[PR #212] [MERGED] kb: Cyberpunk 2077 native modding — address hashes for update-proof hooks, and which source wins #215

Closed
opened 2026-10-15 20:54:26 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rehan-remade/universal-modder/pull/212
Author: @Selene0623
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @rehan-remade

Base: main ← Head: kb/cp2077-agent-skills


📝 Commits (4)

  • 25ef56a kb: Cyberpunk 2077 native modding — address hashes and which source wins
  • fdc6549 kb: cyberpunk 2077 address hashes: review fixes
  • 93bab0f Merge remote-tracking branch 'origin/main' into land/pr-212
  • 8c4c52a kb: regenerate the index

📊 Changes

3 files changed (+172 additions, -1 deletions)

View changed files

📝 knowledge/INDEX.md (+2 -1)
➕ knowledge/games/cyberpunk-2077/cyberpunk-2077-native-modding-address-hashes.md (+128 -0)
📝 knowledge/index.json (+42 -0)

📄 Description

Adds knowledge/games/cyberpunk-2077/cyberpunk-2077-native-modding-address-hashes.md — the first Cyberpunk 2077 note in the base.

What it covers. Two things that are hard to pick up from scratch:

  1. The symbol table the game itself ships — bin/x64/cyberpunk2077_addresses.json, 987,479 entries over 606,577 distinct offsets — and how to turn an RVA from a disassembler into the linker-map form section:rva_from_section_base (0x102428 → 0001:00101428) to get the hash, secondary hash and symbol name that keep a native hook alive across patches via RED4ext::UniversalRelocFunc. Missing match ≠ broken conversion; the table is per-build.
  2. The source-priority ladder for native/Redscript work (local code → fetched upstream trees → RED4ext.SDK → RedLib → decompiled scripts → binary), the SDK style rules, plugin lifecycle, @wrapMethod semantics, and the concurrency discipline native callbacks demand.

It is verified, and the verification found a bug. Distilling alphanin9/CP2077AgentSkills (MIT), I ran its address-hash script against the retail install here. As published it does not start on Python 3.14: %CP2077_PATH% in an add_argument(help=…) string is %-formatted by argparse, so it dies with ValueError: unsupported format character 'C' (0x43) at index 65 before reading any argument. Escaping it as %%CP2077_PATH%% makes it run, and a real lookup returns 0001:00101428 → hash=887623293 → game::WorldBoundarySystem::Tick. The note records the exact transcript, the error paths (Matches: none, exit 2 for an RVA outside every section), and a section-table cross-check with llvm-readobj.

Honesty markers: the symbols' correctness was not verified (that needs disassembly), no plugin was built or injected, and the note flags the stamp gap (table stamped 2025-08-27, exe mtime 2026-08-07). The upstream fix is local, not yet sent to the skill author.

Links: alphanin9/CP2077AgentSkills, wopss/RED4ext.SDK, psiberx/cp2077-red-lib, adamsmasher/cyberpunk (Codeberg).

Gate: um kb check PASS on the note · um kb check --index PASS 158 notes · uv run --with pytest pytest -q tests 87 passed, 1 skipped · um publish check . 473 files, 0 failures, 2 warnings (both pre-existing, unrelated notes).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rehan-remade/universal-modder/pull/212 **Author:** [@Selene0623](https://github.com/Selene0623) **Created:** 10/10/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@rehan-remade](https://github.com/rehan-remade) **Base:** `main` ← **Head:** `kb/cp2077-agent-skills` --- ### 📝 Commits (4) - [`25ef56a`](https://github.com/rehan-remade/universal-modder/commit/25ef56ace74c865a14de94dd7c0a1f0b01202eb2) kb: Cyberpunk 2077 native modding — address hashes and which source wins - [`fdc6549`](https://github.com/rehan-remade/universal-modder/commit/fdc6549de028c5c2d5c3ad0fadd507a2d39bb399) kb: cyberpunk 2077 address hashes: review fixes - [`93bab0f`](https://github.com/rehan-remade/universal-modder/commit/93bab0ff3d2a658febf4b596321318c8c82566b3) Merge remote-tracking branch 'origin/main' into land/pr-212 - [`8c4c52a`](https://github.com/rehan-remade/universal-modder/commit/8c4c52ac8f76fffc85b54967552f56b93465b3ed) kb: regenerate the index ### 📊 Changes **3 files changed** (+172 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `knowledge/INDEX.md` (+2 -1) ➕ `knowledge/games/cyberpunk-2077/cyberpunk-2077-native-modding-address-hashes.md` (+128 -0) 📝 `knowledge/index.json` (+42 -0) </details> ### 📄 Description Adds `knowledge/games/cyberpunk-2077/cyberpunk-2077-native-modding-address-hashes.md` — the first Cyberpunk 2077 note in the base. **What it covers.** Two things that are hard to pick up from scratch: 1. The symbol table the game itself ships — `bin/x64/cyberpunk2077_addresses.json`, 987,479 entries over 606,577 distinct offsets — and how to turn an RVA from a disassembler into the linker-map form `section:rva_from_section_base` (`0x102428` → `0001:00101428`) to get the `hash`, `secondary hash` and symbol name that keep a native hook alive across patches via `RED4ext::UniversalRelocFunc`. Missing match ≠ broken conversion; the table is per-build. 2. The source-priority ladder for native/Redscript work (local code → fetched upstream trees → RED4ext.SDK → RedLib → decompiled scripts → binary), the SDK style rules, plugin lifecycle, `@wrapMethod` semantics, and the concurrency discipline native callbacks demand. **It is verified, and the verification found a bug.** Distilling [alphanin9/CP2077AgentSkills](https://github.com/alphanin9/CP2077AgentSkills) (MIT), I ran its address-hash script against the retail install here. As published it does not start on Python 3.14: `%CP2077_PATH%` in an `add_argument(help=…)` string is `%`-formatted by argparse, so it dies with `ValueError: unsupported format character 'C' (0x43) at index 65` before reading any argument. Escaping it as `%%CP2077_PATH%%` makes it run, and a real lookup returns `0001:00101428` → `hash=887623293` → `game::WorldBoundarySystem::Tick`. The note records the exact transcript, the error paths (`Matches: none`, exit 2 for an RVA outside every section), and a section-table cross-check with `llvm-readobj`. **Honesty markers:** the symbols' *correctness* was not verified (that needs disassembly), no plugin was built or injected, and the note flags the stamp gap (table stamped 2025-08-27, exe mtime 2026-08-07). The upstream fix is local, not yet sent to the skill author. **Links:** alphanin9/CP2077AgentSkills, `wopss/RED4ext.SDK`, `psiberx/cp2077-red-lib`, `adamsmasher/cyberpunk` (Codeberg). Gate: `um kb check` PASS on the note · `um kb check --index` PASS 158 notes · `uv run --with pytest pytest -q tests` 87 passed, 1 skipped · `um publish check .` 473 files, 0 failures, 2 warnings (both pre-existing, unrelated notes). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 20:54:26 +00:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rehan-remade/universal-modder#215
No description provided.