Commit Graph
166 Commits
Author SHA1 Message Date
Walter Agazzi a660cd67a4 AGS: Engine: fixed bytecode fixup assertion done for unapplicable case
Was broken by 973845a
From upstream 9d86d5ab1a6e84115c33ffbfc8a96185e6b9fd63
2024-01-17 03:12:32 +01:00
Walter Agazzi 46b14a21c6 AGS: Engine: safety check for fixups with out of range code reference
From upstream 973845a15ed9726956895161c8847bc668c3e787
2024-01-17 03:12:31 +01:00
Walter Agazzi cce6aff754 AGS: Engine: replaced uses of strncpy with snprintf for safety
From upstream 02feb81b34f041dccd8a4bb33ff060cc532d979b
2024-01-17 03:12:30 +01:00
D G Turner a162a731d8 AGS: Fix Signed vs. Unsigned Comparison GCC Compiler Warning 2023-08-13 23:37:58 +01:00
Walter Agazzi 7688ff025f AGS: Engine: sync audio in case of scheduled post-script actions
This fixes a case when a clip was ordered to Play right before
a Room change, or similar game mode change, but is delayed
 until after the change occurs.
From upstream d327b06bf5f3d8fff02b454d07560fcd5fc05b24
2023-08-13 10:58:26 +02:00
Walter Agazzi d9377bbb63 AGS: Engine: Fix typo in commit b81abc533f508e5831e7ca6d2512c66d506ef09d
loopIterations -> loopCheckIterations
2023-08-13 10:58:26 +02:00
Walter Agazzi 4d28890458 AGS: Engine: fixed loop check... again...
The latest change (c694126) was meant to fix a timeout test logic,
 but it broke the primary loop count check.

The incorrect behavior may be observed when a function with
many loops and `noloopcheck` modifier is called *repeatedly*
from another function. Normally in such case the iterations
passed withing a `noloopcheck` function should not be counted,
but they were.

Apparently the situation cannot be resolved without having 2 counters:
1. One is working all the time, and is used to detect timeouts, as these
may occur both in normal circumstances and in functions with
`noloopcheck` modifier.
2. Second is working only in functions without `noloopcheck` modifier
and is used to do the "stuck in a loop" test.

+ backported small optimization from 3.6.1 branch.
From upstream 70afd47f4879b4eaed5dab664af9e4485055875f
2023-08-13 10:58:26 +02:00
Walter Agazzi e3bf334921 AGS: Engine: made run_interaction_script() safer in case evt is too high
From upstream 4d7565099652c019d0dcbac5c60f62d735dfae3e
2023-08-13 10:58:26 +02:00
elasota 067626137e AGS: Fix cast of integer to pointer of greater size warning 2023-07-08 22:02:00 +03:00
Walter Agazzi 0690f14871 AGS: Engine: ccInstance: do not assert stack if script was aborted
from upstream a55d76322fca302c0668e3ab76f0c122b22341d3
2023-06-19 22:01:30 +03:00
Walter Agazzi d2336f3b70 AGS: Removed Dustbowl steam username workaround
Return a proper string in ags_steam plugin stub, avoiding script
workaround
2023-06-17 10:14:46 +02:00
D G Turner 12d14752bd AGS: Fix Set But Unused Variable GCC Compiler Warning 2023-05-15 22:33:41 +01:00
Walter Agazzi 6055a5fe5a AGS: Engine: fixed script's timeout check was working incorrectly again
From upstream c694126d77503b9d5528bd95427a8ef6ee48aa6c
2023-05-14 23:04:38 +02:00
Walter Agazzi 1bf6a2025f AGS: Engine: improvements to the "timeout" check
* Fixed _lastAliveTs was not reset right after calling sys_evt_process_pending();
this caused events polling called continuously after timeout happened once.
* Set timeout to 60 fps (16.777 ms) instead of random 10ms.
* Do the timeout test only each 1000th loop iteration.
* Few other tiny adjustments in code.

Partially from upstream 60aaef003021fec2f75d4dc6db1b24f0b5d2be65
2023-05-14 23:04:38 +02:00
Walter Agazzi 88a1083e0d AGS: Move strlen out of loops
From upstream b476dfca4b40bc2ca59b7f0fd793543524397ccf
2023-03-12 20:58:28 +00:00
Walter Agazzi c683fef66e AGS: Add workaround for Dustbowl character creation
Avoid using the stubbed Steam GetUserName method to
initialize the character name
2023-01-19 20:39:37 +01:00
Donovan Watteau 2c804b9c71 AGS: Fix AmigaOS and NDS builds 2022-12-18 14:03:39 +01:00
Thierry Crozat 5772893340 AGS: Engine: fixed CallScriptFunction for the ancient games + added comments
Was broken by dec92f05ea
(e38df03c5d1658a2c44a26ba4ee6f22663c1e701 in upstream).

Some games do not have function arg count appended to the function names in
the export table; in that case `export_args` remained uninitialized.

From upstream cdbb7a7367db57e14983015232ecc97f6a3dd212
2022-12-17 22:10:55 +01:00
Thierry Crozat 7d88a52275 AGS: Engine: fixed restoring a legacy savegame
From upstream 9776df3c8403f252e981f5518c48eace2e83d373
2022-12-15 22:40:17 +01:00
Hubert Maier a316869e7c AGS: Correct spelling mistake
occured -> occurred
2022-10-27 15:56:08 +02:00
Hubert Maier e5336d1400 AGS: Correct spelling mistake
accomodate -> accommodate
2022-10-27 15:56:08 +02:00
Hubert Maier 255730b227 AGS: Correct spelling mistake
occured -> occurred
2022-10-27 15:56:08 +02:00
Thierry Crozat 6f512bb2af AGS: Removed some redundant/obsolete comments
From upstream a7bd24cd4822bdcabef061197c98d1224200aa2a
2022-10-09 18:56:36 +01:00
Donovan Watteau 27f9a460b5 JANITORIAL: Fix "the the" and similar typos 2022-07-29 19:36:40 +03:00
Thierry Crozat 4f90db8fb4 AGS: Small correction to the hung script loop check 2022-06-24 20:54:42 +01:00
D G Turner 7f2f42e4a1 AGS: Fix Signed vs. Unsigned Comparison GCC Compiler Warning 2022-06-24 01:28:37 +01:00
Thierry Crozat 08db4be24c AGS: As a hotfix, restored the old way to test for hung script loops
The timeout method introduced by 6f665dfe is not working very well and
gives "false positives", so I'll disable it for the time being.

From upstream e0edb28b6606c360a1ea3fdcc487c2b05929ed02
2022-06-23 23:57:49 +01:00
Thierry Crozat 6f665dfe68 AGS: Test for hanging script using timeout instead of while loops
From upstream c34f0c96596f1a7814c15e7a06c2c498cb95ebfc
2022-06-23 23:57:27 +01:00
Thierry Crozat 305fdb853a AGS: Abort current scripts on close window event
This helps kill "hanging" scripts if user closed the window while
there's no real engine update.

From upstream a758fd6de2dccd0c948fc7f9e5b65200df902a65
2022-06-23 23:57:26 +01: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 8e55de7b77 AGS: Changed sccmd_info array from being global objects 2022-05-31 18:33:21 -07:00
Paul Gilbert d39c6cb31f AGS: Added "sound volume" param to all Animate() functions
From upstream 926220f9706baafa80d05ff6264f7fa13296dc16
2022-05-10 21:17:59 -07:00
Paul Gilbert 1607b2530b AGS: Fixed script errors when non-obligatory callbacks are missing
From upstream 29aaa19d712c3edf5701c648833283011c2f7298
2022-05-08 11:37:49 -07:00
Paul Gilbert 13f40609c7 AGS: Reset currentline when exiting script function, for cc_errors
From upstream 538e9072b03b0441853ac0022d17f8990065f8de
2022-05-05 22:41:10 -07:00
Paul Gilbert b1649597d7 AGS: Replaced Math/std Min/Max with ScummVM macros
Inspired by 6dee5ee6f271c600e30879d892295ea6069e8cc9
2022-05-05 22:41:10 -07:00
Paul Gilbert 28a2b6aa9c AGS: Added extra checks for abort_engine being set
This fixes an intermittant error I noticed when
qutting QFG2AGDI via the quit dialog could open
the debugger with an error rather than exitting
2022-05-05 22:41:09 -07:00
Paul Gilbert faa858a55b AGS: Fixed sending non-error messages to debugger
From upstream 3b43353986ca91ecad9c5270e362c8716effaf37
2022-05-05 22:41:07 -07:00
Paul Gilbert 540a92a6c5 AGS: Necessary fixes to build with latest changes to ccError
From upstream 238b18e2ea0a34742d50c5d4298a06cc3077dcdd
2022-05-05 22:41:07 -07:00
Paul Gilbert 8e132f7b3f AGS: cc_error returns stack from all script threads
From upstream 9e76800d668d8d0af7d47d815e6d1b781c7601f6
2022-05-05 22:41:07 -07:00
Paul Gilbert 16d0d89787 AGS: Grouped ccError variables in a struct
From upstream 48ef387226e4d420dc62d0a0b204cf4cd89a1139
2022-05-05 22:41:07 -07:00
Paul Gilbert a2a5f2575d AGS: Reorganized few cc_ headers
From upstream ea1f8b9ece69fc7c49c4d3aa7b9af51c4ca736e5
2022-05-05 22:41:07 -07:00
Paul Gilbert 480be2134b AGS: Added script instance thread stack, replacing current_instance
From upstream f3443cb7a4ae5858e5d2d28131aaf6cf138bc0ec
2022-05-05 22:41:06 -07:00
Paul Gilbert 68e5184afa AGS: Replaced some (v)sprintfs with sNprintf counterparts
From upstream a34bd392249f87a152dc470d90c67a7d193a28d8
2022-04-27 20:51:30 -07:00
Paul Gilbert a6f42ad1ab AGS: Fixing various "unused va/arg" warnings + removed empty funcs
From upstream 61771ecd638338806c40d0da2bf1addea06cac90
2022-04-25 21:44:40 -07:00
Paul Gilbert a633e9d72f AGS: Fixing various type-cast warnings
From upstream 6c42c7331e96386721f28c92ec3cb4cd039e10cd
2022-04-25 20:06:19 -07:00
Paul Gilbert 67628b9c6a AGS: Suppress endless "unused param" warnings in script api
From upstream b4a5ec72c059bc3c65e89a45a8b1218068a2015a
2022-04-24 16:00:05 -07:00
Paul Gilbert 608389c4c5 AGS: made SystemImports index an unsigned value
From upstream 30b8f4016c815f01b49398ddb697b454f1565218
2022-04-24 16:00:05 -07:00
Paul Gilbert 9533c0e028 AGS: Made script module index an unsigned value
From upstream bd4e65677eb0319ff746e519ee40016000a4f4f9
2022-04-24 16:00:04 -07:00
Paul Gilbert 14cffd13e7 AGS: Use String::NoIndex instead of -1 where necessary
From upstream 56275cb1f58f630082f3f51ab8e2c0ab5b021b16
2022-04-24 16:00:04 -07:00
Paul Gilbert 7ebdd8f304 AGS: Removed redundant <3 params check from DoRunScriptFuncCantBlock
From upstream f156586fa9d6b99249eaff54230179f784fdec09
2022-04-22 21:04:25 -07:00