diff --git a/desmume/src/mc.cpp b/desmume/src/mc.cpp index 87afe5b76..f10c84277 100644 --- a/desmume/src/mc.cpp +++ b/desmume/src/mc.cpp @@ -119,6 +119,12 @@ const char *save_names[] = { "FLASH 512Mbit" }; +//forces the currently selected backup type to be current +//(can possibly be used to repair poorly chosen save types discovered late in gameplay i.e. pokemon gamers) +void backup_forceManualBackupType() +{ + MMU_new.backupDevice.forceManualBackupType(); +} void backup_setManualBackupType(int type) { @@ -1073,3 +1079,9 @@ bool BackupDevice::load_movie(EMUFILE* is) { return true; } + +void BackupDevice::forceManualBackupType() +{ + addr_size = addr_size_for_old_save_size(save_types[CommonSettings.manualBackupType][1]); + state = RUNNING; +} \ No newline at end of file diff --git a/desmume/src/mc.h b/desmume/src/mc.h index b102dd7aa..0642a2473 100644 --- a/desmume/src/mc.h +++ b/desmume/src/mc.h @@ -82,6 +82,7 @@ public: void reset(); void close_rom(); + void forceManualBackupType(); void reset_hardware(); bool save_state(EMUFILE* os); @@ -155,6 +156,7 @@ void fw_reset_com(memory_chip_t *mc); /* reset communication with mc */ u8 fw_transfer(memory_chip_t *mc, u8 data); void backup_setManualBackupType(int type); +void backup_forceManualBackupType(); extern const char *save_names[]; diff --git a/desmume/src/windows/hotkey.cpp b/desmume/src/windows/hotkey.cpp index 29059bfaa..778bb9bae 100644 --- a/desmume/src/windows/hotkey.cpp +++ b/desmume/src/windows/hotkey.cpp @@ -91,6 +91,36 @@ void HK_ReloadROM(int, bool justPressed) void OpenRecentROM(int listNum); OpenRecentROM(0); } +void HK_QuickScreenShot(int param, bool justPressed) +{ + char buffer[MAX_PATH]; + ZeroMemory(buffer, sizeof(buffer)); + path.getpath(path.SCREENSHOTS, buffer); + + char file[MAX_PATH]; + ZeroMemory(file, sizeof(file)); + path.formatname(file); + + strcat(buffer, file); + if( strlen(buffer) > (MAX_PATH - 4)) + buffer[MAX_PATH - 4] = '\0'; + + switch(path.imageformat()) + { + case path.PNG: + { + strcat(buffer, ".png"); + NDS_WritePNG(buffer); + } + break; + case path.BMP: + { + strcat(buffer, ".bmp"); + NDS_WriteBMP(buffer); + } + break; + } +} void HK_PrintScreen(int param, bool justPressed) { char outFilename[MAX_PATH]; @@ -507,6 +537,13 @@ void InitCustomKeys (SCustomKeys *keys) keys->PrintScreen.page = HOTKEY_PAGE_MAIN; keys->PrintScreen.key = VK_F12; + keys->QuickPrintScreen.handleKeyDown = HK_QuickScreenShot; + keys->QuickPrintScreen.code = "QuickScreenshot"; + keys->QuickPrintScreen.name = STRW(ID_LABEL_HK13b); + keys->QuickPrintScreen.page = HOTKEY_PAGE_MAIN; + keys->QuickPrintScreen.key = VK_F12; + keys->QuickPrintScreen.modifiers = CUSTKEY_CTRL_MASK; + keys->ToggleReadOnly.handleKeyDown = HK_ToggleReadOnly; keys->ToggleReadOnly.code = "ToggleReadOnly"; keys->ToggleReadOnly.name = STRW(ID_LABEL_HK24); diff --git a/desmume/src/windows/hotkey.h b/desmume/src/windows/hotkey.h index 66063fef6..b26efc95b 100644 --- a/desmume/src/windows/hotkey.h +++ b/desmume/src/windows/hotkey.h @@ -78,6 +78,7 @@ struct SCustomKeys SCustomKey ToggleRasterizer; SCustomKey PrintScreen; //Screenshot + SCustomKey QuickPrintScreen; SCustomKey RecordWAV, RecordAVI; @@ -112,6 +113,7 @@ int GetModifiers(int key); //HOTKEY HANDLERS void HK_PrintScreen(int, bool); +void HK_QuickScreenShot(int, bool); void HK_StateSaveSlot(int, bool); void HK_StateLoadSlot(int, bool); void HK_StateSetSlot(int, bool); diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 5e7c69adb..f66ab5400 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -1996,12 +1996,17 @@ int MenuInit() ResetSaveStateTimes(); + HMENU configMenu = GetSubMenuByIdOfFirstChild(mainMenu,IDM_3DCONFIG); + HMENU advancedMenu = GetSubMenuByIdOfFirstChild(configMenu,ID_ADVANCED); + DeleteMenu(advancedMenu,ID_ADVANCED,MF_BYCOMMAND); + #ifndef DEVELOPER_MENU_ITEMS // menu items that are only useful for desmume developers (maybe) HMENU fileMenu = GetSubMenu(mainMenu, 0); DeleteMenu(fileMenu, IDM_FILE_RECORDUSERSPUWAV, MF_BYCOMMAND); #endif +#ifdef DEVELOPER for(int i=0; iaddMenuItem(IDC_SAVETYPE, false, &mm); +#else + DeleteMenu(configMenu,GetSubMenuIndexByHMENU(configMenu,advancedMenu),MF_BYPOSITION); +#endif return 1; } @@ -4373,35 +4381,7 @@ DOKEYDOWN: HK_PrintScreen(0, true); return 0; case IDM_QUICK_PRINTSCREEN: - { - char buffer[MAX_PATH]; - ZeroMemory(buffer, sizeof(buffer)); - path.getpath(path.SCREENSHOTS, buffer); - - char file[MAX_PATH]; - ZeroMemory(file, sizeof(file)); - path.formatname(file); - - strcat(buffer, file); - if( strlen(buffer) > (MAX_PATH - 4)) - buffer[MAX_PATH - 4] = '\0'; - - switch(path.imageformat()) - { - case path.PNG: - { - strcat(buffer, ".png"); - NDS_WritePNG(buffer); - } - break; - case path.BMP: - { - strcat(buffer, ".bmp"); - NDS_WriteBMP(buffer); - } - break; - } - } + HK_QuickScreenShot(0, true); return 0; case IDM_FILE_RECORDAVI: if (AVI_IsRecording()) @@ -5196,6 +5176,8 @@ DOKEYDOWN: } return 0; + case IDC_SAVETYPE_FORCE: backup_forceManualBackupType(); return 0; + default: { u32 id = LOWORD(wParam); @@ -6002,6 +5984,7 @@ void UpdateHotkeyAssignments() { UpdateHotkeyAssignment(CustomKeys.OpenROM, IDM_OPEN); UpdateHotkeyAssignment(CustomKeys.PrintScreen, IDM_PRINTSCREEN); + UpdateHotkeyAssignment(CustomKeys.QuickPrintScreen, IDM_QUICK_PRINTSCREEN); UpdateHotkeyAssignment(CustomKeys.RecordAVI, IDM_FILE_RECORDAVI); UpdateHotkeyAssignment(CustomKeys.Pause, IDM_PAUSE); UpdateHotkeyAssignment(CustomKeys.Reset, IDM_RESET); diff --git a/desmume/src/windows/resource.h b/desmume/src/windows/resource.h index 690647029..99fd44246 100644 Binary files a/desmume/src/windows/resource.h and b/desmume/src/windows/resource.h differ diff --git a/desmume/src/windows/resources.rc b/desmume/src/windows/resources.rc index 5b7793058..bbb9e7e04 100644 Binary files a/desmume/src/windows/resources.rc and b/desmume/src/windows/resources.rc differ diff --git a/desmume/src/windows/winutil.cpp b/desmume/src/windows/winutil.cpp index 516b9f5c4..45e83524a 100644 --- a/desmume/src/windows/winutil.cpp +++ b/desmume/src/windows/winutil.cpp @@ -115,3 +115,38 @@ void CheckDlgItem(HWND hDlg, int id, bool checked) CheckDlgButton(hDlg, id, checked ? BST_CHECKED : BST_UNCHECKED); } +HMENU GetSubMenuByIdOfFirstChild(HMENU menu, UINT child) +{ + int count = GetMenuItemCount(menu); + for(int i=0;i