cfg: turn a handful of parameter parsing errors into fatal (#554)

For parameters that require two values (`width, height` or `x, y`), if
the string fails to parse, turn into runtime failure.
This commit is contained in:
bicarus
2026-02-13 03:22:20 -08:00
committed by GitHub
parent f4050e9adb
commit 408ed17521
5 changed files with 12 additions and 12 deletions
+6 -6
View File
@@ -1083,8 +1083,8 @@ int main_implementation(int argc, char *argv[]) {
std::pair<uint32_t, uint32_t> result;
if (parse_width_height(options[launcher::Options::spice2x_WindowSize].value_text(), result)) {
GRAPHICS_WINDOW_SIZE = result;
} else {
log_warning("launcher", "failed to parse -windowsize");
} else if (!cfg_run && !cfg::CONFIGURATOR_STANDALONE) {
log_fatal("launcher", "failed to parse -windowsize");
}
}
if (options[launcher::Options::spice2x_WindowPosition].is_active()) {
@@ -1401,8 +1401,8 @@ int main_implementation(int argc, char *argv[]) {
std::pair<uint32_t, uint32_t> result;
if (parse_width_height(options[launcher::Options::FullscreenResolution].value_text(), result)) {
GRAPHICS_FS_CUSTOM_RESOLUTION = result;
} else {
log_warning("launcher", "failed to parse -forceres");
} else if (!cfg_run && !cfg::CONFIGURATOR_STANDALONE) {
log_fatal("launcher", "failed to parse -forceres");
}
}
@@ -1410,8 +1410,8 @@ int main_implementation(int argc, char *argv[]) {
std::pair<uint32_t, uint32_t> result;
if (parse_width_height(options[launcher::Options::FullscreenSubResolution].value_text(), result)) {
GRAPHICS_FS_CUSTOM_RESOLUTION_SUB = result;
} else {
log_warning("launcher", "failed to parse -forceressub");
} else if (!cfg_run && !cfg::CONFIGURATOR_STANDALONE) {
log_fatal("launcher", "failed to parse -forceressub");
}
}