2021-02-10 18:17:09 +01:00
|
|
|
#include <hex.hpp>
|
|
|
|
|
2021-08-29 22:15:18 +02:00
|
|
|
#include <hex/helpers/logger.hpp>
|
|
|
|
|
2020-11-10 15:26:38 +01:00
|
|
|
#include "window.hpp"
|
2021-04-20 21:46:48 +02:00
|
|
|
#include "init/splash_window.hpp"
|
|
|
|
|
2024-02-11 13:46:06 +01:00
|
|
|
#include "crash_handlers.hpp"
|
|
|
|
|
2023-11-18 14:50:43 +01:00
|
|
|
#include <hex/api/task_manager.hpp>
|
2023-07-13 14:08:23 +02:00
|
|
|
#include <hex/api/plugin_manager.hpp>
|
2023-07-22 21:30:22 +02:00
|
|
|
|
2024-02-11 13:46:06 +01:00
|
|
|
namespace hex::init {
|
2023-07-13 14:08:23 +02:00
|
|
|
|
2024-02-11 13:46:06 +01:00
|
|
|
int runImHex();
|
|
|
|
void runCommandLine(int argc, char **argv);
|
2023-01-16 19:39:00 +01:00
|
|
|
|
2023-07-22 21:30:22 +02:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* @brief Main entry point of ImHex
|
|
|
|
* @param argc Argument count
|
|
|
|
* @param argv Argument values
|
|
|
|
* @return Exit code
|
|
|
|
*/
|
|
|
|
int main(int argc, char **argv) {
|
2024-02-11 13:46:06 +01:00
|
|
|
using namespace hex;
|
|
|
|
|
|
|
|
// Set the main thread's name to "Main"
|
2024-01-09 10:39:06 +01:00
|
|
|
TaskManager::setCurrentThreadName("Main");
|
2024-02-11 13:46:06 +01:00
|
|
|
|
|
|
|
// Setup crash handlers right away to catch crashes as early as possible
|
2024-01-04 00:37:56 +01:00
|
|
|
crash::setupCrashHandlers();
|
2023-07-21 11:53:37 +02:00
|
|
|
|
2024-02-11 13:46:06 +01:00
|
|
|
// Run platform-specific initialization code
|
|
|
|
Window::initNative();
|
|
|
|
|
|
|
|
// Handle command line arguments if any have been passed
|
2023-07-22 21:30:22 +02:00
|
|
|
if (argc > 1) {
|
2024-02-11 13:46:06 +01:00
|
|
|
init::runCommandLine(argc, argv);
|
2023-07-22 21:30:22 +02:00
|
|
|
}
|
2022-08-16 11:48:37 +02:00
|
|
|
|
2024-02-11 13:46:06 +01:00
|
|
|
// Log some system information to aid debugging when users share their logs
|
2023-07-22 21:30:22 +02:00
|
|
|
log::info("Welcome to ImHex {}!", ImHexApi::System::getImHexVersion());
|
|
|
|
log::info("Compiled using commit {}@{}", ImHexApi::System::getCommitBranch(), ImHexApi::System::getCommitHash());
|
|
|
|
log::info("Running on {} {} ({})", ImHexApi::System::getOSName(), ImHexApi::System::getOSVersion(), ImHexApi::System::getArchitecture());
|
2024-06-03 10:02:29 +02:00
|
|
|
#if defined(OS_LINUX)
|
|
|
|
auto distro = ImHexApi::System::getLinuxDistro().value();
|
|
|
|
log::info("Linux distribution: {}. Version: {}", distro.name, distro.version == "" ? "None" : distro.version);
|
|
|
|
#endif
|
|
|
|
|
2023-07-22 21:30:22 +02:00
|
|
|
|
2024-02-11 13:46:06 +01:00
|
|
|
// Run ImHex
|
2024-02-10 23:31:05 +01:00
|
|
|
return init::runImHex();
|
2023-11-10 20:47:08 +01:00
|
|
|
}
|