diff --git a/BizHawk.Client.ApiHawk/Classes/ClientApi.cs b/BizHawk.Client.ApiHawk/Classes/ClientApi.cs index c782ffc12e..0f96af1389 100644 --- a/BizHawk.Client.ApiHawk/Classes/ClientApi.cs +++ b/BizHawk.Client.ApiHawk/Classes/ClientApi.cs @@ -1,4 +1,5 @@ using System; +using System.Drawing; using System.Collections.Generic; using System.IO; using System.Linq; @@ -663,26 +664,14 @@ namespace BizHawk.Client.ApiHawk InvokeMainFormMethod("TogglePause"); } - public static int TransformPointX(int x) + public static Point TransformPoint(Point point) { - var point = new System.Drawing.Point(x, 0); Type t = ClientAssembly.GetType("BizHawk.Client.EmuHawk.GlobalWin"); FieldInfo f = t.GetField("DisplayManager"); object displayManager = f.GetValue(null); MethodInfo m = t.GetMethod("TransFormPoint"); point = (System.Drawing.Point)m.Invoke(displayManager, new object[] { point }); - return point.X; - } - - public static int TransformPointY(int y) - { - var point = new System.Drawing.Point(0, y); - Type t = ClientAssembly.GetType("BizHawk.Client.EmuHawk.GlobalWin"); - FieldInfo f = t.GetField("DisplayManager"); - object displayManager = f.GetValue(null); - MethodInfo m = t.GetMethod("TransFormPoint"); - point = (System.Drawing.Point)m.Invoke(displayManager, new object[] { point }); - return point.Y; + return point; } public static void Unpause() diff --git a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs b/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs index 6057c4d5ff..8b58458887 100644 --- a/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs +++ b/BizHawk.Client.EmuHawk/DisplayManager/Filters/Gui.cs @@ -334,7 +334,11 @@ namespace BizHawk.Client.EmuHawk.Filters public override Vector2 UntransformPoint(string channel, Vector2 point) { point = Transform(matBotInvert, point); + //hack to accomodate input tracking system's float-point sense (based on the core's videobuffer height) + //actually, this is needed for a reason similar to the "TouchScreenStart" that I removed. + //So, something like that needs readding if we're to get rid of this hack. + //(should redo it as a mouse coordinate offset or something.. but the key is to pipe it to the point where this is needed.. that is where MainForm does DisplayManager.UntransformPoint() point.Y *= 2; //in case we're in this layout, we get confused, so fix it @@ -351,8 +355,8 @@ namespace BizHawk.Client.EmuHawk.Filters public override Vector2 TransformPoint(string channel, Vector2 point) { - //NOT TESTED, probably needs adjustment - return Transform(matBot, point); + point = Transform(matBot, point); + return point; } public override void Run() diff --git a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs index 545a5c6936..ba0f256649 100644 --- a/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs +++ b/BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.Client.cs @@ -361,19 +361,28 @@ namespace BizHawk.Client.EmuHawk MainForm.TogglePause(); } - [LuaMethodExample("local inclitra = client.transformPointX( 16 );")] - [LuaMethod("transformPointX", "Transforms an x-coordinate in emulator space to an x-coordinate in client space")] - public static int TransformPointX(int x) + //couldn't make this work.. + //[LuaMethodExample("local inclitra = client.transformPoint( 32, 100 );")] + //[LuaMethod("transformPoint", "Transforms a point in emulator space to a point in client space")] + //public static object TransformPoint(int x, int y) + //{ + // var point = new System.Drawing.Point(x, y); + // return GlobalWin.DisplayManager.TransformPoint(point); + //} + + [LuaMethodExample("local inclitra = client.transformPointX( 16, 100 );")] + [LuaMethod("transformPointX", "Transforms a point in emulator space to an x-coordinate in client space")] + public static int TransformPointX(int x, int y) { - var point = new System.Drawing.Point(x, 0); + var point = new System.Drawing.Point(x, y); return GlobalWin.DisplayManager.TransformPoint(point).X; } - [LuaMethodExample("local inclitra = client.transformPointY( 32 );")] - [LuaMethod("transformPointY", "Transforms an y-coordinate in emulator space to an y-coordinate in client space")] - public static int TransformPointY(int y) + [LuaMethodExample("local inclitra = client.transformPointY( 16, 100 );")] + [LuaMethod("transformPointY", "Transforms a point in emulator space to a y-coordinate in client space")] + public static int TransformPointY(int x, int y) { - var point = new System.Drawing.Point(0, y); + var point = new System.Drawing.Point(x, y); return GlobalWin.DisplayManager.TransformPoint(point).Y; }