[Scummvm-devel] kyra.dat
Max Horn
max at quendi.de
Mon Jul 13 22:54:59 CEST 2009
Am 12.07.2009 um 22:28 schrieb Johannes Schickel:
> sunmax at libero.it wrote:
>> Hi Johannes,
>
[...]
> Opening a file is done on a completely different basis. And in fact
> there is no easy way to keep a file open. I might implement a cache
> for
> that inside KYRA. I can't promise anything here though, since that
> might
> take some time till I find a clean way of implementing it. On the
> other
> hand I might just rework our static resource code in KYRA, but that
> will
> be too risky for the next release. Maybe I'll just add some HACK to
> the
> 1.0.0 branch which keeps it open for some time... :-).
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...
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...
So far for the theory, now its your turn to tell us why the above
won't work :)
Cheers,
Max
More information about the Scummvm-devel
mailing list