GB: cleanup
This commit is contained in:
parent
9a6decef06
commit
b6404ced10
|
@ -6,15 +6,27 @@
|
||||||
|
|
||||||
using namespace gambatte;
|
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()
|
GBEXPORT GB *gambatte_create()
|
||||||
{
|
{
|
||||||
return new (std::calloc(1, sizeof (GB))) GB();
|
return new GB();
|
||||||
}
|
}
|
||||||
|
|
||||||
GBEXPORT void gambatte_destroy(GB *g)
|
GBEXPORT void gambatte_destroy(GB *g)
|
||||||
{
|
{
|
||||||
g->~GB();
|
delete g;
|
||||||
std::free(g);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GBEXPORT int gambatte_load(GB *g, const char *romfiledata, unsigned romfilelength, long long now, unsigned flags)
|
GBEXPORT int gambatte_load(GB *g, const char *romfiledata, unsigned romfilelength, long long now, unsigned flags)
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue