mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-02 06:40:42 -07:00
logger: show message popup for log_fatal (#412)
## Link to GitHub Issue, if one exists #410 ## Description of change When raising fatal errors via `log_fatal`, also show a modal popup. Update instances of `log_fatal` where the message was too long to fit. ## Testing Tested various failure conditions.
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
#include <atomic>
|
||||
|
||||
#include "build/defs.h"
|
||||
#include "hooks/graphics/graphics.h"
|
||||
#include "deferlog.h"
|
||||
#include "util/logging.h"
|
||||
|
||||
@@ -73,32 +72,4 @@ namespace deferredlogs {
|
||||
log_warning("troubleshooter", "{}", msg);
|
||||
});
|
||||
}
|
||||
|
||||
void show_popup_for_crash() {
|
||||
static std::once_flag shown;
|
||||
std::call_once(shown, []() {
|
||||
|
||||
// minimize all windows
|
||||
// only needed because in multi-monitor full screen games, MessageBox fails to show above the game
|
||||
for (auto &hwnd : GRAPHICS_WINDOWS) {
|
||||
ShowWindow(hwnd, SW_FORCEMINIMIZE);
|
||||
}
|
||||
|
||||
const std::string title = "spice2x (" + to_string(VERSION_STRING_CFG) + ") - crash handler";
|
||||
std::string text;
|
||||
text += "Game has crashed.\n\n";
|
||||
text += "Check log.txt and look for error messages near the end of file.\n\n";
|
||||
text += "Unsure what to do next?\n";
|
||||
text += " * update spice2x to the latest version\n";
|
||||
text += " * check the FAQ on spice2x wiki on github\n";
|
||||
text += " * do NOT screenshot this, instead, share log.txt with someone and ask for help\n\n";
|
||||
text += "Press Enter, Esc, Alt+F4, or click OK to exit. Otherwise, game will close in 30 seconds.";
|
||||
|
||||
MessageBox(
|
||||
nullptr,
|
||||
text.c_str(),
|
||||
title.c_str(),
|
||||
MB_OK | MB_ICONERROR | MB_TASKMODAL | MB_SETFOREGROUND | MB_TOPMOST);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user