Tool for automating the Gen 4 Cute Charm setup for Pokemon Diamond and related NDS titles.
  • C# 98.2%
  • PowerShell 1.8%
Find a file
2026-05-20 12:00:00 +01:00
Glasshouse.App Initial 2026-05-18 12:00:00 +01:00
Glasshouse.Core Initial 2026-05-18 12:00:00 +01:00
Glasshouse.Tests Initial 2026-05-18 12:00:00 +01:00
scripts Initial 2026-05-18 12:00:00 +01:00
.gitignore Initial 2026-05-18 12:00:00 +01:00
Glasshouse.sln Initial 2026-05-18 12:00:00 +01:00
README.md Don't need this tbf 2026-05-20 12:00:00 +01:00

glasshouse

Tool for automating the Gen 4 Cute Charm setup for Pokemon Diamond and related NDS titles. It uses PKHeX for save parsing and legal Pokemon generation by default so that it is not flipping bytes blindly. It loads the save, builds a Cute Charm lead plan, generates legal party edits, writes the save back out, and then reloads the written file to prove the mutation persisted

Status

This is early tooling. It's built around save structures and the Cute Charm PID abuse case. It's not a general PKHeX replacement and it's not trying to become one. This was something I wrote while I was bored on a weekend.

Current support:

  • Gen IV .sav and .dsv loading through PKHeX.Core
  • TID/SID inspection
  • Cute Charm compatibility analysis
  • Full Cute Charm group planner
  • Game-aware encounter table selection for Diamond, Pearl, Platinum, HeartGold and SoulSilver
  • Legal Cute Charm lead generation
  • PKHeX legality report display for generated Pokemon
  • Party legality audit with Glasshouse-scoped repair
  • Party slot repair modes for trainer data, PID rerolls and encounter regeneration
  • Party slot display
  • Direct save patching with backup
  • Optional export mode for writing a separate patched copy
  • Post write reload verification
  • Zipped win-x64 release packaging

Cute Charm Glitch

In Gen IV the Cute Charm can force a wild Pokemon PID from a very small PID window when the lead Pokemon has Cute Charm and the wild encounter has a compatible gender ratio. Normally a shiny PID is rare because the shiny check depends on the trainer ID, secret ID, and PID halves:

TID xor SID xor PID_LOW xor PID_HIGH < 8

Cute Charm changes the practical search space. Instead of the game rolling across the full 32 bit PID space for every normal encounter path, the Cute Charm branch can force one of a small set of low PIDs. If the saves TID/SID line up with that forced PID set then a bunch of those forced PIDs pass the shiny check. So the odds can jump hard because the game is repeatedly landing inside a tiny PID region that was made shiny for that trainer pair

Glasshouse automates that setup and writes the trainer XOR relationship, checks the known Cute Charm PID groups and then recommends or writes the SID that makes the selected group work

The UI uses three terms consistently:

  • Cute Charm lead means the legal party slot 1 Pokemon with Cute Charm
  • Hunt target means the wild encounter species affected by the chosen group
  • Group means the Cute Charm PID/SID scenario

Planner and legality report

The Group planner tab enumerates every supported Cute Charm group. It shows the lead gender, forced target gender, target gender ratio, current shiny PID count, recommended SID and patched shiny PID count. It also lists wild species from the loaded save that match the relevant gender threshold, so you can see which encounter pool each group actually affects.

The Legality tab previews the generated Pokemon before automation and updates after a write. It shows PID, ability, gender, shiny state and the PKHeX legality messages returned by LegalityAnalysis. That means the UI exposes the generated entity audit trail instead of hiding it behind a success box.

Game awareness and party audit

Glasshouse reads the save version and maps it to a concrete encounter table before it scans wild slots. Diamond, Pearl, Platinum, HeartGold and SoulSilver are treated as separate encounter contexts. Aggregate save flags such as D/P or HG/SS are normalised to a deterministic fallback so planner output stays stable.

The Party audit tab runs a PKHeX legality pass over each party slot. It shows PID, ability, legality status and returned legality issues. Slots that look like Glasshouse-managed Cute Charm edits are marked as repair candidates. The repair button regenerates the selected Cute Charm lead and writes it through the same backup, save and reload verification path as normal automation.

The Legality tab also has party repair modes. Pick a slot, pick a mode, then apply. Modes include trainer-only repair, legal PID reroll, shiny PID reroll and encounter regeneration. The repair path matches the Pokemon to the save OT/TID/SID by default, and can preserve nickname and level where that still makes sense.

Build (from source)

dotnet build .\Glasshouse.sln

If dotnet is not on PATH then just use the installed SDK directly:

& "C:\Program Files\dotnet\dotnet.exe" build .\Glasshouse.sln

Run

dotnet run --project .\Glasshouse.App\Glasshouse.App.csproj

There is an optional direct apply integration test that copies a real save to a temporary folder, patches that copied path, reloads it, then asserts that party slot 1 really contains the requested Cute Charm lead

To enable it:

$env:GLASSHOUSE_TEST_SAVE_PATH = "D:\roms\nds\saves\Pokemon Diamond.sav"
dotnet run --project .\Glasshouse.Tests\Glasshouse.Tests.csproj

Notes

This project is for save research and personal automation. Keep backups of real saves and especially saves from flashcarts/emulator sync folders

Glasshouse does create a backup before direct writes but keeping your own known-good copy is still sensible.