本帖最后由 shane007 于 2023-8-25 17:31 编辑
+ Q+ E/ ]9 K: V$ {% t/ z# ^2 G1 i; v3 Z" N9 d) V5 W
本游戏的引擎似乎有支持2套图形API,DirectDraw和Opengl,
, y6 ]/ n* {- J1 r. f% a7 X游戏应该实际只用了其中1个,暂时作下记录。
+ O- a3 k! J1 `6 [. n% B5 Z" N; h4 k; y3 C9 a' ]
DirectDraw是由bin目录下的ddraw2d.dll来完成的。
$ o3 B# W! z9 j以下是一处的初始化代码
, U* o# V8 e+ X! C* a- CSpace:10015015
' B* p, n. O+ h) c, v - CSpace:10015015 loc_10015015: ; CODE XREF: sub_10014D50+2AD↑j
/ T! b# |) e1 w5 h* Z - CSpace:10015015 mov [ebp+lpGUID], 0( T& V) V( H7 D: b7 e
- CSpace:1001501C mov eax, [ebp+dwNewLong]
; k9 d) c2 y) z7 N% \5 U# H - CSpace:1001501F mov ecx, [eax+230h]
( A3 L" i* L; F3 `$ L - CSpace:10015025 movzx edx, byte ptr [ecx+1Ah]- `. M% W0 h& @9 m
- CSpace:10015029 test edx, edx8 a# s0 d+ [$ N1 M2 h5 w- T4 m
- CSpace:1001502B jnz short loc_1001503C
% @3 E/ V D8 I1 b# K% N/ ]; C" p1 b - CSpace:1001502D mov eax, [ebp+dwNewLong]
# K9 `7 z$ v4 n5 V1 q: w7 j - CSpace:10015030 mov ecx, [eax+230h]* w$ O: c0 ~! f' {- q4 f ~
- CSpace:10015036 add ecx, 8 n. w9 y/ E7 r; o1 a
- CSpace:10015039 mov [ebp+lpGUID], ecx
2 t& `: }. E+ J0 U$ t3 \" `: Q - CSpace:1001503C9 `0 |6 K4 e8 ~- Z8 }
- CSpace:1001503C loc_1001503C: ; CODE XREF: sub_10014D50+2DB↑j4 u( l0 ]9 i( y! t6 b2 ~3 x
- CSpace:1001503C mov eax, [ebp+dwNewLong]; \' q2 U9 f7 S, Z* m
- CSpace:1001503F mov ecx, [eax+230h]
8 t. R# D$ n- p. E( x6 n - CSpace:10015045 mov edx, [ecx+1Ch]* M' g4 ~) N# U
- CSpace:10015048 push edx
9 e5 w" c! h) M( O2 R2 E0 g - CSpace:10015049 mov eax, [ebp+dwNewLong]& Z' z6 T' }7 w6 I4 s
- CSpace:1001504C mov ecx, [eax+230h]4 [# A9 `, m; m) }
- CSpace:10015052 mov edx, [ecx+20h]) M" Q0 U ^& L- i
- CSpace:10015055 push edx
' ~: \+ a/ R: I - CSpace:10015056 push offset aUsingDirectdra ; "Using DirectDraw %s (%s)"
, K1 P5 Z" U) B# }3 ]$ `7 Z - CSpace:1001505B push 3# E: M+ x9 G3 [6 F
- CSpace:1001505D mov eax, [ebp+dwNewLong]
! s3 r; `0 p! J; \: e% O - CSpace:10015060 push eax+ o1 z* Q* `8 g& L
- CSpace:10015061 call sub_1003882A& I& a) |& Y% Q+ s
- CSpace:10015066 add esp, 14h) v0 D+ ]1 I1 h- o' j- S
- CSpace:10015069 push 0 ; pUnkOuter b: `9 }7 {/ w4 a! |9 }' D
- CSpace:1001506B mov eax, [ebp+dwNewLong]* J' B6 X( t9 L4 A( @& t
- CSpace:1001506E add eax, 1DCh
' G: E6 W. z. S/ O - CSpace:10015073 push eax ; lplpDD# \+ T- P3 s. Y/ p3 s. T6 r7 \, @
- CSpace:10015074 mov ecx, [ebp+lpGUID]! [- R' O% | S
- CSpace:10015077 push ecx ; lpGUID
5 H' z5 \( @3 `, u0 @& V# S - CSpace:10015078 call j_DirectDrawCreate
& L \/ z2 C, k7 |/ m; n - CSpace:1001507D mov [ebp+var_14], eax
. r* x" t2 u8 w) k3 M, }8 m - CSpace:10015080 cmp [ebp+var_14], 0, ~+ G' q4 k* a' B' f0 G
- CSpace:10015084 jz short loc_1001509E
3 F# y% X' E2 T6 ]" s. c9 I0 \' a - CSpace:10015086 push offset aDirectdrawcrea ; "DirectDrawCreate FAILED (Code: %08lx)\n"# R2 D [( p, t2 ~; r! o( }% y) S1 K- E
- CSpace:1001508B mov eax, [ebp+var_14]
5 ` m( v( H* w8 A3 }3 F5 R - CSpace:1001508E push eax
* r; C" l6 H: d& Z7 b- l% b9 \ - CSpace:1001508F mov ecx, [ebp+dwNewLong]. p* L' i8 F# Y' e. r2 H& C! f
- CSpace:10015092 call sub_10038F3C9 j7 k; P) L! G/ E
- CSpace:10015097 xor al, al
& B2 b8 B1 O5 c; D$ P }1 g E" A* _ - CSpace:10015099 jmp loc_10015173
复制代码
9 [' o; M. f5 c- F2 ?7 P/ {9 I7 Q. l- {3 i7 s
. g. D4 Z# r" ?& j7 V
我用3D Analyzer对opengl API的调用进行跟踪之后,输出了不少log., t/ a0 i' l( `4 Z9 ~* t9 B
记录到log_GL.out文件中。以下是摘录的一段。
8 \2 T8 i( L2 g2 M我认为这个游戏大概率使用的是opengl API,程序修改的切入点,还需要进一步分析。
2 k/ l* J. `6 N+ x9 P以前Skywalker 说 这个游戏不能用Hypersnap抓图,这也算是个使用opengl API的侧面证明吧?% Z ~6 r+ A) K7 E+ n
- glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>* f3 q& h5 x# ^) d( m
- glTexEnvi, GLenum<8960>, GLenum<34176>, GLint<5890># S* T3 {0 `, V6 x) ^/ ]
- glTexEnvi, GLenum<8960>, GLenum<34192>, GLint<768>+ T8 j4 r8 {, ~% _
- glTexEnvi, GLenum<8960>, GLenum<34177>, GLint<34167>
! J- {+ {( ]* ]- I2 Z9 K, [ - glTexEnvi, GLenum<8960>, GLenum<34193>, GLint<768>
g; d& [& ?* I$ A - glTexEnvi, GLenum<8960>, GLenum<34161>, GLint<8448>2 R+ W+ H+ e0 @3 z2 I" k
- glTexEnvf, GLenum<8960>, GLenum<34163>, GLfloat<1065353216>& Z5 ]$ C. n. g& ~- D M8 y
- glTexEnvi, GLenum<8960>, GLenum<34184>, GLint<5890>' ?" `4 b6 ?+ c, j
- glTexEnvi, GLenum<8960>, GLenum<34200>, GLint<770># L9 x7 J5 l3 D! n2 D' a& [
- glTexEnvi, GLenum<8960>, GLenum<34185>, GLint<34167>! ^- X6 f$ H( k0 m+ n3 F
- glTexEnvi, GLenum<8960>, GLenum<34201>, GLint<770>, Y! I3 C0 \2 X9 [
- glTexEnvi, GLenum<8960>, GLenum<34162>, GLint<8448>: a; t% I: C- O1 A
- glTexEnvf, GLenum<8960>, GLenum<3356>, GLfloat<1065353216>) Z9 ^& j( z/ ?- x1 ^
- glClear, GLbitfield<256>, y4 M: Q) n d7 X& E3 m. E* h
- glShadeModel, GLenum<7424>
8 @* }/ [3 x9 ~4 I4 H - glDisable, GLenum<2929>" C' d5 R- W+ W# M1 B
- glDisable, GLenum<3008>
& B' I, ~3 A M& z3 _! c. f - glDisable, GLenum<2896>( c; i: _& l! V% Z; [
- glEnable, GLenum<3042>: U+ \" i' G, ?# v( V; k
- glDisable, GLenum<3553>
7 K1 T) @5 E W* B0 F - glBindTexture, GLenum<3553>, GLuint<631>+ k& v3 h7 ?( y+ J) h* o
- glTexParameteri, GLenum<3553>, GLenum<10240>, GLint<9729>8 w, E: z: C( Q; o( w
- glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>
" ?* \- q- [% u" s# I: I - glClear, GLbitfield<16384>& K- f! P. V& u- O( k0 [ Q
- glTexSubImage2D, GLenum<3553>, GLint<0>, GLint<0>, GLint<0>, GLsizei<512>, GLsizei<384>, GLenum<6408>, GLenum<5121>, CGLvoidP<266776608>
6 T" d+ K/ h9 A J$ j4 C6 L - glEnable, GLenum<3553>2 E4 y1 C: @% t+ g
- glBegin, GLenum<7>
& C1 G8 q5 ^8 K. W0 ?( j - glColor4f, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>2 o, |( k4 `0 l9 e3 t
- glTexCoord2f, GLfloat<0>, GLfloat<0>3 l5 u& e: V/ I) L1 v
- glVertex2i, GLint<0>, GLint<768>) v6 |2 ` @1 Z* {/ f- R' ^' u( c
- glTexCoord2f, GLfloat<1065353216>, GLfloat<0>
4 G- ^- A" u* W! {9 H) ^1 ? - glVertex2i, GLint<1024>, GLint<768>5 E3 K2 ?/ p, _! I0 F) r& D
- glTexCoord2f, GLfloat<1065353216>, GLfloat<1065353216>2 d; C0 _- L) h: S
- glVertex2i, GLint<1024>, GLint<-256>
7 w/ T3 g9 ^8 w( n - glTexCoord2f, GLfloat<0>, GLfloat<1065353216>6 J5 a% t& z8 p, P5 K
- glVertex2i, GLint<0>, GLint<-256>
; C% t. g" h; B' ^, S - glEnd
8 h4 G9 z4 X# `6 q& j - glShadeModel, GLenum<7424>
* W) J% ?* G( \9 P - glGetError
. S! L6 o3 v, H$ s- l) A' w, U - glDisable, GLenum<2929>4 U: a( ~& d X' G w+ n* R! T
- glGetError
9 f$ s0 Q$ D- d/ }! k - glBlendFunc, GLenum<770>, GLenum<771>) N5 N( H) L! p: W, B, S' H" |
- glGetError
2 o Y$ m6 P r3 g - glEnable, GLenum<3042>
8 h, j- a9 p! b% S - glGetError; _, [' r2 [$ q( g, a
- glDisable, GLenum<3553>2 f% @% S% I8 n( N0 ?4 k
- glGetError
) i" g3 M' }' e/ v) B* d% j - glBegin, GLenum<7>
0 f) X% x" b2 s/ U/ H9 \ - glColor4f, GLfloat<0>, GLfloat<0>, GLfloat<0>, GLfloat<1059883844># k6 p! V$ O! `3 d* R
- glTexCoord2f, GLfloat<0>, GLfloat<0>
+ i; Z* m: L5 q! \/ y3 w/ u7 ^ - glVertex2i, GLint<0>, GLint<768>) |+ N9 [1 C( }
- glTexCoord2f, GLfloat<1065353216>, GLfloat<0>
6 _% ]2 K w, e. ~. E. \ - glVertex2i, GLint<1024>, GLint<768>
, Q$ g9 E/ b/ A/ g8 t - glTexCoord2f, GLfloat<1065353216>, GLfloat<1065353216>
% }- H9 ?) F o: A; g - glVertex2i, GLint<1024>, GLint<0>' |7 w, ~! `: c# } L
- glTexCoord2f, GLfloat<0>, GLfloat<1065353216>
" }" Q1 H% L! b: `& X - glVertex2i, GLint<0>, GLint<0>
. k) }: q9 E2 W/ F& t) K+ K# r+ |" [ - glEnd
! ?: p7 A' t$ u! t4 w# A" V - glGetError
/ q3 L" u. ]5 b7 a0 Z1 o$ F - glEnable, GLenum<3553>
, ^& t h* ]/ ^4 p9 U - glGetError
. Q3 o) K* q6 Q0 F% |3 L- n- G* ^ - glFlush& y6 o( D# R3 @& o
- wglSwapBuffers
6 v* x) x3 o4 T( B6 c7 t - ---------------------------2 C2 G* l0 C; w3 F4 w3 S- _
- , HDC<-33484711>: z5 p' A' P9 ~: @+ u+ F2 I. r
- wglGetPixelFormat, HDC<-33484711>$ n% r+ x# X3 d c) J. [& t& h: k, l
- glMatrixMode, GLenum<5889>/ A( l* j- \* y6 s6 P( d( p
- glLoadIdentity
) ]3 e; g. k) N; t - glOrtho, GLdouble<00>, GLdouble<01083179008>, GLdouble<00>, GLdouble<01082654720>, GLdouble<0-1074790400>, GLdouble<01076101120># ~) U) Z- I$ S {1 l" c4 S
- glViewport, GLint<0>, GLint<0>, GLsizei<1024>, GLsizei<768>
5 s6 s3 G# h7 r- H+ N - glMatrixMode, GLenum<5888>! n z, g1 N' H Z& W+ l- C
- glLoadIdentity
3 y1 ]+ x1 b% Z3 H3 d0 [( q - glColor3f, GLfloat<1065353216>, GLfloat<0>, GLfloat<0>& X! F# E% [/ X+ |( a! W
- glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>( m( [0 H4 `$ R3 q+ I
- glTexEnvi, GLenum<8960>, GLenum<34176>, GLint<5890>
8 R: W8 ?2 x) Y7 P% L( y* m9 K6 U - glTexEnvi, GLenum<8960>, GLenum<34192>, GLint<768>
4 y; V/ ?2 v+ c1 }" B) Y0 B' A - glTexEnvi, GLenum<8960>, GLenum<34177>, GLint<34167>
* K- f- y& g$ M - glTexEnvi, GLenum<8960>, GLenum<34193>, GLint<768>' K+ T) G8 M* W2 z; u6 V
- glTexEnvi, GLenum<8960>, GLenum<34161>, GLint<8448># v. s0 V5 a* K
- glTexEnvf, GLenum<8960>, GLenum<34163>, GLfloat<1065353216>. X" y0 h8 k' q( A4 {4 g
- glTexEnvi, GLenum<8960>, GLenum<34184>, GLint<5890>0 I }; |% U3 R1 W3 G
- glTexEnvi, GLenum<8960>, GLenum<34200>, GLint<770>3 b" s9 O, `9 ~9 i) \
- glTexEnvi, GLenum<8960>, GLenum<34185>, GLint<34167>7 n5 l8 S- {( I1 O8 R
- glTexEnvi, GLenum<8960>, GLenum<34201>, GLint<770>
1 `# G) O; j# I( W - glTexEnvi, GLenum<8960>, GLenum<34162>, GLint<8448>$ W9 V" r E! T- e
- glTexEnvf, GLenum<8960>, GLenum<3356>, GLfloat<1065353216>
( t4 y" V" u, ?' | - glClear, GLbitfield<256>+ ]* K# P* p+ G1 k9 Z. r1 S
- glShadeModel, GLenum<7424>
d$ x" V0 Q2 ^* v6 P: }3 \% s B - glDisable, GLenum<2929>: t* A4 L$ W, r6 i* X
- glDisable, GLenum<3008>$ ^6 L6 L$ d+ P
- glDisable, GLenum<2896>. ~/ H! V, Y. W/ }- ~' x
- glEnable, GLenum<3042>
5 R$ S8 A% F% f' d5 i6 w - glDisable, GLenum<3553>- h o$ o2 m8 H6 n3 A, T g
- glBindTexture, GLenum<3553>, GLuint<631>
- R/ H/ H7 O$ K8 m* I+ I; u+ p9 C) D - glTexParameteri, GLenum<3553>, GLenum<10240>, GLint<9729>
1 Q4 `6 Y' d1 m- t! C1 y - glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>+ @; p8 ~ g. ]
- glClear, GLbitfield<16384>1 s/ g/ q3 n4 c- L1 d. q9 t6 r
- glTexSubImage2D, GLenum<3553>, GLint<0>, GLint<0>, GLint<0>, GLsizei<512>, GLsizei<384>, GLenum<6408>, GLenum<5121>, CGLvoidP<266776608>
# T2 w7 {7 H' F. d( t- ] - glEnable, GLenum<3553>
5 F$ o; {7 [* O) n! j - glBegin, GLenum<7>
- k5 A$ @( F7 o: z! w3 T - glColor4f, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>2 W* h3 v# b+ S& ]4 {0 _+ W
- glTexCoord2f, GLfloat<0>, GLfloat<0>" n2 V, L3 x6 w h% N/ ^/ U% W/ q
- glVertex2i, GLint<0>, GLint<768>* g$ [1 w R, U" m$ j
- glTexCoord2f, GLfloat<1065353216>, GLfloat<0>* D2 N D+ ^9 u: C! e4 u) [' [
- glVertex2i, GLint<1024>, GLint<768>, J7 S' o% [$ {& F1 h. n
- glTexCoord2f, GLfloat<1065353216>, GLfloat<1065353216>
8 {& Y& m6 G1 j# K - glVertex2i, GLint<1024>, GLint<-256>
& a% I9 q) B5 ]. ?* v0 K6 r4 S - glTexCoord2f, GLfloat<0>, GLfloat<1065353216>5 V+ E- ~- R. V. n1 N5 N6 y
- glVertex2i, GLint<0>, GLint<-256>
. F9 Y/ i) z9 M& y
复制代码
E' y4 y! H; h2 m% J+ f& ^0 h( P$ v% T" D- w% m7 W
|