本帖最后由 shane007 于 2023-8-25 17:31 编辑 9 J5 s9 i/ V1 b( S
; l! H& M9 Q* s/ l! O( c
本游戏的引擎似乎有支持2套图形API,DirectDraw和Opengl,
, e( b0 B" i S, ?/ }游戏应该实际只用了其中1个,暂时作下记录。" m& ^! a9 Z" g6 V! R6 e
5 \2 e) ] l# q6 C1 l6 D7 e+ q
DirectDraw是由bin目录下的ddraw2d.dll来完成的。
* e4 s! }0 W' p$ H以下是一处的初始化代码( I j# n1 d! t5 a
- CSpace:10015015: a4 M! g3 ^% R( }. R/ F) g6 S/ L
- CSpace:10015015 loc_10015015: ; CODE XREF: sub_10014D50+2AD↑j
0 o: ~. L( m9 P7 A - CSpace:10015015 mov [ebp+lpGUID], 0
* h: s( I. u# n: f - CSpace:1001501C mov eax, [ebp+dwNewLong]
3 J8 C( E* X4 z/ l+ Z- A - CSpace:1001501F mov ecx, [eax+230h]
" |2 u& Y9 j/ x8 L* u - CSpace:10015025 movzx edx, byte ptr [ecx+1Ah]
. I( H* ~( s& ~ - CSpace:10015029 test edx, edx6 W0 K/ B. S( n% l" l
- CSpace:1001502B jnz short loc_1001503C% ?+ Z1 r- n6 r1 z
- CSpace:1001502D mov eax, [ebp+dwNewLong]
t5 y% L) s3 E5 d4 W5 [ - CSpace:10015030 mov ecx, [eax+230h]! I$ B8 m' w2 F/ v
- CSpace:10015036 add ecx, 87 @: W5 [" e, ~
- CSpace:10015039 mov [ebp+lpGUID], ecx
% Z6 A* Y6 a; ~. i3 x" K9 h4 I! Y9 w - CSpace:1001503C
7 K# h+ g" z6 g+ `' y0 }8 X - CSpace:1001503C loc_1001503C: ; CODE XREF: sub_10014D50+2DB↑j; s8 i# `* a Z( x4 }2 |# m0 {0 l
- CSpace:1001503C mov eax, [ebp+dwNewLong]; e" G7 K) f% p& U
- CSpace:1001503F mov ecx, [eax+230h]
4 X' e* a* i& Q$ f( q' Z9 B: _ - CSpace:10015045 mov edx, [ecx+1Ch]* N! M, o- Z$ ]6 x p& ?- _3 }
- CSpace:10015048 push edx
4 ^ V f2 F- c, n0 R - CSpace:10015049 mov eax, [ebp+dwNewLong]6 n$ Z! I7 P2 ^& ^& i' K4 }8 C2 C
- CSpace:1001504C mov ecx, [eax+230h]
0 c) @8 L! Q( l. ` - CSpace:10015052 mov edx, [ecx+20h]
' l4 r3 P+ ?; ` - CSpace:10015055 push edx( F- S6 {: p9 V- n
- CSpace:10015056 push offset aUsingDirectdra ; "Using DirectDraw %s (%s)"
8 ~% q: G9 U0 `7 ~+ I - CSpace:1001505B push 37 o( N& s, b9 c9 i" K
- CSpace:1001505D mov eax, [ebp+dwNewLong]0 ?* H- p% D2 b8 U! ?* I
- CSpace:10015060 push eax
/ L" g% {' d z2 [- _ - CSpace:10015061 call sub_1003882A
$ o2 A' s9 v( R( R2 X - CSpace:10015066 add esp, 14h, e& @- N6 U6 d. Q
- CSpace:10015069 push 0 ; pUnkOuter: Y' {1 D8 n) T
- CSpace:1001506B mov eax, [ebp+dwNewLong]
) b1 V B Z4 N3 G - CSpace:1001506E add eax, 1DCh
! O/ W$ N+ I/ A2 { - CSpace:10015073 push eax ; lplpDD
2 K6 k6 ?: x8 e4 T/ t% Q0 O$ J - CSpace:10015074 mov ecx, [ebp+lpGUID]% H; V# a. y/ S; m& r" n
- CSpace:10015077 push ecx ; lpGUID
* n* N5 j; a$ ]& S. o1 T t+ u( C - CSpace:10015078 call j_DirectDrawCreate
% p* r" X& Z5 v2 X4 |* h - CSpace:1001507D mov [ebp+var_14], eax
8 ~0 F3 N6 f* T& k/ Z - CSpace:10015080 cmp [ebp+var_14], 0; K2 G' W7 z. ^: D
- CSpace:10015084 jz short loc_1001509E0 o1 ?$ _4 w. m+ S8 L- Y3 R+ n
- CSpace:10015086 push offset aDirectdrawcrea ; "DirectDrawCreate FAILED (Code: %08lx)\n"
. \2 a) J# i/ u H5 h+ k( z - CSpace:1001508B mov eax, [ebp+var_14]4 M h$ |5 q! I. L2 @3 g3 g5 ?6 x6 O
- CSpace:1001508E push eax
7 Y0 M- i! w! y, |6 }0 o - CSpace:1001508F mov ecx, [ebp+dwNewLong]9 z$ ?. G3 q6 O1 o7 d
- CSpace:10015092 call sub_10038F3C; S; w: `) B: M- c2 V+ j. [
- CSpace:10015097 xor al, al
$ ^' }3 n( e& z* \9 G - CSpace:10015099 jmp loc_10015173
复制代码 7 y, W% q8 `/ Y4 w
4 n$ T9 H5 C5 L3 X
* N3 p d( X' w7 _
我用3D Analyzer对opengl API的调用进行跟踪之后,输出了不少log.; \# C$ U: ~* J) g
记录到log_GL.out文件中。以下是摘录的一段。5 D4 v& L! {; m
我认为这个游戏大概率使用的是opengl API,程序修改的切入点,还需要进一步分析。
* r$ P* o+ ]" _: j* f( I' C) B以前Skywalker 说 这个游戏不能用Hypersnap抓图,这也算是个使用opengl API的侧面证明吧?3 ^3 T+ v+ i$ o0 ^ N
- glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>. @. _$ a9 P* c4 [1 l
- glTexEnvi, GLenum<8960>, GLenum<34176>, GLint<5890>4 w7 N( N% A! D% E0 E$ Q
- glTexEnvi, GLenum<8960>, GLenum<34192>, GLint<768>
& n# ?& F4 o4 A0 u6 z - glTexEnvi, GLenum<8960>, GLenum<34177>, GLint<34167>
4 y2 U ^ H2 e - glTexEnvi, GLenum<8960>, GLenum<34193>, GLint<768># B$ S8 N/ y6 u. a* J
- glTexEnvi, GLenum<8960>, GLenum<34161>, GLint<8448>
* I% v' Y p0 n - glTexEnvf, GLenum<8960>, GLenum<34163>, GLfloat<1065353216>
. N$ P3 `. D; A$ z, x5 ] - glTexEnvi, GLenum<8960>, GLenum<34184>, GLint<5890>' ?/ X& ?- ?# A9 o1 V3 m( ^, t
- glTexEnvi, GLenum<8960>, GLenum<34200>, GLint<770>
2 k! _$ }. T! p3 Z; r - glTexEnvi, GLenum<8960>, GLenum<34185>, GLint<34167>4 w' @- ^+ g0 T' q {
- glTexEnvi, GLenum<8960>, GLenum<34201>, GLint<770>
- g+ r, ]+ R- M8 b - glTexEnvi, GLenum<8960>, GLenum<34162>, GLint<8448>
0 X2 e& T: h0 r& [, I2 I9 F5 y3 A5 }8 X - glTexEnvf, GLenum<8960>, GLenum<3356>, GLfloat<1065353216>
% T9 \8 x3 l& c0 ^3 m - glClear, GLbitfield<256>
( ?' @" E( N/ ^. H; y2 [4 q8 n/ ] - glShadeModel, GLenum<7424>
' R0 b; D. g6 L - glDisable, GLenum<2929>
; d' N9 f- g- `- S, e - glDisable, GLenum<3008>6 S. @* I9 _! _' O4 V$ c9 x
- glDisable, GLenum<2896>
' f% O# K; r7 Q2 j' b" {: U8 \$ j - glEnable, GLenum<3042>
" |1 }3 o$ B7 x. t - glDisable, GLenum<3553>
0 X0 [9 `- g3 d7 v0 a, y - glBindTexture, GLenum<3553>, GLuint<631>
5 ~2 Y5 Q; ]1 q ^4 S - glTexParameteri, GLenum<3553>, GLenum<10240>, GLint<9729>
9 Y: k- j# {3 t# _5 r; h+ a5 \ - glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>
2 {, k) k: w& @9 p6 j& c - glClear, GLbitfield<16384>
% x4 Z5 j( ~+ h5 m N0 [: w& I - glTexSubImage2D, GLenum<3553>, GLint<0>, GLint<0>, GLint<0>, GLsizei<512>, GLsizei<384>, GLenum<6408>, GLenum<5121>, CGLvoidP<266776608>
0 _7 J7 D# X9 Y: N8 w3 J* k2 h - glEnable, GLenum<3553>
+ R' B2 f7 T1 q9 E5 |: | - glBegin, GLenum<7>9 ^% u! m- ` `, ]
- glColor4f, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>
- q% Z- w; V- @; [+ J - glTexCoord2f, GLfloat<0>, GLfloat<0>% W/ j: z2 x% n; t
- glVertex2i, GLint<0>, GLint<768>
/ o& w& z& h! v, N" @) U9 t - glTexCoord2f, GLfloat<1065353216>, GLfloat<0>) W3 G1 u. \* D. b" l% n6 j( s
- glVertex2i, GLint<1024>, GLint<768>6 u& a( }7 c; A3 o9 z4 \. R
- glTexCoord2f, GLfloat<1065353216>, GLfloat<1065353216>
% D+ ~. S- G3 a2 u. q$ z- N7 o - glVertex2i, GLint<1024>, GLint<-256>' w0 x: \1 c' S
- glTexCoord2f, GLfloat<0>, GLfloat<1065353216>; {4 b' d6 Q5 `( s8 m: O
- glVertex2i, GLint<0>, GLint<-256>% ?" I( S# a1 i5 T' u0 z
- glEnd% Z- ~/ ~# A k$ _$ N
- glShadeModel, GLenum<7424>' \+ _/ e0 w3 T' p
- glGetError- |0 ?' O* W! L0 T3 v
- glDisable, GLenum<2929>
- O# ~$ _7 n3 m# l - glGetError
4 g {' ~, Z% ?! Z4 i- e# i) v - glBlendFunc, GLenum<770>, GLenum<771> d$ O: D6 Y# s9 H
- glGetError
8 g/ C; x; |5 o7 M) W - glEnable, GLenum<3042>
) b' a+ s8 g0 \ - glGetError" c4 g* |7 j$ O9 p2 k
- glDisable, GLenum<3553>
; X; v& [4 e S! K B; G+ y2 a. @2 N - glGetError
% f; y, o/ I5 f: A6 x - glBegin, GLenum<7>
) H; }2 }0 o3 @" D3 x$ X$ G a - glColor4f, GLfloat<0>, GLfloat<0>, GLfloat<0>, GLfloat<1059883844>! d" Y* D* r- F/ T' E
- glTexCoord2f, GLfloat<0>, GLfloat<0>
- G8 z* T1 R2 f6 D) p; M - glVertex2i, GLint<0>, GLint<768> L! Z u+ R/ d! g% O8 z
- glTexCoord2f, GLfloat<1065353216>, GLfloat<0>" `, t ]/ i9 R- S+ P M
- glVertex2i, GLint<1024>, GLint<768>
; u! t: j) e I- M, ~5 L - glTexCoord2f, GLfloat<1065353216>, GLfloat<1065353216> m: b- E$ T' F6 V7 X% C' m
- glVertex2i, GLint<1024>, GLint<0>3 ]6 {9 Q- T/ z7 `0 \) o) z
- glTexCoord2f, GLfloat<0>, GLfloat<1065353216>' K5 ?' @( M, j* y6 a* G( Y
- glVertex2i, GLint<0>, GLint<0>1 m7 H- z/ `. d$ \' O, G; c
- glEnd$ D& { [0 h. @
- glGetError% ?& m3 n% C0 C* S" g
- glEnable, GLenum<3553>
- M8 n9 b+ m" l& c - glGetError, k, E" q: f ~9 `
- glFlush
; C! ?2 E' o5 E! u9 K - wglSwapBuffers
5 O5 L1 V( ^$ k4 d* [ - ---------------------------
/ x; ^! Y" h: O$ f0 o% d/ {+ K - , HDC<-33484711>9 d8 a- v$ e/ b0 c
- wglGetPixelFormat, HDC<-33484711>+ T5 N9 j5 E+ q/ P
- glMatrixMode, GLenum<5889>
2 h. G# ?* d5 u2 t: N - glLoadIdentity
3 j5 w6 B7 j! e% D - glOrtho, GLdouble<00>, GLdouble<01083179008>, GLdouble<00>, GLdouble<01082654720>, GLdouble<0-1074790400>, GLdouble<01076101120>
, d8 g) @, {( _$ d' x7 p$ u! E - glViewport, GLint<0>, GLint<0>, GLsizei<1024>, GLsizei<768>3 B# K' j9 \8 U. R
- glMatrixMode, GLenum<5888>( b# D6 N& H: e
- glLoadIdentity
5 e; y0 Z( h- ]4 M \9 s - glColor3f, GLfloat<1065353216>, GLfloat<0>, GLfloat<0>
# B# ~$ C/ t) M* Z5 E - glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>: J, Z5 v1 R+ ~
- glTexEnvi, GLenum<8960>, GLenum<34176>, GLint<5890>
7 V9 W0 a. D0 y# `- @ - glTexEnvi, GLenum<8960>, GLenum<34192>, GLint<768>$ A+ S# B u; G2 @+ z! ~3 C
- glTexEnvi, GLenum<8960>, GLenum<34177>, GLint<34167>
2 k: Q" R- l: I, U; o, _ - glTexEnvi, GLenum<8960>, GLenum<34193>, GLint<768>: O' r+ I- C7 A8 ~( [# Q0 M3 g
- glTexEnvi, GLenum<8960>, GLenum<34161>, GLint<8448>
9 F* E9 Y+ \0 U6 H. d) O - glTexEnvf, GLenum<8960>, GLenum<34163>, GLfloat<1065353216>4 B! s- y5 `- [/ F' X+ S- T
- glTexEnvi, GLenum<8960>, GLenum<34184>, GLint<5890>, V/ h8 h, A0 e
- glTexEnvi, GLenum<8960>, GLenum<34200>, GLint<770> T: v% D6 p" f2 q6 s# }
- glTexEnvi, GLenum<8960>, GLenum<34185>, GLint<34167>4 P, A+ W* m- N
- glTexEnvi, GLenum<8960>, GLenum<34201>, GLint<770>: I3 N2 Y' r' E) F+ V5 U
- glTexEnvi, GLenum<8960>, GLenum<34162>, GLint<8448>
( i$ t; n% `1 p8 s2 i7 L; H - glTexEnvf, GLenum<8960>, GLenum<3356>, GLfloat<1065353216>) e8 k1 ?& r7 W, O, D
- glClear, GLbitfield<256>2 \1 {: o" h, [; w2 M# [" ?
- glShadeModel, GLenum<7424>
6 s2 Z( N: D: k [% ? - glDisable, GLenum<2929>
) J2 W; D U R% X4 R - glDisable, GLenum<3008>" K4 a4 w9 R% z% c0 W1 p6 U/ p
- glDisable, GLenum<2896>
& v- l) c4 J1 m- ~ - glEnable, GLenum<3042>
( \# f# o8 Q# r# t2 J& Y4 I - glDisable, GLenum<3553>) Z; R, x0 |, E; Y2 [5 S
- glBindTexture, GLenum<3553>, GLuint<631>
* f6 Q& X: K; A9 Y - glTexParameteri, GLenum<3553>, GLenum<10240>, GLint<9729>
4 q7 I E: }. }: T2 l - glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>
" l8 g0 g0 p2 N/ S! v - glClear, GLbitfield<16384>
5 m1 b; }" C ^/ j. N7 m F! h, g - glTexSubImage2D, GLenum<3553>, GLint<0>, GLint<0>, GLint<0>, GLsizei<512>, GLsizei<384>, GLenum<6408>, GLenum<5121>, CGLvoidP<266776608>. N3 e, ^' q+ ?0 o
- glEnable, GLenum<3553>
! I0 [/ ]& X, @7 A- R1 W& p - glBegin, GLenum<7>
* F" e% T( W' C2 ]' J& T0 P - glColor4f, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>
2 D% Z. X5 ` i, f4 {, \ - glTexCoord2f, GLfloat<0>, GLfloat<0>4 k' n3 Q1 }+ [7 Q3 M
- glVertex2i, GLint<0>, GLint<768>
( ]! z2 e, N+ g+ H. F - glTexCoord2f, GLfloat<1065353216>, GLfloat<0>
: v% G! }6 ]( i" P - glVertex2i, GLint<1024>, GLint<768>
& _5 I0 c0 \5 c5 R - glTexCoord2f, GLfloat<1065353216>, GLfloat<1065353216> F7 P, h* Q O# K" p
- glVertex2i, GLint<1024>, GLint<-256>
0 w* Q+ `6 ]& W - glTexCoord2f, GLfloat<0>, GLfloat<1065353216>& S: m' g, ~0 x7 d7 ?! ]) m
- glVertex2i, GLint<0>, GLint<-256># {/ S+ w+ ?7 V/ w3 `
复制代码
, y: p4 h* h$ J0 |/ L! Z
. |% N: Q! Q3 F l- m* z% v |