Kinoko
A reimplementation of Mario Kart Wii's physics engine in C++
Toggle main menu visibility
Loading...
Searching...
No Matches
RootScene.cc
1
#include "RootScene.hh"
2
3
#include "game/system/KPadDirector.hh"
4
#include "game/system/RaceConfig.hh"
5
#include "game/system/ResourceManager.hh"
6
7
#include <egg/core/SceneManager.hh>
8
#include <host/SceneId.hh>
9
10
#include <ScopeLock.hh>
11
12
namespace
Kinoko::Scene
{
13
15
RootScene::RootScene() {
16
m_heap->setName(
"RootSceneHeap"
);
17
}
18
20
RootScene::~RootScene() =
default
;
21
23
void
RootScene::enter() {
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
33
void
RootScene::allocate() {
34
{
35
ScopeLock<GroupID> lock(GroupID::Resource);
36
System::ResourceManager::CreateInstance();
37
}
38
39
{
40
ScopeLock<GroupID> lock(GroupID::Race);
41
System::KPadDirector::CreateInstance();
42
System::RaceConfig::CreateInstance();
43
}
44
}
45
47
void
RootScene::init() {
48
{
49
ScopeLock<GroupID> lock(GroupID::Race);
50
System::RaceConfig::Instance()->init();
51
}
52
}
53
54
#ifdef BUILD_DEBUG
55
void
RootScene::checkMemory() {
56
EGG::ExpHeap *heap = EGG::Heap::dynamicCastToExp(m_heap);
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
Kinoko::Scene
Pertains to scene handling.
Definition
GameScene.cc:10
game
scene
RootScene.cc
Made by
Malleo
. Logo by
vabold
. Website generated by
Doxygen
1.17.0