I-Am-Dench / nimbus-launcher

Launcher program for LEGO® Universe clients.
GNU General Public License v3.0
3 stars 0 forks source link

ENH: Implement sub-package CLI for patching protocols #26

Open I-Am-Dench opened 3 months ago

I-Am-Dench commented 3 months ago

This tool would most likely be used by modders, or anyone just messing around with the client, to remove the need for an HTTP server when building and testing patches.

This will most likely need a sizable rewrite to the underlying Patch implementation and re-evaluation of the protocol specification to allow for pulling local resources instead of strictly remote ones.

aronwk-aaron commented 3 months ago

There's also the option of implementing the original patching protocol as well. I think i can scrounge up some documentation I have on that if you would like The client has a patcher built into it to facilitate download while playing

I-Am-Dench commented 3 months ago

That would actually be fantastic! Seems like that would probably be the ideal solution. Send over what you can find! Might even be worth it to try and find the original patcher to run some tests on, ~though after some brief searching it seems like no one, or very few people, got around actually archiving it.~ Found it within the packed client.

aronwk-aaron commented 3 months ago

https://docs.lu-dev.net/en/latest/file-structures/compression.html

https://github.com/LUDevNet/LUpdate

here are some resources and tools that can generate the patches, although some additional code is needed for the patch cache generation that I have not published yet

Xiphoseer commented 3 months ago

The basic idea of that system is that every file is identified by its content via md5sum hash digest, compressed with "raw" zlib/deflate in the sd0 container format, and then served on the PATCHSERVERIP CDN as /luclient/a/b/<md5sum>.sd0 (where a/b are the first two hex digits of the md5sum respectively) via HTTP.

The versions/trunk.txt (manifest) next to the client folder in a packed client is used to look up the current md5sum + size for a path. That file itself is patched using that system via the index.txt manifest. A bunch of this is configurable in theory via patcher.ini

The packed stuff is a bit different again, it's mostly client side, except for the prepackaged "frontend" (another manifest txt) minimal download. It uses the pk (archives) and pki (index). Those use a binary tree of CRC32 hashes of asset paths to figure out which pk a file belongs to and where in that pk it is at.

Feel free to contact me on discord (same username) for questions.

I-Am-Dench commented 3 months ago

Thanks guys, really appreciate it! I started working yesterday on a library for go implementations of LU formats. So far I got manifest and pk files working, and hopefully pki isn't too far away. Definitely got a ways to go before the launcher can support live-accurate patching.

Xiphoseer commented 3 months ago

FWIW a bunch of this is implemented in https://assembly.lu-dev.net/ which you could wrap in a shared library for use in your patcher of you want.

Edit: specifically a bunch of docs are in https://assembly.lu-dev.net/assembly_pack/index.html and there is https://github.com/lcdr/lu_formats as well

aronwk-aaron commented 3 months ago

@I-Am-Dench if you have discord and want to talk more about this, feel free to add me, my username is aronwk