I followed the github issue and looked ok from my perspective too.

On Sun, 11 Apr 2021 at 01:47, Bryan Steele <[email protected]> wrote:
>
> On Sat, Apr 10, 2021 at 08:39:07PM -0400, Bryan Steele wrote:
> > On Sat, Apr 10, 2021 at 04:56:55PM -0700, Nam Nguyen wrote:
> > > solene@ reported that games/barony has missing textures.[1] Here is a
> > > diff fixing this sourced from a PR by Sylvain Becker.
> > >
> > > I used hg bisect to track down the revision in sdl2's repository that
> > > introduced this bug.[2] I contacted Sylvain Becker, the author of the sdl2
> > > commit. Sylvain fixed barony's usage of sdl2.
> > >
> > > The bug is with barony's modification of refcount, which is
> > > read-only. The fix uses userdata to stash imgref.
> > >
> > > I tried to understand the fix, but more eyes are welcome.
> > >
> > > Details
> > > =======
> > >
> > > >From /usr/local/include/SDL2/SDL_surface.h, refcount is read-only.
> > >
> > > /** Application data associated with the surface */
> > > void *userdata;             /**< Read-write */
> > > /** Reference count -- used when freeing surface */
> > > int refcount;               /**< Read-mostly */
> > >
> > > Important variables:
> > > userdata: used to store imgref (the id) of a surface
> > > imgref: global Uint32 used to index into allsurfaces, an array of
> > >   GL_Surface pointers[3][4]
> > > refcount: read-only field in SDL_Surface used to count how many
> > >   references are made to a GL_Surface. See deleted comments in 1107-1113
> > >   in SDL_pixels.c.[2] It is probably used for some other purpose in the
> > >   implementation now that is deleted.
> > >
> > > Testing
> > > =======
> > >
> > > Textures work now with epic game assets downloaded on September 5,
> > > 2020. Feedback and tests are welcome. OK?
> > >
> > > Footnotes:
> > > [1] https://github.com/TurningWheel/Barony/issues/580
> > > [2] 
> > > https://github.com/libsdl-org/SDL/commit/ebc12a2fd2bb692908884e7db6cc935941a591f2#diff-98a8d948613c29516e252e8134aee43ba14fb7bcd6457d29be3ba99861fd80bcL1107
> > > [3] Barony-3.3.7/src/main.cpp:344:Uint32 imgref = 1
> > > [4] src/init.cpp:354: allsurfaces = (SDL_Surface**) malloc
> >
> > I tested this and can confirm this fixes the texture loading problem
> > and makes Barony 3.3.7 playable again, thanks for working with the
> > upstream SDL2 developers to find and fix this Nam!
> >
> > ok brynet@ at least, but will also need approval by solene@ (maintainer)
> > and also naddy@ because of the upcoming ports tree lock.
> >
> > -Bryan.
>
> Whoops, sorry solene@.
>
> MAINTAINER =    David Carlier <devnexen@...>
>

Reply via email to