Brenchen Posted August 24, 2009 Report Posted August 24, 2009 Hi all, Looking through the FSI parameters, there is a usage one in particular I don't quite understand. For example, I was looking at 0x0D0C for Lights, and in usage there is 1=Nav, 2=Bcn, 4=Land etc... I would suspect there are some use for them somewhere but I dont know how to include them in my code. Also now if I just look at 0x0D0C, I can turn ON the light, but how do I code it so it turns OFF? Just a note, I'm programming in C++. Thanks
Pete Dowson Posted August 25, 2009 Report Posted August 25, 2009 Looking through the FSI parameters, there is a usage one in particular I don't quite understand. Please do NOT use the FSInterrogate parameters as documentation for offsets. I cannot support such use. To start with they are likely to be out of date and even incomplete, and second they simply do NOT contain so much explanation. All of the assistance I provide is in the offset documentation, which you should ALWAYS use. The FSI files are simply an aid to debugging your code when interfacing to FSUIPC. For example, I was looking at 0x0D0C for Lights, and in usage there is 1=Nav, 2=Bcn, 4=Land etc... I would suspect there are some use for them somewhere but I dont know how to include them in my code.Also now if I just look at 0x0D0C, I can turn ON the light, but how do I code it so it turns OFF? 0D0C has ten bits, one for each of 10 lights. When its bit is set to "1" its corresponding light is on. When it is "0", it is off. Simple. Just like a switch. Just a note, I'm programming in C++. If you are programming in such an advanced language then surely you understand bits and bytes? Regards Pete
Brenchen Posted August 25, 2009 Author Report Posted August 25, 2009 Thanks for the reply Pete, I do understand some basic bitwise ops (previously done it with asm's), but I'm only a beginner at C/C++ so it will take some figuring out for me. All of the assistance I provide is in the offset documentation, which you should ALWAYS use. The FSI files are simply an aid to debugging your code when interfacing to FSUIPC. Is it the doc called 'FSUIPC4 Offsets Status.pdf' file? I thought it was written for FSUIPC4 (FSX)? Regards Brendan
Pete Dowson Posted August 25, 2009 Report Posted August 25, 2009 Is it the doc called 'FSUIPC4 Offsets Status.pdf' file? I thought it was written for FSUIPC4 (FSX)? That document gives updated status for FSX. The base document from which it derives and which covers all versions up to FS2004 is called "FSUIPC for Programmers". Regards Pete
Brenchen Posted August 25, 2009 Author Report Posted August 25, 2009 Pete, I've read through your documentation, and also played around with it, but unfortunately I still can't seemed to get that simple function working... All I'm trying to understand is how your 'bits' work. Simple example 0x0262 - Pausing/Unpausing of the sim. When you said 1 is pause, 0 is unpause, I can't seemed to find the relationship between them. What I've done was converting the 262 hex to bin, and saw the last 2 bits were xxx....xx10, and I tried the 0x0262, default is unpausing the sim. So how does the 'Use' fit into this context? If we talk about the lights example, I can't understand how the 10 bits fit into the context of either 0x0D0C (LIGHTS) or even just 0x0280 (NAV), again I didn't quite grasp the offset and how the offset works. Forgive me ignorance questions, I have bit of trouble comprehending text. Regards, Brendan
Pete Dowson Posted August 25, 2009 Report Posted August 25, 2009 All I'm trying to understand is how your 'bits' work. Bits don't "work". Bits are just 1 or 0. They are the smallest unit of information a computer can handle. The word "bit" comes from "Binary digIT". There are 8 bits in a byte. There's really nothing more to understand. They do absolutely nothing by themselves but represent a state, like on or off, or as part of a number, or a program, or a character, or a picture. Simple example 0x0262 - Pausing/Unpausing of the sim. When you said 1 is pause, 0 is unpause, I can't seemed to find the relationship between them. Relationship between what? 0 and 1? There isn't one. The word (2-bytes) at Offset 0x0262 is set to value 1 to pause, or to 0 to unpause. It is as simply as that. What I've done was converting the 262 hex to bin, and saw the last 2 bits were xxx....xx10 Why do you want to decode the offset? That's just an address, a code, a number. 0x0262 is binary 0010 0110 0010, but so what? It is also decimal 610, which you could use instead, but why bother? What are you wanting to manipulate the address of the variable for? The offset just identifies which value it is you want to change, it is NOT the value itself! I really do think you need to learn a little more about computers and programming before tackling a program, and especially before attempting to use C/C++. It is not suitable for beginners in any case. If we talk about the lights example, I can't understand how the 10 bits fit into the context of either 0x0D0C (LIGHTS) or even just 0x0280 (NAV), again I didn't quite grasp the offset and how the offset works. The offset is a number, a token, a name if you like, for the value you want to change. Think of it as a name -- think "Lights" instead of 0x0D0C and you'll be half way there. Forgive me ignorance questions, I have bit of trouble comprehending text. Why don't you look at the examples provided in the SDK then? Can you see the bits about the FSUIPC_Read and FSUIPC_Write functions? Can you not see that the Offset is one parameter and the value is another. When you learn a bit more about programming you will find out about variables, which have names (but can have numbers, or pointers, just like offsets), and values, which are numbers or characters or strings which go into those variables. Or think of the offsets as an array of memory bytes and the numeric value of the address of those is the offset. A slot number. NOT the value which lies inside the memory. Pete
Brenchen Posted August 25, 2009 Author Report Posted August 25, 2009 Sorry Pete, I think I'm really not getting my question across. Basically what I wanted to ask was, for example the Pitot-Heat switch. I understand (in C++): - DWORD dwOffset: 0x029C (hex offsets as per table) - DWORD dwSize: 1 (Size in Bytes as per table) - void *pSrce: chOurKey (from your example "static char chOurKey[] = "IKB3BI67TCHE"; // As obtained from Pete Dowson") - DWORD *pdwResult: &dwResult (defined as 'DWORD dwResult' in the header) The lines of code I used to activate the Pitot Heat are: FSUIPC_Write(0x290C, 1, chOurKey, &dwResult); FSUIPC_Process(&dwResult); The result will only get me to turn ON the Pitot-Heat. Now as per 'Use' column of the table says "Pitot Heat switch (0=off, 1=on)", what is the exact lines of code (using my variables names) that I need to type to get the Pitot-Heat switch to turn OFF? Regards, Brendan
Pete Dowson Posted August 25, 2009 Report Posted August 25, 2009 - DWORD dwOffset: 0x029C (hex offsets as per table) - DWORD dwSize: 1 (Size in Bytes as per table) - void *pSrce: chOurKey (from your example "static char chOurKey[] = "IKB3BI67TCHE"; // As obtained from Pete Dowson") - DWORD *pdwResult: &dwResult (defined as 'DWORD dwResult' in the header) The lines of code I used to activate the Pitot Heat are: FSUIPC_Write(0x290C, 1, chOurKey, &dwResult); FSUIPC_Process(&dwResult); First, don't you see any difference between 0x029C and 0x290C? You cannot program at random like that, you must take a LOT more care!! And where do you get any example for writing a 12 character access key (which your "chOurKey" is -- count them!) to the one byte offset 0x029C? Even you just quoted that it was only one byte long. Can't you even see that 12 bytes don't fit into one byte? What is the point of sending an example Key to it? What do you think you are doing? The Key (which as it actually says, and you are even quoting, has to be obtained from me, Pete Dowson, not from an example in a document) is an unlock key which only needed ever to be written to the 12 byte area at offset 0x8001. So why are you writing it to 0x290C? What did you think that would do? The result will only get me to turn ON the Pitot-Heat. Now as per 'Use' column of the table says "Pitot Heat switch (0=off, 1=on)", what is the exact lines of code (using my variables names) that I need to type to get the Pitot-Heat switch to turn OFF? You just stated it! You need to send value 1 to turn it on, 0 to turn it off. Why don't you actually READ what you quote to me, instead of quoting it so blindly without even reading it? This exchange is getting nowhere. Unless you take more care in reading what is written I see no point in me answering any more of your questions. I really do think you need to learn a lot more about programming, I'm afraid. Do NOT try starting programming by writing a program to interface to FSUIPC. Have a go at a "Hello world" example from a programming tutorial book first, please. You need to understand basic concepts like variables and values. Regards Pete
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now