Skip to content

Commit

Permalink
implement bdmv filter according to settings
Browse files Browse the repository at this point in the history
  • Loading branch information
13xforever committed Jan 22, 2024
1 parent 2b166c2 commit 80d6a9b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
21 changes: 21 additions & 0 deletions Ps3DiscDumper/Dumper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ public void DetectDisc(string inDir = "", Func<Dumper, string> outputDirFormatte

// todo: maybe use discutils instead to read TOC as one block
var files = IOEx.GetFilepaths(InputDevicePath, "*", SearchOption.AllDirectories);
if (!SettingsProvider.Settings.CopyBdmv)
{
var prefixList = Settings.BdmvFolders
.Select(f => Path.Combine(InputDevicePath, f) + Path.DirectorySeparatorChar)
.ToArray();
files = files.Where(f => !prefixList.Any(f.StartsWith));
}
DiscFilenames = new();
var totalFilesize = 0L;
var rootLength = InputDevicePath.Length;
Expand Down Expand Up @@ -518,7 +525,21 @@ public async Task DumpAsync(string output)
dumpPath = parent;
}
if (filesystemStructure is null)
{
(filesystemStructure, emptyDirStructure) = GetFilesystemStructure();
var prefixList = Settings.BdmvFolders.Select(f => f + Path.DirectorySeparatorChar).ToArray();
if (!SettingsProvider.Settings.CopyBdmv)
{
filesystemStructure = filesystemStructure
.Where(r => !Settings.BdmvFolders.Any(f => r.TargetFileName == f) &&
!prefixList.Any(p => r.TargetFileName.StartsWith(p)))
.ToList();
emptyDirStructure = emptyDirStructure
.Where(r => !Settings.BdmvFolders.Any(f => r.TargetDirName == f) &&
!prefixList.Any(p => r.TargetDirName.StartsWith(p)))
.ToList();
}
}
var validators = GetValidationInfo();
if (!string.IsNullOrEmpty(dumpPath))
{
Expand Down
4 changes: 2 additions & 2 deletions Ps3DiscDumper/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public struct Settings
{
public Settings() { }

[JsonIgnore]
public const string DefaultPattern = $"%{Patterns.Title}% [%{Patterns.ProductCode}%]";
[JsonIgnore] public const string DefaultPattern = $"%{Patterns.Title}% [%{Patterns.ProductCode}%]";
[JsonIgnore] public static readonly string[] BdmvFolders = ["BDMV", "AACS", "CERTIFICATE"];

public string OutputDir { get; set; } = ".";
public string IrdDir { get; set; } = Path.Combine(Environment.GetFolderPath(SpecialFolder.ApplicationData) ,"ps3-iso-dumper", "ird");
Expand Down
5 changes: 4 additions & 1 deletion UI.Avalonia/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ IOException when e.Message.Contains("cyclic redundancy check")
else if (Directory.Exists(Path.Combine(dumper.InputDevicePath, "BDMV")))
{
StepTitle = "Ready to dump a hybrid disc";
StepSubtitle = "All files will be copied, but only PS3 game files will be decrypted";
if (CopyBdmv)
StepSubtitle = "All files will be copied, but only PS3 game files will be decrypted";
else
StepSubtitle = "Only PS3 game files will be copied";
LearnMoreLink = SettingsViewModel.HybridDiscWikiLink;
LastOperationNotification = true;
}
Expand Down

0 comments on commit 80d6a9b

Please sign in to comment.