Skip to content

Support and validate Cyberpunk 2.5 full script bundles - #203

Open
Antrakt92 wants to merge 1 commit into
jac3km4:0.5.xfrom
Antrakt92:codex/redscript-cp25-upstream
Open

Antrakt92 wants to merge 1 commit into
jac3km4:0.5.xfrom
Antrakt92:codex/redscript-cp25-upstream

Conversation

@Antrakt92

@Antrakt92 Antrakt92 commented Oct 22, 2026 •

Copy link
Copy Markdown

Cyberpunk 2077 2.5 still uses bundle version 14, but its full script cache has a seventh table descriptor. The old reader starts the string data at the old header boundary. This patch reads the extended header and follows the stored table offsets so full 2.5 bundles can be compiled.

The extra table has one 12-byte linkage row per definition, including index zero. The reader checks the row count, file bounds and CRC. An unchanged extended bundle is preserved byte for byte; after an edit, a full bundle gets regenerated zero linkage rows with updated counts, offsets and checksums. Legacy bundles keep their original layout.

Related to #202: this approach retains the extended layout in the output. Rows with external-resolution bit 0 set are rejected explicitly because they need a precompiled-base resolver. Other nonzero producer fields are not fully understood, so this does not claim general patch-bundle support.

Two related changes are needed in the compilation path:

  • The SCC signature marker uses four-byte enum storage for extended bundles. The old zero-width marker was rejected by the 2.5 native loader.
  • CLI and SCC serialization finish before the destination file is opened. Serialization failure therefore leaves an existing output intact. Filesystem writes are not atomic once writing starts.

Checks

On this format-only branch, 6229 local Windows tests passed, along with all-target Clippy and stable formatting:

cargo build --locked --workspace --exclude scc-lib-tests
cargo test --locked --workspace --exclude scc-lib-tests
cargo clippy --locked --workspace --exclude scc-lib-tests --all-targets
cargo fmt --all -- --check

The synthetic tests cover unchanged byte preservation, definition growth, legacy writing, invalid counts/bounds/CRC and external-linkage rejection. They build extended input from the existing upstream fixture; no new game cache or decompiled game source is included.

Independent DLL checks compiled legacy and pristine 2.5 inputs with error popups disabled. Official REDmod SCC produced LoadAndSave output and reported a functional match for 2.5 outputs, including class, field, method, wrap and replace probes. LoadAndSave returned 0xFFFFFFFF despite reporting completion, so acceptance was checked using the produced file and a successful compareBlobs, not its exit code alone.

A minimal game smoke test used the combined DEV2 build with RED4ext 1.30.0 and a local Auto Continue 1.1.2 test build. Startup compilation, save loading, automatic final confirmation and a rendered world were observed. This was not an in-game test of this standalone PR or the exact public ZIP, and it does not establish full-collection or cross-platform compatibility.

scc-lib-tests was excluded because libclang is unavailable. Stable rustfmt ignores the repository's nightly-only options; those options were not validated locally. No hosted CI was requested or run from this submission.

The rest of the work

The other changes are available separately so they can be reviewed independently:

  • #204: zero-capacity DLL error-buffer fix and regression test, based directly on 0.5.x.
  • #205: dependency refresh, bpaf migration and TOML/CLI regressions, also based directly on 0.5.x. It remains a draft pending libclang/platform checks.
  • Combined source and temporary Windows build, 0.5.31-cp25.2: contains the format changes, dependency work and error-buffer fix, with source/file hashes and licence notices. That combined build passed 6232 local tests and separate final DLL/CLI checks. Its exact public ZIP has not been tested in the running game.

The Windows package is an experimental replacement while upstream compatibility work is reviewed. It is installed instead of the official compiler, not as a second dependency. The original MIT licence and credits are retained; users are directed back to a supported upstream release when it includes the required fixes.

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