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
|
#ifndef NW4R_SND_INSTANCE_POOL_H
#define NW4R_SND_INSTANCE_POOL_H
/*******************************************************************************
* headers
*/
#include <new>
#include "common.h"
/*******************************************************************************
* classes and functions
*/
namespace nw4r { namespace snd { namespace detail
{
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2e96b
class PoolImpl
{
// methods
protected:
// cdtors
PoolImpl() : mNext(nullptr) {}
// methods
u32 CreateImpl(void *buffer, u32 size, u32 objSize);
void DestroyImpl(void *buffer, u32 size);
int CountImpl() const;
void *AllocImpl();
void FreeImpl(void *ptr);
// members
private:
PoolImpl *mNext; // size 0x04, offset 0x00
}; // size 0x04
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2f735, 0x31491...
template <class T>
class InstancePool : private PoolImpl
{
// methods
public:
// methods
u32 Create(void *buffer, u32 size)
{
u32 objSize = sizeof(T);
return CreateImpl(buffer, size, objSize);
}
void Destroy(void *buffer, u32 size) { DestroyImpl(buffer, size); }
int Count() const { return CountImpl(); }
T *Alloc()
{
void *ptr = AllocImpl();
if (!ptr)
return nullptr;
return new (ptr) T;
}
void Free(T *obj)
{
if (obj)
{
obj->~T();
FreeImpl(obj);
}
}
// members
private:
/* base PoolImpl */ // size 0x04, offset 0x00
}; // size 0x04
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2efa0, 0x309c7...
template <class T>
class MemoryPool : private PoolImpl
{
// methods
public:
// methods
u32 Create(void *buffer, u32 size)
{
u32 objSize = sizeof(T);
return CreateImpl(buffer, size, objSize);
}
void Destroy(void *buffer, u32 size) { DestroyImpl(buffer, size); }
int Count() const { return CountImpl(); } // Presumably
T *Alloc() { return static_cast<T *>(AllocImpl()); }
void Free(T *obj) { FreeImpl(obj); }
// members
private:
/* base PoolImpl */ // size 0x04, offset 0x00
}; // size 0x04
}}} // namespace nw4r::snd::detail
#endif // NW4R_SND_INSTANCE_POOL_H
|