Skip to content

Commit

Permalink
additional disc key debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
13xforever committed Sep 30, 2023
1 parent 007da13 commit 21448a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
23 changes: 20 additions & 3 deletions Ps3DiscDumper/Dumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Ps3DiscDumper;

public class Dumper: IDisposable
{
public const string Version = "4.0.3";
public const string Version = "4.0.4";

static Dumper() => Log.Info("PS3 Disc Dumper v" + Version);

Expand Down Expand Up @@ -310,7 +310,7 @@ public async Task FindDiscKeyAsync(string discKeyCachePath)
{
Log.Trace($"Getting keys from {keyProvider.GetType().Name}...");
var newKeys = await keyProvider.EnumerateAsync(discKeyCachePath, ProductCode, Cts.Token).ConfigureAwait(false);
Log.Trace($"Got {newKeys.Count} keys");
Log.Trace($"Got {newKeys.Count} keys from {keyProvider.GetType().Name}");
lock (AllKnownDiscKeys)
{
foreach (var keyInfo in newKeys)
Expand Down Expand Up @@ -450,7 +450,19 @@ public async Task FindDiscKeyAsync(string discKeyCachePath)
string discKey = null;
try
{
discKey = untestedKeys.AsParallel().FirstOrDefault(k => !Cts.IsCancellationRequested && IsValidDiscKey(k));
var validKeys = untestedKeys.AsParallel().Where(k => !Cts.IsCancellationRequested && IsValidDiscKey(k)).Distinct().ToList();
if (validKeys.Count > 1)
{
Log.Warn($"Expected only one valid decryption key, but found {validKeys.Count}:");
foreach (var k in validKeys)
{
Log.Debug($"\t{k}:");
var kiList = AllKnownDiscKeys[k];
foreach (var ki in kiList)
Log.Debug($"\t\t{ki.KeyType}: {Path.GetFileName(ki.FullPath)}");
}
}
discKey = validKeys.FirstOrDefault();
}
catch (Exception e)
{
Expand All @@ -459,6 +471,11 @@ public async Task FindDiscKeyAsync(string discKeyCachePath)
if (discKey == null)
throw new KeyNotFoundException("No valid disc decryption key was found");

Log.Info($"Selected disc key: {discKey}, known key sources:");
var keyInfoList = AllKnownDiscKeys[discKey];
foreach (var ki in keyInfoList)
Log.Debug($"\t{ki.KeyType}: {Path.GetFileName(ki.FullPath)}");

if (Cts.IsCancellationRequested)
return;

Expand Down
4 changes: 2 additions & 2 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="nunit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="NUnit.Analyzers" Version="3.6.1">
<PackageReference Include="NUnit.Analyzers" Version="3.8.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down

0 comments on commit 21448a6

Please sign in to comment.