Hacking WIP SDL 1.2.15 for Switch (libnx based)

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
SDL_logo.png

I started working on a SDL 1.2 port for Switch, reusing the code from my 3ds port.

The link for the initial port is: (removed for project refactoring using a fork of the official SDL repository... stay tuned)

I also started a collection of portlibs: (repo removed since an official package is to be released soon)

At the moment I don't have a Switch and can't test the code myself, so any help for testing the code would be very apreciated.

Changelog

v0.2 - (02/03/2018)
- Added 8bpp 16bpp and 24bpp video mode
- Added touch screen handling (mapped to mouse events)
- Added automatic download an install of SDL_image SDL_gfx SDL_TTF and SDL_Mixer

v0.1 - (24/02/2018)
in the first release there is a basic video 32 bpp driver and key input events handler.

Installation

Install the needed portlibs (https://github.com/Nop90-Switch/Switch_portlibs)

Run make all & make install on the provided Makefile. This will compile the SDL lib , download and install SDL_image SDL_gfx SDL_TTF and SDL_Mixer and instal everything in the portlibs directory of your devkitA64 toolchain.

To use the libs remember to declare all the libraries dependencies in you makefile ( refer to the standard SDL 1.2 documentation or look at my ported SDL games).

Known Bugs

- Exiting the homebrew using the SDL libs the HBL crashes

To Do List

- Joystick spport
- Audio support
- Thread support

Games using SDL 1.2 for switch
Fruity- Ported by @Nop90 (GBATemp Link)
 
Last edited by nop90,

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
Attached a minimal SDL program (source and nro/nso).

It simply should draw a small 10x10px square in the top-right corner, than loop till tha A key is pressed.

The prognam runs fine on yuzu and the input handlig works. But nothing renders.

Please test the program on a real switch and tell me if the sceen remauns balck or the square is visible.

Thanks.

PS: if the video uoput works, please exit the program after few seconds (press A) because in this code the screen isn't refreshed and I dont want that any LCD damage occours to your Switches.
 

Attachments

  • test.zip
    1,008.3 KB · Views: 335

notimp

Well-Known Member
Member
Joined
Sep 18, 2007
Messages
5,779
Trophies
1
XP
4,419
Country
Laos
Attached a minimal SDL program (source and nro/nso).

It simply should draw a small 10x10px square in the top-right corner, than loop till tha A key is pressed.

The prognam runs fine on yuzu and the input handlig works. But nothing renders.

Please test the program on a real switch and tell me if the sceen remauns balck or the square is visible.
The .nro results in a black screen. No Square is rendered. If you press A the switch hard crashes with errorcode 2162-0002. Results reproduced twice. .nro launched with HBL.
 
  • Like
Reactions: lordelan and nop90

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
The .nro results in a black screen. No Square is rendered. If you press A the switch hard crashes with errorcode 2162-0002. Results reproduced twice. .nro launched with HBL.

Pressing A the app exit, this means the Key handlig is working. It crashes probably because I missed deiniting something. It's hard to code without testing.

For the missing rendering, I'll try to find the cause in the sources.

Thanks.
 

Attachments

  • test.zip
    234.4 KB · Views: 253
Last edited by nop90,

notimp

Well-Known Member
Member
Joined
Sep 18, 2007
Messages
5,779
Trophies
1
XP
4,419
Country
Laos
If you are a Generation Y'er, how about not highjacking all posts with your *feels* of how *nice* things are, and how *soon* things must be happening, because you just *feel* it, calling everyone you hardly interacted with a *friend* and how that one Saturn game you played on Vita was lovely - because the port had the letters SDL in it as well. (edit SDL is closely linked to cross plattform ports of games developed with that layer, to different platforms. I didn't know that. The last nag was misplaced, I'm sorry.)

Context (you didnt provide): http://wololo.net/2017/11/29/legend-sword-fairy-ported-psvita-play-famous-chinese-rpg-english-vita/

I was just thinking of how swell a world would be, where people didnt just say pleasentries, because they wanted to compliment-nudge you into doing what they want.

That said, that chinese RPG does look nice... ;)
 
Last edited by notimp,
  • Like
Reactions: PCityPaul

kumikochan

Well-Known Member
Member
Joined
Feb 4, 2015
Messages
3,753
Trophies
0
Age
36
Location
Tongeren
XP
3,311
Country
Belgium
If you are a Generation Y'er, how about not highjacking all posts with your *feels* of how *nice* things are, and how *soon* things must be happening, because you just *feel* it, calling everyone you hardly interacted with a *friend* and how that one Saturn game you played on Vita was lovely - because the port had the letters SDL in it as well. (edit SDL is closely linked to cross plattform ports of games developed with that layer, to different platforms. I didn't know that. The last nag was misplaced, I'm sorry.)

Context (you didnt provide): http://wololo.net/2017/11/29/legend-sword-fairy-ported-psvita-play-famous-chinese-rpg-english-vita/

I was just thinking of how swell a world would be, where people didnt just say pleasentries, because they wanted to compliment-nudge you into doing what they want.

That said, that chinese RPG does look nice... ;)
Well i assure you that i'm one of the last people you should expect a compliment from and especially nudging them in doing what i want. I don't feel that entitled sorry. I'm not one of those whiners believe me
 

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
Whats supposed to happen? The .nro file just shows black screen on my Switch.
Discovered that I can use Ryujinx to test the SDL code, and so I was able to debug the code and find the bug (I'm not setting the video sceen as a HW Surface, so rendering function is not called).

I'll fix the SDL code tonight.
 
Last edited by nop90,
  • Like
Reactions: lordelan

nop90

Well-Known Member
OP
Member
Joined
Jan 11, 2014
Messages
1,556
Trophies
0
Location
Rome
XP
3,036
Country
Italy
In Ryujinx now the rendering works fine.

Please check the nso in the attached file, you shouls see a 30x30px white swuare with a smaller purple square inside, and pressing A the code should exit to HBL (now the program should exit without crashing).

Sorry for all the requestes of today, if this works I'll continue testing on the emulator.

Thanks
 

Attachments

  • test.zip
    237.4 KB · Views: 247

Anfroid

Well-Known Member
Member
Joined
Sep 30, 2011
Messages
530
Trophies
1
XP
2,275
Country
United States
In Ryujinx now the rendering works fine.

Please check the nso in the attached file, you shouls see a 30x30px white swuare with a smaller purple square inside, and pressing A the code should exit to HBL (now the program should exit without crashing).

Sorry for all the requestes of today, if this works I'll continue testing on the emulator.

Thanks
Squares showed up properly but pressing A still crashed my switch.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Sicklyboy @ Sicklyboy: *teleports behind you* "Nothing personnel, kiddo"