1#include "host/KReplaySystem.hh"
2#include "host/KTestSystem.hh"
3#include "host/Option.hh"
5#include <egg/core/ExpHeap.hh>
9#if defined(__arm64__) || defined(__aarch64__)
10static void FlushDenormalsToZero() {
12 asm(
"mrs %0, fpcr" :
"=r"(fpcr));
13 asm(
"msr fpcr, %0" ::
"r"(fpcr | (1 << 24)));
15#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
18static void FlushDenormalsToZero() {
19 _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
23static void *s_memorySpace =
nullptr;
26static void InitMemory() {
27 s_memorySpace = malloc(MEMORY_SPACE_SIZE);
28 s_rootHeap = EGG::ExpHeap::create(s_memorySpace, MEMORY_SPACE_SIZE, DEFAULT_OPT);
29 s_rootHeap->setName(
"EGGRoot");
30 s_rootHeap->becomeCurrentHeap();
32 EGG::SceneManager::SetRootHeap(s_rootHeap);
35int main(
int argc,
char **argv) {
36 FlushDenormalsToZero();
42 const std::unordered_map<std::string, std::function<
KSystem *()>> modeMap = {
43 {
"test", []() ->
KSystem * {
return KTestSystem::CreateInstance(); }},
44 {
"replay", []() ->
KSystem * {
return KReplaySystem::CreateInstance(); }},
48 PANIC(
"Too few arguments!");
55 const std::string mode = argv[1];
57 auto it = modeMap.find(mode);
58 if (it != modeMap.end()) {
61 PANIC(
"Invalid mode!");
66 return sys->
run() ? 0 : 1;
A high-level representation of a memory heap for managing dynamic memory allocation....
Base interface for a Kinoko system.
virtual void init()=0
Initializes the system.
virtual bool run()=0
Executes a run.
virtual void parseOptions(int argc, char **argv)=0
Parses non-generic command line options.