A reimplementation of Mario Kart Wii's physics engine in C++
Loading...
Searching...
No Matches
RootScene.cc
Go to the documentation of this file.
1#include "RootScene.hh"
2
6
8#include <host/SceneId.hh>
9
10#include <ScopeLock.hh>
11
12namespace Kinoko::Scene {
13
16 m_heap->setName("RootSceneHeap");
17}
18
20RootScene::~RootScene() = default;
21
24 allocate();
25 init();
26#ifdef BUILD_DEBUG
27 checkMemory();
28#endif // BUILD_DEBUG
29 m_sceneMgr->createChildScene(static_cast<int>(Host::SceneId::Race), this);
30}
31
45
53
54#ifdef BUILD_DEBUG
55void RootScene::checkMemory() {
57 ASSERT(heap);
58
59 heap->calcGroupSize(&m_groupSizeRecord);
60 size_t defaultSize = m_groupSizeRecord.getGroupSize(static_cast<u16>(GroupID::None));
61
62 // The scene is the first, always group ID 0 allocation to happen in the scene's heap
63 ASSERT(defaultSize >= sizeof(RootScene));
64 defaultSize -= sizeof(RootScene);
65 if (defaultSize > 0) {
66 WARN("Default memory usage found! %zu bytes", defaultSize);
67 }
68
69 for (u16 groupID = 1; groupID < m_groupSizeRecord.size(); ++groupID) {
70 size_t size = m_groupSizeRecord.getGroupSize(groupID);
71 if (size == 0) {
72 continue;
73 }
74
75 DEBUG("Group ID %d: Allocated %zu bytes", groupID, size);
76 }
77}
78#endif // BUILD_DEBUG
79
80} // namespace Kinoko::Scene
#define DEBUG(m,...)
Definition Logger.hh:49
#define ASSERT(e)
Definition Logger.hh:25
#define WARN(m,...)
Definition Logger.hh:33
High-level implementation of a memory heap for managing dynamic memory allocation....
static ExpHeap * dynamicCastToExp(Heap *heap)
Definition Heap.hh:107
void setName(const char *name)
Definition Heap.hh:92
void createChildScene(int nextSceneId, Scene *parent)
SceneManager * m_sceneMgr
Definition Scene.hh:85
Heap * heap() const
Definition Scene.hh:55
The parent scene for all other scenes.
Definition RootScene.hh:9
EGG::ExpHeap::GroupSizeRecord m_groupSizeRecord
Definition RootScene.hh:24
void enter() override
Definition RootScene.cc:23
static KPadDirector * CreateInstance()
static RaceConfig * Instance()
Definition RaceConfig.hh:82
static RaceConfig * CreateInstance()
Definition RaceConfig.cc:60
static ResourceManager * CreateInstance()
Pertains to scene handling.
Definition GameScene.cc:10
uint16_t u16
Definition Memory.hh:17