diff --git a/Core/ControlManager.cpp b/Core/ControlManager.cpp index fcb8691f..1b4edeca 100644 --- a/Core/ControlManager.cpp +++ b/Core/ControlManager.cpp @@ -10,7 +10,7 @@ unique_ptr ControlManager::_keyManager = nullptr; shared_ptr ControlManager::_controlDevices[2] = { nullptr, nullptr }; IGameBroadcaster* ControlManager::_gameBroadcaster = nullptr; -MousePosition ControlManager::_mousePosition = { 0, 0 }; +MousePosition ControlManager::_mousePosition = { -1, -1 }; ControlManager::ControlManager() { @@ -261,9 +261,14 @@ void ControlManager::StreamState(bool saving) void ControlManager::SetMousePosition(double x, double y) { - OverscanDimensions overscan = EmulationSettings::GetOverscanDimensions(); - _mousePosition.X = (int32_t)(x * (PPU::ScreenWidth - overscan.Left - overscan.Right) + overscan.Left); - _mousePosition.Y = (int32_t)(y * (PPU::ScreenHeight - overscan.Top - overscan.Bottom) + overscan.Top); + if(x < 0 || y < 0) { + _mousePosition.X = -1; + _mousePosition.Y = -1; + } else { + OverscanDimensions overscan = EmulationSettings::GetOverscanDimensions(); + _mousePosition.X = (int32_t)(x * (PPU::ScreenWidth - overscan.Left - overscan.Right) + overscan.Left); + _mousePosition.Y = (int32_t)(y * (PPU::ScreenHeight - overscan.Top - overscan.Bottom) + overscan.Top); + } } MousePosition ControlManager::GetMousePosition() diff --git a/GUI.NET/Controls/ctrlRenderer.cs b/GUI.NET/Controls/ctrlRenderer.cs index b194134b..9599a8f4 100644 --- a/GUI.NET/Controls/ctrlRenderer.cs +++ b/GUI.NET/Controls/ctrlRenderer.cs @@ -81,6 +81,7 @@ namespace Mesen.GUI.Controls { tmrMouse.Stop(); ShowMouse(); + InteropEmu.SetMousePosition(-1, -1); } } }