Jump to content

ARCADE 0.188


Robert
 Share

Recommended Posts

Aha I could replicate it. I altered gui\interface.ini and added a long line of zzzzzzzzz after my correct folder name. Then I started Arcade32 and quit. Then I checked ini\ui.ini and the historypath just says J.

Link to comment
Share on other sites

Found the problem and added a solution.

 

The issue is that when you call 'set_value', it can corrupt the data you pass to it. So, "path" turned into garbage, so garbage was written to ui.ini.

 

I made a temporary variable and copied "path" to it, then use the temporary variable on the 2nd write.

 

 

 

It might be wise in the future to note that once any variable is passed to set_value, that variable becomes useless.

  • Like 1
Link to comment
Share on other sites

 

So looks like the problem is here:

void OptionsInit(void)
{
	// setup our INI folder
	SetIniDir("ini");
	// gamelist creation
	game_opts.add_entries();
	// now load the options and interface settings
	LoadOptionsAndInterface();
	// setup directory for datafiles in the Internal UI
	SetDatsDir(GetDatsDir());
}

?Specifically, these seems have broken during 0.187-0.188 development cycle:
const char * GetDatsDir(void)
{
	return winui_opts.value(MUIOPTION_DATS_DIRECTORY);
}

void SetDatsDir(const char *path)
{
	winui_opts.set_value(MUIOPTION_DATS_DIRECTORY, path, OPTION_PRIORITY_CMDLINE);
	ui_opts.set_value(OPTION_HISTORY_PATH, path, OPTION_PRIORITY_CMDLINE);
	SaveInternalUI();	// ensure we store again the new dats dir for the core
}

I don't know what could happened, because all worked as expected in 0.187. Also, I'm still not able to reproduce this. My UI.INI didn't get corrupted and the value from INTERFACE.INI is correctly copied.

Mistery.

Found the problem and added a solution.

 

The issue is that when you call 'set_value', it can corrupt the data you pass to it. So, "path" turned into garbage, so garbage was written to ui.ini.

 

I made a temporary variable and copied "path" to it, then use the temporary variable on the 2nd write.

 

 

 

It might be wise in the future to note that once any variable is passed to set_value, that variable becomes useless.

 

That's good news!

I'm glad that you found the cause. :cat:

 

Anyway, it’s really mystery that it doesn’t occur depending on the environment.

Edited by demonkatze
Link to comment
Share on other sites

@ Robbberto, are you going to release ARCADE 0.188a like you did with MAMEUI 0.188a? Because that was a pretty significant bugfix. And also it would give us a chance to sniff out any other bugs before the v0.189 release.

Link to comment
Share on other sites

No, because we are using pointers to the memory holding the contents of path. If your suggestion was used, t1 will simply point at path. Then when path gets corrupted, t1 will be corrupt too, since it is looking at the same part of memory.

By making a copy, each one gets its own section of memory.

Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

×
×
  • Create New...