* 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.). */
| 307 | * render, what virtual input devices to use, etc.). |
| 308 | */ |
| 309 | int 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 ); |
no test coverage detected