This commit is contained in:
恍兮惚兮 2025-01-09 11:58:55 +08:00
parent c46b9e05b1
commit 68575aee1a
5 changed files with 44 additions and 11 deletions

View File

@ -892,6 +892,21 @@ namespace ppsspp
strReplace(s, "#n", ""); strReplace(s, "#n", "");
buffer->from(s); buffer->from(s);
} }
void ULJM05703(TextBuffer *buffer, HookParam *hp)
{
auto s = buffer->strA();
s = std::regex_replace(s, std::regex(R"(#Kana\[(.*?),(.*?)\])"), "$1");
strReplace(s, "\x81\x40", "");
buffer->from(s);
ULJM05943F(buffer, hp);
}
void ULJM05915(TextBuffer *buffer, HookParam *hp)
{
auto s = buffer->strA();
strReplace(s, "#n#", "\n#");
buffer->from(s);
ULJM05943F(buffer, hp);
}
void FULJM05889(TextBuffer *buffer, HookParam *) void FULJM05889(TextBuffer *buffer, HookParam *)
{ {
auto text = reinterpret_cast<LPSTR>(buffer->buff); auto text = reinterpret_cast<LPSTR>(buffer->buff);
@ -929,7 +944,6 @@ namespace ppsspp
s = std::regex_replace(s, std::regex("\\n+"), ""); s = std::regex_replace(s, std::regex("\\n+"), "");
buffer->from(s); buffer->from(s);
} }
void ULJM05441(hook_context *context, HookParam *hp, TextBuffer *buffer, uintptr_t *split) void ULJM05441(hook_context *context, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
{ {
auto data = PPSSPP::emu_arg(context)[1]; auto data = PPSSPP::emu_arg(context)[1];
@ -1718,6 +1732,8 @@ namespace ppsspp
{0x88C0410, {0, 2, 0, 0, ULJM05019, "ULJM05019"}}, {0x88C0410, {0, 2, 0, 0, ULJM05019, "ULJM05019"}},
// 遙かなる時空の中で3 with 十六夜記 愛蔵版 // 遙かなる時空の中で3 with 十六夜記 愛蔵版
{0x89024C8, {0, 0, 0, ULJM05441, 0, "ULJM05441"}}, {0x89024C8, {0, 0, 0, ULJM05441, 0, "ULJM05441"}},
// 遙かなる時空の中で3 運命の迷宮 愛蔵版
{0x89081f4, {0, 0, 0, ULJM05441, 0, "ULJM05547"}},
// 遙かなる時空の中で4 愛蔵版 // 遙かなる時空の中で4 愛蔵版
{0x8955CE0, {0, 0, 0, ULJM05810, 0, "ULJM05810"}}, {0x8955CE0, {0, 0, 0, ULJM05810, 0, "ULJM05810"}},
// 遙かなる時空の中で5 風花記 // 遙かなる時空の中で5 風花記
@ -2060,5 +2076,11 @@ namespace ppsspp
{0x88E08D0, {0, 3, 0, 0, 0, "ULJM0610[78]"}}, {0x88E08D0, {0, 3, 0, 0, 0, "ULJM0610[78]"}},
// 花帰葬 // 花帰葬
{0x88139f4, {CODEC_UTF16, 0, 0, 0, ULJM05701, "ULJM05701"}}, {0x88139f4, {CODEC_UTF16, 0, 0, 0, ULJM05701, "ULJM05701"}},
// 死神所業~怪談ロマンス~
{0x8857390, {0, 1, 0, 0, 0, "ULJM06334"}},
// 二世の契り
{0x888D34C, {0, 3, 0, 0, ULJM05703, "ULJM05703"}},
// 二世の契り 想い出の先へ
{0x88744A8, {0, 3, 0, 0, ULJM05915, "ULJM05915"}},
}; };
} }

View File

@ -256,9 +256,12 @@ void SafeSendJitVeh(hook_context *context, uintptr_t address, uint64_t em_addr,
{ {
} }
} }
bool safeleave = false;
std::unordered_map<uintptr_t, uint64_t> addresscalledtime; std::unordered_map<uintptr_t, uint64_t> addresscalledtime;
bool SendJitVeh(PCONTEXT pcontext, uintptr_t address, uint64_t em_addr, JITTYPE jittype, intptr_t padding) bool SendJitVeh(PCONTEXT pcontext, uintptr_t address, uint64_t em_addr, JITTYPE jittype, intptr_t padding)
{ {
if (safeleave)
return false;
if (addresscalledtime.find(address) == addresscalledtime.end()) if (addresscalledtime.find(address) == addresscalledtime.end())
addresscalledtime[address] = 0; addresscalledtime[address] = 0;
auto tm = GetTickCount64(); auto tm = GetTickCount64();
@ -555,10 +558,11 @@ void _SearchForHooks(SearchParam spUser)
auto f = fopen("1.txt", "a"); auto f = fopen("1.txt", "a");
for (auto addr : jitaddr2emuaddr) for (auto addr : jitaddr2emuaddr)
{ {
fprintf(f, "%llx => %llx\n", addr.second.second, addr.first); fprintf(f, "%llx => %p\n", addr.second.second, addr.first);
} }
fclose(f); fclose(f);
#endif #endif
safeleave = false;
std::vector<newFuncType> funcs; std::vector<newFuncType> funcs;
std::vector<void *> successaddr; std::vector<void *> successaddr;
for (auto addr : jitaddr2emuaddr) for (auto addr : jitaddr2emuaddr)
@ -574,7 +578,9 @@ void _SearchForHooks(SearchParam spUser)
ConsoleOutput(TR[HOOK_SEARCH_INITIALIZED], successaddr.size()); ConsoleOutput(TR[HOOK_SEARCH_INITIALIZED], successaddr.size());
ConsoleOutput(TR[MAKE_GAME_PROCESS_TEXT], sp.searchTime / 1000); ConsoleOutput(TR[MAKE_GAME_PROCESS_TEXT], sp.searchTime / 1000);
Sleep(sp.searchTime); Sleep(sp.searchTime);
remove_veh_hook(successaddr); // remove_veh_hook(successaddr);
// remove_veh_hook还是有问题容易崩
safeleave = true;
} }
SearchForHooks_Return(); SearchForHooks_Return();
} }

View File

@ -443,10 +443,14 @@ bool TextHook::breakpointcontext(PCONTEXT pcontext)
context.toPCONTEXT(pcontext); context.toPCONTEXT(pcontext);
return true; return true;
} }
extern bool safeleave;
bool TextHook::InsertBreakPoint() bool TextHook::InsertBreakPoint()
{ {
// MH_CreateHook 64位unity/yuzu-emu经常 MH_ERROR_MEMORY_ALLOC // MH_CreateHook 64位unity/yuzu-emu经常 MH_ERROR_MEMORY_ALLOC
return add_veh_hook(location, std::bind(&TextHook::breakpointcontext, this, std::placeholders::_1)); for (int i = 0; i < 1 + safeleave; i++)
if (add_veh_hook(location, std::bind(&TextHook::breakpointcontext, this, std::placeholders::_1)))
return true;
return false;
} }
void TextHook::RemoveBreakPoint() void TextHook::RemoveBreakPoint()
{ {

View File

@ -108,12 +108,13 @@ bool __remove_veh_hook(void *origFunc)
void remove_veh_hook(void *origFunc) void remove_veh_hook(void *origFunc)
{ {
// 仅会在手动移除时被调用 // 仅会在手动移除时被调用
while (true) // while (true)
{ // {
std::lock_guard _(vehlistlock); // std::lock_guard _(vehlistlock);
if (__remove_veh_hook(origFunc)) if (__remove_veh_hook(origFunc))
break; ;
} // break;
//}
} }
void remove_veh_hook(std::vector<void *> origFuncs) void remove_veh_hook(std::vector<void *> origFuncs)
{ {

View File

@ -1,7 +1,7 @@
set(VERSION_MAJOR 6) set(VERSION_MAJOR 6)
set(VERSION_MINOR 19) set(VERSION_MINOR 19)
set(VERSION_PATCH 1) set(VERSION_PATCH 2)
set(VERSION_REVISION 0) set(VERSION_REVISION 0)
set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}") set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}")
add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp) add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp)