This commit is contained in:
恍兮惚兮 2024-04-01 16:42:31 +08:00
parent cf342364fc
commit 505de799dd
2 changed files with 47 additions and 34 deletions

View File

@ -101,7 +101,7 @@ struct GameInfo {
bool checkiscurrentgame(const emfuncinfo& em){ bool checkiscurrentgame(const emfuncinfo& em){
auto wininfos=get_proc_windows(); auto wininfos=get_proc_windows();
for(auto&& info:wininfos){ for(auto&& info:wininfos){
if(info.title.find(acastw(game_info.version))!=info.title.npos){ if((game_info.version.size())&&(info.title.find(acastw(game_info.version))!=info.title.npos)&&(game_info.id!=0)){
//判断是有效的info //判断是有效的info
auto checkversion=(std::wstring(em._version)==acastw(game_info.version)); auto checkversion=(std::wstring(em._version)==acastw(game_info.version));
auto checkid=(std::stoll(em._id,0,16)==game_info.id); auto checkid=(std::stoll(em._id,0,16)==game_info.id);
@ -454,6 +454,20 @@ bool F0100982015606000(void* data, size_t* len, HookParam* hp){
return write_string_overwrite(data,len,s); return write_string_overwrite(data,len,s);
} }
bool F010001D015260000(void* data, size_t* len, HookParam* hp){
auto s=std::string((char*)data,*len);
if(startWith(s,"#Key"))return false;
strReplace(s,"#n","\n");
return write_string_overwrite(data,len,s);
}
bool F0100AEC013DDA000(void* data, size_t* len, HookParam* hp){
auto s=std::string((char*)data,*len);
static std::string ss;
if(ss==s)return false;
ss=s;
return true;
}
bool F0100925014864000(void* data, size_t* len, HookParam* hp){ bool F0100925014864000(void* data, size_t* len, HookParam* hp){
auto s=std::string((char*)data,*len); auto s=std::string((char*)data,*len);
@ -538,6 +552,9 @@ auto _=[](){
{0x81c9ae60 - 0x80004000,{"Hamefura Pirates",CODEC_UTF16,0,0,T0100982015606000,F0100982015606000,L"0100982015606000",L"1.0.0"}},// Hamekai.ChoicesText$$SetText {0x81c9ae60 - 0x80004000,{"Hamefura Pirates",CODEC_UTF16,0,0,T0100982015606000,F0100982015606000,L"0100982015606000",L"1.0.0"}},// Hamekai.ChoicesText$$SetText
{0x81eb7dc0 - 0x80004000,{"Hamefura Pirates",CODEC_UTF16,0,0,T0100982015606000,F0100982015606000,L"0100982015606000",L"1.0.0"}},// Hamekai.ShortStoryTextView$$AddText {0x81eb7dc0 - 0x80004000,{"Hamefura Pirates",CODEC_UTF16,0,0,T0100982015606000,F0100982015606000,L"0100982015606000",L"1.0.0"}},// Hamekai.ShortStoryTextView$$AddText
{0x80225C3C - 0x80004000,{"Death end re;Quest 2",CODEC_UTF8,8,0,0,F010001D015260000,L"010001D015260000",L"1.0.0"}},
{0x80241088 - 0x80004000,{"Death end re;Quest",CODEC_UTF8,8,0,0,F0100AEC013DDA000,L"0100AEC013DDA000",L"1.0.0"}},//english ver
}; };
return 1; return 1;
}(); }();

View File

@ -4,6 +4,7 @@ namespace
{ {
std::optional<HookParam> ParseRCode(std::wstring RCode) std::optional<HookParam> ParseRCode(std::wstring RCode)
{ {
RCode.erase(0,1);
std::wsmatch match; std::wsmatch match;
HookParam hp; HookParam hp;
hp.type |= DIRECT_READ; hp.type |= DIRECT_READ;
@ -40,16 +41,28 @@ namespace
return hp; return hp;
} }
std::optional<HookParam> ParseHCode(std::wstring HCode) std::optional<HookParam> ParseHCode(std::wstring HCode,std::optional<HookParam> hpo={})
{ {
std::wsmatch match; auto hp=hpo?hpo.value():HookParam{};
HookParam hp;
if(endWith(HCode,L":JIT:YUZU")){ switch (HCode[0])
{
case L'B':
hp.type|=BREAK_POINT;
case L'H':
break;
default:
return {};
}
HCode.erase(0,1);
if(endWith(HCode,L":JIT:YUZU"))
hp.jittype=JITTYPE::YUZU; hp.jittype=JITTYPE::YUZU;
} else if(endWith(HCode,L":JIT:PPSSPP"))
else if(endWith(HCode,L":JIT:PPSSPP")){
hp.jittype=JITTYPE::PPSSPP; hp.jittype=JITTYPE::PPSSPP;
}
// {A|B|W|H|S|Q|V|M} // {A|B|W|H|S|Q|V|M}
switch (HCode[0]) switch (HCode[0])
{ {
@ -98,7 +111,8 @@ namespace
hp.type |= NO_CONTEXT; hp.type |= NO_CONTEXT;
HCode.erase(0, 1); HCode.erase(0, 1);
} }
std::wsmatch match;
// [codepage#] // [codepage#]
if (std::regex_search(HCode, match, std::wregex(L"^([0-9]+)#"))) if (std::regex_search(HCode, match, std::wregex(L"^([0-9]+)#")))
{ {
@ -183,18 +197,8 @@ namespace
std::optional<HookParam> ParseECode(std::wstring code) std::optional<HookParam> ParseECode(std::wstring code)
{ {
auto idx=code.find(L'H'); code.erase(0,1);
if(idx==code.npos) HookParam hp;
{
idx=code.find(L'B');
if(idx==code.npos)
return {};
}
auto hpo=ParseHCode(code.substr(idx+1));
code=code.substr(0,idx);
if(hpo.has_value()==false)return {};
auto hp=hpo.value();
hp.type|=EMBED_ABLE; hp.type|=EMBED_ABLE;
if(code[0]==L'D') if(code[0]==L'D')
@ -215,8 +219,8 @@ namespace
return {}; return {};
code.erase(0,1); code.erase(0,1);
} }
if(code.size())return {};
return hp; return ParseHCode(code,hp);
} }
std::wstring HexString(int64_t num) std::wstring HexString(int64_t num)
@ -363,17 +367,9 @@ namespace HookCode
if (code[0] == L'/') code.erase(0, 1); if (code[0] == L'/') code.erase(0, 1);
code.erase(std::find(code.begin(), code.end(), L'/'), code.end()); // legacy/AGTH compatibility code.erase(std::find(code.begin(), code.end(), L'/'), code.end()); // legacy/AGTH compatibility
Trim(code); Trim(code);
if (code[0] == L'R') return ParseRCode(code.erase(0, 1)); if (code[0] == L'R') return ParseRCode(code);
else if (code[0] == L'B'||code[0] == L'H'){ else if (code[0] == L'E') return ParseECode(code);
auto isbreakpoint=code[0] == L'B'; else return ParseHCode(code);
auto hpo=ParseHCode(code.erase(0, 1));
if(isbreakpoint && hpo.has_value()){
hpo.value().type|=BREAK_POINT;
}
return hpo;
}
else if (code[0] == L'E') return ParseECode(code.erase(0, 1));
return {};
} }
std::wstring Generate(HookParam hp, DWORD processId) std::wstring Generate(HookParam hp, DWORD processId)