@@ -112,8 +112,13 @@ public class DiskStorage implements Storage
|
|||||||
public byte[] readIndex(int indexId) throws IOException
|
public byte[] readIndex(int indexId) throws IOException
|
||||||
{
|
{
|
||||||
IndexEntry entry = index255.read(indexId);
|
IndexEntry entry = index255.read(indexId);
|
||||||
byte[] indexData = data.read(index255.getIndexFileId(), entry.getId(), entry.getSector(), entry.getLength());
|
if (entry != null)
|
||||||
return indexData;
|
{
|
||||||
|
byte[] indexData = data.read(index255.getIndexFileId(), entry.getId(), entry.getSector(), entry.getLength());
|
||||||
|
return indexData;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadIndex(Index index) throws IOException
|
private void loadIndex(Index index) throws IOException
|
||||||
@@ -121,6 +126,12 @@ public class DiskStorage implements Storage
|
|||||||
logger.trace("Loading index {}", index.getId());
|
logger.trace("Loading index {}", index.getId());
|
||||||
|
|
||||||
byte[] indexData = readIndex(index.getId());
|
byte[] indexData = readIndex(index.getId());
|
||||||
|
|
||||||
|
if (indexData == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Container res = Container.decompress(indexData, null);
|
Container res = Container.decompress(indexData, null);
|
||||||
byte[] data = res.data;
|
byte[] data = res.data;
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ import com.google.gson.Gson;
|
|||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import net.runelite.cache.fs.Store;
|
import net.runelite.cache.fs.Store;
|
||||||
import net.runelite.data.dump.MediaWiki;
|
import net.runelite.data.dump.MediaWiki;
|
||||||
import net.runelite.data.dump.wiki.NpcStatsDumper;
|
import net.runelite.data.dump.wiki.NpcStatsDumper;
|
||||||
@@ -40,9 +43,16 @@ public class App
|
|||||||
|
|
||||||
public static void main(String[] args) throws IOException
|
public static void main(String[] args) throws IOException
|
||||||
{
|
{
|
||||||
final File home = new File(System.getProperty("user.home"));
|
Path path = Paths.get(System.getProperty("user.home"), "jagexcache" + File.separator + "oldschool" + File.separator + "LIVE");
|
||||||
final Store cacheStore = new Store(new File(home,
|
final File jagexcache = new File(String.valueOf(path));
|
||||||
"jagexcache" + File.separator + "oldschool" + File.separator + "LIVE"));
|
|
||||||
|
if (!Files.exists(path))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Store cacheStore = new Store(jagexcache);
|
||||||
|
|
||||||
cacheStore.load();
|
cacheStore.load();
|
||||||
|
|
||||||
// Try to make this go faster (probably not very smart)
|
// Try to make this go faster (probably not very smart)
|
||||||
|
|||||||
Reference in New Issue
Block a user