nbarkhina / N64Wasm

A web based N64 Emulator
https://www.neilb.net/n64wasm/
MIT License
622 stars 132 forks source link

Sram dump to indexdb #3

Closed thelamer closed 2 years ago

thelamer commented 2 years ago

Outside of just save states would it be possible to implement "cmd_savefiles" as a callable function to dump sram like you have with Retroarch Emscripten builds?

nbarkhina commented 2 years ago

Currently you can already export the sram by turning on advanced mode in settings.js. That will reveal a dropdown during play where you can export the save file:

response

Saving it to indexedb is possible as well but would require either periodically auto saving it or detecting when there is a change to the save and then doing the save then.

thelamer commented 2 years ago

Ahh I see neil_export_sra. Before I go and fork is it possible to integrate logic to pass a game name to keep SRAM isolated per rom? Should probably be done on load and module start honestly not be function specific.

nbarkhina commented 2 years ago

Yeah the JavaScript code stores the filename as "this.rom_name" in script.js. Though it's not necessary, you could also pass the rom name to the Module if you need. The best place I think you could do it is in script.js in WriteConfigFile(). That is a function that is used to pass a bunch of parameters to the Module on load. The C++ code then reads out the config file in mymain.cpp in "readConfig()". Hope that helps.