Generate RetroArch NSP Forwarders (with proper icon and title)

Discussion in 'Switch - Tutorials' started by natinusala, Jan 13, 2019 at 7:48 PM.

  1. natinusala
    OP

    natinusala Win32 error 31 is not an error

    Member
    10
    Dec 1, 2012
    France
    This tutorial will show you how to generate a RetroArch NSP Forwarder. The end result is a game on your HOME menu, and when you open it RetroArch is launched with the game directly running. Here's a video showing what it looks like (video by @bobdamnit).

    I may or may not make an automated version of it, in a nice GUI, without any external dependency required. Time will tell. If someone wants to do it, go ahead.

    1. What's needed
    • The latest release of hacBrewPack : https://github.com/The-4n/hacBrewPack/releases
    • keys.dat (I recommend using Lockpick to dump it)
    • The latest release of my modded hbloader : https://github.com/natinusala/nx-hbloader-retroarch-forwarder-mod/releases (build.zip)
    • The core (NRO) and the game you want to forward on your SD card (download the core through RA's online updater)
    • A 256x256 JPG icon of the game you want to forward (I suggest that you make your own)
    • (optional) a PNG to be displayed in the top-left corner of the screen while loading (normally Nintendo logo) and a GIF to be displayed in the bottom-right corner (normally an animated Switch logo)
    2. Creating the NSP

    Extract hacBrewPack somewhere and follow these steps:
    • copy your keys.dat where hacbrewpack.exe is
    • copy both "control" and "exefs" from my modded hbloader to the folder where hacbrewpack.exe is
    • inside the new "control", copy your 256x256 JPG and rename it "icon_AmericanEnglish.dat"
    • create a folder called "logo" where hacbrewpack.exe is
    • now the important part: create a folder called "romfs" where hacbrewpack.exe is
      • inside, create two files: "nextNroPath" and "nextArgv"
      • in "nextNroPath", write the path to the core on your SD card starting by "sdmc:" (for example sdmc:/retroarch/cores/quicknes_libretro_libnx.nro)
      • in "nextArgv", write the path to the core on your SD card starting by "sdmc":, followed by a whitespace and the path to the game on your SD card between quotes (for example sdmc:/retroarch/cores/quicknes_libretro_libnx.nro "sdmc:/roms/nes/Super Mario Bros. 3 (USA).nes")
      • Be sure not to put newlines in the end of any of those files
    • Open cmd in the folder where hacbrewpack.exe is and run "hacbrewpack.exe --titleid <title id> --titlename <game name> --titlepublisher <game publisher>"
    • If everything went fine, you should have your NSP in the "hacbrewpack_nsp" folder (called by its title id)
    3. How does it work?

    If a content path is set in argv when running RetroArch, the content is loaded instead of opening the menu.

    This is a simple mod of hbloader which reads the NRO path ("nextNroPath") as well as argv ("nextArgv") from its romfs.
    1. you run the title
    2. hbloader starts
    3. hbloader reads the NRO path and its arguments from its romfs
    4. hbloader starts the NRO (the core), giving the arguments (the content path)
    5. The core is started, and loads the content given in arguments
    "But why use romfs, you could have directly set the path in the code" I hear you ask. I used romfs because I wanted to be able to change the core and content path without rebuilding hbloader, for an eventual automated tool.
     
    Last edited by natinusala, Jan 15, 2019 at 11:38 PM
    JJTapia19, wizra, Tommy084 and 27 others like this.
  2. ScarletDreamz

    ScarletDreamz [Debug Mode]

    Member
    11
    Feb 16, 2015
    United States
    California
    Alright, then this is a forwarder for HBLoader, honetly, never saw this method coming, since we have the libretro source.

    Wouldn't be easier to just modify the arguments on the RetroArch NSP from libretro to pass the arguments to select a core + a rom?
     
    Last edited by ScarletDreamz, Jan 13, 2019 at 8:46 PM
    Cybernatus and Mrdx like this.
  3. Mrdx

    Mrdx Advanced Member

    Newcomer
    4
    Dec 12, 2013
    Antigua and Barbuda
    This method is indeed very tedious but it works! I hope we'll get an automated one-button tool soon
     
    Azel likes this.
  4. shrinerlp

    shrinerlp Member

    Newcomer
    3
    Oct 4, 2007
    Cyprus
    exactly what I wanted, thank you!
     
  5. natinusala
    OP

    natinusala Win32 error 31 is not an error

    Member
    10
    Dec 1, 2012
    France
    What do you think the RetroArch NSP from libretro is ? It's exactly the same as I did, it's the same as nro2nsp, it's the same as any homebrew NSP out there. They are all modded hbloader copies, mine is just modded a little bit more :P
     
  6. m4xw

    m4xw Ancient Deity

    Member
    13
    May 25, 2018
    Germany
    And its a actual requirement for salamander to work
     
  7. Volthax

    Volthax Member

    Newcomer
    1
    Dec 13, 2018
    Netherlands Antilles
    Team-Xecutor advices instead of using Lockpick for this tutorial to use Unlockpick instead, this as that release contains secure info and the proper agenda of 2019 aka the 12 months agenda.
     
  8. Syynx

    Syynx Advanced Member

    Newcomer
    2
    Jun 5, 2018
    United States
    • inside, copy "hbl.nacp" from the hbloader build folder, and rename it "control.nacp"
    I'm having trouble finding this file
     
  9. TotalJustice

    TotalJustice GBAtemp Regular

    Member
    2
    Jan 28, 2017
    Managed to do this with super metroid, thanks!

    Is there a way to enable video capture? And if possible, have the application pause when pressing the home button.

    Edit: It crashes when loading n64 games :( :( :(
    — Posts automatically merged - Please don't double post! —

    Do you have the build folder? It should be inside the build folder after you do make clean / make.
     
    Last edited by TotalJustice, Jan 14, 2019 at 5:01 AM
  10. ScarletDreamz

    ScarletDreamz [Debug Mode]

    Member
    11
    Feb 16, 2015
    United States
    California
    Would try to make a GUI for this if it does not require to much external stuff C:
     
    Last edited by ScarletDreamz, Jan 14, 2019 at 7:52 AM
    EmperorX likes this.
  11. natinusala
    OP

    natinusala Win32 error 31 is not an error

    Member
    10
    Dec 1, 2012
    France
    When you build HBL you should have a "build" folder, and inside it (and its subfolders) you should have main, main.npdm and hbl.nacp
     
  12. ScarletDreamz

    ScarletDreamz [Debug Mode]

    Member
    11
    Feb 16, 2015
    United States
    California
    So far, so good:
    [​IMG]
     
    Jeomite, lordelan, crow132 and 2 others like this.
  13. Canny86

    Canny86 Member

    Newcomer
    2
    Jun 24, 2018
    Germany
    Can you confirm n64 is working. I have problems with it.
     
  14. lordelan

    lordelan GBAtemp Psycho!

    Member
    9
    Jan 4, 2015
    Germany
    Interesting indeed although it's not for me. I prefer having just one RetroArch main icon on the homescreen.

    But thinking of it, people will start putting their entire rom sets on their home screen (which is stupid) and I wonder if we already know what the icon limit for Horizon is. The limit for Café OS (Wii U) was 300 titles.

    @natinusala: Could you just put out a simple RetroArch forwarder (which launches the sd:\switch\retroarch\retroarch.nro with full memory access)?
    Because it's not so comfortable to remove and reinstall the (non forwarder) RetroArch nsp for every release.
    Or was there a reason why it's better to have a "real" RetroArch nsp rather than a forwarder nsp for it?
     
  15. natinusala
    OP

    natinusala Win32 error 31 is not an error

    Member
    10
    Dec 1, 2012
    France
    Use title redirection anyway. The NSP will eventually be deprecated and removed from downloads.
     
  16. chaleman

    chaleman Newbie

    Newcomer
    1
    May 20, 2018
    United States

    this is exactly what I was wondering... forward RetroArch itself....
     
    lordelan likes this.
  17. Trice

    Trice Advanced Member

    Newcomer
    4
    Jan 20, 2009
    Switzerland
    The title limit shouldn't be a problem this time. It's way larger than the Wii U's according to SciresM:

     
    Last edited by Trice, Jan 14, 2019 at 1:12 PM
    lordelan likes this.
  18. lordelan

    lordelan GBAtemp Psycho!

    Member
    9
    Jan 4, 2015
    Germany
    Trice likes this.
  19. CatmanFan

    CatmanFan I actually prefer being an artist more now.

    Member
    7
    Aug 14, 2016
    Morocco
    Sorry if I sound like a noob, but I only got to compiling the HBmenu before I got this:
    Code:
    C:/Users/a/Homebrew/Switch/RetroArch/Forwarders/Tools/nx-hbloader-retroarch-forwarder-mod-master/source/main.c: In function 'getIsApplication':
    C:/Users/a/Homebrew/Switch/RetroArch/Forwarders/Tools/nx-hbloader-retroarch-forwarder-mod-master/source/main.c:142:14: warning: implicit declaration of function 'pmshellGetApplicationPid'; did you mean 'pmdmntGetApplicationPid'? [-Wimplicit-function-declaration]
             rc = pmshellGetApplicationPid(&app_pid);
                  ^~~~~~~~~~~~~~~~~~~~~~~~
                  pmdmntGetApplicationPid
    C:/Users/a/Homebrew/Switch/RetroArch/Forwarders/Tools/nx-hbloader-retroarch-forwarder-mod-master/source/main.c: In function 'loadNro':
    C:/Users/a/Homebrew/Switch/RetroArch/Forwarders/Tools/nx-hbloader-retroarch-forwarder-mod-master/source/main.c:413:11: error: 'EntryType_RandomSeed' undeclared (first use in this function); did you mean 'EntryType_EndOfList'?
             { EntryType_RandomSeed,           0, {0, 0} },
               ^~~~~~~~~~~~~~~~~~~~
               EntryType_EndOfList
    C:/Users/a/Homebrew/Switch/RetroArch/Forwarders/Tools/nx-hbloader-retroarch-forwarder-mod-master/source/main.c:413:11: note: each undeclared identifier is reported only once for each function it appears in
    C:/Users/a/Homebrew/Switch/RetroArch/Forwarders/Tools/nx-hbloader-retroarch-forwarder-mod-master/source/main.c:421:38: error: 'EnvAppletFlags_ApplicationOverride' undeclared (first use in this function); did you mean 'AppletType_Application'?
             entry_AppletType->Value[1] = EnvAppletFlags_ApplicationOverride;
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                          AppletType_Application
    C:/Users/a/Homebrew/Switch/RetroArch/Forwarders/Tools/nx-hbloader-retroarch-forwarder-mod-master/source/main.c:421:36: warning: assignment to 'u64' {aka 'long unsigned int'} from 'ConfigEntry *' {aka 'struct <anonymous> *'} makes integer from pointer without a cast [-Wint-conversion]
             entry_AppletType->Value[1] = EnvAppletFlags_ApplicationOverride;
                                        ^
    make[1]: *** [/opt/devkitpro/devkitA64/base_rules:19: main.o] Error 1
    make: *** [Makefile:124: build] Error 2
    
    Tried reinstalling devkitA64 and using MSYS2 instead of CMD for compiling, but I still get the same error.
     
  20. TotalJustice

    TotalJustice GBAtemp Regular

    Member
    2
    Jan 28, 2017
    Have you tried to load n64 games yet?
     
Loading...