Commit 9a5fa428 authored by Alexander Mikhaylenko's avatar Alexander Mikhaylenko

nintendo-ds: Add NintendoDsSavestate

This special savestate stores screen layout and which screen is visible
if quick switch is used.

NintendoDsRunner is supposed to override load_extra_savestate_metadata(),
call load_extra_metadata() from it and use the property values.

Similarly, it overrides save_extra_savestate_metadata() and change the
properties, so that later they are written into the keyfile.
parent 720fef99
......@@ -6,6 +6,7 @@ vala_sources = [
'nintendo-ds-platform.vala',
'nintendo-ds-plugin.vala',
'nintendo-ds-runner.vala',
'nintendo-ds-savestate.vala',
]
c_sources = [
......
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.NintendoDsSavestate : Savestate {
public NintendoDsLayout screen_layout { get; set; }
public bool view_bottom_screen { get; set; }
public void load_extra_metadata () {
var keyfile = get_metadata ();
try {
var layout_value = keyfile.get_string ("Nintendo DS", "Screen Layout");
view_bottom_screen = keyfile.get_boolean ("Nintendo DS", "View Bottom Screen");
screen_layout = NintendoDsLayout.from_value (layout_value);
}
catch (KeyFileError e) {
critical ("Failed to get Nintendo DS metadata from metadata file for savestate at %s: %s", path, e.message);
return;
}
}
protected override void save_extra_metadata (KeyFile keyfile) {
keyfile.set_string ("Nintendo DS", "Screen Layout", screen_layout.get_value ());
keyfile.set_boolean ("Nintendo DS", "View Bottom Screen", view_bottom_screen);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment