bemaniutils icon indicating copy to clipboard operation
bemaniutils copied to clipboard

Implement decompressed kbinxml decoding

Open Bottersnike opened this issue 3 years ago • 6 comments
trafficstars

Implement decoding of decompressed binary packets.

See https://bsnk.me/eamuse/packet.html#schema for format reference.

Potential todo:

  • [ ] Switch to decompressed packing if any node names longer than 24h are present ('cus that's invalid!)

Bottersnike avatar Jun 18 '22 01:06 Bottersnike

For the TODO, would you do that by walking the tree recursively and choosing compressed/uncompressed if any node or attribute is > 0x24? Seems reasonable to do that as a transparent way of encoding without the above layers needing to know anything. I'd be cool if you had that in a different PR to keep this one simple. As for this one, do you have any sample binary data (maybe generated by another known good kbinxml implementation) that could be checked into the tests directory alongside the other fixture data and used to test this?

DragonMinded avatar Jun 22 '22 02:06 DragonMinded

A pre-walk of the tree would likely be the plan yeah. I can look into generating some tests later today 👍

Bottersnike avatar Jun 22 '22 02:06 Bottersnike

Pinging this, did you get a chance to write tests?

DragonMinded avatar Aug 13 '22 16:08 DragonMinded

Pinging this, did you get a chance to write tests?

Plenty, but never used any of them 😅. Will try and get some actually written

Bottersnike avatar Aug 16 '22 13:08 Bottersnike

I know there's already some binary blobs from "difficult" bits I've had to fix the BINXML decoder on before, similarly for the LZSS encoder/decoder. If you just take a known working blob encoded by mon's tool or something and check it in and verify that it decodes, and then re-encodes back to the same blob, that'll probably be fine. I just want to make sure that it's not going to regress any existing decoding/encoding.

DragonMinded avatar Aug 16 '22 16:08 DragonMinded

I've just pushed an update that also adds decompressed encoding and then uses it as part of the roundtrip loop, which should cover most interesting cases

Bottersnike avatar Sep 09 '22 12:09 Bottersnike

Ah shit, I completely spaced on this, let me check now!

DragonMinded avatar Sep 19 '22 03:09 DragonMinded