diff render_sdl.c @ 1398:08116cb5ffaa

Fix absolute mouse mode when non-default overscan settings are used
author Michael Pavone <pavone@retrodev.com>
date Wed, 14 Jun 2017 20:46:11 -0700
parents 89eb967fed72
children 458df351af06
line wrap: on
line diff
--- a/render_sdl.c	Wed Jun 14 09:48:46 2017 -0700
+++ b/render_sdl.c	Wed Jun 14 20:46:11 2017 -0700
@@ -567,9 +567,11 @@
 #define FPS_INTERVAL 1000
 #endif
 
+static uint32_t last_width;
 void render_framebuffer_updated(uint8_t which, int width)
 {
 	static uint8_t last;
+	last_width = width;
 	uint32_t height = which <= FRAMEBUFFER_EVEN 
 		? (video_standard == VID_NTSC ? 243 : 294) - (overscan_top[video_standard] + overscan_bot[video_standard])
 		: 240;
@@ -692,6 +694,26 @@
 	events_processed = 0;
 }
 
+uint32_t render_emulated_width()
+{
+	return last_width - overscan_left[video_standard] - overscan_right[video_standard];
+}
+
+uint32_t render_emulated_height()
+{
+	return (video_standard == VID_NTSC ? 243 : 294) - overscan_top[video_standard] - overscan_bot[video_standard];
+}
+
+uint32_t render_overscan_left()
+{
+	return overscan_left[video_standard];
+}
+
+uint32_t render_overscan_top()
+{
+	return overscan_top[video_standard];
+}
+
 void render_wait_quit(vdp_context * context)
 {
 	SDL_Event event;