You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was going to extend it to allow controller input and state management. I've already figured out the controller stuff (I basically just create a ControllerInput object and write emulator.input = new ControllerInput()), but I don't know enough about NES architecture to know how to deal with state.
If I wanted the ability to save and load states or export and import a battery save, how would I go about doing that? What functions / files should I look into?
The text was updated successfully, but these errors were encountered:
Thanks, and awesome to see you working with it! The things you're looking for have been on my "I wanted to do this, but I never really got around to it" list. :)
Battery save shouldn't be too complex to implement. Every Cartridge instance has ramData field, which is a Uint8Array. I guess you can read and store this data (from nesnes.cartridge, where nesnes is a NesNes instance) while it's running. If you want to load it again it should be a case of setting the ramData of the cartridge right after booting (but before running).
Does this help you? Please let me know if I don't make any sense. :)
Regarding save and load state: this is a little bit more complicated. I think it would require serializing the state of all the main components, and the code is not built for this. Right now the system state is a little bit all over the place. One solution would be to add serializeState and deserializeState method to all components involved, but I'm not sure how much work this would be. I also don't know how other emulators handle this.
By the way, if you want to know what the main components exactly are, look at initCore() in https://github.com/koenkivits/nesnes/blob/master/index.js . This is the method that basically initializes the entire system and all of its components.
Awesome project!
I was going to extend it to allow controller input and state management. I've already figured out the controller stuff (I basically just create a
ControllerInput
object and writeemulator.input = new ControllerInput()
), but I don't know enough about NES architecture to know how to deal with state.If I wanted the ability to save and load states or export and import a battery save, how would I go about doing that? What functions / files should I look into?
The text was updated successfully, but these errors were encountered: