Commit Graph
84 Commits
Author SHA1 Message Date
D G Turner bc6d5c1cf6 M4: Fix Unused Variable GCC Compiler Warning 2024-05-26 18:38:58 +01:00
Paul Gilbert 42bdadaed6 M4: Endian fix for script interpreter. Demo now gets in-game on BE systems 2024-05-25 19:50:03 -07:00
Paul Gilbert 38cd2e1cc6 M4: Endian fix for cutscene palettes 2024-05-25 16:44:24 -07:00
Paul Gilbert 32f3bfea6c M4: More endian fixes 2024-05-25 12:17:39 -07:00
Paul Gilbert 2a5ffabb74 M4: Further endian fixes 2024-05-24 20:31:48 -07:00
Paul Gilbert fa5bb0d589 M4: Further endian fixes 2024-05-23 21:59:04 -07:00
Paul Gilbert 2225f85548 M4: Fix endian issue in sprite loading 2024-05-23 20:54:05 -07:00
Paul Gilbert 9cf11cab19 M4: Fix endian issue in wscript cruncher 2024-05-23 20:38:06 -07:00
Paul Gilbert 41d87f2178 M4: Cleanup of dead machine code, deleting of dead machines between scenes 2024-02-24 12:05:22 -08:00
antoniou79 a6929c4882 M4: Attempt to workaround double free() issue
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.
2024-02-24 12:05:22 -08:00
Paul Gilbert 7a20b43501 M4: Further endian loading fixes 2024-02-17 20:12:25 -08:00
Paul Gilbert 217312dedf M4: Endian proofing ws loading 2024-02-17 18:46:05 -08:00
Paul Gilbert 945ef9dbd4 M4: Remove deprecated sprite code 2024-02-12 20:44:37 -08:00
Paul Gilbert 0e9a6ccdd6 M4: Adding shadows rendering
The shadowing alpha blending seems okay, but there still seems
to be an issue with the shadows getting incorrectly clipped
2024-02-10 20:32:53 -08:00
Paul Gilbert d36ec09657 M4: Fix define for cels byte swapping code 2024-02-05 19:04:49 -08:00
Paul Gilbert 144b4fd1cd M4: Cleaner implementation of BE handling for cels
I don't have a BE system to test this out properly, but in
theory it should be cleaner to do any byte swapping for
loaded resources at load time rather than everywhere the
resource is accessed.

In a few places, such as script execution, it won't be
feasible to track down which bytes are the opcodes and
switch them beforehand. But for others, such as cels,
it should be possible to similar to what I've done here
to ensure the data can be accessed natively afterwards.
2024-02-05 18:58:39 -08:00
Paul Gilbert e7384ec53a M4: Fix crash talking to mayor in room 105 2024-02-03 11:05:48 -08:00
Paul Gilbert e153f02a51 M4: Clarify method out of index sprite errors occurs in 2024-02-02 19:53:13 -08:00
Paul Gilbert 6ac2b368b3 M4: RIDDLE: Compilation fix 2024-01-16 20:46:08 -08:00
Paul Gilbert ad029b18cf M4: RIDDLE: Start of room 201 2024-01-16 17:57:12 -08:00
Paul Gilbert d1568d0f27 M4: Fix Wilbur facing wrong direction in 64-bit builds 2024-01-11 21:59:50 -08:00
Paul Gilbert 1d048c1eea M4: Multiple likely fixes for reading values on BE systems 2024-01-09 19:08:46 -08:00
Paul Gilbert bb45f57556 M4: Fix basic walk animation on 64-bit builds 2024-01-09 18:49:09 -08:00
D G Turner d994fd8bd2 M4: Remove Remaining Extraneous Extern Declarations in Headers
The remaining extern declarations are required to declare global / directly
accessed variables.
2023-12-26 02:59:51 +00:00
D G Turner a6c0a1b88a M4: Fix Various GCC Compiler Warnings
These are mainly from -Wredundant-decls i.e. duplicated header definitions
2023-12-25 20:38:58 +00:00
Eugene Sandulenko 66b2bc58df M4: Fix warning about wrong allocation type. CID 1533014 2023-12-25 14:47:59 +01:00
Eugene Sandulenko 2b7934eb85 M4: Fix endless loop 2023-12-24 02:17:14 +01:00
Paul Gilbert 496ae8674d M4: Cleanup of wscript/ folder 2023-12-24 01:53:38 +01:00
Paul Gilbert 9e6aa1320c M4: Fix incorrect starting frame index for animations
This fixes animations on Linux which uses 64-bit ints
2023-12-24 01:53:38 +01:00
Paul Gilbert 07e04bf830 M4: More compiler warning fixes 2023-12-24 01:53:38 +01:00
Paul Gilbert 88fb6e7a23 M4: Change NULL to nullptr 2023-12-24 01:53:38 +01:00
Paul Gilbert fa036363f2 M4: Fix formatting of tabs in local variables 2023-12-24 01:53:38 +01:00
Paul Gilbert 003d6ca0b3 M4: Remainder of room 801 daemon 2023-12-24 01:53:38 +01:00
Paul Gilbert a5986df3c9 M4: Further array initialization fixes 2023-12-24 01:53:38 +01:00
Paul Gilbert 3e24d2c8d2 M4: Fixing casts to intptr 2023-12-24 01:53:38 +01:00
Paul Gilbert 71eb0c4276 M4: Clarify a bunch of byte * as being intptr 2023-12-24 01:53:38 +01:00
Torbjörn Andersson e7eb97aca3 M4: Fix another GCC compile error 2023-12-24 01:53:38 +01:00
Torbjörn Andersson ae4452ba4f M4: Consistent handling of a few sourceOffsets
At least one of them wouldn't compile with GCC before this change.
2023-12-24 01:53:38 +01:00
Paul Gilbert e03a38712b M4: In progress room 105 daemon 2023-12-24 01:53:38 +01:00
Paul Gilbert caec8484c0 M4: Change lots of methods to be camelcase 2023-12-24 01:53:38 +01:00
Paul Gilbert 9d6400e40c M4: Fix a bunch of pointer arithmatic 2023-12-24 01:53:38 +01:00
Paul Gilbert 11d155d7ba M4: Change %ld in string formats to %d 2023-12-24 01:53:38 +01:00
Paul Gilbert d503f712ed M4: Fixes closing game menu 2023-12-24 01:53:38 +01:00
Torbjörn Andersson 82f8a10263 M4: Fixed some GCC errors and warnings
I'm still nowhere near being able to build the M4 engine, though.
2023-12-24 01:53:38 +01:00
Paul Gilbert e9d918c773 M4: Cleanups of mouse init / sprites 2023-12-24 01:53:38 +01:00
Paul Gilbert db720319e9 M4: Remove duplicate ws_LogErrorMsg 2023-12-24 01:53:38 +01:00
Paul Gilbert f8c1cd0186 M4: Fix some pointer arithmatic 2023-12-24 01:53:38 +01:00
Paul Gilbert 7d537e1b33 M4: Implemented room 901 2023-12-24 01:53:38 +01:00
Torbjörn Andersson cce9e26643 M4: Use intptr instead of intptr_t, like most our engines do
If it turns out to be necessary to use intptr_t after all, we're going
to have to include the appropriate header for it. Currently we don't.
2023-12-24 01:53:38 +01:00
Paul Gilbert c47f9dc3b7 M4: Minor cleanups and pointer casting 2023-12-24 01:53:38 +01:00