mirror of
https://github.com/wiiu-env/RPXLoadingModule.git
synced 2024-11-22 01:49:15 +01:00
Implement RL_GetPathOfSaveRedirection
This commit is contained in:
parent
77c7db4ed9
commit
a31646fbfe
@ -1,6 +1,6 @@
|
||||
FROM ghcr.io/wiiu-env/devkitppc:20230621
|
||||
|
||||
COPY --from=ghcr.io/wiiu-env/librpxloader:20230621 /artifacts $DEVKITPRO
|
||||
COPY --from=ghcr.io/wiiu-env/librpxloader:0.1.3-dev-20240329-8a2fc9f /artifacts $DEVKITPRO
|
||||
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/libwuhbutils:20230621 /artifacts $DEVKITPRO
|
||||
|
@ -382,7 +382,7 @@ RPXLoaderStatus RL_GetVersion(RPXLoaderVersion *outVersion) {
|
||||
if (!outVersion) {
|
||||
return RPX_LOADER_RESULT_INVALID_ARGUMENT;
|
||||
}
|
||||
*outVersion = 2;
|
||||
*outVersion = 3;
|
||||
return RPX_LOADER_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
@ -398,6 +398,18 @@ RPXLoaderStatus RL_GetPathOfRunningExecutable(char *outBuffer, uint32_t outSize)
|
||||
return RPX_LOADER_RESULT_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
RPXLoaderStatus RL_GetPathOfSaveRedirection(char *outBuffer, uint32_t outSize) {
|
||||
if (outBuffer == nullptr || outSize == 0) {
|
||||
return RPX_LOADER_RESULT_INVALID_ARGUMENT;
|
||||
}
|
||||
if (saveLayerHandle != 0 && !gActiveSaveRedirectionPath.empty()) {
|
||||
strncpy(outBuffer, gActiveSaveRedirectionPath.c_str(), outSize - 1);
|
||||
return RPX_LOADER_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
return RPX_LOADER_RESULT_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
WUMS_EXPORT_FUNCTION(RL_PrepareLaunchFromSD);
|
||||
WUMS_EXPORT_FUNCTION(RL_LaunchPreparedHomebrew);
|
||||
WUMS_EXPORT_FUNCTION(RL_LaunchHomebrew);
|
||||
@ -407,3 +419,4 @@ WUMS_EXPORT_FUNCTION(RL_EnableContentRedirection);
|
||||
WUMS_EXPORT_FUNCTION(RL_DisableContentRedirection);
|
||||
WUMS_EXPORT_FUNCTION(RL_UnmountCurrentRunningBundle);
|
||||
WUMS_EXPORT_FUNCTION(RL_GetPathOfRunningExecutable);
|
||||
WUMS_EXPORT_FUNCTION(RL_GetPathOfSaveRedirection);
|
||||
|
@ -3,3 +3,4 @@
|
||||
RPXLoader_ReplacementInformation gReplacementInfo = {};
|
||||
CRLayerHandle contentLayerHandle = 0;
|
||||
CRLayerHandle saveLayerHandle = 0;
|
||||
std::string gActiveSaveRedirectionPath;
|
@ -54,3 +54,4 @@ extern RPXLoader_ReplacementInformation gReplacementInfo;
|
||||
|
||||
extern CRLayerHandle contentLayerHandle;
|
||||
extern CRLayerHandle saveLayerHandle;
|
||||
extern std::string gActiveSaveRedirectionPath;
|
@ -91,6 +91,8 @@ WUMS_APPLICATION_STARTS() {
|
||||
gReplacementInfo.lastFileLoaded[0] = '\0';
|
||||
}
|
||||
|
||||
gActiveSaveRedirectionPath.clear();
|
||||
|
||||
if (_SYSGetSystemApplicationTitleId(SYSTEM_APP_ID_HEALTH_AND_SAFETY) == OSGetTitleID() &&
|
||||
strlen(gReplacementInfo.contentReplacementInfo.bundleMountInformation.toMountPath) > 0) {
|
||||
uint32_t currentHash = StringTools::hash(gReplacementInfo.contentReplacementInfo.bundleMountInformation.toMountPath);
|
||||
@ -100,10 +102,11 @@ WUMS_APPLICATION_STARTS() {
|
||||
nn::act::PersistentId persistentId = nn::act::GetPersistentId();
|
||||
nn::act::Finalize();
|
||||
|
||||
std::string basePath = string_format("fs:/vol/external01/wiiu/apps/save/%08X", currentHash);
|
||||
std::string relativePath = string_format("wiiu/apps/save/%08X", currentHash);
|
||||
if (!shortNameSanitized.empty()) {
|
||||
basePath += string_format(" (%s)", shortNameSanitized.c_str());
|
||||
relativePath += string_format(" (%s)", shortNameSanitized.c_str());
|
||||
}
|
||||
std::string basePath = "fs:/vol/external01/" + relativePath;
|
||||
|
||||
std::string common = basePath + "/common";
|
||||
std::string user = basePath + string_format("/%08X", 0x80000000 | persistentId);
|
||||
@ -145,6 +148,8 @@ WUMS_APPLICATION_STARTS() {
|
||||
gReplacementInfo.contentReplacementInfo.bundleMountInformation.isMounted = true;
|
||||
gReplacementInfo.contentReplacementInfo.bundleMountInformation.toMountPath[0] = '\0';
|
||||
|
||||
gActiveSaveRedirectionPath = relativePath;
|
||||
|
||||
OSMemoryBarrier();
|
||||
return;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user