1
0
mirror of synced 2025-01-11 22:02:17 +01:00
ImHex/main/gui/source/init/run/native.cpp

45 lines
1.1 KiB
C++
Raw Normal View History

#if !defined(OS_WEB)
#include <hex/api/event_manager.hpp>
#include <wolv/utils/guards.hpp>
#include <init/run.hpp>
#include <window.hpp>
namespace hex::init {
int runImHex() {
bool shouldRestart = false;
do {
// Register an event handler that will make ImHex restart when requested
shouldRestart = false;
RequestRestartImHex::subscribe([&] {
shouldRestart = true;
});
{
auto splashWindow = initializeImHex();
// Draw the splash window while tasks are running
if (!splashWindow->loop())
ImHexApi::System::impl::addInitArgument("tasks-failed");
handleFileOpenRequest();
}
// Main window
2024-12-15 21:44:36 +01:00
{
Window window;
window.loop();
}
deinitializeImHex();
} while (shouldRestart);
return EXIT_SUCCESS;
}
}
#endif