MCPcopy Create free account
hub / github.com/TASEmulators/fceux / ALoad

Function ALoad

src/drivers/win/window.cpp:1081–1175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1079}
1080
1081bool ALoad(const char *nameo, char* innerFilename, bool silent)
1082{
1083 FILE* patchTrial = fopen(nameo, "rb");
1084 if(patchTrial)
1085 {
1086 char sig[10] = {0};
1087 fread(sig,1,5,patchTrial);
1088 fclose(patchTrial);
1089 if(!strcmp(sig,"PATCH"))
1090 {
1091 //assuming it's a patch:
1092
1093 //if nothing's loaded, we can't load this
1094 if(!LoadedRomFName[0])
1095 return false;
1096
1097 //ok, set this as a patch and load it
1098 //use a temp std::string to avoid problems copying from LoadedRomFName, to LoadedRomFName
1099 //pass nullptr as innerFilename -- see, it's not used here anyway
1100 strcpy(LoadedRomFNamePatchToUse,nameo);
1101 std::string tmp_LoadedRomFName = LoadedRomFName;
1102 bool ret = ALoad(tmp_LoadedRomFName.c_str(),nullptr,silent);
1103
1104 //clear the patch file. FCEUX doesn't seem to ever reload the roms (?) so it can't need to reuse it
1105 //and if it does.. well.. it won't be patched.
1106 //there's only so much we can do with this old framework
1107 LoadedRomFNamePatchToUse[0] = 0;
1108
1109 return ret;
1110 }
1111 }
1112
1113
1114 int oldPaused = EmulationPaused;
1115
1116 // loading is not started yet, so the game can continue;
1117 // FCEUI_LoadGameVirtual() already had an FCEUI_CloseGame() call after loading success;
1118 // if (GameInfo) FCEUI_CloseGame();
1119
1120 if (FCEUI_LoadGameVirtual(nameo, !(pal_setting_specified || dendy_setting_specified), silent))
1121 {
1122 pal_emulation = FCEUI_GetCurrentVidSystem(0, 0);
1123
1124 UpdateCheckedMenuItems();
1125
1126 PushCurrentVideoSettings();
1127
1128 std::string recentFileName = nameo;
1129 if(GameInfo->archiveFilename && GameInfo->archiveCount>1)
1130 recentFileName = (std::string)GameInfo->archiveFilename + "|" + GameInfo->filename;
1131 else
1132 recentFileName = nameo;
1133
1134 AddRecentFile(recentFileName.c_str());
1135
1136 RefreshThrottleFPS();
1137
1138 if(eoptions & EO_HIDEMENU && !tog)

Callers 5

emu_loadromFunction · 0.85
LoadRecentRomFunction · 0.85
LoadNewGameyFunction · 0.85
AppWndProcFunction · 0.85
mainFunction · 0.85

Calls 15

FCEUI_LoadGameVirtualFunction · 0.85
UpdateCheckedMenuItemsFunction · 0.85
PushCurrentVideoSettingsFunction · 0.85
AddRecentFileFunction · 0.85
ToggleHideMenuFunction · 0.85
SetFSVideoModeFunction · 0.85
OpenRWRecentFileFunction · 0.85
OpenRamWatchFunction · 0.85
DoDebugFunction · 0.85
SetMainWindowTextFunction · 0.85
updateGameDependentMenusFunction · 0.85

Tested by

no test coverage detected