mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-14 08:23:55 +08:00
some
This commit is contained in:
parent
d7923b5446
commit
43d2e5fb2e
@ -1,10 +1,10 @@
|
||||
include_directories(. util engines)
|
||||
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||
set(enginessrc MKXPZ Ryujinx livecaptions Kincaid vita3k rpcs3 yuzu TYPEMOON UnrealEngine AGES7 mono Godot 5pb lucasystem LightVN V8 pchooks Artemis KiriKiri YOX PPSSPP CMVS Suika2 )
|
||||
set(enginessrc MKXPZ Ryujinx livecaptions Kincaid vita3k rpcs3 yuzu TYPEMOON UnrealEngine AGES7 mono Godot 5pb lucasystem LightVN V8 Artemis KiriKiri YOX PPSSPP CMVS Suika2 )
|
||||
set(enginepath "engine64")
|
||||
set(collector "enginecollection64.cpp")
|
||||
else()
|
||||
set(enginessrc Winters Cage AGE_System AksysGames RPGMaker Stronger TACTICS Onscripter Sceplay DISCOVERY Erogos godot A98SYS GuruGuruSMF4 TeethingRing Fizz CoffeeMaker VALKYRIA mirage CisLugI tamasoft FrontWing solfasys Diskdream splushwave ransel akatombo GASTRO GSX Aksys ScrPlayer SYSD KISS IGScript Jellyfish BKEngine Overflow SRPGStudio Suika2 FVP LCScript Ohgetsu RPGMakerRGSS3 ONScripterru OVERDRIVE HXP Palette Purple Ruf RUNE Tarte Tomato Sakuradog Troy VitaminSoft UnknownEngine TSSystem Xbangbang Anisetta Nijyuei Interheart LovaGame Giga Jisatu101 EntisGLS Ciel ACTGS TerraLunar PPSSPP jukujojidai PCSX2 VanillawareGC cef V8 mono pchooks PONScripter Bishop sakanagl Lightvn KiriKiri SideB BGI Bootup morning shyakunage Regista NNNConfig Eushully Majiro littlecheese Elf Silkys CMVS Wolf Circus1 Circus2 Cotopha Artemis CatSystem Atelier Tenco QLIE Pal AIL2 NeXAS LunaSoft Unicorn Rejet Interlude AdobeAir Retouch Malie Live Nexton Lucifen Waffle TinkerBell SystemAoi Yuris Nitroplus2 Bruns EME RRE Candy Speed ApricoT Triangle AB2Try MBLMED GameMaker DxLib CodeX Minori Sprite RpgmXP Eagls Debonosu C4 WillPlus Tanuki GXP AOS Mink YukaSystem2 sakusesu Exp Syuntada Pensil Anim hibiki Nitroplus Reallive Siglus Taskforce2 RUGP IronGameSystem Anex86 ShinyDaysGame MarineHeart ShinaRio CaramelBox UnisonShift Escude Ryokucha Alice Footy2 utawarerumono System4x Abalone Abel 5pb HorkEye XUSE Leaf Nekopack AXL AGS AdobeFlash10 FocasLens Tamamo Ages3ResT)
|
||||
set(enginessrc Winters Cage AGE_System AksysGames RPGMaker Stronger TACTICS Onscripter Sceplay DISCOVERY Erogos godot A98SYS GuruGuruSMF4 TeethingRing Fizz CoffeeMaker VALKYRIA mirage CisLugI tamasoft FrontWing solfasys Diskdream splushwave ransel akatombo GASTRO GSX Aksys ScrPlayer SYSD KISS IGScript Jellyfish BKEngine Overflow SRPGStudio Suika2 FVP LCScript Ohgetsu RPGMakerRGSS3 ONScripterru OVERDRIVE HXP Palette Purple Ruf RUNE Tarte Tomato Sakuradog Troy VitaminSoft UnknownEngine TSSystem Xbangbang Anisetta Nijyuei Interheart LovaGame Giga Jisatu101 EntisGLS Ciel ACTGS TerraLunar PPSSPP jukujojidai PCSX2 VanillawareGC cef V8 mono PONScripter Bishop sakanagl Lightvn KiriKiri SideB BGI Bootup morning shyakunage Regista NNNConfig Eushully Majiro littlecheese Elf Silkys CMVS Wolf Circus1 Circus2 Cotopha Artemis CatSystem Atelier Tenco QLIE Pal AIL2 NeXAS LunaSoft Unicorn Rejet Interlude AdobeAir Retouch Malie Live Nexton Lucifen Waffle TinkerBell SystemAoi Yuris Nitroplus2 Bruns EME RRE Candy Speed ApricoT Triangle AB2Try MBLMED GameMaker DxLib CodeX Minori Sprite RpgmXP Eagls Debonosu C4 WillPlus Tanuki GXP AOS Mink YukaSystem2 sakusesu Exp Syuntada Pensil Anim hibiki Nitroplus Reallive Siglus Taskforce2 RUGP IronGameSystem Anex86 ShinyDaysGame MarineHeart ShinaRio CaramelBox UnisonShift Escude Ryokucha Alice Footy2 utawarerumono System4x Abalone Abel 5pb HorkEye XUSE Leaf Nekopack AXL AGS AdobeFlash10 FocasLens Tamamo Ages3ResT)
|
||||
set(enginepath "engine32")
|
||||
set(collector "enginecollection32.cpp")
|
||||
endif()
|
||||
|
@ -5,6 +5,7 @@ public:
|
||||
{
|
||||
ConsoleOutput("IGNORE %s", getenginename());
|
||||
// ConsoleOutput("IGNORE engine");
|
||||
PcHooks::hooknormalfunctions();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -9,7 +9,6 @@ class ENGINE
|
||||
{
|
||||
public:
|
||||
const char *enginename;
|
||||
bool dontstop; // dont stop even if attached a engine
|
||||
bool is_engine_certain; // stop when match a engine ,even if not attached
|
||||
|
||||
enum class CHECK_BY
|
||||
@ -37,7 +36,7 @@ public:
|
||||
return enginename;
|
||||
return typeid(*this).name() + 6;
|
||||
}
|
||||
ENGINE() : enginename(nullptr), dontstop(false), is_engine_certain(true), check_by(CHECK_BY::ALL_TRUE){};
|
||||
ENGINE() : enginename(nullptr), is_engine_certain(true), check_by(CHECK_BY::ALL_TRUE){};
|
||||
bool check_function();
|
||||
};
|
||||
|
||||
|
@ -1,24 +1,27 @@
|
||||
#include"CaramelBox.h"
|
||||
|
||||
#include "CaramelBox.h"
|
||||
|
||||
static void SpecialHookCaramelBox(hook_stack *stack, HookParam *hp, TextBuffer *buffer, uintptr_t *split)
|
||||
{
|
||||
DWORD reg_ecx = *(DWORD*)(stack->base + hp->offset);
|
||||
DWORD reg_ecx = *(DWORD *)(stack->base + hp->offset);
|
||||
BYTE *ptr = (BYTE *)reg_ecx;
|
||||
buffer_index = 0;
|
||||
while (ptr[0])
|
||||
if (ptr[0] == 0x28) { // Furigana format: (Kanji,Furi)
|
||||
if (ptr[0] == 0x28)
|
||||
{ // Furigana format: (Kanji,Furi)
|
||||
ptr++;
|
||||
while (ptr[0]!=0x2c) //Copy Kanji
|
||||
while (ptr[0] != 0x2c) // Copy Kanji
|
||||
text_buffer[buffer_index++] = *ptr++;
|
||||
while (ptr[0]!=0x29) // Skip Furi
|
||||
while (ptr[0] != 0x29) // Skip Furi
|
||||
ptr++;
|
||||
ptr++;
|
||||
} else if (ptr[0] == 0x5c)
|
||||
ptr +=2;
|
||||
else {
|
||||
}
|
||||
else if (ptr[0] == 0x5c)
|
||||
ptr += 2;
|
||||
else
|
||||
{
|
||||
text_buffer[buffer_index++] = ptr[0];
|
||||
if (LeadByteTable[ptr[0]] == 2) {
|
||||
if (LeadByteTable[ptr[0]] == 2)
|
||||
{
|
||||
ptr++;
|
||||
text_buffer[buffer_index++] = ptr[0];
|
||||
}
|
||||
@ -30,9 +33,16 @@ static void SpecialHookCaramelBox(hook_stack *stack, HookParam *hp, TextBuffer *
|
||||
// jichi 10/1/2013: Change return type to bool
|
||||
bool InsertCaramelBoxHook()
|
||||
{
|
||||
union { DWORD i; BYTE* pb; WORD* pw; DWORD *pd; };
|
||||
union
|
||||
{
|
||||
DWORD i;
|
||||
BYTE *pb;
|
||||
WORD *pw;
|
||||
DWORD *pd;
|
||||
};
|
||||
DWORD reg = -1;
|
||||
for (i = processStartAddress + 0x1000; i < processStopAddress - 4; i++) {
|
||||
for (i = processStartAddress + 0x1000; i < processStopAddress - 4; i++)
|
||||
{
|
||||
if (*pd == 0x7ff3d) // cmp eax, 7ff
|
||||
reg = 0;
|
||||
else if ((*pd & 0xfffff8fc) == 0x07fff880) // cmp reg, 7ff
|
||||
@ -42,43 +52,55 @@ bool InsertCaramelBoxHook()
|
||||
continue;
|
||||
|
||||
DWORD flag = 0;
|
||||
if (*(pb - 6) == 3) { //add reg, [ebp+$disp_32]
|
||||
if (*(pb - 6) == 3)
|
||||
{ // add reg, [ebp+$disp_32]
|
||||
if (*(pb - 5) == (0x85 | (reg << 3)))
|
||||
flag = 1;
|
||||
} else if (*(pb - 3) == 3) { // add reg, [ebp+$disp_8]
|
||||
}
|
||||
else if (*(pb - 3) == 3)
|
||||
{ // add reg, [ebp+$disp_8]
|
||||
if (*(pb - 2) == (0x45 | (reg << 3)))
|
||||
flag = 1;
|
||||
} else if (*(pb - 2) == 3) { // add reg, reg
|
||||
if (((*(pb - 1) >> 3) & 7)== reg)
|
||||
}
|
||||
else if (*(pb - 2) == 3)
|
||||
{ // add reg, reg
|
||||
if (((*(pb - 1) >> 3) & 7) == reg)
|
||||
flag = 1;
|
||||
}
|
||||
reg = -1;
|
||||
if (flag) {
|
||||
for (DWORD j = i, k = i - 0x100; j > k; j--) {
|
||||
if ((*(DWORD *)j & 0xffff00ff) == 0x1000b8) { // mov eax,10??
|
||||
if (flag)
|
||||
{
|
||||
for (DWORD j = i, k = i - 0x100; j > k; j--)
|
||||
{
|
||||
if ((*(DWORD *)j & 0xffff00ff) == 0x1000b8)
|
||||
{ // mov eax,10??
|
||||
HookParam hp;
|
||||
hp.address = j & ~0xf;
|
||||
hp.text_fun = SpecialHookCaramelBox;
|
||||
hp.type = USING_STRING;
|
||||
for (i &= ~0xffff; i < processStopAddress - 4; i++)
|
||||
if (pb[0] == 0xe8) {
|
||||
if (pb[0] == 0xe8)
|
||||
{
|
||||
pb++;
|
||||
if (pd[0] + i + 4 == hp.address) {
|
||||
if (pd[0] + i + 4 == hp.address)
|
||||
{
|
||||
pb += 4;
|
||||
if ((pd[0] & 0xffffff) == 0x04c483)
|
||||
hp.offset=get_stack(1);
|
||||
else hp.offset=get_reg(regs::ecx);
|
||||
hp.offset = get_stack(1);
|
||||
else
|
||||
hp.offset = get_reg(regs::ecx);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hp.offset == 0) {
|
||||
if (hp.offset == 0)
|
||||
{
|
||||
ConsoleOutput("CaramelBox: failed, zero off");
|
||||
return false;
|
||||
}
|
||||
ConsoleOutput("INSERT CaramelBox");
|
||||
|
||||
//RegisterEngineType(ENGINE_CARAMEL);
|
||||
|
||||
// RegisterEngineType(ENGINE_CARAMEL);
|
||||
return NewHook(hp, "CaramelBox");
|
||||
}
|
||||
}
|
||||
@ -86,54 +108,59 @@ bool InsertCaramelBoxHook()
|
||||
}
|
||||
ConsoleOutput("CaramelBox: failed");
|
||||
return false;
|
||||
//_unknown_engine:
|
||||
//ConsoleOutput("Unknown CarmelBox engine.");
|
||||
//_unknown_engine:
|
||||
// ConsoleOutput("Unknown CarmelBox engine.");
|
||||
}
|
||||
|
||||
|
||||
bool CaramelBox::attach_function() {
|
||||
|
||||
return InsertCaramelBoxHook();
|
||||
}
|
||||
bool CaramelBox::attach_function()
|
||||
{
|
||||
|
||||
return InsertCaramelBoxHook();
|
||||
}
|
||||
|
||||
|
||||
bool CaramelBoxMilkAji::attach_function(){
|
||||
//雨芳恋歌
|
||||
//https://vndb.org/v6663
|
||||
bool CaramelBoxMilkAji::attach_function()
|
||||
{
|
||||
// 雨芳恋歌
|
||||
// https://vndb.org/v6663
|
||||
BYTE bytes[] = {
|
||||
0x33,0xD2,
|
||||
0xB9,0x8A,0x02,0x00,0x00,
|
||||
0xF7,0xF1,
|
||||
0x6B,0xC0,0x44,
|
||||
0x6B,0xC0,0x03
|
||||
};
|
||||
auto addr=MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
|
||||
if(addr==0)return false;
|
||||
addr=MemDbg::findEnclosingAlignedFunction(addr);
|
||||
if(addr==0)return false;
|
||||
0x33, 0xD2,
|
||||
0xB9, 0x8A, 0x02, 0x00, 0x00,
|
||||
0xF7, 0xF1,
|
||||
0x6B, 0xC0, 0x44,
|
||||
0x6B, 0xC0, 0x03};
|
||||
auto addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
|
||||
if (addr == 0)
|
||||
return false;
|
||||
addr = MemDbg::findEnclosingAlignedFunction(addr);
|
||||
if (addr == 0)
|
||||
return false;
|
||||
HookParam hp;
|
||||
hp.address = addr;
|
||||
hp.type = USING_STRING;
|
||||
hp.offset=get_stack(1);
|
||||
|
||||
return NewHook(hp, "CaramelBox");
|
||||
hp.address = addr;
|
||||
hp.type = USING_STRING;
|
||||
hp.offset = get_stack(1);
|
||||
|
||||
return NewHook(hp, "CaramelBox");
|
||||
}
|
||||
bool CaramelBox2::attach_function(){
|
||||
//https://vndb.org/r19777
|
||||
//Otoboku - Maidens Are Falling for Me! - Download Edition
|
||||
trigger_fun=[](LPVOID addr1, hook_stack* stack){
|
||||
if(addr1!=TextOutA&& addr1!=GetTextExtentPoint32A)return false;
|
||||
auto addr=stack->retaddr;
|
||||
bool CaramelBox2::attach_function()
|
||||
{
|
||||
// https://vndb.org/r19777
|
||||
// Otoboku - Maidens Are Falling for Me! - Download Edition
|
||||
PcHooks::hookGDIFunctions();
|
||||
trigger_fun = [](LPVOID addr1, hook_stack *stack)
|
||||
{
|
||||
if (addr1 != TextOutA && addr1 != GetTextExtentPoint32A)
|
||||
return false;
|
||||
auto addr = stack->retaddr;
|
||||
addr = MemDbg::findEnclosingAlignedFunction(addr);
|
||||
if (addr == 0)return false;
|
||||
if (addr == 0)
|
||||
return false;
|
||||
HookParam hp;
|
||||
hp.address = addr;
|
||||
hp.type = USING_STRING|USING_SPLIT;
|
||||
hp.offset=get_stack(2);
|
||||
hp.split=get_stack(2);
|
||||
hp.address = addr;
|
||||
hp.type = USING_STRING | USING_SPLIT;
|
||||
hp.offset = get_stack(2);
|
||||
hp.split = get_stack(2);
|
||||
NewHook(hp, "CaramelBox");
|
||||
return true;
|
||||
};
|
||||
return true;
|
||||
return true;
|
||||
}
|
@ -43,6 +43,7 @@ namespace
|
||||
// https://vndb.org/v6187
|
||||
// みちくさ~Loitering on the way~
|
||||
|
||||
PcHooks::hookGDIFunctions();
|
||||
trigger_fun = [](LPVOID addr, hook_stack *stack)
|
||||
{
|
||||
if (addr != (LPVOID)GetGlyphOutlineA)
|
||||
|
@ -1,27 +1,29 @@
|
||||
#include"Footy2.h"
|
||||
bool insertstrcpyhook() {
|
||||
#include "Footy2.h"
|
||||
bool insertstrcpyhook()
|
||||
{
|
||||
const BYTE bytes[] = {
|
||||
0x3B,0xD8,0x72,0x45,0x83,0xF9,0x10,0x72,0x04,0x8B,0x16,0xEB,0x02
|
||||
};
|
||||
0x3B, 0xD8, 0x72, 0x45, 0x83, 0xF9, 0x10, 0x72, 0x04, 0x8B, 0x16, 0xEB, 0x02};
|
||||
auto addrs = Util::SearchMemory(bytes, sizeof(bytes), PAGE_EXECUTE, processStartAddress, processStopAddress);
|
||||
const BYTE funcstart[] = {
|
||||
0x55,0x8b,0xec,0x53,0x8b,0x5d,0x08
|
||||
};
|
||||
bool succ=false;
|
||||
for (auto addr : addrs) {
|
||||
0x55, 0x8b, 0xec, 0x53, 0x8b, 0x5d, 0x08};
|
||||
bool succ = false;
|
||||
for (auto addr : addrs)
|
||||
{
|
||||
addr = reverseFindBytes(funcstart, sizeof(funcstart), addr - 0x100, addr);
|
||||
if (addr == 0)continue;
|
||||
if (addr == 0)
|
||||
continue;
|
||||
HookParam hp;
|
||||
hp.address = addr;
|
||||
hp.offset=get_stack(1);
|
||||
hp.offset = get_stack(1);
|
||||
hp.type = USING_STRING;
|
||||
ConsoleOutput("strcpy %p", addr);
|
||||
succ|=NewHook(hp, "strcpy");
|
||||
succ |= NewHook(hp, "strcpy");
|
||||
}
|
||||
return succ;
|
||||
return false;
|
||||
}
|
||||
bool Footy2::attach_function() {
|
||||
//ガールズ・ブック・メイカー -幸せのリブレット-
|
||||
bool Footy2::attach_function()
|
||||
{
|
||||
// ガールズ・ブック・メイカー -幸せのリブレット-
|
||||
|
||||
return insertstrcpyhook();
|
||||
}
|
||||
return insertstrcpyhook();
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
|
||||
|
||||
class Footy2:public ENGINE{
|
||||
public:
|
||||
Footy2(){
|
||||
|
||||
check_by=CHECK_BY::FILE;
|
||||
check_by_target=L"Footy2.dll";
|
||||
dontstop=true;
|
||||
class Footy2 : public ENGINE
|
||||
{
|
||||
public:
|
||||
Footy2()
|
||||
{
|
||||
is_engine_certain = false;
|
||||
check_by = CHECK_BY::FILE;
|
||||
check_by_target = L"Footy2.dll";
|
||||
};
|
||||
bool attach_function();
|
||||
bool attach_function();
|
||||
};
|
@ -2,6 +2,8 @@
|
||||
|
||||
bool GuruGuruSMF4::attach_function()
|
||||
{
|
||||
|
||||
PcHooks::hookGDIFunctions();
|
||||
// 奈落の森の花
|
||||
trigger_fun = [](LPVOID addr1, hook_stack *stack)
|
||||
{
|
||||
|
@ -1,41 +1,42 @@
|
||||
#include"IronGameSystem.h"
|
||||
#include "IronGameSystem.h"
|
||||
|
||||
|
||||
bool InsertIGSDynamicHook(LPVOID addr, hook_stack* stack)
|
||||
bool InsertIGSDynamicHook(LPVOID addr, hook_stack *stack)
|
||||
{
|
||||
if (addr != GetGlyphOutlineW)
|
||||
return false;
|
||||
DWORD i;
|
||||
i = *(DWORD *)stack->ebp;
|
||||
i = *(DWORD *)(i+4);
|
||||
//if (SafeFillRange(L"mscorlib.ni.dll", &j, &k)) { // Artikash 6/30/2018: Dunno why addresses are needed
|
||||
while (*(BYTE *)i != 0xe8)
|
||||
i++;
|
||||
DWORD t = *(DWORD *)(i + 1) + i + 5;
|
||||
//if (t>j && t<k) {
|
||||
HookParam hp;
|
||||
hp.address = t;
|
||||
hp.offset=get_reg(regs::edx);
|
||||
hp.split = get_reg(regs::esp);
|
||||
hp.type = CODEC_UTF16|USING_SPLIT;
|
||||
ConsoleOutput("INSERT IronGameSystem");
|
||||
|
||||
//ConsoleOutput("IGS - Please set text(ヂ<>ス<EFBFBD> display speed(表示速度) to fastest(瞬<>");
|
||||
//RegisterEngineType(ENGINE_IGS);
|
||||
return NewHook(hp, "IronGameSystem");
|
||||
//}
|
||||
i = *(DWORD *)(i + 4);
|
||||
// if (SafeFillRange(L"mscorlib.ni.dll", &j, &k)) { // Artikash 6/30/2018: Dunno why addresses are needed
|
||||
while (*(BYTE *)i != 0xe8)
|
||||
i++;
|
||||
DWORD t = *(DWORD *)(i + 1) + i + 5;
|
||||
// if (t>j && t<k) {
|
||||
HookParam hp;
|
||||
hp.address = t;
|
||||
hp.offset = get_reg(regs::edx);
|
||||
hp.split = get_reg(regs::esp);
|
||||
hp.type = CODEC_UTF16 | USING_SPLIT;
|
||||
ConsoleOutput("INSERT IronGameSystem");
|
||||
|
||||
// ConsoleOutput("IGS - Please set text(ヂ<>ス<EFBFBD> display speed(表示速度) to fastest(瞬<>");
|
||||
// RegisterEngineType(ENGINE_IGS);
|
||||
return NewHook(hp, "IronGameSystem");
|
||||
//}
|
||||
//}
|
||||
ConsoleOutput("IGS: failed");
|
||||
return true; // jichi 12/25/2013: return true
|
||||
}
|
||||
void InsertIronGameSystemHook()
|
||||
{
|
||||
//ConsoleOutput("Probably IronGameSystem. Wait for text.");
|
||||
PcHooks::hookGDIFunctions();
|
||||
// ConsoleOutput("Probably IronGameSystem. Wait for text.");
|
||||
trigger_fun = InsertIGSDynamicHook;
|
||||
ConsoleOutput("TRIGGER IronGameSystem");
|
||||
}
|
||||
|
||||
bool IronGameSystem::attach_function() {
|
||||
InsertIronGameSystemHook();
|
||||
return true;
|
||||
}
|
||||
bool IronGameSystem::attach_function()
|
||||
{
|
||||
InsertIronGameSystemHook();
|
||||
return true;
|
||||
}
|
@ -1,7 +1,8 @@
|
||||
#include"LovaGame.h"
|
||||
|
||||
bool LovaGame::attach_function(){
|
||||
return false;
|
||||
#include "LovaGame.h"
|
||||
|
||||
bool LovaGame::attach_function()
|
||||
{
|
||||
return false;
|
||||
#if 0
|
||||
/** 7/19/2015: Game engine specific for http://lova.jp
|
||||
*
|
||||
@ -67,4 +68,4 @@
|
||||
ConsoleOutput("INSERT LOVA");
|
||||
return NewHook(hp, "LOVA");
|
||||
#endif
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
|
||||
class LovaGame:public ENGINE{
|
||||
public:
|
||||
LovaGame(){
|
||||
|
||||
check_by=CHECK_BY::FILE_ALL;
|
||||
check_by_target=check_by_list{L"UE3ShaderCompileWorker.exe",L"awesomium_process.exe"};
|
||||
dontstop=true;
|
||||
class LovaGame : public ENGINE
|
||||
{
|
||||
public:
|
||||
LovaGame()
|
||||
{
|
||||
|
||||
check_by = CHECK_BY::FILE_ALL;
|
||||
check_by_target = check_by_list{L"UE3ShaderCompileWorker.exe", L"awesomium_process.exe"};
|
||||
}
|
||||
bool attach_function();
|
||||
};
|
@ -614,7 +614,7 @@ namespace
|
||||
|
||||
auto arg = (HookArgument *)s->stack[0]; // arg1
|
||||
if (arg && arg->isValid())
|
||||
{ // && (quint8)arg->text[0] > 127) { // skip translate text beginning with ascii character
|
||||
{ // && (quint8)arg->text[0] > 127) { // skip translate text beginning with ascii character
|
||||
std::wstring oldText = StringToWideString(std::string_view(arg->text, arg->size), CP_UTF8).value(), // QString::fromUtf8(arg->text, arg->size),
|
||||
prefix,
|
||||
suffix,
|
||||
@ -663,7 +663,7 @@ namespace
|
||||
|
||||
auto arg = (HookArgument *)s->stack[0]; // arg1
|
||||
if (arg && arg->isValid())
|
||||
{ // && (quint8)arg->text[0] > 127) { // skip translate text beginning with ascii character
|
||||
{ // && (quint8)arg->text[0] > 127) { // skip translate text beginning with ascii character
|
||||
std::wstring oldText = StringToWideString(std::string_view(arg->text, arg->size), CP_UTF8).value(), // QString::fromUtf8(arg->text, arg->size),
|
||||
prefix,
|
||||
suffix,
|
||||
@ -774,7 +774,7 @@ namespace
|
||||
// }
|
||||
}
|
||||
}
|
||||
void hookafter2(hook_stack *s,TextBuffer buffer)
|
||||
void hookafter2(hook_stack *s, TextBuffer buffer)
|
||||
{
|
||||
{
|
||||
auto arg = (HookArgument *)s->stack[2]; // arg2
|
||||
@ -1420,6 +1420,7 @@ bool RPGMakerRGSS3::attach_function()
|
||||
}
|
||||
bool RPGMakerRGSS300::attach_function()
|
||||
{
|
||||
PcHooks::hookGDIFunctions();
|
||||
trigger_fun = [](LPVOID addr1, hook_stack *stack)
|
||||
{
|
||||
if (addr1 != GetGlyphOutlineW)
|
||||
|
@ -91,6 +91,7 @@ static bool InsertRealliveDynamicHook(LPVOID addr, hook_stack *stack)
|
||||
}
|
||||
void InsertRealliveHook()
|
||||
{
|
||||
PcHooks::hookGDIFunctions();
|
||||
// ConsoleOutput("Probably Reallive. Wait for text.");
|
||||
ConsoleOutput("TRIGGER Reallive");
|
||||
trigger_fun = InsertRealliveDynamicHook;
|
||||
|
@ -45,6 +45,7 @@ bool InsertRyokuchaDynamicHook(LPVOID addr, hook_stack *)
|
||||
}
|
||||
void InsertRyokuchaHook()
|
||||
{
|
||||
PcHooks::hookGDIFunctions();
|
||||
// ConsoleOutput("Probably Ryokucha. Wait for text.");
|
||||
trigger_fun = InsertRyokuchaDynamicHook;
|
||||
ConsoleOutput("TRIGGER Ryokucha");
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
bool Sceplay::attach_function()
|
||||
{
|
||||
PcHooks::hookGDIFunctions();
|
||||
trigger_fun = [](LPVOID addr1, hook_stack *stack)
|
||||
{
|
||||
if (addr1 != GetGlyphOutlineA)
|
||||
|
@ -169,6 +169,7 @@ bool InsertShinaHook(int ver)
|
||||
|
||||
if (ver >= 50)
|
||||
{
|
||||
PcHooks::hookGDIFunctions();
|
||||
// trigger_fun = StackSearchingTrigger<GetGlyphOutlineA, NULL>;
|
||||
trigger_fun = [](LPVOID funcAddr, hook_stack *stack)
|
||||
{
|
||||
|
@ -192,6 +192,7 @@ namespace
|
||||
|
||||
bool InsertSystemAoiDynamic()
|
||||
{
|
||||
PcHooks::hookGDIFunctions();
|
||||
ConsoleOutput("DYNAMIC SystemAoi");
|
||||
// ConsoleOutput("Probably SoftHouseChara. Wait for text.");
|
||||
trigger_fun = InsertSystemAoiDynamicHook;
|
||||
|
@ -39,6 +39,7 @@ bool InsertTriangleHook()
|
||||
|
||||
bool Triangle::attach_function()
|
||||
{
|
||||
PcHooks::hookGDIFunctions();
|
||||
trigger_fun = [](LPVOID addr, hook_stack *stack)
|
||||
{
|
||||
// Triangle やっぱり妹がすきっ!
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "Waffle.h"
|
||||
|
||||
#include "pchhook.h"
|
||||
bool InsertWaffleDynamicHook(LPVOID addr, hook_stack *stack)
|
||||
{
|
||||
ConsoleOutput("WaffleDynamic:triggered");
|
||||
@ -42,8 +42,9 @@ bool InsertWaffleDynamicHook(LPVOID addr, hook_stack *stack)
|
||||
* Sample game: 完全時間停止 体験版
|
||||
* GDI text: TextOutA and GetTextExtentPoint32A
|
||||
*/
|
||||
bool InsertWaffleHook()
|
||||
bool waffleoldhook()
|
||||
{
|
||||
// waffle经常会加密,这个遍历会导致很慢。
|
||||
bool found = false;
|
||||
for (DWORD i = processStartAddress + 0x1000; i < processStopAddress - 4; i++)
|
||||
if (*(DWORD *)i == 0xac68 && *(BYTE *)(i + 4) == 0)
|
||||
@ -57,7 +58,10 @@ bool InsertWaffleHook()
|
||||
ConsoleOutput("INSERT WAFFLE");
|
||||
found |= NewHook(hp, "WAFFLE");
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
bool InsertWaffleHook()
|
||||
{
|
||||
/** new waffle?
|
||||
* test on 母三人とアナあそび https://vndb.org/v24214
|
||||
* and 変態エルフ姉妹と真面目オーク https://vndb.org/v24215
|
||||
@ -79,12 +83,9 @@ bool InsertWaffleHook()
|
||||
hp.offset = get_reg(regs::eax);
|
||||
hp.type = DATA_INDIRECT;
|
||||
ConsoleOutput("INSERT WAFFLE2");
|
||||
found |= NewHook(hp, "WAFFLE2");
|
||||
return NewHook(hp, "WAFFLE2");
|
||||
}
|
||||
// ConsoleOutput("Probably Waffle. Wait for text.");
|
||||
if (!found)
|
||||
trigger_fun = InsertWaffleDynamicHook;
|
||||
return found;
|
||||
return false;
|
||||
// ConsoleOutput("WAFFLE: failed");
|
||||
}
|
||||
bool InsertWaffleHookx()
|
||||
@ -610,5 +611,13 @@ bool Waffle::attach_function()
|
||||
bool b2 = InsertWaffleHookx();
|
||||
bool b3 = hh();
|
||||
b3 |= waffle3();
|
||||
return b1 || b2 || embed || b3;
|
||||
auto succ = b1 || b2 || embed || b3;
|
||||
// ConsoleOutput("Probably Waffle. Wait for text.");
|
||||
if (!succ)
|
||||
{
|
||||
succ = waffleoldhook();
|
||||
PcHooks::hookGDIFunctions();
|
||||
trigger_fun = InsertWaffleDynamicHook;
|
||||
}
|
||||
return succ;
|
||||
}
|
@ -1,11 +1,13 @@
|
||||
|
||||
|
||||
class Waffle:public ENGINE{
|
||||
public:
|
||||
Waffle(){
|
||||
|
||||
check_by=CHECK_BY::FILE;
|
||||
check_by_target=L"cfg.pak";
|
||||
class Waffle : public ENGINE
|
||||
{
|
||||
public:
|
||||
Waffle()
|
||||
{
|
||||
|
||||
check_by = CHECK_BY::FILE;
|
||||
check_by_target = L"cfg.pak";
|
||||
};
|
||||
bool attach_function();
|
||||
bool attach_function();
|
||||
};
|
@ -1,11 +0,0 @@
|
||||
#include"pchooks.h"
|
||||
|
||||
bool pchooks::attach_function() {
|
||||
for (std::wstring DXVersion : { L"d3dx9", L"d3dx10" })
|
||||
if (HMODULE module = GetModuleHandleW(DXVersion.c_str())) PcHooks::hookD3DXFunctions(module);
|
||||
else for (int i = 0; i < 50; ++i)
|
||||
if (HMODULE module = GetModuleHandleW((DXVersion + L"_" + std::to_wstring(i)).c_str())) PcHooks::hookD3DXFunctions(module);
|
||||
PcHooks::hookGDIFunctions();
|
||||
PcHooks::hookGDIPlusFunctions();
|
||||
return true;
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
|
||||
|
||||
class pchooks:public ENGINE{
|
||||
public:
|
||||
pchooks(){
|
||||
|
||||
check_by=CHECK_BY::ALL_TRUE;
|
||||
dontstop=true;
|
||||
};
|
||||
bool attach_function();
|
||||
};
|
@ -1,16 +0,0 @@
|
||||
#include "pchooks.h"
|
||||
|
||||
bool pchooks::attach_function()
|
||||
{
|
||||
for (std::wstring DXVersion : {L"d3dx9", L"d3dx10"})
|
||||
if (HMODULE module = GetModuleHandleW(DXVersion.c_str()))
|
||||
PcHooks::hookD3DXFunctions(module);
|
||||
else
|
||||
for (int i = 0; i < 50; ++i)
|
||||
if (HMODULE module = GetModuleHandleW((DXVersion + L"_" + std::to_wstring(i)).c_str()))
|
||||
PcHooks::hookD3DXFunctions(module);
|
||||
|
||||
PcHooks::hookGDIFunctions();
|
||||
PcHooks::hookGDIPlusFunctions();
|
||||
return true;
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
|
||||
|
||||
class pchooks : public ENGINE
|
||||
{
|
||||
public:
|
||||
pchooks()
|
||||
{
|
||||
|
||||
check_by = CHECK_BY::ALL_TRUE;
|
||||
dontstop = true;
|
||||
};
|
||||
bool attach_function();
|
||||
};
|
@ -17,7 +17,6 @@
|
||||
#include "engine32/splushwave.h"
|
||||
#include "engine32/FrontWing.h"
|
||||
#include "engine32/GSX.h"
|
||||
#include "engine32/pchooks.h"
|
||||
#include "engine32/VALKYRIA.h"
|
||||
#include "engine32/mirage.h"
|
||||
#include "engine32/Sprite.h"
|
||||
@ -194,7 +193,6 @@ std::vector<ENGINE *> check_engines()
|
||||
new cef,
|
||||
new mono,
|
||||
new sakanagl,
|
||||
new pchooks,
|
||||
new PONScripter,
|
||||
new Renpy,
|
||||
new Lightvn,
|
||||
@ -413,6 +411,6 @@ std::vector<ENGINE *> check_engines()
|
||||
new AksysGames,
|
||||
new AGE_System,
|
||||
new Cage,
|
||||
new Winters
|
||||
new Winters,
|
||||
};
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
#include "engine64/V8.h"
|
||||
#include "engine64/mono.h"
|
||||
#include "engine64/AGES7.h"
|
||||
#include "engine64/pchooks.h"
|
||||
#include "engine64/Artemis.h"
|
||||
#include "engine64/KiriKiri.h"
|
||||
#include "engine64/YOX.h"
|
||||
@ -40,7 +39,6 @@ std::vector<ENGINE *> check_engines()
|
||||
new lucasystem,
|
||||
new LightVN,
|
||||
new Artemis,
|
||||
new pchooks,
|
||||
new KiriKiri,
|
||||
new YOX,
|
||||
new CMVS,
|
||||
@ -50,5 +48,6 @@ std::vector<ENGINE *> check_engines()
|
||||
new UnrealEngine,
|
||||
new Kincaid,
|
||||
new lua51,
|
||||
new MKXPZ};
|
||||
new MKXPZ,
|
||||
};
|
||||
}
|
||||
|
@ -91,11 +91,6 @@ bool checkengine()
|
||||
if (matched == false)
|
||||
continue;
|
||||
ConsoleOutput(MatchedEngine, m->getenginename());
|
||||
if (m->dontstop)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m->is_engine_certain)
|
||||
{
|
||||
ConsoleOutput(ConfirmStop, m->getenginename());
|
||||
@ -141,8 +136,9 @@ void HIJACK()
|
||||
ConsoleOutput(HIJACK_ERROR);
|
||||
}
|
||||
|
||||
if (result == false)
|
||||
if (!result)
|
||||
{
|
||||
PcHooks::hooknormalfunctions();
|
||||
PcHooks::hookOtherPcFunctions();
|
||||
}
|
||||
}
|
@ -1,13 +1,14 @@
|
||||
|
||||
|
||||
class lua51:public ENGINE{
|
||||
public:
|
||||
lua51(){
|
||||
|
||||
check_by=CHECK_BY::FILE_ANY;
|
||||
check_by_target=check_by_list{L"lua5.1.dll",L"lua51.dll"};
|
||||
is_engine_certain=false;
|
||||
//dontstop=true;
|
||||
class lua51 : public ENGINE
|
||||
{
|
||||
public:
|
||||
lua51()
|
||||
{
|
||||
|
||||
check_by = CHECK_BY::FILE_ANY;
|
||||
check_by_target = check_by_list{L"lua5.1.dll", L"lua51.dll"};
|
||||
is_engine_certain = false;
|
||||
};
|
||||
bool attach_function();
|
||||
bool attach_function();
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
#define RESOLVE_IMPORT(name) name = (decltype(name))(GetProcAddress(game_module, #name))
|
||||
|
||||
void commonsolvemonostring(uintptr_t offset, TextBuffer* buffer);
|
||||
#pragma once
|
||||
void commonsolvemonostring(uintptr_t offset, TextBuffer *buffer);
|
||||
void unity_ui_string_hook_after(uintptr_t *offset, TextBuffer buff);
|
||||
|
||||
uintptr_t tryfindmonoil2cpp(const char *_dll, const char *_namespace, const char *_class, const char *_method, int paramCoun, bool strict = false);
|
@ -2,72 +2,91 @@
|
||||
// 8/1/2014 jichi
|
||||
|
||||
#include "pchooks.h"
|
||||
//#include <gdiplus.h>
|
||||
|
||||
// #include <gdiplus.h>
|
||||
|
||||
// 8/1/2014 jichi: Split is not used.
|
||||
// Although split is specified, USING_SPLIT is not assigned.
|
||||
|
||||
// Use LPASTE to convert to wchar_t
|
||||
// http://bytes.com/topic/c/answers/135834-defining-wide-character-strings-macros
|
||||
//#define LPASTE(s) L##s
|
||||
//#define L(s) LPASTE(s)
|
||||
// #define LPASTE(s) L##s
|
||||
// #define L(s) LPASTE(s)
|
||||
#define NEW_HOOK(_dll, _fun, _data, _data_ind, _split_off, _split_ind, _type, _len_off) \
|
||||
{ \
|
||||
HookParam hp; \
|
||||
wcsncpy_s(hp.module, _dll, MAX_MODULE_SIZE - 1); \
|
||||
strncpy_s(hp.function, #_fun, MAX_MODULE_SIZE - 1); \
|
||||
hp.offset = _data; \
|
||||
hp.index = _data_ind; \
|
||||
hp.split = _split_off; \
|
||||
hp.split_index = _split_ind; \
|
||||
hp.type = _type | MODULE_OFFSET | FUNCTION_OFFSET; \
|
||||
hp.length_offset = _len_off; \
|
||||
NewHook(hp, #_fun); \
|
||||
{ \
|
||||
HookParam hp; \
|
||||
wcsncpy_s(hp.module, _dll, MAX_MODULE_SIZE - 1); \
|
||||
strncpy_s(hp.function, #_fun, MAX_MODULE_SIZE - 1); \
|
||||
hp.offset = _data; \
|
||||
hp.index = _data_ind; \
|
||||
hp.split = _split_off; \
|
||||
hp.split_index = _split_ind; \
|
||||
hp.type = _type | MODULE_OFFSET | FUNCTION_OFFSET; \
|
||||
hp.length_offset = _len_off; \
|
||||
NewHook(hp, #_fun); \
|
||||
}
|
||||
|
||||
#define NEW_MODULE_HOOK(_module, _fun, _data, _data_ind, _split_off, _split_ind, _type, _len_off) \
|
||||
{ \
|
||||
HookParam hp; \
|
||||
wchar_t path[MAX_PATH]; \
|
||||
if (GetModuleFileNameW(_module, path, MAX_PATH)) \
|
||||
wcsncpy_s(hp.module, wcsrchr(path, L'\\') + 1, MAX_MODULE_SIZE - 1); \
|
||||
strncpy_s(hp.function, #_fun, MAX_MODULE_SIZE - 1); \
|
||||
hp.offset = _data; \
|
||||
hp.index = _data_ind; \
|
||||
hp.split = _split_off; \
|
||||
hp.split_index = _split_ind; \
|
||||
hp.type = _type | MODULE_OFFSET | FUNCTION_OFFSET; \
|
||||
hp.length_offset = _len_off; \
|
||||
NewHook(hp, #_fun); \
|
||||
{ \
|
||||
HookParam hp; \
|
||||
wchar_t path[MAX_PATH]; \
|
||||
if (GetModuleFileNameW(_module, path, MAX_PATH)) \
|
||||
wcsncpy_s(hp.module, wcsrchr(path, L'\\') + 1, MAX_MODULE_SIZE - 1); \
|
||||
strncpy_s(hp.function, #_fun, MAX_MODULE_SIZE - 1); \
|
||||
hp.offset = _data; \
|
||||
hp.index = _data_ind; \
|
||||
hp.split = _split_off; \
|
||||
hp.split_index = _split_ind; \
|
||||
hp.type = _type | MODULE_OFFSET | FUNCTION_OFFSET; \
|
||||
hp.length_offset = _len_off; \
|
||||
NewHook(hp, #_fun); \
|
||||
}
|
||||
|
||||
#ifndef _WIN64
|
||||
enum args {
|
||||
s_retaddr = 0
|
||||
, s_arg1 = 4 * 1 // 0x4
|
||||
, s_arg2 = 4 * 2 // 0x8
|
||||
, s_arg3 = 4 * 3 // 0xc
|
||||
, s_arg4 = 4 * 4 // 0x10
|
||||
, s_arg5 = 4 * 5 // 0x14
|
||||
, s_arg6 = 4 * 6 // 0x18
|
||||
, s_arg7 = 4 * 7
|
||||
enum args
|
||||
{
|
||||
s_retaddr = 0,
|
||||
s_arg1 = 4 * 1 // 0x4
|
||||
,
|
||||
s_arg2 = 4 * 2 // 0x8
|
||||
,
|
||||
s_arg3 = 4 * 3 // 0xc
|
||||
,
|
||||
s_arg4 = 4 * 4 // 0x10
|
||||
,
|
||||
s_arg5 = 4 * 5 // 0x14
|
||||
,
|
||||
s_arg6 = 4 * 6 // 0x18
|
||||
,
|
||||
s_arg7 = 4 * 7
|
||||
};
|
||||
#else // _WIN32
|
||||
enum args {
|
||||
s_retaddr = 0x0,
|
||||
s_arg1 = -0x20,
|
||||
s_arg2 = -0x28,
|
||||
s_arg3 = -0x50,
|
||||
s_arg4 = -0x58,
|
||||
s_arg5 = 0x8,
|
||||
s_arg6 = 0x10,
|
||||
s_arg7 = 0x18
|
||||
#else // _WIN32
|
||||
enum args
|
||||
{
|
||||
s_retaddr = 0x0,
|
||||
s_arg1 = -0x20,
|
||||
s_arg2 = -0x28,
|
||||
s_arg3 = -0x50,
|
||||
s_arg4 = -0x58,
|
||||
s_arg5 = 0x8,
|
||||
s_arg6 = 0x10,
|
||||
s_arg7 = 0x18
|
||||
};
|
||||
#endif // _WIN64
|
||||
|
||||
constexpr short arg_sz = (short)sizeof(void*);
|
||||
constexpr short arg_sz = (short)sizeof(void *);
|
||||
void PcHooks::hooknormalfunctions()
|
||||
{
|
||||
for (std::wstring DXVersion : {L"d3dx9", L"d3dx10"})
|
||||
if (HMODULE module = GetModuleHandleW(DXVersion.c_str()))
|
||||
PcHooks::hookD3DXFunctions(module);
|
||||
else
|
||||
for (int i = 0; i < 50; ++i)
|
||||
if (HMODULE module = GetModuleHandleW((DXVersion + L"_" + std::to_wstring(i)).c_str()))
|
||||
PcHooks::hookD3DXFunctions(module);
|
||||
|
||||
PcHooks::hookGDIFunctions();
|
||||
PcHooks::hookGDIPlusFunctions();
|
||||
}
|
||||
// jichi 7/17/2014: Renamed from InitDefaultHook
|
||||
void PcHooks::hookGDIFunctions()
|
||||
{
|
||||
@ -93,8 +112,7 @@ void PcHooks::hookGDIFunctions()
|
||||
//
|
||||
// Note: All functions does not have NO_CONTEXT attribute and will be filtered.
|
||||
|
||||
|
||||
//#define _(Name, ...) \
|
||||
//#define _(Name, ...) \
|
||||
// hookman[HF_##Name].InitHook(Name, __VA_ARGS__); \
|
||||
// hookman[HF_##Name].SetHookName(names[HF_##Name]);
|
||||
|
||||
@ -102,114 +120,117 @@ void PcHooks::hookGDIFunctions()
|
||||
// 7/26/2014 jichi: Why there is no USING_SPLIT type?
|
||||
|
||||
// gdi32.dll
|
||||
NEW_HOOK(L"gdi32.dll", GetTextExtentPoint32A, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / arg_sz) // BOOL GetTextExtentPoint32(HDC hdc, LPCTSTR lpString, int c, LPSIZE lpSize);
|
||||
NEW_HOOK(L"gdi32.dll", GetTextExtentExPointA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / arg_sz) // BOOL GetTextExtentExPoint(HDC hdc, LPCTSTR lpszStr, int cchString, int nMaxExtent, LPINT lpnFit, LPINT alpDx, LPSIZE lpSize);
|
||||
NEW_HOOK(L"gdi32.dll", GetCharacterPlacementA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / arg_sz) // DWORD GetCharacterPlacement(HDC hdc, LPCTSTR lpString, int nCount, int nMaxExtent, LPGCP_RESULTS lpResults, DWORD dwFlags);
|
||||
NEW_HOOK(L"gdi32.dll", GetGlyphIndicesA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / arg_sz) // DWORD GetGlyphIndices( HDC hdc, LPCTSTR lpstr, int c, LPWORD pgi, DWORD fl);
|
||||
NEW_HOOK(L"gdi32.dll", GetGlyphOutlineA, s_arg2, 0,s_arg1,0, CODEC_ANSI_BE, 0) // DWORD GetGlyphOutline(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, const MAT2 *lpmat2);
|
||||
NEW_HOOK(L"gdi32.dll", ExtTextOutA, s_arg6, 0,s_arg1,0, USING_STRING, s_arg7 / arg_sz) // BOOL ExtTextOut(HDC hdc, int X, int Y, UINT fuOptions, const RECT *lprc, LPCTSTR lpString, UINT cbCount, const INT *lpDx);
|
||||
NEW_HOOK(L"gdi32.dll", TextOutA, s_arg4, 0,s_arg1,0, USING_STRING, s_arg5 / arg_sz) // BOOL TextOut(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cchString);
|
||||
NEW_HOOK(L"gdi32.dll", GetCharABCWidthsA, s_arg2, 0,s_arg1,0, CODEC_ANSI_BE, 0) // BOOL GetCharABCWidths(HDC hdc, UINT uFirstChar, UINT uLastChar, LPABC lpabc);
|
||||
NEW_HOOK(L"gdi32.dll", GetCharABCWidthsFloatA, s_arg2, 0,s_arg1,0, CODEC_ANSI_BE, 0) // BOOL GetCharABCWidthsFloat(HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT lpABCF);
|
||||
NEW_HOOK(L"gdi32.dll", GetCharWidth32A, s_arg2, 0,s_arg1,0, CODEC_ANSI_BE, 0) // BOOL GetCharWidth32(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer);
|
||||
NEW_HOOK(L"gdi32.dll", GetCharWidthFloatA, s_arg2, 0,s_arg1,0, CODEC_ANSI_BE, 0) // BOOL GetCharWidthFloat(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBuffer);
|
||||
NEW_HOOK(L"gdi32.dll", GetTextExtentPoint32A, s_arg2, 0, s_arg1, 0, USING_STRING, s_arg3 / arg_sz) // BOOL GetTextExtentPoint32(HDC hdc, LPCTSTR lpString, int c, LPSIZE lpSize);
|
||||
NEW_HOOK(L"gdi32.dll", GetTextExtentExPointA, s_arg2, 0, s_arg1, 0, USING_STRING, s_arg3 / arg_sz) // BOOL GetTextExtentExPoint(HDC hdc, LPCTSTR lpszStr, int cchString, int nMaxExtent, LPINT lpnFit, LPINT alpDx, LPSIZE lpSize);
|
||||
NEW_HOOK(L"gdi32.dll", GetCharacterPlacementA, s_arg2, 0, s_arg1, 0, USING_STRING, s_arg3 / arg_sz) // DWORD GetCharacterPlacement(HDC hdc, LPCTSTR lpString, int nCount, int nMaxExtent, LPGCP_RESULTS lpResults, DWORD dwFlags);
|
||||
NEW_HOOK(L"gdi32.dll", GetGlyphIndicesA, s_arg2, 0, s_arg1, 0, USING_STRING, s_arg3 / arg_sz) // DWORD GetGlyphIndices( HDC hdc, LPCTSTR lpstr, int c, LPWORD pgi, DWORD fl);
|
||||
NEW_HOOK(L"gdi32.dll", GetGlyphOutlineA, s_arg2, 0, s_arg1, 0, CODEC_ANSI_BE, 0) // DWORD GetGlyphOutline(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, const MAT2 *lpmat2);
|
||||
NEW_HOOK(L"gdi32.dll", ExtTextOutA, s_arg6, 0, s_arg1, 0, USING_STRING, s_arg7 / arg_sz) // BOOL ExtTextOut(HDC hdc, int X, int Y, UINT fuOptions, const RECT *lprc, LPCTSTR lpString, UINT cbCount, const INT *lpDx);
|
||||
NEW_HOOK(L"gdi32.dll", TextOutA, s_arg4, 0, s_arg1, 0, USING_STRING, s_arg5 / arg_sz) // BOOL TextOut(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cchString);
|
||||
NEW_HOOK(L"gdi32.dll", GetCharABCWidthsA, s_arg2, 0, s_arg1, 0, CODEC_ANSI_BE, 0) // BOOL GetCharABCWidths(HDC hdc, UINT uFirstChar, UINT uLastChar, LPABC lpabc);
|
||||
NEW_HOOK(L"gdi32.dll", GetCharABCWidthsFloatA, s_arg2, 0, s_arg1, 0, CODEC_ANSI_BE, 0) // BOOL GetCharABCWidthsFloat(HDC hdc, UINT iFirstChar, UINT iLastChar, LPABCFLOAT lpABCF);
|
||||
NEW_HOOK(L"gdi32.dll", GetCharWidth32A, s_arg2, 0, s_arg1, 0, CODEC_ANSI_BE, 0) // BOOL GetCharWidth32(HDC hdc, UINT iFirstChar, UINT iLastChar, LPINT lpBuffer);
|
||||
NEW_HOOK(L"gdi32.dll", GetCharWidthFloatA, s_arg2, 0, s_arg1, 0, CODEC_ANSI_BE, 0) // BOOL GetCharWidthFloat(HDC hdc, UINT iFirstChar, UINT iLastChar, PFLOAT pxBuffer);
|
||||
|
||||
NEW_HOOK(L"gdi32.dll", GetTextExtentPoint32W, s_arg2, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", GetTextExtentExPointW, s_arg2, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", GetCharacterPlacementW, s_arg2, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", GetGlyphIndicesW, s_arg2, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", GetGlyphOutlineW, s_arg2, 0,s_arg1,0, CODEC_UTF16, 0)
|
||||
//ExtTextOutW全是乱码,没卵用
|
||||
//NEW_HOOK(L"gdi32.dll", ExtTextOutW, s_arg6, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg7 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", TextOutW, s_arg4, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg5 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", GetCharABCWidthsW, s_arg2, 0,s_arg1,0, CODEC_UTF16, 0)
|
||||
NEW_HOOK(L"gdi32.dll", GetCharABCWidthsFloatW, s_arg2, 0,s_arg1,0, CODEC_UTF16, 0)
|
||||
NEW_HOOK(L"gdi32.dll", GetCharWidth32W, s_arg2, 0,s_arg1,0, CODEC_UTF16, 0)
|
||||
NEW_HOOK(L"gdi32.dll", GetCharWidthFloatW, s_arg2, 0,s_arg1,0, CODEC_UTF16, 0)
|
||||
NEW_HOOK(L"gdi32.dll", GetTextExtentPoint32W, s_arg2, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", GetTextExtentExPointW, s_arg2, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", GetCharacterPlacementW, s_arg2, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", GetGlyphIndicesW, s_arg2, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", GetGlyphOutlineW, s_arg2, 0, s_arg1, 0, CODEC_UTF16, 0)
|
||||
// ExtTextOutW全是乱码,没卵用
|
||||
// NEW_HOOK(L"gdi32.dll", ExtTextOutW, s_arg6, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg7 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", TextOutW, s_arg4, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg5 / arg_sz)
|
||||
NEW_HOOK(L"gdi32.dll", GetCharABCWidthsW, s_arg2, 0, s_arg1, 0, CODEC_UTF16, 0)
|
||||
NEW_HOOK(L"gdi32.dll", GetCharABCWidthsFloatW, s_arg2, 0, s_arg1, 0, CODEC_UTF16, 0)
|
||||
NEW_HOOK(L"gdi32.dll", GetCharWidth32W, s_arg2, 0, s_arg1, 0, CODEC_UTF16, 0)
|
||||
NEW_HOOK(L"gdi32.dll", GetCharWidthFloatW, s_arg2, 0, s_arg1, 0, CODEC_UTF16, 0)
|
||||
|
||||
// user32.dll
|
||||
NEW_HOOK(L"user32.dll", DrawTextA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / arg_sz) // int DrawText(HDC hDC, LPCTSTR lpchText, int nCount, LPRECT lpRect, UINT uFormat);
|
||||
NEW_HOOK(L"user32.dll", DrawTextExA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / arg_sz) // int DrawTextEx(HDC hdc, LPTSTR lpchText,int cchText, LPRECT lprc, UINT dwDTFormat, LPDRAWTEXTPARAMS lpDTParams);NEW_HOOK(L"gdi32.dll", GetTabbedTextExtentA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / arg_sz) // DWORD GetTabbedTextExtent(HDC hDC, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions);
|
||||
NEW_HOOK(L"user32.dll", TabbedTextOutA, s_arg4, 0, s_arg1, 0, USING_STRING, s_arg5 / arg_sz) // LONG TabbedTextOut(HDC hDC, int X, int Y, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions, int nTabOrigin);
|
||||
NEW_HOOK(L"user32.dll", GetTabbedTextExtentA, s_arg2, 0, s_arg1, 0, USING_STRING, s_arg3 / arg_sz) // DWORD GetTabbedTextExtent(HDC hDC, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions);
|
||||
NEW_HOOK(L"user32.dll", DrawTextA, s_arg2, 0, s_arg1, 0, USING_STRING, s_arg3 / arg_sz) // int DrawText(HDC hDC, LPCTSTR lpchText, int nCount, LPRECT lpRect, UINT uFormat);
|
||||
NEW_HOOK(L"user32.dll", DrawTextExA, s_arg2, 0, s_arg1, 0, USING_STRING, s_arg3 / arg_sz) // int DrawTextEx(HDC hdc, LPTSTR lpchText,int cchText, LPRECT lprc, UINT dwDTFormat, LPDRAWTEXTPARAMS lpDTParams);NEW_HOOK(L"gdi32.dll", GetTabbedTextExtentA, s_arg2, 0,s_arg1,0, USING_STRING, s_arg3 / arg_sz) // DWORD GetTabbedTextExtent(HDC hDC, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions);
|
||||
NEW_HOOK(L"user32.dll", TabbedTextOutA, s_arg4, 0, s_arg1, 0, USING_STRING, s_arg5 / arg_sz) // LONG TabbedTextOut(HDC hDC, int X, int Y, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions, int nTabOrigin);
|
||||
NEW_HOOK(L"user32.dll", GetTabbedTextExtentA, s_arg2, 0, s_arg1, 0, USING_STRING, s_arg3 / arg_sz) // DWORD GetTabbedTextExtent(HDC hDC, LPCTSTR lpString, int nCount, int nTabPositions, const LPINT lpnTabStopPositions);
|
||||
|
||||
NEW_HOOK(L"user32.dll", DrawTextW, s_arg2, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"user32.dll", DrawTextExW, s_arg2, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"user32.dll", TabbedTextOutW, s_arg4, 0, s_arg1, 0, CODEC_UTF16|USING_STRING, s_arg5 / arg_sz)
|
||||
NEW_HOOK(L"user32.dll", GetTabbedTextExtentW, s_arg2, 0, s_arg1, 0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"user32.dll", DrawTextW, s_arg2, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"user32.dll", DrawTextExW, s_arg2, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"user32.dll", TabbedTextOutW, s_arg4, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg5 / arg_sz)
|
||||
NEW_HOOK(L"user32.dll", GetTabbedTextExtentW, s_arg2, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz)
|
||||
}
|
||||
|
||||
// jichi 6/18/2015: GDI+ functions
|
||||
void PcHooks::hookGDIPlusFunctions()
|
||||
{
|
||||
HMODULE hModule = ::GetModuleHandleA("gdiplus.dll");
|
||||
if (!hModule) return;
|
||||
if (!hModule)
|
||||
return;
|
||||
|
||||
// gdiplus.dll
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms534053%28v=vs.85%29.aspx
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms534052%28v=vs.85%29.aspx
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/ms534039%28v=vs.85%29.aspx
|
||||
// Use arg1 pionter to GpGraphics as split
|
||||
//using namespace Gdiplus::DllExports;
|
||||
// using namespace Gdiplus::DllExports;
|
||||
// Use arg5 style as split
|
||||
NEW_MODULE_HOOK(hModule, GdipAddPathString, s_arg2, 0,s_arg5,0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz) // GpStatus WINGDIPAPI GdipAddPathString(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *format)
|
||||
NEW_MODULE_HOOK(hModule, GdipAddPathStringI, s_arg2, 0,s_arg5,0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz) // GpStatus WINGDIPAPI GdipAddPathStringI(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST Rect *layoutRect, GDIPCONST GpStringFormat *format)
|
||||
NEW_MODULE_HOOK(hModule, GdipMeasureCharacterRanges, s_arg2, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz) // GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF &layoutRect, GDIPCONST GpStringFormat *stringFormat, INT regionCount, GpRegion **regions)
|
||||
NEW_MODULE_HOOK(hModule, GdipDrawString, s_arg2, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz) // GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, GDIPCONST GpBrush *brush);
|
||||
NEW_MODULE_HOOK(hModule, GdipMeasureString, s_arg2, 0,s_arg1,0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz) // GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox, INT *codepointsFitted, INT *linesFilled )
|
||||
NEW_MODULE_HOOK(hModule, GdipDrawDriverString, s_arg1, 0,s_arg3,0, CODEC_UTF16|USING_STRING, s_arg2 / arg_sz)
|
||||
NEW_MODULE_HOOK(hModule, GdipMeasureDriverString, s_arg1, 0,s_arg3,0, CODEC_UTF16|USING_STRING, s_arg2 / arg_sz)
|
||||
NEW_MODULE_HOOK(hModule, GdipAddPathString, s_arg2, 0, s_arg5, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz) // GpStatus WINGDIPAPI GdipAddPathString(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *format)
|
||||
NEW_MODULE_HOOK(hModule, GdipAddPathStringI, s_arg2, 0, s_arg5, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz) // GpStatus WINGDIPAPI GdipAddPathStringI(GpPath *path, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFontFamily *family, INT style, REAL emSize, GDIPCONST Rect *layoutRect, GDIPCONST GpStringFormat *format)
|
||||
NEW_MODULE_HOOK(hModule, GdipMeasureCharacterRanges, s_arg2, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz) // GpStatus WINGDIPAPI GdipMeasureCharacterRanges(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF &layoutRect, GDIPCONST GpStringFormat *stringFormat, INT regionCount, GpRegion **regions)
|
||||
NEW_MODULE_HOOK(hModule, GdipDrawString, s_arg2, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz) // GpStatus WINGDIPAPI GdipDrawString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, GDIPCONST GpBrush *brush);
|
||||
NEW_MODULE_HOOK(hModule, GdipMeasureString, s_arg2, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz) // GpStatus WINGDIPAPI GdipMeasureString(GpGraphics *graphics, GDIPCONST WCHAR *string, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *layoutRect, GDIPCONST GpStringFormat *stringFormat, RectF *boundingBox, INT *codepointsFitted, INT *linesFilled )
|
||||
NEW_MODULE_HOOK(hModule, GdipDrawDriverString, s_arg1, 0, s_arg3, 0, CODEC_UTF16 | USING_STRING, s_arg2 / arg_sz)
|
||||
NEW_MODULE_HOOK(hModule, GdipMeasureDriverString, s_arg1, 0, s_arg3, 0, CODEC_UTF16 | USING_STRING, s_arg2 / arg_sz)
|
||||
}
|
||||
|
||||
|
||||
bool PcHooks::hookD3DXFunctions(HMODULE d3dxModule)
|
||||
{
|
||||
if (GetProcAddress(d3dxModule, "D3DXCreateTextA"))
|
||||
{
|
||||
NEW_MODULE_HOOK(d3dxModule, D3DXCreateTextA, s_arg3, 0, 0, 0, USING_STRING, 0)
|
||||
NEW_MODULE_HOOK(d3dxModule, D3DXCreateTextW, s_arg3, 0, 0, 0, USING_STRING|CODEC_UTF16, 0)
|
||||
}
|
||||
if (GetProcAddress(d3dxModule, "D3DXCreateTextA"))
|
||||
{
|
||||
NEW_MODULE_HOOK(d3dxModule, D3DXCreateTextA, s_arg3, 0, 0, 0, USING_STRING, 0)
|
||||
NEW_MODULE_HOOK(d3dxModule, D3DXCreateTextW, s_arg3, 0, 0, 0, USING_STRING | CODEC_UTF16, 0)
|
||||
}
|
||||
|
||||
// Second call in D3DX(10)CreateFontIndirect is D3DXFont constructor, which sets up the vtable
|
||||
// Call it to set up the vtable then extract the function addresses from that vtable
|
||||
uintptr_t createFont = (uintptr_t)GetProcAddress(d3dxModule, "D3DXCreateFontIndirectA");
|
||||
if (!createFont) createFont = (uintptr_t)GetProcAddress(d3dxModule, "D3DX10CreateFontIndirectA");
|
||||
if (!createFont) {
|
||||
// Second call in D3DX(10)CreateFontIndirect is D3DXFont constructor, which sets up the vtable
|
||||
// Call it to set up the vtable then extract the function addresses from that vtable
|
||||
uintptr_t createFont = (uintptr_t)GetProcAddress(d3dxModule, "D3DXCreateFontIndirectA");
|
||||
if (!createFont)
|
||||
createFont = (uintptr_t)GetProcAddress(d3dxModule, "D3DX10CreateFontIndirectA");
|
||||
if (!createFont)
|
||||
{
|
||||
ConsoleOutput("D3DX failed: couldn't find entry function");
|
||||
return false;
|
||||
}
|
||||
|
||||
struct D3DXFont
|
||||
{
|
||||
uintptr_t(*vtable)[20];
|
||||
DWORD data[2000];
|
||||
} font;
|
||||
for (int i = 0, calls = 0; i < 100; ++i)
|
||||
{
|
||||
if (*(BYTE*)(createFont + i) == 0xe8) ++calls;
|
||||
if (calls == 2)
|
||||
{
|
||||
union
|
||||
{
|
||||
void(D3DXFont::*ctor)();
|
||||
uintptr_t addr;
|
||||
} fuckTheTypeSystem;
|
||||
fuckTheTypeSystem.addr = *(DWORD*)(createFont + i + 1) + createFont + i + 5;
|
||||
(font.*(fuckTheTypeSystem.ctor))();
|
||||
struct D3DXFont
|
||||
{
|
||||
uintptr_t (*vtable)[20];
|
||||
DWORD data[2000];
|
||||
} font;
|
||||
for (int i = 0, calls = 0; i < 100; ++i)
|
||||
{
|
||||
if (*(BYTE *)(createFont + i) == 0xe8)
|
||||
++calls;
|
||||
if (calls == 2)
|
||||
{
|
||||
union
|
||||
{
|
||||
void (D3DXFont::*ctor)();
|
||||
uintptr_t addr;
|
||||
} fuckTheTypeSystem;
|
||||
fuckTheTypeSystem.addr = *(DWORD *)(createFont + i + 1) + createFont + i + 5;
|
||||
(font.*(fuckTheTypeSystem.ctor))();
|
||||
|
||||
HookParam hp;
|
||||
hp.address = (*font.vtable)[14];
|
||||
hp.offset = s_arg3;
|
||||
hp.length_offset = s_arg4 / arg_sz;
|
||||
hp.type = USING_STRING;
|
||||
auto suc=NewHook(hp, "ID3DXFont::DrawTextA");
|
||||
hp.address = (*font.vtable)[15];
|
||||
hp.type = USING_STRING | CODEC_UTF16;
|
||||
suc|=NewHook(hp, "ID3DXFont::DrawTextW");
|
||||
return suc;
|
||||
}
|
||||
}
|
||||
ConsoleOutput("D3DX failed: couldn't find vtable");
|
||||
HookParam hp;
|
||||
hp.address = (*font.vtable)[14];
|
||||
hp.offset = s_arg3;
|
||||
hp.length_offset = s_arg4 / arg_sz;
|
||||
hp.type = USING_STRING;
|
||||
auto suc = NewHook(hp, "ID3DXFont::DrawTextA");
|
||||
hp.address = (*font.vtable)[15];
|
||||
hp.type = USING_STRING | CODEC_UTF16;
|
||||
suc |= NewHook(hp, "ID3DXFont::DrawTextW");
|
||||
return suc;
|
||||
}
|
||||
}
|
||||
ConsoleOutput("D3DX failed: couldn't find vtable");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -224,13 +245,13 @@ void PcHooks::hookOtherPcFunctions()
|
||||
// Lstr functions usually extracts rubbish, and might crash certain games like 「Magical Marriage Lunatics!!」
|
||||
// Needed by Gift
|
||||
// Use arg1 address for both split and data
|
||||
NEW_HOOK(L"kernel32.dll", lstrlenA, s_arg1, 0,s_arg1,0, USING_STRING, 0) // 9/8/2013 jichi: int WINAPI lstrlen(LPCTSTR lpString);
|
||||
NEW_HOOK(L"kernel32.dll", lstrcpyA, s_arg2, 0,0,0, USING_STRING, 0)
|
||||
NEW_HOOK(L"kernel32.dll", lstrcpynA, s_arg2, 0,0,0, USING_STRING, 0)
|
||||
NEW_HOOK(L"kernel32.dll", lstrlenA, s_arg1, 0, s_arg1, 0, USING_STRING, 0) // 9/8/2013 jichi: int WINAPI lstrlen(LPCTSTR lpString);
|
||||
NEW_HOOK(L"kernel32.dll", lstrcpyA, s_arg2, 0, 0, 0, USING_STRING, 0)
|
||||
NEW_HOOK(L"kernel32.dll", lstrcpynA, s_arg2, 0, 0, 0, USING_STRING, 0)
|
||||
|
||||
NEW_HOOK(L"kernel32.dll", lstrlenW, s_arg1, 0,s_arg1,0, CODEC_UTF16|USING_STRING, 0) // 9/8/2013 jichi: add lstrlen
|
||||
NEW_HOOK(L"kernel32.dll", lstrcpyW, s_arg2, 0,0,0, CODEC_UTF16|USING_STRING, 0)
|
||||
NEW_HOOK(L"kernel32.dll", lstrcpynW, s_arg2, 0,0,0, CODEC_UTF16|USING_STRING, 0)
|
||||
NEW_HOOK(L"kernel32.dll", lstrlenW, s_arg1, 0, s_arg1, 0, CODEC_UTF16 | USING_STRING, 0) // 9/8/2013 jichi: add lstrlen
|
||||
NEW_HOOK(L"kernel32.dll", lstrcpyW, s_arg2, 0, 0, 0, CODEC_UTF16 | USING_STRING, 0)
|
||||
NEW_HOOK(L"kernel32.dll", lstrcpynW, s_arg2, 0, 0, 0, CODEC_UTF16 | USING_STRING, 0)
|
||||
|
||||
// size_t strlen(const char *str);
|
||||
// size_t strlen_l(const char *str, _locale_t locale);
|
||||
@ -285,31 +306,31 @@ void PcHooks::hookOtherPcFunctions()
|
||||
|
||||
// 2/29/2020 Artikash: TODO: Sort out what to do for string comparison functions
|
||||
// http://sakuradite.com/topic/159
|
||||
NEW_HOOK(L"kernel32.dll", MultiByteToWideChar, s_arg3, 0,4,0, USING_STRING, s_arg4 / arg_sz)
|
||||
NEW_HOOK(L"kernel32.dll", WideCharToMultiByte, s_arg3, 0,4,0, CODEC_UTF16|USING_STRING, s_arg4 / arg_sz)
|
||||
NEW_HOOK(L"kernel32.dll", MultiByteToWideChar, s_arg3, 0, 4, 0, USING_STRING, s_arg4 / arg_sz)
|
||||
NEW_HOOK(L"kernel32.dll", WideCharToMultiByte, s_arg3, 0, 4, 0, CODEC_UTF16 | USING_STRING, s_arg4 / arg_sz)
|
||||
|
||||
NEW_HOOK(L"kernel32.dll", GetStringTypeA, s_arg3, 0, 0, 0, USING_STRING, s_arg4 / arg_sz)
|
||||
NEW_HOOK(L"kernel32.dll", GetStringTypeExA, s_arg3, 0, 0, 0, USING_STRING, s_arg4 / arg_sz)
|
||||
NEW_HOOK(L"kernel32.dll", FoldStringA, s_arg2, 0, 0, 0, USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"kernel32.dll", GetStringTypeW, s_arg2, 0, 0, 0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"kernel32.dll", GetStringTypeExW, s_arg3, 0, 0, 0, CODEC_UTF16|USING_STRING, s_arg4 / arg_sz)
|
||||
NEW_HOOK(L"kernel32.dll", FoldStringW, s_arg2, 0, 0, 0, CODEC_UTF16|USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"kernel32.dll", GetStringTypeW, s_arg2, 0, 0, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz)
|
||||
NEW_HOOK(L"kernel32.dll", GetStringTypeExW, s_arg3, 0, 0, 0, CODEC_UTF16 | USING_STRING, s_arg4 / arg_sz)
|
||||
NEW_HOOK(L"kernel32.dll", FoldStringW, s_arg2, 0, 0, 0, CODEC_UTF16 | USING_STRING, s_arg3 / arg_sz)
|
||||
|
||||
NEW_HOOK(L"user32.dll", CharNextA, s_arg1, 0,0,0, DATA_INDIRECT, 0) // LPTSTR WINAPI CharNext(_In_ LPCTSTR lpsz);
|
||||
NEW_HOOK(L"user32.dll", CharNextW, s_arg1, 0,0,0, CODEC_UTF16|DATA_INDIRECT, 0)
|
||||
NEW_HOOK(L"user32.dll", CharPrevA, s_arg1, 0,0,0, DATA_INDIRECT, 0) // LPTSTR WINAPI CharPrev(_In_ LPCTSTR lpszStart, _In_ LPCTSTR lpszCurrent);
|
||||
NEW_HOOK(L"user32.dll", CharPrevW, s_arg1, 0,0,0, CODEC_UTF16|DATA_INDIRECT, 0)
|
||||
NEW_HOOK(L"user32.dll", CharNextExA, s_arg2, 0,0,0, DATA_INDIRECT, 0) // LPSTR WINAPI CharNextExA(_In_ WORD CodePage, _In_ LPCSTR lpCurrentChar, _In_ DWORD dwFlags);
|
||||
NEW_HOOK(L"user32.dll", CharPrevExA, s_arg2, 0,0,0, CODEC_UTF16|DATA_INDIRECT, 0)
|
||||
NEW_HOOK(L"user32.dll", CharNextA, s_arg1, 0, 0, 0, DATA_INDIRECT, 0) // LPTSTR WINAPI CharNext(_In_ LPCTSTR lpsz);
|
||||
NEW_HOOK(L"user32.dll", CharNextW, s_arg1, 0, 0, 0, CODEC_UTF16 | DATA_INDIRECT, 0)
|
||||
NEW_HOOK(L"user32.dll", CharPrevA, s_arg1, 0, 0, 0, DATA_INDIRECT, 0) // LPTSTR WINAPI CharPrev(_In_ LPCTSTR lpszStart, _In_ LPCTSTR lpszCurrent);
|
||||
NEW_HOOK(L"user32.dll", CharPrevW, s_arg1, 0, 0, 0, CODEC_UTF16 | DATA_INDIRECT, 0)
|
||||
NEW_HOOK(L"user32.dll", CharNextExA, s_arg2, 0, 0, 0, DATA_INDIRECT, 0) // LPSTR WINAPI CharNextExA(_In_ WORD CodePage, _In_ LPCSTR lpCurrentChar, _In_ DWORD dwFlags);
|
||||
NEW_HOOK(L"user32.dll", CharPrevExA, s_arg2, 0, 0, 0, CODEC_UTF16 | DATA_INDIRECT, 0)
|
||||
|
||||
// トキノ戦華
|
||||
NEW_HOOK(L"user32.dll", wvsprintfA, s_arg2, 0, 0, 0, USING_STRING, 0)
|
||||
NEW_HOOK(L"user32.dll", wvsprintfW, s_arg2, 0, 0, 0, CODEC_UTF16 | USING_STRING, 0)
|
||||
|
||||
//トキノ戦華
|
||||
NEW_HOOK(L"user32.dll", wvsprintfA, s_arg2, 0,0,0, USING_STRING, 0)
|
||||
NEW_HOOK(L"user32.dll", wvsprintfW, s_arg2, 0,0,0, CODEC_UTF16|USING_STRING, 0)
|
||||
|
||||
if (HMODULE module = GetModuleHandleW(L"OLEAUT32.dll"))
|
||||
{
|
||||
NEW_MODULE_HOOK(module, SysAllocString, s_arg1, 0, 0, 0, CODEC_UTF16|USING_STRING, 0)
|
||||
NEW_MODULE_HOOK(module, SysAllocStringLen, s_arg1, 0, 0, 0, CODEC_UTF16|USING_STRING|KNOWN_UNSTABLE, s_arg2 / arg_sz)
|
||||
NEW_MODULE_HOOK(module, SysAllocString, s_arg1, 0, 0, 0, CODEC_UTF16 | USING_STRING, 0)
|
||||
NEW_MODULE_HOOK(module, SysAllocStringLen, s_arg1, 0, 0, 0, CODEC_UTF16 | USING_STRING | KNOWN_UNSTABLE, s_arg2 / arg_sz)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,13 +5,14 @@
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
namespace PcHooks {
|
||||
|
||||
void hookGDIFunctions();
|
||||
void hookGDIPlusFunctions();
|
||||
bool hookD3DXFunctions(HMODULE d3dxModule);
|
||||
void hookOtherPcFunctions();
|
||||
|
||||
namespace PcHooks
|
||||
{
|
||||
void hook_GetTextExtentPoint32A();
|
||||
void hookGDIFunctions();
|
||||
void hookGDIPlusFunctions();
|
||||
bool hookD3DXFunctions(HMODULE d3dxModule);
|
||||
void hookOtherPcFunctions();
|
||||
void hooknormalfunctions();
|
||||
} // namespace PcHooks
|
||||
|
||||
// EOF
|
||||
|
@ -289,7 +289,7 @@ namespace ppsspp
|
||||
}
|
||||
else if ((address & 0x3F800000) == 0x04000000)
|
||||
{
|
||||
return true;
|
||||
return address < 0x80000000; // Let's disallow kernel-flagged VRAM. We don't have it mapped and I am not sure if it's accessible.
|
||||
}
|
||||
else if ((address & 0xBFFFC000) == 0x00010000)
|
||||
{
|
||||
|
@ -97,7 +97,7 @@ uintptr_t getasbaddr(const HookParam &hp)
|
||||
try
|
||||
{
|
||||
auto ordinal = std::stoi(hp.function);
|
||||
function = GetProcAddress(GetModuleHandleW(hp.module), (LPCSTR)ordinal);
|
||||
function = GetProcAddress(GetModuleHandleW(hp.module), (LPCSTR)(uintptr_t)ordinal);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
set(VERSION_MAJOR 5)
|
||||
set(VERSION_MINOR 58)
|
||||
set(VERSION_PATCH 7)
|
||||
set(VERSION_MAJOR 6)
|
||||
set(VERSION_MINOR 0)
|
||||
set(VERSION_PATCH 0)
|
||||
set(VERSION_REVISION 0)
|
||||
add_definitions(-DVERSION_MAJOR=${VERSION_MAJOR})
|
||||
add_definitions(-DVERSION_MINOR=${VERSION_MINOR})
|
||||
|
@ -48,7 +48,7 @@ class AttachProcessDialog(saveposwindow):
|
||||
self.setWindowTitle(
|
||||
"选择进程_当前权限_" + ("管理员" if windows.IsUserAnAdmin() else "非管理员")
|
||||
)
|
||||
self.setWindowIcon(qtawesome.icon("fa.gear"))
|
||||
self.setWindowIcon(qtawesome.icon(globalconfig["toolbutton"]["buttons"]["selectgame"]["icon"]))
|
||||
w = QWidget()
|
||||
self.layout1 = QVBoxLayout()
|
||||
self.label = LLabel(
|
||||
|
@ -1,5 +1,5 @@
|
||||
from qtsymbols import *
|
||||
import gobject, os
|
||||
import gobject, os, qtawesome
|
||||
from myutils.config import globalconfig, uid2gamepath
|
||||
from myutils.wrapper import Singleton_close
|
||||
from myutils.utils import getfilemd5, getimagefilefilter
|
||||
@ -29,6 +29,7 @@ class dialog_memory(saveposwindow):
|
||||
poslist=globalconfig["memorydialoggeo"],
|
||||
)
|
||||
self.setWindowTitle("备忘录")
|
||||
self.setWindowIcon(qtawesome.icon(globalconfig["toolbutton"]["buttons"]["memory"]["icon"]))
|
||||
formLayout = QVBoxLayout() #
|
||||
self.showtext = QTextEdit()
|
||||
self.rwpath = gobject.getuserconfigdir(
|
||||
|
@ -93,7 +93,7 @@ class dialog_savedgame_integrated(saveposwindow):
|
||||
| Qt.WindowType.WindowCloseButtonHint,
|
||||
poslist=globalconfig["savegamedialoggeo"],
|
||||
)
|
||||
self.setWindowIcon(qtawesome.icon("fa.gear"))
|
||||
self.setWindowIcon(qtawesome.icon(globalconfig["toolbutton"]["buttons"]["gamepad_new"]["icon"]))
|
||||
w, self.internallayout = getboxlayout(
|
||||
[], margin0=True, makewidget=True, both=True
|
||||
)
|
||||
|
@ -558,7 +558,7 @@ class hookselect(closeashidewindow):
|
||||
self.widget = QWidget()
|
||||
|
||||
self.setCentralWidget(self.widget)
|
||||
self.setWindowIcon(qtawesome.icon("fa.gear"))
|
||||
self.setWindowIcon(qtawesome.icon(globalconfig["toolbutton"]["buttons"]["selecttext"]["icon"]))
|
||||
self.hboxlayout = QHBoxLayout()
|
||||
self.widget.setLayout(self.hboxlayout)
|
||||
self.vboxlayout = QVBoxLayout()
|
||||
|
@ -229,22 +229,13 @@ def on_not_find_qweb(self):
|
||||
|
||||
|
||||
def resetgroudswitchcallback(self, group):
|
||||
|
||||
if group == "QWebEngine" and not gobject.testuseqwebengine():
|
||||
self.seletengeinecombo.blockSignals(True)
|
||||
visengine_internal = ["textbrowser", "webview", "QWebEngine"]
|
||||
globalconfig["rendertext_using"] = visengine_internal[
|
||||
self.seletengeinecombo.lastindex
|
||||
]
|
||||
self.seletengeinecombo.setCurrentIndex(self.seletengeinecombo.lastindex)
|
||||
self.seletengeinecombo.blockSignals(False)
|
||||
on_not_find_qweb(self)
|
||||
return
|
||||
if group == "QWebEngine":
|
||||
group = "webview"
|
||||
clearlayout(self.goodfontsettingsformlayout)
|
||||
|
||||
goodfontgroupswitch = SuperCombo()
|
||||
self.seletengeinecombo.lastindex = self.seletengeinecombo.currentIndex()
|
||||
if group == "webview" or group == "QWebEngine":
|
||||
if group == "webview":
|
||||
_btn = LPushButton("编辑")
|
||||
_btn.clicked.connect(lambda: extrahtml(self))
|
||||
switch = getsimpleswitch(
|
||||
@ -263,8 +254,7 @@ def resetgroudswitchcallback(self, group):
|
||||
getboxlayout([switch, _btn]),
|
||||
)
|
||||
self.goodfontsettingsformlayout.addRow(SplitLine())
|
||||
if group == "QWebEngine":
|
||||
group = "webview"
|
||||
|
||||
__form = LFormLayout()
|
||||
__form.addRow("字体样式", goodfontgroupswitch)
|
||||
self.goodfontsettingsformlayout.addRow(__form)
|
||||
@ -304,8 +294,8 @@ def creategoodfontwid(self):
|
||||
|
||||
def _createseletengeinecombo(self):
|
||||
|
||||
visengine = ["Qt", "Webview2"] # , "QWebEngine"]
|
||||
visengine_internal = ["textbrowser", "webview"] # , "QWebEngine"]
|
||||
visengine = ["Qt", "Webview2"]
|
||||
visengine_internal = ["textbrowser", "webview"]
|
||||
self.seletengeinecombo = getsimplecombobox(
|
||||
visengine,
|
||||
globalconfig,
|
||||
|
@ -37,7 +37,7 @@ from gui.dynalang import LDialog, LFormLayout
|
||||
def __create(self):
|
||||
self.selectbutton = getIconButton(
|
||||
gobject.baseobject.createattachprocess,
|
||||
icon="fa.gear",
|
||||
icon=globalconfig["toolbutton"]["buttons"]["selectgame"]["icon"],
|
||||
enable=globalconfig["sourcestatus2"]["texthook"]["use"],
|
||||
)
|
||||
return self.selectbutton
|
||||
@ -46,7 +46,7 @@ def __create(self):
|
||||
def __create2(self):
|
||||
self.selecthookbutton = getIconButton(
|
||||
lambda: gobject.baseobject.hookselectdialog.showsignal.emit(),
|
||||
icon="fa.gear",
|
||||
icon=globalconfig["toolbutton"]["buttons"]["selecttext"]["icon"],
|
||||
enable=globalconfig["sourcestatus2"]["texthook"]["use"],
|
||||
)
|
||||
return self.selecthookbutton
|
||||
@ -613,7 +613,7 @@ def setTabOne_lazy_h(self, basel: QVBoxLayout):
|
||||
"游戏管理",
|
||||
D_getIconButton(
|
||||
lambda: dialog_savedgame_integrated(self),
|
||||
icon="fa.gamepad",
|
||||
icon=globalconfig["toolbutton"]["buttons"]["gamepad_new"]["icon"],
|
||||
),
|
||||
"",
|
||||
],
|
||||
|
@ -329,7 +329,7 @@ class showocrimage(saveposwindow):
|
||||
self.originimage = None
|
||||
super().__init__(parent, poslist=globalconfig["showocrgeo"])
|
||||
self.setWindowIcon(qtawesome.icon("fa.picture-o"))
|
||||
self.setWindowTitle("截图")
|
||||
self.setWindowTitle("查看")
|
||||
self.originlabel = pixmapviewer()
|
||||
qw = QWidget()
|
||||
self.layout1 = QVBoxLayout()
|
||||
|
@ -928,6 +928,7 @@ class showdiction(LMainWindow):
|
||||
|
||||
self.resize(400, parent.height())
|
||||
self.setWindowTitle("查看")
|
||||
self.setWindowIcon(qtawesome.icon("fa.book"))
|
||||
self.tree = kpQTreeView(self)
|
||||
self.tree.setHeaderHidden(True)
|
||||
self.tree.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
|
||||
@ -1058,9 +1059,7 @@ class searchwordW(closeashidewindow):
|
||||
self.setWindowIcon(qtawesome.icon("fa.search"))
|
||||
self.thisps = {}
|
||||
self.hasclicked = False
|
||||
|
||||
ww = QWidget(self)
|
||||
self.setWindowIcon(qtawesome.icon("fa.gear"))
|
||||
self.vboxlayout = QVBoxLayout()
|
||||
ww.setLayout(self.vboxlayout)
|
||||
self.searchlayout = QHBoxLayout()
|
||||
|
@ -830,12 +830,13 @@ class resizableframeless(saveposwindow):
|
||||
self.starth - (gpos.y() - self.starty),
|
||||
)
|
||||
elif self._corner_drag_zuoxia:
|
||||
self.setgeokeepminsize(
|
||||
x, y, w, h = self.calculatexywh(
|
||||
(gpos - self.startxp).x(),
|
||||
self.y(),
|
||||
self.startw - (gpos.x() - self.startx),
|
||||
pos.y(),
|
||||
)
|
||||
self.setGeometry(x, self.y(), w, h)
|
||||
elif self._corner_drag_youxia:
|
||||
self.resize(pos.x(), pos.y())
|
||||
elif self._move_drag:
|
||||
@ -844,12 +845,15 @@ class resizableframeless(saveposwindow):
|
||||
def mouseReleaseEvent(self, e: QMouseEvent):
|
||||
self.resetflags()
|
||||
|
||||
def setgeokeepminsize(self, x, y, w, h):
|
||||
def setgeokeepminsize(self, *argc):
|
||||
self.setGeometry(*self.calculatexywh(*argc))
|
||||
|
||||
def calculatexywh(self, x, y, w, h):
|
||||
width = max(w, self.minimumWidth())
|
||||
height = max(h, self.minimumHeight())
|
||||
x -= width - w
|
||||
y -= height - h
|
||||
self.setGeometry(x, y, width, height)
|
||||
return x, y, width, height
|
||||
|
||||
|
||||
class Prompt_dialog(LDialog):
|
||||
|
@ -4,7 +4,7 @@ import gobject, uuid, json, os, functools, windows, time
|
||||
from urllib.parse import quote
|
||||
from myutils.config import globalconfig, static_data
|
||||
from myutils.wrapper import tryprint, threader
|
||||
from gui.usefulwidget import WebivewWidget, QWebWrap
|
||||
from gui.usefulwidget import WebivewWidget
|
||||
|
||||
testsavejs = False
|
||||
|
||||
@ -34,30 +34,27 @@ class TextBrowser(QWidget, dataget):
|
||||
event.size().width() - 2 * self._padding,
|
||||
event.size().height() - 2 * self._padding,
|
||||
)
|
||||
self.masklabel.resize(event.size())
|
||||
self.__makeborder(event.size())
|
||||
|
||||
def setselectable(self, b):
|
||||
self.masklabel.setHidden(b)
|
||||
self.selectable = b
|
||||
|
||||
def __init__(self, parent) -> None:
|
||||
super().__init__(parent)
|
||||
if globalconfig["rendertext_using"] == "QWebEngine":
|
||||
self.webivewwidget = QWebWrap(self)
|
||||
self.webivewwidget.on_load.connect(self.__loadextra)
|
||||
else:
|
||||
# webview2当会执行alert之类的弹窗js时,若qt窗口不可视,会卡住
|
||||
self.webivewwidget = WebivewWidget(self, usedarklight=False)
|
||||
self.selectable = False
|
||||
# webview2当会执行alert之类的弹窗js时,若qt窗口不可视,会卡住
|
||||
self.webivewwidget = WebivewWidget(self, usedarklight=False)
|
||||
|
||||
# webview2无法接收qt事件。
|
||||
webviewhwnd = self.webivewwidget.get_hwnd()
|
||||
self.wndproc = windows.WNDPROCTYPE(
|
||||
functools.partial(
|
||||
self.extrahandle,
|
||||
windows.GetWindowLongPtr(webviewhwnd, windows.GWLP_WNDPROC),
|
||||
)
|
||||
# webview2无法接收qt事件。
|
||||
webviewhwnd = self.webivewwidget.get_hwnd()
|
||||
self.wndproc = windows.WNDPROCTYPE(
|
||||
functools.partial(
|
||||
self.extrahandle,
|
||||
windows.GetWindowLongPtr(webviewhwnd, windows.GWLP_WNDPROC),
|
||||
)
|
||||
windows.SetWindowLongPtr(webviewhwnd, windows.GWLP_WNDPROC, self.wndproc)
|
||||
)
|
||||
windows.SetWindowLongPtr(webviewhwnd, windows.GWLP_WNDPROC, self.wndproc)
|
||||
|
||||
self.masklabel_left = QLabel(self)
|
||||
self.masklabel_left.setMouseTracking(True)
|
||||
# self.masklabel_left.setStyleSheet('background-color:red')
|
||||
@ -70,8 +67,6 @@ class TextBrowser(QWidget, dataget):
|
||||
self.masklabel_top.setMouseTracking(True)
|
||||
# self.masklabel_bottom.setStyleSheet('background-color:red')
|
||||
self.saveclickfunction = {}
|
||||
self.masklabel = QLabel(self.webivewwidget)
|
||||
self.masklabel.setMouseTracking(True)
|
||||
self.webivewwidget.navigate(
|
||||
os.path.abspath(r"LunaTranslator\rendertext\webview.html")
|
||||
)
|
||||
@ -81,7 +76,6 @@ class TextBrowser(QWidget, dataget):
|
||||
self.webivewwidget.bind("calllunaheightchange", self.calllunaheightchange)
|
||||
self.saveiterclasspointer = {}
|
||||
self.isfirst = True
|
||||
self._qweb_query_word()
|
||||
|
||||
@threader
|
||||
def trackingthread(self):
|
||||
@ -102,7 +96,7 @@ class TextBrowser(QWidget, dataget):
|
||||
if wp == windows.WM_LBUTTONDOWN:
|
||||
# 因为有父窗口,所以msg是WM_PARENTNOTIFY,wp才是WM_LBUTTONDOWN
|
||||
# 而且SetCapture后会立即被父窗口把capture夺走,无法后面的释放&移动,所以只能开个线程来弄
|
||||
if self.masklabel.isVisible():
|
||||
if not self.selectable:
|
||||
self.trackingthread()
|
||||
return windows.WNDPROCTYPE(orig)(hwnd, msg, wp, lp)
|
||||
|
||||
@ -162,7 +156,6 @@ class TextBrowser(QWidget, dataget):
|
||||
self.debugeval(
|
||||
f'create_internal_text("{style}","{styleargs}","{_id}","{name}","{text}","{args}");'
|
||||
)
|
||||
self._qweb_query_h()
|
||||
|
||||
def create_internal_rubytext(self, style, styleargs, _id, tag, args):
|
||||
tag = quote(json.dumps(tag))
|
||||
@ -172,41 +165,6 @@ class TextBrowser(QWidget, dataget):
|
||||
f'create_internal_rubytext("{style}","{styleargs}","{_id}","{tag}","{args}");'
|
||||
)
|
||||
|
||||
self._qweb_query_h()
|
||||
|
||||
# js api end
|
||||
# native api
|
||||
def _qweb_query_value_callback(self, name, callback):
|
||||
|
||||
def __receiver(callback, value):
|
||||
if not value:
|
||||
return
|
||||
self.webivewwidget.eval(f"{name}=null")
|
||||
callback(value)
|
||||
|
||||
self.webivewwidget.eval(name, functools.partial(__receiver, callback))
|
||||
|
||||
def _qweb_query_h(self):
|
||||
if not isinstance(self.webivewwidget, QWebWrap):
|
||||
return
|
||||
self._qweb_query_value_callback("window.__resolve_h", self.calllunaheightchange)
|
||||
|
||||
def _qweb_query_word(self):
|
||||
if not isinstance(self.webivewwidget, QWebWrap):
|
||||
return
|
||||
t = QTimer(self)
|
||||
t.setInterval(100)
|
||||
|
||||
def __intervaledqueryword():
|
||||
|
||||
self._qweb_query_value_callback(
|
||||
"window.__resolve_word", self.calllunaclickedword
|
||||
)
|
||||
|
||||
t.timeout.connect(__intervaledqueryword)
|
||||
t.timeout.emit()
|
||||
t.start()
|
||||
|
||||
def calllunaheightchange(self, h):
|
||||
extra_space = globalconfig["extra_space"]
|
||||
extra_space_trans = globalconfig["extra_space_trans"]
|
||||
|
@ -47,7 +47,6 @@ class TS(basetrans):
|
||||
"Referer": "https://fanyi.baidu.com/mtpe-individual/multimodal",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
|
||||
"sec-ch-ua": '"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
from urllib import parse
|
||||
from myutils.config import static_data
|
||||
from translator.basetranslator import basetrans
|
||||
|
||||
|
||||
@ -32,15 +31,9 @@ class TS(basetrans):
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
}
|
||||
|
||||
data = (
|
||||
"text="
|
||||
+ parse.quote(query)
|
||||
+ "&target_lang="
|
||||
+ self.tgtlang
|
||||
+ "&source_lang="
|
||||
+ self.srclang
|
||||
)
|
||||
|
||||
data = "text=" + parse.quote(query) + "&target_lang=" + self.tgtlang
|
||||
if self.srclang != "auto":
|
||||
data += "&source_lang=" + self.srclang
|
||||
response = self.proxysession.post(
|
||||
endpoint, headers=headers, verify=False, data=data
|
||||
)
|
||||
|
@ -38,36 +38,17 @@ class TS(basetrans):
|
||||
},
|
||||
verify=False,
|
||||
).text
|
||||
# print(html)
|
||||
# self.bl=re.search('"cfb2h":"(.*?)"',html).groups()[0]
|
||||
# self.fsid=re.search('"FdrFJe":"(.*?)"',html).groups()[0]
|
||||
|
||||
def realfy1(self, content):
|
||||
t1 = time.time()
|
||||
param = json.dumps([[content, self.srclang, self.tgtlang, True], [1]])
|
||||
# print([content, 'ja', 'zh-CN', True])
|
||||
freq = json.dumps([[["MkEWBc", param, None, "generic"]]])
|
||||
freq = {"f.req": freq}
|
||||
freq = urlencode(freq)
|
||||
# print(freq)
|
||||
# params = {
|
||||
# 'rpcids': 'MkEWBc',
|
||||
# 'source-path': '/',
|
||||
# 'f.sid': self.fsid,
|
||||
# 'bl': self.bl,
|
||||
# 'hl': 'zh-CN',
|
||||
# 'soc-app': '1',
|
||||
# 'soc-platform': '1',
|
||||
# 'soc-device': '1',
|
||||
# '_reqid': '86225',
|
||||
# 'rt': 'c',
|
||||
# }
|
||||
|
||||
headers = {
|
||||
"Origin": "https://translate.google.com",
|
||||
"Referer": "https://translate.google.com",
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ class TS(basetrans):
|
||||
"ko": "KR",
|
||||
"es": "SP",
|
||||
"ru": "RU",
|
||||
"auto": "AUTO",
|
||||
}
|
||||
|
||||
def inittranslator(self):
|
||||
@ -42,11 +43,11 @@ class TS(basetrans):
|
||||
}
|
||||
|
||||
headers = {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
|
||||
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
||||
"Accept-Language": "zh-CN,zh;q=0.9,ar;q=0.8,sq;q=0.7,ru;q=0.6",
|
||||
"Cache-Control": "no-cache",
|
||||
"Connection": "keep-alive",
|
||||
# 'Cookie': 'OUTFOX_SEARCH_USER_ID_NCOO=1687808799.7930427; OUTFOX_SEARCH_USER_ID=883935257@114.94.0.34; UM_distinctid=190bd0ad3d54a1-0822da004c7e09-26001f51-1bcab9-190bd0ad3d6788; _uetsid=b9841280a0d111ef9208815fe9e30d9a; _uetvid=224af48054ce11efa8cdedcb91b3a5c6',
|
||||
"Origin": "https://m.youdao.com",
|
||||
"Pragma": "no-cache",
|
||||
"Referer": "https://m.youdao.com/translate",
|
||||
@ -55,8 +56,8 @@ class TS(basetrans):
|
||||
"Sec-Fetch-Site": "same-origin",
|
||||
"Sec-Fetch-User": "?1",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Mobile/15E148 Safari/604.1",
|
||||
"sec-ch-ua": '"Microsoft Edge";v="105", "Not)A;Brand";v="8", "Chromium";v="105"',
|
||||
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
|
||||
"sec-ch-ua": '"Google Chrome";v="129", "Not=A?Brand";v="8", "Chromium";v="129"',
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
"sec-ch-ua-platform": '"Windows"',
|
||||
}
|
||||
@ -66,12 +67,15 @@ class TS(basetrans):
|
||||
data=data,
|
||||
headers=headers,
|
||||
cookies={
|
||||
"_yd_btn_fanyi_29": "true",
|
||||
"_yd_newbanner_day": "29",
|
||||
"OUTFOX_SEARCH_USER_ID_NCOO": "1687808799.7930427",
|
||||
"OUTFOX_SEARCH_USER_ID": "883935257@114.94.0.34",
|
||||
"UM_distinctid": "190bd0ad3d54a1-0822da004c7e09-26001f51-1bcab9-190bd0ad3d6788",
|
||||
"_uetsid": "b9841280a0d111ef9208815fe9e30d9a",
|
||||
"_uetvid": "224af48054ce11efa8cdedcb91b3a5c6",
|
||||
},
|
||||
).text
|
||||
|
||||
return re.search(
|
||||
'<ul id="translateResult">([\\s\\S]*?)<li>([\\s\\S]*?)</li>([\\s\\S]*?)<\/ul>',
|
||||
r'<ul id="translateResult">([\s\S]*?)<li>([\s\S]*?)</li>([\s\S]*?)<\/ul>',
|
||||
response,
|
||||
).groups()[1]
|
||||
|
@ -33,7 +33,6 @@ class TS(basetrans):
|
||||
}
|
||||
headers = {
|
||||
"Connection": "Keep-Alive",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Accept": "*/*",
|
||||
"User-Agent": "Youdao Desktop Dict (Windows NT 10.0)",
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user