PDA

View Full Version : [Renamed] GS Stances Help



Crsps
May 3rd, 2011, 21:43
I've been trying to load these animations forever.
I have them all correct in my server-sided. I just cannot get the client to simply load the damn file without throwing a error at me, and totally making the client freeze. :rofl:
My client is a re-factored client [Meaning renamed variables [Galkons stuff])

Anyhow, These are my current codes (I have tried many)

Framereader.java Reading Animation.


public static void readAnimHeader(byte abyte0[], int fileId) {
if (fileId == 74) {
abyte0 = DataUtils.readFile(signlink.findcachedir() + "rsanim/" + fileId
+ ".dat"); //It is located here.
System.out.println("Custom GS Stance Loaded");
}
ByteVector stream = new ByteVector(abyte0);
stream.currentOffset = abyte0.length - 12;
int i = stream.readInt();
int j = stream.readInt();
int k = stream.readInt();
int i1 = 0;
ByteVector stream_1 = new ByteVector(abyte0);
stream_1.currentOffset = i1;
i1 += i + 4;
ByteVector stream_2 = new ByteVector(abyte0);
stream_2.currentOffset = i1;
i1 += j;
ByteVector stream_3 = new ByteVector(abyte0);
stream_3.currentOffset = i1;
i1 += k;
ByteVector stream_4 = new ByteVector(abyte0);
stream_4.currentOffset = i1;
SkinList class18 = new SkinList(stream_4);
int k1 = stream_1.readInt();
int ai[] = new int[500];
int ai1[] = new int[500];
int ai2[] = new int[500];
int ai3[] = new int[500];
for (int l1 = 0; l1 < k1; l1++) {
int i2 = stream_1.readInt();
FrameReader frameReader = new FrameReader();
frameList.put(new Integer((fileId << 16) + i2), frameReader);
frameReader.aClass18_637 = class18;
int j2 = stream_1.readUByte();
int k2 = -1;
int l2 = 0;
for (int i3 = 0; i3 < j2; i3++) {
int j3 = stream_2.readUByte();
if (j3 > 0) {
if (class18.skins[i3] != 0) {
for (int l3 = i3 - 1; l3 > k2; l3--) {
if (class18.skins[l3] != 0)
continue;
ai[l2] = l3;
ai1[l2] = 0;
ai2[l2] = 0;
ai3[l2] = 0;
l2++;
break;
}

}
ai[l2] = i3;
char c = '\0';
if (class18.skins[i3] == 3)
c = '\200';
if ((j3 & 1) != 0)
ai1[l2] = stream_3.readSmart();
else
ai1[l2] = c;
if ((j3 & 2) != 0)
ai2[l2] = stream_3.readSmart();
else
ai2[l2] = c;
if ((j3 & 4) != 0)
ai3[l2] = stream_3.readSmart();
else
ai3[l2] = c;
k2 = i3;
l2++;
}
}
frameReader.anInt638 = l2;
frameReader.anIntArray639 = new int[l2];
frameReader.anIntArray640 = new int[l2];
frameReader.anIntArray641 = new int[l2];
frameReader.anIntArray642 = new int[l2];
for (int k3 = 0; k3 < l2; k3++) {
frameReader.anIntArray639[k3] = ai[k3];
frameReader.anIntArray640[k3] = ai1[k3];
frameReader.anIntArray641[k3] = ai2[k3];
frameReader.anIntArray642[k3] = ai3[k3];
}
}
}


Client.java Ondemand


if (onDemandData.dataType == 1 && onDemandData.buffer != null) {
if (onDemandData.ID == 0) { //Idk why, but the client isnt throwing 74 as the ID, if you know how to get it like that, please tell me, I don't like the feeling using 0..
FrameReader.readAnimHeader(onDemandData.buffer,74) ; //Hey, im 74, pick my GS Animation (:
} else {
FrameReader.readAnimHeader(onDemandData.buffer,
onDemandData.ID);
}
}


And the error:


Exception in thread "Thread-2" java.lang.ArrayIndexOutOfBoundsException


And it does Print "Custom GS Stance Loaded" before the error.