This commit is contained in:
恍兮惚兮 2024-11-27 17:27:29 +08:00
parent 4d8475f5c1
commit b46e0538ae
8 changed files with 101 additions and 15 deletions

View File

@ -273,7 +273,7 @@ namespace hookmages
buffer->from(s);
}
bool MAGES()
bool MAGES_text()
{
#ifndef _WIN64
auto dialogSigOffset = 2;
@ -371,10 +371,10 @@ namespace hookmages
// hookaddr上是没有重复的pos上是都能读到但有重复。
hp.text_fun = SpecialHookMAGES<0>;
hp.type = CODEC_UTF16 | USING_STRING | NO_CONTEXT;
auto _ = NewHook(hp, "5pb_MAGES");
auto _ = NewHook(hp, "MAGES_text");
hp.address = pos;
hp.text_fun = SpecialHookMAGES<1>;
_ |= NewHook(hp, "5pb_MAGES");
_ |= NewHook(hp, "MAGES_text");
ConsoleOutput("%p %p", hookaddr, pos);
return _;
@ -417,9 +417,41 @@ namespace hookmages
hp.address = hookaddr;
hp.text_fun = SpecialHookMAGES<0>;
hp.type = CODEC_UTF16 | USING_STRING | NO_CONTEXT;
return NewHook(hp, "5pb_MAGES");
return NewHook(hp, "MAGES");
#endif
}
void MAGES_mail()
{
#ifndef _WIN64
BYTE sig1[] = {
0xe8, XX, XX, XX, 0x00, 0x6a, 0x18, 0x50, 0x68, XX, 0x01, 0x00, 0x00, 0xe8, XX4, 0x8b};
auto sigsize = sizeof(sig1);
auto addr = MemDbg::findBytes(sig1, sizeof(sig1), processStartAddress, processStopAddress);
if (!addr)
{
BYTE sig2[] = {
0xe8, XX, XX, XX, 0x00, 0x6a, 0x18, XX, XX, 0xb9, XX, 0x01, 0x00, 0x00, 0xe8, XX4, 0x8b};
sigsize = sizeof(sig2);
addr = MemDbg::findBytes(sig2, sizeof(sig2), processStartAddress, processStopAddress);
}
if (!addr)
return;
addr += sigsize - 6;
addr += *(int *)(addr + 1) + 5;
HookParam hp;
hp.address = addr;
hp.text_fun = SpecialHookMAGES<0>;
hp.type = CODEC_UTF16 | USING_STRING | NO_CONTEXT;
NewHook(hp, "MAGES_mail");
#endif
}
bool MAGES()
{
auto succ = MAGES_text();
if (succ)
MAGES_mail();
return succ;
}
}

View File

@ -368,6 +368,30 @@ namespace ppsspp
last = s;
buffer->from(s);
}
void ULJM06289(TextBuffer *buffer, HookParam *hp)
{
StringFilter(buffer, "#n", 2);
StringFilter(buffer, "\x81\x40", 2);
auto s = buffer->strA();
s = std::regex_replace(s, std::regex("(#[A-Za-z]+\\[(\\d*[.])?\\d+\\])+"), "");
buffer->from(s);
}
namespace
{
void ULJM05823_1(TextBuffer *buffer, HookParam *hp)
{
StringFilter(buffer, "#n", 2);
auto s = buffer->strA();
s = std::regex_replace(s, std::regex("(#[A-Za-z]+\\[(\\d*[.])?\\d+\\])+"), "");
buffer->from(s);
}
void ULJM05823_2(TextBuffer *buffer, HookParam *hp)
{
auto s = buffer->viewA();
if (s.find("#n") != s.npos)
return buffer->clear();
}
}
std::unordered_map<uintptr_t, emfuncinfo> emfunctionhooks = {
// Shinigami to Shoujo
{0x883bf34, {0, 1, 0, 0, ULJS00403_filter, "ULJS00403"}},
@ -459,6 +483,36 @@ namespace ppsspp
{0x880a744, {0, 0, 0, 0, ULJM05943F, "ULJM0630[23]"}}, // ULJM06302 & ULJM06303
// アーメン・ノワール ポータブル
{0x883b6a8, {0, 0, 0, 0, ULJM05943F, "ULJM06064"}},
// デス・コネクション ポータブル
{0x882AEF4, {0, 0, 0, 0, ULJM05823_1, "ULJM05823"}},
{0x88B2464, {0, 0, 0, 0, ULJM05823_2, "ULJM05823"}}, // text+name->name
// しらつゆの怪
{0x888A26C, {0, 0, 0, 0, ULJM06289, "ULJM06289"}},
// 新装版クローバーの国のアリスWonderful Wonder World
{0x8875E50, {0, 1, 0, 0, 0, "NPJH50894"}},
// ダイヤの国のアリスWonderful Wonder World
{0x8857E3C, {0, 0, 0, 0, 0, "ULJM06216"}},
// ダイヤの国のアリス~ Wonderful Mirror World
{0x8855AE4, {0, 1, 0, 0, 0, "ULJM06295"}},
// ハートの国のアリスWonderful Twin World
{0x8881CAC, {0, 1, 0, 0, 0, "NPJH50872"}},
// 新装版 ハートの国のアリスWonderful Wonder World
{0x886B610, {0, 1, 0, 0, 0, "ULJM06332"}},
// S・Y・K ~新説西遊記~ ポータブル
{0x88DD918, {0, 0, 0, 0, ULJM05823_2, "ULJM05697"}}, // text+name->name
{0x88DA420, {0, 4, 0, 0, ULJM05823_1, "ULJM05697"}},
// Glass Heart Princess
{0x885FA30, {0, 0, 0, 0, ULJM05823_1, "ULJM06196"}},
// Glass Heart Princess:PLATINUM
{0x885D4F0, {0, 0, 0, 0, ULJM05823_1, "ULJM06309"}},
// ウィル・オ・ウィスプ ポータブル
{0x885DD04, {0, 0, 0, 0, ULJM05823_1, "ULJM05447"}},
// 華鬼 ~恋い初める刻 永久の印~
{0x8829F14, {0, 4, 0, 0, ULJM05823_1, "ULJM05847"}},
{0x886D270, {0, 0, 0, 0, ULJM05823_2, "ULJM05847"}},
// 華鬼 ~夢のつづき~
{0x88406CC, {0, 0, 0, 0, ULJM05823_1, "ULJM06048"}}, // text
{0x885B7BC, {0, 0, 0, 0, ULJM05823_1, "ULJM06048"}}, // name+text
};
}

View File

@ -37,8 +37,7 @@ DWORD WINAPI Pipe(LPVOID)
*(DWORD *)buffer = GetCurrentProcessId();
WriteFile(hookPipe, buffer, sizeof(DWORD), &count, nullptr);
WORD hookversion[4] = LUNA_VERSION;
WriteFile(hookPipe, hookversion, sizeof(hookversion), &count, nullptr);
WriteFile(hookPipe, LUNA_VERSION, sizeof(LUNA_VERSION), &count, nullptr);
ConsoleOutput(PIPE_CONNECTED);
HIJACK();

View File

@ -310,10 +310,9 @@ LunaHost::LunaHost()
} })
.detach();
WORD version[4] = LUNA_VERSION;
WCHAR vs[32];
wsprintf(vs, L" | %s v%d.%d.%d", VersionCurrent, version[0], version[1], version[2]);
wsprintf(vs, L" | %s v%d.%d.%d", VersionCurrent, LUNA_VERSION[0], LUNA_VERSION[1], LUNA_VERSION[2]);
title += vs;
settext(title);
std::thread([&]()

View File

@ -102,9 +102,8 @@ namespace
Host::AddConsoleOutput(FormatString(PROC_CONN,processId));
//CreatePipe();
WORD hookversion[4];
WORD hostversion[4]=LUNA_VERSION;
if( ReadFile(hookPipe, hookversion, sizeof(hookversion), &bytesRead, nullptr)){
if(memcmp(hostversion,hookversion,sizeof(hookversion))!=0)
if(memcmp(hookversion,LUNA_VERSION,sizeof(hookversion))!=0)
Host::Warning(UNMATCHABLEVERSION);
}

View File

@ -32,4 +32,5 @@ constexpr auto LUNA_HOOK_DLL = LUNA_HOOK_DLL_64; // .dll but LoadLibrary automat
constexpr auto LUNA_HOOK_DLL = LUNA_HOOK_DLL_32; // .dll but LoadLibrary automatically adds that
#endif
extern WORD LUNA_VERSION[4];
// EOF

View File

@ -1,10 +1,10 @@
set(VERSION_MAJOR 6)
set(VERSION_MINOR 6)
set(VERSION_PATCH 7)
set(VERSION_PATCH 8)
set(VERSION_REVISION 0)
set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}")
add_library(VERSION_DEF INTERFACE)
target_compile_definitions(VERSION_DEF INTERFACE
LUNA_VERSION=${LUNA_VERSION})
add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp)
target_compile_definitions(VERSION_DEF PRIVATE
LUNA_VERSION_=${LUNA_VERSION})
include(${CMAKE_CURRENT_LIST_DIR}/version/generate_product_version.cmake)

2
cpp/version_def.cpp Normal file
View File

@ -0,0 +1,2 @@
#include<Windows.h>
WORD LUNA_VERSION[4] = LUNA_VERSION_;