Rename IndexStore to be more accurate, rename rest in Archive

This commit is contained in:
Lucas
2019-07-07 06:35:37 +02:00
parent eeeafb93b7
commit b81aa94685
11 changed files with 112 additions and 111 deletions

View File

@@ -15,14 +15,14 @@ public class Archive extends AbstractArchive {
@ObfuscatedSignature(
signature = "Lff;"
)
@Export("indexStore")
IndexStore indexStore;
@Export("archiveDisk")
ArchiveDisk archiveDisk;
@ObfuscatedName("r")
@ObfuscatedSignature(
signature = "Lff;"
)
@Export("referenceStore")
IndexStore referenceStore;
@Export("masterDisk")
ArchiveDisk masterDisk;
@ObfuscatedName("p")
@ObfuscatedGetter(
intValue = -1579549759
@@ -34,20 +34,20 @@ public class Archive extends AbstractArchive {
@ObfuscatedName("ag")
boolean field404;
@ObfuscatedName("aq")
@Export("validArchives")
volatile boolean[] validArchives;
@Export("validGroups")
volatile boolean[] validGroups;
@ObfuscatedName("av")
@ObfuscatedGetter(
intValue = 1472870917
)
@Export("indexReferenceCrc")
int indexReferenceCrc;
@Export("indexCrc")
int indexCrc;
@ObfuscatedName("ar")
@ObfuscatedGetter(
intValue = -785528219
)
@Export("indexReferenceVersion")
int indexReferenceVersion;
@Export("indexVersion")
int indexVersion;
@ObfuscatedName("ac")
@ObfuscatedGetter(
intValue = -1884661133
@@ -57,13 +57,13 @@ public class Archive extends AbstractArchive {
@ObfuscatedSignature(
signature = "(Lff;Lff;IZZZ)V"
)
public Archive(IndexStore var1, IndexStore var2, int var3, boolean var4, boolean var5, boolean var6) {
public Archive(ArchiveDisk var1, ArchiveDisk var2, int var3, boolean var4, boolean var5, boolean var6) {
super(var4, var5);
this.field403 = false;
this.field404 = false;
this.field405 = -1;
this.indexStore = var1;
this.referenceStore = var2;
this.archiveDisk = var1;
this.masterDisk = var2;
this.index = var3;
this.field404 = var6;
int var7 = this.index;
@@ -101,7 +101,7 @@ public class Archive extends AbstractArchive {
)
@Export("groupLoadPercent")
int groupLoadPercent(int var1) {
return super.groups[var1] != null ? 100 : (this.validArchives[var1] ? 100 : class54.method1086(this.index, var1));
return super.groups[var1] != null ? 100 : (this.validGroups[var1] ? 100 : class54.method1086(this.index, var1));
}
@ObfuscatedName("z")
@@ -111,13 +111,13 @@ public class Archive extends AbstractArchive {
)
@Export("loadGroup")
void loadGroup(int group) {
if (this.indexStore != null && this.validArchives != null && this.validArchives[group]) {
IndexStore var2 = this.indexStore;
if (this.archiveDisk != null && this.validGroups != null && this.validGroups[group]) {
ArchiveDisk var2 = this.archiveDisk;
byte[] var3 = null;
NodeDeque var4 = IndexStoreActionHandler.IndexStoreActionHandler_requestQueue;
synchronized(IndexStoreActionHandler.IndexStoreActionHandler_requestQueue) {
for (IndexStoreAction var6 = (IndexStoreAction)IndexStoreActionHandler.IndexStoreActionHandler_requestQueue.last(); var6 != null; var6 = (IndexStoreAction)IndexStoreActionHandler.IndexStoreActionHandler_requestQueue.previous()) {
if (var6.key == (long) group && var2 == var6.indexStore && var6.type == 0) {
if (var6.key == (long) group && var2 == var6.archiveDisk && var6.type == 0) {
var3 = var6.data;
break;
}
@@ -173,16 +173,16 @@ public class Archive extends AbstractArchive {
)
@Export("loadIndexReference")
public void loadIndexReference(int var1, int var2) {
this.indexReferenceCrc = var1;
this.indexReferenceVersion = var2;
if (this.referenceStore != null) {
this.indexCrc = var1;
this.indexVersion = var2;
if (this.masterDisk != null) {
int var3 = this.index;
IndexStore var4 = this.referenceStore;
ArchiveDisk var4 = this.masterDisk;
byte[] var5 = null;
NodeDeque var6 = IndexStoreActionHandler.IndexStoreActionHandler_requestQueue;
synchronized(IndexStoreActionHandler.IndexStoreActionHandler_requestQueue) {
for (IndexStoreAction var8 = (IndexStoreAction)IndexStoreActionHandler.IndexStoreActionHandler_requestQueue.last(); var8 != null; var8 = (IndexStoreAction)IndexStoreActionHandler.IndexStoreActionHandler_requestQueue.previous()) {
if (var8.key == (long)var3 && var4 == var8.indexStore && var8.type == 0) {
if (var8.key == (long)var3 && var4 == var8.archiveDisk && var8.type == 0) {
var5 = var8.data;
break;
}
@@ -196,7 +196,7 @@ public class Archive extends AbstractArchive {
this.load(var4, var3, var7, true);
}
} else {
PacketBuffer.requestNetFile(this, 255, this.index, this.indexReferenceCrc, (byte)0, true);
PacketBuffer.requestNetFile(this, 255, this.index, this.indexCrc, (byte)0, true);
}
}
@@ -213,8 +213,8 @@ public class Archive extends AbstractArchive {
throw new RuntimeException();
}
if (this.referenceStore != null) {
Widget.method4499(this.index, var2, this.referenceStore);
if (this.masterDisk != null) {
Widget.method4499(this.index, var2, this.masterDisk);
}
this.decodeIndex(var2);
@@ -222,9 +222,9 @@ public class Archive extends AbstractArchive {
} else {
var2[var2.length - 2] = (byte)(super.groupVersions[var1] >> 8);
var2[var2.length - 1] = (byte)super.groupVersions[var1];
if (this.indexStore != null) {
Widget.method4499(var1, var2, this.indexStore);
this.validArchives[var1] = true;
if (this.archiveDisk != null) {
Widget.method4499(var1, var2, this.archiveDisk);
this.validGroups[var1] = true;
}
if (var4) {
@@ -240,19 +240,19 @@ public class Archive extends AbstractArchive {
garbageValue = "-2045340856"
)
@Export("load")
void load(IndexStore var1, int var2, byte[] var3, boolean var4) {
void load(ArchiveDisk var1, int var2, byte[] var3, boolean var4) {
int var5;
if (var1 == this.referenceStore) {
if (var1 == this.masterDisk) {
if (this.field403) {
throw new RuntimeException();
} else if (var3 == null) {
PacketBuffer.requestNetFile(this, 255, this.index, this.indexReferenceCrc, (byte)0, true);
PacketBuffer.requestNetFile(this, 255, this.index, this.indexCrc, (byte)0, true);
} else {
IndexCache_crc.reset();
IndexCache_crc.update(var3, 0, var3.length);
var5 = (int)IndexCache_crc.getValue();
if (var5 != this.indexReferenceCrc) {
PacketBuffer.requestNetFile(this, 255, this.index, this.indexReferenceCrc, (byte)0, true);
if (var5 != this.indexCrc) {
PacketBuffer.requestNetFile(this, 255, this.index, this.indexCrc, (byte)0, true);
} else {
Buffer var9 = new Buffer(Strings.decompressBytes(var3));
int var7 = var9.readUnsignedByte();
@@ -264,8 +264,8 @@ public class Archive extends AbstractArchive {
var8 = var9.readInt();
}
if (var8 != this.indexReferenceVersion) {
PacketBuffer.requestNetFile(this, 255, this.index, this.indexReferenceCrc, (byte)0, true);
if (var8 != this.indexVersion) {
PacketBuffer.requestNetFile(this, 255, this.index, this.indexCrc, (byte)0, true);
} else {
this.decodeIndex(var3);
this.loadAllLocal();
@@ -284,20 +284,20 @@ public class Archive extends AbstractArchive {
var5 = (int)IndexCache_crc.getValue();
int var6 = ((var3[var3.length - 2] & 255) << 8) + (var3[var3.length - 1] & 255);
if (var5 == super.groupCrcs[var2] && var6 == super.groupVersions[var2]) {
this.validArchives[var2] = true;
this.validGroups[var2] = true;
if (var4) {
super.groups[var2] = Projectile.byteArrayToObject(var3, false);
}
} else {
this.validArchives[var2] = false;
this.validGroups[var2] = false;
if (this.field404 || var4) {
PacketBuffer.requestNetFile(this, this.index, var2, super.groupCrcs[var2], (byte)2, var4);
}
}
} else {
this.validArchives[var2] = false;
this.validGroups[var2] = false;
if (this.field404 || var4) {
PacketBuffer.requestNetFile(this, this.index, var2, super.groupCrcs[var2], (byte)2, var4);
}
@@ -313,21 +313,21 @@ public class Archive extends AbstractArchive {
)
@Export("loadAllLocal")
void loadAllLocal() {
this.validArchives = new boolean[super.groups.length];
this.validGroups = new boolean[super.groups.length];
int var1;
for (var1 = 0; var1 < this.validArchives.length; ++var1) {
this.validArchives[var1] = false;
for (var1 = 0; var1 < this.validGroups.length; ++var1) {
this.validGroups[var1] = false;
}
if (this.indexStore == null) {
if (this.archiveDisk == null) {
this.field403 = true;
} else {
this.field405 = -1;
for (var1 = 0; var1 < this.validArchives.length; ++var1) {
for (var1 = 0; var1 < this.validGroups.length; ++var1) {
if (super.fileCounts[var1] > 0) {
NPC.method2009(var1, this.indexStore, this);
NPC.method2009(var1, this.archiveDisk, this);
this.field405 = var1;
}
}
@@ -345,7 +345,7 @@ public class Archive extends AbstractArchive {
garbageValue = "0"
)
public boolean method132(int var1) {
return this.validArchives[var1];
return this.validGroups[var1];
}
@ObfuscatedName("df")

View File

@@ -7,8 +7,9 @@ import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;
@ObfuscatedName("ff")
@Implements("IndexStore")
public final class IndexStore {
@Implements("ArchiveDisk")
public final class ArchiveDisk
{
@ObfuscatedName("m")
@Export("IndexStore_buffer")
static byte[] IndexStore_buffer;
@@ -16,20 +17,20 @@ public final class IndexStore {
@ObfuscatedSignature(
signature = "Ldy;"
)
@Export("dataFile")
BufferedFile dataFile;
@Export("datFile")
BufferedFile datFile;
@ObfuscatedName("q")
@ObfuscatedSignature(
signature = "Ldy;"
)
@Export("indexFile")
BufferedFile indexFile;
@Export("idxFile")
BufferedFile idxFile;
@ObfuscatedName("w")
@ObfuscatedGetter(
intValue = -1982523283
)
@Export("index")
int index;
@Export("archive")
int archive;
@ObfuscatedName("o")
@ObfuscatedGetter(
intValue = -748616567
@@ -40,13 +41,13 @@ public final class IndexStore {
@ObfuscatedSignature(
signature = "(ILdy;Ldy;I)V"
)
public IndexStore(int var1, BufferedFile var2, BufferedFile var3, int var4) {
this.dataFile = null;
this.indexFile = null;
public ArchiveDisk(int var1, BufferedFile var2, BufferedFile var3, int var4) {
this.datFile = null;
this.idxFile = null;
this.maxEntrySize = 65000;
this.index = var1;
this.dataFile = var2;
this.indexFile = var3;
this.archive = var1;
this.datFile = var2;
this.idxFile = var3;
this.maxEntrySize = var4;
}
@@ -57,28 +58,28 @@ public final class IndexStore {
)
@Export("read")
public byte[] read(int var1) {
BufferedFile var2 = this.dataFile;
synchronized(this.dataFile) {
BufferedFile var2 = this.datFile;
synchronized(this.datFile) {
byte[] var10000;
try {
Object var4;
if (this.indexFile.length() < (long)(var1 * 6 + 6)) {
if (this.idxFile.length() < (long)(var1 * 6 + 6)) {
var4 = null;
var10000 = (byte[])((byte[])var4);
var10000 = ((byte[])var4);
return var10000;
}
this.indexFile.seek((long)(var1 * 6));
this.indexFile.read(IndexStore_buffer, 0, 6);
this.idxFile.seek((long)(var1 * 6));
this.idxFile.read(IndexStore_buffer, 0, 6);
int var5 = ((IndexStore_buffer[0] & 255) << 16) + (IndexStore_buffer[2] & 255) + ((IndexStore_buffer[1] & 255) << 8);
int var6 = (IndexStore_buffer[5] & 255) + ((IndexStore_buffer[3] & 255) << 16) + ((IndexStore_buffer[4] & 255) << 8);
if (var5 < 0 || var5 > this.maxEntrySize) {
var4 = null;
var10000 = (byte[])((byte[])var4);
var10000 = ((byte[])var4);
return var10000;
}
if (var6 > 0 && (long)var6 <= this.dataFile.length() / 520L) {
if (var6 > 0 && (long)var6 <= this.datFile.length() / 520L) {
byte[] var7 = new byte[var5];
int var8 = 0;
int var9 = 0;
@@ -86,23 +87,23 @@ public final class IndexStore {
while (var8 < var5) {
if (var6 == 0) {
var4 = null;
var10000 = (byte[])((byte[])var4);
var10000 = ((byte[])var4);
return var10000;
}
this.dataFile.seek((long)(var6 * 520));
this.datFile.seek((long)(var6 * 520));
int var10 = var5 - var8;
if (var10 > 512) {
var10 = 512;
}
this.dataFile.read(IndexStore_buffer, 0, var10 + 8);
this.datFile.read(IndexStore_buffer, 0, var10 + 8);
int var11 = (IndexStore_buffer[1] & 255) + ((IndexStore_buffer[0] & 255) << 8);
int var12 = (IndexStore_buffer[3] & 255) + ((IndexStore_buffer[2] & 255) << 8);
int var13 = ((IndexStore_buffer[5] & 255) << 8) + ((IndexStore_buffer[4] & 255) << 16) + (IndexStore_buffer[6] & 255);
int var14 = IndexStore_buffer[7] & 255;
if (var11 == var1 && var9 == var12 && var14 == this.index) {
if (var13 >= 0 && (long)var13 <= this.dataFile.length() / 520L) {
if (var11 == var1 && var9 == var12 && var14 == this.archive) {
if (var13 >= 0 && (long)var13 <= this.datFile.length() / 520L) {
for (int var15 = 0; var15 < var10; ++var15) {
var7[var8++] = IndexStore_buffer[var15 + 8];
}
@@ -113,12 +114,12 @@ public final class IndexStore {
}
var4 = null;
var10000 = (byte[])((byte[])var4);
var10000 = ((byte[])var4);
return var10000;
}
var4 = null;
var10000 = (byte[])((byte[])var4);
var10000 = ((byte[])var4);
return var10000;
}
@@ -127,7 +128,7 @@ public final class IndexStore {
}
var4 = null;
var10000 = (byte[])((byte[])var4);
var10000 = ((byte[])var4);
} catch (IOException var17) {
return null;
}
@@ -143,8 +144,8 @@ public final class IndexStore {
)
@Export("write")
public boolean write(int var1, byte[] var2, int var3) {
BufferedFile var4 = this.dataFile;
synchronized(this.dataFile) {
BufferedFile var4 = this.datFile;
synchronized(this.datFile) {
if (var3 >= 0 && var3 <= this.maxEntrySize) {
boolean var6 = this.write0(var1, var2, var3, true);
if (!var6) {
@@ -165,29 +166,29 @@ public final class IndexStore {
)
@Export("write0")
boolean write0(int var1, byte[] var2, int var3, boolean var4) {
BufferedFile var5 = this.dataFile;
synchronized(this.dataFile) {
BufferedFile var5 = this.datFile;
synchronized(this.datFile) {
try {
int var7;
boolean var8;
boolean var10000;
if (var4) {
if (this.indexFile.length() < (long)(var1 * 6 + 6)) {
if (this.idxFile.length() < (long)(var1 * 6 + 6)) {
var8 = false;
var10000 = var8;
return var10000;
}
this.indexFile.seek((long)(var1 * 6));
this.indexFile.read(IndexStore_buffer, 0, 6);
this.idxFile.seek((long)(var1 * 6));
this.idxFile.read(IndexStore_buffer, 0, 6);
var7 = (IndexStore_buffer[5] & 255) + ((IndexStore_buffer[3] & 255) << 16) + ((IndexStore_buffer[4] & 255) << 8);
if (var7 <= 0 || (long)var7 > this.dataFile.length() / 520L) {
if (var7 <= 0 || (long)var7 > this.datFile.length() / 520L) {
var8 = false;
var10000 = var8;
return var10000;
}
} else {
var7 = (int)((this.dataFile.length() + 519L) / 520L);
var7 = (int)((this.datFile.length() + 519L) / 520L);
if (var7 == 0) {
var7 = 1;
}
@@ -199,8 +200,8 @@ public final class IndexStore {
IndexStore_buffer[3] = (byte)(var7 >> 16);
IndexStore_buffer[4] = (byte)(var7 >> 8);
IndexStore_buffer[5] = (byte)var7;
this.indexFile.seek((long)(var1 * 6));
this.indexFile.write(IndexStore_buffer, 0, 6);
this.idxFile.seek((long)(var1 * 6));
this.idxFile.write(IndexStore_buffer, 0, 6);
int var9 = 0;
int var10 = 0;
@@ -210,10 +211,10 @@ public final class IndexStore {
int var11 = 0;
int var12;
if (var4) {
this.dataFile.seek((long)(var7 * 520));
this.datFile.seek((long)(var7 * 520));
try {
this.dataFile.read(IndexStore_buffer, 0, 8);
this.datFile.read(IndexStore_buffer, 0, 8);
} catch (EOFException var16) {
break label129;
}
@@ -222,13 +223,13 @@ public final class IndexStore {
int var13 = (IndexStore_buffer[3] & 255) + ((IndexStore_buffer[2] & 255) << 8);
var11 = ((IndexStore_buffer[5] & 255) << 8) + ((IndexStore_buffer[4] & 255) << 16) + (IndexStore_buffer[6] & 255);
int var14 = IndexStore_buffer[7] & 255;
if (var12 != var1 || var13 != var10 || var14 != this.index) {
if (var12 != var1 || var13 != var10 || var14 != this.archive) {
var8 = false;
var10000 = var8;
return var10000;
}
if (var11 < 0 || (long)var11 > this.dataFile.length() / 520L) {
if (var11 < 0 || (long)var11 > this.datFile.length() / 520L) {
var8 = false;
var10000 = var8;
return var10000;
@@ -237,7 +238,7 @@ public final class IndexStore {
if (var11 == 0) {
var4 = false;
var11 = (int)((this.dataFile.length() + 519L) / 520L);
var11 = (int)((this.datFile.length() + 519L) / 520L);
if (var11 == 0) {
++var11;
}
@@ -258,15 +259,15 @@ public final class IndexStore {
IndexStore_buffer[4] = (byte)(var11 >> 16);
IndexStore_buffer[5] = (byte)(var11 >> 8);
IndexStore_buffer[6] = (byte)var11;
IndexStore_buffer[7] = (byte)this.index;
this.dataFile.seek((long)(var7 * 520));
this.dataFile.write(IndexStore_buffer, 0, 8);
IndexStore_buffer[7] = (byte)this.archive;
this.datFile.seek((long)(var7 * 520));
this.datFile.write(IndexStore_buffer, 0, 8);
var12 = var3 - var9;
if (var12 > 512) {
var12 = 512;
}
this.dataFile.write(var2, var9, var12);
this.datFile.write(var2, var9, var12);
var9 += var12;
var7 = var11;
++var10;

View File

@@ -1277,7 +1277,7 @@ public final class Client extends GameShell implements Usernamed {
this.setUpKeyboard();
this.setUpMouse();
class16.mouseWheel = this.mouseWheel();
Fonts.indexStore255 = new IndexStore(255, class168.dat2File, class168.idx255File, 500000);
Fonts.archiveDisk255 = new ArchiveDisk(255, class168.dat2File, class168.idx255File, 500000);
ReflectionCheck.clientPreferences = class306.method5780();
this.setUpClipboard();
String var1 = Ignored.field402;

View File

@@ -11,8 +11,8 @@ public class Fonts {
@ObfuscatedSignature(
signature = "Lff;"
)
@Export("indexStore255")
static IndexStore indexStore255;
@Export("archiveDisk255")
static ArchiveDisk archiveDisk255;
@ObfuscatedName("o")
static byte[][][] field350;
@ObfuscatedName("l")

View File

@@ -36,8 +36,8 @@ public class IndexStoreAction extends Node {
@ObfuscatedSignature(
signature = "Lff;"
)
@Export("indexStore")
IndexStore indexStore;
@Export("archiveDisk")
ArchiveDisk archiveDisk;
@ObfuscatedName("w")
@ObfuscatedSignature(
signature = "Lit;"

View File

@@ -42,13 +42,13 @@ public class IndexStoreActionHandler implements Runnable {
Object var3;
if (var2 != null) {
if (var2.type == 0) {
var2.indexStore.write((int)var2.key, var2.data, var2.data.length);
var2.archiveDisk.write((int)var2.key, var2.data, var2.data.length);
var1 = IndexStoreActionHandler_requestQueue;
synchronized(IndexStoreActionHandler_requestQueue) {
var2.remove();
}
} else if (var2.type == 1) {
var2.data = var2.indexStore.read((int)var2.key);
var2.data = var2.archiveDisk.read((int)var2.key);
var1 = IndexStoreActionHandler_requestQueue;
synchronized(IndexStoreActionHandler_requestQueue) {
IndexStoreActionHandler_responseQueue.addFirst(var2);

View File

@@ -167,11 +167,11 @@ public final class NPC extends Actor {
signature = "(ILff;Lit;B)V",
garbageValue = "-51"
)
static void method2009(int var0, IndexStore var1, Archive var2) {
static void method2009(int var0, ArchiveDisk var1, Archive var2) {
IndexStoreAction var3 = new IndexStoreAction();
var3.type = 1;
var3.key = (long)var0;
var3.indexStore = var1;
var3.archiveDisk = var1;
var3.indexCache = var2;
NodeDeque var4 = IndexStoreActionHandler.IndexStoreActionHandler_requestQueue;
synchronized(IndexStoreActionHandler.IndexStoreActionHandler_requestQueue) {

View File

@@ -438,7 +438,7 @@ public final class NetSocket extends AbstractSocket implements Runnable {
} else if (var2 == 2) {
var18 = WorldMapSection2.method593(var0, var1, var3, var4);
} else {
var18 = IndexStore.method3585(var0, var1, var2, var3, var4);
var18 = ArchiveDisk.method3585(var0, var1, var2, var3, var4);
}
var8 = var0 - 64;

View File

@@ -1529,12 +1529,12 @@ public class Widget extends Node {
signature = "(I[BLff;I)V",
garbageValue = "-1287305716"
)
static void method4499(int var0, byte[] var1, IndexStore var2) {
static void method4499(int var0, byte[] var1, ArchiveDisk var2) {
IndexStoreAction var3 = new IndexStoreAction();
var3.type = 0;
var3.key = (long)var0;
var3.data = var1;
var3.indexStore = var2;
var3.archiveDisk = var2;
NodeDeque var4 = IndexStoreActionHandler.IndexStoreActionHandler_requestQueue;
synchronized(IndexStoreActionHandler.IndexStoreActionHandler_requestQueue) {
IndexStoreActionHandler.IndexStoreActionHandler_requestQueue.addFirst(var3);

View File

@@ -83,12 +83,12 @@ public final class class22 {
)
@Export("newIndexCache")
static Archive newIndexCache(int var0, boolean var1, boolean var2, boolean var3) {
IndexStore var4 = null;
ArchiveDisk var4 = null;
if (class168.dat2File != null) {
var4 = new IndexStore(var0, class168.dat2File, IndexStoreAction.idxFiles[var0], 1000000);
var4 = new ArchiveDisk(var0, class168.dat2File, IndexStoreAction.idxFiles[var0], 1000000);
}
return new Archive(var4, Fonts.indexStore255, var0, var1, var2, var3);
return new Archive(var4, Fonts.archiveDisk255, var0, var1, var2, var3);
}
@ObfuscatedName("jp")

View File

@@ -107,7 +107,7 @@ public class class3 implements Enumerated {
return;
}
var1.indexCache.load(var1.indexStore, (int)var1.key, var1.data, false);
var1.indexCache.load(var1.archiveDisk, (int)var1.key, var1.data, false);
}
}