Skip to content

Commit ae12b0e

Browse files
committed
Revert some changes from #1237 and #1380 that aren't needed anymore
1 parent 8c059aa commit ae12b0e

File tree

8 files changed

+41
-54
lines changed

8 files changed

+41
-54
lines changed

BizHawk.Client.EmuHawk/MainForm.Events.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,6 @@ private void ToolsSubMenu_DropDownOpened(object sender, EventArgs e)
13721372
RamSearchMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["RAM Search"].Bindings;
13731373
HexEditorMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Hex Editor"].Bindings;
13741374
LuaConsoleMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Lua Console"].Bindings;
1375-
LuaConsoleMenuItem.Enabled = GlobalWin.Tools.IsAvailable<LuaConsole>();
13761375
CheatsMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Cheats"].Bindings;
13771376
TAStudioMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["TAStudio"].Bindings;
13781377
VirtualPadMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Virtual Pad"].Bindings;

BizHawk.Client.EmuHawk/tools/Lua/Libraries/EmuLuaLibrary.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,7 @@ public override void EndLuaDrawing()
114114
public bool IsRunning { get; set; }
115115
public bool FrameAdvanceRequested { get; private set; }
116116

117-
public override LuaFunctionList GetRegisteredFunctions()
118-
{
119-
return EventsLibrary.RegisteredFunctions;
120-
}
117+
public override LuaFunctionList RegisteredFunctions => EventsLibrary.RegisteredFunctions;
121118

122119
public override void WindowClosed(IntPtr handle)
123120
{

BizHawk.Client.EmuHawk/tools/Lua/Libraries/NotReallyLuaLibrary.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ public override void ExecuteString(string command)
3535
{
3636
}
3737
private static readonly LuaFunctionList EmptyLuaFunList = new LuaFunctionList();
38-
public override LuaFunctionList GetRegisteredFunctions()
39-
{
40-
return EmptyLuaFunList;
41-
}
38+
public override LuaFunctionList RegisteredFunctions => EmptyLuaFunList;
4239
public override void Restart(IEmulatorServiceProvider newServiceProvider)
4340
{
4441
}

BizHawk.Client.EmuHawk/tools/Lua/Libraries/PlatformEmuLuaLibrary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace BizHawk.Client.EmuHawk
1111
public abstract class PlatformEmuLuaLibrary
1212
{
1313
public readonly LuaDocumentation Docs = new LuaDocumentation();
14+
public abstract LuaFunctionList RegisteredFunctions { get; }
1415
public GuiLuaLibrary GuiLibrary => (GuiLuaLibrary) Libraries[typeof(GuiLuaLibrary)];
1516
protected readonly Dictionary<Type, LuaLibraryBase> Libraries = new Dictionary<Type, LuaLibraryBase>();
1617
public IEnumerable<LuaFile> RunningScripts => ScriptList.Where(lf => lf.Enabled);
@@ -27,7 +28,6 @@ public abstract class PlatformEmuLuaLibrary
2728
public abstract void Close();
2829
public abstract void EndLuaDrawing();
2930
public abstract void ExecuteString(string command);
30-
public abstract LuaFunctionList GetRegisteredFunctions();
3131
public abstract void Restart(IEmulatorServiceProvider newServiceProvider);
3232
public abstract EmuLuaLibrary.ResumeResult ResumeScriptFromThreadOf(LuaFile lf);
3333
public abstract void SpawnAndSetFileThread(string pathToLoad, LuaFile lf);

BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public void Restart()
176176
{
177177
LuaImp.CallExitEvent(file);
178178

179-
LuaImp.GetRegisteredFunctions().RemoveAll(lf => lf.Lua == file.Thread);
179+
LuaImp.RegisteredFunctions.RemoveAll(lf => lf.Lua == file.Thread);
180180

181181
UpdateRegisteredFunctionsDialog();
182182

@@ -795,7 +795,7 @@ private void ScriptSubMenu_DropDownOpened(object sender, EventArgs e)
795795

796796
SelectAllMenuItem.Enabled = LuaImp.ScriptList.Any();
797797
StopAllScriptsMenuItem.Enabled = LuaImp.ScriptList.Any(script => script.Enabled);
798-
RegisteredFunctionsMenuItem.Enabled = LuaImp.GetRegisteredFunctions().Any();
798+
RegisteredFunctionsMenuItem.Enabled = LuaImp.RegisteredFunctions.Any();
799799
}
800800

801801
private void NewScriptMenuItem_Click(object sender, EventArgs e)
@@ -857,15 +857,15 @@ private void ToggleScriptMenuItem_Click(object sender, EventArgs e)
857857
foreach (var selectedItem in SelectedItems)
858858
{
859859
var temp = selectedItem;
860-
LuaImp.GetRegisteredFunctions().RemoveAll(lf => lf.Lua == temp.Thread);
860+
LuaImp.RegisteredFunctions.RemoveAll(lf => lf.Lua == temp.Thread);
861861
UpdateRegisteredFunctionsDialog();
862862
}
863863

864864
LuaImp.CallExitEvent(file);
865865
file.Stop();
866866
if (Global.Config.RemoveRegisteredFunctionsOnToggle)
867867
{
868-
LuaImp.GetRegisteredFunctions().ClearAll();
868+
LuaImp.RegisteredFunctions.ClearAll();
869869
}
870870
}
871871
}
@@ -945,7 +945,7 @@ private void RemoveScriptMenuItem_Click(object sender, EventArgs e)
945945
foreach (var item in items)
946946
{
947947
var temp = item;
948-
LuaImp.GetRegisteredFunctions().RemoveAll(x => x.Lua == temp.Thread);
948+
LuaImp.RegisteredFunctions.RemoveAll(x => x.Lua == temp.Thread);
949949

950950
LuaImp.ScriptList.Remove(item);
951951
}
@@ -1064,7 +1064,7 @@ private void StopAllScriptsMenuItem_Click(object sender, EventArgs e)
10641064

10651065
private void RegisteredFunctionsMenuItem_Click(object sender, EventArgs e)
10661066
{
1067-
if (LuaImp.GetRegisteredFunctions().Any())
1067+
if (LuaImp.RegisteredFunctions.Any())
10681068
{
10691069
var alreadyOpen = false;
10701070
foreach (Form form in Application.OpenForms)
@@ -1221,7 +1221,7 @@ private void ScriptListContextMenu_Opening(object sender, CancelEventArgs e)
12211221

12221222
private void ConsoleContextMenu_Opening(object sender, CancelEventArgs e)
12231223
{
1224-
RegisteredFunctionsContextItem.Enabled = LuaImp.GetRegisteredFunctions().Any();
1224+
RegisteredFunctionsContextItem.Enabled = LuaImp.RegisteredFunctions.Any();
12251225
CopyContextItem.Enabled = OutputBox.SelectedText.Any();
12261226
ClearConsoleContextItem.Enabled =
12271227
SelectAllContextItem.Enabled =

BizHawk.Client.EmuHawk/tools/Lua/LuaRegisteredFunctionsList.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public void NewUpdate(ToolFormUpdateType type) { }
1717

1818
public void UpdateValues()
1919
{
20-
if (GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Any())
20+
if (GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.Any())
2121
{
2222
PopulateListView();
2323
}
@@ -46,7 +46,7 @@ private void PopulateListView()
4646
{
4747
FunctionView.Items.Clear();
4848

49-
var nlfs = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().OrderBy(x => x.Event).ThenBy(x => x.Name);
49+
var nlfs = GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.OrderBy(x => x.Event).ThenBy(x => x.Name);
5050
foreach (var nlf in nlfs)
5151
{
5252
var item = new ListViewItem { Text = nlf.Event };
@@ -76,7 +76,7 @@ private void CallFunction()
7676
foreach (int index in indices)
7777
{
7878
var guid = FunctionView.Items[index].SubItems[2].Text;
79-
GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions()[guid].Call();
79+
GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions[guid].Call();
8080
}
8181
}
8282
}
@@ -89,8 +89,8 @@ private void RemoveFunctionButton()
8989
foreach (int index in indices)
9090
{
9191
var guid = FunctionView.Items[index].SubItems[2].Text;
92-
var nlf = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions()[guid];
93-
GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Remove(nlf);
92+
var nlf = GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions[guid];
93+
GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.Remove(nlf);
9494
}
9595

9696
PopulateListView();
@@ -109,7 +109,7 @@ private void FunctionView_DoubleClick(object sender, EventArgs e)
109109

110110
private void RemoveAllBtn_Click(object sender, EventArgs e)
111111
{
112-
GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().ClearAll();
112+
GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.ClearAll();
113113
PopulateListView();
114114
}
115115

@@ -118,7 +118,7 @@ private void DoButtonsStatus()
118118
var indexes = FunctionView.SelectedIndices;
119119
CallButton.Enabled = indexes.Count > 0;
120120
RemoveButton.Enabled = indexes.Count > 0;
121-
RemoveAllBtn.Enabled = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Any();
121+
RemoveAllBtn.Enabled = GlobalWin.Tools.LuaConsole.LuaImp.RegisteredFunctions.Any();
122122
}
123123

124124
private void FunctionView_KeyDown(object sender, KeyEventArgs e)

Bizware/BizHawk.Bizware.BizwareGL.OpenTK/IGL_TK.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public Pipeline CreatePipeline(VertexLayout vertexLayout, Shader vertexShader, S
303303
{
304304
int size, length;
305305
ActiveUniformType type;
306-
string name = new System.Text.StringBuilder(1024).ToString().ToString();
306+
string name = new System.Text.StringBuilder(1024).ToString();
307307
GL.GetActiveUniform(pid, i, 1024, out length, out size, out type, out name);
308308
errcode = GL.GetError();
309309
int loc = GL.GetUniformLocation(pid, name);

Bizware/BizHawk.Bizware.BizwareGL.SlimDX/IGL_SlimDX9.cs

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -298,35 +298,29 @@ BlendOperation ConvertBlendOp(gl.BlendEquationMode glmode)
298298

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

301-
Blend ConvertBlendArg(gl.BlendingFactorSrc glmode)
302-
{
303-
if(glmode == gl.BlendingFactorSrc.Zero) return Blend.Zero;
304-
if(glmode == gl.BlendingFactorSrc.One) return Blend.One;
305-
if(glmode == gl.BlendingFactorSrc.SrcColor) return Blend.SourceColor;
306-
if(glmode == gl.BlendingFactorSrc.OneMinusSrcColor) return Blend.InverseSourceColor;
307-
if(glmode == gl.BlendingFactorSrc.SrcAlpha) return Blend.SourceAlpha;
308-
if(glmode == gl.BlendingFactorSrc.OneMinusSrcAlpha) return Blend.InverseSourceAlpha;
309-
if(glmode == gl.BlendingFactorSrc.DstAlpha) return Blend.DestinationAlpha;
310-
if(glmode == gl.BlendingFactorSrc.OneMinusDstAlpha) return Blend.InverseDestinationAlpha;
311-
if(glmode == gl.BlendingFactorSrc.DstColor) return Blend.DestinationColor;
312-
if(glmode == gl.BlendingFactorSrc.OneMinusDstColor) return Blend.InverseDestinationColor;
313-
if(glmode == gl.BlendingFactorSrc.SrcAlphaSaturate) return Blend.SourceAlphaSaturated;
314-
if(glmode == gl.BlendingFactorSrc.ConstantColor) return Blend.BlendFactor;
315-
if(glmode == gl.BlendingFactorSrc.OneMinusConstantColor) return Blend.InverseBlendFactor;
316-
if(glmode == gl.BlendingFactorSrc.ConstantAlpha) throw new NotSupportedException();
317-
if(glmode == gl.BlendingFactorSrc.OneMinusConstantAlpha) throw new NotSupportedException();
318-
if(glmode == gl.BlendingFactorSrc.Src1Alpha) throw new NotSupportedException();
319-
if(glmode == gl.BlendingFactorSrc.Src1Color) throw new NotSupportedException();
320-
if(glmode == gl.BlendingFactorSrc.OneMinusSrc1Color) throw new NotSupportedException();
321-
if (glmode == gl.BlendingFactorSrc.OneMinusSrc1Alpha) throw new NotSupportedException();
322-
/* Compiles when commented
323-
if(glmode == gl.BlendingFactorSrc.ConstantColorExt) throw new NotSupportedException();
324-
if(glmode == gl.BlendingFactorSrc.OneMinusConstantColorExt) throw new NotSupportedException();
325-
if(glmode == gl.BlendingFactorSrc.ConstantAlphaExt) throw new NotSupportedException();
326-
if(glmode == gl.BlendingFactorSrc.OneMinusConstantAlphaExt) throw new NotSupportedException();
327-
*/
328-
throw new ArgumentOutOfRangeException();
329-
}
301+
Blend ConvertBlendArg(gl.BlendingFactorSrc glmode) => glmode switch
302+
{
303+
gl.BlendingFactorSrc.Zero => Blend.Zero,
304+
gl.BlendingFactorSrc.One => Blend.One,
305+
gl.BlendingFactorSrc.SrcColor => Blend.SourceColor,
306+
gl.BlendingFactorSrc.OneMinusSrcColor => Blend.InverseSourceColor,
307+
gl.BlendingFactorSrc.SrcAlpha => Blend.SourceAlpha,
308+
gl.BlendingFactorSrc.OneMinusSrcAlpha => Blend.InverseSourceAlpha,
309+
gl.BlendingFactorSrc.DstAlpha => Blend.DestinationAlpha,
310+
gl.BlendingFactorSrc.OneMinusDstAlpha => Blend.InverseDestinationAlpha,
311+
gl.BlendingFactorSrc.DstColor => Blend.DestinationColor,
312+
gl.BlendingFactorSrc.OneMinusDstColor => Blend.InverseDestinationColor,
313+
gl.BlendingFactorSrc.SrcAlphaSaturate => Blend.SourceAlphaSaturated,
314+
gl.BlendingFactorSrc.ConstantColor => Blend.BlendFactor,
315+
gl.BlendingFactorSrc.OneMinusConstantColor => Blend.InverseBlendFactor,
316+
gl.BlendingFactorSrc.ConstantAlpha => throw new NotSupportedException(),
317+
gl.BlendingFactorSrc.OneMinusConstantAlpha => throw new NotSupportedException(),
318+
gl.BlendingFactorSrc.Src1Alpha => throw new NotSupportedException(),
319+
gl.BlendingFactorSrc.Src1Color => throw new NotSupportedException(),
320+
gl.BlendingFactorSrc.OneMinusSrc1Color => throw new NotSupportedException(),
321+
gl.BlendingFactorSrc.OneMinusSrc1Alpha => throw new NotSupportedException(),
322+
_ => throw new ArgumentOutOfRangeException()
323+
};
330324

331325
public void SetBlendState(IBlendState rsBlend)
332326
{

0 commit comments

Comments
 (0)