From af46e93a5eecaf030ce9b7dcbac526ba32c341b5 Mon Sep 17 00:00:00 2001 From: badbl0cks <4161747+badbl0cks@users.noreply.github.com> Date: Wed, 17 May 2023 10:07:12 -0700 Subject: [PATCH] Implement BOTW save data mounting - Add account initialization and user handling - Mount save data using BOTW Application ID - Proper error handling with Result codes - Foundation for save file manipulation --- source/save_basic.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/source/save_basic.c b/source/save_basic.c index c1fdc0d..331cbe5 100644 --- a/source/save_basic.c +++ b/source/save_basic.c @@ -6,11 +6,38 @@ static gameDataSav save_data = {0}; void openSave() { + Result rc = 0; + AccountUid uid = {0}; + u64 application_id = 0x01007ef00011e000; // BOTW Application ID + printf("Opening BOTW save data...\n"); - // TODO: Implement save file reading + + // Get user account + rc = accountInitialize(AccountServiceType_Application); + if (R_FAILED(rc)) { + printf("accountInitialize() failed: 0x%x\n", rc); + return; + } + + rc = accountGetPreselectedUser(&uid); + accountExit(); + + if (R_FAILED(rc)) { + printf("accountGetPreselectedUser() failed: 0x%x\n", rc); + return; + } + + // Mount save data + rc = fsdevMountSaveData("save", application_id, uid); + if (R_FAILED(rc)) { + printf("fsdevMountSaveData() failed: 0x%x\n", rc); + return; + } + + printf("Save data mounted successfully!\n"); } void processSave() { printf("Processing save data...\n"); - // TODO: Implement save processing logic + // TODO: Implement actual save processing } \ No newline at end of file