Opened 9 years ago

Closed 5 years ago

Last modified 5 years ago

#5517 closed defect (fixed)

DW: Unsupported Mac demo

Reported by: SF/gonsalet Owned by: bluegr
Priority: normal Component: Engine: Tinsel
Keywords: detection Cc:
Game: Discworld


Discworld Mac demo found on demo CD from Micromanía 3a Época Núm. 10 is unsupported by ScummVM 1.2.0.

The game in \'C:\\Users\\gonzy\\Desktop\\DW2\\\' seems to be unknown.
Please, report the following data to the ScummVM team along with name
of the game you tried to add and its version/language/etc.:
{"dw.scn", 0, "ae291aa4ed7f7caacbfb711b6ff2c8bd", 1286264},
{"english.txt", 0, "13865d8ff4170ea6bb024055f793c956", 230790},
{"english.smp", 0, "c595e906cb4bf308d2e80ecf3fd1f4f1", 52519978},

SCUMMVM version 1.2.053093 (Oct 9 2010 11:56:44)
Discworld Mac demo from Micromanía 3a Época Núm. 23 demo CD (published around the game's release date).
Language: English (I guess UK English, since it includes files ENGLISH.IDX, .SMP and .TXT).
Version of the game: Mac (probably CD version, since the whole lot weighs around 100MB).

This demo seems to be unknown up to the moment, which explains it being unsupported (see "Game demos required" on the forums: ).

Here are the demo files as extracted using HFVExplorer:

Ticket imported from: #3110936. Ticket imported from: bugs/5517.

Attachments (1)

micromania10_demodisc-dw_mac_demo.jpg (130.4 KB ) - added by SF/gonsalet 9 years ago.
Demo disc containing Discworld Mac demo (Micromanía 3a Época Núm. 10)

Download all attachments as: .zip

Change History (22)

by SF/gonsalet, 9 years ago

Demo disc containing Discworld Mac demo (Micromanía 3a Época Núm. 10)

comment:1 by fingolfin, 9 years ago

Owner: set to dreammaster

comment:2 by dreammaster, 9 years ago

As clone2727 suggested in the forum thread, the problem is that the resources are being stored in BE format rather than LE, rather than the demo using compression.

comment:3 by dreammaster, 9 years ago

I started experimenting with some code to allow for reading the contents of the files in BE format, but another problem has emerged with the format of the SCN files.

In a standard SCN file, resource chunks are identified by an eight byte header - the first for bytes being the type (normally in the format '0x333400**'), and the remaining four being the offset in the file of the next resource. So it's a fairly simple matter for the code to scan across all the resources in the file by checking each Id, and then using the offset to find the next resource.

In the Macintosh demo, though, whilst the first four bytes seem to be a valid resource Id type in BE format, the 4 bytes for the offset to the next resource don't seeem to be correct.. the values don't match where new resources start, based on an explicit manual view of the data.

It's very strange. The difference between values provided and the correct offset seems to be different for different .scn files, so it's not a simple matter of adjusting the amount by some fixed delta.

I'll try to investigate it some more.

comment:4 by dreammaster, 9 years ago

Another problem with the provided demo dw.scn file is that the CHUNK_PCODE (0x3334000A resource) which is the master script doesn't seem to be present. This makes me wonder whether the provided data files were correctly extracted/copied.

I'm at a limit to what I can do with the demo; I'm unassigning myself from the ticket, and leaving it open. Hopefully someone with a Macintosh system and/or other BE format release can further work on supporting these versions of the game and/or demo.

comment:5 by dreammaster, 9 years ago

Owner: dreammaster removed

comment:6 by SF/gonsalet, 9 years ago

As to the extraction of the Mac files, I followed the steps explained in : I used HFVExplorer and allowed the program to choose the copy mode automatically. Everything seemed to go fine, so I guess the files should be OK as they are now. Of course, if anyone has any suggestion of a better way to extract them, I can just do it again and see if we get something new.

Thanks for having a go at it, dreammaster. Hope someone with a Mac can have a look at it (not my case, just a plain old PC user here).

comment:7 by fingolfin, 9 years ago

Summary: Discworld: Unsupported Mac demoDW: Unsupported Mac demo

comment:8 by fingolfin, 9 years ago

I could take a look at the demo (I have a mac, and am a mac veteran, so know about all those funky old formats ;). Provided somebody tells me where I can find the original, non-extracted files.

comment:9 by SF/gonsalet, 9 years ago

Well, I made an ISO image from the original demo CD, which should contain all the MAC files (as well as the Windows files that we are not interested in).

Would you be able to use that in your MAC? I don't have the ISO around right now, but I'll try to upload it tomorrow. Uhm, I guess I'll have to upload it in chunks, since it's bigger than 200 MB... Well, I'll try and do that and I'll post the links here.

comment:10 by fingolfin, 9 years ago

I should be able to use that ISO image, yes.

Regarding upload, I could create a temporary FTP account so that you can upload it in one piece. Contact me by email (fingolfin AT

comment:11 by SF/gonsalet, 9 years ago

Okay, sorry for the short hiatus, now contacting fingolfin through e-mail... Let's see if we can get that ISO up in the net.

comment:12 by fingolfin, 9 years ago

Got the files. For me, dw.scn is 1272686 bytes big, and not 1286264. And indeed, scanning for chunks works just fine. I verified by inserting some printfs in FindChunk to see if it finds sane values. After removing the "assert(!bigEndian);" in FindChunk(), that is.

It still crashes a it later in Tinsel::DwInitCursor, in this code:
numTrails = FROM_LE_32(pfilm->numreels) - 1;
assert(numTrails <= MAX_TRAILERS);
Inspecting the values, it seems pfilm->numreels really is in BE format. I assume many more places will suffer from similar problems.

Going back to the data files, I assume this means that the files where not "correctly" (?) extracted by Gonzy. Maybe they were extracted in some kind of encoded format (MacBInary, etc.), which are commonly used to transfer Mac files (in order to preserve the so-called "resource fork" and various meta data). Impossible to tell for me, as the original link to the converted files does not work anymore.

But since the DW files don't seem to have a resource fork, it's actually not necessary to encode them in any way. On the other hand, it would be possible to add support for encoded files using the code in common/macresman.*. Not sure whether that would be wotht it, though.

comment:13 by SF/gonsalet, 9 years ago

Just wanted to point out that the extracted files can be downloaded from the demo repository at . If no one else knows how to extract them correctly, I can try again with different extract options.

comment:14 by fingolfin, 9 years ago

I forgot to mention that I also had to remove the check in SetupHandleTable() for TinselV1Mac. I'll commit the relevant changes.

Gonzy, can you try using "raw data" copy mode with HFVExplorer to see if that makes any difference for youß

comment:15 by SF/gonsalet, 9 years ago

OK then, here we go, a new fresh raw extraction of the MAC files using HFVExplorer:

I've included the whole set of files extracted using 3 different options: "raw, data", "raw, fork" and "macbinary 2".

Anyway, I think the interesting one is "raw, data" (in the folder "discworld_raw_data"). The dw.scn file in this case is 1272686 bytes big, just as fingolfin said it should.

So, maybe dreammaster would like to have a look at this new file set, if he's not tired already of this mac demo thing anyway...?

comment:16 by fingolfin, 9 years ago

Thanks for the link to the "old" extracted data files . I had a look at the 1286264 bytes DW.SCN. The file apparently underwent a LF (mac line endings) -> CR/LF (windows line endings) translation, as if it was a text file.
So, that nicely explains why those files are weird. They are corrupt, and I am afraid most probably beyond repair.

comment:17 by SF/gonsalet, 9 years ago

Just a small link update: the latest and best extraction of the MAC files can be found in:

All previous links referenced in this bug report can be ignored, as they are all inactive or they don't contain what they used to.

Hope someone can have a new look at the demo, now that the files should be usable, and make it work in scummvm! Anyway, I guess it's not the biggest priority, and of course it shouldn't be, there's lots of other great things to accomplish out there... Thanks to all devs for their hard work!

comment:18 by bluegr, 7 years ago

Some initial work for this has been done in 3fdddd53b2b970aae3e967bebc0bff6e642a5111

There are still things missing, and it still crashes, but it progresses a bit more now before it dies

comment:19 by bluegr, 7 years ago

More work has been done on this, fixing several endian issues with this version, and the game now starts (both the demo and the full version)

Current missing stuff / TODO:
- The music is skipped for now, as it isn't MIDI
- There are palette issues (some black colors are substituted with white ones)
- The sprite drawing graphics functions are missing, so no sprites are drawn

comment:20 by bluegr, 5 years ago

Owner: set to bluegr
Resolution: fixed
Status: newclosed

comment:21 by bluegr, 5 years ago

This has been implemented and the Mac demo version of DW1 has been working since ScummVM version 1.6.0, together with the Mac full version.

There's one pending bug, where some subtitles appear black with certain compilers (they look OK with MSVC, but not with gcc). This has been filed as bug #6470:

Closing this as fixed

Note: See TracTickets for help on using tickets.