Commit 02cdc7f4 authored by AndreiLisita's avatar AndreiLisita 🎮

plugins: Add MS-DOS plugin

parent 48c4fbed
Pipeline #44691 passed with stages
in 17 minutes and 15 seconds
......@@ -16,6 +16,7 @@ option ('game-cube-plugin', description: 'Support for GameCube games',
option ('libretro-plugin', description: 'Support for Libretro games', type: 'boolean')
option ('love-plugin', description: 'Support for LÖVE games', type: 'boolean')
option ('mame-plugin', description: 'Support for MAME games', type: 'boolean', value: false)
option ('ms-dos-plugin', description: 'Support for MS-DOS 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')
option ('sega-cd-plugin', description: 'Support for Sega CD games', type: 'boolean')
......
......@@ -5,6 +5,7 @@ plugins = [
'libretro',
'love',
'mame',
'ms-dos',
'nintendo-ds',
'playstation',
'sega-cd',
......
install_data (plugin_name + '.plugin', install_dir: plugins_dir)
[Plugin]
Module=libgames-ms-dos-plugin
Name=MS-DOS Plugin
Description=Provides support for MS-DOS games.
Authors=Andrei Lisita <andreii.lisita@gmail.com>
Copyright=Copyright © 2018 Andrei Lisita
subdir ('data')
subdir ('src')
vala_sources = [
'ms-dos-input-capabilities.vala',
'ms-dos-plugin.vala',
]
c_args = [
'-DG_LOG_DOMAIN="GamesMsDos"'
]
shared_module (
'games-' + plugin_name + '-plugin',
vala_sources,
dependencies: gnome_games_dep,
c_args: c_args,
install: true,
install_dir: plugins_dir
)
// This file is part of GNOME Games. License: GPL-3.0+.
public class Games.MsDosInputCapabilities : Object, InputCapabilities {
public bool get_allow_classic_gamepads () throws Error {
return true;
}
public bool get_allow_analog_gamepads () throws Error {
return true;
}
public bool get_allow_keyboard_mode () {
return true;
}
}
// This file is part of GNOME Games. License: GPL-3.0+.
private class Games.MsDosPlugin : Object, Plugin {
private const string FINGERPRINT_PREFIX = "ms-dos";
private const string MIME_TYPE = "application/x-ms-dos-executable";
private const string PLATFORM_ID = "MSDOS";
private const string PLATFORM_NAME = _("MS-DOS");
private static Platform platform;
static construct {
platform = new GenericPlatform (PLATFORM_ID, PLATFORM_NAME);
}
public UriGameFactory[] get_uri_game_factories () {
var game_uri_adapter = new GenericGameUriAdapter (game_for_uri);
var factory = new GenericUriGameFactory (game_uri_adapter);
factory.add_mime_type (MIME_TYPE);
return { factory };
}
private static Game game_for_uri (Uri uri) throws Error {
var uid = new FingerprintUid (uri, FINGERPRINT_PREFIX);
var title = new FilenameTitle (uri);
var media = new GriloMedia (title, MIME_TYPE);
var release_date = new GriloReleaseDate (media);
var cooperative = new GriloCooperative (media);
var genre = new GriloGenre (media);
var players = new GriloPlayers (media);
var developer = new GriloDeveloper (media);
var publisher = new GriloPublisher (media);
var description = new GriloDescription (media);
var rating = new GriloRating (media);
var cover = new CompositeCover ({
new LocalCover (uri),
new GriloCover (media, uid)});
var core_source = new RetroCoreSource (platform, { MIME_TYPE });
var input_capabilities = new MsDosInputCapabilities();
var runner = new RetroRunner (core_source, uri, uid, title, input_capabilities);
var game = new GenericGame (uid, title, platform, runner);
game.set_cover (cover);
game.set_release_date (release_date);
game.set_cooperative (cooperative);
game.set_genre (genre);
game.set_players (players);
game.set_developer (developer);
game.set_publisher (publisher);
game.set_description (description);
game.set_rating (rating);
return game;
}
}
[ModuleInit]
public Type register_games_plugin (TypeModule module) {
return typeof (Games.MsDosPlugin);
}
......@@ -34,6 +34,7 @@ plugins/love/src/love-package.vala
plugins/love/src/love-plugin.vala
plugins/mame/src/mame-game-uri-adapter.vala
plugins/mame/src/mame-plugin.vala
plugins/ms-dos/src/ms-dos-plugin.vala
plugins/nintendo-ds/src/nintendo-ds-plugin.vala
plugins/playstation/src/playstation-header.vala
plugins/playstation/src/playstation-plugin.vala
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment