Skip to content

Commit

Permalink
Strings files are now loaded correctly. Unsure why almost the same co…
Browse files Browse the repository at this point in the history
…de has to be called twice.
  • Loading branch information
tstavrianos committed Jul 12, 2017
1 parent 6094829 commit f4932c6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/skyproc/BSA.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ public LShrinkArray getFile(String filePath1) throws IOException, DataFormatExce
}
aSize--;
}
SPGlobal.logSpecial(LogTypes.BSA, header, filePath);
SPGlobal.logSpecial(LogTypes.BSA, header, filePath1);
SPGlobal.logSpecial(LogTypes.BSA, header, "" + isCompressed(ref));
if (isCompressed(ref))
{
int uncompressedSize = Ln.arrayToInt(in.extractInts(4));
Expand All @@ -229,10 +226,8 @@ public LShrinkArray getFile(String filePath1) throws IOException, DataFormatExce

Lz4Decompressor decompressor2 = new Lz4Decompressor();
byte[] uncompressedByteData = new byte[uncompressedSize];
SPGlobal.logSpecial(LogTypes.BSA, header, "" + aSize + " - " + uncompressedSize);

int decompressedLength2 = decompressor2.decompress(compressedByteData, 0, aSize, uncompressedByteData, 0, uncompressedSize);

return new LShrinkArray(ByteBuffer.wrap(uncompressedByteData));
}
return new LShrinkArray(in.extract(0, aSize));
Expand Down
26 changes: 26 additions & 0 deletions src/skyproc/Mod.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,32 @@ void addStream(Map<SubStringPointer.Files, LImport> streams, SubStringPointer.Fi
}
return;
}
else
{
//check for plugin loaded BSA has strings file
for (BSA theBSA : BSA.getPluginBSAs())
{
theBSA.loadFolders();
if (!theBSA.hasFile(stringPath)) {
continue;
}
LByteChannel stream = new LByteChannel();
stream.openStream(theBSA.getFile(stringPath));
streams.put(file, stream);
return;
}
// check for resource loaded BSA with strings file
for (BSA theBSA : BSA.getResourceBSAa()) {
theBSA.loadFolders();
if (!theBSA.hasFile(stringPath)) {
continue;
}
LByteChannel stream = new LByteChannel();
stream.openStream(theBSA.getFile(stringPath));
streams.put(file, stream);
return;
}
}

if (SPGlobal.logMods) {
SPGlobal.logMod(this, getName(), "No strings file for " + file);
Expand Down

0 comments on commit f4932c6

Please sign in to comment.