Locate server packet sizes - Shadowrs/osrs-refactor-revision-1 GitHub Wiki

Search for uses of the nextKey method within the ISAAC class (see how to disable isaac)

This method is used twice in the RSBuffer class, to cipher and dechiper a packet's opcode.

Identify these methods, and rename for convenience.

Original:

public void method623(final int var1) {
	aByteArray1174[++anInt1172 - 1] = (byte) (var1 + aClass37_1186.method175());
}

Renamed:

public void putOpcode(final int code) {
	backing[++pos - 1] = (byte) (code + isaac.nextKey());
}

Read opcode method, original:

public int method628() {
	return (aByteArray1174[++anInt1172 - 1] - aClass37_1186.method175()) & 255;
}

Renamed

public int opcode() {
	return (backing[++pos - 1] - isaac.nextKey()) & 255;
}

Now, search for code uses of the opcode method. It is used twice:

  • During the login protocol
  • During the in-game protocol

Find the usage for code which resembles this structure, and rename to match:

// read packets
if(pktOpc == -1) {
 Class20.stream.readbytes(gamecon.backing, 0, 1);
 gamecon.pos = 0;
 pktOpc = gamecon.opcode();
 pktSize = Class95.PACKETSIZES[pktOpc];
 --var11;
}

You've now identified packet reading in the client. This is where packets from the server are decoded. In the above line, there is an Integer array (Class95.PACKETSIZES), these are the incoming packet sizes. Take note of where this array is located, as it is helpful to know packet sizes later, when you are creating packets within the server which you'll send to the client.

Packet sizes

size type

= 0 | fixed length -1 | varbyte -2 | varshort