Skip to content

Commit 41faf25

Browse files
committed
Remove most of (old) BSNES' managed source and callsites
1 parent 4f72995 commit 41faf25

38 files changed

+10
-4744
lines changed

src/BizHawk.Client.Common/Api/Classes/EmulationApi.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using BizHawk.Emulation.Cores.Nintendo.BSNES;
1212
using BizHawk.Emulation.Cores.Nintendo.NES;
1313
using BizHawk.Emulation.Cores.Consoles.Nintendo.NDS;
14-
using BizHawk.Emulation.Cores.Nintendo.SNES;
1514
using BizHawk.Emulation.Cores.PCEngine;
1615
using BizHawk.Emulation.Cores.Sega.MasterSystem;
1716
using BizHawk.Emulation.Cores.WonderSwan;
@@ -195,7 +194,6 @@ public void SetLagCount(int count)
195194

196195
public object? GetSettings() => Emulator switch // (select) cores A-Z by value of `CoreAttribute.CoreName`
197196
{
198-
LibsnesCore snes => snes.GetSettings(),
199197
WonderSwan ws => ws.GetSettings(),
200198
GPGX gpgx => gpgx.GetSettings(),
201199
NDS nds => nds.GetSettings(),
@@ -208,7 +206,6 @@ public void SetLagCount(int count)
208206

209207
public PutSettingsDirtyBits PutSettings(object settings) => Emulator switch // (select) cores A-Z by value of `CoreAttribute.CoreName`
210208
{
211-
LibsnesCore snes => snes.PutSettings((LibsnesCore.SnesSettings) settings),
212209
WonderSwan ws => ws.PutSettings((WonderSwan.Settings) settings),
213210
GPGX gpgx => gpgx.PutSettings((GPGX.GPGXSettings) settings),
214211
NDS nds => nds.PutSettings((NDS.NDSSettings) settings),
@@ -223,19 +220,6 @@ public void SetRenderPlanes(params bool[] args)
223220
{
224221
static bool GetSetting(bool[] settings, int index) => index >= settings.Length || settings[index];
225222
// (select) cores A-Z by value of `CoreAttribute.CoreName`
226-
void SetLibsnes(LibsnesCore core)
227-
{
228-
var s = core.GetSettings();
229-
s.ShowBG1_0 = s.ShowBG1_1 = GetSetting(args, 0);
230-
s.ShowBG2_0 = s.ShowBG2_1 = GetSetting(args, 1);
231-
s.ShowBG3_0 = s.ShowBG3_1 = GetSetting(args, 2);
232-
s.ShowBG4_0 = s.ShowBG4_1 = GetSetting(args, 3);
233-
s.ShowOBJ_0 = GetSetting(args, 4);
234-
s.ShowOBJ_1 = GetSetting(args, 5);
235-
s.ShowOBJ_2 = GetSetting(args, 6);
236-
s.ShowOBJ_3 = GetSetting(args, 7);
237-
core.PutSettings(s);
238-
}
239223
void SetBsnes(ISettable<BsnesCore.SnesSettings, BsnesCore.SnesSyncSettings> settingsProvider)
240224
{
241225
var s = settingsProvider.GetSettings();
@@ -319,9 +303,6 @@ void SetSnes9x(Snes9x core)
319303
// (select) cores A-Z by value of `CoreAttribute.CoreName`
320304
switch (Emulator)
321305
{
322-
case LibsnesCore snes:
323-
SetLibsnes(snes);
324-
break;
325306
case BsnesCore bsnes:
326307
SetBsnes(bsnes);
327308
break;

src/BizHawk.Client.Common/RomLoader.cs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using BizHawk.Emulation.Cores;
1111
using BizHawk.Emulation.Cores.Libretro;
1212
using BizHawk.Emulation.Cores.Nintendo.Sameboy;
13-
using BizHawk.Emulation.Cores.Nintendo.SNES;
1413
using BizHawk.Emulation.Cores.Sony.PSX;
1514
using BizHawk.Emulation.Cores.Arcades.MAME;
1615
using BizHawk.Emulation.DiscSystem;
@@ -709,28 +708,8 @@ private bool LoadXML(string path, CoreComm nextComm, HawkFile file, string force
709708
}
710709
catch (Exception ex)
711710
{
712-
try
713-
{
714-
// need to get rid of this hack at some point
715-
rom = new RomGame(file);
716-
game = rom.GameInfo;
717-
game.System = VSystemID.Raw.SNES;
718-
nextEmulator = new LibsnesCore(
719-
game,
720-
null,
721-
rom.FileData,
722-
Path.GetDirectoryName(path.SubstringBefore('|')),
723-
nextComm,
724-
GetCoreSettings<LibsnesCore, LibsnesCore.SnesSettings>(),
725-
GetCoreSyncSettings<LibsnesCore, LibsnesCore.SnesSyncSettings>()
726-
);
727-
return true;
728-
}
729-
catch
730-
{
731-
DoLoadErrorCallback(ex.ToString(), VSystemID.Raw.GBL, LoadErrorType.Xml);
732-
return false;
733-
}
711+
DoLoadErrorCallback(ex.ToString(), VSystemID.Raw.GBL, LoadErrorType.Xml);
712+
return false;
734713
}
735714
}
736715

src/BizHawk.Client.Common/config/Config.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class Config
3535
([ VSystemID.Raw.GBL ],
3636
[ CoreNames.GambatteLink, CoreNames.GBHawkLink, CoreNames.GBHawkLink3x, CoreNames.GBHawkLink4x ]),
3737
([ VSystemID.Raw.SGB ],
38-
[ CoreNames.Gambatte, CoreNames.Bsnes115, CoreNames.SubBsnes115, CoreNames.Bsnes ]),
38+
[ CoreNames.Gambatte, CoreNames.Bsnes115, CoreNames.SubBsnes115 ]),
3939
([ VSystemID.Raw.N64 ],
4040
[ CoreNames.Mupen64Plus, CoreNames.Ares64 ]),
4141
([ VSystemID.Raw.NES ],
@@ -47,7 +47,7 @@ public class Config
4747
([ VSystemID.Raw.SMS, VSystemID.Raw.GG, VSystemID.Raw.SG ],
4848
[ CoreNames.Gpgx, CoreNames.SMSHawk ]),
4949
([ VSystemID.Raw.SNES ],
50-
[ CoreNames.Snes9X, CoreNames.Bsnes115, CoreNames.SubBsnes115, CoreNames.Faust, CoreNames.Bsnes ]),
50+
[ CoreNames.Snes9X, CoreNames.Bsnes115, CoreNames.SubBsnes115, CoreNames.Faust ]),
5151
([ VSystemID.Raw.TI83 ],
5252
[ CoreNames.Emu83, CoreNames.TI83Hawk ]),
5353
};

src/BizHawk.Client.EmuHawk/Extensions/CoreExtensions.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using BizHawk.Emulation.Common;
44
using BizHawk.Emulation.Cores.Consoles.Nintendo.QuickNES;
55
using BizHawk.Emulation.Cores.Nintendo.BSNES;
6-
using BizHawk.Emulation.Cores.Nintendo.SNES;
76
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
87
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
98
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
@@ -28,7 +27,7 @@ public static Bitmap Icon(this IEmulator core)
2827
// (select) cores A-Z by value of `CoreAttribute.CoreName`
2928
return core switch
3029
{
31-
BsnesCore or LibsnesCore or SubBsnesCore => Properties.Resources.Bsnes,
30+
BsnesCore or SubBsnesCore => Properties.Resources.Bsnes,
3231
Gameboy => Properties.Resources.Gambatte,
3332
GPGX => Properties.Resources.GenPlus,
3433
MAME => Properties.Resources.Mame,

src/BizHawk.Client.EmuHawk/MainForm.VSystem.cs

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
using BizHawk.Emulation.Cores.Nintendo.N64;
5353
using BizHawk.Emulation.Cores.Nintendo.NES;
5454
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
55-
using BizHawk.Emulation.Cores.Nintendo.SNES;
5655
using BizHawk.Emulation.Cores.Nintendo.Sameboy;
5756
using BizHawk.Emulation.Cores.Nintendo.SubGBHawk;
5857
using BizHawk.Emulation.Cores.Nintendo.SubNESHawk;
@@ -736,12 +735,6 @@ private void PsxSubMenu_DropDownOpened(object sender, EventArgs e)
736735

737736

738737

739-
private DialogResult OpenOldBSNESGamepadSettingsDialog(ISettingsAdapter settable)
740-
{
741-
using SNESControllerSettings form = new(settable);
742-
return this.ShowDialogWithTempMute(form);
743-
}
744-
745738
private DialogResult OpenBSNESGamepadSettingsDialog(ISettingsAdapter settable)
746739
{
747740
using BSNESControllerSettings form = new(settable);
@@ -751,7 +744,6 @@ private DialogResult OpenBSNESGamepadSettingsDialog(ISettingsAdapter settable)
751744
private void SNESControllerConfigurationMenuItem_Click(object sender, EventArgs e)
752745
=> _ = Emulator switch
753746
{
754-
LibsnesCore => OpenOldBSNESGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<LibsnesCore>()),
755747
BsnesCore => OpenBSNESGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<BsnesCore>()),
756748
SubBsnesCore => OpenBSNESGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<SubBsnesCore>()),
757749
_ => DialogResult.None,
@@ -760,16 +752,12 @@ private void SNESControllerConfigurationMenuItem_Click(object sender, EventArgs
760752
private void SnesGfxDebuggerMenuItem_Click(object sender, EventArgs e)
761753
=> Tools.Load<SNESGraphicsDebugger>();
762754

763-
private DialogResult OpenOldBSNESSettingsDialog(ISettingsAdapter settable)
764-
=> SNESOptions.DoSettingsDialog(this, settable);
765-
766755
private DialogResult OpenBSNESSettingsDialog(ISettingsAdapter settable)
767756
=> BSNESOptions.DoSettingsDialog(this, settable);
768757

769758
private void SnesOptionsMenuItem_Click(object sender, EventArgs e)
770759
=> _ = Emulator switch
771760
{
772-
LibsnesCore => OpenOldBSNESSettingsDialog(GetSettingsAdapterForLoadedCore<LibsnesCore>()),
773761
BsnesCore => OpenBSNESSettingsDialog(GetSettingsAdapterForLoadedCore<BsnesCore>()),
774762
SubBsnesCore => OpenBSNESSettingsDialog(GetSettingsAdapterForLoadedCore<SubBsnesCore>()),
775763
_ => DialogResult.None,
@@ -807,27 +795,6 @@ private void SNES_ToggleBg(int layer)
807795
settingsProvider.PutSettings(s);
808796
break;
809797
}
810-
case LibsnesCore libsnes:
811-
{
812-
var s = libsnes.GetSettings();
813-
switch (layer)
814-
{
815-
case 1:
816-
result = s.ShowBG1_0 = s.ShowBG1_1 = !s.ShowBG1_1;
817-
break;
818-
case 2:
819-
result = s.ShowBG2_0 = s.ShowBG2_1 = !s.ShowBG2_1;
820-
break;
821-
case 3:
822-
result = s.ShowBG3_0 = s.ShowBG3_1 = !s.ShowBG3_1;
823-
break;
824-
case 4:
825-
result = s.ShowBG4_0 = s.ShowBG4_1 = !s.ShowBG4_1;
826-
break;
827-
}
828-
libsnes.PutSettings(s);
829-
break;
830-
}
831798
case Snes9x snes9X:
832799
{
833800
var s = snes9X.GetSettings();
@@ -873,20 +840,6 @@ private void SNES_ToggleObj(int layer)
873840
bsnes.PutSettings(s);
874841
AddOnScreenMessage($"Obj {layer} Layer {(result ? "On" : "Off")}");
875842
}
876-
else if (Emulator is LibsnesCore bsnes1)
877-
{
878-
var s = bsnes1.GetSettings();
879-
result = layer switch
880-
{
881-
1 => s.ShowOBJ_0 = !s.ShowOBJ_0,
882-
2 => s.ShowOBJ_1 = !s.ShowOBJ_1,
883-
3 => s.ShowOBJ_2 = !s.ShowOBJ_2,
884-
4 => s.ShowOBJ_3 = !s.ShowOBJ_3,
885-
_ => result,
886-
};
887-
bsnes1.PutSettings(s);
888-
AddOnScreenMessage($"Obj {layer} Layer {(result ? "On" : "Off")}");
889-
}
890843
else if (Emulator is Snes9x snes9X)
891844
{
892845
var s = snes9X.GetSettings();
@@ -1147,13 +1100,6 @@ ToolStripMenuItemEx CreateCoreSubmenu(VSystemCategory cat, string coreName, para
11471100
// Atari2600Hawk
11481101
items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Atari2600Hawk, CreateGenericCoreConfigItem<Atari2600>(CoreNames.Atari2600Hawk)));
11491102

1150-
// BSNES
1151-
var oldBSNESGamepadSettingsItem = CreateSettingsItem("Controller Configuration...", (_, _) => OpenOldBSNESGamepadSettingsDialog(GetSettingsAdapterFor<LibsnesCore>()));
1152-
var oldBSNESSettingsItem = CreateSettingsItem("Options...", (_, _) => OpenOldBSNESSettingsDialog(GetSettingsAdapterFor<LibsnesCore>()));
1153-
var oldBSNESSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Bsnes, oldBSNESGamepadSettingsItem, oldBSNESSettingsItem);
1154-
oldBSNESSubmenu.DropDownOpened += (_, _) => oldBSNESGamepadSettingsItem.Enabled = MovieSession.Movie.NotActive() || Emulator is not LibsnesCore;
1155-
items.Add(oldBSNESSubmenu);
1156-
11571103
// BSNESv115+
11581104
var bsnesGamepadSettingsItem = CreateSettingsItem("Controller Configuration...", (_, _) => OpenBSNESGamepadSettingsDialog(GetSettingsAdapterFor<BsnesCore>()));
11591105
var bsnesSettingsItem = CreateSettingsItem("Options...", (_, _) => OpenBSNESSettingsDialog(GetSettingsAdapterFor<BsnesCore>()));
@@ -1525,10 +1471,6 @@ private void HandlePlatformMenus()
15251471
GBSubMenu.Visible = true;
15261472
SameBoyColorChooserMenuItem.Visible = Emulator is Sameboy { IsCGBMode: false }; // palette config only works in DMG mode
15271473
break;
1528-
case VSystemID.Raw.SNES when Emulator is LibsnesCore oldBSNES: // doesn't use "SGB" sysID, always "SNES"
1529-
SNESSubMenu.Text = oldBSNES.IsSGB ? "&SGB" : "&SNES";
1530-
SNESSubMenu.Visible = true;
1531-
break;
15321474
case var _ when Emulator is BsnesCore or SubBsnesCore:
15331475
SNESSubMenu.Text = $"&{sysID}";
15341476
SNESSubMenu.Visible = true;

src/BizHawk.Client.EmuHawk/MainForm.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
using BizHawk.Emulation.Cores.Consoles.SNK;
3333
using BizHawk.Emulation.Cores.Nintendo.GBA;
3434
using BizHawk.Emulation.Cores.Nintendo.NES;
35-
using BizHawk.Emulation.Cores.Nintendo.SNES;
3635

3736
using BizHawk.Emulation.DiscSystem;
3837

@@ -3604,12 +3603,6 @@ public string SaveStatePrefix()
36043603
var name = Game.FilesystemSafeName();
36053604
name += $".{Emulator.Attributes().CoreName}";
36063605

3607-
// Bsnes profiles have incompatible savestates so save the profile name
3608-
if (Emulator is LibsnesCore bsnes)
3609-
{
3610-
name += $".{bsnes.CurrentProfile}";
3611-
}
3612-
36133606
if (MovieSession.Movie.IsActive())
36143607
{
36153608
name += $".{Path.GetFileNameWithoutExtension(MovieSession.Movie.Filename)}";
@@ -3803,8 +3796,7 @@ private bool LoadRomInternal(string path, LoadRomArgs args, out bool failureIsFr
38033796
InputManager.SyncControls(Emulator, MovieSession, Config);
38043797
_multiDiskMode = false;
38053798

3806-
if (oaOpenrom is not null && ".xml".EqualsIgnoreCase(Path.GetExtension(oaOpenrom.Path.Replace("|", "")))
3807-
&& Emulator is not LibsnesCore)
3799+
if (oaOpenrom is not null && ".xml".EqualsIgnoreCase(Path.GetExtension(oaOpenrom.Path.Replace("|", ""))))
38083800
{
38093801
// this is a multi-disk bundler file
38103802
// determine the xml assets and create RomStatusDetails for all of them

src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.ConsoleID.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using BizHawk.Emulation.Cores.Consoles.Nintendo.NDS;
55
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
66
using BizHawk.Emulation.Cores.Consoles.Sega.PicoDrive;
7-
using BizHawk.Emulation.Cores.Nintendo.SNES;
87

98
namespace BizHawk.Client.EmuHawk
109
{
@@ -155,7 +154,6 @@ protected ConsoleID SystemIdToConsoleId()
155154
VSystemID.Raw.SGX => ConsoleID.PCEngine, // ???
156155
VSystemID.Raw.SGXCD => ConsoleID.PCEngineCD, // ???
157156
VSystemID.Raw.SMS => ConsoleID.MasterSystem,
158-
VSystemID.Raw.SNES when Emu is LibsnesCore { IsSGB: true } => ConsoleID.GB,
159157
VSystemID.Raw.SNES => ConsoleID.SNES,
160158
VSystemID.Raw.TI83 => ConsoleID.TI83,
161159
VSystemID.Raw.TIC80 => ConsoleID.Tic80,

src/BizHawk.Client.EmuHawk/RetroAchievements/RetroAchievements.Hardcore.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using BizHawk.Emulation.Cores.Nintendo.GBA;
1414
using BizHawk.Emulation.Cores.Nintendo.NES;
1515
using BizHawk.Emulation.Cores.Nintendo.Sameboy;
16-
using BizHawk.Emulation.Cores.Nintendo.SNES;
1716
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
1817
using BizHawk.Emulation.Cores.Nintendo.SubGBHawk;
1918
using BizHawk.Emulation.Cores.Nintendo.SubNESHawk;
@@ -46,7 +45,6 @@ public abstract partial class RetroAchievements
4645
private static readonly Dictionary<Type, string[]> CoreGraphicsLayers = new()
4746
{
4847
[typeof(Atari2600)] = new[] { "ShowBG", "ShowPlayer1", "ShowPlayer2", "ShowMissle1", "ShowMissle2", "ShowBall", "ShowPlayfield" },
49-
[typeof(LibsnesCore)] = new[] { "ShowBG1_0", "ShowBG2_0", "ShowBG3_0", "ShowBG4_0", "ShowBG1_1", "ShowBG2_1", "ShowBG3_1", "ShowBG4_1", "ShowOBJ_0", "ShowOBJ_1", "ShowOBJ_2", "ShowOBJ_3" },
5048
[typeof(BsnesCore)] = new[] { "ShowBG1_0", "ShowBG2_0", "ShowBG3_0", "ShowBG4_0", "ShowBG1_1", "ShowBG2_1", "ShowBG3_1", "ShowBG4_1", "ShowOBJ_0", "ShowOBJ_1", "ShowOBJ_2", "ShowOBJ_3" },
5149
[typeof(WonderSwan)] = new[] { "EnableBG", "EnableFG", "EnableSprites", },
5250
[typeof(GPGX)] = new[] { "DrawBGA", "DrawBGB", "DrawBGW", "DrawObj", },

0 commit comments

Comments
 (0)