Skip to content

Commit

Permalink
Revert some changes from #1237 and #1380 that aren't needed anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiRulz committed Nov 4, 2019
1 parent 8c059aa commit ae12b0e
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 54 deletions.
1 change: 0 additions & 1 deletion BizHawk.Client.EmuHawk/MainForm.Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,6 @@ private void ToolsSubMenu_DropDownOpened(object sender, EventArgs e)
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;
Expand Down
5 changes: 1 addition & 4 deletions BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,7 @@ public override void EndLuaDrawing()
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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ public override void ExecuteString(string command)
{
}
private static readonly LuaFunctionList EmptyLuaFunList = new LuaFunctionList();
public override LuaFunctionList GetRegisteredFunctions()
{
return EmptyLuaFunList;
}
public override LuaFunctionList RegisteredFunctions => EmptyLuaFunList;
public override void Restart(IEmulatorServiceProvider newServiceProvider)
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -27,7 +28,6 @@ public abstract class PlatformEmuLuaLibrary
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);
Expand Down
14 changes: 7 additions & 7 deletions BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public void Restart()
{
LuaImp.CallExitEvent(file);

LuaImp.GetRegisteredFunctions().RemoveAll(lf => lf.Lua == file.Thread);
LuaImp.RegisteredFunctions.RemoveAll(lf => lf.Lua == file.Thread);

UpdateRegisteredFunctionsDialog();

Expand Down Expand Up @@ -795,7 +795,7 @@ private void ScriptSubMenu_DropDownOpened(object sender, EventArgs e)

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)
Expand Down Expand Up @@ -857,15 +857,15 @@ private void ToggleScriptMenuItem_Click(object sender, EventArgs e)
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();
}

LuaImp.CallExitEvent(file);
file.Stop();
if (Global.Config.RemoveRegisteredFunctionsOnToggle)
{
LuaImp.GetRegisteredFunctions().ClearAll();
LuaImp.RegisteredFunctions.ClearAll();
}
}
}
Expand Down Expand Up @@ -945,7 +945,7 @@ private void RemoveScriptMenuItem_Click(object sender, EventArgs e)
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);
}
Expand Down Expand Up @@ -1064,7 +1064,7 @@ private void StopAllScriptsMenuItem_Click(object sender, EventArgs e)

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)
Expand Down Expand Up @@ -1221,7 +1221,7 @@ private void ScriptListContextMenu_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();
ClearConsoleContextItem.Enabled =
SelectAllContextItem.Enabled =
Expand Down
14 changes: 7 additions & 7 deletions BizHawk.Client.EmuHawk/tools/Lua/LuaRegisteredFunctionsList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void NewUpdate(ToolFormUpdateType type) { }

public void UpdateValues()
{
if (GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Any())
if (GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.Any())
{
PopulateListView();
}
Expand Down Expand Up @@ -46,7 +46,7 @@ private void PopulateListView()
{
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 };
Expand Down Expand Up @@ -76,7 +76,7 @@ private void CallFunction()
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();
}
}
}
Expand All @@ -89,8 +89,8 @@ private void RemoveFunctionButton()
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();
Expand All @@ -109,7 +109,7 @@ private void FunctionView_DoubleClick(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();
}

Expand All @@ -118,7 +118,7 @@ private void DoButtonsStatus()
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)
Expand Down
2 changes: 1 addition & 1 deletion Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public Pipeline CreatePipeline(VertexLayout vertexLayout, Shader vertexShader, S
{
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);
Expand Down
52 changes: 23 additions & 29 deletions Bizware/BizHawk.Bizware.BizwareGL.SlimDX/IGL_SlimDX9.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,35 +298,29 @@ BlendOperation ConvertBlendOp(gl.BlendEquationMode glmode)

Blend ConvertBlendArg(gl.BlendingFactorDest glmode) { return ConvertBlendArg((gl.BlendingFactorSrc)glmode); }

Blend ConvertBlendArg(gl.BlendingFactorSrc glmode)
{
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();
}
Blend ConvertBlendArg(gl.BlendingFactorSrc glmode) => glmode switch
{
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)
{
Expand Down

0 comments on commit ae12b0e

Please sign in to comment.