Fix SGB save states

This commit is contained in:
Lior Halphon 2019-07-19 19:57:11 +03:00
parent 32c781c531
commit a0671bc8a9
1 changed files with 8 additions and 4 deletions

View File

@ -3,13 +3,17 @@ auto ICD::serialize(serializer& s) -> void {
auto size = GB_get_save_state_size(&sameboy);
auto data = new uint8_t[size];
s.array(data, size);
if(s.mode() == serializer::Load) {
GB_load_state_from_buffer(&sameboy, data, size);
}
if(s.mode() == serializer::Save) {
GB_save_state_to_buffer(&sameboy, data);
}
s.array(data, size);
if(s.mode() == serializer::Load) {
GB_load_state_from_buffer(&sameboy, data, size);
}
delete[] data;
for(auto n : range(64)) s.array(packet[n].data);