OSRS Revision upgrading

Jul 8, 2021
16
11
0
Alright so a fuck ton of people are asking how is revision upgrades done.
1) This thread is just to save time for us to stop repeating the same answer this question is very common.
2) Yeah my English grammar won't be the best.

Anyways:

First of all we need to know what deobs are. In here at least everyone call deobfuscated clients deob,

Obfuscated clients are pretty much randomized names / random numbers / and bunch more of random crap to make it harder for human eye to read.
Deobfuscated is opposite of obfuscation, it does not contain that random crap, deobfuscation will make for example: a = new dn to: field1935 = new class15. Add mapping to it and it will make instead of that field1935 = new class15 to: projectiles = new NodeDeque();
Some better example on the left you have obfuscated code on the right you have deobfuscated + mapped class:
idea64_3qRNz4ZaEY.png

Now since you know that lets continue on how we going to upgrade our server from revision 213 to revision 215 using Alter

First of all we will need to refactor buffer meaning (Mappers don't rename these, since most of the mappers that we use are by like RL/OPRS/Botters who don't really need this class) :
ReffactoringBuffer.png

All of those method##### to what they are reading/writing as in above example we see --var4 and we see that it's expecting array of bytes and that it's starting point is var3 + var2 + 1 => Which is the end of the array we indicate that it starts from the end so we call it reversed. => We also can see that it reads them out of the array with - 128 (Which shows it's ADD)
One more example:
idea64_puRDH4ZEoD.png
this.offset += 2; <-- This indicates how many bytes and by that we determine which type it is you can find all of them IBM Documentation
So we now know it's short we also see that it has & 255 in the end -> Which will indicate that it's order is LE aka Little

At first this all can seem to be complicated but after some practice (You will fail some times, but if you will continue trying eventually you will get a hang of it)
Just to make this process some what easier: https://github.com/CloudS3c/meteor-client/blob/main/osrs/src/main/java/Buffer.java Just copy entire line after var1 = or after return and search inside that link. If you can't find some methods name you can ask around R-S Discord (Expect to be trolled) or you can also just call all of the methods p1-4 etc. and Just reverse from reading to writing. I hope this step was some what useful there is really too much to cover and i am no expert at networking maybe someone in the comments will explain this better. But you will be now asking your self why tf do i need this?? Yh dunno.

Jk this is needed to know in what Type / order / transformer we need to send the data that we send from server.

So now we finished refactoring the buffer. Now we going to identify packets p much it's just looking for similarities.
idea64_YU4MsGPBMX.png
So yeah you go renaming packets looking for similarities like in the screenshot above only IF_SETTEXT has .text)) { in it's block so then you just rename it (If you're using Intellij just hit Shift + F6) It will rename across all classes.
And so on.. Now what to keep in mind that all those values are in random order -> So we need to match it.
PacketValueOrder.png
Now we have on server that's rev 213[Alter/RSMOD v1]:
idea64_vqDDxyG4Wu.png

And yeah this is why we refactor the buffer first: Blue color:
Var49 = readString => Most of the time if the packets is not new you will only need to send bytes (It's only for strings)
graphic = readIntIME => Now you can see on server side that we have: type: INT, and it's order: INVERSE_MIDDLE which is IME
Now you can see in the screenshot above that they are in a new order meaning we have to move - name: TEXT and type: BYTES bellow hash block.
And yes the order is very important. If you fail to follow the order of the packets values the packet will read them incorrect meaning you will see flying baboons.. Nah you will just be crashing when you will be sending that packet.

Now u see that opcode: 57 (It's pretty much packets ID) => We find them at ServerPackets.java
idea64_LxHzorVLxf.png
Now that type: VARIABLE_SHORT -> It's packets size.
If its a fixed length one, then just type FIXED.
If the size is -1, its VARIABLE_BYTE, and if it's -2, it's VARIABLE_SHORT

And yeah pretty much you will need to do that for all the packets.. Fun ones will be Zone Updates / Player Info / Npc Info

Whats so fun about those fuckers? Ohh boyy
Let's start with Zone Updates this one is pretty simple but still need to point out: That when you're doing these packets you need to not forget that when sending UPDATE_ZONE_PARTIAL_ENCLOSED you need to have them in correct order (Not packet order) But in what order the packets are being sent.
idea64_2sH1p3IX6J.jpg
If you will send them incorrect expect Dropped items / Objects and etc. To be in incorrect order when you enter that region.

Player Info / Npc Info --> These ones will be the hardest ones.
Player_info.jpg
if (var3 & 2) = 0x2
from Hex to Dec (You can convert them with your calculator or using: Hexadecimal to Decimal Converter)
Most common mistake is that people think oh you just add 0x in front of it nah you fucker. when it will be & 10 it will become : 16 and etc.
Now you will need to follow also how the masks are being readed on client if u fail doing that all other masks will be reading incorrect values as well.
Player_info.png
And the fun part is appearance

idea64_GwjVMXo1Sz.jpg

If you forget to send or send it incorrectly may god be with you it's a son of a bitch to locate where you went wrong. Don't rush with these masks / packets.
With packets it would be recommended to do one by one and test them out. Since it's better to know exactly on which one you is faulty rather than digging trough 100 packets at once.
Default packets that you need to pass login phase: IF_OPENTOP, REBUILD_NORMAL, For RSMOD/ALTER you will need to do RebuildLogin (Which is basically the same packet REBUILD_NORMAL) but it needs extra data.
Anyways yh that's it for masks same will go for NPC_INFO

Also you will need to find and update this:
idea64_0Ht8vitkfb.jpg
When it's incorrect. It will be only noticed when you join region that contains npcs. You will be crashed.

Ohh just forgot to include login decoder i guess ill do that later. :S

Overall that should be it , that's the bare minimum that you need to do to upgrade from any rev. Don't get me wrong you will need to put way more work. Especially when doing bigger jumps you.
Also when jagex adds new stuff to packets or change value types. You can't skip a single byte. Entire game runs on one huge ass array if you read something incorrectly the entire array gets fucked and makes other packets read incorrect values.
It's also not recommended to start doing rev upgrading for complete beginners you need to have some coding knowledge. Keep your eyes on comments i hope there will be some more extra notes it's a huge topic to cover but yh these are basically main things you will need to do for first time it can really take long time but the more you practice it the faster it goes.
Also to make easier you can reference to fully refactored client: https://github.com/CloudS3c/meteor-client/tree/main/osrs/src/main/java


 

Attachments

  • Player_info.png
    Player_info.png
    27.3 KB · Views: 638
Last edited:
Appreciate you pulling this together, this will definitely give people direction on what to look at when going through these revision upgrades!
 
Looks pretty accurate. Basically just rename the client and make the server match + add anything new. In summation, this is what I do:
  • rename the Packet.java aka Buffer.java scrambled byte order methods that didn't map properly
  • find all packet ids by renaming them to match your current client (client, server, and zone prot)
  • identify any new packets
  • fix scrambled packet byte orders for client, server, and zone prot
  • fix scrambled npc updating (and check if player updating changed)
  • fix scrambled byte order of npc updating masks
  • fix scrambled byte order of player updating masks
  • fix scrambled mask order & mask ids of npc updating masks
  • fix scrambled mask order & mask ids of player updating masks
  • fix player appearance if needed
  • if there were any new packets add support to the server
  • check if anything extra is sent on login
  • fix archive hash order sent on login
  • update any config decoder opcode changes
  • if it doesnt work disable all the packets except those that are necessary, to help find the issue
  • make sure any enums, structs, params, dbtables, or scripts that got removed are not being used and if they are update the server with the new functionality. for example music stuff moving from enums to dbtables might cause errors if your server is still using the nonexistent enums
  • dump components for interfaces that changed
  • for toplevel components use the enums in the cache to map the resizable components to all other toplevels (fixed 1129, resizable 1130, resizeable moder 1131, full screen 1132, spectator 139, mobile 1745)
 
I know nothing about this type of things, but I'm very happy to see things like this still being provided. Thank you and to others who continue this area of teaching!
 
Nice contribution :D. As someone who learned how to do all of this back in the day with no information on it, it is nice to see the community finally documenting it for people unfamiliar with the process.
 
This is great info, I have a question tho

As someone who's very new to all of this I was expecting the process would include a part where you run the real game client and use some software like fiddler to read and analyze the network traffic and see what's being sent and received, yet you didn't include anything around those lines

If you're jumping to a new rev that has new stuff, how do you know what new packets your server needs to send to the new client to understand it? For example some new interface?

Or is it easier to go through a deobfuscated client like meteor and try to pick up the new stuff by reading the code?
 

Users who are viewing this thread (total: 1, members: 0, guests: 1)