Open magnetardev opened 2 months ago
Okay, so pretty much everything here besides controller bindings and settings is figured out:
It really just needs a more unified API so that core data stuff is more or less abstracted away, which will likely help streamline CloudKit integration and also help if we migrate to something like SwiftData down the line.
Controller bindings could probably just be stored as the following, where the data field is a codable-encoded representation of the bindings.
id: UUID
auxId: String
system: GameSystem
game: Game?
kind: ControlBindingKind
data: Data
Settings is a bit trickier and I'm not really sure what to do about them. The basic settings could just be tossed into UserDefaults
, but game-specific settings would be a nice feautre as well as core-specific settings. Here's the basic stuff I've had in the back of my mind:
Okay so I've centralized a lot of the APIs and I think everything Core Data related is now abstracted in a reasonable way.
I've also made two big improvements:
NSManagedObject.prepareForDeletion
method.Those two things will improve data consistency substantially, and this applies for the three entities where it matters: Game, ImageAsset, and SaveState.
Now that the API is cleaner, the remaining storage-related things are:
Psudeo-code of some of the tables/general storage stuff we'll need:
"\(gameId).save.\(saveExtension)"