whscullin / apple2js

An Apple II emulator originally written in Javascript, now being converted to TypeScript
http://www.scullinsteel.com/apple2/
MIT License
438 stars 57 forks source link

State saving and recovery is not good when using a smart drive #156

Open dungeonkim opened 2 years ago

dungeonkim commented 2 years ago

If I save the state while using the Smart drive, it cannot return to the original state when the state is loaded. Is there any way to fix or work around something?

iflan commented 2 years ago

Can you give a particular example? Is this about the state of the drive or about the state of the whole VM?

dungeonkim commented 2 years ago

Below is the game I am making. https://www.dungeon.kim/a2rogue/ If you save the state with F6, move around a bit, and then load the state, it doesn't go back to the original state. I haven't written any files, I'm only reading from the .hdv.

whscullin commented 2 years ago

I hadn't implemented saving state for the smart drives because the naive approach of just storing the whole images that is use for floppies doesn't work with the larger disk images, because of browser local storage limitations. But I had been contemplating storing block deltas, and that would work as long as the hdv that gets loaded doesn't change. There are also possibly ways to store more data other than using local storage.

The game you are working on looks great, so I hope we come up a solution that works for you.

dungeonkim commented 2 years ago

Storing the delta seems like a very good idea. Thank you very much. Your work helps me a lot. May you always be happy.