Add custom new to GBA build
This commit is contained in:
parent
9c2e71045f
commit
dd4556e4e1
@ -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)
|
||||
|
31
src/nostalgia/core/gba/mem.cpp
Normal file
31
src/nostalgia/core/gba/mem.cpp
Normal 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) {
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user