From 822bc9a3ab310b8f4b3c6d549fcd79f773aaa498 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 17 Jun 2020 22:56:18 -0300 Subject: [PATCH 01/21] Convert startup errors to TaskDialog --- src/win/win_ui.c | 66 +++++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 1dfc57527..d13f45dbf 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -819,6 +819,20 @@ SubWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } +static HRESULT CALLBACK +TaskDialogProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, LONG_PTR lpRefData) +{ + switch (message) { + case TDN_HYPERLINK_CLICKED: + /* open linked URL */ + ShellExecute(hwnd, L"open", (LPCWSTR) lParam, NULL, NULL, SW_SHOW); + break; + } + + return S_OK; +} + + int ui_init(int nCmdShow) { @@ -826,18 +840,31 @@ ui_init(int nCmdShow) WNDCLASSEX wincl; /* buffer for main window's class */ RAWINPUTDEVICE ridev; /* RawInput device */ MSG messages; /* received-messages buffer */ - HWND hwnd = NULL; /* handle for our window */ + HWND hwnd = NULL; /* handle for our window */ HACCEL haccel; /* handle to accelerator table */ - RECT sbar_rect; /* RECT of the status bar */ + RECT sbar_rect; /* RECT of the status bar */ int bRet; + TASKDIALOGCONFIG tdconfig = {0}; + TASKDIALOG_BUTTON tdbuttons[] = {{IDOK, MAKEINTRESOURCE(IDS_2119)}}; + /* Set up TaskDialog configuration. */ + tdconfig.cbSize = sizeof(tdconfig); + tdconfig.dwFlags = TDF_ENABLE_HYPERLINKS; + tdconfig.dwCommonButtons = 0; + tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_STRINGS); + tdconfig.pszMainIcon = TD_ERROR_ICON; + tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2050); + tdconfig.cButtons = ARRAYSIZE(tdbuttons); + tdconfig.pButtons = tdbuttons; + tdconfig.pfCallback = TaskDialogProcedure; + + /* Start settings-only mode if requested. */ if (settings_only) { if (! pc_init_modules()) { /* Dang, no ROMs found at all! */ - MessageBox(hwnd, - plat_get_string(IDS_2056), - plat_get_string(IDS_2050), - MB_OK | MB_ICONERROR); + tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2120); + tdconfig.pszContent = MAKEINTRESOURCE(IDS_2056); + TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); return(6); } @@ -895,7 +922,7 @@ ui_init(int nCmdShow) menuMain, /* menu */ hinstance, /* Program Instance handler */ NULL); /* no Window Creation data */ - hwndMain = hwnd; + hwndMain = tdconfig.hwndParent = hwnd; ui_window_title(title); @@ -925,10 +952,8 @@ ui_init(int nCmdShow) ridev.dwFlags = RIDEV_NOHOTKEYS; ridev.hwndTarget = NULL; /* current focus window */ if (! RegisterRawInputDevices(&ridev, 1, sizeof(ridev))) { - MessageBox(hwndMain, - plat_get_string(IDS_2105), - plat_get_string(IDS_2050), - MB_OK | MB_ICONERROR); + tdconfig.pszContent = MAKEINTRESOURCE(IDS_2105); + TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); return(4); } keyboard_getkeymap(); @@ -939,10 +964,8 @@ ui_init(int nCmdShow) /* Load the accelerator table */ haccel = LoadAccelerators(hinstance, ACCEL_NAME); if (haccel == NULL) { - MessageBox(hwndMain, - plat_get_string(IDS_2104), - plat_get_string(IDS_2050), - MB_OK | MB_ICONERROR); + tdconfig.pszContent = MAKEINTRESOURCE(IDS_2104); + TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); return(3); } @@ -972,19 +995,16 @@ ui_init(int nCmdShow) /* All done, fire up the actual emulated machine. */ if (! pc_init_modules()) { /* Dang, no ROMs found at all! */ - MessageBox(hwnd, - plat_get_string(IDS_2056), - plat_get_string(IDS_2050), - MB_OK | MB_ICONERROR); + tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2120); + tdconfig.pszContent = MAKEINTRESOURCE(IDS_2056); + TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); return(6); } /* Initialize the configured Video API. */ if (! plat_setvid(vid_api)) { - MessageBox(hwnd, - plat_get_string(IDS_2089), - plat_get_string(IDS_2050), - MB_OK | MB_ICONERROR); + tdconfig.pszContent = MAKEINTRESOURCE(IDS_2089); + TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); return(5); } From 02cdf5e78738d13270f2fee19f64bbf9f798f00d Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 17 Jun 2020 23:07:32 -0300 Subject: [PATCH 02/21] Convert settings save prompt to TaskDialog --- src/include/86box/language.h | 13 +++++++++---- src/win/86Box.rc | 17 +++++++++++------ src/win/win_settings.c | 22 ++++++++++++++++++---- 3 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index d5a6d9b8f..e81e22b26 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -24,7 +24,7 @@ #define IDS_STRINGS 2048 // "86Box" #define IDS_2049 2049 // "86Box Error" #define IDS_2050 2050 // "86Box Fatal Error" -#define IDS_2051 2051 // "This will hard reset the.." +#define IDS_2051 2051 // "Are you sure you want to save..." #define IDS_2052 2052 // "Use CTRL+ALT+PAGE DOWN.." #define IDS_2053 2053 // "Speed" #define IDS_2054 2054 // "ZIP %i (%03i): %ls" @@ -62,7 +62,7 @@ #define IDS_2086 2086 // "MB" #define IDS_2087 2087 // "Check BPB" #define IDS_2088 2088 // "KB" -#define IDS_2089 2089 // "Neither DirectDraw nor Dire.." +#define IDS_2089 2089 // "Could not initialize the video..." #define IDS_2090 2090 // "Default" #define IDS_2091 2091 // "%i Wait state(s)" #define IDS_2092 2092 // "Type" @@ -77,8 +77,8 @@ #define IDS_2101 2101 // "Microsoft SideWinder Pad" #define IDS_2102 2102 // "Thrustmaster Flight Cont.." #define IDS_2103 2103 // "None" -#define IDS_2104 2104 // "Unable to load Accelerators" -#define IDS_2105 2105 // "Unable to register Raw Input" +#define IDS_2104 2104 // "Unable to load keyboard..." +#define IDS_2105 2105 // "Unable to register raw input." #define IDS_2106 2106 // "%u" #define IDS_2107 2107 // "%u MB (CHS: %i, %i, %i)" #define IDS_2108 2108 // "Floppy %i (%s): %ls" @@ -92,6 +92,11 @@ #define IDS_2116 2116 // "MO images (*.IM?)\0*.IM..." #define IDS_2117 2117 // "Welcome to 86Box!" #define IDS_2118 2118 // "Internal controller" +#define IDS_2119 2119 // "Exit" +#define IDS_2120 2120 // "No ROMs found" +#define IDS_2121 2121 // "Save changes\nThis will hard..." +#define IDS_2122 2122 // "Discard changes\nAll changes..." +#define IDS_2123 2123 // "Cancel\nGo back to the..." #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 4ca9269a6..f8adec7f5 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -893,12 +893,12 @@ BEGIN 2048 "86Box" IDS_2049 "86Box Error" IDS_2050 "86Box Fatal Error" - IDS_2051 "This will hard reset the emulated machine.\nAre you sure you want to save the settings?" + IDS_2051 "Are you sure you want to save the settings?" IDS_2052 "Use CTRL+ALT+PAGE DOWN to return to windowed mode" IDS_2053 "Speed" IDS_2054 "ZIP %03i %i (%s): %ls" IDS_2055 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0" - IDS_2056 "86Box could not find any usable ROM images.\n\nPlease download a ROM set from https://github.com/86Box/roms/releases/latest and extract it into the ""roms"" directory." + IDS_2056 "86Box could not find any usable ROM images.\n\nPlease download a ROM set from https://github.com/86Box/roms/releases/latest and extract it into the ""roms"" directory." IDS_2057 "(empty)" IDS_2058 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0All files (*.*)\0*.*\0" IDS_2059 "Turbo" @@ -939,7 +939,7 @@ BEGIN IDS_2086 "MB" IDS_2087 "Check BPB" IDS_2088 "KB" - IDS_2089 "86Box could not initialize the video renderer." + IDS_2089 "Could not initialize the video renderer." IDS_2090 "Default" IDS_2091 "%i Wait state(s)" IDS_2092 "Type" @@ -954,8 +954,8 @@ BEGIN IDS_2101 "Microsoft SideWinder Pad" IDS_2102 "Thrustmaster Flight Control System" IDS_2103 "None" - IDS_2104 "Unable to load Keyboard Accelerators!" - IDS_2105 "Unable to register Raw Input!" + IDS_2104 "Unable to load keyboard accelerators." + IDS_2105 "Unable to register raw input." IDS_2106 "%u" IDS_2107 "%u MB (CHS: %i, %i, %i)" IDS_2108 "Floppy %i (%s): %ls" @@ -968,7 +968,12 @@ BEGIN IDS_2115 "MO %i (%03i): %ls" IDS_2116 "MO images (*.IM?)\0*.IM?\0All files (*.*)\0*.*\0" IDS_2117 "Welcome to 86Box!" - IDS_2118 "Internal controller" + IDS_2118 "Internal controller" + IDS_2119 "Exit" + IDS_2120 "No ROMs found" + IDS_2121 "Save changes\nThis will hard reset the emulated machine." + IDS_2122 "Discard changes\nAll changes made to the settings will be lost." + IDS_2123 "Cancel\nGo back to the Settings window." END STRINGTABLE DISCARDABLE diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 3ddd0dffb..c537fb529 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -396,17 +396,31 @@ static int settings_msgbox_reset(void) { int changed, i = 0; + TASKDIALOGCONFIG tdconfig = {0}; + TASKDIALOG_BUTTON tdbuttons[] = { + {IDYES, MAKEINTRESOURCE(IDS_2121)}, + {IDNO, MAKEINTRESOURCE(IDS_2122)}, + {IDCANCEL, MAKEINTRESOURCE(IDS_2123)} + }; changed = win_settings_changed(); if (changed) { - i = settings_msgbox(MBX_QUESTION, (wchar_t *)IDS_2051); + tdconfig.cbSize = sizeof(tdconfig); + tdconfig.hwndParent = hwndParentDialog; + tdconfig.dwFlags = TDF_USE_COMMAND_LINKS; + tdconfig.dwCommonButtons = 0; + tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_STRINGS); + tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2051); + tdconfig.cButtons = ARRAYSIZE(tdbuttons); + tdconfig.pButtons = tdbuttons; + TaskDialogIndirect(&tdconfig, &i, NULL, NULL); - if (i == 1) return(1); /* no */ + if (i == IDNO) return(1); /* no */ - if (i < 0) return(0); /* cancel */ + if (i == IDYES) return(2); /* yes */ - return(2); /* yes */ + return(0); /* cancel */ } else return(1); } From eee75a7c1d59e2fb89afc77a3c78a20cb616433f Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 17 Jun 2020 23:15:04 -0300 Subject: [PATCH 03/21] Convert ui_msgbox to TaskDialog --- src/include/86box/language.h | 4 ++-- src/win/86Box.rc | 4 ++-- src/win/win_dialog.c | 34 +++++++++++++++++++--------------- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index e81e22b26..2330b385d 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -22,8 +22,8 @@ /* String IDs. */ #define IDS_STRINGS 2048 // "86Box" -#define IDS_2049 2049 // "86Box Error" -#define IDS_2050 2050 // "86Box Fatal Error" +#define IDS_2049 2049 // "Error" +#define IDS_2050 2050 // "Fatal error" #define IDS_2051 2051 // "Are you sure you want to save..." #define IDS_2052 2052 // "Use CTRL+ALT+PAGE DOWN.." #define IDS_2053 2053 // "Speed" diff --git a/src/win/86Box.rc b/src/win/86Box.rc index f8adec7f5..872d4a344 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -891,8 +891,8 @@ END STRINGTABLE DISCARDABLE BEGIN 2048 "86Box" - IDS_2049 "86Box Error" - IDS_2050 "86Box Fatal Error" + IDS_2049 "Error" + IDS_2050 "Fatal error" IDS_2051 "Are you sure you want to save the settings?" IDS_2052 "Use CTRL+ALT+PAGE DOWN to return to windowed mode" IDS_2053 "Speed" diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index 7844e1c8c..84a15b7d3 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -43,34 +43,34 @@ int ui_msgbox(int flags, void *arg) { WCHAR temp[512]; - DWORD fl = 0; + int fl = 0; + PCWSTR icon = NULL; WCHAR *str = NULL; WCHAR *cap = NULL; switch(flags & 0x1f) { case MBX_INFO: /* just an informational message */ - fl = (MB_OK | MB_ICONINFORMATION); - cap = plat_get_string(IDS_STRINGS); /* "86Box" */ + icon = TD_INFORMATION_ICON; + fl = TDCBF_OK_BUTTON; break; case MBX_ERROR: /* error message */ + fl = TDCBF_OK_BUTTON; if (flags & MBX_FATAL) { - fl = (MB_OK | MB_ICONERROR); - cap = plat_get_string(IDS_2050); /* "Fatal Error"*/ + icon = TD_ERROR_ICON; + cap = plat_get_string(IDS_2050); /* "Fatal error" */ } else { - fl = (MB_OK | MB_ICONWARNING); + icon = TD_WARNING_ICON; cap = plat_get_string(IDS_2049); /* "Error" */ } break; case MBX_QUESTION: /* question */ - fl = (MB_YESNOCANCEL | MB_ICONQUESTION); - cap = plat_get_string(IDS_STRINGS); /* "86Box" */ + fl = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON; break; case MBX_QUESTION_YN: /* question */ - fl = (MB_YESNO | MB_ICONQUESTION); - cap = plat_get_string(IDS_STRINGS); /* "86Box" */ + fl = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON; break; } @@ -95,14 +95,18 @@ ui_msgbox(int flags, void *arg) * that if the value of 'arg' is low, its an ID.. */ if (((uintptr_t)arg) < ((uintptr_t)65636)) - str = plat_get_string((intptr_t)arg); + str = MAKEINTRESOURCE((intptr_t)arg); } /* At any rate, we do have a valid (wide) string now. */ - fl = MessageBox(hwndMain, /* our main window */ - str, /* error message etc */ - cap, /* window caption */ - fl); + TaskDialog(hwndMain, + NULL, + MAKEINTRESOURCE(IDS_STRINGS), + cap, + str, + fl, + icon, + &fl); /* Convert return values to generic ones. */ if (fl == IDNO) fl = 1; From 78bc6d9887003dbd6cd08d3b46d005329258ea6e Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 17 Jun 2020 23:24:56 -0300 Subject: [PATCH 04/21] Change startup error button to IDCANCEL, enabling the user to close the TaskDialog instead --- src/win/win_ui.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win/win_ui.c b/src/win/win_ui.c index d13f45dbf..d47e4da0f 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -845,7 +845,7 @@ ui_init(int nCmdShow) RECT sbar_rect; /* RECT of the status bar */ int bRet; TASKDIALOGCONFIG tdconfig = {0}; - TASKDIALOG_BUTTON tdbuttons[] = {{IDOK, MAKEINTRESOURCE(IDS_2119)}}; + TASKDIALOG_BUTTON tdbuttons[] = {{IDCANCEL, MAKEINTRESOURCE(IDS_2119)}}; /* Set up TaskDialog configuration. */ tdconfig.cbSize = sizeof(tdconfig); From 5957832a4197aa2554cea8951cd614f753cd5161 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 00:06:15 -0300 Subject: [PATCH 05/21] Convert about dialog to TaskDialog --- src/include/86box/language.h | 4 +++ src/win/86Box.rc | 17 +++--------- src/win/win_about.c | 53 ++++++++++-------------------------- 3 files changed, 23 insertions(+), 51 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 2330b385d..473f32d18 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -97,6 +97,10 @@ #define IDS_2121 2121 // "Save changes\nThis will hard..." #define IDS_2122 2122 // "Discard changes\nAll changes..." #define IDS_2123 2123 // "Cancel\nGo back to the..." +#define IDS_2124 2124 // "About " EMU_NAME +#define IDS_2125 2125 // EMU_NAME " v" EMU_VERSION +#define IDS_2126 2126 // "An emulator of old computers..." +#define IDS_2127 2127 // "OK" #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 872d4a344..a75236f48 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -274,19 +274,6 @@ END // // Dialog // -DLG_ABOUT DIALOG DISCARDABLE 0, 0, 209, 114 -STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "About 86Box" -FONT 9, "Segoe UI" -BEGIN - DEFPUSHBUTTON "OK",IDOK,129,94,71,12 - ICON 100,IDC_ABOUT_ICON,7,7,20,20 - LTEXT "86Box v" EMU_VERSION " - An emulator of old computers\n\nAuthors: Sarah Walker, Miran Grca, Fred N. van Kempen (waltje), SA1988, MoochMcGee, reenigne, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2. See LICENSE for more information.", - IDC_ABOUT_ICON,54,7,146,73 - CONTROL "",IDC_ABOUT_ICON,"Static",SS_BLACKFRAME | SS_SUNKEN,0, - 86,208,1 -END - DLG_STATUS DIALOG DISCARDABLE 0, 0, 186, 386 STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Status" @@ -974,6 +961,10 @@ BEGIN IDS_2121 "Save changes\nThis will hard reset the emulated machine." IDS_2122 "Discard changes\nAll changes made to the settings will be lost." IDS_2123 "Cancel\nGo back to the Settings window." + IDS_2124 "About " EMU_NAME + IDS_2125 EMU_NAME " v" EMU_VERSION + IDS_2126 "An emulator of old computers\n\nAuthors: Sarah Walker, Miran Grca, Fred N. van Kempen (waltje), SA1988, MoochMcGee, reenigne, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2. See LICENSE for more information." + IDS_2127 "OK" END STRINGTABLE DISCARDABLE diff --git a/src/win/win_about.c b/src/win/win_about.c index 0c57c346d..bc4beda7d 100644 --- a/src/win/win_about.c +++ b/src/win/win_about.c @@ -21,6 +21,7 @@ #include #include #undef BITMAP +#include #include #include #include @@ -31,45 +32,21 @@ #include <86box/win.h> -#if defined(__amd64__) || defined(__aarch64__) -static LRESULT CALLBACK -#else -static BOOL CALLBACK -#endif -AboutDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) -{ - HWND h; - HANDLE ih; - - switch (message) { - case WM_INITDIALOG: - plat_pause(1); - h = GetDlgItem(hdlg, IDC_ABOUT_ICON); - ih = LoadImage(hinstance,(PCTSTR)10,IMAGE_ICON,64,64,0); - SendMessage(h, STM_SETIMAGE, (WPARAM)IMAGE_ICON, - (LPARAM)ih); - break; - - case WM_COMMAND: - switch (LOWORD(wParam)) { - case IDOK: - case IDCANCEL: - EndDialog(hdlg, 0); - plat_pause(0); - return TRUE; - - default: - break; - } - break; - } - - return(FALSE); -} - - void AboutDialogCreate(HWND hwnd) { - DialogBox(hinstance, (LPCTSTR)DLG_ABOUT, hwnd, AboutDialogProcedure); + TASKDIALOGCONFIG tdconfig = {0}; + TASKDIALOG_BUTTON tdbuttons[] = {{IDCANCEL, MAKEINTRESOURCE(IDS_2127)}}; + + tdconfig.cbSize = sizeof(tdconfig); + tdconfig.hwndParent = hwnd; + tdconfig.hInstance = hinstance; + tdconfig.dwCommonButtons = 0; + tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_2124); + tdconfig.pszMainIcon = (PCWSTR) 10; + tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2125); + tdconfig.pszContent = MAKEINTRESOURCE(IDS_2126); + tdconfig.cButtons = ARRAYSIZE(tdbuttons); + tdconfig.pButtons = tdbuttons; + TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); } From 47544cd02bb2ef35ff33f8b6ef7924bdb6f282ad Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 20:34:12 -0300 Subject: [PATCH 06/21] Introduce ui_msgbox_ex, allowing for customizable header and buttons --- src/include/86box/ui.h | 4 +- src/win/win_dialog.c | 124 +++++++++++++++++++++-------------------- 2 files changed, 68 insertions(+), 60 deletions(-) diff --git a/src/include/86box/ui.h b/src/include/86box/ui.h index ce9635cf1..feeea14e4 100644 --- a/src/include/86box/ui.h +++ b/src/include/86box/ui.h @@ -36,8 +36,10 @@ extern "C" { #define MBX_QUESTION_YN 4 #define MBX_FATAL 0x20 #define MBX_ANSI 0x80 +#define MBX_LINKS 0x100 -extern int ui_msgbox(int type, void *arg); +extern int ui_msgbox(int flags, void *message); +extern int ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, void *btn3); extern void ui_check_menu_item(int id, int checked); diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index 84a15b7d3..f9613c346 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -34,97 +34,103 @@ #include <86box/win.h> + +#define STRING_OR_RESOURCE(s) ((!(s)) ? (NULL) : ((((uintptr_t)s) < ((uintptr_t)65636)) ? (MAKEINTRESOURCE(s)) : (s))) + + WCHAR wopenfilestring[512]; char openfilestring[512]; uint8_t filterindex = 0; int -ui_msgbox(int flags, void *arg) +ui_msgbox(int flags, void *message) { - WCHAR temp[512]; - int fl = 0; - PCWSTR icon = NULL; - WCHAR *str = NULL; - WCHAR *cap = NULL; + return ui_msgbox_ex(flags, NULL, message, NULL, NULL, NULL); +} + +int +ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, void *btn3) { + WCHAR temp[512]; + TASKDIALOGCONFIG tdconfig = {0}; + TASKDIALOG_BUTTON tdbuttons[3], + tdb_yes = {IDYES, STRING_OR_RESOURCE(btn1)}, + tdb_no = {IDNO, STRING_OR_RESOURCE(btn2)}, + tdb_cancel = {IDCANCEL, STRING_OR_RESOURCE(btn3)}; + int ret = 0; + + /* Configure the default OK button. */ + tdconfig.cButtons = 0; + if (btn1) + tdbuttons[tdconfig.cButtons++] = tdb_yes; + else + tdconfig.dwCommonButtons = TDCBF_OK_BUTTON; + + /* Configure the message type. */ switch(flags & 0x1f) { case MBX_INFO: /* just an informational message */ - icon = TD_INFORMATION_ICON; - fl = TDCBF_OK_BUTTON; + tdconfig.pszMainIcon = TD_INFORMATION_ICON; break; case MBX_ERROR: /* error message */ - fl = TDCBF_OK_BUTTON; if (flags & MBX_FATAL) { - icon = TD_ERROR_ICON; - cap = plat_get_string(IDS_2050); /* "Fatal error" */ + tdconfig.pszMainIcon = TD_ERROR_ICON; + tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2050); /* "Fatal error" */ } else { - icon = TD_WARNING_ICON; - cap = plat_get_string(IDS_2049); /* "Error" */ + tdconfig.pszMainIcon = TD_WARNING_ICON; + tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2049); /* "Error" */ } break; case MBX_QUESTION: /* question */ - fl = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON | TDCBF_CANCEL_BUTTON; - break; + case MBX_QUESTION_YN: + if (!btn1) /* replace default "OK" button with "Yes" button */ + tdconfig.dwCommonButtons = TDCBF_YES_BUTTON; - case MBX_QUESTION_YN: /* question */ - fl = TDCBF_YES_BUTTON | TDCBF_NO_BUTTON; + if (btn2) /* "No" button */ + tdbuttons[tdconfig.cButtons++] = tdb_no; + else + tdconfig.dwCommonButtons |= TDCBF_NO_BUTTON; + + if (flags & MBX_QUESTION) { + if (btn3) /* "Cancel" button */ + tdbuttons[tdconfig.cButtons++] = tdb_cancel; + else + tdconfig.dwCommonButtons |= TDCBF_CANCEL_BUTTON; + } break; } - /* If ANSI string, convert it. */ - str = (WCHAR *)arg; + /* If the message is an ANSI string, convert it. */ + tdconfig.pszContent = (WCHAR *) STRING_OR_RESOURCE(message); if (flags & MBX_ANSI) { - mbstowcs(temp, (char *)arg, strlen((char *)arg)+1); - str = temp; - } else { - /* - * It's a Unicode string. - * - * Well, no, maybe not. It could also be one of the - * strings stored in the Resources. Those are wide, - * but referenced by a numeric ID. - * - * The good news is, that strings are usually stored - * in the executable near the end of the code/rodata - * segment. This means, that *real* string pointers - * usually have a pretty high (numeric) value, much - * higher than the numeric ID's. So, we guesswork - * that if the value of 'arg' is low, its an ID.. - */ - if (((uintptr_t)arg) < ((uintptr_t)65636)) - str = MAKEINTRESOURCE((intptr_t)arg); + mbstowcs(temp, (char *)message, strlen((char *)message)+1); + tdconfig.pszContent = temp; } - /* At any rate, we do have a valid (wide) string now. */ - TaskDialog(hwndMain, - NULL, - MAKEINTRESOURCE(IDS_STRINGS), - cap, - str, - fl, - icon, - &fl); + /* Configure the rest of the TaskDialog. */ + tdconfig.cbSize = sizeof(tdconfig); + tdconfig.hwndParent = hwndMain; + if (flags & MBX_LINKS) + tdconfig.dwFlags = TDF_USE_COMMAND_LINKS; + tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_STRINGS); + if (header) + tdconfig.pszMainInstruction = STRING_OR_RESOURCE(header); + tdconfig.pButtons = tdbuttons; + + /* Run the TaskDialog. */ + TaskDialogIndirect(&tdconfig, &ret, NULL, NULL); /* Convert return values to generic ones. */ - if (fl == IDNO) fl = 1; - else if (fl == IDCANCEL) fl = -1; - else fl = 0; + if (ret == IDNO) ret = 1; + else if (ret == IDCANCEL) ret = -1; + else ret = 0; - return(fl); + return(ret); } -#if 0 -int -msgbox_reset_yn(HWND hwnd) -{ - return(MessageBox(hwnd, plat_get_string(IDS_2051), -#endif - - int file_dlg_w(HWND hwnd, WCHAR *f, WCHAR *fn, int save) { From 6eb7314c5b992e91f50697722e101373dffaaf7c Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 21:05:53 -0300 Subject: [PATCH 07/21] Improve fatals and missing romset messages (also introducing ui_msgbox_header as a middle-of-the-road option) --- src/include/86box/language.h | 5 +++-- src/include/86box/ui.h | 1 + src/pc.c | 9 ++++++--- src/win/86Box.rc | 5 +++-- src/win/win_dialog.c | 7 +++++++ 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 473f32d18..d29573aa5 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -36,8 +36,8 @@ #define IDS_2060 2060 // "On" #define IDS_2061 2061 // "Off" #define IDS_2062 2062 // "All floppy images (*.DSK..." -#define IDS_2063 2063 // "Configured ROM set not avai.." -#define IDS_2064 2064 // "Configured video BIOS not.." +#define IDS_2063 2063 // "Machine ""%S"" is not..." +#define IDS_2064 2064 // "Video card ""%S"" is not..." #define IDS_2065 2065 // "Machine" #define IDS_2066 2066 // "Display" #define IDS_2067 2067 // "Input devices" @@ -101,6 +101,7 @@ #define IDS_2125 2125 // EMU_NAME " v" EMU_VERSION #define IDS_2126 2126 // "An emulator of old computers..." #define IDS_2127 2127 // "OK" +#define IDS_2128 2128 // "Hardware not available" #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" diff --git a/src/include/86box/ui.h b/src/include/86box/ui.h index feeea14e4..ab250cb41 100644 --- a/src/include/86box/ui.h +++ b/src/include/86box/ui.h @@ -39,6 +39,7 @@ extern "C" { #define MBX_LINKS 0x100 extern int ui_msgbox(int flags, void *message); +extern int ui_msgbox_header(int flags, void *header, void *message); extern int ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, void *btn3); extern void ui_check_menu_item(int id, int checked); diff --git a/src/pc.c b/src/pc.c index 6b1d57ce0..8269685a8 100644 --- a/src/pc.c +++ b/src/pc.c @@ -283,7 +283,7 @@ fatal(const char *fmt, ...) to avoid things like threads getting stuck. */ do_stop(); - ui_msgbox(MBX_ERROR|MBX_FATAL|MBX_ANSI, temp); + ui_msgbox_ex(MBX_ERROR | MBX_FATAL | MBX_ANSI, NULL, temp, (wchar_t *) IDS_2119, NULL, NULL); fflush(stdlog); @@ -553,6 +553,7 @@ int pc_init_modules(void) { int c, m; + wchar_t temp[512]; pc_log("Scanning for ROM images:\n"); c = m = 0; @@ -568,11 +569,12 @@ pc_init_modules(void) /* Load the ROMs for the selected machine. */ if (! machine_available(machine)) { + swprintf(temp, sizeof(temp), plat_get_string(IDS_2063), machine_getname()); c = 0; machine = -1; while (machine_get_internal_name_ex(c) != NULL) { if (machine_available(c)) { - ui_msgbox(MBX_INFO, (wchar_t *)IDS_2063); + ui_msgbox_header(MBX_INFO, (wchar_t *) IDS_2128, temp); machine = c; config_save(); break; @@ -588,11 +590,12 @@ pc_init_modules(void) /* Make sure we have a usable video card. */ if (! video_card_available(gfxcard)) { + swprintf(temp, sizeof(temp), plat_get_string(IDS_2064), video_card_getname(gfxcard)); c = 0; while (video_get_internal_name(c) != NULL) { gfxcard = -1; if (video_card_available(c)) { - ui_msgbox(MBX_INFO, (wchar_t *)IDS_2064); + ui_msgbox_header(MBX_INFO, (wchar_t *) IDS_2128, temp); gfxcard = c; config_save(); break; diff --git a/src/win/86Box.rc b/src/win/86Box.rc index a75236f48..b3ea93c55 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -892,12 +892,12 @@ BEGIN IDS_2060 "On" IDS_2061 "Off" IDS_2062 "All images (*.86F;*.DSK;*.FLP;*.IM?;*.*FD?)\0*.86F;*.DSK;*.FLP;*.IM?;*.*FD?\0Basic sector images (*.DSK;*.FLP;*.IM?;*.*FD?)\0*.DSK;*.FLP;*.IM?;*.IMG;*.*FD?\0Surface images (*.86F)\0*.86F\0" - IDS_2063 "Configured ROM set not available.\nDefaulting to an available ROM set." + IDS_2063 "Machine ""%S"" is not available due to missing ROMs in the roms/machines directory. Switching to an available machine." END STRINGTABLE DISCARDABLE BEGIN - IDS_2064 "Configured video BIOS not available.\nDefaulting to an available video BIOS." + IDS_2064 "Video card ""%S"" is not available due to missing ROMs in the roms/video directory. Switching to an available video card." IDS_2065 "Machine" IDS_2066 "Display" IDS_2067 "Input devices" @@ -965,6 +965,7 @@ BEGIN IDS_2125 EMU_NAME " v" EMU_VERSION IDS_2126 "An emulator of old computers\n\nAuthors: Sarah Walker, Miran Grca, Fred N. van Kempen (waltje), SA1988, MoochMcGee, reenigne, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2. See LICENSE for more information." IDS_2127 "OK" + IDS_2128 "Hardware not available" END STRINGTABLE DISCARDABLE diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index f9613c346..a5ff73867 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -50,6 +50,13 @@ ui_msgbox(int flags, void *message) } +int +ui_msgbox_header(int flags, void *header, void *message) +{ + return ui_msgbox_ex(flags, header, message, NULL, NULL, NULL); +} + + int ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, void *btn3) { WCHAR temp[512]; From 62724cda1f54367aa65eec4d994a3d802cdf5847 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 21:11:32 -0300 Subject: [PATCH 08/21] Make "Exit" the default button for fatal errors --- src/pc.c | 2 +- src/win/win_dialog.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/pc.c b/src/pc.c index 8269685a8..574b81d58 100644 --- a/src/pc.c +++ b/src/pc.c @@ -283,7 +283,7 @@ fatal(const char *fmt, ...) to avoid things like threads getting stuck. */ do_stop(); - ui_msgbox_ex(MBX_ERROR | MBX_FATAL | MBX_ANSI, NULL, temp, (wchar_t *) IDS_2119, NULL, NULL); + ui_msgbox(MBX_ERROR | MBX_FATAL | MBX_ANSI, temp); fflush(stdlog); diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index a5ff73867..43ef4a779 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -64,7 +64,8 @@ ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, voi TASKDIALOG_BUTTON tdbuttons[3], tdb_yes = {IDYES, STRING_OR_RESOURCE(btn1)}, tdb_no = {IDNO, STRING_OR_RESOURCE(btn2)}, - tdb_cancel = {IDCANCEL, STRING_OR_RESOURCE(btn3)}; + tdb_cancel = {IDCANCEL, STRING_OR_RESOURCE(btn3)}, + tdb_exit = {IDCLOSE, MAKEINTRESOURCE(IDS_2119)}; int ret = 0; /* Configure the default OK button. */ @@ -84,6 +85,13 @@ ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, voi if (flags & MBX_FATAL) { tdconfig.pszMainIcon = TD_ERROR_ICON; tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2050); /* "Fatal error" */ + + /* replace default "OK" button with "Exit" button */ + if (btn1) + tdconfig.cButtons = 0; + else + tdconfig.dwCommonButtons = 0; + tdbuttons[tdconfig.cButtons++] = tdb_exit; } else { tdconfig.pszMainIcon = TD_WARNING_ICON; tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2049); /* "Error" */ From a5e14f2ae78c7f9a0eebfeb413dd01c579f8712d Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 21:20:10 -0300 Subject: [PATCH 09/21] Improve pcap errors --- src/config.c | 4 ++-- src/include/86box/language.h | 1 + src/network/network.c | 2 +- src/win/86Box.rc | 8 +++++++- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/config.c b/src/config.c index e1d0ad6d4..5a089b8b8 100644 --- a/src/config.c +++ b/src/config.c @@ -713,9 +713,9 @@ load_network(void) if (p != NULL) { if ((network_dev_to_id(p) == -1) || (network_ndev == 1)) { if ((network_ndev == 1) && strcmp(network_host, "none")) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2094); + ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2094, (wchar_t *) IDS_2129); } else if (network_dev_to_id(p) == -1) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2095); + ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2095, (wchar_t *) IDS_2129); } strcpy(network_host, "none"); diff --git a/src/include/86box/language.h b/src/include/86box/language.h index d29573aa5..10a91e07e 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -102,6 +102,7 @@ #define IDS_2126 2126 // "An emulator of old computers..." #define IDS_2127 2127 // "OK" #define IDS_2128 2128 // "Hardware not available" +#define IDS_2129 2129 // "Make sure " PCAP " is installed..." #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" diff --git a/src/network/network.c b/src/network/network.c index a32f232c1..77fbfa1ae 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -438,7 +438,7 @@ network_reset(void) if (i < 0) { /* Tell user we can't do this (at the moment.) */ - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2093); + ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2093, (wchar_t *) IDS_2129); // FIXME: we should ask in the dialog if they want to // reconfigure or quit, and throw them into the diff --git a/src/win/86Box.rc b/src/win/86Box.rc index b3ea93c55..25543e05a 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -930,7 +930,7 @@ BEGIN IDS_2090 "Default" IDS_2091 "%i Wait state(s)" IDS_2092 "Type" - IDS_2093 "PCap failed to set up because it may not be initialized" + IDS_2093 "Failed to set up PCap" IDS_2094 "No PCap devices found" IDS_2095 "Invalid PCap device" IDS_2096 "Standard 2-button joystick(s)" @@ -966,6 +966,12 @@ BEGIN IDS_2126 "An emulator of old computers\n\nAuthors: Sarah Walker, Miran Grca, Fred N. van Kempen (waltje), SA1988, MoochMcGee, reenigne, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2. See LICENSE for more information." IDS_2127 "OK" IDS_2128 "Hardware not available" +#ifdef _WIN32 +#define PCAP "WinPcap" +#else +#define PCAP "libpcap" +#endif + IDS_2129 "Make sure " PCAP " is installed and that you are on a " PCAP "-compatible network connection." END STRINGTABLE DISCARDABLE From a3d6e4aa4e71b60f3a58b88869972439e915331a Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 21:23:34 -0300 Subject: [PATCH 10/21] Improve MFM/RLL/ESDI CD-ROM error message --- src/disk/hdd.c | 5 +---- src/include/86box/language.h | 1 + src/win/86Box.rc | 1 + 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/disk/hdd.c b/src/disk/hdd.c index 15bb5743e..f1c0f1599 100644 --- a/src/disk/hdd.c +++ b/src/disk/hdd.c @@ -49,7 +49,7 @@ hdd_string_to_bus(char *str, int cdrom) if (! strcmp(str, "mfm")) { if (cdrom) { no_cdrom: - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_4099); + ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2130, (wchar_t *) IDS_4099); return(0); } @@ -93,9 +93,6 @@ no_cdrom: if (! strcmp(str, "scsi")) return(HDD_BUS_SCSI); - if (! strcmp(str, "usb")) - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_4110); - return(0); } diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 10a91e07e..9bb707c6b 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -103,6 +103,7 @@ #define IDS_2127 2127 // "OK" #define IDS_2128 2128 // "Hardware not available" #define IDS_2129 2129 // "Make sure " PCAP " is installed..." +#define IDS_2130 2130 // "Invalid configuration" #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 25543e05a..ce9747a67 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -972,6 +972,7 @@ BEGIN #define PCAP "libpcap" #endif IDS_2129 "Make sure " PCAP " is installed and that you are on a " PCAP "-compatible network connection." + IDS_2130 "Invalid configuration" END STRINGTABLE DISCARDABLE From 56e486b699a632d6dbff6db37e4450033562746c Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 21:31:56 -0300 Subject: [PATCH 11/21] Improve printer library dependency errors --- src/include/86box/language.h | 4 +++- src/printer/prt_escp.c | 4 ++-- src/printer/prt_ps.c | 2 +- src/win/86Box.rc | 22 +++++++++++++++++----- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 9bb707c6b..bdd043eb7 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -102,8 +102,10 @@ #define IDS_2126 2126 // "An emulator of old computers..." #define IDS_2127 2127 // "OK" #define IDS_2128 2128 // "Hardware not available" -#define IDS_2129 2129 // "Make sure " PCAP " is installed..." +#define IDS_2129 2129 // "Make sure " LIB_NAME_PCAP "..." #define IDS_2130 2130 // "Invalid configuration" +#define IDS_2131 2131 // LIB_NAME_FREETYPE " is required..." +#define IDS_2132 2132 // LIB_NAME_GS " is required for... #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" diff --git a/src/printer/prt_escp.c b/src/printer/prt_escp.c index 9cfc2a762..b30d955ef 100644 --- a/src/printer/prt_escp.c +++ b/src/printer/prt_escp.c @@ -2036,7 +2036,7 @@ escp_init(void *lpt) if (ft_handle == NULL) { ft_handle = dynld_module(fn, ft_imports); if (ft_handle == NULL) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2110); + ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2110, (wchar_t *) IDS_2131); return(NULL); } } @@ -2044,7 +2044,7 @@ escp_init(void *lpt) /* Initialize FreeType. */ if (ft_lib == NULL) { if (ft_Init_FreeType(&ft_lib)) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2110); + ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2110, (wchar_t *) IDS_2131); dynld_close(ft_lib); ft_lib = NULL; return(NULL); diff --git a/src/printer/prt_ps.c b/src/printer/prt_ps.c index b822ff17a..b3d7500d4 100644 --- a/src/printer/prt_ps.c +++ b/src/printer/prt_ps.c @@ -352,7 +352,7 @@ ps_init(void *lpt) /* Try loading the DLL. */ ghostscript_handle = dynld_module(PATH_GHOSTSCRIPT_DLL, ghostscript_imports); if (ghostscript_handle == NULL) { - ui_msgbox(MBX_ERROR, (wchar_t *) IDS_2114); + ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2114, (wchar_t *) IDS_2132); } else { if (gsapi_revision(&rev, sizeof(rev)) == 0) { pclog("Loaded %s, rev %ld (%ld)\n", rev.product, rev.revision, rev.revisiondate); diff --git a/src/win/86Box.rc b/src/win/86Box.rc index ce9747a67..4e01a43b1 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -947,11 +947,11 @@ BEGIN IDS_2107 "%u MB (CHS: %i, %i, %i)" IDS_2108 "Floppy %i (%s): %ls" IDS_2109 "All images (*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF)\0*.0??;*.1??;*.??0;*.86F;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.JSON;*.TD0;*.*FD?;*.MFM;*.XDF\0Advanced sector images (*.IMD;*.JSON;*.TD0)\0*.IMD;*.JSON;*.TD0\0Basic sector images (*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?)\0*.0??;*.1??;*.??0;*.BIN;*.CQ?;*.D??;*.FLP;*.HDM;*.IM?;*.XDF;*.*FD?\0Flux images (*.FDI)\0*.FDI\0Surface images (*.86F;*.MFM)\0*.86F;*.MFM\0All files (*.*)\0*.*\0" - IDS_2110 "Unable to initialize FreeType, freetype.dll is required" + IDS_2110 "Unable to initialize FreeType" IDS_2111 "Unable to initialize SDL, SDL2.dll is required" IDS_2112 "Are you sure you want to hard reset the emulated machine?" IDS_2113 "Are you sure you want to quit 86Box?" - IDS_2114 "Unable to initialize Ghostscript, gsdll32.dll is required for automatic convertion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript files (.ps)." + IDS_2114 "Unable to initialize Ghostscript" IDS_2115 "MO %i (%03i): %ls" IDS_2116 "MO images (*.IM?)\0*.IM?\0All files (*.*)\0*.*\0" IDS_2117 "Welcome to 86Box!" @@ -967,12 +967,24 @@ BEGIN IDS_2127 "OK" IDS_2128 "Hardware not available" #ifdef _WIN32 -#define PCAP "WinPcap" +#define LIB_NAME_PCAP "WinPcap" #else -#define PCAP "libpcap" +#define LIB_NAME_PCAP "libpcap" #endif - IDS_2129 "Make sure " PCAP " is installed and that you are on a " PCAP "-compatible network connection." + IDS_2129 "Make sure " LIB_NAME_PCAP " is installed and that you are on a " LIB_NAME_PCAP "-compatible network connection." IDS_2130 "Invalid configuration" +#ifdef _WIN32 +#define LIB_NAME_FREETYPE "freetype.dll" +#else +#define LIB_NAME_FREETYPE "libfreetype" +#endif + IDS_2131 LIB_NAME_FREETYPE " is required for ESC/P printer emulation." +#ifdef _WIN32 +#define LIB_NAME_GS "gsdll32.dll" +#else +#define LIB_NAME_GS "libgs" +#endif + IDS_2132 LIB_NAME_GS " is required for automatic conversion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript (.ps) files." END STRINGTABLE DISCARDABLE From 0a6e3ee1e294209d35cb1ffcf54e5df729b552c6 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 21:35:42 -0300 Subject: [PATCH 12/21] Improve FluidSynth library dependency error --- src/include/86box/language.h | 1 + src/sound/midi_fluidsynth.c | 2 +- src/win/86Box.rc | 8 +++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index bdd043eb7..4b793d75d 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -106,6 +106,7 @@ #define IDS_2130 2130 // "Invalid configuration" #define IDS_2131 2131 // LIB_NAME_FREETYPE " is required..." #define IDS_2132 2132 // LIB_NAME_GS " is required for... +#define IDS_2133 2133 // LIB_NAME_FLUIDSYNTH " is required..." #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 11c4a8b57..20f64b55a 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -230,7 +230,7 @@ void* fluidsynth_init(const device_t *info) #endif if (fluidsynth_handle == NULL) { - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_2080); + ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2080, (wchar_t *) IDS_2133); return NULL; } diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 4e01a43b1..924dcb3e1 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -917,7 +917,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_2080 "Unable to initialize FluidSynth, libfluidsynth.dll is required" + IDS_2080 "Unable to initialize FluidSynth" IDS_2081 "Bus" IDS_2082 "File" IDS_2083 "C" @@ -985,6 +985,12 @@ BEGIN #define LIB_NAME_GS "libgs" #endif IDS_2132 LIB_NAME_GS " is required for automatic conversion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript (.ps) files." +#ifdef _WIN32 +#define LIB_NAME_FLUIDSYNTH "libfluidsynth.dll" +#else +#define LIB_NAME_FLUIDSYNTH "libfluidsynth" +#endif + IDS_2133 LIB_NAME_FLUIDSYNTH " is required for FluidSynth MIDI output." END STRINGTABLE DISCARDABLE From 3539c4f465f873ca6f815eca929d118f2255ddbf Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 21:46:28 -0300 Subject: [PATCH 13/21] Fix and improve fullscreen exit notice (also introducing MBX_DONTASK for "don't show this message again") --- src/config.c | 2 +- src/include/86box/language.h | 4 +++- src/include/86box/ui.h | 1 + src/win/86Box.rc | 4 +++- src/win/win.c | 4 ++-- src/win/win_dialog.c | 8 ++++++-- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/config.c b/src/config.c index 5a089b8b8..d385c7ed2 100644 --- a/src/config.c +++ b/src/config.c @@ -451,7 +451,7 @@ load_general(void) video_fullscreen_scale = config_get_int(cat, "video_fullscreen_scale", 0); - video_fullscreen_first = config_get_int(cat, "video_fullscreen_first", 0); + video_fullscreen_first = config_get_int(cat, "video_fullscreen_first", 1); force_43 = !!config_get_int(cat, "force_43", 0); scale = config_get_int(cat, "scale", 1); diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 4b793d75d..b8509e591 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -25,7 +25,7 @@ #define IDS_2049 2049 // "Error" #define IDS_2050 2050 // "Fatal error" #define IDS_2051 2051 // "Are you sure you want to save..." -#define IDS_2052 2052 // "Use CTRL+ALT+PAGE DOWN.." +#define IDS_2052 2052 // "Press CTRL+ALT+PAGE DOWN..." #define IDS_2053 2053 // "Speed" #define IDS_2054 2054 // "ZIP %i (%03i): %ls" #define IDS_2055 2055 // "ZIP images (*.IM?)\0*.IM..." @@ -107,6 +107,8 @@ #define IDS_2131 2131 // LIB_NAME_FREETYPE " is required..." #define IDS_2132 2132 // LIB_NAME_GS " is required for... #define IDS_2133 2133 // LIB_NAME_FLUIDSYNTH " is required..." +#define IDS_2134 2134 // "Entering fullscreen mode" +#define IDS_2135 2135 // "Don't show this message again" #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" diff --git a/src/include/86box/ui.h b/src/include/86box/ui.h index ab250cb41..f497fb857 100644 --- a/src/include/86box/ui.h +++ b/src/include/86box/ui.h @@ -37,6 +37,7 @@ extern "C" { #define MBX_FATAL 0x20 #define MBX_ANSI 0x80 #define MBX_LINKS 0x100 +#define MBX_DONTASK 0x200 extern int ui_msgbox(int flags, void *message); extern int ui_msgbox_header(int flags, void *header, void *message); diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 924dcb3e1..bdb823786 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -881,7 +881,7 @@ BEGIN IDS_2049 "Error" IDS_2050 "Fatal error" IDS_2051 "Are you sure you want to save the settings?" - IDS_2052 "Use CTRL+ALT+PAGE DOWN to return to windowed mode" + IDS_2052 "Press CTRL+ALT+PAGE DOWN to return to windowed mode." IDS_2053 "Speed" IDS_2054 "ZIP %03i %i (%s): %ls" IDS_2055 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0" @@ -991,6 +991,8 @@ BEGIN #define LIB_NAME_FLUIDSYNTH "libfluidsynth" #endif IDS_2133 LIB_NAME_FLUIDSYNTH " is required for FluidSynth MIDI output." + IDS_2134 "Entering fullscreen mode" + IDS_2135 "Don't show this message again" END STRINGTABLE DISCARDABLE diff --git a/src/win/win.c b/src/win/win.c index 9bdb91a56..c109c9b8b 100644 --- a/src/win/win.c +++ b/src/win/win.c @@ -789,8 +789,8 @@ plat_setfullscreen(int on) if (on && video_fullscreen) return; if (on && video_fullscreen_first) { - video_fullscreen_first = 0; - ui_msgbox(MBX_INFO, (wchar_t *)IDS_2052); + if (ui_msgbox_header(MBX_INFO | MBX_DONTASK, (wchar_t *) IDS_2134, (wchar_t *) IDS_2052) == 10) + video_fullscreen_first = 0; } /* OK, claim the video. */ diff --git a/src/win/win_dialog.c b/src/win/win_dialog.c index 43ef4a779..bc8964f95 100644 --- a/src/win/win_dialog.c +++ b/src/win/win_dialog.c @@ -66,7 +66,7 @@ ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, voi tdb_no = {IDNO, STRING_OR_RESOURCE(btn2)}, tdb_cancel = {IDCANCEL, STRING_OR_RESOURCE(btn3)}, tdb_exit = {IDCLOSE, MAKEINTRESOURCE(IDS_2119)}; - int ret = 0; + int ret = 0, checked = 0; /* Configure the default OK button. */ tdconfig.cButtons = 0; @@ -133,15 +133,19 @@ ui_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, voi if (header) tdconfig.pszMainInstruction = STRING_OR_RESOURCE(header); tdconfig.pButtons = tdbuttons; + if (flags & MBX_DONTASK) + tdconfig.pszVerificationText = MAKEINTRESOURCE(IDS_2135); /* Run the TaskDialog. */ - TaskDialogIndirect(&tdconfig, &ret, NULL, NULL); + TaskDialogIndirect(&tdconfig, &ret, NULL, &checked); /* Convert return values to generic ones. */ if (ret == IDNO) ret = 1; else if (ret == IDCANCEL) ret = -1; else ret = 0; + if (checked) ret += 10; + return(ret); } From 9733beb54242d1ee42c6f81ba7c4aeb93a86da42 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Jun 2020 00:16:05 -0300 Subject: [PATCH 14/21] Improve settings messageboxes --- src/include/86box/language.h | 14 +++++++---- src/win/86Box.rc | 22 ++++++++++------- src/win/win_media_menu.c | 2 +- src/win/win_settings.c | 46 +++++++++++++++--------------------- 4 files changed, 44 insertions(+), 40 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index b8509e591..9bb1d2534 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -118,16 +118,22 @@ #define IDS_4101 4101 // "Custom (large)..." #define IDS_4102 4102 // "Add New Hard Disk" #define IDS_4103 4103 // "Add Existing Hard Disk" -#define IDS_4104 4104 // "Attempting to create a HDI ima.." -#define IDS_4105 4105 // "Attempting to create a spurio.." +#define IDS_4104 4104 // "HDI disk images cannot be..." +#define IDS_4105 4105 // "Disk images cannot be larger..." #define IDS_4106 4106 // "Hard disk images (*.HDI;*.HD.." #define IDS_4107 4107 // "Unable to open the file for read" #define IDS_4108 4108 // "Unable to open the file for write" #define IDS_4109 4109 // "HDI or HDX image with a sect.." #define IDS_4110 4110 // "USB is not yet supported" -#define IDS_4111 4111 // "This image exists and will be.." -#define IDS_4112 4112 // "Please enter a valid file name" +#define IDS_4111 4111 // "Disk image file already exists" +#define IDS_4112 4112 // "Please specify a valid file name." #define IDS_4113 4113 // "Remember to partition and fo.." +#define IDS_4114 4114 // "Make sure the file exists and..." +#define IDS_4115 4115 // "Make sure the file is being..." +#define IDS_4116 4116 // "Disk image too large" +#define IDS_4117 4117 // "Remember to partition and format..." +#define IDS_4118 4118 // "The selected file will be..." +#define IDS_4119 4119 // "Unsupported disk image" #define IDS_4352 4352 // "MFM/RLL" #define IDS_4353 4353 // "XT IDE" diff --git a/src/win/86Box.rc b/src/win/86Box.rc index bdb823786..b29b08b50 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -1005,16 +1005,22 @@ BEGIN IDS_4101 "Custom (large)..." IDS_4102 "Add New Hard Disk" IDS_4103 "Add Existing Hard Disk" - IDS_4104 "Attempting to create a HDI image larger than 4 GB" - IDS_4105 "Attempting to create a hard disk image beyond the 28-bit LBA limit" + IDS_4104 "HDI disk images cannot be larger than 4 GB." + IDS_4105 "Disk images cannot be larger than 127 GB." IDS_4106 "Hard disk images (*.HD?;*.IM?;*.VHD)\0*.HD?;*.IM?;*.VHD\0All files (*.*)\0*.*\0" - IDS_4107 "Unable to open the file for read" - IDS_4108 "Unable to open the file for write" - IDS_4109 "HDI or HDX images with a sector size that is not 512 are not supported" + IDS_4107 "Unable to read file" + IDS_4108 "Unable to write file" + IDS_4109 "HDI or HDX images with a sector size other than 512 are not supported." IDS_4110 "USB is not yet supported" - IDS_4111 "This image exists and will be overwritten.\nAre you sure you want to use it?" - IDS_4112 "Please enter a valid file name" - IDS_4113 "The image has been successfully created." + IDS_4111 "Disk image file already exists" + IDS_4112 "Please specify a valid file name." + IDS_4113 "Disk image created" + IDS_4114 "Make sure the file exists and is readable." + IDS_4115 "Make sure the file is being saved to a writable directory." + IDS_4116 "Disk image too large" + IDS_4117 "Remember to partition and format the newly-created drive." + IDS_4118 "The selected file will be overwritten. Are you sure you want to use it?" + IDS_4119 "Unsupported disk image" IDS_4352 "MFM/RLL" IDS_4353 "XTA" diff --git a/src/win/win_media_menu.c b/src/win/win_media_menu.c index fe3d6153d..6340d36b4 100644 --- a/src/win/win_media_menu.c +++ b/src/win/win_media_menu.c @@ -429,7 +429,7 @@ media_menu_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) plat_pause(1); ret = d86f_export(id, wopenfilestring); if (!ret) - ui_msgbox(MBX_ERROR, (wchar_t *)IDS_4108); + ui_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4108, (wchar_t *) IDS_4115); plat_pause(0); } break; diff --git a/src/win/win_settings.c b/src/win/win_settings.c index c537fb529..0f4a1f548 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -178,7 +178,7 @@ image_list_init(HWND hwndList, const uint8_t *icon_ids) /* Show a MessageBox dialog. This is nasty, I know. --FvK */ static int -settings_msgbox(int type, void *arg) +settings_msgbox_header(int flags, void *header, void *message) { HWND h; int i; @@ -186,7 +186,7 @@ settings_msgbox(int type, void *arg) h = hwndMain; hwndMain = hwndParentDialog; - i = ui_msgbox(type, arg); + i = ui_msgbox_header(flags, header, message); hwndMain = h; @@ -396,31 +396,23 @@ static int settings_msgbox_reset(void) { int changed, i = 0; - TASKDIALOGCONFIG tdconfig = {0}; - TASKDIALOG_BUTTON tdbuttons[] = { - {IDYES, MAKEINTRESOURCE(IDS_2121)}, - {IDNO, MAKEINTRESOURCE(IDS_2122)}, - {IDCANCEL, MAKEINTRESOURCE(IDS_2123)} - }; + HWND h; changed = win_settings_changed(); if (changed) { - tdconfig.cbSize = sizeof(tdconfig); - tdconfig.hwndParent = hwndParentDialog; - tdconfig.dwFlags = TDF_USE_COMMAND_LINKS; - tdconfig.dwCommonButtons = 0; - tdconfig.pszWindowTitle = MAKEINTRESOURCE(IDS_STRINGS); - tdconfig.pszMainInstruction = MAKEINTRESOURCE(IDS_2051); - tdconfig.cButtons = ARRAYSIZE(tdbuttons); - tdconfig.pButtons = tdbuttons; - TaskDialogIndirect(&tdconfig, &i, NULL, NULL); + h = hwndMain; + hwndMain = hwndParentDialog; - if (i == IDNO) return(1); /* no */ + i = ui_msgbox_ex(MBX_QUESTION | MBX_LINKS, (wchar_t *) IDS_2051, NULL, (wchar_t *) IDS_2121, (wchar_t *) IDS_2122, (wchar_t *) IDS_2123); - if (i == IDYES) return(2); /* yes */ + hwndMain = h; - return(0); /* cancel */ + if (i == 1) return(1); /* no */ + + if (i == -1) return(0); /* cancel */ + + return(2); /* yes */ } else return(1); } @@ -2876,7 +2868,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM /* Make sure no file name is allowed with removable SCSI hard disks. */ if (wcslen(hd_file_name) == 0) { hdd_ptr->bus = HDD_BUS_DISABLED; - settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4112); + settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_2130, (wchar_t *) IDS_4112); return TRUE; } @@ -2920,14 +2912,14 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM if (size > 0x1FFFFFFE00ll) { fclose(f); - settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4105); + settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4116, (wchar_t *) IDS_4105); return TRUE; } if (image_is_hdi(hd_file_name)) { if (size >= 0x100000000ll) { fclose(f); - settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4104); + settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4116, (wchar_t *) IDS_4104); return TRUE; } @@ -3022,7 +3014,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM free(big_buf); fclose(f); - settings_msgbox(MBX_INFO, (wchar_t *)IDS_4113); + settings_msgbox_header(MBX_INFO, (wchar_t *) IDS_4113, (wchar_t *) IDS_4117); } hard_disk_added = 1; @@ -3051,7 +3043,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM f = _wfopen(wopenfilestring, L"rb"); if (f != NULL) { fclose(f); - if (settings_msgbox(MBX_QUESTION, (wchar_t *)IDS_4111) != 0) /* yes */ + if (settings_msgbox_header(MBX_QUESTION, (wchar_t *) IDS_4111, (wchar_t *) IDS_4118) != 0) /* yes */ return FALSE; } } @@ -3060,7 +3052,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM if (f == NULL) { hdd_add_file_open_error: fclose(f); - settings_msgbox(MBX_ERROR, (existing & 1) ? (wchar_t *)IDS_4107 : (wchar_t *)IDS_4108); + settings_msgbox_header(MBX_ERROR, (existing & 1) ? (wchar_t *) IDS_4114 : (wchar_t *) IDS_4115, (existing & 1) ? (wchar_t *) IDS_4107 : (wchar_t *) IDS_4108); return TRUE; } if (existing & 1) { @@ -3068,7 +3060,7 @@ hdd_add_file_open_error: fseeko64(f, 0x10, SEEK_SET); fread(§or_size, 1, 4, f); if (sector_size != 512) { - settings_msgbox(MBX_ERROR, (wchar_t *)IDS_4109); + settings_msgbox_header(MBX_ERROR, (wchar_t *) IDS_4119, (wchar_t *) IDS_4109); fclose(f); return TRUE; } From f73cbb79b6e88a1baa5c47fb591e79a6718e5a62 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Jun 2020 00:18:28 -0300 Subject: [PATCH 15/21] Improve new_floppy messageboxes --- src/win/win_new_floppy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/win/win_new_floppy.c b/src/win/win_new_floppy.c index 78c51b497..35efa6379 100644 --- a/src/win/win_new_floppy.c +++ b/src/win/win_new_floppy.c @@ -515,7 +515,7 @@ static wchar_t fd_file_name[1024]; /* Show a MessageBox dialog. This is nasty, I know. --FvK */ static int -new_floppy_msgbox(HWND hwnd, int type, void *arg) +new_floppy_msgbox_header(HWND hwnd, int flags, void *header, void *message) { HWND h; int i; @@ -523,7 +523,7 @@ new_floppy_msgbox(HWND hwnd, int type, void *arg) h = hwndMain; hwndMain = hwnd; - i = ui_msgbox(type, arg); + i = ui_msgbox_header(flags, header, message); hwndMain = h; @@ -607,7 +607,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) //ui_sb_mount_floppy_img(fdd_id, sb_part, 0, fd_file_name); floppy_mount(fdd_id, fd_file_name, 0); } else { - new_floppy_msgbox(hdlg, MBX_ERROR, (wchar_t *)IDS_4108); + new_floppy_msgbox_header(hdlg, MBX_ERROR, (wchar_t *) IDS_4108, (wchar_t *) IDS_4115); return TRUE; } /*FALLTHROUGH*/ @@ -637,7 +637,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) f = _wfopen(wopenfilestring, L"rb"); if (f != NULL) { fclose(f); - if (new_floppy_msgbox(hdlg, MBX_QUESTION, (wchar_t *)IDS_4111) != 0) /* yes */ + if (new_floppy_msgbox_header(hdlg, MBX_QUESTION, (wchar_t *) IDS_4111, (wchar_t *) IDS_4118) != 0) /* yes */ return FALSE; } SendMessage(h, WM_SETTEXT, 0, (LPARAM) wopenfilestring); From 09083aa98ab0abeb73d345b1dac367dffd9b0d2d Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Jun 2020 00:21:40 -0300 Subject: [PATCH 16/21] Add custom buttons to overwrite confirmation questions --- src/include/86box/language.h | 2 ++ src/win/86Box.rc | 2 ++ src/win/win_new_floppy.c | 19 ++++++++++++++++++- src/win/win_settings.c | 19 ++++++++++++++++++- 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 9bb1d2534..002a0cc33 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -134,6 +134,8 @@ #define IDS_4117 4117 // "Remember to partition and format..." #define IDS_4118 4118 // "The selected file will be..." #define IDS_4119 4119 // "Unsupported disk image" +#define IDS_4120 4120 // "Overwrite" +#define IDS_4121 4121 // "Cancel" #define IDS_4352 4352 // "MFM/RLL" #define IDS_4353 4353 // "XT IDE" diff --git a/src/win/86Box.rc b/src/win/86Box.rc index b29b08b50..c5dbfde49 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -1021,6 +1021,8 @@ BEGIN IDS_4117 "Remember to partition and format the newly-created drive." IDS_4118 "The selected file will be overwritten. Are you sure you want to use it?" IDS_4119 "Unsupported disk image" + IDS_4120 "Overwrite" + IDS_4121 "Cancel" IDS_4352 "MFM/RLL" IDS_4353 "XTA" diff --git a/src/win/win_new_floppy.c b/src/win/win_new_floppy.c index 35efa6379..33c83299f 100644 --- a/src/win/win_new_floppy.c +++ b/src/win/win_new_floppy.c @@ -531,6 +531,23 @@ new_floppy_msgbox_header(HWND hwnd, int flags, void *header, void *message) } +static int +new_floppy_msgbox_ex(HWND hwnd, int flags, void *header, void *message, void *btn1, void *btn2, void *btn3) +{ + HWND h; + int i; + + h = hwndMain; + hwndMain = hwnd; + + i = ui_msgbox_ex(flags, header, message, btn1, btn2, btn3); + + hwndMain = h; + + return(i); +} + + #if defined(__amd64__) || defined(__aarch64__) static LRESULT CALLBACK #else @@ -637,7 +654,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) f = _wfopen(wopenfilestring, L"rb"); if (f != NULL) { fclose(f); - if (new_floppy_msgbox_header(hdlg, MBX_QUESTION, (wchar_t *) IDS_4111, (wchar_t *) IDS_4118) != 0) /* yes */ + if (new_floppy_msgbox_ex(hdlg, MBX_QUESTION, (wchar_t *) IDS_4111, (wchar_t *) IDS_4118, (wchar_t *) IDS_4120, (wchar_t *) IDS_4121, NULL) != 0) /* yes */ return FALSE; } SendMessage(h, WM_SETTEXT, 0, (LPARAM) wopenfilestring); diff --git a/src/win/win_settings.c b/src/win/win_settings.c index 0f4a1f548..a908ef64d 100644 --- a/src/win/win_settings.c +++ b/src/win/win_settings.c @@ -194,6 +194,23 @@ settings_msgbox_header(int flags, void *header, void *message) } +static int +settings_msgbox_ex(int flags, void *header, void *message, void *btn1, void *btn2, void *btn3) +{ + HWND h; + int i; + + h = hwndMain; + hwndMain = hwndParentDialog; + + i = ui_msgbox_ex(flags, header, message, btn1, btn2, btn3); + + hwndMain = h; + + return(i); +} + + /* This does the initial read of global variables into the temporary ones. */ static void win_settings_init(void) @@ -3043,7 +3060,7 @@ win_settings_hard_disks_add_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM f = _wfopen(wopenfilestring, L"rb"); if (f != NULL) { fclose(f); - if (settings_msgbox_header(MBX_QUESTION, (wchar_t *) IDS_4111, (wchar_t *) IDS_4118) != 0) /* yes */ + if (settings_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_4111, (wchar_t *) IDS_4118, (wchar_t *) IDS_4120, (wchar_t *) IDS_4121, NULL) != 0) /* yes */ return FALSE; } } From a44c2c2fe1ba5acd17544d59ce61f1092ba167a8 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Jun 2020 00:26:13 -0300 Subject: [PATCH 17/21] Improve reset and exit confirmations --- src/include/86box/language.h | 5 ++++- src/win/86Box.rc | 7 +++++-- src/win/win_ui.c | 10 +++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/include/86box/language.h b/src/include/86box/language.h index 002a0cc33..0e603e92f 100644 --- a/src/include/86box/language.h +++ b/src/include/86box/language.h @@ -109,6 +109,9 @@ #define IDS_2133 2133 // LIB_NAME_FLUIDSYNTH " is required..." #define IDS_2134 2134 // "Entering fullscreen mode" #define IDS_2135 2135 // "Don't show this message again" +#define IDS_2136 2136 // "Don't Exit" +#define IDS_2137 2137 // "Reset" +#define IDS_2138 2138 // "Don't Reset" #define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4097 4097 // "%01i:%01i" @@ -135,7 +138,7 @@ #define IDS_4118 4118 // "The selected file will be..." #define IDS_4119 4119 // "Unsupported disk image" #define IDS_4120 4120 // "Overwrite" -#define IDS_4121 4121 // "Cancel" +#define IDS_4121 4121 // "Don't Overwrite" #define IDS_4352 4352 // "MFM/RLL" #define IDS_4353 4353 // "XT IDE" diff --git a/src/win/86Box.rc b/src/win/86Box.rc index c5dbfde49..8af0a4e19 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -950,7 +950,7 @@ BEGIN IDS_2110 "Unable to initialize FreeType" IDS_2111 "Unable to initialize SDL, SDL2.dll is required" IDS_2112 "Are you sure you want to hard reset the emulated machine?" - IDS_2113 "Are you sure you want to quit 86Box?" + IDS_2113 "Are you sure you want to exit " EMU_NAME "?" IDS_2114 "Unable to initialize Ghostscript" IDS_2115 "MO %i (%03i): %ls" IDS_2116 "MO images (*.IM?)\0*.IM?\0All files (*.*)\0*.*\0" @@ -993,6 +993,9 @@ BEGIN IDS_2133 LIB_NAME_FLUIDSYNTH " is required for FluidSynth MIDI output." IDS_2134 "Entering fullscreen mode" IDS_2135 "Don't show this message again" + IDS_2136 "Don't Exit" + IDS_2137 "Reset" + IDS_2138 "Don't Reset" END STRINGTABLE DISCARDABLE @@ -1022,7 +1025,7 @@ BEGIN IDS_4118 "The selected file will be overwritten. Are you sure you want to use it?" IDS_4119 "Unsupported disk image" IDS_4120 "Overwrite" - IDS_4121 "Cancel" + IDS_4121 "Don't Overwrite" IDS_4352 "MFM/RLL" IDS_4353 "XTA" diff --git a/src/win/win_ui.c b/src/win/win_ui.c index d47e4da0f..b2f01e215 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -312,7 +312,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_ACTION_HRESET: win_notify_dlg_open(); - i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2112); + i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL); if (i == 0) pc_reset_hard(); win_notify_dlg_closed(); @@ -327,7 +327,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (no_quit_confirm) i = 0; else - i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2113); + i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL); if (i == 0) { UnhookWindowsHookEx(hKeyboardHook); KillTimer(hwnd, TIMER_1SEC); @@ -695,7 +695,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (no_quit_confirm) i = 0; else - i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2113); + i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL); if (i == 0) { UnhookWindowsHookEx(hKeyboardHook); KillTimer(hwnd, TIMER_1SEC); @@ -731,7 +731,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (manager_wm) break; win_notify_dlg_open(); - i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2112); + i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2112, NULL, (wchar_t *) IDS_2137, (wchar_t *) IDS_2138, NULL); if (i == 0) pc_reset_hard(); win_notify_dlg_closed(); @@ -744,7 +744,7 @@ MainWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (no_quit_confirm) i = 0; else - i = ui_msgbox(MBX_QUESTION_YN, (wchar_t *)IDS_2113); + i = ui_msgbox_ex(MBX_QUESTION_YN, (wchar_t *) IDS_2113, NULL, (wchar_t *) IDS_2119, (wchar_t *) IDS_2136, NULL); if (i == 0) { UnhookWindowsHookEx(hKeyboardHook); KillTimer(hwnd, TIMER_1SEC); From 07ec8cd78c83bfcc9bf8200165401323544b7178 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Jun 2020 00:27:15 -0300 Subject: [PATCH 18/21] Move more stuff in the .rc file to EMU_NAME --- src/win/86Box.rc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 8af0a4e19..c33419226 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -163,7 +163,7 @@ BEGIN #endif POPUP "&Help" BEGIN - MENUITEM "&About 86Box...", IDM_ABOUT + MENUITEM "&About " EMU_NAME "...", IDM_ABOUT END END @@ -318,7 +318,7 @@ END DLG_CONFIG DIALOG DISCARDABLE 0, 0, 366, 251 STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "86Box Settings" +CAPTION EMU_NAME " Settings" FONT 9, "Segoe UI" BEGIN DEFPUSHBUTTON "OK",IDOK,246,230,50,14 @@ -877,7 +877,7 @@ END STRINGTABLE DISCARDABLE BEGIN - 2048 "86Box" + 2048 EMU_NAME IDS_2049 "Error" IDS_2050 "Fatal error" IDS_2051 "Are you sure you want to save the settings?" @@ -885,7 +885,7 @@ BEGIN IDS_2053 "Speed" IDS_2054 "ZIP %03i %i (%s): %ls" IDS_2055 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0" - IDS_2056 "86Box could not find any usable ROM images.\n\nPlease download a ROM set from https://github.com/86Box/roms/releases/latest and extract it into the ""roms"" directory." + IDS_2056 EMU_NAME " could not find any usable ROM images.\n\nPlease download a ROM set from https://github.com/86Box/roms/releases/latest and extract it into the ""roms"" directory." IDS_2057 "(empty)" IDS_2058 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0All files (*.*)\0*.*\0" IDS_2059 "Turbo" @@ -954,7 +954,7 @@ BEGIN IDS_2114 "Unable to initialize Ghostscript" IDS_2115 "MO %i (%03i): %ls" IDS_2116 "MO images (*.IM?)\0*.IM?\0All files (*.*)\0*.*\0" - IDS_2117 "Welcome to 86Box!" + IDS_2117 "Welcome to " EMU_NAME "!" IDS_2118 "Internal controller" IDS_2119 "Exit" IDS_2120 "No ROMs found" From 666f02dc23ff45a6e35dca2e48c522af89ec1ede Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Jun 2020 00:29:37 -0300 Subject: [PATCH 19/21] Move romset URL to 86box.h --- src/include/86box/86box.h | 3 +++ src/win/86Box.rc | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 9f1fe7c92..9fd301138 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -42,6 +42,9 @@ #endif #define COPYRIGHT_YEAR "2020" +/* Web URL info. */ +#define EMU_ROMS_URL "https://github.com/86Box/roms/releases/latest" + /* Filename and pathname info. */ #define CONFIG_FILE L"86box.cfg" #define NVR_PATH L"nvr" diff --git a/src/win/86Box.rc b/src/win/86Box.rc index c33419226..c62f6a93b 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -885,7 +885,7 @@ BEGIN IDS_2053 "Speed" IDS_2054 "ZIP %03i %i (%s): %ls" IDS_2055 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0" - IDS_2056 EMU_NAME " could not find any usable ROM images.\n\nPlease download a ROM set from https://github.com/86Box/roms/releases/latest and extract it into the ""roms"" directory." + IDS_2056 EMU_NAME " could not find any usable ROM images.\n\nPlease download a ROM set from " EMU_ROMS_URL " and extract it into the ""roms"" directory." IDS_2057 "(empty)" IDS_2058 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0All files (*.*)\0*.*\0" IDS_2059 "Turbo" From 9f5956d456d41c7a925c78eedf182c7ad4b61c18 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Jun 2020 00:34:56 -0300 Subject: [PATCH 20/21] Add website to about dialog --- src/include/86box/86box.h | 3 ++- src/win/win_about.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 9fd301138..bbb37895e 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -43,7 +43,8 @@ #define COPYRIGHT_YEAR "2020" /* Web URL info. */ -#define EMU_ROMS_URL "https://github.com/86Box/roms/releases/latest" +#define EMU_SITE L"86box.github.io" +#define EMU_ROMS_URL L"https://github.com/86Box/roms/releases/latest" /* Filename and pathname info. */ #define CONFIG_FILE L"86box.cfg" diff --git a/src/win/win_about.c b/src/win/win_about.c index bc4beda7d..b09efa478 100644 --- a/src/win/win_about.c +++ b/src/win/win_about.c @@ -35,8 +35,12 @@ void AboutDialogCreate(HWND hwnd) { + int i; TASKDIALOGCONFIG tdconfig = {0}; - TASKDIALOG_BUTTON tdbuttons[] = {{IDCANCEL, MAKEINTRESOURCE(IDS_2127)}}; + TASKDIALOG_BUTTON tdbuttons[] = { + {IDOK, EMU_SITE}, + {IDCANCEL, MAKEINTRESOURCE(IDS_2127)} + }; tdconfig.cbSize = sizeof(tdconfig); tdconfig.hwndParent = hwnd; @@ -48,5 +52,9 @@ AboutDialogCreate(HWND hwnd) tdconfig.pszContent = MAKEINTRESOURCE(IDS_2126); tdconfig.cButtons = ARRAYSIZE(tdbuttons); tdconfig.pButtons = tdbuttons; - TaskDialogIndirect(&tdconfig, NULL, NULL, NULL); + tdconfig.nDefaultButton = IDCANCEL; + TaskDialogIndirect(&tdconfig, &i, NULL, NULL); + + if (i == IDOK) + ShellExecute(hwnd, L"open", L"https://" EMU_SITE, NULL, NULL, SW_SHOW); } From 5bda6c628a96915a0f3cc20d95bb7423388b8e10 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Jun 2020 00:37:07 -0300 Subject: [PATCH 21/21] Fix redundant FDC name --- src/win/86Box.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 88ab9c1e4..6ceab5ab7 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -503,7 +503,7 @@ BEGIN WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Configure",IDC_CONFIGURE_HDC,222,25,38,12 - LTEXT "FDC Controller:",IDT_1768,7,44,48,10 + LTEXT "FD Controller:",IDT_1768,7,44,48,10 COMBOBOX IDC_COMBO_FDC,64,43,155,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Configure",IDC_CONFIGURE_FDC,222,43,38,12