mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-25 09:26:55 +01:00
Caclulate how much of the stream actually is needed
This commit is contained in:
parent
e461e78313
commit
79365a9fe6
@ -110,12 +110,21 @@ public class FSTDataProviderNUSTitle implements FSTDataProvider, HasNUSTitle {
|
||||
streamFilesize = curVal;
|
||||
}
|
||||
} else {
|
||||
streamOffset = (payloadOffset / 0x8000) * 0x8000;
|
||||
// We need the previous IV if we don't start at the first block.
|
||||
if (payloadOffset >= 0x8000 && payloadOffset % 0x8000 == 0) {
|
||||
streamOffset -= 16;
|
||||
if (size != entry.getFileSize()) {
|
||||
streamOffset = (payloadOffset / 0x8000) * 0x8000;
|
||||
|
||||
// We need the missing bytes of the previous blocks + the size we want to read.
|
||||
streamFilesize = size;
|
||||
long offsetInBlock = offset - streamOffset;
|
||||
streamFilesize += offsetInBlock;
|
||||
|
||||
// We need the previous IV if we don't start at the first block.
|
||||
if (payloadOffset >= 0x8000 && payloadOffset % 0x8000 == 0) {
|
||||
streamOffset -= 16;
|
||||
streamFilesize += 16;
|
||||
}
|
||||
}
|
||||
streamFilesize = c.getEncryptedFileSize();
|
||||
|
||||
}
|
||||
|
||||
NUSDataProvider dataProvider = title.getDataProvider();
|
||||
|
Loading…
Reference in New Issue
Block a user