From 715bf9feaa58a5f19839fcae7a66bdfcf657e036 Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sat, 18 Aug 2018 19:06:45 -0400 Subject: [PATCH] update scenarioplayer hook --- vnrhook/src/engine/engine.cc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/vnrhook/src/engine/engine.cc b/vnrhook/src/engine/engine.cc index 2e4e339..52d7dc8 100644 --- a/vnrhook/src/engine/engine.cc +++ b/vnrhook/src/engine/engine.cc @@ -11355,18 +11355,23 @@ bool InsertScenarioPlayerHook() } HookParam hp = {}; - hp.address = addr; + //hp.address = addr; hp.length_offset = 1; hp.offset = 4; - if (addr - start == addr_offset_W) { - hp.type = USING_UNICODE; - ConsoleOutput("vnreng: INSERT ScenarioPlayerW"); - NewHook(hp, "ScenarioPlayerW"); - } else { - hp.type = BIG_ENDIAN; // 4 - ConsoleOutput("vnreng: INSERT ScenarioPlayerA"); - NewHook(hp, "ScenarioPlayerA"); - } + //if (addr - start == addr_offset_W) { + // Artikash 8/18/2018: can't figure out how to tell apart which hook is needed, so just insert both xD + HookParam hp2 = hp; + + hp.type = USING_UNICODE; + hp.address = addr; + ConsoleOutput("vnreng: INSERT ScenarioPlayerW"); + NewHook(hp, "ScenarioPlayerW"); + //} else { + hp2.type = BIG_ENDIAN; // 4 + hp2.address = addr + 5; + ConsoleOutput("vnreng: INSERT ScenarioPlayerA"); + NewHook(hp2, "ScenarioPlayerA"); + //} return true; }