Skip to content

Commit 835881a

Browse files
committed
Add support for FS_LAYER_TYPE_SAVE_REPLACE_FOR_CURRENT_USER
1 parent d0dfbd6 commit 835881a

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ FROM ghcr.io/wiiu-env/devkitppc:20240423
22

33
COPY --from=ghcr.io/wiiu-env/libfunctionpatcher:20230621 /artifacts $DEVKITPRO
44
COPY --from=ghcr.io/wiiu-env/wiiumodulesystem:20240424 /artifacts $DEVKITPRO
5-
COPY --from=ghcr.io/wiiu-env/libcontentredirection:20240424 /artifacts $DEVKITPRO
5+
COPY --from=ghcr.io/wiiu-env/libcontentredirection:20240428 /artifacts $DEVKITPRO
66

77
WORKDIR project

src/export.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
#include "FileUtils.h"
44
#include "IFSWrapper.h"
55
#include "malloc.h"
6+
#include "utils/StringTools.h"
67
#include "utils/logger.h"
78
#include "utils/utils.h"
89
#include <content_redirection/redirection.h>
910
#include <coreinit/dynload.h>
1011
#include <mutex>
12+
#include <nn/act.h>
1113
#include <wums/exports.h>
1214

1315
struct AOCTitle {
@@ -115,6 +117,15 @@ ContentRedirectionApiErrorType CRAddFSLayer(CRLayerHandle *handle, const char *l
115117
} else if (layerType == FS_LAYER_TYPE_SAVE_REPLACE) {
116118
DEBUG_FUNCTION_LINE_INFO("Redirecting \"/vol/save\" to \"%s\", mode: \"replace\"", replacementDir);
117119
ptr = make_unique_nothrow<FSWrapper>(layerName, "/vol/save", replacementDir, false, true);
120+
} else if (layerType == FS_LAYER_TYPE_SAVE_REPLACE_FOR_CURRENT_USER) {
121+
nn::act::Initialize();
122+
nn::act::PersistentId persistentId = nn::act::GetPersistentId();
123+
nn::act::Finalize();
124+
125+
std::string user = string_format("/vol/save/%08X", 0x80000000 | persistentId);
126+
127+
DEBUG_FUNCTION_LINE_INFO("Redirecting \"%s\" to \"%s\", mode: \"replace\"", user.c_str(), replacementDir);
128+
ptr = make_unique_nothrow<FSWrapper>(layerName, user, replacementDir, false, true);
118129
} else {
119130
DEBUG_FUNCTION_LINE_ERR("CONTENT_REDIRECTION_API_ERROR_UNKNOWN_LAYER_DIR_TYPE: %s %s %d", layerName, replacementDir, layerType);
120131
return CONTENT_REDIRECTION_API_ERROR_UNKNOWN_FS_LAYER_TYPE;

0 commit comments

Comments
 (0)