mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-29 11:24:20 +01:00
Fix some paths for *nix users.
This commit is contained in:
parent
8016b3edaf
commit
fa3b0df7d2
@ -16,6 +16,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
package de.mas.wiiu.jnus;
|
package de.mas.wiiu.jnus;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -69,8 +70,10 @@ public class NUSTitle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FSTEntry getFSTEntryByFullPath(String givenFullPath) {
|
public FSTEntry getFSTEntryByFullPath(String givenFullPath) {
|
||||||
String fullPath = givenFullPath.replaceAll("/", "\\\\");
|
String fullPath = givenFullPath.replace("/", File.separator);
|
||||||
if (!fullPath.startsWith("\\")) fullPath = "\\" + fullPath;
|
if (!fullPath.startsWith(File.separator)) {
|
||||||
|
fullPath = File.separator + fullPath;
|
||||||
|
}
|
||||||
for (FSTEntry f : getAllFSTEntriesFlat()) {
|
for (FSTEntry f : getAllFSTEntriesFlat()) {
|
||||||
if (f.getFullPath().equals(fullPath)) {
|
if (f.getFullPath().equals(fullPath)) {
|
||||||
return f;
|
return f;
|
||||||
@ -86,7 +89,7 @@ public class NUSTitle {
|
|||||||
List<FSTEntry> result = new ArrayList<>();
|
List<FSTEntry> result = new ArrayList<>();
|
||||||
|
|
||||||
for (FSTEntry f : files) {
|
for (FSTEntry f : files) {
|
||||||
String match = f.getFullPath().replaceAll("\\\\", "/");
|
String match = f.getFullPath().replace(File.separator, "/");
|
||||||
Matcher m = p.matcher(match);
|
Matcher m = p.matcher(match);
|
||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
result.add(f);
|
result.add(f);
|
||||||
|
@ -51,7 +51,7 @@ public final class FSTService {
|
|||||||
fstEntryToOffsetMap.put(0, rootEntry);
|
fstEntryToOffsetMap.put(0, rootEntry);
|
||||||
|
|
||||||
int lastlevel = level;
|
int lastlevel = level;
|
||||||
String path = "\\";
|
String path = File.separator;
|
||||||
|
|
||||||
FSTEntry last = null;
|
FSTEntry last = null;
|
||||||
for (int i = 1; i < totalEntries; i++) {
|
for (int i = 1; i < totalEntries; i++) {
|
||||||
|
@ -90,7 +90,7 @@ public final class WoomyParser {
|
|||||||
String entryName = entry.getName();
|
String entryName = entry.getName();
|
||||||
Matcher matcher = pattern.matcher(entryName);
|
Matcher matcher = pattern.matcher(entryName);
|
||||||
if (matcher.matches()) {
|
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];
|
String filename = tokens[tokens.length - 1];
|
||||||
result.put(filename.toLowerCase(Locale.ENGLISH), entry);
|
result.put(filename.toLowerCase(Locale.ENGLISH), entry);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
package de.mas.wiiu.jnus.implementations.wud.parser;
|
package de.mas.wiiu.jnus.implementations.wud.parser;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.ByteOrder;
|
import java.nio.ByteOrder;
|
||||||
@ -136,11 +138,11 @@ public final class WUDInfoParser {
|
|||||||
|
|
||||||
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() + "\\" + WUD_TICKET_FILENAME, siPartition, siFST, wudInfo.getWUDDiscReader(),
|
byte[] rawTIK = getFSTEntryAsByte(dirChilden.getFullPath() + File.separator + WUD_TICKET_FILENAME, siPartition, siFST, wudInfo.getWUDDiscReader(),
|
||||||
wudInfo.getTitleKey());
|
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());
|
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());
|
wudInfo.getTitleKey());
|
||||||
|
|
||||||
String partitionName = "GM" + Utils.ByteArrayToString(Arrays.copyOfRange(rawTIK, 0x1DC, 0x1DC + 0x08));
|
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 {
|
private static byte[] getFSTEntryAsByte(String filePath, WUDPartition partition, FST fst, WUDDiscReader discReader, byte[] key) throws IOException {
|
||||||
FSTEntry entry = getEntryByFullPath(fst.getRoot(), filePath);
|
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());
|
ContentFSTInfo info = fst.getContentFSTInfos().get((int) entry.getContentFSTID());
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ public final class HashUtil {
|
|||||||
if (!Arrays.equals(real_h0_hash, expected_h0_hash)) {
|
if (!Arrays.equals(real_h0_hash, expected_h0_hash)) {
|
||||||
throw new CheckSumWrongException("h0 checksumfail", real_h0_hash, expected_h0_hash);
|
throw new CheckSumWrongException("h0 checksumfail", real_h0_hash, expected_h0_hash);
|
||||||
} else {
|
} else {
|
||||||
log.finest("h1 checksum right!");
|
log.finest("h0 checksum right!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((block % 16) == 0) {
|
if ((block % 16) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user