diff --git a/src/BizHawk.Client.Common/DisplayManager/Filters/Gui.cs b/src/BizHawk.Client.Common/DisplayManager/Filters/Gui.cs index f41cb00e46..68ed283e9a 100644 --- a/src/BizHawk.Client.Common/DisplayManager/Filters/Gui.cs +++ b/src/BizHawk.Client.Common/DisplayManager/Filters/Gui.cs @@ -197,11 +197,7 @@ namespace BizHawk.Client.Common.Filters } public override Vector2 TransformPoint(string channel, Vector2 point) - { - // TODO - Console.WriteLine($"TODO ScreenControlNDS TransformPoint {point.X} / {point.Y}"); - return base.TransformPoint(channel, point); - } + => _nds.GetScreenCoords(point.X, point.Y); } /// diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/LibMelonDS.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/LibMelonDS.cs index 78d65550dc..7027a400bd 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/LibMelonDS.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/LibMelonDS.cs @@ -294,5 +294,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS [BizImport(CC)] public abstract void GetTouchCoords(ref int x, ref int y); + + [BizImport(CC)] + public abstract void GetScreenCoords(ref float x, ref float y); } } diff --git a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs index 7c2d9da46e..599d5b1767 100644 --- a/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs +++ b/src/BizHawk.Emulation.Cores/Consoles/Nintendo/NDS/MelonDS.cs @@ -71,6 +71,8 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS private IntPtr GetGLProcAddressCallback(string proc) => _openGLProvider.GetGLProcAddress(proc); + // TODO: Probably can make these into an interface (ITouchScreen with UntransformPoint/TransformPoint methods?) + // Which case the hackiness of the current screen controls wouldn't be as bad public Vector2 GetTouchCoords(int x, int y) { if (_glContext != null) @@ -86,6 +88,21 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.NDS return new(x, y); } + public Vector2 GetScreenCoords(float x, float y) + { + if (_glContext != null) + { + _core.GetScreenCoords(ref x, ref y); + } + else + { + // no GL context, so nothing fancy can be applied + y = Math.Min(256, y + 192); + } + + return new(x, y); + } + [CoreConstructor(VSystemID.Raw.NDS)] public NDS(CoreLoadParameters lp) : base(lp.Comm, new()