aboutsummaryrefslogtreecommitdiff
path: root/frontend/menu.c
diff options
context:
space:
mode:
authornotaz2012-11-13 02:28:41 +0200
committernotaz2012-11-13 02:28:41 +0200
commitc65553d0cafc353daad3fdcc0aab63bb8427a809 (patch)
tree1c98a01dcf48755518405457b1ba0593465e7a2f /frontend/menu.c
parent7851087ded290440ef7490f7725a7b78602bd736 (diff)
downloadpcsx_rearmed-c65553d0cafc353daad3fdcc0aab63bb8427a809.tar.gz
pcsx_rearmed-c65553d0cafc353daad3fdcc0aab63bb8427a809.tar.bz2
pcsx_rearmed-c65553d0cafc353daad3fdcc0aab63bb8427a809.zip
fix some random corner cases
Diffstat (limited to 'frontend/menu.c')
-rw-r--r--frontend/menu.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/frontend/menu.c b/frontend/menu.c
index ec3c5a2..f77bc9d 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -624,12 +624,18 @@ static void draw_savestate_bg(int slot)
x = gpu->ulControl[5] & 0x3ff;
y = (gpu->ulControl[5] >> 10) & 0x1ff;
- s = (u16 *)gpu->psxVRam + y * 1024 + x;
w = psx_widths[(gpu->ulStatus >> 16) & 7];
tmp = gpu->ulControl[7];
h = ((tmp >> 10) & 0x3ff) - (tmp & 0x3ff);
if (gpu->ulStatus & 0x80000) // doubleheight
h *= 2;
+ if (h <= 0 || h > 512)
+ goto out;
+ if (y > 512 - 64)
+ y = 0;
+ if (y + h > 512)
+ h = 512 - y;
+ s = (u16 *)gpu->psxVRam + y * 1024 + x;
x = max(0, g_menuscreen_w - w) & ~3;
y = max(0, g_menuscreen_h / 2 - h / 2);