Loadstate and Savestate weirdness

Monkey Forums/Monkey Programming/Loadstate and Savestate weirdness

John McCubbin(Posted 2013) [#1]
This just occured to me today (because I was building a game for desktop with the XNA target) that if you move your game to another folder, or rename the .exe the location of your savestate in "...AppData\Local\IsolatedStorage" changes, is that just how XNA does it or is that an inherent problem with LoadState and SaveState?


muddy_shoes(Posted 2013) [#2]
Mojo uses this call to get the IsolatedStorageFile on Windows:

IsolatedStorageFile file=IsolatedStorageFile.GetUserStoreForAssembly();


For an unsigned assembly this probably uses the URL as part of the assembly identification so if you move the executable (or swap from debug to release or vice versa) you may well end up with a different IsolatedStorageFile.

MSDN suggests using this call for Windows:

IsolatedStorageFile savegameStorage = IsolatedStorageFile.GetUserStoreForDomain();


But whether that would resolve the folder issue I have no idea.


John McCubbin(Posted 2013) [#3]
Thanks for the info muddy_shoes, I went ahead and changed the code in xnagame.cs to use GetUserStoreForDomain rather than GetUserStoreForAssembly but the same problem still persists, after reading this post from someone else it appears that the location and name of the storage file is not something the programmer can change, so thats kind of a pain, but if thats now its meant to work then you can't really argue, just a pity we cant save somewhere like my documents.

http://go4answers.webhost4life.com/Example/isolated-storage-problem-49301.aspx