diff --git a/src/app.cpp b/src/app.cpp index a5827db..77d89f0 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -1,19 +1,47 @@ #include "app.h" +#include "launcher.h" #include "window.h" CRebuilderApp g_AppInstance; CRebuilderApp::CRebuilderApp() { - } BOOL CRebuilderApp::InitInstance() { - m_pMainWnd = new CRebuilderWindow(); - m_pMainWnd->ShowWindow(m_nCmdShow); - m_pMainWnd->UpdateWindow(); + bool run_only = false; - return TRUE; + char *tokens = strtok(m_lpCmdLine, " "); + while (tokens) { + if (!strcmp(tokens, "--run") || !strcmp(tokens, "-r")) { + run_only = true; + } else if (!strcmp(tokens, "--help") || !strcmp(tokens, "-h")) { + ::MessageBoxA(0, "LEGO Island Rebuilder\n" + "\n" + "Supported arguments:\n" + "\n" + "--help, -h\n" + "Displays this help page.\n" + "\n" + "--run, -r\n" + "Run LEGO Island immediately with the last used configuration.", + "Command Line Argument Help", 0); + return false; + } + + tokens = strtok(NULL, " "); + } + + if (!run_only) { + m_pMainWnd = new CRebuilderWindow(); + m_pMainWnd->ShowWindow(m_nCmdShow); + m_pMainWnd->UpdateWindow(); + + return TRUE; + } else { + Launcher::Launch(NULL); + return FALSE; + } }