Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Test Builds => Topic started by: m!m on December 13, 2015, 10:25:59 am

Title: Config files on all platforms
Post by: m!m on December 13, 2015, 10:25:59 am
I added support for using a config file on Windows instead of the registry for storing configuration data for FSO. I also updated wxLauncher to properly support this behavior when an SDL build is selected.

Test builds: http://www.mediafire.com/download/kmzczw19fn784gq/ConfigTest.7z

That file contains new FSO and wxLauncher builds. To test this, unpack the FSO executables into the game root folder and the wxlauncher-0.10.1 folder to a directory of your choosing (don't overwrite your old launcher!).
First you should check if the new builds don't break any existing behavior. To do that, launch one of the builds the same way as usual (e.g. by using wxLauncher) and verify that all settings are still using the old values (if it doesn't then you will notice pretty soon because FSO will only run in 1024x768). If everything works you can try the updated wxLauncher builds.
Go to <path>/wxlauncher-0.10.1/bin and execute the wxLauncher executable in that directory. Select the build you just unpacked, change some settings (e.g. resolution) and launch FSO. If the changed settings are used, post here! If they are not used, also post here!

EDIT: Please also check if all your pilots are present. They are now stored in a user specific folder and not with in the FSO folder. The launcher will copy the files if they aren't present in the user directory so no pilot should be missing. A portable mode is planned but not currently implemented.
Title: Re: Config files on all platforms
Post by: chief1983 on December 13, 2015, 10:36:48 am
Do you mean that the SDL build still supports the registry unless some special flag is sent by the launcher telling it that it can read its settings from config files?  So that both the engine and launcher are backwards and forwards compatible?
Title: Re: Config files on all platforms
Post by: m!m on December 13, 2015, 10:40:36 am
The SDL builds will use the registry if no config file is present. If one is found then only the config file is used. The launcher only has to write the config file, no additional command line option is required.
Title: Re: Config files on all platforms
Post by: chief1983 on December 13, 2015, 12:29:39 pm
So in a launcherless environment, one would have tto manually create the config file first on windows.  Guess that's the best we can hope for for backwards compatibility.
Title: Re: Config files on all platforms
Post by: m!m on December 13, 2015, 12:41:35 pm
If there is no launcher then the code will try to use the registry values so the config handling is fully backwards compatible.
What isn't backwards compatible is the movement from writing stuff into the FSO directory to writing it to a user specific directory (e.g. on Windows that somewhere under Users\...\AppData\Roaming). That needs a launcher to write data to the right place and copy the pilots files when doing the first launch.
As stated in the first post (after the edit) I want to add a portable mode where all data is written to the FSO directory but that is currently not completed.
Title: Re: Config files on all platforms
Post by: mjn.mixael on December 13, 2015, 02:12:37 pm
Just curious.. are there even any legitimate scenarios for a completely launcherless environment? How is that handled on other OS platforms?
Title: Re: Config files on all platforms
Post by: chief1983 on December 13, 2015, 03:07:18 pm
Before wxLauncher, Linux users pretty much had to write config files from scratch.  I think that the configuration system should always be manually editable, but beyond that I don't expect anyone to want to skip using a launcher if one is available.
Title: Re: Config files on all platforms
Post by: m!m on December 13, 2015, 05:27:03 pm
The only thing the launcher does that is a little more complicated to do manually is copying the pilot files. I think the users who configure FSO manually probably can handle executing one command to migrate the pilot files (we could even print that command to stdout).
Title: Re: Config files on all platforms
Post by: jg18 on December 14, 2015, 12:16:45 am
wxL copies the pilot files? Did it always do that? I don't remember there being code for that when I was an active contributor...
Title: Re: Config files on all platforms
Post by: m!m on December 14, 2015, 03:34:54 am
That code was added by me because the directory where FSO saves its pilot files has changed. The launcher automatically copies the pilot files when a build requiring that is launched.
Title: Re: Config files on all platforms
Post by: tomimaki on December 15, 2015, 10:31:06 am
When I choose build in wxlauncher (installed, not from archive), it shows error:
Application was unable to start correctly (0xc000007b). Click ok to close application.

And advanced settings tab shows:
The executable did not generate flag file.
Make sure that the executable is an FS2 Open executable.


Launcher from archive shows this error:
The program can't start because MSVCP140D.dll is missing from your computer. Try reinstalling the program to fix this problem.

Win7, MVC++ 2015 Redistributable is installed.
Title: Re: Config files on all platforms
Post by: chief1983 on December 15, 2015, 10:33:51 am
Could it be the redist for the wrong arch is installed?  There are x86 and x64 versions of the MSVC redistributable.
Title: Re: Config files on all platforms
Post by: m!m on December 15, 2015, 11:07:08 am
<snip>
Thank you for testing the builds!

I accidentally uploaded a debug build which needs the debug redistributable but that's not included in the standard package. Here is a new release build which should hopefully work better: http://www.mediafire.com/download/2eb4692ktm9349k/ConfigFile.7z

I don't know why FSO is crashing when it's launched, I'll try to reproduce that on my computer.
Title: Re: Config files on all platforms
Post by: AdmiralRalwood on December 15, 2015, 11:20:31 am
Had at least two people get exactly the same error (and never found out the cause) with the 64-bit test builds.
Title: Re: Config files on all platforms
Post by: m!m on December 15, 2015, 12:18:30 pm
I tried running the build with my installed version of wxLauncher and when I launch the build wxLauncher crashes. However, when I try launching the build using my development version of wxLauncher everything works fine so I have no idea why it is crashing.
Title: Re: Config files on all platforms
Post by: tomimaki on December 15, 2015, 05:20:39 pm
Now wxlauncher works but executables still crash with the same error.

Never saw this error with custom builds I tried from other topics. :wtf:

edit:
Oh wait. Where is play button? :p
(http://i.imgur.com/aBDH9EJ.jpg)
Title: Re: Config files on all platforms
Post by: m!m on December 16, 2015, 08:48:43 am
The layout of the basic settings page is broken and I don't have any idea how to fix it so until wxLauncher works properly with wxWidgets 3.0 this feature will be put on hold.
Title: Re: Config files on all platforms
Post by: m!m on December 16, 2015, 12:39:13 pm
I finally got wxWidgets 2.8 to compile and managed to compile new builds: http://www.mediafire.com/download/kmzczw19fn784gq/ConfigTest.7z

This should not have the layout issues of the older builds.
Title: Re: Config files on all platforms
Post by: tomimaki on December 17, 2015, 02:00:35 pm
I solved why error 0xc000007b pops up.
Long story short: mess with SDL2.dll for different architectures. :nervous:

Some time ago I tested x64 builds which are linked to SDL2.dll for 64bit.
Now this wxlauncher works with SDL2.dll for 32bit and executables are 32bit too. But exes tried to load dll (named the same for both archs) from root folder. So I deleted dll from fs folder, but executables screamed about missing SDL2.dll, then I copied dll from bin folder to fs folder and error is gone. :)

Anyway after launch it asks to create profile. When I wrote name and pressed enter, I see this:
Selected pilot was created with different language to the currently active language.
Please select different pilot or change language.

It doesn't let me proceed further. I can't create next profile.

Win7 polish and fs english version from GOG.
Title: Re: Config files on all platforms
Post by: niffiwan on December 17, 2015, 03:38:12 pm
That's a FSO message. Unfortunately there's language specific data stored in the pilotfiles which means they're not portable between different languages (why did FSO think it was a good idea to use translated intel names as a key...). If you can't create a new pilot then you might have reached the limit of 20 pilots? Or... if you don't have any pilots at all then maybe there's a permissions issue with writing to the pilot file location? I guess m!m will need to post what the new location is to be able to check that, I'd *guess* it'll be under %APPDATA%?
Title: Re: Config files on all platforms
Post by: m!m on December 17, 2015, 03:54:48 pm
<snip>
Which launcher did you use? My updated build or the old one?

The path should be %APPDATA%\HardLightProductions\FreeSpaceOpen which should be writable for the FSO process. Could you post what the data folder in that directory contains (if it exists at all)?
Title: Re: Config files on all platforms
Post by: tomimaki on December 17, 2015, 04:07:11 pm
Your updated build.
This %APPDATA%\Roaming\HardLightProductions\FreeSpaceOpen exists but I have nothing there.
Title: Re: Config files on all platforms
Post by: m!m on December 20, 2015, 09:54:27 am
That's weird, could you post the contents of %APPDATA%\wxlauncher\wxLauncher.log (obviously after running my wxLauncher build)?
Also make sure that you have selected the correct FSO build, if an old build is used the new behavior will not be triggered.
Title: Re: Config files on all platforms
Post by: tomimaki on December 20, 2015, 01:32:33 pm
Oh, silly me. :ick:
I just renamed wxlauncher folder in Appdata\Roaming, so tested launcher doesn't use old data. Then all works ok.
I could create pilot and start mission, fs2_open.log is created in AppData\Roaming\HardLightProductions\FreeSpaceOpen\data.

Seems this launcher doesn't like profiles created by normal wxlauncher.
Title: Re: Config files on all platforms
Post by: m!m on December 20, 2015, 03:10:50 pm
That's odd. Which launcher version are you using? I'm guessing 0.10.1. I'll try to reproduce this issue.
Title: Re: Config files on all platforms
Post by: tomimaki on December 20, 2015, 03:41:34 pm
Yes, 0.10.1.
Title: Re: Config files on all platforms
Post by: m!m on December 21, 2015, 08:34:01 am
I can't reproduce it here, everything works fine when switching between the launcher versions.
Could you post the old wxLauncher log file here?
Title: Re: Config files on all platforms
Post by: tomimaki on December 21, 2015, 03:49:21 pm
Launcher 0.10.1, tested fso - wxlauncher crash when I try to play
Launcher 0.10.1, nightly fso - ok, pilots from game\data\players
Launcher test, tested fso - ok, pilots from AppData\Roaming\HardLightProductions\FreeSpaceOpen\data\players
Launcher test, nightly fso - ok, pilots from game\data\players

Tested launcher never copied pilots to new location.

Log from 0.10.1 when crash
Code: [Select]
15355211327:INFO :wxLauncher Version 0.10.1
15355211327:INFO :Build "7dffa3aced" committed on (Tue Sep 22 21:03:26 2015 -0600)
15355211327:INFO :12/21/15 22:13:27
15355211327:INFO :Initializing profiles...
15355211327:INFO : My profiles file is: C:\Users\Tomi\AppData\Roaming\wxlauncher\global.ini
15355211327:INFO : Found 1 profile(s).
15355211327:INFO :Initializing SkinSystem...
15355211327:INFO :Initializing HelpManager...
15355211327:INFO :Initializing FlagListManager...
15355211327:INFO :Initializing ProfileProxy...
15355211327:INFO :wxLauncher starting up.
15355211327:STSBR:Profile 'Default' saved
15355211327:STSBR:Now autosaving profiles.
15355211327:ERROR:file '': unexpected character
15355211329:STSBR:MainWindow is complete
15355211329:STSBR:Ready.
15355211329:ERROR:file '': unexpected character
15355211330:INFO :The current game root folder is D:\FreeSpace2
15355211330:INFO : Found 38 FS2 Open executables in 'D:\FreeSpace2'
15355211330:WARN :Revision version number out of range (175640) in executable fs2_open_3_7_3_SSE2_20151216_175640d-DEBUG.exe
15355211330:WARN :Revision version number out of range (175640) in executable fs2_open_3_7_3_SSE2_20151216_175640d.exe
15355211330:WARN :Token ending in 'd' is not a number (7badc4d) in executable fs2_open_3_7_3_SSE2_20151217_7badc4d-DEBUG.exe
15355211330:WARN :Token ending in 'd' is not a number (7badc4d) in executable fs2_open_3_7_3_SSE2_20151217_7badc4d.exe
15355211331:INFO :Detected OpenAL version: 1.1 ALSOFT 1.17.1

Log from tested launcher
Code: [Select]
15355210536:INFO :wxLauncher Version 0.10.1
15355210536:INFO :Build "123456789abc+ unknown custom tip" committed on (Thu Jan 01 00:00:00 1970 -0000)
15355210536:INFO :Mon Dec 21 22:05:36 2015
15355210536:INFO :Initializing profiles...
15355210536:INFO : My profiles file is: C:\Users\Tomi\AppData\Roaming\wxlauncher\global.ini
15355210536:INFO : Found 1 profile(s).
15355210536:INFO :Initializing SkinSystem...
15355210536:INFO :Initializing HelpManager...
15355210536:INFO :Initializing FlagListManager...
15355210536:INFO :Initializing ProfileProxy...
15355210536:INFO :wxLauncher starting up.
15355210536:STSBR:Profile 'Default' saved
15355210536:STSBR:Now autosaving profiles.
15355210537:ERROR:file '': unexpected character
15355210538:STSBR:MainWindow is complete
15355210538:STSBR:Ready.
15355210539:ERROR:file '': unexpected character
15355210540:INFO :The current game root folder is D:\FreeSpace2
15355210540:INFO : Found 38 FS2 Open executables in 'D:\FreeSpace2'
15355210540:WARN :Revision version number out of range (175640) in executable fs2_open_3_7_3_SSE2_20151216_175640d-DEBUG.exe
15355210540:WARN :Revision version number out of range (175640) in executable fs2_open_3_7_3_SSE2_20151216_175640d.exe
15355210540:WARN :Token ending in 'd' is not a number (7badc4d) in executable fs2_open_3_7_3_SSE2_20151217_7badc4d-DEBUG.exe
15355210540:WARN :Token ending in 'd' is not a number (7badc4d) in executable fs2_open_3_7_3_SSE2_20151217_7badc4d.exe
15355210540:INFO :Detected OpenAL version: 1.1 ALSOFT 1.17.1
15355210546:INFO :Detected OpenAL version: 1.1 ALSOFT 1.17.1
15355210555:INFO :FS2 Open is now running...
15355210951:INFO :FS2 Open exited with a status of 0
15355211007:INFO :saving global profile before exiting.
15355211007:INFO :autosaving profile Default before exiting
15355211008:STSBR:Profile 'Default' saved
15355211008:INFO :wxLogger shutdown complete.

Log closed.
Title: Re: Config files on all platforms
Post by: Bryan See on January 02, 2016, 12:27:55 pm
Check your config parser. Is there something wrong with it?
Title: Re: Config files on all platforms
Post by: Bryan See on January 09, 2016, 01:01:04 pm
I've tested this build, and when I try to type in a new pilot name, it refuses because of the different language. Closing FSO will result in the error.

Code: [Select]
Error: Couldn't load pilot file, bailing
File: playermenu.cpp
Line: 499

ntdll.dll! ZwWaitForSingleObject + 12 bytes
KERNELBASE.dll! WaitForSingleObject + 18 bytes
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
fs2_open_3_7_3_SSE2-DEBUG.exe! <no symbol>
KERNEL32.DLL! BaseThreadInitThunk + 36 bytes
ntdll.dll! RtlUnicodeStringToInteger + 595 bytes
ntdll.dll! RtlUnicodeStringToInteger + 542 bytes
Title: Re: Config files on all platforms
Post by: m!m on January 12, 2016, 08:55:16 am
Have you set a different message in your current registry settings?
I just realized that when using a config file, FSO doesn't read the language setting from the registry and then uses the default which is English because the config file doesn't contain that value. Trying to load a previous pilot will then obviously result in issues. I'll fix that by transferring the old value when wxLauncher creates the file for the first time.

I don't understand why FSO has issues when creating a new pilot because then the language should be the same. I'll need to know a few things about your system to reproduce this issue:
Title: Re: Config files on all platforms
Post by: Bryan See on January 14, 2016, 09:43:15 am
No. There's no registry settings. I used command line settings. I did not used the updated wxLauncher (i.e. the latest version which do not have a registry helper). I used the recent version on my laptop, as this is brand new. I did not change the language setting in the registry.
Title: Re: Config files on all platforms
Post by: m!m on March 12, 2016, 11:59:36 am
I have worked a bit more on these builds. The new wxLauncher now copies all configuration found in the registry to the new config file so nothing gets lost even if the launcher doesn't use a specific option. To test this properly you will need to delete all files in %AppData%\HardLightProductions\FreeSpaceOpen if the directory exists. Before using the new launcher, start one of the new builds using the old launcher to confirm that it can still properly launch these new builds. After that try launching one of the new builds using the new launcher and check if anything is wrong.

Link to new launcher: http://www.mediafire.com/download/ecfiooto5pimghl/wxlauncher-0.10.1.zip
Link to new builds: http://www.mediafire.com/download/aduvyjz7o3arhji/NewConfigBuilds.zip
Title: Re: Config files on all platforms
Post by: tomimaki on March 15, 2016, 05:05:36 pm
Do these new builds need sdl2.dll? What version?
Title: Re: Config files on all platforms
Post by: m!m on March 15, 2016, 05:08:59 pm
Yes, they require SDL. You can use the DLL from the SDL homepage: https://www.libsdl.org/release/SDL2-2.0.4-win32-x86.zip
Title: Re: Config files on all platforms
Post by: tomimaki on March 15, 2016, 05:24:22 pm
Ok.
In old wxlauncher I selected new build and tried to play but launcher crashed.
Exception error: c0000005
Title: Re: Config files on all platforms
Post by: m!m on March 15, 2016, 05:34:32 pm
Please post you launcher log located at %APPDATA&\wxlauncher\wxLauncher.log
Title: Re: Config files on all platforms
Post by: tomimaki on March 15, 2016, 05:40:21 pm
Code: [Select]
16075223900:INFO :wxLauncher Version 0.10.1
16075223900:INFO :Build "7dffa3aced" committed on (Tue Sep 22 21:03:26 2015 -0600)
16075223900:INFO :03/15/16 23:39:00
16075223901:INFO :Initializing profiles...
16075223901:INFO : My profiles file is: C:\Users\Tomi\AppData\Roaming\wxlauncher\global.ini
16075223901:INFO : Found 8 profile(s).
16075223901:INFO :Initializing SkinSystem...
16075223901:INFO :Initializing HelpManager...
16075223901:INFO :Initializing FlagListManager...
16075223901:INFO :Initializing ProfileProxy...
16075223901:INFO :wxLauncher starting up.
16075223901:STSBR:Profile 'Freespace2' saved
16075223901:STSBR:Now autosaving profiles.
16075223901:ERROR:file '': unexpected character
16075223902:STSBR:MainWindow is complete
16075223903:STSBR:Ready.
16075223903:ERROR:file '': unexpected character
16075223904:INFO :The current game root folder is D:\FreeSpace2
16075223904:INFO : Found 8 FS2 Open executables in 'D:\FreeSpace2'
16075223904:INFO : Found 6 FRED2 Open executables in 'D:\FreeSpace2'
16075223904:INFO :Detected OpenAL version: 1.1 ALSOFT 1.17.2
Title: Re: Config files on all platforms
Post by: m!m on March 16, 2016, 05:05:07 am
Sadly there isn't much information in that log :blah:
Does it work with the launcher I uploaded? If it does then we'll just have to wait until it can be reproduced by someone who can build and debug wxLauncher.
Title: Re: Config files on all platforms
Post by: tomimaki on March 16, 2016, 11:48:00 am
Some further testing. :drevil:
I tried directly start new build but it crashed:
Code: [Select]
Problem Event Name: BEX
  Application Name: fs2_open_3_7_5_SSE2_config.exe
  Fault Module Name: StackHash_0a9e
  Exception Code: c0000005
but then I copied SDL2.dll from archive with new wxlauncher. Old wxlauncher still crashes, but directly start worked.

Yes, new builds work with new wxlauncher. All saves were copied to new location.
So only problem is with combination: old (default) wxlauncher - new builds.
Title: Re: Config files on all platforms
Post by: m!m on March 16, 2016, 01:29:15 pm
If the new launcher works properly then I think this should be good to merge into antipodes.
Title: Re: Config files on all platforms
Post by: Bryan See on July 27, 2016, 07:25:33 am
Have this merged into antipodes or master branches lately?
Title: Re: Config files on all platforms
Post by: m!m on July 27, 2016, 08:17:06 am
The changes have been merged into antipodes a long time ago and since antipodes has been merged into master these changes are also included in the current master branch.
Title: Re: Config files on all platforms
Post by: Bryan See on July 28, 2016, 12:00:02 pm
Good, regarding config files, where can I place them or how can I create them?
Title: Re: Config files on all platforms
Post by: The E on July 28, 2016, 12:30:05 pm
Bryan, the files under discussion here are things like player profiles, campaign savegames, and all the .cfgs that were previously dumped into the data directory. They now live at %appdata%\HardLightProductions\FreeSpaceOpen\data
Title: Re: Config files on all platforms
Post by: chief1983 on July 28, 2016, 12:36:59 pm
Also the data that used to live in the registry on Windows now lives in fs2_open.ini like on the other platforms.
Title: Re: Config files on all platforms
Post by: Bryan See on July 30, 2016, 06:50:27 am
Thanks for the heads-up, The E and chief1983, but... how does the fs2_open.ini look like in terms of content itself? Much like the mod INI files that reside on mod folders?

EDIT: Wxlauncher crashes upon starting the latest Nightly Build that has the capability to save/load config files.
Title: Re: Config files on all platforms
Post by: chief1983 on July 30, 2016, 07:25:48 am
Wxlauncher will create that file for you, no need to mess with it yourself.
Title: Re: Config files on all platforms
Post by: Bryan See on July 30, 2016, 01:48:15 pm
What happens if I mess it up, then wxLauncher will correct it, otherwise FSOpen will fail to start badly?
Title: Re: Config files on all platforms
Post by: chief1983 on July 30, 2016, 01:53:13 pm
Wxlauncher doesn't have ini autocorrect, if you mess it up by hand it will probably just ignore lines or crash altogether.  There is a bug where the launcher may have written arguments in a case that fso won't read correctly though, I mean to file an issue to get that addressed at some point.