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) private void PSXHashDiscsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
using var form = new PSXHashDiscs(); if (Emulator is Octoshock psx)
form.ShowDialog(); {
using var form = new PSXHashDiscs(psx);
form.ShowDialog();
}
} }
#endregion #endregion

View File

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