Opened 22 months ago

Last modified 2 weeks ago

#14159 pending defect (pending)

GRIM: MD5 dialog can’t be cancelled in Grim Fandango

Reported by: ccawley2011 Owned by:
Priority: normal Component: Common
Version: Keywords:
Cc: Game:

Description

The MD5 dialog in Grim doesn’t have a cancel button, so it’s necessary to wait until all files are checked before ScummVM can be interacted with. It also doesn’t appear to poll for events, which means that on a cooperatively multitasked operating system like RISC OS it’s not possible to interact with anything outside of ScummVM either.

Change History (7)

comment:1 by deckarep, 13 months ago

Hi ScummVM Team,

I was looking at this bug to see if I can contribute a patch to improve it and I discovered that one of the reasons the md5 detection code for the GRIM engine is slow is that it's doing an md5 checksum of the full file (all bytes).

However,

It seems like somewhere Grim is supposed to check only 5k bytes per this function:

./scummvm --md5 --md5-path=<file> --md5-engine=grim

Notice the output says:
VOX0001.LAB: <hash> (first 5000 bytes), <size> bytes

Since Grim has a lot of files with some being quite large to check for it might be good to modify this related code to cap all md5 checks at 5k bytes to speed up this process for end users.

I'm not sure why there's an inconsistency here but there is a potential for this md5 integrity check code to be much faster.

comment:2 by sev-, 12 months ago

Would be nice to get fixed before 2.8.0 release

comment:3 by somaen, 12 months ago

Grim intentionally checks the entire file of all the files, as we had a lot of issues with bugs filed from scratched CDs. That said, we should fix the UX issues here.

comment:4 by aquadran, 2 weeks ago

Owner: set to aquadran
Resolution: assigned
Status: newpending

comment:5 by aquadran, 2 weeks ago

Component: Engine: GrimCommon
Owner: aquadran removed
Priority: highnormal
Resolution: assignedpending
Summary: GRIM: MD5 dialog can’t be cancelledMD5 dialog can’t be cancelled in Grim Fandango

MD5 check use common MD5 checksum code which read whole file at once, there is no any possible polling while reading file.
This is limitation of MD5 code, not engine specific issue.
Also its performance issue depends on speed access to read files.

comment:6 by sev-, 2 weeks ago

This could be implemented if we make our md5 checksum more granular.

I see two approaches:

  1. Pass a callback and number of bytes or milliseconds to call in-between. This might not truly work in GUI, though due to race condition on screen updating
  2. Implement state for md5, so it is re-entrant, something like
  md5.setup(data, size, milliseconds);

  while (md5.process()) {
     update_gui();
  }

  checksum = md5.getResult();

comment:7 by sev-, 2 weeks ago

Summary: MD5 dialog can’t be cancelled in Grim FandangoGRIM: MD5 dialog can’t be cancelled in Grim Fandango
Note: See TracTickets for help on using tickets.