本帖最后由 shane007 于 2023-8-27 13:23 编辑
7 w9 N9 y6 q! Q1 w0 p6 |
k+ y1 X" z" M& x' d本游戏采用了CEGUI,该组件能采用directx和opengl。! p; v0 V3 {4 D) _, q4 q
经过我的小方块测试,游戏屏幕显示了小方块,因此确认是directx9的游戏。
/ h2 j) g1 K6 b6 t1 t h游戏自带一个EngineSetup.exe程序,设置为窗口模式后就能用cheatengine调式。
/ a1 ~' P2 b1 v# r(由于游戏窗口较大,我将游戏屏幕和cheatengine分别显示到2个显示器上即可。). \1 s1 d! t: O4 [, w; Q' w' I s( J
' k8 r6 o4 }* O# O
6 Q' C \7 @9 y$ j$ D9 [& |在游戏中找一个字幕,在以下地方断下。
) y9 |) u8 A* Z' o* ?由于该游戏基本都是显示在屏幕固定位置(上或者下,居中),' x/ D% E* B' _8 p3 y4 o7 @
因此暂时认为此处就是游戏的字幕函数,该函数被20处左右地方调用。% V4 \$ i& S1 X
1 k' v* W2 G$ P* V( N, B
- NextLife.exe+11C5 - 42 - inc edx( h2 v; j, S! ?2 U" B E
- 004011C5
复制代码 2 \1 S4 d) o+ o2 t# E( o" q
( J' i- d0 I2 V8 {
该地方的伪代码
6 b: ?1 `7 C- J- w" X0 L! Y- void __thiscall sub_401160(char **this, const char *a2)
# ^* L# H* d5 Q0 a! I8 q, g - {
! k+ {7 }1 y1 b6 z3 I- d - char **v2; // esi
) {$ x/ u' h" o' O+ }: K - char *v3; // eax( L- i, b j7 p r# S3 e
- char *v4; // eax
w7 e5 _8 [* |- N
1 Q/ O# | R0 O5 |; @, K. t- v2 = this;/ `, F, l$ T4 G1 h( E
- if ( a2 )0 z$ b. `7 z- |+ w: F
- {* z+ t; t# S/ w) y* a1 J! i0 ~' l0 i
- v3 = *this;: n8 ^/ ` [! y. Z2 B
- if ( a2 != *this )
7 H# b+ Y6 Q1 g; M" B( v - {
% p9 p3 _% p* h0 C9 p: B u - if ( *a2 )
) U( T( U) R; P - {
& q' ?2 W, A: y1 s4 x - sub_401030(strlen(a2));! o+ s) W9 K* `7 w8 `# t- Q
- strcpy(*v2, a2);
" z1 k# p! Y5 Z, ?$ x: [ - }$ y$ B5 w0 }! q l+ Y
- else5 n7 f! P6 g& f) H! W( B
- {% z# l/ B S6 h- i5 c5 l
- this[1] = (char *)1;
3 t" l( g, _; c, s$ V V2 T/ [$ W - if ( v3 )" E5 p9 J$ U3 n
- operator delete[](v3);/ M0 t# N3 [4 N- A/ u! L' }* A
- v4 = (char *)operator new(6u);. N- p6 P2 p9 \
- *v2 = v4;( p* J2 C9 ]. }7 d5 g
- *(_DWORD *)v4 = 0;! B0 A/ i2 `( p
- }# \6 V: b6 J( m! Z; c% ~
- }7 s5 A8 Z, i* d+ n" |
- }
1 F$ @ a7 A( G - }
复制代码 ; M; b/ k! h: J; s7 a$ q/ B
汇编代码
7 e* @+ g8 S5 p; b- .text:004010F0
: k2 y5 f/ O | - .text:004010F0 ; =============== S U B R O U T I N E =======================================
6 d# H" N3 h$ ^6 L - .text:004010F0
2 T! g/ ]* a N7 Z$ Q - .text:004010F0) j+ m6 P& Q+ ?, V. ?' S; X. w+ z
- .text:004010F0 sub_4010F0 proc near ; CODE XREF: _main+139↓p3 S$ `0 E: P- {
- .text:004010F0 ; sub_403240+97E↓p ...8 ]% I- y2 H- s x
- .text:004010F01 l- V) W8 \, w
- .text:004010F0 arg_0 = dword ptr 4
6 d9 N. M e% y! s7 ~! _ - .text:004010F02 b& f" O1 \+ d6 A+ k* c+ [$ ~6 E" J' }
- .text:004010F0 mov eax, [ecx]
) g4 f! q, t1 z0 ]8 d4 V, z - .text:004010F2 test eax, eax" x/ x2 D# f6 G3 K6 c2 _/ T
- .text:004010F4 mov edx, [esp+arg_0]
. y6 q4 E* t) T; ]+ v* k - .text:004010F8 jz short loc_401147
+ m3 k S2 g& {- I - .text:004010FA test edx, edx
' e/ h9 o4 e* n l - .text:004010FC jz short loc_401147
* F- ~$ g* Q, s - .text:004010FE mov cl, [eax], v8 a# q: G6 z4 A7 ?, c: Y# r
- .text:00401100 test cl, cl* |! i/ N3 a+ y' A( l% J
- .text:00401102 jnz short loc_401116
" B9 i& a0 p% d* B, j - .text:00401104 cmp byte ptr [edx], 0
( o+ a1 y5 p( t: V - .text:00401107 setz al
" t$ Q( ]1 z- ~ - .text:0040110A xor edx, edx! u' A+ ^* v! `2 _3 ]
- .text:0040110C test al, al; ^) ?( ?" y$ c; W: z. ~6 L
- .text:0040110E setz dl$ m7 D* \0 ?' z' k
- .text:00401111 mov al, dl" G. O% Z% d K; ]+ e0 [9 x p
- .text:00401113 retn 4
% q- ?8 U9 l3 y" C1 k5 N$ D - .text:00401116 ; ---------------------------------------------------------------------------
( R" [! _; y: ?8 B6 w8 p - .text:00401116
7 C2 O$ N' o4 F/ O" @; v - .text:00401116 loc_401116: ; CODE XREF: sub_4010F0+12↑j; w, C1 s. e4 O; O0 B6 M# H
- .text:00401116 cmp byte ptr [edx], 05 {1 a) z; l- Z( C2 A8 g
- .text:00401119 jz short loc_401147; u8 W1 V3 O) h4 t" P
- .text:0040111B jmp short loc_401120: d$ l- i, }% ?/ q S% \ N
- .text:0040111B ; ---------------------------------------------------------------------------
1 C' O$ t0 h& R5 } - .text:0040111D align 10h$ K4 w Z, C8 J# [; M
- .text:00401120
. y* F/ T* P, g. D! V - .text:00401120 loc_401120: ; CODE XREF: sub_4010F0+2B↑j$ P6 Q B$ Q$ W8 h5 j* D* q# q$ P
- .text:00401120 ; sub_4010F0+3B↓j
$ D$ t0 V1 J4 H! b3 A: _5 c - .text:00401120 cmp cl, [edx]7 x! A- x& q6 k" V ]# v) c
- .text:00401122 jnz short loc_40112D
. x. [* R, c) Z! J% |* k - .text:00401124 mov cl, [eax+1]6 F- T' }/ l' S5 b: v% b
- .text:00401127 inc eax
; e6 m' S q& u# D' `' s, u4 u0 P- [ - .text:00401128 inc edx6 L8 L/ O c, _- k. R. _( r' V) t
- .text:00401129 test cl, cl/ [5 N3 s. v3 w/ W: F
- .text:0040112B jnz short loc_401120! n/ C, `$ D! l- L7 i
- .text:0040112D
- N% `% |4 x$ N# ?& W0 v7 Q& U - .text:0040112D loc_40112D: ; CODE XREF: sub_4010F0+32↑j' ]. v' | j! P S
- .text:0040112D movzx eax, byte ptr [eax]8 c3 Y( F2 V; P+ a) t" S) Y
- .text:00401130 movzx ecx, byte ptr [edx]
+ \7 ?1 ^& n3 u5 h/ ? - .text:00401133 sub eax, ecx
R7 u, x+ T$ f2 ] - .text:00401135 neg eax! f, v2 p+ B* u/ {6 J8 x
- .text:00401137 sbb al, al
5 K& k$ Z; w8 f* Y - .text:00401139 inc al
: H: h2 X- U8 Q9 U - .text:0040113B xor edx, edx
* p! H. ^% p& y6 _" I - .text:0040113D test al, al
6 \ r3 e/ B% |9 o% l3 G - .text:0040113F setz dl
* F( y) }8 H3 L6 Z2 ^ - .text:00401142 mov al, dl
2 q8 p4 ]( |. n6 \" C8 i - .text:00401144 retn 4$ T2 d1 F- f7 \1 U. [* P
- .text:00401147 ; ---------------------------------------------------------------------------6 T# O6 W9 o% B, @. p
- .text:00401147
& O: J( j( t9 H - .text:00401147 loc_401147: ; CODE XREF: sub_4010F0+8↑j
3 x- P, Y( o) V$ p! K7 z9 a - .text:00401147 ; sub_4010F0+C↑j ...+ X1 W! m* `$ S' Y3 }, n
- .text:00401147 xor al, al
0 U" m/ d& F; u0 g' \4 `, x - .text:00401149 xor edx, edx4 K, q: H2 D& N0 B; ~
- .text:0040114B test al, al% [1 s" y2 G* ? \$ {9 `
- .text:0040114D setz dl
" l6 y; r- |8 V: B- f& p - .text:00401150 mov al, dl+ d- o; Z9 v+ L+ y
- .text:00401152 retn 4: Z5 \6 }! H1 m( T+ ^; P
- .text:00401152 sub_4010F0 endp, M* `' w5 N: q! J2 T
- .text:00401152/ _/ x3 D% E3 O% p" D0 a m
- .text:00401152 ; ---------------------------------------------------------------------------1 g, a. @; h! ^3 K, B; o
- .text:00401155 align 10h
- q. z: c( j, h4 _9 X - .text:00401160( a1 \. i6 \- n( K4 l6 i. |
- .text:00401160 ; =============== S U B R O U T I N E =======================================
2 ^: A+ G4 `2 m6 k - .text:00401160
: H4 a* h t2 Q0 F4 I - .text:00401160, w1 t( r* _: C
- .text:00401160 sub_401160 proc near ; CODE XREF: sub_4013D0+15↓p
) B$ J( n! X8 n! E! o - .text:00401160 ; sub_4013F0+C↓p ...7 J0 \* \' E) B$ h& K& I2 D- b
- .text:00401160
3 q8 U) P2 [- I4 P/ @2 y - .text:00401160 arg_0 = dword ptr 4
7 b5 s6 Y8 g* l - .text:00401160; d' ?* b3 |7 A3 z" A+ n6 c
- .text:00401160 push esi
; `! h1 v1 A+ m0 _8 |! T3 W J, q - .text:00401161 push edi
% V* K6 G6 N5 F - .text:00401162 mov edi, [esp+8+arg_0]
3 v; E' {- c! U. N# F- @9 \ - .text:00401166 test edi, edi
* C- C' p( M2 S - .text:00401168 mov esi, ecx
# S! v: S5 P) P) s: T4 E - .text:0040116A jz short loc_4011CA
+ ^, H. I: D E6 t% L - .text:0040116C mov eax, [esi]
5 q* x7 h: S$ s$ G9 `, d6 d, F4 B - .text:0040116E cmp edi, eax9 P9 y$ ] p% o: L$ R( H8 W
- .text:00401170 jz short loc_4011CA: L- i( q% S# E4 N
- .text:00401172 cmp byte ptr [edi], 0 B5 M a) l/ ]7 p( @. ~- m
- .text:00401175 jnz short loc_4011A2
: `1 x' Q$ {3 S$ e7 U0 X - .text:00401177 test eax, eax! g8 t: [6 E8 B: l3 g( l: Q
- .text:00401179 mov dword ptr [esi+4], 1
# j$ ]/ R$ k7 N: @$ O - .text:00401180 jz short loc_40118B5 @! Y) R) ~7 }+ P! N \
- .text:00401182 push eax ; void *! c9 p! W3 V) q! i0 S/ p3 S
- .text:00401183 call ??_V@YAXPAX@Z ; operator delete[](void *)
A4 d$ M) _9 L5 h% q; l - .text:00401188 add esp, 4
% G+ l" ~; f0 d* @( J9 A/ K - .text:0040118B
6 A& N/ {! z& I8 q8 x- s: Y. W - .text:0040118B loc_40118B: ; CODE XREF: sub_401160+20↑j8 g" Q. @& z$ A' y
- .text:0040118B push 6 ; Size) R1 z5 E }( D9 F1 P
- .text:0040118D call j_??2@YAPAXI@Z ; operator new(uint)
1 F2 Y. r4 W6 k4 e: a - .text:00401192 add esp, 4
: P! c/ Y8 |5 Y) T9 t - .text:00401195 mov [esi], eax/ m! n7 R! J, C4 y. A6 ^$ E4 o
- .text:00401197 pop edi
# d# G' s& S7 I9 y6 N* K - .text:00401198 mov dword ptr [eax], 0
( t5 Y# O3 B) F, d$ I9 Y - .text:0040119E pop esi
9 T7 ~' u! y0 T, q - .text:0040119F retn 4* z8 @& I( M! f0 P0 _
- .text:004011A2 ; ---------------------------------------------------------------------------
* F+ ^+ o& j% }9 } - .text:004011A2# e. W6 B9 E# m4 b* r
- .text:004011A2 loc_4011A2: ; CODE XREF: sub_401160+15↑j, X! X' F4 ]; g5 w1 K
- .text:004011A2 mov eax, edi1 @. V% Q. G8 L4 X f7 p( {
- .text:004011A4 lea edx, [eax+1]
. V# V1 p0 u' w7 E' T - .text:004011A7
! N) a& y& _1 g- s" o) O - .text:004011A7 loc_4011A7: ; CODE XREF: sub_401160+4C↓j
$ j# n; ?& v7 N$ O d1 S - .text:004011A7 mov cl, [eax]9 j9 Q s6 z: M' ^+ F# _4 k5 B
- .text:004011A9 inc eax
& s3 U1 \; o1 h" D$ e+ ~ - .text:004011AA test cl, cl
6 d% V0 _# H- Z3 D5 V - .text:004011AC jnz short loc_4011A7
" e' H3 y- X9 A$ j' ?8 @( _ - .text:004011AE sub eax, edx
$ C% T; [5 C& u2 e - .text:004011B0 push eax% @. d1 p( l9 F
- .text:004011B1 mov ecx, esi
+ E! S/ I* J! q: l7 {' V - .text:004011B3 call sub_401030
- q: Q3 @: V7 p7 `* G0 p# x - .text:004011B8 mov edx, [esi]
8 R8 c9 G0 V! B; R4 ` - .text:004011BA mov ecx, edi
6 y: ?7 F8 {/ S% S3 A3 G } - .text:004011BC lea esp, [esp+0]
/ d7 h3 G, g: D* W: e0 ~ - .text:004011C02 P- a2 s$ e6 ~2 q: h0 y
- .text:004011C0 loc_4011C0: ; CODE XREF: sub_401160+68↓j
7 B- d. Y8 ^3 B - .text:004011C0 mov al, [ecx]
# n$ x* k) A6 {9 z - .text:004011C2 inc ecx$ b7 e* M: u( x! j0 d
- .text:004011C3 mov [edx], al
! y& M$ A' ^4 M+ l- ` - .text:004011C5 inc edx k# t4 s" \ |% v/ B2 U! l
- .text:004011C6 test al, al
, q0 D+ _- \" m; n - .text:004011C8 jnz short loc_4011C0+ t) k9 i$ _6 t, O
- .text:004011CA. j F- S/ l8 P9 w
- .text:004011CA loc_4011CA: ; CODE XREF: sub_401160+A↑j
' q& d, _; M9 [ [- H* i - .text:004011CA ; sub_401160+10↑j
. N5 s- p% J) B: x: W - .text:004011CA pop edi
9 J* e& X2 x) m - .text:004011CB pop esi# e8 q' u& ~. o* [( W
- .text:004011CC retn 4
2 G+ u7 W* d5 l) b- d7 Y - .text:004011CC sub_401160 endp& s* |# ]4 E! |) F
- .text:004011CC$ s& |# r6 N" m/ O
- .text:004011CC ; ---------------------------------------------------------------------------
复制代码
) B) D# ^" c a% g
; ]3 R( L6 ?- Z+ A- Y0 F" x! n7 c& Z/ S
|