Skip to content

Commit

Permalink
Fix Echoes of Wisdom incompatbility with ReverseNX-RT
Browse files Browse the repository at this point in the history
  • Loading branch information
masagrator authored Nov 22, 2024
1 parent 668eb05 commit 2f59839
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
21 changes: 19 additions & 2 deletions saltysd_core/source/ReverseNX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void WaitSystemEvent(SystemEvent* systemEvent) {
}

/*
Used by Monster Hunter Rise.
Used by Monster Hunter Rise and The Legend of Zelda: Echoes of Wisdom
Game won't check if mode was changed until NotificationMessage event will be flagged.
Functions below are detecting which MultiWait includes NotificationMessage event,
Expand Down Expand Up @@ -290,7 +290,24 @@ void LinkMultiWaitHolder(void* MultiWaitType, void* MultiWaitHolderType) {
void* WaitAny(void* MultiWaitType) {
if (multiWaitCopy != MultiWaitType)
return ((nnosWaitAny)(Address_weaks.WaitAny))(MultiWaitType);
return ((nnosTimedWaitAny)(Address_weaks.TimedWaitAny))(MultiWaitType, 1000000);
static uint8_t compare = 255;
if (compare == 255) compare = GetOperationMode(); //Trick for saving space
static uint8_t compare_def = 255;
if (compare_def == 255) compare_def = ReverseNX_RT->def; //Trick for saving space
ReverseNX_RT->pluginActive = true;
while(true) {
void* ret_value = ((nnosTimedWaitAny)(Address_weaks.TimedWaitAny))(MultiWaitType, 1000000);
if (ret_value != NULL) return ret_value;
if (compare_def == false && ReverseNX_RT->def == true) {
compare_def = ReverseNX_RT->def;
return multiWaitHolderCopy;
}
else compare_def = ReverseNX_RT->def;
if (!compare_def && compare != ReverseNX_RT->isDocked) {
compare = ReverseNX_RT->isDocked;
return multiWaitHolderCopy;
}
}
}

extern "C" {
Expand Down
8 changes: 1 addition & 7 deletions saltysd_core/source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,13 +406,7 @@ int main(int argc, char *argv[])
if (R_SUCCEEDED(shmemMapRc)) {
NX_FPS(&_sharedmemory);

uint64_t titid = 0;
svcGetInfo(&titid, 18, CUR_PROCESS_HANDLE, 0);

if (tid == 0x01008CF01BAAC000) {
SaltySDCore_printf("SaltySD Core: Detected \"The Legend of Zelda: Echoes of Wisdom\", disabling ReverseNX-RT...\n", ret);
}
else ReverseNX(&_sharedmemory);
ReverseNX(&_sharedmemory);

if (SaltySDCore_isRelrAvailable()) {
SaltySDCore_printf("SaltySD Core: Game is using RELR. Applying hacky solution.\n", ret);
Expand Down

0 comments on commit 2f59839

Please sign in to comment.