1# Chapter 16: third-party, other people's code, kept honest 2 3Three big pieces of this project were written by somebody else: the SNES 4emulator (jgenesis, Rust), the bot (zbanks/alttp, C), and the code that 5talks to Jev (jevcrates, Rust, shared with three sibling projects). Plus the 6few hundred ordinary crates any Rust program pulls in. They all live under 7here, one folder per language. 8 9The rule for all of it is the same: **upstream's code is upstream's code.** 10It is never edited to taste. When this project needs it to behave 11differently, the change is either made from outside (a host, a compiler 12flag, a wrapper), or it is a *carried patch*: a change recorded on its own, 13named for what it does, so that it can be found, re-applied after pulling a 14new upstream, and dropped the day upstream fixes the same thing. 15 16| Code | How it arrives | Changes we carry | 17| --- | --- | --- | 18| zbanks/alttp | Vendored with `git read-tree`, byte for byte | Nineteen patch files, applied at build time (chapter 18). | 19| jgenesis | A git subtree | Two commits: `wram()` and `wram_mut()` on `snes-core` (chapter 19). | 20| jevcrates | A git submodule | None; it is changed in its own repository. | 21| crates.io | Downloaded at build time, pinned by `Cargo.lock` | None; `fixups/` answers what reindeer cannot infer (chapter 20). | 22 23> **Aside: why no chapters for the vendored trees?** Their documentation is 24> upstream's, and it is upstream's text that should be there. A README of 25> ours inside `zbanks-alttp/` or `jgenesis/` would be deleted by the next 26> refresh, which replaces the folder wholesale, and anything we wrote inside 27> it would silently stop being true the day upstream changed. So the 28> chapters are one level up, describing the trees from outside: chapter 17 29> for the bot, chapter 19 for jgenesis and jevcrates. jevcrates carries a 30> guide of its own. 31 32> **Try it.** See every change carried on the bot: 33> `ls third-party/c/patches/`. See the two on the emulator: 34> `git log --oneline -- third-party/rust/jgenesis`. 35 36## For the people who maintain it 37 38### In this folder 39 40| Path | Chapter | What | 41| --- | --- | --- | 42| [c/](c/) | 17 | The zbanks/alttp C bot, vendored, its carried patches (chapter 18), and its `cxx_library`. | 43| [rust/](rust/) | 19 | The cargo manifest reindeer reads, the buck targets it generates, the reindeer fixups (chapter 20), the empty crate root (chapter 21), the vendored jgenesis emulator and the jevcrates submodule. | 44| [README.md](README.md) | | This chapter. | 45| [CLAUDE.md](CLAUDE.md) | | The carried-patch rule, for agents. | 46 47← Previous: [Chapter 15, hotdemo/](../apps/hotdemo/) · Up: [jevsnes](../) · Next: [Chapter 17, c/](c/) →