Page 1 of 1

Directories not remembering changes

Posted: Sun Oct 29, 2017 11:47 pm
by DigitalVB-M

Hey there, not sure if this is the proper forum to post in. If so, sorry about that, I'll rewrite this in the proper one.

 

The problem I'm having is that the directories in Options > Directories... doesn't save what I put in there when I close VBA-M. It works when I put it in before playing but turns blank when I close the program and then open the program. I've tried running it in administrator mode but same result.

 

I'm using the 2.0.1 version if it helps.


Directories not remembering changes

Posted: Sun Nov 05, 2017 5:45 pm
by turtleneckthomas

This bug has been reported on github.

 

I am trying to resolve it myself though because I don't really want to wait for the next push.

 

PERTAINING TO GBA BIOS

 

Unfortunately I am not familiar with wxWidgets nor this codebase but I am syphoning through it to try and find the solution.

 

Can a developer confirm if this is where the code is being handled to load the configuration settings?

 

CPUInit(gopts.gba_bios.mb_fn_str(), useBiosFileGBA); It is defined @ panel.cpp line 285

 

CPUInit is also called like this

CPUInit(biosFileNameGBA, useBios); @ SDL.cpp line 1825

 

This function loads in the bios file name. It is defined @ GBA.cpp line 3298

 

The bios file name grabs the value from the config from function LoadConfig @ ConfigManager.cpp line 464

with this:

biosFileNameGBA = ReadPrefString("biosFileGBA");

 

LoadConfig() is called @ SDL.cpp on line 1718

 

with this comment:

LoadConfig(); // Parse command line arguments (overrides ini)

 

so according to this LoadConfig is only used to override the ini setting when vba-m has additional command line arguments.

 

So we need to find where the config settings are initially loaded from when the application is launched...

which seem to be using this object gopts...which as far as i can tell is defined in opts.cpp line 38...

opts_t gopts;

opts_t also defines some ui component

wxString gba_bios

this array opt_desc opt

contains

STROPT("GBA/BiosFile", "", wxTRANSLATE("BIOS file to use, if enabled"), gopts.gba_bios),

 

This defines a section and the corresponding ini setting to search for. Then I think it's taking that value and setting it to the object string gopts.gba_bios.

if i try to force "BiosFile" in the GBA section of the ini though it doesn't do anything. In fact after I load an instance of vba-m and exit it deletes the line with "BiosFile".

 

There is a line that says "biosFileGBA" in the ini however. If I change the above line to

STROPT("GBA/biosFileGBA", "", wxTRANSLATE("BIOS file to use, if enabled"), gopts.gba_bios)

this doesn't fix anything.

 

So the problem stems deeper into how vba-m is actually reading and writing to the ini/cfg file.

 

This function:

void OpenPreferences(const char *name)

{

Code: Select all

if (!preferences && name)


	preferences = iniparser_load(name);

}

 

is actually reading from the config.ini file

 

it calls a function iniparser_load which returns a dictionary. it has this description

This is the parser for ini files. This function is called, providing

the name of the file to be read. It returns a dictionary object that

should not be accessed directly, but through accessor functions

instead.

 

So now I'm at a wall because I don't have VS2013 I can't properly build the project to actually debug this and see what iniparser_load is returning

 

on top of this i am not so familiar with c/c++ but I believe this may be the root of the problem?