WIP SDL 1.2.15 for Switch (libnx based)

Discussion in 'Switch - Exploits, Custom Firmwares & Soft Mods' started by nop90, Feb 24, 2018.

  1. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    11
    Jan 11, 2014
    Italy
    Rome
    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, Mar 5, 2018
    Don Jon, lordelan, cearp and 26 others like this.
  2. zoogie

    zoogie playing around in the dsiware

    Member
    20
    Nov 30, 2014
    Micronesia, Federated States of
    Fantastic! Looking forward to progress on the GPU front.
     
    KiiWii likes this.
  3. ploggy

    ploggy WAKA! WAKA!

    Member
    12
    Aug 29, 2007
    United Kingdom
    Can someone say MUGEN ;)
    Thanks man :)
     
    lordelan, Don Jon and Linkuei like this.
  4. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    11
    Jan 11, 2014
    Italy
    Rome
    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.
     

    Attached Files:

    • test.zip
      File size:
      1,008.3 KB
      Views:
      65
    julialy, ShadowOne333 and Masterwin like this.
  5. Kojote

    Kojote Member

    Newcomer
    1
    Sep 27, 2015
    Australia
    Salzburg
    Great news my friend :) Seems the door is open to get many nice homebrew games to the Switch sometime soon.
     
    nop90 likes this.
  6. notimp

    notimp GBAtemp Advanced Fan

    Member
    6
    Sep 18, 2007
    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.
     
    lordelan and nop90 like this.
  7. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    11
    Jan 11, 2014
    Italy
    Rome
    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.
     

    Attached Files:

    • test.zip
      File size:
      234.4 KB
      Views:
      26
    Last edited by nop90, Feb 25, 2018
  8. kumikochan

    kumikochan GBAtemp Addict

    Member
    9
    Feb 4, 2015
    Belgium
    Tongeren
    Nice would love to play The Legend of Sword and Fairy on my switch. Played it on my vita and it's an amazing game
     
  9. Anfroid

    Anfroid GBAtemp Fan

    Member
    4
    GBAtemp Patron
    Anfroid is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Sep 30, 2011
    United States
    Got the same thing.
     
  10. notimp

    notimp GBAtemp Advanced Fan

    Member
    6
    Sep 18, 2007
    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, Feb 25, 2018
    PCityPaul likes this.
  11. kumikochan

    kumikochan GBAtemp Addict

    Member
    9
    Feb 4, 2015
    Belgium
    Tongeren
    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
     
  12. fatsquirrel

    fatsquirrel GBAtemp Addict

    Member
    10
    Nov 11, 2013
    Great news, keep up the good work. The rate that things are coming out at is crazy...
     
  13. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    11
    Jan 11, 2014
    Italy
    Rome
    Someone please text the attached nso. Made a small change.
     

    Attached Files:

    • test.zip
      File size:
      234.4 KB
      Views:
      35
  14. Maufeat

    Maufeat Member

    Newcomer
    2
    Sep 3, 2015
    Germany
    WebDev
    Whats supposed to happen? The .nro file just shows black screen on my Switch.
     
  15. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    11
    Jan 11, 2014
    Italy
    Rome
    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, Feb 25, 2018
    lordelan likes this.
  16. nop90
    OP

    nop90 GBAtemp Advanced Maniac

    Member
    11
    Jan 11, 2014
    Italy
    Rome
    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
     

    Attached Files:

    • test.zip
      File size:
      237.4 KB
      Views:
      40
  17. Don Jon

    Don Jon GBAtemp Advanced Fan

    Member
    6
    Nov 20, 2015
    United States
    love mugen but not familiar with its porting abilities
    could you elaborate kind sir?
     
  18. ploggy

    ploggy WAKA! WAKA!

    Member
    12
    Aug 29, 2007
    United Kingdom
    Iirc Mugen uses Sdl as it's base so hopefully with this sdl implementation, Mugen could make its way onto Switch ;)
     
    lordelan and Don Jon like this.
  19. Anfroid

    Anfroid GBAtemp Fan

    Member
    4
    GBAtemp Patron
    Anfroid is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Sep 30, 2011
    United States
    Squares showed up properly but pressing A still crashed my switch.
     
  20. Technicmaster0

    Technicmaster0 GBAtemp Psycho!

    Member
    8
    Oct 22, 2011
    Gambia, The
    Same for me. Error Code: 2162-0002
     
Loading...