GB: cleanup

This commit is contained in:
goyuken 2014-06-16 16:23:26 +00:00
parent 9a6decef06
commit b6404ced10
2 changed files with 15 additions and 3 deletions

View File

@ -6,15 +6,27 @@
using namespace gambatte;
// new is actually called in a few different places, so replace all of them for determinism guarantees
void *operator new(std::size_t n)
{
void *p = std::malloc(n);
std::memset(p, 0, n);
return p;
}
void operator delete(void *p)
{
std::free(p);
}
GBEXPORT GB *gambatte_create()
{
return new (std::calloc(1, sizeof (GB))) GB();
return new GB();
}
GBEXPORT void gambatte_destroy(GB *g)
{
g->~GB();
std::free(g);
delete g;
}
GBEXPORT int gambatte_load(GB *g, const char *romfiledata, unsigned romfilelength, long long now, unsigned flags)

Binary file not shown.