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

Function LoadGame

src/drivers/sdl/sdl.cpp:207–249  ·  view source on GitHub ↗

* Loads a game, given a full path/filename. The driver code must be * initialized after the game is loaded, because the emulator code * provides data necessary for the driver code(number of scanlines to * render, what virtual input devices to use, etc.). */

Source from the content-addressed store, hash-verified

205 * render, what virtual input devices to use, etc.).
206 */
207int LoadGame(const char *path, bool silent)
208{
209 if (isloaded){
210 CloseGame();
211 }
212 if(!FCEUI_LoadGame(path, 1, silent)) {
213 return 0;
214 }
215
216 int state_to_load;
217 g_config->getOption("SDL.AutoLoadState", &state_to_load);
218 if (state_to_load >= 0 && state_to_load < 10){
219 FCEUI_SelectState(state_to_load, 0);
220 FCEUI_LoadState(NULL, false);
221 }
222
223 ParseGIInput(GameInfo);
224 RefreshThrottleFPS();
225
226 if(!DriverInitialize(GameInfo)) {
227 return(0);
228 }
229
230 // set pal/ntsc
231 int id;
232 g_config->getOption("SDL.PAL", &id);
233 FCEUI_SetRegion(id);
234
235 g_config->getOption("SDL.SwapDuty", &id);
236 swapDuty = id;
237
238 std::string filename;
239 g_config->getOption("SDL.Sound.RecordFile", &filename);
240 if(filename.size()) {
241 if(!FCEUI_BeginWaveRecord(filename.c_str())) {
242 g_config->setOption("SDL.Sound.RecordFile", "");
243 }
244 }
245 isloaded = 1;
246
247 FCEUD_NetworkConnect();
248 return 1;
249}
250
251/**
252 * Closes a game. Frees memory, and deinitializes the drivers.

Callers 5

hardResetFunction · 0.70
loadNSFFunction · 0.70
loadGameFunction · 0.70
reloadLastGameFunction · 0.70
mainFunction · 0.70

Calls 13

FCEUI_LoadGameFunction · 0.85
FCEUI_SelectStateFunction · 0.85
FCEUI_LoadStateFunction · 0.85
FCEUI_SetRegionFunction · 0.85
FCEUI_BeginWaveRecordFunction · 0.85
getOptionMethod · 0.80
setOptionMethod · 0.80
CloseGameFunction · 0.70
ParseGIInputFunction · 0.70
RefreshThrottleFPSFunction · 0.70
DriverInitializeFunction · 0.70
FCEUD_NetworkConnectFunction · 0.70

Tested by

no test coverage detected