-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial work on splitting up for save detection
- Loading branch information
Showing
6 changed files
with
142 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <stdio.h> | ||
#include <3ds.h> | ||
#include "editprofile.h" | ||
#include "title.h" | ||
#include "const.h" | ||
#include "struct.h" | ||
#include "save.h" | ||
|
||
int main(); | ||
void fail_print(Result* res); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#include <3ds.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include "struct.h" | ||
#include "save.h" | ||
|
||
Result open_archive(u32 lowid, InstallType install_type, FS_Archive* save_archive) | ||
{ | ||
FS_MediaType media_type = (install_type == SD_CARD) ? MEDIATYPE_SD : MEDIATYPE_GAME_CARD; | ||
const u32 path[3] = { media_type, lowid, 0x00040000 }; | ||
|
||
FS_ArchiveID archive_id = (install_type == SD_CARD) ? ARCHIVE_USER_SAVEDATA : ARCHIVE_GAMECARD_SAVEDATA; | ||
|
||
Result res; | ||
res = FSUSER_OpenArchive(save_archive, archive_id, (FS_Path){PATH_BINARY, 12, path}); | ||
if(R_FAILED(res)) return res; | ||
|
||
return 0; | ||
} | ||
|
||
SavesList save_check(FS_Archive* save_archive) | ||
{ | ||
Result res; | ||
SavesList saves_list = {false, false, false}; | ||
|
||
for (int i = 0; i < 3; ++i) | ||
{ | ||
bool exist = file_check(i, save_archive); | ||
if (exist) | ||
{ | ||
saves_list.total_saves++; | ||
} | ||
switch(i) | ||
{ | ||
case 0: | ||
saves_list.profile0 = exist; | ||
break; | ||
|
||
case 1: | ||
saves_list.profile1 = exist; | ||
break; | ||
|
||
case 2: | ||
saves_list.profile2 = exist; | ||
break; | ||
} | ||
} | ||
|
||
return saves_list; | ||
} | ||
|
||
bool file_check(int i, FS_Archive* save_archive) | ||
{ | ||
char profile_path[0x107] = {0}; | ||
sprintf(profile_path, "/profile%i/pkprfl.bmssv", i); | ||
printf("%s\n", profile_path); | ||
|
||
// Open file | ||
Handle file_handle; | ||
|
||
Result res; | ||
res = FSUSER_OpenFile(&file_handle, *save_archive, fsMakePath(PATH_ASCII, profile_path), FS_OPEN_WRITE | FS_OPEN_READ, 0); | ||
if(R_FAILED(res)) | ||
{ | ||
return false; | ||
} | ||
FSFILE_Close(file_handle); | ||
return true; | ||
} | ||
|
||
Result open_file() | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef _SAVEH_ | ||
#define _SAVEH_ | ||
|
||
#include <3ds.h> | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include "struct.h" | ||
|
||
Result open_archive(u32 lowid, InstallType install_type, FS_Archive* save_archive); | ||
SavesList save_check(FS_Archive* save_archive); | ||
bool file_check(int i, FS_Archive* save_archive); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters