Opened 13 years ago

Last modified 3 months ago

#7502 new enhancement

ALL: Check for presence and validity of external data files

Reported by: SF/clemty Owned by:
Priority: normal Component: --Other--
Keywords: Cc:


- damaged scummvm datafiles prevent games from playing
- scummvm gives only cryptic information when the
datafiles are damaged

after running into a similar problem with sky.cpt, I
think joostp added a size check which would complain if
the datafile was not present in its entirety - maybe
add that to ScummVM as well?

here's the problem with kyra on the forum

Ticket imported from: #1520433. Ticket imported from: feature-requests/318.

Change History (13)

comment:1 Changed 13 years ago by SF/clemty

Owner: set to lordhoto

comment:2 Changed 13 years ago by fingolfin

Definitely sounds like a good idea. We should do that for all the external data
files, i.e.


We should first check for the presence of the file, and if missing, show an
approriate error *dialog*. Next, run some simply integrity check on the files
(minimal file size, a fixed header, whatever), and if that fails, display
*another* dialog, telling that the data file is likely corrupt.
And ideally, a third dialog would be shown if the data file was outdated.

comment:3 Changed 13 years ago by fingolfin

Summary: kyra: check size of kyra.datALL: Check for presence and validity of external data files

comment:4 Changed 13 years ago by sev-

data file structure:

TAG VER LENGTH data block MD5

1. Check TAG that file is valid
2. Check version
3. Check LENGTH
4. Calculate MD5 and match

This will be easy to implement and will be universal enough
to avoid any hardcoded file details.

comment:5 Changed 13 years ago by SF/clemty

wouldn't that require an update to all data files?

I think lordhoto once mentioned that kyra.dat is the same
format as the kyra .pak files

comment:6 Changed 13 years ago by sev-

Yes, but that will be done only once and will save us from
these periodic bogus bugreports.

comment:7 Changed 13 years ago by lordhoto

Owner: lordhoto deleted

comment:8 Changed 13 years ago by lordhoto

The current Kyrandia implementation hardcodes the size in
the ScummVM sourcecode, if someones implements the described
'data file structure' in a generic way I'll change the
Kyrandia code to support it. I'm changing the 'Assigned To'
field to None for now, since I'm not working on a generic
way, so any other developer can feel free to implement it
and as I, said before, will change the Kyrandia code then.

comment:9 Changed 12 years ago by lordhoto

I would use a structure like this though:
TAG \ (maybe this field could be engine depended too)
VER | Datafile header
MD5 /

DATAFILE > Engine specific stuff

I don't see much sense behind adding the MD5 at the file end.

comment:10 Changed 12 years ago by vinterstum

We could also preserve at least some measure of backwards
compatability by trying to load the file as the old format
if it fails the integrity check, and just display a 'Your
copy of kyra.dat may be outdated or corrupted' message
(given that the current format of kyra.dat would use invalid
fields for the integrity check, and always fail it).

It doesn't really make sense to force people to download a
new version of kyra.dat for an integrity check when they
know their current one works fine :).

comment:11 Changed 12 years ago by SF/clemty

maybe simply add a size-check for now, add the more
sophisticated check the next time kyra.dat changes (or if it
is stable, with the next stable version?)

comment:12 Changed 12 years ago by lordhoto

Clemmy: we have that size check by now.

We should just try to load kyra.dat/otherdatafile in the old
style way if just the TAG check failed, we should add a
return value in the loading function which tells what failed
while trying to load it the new way IMHO.

comment:13 Changed 3 months ago by digitall

Component: --Other--
Note: See TracTickets for help on using tickets.