-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbik_utils.cpp
More file actions
48 lines (36 loc) · 1.2 KB
/
bik_utils.cpp
File metadata and controls
48 lines (36 loc) · 1.2 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
#include "bik_utils.hpp"
//////////////////////////////////////////////////////////////////////////
Char* Bik::Utils::decorateFunctionName(const Char* functionName, Int32u parameterCount)
{
// generate decorated function name, e.g. _BinkOpen@8
static Char buffer[256];
Int32u count = sprintf(buffer, "_%s@%d", functionName, parameterCount * 4);
buffer[count] = '\0';
return buffer;
}
Bool Bik::Utils::generateExport(const Char* functionName, Int32u parameterCount)
{
#if defined(BINK_GENERATE)
// we are going to generate .def file
static Bool started = False;
static Int32u ordinal = 1;
FILE* exportFile = NULL;
if (!started)
{
started = True;
exportFile = fopen("export.def", "w");
fprintf(exportFile, "LIBRARY binkw32.dll\n");
fprintf(exportFile, "EXPORTS\n");
fclose(exportFile);
}
exportFile = fopen("export.def", "a");
fprintf(exportFile, "\t_%s@%d = _%s%d@%d @%d\n", functionName, parameterCount * 4,
functionName, parameterCount, parameterCount * 4, ordinal++);
//fprintf(exportFile, "\t_%s@%d = _%s%d@%d\n", functionName, parameterCount * 4,
// functionName, parameterCount, parameterCount * 4);
fclose(exportFile);
return True;
#else
return False;
#endif // BINK_GENERATE
}