fixed compile,

fixed crash,
added panicalert`


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2017 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2009-01-26 16:27:01 +00:00
parent bc6bbafb95
commit 356db07cbf
3 changed files with 52 additions and 50 deletions

View File

@ -15,20 +15,11 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
/*
All plugins from Core > Plugins are loaded and unloaded with this class when
Dolpin is started and stopped.
*/
//////////////////////////////////////////////////////////////////////////////////////////
// File description
/* ¯¯¯¯¯¯¯¯¯¯¯¯
All plugins from Core > Plugins are loaded and unloaded with this class when Dolpin is started
and stopped.
//////////////////////////////////////*/
//////////////////////////////////////////////////////////////////////////////////////////
// Include
// ¯¯¯¯¯¯¯¯¯¯¯¯
#include <string.h> // System
#ifdef _WIN32
#include <windows.h>
@ -42,7 +33,6 @@
#include "StringUtil.h"
#include "DynamicLibrary.h"
#include "ConsoleWindow.h"
////////////////////////////////////////
DynamicLibrary::DynamicLibrary()
@ -81,24 +71,23 @@ std::string GetLastErrorAsString()
#endif
}
/* Function: Loading means loading the dll with LoadLibrary() to get an instance to the dll.
This is done when Dolphin is started to determine which dlls are good, and before opening
the Config and Debugging windows from Plugin.cpp and before opening the dll for running
the emulation in Video_...cpp in Core. Since this is fairly slow, TODO: think about
/* Function: Loading means loading the dll with LoadLibrary() to get an
instance to the dll. This is done when Dolphin is started to determine
which dlls are good, and before opening the Config and Debugging windows
from Plugin.cpp and before opening the dll for running the emulation in
Video_...cpp in Core. Since this is fairly slow, TODO: think about
implementing some sort of cache.
Called from: The Dolphin Core */
int DynamicLibrary::Load(const char* filename)
{
if (!filename || strlen(filename) == 0)
{
if (!filename || strlen(filename) == 0) {
LOG(MASTER_LOG, "Missing filename of dynamic library to load");
PanicAlert("Missing filename of dynamic library to load");
return 0;
}
LOG(MASTER_LOG, "Trying to load library %s", filename);
if (IsLoaded())
{
if (IsLoaded()) {
LOG(MASTER_LOG, "Trying to load already loaded library %s", filename);
return 2;
}
@ -110,8 +99,7 @@ int DynamicLibrary::Load(const char* filename)
library = dlopen(filename, RTLD_NOW | RTLD_LOCAL);
#endif
if (!library)
{
if (!library) {
LOG(MASTER_LOG, "Error loading DLL %s: %s", filename, GetLastErrorAsString().c_str());
PanicAlert("Error loading DLL %s: %s\n", filename, GetLastErrorAsString().c_str());
return 0;
@ -162,7 +150,7 @@ void* DynamicLibrary::Get(const char* funcname) const
if (!retval)
{
LOG(MASTER_LOG, "Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
//PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
}
return retval;

View File

@ -37,6 +37,15 @@ CPlugin::~CPlugin()
CPlugin::CPlugin(const char* _szName) : valid(false)
{
m_GetDllInfo = NULL;
m_DllConfig = NULL;
m_DllDebugger = NULL;
m_SetDllGlobals = NULL;
m_Initialize = NULL;
m_Shutdown = NULL;
m_DoState = NULL;
if (m_hInstLib.Load(_szName)) {
m_GetDllInfo = reinterpret_cast<TGetDllInfo>
@ -76,8 +85,7 @@ void *CPlugin::LoadSymbol(const char *sym) {
// ______________________________________________________________________________________
// GetInfo: Get DLL info
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) {
if (m_GetDllInfo != 0)
{
if (m_GetDllInfo != NULL) {
m_GetDllInfo(&_pluginInfo);
return(true);
}
@ -89,7 +97,8 @@ bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) {
// Config: Open the Config window
void CPlugin::Config(HWND _hwnd)
{
if (m_DllConfig != 0) m_DllConfig(_hwnd);
if (m_DllConfig != NULL)
m_DllConfig(_hwnd);
}
@ -97,32 +106,35 @@ void CPlugin::Config(HWND _hwnd)
// Debug: Open the Debugging window
void CPlugin::Debug(HWND _hwnd, bool Show)
{
if (m_DllDebugger != 0) m_DllDebugger(_hwnd, Show);
if (m_DllDebugger != NULL)
m_DllDebugger(_hwnd, Show);
}
void CPlugin::SetGlobals(PLUGIN_GLOBALS* _pluginGlobals) {
if (m_SetDllGlobals != 0)
if (m_SetDllGlobals != NULL)
m_SetDllGlobals(_pluginGlobals);
}
void CPlugin::DoState(unsigned char **ptr, int mode) {
if (m_DoState != 0)
if (m_DoState != NULL)
m_DoState(ptr, mode);
}
// Run Initialize() in the plugin
void CPlugin::Initialize(void *init)
{
/* We first check that we have found the Initialize() function, but there is no
restriction on running this several times */
if (m_Initialize != 0) m_Initialize(init);
/* We first check that we have found the Initialize() function, but there
is no restriction on running this several times */
if (m_Initialize != NULL)
m_Initialize(init);
}
void CPlugin::Shutdown()
{
if (m_Shutdown != 0) m_Shutdown();
if (m_Shutdown != NULL)
m_Shutdown();
}
} // end of namespace Common

View File

@ -228,10 +228,12 @@ void ConfigDialog::CreateGUIControls()
wxStaticBoxSizer * sbRealRecord = new wxStaticBoxSizer(wxVERTICAL, m_PageReal, wxT("Record movements"));
wxArrayString StrHotKey;
for(int i = 0; i < 10; i++) StrHotKey.Add(wxString::Format("Shift + %i", i));
for(int i = 0; i < 10; i++)
StrHotKey.Add(wxString::Format(wxT("Shift + %i"), i));
wxArrayString StrPlayBackSpeed;
for(int i = 1; i < 8; i++) StrPlayBackSpeed.Add(wxString::Format("%i", i*5));
for(int i = 1; i < 8; i++)
StrPlayBackSpeed.Add(wxString::Format(wxT("%i"), i*5));
wxBoxSizer * sRealRecord[RECORDING_ROWS];