From da869b41fbb3bfb2c31798abf01e648d6dc15221 Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Sat, 12 Dec 2020 14:09:34 +0100 Subject: Stop loading at the end of a file When section 0 is found, assume we reached the end of the serialization, so stop deserializing. --- sms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sms.c') diff --git a/sms.c b/sms.c index a2e3d3b..94fd5aa 100644 --- a/sms.c +++ b/sms.c @@ -309,7 +309,8 @@ void sms_deserialize(deserialize_buffer *buf, sms_context *sms) //TODO: cart RAM while (buf->cur_pos < buf->size) { - load_section(buf); + if (!load_section(buf)) + break; } z80_invalidate_code_range(sms->z80, 0xC000, 0x10000); if (sms->bank_regs[0] & 8) { -- cgit v1.2.3