How to import save state #44

Open
davidmurilloES opened this Issue Dec 29, 2016 · 13 comments

Comments

Projects
None yet
3 participants
@davidmurilloES

davidmurilloES commented Dec 29, 2016

Hi, when I try to import a saveState, I call to the function importSave which is in saves.js. I don't get any warning or error, but the emulator stills running the rom that was loaded at the beginning, it's like I never called the function importSave().

The data stored inside "saves" and "saveType" are correct data, got usgin the function exportSave()

image

May I have to edit the code, or nowadays stills under development this function?

@Onimishra

This comment has been minimized.

Show comment
Hide comment
@Onimishra

Onimishra Dec 30, 2016

Hep!
When you import at save game, it overwrites the current state within the virtual cartridge. This means that the game most likely has to load its savegame into memory again - at least that is what I've found when I've worked with it. Try to put in a restart of the emulator (simply Iodine.restart()) after your call to import save. In my case with pokemon as a test game, it makes then downloaded save game appear in the menu.

In Taisel's glue code (SavesGlueCode.js), you'll see that he never calls the import. Instead he overrides the saved data in the browsers storage, making Iodine load the new save game the next time it starts up.

Onimishra commented Dec 30, 2016

Hep!
When you import at save game, it overwrites the current state within the virtual cartridge. This means that the game most likely has to load its savegame into memory again - at least that is what I've found when I've worked with it. Try to put in a restart of the emulator (simply Iodine.restart()) after your call to import save. In my case with pokemon as a test game, it makes then downloaded save game appear in the menu.

In Taisel's glue code (SavesGlueCode.js), you'll see that he never calls the import. Instead he overrides the saved data in the browsers storage, making Iodine load the new save game the next time it starts up.

@davidmurilloES

This comment has been minimized.

Show comment
Hide comment
@davidmurilloES

davidmurilloES Jan 3, 2017

Thank you for your reply!

When I save a freeze state, I get a file which contains de whole rom file and my state, but the problem is that this file is too big. I want only save my state and load it into the canvas after the rom file is loaded. Is this possible? Because the state file is about 50-200KB and the freeze state is about 3MB up to 25MB

Thank you for your reply!

When I save a freeze state, I get a file which contains de whole rom file and my state, but the problem is that this file is too big. I want only save my state and load it into the canvas after the rom file is loaded. Is this possible? Because the state file is about 50-200KB and the freeze state is about 3MB up to 25MB

@Onimishra

This comment has been minimized.

Show comment
Hide comment
@Onimishra

Onimishra Jan 3, 2017

Iodine does not, to my knowledge, support save states, in the same sense as other emulators. "Save states" usually refers to a snapshot of a point in the game that you can restore, and which is unrelated to the game's own save game cycle.

The import and export in Iodine is for the game's own save cycle, not for save states. On the old physical cartridges, part of them was writeable, so the games could write their save games. When it is a digital file (a .rom file), it only contains the game code. The writeable part of the cartridge is what you in Iodine can import and export.

I too need save states (snapshots) for a feature on my own site, but lack knowledge on how to implement real save states in an emulator. I'd hope it is something that Taisel would look into in the future.

Onimishra commented Jan 3, 2017

Iodine does not, to my knowledge, support save states, in the same sense as other emulators. "Save states" usually refers to a snapshot of a point in the game that you can restore, and which is unrelated to the game's own save game cycle.

The import and export in Iodine is for the game's own save cycle, not for save states. On the old physical cartridges, part of them was writeable, so the games could write their save games. When it is a digital file (a .rom file), it only contains the game code. The writeable part of the cartridge is what you in Iodine can import and export.

I too need save states (snapshots) for a feature on my own site, but lack knowledge on how to implement real save states in an emulator. I'd hope it is something that Taisel would look into in the future.

@davidmurilloES

This comment has been minimized.

Show comment
Hide comment
@davidmurilloES

davidmurilloES Jan 3, 2017

Okay. Anyway, it's possible to save freeze state with Iodine? I got it on GBC emulator, by I want to use it on Iodine too.

Okay. Anyway, it's possible to save freeze state with Iodine? I got it on GBC emulator, by I want to use it on Iodine too.

@Onimishra

This comment has been minimized.

Show comment
Hide comment
@Onimishra

Onimishra Jan 3, 2017

As far as I know, no it is not possible to save freeze state in Iodine.
@taisel could chime in here, but I think it is something he would have to develop.

As far as I know, no it is not possible to save freeze state in Iodine.
@taisel could chime in here, but I think it is something he would have to develop.

@taisel

This comment has been minimized.

Show comment
Hide comment
@taisel

taisel Jan 4, 2017

Owner

Sorry for being gone so long (still am).

The emulator loads in saves when you start the game, and overwrites current saves when you pause/restart/close it. In order to load a save properly, you must load it in while the game is unloaded.

There are no save states yet, although it is technically possible to do. It was left out in case the object tree / properties of individual objects changed. It's support hell to support older revisions of save states.

Owner

taisel commented Jan 4, 2017

Sorry for being gone so long (still am).

The emulator loads in saves when you start the game, and overwrites current saves when you pause/restart/close it. In order to load a save properly, you must load it in while the game is unloaded.

There are no save states yet, although it is technically possible to do. It was left out in case the object tree / properties of individual objects changed. It's support hell to support older revisions of save states.

@taisel

This comment has been minimized.

Show comment
Hide comment
@taisel

taisel Jan 4, 2017

Owner

Additionally, you don't call the emulator to pass it saves, it calls callbacks to handle such (So some abstract database can return an arbitrary blob). You just need to make sure the save system is ready during the callback.

It was done in this asynchronous way, because of the multi-threading feature.

Owner

taisel commented Jan 4, 2017

Additionally, you don't call the emulator to pass it saves, it calls callbacks to handle such (So some abstract database can return an arbitrary blob). You just need to make sure the save system is ready during the callback.

It was done in this asynchronous way, because of the multi-threading feature.

@davidmurilloES

This comment has been minimized.

Show comment
Hide comment
@davidmurilloES

davidmurilloES Jan 4, 2017

I modified your code in order to save the states inside my server, you can continue your game wherever you are, but I need to save the states in any point of the game, not using the custom option "save" inside each game because there are some games in which you can't save.

I modified your code in order to save the states inside my server, you can continue your game wherever you are, but I need to save the states in any point of the game, not using the custom option "save" inside each game because there are some games in which you can't save.

@Onimishra

This comment has been minimized.

Show comment
Hide comment
@Onimishra

Onimishra Jan 4, 2017

Taisel, would you be willing to describe how to do it? I have no problem losing save state comparability between versions, as I currently have no intention of exposing it to my users. I just want my system to do it when you close the browser, so it can continue at the exact spot when you start it the next time.

Taisel, would you be willing to describe how to do it? I have no problem losing save state comparability between versions, as I currently have no intention of exposing it to my users. I just want my system to do it when you close the browser, so it can continue at the exact spot when you start it the next time.

@taisel

This comment has been minimized.

Show comment
Hide comment
@taisel

taisel Jan 4, 2017

Owner

Well, it requires object serialization, but the issue right now is the infrastructure for serializing/de-serializing the multi-threaded graphics in particular.

Most people don't notice that we have multi-threading, as we have a single threaded runtime too, which not-nightly/canary versions use.

Owner

taisel commented Jan 4, 2017

Well, it requires object serialization, but the issue right now is the infrastructure for serializing/de-serializing the multi-threaded graphics in particular.

Most people don't notice that we have multi-threading, as we have a single threaded runtime too, which not-nightly/canary versions use.

@davidmurilloES

This comment has been minimized.

Show comment
Hide comment
@davidmurilloES

davidmurilloES Jan 5, 2017

@taisel is hard program the function that saves a freeze state in Iodine?

@taisel is hard program the function that saves a freeze state in Iodine?

@Onimishra

This comment has been minimized.

Show comment
Hide comment
@Onimishra

Onimishra Jan 5, 2017

I can see how that poses a challenge... too bad, would have made the user experience a lot better at my site ;) thought I remembered an open issue about iOS running the single threaded runtime, but now I can't find it, so it might have been in the "fixed" section. Either way, I take it that when you create a solution you'd want it to work on both single and multithreaded versions.

I can see how that poses a challenge... too bad, would have made the user experience a lot better at my site ;) thought I remembered an open issue about iOS running the single threaded runtime, but now I can't find it, so it might have been in the "fixed" section. Either way, I take it that when you create a solution you'd want it to work on both single and multithreaded versions.

@Onimishra Onimishra referenced this issue Jan 5, 2017

Closed

Save State #43

@davidmurilloES

This comment has been minimized.

Show comment
Hide comment
@davidmurilloES

davidmurilloES Jan 5, 2017

I need to save a freeze state in Iodine :(

I need to save a freeze state in Iodine :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment