botw-completer/source/main.c
badbl0cks 07db2a4d8d
Fix save device unmounting on exit
- Properly unmount save device before application exit
- Prevents potential file system issues
- Ensures clean shutdown process
2023-05-23 11:17:52 -07:00

42 lines
No EOL
839 B
C

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <switch.h>
#include "save_basic.h"
#include "ui_basic.h"
int main(int argc, char **argv)
{
setvbuf(stdout, NULL, _IONBF, BUFSIZ);
consoleInit(NULL);
// Configure input
padConfigureInput(1, HidNpadStyleSet_NpadStandard);
PadState pad;
padInitializeDefault(&pad);
// Initialize save system
openSave();
processSave();
// Initialize UI
initUI();
bool exit = false;
// Main loop
while(appletMainLoop() && !exit)
{
padUpdate(&pad);
u64 kDown = padGetButtonsDown(&pad);
exit = handleButtonPress(kDown);
consoleUpdate(NULL);
}
// Unmount save data before exit
fsdevUnmountDevice("save");
consoleExit(NULL);
return 0;
}