Reduce bsnes115 state size (#3105)

* testing...

* more testing...

* this is probably a bad idea

* well this probably fixes state size issues

* time to debug this

* oh derp it's just not enough memory in invis heap

* let's see if this works?

* apparently this breaks slow ppu?

* testing...

* testing...

* testing...

* sanity checking

* let's try again

* i do not know what the fuck is up with this emulator nor do i care enough, state size is still under a mb anyways with slow ppu

* oops forgot to commit this

* resolve some issues

* tweak memory allocation sizes

* dont save more cache stuff

* wtf was i even thinking here

* move comment back to original pos, comment on double loading
This commit is contained in:
CasualPokePlayer 2022-01-31 19:00:04 -08:00 committed by GitHub
parent 7ac2e97cb7
commit 096f24e7c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 54 additions and 30 deletions

Binary file not shown.

View File

@ -115,10 +115,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.BSNES
{
Filename = "bsnes.wbx",
Path = dllPath,
SbrkHeapSizeKB = 14 * 1024,
InvisibleHeapSizeKB = 4,
MmapHeapSizeKB = 110 * 1024, // TODO: check whether this needs to be larger; it depends on the rom size
PlainHeapSizeKB = 0,
SbrkHeapSizeKB = 12 * 1024,
InvisibleHeapSizeKB = 136 * 1024, // TODO: Roms get saved here and in mmap, consider consolidating?
MmapHeapSizeKB = 33 * 1024, // TODO: check whether this needs to be larger; it depends on the rom size
PlainHeapSizeKB = 1 * 1024,
SealedHeapSizeKB = 0,
SkipCoreConsistencyCheck = comm.CorePreferences.HasFlag(CoreComm.CorePreferencesFlags.WaterboxCoreConsistencyCheck),
SkipMemoryConsistencyCheck = comm.CorePreferences.HasFlag(CoreComm.CorePreferencesFlags.WaterboxMemoryConsistencyCheck),

View File

@ -6,8 +6,9 @@ bool Memory::GlobalWriteEnable = false;
Bus bus;
Bus::~Bus() {
if(lookup) delete[] lookup;
if(target) delete[] target;
//if(lookup) delete[] lookup;
//if(target) delete[] target;
abort();
}
auto Bus::reset() -> void {
@ -17,11 +18,14 @@ auto Bus::reset() -> void {
counter[id] = 0;
}
if(lookup) delete[] lookup;
if(target) delete[] target;
//if(lookup) delete[] lookup;
//if(target) delete[] target;
lookup = new uint8 [16 * 1024 * 1024]();
target = new uint32[16 * 1024 * 1024]();
//lookup = new uint8 [16 * 1024 * 1024]();
//target = new uint32[16 * 1024 * 1024]();
if (!lookup) lookup = alloc_invisible<uint8> (16 * 1024 * 1024);
if (!target) target = alloc_invisible<uint32>(16 * 1024 * 1024);
reader[0] = [](uint, uint8 data) -> uint8 { return data; };
writer[0] = [](uint, uint8) -> void {};

View File

@ -1,14 +1,18 @@
struct ProtectableMemory : Memory {
inline auto reset() -> void override {
delete[] self.data;
self.data = nullptr;
self.size = 0;
//delete[] self.data;
//self.data = nullptr;
//self.size = 0;
}
inline auto allocate(uint size, uint8 fill = 0xff) -> void override {
if (!self.data) {
self.data = alloc_plain<uint8>(self.size = size);
}
if(self.size != size) {
delete[] self.data;
self.data = new uint8[self.size = size];
//delete[] self.data;
//self.data = new uint8[self.size = size];
abort();
}
for(uint address : range(size)) {
self.data[address] = fill;

View File

@ -1,14 +1,18 @@
struct ReadableMemory : Memory {
inline auto reset() -> void override {
delete[] self.data;
self.data = nullptr;
self.size = 0;
//delete[] self.data;
//self.data = nullptr;
//self.size = 0;
}
inline auto allocate(uint size, uint8 fill = 0xff) -> void override {
if (!self.data) {
self.data = alloc_invisible<uint8>(self.size = size);
}
if(self.size != size) {
delete[] self.data;
self.data = new uint8[self.size = size];
//delete[] self.data;
//self.data = new uint8[self.size = size];
abort();
}
for(uint address : range(size)) {
self.data[address] = fill;

View File

@ -1,14 +1,18 @@
struct WritableMemory : Memory {
inline auto reset() -> void override {
delete[] self.data;
self.data = nullptr;
self.size = 0;
//delete[] self.data;
//self.data = nullptr;
//self.size = 0;
}
inline auto allocate(uint size, uint8 fill = 0xff) -> void override {
if (!self.data) {
self.data = alloc_plain<uint8>(self.size = size);
}
if(self.size != size) {
delete[] self.data;
self.data = new uint8[self.size = size];
//delete[] self.data;
//self.data = new uint8[self.size = size];
abort();
}
for(uint address : range(size)) {
self.data[address] = fill;

View File

@ -34,10 +34,12 @@ auto PPU::noVRAMBlocking() const -> bool { return configuration.hacks.ppu.noVRAM
#define ppu ppufast
PPU::PPU() {
output = new uint16_t[2304 * 2160]();
//output = new uint16_t[2304 * 2160]();
output = alloc_invisible<uint16_t>(2304 * 2160);
for(uint l : range(16)) {
lightTable[l] = new uint16_t[32768];
//lightTable[l] = new uint16_t[32768];
lightTable[l] = alloc_invisible<uint16_t>(32768);
for(uint r : range(32)) {
for(uint g : range(32)) {
for(uint b : range(32)) {
@ -51,14 +53,17 @@ PPU::PPU() {
}
}
lines = alloc_invisible<Line>(240);
for(uint y : range(240)) {
lines[y].y = y;
}
}
PPU::~PPU() {
delete[] output;
for(uint l : range(16)) delete[] lightTable[l];
//delete[] output;
//for(uint l : range(16)) delete[] lightTable[l];
abort();
}
auto PPU::synchronizeCPU() -> void {

View File

@ -351,7 +351,8 @@ public:
};
//unserialized:
Line lines[240];
//Line lines[240];
Line* lines;
//used to help detect when the video output size changes between frames to clear overscan area.
struct Frame {

View File

@ -3,6 +3,8 @@
//license: GPLv3
//started: 2004-10-14
#include <emulibc.h>
#include <emulator/emulator.hpp>
#include <emulator/random.hpp>
#include <emulator/cheat.hpp>