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;
HexEditorMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Hex Editor"].Bindings;
LuaConsoleMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Lua Console"].Bindings;
LuaConsoleMenuItem.Enabled = GlobalWin.Tools.IsAvailable<LuaConsole>();
CheatsMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Cheats"].Bindings;
TAStudioMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["TAStudio"].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 FrameAdvanceRequested { get; private set; }
public override LuaFunctionList GetRegisteredFunctions()
{
return EventsLibrary.RegisteredFunctions;
}
public override LuaFunctionList RegisteredFunctions => EventsLibrary.RegisteredFunctions;
public override void WindowClosed(IntPtr handle)
{

View File

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

View File

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

View File

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

View File

@ -17,7 +17,7 @@ namespace BizHawk.Client.EmuHawk
public void UpdateValues()
{
if (GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Any())
if (GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.Any())
{
PopulateListView();
}
@ -46,7 +46,7 @@ namespace BizHawk.Client.EmuHawk
{
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)
{
var item = new ListViewItem { Text = nlf.Event };
@ -76,7 +76,7 @@ namespace BizHawk.Client.EmuHawk
foreach (int index in indices)
{
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)
{
var guid = FunctionView.Items[index].SubItems[2].Text;
var nlf = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions()[guid];
GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Remove(nlf);
var nlf = GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions[guid];
GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.Remove(nlf);
}
PopulateListView();
@ -109,7 +109,7 @@ namespace BizHawk.Client.EmuHawk
private void RemoveAllBtn_Click(object sender, EventArgs e)
{
GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().ClearAll();
GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.ClearAll();
PopulateListView();
}
@ -118,7 +118,7 @@ namespace BizHawk.Client.EmuHawk
var indexes = FunctionView.SelectedIndices;
CallButton.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)

View File

@ -303,7 +303,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.OpenTK
{
int size, length;
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);
errcode = GL.GetError();
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.BlendingFactorSrc glmode)
Blend ConvertBlendArg(gl.BlendingFactorSrc glmode) => glmode switch
{
if(glmode == gl.BlendingFactorSrc.Zero) return Blend.Zero;
if(glmode == gl.BlendingFactorSrc.One) return Blend.One;
if(glmode == gl.BlendingFactorSrc.SrcColor) return Blend.SourceColor;
if(glmode == gl.BlendingFactorSrc.OneMinusSrcColor) return Blend.InverseSourceColor;
if(glmode == gl.BlendingFactorSrc.SrcAlpha) return Blend.SourceAlpha;
if(glmode == gl.BlendingFactorSrc.OneMinusSrcAlpha) return Blend.InverseSourceAlpha;
if(glmode == gl.BlendingFactorSrc.DstAlpha) return Blend.DestinationAlpha;
if(glmode == gl.BlendingFactorSrc.OneMinusDstAlpha) return Blend.InverseDestinationAlpha;
if(glmode == gl.BlendingFactorSrc.DstColor) return Blend.DestinationColor;
if(glmode == gl.BlendingFactorSrc.OneMinusDstColor) return Blend.InverseDestinationColor;
if(glmode == gl.BlendingFactorSrc.SrcAlphaSaturate) return Blend.SourceAlphaSaturated;
if(glmode == gl.BlendingFactorSrc.ConstantColor) return Blend.BlendFactor;
if(glmode == gl.BlendingFactorSrc.OneMinusConstantColor) return Blend.InverseBlendFactor;
if(glmode == gl.BlendingFactorSrc.ConstantAlpha) throw new NotSupportedException();
if(glmode == gl.BlendingFactorSrc.OneMinusConstantAlpha) throw new NotSupportedException();
if(glmode == gl.BlendingFactorSrc.Src1Alpha) throw new NotSupportedException();
if(glmode == gl.BlendingFactorSrc.Src1Color) throw new NotSupportedException();
if(glmode == gl.BlendingFactorSrc.OneMinusSrc1Color) throw new NotSupportedException();
if (glmode == gl.BlendingFactorSrc.OneMinusSrc1Alpha) throw new NotSupportedException();
/* Compiles when commented
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();
}
gl.BlendingFactorSrc.Zero => Blend.Zero,
gl.BlendingFactorSrc.One => Blend.One,
gl.BlendingFactorSrc.SrcColor => Blend.SourceColor,
gl.BlendingFactorSrc.OneMinusSrcColor => Blend.InverseSourceColor,
gl.BlendingFactorSrc.SrcAlpha => Blend.SourceAlpha,
gl.BlendingFactorSrc.OneMinusSrcAlpha => Blend.InverseSourceAlpha,
gl.BlendingFactorSrc.DstAlpha => Blend.DestinationAlpha,
gl.BlendingFactorSrc.OneMinusDstAlpha => Blend.InverseDestinationAlpha,
gl.BlendingFactorSrc.DstColor => Blend.DestinationColor,
gl.BlendingFactorSrc.OneMinusDstColor => Blend.InverseDestinationColor,
gl.BlendingFactorSrc.SrcAlphaSaturate => Blend.SourceAlphaSaturated,
gl.BlendingFactorSrc.ConstantColor => Blend.BlendFactor,
gl.BlendingFactorSrc.OneMinusConstantColor => Blend.InverseBlendFactor,
gl.BlendingFactorSrc.ConstantAlpha => throw new NotSupportedException(),
gl.BlendingFactorSrc.OneMinusConstantAlpha => throw new NotSupportedException(),
gl.BlendingFactorSrc.Src1Alpha => throw new NotSupportedException(),
gl.BlendingFactorSrc.Src1Color => throw new NotSupportedException(),
gl.BlendingFactorSrc.OneMinusSrc1Color => throw new NotSupportedException(),
gl.BlendingFactorSrc.OneMinusSrc1Alpha => throw new NotSupportedException(),
_ => throw new ArgumentOutOfRangeException()
};
public void SetBlendState(IBlendState rsBlend)
{