So my Python is a little rusty, but after an hour or so of fiddling with it I was able to write a functional program that changes a block of code in ROM. Here’s my program that rewrites the treasure chest array to remove items and cutscene animations from all chests. (I changed the file extensions of the ROM to .bin instead of .sfc for ease of reading in the bytes, this process works identically well if I switch the extensions back to .sfc.)



What’s going on here is this: The treasure chest code is broken up into 4-byte sections. The bytes indicate, respectively, the chest’s X location and Y location on the map, the chest’s contents (item code), and a byte that combines the chest number with the chest animation (0x80=play fanfare, 0x00=no fanfare). A 0xFF byte denotes the end of a map, so if a map has several chests you’ll see a few 4-byte groups show up before another 0xFF.
So, by changing every third byte to 0x00, and making sure that no fourth byte is >0x80, this “empties” every chest in the game and removes all fanfares. Later, the randomizer would go back in and fill in the third bytes with shuffled item codes.
Since this text-replacement mechanic is the bread and butter of the randomizer’s functionality, it was nice to so quickly be able to write functional code to perform this, without too many lines. If anyone has any ideas on how I can make this program even more efficient, let me know — I’ll be using this same method over and over in the finished randomizer.
