* 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.). */
| 205 | * render, what virtual input devices to use, etc.). |
| 206 | */ |
| 207 | int 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. |
no test coverage detected