binji / binjgb

Gameboy emulator implemented in C, that also runs in the browser
https://binji.github.io/binjgb/
MIT License
534 stars 61 forks source link

Lost Save Files #23

Closed ChefFloyardee closed 4 years ago

ChefFloyardee commented 4 years ago

Hi there!

Let me begin by again THANKING you for helping me get this up and running on my site!

I did just run into one issue though. On Chromebooks the save file sometimes fails to load, which forces one to restart their game from the start.

Do you think you know why this is happening, and could you possibly add a patch that would allow one to save their save state as a .sav file that could be played on other emulators (or even sent to other computers)?

Thanks and let me know :D

binji commented 4 years ago

Yes, it's happening because I removed save support from the simple example I showed you. :-)

It shouldn't be too much work to add it back in, but I won't have time to do it for a little while. Basically all the stuff in demo.js called extRam* needs to be added back in, as well as reading/writing to indexeddb.

ChefFloyardee commented 4 years ago

Thank you so much for getting back to me!

My students are the main ones who play my ROM and use the emulator, and one of them lost their save file and was crushed since they put so much hard work into it! I was heartbroken as well, since it brought back memories from my Game Boy days when the cart batteries would die!

Any who, this is great to hear! Let me know when you get a chance to fix it so we can work to get my page's code back where it needs to be!

In the meantime I guess I will have to use this as a reason to teach them about perseverance in the face of adversity! (Either that or make them their own ROM files that give them their high-leveled Pokemon back!) :D

binji commented 4 years ago

I added saving to simple.js in this commit: b2ef17fff8c0fa7d5f60ef43a3f8fbf0751c3c9a.

It uses localStorage under the hood, and only uses one save file (not one-per game). But I think it should work for your use case.

ChefFloyardee commented 4 years ago

Thank you so much!

Can I just copy and paste this into my simple.js file, or should I delete mine, download yours, and then try re-uploading it?

binji commented 4 years ago

The changes are pretty small, you should be able to copy-paste them to your version.

ChefFloyardee commented 4 years ago

Thank you so much!

I will try this now and fingers-crossed for now more lost save files :D :D :D

binji commented 4 years ago

Happy to help!

cyberic99 commented 3 years ago

Hi binji.

would it be possible to add a button to upload a .sav file (while powered off) and to download the current .save file?

thanks!

ChefFloyardee commented 3 years ago

I would also like this so please let me know! :D

On 4/13/21, cyberic99 @.***> wrote:

Hi binji.

would it be possible to add a button to upload a .sav file (while powered off) and to download the current .save file?

thanks!

-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/binji/binjgb/issues/23#issuecomment-818817614

-- Mr. Chase Floyd - Science Teacher

Certified to Teach Grades 7-12 Earth & Space Science, Physics, General Science, and Technology Education.