Changes between Version 3 and Version 7 of Ticket #14503


Ignore:
Timestamp:
06/10/23 10:38:39 (11 months ago)
Author:
yarolig
Comment:

looks like a Common::File calls CCArchive::createReadStreamForMember("049.att."), which calls BaseCCArchive::getHeaderEntry which tries to convert file name to resource id.

In case of file name "049.att." it is converted to existing resource with id=55679 and file size 5526.

The dot "." was added in Common:: File::Open

	if ((stream = archive.createReadStreamForMember(filename))) {
		debug(8, "Opening hashed: %s", filename.toString().c_str());
	} else if ((stream = archive.createReadStreamForMember(filename.append(".")))) {
		// WORKAROUND: Bug #2548: "SIMON1: Game Detection fails"
		// sometimes instead of "GAMEPC" we get "GAMEPC." (note trailing dot)
		debug(8, "Opening hashed: %s.", filename.toString().c_str());
	}

I guess that resource loading by ID is a MM1 thing, so my best workaround now is:

void SpriteResource::load(const Common::String &filename) {
	_filename = filename;
	Common::File f;

	if (g_engine->getGameID() == GType_MightAndMagic1 && f.open(filename)) {
		load(f);
	} else {
		File f2(filename);
		load(f2);
	}
}

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14503 – Description

    v3 v7  
    55See also https://bugs.scummvm.org/ticket/14431#comment:2
    66
    7 I have a dirty workaround: https://github.com/scummvm/scummvm/compare/master...yarolig:scummvm:carnage-hand-workaround
     7I had a dirty workaround:
     8{{{
     9diff --git a/engines/mm/shared/xeen/sprites.cpp b/engines/mm/shared/xeen/sprites.cpp
     10index 97fa01aa11b..ce5c377fc3c 100644
     11--- a/engines/mm/shared/xeen/sprites.cpp
     12+++ b/engines/mm/shared/xeen/sprites.cpp
     13@@ -213,6 +213,12 @@ void SpriteDrawer::draw(XSurface &dest, uint16 offset, const Common::Point &pt,
     14        _destBottom = (byte *)dest.getBasePtr(clipRect.right, clipRect.bottom - 1);
     15        _pitch = dest.pitch;
     16
     17+       // WORKAROUND for carnage hand
     18+       if (_filesize == 5526) {
     19+               if (offset > _filesize || offset == 86 || offset == 3584)
     20+                       return;
     21+       }
     22+
     23        // Get cell header
     24        Common::MemoryReadStream f(_data, _filesize);
     25        f.seek(offset);
     26}}}
     27 
     28And now it less dirty:
     29{{{
     30diff --git a/engines/mm/shared/xeen/sprites.cpp b/engines/mm/shared/xeen/sprites.cpp
     31index 97fa01aa11b..859818ddb66 100644
     32--- a/engines/mm/shared/xeen/sprites.cpp
     33+++ b/engines/mm/shared/xeen/sprites.cpp
     34@@ -80,7 +80,7 @@ SpriteResource &SpriteResource::operator=(const SpriteResource &src) {
     35 void SpriteResource::load(const Common::String &filename) {
     36        _filename = filename;
     37        Common::File f;
     38-       if (f.open(filename)) {
     39+       if (g_engine->getGameID() == GType_MightAndMagic1 && f.open(filename)) {
     40                load(f);
     41        } else {
     42                File f2(filename);
     43}}}
     44
     45I'm posting a pull request if you are ok with that https://github.com/scummvm/scummvm/pull/5084
    846
    947The animation was ok in branch 2-7.