Skip to content

Commit

Permalink
update hook.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chinosk6 committed Apr 5, 2024
1 parent e9c45ca commit 6b1dc99
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1524,23 +1524,21 @@ namespace

int slotNewCount = 0;
bool settingLiveIdolSlot = false;
void* lastNewMvUnitSlot = NULL;
void* lastIdol = NULL;

void* MvUnitSlotGenerator_NewMvUnitSlot_orig;
void* MvUnitSlotGenerator_NewMvUnitSlot_hook(int slot, void* idol, void* method) {
if (g_allow_same_idol && settingLiveIdolSlot) {
if (slotNewCount >= 1) {
printf("catch exchange.\n");
return lastNewMvUnitSlot;
idol = lastIdol;
}
else {
slotNewCount++;
lastIdol = idol;
}
}

auto ret = reinterpret_cast<decltype(MvUnitSlotGenerator_NewMvUnitSlot_hook)*>(MvUnitSlotGenerator_NewMvUnitSlot_orig)(slot, idol, method);
lastNewMvUnitSlot = ret;
return ret;
return reinterpret_cast<decltype(MvUnitSlotGenerator_NewMvUnitSlot_hook)*>(MvUnitSlotGenerator_NewMvUnitSlot_orig)(slot, idol, method);
}

void* LiveMVUnitMemberChangePresenter_initializeAsync_b_4_MoveNext_orig;
Expand Down

0 comments on commit 6b1dc99

Please sign in to comment.