DC: Move dynamic plugin handling into the platform

This commit is contained in:
Marcus Comstedt 2011-04-20 22:30:01 +02:00
parent eb8b1a962b
commit 21421d2e86
7 changed files with 24 additions and 58 deletions

View File

@ -75,11 +75,6 @@ MODULE_OBJS := \
vkeybd/virtual-keyboard-gui.o \
vkeybd/virtual-keyboard-parser.o
ifeq ($(BACKEND),dc)
MODULE_OBJS += \
plugins/dc/dc-provider.o
endif
ifeq ($(BACKEND),ds)
MODULE_OBJS += \
fs/ds/ds-fs-factory.o \

View File

@ -65,7 +65,7 @@ ENABLE_TOUCHE = $(ENABLED)
ENABLE_TUCKER = $(ENABLED)
OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \
label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o
label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o plugins.o
MODULE_DIRS += ./

View File

@ -31,6 +31,9 @@
#include "backends/audiocd/default/default-audiocd.h"
#include "backends/fs/fs-factory.h"
#include "audio/mixer_intern.h"
#ifdef DYNAMIC_MODULES
#include "backends/plugins/dynamic-plugin.h"
#endif
#define NUM_BUFFERS 4
#define SOUND_BUFFER_SHIFT 3
@ -69,7 +72,11 @@ class DCCDManager : public DefaultAudioCDManager {
void updateCD();
};
class OSystem_Dreamcast : private DCHardware, public BaseBackend, public PaletteManager, public FilesystemFactory {
class OSystem_Dreamcast : private DCHardware, public BaseBackend, public PaletteManager, public FilesystemFactory
#ifdef DYNAMIC_MODULES
, public FilePluginProvider
#endif
{
public:
OSystem_Dreamcast();
@ -250,6 +257,14 @@ public:
void logMessage(LogMessageType::Type type, const char *message);
Common::String getSystemLanguage() const;
#ifdef DYNAMIC_MODULES
class DCPlugin;
protected:
Plugin* createPlugin(const Common::FSNode &node) const;
bool isPluginFilename(const Common::FSNode &node) const;
#endif
};

View File

@ -33,7 +33,6 @@
#include <common/config-manager.h>
#include <common/memstream.h>
#include "backends/plugins/dc/dc-provider.h"
#include "audio/mixer_intern.h"
@ -336,7 +335,7 @@ int main()
g_system = &osys_dc;
#ifdef DYNAMIC_MODULES
PluginManager::instance().addPluginProvider(new DCPluginProvider());
PluginManager::instance().addPluginProvider(&osys_dc);
#endif
scummvm_main(argc, argv);

View File

@ -1,7 +1,7 @@
MODULE := backends/platform/dc
MODULE_OBJS := dcmain.o time.o display.o audio.o input.o selector.o icon.o \
label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o
label.o vmsave.o softkbd.o dcloader.o cache.o dc-fs.o plugins.o
# We don't use rules.mk but rather manually update OBJS and MODULE_DIRS.
MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS))

View File

@ -25,16 +25,15 @@
#include "common/scummsys.h"
#if defined(DYNAMIC_MODULES) && defined(__DC__)
#if defined(DYNAMIC_MODULES)
#include "backends/plugins/dc/dc-provider.h"
#include "backends/plugins/dynamic-plugin.h"
#include "common/fs.h"
#include "dcloader.h"
class DCPlugin : public DynamicPlugin {
class OSystem_Dreamcast::DCPlugin : public DynamicPlugin {
protected:
void *_dlHandle;
@ -85,11 +84,11 @@ public:
};
Plugin* DCPluginProvider::createPlugin(const Common::FSNode &node) const {
Plugin* OSystem_Dreamcast::createPlugin(const Common::FSNode &node) const {
return new DCPlugin(node.getPath());
}
bool DCPluginProvider::isPluginFilename(const Common::FSNode &node) const {
bool OSystem_Dreamcast::isPluginFilename(const Common::FSNode &node) const {
// Check the plugin suffix
Common::String filename = node.getName();
if (!filename.hasSuffix(".PLG"))
@ -98,4 +97,4 @@ bool DCPluginProvider::isPluginFilename(const Common::FSNode &node) const {
return true;
}
#endif // defined(DYNAMIC_MODULES) && defined(__DC__)
#endif // defined(DYNAMIC_MODULES)

View File

@ -1,42 +0,0 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
* $Id$
*
*/
#ifndef BACKENDS_PLUGINS_DC_H
#define BACKENDS_PLUGINS_DC_H
#include "base/plugins.h"
#if defined(DYNAMIC_MODULES) && defined(__DC__)
class DCPluginProvider : public FilePluginProvider {
protected:
Plugin* createPlugin(const Common::FSNode &node) const;
bool isPluginFilename(const Common::FSNode &node) const;
};
#endif // defined(DYNAMIC_MODULES) && defined(__DC__)
#endif