Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pure-getkey output names for PS3CFW #801

Merged
merged 5 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@
- Reenable XGD1 PVD reporting
- Improve PS4/PS5 parsing
- Don't add special field keys with no reason
- Add pure-getkey output names for PS3CFW

### 3.2.4 (2024-11-24)

Expand Down
2 changes: 1 addition & 1 deletion MPF.Processors.Test/PS3CFWTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void GetOutputFiles_BluRay_Populated()
var processor = new PS3CFW(RedumpSystem.SonyPlayStation3, MediaType.BluRay);

var actual = processor.GetOutputFiles(baseDirectory, baseFilename);
Assert.Equal(3, actual.Count);
Assert.Equal(4, actual.Count);
}

[Fact]
Expand Down
27 changes: 14 additions & 13 deletions MPF.Processors/PS3CFW.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ public override void GenerateSubmissionInfo(SubmissionInfo info, string basePath
// Try to determine the name of the GetKey file(s)
string? getKeyBasePath = GetCFWBasePath(basePath);

// If GenerateSubmissionInfo is run, .getkey.log existence should already be checked
if (!File.Exists(getKeyBasePath + ".getkey.log"))
// If GenerateSubmissionInfo is run, getkey.log existence should already be checked
if (!File.Exists(getKeyBasePath + "getkey.log"))
return;

// Get dumping date from GetKey log date
info.DumpingInfo.DumpingDate = ProcessingTool.GetFileModifiedDate(getKeyBasePath + ".getkey.log")?.ToString("yyyy-MM-dd HH:mm:ss");
info.DumpingInfo.DumpingDate = ProcessingTool.GetFileModifiedDate(getKeyBasePath + "getkey.log")?.ToString("yyyy-MM-dd HH:mm:ss");

// TODO: Put info about abnormal PIC info beyond 132 bytes in comments?
if (File.Exists(getKeyBasePath + ".disc.pic"))
info.Extras!.PIC = GetPIC(getKeyBasePath + ".disc.pic", 264);
if (File.Exists(getKeyBasePath + "disc.pic"))
info.Extras!.PIC = GetPIC(getKeyBasePath + "disc.pic", 264);

// Parse Disc Key, Disc ID, and PIC from the .getkey.log file
if (ProcessingTool.ParseGetKeyLog(getKeyBasePath + ".getkey.log", out string? key, out string? id, out string? pic))
// Parse Disc Key, Disc ID, and PIC from the getkey.log file
if (ProcessingTool.ParseGetKeyLog(getKeyBasePath + "getkey.log", out string? key, out string? id, out string? pic))
{
if (key != null)
info.Extras!.DiscKey = key.ToUpperInvariant();
Expand All @@ -78,12 +78,13 @@ internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string
{
case MediaType.BluRay:
return [
new($"{baseFilename}.iso", OutputFileFlags.Required),
new($"{baseFilename}.getkey.log", OutputFileFlags.Required
new([$"{baseFilename}.iso", $"{baseFilename}.ISO"], OutputFileFlags.Required),
new([$"{baseFilename}.cue", $"{baseFilename}.CUE"], OutputFileFlags.Zippable),
new([$"{baseFilename}.getkey.log", "getkey.log"], OutputFileFlags.Required
| OutputFileFlags.Artifact
| OutputFileFlags.Zippable,
"getkey_log"),
new($"{baseFilename}.disc.pic", OutputFileFlags.Required
new([$"{baseFilename}.disc.pic", "disc.pic"], OutputFileFlags.Required
| OutputFileFlags.Binary
| OutputFileFlags.Zippable,
"disc_pic"),
Expand Down Expand Up @@ -133,7 +134,7 @@ internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string
#region Helper Functions

/// <summary>
/// Estimate the base filename of the .getkey.log file associated with the dump
/// Estimate the base filename of the getkey.log file associated with the dump
/// </summary>
/// <param name="iso">Path to ISO file</param>
/// <returns>Base filename, null if not found</returns>
Expand All @@ -148,12 +149,12 @@ internal override List<OutputFile> GetOutputFiles(string? baseDirectory, string
try
{
string dir = Path.GetDirectoryName(iso) ?? ".";
string[] files = Directory.GetFiles(dir, "*.getkey.log");
string[] files = Directory.GetFiles(dir, "*getkey.log");

if (files.Length != 1)
return null;

return files[0].Substring(0, files[0].Length - 11);
return files[0].Substring(0, files[0].Length - 10);
}
catch
{
Expand Down
Loading