本帖最后由 shane007 于 2023-9-5 15:50 编辑 1 z) E2 @ Z4 B7 l$ N- x) B5 F
, G' h" `1 Y) E4 V& _glCallLists的调用处,共有三处。3 F: n! F _# A. S% W5 v& u7 p
此三处估计是对应游戏中三类不同的字幕。, s& d, p& E' r6 d2 v1 i
接下去分析清楚接口之后,大算用函数替换的方法来实现汉化。- q$ r3 \6 p2 {
分析的文件名,748 KB (765,952 字节)
+ I8 F! M: o" u4 Ltoh.exe
9 A+ {% k( p: u0 }2 ~: o0 P J9 m! b; e8 Y1 F
经过hook验证,第3处没有被使用。屏幕上找到一句字幕之后,用cheatengine下断点,在以下地方断下,
! h, u( @( G" B) ^; `3 O等日后再仔细研究,看显示函数究竟在哪里。5 e9 e; |' o9 ?: q1 a$ V; @
3 {, B) T1 U3 b6 n/ A, C$ ^
toh.exe+316C8 - 8B 45 F8 - mov eax,[ebp-08]# u# N( r% q* O, P) b) ]8 ^% w
004316C8
! Z r" o/ y" n8 E! d* l ~9 p; }* S$ J2 |
第1处
: q9 y4 Z# f8 h3 j/ h, [- void sub_4519B8(char *a1, ...)
0 }4 P# g$ h) Y, E4 g G, { - {
. R8 Z) B8 b/ U6 U - GLsizei v1; // eax2 n7 y; I% d3 _6 X; U
- char lists; // [esp+4h] [ebp-800h]
8 y- s* d( D* D3 E5 @7 S, v - va_list va; // [esp+810h] [ebp+Ch]
% C; t0 @5 X! Q, w( \ - . ~. M. u- W6 Q2 l9 ^- _
- va_start(va, a1); d$ b Q" {+ Q$ f5 `6 N
- if ( a1 )* ]$ T$ E0 U( C! e) Z+ q* l( o
- {
% g* F5 W: y2 ~- C - vsprintf(&lists, a1, va);' a5 G9 Y5 {; d* K
- glPushAttrib(0x20000u);
0 m+ d3 A$ z8 J# w - glListBase(base);
; U& Y) e2 T9 [ - v1 = strlen(&lists);9 `* ]( c# n* z" P* r
- glCallLists(v1, 0x1401u, &lists);# F: \" _, A& d+ i
- glPopAttrib();
6 s `, E5 c3 l% h& \& T# m# J. Q - }
, ^# n% |2 R! X - }
复制代码
4 i6 a W% L4 |第2处5 |' v6 j% A; u( W* C
- void sub_451A3A(GLint x, int a2, int a3, char *a4, ...)
% w8 n, y5 C, ~2 _# H - {
5 Z) ^, i3 Y9 \% g ` - int v4; // eax
3 p* ^4 K$ |' A, C8 n - GLsizei v5; // eax
" t" u0 J7 s& I! a, G6 N - char lists; // [esp+4h] [ebp-800h], p. ^ A, M3 N: D. Z
- va_list va; // [esp+81Ch] [ebp+18h]
7 K# W6 o. R& u# }( } - " c3 J0 i' W$ v' s
- va_start(va, a4);
+ g; ~" ~' d3 \ - if ( a4 ); `8 M4 {- p5 _4 p# k/ \
- {, k( j/ M/ m! m6 P: v
- sub_44FDD0(a3);% c$ T. y: x, K7 W1 w% H. T
- v4 = sub_40BB44();
+ a, A9 [$ o2 Z - glRasterPos2i(x, v4 - a2);* A9 h5 w" M2 r% R& c9 i9 ]# j2 R
- vsprintf(&lists, a4, va);
/ M+ k7 B+ r9 ^# d d9 ~4 D, W - glPushAttrib(0x20000u);7 c" o* `- P S! X* S
- glListBase(base);
/ g# I3 p# W0 \* z& a7 Y - v5 = strlen(&lists);
3 x# D7 y0 H; i/ `, i- L - glCallLists(v5, 0x1401u, &lists);
$ k* S" o& `6 C/ P! a& o - glPopAttrib();0 {; U, F/ x8 W" ?% _) {
- }1 B# {3 P0 d, m; `
- }
复制代码 2 S$ w( Y: H( v3 N8 C6 l
/ o- c$ Q' U! y# C
1 k& k7 x! t3 Q' ~6 Z第3处- void sub_451D7C(int a1, GLint y, int a3, int a4, int a5, GLuint base, char *a7, ...)
5 ]% f. u& i" H. `. { - {
# x4 U& n k' w9 f( k: p% @8 L0 w - GLvoid *v7; // ST08_4 |* _% p% G2 o6 V9 p3 F, y
- GLsizei v8; // eax
! c5 B: {9 T u: |9 `3 v - int v9; // [esp+0h] [ebp-1018h]
7 K3 v# L% K/ s7 I6 b - char v10; // [esp+8h] [ebp-1010h]" g$ x( S2 Q* e; S6 F% W- g
- GLvoid *lists; // [esp+100Ch] [ebp-Ch]
6 r$ K6 T* s! g5 C - char v12[5]; // [esp+1013h] [ebp-5h]- \3 t q6 } F ~. z
- va_list va; // [esp+103Ch] [ebp+24h]
* x. s2 y/ ?$ v# i - * ~* D C1 ?0 g% Y
- va_start(va, a7);
) g& e+ S0 e. Z4 u1 d - v9 = 1;
# e# @ E* L5 V) e& X) f - if ( a7 )
+ a+ ^/ {) o: W2 Y: z9 `% I, E - {2 [2 S( A& |: m; f* M4 W1 V
- vsprintf(&v10, a7, va);
, i' w. Q9 |. f/ j: ~ I$ A - glPushAttrib(0x20000u);' [5 ~7 P# v1 P- `) ]7 s" p, b
- glListBase(base);5 H# j% y2 E: E+ ]
- lists = &v10;
j4 t1 L$ N$ ]1 { - do, j* x, V- |4 [* u
- {
" \/ s* S6 z) ~# F1 B) b - *(_DWORD *)&v12[1] = lists;7 i; W+ p; D K, u& ]- t
- while ( **(_BYTE **)&v12[1] && **(_BYTE **)&v12[1] != 10 )
6 ]0 _5 b. z( n. s. H7 f8 g7 p - ++*(_DWORD *)&v12[1];
. A1 n' n# f* j( v5 H8 [4 m& r# Z - v12[0] = **(_BYTE **)&v12[1];9 ^( {" S# O7 E7 z
- **(_BYTE **)&v12[1] = 0;# I1 L( q0 [9 j* u$ ^1 S
- if ( v12[0] == 10 && *(GLvoid **)&v12[1] != lists && *(_BYTE *)(*(_DWORD *)&v12[1] - 1) == 13 )3 p; {( Q& `3 r0 H+ H
- *(_BYTE *)(*(_DWORD *)&v12[1] - 1) = 0;( n! Z' P$ H' u1 Q6 N
- y -= a5;
1 d/ {" Y+ L% f3 x - glRasterPos2i(*(_DWORD *)a4 + a1, y);
( A7 \" h0 l' }7 u% d - v7 = lists;2 a0 c! z1 o" b2 @0 P
- v8 = strlen((const char *)lists);
) k# d+ |% v1 y- }1 w8 s0 i - glCallLists(v8, 0x1401u, v7);
* D2 w- o* O; E% e# m, y6 N% R/ Y1 N - if ( v9 < a3 )
' t9 O. K" P" N s( M3 A* ? - a4 += 4;
% I5 ?, j5 y, A" f - ++v9;
) a- p5 l4 O2 b - lists = (GLvoid *)(*(_DWORD *)&v12[1] + 1); C8 P! P- x) n% u: P8 T7 r) ?
- }1 u" {- V. ]" m6 f5 |
- while ( v12[0] );
: m1 _! h/ f; M2 O& p - glPopAttrib();
. ^" y2 a' O& Q3 e: B( `9 h - }+ ~5 [) H# ?7 n( h2 P8 }
- }
复制代码
6 y2 ]& E1 O. H5 ]& G7 z& _- m* G$ |" k8 \: N8 v
. N8 }$ i, A7 x
6 C7 T3 V: ?- x; ^5 l0 h
3 S0 i+ p6 W( d2 R' A& K1 o- N- [) W- V* ?9 {. H9 l
- d& U% H) l# l$ F3 L0 q) A8 y; f( N& ?0 O7 r
|