本帖最后由 shane007 于 2023-9-5 15:50 编辑
) d2 |" S X) x& r* |6 O4 ^, u* u( B4 K2 p% t, f! z2 h
glCallLists的调用处,共有三处。
, w8 T9 F- H( X此三处估计是对应游戏中三类不同的字幕。' |: f% R( K6 U. ]
接下去分析清楚接口之后,大算用函数替换的方法来实现汉化。0 R+ z) A" o" D; k4 E
分析的文件名,748 KB (765,952 字节)1 S5 U2 h' O4 ?" n
toh.exe8 x9 R1 }7 N/ q) D: z S' j* S9 H2 l
7 I! e: Q1 \$ h经过hook验证,第3处没有被使用。屏幕上找到一句字幕之后,用cheatengine下断点,在以下地方断下,! {) r/ |' h+ [: j- x" {5 t9 e
等日后再仔细研究,看显示函数究竟在哪里。9 M2 {+ o/ W5 t
6 f* E- ~; v" b* ^: D, ?7 g. |toh.exe+316C8 - 8B 45 F8 - mov eax,[ebp-08]
' o* q" g0 `/ x0 H& Y7 i004316C8
: T: o# ^2 E- p# j7 R8 ^" K( M) y: }$ @) n7 Z+ w! q k6 @" [) s
第1处$ n* I; B7 y0 O8 z( G+ w
- void sub_4519B8(char *a1, ...)
* r4 c9 x2 y3 f4 m' K* J - {
8 G3 `6 z( W0 M" I& z9 l - GLsizei v1; // eax3 g. W: l C ^$ m
- char lists; // [esp+4h] [ebp-800h]; m# C1 P$ a$ L' L: `2 R$ q7 a
- va_list va; // [esp+810h] [ebp+Ch]3 T+ G$ W0 Z9 u9 W
- 5 n5 ~% o9 `: g+ P
- va_start(va, a1); Q3 H( R# T3 {) x
- if ( a1 )- {/ E* V1 k) ?5 `" C
- {
! r/ P- H! \; V3 @) o$ ~9 s - vsprintf(&lists, a1, va);$ T' c4 t/ t* Z/ D; [
- glPushAttrib(0x20000u);* D3 w H4 ^! D# c) r5 O
- glListBase(base);# v. E% V( K' i6 q/ v) C
- v1 = strlen(&lists);* {& W# Z3 P* V: f& C- o5 C
- glCallLists(v1, 0x1401u, &lists);
( o$ P* h1 O+ m- O - glPopAttrib();3 _& o9 T5 C: Z+ a
- }
6 b9 v# w& [3 N$ J - }
复制代码
% y& i" E- }; q6 J) o1 ]1 b: z第2处
. o/ M7 m6 M& T% L8 Z- void sub_451A3A(GLint x, int a2, int a3, char *a4, ...)
, L q/ k6 Z; O, s4 i+ J - {
& M7 B! Q& c2 `+ }& Z2 ^0 k9 B" Q - int v4; // eax. @0 S- D- i5 F6 h0 n/ M/ p6 j
- GLsizei v5; // eax
7 T7 v( G: ], u8 P |6 I5 L - char lists; // [esp+4h] [ebp-800h]
: U, h" Y0 S: ~ - va_list va; // [esp+81Ch] [ebp+18h]1 k! f3 B$ g4 @- H1 g9 h
- 1 L6 I' |. Z7 ~ Q- M# Y9 r+ ~
- va_start(va, a4);) }' { D( Y$ v2 ?. P' ~: Z7 d
- if ( a4 ) C& _# \& J: v% [6 }5 D0 a5 x
- {$ J% i! H" G( h: p( S( x+ m. ^$ {- a
- sub_44FDD0(a3);
" N% I& ~4 p c; [) J - v4 = sub_40BB44();1 W; y# ?# b; a+ r; u! a
- glRasterPos2i(x, v4 - a2);
% X) }, o7 z9 q - vsprintf(&lists, a4, va);* a" M& }: |$ c" p4 y
- glPushAttrib(0x20000u);% C# b0 K5 l6 A' A) |2 ^
- glListBase(base);
; e/ [- n. G5 P3 ?* n - v5 = strlen(&lists);& c$ p D+ {) J
- glCallLists(v5, 0x1401u, &lists);
- c9 D3 L% N+ P1 a9 U: R. y - glPopAttrib();
" S3 R" W- i2 y- ~8 _9 G - }9 p% X6 l; Q7 v) N" L) H6 D
- }
复制代码 ( @$ l& U# I8 L
; j7 q. |9 h& g; N1 e
6 p4 s6 u" y2 u A第3处- void sub_451D7C(int a1, GLint y, int a3, int a4, int a5, GLuint base, char *a7, ...)
5 W" e) s/ f8 a, R5 g& k5 E5 | - {
, B& y% D7 v' U6 D/ o- [ - GLvoid *v7; // ST08_4
$ c) ?" T* a+ p( @ - GLsizei v8; // eax( Q4 Z0 G+ K7 m. I* ]0 ?
- int v9; // [esp+0h] [ebp-1018h]
, [" o: L/ q: I+ k/ n6 I ? - char v10; // [esp+8h] [ebp-1010h]
/ _% W9 r7 M: k- V$ R. Z - GLvoid *lists; // [esp+100Ch] [ebp-Ch]' l3 T/ `, }% [3 r' s, t
- char v12[5]; // [esp+1013h] [ebp-5h]
& c8 \& ?/ G2 r" I6 L% e4 I; ? - va_list va; // [esp+103Ch] [ebp+24h]
* [, O" B! m- z. w$ k/ u
5 y* K# f, F! }/ G6 E+ m( i& J0 h- va_start(va, a7);
" |5 e( |" i% N# c; O6 l! l - v9 = 1;- P+ F3 x+ b$ t6 N2 l: P
- if ( a7 )
9 {( c$ ?# c3 T% s" T/ l - {& S! b0 r: g7 x+ Y7 [! k
- vsprintf(&v10, a7, va);
% w* N# u! }' R( G' E. Q* O - glPushAttrib(0x20000u);" P1 J' w, N; q
- glListBase(base);+ M, ]' _3 Q j$ |- L
- lists = &v10;
5 I( p$ J0 z* q, r- ` - do
! [; ]3 }9 J$ b- M4 | - {% f7 G/ Y+ s, ?* i/ [! H
- *(_DWORD *)&v12[1] = lists;
, G+ ~! V2 ^! h" y1 _* \0 @+ k& D - while ( **(_BYTE **)&v12[1] && **(_BYTE **)&v12[1] != 10 )
' C: n+ q- w- r! u7 l - ++*(_DWORD *)&v12[1];' g* ?! ]+ | K
- v12[0] = **(_BYTE **)&v12[1];
+ b! g( G; n0 u2 t+ J) @' a - **(_BYTE **)&v12[1] = 0;
7 }: V( R* s2 t B8 u' F7 B - if ( v12[0] == 10 && *(GLvoid **)&v12[1] != lists && *(_BYTE *)(*(_DWORD *)&v12[1] - 1) == 13 )
! R7 D0 @8 D( g( t - *(_BYTE *)(*(_DWORD *)&v12[1] - 1) = 0;5 w- e& h) r: N5 W6 p- H) n$ ^
- y -= a5;
+ `( V* U* ?9 U2 O& | - glRasterPos2i(*(_DWORD *)a4 + a1, y);* }4 V2 z+ a# o: T9 V
- v7 = lists;1 _" }! K @* n& D4 L6 v( h
- v8 = strlen((const char *)lists);
) k$ B/ i' r# o% u! w - glCallLists(v8, 0x1401u, v7);2 o; D+ H$ q# u) C7 C
- if ( v9 < a3 )
1 R0 e3 N7 H4 y$ X- a7 A( N6 U4 Q - a4 += 4;% \; o2 f9 u7 M7 |1 [/ z0 d
- ++v9;
8 _) ^$ X. d: V: e; @* a% g - lists = (GLvoid *)(*(_DWORD *)&v12[1] + 1);
/ D6 b: [ ^, { - }
5 r+ L3 }1 D1 s# W - while ( v12[0] );
5 \5 ]7 }5 |5 W# Y7 N+ `$ h( C% r - glPopAttrib();
' D& `$ y J& z$ ~. f4 [" O - }
+ v: ~4 x' ^& |/ r0 N: |* X/ x - }
复制代码
( u* ?4 {# t6 f( [; e
6 y( b. j( ~/ [# Y8 l& u5 f& s2 ]% A) y8 n- \& G* e
, O% {7 ~ k* y1 Q
0 S% L) r- i9 Q$ r# v. A% F
, I, b+ P! f! S5 ]9 I: k
+ k5 S8 g- X5 R) R) r8 |2 d! W8 x, o
|