mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 23:41:26 +12:00
Fix cli args and app version/name
This commit is contained in:
parent
4f389757ee
commit
7cf037bd49
1 changed files with 9 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
// Qt5.10+ frontend implementation for rpcs3. Known to work on Windows, Linux, Mac
|
// Qt5.10+ frontend implementation for rpcs3. Known to work on Windows, Linux, Mac
|
||||||
// by Sacha Refshauge, Megamouse and flash-fire
|
// by Sacha Refshauge, Megamouse and flash-fire
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -97,13 +97,14 @@ static semaphore<> s_qt_mutex{};
|
||||||
std::abort();
|
std::abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* ARG_NO_GUI = "no-gui";
|
const char* ARG_HEADLESS = "headless";
|
||||||
const char* ARG_HI_DPI = "hidpi";
|
const char* ARG_HI_DPI = "hidpi";
|
||||||
|
|
||||||
QCoreApplication* createApplication(int& argc, char* argv[])
|
QCoreApplication* createApplication(int& argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
const std::string headless("--" + std::string(ARG_HEADLESS));
|
||||||
for (int i = 1; i < argc; ++i)
|
for (int i = 1; i < argc; ++i)
|
||||||
if (!strcmp(ARG_NO_GUI, argv[i]))
|
if (!strcmp(headless.c_str(), argv[i]))
|
||||||
return new headless_application(argc, argv);
|
return new headless_application(argc, argv);
|
||||||
return new gui_application(argc, argv);
|
return new gui_application(argc, argv);
|
||||||
}
|
}
|
||||||
|
@ -126,6 +127,8 @@ int main(int argc, char** argv)
|
||||||
s_qt_mutex.lock();
|
s_qt_mutex.lock();
|
||||||
|
|
||||||
QScopedPointer<QCoreApplication> app(createApplication(argc, argv));
|
QScopedPointer<QCoreApplication> app(createApplication(argc, argv));
|
||||||
|
app->setApplicationVersion(qstr(rpcs3::version.to_string()));
|
||||||
|
app->setApplicationName("RPCS3");
|
||||||
|
|
||||||
// Command line args
|
// Command line args
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
|
@ -135,7 +138,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
const QCommandLineOption helpOption = parser.addHelpOption();
|
const QCommandLineOption helpOption = parser.addHelpOption();
|
||||||
const QCommandLineOption versionOption = parser.addVersionOption();
|
const QCommandLineOption versionOption = parser.addVersionOption();
|
||||||
parser.addOption(QCommandLineOption(ARG_NO_GUI, "Run RPCS3 without the GUI."));
|
parser.addOption(QCommandLineOption(ARG_HEADLESS, "Run RPCS3 in headless mode."));
|
||||||
parser.addOption(QCommandLineOption(ARG_HI_DPI, "Enables Qt High Dpi Scaling.", "enabled", "1"));
|
parser.addOption(QCommandLineOption(ARG_HI_DPI, "Enables Qt High Dpi Scaling.", "enabled", "1"));
|
||||||
parser.process(app->arguments());
|
parser.process(app->arguments());
|
||||||
|
|
||||||
|
@ -143,9 +146,6 @@ int main(int argc, char** argv)
|
||||||
if (parser.isSet(versionOption) || parser.isSet(helpOption))
|
if (parser.isSet(versionOption) || parser.isSet(helpOption))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
app->setApplicationVersion(qstr(rpcs3::version.to_string()));
|
|
||||||
app->setApplicationName("RPCS3");
|
|
||||||
|
|
||||||
if (auto gui_app = qobject_cast<gui_application*>(app.data()))
|
if (auto gui_app = qobject_cast<gui_application*>(app.data()))
|
||||||
{
|
{
|
||||||
// Set QT_AUTO_SCREEN_SCALE_FACTOR from environment. Defaults to cli argument, which defaults to 1.
|
// Set QT_AUTO_SCREEN_SCALE_FACTOR from environment. Defaults to cli argument, which defaults to 1.
|
||||||
|
@ -158,9 +158,9 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
gui_app->Init();
|
gui_app->Init();
|
||||||
}
|
}
|
||||||
else if (auto non_gui_app = qobject_cast<headless_application*>(app.data()))
|
else if (auto headless_app = qobject_cast<headless_application*>(app.data()))
|
||||||
{
|
{
|
||||||
non_gui_app->Init();
|
headless_app->Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue