From cb69e3319070ebb812a68b76e8538732a79b70fe Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 9 Nov 2008 20:12:51 +0000 Subject: [PATCH] Windows - added quicksave and quickload functions. It uses up 0,1,2,3,4,5,6,7,8,9,I, and P for accel keys. This is temporary until a re-mappable hotkey system is in place. --- desmume/src/windows/main.cpp | 41 ++++++++++++++++++++++++++++++-- desmume/src/windows/resource.h | 13 +++++++++- desmume/src/windows/resources.rc | 14 ++++++++++- 3 files changed, 64 insertions(+), 4 deletions(-) diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index b745d8d82..485c5aba4 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -20,7 +20,6 @@ along with DeSmuME; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - #include "windriver.h" #include #include @@ -28,6 +27,7 @@ #include #include #include +#include #include "CWindow.h" #include "../MMU.h" #include "../armcpu.h" @@ -176,6 +176,9 @@ bool frameCounterDisplay = false; bool FpsDisplay = false; unsigned short windowSize = 0; +unsigned int lastSaveState = 0; //Keeps track of last savestate used for quick save/load functions +std::string MessageToDisplay = ""; //temp variable to store message that will be displayed via DisplayMessage function + /* the firmware settings */ struct NDS_fw_config_data win_fw_config; @@ -638,7 +641,6 @@ void CheckMessages() } } - DWORD WINAPI run( LPVOID lpParameter) { char txt[80]; @@ -1780,6 +1782,41 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDM_STATE_LOAD_F10: StateLoadSlot(10); return 0; + case ACCEL_I: //Quick Save + StateSaveSlot(lastSaveState); + return 0; + case ACCEL_P: //Quick Load + StateLoadSlot(lastSaveState); + return 0; + //Save slot selection + case ACCEL_0: + lastSaveState = 0; + return 0; + case ACCEL_1: + lastSaveState = 1; + return 0; + case ACCEL_2: + lastSaveState = 2; + return 0; + case ACCEL_3: + lastSaveState = 3; + return 0; + case ACCEL_4: + lastSaveState = 4; + return 0; + case ACCEL_5: + lastSaveState = 5; + case ACCEL_6: + lastSaveState = 6; + return 0; + case ACCEL_7: + lastSaveState = 7; + case ACCEL_8: + lastSaveState = 8; + return 0; + case ACCEL_9: + lastSaveState = 9; + return 0; case IDM_IMPORTBACKUPMEMORY: { OPENFILENAME ofn; diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 572074869..38983687d 100644 --- a/desmume/src/windows/resource.h +++ b/desmume/src/windows/resource.h @@ -333,13 +333,24 @@ #define ID_FILE_STOPAVI 40014 #define IDM_FILE_RECORDAVI 40015 #define IDM_FILE_STOPAVI 40016 +#define ACCEL_I 40018 +#define ACCEL_0 40020 +#define ACCEL_1 40021 +#define ACCEL_3 40023 +#define ACCEL_2 40024 +#define ACCEL_4 40025 +#define ACCEL_5 40026 +#define ACCEL_6 40027 +#define ACCEL_7 40028 +#define ACCEL_8 40029 +#define ACCEL_9 40030 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 107 -#define _APS_NEXT_COMMAND_VALUE 40018 +#define _APS_NEXT_COMMAND_VALUE 40032 #define _APS_NEXT_CONTROL_VALUE 1018 #define _APS_NEXT_SYMED_VALUE 112 #endif diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index d0973c627..45e314b6f 100644 --- a/desmume/src/windows/resources.rc +++ b/desmume/src/windows/resources.rc @@ -17,7 +17,7 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) #ifdef _WIN32 LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1251) +#pragma code_page(1252) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// @@ -49,6 +49,18 @@ BEGIN VK_F7, IDM_STATE_SAVE_F7, VIRTKEY, SHIFT, NOINVERT VK_F8, IDM_STATE_SAVE_F8, VIRTKEY, SHIFT, NOINVERT VK_F9, IDM_STATE_SAVE_F9, VIRTKEY, SHIFT, NOINVERT + "I", ACCEL_I, VIRTKEY, NOINVERT + "P", ACCEL_P, VIRTKEY, NOINVERT + "0", ACCEL_0, VIRTKEY, NOINVERT + "1", ACCEL_1, VIRTKEY, NOINVERT + "2", ACCEL_2, VIRTKEY, NOINVERT + "3", ACCEL_3, VIRTKEY, NOINVERT + "4", ACCEL_4, VIRTKEY, NOINVERT + "5", ACCEL_5, VIRTKEY, NOINVERT + "6", ACCEL_6, VIRTKEY, NOINVERT + "7", ACCEL_7, VIRTKEY, NOINVERT + "8", ACCEL_8, VIRTKEY, NOINVERT + "9", ACCEL_9, VIRTKEY, NOINVERT END #endif // Neutral resources