Skip to content

Commit

Permalink
Remove most of Octoshock's managed source and callsites
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiRulz committed Jan 10, 2025
1 parent 27c2c5a commit aa53e80
Show file tree
Hide file tree
Showing 21 changed files with 6 additions and 3,544 deletions.
11 changes: 0 additions & 11 deletions src/BizHawk.Client.Common/DisplayManager/DisplayManagerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.Nintendo.N3DS;
using BizHawk.Emulation.Cores.Consoles.Nintendo.NDS;
using BizHawk.Emulation.Cores.Sony.PSX;

namespace BizHawk.Client.Common
{
Expand Down Expand Up @@ -222,16 +221,6 @@ public void RefreshUserShader()
padding.Bottom += GameExtraPadding.Bottom;
}

// an experimental feature
if (source && GlobalEmulator is Octoshock psx)
{
var corePadding = psx.VideoProvider_Padding;
padding.Left += corePadding.Width / 2;
padding.Right += corePadding.Width - corePadding.Width / 2;
padding.Top += corePadding.Height / 2;
padding.Bottom += corePadding.Height - corePadding.Height / 2;
}

// apply user's crop selections as a negative padding (believe it or not, this largely works)
// is there an issue with the aspect ratio? I don't know--but if there is, there would be with the padding too
padding.Left -= GlobalConfig.DispCropLeft;
Expand Down
25 changes: 2 additions & 23 deletions src/BizHawk.Client.Common/RomLoader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;

using BizHawk.Common;
Expand All @@ -11,7 +10,6 @@
using BizHawk.Emulation.Cores.Libretro;
using BizHawk.Emulation.Cores.Nintendo.Sameboy;
using BizHawk.Emulation.Cores.Nintendo.SNES;
using BizHawk.Emulation.Cores.Sony.PSX;
using BizHawk.Emulation.Cores.Arcades.MAME;
using BizHawk.Emulation.DiscSystem;

Expand Down Expand Up @@ -618,27 +616,6 @@ private bool TryLoadSiblingCue(
out game);
}

private void LoadPSF(string path, CoreComm nextComm, HawkFile file, out IEmulator nextEmulator, out RomGame rom, out GameInfo game)
{
// TODO: Why does the PSF loader need CbDeflater provided? Surely this is a matter internal to it.
static byte[] CbDeflater(Stream instream, int size)
{
return new GZipStream(instream, CompressionMode.Decompress).ReadAllBytes();
}
var psf = new PSF();
psf.Load(path, CbDeflater);
nextEmulator = new Octoshock(
nextComm,
psf,
GetCoreSettings<Octoshock, Octoshock.Settings>(),
GetCoreSyncSettings<Octoshock, Octoshock.SyncSettings>()
);

// total garbage, this
rom = new RomGame(file);
game = rom.GameInfo;
}

// HACK due to MAME wanting CHDs as hard drives / handling it on its own (bad design, I know!)
// only matters for XML, as CHDs are never the "main" rom for MAME
// (in general, this is kind of bad as CHD hard drives might be useful for other future cores?)
Expand Down Expand Up @@ -858,10 +835,12 @@ public bool LoadRom(string path, CoreComm nextComm, string launchLibretroCore, s
if (!LoadXML(path, nextComm, file, forcedCoreName, out nextEmulator, out rom, out game))
return false;
break;
#if false // was only wired up for Octoshock
case ".psf":
case ".minipsf":
LoadPSF(path, nextComm, file, out nextEmulator, out rom, out game);
break;
#endif
case ".zip" when forcedCoreName is null:
case ".7z" when forcedCoreName is null:
LoadMAME(path: path, nextComm, file, ext: ext, out nextEmulator, out rom, out game, out cancel);
Expand Down
2 changes: 0 additions & 2 deletions src/BizHawk.Client.Common/config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ public class Config
[ CoreNames.QuickNes, CoreNames.NesHawk, CoreNames.SubNesHawk ]),
([ VSystemID.Raw.PCE, VSystemID.Raw.PCECD, VSystemID.Raw.SGX, VSystemID.Raw.SGXCD ],
[ CoreNames.TurboNyma, CoreNames.HyperNyma, CoreNames.PceHawk ]),
([ VSystemID.Raw.PSX ],
[ CoreNames.Nymashock, CoreNames.Octoshock ]),
([ VSystemID.Raw.SMS, VSystemID.Raw.GG, VSystemID.Raw.SG ],
[ CoreNames.Gpgx, CoreNames.SMSHawk ]),
([ VSystemID.Raw.SNES ],
Expand Down
41 changes: 0 additions & 41 deletions src/BizHawk.Client.EmuHawk/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 0 additions & 62 deletions src/BizHawk.Client.EmuHawk/MainForm.VSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
Expand Down Expand Up @@ -693,47 +692,6 @@ private void NesSubMenu_DropDownOpened(object sender, EventArgs e)



private DialogResult OpenOctoshockGamepadSettingsDialog(ISettingsAdapter settable)
{
using PSXControllerConfig form = new(settable);
return this.ShowDialogWithTempMute(form);
}

private void PsxControllerSettingsMenuItem_Click(object sender, EventArgs e)
=> _ = Emulator switch
{
Octoshock => OpenOctoshockGamepadSettingsDialog(GetSettingsAdapterForLoadedCore<Octoshock>()),
_ => DialogResult.None
};

private DialogResult OpenOctoshockSettingsDialog(ISettingsAdapter settable, OctoshockDll.eVidStandard vidStandard, Size vidSize)
=> PSXOptions.DoSettingsDialog(Config, this, settable, vidStandard, vidSize);

private void PsxOptionsMenuItem_Click(object sender, EventArgs e)
{
var result = Emulator switch
{
Octoshock octoshock => OpenOctoshockSettingsDialog(GetSettingsAdapterForLoadedCore<Octoshock>(), octoshock.SystemVidStandard, octoshock.CurrentVideoSize),
_ => DialogResult.None
};
if (result.IsOk()) FrameBufferResized();
}

private void PsxDiscControlsMenuItem_Click(object sender, EventArgs e)
=> Tools.Load<VirtualpadTool>().ScrollToPadSchema("Console");

private void PsxHashDiscsMenuItem_Click(object sender, EventArgs e)
{
if (Emulator is not IRedumpDiscChecksumInfo psx) return;
using PSXHashDiscs form = new() { _psx = psx };
this.ShowDialogWithTempMute(form);
}

private void PsxSubMenu_DropDownOpened(object sender, EventArgs e)
=> PSXControllerSettingsMenuItem.Enabled = MovieSession.Movie.NotActive();



private DialogResult OpenOldBSNESGamepadSettingsDialog(ISettingsAdapter settable)
{
using SNESControllerSettings form = new(settable);
Expand Down Expand Up @@ -1310,22 +1268,6 @@ ToolStripMenuItemEx CreateCoreSubmenu(VSystemCategory cat, string coreName, para
// O2Hawk
items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.O2Hawk, CreateGenericCoreConfigItem<O2Hawk>(CoreNames.O2Hawk)));

// Octoshock
var octoshockGamepadSettingsItem = CreateSettingsItem("Controller / Memcard Settings...", (_, _) => OpenOctoshockGamepadSettingsDialog(GetSettingsAdapterFor<Octoshock>()));
var octoshockSettingsItem = CreateSettingsItem("Options...", PsxOptionsMenuItem_Click);
// using init buffer sizes here (in practice, they don't matter here, but might as well)
var octoshockNTSCSettingsItem = CreateSettingsItem("Options (as NTSC)...", (_, _) => OpenOctoshockSettingsDialog(GetSettingsAdapterFor<Octoshock>(), OctoshockDll.eVidStandard.NTSC, new(280, 240)));
var octoshockPALSettingsItem = CreateSettingsItem("Options (as PAL)...", (_, _) => OpenOctoshockSettingsDialog(GetSettingsAdapterFor<Octoshock>(), OctoshockDll.eVidStandard.PAL, new(280, 288)));
var octoshockSubmenu = CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.Octoshock, octoshockGamepadSettingsItem, octoshockSettingsItem, octoshockNTSCSettingsItem, octoshockPALSettingsItem);
octoshockSubmenu.DropDownOpened += (_, _) =>
{
var loadedCoreIsOctoshock = Emulator is Octoshock;
octoshockGamepadSettingsItem.Enabled = !loadedCoreIsOctoshock || MovieSession.Movie.NotActive();
octoshockSettingsItem.Visible = loadedCoreIsOctoshock;
octoshockNTSCSettingsItem.Visible = octoshockPALSettingsItem.Visible = !loadedCoreIsOctoshock;
};
items.Add(octoshockSubmenu);

// PCEHawk
items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.PceHawk, CreateGenericCoreConfigItem<PCEngine>(CoreNames.PceHawk)));

Expand Down Expand Up @@ -1438,7 +1380,6 @@ private void HandlePlatformMenus()
GBSubMenu.Visible = false;
A7800SubMenu.Visible = false;
SNESSubMenu.Visible = false;
PSXSubMenu.Visible = false;
ColecoSubMenu.Visible = false;
N64SubMenu.Visible = false;
Ares64SubMenu.Visible = false;
Expand Down Expand Up @@ -1481,9 +1422,6 @@ private void HandlePlatformMenus()
case VSystemID.Raw.NES:
NESSubMenu.Visible = true;
break;
case VSystemID.Raw.PSX when Emulator is Octoshock:
PSXSubMenu.Visible = true;
break;
case VSystemID.Raw.TI83:
TI83SubMenu.Visible = true;
LoadTIFileMenuItem.Visible = Emulator is TI83;
Expand Down
1 change: 0 additions & 1 deletion src/BizHawk.Client.EmuHawk/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ private void SetImages()
NESSoundChannelsMenuItem.Image = Properties.Resources.Audio;
(KeypadMenuItem.Image, /*KeypadMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(TI83KeyPad)]
= (/*TI83KeyPad.ToolIcon.ToBitmap()*/Properties.Resources.Calculator, "TI-83 Virtual KeyPad");
PSXControllerSettingsMenuItem.Image = Properties.Resources.GameController;
SNESControllerConfigurationMenuItem.Image = Properties.Resources.GameController;
(SnesGfxDebuggerMenuItem.Image, /*SnesGfxDebuggerMenuItem.Text*/_) = ToolManager.IconAndNameCache[typeof(SNESGraphicsDebugger)]
= (/*SNESGraphicsDebugger.ToolIcon.ToBitmap()*/Properties.Resources.Bug, "Graphics Debugger");
Expand Down
Loading

0 comments on commit aa53e80

Please sign in to comment.