冒险解谜游戏中文网 ChinaAVG
标题:
【DirectDraw游戏汉化 #2】 静物前传(Post Mortem)寻找CreateSurface
[打印本页]
作者:
shane007
时间:
2023-8-25 16:59
标题:
【DirectDraw游戏汉化 #2】 静物前传(Post Mortem)寻找CreateSurface
这游戏以前分析过,本贴再写得详细一些。
J: E' t4 @+ G: m
这是一个DirectDraw游戏,在Post Mortem\Dlls下的DX7SoundManager.dll里完成对DirectDraw的初始化,
; h$ c) B6 W s( T: i* f
注意,初始化不是用导入函数方式进行,而是以loadlibrary方式进行的。
: a( r6 n8 n6 r" ~& b
' F1 V; x0 `0 n% E: t
参考DDRAW.H得知CreateSurface是其中第7个函数,则函数偏移量为4X(7-1)=24,就是0x18.
6 Z& w& ^6 U; D
STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID FAR * ppvObj) PURE;
+ \0 e8 u1 @" d7 f$ v6 o% h
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
. T1 [: R9 B6 \5 B% L* W! m& r
STDMETHOD_(ULONG,Release) (THIS) PURE;
3 H9 A/ H: B4 L' s6 h
STDMETHOD(Compact)(THIS) PURE;
1 m7 X% f7 `5 Y! J
STDMETHOD(CreateClipper)(THIS_ DWORD, LPDIRECTDRAWCLIPPER FAR*, IUnknown FAR * ) PURE;
: V* K, X5 p1 |/ o; [2 @2 J
STDMETHOD(CreatePalette)(THIS_ DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE FAR*, IUnknown FAR * ) PURE;
9 [0 J5 o/ l( {3 }* M3 n$ I
STDMETHOD(CreateSurface)(THIS_ LPDDSURFACEDESC, LPDIRECTDRAWSURFACE FAR *, IUnknown FAR *) PURE;
复制代码
' |" a9 x0 m% H z
以下一段中完成CreateSurface。
.text:24BC2E53 call dword ptr [ecx+18h]
复制代码
1 `: G& Q1 s$ w
5 o( c0 L9 a0 K x' \5 J2 Y
6 `' k$ Z4 `- X8 T5 S5 K
6 c1 O& f0 P4 D* M1 x$ o
' V/ o& J A( L4 S/ P, m2 }
.text:24BC2CD2 ; =============== S U B R O U T I N E =======================================
+ l: n4 z: L+ }% G6 I
.text:24BC2CD2
9 @' E! f' j2 H0 y* e0 K! O
.text:24BC2CD2 ; Attributes: bp-based frame
- D. b1 y4 u* R! F0 y) T' [
.text:24BC2CD2
) ^/ p, ~. s: j2 b. H- k: X" j
.text:24BC2CD2 sub_24BC2CD2 proc near ; CODE XREF: .text:loc_24BC2811↑p
3 o0 Z5 r0 k4 f4 Y6 m/ V9 n
.text:24BC2CD2
T2 J: s: ~: S+ I/ j0 w
.text:24BC2CD2 Dst = dword ptr -90h
0 a- E% Y# i8 ~, d# {2 C* C( g
.text:24BC2CD2 var_8C = dword ptr -8Ch
, E3 o" w1 Z% J
.text:24BC2CD2 var_28 = dword ptr -28h
- S5 R9 B; t/ c5 w: L
.text:24BC2CD2 var_24 = dword ptr -24h
5 u9 s U* X- G+ [/ w! Z
.text:24BC2CD2 var_20 = dword ptr -20h
+ S2 P7 p& \/ p+ g5 s+ d* f
.text:24BC2CD2 var_1C = dword ptr -1Ch
- N6 o. X3 v) \2 I" C. [( n
.text:24BC2CD2 var_18 = dword ptr -18h
# ], `, g( M( A4 {% m6 g4 E/ ]
.text:24BC2CD2 ppv = dword ptr -14h
1 {6 _8 ?* G3 e2 `+ f* M* B
.text:24BC2CD2 var_10 = dword ptr -10h
) S) P6 Y( e; q
.text:24BC2CD2 var_C = dword ptr -0Ch
& k1 @( Z3 C4 O d2 f- {. [" X
.text:24BC2CD2 var_8 = dword ptr -8
5 M% y& B+ V) l
.text:24BC2CD2 hLibModule = dword ptr -4
% O: O* Q, j- m0 B% m' k( M
.text:24BC2CD2
1 x; W5 C% }- ^7 B
.text:24BC2CD2 push ebp
" K4 j2 u5 F4 g* u6 p R& Q
.text:24BC2CD3 mov ebp, esp
3 N* X3 N; m# ?
.text:24BC2CD5 sub esp, 90h
$ e. _9 p$ j, b* Y+ t. T7 v2 H
.text:24BC2CDB push ebx
0 h6 N; \3 v$ [7 P* B* P0 ~5 p
.text:24BC2CDC mov ebx, ds:LoadLibraryA
8 o9 \' b @9 f
.text:24BC2CE2 push esi
4 Y' G/ |, o/ V6 P
.text:24BC2CE3 push edi
: C% u& o+ c* I* \
.text:24BC2CE4 xor edi, edi
+ G% j! u% K0 q& e8 ^2 l
.text:24BC2CE6 push offset LibFileName ; "DDRAW.DLL"
1 O0 K# e _. w. y0 W& Q' B" ~
.text:24BC2CEB mov [ebp+var_8], edi
* G+ x4 q5 ^, B; x
.text:24BC2CEE mov [ebp+var_1C], edi
( B2 b) n- W0 E
.text:24BC2CF1 mov [ebp+var_C], edi
5 X7 v Y( |5 M. v2 T: n
.text:24BC2CF4 mov [ebp+var_10], edi
- P, y+ k" v0 H
.text:24BC2CF7 mov [ebp+var_18], edi
$ i5 a. `/ E p2 d) Y
.text:24BC2CFA call ebx ; LoadLibraryA
) m: c2 `; I; D4 \+ s
.text:24BC2CFC mov esi, eax
. X. E* R M7 N" l, v" o& p) f
.text:24BC2CFE cmp esi, edi
9 L8 k' U& d4 y9 | p
.text:24BC2D00 mov [ebp+hLibModule], esi
& Y/ B* ~; h2 A8 ^
.text:24BC2D03 jnz short loc_24BC2D0F
! u) w5 A' ? F$ i, |7 A5 _
.text:24BC2D05 push offset aCouldnTLoadlib ; "Couldn't LoadLibrary DDraw\r\n"
4 |+ L" B# g' r, j$ w4 \2 J( M
.text:24BC2D0A jmp loc_24BC2E6D
* T$ l; ^" l! R1 G3 h N( b
.text:24BC2D0F ; ---------------------------------------------------------------------------
2 v3 S( q& N1 @% `8 F3 A
.text:24BC2D0F
: c" a1 `% P. {! K
.text:24BC2D0F loc_24BC2D0F: ; CODE XREF: sub_24BC2CD2+31↑j
( b( s1 O/ c/ w2 B; k
.text:24BC2D0F push offset ProcName ; "DirectDrawCreate"
7 a" B6 c0 Q7 H$ f' i8 @
.text:24BC2D14 push esi ; hModule
5 R4 r6 w" Q/ w( \) K: k
.text:24BC2D15 call ds:GetProcAddress
2 r% E% x2 l, O+ ~+ Q
.text:24BC2D1B cmp eax, edi
* z5 ?& ^0 _1 O5 B2 o* U/ @% k# B' i
.text:24BC2D1D jnz short loc_24BC2D30
0 D. r$ M% j- p: m* j: n% {
.text:24BC2D1F push esi ; hLibModule
8 h9 ~. q+ y" @
.text:24BC2D20 call ds:FreeLibrary
2 w& m; z+ R2 ]8 P/ p7 N& M0 m
.text:24BC2D26 push offset aCouldnTGetproc ; "Couldn't GetProcAddress DirectDrawCreat"...
7 o m+ m7 ~* r) i: y
.text:24BC2D2B jmp loc_24BC2E6D
7 r2 ^' G, W% K+ [
.text:24BC2D30 ; ---------------------------------------------------------------------------
; s7 k" w& @- f9 U2 j
.text:24BC2D30
$ J, Z+ i7 V. H
.text:24BC2D30 loc_24BC2D30: ; CODE XREF: sub_24BC2CD2+4B↑j
* U+ t) C' E" Q( {) y/ q
.text:24BC2D30 lea ecx, [ebp+var_8]
4 h* j: p1 v; ^
.text:24BC2D33 push edi
) l; Z6 W/ q! K: D
.text:24BC2D34 push ecx
$ v/ v) T5 w* W3 O5 q( w8 V
.text:24BC2D35 push edi
! n2 r# q* k1 r" [ @( F2 w
.text:24BC2D36 call eax
7 { K, z$ X4 N3 v9 Q* c6 ^* N
.text:24BC2D38 test eax, eax
( q4 Z+ O, P& `3 T0 y/ i
.text:24BC2D3A jge short loc_24BC2D4D
- P* x, c% t' l8 x2 A
.text:24BC2D3C push esi ; hLibModule
5 I4 ^% x* U) j% D- k8 ?
.text:24BC2D3D call ds:FreeLibrary
; y6 g. G U P
.text:24BC2D43 push offset aCouldnTCreateD ; "Couldn't create DDraw\r\n"
' `" @$ a5 `, k0 g) e- w) a8 }1 b
.text:24BC2D48 jmp loc_24BC2E6D
$ L$ U3 q( @; M# \7 n* r3 D& h
.text:24BC2D4D ; ---------------------------------------------------------------------------
& j; M- j5 C2 N( }
.text:24BC2D4D
# f5 r8 b* o$ V! E: f; Y5 C
.text:24BC2D4D loc_24BC2D4D: ; CODE XREF: sub_24BC2CD2+68↑j
- A/ d& A' |8 A) x% h
.text:24BC2D4D mov eax, [ebp+var_8]
0 G5 ~) E/ C% d% n' J2 M* o ~
.text:24BC2D50 lea edx, [ebp+var_1C]
$ C& F7 `6 c. q- t/ n7 D
.text:24BC2D53 push edx
, v8 M, c* l$ G% z- g2 J
.text:24BC2D54 push offset unk_24BC4470
0 n( O2 W3 q' H7 U8 {' `
.text:24BC2D59 mov ecx, [eax]
# m& E% ^# x* ]4 \. Q- a$ U* }1 j
.text:24BC2D5B push eax
' ?2 \& d7 ?2 v( }4 q3 U
.text:24BC2D5C call dword ptr [ecx]
, G B9 N' F7 ^4 _
.text:24BC2D5E test eax, eax
' E: n. S; F$ b5 Y: q
.text:24BC2D60 jge short loc_24BC2D87
8 T# Z' _& a1 J7 Z, V
.text:24BC2D62 mov eax, [ebp+var_8]
" l% L) u! q, h+ c( z, G
.text:24BC2D65 push eax
! D h1 h y' n- O* u% r u$ a
.text:24BC2D66 mov ecx, [eax]
$ G; h+ s5 Q8 B: Q9 v
.text:24BC2D68 call dword ptr [ecx+8]
+ S; _9 ~5 o& B, E x8 c* a6 b- U
.text:24BC2D6B push esi ; hLibModule
; i; a( k# \3 W, h( l! O p
.text:24BC2D6C call ds:FreeLibrary
* _( u* R# c. d8 b
.text:24BC2D72 push offset OutputString ; "Couldn't QI DDraw2\r\n"
6 ^# j: N0 z- p0 g& W
.text:24BC2D77 call ds:OutputDebugStringA
7 D( N% b6 v( d8 j# j! P5 P9 h
.text:24BC2D7D mov eax, 100h
5 Q8 ]8 `# ^* k
.text:24BC2D82 jmp loc_24BC3011
& ]4 ^# |2 c* J' j
.text:24BC2D87 ; ---------------------------------------------------------------------------
! E6 @" j Q2 K7 I. n
.text:24BC2D87
% t, ~3 d. t4 H
.text:24BC2D87 loc_24BC2D87: ; CODE XREF: sub_24BC2CD2+8E↑j
7 C5 m C( @1 F/ A0 I
.text:24BC2D87 mov eax, [ebp+var_1C]
: Q( Z5 T0 d! f: {5 J; }1 L7 s
.text:24BC2D8A push eax
3 a3 {3 K. }) x8 p
.text:24BC2D8B mov ecx, [eax]
2 K0 b e8 ?* ~% p" U
.text:24BC2D8D call dword ptr [ecx+8]
5 B% F6 Q$ ^, Q
.text:24BC2D90 push offset aDinputDll ; "DINPUT.DLL"
; `4 Q. E1 {2 Q" b
.text:24BC2D95 call ebx ; LoadLibraryA
, F7 S3 R& D: t' u+ ?! U
.text:24BC2D97 mov esi, eax
m ^& J/ c9 k& X
.text:24BC2D99 cmp esi, edi
2 }' c0 e& K3 b9 Z2 G
.text:24BC2D9B jnz short loc_24BC2DB6
0 Y5 Q+ h2 c+ J& X
.text:24BC2D9D mov eax, [ebp+var_8]
% P5 m6 z9 W$ {
.text:24BC2DA0 push eax
5 S: F# M. r& t) o7 N( I4 K, p
.text:24BC2DA1 mov ecx, [eax]
* V$ D# l1 n z9 J! n. M6 b" ~5 R! u
.text:24BC2DA3 call dword ptr [ecx+8]
( A6 ~6 a1 [1 D$ s6 a
.text:24BC2DA6 push [ebp+hLibModule] ; hLibModule
# s4 O1 W! Z& Y; Z% o) q4 A
.text:24BC2DA9 call ds:FreeLibrary
: Y- R! V" ~0 B7 ?- ]' [
.text:24BC2DAF push offset aCouldnTLoadlib_0 ; "Couldn't LoadLibrary DInput\r\n"
: J$ g: B) I' a# W, I" p
.text:24BC2DB4 jmp short loc_24BC2DE2
0 I z0 W2 q. o% U C! p/ {, U6 p
.text:24BC2DB6 ; ---------------------------------------------------------------------------
2 _, `# I$ ~, s5 \6 {
.text:24BC2DB6
( J6 q& U: M: d. h- w
.text:24BC2DB6 loc_24BC2DB6: ; CODE XREF: sub_24BC2CD2+C9↑j
0 p5 _1 l4 J- ?. O* b
.text:24BC2DB6 push offset aDirectinputcre ; "DirectInputCreateA"
( N# B1 j* X: v3 @$ y2 `/ m6 ~& b
.text:24BC2DBB push esi ; hModule
, E" d- L1 |) g" s6 F
.text:24BC2DBC call ds:GetProcAddress
* Z9 z5 {& A. q$ ~) ]
.text:24BC2DC2 push esi ; hLibModule
5 E5 B! q ` f
.text:24BC2DC3 mov esi, ds:FreeLibrary
, X* Q3 P2 }( q1 z! b" \% J: I$ I
.text:24BC2DC9 test eax, eax
9 M0 s2 i% J' V% z
.text:24BC2DCB jnz short loc_24BC2DF2
" o/ }1 \- x1 m. ^' ~: ^1 V, M
.text:24BC2DCD call esi ; FreeLibrary
! S6 f% l4 a; T; f. f& s' R
.text:24BC2DCF mov eax, [ebp+var_8]
' n1 q# z1 n5 O9 |' i2 R$ ]0 `% G
.text:24BC2DD2 push eax
) D- X! O; p& y6 ~
.text:24BC2DD3 mov ecx, [eax]
; C# H0 |/ z: {
.text:24BC2DD5 call dword ptr [ecx+8]
" G' a0 M7 h" x9 p
.text:24BC2DD8 push [ebp+hLibModule] ; hLibModule
, |1 M7 ~8 Y9 o3 k1 ^5 `
.text:24BC2DDB call esi ; FreeLibrary
( C4 A" k# o3 [& g
.text:24BC2DDD push offset aCouldnTGetproc_0 ; "Couldn't GetProcAddress DInputCreate\r"...
" z4 |4 K; g" X/ h
.text:24BC2DE2
5 F! q% Y" j% k- |
.text:24BC2DE2 loc_24BC2DE2: ; CODE XREF: sub_24BC2CD2+E2↑j
5 |' J' r$ `$ Y$ L
.text:24BC2DE2 call ds:OutputDebugStringA
) \4 N$ N1 ]2 e% H# P7 \. @
.text:24BC2DE8 mov eax, 200h
/ x) w6 |$ P/ j; s O j5 H
.text:24BC2DED jmp loc_24BC3011
/ n* A' S$ |% J6 k
.text:24BC2DF2 ; ---------------------------------------------------------------------------
- D: T8 P$ V: r" ]
.text:24BC2DF2
" N, _1 l7 L I/ b& V: A
.text:24BC2DF2 loc_24BC2DF2: ; CODE XREF: sub_24BC2CD2+F9↑j
8 G! I; y0 Y6 j4 {; b
.text:24BC2DF2 call esi ; FreeLibrary
- H% h8 E( P7 {$ I- z* S! z
.text:24BC2DF4 push 6Ch ; Size
7 C5 S* _% z2 z. f2 L; q m* o
.text:24BC2DF6 lea eax, [ebp+Dst]
- A' ]6 h0 O. g# I$ o4 A
.text:24BC2DFC push edi ; Val
' y i* l/ u2 v0 ]. ?
.text:24BC2DFD push eax ; Dst
7 w, V4 ~8 x/ a; M
.text:24BC2DFE call memset
9 y% x& v" e' z% D3 o
.text:24BC2E03 mov eax, [ebp+var_8]
! P9 C* s/ W' J1 \0 g' q$ v
.text:24BC2E06 add esp, 0Ch
: t7 O- s6 D7 i% N
.text:24BC2E09 mov [ebp+Dst], 6Ch
# n6 _, x* W' s8 \
.text:24BC2E13 mov [ebp+var_8C], 1
}* j! h3 _' r
.text:24BC2E1D mov [ebp+var_28], 200h
# m- s3 V: ?- ~8 f" P6 M
.text:24BC2E24 mov ecx, [eax]
0 V& W' X J' P2 T" j3 h0 L9 J" H
.text:24BC2E26 push 8
$ l# E; \# K" H
.text:24BC2E28 push edi
8 `1 W3 _" U' f9 x3 d
.text:24BC2E29 push eax
# q' r" Y& G# n8 o9 O' u& n; B
.text:24BC2E2A call dword ptr [ecx+50h]
! j8 M: [- o. A7 c! `" z
.text:24BC2E2D test eax, eax
9 i1 i) o+ l3 ^6 x, O$ ^6 c
.text:24BC2E2F mov eax, [ebp+var_8]
$ P5 \6 H; b0 y& G. _3 p
.text:24BC2E32 mov ecx, [eax]
9 m, n$ j9 W7 y# B+ z
.text:24BC2E34 jge short loc_24BC2E46
( [& K9 d$ L& [$ E2 \
.text:24BC2E36 push eax
8 }0 t3 a2 B& j% O5 h. y7 D& x3 B! U& d
.text:24BC2E37 call dword ptr [ecx+8]
, e$ ?0 Y7 O( w) Q4 `0 S
.text:24BC2E3A push [ebp+hLibModule] ; hLibModule
; O2 a- q- T0 T; j
.text:24BC2E3D call esi ; FreeLibrary
8 g6 e3 y E: R8 @
.text:24BC2E3F push offset aCouldnTSetCoop ; "Couldn't Set coop level\r\n"
) d" c' G6 b6 W4 X( I4 i
.text:24BC2E44 jmp short loc_24BC2E6D
9 u* t+ Y# C, U6 a- v
.text:24BC2E46 ; ---------------------------------------------------------------------------
6 S7 Q& m& c8 @+ c5 w3 y2 z4 {$ Z
.text:24BC2E46
8 g- A. X" D9 ~, s% {' o
.text:24BC2E46 loc_24BC2E46: ; CODE XREF: sub_24BC2CD2+162↑j
7 O6 E* @/ J+ d3 _2 y9 U- u: K- |6 {) K
.text:24BC2E46 lea edx, [ebp+var_C]
Z9 e4 ~5 k+ A1 r
.text:24BC2E49 push edi
' J' U, r7 P; F; {. ~4 v& c B
.text:24BC2E4A push edx
W" p1 i8 j/ [
.text:24BC2E4B lea edx, [ebp+Dst]
, T" H7 M: r8 P- ]7 S
.text:24BC2E51 push edx
( t( g" L' X" G0 P8 Q! ?, u& T
.text:24BC2E52 push eax
; _5 v2 V& B/ v1 k% j. \; I
.text:24BC2E53 call dword ptr [ecx+18h]
|: U+ ?* t& i& ^% ?3 |* K9 k
.text:24BC2E56 test eax, eax
% K' q; q% h0 a' _- W6 U
.text:24BC2E58 jge short loc_24BC2E7A
, H: y1 D/ \# T% s K7 _& X
.text:24BC2E5A mov eax, [ebp+var_8]
+ a4 m4 D K; c/ y
.text:24BC2E5D push eax
; v) u. a5 A. w w2 G6 j, P
.text:24BC2E5E mov ecx, [eax]
; T% A5 \: Q+ M1 ~$ w
.text:24BC2E60 call dword ptr [ecx+8]
! i- U5 w* l" w$ X0 v
.text:24BC2E63 push [ebp+hLibModule] ; hLibModule
4 z& h: s5 z9 @
.text:24BC2E66 call esi ; FreeLibrary
9 I% t" G: z" O Y- q0 z# J
.text:24BC2E68 push offset aCouldnTCreates ; "Couldn't CreateSurface\r\n"
; V; O. J7 g, P
.text:24BC2E6D
: K# n$ n) u+ S! K+ m3 _
.text:24BC2E6D loc_24BC2E6D: ; CODE XREF: sub_24BC2CD2+38↑j
2 K2 o, n. i+ K8 C
.text:24BC2E6D ; sub_24BC2CD2+59↑j ...
* P2 D/ @* @# z9 | A1 O1 K
.text:24BC2E6D call ds:OutputDebugStringA
+ |- \* ~1 \7 a( \0 p
.text:24BC2E73 xor eax, eax
$ q9 c- z+ j r5 F: b. O
.text:24BC2E75 jmp loc_24BC3011
0 m/ G: v1 N4 k6 \
.text:24BC2E7A ; ---------------------------------------------------------------------------
复制代码
: F) {8 [! c* f7 O2 G
W) y r0 h# V) Y6 d# }$ s( v. ?6 r
( s2 X6 q% X* h9 a5 s: r
欢迎光临 冒险解谜游戏中文网 ChinaAVG (https://chinaavg.com/)
Powered by Discuz! X3.2