Added logic to always attempt to resolve the absolute path to the ROM file when loading a new game.

This commit is contained in:
Matthew Budd 2020-12-09 21:48:17 -05:00
parent 9e6c963733
commit 03390b4d89
1 changed files with 15 additions and 1 deletions

View File

@ -206,12 +206,26 @@ int reloadLastGame(void)
*/
int LoadGame(const char *path, bool silent)
{
char fullpath[4096];
int gg_enabled, autoLoadDebug, autoOpenDebugger, autoInputPreset;
if (isloaded){
CloseGame();
}
#if defined(__linux) || defined(__APPLE__)
// Resolve absolute path to file
if ( realpath( path, fullpath ) == NULL )
{
strcpy( fullpath, path );
}
#else
strcpy( fullpath, path );
#endif
//printf("Fullpath: %zi '%s'\n", sizeof(fullpath), fullpath );
// For some reason, the core of the emulator clears the state of
// the game genie option selection. So check the config each time
// and re-enable the core game genie state if needed.
@ -219,7 +233,7 @@ int LoadGame(const char *path, bool silent)
FCEUI_SetGameGenie (gg_enabled);
if(!FCEUI_LoadGame(path, 1, silent)) {
if(!FCEUI_LoadGame(fullpath, 1, silent)) {
return 0;
}