Add custom new to GBA build

This commit is contained in:
Gary Talent 2017-10-13 10:53:19 -05:00
parent 9c2e71045f
commit dd4556e4e1
2 changed files with 32 additions and 0 deletions

View File

@ -6,6 +6,7 @@ if(NOSTALGIA_BUILD_TYPE STREQUAL "GBA")
CPP
gba/gfx.cpp
gba/media.cpp
gba/mem.cpp
)
elseif(NOSTALGIA_BUILD_TYPE STREQUAL "Native")
set(CMAKE_INCLUDE_CURRENT_DIR ON)

View File

@ -0,0 +1,31 @@
/*
* Copyright 2016-2017 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "addresses.hpp"
namespace nostalgia {
namespace core {
static uint8_t *_heapPtr = MEM_WRAM_END;
void clearHeap() {
_heapPtr = MEM_WRAM_END;
}
}
}
using namespace nostalgia::core;
void *operator new(size_t sz) {
return _heapPtr -= sz;
}
void operator delete(void *ptr) {
}