diff --git a/src/cheat.cpp b/src/cheat.cpp index 44ea34ec..41092e3a 100644 --- a/src/cheat.cpp +++ b/src/cheat.cpp @@ -964,3 +964,20 @@ void UpdateFrozenList(void) } //FCEUI_DispMessage("FrozenCount: %d",0,FrozenAddressCount);//Debug } + +// disable all cheats +int FCEU_DisableAllCheats(){ + int count = 0; + struct CHEATF *next=cheats; + while(next) + { + if(next->status){ + count++; + } + next->status = 0; + next = next->next; + } + savecheats=1; + RebuildSubCheats(); + return count; +} diff --git a/src/cheat.h b/src/cheat.h index 431ff0a5..136f6025 100644 --- a/src/cheat.h +++ b/src/cheat.h @@ -9,4 +9,6 @@ void FCEU_PowerCheats(void); int FCEU_CheatGetByte(uint32 A); void FCEU_CheatSetByte(uint32 A, uint8 V); -extern int savecheats; \ No newline at end of file +extern int savecheats; + +int FCEU_DisableAllCheats(); \ No newline at end of file diff --git a/src/drivers/win/archive.cpp b/src/drivers/win/archive.cpp index 7175b9ec..118aca61 100644 --- a/src/drivers/win/archive.cpp +++ b/src/drivers/win/archive.cpp @@ -275,6 +275,9 @@ public: } }; +// indicator for the open in archive dialog that if the load was canceled by the user. +// TODO: Since I can't think of a better way to indicate it, hope someone could imporve it. +bool archiveManuallyCanceled; static BOOL CALLBACK ArchiveFileSelectorCallback(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -282,6 +285,8 @@ static BOOL CALLBACK ArchiveFileSelectorCallback(HWND hwndDlg, UINT uMsg, WPARAM { case WM_INITDIALOG: { + // TODO: find a better way to do this. + archiveManuallyCanceled = false; HWND hwndListbox = GetDlgItem(hwndDlg,IDC_LIST1); for(uint32 i=0;isize();i++) { @@ -307,6 +312,9 @@ static BOOL CALLBACK ArchiveFileSelectorCallback(HWND hwndDlg, UINT uMsg, WPARAM case IDCANCEL: EndDialog(hwndDlg, LB_ERR); + // Tell the parent window that the operation was canceled rather than loading error + // TODO: find a better way to do this. + archiveManuallyCanceled = true; return TRUE; } break; diff --git a/src/drivers/win/cheat.cpp b/src/drivers/win/cheat.cpp index ad2a582e..ef60cc3f 100644 --- a/src/drivers/win/cheat.cpp +++ b/src/drivers/win/cheat.cpp @@ -901,6 +901,7 @@ BOOL CALLBACK GGConvCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) EnableWindow(GetDlgItem(hCheat,IDC_BTN_CHEAT_DEL),TRUE); EnableWindow(GetDlgItem(hCheat,IDC_BTN_CHEAT_UPD),TRUE); + UpdateCheatsAdded(); } } break; @@ -1026,4 +1027,31 @@ void DoGGConv() void ListBox::OnRButtonDown(UINT nFlags, CPoint point) { CPoint test = point; -} */ \ No newline at end of file +} */ + +void DisableAllCheats() +{ + if(!FCEU_DisableAllCheats() || !hCheat){ + return; + } + int selcheattemp = SendDlgItemMessage(hCheat, IDC_LIST_CHEATS, LB_GETCOUNT, 0, 0) - 1; + LRESULT sel; char str[259]; + while(selcheattemp >= 0) + { + SendDlgItemMessage(hCheat,IDC_LIST_CHEATS,LB_GETTEXT,selcheattemp, (LPARAM)(LPCTSTR)str); + if(str[0] == '*') + { + sel = SendDlgItemMessage(hCheat,IDC_LIST_CHEATS,LB_GETSEL,selcheattemp,0); + str[0] = ' '; + SendDlgItemMessage(hCheat,IDC_LIST_CHEATS,LB_DELETESTRING,selcheattemp,0); + SendDlgItemMessage(hCheat,IDC_LIST_CHEATS,LB_INSERTSTRING,selcheattemp, (LPARAM)(LPSTR)str); + if(sel) + { + SendDlgItemMessage(hCheat,IDC_LIST_CHEATS,LB_SETSEL,1,selcheattemp); + } + } + selcheattemp--; + } + sprintf(str, "Active Cheats %d", 0); + SetDlgItemText(hCheat, 201, str); +} \ No newline at end of file diff --git a/src/drivers/win/cheat.h b/src/drivers/win/cheat.h index 44f35a5c..8d9f5b2b 100644 --- a/src/drivers/win/cheat.h +++ b/src/drivers/win/cheat.h @@ -14,3 +14,5 @@ void UpdateCheatsAdded(); extern unsigned int FrozenAddressCount; extern std::vector FrozenAddresses; //void ConfigAddCheat(HWND wnd); //bbit edited:commented out this line + +void DisableAllCheats(); \ No newline at end of file diff --git a/src/drivers/win/directories.cpp b/src/drivers/win/directories.cpp index 75a0bf67..accda7d5 100644 --- a/src/drivers/win/directories.cpp +++ b/src/drivers/win/directories.cpp @@ -143,9 +143,11 @@ static BOOL CALLBACK DirConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM "Base Directory", }; - char name[MAX_PATH]; + char name[MAX_PATH]; + char path[MAX_PATH]; + GetDlgItemText(hwndDlg, EDIT_ROMS + ((wParam & 0xFFFF) - BUTTON_ROMS), path, MAX_PATH); - if(BrowseForFolder(hwndDlg, helpert[ ( (wParam & 0xFFFF) - BUTTON_ROMS)], name)) + if(BrowseForFolder(hwndDlg, helpert[ ( (wParam & 0xFFFF) - BUTTON_ROMS)], name, path)) { SetDlgItemText(hwndDlg, EDIT_ROMS + ((wParam & 0xFFFF) - BUTTON_ROMS), name); } diff --git a/src/drivers/win/gui.cpp b/src/drivers/win/gui.cpp index ab3a158c..171187ae 100644 --- a/src/drivers/win/gui.cpp +++ b/src/drivers/win/gui.cpp @@ -3,6 +3,8 @@ #include #include // For directories configuration dialog. +int CALLBACK SHBrowseForFolderCallbackProc(HWND, UINT, LPARAM, LPARAM); + /** * Centers a window relative to its parent window. * @@ -96,18 +98,26 @@ void ShowCursorAbs(int set_visible) * * @return 0 or 1 to indicate failure or success. **/ -int BrowseForFolder(HWND hParent, const char *htext, char *buf) +int BrowseForFolder(HWND hParent, const char *htext, char *buf, char* defPath = NULL) { BROWSEINFO bi; LPCITEMIDLIST pidl; - buf[0] = 0; - memset(&bi, 0, sizeof(bi)); - bi.hwndOwner = hParent; bi.lpszTitle = htext; - bi.ulFlags = BIF_RETURNONLYFSDIRS; + bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_EDITBOX; + + if(defPath == NULL || defPath[0] == '\0') + { + char currentDir[MAX_PATH]; + GetCurrentDirectory(MAX_PATH, currentDir); + bi.lParam = (LPARAM)currentDir; + } else { + bi.lParam = (LPARAM)defPath; + } + + bi.lpfn = SHBrowseForFolderCallbackProc; if(FAILED(CoInitialize(0))) { @@ -134,4 +144,9 @@ int BrowseForFolder(HWND hParent, const char *htext, char *buf) return 1; } - +// Automatically expand to the configured folder. +int CALLBACK SHBrowseForFolderCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) { + if(uMsg == BFFM_INITIALIZED) + SendMessage(hwnd, BFFM_SETSELECTION, TRUE, (LPARAM)(const char*)lpData); + return 0; +} \ No newline at end of file diff --git a/src/drivers/win/gui.h b/src/drivers/win/gui.h index 25d71c6d..e1825c90 100644 --- a/src/drivers/win/gui.h +++ b/src/drivers/win/gui.h @@ -1,4 +1,4 @@ void ShowCursorAbs(int set_visible); -int BrowseForFolder(HWND hParent, const char *htext, char *buf); +int BrowseForFolder(HWND hParent, const char *htext, char *buf, char* defPath = NULL); void CenterWindow(HWND hwndDlg); void CenterWindowOnScreen(HWND hwnd); diff --git a/src/drivers/win/input.cpp b/src/drivers/win/input.cpp index 3021348e..50668570 100644 --- a/src/drivers/win/input.cpp +++ b/src/drivers/win/input.cpp @@ -1202,6 +1202,9 @@ static void UpdateFourscoreState(HWND dlg) SetDlgItemText(dlg,TXT_PAD1,ESI_Name(SI_GAMEPAD)); SetDlgItemText(dlg,TXT_PAD2,ESI_Name(SI_GAMEPAD)); } + + EnableWindow(GetDlgItem(dlg,102), enable); + EnableWindow(GetDlgItem(dlg,103), enable); } //Callback function of the input configuration dialog. @@ -1302,7 +1305,7 @@ BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara char btext[128]; if (autoHoldKey) { - if (!GetKeyNameText(autoHoldKey << 16, btext, 128)) + if (!GetKeyNameText((autoHoldKey & 0x7F) << 16 | (autoHoldKey & 0x80) << 17, btext, 128)) sprintf(btext, "KB: %d", autoHoldKey); } else { @@ -1483,7 +1486,7 @@ BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara if(button) { - if(!GetKeyNameText(button << 16, btext, 128)) + if(!GetKeyNameText((button & 0x7F) << 16 | (button & 0x80) << 17, btext, 128)) { sprintf(btext, "KB: %d", button); } @@ -1509,7 +1512,7 @@ BOOL CALLBACK InputConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara if(button) { - if( !GetKeyNameText(button << 16, btext, sizeof(btext))) + if( !GetKeyNameText((button & 0x7F) << 16 | (button & 0x80 << 17), btext, sizeof(btext))) { sprintf(btext, "KB: %d", button); } diff --git a/src/drivers/win/log.cpp b/src/drivers/win/log.cpp index a7305209..4232180b 100644 --- a/src/drivers/win/log.cpp +++ b/src/drivers/win/log.cpp @@ -2,7 +2,7 @@ #include "common.h" #include "tracer.h" -static HWND logwin = 0; +HWND logwin = 0; static char *logtext[MAXIMUM_NUMBER_OF_LOGS]; static int logcount=0; diff --git a/src/drivers/win/main.cpp b/src/drivers/win/main.cpp index 81a92c70..1190e2a7 100644 --- a/src/drivers/win/main.cpp +++ b/src/drivers/win/main.cpp @@ -354,16 +354,51 @@ int BlockingCheck() } } - if(!handled && taseditorWindow.hwndTASEditor && taseditorEnableAcceleratorKeys) + if(!handled && taseditorWindow.hwndTASEditor) { - if(IsChild(taseditorWindow.hwndTASEditor, msg.hwnd)) - handled = TranslateAccelerator(taseditorWindow.hwndTASEditor, fceu_hAccel, &msg); + if(taseditorEnableAcceleratorKeys) + if(IsChild(taseditorWindow.hwndTASEditor, msg.hwnd)) + handled = TranslateAccelerator(taseditorWindow.hwndTASEditor, fceu_hAccel, &msg); + if(!handled && taseditorWindow.hwndTASEditor){ + handled = IsDialogMessage(taseditorWindow.hwndTASEditor, &msg); + } } if(!handled && taseditorWindow.hwndFindNote) { if(IsChild(taseditorWindow.hwndFindNote, msg.hwnd)) handled = IsDialogMessage(taseditorWindow.hwndFindNote, &msg); } + + extern HWND uug; + if(!handled && uug && IsChild(uug, msg.hwnd)) + handled = IsDialogMessage(uug, &msg); + if(!handled && pwindow && IsChild(pwindow, msg.hwnd)) + handled = IsDialogMessage(pwindow, &msg); + if(!handled && hCDLogger && IsChild(hCDLogger, msg.hwnd)) + handled = IsDialogMessage(hCDLogger, &msg); + if(!handled && hTracer && IsChild(hTracer, msg.hwnd)) + handled = IsDialogMessage(hTracer, &msg); + extern HWND hGGConv; + if(!handled && hGGConv && IsChild(hGGConv, msg.hwnd)) + handled = IsDialogMessage(hGGConv, &msg); + if(!handled && hDebug && IsChild(hDebug, msg.hwnd)) + handled = IsDialogMessage(hDebug, &msg); + extern HWND hPPUView; + if(!handled && hPPUView && IsChild(hPPUView, msg.hwnd)) + handled = IsDialogMessage(hPPUView, &msg); + extern HWND hNTView; + if(!handled && hNTView && IsChild(hNTView, msg.hwnd)) + handled = IsDialogMessage(hNTView, &msg); + extern HWND hTextHooker; + if(!handled && hTextHooker && IsChild(hTextHooker, msg.hwnd)) + handled = IsDialogMessage(hTextHooker, &msg); + extern HWND LuaConsoleHWnd; + if(!handled && LuaConsoleHWnd && IsChild(LuaConsoleHWnd, msg.hwnd)) + handled = IsDialogMessage(LuaConsoleHWnd, &msg); + extern HWND logwin; + if(!handled && logwin && IsChild(logwin, msg.hwnd)) + handled = IsDialogMessage(logwin, &msg); + /* //adelikat - Currently no accel keys are used in the main window. Uncomment this block to activate them. if(!handled) if(msg.hwnd == hAppWnd) @@ -711,8 +746,6 @@ int main(int argc,char *argv[]) fullscreen=0; } - CreateMainWindow(); - // Do single instance coding, since we now know if the user wants it, // and we have a source window to send from // http://wiki.github.com/ffi/ffi/windows-examples @@ -741,12 +774,17 @@ int main(int argc,char *argv[]) { //kill this one, activate the other one SetActiveWindow(DoInstantiatedExitWindow); + if(IsIconic(DoInstantiatedExitWindow)) + ShowWindow(DoInstantiatedExitWindow, SW_RESTORE); + SetForegroundWindow(DoInstantiatedExitWindow); do_exit(); return 0; } } } + CreateMainWindow(); + if(!InitDInput()) { do_exit(); diff --git a/src/drivers/win/mapinput.cpp b/src/drivers/win/mapinput.cpp index 307aa518..98b97dfe 100644 --- a/src/drivers/win/mapinput.cpp +++ b/src/drivers/win/mapinput.cpp @@ -7,6 +7,7 @@ #include "../../input.h" #include #include "window.h" +#include "taseditor/taseditor_window.h" void KeyboardUpdateState(void); //mbg merge 7/17/06 yech had to add this @@ -689,7 +690,11 @@ BOOL CALLBACK MapInputDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM PopulateMappingDisplay(hwndDlg); // Autosize last column. - SendMessage(hwndListView, LVM_SETCOLUMNWIDTH, (WPARAM)2, MAKELPARAM(LVSCW_AUTOSIZE_USEHEADER, 0)); + SendMessage(hwndListView, LVM_SETCOLUMNWIDTH, (WPARAM)2, MAKELPARAM(LVSCW_AUTOSIZE, 0)); + SendMessage(hwndListView, LVM_SETCOLUMNWIDTH, (WPARAM)1, MAKELPARAM(LVSCW_AUTOSIZE, 0)); + RECT rect; + GetClientRect(hwndListView, &rect); + SendMessage(hwndListView, LVM_SETCOLUMNWIDTH, (WPARAM)2, MAKELPARAM(rect.right - rect.left - SendMessage(hwndListView, LVM_GETCOLUMNWIDTH, 0, 0) - SendMessage(hwndListView, LVM_GETCOLUMNWIDTH, 1, 0), 0)); CenterWindowOnScreen(hwndDlg); } @@ -708,6 +713,10 @@ BOOL CALLBACK MapInputDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM { case IDOK: UpdateMenuHotkeys(); + // Update TAS Editor's tooltips if it's opening. + extern TASEDITOR_WINDOW taseditorWindow; + if (taseditorWindow.hwndTASEditor) + taseditorWindow.updateTooltips(); EndDialog(hwndDlg, 1); return TRUE; diff --git a/src/drivers/win/memview.cpp b/src/drivers/win/memview.cpp index 7ce539a4..6f46e452 100644 --- a/src/drivers/win/memview.cpp +++ b/src/drivers/win/memview.cpp @@ -1262,9 +1262,10 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa // update menus for (i = MODE_NES_MEMORY; i <= MODE_NES_FILE; i++) - { - CheckMenuItem(GetMenu(hwnd), MENU_MV_VIEW_RAM + i, (EditingMode == i) ? MF_CHECKED : MF_UNCHECKED); - } + if(EditingMode == i) { + CheckMenuRadioItem(GetMenu(hMemView), MENU_MV_VIEW_RAM, MENU_MV_VIEW_ROM, MENU_MV_VIEW_RAM + i, MF_BYCOMMAND); + break; + } CheckMenuItem(GetMenu(hwnd), ID_HIGHLIGHTING_HIGHLIGHT_ACTIVITY, (MemView_HighlightActivity) ? MF_CHECKED: MF_UNCHECKED); CheckMenuItem(GetMenu(hwnd), ID_HIGHLIGHTING_FADEWHENPAUSED, (MemView_HighlightActivity_FadeWhenPaused) ? MF_CHECKED: MF_UNCHECKED); @@ -2038,9 +2039,11 @@ LRESULT CALLBACK MemViewCallB(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case MENU_MV_VIEW_ROM: EditingMode = wParam - MENU_MV_VIEW_RAM; for (i = MODE_NES_MEMORY; i <= MODE_NES_FILE; i++) - { - CheckMenuItem(GetMenu(hMemView), MENU_MV_VIEW_RAM + i, (EditingMode == i) ? MF_CHECKED : MF_UNCHECKED); - } + if(EditingMode == i) + { + CheckMenuRadioItem(GetMenu(hMemView), MENU_MV_VIEW_RAM, MENU_MV_VIEW_ROM, MENU_MV_VIEW_RAM + i, MF_BYCOMMAND); + break; + } if (EditingMode == MODE_NES_MEMORY) MaxSize = 0x10000; if (EditingMode == MODE_NES_PPU) diff --git a/src/drivers/win/memviewsp.cpp b/src/drivers/win/memviewsp.cpp index 83efde3d..1f155455 100644 --- a/src/drivers/win/memviewsp.cpp +++ b/src/drivers/win/memviewsp.cpp @@ -181,7 +181,7 @@ void updateBookmarkMenus(HMENU menu) { // Get the text of the menu char buffer[0x100]; - sprintf(buffer, i < 10 ? "$%04X - %s\tCTRL-%d" : "$%04X - %s", hexBookmarks[i].address, hexBookmarks[i].description, i); + sprintf(buffer, i < 10 ? "&%d. $%04X - %s\tCtrl+%d" : "%d. $%04X - %s",i, hexBookmarks[i].address, hexBookmarks[i].description, i); mi.dwTypeData = buffer; mi.cch = strlen(buffer); diff --git a/src/drivers/win/ntview.cpp b/src/drivers/win/ntview.cpp index b8ac8d61..0ebb504e 100644 --- a/src/drivers/win/ntview.cpp +++ b/src/drivers/win/ntview.cpp @@ -567,6 +567,8 @@ BOOL CALLBACK NTViewCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) break; case IDC_NTVIEW_SHOW_SCROLL_LINES : scrolllines ^= 1; + EnableWindow(GetDlgItem(hwndDlg, IDC_NTVIEW_SCANLINE_TEXT), scrolllines); + EnableWindow(GetDlgItem(hwndDlg, IDC_NTVIEW_SCANLINE), scrolllines); chrchanged = 1; break; case IDC_NTVIEW_SHOW_ATTRIBUTES : diff --git a/src/drivers/win/palette.cpp b/src/drivers/win/palette.cpp index 4c77e92d..bed79087 100644 --- a/src/drivers/win/palette.cpp +++ b/src/drivers/win/palette.cpp @@ -117,6 +117,11 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa CenterWindowOnScreen(hwndDlg); + EnableWindow(GetDlgItem(hwndDlg, 65463), ntsccol_enable); + EnableWindow(GetDlgItem(hwndDlg, 64395), ntsccol_enable); + EnableWindow(GetDlgItem(hwndDlg, CTL_HUE_TRACKBAR), ntsccol_enable); + EnableWindow(GetDlgItem(hwndDlg, CTL_TINT_TRACKBAR), ntsccol_enable); + break; case WM_HSCROLL: @@ -153,6 +158,11 @@ BOOL CALLBACK PaletteConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa case CHECK_PALETTE_ENABLED: ntsccol_enable ^= 1; FCEUI_SetNTSCTH(ntsccol_enable, ntsctint, ntschue); // it recalculates everything, use it for PAL block too! + EnableWindow(GetDlgItem(hwndDlg, 65463), ntsccol_enable); + EnableWindow(GetDlgItem(hwndDlg, 64395), ntsccol_enable); + EnableWindow(GetDlgItem(hwndDlg, CTL_HUE_TRACKBAR), ntsccol_enable); + EnableWindow(GetDlgItem(hwndDlg, CTL_TINT_TRACKBAR), ntsccol_enable); + break; case CHECK_PALETTE_GRAYSCALE: diff --git a/src/drivers/win/replay.cpp b/src/drivers/win/replay.cpp index fb5cd8d1..9b5e7520 100644 --- a/src/drivers/win/replay.cpp +++ b/src/drivers/win/replay.cpp @@ -289,6 +289,8 @@ void UpdateReplayDialog(HWND hwndDlg) EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_READONLY),FALSE); EnableWindow(GetDlgItem(hwndDlg,IDOK),FALSE); } + EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_STOPMOVIE), !doClear); + EnableWindow(GetDlgItem(hwndDlg,IDC_EDIT_STOPFRAME), !doClear && SendDlgItemMessage(hwndDlg, IDC_CHECK_STOPMOVIE, BM_GETCHECK, 0, 0) == BST_CHECKED); } // C:\fceu\movies\bla.fcm + C:\fceu\fceu\ -> C:\fceu\movies\bla.fcm @@ -649,6 +651,9 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP int wID = LOWORD(wParam); switch(wID) { + case IDC_CHECK_STOPMOVIE: + EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT_STOPFRAME), SendDlgItemMessage(hwndDlg, IDC_CHECK_STOPMOVIE, BM_GETCHECK, 0, 0) == BST_CHECKED); + break; case IDC_BUTTON_METADATA: DialogBoxParam(fceu_hInstance, "IDD_REPLAY_METADATA", hwndDlg, ReplayMetadataDialogProc, (LPARAM)0); break; @@ -714,6 +719,21 @@ BOOL CALLBACK ReplayDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP } else { + extern unsigned int FrozenAddressCount; + if(FrozenAddressCount) + { + char ch[512]; + sprintf(ch, "You have %d activated cheats. If this is not your intentional, it can cause playback prblems! Do you want to disable all of them and continue?", FrozenAddressCount); + switch(MessageBox(hwndDlg, ch, "Movie playing problem", MB_YESNOCANCEL|MB_ICONEXCLAMATION)) + { + case IDCANCEL: + return TRUE; + case IDYES: + extern void DisableAllCheats(); + DisableAllCheats(); + } + + } // user had made their choice // TODO: warn the user when they open a movie made with a different ROM char* fn=GetReplayPath(hwndDlg); diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index 1e9e6102..1ee99401 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -7,93 +7,16 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include "afxres.h" - +#include "afxres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// Russian (Russia) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_TASEDITOR_SAVINGOPTIONS DIALOGEX 0, 0, 223, 208 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Project file saving options" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,109,187,50,14 - PUSHBUTTON "Cancel",IDCANCEL,165,187,50,14 - CONTROL " Binary format of Input",IDC_CHECK_BINARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,17,89,10 - CONTROL " Markers",IDC_CHECK_MARKERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,32,67,10 - CONTROL " Bookmarks",IDC_CHECK_BOOKMARKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,47,67,10 - CONTROL " History",IDC_CHECK_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,62,67,10 - CONTROL " Piano Roll",IDC_CHECK_PIANO_ROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,77,67,10 - CONTROL " Selection",IDC_CHECK_SELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,92,67,10 - GROUPBOX "File contents",IDC_STATIC,105,4,111,177 - GROUPBOX "Greenzone saving options",IDC_STATIC,112,106,97,69 - CONTROL " all frames",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,122,117,77,10 - CONTROL " every 16th frame",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,122,131,77,10 - CONTROL " marked frames",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,122,145,77,10 - CONTROL " don't save",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,122,159,77,10 - CONTROL " Autosave project",IDC_AUTOSAVE_PROJECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,17,81,10 - CONTROL " silently",IDC_SILENT_AUTOSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,47,42,10 - LTEXT "every",IDC_STATIC,14,32,21,8 - EDITTEXT IDC_AUTOSAVE_PERIOD,36,30,24,14,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "minutes",IDC_STATIC,64,32,28,8 - GROUPBOX "Settings",IDC_STATIC,6,4,91,177 -END - -IDD_SYMBOLIC_DEBUG_NAMING DIALOGEX 0, 0, 245, 83 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Symbolic Debug Naming" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - DEFPUSHBUTTON "OK",IDOK,132,62,50,14 - PUSHBUTTON "Cancel",IDCANCEL,189,62,50,14 - LTEXT "File",IDC_STATIC,7,7,15,9 - EDITTEXT IDC_SYMBOLIC_ADDRESS,38,24,33,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP - LTEXT "Address",IDC_STATIC,6,26,30,10 - EDITTEXT IDC_SYMBOLIC_NAME,107,24,132,13,ES_AUTOHSCROLL - LTEXT "Name",IDC_STATIC,83,26,22,10 - LTEXT "Comment",IDC_STATIC,6,45,37,10 - EDITTEXT IDC_SYMBOLIC_COMMENT,45,43,194,13,ES_AUTOHSCROLL - EDITTEXT IDC_SYMBOLIC_FILENAME,24,6,215,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_SYMBOLIC_DEBUG_NAMING, DIALOG - BEGIN - BOTTOMMARGIN, 82 - END -END -#endif // APSTUDIO_INVOKED - -#endif // Russian (Russia) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Neutral resources +// 非特定语言 resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1252) +#pragma code_page(936) ///////////////////////////////////////////////////////////////////////////// // @@ -431,11 +354,11 @@ BEGIN GROUPBOX "NES Palette",302,10,8,102,81,WS_GROUP DEFPUSHBUTTON "&Load Palette...",BTN_PALETTE_LOAD,18,39,58,14 CONTROL "Enabled",CHECK_PALETTE_ENABLED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,22,87,12 - CONTROL "Tint",CTL_TINT_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,121,44,91,11 + CONTROL "Tint",CTL_TINT_TRACKBAR,"msctls_trackbar32",WS_DISABLED | WS_TABSTOP,121,44,91,11 GROUPBOX "NTSC Color Emulation",101,115,8,103,81,WS_GROUP - CONTROL "Hue",CTL_HUE_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,121,69,91,11 - CTEXT "Hue",64395,124,59,85,8 - CTEXT "Tint",65463,123,34,85,8 + CONTROL "Hue",CTL_HUE_TRACKBAR,"msctls_trackbar32",WS_DISABLED | WS_TABSTOP,121,69,91,11 + CTEXT "Hue",64395,124,59,85,8,WS_DISABLED + CTEXT "Tint",65463,123,34,85,8,WS_DISABLED CONTROL "Force Grayscale",CHECK_PALETTE_GRAYSCALE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,57,85,12 CONTROL "Use Custom Palette",CHECK_PALETTE_CUSTOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,22,85,12 GROUPBOX "PAL Emulation",IDC_STATIC,10,89,208,66,WS_DISABLED @@ -513,7 +436,7 @@ BEGIN COMBOBOX COMBO_SOUND_RATE,50,61,53,46,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Hz",65460,108,64,15,9 LTEXT "Depth:",65462,17,85,27,10 - COMBOBOX COMBO_SOUND_8BIT,50,82,67,45,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX COMBO_SOUND_8BIT,50,82,67,45,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "Mute frame advance",CHECK_SOUND_MUTEFA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,110,87,11 CONTROL "Mute Turbo",CHECK_SOUND_MUTETURBO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,111,53,10 GROUPBOX "Triangle",131,70,142,44,93,WS_GROUP @@ -654,11 +577,11 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,8,183,12 CONTROL "Set high-priority thread.",CB_SET_HIGH_PRIORITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,24,102,12 CONTROL "Overclocking (old PPU only).",CB_OVERCLOCKING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,41,101,10 - EDITTEXT IDC_EXTRA_SCANLINES,104,55,84,14,ES_AUTOHSCROLL - LTEXT "Post-render scanlines:",IDC_STATIC,21,57,74,8 - CONTROL "Don't overclock 7-bit samples.",CB_SKIP_7BIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,87,111,10 - EDITTEXT IDC_VBLANK_SCANLINES,104,68,84,14,ES_AUTOHSCROLL - LTEXT "VBlank scanlines:",IDC_STATIC,21,71,76,8 + EDITTEXT IDC_EXTRA_SCANLINES,104,55,84,14,ES_AUTOHSCROLL | WS_DISABLED + LTEXT "Post-render scanlines:",IDC_EXTRA_SCANLINES_TEXT,21,57,74,8, WS_DISABLED + CONTROL "Don't overclock 7-bit samples.",CB_SKIP_7BIT,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,10,87,111,10 + EDITTEXT IDC_VBLANK_SCANLINES,104,68,84,14,ES_AUTOHSCROLL | WS_DISABLED + LTEXT "VBlank scanlines:",IDC_VBLANK_SCANLINES_TEXT,21,71,76,8, WS_DISABLED END MOVIEOPTIONS DIALOGEX 65520, 76, 147, 222 @@ -944,7 +867,7 @@ BEGIN LTEXT "Refresh: More",-1,225,254,50,9 CONTROL "",IDC_NTVIEW_REFRESH_TRACKBAR,"msctls_trackbar32",WS_TABSTOP,275,254,50,11 LTEXT "Less",-1,325,254,18,10 - LTEXT "Display on scanline:",-1,253,269,65,9 + LTEXT "Display on scanline:",IDC_NTVIEW_SCANLINE_TEXT,253,269,65,9 EDITTEXT IDC_NTVIEW_SCANLINE,315,267,27,12 CONTROL "Show Scroll Lines",IDC_NTVIEW_SHOW_SCROLL_LINES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,254,69,10 CONTROL "Show Attributes",IDC_NTVIEW_SHOW_ATTRIBUTES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,265,69,10 @@ -1512,9 +1435,9 @@ BEGIN CONTROL "TV Aspect",IDC_VIDEOCONFIG_TVASPECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,357,29,48,12 GROUPBOX "When resizing the window",65431,188,38,152,43,WS_GROUP CONTROL "Square pixels",IDC_VIDEOCONFIG_SQUARE_PIXELS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,448,14,55,12 - EDITTEXT IDC_TVASPECT_X,407,28,41,12,ES_AUTOHSCROLL - EDITTEXT IDC_TVASPECT_Y,458,28,41,12,ES_AUTOHSCROLL - CTEXT "/",IDC_STATIC_SLASHTEXT,449,31,8,8 + EDITTEXT IDC_TVASPECT_X,407,28,41,12,ES_AUTOHSCROLL | WS_DISABLED + EDITTEXT IDC_TVASPECT_Y,458,28,41,12,ES_AUTOHSCROLL | WS_DISABLED + CTEXT "/",IDC_STATIC_SLASHTEXT,449,31,8,8,WS_DISABLED LTEXT "DirectDraw:",65454,11,126,46,10 LTEXT "DirectDraw:",65455,188,125,46,10 COMBOBOX IDC_VIDEOCONFIG_DIRECTDRAW_FS,59,123,105,50,CBS_DROPDOWNLIST | WS_TABSTOP @@ -1730,6 +1653,10 @@ BEGIN BOTTOMMARGIN, 121 END + "NTVIEW", DIALOG + BEGIN + END + "MONITOR", DIALOG BEGIN LEFTMARGIN, 7 @@ -1756,6 +1683,10 @@ BEGIN BOTTOMMARGIN, 198 END + "TASEDITOR", DIALOG + BEGIN + END + "ASSEMBLER", DIALOG BEGIN LEFTMARGIN, 7 @@ -2460,12 +2391,119 @@ BEGIN END END -#endif // Neutral resources + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +NTVIEW AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +TIMINGCONFIG AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +#endif // 非特定语言 resources ///////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// -// English (United States) resources +// 俄语(俄罗斯) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT +#pragma code_page(1251) + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_TASEDITOR_SAVINGOPTIONS DIALOGEX 0, 0, 223, 208 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Project file saving options" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,109,187,50,14 + PUSHBUTTON "Cancel",IDCANCEL,165,187,50,14 + CONTROL " Binary format of Input",IDC_CHECK_BINARY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,17,89,10 + CONTROL " Markers",IDC_CHECK_MARKERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,32,67,10 + CONTROL " Bookmarks",IDC_CHECK_BOOKMARKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,47,67,10 + CONTROL " History",IDC_CHECK_HISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,62,67,10 + CONTROL " Piano Roll",IDC_CHECK_PIANO_ROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,77,67,10 + CONTROL " Selection",IDC_CHECK_SELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,122,92,67,10 + GROUPBOX "File contents",IDC_STATIC,105,4,111,177 + GROUPBOX "Greenzone saving options",IDC_STATIC,112,106,97,69 + CONTROL " all frames",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,122,117,77,10 + CONTROL " every 16th frame",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,122,131,77,10 + CONTROL " marked frames",IDC_RADIO3,"Button",BS_AUTORADIOBUTTON,122,145,77,10 + CONTROL " don't save",IDC_RADIO4,"Button",BS_AUTORADIOBUTTON,122,159,77,10 + CONTROL " Autosave project",IDC_AUTOSAVE_PROJECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,17,81,10 + CONTROL " silently",IDC_SILENT_AUTOSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,47,42,10 + LTEXT "every",IDC_AUTOSAVE_PERIOD_EVERY_TEXT,14,32,21,8 + EDITTEXT IDC_AUTOSAVE_PERIOD,36,30,24,14,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "minutes",IDC_AUTOSAVE_PERIOD_MINUTES_TEXT,64,32,28,8 + GROUPBOX "Settings",IDC_STATIC,6,4,91,177 +END + +IDD_SYMBOLIC_DEBUG_NAMING DIALOGEX 0, 0, 245, 83 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Symbolic Debug Naming" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "OK",IDOK,132,62,50,14 + PUSHBUTTON "Cancel",IDCANCEL,189,62,50,14 + LTEXT "File",IDC_STATIC,7,7,15,9 + EDITTEXT IDC_SYMBOLIC_ADDRESS,38,24,33,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP + LTEXT "Address",IDC_STATIC,6,26,30,10 + EDITTEXT IDC_SYMBOLIC_NAME,107,24,132,13,ES_AUTOHSCROLL + LTEXT "Name",IDC_STATIC,83,26,22,10 + LTEXT "Comment",IDC_STATIC,6,45,37,10 + EDITTEXT IDC_SYMBOLIC_COMMENT,45,43,194,13,ES_AUTOHSCROLL + EDITTEXT IDC_SYMBOLIC_FILENAME,24,6,215,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_TABSTOP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_TASEDITOR_SAVINGOPTIONS, DIALOG + BEGIN + END + + IDD_SYMBOLIC_DEBUG_NAMING, DIALOG + BEGIN + BOTTOMMARGIN, 82 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_TASEDITOR_SAVINGOPTIONS AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +#endif // 俄语(俄罗斯) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// 英语(美国) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US @@ -2699,7 +2737,7 @@ IDB_BITMAP_SELECTED17 BITMAP "res\\te_17_selected.bmp" IDB_BITMAP_SELECTED18 BITMAP "res\\te_18_selected.bmp" IDB_BITMAP_SELECTED19 BITMAP "res\\te_19_selected.bmp" IDB_BRANCH_SPRITESHEET BITMAP "res\\branch_spritesheet.bmp" -#endif // English (United States) resources +#endif // 英语(美国) resources ///////////////////////////////////////////////////////////////////////////// @@ -2709,8 +2747,7 @@ IDB_BRANCH_SPRITESHEET BITMAP "res\\branch_spritesheet.bmp" // // Generated from the TEXTINCLUDE 3 resource. // - - + ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED diff --git a/src/drivers/win/resource.h b/src/drivers/win/resource.h index dcd58f63..1839a585 100644 --- a/src/drivers/win/resource.h +++ b/src/drivers/win/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by res.rc +// Microsoft Visual C++ 生成的包含文件。 +// 供 res.rc 使用 // #define CLOSE_BUTTON 1 #define BUTTON_CLOSE 1 @@ -784,6 +784,10 @@ #define IDC_RICHEDIT_DISASM 1304 #define IDC_CHECK2 1305 #define DEBUGIDAFONT 1305 +#define IDC_AUTOSAVE_PERIOD_EVERY_TEXT 1306 +#define IDC_AUTOSAVE_PERIOD_MINUTES_TEXT 1307 +#define IDC_VBLANK_SCANLINES_TEXT 1308 +#define IDC_EXTRA_SCANLINES_TEXT 1309 #define MENU_NETWORK 40040 #define MENU_PALETTE 40041 #define MENU_SOUND 40042 @@ -1271,14 +1275,15 @@ #define IDC_STATIC_SLASHTEXT 65442 #define IDC_BOOKMARK_NAME_TEXT 65535 #define ID_CDL 65535 +#define IDC_NTVIEW_SCANLINE_TEXT 65535 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 293 +#define _APS_NEXT_RESOURCE_VALUE 296 #define _APS_NEXT_COMMAND_VALUE 40600 -#define _APS_NEXT_CONTROL_VALUE 1306 +#define _APS_NEXT_CONTROL_VALUE 1310 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/drivers/win/sound.cpp b/src/drivers/win/sound.cpp index baef27fd..ae5f1a86 100644 --- a/src/drivers/win/sound.cpp +++ b/src/drivers/win/sound.cpp @@ -387,7 +387,7 @@ void win_SoundWriteData(int32 *buffer, int count) { //-------- //GUI and control APIs -static HWND uug=0; +HWND uug=0; static void UpdateSD(HWND hwndDlg) { @@ -450,6 +450,7 @@ static void UpdateSD(HWND hwndDlg) EnableWindow(GetDlgItem(hwndDlg,65457),FALSE); //Misc. Output Format group EnableWindow(GetDlgItem(hwndDlg,65455),FALSE); + EnableWindow(GetDlgItem(hwndDlg,65462),FALSE); EnableWindow(GetDlgItem(hwndDlg,65461),FALSE); EnableWindow(GetDlgItem(hwndDlg,65460),FALSE); @@ -490,6 +491,7 @@ static void UpdateSD(HWND hwndDlg) EnableWindow(GetDlgItem(hwndDlg,65457),TRUE); //Misc. Output Format group EnableWindow(GetDlgItem(hwndDlg,65455),TRUE); + EnableWindow(GetDlgItem(hwndDlg,65462),TRUE); EnableWindow(GetDlgItem(hwndDlg,65461),TRUE); EnableWindow(GetDlgItem(hwndDlg,65460),TRUE); diff --git a/src/drivers/win/taseditor.cpp b/src/drivers/win/taseditor.cpp index ef423732..86f89e6b 100644 --- a/src/drivers/win/taseditor.cpp +++ b/src/drivers/win/taseditor.cpp @@ -682,12 +682,23 @@ BOOL CALLBACK savingOptionsWndProc(HWND hwndDlg, UINT message, WPARAM wParam, LP CheckDlgButton(hwndDlg, IDC_CHECK_PIANO_ROLL, taseditorConfig.projectSavingOptions_SavePianoRoll?BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CHECK_SELECTION, taseditorConfig.projectSavingOptions_SaveSelection?BST_CHECKED : BST_UNCHECKED); CheckRadioButton(hwndDlg, IDC_RADIO1, IDC_RADIO4, IDC_RADIO1 + (taseditorConfig.projectSavingOptions_GreenzoneSavingMode % GREENZONE_SAVING_MODES_TOTAL)); + EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSAVE_PERIOD), taseditorConfig.autosaveEnabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSAVE_PERIOD_EVERY_TEXT), taseditorConfig.autosaveEnabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSAVE_PERIOD_MINUTES_TEXT), taseditorConfig.autosaveEnabled); return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { + case IDC_AUTOSAVE_PROJECT: + { + bool chk = BST_CHECKED == SendDlgItemMessage(hwndDlg, IDC_AUTOSAVE_PROJECT, BM_GETCHECK, 0, 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSAVE_PERIOD), chk); + EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSAVE_PERIOD_EVERY_TEXT), chk); + EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSAVE_PERIOD_MINUTES_TEXT), chk); + } + break; case IDOK: { taseditorConfig.autosaveEnabled = (SendDlgItemMessage(hwndDlg, IDC_AUTOSAVE_PROJECT, BM_GETCHECK, 0, 0) == BST_CHECKED); diff --git a/src/drivers/win/taseditor/piano_roll.cpp b/src/drivers/win/taseditor/piano_roll.cpp index f0198fc2..ae3161d6 100644 --- a/src/drivers/win/taseditor/piano_roll.cpp +++ b/src/drivers/win/taseditor/piano_roll.cpp @@ -433,7 +433,7 @@ void PIANO_ROLL::reset() mustRedrawList = mustCheckItemUnderMouse = true; playbackCursorOffset = 0; shiftHeld = ctrlHeld = altHeld = false; - shiftTimer = ctrlTimer = shiftActions裲unt = ctrlActions裲unt = 0; + shiftTimer = ctrlTimer = shiftActionsCount = ctrlActionsCount = 0; nextHeaderUpdateTime = headerItemUnderMouse = 0; // delete all columns except 0th while (ListView_DeleteColumn(hwndList, 1)) {} @@ -480,16 +480,16 @@ void PIANO_ROLL::update() { if ((int)(shiftTimer + GetDoubleClickTime()) > clock()) { - shiftActions裲unt++; - if (shiftActions裲unt >= DOUBLETAP_COUNT) + shiftActionsCount++; + if (shiftActionsCount >= DOUBLETAP_COUNT) { if (taseditorWindow.TASEditorIsInFocus) followPlaybackCursor(); - shiftActions裲unt = ctrlActions裲unt = 0; + shiftActionsCount = ctrlActionsCount = 0; } } else { - shiftActions裲unt = 0; + shiftActionsCount = 0; } shiftTimer = clock(); } @@ -497,16 +497,16 @@ void PIANO_ROLL::update() { if ((int)(ctrlTimer + GetDoubleClickTime()) > clock()) { - ctrlActions裲unt++; - if (ctrlActions裲unt >= DOUBLETAP_COUNT) + ctrlActionsCount++; + if (ctrlActionsCount >= DOUBLETAP_COUNT) { if (taseditorWindow.TASEditorIsInFocus) followSelection(); - ctrlActions裲unt = shiftActions裲unt = 0; + ctrlActionsCount = shiftActionsCount = 0; } } else { - ctrlActions裲unt = 0; + ctrlActionsCount = 0; } ctrlTimer = clock(); } diff --git a/src/drivers/win/taseditor/piano_roll.h b/src/drivers/win/taseditor/piano_roll.h index 9d912a9e..033d5f13 100644 --- a/src/drivers/win/taseditor/piano_roll.h +++ b/src/drivers/win/taseditor/piano_roll.h @@ -217,7 +217,7 @@ public: bool shiftHeld, ctrlHeld, altHeld; int shiftTimer, ctrlTimer; - int shiftActions裲unt, ctrlActions裲unt; + int shiftActionsCount, ctrlActionsCount; HWND hwndMarkerDragBox, hwndMarkerDragBoxText; // GDI stuff diff --git a/src/drivers/win/taseditor/taseditor_window.cpp b/src/drivers/win/taseditor/taseditor_window.cpp index c4afb7fd..815c6a46 100644 --- a/src/drivers/win/taseditor/taseditor_window.cpp +++ b/src/drivers/win/taseditor/taseditor_window.cpp @@ -132,47 +132,47 @@ char taseditorHelpFilename[] = "\\taseditor.chm"; // "y < 0" means that the coordinate is counted from the lower border of the window (bottom-aligned) // The items in this array MUST be sorted by the same order as the Window_items_enum! WindowItemData windowItems[TASEDITOR_WINDOW_TOTAL_ITEMS] = { - WINDOWITEMS_PIANO_ROLL, IDC_LIST1, 0, 0, -1, -1, "", "", false, 0, 0, - WINDOWITEMS_PLAYBACK_MARKER, IDC_PLAYBACK_MARKER, 0, 0, 0, 0, "Click here to scroll Piano Roll to Playback cursor (hotkey: tap Shift twice)", "", false, 0, 0, - WINDOWITEMS_PLAYBACK_MARKER_EDIT, IDC_PLAYBACK_MARKER_EDIT, 0, 0, -1, 0, "Click to edit text", "", false, 0, 0, - WINDOWITEMS_SELECTION_MARKER, IDC_SELECTION_MARKER, 0, -1, 0, -1, "Click here to scroll Piano Roll to Selection (hotkey: tap Ctrl twice)", "", false, 0, 0, - WINDOWITEMS_SELECTION_MARKER_EDIT, IDC_SELECTION_MARKER_EDIT, 0, -1, -1, -1, "Click to edit text", "", false, 0, 0, - WINDOWITEMS_PLAYBACK_BOX, IDC_PLAYBACK_BOX, -1, 0, 0, 0, "", "", false, 0, 0, - WINDOWITEMS_PROGRESS_BUTTON, IDC_PROGRESS_BUTTON, -1, 0, 0, 0, "Click here when you want to abort seeking", "", false, EMUCMD_TASEDITOR_CANCEL_SEEKING, 0, - WINDOWITEMS_REWIND_FULL, TASEDITOR_REWIND_FULL, -1, 0, 0, 0, "Send Playback to previous Marker (mouse: Shift+Wheel up) (hotkey: Shift+PageUp)", "", false, 0, 0, - WINDOWITEMS_REWIND, TASEDITOR_REWIND, -1, 0, 0, 0, "Rewind 1 frame (mouse: Right button+Wheel up) (hotkey: Shift+Up)", "", false, EMUCMD_TASEDITOR_REWIND, 0, - WINDOWITEMS_PAUSE, TASEDITOR_PLAYSTOP, -1, 0, 0, 0, "Pause/Unpause Emulation (mouse: Middle button)", "", false, EMUCMD_PAUSE, 0, - WINDOWITEMS_FORWARD, TASEDITOR_FORWARD, -1, 0, 0, 0, "Advance 1 frame (mouse: Right button+Wheel down) (hotkey: Shift+Down)", "", false, EMUCMD_FRAME_ADVANCE, 0, - WINDOWITEMS_FORWARD_FULL, TASEDITOR_FORWARD_FULL, -1, 0, 0, 0, "Send Playback to next Marker (mouse: Shift+Wheel down) (hotkey: Shift+PageDown)", "", false, 0, 0, - WINDOWITEMS_PROGRESS_BAR, IDC_PROGRESS1, -1, 0, 0, 0, "", "", false, 0, 0, - WINDOWITEMS_FOLLOW_CURSOR, CHECK_FOLLOW_CURSOR, -1, 0, 0, 0, "The Piano Roll will follow Playback cursor movements", "", false, 0, 0, - WINDOWITEMS_TURBO_SEEK, CHECK_TURBO_SEEK, -1, 0, 0, 0, "Uncheck when you need to watch seeking in slow motion", "", false, 0, 0, - WINDOWITEMS_AUTORESTORE_PLAYBACK, CHECK_AUTORESTORE_PLAYBACK, -1, 0, 0, 0, "Whenever you change Input above Playback cursor, the cursor returns to where it was before the change", "", false, EMUCMD_TASEDITOR_SWITCH_AUTORESTORING, 0, - WINDOWITEMS_RECORDER_BOX, IDC_RECORDER_BOX, -1, 0, 0, 0, "", "", false, 0, 0, - WINDOWITEMS_RECORDING, IDC_RECORDING, -1, 0, 0, 0, "Switch Input Recording on/off", "", false, EMUCMD_MOVIE_READONLY_TOGGLE, 0, - WINDOWITEMS_RECORD_ALL, IDC_RADIO_ALL, -1, 0, 0, 0, "Switch off Multitracking", "", false, 0, 0, - WINDOWITEMS_RECORD_1P, IDC_RADIO_1P, -1, 0, 0, 0, "Select Joypad 1 as current", "", false, EMUCMD_TASEDITOR_SWITCH_MULTITRACKING, 0, - WINDOWITEMS_RECORD_2P, IDC_RADIO_2P, -1, 0, 0, 0, "Select Joypad 2 as current", "", false, EMUCMD_TASEDITOR_SWITCH_MULTITRACKING, 0, - WINDOWITEMS_RECORD_3P, IDC_RADIO_3P, -1, 0, 0, 0, "Select Joypad 3 as current", "", false, EMUCMD_TASEDITOR_SWITCH_MULTITRACKING, 0, - WINDOWITEMS_RECORD_4P, IDC_RADIO_4P, -1, 0, 0, 0, "Select Joypad 4 as current", "", false, EMUCMD_TASEDITOR_SWITCH_MULTITRACKING, 0, - WINDOWITEMS_SUPERIMPOSE, IDC_SUPERIMPOSE, -1, 0, 0, 0, "Allows to superimpose old Input with new buttons, instead of overwriting", "", false, 0, 0, - WINDOWITEMS_USE_PATTERN, IDC_USEPATTERN, -1, 0, 0, 0, "Applies current Autofire Pattern to Input recording", "", false, 0, 0, - WINDOWITEMS_SPLICER_BOX, IDC_SPLICER_BOX, -1, 0, 0, 0, "", "", false, 0, 0, - WINDOWITEMS_SELECTION_TEXT, IDC_TEXT_SELECTION, -1, 0, 0, 0, "Current size of Selection", "", false, 0, 0, - WINDOWITEMS_CLIPBOARD_TEXT, IDC_TEXT_CLIPBOARD, -1, 0, 0, 0, "Current size of Input in the Clipboard", "", false, 0, 0, - WINDOWITEMS_LUA_BOX, IDC_LUA_BOX, -1, 0, 0, 0, "", "", false, 0, 0, - WINDOWITEMS_RUN_MANUAL, TASEDITOR_RUN_MANUAL, -1, 0, 0, 0, "Press the button to execute Lua Manual Function", "", false, EMUCMD_TASEDITOR_RUN_MANUAL_LUA, 0, - WINDOWITEMS_RUN_AUTO, IDC_RUN_AUTO, -1, 0, 0, 0, "Enable Lua Auto Function (but first it must be registered by Lua script)", "", false, 0, 0, - WINDOWITEMS_BRANCHES_BUTTON, IDC_BRANCHES_BUTTON, -1, 0, 0, 0, "Click here to switch between Bookmarks List and Branches Tree", "", false, 0, 0, - WINDOWITEMS_BOOKMARKS_BOX, IDC_BOOKMARKS_BOX, -1, 0, 0, 0, "", "", false, 0, 0, - WINDOWITEMS_BOOKMARKS_LIST, IDC_BOOKMARKSLIST, -1, 0, 0, 0, "Right click = set Bookmark, Left click = jump to Bookmark or load Branch", "", false, 0, 0, - WINDOWITEMS_BRANCHES_BITMAP, IDC_BRANCHES_BITMAP, -1, 0, 0, 0, "Right click = set Bookmark, single Left click = jump to Bookmark, double Left click = load Branch", "", false, 0, 0, - WINDOWITEMS_HISTORY_BOX, IDC_HISTORY_BOX, -1, 0, 0, -1, "", "", false, 0, 0, - WINDOWITEMS_HISTORY_LIST, IDC_HISTORYLIST, -1, 0, 0, -1, "Click to revert the project back to that time", "", false, 0, 0, - WINDOWITEMS_PREVIOUS_MARKER, TASEDITOR_PREV_MARKER, -1, -1, 0, -1, "Send Selection to previous Marker (mouse: Ctrl+Wheel up) (hotkey: Ctrl+PageUp)", "", false, 0, 0, - WINDOWITEMS_SIMILAR, TASEDITOR_FIND_BEST_SIMILAR_MARKER, -1, -1, 0, -1, "Auto-search for Marker Note", "", false, 0, 0, - WINDOWITEMS_MORE, TASEDITOR_FIND_NEXT_SIMILAR_MARKER, -1, -1, 0, -1, "Continue Auto-search", "", false, 0, 0, - WINDOWITEMS_NEXT_MARKER, TASEDITOR_NEXT_MARKER, -1, -1, 0, -1, "Send Selection to next Marker (mouse: Ctrl+Wheel up) (hotkey: Ctrl+PageDown)", "", false, 0, 0, + WINDOWITEMS_PIANO_ROLL, IDC_LIST1, 0, 0, -1, -1, "", false, 0, 0, + WINDOWITEMS_PLAYBACK_MARKER, IDC_PLAYBACK_MARKER, 0, 0, 0, 0, "Click here to scroll Piano Roll to Playback cursor (hotkey: tap Shift twice)", false, 0, 0, + WINDOWITEMS_PLAYBACK_MARKER_EDIT, IDC_PLAYBACK_MARKER_EDIT, 0, 0, -1, 0, "Click to edit text", false, 0, 0, + WINDOWITEMS_SELECTION_MARKER, IDC_SELECTION_MARKER, 0, -1, 0, -1, "Click here to scroll Piano Roll to Selection (hotkey: tap Ctrl twice)", false, 0, 0, + WINDOWITEMS_SELECTION_MARKER_EDIT, IDC_SELECTION_MARKER_EDIT, 0, -1, -1, -1, "Click to edit text", false, 0, 0, + WINDOWITEMS_PLAYBACK_BOX, IDC_PLAYBACK_BOX, -1, 0, 0, 0, "", false, 0, 0, + WINDOWITEMS_PROGRESS_BUTTON, IDC_PROGRESS_BUTTON, -1, 0, 0, 0, "Click here when you want to abort seeking", false, EMUCMD_TASEDITOR_CANCEL_SEEKING, 0, + WINDOWITEMS_REWIND_FULL, TASEDITOR_REWIND_FULL, -1, 0, 0, 0, "Send Playback to previous Marker (mouse: Shift+Wheel up) (hotkey: Shift+PageUp)", false, 0, 0, + WINDOWITEMS_REWIND, TASEDITOR_REWIND, -1, 0, 0, 0, "Rewind 1 frame (mouse: Right button+Wheel up) (hotkey: Shift+Up)", false, EMUCMD_TASEDITOR_REWIND, 0, + WINDOWITEMS_PAUSE, TASEDITOR_PLAYSTOP, -1, 0, 0, 0, "Pause/Unpause Emulation (mouse: Middle button)", false, EMUCMD_PAUSE, 0, + WINDOWITEMS_FORWARD, TASEDITOR_FORWARD, -1, 0, 0, 0, "Advance 1 frame (mouse: Right button+Wheel down) (hotkey: Shift+Down)", false, EMUCMD_FRAME_ADVANCE, 0, + WINDOWITEMS_FORWARD_FULL, TASEDITOR_FORWARD_FULL, -1, 0, 0, 0, "Send Playback to next Marker (mouse: Shift+Wheel down) (hotkey: Shift+PageDown)", false, 0, 0, + WINDOWITEMS_PROGRESS_BAR, IDC_PROGRESS1, -1, 0, 0, 0, "", false, 0, 0, + WINDOWITEMS_FOLLOW_CURSOR, CHECK_FOLLOW_CURSOR, -1, 0, 0, 0, "The Piano Roll will follow Playback cursor movements", false, 0, 0, + WINDOWITEMS_TURBO_SEEK, CHECK_TURBO_SEEK, -1, 0, 0, 0, "Uncheck when you need to watch seeking in slow motion", false, 0, 0, + WINDOWITEMS_AUTORESTORE_PLAYBACK, CHECK_AUTORESTORE_PLAYBACK, -1, 0, 0, 0, "Whenever you change Input above Playback cursor, the cursor returns to where it was before the change", false, EMUCMD_TASEDITOR_SWITCH_AUTORESTORING, 0, + WINDOWITEMS_RECORDER_BOX, IDC_RECORDER_BOX, -1, 0, 0, 0, "", false, 0, 0, + WINDOWITEMS_RECORDING, IDC_RECORDING, -1, 0, 0, 0, "Switch Input Recording on/off", false, EMUCMD_MOVIE_READONLY_TOGGLE, 0, + WINDOWITEMS_RECORD_ALL, IDC_RADIO_ALL, -1, 0, 0, 0, "Switch off Multitracking", false, 0, 0, + WINDOWITEMS_RECORD_1P, IDC_RADIO_1P, -1, 0, 0, 0, "Select Joypad 1 as current", false, EMUCMD_TASEDITOR_SWITCH_MULTITRACKING, 0, + WINDOWITEMS_RECORD_2P, IDC_RADIO_2P, -1, 0, 0, 0, "Select Joypad 2 as current", false, EMUCMD_TASEDITOR_SWITCH_MULTITRACKING, 0, + WINDOWITEMS_RECORD_3P, IDC_RADIO_3P, -1, 0, 0, 0, "Select Joypad 3 as current", false, EMUCMD_TASEDITOR_SWITCH_MULTITRACKING, 0, + WINDOWITEMS_RECORD_4P, IDC_RADIO_4P, -1, 0, 0, 0, "Select Joypad 4 as current", false, EMUCMD_TASEDITOR_SWITCH_MULTITRACKING, 0, + WINDOWITEMS_SUPERIMPOSE, IDC_SUPERIMPOSE, -1, 0, 0, 0, "Allows to superimpose old Input with new buttons, instead of overwriting", false, 0, 0, + WINDOWITEMS_USE_PATTERN, IDC_USEPATTERN, -1, 0, 0, 0, "Applies current Autofire Pattern to Input recording", false, 0, 0, + WINDOWITEMS_SPLICER_BOX, IDC_SPLICER_BOX, -1, 0, 0, 0, "", false, 0, 0, + WINDOWITEMS_SELECTION_TEXT, IDC_TEXT_SELECTION, -1, 0, 0, 0, "Current size of Selection", false, 0, 0, + WINDOWITEMS_CLIPBOARD_TEXT, IDC_TEXT_CLIPBOARD, -1, 0, 0, 0, "Current size of Input in the Clipboard", false, 0, 0, + WINDOWITEMS_LUA_BOX, IDC_LUA_BOX, -1, 0, 0, 0, "", false, 0, 0, + WINDOWITEMS_RUN_MANUAL, TASEDITOR_RUN_MANUAL, -1, 0, 0, 0, "Press the button to execute Lua Manual Function", false, EMUCMD_TASEDITOR_RUN_MANUAL_LUA, 0, + WINDOWITEMS_RUN_AUTO, IDC_RUN_AUTO, -1, 0, 0, 0, "Enable Lua Auto Function (but first it must be registered by Lua script)", false, 0, 0, + WINDOWITEMS_BRANCHES_BUTTON, IDC_BRANCHES_BUTTON, -1, 0, 0, 0, "Click here to switch between Bookmarks List and Branches Tree", false, 0, 0, + WINDOWITEMS_BOOKMARKS_BOX, IDC_BOOKMARKS_BOX, -1, 0, 0, 0, "", false, 0, 0, + WINDOWITEMS_BOOKMARKS_LIST, IDC_BOOKMARKSLIST, -1, 0, 0, 0, "Right click = set Bookmark, Left click = jump to Bookmark or load Branch", false, 0, 0, + WINDOWITEMS_BRANCHES_BITMAP, IDC_BRANCHES_BITMAP, -1, 0, 0, 0, "Right click = set Bookmark, single Left click = jump to Bookmark, double Left click = load Branch", false, 0, 0, + WINDOWITEMS_HISTORY_BOX, IDC_HISTORY_BOX, -1, 0, 0, -1, "", false, 0, 0, + WINDOWITEMS_HISTORY_LIST, IDC_HISTORYLIST, -1, 0, 0, -1, "Click to revert the project back to that time", false, 0, 0, + WINDOWITEMS_PREVIOUS_MARKER, TASEDITOR_PREV_MARKER, -1, -1, 0, -1, "Send Selection to previous Marker (mouse: Ctrl+Wheel up) (hotkey: Ctrl+PageUp)", false, 0, 0, + WINDOWITEMS_SIMILAR, TASEDITOR_FIND_BEST_SIMILAR_MARKER, -1, -1, 0, -1, "Auto-search for Marker Note", false, 0, 0, + WINDOWITEMS_MORE, TASEDITOR_FIND_NEXT_SIMILAR_MARKER, -1, -1, 0, -1, "Continue Auto-search", false, 0, 0, + WINDOWITEMS_NEXT_MARKER, TASEDITOR_NEXT_MARKER, -1, -1, 0, -1, "Send Selection to next Marker (mouse: Ctrl+Wheel up) (hotkey: Ctrl+PageDown)", false, 0, 0, }; TASEDITOR_WINDOW::TASEDITOR_WINDOW() @@ -186,6 +186,64 @@ TASEDITOR_WINDOW::TASEDITOR_WINDOW() minHeight = 0; } +void TASEDITOR_WINDOW::updateTooltips() +{ + for (int i = 0; i < TASEDITOR_WINDOW_TOTAL_ITEMS; ++i) + { + TOOLINFO toolInfo = { 0 }; + toolInfo.cbSize = sizeof(TOOLINFO); + toolInfo.hwnd = hwndTASEditor; + toolInfo.uId = (UINT_PTR)GetDlgItem(hwndTASEditor, windowItems[i].id); + if (windowItems[i].isStaticRect) + { + // for static text we specify rectangle + RECT toolRect; + GetWindowRect(GetDlgItem(hwndTASEditor, windowItems[i].id), &toolRect); + POINT pt; + pt.x = toolRect.left; + pt.y = toolRect.top; + ScreenToClient(hwndTASEditor, &pt); + toolInfo.rect.left = pt.x; + toolInfo.rect.top = pt.y; + toolInfo.rect.right = toolInfo.rect.left + toolRect.right - toolRect.left; + toolInfo.rect.bottom = toolInfo.rect.top + toolRect.bottom - toolRect.top; + toolInfo.uFlags = TTF_SUBCLASS; + } + else + // for other controls we provide hwnd + toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS; + char tooltipText[TOOLTIP_TEXT_MAX_LEN]; + if (windowItems[i].hotkeyEmuCmd && FCEUD_CommandMapping[windowItems[i].hotkeyEmuCmd]) + { + // add hotkey mapping if needed + strcpy(tooltipText, windowItems[i].tooltipText); + strcat(tooltipText, " (hotkey: "); + strcat(tooltipText, GetKeyComboName(FCEUD_CommandMapping[windowItems[i].hotkeyEmuCmd])); + strcat(tooltipText, ")"); + toolInfo.lpszText = tooltipText; + } else + // No hotkey, use the tooltip text itself + toolInfo.lpszText = windowItems[i].tooltipText; + + if(!windowItems[i].tooltipHWND) + { + // if the tooltip handle is not created yet, create one + if (windowItems[i].tooltipHWND = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL, + WS_POPUP | TTS_ALWAYSTIP | TTS_BALLOON | TTS_NOANIMATE | TTS_NOFADE, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + hwndTASEditor, NULL, + fceu_hInstance, NULL)) + { + SendMessage(windowItems[i].tooltipHWND, TTM_ADDTOOL, 0, (LPARAM)&toolInfo); + SendMessage(windowItems[i].tooltipHWND, TTM_SETDELAYTIME, TTDT_AUTOPOP, TOOLTIPS_AUTOPOP_TIMEOUT); + } + } else + // The tooltip handle is already created, just update the tooltip info + SendMessage(windowItems[i].tooltipHWND, TTM_SETTOOLINFO, 0, (LPARAM)&toolInfo); + } +} + void TASEDITOR_WINDOW::init() { isReadyForResizing = false; @@ -203,61 +261,8 @@ void TASEDITOR_WINDOW::init() updateCheckedItems(); hPatternsMenu = GetSubMenu(hMainMenu, PATTERNS_MENU_POS); // tooltips - for (int i = 0; i < TASEDITOR_WINDOW_TOTAL_ITEMS; ++i) - { - if (windowItems[i].tooltipTextBase[0]) - { - windowItems[i].tooltipHWND = CreateWindowEx(NULL, TOOLTIPS_CLASS, NULL, - WS_POPUP | TTS_ALWAYSTIP | TTS_BALLOON | TTS_NOANIMATE | TTS_NOFADE, - CW_USEDEFAULT, CW_USEDEFAULT, - CW_USEDEFAULT, CW_USEDEFAULT, - hwndTASEditor, NULL, - fceu_hInstance, NULL); - if (windowItems[i].tooltipHWND) - { - // Associate the tooltip with the tool - TOOLINFO toolInfo = {0}; - toolInfo.cbSize = sizeof(toolInfo); - toolInfo.hwnd = hwndTASEditor; - toolInfo.uId = (UINT_PTR)GetDlgItem(hwndTASEditor, windowItems[i].id); - if (windowItems[i].isStaticRect) - { - // for static text we specify rectangle - toolInfo.uFlags = TTF_SUBCLASS; - RECT toolRect; - GetWindowRect(GetDlgItem(hwndTASEditor, windowItems[i].id), &toolRect); - POINT pt; - pt.x = toolRect.left; - pt.y = toolRect.top; - ScreenToClient(hwndTASEditor, &pt); - toolInfo.rect.left = pt.x; - toolInfo.rect.right = toolInfo.rect.left + (toolRect.right - toolRect.left); - toolInfo.rect.top = pt.y; - toolInfo.rect.bottom = toolInfo.rect.top + (toolRect.bottom - toolRect.top); - } else - { - // for other controls we provide hwnd - toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS; - } - // add hotkey mapping if needed - if (windowItems[i].hotkeyEmuCmd && FCEUD_CommandMapping[windowItems[i].hotkeyEmuCmd]) - { - windowItems[i].tooltipText[0] = 0; - strcpy(windowItems[i].tooltipText, windowItems[i].tooltipTextBase); - strcat(windowItems[i].tooltipText, " (hotkey: "); - strncat(windowItems[i].tooltipText, GetKeyComboName(FCEUD_CommandMapping[windowItems[i].hotkeyEmuCmd]), TOOLTIP_TEXT_MAX_LEN - strlen(windowItems[i].tooltipText) - 1); - strncat(windowItems[i].tooltipText, ")", TOOLTIP_TEXT_MAX_LEN - strlen(windowItems[i].tooltipText) - 1); - toolInfo.lpszText = windowItems[i].tooltipText; - } else - { - toolInfo.lpszText = windowItems[i].tooltipTextBase; - } - SendMessage(windowItems[i].tooltipHWND, TTM_ADDTOOL, 0, (LPARAM)&toolInfo); - SendMessage(windowItems[i].tooltipHWND, TTM_SETDELAYTIME, TTDT_AUTOPOP, TOOLTIPS_AUTOPOP_TIMEOUT); - } - } - } updateTooltips(); + toggleTooltips(); // subclass "Marker X" text fields IDC_PLAYBACK_MARKER_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTASEditor, IDC_PLAYBACK_MARKER), GWL_WNDPROC, (LONG)IDC_PLAYBACK_MARKER_WndProc); IDC_SELECTION_MARKER_oldWndProc = (WNDPROC)SetWindowLong(GetDlgItem(hwndTASEditor, IDC_SELECTION_MARKER), GWL_WNDPROC, (LONG)IDC_SELECTION_MARKER_WndProc); @@ -535,7 +540,7 @@ void TASEDITOR_WINDOW::changeBookmarksListHeight(int newHeight) ShowWindow(hwndTASEditor, SW_SHOWMAXIMIZED); } -void TASEDITOR_WINDOW::updateTooltips() +void TASEDITOR_WINDOW::toggleTooltips() { if (taseditorConfig.tooltipsEnabled) { @@ -1258,7 +1263,7 @@ BOOL CALLBACK TASEditorWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara case ID_HELP_TOOLTIPS: taseditorConfig.tooltipsEnabled ^= 1; taseditorWindow.updateCheckedItems(); - taseditorWindow.updateTooltips(); + taseditorWindow.toggleTooltips(); break; case ID_HELP_ABOUT: DialogBox(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDITOR_ABOUT), taseditorWindow.hwndTASEditor, aboutWndProc); diff --git a/src/drivers/win/taseditor/taseditor_window.h b/src/drivers/win/taseditor/taseditor_window.h index 687d55fa..6274547a 100644 --- a/src/drivers/win/taseditor/taseditor_window.h +++ b/src/drivers/win/taseditor/taseditor_window.h @@ -62,8 +62,8 @@ struct WindowItemData int y; int width; int height; - char tooltipTextBase[TOOLTIP_TEXT_MAX_LEN]; - char tooltipText[TOOLTIP_TEXT_MAX_LEN]; +// char* tooltipTextBase; + char* tooltipText; bool isStaticRect; int hotkeyEmuCmd; HWND tooltipHWND; @@ -83,6 +83,7 @@ public: void handleWindowMovingOrResizing(); void changeBookmarksListHeight(int newHeight); + void toggleTooltips(); void updateTooltips(); void updateCaption(); void updateCheckedItems(); diff --git a/src/drivers/win/texthook.h b/src/drivers/win/texthook.h index 334b2c79..e897569a 100644 --- a/src/drivers/win/texthook.h +++ b/src/drivers/win/texthook.h @@ -14,3 +14,5 @@ void UpdateTextHooker(); void KillTextHooker(); void DoTextHooker(); void TextHookerCheck(); + +extern HWND hTextHooker; \ No newline at end of file diff --git a/src/drivers/win/timing.cpp b/src/drivers/win/timing.cpp index 9f29adec..89bc6e35 100644 --- a/src/drivers/win/timing.cpp +++ b/src/drivers/win/timing.cpp @@ -44,20 +44,23 @@ void CloseTimingDialog(HWND hwndDlg) if (postrenderscanlines < 0) { postrenderscanlines = 0; - MessageBox(hwndDlg, "Overclocking is when you speed up your CPU, not slow it down!", "Error", MB_OK); + MessageBox(hwndDlg, "Overclocking is when you speed up your CPU, not slow it down!", "Error", MB_OK | MB_ICONERROR); sprintf(str,"%d",postrenderscanlines); SetDlgItemText(hwndDlg,IDC_EXTRA_SCANLINES,str); + SetFocus(GetDlgItem(hwndDlg, IDC_EXTRA_SCANLINES)); } else if (vblankscanlines < 0) { vblankscanlines = 0; - MessageBox(hwndDlg, "Overclocking is when you speed up your CPU, not slow it down!", "Error", MB_OK); + MessageBox(hwndDlg, "Overclocking is when you speed up your CPU, not slow it down!", "Error", MB_OK | MB_ICONERROR); sprintf(str,"%d",vblankscanlines); SetDlgItemText(hwndDlg,IDC_VBLANK_SCANLINES,str); + SetFocus(GetDlgItem(hwndDlg, IDC_VBLANK_SCANLINES)); } else if (overclock_enabled && newppu) { - MessageBox(hwndDlg, "Overclocking doesn't work with new PPU!", "Error", MB_OK); + MessageBox(hwndDlg, "Overclocking doesn't work with new PPU!", "Error", MB_OK | MB_ICONERROR); + SetFocus(GetDlgItem(hwndDlg, CB_OVERCLOCKING)); } else EndDialog(hwndDlg, 0); @@ -85,9 +88,20 @@ BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar CheckDlgButton(hwndDlg, CB_DISABLE_SPEED_THROTTLING, BST_CHECKED); } - if(overclock_enabled) - CheckDlgButton(hwndDlg, CB_OVERCLOCKING, BST_CHECKED); + if(newppu) + { + EnableWindow(GetDlgItem(hwndDlg, CB_OVERCLOCKING), false); + } + if(overclock_enabled) + { + CheckDlgButton(hwndDlg, CB_OVERCLOCKING, BST_CHECKED); + EnableWindow(GetDlgItem(hwndDlg, IDC_EXTRA_SCANLINES), true); + EnableWindow(GetDlgItem(hwndDlg, CB_SKIP_7BIT), true); + EnableWindow(GetDlgItem(hwndDlg, IDC_VBLANK_SCANLINES), true); + EnableWindow(GetDlgItem(hwndDlg, IDC_VBLANK_SCANLINES_TEXT), true); + EnableWindow(GetDlgItem(hwndDlg, IDC_EXTRA_SCANLINES_TEXT), true); + } if(skip_7bit_overclocking) CheckDlgButton(hwndDlg, CB_SKIP_7BIT, BST_CHECKED); @@ -117,6 +131,16 @@ BOOL CALLBACK TimingConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar { case 1: CloseTimingDialog(hwndDlg); + break; + case CB_OVERCLOCKING: + bool chk = IsDlgButtonChecked(hwndDlg, CB_OVERCLOCKING) == BST_CHECKED; + + EnableWindow(GetDlgItem(hwndDlg, IDC_EXTRA_SCANLINES), chk); + EnableWindow(GetDlgItem(hwndDlg, CB_SKIP_7BIT), chk); + EnableWindow(GetDlgItem(hwndDlg, IDC_VBLANK_SCANLINES), chk); + EnableWindow(GetDlgItem(hwndDlg, IDC_VBLANK_SCANLINES_TEXT), chk); + EnableWindow(GetDlgItem(hwndDlg, IDC_EXTRA_SCANLINES_TEXT), chk); + break; } } diff --git a/src/drivers/win/video.cpp b/src/drivers/win/video.cpp index e72dad77..e48bcd72 100644 --- a/src/drivers/win/video.cpp +++ b/src/drivers/win/video.cpp @@ -1283,6 +1283,11 @@ BOOL CALLBACK VideoConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara strcat(buf, " (double-click anywhere)"); } SetDlgItemText(hwndDlg, IDC_VIDEOCONFIG_FS, buf); + + EnableWindow(GetDlgItem(hwndDlg, IDC_TVASPECT_X), eoptions&EO_TVASPECT); + EnableWindow(GetDlgItem(hwndDlg, IDC_TVASPECT_Y), eoptions&EO_TVASPECT); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC_SLASHTEXT), eoptions&EO_TVASPECT); + break; } case WM_CLOSE: @@ -1398,6 +1403,11 @@ gornk: fssync=SendDlgItemMessage(hwndDlg,IDC_VIDEOCONFIG_SYNC_METHOD_FS,CB_GETCURSEL,0,(LPARAM)(LPSTR)0); EndDialog(hwndDlg,0); break; + case IDC_VIDEOCONFIG_TVASPECT: + bool enable = SendDlgItemMessage(hwndDlg, IDC_VIDEOCONFIG_TVASPECT, BM_GETCHECK, 0, 0) == BST_CHECKED; + EnableWindow(GetDlgItem(hwndDlg, IDC_TVASPECT_X), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_TVASPECT_Y), enable); + EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC_SLASHTEXT), enable); } } return 0; diff --git a/src/drivers/win/window.cpp b/src/drivers/win/window.cpp index 971dc7c5..37291a21 100644 --- a/src/drivers/win/window.cpp +++ b/src/drivers/win/window.cpp @@ -94,7 +94,6 @@ using namespace std; #define FCEUX_CONTEXT_TOGGLESUBTITLES 60003 #define FCEUX_CONTEXT_DUMPSUBTITLES 60004 - //******************************************************************************** //Globals //******************************************************************************** @@ -109,6 +108,9 @@ HMENU hfceuxcontext; //Handle to context menu HMENU hfceuxcontextsub; //Handle to context sub menu HWND MainhWnd; //Main FCEUX(Parent) window Handle. Dialogs should use GetMainHWND() to get this +// HWND list for menu update, refers to FCEU_MENU_HWND +HMENU hmenuList[FCEUMENU_LIMIT]; + //Extern variables------------------------------------- extern bool movieSubtitles; extern FCEUGI *GameInfo; @@ -418,9 +420,9 @@ void UpdateCheckedMenuItems() CheckMenuItem(fceumenu, polo2[x], *polo[x] ? MF_CHECKED : MF_UNCHECKED); } //File Menu - CheckMenuItem(fceumenu, ID_FILE_RECORDMODE_TRUNCATE, movieRecordMode == MOVIE_RECORD_MODE_TRUNCATE ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(fceumenu, ID_FILE_RECORDMODE_OVERWRITE, movieRecordMode == MOVIE_RECORD_MODE_OVERWRITE ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(fceumenu, ID_FILE_RECORDMODE_INSERT, movieRecordMode == MOVIE_RECORD_MODE_INSERT ? MF_CHECKED : MF_UNCHECKED); + if (movieRecordMode == MOVIE_RECORD_MODE_TRUNCATE) CheckMenuRadioItem(fceumenu, ID_FILE_RECORDMODE_TRUNCATE, ID_FILE_RECORDMODE_INSERT, ID_FILE_RECORDMODE_TRUNCATE, MF_BYCOMMAND); + if (movieRecordMode == MOVIE_RECORD_MODE_OVERWRITE) CheckMenuRadioItem(fceumenu, ID_FILE_RECORDMODE_TRUNCATE, ID_FILE_RECORDMODE_INSERT, ID_FILE_RECORDMODE_OVERWRITE, MF_BYCOMMAND); + if (movieRecordMode == MOVIE_RECORD_MODE_INSERT) CheckMenuRadioItem(fceumenu, ID_FILE_RECORDMODE_TRUNCATE, ID_FILE_RECORDMODE_INSERT, ID_FILE_RECORDMODE_INSERT, MF_BYCOMMAND); CheckMenuItem(fceumenu, ID_FILE_MOVIE_TOGGLEREAD, movie_readonly ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(fceumenu, ID_FILE_OPENLUAWINDOW, LuaConsoleHWnd ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(fceumenu, ID_AVI_ENABLEHUDRECORDING, FCEUI_AviEnableHUDrecording() ? MF_CHECKED : MF_UNCHECKED); @@ -514,9 +516,9 @@ void UpdateContextMenuItems(HMENU context, int whichContext) EnableMenuItem(context, FCEUX_CONTEXT_DELETE_1_FRAME, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(context, FCEUX_CONTEXT_TRUNCATE_MOVIE, MF_BYCOMMAND | MF_GRAYED); } - CheckMenuItem(context, FCEUX_CONTEXT_RECORDMODE_TRUNCATE, movieRecordMode == MOVIE_RECORD_MODE_TRUNCATE ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(context, FCEUX_CONTEXT_RECORDMODE_OVERWRITE, movieRecordMode == MOVIE_RECORD_MODE_OVERWRITE ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(context, FCEUX_CONTEXT_RECORDMODE_INSERT, movieRecordMode == MOVIE_RECORD_MODE_INSERT ? MF_CHECKED : MF_UNCHECKED); + if (movieRecordMode == MOVIE_RECORD_MODE_TRUNCATE) CheckMenuRadioItem(context, FCEUX_CONTEXT_RECORDMODE_TRUNCATE, FCEUX_CONTEXT_RECORDMODE_INSERT, FCEUX_CONTEXT_RECORDMODE_TRUNCATE, MF_BYCOMMAND); + if (movieRecordMode == MOVIE_RECORD_MODE_OVERWRITE) CheckMenuRadioItem(context, FCEUX_CONTEXT_RECORDMODE_TRUNCATE, FCEUX_CONTEXT_RECORDMODE_INSERT, FCEUX_CONTEXT_RECORDMODE_OVERWRITE, MF_BYCOMMAND); + if (movieRecordMode == MOVIE_RECORD_MODE_INSERT) CheckMenuRadioItem(context, FCEUX_CONTEXT_RECORDMODE_TRUNCATE, FCEUX_CONTEXT_RECORDMODE_INSERT, FCEUX_CONTEXT_RECORDMODE_INSERT, MF_BYCOMMAND); //Undo Loadstate if (CheckBackupSaveStateExist() && (undoLS || redoLS)) @@ -568,12 +570,12 @@ void UpdateContextMenuItems(HMENU context, int whichContext) if (tog) { InsertMenu(context, 0xFFFF, MF_SEPARATOR, 0, ""); - InsertMenu(context,0xFFFF, MF_BYCOMMAND, FCEUX_CONTEXT_UNHIDEMENU, "Unhide Menu"); + InsertMenu(context,0xFFFF, MF_BYCOMMAND, FCEUX_CONTEXT_UNHIDEMENU, HOTKEYMENUINDEX::getQualifiedMenuText("Unhide Menu", EMUCMD_HIDE_MENU_TOGGLE).c_str()); } if (whichContext > 1 && currMovieData.subtitles.size() != 0){ // At position 3 is "View comments and subtitles". Insert this there: - InsertMenu(context,0x3, MF_BYPOSITION, FCEUX_CONTEXT_TOGGLESUBTITLES, movieSubtitles ? "Subtitle Display: On" : "Subtitle Display: Off"); + InsertMenu(context,0x3, MF_BYPOSITION, FCEUX_CONTEXT_TOGGLESUBTITLES, HOTKEYMENUINDEX::getQualifiedMenuText(movieSubtitles ? "Subtitle Display: On" : "Subtitle Display: Off", EMUCMD_MISC_DISPLAY_MOVIESUBTITLES).c_str()); // At position 4(+1) is after View comments and subtitles. Insert this there: InsertMenu(context,0x5, MF_BYPOSITION, FCEUX_CONTEXT_DUMPSUBTITLES, "Dump Subtitles to SRT file"); } @@ -1067,7 +1069,9 @@ bool ALoad(const char *nameo, char* innerFilename, bool silent) { int oldPaused = EmulationPaused; - if (GameInfo) FCEUI_CloseGame(); + // loading is not started yet, so the game can continue; + // FCEUI_LoadGameVirtual() already had an FCEUI_CloseGame() call after loading success; + // if (GameInfo) FCEUI_CloseGame(); if (FCEUI_LoadGameVirtual(nameo, !(pal_setting_specified || dendy_setting_specified), silent)) { @@ -1418,7 +1422,9 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) whichContext = 0; // NoGame hfceuxcontext = LoadMenu(fceu_hInstance,"FCEUCONTEXTMENUS"); + hmenuList[FCEUMENU_HWND::FCEUMENU_CONTEXT] = hfceuxcontext; hfceuxcontextsub = GetSubMenu(hfceuxcontext, whichContext); + hmenuList[whichContext] = hfceuxcontextsub; UpdateContextMenuItems(hfceuxcontextsub, whichContext); pt.x = LOWORD(lParam); //Get mouse x in terms of client area pt.y = HIWORD(lParam); //Get mouse y in terms of client area @@ -1542,12 +1548,25 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { UINT len; - len=DragQueryFileW((HDROP)wParam,0,0,0)+1; - wchar_t* wftmp = new wchar_t[len]; + /* + Using DragQueryFileW() and wcstombs() is not a proper way to convert Unicode string + to a multibyte one, the system has its own codepage but wcstombs seems ignores it and only + convert it to UTF-8. Similarly, functions such named FCEUD_UTF8fopen() acturally perform ANSI + behaviour which follows the codepage of the system rather than UTF-8. I knew Windows with some + languages has a very narrow codepage like 1252 and may have a problem to load a filename + which contains extra characters without its convert, but the wcstombs() may corrupt the string + to garbage text to the title and menu in some multibyte language Windows systems, it's due to + the limitation of ANSI application and system itself, not the fault of the emulator, so there's + no responsibility for the emulator to use a different API to solve it, just leave it as the + default definition. + */ + len = DragQueryFile((HDROP)wParam, 0, 0, 0) + 1; + char* ftmp = new char[len]; { - DragQueryFileW((HDROP)wParam,0,wftmp,len); - std::string fileDropped = wcstombs(wftmp); - delete[] wftmp; + DragQueryFile((HDROP)wParam,0,ftmp,len); + // std::string fileDropped = wcstombs(wftmp); + std::string fileDropped = ftmp; + delete[] ftmp; //adelikat: Drag and Drop only checks file extension, the internal functions are responsible for file error checking //------------------------------------------------------- @@ -2090,6 +2109,9 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) break; case ID_NEWPPU: + if(overclock_enabled && + MessageBox(hWnd, "The new PPU doesn't support overclocking, it will be disabled. Do you want to continue?", "Overclocking", MB_ICONQUESTION | MB_YESNO) == IDNO) + break; case ID_OLDPPU: FCEU_TogglePPU(); break; @@ -2667,6 +2689,7 @@ int CreateMainWindow() AdjustWindowRectEx(&tmp, WS_OVERLAPPEDWINDOW, 1, 0); fceumenu = LoadMenu(fceu_hInstance,"FCEUMENU"); + hmenuList[FCEUMENU_MAIN] = fceumenu; recentmenu = CreateMenu(); recentluamenu = CreateMenu(); @@ -2873,300 +2896,274 @@ void ChangeMenuItemText(int menuitem, string text) SetMenuItemInfo(fceumenu, menuitem, FALSE, &moo); } +string HOTKEYMENUINDEX::getQualifiedMenuText() { + int length = GetMenuString(hmenuList[hmenu_index], menu_id, 0, 0, flags) + 1; + char* buffer = new char[length]; + GetMenuString(hmenuList[hmenu_index], menu_id, buffer, length, flags); + if (char* pTab = strrchr(buffer, '\t')) + *pTab = '\0'; + std::string menustr = HOTKEYMENUINDEX::getQualifiedMenuText(buffer, cmd_id); + delete[] buffer; + return menustr; +} + +string HOTKEYMENUINDEX::getQualifiedMenuText(char* text, int emu_cmd_id) { + char* combo = GetKeyComboName(FCEUD_CommandMapping[emu_cmd_id]); + char* str = new char[strlen(text) + strlen(combo) + strlen("\t") + 1]; + strcpy(str, text); + if (strcmp("", combo)) + { + strcat(str, "\t"); + strcat(str, combo); + } + string menustr = str; + delete[] str; + return menustr; +} + +struct HOTKEYMENUINDEX HOTKEYMENUINDEXs[] = { + // "&Open..." + { MENU_OPEN_FILE,EMUCMD_OPENROM }, + // "Open ROM" + { FCEU_CONTEXT_OPENROM,EMUCMD_OPENROM,FCEUMENU_CONTEXT_OFF }, + // "&Close" + { MENU_CLOSE_FILE,EMUCMD_CLOSEROM }, + // "Close ROM" + { FCEU_CONTEXT_CLOSEROM,EMUCMD_CLOSEROM,FCEUMENU_CONTEXT_GAME }, + // "&Load State" + { MENU_LOADSTATE,EMUCMD_LOAD_STATE,FCEUMENU_CONTEXT_GAME }, + // "&Save State" + { MENU_SAVESTATE,EMUCMD_SAVE_STATE }, + // "Load State &From..." + { MENU_LOAD_STATE,EMUCMD_LOAD_STATE_FROM }, + // "Save State &As..." + { MENU_SAVE_STATE,EMUCMD_SAVE_STATE_AS }, + // "&Next save slot" + { MENU_NEXTSAVESTATE,EMUCMD_SAVE_SLOT_NEXT }, + // "&Previous save slot" + { MENU_PREVIOUSSAVESTATE,EMUCMD_SAVE_SLOT_PREV }, + // "&View save slots" + { MENU_VIEWSAVESLOTS,EMUCMD_MISC_SHOWSTATES }, + // "Record Movie..." + { FCEUX_CONTEXT_RECORDMOVIE,EMUCMD_MOVIE_RECORD_TO,FCEUMENU_CONTEXT_GAME }, + // "&Record Movie..." + { MENU_RECORD_MOVIE,EMUCMD_MOVIE_RECORD_TO }, + // "Play Movie..." + { FCEUX_CONTEXT_REPLAYMOVIE,EMUCMD_MOVIE_REPLAY_FROM,FCEUMENU_CONTEXT_GAME }, + // "&Play Movie..." + { MENU_REPLAY_MOVIE,EMUCMD_MOVIE_REPLAY_FROM }, + // "&Stop Movie" + { MENU_STOP_MOVIE,EMUCMD_MOVIE_STOP }, + // "Stop Movie Replay" + { FCEU_CONTEXT_STOPMOVIE,EMUCMD_MOVIE_STOP,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "Stop Movie Replay" + { FCEU_CONTEXT_STOPMOVIE,EMUCMD_MOVIE_STOP,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "Stop Movie Recording" + { FCEU_CONTEXT_STOPMOVIE,EMUCMD_MOVIE_STOP,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "Stop Movie Recording" + { FCEU_CONTEXT_STOPMOVIE,EMUCMD_MOVIE_STOP,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "Play Movie from Beginning" + { FCEU_CONTEXT_PLAYMOVIEFROMBEGINNING,EMUCMD_MOVIE_PLAY_FROM_BEGINNING,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "Play Movie from Beginning" + { FCEU_CONTEXT_PLAYMOVIEFROMBEGINNING,EMUCMD_MOVIE_PLAY_FROM_BEGINNING,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "Play Movie from Beginning" + { FCEU_CONTEXT_PLAYMOVIEFROMBEGINNING,EMUCMD_MOVIE_PLAY_FROM_BEGINNING,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "Play Movie from Beginning" + { FCEU_CONTEXT_PLAYMOVIEFROMBEGINNING,EMUCMD_MOVIE_PLAY_FROM_BEGINNING,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "Play from &Beginning" + { ID_FILE_PLAYMOVIEFROMBEGINNING,EMUCMD_MOVIE_PLAY_FROM_BEGINNING }, + // "&Read-only" + { ID_FILE_MOVIE_TOGGLEREAD,EMUCMD_MOVIE_READONLY_TOGGLE }, + // "Toggle to read+write" + { FCEUX_CONTEXT_READONLYTOGGLE,EMUCMD_MOVIE_READONLY_TOGGLE,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "Toggle to Read-only" + { FCEUX_CONTEXT_READONLYTOGGLE,EMUCMD_MOVIE_READONLY_TOGGLE,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "Toggle to read+write" + { FCEUX_CONTEXT_READONLYTOGGLE,EMUCMD_MOVIE_READONLY_TOGGLE,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "Toggle to Read-only" + { FCEUX_CONTEXT_READONLYTOGGLE,EMUCMD_MOVIE_READONLY_TOGGLE,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "&Screenshot" + { ID_FILE_SCREENSHOT,EMUCMD_SCREENSHOT }, + // "Screenshot" + { FCEUX_CONTEXT_SCREENSHOT,EMUCMD_SCREENSHOT, FCEUMENU_CONTEXT_GAME }, + // "&Record AVI..." + { MENU_RECORD_AVI,EMUCMD_AVI_RECORD_AS }, + //"&Stop AVI" + { MENU_STOP_AVI,EMUCMD_AVI_STOP }, + // "&Reset" + { MENU_RESET,EMUCMD_RESET }, + // "&Power" + { MENU_POWER,EMUCMD_POWER }, + // "&Eject/Insert Disk" + { MENU_EJECT_DISK,EMUCMD_FDS_EJECT_INSERT }, + // "&Switch Disk Side" + { MENU_SWITCH_DISK,EMUCMD_FDS_SIDE_SELECT }, + // "&Insert Coin" + { MENU_INSERT_COIN,EMUCMD_VSUNI_COIN }, + // "Speed &Up" + { ID_NES_SPEEDUP,EMUCMD_SPEED_FASTER }, + // "Slow &Down" + { ID_NES_SLOWDOWN,EMUCMD_SPEED_SLOWER }, + // "&Slowest Speed" + { ID_NES_SLOWESTSPEED,EMUCMD_SPEED_SLOWEST }, + // "&Normal Speed" + { ID_NES_NORMALSPEED,EMUCMD_SPEED_NORMAL }, + // "&Turbo" + { ID_NES_TURBO,EMUCMD_SPEED_TURBO_TOGGLE }, + // "&Pause" + { ID_NES_PAUSE,EMUCMD_PAUSE }, + // "&Hide Menu" + { MENU_HIDE_MENU,EMUCMD_HIDE_MENU_TOGGLE }, + // "Unhide Menu" + { FCEUX_CONTEXT_UNHIDEMENU,EMUCMD_HIDE_MENU_TOGGLE,FCEUMENU_CONTEXT_GAME }, + // "Unhide Menu" + { FCEUX_CONTEXT_UNHIDEMENU,EMUCMD_HIDE_MENU_TOGGLE,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "Unhide Menu" + { FCEUX_CONTEXT_UNHIDEMENU,EMUCMD_HIDE_MENU_TOGGLE,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "Unhide Menu" + { FCEUX_CONTEXT_UNHIDEMENU,EMUCMD_HIDE_MENU_TOGGLE,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "Unhide Menu" + { FCEUX_CONTEXT_UNHIDEMENU,EMUCMD_HIDE_MENU_TOGGLE,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "&Frame Adv. - Skip Lag" + { MENU_DISPLAY_FA_LAGSKIP,EMUCMD_FRAMEADV_SKIPLAG }, + // "&Lag Counter" + { MENU_DISPLAY_LAGCOUNTER,EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE }, + // "&Frame Counter" + { ID_DISPLAY_FRAMECOUNTER,EMUCMD_MOVIE_FRAME_DISPLAY_TOGGLE }, + // "&Rerecord Counter + { ID_DISPLAY_RERECORDCOUNTER,EMUCMD_RERECORD_DISPLAY_TOGGLE }, + // "&Movie status icon" + { ID_DISPLAY_MOVIESTATUSICON,EMUCMD_MOVIE_ICON_DISPLAY_TOGGLE }, + // "FPS" + { ID_DISPLAY_FPS,EMUCMD_FPS_DISPLAY_TOGGLE }, + // "Graphics: &BG" + { MENU_DISPLAY_BG,EMUCMD_MISC_DISPLAY_BG_TOGGLE }, + // "Graphics: &OBJ" + { MENU_DISPLAY_OBJ,EMUCMD_MISC_DISPLAY_OBJ_TOGGLE }, + // "&Cheats..." + { MENU_CHEATS,EMUCMD_TOOL_OPENCHEATS }, + // "RAM Search..." + { ID_RAM_SEARCH,EMUCMD_TOOL_OPENRAMSEARCH }, + // "RAM Watch..." + { ID_RAM_WATCH,EMUCMD_TOOL_OPENRAMWATCH }, + // "&Memory Watch..." + { MENU_MEMORY_WATCH,EMUCMD_TOOL_OPENMEMORYWATCH }, + // "&TAS Editor..." + { MENU_TASEDITOR,EMUCMD_MISC_OPENTASEDITOR }, + // "&Debugger..." + { MENU_DEBUGGER,EMUCMD_TOOL_OPENDEBUGGER }, + // "&PPU Viewer..." + { MENU_PPUVIEWER,EMUCMD_TOOL_OPENPPU }, + // "&Name Table Viewer..." + { MENU_NAMETABLEVIEWER,EMUCMD_TOOL_OPENNTVIEW }, + // "&Hex Editor..." + { MENU_HEXEDITOR,EMUCMD_TOOL_OPENHEX }, + // "&Trace Logger..." + { MENU_TRACELOGGER,EMUCMD_TOOL_OPENTRACELOGGER }, + // "&Code/Data Logger..." + { MENU_CDLOGGER,EMUCMD_TOOL_OPENCDLOGGER }, + // "Undo savestate" + { FCEUX_CONTEXT_UNDOSAVESTATE,EMUCMD_MISC_UNDOREDOSAVESTATE,FCEUMENU_CONTEXT_GAME }, + // "Undo savestate" + { FCEUX_CONTEXT_UNDOSAVESTATE,EMUCMD_MISC_UNDOREDOSAVESTATE,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "Undo savestate" + { FCEUX_CONTEXT_UNDOSAVESTATE,EMUCMD_MISC_UNDOREDOSAVESTATE,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "Undo savestate" + { FCEUX_CONTEXT_UNDOSAVESTATE,EMUCMD_MISC_UNDOREDOSAVESTATE,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "Undo savestate" + { FCEUX_CONTEXT_UNDOSAVESTATE,EMUCMD_MISC_UNDOREDOSAVESTATE,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "Rewind to last auto-save" + { FCEUX_CONTEXT_REWINDTOLASTAUTO,EMUCMD_MISC_AUTOSAVE,FCEUMENU_CONTEXT_GAME }, + // "Rewind to last auto-save" + { FCEUX_CONTEXT_REWINDTOLASTAUTO,EMUCMD_MISC_AUTOSAVE,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "Rewind to last auto-save" + { FCEUX_CONTEXT_REWINDTOLASTAUTO,EMUCMD_MISC_AUTOSAVE,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "Rewind to last auto-save" + { FCEUX_CONTEXT_REWINDTOLASTAUTO,EMUCMD_MISC_AUTOSAVE,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "Rewind to last auto-save" + { FCEUX_CONTEXT_REWINDTOLASTAUTO,EMUCMD_MISC_AUTOSAVE,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "Toggle to Recording" + { FCEUX_CONTEXT_TOGGLE_RECORDING,EMUCMD_MOVIE_TOGGLE_RECORDING,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "Toggle to Recording" + { FCEUX_CONTEXT_TOGGLE_RECORDING,EMUCMD_MOVIE_TOGGLE_RECORDING,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "Toggle to Playing" + { FCEUX_CONTEXT_TOGGLE_RECORDING,EMUCMD_MOVIE_TOGGLE_RECORDING,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "Toggle to Playing" + { FCEUX_CONTEXT_TOGGLE_RECORDING,EMUCMD_MOVIE_TOGGLE_RECORDING,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "&Toggle Recording/Playing" + { ID_FILE_TOGGLE_RECORDING_MOVIE,EMUCMD_MOVIE_TOGGLE_RECORDING }, + // "&Truncate at Current Frame" + { ID_FILE_TRUNCATE_MOVIE,EMUCMD_MOVIE_TRUNCATE }, + // "Truncate at Current Frame" + { FCEUX_CONTEXT_TRUNCATE_MOVIE,EMUCMD_MOVIE_TRUNCATE,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "Truncate at Current Frame" + { FCEUX_CONTEXT_TRUNCATE_MOVIE,EMUCMD_MOVIE_TRUNCATE,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "Truncate at Current Frame" + { FCEUX_CONTEXT_TRUNCATE_MOVIE,EMUCMD_MOVIE_TRUNCATE,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "Truncate at Current Frame" + { FCEUX_CONTEXT_TRUNCATE_MOVIE,EMUCMD_MOVIE_TRUNCATE,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "&Insert 1 Frame" + { ID_FILE_INSERT_1_FRAME,EMUCMD_MOVIE_INSERT_1_FRAME }, + // "Insert 1 Frame" + { FCEUX_CONTEXT_INSERT_1_FRAME,EMUCMD_MOVIE_INSERT_1_FRAME,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "Insert 1 Frame" + { FCEUX_CONTEXT_INSERT_1_FRAME,EMUCMD_MOVIE_INSERT_1_FRAME,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "Insert 1 Frame" + { FCEUX_CONTEXT_INSERT_1_FRAME,EMUCMD_MOVIE_INSERT_1_FRAME,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "Insert 1 Frame" + { FCEUX_CONTEXT_INSERT_1_FRAME,EMUCMD_MOVIE_INSERT_1_FRAME,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "&Delete 1 Frame" + { ID_FILE_DELETE_1_FRAME,EMUCMD_MOVIE_DELETE_1_FRAME }, + // "Delete 1 Frame" + { FCEUX_CONTEXT_DELETE_1_FRAME,EMUCMD_MOVIE_DELETE_1_FRAME,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "Delete 1 Frame" + { FCEUX_CONTEXT_DELETE_1_FRAME,EMUCMD_MOVIE_DELETE_1_FRAME,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "Delete 1 Frame" + { FCEUX_CONTEXT_DELETE_1_FRAME,EMUCMD_MOVIE_DELETE_1_FRAME,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "Delete 1 Frame" + { FCEUX_CONTEXT_DELETE_1_FRAME,EMUCMD_MOVIE_DELETE_1_FRAME,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "&Next Record Mode" + { ID_FILE_NEXTRECORDMODE,EMUCMD_MOVIE_NEXT_RECORD_MODE }, + // "&Truncate + { ID_FILE_RECORDMODE_TRUNCATE,EMUCMD_MOVIE_RECORD_MODE_TRUNCATE }, + // "&Truncate" + { FCEUX_CONTEXT_RECORDMODE_TRUNCATE,EMUCMD_MOVIE_RECORD_MODE_TRUNCATE,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "&Truncate" + { FCEUX_CONTEXT_RECORDMODE_TRUNCATE,EMUCMD_MOVIE_RECORD_MODE_TRUNCATE,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "&Truncate" + { FCEUX_CONTEXT_RECORDMODE_TRUNCATE,EMUCMD_MOVIE_RECORD_MODE_TRUNCATE,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "&Truncate" + { FCEUX_CONTEXT_RECORDMODE_TRUNCATE,EMUCMD_MOVIE_RECORD_MODE_TRUNCATE,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "&Overwrite[W]" + { ID_FILE_RECORDMODE_OVERWRITE,EMUCMD_MOVIE_RECORD_MODE_OVERWRITE }, + // "&Overwrite[W]" + { FCEUX_CONTEXT_RECORDMODE_OVERWRITE,EMUCMD_MOVIE_RECORD_MODE_OVERWRITE,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "&Overwrite[W]" + { FCEUX_CONTEXT_RECORDMODE_OVERWRITE,EMUCMD_MOVIE_RECORD_MODE_OVERWRITE,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "&Overwrite[W]" + { FCEUX_CONTEXT_RECORDMODE_OVERWRITE,EMUCMD_MOVIE_RECORD_MODE_OVERWRITE,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "&Overwrite[W]" + { FCEUX_CONTEXT_RECORDMODE_OVERWRITE,EMUCMD_MOVIE_RECORD_MODE_OVERWRITE,FCEUMENU_CONTEXT_RECORDING_READWRITE }, + // "&Insert[I]" + { ID_FILE_RECORDMODE_INSERT,EMUCMD_MOVIE_RECORD_MODE_INSERT }, + // "&Insert[I]" + { FCEUX_CONTEXT_RECORDMODE_INSERT,EMUCMD_MOVIE_RECORD_MODE_INSERT,FCEUMENU_CONTEXT_PLAYING_READONLY }, + // "&Insert[I]" + { FCEUX_CONTEXT_RECORDMODE_INSERT,EMUCMD_MOVIE_RECORD_MODE_INSERT,FCEUMENU_CONTEXT_PLAYING_READWRITE }, + // "&Insert[I]" + { FCEUX_CONTEXT_RECORDMODE_INSERT,EMUCMD_MOVIE_RECORD_MODE_INSERT,FCEUMENU_CONTEXT_RECORDING_READONLY }, + // "&Insert[I]" + { FCEUX_CONTEXT_RECORDMODE_INSERT,EMUCMD_MOVIE_RECORD_MODE_INSERT,FCEUMENU_CONTEXT_RECORDING_READWRITE } +}; + +int HOTKEYMENUINDEX::updateMenuText() { + return ModifyMenu(hmenuList[hmenu_index], menu_id, GetMenuState(hmenuList[hmenu_index], menu_id, flags) | flags, menu_id, getQualifiedMenuText().c_str()); +} + void UpdateMenuHotkeys() { - //Update all menu items that can be called from a hotkey to include the current hotkey assignment - string combo, combined; - - //-------------------------------FILE--------------------------------------- - //Open ROM - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_OPENROM]); - combined = "&Open ROM...\t" + combo; - ChangeMenuItemText(MENU_OPEN_FILE, combined); - - //Close ROM - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_CLOSEROM]); - combined = "&Close\t" + combo; - ChangeMenuItemText(MENU_CLOSE_FILE, combined); - - //Load State - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_LOAD_STATE]); - combined = "&Load State\t" + combo; - ChangeMenuItemText(MENU_LOADSTATE, combined); - - //Save State - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_SAVE_STATE]); - combined = "&Save State\t" + combo; - ChangeMenuItemText(MENU_SAVESTATE, combined); - - //Loadstate from - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_LOAD_STATE_FROM]); - combined = "Load State &From...\t" + combo; - ChangeMenuItemText(MENU_LOAD_STATE, combined); - - //Savestate as - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_SAVE_STATE_AS]); - combined = "Save State &As...\t" + combo; - ChangeMenuItemText(MENU_SAVE_STATE, combined); - - //Next Save Slot - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_SAVE_SLOT_NEXT]); - combined = "&Next save slot\t" + combo; - ChangeMenuItemText(MENU_NEXTSAVESTATE, combined); - - //Previous Save Slot - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_SAVE_SLOT_PREV]); - combined = "&Previous save slot\t" + combo; - ChangeMenuItemText(MENU_PREVIOUSSAVESTATE, combined); - - //View Save Slots - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MISC_SHOWSTATES]); - combined = "&View save slots\t" + combo; - ChangeMenuItemText(MENU_VIEWSAVESLOTS, combined); - - //Record Movie - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_RECORD_TO]); - combined = "&Record Movie...\t" + combo; - ChangeMenuItemText(MENU_RECORD_MOVIE, combined); - - //Play movie - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_REPLAY_FROM]); - combined = "&Play Movie...\t" + combo; - ChangeMenuItemText(MENU_REPLAY_MOVIE, combined); - - //Stop movie - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_STOP]); - combined = "&Stop Movie\t" + combo; - ChangeMenuItemText(MENU_STOP_MOVIE, combined); - - //Play Movie from Beginning - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_PLAY_FROM_BEGINNING]); - combined = "Play from &Beginning\t" + combo; - ChangeMenuItemText(ID_FILE_PLAYMOVIEFROMBEGINNING, combined); - - //Toggle Movie Recording/Playing - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_TOGGLE_RECORDING]); - combined = "&Toggle Recording/Playing\t" + combo; - ChangeMenuItemText(ID_FILE_TOGGLE_RECORDING_MOVIE, combined); - - //Insert 1 Frame - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_INSERT_1_FRAME]); - combined = "&Insert 1 Frame\t" + combo; - ChangeMenuItemText(ID_FILE_INSERT_1_FRAME, combined); - - //Delete 1 Frame - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_DELETE_1_FRAME]); - combined = "&Delete 1 Frame\t" + combo; - ChangeMenuItemText(ID_FILE_DELETE_1_FRAME, combined); - - //Truncate Movie at Current Frame - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_TRUNCATE]); - combined = "&Truncate at &Current Frame\t" + combo; - ChangeMenuItemText(ID_FILE_TRUNCATE_MOVIE, combined); - - //Read only - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_READONLY_TOGGLE]); - combined = "&Read only\t" + combo; - ChangeMenuItemText(ID_FILE_MOVIE_TOGGLEREAD, combined); - - //Next Record Mode - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_NEXT_RECORD_MODE]); - combined = "&Next Record Mode\t" + combo; - ChangeMenuItemText(ID_FILE_NEXTRECORDMODE, combined); - - //Prev Record Mode - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_PREV_RECORD_MODE]); - combined = "&Prev Record Mode\t" + combo; - ChangeMenuItemText(ID_FILE_PREVRECORDMODE, combined); - - //Record Mode Truncate - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_RECORD_MODE_TRUNCATE]); - combined = "&Truncate\t" + combo; - ChangeMenuItemText(ID_FILE_RECORDMODE_TRUNCATE, combined); - - //Record Mode Overwrite - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_RECORD_MODE_OVERWRITE]); - combined = "&Overwrite[W]\t" + combo; - ChangeMenuItemText(ID_FILE_RECORDMODE_OVERWRITE, combined); - - //Record Mode Insert - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_RECORD_MODE_INSERT]); - combined = "&Insert[I]\t" + combo; - ChangeMenuItemText(ID_FILE_RECORDMODE_INSERT, combined); - - //Screenshot - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_SCREENSHOT]); - combined = "&Screenshot\t" + combo; - ChangeMenuItemText(ID_FILE_SCREENSHOT, combined); - - //Record AVI - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_AVI_RECORD_AS]); - combined = "&Record AVI...\t" + combo; - ChangeMenuItemText(MENU_RECORD_AVI, combined); - - //Stop AVI - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_AVI_STOP]); - combined = "&Stop AVI\t" + combo; - ChangeMenuItemText(MENU_STOP_AVI, combined); - - //-------------------------------NES---------------------------------------- - //Reset - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_RESET]); - combined = "&Reset\t" + combo; - ChangeMenuItemText(MENU_RESET, combined); - - //Power - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_POWER]); - combined = "&Power\t" + combo; - ChangeMenuItemText(MENU_POWER, combined); - - //Eject/Insert Disk - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_FDS_EJECT_INSERT]); - combined = "&Eject/Insert Disk\t" + combo; - ChangeMenuItemText(MENU_EJECT_DISK, combined); - - //Switch Disk Side - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_FDS_SIDE_SELECT]); - combined = "&Switch Disk Side\t" + combo; - ChangeMenuItemText(MENU_SWITCH_DISK, combined); - - //Insert Coin - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_VSUNI_COIN]); - combined = "&Insert Coin\t" + combo; - ChangeMenuItemText(MENU_INSERT_COIN, combined); - - //Speed Up - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_SPEED_FASTER]); - combined = "Speed &Up\t" + combo; - ChangeMenuItemText(ID_NES_SPEEDUP, combined); - - //Slow Down - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_SPEED_SLOWER]); - combined = "Slow &Down\t" + combo; - ChangeMenuItemText(ID_NES_SLOWDOWN, combined); - - //Pause - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_PAUSE]); - combined = "&Pause\t" + combo; - ChangeMenuItemText(ID_NES_PAUSE, combined); - - //Slowest Speed - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_SPEED_SLOWEST]); - combined = "&Slowest Speed\t" + combo; - ChangeMenuItemText(ID_NES_SLOWESTSPEED, combined); - - //Normal Speed - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_SPEED_NORMAL]); - combined = "&Normal Speed\t" + combo; - ChangeMenuItemText(ID_NES_NORMALSPEED, combined); - - //Turbo - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_SPEED_TURBO_TOGGLE]); - combined = "&Turbo\t" + combo; - ChangeMenuItemText(ID_NES_TURBO, combined); - - //-------------------------------Config------------------------------------- - //Hide Menu - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_HIDE_MENU_TOGGLE]); - combined = "&Hide Menu\t" + combo; - ChangeMenuItemText(MENU_HIDE_MENU, combined); - - //Frame Adv. skip lag - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_FRAMEADV_SKIPLAG]); - combined = "&Frame Adv. - Skip Lag\t" + combo; - ChangeMenuItemText(MENU_DISPLAY_FA_LAGSKIP, combined); - - //Lag Counter - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MISC_DISPLAY_LAGCOUNTER_TOGGLE]); - combined = "&Lag Counter\t" + combo; - ChangeMenuItemText(MENU_DISPLAY_LAGCOUNTER, combined); - - //Frame Counter - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_FRAME_DISPLAY_TOGGLE]); - combined = "&Frame Counter\t" + combo; - ChangeMenuItemText(ID_DISPLAY_FRAMECOUNTER, combined); - - //Rerecord Counter - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_RERECORD_DISPLAY_TOGGLE]); - combined = "&Rerecord Counter\t" + combo; - ChangeMenuItemText(ID_DISPLAY_RERECORDCOUNTER, combined); - - //Movie status icon - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MOVIE_ICON_DISPLAY_TOGGLE]); - combined = "&Movie status icon\t" + combo; - ChangeMenuItemText(ID_DISPLAY_MOVIESTATUSICON, combined); - - //FPS counter - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_FPS_DISPLAY_TOGGLE]); - combined = "FPS\t" + combo; - ChangeMenuItemText(ID_DISPLAY_FPS, combined); - - //Graphics: BG - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MISC_DISPLAY_BG_TOGGLE]); - combined = "Graphics: &BG\t" + combo; - ChangeMenuItemText(MENU_DISPLAY_BG, combined); - - //Graphics: OBJ - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MISC_DISPLAY_OBJ_TOGGLE]); - combined = "Graphics: &OBJ\t" + combo; - ChangeMenuItemText(MENU_DISPLAY_OBJ, combined); - - //-------------------------------Tools-------------------------------------- - //Open Cheats - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_TOOL_OPENCHEATS]); - combined = "&Cheats...\t" + combo; - ChangeMenuItemText(MENU_CHEATS, combined); - - //Open RAM Search - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_TOOL_OPENRAMSEARCH]); - combined = "&RAM Search...\t" + combo; - ChangeMenuItemText(ID_RAM_SEARCH, combined); - - //Open RAM Watch - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_TOOL_OPENRAMWATCH]); - combined = "&RAM Watch...\t" + combo; - ChangeMenuItemText(ID_RAM_WATCH, combined); - - //Open Memory Watch - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_TOOL_OPENMEMORYWATCH]); - combined = "&Memory Watch...\t" + combo; - ChangeMenuItemText(MENU_MEMORY_WATCH, combined); - - //Open TAS Editor - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_MISC_OPENTASEDITOR]); - combined = "&TAS Editor...\t" + combo; - ChangeMenuItemText(MENU_TASEDITOR, combined); - - //-------------------------------Debug-------------------------------------- - //Open Debugger - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_TOOL_OPENDEBUGGER]); - combined = "&Debugger...\t" + combo; - ChangeMenuItemText(MENU_DEBUGGER, combined); - - //Open PPU Viewer - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_TOOL_OPENPPU]); - combined = "&PPU Viewer...\t" + combo; - ChangeMenuItemText(MENU_PPUVIEWER, combined); - - //Open Nametable Viewer - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_TOOL_OPENNTVIEW]); - combined = "&Name table Viewer...\t" + combo; - ChangeMenuItemText(MENU_NAMETABLEVIEWER, combined); - - //Open Hex editor - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_TOOL_OPENHEX]); - combined = "&Hex Editor...\t" + combo; - ChangeMenuItemText(MENU_HEXEDITOR, combined); - - //Open Trace Logger - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_TOOL_OPENTRACELOGGER]); - combined = "&Trace Logger...\t" + combo; - ChangeMenuItemText(MENU_TRACELOGGER, combined); - - //Open Code/Data Logger - combo = GetKeyComboName(FCEUD_CommandMapping[EMUCMD_TOOL_OPENCDLOGGER]); - combined = "&Code/Data Logger...\t" + combo; - ChangeMenuItemText(MENU_CDLOGGER, combined); + for (int i = 0; i < sizeof(HOTKEYMENUINDEXs) / sizeof(HOTKEYMENUINDEX); ++i) + HOTKEYMENUINDEXs[i].updateMenuText(); } //This function is for the context menu item Save Movie As... diff --git a/src/drivers/win/window.h b/src/drivers/win/window.h index 66284072..9525a077 100644 --- a/src/drivers/win/window.h +++ b/src/drivers/win/window.h @@ -54,4 +54,31 @@ inline std::wstring GetDlgItemTextW(HWND hDlg, int nIDDlgItem) { return buf; } +enum FCEUMENU_HWND { + FCEUMENU_CONTEXT_OFF, // NoGame + FCEUMENU_CONTEXT_GAME, // Game+NoMovie + FCEUMENU_CONTEXT_PLAYING_READONLY, //Game+Movie+Playing+ReadOnly + FCEUMENU_CONTEXT_PLAYING_READWRITE, //Game+Movie+Playing+ReadWrite + FCEUMENU_CONTEXT_RECORDING_READONLY, //Game+Movie+Recording+ReadOnly + FCEUMENU_CONTEXT_RECORDING_READWRITE, //Game+Movie+Recording+Readwrite + FCEUMENU_CONTEXT, // parent menu of all context menus, + // not recommended to use it since there's duplicate ids in context menus, + // unless you're quite sure the id is unique in all submenus. + FCEUMENU_MAIN, // main fceux menu + FCEUMENU_LIMIT +}; + +struct HOTKEYMENUINDEX { + int menu_id; // menu ID + int cmd_id; // hotkey ID + int hmenu_index = FCEUMENU_MAIN; // whitch menu it belongs to, refers to FCEUMENU_HWND + int flags = MF_BYCOMMAND; // flags when searching and modifying menu item, usually MF_BYCOMMAND + // returns an std::string contains original menu text followed with shortcut keys. + std::string getQualifiedMenuText(); + // this is used when you only want to create a qualified menu text String + static std::string getQualifiedMenuText(char* text, int cmdid); + int updateMenuText(); + HOTKEYMENUINDEX(int id, int cmd, int menu = FCEUMENU_MAIN, int _flags = MF_BYCOMMAND) : menu_id(id), cmd_id(cmd), hmenu_index(menu), flags(_flags) {} +}; + #endif diff --git a/src/fceu.cpp b/src/fceu.cpp index 659307ea..cb0d147f 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -416,10 +416,13 @@ FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silen if (!fp) { - if (!silent) - FCEU_PrintError("Error opening \"%s\"!", name); + extern bool archiveManuallyCanceled; + // Although !fp, if the operation was canceled from archive select dialog box, don't show the error message; + if (!silent && !archiveManuallyCanceled) + FCEU_PrintError("打开 \"%s\" 错误!", name); return 0; - } else if (fp->archiveFilename != "") + } + else if (fp->archiveFilename != "") { strcpy(fullname, fp->archiveFilename.c_str()); strcat(fullname, "|");