mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 05:05:19 -05:00
impr: Various web build improvements, API cleanup (#1541)
This commit is contained in:
46
main/gui/source/init/run/native.cpp
Normal file
46
main/gui/source/init/run/native.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#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
|
||||
Reference in New Issue
Block a user