OS/2, eCS & ArcaOS - Technical > Programming
[SDL2] SDL_ListModes and emulation
Mentore:
You guys, something interesting here.
First of all the good news: I FINALLY got to compile a working release of FUSE, one of the best ZX Spectrum emulators available as open source https://sourceforge.net/projects/fuse-emulator/.
Configure and Make went successful but I encountered two major problems:
* the font file fuse.font used in the SDL version got broken during compilation. I solved it replacing the broken one with a pre-compiled version from a Debian distribution. OK, I cheated, but too little time to investigate on this;
* The executable crashed during SDL graphic mode initialization.
In the source file ui/sdl/sdldisplay.c there's a function named
uidisplay_init( int width, int height )
which calls SDL_ListModes like this:
modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_SWSURFACE);
where modes is of type SDL_Rect **modes; as per documentation.
I noticed that SDL_ListModes returns three available modes but only the first one seems somehow valid.
Trying to access modes[1] or modes[2] immediately crashed the program. SDL documentation was not helpful as I hoped.
The obvious solution was to force selecting modes[0] like this
#if defined (__OS2__)
mn = 0; // Remove useless warning
mw = modes[0]->w;
mh = modes[0]->h;
fprintf (stderr, "OS/2 system: resolution is %d x %d\n\r", mw, mh);
#else
...rest of original code follows...
I'm currently uploading everything on Hobbes, with source and utilities.
Did someone else encounter this problem? It seems almost like SDL2 under OS/2 works only in full screen mode. This may also explain why I can't start sUQLx (a Sinclair QL SDL emulator) in windowed mode, even if I try to force it.
Mentore
Pete:
Hi Mentore
I have not played any ZX Spectrum games in many years, would not mind having another go at pacman as I think the Speccy version was the best.
Starfighter (downloaded from hobbes) is an SDL2 game that runs in a window so SDL2 for OS/2 should not be fullscreen only.
However, Starfighter does not work with SDL2 files installed by ANPM - currently at 2.0.18-3 - but requires an earlier package http://hobbes.nmsu.edu/download/pub/os2/dev/SDL2-2.0.4-20160225.zip in order to run.
So, I guess the question is: Are you using the right variant of SDL2?
Regards
Pete
Dave Yeo:
The SDL2 rpm also works if linked against it. Are you perhaps using a 3D (OpenGL) surface? They're not supported.
Mentore:
--- Quote from: Dave Yeo on October 30, 2024, 06:18:37 pm ---The SDL2 rpm also works if linked against it. Are you perhaps using a 3D (OpenGL) surface? They're not supported.
--- End quote ---
Hi Dave,
the call to SDL_ListModes is done against a SWSURFACE so I guess it's the software renderer.
Maybe the best course of action is to take a look at the SDL2 games ported on OS/2 and see what I can do with them - I used the libraries and the runtimes taken from the RPM archive.
I won't be able to get back to my OS/2 VM until the next Monday, so I guess the next few days will be silent from this side.
Still I'm really exhalted from being able to port such a nice piece of software on OS/2, even if it's for my deep love for the ZX Spectrum.
Mentore
Mentore:
--- Quote from: Pete on October 30, 2024, 03:11:43 pm ---Hi Mentore
I have not played any ZX Spectrum games in many years, would not mind having another go at pacman as I think the Speccy version was the best.
Starfighter (downloaded from hobbes) is an SDL2 game that runs in a window so SDL2 for OS/2 should not be fullscreen only.
However, Starfighter does not work with SDL2 files installed by ANPM - currently at 2.0.18-3 - but requires an earlier package http://hobbes.nmsu.edu/download/pub/os2/dev/SDL2-2.0.4-20160225.zip in order to run.
So, I guess the question is: Are you using the right variant of SDL2?
Regards
Pete
--- End quote ---
Thanks Pete. Indeed I already saw some SDL2 games on OS/2 working in windowed mode so yes, I guess my SDL2 install might be the culprit.
Feel free to fetch one of my ZX Spectrum emulators and try them: the 'net is literally full of snapshots and tape images to play, including some really great gems of the past which still stand the test of time (remember Jetpac?).
I'll have a look at different SDL2 implementations and maybe - with a little luck - repack the software with the good one for my port.
Mentore
Navigation
[0] Message Index
[#] Next page
Go to full version