From 08a15e3b33eb03c718f80a6fb27e6776d033d87a Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Mon, 21 Oct 2024 23:43:17 +0100 Subject: [PATCH] Fix new saves being written to game root --- UnleashedRecomp/config.h | 5 +++++ UnleashedRecomp/kernel/xam.cpp | 5 ++++- UnleashedRecomp/main.cpp | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/UnleashedRecomp/config.h b/UnleashedRecomp/config.h index 9605223..7bc0c68 100644 --- a/UnleashedRecomp/config.h +++ b/UnleashedRecomp/config.h @@ -72,6 +72,11 @@ public: return GetUserPath() / TOML_FILE; } + static std::filesystem::path GetSavePath() + { + return GetUserPath() / "save"; + } + static void Load(); static void Save(); }; diff --git a/UnleashedRecomp/kernel/xam.cpp b/UnleashedRecomp/kernel/xam.cpp index b3e6476..538d52f 100644 --- a/UnleashedRecomp/kernel/xam.cpp +++ b/UnleashedRecomp/kernel/xam.cpp @@ -244,7 +244,10 @@ SWA_API uint32_t XamContentCreateEx(DWORD dwUserIndex, LPCSTR szRootName, const const char* root = ""; if (pContentData->dwContentType == XCONTENTTYPE_SAVEDATA) { - root = ".\\save"; + // auuughh + auto savePath = Config::GetSavePath().string(); + root = new char[savePath.size() + 1]; + strcpy(const_cast(root), savePath.c_str()); } else if (pContentData->dwContentType == XCONTENTTYPE_DLC) { diff --git a/UnleashedRecomp/main.cpp b/UnleashedRecomp/main.cpp index 26bf5a3..eef5a1b 100644 --- a/UnleashedRecomp/main.cpp +++ b/UnleashedRecomp/main.cpp @@ -40,7 +40,7 @@ void KiSystemStartup() XamRegisterContent(gameContent, DirectoryExists(".\\game") ? ".\\game" : "."); XamRegisterContent(updateContent, ".\\update"); - const auto savePath = Config::GetUserPath() / "save"; + const auto savePath = Config::GetSavePath(); const auto saveName = "SYS-DATA"; // TODO: implement save slots?