From 966c3fea5b420ba3d947416035cb01d6d65c5440 Mon Sep 17 00:00:00 2001 From: Zion Nimchuk Date: Sat, 13 Oct 2018 23:33:20 -0700 Subject: [PATCH] Fix command line arguments, add --version and set Qt application name --- rpcs3/main.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/rpcs3/main.cpp b/rpcs3/main.cpp index d5dd319e0f..567a5ceaa7 100644 --- a/rpcs3/main.cpp +++ b/rpcs3/main.cpp @@ -1,5 +1,5 @@ // Qt5.2+ frontend implementation for rpcs3. Known to work on Windows, Linux, Mac -// by Sacha Refshauge +// by Sacha Refshauge, Megamouse and flash-fire #include #include @@ -18,6 +18,8 @@ #include #endif +#include "rpcs3_version.h" + inline std::string sstr(const QString& _in) { return _in.toStdString(); } template @@ -99,13 +101,25 @@ int main(int argc, char** argv) s_qt_mutex.lock(); rpcs3_app app(argc, argv); + app.setApplicationVersion(qstr(rpcs3::version.to_string())); + app.setApplicationName("RPCS3"); + // Command line args QCommandLineParser parser; parser.setApplicationDescription("Welcome to RPCS3 command line."); parser.addPositionalArgument("(S)ELF", "Path for directly executing a (S)ELF"); parser.addPositionalArgument("[Args...]", "Optional args for the executable"); - parser.addHelpOption(); + + const QCommandLineOption helpOption = parser.addHelpOption(); + const QCommandLineOption versionOption = parser.addVersionOption(); parser.parse(QCoreApplication::arguments()); + parser.process(app); + + // Don't start up the full rpcs3 gui if we just want the version or help. + if (parser.isSet(versionOption)) + return true; + if (parser.isSet(helpOption)) + return true; app.Init();