From 312628821ffb06c57d85ca91e0b806709a2c3f1a Mon Sep 17 00:00:00 2001 From: zeromus Date: Thu, 11 Aug 2011 04:12:36 +0000 Subject: [PATCH] win32: add hotkey for limit framerate limit toggle --- desmume/src/windows/hotkey.cpp | 11 +++++++++++ desmume/src/windows/hotkey.h | 2 +- desmume/src/windows/main.cpp | 2 +- desmume/src/windows/resource.h | 1 + desmume/src/windows/resources.rc | Bin 1405976 -> 1406732 bytes desmume/src/windows/throttle.h | 1 + 6 files changed, 15 insertions(+), 2 deletions(-) diff --git a/desmume/src/windows/hotkey.cpp b/desmume/src/windows/hotkey.cpp index 86728ef89..fc969949c 100644 --- a/desmume/src/windows/hotkey.cpp +++ b/desmume/src/windows/hotkey.cpp @@ -412,6 +412,11 @@ void HK_FastForwardKeyDown(int, bool justPressed) { FastForward = 1; } void HK_FastForwardKeyUp(int) { FastForward = 0; } void HK_IncreaseSpeed(int, bool justPressed) { IncreaseSpeed(); } void HK_DecreaseSpeed(int, bool justPressed) { DecreaseSpeed(); } +void HK_FrameLimitToggle(int, bool justPressed) { + FrameLimit ^= 1; + WritePrivateProfileInt("FrameLimit", "FrameLimit", FrameLimit, IniName); +} + void HK_FrameAdvanceKeyDown(int, bool justPressed) { FrameAdvance(true); } void HK_FrameAdvanceKeyUp(int) { FrameAdvance(false); } @@ -518,6 +523,12 @@ void InitCustomKeys (SCustomKeys *keys) keys->DecreaseSpeed.page = HOTKEY_PAGE_MAIN; keys->DecreaseSpeed.key = VK_OEM_MINUS; + keys->FrameLimitToggle.handleKeyDown = HK_FrameLimitToggle; + keys->FrameLimitToggle.code = "FrameLimitToggle"; + keys->FrameLimitToggle.name = STRW(ID_LABEL_HK8b); + keys->FrameLimitToggle.page = HOTKEY_PAGE_MAIN; + keys->FrameLimitToggle.key = NULL; + keys->IncreasePressure.handleKeyDown = HK_IncreasePressure; keys->IncreasePressure.code = "IncreasePressure"; keys->IncreasePressure.name = STRW(ID_LABEL_HK55); diff --git a/desmume/src/windows/hotkey.h b/desmume/src/windows/hotkey.h index 64e32f2ce..3cbafbef4 100644 --- a/desmume/src/windows/hotkey.h +++ b/desmume/src/windows/hotkey.h @@ -68,7 +68,7 @@ struct SCustomKeys SCustomKey Slot[10]; SCustomKey QuickSave, QuickLoad, NextSaveSlot, PreviousSaveSlot; - SCustomKey OpenROM, ReloadROM, Reset, Pause, FrameAdvance, FastForward, FastForwardToggle, IncreaseSpeed, DecreaseSpeed, Microphone, IncreasePressure, DecreasePressure; + SCustomKey OpenROM, ReloadROM, Reset, Pause, FrameAdvance, FastForward, FastForwardToggle, IncreaseSpeed, DecreaseSpeed, FrameLimitToggle, Microphone, IncreasePressure, DecreasePressure; SCustomKey PlayMovie, RecordMovie, StopMovie, ToggleReadOnly; diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index e51c59d0e..a03d83d06 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -405,7 +405,7 @@ UINT currLanguageMenuItem = IDC_LANGENGLISH; extern HWND RamSearchHWnd; static bool lostFocusPause = true; static bool lastPauseFromLostFocus = false; -static bool FrameLimit = true; +bool FrameLimit = true; extern bool allowBackgroundInput; std::vector LuaScriptHWnds; diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 8e5a274c1..c3f832252 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -725,6 +725,7 @@ #define ID_LABEL_HK7 4471 #define IDC_GI_TITLEFR 4472 #define ID_LABEL_HK8 4472 +#define ID_LABEL_HK8b 44720 #define IDC_GI_TITLEGE 4473 #define ID_LABEL_HK9 4473 #define IDC_GI_TITLEIT 4474 diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index 66ad3de9063c42b7913b189906c8d1e2d028da92..cadfd80d03d7b1204b42a8a1655efcd422fccd8f 100644 GIT binary patch delta 516 zcmbR7BDCjSXhRF*7N(Bp%oYqu(>EqEOHO}aEWjd}%aF-X!l1z5#!$qN$dJpB3Z_dK zQm4;-#$-HQAXZdudcs{^p7veOnShvi`>y9K1=mP6L}vPjUo0H$e*0K~m<@>8xBKnm zVDTc^Ac$+WM_KT1VVQm|nMZ2+g(`NI_Ap*fAm##M?(Jc`JU)RW8>}*YLkkzr^lQ>W zO4AL*h18}8Wbp{JYsK>bG4FP*c)ou(NH!B1bU??pM_C8}9WB^$k7Pr1+PTDqfLIua UMYeN^i?X?qWX5)29CC;Q0OFmN1^@s6 delta 172 zcmeBq7dqobXhRF*7N(Bp+oy4I8n8@X&?&+)U5<}4Zo8H}|1zF-ou5oV%)DLaCrj4R z=|D9y?Q;8BftU@5*|*E>=iu>b2MPl*7Z7s;jo}Fh11VIQ-qpe-FnyM!kju0j9)b2- z2|Pf|yZu%I-@h9m+n%ws1ML7}0ia!i7jCwvNeTh6Fc6DuPm>fia+?km(b;a0AbLj( E0JDuf_5c6? diff --git a/desmume/src/windows/throttle.h b/desmume/src/windows/throttle.h index 5a1968d62..6ff2dfa9e 100644 --- a/desmume/src/windows/throttle.h +++ b/desmume/src/windows/throttle.h @@ -2,6 +2,7 @@ #define _THROTTLE_H_ extern int FastForward; +extern bool FrameLimit; void IncreaseSpeed(); void DecreaseSpeed();