Skip to content

Commit

Permalink
Fix returning from System Transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed May 5, 2024
1 parent db349f0 commit f18b51d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions source/patches/patches_replacements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "patches.h"
#include <coreinit/filesystem_fsa.h>
#include <coreinit/title.h>
#include <sysapp/launch.h>

static inline bool IsInHardcodedHomebrewMemoryRegion(void *addr) {
if ((uint32_t) addr >= 0x00800000 && (uint32_t) addr < 0x01000000) {
Expand Down Expand Up @@ -54,10 +55,26 @@ DECL_FUNCTION(uint32_t, FSGetClientNum) {
}
return real_FSGetClientNum();
}

DECL_FUNCTION(uint32_t, SYSReturnToCaller, void *args) {
// Fix jumping back to the System Settings when exiting the System Transfer
auto curTitleID = OSGetTitleID();
if (curTitleID == 0x0005001010062000L || curTitleID == 0x0005001010062100L || curTitleID == 0x0005001010062200L) {
SysAppSettingsArgs set_args{};
// Jump directly to the Transfer Menu
set_args.jumpTo = 0xFF;
_SYSLaunchSettings(&set_args);
return 0;
}

return real_SYSReturnToCaller(args);
}

function_replacement_data_t patches_function_replacements[] = {
REPLACE_FUNCTION(FSAddClient, LIBRARY_COREINIT, FSAddClient),
REPLACE_FUNCTION(FSDelClient, LIBRARY_COREINIT, FSDelClient),
REPLACE_FUNCTION(FSGetClientNum, LIBRARY_COREINIT, FSGetClientNum),
REPLACE_FUNCTION(SYSReturnToCaller, LIBRARY_SYSAPP, SYSReturnToCaller),
};

uint32_t patches_function_replacements_size = sizeof(patches_function_replacements) / sizeof(function_replacement_data_t);

0 comments on commit f18b51d

Please sign in to comment.