luxtorpeda-dev/luxtorpeda

High screen refresh rate causes crash: SdlError("Window is too large.")', src/ui.rs:514:10

Closed this issue · 12 comments

Linux Distribution

Ubuntu 22.04

Luxtorpeda Version

57

Bug description

When the screen refresh rate is set to 165Hz, Luxtorpeda is unable to display engine choice and crashes. If the screen refresh rate is set to 60Hz, it works as expected.

I've encountered this only when trying out Caesar III. I have Arx Fatalis running just fine at 165Hz or 60Hz. This could be an issue with games that have multiple engine choice, like Caesar with Julius and Augustus engines.

Steps To Reproduce

  1. Set screen refresh rate to 165Hz;
  2. Start Caesar 3;
  3. Crashes with error thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SdlError("Window is too large.")', src/ui.rs:514:10.

Expected Behavior

Should display a choice selection between Julius and Augustus game engines and launch the game.

Additional Context

No response

Relevant log output

21:55:51 [INFO] setup_logging success
21:55:51 [INFO] turning virtual gamepad off
21:55:51 [INFO] update_packages_json. found hash: 4ee6d8dccfb3c2e9d7d5c7b817ad4c49d44c3c08
21:55:51 [INFO] update_packages_json. found hash and remote hash: 4ee6d8dccfb3c2e9d7d5c7b817ad4c49d44c3c08 4ee6d8dccfb3c2e9d7d5c7b817ad4c49d44c3c08
21:55:51 [INFO] luxtorpeda version: 57.0.0
21:55:51 [INFO] steam_app_id: "517790"
21:55:51 [INFO] original command: ["/home/aai/.steam/debian-installation/steamapps/common/Caesar 3/SierraLauncher.exe"]
21:55:51 [INFO] working dir: Ok("/home/aai/.steam/debian-installation/steamapps/common/Caesar 3")
21:55:51 [INFO] tool dir: "/home/aai/.steam/debian-installation/compatibilitytools.d/luxtorpeda"
21:55:51 [INFO] user_packages_file not found
21:55:51 [INFO] user_packages_file not found
21:55:51 [INFO] showing engine choices
21:55:51 [INFO] show choice. found default choice.
21:55:51 [INFO] show choice. found default choice. choice is "julius"
21:55:51 [INFO] LUX_DISABLE_DEFAULT_CONFIRM not found: environment variable not found
21:55:51 [INFO] window is on display_index: 0 on_steam_deck: false steam_deck_gaming_mode: false
21:55:51 [INFO] found dpi: (4064.0, 96.0, 96.0) using dpi: 4064.0
21:55:51 [INFO] using scaled_width: 20320 scaled_height: 6096
21:55:51 [INFO] using dpi scaling of 1746.25
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: SdlError("Window is too large.")', src/ui.rs:514:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Game process removed: AppID 517790 "/home/aai/.steam/debian-installation/ubuntu12_32/reaper SteamLaunch AppId=517790 -- '/home/aai/.steam/debian-installation/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/aai/.steam/debian-installation/compatibilitytools.d/luxtorpeda'/luxtorpeda.sh waitforexitandrun  '/home/aai/.steam/debian-installation/steamapps/common/Caesar 3/SierraLauncher.exe'", ProcID 10588 
ThreadGetProcessExitCode: no such process 10704
ThreadGetProcessExitCode: no such process 10591
ThreadGetProcessExitCode: no such process 10590
ThreadGetProcessExitCode: no such process 10589
Uploaded AppInterfaceStats to Steam
assert_20220825225550_31.dmp[10546]: Finished uploading minidump (out-of-process): success = yes
assert_20220825225550_31.dmp[10546]: response: CrashID=bp-23849b15-2a35-4118-ac97-735eb2220825
assert_20220825225550_31.dmp[10546]: file ''/tmp/dumps/assert_20220825225550_31.dmp'', upload yes: ''CrashID=bp-23849b15-2a35-4118-ac97-735eb2220825''

@sekanS Thanks for the report. Could you provide a log of the working case with your 60hz refresh rate?

It looks like the dpi scaling is trying to create a resolution for the window that's too large, hence the panic, although not sure why the refresh rate would affect that.

Here is a full log of starting the game using 60Hz.

Could not connect to X session manager: None of the authentication protocols specified are supported
GameAction [AppID 517790, ActionID 2] : LaunchApp changed task to ProcessingInstallScript with ""
14:45:58 [INFO] setup_logging success
Error: Custom { kind: Other, error: "iscriptevaluator ignoring" }
GameAction [AppID 517790, ActionID 2] : LaunchApp changed task to SynchronizingControllerConfig with ""
GameAction [AppID 517790, ActionID 2] : LaunchApp changed task to SiteLicenseSeatCheckout with ""
GameAction [AppID 517790, ActionID 2] : LaunchApp changed task to CreatingProcess with ""
GameAction [AppID 517790, ActionID 2] : LaunchApp waiting for user response to CreatingProcess ""
GameAction [AppID 517790, ActionID 2] : LaunchApp continues with user response "CreatingProcess"
/bin/sh\0-c\0/home/aai/.steam/debian-installation/ubuntu12_32/reaper SteamLaunch AppId=517790 -- '/home/aai/.steam/debian-installation/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/aai/.steam/debian-installation/compatibilitytools.d/luxtorpeda'/luxtorpeda.sh waitforexitandrun  '/home/aai/.steam/debian-installation/steamapps/common/Caesar 3/SierraLauncher.exe'\0
Game process added : AppID 517790 "/home/aai/.steam/debian-installation/ubuntu12_32/reaper SteamLaunch AppId=517790 -- '/home/aai/.steam/debian-installation/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/aai/.steam/debian-installation/compatibilitytools.d/luxtorpeda'/luxtorpeda.sh waitforexitandrun  '/home/aai/.steam/debian-installation/steamapps/common/Caesar 3/SierraLauncher.exe'", ProcID 65016, IP 0.0.0.0:0
chdir /home/aai/.steam/debian-installation/steamapps/common/Caesar 3
ERROR: ld.so: object '/home/aai/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/aai/.steam/debian-installation/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
GameAction [AppID 517790, ActionID 2] : LaunchApp changed task to WaitingGameWindow with ""
ERROR: ld.so: object '/home/aai/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/aai/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/aai/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
pid 65021 != 65018, skipping destruction (fork without exec?)
GameAction [AppID 517790, ActionID 2] : LaunchApp changed task to Completed with ""
LD_PRELOAD found with /tmp/pressure-vessel-libs-QCUMR1/${PLATFORM}/gameoverlayrenderer.so
pid 65133 != 65132, skipping destruction (fork without exec?)
14:45:59 [INFO] setup_logging success
14:45:59 [INFO] turning virtual gamepad off
14:45:59 [INFO] update_packages_json. found hash: b3cf206ecdedb55e54ee0dee9e857a5e196d9c98
14:45:59 [INFO] update_packages_json. found hash and remote hash: b3cf206ecdedb55e54ee0dee9e857a5e196d9c98 b3cf206ecdedb55e54ee0dee9e857a5e196d9c98
14:45:59 [INFO] luxtorpeda version: 57.0.0
14:45:59 [INFO] steam_app_id: "517790"
14:45:59 [INFO] original command: ["/home/aai/.steam/debian-installation/steamapps/common/Caesar 3/SierraLauncher.exe"]
14:45:59 [INFO] working dir: Ok("/home/aai/.steam/debian-installation/steamapps/common/Caesar 3")
14:45:59 [INFO] tool dir: "/home/aai/.steam/debian-installation/compatibilitytools.d/luxtorpeda"
14:45:59 [INFO] user_packages_file not found
14:45:59 [INFO] user_packages_file not found
14:45:59 [INFO] showing engine choices
14:45:59 [INFO] show choice. found default choice.
14:45:59 [INFO] show choice. found default choice. choice is "julius"
14:45:59 [INFO] LUX_DISABLE_DEFAULT_CONFIRM not found: environment variable not found
14:45:59 [INFO] window is on display_index: 0 on_steam_deck: false steam_deck_gaming_mode: false
14:45:59 [INFO] found dpi: (188.62878, 96.0, 96.0) using dpi: 188.62878
14:45:59 [INFO] using scaled_width: 940 scaled_height: 282
14:45:59 [INFO] using dpi scaling of 2.456104
14:45:59 [INFO] 0 joysticks available
found dpi: (188.62878, 96.0, 96.0)
using dpi_value: 188.62878
14:46:03 [INFO] engine choice complete
14:46:03 [INFO] julius-517790-9.tar.xz found in cache (skip)
14:46:03 [INFO] engine choice complete
14:46:03 [INFO] json:
14:46:03 [INFO] {
    "game_name": "Caesar 3",
    "download": [
        {
            "name": "julius",
            "url": "https://github.com/luxtorpeda-dev/packages/releases/download/julius-9/",
            "file": "julius-517790-9.tar.xz"
        }
    ],
    "cloudNotAvailable": true,
    "command": "./julius",
    "command_args": [
        "./C3"
    ]
}
14:46:03 [INFO] installing: julius-517790-9
14:46:03 [INFO] install: "license"
14:46:03 [INFO] install: "license/LICENSE.julius"
14:46:03 [INFO] install: "julius"
14:46:03 [INFO] run: "./julius" with args: ["./C3"] []
INFO: Julius version 1.7.0
INFO: Initializing SDL
INFO: SDL initialized
INFO: Loading game from ./C3
INFO: Config key  gameplay_fix_immigration
INFO: Config key  gameplay_fix_100y_ghosts
INFO: Config key  screen_display_scale  150
INFO: Config key  screen_cursor_scale  100
INFO: Config key  ui_sidebar_info
INFO: Config key  ui_show_intro_video
INFO: Config key  ui_smooth_scrolling
INFO: Config key  ui_disable_mouse_edge_scrolling
INFO: Config key  ui_disable_map_drag
INFO: Config key  ui_visual_feedback_on_delete
INFO: Config key  ui_allow_cycling_temples
INFO: Config key  ui_show_water_structure_range
INFO: Config key  ui_show_construction_size
INFO: Config key  ui_highlight_legions
INFO: Config key  ui_show_military_sidebar
INFO: Config key  ui_language_dir
INFO: Config value  
INFO: Detected language:  English
INFO: Detected encoding:  1252
INFO: Creating screen 2560 x 1600, fullscreen, driver: x11
INFO: Creating renderer
INFO: Texture created: 1706 x 1066
INFO: Model loaded
INFO: Loading audio files
INFO: Window 1 shown
INFO: Window 1 hidden
INFO: Window 1 shown
INFO: Window move to coordinates x: 0 y: 0
INFO: Window resized to 2560 x 1600
INFO: System resize to 2560 x 1600
Installing breakpad exception handler for appid(gameoverlayui)/version(20220820011708)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)
INFO: Exiting game
14:46:08 [INFO] run returned with exit status: 0
Game process removed: AppID 517790 "/home/aai/.steam/debian-installation/ubuntu12_32/reaper SteamLaunch AppId=517790 -- '/home/aai/.steam/debian-installation/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/aai/.steam/debian-installation/compatibilitytools.d/luxtorpeda'/luxtorpeda.sh waitforexitandrun  '/home/aai/.steam/debian-installation/steamapps/common/Caesar 3/SierraLauncher.exe'", ProcID 65142 
ThreadGetProcessExitCode: no such process 65142
ThreadGetProcessExitCode: no such process 65132
ThreadGetProcessExitCode: no such process 65019
ThreadGetProcessExitCode: no such process 65018
ThreadGetProcessExitCode: no such process 65017
Uploaded AppInterfaceStats to Steam

(process:65145): GLib-GObject-CRITICAL **: 15:46:09.720: g_object_unref: assertion 'G_IS_OBJECT (object)' failed

@sekanS Are you on x11 or wayland? If on x11, can you run the following command on both cases and send the result here?

xrandr

@d10sfan I'm almost always using X11 (especially when gaming). All tests so far were made on X11.

Either way, here is the output on X11:

$ xrandr
Screen 0: minimum 8 x 8, current 2560 x 1600, maximum 32767 x 32767
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 disconnected (normal left inverted right x axis y axis)
DP-2 disconnected (normal left inverted right x axis y axis)
DP-3 disconnected (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
DP-4 connected primary 2560x1600+0+0 (normal left inverted right x axis y axis) 16mm x 10mm
   2560x1600     60.01 + 165.02*

And here is the output on Wayland:

$ xrandr
Screen 0: minimum 16 x 16, current 2560 x 1600, maximum 32767 x 32767
XWAYLAND0 connected primary 2560x1600+0+0 (normal left inverted right x axis y axis) 340mm x 220mm
   2560x1600    164.91*+
   2048x1536    164.95  
   1920x1440    164.87  
   1600x1200    164.88  
   1440x1080    164.85  
   1400x1050    164.88  
   1280x1024    164.93  
   1280x960     164.80  
   1152x864     164.93  
   1024x768     164.99  
   800x600      164.72  
   640x480      164.26  
   320x240      163.69  
   1920x1200    164.87  
   1680x1050    164.82  
   1440x900     164.86  
   1280x800     164.81  
   720x480      164.67  
   640x400      164.67  
   320x200      161.83  
   2560x1440    164.90  
   2048x1152    164.90  
   1920x1080    164.83  
   1600x900     164.77  
   1368x768     164.98  
   1280x720     164.71  
   1024x576     164.94  
   864x486      164.71  
   720x400      164.23  
   640x350      164.46

later edit:

I've made another test. Used Wayland and left the refresh rate at 165Hz. The game ran just fine. So this issue seems to happen only on X11 @ 165Hz.

The log below is of successfully starting Caesar III on Wayland @ 165Hz:

Could not connect to X session manager: None of the authentication protocols specified are supported
Could not connect to X session manager: None of the authentication protocols specified are supported
Could not connect to X session manager: None of the authentication protocols specified are supported
Could not connect to X session manager: None of the authentication protocols specified are supported
Could not connect to X session manager: None of the authentication protocols specified are supported
GameAction [AppID 517790, ActionID 1] : LaunchApp changed task to ProcessingInstallScript with ""
23:26:38 [INFO] setup_logging success
Error: Custom { kind: Other, error: "iscriptevaluator ignoring" }
GameAction [AppID 517790, ActionID 1] : LaunchApp changed task to SynchronizingControllerConfig with ""
Installing breakpad exception handler for appid(steam)/version(1660960119)
GameAction [AppID 517790, ActionID 1] : LaunchApp changed task to SiteLicenseSeatCheckout with ""
GameAction [AppID 517790, ActionID 1] : LaunchApp changed task to CreatingProcess with ""
GameAction [AppID 517790, ActionID 1] : LaunchApp waiting for user response to CreatingProcess ""
GameAction [AppID 517790, ActionID 1] : LaunchApp continues with user response "CreatingProcess"
/bin/sh\0-c\0/home/aai/.steam/debian-installation/ubuntu12_32/reaper SteamLaunch AppId=517790 -- '/home/aai/.steam/debian-installation/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/aai/.steam/debian-installation/compatibilitytools.d/luxtorpeda'/luxtorpeda.sh waitforexitandrun  '/home/aai/.steam/debian-installation/steamapps/common/Caesar 3/SierraLauncher.exe'\0
Game process added : AppID 517790 "/home/aai/.steam/debian-installation/ubuntu12_32/reaper SteamLaunch AppId=517790 -- '/home/aai/.steam/debian-installation/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/aai/.steam/debian-installation/compatibilitytools.d/luxtorpeda'/luxtorpeda.sh waitforexitandrun  '/home/aai/.steam/debian-installation/steamapps/common/Caesar 3/SierraLauncher.exe'", ProcID 93591, IP 0.0.0.0:0
chdir /home/aai/.steam/debian-installation/steamapps/common/Caesar 3
ERROR: ld.so: object '/home/aai/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/aai/.steam/debian-installation/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object '/home/aai/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
GameAction [AppID 517790, ActionID 1] : LaunchApp changed task to WaitingGameWindow with ""
ERROR: ld.so: object '/home/aai/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/aai/.steam/debian-installation/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
pid 93596 != 93593, skipping destruction (fork without exec?)
GameAction [AppID 517790, ActionID 1] : LaunchApp changed task to Completed with ""
LD_PRELOAD found with /tmp/pressure-vessel-libs-Q1WOR1/${PLATFORM}/gameoverlayrenderer.so
pid 93711 != 93710, skipping destruction (fork without exec?)
23:26:39 [INFO] setup_logging success
23:26:39 [INFO] turning virtual gamepad off
23:26:39 [INFO] update_packages_json. found hash: b3cf206ecdedb55e54ee0dee9e857a5e196d9c98
23:26:39 [INFO] update_packages_json. found hash and remote hash: b3cf206ecdedb55e54ee0dee9e857a5e196d9c98 b3cf206ecdedb55e54ee0dee9e857a5e196d9c98
23:26:39 [INFO] luxtorpeda version: 57.0.0
23:26:39 [INFO] steam_app_id: "517790"
23:26:39 [INFO] original command: ["/home/aai/.steam/debian-installation/steamapps/common/Caesar 3/SierraLauncher.exe"]
23:26:39 [INFO] working dir: Ok("/home/aai/.steam/debian-installation/steamapps/common/Caesar 3")
23:26:39 [INFO] tool dir: "/home/aai/.steam/debian-installation/compatibilitytools.d/luxtorpeda"
23:26:39 [INFO] user_packages_file not found
23:26:39 [INFO] user_packages_file not found
23:26:39 [INFO] showing engine choices
23:26:39 [INFO] show choice. found default choice.
23:26:39 [INFO] show choice. found default choice. choice is "julius"
23:26:39 [INFO] LUX_DISABLE_DEFAULT_CONFIRM not found: environment variable not found
23:26:39 [INFO] window is on display_index: 0 on_steam_deck: false steam_deck_gaming_mode: false
23:26:39 [INFO] found dpi: (189.34628, 96.0, 96.0) using dpi: 189.34628
23:26:39 [INFO] using scaled_width: 945 scaled_height: 283
23:26:39 [INFO] using dpi scaling of 2.4654462
23:26:39 [INFO] 0 joysticks available
found dpi: (189.34628, 96.0, 96.0)
using dpi_value: 189.34628
Installing breakpad exception handler for appid(steam)/version(1660960119)
23:26:43 [INFO] engine choice complete
23:26:43 [INFO] julius-517790-9.tar.xz found in cache (skip)
23:26:43 [INFO] engine choice complete
23:26:43 [INFO] json:
23:26:43 [INFO] {
    "game_name": "Caesar 3",
    "download": [
        {
            "name": "julius",
            "url": "https://github.com/luxtorpeda-dev/packages/releases/download/julius-9/",
            "file": "julius-517790-9.tar.xz"
        }
    ],
    "cloudNotAvailable": true,
    "command": "./julius",
    "command_args": [
        "./C3"
    ]
}
23:26:43 [INFO] installing: julius-517790-9
23:26:43 [INFO] install: "license"
23:26:43 [INFO] install: "license/LICENSE.julius"
23:26:43 [INFO] install: "julius"
23:26:43 [INFO] run: "./julius" with args: ["./C3"] []
INFO: Julius version 1.7.0
INFO: Initializing SDL
INFO: SDL initialized
INFO: Loading game from ./C3
INFO: Config key  gameplay_fix_immigration
INFO: Config key  gameplay_fix_100y_ghosts
INFO: Config key  screen_display_scale  150
INFO: Config key  screen_cursor_scale  100
INFO: Config key  ui_sidebar_info
INFO: Config key  ui_show_intro_video
INFO: Config key  ui_smooth_scrolling
INFO: Config key  ui_disable_mouse_edge_scrolling
INFO: Config key  ui_disable_map_drag
INFO: Config key  ui_visual_feedback_on_delete
INFO: Config key  ui_allow_cycling_temples
INFO: Config key  ui_show_water_structure_range
INFO: Config key  ui_show_construction_size
INFO: Config key  ui_highlight_legions
INFO: Config key  ui_show_military_sidebar
INFO: Config key  ui_language_dir
INFO: Config value  
INFO: Detected language:  English
INFO: Detected encoding:  1252
INFO: Creating screen 2560 x 1600, fullscreen, driver: x11
INFO: Creating renderer
INFO: Texture created: 1706 x 1066
INFO: Model loaded
INFO: Loading audio files
INFO: Window 1 shown
INFO: Window 1 hidden
INFO: Window 1 shown
INFO: Window move to coordinates x: 0 y: 0
INFO: Window resized to 2560 x 1600
INFO: System resize to 2560 x 1600
Installing breakpad exception handler for appid(gameoverlayui)/version(20220820011708)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)
INFO: Exiting game
23:26:47 [INFO] run returned with exit status: 0
Game process removed: AppID 517790 "/home/aai/.steam/debian-installation/ubuntu12_32/reaper SteamLaunch AppId=517790 -- '/home/aai/.steam/debian-installation/steamapps/common/SteamLinuxRuntime_soldier'/_v2-entry-point --verb=waitforexitandrun -- '/home/aai/.steam/debian-installation/compatibilitytools.d/luxtorpeda'/luxtorpeda.sh waitforexitandrun  '/home/aai/.steam/debian-installation/steamapps/common/Caesar 3/SierraLauncher.exe'", ProcID 93740 

@sekanS It looks like in your wayland example the dpi variables are correct, instead of very high like in x11.

Related to this: found dpi: (4064.0, 96.0, 96.0) using dpi: 4064.0

Recently, SDL2 added a warning about using that API, which seems to have been added because of issues with accuracy on sdl2: libsdl-org/SDL@307b0b7

So it may mean I need to switch to another way of determing the scaling needed. For now, so it does not crash, I could look at detecting a high refresh rate and x11, and disabling the dpi scaling attempt (or at least ignoring the high value). Are there other refresh rates that your monitor supports that cause this issue as well?

@d10sfan I'm using the laptop's screen, and I can only go either 60 or 165 Hz, nothing in between. So, unfortunately, I can't test different higher refresh rates to see if others would cause problems. My external monitor is only going as high as 60Hz, no luck there either.

It's a good think you found that API warning. Gives it a bit more perspective now.

@sekanS I created a workaround for this in #169

There's a build at https://github.com/luxtorpeda-dev/luxtorpeda/actions/runs/2945899483 if you could try it and let me know if that fixes the crash and still look ok.

I'd still like to look at how the dpi scaling works in the future to see if the calculation can be fixed, possibly by using other sdl2 features than getting the reported DPI.

@d10sfan I tested the new build, and it's able to run at 165Hz, but the window is blank now:
blank_gui

Switching to 60Hz displays the window properly, as expected.

Here is the output of the run at 165Hz:

09:51:50 [INFO] setup_logging success
09:51:50 [INFO] turning virtual gamepad off
09:51:50 [INFO] update_packages_json. found hash: 3df4d661f1cdda20acd4a956f824a9ee03eb0d55
09:51:50 [INFO] update_packages_json. found hash and remote hash: 3df4d661f1cdda20acd4a956f824a9ee03eb0d55 3df4d661f1cdda20acd4a956f824a9ee03eb0d55
09:51:50 [INFO] luxtorpeda version: 57.0.0
09:51:50 [INFO] steam_app_id: "517790"
09:51:50 [INFO] original command: ["/home/aai/.steam/debian-installation/steamapps/common/Caesar 3/SierraLauncher.exe"]
09:51:50 [INFO] working dir: Ok("/home/aai/.steam/debian-installation/steamapps/common/Caesar 3")
09:51:50 [INFO] tool dir: "/home/aai/.steam/debian-installation/compatibilitytools.d/luxtorpeda"
09:51:50 [INFO] user_packages_file not found
09:51:50 [INFO] user_packages_file not found
09:51:50 [INFO] showing engine choices
09:51:50 [INFO] show choice. found default choice.
09:51:50 [INFO] show choice. found default choice. choice is "julius"
09:51:50 [INFO] LUX_DISABLE_DEFAULT_CONFIRM not found: environment variable not found
09:51:50 [INFO] window is on display_index: 0 on_steam_deck: false steam_deck_gaming_mode: false
09:51:50 [INFO] found dpi: (4064.0, 96.0, 96.0) using dpi: 120.0
09:51:50 [INFO] using dpi scaling of 1.5625
09:51:50 [INFO] 0 joysticks available
found dpi: (4064.0, 96.0, 96.0)
using dpi_value: 4064.0
09:51:55 [INFO] engine choice complete
09:51:55 [INFO] julius-517790-9.tar.xz found in cache (skip)
09:51:55 [INFO] engine choice complete
09:51:55 [INFO] json:
09:51:55 [INFO] {
    "game_name": "Caesar 3",
    "download": [
        {
            "name": "julius",
            "url": "https://github.com/luxtorpeda-dev/packages/releases/download/julius-9/",
            "file": "julius-517790-9.tar.xz"
        }
    ],
    "cloudNotAvailable": true,
    "command": "./julius",
    "command_args": [
        "./C3"
    ]
}
09:51:55 [INFO] installing: julius-517790-9
09:51:55 [INFO] install: "license"
09:51:55 [INFO] install: "license/LICENSE.julius"
09:51:55 [INFO] install: "julius"
09:51:55 [INFO] run: "./julius" with args: ["./C3"] []
INFO: Julius version 1.7.0
INFO: Initializing SDL
INFO: SDL initialized
INFO: Loading game from ./C3
INFO: Config key  gameplay_fix_immigration
INFO: Config key  gameplay_fix_100y_ghosts
INFO: Config key  screen_display_scale  150
INFO: Config key  screen_cursor_scale  100
INFO: Config key  ui_sidebar_info
INFO: Config key  ui_show_intro_video
INFO: Config key  ui_smooth_scrolling
INFO: Config key  ui_disable_mouse_edge_scrolling
INFO: Config key  ui_disable_map_drag
INFO: Config key  ui_visual_feedback_on_delete
INFO: Config key  ui_allow_cycling_temples
INFO: Config key  ui_show_water_structure_range
INFO: Config key  ui_show_construction_size
INFO: Config key  ui_highlight_legions
INFO: Config key  ui_show_military_sidebar
INFO: Config key  ui_language_dir
INFO: Config value  
INFO: Detected language:  English
INFO: Detected encoding:  1252
INFO: Creating screen 2560 x 1600, fullscreen, driver: x11
INFO: Creating renderer
INFO: Texture created: 1706 x 1066
INFO: Model loaded
INFO: Loading audio files
INFO: Window 1 shown
INFO: Window 1 hidden
INFO: Window 1 shown
INFO: Window move to coordinates x: 0 y: 0
INFO: Window resized to 2560 x 1600
INFO: System resize to 2560 x 1600
Installing breakpad exception handler for appid(gameoverlayui)/version(20220820011708)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)
Installing breakpad exception handler for appid(gameoverlayui)/version(1.0)

@sekanS It looks like there was another spot where the dpi needed to be fixed. Can you try the build from this? https://github.com/luxtorpeda-dev/luxtorpeda/actions/runs/2960412707

@d10sfan Tested the latest build and it works perfectly fine.

@sekanS Thanks for testing! I've released a new version with this fix. Let me know if you run into any issues.

Works like a charm. Thank you, @d10sfan! 🥇