sameboy: a bit of savestate optimization

This commit is contained in:
nattthebear 2017-07-19 20:38:19 -04:00
parent a640c53e52
commit 0d6bdc200b
2 changed files with 7 additions and 31 deletions

View File

@ -63,11 +63,11 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy
_core = PreInit<LibSameboy>(new PeRunnerOptions
{
Filename = "sameboy.wbx",
SbrkHeapSizeKB = 128,
InvisibleHeapSizeKB = 16 * 1024,
SealedHeapSizeKB = 5 * 1024,
PlainHeapSizeKB = 4096,
MmapHeapSizeKB = 34 * 1024
SbrkHeapSizeKB = 192,
InvisibleHeapSizeKB = 4,
SealedHeapSizeKB = 9 * 1024,
PlainHeapSizeKB = 4,
MmapHeapSizeKB = 1024
});
_cgb = (rom[0x143] & 0xc0) == 0xc0 && !sgb;

View File

@ -5,11 +5,8 @@
#include <string.h>
#include <errno.h>
#include <stdarg.h>
#ifndef _WIN32
#include <unistd.h>
#include <sys/select.h>
#endif
#include "gb.h"
#include "../emulibc/emulibc.h"
void GB_attributed_logv(GB_gameboy_t *gb, GB_log_attributes attributes, const char *fmt, va_list args)
{
@ -75,27 +72,6 @@ void GB_init_cgb(GB_gameboy_t *gb)
GB_reset(gb);
}
void GB_free(GB_gameboy_t *gb)
{
gb->magic = 0;
if (gb->ram) {
free(gb->ram);
}
if (gb->vram) {
free(gb->vram);
}
if (gb->mbc_ram) {
free(gb->mbc_ram);
}
if (gb->rom) {
free(gb->rom);
}
if (gb->breakpoints) {
free(gb->breakpoints);
}
memset(gb, 0, sizeof(*gb));
}
int GB_load_boot_rom(GB_gameboy_t *gb, const char *path)
{
FILE *f = fopen(path, "rb");
@ -127,7 +103,7 @@ int GB_load_rom(GB_gameboy_t *gb, const char *path)
if (gb->rom) {
free(gb->rom);
}
gb->rom = malloc(gb->rom_size);
gb->rom = alloc_sealed(gb->rom_size);
memset(gb->rom, 0xFF, gb->rom_size); /* Pad with 0xFFs */
fread(gb->rom, gb->rom_size, 1, f);
fclose(f);