2009-07-28 21:32:10 +00:00
|
|
|
// Copyright (C) 2003 Dolphin Project.
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
// 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, version 2.0.
|
|
|
|
|
|
|
|
// 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 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
2009-01-15 06:48:15 +00:00
|
|
|
|
2009-03-28 08:57:34 +00:00
|
|
|
// --------------------------------------------------------------------------------------------
|
2009-02-20 22:04:52 +00:00
|
|
|
// This is the common Plugin class that links to the functions that are
|
|
|
|
// common to all plugins. This class is inherited by all plugin classes. But it's only created
|
|
|
|
// directly in PluginManager.cpp when we check if a plugin is valid or not.
|
2009-03-28 08:57:34 +00:00
|
|
|
// --------------------------------------------------------------------------------------------
|
2008-12-08 05:30:24 +00:00
|
|
|
|
|
|
|
#include "Plugin.h"
|
|
|
|
|
|
|
|
namespace Common
|
|
|
|
{
|
|
|
|
|
2009-01-19 03:45:28 +00:00
|
|
|
CPlugin::~CPlugin()
|
|
|
|
{
|
2009-02-20 22:04:52 +00:00
|
|
|
m_hInstLib.Unload();
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2009-01-31 23:47:45 +00:00
|
|
|
CPlugin::CPlugin(const char* _szName) : valid(false)
|
2009-01-19 03:45:28 +00:00
|
|
|
{
|
2009-02-20 22:04:52 +00:00
|
|
|
m_GetDllInfo = NULL;
|
|
|
|
m_DllConfig = NULL;
|
|
|
|
m_DllDebugger = NULL;
|
|
|
|
m_SetDllGlobals = NULL;
|
|
|
|
m_Initialize = NULL;
|
|
|
|
m_Shutdown = NULL;
|
|
|
|
m_DoState = NULL;
|
Now you can switch between Emulated and Real WiiMotes, connect more Real Wiimotes and even pair them up (if you have MS BT Stack) during gameplay!
All you gotta do is Pause the emulation! That's useful for when your batteries run out during gameplay, for example...
But if you change the WiiMote source (between Emulated, Real or Inactive) you must disconnect and reconnect (Menu Tools -> Connect WiiMote) the WiiMotes affected by the change...
Thanks to jack.fr0st who did all the emulation state notification work!
Now every plugin has a way to know the current emulation state (paused, stopped or playing)
@ayuanx: I thought about doing a PostMessage(g_WiimoteInitialize.hWnd, WM_USER, WIIMOTE_DISCONNECT, current_number); so that the user gets asked to reconnect that WiiMote, trying to avoid having to disconnect and reconnect, but it didn't work because shooting that message only asks to reconnect, doesn't do a disconnect... Do you have any ideas on how to accomplish that?
Also, if anyone could check if Issue 1916 is finally fixed... Or at least when is the cursor being hidden or not...
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4789 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-01-06 19:26:52 +00:00
|
|
|
m_EmuStateChange = NULL;
|
2009-02-20 22:04:52 +00:00
|
|
|
|
|
|
|
if (m_hInstLib.Load(_szName))
|
2010-06-05 01:38:22 +00:00
|
|
|
{
|
2009-02-08 10:09:26 +00:00
|
|
|
m_GetDllInfo = reinterpret_cast<TGetDllInfo>
|
|
|
|
(m_hInstLib.Get("GetDllInfo"));
|
|
|
|
m_DllConfig = reinterpret_cast<TDllConfig>
|
|
|
|
(m_hInstLib.Get("DllConfig"));
|
|
|
|
m_DllDebugger = reinterpret_cast<TDllDebugger>
|
|
|
|
(m_hInstLib.Get("DllDebugger"));
|
|
|
|
m_SetDllGlobals = reinterpret_cast<TSetDllGlobals>
|
|
|
|
(m_hInstLib.Get("SetDllGlobals"));
|
|
|
|
m_Initialize = reinterpret_cast<TInitialize>
|
|
|
|
(m_hInstLib.Get("Initialize"));
|
|
|
|
m_Shutdown = reinterpret_cast<TShutdown>
|
|
|
|
(m_hInstLib.Get("Shutdown"));
|
|
|
|
m_DoState = reinterpret_cast<TDoState>
|
|
|
|
(m_hInstLib.Get("DoState"));
|
Now you can switch between Emulated and Real WiiMotes, connect more Real Wiimotes and even pair them up (if you have MS BT Stack) during gameplay!
All you gotta do is Pause the emulation! That's useful for when your batteries run out during gameplay, for example...
But if you change the WiiMote source (between Emulated, Real or Inactive) you must disconnect and reconnect (Menu Tools -> Connect WiiMote) the WiiMotes affected by the change...
Thanks to jack.fr0st who did all the emulation state notification work!
Now every plugin has a way to know the current emulation state (paused, stopped or playing)
@ayuanx: I thought about doing a PostMessage(g_WiimoteInitialize.hWnd, WM_USER, WIIMOTE_DISCONNECT, current_number); so that the user gets asked to reconnect that WiiMote, trying to avoid having to disconnect and reconnect, but it didn't work because shooting that message only asks to reconnect, doesn't do a disconnect... Do you have any ideas on how to accomplish that?
Also, if anyone could check if Issue 1916 is finally fixed... Or at least when is the cursor being hidden or not...
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4789 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-01-06 19:26:52 +00:00
|
|
|
m_EmuStateChange = reinterpret_cast<TEmuStateChange>
|
|
|
|
(m_hInstLib.Get("EmuStateChange"));
|
2009-03-18 17:17:58 +00:00
|
|
|
|
2010-06-05 01:38:22 +00:00
|
|
|
// Check if the plugin has all the functions it should have
|
2009-03-18 17:17:58 +00:00
|
|
|
if (m_GetDllInfo != 0 &&
|
|
|
|
m_DllConfig != 0 &&
|
|
|
|
m_DllDebugger != 0 &&
|
|
|
|
m_SetDllGlobals != 0 &&
|
|
|
|
m_Initialize != 0 &&
|
|
|
|
m_Shutdown != 0 &&
|
Now you can switch between Emulated and Real WiiMotes, connect more Real Wiimotes and even pair them up (if you have MS BT Stack) during gameplay!
All you gotta do is Pause the emulation! That's useful for when your batteries run out during gameplay, for example...
But if you change the WiiMote source (between Emulated, Real or Inactive) you must disconnect and reconnect (Menu Tools -> Connect WiiMote) the WiiMotes affected by the change...
Thanks to jack.fr0st who did all the emulation state notification work!
Now every plugin has a way to know the current emulation state (paused, stopped or playing)
@ayuanx: I thought about doing a PostMessage(g_WiimoteInitialize.hWnd, WM_USER, WIIMOTE_DISCONNECT, current_number); so that the user gets asked to reconnect that WiiMote, trying to avoid having to disconnect and reconnect, but it didn't work because shooting that message only asks to reconnect, doesn't do a disconnect... Do you have any ideas on how to accomplish that?
Also, if anyone could check if Issue 1916 is finally fixed... Or at least when is the cursor being hidden or not...
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4789 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-01-06 19:26:52 +00:00
|
|
|
m_DoState != 0 &&
|
|
|
|
m_EmuStateChange != 0)
|
2009-03-18 17:17:58 +00:00
|
|
|
valid = true;
|
|
|
|
}
|
2009-01-15 06:48:15 +00:00
|
|
|
|
2009-01-24 12:09:30 +00:00
|
|
|
// Save the filename for this plugin
|
|
|
|
Filename = _szName;
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2009-02-08 10:09:26 +00:00
|
|
|
void *CPlugin::LoadSymbol(const char *sym)
|
|
|
|
{
|
2009-02-20 22:04:52 +00:00
|
|
|
return m_hInstLib.Get(sym);
|
2009-01-15 06:48:15 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2009-01-22 11:18:46 +00:00
|
|
|
// GetInfo: Get DLL info
|
2009-02-08 10:09:26 +00:00
|
|
|
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo)
|
|
|
|
{
|
2009-02-20 22:04:52 +00:00
|
|
|
if (m_GetDllInfo != NULL) {
|
|
|
|
m_GetDllInfo(&_pluginInfo);
|
2009-02-21 12:07:03 +00:00
|
|
|
return true;
|
2010-06-05 01:38:22 +00:00
|
|
|
}
|
2009-02-21 12:07:03 +00:00
|
|
|
return false;
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2009-01-22 11:18:46 +00:00
|
|
|
// Config: Open the Config window
|
|
|
|
void CPlugin::Config(HWND _hwnd)
|
|
|
|
{
|
2009-02-20 22:04:52 +00:00
|
|
|
if (m_DllConfig != NULL)
|
|
|
|
m_DllConfig(_hwnd);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2009-01-22 11:18:46 +00:00
|
|
|
// Debug: Open the Debugging window
|
|
|
|
void CPlugin::Debug(HWND _hwnd, bool Show)
|
|
|
|
{
|
2009-02-20 22:04:52 +00:00
|
|
|
if (m_DllDebugger != NULL)
|
|
|
|
m_DllDebugger(_hwnd, Show);
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2009-01-07 22:07:51 +00:00
|
|
|
|
2009-01-15 06:48:15 +00:00
|
|
|
void CPlugin::SetGlobals(PLUGIN_GLOBALS* _pluginGlobals) {
|
2009-02-20 22:04:52 +00:00
|
|
|
if (m_SetDllGlobals != NULL)
|
|
|
|
m_SetDllGlobals(_pluginGlobals);
|
2009-01-15 06:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CPlugin::DoState(unsigned char **ptr, int mode) {
|
2009-02-20 22:04:52 +00:00
|
|
|
if (m_DoState != NULL)
|
|
|
|
m_DoState(ptr, mode);
|
2009-01-15 06:48:15 +00:00
|
|
|
}
|
|
|
|
|
Now you can switch between Emulated and Real WiiMotes, connect more Real Wiimotes and even pair them up (if you have MS BT Stack) during gameplay!
All you gotta do is Pause the emulation! That's useful for when your batteries run out during gameplay, for example...
But if you change the WiiMote source (between Emulated, Real or Inactive) you must disconnect and reconnect (Menu Tools -> Connect WiiMote) the WiiMotes affected by the change...
Thanks to jack.fr0st who did all the emulation state notification work!
Now every plugin has a way to know the current emulation state (paused, stopped or playing)
@ayuanx: I thought about doing a PostMessage(g_WiimoteInitialize.hWnd, WM_USER, WIIMOTE_DISCONNECT, current_number); so that the user gets asked to reconnect that WiiMote, trying to avoid having to disconnect and reconnect, but it didn't work because shooting that message only asks to reconnect, doesn't do a disconnect... Do you have any ideas on how to accomplish that?
Also, if anyone could check if Issue 1916 is finally fixed... Or at least when is the cursor being hidden or not...
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4789 8ced0084-cf51-0410-be5f-012b33b47a6e
2010-01-06 19:26:52 +00:00
|
|
|
void CPlugin::EmuStateChange(PLUGIN_EMUSTATE newState) {
|
|
|
|
if (m_EmuStateChange != NULL)
|
|
|
|
m_EmuStateChange(newState);
|
|
|
|
}
|
|
|
|
|
2009-01-19 03:45:28 +00:00
|
|
|
void CPlugin::Initialize(void *init)
|
|
|
|
{
|
2009-02-20 22:04:52 +00:00
|
|
|
if (m_Initialize != NULL)
|
|
|
|
m_Initialize(init);
|
2009-01-15 06:48:15 +00:00
|
|
|
}
|
|
|
|
|
2009-01-19 03:45:28 +00:00
|
|
|
void CPlugin::Shutdown()
|
|
|
|
{
|
2009-02-20 22:04:52 +00:00
|
|
|
if (m_Shutdown != NULL)
|
|
|
|
m_Shutdown();
|
2009-01-07 22:07:51 +00:00
|
|
|
}
|
|
|
|
|
2009-03-28 08:57:34 +00:00
|
|
|
} // Namespace
|