[gnome-games/wip/aplazas/speedup-collection] Try to find slow code points
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/aplazas/speedup-collection] Try to find slow code points
- Date: Wed, 24 May 2017 11:27:35 +0000 (UTC)
commit 3032c75c6fc934159c24d77c7257f578395ca590
Author: Adrien Plazas <kekun plazas laposte net>
Date: Mon May 22 15:24:23 2017 +0200
Try to find slow code points
plugins/Makefile.am | 4 -
plugins/pc-engine/src/pc-engine-plugin.vala | 13 +---
.../playstation/src/playstation-game-factory.vala | 98 ++++++++++----------
src/ui/collection-icon-view.vala | 4 +-
4 files changed, 52 insertions(+), 67 deletions(-)
---
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index cd409c4..3cfe3a0 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -44,10 +44,6 @@ if ENABLE_LOVE_PLUGIN
SUBDIRS += love
endif
-if ENABLE_MAME_PLUGIN
-SUBDIRS += mame
-endif
-
if ENABLE_MASTER_SYSTEM_PLUGIN
SUBDIRS += master-system
endif
diff --git a/plugins/pc-engine/src/pc-engine-plugin.vala b/plugins/pc-engine/src/pc-engine-plugin.vala
index a6370de..d184416 100644
--- a/plugins/pc-engine/src/pc-engine-plugin.vala
+++ b/plugins/pc-engine/src/pc-engine-plugin.vala
@@ -62,12 +62,8 @@ private class Games.PcEnginePlugin : Object, Plugin {
private static bool is_valid_disc (Uri uri) throws Error {
var file = uri.to_file ();
- var file_info = file.query_info (FileAttribute.STANDARD_CONTENT_TYPE,
FileQueryInfoFlags.NONE);
- var mime_type = file_info.get_content_type ();
File bin_file;
- switch (mime_type) {
- case CUE_MIME_TYPE:
var cue = new CueSheet (file);
if (cue.tracks_number < 2)
return false;
@@ -78,16 +74,9 @@ private class Games.PcEnginePlugin : Object, Plugin {
bin_file = track.file.file;
- break;
- // TODO Add support for binary files.
- default:
- return false;
- }
-
var path = bin_file.get_path ();
- var offsets = Grep.get_offsets (path, CD_MAGIC_VALUE);
- return offsets.length > 0;
+ return true;
}
}
diff --git a/plugins/playstation/src/playstation-game-factory.vala
b/plugins/playstation/src/playstation-game-factory.vala
index 769b487..1eb1ebb 100644
--- a/plugins/playstation/src/playstation-game-factory.vala
+++ b/plugins/playstation/src/playstation-game-factory.vala
@@ -51,78 +51,78 @@ public class Games.PlayStationGameFactory : Object, UriGameFactory {
return;
var file = uri.to_file ();
- var file_info = file.query_info (FileAttribute.STANDARD_CONTENT_TYPE,
FileQueryInfoFlags.NONE);
- var mime_type = file_info.get_content_type ();
+ // var file_info = file.query_info (FileAttribute.STANDARD_CONTENT_TYPE,
FileQueryInfoFlags.NONE);
+ // var mime_type = file_info.get_content_type ();
File bin_file;
- switch (mime_type) {
- case CUE_MIME_TYPE:
- var cue = new CueSheet (file);
- if (cue.tracks_number == 0)
- return;
+ // switch (mime_type) {
+ // case CUE_MIME_TYPE:
+ // var cue = new CueSheet (file);
+ // if (cue.tracks_number == 0)
+ // return;
- var track = cue.get_track (0);
- if (track.track_mode != CueSheetTrackMode.MODE1_2352 &&
- track.track_mode != CueSheetTrackMode.MODE2_2352)
- return;
+ // var track = cue.get_track (0);
+ // if (track.track_mode != CueSheetTrackMode.MODE1_2352 &&
+ // track.track_mode != CueSheetTrackMode.MODE2_2352)
+ // return;
- bin_file = track.file.file;
+ // bin_file = track.file.file;
- break;
+ // break;
// TODO Add support for binary files.
- default:
- return;
- }
+ // default:
+ // return;
+ // }
- var header = new PlayStationHeader (bin_file);
- header.check_validity ();
- var disc_id = header.disc_id;
+ // var header = new PlayStationHeader (bin_file);
+ // header.check_validity ();
+ // var disc_id = header.disc_id;
- var gameinfo = get_gameinfo ();
- var disc_set_id = gameinfo.get_disc_set_id_for_disc_id (disc_id);
+ // var gameinfo = get_gameinfo ();
+ // var disc_set_id = gameinfo.get_disc_set_id_for_disc_id (disc_id);
- return_if_fail (media_for_disc_id.contains (disc_id) == game_for_disc_set_id.contains
(disc_set_id));
+ // return_if_fail (media_for_disc_id.contains (disc_id) == game_for_disc_set_id.contains
(disc_set_id));
// Check whether we already have a media and by extension a media set
// and a game for this disc ID. If such a case, simply add the new URI.
- if (media_for_disc_id.contains (disc_id)) {
- var media = media_for_disc_id.lookup (disc_id);
- media.add_uri (uri);
- game_for_uri[uri] = game_for_disc_set_id[disc_set_id];
+ // if (media_for_disc_id.contains (disc_id)) {
+ // var media = media_for_disc_id.lookup (disc_id);
+ // media.add_uri (uri);
+ // game_for_uri[uri] = game_for_disc_set_id[disc_set_id];
- return;
- }
+ // return;
+ // }
// A game correspond to this URI but we don't have it yet: create it.
- var new_medias = new HashTable<string, Media> (str_hash, str_equal);
- Media[] new_medias_array = {};
- var new_disc_ids = gameinfo.get_disc_set_ids_for_disc_id (disc_id);
- foreach (var new_disc_id in new_disc_ids) {
- assert (!media_for_disc_id.contains (new_disc_id));
+ // var new_medias = new HashTable<string, Media> (str_hash, str_equal);
+ // Media[] new_medias_array = {};
+ // var new_disc_ids = gameinfo.get_disc_set_ids_for_disc_id (disc_id);
+ // foreach (var new_disc_id in new_disc_ids) {
+ // assert (!media_for_disc_id.contains (new_disc_id));
- var title = new GameinfoDiscIdDiscTitle (gameinfo, new_disc_id);
- var media = new Media (title);
- new_medias_array += media;
- new_medias[new_disc_id] = media;
- }
+ // var title = new GameinfoDiscIdDiscTitle (gameinfo, new_disc_id);
+ // var media = new Media (title);
+ // new_medias_array += media;
+ // new_medias[new_disc_id] = media;
+ // }
- var media = new_medias.lookup (disc_id);
- media.add_uri (uri);
+ // var media = new_medias.lookup (disc_id);
+ // media.add_uri (uri);
- var icon = GLib.Icon.new_for_string (ICON_NAME);
- var media_set = new MediaSet (new_medias_array, icon);
- var game = create_game (media_set, disc_set_id, uri);
+ // var icon = GLib.Icon.new_for_string (ICON_NAME);
+ // var media_set = new MediaSet (new_medias_array, icon);
+ // var game = create_game (media_set, disc_set_id, uri);
// Creating the Medias, MediaSet and Game worked, we can save them.
- foreach (var new_disc_id in new_medias.get_keys ())
- media_for_disc_id[new_disc_id] = new_medias[new_disc_id];
+ // foreach (var new_disc_id in new_medias.get_keys ())
+ // media_for_disc_id[new_disc_id] = new_medias[new_disc_id];
- game_for_uri[uri] = game;
- game_for_disc_set_id[disc_set_id] = game;
- games.add (game);
- game_added (game);
+ // game_for_uri[uri] = game;
+ // game_for_disc_set_id[disc_set_id] = game;
+ // games.add (game);
+ // game_added (game);
}
public async void foreach_game (GameCallback game_callback) {
diff --git a/src/ui/collection-icon-view.vala b/src/ui/collection-icon-view.vala
index 59cc50f..ae177cb 100644
--- a/src/ui/collection-icon-view.vala
+++ b/src/ui/collection-icon-view.vala
@@ -31,7 +31,7 @@ private class Games.CollectionIconView : Gtk.Stack {
}
model_changed_id = model.items_changed.connect (on_items_changed);
- flow_box.invalidate_sort ();
+ // flow_box.invalidate_sort ();
}
}
@@ -49,7 +49,7 @@ private class Games.CollectionIconView : Gtk.Stack {
construct {
flow_box.max_children_per_line = uint.MAX;
flow_box.set_filter_func (filter_box);
- flow_box.set_sort_func (sort_boxes);
+ // flow_box.set_sort_func (sort_boxes);
}
[GtkCallback]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]