diff --git a/cpp/LunaHook/LunaHook/CMakeLists.txt b/cpp/LunaHook/LunaHook/CMakeLists.txt index f0135355..8fe8713a 100644 --- a/cpp/LunaHook/LunaHook/CMakeLists.txt +++ b/cpp/LunaHook/LunaHook/CMakeLists.txt @@ -1,10 +1,29 @@ include_directories(. util engines) if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) - set(enginessrc BGI MKXPZ Ryujinx livecaptions Kincaid vita3k rpcs3 yuzu TYPEMOON UnrealEngine AGES7 mono Godot 5pb lucasystem LightVN V8 Artemis KiriKiri YOX CMVS Suika2 ) + set(enginessrc + BGI MKXPZ Ryujinx livecaptions Kincaid vita3k rpcs3 yuzu TYPEMOON UnrealEngine AGES7 mono + Godot 5pb lucasystem LightVN V8 Artemis KiriKiri YOX CMVS Suika2) set(enginepath "engine64") set(collector "enginecollection64.cpp") else() - set(enginessrc e_Erekiteru AbogadoPowers DAC BunBun antique T2U Moonstone Aromarie Winters Cage AGE_System AksysGames RPGMaker Stronger TACTICS Onscripter Sceplay DISCOVERY Erogos godot A98SYS GuruGuruSMF4 TeethingRing Fizz CoffeeMaker VALKYRIA mirage CisLugI tamasoft FrontWing solfasys Diskdream splushwave ransel akatombo GASTRO GSX Aksys ScrPlayer SYSD KISS IGScript Jellyfish BKEngine Overflow SRPGStudio Suika2 FVP LCScript Ohgetsu RPGMakerRGSS3 ONScripterru OVERDRIVE HXP Palette Purple Ruf RUNE Tarte Tomato Sakuradog Troy VitaminSoft UnknownEngine TSSystem Xbangbang Anisetta Nijyuei Interheart LovaGame Giga Jisatu101 EntisGLS Ciel ACTGS TerraLunar jukujojidai VanillawareGC cef V8 mono PONScripter Bishop sakanagl Lightvn KiriKiri SideB BGI Bootup morning shyakunage Regista NNNConfig Eushully Majiro littlecheese Elf Silkys CMVS Wolf Circus1 Circus2 Cotopha Artemis CatSystem Atelier Tenco QLIE Pal AIL NeXAS LunaSoft Unicorn Rejet Interlude AdobeAir Retouch Malie Live Nexton Lucifen Waffle TinkerBell SystemAoi Yuris Nitroplus2 Bruns EME RRE Candy Speed ApricoT Triangle AB2Try MBLMED GameMaker DxLib CodeX Minori Sprite RpgmXP Eagls Debonosu C4 WillPlus Tanuki GXP AOS Mink YukaSystem2 sakusesu Exp Syuntada Pensil Anim hibiki Nitroplus Reallive Siglus Taskforce2 RUGP IronGameSystem Anex86 ShinyDaysGame MarineHeart ShinaRio CaramelBox UnisonShift Escude Ryokucha Alice Footy2 utawarerumono System4x Abalone Abel 5pb HorkEye XUSE Leaf Nekopack AXL AGS AdobeFlash10 FocasLens Tamamo Ages3ResT) + set(enginessrc + e_Erekiteru AbogadoPowers DAC BunBun antique T2U Moonstone Aromarie Winters Cage AGE_System + AksysGames RPGMaker Stronger TACTICS Onscripter Sceplay DISCOVERY Erogos godot A98SYS + GuruGuruSMF4 TeethingRing Fizz CoffeeMaker VALKYRIA mirage CisLugI tamasoft FrontWing solfasys + Diskdream splushwave ransel akatombo GASTRO GSX Aksys ScrPlayer SYSD KISS IGScript Jellyfish + BKEngine Overflow SRPGStudio Suika2 FVP LCScript Ohgetsu RPGMakerRGSS3 ONScripterru OVERDRIVE + HXP Palette Purple Ruf RUNE Tarte Tomato Sakuradog Troy VitaminSoft UnknownEngine TSSystem + Xbangbang Anisetta Nijyuei Interheart LovaGame Giga Jisatu101 EntisGLS Ciel ACTGS TerraLunar + jukujojidai VanillawareGC cef V8 mono PONScripter Bishop sakanagl Lightvn KiriKiri SideB BGI + Bootup morning shyakunage Regista NNNConfig Eushully Majiro littlecheese Elf Silkys CMVS Wolf + Circus1 Circus2 Cotopha Artemis CatSystem Atelier Tenco QLIE Pal AIL NeXAS LunaSoft Unicorn + Rejet Interlude AdobeAir Retouch Malie Live Nexton Lucifen Waffle TinkerBell SystemAoi Yuris + Nitroplus2 Bruns EME RRE Candy Speed ApricoT Triangle AB2Try MBLMED GameMaker DxLib CodeX + Minori Sprite RpgmXP Eagls Debonosu C4 WillPlus Tanuki GXP AOS Mink YukaSystem2 sakusesu Exp + Syuntada Pensil Anim hibiki Nitroplus Reallive Siglus Taskforce2 RUGP IronGameSystem Anex86 + ShinyDaysGame MarineHeart ShinaRio CaramelBox UnisonShift Escude Ryokucha Alice Footy2 + utawarerumono System4x Abalone Abel 5pb HorkEye XUSE Leaf Nekopack AXL AGS AdobeFlash10 + FocasLens Tamamo Ages3ResT H_do_C) set(enginepath "engine32") set(collector "enginecollection32.cpp") endif() diff --git a/cpp/LunaHook/LunaHook/engine32/Circus1.cpp b/cpp/LunaHook/LunaHook/engine32/Circus1.cpp index 4d4c1a83..7a675d91 100644 --- a/cpp/LunaHook/LunaHook/engine32/Circus1.cpp +++ b/cpp/LunaHook/LunaHook/engine32/Circus1.cpp @@ -90,7 +90,7 @@ bool Circus1::attach_function() bool Circus_old::attach_function() { //[041213][CIRCUS]最終試験くじら - auto call = finddllfunctioncall((DWORD)GetGlyphOutlineA, processStartAddress, processStopAddress); + auto call = findiatcallormov((DWORD)GetGlyphOutlineA, processStartAddress, processStartAddress, processStopAddress); if (!call) return false; auto func = MemDbg::findEnclosingAlignedFunction(call); diff --git a/cpp/LunaHook/LunaHook/engine32/H_do_C.cpp b/cpp/LunaHook/LunaHook/engine32/H_do_C.cpp new file mode 100644 index 00000000..030116cc --- /dev/null +++ b/cpp/LunaHook/LunaHook/engine32/H_do_C.cpp @@ -0,0 +1,67 @@ +#include "H_do_C.h" +// https://vndb.org/v565 +// 夢見師 +namespace +{ + bool nomal() + { + auto call = findiatcallormov((ULONG)GetGlyphOutlineA, processStartAddress, processStartAddress, processStopAddress, false, XX); + if (!call) + return false; + BYTE sig[] = {0xB8, 0x68, 0x24, 0x00, 0x00}; + auto addr = reverseFindBytes(sig, sizeof(sig), call - 0x100, call); + if (!addr) + return false; + auto as = findxref_reverse_checkcallop(addr, processStartAddress, processStopAddress, 0xe8); + if (as.size() != 2) + return false; + auto as0 = MemDbg::findEnclosingAlignedFunction(as[0]); + auto as1 = MemDbg::findEnclosingAlignedFunction(as[1]); + if (as0 != as1) + return false; + if (!as0) + return false; + HookParam hp; + hp.address = as0; + hp.offset = stackoffset(2); + hp.type = USING_CHAR | CODEC_ANSI_BE; + return NewHook(hp, "H_do_C"); + } + bool embed() + { + BYTE sig[] = { + 0x8a, 0x03, + 0x3c, 0x7c, + 0x0f, 0x84, XX4, + 0x3c, 0x80, + 0x72, 0x0b, + 0x83, 0xc6, 0x02, + 0x83, 0xc3, 0x02, + 0xe9, XX4, + 0x3c, 0x5c, + 0x0f, 0x85, XX4, + 0x8a, 0x43, 0x01, + 0x83, 0xc3, 0x01, + 0x83, 0xc6, 0x01, + 0x3c, 0x31}; + bool succ = false; + for (auto addr : Util::SearchMemory(sig, sizeof(sig), PAGE_EXECUTE, processStartAddress, processStopAddress)) + { + addr = MemDbg::findEnclosingAlignedFunction(addr); + if (!addr) + continue; + HookParam hp; + hp.address = addr; + hp.offset = regoffset(ecx); + hp.type = USING_STRING | EMBED_ABLE | EMBED_AFTER_NEW | EMBED_DYNA_SJIS; + hp.embed_hook_font = F_GetGlyphOutlineA; + hp.lineSeparator = L"||"; + succ |= NewHook(hp, "H_do_C"); + } + return succ; + } +} +bool H_do_C::attach_function() +{ + return embed() | nomal(); +} \ No newline at end of file diff --git a/cpp/LunaHook/LunaHook/engine32/H_do_C.h b/cpp/LunaHook/LunaHook/engine32/H_do_C.h new file mode 100644 index 00000000..96303f3d --- /dev/null +++ b/cpp/LunaHook/LunaHook/engine32/H_do_C.h @@ -0,0 +1,14 @@ + + +class H_do_C : public ENGINE +{ +public: + H_do_C() + { + + check_by = CHECK_BY::CUSTOM; + check_by_target = []() + { return Util::CheckFile(L"*.pak") && Util::SearchResourceString(L"(C) H℃"); }; + }; + bool attach_function(); +}; \ No newline at end of file diff --git a/cpp/LunaHook/LunaHook/engine32/Silkys.cpp b/cpp/LunaHook/LunaHook/engine32/Silkys.cpp index 7ecafe45..d702aa72 100644 --- a/cpp/LunaHook/LunaHook/engine32/Silkys.cpp +++ b/cpp/LunaHook/LunaHook/engine32/Silkys.cpp @@ -417,7 +417,7 @@ namespace bool saiminset() { //[230929][1237052][シルキーズSAKURA] 催眠奪女Set パッケージ版 - auto addr1 = finddllfunctioncall((DWORD)GetGlyphOutlineA, processStartAddress, processStopAddress); + auto addr1 = findiatcallormov((DWORD)GetGlyphOutlineA, processStartAddress, processStartAddress, processStopAddress); if (addr1 == 0) return false; auto func1 = MemDbg::findEnclosingAlignedFunction(addr1); diff --git a/cpp/LunaHook/LunaHook/enginecollection32.cpp b/cpp/LunaHook/LunaHook/enginecollection32.cpp index d6389b70..4ce023cf 100644 --- a/cpp/LunaHook/LunaHook/enginecollection32.cpp +++ b/cpp/LunaHook/LunaHook/enginecollection32.cpp @@ -6,6 +6,7 @@ #include "engine32/mono.h" #include "engine32/Tarte.h" #include "engine32/sakanagl.h" +#include "engine32/H_do_C.h" #include "engine32/LCScript.h" #include "engine32/Cage.h" #include "engine32/ONScripterru.h" @@ -426,5 +427,7 @@ std::vector check_engines() new BunBun, new DAC, new AbogadoPowers, - new e_Erekiteru}; + new e_Erekiteru, + new H_do_C + }; } \ No newline at end of file diff --git a/cpp/LunaHook/LunaHook/util/util.cc b/cpp/LunaHook/LunaHook/util/util.cc index 0be7e883..fa3a4202 100644 --- a/cpp/LunaHook/LunaHook/util/util.cc +++ b/cpp/LunaHook/LunaHook/util/util.cc @@ -431,19 +431,6 @@ std::vector findrelativecall(const BYTE *pattern, int length, DWORD calla } return save; } -uintptr_t finddllfunctioncall(uintptr_t funcptr, uintptr_t start, uintptr_t end, WORD sig, bool reverse) -{ - auto entry = Util::FindImportEntry(start, funcptr); - if (entry == 0) - return 0; - BYTE bytes[] = {0xFF, 0x15, XX4}; - memcpy(bytes + 2, &entry, 4); - memcpy(bytes, &sig, 2); - if (reverse) - return reverseFindBytes(bytes, sizeof(bytes), start, end); - else - return MemDbg::findBytes(bytes, sizeof(bytes), start, end); -} uintptr_t findfuncstart(uintptr_t start, uintptr_t range, bool checkalign) { const BYTE funcstart[] = { diff --git a/cpp/LunaHook/LunaHook/util/util.h b/cpp/LunaHook/LunaHook/util/util.h index 1cd21875..227d6d38 100644 --- a/cpp/LunaHook/LunaHook/util/util.h +++ b/cpp/LunaHook/LunaHook/util/util.h @@ -57,7 +57,6 @@ uintptr_t SafeFindBytes(LPCVOID pattern, size_t patternSize, uintptr_t lowerBoun std::vector findrelativecall(const BYTE *pattern, int length, DWORD calladdress, DWORD start, DWORD end); -uintptr_t finddllfunctioncall(uintptr_t funcptr, uintptr_t start, uintptr_t end, WORD sig = 0x15ff, bool reverse = false); uintptr_t findfuncstart(uintptr_t addr, uintptr_t range = 0x100, bool checkalign = false); uintptr_t findiatcallormov(uintptr_t addr, DWORD hmodule, uintptr_t start, uintptr_t end, bool reverse = false, BYTE movreg = 0); std::vector findiatcallormov_all(uintptr_t addr, DWORD hmodule, uintptr_t start, uintptr_t end, DWORD protect, BYTE movreg = 0);