mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-07-01 16:53:28 +00:00
CMain: Show message on fatal aurora log
This commit is contained in:
parent
ae0f62c021
commit
976aebef24
@ -32,6 +32,7 @@
|
|||||||
#include <aurora/event.h>
|
#include <aurora/event.h>
|
||||||
#include <aurora/main.h>
|
#include <aurora/main.h>
|
||||||
#include <dolphin/vi.h>
|
#include <dolphin/vi.h>
|
||||||
|
#include <SDL_messagebox.h>
|
||||||
|
|
||||||
using namespace std::literals;
|
using namespace std::literals;
|
||||||
|
|
||||||
@ -451,6 +452,7 @@ static bool IsClientLoggingEnabled(int argc, char** argv) {
|
|||||||
static void SetupLogging() {}
|
static void SetupLogging() {}
|
||||||
|
|
||||||
static std::unique_ptr<metaforce::Application> g_app;
|
static std::unique_ptr<metaforce::Application> g_app;
|
||||||
|
static SDL_Window* g_window;
|
||||||
static bool g_paused;
|
static bool g_paused;
|
||||||
|
|
||||||
static void aurora_log_callback(AuroraLogLevel level, const char* message, unsigned int len) {
|
static void aurora_log_callback(AuroraLogLevel level, const char* message, unsigned int len) {
|
||||||
@ -469,6 +471,10 @@ static void aurora_log_callback(AuroraLogLevel level, const char* message, unsig
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (level == LOG_FATAL) {
|
||||||
|
auto msg = fmt::format(FMT_STRING("Metaforce encountered an internal error:\n\n{}"), message);
|
||||||
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Metaforce", msg.c_str(), g_window);
|
||||||
|
}
|
||||||
metaforce::Log.report(severity, FMT_STRING("{}"), message);
|
metaforce::Log.report(severity, FMT_STRING("{}"), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,6 +550,7 @@ int main(int argc, char** argv) {
|
|||||||
.imGuiInitCallback = aurora_imgui_init_callback,
|
.imGuiInitCallback = aurora_imgui_init_callback,
|
||||||
};
|
};
|
||||||
const auto info = aurora_initialize(argc, argv, &config);
|
const auto info = aurora_initialize(argc, argv, &config);
|
||||||
|
g_window = info.window;
|
||||||
g_app->onImGuiAddTextures();
|
g_app->onImGuiAddTextures();
|
||||||
g_app->onAppLaunched(info);
|
g_app->onAppLaunched(info);
|
||||||
g_app->onAppWindowResized(info.windowSize);
|
g_app->onAppWindowResized(info.windowSize);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user