Delegate more of ClientLuaLibrary to ApiHawk
This commit is contained in:
parent
a74d657a2a
commit
ff4662efe8
|
@ -1,16 +1,15 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
using BizHawk.Client.Common;
|
||||||
|
using BizHawk.Client.Common.cheats;
|
||||||
|
using BizHawk.Emulation.Common;
|
||||||
|
|
||||||
using NLua;
|
using NLua;
|
||||||
using BizHawk.Emulation.Common;
|
|
||||||
using BizHawk.Client.Common;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
using BizHawk.Common;
|
|
||||||
using BizHawk.Client.Common.cheats;
|
|
||||||
|
|
||||||
// ReSharper disable StringLiteralTypo
|
// ReSharper disable StringLiteralTypo
|
||||||
// ReSharper disable UnusedMember.Global
|
// ReSharper disable UnusedMember.Global
|
||||||
|
@ -37,33 +36,19 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[LuaMethodExample("client.exit( );")]
|
[LuaMethodExample("client.exit( );")]
|
||||||
[LuaMethod("exit", "Closes the emulator")]
|
[LuaMethod("exit", "Closes the emulator")]
|
||||||
public void CloseEmulator()
|
public void CloseEmulator() => APIs.EmuClient.CloseEmulator();
|
||||||
{
|
|
||||||
MainForm.CloseEmulator();
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.exitCode( 0 );")]
|
[LuaMethodExample("client.exitCode( 0 );")]
|
||||||
[LuaMethod("exitCode", "Closes the emulator and returns the provided code")]
|
[LuaMethod("exitCode", "Closes the emulator and returns the provided code")]
|
||||||
public void CloseEmulatorWithCode(int exitCode)
|
public void CloseEmulatorWithCode(int exitCode) => APIs.EmuClient.CloseEmulatorWithCode(exitCode);
|
||||||
{
|
|
||||||
MainForm.CloseEmulator(exitCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("local inclibor = client.borderheight( );")]
|
[LuaMethodExample("local inclibor = client.borderheight( );")]
|
||||||
[LuaMethod("borderheight", "Gets the current height in pixels of the letter/pillarbox area (top side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
|
[LuaMethod("borderheight", "Gets the current height in pixels of the letter/pillarbox area (top side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
|
||||||
public static int BorderHeight()
|
public int BorderHeight() => APIs.EmuClient.BorderHeight();
|
||||||
{
|
|
||||||
var point = new Point(0, 0);
|
|
||||||
return GlobalWin.DisplayManager.TransformPoint(point).Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("local inclibor = client.borderwidth( );")]
|
[LuaMethodExample("local inclibor = client.borderwidth( );")]
|
||||||
[LuaMethod("borderwidth", "Gets the current width in pixels of the letter/pillarbox area (left side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
|
[LuaMethod("borderwidth", "Gets the current width in pixels of the letter/pillarbox area (left side only) around the emu display surface, excluding the gameExtraPadding you've set. This function (the whole lot of them) should be renamed or refactored since the padding areas have got more complex.")]
|
||||||
public static int BorderWidth()
|
public int BorderWidth() => APIs.EmuClient.BorderWidth();
|
||||||
{
|
|
||||||
var point = new Point(0, 0);
|
|
||||||
return GlobalWin.DisplayManager.TransformPoint(point).X;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("local inclibuf = client.bufferheight( );")]
|
[LuaMethodExample("local inclibuf = client.bufferheight( );")]
|
||||||
[LuaMethod("bufferheight", "Gets the visible height of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
|
[LuaMethod("bufferheight", "Gets the visible height of the emu display surface (the core video output). This excludes the gameExtraPadding you've set.")]
|
||||||
|
@ -81,29 +66,21 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[LuaMethodExample("client.clearautohold( );")]
|
[LuaMethodExample("client.clearautohold( );")]
|
||||||
[LuaMethod("clearautohold", "Clears all autohold keys")]
|
[LuaMethod("clearautohold", "Clears all autohold keys")]
|
||||||
public void ClearAutohold()
|
public void ClearAutohold() => APIs.EmuClient.ClearAutohold();
|
||||||
{
|
|
||||||
MainForm.ClearHolds();
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.closerom( );")]
|
[LuaMethodExample("client.closerom( );")]
|
||||||
[LuaMethod("closerom", "Closes the loaded Rom")]
|
[LuaMethod("closerom", "Closes the loaded Rom")]
|
||||||
public void CloseRom()
|
public void CloseRom() => APIs.EmuClient.CloseRom();
|
||||||
{
|
|
||||||
MainForm.CloseRom();
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.enablerewind( true );")]
|
[LuaMethodExample("client.enablerewind( true );")]
|
||||||
[LuaMethod("enablerewind", "Sets whether or not the rewind feature is enabled")]
|
[LuaMethod("enablerewind", "Sets whether or not the rewind feature is enabled")]
|
||||||
public void EnableRewind(bool enabled)
|
public void EnableRewind(bool enabled) => APIs.EmuClient.EnableRewind(enabled);
|
||||||
{
|
|
||||||
MainForm.EnableRewind(enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.frameskip( 8 );")]
|
[LuaMethodExample("client.frameskip( 8 );")]
|
||||||
[LuaMethod("frameskip", "Sets the frame skip value of the client UI (use 0 to disable)")]
|
[LuaMethod("frameskip", "Sets the frame skip value of the client UI (use 0 to disable)")]
|
||||||
public void FrameSkip(int numFrames)
|
public void FrameSkip(int numFrames)
|
||||||
{
|
{
|
||||||
|
//TODO delegate to APIs.EmuClient (impl uses `> 0` instead of `>= 0`)
|
||||||
if (numFrames >= 0)
|
if (numFrames >= 0)
|
||||||
{
|
{
|
||||||
GlobalWin.Config.FrameSkip = numFrames;
|
GlobalWin.Config.FrameSkip = numFrames;
|
||||||
|
@ -115,21 +92,10 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Use with <see cref="SeekFrame(int)"/> for CamHack.
|
|
||||||
/// Refer to <see cref="MainForm.InvisibleEmulation"/> for the workflow details.
|
|
||||||
/// </summary>
|
|
||||||
[LuaMethodExample("client.invisibleemulation( true );")]
|
[LuaMethodExample("client.invisibleemulation( true );")]
|
||||||
[LuaMethod("invisibleemulation", "Disables and enables emulator updates")]
|
[LuaMethod("invisibleemulation", "Disables and enables emulator updates")]
|
||||||
public void InvisibleEmulation(bool invisible)
|
public void InvisibleEmulation(bool invisible) => APIs.EmuClient.InvisibleEmulation(invisible);
|
||||||
{
|
|
||||||
MainForm.InvisibleEmulation = invisible;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Use with <see cref="InvisibleEmulation(bool)"/> for CamHack.
|
|
||||||
/// Refer to <see cref="MainForm.InvisibleEmulation"/> for the workflow details.
|
|
||||||
/// </summary>
|
|
||||||
[LuaMethodExample("client.seekframe( 100 );")]
|
[LuaMethodExample("client.seekframe( 100 );")]
|
||||||
[LuaMethod("seekframe", "Makes the emulator seek to the frame specified")]
|
[LuaMethod("seekframe", "Makes the emulator seek to the frame specified")]
|
||||||
public void SeekFrame(int frame)
|
public void SeekFrame(int frame)
|
||||||
|
@ -153,62 +119,43 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[LuaMethodExample("local incliget = client.gettargetscanlineintensity( );")]
|
[LuaMethodExample("local incliget = client.gettargetscanlineintensity( );")]
|
||||||
[LuaMethod("gettargetscanlineintensity", "Gets the current scanline intensity setting, used for the scanline display filter")]
|
[LuaMethod("gettargetscanlineintensity", "Gets the current scanline intensity setting, used for the scanline display filter")]
|
||||||
public static int GetTargetScanlineIntensity()
|
public int GetTargetScanlineIntensity() => APIs.EmuClient.GetTargetScanlineIntensity();
|
||||||
{
|
|
||||||
return GlobalWin.Config.TargetScanlineFilterIntensity;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("local incliget = client.getwindowsize( );")]
|
[LuaMethodExample("local incliget = client.getwindowsize( );")]
|
||||||
[LuaMethod("getwindowsize", "Gets the main window's size Possible values are 1, 2, 3, 4, 5, and 10")]
|
[LuaMethod("getwindowsize", "Gets the main window's size Possible values are 1, 2, 3, 4, 5, and 10")]
|
||||||
public int GetWindowSize()
|
public int GetWindowSize()
|
||||||
{
|
{
|
||||||
|
//TODO delegate to APIs.EmuClient (impl's copy of Emulator is weird)
|
||||||
return GlobalWin.Config.TargetZoomFactors[Emulator.SystemId];
|
return GlobalWin.Config.TargetZoomFactors[Emulator.SystemId];
|
||||||
}
|
}
|
||||||
|
|
||||||
[LuaMethodExample("client.SetGameExtraPadding( 5, 10, 15, 20 );")]
|
[LuaMethodExample("client.SetGameExtraPadding( 5, 10, 15, 20 );")]
|
||||||
[LuaMethod("SetGameExtraPadding", "Sets the extra padding added to the 'emu' surface so that you can draw HUD elements in predictable placements")]
|
[LuaMethod("SetGameExtraPadding", "Sets the extra padding added to the 'emu' surface so that you can draw HUD elements in predictable placements")]
|
||||||
public void SetGameExtraPadding(int left, int top, int right, int bottom)
|
public void SetGameExtraPadding(int left, int top, int right, int bottom) => APIs.EmuClient.SetGameExtraPadding(left, top, right, bottom);
|
||||||
{
|
|
||||||
GlobalWin.DisplayManager.GameExtraPadding = new System.Windows.Forms.Padding(left, top, right, bottom);
|
|
||||||
MainForm.FrameBufferResized();
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.SetSoundOn( true );")]
|
[LuaMethodExample("client.SetSoundOn( true );")]
|
||||||
[LuaMethod("SetSoundOn", "Sets the state of the Sound On toggle")]
|
[LuaMethod("SetSoundOn", "Sets the state of the Sound On toggle")]
|
||||||
public static void SetSoundOn(bool enable) => ClientApi.SetSoundOn(enable);
|
public void SetSoundOn(bool enable) => APIs.EmuClient.SetSoundOn(enable);
|
||||||
|
|
||||||
[LuaMethodExample("if ( client.GetSoundOn( ) ) then\r\n\tconsole.log( \"Gets the state of the Sound On toggle\" );\r\nend;")]
|
[LuaMethodExample("if ( client.GetSoundOn( ) ) then\r\n\tconsole.log( \"Gets the state of the Sound On toggle\" );\r\nend;")]
|
||||||
[LuaMethod("GetSoundOn", "Gets the state of the Sound On toggle")]
|
[LuaMethod("GetSoundOn", "Gets the state of the Sound On toggle")]
|
||||||
public static bool GetSoundOn() => ClientApi.GetSoundOn();
|
public bool GetSoundOn() => APIs.EmuClient.GetSoundOn();
|
||||||
|
|
||||||
[LuaMethodExample("client.SetClientExtraPadding( 5, 10, 15, 20 );")]
|
[LuaMethodExample("client.SetClientExtraPadding( 5, 10, 15, 20 );")]
|
||||||
[LuaMethod("SetClientExtraPadding", "Sets the extra padding added to the 'native' surface so that you can draw HUD elements in predictable placements")]
|
[LuaMethod("SetClientExtraPadding", "Sets the extra padding added to the 'native' surface so that you can draw HUD elements in predictable placements")]
|
||||||
public void SetClientExtraPadding(int left, int top, int right, int bottom)
|
public void SetClientExtraPadding(int left, int top, int right, int bottom) => APIs.EmuClient.SetClientExtraPadding(left, top, right, bottom);
|
||||||
{
|
|
||||||
GlobalWin.DisplayManager.ClientExtraPadding = new System.Windows.Forms.Padding(left, top, right, bottom);
|
|
||||||
MainForm.FrameBufferResized();
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("if ( client.ispaused( ) ) then\r\n\tconsole.log( \"Returns true if emulator is paused, otherwise, false\" );\r\nend;")]
|
[LuaMethodExample("if ( client.ispaused( ) ) then\r\n\tconsole.log( \"Returns true if emulator is paused, otherwise, false\" );\r\nend;")]
|
||||||
[LuaMethod("ispaused", "Returns true if emulator is paused, otherwise, false")]
|
[LuaMethod("ispaused", "Returns true if emulator is paused, otherwise, false")]
|
||||||
public bool IsPaused()
|
public bool IsPaused() => APIs.EmuClient.IsPaused();
|
||||||
{
|
|
||||||
return MainForm.EmulatorPaused;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("if ( client.client.isturbo( ) ) then\r\n\tconsole.log( \"Returns true if emulator is in turbo mode, otherwise, false\" );\r\nend;")]
|
[LuaMethodExample("if ( client.client.isturbo( ) ) then\r\n\tconsole.log( \"Returns true if emulator is in turbo mode, otherwise, false\" );\r\nend;")]
|
||||||
[LuaMethod("isturbo", "Returns true if emulator is in turbo mode, otherwise, false")]
|
[LuaMethod("isturbo", "Returns true if emulator is in turbo mode, otherwise, false")]
|
||||||
public bool IsTurbo()
|
public bool IsTurbo() => APIs.EmuClient.IsTurbo();
|
||||||
{
|
|
||||||
return MainForm.IsTurboing;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("if ( client.isseeking( ) ) then\r\n\tconsole.log( \"Returns true if emulator is seeking, otherwise, false\" );\r\nend;")]
|
[LuaMethodExample("if ( client.isseeking( ) ) then\r\n\tconsole.log( \"Returns true if emulator is seeking, otherwise, false\" );\r\nend;")]
|
||||||
[LuaMethod("isseeking", "Returns true if emulator is seeking, otherwise, false")]
|
[LuaMethod("isseeking", "Returns true if emulator is seeking, otherwise, false")]
|
||||||
public bool IsSeeking()
|
public bool IsSeeking() => APIs.EmuClient.IsSeeking();
|
||||||
{
|
|
||||||
return MainForm.IsSeeking;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.opencheats( );")]
|
[LuaMethodExample("client.opencheats( );")]
|
||||||
[LuaMethod("opencheats", "opens the Cheats dialog")]
|
[LuaMethod("opencheats", "opens the Cheats dialog")]
|
||||||
|
@ -228,11 +175,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[LuaMethodExample("client.openrom( \"C:\\\" );")]
|
[LuaMethodExample("client.openrom( \"C:\\\" );")]
|
||||||
[LuaMethod("openrom", "opens the Open ROM dialog")]
|
[LuaMethod("openrom", "opens the Open ROM dialog")]
|
||||||
public void OpenRom(string path)
|
public void OpenRom(string path) => APIs.EmuClient.OpenRom(path);
|
||||||
{
|
|
||||||
var ioa = OpenAdvancedSerializer.ParseWithLegacy(path);
|
|
||||||
MainForm.LoadRom(path, new LoadRomArgs { OpenAdvanced = ioa });
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.opentasstudio( );")]
|
[LuaMethodExample("client.opentasstudio( );")]
|
||||||
[LuaMethod("opentasstudio", "opens the TAStudio dialog")]
|
[LuaMethod("opentasstudio", "opens the TAStudio dialog")]
|
||||||
|
@ -248,80 +191,50 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[LuaMethodExample("client.pause( );")]
|
[LuaMethodExample("client.pause( );")]
|
||||||
[LuaMethod("pause", "Pauses the emulator")]
|
[LuaMethod("pause", "Pauses the emulator")]
|
||||||
public void Pause()
|
public void Pause() => APIs.EmuClient.Pause();
|
||||||
{
|
|
||||||
MainForm.PauseEmulator();
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.pause_av( );")]
|
[LuaMethodExample("client.pause_av( );")]
|
||||||
[LuaMethod("pause_av", "If currently capturing Audio/Video, this will suspend the record. Frames will not be captured into the AV until client.unpause_av() is called")]
|
[LuaMethod("pause_av", "If currently capturing Audio/Video, this will suspend the record. Frames will not be captured into the AV until client.unpause_av() is called")]
|
||||||
public void PauseAv()
|
public void PauseAv() => APIs.EmuClient.PauseAv();
|
||||||
{
|
|
||||||
MainForm.PauseAvi = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.reboot_core( );")]
|
[LuaMethodExample("client.reboot_core( );")]
|
||||||
[LuaMethod("reboot_core", "Reboots the currently loaded core")]
|
[LuaMethod("reboot_core", "Reboots the currently loaded core")]
|
||||||
public void RebootCore()
|
public void RebootCore()
|
||||||
{
|
{
|
||||||
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = true;
|
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = true;
|
||||||
MainForm.RebootCore();
|
APIs.EmuClient.RebootCore();
|
||||||
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = false;
|
((LuaConsole)GlobalWin.Tools.Get<LuaConsole>()).LuaImp.IsRebootingCore = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
[LuaMethodExample("local incliscr = client.screenheight( );")]
|
[LuaMethodExample("local incliscr = client.screenheight( );")]
|
||||||
[LuaMethod("screenheight", "Gets the current height in pixels of the emulator's drawing area")]
|
[LuaMethod("screenheight", "Gets the current height in pixels of the emulator's drawing area")]
|
||||||
public int ScreenHeight()
|
public int ScreenHeight() => APIs.EmuClient.ScreenHeight();
|
||||||
{
|
|
||||||
return MainForm.PresentationPanel.NativeSize.Height;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.screenshot( \"C:\\\" );")]
|
[LuaMethodExample("client.screenshot( \"C:\\\" );")]
|
||||||
[LuaMethod("screenshot", "if a parameter is passed it will function as the Screenshot As menu item of EmuHawk, else it will function as the Screenshot menu item")]
|
[LuaMethod("screenshot", "if a parameter is passed it will function as the Screenshot As menu item of EmuHawk, else it will function as the Screenshot menu item")]
|
||||||
public void Screenshot(string path = null)
|
public void Screenshot(string path = null) => APIs.EmuClient.Screenshot(path);
|
||||||
{
|
|
||||||
if (path == null)
|
|
||||||
{
|
|
||||||
MainForm.TakeScreenshot();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MainForm.TakeScreenshot(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.screenshottoclipboard( );")]
|
[LuaMethodExample("client.screenshottoclipboard( );")]
|
||||||
[LuaMethod("screenshottoclipboard", "Performs the same function as EmuHawk's Screenshot To Clipboard menu item")]
|
[LuaMethod("screenshottoclipboard", "Performs the same function as EmuHawk's Screenshot To Clipboard menu item")]
|
||||||
public void ScreenshotToClipboard()
|
public void ScreenshotToClipboard() => APIs.EmuClient.ScreenshotToClipboard();
|
||||||
{
|
|
||||||
MainForm.TakeScreenshotToClipboard();
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.settargetscanlineintensity( -1000 );")]
|
[LuaMethodExample("client.settargetscanlineintensity( -1000 );")]
|
||||||
[LuaMethod("settargetscanlineintensity", "Sets the current scanline intensity setting, used for the scanline display filter")]
|
[LuaMethod("settargetscanlineintensity", "Sets the current scanline intensity setting, used for the scanline display filter")]
|
||||||
public static void SetTargetScanlineIntensity(int val)
|
public void SetTargetScanlineIntensity(int val) => APIs.EmuClient.SetTargetScanlineIntensity(val);
|
||||||
{
|
|
||||||
GlobalWin.Config.TargetScanlineFilterIntensity = val;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.setscreenshotosd( true );")]
|
[LuaMethodExample("client.setscreenshotosd( true );")]
|
||||||
[LuaMethod("setscreenshotosd", "Sets the screenshot Capture OSD property of the client")]
|
[LuaMethod("setscreenshotosd", "Sets the screenshot Capture OSD property of the client")]
|
||||||
public static void SetScreenshotOSD(bool value)
|
public void SetScreenshotOSD(bool value) => APIs.EmuClient.SetScreenshotOSD(value);
|
||||||
{
|
|
||||||
GlobalWin.Config.ScreenshotCaptureOsd = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("local incliscr = client.screenwidth( );")]
|
[LuaMethodExample("local incliscr = client.screenwidth( );")]
|
||||||
[LuaMethod("screenwidth", "Gets the current width in pixels of the emulator's drawing area")]
|
[LuaMethod("screenwidth", "Gets the current width in pixels of the emulator's drawing area")]
|
||||||
public int ScreenWidth()
|
public int ScreenWidth() => APIs.EmuClient.ScreenWidth();
|
||||||
{
|
|
||||||
return MainForm.PresentationPanel.NativeSize.Width;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.setwindowsize( 100 );")]
|
[LuaMethodExample("client.setwindowsize( 100 );")]
|
||||||
[LuaMethod("setwindowsize", "Sets the main window's size to the give value. Accepted values are 1, 2, 3, 4, 5, and 10")]
|
[LuaMethod("setwindowsize", "Sets the main window's size to the give value. Accepted values are 1, 2, 3, 4, 5, and 10")]
|
||||||
public void SetWindowSize(int size)
|
public void SetWindowSize(int size)
|
||||||
{
|
{
|
||||||
|
//TODO delegate to APIs.EmuClient (impl's copy of Emulator is weird)
|
||||||
if (size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 10)
|
if (size == 1 || size == 2 || size == 3 || size == 4 || size == 5 || size == 10)
|
||||||
{
|
{
|
||||||
GlobalWin.Config.TargetZoomFactors[Emulator.SystemId] = size;
|
GlobalWin.Config.TargetZoomFactors[Emulator.SystemId] = size;
|
||||||
|
@ -336,17 +249,7 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[LuaMethodExample("client.speedmode( 75 );")]
|
[LuaMethodExample("client.speedmode( 75 );")]
|
||||||
[LuaMethod("speedmode", "Sets the speed of the emulator (in terms of percent)")]
|
[LuaMethod("speedmode", "Sets the speed of the emulator (in terms of percent)")]
|
||||||
public void SpeedMode(int percent)
|
public void SpeedMode(int percent) => APIs.EmuClient.SpeedMode(percent);
|
||||||
{
|
|
||||||
if (percent.StrictlyBoundedBy(0.RangeTo(6400)))
|
|
||||||
{
|
|
||||||
MainForm.ClickSpeedItem(percent);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Log("Invalid speed value");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("local curSpeed = client.getconfig().SpeedPercent")]
|
[LuaMethodExample("local curSpeed = client.getconfig().SpeedPercent")]
|
||||||
[LuaMethod("getconfig", "gets the current config settings object")]
|
[LuaMethod("getconfig", "gets the current config settings object")]
|
||||||
|
@ -357,15 +260,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[LuaMethodExample("client.togglepause( );")]
|
[LuaMethodExample("client.togglepause( );")]
|
||||||
[LuaMethod("togglepause", "Toggles the current pause state")]
|
[LuaMethod("togglepause", "Toggles the current pause state")]
|
||||||
public void TogglePause()
|
public void TogglePause() => APIs.EmuClient.TogglePause();
|
||||||
{
|
|
||||||
MainForm.TogglePause();
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("local newY = client.transform_point( 32, 100 ).y;")]
|
[LuaMethodExample("local newY = client.transform_point( 32, 100 ).y;")]
|
||||||
[LuaMethod("transformPoint", "Transforms a point (x, y) in emulator space to a point in client space")]
|
[LuaMethod("transformPoint", "Transforms a point (x, y) in emulator space to a point in client space")]
|
||||||
public LuaTable TransformPoint(int x, int y) {
|
public LuaTable TransformPoint(int x, int y) {
|
||||||
var transformed = ClientApi.TransformPoint(new Point(x, y));
|
var transformed = APIs.EmuClient.TransformPoint(new Point(x, y));
|
||||||
var table = Lua.NewTable();
|
var table = Lua.NewTable();
|
||||||
table["x"] = transformed.X;
|
table["x"] = transformed.X;
|
||||||
table["y"] = transformed.Y;
|
table["y"] = transformed.Y;
|
||||||
|
@ -374,31 +274,19 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[LuaMethodExample("client.unpause( );")]
|
[LuaMethodExample("client.unpause( );")]
|
||||||
[LuaMethod("unpause", "Unpauses the emulator")]
|
[LuaMethod("unpause", "Unpauses the emulator")]
|
||||||
public void Unpause()
|
public void Unpause() => APIs.EmuClient.Unpause();
|
||||||
{
|
|
||||||
MainForm.UnpauseEmulator();
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.unpause_av( );")]
|
[LuaMethodExample("client.unpause_av( );")]
|
||||||
[LuaMethod("unpause_av", "If currently capturing Audio/Video this resumes capturing")]
|
[LuaMethod("unpause_av", "If currently capturing Audio/Video this resumes capturing")]
|
||||||
public void UnpauseAv()
|
public void UnpauseAv() => APIs.EmuClient.UnpauseAv();
|
||||||
{
|
|
||||||
MainForm.PauseAvi = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("local inclixpo = client.xpos( );")]
|
[LuaMethodExample("local inclixpo = client.xpos( );")]
|
||||||
[LuaMethod("xpos", "Returns the x value of the screen position where the client currently sits")]
|
[LuaMethod("xpos", "Returns the x value of the screen position where the client currently sits")]
|
||||||
public int Xpos()
|
public int Xpos() => APIs.EmuClient.Xpos();
|
||||||
{
|
|
||||||
return MainForm.DesktopLocation.X;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("local incliypo = client.ypos( );")]
|
[LuaMethodExample("local incliypo = client.ypos( );")]
|
||||||
[LuaMethod("ypos", "Returns the y value of the screen position where the client currently sits")]
|
[LuaMethod("ypos", "Returns the y value of the screen position where the client currently sits")]
|
||||||
public int Ypos()
|
public int Ypos() => APIs.EmuClient.Ypos();
|
||||||
{
|
|
||||||
return MainForm.DesktopLocation.Y;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("local incbhver = client.getversion( );")]
|
[LuaMethodExample("local incbhver = client.getversion( );")]
|
||||||
[LuaMethod("getversion", "Returns the current stable BizHawk version")]
|
[LuaMethod("getversion", "Returns the current stable BizHawk version")]
|
||||||
|
@ -429,17 +317,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
[LuaMethodExample("client.displaymessages( true );")]
|
[LuaMethodExample("client.displaymessages( true );")]
|
||||||
[LuaMethod("displaymessages", "sets whether or not on screen messages will display")]
|
[LuaMethod("displaymessages", "sets whether or not on screen messages will display")]
|
||||||
public void DisplayMessages(bool value)
|
public void DisplayMessages(bool value) => APIs.EmuClient.DisplayMessages(value);
|
||||||
{
|
|
||||||
GlobalWin.Config.DisplayMessages = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.saveram( );")]
|
[LuaMethodExample("client.saveram( );")]
|
||||||
[LuaMethod("saveram", "flushes save ram to disk")]
|
[LuaMethod("saveram", "flushes save ram to disk")]
|
||||||
public void SaveRam()
|
public void SaveRam() => APIs.EmuClient.SaveRam();
|
||||||
{
|
|
||||||
MainForm.FlushSaveRAM();
|
|
||||||
}
|
|
||||||
|
|
||||||
[LuaMethodExample("client.sleep( 50 );")]
|
[LuaMethodExample("client.sleep( 50 );")]
|
||||||
[LuaMethod("sleep", "sleeps for n milliseconds")]
|
[LuaMethod("sleep", "sleeps for n milliseconds")]
|
||||||
|
|
Loading…
Reference in New Issue