mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-22 07:59:19 +01:00
Give the NUSDataProvider implementation a hint to limit the length of the content stream
This commit is contained in:
parent
a58c1c5b77
commit
1f02e9d41d
@ -119,7 +119,26 @@ public class FSTDataProviderNUSTitle implements FSTDataProvider, HasNUSTitle {
|
||||
|
||||
NUSDataProvider dataProvider = title.getDataProvider();
|
||||
|
||||
InputStream in = dataProvider.getInputStreamFromContent(c, fileOffsetBlock);
|
||||
Optional<Long> readFilesize = Optional.empty();
|
||||
if (c.isHashed()) {
|
||||
long offsetInBlock = fileOffset - ((fileOffsetBlock / 0x10000) * 0xFC00);
|
||||
if (offsetInBlock + fileSize < 0xFC00) {
|
||||
readFilesize = Optional.of(0x10000L);
|
||||
} else {
|
||||
long curVal = 0x10000;
|
||||
long missing = (fileSize - (0xFC00 - offsetInBlock));
|
||||
|
||||
curVal += (missing / 0xFC00) * 0x10000;
|
||||
|
||||
if (missing % 0xFC00 > 0) {
|
||||
curVal += 0x10000;
|
||||
}
|
||||
|
||||
readFilesize = Optional.of(curVal);
|
||||
}
|
||||
}
|
||||
|
||||
InputStream in = dataProvider.getInputStreamFromContent(c, fileOffsetBlock, readFilesize);
|
||||
|
||||
try {
|
||||
NUSDecryption nusdecryption = new NUSDecryption(title.getTicket().get());
|
||||
|
Loading…
Reference in New Issue
Block a user