Save modification plug-in

Yo. Just looking for a way, where-upon the game starts up, for a game to check if save files have, as an example, the following bit of verbage in it(Not verbatim, just the "characterCreations" bit):

Code:
  "characterCreations": {
    "_data": {
      "@c": 394,
      "@a": []
    },
    "_dataDd": {
      "@c": 395,
      "@a": []
    },
    "_dataSv": {
      "@c": 396,
      "@a": []
    },
    "_dataFace": {
      "@c": 397,
      "@a": []
    },
    "@c": 393,
    "@": "Game_CharacterCreations"
  },

And if it does not have that in it, to append that to the end so that saves from a version without the plug-in that has this bit of code(SRD's character creator ex) will be compatible.

I'd appreciate any advice on this.
To be clear, when I insert the bit above to the bottom of an old version save file using an external save editor, the save functions, but without that it does not. I've been looking through how other plug-ins do it and it's not immensely obvious to me. Like, for example, I think that the code that yanfly's save event plugin uses to add itself onto loaded save games is this:
Code:
Yanfly.SEL.Game_System_initialize = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
  Yanfly.SEL.Game_System_initialize.call(this);
  this.initSavedEventLocations();
};

Game_System.prototype.initSavedEventLocations = function() {
  this._savedEventLocations = {};
};

Game_System.prototype.savedEventLocations = function() {
  if (this._savedEventLocations === undefined) this.initSavedEventLocations();
  return this._savedEventLocations;
};

Game_System.prototype.isSavedEventLocation = function(mapId, eventId) {
  if (this._savedEventLocations === undefined) this.initSavedEventLocations();
  return this._savedEventLocations[[mapId, eventId]] !== undefined;
};

I thought it would be something to do with the datamanager but it does not appear that's the case.

So I tried making a plugin like this:

Code:
  (function() {
  var parameters = PluginManager.parameters('Save_Fix');
 
 
    function Game_CharacterCreations() {
    this.initialize.apply(this, arguments);
}

    
Game_CharacterCreations.prototype.initialize = function() {

if (this._characterCreations === undefined)
{
    this._data = [];
    this._dataDd = [];
    this._dataSv = [];
    this._dataFace = [];
}
};

Game_System.prototype.getCommonEventMenuSettings = function(key) {
    if (this._commonEventMenuSettings === undefined) {
      this.initCommonEventMenuSettings();
    }
    return this._commonEventMenuSettings[key];
};
    



 
  
  })();
But that didn't do anything whatsoever.

I'm wondering if I could use the DataManager.makeSaveContents function to do this seeing as its described as having the ability to alias save files. Like if I were to make a version of the game that doesn't have the plug-in that causes the problem, and then have a function, after load or during load, call DataManager.makeSaveContents to add in the required bit of text in the right place, and then have the user then move the save file to the next version it could work, too. But I wonder if that's even necessary. Not that I know the how of all that.
No - the other plugins don't do this at all, which is why we always tell people to start a new game after changing plugins.

The usual way to work is for Plugins to add code to the load and save functions without version checks.
This is why it usually results in "undefined" errors if you continue playing an old save after changing plugins.

And really? This should not be a problem at all, because this can only happen during development, not after the final product has been given to the player/customer. Because the player can't change the plugins.
And since you have to play your game a thousand times from the beginning for testing purposes, adding a Dogen times for plugin changes should not matter.

Original thread: https://forums.rpgmakerweb.com/threads/save-modification-plug-in.97220/