Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce5b610f92 | ||
|
|
048d70b473 | ||
|
|
0761450a8d | ||
|
|
82d53db68f | ||
|
|
f8a9c8515d | ||
|
|
0ef06c36e9 | ||
|
|
c1c25b5f5e | ||
|
|
c175fedbdb | ||
|
|
f7879bf9e8 | ||
|
|
fed9d6ea57 | ||
|
|
41946b6bc5 | ||
|
|
d585c4b534 | ||
|
|
1886e14a9b | ||
|
|
e8f4d88711 | ||
|
|
0dbc483a91 | ||
|
|
b6bb5f0582 | ||
|
|
ea3f6d3f96 | ||
|
|
4aa6aca25e | ||
|
|
a93c727ba2 | ||
|
|
55cab8202d | ||
|
|
1fa7380f06 | ||
|
|
a0acd91a55 |
@@ -0,0 +1,36 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
project: [IRDKit]
|
||||||
|
runtime: [win-x86, win-x64, win-arm64, linux-x64, linux-arm64, osx-x64, osx-arm64]
|
||||||
|
framework: [net8.0]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: 'true'
|
||||||
|
|
||||||
|
- name: Setup .NET
|
||||||
|
uses: actions/setup-dotnet@v4
|
||||||
|
with:
|
||||||
|
dotnet-version: 9.0.x
|
||||||
|
|
||||||
|
- name: Restore dependencies
|
||||||
|
run: dotnet restore
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: dotnet publish ${{ matrix.project }}/${{ matrix.project }}.csproj -f ${{ matrix.framework }} -r ${{ matrix.runtime }} -c Release -p:DebugType=None -p:DebugSymbols=false
|
||||||
|
|
||||||
|
- name: Upload build
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: ${{ matrix.project }}_${{ matrix.framework }}_${{ matrix.runtime }}
|
||||||
|
path: ${{ matrix.project }}/bin/Release/${{ matrix.framework }}/${{ matrix.runtime }}/publish/*
|
||||||
+1
-1
@@ -1,3 +1,3 @@
|
|||||||
[submodule "DiscUtils"]
|
[submodule "DiscUtils"]
|
||||||
path = DiscUtils
|
path = LibIRD/DiscUtils
|
||||||
url = https://github.com/Deterous/DiscUtils
|
url = https://github.com/Deterous/DiscUtils
|
||||||
|
|||||||
Vendored
+24
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||||
|
// for the documentation about the tasks.json format
|
||||||
|
"version": "2.0.0",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"label": "build",
|
||||||
|
"command": "dotnet",
|
||||||
|
"type": "shell",
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
// Ask dotnet build to generate full paths for file names.
|
||||||
|
"/property:GenerateFullPaths=true",
|
||||||
|
// Do not generate summary otherwise it leads to duplicate errors in Problems panel
|
||||||
|
"/consoleloggerparameters:NoSummary"
|
||||||
|
],
|
||||||
|
"group": "build",
|
||||||
|
"presentation": {
|
||||||
|
"reveal": "silent"
|
||||||
|
},
|
||||||
|
"problemMatcher": "$msCompile"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
-1
Submodule DiscUtils deleted from 299030c20b
+16
-9
@@ -1,20 +1,25 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- Assembly Properties -->
|
<!-- Assembly Properties -->
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetName>irdkit</TargetName>
|
<TargetName>irdkit</TargetName>
|
||||||
<AssemblyName>irdkit</AssemblyName>
|
<AssemblyName>irdkit</AssemblyName>
|
||||||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
|
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||||
|
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||||
<Version>0.6.1</Version>
|
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
|
||||||
|
<PublishSingleFile>true</PublishSingleFile>
|
||||||
|
<SelfContained>false</SelfContained>
|
||||||
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
<Version>0.9.5</Version>
|
||||||
|
|
||||||
<!-- Package Properties -->
|
<!-- Package Properties -->
|
||||||
<Authors>Deterous</Authors>
|
<Authors>Deterous</Authors>
|
||||||
<Description>Library for ISO Rebuild Data</Description>
|
<Description>Library for ISO Rebuild Data</Description>
|
||||||
<Copyright>Copyright (c) Deterous 2023-2024</Copyright>
|
<Copyright>Copyright (c) Deterous 2023-2025</Copyright>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<RepositoryUrl>https://github.com/Deterous/LibIRD</RepositoryUrl>
|
<RepositoryUrl>https://github.com/Deterous/LibIRD</RepositoryUrl>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
@@ -27,11 +32,13 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\LibIRD\LibIRD.csproj" PrivateAssets="All" />
|
|
||||||
<ProjectReference Include="..\DiscUtils\Library\DiscUtils.Core\DiscUtils.Core.csproj" PrivateAssets="All" />
|
|
||||||
<ProjectReference Include="..\DiscUtils\Library\DiscUtils.Iso9660\DiscUtils.Iso9660.csproj" PrivateAssets="All" />
|
|
||||||
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
<PackageReference Include="CommandLineParser" Version="2.9.1" />
|
||||||
<PackageReference Include="SabreTools.RedumpLib" Version="1.3.3" />
|
<PackageReference Include="SabreTools.Hashing" Version="1.5.0" />
|
||||||
|
<PackageReference Include="SabreTools.RedumpLib" Version="1.7.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\LibIRD\LibIRD.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
+54
-61
@@ -1,17 +1,14 @@
|
|||||||
using CommandLine;
|
using System;
|
||||||
using DiscUtils;
|
|
||||||
using DiscUtils.Iso9660;
|
|
||||||
using LibIRD;
|
|
||||||
using SabreTools.RedumpLib.Web;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Compression;
|
using System.IO.Compression;
|
||||||
using System.IO.Hashing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Security.Cryptography;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using CommandLine;
|
||||||
|
using LibIRD;
|
||||||
|
using SabreTools.Hashing;
|
||||||
|
using SabreTools.RedumpLib.Web;
|
||||||
|
|
||||||
namespace IRDKit
|
namespace IRDKit
|
||||||
{
|
{
|
||||||
@@ -62,6 +59,9 @@ namespace IRDKit
|
|||||||
[Option('o', "output", HelpText = "Path to the text or json file to be created (will overwrite)")]
|
[Option('o', "output", HelpText = "Path to the text or json file to be created (will overwrite)")]
|
||||||
public string OutPath { get; set; }
|
public string OutPath { get; set; }
|
||||||
|
|
||||||
|
[Option('a', "all", HelpText = "Print the entire contents of the IRD")]
|
||||||
|
public bool All { get; set; }
|
||||||
|
|
||||||
[Option('j', "json", HelpText = "Print IRD or ISO information as a JSON object")]
|
[Option('j', "json", HelpText = "Print IRD or ISO information as a JSON object")]
|
||||||
public bool Json { get; set; }
|
public bool Json { get; set; }
|
||||||
|
|
||||||
@@ -100,6 +100,9 @@ namespace IRDKit
|
|||||||
[Option('s', "serial", HelpText = "Appends disc serial to new IRD filename")]
|
[Option('s', "serial", HelpText = "Appends disc serial to new IRD filename")]
|
||||||
public bool Serial { get; set; }
|
public bool Serial { get; set; }
|
||||||
|
|
||||||
|
[Option('e', "version", HelpText = "Appends disc version to new IRD filename")]
|
||||||
|
public bool Ver { get; set; }
|
||||||
|
|
||||||
[Option('c', "crc", HelpText = "Appends ISO CRC to new IRD filename")]
|
[Option('c', "crc", HelpText = "Appends ISO CRC to new IRD filename")]
|
||||||
public bool CRC { get; set; }
|
public bool CRC { get; set; }
|
||||||
|
|
||||||
@@ -283,7 +286,7 @@ namespace IRDKit
|
|||||||
string lastIRD = irdFiles.Last();
|
string lastIRD = irdFiles.Last();
|
||||||
foreach (string file in irdFiles)
|
foreach (string file in irdFiles)
|
||||||
{
|
{
|
||||||
PrintInfo(file, opt.Json, (noISO && file.Equals(lastIRD)), opt.OutPath);
|
PrintInfo(file, opt.Json, (noISO && file.Equals(lastIRD)), opt.OutPath, opt.All);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -295,7 +298,7 @@ namespace IRDKit
|
|||||||
{
|
{
|
||||||
PrintISO(file, opt.Json, file.Equals(lastISO), opt.OutPath);
|
PrintISO(file, opt.Json, file.Equals(lastISO), opt.OutPath);
|
||||||
}
|
}
|
||||||
catch (InvalidFileSystemException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
// Not a valid ISO file despite extension, assume file is an IRD
|
// Not a valid ISO file despite extension, assume file is an IRD
|
||||||
if (!opt.Json)
|
if (!opt.Json)
|
||||||
@@ -325,7 +328,7 @@ namespace IRDKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Print info from given file
|
// Print info from given file
|
||||||
PrintInfo(filePath, opt.Json, true, opt.OutPath);
|
PrintInfo(filePath, opt.Json, true, opt.OutPath, opt.All);
|
||||||
|
|
||||||
if (opt.OutPath != null && opt.OutPath != "")
|
if (opt.OutPath != null && opt.OutPath != "")
|
||||||
Console.WriteLine($"Info saved to {opt.OutPath}");
|
Console.WriteLine($"Info saved to {opt.OutPath}");
|
||||||
@@ -417,7 +420,7 @@ namespace IRDKit
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RenameIRD(file, datfile, serial: opt.Serial, crc: opt.CRC, verbose: opt.Verbose);
|
RenameIRD(file, datfile, serial: opt.Serial, ver: opt.Ver, crc: opt.CRC, verbose: opt.Verbose);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -438,7 +441,7 @@ namespace IRDKit
|
|||||||
// Rename provided IRD path
|
// Rename provided IRD path
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RenameIRD(irdPath, datfile, serial: opt.Serial, crc: opt.CRC, verbose: opt.Verbose);
|
RenameIRD(irdPath, datfile, serial: opt.Serial, ver: opt.Ver, crc: opt.CRC, verbose: opt.Verbose);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -464,8 +467,9 @@ namespace IRDKit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inPath">File to retrieve info from</param>
|
/// <param name="inPath">File to retrieve info from</param>
|
||||||
/// <param name="json">Whether to format output as JSON (true) or plain text (false)</param>
|
/// <param name="json">Whether to format output as JSON (true) or plain text (false)</param>
|
||||||
|
/// <param name="single">Whether to print a single JSON object or not</param>
|
||||||
/// <param name="outPath">File to output info to</param>
|
/// <param name="outPath">File to output info to</param>
|
||||||
public static void PrintInfo(string inPath, bool json, bool single = true, string outPath = null)
|
public static void PrintInfo(string inPath, bool json, bool single = true, string outPath = null, bool printAll = false)
|
||||||
{
|
{
|
||||||
// Check if file is an ISO
|
// Check if file is an ISO
|
||||||
bool isISO = String.Compare(Path.GetExtension(inPath), ".iso", StringComparison.OrdinalIgnoreCase) == 0;
|
bool isISO = String.Compare(Path.GetExtension(inPath), ".iso", StringComparison.OrdinalIgnoreCase) == 0;
|
||||||
@@ -476,7 +480,7 @@ namespace IRDKit
|
|||||||
PrintISO(inPath, json, single, outPath);
|
PrintISO(inPath, json, single, outPath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (InvalidFileSystemException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
// Not a valid ISO file despite extension, try open as IRD
|
// Not a valid ISO file despite extension, try open as IRD
|
||||||
}
|
}
|
||||||
@@ -492,10 +496,10 @@ namespace IRDKit
|
|||||||
File.AppendAllText(outPath, $"\"{Path.GetFileName(inPath)}\": ");
|
File.AppendAllText(outPath, $"\"{Path.GetFileName(inPath)}\": ");
|
||||||
else
|
else
|
||||||
Console.Write($"\"{Path.GetFileName(inPath)}\": ");
|
Console.Write($"\"{Path.GetFileName(inPath)}\": ");
|
||||||
ird.PrintJson(outPath, single);
|
ird.PrintJson(outPath, single, printAll);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
IRD.Read(inPath).Print(outPath, Path.GetFileName(inPath));
|
IRD.Read(inPath).Print(outPath, Path.GetFileName(inPath), printAll);
|
||||||
|
|
||||||
if (json)
|
if (json)
|
||||||
return;
|
return;
|
||||||
@@ -518,6 +522,7 @@ namespace IRDKit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="isoPath">Path to ISO file</param>
|
/// <param name="isoPath">Path to ISO file</param>
|
||||||
/// <param name="json">Whether to format output as JSON (true) or plain text (false)</param>
|
/// <param name="json">Whether to format output as JSON (true) or plain text (false)</param>
|
||||||
|
/// <param name="single">Whether to print a single JSON object or not</param>
|
||||||
/// <param name="outPath">File to output info to</param>
|
/// <param name="outPath">File to output info to</param>
|
||||||
/// <exception cref="FileNotFoundException"></exception>
|
/// <exception cref="FileNotFoundException"></exception>
|
||||||
/// <exception cref="InvalidFileSystemException"></exception>
|
/// <exception cref="InvalidFileSystemException"></exception>
|
||||||
@@ -526,18 +531,18 @@ namespace IRDKit
|
|||||||
// Open ISO file for reading
|
// Open ISO file for reading
|
||||||
using FileStream fs = new(isoPath, FileMode.Open, FileAccess.Read);
|
using FileStream fs = new(isoPath, FileMode.Open, FileAccess.Read);
|
||||||
// Validate ISO file stream
|
// Validate ISO file stream
|
||||||
if (fs == null || !CDReader.Detect(fs))
|
if (fs == null || !LibIRD.DiscUtils.Iso9660.CDReader.Detect(fs))
|
||||||
{
|
{
|
||||||
Console.Error.WriteLine($"{isoPath} is not a valid ISO file");
|
Console.Error.WriteLine($"{isoPath} is not a valid ISO file");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Create new ISO reader
|
// Create new ISO reader
|
||||||
using CDReader reader = new(fs, true, true);
|
using LibIRD.DiscUtils.Iso9660.CDReader reader = new(fs);
|
||||||
|
|
||||||
// Write PS3_DISC.SFB info
|
// Write PS3_DISC.SFB info
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using DiscUtils.Streams.SparseStream s = reader.OpenFile("\\PS3_DISC.SFB", FileMode.Open, FileAccess.Read);
|
using LibIRD.DiscUtils.Streams.SparseStream s = reader.OpenFile("\\PS3_DISC.SFB", FileMode.Open, FileAccess.Read);
|
||||||
PS3_DiscSFB ps3_DiscSFB = new(s);
|
PS3_DiscSFB ps3_DiscSFB = new(s);
|
||||||
if (json)
|
if (json)
|
||||||
{
|
{
|
||||||
@@ -574,7 +579,7 @@ namespace IRDKit
|
|||||||
// Write PARAM.SFO info
|
// Write PARAM.SFO info
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using DiscUtils.Streams.SparseStream s = reader.OpenFile("\\PS3_GAME\\PARAM.SFO", FileMode.Open, FileAccess.Read);
|
using LibIRD.DiscUtils.Streams.SparseStream s = reader.OpenFile("\\PS3_GAME\\PARAM.SFO", FileMode.Open, FileAccess.Read);
|
||||||
ParamSFO paramSFO = new(s);
|
ParamSFO paramSFO = new(s);
|
||||||
if (json)
|
if (json)
|
||||||
{
|
{
|
||||||
@@ -706,7 +711,7 @@ namespace IRDKit
|
|||||||
for (int i = 0; i < regionCount; i++)
|
for (int i = 0; i < regionCount; i++)
|
||||||
{
|
{
|
||||||
if (!IRD1.RegionHashes[i].SequenceEqual(IRD2.RegionHashes[i]))
|
if (!IRD1.RegionHashes[i].SequenceEqual(IRD2.RegionHashes[i]))
|
||||||
printText.AppendLine($"Region {i} Hash: {Convert.ToHexString(IRD1.RegionHashes[i])} vs {Convert.ToHexString(IRD2.RegionHashes[i])}");
|
printText.AppendLine($"Region {i} Hash: {LibIRD.IRD.ByteArrayToHexString(IRD1.RegionHashes[i])} vs {LibIRD.IRD.ByteArrayToHexString(IRD2.RegionHashes[i])}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Print the difference in number of files, if not 0
|
// Print the difference in number of files, if not 0
|
||||||
@@ -722,7 +727,7 @@ namespace IRDKit
|
|||||||
if (j == -1)
|
if (j == -1)
|
||||||
missingOffsets2.Add(IRD1.FileKeys[i]);
|
missingOffsets2.Add(IRD1.FileKeys[i]);
|
||||||
if (j != -1 && !IRD1.FileHashes[i].SequenceEqual(IRD2.FileHashes[j]))
|
if (j != -1 && !IRD1.FileHashes[i].SequenceEqual(IRD2.FileHashes[j]))
|
||||||
printText.AppendLine($"File Hash at Offset {IRD1.FileKeys[i]}: {Convert.ToHexString(IRD1.FileHashes[i])} vs {Convert.ToHexString(IRD2.FileHashes[j])}");
|
printText.AppendLine($"File Hash at Offset {IRD1.FileKeys[i]}: {LibIRD.IRD.ByteArrayToHexString(IRD1.FileHashes[i])} vs {LibIRD.IRD.ByteArrayToHexString(IRD2.FileHashes[j])}");
|
||||||
}
|
}
|
||||||
for (int i = 0; i < IRD2.FileKeys.Length; i++)
|
for (int i = 0; i < IRD2.FileKeys.Length; i++)
|
||||||
{
|
{
|
||||||
@@ -734,7 +739,7 @@ namespace IRDKit
|
|||||||
if (missingOffsets1.Count > 0)
|
if (missingOffsets1.Count > 0)
|
||||||
printText.AppendLine($"File Offsets not Present in {irdPath1}: {string.Join(", ", missingOffsets1)}");
|
printText.AppendLine($"File Offsets not Present in {irdPath1}: {string.Join(", ", missingOffsets1)}");
|
||||||
if (missingOffsets2.Count > 0)
|
if (missingOffsets2.Count > 0)
|
||||||
printText.AppendLine($"File Offsets not Present in {irdPath2}: {string.Join(", ", missingOffsets2)}");
|
printText.AppendLine($"File Offsets not Present in {irdPath2}: {string.Join(", ", missingOffsets2)}");
|
||||||
|
|
||||||
// Print any extra config data difference
|
// Print any extra config data difference
|
||||||
if (IRD1.ExtraConfig != IRD2.ExtraConfig)
|
if (IRD1.ExtraConfig != IRD2.ExtraConfig)
|
||||||
@@ -750,15 +755,15 @@ namespace IRDKit
|
|||||||
|
|
||||||
// Print any data 1 key difference
|
// Print any data 1 key difference
|
||||||
if (!IRD1.Data1Key.SequenceEqual(IRD2.Data1Key))
|
if (!IRD1.Data1Key.SequenceEqual(IRD2.Data1Key))
|
||||||
printText.AppendLine($"Data 1 Key: {Convert.ToHexString(IRD1.Data1Key)} vs {Convert.ToHexString(IRD2.Data1Key)}");
|
printText.AppendLine($"Data 1 Key: {LibIRD.IRD.ByteArrayToHexString(IRD1.Data1Key)} vs {LibIRD.IRD.ByteArrayToHexString(IRD2.Data1Key)}");
|
||||||
|
|
||||||
// Print any data 2 key difference
|
// Print any data 2 key difference
|
||||||
if (!IRD1.Data2Key.SequenceEqual(IRD2.Data2Key))
|
if (!IRD1.Data2Key.SequenceEqual(IRD2.Data2Key))
|
||||||
printText.AppendLine($"Data 2 Key: {Convert.ToHexString(IRD1.Data2Key)} vs {Convert.ToHexString(IRD2.Data2Key)}");
|
printText.AppendLine($"Data 2 Key: {LibIRD.IRD.ByteArrayToHexString(IRD1.Data2Key)} vs {LibIRD.IRD.ByteArrayToHexString(IRD2.Data2Key)}");
|
||||||
|
|
||||||
// Print any PIC difference
|
// Print any PIC difference
|
||||||
if (!IRD1.PIC.SequenceEqual(IRD2.PIC))
|
if (!IRD1.PIC.SequenceEqual(IRD2.PIC))
|
||||||
printText.AppendLine($"PIC: {Convert.ToHexString(IRD1.PIC)} vs {Convert.ToHexString(IRD2.PIC)}");
|
printText.AppendLine($"PIC: {LibIRD.IRD.ByteArrayToHexString(IRD1.PIC)} vs {LibIRD.IRD.ByteArrayToHexString(IRD2.PIC)}");
|
||||||
|
|
||||||
// Write formatted string to file if output path provided, otherwise to console
|
// Write formatted string to file if output path provided, otherwise to console
|
||||||
if (outPath != null)
|
if (outPath != null)
|
||||||
@@ -810,7 +815,7 @@ namespace IRDKit
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Get disc key from hex string
|
// Get disc key from hex string
|
||||||
byte[] discKey = Convert.FromHexString(hexKey);
|
byte[] discKey = LibIRD.IRD.HexStringToByteArray(hexKey);
|
||||||
if (discKey == null || discKey.Length != 16)
|
if (discKey == null || discKey.Length != 16)
|
||||||
Console.Error.WriteLine($"{hexKey} is not a valid key, detecting key automatically...");
|
Console.Error.WriteLine($"{hexKey} is not a valid key, detecting key automatically...");
|
||||||
else
|
else
|
||||||
@@ -846,7 +851,7 @@ namespace IRDKit
|
|||||||
Console.Error.WriteLine($"{hexKey} is not a valid key, detecting key automatically...");
|
Console.Error.WriteLine($"{hexKey} is not a valid key, detecting key automatically...");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Creating {irdPath} with Key: {Convert.ToHexString(discKey)}");
|
Console.WriteLine($"Creating {irdPath} with Key: {LibIRD.IRD.ByteArrayToHexString(discKey)}");
|
||||||
IRD ird1 = new ReIRD(isoPath, discKey, layerbreak);
|
IRD ird1 = new ReIRD(isoPath, discKey, layerbreak);
|
||||||
ird1.Write(irdPath);
|
ird1.Write(irdPath);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
@@ -894,7 +899,7 @@ namespace IRDKit
|
|||||||
Console.Error.WriteLine($"{hexKey} is not a valid key, detecting key automatically...");
|
Console.Error.WriteLine($"{hexKey} is not a valid key, detecting key automatically...");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine($"Creating {irdPath} with Key: {Convert.ToHexString(discKey)}");
|
Console.WriteLine($"Creating {irdPath} with Key: {LibIRD.IRD.ByteArrayToHexString(discKey)}");
|
||||||
IRD ird1 = new ReIRD(isoPath, discKey, layerbreak);
|
IRD ird1 = new ReIRD(isoPath, discKey, layerbreak);
|
||||||
ird1.Write(irdPath);
|
ird1.Write(irdPath);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
@@ -936,22 +941,16 @@ namespace IRDKit
|
|||||||
Console.WriteLine("No key provided... Searching for key on redump.org");
|
Console.WriteLine("No key provided... Searching for key on redump.org");
|
||||||
|
|
||||||
// Compute CRC32 hash
|
// Compute CRC32 hash
|
||||||
byte[] crc32;
|
byte[] crc32 = HashTool.GetFileHashArray(isoPath, HashType.CRC32);
|
||||||
uint crc32UInt;
|
string crc32String = LibIRD.IRD.ByteArrayToHexString(crc32).ToLowerInvariant();
|
||||||
using (FileStream fs = File.OpenRead(isoPath))
|
|
||||||
{
|
// Convert to UInt for use as UID in IRD
|
||||||
Crc32 hasher = new();
|
Array.Reverse(crc32);
|
||||||
hasher.Append(fs);
|
uint crc32UInt = BitConverter.ToUInt32(crc32, 0);
|
||||||
crc32 = hasher.GetCurrentHash();
|
|
||||||
crc32UInt = BitConverter.ToUInt32(crc32);
|
|
||||||
// Change endianness
|
|
||||||
Array.Reverse(crc32);
|
|
||||||
}
|
|
||||||
string crc32_hash = Convert.ToHexString(crc32).ToLower();
|
|
||||||
|
|
||||||
// Search for ISO on redump.org
|
// Search for ISO on redump.org
|
||||||
RedumpHttpClient redump = new();
|
RedumpClient redump = new();
|
||||||
List<int> ids = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + crc32_hash).ConfigureAwait(false).GetAwaiter().GetResult();
|
List<int> ids = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + crc32String).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||||
int id;
|
int id;
|
||||||
if (ids.Count == 0)
|
if (ids.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -961,16 +960,10 @@ namespace IRDKit
|
|||||||
else if (ids.Count > 1)
|
else if (ids.Count > 1)
|
||||||
{
|
{
|
||||||
// More than one result for the CRC32 hash, compute SHA1 hash instead
|
// More than one result for the CRC32 hash, compute SHA1 hash instead
|
||||||
byte[] sha1;
|
string sha1String = HashTool.GetFileHash(isoPath, HashType.SHA1);
|
||||||
using (FileStream fs = File.OpenRead(isoPath))
|
|
||||||
{
|
|
||||||
SHA1 hasher = SHA1.Create();
|
|
||||||
sha1 = hasher.ComputeHash(fs);
|
|
||||||
}
|
|
||||||
string sha1_hash = Convert.ToHexString(sha1).ToLower();
|
|
||||||
|
|
||||||
// Search redump.org for SHA1 hash
|
// Search redump.org for SHA1 hash
|
||||||
List<int> ids2 = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + sha1_hash).ConfigureAwait(false).GetAwaiter().GetResult();
|
List<int> ids2 = redump.CheckSingleSitePage("http://redump.org/discs/system/ps3/quicksearch/" + sha1String).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||||
if (ids2.Count == 0)
|
if (ids2.Count == 0)
|
||||||
{
|
{
|
||||||
Console.Error.WriteLine("ISO not found in redump and no valid key provided, cannot create IRD");
|
Console.Error.WriteLine("ISO not found in redump and no valid key provided, cannot create IRD");
|
||||||
@@ -990,15 +983,15 @@ namespace IRDKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Download key file from redump.org
|
// Download key file from redump.org
|
||||||
byte[] key = redump.GetByteArrayAsync($"http://redump.org/disc/{id}/key").ConfigureAwait(false).GetAwaiter().GetResult();
|
byte[] key = redump.DownloadData($"http://redump.org/disc/{id}/key").ConfigureAwait(false).GetAwaiter().GetResult();
|
||||||
if (key.Length != 16)
|
if (key == null || key.Length != 16)
|
||||||
{
|
{
|
||||||
Console.Error.WriteLine("Invalid key obtained from redump and no valid key provided, cannot create IRD");
|
Console.Error.WriteLine("Invalid key obtained from redump and no valid key provided, cannot create IRD");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create IRD with key from redump
|
// Create IRD with key from redump
|
||||||
Console.WriteLine($"Creating {irdPath} with Key from redump.org: {Convert.ToHexString(key)}");
|
Console.WriteLine($"Creating {irdPath} with Key from redump.org: {LibIRD.IRD.ByteArrayToHexString(key)}");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IRD ird = new ReIRD(isoPath, key, layerbreak, crc32UInt);
|
IRD ird = new ReIRD(isoPath, key, layerbreak, crc32UInt);
|
||||||
@@ -1036,18 +1029,18 @@ namespace IRDKit
|
|||||||
return node.Attribute("name").Value;
|
return node.Attribute("name").Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RenameIRD(string irdPath, XDocument datfile, bool serial = false, bool crc = false, bool verbose = false)
|
public static void RenameIRD(string irdPath, XDocument datfile, bool serial = false, bool ver = false, bool crc = false, bool verbose = false)
|
||||||
{
|
{
|
||||||
IRD ird = IRD.Read(irdPath);
|
IRD ird = IRD.Read(irdPath);
|
||||||
|
|
||||||
if (ird.ExtraConfig != 0x0001)
|
if (ird.ExtraConfig != 0x0001)
|
||||||
throw new ArgumentException($"{irdPath} is not a redump-style IRD");
|
throw new ArgumentException($"{irdPath} is not a redump-style IRD");
|
||||||
|
|
||||||
string filename = GetDatFilename(ird, datfile);
|
string filename = GetDatFilename(ird, datfile) ?? throw new ArgumentException($"Cannot determine DAT filename for {irdPath}");
|
||||||
if (filename == null)
|
|
||||||
throw new ArgumentException($"Cannot determine DAT filename for {irdPath}");
|
|
||||||
if (serial)
|
if (serial)
|
||||||
filename += $" [{ird.TitleID[..4]}-{ird.TitleID[4..9]}]";
|
filename += $" [{ird.TitleID.Substring(0, 4).Replace('\0', ' ')}-{ird.TitleID.Substring(4, 5).Replace('\0', ' ')}]";
|
||||||
|
if (ver)
|
||||||
|
filename += $" [{ird.DiscVersion.Replace('\0', ' ')}]";
|
||||||
if (crc)
|
if (crc)
|
||||||
filename += $" [{ird.UID:X8}]";
|
filename += $" [{ird.UID:X8}]";
|
||||||
|
|
||||||
@@ -1073,7 +1066,7 @@ namespace IRDKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Helper Functions
|
#region Helper Functions
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ For all options, run `irdkit help info`
|
|||||||
To print info about an ISO or IRD file, run `irdkit info game.iso` or `irdkit info game.ird`
|
To print info about an ISO or IRD file, run `irdkit info game.iso` or `irdkit info game.ird`
|
||||||
The info can be printed to a file, e.g. `-o out.txt` or `--output=`
|
The info can be printed to a file, e.g. `-o out.txt` or `--output=`
|
||||||
The info can be formatted as a JSON with `-j` or `--json`
|
The info can be formatted as a JSON with `-j` or `--json`
|
||||||
|
To print all info in the IRD use `-a` or `--all`
|
||||||
|
|
||||||
## Comparing IRDs
|
## Comparing IRDs
|
||||||
|
|
||||||
@@ -39,3 +40,9 @@ For all options, run `irdkit help diff`
|
|||||||
|
|
||||||
To compare two IRDs, run `irdkit diff game1.ird game2.ird`
|
To compare two IRDs, run `irdkit diff game1.ird game2.ird`
|
||||||
The comparison can be printed to a file, e.g. `-o out.txt` or `--output=`
|
The comparison can be printed to a file, e.g. `-o out.txt` or `--output=`
|
||||||
|
|
||||||
|
## Renaming IRDs
|
||||||
|
|
||||||
|
For all options, run `irdkit help rename`
|
||||||
|
|
||||||
|
To rename an IRD (or folder of IRDs) according to a redump DAT, run `irdkit rename -d redump.dat game.ird`
|
||||||
|
|||||||
+2
-18
@@ -11,16 +11,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
.gitattributes = .gitattributes
|
.gitattributes = .gitattributes
|
||||||
.gitignore = .gitignore
|
.gitignore = .gitignore
|
||||||
|
.gitmodules = .gitmodules
|
||||||
LICENSE.txt = LICENSE.txt
|
LICENSE.txt = LICENSE.txt
|
||||||
|
publish-irdkit.ps1 = publish-irdkit.ps1
|
||||||
README.md = README.md
|
README.md = README.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscUtils.Core", "DiscUtils\Library\DiscUtils.Core\DiscUtils.Core.csproj", "{9E71F5CD-887D-4A61-8460-9F7E8F110B46}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscUtils.Iso9660", "DiscUtils\Library\DiscUtils.Iso9660\DiscUtils.Iso9660.csproj", "{9E1EF05F-388B-42C6-A4E7-98BE20C7C8EC}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DiscUtils.Streams", "DiscUtils\Library\DiscUtils.Streams\DiscUtils.Streams.csproj", "{E8D0B8B0-F165-4FA1-AC7B-194F5F48A5F9}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -35,18 +31,6 @@ Global
|
|||||||
{9060E3AF-E4FB-436F-93A1-5C47389CB88E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{9060E3AF-E4FB-436F-93A1-5C47389CB88E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{9060E3AF-E4FB-436F-93A1-5C47389CB88E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{9060E3AF-E4FB-436F-93A1-5C47389CB88E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{9060E3AF-E4FB-436F-93A1-5C47389CB88E}.Release|Any CPU.Build.0 = Release|Any CPU
|
{9060E3AF-E4FB-436F-93A1-5C47389CB88E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{9E71F5CD-887D-4A61-8460-9F7E8F110B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{9E71F5CD-887D-4A61-8460-9F7E8F110B46}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{9E71F5CD-887D-4A61-8460-9F7E8F110B46}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{9E71F5CD-887D-4A61-8460-9F7E8F110B46}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{9E1EF05F-388B-42C6-A4E7-98BE20C7C8EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{9E1EF05F-388B-42C6-A4E7-98BE20C7C8EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{9E1EF05F-388B-42C6-A4E7-98BE20C7C8EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{9E1EF05F-388B-42C6-A4E7-98BE20C7C8EC}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{E8D0B8B0-F165-4FA1-AC7B-194F5F48A5F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{E8D0B8B0-F165-4FA1-AC7B-194F5F48A5F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{E8D0B8B0-F165-4FA1-AC7B-194F5F48A5F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{E8D0B8B0-F165-4FA1-AC7B-194F5F48A5F9}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
Submodule
+1
Submodule LibIRD/DiscUtils added at 445a572137
+437
-205
File diff suppressed because it is too large
Load Diff
+24
-18
@@ -1,18 +1,22 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- Assembly Properties -->
|
<!-- Assembly Properties -->
|
||||||
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
|
|
||||||
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
<RuntimeIdentifiers>win-x86;win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>
|
||||||
|
<CheckEolTargetFramework>false</CheckEolTargetFramework>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
|
||||||
<Version>0.6.0</Version>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
<Version>0.9.4</Version>
|
||||||
<PackageOutputPath>../nupkg</PackageOutputPath>
|
<PackageOutputPath>../nupkg</PackageOutputPath>
|
||||||
|
|
||||||
|
<!-- Avoid inexact read with 'System.IO.Stream.Read' -->
|
||||||
|
<NoWarn>CA2022</NoWarn>
|
||||||
|
|
||||||
<!-- Package Properties -->
|
<!-- Package Properties -->
|
||||||
<Authors>Deterous</Authors>
|
<Authors>Deterous</Authors>
|
||||||
<Description>Library for ISO Rebuild Data</Description>
|
<Description>Library for ISO Rebuild Data</Description>
|
||||||
<Copyright>Copyright (c) Deterous 2023-2024</Copyright>
|
<Copyright>Copyright (c) Deterous 2023-2025</Copyright>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
<RepositoryUrl>https://github.com/Deterous/LibIRD/</RepositoryUrl>
|
<RepositoryUrl>https://github.com/Deterous/LibIRD/</RepositoryUrl>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
@@ -21,24 +25,26 @@
|
|||||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="$(RuntimeIdentifier.StartsWith(`osx-arm`))">
|
||||||
|
<TargetFrameworks>net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="!$(RuntimeIdentifier.StartsWith(`osx-arm`))">
|
||||||
|
<TargetFrameworks>net20;net35;net40;net452;net462;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="./README.md" Pack="true" PackagePath="" />
|
<None Include="./README.md" Pack="true" PackagePath="" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<!-- Support for old .NET versions -->
|
||||||
<ProjectReference Include="..\DiscUtils\Library\DiscUtils.Core\DiscUtils.Core.csproj" PrivateAssets="All" />
|
<ItemGroup Condition="$(TargetFramework.StartsWith(`net2`))">
|
||||||
<ProjectReference Include="..\DiscUtils\Library\DiscUtils.Iso9660\DiscUtils.Iso9660.csproj" PrivateAssets="All" />
|
<PackageReference Include="Net30.LinqBridge" Version="1.3.0" />
|
||||||
<ProjectReference Include="..\DiscUtils\Library\DiscUtils.Streams\DiscUtils.Streams.csproj" PrivateAssets="All" />
|
|
||||||
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<ItemGroup>
|
||||||
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</PropertyGroup>
|
<PackageReference Include="SabreTools.Hashing" Version="1.4.0" />
|
||||||
<Target Name="CopyProjectReferencesToPackage" DependsOnTargets="BuildOnlySettings;ResolveReferences">
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference')->WithMetadataValue('PrivateAssets', 'All'))" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace LibIRD
|
namespace LibIRD
|
||||||
{
|
{
|
||||||
@@ -68,7 +68,7 @@ namespace LibIRD
|
|||||||
// Read SFB file version
|
// Read SFB file version
|
||||||
byte[] buf = br.ReadBytes(2);
|
byte[] buf = br.ReadBytes(2);
|
||||||
Array.Reverse(buf);
|
Array.Reverse(buf);
|
||||||
Version = BitConverter.ToUInt16(buf);
|
Version = BitConverter.ToUInt16(buf, 0);
|
||||||
|
|
||||||
// Process all field headers
|
// Process all field headers
|
||||||
sfbStream.Seek(0x20, SeekOrigin.Begin);
|
sfbStream.Seek(0x20, SeekOrigin.Begin);
|
||||||
@@ -131,11 +131,6 @@ namespace LibIRD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Define JSON options once
|
|
||||||
/// </summary>
|
|
||||||
private readonly JsonSerializerOptions JsonOpts = new() { WriteIndented = true };
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prints parameters extracted from PS3_DISC.SFB to a json object
|
/// Prints parameters extracted from PS3_DISC.SFB to a json object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -143,7 +138,7 @@ namespace LibIRD
|
|||||||
public void PrintJson(string jsonPath = null)
|
public void PrintJson(string jsonPath = null)
|
||||||
{
|
{
|
||||||
// Serialise PS3_Disc.SFB data to a JSON object
|
// Serialise PS3_Disc.SFB data to a JSON object
|
||||||
string json = JsonSerializer.Serialize(Field, JsonOpts);
|
string json = JsonConvert.SerializeObject(Field, Formatting.Indented);
|
||||||
|
|
||||||
// If no path given, output to console
|
// If no path given, output to console
|
||||||
if (jsonPath == null)
|
if (jsonPath == null)
|
||||||
|
|||||||
+2
-7
@@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace LibIRD
|
namespace LibIRD
|
||||||
{
|
{
|
||||||
@@ -154,11 +154,6 @@ namespace LibIRD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Define JSON options once
|
|
||||||
/// </summary>
|
|
||||||
private readonly JsonSerializerOptions JsonOpts = new() { WriteIndented = true };
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Prints parameters extracted from PARAM.SFO to a json object
|
/// Prints parameters extracted from PARAM.SFO to a json object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -166,7 +161,7 @@ namespace LibIRD
|
|||||||
public void PrintJson(string jsonPath = null)
|
public void PrintJson(string jsonPath = null)
|
||||||
{
|
{
|
||||||
// Serialise PS3_Disc.SFB data to a JSON object
|
// Serialise PS3_Disc.SFB data to a JSON object
|
||||||
string json = JsonSerializer.Serialize(Field, JsonOpts);
|
string json = JsonConvert.SerializeObject(Field, Formatting.Indented);
|
||||||
|
|
||||||
// If no path given, output to console
|
// If no path given, output to console
|
||||||
if (jsonPath == null)
|
if (jsonPath == null)
|
||||||
|
|||||||
+3
-38
@@ -1,7 +1,5 @@
|
|||||||
using DiscUtils.Iso9660;
|
using System;
|
||||||
using System;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Hashing;
|
|
||||||
|
|
||||||
namespace LibIRD
|
namespace LibIRD
|
||||||
{
|
{
|
||||||
@@ -135,7 +133,7 @@ namespace LibIRD
|
|||||||
{
|
{
|
||||||
// If no layerbreak provided, ensure ISO is not BD-Video hybrid
|
// If no layerbreak provided, ensure ISO is not BD-Video hybrid
|
||||||
using FileStream fs = new FileStream(isoPath, FileMode.Open, FileAccess.Read) ?? throw new FileNotFoundException(isoPath);
|
using FileStream fs = new FileStream(isoPath, FileMode.Open, FileAccess.Read) ?? throw new FileNotFoundException(isoPath);
|
||||||
CDReader reader = new(fs, true, true);
|
DiscUtils.Iso9660.CDReader reader = new(fs);
|
||||||
if (reader.DirectoryExists("\\BDMV"))
|
if (reader.DirectoryExists("\\BDMV"))
|
||||||
throw new ArgumentException("Layerbreak must be provided for BD-Video hybrid discs");
|
throw new ArgumentException("Layerbreak must be provided for BD-Video hybrid discs");
|
||||||
// Assume disc has default layerbreak
|
// Assume disc has default layerbreak
|
||||||
@@ -184,7 +182,7 @@ namespace LibIRD
|
|||||||
l0es[0], l0es[1], l0es[2], l0es[3],
|
l0es[0], l0es[1], l0es[2], l0es[3],
|
||||||
// 32 bytes of zeros
|
// 32 bytes of zeros
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||||
// Initial portion of PIC again, for 2nd layer
|
// Initial portion of PIC again, for 2nd layer
|
||||||
// ["DI"] [v1] [11unit][DI num]
|
// ["DI"] [v1] [11unit][DI num]
|
||||||
0x44, 0x49, 0x01, 0x11, 0x00, 0x01, 0x20, 0x00,
|
0x44, 0x49, 0x01, 0x11, 0x00, 0x01, 0x20, 0x00,
|
||||||
@@ -232,39 +230,6 @@ namespace LibIRD
|
|||||||
return pic;
|
return pic;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Generates the UID field by computing the CRC32 hash of the ISO
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="isoPath">Path to the ISO</param>
|
|
||||||
/// <exception cref="FileNotFoundException"></exception>
|
|
||||||
private static uint GenerateUID(string isoPath)
|
|
||||||
{
|
|
||||||
// Check file exists
|
|
||||||
FileInfo iso;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
iso = new FileInfo(isoPath);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("Invalid ISO Path: " + e.Message);
|
|
||||||
}
|
|
||||||
if (!iso.Exists)
|
|
||||||
throw new FileNotFoundException(nameof(isoPath));
|
|
||||||
|
|
||||||
// Compute CRC32 hash
|
|
||||||
byte[] crc32;
|
|
||||||
using (FileStream fs = File.OpenRead(isoPath))
|
|
||||||
{
|
|
||||||
Crc32 hasher = new();
|
|
||||||
hasher.Append(fs);
|
|
||||||
crc32 = hasher.GetCurrentHash();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Redump ISO CRC32 hash is used as the Unique ID in the reproducible IRD
|
|
||||||
return BitConverter.ToUInt32(crc32, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Calculates ISO file size
|
/// Calculates ISO file size
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ IRDKit is a tool that allows direct use of LibIRD functionality from a command l
|
|||||||
- Printing info about all ISOs and IRDs in a folder: `irdkit info .`
|
- Printing info about all ISOs and IRDs in a folder: `irdkit info .`
|
||||||
- Creating an IRD from an ISO: `irdkit create game.iso`
|
- Creating an IRD from an ISO: `irdkit create game.iso`
|
||||||
- Finding differences between two IRDs: `irdkit diff game1.ird game2.ird`
|
- Finding differences between two IRDs: `irdkit diff game1.ird game2.ird`
|
||||||
|
- Renaming an IRD or folder of IRDs using a redump DAT: `irdkit rename -d redump.dat game.ird`
|
||||||
|
|
||||||
For detailed usage, read more [here](IRDKit).
|
For detailed usage, read more [here](IRDKit).
|
||||||
|
|
||||||
|
|||||||
+14
-14
@@ -1,15 +1,15 @@
|
|||||||
dotnet publish -c Release -f net8.0 -r win-x86 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
dotnet publish -c Release -f net9.0 -r win-x86 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
||||||
dotnet publish -c Release -f net8.0 -r win-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
dotnet publish -c Release -f net9.0 -r win-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
||||||
dotnet publish -c Release -f net8.0 -r win-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
dotnet publish -c Release -f net9.0 -r win-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
||||||
dotnet publish -c Release -f net8.0 -r linux-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
dotnet publish -c Release -f net9.0 -r linux-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
||||||
dotnet publish -c Release -f net8.0 -r linux-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
dotnet publish -c Release -f net9.0 -r linux-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
||||||
dotnet publish -c Release -f net8.0 -r osx-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
dotnet publish -c Release -f net9.0 -r osx-x64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
||||||
dotnet publish -c Release -f net8.0 -r osx-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
dotnet publish -c Release -f net9.0 -r osx-arm64 --self-contained=false -p:PublishSingleFile=true -p:DebugType=None IRDKit\IRDKit.csproj
|
||||||
|
|
||||||
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/win-x86/publish/irdkit.exe" -Destination "./irdkit-win-x86.zip" -CompressionLevel "Optimal"
|
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/win-x86/publish/irdkit.exe" -Destination "./irdkit-win-x86.zip" -CompressionLevel "Optimal"
|
||||||
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/win-x64/publish/irdkit.exe" -Destination "./irdkit-win-x64.zip" -CompressionLevel "Optimal"
|
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/win-x64/publish/irdkit.exe" -Destination "./irdkit-win-x64.zip" -CompressionLevel "Optimal"
|
||||||
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/win-arm64/publish/irdkit.exe" -Destination "./irdkit-win-arm64.zip" -CompressionLevel "Optimal"
|
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/win-arm64/publish/irdkit.exe" -Destination "./irdkit-win-arm64.zip" -CompressionLevel "Optimal"
|
||||||
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/linux-x64/publish/irdkit" -Destination "./irdkit-linux-x64.zip" -CompressionLevel "Optimal"
|
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/linux-x64/publish/irdkit" -Destination "./irdkit-linux-x64.zip" -CompressionLevel "Optimal"
|
||||||
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/linux-arm64/publish/irdkit" -Destination "./irdkit-linux-arm64.zip" -CompressionLevel "Optimal"
|
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/linux-arm64/publish/irdkit" -Destination "./irdkit-linux-arm64.zip" -CompressionLevel "Optimal"
|
||||||
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/osx-x64/publish/irdkit" -Destination "./irdkit-osx-x64.zip" -CompressionLevel "Optimal"
|
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/osx-x64/publish/irdkit" -Destination "./irdkit-osx-x64.zip" -CompressionLevel "Optimal"
|
||||||
Compress-Archive -Path "./IRDKit/bin/Release/net8.0/osx-arm64/publish/irdkit" -Destination "./irdkit-osx-arm64.zip" -CompressionLevel "Optimal"
|
Compress-Archive -Path "./IRDKit/bin/Release/net9.0/osx-arm64/publish/irdkit" -Destination "./irdkit-osx-arm64.zip" -CompressionLevel "Optimal"
|
||||||
Reference in New Issue
Block a user