4 #define BINKMAJORVERSION 1
5 #define BINKMINORVERSION 9
6 #define BINKSUBVERSION 3
7 #define BINKVERSION "1.9c"
8 #define BINKDATE "2008-01-15"
18 typedef struct BINK PTR4
* HBINK
;
21 typedef S32 (RADLINK PTR4
* BINKIOOPEN
) (struct BINKIO PTR4
* Bnkio
, const char PTR4
*name
, U32 flags
);
22 typedef U32 (RADLINK PTR4
* BINKIOREADHEADER
) (struct BINKIO PTR4
* Bnkio
, S32 Offset
, void PTR4
* Dest
,U32 Size
);
23 typedef U32 (RADLINK PTR4
* BINKIOREADFRAME
) (struct BINKIO PTR4
* Bnkio
, U32 Framenum
,S32 origofs
,void PTR4
* dest
,U32 size
);
24 typedef U32 (RADLINK PTR4
* BINKIOGETBUFFERSIZE
)(struct BINKIO PTR4
* Bnkio
, U32 Size
);
25 typedef void (RADLINK PTR4
* BINKIOSETINFO
) (struct BINKIO PTR4
* Bnkio
, void PTR4
* Buf
,U32 Size
,U32 FileSize
,U32 simulate
);
26 typedef U32 (RADLINK PTR4
* BINKIOIDLE
) (struct BINKIO PTR4
* Bnkio
);
27 typedef void (RADLINK PTR4
* BINKIOCLOSE
) (struct BINKIO PTR4
* Bnkio
);
28 typedef S32 (RADLINK PTR4
* BINKIOBGCONTROL
) (struct BINKIO PTR4
* Bnkio
, U32 Control
);
30 typedef void (RADLINK PTR4
* BINKCBSUSPEND
) (struct BINKIO PTR4
* Bnkio
);
31 typedef S32 (RADLINK PTR4
* BINKCBTRYSUSPEND
) (struct BINKIO PTR4
* Bnkio
);
32 typedef void (RADLINK PTR4
* BINKCBRESUME
) (struct BINKIO PTR4
* Bnkio
);
33 typedef void (RADLINK PTR4
* BINKCBIDLE
) (struct BINKIO PTR4
* Bnkio
);
35 typedef struct BINKIO
{
36 BINKIOREADHEADER ReadHeader
;
37 BINKIOREADFRAME ReadFrame
;
38 BINKIOGETBUFFERSIZE GetBufferSize
;
39 BINKIOSETINFO SetInfo
;
42 BINKIOBGCONTROL BGControl
;
44 volatile U32 ReadError
;
45 volatile U32 DoingARead
;
46 volatile U32 BytesRead
;
48 volatile U32 TotalTime
;
49 volatile U32 ForegroundTime
;
50 volatile U32 IdleTime
;
51 volatile U32 ThreadTime
;
53 volatile U32 BufHighUsed
;
54 volatile U32 CurBufSize
;
55 volatile U32 CurBufUsed
;
56 volatile U32 Suspended
;
57 volatile U8 iodata
[128+32];
59 // filled in by the caller
60 BINKCBSUSPEND suspend_callback
;
61 BINKCBTRYSUSPEND try_suspend_callback
;
62 BINKCBRESUME resume_callback
;
63 BINKCBIDLE idle_on_callback
;
64 volatile U32 callback_control
[16]; // buffer for background IO callback
68 typedef S32 (RADLINK PTR4
* BINKSNDOPEN
) (struct BINKSND PTR4
* BnkSnd
, U32 freq
, S32 bits
, S32 chans
, U32 flags
, HBINK bink
);
69 typedef S32 (RADLINK PTR4
* BINKSNDREADY
) (struct BINKSND PTR4
* BnkSnd
);
70 typedef S32 (RADLINK PTR4
* BINKSNDLOCK
) (struct BINKSND PTR4
* BnkSnd
, U8 PTR4
* PTR4
* addr
, U32 PTR4
* len
);
71 typedef S32 (RADLINK PTR4
* BINKSNDUNLOCK
) (struct BINKSND PTR4
* BnkSnd
, U32 filled
);
72 typedef void (RADLINK PTR4
* BINKSNDVOLUME
) (struct BINKSND PTR4
* BnkSnd
, S32 volume
);
73 typedef void (RADLINK PTR4
* BINKSNDPAN
) (struct BINKSND PTR4
* BnkSnd
, S32 pan
);
74 typedef void (RADLINK PTR4
* BINKSNDMIXBINS
) (struct BINKSND PTR4
* BnkSnd
, U32 PTR4
* mix_bins
, U32 total
);
75 typedef void (RADLINK PTR4
* BINKSNDMIXBINVOLS
) (struct BINKSND PTR4
* BnkSnd
, U32 PTR4
* vol_mix_bins
, S32 PTR4
* volumes
, U32 total
);
76 typedef S32 (RADLINK PTR4
* BINKSNDONOFF
) (struct BINKSND PTR4
* BnkSnd
, S32 status
);
77 typedef S32 (RADLINK PTR4
* BINKSNDPAUSE
) (struct BINKSND PTR4
* BnkSnd
, S32 status
);
78 typedef void (RADLINK PTR4
* BINKSNDCLOSE
) (struct BINKSND PTR4
* BnkSnd
);
80 typedef BINKSNDOPEN (RADLINK PTR4
* BINKSNDSYSOPEN
) (UINTa param
);
82 typedef struct BINKSND
{
83 // for the spu, we *send* through sndreadpos, but we only return sndwritepos
84 U8 PTR4
* sndwritepos
; // current write position
88 U32 sndbufsize
; // sound buffer size
89 U8 PTR4
* sndbuf
; // sound buffer
90 U8 PTR4
* sndend
; // end of the sound buffer
91 UINTa sndcomp
; // sound compression handle
93 U8 PTR4
* sndreadpos
; // current read position (needs to be after the pad)
95 #if defined( BINK_SPU_PROCESS )
96 struct binksnd_hide
// put variables that we don't want to accidentally
97 { // use on the spu into a structure
111 U32 sndendframe
; // frame number that the sound ends on
113 U32 sndpad
; // padded this much audio
114 S32 sndprime
; // amount of data to prime the playahead
117 U32 sndconvert8
; // convert back to 8-bit sound at runtime
122 BINKSNDUNLOCK Unlock
;
123 BINKSNDVOLUME Volume
;
126 BINKSNDONOFF SetOnOff
;
128 BINKSNDMIXBINS MixBins
;
129 BINKSNDMIXBINVOLS MixBinVols
;
131 #if defined( BINK_SPU_PROCESS )
137 typedef struct BINKRECT
{
138 S32 Left
,Top
,Width
,Height
;
141 #define BINKMAXDIRTYRECTS 8
143 typedef struct BUNDLEPOINTERS
{
155 typedef struct BINKPLANE
162 typedef struct BINKFRAMEPLANESET
170 #define BINKMAXFRAMEBUFFERS 2
172 typedef struct BINKFRAMEBUFFERS
178 U32 cRcBBufferHeight
;
181 BINKFRAMEPLANESET Frames
[ BINKMAXFRAMEBUFFERS
];
184 typedef struct BINK
{
185 U32 Width
; // Width (1 based, 640 for example)
186 U32 Height
; // Height (1 based, 480 for example)
187 U32 Frames
; // Number of frames (1 based, 100 = 100 frames)
188 U32 FrameNum
; // Frame to *be* displayed (1 based)
189 U32 LastFrameNum
; // Last frame decompressed or skipped (1 based)
191 U32 FrameRate
; // Frame Rate Numerator
192 U32 FrameRateDiv
; // Frame Rate Divisor (frame rate=numerator/divisor)
194 U32 ReadError
; // Non-zero if a read error has ocurred
195 U32 OpenFlags
; // flags used on open
196 U32 BinkType
; // Bink flags
198 U32 Size
; // size of file
199 U32 FrameSize
; // The current frame's size in bytes
200 U32 SndSize
; // The current frame sound tracks' size in bytes
202 U32 FrameChangePercent
; // very rough percentage of the frame that changed
204 BINKRECT FrameRects
[BINKMAXDIRTYRECTS
];// Dirty rects from BinkGetRects
207 BINKFRAMEBUFFERS
* FrameBuffers
; // Bink frame buffers that we decompress to
209 void PTR4
* MaskPlane
; // pointer to the mask plane (Ywidth/16*Yheight/16)
210 U32 MaskPitch
; // Mask Pitch
211 U32 MaskLength
; // total length of the mask plane
212 void PTR4
* AsyncMaskPlane
; // pointer to the mask plane for async data
213 void PTR4
* InUseMaskPlane
; // pointer to the mask plane in use
214 void PTR4
* LastMaskPlane
; // pointer to the last mask plane
216 U32 LargestFrameSize
; // Largest frame size
217 U32 InternalFrames
; // how many frames were potentially compressed
219 S32 NumTracks
; // how many tracks
221 U32 Highest1SecRate
; // Highest 1 sec data rate
222 U32 Highest1SecFrame
; // Highest 1 sec data rate starting frame
224 S32 Paused
; // is the bink movie paused?
226 // everything below is for internal Bink use
228 S32 async_in_progress
[2]; // is an async decompression in progress
230 U32 soundon
; // sound turned on?
231 U32 videoon
; // video turned on?
233 void PTR4
* compframe
; // compressed frame data
234 U32 compframesize
; // compressed frame size
235 U32 compframeoffset
; // compressed frame offset
236 U32 compframekey
; // if this frame a key frame
238 U32 skippedlastblit
; // skipped last frame?
240 U32 playingtracks
; // how many tracks are playing
241 BINKSND PTR4
* bsnd
; // SND structures
242 S32 PTR4
* trackindexes
; // track indexes
244 BUNDLEPOINTERS bunp
; // pointers to internal temporary memory
246 U32 changepercent
; // how much roughly did the current frame change?
248 #if defined( BINK_SPU_PROCESS )
249 struct bink_hide
// put variables that we don't want to accidentally
250 { // use on the spu into a structure
253 void PTR4
* preloadptr
; // preloaded compressed frame data
254 U32
* frameoffsets
; // offsets of each of the frames
256 BINKIO bio
; // IO structure (should be the last element)
257 U8 PTR4
* ioptr
; // io buffer ptr
258 U32 iosize
; // io buffer size
259 U32 decompwidth
; // width not include scaling
260 U32 decompheight
; // height not include scaling
262 U32 PTR4
* tracksizes
; // largest single frame of track
263 U32 PTR4
* tracktypes
; // type of each sound track
264 S32 PTR4
* trackIDs
; // external track numbers
266 U32 numrects
; // number of rects from BinkGetRects
268 U32 playedframes
; // how many frames have we played
269 U32 firstframetime
; // very first frame start
270 U32 startblittime
; // start of blit period
271 U32 startsynctime
; // start of synched time
272 U32 startsyncframe
; // frame of startsynctime
273 U32 twoframestime
; // two frames worth of time
275 U32 slowestframetime
; // slowest frame in ms
276 U32 slowestframe
; // slowest frame number
277 U32 slowest2frametime
; // second slowest frame in ms
278 U32 slowest2frame
; // second slowest frame
280 U32 totalmem
; // total memory used
281 U32 timevdecomp
; // total time decompressing video
282 U32 timeadecomp
; // total time decompressing audio
283 U32 timeblit
; // total time blitting
284 U32 timeopen
; // total open time
286 U32 fileframerate
; // frame rate originally in the file
287 U32 fileframeratediv
;
289 U32 runtimeframes
; // max frames for runtime analysis
290 S32 rtindex
; // index of where we are in the runtime frames
291 U32 PTR4
* rtframetimes
; // start times for runtime frames
292 U32 PTR4
* rtadecomptimes
; // decompress times for runtime frames
293 U32 PTR4
* rtvdecomptimes
; // decompress times for runtime frames
294 U32 PTR4
* rtblittimes
; // blit times for runtime frames
295 U32 PTR4
* rtreadtimes
; // read times for runtime frames
296 U32 PTR4
* rtidlereadtimes
; // idle read times for runtime frames
297 U32 PTR4
* rtthreadreadtimes
;// thread read times for runtime frames
299 U32 lastblitflags
; // flags used on last blit
300 U32 lastdecompframe
; // last frame number decompressed
301 U32 lastfinisheddoframe
; // time that the last do frame finished
303 U32 lastresynctime
; // last loop point that we did a resync on
304 U32 doresync
; // should we do a resync in the next doframe?
306 U32 soundskips
; // number of sound stops
307 U32 skipped_status_this_frame
;//0=not checked this frame, 1=no skip, 2=skip
308 U32 very_delayed
; // is this frame more than 725 ms late?
309 U32 skippedblits
; // how many blits were skipped
311 U32 skipped_in_a_row
; // how many frames have we skipped in a row
312 U32 paused_sync_diff
; // sync delta at the time of a pause
313 U32 last_time_almost_empty
; // time of last almost empty IO buffer
314 U32 last_read_count
; // counter to keep track of the last bink IO
315 U32 last_sound_count
; // counter to keep track of the last bink sound
316 U32 snd_callback_buffer
[16]; // buffer for background sound callback
317 S32 allkeys
; // are all frames keyframes?
318 BINKFRAMEBUFFERS
* allocatedframebuffers
; // pointer to internally allocated buffers
320 #if defined( BINK_SPU_PROCESS )
326 typedef struct BINKSUMMARY
{
327 U32 Width
; // Width of frames
328 U32 Height
; // Height of frames
329 U32 TotalTime
; // total time (ms)
330 U32 FileFrameRate
; // frame rate
331 U32 FileFrameRateDiv
; // frame rate divisor
332 U32 FrameRate
; // frame rate
333 U32 FrameRateDiv
; // frame rate divisor
334 U32 TotalOpenTime
; // Time to open and prepare for decompression
335 U32 TotalFrames
; // Total Frames
336 U32 TotalPlayedFrames
; // Total Frames played
337 U32 SkippedFrames
; // Total number of skipped frames
338 U32 SkippedBlits
; // Total number of skipped blits
339 U32 SoundSkips
; // Total number of sound skips
340 U32 TotalBlitTime
; // Total time spent blitting
341 U32 TotalReadTime
; // Total time spent reading
342 U32 TotalVideoDecompTime
; // Total time spent decompressing video
343 U32 TotalAudioDecompTime
; // Total time spent decompressing audio
344 U32 TotalIdleReadTime
; // Total time spent reading while idle
345 U32 TotalBackReadTime
; // Total time spent reading in background
346 U32 TotalReadSpeed
; // Total io speed (bytes/second)
347 U32 SlowestFrameTime
; // Slowest single frame time (ms)
348 U32 Slowest2FrameTime
; // Second slowest single frame time (ms)
349 U32 SlowestFrameNum
; // Slowest single frame number
350 U32 Slowest2FrameNum
; // Second slowest single frame number
351 U32 AverageDataRate
; // Average data rate of the movie
352 U32 AverageFrameSize
; // Average size of the frame
353 U32 HighestMemAmount
; // Highest amount of memory allocated
354 U32 TotalIOMemory
; // Total extra memory allocated
355 U32 HighestIOUsed
; // Highest extra memory actually used
356 U32 Highest1SecRate
; // Highest 1 second rate
357 U32 Highest1SecFrame
; // Highest 1 second start frame
361 typedef struct BINKREALTIME
{
362 U32 FrameNum
; // Current frame number
363 U32 FrameRate
; // frame rate
364 U32 FrameRateDiv
; // frame rate divisor
365 U32 Frames
; // frames in this sample period
366 U32 FramesTime
; // time is ms for these frames
367 U32 FramesVideoDecompTime
; // time decompressing these frames
368 U32 FramesAudioDecompTime
; // time decompressing these frames
369 U32 FramesReadTime
; // time reading these frames
370 U32 FramesIdleReadTime
; // time reading these frames at idle
371 U32 FramesThreadReadTime
; // time reading these frames in background
372 U32 FramesBlitTime
; // time blitting these frames
373 U32 ReadBufferSize
; // size of read buffer
374 U32 ReadBufferUsed
; // amount of read buffer currently used
375 U32 FramesDataRate
; // data rate for these frames
378 #define BINKMARKER1 'fKIB'
379 #define BINKMARKER2 'gKIB' // new Bink files use this tag
380 #define BINKMARKER3 'hKIB' // newer Bink files use this tag
381 #define BINKMARKER4 'iKIB' // even newer Bink files use this tag
383 typedef struct BINKHDR
{
384 U32 Marker
; // Bink marker
385 U32 Size
; // size of the file-8
386 U32 Frames
; // Number of frames (1 based, 100 = 100 frames)
387 U32 LargestFrameSize
; // Size in bytes of largest frame
388 U32 InternalFrames
; // Number of internal frames
390 U32 Width
; // Width (1 based, 640 for example)
391 U32 Height
; // Height (1 based, 480 for example)
392 U32 FrameRate
; // frame rate
393 U32 FrameRateDiv
; // frame rate divisor (framerate/frameratediv=fps)
395 U32 Flags
; // height compression options
396 U32 NumTracks
; // number of tracks
400 //=======================================================================
401 #define BINKYAINVERT 0x00000800L // Reverse Y and A planes when blitting (for debugging)
402 #define BINKFRAMERATE 0x00001000L // Override fr (call BinkFrameRate first)
403 #define BINKPRELOADALL 0x00002000L // Preload the entire animation
404 #define BINKSNDTRACK 0x00004000L // Set the track number to play
405 #define BINKOLDFRAMEFORMAT 0x00008000L // using the old Bink frame format (internal use only)
406 #define BINKRBINVERT 0x00010000L // use reversed R and B planes (internal use only)
407 #define BINKGRAYSCALE 0x00020000L // Force Bink to use grayscale
408 //#define BINKNOMMX 0x00040000L // Don't use MMX
409 #define BINKNOSKIP 0x00080000L // Don't skip frames if falling behind
410 #define BINKALPHA 0x00100000L // Decompress alpha plane (if present)
411 #define BINKNOFILLIOBUF 0x00200000L // Don't Fill the IO buffer (in BinkOpen and BinkCopyTo)
412 #define BINKSIMULATE 0x00400000L // Simulate the speed (call BinkSim first)
413 #define BINKFILEHANDLE 0x00800000L // Use when passing in a file handle
414 #define BINKIOSIZE 0x01000000L // Set an io size (call BinkIOSize first)
415 #define BINKIOPROCESSOR 0x02000000L // Set an io processor (call BinkIO first)
416 #define BINKFROMMEMORY 0x04000000L // Use when passing in a pointer to the file
417 #define BINKNOTHREADEDIO 0x08000000L // Don't use a background thread for IO
418 #define BINKNOFRAMEBUFFERS 0x00000400L // Don't allocate internal frame buffers - application must call BinkRegisterFrameBuffers
419 #define BINKNOYPLANE 0x00000200L // Don't decompress the Y plane (internal flag)
420 #define BINKRUNNINGASYNC 0x00000100L // This frame is decompressing asynchronously
422 #define BINKSURFACEFAST 0x00000000L
423 #define BINKSURFACESLOW 0x08000000L
424 #define BINKSURFACEDIRECT 0x04000000L
426 #define BINKCOPYALL 0x80000000L // copy all pixels (not just changed)
427 #define BINKCOPY2XH 0x10000000L // Force doubling height scaling
428 #define BINKCOPY2XHI 0x20000000L // Force interleaving height scaling
429 #define BINKCOPY2XW 0x30000000L // copy the width zoomed by two
430 #define BINKCOPY2XWH 0x40000000L // copy the width and height zoomed by two
431 #define BINKCOPY2XWHI 0x50000000L // copy the width and height zoomed by two
432 #define BINKCOPY1XI 0x60000000L // copy the width and height zoomed by two
433 #define BINKCOPYNOSCALING 0x70000000L // Force scaling off
435 //#define BINKNOFILLIOBUF 0x00200000L // Don't Fill the IO buffer (in BinkOpen and BinkCopyTo)
436 //#define BINKALPHA 0x00100000L // Decompress alpha plane (if present)
437 //#define BINKNOSKIP 0x00080000L // don't skip the blit if behind in sound
438 //#define BINKNOMMX 0x00040000L // No MMX
439 //#define BINKGRAYSCALE 0x00020000L // force Bink to use grayscale
440 //#define BINKRBINVERT 0x00010000L // use reversed R and B planes
442 #define BINKSURFACEP8 0
443 #define BINKSURFACE24 1
444 #define BINKSURFACE24R 2
445 #define BINKSURFACE32 3
446 #define BINKSURFACE32R 4
447 #define BINKSURFACE32A 5
448 #define BINKSURFACE32RA 6
449 #define BINKSURFACE4444 7
450 #define BINKSURFACE5551 8
451 #define BINKSURFACE555 9
452 #define BINKSURFACE565 10
453 #define BINKSURFACE655 11
454 #define BINKSURFACE664 12
455 #define BINKSURFACEYUY2 13
456 #define BINKSURFACEUYVY 14
457 #define BINKSURFACEYV12 15
458 #define BINKSURFACEMASK 15
462 #define BINKSURFACESALL 32
463 #define BINKCONVERTERSMONO 64
464 #define BINKCONVERTERS2X 256
466 #define BINKCONVERTERSALL (BINKSURFACESALL|BINKCONVERTERSMONO|BINKCONVERTERS2X)
468 #define BinkLoad() BinkLoadUnload(1)
469 #define BinkUnload() BinkLoadUnload(0)
471 #define BinkLoadConverter(val) BinkLoadUnloadConverter(val,1)
472 #define BinkUnloadConverter(val) BinkLoadUnloadConverter(val,0)
474 RADEXPFUNC
void RADEXPLINK
BinkLoadUnload( S32 inout
);
475 RADEXPFUNC
void RADEXPLINK
BinkLoadUnloadConverter( U32 surfaces
, S32 inout
);
479 #define BINKGOTOQUICK 1
480 #define BINKGOTOQUICKSOUND 2
482 #define BINKGETKEYPREVIOUS 0
483 #define BINKGETKEYNEXT 1
484 #define BINKGETKEYCLOSEST 2
485 #define BINKGETKEYNOTEQUAL 128
487 //=======================================================================
491 #if !defined(__RADMACH__) && defined(__RADINDLL__)
495 RADEXPFUNC HBINK RADEXPLINK
BinkMacOpen(void /*FSSpec*/ * fsp
,U32 flags
);
499 RADEXPFUNC HBINK RADEXPLINK
BinkNDSOpen(void /*FSFileID*/ * fid
,U32 flags
);
502 RADEXPFUNC
void PTR4
* RADEXPLINK
BinkLogoAddress(void);
504 RADEXPFUNC
void RADEXPLINK
BinkSetError(const char PTR4
* err
);
505 RADEXPFUNC
char PTR4
* RADEXPLINK
BinkGetError(void);
507 RADEXPFUNC HBINK RADEXPLINK
BinkOpen(const char PTR4
* name
,U32 flags
);
509 RADEXPFUNC
void RADEXPLINK
BinkGetFrameBuffersInfo( HBINK bink
, BINKFRAMEBUFFERS
* fbset
);
510 RADEXPFUNC
void RADEXPLINK
BinkRegisterFrameBuffers( HBINK bink
, BINKFRAMEBUFFERS
* fbset
);
511 RADEXPFUNC S32 RADEXPLINK
BinkDoFrame(HBINK bnk
);
512 RADEXPFUNC
void RADEXPLINK
BinkNextFrame(HBINK bnk
);
513 RADEXPFUNC S32 RADEXPLINK
BinkWait(HBINK bnk
);
514 RADEXPFUNC
void RADEXPLINK
BinkClose(HBINK bnk
);
515 RADEXPFUNC S32 RADEXPLINK
BinkPause(HBINK bnk
,S32 pause
);
516 RADEXPFUNC S32 RADEXPLINK
BinkCopyToBuffer(HBINK bnk
,void* dest
,S32 destpitch
,U32 destheight
,U32 destx
,U32 desty
,U32 flags
);
517 RADEXPFUNC S32 RADEXPLINK
BinkCopyToBufferRect(HBINK bnk
,void* dest
,S32 destpitch
,U32 destheight
,U32 destx
,U32 desty
,U32 srcx
, U32 srcy
, U32 srcw
, U32 srch
, U32 flags
);
518 RADEXPFUNC S32 RADEXPLINK
BinkGetRects(HBINK bnk
,U32 flags
);
519 RADEXPFUNC
void RADEXPLINK
BinkGoto(HBINK bnk
,U32 frame
,S32 flags
); // use 1 for the first frame
520 RADEXPFUNC U32 RADEXPLINK
BinkGetKeyFrame(HBINK bnk
,U32 frame
,S32 flags
);
522 RADEXPFUNC S32 RADEXPLINK
BinkSetVideoOnOff(HBINK bnk
,S32 onoff
);
523 RADEXPFUNC S32 RADEXPLINK
BinkSetSoundOnOff(HBINK bnk
,S32 onoff
);
524 RADEXPFUNC
void RADEXPLINK
BinkSetVolume(HBINK bnk
, U32 trackid
, S32 volume
);
525 RADEXPFUNC
void RADEXPLINK
BinkSetPan(HBINK bnk
,U32 trackid
, S32 pan
);
526 RADEXPFUNC
void RADEXPLINK
BinkSetMixBins(HBINK bnk
,U32 trackid
, U32 PTR4
* mix_bins
, U32 total
);
527 RADEXPFUNC
void RADEXPLINK
BinkSetMixBinVolumes(HBINK bnk
,U32 trackid
, U32 PTR4
* vol_mix_bins
, S32 PTR4
* volumes
, U32 total
);
528 RADEXPFUNC
void RADEXPLINK
BinkService(HBINK bink
);
530 RADEXPFUNC S32 RADEXPLINK
BinkShouldSkip(HBINK bink
);
532 RADEXPFUNC
void RADEXPLINK
BinkGetPalette( void * out_pal
);
534 #define BINKBGIOSUSPEND 1
535 #define BINKBGIORESUME 2
536 #define BINKBGIOWAIT 0x80000000
538 RADEXPFUNC S32 RADEXPLINK
BinkControlBackgroundIO(HBINK bink
,U32 control
);
541 #if defined( __RADWIN__ ) || defined( __RADXENON__ ) || defined( __RADPS3__ )
543 RADEXPFUNC S32 RADEXPLINK
BinkStartAsyncThread( S32 thread_num
, void const * param
);
544 RADEXPFUNC S32 RADEXPLINK
BinkDoFrameAsync(HBINK bink
, U32 yplane_thread_num
, U32 other_work_thread_num
);
545 RADEXPFUNC S32 RADEXPLINK
BinkDoFrameAsyncWait(HBINK bink
, S32 us
);
546 RADEXPFUNC S32 RADEXPLINK
BinkRequestStopAsyncThread( S32 thread_num
);
547 RADEXPFUNC S32 RADEXPLINK
BinkWaitStopAsyncThread( S32 thread_num
);
552 typedef struct BINKTRACK PTR4
* HBINKTRACK
;
554 typedef struct BINKTRACK
567 RADEXPFUNC HBINKTRACK RADEXPLINK
BinkOpenTrack(HBINK bnk
,U32 trackindex
);
568 RADEXPFUNC
void RADEXPLINK
BinkCloseTrack(HBINKTRACK bnkt
);
569 RADEXPFUNC U32 RADEXPLINK
BinkGetTrackData(HBINKTRACK bnkt
,void PTR4
* dest
);
571 RADEXPFUNC U32 RADEXPLINK
BinkGetTrackType(HBINK bnk
,U32 trackindex
);
572 RADEXPFUNC U32 RADEXPLINK
BinkGetTrackMaxSize(HBINK bnk
,U32 trackindex
);
573 RADEXPFUNC U32 RADEXPLINK
BinkGetTrackID(HBINK bnk
,U32 trackindex
);
575 RADEXPFUNC
void RADEXPLINK
BinkGetSummary(HBINK bnk
,BINKSUMMARY PTR4
* sum
);
576 RADEXPFUNC
void RADEXPLINK
BinkGetRealtime(HBINK bink
,BINKREALTIME PTR4
* run
,U32 frames
);
578 RADEXPFUNC
void RADEXPLINK
BinkSetSoundTrack(U32 total_tracks
, U32 PTR4
* tracks
);
579 RADEXPFUNC
void RADEXPLINK
BinkSetIO(BINKIOOPEN io
);
580 RADEXPFUNC
void RADEXPLINK
BinkSetFrameRate(U32 forcerate
,U32 forceratediv
);
581 RADEXPFUNC
void RADEXPLINK
BinkSetSimulate(U32 sim
);
582 RADEXPFUNC
void RADEXPLINK
BinkSetIOSize(U32 iosize
);
584 RADEXPFUNC S32 RADEXPLINK
BinkSetSoundSystem(BINKSNDSYSOPEN open
, UINTa param
);
587 #define BINK_CPU_MMX 1
588 #define BINK_CPU_3DNOW 2
589 #define BINK_CPU_SSE 4
590 #define BINK_CPU_SSE2 8
591 #elif defined( __RADMAC__ )
592 #define BINK_CPU_ALTIVEC 1
595 RADEXPFUNC S32 RADEXPLINK
BinkControlPlatformFeatures( S32 use
, S32 dont_use
);
599 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenDirectSound(UINTa param
); // don't call directly
600 #define BinkSoundUseDirectSound(lpDS) BinkSetSoundSystem(BinkOpenDirectSound,(UINTa)lpDS)
602 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenWaveOut(UINTa param
); // don't call directly
603 #define BinkSoundUseWaveOut() BinkSetSoundSystem(BinkOpenWaveOut,0)
609 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenXAudio(UINTa param
); // don't call directly
610 #define BinkSoundUseXAudio() BinkSetSoundSystem(BinkOpenXAudio,0)
617 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenMiles(UINTa param
); // don't call directly
618 #define BinkSoundUseMiles(hdigdriver) BinkSetSoundSystem(BinkOpenMiles,(UINTa)hdigdriver)
625 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenSoundManager(UINTa param
); // don't call directly
626 #define BinkSoundUseSoundManager() BinkSetSoundSystem(BinkOpenSoundManager,0)
632 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenSDLMixer(UINTa param
); // don't call directly
633 #define BinkSoundUseSDLMixer() BinkSetSoundSystem(BinkOpenSDLMixer,0)
637 #if defined( __RADNGC__ ) || defined( __RADWII__ )
639 typedef void PTR4
* (RADLINK PTR4
* RADARAMALLOC
) ( U32 num_bytes
);
640 typedef void (RADLINK PTR4
* RADARAMFREE
) ( void PTR4
* ptr
);
642 typedef struct RADARAMCALLBACKS
644 RADARAMALLOC aram_malloc
;
645 RADARAMFREE aram_free
;
648 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenAX(U32 param
); // don't call directly
649 #define BinkSoundUseAX( functions ) BinkSetSoundSystem(BinkOpenAX,(U32)functions) // takes a pointer to RADARAMCALLBACKS
651 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenMusyXSound(U32 param
); // don't call directly
652 #define BinkSoundUseMusyX( ) BinkSetSoundSystem(BinkOpenMusyXSound,0)
658 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenRAD_IOP(U32 param
); // don't call directly
659 #define BinkSoundUseRAD_IOP( which_sound_core ) BinkSetSoundSystem(BinkOpenRAD_IOP,which_sound_core)
665 RADEXPFUNC
void RADEXPLINK
BinkFreeGlobals( void );
667 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenLibAudio( U32 param
);
668 #define BinkSoundUseLibAudio( number_of_speakers ) BinkSetSoundSystem( BinkOpenLibAudio, number_of_speakers )
674 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenPSPSound( U32 param
);
675 #define BinkSoundUsePSPSound( which_pcm_channel ) BinkSetSoundSystem( BinkOpenPSPSound, ((U32)(S32)which_pcm_channel) )
681 RADEXPFUNC BINKSNDOPEN RADEXPLINK
BinkOpenNDSSound(U32 param
); // don't call directly
682 #define BinkSoundUseNDSSound( param ) BinkSetSoundSystem(BinkOpenNDSSound, param)
684 // Packs channel bitmask into loword and alarm bitmask into lobyte of hiword
685 #define BINK_PACK_CHANNEL( ch ) ((U32)(1 << ((ch) & 0xFFFF)))
686 #define BINK_PACK_ALARM( al ) ((U32)(1 << (16 + ((al) & 0xFF))))
690 #if defined(__RADXBOX__) || defined(__RADWIN__)
692 RADEXPFUNC S32 RADEXPLINK
BinkDX8SurfaceType(void* lpD3Ds
);
696 #if defined(__RADXENON__) || defined(__RADWIN__)
698 RADEXPFUNC S32 RADEXPLINK
BinkDX9SurfaceType(void* lpD3Ds
);
703 // The BinkBuffer API isn't implemented on DOS, or any of the consoles
704 #if !defined(__RADDOS__) && !defined(__RADXBOX__) && !defined(__RADNGC__) && !defined(__RADNDS__)
706 //=========================================================================
707 typedef struct BINKBUFFER
* HBINKBUFFER
;
709 #define BINKBUFFERSTRETCHXINT 0x80000000
710 #define BINKBUFFERSTRETCHX 0x40000000
711 #define BINKBUFFERSHRINKXINT 0x20000000
712 #define BINKBUFFERSHRINKX 0x10000000
713 #define BINKBUFFERSTRETCHYINT 0x08000000
714 #define BINKBUFFERSTRETCHY 0x04000000
715 #define BINKBUFFERSHRINKYINT 0x02000000
716 #define BINKBUFFERSHRINKY 0x01000000
717 #define BINKBUFFERSCALES 0xff000000
718 #define BINKBUFFERRESOLUTION 0x00800000
722 //#include <windows.h>
723 //#include <palettes.h>
724 //#include <qdoffscreen.h>
726 typedef struct BINKBUFFER
{
751 #define BINKBUFFERAUTO 0
752 #define BINKBUFFERDIRECT 1
753 #define BINKBUFFERGWORLD 2
754 #define BINKBUFFERTYPEMASK 31
756 RADEXPFUNC HBINKBUFFER RADEXPLINK
BinkBufferOpen( void* /*WindowPtr*/ wnd
, U32 width
, U32 height
, U32 bufferflags
);
757 RADEXPFUNC S32 RADEXPLINK
BinkGDSurfaceType( void* /*GDHandle*/ gd
);
758 RADEXPFUNC S32 RADEXPLINK
BinkIsSoftwareCursor(void* /*GDHandle*/ gd
);
759 RADEXPFUNC S32 RADEXPLINK
BinkCheckCursor(void* /*WindowPtr*/ wp
,S32 x
,S32 y
,S32 w
,S32 h
);
763 typedef struct BINKBUFFER
{
776 U32 ExtraWindowWidth
;
777 U32 ExtraWindowHeight
;
812 #define BINKBUFFERAUTO 0
813 #define BINKBUFFERPRIMARY 1
814 #define BINKBUFFERDIBSECTION 2
815 #define BINKBUFFERYV12OVERLAY 3
816 #define BINKBUFFERYUY2OVERLAY 4
817 #define BINKBUFFERUYVYOVERLAY 5
818 #define BINKBUFFERYV12OFFSCREEN 6
819 #define BINKBUFFERYUY2OFFSCREEN 7
820 #define BINKBUFFERUYVYOFFSCREEN 8
821 #define BINKBUFFERRGBOFFSCREENVIDEO 9
822 #define BINKBUFFERRGBOFFSCREENSYSTEM 10
823 #define BINKBUFFERLAST 10
824 #define BINKBUFFERTYPEMASK 31
826 RADEXPFUNC HBINKBUFFER RADEXPLINK
BinkBufferOpen( void* /*HWND*/ wnd
, U32 width
, U32 height
, U32 bufferflags
);
827 RADEXPFUNC S32 RADEXPLINK
BinkBufferSetHWND( HBINKBUFFER buf
, void* /*HWND*/ newwnd
);
828 RADEXPFUNC S32 RADEXPLINK
BinkDDSurfaceType(void PTR4
* lpDDS
);
829 RADEXPFUNC S32 RADEXPLINK
BinkIsSoftwareCursor(void PTR4
* lpDDSP
, void* /*HCURSOR*/ cur
);
830 RADEXPFUNC S32 RADEXPLINK
BinkCheckCursor(void* /*HWND*/ wnd
,S32 x
,S32 y
,S32 w
,S32 h
);
831 RADEXPFUNC S32 RADEXPLINK
BinkBufferSetDirectDraw(void PTR4
* lpDirectDraw
, void PTR4
* lpPrimary
);
835 RADEXPFUNC
void RADEXPLINK
BinkBufferClose( HBINKBUFFER buf
);
836 RADEXPFUNC S32 RADEXPLINK
BinkBufferLock( HBINKBUFFER buf
);
837 RADEXPFUNC S32 RADEXPLINK
BinkBufferUnlock( HBINKBUFFER buf
);
838 RADEXPFUNC
void RADEXPLINK
BinkBufferSetResolution( S32 w
, S32 h
, S32 bits
);
839 RADEXPFUNC
void RADEXPLINK
BinkBufferCheckWinPos( HBINKBUFFER buf
, S32 PTR4
* NewWindowX
, S32 PTR4
* NewWindowY
);
840 RADEXPFUNC S32 RADEXPLINK
BinkBufferSetOffset( HBINKBUFFER buf
, S32 destx
, S32 desty
);
841 RADEXPFUNC
void RADEXPLINK
BinkBufferBlit( HBINKBUFFER buf
, BINKRECT PTR4
* rects
, U32 numrects
);
842 RADEXPFUNC S32 RADEXPLINK
BinkBufferSetScale( HBINKBUFFER buf
, U32 w
, U32 h
);
843 RADEXPFUNC
char PTR4
* RADEXPLINK
BinkBufferGetDescription( HBINKBUFFER buf
);
844 RADEXPFUNC
char PTR4
* RADEXPLINK
BinkBufferGetError();
845 RADEXPFUNC
void RADEXPLINK
BinkRestoreCursor(S32 checkcount
);
846 RADEXPFUNC S32 RADEXPLINK
BinkBufferClear(HBINKBUFFER buf
, U32 RGB
);
850 typedef void PTR4
* (RADLINK PTR4
* BINKMEMALLOC
) (U32 bytes
);
851 typedef void (RADLINK PTR4
* BINKMEMFREE
) (void PTR4
* ptr
);
853 RADEXPFUNC
void RADEXPLINK
BinkSetMemory(BINKMEMALLOC a
,BINKMEMFREE f
);
857 #if !defined(__RADMACH__) && defined(__RADINDLL__)
867 // @cdep pre $set(INCs,$INCs -I$clipfilename($file)) $ignore(TakeCPP)