Commit Graph
190 Commits
Author SHA1 Message Date
Scott Percival 5e18b53e93 DIRECTOR: Fix use-after-free in EXE loader 2024-01-30 23:30:11 +01:00
Le Philousophe cf3eac29c3 DIRECTOR: Migrate engine to Path 2023-12-24 13:19:25 +01:00
Scott Percival d7511529cf DIRECTOR: Fix loadEXEv3 to switch movies instead of injecting in-place
Fixes loading the title screen in GADGET: Invention, Travel and
Adventure.
2023-12-14 20:29:02 +01:00
Eugene Sandulenko 8bccc12786 DIRECTOR: Reduce header dependency 2023-08-02 21:05:06 +02:00
Harishankar Kumar 815011941f DIRECTOR: Fix memory leaks while loading exe
This patch fixes memory leaks associated with loading exe files,
in the cases where archive cannot be loaded up from exe, exeStream
is deleted.
2023-07-26 02:45:49 +02:00
elasota b8acbe6bee COMMON: Archive path refactoring, add getFileName and getPathInArchive that unambiguously return the filename or the full path 2023-07-19 18:51:37 +02:00
Scott Percival 36cb4594c2 DIRECTOR: Fix ProjectorArchive path resolution 2023-07-08 22:01:00 +03:00
Scott Percival 93bd0741d6 DIRECTOR: Interrogate SearchMan for path matches 2023-07-08 22:01:00 +03:00
Scott Percival 17e1853347 DIRECTOR: Refactor path detection
Previously, paths were verified by pathMakeRelative().
This method had several drawbacks; the code was increasingly ad-hoc
and recursive, and the function would return a Common::String that
was not guaranteed to be distinct. 90% of the time the path would need
to be converted to Common::Path so that file streams could use it.

This code has been replaced with findPath(), a function which takes a
path string as recieved from Director (e.g. a Lingo script, a filename
stored in a CastInfo record) and returns a Common::Path object for the
file on the local system. The inner workings have been split into subfunctions,
which should make it easier to add workarounds and fuzz at the correct
layer.
2023-07-08 22:01:00 +03:00
Eugene Sandulenko 9aa0958736 DIRECTOR: Properly keep track of open resource files and their precedence
We used to close resources when we were closing movies, but with making
Archives owned by Director class, we now have list of all _seen_ resources.

This change implements a proper, ordered list of resources which are
overriding the ones loaded earlier.

Fixes cursors in the7colors which were read from previously loaded Shared Casts.
--start-movie=04CLUB:FloorColidor:IntoFloo
2023-06-30 00:32:57 +02:00
Eugene Sandulenko 95d8cf840c DIRECTOR: _allOpenResFiles -> _allSeenResFiles 2023-06-29 23:22:54 +02:00
Eugene Sandulenko 7baba61852 DIRECTOR: Modernized rest of the loops 2023-06-29 23:22:38 +02:00
Misty De Meo 610fe3ac4b DIRECTOR: Resource: do not delete stream on fail
The stream becomes owned by the Archive as soon as openStream()
is called, so freeing the Archive object also frees the stream.
Trying to delete it a second time will blow up.
2023-06-22 22:07:38 -07:00
Scott Percival 354abe0cc7 DIRECTOR: Fix ProjectorArchive path lookup 2023-06-08 09:16:30 +02:00
Scott Percival 458e97933d DIRECTOR: Refactor archive loading code
Make DirectorEngine::_allOpenResFiles the de-facto owner of Archive *
objects, move all of the various loadEXE/loadMac methods off Window and
onto DirectorEngine, and replace inline Archive loading with
openArchive().
2023-06-08 09:16:30 +02:00
Eugene Sandulenko 501ed235e3 DIRECTOR: Return full path for Raw EXE
This fixed mcluhan-win that uses path to .exe as the root for other files
2023-06-02 16:31:29 +02:00
Eugene Sandulenko dd50ae1089 DIRECTOR: Improve debug output 2023-06-02 14:36:41 +02:00
Eugene Sandulenko b60275e104 DIRECTOR: Gracefully process case when there is no startup file specified 2023-05-29 22:21:23 +02:00
Harishankar Kumar 832d7d2f02 DIRECTOR: Change error in case of bad file to warning, to exit gracefully
Initially for a bad file that didn't exist, the ProjectorArchive was throwing up, now however implemented gracefully loading.
Fixed error and termination for `Majestic.bin`, the path it tried to look up was `Majestic` from detection entry.
2023-05-29 19:36:15 +02:00
Harishankar Kumar 608beef745 DIRECTOR: Fix memory leak due to bad flag
ProjectorArchive was giving memory leak and build failures due to not deleting unwrapped stream after use
2023-05-29 19:36:15 +02:00
Harishankar Kumar 9955c95806 DIRECTOR: Add multiple resources in exe using ProjectorArchive
This patch uses ProjectorArchive to extract multiple resources embedded into executable files, additionally a new function getRawExe is defined which gets raw exe file name without --start-movie overriding it.
Solves the problem for finding multiple resource files like `ModTB.DXR` in 'mcluhan', uses 'mcluhan.exe' to extract resources and add them to SearchMan.
2023-05-29 19:36:15 +02:00
Donovan Watteau f5a505782f DIRECTOR: Fix -Wformat warning 2023-05-14 22:57:11 +02:00
Vladimir Serbinenko 18d740fedd DIRECTOR: Redo "Fix use-after-free"
This reverts commit 036297b605.
Then it solves the same problem in a way that is more compliant
with how similar code is written in this engine thus avioding
accidentally introduced memory leak.
2023-05-12 00:11:58 +02:00
Scott Percival 5426729bf4 DIRECTOR: Fix zoom transitions 2023-05-10 09:48:50 +02:00
Scott Percival f703ee6ecf DIRECTOR: Split CastMember classes into files 2023-04-29 14:20:05 +02:00
eientei 0d46b2c649 DIRECTOR: resource: fix typo 2023-04-22 20:05:36 +08:00
Eugene Sandulenko ab8eb9a68a DIRECTOR: Fix warning 2023-03-14 11:27:43 +01:00
hax0kartik 047184a1b5 DIRECTOR: Fix alignment issue during seeking in ProjectorArchive 2023-03-13 23:25:55 +01:00
hax0kartik a15208bded DIRECTOR: Fix incorrect dict parsing in ProjectorArchive 2023-03-13 23:25:55 +01:00
hax0kartik 325594ab0b DIRECTOR: Offset to PJXX tags is always in fixed endian 2023-03-13 23:25:55 +01:00
hax0kartik 58ff07f4a6 DIRECTOR: ProjectorArchive filemap offset needs to be 32 bit only 2023-03-13 23:25:55 +01:00
hax0kartik 7172b7620a DIRECTOR: Prefix warnings with BUILDBOT in ProjectorArchive 2023-03-13 23:25:55 +01:00
hax0kartik 3f49fca324 DIRECTOR: Check for invalid seeks in ProjectorArchive 2023-03-13 23:25:55 +01:00
hax0kartik 7ee8e6653c DIRECTOR: Return false on failure in ProjectorArchive 2023-03-13 23:25:55 +01:00
hax0kartik e10f756d68 DIRECTOR: Use BufferedStream in ProjectorArchive 2023-03-13 23:25:55 +01:00
hax0kartik ea9d0d39f8 JANITORIAL: Fix code formatting issues in ProjectorArchive 2023-03-13 23:25:55 +01:00
hax0kartik 2a2217cb46 DIRECTOR: Add ProjectorArchive 2023-03-13 23:25:55 +01:00
eientei ae903d4940 DIRECTOR: Fix possible memory leak when loading an unhandled EXE version 2023-02-25 11:35:24 +01:00
eientei b44cc897d0 DIRECTOR: Fix memory leak when loading an unsupported file 2023-02-25 11:35:24 +01:00
Eugene Sandulenko e9146658d9 DIRECTOR: Fix use after free 2023-01-27 20:01:51 +01:00
Eugene Sandulenko 3058bdb8be DIRECTOR: Do not leak memory on failed EXEv4 load 2023-01-27 15:11:20 +01:00
Scott Percival e93583bbf0 DIRECTOR: Fix memory leak in Window::loadEXE() 2023-01-27 13:31:21 +01:00
Eugene Sandulenko c4afc4ac3e JANITORIAL: Remove excess empty lines 2023-01-20 14:01:20 +01:00
Scott Percival d76b359ac2 DIRECTOR: Refactor movie loaders to allow loading from executables 2023-01-19 12:12:21 +01:00
Scott Percival 05ca29629a Revert "DIRECTOR: openMainArchive may be opening an EXE"
This reverts commit 6af5e86a77.
2023-01-19 12:12:21 +01:00
Misty De Meo 08406b4510 DIRECTOR: add SearchMan check 2023-01-15 23:32:06 +01:00
Misty De Meo 6af5e86a77 DIRECTOR: openMainArchive may be opening an EXE
This fixes Fukuoka-Go-Round, which ends up passing the main EXE as a movie
to (re)open at runtime instead of a movie. Without this, clicking back to
the main menu crashes the disc.
2023-01-15 23:32:06 +01:00
elasota e280186a8c ALL: VS warning cleanup 2022-12-25 16:31:57 +01:00
Cameron Cawley 28d7b361ea COMMON: Move more file format code into common/formats 2022-12-11 22:33:23 +01:00
Vladimir Serbinenko 0670d1a16a DIRECTOR: Switch to openFileOrDataFork 2022-12-04 20:16:21 +01:00