冒险解谜游戏中文网 ChinaAVG
标题:
【Directx9游戏汉化 #9】来世(nextlife) 字幕显示函数
[打印本页]
作者:
shane007
时间:
2023-8-27 13:22
标题:
【Directx9游戏汉化 #9】来世(nextlife) 字幕显示函数
本帖最后由 shane007 于 2023-8-27 13:23 编辑
$ W$ E3 Z0 D! x: n+ ^
% Q. X3 z; _% G1 L( e
本游戏采用了CEGUI,该组件能采用directx和opengl。
- a0 `4 j# D; D* Y3 w* p q" `9 `
经过我的小方块测试,游戏屏幕显示了小方块,因此确认是directx9的游戏。
# _; B# y6 H% f( x, _
游戏自带一个EngineSetup.exe程序,设置为窗口模式后就能用cheatengine调式。
- ^$ r. T! G0 e2 h
(由于游戏窗口较大,我将游戏屏幕和cheatengine分别显示到2个显示器上即可。)
+ l7 R8 E5 B8 P& [# h% N( i
: c! i- u: b0 S3 G4 Y5 B$ [
2 s* {$ K# K( y! g' ]$ P( I3 P
在游戏中找一个字幕,在以下地方断下。
- V" p, F- W3 w8 J" r' t
由于该游戏基本都是显示在屏幕固定位置(上或者下,居中),
, A6 v8 N7 f6 k
因此暂时认为此处就是游戏的字幕函数,该函数被20处左右地方调用。
0 K9 ~, ^ E: v5 J
1 z0 `1 Q {8 W; r4 K) o
NextLife.exe+11C5 - 42 - inc edx
2 o- k9 g% ?, ~0 h( m
004011C5
复制代码
. \. B& `* r8 E5 M# V
( g) j( b/ v! K i( P
该地方的伪代码
- }3 ?3 Y( v8 e. V8 u. k w
void __thiscall sub_401160(char **this, const char *a2)
" d, f" C' m4 }( I4 Y
{
1 a4 O6 p3 K8 k: G4 z
char **v2; // esi
: a5 Q" n& c+ V; R8 O; F
char *v3; // eax
% U+ Q# {0 x; A. K
char *v4; // eax
. ?* K- s1 S! K* P ], S- O
3 x9 K3 @8 M% i k ^$ \/ Q
v2 = this;
8 I+ N# m8 ^: |8 J
if ( a2 )
- {0 u! S: i* u* P% o: ^
{
- W/ h ?+ u7 ]
v3 = *this;
; ~) |/ S u* X2 t# z
if ( a2 != *this )
+ u3 A# a0 A4 Q! `3 }$ ?
{
6 o& l% j2 g) V" X
if ( *a2 )
. N! K$ b1 a: _- b; O' `& x
{
; x* `4 t1 R$ V7 S3 K
sub_401030(strlen(a2));
: R7 w, L% V' ?
strcpy(*v2, a2);
& |; I. j: h5 M" G4 `
}
( b- G( M/ {- q- P4 w
else
' j* t" Z$ R& b/ u* s. S% p
{
6 z% I5 A3 Z y
this[1] = (char *)1;
# d) v7 J: ]9 c ~/ x) E* s
if ( v3 )
( ^2 j! ^- k- A) e; f5 \( r
operator delete[](v3);
+ f3 I1 W/ p$ L4 K" U5 D
v4 = (char *)operator new(6u);
( o+ k8 \$ t5 J: P8 B# T
*v2 = v4;
( V* @- ^# X1 J4 H
*(_DWORD *)v4 = 0;
. H$ G2 R/ A( x" g
}
8 d- t2 r* v1 x! @* @
}
, o+ B0 R& v9 o( u G W$ ~1 `& j
}
# T! m$ \" @5 ^6 F+ R; k# E
}
复制代码
6 U2 @5 R! R: `: w# j( z! r
汇编代码
( [! f: @2 ~5 {5 {5 E& P7 B
.text:004010F0
* N. k7 ?" p7 @/ w
.text:004010F0 ; =============== S U B R O U T I N E =======================================
( b% k8 l# w( h' _ M% A6 ] x
.text:004010F0
1 R7 |1 l' z2 @' a6 S0 s1 f
.text:004010F0
& M# C+ W6 N8 E6 M6 t. `( i, m
.text:004010F0 sub_4010F0 proc near ; CODE XREF: _main+139↓p
2 T8 }8 j) g7 l7 T) F1 T4 r6 O# I N8 K
.text:004010F0 ; sub_403240+97E↓p ...
, |3 e5 a% U, n/ i7 H0 I9 j4 \
.text:004010F0
1 ~6 m6 N8 o6 `2 \0 ?- Z) H( H) A
.text:004010F0 arg_0 = dword ptr 4
: Z# ~8 @0 h7 u3 D6 ^
.text:004010F0
$ c+ D& v4 H" k, x* p# d( O
.text:004010F0 mov eax, [ecx]
! t! \( c4 r/ T/ _0 R1 ?. e- w) J
.text:004010F2 test eax, eax
1 C. ?2 W5 G z. Y) z# P4 ~9 w
.text:004010F4 mov edx, [esp+arg_0]
& K, W- O% { W' @. w1 F, m
.text:004010F8 jz short loc_401147
3 F" ]+ m# c/ O, n5 |- g
.text:004010FA test edx, edx
+ [2 j: {# n) I2 J* q* o+ i% V
.text:004010FC jz short loc_401147
1 m7 V0 O$ Q2 _ R
.text:004010FE mov cl, [eax]
" n% {# S/ D, Q$ I! J) Y
.text:00401100 test cl, cl
& r: N% [9 U; O9 F
.text:00401102 jnz short loc_401116
5 T, p1 p" @% [8 A
.text:00401104 cmp byte ptr [edx], 0
4 v0 h1 A; a- F) f! g# y8 w! H
.text:00401107 setz al
: n6 v$ @% y/ H
.text:0040110A xor edx, edx
- E0 v; I, _9 n8 |
.text:0040110C test al, al
! l6 k: D8 s: Q# \" W; e! R
.text:0040110E setz dl
9 z9 C: o$ o# G0 G; U
.text:00401111 mov al, dl
3 C% s v5 \- D# k e9 V
.text:00401113 retn 4
& C/ \8 F2 L8 x( K: {' X) n( l
.text:00401116 ; ---------------------------------------------------------------------------
3 ^, `( ^0 M9 a" h. P6 \1 w
.text:00401116
- w9 c: G+ _ q% O" h& s: ^
.text:00401116 loc_401116: ; CODE XREF: sub_4010F0+12↑j
# C# C' Z3 w/ W# Y8 A& D! G) M
.text:00401116 cmp byte ptr [edx], 0
! L" W/ C: L& Q! v
.text:00401119 jz short loc_401147
6 o) O2 p: [. J# J. d! S
.text:0040111B jmp short loc_401120
' K" R5 B n8 `' _
.text:0040111B ; ---------------------------------------------------------------------------
: G. {) \" n) U6 c7 N. E" f7 L
.text:0040111D align 10h
) [$ k; n. I; B: m5 ] N/ D! c
.text:00401120
, C% |- r; E- Z v
.text:00401120 loc_401120: ; CODE XREF: sub_4010F0+2B↑j
$ _, G& \' h |" l. n
.text:00401120 ; sub_4010F0+3B↓j
" ^, G) }- K5 L* X
.text:00401120 cmp cl, [edx]
9 ~+ ^% a( ^9 \; v
.text:00401122 jnz short loc_40112D
$ s0 u* v( f5 [2 V: z* c0 B3 e. {3 e+ R
.text:00401124 mov cl, [eax+1]
) B$ {5 D+ i* f8 g! A2 E
.text:00401127 inc eax
$ [+ R) N! O8 J, r8 H
.text:00401128 inc edx
; q9 w& ]) U0 Y7 u- S, R B$ W
.text:00401129 test cl, cl
9 z8 z, y; m! G, e" D7 u) R
.text:0040112B jnz short loc_401120
# w1 p1 _" H7 X) i1 c+ s
.text:0040112D
! m* [; O; o- z5 |2 ]9 `8 M. {
.text:0040112D loc_40112D: ; CODE XREF: sub_4010F0+32↑j
! v+ z- i# \1 {) Q
.text:0040112D movzx eax, byte ptr [eax]
" b" H0 f1 m6 U) t! l
.text:00401130 movzx ecx, byte ptr [edx]
. r$ Y$ S8 o3 \5 P
.text:00401133 sub eax, ecx
: x/ A" U2 I; N5 \- Q
.text:00401135 neg eax
" `3 H7 [) ^ u4 X) ]' j+ j
.text:00401137 sbb al, al
- ?8 v( D# p# G1 {
.text:00401139 inc al
' J! g8 j0 r! ?
.text:0040113B xor edx, edx
6 @1 k9 N0 M" h; {! {$ }3 n
.text:0040113D test al, al
4 Z8 t* X7 p a( b
.text:0040113F setz dl
: o, P A! Q# j# U
.text:00401142 mov al, dl
! U' y4 d C" L
.text:00401144 retn 4
j9 J5 s1 o# N6 @
.text:00401147 ; ---------------------------------------------------------------------------
1 D) D# m# [, a* }; m' m; M, V% E2 T
.text:00401147
. x3 {" i( z* Z/ k3 T6 u( w. [
.text:00401147 loc_401147: ; CODE XREF: sub_4010F0+8↑j
8 {* j6 m. U' [8 l% O* p
.text:00401147 ; sub_4010F0+C↑j ...
$ t. f2 Z$ M4 E+ c2 L
.text:00401147 xor al, al
' q) R% s' h& p, Q6 X
.text:00401149 xor edx, edx
5 P' S8 d( t! r4 ^' V3 o
.text:0040114B test al, al
! h) l4 j) R) p9 @1 g3 y W! v
.text:0040114D setz dl
! A* |, K9 B# P, g( Y
.text:00401150 mov al, dl
; s$ |7 _- p* B
.text:00401152 retn 4
; l4 p+ s" H$ A/ V
.text:00401152 sub_4010F0 endp
h7 y8 d5 E7 g5 d( O- s" A$ K
.text:00401152
2 X( P5 f% t0 a# T4 H. L2 \
.text:00401152 ; ---------------------------------------------------------------------------
4 H0 a. v3 U* C) E
.text:00401155 align 10h
( [# | l3 x K" l
.text:00401160
! `1 k% s% P- x5 e j% S
.text:00401160 ; =============== S U B R O U T I N E =======================================
1 |) F4 D+ [; o" |
.text:00401160
, z' p4 m: p4 D- \2 p% Y I. |# h+ S
.text:00401160
y4 y9 n5 S0 h2 W+ i b0 i
.text:00401160 sub_401160 proc near ; CODE XREF: sub_4013D0+15↓p
: W- H- y. E: o4 V
.text:00401160 ; sub_4013F0+C↓p ...
4 Y3 O9 F7 E8 Z
.text:00401160
: X7 c1 {1 l. X0 o+ Y
.text:00401160 arg_0 = dword ptr 4
# W+ j/ t& G0 K% X6 Y' F' }5 E
.text:00401160
. {$ ]4 b) k4 R3 w* {
.text:00401160 push esi
u& h4 f; p. n# f/ K9 Q
.text:00401161 push edi
8 h" @# I& l0 Q+ z& Y# y
.text:00401162 mov edi, [esp+8+arg_0]
% u% H' X" r! M i+ Q3 D
.text:00401166 test edi, edi
e) H! p, L# s& w# r
.text:00401168 mov esi, ecx
8 z; Y T( \6 V: c
.text:0040116A jz short loc_4011CA
& s/ Y+ e7 A2 I" Q. }( G
.text:0040116C mov eax, [esi]
- q. k7 k7 J- k* r* E5 |8 a- o( ~
.text:0040116E cmp edi, eax
& n7 K Z+ h6 T' I
.text:00401170 jz short loc_4011CA
) Z4 X& q* s4 L c- C
.text:00401172 cmp byte ptr [edi], 0
, `& [" }* Q7 y6 }# v) G! `
.text:00401175 jnz short loc_4011A2
: ]& n& `/ `0 N* ^
.text:00401177 test eax, eax
( Q2 `' U3 J8 k% a) Y) H, Z
.text:00401179 mov dword ptr [esi+4], 1
# S! h0 N/ j0 e" G X$ i. [9 F+ K$ m7 v
.text:00401180 jz short loc_40118B
% ?* w7 `# M( u4 ]7 g* C
.text:00401182 push eax ; void *
( ? ^2 Z- k* Y* D
.text:00401183 call ??_V@YAXPAX@Z ; operator delete[](void *)
1 U. s& c n4 D5 S0 y ^& h: g
.text:00401188 add esp, 4
7 o4 R$ s: l" Z$ D) s' L
.text:0040118B
" T- V) c( c+ D; v% `/ Z" t
.text:0040118B loc_40118B: ; CODE XREF: sub_401160+20↑j
: ^$ \7 R1 \. t1 O. i9 H7 R' k
.text:0040118B push 6 ; Size
& ~( j3 R* f; k- K. m7 u9 r7 E
.text:0040118D call j_??2@YAPAXI@Z ; operator new(uint)
: o# Q& h% I2 q& @* a+ G
.text:00401192 add esp, 4
! r* f. f* {0 E3 Z
.text:00401195 mov [esi], eax
2 W1 g) i! N- y0 W, A
.text:00401197 pop edi
& L* Q6 U: t3 R2 m
.text:00401198 mov dword ptr [eax], 0
. N" \, E4 t* ?- D4 u4 G
.text:0040119E pop esi
1 e" ~# z1 N9 T) F% a
.text:0040119F retn 4
8 n* i$ L0 n7 A# A
.text:004011A2 ; ---------------------------------------------------------------------------
7 W9 i, z9 L% p
.text:004011A2
1 Q9 j- P7 ]4 `# B6 {2 ~2 t
.text:004011A2 loc_4011A2: ; CODE XREF: sub_401160+15↑j
+ Z( R8 z9 x' O- W9 a( g; X, B
.text:004011A2 mov eax, edi
# w1 @( h2 T. P H' `% ^$ Q6 b
.text:004011A4 lea edx, [eax+1]
5 V' U' I% {/ n/ F
.text:004011A7
& S7 n5 Y. |$ E# q) y1 b2 t! ~
.text:004011A7 loc_4011A7: ; CODE XREF: sub_401160+4C↓j
- ?. m1 a5 I5 ~# r) h7 z1 c: K& V
.text:004011A7 mov cl, [eax]
3 s M9 P1 p$ h
.text:004011A9 inc eax
% y. ~) g2 w% D- t
.text:004011AA test cl, cl
8 x$ t8 @) x2 \2 \9 G) ^0 g
.text:004011AC jnz short loc_4011A7
" x/ B6 Y5 Y- [- F3 |/ y
.text:004011AE sub eax, edx
; G6 t" @/ x0 |! V) b
.text:004011B0 push eax
3 v) D: o) @ d) e& e; p
.text:004011B1 mov ecx, esi
* R) y8 p# m6 ]
.text:004011B3 call sub_401030
+ X' e! }# T3 Q
.text:004011B8 mov edx, [esi]
0 L. U1 c. V# q7 A+ H- x
.text:004011BA mov ecx, edi
6 g6 i! p/ X T$ s5 z
.text:004011BC lea esp, [esp+0]
* G6 R* p* i/ I7 k; w% t
.text:004011C0
/ `9 L' h8 r T8 U
.text:004011C0 loc_4011C0: ; CODE XREF: sub_401160+68↓j
: z# ?8 n: j1 E
.text:004011C0 mov al, [ecx]
4 T/ ~4 K5 y. ~* G
.text:004011C2 inc ecx
% g& G' x( }3 {: \
.text:004011C3 mov [edx], al
/ i L" T% R$ J5 B: A/ E# x
.text:004011C5 inc edx
7 A# ^# a* }, [' \! f
.text:004011C6 test al, al
0 Q6 i9 z& W/ x8 H" m' d
.text:004011C8 jnz short loc_4011C0
8 z, N* p3 ?, h+ j% f
.text:004011CA
e& e' \% S3 j5 Y* I
.text:004011CA loc_4011CA: ; CODE XREF: sub_401160+A↑j
9 Q* P9 j4 q+ @% Y
.text:004011CA ; sub_401160+10↑j
# T8 Q" W+ h1 B! S
.text:004011CA pop edi
4 j* k5 t+ M) n3 d
.text:004011CB pop esi
/ A$ L0 q1 i+ f" F
.text:004011CC retn 4
4 _ F1 ^% {4 o# i* p
.text:004011CC sub_401160 endp
) N) [( h0 P/ b: U$ X
.text:004011CC
, P8 P P, @6 D k
.text:004011CC ; ---------------------------------------------------------------------------
复制代码
4 I" O) z1 z: y `
V# o( l8 x4 H+ J" I
8 K7 s q1 y/ f* `1 N
欢迎光临 冒险解谜游戏中文网 ChinaAVG (https://chinaavg.com/)
Powered by Discuz! X3.2