This is a library which handles managing FreeRAM addresses for you. It is quite flexible, supporting both SA-1 and LoROM, and is compatible with most tools with only a few lines of code changed (this is mostly due to needing to pass extra info on to Asar, which I really couldn't avoid). It allows you to share FreeRAM values between different types of resources too (e.g. blocks and UberASM).
Currently, it's integrated with Asar, so any tool that uses Asar underneath should be able to use this.
Usage for regular users: First, download the modified version of asar which is compatible with this. (exe, dll - rename the dll to just asar.dll to get tools to recognize it though!). Then download the library freeram.dll and keep it around next to asar (both asar.dll and asar.exe). Then, download the SMW base ram description and rename it to <your_rom_name>.ramdesc. After this, you're good to go, just insert some resources that utilize this freeram library (that means you're currently limited to patches only, and no existing patches have been converted to use it yet, soo... just wait a bit). You'll know if you did something wrong because you'll get errors. (Linux users: clone the Asar repository and checkout the freeram branch. Then build like you normally build asar. For the freeram library, clone its repository and build it with CMake.)
Usage for patch/ASM developers: The version of asar included here has a single new function simply called "freeram". It takes 3 arguments: identifier, size and flags. Identifier can be any valid C-style identifier (start with alphabetical or underscore, continue with alphanumeric or underscore) and is used to uniquely identify this freeram (this is what allows you to share freeram between e.g. sprites and blocks). Size should be obvious, it's how many bytes of free RAM you're requesting. Flags is a bit more complicated: it's a comma-separated list of flags which allows you to place certain restrictions on the type of RAM you get assigned. Each region of unused RAM in SMW is assigned a set of flags. These include things like when is the RAM cleared (on level load, on reset, on overworld load, etc), what region of memory is it in (whether it's direct page, <$1FFF, or a long address), and what enhancement chips this address is available on. If, when requesting RAM, you prefix a flag with -, you are explicitly requesting RAM that doesn't have that flag set. Another thing to note is that some addresses have flags prefixed with @. This means you'll never be assigned a freeram with those flags unless you explicitly request them. This is useful for things like SA1-only addresses.
Usage for tool developers that wish to use this outside of asar: The github readme provides documentation of the C API.
This is not quite finished yet: The base ramdesc file still needs filling in. Currently, it's missing all SA-1 exclusive addresses, and it's missing claims for tools that use hardcoded memory locations (e.g. Lunar Magic, most Sprite Tools). The ramdesc format is also documented on github.
In the next few days, I'll port most common tools to add support for this, and then (if this thing becomes accepted enough), I'll convert existing resources using freeram to use this library too.
Posting posts around at the speed of sound. Got places to go, gotta follow my rainbow!Remember to wash your hands and stay safe! “Even if you personally are so dissatisfied with life that you want the world to end, surely the cruel reality is that it will continue on, unchanging. All the better for someone perfectly content, like me.” – Aya Shameimaru, Touhou Suzunaan ~ Forbidden Scrollery