本帖最后由 shane007 于 2023-8-25 17:31 编辑
" T( V4 I0 E) C$ i, x+ G( I6 f" Y, l7 C& P: S+ I! L
本游戏的引擎似乎有支持2套图形API,DirectDraw和Opengl,
5 i2 d5 A" u7 B' X4 ^" L7 e# z游戏应该实际只用了其中1个,暂时作下记录。
9 W+ n! {6 V. i; r- s! F" x: D5 E z C
DirectDraw是由bin目录下的ddraw2d.dll来完成的。
* \" t- a% l1 [, q1 e% }7 f6 ^以下是一处的初始化代码
$ S) v' k0 @) z8 F. K! u$ `5 C- S' V- CSpace:100150151 T# a! `& {! Y' I8 N1 O2 H
- CSpace:10015015 loc_10015015: ; CODE XREF: sub_10014D50+2AD↑j
: P( h6 ^7 f1 [5 y: _7 B - CSpace:10015015 mov [ebp+lpGUID], 0
u4 b3 n7 r- p# G! E l: \ - CSpace:1001501C mov eax, [ebp+dwNewLong]
9 h- L6 p# G1 f0 |5 h, y - CSpace:1001501F mov ecx, [eax+230h]
2 t. g' K2 L( x/ T; F, x' c - CSpace:10015025 movzx edx, byte ptr [ecx+1Ah]
! W' k$ x; {+ a( }' g - CSpace:10015029 test edx, edx
7 [# E$ r; j" l, ~; z - CSpace:1001502B jnz short loc_1001503C
5 o+ a% y! H( S! v- z/ E' h - CSpace:1001502D mov eax, [ebp+dwNewLong]/ w, }5 d) v2 I( t9 D; _ @* Q
- CSpace:10015030 mov ecx, [eax+230h]9 g: Y8 z6 S' H; ?9 U% u
- CSpace:10015036 add ecx, 8
3 ]1 E$ b: _# X2 J) e - CSpace:10015039 mov [ebp+lpGUID], ecx2 D/ i; {" w- K3 ]
- CSpace:1001503C
; \% R- E+ M/ c/ V& e - CSpace:1001503C loc_1001503C: ; CODE XREF: sub_10014D50+2DB↑j+ {2 t d9 h5 N3 k7 k
- CSpace:1001503C mov eax, [ebp+dwNewLong]; z% [* k' B! I3 W
- CSpace:1001503F mov ecx, [eax+230h]: j/ T0 \$ ~9 s% }( Y Z
- CSpace:10015045 mov edx, [ecx+1Ch]
( K s& a7 P$ v+ |2 } - CSpace:10015048 push edx
2 E' b' ~/ K) d! S1 R. t - CSpace:10015049 mov eax, [ebp+dwNewLong]7 S) I) E: \: E
- CSpace:1001504C mov ecx, [eax+230h]- i2 s: [9 f; v+ p8 B1 E$ M# n9 \7 @
- CSpace:10015052 mov edx, [ecx+20h]
1 x1 O: x5 L5 |8 }& K* R+ K - CSpace:10015055 push edx \7 \# j% i7 L% X$ u
- CSpace:10015056 push offset aUsingDirectdra ; "Using DirectDraw %s (%s)"
0 H8 A7 e+ Q* T2 \ - CSpace:1001505B push 35 m2 r, |: L% S- `, M
- CSpace:1001505D mov eax, [ebp+dwNewLong]
2 H" Y2 u% q+ i( e - CSpace:10015060 push eax
' Q( Q; L S! n2 N. ^ - CSpace:10015061 call sub_1003882A
8 J, T1 i" `7 E - CSpace:10015066 add esp, 14h
9 Q0 ]" M" |. j2 s1 C7 h - CSpace:10015069 push 0 ; pUnkOuter2 m+ L" x! s: K; g) i
- CSpace:1001506B mov eax, [ebp+dwNewLong]0 K$ {$ |/ d/ Q7 {; H& }! S. w2 H
- CSpace:1001506E add eax, 1DCh
o8 `/ Z ~/ `8 y! N - CSpace:10015073 push eax ; lplpDD
7 @% e" J' d/ ~3 w' D - CSpace:10015074 mov ecx, [ebp+lpGUID]
& h8 v9 k" _) M, T: F! r5 r - CSpace:10015077 push ecx ; lpGUID
+ s! h0 m8 x8 f; c; v% E$ R+ R - CSpace:10015078 call j_DirectDrawCreate% N- m8 T% z7 M$ q& ?5 y4 ^$ n/ V, }
- CSpace:1001507D mov [ebp+var_14], eax) p7 `% {& C/ S0 y/ J# v
- CSpace:10015080 cmp [ebp+var_14], 0
$ F' @# b( i# I8 l5 j& z+ E: q2 S - CSpace:10015084 jz short loc_1001509E
. b, S2 U/ G) ~* [. ] - CSpace:10015086 push offset aDirectdrawcrea ; "DirectDrawCreate FAILED (Code: %08lx)\n"
/ M9 \3 B1 i. k9 L/ L7 m - CSpace:1001508B mov eax, [ebp+var_14], D) a8 d& |8 o Y
- CSpace:1001508E push eax
8 ^% K& h, q3 t+ r$ w6 Q - CSpace:1001508F mov ecx, [ebp+dwNewLong]
: h& h# |! H! Z3 r# \* Y2 f- m+ ~ - CSpace:10015092 call sub_10038F3C
- n% n/ U0 S# n# X) a, G+ @ - CSpace:10015097 xor al, al
4 L# p' g4 V+ c' U; B) s# ?2 _ - CSpace:10015099 jmp loc_10015173
复制代码
3 Y T) R8 P/ z' L7 l; ^+ N$ ^+ B1 q6 l& ^# E3 _
' E# ]; y4 V. O `
我用3D Analyzer对opengl API的调用进行跟踪之后,输出了不少log.
0 I- b- }0 X$ Y记录到log_GL.out文件中。以下是摘录的一段。 F+ T" H5 w% l9 h1 V4 ~
我认为这个游戏大概率使用的是opengl API,程序修改的切入点,还需要进一步分析。, ^1 {2 \% Y5 G8 u; r' M' P5 k
以前Skywalker 说 这个游戏不能用Hypersnap抓图,这也算是个使用opengl API的侧面证明吧?- ]3 @# x9 t+ T, {# T
- glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>
s* K ]4 p7 d6 m - glTexEnvi, GLenum<8960>, GLenum<34176>, GLint<5890>
1 s9 D0 t! Y8 J7 g( J$ K - glTexEnvi, GLenum<8960>, GLenum<34192>, GLint<768>
) i- m9 c5 @% H2 ^+ g5 _) p" R* q3 N - glTexEnvi, GLenum<8960>, GLenum<34177>, GLint<34167>$ ]) ?2 `* l8 W; [
- glTexEnvi, GLenum<8960>, GLenum<34193>, GLint<768>
' ^' p; j3 F" H( j - glTexEnvi, GLenum<8960>, GLenum<34161>, GLint<8448>) i9 e$ c. i( Y# x
- glTexEnvf, GLenum<8960>, GLenum<34163>, GLfloat<1065353216>
8 {( `7 w' X( h - glTexEnvi, GLenum<8960>, GLenum<34184>, GLint<5890>
9 V0 s% j- w+ v+ w1 F - glTexEnvi, GLenum<8960>, GLenum<34200>, GLint<770>
% s* K/ o7 O' D! ^ - glTexEnvi, GLenum<8960>, GLenum<34185>, GLint<34167>8 K" D+ m$ w. \! ]% u0 H8 b
- glTexEnvi, GLenum<8960>, GLenum<34201>, GLint<770>! f3 y4 f* v5 ~6 Q2 g( V+ R2 e& |
- glTexEnvi, GLenum<8960>, GLenum<34162>, GLint<8448>
: W- c- \. n; v# u8 v1 U8 A - glTexEnvf, GLenum<8960>, GLenum<3356>, GLfloat<1065353216>- A# K0 e- X7 n. r, N& p7 g$ \
- glClear, GLbitfield<256>
3 f- m; \& e5 ^6 X& Q3 W' s! v0 n - glShadeModel, GLenum<7424>
- O% c5 C. H( P5 H0 S9 `7 } - glDisable, GLenum<2929>) w! I/ V8 j5 O' ]* a
- glDisable, GLenum<3008>
! J% O0 N4 p8 b* ^# V - glDisable, GLenum<2896>
}3 P9 E' q% V/ ^" ? - glEnable, GLenum<3042>
7 Y- k0 @' ~8 N2 v; `; a+ Z - glDisable, GLenum<3553>: w( g0 V& E/ b. _' M. g
- glBindTexture, GLenum<3553>, GLuint<631>% L( b7 @4 y5 x$ j& K0 u0 D# J% O
- glTexParameteri, GLenum<3553>, GLenum<10240>, GLint<9729>$ F+ Q7 ?7 ^1 h2 @' g/ s+ I
- glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>% ~ U. g4 T3 Z3 D2 B& H
- glClear, GLbitfield<16384>: u2 h3 O3 a8 Z; Y
- glTexSubImage2D, GLenum<3553>, GLint<0>, GLint<0>, GLint<0>, GLsizei<512>, GLsizei<384>, GLenum<6408>, GLenum<5121>, CGLvoidP<266776608>
0 C$ w7 Y$ R$ \* u - glEnable, GLenum<3553>
' T0 V% z& e! j J/ ] - glBegin, GLenum<7>
# k* U4 _. D: S/ E2 s W - glColor4f, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>8 w+ t3 w7 M7 c, ~
- glTexCoord2f, GLfloat<0>, GLfloat<0>
z' r# u9 ^1 y) |6 L - glVertex2i, GLint<0>, GLint<768>" n* \; W% {) G2 @" O
- glTexCoord2f, GLfloat<1065353216>, GLfloat<0>2 F6 i. b) C8 J4 ^/ ?9 U
- glVertex2i, GLint<1024>, GLint<768>3 K6 u- o2 ^; _8 s
- glTexCoord2f, GLfloat<1065353216>, GLfloat<1065353216>
3 G. |7 X* H' T9 I - glVertex2i, GLint<1024>, GLint<-256>
2 v4 R( u/ e( q3 f - glTexCoord2f, GLfloat<0>, GLfloat<1065353216>
: L4 y$ ?$ D' U/ E' K - glVertex2i, GLint<0>, GLint<-256> a' i8 d& U# r2 W; K0 t
- glEnd% c: k. u/ c% {/ D
- glShadeModel, GLenum<7424>, `/ \7 U1 x$ O6 b, U# P4 F; j
- glGetError
2 g2 G: S, ?3 ^4 M9 H: m - glDisable, GLenum<2929>( F* r2 H V# r/ |
- glGetError" }7 u& h) v, V9 N/ b
- glBlendFunc, GLenum<770>, GLenum<771>$ S% W$ \3 {# v( x
- glGetError
5 n; v, j$ L0 g) _4 G; ` - glEnable, GLenum<3042>$ ^) I* e4 z3 B$ H6 N& g/ g' u
- glGetError
C- K o( k6 }, j% _ - glDisable, GLenum<3553>
3 g; b% ?2 X# ~9 p+ U, d - glGetError+ c) Y" `) G4 W
- glBegin, GLenum<7>
) c6 Z. B- j; b. x% [ - glColor4f, GLfloat<0>, GLfloat<0>, GLfloat<0>, GLfloat<1059883844>
) R1 r# ?( n" u7 |1 H - glTexCoord2f, GLfloat<0>, GLfloat<0>
2 s- s, P* {, y* D% C1 E - glVertex2i, GLint<0>, GLint<768>3 G+ B2 A( N4 K0 e" a: w8 J- X! e
- glTexCoord2f, GLfloat<1065353216>, GLfloat<0>& k( } L8 r# s6 S$ E; k
- glVertex2i, GLint<1024>, GLint<768>. k8 j: g+ u8 |9 m- E0 J
- glTexCoord2f, GLfloat<1065353216>, GLfloat<1065353216>3 }4 _9 }) \0 T4 p* |
- glVertex2i, GLint<1024>, GLint<0>
7 v) H1 T1 p# J& r/ D - glTexCoord2f, GLfloat<0>, GLfloat<1065353216>2 i! y, E; e2 y5 s
- glVertex2i, GLint<0>, GLint<0>6 J1 g# O6 x& j9 o; q
- glEnd: _- U' \" Z7 ~ }. J6 A- L
- glGetError4 N6 s! d6 c, E4 Z; j& H9 g
- glEnable, GLenum<3553> z; l- C$ @* z, F. A1 `! F8 O% p
- glGetError
* `% V6 \7 W; J1 k5 B' |# o' r, e - glFlush, T: r+ z3 }4 Y( t, y, W8 ~
- wglSwapBuffers
: z" b+ p6 f( P$ F& E - ---------------------------
4 y( R! { d+ M& r! K4 s% d6 b' Z - , HDC<-33484711>
9 U8 Z! R) U" s% E% n+ K6 n. J - wglGetPixelFormat, HDC<-33484711>9 ~9 _6 `9 f; ~, P0 k' x" \
- glMatrixMode, GLenum<5889>
1 p8 n) o2 |2 z' U: `' L - glLoadIdentity
, v" R y \5 R4 z6 O3 K% ?0 p - glOrtho, GLdouble<00>, GLdouble<01083179008>, GLdouble<00>, GLdouble<01082654720>, GLdouble<0-1074790400>, GLdouble<01076101120>, r" s9 J! |4 H1 j
- glViewport, GLint<0>, GLint<0>, GLsizei<1024>, GLsizei<768>
) u. u) {0 e" Q. i7 }4 G - glMatrixMode, GLenum<5888>* }+ K! @0 S i6 \ m
- glLoadIdentity
$ z$ h0 j: a2 T0 y% _ - glColor3f, GLfloat<1065353216>, GLfloat<0>, GLfloat<0>
8 R+ }5 n/ R G) } - glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>
$ P$ t, R' |, S/ B6 a) r& a9 ?8 F - glTexEnvi, GLenum<8960>, GLenum<34176>, GLint<5890>
2 v3 u- [* w0 [$ A1 R - glTexEnvi, GLenum<8960>, GLenum<34192>, GLint<768>' O4 W- c0 T& w4 R0 g0 V
- glTexEnvi, GLenum<8960>, GLenum<34177>, GLint<34167>7 p$ p: _3 P7 ~4 a8 f: M+ [
- glTexEnvi, GLenum<8960>, GLenum<34193>, GLint<768>
3 _: r. y* D) H1 ]( n" C0 L, _ - glTexEnvi, GLenum<8960>, GLenum<34161>, GLint<8448>4 j @; E( Y8 B y9 W/ g5 b# c
- glTexEnvf, GLenum<8960>, GLenum<34163>, GLfloat<1065353216>
9 C0 Y1 l- b: g Q* c - glTexEnvi, GLenum<8960>, GLenum<34184>, GLint<5890>/ ]. u/ Q1 G+ w4 K1 f u
- glTexEnvi, GLenum<8960>, GLenum<34200>, GLint<770>
& i3 ?, J7 q) Q. g! a. X- @% Z - glTexEnvi, GLenum<8960>, GLenum<34185>, GLint<34167>
) C% }* j" Z0 F2 J' X1 o+ V - glTexEnvi, GLenum<8960>, GLenum<34201>, GLint<770>
$ {7 Y1 J) v4 o8 q8 u/ S - glTexEnvi, GLenum<8960>, GLenum<34162>, GLint<8448>$ A2 A+ v- T7 e! |3 z2 A+ [
- glTexEnvf, GLenum<8960>, GLenum<3356>, GLfloat<1065353216>
" C# D$ z! I5 h/ I3 Q' o& l - glClear, GLbitfield<256># o! G6 X& A, e0 P: v: R0 ^* C
- glShadeModel, GLenum<7424>% H& \9 M8 B5 }4 E/ R' ~
- glDisable, GLenum<2929>, F3 Q; \1 l1 a" ^
- glDisable, GLenum<3008>, G; g8 `6 z1 G, p/ ?3 A
- glDisable, GLenum<2896>
6 G$ y, v" D& D/ Q$ ~) H+ _9 z7 r- u - glEnable, GLenum<3042>+ i5 t! H8 T: b& ^1 W
- glDisable, GLenum<3553> f2 E8 ]4 u5 Y @7 y/ n& I, D( }
- glBindTexture, GLenum<3553>, GLuint<631>. T) H8 |# n/ q% q3 F8 a
- glTexParameteri, GLenum<3553>, GLenum<10240>, GLint<9729>& ^. L- q+ @- x, I; [7 I
- glClearColor, GLclampf<0>, GLclampf<0>, GLclampf<0>, GLclampf<0>
% J i; @( ]2 Y- ?$ \ i - glClear, GLbitfield<16384>
0 m( {3 U: L+ F - glTexSubImage2D, GLenum<3553>, GLint<0>, GLint<0>, GLint<0>, GLsizei<512>, GLsizei<384>, GLenum<6408>, GLenum<5121>, CGLvoidP<266776608>
6 {2 _! Z& |+ }# I9 l; Q5 V a - glEnable, GLenum<3553>$ y; a( e. S$ N, _3 P
- glBegin, GLenum<7>/ F8 b2 d) g4 K; r
- glColor4f, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>, GLfloat<1065353216>* z5 C! K; p& Q
- glTexCoord2f, GLfloat<0>, GLfloat<0>
% O5 R' ]0 I0 J0 ? - glVertex2i, GLint<0>, GLint<768>6 g- K3 }* \7 r8 H% i" V
- glTexCoord2f, GLfloat<1065353216>, GLfloat<0>" _6 C% t! _7 b" `4 |
- glVertex2i, GLint<1024>, GLint<768>3 {4 X0 s# M1 K3 z
- glTexCoord2f, GLfloat<1065353216>, GLfloat<1065353216>
5 Y2 X0 h2 ^+ U; x; z& P& T! o - glVertex2i, GLint<1024>, GLint<-256>
4 l9 R: N9 l* e4 H& x - glTexCoord2f, GLfloat<0>, GLfloat<1065353216>
~) q. }( Z. Y( R! H$ ^6 H - glVertex2i, GLint<0>, GLint<-256>6 }+ n4 G5 N: Z8 l! N) w
复制代码 ; ?2 j7 g. k0 p7 _' u
& \: R/ D- X# C/ M' Y& b4 D1 v
|