-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbik_descriptor.cpp
More file actions
74 lines (57 loc) · 1.65 KB
/
bik_descriptor.cpp
File metadata and controls
74 lines (57 loc) · 1.65 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
#include "bik_descriptor.hpp"
#include "bik_internal.hpp"
#include "bik_utils.hpp"
using namespace Bik::Internal;
using namespace CMF::Utils;
using namespace Bik::Utils;
//////////////////////////////////////////////////////////////////////////
BinkFunctionDescriptor* BinkFunctionDescriptor::f_descriptorList = NULL;
BinkFunctionDescriptor::BinkFunctionDescriptor(const Char* functionName, Int32u parameterCount) :
f_name(functionName),
f_currentAddress(NULL),
f_originalAddress(NULL),
f_parameterCount(parameterCount)
{
if (f_descriptorList != NULL)
{
BinkFunctionDescriptor* descriptor = f_descriptorList;
while (descriptor->f_next != NULL)
descriptor = descriptor->f_next;
descriptor->f_next = this;
} else f_descriptorList = this;
}
BinkFunctionDescriptor::~BinkFunctionDescriptor()
{
}
Bool BinkFunctionDescriptor::isValid() const
{
return (f_originalAddress != NULL);
}
const Char* BinkFunctionDescriptor::getName(Bool decorated) const
{
return (decorated ? decorateFunctionName(f_name, f_parameterCount) : f_name);
}
Void* BinkFunctionDescriptor::getAddress(Bool original) const
{
return (original ? f_originalAddress : f_currentAddress);
}
Bool BinkFunctionDescriptor::initialize()
{
if (f_name == NULL)
return False;
f_currentAddress = getFunctionAddress(f_name, f_parameterCount, True);
f_originalAddress = getFunctionAddress(f_name, f_parameterCount, False);
return True;
}
Bool BinkFunctionDescriptor::initializeList()
{
if (f_descriptorList == NULL)
return False;
BinkFunctionDescriptor* descriptor = f_descriptorList;
while (descriptor != NULL)
{
descriptor->initialize();
descriptor = descriptor->f_next;
}
return True;
}