impr: Added comments everywhere in main application

This commit is contained in:
WerWolv
2023-02-17 12:03:53 +01:00
parent 279e085887
commit 21dc65f42a
8 changed files with 486 additions and 310 deletions

View File

@@ -14,8 +14,6 @@ int main(int argc, char **argv, char **envp) {
using namespace hex;
ImHexApi::System::impl::setProgramArguments(argc, argv, envp);
bool shouldRestart = false;
// Check if ImHex is installed in portable mode
{
if (const auto executablePath = fs::getExecutablePath(); executablePath.has_value()) {
@@ -26,7 +24,9 @@ int main(int argc, char **argv, char **envp) {
}
}
bool shouldRestart = false;
do {
// Register a event to handle restarting of ImHex
EventManager::subscribe<RequestRestartImHex>([&]{ shouldRestart = true; });
shouldRestart = false;
@@ -38,15 +38,17 @@ int main(int argc, char **argv, char **envp) {
init::WindowSplash splashWindow;
// Add initialization tasks to run
TaskManager::init();
for (const auto &[name, task, async] : init::getInitTasks())
splashWindow.addStartupTask(name, task, async);
// Draw the splash window while tasks are running
if (!splashWindow.loop())
ImHexApi::System::getInitArguments().insert({ "tasks-failed", {} });
}
// Clean up
// Clean up everything after the main window is closed
ON_SCOPE_EXIT {
for (const auto &[name, task, async] : init::getExitTasks())
task();
@@ -65,7 +67,7 @@ int main(int argc, char **argv, char **envp) {
}
}
// Render the main window
window.loop();
}