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.
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().
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.
In D5 and up, you can have multiple casts in the same movie, along with
external casts. Unlike shared casts these are different namespaces;
each movie maps the casts to a libId, which is then used by
CastMemberID.castLib.
For D4 and below, the default cast libId is now represented by
DEFAULT_CAST_LIB. This should make refactoring easier in future.
Remove uses of deprected `SeekableSubReadStreamEndian` in archive.cpp
The deprationwarning was:
Use SeekableReadStreamEndianWrapper with SeekableSubReadStream instead
Two improvements for RIFF loading: size and alignment
A RIFF elements header: FourCC and size (4 bytes each) are not included
in the size. Offset + 12 then size - 4.
'DIB ' resources were found to always lead with two zero bytes.
Tested with: Fujitsu fmTOWNS SUPER TECHNOLOGY DEMO 1993.
Other resources such as 'SND ' do need alignment.
Tested with: SpaceWarlock Win. Intro movie lacked sound without
alignment. (WARNING: SNDDecoder: Bad format: 17408!)
Previously the methods would pass by reference, then convert to a
pointer on success and take ownership. This isn't ideal, as a
reference suggests no transferral of ownership, and doesn't suggest
it needs to be a heap resource allocated by new.
ILS is the initial load segment.
The part of a shockwave file that's needed to get things going and
other media can be loaded later over a slow 90s internet connection
There doesn't seem to be any case in which we should fall back to
getFirstResource in D4 as found in #4172. So we can remove that fallback
and the associated warning.