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

Function LoadGame

src/drivers/Qt/fceuWrapper.cpp:309–470  ·  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

307 * render, what virtual input devices to use, etc.).
308 */
309int LoadGame(const char *path, bool silent)
310{
311 std::string fullpath;
312 int gg_enabled, autoLoadDebug, autoOpenDebugger, autoInputPreset;
313
314 if (isloaded){
315 CloseGame();
316 }
317
318 QFileInfo fi( path );
319
320 // Resolve absolute path to file
321 if ( fi.exists() )
322 {
323 //printf("FI: '%s'\n", fi.absoluteFilePath().toStdString().c_str() );
324 //printf("FI: '%s'\n", fi.canonicalFilePath().toStdString().c_str() );
325 fullpath = fi.canonicalFilePath().toStdString();
326 }
327 else
328 {
329 fullpath.assign( path );
330 }
331//#if defined(__linux__) || defined(__APPLE__) || defined(__unix__)
332//
333// // Resolve absolute path to file
334// if ( realpath( path, fullpath ) == NULL )
335// {
336// strcpy( fullpath, path );
337// }
338//#else
339// strcpy( fullpath, path );
340//#endif
341
342 //printf("Fullpath: %zi '%s'\n", sizeof(fullpath), fullpath );
343
344 // For some reason, the core of the emulator clears the state of
345 // the game genie option selection. So check the config each time
346 // and re-enable the core game genie state if needed.
347 g_config->getOption ("SDL.GameGenie", &gg_enabled);
348
349 FCEUI_SetGameGenie (gg_enabled);
350
351 // Set RAM Init Method Prior to Loading New Game
352 g_config->getOption ("SDL.RamInitMethod", &RAMInitOption);
353
354 // Load the game
355 if(!FCEUI_LoadGame(fullpath.c_str(), 1, silent)) {
356 return 0;
357 }
358
359 if ( consoleWindow )
360 {
361 consoleWindow->addRecentRom( fullpath.c_str() );
362 }
363
364 hexEditorLoadBookmarks();
365
366 g_config->getOption( "SDL.AutoLoadDebugFiles", &autoLoadDebug );

Callers 9

reloadLastGameFunction · 0.70
fceuWrapperHardResetFunction · 0.70
fceuWrapperInitFunction · 0.70
dropEventMethod · 0.70
openROMFileMethod · 0.70
loadRomRequestCBMethod · 0.70
loadNSFMethod · 0.70
loadMostRecentROMMethod · 0.70
activateCBMethod · 0.70

Calls 15

FCEUI_SetGameGenieFunction · 0.85
FCEUI_LoadGameFunction · 0.85
hexEditorLoadBookmarksFunction · 0.85
loadGameDebugBreakpointsFunction · 0.85
debuggerWindowIsOpenFunction · 0.85
updateCheatDialogFunction · 0.85
FCEUI_SelectStateFunction · 0.85
FCEUI_LoadStateFunction · 0.85
FCEUI_SetRegionFunction · 0.85
CalcVideoDimensionsFunction · 0.85

Tested by

no test coverage detected