switchbrew / switch-examples

Switch examples for devkitA64 and libnx.

Home Page:https://devkitpro.org/viewforum.php?f=42

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Creating a save example

EimaMei opened this issue · comments

I wasn't able to find information on how to create a savefile for a homebrew game. If it isn't possible, then is there any other way to save information as a file?

commented

Homebrew apps run by replacing an existing official app's executable, but they retain their context. As such, trying to use the native savegame APIs would result in homebrew carelessly overwriting and corrupting people's savegames for the target titles they choose to use for running homebrew.

The recommended way to handle homebrew saves is by simply creating files on the SD card with the standard C file routines (stdio). Please note that the default working directory is the same as the directory that holds the NRO; it is strongly recommended to use this directory for any saved data produced by homebrew applications. This means you can just do something like fopen("mygame.cfg", "w") for write access.

Oh okay! Makes sense now, thank you for the help