mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
Clang-format
This commit is contained in:
parent
c1f49fb6dd
commit
35d17ed179
@ -18,8 +18,6 @@
|
|||||||
// Custom message handler to ignore Qt logs
|
// 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[]) {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
SetConsoleOutputCP(CP_UTF8);
|
SetConsoleOutputCP(CP_UTF8);
|
||||||
@ -37,51 +35,54 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
// Map of argument strings to lambda functions
|
// Map of argument strings to lambda functions
|
||||||
std::unordered_map<std::string, std::function<void(int&)>> arg_map = {
|
std::unordered_map<std::string, std::function<void(int&)>> arg_map = {
|
||||||
{"-h", [&](int&) {
|
{"-h",
|
||||||
std::cout << "Usage: emulator [options]\n"
|
[&](int&) {
|
||||||
"Options:\n"
|
std::cout << "Usage: emulator [options]\n"
|
||||||
" No arguments: Opens the GUI.\n"
|
"Options:\n"
|
||||||
" -g, --game <path|ID> Specify game path or ID to launch\n"
|
" No arguments: Opens the GUI.\n"
|
||||||
" -p, --patch <patch_file> Apply specified patch file\n"
|
" -g, --game <path|ID> Specify game path or ID to launch\n"
|
||||||
" -s, --show-gui Show the GUI\n"
|
" -p, --patch <patch_file> Apply specified patch file\n"
|
||||||
" -h, --help Display this help message\n";
|
" -s, --show-gui Show the GUI\n"
|
||||||
exit(0);
|
" -h, --help Display this help message\n";
|
||||||
}},
|
exit(0);
|
||||||
|
}},
|
||||||
{"--help", [&](int& i) { arg_map["-h"](i); }}, // Redirect --help to -h
|
{"--help", [&](int& i) { arg_map["-h"](i); }}, // Redirect --help to -h
|
||||||
|
|
||||||
{"-s", [&](int&) { show_gui = true; }},
|
{"-s", [&](int&) { show_gui = true; }},
|
||||||
{"--show-gui", [&](int& i) { arg_map["-s"](i); }},
|
{"--show-gui", [&](int& i) { arg_map["-s"](i); }},
|
||||||
|
|
||||||
{"-g", [&](int& i) {
|
{"-g",
|
||||||
if (i + 1 < argc) {
|
[&](int& i) {
|
||||||
gamePath = argv[++i];
|
if (i + 1 < argc) {
|
||||||
has_game_argument = true;
|
gamePath = argv[++i];
|
||||||
} else {
|
has_game_argument = true;
|
||||||
std::cerr << "Error: Missing argument for -g/--game\n";
|
} else {
|
||||||
exit(1);
|
std::cerr << "Error: Missing argument for -g/--game\n";
|
||||||
}
|
exit(1);
|
||||||
}},
|
}
|
||||||
|
}},
|
||||||
{"--game", [&](int& i) { arg_map["-g"](i); }},
|
{"--game", [&](int& i) { arg_map["-g"](i); }},
|
||||||
|
|
||||||
{"-p", [&](int& i) {
|
{"-p",
|
||||||
if (i + 1 < argc) {
|
[&](int& i) {
|
||||||
MemoryPatcher::patchFile = argv[++i];
|
if (i + 1 < argc) {
|
||||||
} else {
|
MemoryPatcher::patchFile = argv[++i];
|
||||||
std::cerr << "Error: Missing argument for -p\n";
|
} else {
|
||||||
exit(1);
|
std::cerr << "Error: Missing argument for -p\n";
|
||||||
}
|
exit(1);
|
||||||
}},
|
}
|
||||||
|
}},
|
||||||
{"--patch", [&](int& i) { arg_map["-p"](i); }},
|
{"--patch", [&](int& i) { arg_map["-p"](i); }},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Parse command-line arguments using the map
|
// Parse command-line arguments using the map
|
||||||
for (int i = 1; i < argc; ++i) {
|
for (int i = 1; i < argc; ++i) {
|
||||||
std::string curArg = argv[i];
|
std::string cur_arg = argv[i];
|
||||||
auto it = arg_map.find(curArg);
|
auto it = arg_map.find(cur_arg);
|
||||||
if (it != arg_map.end()) {
|
if (it != arg_map.end()) {
|
||||||
it->second(i); // Call the associated lambda function
|
it->second(i); // Call the associated lambda function
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Unknown argument: " << curArg << "\n";
|
std::cerr << "Unknown argument: " << cur_arg << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +98,7 @@ int main(int argc, char* argv[]) {
|
|||||||
|
|
||||||
// Initialize the main window
|
// Initialize the main window
|
||||||
MainWindow* m_main_window = new MainWindow(nullptr);
|
MainWindow* m_main_window = new MainWindow(nullptr);
|
||||||
if((has_command_line_argument && show_gui) || !has_command_line_argument) {
|
if ((has_command_line_argument && show_gui) || !has_command_line_argument) {
|
||||||
m_main_window->Init();
|
m_main_window->Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +132,6 @@ int main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Show the main window and run the Qt application
|
// Show the main window and run the Qt application
|
||||||
m_main_window->show();
|
m_main_window->show();
|
||||||
return a.exec();
|
return a.exec();
|
||||||
|
Loading…
Reference in New Issue
Block a user