[gnome-games] retro: Adapt to serialization changes
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] retro: Adapt to serialization changes
- Date: Wed, 25 Jan 2017 17:23:12 +0000 (UTC)
commit 31322e0b41adf59b6d549d99a8a35400007f9e28
Author: Adrien Plazas <kekun plazas laposte net>
Date: Wed Jan 25 18:17:04 2017 +0100
retro: Adapt to serialization changes
Use Core.serialize_state() and Core.deserialize_state() instead of
Core.serialize_size(), Core.serialize() and Core.unserialize()
https://bugzilla.gnome.org/show_bug.cgi?id=777489
src/retro/retro-runner.vala | 15 ++-------------
1 files changed, 2 insertions(+), 13 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index 6d1bcc1..45ac153 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -428,11 +428,7 @@ public class Games.RetroRunner : Object, Runner {
if (!core_supports_snapshotting)
return;
- var size = core.serialize_size ();
- var buffer = new uint8[size];
-
- if (!core.serialize (buffer))
- throw new RetroError.COULDNT_WRITE_SNAPSHOT (_("Couldn't write snapshot."));
+ var buffer = core.serialize_state ();
var dir = Application.get_snapshots_dir ();
try_make_dir (dir);
@@ -454,14 +450,7 @@ public class Games.RetroRunner : Object, Runner {
uint8[] data = null;
FileUtils.get_data (snapshot_path, out data);
- var expected_size = core.serialize_size ();
- if (data.length > expected_size)
- /* Not translated as this is not presented to the user */
- throw new RetroError.COULDNT_LOAD_SNAPSHOT ("[%s] Unexpected serialization data size:
got %lu, expected %lu\n", core.file_name, data.length, expected_size);
-
- if (!core.unserialize (data))
- /* Not translated as this is not presented to the user */
- throw new RetroError.COULDNT_LOAD_SNAPSHOT ("Could not load snapshot");
+ core.deserialize_state (data);
}
private void save_media_data () throws Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]