lua - add client.get/set displayfilter() and get/set scanlineintensity()

This commit is contained in:
adelikat 2014-01-02 01:11:00 +00:00
parent 6252c58a3f
commit 3fd6da23a6
1 changed files with 43 additions and 2 deletions

View File

@ -1,10 +1,20 @@
using System; using System;
using System.Collections.Generic;
using BizHawk.Client.Common; using BizHawk.Client.Common;
namespace BizHawk.Client.EmuHawk namespace BizHawk.Client.EmuHawk
{ {
public class MultiClientLuaLibrary : LuaLibraryBase public class MultiClientLuaLibrary : LuaLibraryBase
{ {
private Dictionary<int, string> _filterMappings = new Dictionary<int,string>
{
{ 0, "None" },
{ 1, "x2SAI" },
{ 2, "SuperX2SAI" },
{ 3, "SuperEagle" },
{ 4, "Scanlines" },
};
public MultiClientLuaLibrary(Action<string> logOutputCallback) public MultiClientLuaLibrary(Action<string> logOutputCallback)
: this() : this()
{ {
@ -23,6 +33,8 @@ namespace BizHawk.Client.EmuHawk
"closerom", "closerom",
"enablerewind", "enablerewind",
"frameskip", "frameskip",
"getdisplayfilter",
"gettargetscanlineintensity",
"getwindowsize", "getwindowsize",
"ispaused", "ispaused",
"opencheats", "opencheats",
@ -41,7 +53,9 @@ namespace BizHawk.Client.EmuHawk
"screenshot", "screenshot",
"screenshottoclipboard", "screenshottoclipboard",
"screenwidth", "screenwidth",
"setdisplayfilter",
"setscreenshotosd", "setscreenshotosd",
"settargetscanlineintensity",
"setwindowsize", "setwindowsize",
"speedmode", "speedmode",
"togglepause", "togglepause",
@ -100,9 +114,14 @@ namespace BizHawk.Client.EmuHawk
} }
} }
public static bool client_ispaused() public string client_getdisplayfilter()
{ {
return GlobalWin.MainForm.EmulatorPaused; return _filterMappings[Global.Config.TargetDisplayFilter];
}
private static int client_gettargetscanlineintensity()
{
return Global.Config.TargetScanlineFilterIntensity;
} }
public static int client_getwindowsize() public static int client_getwindowsize()
@ -110,6 +129,11 @@ namespace BizHawk.Client.EmuHawk
return Global.Config.TargetZoomFactor; return Global.Config.TargetZoomFactor;
} }
public static bool client_ispaused()
{
return GlobalWin.MainForm.EmulatorPaused;
}
public static void client_opencheats() public static void client_opencheats()
{ {
GlobalWin.Tools.Load<Cheats>(); GlobalWin.Tools.Load<Cheats>();
@ -192,6 +216,23 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.MainForm.TakeScreenshotToClipboard(); GlobalWin.MainForm.TakeScreenshotToClipboard();
} }
public void client_setdisplayfilter(string filter)
{
foreach (var kvp in _filterMappings)
{
if (String.Equals(kvp.Value, filter, StringComparison.CurrentCultureIgnoreCase))
{
Global.Config.TargetDisplayFilter = kvp.Key;
return;
}
}
}
private static void client_settargetscanlineintensity(int val)
{
Global.Config.TargetScanlineFilterIntensity = val;
}
public static void client_setscreenshotosd(bool value) public static void client_setscreenshotosd(bool value)
{ {
Global.Config.Screenshot_CaptureOSD = value; Global.Config.Screenshot_CaptureOSD = value;