void UpdateEMUCore(Config *config) { int ntsccol, ntsctint, ntschue, flag, start, end; std::string cpalette; config->getOption("SDL.NTSCpalette", &ntsccol); config->getOption("SDL.Tint", &ntsctint); config->getOption("SDL.Hue", &ntschue); FCEUI_SetNTSCTH(ntsccol, ntsctint, ntschue); config->getOption("SDL.Palette", &cpalette); if(cpalette.size()) { LoadCPalette(cpalette); } config->getOption("SDL.PAL", &flag); FCEUI_SetVidSystem(flag ? 1 : 0); config->getOption("SDL.GameGenie", &flag); FCEUI_SetGameGenie(flag ? 1 : 0); config->getOption("SDL.Sound.LowPass", &flag); FCEUI_SetLowPass(flag ? 1 : 0); config->getOption("SDL.DisableSpriteLimit", &flag); FCEUI_DisableSpriteLimitation(flag ? 1 : 0); //Not used anymore. //config->getOption("SDL.SnapName", &flag); //FCEUI_SetSnapName(flag ? true : false); config->getOption("SDL.ScanLineStart", &start); config->getOption("SDL.ScanLineEnd", &end); #if DOING_SCANLINE_CHECKS for(int i = 0; i < 2; x++) { if(srendlinev[x]<0 || srendlinev[x]>239) srendlinev[x]=0; if(erendlinev[x]<srendlinev[x] || erendlinev[x]>239) erendlinev[x]=239; } #endif FCEUI_SetRenderedLines(start + 8, end - 8, start, end); }
void UpdateEMUCore(Config *config) { FCEUI_SetVidSystem(0); FCEUI_SetGameGenie(0); FCEUI_SetLowPass(0); FCEUI_DisableSpriteLimitation(0); int start = 0, end = 239; // TODO: tsone: can be removed? not sure what this is.. it's disabled due to #define #if DOING_SCANLINE_CHECKS for(int i = 0; i < 2; x++) { if(srendlinev[x]<0 || srendlinev[x]>239) srendlinev[x]=0; if(erendlinev[x]<srendlinev[x] || erendlinev[x]>239) erendlinev[x]=239; } #endif FCEUI_SetRenderedLines(start + 8, end - 8, start, end); }
int main(int argc,char *argv[]) { char *t; if(timeBeginPeriod(1)!=TIMERR_NOERROR) { AddLogText("Error setting timer granularity to 1ms.",1); } if(!FCEUI_Initialize()) goto doexito; srand(GetTickCount()); // rand() is used for some GUI sillyness. fceu_hInstance=GetModuleHandle(0); GetBaseDirectory(); sprintf(TempArray,"%s\\fceu98.cfg",BaseDirectory); LoadConfig(TempArray); t=ParseArgies(argc,argv); /* Bleh, need to find a better place for this. */ { palyo&=1; FCEUI_SetVidSystem(palyo); genie&=1; FCEUI_SetGameGenie(genie); fullscreen&=1; soundo&=1; FCEUI_SetSoundVolume(soundvolume); FCEUI_SetSoundQuality(soundquality); } ParseGIInput(NULL); /* Since a game doesn't have to be loaded before the GUI can be used, make sure the temporary input type variables are set. */ CreateDirs(); SetDirs(); DoVideoConfigFix(); DoTimingConfigFix(); if(eoptions&EO_CPALETTE) FCEUI_SetPaletteArray(cpalette); if(!t) fullscreen=0; CreateMainWindow(); if(!InitDInput()) goto doexito; if(!DriverInitialize()) goto doexito; InitSpeedThrottle(); UpdateMenu(); if(t) ALoad(t); else if(eoptions&EO_FOAFTERSTART) LoadNewGamey(hAppWnd, 0); doloopy: UpdateFCEUWindow(); if(GI) { while(GI) { uint8 *gfx; int32 *sound; int32 ssize; FCEUI_Emulate(&gfx, &sound, &ssize, 0); xbsave = gfx; FCEUD_Update(gfx, sound, ssize); } xbsave = NULL; RedrawWindow(hAppWnd,0,0,RDW_ERASE|RDW_INVALIDATE); StopSound(); } Sleep(50); if(!exiting) goto doloopy; doexito: DriverKill(); timeEndPeriod(1); FCEUI_Kill(); return(0); }
int main(int argc, char *argv[]) { #ifdef HW_DOL ipl_set_config(6); // disable Qoob modchip #endif #ifdef WII_DVD DI_Init(); // first #endif int selectedMenu = -1; InitDeviceThread(); InitGCVideo (); ResetVideo_Menu (); // change to menu video mode // Controllers PAD_Init(); #ifdef HW_RVL WPAD_Init(); // read wiimote accelerometer and IR data WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR); WPAD_SetVRes(WPAD_CHAN_ALL,640,480); // Wii Power/Reset buttons WPAD_SetPowerButtonCallback((WPADShutdownCallback)ShutdownCB); SYS_SetPowerCallback(ShutdownCB); SYS_SetResetCallback(ResetCB); #endif // Initialise FreeType if (FT_Init ()) { printf ("Cannot initialise font subsystem!\n"); while (1); } InitialiseAudio(); // Initialize libFAT for SD and USB MountAllFAT(); // Initialize DVD subsystem (GameCube only) #ifdef HW_DOL DVD_Init (); #endif // allocate memory to store rom nesrom = (unsigned char *)malloc(1024*1024*3); // 3 MB should be plenty /*** Minimal Emulation Loop ***/ if ( !FCEUI_Initialize() ) { WaitPrompt("Unable to initialize FCE Ultra\n"); ExitToLoader(); } FCEUI_SetGameGenie(0); // 0 - OFF, 1 - ON memset(FDSBIOS, 0, sizeof(FDSBIOS)); // clear FDS BIOS memory cleanSFMDATA(); // clear state data // Set defaults DefaultSettings(); // store path app was loaded from sprintf(appPath, "fceugx"); if(argc > 0 && argv[0] != NULL) CreateAppPath(argv[0]); // Load preferences if(!LoadPrefs()) { WaitPrompt("Preferences reset - check settings!"); selectedMenu = 1; // change to preferences menu } FCEUI_SetSoundQuality(1); // 0 - low, 1 - high, 2 - high (alt.) FCEUI_SetVidSystem(GCSettings.timing); // causes a small 'pop' in the audio while (1) // main loop { #ifdef HW_RVL if(ShutdownRequested) ShutdownWii(); #endif // go back to checking if devices were inserted/removed // since we're entering the menu LWP_ResumeThread (devicethread); MainMenu(selectedMenu); selectedMenu = 2; // return to game menu from now on // stop checking if devices were removed/inserted // since we're starting emulation again LWP_SuspendThread (devicethread); ResetVideo_Emu(); setFrameTimer(); // set frametimer method before emulation SetPalette(); static int fskipc=0; while(1) // emulation loop { uint8 *gfx; int32 *sound; int32 ssize; #ifdef FRAMESKIP fskipc=(fskipc+1)%(frameskip+1); #endif FCEUI_Emulate(&gfx, &sound, &ssize, fskipc); if(!fskipc) { xbsave = gfx; FCEUD_Update(gfx, sound, ssize); } if(ResetRequested) { PowerNES(); // reset game ResetRequested = 0; } if(ConfigRequested) { ResetVideo_Menu(); if (GCSettings.AutoSave == 1) { SaveRAM(GCSettings.SaveMethod, SILENT); } else if (GCSettings.AutoSave == 2) { SaveState(GCSettings.SaveMethod, SILENT); } else if(GCSettings.AutoSave == 3) { SaveRAM(GCSettings.SaveMethod, SILENT); SaveState(GCSettings.SaveMethod, SILENT); } // save zoom level SavePrefs(SILENT); ConfigRequested = 0; break; // leave emulation loop } } } }
bool Emulator_Implementation_InitSettings() { LOG_DBG("Emulator_Implementation_InitSettings()"); memset((&Settings), 0, (sizeof(Settings))); currentconfig.Clear(); #ifdef SYS_CONFIG_FILE try_load_config_file(SYS_CONFIG_FILE, currentconfig); #endif //PS3 - General settings if (currentconfig.Exists("PS3General::KeepAspect")) { Settings.PS3KeepAspect = currentconfig.GetBool("PS3General::KeepAspect"); } else { Settings.PS3KeepAspect = true; } if (currentconfig.Exists("PS3General::Smooth")) { Settings.PS3Smooth = currentconfig.GetBool("PS3General::Smooth"); } else { Settings.PS3Smooth = false; } if (currentconfig.Exists("PS3General::OverscanEnabled")) { Settings.PS3OverscanEnabled = currentconfig.GetBool("PS3General::OverscanEnabled"); } else { Settings.PS3OverscanEnabled = false; } if (currentconfig.Exists("PS3General::OverscanAmount")) { Settings.PS3OverscanAmount = currentconfig.GetInt("PS3General::OverscanAmount"); } else { Settings.PS3OverscanAmount = 0; } if (currentconfig.Exists("FCEU::Controlstyle")) { Settings.FCEUControlstyle = currentconfig.GetInt("FCEU::Controlstyle"); control_style = (ControlStyle)(((int)Settings.FCEUControlstyle)); } else { Settings.FCEUControlstyle = CONTROL_STYLE_ORIGINAL; control_style = CONTROL_STYLE_ORIGINAL; } if (currentconfig.Exists("FCEU::DisableSpriteLimitation")) { Settings.FCEUDisableSpriteLimitation = currentconfig.GetBool("FCEU::DisableSpriteLimitation"); FCEUI_DisableSpriteLimitation(Settings.FCEUDisableSpriteLimitation); } else { Settings.FCEUDisableSpriteLimitation = false; } if (currentconfig.Exists("PS3General::PS3CurrentShader")) { Settings.PS3CurrentShader.assign(currentconfig.GetString("PS3General::PS3CurrentShader")); } else { Settings.PS3CurrentShader.assign(DEFAULT_SHADER_FILE); } if (currentconfig.Exists("PS3General::PS3CurrentResolution")) { Settings.PS3CurrentResolution = currentconfig.GetInt("PS3General::PS3CurrentResolution"); } else { Settings.PS3CurrentResolution = NULL; } if (currentconfig.Exists("FCEU::GameGenie")) { Settings.FCEUGameGenie = currentconfig.GetBool("FCEU::GameGenie"); FCEUI_SetGameGenie(Settings.FCEUGameGenie); } else { Settings.FCEUGameGenie = false; } FCEUI_SetGameGenie(Settings.FCEUGameGenie); if (currentconfig.Exists("PS3General::PS3PALTemporalMode60Hz")) { Settings.PS3PALTemporalMode60Hz = currentconfig.GetBool("PS3General::PS3PALTemporalMode60Hz"); } else { Settings.PS3PALTemporalMode60Hz = false; } //RSound Settings if(currentconfig.Exists("RSound::RSoundEnabled")) { Settings.RSoundEnabled = currentconfig.GetBool("RSound::RSoundEnabled"); } else { Settings.RSoundEnabled = false; } if(currentconfig.Exists("RSound::RSoundServerIPAddress")) { Settings.RSoundServerIPAddress = currentconfig.GetString("RSound::RSoundServerIPAddress"); } else { Settings.RSoundServerIPAddress = "0.0.0.0"; } if(currentconfig.Exists("PS3General::Throttled")) { Settings.Throttled = currentconfig.GetInt("PS3General::Throttled"); } else { Settings.Throttled = 1; } // PS3 Path Settings if (currentconfig.Exists("PS3Paths::PathSaveStates")) { Settings.PS3PathSaveStates = currentconfig.GetString("PS3Paths::PathSaveStates"); } else { Settings.PS3PathSaveStates = USRDIR; } if (currentconfig.Exists("PS3Paths::PathSRAM")) { Settings.PS3PathSRAM = currentconfig.GetString("PS3Paths::PathSRAM"); } else { Settings.PS3PathSRAM = USRDIR; } if (currentconfig.Exists("PS3Paths::PathCheats")) { Settings.PS3PathCheats = currentconfig.GetString("PS3Paths::PathCheats"); } else { Settings.PS3PathCheats = USRDIR; } if (currentconfig.Exists("PS3Paths::PathScreenshots")) { Settings.PS3PathScreenshots = currentconfig.GetString("PS3Paths::PathScreenshots"); } else { Settings.PS3PathScreenshots = USRDIR; } if (currentconfig.Exists("PS3Paths::PathROMDirectory")) { Settings.PS3PathROMDirectory = currentconfig.GetString("PS3Paths::PathROMDirectory"); } else { Settings.PS3PathROMDirectory = "/"; } if (currentconfig.Exists("PS3Paths::BaseDirectory")) { Settings.PS3PathBaseDirectory = currentconfig.GetString("PS3Paths::PathBaseDirectory"); } else { Settings.PS3PathBaseDirectory = USRDIR; } if (currentconfig.Exists("PS3General::ControlScheme")) { Settings.ControlScheme = currentconfig.GetInt("PS3General::ControlScheme"); } else { Settings.ControlScheme = CONTROL_SCHEME_DEFAULT; } Emulator_Implementation_SwitchControlScheme(); LOG_DBG("SUCCESS - Emulator_Implementation_InitSettings()"); return true; }