Deprecated: Function create_function() is deprecated in /home/customer/www/ on line 811

1 (edited by parasti 2013-10-20 02:10:44)

Topic: SDL2 port

Hello, I'm back!

As you may know, GNU/Linux developers love to break things... Now, they are breaking the desktop by getting rid of X11 and replacing it with Wayland. Here's some reading for you.

This new technology is really exciting, but breaks compatibility with current applications that depend on X. This means that Neverball may not run in a near future, but there will be a compatibility layer called xwayland, yuck, that's not nice. To get it run natively we need to port it to SDL2 ! And that's what I done with some hours of my time.

There's still some bugs left and I need some testers to help find them. As SDL2 is still not officially released, you'll need to compile it by yourself.

Here's the source code:

Have fun!

Note by parasti: the SDL2 port is now official and fully functional. Look further in the thread for the latest builds.

Warning: count(): Parameter must be an array or an object that implements Countable in /home/customer/www/ on line 814


Re: SDL2 port

Great work, Can you test it on other platforms apart from Linux yet?

Currently Playing:
Celeste and Electronic Super Joy

Deprecated: Function create_function() is deprecated in /home/customer/www/ on line 811

3 (edited by GeeckoDev 2013-07-24 14:55:42)

Re: SDL2 port

I didn't yet, but it should be working out-of-the-box. I would be great to spot the remaining bugs.

I'm currently trying to run it under Wayland. I got a black window without graphics, which is not nice, but keyboard and mouse input seems to be working because I'm hearing the menu sounds.

EDIT: Nice, it seems that prebuilt SDL2 (updated daily) can be found here for Windows and OSX:


Re: SDL2 port

If you can cross-compile to either Windows or Mac, I'll gladly test it for you.

Currently Playing:
Celeste and Electronic Super Joy


Re: SDL2 port

Compiling it under Windows is a pain in the ass, so I'll try to compile it on my Hackintosh big_smile


Re: SDL2 port

Will test it on real iMac hardware :-)

and then...

Only three weeks now until I build my new Mountain Lion Core i5 Ultra-Hackintosh. With the 256GB Samsung 840 Pro, it will be a fairly ZIPPY machine.

Currently Playing:
Celeste and Electronic Super Joy


Re: SDL2 port

Holy crap, it seems that building it under OS X is even worse than on Windows. Build may be ready in a few hours.


Re: SDL2 port

I kind of gave up with OS X for now, but Linux-side, Neverball and Neverputt are now running on Wayland/Weston !

I only needed to update SDL and it worked big_smile


Re: SDL2 port

Very nice. Great work.

The transition to SDL2 is an important direction in general. Wayland compatibility is delicious gravy.

I haven't started doing any significant work with SDL2 yet, but do you think it might help to improve our multi-head support? I'd really love to be able to choose a display device by name in the config GUI, and have the game go fullscreen on it. Is that goal any closer with SDL2? (As with most things, this type of capability is handled by environment variables in SDL1, outside of the game.)


Re: SDL2 port

Wow, it's been a while, sorry.

I asked icculus about this (he's one of the main maintainer of the SDL library) :

According to the documentation, I think your wishes will become true. But, the SDL2 port needs some more polishing, particularly with the broken text input.


Re: SDL2 port

themacmeister wrote:

...until I build my new Mountain Lion Core i5 Ultra-Hackintosh.

Pls note: Have 8-core MacPro 4,1 - 16GB RAM instead -- at about $1000 cheaper, with no building required.

Currently Playing:
Celeste and Electronic Super Joy


Re: SDL2 port

What about speeding things and getting ready for a new stable release?

@themacmeister You must be very proud of your computer. :3


Re: SDL2 port

@GeeckoDev -- Yeah, if it ever gets DELIVERED!!!

Getting impatient, but eBay estimated Oct 2 - Oct 8, so I'm getting angry prematurely smile

Currently Playing:
Celeste and Electronic Super Joy


Re: SDL2 port

Just an FYI. I took GeeckoDev's code and have been poking at it for the past week. It's pretty much complete, I just have to go over it and clean up the patches before committing to SVN. For now you can get the code on Github:

You'll also need SDL2 and SDL2_ttf (the latter of which you might have to compile from source).

I implemented a display selection GUI, so be sure to check that out. I have a 2 monitor setup, so I have been able to test it and it should work. Fullscreen works completely differently now, too. I'd actually love feedback on both of those, as that has historically been a really finicky part of SDL. I also haven't done any testing on Windows yet.

15 (edited by GeeckoDev 2013-10-06 13:25:06)

Re: SDL2 port

I will happily test it. WOO, parasti!

Edit: I reviewed each commit and I'm amazed by the amount of work done in such a short time :3

Edit2: Everything seems to work fine so far. The broken text input is fixed. I have to test it with a multi-monitor setup.


Re: SDL2 port

Nice, thanks for having a look at it.

There are actually not that many changes that were required for the port itself. It's just that SDL2 makes a lot of our old workarounds obsolete, and I couldn't resist doing mostly unrelated restructuring of some GUI code in the last couple of commits.

17 (edited by GeeckoDev 2013-10-06 15:29:25)

Re: SDL2 port

It's good. Really good. Multi-head support, wayland compatibility, and no more keyboard grab when going fullscreen (= alt+tab and hotkeys finally working), yay!

On a totally different note, what about migrating from SVN to git and making a GitHub mirror of it, just like the GNOME project did? I'm sure it would attract many new contributors smile

Edit: Multi-head seems to work well, too. Just one detail though, when I go to overview mode in gnome-shell from fullscreen, the window appears at the same size than before going fullscreen. Like this (800x600 window -> 1366x768 fullscreen)

Edit2: Nevermind, FEZ which is based on SDL2 has the exact same issue.


Re: SDL2 port

No idea how the overview works. I guess it involves window resizing? We don't handle that at all. It would be nice to, since our "resolution switching" now consists of "make a new window of this size" (basically a terribly inefficient way to resize a window) and fullscreen is always desktop-sized. My OpenGL is a little rusty, so I'm not sure if or when I'll get around to that.


Re: SDL2 port

SDL2 stuff has been committed to SVN. Unless my patch cleanups broke something, this is the exact same code that I put on Github. So, please test, if you haven't. Windows build is incoming ASAP.


Re: SDL2 port

Here's a Windows build:

Things to test would be text input, everything in the options screen, especially fullscreen and display switching (even if you only have one monitor).

It has HMD support compiled in as well, where you can blow your mind even without owning an Oculus Rift.


Re: SDL2 port

Unfortunately, the provided build doesn't work for me. When trying to run neverball.exe, I get an error "The procedure entry point wcscat_s could not be located in the dynamic link library msvcrt.dll." This is on a 32-bit Windows XP SP3 system.

From some short tests using my own Windows build of the SDL2-based trunk, my impression is that things generally work as expected.

Not sure about the new resolution handling, though. Tying fullscreen mode to the size of the desktop is a restriction that would bother me if I were still an active Neverball user since my desktop resolution is not identical to the resolution I'd like to play the game at. The resolution selector also lists several modes that my monitor doesn't support. I was going to blame SDL for misreporting them, but then I saw that they're actually hardcoded in st_common.c. I'm afraid I can't do any multi-monitor tests, but the one display I have was reported correctly.

As for text input, only minor issues. In the title screen, many non-alphanumeric keys (including the arrow keys) will disrupt the cheat mode activation queue when pressed. In screens using the on-screen keyboard, there's no longer a menu sound when entering characters using the actual keyboard. Intentional? Backspace, being handled differently, still beeps, though. On the plus side, the Alt+Numpad input method (e.g., Alt+0227 => ã) works now. The player name screen no longer restricts the length of the string while the score system still uses a MAXNAM of 9 – didn't check whether this actually leads to any problems.

Pressing Alt+F4 didn't close the program; turns out that WIN32 wasn't defined in my build environment. (All other #ifdefs in the code use _WIN32.) Also, is there still a valid rationale for not setting a window icon on Windows? When removing the check, the icon showed up OK with alpha intact.


Re: SDL2 port

Thanks, this is good feedback (wish there was more of it coming in).

Yes, the Oculus SDK doesn't support Windows XP. I'm sure their use of wcscat_s is only the tip of the iceberg.

I wish there was a way to keep SDL 1.2 fullscreen as an option, but there really isn't one that doesn't involve platform-specific hacks that I specifically wanted to avoid by migrating to SDL 2. Thankfully the fullscreen desktop mode that we use now is vastly better in most regards, fixes every issue that ever existed in SDL 1.2 fullscreen (multi-monitor problems, window manager keys not working, desktop mode not getting restored on Linux), but does so at the cost of having to do manual resolution scaling.

As you have probably noticed I didn't actually implement that part. So right now the resolution screen is just a fancy way to resize the window to a standard size. We only use the desktop display mode for fullscreen, which is why it no longer makes sense to list the display modes of your monitor and allow switching to them while in fullscreen.

I committed fixes for a few of these. The typing sounds I didn't notice missing, that won't be as straightforward to fix. (I'm curious, though, why would missing sounds be intentional?)


Re: SDL2 port

Windows and Mac OS X users have runtime binaries for 2.0 ->

?? No need to compile it again ??

Currently Playing:
Celeste and Electronic Super Joy


Re: SDL2 port

parasti wrote:

I wish there was a way to keep SDL 1.2 fullscreen as an option, but there really isn't one that doesn't involve platform-specific hacks that I specifically wanted to avoid by migrating to SDL 2.

I guess that being on Windows, I have been spared most of the fullscreen trouble that exists on other platforms. Unfortunately, even with scaling, the new system doesn't allow for running the game at something higher than the desktop resolution (without cropping or losing detail) so there's less flexibility in this regard.

That said, I did notice a trend lately of games simply using the desktop mode and no longer offering alternatives. Always seemed somewhat lazy to me, but perhaps it's the way things are moving. For my anti-fork I'll just wait and see which direction the upcoming LWJGL 3 will take.

(I'm curious, though, why would missing sounds be intentional?)

I thought it likely that you would have noticed the missing sounds during testing, so the fact that they weren't restored pointed to it possibly being on purpose. Typing text doesn't interact with UI widgets the way that clicking the character buttons does, so the rationale might have been that therefore it didn't warrant a menu sound. (Hey, I was just trying not to yell "BUG!" prematurely.)


Re: SDL2 port

Oh, I see -- sorry about my previous post, you gave the SDL2 link for COMPILE, I didn't realise it was the Neverball source that required compiling... my bad, my stupid.

Currently Playing:
Celeste and Electronic Super Joy