1
0
mirror of synced 2024-11-15 11:33:23 +01:00
ImHex/main/source/main.cpp
WerWolv 966f3b8597
sys: Replace existing bad project system with a much better one (#663)
* sys: Initial effort to replace existing project files with a better system

* sys: Added back marking provider as dirty

* sys: Remove git commit information from project files

* sys: Format data processor save file nicely

* fix: Automatic pattern loading not working correctly

* ui: Added warning popup when closing a provider with modifications

Closes #604

* sys: Fixed build issues

* tests: Removed useless debug logs

* patterns: Updated pattern language

* sys: Added log message when crashing with a signal

* sys: Make sure abnormal termination handlers are being called more reliably
2022-08-08 21:23:52 +02:00

60 lines
1.3 KiB
C++

#include <hex.hpp>
#include <hex/helpers/utils.hpp>
#include <hex/helpers/logger.hpp>
#include "window.hpp"
#include "init/splash_window.hpp"
#include "init/tasks.hpp"
#include <hex/api/project_file_manager.hpp>
int main(int argc, char **argv, char **envp) {
using namespace hex;
ImHexApi::System::impl::setProgramArguments(argc, argv, envp);
#if defined(OS_WINDOWS)
ImHexApi::System::impl::setBorderlessWindowMode(true);
#endif
// Initialization
{
Window::initNative();
hex::log::info("Welcome to ImHex!");
init::WindowSplash splashWindow;
for (const auto &[name, task] : init::getInitTasks())
splashWindow.addStartupTask(name, task);
if (!splashWindow.loop())
ImHexApi::System::getInitArguments().insert({ "tasks-failed", {} });
}
// Clean up
ON_SCOPE_EXIT {
for (const auto &[name, task] : init::getExitTasks())
task();
};
// Main window
{
Window window;
if (argc == 1)
; // No arguments provided
else if (argc == 2)
EventManager::post<RequestOpenFile>(argv[1]);
else {
hex::log::fatal("Usage: {} [<file_name>]", argv[0]);
return EXIT_FAILURE;
}
window.loop();
}
return EXIT_SUCCESS;
}