Quantcast

Jump to content

» «
Photo

maintaining compatibility with existing saves

5 replies to this topic
cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#1

Posted 31 August 2013 - 03:46 PM

I've already asked this in one of my existing topics, but then I thought it'd be better if this had its own topic.
What is the reason that saves crash after the main.scm is modified?
Sometimes, when I download a savegame, I cannot load it because maybe my main.scm or his main.scm was modified.
What is the cause behind this?
Can we prevent it from happening?

ChopTheDog.
  • ChopTheDog.

    War. War never changes.

  • Members
  • Joined: 31 May 2010
  • None

#2

Posted 31 August 2013 - 05:08 PM

QUOTE (cst1992 @ Saturday, Aug 31 2013, 16:46)
I've already asked this in one of my existing topics, but then I thought it'd be better if this had its own topic.
What is the reason that saves crash after the main.scm is modified?
Sometimes, when I download a savegame, I cannot load it because maybe my main.scm or his main.scm was modified.
What is the cause behind this?
Can we prevent it from happening?

AFAIK, this happens because of the hard coded data that resides inside the exe file.

When a call for a Save or Load is made the exe checks for the default missions and since it cannot find them it crashes.

I was working on a fix for this but I thought reverse engineering the exe wouldn't be a good idea.

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#3

Posted 31 August 2013 - 06:26 PM

That would be directly considered hacking -- big NO NO.
Hmm. so it's impossible.

Just thought it'd be great to modify the main.scm, as it opens up many possibilities, but requiring a new game to work is too much to ask in most cases.

OrionSR
  • OrionSR

    Chain Game Development Team

  • Members
  • Joined: 23 May 2007
  • None

#4

Posted 31 August 2013 - 06:35 PM

The primary problem with save compatibility is the size of the main thread. If the size doesn't match then the pointers to active threads won't be correct and the game will either crash or start a new save. There are working v1 <=> v2 save converters that can successfully adjust the pointers. In my experience, any modification to active threads will cause a crash unless the data in the save is modified to match, even if the size of the thread is not changed. Within these limitations I've had a reasonable amount of success modifying missions and other threads that don't persist in the save file and maintaining save compatibility.

The main thread and other active threads can be disabled to allow the incompatible save to be loaded. Either change the global timer to a lower value (change the weather timer to match or the weather goes crazy), or increase the wake timer for modified active threads. This will allow you to deactivate any thread besides main and load your modified threads instead. Then reset the global and weather timers to their original values, or run a Traffic Glitch fix to reset all timers to 0.

As Used: Usually when I modify a mission or other inactive thread it's to insert text messages or other modifications that allow me to determine when certain sections of code have been executed, like when a vehicle receives it's immunities. Lowering the global timer has allowed me to kill mission threads that were saved using a save anywhere mod, and to determine that the blackboard was missing from the drydock while the import/export was active (it is rarely deleted by the driving or bike school missions).

goodidea82
  • goodidea82

    SA Modder

  • Members
  • Joined: 13 Jun 2013

#5

Posted 01 September 2013 - 09:47 AM

Also maybe helpful is the Savegame Editor so you can analze what is actually in the save games. Among others all the global variables are stored. I speculate, if the memory allocation of global vars changes, then it's a mess.

cst1992
  • cst1992

    Spam Hater

  • Members
  • Joined: 27 Dec 2012

#6

Posted 01 September 2013 - 10:06 AM

I have that one, and ryosuke's saveeditor is better than that one. The latter actually shows which global variables store what.
For eg. my game crashed in the 'life's a beach' mission, and I changed the global variable 455 from 0 to 1 to skip it.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users