-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbik_internal.hpp
More file actions
192 lines (142 loc) · 5.53 KB
/
Copy pathbik_internal.hpp
File metadata and controls
192 lines (142 loc) · 5.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
#ifndef _BIK_INTERNAL_HPP_
#define _BIK_INTERNAL_HPP_
#include "bik_common.hpp"
#include "bik_public.hpp"
#include "bik_subtitle.hpp"
//////////////////////////////////////////////////////////////////////////
#include <stdio.h>
//////////////////////////////////////////////////////////////////////////
namespace Bik
{
namespace Internal
{
struct FrameBuffer
{
BinkHandle binkHandle;
Int32u surfaceType;
Int32u pixelSize; // size of one pixel in bytes
Int32u pitch; // number of bytes required for one line
#if defined(CMF_PLATFORM_WIN32)
HWND hWindow;
WINDOWINFO wiWindow;
WNDCLASSEXA wcWindow;
CHAR szWindowClass[64];
#endif // CMF_PLATFORM_WIN32
Graphics::Canvas canvas;
};
struct LocalData
{
BinkHandle binkHandle;
Int32u storageIndex;
Char fileName[1024];
Int32u currentTrack; // Index of current audio track playing
Bool updateBuffer; // Determines if we need to update frame buffer (i.e. BinkDoFrame was called).
FrameBuffer frameBuffer;
SubtitleFile* subtitleList; // one for every track
Bool useBinkFramebuffers;
BinkFramebuffers binkFramebuffers;
};
static const Int32u TRACK_STATE_CAPACITY = 32;
typedef Bool TrackState[TRACK_STATE_CAPACITY];
struct BinkLibrary
{
Int32u version;
Int32u versionMajor, versionMinor, versionMicro;
TrackState trackState;
#if defined(CMF_PLATFORM_WIN32)
HMODULE hBikModLibrary;
HMODULE hBinkLibrary;
#endif // CMF_PLATFORM_WIN32
};
struct GlobalConfig
{
Bool showFps;
const Char* timeFormat;
const Char* homepageUrl;
Bool versionCheck;
const Char* versionUrl;
Bool versionRandom;
Bool logEnabled;
Bool logCallEnabled;
Bool logErrorEnabled;
Bool logDebugEnabled;
Bool clusteredLog;
FILE* logFile;
const Char* logFilePath;
Bool disableBink;
Bool checkAfterCall;
const Char* libraryFilePath;
Bool binkFindWindow;
Bool showSubtitles;
Bool subtitleDebug;
CStringList subtitleExt;
CStringList subtitlePath;
Int32u subtitlePlacementX, subtitlePlacementY;
Int32u subtitleAlignmentX, subtitleAlignmentY;
const Char* subtitleLanguage;
Bool subtitlePanelEnabled;
Color subtitlePanelColor;
Int32u subtitlePanelHeight;
const Char* fontFamily;
Int32s fontSize, fontWeight;
Color fontForeColor;
Bool fontItalic, fontUnderline, fontStrikeOut;
Int32u fontOutlineSize;
Color fontOutlineColor;
Bool fontRightToLeft;
Bool videoDebug;
Bool videoForcePosition, videoForceResolution, videoForceFullscreen;
Int32u videoForceX, videoForceY, videoForceWidth, videoForceHeight;
Int32u videoRescaleFilter;
};
//////////////////////////////////////////////////////////////////////////
Bool initLibrary();
Bool closeLibrary();
BinkLibrary& getLibrary();
GlobalConfig& getConfig();
//////////////////////////////////////////////////////////////////////////
const Char* getTimeString();
Void writeListToLog(const Char* message, const va_list list);
Void writeToLog(const Char* message, ...);
Void logDebug(const Char* message, ...);
Void logError(const Char* message, ...);
Void logCall(const Char* functionName, Int32u parameterCount);
//////////////////////////////////////////////////////////////////////////
Void* getFunctionAddress(const Char* functionName, Int32u parameterCount, Bool current);
//////////////////////////////////////////////////////////////////////////
Void allocateFrameBuffer(FrameBuffer& frameBuffer, Int32u surfaceType, BinkHandle binkHandle);
Void releaseFrameBuffer(FrameBuffer& frameBuffer);
//////////////////////////////////////////////////////////////////////////
Void createLocalStorage();
Void destroyLocalStorage();
Void initLocalData(LocalData& localData, BinkHandle binkHandle);
LocalData& allocateLocalData(BinkHandle binkHandle);
Void releaseLocalData(LocalData& localData);
Void releaseLocalData(BinkHandle binkHandle);
LocalData& getLocalData(BinkHandle binkHandle);
//////////////////////////////////////////////////////////////////////////
//Void eraseBuffer(Void* buffer, Int32u pitch, Int32u height, Int32u offsetX, Int32u offsetY);
//Void eraseBuffer(FrameBuffer& frameBuffer);
Void finishRendering(FrameBuffer& frameBuffer);
Void copyToBuffer(FrameBuffer& frameBuffer, Void* targetBuffer, Int32u targetPitch,
Int32u targetHeight, Int32u targetX, Int32u targetY, const Rect* sourceArea = NULL);
Void drawFrameRate(FrameBuffer& frameBuffer, Int32u x, Int32u y);
Void drawSubtitle(FrameBuffer& frameBuffer, SubtitleFile* subtitleList,
Int32u& debugX, Int32u& debugY, Int32u debugIncY);
Bool validateBuffer(BinkHandle binkHandle, FrameBuffer& frameBuffer, Int32u surfaceType);
Void drawFrame(LocalData& localData);
//////////////////////////////////////////////////////////////////////////
Bool loadSubtitleFile(LocalData& localData, Int32u trackIndex);
Void loadSubtitleFile(LocalData& localData);
Int32s compareLibraryVersion(Int32u major, Int32u minor, Int32u micro);
Void setSoundTrack(Int32u* trackList, Int32u trackCount);
//////////////////////////////////////////////////////////////////////////
const Char* getFrameRateString(BinkHandle binkHandle);
Int32u surfaceTypeToColorDepth(Int32u type);
//////////////////////////////////////////////////////////////////////////
Bool receiveVersion(const Char* versionUrl, Int32u& versionMajor, Int32u& versionMinor,
Int32u& versionMicro);
const Char* getBinkFileName(const Char* fileName, Int32u flags);
} // namespace Internal
} // namespace Bik
#endif // _BIK_INTERNAL_HPP_