mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 02:47:02 +02:00
system: add console language conf
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "emulator.h"
|
||||
#include "kytyGitVersion.h"
|
||||
|
||||
#include <charconv>
|
||||
#include <cstdio>
|
||||
#include <fmt/format.h>
|
||||
|
||||
@@ -47,6 +48,7 @@ static void PrintUsage() {
|
||||
::printf(" --screen-width <num> Window width. Default: 1280.\n");
|
||||
::printf(" --screen-height <num> Window height. Default: 720.\n");
|
||||
::printf(" --vblank-frequency <num> Virtual vblank frequency. Default: 60.\n");
|
||||
::printf(" --console-language <0-29> Console language. Default: 1 (English US).\n");
|
||||
::printf(" --vulkan-validation <true|false> Enable Vulkan validation.\n");
|
||||
::printf(" --shader-validation <true|false> Enable shader validation.\n");
|
||||
::printf(" --shader-optimization-type <value> None, Size, or Performance.\n");
|
||||
@@ -101,6 +103,17 @@ static bool ParseEnum(const std::string& value, E& out) {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ParseConsoleLanguage(const std::string& value, uint32_t& out) {
|
||||
uint32_t language = 0;
|
||||
auto [end, error] = std::from_chars(value.data(), value.data() + value.size(), language);
|
||||
if (error != std::errc {} || end != value.data() + value.size() ||
|
||||
language > Config::MAX_CONSOLE_LANGUAGE) {
|
||||
return false;
|
||||
}
|
||||
out = language;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool ParseArgs(int argc, char* argv[], RunOptions& options, bool& show_help) {
|
||||
show_help = false;
|
||||
|
||||
@@ -167,6 +180,11 @@ static bool ParseArgs(int argc, char* argv[], RunOptions& options, bool& show_he
|
||||
const int32_t vblank_frequency = Common::ToInt32(value);
|
||||
options.config.vblank_frequency =
|
||||
static_cast<uint32_t>(vblank_frequency < 0 ? 0 : vblank_frequency);
|
||||
} else if (arg == "--console-language") {
|
||||
if (!ParseConsoleLanguage(value, options.config.console_language)) {
|
||||
::printf("invalid console language: %s\n", value.c_str());
|
||||
return false;
|
||||
}
|
||||
} else if (arg == "--vulkan-validation") {
|
||||
if (!ParseBool(value, options.config.vulkan_validation_enabled)) {
|
||||
::printf("invalid boolean for %s: %s\n", arg.c_str(), value.c_str());
|
||||
|
||||
Reference in New Issue
Block a user