Advertisement
Maliki79

Mal_NewSaveSelectionFix

Mar 13th, 2025 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //This plugin sets the topmost open save slot when starting a new save in a game.
  2. //Put this plugin at the very top of your plugin manager to minimize compatibility issues.
  3. //ver 1.0b
  4. DataManager.selectSavefileForNewGame = function() {
  5.     var globalInfo = this.loadGlobalInfo();
  6.     var earlySelect = -1;
  7.     this._lastAccessedId = 1;
  8.     if (globalInfo) {
  9.         for (var i = 1; i < globalInfo.length; i++) {
  10.                 if(!this.isThisGameFile(i)){
  11.                     this._lastAccessedId = i;
  12.                      earlySelect = this._lastAccessedId;
  13.                     break;
  14.                 }
  15.         };
  16.         if (earlySelect == -1) {
  17.         var numSavefiles = Math.max(0, globalInfo.length - 1);
  18.         if (numSavefiles < this.maxSavefiles()) {
  19.             this._lastAccessedId = numSavefiles + 1;
  20.         } else {
  21.             var timestamp = Number.MAX_VALUE;
  22.             for (var i = 1; i < globalInfo.length; i++) {
  23.                 if (!globalInfo[i]) {
  24.                     this._lastAccessedId = i;
  25.                     break;
  26.                 }
  27.                 if (globalInfo[i].timestamp < timestamp) {
  28.                     timestamp = globalInfo[i].timestamp;
  29.                     this._lastAccessedId = i;
  30.                 }
  31.             }
  32.         }
  33.         }
  34.     }
  35. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement