I think I figured out the best method: a hybrid of both recording real time presses, and parsing the FM2 when necessary. I have coded this, and it seems to work nicely. I have created a
page regarding this kind of TASing, and the page includes a link to the script. Could anyone report back letting me know how it works for them? Perhaps this will spawn some WIPs? :)
Edit: I've made this a little more efficient...now, instead of reparsing on every state load, it parses the file once in its entirety, caches the data, and references the frame you are loading to. You can find the updated script where the old one was. The problem is, it seems that without writing to the save states, this will seemingly not work with rerecording.
adelikat recommends I try to patch FCEUX. I'm not sure why I'd do that if there's any possibility of just including it in the main code (It does sound like a useful feature), but nonetheless, here'd be the game plan if I was able to do this:
- When playing in real-time, count normally.
- Upon saving, log the data to the save state. Load this data upon loading.
- If a save state is loaded without this data, and it is part of a movie, parse the FM2 for the data and log it. If it is not part of a movie, reset everything.
Until I'm given more information on this, I can't really continue on with this...which means I have time to do other things! Woo! <_<
Edit 2: It seems like I'm really thinking about this too hard. After all, considering we already have a tool that calculates button presses, we really just need one that tracks them in real time and that allows rerecording. So, here's the new plan:
- When the script is run, if a movie is loaded in read only mode, calculate the initial data. If not, begin everything at 0.
- When you save a savestate to a slot, record the data at that point.
- When you load a state saved while running, load back the data.
This should be enough to conveniently make a minimal input TAS. There's no reason to over think this.
Edit 3:
Done. It even works on Snes9x, though it only loads initial data if a fm2 file is loaded. I'm sure there's a way to support other emulators, but I'll leave that up to the people who care enough to modify the code for that feature. :)
Edit 4:
Expanded the page and proposed a scoring system. I will construct a very sloppy MPTAS of SMB as a proof of concept, and afterwards, I might try to obsolete myself. It'd be really cool if someone continued mugg's work on the MHTAS end.