Skip to content

Commit

Permalink
Small bug fix for RS3 caches.
Browse files Browse the repository at this point in the history
  • Loading branch information
Displee committed Apr 13, 2019
1 parent 8906a39 commit f255d8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
Binary file modified RS2-Cache-Library.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions src/main/java/org/displee/cache/index/Index.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public boolean writeArchiveSector(int id, byte[] data) {
while (written < data.length) {
int currentPosition = 0;
if (overWrite) {
super.origin.getMainFile().seek(position * Constants.ARCHIVE_SIZE);
super.origin.getMainFile().seek((long) position * Constants.ARCHIVE_SIZE);
super.origin.getMainFile().read(buffer, 0, archiveHeaderSize);
archiveSector.read(new InputStream(buffer));
currentPosition = archiveSector.getNextPosition();
Expand Down Expand Up @@ -314,7 +314,7 @@ public boolean writeArchiveSector(int id, byte[] data) {
archiveSector.setType(archiveDataSize == 510 ? 1 : 0);
archiveSector.setChunk(chunk);
archiveSector.setPosition(currentPosition);
super.origin.getMainFile().seek(position * Constants.ARCHIVE_SIZE);
super.origin.getMainFile().seek((long) position * Constants.ARCHIVE_SIZE);
archiveSector.write(new OutputStream(archiveHeaderSize));
super.origin.getMainFile().write(archiveSector.write(new OutputStream(archiveHeaderSize)), 0, archiveHeaderSize);
int length = data.length - written;
Expand Down
24 changes: 2 additions & 22 deletions src/test/java/Test.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,11 @@
import org.displee.CacheLibrary;
import org.displee.CacheLibraryMode;
import org.displee.cache.index.Index;
import org.displee.cache.index.archive.Archive;
import org.displee.cache.index.archive.Archive317;
import org.displee.io.impl.InputStream;
import org.displee.io.impl.OutputStream;
import org.displee.utilities.GZIPCompressor;
import org.displee.utilities.HashGenerator;

import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;

public class Test {

public static void main(String[] args) throws Exception {
test1();
//System.out.println("");
//test2();
}

//0 = config, models = 1, animation = 2, midi = 3, maps = 4
private static void test1() throws Exception {
CacheLibrary cache = new CacheLibrary("C:\\Users\\Maffia\\RuthlessPSCache", CacheLibraryMode.UN_CACHED);
Index index = cache.getIndex(7);
Archive archive = index.getArchive(0);
System.out.println(archive.getInfo());
CacheLibrary lib = new CacheLibrary("C:\\Users\\Maffia\\Documents\\RSPS\\RS3\\861\\861 Cache editing", CacheLibraryMode.UN_CACHED);
System.out.println(lib.getLastIndex());
}

}

0 comments on commit f255d8f

Please sign in to comment.