[gnome-games/wip/exalm/ds: 8/16] 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: 8/16] retro-runner: Add functions for extra metadata
- Date: Wed, 14 Aug 2019 08:10:27 +0000 (UTC)
commit 8c4ec8b18c67acfe0d57d9ccb11de345652d18b0
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
set_metadata_automatic() and is written right there, any extra metadata
for subclasses needs to be supplied before it, and it will be written via
a virtual method 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 7080fa6e..8dcfee8c 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -217,6 +217,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;
}
@@ -250,6 +252,9 @@ public class Games.RetroRunner : Object, Runner {
core.reset ();
loop.start ();
+
+ load_extra_savestate_metadata (latest_savestate);
+
running = true;
}
@@ -488,12 +493,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
@@ -673,5 +686,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]