Mercurial > mm7
annotate Bink_Smacker.cpp @ 2461:ff7f4995aa25
function MakeScreenshot()
author | Ritor1 |
---|---|
date | Tue, 05 Aug 2014 17:00:35 +0600 |
parents | f4af3b203f65 |
children |
rev | line source |
---|---|
2415 | 1 #define _CRTDBG_MAP_ALLOC |
2 #include <stdlib.h> | |
3 #include <crtdbg.h> | |
4 | |
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2125
diff
changeset
|
5 #define _CRT_SECURE_NO_WARNINGS |
0 | 6 #include "Bink_Smacker.h" |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 int (__stdcall *smackw32_SmackSoundUseMSS)(HDIGDRIVER) = 0; | |
15 unsigned int (__stdcall *smackw32_SmackUseMMX)(unsigned int) = 0; | |
16 HSMACK (__stdcall *smackw32_SmackOpen)(HANDLE, unsigned int, unsigned int) = 0; | |
17 HSMACKBLIT (__stdcall *smackw32_SmackBlitOpen)(unsigned int) = 0; | |
18 void (__stdcall *smackw32_SmackToBuffer)(HSMACK, unsigned int, unsigned int, unsigned int, unsigned int, void *, unsigned int) = 0; | |
19 void (__stdcall *smackw32_SmackBlitSetPalette)(HSMACKBLIT, void *, unsigned int) = 0; | |
20 unsigned int (__stdcall *smackw32_SmackDoFrame)(HSMACK) = 0; | |
21 unsigned int (__stdcall *smackw32_SmackToBufferRect)(HSMACK, unsigned int) = 0; | |
22 void (__stdcall *smackw32_SmackBlit)(HSMACKBLIT, void *, unsigned int, unsigned int, unsigned int, void *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) = 0; | |
23 void (__stdcall *smackw32_SmackNextFrame)(HSMACK) = 0; | |
24 unsigned int (__stdcall *smackw32_SmackWait)(HSMACK) = 0; | |
25 unsigned int (__stdcall *smackw32_SmackSoundOnOff)(HSMACK, unsigned int) = 0; | |
26 void (__stdcall *smackw32_SmackClose)(HSMACK) = 0; | |
27 void (__stdcall *smackw32_SmackBufferClose)(HSMACKBUF) = 0; | |
28 void (__stdcall *smackw32_SmackBlitClose)(HSMACKBLIT) = 0; | |
29 int (__stdcall *smackw32_SmackBlitClear)(HSMACKBLIT, unsigned short *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, int) = 0; | |
30 int (__stdcall *smackw32_SmackGoto)(_SMACK *, long) = 0; | |
343 | 31 int (__stdcall *smackw32_SmackBufferOpen)(HWND a1, long a2, long a3, long a4, long a5, long a6) = nullptr; |
2125 | 32 void(__stdcall *smackw32_SmackBufferNewPalette)(HSMACKBUF, void *, unsigned int) = nullptr; |
33 void(__stdcall *smackw32_SmackColorRemapWithTrans)(_SMACK *, void *, unsigned int, unsigned int, unsigned int) = nullptr; | |
0 | 34 void SMACKW32_DLL_Initialize() |
35 { | |
2070 | 36 HMODULE pDll = LoadLibraryW(L"SmackW32.dll"); |
37 | |
38 #define LOAD(x) smackw32_##x = (decltype(smackw32_##x))GetProcAddress(pDll, #x) | |
39 { | |
40 smackw32_SmackSoundUseMSS = (int (__stdcall *)(HDIGDRIVER))GetProcAddress(pDll, "_SmackSoundUseMSS@4"); | |
41 smackw32_SmackUseMMX = (unsigned int (__stdcall *)(unsigned int))GetProcAddress(pDll, "_SmackUseMMX@4"); | |
42 smackw32_SmackOpen = (HSMACK (__stdcall *)(HANDLE, unsigned int, unsigned int))GetProcAddress(pDll, "_SmackOpen@12"); | |
43 smackw32_SmackBlitOpen = (HSMACKBLIT (__stdcall *)(unsigned int))GetProcAddress(pDll, "_SmackBlitOpen@4"); | |
44 smackw32_SmackToBuffer = (void (__stdcall *)(HSMACK, unsigned int, unsigned int, unsigned int, unsigned int, void *, unsigned int))GetProcAddress(pDll, "_SmackToBuffer@28"); | |
45 smackw32_SmackBlitSetPalette = (void (__stdcall *)(HSMACKBLIT, void *, unsigned int))GetProcAddress(pDll, "_SmackBlitSetPalette@12"); | |
46 smackw32_SmackDoFrame = (unsigned int (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackDoFrame@4"); | |
47 smackw32_SmackToBufferRect = (unsigned int (__stdcall *)(HSMACK, unsigned int))GetProcAddress(pDll, "_SmackToBufferRect@8"); | |
48 smackw32_SmackBlit = (void (__stdcall *)(HSMACKBLIT, void *, unsigned int, unsigned int, unsigned int, void *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int))GetProcAddress(pDll, "_SmackBlit@44"); | |
49 smackw32_SmackNextFrame = (void (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackNextFrame@4"); | |
50 smackw32_SmackWait = (unsigned int (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackWait@4"); | |
51 smackw32_SmackSoundOnOff = (unsigned int (__stdcall *)(HSMACK, unsigned int))GetProcAddress(pDll, "_SmackSoundOnOff@8"); | |
52 smackw32_SmackClose = (void (__stdcall *)(HSMACK))GetProcAddress(pDll, "_SmackClose@4"); | |
53 smackw32_SmackBufferClose = (void (__stdcall *)(HSMACKBUF))GetProcAddress(pDll, "_SmackBufferClose@4"); | |
54 smackw32_SmackBlitClose = (void (__stdcall *)(HSMACKBLIT))GetProcAddress(pDll, "_SmackBlitClose@4"); | |
55 smackw32_SmackBlitClear = (int (__stdcall *)(HSMACKBLIT, unsigned short *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, int))GetProcAddress(pDll, "_SmackBlitClear@32"); | |
56 smackw32_SmackGoto = (int (__stdcall *)(_SMACK *, long))GetProcAddress(pDll, "_SmackGoto@8"); | |
57 smackw32_SmackBufferOpen = (int (__stdcall *)(HWND, long, long, long, long, long))GetProcAddress(pDll, "_SmackBufferOpen@24"); | |
2125 | 58 smackw32_SmackBufferNewPalette = (void(__stdcall *)(HSMACKBUF, void *, unsigned int))GetProcAddress(pDll, "_SmackBufferNewPalette@12"); |
59 smackw32_SmackColorRemapWithTrans = (void(__stdcall *)(_SMACK *, void *, unsigned int, unsigned int, unsigned int))GetProcAddress(pDll, "_SmackColorRemapWithTrans@20"); | |
60 //LOAD(SmackBufferNewPalette); | |
61 //LOAD(SmackColorRemapWithTrans); | |
2070 | 62 } |
0 | 63 } |
64 | |
65 | |
66 | |
67 | |
2125 | 68 void __stdcall SmackColorRemapWithTrans(_SMACK *a1, void *a2, unsigned int a3, unsigned int a4, unsigned int a5) |
2070 | 69 { |
70 return (smackw32_SmackColorRemapWithTrans)(a1, a2, a3, a4, a5); | |
71 } | |
0 | 72 |
73 void __stdcall SmackBlitClose(HSMACKBLIT hBlit) | |
74 { | |
75 (smackw32_SmackBlitClose)(hBlit); | |
76 } | |
77 | |
78 void __stdcall SmackBufferClose(HSMACKBUF hBuf) | |
79 { | |
80 (smackw32_SmackBufferClose)(hBuf); | |
81 } | |
82 | |
83 void __stdcall SmackClose(HSMACK hSmack) | |
84 { | |
85 (smackw32_SmackClose)(hSmack); | |
86 } | |
87 | |
88 unsigned int __stdcall SmackSoundOnOff(HSMACK hSmack, unsigned int bOn) | |
89 { | |
90 return (smackw32_SmackSoundOnOff)(hSmack, bOn); | |
91 } | |
92 | |
93 unsigned int __stdcall SmackWait(HSMACK hSmack) | |
94 { | |
95 return (smackw32_SmackWait)(hSmack); | |
96 } | |
97 | |
98 void __stdcall SmackNextFrame(HSMACK hSmack) | |
99 { | |
100 (smackw32_SmackNextFrame)(hSmack); | |
101 } | |
102 | |
103 void __stdcall SmackBlit(HSMACKBLIT hBlit, void *pDest, unsigned int uDestPitch, unsigned int uDestX, unsigned int uDestY, void *pSrc, unsigned int uSrcPitch, unsigned int uSrcX, unsigned int uSrcY, unsigned int uSrcZ, unsigned int uSrcW) | |
104 { | |
105 (smackw32_SmackBlit)(hBlit, pDest, uDestPitch, uDestX, uDestY, pSrc, uSrcPitch, uSrcX, uSrcY, uSrcZ, uSrcW); | |
106 } | |
107 | |
108 unsigned int __stdcall SmackToBufferRect(HSMACK hSmack, unsigned int uSmackSurface) | |
109 { | |
110 return (smackw32_SmackToBufferRect)(hSmack, uSmackSurface); | |
111 } | |
112 | |
113 unsigned int __stdcall SmackDoFrame(HSMACK hSmack) | |
114 { | |
115 return (smackw32_SmackDoFrame)(hSmack); | |
116 } | |
117 | |
118 void __stdcall SmackBlitSetPalette(HSMACKBLIT hBlit, void *pPalette, unsigned int uPalType) | |
119 { | |
120 (smackw32_SmackBlitSetPalette)(hBlit, pPalette, uPalType); | |
121 } | |
122 | |
123 int __stdcall SmackSoundUseMSS(HDIGDRIVER hDrv) | |
124 { | |
125 return (smackw32_SmackSoundUseMSS)(hDrv); | |
126 } | |
127 | |
128 unsigned int __stdcall SmackUseMMX(unsigned int flag) | |
129 { | |
130 return (smackw32_SmackUseMMX)(flag); | |
131 } | |
132 | |
133 HSMACK __stdcall SmackOpen(HANDLE hSourceFile, unsigned int uFlags, unsigned int uExtraBuffers) | |
134 { | |
135 return (smackw32_SmackOpen)(hSourceFile, uFlags, uExtraBuffers); | |
136 } | |
137 | |
138 HSMACKBLIT __stdcall SmackBlitOpen(unsigned int uSurfaceFormat) | |
139 { | |
140 return (smackw32_SmackBlitOpen)(uSurfaceFormat); | |
141 } | |
142 | |
143 void __stdcall SmackToBuffer(HSMACK hSmack, unsigned int uX, unsigned int uY, unsigned int uPitch, unsigned int uHeight, void *pBuffer, unsigned int uFlags) | |
144 { | |
145 (smackw32_SmackToBuffer)(hSmack, uX, uY, uPitch, uHeight, pBuffer, uFlags); | |
146 } | |
147 | |
148 int __stdcall SmackBlitClear(HSMACKBLIT a1, unsigned short *pFrameData, unsigned int uTargetSurfacePitch, unsigned int uOutX, unsigned int uOutY, unsigned int uOutZ, unsigned int uOutW, int a8) | |
149 { | |
150 return (smackw32_SmackBlitClear)(a1, pFrameData, uTargetSurfacePitch, uOutX, uOutY, uOutZ, uOutW, a8); | |
151 } | |
152 | |
153 int __stdcall SmackGoto(_SMACK *a1, long a2) | |
154 { | |
155 return (smackw32_SmackGoto)(a1, a2); | |
156 } | |
157 | |
158 | |
159 int __stdcall SmackBufferOpen(HWND a1, long a2, long a3, long a4, long a5, long a6) | |
160 { | |
343 | 161 return (smackw32_SmackBufferOpen)(a1, a2, a3, a4, a5, a6); |
0 | 162 } |
163 | |
347 | 164 int __fastcall SmackVolumePan(_SMACK *a3, long a4, long a5, long a6) |
0 | 165 { |
356 | 166 //__asm int 3 |
0 | 167 return 0; |
168 } | |
169 | |
170 | |
171 // sub_4D83D0: using guessed type int __stdcall SmackBufferNewPalette(_DWORD, _DWORD, _DWORD); | |
2125 | 172 void __stdcall SmackBufferNewPalette(HSMACKBUF a1, void *a2, unsigned int a3) |
0 | 173 { |
2125 | 174 (smackw32_SmackBufferNewPalette)(a1, a2, a3); |
0 | 175 } |
176 | |
177 | |
178 | |
179 | |
180 | |
181 | |
182 | |
183 | |
184 | |
185 | |
186 | |
187 | |
188 | |
189 | |
190 | |
191 | |
192 | |
193 | |
194 | |
195 | |
196 | |
197 | |
198 | |
199 | |
200 | |
201 | |
202 | |
203 | |
204 | |
205 | |
206 | |
207 int (__stdcall *binkw32_BinkDDSurfaceType)(struct IDirectDrawSurface *) = 0; | |
208 int (__stdcall *binkw32_BinkSetSoundSystem)(void *, HDIGDRIVER) = 0; | |
209 int (__stdcall *binkw32_BinkOpenMiles)(int) = 0; | |
210 HBINK (__stdcall *binkw32_BinkOpen)(void *, unsigned int) = 0; | |
211 int (__stdcall *binkw32_BinkWait)(HBINK) = 0; | |
212 int (__stdcall *binkw32_BinkDoFrame)(HBINK) = 0; | |
213 int (__stdcall *binkw32_BinkNextFrame)(HBINK) = 0; | |
214 int (__stdcall *binkw32_BinkGetRects)(HBINK, unsigned int) = 0; | |
215 int (__stdcall *binkw32_BinkCopyToBuffer)(HBINK, void *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) = 0; | |
216 int (__stdcall *binkw32_BinkPause)(HBINK, int) = 0; | |
217 int (__stdcall *binkw32_BinkClose)(HBINK) = 0; | |
218 int (__stdcall *binkw32_BinkBufferSetOffset)(void *, int, int) = 0; | |
219 int (__stdcall *binkw32_BinkBufferSetScale)(void *, unsigned int, unsigned int) = 0; | |
220 void BINKW32_DLL_Initialize() | |
221 { | |
222 HMODULE pDll = LoadLibraryW(L"BinkW32.dll"); | |
223 | |
224 binkw32_BinkDDSurfaceType = (int (__stdcall *)(struct IDirectDrawSurface *))GetProcAddress(pDll, "_BinkDDSurfaceType@4"); | |
225 binkw32_BinkSetSoundSystem = (int (__stdcall *)(void *, HDIGDRIVER))GetProcAddress(pDll, "_BinkSetSoundSystem@8"); | |
226 binkw32_BinkOpenMiles = (int (__stdcall *)(int))GetProcAddress(pDll, "_BinkOpenMiles@4"); | |
227 binkw32_BinkOpen = (HBINK (__stdcall *)(void *, unsigned int))GetProcAddress(pDll, "_BinkOpen@8"); | |
228 binkw32_BinkWait = (int (__stdcall *)(HBINK))GetProcAddress(pDll, "_BinkWait@4"); | |
229 binkw32_BinkBufferSetOffset = (int (__stdcall *)(void *, int, int))GetProcAddress(pDll, "_BinkBufferSetOffset@12"); | |
230 binkw32_BinkBufferSetScale = (int (__stdcall *)(void *, unsigned int, unsigned int))GetProcAddress(pDll, "_BinkBufferSetScale@12"); | |
231 binkw32_BinkDoFrame = (int (__stdcall *)(HBINK))GetProcAddress(pDll, "_BinkDoFrame@4"); | |
232 binkw32_BinkNextFrame = (int (__stdcall *)(HBINK))GetProcAddress(pDll, "_BinkNextFrame@4"); | |
233 binkw32_BinkGetRects = (int (__stdcall *)(HBINK, unsigned int))GetProcAddress(pDll, "_BinkGetRects@8"); | |
234 binkw32_BinkCopyToBuffer = (int (__stdcall *)(HBINK, void *, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int))GetProcAddress(pDll, "_BinkCopyToBuffer@28"); | |
235 binkw32_BinkPause = (int (__stdcall *)(HBINK, int))GetProcAddress(pDll, "_BinkPause@8"); | |
236 binkw32_BinkClose = (int (__stdcall *)(HBINK))GetProcAddress(pDll, "_BinkClose@4"); | |
237 } | |
238 | |
239 | |
240 int __stdcall BinkPause(HBINK hBink, int bPause) | |
241 { | |
242 return (binkw32_BinkPause)(hBink, bPause); | |
243 } | |
244 | |
245 int __stdcall BinkClose(HBINK hBink) | |
246 { | |
247 return (binkw32_BinkClose)(hBink); | |
248 } | |
249 | |
250 int __stdcall BinkGetRects(HBINK hBink, unsigned int uFlags) | |
251 { | |
252 return (binkw32_BinkGetRects)(hBink, uFlags); | |
253 } | |
254 | |
255 int __stdcall BinkCopyToBuffer(HBINK hBink, void *pBuffer, unsigned int lPitch, unsigned int uNumScanlines, unsigned int uX, unsigned int uY, unsigned int uFlags) | |
256 { | |
257 return (binkw32_BinkCopyToBuffer)(hBink, pBuffer, lPitch, uNumScanlines, uX, uY, uFlags); | |
258 } | |
259 | |
260 int __stdcall BinkDoFrame(HBINK hBink) | |
261 { | |
262 return (binkw32_BinkDoFrame)(hBink); | |
263 } | |
264 | |
265 int __stdcall BinkNextFrame(HBINK hBink) | |
266 { | |
267 return (binkw32_BinkNextFrame)(hBink); | |
268 } | |
269 | |
270 HBINK __stdcall BinkOpen(void *hFileHandle, unsigned int uFlags) | |
271 { | |
272 return (binkw32_BinkOpen)(hFileHandle, uFlags); | |
273 } | |
274 | |
275 int __stdcall BinkOpenMiles(int unk) | |
276 { | |
277 return (binkw32_BinkOpenMiles)(unk); | |
278 } | |
279 | |
280 int __stdcall BinkWait(HBINK hBink) | |
281 { | |
282 return (binkw32_BinkWait)(hBink); | |
283 } | |
284 | |
285 | |
286 | |
287 int __stdcall BinkBufferSetOffset(void *pStruct, int b, int c) | |
288 { | |
289 return (binkw32_BinkBufferSetOffset)(pStruct, b, c); | |
290 } | |
291 | |
292 int __stdcall BinkBufferSetScale(void *pStruct, unsigned int uWidth, unsigned int uHeight) | |
293 { | |
294 return (binkw32_BinkBufferSetScale)(pStruct, uWidth, uHeight); | |
295 } | |
296 | |
297 int __stdcall BinkDDSurfaceType(struct IDirectDrawSurface *pDDS) | |
298 { | |
299 return (binkw32_BinkDDSurfaceType)(pDDS); | |
300 } | |
301 | |
302 int __stdcall BinkSetSoundSystem(void *pSoundSystem, HDIGDRIVER hDrv) | |
303 { | |
304 return (binkw32_BinkSetSoundSystem)(pSoundSystem, hDrv); | |
305 } | |
306 | |
307 | |
308 | |
309 | |
310 | |
311 | |
312 int __stdcall BinkGoto(_BINK *a1, long a2, long a3) | |
313 { | |
314 __asm int 3 | |
315 return 0; | |
316 } | |
317 | |
318 | |
319 | |
320 | |
321 | |
322 | |
323 | |
324 | |
325 | |
326 | |
327 | |
328 | |
329 | |
330 | |
331 | |
332 | |
333 | |
334 | |
335 | |
336 |