Jump to content
The simFlight Network Forums

A few SDK questions


Recommended Posts

Hi Pete,

I have a few SDK questions:

1) Is there any way to reliable know when a player has saved the current flight ?

I have looked into offset 3F02 and 3F04 but those only get updated on flight load, not save. I think I remember seeing something that I can find out the last selected menu but I won't know if the menu action was actually performed or not.

Ideally I need to know when a flight got saved and the new saved flight name.

2) What is the most reliable way to check if the user changed the plane ? Right now I use offset 3D00 (aircraft name) and compare it with the previous one all the time until it changes. This seems to work fine, I'm just wondering if there is a more elegant solution.

3) While in the menu or during game load the payload station count (13FC) is set to 0. Is that intentional ?

4) When writing 0xFF000800 to 0x32F0 in order to disable the Aircraft menu, it also disables the World menu. The same is true for bit 12 and 13. Is that a bug or intentional or am I doing something wrong ?

Thanks for your help !

Matthias

Link to comment
Share on other sites

1) Is there any way to reliable know when a player has saved the current flight ?

No, not at present. FSUIPC doesn't currently detect flights being saved. I'm not sure without research whether it could do it reliably.

I have looked into offset 3F02 and 3F04 but those only get updated on flight load, not save. I think I remember seeing something that I can find out the last selected menu but I won't know if the menu action was actually performed or not.

Flight saving doesn't need menu access in any case. You can do it by pressing ; and giving a name. This doesn't use the menus.

Furthermore, modules and gauges can save flights "surreptitiously". In fact my own AutoSave does just this -- it saves flights on a regular selected basis without any menu or user action.

Ideally I need to know when a flight got saved and the new saved flight name.

Well, I'm not sure I can do that. I could maybe add it to my list, but I would like to know the reasons please.

2) What is the most reliable way to check if the user changed the plane ? Right now I use offset 3D00 (aircraft name) and compare it with the previous one all the time until it changes. This seems to work fine, I'm just wondering if there is a more elegant solution.

The main thing to check first is the AIR file change counter at 32FC. This may of course change when the user reloads the same aircraft -- but you cannot tell if any of the files have been changed in the interim. Sorry, there's no way I could detect that. If all you need to know is that there is a possibility of change, then merely seeing the count change would be sufficient.

3) While in the menu or during game load the payload station count (13FC) is set to 0. Is that intentional ?

I'm not setting anything to anything. It may be that FS is doing this, or simply that the memory being addressed isn't accessibly during such times.

4) When writing 0xFF000800 to 0x32F0 in order to disable the Aircraft menu, it also disables the World menu. The same is true for bit 12 and 13. Is that a bug or intentional or am I doing something wrong ?

I have no idea. These facilities have not been revised at all specifically for FS2004, so possibly it is some change there which is affecting this. If it does what you say I would call it a bugbut I shall need to verify this and then correct it. Do you have a demo program which I can use to check it? I am tied up with other matters for a few days but I can look at this early next week.

Regards,

Pete

Link to comment
Share on other sites

Hi Pete,

thanks for the response.

1) I am working on an addon that tracks specific information during a users flight. I would like to save my addon data automatically when the user saves his current flight. So when the user reloads the flight at some other point in time I could also get my addon data/state back automatically as well.

As it stands I have only the option of an autosave at certain intervals or the need for the user to do an additional save of my plugin data within my plugins interface.

2) 32FC: That's exactly what I was looking for, so I only need to read that WORD regularly and read the name and other details as needed.

3) No problem, I was just wondering.

4) I guess it is a bug then. Sorry, I don't have a program to give you for testing but you can easily reproduce it with FSInterrogate. There is no rush at all, I'm still ways away from finishing.

Matthias

Link to comment
Share on other sites

I would like to save my addon data automatically when the user saves his current flight. So when the user reloads the flight at some other point in time I could also get my addon data/state back automatically as well.

Oh yes, I see. I will add it to my list. It should be easy enough, but I really don't want to allocate space for another filename string. I may consider just changing a "save" count somewhere you can read and updating the Loaded FLT pathname at 3F04 but without changing the 'load' count. The only problem then is that the currently loaded FLT name may change to an AutoSaved one pretty soon after loading -- I wouldn't be able to easily distinguish auto-saved flights from user-saved ones.

4) I guess it is a bug then. Sorry, I don't have a program to give you for testing but you can easily reproduce it with FSInterrogate. There is no rush at all, I'm still ways away from finishing.

Okay, I'll check it out.

Regards,

Pete

Link to comment
Share on other sites

Great ! The 'save' change would be fantastic and would streamline the whole thing so much.

Using the loaded filename area is just fine with me. I assume there will always be a few seconds window to read it before it gets replaced.

I guess the only issue may be compatibility with projects that already use that facility as it is.

Thanks,

Matthias

Link to comment
Share on other sites

Great ! The 'save' change would be fantastic and would streamline the whole thing so much.

I had a look, and it was pretty easy. I also found the menu bug -- looks like it's been that way for a *long* time. Evidently not many folks using it for individual menus.

The saved flight filename system will be as follows:

A 16-bit (2 byte) count will be updated at offset 3BD4 each time a flight is saved, no matter by whom or how.

To get the name of the last saved flight, you will need to use the "path reading" mechanism operating on offsets 0FF0-10FF. This is described in the text section of the Programmer's Guide already. The last saved flight will be using a 3 in the Command Word.

Note that flights are normally saved to the default Flights path, and this won't be included in the flight filename you read. The best thing to do is use the path reading facility once only, when you first get connected, with command word = 1, then prepend the path to the filename (check that there's a separating \ character) before using it.

I've made the changes but its getting very late here now so I won't test till tomorrow sometime. If you want an interim version to check out, please email me on petedowson@btconnect.com. Otherwise it'll be in the next general release, probably 3.24 in two weeks.

Regards,

Pete

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.