Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDL3 #8638

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

SDL3 #8638

wants to merge 4 commits into from

Conversation

Pentarctagon
Copy link
Member

@Pentarctagon Pentarctagon commented Mar 26, 2024


Some initial work seeing what moving to SDL3 will take. The first commit is from running the recommended rename_* scripts from https://github.com/libsdl-org/SDL/blob/main/docs/README-migration.md. Second commit is simpler things I was able to easily fix - main thing with this was more things are taking floats instead of ints as arguments.

@Pentarctagon Pentarctagon marked this pull request as draft March 26, 2024 20:29
@github-actions github-actions bot added macOS OS-specific issues that apply to Apple macOS. AI Issues with the AI engine, including micro AIs. MP Issues with multiplayer support or bundled multiplayer content. UI User interface issues, including both back-end and front-end issues. Editor Map/scenario editor issues. Lua API Issues with the Lua engine and API. Add-ons Issues with the add-ons client and/or server. Building Build-time issues. Help In-game Help functions CMake Issues involving the CMake build system. labels Mar 26, 2024
@Wedge009
Copy link
Member

This sounds interesting. Unfortunate that there's breaking changes for SDL_RWops. Might this help with SDL dependencies for things like #6826?

@Pentarctagon
Copy link
Member Author

The minimum requirement for that one is only 2.0.18, so this wouldn't really be relevant for that PR.

@gfgtdf
Copy link
Contributor

gfgtdf commented Mar 27, 2024

It seems a bit odd to me that the script changes for example __APPLE__ to SDL_PLATFORM_APPLE since i thought __APPLE__ is provided by the compiler and not by sdl, i might be wrong though.

About "SDL_RWops": iirc the main reason why they were needed in the first place was to support non-utf-8 filepaths for windows 7 (especially for some bug in sdl-mixer that called different version of the windows api). Since it seemed like we mostly dropped support for windows 7, we can in the worst case also just skip the SDL_RWOps part and use the "normal" api the takes paths.

@Pentarctagon
Copy link
Member Author

The normal API being what's in filesystem.cpp?

@gfgtdf
Copy link
Contributor

gfgtdf commented Mar 27, 2024

The normal API being what's in filesystem.cpp?

The normal api being IMG_Load instead of IMG_Load_RW , Mix_LoadMUSinstead of Mix_LoadMUSType_RW etc.

@Pentarctagon
Copy link
Member Author

Ah, alright. Looks like the new ones are Mix_LoadWAV_IO, IMG_Load_IO, etc. So like:
IMG_Load_IO(SDL_IOFromFile(ovr_file.c_str(), "rb"), true);

@gfgtdf
Copy link
Contributor

gfgtdf commented Mar 27, 2024

I guess that works too, i don't really see the advntage of that though.

@Pentarctagon
Copy link
Member Author

It has an argument for whether to close the file before it returns with the data, which is probably a good thing to do (and the current functions all set that argument to true).

@Pentarctagon
Copy link
Member Author

Got it compiling, though it's pretty broken at the moment too.

@github-actions github-actions bot added the SCons Issues involving the SCons build system. label Mar 28, 2024
@Wedge009
Copy link
Member

Broken how? Things not displaying properly?

@Pentarctagon
Copy link
Member Author

It seems mostly input related actually - tooltips only display for a split second after your mouse moves rather than for the entire duration the mouse is hovering over the element, the help can be opened, but it's impossible to click anything in it other than the Close button, scrolling around the map doesn't work, etc.

@Pentarctagon
Copy link
Member Author

Got the input fixed. So yeah, at this point it seems like everything is working. Looked in-game, in the editor, went online, looked at the list of add-ons in the add-ons manager, and it all worked and looked like expected.

@gfgtdf
Copy link
Contributor

gfgtdf commented Mar 29, 2024

I still think the change from __APPLE__ to SDL_PLATFORM_APPLE is most likely wrong, in many cases (server/, utils/ ) i don't even know how they compile since they afaik don't depend on sdl

@Pentarctagon
Copy link
Member Author

Well, it'd just mean that the macro isn't defined, which by itself wouldn't cause a build failure. Trying to compile code for the wrong platform obviously might, but I don't have a macOS machine and CI can't run until there's actually an SDL3 release made available on the various platforms.

@Pentarctagon
Copy link
Member Author

Oh, also, there's this bit of Windows-specific code that I'm not sure what to do with:
10db633#diff-b482f066a3f38e67254db02f4d28fb308a5adaf2ebda24427ed8fc86a4ef84dfR691-R692

The non-Windows bit was removed since the function it calls is empty anyway, but on Windows it actually does something.

@Wedge009
Copy link
Member

Did you set-up SDL3 manually? Looks like my distribution doesn't package sdl3 yet.

@Pentarctagon
Copy link
Member Author

Yes - SDL3, SDL3_image, and SDL3_mixer. The latter two don't actually have any sort of release yet either - I just took the current code from their git repository.

@github-actions github-actions bot added the Units Issues that involve unit definitions or their implementation in the engine. label Apr 13, 2024
@Wedge009 Wedge009 added Engine General game engine issues that do not fit in any other category. and removed macOS OS-specific issues that apply to Apple macOS. AI Issues with the AI engine, including micro AIs. MP Issues with multiplayer support or bundled multiplayer content. UI User interface issues, including both back-end and front-end issues. Editor Map/scenario editor issues. Units Issues that involve unit definitions or their implementation in the engine. Lua API Issues with the Lua engine and API. Add-ons Issues with the add-ons client and/or server. Help In-game Help functions SCons Issues involving the SCons build system. CMake Issues involving the CMake build system. labels Apr 13, 2024
@github-actions github-actions bot added macOS OS-specific issues that apply to Apple macOS. AI Issues with the AI engine, including micro AIs. UI User interface issues, including both back-end and front-end issues. Editor Map/scenario editor issues. Units Issues that involve unit definitions or their implementation in the engine. Lua API Issues with the Lua engine and API. Help In-game Help functions SCons Issues involving the SCons build system. CMake Issues involving the CMake build system. labels May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AI Issues with the AI engine, including micro AIs. Building Build-time issues. CMake Issues involving the CMake build system. Editor Map/scenario editor issues. Engine General game engine issues that do not fit in any other category. Help In-game Help functions Lua API Issues with the Lua engine and API. macOS OS-specific issues that apply to Apple macOS. SCons Issues involving the SCons build system. UI User interface issues, including both back-end and front-end issues. Units Issues that involve unit definitions or their implementation in the engine.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants