Fixed banking when connected to reference server

This commit is contained in:
Pazaz 2022-04-27 00:17:38 -04:00
parent 8d8d3b6c73
commit 2e4cc73755
5 changed files with 71 additions and 67 deletions

View file

@ -248,7 +248,7 @@ public class Buffer extends Node {
}
@OriginalMember(owner = "client!wa", name = "i", descriptor = "(B)B")
public final byte g1neg() {
public final byte g1sneg() {
return (byte) -this.data[this.offset++];
}
@ -399,9 +399,9 @@ public class Buffer extends Node {
}
@OriginalMember(owner = "client!wa", name = "l", descriptor = "(I)I")
public final int g4me() {
public final int g4le() {
this.offset += 4;
return ((this.data[this.offset - 2] & 0xFF) << 16) + ((this.data[this.offset - 1] & 0xFF) << 24) + ((this.data[this.offset - 3] & 0xFF) << 8) + (this.data[this.offset - 4] & 0xFF);
return ((this.data[this.offset - 1] & 0xFF) << 24) + ((this.data[this.offset - 2] & 0xFF) << 16) + ((this.data[this.offset - 3] & 0xFF) << 8) + (this.data[this.offset - 4] & 0xFF);
}
@OriginalMember(owner = "client!wa", name = "l", descriptor = "(II)V")
@ -419,7 +419,7 @@ public class Buffer extends Node {
}
@OriginalMember(owner = "client!wa", name = "g", descriptor = "(Z)I")
public final int p1neg() {
public final int g1neg() {
return -this.data[this.offset++] & 0xFF;
}
@ -491,7 +491,7 @@ public class Buffer extends Node {
// reverse "middle-endian"
@OriginalMember(owner = "client!wa", name = "o", descriptor = "(B)I")
public final int p4rme() {
public final int g4me() {
this.offset += 4;
return ((this.data[this.offset - 3] & 0xFF) << 24) + ((this.data[this.offset - 4] & 0xFF) << 16) + ((this.data[this.offset - 1] & 0xFF) << 8) + (this.data[this.offset - 2] & 0xFF);
}

View file

@ -584,8 +584,8 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
try {
leftMargin = 0;
clientBuild = 530;
frameWidth = 2500;
frameHeight = 1400;
frameWidth = 765;
frameHeight = 503;
canvasWidth = frameWidth;
canvasHeight = frameHeight;
topMargin = 0;

View file

@ -138,19 +138,26 @@ public class InterfaceList {
@OriginalMember(owner = "client!af", name = "a", descriptor = "(BI)Lclient!be;")
public static Component getComponent(@OriginalArg(1) int id) {
@Pc(7) int interfaceId = id >> 16;
@Pc(18) int componentId = id & 0xFFFF;
if (components[interfaceId] == null || components[interfaceId][componentId] == null) {
@Pc(33) boolean success = load(interfaceId);
if (!success) {
try {
@Pc(7) int interfaceId = id >> 16;
@Pc(18) int componentId = id & 0xFFFF;
if (components.length < interfaceId || interfaceId < 0) {
return null;
}
// todo: this should not be necessary, data/server-related?
if (components.length <= interfaceId || components[interfaceId].length <= componentId) {
if (components[interfaceId] == null || components[interfaceId][componentId] == null) {
@Pc(33) boolean success = load(interfaceId);
if (!success) {
return null;
}
}
if (components[interfaceId].length < componentId) {
return null;
}
return components[interfaceId][componentId];
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
return components[interfaceId][componentId];
}
@OriginalMember(owner = "client!client", name = "b", descriptor = "(Lclient!be;)Lclient!bf;")

View file

@ -12,10 +12,10 @@ public final class Packet extends Buffer {
public static final int[] BIT_MASKS = new int[] { 0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 131071, 262143, 524287, 1048575, 2097151, 4194303, 8388607, 16777215, 33554431, 67108863, 134217727, 268435455, 536870911, 1073741823, Integer.MAX_VALUE, -1 };
@OriginalMember(owner = "client!i", name = "Xb", descriptor = "Lclient!ij;")
private IsaacRandom aClass71_1;
private IsaacRandom isaac;
@OriginalMember(owner = "client!i", name = "fc", descriptor = "I")
private int anInt2846;
private int bitOffset;
@OriginalMember(owner = "client!i", name = "<init>", descriptor = "(I)V")
public Packet(@OriginalArg(0) int arg0) {
@ -24,22 +24,22 @@ public final class Packet extends Buffer {
@OriginalMember(owner = "client!i", name = "q", descriptor = "(B)V")
public final void accessBits() {
this.anInt2846 = this.offset * 8;
this.bitOffset = this.offset * 8;
}
@OriginalMember(owner = "client!i", name = "a", descriptor = "(BI[BI)V")
public final void method2237(@OriginalArg(2) byte[] arg0, @OriginalArg(3) int arg1) {
public final void gBytesIsaac(@OriginalArg(2) byte[] arg0, @OriginalArg(3) int arg1) {
for (@Pc(17) int local17 = 0; local17 < arg1; local17++) {
arg0[local17] = (byte) (this.data[this.offset++] - this.aClass71_1.getNextKey());
arg0[local17] = (byte) (this.data[this.offset++] - this.isaac.getNextKey());
}
}
@OriginalMember(owner = "client!i", name = "f", descriptor = "(BI)I")
public final int gBits(@OriginalArg(1) int arg0) {
@Pc(6) int local6 = this.anInt2846 >> 3;
@Pc(14) int local14 = 8 - (this.anInt2846 & 0x7);
@Pc(6) int local6 = this.bitOffset >> 3;
@Pc(14) int local14 = 8 - (this.bitOffset & 0x7);
@Pc(16) int local16 = 0;
this.anInt2846 += arg0;
this.bitOffset += arg0;
while (local14 < arg0) {
local16 += (BIT_MASKS[local14] & this.data[local6++]) << arg0 - local14;
arg0 -= local14;
@ -55,26 +55,26 @@ public final class Packet extends Buffer {
@OriginalMember(owner = "client!i", name = "a", descriptor = "([IZ)V")
public final void setKey(@OriginalArg(0) int[] arg0) {
this.aClass71_1 = new IsaacRandom(arg0);
this.isaac = new IsaacRandom(arg0);
}
@OriginalMember(owner = "client!i", name = "q", descriptor = "(II)I")
public final int method2241(@OriginalArg(0) int arg0) {
return arg0 * 8 - this.anInt2846;
return arg0 * 8 - this.bitOffset;
}
@OriginalMember(owner = "client!i", name = "r", descriptor = "(II)V")
public final void p1isaac(@OriginalArg(1) int arg0) {
this.data[this.offset++] = (byte) (arg0 + this.aClass71_1.getNextKey());
this.data[this.offset++] = (byte) (arg0 + this.isaac.getNextKey());
}
@OriginalMember(owner = "client!i", name = "s", descriptor = "(I)I")
public final int g1isaac() {
return this.data[this.offset++] - this.aClass71_1.getNextKey() & 0xFF;
return this.data[this.offset++] - this.isaac.getNextKey() & 0xFF;
}
@OriginalMember(owner = "client!i", name = "h", descriptor = "(Z)V")
public final void accessBytes() {
this.offset = (this.anInt2846 + 7) / 8;
this.offset = (this.bitOffset + 7) / 8;
}
}

View file

@ -48,7 +48,7 @@ public class Protocol {
@Pc(39) int local39;
@Pc(45) int local45;
if (opcode == ServerProt.LOCATION_PACKET_195) {
local15 = inboundBuffer.p1neg();
local15 = inboundBuffer.g1neg();
local19 = local15 & 0x3;
local23 = local15 >> 2;
local27 = Static133.anIntArray453[local23];
@ -189,7 +189,7 @@ public class Protocol {
}
} else if (opcode == ServerProt.LOCATION_PACKET_135) {
local15 = inboundBuffer.g2leadd();
local23 = inboundBuffer.p1neg();
local23 = inboundBuffer.g1neg();
local27 = Static180.anInt4264 + (local23 & 0x7);
local19 = (local23 >> 4 & 0x7) + Static115.anInt2940;
local31 = inboundBuffer.g2le();
@ -358,7 +358,7 @@ public class Protocol {
Static72.regionsXteaKeys = new int[local20][4];
for (local26 = 0; local26 < local20; local26++) {
for (local31 = 0; local31 < 4; local31++) {
Static72.regionsXteaKeys[local26][local31] = inboundBuffer.p4rme();
Static72.regionsXteaKeys[local26][local31] = inboundBuffer.g4me();
}
}
local26 = inboundBuffer.g1ssub();
@ -429,7 +429,7 @@ public class Protocol {
Static72.regionsXteaKeys = new int[local60][4];
for (local64 = 0; local64 < local60; local64++) {
for (local391 = 0; local391 < 4; local391++) {
Static72.regionsXteaKeys[local64][local391] = inboundBuffer.p4rme();
Static72.regionsXteaKeys[local64][local391] = inboundBuffer.g4me();
}
}
local64 = inboundBuffer.g2();
@ -562,13 +562,13 @@ public class Protocol {
}
}
if ((flags & 0x400) != 0) {
player.anInt3380 = inboundBuffer.p1neg();
player.anInt3380 = inboundBuffer.g1neg();
player.anInt3428 = inboundBuffer.g1();
player.anInt3416 = inboundBuffer.g1add();
player.anInt3392 = inboundBuffer.g1();
player.anInt3395 = inboundBuffer.g2le() + client.loop;
player.anInt3386 = inboundBuffer.g2le() + client.loop;
player.anInt3431 = inboundBuffer.p1neg();
player.anInt3431 = inboundBuffer.g1neg();
player.movementQueueSize = 1;
player.anInt3405 = 0;
}
@ -590,7 +590,7 @@ public class Protocol {
player.addHit(int2, client.loop, int1);
}
if ((flags & 0x800) != 0) {
int1 = inboundBuffer.p1neg();
int1 = inboundBuffer.g1neg();
@Pc(502) int[] seqIds = new int[int1];
@Pc(505) int[] delays = new int[int1];
@Pc(508) int[] slotMasks = new int[int1];
@ -610,7 +610,7 @@ public class Protocol {
if (int1 == 65535) {
int1 = -1;
}
int2 = inboundBuffer.p4rme();
int2 = inboundBuffer.g4me();
@Pc(573) boolean local573 = true;
if (int1 != -1 && player.spotAnimId != -1 && SeqTypeList.get(SpotAnimTypeList.get(int1).seqId).anInt5355 < SeqTypeList.get(SpotAnimTypeList.get(player.spotAnimId).seqId).anInt5355) {
local573 = false;
@ -881,7 +881,7 @@ public class Protocol {
@Pc(133) int local133;
if (opcode == ServerProt.VARP_SMALL) {
local133 = inboundBuffer.g2sub();
@Pc(137) byte local137 = inboundBuffer.g1neg();
@Pc(137) byte local137 = inboundBuffer.g1sneg();
Static170.method2575(local137, local133);
opcode = -1;
return true;
@ -1053,7 +1053,7 @@ public class Protocol {
} else {
@Pc(864) int local864;
if (opcode == ServerProt.IF_SETSCROLLPOS) {
local133 = inboundBuffer.p4rme();
local133 = inboundBuffer.g4me();
local786 = inboundBuffer.g2le();
local864 = inboundBuffer.g2();
if (setVerifyId(local864)) {
@ -1218,9 +1218,9 @@ public class Protocol {
opcode = -1;
return true;
} else if (opcode == ServerProt.IF_SETHIDE) {
local133 = inboundBuffer.p1neg();
local133 = inboundBuffer.g1neg();
local786 = inboundBuffer.g2();
local864 = inboundBuffer.g4me();
local864 = inboundBuffer.g4le();
if (setVerifyId(local786)) {
DelayedStateChange.method2905(local864, local133);
}
@ -1283,7 +1283,7 @@ public class Protocol {
opcode = -1;
return true;
} else if (opcode == ServerProt.IF_SETANIM) {
local133 = inboundBuffer.p4rme();
local133 = inboundBuffer.g4me();
local786 = inboundBuffer.g2les();
local864 = inboundBuffer.g2sub();
if (setVerifyId(local864)) {
@ -1296,7 +1296,7 @@ public class Protocol {
@Pc(1804) ServerActiveProperties local1804;
if (opcode == ServerProt.WIDGETSTRUCT_SETTING) {
local133 = inboundBuffer.g2leadd();
local786 = inboundBuffer.g4me();
local786 = inboundBuffer.g4le();
local864 = inboundBuffer.g2sub();
local171 = inboundBuffer.g2le();
if (local171 == 65535) {
@ -1419,7 +1419,7 @@ public class Protocol {
opcode = -1;
return true;
} else if (opcode == ServerProt.INTERFACE_ANIMATE_ROTATE) {
local133 = inboundBuffer.p4rme();
local133 = inboundBuffer.g4me();
local786 = inboundBuffer.g2sub();
local864 = inboundBuffer.g2();
local171 = inboundBuffer.g2sub();
@ -1491,7 +1491,7 @@ public class Protocol {
return true;
} else if (opcode == ServerProt.CLEAR_GROUND_ITEMS) {
Static115.anInt2940 = inboundBuffer.g1();
Static180.anInt4264 = inboundBuffer.p1neg();
Static180.anInt4264 = inboundBuffer.g1neg();
for (local133 = Static115.anInt2940; local133 < Static115.anInt2940 + 8; local133++) {
for (local786 = Static180.anInt4264; local786 < Static180.anInt4264 + 8; local786++) {
if (Static159.aClass69ArrayArrayArray1[Player.level][local133][local786] != null) {
@ -1508,7 +1508,7 @@ public class Protocol {
opcode = -1;
return true;
} else if (opcode == ServerProt.INTERFACE_ITEMS_CLEAR) {
local133 = inboundBuffer.p4rme();
local133 = inboundBuffer.g4me();
@Pc(2666) Component local2666 = InterfaceList.getComponent(local133);
for (local864 = 0; local864 < local2666.objTypes.length; local864++) {
local2666.objTypes[local864] = -1;
@ -1518,7 +1518,7 @@ public class Protocol {
opcode = -1;
return true;
} else if (opcode == ServerProt.IF_SETMODEL) {
local133 = inboundBuffer.g4me();
local133 = inboundBuffer.g4le();
local786 = inboundBuffer.g2leadd();
local864 = inboundBuffer.g2sub();
if (local864 == 65535) {
@ -1759,7 +1759,7 @@ public class Protocol {
return true;
} else if (opcode == ServerProt.CLIENT_SETVARC_SMALL) {
local133 = inboundBuffer.g2le();
local786 = inboundBuffer.p1neg();
local786 = inboundBuffer.g1neg();
local864 = inboundBuffer.g2leadd();
if (setVerifyId(local133)) {
DelayedStateChange.method2606(local864, local786);
@ -1811,7 +1811,7 @@ public class Protocol {
Static241.setWindowMode(false, Preferences.favoriteWorlds, -1, -1);
}
@Pc(3848) byte[] local3848 = new byte[length];
inboundBuffer.method2237(local3848, length);
inboundBuffer.gBytesIsaac(local3848, length);
local156 = Static10.decodeString(local3848, length, 0);
if (GameShell.frame == null && (SignLink.anInt5928 == 3 || !SignLink.osName.startsWith("win") || client.haveIe6)) {
Static169.openUrl(local156, true);
@ -1824,7 +1824,7 @@ public class Protocol {
return true;
} else if (opcode == ServerProt.GENERATE_CHAT_HEAD_FROM_BODY) {
local133 = inboundBuffer.g2sub();
local786 = inboundBuffer.p4rme();
local786 = inboundBuffer.g4me();
local864 = inboundBuffer.g2leadd();
local171 = inboundBuffer.g2le();
local1146 = inboundBuffer.g2leadd();
@ -1841,7 +1841,7 @@ public class Protocol {
return true;
} else if (opcode == ServerProt.IF_OPENTOP) {
local133 = inboundBuffer.g1();
local786 = inboundBuffer.p4rme();
local786 = inboundBuffer.g4me();
local864 = inboundBuffer.g2sub();
local171 = inboundBuffer.g2();
if (setVerifyId(local864)) {
@ -1925,7 +1925,7 @@ public class Protocol {
return true;
} else if (opcode == ServerProt.IF_SETPOSITION) {
local133 = inboundBuffer.g2sub();
local786 = inboundBuffer.g4me();
local786 = inboundBuffer.g4le();
local864 = inboundBuffer.g2s();
local171 = inboundBuffer.g2sadd();
if (setVerifyId(local133)) {
@ -2068,7 +2068,7 @@ public class Protocol {
opcode = -1;
return true;
} else if (opcode == ServerProt.IF_SETTEXT1) {
local133 = inboundBuffer.p4rme();
local133 = inboundBuffer.g4me();
local156 = inboundBuffer.gjstr();
local864 = inboundBuffer.g2sub();
if (setVerifyId(local864)) {
@ -2077,7 +2077,7 @@ public class Protocol {
opcode = -1;
return true;
} else if (opcode == ServerProt.VARBIT_LARGE) {
local133 = inboundBuffer.g4me();
local133 = inboundBuffer.g4le();
local786 = inboundBuffer.g2leadd();
Static272.method3995(local133, local786);
opcode = -1;
@ -2142,7 +2142,7 @@ public class Protocol {
return true;
} else if (opcode == ServerProt.IF_SETNPCHEAD) {
local133 = inboundBuffer.g2sub();
local786 = inboundBuffer.g4me();
local786 = inboundBuffer.g4le();
if (local133 == 65535) {
local133 = -1;
}
@ -2260,7 +2260,7 @@ public class Protocol {
return true;
} else if (opcode == ServerProt.IF_SETOBJECT) {
local133 = inboundBuffer.g4();
local786 = inboundBuffer.p4rme();
local786 = inboundBuffer.g4me();
local864 = inboundBuffer.g2leadd();
if (local864 == 65535) {
local864 = -1;
@ -2333,7 +2333,7 @@ public class Protocol {
opcode = -1;
return true;
} else if (opcode == ServerProt.UPDATE_CURRENT_LOCATION) {
Static115.anInt2940 = inboundBuffer.p1neg();
Static115.anInt2940 = inboundBuffer.g1neg();
Static180.anInt4264 = inboundBuffer.g1();
opcode = -1;
return true;
@ -2629,13 +2629,10 @@ public class Protocol {
}
} else if (type == 7) {
component = InterfaceList.getComponent(i);
// todo: this should not be necessary, data/server-related?
if (component != null) {
@Pc(1145) boolean hidden = change.intArg1 == 1;
if (hidden != component.hidden) {
component.hidden = hidden;
Static43.redraw(component);
}
@Pc(1145) boolean hidden = change.intArg1 == 1;
if (component != null && hidden != component.hidden) {
component.hidden = hidden;
Static43.redraw(component);
}
} else if (type == 8) {
component = InterfaceList.getComponent(i);
@ -3021,13 +3018,13 @@ public class Protocol {
@Pc(47) int local47;
if ((local18 & 0x40) != 0) {
local43 = inboundBuffer.g1();
local47 = inboundBuffer.p1neg();
local47 = inboundBuffer.g1neg();
local14.addHit(local47, client.loop, local43);
local14.hitpointsBarVisibleUntil = client.loop + 300;
local14.hitpointsBar = inboundBuffer.g1ssub();
}
if ((local18 & 0x2) != 0) {
local43 = inboundBuffer.p1neg();
local43 = inboundBuffer.g1neg();
local47 = inboundBuffer.g1ssub();
local14.addHit(local47, client.loop, local43);
}
@ -3050,7 +3047,7 @@ public class Protocol {
if (local43 == 65535) {
local43 = -1;
}
local47 = inboundBuffer.g4me();
local47 = inboundBuffer.g4le();
@Pc(147) boolean local147 = true;
if (local43 != -1 && local14.spotAnimId != -1 && SeqTypeList.get(SpotAnimTypeList.get(local43).seqId).anInt5355 < SeqTypeList.get(SpotAnimTypeList.get(local14.spotAnimId).seqId).anInt5355) {
local147 = false;
@ -3092,7 +3089,7 @@ public class Protocol {
local14.chatLoops = 100;
}
if ((local18 & 0x100) != 0) {
local43 = inboundBuffer.p1neg();
local43 = inboundBuffer.g1neg();
@Pc(331) int[] local331 = new int[local43];
@Pc(334) int[] local334 = new int[local43];
@Pc(337) int[] local337 = new int[local43];