prefer update pkg links with drm_type="mbind"

these are supposedly drm-free (well, "PS3 disc bind content" or "Magic Gate Memory Stick bind content" for PSP)
This commit is contained in:
13xforever
2026-01-19 19:50:24 +05:00
parent 6f352bdd03
commit 3be77681c8
2 changed files with 30 additions and 5 deletions

View File

@@ -36,10 +36,14 @@ public class TitlePatchPackage
public string Sha1Sum { get; set; }
[XmlAttribute("url")]
public string Url { get; set; }
[XmlAttribute("drm_type")]
public string DrmType { get; set; }
[XmlAttribute("ps3_system_ver")]
public string Ps3SystemVer { get; set; }
[XmlElement("paramsfo")]
public TitlePatchParamSfo ParamSfo { get; set; }
[XmlElement("url")]
public UrlInfo AltUrl { get; set; }
}
public class TitlePatchParamSfo
@@ -47,5 +51,17 @@ public class TitlePatchParamSfo
[XmlElement("TITLE")]
public string Title { get; set; }
}
public class UrlInfo
{
[XmlAttribute("url")]
public string Url { get; set; }
[XmlAttribute("size")]
public long Size { get; set; }
[XmlAttribute("sha1sum")]
public string Sha1Sum { get; set; }
[XmlAttribute("drm_type")]
public string DrmType { get; set; }
}
#nullable restore

View File

@@ -24,21 +24,30 @@ internal static class TitlePatchFormatter
if (pkgs.Length > 1)
content.AppendLine(
$"""
Total download size of all {pkgs.Length} packages is {pkgs.Sum(p => p.Size).AsStorageUnit()}.
Total download size of all {pkgs.Length} packages is {pkgs.Sum(p => p.AltUrl?.Size ?? p.Size).AsStorageUnit()}.
⏩ You can use tools such as [rusty-psn](https://github.com/RainbowCookie32/rusty-psn/releases/latest) or [PySN](https://github.com/AphelionWasTaken/PySN/releases/latest) for mass download of all updates.
⚠️ You **must** install listed updates in order, starting with the first one. You **can not** skip intermediate versions.
"""
).AppendLine();
foreach (var pkg in pkgs)
content.AppendLine($"""[⏬ Update v`{pkg.Version}` ({pkg.Size.AsStorageUnit()})]({pkg.Url})""");
{
// prefer drm-free link
content.Append($"[⏬ Update v`{pkg.Version}` ({(pkg.AltUrl?.Size ?? pkg.Size).AsStorageUnit()})]({pkg.AltUrl?.Url ?? pkg.Url})");
if (pkg.AltUrl is { Url: { Length: >0} altUrl })
content.Append($" | [with DRM]({pkg.Url})");
content.AppendLine();
}
}
else if (pkgs is [var pkg])
{
var link = $"[⏬ {Path.GetFileName(GetLinkName(pkg.Url))}]({pkg.Url})";
if (pkg.AltUrl is { Url: { Length: > 0 } altUrl })
link += $" | [with DRM]({pkg.Url})";
content.AppendLine(
$"""
### {title} update v{pkg.Version} ({pkg.Size.AsStorageUnit()})
[⏬ {Path.GetFileName(GetLinkName(pkg.Url))}]({pkg.Url})
### {title} update v{pkg.Version} ({(pkg.AltUrl?.Size ?? pkg.Size).AsStorageUnit()})
{link}
"""
);
}