Regarding extra_info when saving files

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
zorexx
Newbie
Posts: 23
Joined: Thu Jun 23, 2011 7:15 am
Contact:

Regarding extra_info when saving files

#1 Post by zorexx »

I found that the extra_info feature when saving files is kinda broken.
When using scan_saved_game, the extra_info returned is always an empty string.
After a bit of poking here and there, I found the cause:
In "renpy/loadsave.py", line 282:

Code: Select all

json = { "_save_name" : extra_info }
should be

Code: Select all

json = { "_extra_info" : extra_info }
instead.
After applying this fix, it works again.

Also, why is the extra_info stored in 2 different files in the save file? (json and extra_info)

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Regarding extra_info when saving files

#2 Post by PyTom »

I think that's the wrong fix. Instead, you want to change line 398 to use _save_name, as was done in:

https://github.com/renpy/renpy/commit/d ... 08c06dfe0a

The information is stored in two places so that loading a new file in an old version of Ren'Py isn't guaranteed to fail, although that case isn't actually supported. At the very least, scanning the new save files with an older Ren'Py isn't going to break things.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

zorexx
Newbie
Posts: 23
Joined: Thu Jun 23, 2011 7:15 am
Contact:

Re: Regarding extra_info when saving files

#3 Post by zorexx »

I see, thanks.
But why use save_name instead of extra_info?

PS: I assume the same thing has to be done to line 446 as well? (list_saved_games)

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Regarding extra_info when saving files

#4 Post by PyTom »

In Ren'Py, extra_info almost always originates from save_name. While it's possible to change that, doing so doesn't make a lot of sense in 6.16 - it's far better to to add a new function to save_json_callbacks, and have it add your data in a more structured way.

Also, the data is often accessed through the FileSaveName function - which is preferred in screens-based code.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

zorexx
Newbie
Posts: 23
Joined: Thu Jun 23, 2011 7:15 am
Contact:

Re: Regarding extra_info when saving files

#5 Post by zorexx »

Ok, I get it now, thanks for the explanation. :)

Post Reply

Who is online

Users browsing this forum: No registered users