mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-12-26 21:24:12 +08:00
psp
This commit is contained in:
parent
1ed7354fe6
commit
18ea39c0e2
@ -89,22 +89,24 @@ bool hookPPSSPPDoJit(){
|
|||||||
hp.text_fun=[](hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){
|
hp.text_fun=[](hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){
|
||||||
auto em_address=stack->ARG2;
|
auto em_address=stack->ARG2;
|
||||||
|
|
||||||
if(breakpoints.find(em_address)!=breakpoints.end())return;
|
|
||||||
breakpoints.insert(em_address);
|
|
||||||
|
|
||||||
if(emfunctionhooks.find(em_address)==emfunctionhooks.end())return;
|
if(emfunctionhooks.find(em_address)==emfunctionhooks.end())return;
|
||||||
|
|
||||||
static emfuncinfo op;
|
static emfuncinfo op;
|
||||||
op=emfunctionhooks.at(em_address);
|
op=emfunctionhooks.at(em_address);
|
||||||
HookParam hpinternal;
|
HookParam hpinternal;
|
||||||
|
hpinternal.user_value=em_address;
|
||||||
hpinternal.address=stack->retaddr;
|
hpinternal.address=stack->retaddr;
|
||||||
hpinternal.text_fun=[](hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){
|
hpinternal.text_fun=[](hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){
|
||||||
hp->text_fun=nullptr;hp->type=HOOK_EMPTY;
|
hp->text_fun=nullptr;hp->type=HOOK_EMPTY;
|
||||||
|
|
||||||
auto ret=stack->rax;
|
auto ret=stack->rax;
|
||||||
|
if(breakpoints.find(ret)!=breakpoints.end())return;
|
||||||
|
breakpoints.insert(ret);
|
||||||
DWORD _;
|
DWORD _;
|
||||||
VirtualProtect((LPVOID)ret,0x10,PAGE_EXECUTE_READWRITE,&_);
|
VirtualProtect((LPVOID)ret,0x10,PAGE_EXECUTE_READWRITE,&_);
|
||||||
HookParam hpinternal;
|
HookParam hpinternal;
|
||||||
hpinternal.address=ret;
|
hpinternal.address=ret;
|
||||||
|
hpinternal.user_value=hp->user_value;
|
||||||
hpinternal.type=CODEC_UTF16|USING_STRING|NO_CONTEXT;
|
hpinternal.type=CODEC_UTF16|USING_STRING|NO_CONTEXT;
|
||||||
hpinternal.text_fun=(decltype(hpinternal.text_fun))op.hookfunc;
|
hpinternal.text_fun=(decltype(hpinternal.text_fun))op.hookfunc;
|
||||||
hpinternal.filter_fun=(decltype(hpinternal.filter_fun))op.filterfun;
|
hpinternal.filter_fun=(decltype(hpinternal.filter_fun))op.filterfun;
|
||||||
@ -290,6 +292,80 @@ bool ULJM06036_filter(void* data, size_t* len, HookParam* hp){
|
|||||||
result = std::regex_replace(result, tagPattern, L"");
|
result = std::regex_replace(result, tagPattern, L"");
|
||||||
return write_string_overwrite(data,len,result);
|
return write_string_overwrite(data,len,result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Corda{
|
||||||
|
std::string readBinaryString(uintptr_t address,bool* haveName){
|
||||||
|
* haveName=false;
|
||||||
|
if ((*(WORD*)address & 0xF0FF) == 0x801b) {
|
||||||
|
*haveName = true;
|
||||||
|
address = address+2; // (1)
|
||||||
|
}
|
||||||
|
std::string s;int i=0;uint8_t c;
|
||||||
|
while ((c = *(uint8_t*)(address+i)) != 0) {
|
||||||
|
if (c == 0x1b) {
|
||||||
|
if (*haveName)
|
||||||
|
return s; // (1) skip junk after name
|
||||||
|
|
||||||
|
c = *(uint8_t*)(address+(i + 1));
|
||||||
|
if (c == 0x7f)
|
||||||
|
i += 5;
|
||||||
|
else
|
||||||
|
i += 2;
|
||||||
|
}
|
||||||
|
else if (c == 0x0a) {
|
||||||
|
s += '\n';
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
else if (c == 0x20) {
|
||||||
|
s += ' ';
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
auto len=1+(IsDBCSLeadByteEx(932,*(BYTE*)(address+i)));
|
||||||
|
s += std::string((char*)(address+i),len);
|
||||||
|
i += len;//encoder.encode(c).byteLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// @name [ULJM05428] Kin'iro no Corda 2f
|
||||||
|
// @version 0.1
|
||||||
|
// @author [DC]
|
||||||
|
// @description PPSSPP x64
|
||||||
|
// *
|
||||||
|
// * Koei
|
||||||
|
|
||||||
|
void ULJM05428(hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){
|
||||||
|
hp->type=USING_STRING|NO_CONTEXT;
|
||||||
|
hp->codepage=932;
|
||||||
|
auto address= emu_arg(stack)[1];
|
||||||
|
bool haveNamve;
|
||||||
|
auto s=Corda::readBinaryString(address,&haveNamve);
|
||||||
|
*split=haveNamve;
|
||||||
|
write_string_new(data,len,s);
|
||||||
|
}
|
||||||
|
// @name [ULJM05054] Kin'iro no Corda
|
||||||
|
// @version 0.1
|
||||||
|
// @author [DC]
|
||||||
|
// @description PPSSPP x64
|
||||||
|
// *
|
||||||
|
// * Koei
|
||||||
|
|
||||||
|
void ULJM05054(hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){
|
||||||
|
hp->type=USING_STRING|NO_CONTEXT;
|
||||||
|
hp->codepage=932;
|
||||||
|
if (hp->user_value != 0x886162c) {
|
||||||
|
auto addr=emu_arg(stack)[0]+0x3c;
|
||||||
|
*data=addr;*len=strlen((char*)addr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto address= emu_arg(stack)[1];
|
||||||
|
bool haveNamve;
|
||||||
|
auto s=Corda::readBinaryString(address,&haveNamve);
|
||||||
|
*split=haveNamve;
|
||||||
|
write_string_new(data,len,s);
|
||||||
|
}
|
||||||
namespace{
|
namespace{
|
||||||
auto _=[](){
|
auto _=[](){
|
||||||
emfunctionhooks={
|
emfunctionhooks={
|
||||||
@ -299,6 +375,9 @@ auto _=[](){
|
|||||||
{0x8850b2c,{"Sekai de Ichiban Dame na Koi",NPJH50909,NPJH50909_filter,L"NPJH50909"}},
|
{0x8850b2c,{"Sekai de Ichiban Dame na Koi",NPJH50909,NPJH50909_filter,L"NPJH50909"}},
|
||||||
{0x0891D72C,{"Dunamis15",ULJM06119,ULJM06119_filter,L"ULJM06119"}},
|
{0x0891D72C,{"Dunamis15",ULJM06119,ULJM06119_filter,L"ULJM06119"}},
|
||||||
{0x88506d0,{"Princess Evangile Portable",ULJM06036,ULJM06036_filter,L"ULJM06036"}},
|
{0x88506d0,{"Princess Evangile Portable",ULJM06036,ULJM06036_filter,L"ULJM06036"}},
|
||||||
|
{0x89b59dc,{"Kin'iro no Corda 2f",ULJM05428,0,L"ULJM05428"}},
|
||||||
|
{0x886162c,{"Kin'iro no Corda",ULJM05054,0,L"ULJM05054"}},
|
||||||
|
{0x8899e90,{"Kin'iro no Corda",ULJM05054,0,L"ULJM05054"}},
|
||||||
};
|
};
|
||||||
return 1;
|
return 1;
|
||||||
}();
|
}();
|
||||||
|
@ -30,8 +30,8 @@ std::optional<std::wstring> StringToWideString(const std::string& text, UINT enc
|
|||||||
size_t u32strlen(uint32_t* data);
|
size_t u32strlen(uint32_t* data);
|
||||||
inline bool disable_mbwc=false;
|
inline bool disable_mbwc=false;
|
||||||
inline bool disable_wcmb=false;
|
inline bool disable_wcmb=false;
|
||||||
|
template<class ST>
|
||||||
inline void Trim(std::wstring& text)
|
inline void Trim(ST& text)
|
||||||
{
|
{
|
||||||
text.erase(text.begin(), std::find_if_not(text.begin(), text.end(), iswspace));
|
text.erase(text.begin(), std::find_if_not(text.begin(), text.end(), iswspace));
|
||||||
text.erase(std::find_if_not(text.rbegin(), text.rend(), iswspace).base(), text.end());
|
text.erase(std::find_if_not(text.rbegin(), text.rend(), iswspace).base(), text.end());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user