本帖最后由 shane007 于 2023-8-27 13:23 编辑
5 W/ a3 ]2 V* u9 l3 R) L; T2 ^( m" z" ^& Q
本游戏采用了CEGUI,该组件能采用directx和opengl。
/ A y' D7 m" b经过我的小方块测试,游戏屏幕显示了小方块,因此确认是directx9的游戏。
7 U8 Z- k. O5 F4 Z. K* c7 @游戏自带一个EngineSetup.exe程序,设置为窗口模式后就能用cheatengine调式。- v$ I; K5 ]6 E7 p. L7 h! W
(由于游戏窗口较大,我将游戏屏幕和cheatengine分别显示到2个显示器上即可。)# I l9 t6 x- j
( A( e! _! U/ u. ^ w. R, i7 r1 \" v7 K! m5 o$ w$ \; h, B
在游戏中找一个字幕,在以下地方断下。
: Q8 }* K- ~' x8 U& d) ~由于该游戏基本都是显示在屏幕固定位置(上或者下,居中),3 V0 g, ~/ |' u
因此暂时认为此处就是游戏的字幕函数,该函数被20处左右地方调用。# P* ^" A/ V+ J( l8 `5 b
1 h8 t2 p' i, D$ m2 h' }5 h- z
- NextLife.exe+11C5 - 42 - inc edx
( C0 z) q7 ]' I- I$ X+ I - 004011C5
复制代码
* g8 B8 r7 G7 g$ m: A/ f7 u9 s! g4 I7 q# D1 I
该地方的伪代码
5 z, ] T* m1 T" D- z5 `- void __thiscall sub_401160(char **this, const char *a2). o; v/ X" }! i) Q1 Q% |8 [
- {* ^& _9 F& @9 w+ Y: c5 ^% }0 C
- char **v2; // esi
. h7 V& r2 Y- f+ ]" a - char *v3; // eax$ A! G' |- T2 E$ V6 P1 F
- char *v4; // eax
1 [) `1 ^0 v! V& F0 c5 g% a W - 1 v2 `& M& o: \* E \8 G% D
- v2 = this;+ S% x/ Y A' q" a: v: s9 q7 C
- if ( a2 )
* R/ e8 d) Z* s$ o: q! _ - {- \0 [; N; i3 I1 H0 J4 A
- v3 = *this;
' D2 A! ?3 u: s$ v - if ( a2 != *this )1 ~5 r7 r6 B. M5 w" b
- {
" p: v: t( N4 \5 k: i/ _ - if ( *a2 )" {" _$ H( k- }& j, @
- {
- |5 d* Q" O+ x {7 d - sub_401030(strlen(a2));
8 v2 R1 s( O: k P' l - strcpy(*v2, a2);3 ?7 F/ ~) Q" r
- }
* p& b m9 h/ T- w3 t - else
' f8 z2 G4 D% q4 E6 C' [ - {
- n. z" t6 @* \ - this[1] = (char *)1;, R# K! B8 a' t- `4 j
- if ( v3 )
! v5 h# V) C- y( [- ^( z) N - operator delete[](v3); P* |; k) g e; A9 j+ Q+ P
- v4 = (char *)operator new(6u); V( T: |9 K' M; R
- *v2 = v4;+ N3 v0 L$ F) i. {8 d/ f
- *(_DWORD *)v4 = 0;; _ b. O" U9 ^+ r( |! `
- }
9 G; Y8 v0 |) t& Q& y* E0 `# T" c - }, _8 P' ^$ K, z% [ f1 k
- }
6 r, Z" N$ y2 S: r) H - }
复制代码 . g2 V. c0 ?: `6 D" p% V
汇编代码
7 V+ g/ x4 S2 |5 H- .text:004010F0
2 S4 B: t$ q0 P+ T+ h+ Y - .text:004010F0 ; =============== S U B R O U T I N E =======================================
0 j+ S1 ~1 O" n - .text:004010F0
4 r7 i( E$ T2 D9 r: J5 K: t6 K - .text:004010F0& e( B: C( L9 s; D
- .text:004010F0 sub_4010F0 proc near ; CODE XREF: _main+139↓p
! T1 a: }9 n- Q( X - .text:004010F0 ; sub_403240+97E↓p ...; F4 H& p/ @5 _3 c2 N
- .text:004010F0+ i# G) {, K; q3 g8 g/ ~9 U1 ~( I
- .text:004010F0 arg_0 = dword ptr 4
' U& L, j# F" Y* N% O* r - .text:004010F0
! B) I$ S0 L/ S( w3 I - .text:004010F0 mov eax, [ecx]1 ]* R8 v. U' z+ z* D
- .text:004010F2 test eax, eax
) B' ?# i$ d0 k, V: H/ N, w% T0 p - .text:004010F4 mov edx, [esp+arg_0]8 J4 R, N6 s+ y3 o$ Y2 h T) f
- .text:004010F8 jz short loc_401147
8 g5 q% \! t# F0 q. Q - .text:004010FA test edx, edx- ]+ Z' h1 y5 Y* T) p- p8 x8 J$ n3 j
- .text:004010FC jz short loc_401147
+ l- [4 b l+ v8 o2 ]6 ~ - .text:004010FE mov cl, [eax]7 S `1 ~8 F) m8 U* X
- .text:00401100 test cl, cl/ @8 j2 G5 _ z. e4 s
- .text:00401102 jnz short loc_401116& ?" _0 x6 _, B6 l) i5 B' b
- .text:00401104 cmp byte ptr [edx], 0
: e) c( m0 T5 w* _3 w% _% ` - .text:00401107 setz al
. v0 S3 v3 k! d8 b- ^* s j) q. v - .text:0040110A xor edx, edx) {0 s; J* x0 A s
- .text:0040110C test al, al7 J2 `& O( Z1 y7 s
- .text:0040110E setz dl# d5 E. {, h* w7 x5 n6 t; ?# v. v# o
- .text:00401111 mov al, dl
3 |1 M* p9 T+ Q9 N - .text:00401113 retn 4; N( D2 w& @. ^+ {9 p4 O
- .text:00401116 ; ---------------------------------------------------------------------------
# `( ?' v S4 d) T( L - .text:00401116: d* ^+ [* {$ v9 X7 x2 D/ P
- .text:00401116 loc_401116: ; CODE XREF: sub_4010F0+12↑j
, L# J4 ~( N2 w; J - .text:00401116 cmp byte ptr [edx], 0 `2 p* V$ i' L" |7 G8 j
- .text:00401119 jz short loc_401147
( p" r; `! u' R) `! e8 Z, {9 S& U - .text:0040111B jmp short loc_401120
/ n/ m$ _. L. X3 _( P( Q - .text:0040111B ; ---------------------------------------------------------------------------
: Z! ?- Q, u: s, v- h& D - .text:0040111D align 10h
3 a6 g. A% N, u" p% i& H - .text:00401120
4 c& }% m- o0 t" P. b9 M - .text:00401120 loc_401120: ; CODE XREF: sub_4010F0+2B↑j, S" J/ R1 {9 h5 ^5 X# k7 `$ a
- .text:00401120 ; sub_4010F0+3B↓j
8 h% b" t' l$ S R - .text:00401120 cmp cl, [edx]
6 M% x+ P6 o/ x I5 d3 C - .text:00401122 jnz short loc_40112D) \% _1 k5 D. C
- .text:00401124 mov cl, [eax+1]5 O' N3 D( C! l5 A9 Q8 W' o5 n
- .text:00401127 inc eax! }7 ?$ G# K' g9 M2 h7 Q
- .text:00401128 inc edx
0 ]. h% W, s `6 k9 C" g, w$ P - .text:00401129 test cl, cl
) ~! w, k& x' x% i4 ~" f' W - .text:0040112B jnz short loc_401120
# L8 r: v4 S! Q+ L - .text:0040112D0 `9 d: `! N' O) f4 a; M9 B5 |- x9 b
- .text:0040112D loc_40112D: ; CODE XREF: sub_4010F0+32↑j
- M0 Y( U$ P) O- r9 D9 D+ }2 M, e - .text:0040112D movzx eax, byte ptr [eax]4 m1 T- f! n/ @1 v6 J/ A7 d( Y
- .text:00401130 movzx ecx, byte ptr [edx]
+ K" [6 @2 x& E2 D9 A - .text:00401133 sub eax, ecx
- D1 Y0 o; L; m- _! E- { - .text:00401135 neg eax2 _& t9 ~+ T( Z* f9 U
- .text:00401137 sbb al, al2 m- @. a4 k+ S# O( G2 {* O
- .text:00401139 inc al
: m$ ~1 q& G3 G V" S - .text:0040113B xor edx, edx
( F) ^( z" w7 H - .text:0040113D test al, al# h( ]4 Q9 ` l2 G1 Y$ Z' [7 j% I
- .text:0040113F setz dl
7 J% N+ ?6 q6 ^ V$ ]$ d - .text:00401142 mov al, dl6 N0 {% `. v* P' _# q1 L1 ~
- .text:00401144 retn 4
% k, N. N" z- y, c J! u ] - .text:00401147 ; ---------------------------------------------------------------------------
1 n6 v! G- G M" ] - .text:00401147
5 M+ P9 q9 c k. H - .text:00401147 loc_401147: ; CODE XREF: sub_4010F0+8↑j6 K. K& d) Z' r3 v( \
- .text:00401147 ; sub_4010F0+C↑j ...! M6 Z9 G1 G* t* w& c! ~
- .text:00401147 xor al, al
6 {# a8 e+ M2 Z# W+ ^, \) j6 W - .text:00401149 xor edx, edx
9 Q% \7 z4 |, S; O- z - .text:0040114B test al, al' n# [# T* o7 w9 h( p
- .text:0040114D setz dl
: }& M) |& p8 A) d - .text:00401150 mov al, dl
" f+ J4 [& c+ y |% Q - .text:00401152 retn 4& d% o# S x" w1 {9 W
- .text:00401152 sub_4010F0 endp
7 {, o( Y p4 O; c: u- d, h - .text:00401152. P) D. z0 O0 H& ^# O) F# ~
- .text:00401152 ; ---------------------------------------------------------------------------7 H% b/ K) c9 J; Z) c
- .text:00401155 align 10h
" N, J' y0 |& S - .text:00401160
+ c; N* N8 f% d5 Q4 T - .text:00401160 ; =============== S U B R O U T I N E =======================================4 P+ d6 w# p5 R' C
- .text:00401160% n! l+ A3 h' z" u8 \6 J* ^* B8 \
- .text:00401160
# Y4 O* K$ T. S" Y! L& `1 [ - .text:00401160 sub_401160 proc near ; CODE XREF: sub_4013D0+15↓p% l2 n: k4 g4 V* l) d
- .text:00401160 ; sub_4013F0+C↓p ...1 ] h* Y* ~2 _
- .text:00401160
. L) |7 f0 d1 I. v - .text:00401160 arg_0 = dword ptr 44 U; d$ i0 Y6 { K* e8 U' S
- .text:00401160
3 p4 D Y+ Y! E* g' f+ r U) |) U - .text:00401160 push esi
% j$ v* m5 j& p1 k7 \8 s( `6 D! a+ ] - .text:00401161 push edi% w$ B' ^) F H; T2 b& P: |
- .text:00401162 mov edi, [esp+8+arg_0]
* r( \: B5 s/ v: ]. H1 V8 M, v - .text:00401166 test edi, edi
$ M5 ^5 Y; u; r8 A9 x - .text:00401168 mov esi, ecx
. M+ @: a$ d; P5 p - .text:0040116A jz short loc_4011CA+ T) Q2 Y7 W: v* K$ V" [2 ]
- .text:0040116C mov eax, [esi]' ]2 G- G6 I3 w3 G d
- .text:0040116E cmp edi, eax. X: s+ W0 K& S+ {2 I( g
- .text:00401170 jz short loc_4011CA* \$ R1 h' i9 W6 r$ j4 W- ~
- .text:00401172 cmp byte ptr [edi], 03 a8 a* S% L: l0 b
- .text:00401175 jnz short loc_4011A2! H- m0 m( |# W s/ |7 s
- .text:00401177 test eax, eax
; G' T$ D5 Y" {, j4 ^# [; Y. a: x - .text:00401179 mov dword ptr [esi+4], 1* a, x4 s% |* r" d4 p+ }+ @& U
- .text:00401180 jz short loc_40118B
/ ]* L5 E p* {, V - .text:00401182 push eax ; void *
% p6 e. E$ V- j: H - .text:00401183 call ??_V@YAXPAX@Z ; operator delete[](void *)
0 r5 y* S; m H5 k, c( ~* x6 H - .text:00401188 add esp, 4+ D. ~ M8 i7 W5 n
- .text:0040118B9 g( c( {: u+ ^2 P! \
- .text:0040118B loc_40118B: ; CODE XREF: sub_401160+20↑j# s3 p' K# _! a1 S2 U5 W
- .text:0040118B push 6 ; Size
# b" H6 k, u9 t7 h: ^9 A# l - .text:0040118D call j_??2@YAPAXI@Z ; operator new(uint)
+ t' f3 M" {2 Q8 [9 | - .text:00401192 add esp, 4
% o4 t8 _6 N* J/ M - .text:00401195 mov [esi], eax
6 U/ r3 [, o! p6 a" [+ i - .text:00401197 pop edi: e; y7 v2 z4 I Y9 j
- .text:00401198 mov dword ptr [eax], 0( O* G' H( Y7 {3 e; s! z
- .text:0040119E pop esi
% Z3 Y8 p. r0 I - .text:0040119F retn 48 Z8 Q1 N1 V/ X8 J" K6 m r% O
- .text:004011A2 ; ---------------------------------------------------------------------------
0 e; J$ j( i8 M5 \ - .text:004011A2
4 b$ s% D o5 q o T - .text:004011A2 loc_4011A2: ; CODE XREF: sub_401160+15↑j6 Q' p s/ D$ {+ i6 l6 M" _3 w: ?
- .text:004011A2 mov eax, edi
5 ?4 ~4 i& y( S; ?8 {6 p/ S - .text:004011A4 lea edx, [eax+1]9 ]" C4 ^0 q1 U5 N% t
- .text:004011A78 ?9 x Q$ y/ Q6 |3 `# @
- .text:004011A7 loc_4011A7: ; CODE XREF: sub_401160+4C↓j1 y7 P/ @- u: |1 O7 \% S
- .text:004011A7 mov cl, [eax]; O8 M$ c5 g& u, M
- .text:004011A9 inc eax
; E% O" w+ q1 ?! c: H- x - .text:004011AA test cl, cl7 n6 U5 @* x" J5 U0 ^. k# G" D. o
- .text:004011AC jnz short loc_4011A7
& {6 ]4 f; E T Q+ B - .text:004011AE sub eax, edx( Z4 U) c: u2 j0 m0 n3 ~5 r; _" \
- .text:004011B0 push eax5 t! H4 e( O* j# r
- .text:004011B1 mov ecx, esi
! v$ }$ w$ L# S( C6 z4 w+ x% ?+ M - .text:004011B3 call sub_401030$ d/ x% Z. d" Q3 n; F
- .text:004011B8 mov edx, [esi]
! i/ @6 Q5 S4 k - .text:004011BA mov ecx, edi
. j$ {+ ]& M+ A$ e2 p - .text:004011BC lea esp, [esp+0]8 ?' U( G% k; R6 r
- .text:004011C0
) f2 u: R8 v5 t4 r* W- E8 g - .text:004011C0 loc_4011C0: ; CODE XREF: sub_401160+68↓j# p; `# L4 S* y' A& Z, @! j! a5 ?3 n# q4 j
- .text:004011C0 mov al, [ecx]
; [8 L) v+ r- k9 N! r# D( B - .text:004011C2 inc ecx v- J. u0 h2 z/ }; H2 b
- .text:004011C3 mov [edx], al. j: b0 j; w% z- k: z
- .text:004011C5 inc edx: C+ e; h5 f0 [2 g& ?2 P: n
- .text:004011C6 test al, al
) T! k# o$ K: U6 q, V U, v - .text:004011C8 jnz short loc_4011C0
7 x9 T: C% v: m - .text:004011CA! P. q( Q4 U9 T* w c, z, D
- .text:004011CA loc_4011CA: ; CODE XREF: sub_401160+A↑j& V6 Q/ A# a: g2 l! d
- .text:004011CA ; sub_401160+10↑j2 m y1 u+ |4 J- s- D, t: W* q
- .text:004011CA pop edi- ^0 D7 [9 [8 C& a+ U6 Y7 J
- .text:004011CB pop esi
& z* p3 k! q# j: l) M8 t - .text:004011CC retn 4
7 F- F$ k0 S3 x' B/ c" e - .text:004011CC sub_401160 endp
y" J' S" k- s5 `" l - .text:004011CC. B5 w3 z5 t& t# d$ Z8 b r
- .text:004011CC ; ---------------------------------------------------------------------------
复制代码 2 e4 Q0 v- G! J6 \8 a
7 s! S* ?, S) D- g. b; G' |& |7 R) l
+ @$ i! f+ n) ` |