From c3c3e48da7f4b3dadb92e4e94f237006e26ddfe3 Mon Sep 17 00:00:00 2001 From: zeromus Date: Tue, 17 Mar 2009 05:45:51 +0000 Subject: [PATCH] win32: add separate framelimiter so that you can use frameskip 0 + limit (the old pre-0.9.1 style before I broke it) --- desmume/src/windows/main.cpp | 13 ++++++++++++- desmume/src/windows/resource.h | 1 + desmume/src/windows/resources.rc | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 8bf12e5bb..79c50aba5 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -152,6 +152,8 @@ int WndY = 0; int ScreenGap = 0; +static int FrameLimit = 0; + //=========================== view tools TOOLSCLASS *ViewDisasm_ARM7 = NULL; TOOLSCLASS *ViewDisasm_ARM9 = NULL; @@ -938,7 +940,7 @@ DWORD WINAPI run() NDS_SkipFrame(true); } - if(frameskiprate != 0 || autoframeskipenab) + if(autoframeskipenab || FrameLimit) while(SpeedThrottle()) { } @@ -1086,6 +1088,8 @@ int MenuInit() MainWindow->checkMenu(IDM_SCREENSEP_BORDER, MF_BYCOMMAND | ((ScreenGap==5)?MF_CHECKED:MF_UNCHECKED)); MainWindow->checkMenu(IDM_SCREENSEP_NDSGAP, MF_BYCOMMAND | ((ScreenGap==64)?MF_CHECKED:MF_UNCHECKED)); + MainWindow->checkMenu(IDC_FRAMELIMIT, MF_BYCOMMAND | FrameLimit?MF_CHECKED:MF_UNCHECKED); + recentromsmenu = LoadMenu(hAppInst, "RECENTROMS"); GetRecentRoms(); @@ -1271,6 +1275,7 @@ int WINAPI WinMain (HINSTANCE hThisInstance, WndY = GetPrivateProfileInt("Video","WindowPosY", CW_USEDEFAULT, IniName); frameCounterDisplay = GetPrivateProfileInt("Display","FrameCounter", 0, IniName); ScreenGap = GetPrivateProfileInt("Display", "ScreenGap", 0, IniName); + FrameLimit = GetPrivateProfileInt("FrameLimit", "FrameLimit", 1, IniName); //sprintf(text, "%s", DESMUME_NAME_AND_VERSION); MainWindow = new WINCLASS(CLASSNAME, hThisInstance); DWORD dwStyle = WS_CAPTION| WS_SYSMENU | WS_SIZEBOX | WS_MINIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; @@ -2745,6 +2750,12 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM ChangeLanguage(2); CheckLanguage(LOWORD(wParam)); return 0; + case IDC_FRAMELIMIT: + { + FrameLimit ^= 1; + MainWindow->checkMenu(IDC_FRAMELIMIT, FrameLimit ? MF_CHECKED : MF_UNCHECKED); + WritePrivateProfileInt("FrameLimit", "FrameLimit", FrameLimit, IniName); + } case IDM_SCREENSEP_NONE: { SetScreenGap(0); diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 059536f53..5d12b5454 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -389,6 +389,7 @@ #define IDM_SCREENSEP_NDSGAP 40002 #define IDM_ABOUT 40003 #define IDM_EMULATIONSETTINGS 40004 +#define IDC_FRAMELIMIT 40005 #define ID_VIEW_FRAMECOUNTER 40009 #define ID_VIEW_DISPLAYFPS 40010 #define IDM_FILE_RECORDAVI 40015 diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index 9c6597b99..c4aa60858 100644 --- a/desmume/src/windows/resources.rc +++ b/desmume/src/windows/resources.rc @@ -131,6 +131,7 @@ BEGIN MENUITEM "Firmware Indstillinger", IDM_FIRMSETTINGS POPUP "&Frame Skip" BEGIN + MENUITEM "Limit to 60", IDC_FRAMELIMIT MENUITEM "Auto", IDC_FRAMESKIPAUTO MENUITEM "0", IDC_FRAMESKIP0 MENUITEM "1", IDC_FRAMESKIP1 @@ -294,6 +295,7 @@ BEGIN MENUITEM "Emulation Settings", IDM_EMULATIONSETTINGS POPUP "&Frame Skip" BEGIN + MENUITEM "Limit to 60", IDC_FRAMELIMIT MENUITEM "Auto", IDC_FRAMESKIPAUTO MENUITEM "0", IDC_FRAMESKIP0 MENUITEM "1", IDC_FRAMESKIP1 @@ -455,6 +457,7 @@ BEGIN MENUITEM "Config. du firmware", IDM_FIRMSETTINGS POPUP "&Frame Skip" BEGIN + MENUITEM "Limit to 60", IDC_FRAMELIMIT MENUITEM "Auto", IDC_FRAMESKIPAUTO MENUITEM "0", IDC_FRAMESKIP0 MENUITEM "1", IDC_FRAMESKIP1