本帖最后由 shane007 于 2023-8-26 17:10 编辑 9 L/ t' y2 _, m( M5 h. C
/ p& f, {. z) v这个游戏的主要修改点在\player\BuildingBlocks目录下的Adventure.dll中。
% [9 x4 D) c, y. e8 E8 p用API monitor对本DLL的CreateFontA函数进行跟踪,发现确实有调用, 参数如下。5 @5 F6 u- A$ Q% \9 S. c
X9 R* Q2 m# p/ k. u
- # Type Name Pre-Call Value Post-Call Value
G! ^- \/ }5 h8 y; `- r* U - 1 int nHeight 0xfffffff0 0xfffffff0
& V. H" n0 _" G. O; A1 \ - 2 int nWidth 0x00000000 0x00000000
" D, F$ T2 a: z/ y |. y - 3 int nEscapement 0x00000000 0x00000000, l/ \7 [# M9 V+ M
- 4 int nOrientation 0x00000000 0x00000000
+ @9 x/ C3 U9 F7 R2 } - 5 int fnWeight FW_NORMAL FW_NORMAL
* A5 c. }) F* x" ^; x - 6 DWORD fdwItalic 0x00000000 0x000000000 O9 w. D- x6 P% ]
- 7 DWORD fdwUnderline 0x00000000 0x00000000: H* y& c; _" L# k$ G) \, ~
- 8 DWORD fdwStrikeOut 0x00000000 0x000000009 }0 h" [' Z& F/ g, ?! k5 b9 _
- 9 DWORD fdwCharSet DEFAULT_CHARSET DEFAULT_CHARSET7 j2 j. d7 o6 v2 \& p
- 10 DWORD fdwOutputPrecision OUT_TT_ONLY_PRECIS OUT_TT_ONLY_PRECIS' m; l2 c' J+ o C' t! H# {2 b
- 11 DWORD fdwClipPrecision CLIP_DEFAULT_PRECIS CLIP_DEFAULT_PRECIS b! E' Y& `. L& E. U. d" s
- 12 DWORD fdwQuality PROOF_QUALITY PROOF_QUALITY
7 s& ]- l! u' K6 f - 13 DWORD fdwPitchAndFamily FF_DONTCARE | DEFAULT_PITCH FF_DONTCARE | DEFAULT_PITCH
4 \! M7 c4 l! J q* o - 14 LPCTSTR lpszFace 0x09148a58 "Arial" 0x09148a58 "Arial"5 T0 Z1 ^4 {3 m9 F6 ~
复制代码 / b. _* H4 H" f+ m" a3 m3 I
J; S1 G' H, B- b1 Y2 `/ B
用ida pro找到调用CreateFontA的源头函数如下。5 h7 w& O6 [! J f- ^
从函数的参数可以看出,这应该就是字幕显示函数了。% g& G/ i* c) q# i+ P1 O/ P
关于后续修改,先修改CreateFontA函数的fdwCharSet,lpszFace这2个参数,也许就能出中文。
" d3 ?3 R* P4 R9 Q% a5 n; P还不行的话,就自己写一个显示函数。以下函数中lpMultiByteStr就是指向字幕的指针。
8 ?( }# y3 K" e( ^6 U! i
1 `) c0 Z+ J& X6 ?" ]. C$ q- 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)
' x/ Q. v6 m* N - {
$ n' `0 F5 | P; Y( J" S - void *v11; // edi
# k$ d: j9 c% _" m( g2 f- p0 A - int v12; // eax7 M4 r. x* e9 _8 Y
- int v14; // ecx
( l8 v- O$ V) p( ~) h) x1 V - int v15; // eax4 D, I: U% w9 ?, H' Q# x( a
- char *v16; // eax" G) B4 t0 b; f& S3 t
- int v17; // eax
' G- t: h! g9 m9 L - HDC v18; // ebp1 W$ k5 a" N* W! }2 Z5 r( {
- int v19; // eax! i) f; m$ |5 ]$ C4 E: v, X/ T
- int v20; // eax4 T/ N6 w% o3 `# ~6 |2 Y1 x
- int v21; // esi
. C- h) _) h* {6 _: P; j% U/ C ^8 w, a - char *v22; // eax
' n" ^) Y$ c2 o! q - int v23; // esi
1 u% B' l; R% w$ k - int v24; // ecx
# C+ |+ H3 J/ y6 B P8 B - HBRUSH v25; // eax$ l/ f; e6 G; P+ P9 X0 d) O
- signed int v26; // ebx
# w' q5 F3 f; y) `4 X - WCHAR *v27; // eax- V8 O3 B- Q. a+ M. n
- int v28; // esi
9 \# Q4 i$ ^/ F; F7 V8 `. e: J) o - int v29; // ecx4 [! U T0 i9 T7 H4 h, P
- int v30; // eax
- A/ [1 t9 U; ]. Y( Y0 V" D# [ - int v31; // ST28_4; X: O1 V2 V! w& T6 j2 l/ U( c
- bool v32; // sf
1 J+ Z1 Y/ K! l. C" d9 r+ }9 ^ - unsigned __int8 v33; // of
2 }1 B; D# J9 @! S - unsigned __int8 *v34; // ebx) Y+ B( u3 C3 |9 I! }) R
- int v35; // ecx
- B4 x. P# N; ?- q& X. m - int v36; // esi
: G# R7 t- y' g4 z6 V2 B( v - int v37; // edx: A1 S2 Y/ x n; V
- int v38; // eax
1 D" P2 I' r4 _$ J" F& J - unsigned __int8 *v39; // ecx
0 o5 q8 m" z7 N& h' f - int v40; // [esp+40h] [ebp-2098h]
! ]3 A0 @+ u8 u/ o% i2 G9 ?8 B - signed int v41; // [esp+44h] [ebp-2094h]
" H: ?; g8 Y6 j9 ~4 S9 o/ U/ t - WCHAR *v42; // [esp+48h] [ebp-2090h]9 ~- g0 ?4 J$ x' ?3 Z
- LPCSTR v43; // [esp+4Ch] [ebp-208Ch]( b& r2 V1 z) ]* d
- int v44; // [esp+50h] [ebp-2088h]
" c& {: W8 V# |" V! U" C" X& W1 j - HGDIOBJ v45; // [esp+54h] [ebp-2084h]* r1 D3 a& c) Q( h; k( r1 `7 z
- HGDIOBJ v46; // [esp+58h] [ebp-2080h]' R$ W& O" y2 ^4 S
- HGDIOBJ v47; // [esp+60h] [ebp-2078h]
' `# i6 m. D, j9 m; q6 M; c" c' x - HFONT v48; // [esp+64h] [ebp-2074h]! B2 G3 u3 C& X( w' M: g) v* H
- float v49; // [esp+68h] [ebp-2070h]2 o6 f$ y/ L9 g' ~5 w: K7 ?
- float v50; // [esp+6Ch] [ebp-206Ch]
7 B9 [! _+ `5 Z! G4 Z- ? - char v51; // [esp+70h] [ebp-2068h]/ P4 E" H" ?' I" E1 b$ f
- int v52; // [esp+74h] [ebp-2064h]
. |0 e* _( l/ c - int v53; // [esp+78h] [ebp-2060h]
/ ^" s. i7 q% f% X - int v54; // [esp+7Ch] [ebp-205Ch]
# l' f& b5 X" ?! R - int v55; // [esp+84h] [ebp-2054h]
$ e6 Q: n8 o! B* R- o) y: z- y( g - struct tagSIZE v56; // [esp+88h] [ebp-2050h]
2 _* y: C5 \: q# E - struct tagRECT rc; // [esp+90h] [ebp-2048h]7 p+ t$ S1 P. b
- int v58; // [esp+A0h] [ebp-2038h]
2 N" C$ A6 n% q0 ]$ T; j; ~ - char v59; // [esp+A4h] [ebp-2034h]( v3 s1 j: v% m% f9 B9 v
- WCHAR WideCharStr[4096]; // [esp+D4h] [ebp-2004h]
# R" g | W" z& X0 L" S P9 k5 y - ! g: ^& E" C0 U ^$ ^
- v11 = this;: Z/ u) O3 m# ^( _% ] e4 B1 L: c9 T
- v58 = 52;3 _, x+ ], ], p! D" A9 i
- memset(&v59, 0, 0x30u);/ x, m( t! C% f) t# x+ t+ x% h5 E
- if ( *lpMultiByteStr )+ l" \. e; M. r# b5 ?2 e0 q4 j
- {
6 Q! ~& T0 w: o. _ - v12 = MultiByteToWideChar(0xFDE9u, 0, lpMultiByteStr, -1, WideCharStr, 4096);
& I5 M) A) Z- j6 B3 l; a7 s - *((_DWORD *)v11 + 4) = v12;
- h8 z$ G* J2 a/ x2 t - if ( v12 <= 1 )0 N2 G! G0 |- j Q, e3 j3 B5 s
- return 0;5 z& y' |4 b0 }3 |
- *((_DWORD *)v11 + 4) = v12 - 1;; p$ d% X( B: R
- qsort(WideCharStr, v12 - 1, 2u, sub_10057A40);) T- p4 {4 e, J) |" u/ _
- }
1 J3 C: @* y; p* B6 J" W - else: T6 k9 z* C- I& v* J' o- I; S
- {" g; d* l2 l2 W& q$ B0 n0 C
- *((_DWORD *)v11 + 4) = 352;. c+ D1 {* d; N9 `6 g
- v14 = *((_DWORD *)v11 + 4);
: W* q9 e. m. } - v15 = 0;
, I! T# K* A% [0 j - do
' E2 D4 R8 u$ d/ n: n: r% f! e& T - {
& ?( E; ^$ N, M4 B: [7 J( ^ - WideCharStr[v15] = v15 + 32;5 [6 p% v# `6 F- i3 ?! Q
- ++v15;
0 Y, b- o4 u4 i7 q# q - }
7 T3 H' u* s2 y; p) t% {2 w6 u - while ( v15 < v14 );3 ^) `3 h$ V2 C7 I- F) R. f2 F
- }- w# h& e. j. h! G
- v16 = *(char **)v11;! r% i4 c% T1 l
- if ( !*(_DWORD *)v11 )
2 x: J3 V+ g" M# x4 Z, ]! K5 j6 q - v16 = byte_100B2D6E;
4 I4 n! t4 F/ {$ j - v17 = CKContext::CreateObject(a2, 31, v16, 0, 0);1 h* M* g, H8 u g" H) Y# M
- *((_DWORD *)v11 + 6) = v17;7 p" i8 q) q s! a% r2 a
- if ( !(*(int (__thiscall **)(int, int, int, signed int, _DWORD))(*(_DWORD *)v17 + 84))(v17, xRight, yBottom, 32, 0) )3 P7 E5 Z+ M9 G+ T% h
- return 0;
! l. R/ c" u# ?" U/ v( [# Y - (*(void (__stdcall **)(int *))(**((_DWORD **)v11 + 6) + 136))(&v58);
+ c5 S; T2 V+ E j( t! B - v18 = CreateCompatibleDC(0);
/ P4 v$ M' |6 y - v45 = VxCreateBitmap((const struct VxImageDescEx *)&v58);
; h1 g( ~5 W& Q( N* R - v47 = SelectObject(v18, v45);
$ i- Q: E5 M. b: Y - XString::operator=(v11, a3);" T+ K2 [* U" O
- *((_DWORD *)v11 + 2) = nNumber;: E6 ]5 C/ w Z6 _$ E
- v19 = GetDeviceCaps(v18, 90);6 s. [3 _/ s1 Q. P* V h
- v20 = MulDiv(nNumber, v19, 72);' B7 L/ O, O2 j. k' U" n
- v48 = CreateFontA(-v20, 0, 0, 0, a6, a8 & 1, ((unsigned int)a8 >> 1) & 1, 0, 1u, 7u, 0, a7, 0, (LPCSTR)a4);
* p p9 u6 J0 e; m3 j3 {, x; k - v46 = SelectObject(v18, v48);1 D1 n1 b( M+ R2 F
- GetTextExtentPointA(v18, "A", 1, &v56);
. L+ m$ i, ?( l4 H - v21 = *((_DWORD *)v11 + 4);
2 F# h# g* e. ^1 y' x - *((_DWORD *)v11 + 3) = v56.cy;
0 M' `8 P2 F$ q J# N( R$ X0 {) { - v22 = (char *)operator new(32 * v21);
+ ^+ j( y! S) }9 L+ w& Y) Y9 K - if ( v22 )
6 F4 ]! M/ @; ~% i+ F1 t4 @7 J - {
3 X' B* ]5 F( t+ S& b - v23 = v21 - 1;
6 \: d& S1 f# h- L# A - if ( v23 >= 0 )
; J* }2 p5 i" h- N% G - {8 ]+ a2 U$ n" s: c/ r: M
- v24 = (int)(v22 + 12);* x9 K2 u5 u( C. Q) G% y+ I( K( c& b
- do& ^9 i$ {8 a' c8 O3 H1 P
- {
7 v1 ]4 r# t/ w, Z! \, j/ g- n5 T - *(float *)(v24 - 4) = 0.0;. Y$ @* t. Y, X
- v24 += 32;; N! i1 J+ O* T' N/ x
- --v23;. _/ u$ R! Z$ \& |/ S% d
- *(float *)(v24 - 32) = 0.0;9 g1 X5 c6 X: H* e+ S: `) Y
- *(float *)(v24 - 44) = 0.0;8 e4 x q; P8 e S6 w, T
- *(float *)(v24 - 40) = 0.0;" ^3 s5 f2 ]+ q) Y$ Z$ E5 _
- *(float *)(v24 - 36) = 0.0;
1 U, j j* t. c0 Z - *(float *)(v24 - 32) = 0.0;4 I1 a. d' _ q& f
- }
+ u3 r7 p! u1 }7 w; ^, y& ]& K - while ( v23 >= 0 );: l) H4 e( {% U! }2 w
- }# e) b" I8 v/ @: C
- }+ L8 l/ k7 k) u$ d1 m: c/ q
- else
' p1 K& {5 g- D: {) @ G - {
5 H o% p8 B; _! u7 f - v22 = 0;
! L }7 G2 n& m5 {* ^8 ^4 { - }1 x6 ^; F" g% [# F2 h
- *((_DWORD *)v11 + 5) = v22;" ?9 J. c0 M- ^$ _& l
- SetRect(&rc, 0, 0, xRight, yBottom);
7 G" J, `: b( F( C. l - v25 = (HBRUSH)GetStockObject(4);* O# H! V5 p- O G
- FillRect(v18, &rc, v25);
: U5 {2 p/ J( J! ]9 x - SetBkColor(v18, 0);
+ a- a1 q9 X( |# b3 e9 ]0 u' K O - SetTextColor(v18, 0xFFFFFFu);
4 s7 {# x; [5 p/ ^8 Y7 ? - SetBkMode(v18, 1);' v# h! ^0 Z& g! Y2 ~. N$ _
- v26 = 1;
- N0 J8 ?- u$ G% o - v41 = 1;
5 {9 I% q$ d \; v- ? - v40 = 0;
2 @0 K' O% b7 Q% Z! W. f1 x - v43 = 0;
8 X: t8 g* w. t - if ( *((_DWORD *)v11 + 4) > 0 )
+ f0 e: v1 J5 g - {! C7 @' b: p E0 Z9 U7 A4 m# p6 ~' f
- v27 = WideCharStr;
& W( m# O% `$ n, r, a3 ?% O7 ^6 S" b - v44 = 0;4 F# E7 W: A/ d+ B
- v42 = WideCharStr;
/ A& @' T8 Q& _5 z8 k - v49 = (double)xRight;% k, r7 u4 |3 O& w6 R
- v50 = (double)yBottom;+ J/ V3 w5 N: S8 r0 u' }
- while ( 1 )9 S; K- ` \* T' D/ p
- {7 o% R1 P/ \3 w
- v28 = v44 + *((_DWORD *)v11 + 5);% g3 I, `) C) n5 y9 ^4 g
- *(_WORD *)(v28 + 16) = *v27;. J& ^- r) A! T7 [4 D
- GetCharABCWidthsW(v18, *v27, *v27, (LPABC)(v28 + 20)); v6 G/ R. P# O: e/ Z B) z$ i. |1 j
- if ( *v42 >= 0x20u )
- ]2 I3 s* I, Q9 e6 R* Y - {
: D/ w% S* ]7 B# F- d9 a6 y, A( ]) n - --*(_DWORD *)(v28 + 20);0 M. x; Z$ D' c" f- L) U" z# V
- *(_DWORD *)(v28 + 24) += 2;
8 m3 {. y/ ?2 }7 L- U7 H - --*(_DWORD *)(v28 + 28);
! C3 d$ E1 A: v+ x) L2 U7 b- o - }2 V. Z" S# `$ M& ^, Y. @: r- F: |
- else
H% P/ w/ O4 P- b, T, Q - {
0 q& l% [9 y- W4 _& D; E' K) n. ? - *(_DWORD *)(v28 + 20) = 0;1 K! D. n( l/ A, e d( ^: p* a
- *(_DWORD *)(v28 + 28) = 0;
( M K. X; T; ~3 {7 H1 R- a+ E - }
: O4 B8 R* l K! A6 g - v29 = *(_DWORD *)(v28 + 24);7 _1 c i$ W3 ]
- v30 = v40;" `2 P0 c$ r2 s* i8 I! Q
- if ( v29 + v26 + 1 >= (unsigned int)xRight )6 n( Q5 C/ p, c6 R7 D+ r
- {( h- ~+ b+ h+ g& ^
- v26 = 1;* H' |; ?8 `; k! V) Y
- v30 = v40 + *((_DWORD *)v11 + 3) + 1;
. D/ a( x& Y& X# v' _( w - v41 = 1;! w* I3 |6 s) ]3 a; ]% } D/ t I3 M
- v40 += *((_DWORD *)v11 + 3) + 1;9 T; N0 m4 z& G4 e" j# H! h
- }
- Z9 @6 {3 Y' `) J4 i$ m& k - *(float *)v28 = (double)v41 / v49; r% k# T7 E1 w1 G- _
- *(float *)(v28 + 4) = (double)v40 / v50;6 s" _: j% o1 x% h# T1 C
- *(float *)(v28 + 8) = (double)(unsigned int)(v26 + v29) / v49;
( b$ u) C& }+ v: v - v31 = v26 - *(_DWORD *)(v28 + 20);
/ s9 z0 u2 J& z& W - *(float *)(v28 + 12) = (double)(v30 + *((_DWORD *)v11 + 3)) / v50;
* ?9 E" Y+ W, t+ R/ h* E - TextOutW(v18, v31, v30, v42, 1);
8 M( Z$ e+ e: i - v44 += 32;$ O: h( _6 R+ n" X4 ]; y4 u& z
- ++v42;0 v# m+ ?+ [0 X. x+ M% }3 V6 ]
- v33 = __OFSUB__(v43 + 1, *((_DWORD *)v11 + 4));
5 b& u* ^2 a( X$ b; ~* y9 u1 A6 K - v32 = (signed int)&v43[-*((_DWORD *)v11 + 4) + 1] < 0;7 v! y8 @4 d0 d, E9 M- {/ @! e
- v26 += *(_DWORD *)(v28 + 24) + 1;+ u2 z2 |, a. Y0 |- U) o* m# ^
- v41 = v26;+ p& ]2 [6 s8 o8 j# J* w- d
- ++v43;8 C1 k4 `" E, K" w/ z0 }
- if ( !(v32 ^ v33) )
3 }+ s" p. g1 X2 t* x$ q0 J; R - break;0 f- o/ F% {* d* M" m
- v27 = v42;
" D- Q& D- B) K0 Q% z1 F: i' i - }
3 X0 D1 @- ` L" [! Z - }' V0 y( \$ W' f5 \. K
- v34 = CKBitmapData::LockSurfacePtr((CKBitmapData *)(*((_DWORD *)v11 + 6) + 56), -1);1 ^2 O. S& G$ o# Q* Y& F' M Y9 _
- if ( v34 )
( y' l8 Z1 s8 L# @ - {8 T5 l. G6 U6 E$ F$ z+ D
- GetObjectA(v45, 24, &v51);$ P3 L' \' h# \7 `. D
- v35 = v53;3 Z; L& P6 B* B# d7 [. J
- v36 = v55 + v54 * (v53 - 1);
! G s) W* p: Z5 K$ N3 | - v40 = 0;: s- A G2 Q7 ]: Y- g# _, ^- A
- if ( v53 > 0 )% s; b3 g. \; j
- {; m) Z" h& q* H% E
- v37 = v52;
, j) {/ o1 M! V$ y) D% E) e* t - do
5 O3 b: k$ ?7 H7 z. }- X - {
: ^7 x5 C, g; m1 U; D8 A) h1 @6 @ - v38 = 0; P& N/ Y x6 T/ ?% M( R- @4 u% n0 _
- if ( v37 > 0 )
9 H z. R' p2 d. ~! V4 b - {
; x6 Y1 z& a9 O4 r2 Z" Z - v39 = (unsigned __int8 *)v36;
$ B! J- u' `3 y* S4 q) j! { - do+ d, ^( o7 G z) J( m4 e/ q" M, s
- {
5 p e) \* x% u) p* r - *(_DWORD *)&v34[4 * v38] = (*v39 << 24) | 0xFFFFFF;
' \7 d8 q/ C; X4 V) N - v37 = v52;0 s6 ?$ e% Z" \
- ++v38;1 } k# [4 U) H% d
- v39 += 3;9 r) a3 N, w: b2 Y6 S. z
- }
: b5 s" C: u! d) p% }# H' | - while ( v38 < v52 );
3 Y" Z( S$ U# ?& U, G) b' r: D3 n' c - v35 = v53;
( ^# P4 s3 d( c O - }/ h# [5 j) X/ g8 Q4 \
- v36 -= v54;% Z5 c; c2 O' E w: `
- v33 = __OFSUB__(v40 + 1, v35);2 g1 m1 n4 c9 t* H
- v32 = v40 + 1 - v35 < 0;
$ |, `* X2 t$ H4 ? - v34 += 4 * v37;( h+ R6 u1 k2 r3 _9 F+ o! V+ D- I4 @
- ++v40;! ~+ N J9 _ M4 ~* }
- }
6 q* ~4 O2 S) I( A - while ( v32 ^ v33 ); z- q2 `0 V1 ]" b2 H% J
- }0 P- p0 x" X/ \/ _# | S: V
- }
0 p5 E& b1 j' ^0 | i - CKBitmapData::ReleaseSurfacePtr((CKBitmapData *)(*((_DWORD *)v11 + 6) + 56), -1);
7 G! p2 H, _* L' M5 O3 ` - SelectObject(v18, v46);
& }( B2 C' b5 p, z- q0 R - VxDeleteFont(v48);
" V6 O3 K' X, e7 V - SelectObject(v18, v47);& w* S6 u6 R+ Y
- VxDeleteBitmap(v45);
* l' `: Z2 y6 l. o - DeleteDC(v18);
; Q3 w( @ z% D - CKObject::SetName(*((CKObject **)v11 + 6), (char *)a3, 0);
C/ r, s$ U0 V5 G6 t& r1 \ - CKBitmapData::SetDesiredVideoFormat(*((_DWORD *)v11 + 6) + 56, 1);) x- ]/ U+ C: R: t1 D
- (*(void (__stdcall **)(_DWORD))(**((_DWORD **)v11 + 6) + 120))(0);
& }9 v! n2 X/ X6 r+ o9 c5 N - return v40 + *((_DWORD *)v11 + 3) < yBottom;
2 E! r, S& u& w. Q9 Z, o - }
. t k1 z- q% J- F8 F+ k
复制代码 + U, t* X, X3 q$ v% i4 R; D
2 \! N5 c" M' s$ o; R* U
|