Revert some changes from #1237 and #1380 that aren't needed anymore

This commit is contained in:
YoshiRulz 2019-11-04 19:50:45 +10:00
parent 8c059aa43c
commit ae12b0e23c
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
8 changed files with 40 additions and 53 deletions

View File

@ -1372,7 +1372,6 @@ namespace BizHawk.Client.EmuHawk
RamSearchMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["RAM Search"].Bindings; RamSearchMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["RAM Search"].Bindings;
HexEditorMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Hex Editor"].Bindings; HexEditorMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Hex Editor"].Bindings;
LuaConsoleMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Lua Console"].Bindings; LuaConsoleMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Lua Console"].Bindings;
LuaConsoleMenuItem.Enabled = GlobalWin.Tools.IsAvailable<LuaConsole>();
CheatsMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Cheats"].Bindings; CheatsMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Cheats"].Bindings;
TAStudioMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["TAStudio"].Bindings; TAStudioMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["TAStudio"].Bindings;
VirtualPadMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Virtual Pad"].Bindings; VirtualPadMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Virtual Pad"].Bindings;

View File

@ -114,10 +114,7 @@ namespace BizHawk.Client.EmuHawk
public bool IsRunning { get; set; } public bool IsRunning { get; set; }
public bool FrameAdvanceRequested { get; private set; } public bool FrameAdvanceRequested { get; private set; }
public override LuaFunctionList GetRegisteredFunctions() public override LuaFunctionList RegisteredFunctions => EventsLibrary.RegisteredFunctions;
{
return EventsLibrary.RegisteredFunctions;
}
public override void WindowClosed(IntPtr handle) public override void WindowClosed(IntPtr handle)
{ {

View File

@ -35,10 +35,7 @@ namespace BizHawk.Client.EmuHawk
{ {
} }
private static readonly LuaFunctionList EmptyLuaFunList = new LuaFunctionList(); private static readonly LuaFunctionList EmptyLuaFunList = new LuaFunctionList();
public override LuaFunctionList GetRegisteredFunctions() public override LuaFunctionList RegisteredFunctions => EmptyLuaFunList;
{
return EmptyLuaFunList;
}
public override void Restart(IEmulatorServiceProvider newServiceProvider) public override void Restart(IEmulatorServiceProvider newServiceProvider)
{ {
} }

View File

@ -11,6 +11,7 @@ namespace BizHawk.Client.EmuHawk
public abstract class PlatformEmuLuaLibrary public abstract class PlatformEmuLuaLibrary
{ {
public readonly LuaDocumentation Docs = new LuaDocumentation(); public readonly LuaDocumentation Docs = new LuaDocumentation();
public abstract LuaFunctionList RegisteredFunctions { get; }
public GuiLuaLibrary GuiLibrary => (GuiLuaLibrary) Libraries[typeof(GuiLuaLibrary)]; public GuiLuaLibrary GuiLibrary => (GuiLuaLibrary) Libraries[typeof(GuiLuaLibrary)];
protected readonly Dictionary<Type, LuaLibraryBase> Libraries = new Dictionary<Type, LuaLibraryBase>(); protected readonly Dictionary<Type, LuaLibraryBase> Libraries = new Dictionary<Type, LuaLibraryBase>();
public IEnumerable<LuaFile> RunningScripts => ScriptList.Where(lf => lf.Enabled); public IEnumerable<LuaFile> RunningScripts => ScriptList.Where(lf => lf.Enabled);
@ -27,7 +28,6 @@ namespace BizHawk.Client.EmuHawk
public abstract void Close(); public abstract void Close();
public abstract void EndLuaDrawing(); public abstract void EndLuaDrawing();
public abstract void ExecuteString(string command); public abstract void ExecuteString(string command);
public abstract LuaFunctionList GetRegisteredFunctions();
public abstract void Restart(IEmulatorServiceProvider newServiceProvider); public abstract void Restart(IEmulatorServiceProvider newServiceProvider);
public abstract EmuLuaLibrary.ResumeResult ResumeScriptFromThreadOf(LuaFile lf); public abstract EmuLuaLibrary.ResumeResult ResumeScriptFromThreadOf(LuaFile lf);
public abstract void SpawnAndSetFileThread(string pathToLoad, LuaFile lf); public abstract void SpawnAndSetFileThread(string pathToLoad, LuaFile lf);

View File

@ -176,7 +176,7 @@ namespace BizHawk.Client.EmuHawk
{ {
LuaImp.CallExitEvent(file); LuaImp.CallExitEvent(file);
LuaImp.GetRegisteredFunctions().RemoveAll(lf => lf.Lua == file.Thread); LuaImp.RegisteredFunctions.RemoveAll(lf => lf.Lua == file.Thread);
UpdateRegisteredFunctionsDialog(); UpdateRegisteredFunctionsDialog();
@ -795,7 +795,7 @@ namespace BizHawk.Client.EmuHawk
SelectAllMenuItem.Enabled = LuaImp.ScriptList.Any(); SelectAllMenuItem.Enabled = LuaImp.ScriptList.Any();
StopAllScriptsMenuItem.Enabled = LuaImp.ScriptList.Any(script => script.Enabled); StopAllScriptsMenuItem.Enabled = LuaImp.ScriptList.Any(script => script.Enabled);
RegisteredFunctionsMenuItem.Enabled = LuaImp.GetRegisteredFunctions().Any(); RegisteredFunctionsMenuItem.Enabled = LuaImp.RegisteredFunctions.Any();
} }
private void NewScriptMenuItem_Click(object sender, EventArgs e) private void NewScriptMenuItem_Click(object sender, EventArgs e)
@ -857,7 +857,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var selectedItem in SelectedItems) foreach (var selectedItem in SelectedItems)
{ {
var temp = selectedItem; var temp = selectedItem;
LuaImp.GetRegisteredFunctions().RemoveAll(lf => lf.Lua == temp.Thread); LuaImp.RegisteredFunctions.RemoveAll(lf => lf.Lua == temp.Thread);
UpdateRegisteredFunctionsDialog(); UpdateRegisteredFunctionsDialog();
} }
@ -865,7 +865,7 @@ namespace BizHawk.Client.EmuHawk
file.Stop(); file.Stop();
if (Global.Config.RemoveRegisteredFunctionsOnToggle) if (Global.Config.RemoveRegisteredFunctionsOnToggle)
{ {
LuaImp.GetRegisteredFunctions().ClearAll(); LuaImp.RegisteredFunctions.ClearAll();
} }
} }
} }
@ -945,7 +945,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var item in items) foreach (var item in items)
{ {
var temp = item; var temp = item;
LuaImp.GetRegisteredFunctions().RemoveAll(x => x.Lua == temp.Thread); LuaImp.RegisteredFunctions.RemoveAll(x => x.Lua == temp.Thread);
LuaImp.ScriptList.Remove(item); LuaImp.ScriptList.Remove(item);
} }
@ -1064,7 +1064,7 @@ namespace BizHawk.Client.EmuHawk
private void RegisteredFunctionsMenuItem_Click(object sender, EventArgs e) private void RegisteredFunctionsMenuItem_Click(object sender, EventArgs e)
{ {
if (LuaImp.GetRegisteredFunctions().Any()) if (LuaImp.RegisteredFunctions.Any())
{ {
var alreadyOpen = false; var alreadyOpen = false;
foreach (Form form in Application.OpenForms) foreach (Form form in Application.OpenForms)
@ -1221,7 +1221,7 @@ namespace BizHawk.Client.EmuHawk
private void ConsoleContextMenu_Opening(object sender, CancelEventArgs e) private void ConsoleContextMenu_Opening(object sender, CancelEventArgs e)
{ {
RegisteredFunctionsContextItem.Enabled = LuaImp.GetRegisteredFunctions().Any(); RegisteredFunctionsContextItem.Enabled = LuaImp.RegisteredFunctions.Any();
CopyContextItem.Enabled = OutputBox.SelectedText.Any(); CopyContextItem.Enabled = OutputBox.SelectedText.Any();
ClearConsoleContextItem.Enabled = ClearConsoleContextItem.Enabled =
SelectAllContextItem.Enabled = SelectAllContextItem.Enabled =

View File

@ -17,7 +17,7 @@ namespace BizHawk.Client.EmuHawk
public void UpdateValues() public void UpdateValues()
{ {
if (GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Any()) if (GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.Any())
{ {
PopulateListView(); PopulateListView();
} }
@ -46,7 +46,7 @@ namespace BizHawk.Client.EmuHawk
{ {
FunctionView.Items.Clear(); FunctionView.Items.Clear();
var nlfs = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().OrderBy(x => x.Event).ThenBy(x => x.Name); var nlfs = GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.OrderBy(x => x.Event).ThenBy(x => x.Name);
foreach (var nlf in nlfs) foreach (var nlf in nlfs)
{ {
var item = new ListViewItem { Text = nlf.Event }; var item = new ListViewItem { Text = nlf.Event };
@ -76,7 +76,7 @@ namespace BizHawk.Client.EmuHawk
foreach (int index in indices) foreach (int index in indices)
{ {
var guid = FunctionView.Items[index].SubItems[2].Text; var guid = FunctionView.Items[index].SubItems[2].Text;
GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions()[guid].Call(); GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions[guid].Call();
} }
} }
} }
@ -89,8 +89,8 @@ namespace BizHawk.Client.EmuHawk
foreach (int index in indices) foreach (int index in indices)
{ {
var guid = FunctionView.Items[index].SubItems[2].Text; var guid = FunctionView.Items[index].SubItems[2].Text;
var nlf = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions()[guid]; var nlf = GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions[guid];
GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Remove(nlf); GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.Remove(nlf);
} }
PopulateListView(); PopulateListView();
@ -109,7 +109,7 @@ namespace BizHawk.Client.EmuHawk
private void RemoveAllBtn_Click(object sender, EventArgs e) private void RemoveAllBtn_Click(object sender, EventArgs e)
{ {
GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().ClearAll(); GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.ClearAll();
PopulateListView(); PopulateListView();
} }
@ -118,7 +118,7 @@ namespace BizHawk.Client.EmuHawk
var indexes = FunctionView.SelectedIndices; var indexes = FunctionView.SelectedIndices;
CallButton.Enabled = indexes.Count > 0; CallButton.Enabled = indexes.Count > 0;
RemoveButton.Enabled = indexes.Count > 0; RemoveButton.Enabled = indexes.Count > 0;
RemoveAllBtn.Enabled = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Any(); RemoveAllBtn.Enabled = GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.Any();
} }
private void FunctionView_KeyDown(object sender, KeyEventArgs e) private void FunctionView_KeyDown(object sender, KeyEventArgs e)

View File

@ -303,7 +303,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
{ {
int size, length; int size, length;
ActiveUniformType type; ActiveUniformType type;
string name = new System.Text.StringBuilder(1024).ToString().ToString(); string name = new System.Text.StringBuilder(1024).ToString();
GL.GetActiveUniform(pid, i, 1024, out length, out size, out type, out name); GL.GetActiveUniform(pid, i, 1024, out length, out size, out type, out name);
errcode = GL.GetError(); errcode = GL.GetError();
int loc = GL.GetUniformLocation(pid, name); int loc = GL.GetUniformLocation(pid, name);

View File

@ -298,35 +298,29 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.SlimDX
Blend ConvertBlendArg(gl.BlendingFactorDest glmode) { return ConvertBlendArg((gl.BlendingFactorSrc)glmode); } Blend ConvertBlendArg(gl.BlendingFactorDest glmode) { return ConvertBlendArg((gl.BlendingFactorSrc)glmode); }
Blend ConvertBlendArg(gl.BlendingFactorSrc glmode) Blend ConvertBlendArg(gl.BlendingFactorSrc glmode) => glmode switch
{ {
if(glmode == gl.BlendingFactorSrc.Zero) return Blend.Zero; gl.BlendingFactorSrc.Zero => Blend.Zero,
if(glmode == gl.BlendingFactorSrc.One) return Blend.One; gl.BlendingFactorSrc.One => Blend.One,
if(glmode == gl.BlendingFactorSrc.SrcColor) return Blend.SourceColor; gl.BlendingFactorSrc.SrcColor => Blend.SourceColor,
if(glmode == gl.BlendingFactorSrc.OneMinusSrcColor) return Blend.InverseSourceColor; gl.BlendingFactorSrc.OneMinusSrcColor => Blend.InverseSourceColor,
if(glmode == gl.BlendingFactorSrc.SrcAlpha) return Blend.SourceAlpha; gl.BlendingFactorSrc.SrcAlpha => Blend.SourceAlpha,
if(glmode == gl.BlendingFactorSrc.OneMinusSrcAlpha) return Blend.InverseSourceAlpha; gl.BlendingFactorSrc.OneMinusSrcAlpha => Blend.InverseSourceAlpha,
if(glmode == gl.BlendingFactorSrc.DstAlpha) return Blend.DestinationAlpha; gl.BlendingFactorSrc.DstAlpha => Blend.DestinationAlpha,
if(glmode == gl.BlendingFactorSrc.OneMinusDstAlpha) return Blend.InverseDestinationAlpha; gl.BlendingFactorSrc.OneMinusDstAlpha => Blend.InverseDestinationAlpha,
if(glmode == gl.BlendingFactorSrc.DstColor) return Blend.DestinationColor; gl.BlendingFactorSrc.DstColor => Blend.DestinationColor,
if(glmode == gl.BlendingFactorSrc.OneMinusDstColor) return Blend.InverseDestinationColor; gl.BlendingFactorSrc.OneMinusDstColor => Blend.InverseDestinationColor,
if(glmode == gl.BlendingFactorSrc.SrcAlphaSaturate) return Blend.SourceAlphaSaturated; gl.BlendingFactorSrc.SrcAlphaSaturate => Blend.SourceAlphaSaturated,
if(glmode == gl.BlendingFactorSrc.ConstantColor) return Blend.BlendFactor; gl.BlendingFactorSrc.ConstantColor => Blend.BlendFactor,
if(glmode == gl.BlendingFactorSrc.OneMinusConstantColor) return Blend.InverseBlendFactor; gl.BlendingFactorSrc.OneMinusConstantColor => Blend.InverseBlendFactor,
if(glmode == gl.BlendingFactorSrc.ConstantAlpha) throw new NotSupportedException(); gl.BlendingFactorSrc.ConstantAlpha => throw new NotSupportedException(),
if(glmode == gl.BlendingFactorSrc.OneMinusConstantAlpha) throw new NotSupportedException(); gl.BlendingFactorSrc.OneMinusConstantAlpha => throw new NotSupportedException(),
if(glmode == gl.BlendingFactorSrc.Src1Alpha) throw new NotSupportedException(); gl.BlendingFactorSrc.Src1Alpha => throw new NotSupportedException(),
if(glmode == gl.BlendingFactorSrc.Src1Color) throw new NotSupportedException(); gl.BlendingFactorSrc.Src1Color => throw new NotSupportedException(),
if(glmode == gl.BlendingFactorSrc.OneMinusSrc1Color) throw new NotSupportedException(); gl.BlendingFactorSrc.OneMinusSrc1Color => throw new NotSupportedException(),
if (glmode == gl.BlendingFactorSrc.OneMinusSrc1Alpha) throw new NotSupportedException(); gl.BlendingFactorSrc.OneMinusSrc1Alpha => throw new NotSupportedException(),
/* Compiles when commented _ => throw new ArgumentOutOfRangeException()
if(glmode == gl.BlendingFactorSrc.ConstantColorExt) throw new NotSupportedException(); };
if(glmode == gl.BlendingFactorSrc.OneMinusConstantColorExt) throw new NotSupportedException();
if(glmode == gl.BlendingFactorSrc.ConstantAlphaExt) throw new NotSupportedException();
if(glmode == gl.BlendingFactorSrc.OneMinusConstantAlphaExt) throw new NotSupportedException();
*/
throw new ArgumentOutOfRangeException();
}
public void SetBlendState(IBlendState rsBlend) public void SetBlendState(IBlendState rsBlend)
{ {