From f42c0d4a39282b2d000d36a60e4fcc0b868cf76e Mon Sep 17 00:00:00 2001 From: Hathor86 Date: Wed, 23 Mar 2016 23:05:05 +0100 Subject: [PATCH] DoFrameAdvance method in ApiHawk --- BizHawk.Client.ApiHawk/Classes/ClientApi.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/BizHawk.Client.ApiHawk/Classes/ClientApi.cs b/BizHawk.Client.ApiHawk/Classes/ClientApi.cs index 516bfb8cc2..af72e8403d 100644 --- a/BizHawk.Client.ApiHawk/Classes/ClientApi.cs +++ b/BizHawk.Client.ApiHawk/Classes/ClientApi.cs @@ -12,6 +12,7 @@ namespace BizHawk.Client.ApiHawk #region Fields private static readonly Assembly clientAssembly; + private static readonly object clientMainForm; public static event EventHandler RomLoaded; @@ -22,20 +23,22 @@ namespace BizHawk.Client.ApiHawk static ClientApi() { clientAssembly = Assembly.GetEntryAssembly(); + clientMainForm = clientAssembly.GetType("BizHawk.Client.EmuHawk.GlobalWin").GetField("MainForm").GetValue(null); } #endregion #region Methods - /*public static void DoframeAdvance() + /// + /// THE FrameAdvance stuff + /// + public static void DoframeAdvance() { - //StepRunLoop_Core - Type emuLuaLib = clientAssembly.GetType("BizHawk.Client.EmuHawk.MainForm"); - //clientAssembly - MethodInfo paddingMethod = emuLuaLib.GetMethod("FrameAdvance"); - paddingMethod.Invoke(paddingMethod, null); - }*/ + Type reflectClass = clientAssembly.GetType("BizHawk.Client.EmuHawk.MainForm"); + MethodInfo method = reflectClass.GetMethod("FrameAdvance"); + method.Invoke(clientMainForm, null); + } /// /// Raise when a rom is successfully Loaded