mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-12-24 20:24:13 +08:00
refactor
This commit is contained in:
parent
5e6bc37051
commit
eb123790e6
@ -1,6 +1,6 @@
|
|||||||
include_directories(. util engines)
|
include_directories(. util engines)
|
||||||
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||||
set(enginessrc TYPEMOON ENTERGRAM AGES7 mono Godot Renpy 5pb lucasystem LightVN V8 pchooks Artemis KiriKiri YOX PPSSPP CMVS Suika2 )
|
set(enginessrc yuzusuyu TYPEMOON ENTERGRAM AGES7 mono Godot Renpy 5pb lucasystem LightVN V8 pchooks Artemis KiriKiri YOX PPSSPP CMVS Suika2 )
|
||||||
set(enginepath "engine64")
|
set(enginepath "engine64")
|
||||||
set(collector "enginecollection64.cpp")
|
set(collector "enginecollection64.cpp")
|
||||||
else()
|
else()
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
#include"winevent.hpp"
|
#include"winevent.hpp"
|
||||||
#include"defs.h"
|
#include"defs.h"
|
||||||
#include"stringfilters.h"
|
#include"stringfilters.h"
|
||||||
|
#include"util.h"
|
||||||
DynamicShiftJISCodec *dynamiccodec=new DynamicShiftJISCodec(932);
|
DynamicShiftJISCodec *dynamiccodec=new DynamicShiftJISCodec(932);
|
||||||
|
|
||||||
|
|
||||||
void cast_back(const HookParam& hp,void*data ,size_t *len,const std::wstring& trans,bool normal){
|
void cast_back(const HookParam& hp,void*data ,size_t *len,const std::wstring& trans,bool normal){
|
||||||
|
|
||||||
if((hp.type&EMBED_CODEC_UTF16)||(hp.type&CODEC_UTF16)){//renpy
|
if((hp.type&EMBED_CODEC_UTF16)||(hp.type&CODEC_UTF16)){//renpy
|
||||||
wcscpy((wchar_t*)data,trans.c_str());
|
write_string_overwrite(data,len,trans);
|
||||||
*len=trans.size()*2;
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
std::string astr;
|
std::string astr;
|
||||||
@ -24,8 +24,7 @@ void cast_back(const HookParam& hp,void*data ,size_t *len,const std::wstring& tr
|
|||||||
else{
|
else{
|
||||||
astr=WideStringToString(trans,hp.codepage?hp.codepage:((hp.type&CODEC_UTF8)?CP_UTF8:embedsharedmem->codepage));
|
astr=WideStringToString(trans,hp.codepage?hp.codepage:((hp.type&CODEC_UTF8)?CP_UTF8:embedsharedmem->codepage));
|
||||||
}
|
}
|
||||||
strcpy((char*)data,astr.c_str());
|
write_string_overwrite(data,len,astr);
|
||||||
*len=astr.size();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include"5pb.h"
|
#include"5pb.h"
|
||||||
#include"mages/mages.hpp"
|
#include"mages/mages.h"
|
||||||
/** jichi 12/2/2014 5pb
|
/** jichi 12/2/2014 5pb
|
||||||
*
|
*
|
||||||
* Sample game: [140924] CROSS<EFBFBD>CHANNEL 〜FINAL COMPLETE<EFBFBD> * See: http://sakuradite.com/topic/528
|
* Sample game: [140924] CROSS<EFBFBD>CHANNEL 〜FINAL COMPLETE<EFBFBD> * See: http://sakuradite.com/topic/528
|
||||||
@ -530,7 +530,7 @@ bool StuffScript_attach_function() {
|
|||||||
bool _5pb::attach_function() {
|
bool _5pb::attach_function() {
|
||||||
bool b1 = Insert5pbHook();
|
bool b1 = Insert5pbHook();
|
||||||
bool b2 = Insert5pbHookex();
|
bool b2 = Insert5pbHookex();
|
||||||
bool b3=mages::MAGES();
|
bool b3=hookmages::MAGES();
|
||||||
bool sf=StuffScript_attach_function();
|
bool sf=StuffScript_attach_function();
|
||||||
return b1 || b2 || b3||sf;
|
return b1 || b2 || b3||sf;
|
||||||
}
|
}
|
||||||
@ -687,9 +687,7 @@ namespace{
|
|||||||
auto xx=std::wstring(text,*len/2);
|
auto xx=std::wstring(text,*len/2);
|
||||||
xx = std::regex_replace(xx, std::wregex(L"\\[(.*?),\\d\\]"), L"$1");
|
xx = std::regex_replace(xx, std::wregex(L"\\[(.*?),\\d\\]"), L"$1");
|
||||||
xx = std::regex_replace(xx, std::wregex(L"\\\\x%l(.*?);(.*?);(.*?);#;"), L"$1");
|
xx = std::regex_replace(xx, std::wregex(L"\\\\x%l(.*?);(.*?);(.*?);#;"), L"$1");
|
||||||
*len=xx.size()*2;
|
return write_string_overwrite(data,size,xx);
|
||||||
wcscpy(text,xx.c_str());
|
|
||||||
return true;
|
|
||||||
};
|
};
|
||||||
hp.newlineseperator=L"\\n";
|
hp.newlineseperator=L"\\n";
|
||||||
return NewHook(hp, "5bp");
|
return NewHook(hp, "5bp");
|
||||||
|
@ -37,8 +37,7 @@ bool InsertAnim2Hook() {
|
|||||||
static const std::regex rx("@\\[(.*?):(.*?)\\]", std::regex_constants::icase);
|
static const std::regex rx("@\\[(.*?):(.*?)\\]", std::regex_constants::icase);
|
||||||
std::string result = std::string((char*)data,*len);
|
std::string result = std::string((char*)data,*len);
|
||||||
result = std::regex_replace(result, rx, "$1");
|
result = std::regex_replace(result, rx, "$1");
|
||||||
*len = (result.size());
|
return write_string_overwrite(data,len,result);
|
||||||
strcpy((char*)data, result.c_str());return true;
|
|
||||||
};
|
};
|
||||||
myhp.newlineseperator=L"@n";
|
myhp.newlineseperator=L"@n";
|
||||||
myhp.type = USING_STRING | NO_CONTEXT|EMBED_ABLE|EMBED_AFTER_OVERWRITE|EMBED_BEFORE_SIMPLE|EMBED_DYNA_SJIS;
|
myhp.type = USING_STRING | NO_CONTEXT|EMBED_ABLE|EMBED_AFTER_OVERWRITE|EMBED_BEFORE_SIMPLE|EMBED_DYNA_SJIS;
|
||||||
|
@ -537,9 +537,7 @@ namespace Private {
|
|||||||
|
|
||||||
DWORD retaddr = s->stack[0]; // retaddr
|
DWORD retaddr = s->stack[0]; // retaddr
|
||||||
* role = Engine::ScenarioRole;
|
* role = Engine::ScenarioRole;
|
||||||
strcpy((char*)data,(LPCSTR)s->stack[textIndex_]);
|
return write_string_overwrite(data,len,(LPCSTR)s->stack[textIndex_]);
|
||||||
*len=strlen((LPCSTR)s->stack[textIndex_]);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string data_; // persistent storage, which makes this function not thread-safe
|
static std::string data_; // persistent storage, which makes this function not thread-safe
|
||||||
@ -594,10 +592,7 @@ namespace Private {
|
|||||||
break;
|
break;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
strcpy((char*)data,(LPCSTR)s->stack[textIndex_]);
|
return write_string_overwrite(data,len,(LPCSTR)s->stack[textIndex_]);
|
||||||
*len=strlen((LPCSTR)s->stack[textIndex_]);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1200,8 +1195,8 @@ bool InsertBGI2Hook()
|
|||||||
static const std::regex rx("<r.+?>(.+?)</r>", std::regex_constants::icase);
|
static const std::regex rx("<r.+?>(.+?)</r>", std::regex_constants::icase);
|
||||||
std::string result = std::string((char*)data,*len);
|
std::string result = std::string((char*)data,*len);
|
||||||
result = std::regex_replace(result, rx, "$1");
|
result = std::regex_replace(result, rx, "$1");
|
||||||
*len = (result.size());
|
|
||||||
strcpy((char*)data, result.c_str());return true;
|
return write_string_overwrite(data,len,result);
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
hp.split = get_stack(8); // pseudo arg8
|
hp.split = get_stack(8); // pseudo arg8
|
||||||
|
@ -1187,10 +1187,8 @@ bool attach(const uint8_t pattern[],int patternSize,DWORD startAddress,DWORD sto
|
|||||||
|
|
||||||
std::regex reg1("\\{(.*?)/(.*?)\\}");
|
std::regex reg1("\\{(.*?)/(.*?)\\}");
|
||||||
std::string result1 = std::regex_replace(str, reg1, "$1");
|
std::string result1 = std::regex_replace(str, reg1, "$1");
|
||||||
*len = result1.size();
|
|
||||||
strcpy(text, result1.c_str());
|
return write_string_overwrite(text,len,result1);
|
||||||
return true;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return NewHook(hp, "EmbedCMVS");
|
return NewHook(hp, "EmbedCMVS");
|
||||||
|
@ -574,9 +574,8 @@ static bool containsNamePunct_(const char *text)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string oldData(trimmedText, trimmedSize);
|
std::string oldData(trimmedText, trimmedSize);
|
||||||
strcpy((char*)data,oldData.c_str());
|
|
||||||
*len=oldData.size();
|
return write_string_overwrite(data,len,oldData);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
void hookafter(hook_stack*s,void* data, size_t len){
|
void hookafter(hook_stack*s,void* data, size_t len){
|
||||||
|
|
||||||
@ -773,8 +772,7 @@ bool attach(ULONG startAddress, ULONG stopAddress)
|
|||||||
|
|
||||||
static std::regex rx(R"(\[(.+?)/.+\])");
|
static std::regex rx(R"(\[(.+?)/.+\])");
|
||||||
auto _=std::regex_replace(std::string((char*)data,*len), rx, "$1");
|
auto _=std::regex_replace(std::string((char*)data,*len), rx, "$1");
|
||||||
strcpy((char*)data,_.c_str());*len=_.size();return true;
|
return write_string_overwrite(data,len,_);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static ULONG p;
|
static ULONG p;
|
||||||
|
@ -126,10 +126,8 @@ namespace Private {
|
|||||||
trimmedText = ltrim(text);
|
trimmedText = ltrim(text);
|
||||||
if (trimmedText != text)
|
if (trimmedText != text)
|
||||||
newData.insert(0,std::string(text, trimmedText - text));
|
newData.insert(0,std::string(text, trimmedText - text));
|
||||||
auto ss=new char[newData.size()+1];
|
|
||||||
strcpy(ss,newData.c_str());
|
|
||||||
s->stack[2] =(ULONG)ss; // reset arg2
|
|
||||||
|
|
||||||
|
write_string_new(&s->stack[2],0,newData);
|
||||||
}
|
}
|
||||||
bool hookBefore(hook_stack*s,void* data, size_t* len,uintptr_t*role)
|
bool hookBefore(hook_stack*s,void* data, size_t* len,uintptr_t*role)
|
||||||
{
|
{
|
||||||
@ -149,10 +147,7 @@ namespace Private {
|
|||||||
//? Engine::NameRole : // retaddr+3 is jmp
|
//? Engine::NameRole : // retaddr+3 is jmp
|
||||||
//Engine::ScenarioRole;
|
//Engine::ScenarioRole;
|
||||||
|
|
||||||
std::string oldData = trimmedText;
|
return write_string_overwrite(data,len,trimmedText);
|
||||||
strcpy((char*)data,oldData.c_str());
|
|
||||||
*len=oldData.size();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alternatively, using the following pattern bytes also works:
|
// Alternatively, using the following pattern bytes also works:
|
||||||
|
@ -10,9 +10,8 @@ bool CodeXFilter(LPVOID data, size_t *size, HookParam *)
|
|||||||
//|晒[さら]
|
//|晒[さら]
|
||||||
std::string result = std::string((char*)data,*len);
|
std::string result = std::string((char*)data,*len);
|
||||||
result = std::regex_replace(result, std::regex("\\|(.+?)\\[(.+?)\\]"), "$1");
|
result = std::regex_replace(result, std::regex("\\|(.+?)\\[(.+?)\\]"), "$1");
|
||||||
*len = (result.size());
|
|
||||||
strcpy((char*)data, result.c_str());return true;
|
return write_string_overwrite(data,len,result);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InsertCodeXHook()
|
bool InsertCodeXHook()
|
||||||
|
@ -568,9 +568,7 @@ namespace Private {
|
|||||||
// 004B521B 33ED XOR EBP,EBP
|
// 004B521B 33ED XOR EBP,EBP
|
||||||
*role = s->stack[5] == 0 ? Engine::NameRole : Engine::ScenarioRole;
|
*role = s->stack[5] == 0 ? Engine::NameRole : Engine::ScenarioRole;
|
||||||
}
|
}
|
||||||
wcscpy((LPWSTR)data,text);
|
return write_string_overwrite(data,len,text);
|
||||||
*len=wcslen(text)*2;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hookAfterCaller(hook_stack*s,void* data, size_t* len,uintptr_t*role)
|
bool hookAfterCaller(hook_stack*s,void* data, size_t* len,uintptr_t*role)
|
||||||
|
@ -56,16 +56,7 @@ bool InsertDebonosuScenarioHook()
|
|||||||
hp.hook_font=F_MultiByteToWideChar|F_GetTextExtentPoint32A;
|
hp.hook_font=F_MultiByteToWideChar|F_GetTextExtentPoint32A;
|
||||||
hp.type = USING_STRING|NO_CONTEXT|USING_SPLIT|FIXING_SPLIT|EMBED_ABLE|EMBED_BEFORE_SIMPLE|EMBED_DYNA_SJIS; // there is only one thread
|
hp.type = USING_STRING|NO_CONTEXT|USING_SPLIT|FIXING_SPLIT|EMBED_ABLE|EMBED_BEFORE_SIMPLE|EMBED_DYNA_SJIS; // there is only one thread
|
||||||
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
||||||
auto text = reinterpret_cast<LPSTR>(data);
|
return write_string_overwrite(data,len,std::regex_replace(std::string((char*)data,*len), std::regex("\\{(.*?)/(.*?)\\}"), "$1"));
|
||||||
std::string str = text;
|
|
||||||
str = str.substr(0, *len);
|
|
||||||
|
|
||||||
std::regex reg1("\\{(.*?)/(.*?)\\}");
|
|
||||||
std::string result1 = std::regex_replace(str, reg1, "$1");
|
|
||||||
*len = result1.size();
|
|
||||||
strcpy(text, result1.c_str());
|
|
||||||
return true;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
ConsoleOutput("INSERT Debonosu");
|
ConsoleOutput("INSERT Debonosu");
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ namespace Private {
|
|||||||
auto text = arg->scenarioText;
|
auto text = arg->scenarioText;
|
||||||
if (!Engine::isAddressReadable(text))
|
if (!Engine::isAddressReadable(text))
|
||||||
return 0;
|
return 0;
|
||||||
strcpy((LPSTR)data,text);*len=strlen(text);return 1;
|
return write_string_overwrite(data,len,text);
|
||||||
// data_ = q->dispatchTextASTD(text, role, sig);
|
// data_ = q->dispatchTextASTD(text, role, sig);
|
||||||
// scenarioArg_ = arg;
|
// scenarioArg_ = arg;
|
||||||
// scenarioText_ = arg->scenarioText;
|
// scenarioText_ = arg->scenarioText;
|
||||||
@ -220,8 +220,7 @@ namespace Private {
|
|||||||
} else if (arg->nameFlag == 0) {
|
} else if (arg->nameFlag == 0) {
|
||||||
* role = Engine::NameRole;
|
* role = Engine::NameRole;
|
||||||
auto text = arg->nameText;
|
auto text = arg->nameText;
|
||||||
|
return write_string_overwrite(data,len,text);
|
||||||
strcpy((LPSTR)data,text);*len=strlen(text);return 1;
|
|
||||||
// ::memcpy(text, newData.constData(), qMin(oldData.size(), newData.size()));
|
// ::memcpy(text, newData.constData(), qMin(oldData.size(), newData.size()));
|
||||||
//int left = oldData.size() - newData.size();
|
//int left = oldData.size() - newData.size();
|
||||||
//if (left > 0)
|
//if (left > 0)
|
||||||
|
@ -215,9 +215,7 @@ bool hook_before(hook_stack*s,void* data, size_t* len,uintptr_t*role){
|
|||||||
return false;
|
return false;
|
||||||
trimmedText = _escudeltrim(arg->text);
|
trimmedText = _escudeltrim(arg->text);
|
||||||
* role = arg->role();
|
* role = arg->role();
|
||||||
strcpy((char*)data,trimmedText);
|
return write_string_overwrite(data,len,trimmedText);
|
||||||
*len=strlen(trimmedText);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
void hook_after(hook_stack*s,void* data, size_t len){
|
void hook_after(hook_stack*s,void* data, size_t len){
|
||||||
static std::string data_;
|
static std::string data_;
|
||||||
|
@ -476,10 +476,7 @@ bool attach(ULONG startAddress, ULONG stopAddress)
|
|||||||
hp.hook_font=F_DrawTextA|F_GetGlyphOutlineA;
|
hp.hook_font=F_DrawTextA|F_GetGlyphOutlineA;
|
||||||
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
||||||
|
|
||||||
static std::regex rx("\\[.+\\|(.+?)\\]");
|
return write_string_overwrite(data,len,std::regex_replace(std::string((LPSTR)data,*len), std::regex("\\[.+\\|(.+?)\\]"), "$1"));
|
||||||
auto x= std::regex_replace(std::string((LPSTR)data,*len), rx, "$1");
|
|
||||||
strcpy((LPSTR)data,x.c_str());
|
|
||||||
*len=x.size();return true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return NewHook(hp,"EmbedFVP");
|
return NewHook(hp,"EmbedFVP");
|
||||||
|
@ -339,22 +339,7 @@ namespace Private {
|
|||||||
auto text = arg->getText();
|
auto text = arg->getText();
|
||||||
if (isBadText(text))
|
if (isBadText(text))
|
||||||
return 0;
|
return 0;
|
||||||
std::wstring oldText = std::wstring(text);//,
|
return write_string_overwrite(data1,len,text);
|
||||||
wcscpy((LPWSTR)data1,oldText.c_str());*len=oldText.size()*2;
|
|
||||||
return 1;
|
|
||||||
// newText = EngineController::instance()->dispatchTextWSTD(oldText, role, reladdr);
|
|
||||||
// if (newText == oldText)
|
|
||||||
// return true;
|
|
||||||
// text_ = newText;
|
|
||||||
|
|
||||||
// arg_ = arg;
|
|
||||||
// argValue_ = *arg;
|
|
||||||
|
|
||||||
// arg->setText(text_);
|
|
||||||
|
|
||||||
// //if (arg->size)
|
|
||||||
// // hashes_.insert(Engine::hashWCharArray(arg->text, arg->size));
|
|
||||||
// return true;
|
|
||||||
}
|
}
|
||||||
void hook2a(hook_stack*s,void* data1, size_t len)
|
void hook2a(hook_stack*s,void* data1, size_t len)
|
||||||
{
|
{
|
||||||
@ -447,9 +432,9 @@ namespace Private {
|
|||||||
auto text = arg->getText();
|
auto text = arg->getText();
|
||||||
if (isBadText(text))
|
if (isBadText(text))
|
||||||
return 0;
|
return 0;
|
||||||
std::wstring oldText = std::wstring(text);//,
|
return write_string_overwrite(data1,len,text);
|
||||||
wcscpy((LPWSTR)data1,oldText.c_str());*len=oldText.size()*2;
|
|
||||||
return 1;}
|
}
|
||||||
void hook2a(hook_stack*s,void* data1, size_t len)
|
void hook2a(hook_stack*s,void* data1, size_t len)
|
||||||
{
|
{
|
||||||
auto text_=new wchar_t[len/2+1];
|
auto text_=new wchar_t[len/2+1];
|
||||||
|
@ -211,9 +211,7 @@ namespace{
|
|||||||
str=stop+2;
|
str=stop+2;
|
||||||
} // = u'<27>.encode('sjis')
|
} // = u'<27>.encode('sjis')
|
||||||
auto old=std::string(str,len);
|
auto old=std::string(str,len);
|
||||||
strcpy((char*)data,old.c_str());*len1=old.size();
|
return write_string_overwrite(data,len1,old);
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
template<int offset=1>
|
template<int offset=1>
|
||||||
void hookafter(hook_stack*s,void* data, size_t len1){
|
void hookafter(hook_stack*s,void* data, size_t len1){
|
||||||
|
@ -26,12 +26,8 @@ bool Jellyfish_attach_function() {
|
|||||||
if(*size==2)return false;
|
if(*size==2)return false;
|
||||||
StringCharReplacer(reinterpret_cast<char*>(data), size, "\\n", 2, '\n');
|
StringCharReplacer(reinterpret_cast<char*>(data), size, "\\n", 2, '\n');
|
||||||
StringCharReplacer(reinterpret_cast<char*>(data), size, "\\N", 2, '\n');
|
StringCharReplacer(reinterpret_cast<char*>(data), size, "\\N", 2, '\n');
|
||||||
auto str=std::string(reinterpret_cast<char*>(data),*size);
|
|
||||||
str = std::regex_replace(str, std::regex("\\\\[0-7a-zA-Z]"), "");
|
return write_string_overwrite(data,size,std::regex_replace(std::string(reinterpret_cast<char*>(data),*size), std::regex("\\\\[0-7a-zA-Z]"), ""));
|
||||||
|
|
||||||
*size = str.size() ;
|
|
||||||
strcpy(reinterpret_cast<char*>(data), str.c_str());
|
|
||||||
return true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return NewHook(hp, "Jellyfish");
|
return NewHook(hp, "Jellyfish");
|
||||||
|
@ -1222,9 +1222,8 @@ namespace{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wcscpy((wchar_t*)data,innner.c_str());
|
|
||||||
*len=innner.size()*2;
|
return write_string_overwrite(data,len,innner);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool attachkr2(ULONG startAddress, ULONG stopAddress)
|
bool attachkr2(ULONG startAddress, ULONG stopAddress)
|
||||||
@ -1300,9 +1299,8 @@ namespace Private {
|
|||||||
strReplace(utf8save, "#00ff0000;", "\\#FF0000");
|
strReplace(utf8save, "#00ff0000;", "\\#FF0000");
|
||||||
strReplace(utf8save, "%p-1;%f\xef\xbc\xad\xef\xbc\xb3 \xe3\x82\xb4\xe3\x82\xb7\xe3\x83\x83\xe3\x82\xaf;", ""); //"%p-1;%fMS ゴシック;"
|
strReplace(utf8save, "%p-1;%f\xef\xbc\xad\xef\xbc\xb3 \xe3\x82\xb4\xe3\x82\xb7\xe3\x83\x83\xe3\x82\xaf;", ""); //"%p-1;%fMS ゴシック;"
|
||||||
strReplace(utf8save, "%p;%fuser;", "");
|
strReplace(utf8save, "%p;%fuser;", "");
|
||||||
strcpy((char*)data,utf8save.c_str());
|
|
||||||
*len=utf8save.size();
|
return write_string_overwrite(data,len,utf8save);
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void after(hook_stack*s,void* data, size_t len){
|
void after(hook_stack*s,void* data, size_t len){
|
||||||
@ -1316,9 +1314,8 @@ namespace Private {
|
|||||||
strReplace(res, "\\#FFFFFF", "#;");
|
strReplace(res, "\\#FFFFFF", "#;");
|
||||||
strReplace(res, "\\#FF0000", "#00ff0000;");
|
strReplace(res, "\\#FF0000", "#00ff0000;");
|
||||||
res=WideStringToString(ConvertToFullWidth((StringToWideString(res))));
|
res=WideStringToString(ConvertToFullWidth((StringToWideString(res))));
|
||||||
auto cs = new char[res.size() + 1];
|
|
||||||
strcpy(cs, res.c_str());
|
write_string_new(&s->ecx,0,res);
|
||||||
s->ecx = (DWORD)cs;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
bool attach(ULONG startAddress, ULONG stopAddress)
|
bool attach(ULONG startAddress, ULONG stopAddress)
|
||||||
@ -1464,7 +1461,7 @@ namespace{
|
|||||||
t=std::regex_replace(t,std::wregex(L"\\[ruby text=\"(.*?)\"\\]"),L"");
|
t=std::regex_replace(t,std::wregex(L"\\[ruby text=\"(.*?)\"\\]"),L"");
|
||||||
t=std::regex_replace(t,std::wregex(L"\\[ch text=\"(.*?)\"\\]"),L"$1");
|
t=std::regex_replace(t,std::wregex(L"\\[ch text=\"(.*?)\"\\]"),L"$1");
|
||||||
if(std::any_of(t.begin(),t.end(),[](wchar_t c){return (c<=127)&&((c!=L'[')||c!=L']');}))return false;
|
if(std::any_of(t.begin(),t.end(),[](wchar_t c){return (c<=127)&&((c!=L'[')||c!=L']');}))return false;
|
||||||
wcscpy((wchar_t*) data,t.c_str());*size=t.size()*2;return true;
|
return write_string_overwrite(data,size,t);
|
||||||
};
|
};
|
||||||
hp.hook_after=[](hook_stack*s,void* data, size_t len){
|
hp.hook_after=[](hook_stack*s,void* data, size_t len){
|
||||||
auto t=std::wstring((wchar_t*)s->stack[off/4]);
|
auto t=std::wstring((wchar_t*)s->stack[off/4]);
|
||||||
|
@ -261,27 +261,8 @@ namespace Private {
|
|||||||
// They should be escaped here.
|
// They should be escaped here.
|
||||||
// Escaping not implemented since I am lazy.
|
// Escaping not implemented since I am lazy.
|
||||||
}
|
}
|
||||||
strcpy((char*)data,oldData.c_str());*len1=oldData.size();
|
write_string_overwrite(data,len1,oldData);
|
||||||
return true;
|
return true;
|
||||||
std::string newData = oldData+"xx";
|
|
||||||
if (newData.empty() || newData == oldData)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (containsZeros)
|
|
||||||
strReplace(newData, zero_str, zero_bytes);
|
|
||||||
//newData.replace(zero_str, zero_bytes);
|
|
||||||
|
|
||||||
int prefixSize = trimmedText - text,
|
|
||||||
suffixSize = size - prefixSize - trimmedSize;
|
|
||||||
if (prefixSize)
|
|
||||||
newData.insert(0,std::string(text, prefixSize));
|
|
||||||
if (suffixSize)
|
|
||||||
newData.append(trimmedText + trimmedSize, suffixSize);
|
|
||||||
|
|
||||||
data_ = newData;
|
|
||||||
s->eax = data_.size() + 1;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void hookafter(hook_stack*s,void* data, size_t len1){
|
void hookafter(hook_stack*s,void* data, size_t len1){
|
||||||
|
|
||||||
|
@ -395,19 +395,12 @@ bool hook2(hook_stack*s,void* data1, size_t* len,uintptr_t*role)
|
|||||||
strReplace(save,"\\k","");
|
strReplace(save,"\\k","");
|
||||||
static std::regex rx("<R(.+?)\\|.+>");
|
static std::regex rx("<R(.+?)\\|.+>");
|
||||||
save= std::regex_replace(save, rx, "$1");
|
save= std::regex_replace(save, rx, "$1");
|
||||||
strcpy((char*)data1,save.c_str());*len=save.size();
|
write_string_overwrite(data1,len,save);
|
||||||
// if (!data_.empty()) {
|
|
||||||
// s->ecx = (ULONG)data_.c_str();
|
|
||||||
// }ConsoleOutput("3");
|
|
||||||
return save.size();
|
return save.size();
|
||||||
}
|
}
|
||||||
void hook2a(hook_stack*s,void* data1, size_t len)
|
void hook2a(hook_stack*s,void* data1, size_t len)
|
||||||
{
|
{
|
||||||
|
write_string_new(&s->ecx,0,std::string((char*)data1,len));
|
||||||
std::string newdata = std::string((char*)data1,len);
|
|
||||||
auto xx=new char[newdata.size()+1];
|
|
||||||
strcpy(xx,newdata.c_str());
|
|
||||||
s->ecx=(ULONG)xx;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool InsertLeafHook()
|
bool InsertLeafHook()
|
||||||
|
@ -27,8 +27,8 @@ void SpecialHookLightvnA(hook_stack*, HookParam*, uintptr_t* data, uintptr_t* sp
|
|||||||
_=std::string(match[2]);
|
_=std::string(match[2]);
|
||||||
*split=2;
|
*split=2;
|
||||||
}
|
}
|
||||||
auto _s=new char[_.size()+1];strcpy(_s,_.c_str());
|
|
||||||
*data=(uintptr_t)_s;*len=_.size();
|
write_string_new(data,len,_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpecialHookLightvnW(hook_stack*, HookParam*, uintptr_t* data, uintptr_t* split, size_t* len)
|
void SpecialHookLightvnW(hook_stack*, HookParam*, uintptr_t* data, uintptr_t* split, size_t* len)
|
||||||
@ -48,8 +48,7 @@ void SpecialHookLightvnW(hook_stack*, HookParam*, uintptr_t* data, uintptr_t* sp
|
|||||||
_=std::wstring(match[2]);
|
_=std::wstring(match[2]);
|
||||||
*split=2;
|
*split=2;
|
||||||
}
|
}
|
||||||
auto _s=new wchar_t[_.size()+1];wcscpy(_s,_.c_str());
|
write_string_new(data,len,_);
|
||||||
*data=(uintptr_t)_s;*len=_.size()*2;
|
|
||||||
}
|
}
|
||||||
bool InsertLightvnHook()
|
bool InsertLightvnHook()
|
||||||
{
|
{
|
||||||
|
@ -192,7 +192,8 @@ namespace Private {
|
|||||||
* role = Engine::OtherRole;
|
* role = Engine::OtherRole;
|
||||||
if (*(DWORD *)retaddr == 0x5010458b)
|
if (*(DWORD *)retaddr == 0x5010458b)
|
||||||
*role = Engine::ScenarioRole;
|
*role = Engine::ScenarioRole;
|
||||||
strcpy((char*)data1,oldData.c_str());*len=oldData.size();
|
|
||||||
|
write_string_overwrite(data1,len,oldData);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1192,8 +1192,7 @@ namespace Private {
|
|||||||
data.append(oldData);
|
data.append(oldData);
|
||||||
else {
|
else {
|
||||||
std::wstring oldText = std::wstring(oldTextAddress, trimmedSize);
|
std::wstring oldText = std::wstring(oldTextAddress, trimmedSize);
|
||||||
wcscpy((LPWSTR)data1,oldText.c_str());
|
write_string_overwrite(data1,len,oldText);
|
||||||
*len=oldText.size()*2;
|
|
||||||
update=true;
|
update=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1628,10 +1627,7 @@ namespace{
|
|||||||
static std::wstring _ws;
|
static std::wstring _ws;
|
||||||
if(_ws==str)return;
|
if(_ws==str)return;
|
||||||
_ws=str;
|
_ws=str;
|
||||||
auto _s=new wchar_t[str.size()+1];
|
write_string_new(data,len,str);
|
||||||
wcscpy(_s,str.c_str());
|
|
||||||
*data=(DWORD)_s;
|
|
||||||
*len=str.size()*2;
|
|
||||||
*split=0;
|
*split=0;
|
||||||
}
|
}
|
||||||
bool malie_light(){
|
bool malie_light(){
|
||||||
|
@ -415,8 +415,9 @@ std::unordered_map<uintptr_t,int>addr_role;
|
|||||||
*role=addr_role[retaddr];
|
*role=addr_role[retaddr];
|
||||||
if (*role == Engine::NameRole)
|
if (*role == Engine::NameRole)
|
||||||
strReplace(oldData,"\x81\x40", ""); // remove spaces in the middle of names
|
strReplace(oldData,"\x81\x40", ""); // remove spaces in the middle of names
|
||||||
strcpy((char*)data1,oldData.c_str());
|
|
||||||
*len=oldData.size();return true;
|
write_string_overwrite(data1,len,oldData);
|
||||||
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
void hookafter(hook_stack*s,void* data1, size_t len){
|
void hookafter(hook_stack*s,void* data1, size_t len){
|
||||||
@ -666,9 +667,8 @@ bool attach(ULONG startAddress, ULONG stopAddress)
|
|||||||
hp.hook_font=F_GetGlyphOutlineA;
|
hp.hook_font=F_GetGlyphOutlineA;
|
||||||
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
||||||
|
|
||||||
static std::regex rx("\\{.*?\\}");
|
write_string_overwrite(data,len,std::regex_replace(std::string((char*)data,*len), std::regex("\\{.*?\\}"), ""));
|
||||||
auto _=std::regex_replace(std::string((char*)data,*len), rx, "");
|
return true;
|
||||||
strcpy((char*)data,_.c_str());*len=_.size();return true;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
count|=NewHook(hp,"EmbedMinori");
|
count|=NewHook(hp,"EmbedMinori");
|
||||||
|
@ -189,8 +189,8 @@ namespace Private {
|
|||||||
*role = Engine::ScenarioRole;
|
*role = Engine::ScenarioRole;
|
||||||
else if (ins == 0x5f) // 0047D5A4 5F POP EDI
|
else if (ins == 0x5f) // 0047D5A4 5F POP EDI
|
||||||
*role = Engine::NameRole;
|
*role = Engine::NameRole;
|
||||||
strcpy((char*)data,text);
|
|
||||||
*len1=strlen(text);
|
write_string_overwrite(data,len1,text);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} // namespace Private
|
} // namespace Private
|
||||||
|
@ -123,8 +123,7 @@ bool before(hook_stack*s,void* data, size_t* len,uintptr_t*role){
|
|||||||
if (*(WORD *)(retaddr - 8) == 0x088b) // 8b08 mov ecx,dword ptr ds:[eax]
|
if (*(WORD *)(retaddr - 8) == 0x088b) // 8b08 mov ecx,dword ptr ds:[eax]
|
||||||
*role = s->stack[3] ? Engine::ScenarioRole : Engine::NameRole;
|
*role = s->stack[3] ? Engine::ScenarioRole : Engine::NameRole;
|
||||||
std::string oldData(trimmedText, trimmedSize);
|
std::string oldData(trimmedText, trimmedSize);
|
||||||
strcpy((char*)data,oldData.c_str());
|
write_string_overwrite(data,len,oldData);
|
||||||
*len=oldData.size();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void after(hook_stack*s,void* data, size_t len){
|
void after(hook_stack*s,void* data, size_t len){
|
||||||
@ -177,8 +176,7 @@ static bool InsertNewPal1Hook()
|
|||||||
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
||||||
auto s=std::string((char*)data,*len);
|
auto s=std::string((char*)data,*len);
|
||||||
s=rubyRemove(s);
|
s=rubyRemove(s);
|
||||||
strcpy((LPSTR)data,s.c_str());*len=s.size();
|
write_string_overwrite(data,len,s);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
hp.hook_font=F_CreateFontIndirectA|F_CreateFontA;
|
hp.hook_font=F_CreateFontIndirectA|F_CreateFontA;
|
||||||
@ -238,7 +236,7 @@ const BYTE bytes[] = {
|
|||||||
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
||||||
auto s=std::string((char*)data,*len);
|
auto s=std::string((char*)data,*len);
|
||||||
s=rubyRemove(s);
|
s=rubyRemove(s);
|
||||||
strcpy((LPSTR)data,s.c_str());*len=s.size();
|
write_string_overwrite(data,len,s);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
return NewHook(hp, "Pal");
|
return NewHook(hp, "Pal");
|
||||||
|
@ -24,11 +24,7 @@ bool InsertPensilHook()
|
|||||||
namespace{
|
namespace{
|
||||||
bool pensilfilter(void* data, size_t* len, HookParam* hp){
|
bool pensilfilter(void* data, size_t* len, HookParam* hp){
|
||||||
//「馬鹿な、\{軌道護符|サテラ}が封じられるとは! ハーリーの仕業か。連中の魔法科学はそこまで進んだのか!?」
|
//「馬鹿な、\{軌道護符|サテラ}が封じられるとは! ハーリーの仕業か。連中の魔法科学はそこまで進んだのか!?」
|
||||||
auto str=std::string(reinterpret_cast<char*>(data),*len);
|
write_string_overwrite(data,len,std::regex_replace(std::string(reinterpret_cast<char*>(data),*len), std::regex("\\\\\\{(.*?)\\|(.*?)\\}"), "$1"));
|
||||||
str = std::regex_replace(str, std::regex("\\\\\\{(.*?)\\|(.*?)\\}"), "$1");
|
|
||||||
|
|
||||||
*len = (str.size()) ;
|
|
||||||
strcpy(reinterpret_cast<char*>(data), str.c_str());
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -630,9 +630,7 @@ namespace Private {
|
|||||||
*/
|
*/
|
||||||
//auto split = s->stack[0]; // retaddr is always the same anyway
|
//auto split = s->stack[0]; // retaddr is always the same anyway
|
||||||
std::string oldData(trimmedText, trimmedSize);
|
std::string oldData(trimmedText, trimmedSize);
|
||||||
|
write_string_overwrite(data1,len,oldData);
|
||||||
strcpy((char*)data1,oldData.c_str());
|
|
||||||
*len=oldData.size();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void hookafter(hook_stack*s,void* data1, size_t len)
|
void hookafter(hook_stack*s,void* data1, size_t len)
|
||||||
@ -916,11 +914,7 @@ bool attach(ULONG startAddress, ULONG stopAddress)
|
|||||||
hp.type=EMBED_ABLE|EMBED_DYNA_SJIS|USING_STRING;
|
hp.type=EMBED_ABLE|EMBED_DYNA_SJIS|USING_STRING;
|
||||||
hp.hook_font=F_ExtTextOutA|F_GetTextExtentPoint32A;
|
hp.hook_font=F_ExtTextOutA|F_GetTextExtentPoint32A;
|
||||||
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
||||||
|
write_string_overwrite(data,len,std::regex_replace(std::string((char*)data,*len), std::regex("\\[rb,(.*?),.+\\]"), "$1"));
|
||||||
static std::regex rx("\\[rb,(.*?),.+\\]");
|
|
||||||
auto _=std::regex_replace(std::string((char*)data,*len), rx, "$1");
|
|
||||||
|
|
||||||
strcpy((char*)data,_.c_str());*len=_.size();
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
return NewHook(hp,"EmbedQLIE");
|
return NewHook(hp,"EmbedQLIE");
|
||||||
|
@ -657,8 +657,7 @@ namespace Private {
|
|||||||
//ULONG split = arg->unknown2[0]; // always 2
|
//ULONG split = arg->unknown2[0]; // always 2
|
||||||
//ULONG split = s->stack[0]; // return address
|
//ULONG split = s->stack[0]; // return address
|
||||||
std::wstring newText;
|
std::wstring newText;
|
||||||
std::wstring old=trimmedText;
|
write_string_overwrite(data1,len1,trimmedText);
|
||||||
wcscpy((LPWSTR)data1,old.c_str());*len1=old.size()*2;
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (newText != trimmedText) {
|
if (newText != trimmedText) {
|
||||||
@ -766,8 +765,7 @@ namespace Private {
|
|||||||
if (arg->isValid()) {
|
if (arg->isValid()) {
|
||||||
auto oldText =StringToWideString(std::string(arg->text),CP_UTF8).value();
|
auto oldText =StringToWideString(std::string(arg->text),CP_UTF8).value();
|
||||||
auto split = s->stack[0]; // return address
|
auto split = s->stack[0]; // return address
|
||||||
std::wstring old=oldText;
|
write_string_overwrite(data1,len1,oldText);
|
||||||
wcscpy((LPWSTR)data1,old.c_str());*len1=old.size()*2;
|
|
||||||
return 1;
|
return 1;
|
||||||
// std::wstring newText = EngineController::instance()->dispatchTextWSTD(oldText, role, sig);
|
// std::wstring newText = EngineController::instance()->dispatchTextWSTD(oldText, role, sig);
|
||||||
// if (newText != oldText) {
|
// if (newText != oldText) {
|
||||||
@ -919,7 +917,7 @@ namespace Private {
|
|||||||
if (text && *text) {
|
if (text && *text) {
|
||||||
std::wstring oldText(text);
|
std::wstring oldText(text);
|
||||||
if (oldText.size() > 1) {
|
if (oldText.size() > 1) {
|
||||||
wcscpy((LPWSTR)data1,oldText.c_str());*len1=oldText.size()*2;
|
write_string_overwrite(data1,len1,oldText);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -177,9 +177,7 @@ bool InsertShinaHook(int ver )
|
|||||||
{
|
{
|
||||||
StringFilter(reinterpret_cast<LPSTR>(data), reinterpret_cast<size_t *>(size), "_r",2);
|
StringFilter(reinterpret_cast<LPSTR>(data), reinterpret_cast<size_t *>(size), "_r",2);
|
||||||
|
|
||||||
static std::regex rx("_t!.*?[/>]");
|
write_string_overwrite(data,size,std::regex_replace(std::string((char*)data,*size), std::regex("_t!.*?[/>]"), ""));
|
||||||
auto _=std::regex_replace(std::string((char*)data,*size), rx, "");
|
|
||||||
strcpy((char*)data,_.c_str());*size=_.size();
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
ConsoleOutput("triggered: adding dynamic reader");
|
ConsoleOutput("triggered: adding dynamic reader");
|
||||||
@ -324,10 +322,7 @@ namespace Private {
|
|||||||
// && text[NameCapacity - 1] == 0 && text[NameCapacity])
|
// && text[NameCapacity - 1] == 0 && text[NameCapacity])
|
||||||
// *role = Engine::NameRole;
|
// *role = Engine::NameRole;
|
||||||
|
|
||||||
std::string oldData = text;
|
write_string_overwrite(data,len,text);
|
||||||
strcpy((char*)data,oldData.c_str());
|
|
||||||
*len=oldData.size();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void dispatchText2(LPSTR text, bool paddingSpace,std::string newData)
|
void dispatchText2(LPSTR text, bool paddingSpace,std::string newData)
|
||||||
@ -404,8 +399,7 @@ namespace Private {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
strcpy((char*)data,save.c_str());
|
write_string_overwrite(data,len,save);
|
||||||
*len=save.size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//void dispatch(LPSTR text)
|
//void dispatch(LPSTR text)
|
||||||
@ -673,9 +667,7 @@ namespace Private {
|
|||||||
*role=argaddr;
|
*role=argaddr;
|
||||||
auto arg = (HookArgument *)argaddr;
|
auto arg = (HookArgument *)argaddr;
|
||||||
if(Engine::isAddressReadable((argaddr + textOffset_))==false){
|
if(Engine::isAddressReadable((argaddr + textOffset_))==false){
|
||||||
auto _=(LPSTR)s->stack[2];
|
write_string_overwrite(data,len,(LPSTR)s->stack[2]);
|
||||||
strcpy((char*)data,_);
|
|
||||||
*len=strlen(_);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
LPSTR textAddress = (LPSTR)*(DWORD *)(argaddr + textOffset_),
|
LPSTR textAddress = (LPSTR)*(DWORD *)(argaddr + textOffset_),
|
||||||
@ -930,11 +922,9 @@ bool attach(int ver)
|
|||||||
hp.newlineseperator=L"_r";
|
hp.newlineseperator=L"_r";
|
||||||
hp.hook_font=F_GetGlyphOutlineA;
|
hp.hook_font=F_GetGlyphOutlineA;
|
||||||
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
hp.filter_fun=[](void* data, size_t* len, HookParam* hp){
|
||||||
|
write_string_overwrite(data,len,std::regex_replace(std::string((char*)data,*len), std::regex("_t!.*?[/>]"), ""));
|
||||||
static std::regex rx("_t!.*?[/>]");
|
return true;
|
||||||
auto _=std::regex_replace(std::string((char*)data,*len), rx, "");
|
};
|
||||||
strcpy((char*)data,_.c_str());*len=_.size();return true;
|
|
||||||
};
|
|
||||||
return NewHook(hp,"EmbedShario");
|
return NewHook(hp,"EmbedShario");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1739,8 +1739,7 @@ bool text_fun(hook_stack*s,void* data, size_t* len,uintptr_t*role){
|
|||||||
if (!arg || !arg->isValid())
|
if (!arg || !arg->isValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wcscpy((wchar_t*)data,arg->getText());
|
write_string_overwrite(data,len,std::wstring(arg->getText(),arg->size));
|
||||||
*len=arg->size *2;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void hookafter(hook_stack*s,void* data, size_t len){
|
void hookafter(hook_stack*s,void* data, size_t len){
|
||||||
@ -1805,8 +1804,7 @@ namespace Private {
|
|||||||
//auto sig = Engine::hashThreadSignature(role, split);
|
//auto sig = Engine::hashThreadSignature(role, split);
|
||||||
|
|
||||||
std::wstring oldText = std::wstring(text, arg->size);//,
|
std::wstring oldText = std::wstring(text, arg->size);//,
|
||||||
wcscpy((wchar_t*)data,oldText.c_str());
|
write_string_overwrite(data,len,oldText);
|
||||||
*len=oldText.size()*2;
|
|
||||||
return true;
|
return true;
|
||||||
// newText = EngineController::instance()->dispatchTextWSTD(oldText, role, sig);
|
// newText = EngineController::instance()->dispatchTextWSTD(oldText, role, sig);
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ static void SpecialHookSilkys(hook_stack* stack, HookParam *, uintptr_t *data,
|
|||||||
Engine::ScenarioRole;
|
Engine::ScenarioRole;
|
||||||
|
|
||||||
std::string oldData(arg->getText(), arg->size);
|
std::string oldData(arg->getText(), arg->size);
|
||||||
strcpy((char*)data1,oldData.c_str());*len=oldData.size();return 1;
|
return write_string_overwrite(data1,len,oldData);
|
||||||
}
|
}
|
||||||
TextUnionA *arg_,
|
TextUnionA *arg_,
|
||||||
argValue_;
|
argValue_;
|
||||||
|
@ -1086,23 +1086,7 @@ namespace Private {
|
|||||||
else if (split >= 2 && split <= 0x14 && split != 3 && split != 0xb || split == 0x22)
|
else if (split >= 2 && split <= 0x14 && split != 3 && split != 0xb || split == 0x22)
|
||||||
*role = Engine::ScenarioRole;
|
*role = Engine::ScenarioRole;
|
||||||
}
|
}
|
||||||
std::string oldData = arg->text;
|
write_string_overwrite(data,len1,arg->text);
|
||||||
std::string newData = oldData+"XX";
|
|
||||||
strcpy((char*)data,oldData.c_str());*len1=oldData.size();
|
|
||||||
return true;
|
|
||||||
if (*role == Engine::NameRole || oldData == newData) // do not translate name
|
|
||||||
return false;
|
|
||||||
|
|
||||||
data_ = newData;
|
|
||||||
|
|
||||||
arg_ = arg;
|
|
||||||
argValue_ = *arg;
|
|
||||||
|
|
||||||
arg->text = data_.c_str();
|
|
||||||
arg->size = data_.size() + 1;
|
|
||||||
arg->capacity = arg->size;
|
|
||||||
|
|
||||||
hashes_.insert(hashCharArray(arg->text));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool hookAfter(hook_stack*s,void* data, size_t* len1,uintptr_t*role)
|
bool hookAfter(hook_stack*s,void* data, size_t* len1,uintptr_t*role)
|
||||||
@ -1587,20 +1571,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
*role = Engine::ScenarioRole ;
|
*role = Engine::ScenarioRole ;
|
||||||
strcpy((char*)data,text);*len=strlen(text);
|
return write_string_overwrite(data,len,text);
|
||||||
/*
|
|
||||||
auto sig = Engine::hashThreadSignature(role, split);
|
|
||||||
//int size = arg->size; // size not used as not needed
|
|
||||||
buffer_ = EngineController::instance()->dispatchTextASTD(text, role, sig);
|
|
||||||
|
|
||||||
if (editable_) {
|
|
||||||
arg_ = arg;
|
|
||||||
text_ = arg->text;
|
|
||||||
size_ = arg->size;
|
|
||||||
arg->text = buffer_.c_str(); // reset arg3
|
|
||||||
arg->size = buffer_.size() + 1; // +1 for the nullptr
|
|
||||||
}*/
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hookAfter(hook_stack*s,void* data, size_t* len,uintptr_t*role)
|
bool hookAfter(hook_stack*s,void* data, size_t* len,uintptr_t*role)
|
||||||
@ -1638,19 +1609,7 @@ public:
|
|||||||
LPCSTR text = arg->text;
|
LPCSTR text = arg->text;
|
||||||
if (arg->size <= 1 || !text || !*text || all_ascii(text))
|
if (arg->size <= 1 || !text || !*text || all_ascii(text))
|
||||||
return false;
|
return false;
|
||||||
strcpy((char*)data,text);*len=strlen(text);
|
return write_string_overwrite(data,len,text);
|
||||||
/* enum { role = Engine::OtherRole };
|
|
||||||
auto sig = Engine::hashThreadSignature(role, split2);
|
|
||||||
buffer_ = g->dispatchTextASTD(text, role, sig);
|
|
||||||
|
|
||||||
if (editable_) {
|
|
||||||
arg_ = arg;
|
|
||||||
text_ = arg->text;
|
|
||||||
size_ = arg->size;
|
|
||||||
arg->text = buffer_.c_str(); // reset arg3
|
|
||||||
arg->size = buffer_.size() + 1; // +1 for the nullptr
|
|
||||||
}*/
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hookAfter(hook_stack*s,void* data, size_t* len,uintptr_t*role)
|
bool hookAfter(hook_stack*s,void* data, size_t* len,uintptr_t*role)
|
||||||
@ -1693,11 +1652,7 @@ bool fixedTextHook(hook_stack*s,void* data, size_t* len,uintptr_t*role)
|
|||||||
*role = Engine::OtherRole;
|
*role = Engine::OtherRole;
|
||||||
|
|
||||||
}
|
}
|
||||||
strcpy((char*)data,text);*len=strlen(text);
|
return write_string_overwrite(data,len,text);
|
||||||
/*std::string buffer_ = EngineController::instance()->dispatchTextASTD(text, role, sig);
|
|
||||||
::strncpy(text, buffer_.c_str(), FixedSize - 1);
|
|
||||||
text[FixedSize - 1] = 0;*/
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // unnamed namespace
|
} // unnamed namespace
|
||||||
|
@ -246,7 +246,8 @@ namespace{
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
*role = Engine::OtherRole ;
|
*role = Engine::OtherRole ;
|
||||||
wcscpy((wchar_t*)data,text);*len=wcslen(text)*2;
|
|
||||||
|
write_string_overwrite(data,len,text);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void afterAgsSpriteCreateTextExW(hook_stack*s,void* data1, size_t len)
|
void afterAgsSpriteCreateTextExW(hook_stack*s,void* data1, size_t len)
|
||||||
@ -282,7 +283,7 @@ namespace{
|
|||||||
*role = Engine::ScenarioRole;
|
*role = Engine::ScenarioRole;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
wcscpy((wchar_t*)data,text);*len=wcslen(text)*2;
|
write_string_overwrite(data,len,text);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void afterAgsSpriteCreateTextW(hook_stack*s,void* data1, size_t len)
|
void afterAgsSpriteCreateTextW(hook_stack*s,void* data1, size_t len)
|
||||||
@ -325,8 +326,7 @@ namespace{
|
|||||||
*role = Engine::ScenarioRole;
|
*role = Engine::ScenarioRole;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
strcpy((char*)data,text);*len=strlen(text);
|
return write_string_overwrite(data,len,text);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// jichi 7/26/2015: Backport logic in vnragent to vnrhook
|
// jichi 7/26/2015: Backport logic in vnragent to vnrhook
|
||||||
|
@ -305,9 +305,8 @@ namespace{
|
|||||||
|
|
||||||
s = std::regex_replace(s, std::regex("(.*)\x81u([\\s\\S]*?)\x81v(.*)"), "\x81u$2\x81v"); //「 」
|
s = std::regex_replace(s, std::regex("(.*)\x81u([\\s\\S]*?)\x81v(.*)"), "\x81u$2\x81v"); //「 」
|
||||||
s = std::regex_replace(s, std::regex("(.*)\x81i([\\s\\S]*?)\x81j(.*)"), "\x81i$2\x81j"); //( )
|
s = std::regex_replace(s, std::regex("(.*)\x81i([\\s\\S]*?)\x81j(.*)"), "\x81i$2\x81j"); //( )
|
||||||
*size = s.size();
|
|
||||||
strcpy((char*)data, s.c_str());
|
return write_string_overwrite(data,size,s);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
bool Tamamogetname(LPVOID data, size_t *size, HookParam *)
|
bool Tamamogetname(LPVOID data, size_t *size, HookParam *)
|
||||||
{
|
{
|
||||||
@ -320,9 +319,7 @@ namespace{
|
|||||||
else if (s.find("\x81i")!=s.npos && s.find("\x81j")!=s.npos)
|
else if (s.find("\x81i")!=s.npos && s.find("\x81j")!=s.npos)
|
||||||
s = std::regex_replace(s, std::regex("(.*)\x81i([\\s\\S]*?)\x81j(.*)"), "$1"); //( )
|
s = std::regex_replace(s, std::regex("(.*)\x81i([\\s\\S]*?)\x81j(.*)"), "$1"); //( )
|
||||||
else return false;
|
else return false;
|
||||||
*size = s.size();
|
return write_string_overwrite(data,size,s);
|
||||||
strcpy((char*)data, s.c_str());
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
bool tamamo3(){
|
bool tamamo3(){
|
||||||
//閃光の騎士 ~カリスティアナイト~
|
//閃光の騎士 ~カリスティアナイト~
|
||||||
|
@ -198,10 +198,8 @@ namespace Private {
|
|||||||
//auto split = s->edx;
|
//auto split = s->edx;
|
||||||
//auto sig = Engine::hashThreadSignature(role, split);
|
//auto sig = Engine::hashThreadSignature(role, split);
|
||||||
enum { sig = 0 }; // split not used
|
enum { sig = 0 }; // split not used
|
||||||
strcpy((char*)data1,text);
|
|
||||||
*len=strlen(text);return true;
|
return write_string_overwrite(data1,len,text);
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
void hookafter(hook_stack*s,void* data1, size_t len)
|
void hookafter(hook_stack*s,void* data1, size_t len)
|
||||||
{
|
{
|
||||||
|
@ -82,8 +82,7 @@ bool WendyBell_filter(void* data, size_t* len, HookParam* hp){
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*len=wc.size()*2;
|
write_string_overwrite(data,len,wc);
|
||||||
wcscpy(reinterpret_cast<LPWSTR>(data),wc.c_str());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -99,8 +98,7 @@ bool tkbl_filter(void* data, size_t* len, HookParam* hp){
|
|||||||
if(last==str)return false;
|
if(last==str)return false;
|
||||||
last=str;
|
last=str;
|
||||||
|
|
||||||
*len=str.size()*2;
|
write_string_overwrite(data,len,str);
|
||||||
wcscpy(reinterpret_cast<LPWSTR>(data),str.c_str());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool tkbl(){
|
bool tkbl(){
|
||||||
|
@ -199,9 +199,7 @@ namespace Private {
|
|||||||
strReplace(oldData, "\x81\x40", "");
|
strReplace(oldData, "\x81\x40", "");
|
||||||
//oldData.replace("\x81\x40", ""); // remove spaces in the middle of names
|
//oldData.replace("\x81\x40", ""); // remove spaces in the middle of names
|
||||||
|
|
||||||
strcpy((CHAR*)data,oldData.c_str());
|
return write_string_overwrite(data,len1,oldData);
|
||||||
*len1=oldData.size();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
void hookafter2(hook_stack*s,void* data, size_t len){
|
void hookafter2(hook_stack*s,void* data, size_t len){
|
||||||
@ -588,10 +586,8 @@ namespace Private {
|
|||||||
//|| isSkippedText(text))
|
//|| isSkippedText(text))
|
||||||
return false;
|
return false;
|
||||||
enum { role = Engine::OtherRole };
|
enum { role = Engine::OtherRole };
|
||||||
std::string oldData = text;
|
|
||||||
strcpy((char*)data,oldData.c_str());
|
return write_string_overwrite(data,len,text);
|
||||||
*len=oldData.size();
|
|
||||||
return true;
|
|
||||||
/* //oldData.replace("\\n", "\n"); // Remove new line. FIXME: automatically adjust line width
|
/* //oldData.replace("\\n", "\n"); // Remove new line. FIXME: automatically adjust line width
|
||||||
std::string newData = EngineController::instance()->dispatchTextASTD(oldData, role, retaddr);
|
std::string newData = EngineController::instance()->dispatchTextASTD(oldData, role, retaddr);
|
||||||
if (newData == oldData)
|
if (newData == oldData)
|
||||||
|
@ -181,9 +181,8 @@ namespace Private {
|
|||||||
|
|
||||||
//auto sig = Engine::hashThreadSignature(role, reladdr);
|
//auto sig = Engine::hashThreadSignature(role, reladdr);
|
||||||
std::string oldData = arg->getText();
|
std::string oldData = arg->getText();
|
||||||
strcpy((LPSTR)data,oldData.c_str());
|
|
||||||
*len=oldData.size();
|
return write_string_overwrite(data,len,oldData);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
void hookafter(hook_stack*s,void* data, size_t len){
|
void hookafter(hook_stack*s,void* data, size_t len){
|
||||||
|
|
||||||
|
@ -271,10 +271,7 @@ bool WillPlus_extra_filter(void* data, size_t* size, HookParam*) {
|
|||||||
std::wregex reg2(L"%[A-Z]+");
|
std::wregex reg2(L"%[A-Z]+");
|
||||||
result1 = std::regex_replace(result1, reg2, L"");
|
result1 = std::regex_replace(result1, reg2, L"");
|
||||||
|
|
||||||
|
write_string_overwrite(data,size,result1);
|
||||||
|
|
||||||
*size = result1.size() * 2;
|
|
||||||
wcscpy(text, result1.c_str());
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
bool InsertWillPlusAHook()
|
bool InsertWillPlusAHook()
|
||||||
@ -532,8 +529,8 @@ bool hookBefore(hook_stack*s,void* data, size_t* len,uintptr_t*role)
|
|||||||
std::wregex reg11(L"\\{(.*?);(.*?)\\}");
|
std::wregex reg11(L"\\{(.*?);(.*?)\\}");
|
||||||
str = std::regex_replace(str, reg11, L"$1");
|
str = std::regex_replace(str, reg11, L"$1");
|
||||||
|
|
||||||
wcscpy((wchar_t*)data,str.c_str());
|
write_string_overwrite(data,len,str);
|
||||||
*len=str.size()*2;
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -777,8 +774,7 @@ namespace TextHookW
|
|||||||
if (!trimmedSize || !*trimmedText)
|
if (!trimmedSize || !*trimmedText)
|
||||||
return false;
|
return false;
|
||||||
std::wstring oldText = std::wstring(trimmedText, trimmedSize);
|
std::wstring oldText = std::wstring(trimmedText, trimmedSize);
|
||||||
wcscpy((LPWSTR)data,oldText.c_str());*len=oldText.size()*2;
|
write_string_overwrite(data,len,oldText);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
template<int idx>
|
template<int idx>
|
||||||
@ -1260,9 +1256,7 @@ namespace Private {
|
|||||||
return false;
|
return false;
|
||||||
std::string oldData(trimmedText, trimmedSize);
|
std::string oldData(trimmedText, trimmedSize);
|
||||||
|
|
||||||
strcpy((char*)data,oldData.c_str());
|
return write_string_overwrite(data,len,oldData);
|
||||||
*len=oldData.size();
|
|
||||||
return true;
|
|
||||||
/*newData = EngineController::instance()->dispatchTextASTD(oldData, role, sig);
|
/*newData = EngineController::instance()->dispatchTextASTD(oldData, role, sig);
|
||||||
if (newData == oldData)
|
if (newData == oldData)
|
||||||
return;
|
return;
|
||||||
@ -1555,9 +1549,8 @@ namespace Private {
|
|||||||
if (!Engine::isAddressReadable(text) || !*text || ::strlen(text) <= 2) // do not translate single character
|
if (!Engine::isAddressReadable(text) || !*text || ::strlen(text) <= 2) // do not translate single character
|
||||||
return false;
|
return false;
|
||||||
*role = Engine::OtherRole ;
|
*role = Engine::OtherRole ;
|
||||||
strcpy((char*)data,text);*len=strlen(text);
|
|
||||||
|
return write_string_overwrite(data,len,text);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Private
|
} // namespace Private
|
||||||
|
@ -264,7 +264,8 @@ namespace Private {
|
|||||||
bool timeout;
|
bool timeout;
|
||||||
int prefixSize = text - self->text,
|
int prefixSize = text - self->text,
|
||||||
capacity = self->capacity - prefixSize;
|
capacity = self->capacity - prefixSize;
|
||||||
strcpy((char*)data1,data.c_str());*len1=data.size();return 1;
|
return write_string_overwrite(data1,len1,data);
|
||||||
|
|
||||||
// data = EngineController::instance()->dispatchTextASTD(data, role, sig, capacity, SendAllowed, &timeout);
|
// data = EngineController::instance()->dispatchTextASTD(data, role, sig, capacity, SendAllowed, &timeout);
|
||||||
// if (timeout)
|
// if (timeout)
|
||||||
// return true;
|
// return true;
|
||||||
|
@ -141,10 +141,8 @@ bool InsertYukaSystem2Hook()
|
|||||||
(wc=='"')||(wc=='.')||(wc=='-')||(wc=='#')||
|
(wc=='"')||(wc=='.')||(wc=='-')||(wc=='#')||
|
||||||
(wc==65533)||(wc==2))return false;
|
(wc==65533)||(wc==2))return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*len = (str.size()) ;
|
return write_string_overwrite(data,len,str);
|
||||||
strcpy(reinterpret_cast<char*>(data), str.c_str());
|
|
||||||
return true;
|
|
||||||
};
|
};
|
||||||
//hp.text_fun = SpecialHookYukaSystem2;
|
//hp.text_fun = SpecialHookYukaSystem2;
|
||||||
ConsoleOutput("INSERT YukaSystem2");
|
ConsoleOutput("INSERT YukaSystem2");
|
||||||
|
@ -155,9 +155,7 @@ bool libcefhook(HMODULE module) {
|
|||||||
s += c;
|
s += c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wcscpy((LPWSTR)data, s.c_str());
|
return write_string_overwrite(data,size,s);
|
||||||
*size = i * 2;
|
|
||||||
return true;
|
|
||||||
};
|
};
|
||||||
hp.type = USING_STRING | CODEC_UTF16|NO_CONTEXT;
|
hp.type = USING_STRING | CODEC_UTF16|NO_CONTEXT;
|
||||||
ConsoleOutput("v8libcefhook %p", addr);
|
ConsoleOutput("v8libcefhook %p", addr);
|
||||||
|
@ -53,8 +53,7 @@ namespace{
|
|||||||
if(text[text.size()-1]=='$')
|
if(text[text.size()-1]=='$')
|
||||||
text=text.substr(0,text.size()-1);
|
text=text.substr(0,text.size()-1);
|
||||||
|
|
||||||
strcpy((char*)data,text.c_str());
|
write_string_overwrite(data,len,text);
|
||||||
*len=text.size();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void hookafter_navel(hook_stack*s,void* data, size_t len)
|
void hookafter_navel(hook_stack*s,void* data, size_t len)
|
||||||
@ -293,8 +292,7 @@ namespace Private {
|
|||||||
if (!*text)
|
if (!*text)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::string oldData = text;
|
write_string_overwrite(data,len1,text);
|
||||||
strcpy((char*)data,oldData.c_str());*len1=oldData.size();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +311,7 @@ namespace Private {
|
|||||||
if (!*text)
|
if (!*text)
|
||||||
return false;
|
return false;
|
||||||
std::string oldData = parseScenarioText(text, scenarioEnd);
|
std::string oldData = parseScenarioText(text, scenarioEnd);
|
||||||
strcpy((char*)data,oldData.c_str());*len1=oldData.size();
|
write_string_overwrite(data,len1,oldData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
bool dispatchNameTextafter(char *text, ULONG split,hook_stack*s,void* data, uintptr_t len1 )
|
bool dispatchNameTextafter(char *text, ULONG split,hook_stack*s,void* data, uintptr_t len1 )
|
||||||
@ -761,8 +759,7 @@ namespace Private {
|
|||||||
if (!text || !*text)
|
if (!text || !*text)
|
||||||
return text;
|
return text;
|
||||||
*role=Engine::ChoiceRole;
|
*role=Engine::ChoiceRole;
|
||||||
std::string oldData =text;
|
write_string_overwrite(data,len1,text);
|
||||||
strcpy((char*)data,oldData.c_str());*len1=oldData.size();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
void hookafter(hook_stack*s,void* data, size_t len1){
|
void hookafter(hook_stack*s,void* data, size_t len1){
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include"5pb.h"
|
#include"5pb.h"
|
||||||
#include"mages/mages.hpp"
|
#include"mages/mages.h"
|
||||||
|
|
||||||
bool _5pb::attach_function() {
|
bool _5pb::attach_function() {
|
||||||
//CHAOS;HEAD_NOAH
|
//CHAOS;HEAD_NOAH
|
||||||
bool b3=mages::MAGES();
|
bool b3=hookmages::MAGES();
|
||||||
return b3;
|
return b3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,9 +8,7 @@ bool ENTERGRAMfilter(void* data, size_t* size, HookParam* hp) {
|
|||||||
std::wstring result1 = std::regex_replace(str, reg1, L"$1");
|
std::wstring result1 = std::regex_replace(str, reg1, L"$1");
|
||||||
std::wregex reg2(L"\x3000|\n");
|
std::wregex reg2(L"\x3000|\n");
|
||||||
std::wstring result2 = std::regex_replace(result1, reg2, L"");
|
std::wstring result2 = std::regex_replace(result1, reg2, L"");
|
||||||
|
write_string_overwrite(text,size,result2);
|
||||||
*size = (result2.size()) * 2;
|
|
||||||
wcscpy(text, result2.c_str());
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
bool InsertENTERGRAM() {
|
bool InsertENTERGRAM() {
|
||||||
|
@ -88,8 +88,7 @@ bool _2(){
|
|||||||
if(str.find(_)!=str.npos)
|
if(str.find(_)!=str.npos)
|
||||||
return false;
|
return false;
|
||||||
str = std::regex_replace(str, std::wregex(L"\\[(.*?)\\]<(.*?)>"), L"$1");
|
str = std::regex_replace(str, std::wregex(L"\\[(.*?)\\]<(.*?)>"), L"$1");
|
||||||
wcscpy((wchar_t*)data,str.c_str());
|
write_string_overwrite(data,len,str);
|
||||||
*len=str.size()*2;
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
return NewHook(hp, "LightVN2");
|
return NewHook(hp, "LightVN2");
|
||||||
|
@ -35,9 +35,7 @@ bool IG64filter(void* data, size_t* size, HookParam*) {
|
|||||||
|
|
||||||
std::wregex reg2(L"@[^@]*@");
|
std::wregex reg2(L"@[^@]*@");
|
||||||
std::wstring result2 = std::regex_replace(result1, reg2, L"");
|
std::wstring result2 = std::regex_replace(result1, reg2, L"");
|
||||||
|
write_string_overwrite(text,size,result2);
|
||||||
*size = (result2.size()) * 2;
|
|
||||||
wcscpy(text, result2.c_str());
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
bool InsertIG64Hook2() {
|
bool InsertIG64Hook2() {
|
||||||
|
@ -68,8 +68,7 @@ _BYTE *__fastcall sub_18005B290(
|
|||||||
|
|
||||||
std::regex_search(str, match,std::wregex(L" Text:(.*?)Next:(.*?)") );
|
std::regex_search(str, match,std::wregex(L" Text:(.*?)Next:(.*?)") );
|
||||||
result1= match[1].str();
|
result1= match[1].str();
|
||||||
*len = (result1.size()) * 2;
|
write_string_overwrite(data,len,result1);
|
||||||
wcscpy((LPWSTR)data, result1.c_str());
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
127
LunaHook/engine64/yuzusuyu.cpp
Normal file
127
LunaHook/engine64/yuzusuyu.cpp
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
#include"yuzusuyu.h"
|
||||||
|
#include"mages/mages.h"
|
||||||
|
namespace{
|
||||||
|
|
||||||
|
auto isFastMem = true;
|
||||||
|
|
||||||
|
auto isVirtual = true;//Process.arch === 'x64' && Process.platform === 'windows';
|
||||||
|
auto idxDescriptor = isVirtual == true ? 2 : 1;
|
||||||
|
auto idxEntrypoint = idxDescriptor + 1;
|
||||||
|
|
||||||
|
uintptr_t getDoJitAddress() {
|
||||||
|
auto RegisterBlockSig1 = "E8 ?? ?? ?? ?? 4? 8B ?? 4? 8B ?? 4? 8B ?? E8 ?? ?? ?? ?? 4? 89?? 4? 8B???? ???????? 4? 89?? ?? 4? 8B?? 4? 89";
|
||||||
|
auto RegisterBlock=find_pattern(RegisterBlockSig1,processStartAddress,processStopAddress);
|
||||||
|
if (RegisterBlock) {
|
||||||
|
auto beginSubSig1 = "CC 40 5? 5? 5?";
|
||||||
|
auto lookbackSize = 0x400;
|
||||||
|
auto address=RegisterBlock-lookbackSize;
|
||||||
|
auto subs=find_pattern(beginSubSig1,address,address+lookbackSize);
|
||||||
|
if(subs){
|
||||||
|
return subs+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
auto PatchSig1 = "4????? 4????? 4????? FF?? ?? 4????? ?? 4????? 75 ?? 4????? ?? 4????? ?? 4?";
|
||||||
|
auto Patch = find_pattern(PatchSig1,processStartAddress,processStopAddress);
|
||||||
|
if (Patch) {
|
||||||
|
auto beginSubSig1 = "4883EC ?? 48";
|
||||||
|
auto lookbackSize = 0x80;
|
||||||
|
auto address = Patch-lookbackSize;
|
||||||
|
auto subs = find_pattern(beginSubSig1,address,address+lookbackSize);
|
||||||
|
if (subs) {
|
||||||
|
idxDescriptor = 1;
|
||||||
|
idxEntrypoint = 2;
|
||||||
|
return subs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
/*
|
||||||
|
这块不知道怎么实现。
|
||||||
|
// DebugSymbol: RegisterBlock
|
||||||
|
// ?RegisterBlock@EmitX64@X64@Backend@Dynarmic@@IEAA?AUBlockDescriptor@1234@AEBVLocationDescriptor@IR@4@PEBX_K@Z <- new
|
||||||
|
// ?RegisterBlock@EmitX64@X64@Backend@Dynarmic@@IEAA?AUBlockDescriptor@1234@AEBVLocationDescriptor@IR@4@PEBX1_K@Z
|
||||||
|
const symbols = DebugSymbol.findFunctionsMatching('Dynarmic::Backend::X64::EmitX64::RegisterBlock');
|
||||||
|
if (symbols.length !== 0) {
|
||||||
|
return symbols[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
// DebugSymbol: Patch
|
||||||
|
// ?Patch@EmitX64@X64@Backend@Dynarmic@@IEAAXAEBVLocationDescriptor@IR@4@PEBX@Z
|
||||||
|
const patchs = DebugSymbol.findFunctionsMatching('Dynarmic::Backend::X64::EmitX64::Patch');
|
||||||
|
if (patchs.length !== 0) {
|
||||||
|
idxDescriptor = 1;
|
||||||
|
idxEntrypoint = 2;
|
||||||
|
return patchs[0];
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
uintptr_t* argidx(hook_stack* stack,int idx){
|
||||||
|
auto offset=0;
|
||||||
|
switch (idx)
|
||||||
|
{
|
||||||
|
case 0:offset=get_reg(regs::rcx);break;
|
||||||
|
case 1:offset=get_reg(regs::rdx);break;
|
||||||
|
case 2:offset=get_reg(regs::r8);break;
|
||||||
|
case 3:offset=get_reg(regs::r9);break;
|
||||||
|
}
|
||||||
|
return (uintptr_t*)((uintptr_t)stack+sizeof(hook_stack)-sizeof(uintptr_t)+offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
class emu_arg{
|
||||||
|
hook_stack* stack;
|
||||||
|
public:
|
||||||
|
emu_arg(hook_stack* stack_):stack(stack_){};
|
||||||
|
uintptr_t operator [](int idx){
|
||||||
|
auto base=stack->r13;
|
||||||
|
auto args=(uintptr_t*)stack->r15;
|
||||||
|
return base+args[idx];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
std::unordered_map<uintptr_t,std::pair<LPCSTR,void*>>emfunctionhooks;
|
||||||
|
|
||||||
|
}
|
||||||
|
bool yuzusuyu::attach_function()
|
||||||
|
{
|
||||||
|
auto DoJitPtr=getDoJitAddress();
|
||||||
|
if(DoJitPtr==0)return false;
|
||||||
|
HookParam hp;
|
||||||
|
hp.address=DoJitPtr;
|
||||||
|
hp.text_fun=[](hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){
|
||||||
|
//hp->text_fun=nullptr;hp->type=HOOK_EMPTY;
|
||||||
|
auto descriptor = *argidx(stack,idxDescriptor); // r8
|
||||||
|
auto entrypoint = *argidx(stack,idxEntrypoint); // r9
|
||||||
|
auto em_address = *(uintptr_t*)descriptor;
|
||||||
|
em_address-=0x80004000;
|
||||||
|
if(emfunctionhooks.find(em_address)!=emfunctionhooks.end() && entrypoint){
|
||||||
|
auto op=emfunctionhooks.at(em_address);
|
||||||
|
DWORD _;
|
||||||
|
VirtualProtect((LPVOID)entrypoint,0x10,PAGE_EXECUTE_READWRITE,&_);
|
||||||
|
HookParam hpinternal;
|
||||||
|
hpinternal.address=entrypoint;
|
||||||
|
hpinternal.type=CODEC_UTF16|USING_STRING|NO_CONTEXT;
|
||||||
|
hpinternal.text_fun=(decltype(hpinternal.text_fun))op.second;
|
||||||
|
NewHook(hpinternal,op.first);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
return NewHook(hp,"YuzuDoJit");
|
||||||
|
}
|
||||||
|
// ==UserScript==
|
||||||
|
// @name [0100978013276000] Memories Off
|
||||||
|
// @version 1.0.0 - 1.0.1
|
||||||
|
// @author Koukdw
|
||||||
|
// @description Yuzu
|
||||||
|
// * MAGES. inc.
|
||||||
|
// * MAGES Engine
|
||||||
|
void _0100978013276000(hook_stack* stack, HookParam* hp, uintptr_t* data, uintptr_t* split, size_t* len){
|
||||||
|
auto s=mages::readString(emu_arg(stack)[0],0);
|
||||||
|
write_string_new(data,len,s);
|
||||||
|
}
|
||||||
|
auto _=[](){
|
||||||
|
emfunctionhooks={
|
||||||
|
{0x8003eeac - 0x80004000,{"Memories Off 1.0.0",_0100978013276000}},
|
||||||
|
{0x8003eebc - 0x80004000,{"Memories Off 1.0.1",_0100978013276000}},
|
||||||
|
};
|
||||||
|
return 1;
|
||||||
|
}();
|
16
LunaHook/engine64/yuzusuyu.h
Normal file
16
LunaHook/engine64/yuzusuyu.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include"engine.h"
|
||||||
|
|
||||||
|
class yuzusuyu:public ENGINE{
|
||||||
|
public:
|
||||||
|
yuzusuyu(){
|
||||||
|
|
||||||
|
is_engine_certain=false;
|
||||||
|
check_by=CHECK_BY::CUSTOM;
|
||||||
|
check_by_target=[](){
|
||||||
|
|
||||||
|
return (wcscmp(processName_lower, L"suyu.exe")==0 || wcscmp(processName_lower, L"yuzu.exe")==0);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
bool attach_function();
|
||||||
|
};
|
||||||
|
|
@ -15,6 +15,7 @@
|
|||||||
#include"engine64/ENTERGRAM.h"
|
#include"engine64/ENTERGRAM.h"
|
||||||
#include"engine64/TYPEMOON.h"
|
#include"engine64/TYPEMOON.h"
|
||||||
#include"engine64/LightVN.h"
|
#include"engine64/LightVN.h"
|
||||||
|
#include"engine64/yuzusuyu.h"
|
||||||
std::vector<ENGINE*> ignore_engines(){ return{ }; }
|
std::vector<ENGINE*> ignore_engines(){ return{ }; }
|
||||||
std::vector<ENGINE*> unsafe_check_atlast(){ return{ }; }
|
std::vector<ENGINE*> unsafe_check_atlast(){ return{ }; }
|
||||||
|
|
||||||
@ -36,7 +37,8 @@ std::vector<ENGINE*> check_engines(){
|
|||||||
new AGES7,
|
new AGES7,
|
||||||
new _5pb,
|
new _5pb,
|
||||||
new TYPEMOON,
|
new TYPEMOON,
|
||||||
new ENTERGRAM
|
new ENTERGRAM,
|
||||||
|
new yuzusuyu
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
add_library(commonengine v8/v8.cpp python/python2.cpp python/python3.cpp python/python.cpp pchooks/pchooks.cpp)
|
add_library(commonengine mages/mages.cpp v8/v8.cpp python/python2.cpp python/python3.cpp python/python.cpp pchooks/pchooks.cpp)
|
||||||
target_precompile_headers(commonengine REUSE_FROM pch)
|
target_precompile_headers(commonengine REUSE_FROM pch)
|
||||||
|
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
#include"engine.h"
|
#include"mages/mages.h"
|
||||||
|
|
||||||
namespace mages{
|
namespace mages{
|
||||||
|
|
||||||
regs reg=regs::invalid;
|
std::map<WORD, std::wstring> createTable(int _idx) {
|
||||||
int gametype=0;
|
|
||||||
std::map<WORD, std::wstring> createTable() {
|
|
||||||
|
|
||||||
auto compound_charsA=LoadResData(std::vector<const wchar_t*>{
|
auto compound_charsA=LoadResData(std::vector<const wchar_t*>{
|
||||||
L"compound_chars_default",
|
L"compound_chars_default",
|
||||||
L"compound_chars_Robotics_Notes_Elite",
|
L"compound_chars_Robotics_Notes_Elite",
|
||||||
L"compound_chars_Robotics_Notes_Dash"
|
L"compound_chars_Robotics_Notes_Dash"
|
||||||
}[gametype],L"COMPOUND_CHARS");
|
}[_idx],L"COMPOUND_CHARS");
|
||||||
auto charsetA=LoadResData(std::vector<const wchar_t*>{
|
auto charsetA=LoadResData(std::vector<const wchar_t*>{
|
||||||
L"charset_default",
|
L"charset_default",
|
||||||
L"charset_Robotics_Notes_Elite",
|
L"charset_Robotics_Notes_Elite",
|
||||||
L"charset_Robotics_Notes_Dash"
|
L"charset_Robotics_Notes_Dash"
|
||||||
}[gametype],L"CHARSET");
|
}[_idx],L"CHARSET");
|
||||||
|
|
||||||
|
|
||||||
auto compound_chars=StringToWideString(compound_charsA);
|
auto compound_chars=StringToWideString(compound_charsA);
|
||||||
@ -48,8 +47,8 @@ namespace mages{
|
|||||||
return table;
|
return table;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring mages_decode(WORD charCode) {
|
std::wstring mages_decode(WORD charCode,int _idx) {
|
||||||
static auto table = createTable();
|
static auto table = createTable(_idx);
|
||||||
if (table.find(charCode) == table.end()) {
|
if (table.find(charCode) == table.end()) {
|
||||||
std::wstringstream _;
|
std::wstringstream _;
|
||||||
_ << std::hex << charCode;
|
_ << std::hex << charCode;
|
||||||
@ -59,10 +58,8 @@ std::wstring mages_decode(WORD charCode) {
|
|||||||
return table[charCode];
|
return table[charCode];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
template<int filter>
|
std::wstring readString(uintptr_t address,int _idx) {
|
||||||
void SpecialHookMAGES(hook_stack* stack, HookParam*, uintptr_t* data, uintptr_t* split, size_t* len)
|
auto edx=address;
|
||||||
{
|
|
||||||
auto edx = regof(reg,stack);//regof(edx, esp_base);
|
|
||||||
std::wstring s = L"", bottom = L"";
|
std::wstring s = L"", bottom = L"";
|
||||||
while (1) {
|
while (1) {
|
||||||
auto c = *(BYTE*)edx;
|
auto c = *(BYTE*)edx;
|
||||||
@ -74,7 +71,7 @@ void SpecialHookMAGES(hook_stack* stack, HookParam*, uintptr_t* data, uintptr_t*
|
|||||||
if (c >= 0x80) {// readChar
|
if (c >= 0x80) {// readChar
|
||||||
auto charCode = *(WORD*)edx;
|
auto charCode = *(WORD*)edx;
|
||||||
edx += 2;
|
edx += 2;
|
||||||
s += mages_decode(charCode);
|
s += mages_decode(charCode,_idx);
|
||||||
}
|
}
|
||||||
else {// readControl
|
else {// readControl
|
||||||
edx += 1;
|
edx += 1;
|
||||||
@ -93,7 +90,7 @@ void SpecialHookMAGES(hook_stack* stack, HookParam*, uintptr_t* data, uintptr_t*
|
|||||||
else {
|
else {
|
||||||
auto charCode = *(WORD*)edx;
|
auto charCode = *(WORD*)edx;
|
||||||
edx += 2;
|
edx += 2;
|
||||||
bottom += mages_decode(charCode);
|
bottom += mages_decode(charCode,_idx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(bottom.size()) s = s + bottom + L": ";
|
if(bottom.size()) s = s + bottom + L": ";
|
||||||
@ -164,7 +161,7 @@ void SpecialHookMAGES(hook_stack* stack, HookParam*, uintptr_t* data, uintptr_t*
|
|||||||
auto charCode = *(WORD*)edx;
|
auto charCode = *(WORD*)edx;
|
||||||
edx+=2;
|
edx+=2;
|
||||||
|
|
||||||
rubi += mages_decode(charCode);
|
rubi += mages_decode(charCode,_idx);
|
||||||
}
|
}
|
||||||
} // end while
|
} // end while
|
||||||
}
|
}
|
||||||
@ -179,7 +176,7 @@ void SpecialHookMAGES(hook_stack* stack, HookParam*, uintptr_t* data, uintptr_t*
|
|||||||
auto charCode = *(WORD*)edx;
|
auto charCode = *(WORD*)edx;
|
||||||
edx+=2;
|
edx+=2;
|
||||||
|
|
||||||
auto cc = mages_decode(charCode);
|
auto cc = mages_decode(charCode,_idx);
|
||||||
bottom += cc;
|
bottom += cc;
|
||||||
s += cc;
|
s += cc;
|
||||||
}
|
}
|
||||||
@ -193,20 +190,35 @@ void SpecialHookMAGES(hook_stack* stack, HookParam*, uintptr_t* data, uintptr_t*
|
|||||||
// do nothing (one byte control)
|
// do nothing (one byte control)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace hookmages{
|
||||||
|
|
||||||
|
regs reg=regs::invalid;
|
||||||
|
int gametype=0;
|
||||||
|
|
||||||
|
template<int filter>
|
||||||
|
void SpecialHookMAGES(hook_stack* stack, HookParam*, uintptr_t* data, uintptr_t* split, size_t* len)
|
||||||
|
{
|
||||||
|
auto edx = regof(reg,stack);//regof(edx, esp_base);
|
||||||
|
|
||||||
|
auto s=mages::readString(edx,gametype);
|
||||||
|
|
||||||
if(filter){
|
if(filter){
|
||||||
static std::wstring last=L"";
|
static std::wstring last=L"";
|
||||||
if(last==s)return;
|
if(last==s)return;
|
||||||
last=s;
|
last=s;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t* _data=new wchar_t[s.size()+1];
|
write_string_new(data,len,s);
|
||||||
wcscpy(_data,s.c_str());
|
|
||||||
*data=(uintptr_t)_data;
|
|
||||||
*len=s.size()*2;
|
|
||||||
}
|
}
|
||||||
#ifndef _WIN64
|
|
||||||
bool MAGES() {
|
bool MAGES() {
|
||||||
|
#ifndef _WIN64
|
||||||
auto dialogSigOffset = 2;
|
auto dialogSigOffset = 2;
|
||||||
BYTE dialogSig1 []={
|
BYTE dialogSig1 []={
|
||||||
0x85,XX,0x74,XX,0x83,XX,0x01,0x74,XX,0x83,XX,0x04,0x74,XX,0xc7,0x05,XX,XX,XX,XX,0x01,0x00,0x00,0x00
|
0x85,XX,0x74,XX,0x83,XX,0x01,0x74,XX,0x83,XX,0x04,0x74,XX,0xc7,0x05,XX,XX,XX,XX,0x01,0x00,0x00,0x00
|
||||||
@ -287,11 +299,9 @@ bool MAGES() {
|
|||||||
hp.text_fun = SpecialHookMAGES<1>;
|
hp.text_fun = SpecialHookMAGES<1>;
|
||||||
_|=NewHook(hp, "5pb_MAGES");
|
_|=NewHook(hp, "5pb_MAGES");
|
||||||
return _;
|
return _;
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
bool MAGES() {
|
|
||||||
auto dialogSigOffset = 2;
|
auto dialogSigOffset = 2;
|
||||||
BYTE dialogSig1 []={
|
BYTE dialogSig1 []={
|
||||||
0x85,XX,0x74,XX,0x41,0x83,XX,0x01,0x74,XX,0x41,0x83,XX,0x04,0x74,XX,0x41
|
0x85,XX,0x74,XX,0x41,0x83,XX,0x01,0x74,XX,0x41,0x83,XX,0x04,0x74,XX,0x41
|
||||||
@ -326,9 +336,10 @@ bool MAGES() {
|
|||||||
hp.text_fun = SpecialHookMAGES<0>;
|
hp.text_fun = SpecialHookMAGES<0>;
|
||||||
hp.type = CODEC_UTF16 | USING_STRING|NO_CONTEXT;
|
hp.type = CODEC_UTF16 | USING_STRING|NO_CONTEXT;
|
||||||
return NewHook(hp, "5pb_MAGES");
|
return NewHook(hp, "5pb_MAGES");
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
8
LunaHook/engines/mages/mages.h
Normal file
8
LunaHook/engines/mages/mages.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#include"engine.h"
|
||||||
|
namespace mages{
|
||||||
|
|
||||||
|
std::wstring readString(uintptr_t address,int _idx) ;
|
||||||
|
}
|
||||||
|
namespace hookmages{
|
||||||
|
bool MAGES();
|
||||||
|
}
|
@ -578,4 +578,30 @@ bool Engine::isAddressWritable(const char *p, size_t count)
|
|||||||
{ return p && count && !::IsBadWritePtr((LPVOID)p, sizeof(*p) * count); }
|
{ return p && count && !::IsBadWritePtr((LPVOID)p, sizeof(*p) * count); }
|
||||||
|
|
||||||
bool Engine::isAddressWritable(const wchar_t *p, size_t count)
|
bool Engine::isAddressWritable(const wchar_t *p, size_t count)
|
||||||
{ return p && count && !::IsBadWritePtr((LPVOID)p, sizeof(*p) * count); }
|
{ return p && count && !::IsBadWritePtr((LPVOID)p, sizeof(*p) * count); }
|
||||||
|
|
||||||
|
|
||||||
|
namespace{
|
||||||
|
|
||||||
|
wchar_t *Xstrcpy(wchar_t *s, const wchar_t *r){return wcscpy(s,r);}
|
||||||
|
char *Xstrcpy(char *s, const char *r){return strcpy(s,r);}
|
||||||
|
template<class CharT>
|
||||||
|
void write_string_new_impl(uintptr_t* data, size_t* len,const std::basic_string<CharT>& s){
|
||||||
|
CharT* _data=new CharT[s.size()+1];
|
||||||
|
Xstrcpy(_data,s.c_str());
|
||||||
|
*data=(uintptr_t)_data;
|
||||||
|
if(len)
|
||||||
|
*len=s.size()*sizeof(CharT);
|
||||||
|
}
|
||||||
|
template<class CharT>
|
||||||
|
bool write_string_overwrite_impl(void* data, size_t* len,const std::basic_string<CharT>& s){
|
||||||
|
Xstrcpy((CharT*)data,s.c_str());
|
||||||
|
*len=s.size()*sizeof(CharT);
|
||||||
|
return s.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void write_string_new(uintptr_t* data, size_t* len,const std::wstring& s){write_string_new_impl<wchar_t>(data,len,s);}
|
||||||
|
void write_string_new(uintptr_t* data, size_t* len,const std::string& s){write_string_new_impl<char>(data,len,s);}
|
||||||
|
|
||||||
|
bool write_string_overwrite(void* data, size_t* len,const std::wstring& s){return write_string_overwrite_impl<wchar_t>(data,len,s);}
|
||||||
|
bool write_string_overwrite(void* data, size_t* len,const std::string& s){return write_string_overwrite_impl<char>(data,len,s);}
|
@ -77,3 +77,7 @@ inline bool isAddressWritable(const void *addr) { return isAddressWritable((cons
|
|||||||
inline bool isAddressWritable(uintptr_t addr) { return isAddressWritable((const void *)addr); }
|
inline bool isAddressWritable(uintptr_t addr) { return isAddressWritable((const void *)addr); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void write_string_new(uintptr_t* data, size_t* len,const std::wstring& s);
|
||||||
|
void write_string_new(uintptr_t* data, size_t* len,const std::string& s);
|
||||||
|
bool write_string_overwrite(void* data, size_t* len,const std::wstring& s);
|
||||||
|
bool write_string_overwrite(void* data, size_t* len,const std::string& s);
|
Loading…
x
Reference in New Issue
Block a user