void HK_PrintScreen(int param, bool justPressed) { if(!justPressed) return; if(!romloaded) return; bool unpause = NDS_Pause(false); char outFilename[MAX_PATH]; OPENFILENAME ofn; ZeroMemory(&ofn,sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = MainWindow->getHWnd(); ofn.lpstrFilter = "png file (*.png)\0*.png\0Bmp file (*.bmp)\0*.bmp\0Any file (*.*)\0*.*\0\0"; ofn.lpstrTitle = "Print Screen Save As"; ofn.nMaxFile = MAX_PATH; ofn.lpstrFile = outFilename; ofn.lpstrDefExt = "png"; ofn.Flags = OFN_OVERWRITEPROMPT | OFN_NOREADONLYRETURN | OFN_PATHMUSTEXIST; std::string filename = path.getpath(path.SCREENSHOTS); char file[MAX_PATH]; ZeroMemory(file, sizeof(file)); path.formatname(file); filename += file; if(path.imageformat() == path.PNG) { filename += ".png"; ofn.lpstrDefExt = "png"; ofn.nFilterIndex = 1; } else if(path.imageformat() == path.BMP) { filename += ".bmp"; ofn.lpstrDefExt = "bmp"; ofn.nFilterIndex = 2; } strcpy(outFilename,filename.c_str()); if(GetSaveFileName(&ofn)) { filename = outFilename; if(toupper(strright(filename,4)) == ".PNG") NDS_WritePNG(filename.c_str(), GPU_screen); else if(toupper(strright(filename,4)) == ".BMP") NDS_WriteBMP(filename.c_str(), GPU_screen); } if(unpause) NDS_UnPause(false); }
void HK_StateSaveSlot(int num, bool justPressed) { if (romloaded && justPressed) { if (!paused) { NDS_Pause(); savestate_slot(num); //Savestate NDS_UnPause(); } else savestate_slot(num); //Savestate LoadSaveStateInfo(); AutoFrameSkip_IgnorePreviousDelay(); } }
static void nds4droid_throttle(bool allowSleep = true, int forceFrameSkip = -1) { int skipRate = (forceFrameSkip < 0) ? frameskiprate : forceFrameSkip; int ffSkipRate = (forceFrameSkip < 0) ? 9 : forceFrameSkip; if(lastskiprate != skipRate) { lastskiprate = skipRate; mainLoopData.framestoskip = 0; // otherwise switches to lower frameskip rates will lag behind } if(!mainLoopData.skipnextframe || forceFrameSkip == 0 || frameAdvance || (continuousframeAdvancing && !FastForward)) { mainLoopData.framesskipped = 0; if (mainLoopData.framestoskip > 0) mainLoopData.skipnextframe = 1; } else { mainLoopData.framestoskip--; if (mainLoopData.framestoskip < 1) mainLoopData.skipnextframe = 0; else mainLoopData.skipnextframe = 1; mainLoopData.framesskipped++; NDS_SkipNextFrame(); } if(FastForward) { if(mainLoopData.framesskipped < ffSkipRate) { mainLoopData.skipnextframe = 1; mainLoopData.framestoskip = 1; } if (mainLoopData.framestoskip < 1) mainLoopData.framestoskip += ffSkipRate; } else if((/*autoframeskipenab && frameskiprate ||*/ FrameLimit) && allowSleep) { SpeedThrottle(); } if (autoframeskipenab && frameskiprate) { if(!frameAdvance && !continuousframeAdvancing) { AutoFrameSkip_NextFrame(); if (mainLoopData.framestoskip < 1) mainLoopData.framestoskip += AutoFrameSkip_GetSkipAmount(0,skipRate); } } else { if (mainLoopData.framestoskip < 1) mainLoopData.framestoskip += skipRate; } if (frameAdvance && allowSleep) { frameAdvance = false; emu_halt(); SPU_Pause(1); } if(execute && emu_paused && !frameAdvance) { // safety net against running out of control in case this ever happens. NDS_UnPause(); NDS_Pause(); } //ServiceDisplayThreadInvocations(); }
void EMU_pause(bool pause) { if (pause) NDS_Pause(); else NDS_UnPause(); }
void nds4droid_unpause() { if(!execute) NDS_Pause(false); if (emu_paused && autoframeskipenab && frameskiprate) AutoFrameSkip_IgnorePreviousDelay(); NDS_UnPause(); }