asar icon indicating copy to clipboard operation
asar copied to clipboard

Add a new version of the freespace command which doens't need autoclean or prot

Open RPGHacker opened this issue 7 years ago • 0 comments
trafficstars

Add a new version of the freespace command which takes an arbitrary identifier and doesn't need an autoclean or prot to prevent freespace leaks.

Example:

org $00xxxx
    jsl NewCode

    ; ...

freespace "MyPatch"
    NewCode:
    ; ...

The returned freespace in this case would write a RATS tag, followed immediately by its identifier (in this case "MyPatch") as a 0-terminated ASCII string. Upon applying a patch twice and encountering such a freespace command, Asar could simply search the ROM for all RATS tags that are followed by that exact identifier and clean those areas.

Alternative idea: I'm not sure if having a freespace command automatically clean stuff is desirable. As an alternative, we could add a new autoclean command which takes an identifier and does exactly what I've just described. In any case this makes prot unncessary and (presumeably) makes autoclean more reliable and less complicated.

RPGHacker avatar Mar 08 '18 00:03 RPGHacker