Commit Graph
11 Commits
Author SHA1 Message Date
Walter Agazzi 815041ec6a AGS: Engine: store game's ccInstances as unique_ptrs instead
The script handling part of the engine appeared to be too fragile and dependent on
 a precise timing of **deleting** a ccInstance.
For example, restoring a saved game may execute in the midst of the call to
RunScriptFunction(), at the "post script cleanup" stage, while there are still references
to ccInstance on the engine's call stack (and few other places). If anything prevents
 ccInstance's disposal at this moment, that would in turn lead to logical errors due to
  the game scripts "instances" counting. The most outstanding consequence is that the
   script exports are kept pointing into the deleted memory and not re-registered after the save is restored.

Overall, the script handling part of the engine would benefit from a major refactor,
 with a goal to make it safe and consistent, but this is not something I might do at the moment.

From upstream 1f6abf4b678f77825c710d4ae18b57ff8f882c93
2024-10-30 18:07:42 +02:00
Walter Agazzi 09ffee9ed7 AGS: Engine: store ccInstances in shared_ptr, tidy freeing of instances (take two)
After the updates to cc_instance this should now work

From upstream b1e4f75141ce88b3146f55ecd9d7a95378428072
and 49e8aa0b566dea4ce025f9530a9f2392dbe67a33
2024-10-30 18:07:42 +02:00
Walter Agazzi 8153a59121 Revert "AGS: Engine: store ccInstances in shared_ptr, tidy freeing of instances"
This reverts commit 016323f1f9797827a36a77ae3a5859b56d3b0998.
2024-10-30 18:07:42 +02:00
Walter Agazzi 253187f4e2 Revert "AGS: Engine: store game's ccInstances as unique_ptrs instead"
This reverts commit 547cd40186876f17914f6a96261aaf5c4dfc21b4.
2024-10-30 18:07:42 +02:00
Walter Agazzi b1e7617964 AGS: Engine: store game's ccInstances as unique_ptrs instead
From upstream 1f6abf4b678f77825c710d4ae18b57ff8f882c93
2024-10-30 18:07:42 +02:00
Walter Agazzi 4019f9305b AGS: Engine: store ccInstances in shared_ptr, tidy freeing of instances
From upstream b1e4f75141ce88b3146f55ecd9d7a95378428072
and 49e8aa0b566dea4ce025f9530a9f2392dbe67a33
2024-10-30 18:07:42 +02:00
Thierry Crozat e90fb00412 AGS: Replaced more strcpy with snprintf, for safety
From upstream 1b6cf053ebbe85e7ba6c5828e2582d757503bc16
2022-06-19 20:50:24 +01:00
Paul Gilbert 2e24e08d5b AGS: Brought few "run script" functions to similar arg list
From upstream 78163a07400353013dd939ca86f5513f3196394a
2022-04-18 19:10:39 -07:00
Eugene Sandulenko abea37c9bb ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
antoniou79 d474ee3003 AGS: Change a few char variables to int8
In order to specify that they should be treated as signed

Some ports may treat an (unspecified) "char" as unsigned by default. Android does this for its ARM architectures and while we did fix this by enforcing -fsigned-char to its compiler, the issue may come up for other ports. Also it should be better to clarify in the engine when a variable is not actually storing string characters.

I've spotted and changed the most "safe" cases I could find for this. As far as I can tell, out of these, only the Outline field and fontoutline array could potentially be assigned valid negative values which would cause bugs for ports treating chars as unsigned.
2021-09-09 19:27:49 -07:00
Paul Gilbert 701396361c AGS: Import of fresh codebase 2021-06-13 21:08:44 -07:00