Skip to content

Fix UE4.27 cooked asset parsing#116

Open
jbowensii wants to merge 1 commit intoAstroTechies:mainfrom
jbowensii:fix/ue4.27-compatibility
Open

Fix UE4.27 cooked asset parsing#116
jbowensii wants to merge 1 commit intoAstroTechies:mainfrom
jbowensii:fix/ue4.27-compatibility

Conversation

@jbowensii
Copy link
Copy Markdown

Summary

Fixes two issues that prevent parsing cooked assets from UE4.27 IoStore games (e.g. Return to Moria, DeltaForce):

  • ObjectVersionUE5 enum panic: UE4.27 files with legacy_file_version <= -8 write a small integer (e.g. 1) in the UE5 version field. The ObjectVersionUE5 enum jumps from UNKNOWN = 0 to INITIAL_VERSION = 1000 with no variants in between, so TryFromPrimitive panics. Fix: fall back to UNKNOWN for unrecognized values instead of propagating the error.

  • Compression block count hard rejection: UE4.27 cooked assets use Zlib compression and have non-zero compression_block_count. The parser returned an error for any value > 0. Fix: skip the FCompressedChunk entries (16 bytes each: two i64 fields) so parsing can continue.

Context

This is blocking bananaturtlesandwich/stove#39 — Stove (the cooked .umap editor) cannot open any UE4.27 map files due to these two errors in unreal_asset.

Changes

  • unreal_asset/src/asset.rs line 568: try_into()try_into().unwrap_or(UNKNOWN) for ObjectVersionUE5
  • unreal_asset/src/asset.rs lines 675-678: Skip compression block entries instead of rejecting

Test plan

  • Open a cooked .umap from a UE4.27 IoStore game (Return to Moria, DeltaForce)
  • Verify the file parses without "No discriminant in enum ObjectVersionUE5" error
  • Verify the file parses without "Compression block count is not zero" error
  • Verify UE5 assets still parse correctly (no regression)

🤖 Generated with Claude Code

Two fixes for parsing cooked assets from UE4.27 games that use IoStore:

1. ObjectVersionUE5 enum panic: UE4.27 files with legacy_file_version <= -8
   write a small integer (e.g. 1) in the UE5 version field. The enum has no
   variant between UNKNOWN (0) and INITIAL_VERSION (1000), causing
   TryFromPrimitive to fail. Fix: fall back to UNKNOWN for unrecognized values.

2. Compression block count rejection: UE4.27 cooked assets use Zlib
   compression with non-zero block counts. The parser hard-rejected these.
   Fix: skip the FCompressedChunk entries (16 bytes each) instead of erroring.

These fixes enable tools like Stove to open cooked .umap files from UE4.27
games such as Return to Moria and DeltaForce.

Fixes bananaturtlesandwich/stove#39

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant