冒险解谜游戏中文网 ChinaAVG
标题:
【Directx9游戏汉化 #9】来世(nextlife) 字幕显示函数
[打印本页]
作者:
shane007
时间:
2023-8-27 13:22
标题:
【Directx9游戏汉化 #9】来世(nextlife) 字幕显示函数
本帖最后由 shane007 于 2023-8-27 13:23 编辑
$ _! ^7 O! g2 ~7 l3 g# y% m
3 O. x# {; f! v$ _9 v
本游戏采用了CEGUI,该组件能采用directx和opengl。
; O# D1 W4 g! Y! ^
经过我的小方块测试,游戏屏幕显示了小方块,因此确认是directx9的游戏。
' q, ^. l' A7 Y0 Y
游戏自带一个EngineSetup.exe程序,设置为窗口模式后就能用cheatengine调式。
7 a( J+ x7 C: K, \
(由于游戏窗口较大,我将游戏屏幕和cheatengine分别显示到2个显示器上即可。)
" H( b2 H4 D3 a
, i4 H+ n7 [2 u1 _) \6 h' }
9 ?$ g+ l- f8 y k+ w
在游戏中找一个字幕,在以下地方断下。
5 P! D% U) G0 Y3 `
由于该游戏基本都是显示在屏幕固定位置(上或者下,居中),
* J- x+ }/ M6 R# f# h. Y3 c
因此暂时认为此处就是游戏的字幕函数,该函数被20处左右地方调用。
! b+ j) I0 Z2 C* o
2 y- T- h& }( c
NextLife.exe+11C5 - 42 - inc edx
& R; k9 m1 \; ]! w5 b: ` Q
004011C5
复制代码
! p- @, y& |. c5 b/ O
4 Z( u; D' D3 H, |. p
该地方的伪代码
9 U5 U q4 g |! m l( B+ K7 v6 L
void __thiscall sub_401160(char **this, const char *a2)
* h" t8 x$ G* W* ?. G
{
# q4 f/ k3 D! ?: O2 \' _1 @
char **v2; // esi
" Z: g1 U( R" C4 y- d3 e0 x* ^' i) j
char *v3; // eax
2 y/ W+ V3 K7 O- Q. @- C
char *v4; // eax
6 [ o/ ? y* I
7 b, M6 L4 W7 y! y5 q& o+ Q
v2 = this;
0 D: V7 h, e% y' Q
if ( a2 )
' r' j$ H' U" m6 y5 R" |3 _4 O
{
! T: A$ ], \7 f) }2 o! X2 D
v3 = *this;
4 c$ c+ m+ D# o3 \4 q/ G9 Q' @9 g2 [
if ( a2 != *this )
7 r" l" m, G" @0 j. k, i
{
: @; }7 A& r+ F3 O8 y8 M3 c
if ( *a2 )
# F2 t1 P! d+ y% X- c- O
{
l+ C# B6 @" |
sub_401030(strlen(a2));
6 t4 t- C. u7 s+ _( u9 t! }
strcpy(*v2, a2);
! Q' U7 {1 k R
}
6 @: k0 D5 f% T
else
$ l$ E Y* R5 R! j7 d4 q8 V
{
6 c+ m6 O* N4 v3 Y
this[1] = (char *)1;
7 x$ N5 P0 r+ R( \# Q8 k
if ( v3 )
, U+ G( P/ h' q; x
operator delete[](v3);
" O4 m0 M4 P- Y& C2 c. [- B
v4 = (char *)operator new(6u);
; F5 j' D$ I" B* N8 F
*v2 = v4;
+ c1 A2 s" t U& s% N
*(_DWORD *)v4 = 0;
! A3 C& A- l0 W( b5 u
}
~. e+ {0 B( S1 q2 e
}
5 [; P$ Z7 @0 e% m4 u
}
* d- H2 }' y7 y; e. K2 B4 I
}
复制代码
% r! S* v. I& m- q$ n! B
汇编代码
% u% {. x' ?; O; H
.text:004010F0
# A S) [/ c4 Y; S) ]
.text:004010F0 ; =============== S U B R O U T I N E =======================================
! k8 e0 `/ F, ]* T0 U# R3 O& }
.text:004010F0
* Q) o5 |+ s8 j' z8 q W6 e& I
.text:004010F0
* s% e! {" g0 I5 v" \
.text:004010F0 sub_4010F0 proc near ; CODE XREF: _main+139↓p
# ^ G* K3 d: o
.text:004010F0 ; sub_403240+97E↓p ...
5 Z( _# ~8 Z x$ S
.text:004010F0
0 a# T6 ~) ]% |7 n8 V0 e/ y# ?
.text:004010F0 arg_0 = dword ptr 4
2 h" A) M& `& `5 k+ e0 P
.text:004010F0
! ~# T% E) j8 q, X
.text:004010F0 mov eax, [ecx]
, F( I6 B2 h; P8 `( U6 n( r
.text:004010F2 test eax, eax
2 q# e: C+ N: p+ E
.text:004010F4 mov edx, [esp+arg_0]
, Q$ \& m% G$ [1 g9 m& w: x* _
.text:004010F8 jz short loc_401147
) ^2 m3 w2 @" Y6 W7 {7 X
.text:004010FA test edx, edx
+ ^/ c! f* W8 ]) P
.text:004010FC jz short loc_401147
4 ]4 ^) Z& ^/ z
.text:004010FE mov cl, [eax]
9 v h4 q( d3 f8 v; s9 P% [" [
.text:00401100 test cl, cl
, K/ y! e$ \5 M8 q, {* e8 a
.text:00401102 jnz short loc_401116
5 ^ n, t) u: i# m# D) y9 n y5 {
.text:00401104 cmp byte ptr [edx], 0
2 N- z. D! J, v, x
.text:00401107 setz al
7 y& C2 L! [8 Z) \* n9 L
.text:0040110A xor edx, edx
8 e" d! J& D) Y7 n5 s
.text:0040110C test al, al
; a/ u, l+ B+ b ~ [! S" G
.text:0040110E setz dl
: C# F/ ~9 K; ~& I) q
.text:00401111 mov al, dl
1 {4 z u6 T+ L4 R
.text:00401113 retn 4
6 t, J* I7 n4 V' \+ S% P
.text:00401116 ; ---------------------------------------------------------------------------
* |5 C' O: ?- b3 e& t0 ]
.text:00401116
! H' \% t3 h. A; V( _8 ~/ f: f
.text:00401116 loc_401116: ; CODE XREF: sub_4010F0+12↑j
+ g ^1 }: k# A) f- p# M
.text:00401116 cmp byte ptr [edx], 0
# Q" j) R8 o6 G) y% K; q, ?! U
.text:00401119 jz short loc_401147
& w1 w# Y: ^- J: B( ^# u2 f5 Y
.text:0040111B jmp short loc_401120
6 A- e0 v3 H6 E5 X* N0 |, W
.text:0040111B ; ---------------------------------------------------------------------------
, r& `+ E/ m! M
.text:0040111D align 10h
3 h+ F7 H5 U# v' L* Q
.text:00401120
# r9 f! }8 ]$ h5 Q- z
.text:00401120 loc_401120: ; CODE XREF: sub_4010F0+2B↑j
( ^1 `& X* [% F! \
.text:00401120 ; sub_4010F0+3B↓j
2 O$ n3 O J d/ ^
.text:00401120 cmp cl, [edx]
+ g/ \& y3 j, } ]+ e+ L
.text:00401122 jnz short loc_40112D
5 c$ x' V+ T6 h+ K
.text:00401124 mov cl, [eax+1]
) ?5 }( t, A/ }6 f( n& _0 G
.text:00401127 inc eax
& A/ r* @4 _1 T2 I+ E$ Y
.text:00401128 inc edx
/ w) ]! I$ q5 S5 y
.text:00401129 test cl, cl
7 A8 a( r6 E) P1 S/ N- ?( |1 `/ A
.text:0040112B jnz short loc_401120
. p. R2 I$ C, r
.text:0040112D
8 H& I [9 [5 t/ m3 |# m8 [9 \
.text:0040112D loc_40112D: ; CODE XREF: sub_4010F0+32↑j
4 V9 N* l1 U$ s# `
.text:0040112D movzx eax, byte ptr [eax]
1 Z# m- ^- N: P9 T
.text:00401130 movzx ecx, byte ptr [edx]
8 s1 S4 \9 {. y) C" t& h
.text:00401133 sub eax, ecx
: ]; r: J/ \. j. J
.text:00401135 neg eax
$ |3 Q: O4 V/ u- u }6 C/ E
.text:00401137 sbb al, al
, Y" }4 S2 P' _- P
.text:00401139 inc al
# O2 {" ^! {6 O4 [" R* k, f" g7 ]
.text:0040113B xor edx, edx
) g2 \6 `! [* }: X: p6 i8 V
.text:0040113D test al, al
$ j; F% s/ `/ z! f5 |7 s
.text:0040113F setz dl
! h n; G+ F" O; M$ w8 E
.text:00401142 mov al, dl
7 _6 k P9 J9 }. X/ r! N' n4 C/ v8 b* D
.text:00401144 retn 4
8 A9 J+ o( b: i
.text:00401147 ; ---------------------------------------------------------------------------
, Q! D' A8 q% }6 |/ G7 H
.text:00401147
8 n5 \& Z3 [& q; x+ T
.text:00401147 loc_401147: ; CODE XREF: sub_4010F0+8↑j
* @" S% L& i, S; X! E' @" d
.text:00401147 ; sub_4010F0+C↑j ...
" S4 p' S! D% z; U7 S2 T
.text:00401147 xor al, al
/ j) Y: N* X/ e. k. y9 L# E
.text:00401149 xor edx, edx
9 H L* [8 B% M5 \ I$ G0 R& m- W
.text:0040114B test al, al
+ d, {* F7 Q1 u5 x
.text:0040114D setz dl
+ c6 C* o0 T9 r" y6 a
.text:00401150 mov al, dl
/ o1 `- F( E2 v3 D+ t
.text:00401152 retn 4
+ f0 _; b, s: R0 R& I* \, @
.text:00401152 sub_4010F0 endp
! e: F2 K) n8 y4 {% b. s+ i
.text:00401152
8 \4 ~; D# _' t0 H
.text:00401152 ; ---------------------------------------------------------------------------
( l# G' e3 Z- ~" a( l
.text:00401155 align 10h
. \- V* h1 H/ O. R
.text:00401160
* m+ V8 m# h' W3 n* |
.text:00401160 ; =============== S U B R O U T I N E =======================================
d# L( C' y, T- x
.text:00401160
6 I0 i' L# |9 w/ r5 C
.text:00401160
, z$ e! N( \8 U# n
.text:00401160 sub_401160 proc near ; CODE XREF: sub_4013D0+15↓p
% }6 d8 @2 k% a/ t W
.text:00401160 ; sub_4013F0+C↓p ...
: q! @" M- h% b N" {. L5 F; P
.text:00401160
% ?6 q+ h8 V+ b
.text:00401160 arg_0 = dword ptr 4
# L! s. \# ~' Q; l, X5 @) g) Y7 X
.text:00401160
1 M6 n6 r8 G! n
.text:00401160 push esi
# {3 S+ Q5 L/ \
.text:00401161 push edi
1 T5 G3 X2 N, A; c( m
.text:00401162 mov edi, [esp+8+arg_0]
7 ]1 _. j: r# U, ^" V/ H$ N
.text:00401166 test edi, edi
`$ r7 a: U/ }0 o. c! k: V
.text:00401168 mov esi, ecx
+ ]8 o# S+ t/ {( N! q. T
.text:0040116A jz short loc_4011CA
`! Q" L0 l4 D3 i
.text:0040116C mov eax, [esi]
5 i4 U+ }( F* V& V' E/ e
.text:0040116E cmp edi, eax
+ S$ d# X8 \9 Z) {
.text:00401170 jz short loc_4011CA
# J" J( E: H& e7 [+ X" b
.text:00401172 cmp byte ptr [edi], 0
" Y/ ] b2 C* O, J: ~8 j. A8 |' ?- g
.text:00401175 jnz short loc_4011A2
; X" b+ V# B0 r) A0 ]+ `6 ?
.text:00401177 test eax, eax
& ~9 ^5 _+ }; m" g
.text:00401179 mov dword ptr [esi+4], 1
- K( _7 V5 u3 l& @
.text:00401180 jz short loc_40118B
) I! b, E1 ^4 ~& u$ M7 s
.text:00401182 push eax ; void *
0 ~( K0 p# q# A p$ T1 y
.text:00401183 call ??_V@YAXPAX@Z ; operator delete[](void *)
, n% r9 B# ~+ |- F, A$ m
.text:00401188 add esp, 4
8 y6 `" [1 f$ |
.text:0040118B
* [% e* X* ]7 q" V' x
.text:0040118B loc_40118B: ; CODE XREF: sub_401160+20↑j
$ m3 j& b' `" h v$ n4 ~, F0 d
.text:0040118B push 6 ; Size
9 R" r# x/ B9 s
.text:0040118D call j_??2@YAPAXI@Z ; operator new(uint)
7 m9 n# P. A1 k2 S- k
.text:00401192 add esp, 4
9 @/ |* @, h$ P t$ V
.text:00401195 mov [esi], eax
7 Q; \+ O0 S7 _) E/ @
.text:00401197 pop edi
6 J0 N, D4 t) J0 N
.text:00401198 mov dword ptr [eax], 0
" g& h. C8 {1 Y
.text:0040119E pop esi
4 F$ Q8 _- O) V/ l; ^3 [
.text:0040119F retn 4
' j6 h6 a$ V; I, T( M! ]0 F. k; e
.text:004011A2 ; ---------------------------------------------------------------------------
6 i; t* p* Y, C
.text:004011A2
+ N" Z" F+ @9 n; ]. P* T$ D
.text:004011A2 loc_4011A2: ; CODE XREF: sub_401160+15↑j
- l2 X. A0 |6 \! U! U
.text:004011A2 mov eax, edi
' m6 B( a7 M( l0 ^
.text:004011A4 lea edx, [eax+1]
* m( h+ J# C' W! g) r$ o
.text:004011A7
) Y$ i1 Y3 M1 _# H
.text:004011A7 loc_4011A7: ; CODE XREF: sub_401160+4C↓j
6 J) H3 G& |$ w) s0 l1 C$ ` b
.text:004011A7 mov cl, [eax]
7 L7 V7 a: E4 h: t. _, P
.text:004011A9 inc eax
v, e3 g% Q2 b
.text:004011AA test cl, cl
% J4 i+ d" @" R( q1 @! m
.text:004011AC jnz short loc_4011A7
8 r3 ?2 P' E; Y- g O
.text:004011AE sub eax, edx
S% U2 L; n7 [8 u
.text:004011B0 push eax
) Y" W" ^+ n+ q. |7 n# P* ?8 @4 ^
.text:004011B1 mov ecx, esi
' e% w+ ]9 K! M
.text:004011B3 call sub_401030
: E+ _9 _$ A% V
.text:004011B8 mov edx, [esi]
# c# D' z' [% ]7 N& J
.text:004011BA mov ecx, edi
; l, X, [- d7 u( K2 H
.text:004011BC lea esp, [esp+0]
7 G: x. v- |' k, W6 F% i4 V
.text:004011C0
% C4 S3 Q. z0 E8 l+ \- v
.text:004011C0 loc_4011C0: ; CODE XREF: sub_401160+68↓j
; \. V' s3 z5 _1 V% n: L, M. k
.text:004011C0 mov al, [ecx]
: K# v, d) L4 y
.text:004011C2 inc ecx
" d6 a, c5 w: d' A7 z* Z
.text:004011C3 mov [edx], al
: W, E0 m6 z2 U
.text:004011C5 inc edx
3 v) y# K/ \3 W+ D
.text:004011C6 test al, al
3 n* Z2 P' J" z
.text:004011C8 jnz short loc_4011C0
; G8 b/ ^1 U+ y, j7 x, T) ^
.text:004011CA
2 x0 O- l& Z) }0 w# s, ` e* `7 d2 V
.text:004011CA loc_4011CA: ; CODE XREF: sub_401160+A↑j
& H) F3 M+ P* _7 | b% W
.text:004011CA ; sub_401160+10↑j
' t5 O9 Y! V, ^2 T6 B8 o3 Y3 w
.text:004011CA pop edi
9 k4 i) @8 H8 J d! Q- B
.text:004011CB pop esi
% J' B1 B' J: _" _9 X# N6 y9 c
.text:004011CC retn 4
" x: Y& X2 c/ n0 o
.text:004011CC sub_401160 endp
$ K. ~* o, A0 w: O5 c2 s3 h
.text:004011CC
r9 b/ `7 _9 J+ s) L* F' t
.text:004011CC ; ---------------------------------------------------------------------------
复制代码
8 B' ^8 H( k( J. d0 U; S; p
0 m" |) Z- I5 S* P, I y" d
' G$ ~: t4 A0 ?. r, C j
欢迎光临 冒险解谜游戏中文网 ChinaAVG (https://chinaavg.com/)
Powered by Discuz! X3.2