Handle Videomodes better #211

Closed
alufolie91 wants to merge 28 commits from vidmodestuff into Saturn-Next
pull from: vidmodestuff
alufolie91 commented 2025-11-09 20:35:48 +01:00 (Migrated from github.com)

"Unhardcodes" the videolist
instead it will now fetch the availble displaymodes for the current screen
This allows any wonky display and display setup to get their supported screen resolutions
Custom resolutions will now also be put into the list, which makes them appear in the video setup and are reselectable aslong as the resolution cvars dont change

All the games "green" resolutions are in a seperate list which will make sure they are ALWAYS avalible on any setup

Should the gamewindow move to a different display, the resolution list will be automatically rebuilt and when in the display setup that will be refreshed to reflect the new list

Not completely sure which max would be the best, but currently this allows to hold 33 video modes (apparently the menu is desinged to hold a max of 36, so this could be raised to the menu limit if needed)

needs a bit of testing to see if anything breaks

tested on a 2560x1440 16:9 screen, a 1920x1080 screen in vertical orientation, and a 2160x1440 3:2 screen in a linux wayland setup
If someone could check on a different setup (ultrawide displays, different os; x11) would be greatly appreciated

much thanks to dsda-Doom for most of the code (saved me almost all the work lul)

kart0429 kart0430
"Unhardcodes" the videolist instead it will now fetch the availble displaymodes for the current screen This allows any wonky display and display setup to get their supported screen resolutions Custom resolutions will now also be put into the list, which makes them appear in the video setup and are reselectable aslong as the resolution cvars dont change All the games "green" resolutions are in a seperate list which will make sure they are ALWAYS avalible on any setup Should the gamewindow move to a different display, the resolution list will be automatically rebuilt and when in the display setup that will be refreshed to reflect the new list Not completely sure which max would be the best, but currently this allows to hold 33 video modes (apparently the menu is desinged to hold a max of 36, so this could be raised to the menu limit if needed) needs a bit of testing to see if anything breaks tested on a 2560x1440 16:9 screen, a 1920x1080 screen in vertical orientation, and a 2160x1440 3:2 screen in a linux wayland setup If someone could check on a different setup (ultrawide displays, different os; x11) would be greatly appreciated much thanks to dsda-Doom for most of the code (saved me almost all the work lul) <img width="5120" height="2880" alt="kart0429" src="https://github.com/user-attachments/assets/6efc0893-b7f6-4c1f-91a3-8cc72d5e521c" /> <img width="5120" height="2880" alt="kart0430" src="https://github.com/user-attachments/assets/76014143-d044-43a4-bba5-73340f6d1912" />
alufolie91 commented 2025-11-09 22:24:23 +01:00 (Migrated from github.com)

Tested on Windows, everything broke since it returned a gazillion video modes, but should be fine now
Not sure how mac behaves, and idk how to test since i dont know how xcode works or if it even still runs on my 15 year old imac

Tested on Windows, everything broke since it returned a gazillion video modes, but should be fine now Not sure how mac behaves, and idk how to test since i dont know how xcode works or if it even still runs on my 15 year old imac
P-AS commented 2025-11-10 03:41:37 +01:00 (Migrated from github.com)

Not sure how mac behaves, and idk how to test since i dont know how xcode works or if it even still runs on my 15 year old imac

Would like to test this on macOS, but unfortunately the CMake build has broken since the last time I tried it in June because of the new source files and cpp files, which the CMake build wasn't updated for. (macOS uses CMake, not Xcode. The Xcode project for SRB2 is ancient, and should probably just be removed.)

Edit: I made a branch that partially fixes this, but it isn't complete: https://github.com/P-AS/SRB2Kart-Saturn/tree/fixcmake

> Not sure how mac behaves, and idk how to test since i dont know how xcode works or if it even still runs on my 15 year old imac Would like to test this on macOS, but unfortunately the CMake build has broken since the last time I tried it in June because of the new source files and cpp files, which the CMake build wasn't updated for. (macOS uses CMake, not Xcode. The Xcode project for SRB2 is ancient, and [should probably just be removed](https://github.com/P-AS/srb2-legacy/commit/1161d3d1ef9eba89810bb46c8b3abd8cc64edf5f).) Edit: I made a branch that partially fixes this, but it isn't complete: https://github.com/P-AS/SRB2Kart-Saturn/tree/fixcmake
P-AS commented 2025-11-10 05:19:51 +01:00 (Migrated from github.com)

Also worth mentioning that this on X11 works fine.

Also worth mentioning that this on X11 works fine.
alufolie91 commented 2025-11-11 14:29:03 +01:00 (Migrated from github.com)

Oof somehow still assumed macos relied purely on xcode.
fixing up the cmake build has been on the todo list for a good while now, but never gotten around due to the assumption its not strictly needed and all the mess with the c++ stuff during v9
if you could make a pr of the fixes would be really really appreciated X)
Perhaps with that knowledge might be also worth looking into providing a mac build aswell which would be awesome
good to hear its working on x11 too though

Oof somehow still assumed macos relied purely on xcode. fixing up the cmake build has been on the todo list for a good while now, but never gotten around due to the assumption its not strictly needed and all the mess with the c++ stuff during v9 if you could make a pr of the fixes would be really really appreciated X) Perhaps with that knowledge might be also worth looking into providing a mac build aswell which would be awesome good to hear its working on x11 too though
alufolie91 commented 2025-11-16 19:55:33 +01:00 (Migrated from github.com)

Ok this is pushed back a bit, since it should be tested a little more just in case.

Ok this is pushed back a bit, since it should be tested a little more just in case.
alufolie91 commented 2025-11-16 19:57:11 +01:00 (Migrated from github.com)

Not sure how mac behaves, and idk how to test since i dont know how xcode works or if it even still runs on my 15 year old imac

Would like to test this on macOS, but unfortunately the CMake build has broken since the last time I tried it in June because of the new source files and cpp files, which the CMake build wasn't updated for. (macOS uses CMake, not Xcode. The Xcode project for SRB2 is ancient, and should probably just be removed.)

Edit: I made a branch that partially fixes this, but it isn't complete: https://github.com/P-AS/SRB2Kart-Saturn/tree/fixcmake

I´ve made a new branch looking into it now aswell, it mostly ported everything over from blankart.
Not everything is fully working and implemented yet, but it produces a functional executable on nix (arch btw) for me
https://github.com/Indev450/SRB2Kart-Saturn/tree/fixceemake
If you could try it out on macOS would be super helpful! c:

> > Not sure how mac behaves, and idk how to test since i dont know how xcode works or if it even still runs on my 15 year old imac > > Would like to test this on macOS, but unfortunately the CMake build has broken since the last time I tried it in June because of the new source files and cpp files, which the CMake build wasn't updated for. (macOS uses CMake, not Xcode. The Xcode project for SRB2 is ancient, and [should probably just be removed](https://github.com/P-AS/srb2-legacy/commit/1161d3d1ef9eba89810bb46c8b3abd8cc64edf5f).) > > Edit: I made a branch that partially fixes this, but it isn't complete: https://github.com/P-AS/SRB2Kart-Saturn/tree/fixcmake I´ve made a new branch looking into it now aswell, it mostly ported everything over from blankart. Not everything is fully working and implemented yet, but it produces a functional executable on nix (arch btw) for me https://github.com/Indev450/SRB2Kart-Saturn/tree/fixceemake If you could try it out on macOS would be super helpful! c:
P-AS commented 2025-11-18 18:53:19 +01:00 (Migrated from github.com)

https://github.com/Indev450/SRB2Kart-Saturn/tree/fixceemake
If you could try it out on macOS would be super helpful! c:

Got it to build successfully with this, bit it needs a patch (https://github.com/P-AS/SRB2Kart-Saturn/commit/ee31cc1722519e4355eae935f683693df104f262) to correctly compile and link on macOS.
Edit: doesn't break CMake/make on linux either.
Screenshot 2025-11-18 at 12 20 36 PM

Used the command: (these last two should automatically turn off but they don't)

cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DSRB2_CONFIG_SYSTEM_LIBRARIES=ON -DSRB2_CONFIG_ENABLE_DISCORDRPC=OFF -DSRB2_CONFIG_LIBBACKTRACE=OFF
> https://github.com/Indev450/SRB2Kart-Saturn/tree/fixceemake > If you could try it out on macOS would be super helpful! c: Got it to build successfully with this, bit it needs a patch (https://github.com/P-AS/SRB2Kart-Saturn/commit/ee31cc1722519e4355eae935f683693df104f262) to correctly compile and link on macOS. Edit: doesn't break CMake/make on linux either. <img width="640" height="432" alt="Screenshot 2025-11-18 at 12 20 36 PM" src="https://github.com/user-attachments/assets/a8d977c7-742e-4f3f-a41f-97f7968b3563" /> Used the command: (these last two should automatically turn off but they don't) ``` cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DSRB2_CONFIG_SYSTEM_LIBRARIES=ON -DSRB2_CONFIG_ENABLE_DISCORDRPC=OFF -DSRB2_CONFIG_LIBBACKTRACE=OFF ```
alufolie91 commented 2025-11-18 22:45:31 +01:00 (Migrated from github.com)

phew really glad this works with some tweaking, ty very much for testing and fixing things up c:
seeing that threads are disabled, so i removed the thread.h include (it wasnt needed anyways, not sure why it was there)
looking a bit around the net the thread_local keyword should be included with clang from xcode version 8, not entirely sure how new that is, but perhaps just removing the include might work ?
otherwise might consider looking into pthread or just seperating the software multithreading from the rest that uses sdl threads
definitely be sure to make a small pr for the ceemake branch so we can get on fixing up the rest of it!

phew really glad this works with some tweaking, ty very much for testing and fixing things up c: seeing that threads are disabled, so i removed the thread.h include (it wasnt needed anyways, not sure why it was there) looking a bit around the net the thread_local keyword should be included with clang from xcode version 8, not entirely sure how new that is, but perhaps just removing the include might work ? otherwise might consider looking into pthread or just seperating the software multithreading from the rest that uses sdl threads definitely be sure to make a small pr for the ceemake branch so we can get on fixing up the rest of it!
P-AS commented 2025-11-23 01:16:27 +01:00 (Migrated from github.com)

Before/After(16:10 and 16:9) on macOS:
image
image
image

Before/After(16:10 and 16:9) on macOS: <img width="640" height="432" alt="image" src="https://github.com/user-attachments/assets/87c643ca-6080-4ad0-917c-07ef0de4ef99" /> <img width="640" height="432" alt="image" src="https://github.com/user-attachments/assets/3fc72272-c142-45ac-9cb1-4e0239738643" /> <img width="640" height="432" alt="image" src="https://github.com/user-attachments/assets/86bca04c-bb0e-495a-8e52-303201e48d65" />
P-AS commented 2025-11-23 16:25:01 +01:00 (Migrated from github.com)

Turns out the modes in red can work correctly if you go into settings and completely disable HiDPI scaling (which I didn't realize was a thing Apple even allowed you to do). Changing the FBO option made no difference on macOS either. This isn't just a macOS specific problem either, it happens on Wayland too (at least when running SDL2 Classic, higher resolutions work correctly when running sdl2-compat on Wayland). Aside from that problem (which is out of scope anyway), I can confidently say this PR works fine on all the environments I've tested it on.
image
Same exact Linux build on Wayland with both SDL2 Classic/sdl2-compat:
Screenshot from 2025-11-23 10-21-22
Screenshot from 2025-11-23 10-22-28

Turns out the modes in red can work correctly if you go into settings and completely disable HiDPI scaling (which I didn't realize was a thing Apple even allowed you to do). Changing the FBO option made no difference on macOS either. This isn't just a macOS specific problem either, it happens on Wayland too (at least when running SDL2 Classic, higher resolutions work correctly when running sdl2-compat on Wayland). Aside from that problem (which is out of scope anyway), I can confidently say this PR works fine on all the environments I've tested it on. <img width="2560" height="1600" alt="image" src="https://github.com/user-attachments/assets/9c995441-ca2f-460a-b9ac-70303a1feade" /> Same exact Linux build on Wayland with both SDL2 Classic/sdl2-compat: <img width="960" height="600" alt="Screenshot from 2025-11-23 10-21-22" src="https://github.com/user-attachments/assets/4a8f0828-d032-4375-b10a-2632b4ccbbea" /> <img width="641" height="401" alt="Screenshot from 2025-11-23 10-22-28" src="https://github.com/user-attachments/assets/a1d357da-26c9-49de-b17f-219a5fd06e5e" />
alufolie91 commented 2025-11-23 23:15:12 +01:00 (Migrated from github.com)

Hm really weird, red marked resolutions are those that are checked to be higher than the current desktop resolution.
Yet they still get added to the list?
I assume you set your display at 3840x2160?
For me setting the desktop resolution below native will not even add any resolution above that here.
Maybe some discrepancies in how SDL reports display modes back in some cases, need to recheck how we get he desktop resolution again
Glad to hear that it works everywhere otherwise c:

Hm really weird, red marked resolutions are those that are checked to be higher than the current desktop resolution. Yet they still get added to the list? I assume you set your display at 3840x2160? For me setting the desktop resolution below native will not even add any resolution above that here. Maybe some discrepancies in how SDL reports display modes back in some cases, need to recheck how we get he desktop resolution again Glad to hear that it works everywhere otherwise c:
alufolie91 commented 2025-11-23 23:18:12 +01:00 (Migrated from github.com)

Ok i think i see, desktop resolution gets checked with SDL_GetDesktopDisplayMode instead of SDL_GetCurrentDisplayMode, which might report something different if anything in the display settings/properties got changed during runtime

Ok i think i see, desktop resolution gets checked with SDL_GetDesktopDisplayMode instead of SDL_GetCurrentDisplayMode, which might report something different if anything in the display settings/properties got changed during runtime
alufolie91 commented 2026-07-21 17:27:22 +02:00 (Migrated from github.com)

gonna close this for now since this is a huge mess and i dont have any means to check anything on mac
maybe ill revisit this sometime in a less messy way

gonna close this for now since this is a huge mess and i dont have any means to check anything on mac maybe ill revisit this sometime in a less messy way

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: saturn/SRB2Kart-Saturn#211