mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 15:55:31 +01:00
Some code clean up
console now prints to file and stderr on windows someone feels like creating a wxw version? git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2046 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
ae84837320
commit
f8064316b1
@ -16,40 +16,33 @@
|
|||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Includes
|
// Includes
|
||||||
// -------------
|
|
||||||
#include <string> // System: To be able to add strings with "+"
|
#include <string> // System: To be able to add strings with "+"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#else
|
||||||
|
#include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "ConsoleWindow.h" // Common
|
#include "ConsoleWindow.h" // Common
|
||||||
///////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Declarations and definitions
|
// Declarations and definitions
|
||||||
// -------------
|
|
||||||
|
|
||||||
namespace Console
|
namespace Console
|
||||||
{
|
{
|
||||||
|
|
||||||
// Create handles
|
// Create handles
|
||||||
#ifdef _WIN32
|
|
||||||
FILE* __fStdOut = NULL;
|
FILE* __fStdOut = NULL;
|
||||||
|
#ifdef _WIN32
|
||||||
HANDLE __hStdOut = NULL;
|
HANDLE __hStdOut = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/* Start console window - width and height is the size of console window, if you enable
|
/* Start console window - width and height is the size of console window, if you enable
|
||||||
File the output will also be written to this file. */
|
File the output will also be written to this file. */
|
||||||
// -------------
|
|
||||||
void Open(int Width, int Height, char * Name, bool File)
|
void Open(int Width, int Height, char * Name, bool File)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -71,9 +64,9 @@ void Open(int Width, int Height, char * Name, bool File)
|
|||||||
SMALL_RECT coo = {0,0, (Width - 1),50}; // Top, left, right, bottom
|
SMALL_RECT coo = {0,0, (Width - 1),50}; // Top, left, right, bottom
|
||||||
SetConsoleWindowInfo(__hStdOut, TRUE, &coo);
|
SetConsoleWindowInfo(__hStdOut, TRUE, &coo);
|
||||||
|
|
||||||
// -----------------------------------------
|
|
||||||
|
#endif
|
||||||
// Create a file and a file handle if File is enabled and we don't already have a file handle
|
// Create a file and a file handle if File is enabled and we don't already have a file handle
|
||||||
// -------------
|
|
||||||
if(File && !__fStdOut)
|
if(File && !__fStdOut)
|
||||||
{
|
{
|
||||||
// Edit the log file name
|
// Edit the log file name
|
||||||
@ -84,33 +77,28 @@ void Open(int Width, int Height, char * Name, bool File)
|
|||||||
// Open the file handle
|
// Open the file handle
|
||||||
__fStdOut = fopen(FullFilename.c_str(), "w");
|
__fStdOut = fopen(FullFilename.c_str(), "w");
|
||||||
}
|
}
|
||||||
// ---------------
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
//////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
/* Close the console window and close the eventual file handle */
|
/* Close the console window and close the eventual file handle */
|
||||||
// -------------
|
|
||||||
void Close()
|
void Close()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
FreeConsole(); // Close the console window
|
FreeConsole(); // Close the console window
|
||||||
if(__fStdOut) fclose(__fStdOut); // Close the file handle
|
|
||||||
#endif
|
#endif
|
||||||
|
if(__fStdOut) fclose(__fStdOut); // Close the file handle
|
||||||
|
|
||||||
}
|
}
|
||||||
//////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Print to screen and file
|
// Print to screen and file
|
||||||
// -------------
|
|
||||||
int Print(const char *fmt, ...)
|
int Print(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
if(__hStdOut)
|
if(__hStdOut)
|
||||||
{
|
{
|
||||||
|
#endif
|
||||||
char s[1024*20]; // Warning, mind this value
|
char s[1024*20]; // Warning, mind this value
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
int cnt; // To store the vsnprintf return message
|
int cnt; // To store the vsnprintf return message
|
||||||
@ -119,41 +107,34 @@ int Print(const char *fmt, ...)
|
|||||||
cnt = vsnprintf(s, 500, fmt, argptr);
|
cnt = vsnprintf(s, 500, fmt, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
DWORD cCharsWritten; // We will get a value back here
|
DWORD cCharsWritten; // We will get a value back here
|
||||||
|
|
||||||
// ------------------------------------------
|
WriteConsole(__hStdOut, s, (DWORD)strlen(s), &cCharsWritten, NULL);
|
||||||
// Write to console
|
#else
|
||||||
// ----------------
|
fprintf(stderr, "%s", s);
|
||||||
if(__hStdOut)
|
#endif
|
||||||
{
|
|
||||||
WriteConsole(__hStdOut, s, (DWORD)strlen(s), &cCharsWritten, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// Write to the file
|
// Write to the file
|
||||||
// ----------------
|
|
||||||
if(__fStdOut)
|
if(__fStdOut)
|
||||||
{
|
{
|
||||||
fprintf(__fStdOut, s);
|
fprintf(__fStdOut, "%s", s);
|
||||||
fflush(__fStdOut); // Write file now, don't wait
|
fflush(__fStdOut); // Write file now, don't wait
|
||||||
}
|
}
|
||||||
|
|
||||||
return(cnt);
|
return(cnt);
|
||||||
}
|
|
||||||
else
|
#if defined(_WIN32)
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
/////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
// =======================================================================================
|
|
||||||
// Clear console screen
|
// Clear console screen
|
||||||
// ---------------
|
|
||||||
void ClearScreen()
|
void ClearScreen()
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
@ -177,13 +158,10 @@ void ClearScreen()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
// =====================
|
|
||||||
|
|
||||||
|
|
||||||
// =======================================================================================
|
/* Get window handle of console window to be able to resize it. We use
|
||||||
/* Get window handle of console window to be able to resize it. We use GetConsoleTitle() and
|
GetConsoleTitle() and FindWindow() to locate the console window handle. */
|
||||||
FindWindow() to locate the console window handle. */
|
|
||||||
// ---------------
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
HWND GetHwnd(void)
|
HWND GetHwnd(void)
|
||||||
{
|
{
|
||||||
@ -213,6 +191,5 @@ HWND GetHwnd(void)
|
|||||||
return(hwndFound);
|
return(hwndFound);
|
||||||
}
|
}
|
||||||
#endif // _WIN32
|
#endif // _WIN32
|
||||||
// =====================
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -65,7 +65,7 @@ std::string GetLastErrorAsString()
|
|||||||
static std::string errstr;
|
static std::string errstr;
|
||||||
char *tmp = dlerror();
|
char *tmp = dlerror();
|
||||||
if (tmp)
|
if (tmp)
|
||||||
errstr = tmp;
|
errstr = tmp;
|
||||||
|
|
||||||
return errstr;
|
return errstr;
|
||||||
#endif
|
#endif
|
||||||
@ -121,7 +121,8 @@ int DynamicLibrary::Unload()
|
|||||||
Console::Print("FreeLibrary: %i\n", library_file.c_str());
|
Console::Print("FreeLibrary: %i\n", library_file.c_str());
|
||||||
retval = FreeLibrary(library);
|
retval = FreeLibrary(library);
|
||||||
#else
|
#else
|
||||||
retval = dlclose(library)?0:1;
|
Console::Print("FreeLibrary: %i\n", library_file.c_str());
|
||||||
|
retval = dlclose(library)?0:1;
|
||||||
#endif
|
#endif
|
||||||
if (!retval) {
|
if (!retval) {
|
||||||
PanicAlert("Error unloading DLL %s: %s", library_file.c_str(),
|
PanicAlert("Error unloading DLL %s: %s", library_file.c_str(),
|
||||||
|
@ -354,7 +354,7 @@ THREAD_RETURN EmuThread(void *pArg)
|
|||||||
if(PADInitialize.padNumber == -1)
|
if(PADInitialize.padNumber == -1)
|
||||||
{
|
{
|
||||||
Plugins.GetPad(i)->Shutdown();
|
Plugins.GetPad(i)->Shutdown();
|
||||||
Plugins.FreePad();
|
Plugins.FreePad(i);
|
||||||
Plugins.GetPad(i)->Initialize(&PADInitialize);
|
Plugins.GetPad(i)->Initialize(&PADInitialize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,6 @@
|
|||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Include
|
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
|
||||||
#include <string> // System
|
#include <string> // System
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -35,207 +32,182 @@
|
|||||||
|
|
||||||
CPluginManager CPluginManager::m_Instance;
|
CPluginManager CPluginManager::m_Instance;
|
||||||
|
|
||||||
//#define INPUTCOMMON
|
|
||||||
//////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// The Plugin Manager Class
|
// The Plugin Manager Class
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
|
||||||
CPluginManager::CPluginManager() :
|
CPluginManager::CPluginManager() :
|
||||||
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
|
m_params(SConfig::GetInstance().m_LocalCoreStartupParameter)
|
||||||
{
|
{
|
||||||
m_PluginGlobals = new PLUGIN_GLOBALS;
|
m_PluginGlobals = new PLUGIN_GLOBALS;
|
||||||
|
|
||||||
|
|
||||||
m_PluginGlobals->eventHandler = EventHandler::GetInstance();
|
m_PluginGlobals->eventHandler = EventHandler::GetInstance();
|
||||||
m_PluginGlobals->config = (void *)&SConfig::GetInstance();
|
m_PluginGlobals->config = (void *)&SConfig::GetInstance();
|
||||||
m_PluginGlobals->messageLogger = NULL;
|
m_PluginGlobals->messageLogger = NULL;
|
||||||
|
|
||||||
#ifdef INPUTCOMMON
|
m_video = NULL;
|
||||||
m_InputManager = new InputManager();
|
m_dsp = NULL;
|
||||||
m_PluginGlobals->inputManager = m_InputManager;
|
for (int i=0;i< MAXPADS;i++)
|
||||||
#endif
|
m_pad[i] = NULL;
|
||||||
|
|
||||||
|
for (int i=0;i< MAXWIIMOTES;i++)
|
||||||
|
m_wiimote[i] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function: FreeLibrary()
|
/* Function:
|
||||||
Called from: In an attempt to avoid the crash that occurs when the use LoadLibrary() and
|
|
||||||
FreeLibrary() often (every game a game is stopped and started) these functions will only
|
FreeLibrary() Called from: In an attempt to avoid the crash that occurs when
|
||||||
be used when
|
the use LoadLibrary() and FreeLibrary() often (every game a game is stopped
|
||||||
1. Dolphin is started
|
and started) these functions will only be used when
|
||||||
2. A plugin is changed
|
1. Dolphin is started
|
||||||
3. Dolphin is closed
|
2. A plugin is changed
|
||||||
it will not be used when we Start and Stop games. */
|
3. Dolphin is closed
|
||||||
|
it will not be used when we Start and Stop games.
|
||||||
|
*/
|
||||||
CPluginManager::~CPluginManager()
|
CPluginManager::~CPluginManager()
|
||||||
{
|
{
|
||||||
Console::Print("Delete CPluginManager\n");
|
Console::Print("Delete CPluginManager\n");
|
||||||
|
|
||||||
if (m_PluginGlobals) delete m_PluginGlobals;
|
delete m_PluginGlobals;
|
||||||
|
|
||||||
if (m_dsp) delete m_dsp;
|
delete m_dsp;
|
||||||
|
|
||||||
if (m_video) delete m_video;
|
for (int i = 0; i < MAXPADS; i++) {
|
||||||
|
if (m_pad[i] && OkayToInitPlugin(i)) {
|
||||||
/**/
|
Console::Print("Delete: %i\n", i);
|
||||||
for (int i = 0; i < MAXPADS; i++)
|
delete m_pad[i];
|
||||||
{
|
|
||||||
if (m_pad[i] && OkayToInitPlugin(i))
|
|
||||||
{
|
|
||||||
Console::Print("Delete: %i\n", i);
|
|
||||||
delete m_pad[i];
|
|
||||||
}
|
|
||||||
m_pad[i] = NULL;
|
|
||||||
}
|
}
|
||||||
|
m_pad[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||||
if (m_wiimote[i]) delete m_wiimote[i];
|
if (m_wiimote[i]) delete m_wiimote[i];
|
||||||
|
|
||||||
|
delete m_video;
|
||||||
|
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////
|
// Init and Shutdown Plugins
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Init and ShutDown Plugins
|
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
|
||||||
|
|
||||||
// Point the m_pad[] and other variables to a certain plugin
|
// Point the m_pad[] and other variables to a certain plugin
|
||||||
bool CPluginManager::InitPlugins()
|
bool CPluginManager::InitPlugins()
|
||||||
{
|
{
|
||||||
if (! GetDSP())
|
if (! GetDSP()) {
|
||||||
{
|
PanicAlert("Can't init DSP Plugin");
|
||||||
PanicAlert("Can't init DSP Plugin");
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! GetVideo())
|
if (! GetVideo()) {
|
||||||
{
|
PanicAlert("Can't init Video Plugin");
|
||||||
PanicAlert("Can't init Video Plugin");
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
// Check if we get at least one pad or wiimote
|
||||||
// Check if we get at least one pad or wiimote
|
|
||||||
bool pad = false;
|
bool pad = false;
|
||||||
bool wiimote = false;
|
bool wiimote = false;
|
||||||
|
|
||||||
// Init pad
|
// Init pad
|
||||||
for (int i = 0; i < MAXPADS; i++)
|
for (int i = 0; i < MAXPADS; i++) {
|
||||||
{
|
if (! m_params.m_strPadPlugin[i].empty())
|
||||||
if (! m_params.m_strPadPlugin[i].empty())
|
GetPad(i);
|
||||||
GetPad(i);
|
if (m_pad[i] != NULL)
|
||||||
if (m_pad[i] != NULL)
|
pad = true;
|
||||||
pad = true;
|
|
||||||
}
|
}
|
||||||
if (! pad)
|
if (! pad) {
|
||||||
{
|
PanicAlert("Can't init any PAD Plugins");
|
||||||
PanicAlert("Can't init any PAD Plugins");
|
return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init wiimote
|
// Init wiimote
|
||||||
if (m_params.bWii)
|
if (m_params.bWii) {
|
||||||
{
|
for (int i = 0; i < MAXWIIMOTES; i++) {
|
||||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
if (! m_params.m_strWiimotePlugin[i].empty())
|
||||||
{
|
GetWiimote(i);
|
||||||
if (! m_params.m_strWiimotePlugin[i].empty())
|
|
||||||
GetWiimote(i);
|
if (m_wiimote[i] != NULL)
|
||||||
|
wiimote = true;
|
||||||
if (m_wiimote[i] != NULL)
|
}
|
||||||
wiimote = true;
|
if (! wiimote) {
|
||||||
}
|
PanicAlert("Can't init any Wiimote Plugins");
|
||||||
if (! wiimote)
|
return false;
|
||||||
{
|
}
|
||||||
PanicAlert("Can't init any Wiimote Plugins");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPluginManager::ShutdownPlugins()
|
void CPluginManager::ShutdownPlugins()
|
||||||
{
|
{
|
||||||
// Check if we can shutdown the plugin
|
// Check if we can shutdown the plugin
|
||||||
for (int i = 0; i < MAXPADS; i++)
|
for (int i = 0; i < MAXPADS; i++) {
|
||||||
{
|
if (m_pad[i] && OkayToInitPlugin(i)) {
|
||||||
if (m_pad[i] && OkayToInitPlugin(i))
|
//Console::Print("Shutdown: %i\n", i);
|
||||||
{
|
m_pad[i]->Shutdown();
|
||||||
//Console::Print("Shutdown: %i\n", i);
|
//delete m_pad[i];
|
||||||
m_pad[i]->Shutdown();
|
}
|
||||||
//delete m_pad[i];
|
//m_pad[i] = NULL;
|
||||||
}
|
}
|
||||||
//m_pad[i] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < MAXWIIMOTES; i++)
|
for (int i = 0; i < MAXWIIMOTES; i++)
|
||||||
if (m_wiimote[i]) m_wiimote[i]->Shutdown();
|
if (m_wiimote[i]) m_wiimote[i]->Shutdown();
|
||||||
|
|
||||||
if (m_video)
|
if (m_video)
|
||||||
m_video->Shutdown();
|
m_video->Shutdown();
|
||||||
|
|
||||||
if (m_dsp)
|
if (m_dsp)
|
||||||
m_dsp->Shutdown();
|
m_dsp->Shutdown();
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Supporting functions
|
// Supporting functions
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
/* Called from: Get__() functions in this file only (not from anywhere else),
|
||||||
/* Called from: Get__() functions in this file only (not from anywhere else), therefore we
|
therefore we can leave all condition checks in the Get__() functions
|
||||||
can leave all condition checks in the Get__() functions below. */
|
below. */
|
||||||
void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)//, PLUGIN_TYPE type)
|
void *CPluginManager::LoadPlugin(const char *_rFilename, int Number)
|
||||||
{
|
{
|
||||||
CPluginInfo info(_rFilename);
|
CPluginInfo info(_rFilename);
|
||||||
PLUGIN_TYPE type = info.GetPluginInfo().Type;
|
PLUGIN_TYPE type = info.GetPluginInfo().Type;
|
||||||
//std::string Filename = info.GetPluginInfo().Filename;
|
std::string Filename = _rFilename;
|
||||||
std::string Filename = _rFilename;
|
Common::CPlugin *plugin = NULL;
|
||||||
Common::CPlugin *plugin = NULL;
|
|
||||||
|
|
||||||
switch (type)
|
if (! File::Exists(_rFilename))
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
case PLUGIN_TYPE_VIDEO:
|
case PLUGIN_TYPE_VIDEO:
|
||||||
plugin = new Common::PluginVideo(_rFilename);
|
plugin = new Common::PluginVideo(_rFilename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLUGIN_TYPE_DSP:
|
case PLUGIN_TYPE_DSP:
|
||||||
plugin = new Common::PluginDSP(_rFilename);
|
plugin = new Common::PluginDSP(_rFilename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLUGIN_TYPE_PAD:
|
case PLUGIN_TYPE_PAD:
|
||||||
plugin = new Common::PluginPAD(_rFilename);
|
plugin = new Common::PluginPAD(_rFilename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PLUGIN_TYPE_WIIMOTE:
|
case PLUGIN_TYPE_WIIMOTE:
|
||||||
plugin = new Common::PluginWiimote(_rFilename);
|
plugin = new Common::PluginWiimote(_rFilename);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PanicAlert("Trying to load unsupported type %d", type);
|
PanicAlert("Trying to load unsupported type %d", type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plugin->IsValid())
|
if (!plugin->IsValid()) {
|
||||||
{
|
PanicAlert("Can't open %s", _rFilename);
|
||||||
PanicAlert("Can't open %s", _rFilename);
|
return NULL;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin->SetGlobals(m_PluginGlobals);
|
plugin->SetGlobals(m_PluginGlobals);
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------
|
/* Check if the plugin has already been initialized. If so, return the Id of
|
||||||
/* Check if the plugin has already been initialized. If so, return the Id of the duplicate pad
|
the duplicate pad so we can point the new m_pad[] to that */
|
||||||
so we can point the new m_pad[] to that */
|
|
||||||
// -------------
|
|
||||||
int CPluginManager::OkayToInitPlugin(int Plugin)
|
int CPluginManager::OkayToInitPlugin(int Plugin)
|
||||||
{
|
{
|
||||||
// Compare it to the earlier plugins
|
// Compare it to the earlier plugins
|
||||||
for(int i = 0; i < Plugin; i++)
|
for(int i = 0; i < Plugin; i++)
|
||||||
if (m_params.m_strPadPlugin[Plugin] == m_params.m_strPadPlugin[i])
|
if (m_params.m_strPadPlugin[Plugin] == m_params.m_strPadPlugin[i])
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
// No there is no duplicate plugin
|
// No there is no duplicate plugin
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -254,182 +226,166 @@ void CPluginManager::ScanForPlugins()
|
|||||||
|
|
||||||
CFileSearch::XStringVector Directories;
|
CFileSearch::XStringVector Directories;
|
||||||
Directories.push_back(std::string(PLUGINS_DIR));
|
Directories.push_back(std::string(PLUGINS_DIR));
|
||||||
|
|
||||||
CFileSearch::XStringVector Extensions;
|
CFileSearch::XStringVector Extensions;
|
||||||
Extensions.push_back("*" PLUGIN_SUFFIX);
|
Extensions.push_back("*" PLUGIN_SUFFIX);
|
||||||
|
|
||||||
CFileSearch FileSearch(Extensions, Directories);
|
CFileSearch FileSearch(Extensions, Directories);
|
||||||
const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
|
const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
|
||||||
|
|
||||||
if (rFilenames.size() > 0)
|
if (rFilenames.size() > 0) {
|
||||||
{
|
for (size_t i = 0; i < rFilenames.size(); i++) {
|
||||||
for (size_t i = 0; i < rFilenames.size(); i++)
|
std::string orig_name = rFilenames[i];
|
||||||
{
|
std::string Filename;
|
||||||
std::string orig_name = rFilenames[i];
|
|
||||||
std::string FileName;
|
if (!SplitPath(rFilenames[i], NULL, &Filename, NULL)) {
|
||||||
|
printf("Bad Path %s\n", rFilenames[i].c_str());
|
||||||
if (!SplitPath(rFilenames[i], NULL, &FileName, NULL))
|
return;
|
||||||
{
|
|
||||||
printf("Bad Path %s\n", rFilenames[i].c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPluginInfo PluginInfo(orig_name.c_str());
|
|
||||||
if (PluginInfo.IsValid())
|
|
||||||
{
|
|
||||||
m_PluginInfos.push_back(PluginInfo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CPluginInfo PluginInfo(orig_name.c_str());
|
||||||
|
if (PluginInfo.IsValid()) {
|
||||||
|
m_PluginInfos.push_back(PluginInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
/* Create or return the already created plugin pointers. This will be called
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
often for the Pad and Wiimote from the SI_.cpp files. And often for the DSP
|
||||||
/* Create or return the already created plugin pointers. This will be called often for the
|
from the DSP files. */
|
||||||
Pad and Wiimote from the SI_.cpp files. And often for the DSP from the DSP files. */
|
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
|
||||||
Common::PluginPAD *CPluginManager::GetPad(int controller)
|
Common::PluginPAD *CPluginManager::GetPad(int controller)
|
||||||
{
|
{
|
||||||
if (m_pad[controller] != NULL)
|
if (m_pad[controller] != NULL)
|
||||||
if (m_pad[controller]->GetFilename() == m_params.m_strPadPlugin[controller])
|
if (m_pad[controller]->GetFilename() == m_params.m_strPadPlugin[controller])
|
||||||
return m_pad[controller];
|
return m_pad[controller];
|
||||||
|
|
||||||
// Else do this
|
// Else do this
|
||||||
if(OkayToInitPlugin(controller) == -1)
|
if(OkayToInitPlugin(controller) == -1) {
|
||||||
{
|
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str(), controller);
|
||||||
m_pad[controller] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[controller].c_str(), controller);
|
Console::Print("LoadPlugin: %i\n", controller);
|
||||||
Console::Print("LoadPlugin: %i\n", controller);
|
}
|
||||||
}
|
else {
|
||||||
else
|
Console::Print("Pointed: %i to %i\n", controller, OkayToInitPlugin(controller));
|
||||||
{
|
m_pad[controller] = m_pad[OkayToInitPlugin(controller)];
|
||||||
Console::Print("Pointed: %i to %i\n", controller, OkayToInitPlugin(controller));
|
|
||||||
m_pad[controller] = m_pad[OkayToInitPlugin(controller)];
|
|
||||||
}
|
}
|
||||||
return m_pad[controller];
|
return m_pad[controller];
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
|
Common::PluginWiimote *CPluginManager::GetWiimote(int controller)
|
||||||
{
|
{
|
||||||
if (m_wiimote[controller] != NULL)
|
if (m_wiimote[controller] != NULL)
|
||||||
if (m_wiimote[controller]->GetFilename() == m_params.m_strWiimotePlugin[controller])
|
if (m_wiimote[controller]->GetFilename() == m_params.m_strWiimotePlugin[controller])
|
||||||
return m_wiimote[controller];
|
return m_wiimote[controller];
|
||||||
|
|
||||||
// Else load a new plugin
|
// Else load a new plugin
|
||||||
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin(m_params.m_strWiimotePlugin[controller].c_str());
|
m_wiimote[controller] = (Common::PluginWiimote*)LoadPlugin(m_params.m_strWiimotePlugin[controller].c_str());
|
||||||
return m_wiimote[controller];
|
return m_wiimote[controller];
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::PluginDSP *CPluginManager::GetDSP()
|
Common::PluginDSP *CPluginManager::GetDSP()
|
||||||
{
|
{
|
||||||
if (m_dsp != NULL)
|
if (m_dsp != NULL)
|
||||||
if (m_dsp->GetFilename() == m_params.m_strDSPPlugin)
|
if (m_dsp->GetFilename() == m_params.m_strDSPPlugin)
|
||||||
return m_dsp;
|
return m_dsp;
|
||||||
// Else load a new plugin
|
// Else load a new plugin
|
||||||
m_dsp = (Common::PluginDSP*)LoadPlugin(m_params.m_strDSPPlugin.c_str());
|
m_dsp = (Common::PluginDSP*)LoadPlugin(m_params.m_strDSPPlugin.c_str());
|
||||||
return m_dsp;
|
return m_dsp;
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::PluginVideo *CPluginManager::GetVideo()
|
Common::PluginVideo *CPluginManager::GetVideo()
|
||||||
{
|
{
|
||||||
if (m_video != NULL)
|
if (m_video != NULL)
|
||||||
if (m_video->GetFilename() == m_params.m_strVideoPlugin)
|
if (m_video->GetFilename() == m_params.m_strVideoPlugin)
|
||||||
return m_video;
|
return m_video;
|
||||||
|
|
||||||
// Else load a new plugin
|
// Else load a new plugin
|
||||||
m_video = (Common::PluginVideo*)LoadPlugin(m_params.m_strVideoPlugin.c_str());
|
m_video = (Common::PluginVideo*)LoadPlugin(m_params.m_strVideoPlugin.c_str());
|
||||||
return m_video;
|
return m_video;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------
|
// Free plugins to completely reset all variables and potential DLLs loaded by
|
||||||
// Free plugins to completely reset all variables and potential DLLs loaded by the plugins in turn
|
// the plugins in turn
|
||||||
// -------------
|
void CPluginManager::FreeVideo()
|
||||||
Common::PluginVideo *CPluginManager::FreeVideo()
|
|
||||||
{
|
{
|
||||||
if(m_video)
|
delete m_video;
|
||||||
delete m_video;
|
m_video = NULL;
|
||||||
m_video = NULL;
|
|
||||||
m_video = (Common::PluginVideo*)LoadPlugin(m_params.m_strVideoPlugin.c_str(), 0);
|
|
||||||
return m_video;
|
|
||||||
}
|
}
|
||||||
Common::PluginPAD *CPluginManager::FreePad()
|
|
||||||
|
void CPluginManager::FreePad(u32 pad)
|
||||||
{
|
{
|
||||||
delete m_pad[0];
|
if (pad < MAXPADS) {
|
||||||
m_pad[0] = NULL; m_pad[1] = NULL; m_pad[2] = NULL; m_pad[3] = NULL;
|
delete m_pad[pad];
|
||||||
m_pad[0] = (Common::PluginPAD*)LoadPlugin(m_params.m_strPadPlugin[0].c_str(), 0);
|
m_pad[pad] = NULL;
|
||||||
return m_pad[0];
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Call DLL functions
|
// Call DLL functions
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯
|
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// Open config window. Input: _rFilename = Plugin filename , Type = Plugin type
|
// Open config window. Input: _rFilename = Plugin filename , Type = Plugin type
|
||||||
// -------------
|
|
||||||
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type)
|
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type)
|
||||||
{
|
{
|
||||||
#ifdef INPUTCOMMON
|
if (! File::Exists(_rFilename)) {
|
||||||
m_InputManager->Init();
|
PanicAlert("Can't find plugin %s", _rFilename);
|
||||||
#endif
|
return;
|
||||||
|
}
|
||||||
switch(Type)
|
|
||||||
{
|
switch(Type) {
|
||||||
case PLUGIN_TYPE_VIDEO:
|
case PLUGIN_TYPE_VIDEO:
|
||||||
GetVideo()->Config((HWND)_Parent);
|
GetVideo()->Config((HWND)_Parent);
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_DSP:
|
case PLUGIN_TYPE_DSP:
|
||||||
GetDSP()->Config((HWND)_Parent);
|
GetDSP()->Config((HWND)_Parent);
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_PAD:
|
case PLUGIN_TYPE_PAD:
|
||||||
GetPad(0)->Config((HWND)_Parent);
|
GetPad(0)->Config((HWND)_Parent);
|
||||||
break;
|
break;
|
||||||
case PLUGIN_TYPE_WIIMOTE:
|
case PLUGIN_TYPE_WIIMOTE:
|
||||||
GetWiimote(0)->Config((HWND)_Parent);
|
GetWiimote(0)->Config((HWND)_Parent);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
PanicAlert("Type %d config not supported in plugin %s", Type, _rFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef INPUTCOMMON
|
|
||||||
m_InputManager->Shutdown();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// Open debugging window. Type = Video or DSP. Show = Show or hide window.
|
// Open debugging window. Type = Video or DSP. Show = Show or hide window.
|
||||||
// -------------
|
|
||||||
void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show)
|
void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show)
|
||||||
{
|
{
|
||||||
switch(Type)
|
if (! File::Exists(_rFilename)) {
|
||||||
{
|
PanicAlert("Can't find plugin %s", _rFilename);
|
||||||
case PLUGIN_TYPE_VIDEO:
|
return;
|
||||||
GetVideo()->Debug((HWND)_Parent, Show);
|
}
|
||||||
break;
|
|
||||||
case PLUGIN_TYPE_DSP:
|
switch(Type) {
|
||||||
GetDSP()->Debug((HWND)_Parent, Show);
|
case PLUGIN_TYPE_VIDEO:
|
||||||
break;
|
GetVideo()->Debug((HWND)_Parent, Show);
|
||||||
|
break;
|
||||||
|
case PLUGIN_TYPE_DSP:
|
||||||
|
GetDSP()->Debug((HWND)_Parent, Show);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
PanicAlert("Type %d debug not supported in plugin %s", Type, _rFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------
|
|
||||||
// Get dll info
|
// Get dll info
|
||||||
// -------------
|
CPluginInfo::CPluginInfo(const char *_rFilename)
|
||||||
CPluginInfo::CPluginInfo(const char *_rFileName)
|
: m_Filename(_rFilename)
|
||||||
: m_FileName(_rFileName)
|
, m_Valid(false)
|
||||||
, m_Valid(false)
|
|
||||||
{
|
{
|
||||||
Common::CPlugin *plugin = new Common::CPlugin(_rFileName);
|
if (! File::Exists(_rFilename)) {
|
||||||
if (plugin->IsValid())
|
PanicAlert("Can't find plugin %s", _rFilename);
|
||||||
{
|
return;
|
||||||
if (plugin->GetInfo(m_PluginInfo))
|
}
|
||||||
m_Valid = true;
|
|
||||||
else
|
Common::CPlugin *plugin = new Common::CPlugin(_rFilename);
|
||||||
PanicAlert("Could not get info about plugin %s", _rFileName);
|
if (plugin->IsValid()) {
|
||||||
|
if (plugin->GetInfo(m_PluginInfo))
|
||||||
delete plugin;
|
m_Valid = true;
|
||||||
}
|
else
|
||||||
|
PanicAlert("Could not get info about plugin %s", _rFilename);
|
||||||
|
|
||||||
|
delete plugin;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////
|
|
||||||
|
|
||||||
|
@ -32,11 +32,11 @@ public:
|
|||||||
CPluginInfo(const char *_rFileName);
|
CPluginInfo(const char *_rFileName);
|
||||||
bool IsValid() const {return(m_Valid);}
|
bool IsValid() const {return(m_Valid);}
|
||||||
const PLUGIN_INFO& GetPluginInfo() const {return(m_PluginInfo);}
|
const PLUGIN_INFO& GetPluginInfo() const {return(m_PluginInfo);}
|
||||||
const std::string& GetFileName() const {return(m_FileName);}
|
const std::string& GetFilename() const {return(m_Filename);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PLUGIN_INFO m_PluginInfo;
|
PLUGIN_INFO m_PluginInfo;
|
||||||
std::string m_FileName;
|
std::string m_Filename;
|
||||||
bool m_Valid;
|
bool m_Valid;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,8 +50,9 @@ public:
|
|||||||
Common::PluginWiimote *GetWiimote(int controller);
|
Common::PluginWiimote *GetWiimote(int controller);
|
||||||
Common::PluginDSP *GetDSP();
|
Common::PluginDSP *GetDSP();
|
||||||
Common::PluginVideo *GetVideo();
|
Common::PluginVideo *GetVideo();
|
||||||
Common::PluginPAD *FreePad();
|
|
||||||
Common::PluginVideo *FreeVideo();
|
void FreePad(u32 pad);
|
||||||
|
void FreeVideo();
|
||||||
|
|
||||||
bool InitPlugins();
|
bool InitPlugins();
|
||||||
void ShutdownPlugins();
|
void ShutdownPlugins();
|
||||||
|
@ -15,9 +15,7 @@
|
|||||||
// Official SVN repository and contact information can be found at
|
// Official SVN repository and contact information can be found at
|
||||||
// http://code.google.com/p/dolphin-emu/
|
// http://code.google.com/p/dolphin-emu/
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Include
|
// Include
|
||||||
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
|
||||||
#include <string> // System
|
#include <string> // System
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@ -29,19 +27,11 @@
|
|||||||
#include "PluginManager.h"
|
#include "PluginManager.h"
|
||||||
#include "ConfigManager.h"
|
#include "ConfigManager.h"
|
||||||
#include "Frame.h"
|
#include "Frame.h"
|
||||||
//////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Declarations and definitions
|
// Declarations and definitions
|
||||||
// ¯¯¯¯¯¯¯¯¯¯
|
|
||||||
extern CFrame* main_frame;
|
extern CFrame* main_frame;
|
||||||
///////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Event table
|
// Event table
|
||||||
// ¯¯¯¯¯¯¯¯¯¯
|
|
||||||
BEGIN_EVENT_TABLE(CConfigMain, wxDialog)
|
BEGIN_EVENT_TABLE(CConfigMain, wxDialog)
|
||||||
|
|
||||||
EVT_CLOSE(CConfigMain::OnClose)
|
EVT_CLOSE(CConfigMain::OnClose)
|
||||||
@ -89,12 +79,8 @@ EVT_CHOICE(ID_WIIMOTE_CB, CConfigMain::OnSelectionChanged)
|
|||||||
EVT_BUTTON(ID_WIIMOTE_CONFIG, CConfigMain::OnConfig)
|
EVT_BUTTON(ID_WIIMOTE_CONFIG, CConfigMain::OnConfig)
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Window class
|
// Window class
|
||||||
// ¯¯¯¯¯¯¯¯¯¯
|
|
||||||
CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
|
CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
|
||||||
: wxDialog(parent, id, title, position, size, style)
|
: wxDialog(parent, id, title, position, size, style)
|
||||||
{
|
{
|
||||||
@ -129,12 +115,9 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
|
|||||||
CConfigMain::~CConfigMain()
|
CConfigMain::~CConfigMain()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
// ====================================================================
|
|
||||||
// Enable or disable objects
|
// Enable or disable objects
|
||||||
// -------------
|
|
||||||
void CConfigMain::UpdateGUI()
|
void CConfigMain::UpdateGUI()
|
||||||
{
|
{
|
||||||
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
if(Core::GetState() != Core::CORE_UNINITIALIZED)
|
||||||
@ -147,7 +130,7 @@ void CConfigMain::UpdateGUI()
|
|||||||
OptimizeQuantizers->Disable();
|
OptimizeQuantizers->Disable();
|
||||||
SkipIdle->Disable();
|
SkipIdle->Disable();
|
||||||
EnableCheats->Disable();
|
EnableCheats->Disable();
|
||||||
// --------
|
|
||||||
GamecubePage->Disable();
|
GamecubePage->Disable();
|
||||||
WiiPage->Disable();
|
WiiPage->Disable();
|
||||||
PathsPage->Disable();
|
PathsPage->Disable();
|
||||||
@ -187,13 +170,9 @@ void CConfigMain::CreateGUIControls()
|
|||||||
Notebook->AddPage(PluginPage, wxT("Plugins"));
|
Notebook->AddPage(PluginPage, wxT("Plugins"));
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// General page
|
// General page
|
||||||
// --------
|
|
||||||
|
|
||||||
// -----------------------------------
|
|
||||||
// Core Settings
|
// Core Settings
|
||||||
// -----------
|
|
||||||
// Basic Settings
|
// Basic Settings
|
||||||
UseDualCore = new wxCheckBox(GeneralPage, ID_USEDUALCORE, wxT("Enable Dual Core"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
UseDualCore = new wxCheckBox(GeneralPage, ID_USEDUALCORE, wxT("Enable Dual Core"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
UseDualCore->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore);
|
UseDualCore->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUseDualCore);
|
||||||
@ -211,9 +190,8 @@ void CConfigMain::CreateGUIControls()
|
|||||||
OptimizeQuantizers = new wxCheckBox(GeneralPage, ID_OPTIMIZEQUANTIZERS, wxT("Optimize Quantizers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
OptimizeQuantizers = new wxCheckBox(GeneralPage, ID_OPTIMIZEQUANTIZERS, wxT("Optimize Quantizers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
OptimizeQuantizers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bOptimizeQuantizers);
|
OptimizeQuantizers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bOptimizeQuantizers);
|
||||||
|
|
||||||
// -----------------------------------
|
|
||||||
// Interface settings
|
// Interface settings
|
||||||
// -----------
|
|
||||||
// Confirm on stop
|
// Confirm on stop
|
||||||
ConfirmStop = new wxCheckBox(GeneralPage, ID_INTERFACE_CONFIRMSTOP, wxT("Confirm On Stop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
ConfirmStop = new wxCheckBox(GeneralPage, ID_INTERFACE_CONFIRMSTOP, wxT("Confirm On Stop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
ConfirmStop->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop);
|
ConfirmStop->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop);
|
||||||
@ -308,9 +286,7 @@ void CConfigMain::CreateGUIControls()
|
|||||||
sGeneralPage->Layout();
|
sGeneralPage->Layout();
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// Gamecube page
|
// Gamecube page
|
||||||
// --------
|
|
||||||
sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("IPL Settings"));
|
sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("IPL Settings"));
|
||||||
/*
|
/*
|
||||||
arrayStringFor_GCSystemLang.Add(wxT("English"));
|
arrayStringFor_GCSystemLang.Add(wxT("English"));
|
||||||
@ -334,9 +310,7 @@ void CConfigMain::CreateGUIControls()
|
|||||||
sGamecube->Layout();
|
sGamecube->Layout();
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// Wii page
|
// Wii page
|
||||||
// --------
|
|
||||||
sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings"));
|
sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings"));
|
||||||
arrayStringFor_WiiSensBarPos.Add(wxT("Bottom")); arrayStringFor_WiiSensBarPos.Add(wxT("Top"));
|
arrayStringFor_WiiSensBarPos.Add(wxT("Bottom")); arrayStringFor_WiiSensBarPos.Add(wxT("Top"));
|
||||||
WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize);
|
WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize);
|
||||||
@ -384,9 +358,7 @@ void CConfigMain::CreateGUIControls()
|
|||||||
sWii->Layout();
|
sWii->Layout();
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// Paths page
|
// Paths page
|
||||||
// --------
|
|
||||||
sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories"));
|
sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories"));
|
||||||
ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator);
|
ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator);
|
||||||
AddISOPath = new wxButton(PathsPage, ID_ADDISOPATH, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0);
|
AddISOPath = new wxButton(PathsPage, ID_ADDISOPATH, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0);
|
||||||
@ -424,9 +396,7 @@ void CConfigMain::CreateGUIControls()
|
|||||||
PathsPage->SetSizer(sPaths);
|
PathsPage->SetSizer(sPaths);
|
||||||
sPaths->Layout();
|
sPaths->Layout();
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// Plugins page
|
// Plugins page
|
||||||
// --------
|
|
||||||
sbGraphicsPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Graphics"));
|
sbGraphicsPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Graphics"));
|
||||||
GraphicSelection = new wxChoice(PluginPage, ID_GRAPHIC_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
|
GraphicSelection = new wxChoice(PluginPage, ID_GRAPHIC_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator);
|
||||||
GraphicConfig = new wxButton(PluginPage, ID_GRAPHIC_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
GraphicConfig = new wxButton(PluginPage, ID_GRAPHIC_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||||
@ -523,9 +493,7 @@ void CConfigMain::CloseClick(wxCommandEvent& WXUNUSED (event))
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ====================================================================
|
|
||||||
// Core settings
|
// Core settings
|
||||||
// -------------
|
|
||||||
void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
|
void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
switch (event.GetId())
|
switch (event.GetId())
|
||||||
@ -587,13 +555,10 @@ void CConfigMain::GCSettingsChanged(wxCommandEvent& event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ==========================
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ====================================================================
|
|
||||||
// Wii settings
|
// Wii settings
|
||||||
// -------------
|
|
||||||
void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
|
void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
switch (event.GetId())
|
switch (event.GetId())
|
||||||
@ -619,13 +584,10 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ==========================
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ====================================================================
|
|
||||||
// Paths settings
|
// Paths settings
|
||||||
// -------------
|
|
||||||
void CConfigMain::ISOPathsSelectionChanged(wxCommandEvent& WXUNUSED (event))
|
void CConfigMain::ISOPathsSelectionChanged(wxCommandEvent& WXUNUSED (event))
|
||||||
{
|
{
|
||||||
if (!ISOPaths->GetStringSelection().empty())
|
if (!ISOPaths->GetStringSelection().empty())
|
||||||
@ -684,9 +646,7 @@ void CConfigMain::DVDRootChanged(wxFileDirPickerEvent& WXUNUSED (event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// =======================================================
|
|
||||||
// Plugins settings
|
// Plugins settings
|
||||||
// -------------
|
|
||||||
|
|
||||||
// Update plugin filenames
|
// Update plugin filenames
|
||||||
void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
|
void CConfigMain::OnSelectionChanged(wxCommandEvent& WXUNUSED (event))
|
||||||
@ -731,7 +691,7 @@ void CConfigMain::CallConfig(wxChoice* _pChoice)
|
|||||||
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
|
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
|
||||||
|
|
||||||
if (pInfo != NULL)
|
if (pInfo != NULL)
|
||||||
CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFileName().c_str(), pInfo->GetPluginInfo().Type);
|
CPluginManager::GetInstance().OpenConfig((HWND) this->GetHandle(), pInfo->GetFilename().c_str(), pInfo->GetPluginInfo().Type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,7 +714,7 @@ void CConfigMain::FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::
|
|||||||
temp = wxString::FromAscii(rInfos[i].GetPluginInfo().Name);
|
temp = wxString::FromAscii(rInfos[i].GetPluginInfo().Name);
|
||||||
int NewIndex = _pChoice->Append(temp, (void*)&rInfos[i]);
|
int NewIndex = _pChoice->Append(temp, (void*)&rInfos[i]);
|
||||||
|
|
||||||
if (rInfos[i].GetFileName() == _SelectFilename)
|
if (rInfos[i].GetFilename() == _SelectFilename)
|
||||||
{
|
{
|
||||||
Index = NewIndex;
|
Index = NewIndex;
|
||||||
}
|
}
|
||||||
@ -772,7 +732,7 @@ bool CConfigMain::GetFilename(wxChoice* _pChoice, std::string& _rFilename)
|
|||||||
if (Index >= 0)
|
if (Index >= 0)
|
||||||
{
|
{
|
||||||
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
|
const CPluginInfo* pInfo = static_cast<CPluginInfo*>(_pChoice->GetClientData(Index));
|
||||||
_rFilename = pInfo->GetFileName();
|
_rFilename = pInfo->GetFilename();
|
||||||
Console::Print("GetFilename: %i %s\n", Index, _rFilename.c_str());
|
Console::Print("GetFilename: %i %s\n", Index, _rFilename.c_str());
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@ -791,4 +751,3 @@ void CConfigMain::InterfaceLanguageChanged( wxCommandEvent& event )
|
|||||||
bRefreshList = true;
|
bRefreshList = true;
|
||||||
bRefreshCache = true;
|
bRefreshCache = true;
|
||||||
}
|
}
|
||||||
// ==========================
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user