bvbohnen / x4-projects

Parent repo for other X4 projects, with shared code for documentation and release generation.
MIT License
42 stars 12 forks source link

Some options do not save properly #14

Closed MrSmite closed 1 year ago

MrSmite commented 1 year ago

API version: 1.88 x4 version: 5.10 HF3

When you open the "extension options" menu and change some of the options on the main page, they don't retain their settings when you load your save. For example, the options to disable help popups alwas revert to "off".

bvbohnen commented 1 year ago

The options should be stored in the uidata.xml file in your profile, eg. documents/egosoft/x4/####/uidata.xml. That particular option would be under "disable_helptext". If you change the option in game and exit the game or load a different save, does the file update with the new setting? (It should change, and still does for me in the current patch.)

There is also a backup copy of the settings stored in each save, but that should only be used to restore settings that werent found in uidata.xml, eg. if the mod were disabled and later reenabled.

MrSmite commented 1 year ago

Thanks for the info. I loaded a save and changed the options from "off" to "on" and then exited. In my uidata.xml I have:

uidata.xml

["disable_animations"]=0.000000,
["disable_helptext"]=0.000000,

In my programming experience, "on" should be 1.000000 so they're still "off" according to the xml. And I don't see these values in my save file. The only thing I have related to them is just the text definitions

save_001.xml

<value name="$disable_helptext_name" type="string" value="55874"/>
<value name="$disable_animations_name" type="string" value="55870"/>

I have a couple other mods that add options to that screen and their options also do not save:

Better Target Monitor

I set "show x3 class" to "off" but xml file shows: _["tm_show_x3class"]=1.000000

Civilian Fleets

I set auto rename to "off" but xml file shows: _["v1024cf_renamefleets"]=1.000000,

If you can give me debug instructions I'll try it. Right now turning on "all logs" just dumps a ton of information that isn't easy to sort through in Notepad++. Oh and I should mention this is a Windows 7 Pro x64 machine.

bvbohnen commented 1 year ago

Do the uidata.xml and save files have a "__MOD_USERDATA" entry? Do standard uidata entries update properly, eg. settings under __CORE_DETAILMONITOR_MAPFILTER?

If you are willing to spend some time digging through the code, you can grab the sn_mod_support_apis contents from git and use them instead of the packed versions. (Keep the subst cat/dat since it is needed for lua stuff.) You can also unpack the packed cat/dat version directly, but everything inside is in txt format so you will lose syntax highlights, and the folder layout is flattened.

lua/userdata/Interface.lua and md/Userdata.xml have the relevant bits. To print to the log, you can use DebugError in lua or debug_text in md.

MrSmite commented 1 year ago

Yes, the data under ___CORE_DETAILMONITORMAPFILTER in uidata.xml is saved correctly.

My uidata.xml has the ___MODUSERDATA entry with a bunch of name/value pairs but the only time it appears in my save file is as a definition:

``

``

It doesn't appear again and unfortunately 15429 is too generic to search for, it appears in several "seed" values throughout my save, for example:

_source job="xenon_fighter_patrol_s_zonespl" seed="15429291907160810296" sector="[0xfbf]" zone="[0xfe3]" commandeerable="1" class="job"

I tried editing the uidata.xml file manually and reloading and the options are loaded correctly so it appears the issue is with writing values, not reading. This also isn't effecting any of the mods that use the API. All the submods that I click on at the top save properly (except 1 option from a mod by Kuertee) but those aren't saved in uidata.xml so that might be why.

Also, I can't get the game to load if I try to use the API unpacked. It's a problem I have with many mods on Windows 7.

bvbohnen commented 1 year ago

I don't see any problems after a quick code review, so it is hard to give suggestions. Maybe you can unpack, edit, and repack to test things. Or you can just use out-of-game uidata.xml editing instead (though there is some danger of putting in values a mod won't support). Or perhaps changing some egosoft setting (looks like mostly map stuff) after changing mod settings will trigger a uidata write with all changes.

Though I will say that my win7->10 free upgrades a couple years ago went smoothly.