The current implementation supports most of the recovered packets.
Exceptions being:
1) type array[x][x] (ex. struct PACKET_ZC_WARPLIST)
2) structs that have nested struct(s) that are not at the end (ex. struct EQUIPSLOTINFO)
3) structs that have multiple nested structs (nested on the same level) (ex. i haven't found an example of this but its possible)
- ... (add to the list)
We can solve these problem by implementing a:
1) struct::array (basically this is struct::nestedarray(count|slurp) without the SUPER::(un)pack_)
in such object we put a "nested" struct::* object that we treat as in struct::nestedarray(count|slurp)
2&3) struct::chain (un)pack class
in such object we can put a list of struct::* objects that we sequentially call method (un)pack_ on.
I'll need help on following:
- TODO: conversion of kLab's C structs to (compilable) ANSI-C.
- DONE: recording of the packet below, so we can put the (un)packer to the test.
Code: Select all
// packet 0x11c
struct PACKET_ZC_WARPLIST {
/* this+0x0 */ short PacketType
/* this+0x2 */ unsigned short SKID
/* this+0x4 */ char mapName[4][16]
}
(or i can just pack my own packet i guess...)
- TODO: test if we really are able to unpack all RO packets
The actual implementation might even change along the way, we'll see.
I didn't have any time today and probably will not have any, but i'll try to work on it tomorrow.
Also, i had an old C struct to perl unpack string test lying around from a while ago but its still very basic and it needs to be worked on.
Suggestions, criticism and questions are always welcome btw.
So for now my thread goes to sleep, i'm hoping for other threads to awake now
UPDATE:
uploaded the first incarnation of the unpacker that implements the solution to the above problems and is thus capable of handling all(?) known RO packets,
in test.pl i marked the design flaws marked by (# FLAW:) and on the bottom of the file you will find the idea's for iteration 2 in the development cycle of the project.
Also added the the (really) old experiment to do C struct to perl unpack string, idk if it has any use.
Experimental:
- changed the way we name and create the objects to make it easier to understand and more dynamical
The external is done: this will probably be the final way of creating the (un)pack objects, so now we can start working on the C struct to (un)pack object parser.
- temporarily(?) merged all array or struct related classes in their respective class until we find the best way to split them back up and let the main array & struct class delegate to other classes without causing overhead.
- $self->{(un)pack} was an experiment, it may change together with the splitting up of the classes (if we decide to)
The internal may still change.
- Fixed multidimensional array unpacking
- Added chain struct with 2 array's test (Harvest)
- Fixed chain struct for (see comments: self unpack, no name)