livecaptions

This commit is contained in:
恍兮惚兮 2024-05-19 16:32:44 +08:00
parent 12ba523edd
commit d15804a5b8
4 changed files with 69 additions and 2 deletions

View File

@ -1,6 +1,6 @@
include_directories(. util engines)
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
set(enginessrc Kincaid vita3k rpcs3 yuzusuyu TYPEMOON ENTERGRAM AGES7 mono Godot Renpy 5pb lucasystem LightVN V8 pchooks Artemis KiriKiri YOX PPSSPP CMVS Suika2 )
set(enginessrc livecaptions Kincaid vita3k rpcs3 yuzusuyu 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

@ -0,0 +1,49 @@
#include "livecaptions.h"
bool livecaptions::attach_function()
{
// .text:0000000180001C98 push rbx
// .text:0000000180001C9A sub rsp, 20h
// .text:0000000180001C9E mov rbx, rcx
// .text:0000000180001CA1 call memmove_0
// .text:0000000180001CA6 mov rax, rbx
// .text:0000000180001CA9 add rsp, 20h
// .text:0000000180001CAD pop rbx
// .text:0000000180001CAE retn
HookParam hp;
hp.address=(uintptr_t)GetProcAddress(GetModuleHandle(L"vcruntime140_app.dll"),"memmove");
hp.text_fun=[](hook_stack *stack, HookParam *hp, uintptr_t *data, uintptr_t *split, size_t *len){
BYTE sig[]={
0x40,0x53,0x48,0x83,0xEC,0x20,0x48,0x8B,0xD9,
0xE8,XX4
};
auto a1=stack->retaddr-sizeof(sig);
if((stack->retaddr>(uintptr_t)GetModuleHandle(L"Microsoft.CognitiveServices.Speech.extension.embedded.sr.dll")))
if(memcmp((void*)a1,&sig,sizeof(sig)-4)==0){
static std::set<uintptr_t>once;
if(once.find(stack->retaddr)!=once.end())return;
once.insert(stack->retaddr);
// hp->text_fun=nullptr;
// hp->type=HOOK_EMPTY;
HookParam hpinternal;
hpinternal.address =a1;// 0xE551+(uintptr_t)GetModuleHandle(L"Microsoft.CognitiveServices.Speech.extension.embedded.sr.dll");
hpinternal.type = USING_STRING | CODEC_UTF8|FULL_STRING;
hpinternal.text_fun = [](hook_stack *stack, HookParam *hp, uintptr_t *data, uintptr_t *split, size_t *len)
{
auto ptr = stack->rdx;
auto size = stack->r8;
if (size == strnlen((char *)ptr, TEXT_BUFFER_SIZE) )//否则有短acsii
{
*data = ptr;
*len = size;
}
};
NewHook(hpinternal, "std::_Char_traits<char,int>::copy(void *, const void *, size_t)");
}
};
return NewHook(hp,"vcruntime140_app:memmove");
}

View File

@ -0,0 +1,16 @@
class livecaptions : public ENGINE
{
public:
livecaptions()
{
check_by = CHECK_BY::CUSTOM;
check_by_target = []()
{
return GetModuleHandle(L"vcruntime140_app.dll")&&GetModuleHandle(L"Microsoft.CognitiveServices.Speech.extension.embedded.sr.dll");
};
};
bool attach_function();
};

View File

@ -9,6 +9,7 @@
#include"engine64/KiriKiri.h"
#include"engine64/YOX.h"
#include"engine64/Suika2.h"
#include"engine64/livecaptions.h"
#include"engine64/CMVS.h"
#include"engine64/5pb.h"
#include"engine64/lucasystem.h"
@ -44,7 +45,8 @@ std::vector<ENGINE*> check_engines(){
new PPSSPPengine,
new vita3k,
new rpcs3,
new Kincaid
new Kincaid,
new livecaptions
};
}