console-mod
Skill92 starsChanged 21 days agoMITView on GitHub
Mod Maker. Describe any change in plain English and Claude builds it into the game: patches, cheats, new behaviour, as code that never touches the original files. Ports PCSX2 .pnach patches to the PS2Recomp port (code writes become ps2_recomp TOML instruction patches, data writes become a C++ game override that writes RDRAM at load or every frame, the rest are flagged for a manual port with the reason) and scaffolds game overrides that bind, replace or wrap a game function with the real PS2Recomp API. Writes to console/patches/, never to the game's files, the generated runner/*.cpp or headers. Use when the user says "mod this game", "add a cheat", "infinite health", "port this pnach", "make my gun do X", "change how X works", "game override", "turn this PCSX2 patch into the port", or once the port boots and they want to change it.
In this repository10 other files it gives its agents.
- console-anywhereSkill
- console-backendSkill
- console-controllerSkill
- console-graphicsSkill
- console-levelsSkill
- console-physicsSkill
- console-reverseSkill
- console-savesSkill
- console-soundSkill
- console-testerSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 139
Bring your own game: Only a game the user owns, dumped from their own disc.
- Very specific: line 147
Never edit the game's files, ps2xRuntime/src/runner/ or any header (a header change rebuilds every generated file).
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
console-mod
The Mod Maker turns a request ("my rifle does triple damage", "start with 99
lives", "skip the intro") into a change built into the port. A mod is a few
small text files you own: a .pnach to try the idea in PCSX2, TOML instruction
patches for ps2_recomp, and a C++ game override compiled into the runner. The
disc, the ELF and the recompiled C++ are never edited.
Be honest about the hard part: finding WHERE the game keeps a value or does a thing is the real work, and it differs per game. This skill gives the method and the tools. Big mods ("two games in one", new modes, new levels) are long projects built from these same pieces, one function and one value at a time.
${CLAUDE_SKILL_DIR} below is this skill's folder (where this SKILL.md lives).
python3 "${CLAUDE_SKILL_DIR}/pnach.py" crc SLUS_203.12 # both CRCs + the pnach name PCSX2 wants
python3 "${CLAUDE_SKILL_DIR}/pnach.py" parse my.pnach # every line, section and code kind
python3 "${CLAUDE_SKILL_DIR}/pnach.py" classify my.pnach --elf SLUS_203.12 # CODE / DATA / BSS / HEAP / OUTSIDE / CAVE
python3 "${CLAUDE_SKILL_DIR}/pnach.py" toml my.pnach --elf SLUS_203.12 # [[patches.instructions]] blocks
python3 "${CLAUDE_SKILL_DIR}/pnach.py" override my.pnach --elf SLUS_203.12 --frame-hook 0x0012A3B0
python3 "${CLAUDE_SKILL_DIR}/override.py" new --name "Gold rifle" --elf SLUS_203.12 --wrap 0x00123450=gold_damage
python3 "${CLAUDE_SKILL_DIR}/override.py" keys SLUS_203.12 # keys for a hand-written overrideOther flags: --map console/functions.csv (the CSV from Ghidra's
ExportPS2Functions.java: tells code from data in single-segment ELFs and
checks function starts), --section NAME (port only some [sections]),
--ignore-crc, --json, --out, --force, --repo <PS2Recomp> (checks
--bind handler names against ps2_call_list.h). Exit 1 means something needs
a manual port or a warning; read it out.
What it reads and writes
| file | what |
the game's main ELF (SLUS_203.12) | read only: segments, sections, original instruction words, both CRCs |
*.pnach | read only: PCSX2 patches, yours or a community patch you trust |
console/functions.csv | optional: Name,Start,End,Size from ExportPS2Functions.java |
console/patches/<slug>.cpp | the override module: yours, safe to share |
console/patches/console_mods.cmake | written once: compiles every .cpp in that folder into ps2EntryRunner |
| the game's ps2_recomp TOML | never written by the tools: paste the toml output yourself, after a backup |
templates/override.cpp | the corrected override template both tools fill in (the original skill's template called an API that never existed) |
templates/console_mods.cmake | copied next to the overrides the first time |
From a request to a mod
- Pin the change down. "Triple damage" means: which number, for which
weapon, when. Ask one question if it is ambiguous. Write it in
console/STATE.mdas the goal. Pick the layer.
the change layer how a value the game keeps in RAM (lives, ammo, money, a timer) data write, re-applied every frame if the game rewrites it pnach, then pnach.py override --frame-hooka constant (speed, gravity, jump height, damage table) data or a constant built in code /console-physicsfinds it,tune.py patchwrites the linesone instruction (skip a check, stop a counter going down) code patch pnach, then pnach.py tomlnew behaviour (a function does something else) function override override.py new --replaceor--wrapthe runtime already has a handler for that function bind override.py new --bind 0xADDR=handler(orhandler@0xADDRin TOMLstubs)a texture, a sound, a level asset swap /console-graphics,/console-sound,/console-levels- Find the address. PCSX2's debugger memory search while playing (search
the value, change it in game, search again), then a write breakpoint shows the
code that changes it; Ghidra (GhydraMCP if installed, see
/console-reverse) for the function and its callers;/console-physicstune.py scanfor floats. Addresses belong to ONE build: always use the user's ELF. - Test in PCSX2 first.
pnach.py crc <ELF>prints the file name PCSX2 looks for (SLUS-20312_1A2B3C4D.pnach, in itspatches/orcheats/folder). Write the lines, enable them, check the effect. Cheap to iterate. - Bake it into the port.
pnach.py classifyfirst. Read out every class and every manual line.- CODE:
pnach.py tomlprints[[patches.instructions]]blocks. Back up the game's TOML, paste them at the end, re-runps2_recomp, rebuild incrementally. ps2_recomp only patches words inside functions it decodes, and SYSCALL/COP0/CACHE originals needpatch_syscalls/patch_cop0/patch_cache = true(the output says when). - DATA, BSS, HEAP:
pnach.py overridewrites the module. Place 1 and 2 writes and anything the game clears at boot need--frame-hook, a function the game calls once per frame AND reaches withjal(see reference/mod-layers.md). Ajtail jump to a known function compiles to a direct C++ call that skips the runtime's function table, so the hook would not run on that path. The tool counts thejalandjreferences and warns; if onlyjreaches it, hook the caller one level up. The same holds foroverride.py --replace/--wrap/--bind. - New behaviour:
override.py new, then fill in the C++ (the stubs show how to read arguments withgetRegU32(ctx, 4)and return withsetReturnU32). API details: reference/override-api.md. - Install once per PS2Recomp checkout, with the user's OK: add
include("<abs path>/console/patches/console_mods.cmake" OPTIONAL)at the end ofps2xRuntime/CMakeLists.txt. It adds every.cppinconsole/patches/to theps2EntryRunnerexecutable itself:ps2_runtimeis a static library, and the linker drops an object file there that only holds a self-registration, so never put overrides insrc/lib/. Thencmake --build out/build --config Debug. The files stay out of the unity batches, so the recompiled game does not rebuild.
- Playtest with
/console-tester(run.py boot ... --expect) and play it yourself. The runtime logs[game_overrides] applying '<name>'when the module matched (runtime logs on). - Record it: one line per mod in
console/STATE.md(name, files, status).
The pnach format, every line kind and the CodeBreaker extended codes are in reference/pnach-format.md.
What classify means
| class | where the write lands | becomes |
| CODE | an executable section, a function in the Ghidra map, or an executable segment | a TOML instruction patch; byte and short writes are merged into the original word from the ELF |
| DATA | data the ELF loads from the file | an RDRAM write in the override at load (place 1/2: also every frame) |
| BSS | the zero-filled part of a segment | the frame hook: once on the first frame (place 0) or every frame (place 1/2) |
| HEAP | RAM beyond the ELF (heap, stack, loaded files) | the frame hook, same as BSS |
| OUTSIDE | scratchpad, hardware registers, BIOS, EE kernel RAM (below 0x00080000) | manual: no RDRAM write does what it did on a PS2 |
| CAVE | new code written into memory, a jump or branch into patched memory, or (with --map) code where no function is | manual: rewrite the logic as an override function |
A low-confidence CODE write (one read-write-execute segment, no sections, no
map) is both patched in the TOML and written to RDRAM, so it works whether it
is code or data. Pass --map to settle it. IOP patches, dpatch lines and
extended codes other than plain writes are listed as manual with the reason.
Guard rails
- Bring your own game. Only a game the user owns, dumped from their own disc. Never download or look for ISOs, ELFs or BIOS files, never ask for them. PS2Recomp needs no BIOS.
- Nothing from the game gets published. Share the
.pnach, the TOML patch lines,console/patches/*.cppand the user's own assets. Never the disc, the ELF, IRX modules, ripped assets or the generatedrunner/*.cpp. - Not affiliated with Sony. PlayStation is a trademark of Sony Interactive Entertainment.
- Never edit the game's files,
ps2xRuntime/src/runner/or any header (a header change rebuilds every generated file); never clean the build. The tools refuse to write intorunner/, refuse to overwrite without--force, and refuse a pnach whose file-name CRC is for another build. Back up the TOML before pasting. A mod that crashes the port is reverted first, then fixed.
Hands off to
/console-physicsto find and tune the numbers (speed, gravity, frame rate)./console-graphics,/console-sound,/console-levelsfor asset swaps./console-testerto boot, playtest and check nothing else broke./console-reverseto re-runps2_recompafter TOML patches and log STATE.md./console-anywhereto package: mods ship as patches and overrides, never game files.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

