From a3a0e3e54353408f6b13da02dc551a7d88f4ead5 Mon Sep 17 00:00:00 2001 From: owomomo Date: Mon, 7 Sep 2020 01:57:32 +0800 Subject: [PATCH] Fix some logic bug of Directories Dialog. --- src/drivers/win/directories.cpp | 7 ++----- src/drivers/win/main.h | 29 +++++++++++++++-------------- src/drivers/win/res.rc | 4 ++-- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/drivers/win/directories.cpp b/src/drivers/win/directories.cpp index 6b3aceb4..069e11e9 100644 --- a/src/drivers/win/directories.cpp +++ b/src/drivers/win/directories.cpp @@ -114,8 +114,7 @@ static INT_PTR CALLBACK DirConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR case WM_CLOSE: case WM_QUIT: - CloseDirectoriesDialog(hwndDlg); - CloseDirectoriesDialog(hwndDlg); //adelikat: Hacky but this fixes the directory overides bug (or at least some instances of it). This of course really just puts a band-aid on the real problem. + EndDialog(hwndDlg, 0); break; case WM_COMMAND: @@ -126,9 +125,7 @@ static INT_PTR CALLBACK DirConCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR { case CLOSE_BUTTON: CloseDirectoriesDialog(hwndDlg); - break; - case BTN_CANCEL: - EndDialog(hwndDlg, 0); + CloseDirectoriesDialog(hwndDlg); //adelikat: Hacky but this fixes the directory overides bug (or at least some instances of it). This of course really just puts a band-aid on the real problem. break; default: static char *helpert[14] = { diff --git a/src/drivers/win/main.h b/src/drivers/win/main.h index faa319cb..4ea60580 100644 --- a/src/drivers/win/main.h +++ b/src/drivers/win/main.h @@ -71,20 +71,21 @@ char *GetRomName(bool force = false); //Checks if rom is loaded, if so, outputs char *GetRomPath(bool force = false); //Checks if rom is loaded, if so, outputs the Rom path only ///Contains the names of the default directories. -static const char *default_directory_names[13] = { - "", // roms - "sav", // nonvol - "fcs", // states - "", // fdsrom - "snaps", // snaps - "cheats", // cheats - "movies", // movies - "tools", // memwatch - "tools", // macro - "tools", // input presets - "tools", // lua scripts - "", // avi output - "" // adelikat - adding a dummy one here ( [13] but only 12 entries) +static const char *default_directory_names[14] = { + "", // roms + "sav", // novol + "fcs", // states + "", // fdsrom + "snaps", // snaps + "cheats", // cheats + "movies", // movies + "tools", // memwatch + "tools", // bot + "tools", // macro + "tools", // input presets + "luascripts", // lua scripts + "", // avi output + "" // adelikat - adding a dummy one here ( [14] but only 13 entries) }; #define NUMBER_OF_DIRECTORIES sizeof(directory_names) / sizeof(*directory_names) diff --git a/src/drivers/win/res.rc b/src/drivers/win/res.rc index f1d132d8..596041b0 100644 --- a/src/drivers/win/res.rc +++ b/src/drivers/win/res.rc @@ -70,10 +70,10 @@ BEGIN PUSHBUTTON "Browse...",BUTTON_MEMWATCH,239,152,56,14 LTEXT "&Input Presets",IDC_STATIC,10,172,42,8 EDITTEXT EDIT_PRESET,71,171,158,12,ES_AUTOHSCROLL - PUSHBUTTON "Browse...",210,239,170,56,14 + PUSHBUTTON "Browse...",BUTTON_PRESET,239,170,56,14 LTEXT "&Lua Scripts",IDC_STATIC,10,190,36,8 EDITTEXT EDIT_LUA,71,189,158,12,ES_AUTOHSCROLL - PUSHBUTTON "Browse...",211,239,188,56,14 + PUSHBUTTON "Browse...",BUTTON_LUA,239,188,56,14 LTEXT "A&vi Output",IDC_STATIC,10,208,34,8 EDITTEXT EDIT_AVI,71,207,158,12,ES_AUTOHSCROLL PUSHBUTTON "Browse...",BUTTON_AVI,239,206,56,14