diff --git a/src/de/mas/wiiu/jnus/NUSTitle.java b/src/de/mas/wiiu/jnus/NUSTitle.java index ac3df95..4498ebd 100644 --- a/src/de/mas/wiiu/jnus/NUSTitle.java +++ b/src/de/mas/wiiu/jnus/NUSTitle.java @@ -16,6 +16,7 @@ ****************************************************************************/ package de.mas.wiiu.jnus; +import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -69,8 +70,10 @@ public class NUSTitle { } public FSTEntry getFSTEntryByFullPath(String givenFullPath) { - String fullPath = givenFullPath.replaceAll("/", "\\\\"); - if (!fullPath.startsWith("\\")) fullPath = "\\" + fullPath; + String fullPath = givenFullPath.replace("/", File.separator); + if (!fullPath.startsWith(File.separator)) { + fullPath = File.separator + fullPath; + } for (FSTEntry f : getAllFSTEntriesFlat()) { if (f.getFullPath().equals(fullPath)) { return f; @@ -86,7 +89,7 @@ public class NUSTitle { List result = new ArrayList<>(); for (FSTEntry f : files) { - String match = f.getFullPath().replaceAll("\\\\", "/"); + String match = f.getFullPath().replace(File.separator, "/"); Matcher m = p.matcher(match); if (m.matches()) { result.add(f); diff --git a/src/de/mas/wiiu/jnus/entities/fst/FSTService.java b/src/de/mas/wiiu/jnus/entities/fst/FSTService.java index 9a4571e..cc243dd 100644 --- a/src/de/mas/wiiu/jnus/entities/fst/FSTService.java +++ b/src/de/mas/wiiu/jnus/entities/fst/FSTService.java @@ -51,7 +51,7 @@ public final class FSTService { fstEntryToOffsetMap.put(0, rootEntry); int lastlevel = level; - String path = "\\"; + String path = File.separator; FSTEntry last = null; for (int i = 1; i < totalEntries; i++) { diff --git a/src/de/mas/wiiu/jnus/implementations/woomy/WoomyParser.java b/src/de/mas/wiiu/jnus/implementations/woomy/WoomyParser.java index e6c35ce..db105b7 100644 --- a/src/de/mas/wiiu/jnus/implementations/woomy/WoomyParser.java +++ b/src/de/mas/wiiu/jnus/implementations/woomy/WoomyParser.java @@ -90,7 +90,7 @@ public final class WoomyParser { String entryName = entry.getName(); Matcher matcher = pattern.matcher(entryName); if (matcher.matches()) { - String[] tokens = entryName.split("[\\\\|/]"); // We only want the filename! + String[] tokens = entryName.replace(File.separator, "\\").split("[\\\\|/]"); // We only want the filename! String filename = tokens[tokens.length - 1]; result.put(filename.toLowerCase(Locale.ENGLISH), entry); } diff --git a/src/de/mas/wiiu/jnus/implementations/wud/parser/WUDInfoParser.java b/src/de/mas/wiiu/jnus/implementations/wud/parser/WUDInfoParser.java index a8103c4..7d414c7 100644 --- a/src/de/mas/wiiu/jnus/implementations/wud/parser/WUDInfoParser.java +++ b/src/de/mas/wiiu/jnus/implementations/wud/parser/WUDInfoParser.java @@ -16,6 +16,8 @@ ****************************************************************************/ package de.mas.wiiu.jnus.implementations.wud.parser; +import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -136,11 +138,11 @@ public final class WUDInfoParser { for (val dirChilden : siFST.getRoot().getDirChildren()) { // The SI partition contains the tmd, cert and tik for every GM partition. - byte[] rawTIK = getFSTEntryAsByte(dirChilden.getFullPath() + "\\" + WUD_TICKET_FILENAME, siPartition, siFST, wudInfo.getWUDDiscReader(), + byte[] rawTIK = getFSTEntryAsByte(dirChilden.getFullPath() + File.separator + WUD_TICKET_FILENAME, siPartition, siFST, wudInfo.getWUDDiscReader(), wudInfo.getTitleKey()); - byte[] rawTMD = getFSTEntryAsByte(dirChilden.getFullPath() + "\\" + WUD_TMD_FILENAME, siPartition, siFST, wudInfo.getWUDDiscReader(), + byte[] rawTMD = getFSTEntryAsByte(dirChilden.getFullPath() + File.separator + WUD_TMD_FILENAME, siPartition, siFST, wudInfo.getWUDDiscReader(), wudInfo.getTitleKey()); - byte[] rawCert = getFSTEntryAsByte(dirChilden.getFullPath() + "\\" + WUD_CERT_FILENAME, siPartition, siFST, wudInfo.getWUDDiscReader(), + byte[] rawCert = getFSTEntryAsByte(dirChilden.getFullPath() + File.separator + WUD_CERT_FILENAME, siPartition, siFST, wudInfo.getWUDDiscReader(), wudInfo.getTitleKey()); String partitionName = "GM" + Utils.ByteArrayToString(Arrays.copyOfRange(rawTIK, 0x1DC, 0x1DC + 0x08)); @@ -179,6 +181,11 @@ public final class WUDInfoParser { private static byte[] getFSTEntryAsByte(String filePath, WUDPartition partition, FST fst, WUDDiscReader discReader, byte[] key) throws IOException { FSTEntry entry = getEntryByFullPath(fst.getRoot(), filePath); + if(entry == null) { + String errormsg = "FSTEntry with name \"" + filePath + "\" not found."; + log.warning(errormsg); + throw new FileNotFoundException(errormsg); + } ContentFSTInfo info = fst.getContentFSTInfos().get((int) entry.getContentFSTID()); diff --git a/src/de/mas/wiiu/jnus/utils/HashUtil.java b/src/de/mas/wiiu/jnus/utils/HashUtil.java index 9335c64..9049c02 100644 --- a/src/de/mas/wiiu/jnus/utils/HashUtil.java +++ b/src/de/mas/wiiu/jnus/utils/HashUtil.java @@ -236,7 +236,7 @@ public final class HashUtil { if (!Arrays.equals(real_h0_hash, expected_h0_hash)) { throw new CheckSumWrongException("h0 checksumfail", real_h0_hash, expected_h0_hash); } else { - log.finest("h1 checksum right!"); + log.finest("h0 checksum right!"); } if ((block % 16) == 0) {