diff --git a/commandline.cpp b/commandline.cpp index 879a30f1..14ca5944 100644 --- a/commandline.cpp +++ b/commandline.cpp @@ -394,6 +394,12 @@ int arg::readCommon() { exit(0); } else if(argis("")) {} + else if(argis("-deck")) { + if(!detect_deck) printf("warning: -deck option after reading config\n"); + detect_deck = false; + shift(); + running_on_deck = argi(); + } else if(argis("-help") || argis("-h")) { printf("\nCommandline help follows. If you meant in-game help, press F1 while playing.\n\n"); printf("Some commadline options automatically enable the cheat mode.\n"); @@ -416,6 +422,7 @@ int arg::readCommon() { printf(" -nogui - do not start the GUI\n"); printf(" -run - run (before handling other options) until the user presses F10\n"); printf(" -exit - exit the program\n"); + printf(" -deck n - disable SteamDeck auto-detection (`-deck 0` sets not deck, `-deck 1` sets deck)\n"); printf("\nFile options:\n"); printf(" -c FILE - use the specified configuration file\n"); diff --git a/config.cpp b/config.cpp index 40c6e0a4..dad674da 100644 --- a/config.cpp +++ b/config.cpp @@ -1126,15 +1126,17 @@ EX void font_reaction() { } #endif +EX bool running_on_deck = false; +EX bool detect_deck = true; + EX void initConfig() { DEBBI(debug_init_config, ("initconfig")); bool qm = !ISPANDORA; - bool deck = false; #if ISLINUX - if(1) { + if(detect_deck) { string name = "", vendor = ""; if(1) { fhstream f("/sys/devices/virtual/dmi/id/board_name", "rt"); @@ -1145,15 +1147,17 @@ EX void initConfig() { if(f.f) vendor = scanline_noblank(f); } if(vendor.find("Valve") != string::npos && (name.find("Jupiter") != string::npos || name.find("Galileo") != string::npos)) - deck = true; + running_on_deck = true; } #endif #if ISSTEAM - if(is_steamdeck()) deck = true; + if(detect_deck && is_steamdeck()) running_on_deck = true; #endif - if(deck) { + detect_deck = false; + + if(running_on_deck) { centered_menus = true; lands_per_page = 18; dialog::onscreen_keyboard = true; @@ -1449,9 +1453,9 @@ EX void initConfig() { ->editable("vsync", 'v'); #endif - param_b(vid.want_fullscreen, "fullscreen", deck ? true : false) + param_b(vid.want_fullscreen, "fullscreen", running_on_deck ? true : false) ->editable("fullscreen mode", 'f'); - param_b(vid.change_fullscr, "fullscreen_change", deck ? true : false) + param_b(vid.change_fullscr, "fullscreen_change", running_on_deck ? true : false) ->editable("use specific fullscreen resolution", 'g'); param_b(vid.relative_window_size, "window_relative", true) ->editable("specify relative window size", 'g'); @@ -1466,7 +1470,7 @@ EX void initConfig() { dialog::bound_low(dialog::get_ne().vmin); dialog::get_di().reaction_final = do_request_resolution_change; }); - param_i(vid.fullscreen_y, "fullscreen_y", deck ? 800 : 1024) + param_i(vid.fullscreen_y, "fullscreen_y", running_on_deck ? 800 : 1024) -> editable(480, 2160, 1, "fullscreen resolution to use (Y)", "", 'x') -> set_sets([] { dialog::scale_given(get_display_modes('y')); @@ -1477,15 +1481,15 @@ EX void initConfig() { -> editable(160, 3840, 40, "window resolution to use (X)", "", 'x') -> set_sets([] { dialog::bound_low(160); dialog::get_di().reaction_final = do_request_resolution_change; }); - param_i(vid.window_y, "window_y", deck ? 800 : 1024) + param_i(vid.window_y, "window_y", running_on_deck ? 800 : 1024) -> editable(120, 2160, 40, "window resolution to use (Y)", "", 'x') -> set_sets([] { dialog::bound_low(120); dialog::get_di().reaction_final = do_request_resolution_change; }); - param_f(vid.window_rel_x, "window_rel_x", deck ? 1 : .9) + param_f(vid.window_rel_x, "window_rel_x", running_on_deck ? 1 : .9) -> editable(.1, 1, .1, "screen size percentage to use (X)", "", 'x') -> set_sets([] { dialog::bound_low(.1); dialog::get_di().reaction_final = do_request_resolution_change; }); - param_f(vid.window_rel_y, "window_rel_y", deck ? 1 : .9) + param_f(vid.window_rel_y, "window_rel_y", running_on_deck ? 1 : .9) -> editable(.1, 1, .1, "screen size percentage to use (Y)", "", 'x') -> set_sets([] { dialog::bound_low(.1); dialog::get_di().reaction_final = do_request_resolution_change; });