xoreos / xoreos

A reimplementation of BioWare's Aurora engine (and derivatives). Pre-pre-alpha :P
https://xoreos.org/
GNU General Public License v3.0
1.09k stars 121 forks source link

KOTOR: Implement game saving/loading #235

Closed seedhartha closed 5 years ago

seedhartha commented 6 years ago

Should the original file format be used though? Loading it is no big deal while saving in it might prove problematic.

DrMcCoy commented 6 years ago

Yes, I'd like xoreos to read and write the original save file format. So far, I haven't seen why it might be problematic.

Since a lot of the stuff inside the save files is GFFs, we can even be a bit more flexible there. We could add our own optional fields, for example.

And if we support some optional feature in the future that the original can't do and the user enabled this, we can probably even increase a version field somewhere so that the original game rejects the save. For NWN, there's fields in the IFO for minimal game version and expansions needed, and I guess something similar would work for KotOR as well.

What we do need, however, is a GFF3 writer. xoreos can't do that yet.

I have a local WIP branch that adds methods to GFF3File and GFF3Struct to modify values there. But I'm not sure whether we want GFF3File to be able to write GFFs itself, or a separate GFF3Writer class that can take a GFF3File and write it to disk (and also maybe write one completely dynamically from code without a GFF3File).

(Likewise, for the Dragon Ages, we will need a GFF4 writer.)

Nostritius commented 6 years ago

I think we also need an erf packer, because the save formats at least in kotor are packed inside an erf archive.

DrMcCoy commented 6 years ago

True, yes.

ERF writer necessary for:

No ERF writer necssary for:

No idea:

DrMcCoy commented 6 years ago

(Narf, sorry, butter fingers McCoy hit the wrong button :P)

Nostritius commented 6 years ago

For Reference: After I finally managed to extract a valid sonic rom, I took a look into the save format. An nds cartridge has basically a big rom, where the data resides, and a much smaller eeprom for writing save data (64 Kb in the case of sonic). The bad news is, that what is written there, seems to be some custom format, starting after the "VB" magic id.