Merge pull request #254 from mjbudd77/master

For Qt/SDL port, added logic to always attempt to resolve the absolute path to the ROM…
This commit is contained in:
mjbudd77 2020-12-09 23:05:17 -05:00 committed by GitHub
commit 650d9eb472
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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) int LoadGame(const char *path, bool silent)
{ {
char fullpath[4096];
int gg_enabled, autoLoadDebug, autoOpenDebugger, autoInputPreset; int gg_enabled, autoLoadDebug, autoOpenDebugger, autoInputPreset;
if (isloaded){ if (isloaded){
CloseGame(); 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 // For some reason, the core of the emulator clears the state of
// the game genie option selection. So check the config each time // the game genie option selection. So check the config each time
// and re-enable the core game genie state if needed. // 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); FCEUI_SetGameGenie (gg_enabled);
if(!FCEUI_LoadGame(path, 1, silent)) { if(!FCEUI_LoadGame(fullpath, 1, silent)) {
return 0; return 0;
} }