diff --git a/DDrawCompat/Common/Hook.cpp b/DDrawCompat/Common/Hook.cpp index cd3ea88..d8f1934 100644 --- a/DDrawCompat/Common/Hook.cpp +++ b/DDrawCompat/Common/Hook.cpp @@ -140,7 +140,12 @@ namespace else if (0xFF == targetFunc[0] && 0x25 == targetFunc[1]) { instructionSize = 6; - targetFunc = **reinterpret_cast(targetFunc + 2); + auto candidateTargetFunc = **reinterpret_cast(targetFunc + 2); + if (Compat::getModuleHandleFromAddress(candidateTargetFunc) == Compat::getModuleHandleFromAddress(targetFunc)) + { + break; + } + targetFunc = candidateTargetFunc; } else {