本帖最后由 shane007 于 2023-8-26 17:10 编辑
) `: S0 R1 f0 Q
, Z1 ^) c) U# A这个游戏的主要修改点在\player\BuildingBlocks目录下的Adventure.dll中。
& j% C/ m, D# N' F# C用API monitor对本DLL的CreateFontA函数进行跟踪,发现确实有调用, 参数如下。* I; O* K8 A: r9 E
) s; h+ B6 M7 o* ?! {. Z
- # Type Name Pre-Call Value Post-Call Value6 X% `3 B% F) L0 [+ y
- 1 int nHeight 0xfffffff0 0xfffffff0
, `4 _. \7 Z% d$ ^2 B1 S7 [& J& H - 2 int nWidth 0x00000000 0x00000000! N7 f( D. W% p: Y) K& h: a, g
- 3 int nEscapement 0x00000000 0x00000000
: e4 e5 c! X# n5 w; j6 E - 4 int nOrientation 0x00000000 0x00000000
7 T7 T6 b( ]- F* }! V - 5 int fnWeight FW_NORMAL FW_NORMAL
! l% n/ s5 D- j: J, ? - 6 DWORD fdwItalic 0x00000000 0x00000000
8 t* {" j* w% K - 7 DWORD fdwUnderline 0x00000000 0x00000000, G- L! O) M: D2 ]5 a$ D
- 8 DWORD fdwStrikeOut 0x00000000 0x000000006 B, P# R3 s0 c' r" F, e( x: v' F
- 9 DWORD fdwCharSet DEFAULT_CHARSET DEFAULT_CHARSET Q1 K( G0 ]3 E3 r; v. }) }( P
- 10 DWORD fdwOutputPrecision OUT_TT_ONLY_PRECIS OUT_TT_ONLY_PRECIS
) B& P( G" C8 P$ u1 A5 z - 11 DWORD fdwClipPrecision CLIP_DEFAULT_PRECIS CLIP_DEFAULT_PRECIS6 F! E- K+ F( g- r
- 12 DWORD fdwQuality PROOF_QUALITY PROOF_QUALITY
, v7 C, r- \4 ? - 13 DWORD fdwPitchAndFamily FF_DONTCARE | DEFAULT_PITCH FF_DONTCARE | DEFAULT_PITCH$ k+ |& {. K! {
- 14 LPCTSTR lpszFace 0x09148a58 "Arial" 0x09148a58 "Arial"; t. n# N6 s U* w: H0 }7 A
复制代码 " ~8 s9 ]/ a5 B8 |
( @+ |3 m( G: e- J
用ida pro找到调用CreateFontA的源头函数如下。
+ ~6 U \. W; P# E; g; V从函数的参数可以看出,这应该就是字幕显示函数了。# U: U' q2 W6 G8 v: Z9 h9 \
关于后续修改,先修改CreateFontA函数的fdwCharSet,lpszFace这2个参数,也许就能出中文。
N. Y. P& t+ Y0 J8 E. O# z还不行的话,就自己写一个显示函数。以下函数中lpMultiByteStr就是指向字幕的指针。" d/ g$ C4 U0 E* V( v) t
- 5 z- j# ]2 m3 q# k* x$ S* w5 f
- bool __thiscall sub_10058A00(void *this, int a2, int a3, int a4, int nNumber, int a6, DWORD a7, int a8, int xRight, int yBottom, LPCSTR lpMultiByteStr)3 v0 y0 h$ f- s: k5 ?& G9 K/ t: S
- {
8 R) v- t+ _, o" T3 N0 p% E- S1 P, p - void *v11; // edi
1 G! k0 G; ^ U' b - int v12; // eax7 c A: N# o! i4 m i
- int v14; // ecx
8 {# E1 W% _9 p0 l! y - int v15; // eax: R5 R8 E0 l' B, c# l7 P7 f
- char *v16; // eax
0 q2 h- Q+ Y* n1 v - int v17; // eax
; p; R/ x9 V$ \8 f& ] - HDC v18; // ebp) w, @& c+ D0 |, I1 f" i7 I
- int v19; // eax
8 S$ @- A' Q9 @0 O+ w/ U/ A - int v20; // eax
+ @. U5 X+ E$ C* X - int v21; // esi( n: h% S# |5 l; k& ]; E
- char *v22; // eax. c# A. M' D( _5 x
- int v23; // esi
+ p S/ N) F1 B8 r9 b - int v24; // ecx
# V% ?1 }" W) |; I1 z: n; v" Z - HBRUSH v25; // eax
4 N: v r. b% ^. l% h - signed int v26; // ebx' _' f/ h P( r- w( M: j4 O
- WCHAR *v27; // eax0 [3 R9 y5 s5 o" {. i
- int v28; // esi
D# n& a8 F9 X4 l - int v29; // ecx
( ^* K8 c$ `: f4 h5 A8 r - int v30; // eax. p3 C0 s, i( j! m9 s# f* V
- int v31; // ST28_4
, q* }4 c# u- M. q J- ~7 a4 d - bool v32; // sf* Z: g6 q& X. _/ |
- unsigned __int8 v33; // of
+ I3 i3 }) ~" f5 y3 ~ - unsigned __int8 *v34; // ebx+ d6 O8 {. y2 o( q% y
- int v35; // ecx
+ D' f' S) u0 H8 Z7 ~( H7 s - int v36; // esi9 r0 a+ s. F6 R& }( N% }7 ?/ t
- int v37; // edx3 E8 C5 W( Y. q
- int v38; // eax/ W1 n9 ]: g. d8 [% [9 e
- unsigned __int8 *v39; // ecx
$ y9 }' X7 G; m - int v40; // [esp+40h] [ebp-2098h]
$ X, h, B! G/ D6 u9 O0 h6 f - signed int v41; // [esp+44h] [ebp-2094h]
7 t8 ?: B) r, \2 F( T( W* S - WCHAR *v42; // [esp+48h] [ebp-2090h]
7 j: Y! d! y0 i2 r - LPCSTR v43; // [esp+4Ch] [ebp-208Ch], h! n+ b; [/ e* f
- int v44; // [esp+50h] [ebp-2088h]0 H, x( q/ [8 |# D5 g0 Z
- HGDIOBJ v45; // [esp+54h] [ebp-2084h]; m: H. K* a! _$ N
- HGDIOBJ v46; // [esp+58h] [ebp-2080h]
/ M" H+ m/ Y9 G9 v7 \ p- ]+ } - HGDIOBJ v47; // [esp+60h] [ebp-2078h], F) l& w& {1 o9 s! R
- HFONT v48; // [esp+64h] [ebp-2074h], ?3 z5 E. G. ^+ S7 R# @
- float v49; // [esp+68h] [ebp-2070h], R0 F3 A) A y" D* }
- float v50; // [esp+6Ch] [ebp-206Ch]6 `# u0 C1 u5 V K5 H
- char v51; // [esp+70h] [ebp-2068h]4 k* C" I4 o2 k0 s6 A
- int v52; // [esp+74h] [ebp-2064h]. G( M* |/ I' O( h, V
- int v53; // [esp+78h] [ebp-2060h]
* B; V+ Y3 g5 `, |- P) e' { - int v54; // [esp+7Ch] [ebp-205Ch]. c$ D+ h% W7 l5 @7 c! p6 `- t7 S
- int v55; // [esp+84h] [ebp-2054h]* `3 H! ?5 a' d& Y, P6 i' }8 {
- struct tagSIZE v56; // [esp+88h] [ebp-2050h]
" N/ P" I! S7 L2 x4 U# q7 D" h - struct tagRECT rc; // [esp+90h] [ebp-2048h]
, x( V! r0 [3 c/ T. U - int v58; // [esp+A0h] [ebp-2038h]
( D' {6 ^( ]. P5 v1 [( `9 j' S - char v59; // [esp+A4h] [ebp-2034h]
; v* N2 B+ ^- c* U' J - WCHAR WideCharStr[4096]; // [esp+D4h] [ebp-2004h]
: ?( f3 I7 N1 w - / F% ~* ^) b7 B* I4 a3 Q1 e
- v11 = this;' H. Z$ d6 }0 O9 u1 ]; N% e
- v58 = 52;
7 _( ]' f* k4 C# [7 P* b+ _9 n& ^" \ - memset(&v59, 0, 0x30u);
/ w+ q+ G0 b$ @ - if ( *lpMultiByteStr ) }5 D& y. t# g7 x( G
- {) P6 k4 t' q" F; L
- v12 = MultiByteToWideChar(0xFDE9u, 0, lpMultiByteStr, -1, WideCharStr, 4096);
0 Q+ l9 |* E+ Z2 Y5 F - *((_DWORD *)v11 + 4) = v12;
* w& m) Y4 L7 ?" h9 A( ? - if ( v12 <= 1 )) u/ p6 C2 r! u6 u7 q6 d
- return 0;4 N$ N) h: z0 S0 J/ W
- *((_DWORD *)v11 + 4) = v12 - 1;7 U1 q) _8 {/ T. _4 V& o0 P
- qsort(WideCharStr, v12 - 1, 2u, sub_10057A40);6 B3 T0 s2 f/ q1 ^7 W# S$ _ |
- }
: s! o4 Q& Q0 Z' ^3 x# C5 M! K - else
6 i1 y- X: v3 Y O - {
; h) O6 l4 q+ F V. ^ - *((_DWORD *)v11 + 4) = 352;
. [8 S7 t3 t3 C5 M7 n1 n1 w - v14 = *((_DWORD *)v11 + 4);
0 j8 A3 I! o, Y( }6 ]+ P - v15 = 0;2 T5 l$ M% ?5 u5 ?& V
- do
$ P$ M) D( i# m X* p - {
! s; T, b5 K5 u! l - WideCharStr[v15] = v15 + 32;' M6 \) z7 E% C4 _4 M; X n, B
- ++v15;
' d# P0 @# u5 T - }! Y1 I: u" \. S+ `8 i
- while ( v15 < v14 );# E$ B; D4 N' l3 b4 K6 d1 `
- }$ f U* F. x3 J) _; k
- v16 = *(char **)v11;0 u9 B% A- {/ l, M1 `, R8 |8 G; }6 L
- if ( !*(_DWORD *)v11 )
& P4 h" L) M, l9 s7 ~6 V* q% P& ` - v16 = byte_100B2D6E;
$ u8 `. o7 ?9 c - v17 = CKContext::CreateObject(a2, 31, v16, 0, 0);
1 g6 U7 L1 H- Z9 o& t9 h: o - *((_DWORD *)v11 + 6) = v17;8 c+ T/ x3 u7 K3 {: a
- if ( !(*(int (__thiscall **)(int, int, int, signed int, _DWORD))(*(_DWORD *)v17 + 84))(v17, xRight, yBottom, 32, 0) )
# B: ?# ?; J/ g. X: _ D - return 0;1 y; p) z5 i$ X7 V6 A, I( r r
- (*(void (__stdcall **)(int *))(**((_DWORD **)v11 + 6) + 136))(&v58);6 e) l* ~4 u2 h% ~; P) ^
- v18 = CreateCompatibleDC(0);, M' ^2 K, A m6 L$ s- K
- v45 = VxCreateBitmap((const struct VxImageDescEx *)&v58);
7 ~1 G# K+ X3 N& Y: e. S2 w - v47 = SelectObject(v18, v45);
$ h- j3 t! p8 u% |. D& p$ U! }+ ] - XString::operator=(v11, a3);
# X' c/ x6 m: a8 n0 H9 l - *((_DWORD *)v11 + 2) = nNumber;
1 U& q( g+ N8 Z# o - v19 = GetDeviceCaps(v18, 90);
5 i5 \2 f4 e0 d+ y& a - v20 = MulDiv(nNumber, v19, 72);) r! o: L! P* a8 J6 K$ E
- v48 = CreateFontA(-v20, 0, 0, 0, a6, a8 & 1, ((unsigned int)a8 >> 1) & 1, 0, 1u, 7u, 0, a7, 0, (LPCSTR)a4);
0 J9 h! }( Y4 y+ f - v46 = SelectObject(v18, v48);4 D% D1 e- s( |$ I
- GetTextExtentPointA(v18, "A", 1, &v56);
+ j# c- F) P# H - v21 = *((_DWORD *)v11 + 4);/ L0 J$ G# @0 I4 v: v, J
- *((_DWORD *)v11 + 3) = v56.cy;
; {, j5 Y |2 J$ ?8 A& T) c6 b) Y - v22 = (char *)operator new(32 * v21);+ f+ r+ K; M5 k6 @# c R
- if ( v22 )
3 L4 D4 d8 k. \* s6 s2 L - {* \& a$ [; W$ r! [( c( t+ T
- v23 = v21 - 1;! u1 ~4 ?8 e& W! h _
- if ( v23 >= 0 )2 | f8 H! R7 [/ W
- {& b5 F6 ^) y$ d: r) y- @. J
- v24 = (int)(v22 + 12);. m: D* O: L5 e: k
- do3 a( k, O& ?- q4 S
- {! s; X$ s }8 B' y! Y
- *(float *)(v24 - 4) = 0.0;& Z1 [! ]( I4 t4 A& p0 N
- v24 += 32;: F8 c8 l9 ` \0 h4 j' a
- --v23;
2 B0 S% w2 k1 I" H: s9 N - *(float *)(v24 - 32) = 0.0;
+ I: J) V: ~1 y& P0 ^% G% i, k - *(float *)(v24 - 44) = 0.0;
D/ u, i. i4 ]8 g - *(float *)(v24 - 40) = 0.0;
6 i5 r( I, ^$ U9 t$ C - *(float *)(v24 - 36) = 0.0;0 g9 H- V5 D8 q8 `) f" l
- *(float *)(v24 - 32) = 0.0;
; i. {& Q* t' {; Q# Q - }
; t# M6 G- N, M - while ( v23 >= 0 );
" _6 a9 n; t* P8 r9 r2 { - }/ N# @# _: L( ~, Z" f1 ]
- }
: V |$ ?0 L1 {- I - else
' ~+ w$ O" x7 `) s - {
# ~- @9 {2 u* |% v! m, y n1 i - v22 = 0;" V2 u: e2 [* x7 n+ I. a
- }
8 s3 t) L2 m6 ] \ - *((_DWORD *)v11 + 5) = v22;
5 W5 u* z6 Z: K3 Y$ T. x9 | - SetRect(&rc, 0, 0, xRight, yBottom);5 r3 u# k2 ~. H# T+ m) H2 U$ p
- v25 = (HBRUSH)GetStockObject(4);
: B4 }- }$ W% O4 ^ - FillRect(v18, &rc, v25);+ C! i7 w% l- ^+ F! F
- SetBkColor(v18, 0);' M3 D L* `; s' K4 Q
- SetTextColor(v18, 0xFFFFFFu);
& ^0 o: o6 o7 r6 C0 Z, u, ] - SetBkMode(v18, 1);$ P8 I, |3 P$ t1 z9 v$ a
- v26 = 1;' V4 F7 p" C# [& \; I2 a
- v41 = 1;
9 L! |1 C6 t7 z$ S0 q1 F* K - v40 = 0;- e+ T' ]5 |: F, t9 I$ |: r7 ]. m
- v43 = 0;' Y7 o# [! h5 h; _
- if ( *((_DWORD *)v11 + 4) > 0 )$ W, h2 ?2 \' d; z& |+ M. O
- {3 `( B+ b+ u+ _6 D8 U
- v27 = WideCharStr;
2 z. J0 S9 Z* P, H/ N. K - v44 = 0;& p. M& ^- t u$ e' J1 l
- v42 = WideCharStr;
7 W }2 w7 Z# u - v49 = (double)xRight;
+ E# a% H @4 }, Y+ w7 _ - v50 = (double)yBottom; [! m3 H \. u( F! L
- while ( 1 )& }2 S( v# t% z. e
- {# H1 \. H: R5 _( c
- v28 = v44 + *((_DWORD *)v11 + 5);" R6 g, H# r+ S2 _
- *(_WORD *)(v28 + 16) = *v27;
( t }$ H8 Q1 |4 W" | - GetCharABCWidthsW(v18, *v27, *v27, (LPABC)(v28 + 20));, O5 i& K6 b9 v2 |
- if ( *v42 >= 0x20u )
' I4 _2 v% a6 X/ u - {7 ~% |. R7 U; H: J4 _9 J8 U
- --*(_DWORD *)(v28 + 20);
, b, f: o' n: z1 c2 _3 ~6 ] - *(_DWORD *)(v28 + 24) += 2;
1 n, {+ H V5 c4 k/ G- E1 E" C0 ] - --*(_DWORD *)(v28 + 28);5 {. @" H! d% u* ?- U* E1 I
- }: g6 k0 {3 m6 U; F/ Y: U' S
- else P3 w+ ?1 E9 h5 Z" |- x; |
- {+ K7 c# U% W) n# Q X$ f' p- ]
- *(_DWORD *)(v28 + 20) = 0;" v( T- t2 @" u( t
- *(_DWORD *)(v28 + 28) = 0;
- u P' l2 v8 X! u1 y' Q - }3 N! X2 P0 a! n4 o/ \8 V
- v29 = *(_DWORD *)(v28 + 24);
4 F7 c m+ E) \9 E - v30 = v40;
0 y* L1 q9 m0 ]: e! i: V - if ( v29 + v26 + 1 >= (unsigned int)xRight ), m5 X* T; I8 Z
- {& G1 K$ v3 j! ^& _2 u5 v* c, G6 |
- v26 = 1;
t v8 C U3 C - v30 = v40 + *((_DWORD *)v11 + 3) + 1; v. ~& ^, A# Z& P
- v41 = 1;
3 L* Y$ b+ ?8 A. O3 D& ^% j# K9 u - v40 += *((_DWORD *)v11 + 3) + 1;
. ^/ f. h3 P# g) @7 J9 O- X - }. H- \; w+ B, V4 W/ Y
- *(float *)v28 = (double)v41 / v49;+ |9 r! ?4 k# [! ~/ z8 Q
- *(float *)(v28 + 4) = (double)v40 / v50;' ?, S4 U3 X$ E/ U
- *(float *)(v28 + 8) = (double)(unsigned int)(v26 + v29) / v49;' `8 l) T: c# `9 r& @6 C
- v31 = v26 - *(_DWORD *)(v28 + 20);2 x& s& D* x( R2 d
- *(float *)(v28 + 12) = (double)(v30 + *((_DWORD *)v11 + 3)) / v50;
3 W) |* V8 [1 {" |+ g! t1 s - TextOutW(v18, v31, v30, v42, 1);$ }+ N* V) Z0 u* F8 N( O4 s v$ G
- v44 += 32;3 v& t6 _2 ^6 s( }. i
- ++v42;: x, q R. U8 z2 i
- v33 = __OFSUB__(v43 + 1, *((_DWORD *)v11 + 4));, U/ t' i8 Z6 ]; r. H* `2 d3 S
- v32 = (signed int)&v43[-*((_DWORD *)v11 + 4) + 1] < 0;
- g- h/ i4 n1 P3 O: _ - v26 += *(_DWORD *)(v28 + 24) + 1; r9 g* T: j, r2 P O
- v41 = v26;
7 Y+ a: f5 `: t# J( H' c - ++v43;
+ k7 r: i! o8 E( r - if ( !(v32 ^ v33) )3 }+ V+ F2 n% v' Z& E
- break;
- G8 z) s/ O2 w - v27 = v42;, L- u x3 C, y% }. i; M8 F
- }" p4 z4 T, V7 J7 H& p. I
- }5 O$ N0 a5 ?: h# ?* x
- v34 = CKBitmapData::LockSurfacePtr((CKBitmapData *)(*((_DWORD *)v11 + 6) + 56), -1);
# U. O6 @6 [* Y8 v, N; [ - if ( v34 )
; Q7 W: y4 K5 \: A( x# i - {
# b+ U( z% t3 X5 R - GetObjectA(v45, 24, &v51);
c) y. b0 l* `* n - v35 = v53;1 U5 q+ i7 O( R; v0 w
- v36 = v55 + v54 * (v53 - 1);
) P, Q4 h) S" A* ^, I/ L - v40 = 0;
; B& j# y. a6 ]* } - if ( v53 > 0 )
& j5 f* U5 t2 {; x, r - {
+ t1 u8 a& F+ d% a$ W - v37 = v52;+ c( _9 q% {' c+ _6 t
- do
7 G- C1 T; w) |" A( b - {
) V/ G5 v9 } x R# m* b - v38 = 0;
S, }4 C' l2 o: i6 ?4 ^ N) ? - if ( v37 > 0 )
1 ]8 ~: Y0 F: b3 v! l - {
/ H0 c$ O5 [, _& ` - v39 = (unsigned __int8 *)v36;
9 L- X8 N. A7 q' s! z4 I7 l - do8 g% s' X3 X4 e
- {! u( j# [ {- G1 d3 k) n
- *(_DWORD *)&v34[4 * v38] = (*v39 << 24) | 0xFFFFFF;: M. N2 t! y! R) {1 d
- v37 = v52;9 ^: c$ E7 s. M; N
- ++v38;
+ {7 `1 m" w) R" Y1 O - v39 += 3;; @0 J |" ~5 E+ g" h1 f
- }1 W0 X `( [/ Q
- while ( v38 < v52 );
& ~# e' v) t0 r5 }5 a6 V - v35 = v53;. I/ _/ X9 s4 ^' [) q; o/ p8 p
- }0 U5 r6 M: C" e/ P" V4 j& Z8 x, D
- v36 -= v54;( {. U) S5 T1 x% u7 _
- v33 = __OFSUB__(v40 + 1, v35);
+ F: l$ H. N, R0 {( V* I+ }1 i - v32 = v40 + 1 - v35 < 0;
B# E- M. \9 P2 G# R* T% S - v34 += 4 * v37;
5 L% z% D2 a+ V# o4 x7 B* z4 K - ++v40;7 }+ x) q( v9 v) z+ o
- }
/ ^) V: h" P U- L% \' r - while ( v32 ^ v33 );8 q Q* R4 q4 d6 I( ]- u g/ K
- }& A) x+ D1 j) ^
- }/ h4 \4 J& x% ^" a9 A( P' _
- CKBitmapData::ReleaseSurfacePtr((CKBitmapData *)(*((_DWORD *)v11 + 6) + 56), -1);; j0 E1 ?4 Y9 f/ D
- SelectObject(v18, v46);/ |1 o) b0 f$ I- z+ a
- VxDeleteFont(v48);$ X- Q4 u2 }0 h/ c d
- SelectObject(v18, v47);
1 V' S4 J: G* ?, O - VxDeleteBitmap(v45);: _5 N" ?8 w7 ~8 O
- DeleteDC(v18);
/ u! U6 b# Z& o/ @) ?- {3 e - CKObject::SetName(*((CKObject **)v11 + 6), (char *)a3, 0);' J' Q' _* l+ L+ O' X1 O
- CKBitmapData::SetDesiredVideoFormat(*((_DWORD *)v11 + 6) + 56, 1);
2 h8 E# W2 }* M( Q% e, q - (*(void (__stdcall **)(_DWORD))(**((_DWORD **)v11 + 6) + 120))(0);2 Q1 J* w5 ]! P$ W
- return v40 + *((_DWORD *)v11 + 3) < yBottom;
1 g: e+ z. b* D' x+ K - }
9 S9 @8 N5 K" d
复制代码 0 C* u; d8 l1 u) R, W
, x( |( O& U. u/ ]4 j
|