10000 GitHub - ShardTinkerer/Back2Britain: Remove Bwt Compression from UO 2D Files
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ShardTinkerer/Back2Britain

8000
8000
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Back2Britain

Whats going on here

In the latest versions of UO 2D since July 2024, Mythic added a new compression level to the files to shrink the data partition down from 160MB to 72MB. This is maintains on the data partition within the files. UOFiddler and Orion both do not have the Bwt decompression built in, but CUO does. So the Bwt method has been referenced in the project as a dependency from CUO libraries, and the files are processed through their awesome work. I was able to use their code to understand this below:

The cliloc files, are loaded in their entirety into Bwt and written back out. This was easy, like 10 minutes effort. The gumpartLegacyMUL.uop was much more complex to work out, and took me about 15 hours of effort to get right. The file structure is as follows:

      uInt32 : MagicNumber
      uInt32 : Version
      uInt32 : timestamp
      Int64 : NextBlockAddress
      uInt32: Block Size
      Int32: Total file count
      ---Seek to NextBlockAddress location---
      From this point, the file is split into chunks of "Block Size". Previously 1000, now 100.
      ---Loop through chunks---
        Int32: fileCount in chunk
        Int64: Next Chunk Address
          ---Loop through files---
          Int64: File data offset
          Int32: Header length
          Int32: Size of data compressed
          Int32: Size of data decompressed
          UInt64: hash (of the filename, so the client can do lookups)
          UInt32: Data hash (not used here)
          Int16: Flag (THIS: is the decompression level. 0/1: None, 2: Normal ZLib, 3: New BWT method)
            ---Save current file position, and point buffer to file data offset---
            byte[]: Read HeaderLength
            byte[]: Read Compressed Data Length
            ---Point buffer back to last position---
          ---end loop---
        ---Seek next Chunk---
      ---end loop---

What really going on?

Then the data taken out of this file is decompressed with the normal ZLib method, then decompressed again using Bwt. Then we pull out the height and width of the gumps and save them into the right place. We set the flag back to 1, and do bit of number crunching to work out the new data offsets and chunk positions. Starting positions of the data dont really matter here, because as long as the structure above is followed it all just works. The original files are zipped into a backup directory, and the decompressed files are written in their place.

Setup

First step, make a backup of the entire UO directory first. Its the easiest way to role back if you have issues.

Patch UO:2D by running UOPatch.exe, this will download the latest file.

Move all these files from the build into the UO Directory. Ideally I'll get this compiled into a single file executable for cleanliness.

Run Back2Britain.exe. This will move all cliloc.* files into backup and gumpartLegacyMUL.uop into the backup folder. Then process the files and create new decompressed files. image

New Files will run with : Orion/UOFiddler/CUO (perhaps more)

https://buymeacoffee.com/adverserath Or even just say thanks on Discord: adverserath

About

Remove Bwt Compression from UO 2D Files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%
0