SDL2 support

153 views
Skip to first unread message

sergio-br2

unread,
Mar 20, 2015, 12:26:18 PM3/20/15
to cabrio...@googlegroups.com
Hi, I ported cabrio to SDL2, it seems it's working:

https://github.com/sergiobenrocha2/cabrio/tree/SDL2

The diff: https://github.com/fredbcode/cabrio/compare/master...sergiobenrocha2:SDL2

It's based on the fred fork.

I noticed only an issue with joystick, analog axis is not working.

Steve, it could be nice if you merge stuff from fred and release 0.9 or even 1.0  :)

sergio-br2

sergio-br2

unread,
Mar 21, 2015, 7:03:06 PM3/21/15
to cabrio...@googlegroups.com
The joystick issue is related to this:

https://bugzilla.libsdl.org/show_bug.cgi?id=2438

It's losing SDL_JOYBUTTONDOWN events too.

So, if you Alt+Tab and come back to cabrio, joystick will work again.

For some reason, Lazy Foo's example works very well: http://lazyfoo.net/tutorials/SDL/19_gamepads_and_joysticks/index.php

sergio-br2

sergio-br2

unread,
Mar 23, 2015, 1:34:38 AM3/23/15
to cabrio...@googlegroups.com
Other workaround for the joystick issue: open cabrio by the desktop entry, in your system menu. It will work on the first try.

Or... wait for SDL 2.0.4.

Things fixed/new:

-- <width> and <height tags> are optional now, if you use <full-screen> tag. Cabrio use SDL_GetDesktopDisplayMode to know the right resolution;
-- added support for filter events, for now it only filters SDL_TEXTINPUT event. So you can add noisy or unusable events in event_filter(), event.c;
-- fixed SDL_PollEvent() call, it was calling once per frame. Change 'while' to 'if' in event_poll(), and you'll see some slowdown in Cabrio right after you mess with an unused input, like joystick analog axis, and try to up or down the list.

sergio-br2

Fred B

unread,
Apr 13, 2015, 6:03:54 AM4/13/15
to cabrio...@googlegroups.com

Hi Sergio, About your PPA, there is created with libsdl2.0.4 beta ?

sergio-br2

unread,
Apr 14, 2015, 12:39:38 PM4/14/15
to cabrio...@googlegroups.com
No, it uses SDL2 from the system/ubuntu repo, i.e.:

14.04 --> 2.0.2+dfsg1-3ubuntu1.1
14.10 --> 2.0.2+dfsg1-3ubuntu2
15.04 --> 2.0.2+dfsg1-6ubuntu2

There is this PPA: https://launchpad.net/~zoogie/+archive/ubuntu/sdl2-snapshots
Maybe it fixes the joystick issue?

sergio-br2

Numsys

unread,
Apr 14, 2015, 12:43:53 PM4/14/15
to cabrio...@googlegroups.com


Le 14/04/2015 18:39, sergio-br2 a écrit :
No, it uses SDL2 from the system/ubuntu repo, i.e.:

14.04 --> 2.0.2+dfsg1-3ubuntu1.1
14.10 --> 2.0.2+dfsg1-3ubuntu2
15.04 --> 2.0.2+dfsg1-6ubuntu2

There is this PPA: https://launchpad.net/~zoogie/+archive/ubuntu/sdl2-snapshots
Maybe it fixes the joystick issue?

sergio-br2



Maybe, but this is not the latest version

libsdl2-image 52 weeks ago

sergio-br2

unread,
Apr 14, 2015, 2:16:22 PM4/14/15
to cabrio...@googlegroups.com
That SDL2 PPA is broken, don't try.

I built here SDL last version (4bab88dd387e, 04/13) and same issue, it seems it's not fixed yet.

sergio-br2

sergio-br2

unread,
Apr 14, 2015, 7:53:57 PM4/14/15
to cabrio...@googlegroups.com
Try add this in the code:

In sdl_wrapper.c:

void sdl_focus( void ) {
    SDL_Window *windowTest = SDL_GetKeyboardFocus();
    if ( windowTest == window )
        printf("\nWindow focused!!!\n");
    else
        printf("\nWindow NOT focused.\n");
}


In include/sdl_wrapper.h:

void sdl_focus( void );


In event.c:

while( SDL_PollEvent( &sdl_event ) ) {
    sdl_focus();
    event_num = EVENT_NONE;
    [...]

So after open cabrio, you'll se "Window NOT focused." after each event, then Alt+Tab out and Alt+Tab back, or click in some window and come back to cabrio, you'll se "Window focused!!!"

It seems the window is not focused at first. I tried to get focus with SDL_RaiseWindow(), but it didn't work. Any idea to workaround it?

sergio-br2

unread,
Apr 15, 2015, 1:06:18 AM4/15/15
to cabrio...@googlegroups.com
Finally found an workaround for this issue: just add SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS=1 as environment variable, or call cabrio with:

SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS=1 cabrio

I'll update the .desktop file


sergio-br2

Fred B

unread,
Apr 15, 2015, 10:32:14 AM4/15/15
to cabrio...@googlegroups.com
Ok the bug is fixed on the latest version  SDL_SetHint("SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS", "1"); in event.c
I will release Livemamecab soon

Thanks Sergio

Fred B

unread,
Apr 16, 2015, 1:22:55 PM4/16/15
to cabrio...@googlegroups.com
Ok I'm pushing the new iso with your changes and some fixes, here http://traceroot.c.la

Still works to do

- Fix memory leaks (at least with video)
- Make a theme by list

michael mapes

unread,
Jan 9, 2016, 1:13:38 AM1/9/16
to Cabrio FE Development
I have still been wanting to run cabrio on a cubie board, and it is the closest to running other than retroarch. Both are giving me a warning  "libgl error: unable to load driver : mali_drm_dri.so"
then they load but ever so slow. I am assuming that the mali drivers are not doing their hardware enhanced magic. I have a cubieboard 2 and i am working in cubieez a debian based distro. I sure would love it if this started magically working. Any and all tips would be greatly appreciated. Thanks.
cabrio error.jpg
Reply all
Reply to author
Forward
0 new messages