How are savefiles & playtimes checked?

When recording gameplay & for other reasons, I move savefiles around a lot.

I have noticed that some saves are simply not "recognized" by the game, and other savefiles have completely incorrect playtimes.

It makes me wonder: how is all this calculated? Something about a globalInfo variable?

In XP, the playtime was stored within the save itself, but it seems here that some kind of "save index" is created whenever you save, and the playtimes are stored in that?

For example,

  • The game has playtime 24 mins.
  • I save to file2.rpgsave
  • I overwrite file2 with a savefile of 12 mins.
  • It will still show "24 mins" in the Load/Save window.
Another example,

  • I save to file2.rpgsave.
  • I copy & rename to create file3.rpgsave.
  • File3 save is not recognized by the game, even though it should be a completely valid save.
Aside from your "normal" save files, MV has 2 additional ones:

- config.rpgsave, to store your options (from the option menu, those are managed in ConfigManager).

- global.rpgsave, to store save file infos.

Since games are running in a browser, you can't just simply browse all files in a certain folder, like we did in Ace, but need to know what you are looking for. This is where "global.rpgsave" comes into play. When a game is saved, this function is called:

DataManager.saveGameWithoutRescue = function(savefileId) {    var json = JsonEx.stringify(this.makeSaveContents());    if (json.length >= 200000) {        console.warn('Save data too big!');    }    StorageManager.save(savefileId, json);    this._lastAccessedId = savefileId;    var globalInfo = this.loadGlobalInfo() || [];    globalInfo[savefileId] = this.makeSavefileInfo();    this.saveGlobalInfo(globalInfo);    return true;};The variable "globalinfo" is used to store information about the available savefiles, which are used to create the entries of the load/save menus. It contains an array with an entry for each savefile, which are created here:

DataManager.makeSavefileInfo = function() {    var info = {};    info.globalId   = this._globalId;    info.title      = $dataSystem.gameTitle;    info.characters = $gameParty.charactersForSavefile();    info.faces      = $gameParty.facesForSavefile();    info.playtime   = $gameSystem.playtimeText();    info.timestamp  = Date.now();    return info;};So, when you are opening the loading menu, MV will check, which indizes in the array are filled with data and display the information for them. If you rename save #1 to #5 (for example), it will still display save #1 in the menu.

Original thread: https://forums.rpgmakerweb.com/threads/how-are-savefiles-playtimes-checked.52148/