From bab8ce180581bc9d1e4584a5d2b8d86efddf219e Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Tue, 12 Feb 2019 09:20:37 -0800 Subject: [PATCH] GB Serialize: Fix loading states with negative pixel x (fixes #1293) --- CHANGES | 1 + src/gb/serialize.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index be0ef5678..f305564e8 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ Bugfixes: - Qt: Fix tile and sprite views not always displaying at first - GBA Memory: Fix a few AGBPrint crashes - GBA Memory: Fix OOB ROM reads showing up as AGBPrint memory + - GB Serialize: Fix loading states with negative pixel x (fixes mgba.io/i/1293) Misc: - GBA Video: Improve sprite cycle counting (fixes mgba.io/i/1274) diff --git a/src/gb/serialize.c b/src/gb/serialize.c index 4eef6ae67..6c3db6308 100644 --- a/src/gb/serialize.c +++ b/src/gb/serialize.c @@ -113,7 +113,7 @@ bool GBDeserialize(struct GB* gb, const struct GBSerializedState* state) { error = true; } LOAD_16LE(check16, 0, &state->video.x); - if (check16 < 0 || check16 > GB_VIDEO_HORIZONTAL_PIXELS) { + if (check16 < -7 || check16 > GB_VIDEO_HORIZONTAL_PIXELS) { mLOG(GB_STATE, WARN, "Savestate is corrupted: video x is out of range"); error = true; }