Fix new saves being written to game root

This commit is contained in:
Hyper 2024-10-21 23:43:17 +01:00
parent 78cba0e78d
commit 08a15e3b33
3 changed files with 10 additions and 2 deletions

View file

@ -72,6 +72,11 @@ public:
return GetUserPath() / TOML_FILE; return GetUserPath() / TOML_FILE;
} }
static std::filesystem::path GetSavePath()
{
return GetUserPath() / "save";
}
static void Load(); static void Load();
static void Save(); static void Save();
}; };

View file

@ -244,7 +244,10 @@ SWA_API uint32_t XamContentCreateEx(DWORD dwUserIndex, LPCSTR szRootName, const
const char* root = ""; const char* root = "";
if (pContentData->dwContentType == XCONTENTTYPE_SAVEDATA) if (pContentData->dwContentType == XCONTENTTYPE_SAVEDATA)
{ {
root = ".\\save"; // auuughh
auto savePath = Config::GetSavePath().string();
root = new char[savePath.size() + 1];
strcpy(const_cast<char*>(root), savePath.c_str());
} }
else if (pContentData->dwContentType == XCONTENTTYPE_DLC) else if (pContentData->dwContentType == XCONTENTTYPE_DLC)
{ {

View file

@ -40,7 +40,7 @@ void KiSystemStartup()
XamRegisterContent(gameContent, DirectoryExists(".\\game") ? ".\\game" : "."); XamRegisterContent(gameContent, DirectoryExists(".\\game") ? ".\\game" : ".");
XamRegisterContent(updateContent, ".\\update"); XamRegisterContent(updateContent, ".\\update");
const auto savePath = Config::GetUserPath() / "save"; const auto savePath = Config::GetSavePath();
const auto saveName = "SYS-DATA"; const auto saveName = "SYS-DATA";
// TODO: implement save slots? // TODO: implement save slots?