-
Notifications
You must be signed in to change notification settings - Fork 160
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
SDL2 Port #1136
SDL2 Port #1136
Conversation
SDL2: general backend; SDL_Sound: for reading and decoding sound formats; MojoAL: a SDL-based implementation of OpenAL API.
Based on the work of @sonneveld (Nick Sonneveld); only relevant code, plus tidied up a little.
Based on the work of @sonneveld (Nick Sonneveld); only relevant code, plus tidied up a little.
Based on the work of @sonneveld (Nick Sonneveld). Audio now plays only on a separate thread, unconditionally. Removed: * Allegro4-based SOUNDCLIP implementations; * old audio thread (now implemented in audio core module); * obsolete config settings; * PSP sound cache (may be reimplemented later).
There's some kind of race condition with MojoAL which may try to mix-in our new clip before it gets properly initialized with data. When it does so, it drops the clip out of the slot. Here we prevent this by polling at least some data in before calling alSourcePlay.
Based on the work of @sonneveld (Nick Sonneveld).
Unfortunately, game processing is not fit for a single event poll, as game thread may be looping in a certain state for a while before returning to the main loop (such as running a dialog script, waiting for a blocking action to complete, etc). Fixing this is a task for another time. At the moment we are adding event polls into each sub-state.
Based on the work of @sonneveld (Nick Sonneveld). Plans for the future refactoring: make gfx driver *return* SDL_Window it creates from SetDisplayMode(), and let engine save it as current render window.
Based on the work of @sonneveld (Nick Sonneveld). This simplifies the code and makes it uniform for Linux, Windows and MacOSX altogether.
Based on the work of @sonneveld (Nick Sonneveld).
Based on the work of @sonneveld (Nick Sonneveld).
Mouse speed control was necessary mostly for Direct3D fullscreen, because Allegro4 had some issues with mouse input in that mode. SDL2 does not seem to have such problem. But I'd like to keep this functionality in the engine just in case, at least for some time.
Based on the work of @sonneveld (Nick Sonneveld) with certain simplifications.
Based on the work of @sonneveld (Nick Sonneveld) with certain simplifications. This keeps original AGS keycodes (based on allegro scancodes, although that's irrelevant now) throughout the engine, and only replaces the way it's generated from backend events. Note that this won't be compatible with unicode text events, and simple AGS code will have to be replaced with something to optionally store unicode text as well. Also, in the future it may be beneficial to refactor event handling globally, and pass all wanted events to the engine components, either directly, or converted to convenient custom data.
Based on the work of @sonneveld (Nick Sonneveld) with minor modifications and fixes.
AGS still uses following from Allegro lib: * bitmaps, drawing, blending and palette functions; * functions for loading/saving bitmaps and pcx; * playing FLIC; * PACKFILE (used in limited situations, e.g. FLIC); * fixed math functions; * file path and find-file functions; * unicode functions;
Based on the work of @ericoporto (Érico Vieira Porto)
This is amazing! 🤯 At first I was a bit confused with how the merge was possible but then I checked
This means updating the CI scripts in this PR or after merge? I think it's fine to update after. It probably needs to update Dockerfiles for everything to include SDL and SDL_Sound libraries required, and then have the environment variables in Cirrus-CI yml point to where they are on the Windows builds, and disable the Android build temporarily since it won't work with current Android project (which is based in the old Allegro Android backend). There may be things that can be removed from the dockerfiles, like Allegro4. @morganwillcock will definitely know more details I made a branch with some modifications to get the CI to build but hasn't been able to finish it, once it works I can create a new branch with properly organized commits. |
Sorry, I was renaming target branch in the main repository and deleted the wrong one afterwards, so this pr got closed and I could not realize how to restore it again. I opened a new identical one instead: #1137 |
Resolves #1096.
Replaces Allegro 4 backend with SDL2.
Main bulk of work was done by @sonneveld previously, now gathered it up, tidied the code, amended and fixed where necessary.
CMake changes by @ericoporto.
Library changes
Notable issues / future todo:
Audio
Audio playback is completely rewritten, uses OpenAL (through MojoAL currently) and SDL2_Sound.
Audio is now played only on a separate thread (this was optional previously).
Notable issues / future todo:
Rendering
Notable issues / future todo:
Building
Must update CI scripts. What is necessary here?
Notable issues / future todo: