[gnome-games/wip/exalm/ds: 6/13] retro-runner: Add functions for extra metadata
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/ds: 6/13] retro-runner: Add functions for extra metadata
- Date: Tue, 13 Aug 2019 23:27:46 +0000 (UTC)
commit 253a0ca637355e6a2a58bc0bb57b153be1818df3
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Tue Aug 13 00:02:35 2019 +0500
retro-runner: Add functions for extra metadata
Savestate subclasses will need to load their metadata. Since currently
all metadata is provided at once via set_metadata_manual() or
save_extra_savestate_metadata() and is written right there, any extra
metadata for subclasses needs to be supplied before it, and it will be
written via a callback in Savestate itself, added in the following commit.
This will be used in the following commits to store extra metadata for
Nintendo DS games.
src/retro/retro-runner.vala | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 55aa633c..06365444 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -221,6 +221,8 @@ public class Games.RetroRunner : Object, Runner {
if (previewed_savestate.has_media_data ())
media_set.selected_media_number = previewed_savestate.get_media_data ();
+ load_extra_savestate_metadata (previewed_savestate);
+
is_ready = true;
}
@@ -254,6 +256,9 @@ public class Games.RetroRunner : Object, Runner {
core.reset ();
loop.start ();
+
+ load_extra_savestate_metadata (latest_savestate);
+
running = true;
}
@@ -492,12 +497,20 @@ public class Games.RetroRunner : Object, Runner {
var now_time = new DateTime.now ();
var platform_prefix = platform.get_uid_prefix ();
var ratio = get_screenshot_aspect_ratio ();
+
+ // FIXME: Because of how saving metadata is done currently, saving
+ // any additional data has to be done before the keyfile is written
+ save_extra_savestate_metadata (tmp_live_savestate);
+
if (is_automatic)
- tmp_live_savestate.set_metadata_automatic (now_time, platform_prefix, get_core_id (),
ratio);
+ tmp_live_savestate.set_metadata_automatic (now_time, platform_prefix,
+ get_core_id (), ratio);
else {
var savestate_name = create_new_savestate_name ();
- tmp_live_savestate.set_metadata_manual (savestate_name, now_time, platform_prefix,
get_core_id (), ratio);
+ tmp_live_savestate.set_metadata_manual (savestate_name, now_time,
+ platform_prefix, get_core_id (),
+ ratio);
}
// Save the tmp_live_savestate into the game savestates directory
@@ -691,5 +704,11 @@ public class Games.RetroRunner : Object, Runner {
}
}
}
+
+ protected virtual void save_extra_savestate_metadata (Savestate savestate) {
+ }
+
+ protected virtual void load_extra_savestate_metadata (Savestate savestate) {
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]