From 294e064a1e283d9654e122bb104f3e30b99c7070 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 21 Apr 2024 11:37:53 +0200 Subject: [PATCH 1/5] Add support for FS_LAYER_TYPE_SAVE_REPLACE_IGNORE_VOL_SAVE_COMMON --- Dockerfile | 4 ++-- src/FSWrapper.cpp | 10 +++++++++- src/FSWrapper.h | 7 ++++++- src/export.cpp | 4 ++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index ef10fff..b417396 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM ghcr.io/wiiu-env/devkitppc:20231112 COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO -COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20230719 /artifacts $DEVKITPRO -COPY --from=ghcr.io/wiiu-env/libcontentredirection:20230621 /artifacts $DEVKITPRO +COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:0.3.2-dev-20231203-2e5832b /artifacts $DEVKITPRO +COPY --from=ghcr.io/wiiu-env/libcontentredirection:1.1-dev-20240421-50d6722 /artifacts $DEVKITPRO WORKDIR project diff --git a/src/FSWrapper.cpp b/src/FSWrapper.cpp index 2982deb..db80561 100644 --- a/src/FSWrapper.cpp +++ b/src/FSWrapper.cpp @@ -670,7 +670,15 @@ bool FSWrapper::IsFileModeAllowed(const char *mode) { } bool FSWrapper::IsPathToReplace(const std::string_view &path) { - return path.starts_with(pPathToReplace); + if (!path.starts_with(pPathToReplace)) { + return false; + } + + if (std::ranges::any_of(pIgnorePaths.cbegin(), pIgnorePaths.cend(), [&path](auto &ignorePath) { return path.starts_with(ignorePath); })) { + return false; + } + + return true; } std::string FSWrapper::GetNewPath(const std::string_view &path) { diff --git a/src/FSWrapper.h b/src/FSWrapper.h index b9a2eb6..9da9ed0 100644 --- a/src/FSWrapper.h +++ b/src/FSWrapper.h @@ -10,16 +10,20 @@ class FSWrapper : public IFSWrapper { public: - FSWrapper(const std::string &name, const std::string &pathToReplace, const std::string &replacePathWith, bool fallbackOnError, bool isWriteable) { + FSWrapper(const std::string &name, const std::string &pathToReplace, const std::string &replacePathWith, bool fallbackOnError, bool isWriteable, std::vector ignorePaths = {}) { this->pName = name; this->pPathToReplace = pathToReplace; this->pReplacePathWith = replacePathWith; this->pFallbackOnError = fallbackOnError; this->pIsWriteable = isWriteable; this->pCheckIfDeleted = fallbackOnError; + this->pIgnorePaths = std::move(ignorePaths); std::replace(pPathToReplace.begin(), pPathToReplace.end(), '\\', '/'); std::replace(pReplacePathWith.begin(), pReplacePathWith.end(), '\\', '/'); + for (auto &ignorePath : pIgnorePaths) { + std::replace(ignorePath.begin(), ignorePath.end(), '\\', '/'); + } } ~FSWrapper() override { { @@ -129,6 +133,7 @@ class FSWrapper : public IFSWrapper { private: std::string pPathToReplace; std::string pReplacePathWith; + std::vector pIgnorePaths; bool pIsWriteable = false; std::mutex openFilesMutex; std::mutex openDirsMutex; diff --git a/src/export.cpp b/src/export.cpp index 5e60770..78c28a4 100644 --- a/src/export.cpp +++ b/src/export.cpp @@ -115,6 +115,10 @@ ContentRedirectionApiErrorType CRAddFSLayer(CRLayerHandle *handle, const char *l } else if (layerType == FS_LAYER_TYPE_SAVE_REPLACE) { DEBUG_FUNCTION_LINE_INFO("Redirecting \"/vol/save\" to \"%s\", mode: \"replace\"", replacementDir); ptr = make_unique_nothrow(layerName, "/vol/save", replacementDir, false, true); + } else if (layerType == FS_LAYER_TYPE_SAVE_REPLACE_IGNORE_VOL_SAVE_COMMON) { + DEBUG_FUNCTION_LINE_INFO("Redirecting \"/vol/save\" to \"%s\", mode: \"replace\", ignore: (\"/vol/save/common\")", replacementDir); + std::vector ignorePaths({"/vol/save/common"}); + ptr = make_unique_nothrow(layerName, "/vol/save", replacementDir, false, true, ignorePaths); } else { DEBUG_FUNCTION_LINE_ERR("CONTENT_REDIRECTION_API_ERROR_UNKNOWN_LAYER_DIR_TYPE: %s %s %d", layerName, replacementDir, layerType); return CONTENT_REDIRECTION_API_ERROR_UNKNOWN_FS_LAYER_TYPE; From ffc77d9b49accff795b3dfd12aef3384b46b042b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Mar 2024 22:30:59 +0000 Subject: [PATCH 2/5] Bump softprops/action-gh-release from 1 to 2 Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 1 to 2. - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2) --- updated-dependencies: - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18e3d48..52719f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: - name: zip artifact run: zip -r ${{ env.REPOSITORY_NAME }}_${{ env.DATETIME }}.zip *.wms - name: Create Release - uses: "softprops/action-gh-release@v1" + uses: "softprops/action-gh-release@v2" with: tag_name: ${{ env.REPOSITORY_NAME }}-${{ env.DATETIME }} draft: false From 40e1d1bf8837b99fef21e33c1847351a665ff224 Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 24 Apr 2024 17:32:03 +0200 Subject: [PATCH 3/5] Update .gitignore to ignore .zip files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ba57c28..98a796f 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ build/ cmake-build-debug/ CMakeLists.txt *.wms +*.zip From f688be4f70fa1c9238da1d2cdc53b5d63833714c Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 24 Apr 2024 17:59:11 +0200 Subject: [PATCH 4/5] Bump version to 0.2.6 --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 86d2776..fff561d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,7 +10,7 @@ WUMS_MODULE_EXPORT_NAME("homebrew_content_redirection"); WUMS_USE_WUT_DEVOPTAB(); WUMS_DEPENDS_ON(homebrew_functionpatcher); -#define VERSION "v0.2.5" +#define VERSION "v0.2.6" DECL_FUNCTION(void, OSCancelThread, OSThread *thread) { if (thread == gThreadData[0].thread || thread == gThreadData[1].thread || thread == gThreadData[2].thread) { From aa727bc6450470521882253fc8ff365bd6de33ef Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 24 Apr 2024 18:07:19 +0200 Subject: [PATCH 5/5] Update Dockerfiles to use latest devkitPPC and wut --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index b417396..43e930d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -FROM ghcr.io/wiiu-env/devkitppc:20231112 +FROM ghcr.io/wiiu-env/devkitppc:20240423 COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO -COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:0.3.2-dev-20231203-2e5832b /artifacts $DEVKITPRO -COPY --from=ghcr.io/wiiu-env/libcontentredirection:1.1-dev-20240421-50d6722 /artifacts $DEVKITPRO +COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20240424 /artifacts $DEVKITPRO +COPY --from=ghcr.io/wiiu-env/libcontentredirection:20240424 /artifacts $DEVKITPRO WORKDIR project