1
0
mirror of synced 2024-12-25 05:54:50 +01:00
ImHex/main/gui/source/init/run/native.cpp

46 lines
1.2 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();
}
// Clean up everything after the main window is closed
ON_SCOPE_EXIT {
deinitializeImHex();
};
// Main window
Window window;
window.loop();
} while (shouldRestart);
return EXIT_SUCCESS;
}
}
#endif