From 6eb7314c5b992e91f50697722e101373dffaaf7c Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 18 Jun 2020 21:05:53 -0300 Subject: [PATCH] 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];