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,136
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,136
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: 340

notimp

Well-Known Member
Member
Joined
Sep 18, 2007
Messages
5,779
Trophies
1
XP
4,420
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,136
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: 257
Last edited by nop90,

notimp

Well-Known Member
Member
Joined
Sep 18, 2007
Messages
5,779
Trophies
1
XP
4,420
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,136
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,136
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: 253

Anfroid

Well-Known Member
Member
Joined
Sep 30, 2011
Messages
530
Trophies
1
XP
2,319
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
  • BigOnYa @ BigOnYa:
    It would be funny to pick up a girl in a real expensive car, then next date show up in a piece o shit car just to see her reaction. If she was real, it wouldn't matter.
  • Psionic Roshambo @ Psionic Roshambo:
    Everyone is disposable and replaceable, lies and deception are the coin of the realm. I have never felt so alone and so at odds with the world.
  • K3Nv2 @ K3Nv2:
    I don't think we should see others as disposable just if they can show any glimps of care about humanity should be forgiven
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, she would leave you inmediately
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    For a time I considered creating a new big bang. Wipe the slate clean and start from scratch....
  • K3Nv2 @ K3Nv2:
    Your closest friend probably talks negative about you the most
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    I know I talk shit about that Ken guy constantly lol
    +1
  • K3Nv2 @ K3Nv2:
    Yeah I just had to consile it's a age thing and I can get erect
    +1
  • BigOnYa @ BigOnYa:
    Right.. Take a number
  • SylverReZ @ SylverReZ:
    @BigOnYa, Binkinator is still around you guys. I just saw him in one of the Discord servers that I'm in.
    +1
  • K3Nv2 @ K3Nv2:
    People get more mad when they learn you aren't as dimwitted as they think
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, that guy who was dissappeared?
  • Psionic Roshambo @ Psionic Roshambo:
    My favorite thing about that Ken, if they talk bad about others to you. They doing it to you too.
  • Psionic Roshambo @ Psionic Roshambo:
    Always remember that
  • K3Nv2 @ K3Nv2:
    More or less then they drop you and blame you when you find out
  • Psionic Roshambo @ Psionic Roshambo:
    Well taking responsibility for their own actions would mean doing work and self reflection lol easier to just be a pile of crap rolling down hill
  • Xdqwerty @ Xdqwerty:
    @SylverReZ, I dont mean to be rude but what was so important about them?
  • SylverReZ @ SylverReZ:
    @Xdqwerty, He truly shared his great knowledge about Switch modding.
    +1
  • SylverReZ @ SylverReZ:
    People miss him because he used to be active a lot.
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    I modified a switch in a bathroom one time by wiping poop on it... Lol
  • K3Nv2 @ K3Nv2:
    Been noticing it more these days alot has to do with coperation attitude manipulation people work in it so long they think it's a good way to live
    +1
  • BigOnYa @ BigOnYa:
    And he/she used to do any/every mod to the Switch, just to learn and teach others as well. A true Switch genius.
    +1
    BigOnYa @ BigOnYa: And he/she used to do any/every mod to the Switch, just to learn and teach others as well. A... +1