diff --git a/src/unix/unix.c b/src/unix/unix.c index d15572dcd..8db22f39a 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -563,22 +563,48 @@ do_stop(void) int ui_msgbox(int flags, void *message) { - return ui_msgbox_header(flags, message, NULL); + return ui_msgbox_header(flags, NULL, message); } -int ui_msgbox_header(int flags, void *message, void* header) +int ui_msgbox_header(int flags, void *header, void* message) { - if (!header) header = L"86Box"; + SDL_MessageBoxData msgdata; + SDL_MessageBoxButtonData msgbtn; + if (!header) header = (flags & MBX_ANSI) ? "86Box" : L"86Box"; + if (header <= (void*)7168) header = plat_get_string(header); + if (message <= (void*)7168) message = plat_get_string(message); + msgbtn.buttonid = 1; + msgbtn.text = "OK"; + msgbtn.flags = 0; + memset(&msgdata, 0, sizeof(SDL_MessageBoxData)); + msgdata.numbuttons = 1; + msgdata.buttons = &msgbtn; + int msgflags = 0; + if (msgflags & MBX_FATAL) msgflags |= SDL_MESSAGEBOX_ERROR; + else if (msgflags & MBX_ERROR || msgflags & MBX_WARNING) msgflags |= SDL_MESSAGEBOX_WARNING; + else msgflags |= SDL_MESSAGEBOX_INFORMATION; + msgdata.flags = msgflags; if (flags & MBX_ANSI) { - fwprintf(stderr, L"%s\n", header); - fprintf(stderr, "==========================\n" - "%s\n", message); - return 0; + int button = 0; + msgdata.title = header; + msgdata.message = message; + SDL_ShowMessageBox(&msgdata, &button); + return button; } - fwprintf(stderr, L"%s\n", header); - fwprintf(stderr, L"==========================\n" - L"%s\n", plat_get_string(message)); + else + { + int button = 0; + char *res = SDL_iconv_string("UTF-8", sizeof(wchar_t) == 2 ? "UTF-16LE" : "UTF-32LE", (char *)message, wcslen(message) * sizeof(wchar_t) + sizeof(wchar_t)); + char *res2 = SDL_iconv_string("UTF-8", sizeof(wchar_t) == 2 ? "UTF-16LE" : "UTF-32LE", (char *)header, wcslen(header) * sizeof(wchar_t) + sizeof(wchar_t)); + msgdata.message = res; + msgdata.title = res2; + SDL_ShowMessageBox(&msgdata, &button); + free(res); + free(res2); + return button; + } + return 0; } @@ -973,7 +999,7 @@ int main(int argc, char** argv) SDL_Init(0); pc_init(argc, argv); if (! pc_init_modules()) { - fprintf(stderr, "No ROMs found.\n"); + ui_msgbox_header(MBX_FATAL, L"No ROMs found.", L"86Box could not find any usable ROM images.\n\nPlease download a ROM set and extract it into the \"roms\" directory."); SDL_Quit(); return 6; } diff --git a/src/win/86Box.rc b/src/win/86Box.rc index 9f98c9350..05990324f 100644 --- a/src/win/86Box.rc +++ b/src/win/86Box.rc @@ -825,12 +825,19 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. +// defining the icons depending on the build status #ifdef RELEASE_BUILD -/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC_256x256.png */ - 10 ICON DISCARDABLE ICON_PATH "icons/86Box-RB.ico" +/* Icon by OBattler and laciba96 (green for release builds)*/ + 10 ICON DISCARDABLE ICON_PATH "icons/86Box-green.ico" +#elif BETA_BUILD +/* Icon by OBattler and laciba96 (yellow for beta builds done by Jenkins)*/ + 10 ICON DISCARDABLE ICON_PATH "icons/86Box-yellow.ico" +#elif ALPHA_BUILD +/* Icon by OBattler and laciba96 (red for alpha builds done by Jenkins)*/ + 10 ICON DISCARDABLE ICON_PATH "icons/86Box-red.ico" #else -/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC2_256x256.png */ - 10 ICON DISCARDABLE ICON_PATH "icons/86Box.ico" +/* Icon by OBattler and laciba96 (gray for builds of branches and from the git master)*/ + 10 ICON DISCARDABLE ICON_PATH "icons/86Box-gray.ico" #endif 16 ICON DISCARDABLE ICON_PATH "icons/floppy_525.ico" 17 ICON DISCARDABLE ICON_PATH "icons/floppy_525_active.ico" diff --git a/src/win/icons/86Box-gray.ico b/src/win/icons/86Box-gray.ico new file mode 100644 index 000000000..c9cbad17d Binary files /dev/null and b/src/win/icons/86Box-gray.ico differ diff --git a/src/win/icons/86Box-green.ico b/src/win/icons/86Box-green.ico new file mode 100644 index 000000000..5c783674d Binary files /dev/null and b/src/win/icons/86Box-green.ico differ diff --git a/src/win/icons/86Box-red.ico b/src/win/icons/86Box-red.ico new file mode 100644 index 000000000..6b4666c43 Binary files /dev/null and b/src/win/icons/86Box-red.ico differ diff --git a/src/win/icons/86Box-yellow.ico b/src/win/icons/86Box-yellow.ico new file mode 100644 index 000000000..c3822c89b Binary files /dev/null and b/src/win/icons/86Box-yellow.ico differ