Move disc hashing to PSX class, remove unused project dependency

This commit is contained in:
YoshiRulz 2020-01-22 05:56:59 +10:00
parent 7e727fc77c
commit df5a382b76
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
3 changed files with 21 additions and 17 deletions

View File

@ -149,9 +149,6 @@
<ProjectReference Include="../BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj"
Name="BizHawk.Emulation.Cores"
Project="{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}" />
<ProjectReference Include="../BizHawk.Emulation.DiscSystem/BizHawk.Emulation.DiscSystem.csproj"
Name="BizHawk.Emulation.DiscSystem"
Project="{f51946ea-827f-4d82-b841-1f2f6d060312}" />
<ProjectReference Include="../Bizware/BizHawk.Bizware.BizwareGL.GdiPlus/BizHawk.Bizware.BizwareGL.GdiPlus.csproj"
Name="BizHawk.Bizware.BizwareGL.GdiPlus"
Project="{337CA23E-65E7-44E1-9411-97EE08BB8116}" />

View File

@ -1,7 +1,6 @@
using System;
using System.Windows.Forms;
using BizHawk.Emulation.DiscSystem;
using BizHawk.Emulation.Cores.Sony.PSX;
namespace BizHawk.Client.EmuHawk
@ -20,19 +19,8 @@ namespace BizHawk.Client.EmuHawk
{
txtHashes.Text = "";
btnHash.Enabled = false;
try
{
foreach (var disc in _psx.Discs)
{
DiscHasher hasher = new DiscHasher(disc);
uint hash = hasher.Calculate_PSX_RedumpHash();
txtHashes.Text += $"{hash:X8} {disc.Name}\r\n";
}
}
finally
{
btnHash.Enabled = true;
}
txtHashes.Text = _psx.CalculateDiscHashes();
btnHash.Enabled = true;
}
}
}

View File

@ -16,10 +16,13 @@ using System.Runtime.InteropServices;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using BizHawk.Emulation.Common;
using BizHawk.Common;
using BizHawk.Emulation.DiscSystem;
#pragma warning disable 649 //adelikat: Disable dumb warnings until this file is complete
@ -456,6 +459,22 @@ namespace BizHawk.Emulation.Cores.Sony.PSX
{
}
public string CalculateDiscHashes()
{
var sb = new StringBuilder();
try
{
foreach (var disc in Discs)
{
sb.Append($"{new DiscHasher(disc).Calculate_PSX_RedumpHash():X8} {disc.Name}\r\n");
}
}
catch
{
// ignored
}
return sb.ToString();
}
public void ResetCounters()
{