I’d like to be able to generate a couple of dozen binaries of a game, each with some unique strings in. Many language compilers have a way to inject constants at compile time and refer to them in the program code, but I’ve been unable to find any reference to a way to do that in Inform 7. That being the case, my current plan is to write code to rewrite the source code of the game, compile, repeat.
I’m just wondering if there’s some easier option I haven’t thought of?
(It did occur to me to wonder if I could binary patch the compiled game file, but the text being compressed makes that non-trivial, and utility libraries for manipulating z8 and glulx files don’t seem to make it easy either.)
Patching the binary isn’t an attractive option, but patching the Inform 6 that’s the output of the Inform 7 compiler isn’t so bad.
An alternative could be to put all your customizations into an extension, something like…
Bespoke Text by Mathew Plover begins here.
Xyzzy is always "plugh".
Bespoke text ends here.
Put that in dir1/Extensions/Mathew Plover/Bespoke Text.i7x, located someplace that isn’t within your project’s .inform or .materials directories. Placing dir1 as a sibling directory alongside them might be convenient, if that’s so, you could then compile your code manually at the command-line with:
Then create dir2/Extensions/Mathew Plover/Bespoke Text.i7x with different values specified and repeat as necessary and automate the building with a makefile or something.