From 46d1c31bda749e4a829bf94e618965d234df76b8 Mon Sep 17 00:00:00 2001 From: Jujstme Date: Fri, 7 Mar 2025 17:43:23 +0100 Subject: [PATCH 1/2] Upload patches --- README.md | 14 ++++++++++++++ UnleashedRecomp/app.cpp | 2 +- UnleashedRecomp/kernel/xam.cpp | 4 ++-- UnleashedRecomp/main.cpp | 10 +++++----- UnleashedRecomp/mod/mod_loader.cpp | 2 +- UnleashedRecomp/user/paths.cpp | 1 + UnleashedRecomp/user/paths.h | 10 ++++++++-- 7 files changed, 32 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index abf1a3d..eb329ee 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,17 @@ +> [!WARNING] +> This repository is a fork of the Unleashed Recompiled project, specifically designed to support binary Arch Linux packaging through the AUR and the PKGBUILD system. For Windows builds, please refer to the upstream repository. +> **Do not attempt to compile the content of this repository with Windows targets**. +> Please be also aware this package, unlike the Flatpak version provided upstream, may not be compatible with the Hedgemod Manager differently from the Flatpak version provided upstream. + +Binaries from this repository are built using: + +``` +$ cmake -DCMAKE_AR=/usr/bin/llvm-ar -DCMAKE_RANLIB=/usr/bin/llvm-ranlib . --preset linux-release +$ cmake --build ./out/build/linux-release --target UnleashedRecomp +``` + +--- +

diff --git a/UnleashedRecomp/app.cpp b/UnleashedRecomp/app.cpp index b298ebc..e6c2414 100644 --- a/UnleashedRecomp/app.cpp +++ b/UnleashedRecomp/app.cpp @@ -33,7 +33,7 @@ PPC_FUNC_IMPL(__imp__sub_824EB490); PPC_FUNC(sub_824EB490) { App::s_isInit = true; - App::s_isMissingDLC = !Installer::checkAllDLC(GetGamePath()); + App::s_isMissingDLC = !Installer::checkAllDLC(g_gamepath); App::s_language = Config::Language; SWA::SGlobals::Init(); diff --git a/UnleashedRecomp/kernel/xam.cpp b/UnleashedRecomp/kernel/xam.cpp index 3d7ca77..05f34d5 100644 --- a/UnleashedRecomp/kernel/xam.cpp +++ b/UnleashedRecomp/kernel/xam.cpp @@ -315,11 +315,11 @@ uint32_t XamContentCreateEx(uint32_t dwUserIndex, const char* szRootName, const } else if (pContentData->dwContentType == XCONTENTTYPE_DLC) { - root = GAME_INSTALL_DIRECTORY "/dlc"; + root = g_gamepath + "/dlc"; } else { - root = GAME_INSTALL_DIRECTORY; + root = g_gamepath; } XamRegisterContent(*pContentData, root); diff --git a/UnleashedRecomp/main.cpp b/UnleashedRecomp/main.cpp index a55c018..fe4b303 100644 --- a/UnleashedRecomp/main.cpp +++ b/UnleashedRecomp/main.cpp @@ -61,8 +61,8 @@ void KiSystemStartup() { const auto gameContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Game"); const auto updateContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Update"); - XamRegisterContent(gameContent, GAME_INSTALL_DIRECTORY "/game"); - XamRegisterContent(updateContent, GAME_INSTALL_DIRECTORY "/update"); + XamRegisterContent(gameContent, g_gamepath + "/game"); + XamRegisterContent(updateContent, g_gamepath + "/update"); const auto saveFilePath = GetSaveFilePath(true); bool saveFileExists = std::filesystem::exists(saveFilePath); @@ -94,7 +94,7 @@ void KiSystemStartup() XamContentCreateEx(0, "D", &gameContent, OPEN_EXISTING, nullptr, nullptr, 0, 0, nullptr); std::error_code ec; - for (auto& file : std::filesystem::directory_iterator(GAME_INSTALL_DIRECTORY "/dlc", ec)) + for (auto& file : std::filesystem::directory_iterator(g_gamepath + "/dlc", ec)) { if (file.is_directory()) { @@ -244,7 +244,7 @@ int main(int argc, char *argv[]) HostStartup(); std::filesystem::path modulePath; - bool isGameInstalled = Installer::checkGameInstall(GAME_INSTALL_DIRECTORY, modulePath); + bool isGameInstalled = Installer::checkGameInstall(g_gamepath, modulePath); bool runInstallerWizard = forceInstaller || forceDLCInstaller || !isGameInstalled; if (runInstallerWizard) { @@ -254,7 +254,7 @@ int main(int argc, char *argv[]) std::_Exit(1); } - if (!InstallerWizard::Run(GAME_INSTALL_DIRECTORY, isGameInstalled && forceDLCInstaller)) + if (!InstallerWizard::Run(g_gamepath, isGameInstalled && forceDLCInstaller)) { std::_Exit(0); } diff --git a/UnleashedRecomp/mod/mod_loader.cpp b/UnleashedRecomp/mod/mod_loader.cpp index dd33c56..282238d 100644 --- a/UnleashedRecomp/mod/mod_loader.cpp +++ b/UnleashedRecomp/mod/mod_loader.cpp @@ -100,7 +100,7 @@ void ModLoader::Init() { configIni = {}; - if (!configIni.read(GAME_INSTALL_DIRECTORY "/cpkredir.ini")) + if (!configIni.read(g_gamepath + "/cpkredir.ini")) return; } diff --git a/UnleashedRecomp/user/paths.cpp b/UnleashedRecomp/user/paths.cpp index 13a8588..633d97c 100644 --- a/UnleashedRecomp/user/paths.cpp +++ b/UnleashedRecomp/user/paths.cpp @@ -3,6 +3,7 @@ std::filesystem::path g_executableRoot = os::process::GetExecutablePath().remove_filename(); std::filesystem::path g_userPath = BuildUserPath(); +extern const std::string g_gamepath = GetGamePath(); bool CheckPortable() { diff --git a/UnleashedRecomp/user/paths.h b/UnleashedRecomp/user/paths.h index c083520..118b570 100644 --- a/UnleashedRecomp/user/paths.h +++ b/UnleashedRecomp/user/paths.h @@ -10,14 +10,20 @@ extern std::filesystem::path g_executableRoot; -inline std::filesystem::path GetGamePath() +inline std::string GetGamePath() { - return GAME_INSTALL_DIRECTORY; + const char* homeDir = getenv("HOME"); + if (homeDir == nullptr) + return g_executableRoot.string(); + std::filesystem::path homePath = homeDir; + std::filesystem::path gamePath = homePath / ".local/share" / USER_DIRECTORY; + return gamePath.string(); } bool CheckPortable(); std::filesystem::path BuildUserPath(); const std::filesystem::path& GetUserPath(); +extern const std::string g_gamepath; inline std::filesystem::path GetSavePath(bool checkForMods) { From a60a7cefef97eeadcba0041eeb16ec206977390c Mon Sep 17 00:00:00 2001 From: Jujstme Date: Mon, 10 Mar 2025 17:36:28 +0100 Subject: [PATCH 2/2] Changed `g_gamepath` into a more descriptive `g_gameInstallPath` --- UnleashedRecomp/app.cpp | 2 +- UnleashedRecomp/kernel/xam.cpp | 4 ++-- UnleashedRecomp/main.cpp | 10 +++++----- UnleashedRecomp/mod/mod_loader.cpp | 2 +- UnleashedRecomp/user/paths.cpp | 2 +- UnleashedRecomp/user/paths.h | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/UnleashedRecomp/app.cpp b/UnleashedRecomp/app.cpp index e6c2414..84d2376 100644 --- a/UnleashedRecomp/app.cpp +++ b/UnleashedRecomp/app.cpp @@ -33,7 +33,7 @@ PPC_FUNC_IMPL(__imp__sub_824EB490); PPC_FUNC(sub_824EB490) { App::s_isInit = true; - App::s_isMissingDLC = !Installer::checkAllDLC(g_gamepath); + App::s_isMissingDLC = !Installer::checkAllDLC(g_gameInstallPath); App::s_language = Config::Language; SWA::SGlobals::Init(); diff --git a/UnleashedRecomp/kernel/xam.cpp b/UnleashedRecomp/kernel/xam.cpp index 05f34d5..adb1cf0 100644 --- a/UnleashedRecomp/kernel/xam.cpp +++ b/UnleashedRecomp/kernel/xam.cpp @@ -315,11 +315,11 @@ uint32_t XamContentCreateEx(uint32_t dwUserIndex, const char* szRootName, const } else if (pContentData->dwContentType == XCONTENTTYPE_DLC) { - root = g_gamepath + "/dlc"; + root = g_gameInstallPath + "/dlc"; } else { - root = g_gamepath; + root = g_gameInstallPath; } XamRegisterContent(*pContentData, root); diff --git a/UnleashedRecomp/main.cpp b/UnleashedRecomp/main.cpp index fe4b303..55a25cf 100644 --- a/UnleashedRecomp/main.cpp +++ b/UnleashedRecomp/main.cpp @@ -61,8 +61,8 @@ void KiSystemStartup() { const auto gameContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Game"); const auto updateContent = XamMakeContent(XCONTENTTYPE_RESERVED, "Update"); - XamRegisterContent(gameContent, g_gamepath + "/game"); - XamRegisterContent(updateContent, g_gamepath + "/update"); + XamRegisterContent(gameContent, g_gameInstallPath + "/game"); + XamRegisterContent(updateContent, g_gameInstallPath + "/update"); const auto saveFilePath = GetSaveFilePath(true); bool saveFileExists = std::filesystem::exists(saveFilePath); @@ -94,7 +94,7 @@ void KiSystemStartup() XamContentCreateEx(0, "D", &gameContent, OPEN_EXISTING, nullptr, nullptr, 0, 0, nullptr); std::error_code ec; - for (auto& file : std::filesystem::directory_iterator(g_gamepath + "/dlc", ec)) + for (auto& file : std::filesystem::directory_iterator(g_gameInstallPath + "/dlc", ec)) { if (file.is_directory()) { @@ -244,7 +244,7 @@ int main(int argc, char *argv[]) HostStartup(); std::filesystem::path modulePath; - bool isGameInstalled = Installer::checkGameInstall(g_gamepath, modulePath); + bool isGameInstalled = Installer::checkGameInstall(g_gameInstallPath, modulePath); bool runInstallerWizard = forceInstaller || forceDLCInstaller || !isGameInstalled; if (runInstallerWizard) { @@ -254,7 +254,7 @@ int main(int argc, char *argv[]) std::_Exit(1); } - if (!InstallerWizard::Run(g_gamepath, isGameInstalled && forceDLCInstaller)) + if (!InstallerWizard::Run(g_gameInstallPath, isGameInstalled && forceDLCInstaller)) { std::_Exit(0); } diff --git a/UnleashedRecomp/mod/mod_loader.cpp b/UnleashedRecomp/mod/mod_loader.cpp index 282238d..da58417 100644 --- a/UnleashedRecomp/mod/mod_loader.cpp +++ b/UnleashedRecomp/mod/mod_loader.cpp @@ -100,7 +100,7 @@ void ModLoader::Init() { configIni = {}; - if (!configIni.read(g_gamepath + "/cpkredir.ini")) + if (!configIni.read(g_gameInstallPath + "/cpkredir.ini")) return; } diff --git a/UnleashedRecomp/user/paths.cpp b/UnleashedRecomp/user/paths.cpp index 633d97c..9a23eb2 100644 --- a/UnleashedRecomp/user/paths.cpp +++ b/UnleashedRecomp/user/paths.cpp @@ -3,7 +3,7 @@ std::filesystem::path g_executableRoot = os::process::GetExecutablePath().remove_filename(); std::filesystem::path g_userPath = BuildUserPath(); -extern const std::string g_gamepath = GetGamePath(); +extern const std::string g_gameInstallPath = GetGamePath(); bool CheckPortable() { diff --git a/UnleashedRecomp/user/paths.h b/UnleashedRecomp/user/paths.h index 118b570..50d8408 100644 --- a/UnleashedRecomp/user/paths.h +++ b/UnleashedRecomp/user/paths.h @@ -23,7 +23,7 @@ inline std::string GetGamePath() bool CheckPortable(); std::filesystem::path BuildUserPath(); const std::filesystem::path& GetUserPath(); -extern const std::string g_gamepath; +extern const std::string g_gameInstallPath; inline std::filesystem::path GetSavePath(bool checkForMods) {