blob: 35e515ef5d970f632363d3f93388937bb6206f53 (
plain)
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
|
#pragma once
#include <container/seadRingBuffer.h>
#include "KingSystem/Resource/resUnit.h"
#include "KingSystem/Utils/Types.h"
namespace ksys::res {
class ResourceUnitPool {
public:
ResourceUnitPool();
virtual ~ResourceUnitPool();
ResourceUnitPool(const ResourceUnitPool&) = delete;
ResourceUnitPool& operator=(const ResourceUnitPool&) = delete;
bool init();
ResourceUnit* tryAlloc();
ResourceUnit* alloc();
void free(ResourceUnit* unit);
void freeForSync(ResourceUnit* unit);
private:
static constexpr s32 UnitCapacity = 9000;
ResourceUnit mUnits[UnitCapacity];
sead::FixedRingBuffer<ResourceUnit*, UnitCapacity> mRingBuffer;
};
KSYS_CHECK_SIZE_NX150(ResourceUnitPool, 0x9c01a0);
} // namespace ksys::res
|