Commit Graph
203 Commits
Author SHA1 Message Date
Scott Percival fca3ddef70 DIRECTOR: Load Xtras from the path before running INI scripts
If there is an Xtra in the Xtras folder and an XObject DLL in the root
path with the same name, the Xtra will have been preloaded and therefore
take precedence.

Fixes initial load scripts for Pothead.
2025-04-19 18:22:48 +08:00
Scott Percival 7ac5047bc7 DIRECTOR: Move _mainArchive handle to DirectorEngine
_mainHandle is a pointer to the projector archive, and is set once at
the start of execution. DirectorEngine is a better place for it rather
than the first Window, as other Windows might try and access it.

Fixes crash when changing the cursor in Microphone Fiend.
2025-03-25 12:17:34 +08:00
Scott Percival 1f8de850f0 DIRECTOR: Quieten benign warnings 2025-02-08 14:45:53 +01:00
Scott Percival fa8e65de44 DIRECTOR: Attempt to auto-load Xtras from path
In D5 and up, you don't have to do "openXlib" for Xtras. Having
them somewhere in the top-level Xtras folder is apparently enough.
Also the files can be in there up to five levels deep.

Fixes initial loading in Ingenious.
2025-02-08 14:45:53 +01:00
Scott Percival 6e8d0611dc DIRECTOR: Remove endian bodge in Windows projector loader
It is possible for the size of a movie stored as an entry to be larger
than the start offset of the list.

Fixes loading the resource list in the Windows version of Pop Up
Computer.
2024-10-13 19:57:43 +02:00
Hubert Maier 42710e6e78 JANITORIAL: DIRECTOR: Fix typos in comments 2024-08-02 17:13:10 +03:00
Roland van Laar f37001225f DIRECTOR: fix namespace in debug message
Window -> DirectorEngine
2024-07-09 09:57:01 +02:00
D G Turner c76ad2acca DIRECTOR: Fix Signed vs. Unsigned Comparison GCC Compiler Warnings 2024-05-26 19:23:09 +01:00
Eugene Sandulenko dea88ded28 DIRECTOR: Patching built-in Projector archive files
This lets McLuhan to finally properly start and load
these movies
2024-05-24 18:29:08 +02:00
Eugene Sandulenko f352a3e1cc DIRECTOR: Improved loading log messages 2024-05-24 01:11:31 +02:00
Eugene Sandulenko 170c1d0ffc DIRECTOR: Dump built-in movie files if requested 2024-05-24 01:11:31 +02:00
Scott Percival d43612db85 DIRECTOR: XOBJ: Refactor methods to pass path to library 2024-03-31 16:58:31 +02:00
Scott Percival ce2b2354c3 DIRECTOR: Add Xtras folder detection 2024-03-11 01:04:43 +01:00
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