[Scummvm-devel] kyra.dat

Johannes Schickel lordhoto at scummvm.org
Mon Jul 13 23:05:24 CEST 2009


Max Horn wrote:
> My two cents: I wouldn't waste time trying to extend the file handling  
> system in KYRA with a generic solution to this, since it's not a  
> generic problem: One single file in Kyra is absolutely central and  
> needs to be accessed again and again and again. That alone seems to  
> warrant treating it differently...
>   

To be precise it's only accessed again and again on engine start up so 
far. That is since I never got around to load only the static data 
needed in the current game part into memory. The "StaticResource" class 
has the possibility for that, just the code doesn't use that yet. This 
results in all static resources being load on game startup.

> Here's what I'd do: Locate the right kyra.dat once at the start of the  
> game. Then, open it, and keep it open. And then modify the place where  
> it normally would be opened with a check "if (filename == "kyra.dat")  
> return _kyraDatHandle;".
> A mild complication would crop up if your code expects to receive  
> ownership of the stream object. Well, that could be resolved by  
> returning a new SubReadStream wrapping the real stream.
>
> I recall that the kyra file code is rather advanced and complicated,  
> but I would hope that it only opens the actual file in 1-2 central  
> places, so only those would have to be changed with the above  
> mentioned check...
>   

These days there's a central place for that. (Even at the time it was 
even more complicated there was a single place :-P).

> So far for the theory, now its your turn to tell us why the above  
> won't work :)
>   

It will work aye, that's one of the possibilities I thought of to be 
precise. Still KYRA does open a PAK file on scene enter at least 3 
times, sometimes more, so I thought it might help to have a more generic 
file caching to resolve possible problems there too. That applies to the 
CD versions of the games btw. the floppy versions (at least Kyra1 
floppy) is different there.

// Johannes




More information about the Scummvm-devel mailing list