Jump to content

1st contact with sdl2...


Tux
 Share

Recommended Posts

I think this time it should work, I have a working test program for the gui (even if it's basic) and I am making good progress for the rest, even if it's awfully long to do... A patch of almost 900 kb so far, and it's not over, still quite a lot to do !

Things to expect :
 - no more normal blits ! This sdl2 is really different, there is almost no way to have direct access to the screen pixels like before, it's possible but not accelerated, so advised against. I'll keep the code, might be useful later to combine a scaler with something else, but for now they are gone. Those still in love with normal blits after all this time will have to stay with an old version... !
 - the yuv overlays are gone too. For them it's because they have become useless : they were 1st done as a 1st approach to scaling to fullscreen in any resolution without opengl. Well today it's very hard to find a computer without opengl, and the picture with yuv overlays is not so good, so for now they are leaving too, but they are still supported in sdl2 if they are needed one day...

So the only 2 rendering methods for now are opengl like before, and sdl2 native which uses either opengl or direct3d behind the scene, but is a lot easier to handle than native 3d programming.

What's better then ? Well small things mainly, except in windows where the gui had become unusable without opengl blits, at least it will fix this mess for sure. Except that yes the gui can be rotated when rotating the screen, very easily, even if it's not done yet. Detects when a joystick is plugged or unplugged without relaunching, and it should be easier to assign a joystick to some specific inputs (will test that later). SDL_sound doesn't require any external lib anymore which means less dlls in the archive, good thing. Since everyting is 3d now, we have real hardware transparency, so it's easy to have some animation working in the background instead of a static picture like before. This is already done in the gui test program, just for fun !
There might be some better ways to render emudx games too since flip and rotation are supported in hardware now, will have to experiment.


One of the biggest reason to upgrade for non windows users is simply the fact that this sdl2 is actively maintained contrary to sdl-1.2...
Ah also it might allow to make an android version... well it would be a non asm version of course, but it should work.

Also I hope to still be able to build the sdl-1.2 version at the end, just in case it's needed.
I did this kind of update once when moving from allegro, but it was not so violent at the time, sdl-1.2 like allegro was using bitmaps to access the screen. It's not the case anymore in sdl2, and it changes a ton of things. For the gui, it can't update just a portion of the screen, so the whole thng needs to be redrawn all the time, it's very fast so it's working well, but it completely changes the way it works internally.
Anyway I hope to see the end of it soon, since there should be bad weather in the following days, I hope to finish it then !

  • Like 2
Link to comment
Share on other sites

1st successful link, lot of things broken inside of course... sdl_sound was merged into raine for sdl2, that's what the authors seem to want, and it was impossible to get a 32 bits package out of their build system (+ no package in mingw32/mingw64 !).

  • Like 1
Link to comment
Share on other sites

Bad day for those who have some complex key configs, most of the key configs have changed, which means you need to update almost everything !
More keys are handled though...

The joystick buttons seem to be the same though...

Except that most of the work is done, opengl works fine (got a lot of trouble with DrawPixels and the overlay text in opengl which conflict with the sdl2 renderer), as expected the emulation of neogeo rasters is back to normal. Didn't test emudx yet. Still a few obvious fixes to make in the gui, and the console is totally broken, so it's not over, but most of the hard work is probably done now !

Edited by Tux
  • Like 1
Link to comment
Share on other sites

8 hours ago, Augusto said:

Any chance to allow map "up down left right" for both digital pad and left analog at same time ? Help very much with some games :😃

Yeah might be a way to do that...

Link to comment
Share on other sites

Some unexpected problems in windows, as usual I would say, a solution is in progress but it takes time... I won't have finished before the end of the week !

(for the gory details, for some reason when calling SDL_OpenAudio the callback is never called, and when calling SDL_OpenAudioDevice, SDL_PauseAudio is ignored and I must use SDL_PauseAudioDevice... ! These 2 combined made me search for a long time ! Apparently everything needs to be migrated to the new audio device api in windows, when there's no need like that in linux... ! I'll do more testing later...)

after a new session, all this mess was because the default sound driver in windows is something called "wasapi". Clearly it sticks to the device preferred setting and refuses to convert anything, for me that was 48000 Hz, samples in floats of 32 bits ! Simply unthinkable, I would have to rewrite a big part to handle this kind of samples... Forcing the directsound driver goes back to what we had with sdl-1.2, much better.
There was also some allergy between direct3d and opengl : start raine in windowed mode with a game like gunbird. Start the game, then go to fullscreen while the game runs using the keyboard shortcut. Call the gui... and bam ! Message  CreateTexture(D3DPOOL_DEFAULT): INVALIDCALL and return to desktop... ! There is a solution to that, thanks to people on the net who had the same kind of problem, there is a hint to tell sdl2 to use opengl instead of direct3d for its rendering : problem solved !

Still a few things to look into tomorrow, but it's starting to look good...

And I think the new dlls will actually make a bigger archive because the mingw32 libs use all the optional libs, which would be totally useless here, but now they must be present on disk, so there is a ton of useless stuff to add... ! At least it simplifies a lot the installation when programming raine, binary packages are convenient... !

Edited by Tux
Link to comment
Share on other sites

@Tux

I known your emulator since the begin of 2000's when the screen had the Bubble Bobble.

Speaking about old version I remember using your emulator loading Kuri Kinto. I not remember what PCB version if was USA, Japan or world set being that both sets run using japanese language in MAME. I remember using your emulator changing dip switches and not remember exactly if had enabled any game code ... Kuri Kinto had used english language in gameplay. I remember when the bosses messages being in english. After was released Raine new versions and doing the same actions not was possible run the game with english language. That game not have dip switches to change language region in MAME.

Only sharing the information above.

 

I use for a long time thus I use for some games MAME and for others your emulator.

I had posted in Retroarch about your emulator being accurate and will be good see a Raine libretro port for users wanting use Neo Geo and other machines in Retroarch.

Very good see Raine running over WINE.

 

About all above in your topic I not understand if is possible add cubeb in your SDL sound code. Not demanding, but cubeq sounds very good.

 

Edited by Augusto
Link to comment
Share on other sites

... and I got a cold. No kidding, got an electric scooter and the wind was just freezing the other morning, I didn't feel my hands anymore on arrival, and got a cold through my nose !

So finishing this might take more time, and even if the biggest part is done, there are still lots of small things to look into.

Some small improvement I noticed in sdl2 : vsync support is better in opengl (and likely in sdl2 native too), now it supports adaptive vsync if your driver supports it (you'll see if it's supported in "video info" after having run something in opengl), and more importantly, I could never fix the tearing in windowed mode before (specially visible in a game like batrider, in the intro after inserting a coin, the super big letters crossing the screens from right to left there is nothing worse than that for tearing), well now no visible tearing anymore even in windowed mode, finally ! For adaptive vsync, it's like vsync but if you've already missed the vertical retrace for a given frame, it swaps buffers immediately, which might be less jarring for the user during occasional framerate drops, which should normaly never happen in raine anyway but it can't hurt to have it.

The key configs are now saved in sections ending in config_sdl2 instead of just config before in raine.cfg and games.cfg. That's because too many keys are now different, and it's better to go back to the default keys than having most of the keys not recognized and not responding.

Also raine has never been easier to compile than now, especially in windows with mingw, I'll probably update the notes on how to compile, but in a nutshell : you get the msys2 installer, it installs 4 shells, but only 2 of them are interesting for raine, either the 32 bits or the 64 bits one, you choose your flavor, then install gcc, g++, and nasm + the basic environment tools. Then all the libs are available as packages, you just need to install git (to get raine sources, although you can get a zip file from github if you prefer), sdl2, sdl2_image, sdl2_ttf, muParser, and that's all. All this can be installed in just 1 command line using their pacman tool. After that cd to the sources directory, type make, or make -j4 if you have at least 4 cores, and after a few seconds you'll have your new binary... ! If you try that on current git sources, the makefile will build a debug build, you have to edit it to build an optimized binary, but it's explained in comments at the beginning of the file and very easy to do.

Edited by Tux
  • Like 1
Link to comment
Share on other sites

It's almost over, probably done tonight or tomorrow. It would be nice to test the opengl "anisotropic filtering", some kind of filtering which is supposed to work better, I am not sure it's good for 2d though, that's the kind of thing which is used in 3d games to make things readable in the 3d world. It's worth a try. Now I am starting to get tired, so not sure I'll test it now.
And I noticed the display of commands from the command.dat is broken, it's been broken for a few versions actually but nobody noticed. It's probably not very hard to fix, so I'll try to have a look.

The most obvious changes are in the gui, clearly, now the game starts as soon as it's loaded behind the main menu (so that you can change options like dipswitches or anything else, but at the same time the game's demo can play). If you start playing and return to the gui, then it's paused, it's a very bad idea not to pause it here, it might be in the middle of a game ! Otherwise if no game is loaded there is now a simple animation running behind the dialogs...
A lot of dialogs didn't really need any title, so only needed titles are displayed now, for those that don't need it it makes more room for the background display.

Emudx is fixed, it can be improved with the new sdl2 functions, but I'll probably keep this for later, it's enough to know it's working for now.
 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...