本帖最后由 shane007 于 2023-8-27 13:23 编辑
, U2 t& v1 D/ W4 c: a' |1 [, W! A+ U6 f5 ^
本游戏采用了CEGUI,该组件能采用directx和opengl。3 V1 \) n( h% u+ ^4 X( m7 _1 z
经过我的小方块测试,游戏屏幕显示了小方块,因此确认是directx9的游戏。
( Z4 ~0 w6 [* B" y游戏自带一个EngineSetup.exe程序,设置为窗口模式后就能用cheatengine调式。0 E3 ]$ e$ y& N9 v4 ]
(由于游戏窗口较大,我将游戏屏幕和cheatengine分别显示到2个显示器上即可。)- r5 @3 h/ A& }2 v/ }2 [' ]7 Y
; c" L: i5 k3 j7 O- u! n
: m( Z! P' c. C3 }. x+ Y在游戏中找一个字幕,在以下地方断下。4 ?5 L5 D. r* ~* }/ H8 C+ X) x
由于该游戏基本都是显示在屏幕固定位置(上或者下,居中),
$ v5 ^7 H2 j9 N \4 |9 m2 A% l因此暂时认为此处就是游戏的字幕函数,该函数被20处左右地方调用。, z1 c' j& C+ D) \
' R* }& U8 F: V9 j: p+ t- NextLife.exe+11C5 - 42 - inc edx' n* Y/ E; p% f% d
- 004011C5
复制代码 - m9 X) W/ }% ?
0 T% Q( g T* y |' j4 E R
该地方的伪代码
+ B) W' `1 n/ p# R2 I- void __thiscall sub_401160(char **this, const char *a2)
" c* t) N) H% G& ?: ]$ i* x! @ - {
- [5 `2 S4 j7 s1 o - char **v2; // esi# l" g, x8 D1 |1 |. U. P
- char *v3; // eax7 x. \. R6 z- H. g
- char *v4; // eax
8 m/ {$ X$ n v9 K8 i - ; T+ O1 y' F2 M$ H& N1 z! [
- v2 = this;
1 n9 L/ y5 i% [! @& }* A- h. j - if ( a2 )+ i* x1 l$ c4 v* B$ X L
- {
, p6 O6 G. O- H5 ]( f4 x6 e - v3 = *this;
; N+ h/ T( z6 k3 x7 T2 A$ } V! Z - if ( a2 != *this )1 j% C- S q0 u7 Q
- {% v" G# F* ?9 m3 a) P3 ?
- if ( *a2 )
( d, L$ h7 \. v3 \6 ] - {* {/ m/ R V/ m$ R' y1 [
- sub_401030(strlen(a2));
5 o1 i% {$ B0 j3 i) T - strcpy(*v2, a2);
6 ^2 p1 \+ A+ `2 N5 b8 }& b9 Y1 s - }
) e$ W2 z; I# t% N( g - else
' K8 P( w1 n" V: M$ q3 a7 a. c - { n0 l7 t0 x+ {3 }$ C9 \& t
- this[1] = (char *)1;
9 S/ x# }$ K/ i5 f3 n& ? - if ( v3 )
K: ^; M- |& e$ q T1 x/ @/ ] - operator delete[](v3); L8 F3 R) T9 H" d7 Y& _
- v4 = (char *)operator new(6u);
8 N0 y* S$ b8 e: ^# h7 f$ ? - *v2 = v4;
3 s; t, ^6 E( n8 l8 a- M! | - *(_DWORD *)v4 = 0;
8 L' C9 G9 r& S7 C3 Y% X K6 y - }8 {% O" w2 g/ g' Q% G- r6 Z# S
- }* X7 |! D8 I* e
- }% `$ G' v1 ^( W u* N% e c
- }
复制代码 # I9 C; @! J1 X$ n7 z2 K
汇编代码
, R) A6 b/ P2 d5 m- .text:004010F0) i! {2 P, Y0 A& S2 ^. b- m
- .text:004010F0 ; =============== S U B R O U T I N E =======================================% b! f1 P9 j5 L8 L0 z
- .text:004010F0/ _9 q$ \" T8 R1 I$ a. Q
- .text:004010F0
* b- s" ^. @0 Q! Z( t! D3 ~ - .text:004010F0 sub_4010F0 proc near ; CODE XREF: _main+139↓p
: g5 r/ ~! v. D) P: H - .text:004010F0 ; sub_403240+97E↓p ...
" R7 X+ F) m! A; S7 P: K4 l3 j - .text:004010F0, K4 h0 c% c( | P2 E) q9 ^- |
- .text:004010F0 arg_0 = dword ptr 4# O+ F& J9 t- S8 X* v9 \
- .text:004010F0
. `! {5 f7 |7 u, `3 V - .text:004010F0 mov eax, [ecx]
. z- K i9 E2 Z2 {, D - .text:004010F2 test eax, eax
: }' ~, L- T. W8 g" }0 J - .text:004010F4 mov edx, [esp+arg_0]' H3 \, b, B2 U k/ T2 }
- .text:004010F8 jz short loc_4011474 Z3 b! j" x7 d3 S' M5 \
- .text:004010FA test edx, edx
" ?" U* }& a5 c3 e* @ - .text:004010FC jz short loc_401147% _" V. q( }7 V) s B& @
- .text:004010FE mov cl, [eax]) h' K8 J% M) v. D- {
- .text:00401100 test cl, cl
) C7 O: O) r9 E% N+ m; J - .text:00401102 jnz short loc_401116
4 k6 r3 B; l. b( H - .text:00401104 cmp byte ptr [edx], 0
1 q6 p4 G' k/ } - .text:00401107 setz al1 p" s' B2 c8 t2 n5 p
- .text:0040110A xor edx, edx( c5 J {. |6 N0 l6 d# I
- .text:0040110C test al, al0 S! l Y1 T( U8 e& g
- .text:0040110E setz dl
) F! e6 ^) }' |! `2 b - .text:00401111 mov al, dl( b, B. ^- ?0 G9 |3 C) G6 b
- .text:00401113 retn 49 z O% n+ \7 Y2 g b
- .text:00401116 ; ---------------------------------------------------------------------------) ~1 P4 c( D3 V$ r
- .text:00401116 V2 u! o: ~9 C' i8 k
- .text:00401116 loc_401116: ; CODE XREF: sub_4010F0+12↑j
7 h! o- Q8 k# T# d - .text:00401116 cmp byte ptr [edx], 03 u/ U O1 o" A v* m9 ?) J0 C
- .text:00401119 jz short loc_401147
5 @$ p: Z1 M- m/ s( X) s9 S' ?! k - .text:0040111B jmp short loc_401120# G6 V ` M* w
- .text:0040111B ; ---------------------------------------------------------------------------
) _: H$ {. j, }. o' L! o3 z$ H - .text:0040111D align 10h
! F5 p6 l& A) ?3 W- P - .text:00401120/ u- o O! k x, ~7 v/ H
- .text:00401120 loc_401120: ; CODE XREF: sub_4010F0+2B↑j
4 Z) J5 q9 t* b. d9 ~$ |( i/ ] - .text:00401120 ; sub_4010F0+3B↓j0 ]0 K ]: f3 }: e
- .text:00401120 cmp cl, [edx]
& ~/ r) g5 \- c- y - .text:00401122 jnz short loc_40112D$ V/ R5 u! ?# v" e( H
- .text:00401124 mov cl, [eax+1]+ e% z6 v/ [8 o4 n! n& R. f9 @
- .text:00401127 inc eax
7 J; ]' V. a+ [ |7 L - .text:00401128 inc edx/ k. Z3 `2 Q) o9 j z+ t
- .text:00401129 test cl, cl- r$ X, g: F5 _: u# j3 V( J$ G
- .text:0040112B jnz short loc_401120
/ n! H: O( z( V2 G8 R - .text:0040112D
* |: t3 B' r( ~" }0 u2 F - .text:0040112D loc_40112D: ; CODE XREF: sub_4010F0+32↑j. N2 m# k( c( N2 |6 d: m% r/ e
- .text:0040112D movzx eax, byte ptr [eax]
: @* I# c: z% y; I) Y5 h - .text:00401130 movzx ecx, byte ptr [edx]; D1 |0 m& ^1 c% k; W' b8 X) Y* y8 @
- .text:00401133 sub eax, ecx r5 n: U' @1 M; }5 r* z
- .text:00401135 neg eax% e! j% B% ?1 ~1 M) |5 G
- .text:00401137 sbb al, al
) b: r8 [8 z2 M! ]0 `- \, Z' S5 ^+ V - .text:00401139 inc al
, V2 a7 ~# ]( G: p1 }5 ?2 K - .text:0040113B xor edx, edx: `. h; d: b A
- .text:0040113D test al, al! y# r5 k' U( Q; i( Y; d
- .text:0040113F setz dl
) ?# D6 [; Z1 L K - .text:00401142 mov al, dl: M/ s1 J/ B2 Z
- .text:00401144 retn 4
; O3 w" a! U5 Y& m# Y; H9 s - .text:00401147 ; ---------------------------------------------------------------------------& t+ u( H9 y( _% w% x
- .text:00401147
( ~8 O# Y; c7 e% M! y7 z - .text:00401147 loc_401147: ; CODE XREF: sub_4010F0+8↑j- G) r' c* c# o% X
- .text:00401147 ; sub_4010F0+C↑j ...
; W2 D- k. t( R: }8 f, _' D# d - .text:00401147 xor al, al
) J6 X* d) y# t - .text:00401149 xor edx, edx
9 J2 r" e1 y6 l5 C1 l+ d$ c - .text:0040114B test al, al- {: `5 t5 V2 k2 Z
- .text:0040114D setz dl4 W, c9 b5 A2 N. `) `
- .text:00401150 mov al, dl' m8 v4 m0 m8 p3 G
- .text:00401152 retn 4
G2 s, j. A- u5 a9 y8 G* d* a) x4 j - .text:00401152 sub_4010F0 endp
4 C7 K8 U, e* R# O) i2 T - .text:004011528 W# D* t& Z5 d# e: i4 F
- .text:00401152 ; ---------------------------------------------------------------------------: G0 p4 L ]# G- j4 ^. X6 ~- u
- .text:00401155 align 10h
. I Y% A, T& b - .text:00401160
/ j2 z2 x* d k; b - .text:00401160 ; =============== S U B R O U T I N E =======================================
+ l, t# Q+ K9 ? - .text:00401160# k9 ]+ \: |+ W
- .text:00401160
) f0 k" n! o5 C+ H) a V$ l' g9 r - .text:00401160 sub_401160 proc near ; CODE XREF: sub_4013D0+15↓p
" p' g. t# B0 T" p: ]0 z" w2 g - .text:00401160 ; sub_4013F0+C↓p ...
: M& t: B+ ^; U9 ^9 ^' I7 E* [ - .text:00401160
) K( p z" T7 q$ `: f+ M% E - .text:00401160 arg_0 = dword ptr 4* r+ v) \5 z9 K' O8 p% k
- .text:004011606 Z% {9 x: g5 k% ?! a
- .text:00401160 push esi
9 r( C) ?- `1 U8 v" Y - .text:00401161 push edi( n8 s p. u; D' c; J2 V
- .text:00401162 mov edi, [esp+8+arg_0]6 _( h4 }. _% ~0 S9 T0 R
- .text:00401166 test edi, edi
7 h* Z- R2 b3 c: L* u - .text:00401168 mov esi, ecx
, Q2 H0 r0 s7 Y! | - .text:0040116A jz short loc_4011CA- J* x# k% E7 Z1 o
- .text:0040116C mov eax, [esi]
/ s! @6 \* x: @/ V - .text:0040116E cmp edi, eax
6 t( ?) ^( G0 q o) ?' D* ? - .text:00401170 jz short loc_4011CA7 B' I! A8 m9 q) Q" }2 ^
- .text:00401172 cmp byte ptr [edi], 0
2 z# g( ~- A. D0 [8 | - .text:00401175 jnz short loc_4011A2. I7 u! h% p/ @7 q7 W! z$ \6 c2 ^1 b
- .text:00401177 test eax, eax
" y3 r* U3 P& r7 K - .text:00401179 mov dword ptr [esi+4], 14 K; G, r* j! U$ k) s
- .text:00401180 jz short loc_40118B
" u9 ~; V) k0 H& A - .text:00401182 push eax ; void *
3 s) r) d/ e% X - .text:00401183 call ??_V@YAXPAX@Z ; operator delete[](void *)
/ [3 U2 w3 d6 N/ e - .text:00401188 add esp, 4
$ v |& V" w/ y/ m; `5 F! t$ y - .text:0040118B! H7 o9 Y$ D a5 S( v5 q
- .text:0040118B loc_40118B: ; CODE XREF: sub_401160+20↑j/ W9 ~, m4 [. ?7 a
- .text:0040118B push 6 ; Size
1 S5 l! z' [5 g) ~2 v# p - .text:0040118D call j_??2@YAPAXI@Z ; operator new(uint)
; m" h0 O. A- Z! B - .text:00401192 add esp, 4
2 A) `5 T; l3 K/ \! H+ x; q - .text:00401195 mov [esi], eax+ G, M( i9 f# ]- Y5 G
- .text:00401197 pop edi" O: x/ n0 Y. h9 k" |
- .text:00401198 mov dword ptr [eax], 0
3 ]: n1 |0 X* H/ u h/ v - .text:0040119E pop esi" l3 U+ o- Y3 p' u: R. j: ]
- .text:0040119F retn 41 P O$ X# V1 i5 t: j
- .text:004011A2 ; ---------------------------------------------------------------------------
0 f# T8 @1 N) p8 B8 X# n - .text:004011A27 e# f* Z, J* v; B
- .text:004011A2 loc_4011A2: ; CODE XREF: sub_401160+15↑j7 |; T; K( r- o
- .text:004011A2 mov eax, edi+ X1 z$ [. z! J" N
- .text:004011A4 lea edx, [eax+1]
/ y5 v9 G7 x$ t; M, o& R - .text:004011A7( H( _; i) f; @ H$ k
- .text:004011A7 loc_4011A7: ; CODE XREF: sub_401160+4C↓j
i' i- V) E& R) R9 V+ w - .text:004011A7 mov cl, [eax]' x( I% d" X% Q s U
- .text:004011A9 inc eax" b4 u( C1 Z5 |
- .text:004011AA test cl, cl
/ N4 ?( s7 P' o6 D) o ?( [7 n - .text:004011AC jnz short loc_4011A7, X# ^ U4 a4 F4 i3 u- ~9 n2 ]
- .text:004011AE sub eax, edx7 j: g# l/ v- S+ x _
- .text:004011B0 push eax
; @* B* M0 h4 }+ m0 d) b+ C - .text:004011B1 mov ecx, esi! ?6 n' d; F3 ?& q& D
- .text:004011B3 call sub_401030
& ]: \2 U- A. I$ h& m" |: I - .text:004011B8 mov edx, [esi]2 @! T! [9 m, N7 Y* }
- .text:004011BA mov ecx, edi
& v( } p1 b; d$ a( u - .text:004011BC lea esp, [esp+0]. W; L$ X b$ H! r
- .text:004011C0$ }: {/ G. {' n+ i u5 _
- .text:004011C0 loc_4011C0: ; CODE XREF: sub_401160+68↓j/ s* o+ o$ Z( b! G) ~0 ]1 V
- .text:004011C0 mov al, [ecx]2 _: s# D8 ?$ p: m& w7 f% x
- .text:004011C2 inc ecx7 L: u- y4 N. a8 s& u
- .text:004011C3 mov [edx], al7 R9 x6 @0 b- @, f2 n: L
- .text:004011C5 inc edx3 x0 x: N: A% f6 f! o8 h
- .text:004011C6 test al, al
w* W) f! I, Q# [ - .text:004011C8 jnz short loc_4011C0# s, b( \) n0 H! H8 ], \
- .text:004011CA; B( |+ T% u) E2 z4 C4 e
- .text:004011CA loc_4011CA: ; CODE XREF: sub_401160+A↑j. s, N+ u; h9 |- a' W9 Q0 H- m
- .text:004011CA ; sub_401160+10↑j1 @" v* E X# t$ {
- .text:004011CA pop edi0 a& m- D& W% i- S+ p2 h9 q/ v& q
- .text:004011CB pop esi$ e. j! P5 {3 u
- .text:004011CC retn 4
. r; d# j: k/ J; w+ y" V) @5 U - .text:004011CC sub_401160 endp0 @, v7 \5 M! i. S3 Y/ s8 _ p
- .text:004011CC7 H& }2 e3 ~7 G. ]9 \, i# a5 P
- .text:004011CC ; ---------------------------------------------------------------------------
复制代码 $ _4 ~, L5 z/ W% ~
1 ?! q+ ^" N* K' [
( p: R% N w! m4 E |