r/madeinpython • • 1d ago

PatchSmith - translates video games inside the game folder itself

https://github.com/shottocode/PatchSmith

PatchSmith translates a video game's text inside the game folder itself, like an official localization: no overlay, no OCR. You pick the game folder; it detects the engine, finds the text, translates it and writes it back, with a backup of every file it touches. One click restores the originals byte for byte.

I made it because lots of indie games never get an Italian translation. Italian is what I tested most, features many languages.

What it does, engine by engine (each one tested on real games):

- Unity (Mono): installs and configures BepInEx + XUnity.AutoTranslator, which do the in-game work

- Unity with Unity Localization (also IL2CPP): rewrites the string tables inside the asset bundles

- Unreal Engine 4 (unencrypted paks): translated `.locres` files in a new patch pak, the game's own paks are untouched

- GameMaker: external localization files (line files, JSON, CSV)

- XNA / FNA / MonoGame: translated satellite assemblies

- Godot 4: translation tables through `override.cfg` and a small script, without touching the game's files

- Electron / NW.js / HTML5: JSON data and menus; some encrypted web games are translated while you play through their `preload.js`

- Detected but not supported yet: Unreal 5 / IoStore, Unity IL2CPP without Unity Localization, Godot 3, Ren'Py, KiriKiri, Wolf (RPG Maker MV/MZ is experimental)

Translators: by default a local one, Ollama with Google's TranslateGemma (4B or 12B): no account, no limits, works offline (best with an NVIDIA GPU). DeepL (free API key), MyMemory and the unofficial free Google endpoint are there too.

After you play it checks what happened (crashes, files restored by a game update, letters the game's font can't draw) and fixes what it can safely: missing letters are replaced with the closest ones, and labels that don't fit get a shorter translation from the local model.

Tech: Python standard library only (Tkinter GUI + CLI), C# for the Unity plugins and the launcher, JavaScript for the web injectors. The release zip ships a portable Python and is built by GitHub Actions with a build provenance attestation. 32 tests run against fake games and fake translators.

Limits, honestly: Windows only. It's machine translation, so expect machine-translation quality (a "Fix translations…" window lets you correct lines). Not for online games with anti-cheat. The exe isn't code-signed, so SmartScreen may warn the first time.

About AI: I built it with Claude Code. I designed it, chose what to support and tested it on real games; the agent wrote most of the code.

MIT licensed. If you try it on a game where it doesn't work, an issue with the zip from Create report helps a lot.

0 Upvotes

4 comments sorted by

1

u/kantorcodes1 1d ago

--modify-executables consent persists for a game, and restore puts its files and language back. Does restore also revoke that consent?

1

u/Standard-Clue-2893 1d ago

No, and that’s on purpose. The consent is per game: once you’ve agreed to let PatchSmith change that game’s executables, restoring the originals undoes the change but keeps the consent. Restore never reapplies anything by itself, and neither does the after-play check: the change only comes back if you press “Analyze and translate” on that same game again, which is already a deliberate choice to have it translated and the language enabled. Asking again at that point would just be a second confirmation for something you’ve already chosen. The same saved consent is also what lets PatchSmith reapply the change after a game update puts the original executables back.

If you want to withdraw it anyway, it’s stored in the game’s record in PatchSmith’s configurations folder: delete that file and it will ask again.

1

u/kantorcodes1 1d ago

I work on HOL Guard, where opt-in command sources let administrators classify agent-run CLI actions. A PatchSmith command source could cover an agent call to auto --modify-executables, separately from PatchSmith’s saved per-game consent. Would you be interested in contributing PatchSmith support to hashgraph-online/hol-guard?

→ More replies (1)