Jump to content
The simFlight Network Forums

Writing payload via 0x1400 (FS9)

Recommended Posts


I am trying to write some weight on one specific station, but it doesm't work.

Maybe I didn't understand the documentation about offset 0x1400. My code is:


DWORD dwResult;

FSUIPC_Write(0x1400, 48*2, 1000, &dwResult);



I like to write 1000lbs to station number 2. My airplane has 8 stations.

I think there is something wrong on my code ;).

Thanks you very much!

Link to comment
Share on other sites

Maybe I didn't understand the documentation about offset 0x1400. My code is:

Can you explain what you think this line is supposed to mean?

FSUIPC_Write(0x1400, 48*2, 1000, &dwResult);

It makes no sense, it does not fit the template, and should not even compile. There's no pointer to the data to be written, and which value is supposed to be the data length?

Please take a look at some examples, or at least read the parameter definitions so you know what the Function needs for its parameters.



Link to comment
Share on other sites

Where can I find some examples?

First of all, you are writing in C or C++. Have you used the language before? Just match up what you wrote:

FSUIPC_Write(0x1400, 48*2, 1000, &dwResult);

to the prototype defnition for that function as declared in the Header (FSUIPC_User.h):

extern BOOL FSUIPC_Write(DWORD dwOffset, DWORD dwSize, void *pSrce, DWORD *pdwResult);

Now, don't you see anything amiss? Check each parameter. For size you have 48*2 -- i.e. 96 bytes. For the pointer to these 96 bytes you have "1000". But 1000 is a number! If it is treated as a pointer it will point to 96 bytes at address 1000 in memory That's not even going to be in your program, so will cause an access protection error.

This is why I asked you what you thought you meant by the line you wrote. I cannot understand what you are thinking. If you want to write 96 bytes you need to prepare an array of 96 bytes, or a structure of that length, with all the data you need already inserted! And provide the pointer to it!

Maybe you are only begnning with C? If so, I should warn you that interfacing to fSUIPC is not really a beginner's project. You should really look, perhaps, at using a Lua plug-in

For examples of FSUIPC_Read and FSUIPC_Write in use, check the UIPCHello source in theUIPC_SDK_C.zip package part of the SDK.

I studied the docs ...

Odd. Everyone says that, and sometimes "many times", but still manage to show they either have not or have skipped over some essential parts altogether.

... but there is nothing exactly what I want to do?

Of course, not exactly, It would be impossible to provde code examples for every possible thing folks wanted to do! But reading and writing offsets is not really very different from one offset to another. And the "ReadThis.txt" file in the C parackage does explain things which you have apparently ignored, as in this part which I quote with emphasis on the relevant part you seem not to have read:

The following Library calls are used to accumulate Read and Write requests:

BOOL FSUIPC_Read(DWORD dwOffset, DWORD dwSize,

void *pDest, DWORD *pdwResult);

BOOL FSUIPC_Write(DWORD dwOffset, DWORD dwSize,

void *pSrce, DWORD *pdwResult);

In both cases you supply an offset, identifying the data required or to be

written, and a size (in bytes). The pointers "pDest" for reads and "pSrce"

for writes naturally must point to the area to receive the result or (for

writes) the area containing the data to be written. These pointers are defined

as "void *" here so that you can use whatever component size or structure you

like, as appropriate for the data in question.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.