It has a lot of possible uses, but the first one I want to use it for is hot loading of scripts.
I have a script language that compiles down to a binary file. I will use the debugger command to load a file at an absolute address.
I compile in a system-unfriendly way so I use absolute addresses. Therefore I compile with a buffer of empty space at a known address. Every frame I just check if a script has reloaded (just check on a magic value), and will copy it over to its “real” address in memory if it found a script.
I use a spare buffer instead of loading straight into the final destination because the debugger command can happen at any time during the frame. I don’t want to risk it reloading while it is processing the script, as that can be a source of many hard-to-reproduce bugs
|