add command line arguments GUI
This commit is contained in:
parent
67af53fd58
commit
56af77f1f4
|
@ -8,10 +8,13 @@
|
||||||
#include "qt_gui/game_install_dialog.h"
|
#include "qt_gui/game_install_dialog.h"
|
||||||
#include "qt_gui/main_window.h"
|
#include "qt_gui/main_window.h"
|
||||||
|
|
||||||
|
// Custom message handler to ignore Qt logs
|
||||||
void customMessageHandler(QtMsgType, const QMessageLogContext&, const QString&) {}
|
void customMessageHandler(QtMsgType, const QMessageLogContext&, const QString&) {}
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
|
// Load configurations and initialize Qt application
|
||||||
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
const auto config_dir = Common::FS::GetUserPath(Common::FS::PathType::UserDir);
|
||||||
Config::load(config_dir / "config.toml");
|
Config::load(config_dir / "config.toml");
|
||||||
QString gameDataPath = qApp->applicationDirPath() + "/game_data/";
|
QString gameDataPath = qApp->applicationDirPath() + "/game_data/";
|
||||||
|
@ -23,14 +26,25 @@ int main(int argc, char* argv[]) {
|
||||||
#endif
|
#endif
|
||||||
std::filesystem::create_directory(path);
|
std::filesystem::create_directory(path);
|
||||||
|
|
||||||
|
// Check if the game install directory is set
|
||||||
if (Config::getGameInstallDir() == "") {
|
if (Config::getGameInstallDir() == "") {
|
||||||
GameInstallDialog dlg;
|
GameInstallDialog dlg;
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
qInstallMessageHandler(customMessageHandler); // ignore qt logs.
|
|
||||||
|
|
||||||
|
// Ignore Qt logs
|
||||||
|
qInstallMessageHandler(customMessageHandler);
|
||||||
|
|
||||||
|
// Initialize the main window
|
||||||
MainWindow* m_main_window = new MainWindow(nullptr);
|
MainWindow* m_main_window = new MainWindow(nullptr);
|
||||||
m_main_window->Init();
|
m_main_window->Init();
|
||||||
|
|
||||||
|
// Check for command line arguments
|
||||||
|
if (argc > 1) {
|
||||||
|
Core::Emulator emulator;
|
||||||
|
emulator.Run(argv[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run the Qt application
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
Loading…
Reference in New Issue