News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

SDL 3

Started by Matei, November 01, 2025, 09:49:04 AM

Previous topic - Next topic

Matei

SimcarStunts version using SDL 3 is in the attached file, details in README.txt. Anyone intersted in testing?

Duplode

Nice, I'll try it out soon.

Duplode

Quote from: Duplode on November 04, 2025, 10:51:07 AMNice, I'll try it out soon.

I tried running it, but couldn't make it work while using sdl3 from the Arch Linux repo, and didn't manage investigate further so far. Running the binary from the attachment initially gives the following error:

$ ./simcar
SDL_FRAMEBUFFER_ACCELERATION 0
>> Set BITSPERPIXEL to 24 and recompile.<<

After changing BITSPERPIXEL in graphics/grconfig.h and recompiling, the executable segfaults:

$ ./simcar
SDL_FRAMEBUFFER_ACCELERATION 0
Set 1064x600x24
Segmentation fault         (core dumped) ./simcar

Matei

Quote from: Duplode on Today at 02:32:54 PM$ ./simcar
SDL_FRAMEBUFFER_ACCELERATION 0
Set 1064x600x24
Segmentation fault         (core dumped) ./simcar

Of course it says "Segmentation fault", the functions support only 32 and 16 bits. If the game works with SDL 2, then you probably have 16 bits, so try 16 with SDL 3, but take this version:

https://matei.one/idxscr.html#download

QuoteVersion 6.2.0 supports SDL 1.2, 2.0 and 3.0, according to your preference.

If your screen is really set to 24 bits then you can only use SDL 1, but I never saw a screen working with this setting on any computer ever since I use GNU/Linux, from 2003.

Matei

"1064x600x24" actually looks like the screen is set to 32 bits (1064*24/32=798), so it shouldn't "Segmentation fault", unless there's a problem with "sdl3 from the Arch Linux repo". Maybe you have an older version, so you can try installing a newer SDL 3 from source code, see "SDL.txt". More details in file graphics/forsdl3/graph2d.c, lines 147...153.

Matei

I think I found the problem. When you started the program, it said "1064x600x24", but 1064 means a width of 798 pixels, although it was set to 800. On my computer it says "1066x600x24". The SDL function to create the window is called in file graphics/forsdl3/graph2d.c at line 139:

SDL_CreateWindow(title,width,height,0);
The graphical functions then use variables RGLOB_width and RGLOB_height set equal to width and height, but the created window is smaller, so memory for those pixels isn't available, so "Segmentation fault". I don't know how to find the parameters of the window:

https://wiki.libsdl.org/SDL3/SDL_GetWindowSurface

Doesn't say. I can set RGLOB_width and RGLOB_height to smaller values than width and height after creating the window, but this is not reliable. Does the problem occur in the same conditions if the image is set to full screen ("fullscr=1" in file "config") or with SDL 2?