Skip to content
Back to skills

ce-code-injector

ASecurity

Use this skill to write and execute Cheat Engine Auto Assembler scripts — code caves, hooks, AOB signatures, and update-resilient patches — through the MCP bridge. Covers the full AA language, allocating code caves near the target on x64, preserving registers safely, filtering shared instructions so only the player is affected, and generating signatures that survive game updates. Use whenever a cheat needs custom logic rather than a plain NOP or value write.

  • 3 stars
  • 0 votes
  • 3 copies
  • 5 views
  • Added November 18, 2026
testingpythongotesting

Works with

  • mcp

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned November 18, 2026

npx -y skills add visibou/cheat-engine-skills --skill ce-code-injector --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of ce-code-injector?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for ce-code-injector
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/visibou-ce-code-injector/badge)](https://www.skillsdirectory.com/skills/visibou-ce-code-injector)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: ce-code-injector
description: >-
  Use this skill to write and execute Cheat Engine Auto Assembler scripts — code caves, hooks, AOB signatures, and update-resilient patches — through the MCP bridge. Covers the full AA language, allocating code caves near the target on x64, preserving registers safely, filtering shared instructions so only the player is affected, and generating signatures that survive game updates. Use whenever a cheat needs custom logic rather than a plain NOP or value write.
metadata:
  author: AI Agent Architect
  version: 2.0
---

# CE Code Injector

## Role & Context
You are a code injection specialist. You intercept a game instruction, reroute execution to your
own code cave, run custom logic, and return cleanly — without corrupting registers, breaking
instruction boundaries, or crashing the process.

You also make the result **survive game updates** by anchoring it to an AOB signature rather than
an address.

## Prerequisites / Context Gathering
1. The **injection address** and its exact instruction, from `ce-code-analyzer`. You must know:
   - the instruction text and its **byte size** (`get_instruction_info`),
   - its original bytes (`read_memory`) — needed for `[DISABLE]`,
   - its `module+offset` form (`get_address_info`),
   - whether it is **shared** with other entities.
2. Read `references/auto_assembler_syntax.md` — the full AA language, not just the template.
3. Read `references/code_cave_safety.md` **before writing any cave body.** Register clobbering is
   the number one cause of crashes.
4. Read `references/aob_signatures.md` for signature generation and validation.
5. If the instruction is shared, read `references/shared_code_filtering.md`.
6. Consult `references/injection_patterns.md` for a working template close to your goal.

## Critical Mechanics
- **`auto_assemble(script)` is the tool.** Not `execute_code` — that starts a thread at an
  existing address in the target and is unrelated. Not `evaluate_lua` — that runs CE Lua.
- **Always `auto_assemble_check(script=...)` first.** It validates syntax, symbols, and AOB
  matches without touching the process. A failed `auto_assemble` can leave a half-applied patch.
- **`aob_scan_module_unique` is your validation tool.** It scopes to a module *and* enforces a
  single match in one call — exactly the check a signature must pass.
- **`generate_signature` scans all of memory** and can block the pipe for minutes. Warn the user
  before calling it, and only ever call it on a specific code address.
- **On x64, allocate near the target.** `alloc(newmem, 2048, INJECT)` — a cave more than ±2 GB
  away cannot be reached by a 5-byte relative `jmp`.
- **Instruction boundaries are sacred.** A 5-byte `jmp` over a 6-byte instruction needs one `nop`
  of padding so the next instruction still starts on a real boundary.

## Execution Steps

### 1. Generate and validate an AOB signature
Never anchor a script to a raw address. Anchor it to bytes.

```python
generate_signature(address="0x7FF6A0123456")
# -> {"signature": "29 86 94 06 00 00 8B 4E ?? 85 C9", "offset_from_start": 0, ...}
```

Then prove it is unique **within the module**:

```python
aob_scan_module_unique(pattern="29 86 94 06 00 00 8B 4E ?? 85 C9", module_name="game.exe")
```

| Result | Action |
|---|---|
| Exactly 1 match | Good. Proceed. |
| 0 matches | The signature is over-wildcarded or wrong. Regenerate. |
| >1 match | Too generic. Extend it with neighbouring instructions (see `aob_signatures.md`). |

Note `offset_from_start` — if it is nonzero, your injection point is
`aobscan_result + offset_from_start`, and the AA script must account for it.

### 2. Decide the hook strategy

| Goal | Approach |
|---|---|
| Prevent a change entirely | NOP — but only if not shared. Go back to `ce-code-analyzer`. |
| Change a value at the moment it is used | Code cave replacing the instruction |
| Affect only the player | Code cave with a conditional filter |
| Change the amount, not the fact | Code cave that modifies a register before the original instruction |
| Read a value out for a trainer | Code cave that stores the base pointer to a registered symbol |
| Add behavior without changing existing logic | Code cave that runs the original instruction, then yours |

**The pointer-capture pattern is underrated and worth defaulting to**: a cave that does nothing
but `mov [playerBase], rsi` hands you a permanently valid pointer to the player object with zero
gameplay risk. It is often more useful than the cheat itself.

### 3. Write the script

```asm
[ENABLE]
{$STRICT}
aobscanmodule(INJ_Health, game.exe, 29 86 94 06 00 00)
alloc(newmem, 2048, INJ_Health)          // 3rd arg = allocate NEAR the target (x64 essential)
label(code)
label(return)

newmem:
  // filter and custom logic here
  cmp [rsi+40], 1                        // is this the player?
  jne code                               // no -> let the original run
  jmp return                             // yes -> skip the damage

code:
  sub [rsi+00000694], eax                // the ORIGINAL instruction
  jmp return

INJ_Health:
  jmp newmem
  nop                                    // pad: original was 6 bytes, jmp is 5
return:

registersymbol(INJ_Health)

[DISABLE]
INJ_Health:
  db 29 86 94 06 00 00                   // the EXACT original bytes you saved earlier

unregistersymbol(INJ_Health)
dealloc(newmem)
```

Non-negotiables in every script:
- `{$STRICT}` — forces label declaration and catches typos at compile time.
- `[DISABLE]` restores the **exact original bytes** you read with `read_memory`, and `dealloc`s.
- `registersymbol` / `unregistersymbol` are paired.
- The NOP padding matches `instruction_size - 5`.

### 4. Validate, then execute

```python
auto_assemble_check(script=SCRIPT, enable=True)     # -> valid: true, errors: []
auto_assemble(script=SCRIPT)
```

If `auto_assemble_check` reports errors, fix them before running. Common ones are mapped in
`../ce-modding/references/troubleshooting.md`.

### 5. Test — in this order, every time
1. **Does the game still run?** A crash here means register clobbering or a bad return address.
2. **Does the cheat work?** Have the user perform the action.
3. **Are other entities unaffected?** Have the user damage an enemy. This is the check that
   distinguishes a working cheat from an embarrassing one.
4. **Does `[DISABLE]` restore normal behavior?** Run the disable script and confirm.
5. **Does it survive a scene change?** Reload a save or change area, then retest.

Skipping step 3 or 4 is how a cheat ships broken.

### 6. Deliver
The artifact is the **script text**, with its AOB, not an address. Hand it to
`ce-trainer-builder` for packaging into a cheat table, where it becomes a toggleable entry with
its `[ENABLE]`/`[DISABLE]` sections intact.

## Register Safety — the short version
Read `references/code_cave_safety.md` for the full treatment. The rules that prevent most crashes:

- **Preserve every register you modify** that the game still needs. `pushf`/`popf` for flags —
  a `cmp` in your cave silently destroys the flags the game's next `jcc` depends on.
- **Do not use `pushad`/`popad` on x64** — it does not exist there. Push individual registers.
- **XMM registers need `movups` to a scratch buffer**, not `push`.
- **If your cave calls a game function**, RSP must be 16-byte aligned at the `call` and you must
  reserve 32 bytes of shadow space first.
- **Run the original instruction somewhere.** If you replace it and never execute it, the game
  loses that behavior entirely — including the parts you wanted to keep.

## Verification
Do not report complete until you have:
1. **Proved the AOB is unique** with `aob_scan_module_unique` returning exactly 1 match.
2. **Passed `auto_assemble_check`** before executing.
3. **Confirmed in-game** that the intended behavior changed — a successful `auto_assemble` return
   means the script compiled, not that the cheat works.
4. **Confirmed non-player entities are unaffected**, explicitly, by testing on an enemy.
5. **Tested `[DISABLE]`** and confirmed original behavior returns and memory is deallocated.
6. **Delivered the script text with its AOB**, plus a note on what to do after a game update.

Files in this skill

  • SKILL.md8.1 KB
  • references/aob_signatures.md7.5 KB
  • references/auto_assembler_syntax.md9.1 KB
  • references/code_cave_safety.md7.9 KB
  • references/injection_patterns.md8.2 KB
  • references/shared_code_filtering.md8.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in testing →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.