This commit is contained in:
恍兮惚兮 2024-03-15 16:08:16 +08:00
parent fc7ae055ab
commit a184ebae85
6 changed files with 117 additions and 8 deletions

View File

@ -1,6 +1,6 @@
include_directories(. util engines)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(enginessrc TYPEMOON ENTERGRAM AGES7 mono Godot Renpy 5pb IG LightVN V8 pchooks Artemis KiriKiri YOX PPSSPP CMVS Suika2 )
set(enginessrc TYPEMOON ENTERGRAM AGES7 mono Godot Renpy 5pb lucasystem LightVN V8 pchooks Artemis KiriKiri YOX PPSSPP CMVS Suika2 )
set(enginepath "engine64")
set(collector "enginecollection64.cpp")
else()

View File

@ -470,10 +470,61 @@ bool InsertStuffScript2Hook()
ConsoleOutput("INSERT StuffScript2");
return NewHook(hp, "StuffScript2");
}
bool StuffScript3Filter(LPVOID data, size_t *size, HookParam *)
{
auto text = reinterpret_cast<LPSTR>(data);
auto len = reinterpret_cast<size_t *>(size);
if (text[0] == '\x81' && text[1] == '\x40') { //removes space at the beginning of the sentence
*len -= 2;
::memmove(text, text + 2, *len);
}
StringFilterBetween(text, len, "/\x81\x79", 3, "\x81\x7A", 2); //remove hidden name
StringFilterBetween(text, len, "[", 1, "]", 1); //garbage
//ruby
CharFilter(text, len, '<');
StringFilterBetween(text, len, ",", 1, ">", 1);
StringCharReplacer(text, len, "_r\x81\x40", 4, ' ');
StringCharReplacer(text, len, "_r", 2, ' ');
return true;
}
bool InsertStuffScript3Hook()
{
/*
* Sample games:
* https://vndb.org/v3111
*/
const BYTE bytes[] = {
0xCC, // int 3
0x81, 0xEC, XX4, // sub esp,00000140 <-- hook here
0xA1, XX4, // mov eax,[EVOLIMIT.exe+8C1F0]
0x33, 0xC4, // xor eax,esp
0x89, 0x84, 0x24, XX4, // mov [esp+0000013C],eax
0x53, // push ebx
0x55, // push ebp
0x8B, 0xAC, 0x24, XX4, // mov ebp,[esp+0000014C]
0x8B, 0x45, 0x2C // mov eax,[ebp+2C]
};
ULONG range = min(processStopAddress - processStartAddress, MAX_REL_ADDR);
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStartAddress + range);
if (!addr) return false;
HookParam hp = {};
hp.address = addr + 1;
hp.offset = get_reg(regs::ecx);
hp.type = USING_STRING | NO_CONTEXT;
hp.filter_fun = StuffScript3Filter;
NewHook(hp, "StuffScript3");
return true;
}
bool StuffScript_attach_function() {
auto _=InsertStuffScriptHook();
_|=InsertStuffScript2Hook();
_|=InsertStuffScript3Hook();
return _;
}
bool _5pb::attach_function() {

View File

@ -1564,6 +1564,7 @@ bool KiriKiri4Filter(LPVOID data, size_t *size, HookParam *)
StringFilterBetween(text, len, L"[mruby r=", 9, L"\" text=\"", 8); // [mruby r="ゆきみ" text="由紀美"]
// ruby type 2
StringFilterBetween(text, len, L"[ruby text=", 11, L"]", 1); // [ruby text="せんがわ" align="e"][ch text="仙川"]
StringFilterBetween(text, len, L"[Ruby text", 10, L"]", 1); // [Ruby text = "Sawano"][ch text="沢野"]
StringFilter(text, len, L"[ch text=\"", 10); // [ruby text="せんがわ" align="e"][ch text="仙川"]
// ruby type 1-2
StringFilter(text, len, L"\"]", 2);
@ -1585,6 +1586,7 @@ bool InsertKiriKiri4Hook()
* https://vndb.org/v7804
* https://vndb.org/v11123
* https://vndb.org/v18650
* https://vndb.org/v38034
*/
const BYTE bytes[] = {
0xE8, XX4, // call Kansen1._GetExceptDLLinfo+67B <-- hook here

View File

@ -1,4 +1,4 @@
#include"IG.h"
#include"lucasystem.h"
bool InsertIG64Hook() {
//<2F><><EFBFBD>륿<EFBFBD><EBA5BF><EFBFBD><EFBFBD> FHD.exe
@ -67,7 +67,63 @@ bool InsertIG64Hook2() {
}
return ok;
}
bool IG::attach_function() {
return InsertIG64Hook2();
bool InsertLucaSystemHook()
{
/*
* Sample games:
* https://vndb.org/r108105
*/
const BYTE bytes[] = {
0xCC, // int 3
0x48, XX4, // mov [rsp+18],rbx <- hook here
0x55, // push rbp
0x56, // push rsi
0x57, // push rdi
0x41, 0x54, // push r12
0x41, 0x55, // push r13
0x41, 0x56, // push r14
0x41, 0x57, // push r15
0x48, 0x8D, 0xAC, 0x24, XX4, // lea rbp,[rsp-00003810]
0xB8, XX4 // mov eax,00003910
};
auto addr=MemDbg::findBytes(bytes, sizeof(bytes),processStartAddress, processStopAddress);
if(!addr)return false;
HookParam hp = {};
hp.address = addr + 1;
hp.offset = get_reg(regs::rdx) ; //RDX
hp.filter_fun = [](LPVOID data, size_t *size, HookParam *)
{
static std::wstring prevText;
auto text = reinterpret_cast<LPWSTR>(data);
auto len = reinterpret_cast<size_t *>(size);
if (text[0] == L'\x3000') { //removes space at the beginning of the sentence
*len -= 2;
::memmove(text, text + 1, *len);
}
if ( *text == L'@' ) //Name in square brackets instead of '@'
if ( wchar_t *match2 = cpp_wcsnchr(text+1, L'@', *len/2-1) ) {
*text = L'[';
*match2 = L']';
}
StringFilterBetween(text, len, L"$C(", 3, L")", 1);
StringFilter(text, len, L"$A", 3); // remove $A followed by 1 char
StringCharReplacer(text, len, L"$d", 2, L'\n');
CharFilter(text, len, L'\xFF3F');
//ruby
StringFilter(text, len, L"$[", 2);
StringFilterBetween(text, len, L"$/", 2, L"$]", 2);
return true;
};
hp.type = CODEC_UTF16 | USING_STRING;
NewHook(hp, "LucaSystem");
return true;
}
bool lucasystem::attach_function() {
return InsertIG64Hook2()|InsertLucaSystemHook();
}

View File

@ -1,8 +1,8 @@
#include"engine.h"
class IG:public ENGINE{
class lucasystem:public ENGINE{
public:
IG(){
lucasystem(){
check_by=CHECK_BY::FILE;
is_engine_certain=false;

View File

@ -11,7 +11,7 @@
#include"engine64/Suika2.h"
#include"engine64/CMVS.h"
#include"engine64/5pb.h"
#include"engine64/IG.h"
#include"engine64/lucasystem.h"
#include"engine64/ENTERGRAM.h"
#include"engine64/TYPEMOON.h"
#include"engine64/LightVN.h"
@ -29,7 +29,7 @@ std::vector<ENGINE*> check_engines(){
new Artemis,
new KiriKiri,
new YOX,
new IG,
new lucasystem,
new LightVN,
new CMVS,
new Suika2,