Start work on CLI tool

This commit is contained in:
Deterous
2023-11-16 11:45:21 +13:00
parent b794ec8f96
commit e665391e47
11 changed files with 217 additions and 100 deletions
+1 -1
View File
@@ -1285,7 +1285,7 @@ namespace LibIRD
print.AppendLine("=============");
// Append IRD fields to string builder
print.AppendLine($"Magic: 3IRD");
print.AppendLine($"Magic: {Encoding.ASCII.GetString(Magic)}");
print.AppendLine($"IRD Version: {Version}");
print.AppendLine($"Title ID: {TitleID}");
print.AppendLine($"Title: {Title}");
+3 -3
View File
@@ -9,16 +9,16 @@
<!-- Package Properties -->
<Authors>Deterous</Authors>
<Description>Library for ISO Rebuild Data</Description>
<Copyright>Copyright (c) Deterous 2023</Copyright>
<Copyright>Copyright (c) 2023 Deterous</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/Deterous/LibIRD</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>ps3 iso ird</PackageTags>
<PackageTags>ps3 iso ird redump</PackageTags>
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
</PropertyGroup>
<ItemGroup>
<None Include="../README.md" Pack="true" PackagePath=""/>
<None Include="./README.md" Pack="true" PackagePath=""/>
</ItemGroup>
<ItemGroup>
+4
View File
@@ -100,6 +100,10 @@ namespace LibIRD
get
{
int index = Array.FindIndex(Params, param => param.Name == key);
if (index == -1)
return null;
if (Params[index].DataFormat == 0x0404)
return Params[index].IntValue.ToString();
return Params[index].StringValue;
}
}
+40
View File
@@ -0,0 +1,40 @@
## How to use the LibIRD library
LibIRD was originally made for creating reproducible, redump-style IRDs when dumping PS3 discs with [MPF](https://github.com/SabreTools/MPF). If you wish to integrate LibIRD into your own application, the following are some examples.
### Reproducible, redump-style IRDs
The standard way of generating a reproducible, redump-style IRD is with a redump ISO file and a redump key file (e.g. http://redump.org/disc/28721/key/):
```cs
byte[] discKey = File.ReadAllBytes("./game.key");
IRD ird = new ReIRD("./game.iso", discKey);
```
Alternatively, the disc key can be extracted from a [GetKey](https://archive.org/download/GetKeyR2GameOS.7z/GetKey-r2-GameOS.7z) log file obtained from a PS3 (or when dumping using [ManaGunZ](https://github.com/Zarh/ManaGunZ/))
```cs
IRD ird = new ReIRD("./game.iso", "./game.getkey.log");
```
### Custom IRDs
Functionality is also provided for creating IRDs with a custom disc key, disc ID, and PIC:
```cs
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 GetKey log file can also be used with an ISO to create a custom IRD, with the disc key, disc ID, and PIC all being extracted from the log file (rather than just the key for redump-style IRDs).
```cs
IRD ird = new IRD("./game.iso", "./game.getkey.log");
```
Finally, an existing IRD file can be read to create an IRD:
```cs
IRD ird = IRD.Read("./game.ird")
```
An IRD can be then be tweaked, its fields printed, and written to a new IRD:
```cs
ird.UID = 0x9F1A51D8;
ird.Print();
ird.Write("game2.ird");
```