Kloct / packet-logger

A GUI packet logger mod for tera-proxy
GNU General Public License v3.0
12 stars 0 forks source link

su_need_remmap #3

Closed KiuviGonka closed 2 years ago

KiuviGonka commented 2 years ago

image

Hi klock imlearnig a little about of mods aand how they work.... can u tell me if the packet showed in the img its ok or its outdate, and in that case how i can find the correct def and opcode :) ty for u work and help 👯

Kloct commented 2 years ago

That packet is unmapped so the logger doesn't know what definition to use to parse it. The packet name there means SU for a packet from the server, then the last part is the opcode in hex (9930). There's several things you can do to identify and map it but it can get pretty complicated depending on the packet you're trying to define/map.

The Hex View includes the 4 byte packet header (size, opcode) then after that the packet data. So there are 4 bytes of data which could be something like an int32, uint32 etc and it's value is 0 so the definition would reflect that. If the packet has already been defined then you can browse toolbox's tera-data/definitions and see if there's a definition that makes sense in this packet's context. But since this looks like a pretty small packet that probably won't help too much.

When looking at definitions there it's also helpful to understand the different types packet data structures for TERA. The readme in tera-data does a pretty good job of explaining them.

One really important thing to do is to try to establish the packet's context; what event in the game triggers/uses this packet. Doing that will help narrow down what the packet could be and what kind of data it contains. As an example C_PLAYER_LOCATION will be sent every time the player moves, and it's structure will always have something to do with player coordinates. So even if you didn't have a definition or mapping for that packet you would be able to fairly quickly create them.

The only other way to figure out what the packet is would be with more advance reverse engineering/debugging of the game client. But that's quite a rabbit hole unless you know what you're doing.

Then for updating packets if you already know the opcode(not NEEDS_REMAP) but you get (bad def) then that means that the packet's length doesn't match it's definition. You'd have to dissect the packet structure again in the hex data to update the definition.

Unfortunately toolbox includes a fairly limited set of opcodes but it's fairly easy to add additional ones either at runtime in a script or by adding files into the toolbox data directory. It's just hard to keep them up to date if they aren't officially supported patch to patch.

If you didn't know you can add opcode mappings by creating a file called protocol.<protocolverison>.map in data/opcodes/ in toolbox. With a format like this:

C_OPCODE 1111

Then you can add definition files to the data/defintions/ folder following the formatting rules for those on tera-data

Hope that helps!

KiuviGonka commented 2 years ago

Hi, u really help me whit that, just a last thing that I want to know, I should use others mobs/ applications for do it?, I know it surely it's Avance but I like to read and learn about it, maybe cheat engine memory view or other thing?

Kloct commented 2 years ago

Yeah cheat engine could work but I'm not too familiar with it. I've been able to follow references to memory addresses containing packet data with some success but haven't done too much else.

This is a blog by the original developer of TERA Proxy that has a whole bunch of useful information about the game and it's networking. https://komyou.tumblr.com/

Then this guy was the Network Architect for TERA when it was originally developed and he has some presentations about the game's design as well (though a lot of them are in Korean). https://www.slideshare.net/sm9kr/presentations

Mod wise there's not too much else out there. This is a really good one for more client oriented mods https://github.com/VenoMKO/RealEditor

You might also check out the client datacenter which just has a bunch of the client's static data but can be used to help identify what type of information might be sent between the client and server. It can be extracted with RealEditor.