mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-04 16:32:39 +00:00
Added --fullscreen <true|false> argument
This commit is contained in:
parent
3ddba2037a
commit
beea900d6f
31
src/main.cpp
31
src/main.cpp
@ -7,6 +7,7 @@
|
|||||||
#include "unordered_map"
|
#include "unordered_map"
|
||||||
|
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
|
#include "common/config.h"
|
||||||
#include "common/memory_patcher.h"
|
#include "common/memory_patcher.h"
|
||||||
#include "emulator.h"
|
#include "emulator.h"
|
||||||
|
|
||||||
@ -57,6 +58,27 @@ int main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
{"--patch", [&](int& i) { arg_map["-p"](i); }},
|
{"--patch", [&](int& i) { arg_map["-p"](i); }},
|
||||||
|
{"-f",
|
||||||
|
[&](int& i) {
|
||||||
|
if (++i >= argc) {
|
||||||
|
std::cerr << "Error: Missing argument for -f/--fullscreen\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
std::string f_param(argv[i]);
|
||||||
|
bool is_fullscreen;
|
||||||
|
if (f_param == "true") {
|
||||||
|
is_fullscreen = true;
|
||||||
|
} else if (f_param == "false") {
|
||||||
|
is_fullscreen = false;
|
||||||
|
} else {
|
||||||
|
std::cerr
|
||||||
|
<< "Error: Invalid argument for -f/--fullscreen. Use 'true' or 'false'.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
// Set fullscreen mode without saving it to config file
|
||||||
|
Config::setFullscreenMode(is_fullscreen);
|
||||||
|
}},
|
||||||
|
{"--fullscreen", [&](int& i) { arg_map["-f"](i); }},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
@ -76,13 +98,18 @@ int main(int argc, char* argv[]) {
|
|||||||
game_path = argv[i];
|
game_path = argv[i];
|
||||||
has_game_argument = true;
|
has_game_argument = true;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Unknown argument: " << cur_arg << "\n";
|
std::cerr << "Unknown argument: " << cur_arg << ", see --help for info.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!has_game_argument) {
|
||||||
|
std::cerr << "Error: Please provide a game path or ID.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the game path or ID exists
|
// Check if the game path or ID exists
|
||||||
if (!has_game_argument || !std::filesystem::exists(game_path)) {
|
if (!std::filesystem::exists(game_path)) {
|
||||||
std::cerr << "Error: Game file not found\n";
|
std::cerr << "Error: Game file not found\n";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,27 @@ int main(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
{"--patch", [&](int& i) { arg_map["-p"](i); }},
|
{"--patch", [&](int& i) { arg_map["-p"](i); }},
|
||||||
|
{"-f",
|
||||||
|
[&](int& i) {
|
||||||
|
if (++i >= argc) {
|
||||||
|
std::cerr << "Error: Missing argument for -f/--fullscreen\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
std::string f_param(argv[i]);
|
||||||
|
bool is_fullscreen;
|
||||||
|
if (f_param == "true") {
|
||||||
|
is_fullscreen = true;
|
||||||
|
} else if (f_param == "false") {
|
||||||
|
is_fullscreen = false;
|
||||||
|
} else {
|
||||||
|
std::cerr
|
||||||
|
<< "Error: Invalid argument for -f/--fullscreen. Use 'true' or 'false'.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
// Set fullscreen mode without saving it to config file
|
||||||
|
Config::setFullscreenMode(is_fullscreen);
|
||||||
|
}},
|
||||||
|
{"--fullscreen", [&](int& i) { arg_map["-f"](i); }},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Parse command-line arguments using the map
|
// Parse command-line arguments using the map
|
||||||
@ -83,7 +104,7 @@ int main(int argc, char* argv[]) {
|
|||||||
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: " << cur_arg << "\n";
|
std::cerr << "Unknown argument: " << cur_arg << ", see --help for info.\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,6 +124,11 @@ int main(int argc, char* argv[]) {
|
|||||||
m_main_window->Init();
|
m_main_window->Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (has_command_line_argument && !has_game_argument) {
|
||||||
|
std::cerr << "Error: Please provide a game path or ID.\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
// Process game path or ID if provided
|
// Process game path or ID if provided
|
||||||
if (has_game_argument) {
|
if (has_game_argument) {
|
||||||
std::filesystem::path game_file_path(gamePath);
|
std::filesystem::path game_file_path(gamePath);
|
||||||
|
Loading…
Reference in New Issue
Block a user