[Scummvm-devel] SAGA - found the issue

Johannes Schickel lordhoto at scummvm.org
Wed Nov 25 20:22:58 CET 2009


yotam barnoy wrote:
> OK Max's strategy paid off!
>
> I was able to lock in on the problem using his idea in no time...
>
> The culprit is the few lines
>            // sanity check
>            if ((resourceData->offset > (uint)context->file->size()) || 
> (resourceData->size > contextSize)) {
>                result = false;
>                break;
>
> in saga/resource.cpp, function loadResContext_v1 (and I imagine v2 has 
> the same thing).
>
> This is repeated inside a loop that sometimes loops 3000 times and 
> sometimes 1000 times. Size() is an expensive operation for the PSP, 
> and this value should be stored in a variable. I'm guessing that when 
> I run it off the PC it is cached.

Sounds fine to use a variable in the engine for it. Of course if you 
would add a cached value for it in the PSP's file stream implementation 
it would assure that no other engine might have slow downs because of 
this. But maybe that's overkill... :-).

// Johannes




More information about the Scummvm-devel mailing list