pass dependency into PsxHashDiscs

This commit is contained in:
adelikat 2020-01-03 14:09:00 -06:00
parent 48a16806cf
commit ba68a307df
2 changed files with 10 additions and 6 deletions

View File

@ -2227,8 +2227,11 @@ namespace BizHawk.Client.EmuHawk
private void PSXHashDiscsToolStripMenuItem_Click(object sender, EventArgs e)
{
using var form = new PSXHashDiscs();
form.ShowDialog();
if (Emulator is Octoshock psx)
{
using var form = new PSXHashDiscs(psx);
form.ShowDialog();
}
}
#endregion

View File

@ -1,7 +1,6 @@
using System;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.DiscSystem;
using BizHawk.Emulation.Cores.Sony.PSX;
@ -9,8 +8,11 @@ namespace BizHawk.Client.EmuHawk
{
public partial class PSXHashDiscs : Form
{
public PSXHashDiscs()
private readonly Octoshock _psx;
public PSXHashDiscs(Octoshock psx)
{
_psx = psx;
InitializeComponent();
}
@ -20,8 +22,7 @@ namespace BizHawk.Client.EmuHawk
btnHash.Enabled = false;
try
{
var psx = (Octoshock)Global.Emulator;
foreach (var disc in psx.Discs)
foreach (var disc in _psx.Discs)
{
DiscHasher hasher = new DiscHasher(disc);
uint hash = hasher.Calculate_PSX_RedumpHash();