Make SI partitions optional for Wii U discs

This commit is contained in:
Maschell 2019-04-14 13:24:35 +02:00
parent 6e9b8df971
commit 7d8bb58cc4

View File

@ -108,7 +108,10 @@ public final class WUDInfoParser {
internalPartitions.put(partitionName, partitionOffset); internalPartitions.put(partitionName, partitionOffset);
} }
Map<String, WUDPartition> partitionsResult = new HashMap<>();
val siPartitionOpt = internalPartitions.entrySet().stream().filter(e -> e.getKey().startsWith("SI")).findFirst(); val siPartitionOpt = internalPartitions.entrySet().stream().filter(e -> e.getKey().startsWith("SI")).findFirst();
if (siPartitionOpt.isPresent()) {
val siPartitionPair = siPartitionOpt.orElseThrow(() -> new ParseException("SI partition not found.", 0)); val siPartitionPair = siPartitionOpt.orElseThrow(() -> new ParseException("SI partition not found.", 0));
// siPartition // siPartition
@ -130,8 +133,6 @@ public final class WUDInfoParser {
FST siFST = FST.parseFST(fileTableBlock, null); FST siFST = FST.parseFST(fileTableBlock, null);
Map<String, WUDPartition> partitionsResult = new HashMap<>();
for (val dirChilden : siFST.getRoot().getDirChildren()) { for (val dirChilden : siFST.getRoot().getDirChildren()) {
// The SI partition contains the tmd, cert and tik for every GM partition. // The SI partition contains the tmd, cert and tik for every GM partition.
byte[] rawTIK = getFSTEntryAsByte(dirChilden.getFullPath() + File.separator + WUD_TICKET_FILENAME, siPartitionOffset, siFST, byte[] rawTIK = getFSTEntryAsByte(dirChilden.getFullPath() + File.separator + WUD_TICKET_FILENAME, siPartitionOffset, siFST,
@ -153,6 +154,7 @@ public final class WUDInfoParser {
curPartition.setPartitionHeader(partitionHeader); curPartition.setPartitionHeader(partitionHeader);
partitionsResult.put(curPartitionPair.getKey(), curPartition); partitionsResult.put(curPartitionPair.getKey(), curPartition);
} }
}
val dataPartitions = internalPartitions.entrySet().stream().filter(e -> !e.getKey().startsWith("GM")).collect(Collectors.toList()); val dataPartitions = internalPartitions.entrySet().stream().filter(e -> !e.getKey().startsWith("GM")).collect(Collectors.toList());
for (val dataPartition : dataPartitions) { for (val dataPartition : dataPartitions) {