-
-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PMEM with SAVEID is broken at least in Chrome #850
Comments
Yes, thats the weird thing. Also map and other stuff is reseting. Im talking about random generated and saved by |
I have noticed similar behaviour on native Windows builds. To my knowledge, resetting the cart with reset() doesn't fix the bug, but resetting from the ESC menu does. And this has to be performed every time TIC-80 is opened. I'm suspecting the SAVEID doesn't get registered until a successful reset, and the default SAVEID is used instead. |
So I spent quite some time trying to figure this out today but sadly I ran out of time, so I'm gonna continue tomorrow. These are some things I found:
diff --git a/src/tic.c b/src/tic.c
index 41e48e2..6a10b59 100644
--- a/src/tic.c
+++ b/src/tic.c
@@ -1749,6 +1749,10 @@ static void updateSaveid(tic_mem* memory)
{
memset(memory->saveid, 0, sizeof memory->saveid);
const char* saveid = readMetatag(memory->cart.code.data, "saveid", tic_core_script_config(memory)->singleComment);
+
+ // saveid is only saved to memory after a reset from the menu
+ printf(saveid);
+
if(saveid)
{
strncpy(memory->saveid, saveid, TIC_SAVEID_SIZE-1);
diff --git a/src/menu.c b/src/menu.c
index 3b3c68e..c67cd9e 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -47,6 +47,8 @@ static void resetGame(Menu* menu)
tic_api_reset(tic);
+ // that's the only difference when reseting from the menu compared
+ // to reseting with the API
setStudioMode(TIC_RUN_MODE);
}
@@ -523,4 +525,4 @@ void initMenu(Menu* menu, tic_mem* tic, FileSystem* fs)
},
.mode = MAIN_MENU_MODE,
};
-}
\ No newline at end of file
+} |
Fixed here c9ac879. |
No description provided.
The text was updated successfully, but these errors were encountered: