From 80b36379e7ba0adf55289c7f1de3b0cc604932f3 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Sat, 9 Oct 2021 18:31:20 -0400 Subject: [PATCH] Mouse screen coordinates calculation fix for NTSC 2X video scaler. Fixes issue #409 for the Qt GUI. --- src/drivers/Qt/sdl-video.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/drivers/Qt/sdl-video.cpp b/src/drivers/Qt/sdl-video.cpp index 99818979..6496ed45 100644 --- a/src/drivers/Qt/sdl-video.cpp +++ b/src/drivers/Qt/sdl-video.cpp @@ -494,8 +494,17 @@ void FCEUI_AviVideoUpdate(const unsigned char* buffer) uint32 PtoV(double nx, double ny) { int x, y; + y = (int)( ny * (double)nes_shm->video.nrow ); - x = (int)( nx * (double)nes_shm->video.ncol ); + + if ( nes_shm->video.preScaler == 3 ) + { + x = (int)( nx * (double)nes_shm->video.ncol * (256.0/301.0) ); + } + else + { + x = (int)( nx * (double)nes_shm->video.ncol ); + } //printf("Scaled (%i,%i) \n", x, y);