冒险解谜游戏中文网 ChinaAVG
标题:
【DirectDraw游戏汉化 #2】 静物前传(Post Mortem)寻找CreateSurface
[打印本页]
作者:
shane007
时间:
2023-8-25 16:59
标题:
【DirectDraw游戏汉化 #2】 静物前传(Post Mortem)寻找CreateSurface
这游戏以前分析过,本贴再写得详细一些。
( B2 R2 s5 @9 ?0 @ v
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
* }0 o# X. C) h! V, X# N# v
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
# W5 \$ v6 _; ]2 F
- p3 G$ L1 S0 v
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
& n1 h5 g* d3 ]& Z; u. n" @' v
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
1 `: h! E# z# F( [; x: E9 {* E; _
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
8 z- [# C0 `6 v( T7 ~: o1 O+ n
STDMETHOD_(ULONG,Release) (THIS) PURE;
; w& |7 [* p7 g
STDMETHOD(Compact)(THIS) PURE;
/ o' w8 x" L0 b. H! _ D
STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
7 C% w$ F3 y8 W3 g7 ^% Q
STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
. C; F4 n$ e& s
STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
F! X) U" f. e# |2 \' r# C8 y. C! u
以下一段中完成CreateSurface。
.text:24BC2E53 call dword ptr [ecx+18h]
复制代码
* r5 M% E$ M; q) |
7 q; z, [" {3 \3 q0 G0 K
9 \* I& S) V/ ^/ T- I, i8 n
( x/ P" c" a( E: `
) O( c; V; @4 u/ h* v/ ?
.text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
' C5 r$ i- G% _# L/ g; F" M) C
.text:24BC2CD2
5 E: A* @( ?2 T: w) v3 ~, y
.text:24BC2CD2 ; Attributes: bp-based frame
' ?* W% d2 h3 S" F5 [7 E
.text:24BC2CD2
0 \, a: n% e# u+ b5 S) |; x; M- H
.text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
2 n+ v4 R/ c+ Q0 U- |* x, ]9 j
.text:24BC2CD2
; K. E/ \! c/ e, |% B! {
.text:24BC2CD2 Dst = dword ptr -90h
6 V; Y* i- M9 U: Z. M% c
.text:24BC2CD2 var_8C = dword ptr -8Ch
& d' M0 g# `" y/ L" d% d0 U
.text:24BC2CD2 var_28 = dword ptr -28h
$ C6 t6 A0 ]& q0 f. z- L
.text:24BC2CD2 var_24 = dword ptr -24h
0 n+ b. [2 W( x" k* B
.text:24BC2CD2 var_20 = dword ptr -20h
+ w& c4 h$ x* r
.text:24BC2CD2 var_1C = dword ptr -1Ch
8 G6 p1 r, i7 f
.text:24BC2CD2 var_18 = dword ptr -18h
9 v B6 t) q W/ j N N
.text:24BC2CD2 ppv = dword ptr -14h
* @: F2 g" l) p5 Z4 [* t" e
.text:24BC2CD2 var_10 = dword ptr -10h
0 U6 F* b1 {, |8 O6 C F
.text:24BC2CD2 var_C = dword ptr -0Ch
L- R v9 s$ N( {6 D1 j
.text:24BC2CD2 var_8 = dword ptr -8
6 W- V; X% ]7 T
.text:24BC2CD2 hLibModule = dword ptr -4
0 U" @' e4 k. N1 F; ^$ F
.text:24BC2CD2
; {6 l' _( t* C2 C4 h
.text:24BC2CD2 push ebp
: o0 T1 K# n' v
.text:24BC2CD3 mov ebp, esp
* Q N8 J% a' w# `6 N3 O3 k
.text:24BC2CD5 sub esp, 90h
9 ~3 A a+ Z& u5 C+ k8 G( X+ N% M
.text:24BC2CDB push ebx
) @8 f$ R" n( b5 h! W
.text:24BC2CDC mov ebx, ds:LoadLibraryA
! \5 z* [# U% c
.text:24BC2CE2 push esi
' N; e I1 Y/ ? U! |1 z
.text:24BC2CE3 push edi
7 _3 a) Z, D/ i2 Q
.text:24BC2CE4 xor edi, edi
& r' b* P3 a3 W' Y* ?0 F/ e
.text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
# Q% r- u9 @! o" R# _
.text:24BC2CEB mov [ebp+var_8], edi
; [ Z& n- w4 V: D+ t0 M
.text:24BC2CEE mov [ebp+var_1C], edi
! J' W' l9 D- D+ E$ D+ `
.text:24BC2CF1 mov [ebp+var_C], edi
: H) P! I2 N3 c3 v, ~
.text:24BC2CF4 mov [ebp+var_10], edi
5 z3 G, N8 f0 F0 p& f: t$ G& [) [, _
.text:24BC2CF7 mov [ebp+var_18], edi
' F6 U. v9 w, N/ [ a" M: r: T0 x
.text:24BC2CFA call ebx ; LoadLibraryA
# C8 H- a# f' F' u
.text:24BC2CFC mov esi, eax
0 o9 v! @* G# M. E8 H
.text:24BC2CFE cmp esi, edi
3 c2 |1 @( g1 D" A+ \
.text:24BC2D00 mov [ebp+hLibModule], esi
1 I6 L+ ?8 ?* S# s- R( C
.text:24BC2D03 jnz short loc_24BC2D0F
- K# P( u, v. R j9 }
.text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
1 y4 h; P5 [* K- z! ]
.text:24BC2D0A jmp loc_24BC2E6D
/ K/ H$ `" p& ~2 m
.text:24BC2D0F ; ---------------------------------------------------------------------------
2 j3 G! V, y! B
.text:24BC2D0F
0 E' H* E8 q3 i
.text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
* h4 [ B5 y; B
.text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
# Z0 J$ x0 m; d1 p4 z
.text:24BC2D14 push esi ; hModule
" u; b- o7 b2 M0 ~) l+ u
.text:24BC2D15 call ds:GetProcAddress
% J' `/ B8 T( H6 T- J
.text:24BC2D1B cmp eax, edi
& `9 N+ P9 w4 a7 O* P
.text:24BC2D1D jnz short loc_24BC2D30
7 X. A: R+ P" c% a1 p
.text:24BC2D1F push esi ; hLibModule
! e: K1 r; I: |
.text:24BC2D20 call ds:FreeLibrary
( B6 @6 y! H/ |7 A3 W$ K* q8 c
.text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
\; t2 F: f5 Z* u/ j0 i
.text:24BC2D2B jmp loc_24BC2E6D
' D+ ?* t Y' ?/ q. y. n
.text:24BC2D30 ; ---------------------------------------------------------------------------
2 t3 K$ D) O7 B; Q" Q& F: N
.text:24BC2D30
1 w: W4 j: d. @% S+ o& N% o
.text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
3 g- `, h( {. K+ j$ C3 f
.text:24BC2D30 lea ecx, [ebp+var_8]
$ J4 o7 l9 S- I4 @
.text:24BC2D33 push edi
) j; l7 t- @% w+ g+ L6 D b7 H% ^
.text:24BC2D34 push ecx
+ n8 l3 M# }' D
.text:24BC2D35 push edi
8 V% C, C% N+ C) A+ C# N* ]+ p/ ]
.text:24BC2D36 call eax
" ^& o- j8 J# j- j
.text:24BC2D38 test eax, eax
$ u8 o! {; r5 x# ^+ s2 n3 S0 l6 x
.text:24BC2D3A jge short loc_24BC2D4D
2 K/ K5 I" J1 g' O- }
.text:24BC2D3C push esi ; hLibModule
& U& u& m: W6 H' Y, q9 ]* R
.text:24BC2D3D call ds:FreeLibrary
; _9 K7 n& N* v$ M
.text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
^$ s( P9 a/ G) v0 v
.text:24BC2D48 jmp loc_24BC2E6D
* s- ~3 b+ G5 b' h9 H
.text:24BC2D4D ; ---------------------------------------------------------------------------
5 d& }6 ?# ]: B' @
.text:24BC2D4D
, y x0 }5 u1 y7 V7 y
.text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
x3 W$ x& v7 S
.text:24BC2D4D mov eax, [ebp+var_8]
7 I( r# F1 T4 U5 \& b+ U: L
.text:24BC2D50 lea edx, [ebp+var_1C]
6 ~0 K5 [2 u& V# ]$ r" U7 h
.text:24BC2D53 push edx
1 l% Z- ~+ B7 \% I' V8 Z
.text:24BC2D54 push offset unk_24BC4470
+ _% G4 _8 ~4 |; L# W- u, a
.text:24BC2D59 mov ecx, [eax]
. e0 i" m$ D( R2 @4 J6 J
.text:24BC2D5B push eax
& ], e% c! n* @- x1 P7 ^
.text:24BC2D5C call dword ptr [ecx]
1 c4 @& b0 p' D0 K+ ?" L
.text:24BC2D5E test eax, eax
$ S$ y% m9 H9 q1 @9 [
.text:24BC2D60 jge short loc_24BC2D87
_1 `- `) d" M# ^$ C" Z4 @
.text:24BC2D62 mov eax, [ebp+var_8]
6 i# _* f4 y2 s: n
.text:24BC2D65 push eax
5 a7 @# Y/ R h2 s$ r) a" b. H
.text:24BC2D66 mov ecx, [eax]
! L7 G( P/ I" Z o2 q5 R2 @
.text:24BC2D68 call dword ptr [ecx+8]
. G7 e, Q& m% M0 z- D R
.text:24BC2D6B push esi ; hLibModule
1 D' m) t5 M9 g; y
.text:24BC2D6C call ds:FreeLibrary
5 m% a3 H- h2 }2 L
.text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
8 R1 I+ T. F: w% o: [+ J
.text:24BC2D77 call ds:OutputDebugStringA
. @ x6 ^; [/ s2 T a
.text:24BC2D7D mov eax, 100h
8 k1 i9 d' B9 ]* ^1 d# F+ y
.text:24BC2D82 jmp loc_24BC3011
: m8 ]% c3 \) W" n O6 O( |& A
.text:24BC2D87 ; ---------------------------------------------------------------------------
' H! ?1 H/ @' P8 k: ?: v) V
.text:24BC2D87
; g8 x7 t) [ J/ ]. m
.text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
. d2 {9 h: s% D4 r/ d
.text:24BC2D87 mov eax, [ebp+var_1C]
0 Q" M+ o4 G- Q1 `2 x. I- H
.text:24BC2D8A push eax
2 C& Z1 ]% A H8 r1 D) e3 l
.text:24BC2D8B mov ecx, [eax]
. M+ [$ U X" ? z
.text:24BC2D8D call dword ptr [ecx+8]
, ` i$ S+ J, C$ [( V
.text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
, N& [) z/ s% s0 L# n
.text:24BC2D95 call ebx ; LoadLibraryA
, [3 O. z! @, ]8 X
.text:24BC2D97 mov esi, eax
% D( X" ?: g) j1 u+ Q
.text:24BC2D99 cmp esi, edi
2 K+ l0 c% N- z
.text:24BC2D9B jnz short loc_24BC2DB6
0 w" y' [( B% Z& \' V
.text:24BC2D9D mov eax, [ebp+var_8]
- B' U$ B# {9 D. R# f7 a- f6 ]% b
.text:24BC2DA0 push eax
. p/ e" J/ u9 l0 d
.text:24BC2DA1 mov ecx, [eax]
% P& P* x# t# {: r3 X
.text:24BC2DA3 call dword ptr [ecx+8]
+ Z$ |" h: `0 r$ z1 d3 Y
.text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
7 I/ a5 _% h0 l( ]/ s; | }4 Z
.text:24BC2DA9 call ds:FreeLibrary
' ]1 c; K* ^) Q J7 f8 M
.text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
}! o9 Z" }/ E4 D; o* q" C/ R7 A
.text:24BC2DB4 jmp short loc_24BC2DE2
/ S7 v8 W0 n x8 W
.text:24BC2DB6 ; ---------------------------------------------------------------------------
$ J/ F5 R! E9 u! J' [. O
.text:24BC2DB6
- {& O8 C7 [, ]9 {& n
.text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
+ k1 b2 t7 p6 k8 [% [% c) A
.text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
+ y3 ?( Y1 A+ N
.text:24BC2DBB push esi ; hModule
( L; T Y. d/ ?( r( i& u
.text:24BC2DBC call ds:GetProcAddress
5 R9 N* M0 Z+ M) ]$ }
.text:24BC2DC2 push esi ; hLibModule
I5 j& P: e& h9 h1 h3 Y
.text:24BC2DC3 mov esi, ds:FreeLibrary
4 ?. K+ h _, K: v' @
.text:24BC2DC9 test eax, eax
+ v8 C/ v- }4 ]8 U( z7 E. l
.text:24BC2DCB jnz short loc_24BC2DF2
2 [% ]- M$ @* z2 u. P
.text:24BC2DCD call esi ; FreeLibrary
& C! o/ S( [, ^/ g% J. ]: P F
.text:24BC2DCF mov eax, [ebp+var_8]
6 ?: H7 l1 l: Y4 `: C# ?) { | T
.text:24BC2DD2 push eax
3 y+ W2 n$ C( d' L. A
.text:24BC2DD3 mov ecx, [eax]
# P& ?7 J& G P1 J" k
.text:24BC2DD5 call dword ptr [ecx+8]
3 H9 W) g( L; A; x
.text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
: J% U: h8 w1 d
.text:24BC2DDB call esi ; FreeLibrary
! a+ m( C& E: Z. s: E& y
.text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
+ A9 e' f( B# p# A# `
.text:24BC2DE2
7 y+ X) h9 U& [. i9 `7 w9 Y# M* W
.text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
0 |2 T x- \6 N7 E7 t# s3 z
.text:24BC2DE2 call ds:OutputDebugStringA
* t8 X# y4 o! G
.text:24BC2DE8 mov eax, 200h
1 L2 j1 Y7 _# n ~
.text:24BC2DED jmp loc_24BC3011
8 }7 X4 I8 I, e3 v2 L
.text:24BC2DF2 ; ---------------------------------------------------------------------------
1 W# ?$ x/ S- J, C1 i
.text:24BC2DF2
+ a: I5 \# b0 x* {
.text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
& G9 r' X2 _! J- h- n. U E
.text:24BC2DF2 call esi ; FreeLibrary
; P. C- q9 B* T' a" ?6 O1 i( t
.text:24BC2DF4 push 6Ch ; Size
3 G; c( u! C. t5 l/ {' c
.text:24BC2DF6 lea eax, [ebp+Dst]
0 `+ K3 y( t5 V7 i5 q8 X; i. d2 w
.text:24BC2DFC push edi ; Val
& `5 r6 k* K# T& p: ~
.text:24BC2DFD push eax ; Dst
1 s" F- V2 J& b: N4 |9 P4 C
.text:24BC2DFE call memset
/ Z/ A( M9 z4 Z4 \, I6 f9 D
.text:24BC2E03 mov eax, [ebp+var_8]
4 v: U2 r$ p& _/ Z5 ]+ `( y: L% h
.text:24BC2E06 add esp, 0Ch
0 l: I3 V8 d1 P1 K/ E7 q6 ~
.text:24BC2E09 mov [ebp+Dst], 6Ch
0 t2 {; D: c8 u a
.text:24BC2E13 mov [ebp+var_8C], 1
7 Y% n, U( V! E8 O" H! h9 w
.text:24BC2E1D mov [ebp+var_28], 200h
# ^' e) f X- o5 ]
.text:24BC2E24 mov ecx, [eax]
- J0 v4 o9 R' @1 o5 ?
.text:24BC2E26 push 8
0 Z3 x/ U+ }/ x4 W( p ~0 \
.text:24BC2E28 push edi
: d8 y1 n" K! [, J
.text:24BC2E29 push eax
8 \# {0 O0 _% l8 B3 K: G9 h
.text:24BC2E2A call dword ptr [ecx+50h]
' Y6 F0 C2 k/ B: O
.text:24BC2E2D test eax, eax
0 l# d1 w+ ?+ i- g5 X
.text:24BC2E2F mov eax, [ebp+var_8]
: Q- m( Y1 o4 ?: D
.text:24BC2E32 mov ecx, [eax]
9 Q$ h9 j, X& [8 l8 A. U
.text:24BC2E34 jge short loc_24BC2E46
7 F6 o: n9 L0 H$ B W
.text:24BC2E36 push eax
4 e5 b. f& z" f
.text:24BC2E37 call dword ptr [ecx+8]
- K& k B1 p% O
.text:24BC2E3A push [ebp+hLibModule] ; hLibModule
6 T$ b. U3 u1 {/ V1 E
.text:24BC2E3D call esi ; FreeLibrary
9 U5 q: U. m" Q& k
.text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
( H5 G3 N% |2 n
.text:24BC2E44 jmp short loc_24BC2E6D
; ]9 k+ f9 v/ ~6 O& t
.text:24BC2E46 ; ---------------------------------------------------------------------------
, j( v3 }2 k' P7 q# `/ k* T
.text:24BC2E46
; E/ ^+ ]" U( g1 Y6 ^. {
.text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
) n2 {9 l1 {5 ^ S4 ]& A0 G/ |
.text:24BC2E46 lea edx, [ebp+var_C]
! ~, a& z' b4 R4 T5 x3 v1 f
.text:24BC2E49 push edi
3 s& z% _6 |0 [6 L+ v* Q
.text:24BC2E4A push edx
2 v, E1 k" ]" c# z9 z
.text:24BC2E4B lea edx, [ebp+Dst]
9 H2 d& `/ T9 W% f0 w7 |2 ^, U
.text:24BC2E51 push edx
) C/ f* O( z: k( A2 S. F
.text:24BC2E52 push eax
: {" F6 a9 z; c( h2 l
.text:24BC2E53 call dword ptr [ecx+18h]
9 I' n I2 ~1 e7 w" X- \3 m
.text:24BC2E56 test eax, eax
# m3 l$ C( p$ Q# \2 |4 w
.text:24BC2E58 jge short loc_24BC2E7A
" q$ q8 P4 ^2 Z Z G- L$ M" X- @
.text:24BC2E5A mov eax, [ebp+var_8]
7 B" ~9 o1 u' u0 n" F
.text:24BC2E5D push eax
+ A' U4 s: n9 A4 O# V
.text:24BC2E5E mov ecx, [eax]
# g5 B- K3 ^% q4 \6 g* X
.text:24BC2E60 call dword ptr [ecx+8]
+ [5 U) @- P- u d; C$ F5 A$ S
.text:24BC2E63 push [ebp+hLibModule] ; hLibModule
, }/ V5 \$ p% r! X5 }0 i* r
.text:24BC2E66 call esi ; FreeLibrary
, }: S; ?; j( R" |8 z4 F
.text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
+ {0 b7 F2 N+ k9 ]$ d, R) |% y; q
.text:24BC2E6D
Q& b i5 p! E) [: X# c; D
.text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
! _2 D& F1 [: I _ t+ H* R
.text:24BC2E6D ; sub_24BC2CD2+59↑j ...
" _2 O8 }7 J4 j; e7 J
.text:24BC2E6D call ds:OutputDebugStringA
$ {( i/ Z; S3 l0 B8 u% i
.text:24BC2E73 xor eax, eax
1 p. e" A/ q! s; I3 Z+ ^8 h$ \. v
.text:24BC2E75 jmp loc_24BC3011
`! M5 u0 V. ~4 V
.text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
- D! N; s5 Q/ V+ {
5 Y9 l; q8 Q! Z4 I
6 k0 k- o1 Z/ `4 z
欢迎光临 冒险解谜游戏中文网 ChinaAVG (https://chinaavg.com/)
Powered by Discuz! X3.2