Print IRD fields, add a READEME
This commit is contained in:
+5
-23
@@ -19,41 +19,23 @@ namespace BuildIRD
|
||||
|
||||
IRD ird1 = new ReIRD("./game.iso", discKey);
|
||||
ird1.Write("./test1.ird");
|
||||
Console.WriteLine("IRD created using .key:");
|
||||
|
||||
// Read IRD and print details to console
|
||||
IRD ird = IRD.Read("./test1.ird");
|
||||
Console.WriteLine("IRD Version: " + ird.Version);
|
||||
Console.WriteLine("Title ID: " + ird.TitleID);
|
||||
Console.WriteLine("Title: " + ird.Title);
|
||||
Console.WriteLine("System Version: " + ird.SystemVersion);
|
||||
Console.WriteLine("Game Version: " + ird.GameVersion);
|
||||
Console.WriteLine("App Version: " + ird.AppVersion);
|
||||
ird1.Print();
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
Console.WriteLine("File not found: " + e.FileName);
|
||||
Console.WriteLine("ERROR: File not found");
|
||||
}
|
||||
|
||||
// Create new reproducible redump-style IRD with a GetKey log
|
||||
// Create new reproducible redump-style IRD with a ManaGunZ log
|
||||
try
|
||||
{
|
||||
IRD ird2 = new ReIRD("./game.iso", "./log.getkey.log");
|
||||
ird2.Write("./test2.ird");
|
||||
Console.WriteLine("IRD created using .getkey.log:");
|
||||
|
||||
// Read IRD and print details to console
|
||||
IRD ird = IRD.Read("./test2.ird");
|
||||
Console.WriteLine("IRD Version: " + ird.Version);
|
||||
Console.WriteLine("Title ID: " + ird.TitleID);
|
||||
Console.WriteLine("Title: " + ird.Title);
|
||||
Console.WriteLine("System Version: " + ird.SystemVersion);
|
||||
Console.WriteLine("Game Version: " + ird.GameVersion);
|
||||
Console.WriteLine("App Version: " + ird.AppVersion);
|
||||
ird2.Print();
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
Console.WriteLine("File not found: " + e.FileName);
|
||||
Console.WriteLine("ERROR: File not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1242,6 +1242,43 @@ namespace LibIRD
|
||||
uid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints IRD fields to console
|
||||
/// </summary>
|
||||
public void Print()
|
||||
{
|
||||
// Build string from parameters
|
||||
StringBuilder print = new();
|
||||
print.AppendLine("IRD Contents:");
|
||||
print.AppendLine("=============");
|
||||
|
||||
// Append IRD fields to string builder
|
||||
print.AppendLine($"Magic: 3IRD");
|
||||
print.AppendLine($"IRD Version: {Version}");
|
||||
print.AppendLine($"Title ID: {TitleID}");
|
||||
print.AppendLine($"Title: {Title}");
|
||||
print.AppendLine($"PUP Version: {SystemVersion}");
|
||||
print.AppendLine($"Game Version: {GameVersion}");
|
||||
print.AppendLine($"App Version: {AppVersion}");
|
||||
print.AppendLine($"Regions: {RegionCount}");
|
||||
print.AppendLine($"Files: {FileCount}");
|
||||
if (ExtraConfig != 0x0000)
|
||||
print.AppendLine($"Extra Config: {ExtraConfig:X4}");
|
||||
if (Attachments != 0x0000)
|
||||
print.AppendLine($"Attachments: {Attachments:X4}");
|
||||
print.AppendLine($"Unique ID: {UID:X8}");
|
||||
print.AppendLine($"Data 1 Key: {Convert.ToHexString(Data1Key)}");
|
||||
print.AppendLine($"Data 2 Key: {Convert.ToHexString(Data2Key)}");
|
||||
print.AppendLine($"PIC: {Convert.ToHexString(PIC)}");
|
||||
print.AppendLine();
|
||||
|
||||
// Ensure UTF-8 will display properly
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
|
||||
// Print formatted string
|
||||
Console.Write(print);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
<!-- Package Properties -->
|
||||
<Authors>Deterous</Authors>
|
||||
<Description>Library for ISO Rebuild Data</Description>
|
||||
<Copyright>Copyright (c)2023 Deterous</Copyright>
|
||||
<Copyright>Copyright (c) Deterous 2023</Copyright>
|
||||
<PackageReadmeFile>README.MD</PackageReadmeFile>
|
||||
<RepositoryUrl>https://github.com/Deterous/LibIRD</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageTags>ps3 iso ird</PackageTags>
|
||||
|
||||
+5
-2
@@ -208,7 +208,9 @@ namespace LibIRD
|
||||
public void Print()
|
||||
{
|
||||
// Build string from parameters
|
||||
StringBuilder print = new("PARAM.SFO Contents:\n====================\n");
|
||||
StringBuilder print = new();
|
||||
print.AppendLine("PARAM.SFO Contents:");
|
||||
print.AppendLine("====================");
|
||||
|
||||
// Loop through all parameters in PARAM.SFO
|
||||
for (int i = 0; i < ParamCount; i++)
|
||||
@@ -221,9 +223,10 @@ namespace LibIRD
|
||||
{
|
||||
case 0x0404:
|
||||
print.Append(Params[i].IntValue);
|
||||
print.AppendLine();
|
||||
break;
|
||||
default:
|
||||
print.Append(Params[i].StringValue);
|
||||
print.AppendLine(Params[i].StringValue);
|
||||
break;
|
||||
}
|
||||
print.Append('\n');
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ namespace LibIRD
|
||||
/// <summary>
|
||||
/// ISO file size
|
||||
/// </summary>
|
||||
public long Size { get; private set; }
|
||||
private long Size { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1 +1,43 @@
|
||||
# WIP
|
||||
# Library for ISO Rebuild Data (LibIRD)
|
||||
|
||||
This .NET library provides methods for generating, writing, and reading IRD files. Functionality is provided for deterministically generating IRDs such that a redump ISO and key have a 1-to-1 correspondence with an unique IRD file.
|
||||
|
||||
## How to use LibIRD
|
||||
|
||||
### Reproducible, redump-style IRDs
|
||||
|
||||
The standard way of generating a reproducible, redump-style IRD with LibIRD is with a redump ISO file and a redump key file (e.g. http://redump.org/disc/28721/key/):
|
||||
```
|
||||
byte[] discKey = File.ReadAllBytes("./game.key");
|
||||
IRD ird = new ReIRD("./game.iso", discKey);
|
||||
```
|
||||
alternatively, the disc key can be extracted from a [ManaGunZ](https://github.com/Zarh/ManaGunZ/) .getkey.log file:
|
||||
```
|
||||
IRD ird = new ReIRD("./game.iso", "./game.getkey.log");
|
||||
```
|
||||
|
||||
### Custom IRDs
|
||||
|
||||
Functionality is also provided for creating custom IRDs, with whatever data you want. One way is to use an ISO with a custom disc key, disc ID, and PIC:
|
||||
```
|
||||
byte[] discKey = new byte[16];
|
||||
byte[] discID = new byte[16];
|
||||
byte[] PIC = new byte[115];
|
||||
// Set vars to desired values
|
||||
IRD ird = new IRD("./game.iso", discKey, discID, discPIC);
|
||||
```
|
||||
As before, a [ManaGunZ](https://github.com/Zarh/ManaGunZ/) log file can also be used with an ISO to create an IRD, with the disc key, disc ID, and PIC all being extracted from the .getkey.log file.
|
||||
```
|
||||
IRD ird = new IRD("./game.iso", "./game.getkey.log");
|
||||
```
|
||||
Finally, an existing IRD file can be read to create an IRD:
|
||||
```
|
||||
IRD ird = IRD.Read("./game.ird")
|
||||
```
|
||||
|
||||
An IRD can be then be tweaked, its fields printed, and written to a new IRD:
|
||||
```
|
||||
ird.UID = 0x9F1A51D8;
|
||||
ird.Print();
|
||||
ird.Write("game2.ird");
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user