aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/resource.cpp
AgeCommit message (Collapse)Author
2018-12-30SCI: Don't try to validate resources added from a Mac resource forkFilippos Karapetis
The fix has been authored originally by csnover, adapted from commit ca420e44167e5ee488b4ad547104fa6b976e6f1c Fixes Trac#10440, Trac#10892.
2018-12-05SCI: Silence more incorrect audio patch type warningsColin Snover
2018-08-27SCI: Load the correct sound effects in Hoyle 4Filippos Karapetis
Fixes bug #10412
2018-01-02SCI32: Fix segfault when SCI3 vocab isn't foundDan Church
Seen when attempting to detect and/or run the Shivers 2 demo. Closes gh-1106.
2017-11-19SCI: Fix UB shifting negative integersColin Snover
2017-09-29SCI32: Fix extremely broken patch for RAMA RESOURCE.SFXColin Snover
Obviously, games other than RAMA need to have sound effects volumes.
2017-09-29SCI32: Improve RESOURCE.SFX fallback for RAMAColin Snover
Since Datafiles says to rename any RESOURCE.SFX to RESSFX.00n, and there is only a RESOURCE.SFX on CD 1, don't confuse users by failing to use RESSFX.001 for CD2 and CD3.
2017-09-24SCI32: Disable all SCI32 Mac codeColin Snover
This code is currently untestable and is almost certainly at least partly based on guesswork & not actual reverse-engineering (as was the case for all other pre-2015 SCI32 code), so future developers interested in adding SCI32 Mac support should use it only as an intermediate reference rather than as known good code.
2017-09-19SCI32: Support RAMA's single sound effects volumeColin Snover
The original installer copied RESOURCE.SFX to the hard drive so there was only one RESOURCE.SFX on CD 1. Instead of requiring users to create duplicates, just use the single RESOURCE.SFX if it exists.
2017-09-10SCI: Remove dead codeColin Snover
2017-09-08SCI: Add method to get resource patch file extensionsColin Snover
2017-09-08SCI: Improve array bounds safety checkColin Snover
There is no practical risk now since the enum and array sizes are the same, but there is no reason to rely on a separate data structure to avoid potential out-of-bounds index use here instead of just checking the array size directly, which is always safe.
2017-09-03SCI32: Make audio resource size mismatch non-fatalColin Snover
Lighthouse audio.225 in RESSCI.002 (US English 1.0C) triggers this condition; the audio resource says its data is one byte larger than the recorded size in the volume. In this case, just use the smaller of the two values for the size, to avoid overreads.
2017-08-25SCI32: Stop blacklisting 37.MAP from PhantasmagoriaColin Snover
It turns out that GOG.com version of Phantasmagoria needs the 37.MAP patch file because for some reason the 37.MAP in RESSCI.000 is empty (36 bytes, versus the correct file which is ~1kB). Fortunately, this file is the same across all CDs in the original US release, so hopefully unblocking this patch will not cause any problems for any of the CD releases either. Fixes Trac#10161.
2017-08-04SCI32: Fix loading audio resources from RESSCI.PATColin Snover
This is used by Lighthouse.
2017-07-23SCI: Blacklist certain audio map patch filesColin Snover
Refs Trac#9976.
2017-07-23SCI: Keep audio maps out of the LRU cacheColin Snover
2017-07-23SCI32: Detect multi-disc audio by RESSCI files instead of RESAUDColin Snover
If a user fails to rename audio files in the required manner when copying them, detecting multi-disc audio by looking for a renamed audio file does not work very well. Looking at RESSCI.00n is a better choice, though this is not completely valid since e.g. Rama 1.0 US has only one RESOURCE.SFX volume which its installer copies to the hard drive, so a little more work will need to be done in the future to find and fix these kinds of edge cases. Refs Trac#9976.
2017-06-09SCI: Get LRU from list directly, instead of from a reverse iteratorColin Snover
2017-06-08SCI32: Clarify code comment about Steam GK2 RESMAP.001Colin Snover
2017-05-20SCI: Ignore patch resources with .DOS and .WIN extensionsColin Snover
Type mismatch is triggered on THEGUIDE.DOS and THEGUIDE.WIN from at least Phant1 French 1.100.000.
2017-05-13SCI: Suppress resource warnings when running fallback detectionColin Snover
For the moment, only warn about bad resources when a game is actually starting, since unknown but valid resources being detected by the fallback detector currently also trigger the warning.
2017-05-13SCI: Dispose uncached volume file streamsColin Snover
The stream returned by a call to ResourceManager::getVolumeFile either MUST (when returning an I/O stream from a Common::FSNode) or must NOT (when returning a Common::File *) be deleted by the caller, depending upon some internal implementation details of ResourceSource that should never have been exposed to callers. FSNode streams that should have been deleted were not being deleted all the time, which leaked and eventually caused ScummVM to run out of FDs. This commit improves this situation by shielding callers from these internal details by centralizing the destruction logic in one place, so FSNode read streams stop being leaked and callers no longer need to know stuff about the internals of the ResourceSource they are trying to read in order to avoid leaking or breaking the volume file cache. Fixes Trac#9782.
2017-05-10SCI: Fix reading of Rave data from compressed KQ6 audio volumesColin Snover
Refs Trac#9764.
2017-05-10SCI: Fix support for ScummVM compressed audio volumesColin Snover
The runtime code for this had previously relied on hot patching volume file offsets at the moment that a resource was loaded, instead of correcting file offsets when reading audio maps. The code added for sanity checking audio volumes started to report warnings because the offsets being received were for the original uncompressed audio volume, which (naturally) is larger than the compressed audio volume. This commit also deduplicates code between addResource and updateResource, and tweaks a validation-related error message for improved clarity. Fixes Trac#9764.
2017-05-09SCI: Add ifdef for SCI32 types in processPatchColin Snover
2017-05-08SCI: Fix SCI1.1 patch resourcesColin Snover
While earlier commits had fixed handling of audio resources in audio bundles to match SSCI, audio *patches* in SCI16 were still being treated like standard resource patches. They are now special-cased in the resource manager, just like SCI32. Incidentally, while fixing the problem with audio patches, I also noticed that the patch resource fixes for SQ5/German were very similar to the special-case operations for resources in SCI32, though using an odd heuristic. After investigating, it appears that Sierra SCI1.1 works mostly like SCI32, and not like what was there from SCI View. So, the old special-case code is deleted and the special-case code for SCI32 has been expanded to cover SCI1.1. (SSCI prior to 1.1 do not appear to do this special-casing.) Fixes Trac#9773.
2017-05-08SCI: Fix Audio36 patch suffix matching against lowercase extensionsColin Snover
The Lighthouse glider demo comes with a file named SDirectX.dll which was failing to match the case-sensitive suffix search for .DLL.
2017-05-08SCI: Fix some issues with ChunkResourceSourceColin Snover
1. The chunk number was hard-coded to zero and inaccessible. 2. Running ResourceManager::getVolumeFile for a chunk resource would always return nullptr instead of a stream of the chunk, which made it impossible to generically validate that resources being added were within bounds of the container file (or, in this case, container chunk).
2017-05-08SCI: Improve detection and reporting of resource errorsColin Snover
Simple assertions in the resource manager are not sufficient to track down resource corruption issues, and some error conditions that were being checked already were either ignored or only raised as warnings that casual users would be unlikely to see. Ideally, error handling in ResourceManager would be improved to the point where errors would correctly propagate out of it (so the warning dialogue could be displayed from outside), but right now error codes are dropped all over the place, and it would take more effort to fix that without much benefit for the current situation. If/until someone has the energy to fix that, the warning dialogue is simply shown from ResourceManager::scanNewSources. Refs Trac#9764.
2017-05-01SCI32: Add support for Shivers interactive demoColin Snover
Closes Trac#9745.
2017-04-23SCI32: Remove SCI3 TODOColin Snover
SCI3 resources appear to already be properly handled.
2017-04-23SCI32: Allow resource maps with missing corresponding volumesColin Snover
GK2 on Steam comes with an extra bogus resource map file which would previously cause ScummVM to refuse to load the game due to a mismatch in the number of map & volume files. This does not cause any harm, but is a pain for users (since it requires them to manually delete the file, and it will be recreated if a user runs the Steam game file integrity check), so allow the game to load with a warning instead.
2017-04-23SCI: Always search for .CSC script patchesColin Snover
Skipping a search for .CSC scripts when any .SCR files exist does not work with at least Phant2, because it comes with an INSTALL.SCR file. Searching unconditionally for .CSC files should not cause any issues since the game scripts will either be in .SCR format or in .CSC format, not both in the same game.
2017-04-23SCI: Implement fallback detection for SCI3Colin Snover
2017-04-23SCI32: Remove incomplete SCI3 detection warningColin Snover
Map format is the same as SCI2/2.1 and volume format is detected correctly as SCI3.
2017-03-30SCI32: Fix audio, wave, VMD, Duck, CLUT, TGA, ZZZ, Etc patchesColin Snover
Specifically, audio patches are used in at least PQ:SWAT (40103.AUD), Lighthouse (9103.AUD), and the GK2 demo (300.AUD).
2017-03-30SCI32: Support reading sound effects from normal resource bundlesColin Snover
2017-03-30SCI: Update formatting strings to match updated Span APIColin Snover
2017-03-27SCI: Implement bounds-checked reads of game resourcesColin Snover
2017-02-18SCI: Fix unaligned readWillem Jan Palenstijn
2017-01-09SCI32: Ignore .OLD extension when searching Audio36 patchesColin Snover
KQ7 2.00b includes a SIERRINF.OLD file which should not be matched.
2016-12-03SCI: Remove unnecessary indirection in Resource::loadPatchColin Snover
2016-11-20SCI32: Fix reading view, pic, and palette patchesColin Snover
Unlike SCI16 games, the location of data within SCI32 patch files is calculated on a per-resource-type basis by the game engine, instead of by reading byte 1 of the patch file.
2016-11-02SCI: Remove old SCI32 hires detection heuristicColin Snover
2016-09-29SCI32: Increase resource manager LRU cache sizeColin Snover
This fixes high CPU utilisation playing Stooge Fighter 3 in SQ6.
2016-09-29SCI32: Fix incorrect warnings about unlocking type 140Colin Snover
This type in SSCI corresponds to Wave resources, but since ScummVM does not differentiate between Wave and Audio resources, just say it's an Audio resource type, not an Invalid resource type.
2016-08-22SCI32: Fix fallback detector for SCI32 games againFilippos Karapetis
A regression from c4250c05d0
2016-08-19SCI: Avoid attempts to use exe/txt/dll files as patchesColin Snover
Fixes some false warnings when games try to read in non-patch files with names that start with A/B/S/T.
2016-08-19SCI32: Enable multi-disc audio resourcesColin Snover
Phant1, PQ:SWAT, GK2, and Phant2 all have different audio maps and audio volumes on each CD. In order to make this work within ScummVM, where CDs are never swapped, each RESOURCE.AUD for these games must be renamed to RESAUD.00x and each RESOURCE.SFX renamed to RESSFX.00x.