OpenBarnyard
Loading...
Searching...
No Matches
AMemory.h
Go to the documentation of this file.
1
#pragma once
2
#include "
AMemoryPoolAllocator.h
"
3
4
#include <cstdint>
5
6
class
AMemoryPool
7
{
8
public
:
9
constexpr
AMemoryPool
(
const
TCHAR
* a_szName,
int
a_iHeapIndex,
size_t
a_uiSize,
int
a_iUnk1,
int
a_iUnk2 )
10
: m_szName( a_szName ), m_iHeapIndex( a_iHeapIndex ), m_uiSize( a_uiSize ), m_iUnk1( a_iUnk1 ), m_iUnk2( a_iUnk2 )
11
{
12
}
13
14
const
TCHAR
*
GetName
()
const
{
return
m_szName; }
15
int
GetHeapIndex
()
const
{
return
m_iHeapIndex; }
16
size_t
GetSize
()
const
{
return
m_uiSize; }
17
TINT
GetUnk2
()
const
{
return
m_iUnk2; }
18
19
private
:
20
const
TCHAR
* m_szName;
21
TINT
m_iHeapIndex;
22
size_t
m_uiSize;
23
TINT
m_iUnk1;
24
TINT
m_iUnk2;
25
};
26
27
class
AMemory
28
{
29
public
:
30
using
POOL
= uint32_t;
31
enum
POOL_
:
POOL
32
{
33
POOL_None
= 0,
34
POOL_StringPool
,
35
POOL_Misc
,
36
POOL_Collision
,
37
POOL_Sound
,
38
POOL_Debug
,
39
POOL_MemTrace
,
40
POOL_Viewport
,
41
POOL_NUMOF
= 8
42
};
43
44
struct
AllocatorList
45
{
46
void
*
Unknown
;
47
AMemoryPoolAllocator
aAllocators
[
POOL_NUMOF
];
48
};
49
50
inline
static
Toshi::TMemory::MemBlock*
s_aMemBlocks
[
POOL_NUMOF
];
51
inline
static
AllocatorList
s_AllocatorList
;
52
53
inline
static
constexpr
AMemoryPool
s_aPools
[
POOL_NUMOF
] = {
54
#define DEFINE_MEMORY_POOL( NAME, SIZE, UNK1, UNK2 ) AMemoryPool( #NAME, NAME, SIZE, UNK1, UNK2 )
55
DEFINE_MEMORY_POOL
(
POOL_None
, 0, 0, 0 ),
56
DEFINE_MEMORY_POOL
(
POOL_StringPool
, 0x00100000, 0x00200000, 0x00200000 ),
57
DEFINE_MEMORY_POOL
(
POOL_Misc
, 0x00080000, 0x001c2000, 0x00096000 ),
58
DEFINE_MEMORY_POOL
(
POOL_Collision
, 0x00008000, 0x00008000, 0 ),
59
DEFINE_MEMORY_POOL
(
POOL_Sound
, 0x00040000, 0x00040000, 0x00010000 ),
60
DEFINE_MEMORY_POOL
(
POOL_Debug
, 0x00fa0000, 0x00fa0000, 0 ),
61
DEFINE_MEMORY_POOL
(
POOL_MemTrace
, 0x00000400, 0x00003000, 0 ),
62
DEFINE_MEMORY_POOL
(
POOL_Viewport
, 0x00004000, 0x00004000, 0 ),
63
#undef DEFINE_MEMORY_POOL
64
};
65
66
public
:
67
static
void
CreatePool
(
POOL
a_ePool );
68
static
Toshi::T2Allocator*
GetAllocator
(
POOL
a_ePool );
69
static
Toshi::TMemory::MemBlock*
GetMemBlock
(
POOL
a_ePool );
70
};
TCHAR
char TCHAR
Definition
Typedefs.h:20
TINT
int TINT
Definition
Typedefs.h:7
DEFINE_MEMORY_POOL
#define DEFINE_MEMORY_POOL(NAME, SIZE, UNK1, UNK2)
AMemoryPoolAllocator.h
AMemoryPool
Definition
AMemory.h:7
AMemoryPool::GetSize
size_t GetSize() const
Definition
AMemory.h:16
AMemoryPool::GetHeapIndex
int GetHeapIndex() const
Definition
AMemory.h:15
AMemoryPool::GetName
const TCHAR * GetName() const
Definition
AMemory.h:14
AMemoryPool::AMemoryPool
constexpr AMemoryPool(const TCHAR *a_szName, int a_iHeapIndex, size_t a_uiSize, int a_iUnk1, int a_iUnk2)
Definition
AMemory.h:9
AMemoryPool::GetUnk2
TINT GetUnk2() const
Definition
AMemory.h:17
AMemory
Definition
AMemory.h:28
AMemory::POOL_
POOL_
Definition
AMemory.h:32
AMemory::POOL_Viewport
@ POOL_Viewport
Definition
AMemory.h:40
AMemory::POOL_Misc
@ POOL_Misc
Definition
AMemory.h:35
AMemory::POOL_MemTrace
@ POOL_MemTrace
Definition
AMemory.h:39
AMemory::POOL_Sound
@ POOL_Sound
Definition
AMemory.h:37
AMemory::POOL_Collision
@ POOL_Collision
Definition
AMemory.h:36
AMemory::POOL_None
@ POOL_None
Definition
AMemory.h:33
AMemory::POOL_NUMOF
@ POOL_NUMOF
Definition
AMemory.h:41
AMemory::POOL_StringPool
@ POOL_StringPool
Definition
AMemory.h:34
AMemory::POOL_Debug
@ POOL_Debug
Definition
AMemory.h:38
AMemory::GetAllocator
static Toshi::T2Allocator * GetAllocator(POOL a_ePool)
Definition
AMemory.cpp:31
AMemory::s_aPools
static constexpr AMemoryPool s_aPools[POOL_NUMOF]
Definition
AMemory.h:53
AMemory::s_aMemBlocks
static Toshi::TMemory::MemBlock * s_aMemBlocks[POOL_NUMOF]
Definition
AMemory.h:50
AMemory::GetMemBlock
static Toshi::TMemory::MemBlock * GetMemBlock(POOL a_ePool)
Definition
AMemory.cpp:38
AMemory::POOL
uint32_t POOL
Definition
AMemory.h:30
AMemory::CreatePool
static void CreatePool(POOL a_ePool)
Definition
AMemory.cpp:12
AMemory::s_AllocatorList
static AllocatorList s_AllocatorList
Definition
AMemory.h:51
AMemory::AllocatorList
Definition
AMemory.h:45
AMemory::AllocatorList::Unknown
void * Unknown
Definition
AMemory.h:46
AMemory::AllocatorList::aAllocators
AMemoryPoolAllocator aAllocators[POOL_NUMOF]
Definition
AMemory.h:47
AMemoryPoolAllocator
Definition
AMemoryPoolAllocator.h:5
D:
_dev
OpenBarnyard
Source
OpenBarnyard
Source
Memory
AMemory.h
Generated by
1.13.2