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

Initial SDL3 support. #434

Merged
merged 54 commits into from
Nov 7, 2024
Merged

Initial SDL3 support. #434

merged 54 commits into from
Nov 7, 2024

Conversation

AliceLR
Copy link
Owner

@AliceLR AliceLR commented Apr 15, 2024

Latest tested SDL3 build: 3.1.6.

  • Update SDL3.
  • Fix regressions for SDL 2.
  • Fix regressions for SDL 1.
  • Redo SDL pkg-config directory determination.
  • Audio cleanup.
  • Resolve #error in render_sdl.c.
  • Resolve text input enablement (platform_sdl.c) and active check (event_sdl.c) issues. Fixed via Enable SDL text events at window creation time. #502.
  • Resolve SDL_EVENT_WINDOW_RESIZED hack. Should be resolved thanks to Split set_video_mode into create_window and resize_window. #494 and Merge/cleanup renderer viewport calculation code. #496, needs testing.
  • Resolve SDL_CreateWindow hacks. Switched to SDL3-style SDL_CreateWindow completely since MZX creates centered windows anyway.
  • Resolve DSO hack TODO? No longer using SDL_FUNCTION_POINTER_IS_VOID_POINTER, Move SDL_LoadObject et al. to platform_sdl.c to fix warnings. #500.
  • Resolve system mouse TODO? Done as part of Split set_video_mode into create_window and resize_window. #494.
  • Mono support in SDL3 audio driver.
  • Cleanup: something better than SDL_RenderTexture_mzx? Switched to just SDL_RenderTexture.
  • Cleanup: SDL_VERSION et al. handling probably not ideal. Made X11 clipboard handler SDL1/2 only; defined new functions to get the compiled and linked version in SDL3 format instead of trying to rename the SDL1/2 macros/functions.
  • Cleanup: unnecessary comments in some places.
  • Cleanup: is it possible to handle some of the 0/-1 to true/false return value changes without #if/#else on branches?
    • SDL_Init Not plausible to do better than current.
    • SDL_GL_LoadLibrary Rewrote wrapper to take advantage of the changed return value.
    • SDL_GL_MakeCurrent Non-necessary call, removed completely.
    • SDL_GetClipboardText Not plausible to do better.
  • Cleanup: final pass checking for any missed 0/-1 to true/false return value changes. Most of these never bothered checking the return value in the first place and should be safe by that technicality.
  • SDL_WINDOW_FULLSCREEN_DESKTOP should remain in the GL allowed flags for SDL2.
  • Should SDL_free the return value of SDL_GetClipboardText.
  • Changelog (prior to merge).

Testing:

  • software doesn't work (no window). Not clear if this was an upstream bug or fixed in MZX.
  • software doesn't work in fullscreen (previous frame displays, no updates). Not clear what fixed this.
  • software crashes in Linux. Cascading failure: resolution_width/resolution_height are unsigned, so -1 -> UINT_MAX, so software's minimum clamps on them fail, so MZX automatically selects the smallest resolution greater than or equal to 320x240, which happens to be 320x240. sdl_create_window_soft doesn't enable blitting for inadequate window surface sizes, so software writes out of bounds to the surface. Fixed all of these issues in Misc. fullscreen tweaks/fixes. #499.
  • softscale doesn't work (black screen) (Linux only?). Caused by sdl_render_rect() normalizing coordinates.
  • sdlaccel doesn't work (black screen). Caused by sdl_render_rect() normalizing coordinates.
  • OpenGL doesn't initialize. SDL3 changed more 0/-1 return values to true/false.
  • MegaZeux's software mixer incorrectly assumes the caller wants to fill the entire buffer, causing playback bugs when the requested frames count isn't exactly equal to the buffer frames count.
  • SDL's ALSA, Pulseaudio, PipeWire, and JACK audio drivers all ignore SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES. actually no it just works now???

@AliceLR AliceLR modified the milestones: 2.93d, 2.93c Nov 4, 2024
@AliceLR AliceLR marked this pull request as ready for review November 7, 2024 05:05
@AliceLR AliceLR merged commit fdfec5c into master Nov 7, 2024
16 checks passed
@AliceLR AliceLR deleted the sdl3 branch November 7, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant