Update RedumpLib to 1.6.4 (fixes #805)

This commit is contained in:
Matt Nadareski
2024-12-31 21:41:32 -05:00
parent ba0fefca42
commit 7b8becfa40
16 changed files with 88 additions and 10 deletions

View File

@@ -157,6 +157,7 @@
- Add and use internal program short names
- Fix BinaryObjectScanner update
- Fix short name test
- Update RedumpLib to 1.6.4
### 3.2.4 (2024-11-24)

View File

@@ -43,7 +43,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.4" />
</ItemGroup>
</Project>

View File

@@ -43,7 +43,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.4" />
</ItemGroup>
</Project>

View File

@@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.CodeCoverage" Version="17.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.4" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.analyzers" Version="1.18.0" />

View File

@@ -32,7 +32,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.4" />
</ItemGroup>
</Project>

View File

@@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.CodeCoverage" Version="17.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.4" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.analyzers" Version="1.18.0" />

View File

@@ -43,7 +43,7 @@
<PackageReference Include="BinaryObjectScanner" Version="3.3.4" />
<PackageReference Include="LibIRD" Version="0.9.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.4" />
</ItemGroup>
</Project>

View File

@@ -867,7 +867,8 @@ namespace MPF.Frontend.ViewModels
CommentsSpecialFields = new Dictionary<SiteCode, string>()
{
[SiteCode.ISBN] = "ISBN",
[SiteCode.RingNonZeroDataStart] = "+123"
[SiteCode.RingNonZeroDataStart] = "+123",
[SiteCode.RingPerfectAudioOffset] = "+0"
},
Contents = "Special contents 1\r\nSpecial contents 2",
ContentsSpecialFields = new Dictionary<SiteCode, string>()

View File

@@ -27,7 +27,7 @@
<PackageReference Include="Microsoft.CodeCoverage" Version="17.12.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.4" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
<PackageReference Include="xunit.analyzers" Version="1.18.0" />

View File

@@ -816,6 +816,35 @@ namespace MPF.Processors.Test
#endregion
#region GetRingPerfectAudioOffset
[Fact]
public void GetRingPerfectAudioOffset_Empty_Null()
{
string log = string.Empty;
string? actual = Redumper.GetRingPerfectAudioOffset(log);
Assert.Null(actual);
}
[Fact]
public void GetRingPerfectAudioOffset_Invalid_Null()
{
string log = "INVALID";
string? actual = Redumper.GetRingPerfectAudioOffset(log);
Assert.Null(actual);
}
[Fact]
public void GetRingPerfectAudioOffset_Valid_Filled()
{
string? expected = "+0";
string log = Path.Combine(Environment.CurrentDirectory, "TestData", "Redumper", "CDROM", "test.log");
string? actual = Redumper.GetRingPerfectAudioOffset(log);
Assert.Equal(expected, actual);
}
#endregion
#region GetSaturnBuildInfo
[Fact]

View File

@@ -98,6 +98,10 @@ PVD:
<< GetRingNonZeroDataStart >>
non-zero data sample range: [12345 23456]
<< GetRingPerfectAudioOffset >>
Perfect Audio Offset (silence level: 0): [-2553 .. +10213]
fallback offset 0 applied
<< GetSaturnHeader >>
SS [
build date: date

View File

@@ -43,7 +43,7 @@
<ItemGroup>
<PackageReference Include="SabreTools.Hashing" Version="1.4.1" />
<PackageReference Include="SabreTools.Models" Version="1.5.8" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.4" />
<PackageReference Include="SabreTools.Serialization" Version="1.8.6" />
</ItemGroup>

View File

@@ -82,6 +82,8 @@ namespace MPF.Processors
{
string ringNonZeroDataStart = GetRingNonZeroDataStart($"{basePath}.log") ?? string.Empty;
info.CommonDiscInfo.CommentsSpecialFields![SiteCode.RingNonZeroDataStart] = ringNonZeroDataStart;
string ringPerfectAudioOffset = GetRingPerfectAudioOffset($"{basePath}.log") ?? string.Empty;
info.CommonDiscInfo.CommentsSpecialFields![SiteCode.RingPerfectAudioOffset] = ringPerfectAudioOffset;
}
break;
@@ -1602,6 +1604,42 @@ namespace MPF.Processors
}
}
/// <summary>
/// Get the perfect audio offset from the input file, if possible
/// </summary>
/// <param name="log">Log file location</param>
/// <returns>Non-zero dta start if possible, null on error</returns>
internal static string? GetRingPerfectAudioOffset(string log)
{
// If the file doesn't exist, we can't get info from it
if (string.IsNullOrEmpty(log))
return null;
if (!File.Exists(log))
return null;
try
{
// If we fallback offset, only return if the value is 0
using var sr = File.OpenText(log);
while (!sr.EndOfStream)
{
string? line = sr.ReadLine()?.TrimStart();
if (line?.StartsWith("fallback offset 0 applied") == true)
return "+0";
else if (line?.StartsWith("fallback offset") == true)
return null; // TODO: Return all fallback offsets?
}
// We couldn't detect it then
return null;
}
catch
{
// We don't care what the exception is right now
return null;
}
}
/// <summary>
/// Get the build info from a Saturn disc, if possible
/// </summary>

View File

@@ -70,7 +70,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.3" />
<PackageReference Include="SabreTools.RedumpLib" Version="1.6.4" />
</ItemGroup>
<ItemGroup>

View File

@@ -490,6 +490,8 @@
VerticalContentAlignmentValue="Top" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"/>
<controls:UserInput x:Name="RingNonZeroDataStart" Label="Ring Non-Zero Data Start" IsReadOnly="True"
Text="{Binding Path=SubmissionInfo.CommonDiscInfo.CommentsSpecialFields[(redump:SiteCode)RingNonZeroDataStart], Mode=TwoWay}"/>
<controls:UserInput x:Name="RingPerfectAudioOffset" Label="Ring Perfect Audio Offset" IsReadOnly="True"
Text="{Binding Path=SubmissionInfo.CommonDiscInfo.CommentsSpecialFields[(redump:SiteCode)RingPerfectAudioOffset], Mode=TwoWay}"/>
<controls:UserInput x:Name="SecuROMData" Label="SecuROM Data" IsReadOnly="True"
Text="{Binding SubmissionInfo.CopyProtection.SecuROMData, Mode=TwoWay}" TextHeight="75" TextWrapping="NoWrap"
VerticalContentAlignmentValue="Top" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"/>

View File

@@ -79,6 +79,7 @@ namespace MPF.UI.Windows
private UserInput? PIC => ItemHelper.FindChild<UserInput>(this, "PIC");
private UserInput? PVD => ItemHelper.FindChild<UserInput>(this, "PVD");
private UserInput? RingNonZeroDataStart => ItemHelper.FindChild<UserInput>(this, "RingNonZeroDataStart");
private UserInput? RingPerfectAudioOffset => ItemHelper.FindChild<UserInput>(this, "RingPerfectAudioOffset");
private UserInput? SecuROMData => ItemHelper.FindChild<UserInput>(this, "SecuROMData");
private UserInput? SSHash => ItemHelper.FindChild<UserInput>(this, "SSHash");
private UserInput? SecuritySectorRanges => ItemHelper.FindChild<UserInput>(this, "SecuritySectorRanges");
@@ -261,6 +262,8 @@ namespace MPF.UI.Windows
PVD!.Visibility = Visibility.Collapsed;
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.RingNonZeroDataStart) != true)
RingNonZeroDataStart!.Visibility = Visibility.Collapsed;
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.RingPerfectAudioOffset) != true)
RingPerfectAudioOffset!.Visibility = Visibility.Collapsed;
if (string.IsNullOrEmpty(submissionInfo.CopyProtection?.SecuROMData))
SecuROMData!.Visibility = Visibility.Collapsed;
if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.SSHash) != true)