From b728100b5ab1a0f05f4869fb27f4c6cbb31bcb0d Mon Sep 17 00:00:00 2001 From: Hyper <34012267+hyperbx@users.noreply.github.com> Date: Tue, 29 Oct 2024 20:55:23 +0000 Subject: [PATCH] xam: use std::string for XamContentCreateEx directory I hate strings --- UnleashedRecomp/kernel/xam.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/UnleashedRecomp/kernel/xam.cpp b/UnleashedRecomp/kernel/xam.cpp index 538d52f..bc9842d 100644 --- a/UnleashedRecomp/kernel/xam.cpp +++ b/UnleashedRecomp/kernel/xam.cpp @@ -241,13 +241,11 @@ SWA_API uint32_t XamContentCreateEx(DWORD dwUserIndex, LPCSTR szRootName, const if (!exists) { - const char* root = ""; + std::string root = ""; + if (pContentData->dwContentType == XCONTENTTYPE_SAVEDATA) { - // auuughh - auto savePath = Config::GetSavePath().string(); - root = new char[savePath.size() + 1]; - strcpy(const_cast(root), savePath.c_str()); + root = Config::GetSavePath().string(); } else if (pContentData->dwContentType == XCONTENTTYPE_DLC) { @@ -259,7 +257,7 @@ SWA_API uint32_t XamContentCreateEx(DWORD dwUserIndex, LPCSTR szRootName, const } XamRegisterContent(*pContentData, root); - CreateDirectoryA(root, nullptr); + CreateDirectoryA(root.c_str(), nullptr); XamRootCreate(szRootName, root); } else