Files
gen1recomp/ports/switch/ota-bootstrap/main.c
T
Andrew Quenehen 9aa8b4e371 Move Switch OTA launcher sources under ports/switch.
Consolidate the native OTA launcher, bootstrap, and assets into the Switch port tree.
2026-08-06 10:22:51 -03:00

37 lines
889 B
C

/*
* Tiny one-shot helper: swap a staged launcher NRO into place, then load the game.
* The main OTA launcher chainloads here because a running NRO cannot replace itself
* on sdmc/FAT.
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#if defined(__SWITCH__)
#include <switch.h>
#endif
#define INSTALL_DIR "sdmc:/switch/gen1recomp"
#define STAGED INSTALL_DIR "/gen1recomp.nro.staged"
#define LAUNCHER INSTALL_DIR "/gen1recomp.nro"
#define GAME INSTALL_DIR "/gen1recomp-game.nro"
int main(int argc, char **argv) {
(void)argc;
(void)argv;
#if defined(__SWITCH__)
remove(LAUNCHER);
if (rename(STAGED, LAUNCHER) != 0) {
return 1;
}
Result rc = envSetNextLoad(GAME, GAME);
if (R_FAILED(rc)) return 1;
return 0;
#else
fprintf(stderr, "ota-bootstrap: host stub (would rename %s -> %s, load %s)\n", STAGED, LAUNCHER,
GAME);
return 0;
#endif
}