Skip to content

Commit

Permalink
Fix GUI things and Sp2 dumping
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasnet-mc committed Jun 3, 2018
1 parent 7167971 commit b78386e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
VERSION_MAJOR := 1
VERSION_MINOR := 0
VERSION_MICRO := 0
VERSION_MICRO := 1

APP_TITLE := EdiZon
APP_AUTHOR := WerWolv and thomasnet
Expand Down Expand Up @@ -208,4 +208,4 @@ $(OFILES_SRC) : $(HFILES_BIN)

#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# EdiZon
A save editor for Horizon by thomasnet and WerWolv
![Icon](https://raw.githubusercontent.com/thomasnet-mc/EdiZon/master/icon.jpg)

A save dumper (future editor) for Horizon by thomasnet and WerWolv

# Credits
3096 for save dumping/injecting
3096 for save dumping/injecting

Bernardo Giordano for some Checkpoint code

Reswitched for the Homebrew Launcher GUI code

# Images
![Capture of main screen](https://cdn.discordapp.com/attachments/445187205372313601/452783262868307979/2018060302561900-DB1426D1DFD034027CECDE9C2DD914B8.jpg)
25 changes: 15 additions & 10 deletions source/save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ void makeExInjDir(char ptr[0x100], u64 titleID, u128 userID, bool isInject, cons
time_t t = time(nullptr);
std::stringstream ss;

mkdir(ROOT_DIR, 0700);

ss << ROOT_DIR << std::setfill('0') << std::setw(sizeof(titleID)*2)
<< std::hex << titleID << "/";
mkdir(ss.str().c_str(), 0700);
Expand Down Expand Up @@ -143,11 +145,6 @@ Result mountSaveByTitleAccountIDs(const u64 titleID, const u128 userID, FsFileSy
return rc;
}

Result mountSaveBySaveDataInfo(const FsSaveDataInfo & info) {
FsFileSystem tmpfs;
return mountSaveByTitleAccountIDs(info.titleID, info.userID, tmpfs);
}

bool getSavefilesForGame(std::vector<s32>& vec, u64 titleID, u128 userID)
{
FsFileSystem tmpfs;
Expand Down Expand Up @@ -283,16 +280,20 @@ s32 backupSave(u64 titleID, u128 userID) {
char *ptr = new char[0x100];
s32 res = 0;

fsMount_SaveData(&fs, titleID, userID);
fsdevMountDevice("save", fs);
if (R_FAILED(mountSaveByTitleAccountIDs(titleID, userID, fs))) {
printf("Failed to mount save.\n");
return 1;
}

makeExInjDir(ptr, titleID, userID, false, nullptr);

if(ptr == nullptr) {
printf("makeExInjDir failed.\n");
fsdevUnmountDevice("save");
return 1;
}

res = copyAllSave("", false, ptr);
res = copyAllSave("", true, ptr);
fsdevUnmountDevice("save");

delete[] ptr;
Expand All @@ -305,11 +306,15 @@ s32 restoreSave(u64 titleID, u128 userID, const char* injectFolder) {
char *ptr = new char[0x100];
s32 res = 0;

fsMount_SaveData(&fs, titleID, userID);
fsdevMountDevice("save", fs);
if (R_FAILED(mountSaveByTitleAccountIDs(titleID, userID, fs))) {
printf("Failed to mount save.\n");
return 1;
}

makeExInjDir(ptr, titleID, userID, true, injectFolder);

if(ptr == nullptr) {
printf("makeExInjDir failed.\n");
fsdevUnmountDevice("save");
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion source/title.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Title::Title(FsSaveDataInfo& saveInfo) {
m_titleName = std::string(langentry->name);
m_titleAuthor = std::string(langentry->author);

m_titleID = buf->nacp.titleID0;
m_titleID = saveInfo.titleID;

njInit();

Expand Down

0 comments on commit b78386e

Please sign in to comment.