changeset 2200:f11f4399d64b

Crop display in game gear mode
author Michael Pavone <pavone@retrodev.com>
date Mon, 22 Aug 2022 20:19:59 -0700
parents 6f66356af4e2
children 2f8984ff5c85
files default.cfg render.h render_sdl.c sms.c
diffstat 4 files changed, 25 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/default.cfg	Mon Aug 22 20:05:36 2022 -0700
+++ b/default.cfg	Mon Aug 22 20:19:59 2022 -0700
@@ -308,7 +308,7 @@
 			#comment out those two lines and uncomment these
 			#top 11
 			#bottom 8
-			
+
 			#these values will completely hide the horizontal border
 			left 13
 			right 14
@@ -326,12 +326,21 @@
 			#coment out those two lines and uncomment these
 			#top 30
 			#bottom 24
-			
+
 			#these values will completely hide the horizontal border
 			left 13
 			right 14
 		}
 	}
+	gamegear {
+		overscan {
+			#generally shouldn't change these
+			top 51
+			bot 48
+			left 61
+			right 62
+		}
+	}
 }
 
 audio {
--- a/render.h	Mon Aug 22 20:05:36 2022 -0700
+++ b/render.h	Mon Aug 22 20:19:59 2022 -0700
@@ -83,6 +83,7 @@
 typedef enum {
 	VID_NTSC,
 	VID_PAL,
+	VID_GAMEGEAR,
 	NUM_VID_STD
 } vid_std;
 
--- a/render_sdl.c	Mon Aug 22 20:05:36 2022 -0700
+++ b/render_sdl.c	Mon Aug 22 20:19:59 2022 -0700
@@ -779,10 +779,10 @@
 	}
 }
 
-static uint32_t overscan_top[NUM_VID_STD] = {2, 21};
-static uint32_t overscan_bot[NUM_VID_STD] = {1, 17};
-static uint32_t overscan_left[NUM_VID_STD] = {13, 13};
-static uint32_t overscan_right[NUM_VID_STD] = {14, 14};
+static uint32_t overscan_top[NUM_VID_STD] = {2, 21, 51};
+static uint32_t overscan_bot[NUM_VID_STD] = {1, 17, 48};
+static uint32_t overscan_left[NUM_VID_STD] = {13, 13, 61};
+static uint32_t overscan_right[NUM_VID_STD] = {14, 14, 62};
 static vid_std video_standard = VID_NTSC;
 static uint8_t need_ui_fb_resize;
 
@@ -941,7 +941,7 @@
 	}
 }
 
-static char *vid_std_names[NUM_VID_STD] = {"ntsc", "pal"};
+static char *vid_std_names[NUM_VID_STD] = {"ntsc", "pal", "gamegear"};
 static int display_hz;
 static int source_hz;
 static int source_frame;
@@ -1504,7 +1504,7 @@
 
 	last_width = width;
 	uint32_t height = which <= FRAMEBUFFER_EVEN
-		? (video_standard == VID_NTSC ? 243 : 294) - (overscan_top[video_standard] + overscan_bot[video_standard])
+		? (video_standard == VID_PAL ? 294 : 243) - (overscan_top[video_standard] + overscan_bot[video_standard])
 		: 240;
 	FILE *screenshot_file = NULL;
 	uint32_t shot_height, shot_width;
@@ -1521,7 +1521,7 @@
 		}
 		free(screenshot_path);
 		screenshot_path = NULL;
-		shot_height = video_standard == VID_NTSC ? 243 : 294;
+		shot_height = height;
 		shot_width = width;
 	}
 	interlaced = last != which;
@@ -1835,7 +1835,7 @@
 
 uint32_t render_emulated_height()
 {
-	return (video_standard == VID_NTSC ? 243 : 294) - overscan_top[video_standard] - overscan_bot[video_standard];
+	return (video_standard == VID_PAL ? 294 : 243) - overscan_top[video_standard] - overscan_bot[video_standard];
 }
 
 uint32_t render_overscan_left()
--- a/sms.c	Mon Aug 22 20:05:36 2022 -0700
+++ b/sms.c	Mon Aug 22 20:19:59 2022 -0700
@@ -412,7 +412,11 @@
 	sms_context *sms = (sms_context *)system;
 	uint32_t target_cycle = sms->z80->Z80_CYCLE + 3420*16;
 	//TODO: PAL support
-	render_set_video_standard(VID_NTSC);
+	if (sms->vdp->type == VDP_GAMEGEAR) {
+		render_set_video_standard(VID_GAMEGEAR);
+	} else {
+		render_set_video_standard(VID_NTSC);
+	}
 	while (!sms->should_return)
 	{
 		if (system->delayed_load_slot) {