This class manages a buffer where all data usually stored in detection
plugin will get copied before unloading the plugin and starting the
game.
This class expects that two functions are present in every
GameDescription: sizeBuffer which calculates how many bytes we will need
to store the entry in RAM and toBuffer which copies the data in the
buffer and fix the pointers in the class.
At the end, it is expected that an ADDynamicGameDescription doesn't
depend anymore on data stored in the detection plugin.
The AD_GAME_DESCRIPTION_HELPERS macro allow to implement these functions
in all GameDescription which don't have any pointer except those in
ADGameDescription.
In some cases the engine may access unallocate space or do a double free_mem on an "machine" object
This can happen when a script "machine"'s step triggers a callback that can result to killing the machine itself (via terminateMachineAndNull()) and free its allocated space via a different pointer, but the code in the machine's step continues to try and access the machine's now unallocated space with its original pointer.
This can be observed by running valgrind with scummvm on Linux. Otherwise crashes may occur in Linux and mingw-w64 release mode builds.
An example case is when Wilbur runs on the hamster wheel on the bottom level of the gerbil case (room602).
The proposed solution here is a workaround, based on valgrind's output, and probably does a poor job of cleaning "machine" memory that's no longer used.
More knowledge on the engine's workings is required for a proper and more efficient fix.
The workaround skips full deallocation of a machine object (in the shutdownMachine()), until the ws_KillMachines() is called. The machID field value of 0xdeaddead is used to skip the machine (which remains in the chain). A more efficient fix could do a full deallocation of a machine object earlier (and remove it from the chain like the previous code did), thus avoiding cluttering of the machine's chain.
When gerbils are asleep Wilbur should be able to use the chute in the top right of the middle floor to go up or down
Also the chute in the middle of floor of the middle floor should lead to Wilbur fallin from the ceiling of the bottom cage floor.
After the cage door opens with the alien hand controlled motor, revisiting the room 602 would show the door misaligned to the left.
Revisiting as in leave the room from the chute (go up one floor) and then return to the bottom floor.
If the wheel motor is running with the alien hand, then revisiting the 602 room should also show the magnet vibating
This could be an "original" bug / missed detail, since the magnet is not vibrating in this case in the demo.
This would crash in the demo and also had some repeating animation issues
The fix includes:
- skipping Wilbur's quote which is missing in the demo (using a new play series "PLAY10Demo").
I can only test in demo, but I'm assuming the spoken quote exists in the full version.
- fix repeating the animation of throwing the kibble (this seems to have been a typing / copy-paste error)
- Removing the kibble from Wilbur's inventory after he throws it (this is an "original" bug since it's not removed in the demo).
- Waking up the Gerbils, after Wilbur throws the kibble at the wood shavings (this is the behavior in the demo).