[Scummvm-devel] PS2 #19 : games : special saved files : important
Max Horn
max at quendi.de
Mon Mar 2 20:59:26 CET 2009
Am 02.03.2009 um 01:08 schrieb sunmax at libero.it:
> On the PS2 we have dire limitations on MC folder contents, where we
> can only store up to 16 files (IIRC), so we cannot just have sword1.*
> and samnmax.s* pollute all the space, so we resort to a trick where
> we create a subfolder for each game:
>
> mc0:ScummVM/simon2/000.sav
>
> mc0:ScummVM/sword1/000.sav
>
> So you can save up to 16 games for each folder, which ain't too bad.
>
> Too achieve that we "trap" the filename, when the engine try to save
> and split it so that we use the first part of it to map it to a sub
> folder. When loading we map it back to canonical engine name, e.g.
> mc0:ScummVM/sword1/000.sav would be converted back to sword1.000.
>
> It seems perfect until you realize that some engines have special
> cases, eg.
Well, actually, it doesn't seem quite that perfect to me -- it's a
hack. Mind you, a reasonable hack, and I fully agree with you doing it
that way. But far better would be to revise the SavefileManager API to
make such a hack unnecessary, I would think. That's nothing for
0.13.x, though, but rather for 0.14.x (or 1.0, anybody? :).
One possible way to do such a modification would be to add a
"gameprefix" parameter to all relevant API calls. That would be set to
either the targetname, or the gameid (the latter if we want to be able
to exchange file between game variants; to be used with utmost care).
Then it is up to the backend whether it simply concatenates the
gameprefix and the filename, or maps this to subdirectories as you do.
So openForSaving("indy3.001") would becomes openForSaving("indy3", ".
001"), and openForLoading("sword2-settings.dat") then
openForLoading("sword2", "-settings.dat");. And to search for saves,
well, you call
listSavefiles("monkey2", "???");
instead of the current
listSavefiles("monkey2.???");
Well, that immediately showcases one ugliness, namely that some
engines uses "TARGET.ext", some use "TARGET-name.ext", and I think for
HE games, we use "TARGETname.ext" (?). And we use mixtures in some
places, too...
Maybe we should strive to unify that: Force all saves to be of either
the form "TARGET.ext" or "TARGET-name.ext". Do so by making the API
openForSaving(TARGET, "name", "ext")
openForSaving(TARGET, "", "ext")
which in the default savefile manager would produce the correct names.
Oh and listSavefiles would be called like this:
listSavefiles(TARGET, "name", "???");
listSavefiles(TARGET, "", "???");
Anything not fitting into the unified naming scheme would have to be
auto-renamed. But I am not sure whether this is worth the effort. Ah
well.
[...]
> a) to require that engine coders use a standard, where the first
> part of a load/save file is always the name of the game?
>
> Ie: iq-points -> indy4.iq
> SAVEGAME.inf -> sword1.inf
> etc.
As Johannes already pointed out, the SAVEGAME.INF case is already
resolved. As for IQ points: As Johannes indicated, these are handled
by game scripts. But it would be easy (and a good idea) to change the
code for this opcode to prefix the filename with the target string (or
gameid?). Possibly with some backward compatibility code to load the
file with the old name... Or just forget about that, the IQ points are
not working properly anyway :).
As for "etc." -- I am not aware of any other cases, but if there are,
>
> This would -greatly- help the PS2 backend maintenance cause
> we won't have to keep a list of exceptions for those files.
>
> b) if an engine fails to do so, is there a way to fetch the
> name of the "engine" used and "game" run anywhere?
>
> Eg. can I check something to know I'm running Scumm/Indy4 ?
You could use ConfMan.getActiveDomain() to determine the target name,
and ConfMan.get("gameid") to obtain the gameid (careful, though,
gameid might be empty, in which case ConfMan.getActiveDomain() doubles
as gameid. I guess we should enforce a gameid to be present in all
cases).
Of course this is somewhat hackish, so ideally doing this should be
only for a temporary emergency workaround... However, several ports
rely on this kind of trick, and have so for a long time -- to my
regret. As far as I can tell, they mostly use this to decide on
keyboard (re)mapping. The NDS, WinCE, Symbian and Maemo ports, at
least, too
>
> I am especially worried now that after FreeSCI merge there
> will be many more savefiles standards, exceptions, etc.
Actually, in SCI, *all* saves are prefixed by the targetname, like
"TARGET-realname.ext".
Bye,
Max
More information about the Scummvm-devel
mailing list