Skip to content

[pull] main from libsdl-org:main - #36

Open
pull[bot] wants to merge 608 commits into
bazelregistry:mainfrom
libsdl-org:main
Open

[pull] main from libsdl-org:main#36
pull[bot] wants to merge 608 commits into
bazelregistry:mainfrom
libsdl-org:main

Conversation

@pull

@pull pull Bot commented Jun 2, 2021

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull Bot added the ⤵️ pull label Jun 2, 2021
sezero and others added 29 commits September 23, 2022 23:00
When we're logically scaling, and preserving the aspect ratio (so are
letterboxing or pillarboxing), the scaled mouse coordinates may be
outside the application window (backbuffer). These can even be negative,
which get underflowed to very large positive values, as SDL 1.2 uses
unsigned coordinates here.

We were already clamping these values for OpenGL logical scaling, which
we do ourselves, but the event filter used with SDL_Renderer doesn't, so
we'll manually clamp these all the time.
This makes 1.2 apps compiled with sdl12-compat's headers work with
a real SDL 1.2 library on macOS. Otherwise: missing symbol.
Signed-off-by: Simon McVittie <smcv@debian.org>
1.2 (on many video backends) would allow smaller surfaces that it would
center in a larger mode, so emulate that here.

Reference Issue #228.
icculus and others added 30 commits November 5, 2025 13:30
There was no Hint API, so environment variables might change on the fly as
apps needed different things. SDL3 (an thus, sdl2-compat) will ignore envvar
changes after startup, since it copies the OS environment table to an
SDL_Environment, and will miss these later changes.

So sdl12-compat will use the "unsafe" (that is: not thread safe) methods to
pull in environment variables, ignoring SDL2's SDL_getenv, and will take
measures to explicitly set hints that SDL2 and later might need, so they are
seen internally despite the state of the SDL3 internal SDL_Environment table.

Reference Issue https://github.com/libsdl-org/sdl2-compat/issues/540
This reverts commit 6595f6e.

It turns out there are a number of games that depend on this:
* antigrav
* armagetronad
* bloboats
* blockout2
* brutalchess
* cytadela
* enemylines3
* enemylines7
* opencity
* pathogen

Fixes #382
…e changes.

This is noticable in, for example, Loki's port of Sid Meier's Alpha Centauri,
where it wants to show static Loki/Firaxis logos on an 8-bit screen surface,
then set the video mode to 16-bit for intro videos through SMPEG, then back to
an 8-bit surface for the main menu and gameplay. Before this, windows would
be destroyed and immediately pop back up: an unnecessary visual glitch, but
also it caused rendering to fail on at least one system.

Since software surfaces already go through a conversion to whatever format the
SDL2 renderer's texture wants, it was better to avoid all the damage by
letting the conversion surface absorb the format change.

Fixes #389.
SDL12_compat.c(3030): Warning! W472: col(165) expression with side effect in sizeof discarded
SDL12_compat.c(1171): Warning! W687: col(20) expression for 'while' is always true
Previously it would adjust it without failing if SDL_ANYFORMAT was set, but
that was a misunderstanding of what this flag does; it decides if its okay
to give you a shadow surface if you have an otherwise-reasonable bpp that the
hardware doesn't support.

Real SDL1.2 would fail with an error message with bpp=232 and flags=ANYFORMAT,
as made clear to us by the tests for a perl SDL1 binding, so while this change
makes sdl12-compat less forgiving, it makes it more _correct_ to what real 1.2
would do.
Otherwise NULL pointer dereference can happen in PrepBlitDestRect()
We probably need to add this quirk for Linux and Mac, too, but I need the exe
names for those platforms.

Reference Issue #395.
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.