[gnome-games/wip/exalm/3ds: 7/14] List 3DS games in collection
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/3ds: 7/14] List 3DS games in collection
- Date: Thu, 10 Dec 2020 22:33:50 +0000 (UTC)
commit 24a75a60614e021185c6875e9f060612ee4d51c3
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Sun Nov 8 16:05:43 2020 +0500
List 3DS games in collection
Add a simple 3DS plugin for finding games. It doesn't provide a view
switcher like DS plugin yet, since we don't ship any core.
See https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/86
data/org.gnome.Games.desktop.in.in | 2 +-
meson_options.txt | 1 +
plugins/meson.build | 1 +
plugins/nintendo-3ds/data/meson.build | 1 +
plugins/nintendo-3ds/data/nintendo-3ds.plugin | 6 +++
plugins/nintendo-3ds/meson.build | 2 +
plugins/nintendo-3ds/src/meson.build | 16 +++++++
plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala | 58 +++++++++++++++++++++++
8 files changed, 86 insertions(+), 1 deletion(-)
---
diff --git a/data/org.gnome.Games.desktop.in.in b/data/org.gnome.Games.desktop.in.in
index 779e780a..bae7d866 100644
--- a/data/org.gnome.Games.desktop.in.in
+++ b/data/org.gnome.Games.desktop.in.in
@@ -13,4 +13,4 @@ Type=Application
StartupNotify=true
DBusActivatable=true
Categories=GNOME;GTK;Player;Game;
-MimeType=application/vnd.nintendo.snes.rom;application/x-amiga-disk-format;application/x-atari-2600-rom;application/x-atari-7800-rom;application/x-atari-lynx-rom;application/x-cue;application/x-discjuggler-cd-image;application/x-doom-wad;application/x-fds-disk;application/x-gameboy-color-rom;application/x-gameboy-rom;application/x-gamecube-rom;application/x-gamegear-rom;application/x-gba-rom;application/x-gd-rom-cue;application/x-genesis-32x-rom;application/x-genesis-rom;application/x-love-game;application/x-mame-rom;application/x-ms-dos-executable;application/x-n64-rom;application/x-neo-geo-pocket-color-rom;application/x-neo-geo-pocket-rom;application/x-nes-rom;application/x-nintendo-ds-rom;application/x-pc-engine-rom;application/x-playstation-rom;application/x-saturn-rom;application/x-sega-cd-rom;application/x-sega-pico-rom;application/x-sg1000-rom;application/x-sms-rom;application/x-virtual-boy-rom;application/x-wii-rom;application/x-wii-wad;application/x-wonderswan-color-rom;app
lication/x-wonderswan-rom;application/zip;
+MimeType=application/vnd.nintendo.snes.rom;application/x-amiga-disk-format;application/x-atari-2600-rom;application/x-atari-7800-rom;application/x-atari-lynx-rom;application/x-cue;application/x-discjuggler-cd-image;application/x-doom-wad;application/x-fds-disk;application/x-gameboy-color-rom;application/x-gameboy-rom;application/x-gamecube-rom;application/x-gamegear-rom;application/x-gba-rom;application/x-gd-rom-cue;application/x-genesis-32x-rom;application/x-genesis-rom;application/x-love-game;application/x-mame-rom;application/x-ms-dos-executable;application/x-n64-rom;application/x-neo-geo-pocket-color-rom;application/x-neo-geo-pocket-rom;application/x-nes-rom;application/x-nintendo-3ds-executable;application/x-nintendo-3ds-rom;application/x-nintendo-ds-rom;application/x-pc-engine-rom;application/x-playstation-rom;application/x-saturn-rom;application/x-sega-cd-rom;application/x-sega-pico-rom;application/x-sg1000-rom;application/x-sms-rom;application/x-virtual-boy-rom;application/x
-wii-rom;application/x-wii-wad;application/x-wonderswan-color-rom;application/x-wonderswan-rom;application/zip;
diff --git a/meson_options.txt b/meson_options.txt
index fa589741..1012b464 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -17,6 +17,7 @@ option ('libretro-plugin', description: 'Support for Libretro games',
option ('love-plugin', description: 'Support for LÖVE games', type: 'boolean')
option ('mame-plugin', description: 'Support for MAME games', type: 'boolean')
option ('ms-dos-plugin', description: 'Support for MS-DOS games', type: 'boolean')
+option ('nintendo-3ds-plugin', description: 'Support for Nintendo 3DS games', type: 'boolean')
option ('nintendo-64-plugin', description: 'Support for Nintendo 64 games', type: 'boolean')
option ('nintendo-ds-plugin', description: 'Support for Nintendo DS games', type: 'boolean')
option ('playstation-plugin', description: 'Support for PlayStation games', type: 'boolean')
diff --git a/plugins/meson.build b/plugins/meson.build
index f15025bb..015da414 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -6,6 +6,7 @@ plugins = [
'love',
'mame',
'ms-dos',
+ 'nintendo-3ds',
'nintendo-64',
'nintendo-ds',
'playstation',
diff --git a/plugins/nintendo-3ds/data/meson.build b/plugins/nintendo-3ds/data/meson.build
new file mode 100644
index 00000000..0d4b6c49
--- /dev/null
+++ b/plugins/nintendo-3ds/data/meson.build
@@ -0,0 +1 @@
+install_data (plugin_name + '.plugin', install_dir: plugins_dir)
diff --git a/plugins/nintendo-3ds/data/nintendo-3ds.plugin b/plugins/nintendo-3ds/data/nintendo-3ds.plugin
new file mode 100644
index 00000000..f3edf634
--- /dev/null
+++ b/plugins/nintendo-3ds/data/nintendo-3ds.plugin
@@ -0,0 +1,6 @@
+[Plugin]
+Module=libgames-nintendo-3ds-plugin
+Name=Nintendo 3DS Plugin
+Description=Provides support for Nintendo 3DS games.
+Authors=Alexander Mikhaylenko <alexm gnome org>
+Copyright=Copyright © 2020 Alexander Mikhaylenko
diff --git a/plugins/nintendo-3ds/meson.build b/plugins/nintendo-3ds/meson.build
new file mode 100644
index 00000000..d7e84900
--- /dev/null
+++ b/plugins/nintendo-3ds/meson.build
@@ -0,0 +1,2 @@
+subdir ('data')
+subdir ('src')
diff --git a/plugins/nintendo-3ds/src/meson.build b/plugins/nintendo-3ds/src/meson.build
new file mode 100644
index 00000000..a3daa090
--- /dev/null
+++ b/plugins/nintendo-3ds/src/meson.build
@@ -0,0 +1,16 @@
+vala_sources = [
+ 'nintendo-3ds-plugin.vala',
+]
+
+c_args = [
+ '-DG_LOG_DOMAIN="GamesNintendo3DS"'
+]
+
+shared_module (
+ 'games-' + plugin_name + '-plugin',
+ vala_sources,
+ dependencies: gnome_games_dep,
+ c_args: c_args,
+ install: true,
+ install_dir: plugins_dir
+)
diff --git a/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
b/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
new file mode 100644
index 00000000..9290e1cf
--- /dev/null
+++ b/plugins/nintendo-3ds/src/nintendo-3ds-plugin.vala
@@ -0,0 +1,58 @@
+// This file is part of GNOME Games. License: GPL-3.0+.
+
+private class Games.Nintendo3DsPlugin : Object, Plugin {
+ private const string 3DS_MIME_TYPE = "application/x-nintendo-3ds-rom";
+ private const string 3DSX_MIME_TYPE = "application/x-nintendo-3ds-executable";
+ private const string PLATFORM_ID = "Nintendo3DS";
+ private const string PLATFORM_NAME = _("Nintendo 3DS");
+ private const string PLATFORM_UID_PREFIX = "nintendo-3ds";
+ private const string[] MIME_TYPES = { 3DS_MIME_TYPE, 3DSX_MIME_TYPE };
+
+ private static RetroPlatform platform;
+
+ static construct {
+ platform = new RetroPlatform (PLATFORM_ID, PLATFORM_NAME, MIME_TYPES, PLATFORM_UID_PREFIX);
+ }
+
+ public Platform[] get_platforms () {
+ return { platform };
+ }
+
+ public string[] get_mime_types () {
+ return MIME_TYPES;
+ }
+
+ public UriGameFactory[] get_uri_game_factories () {
+ var game_uri_adapter = new GenericGameUriAdapter (game_for_uri);
+ var factory = new GenericUriGameFactory (game_uri_adapter);
+ foreach (var mime_type in MIME_TYPES)
+ factory.add_mime_type (mime_type);
+
+ return { factory };
+ }
+
+ public RunnerFactory[] get_runner_factories () {
+ var factory = new RetroRunnerFactory (platform);
+
+ return { factory };
+ }
+
+ private static Game game_for_uri (Uri uri) throws Error {
+ var uid = new Uid (Fingerprint.get_uid (uri, PLATFORM_UID_PREFIX));
+ var title = new FilenameTitle (uri);
+ var media = new GriloMedia (title, 3DS_MIME_TYPE);
+ var cover = new CompositeCover ({
+ new LocalCover (uri),
+ new GriloCover (media, uid)});
+
+ var game = new Game (uid, uri, title, platform);
+ game.set_cover (cover);
+
+ return game;
+ }
+}
+
+[ModuleInit]
+public Type register_games_plugin (TypeModule module) {
+ return typeof (Games.Nintendo3DsPlugin);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]