Skip to content

Commit

Permalink
fix: support Java 22 and newer clients for packs that disregard ZIP spec
Browse files Browse the repository at this point in the history
These changes were tested to work well up to Java 24 and should not
impact older Java versions.

Fixes #294.
  • Loading branch information
AlexTMjugador committed Oct 26, 2024
1 parent 612149b commit cbe9563
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ Versioning](https://semver.org/spec/v2.0.0.html).

#### Fixed

- Packs generated with the `zip_spec_conformance_level` option set to
`disregard` now reliably work on Minecraft clients running Java 22 or newer.
(Thanks _@mrkinau_ and _@mihannnik_ for reporting the issue!)
- Shaders that depend on `#moj_import`ed or parent-defined preprocessor
variables to be syntactically correct or expand to the intended source code
will no longer cause PackSquash to fail or change their semantics.
Expand Down
4 changes: 2 additions & 2 deletions packages/packsquash/src/squash_zip/obfuscation_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ impl ObfuscationEngine {
4096 + central_directory_header.compressed_size % 4096;
}
central_directory_header.local_header_disk_number =
(random_u32(seed) % 32768) as u16 + 32768;
(random_u32(seed) % 32768) as u16 + 32767;
} else {
if obfuscate_uncompressed_size {
central_directory_header.uncompressed_size = 0xFFFFFF7F;
}
central_directory_header.local_header_disk_number = u16::MAX;
central_directory_header.local_header_disk_number = u16::MAX - 1;
}

if let SizeIncreasingObfuscation::Enabled {
Expand Down

0 comments on commit cbe9563

Please sign in to comment.