From ba8c2aa7e439a4a721739464097439ecb2f531f6 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Thu, 15 Jan 2009 06:48:15 +0000 Subject: [PATCH] nakee's work on dolphin events. Also get wxw out of logmanager. This commit wants your comments git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1875 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Common.vcproj | 34 ++- Source/Core/Common/Src/DynamicLibrary.cpp | 6 +- Source/Core/Common/Src/FileUtil.cpp | 32 +-- Source/Core/Common/Src/Plugin.cpp | 126 ++++++------ Source/Core/Common/Src/Plugin.h | 45 ++-- Source/Core/Common/Src/PluginDSP.cpp | 36 ++++ Source/Core/Common/Src/PluginDSP.h | 37 ++++ Source/Core/Common/Src/PluginPAD.cpp | 24 +++ Source/Core/Common/Src/PluginPAD.h | 30 +++ Source/Core/Common/Src/PluginVideo.cpp | 33 +++ Source/Core/Common/Src/PluginVideo.h | 36 ++++ Source/Core/Common/Src/PluginWiimote.cpp | 24 +++ Source/Core/Common/Src/PluginWiimote.h | 32 +++ Source/Core/Common/Src/SConscript | 6 +- Source/Core/Common/Src/Timer.cpp | 16 +- Source/Core/Common/Src/Timer.h | 2 + Source/Core/Core/Core.vcproj | 82 +------- Source/Core/Core/Src/HW/DSP.cpp | 72 +++---- Source/Core/Core/Src/HW/HW.cpp | 2 +- Source/Core/Core/Src/HW/SI.cpp | 69 ++++--- .../Core/Src/HW/SI_DeviceGCController.cpp | 17 +- Source/Core/Core/Src/HW/SystemTimers.cpp | 21 +- Source/Core/Core/Src/HW/VideoInterface.cpp | 47 +++-- .../Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp | 116 +++++------ .../Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp | 45 ++-- Source/Core/Core/Src/LogManager.cpp | 37 +--- Source/Core/Core/Src/PluginManager.cpp | 193 +++++++++++++++--- Source/Core/Core/Src/PluginManager.h | 24 ++- Source/Core/Core/Src/Plugins/Plugin_DSP.cpp | 132 ------------ Source/Core/Core/Src/Plugins/Plugin_DSP.h | 63 ------ Source/Core/Core/Src/Plugins/Plugin_PAD.cpp | 90 -------- Source/Core/Core/Src/Plugins/Plugin_PAD.h | 54 ----- Source/Core/Core/Src/Plugins/Plugin_Video.cpp | 146 ------------- Source/Core/Core/Src/Plugins/Plugin_Video.h | 67 ------ .../Core/Core/Src/Plugins/Plugin_Wiimote.cpp | 99 --------- Source/Core/Core/Src/Plugins/Plugin_Wiimote.h | 55 ----- Source/Core/Core/Src/SConscript | 14 +- Source/Core/Core/Src/State.cpp | 12 +- Source/Core/DebuggerWX/DebuggerWX.vcproj | 14 +- Source/Core/DebuggerWX/Src/CodeWindow.cpp | 22 +- Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp | 18 +- Source/Core/DebuggerWX/Src/SConscript | 6 +- Source/Core/DiscIO/Src/SConscript | 2 +- Source/Core/DolphinWX/DolphinWX.vcproj | 14 +- Source/Core/DolphinWX/Src/ConfigMain.cpp | 22 +- Source/Core/DolphinWX/Src/ConfigMain.h | 2 - Source/Core/DolphinWX/Src/Frame.cpp | 23 +-- Source/Core/DolphinWX/Src/FrameTools.cpp | 23 +-- Source/Core/DolphinWX/Src/SConscript | 4 +- Source/Core/InputCommon/Src/SConscript | 2 +- Source/Core/VideoCommon/Src/SConscript | 2 +- Source/Dolphin.sln | 8 + Source/PluginSpecs/PluginSpecs.h | 43 +++- Source/PluginSpecs/pluginspecs_dsp.h | 23 --- Source/PluginSpecs/pluginspecs_pad.h | 29 +-- Source/PluginSpecs/pluginspecs_video.h | 25 --- Source/PluginSpecs/pluginspecs_wiimote.h | 25 --- Source/Plugins/Plugin_DSP_HLE/Src/SConscript | 2 +- Source/Plugins/Plugin_DSP_HLE/Src/main.cpp | 16 +- Source/Plugins/Plugin_DSP_LLE/Src/SConscript | 2 +- Source/Plugins/Plugin_DSP_LLE/Src/main.cpp | 15 +- Source/Plugins/Plugin_DSP_NULL/Src/SConscript | 2 +- Source/Plugins/Plugin_DSP_NULL/Src/main.cpp | 10 +- .../Plugin_PadSimple/Src/PadSimple.cpp | 38 ++-- .../Plugins/Plugin_PadSimple/Src/SConscript | 10 +- .../Plugin_PadSimpleEvnt.vcproj | 12 +- .../Src/GUI/ConfigDlg.cpp | 43 ++-- .../Plugin_PadSimpleEvnt/Src/PadSimple.cpp | 31 +-- .../Plugin_PadSimpleEvnt/Src/SConscript | 4 +- Source/Plugins/Plugin_VideoDX9/Src/main.cpp | 23 +-- .../Plugin_VideoOGL/Plugin_VideoOGL.vcproj | 8 +- Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp | 46 ++--- Source/Plugins/Plugin_VideoOGL/Src/GLWindow.h | 36 ++-- Source/Plugins/Plugin_VideoOGL/Src/SConscript | 10 +- .../Plugins/Plugin_VideoOGL/Src/X11Window.cpp | 3 - Source/Plugins/Plugin_VideoOGL/Src/main.cpp | 40 ++-- .../Plugins/Plugin_VideoOGL/Src/nGLUtil.cpp | 1 + Source/Plugins/Plugin_Wiimote/Src/main.cpp | 43 ++-- .../Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp | 36 ++-- Source/Plugins/Plugin_nJoy_SDL/Src/SConscript | 2 +- Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp | 106 +++++----- .../Plugin_nJoy_Testing/Src/SConscript | 4 +- .../Plugins/Plugin_nJoy_Testing/Src/nJoy.cpp | 124 +++++------ 83 files changed, 1293 insertions(+), 1657 deletions(-) create mode 100644 Source/Core/Common/Src/PluginDSP.cpp create mode 100644 Source/Core/Common/Src/PluginDSP.h create mode 100644 Source/Core/Common/Src/PluginPAD.cpp create mode 100644 Source/Core/Common/Src/PluginPAD.h create mode 100644 Source/Core/Common/Src/PluginVideo.cpp create mode 100644 Source/Core/Common/Src/PluginVideo.h create mode 100644 Source/Core/Common/Src/PluginWiimote.cpp create mode 100644 Source/Core/Common/Src/PluginWiimote.h delete mode 100644 Source/Core/Core/Src/Plugins/Plugin_DSP.cpp delete mode 100644 Source/Core/Core/Src/Plugins/Plugin_DSP.h delete mode 100644 Source/Core/Core/Src/Plugins/Plugin_PAD.cpp delete mode 100644 Source/Core/Core/Src/Plugins/Plugin_PAD.h delete mode 100644 Source/Core/Core/Src/Plugins/Plugin_Video.cpp delete mode 100644 Source/Core/Core/Src/Plugins/Plugin_Video.h delete mode 100644 Source/Core/Core/Src/Plugins/Plugin_Wiimote.cpp delete mode 100644 Source/Core/Core/Src/Plugins/Plugin_Wiimote.h diff --git a/Source/Core/Common/Common.vcproj b/Source/Core/Common/Common.vcproj index ca54b08ad3..4a7f53aed6 100644 --- a/Source/Core/Common/Common.vcproj +++ b/Source/Core/Common/Common.vcproj @@ -1,7 +1,7 @@ + + + + + + + + + + + + + + + + diff --git a/Source/Core/Common/Src/DynamicLibrary.cpp b/Source/Core/Common/Src/DynamicLibrary.cpp index 010892c183..0f9d4f56de 100644 --- a/Source/Core/Common/Src/DynamicLibrary.cpp +++ b/Source/Core/Common/Src/DynamicLibrary.cpp @@ -38,7 +38,7 @@ and stopped. #include "FileUtil.h" #include "StringUtil.h" #include "DynamicLibrary.h" -#include "../../../../Branches/MusicMod/Common/Src/Console.h" +#include "../../../../Branches/MusicMod/Common/Src/Console.h" /////////////////////////////////// @@ -52,7 +52,7 @@ std::string GetLastErrorAsString() #ifdef _WIN32 LPVOID lpMsgBuf = 0; DWORD error = GetLastError(); - FormatMessage( + FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, @@ -155,7 +155,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; diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp index 3dfdd373c6..923a35b249 100644 --- a/Source/Core/Common/Src/FileUtil.cpp +++ b/Source/Core/Common/Src/FileUtil.cpp @@ -237,7 +237,7 @@ bool Rename(const char *srcFilename, const char *destFilename) bool Copy(const char *srcFilename, const char *destFilename) { -#ifdef _WIN32 +#ifdef _WIN32 return (CopyFile(srcFilename, destFilename, FALSE) == TRUE) ? true : false; #else @@ -259,7 +259,7 @@ bool Copy(const char *srcFilename, const char *destFilename) return false; } - while(! feof(input)) { + while(! feof(input)) { if((rnum = fread(buffer, sizeof(char), BSIZE, input)) != BSIZE) { if(ferror(input) != 0){ PanicAlert("can't read source file\n"); @@ -293,7 +293,7 @@ bool Copy(const char *srcFilename, const char *destFilename) std::string GetUserDirectory() { char path[MAX_PATH]; -#ifdef _WIN32 +#ifdef _WIN32 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path))) { //return std::string(path); @@ -337,7 +337,7 @@ u64 GetSize(const char *filename) } int err = errno; PanicAlert("Error accessing %s: %s", filename, strerror(err)); -#endif +#endif return 0; } @@ -408,7 +408,7 @@ u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry) // Find the first file in the directory. DIR *dirp = opendir(_Directory.c_str()); - + while (!readdir_r(dirp, &dirent, &result) && result) { FSTEntry entry; if (result->d_name[0]=='.') continue; @@ -428,7 +428,7 @@ u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry) parentEntry.children.push_back(entry); } closedir(dirp); - + return foundEntries; } #endif @@ -494,29 +494,29 @@ error_jmp: return Result; #else // taken from http://www.dreamincode.net/code/snippet2700.htm - DIR *pdir = NULL; + DIR *pdir = NULL; pdir = opendir (_Directory.c_str()); struct dirent *pent = NULL; - if (pdir == NULL) { - return false; - } + if (pdir == NULL) { + return false; + } char file[256]; int counter = 1; - while ((pent = readdir(pdir))) { + while ((pent = readdir(pdir))) { if (counter > 2) { for (int i = 0; i < 256; i++) file[i] = '\0'; strcat(file, _Directory.c_str()); - if (pent == NULL) { - return false; - } - strcat(file, pent->d_name); + if (pent == NULL) { + return false; + } + strcat(file, pent->d_name); if (IsDirectory(file) == true) { DeleteDir(file); - } else { + } else { remove(file); } } diff --git a/Source/Core/Common/Src/Plugin.cpp b/Source/Core/Common/Src/Plugin.cpp index 4a77d9c11c..8cc82f062c 100644 --- a/Source/Core/Common/Src/Plugin.cpp +++ b/Source/Core/Common/Src/Plugin.cpp @@ -15,7 +15,7 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ - + // ======================================================= // File description @@ -24,79 +24,91 @@ the config and debugging windows and works with all plugins. */ // ============= - + #include "Plugin.h" namespace Common { -DynamicLibrary CPlugin::m_hInstLib; -void(__cdecl * CPlugin::m_GetDllInfo) (PLUGIN_INFO * _PluginInfo) = 0; -void(__cdecl * CPlugin::m_DllConfig) (HWND _hParent) = 0; -void(__cdecl * CPlugin::m_DllDebugger) (HWND _hParent, bool Show) = 0; -void(__cdecl * CPlugin::m_SetDllGlobals) (PLUGIN_GLOBALS* _PluginGlobals) = 0; - -void -CPlugin::Release(void) -{ - m_GetDllInfo = 0; - m_DllConfig = 0; - m_DllDebugger = 0; - m_SetDllGlobals = 0; - - m_hInstLib.Unload(); +CPlugin::~CPlugin() { + m_hInstLib.Unload(); } -bool -CPlugin::Load(const char* _szName) -{ - if (m_hInstLib.Load(_szName)) - { - m_GetDllInfo = (void (__cdecl*)(PLUGIN_INFO*)) m_hInstLib.Get("GetDllInfo"); - m_DllConfig = (void (__cdecl*)(HWND)) m_hInstLib.Get("DllConfig"); - m_DllDebugger = (void (__cdecl*)(HWND, bool)) m_hInstLib.Get("DllDebugger"); - m_SetDllGlobals = (void (__cdecl*)(PLUGIN_GLOBALS*)) m_hInstLib.Get("SetDllGlobals"); - return(true); +CPlugin::CPlugin(const char* _szName) : valid(false) { + if (m_hInstLib.Load(_szName)) { + + m_GetDllInfo = reinterpret_cast + (m_hInstLib.Get("GetDllInfo")); + m_DllConfig = reinterpret_cast + (m_hInstLib.Get("DllConfig")); + m_DllDebugger = reinterpret_cast + (m_hInstLib.Get("DllDebugger")); + m_SetDllGlobals = reinterpret_cast + (m_hInstLib.Get("SetDllGlobals")); + m_Initialize = reinterpret_cast + (m_hInstLib.Get("Initialize")); + m_Shutdown = reinterpret_cast + (m_hInstLib.Get("Shutdown")); + m_DoState = reinterpret_cast + (m_hInstLib.Get("DoState")); } - return(false); + if (m_GetDllInfo != 0 && + m_DllConfig != 0 && + m_DllDebugger != 0 && + m_SetDllGlobals != 0 && + m_Initialize != 0 && + m_Shutdown != 0 && + m_DoState != 0) + valid = true; + } - -bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) -{ - if (m_GetDllInfo != 0) - { - m_GetDllInfo(&_pluginInfo); - return(true); - } - - return(false); +void *CPlugin::LoadSymbol(const char *sym) { + return m_hInstLib.Get(sym); } +bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) { + if (m_GetDllInfo != 0) { + m_GetDllInfo(&_pluginInfo); + return(true); + } -void CPlugin::Config(HWND _hwnd) -{ - if (m_DllConfig != 0) - { - m_DllConfig(_hwnd); - } + return(false); } -void CPlugin::Debug(HWND _hwnd, bool Show) -{ - if (m_DllDebugger != 0) - { - m_DllDebugger(_hwnd, Show); - } + +void CPlugin::Config(HWND _hwnd) { + if (m_DllConfig != 0) + m_DllConfig(_hwnd); + } -void CPlugin::SetGlobals(PLUGIN_GLOBALS& _pluginGlobals) -{ - if (m_SetDllGlobals != 0) - { - m_SetDllGlobals(&_pluginGlobals); - } +void CPlugin::Debug(HWND _hwnd, bool Show) { + if (m_DllDebugger != 0) + m_DllDebugger(_hwnd, Show); + } -} // end of namespace Common +void CPlugin::SetGlobals(PLUGIN_GLOBALS* _pluginGlobals) { + if (m_SetDllGlobals != 0) + m_SetDllGlobals(_pluginGlobals); + +} + +void CPlugin::DoState(unsigned char **ptr, int mode) { + if (m_DoState != 0) + m_DoState(ptr, mode); +} + +void CPlugin::Initialize(void *init) { + if (m_Initialize != 0) + m_Initialize(init); +} + +void CPlugin::Shutdown() { + if (m_Shutdown != 0) + m_Shutdown(); +} + +} // end of namespace Common \ No newline at end of file diff --git a/Source/Core/Common/Src/Plugin.h b/Source/Core/Common/Src/Plugin.h index 26ed6279f4..0be36eeb24 100644 --- a/Source/Core/Common/Src/Plugin.h +++ b/Source/Core/Common/Src/Plugin.h @@ -19,35 +19,52 @@ #define _PLUGIN_H #include "Common.h" -#include "../../../PluginSpecs/PluginSpecs.h" +#include "PluginSpecs.h" #include "DynamicLibrary.h" namespace Common { + typedef void (__cdecl * TGetDllInfo)(PLUGIN_INFO*); + typedef void (__cdecl * TDllConfig)(HWND); + typedef void (__cdecl * TDllDebugger)(HWND, bool); + typedef void (__cdecl * TSetDllGlobals)(PLUGIN_GLOBALS*); + typedef void (__cdecl * TInitialize)(void *); + typedef void (__cdecl * TShutdown)(); + typedef void (__cdecl * TDoState)(unsigned char**, int); + class CPlugin { public: - static void Release(void); - static bool Load(const char* _szName); + CPlugin(const char* _szName); + ~CPlugin(); - static bool GetInfo(PLUGIN_INFO& _pluginInfo); - static void SetGlobals(PLUGIN_GLOBALS& _PluginGlobals); + virtual bool IsValid() {return valid;}; - static void Config(HWND _hwnd); - static void About(HWND _hwnd); - static void Debug(HWND _hwnd, bool Show); + bool GetInfo(PLUGIN_INFO& _pluginInfo); + void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals); + void *LoadSymbol(const char *sym); + void Config(HWND _hwnd); + void About(HWND _hwnd); + void Debug(HWND _hwnd, bool Show); + void DoState(unsigned char **ptr, int mode); + void Initialize(void *init); + void Shutdown(); private: - static DynamicLibrary m_hInstLib; - - static void (__cdecl * m_GetDllInfo)(PLUGIN_INFO* _PluginInfo); - static void (__cdecl * m_DllConfig)(HWND _hParent); - static void (__cdecl * m_DllDebugger)(HWND _hParent, bool Show); - static void (__cdecl * m_SetDllGlobals)(PLUGIN_GLOBALS* _PluginGlobals); + DynamicLibrary m_hInstLib; + bool valid; + // Functions + TGetDllInfo m_GetDllInfo; + TDllConfig m_DllConfig; + TDllDebugger m_DllDebugger; + TSetDllGlobals m_SetDllGlobals; + TInitialize m_Initialize; + TShutdown m_Shutdown; + TDoState m_DoState; }; } // end of namespace Common diff --git a/Source/Core/Common/Src/PluginDSP.cpp b/Source/Core/Common/Src/PluginDSP.cpp new file mode 100644 index 0000000000..8e57900eec --- /dev/null +++ b/Source/Core/Common/Src/PluginDSP.cpp @@ -0,0 +1,36 @@ +#include "PluginDSP.h" + +namespace Common { + PluginDSP::PluginDSP(const char *_Filename) : CPlugin(_Filename), validDSP(false) { + + DSP_ReadMailboxHigh = reinterpret_cast + (LoadSymbol("DSP_ReadMailboxHigh")); + DSP_ReadMailboxLow = reinterpret_cast + (LoadSymbol("DSP_ReadMailboxLow")); + DSP_WriteMailboxHigh = reinterpret_cast + (LoadSymbol("DSP_WriteMailboxHigh")); + DSP_WriteMailboxLow = reinterpret_cast + (LoadSymbol("DSP_WriteMailboxLow")); + DSP_ReadControlRegister = reinterpret_cast + (LoadSymbol("DSP_ReadControlRegister")); + DSP_WriteControlRegister = reinterpret_cast + (LoadSymbol("DSP_WriteControlRegister")); + DSP_Update = reinterpret_cast + (LoadSymbol("DSP_Update")); + DSP_SendAIBuffer = reinterpret_cast + (LoadSymbol("DSP_SendAIBuffer")); + + if ((DSP_ReadMailboxHigh != 0) && + (DSP_ReadMailboxLow != 0) && + (DSP_WriteMailboxHigh != 0) && + (DSP_WriteMailboxLow != 0) && + (DSP_ReadControlRegister != 0) && + (DSP_WriteControlRegister != 0) && + (DSP_SendAIBuffer != 0) && + (DSP_Update != 0)) + validDSP = true; + } + + PluginDSP::~PluginDSP() { + } +} diff --git a/Source/Core/Common/Src/PluginDSP.h b/Source/Core/Common/Src/PluginDSP.h new file mode 100644 index 0000000000..f837329fd1 --- /dev/null +++ b/Source/Core/Common/Src/PluginDSP.h @@ -0,0 +1,37 @@ +#ifndef _PLUGINDSP_H +#define _PLUGINDSP_H + +#include "pluginspecs_dsp.h" +#include "Plugin.h" + +namespace Common { + typedef void (__cdecl* TDSP_WriteMailBox)(bool _CPUMailbox, unsigned short); + typedef unsigned short (__cdecl* TDSP_ReadMailBox)(bool _CPUMailbox); + typedef unsigned short (__cdecl* TDSP_ReadControlRegister)(); + typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short); + typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate); + typedef void (__cdecl* TDSP_Update)(int cycles); + + class PluginDSP : public CPlugin + { + public: + PluginDSP(const char *_Filename); + ~PluginDSP(); + virtual bool IsValid() {return validDSP;}; + + TDSP_ReadMailBox DSP_ReadMailboxHigh; + TDSP_ReadMailBox DSP_ReadMailboxLow; + TDSP_WriteMailBox DSP_WriteMailboxHigh; + TDSP_WriteMailBox DSP_WriteMailboxLow; + TDSP_ReadControlRegister DSP_ReadControlRegister; + TDSP_WriteControlRegister DSP_WriteControlRegister; + TDSP_SendAIBuffer DSP_SendAIBuffer; + TDSP_Update DSP_Update; + + private: + bool validDSP; + + }; +} + +#endif diff --git a/Source/Core/Common/Src/PluginPAD.cpp b/Source/Core/Common/Src/PluginPAD.cpp new file mode 100644 index 0000000000..b5a0d072e0 --- /dev/null +++ b/Source/Core/Common/Src/PluginPAD.cpp @@ -0,0 +1,24 @@ +#include "PluginPAD.h" + +namespace Common { + PluginPAD::PluginPAD(const char *_Filename) : CPlugin(_Filename), validPAD(false) { + + PAD_GetStatus = reinterpret_cast + (LoadSymbol("PAD_GetStatus")); + PAD_Input = reinterpret_cast + (LoadSymbol("PAD_Input")); + PAD_Rumble = reinterpret_cast + (LoadSymbol("PAD_Rumble")); + PAD_GetAttachedPads = reinterpret_cast + (LoadSymbol("PAD_GetAttachedPads")); + + if ((PAD_GetStatus != 0) && + (PAD_Input != 0) && + (PAD_Rumble != 0) && + (PAD_GetAttachedPads != 0)) + validPAD = true; + } + + PluginPAD::~PluginPAD() { + } +} diff --git a/Source/Core/Common/Src/PluginPAD.h b/Source/Core/Common/Src/PluginPAD.h new file mode 100644 index 0000000000..8197481faa --- /dev/null +++ b/Source/Core/Common/Src/PluginPAD.h @@ -0,0 +1,30 @@ +#ifndef _PLUGINPAD_H +#define _PLUGINPAD_H + +#include "pluginspecs_pad.h" +#include "Plugin.h" + +namespace Common { + typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*); + typedef void (__cdecl* TPAD_Input)(u8, u8); + typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int); + typedef unsigned int (__cdecl* TPAD_GetAttachedPads)(); + + class PluginPAD : public CPlugin { + public: + PluginPAD(const char *_Filename); + ~PluginPAD(); + virtual bool IsValid() {return validPAD;}; + + TPAD_GetStatus PAD_GetStatus; + TPAD_Input PAD_Input; + TPAD_Rumble PAD_Rumble; + TPAD_GetAttachedPads PAD_GetAttachedPads; + + private: + bool validPAD; + + }; +} + +#endif diff --git a/Source/Core/Common/Src/PluginVideo.cpp b/Source/Core/Common/Src/PluginVideo.cpp new file mode 100644 index 0000000000..b3330a42ed --- /dev/null +++ b/Source/Core/Common/Src/PluginVideo.cpp @@ -0,0 +1,33 @@ +#include "PluginVideo.h" + +namespace Common { + PluginVideo::PluginVideo(const char *_Filename) : CPlugin(_Filename), validVideo(false) { + + Video_Prepare = reinterpret_cast + (LoadSymbol("Video_Prepare")); + Video_SendFifoData = reinterpret_cast + (LoadSymbol("Video_SendFifoData")); + Video_UpdateXFB = reinterpret_cast + (LoadSymbol("Video_UpdateXFB")); + Video_Screenshot = reinterpret_cast + (LoadSymbol("Video_Screenshot")); + Video_EnterLoop = reinterpret_cast + (LoadSymbol("Video_EnterLoop")); + Video_AddMessage = reinterpret_cast + (LoadSymbol("Video_AddMessage")); + Video_Stop = reinterpret_cast + (LoadSymbol("Video_Stop")); + + if ((Video_Prepare != 0) && + (Video_SendFifoData != 0) && + (Video_UpdateXFB != 0) && + (Video_EnterLoop != 0) && + (Video_Screenshot != 0) && + (Video_AddMessage != 0) && + (Video_Stop != 0)) + validVideo = true; + } + + PluginVideo::~PluginVideo() { + } +} diff --git a/Source/Core/Common/Src/PluginVideo.h b/Source/Core/Common/Src/PluginVideo.h new file mode 100644 index 0000000000..f679191177 --- /dev/null +++ b/Source/Core/Common/Src/PluginVideo.h @@ -0,0 +1,36 @@ +#ifndef _PLUGINVIDEO_H +#define _PLUGINVIDEO_H + +#include "pluginspecs_video.h" +#include "Plugin.h" + +namespace Common { + typedef void (__cdecl* TVideo_Prepare)(); + typedef void (__cdecl* TVideo_SendFifoData)(u8*,u32); + typedef void (__cdecl* TVideo_UpdateXFB)(u8*, u32, u32, s32); + typedef bool (__cdecl* TVideo_Screenshot)(const char* filename); + typedef void (__cdecl* TVideo_EnterLoop)(); + typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds); + typedef void (__cdecl* TVideo_Stop)(); + + class PluginVideo : public CPlugin { + public: + PluginVideo(const char *_Filename); + ~PluginVideo(); + virtual bool IsValid() {return validVideo;}; + + TVideo_Prepare Video_Prepare; + TVideo_SendFifoData Video_SendFifoData; + TVideo_UpdateXFB Video_UpdateXFB; + TVideo_Screenshot Video_Screenshot; + TVideo_EnterLoop Video_EnterLoop; + TVideo_AddMessage Video_AddMessage; + TVideo_Stop Video_Stop; + + private: + bool validVideo; + + }; +} + +#endif diff --git a/Source/Core/Common/Src/PluginWiimote.cpp b/Source/Core/Common/Src/PluginWiimote.cpp new file mode 100644 index 0000000000..9587e3b6ae --- /dev/null +++ b/Source/Core/Common/Src/PluginWiimote.cpp @@ -0,0 +1,24 @@ +#include "PluginWiimote.h" + +namespace Common { + PluginWiimote::PluginWiimote(const char *_Filename) : CPlugin(_Filename), validWiimote(false) { + + Wiimote_ControlChannel = reinterpret_cast + (LoadSymbol("Wiimote_ControlChannel")); + Wiimote_InterruptChannel = reinterpret_cast + (LoadSymbol("Wiimote_InterruptChannel")); + Wiimote_Update = reinterpret_cast + (LoadSymbol("Wiimote_Update")); + Wiimote_GetAttachedControllers = reinterpret_cast + (LoadSymbol("Wiimote_GetAttachedControllers")); + + if ((Wiimote_ControlChannel != 0) && + (Wiimote_InterruptChannel != 0) && + (Wiimote_Update != 0) && + (Wiimote_GetAttachedControllers != 0)) + validWiimote = true; + } + + PluginWiimote::~PluginWiimote() { + } +} diff --git a/Source/Core/Common/Src/PluginWiimote.h b/Source/Core/Common/Src/PluginWiimote.h new file mode 100644 index 0000000000..2a3a902b47 --- /dev/null +++ b/Source/Core/Common/Src/PluginWiimote.h @@ -0,0 +1,32 @@ +#ifndef _PLUGINWIIMOTE_H +#define _PLUGINWIIMOTE_H + +#include "pluginspecs_wiimote.h" +#include "Plugin.h" + +namespace Common { + + typedef unsigned int (__cdecl* TPAD_GetAttachedPads)(); + typedef void (__cdecl* TWiimote_Update)(); + typedef void (__cdecl* TWiimote_Output)(u16 _channelID, const void* _pData, u32 _Size); + typedef void (__cdecl* TWiimote_Input)(u16 _channelID, const void* _pData, u32 _Size); + typedef unsigned int (__cdecl* TWiimote_GetAttachedControllers)(); + + class PluginWiimote : public CPlugin { + public: + PluginWiimote(const char *_Filename); + ~PluginWiimote(); + virtual bool IsValid() {return validWiimote;}; + + TWiimote_Output Wiimote_ControlChannel; + TWiimote_Input Wiimote_InterruptChannel; + TWiimote_Update Wiimote_Update; + TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers; + + private: + bool validWiimote; + + }; +} + +#endif diff --git a/Source/Core/Common/Src/SConscript b/Source/Core/Common/Src/SConscript index 7de9965b01..46b4f8fabf 100644 --- a/Source/Core/Common/Src/SConscript +++ b/Source/Core/Common/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') @@ -17,6 +17,10 @@ files = [ "MemArena.cpp", "MemoryUtil.cpp", "Plugin.cpp", + "PluginDSP.cpp", + "PluginWiimote.cpp", + "PluginVideo.cpp", + "PluginPAD.cpp", "StringUtil.cpp", "TestFramework.cpp", "Thunk.cpp", diff --git a/Source/Core/Common/Src/Timer.cpp b/Source/Core/Common/Src/Timer.cpp index 3ecd15b11a..270a339a70 100644 --- a/Source/Core/Common/Src/Timer.cpp +++ b/Source/Core/Common/Src/Timer.cpp @@ -20,21 +20,18 @@ #endif #include +#include #include "Common.h" #include "Timer.h" #ifdef __GNUC__ -#include - u32 timeGetTime() { struct timeb t; ftime(&t); return((u32)(t.time * 1000 + t.millitm)); } - - #endif @@ -88,7 +85,6 @@ void _time64(u64* t) #endif - u64 Timer::GetTimeSinceJan1970(void) { time_t ltime; @@ -108,4 +104,14 @@ u64 Timer::GetLocalTimeSinceJan1970(void) return (u64)(sysTime + tzDiff); } + +std::string Timer::GetTimeFormatted(void) +{ + struct timeb tp; + (void)::ftime(&tp); + char temp[32]; + sprintf(temp, "%02hi:%02i:%03i", tp.time/60, tp.time%60, tp.millitm); + + return std::string(temp); +} } // end of namespace Common diff --git a/Source/Core/Common/Src/Timer.h b/Source/Core/Common/Src/Timer.h index 632196939a..ae7b7ee9fc 100644 --- a/Source/Core/Common/Src/Timer.h +++ b/Source/Core/Common/Src/Timer.h @@ -39,6 +39,8 @@ class Timer static u64 GetTimeSinceJan1970(); static u64 GetLocalTimeSinceJan1970(); + static std::string GetTimeFormatted(); + public: diff --git a/Source/Core/Core/Core.vcproj b/Source/Core/Core/Core.vcproj index 1c1ece8967..144dcb103f 100644 --- a/Source/Core/Core/Core.vcproj +++ b/Source/Core/Core/Core.vcproj @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/Core/Core/Src/HW/DSP.cpp b/Source/Core/Core/Src/HW/DSP.cpp index 034e05d918..523b936f8e 100644 --- a/Source/Core/Core/Src/HW/DSP.cpp +++ b/Source/Core/Core/Src/HW/DSP.cpp @@ -27,7 +27,7 @@ // it will automatically relatch and fire a new interrupt. // Then there's the DSP... what likely happens is that the fifo-latched-interrupt handler -// kicks off the DSP, requesting it to fill up the just used buffer through the AXList (or +// kicks off the DSP, requesting it to fill up the just used buffer through the AXList (or // whatever it might be called in Nintendo games). #include "DSP.h" @@ -40,7 +40,7 @@ #include "PeripheralInterface.h" #include "AudioInterface.h" #include "../PowerPC/PowerPC.h" -#include "../Plugins/Plugin_DSP.h" +#include "../PluginManager.h" namespace DSP { @@ -63,7 +63,7 @@ enum AR_DMA_ARADDR_H = 0x5024, AR_DMA_ARADDR_L = 0x5026, AR_DMA_CNT_H = 0x5028, - AR_DMA_CNT_L = 0x502A + AR_DMA_CNT_L = 0x502A }; // aram size and mask @@ -79,7 +79,7 @@ enum union UARAMCount { u32 Hex; - struct + struct { unsigned count : 31; unsigned dir : 1; @@ -93,7 +93,7 @@ union UDSPControl u16 Hex; struct { - unsigned DSPReset : 1; // Write 1 to reset and waits for 0 + unsigned DSPReset : 1; // Write 1 to reset and waits for 0 unsigned DSPAssertInt : 1; unsigned DSPHalt : 1; @@ -122,7 +122,7 @@ struct DSPState IntControl = 0; DSPControl.Hex = 0; } -}; +}; // Blocks are 32 bytes. union UAudioDMAControl @@ -189,7 +189,7 @@ void DoState(PointerWrap &p) void UpdateInterrupts(); -void Update_ARAM_DMA(); +void Update_ARAM_DMA(); void WriteARAM(u8 _iValue, u32 _iAddress); bool Update_DSP_ReadRegister(); void Update_DSP_WriteRegister(); @@ -233,31 +233,31 @@ void Read16(u16& _uReturnValue, const u32 _iAddress) if (_iAddress != 0xCC005004) { LOGV(DSPINTERFACE, 3, "DSPInterface(r16) 0x%08x", _iAddress); } - + Common::PluginDSP *dsp = CPluginManager::GetInstance().GetDSP(); switch (_iAddress & 0xFFFF) { // ================================================================================== // AI_REGS 0x5000+ // ================================================================================== case DSP_MAIL_TO_DSP_HI: - _uReturnValue = PluginDSP::DSP_ReadMailboxHigh(true); + _uReturnValue = dsp->DSP_ReadMailboxHigh(true); return; case DSP_MAIL_TO_DSP_LO: - _uReturnValue = PluginDSP::DSP_ReadMailboxLow(true); + _uReturnValue = dsp->DSP_ReadMailboxLow(true); return; case DSP_MAIL_FROM_DSP_HI: - _uReturnValue = PluginDSP::DSP_ReadMailboxHigh(false); + _uReturnValue = dsp->DSP_ReadMailboxHigh(false); return; case DSP_MAIL_FROM_DSP_LO: - _uReturnValue = PluginDSP::DSP_ReadMailboxLow(false); + _uReturnValue = dsp->DSP_ReadMailboxLow(false); return; case DSP_CONTROL: - _uReturnValue = (g_dspState.DSPControl.Hex & ~DSP_CONTROL_MASK) | - (PluginDSP::DSP_ReadControlRegister() & DSP_CONTROL_MASK); + _uReturnValue = (g_dspState.DSPControl.Hex & ~DSP_CONTROL_MASK) | + (dsp->DSP_ReadControlRegister() & DSP_CONTROL_MASK); return; // ================================================================================== @@ -317,7 +317,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress) void Write16(const u16 _Value, const u32 _Address) { LOGV(DSPINTERFACE, 3, "DSPInterface(w16) 0x%04x 0x%08x", _Value, _Address); - + Common::PluginDSP *dsp = CPluginManager::GetInstance().GetDSP(); switch(_Address & 0xFFFF) { // ================================================================================== @@ -325,18 +325,18 @@ void Write16(const u16 _Value, const u32 _Address) // ================================================================================== case DSP_MAIL_TO_DSP_HI: - PluginDSP::DSP_WriteMailboxHigh(true, _Value); + dsp->DSP_WriteMailboxHigh(true, _Value); break; - case DSP_MAIL_TO_DSP_LO: - PluginDSP::DSP_WriteMailboxLow(true, _Value); + case DSP_MAIL_TO_DSP_LO: + dsp->DSP_WriteMailboxLow(true, _Value); break; - case DSP_MAIL_FROM_DSP_HI: + case DSP_MAIL_FROM_DSP_HI: _dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_HI"); break; - case DSP_MAIL_FROM_DSP_LO: + case DSP_MAIL_FROM_DSP_LO: _dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_LO"); break; @@ -346,8 +346,8 @@ void Write16(const u16 _Value, const u32 _Address) case DSP_CONTROL: { UDSPControl tmpControl; - tmpControl.Hex = (_Value& ~DSP_CONTROL_MASK) | - (PluginDSP::DSP_WriteControlRegister(_Value) & DSP_CONTROL_MASK); + tmpControl.Hex = (_Value& ~DSP_CONTROL_MASK) | + (dsp->DSP_WriteControlRegister(_Value) & DSP_CONTROL_MASK); // Update DSP related flags g_dspState.DSPControl.DSPReset = tmpControl.DSPReset; @@ -379,7 +379,7 @@ void Write16(const u16 _Value, const u32 _Address) UpdateInterrupts(); } - break; + break; // ================================================================================== // AR_REGS 0x501x+ @@ -397,9 +397,9 @@ void Write16(const u16 _Value, const u32 _Address) case 0x501a: break; - case AR_DMA_MMADDR_H: + case AR_DMA_MMADDR_H: g_arDMA.MMAddr = (g_arDMA.MMAddr & 0xFFFF) | (_Value<<16); break; - case AR_DMA_MMADDR_L: + case AR_DMA_MMADDR_L: g_arDMA.MMAddr = (g_arDMA.MMAddr & 0xFFFF0000) | (_Value); break; case AR_DMA_ARADDR_H: @@ -408,7 +408,7 @@ void Write16(const u16 _Value, const u32 _Address) g_arDMA.ARAddr = (g_arDMA.ARAddr & 0xFFFF0000) | (_Value); break; case AR_DMA_CNT_H: - g_arDMA.Cnt.Hex = (g_arDMA.Cnt.Hex & 0xFFFF) | (_Value<<16); + g_arDMA.Cnt.Hex = (g_arDMA.Cnt.Hex & 0xFFFF) | (_Value<<16); g_arDMA.CntValid[0] = true; Update_ARAM_DMA(); break; @@ -421,7 +421,7 @@ void Write16(const u16 _Value, const u32 _Address) // ================================================================================== // Audio DMA_REGS 0x5030+ - // This is the DMA that goes straight out the speaker. + // This is the DMA that goes straight out the speaker. // ================================================================================== case AUDIO_DMA_START_HI: g_audioDMA.SourceAddress = (g_audioDMA.SourceAddress & 0xFFFF) | (_Value<<16); @@ -462,9 +462,9 @@ void UpdateAudioDMA() if (g_audioDMA.AudioDMAControl.Enabled && g_audioDMA.BlocksLeft) { // Read audio at g_audioDMA.ReadAddress in RAM and push onto an external audio fifo in the emulator, // to be mixed with the disc streaming output. If that audio queue fills up, we delay the emulator. - + Common::PluginDSP *dsp = CPluginManager::GetInstance().GetDSP(); // TO RESTORE OLD BEHAVIOUR, COMMENT OUT THIS LINE - PluginDSP::DSP_SendAIBuffer(g_audioDMA.ReadAddress, AudioInterface::GetDSPSampleRate()); + dsp->DSP_SendAIBuffer(g_audioDMA.ReadAddress, AudioInterface::GetDSPSampleRate()); g_audioDMA.ReadAddress += 32; g_audioDMA.BlocksLeft--; @@ -506,19 +506,19 @@ void Write32(const u32 _iValue, const u32 _iAddress) switch (_iAddress & 0xFFFF) { // ================================================================================== - // AR_REGS - i dont know why they are accessed 32 bit too ... + // AR_REGS - i dont know why they are accessed 32 bit too ... // ================================================================================== - case AR_DMA_MMADDR_H: - g_arDMA.MMAddr = _iValue; + case AR_DMA_MMADDR_H: + g_arDMA.MMAddr = _iValue; break; case AR_DMA_ARADDR_H: - g_arDMA.ARAddr = _iValue; + g_arDMA.ARAddr = _iValue; break; case AR_DMA_CNT_H: - g_arDMA.Cnt.Hex = _iValue; + g_arDMA.Cnt.Hex = _iValue; g_arDMA.CntValid[0] = g_arDMA.CntValid[1] = true; Update_ARAM_DMA(); break; @@ -531,7 +531,7 @@ void Write32(const u32 _iValue, const u32 _iAddress) // __________________________________________________________________________________________________ // UpdateInterrupts -// +// void UpdateInterrupts() { if ((g_dspState.DSPControl.AID & g_dspState.DSPControl.AID_mask) || @@ -648,7 +648,7 @@ u8 ReadARAM(u32 _iAddress) return g_ARAM[_iAddress & ARAM_MASK]; } -u8* GetARAMPtr() +u8* GetARAMPtr() { return g_ARAM; } diff --git a/Source/Core/Core/Src/HW/HW.cpp b/Source/Core/Core/Src/HW/HW.cpp index a59452476b..b4ca7819e6 100644 --- a/Source/Core/Core/Src/HW/HW.cpp +++ b/Source/Core/Core/Src/HW/HW.cpp @@ -33,7 +33,7 @@ #include "AudioInterface.h" #include "VideoInterface.h" #include "WII_IPC.h" -#include "../Plugins/Plugin_Video.h" +#include "../PluginManager.h" #include "../CoreTiming.h" #include "SystemTimers.h" #include "../IPC_HLE/WII_IPC_HLE.h" diff --git a/Source/Core/Core/Src/HW/SI.cpp b/Source/Core/Core/Src/HW/SI.cpp index fb1fe3741b..192db7598e 100644 --- a/Source/Core/Core/Src/HW/SI.cpp +++ b/Source/Core/Core/Src/HW/SI.cpp @@ -20,7 +20,7 @@ #include "PeripheralInterface.h" -#include "../Plugins/Plugin_PAD.h" +#include "../PluginManager.h" #include "SI.h" #include "SI_Device.h" @@ -111,13 +111,13 @@ struct SSIChannel USIChannelIn_Hi m_InHi; USIChannelIn_Lo m_InLo; ISIDevice* m_pDevice; -}; +}; // SI Poll: Controls how often a device is polled -union USIPoll +union USIPoll { u32 Hex; - struct + struct { unsigned VBCPY3 : 1; unsigned VBCPY2 : 1; @@ -137,7 +137,7 @@ union USIPoll union USIComCSR { u32 Hex; - struct + struct { unsigned TSTART : 1; unsigned CHANNEL : 2; // determines which SI channel will be used the communication interface. @@ -200,7 +200,7 @@ union USIStatusReg union USIEXIClockCount { u32 Hex; - struct + struct { unsigned LOCK : 1; unsigned : 30; @@ -225,7 +225,7 @@ void DoState(PointerWrap &p) p.Do(g_SIBuffer); } -static void GenerateSIInterrupt(SIInterruptType _SIInterrupt); +static void GenerateSIInterrupt(SIInterruptType _SIInterrupt); void RunSIBuffer(); void UpdateInterrupts(); @@ -236,17 +236,24 @@ void Init() g_Channel[i].m_Out.Hex = 0; g_Channel[i].m_InHi.Hex = 0; g_Channel[i].m_InLo.Hex = 0; - } + } + + Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(0); + + unsigned int AttachedPadMask; + if (pad != NULL) + AttachedPadMask = pad->PAD_GetAttachedPads(); + else + AttachedPadMask = 1; - unsigned int AttachedPadMask = PluginPAD::PAD_GetAttachedPads ? PluginPAD::PAD_GetAttachedPads() : 1; for (int i = 0; i < 4; i++) { if (AttachedPadMask & (1 << i)) g_Channel[i].m_pDevice = new CSIDevice_GCController(i); else g_Channel[i].m_pDevice = new CSIDevice_Dummy(i); - } - + } + g_Poll.Hex = 0; g_ComCSR.Hex = 0; g_StatusReg.Hex = 0; @@ -285,13 +292,13 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) _uReturnValue = g_Channel[0].m_Out.Hex; return; - case SI_CHANNEL_0_IN_HI: + case SI_CHANNEL_0_IN_HI: g_StatusReg.RDST0 = 0; UpdateInterrupts(); _uReturnValue = g_Channel[0].m_InHi.Hex; return; - case SI_CHANNEL_0_IN_LO: + case SI_CHANNEL_0_IN_LO: g_StatusReg.RDST0 = 0; UpdateInterrupts(); _uReturnValue = g_Channel[0].m_InLo.Hex; @@ -304,13 +311,13 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) _uReturnValue = g_Channel[1].m_Out.Hex; return; - case SI_CHANNEL_1_IN_HI: + case SI_CHANNEL_1_IN_HI: g_StatusReg.RDST1 = 0; UpdateInterrupts(); _uReturnValue = g_Channel[1].m_InHi.Hex; return; - case SI_CHANNEL_1_IN_LO: + case SI_CHANNEL_1_IN_LO: g_StatusReg.RDST1 = 0; UpdateInterrupts(); _uReturnValue = g_Channel[1].m_InLo.Hex; @@ -323,13 +330,13 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) _uReturnValue = g_Channel[2].m_Out.Hex; return; - case SI_CHANNEL_2_IN_HI: + case SI_CHANNEL_2_IN_HI: g_StatusReg.RDST2 = 0; UpdateInterrupts(); _uReturnValue = g_Channel[2].m_InHi.Hex; return; - case SI_CHANNEL_2_IN_LO: + case SI_CHANNEL_2_IN_LO: g_StatusReg.RDST2 = 0; UpdateInterrupts(); _uReturnValue = g_Channel[2].m_InLo.Hex; @@ -348,7 +355,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) _uReturnValue = g_Channel[3].m_InHi.Hex; return; - case SI_CHANNEL_3_IN_LO: + case SI_CHANNEL_3_IN_LO: g_StatusReg.RDST3 = 0; UpdateInterrupts(); _uReturnValue = g_Channel[3].m_InLo.Hex; @@ -364,7 +371,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) LOG(SERIALINTERFACE, "(r32-unk): 0x%08x", _iAddress); _dbg_assert_(SERIALINTERFACE,0); break; - } + } // error _uReturnValue = 0xdeadbeef; @@ -399,7 +406,7 @@ void Write32(const u32 _iValue, const u32 _iAddress) case SI_CHANNEL_3_IN_LO: g_Channel[3].m_InLo.Hex = _iValue; break; case SI_POLL: - g_Poll.Hex = _iValue; + g_Poll.Hex = _iValue; break; case SI_COM_CSR: @@ -423,7 +430,7 @@ void Write32(const u32 _iValue, const u32 _iAddress) } break; - case SI_STATUS_REG: + case SI_STATUS_REG: { USIStatusReg tmpStatus(_iValue); @@ -465,8 +472,8 @@ void Write32(const u32 _iValue, const u32 _iAddress) } break; - case SI_EXI_CLOCK_COUNT: - g_EXIClockCount.Hex = _iValue; + case SI_EXI_CLOCK_COUNT: + g_EXIClockCount.Hex = _iValue; break; case 0x80: @@ -476,7 +483,7 @@ void Write32(const u32 _iValue, const u32 _iAddress) default: _dbg_assert_(SERIALINTERFACE,0); break; - } + } } void UpdateInterrupts() @@ -502,7 +509,7 @@ void UpdateInterrupts() void GenerateSIInterrupt(SIInterruptType _SIInterrupt) { - switch(_SIInterrupt) + switch(_SIInterrupt) { case INT_RDSTINT: g_ComCSR.RDSTINT = 1; break; case INT_TCINT: g_ComCSR.TCINT = 1; break; @@ -524,23 +531,23 @@ void UpdateDevices() } void RunSIBuffer() -{ +{ // math inLength int inLength = g_ComCSR.INLNGTH; - if (inLength == 0) + if (inLength == 0) inLength = 128; - else + else inLength++; // math outLength int outLength = g_ComCSR.OUTLNGTH; - if (outLength == 0) + if (outLength == 0) outLength = 128; - else + else outLength++; #ifdef LOGGING - int numOutput = + int numOutput = #endif g_Channel[g_ComCSR.CHANNEL].m_pDevice->RunBuffer(g_SIBuffer, inLength); LOGV(SERIALINTERFACE, 2, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, outLength, numOutput); diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp index e767fa0c2f..7cb07a05c7 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp @@ -20,7 +20,7 @@ #include "SI_Device.h" #include "SI_DeviceGCController.h" -#include "../Plugins/Plugin_PAD.h" +#include "../PluginManager.h" #include "EXI_Device.h" #include "EXI_DeviceMic.h" @@ -50,7 +50,7 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength) int iPosition = 0; while(iPosition < _iLength) - { + { // read the command EBufferCommands command = static_cast(_pBuffer[iPosition ^ 3]); iPosition++; @@ -114,12 +114,13 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength) // // return true on new data (max 7 Bytes and 6 bits ;) // -bool +bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low) { SPADStatus PadStatus; memset(&PadStatus, 0 ,sizeof(PadStatus)); - PluginPAD::PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus); + Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(0); + pad->PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus); _Hi = (u32)((u8)PadStatus.stickY); _Hi |= (u32)((u8)PadStatus.stickX << 8); @@ -141,11 +142,13 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low) // __________________________________________________________________________________________________ // SendCommand -// +// void CSIDevice_GCController::SendCommand(u32 _Cmd) { + Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(0); UCommand command(_Cmd); + switch(command.Command) { // Costis sent it in some demos :) @@ -156,8 +159,8 @@ CSIDevice_GCController::SendCommand(u32 _Cmd) { unsigned int uType = command.Parameter1; // 0 = stop, 1 = rumble, 2 = stop hard unsigned int uStrength = command.Parameter2; - if (PluginPAD::PAD_Rumble) - PluginPAD::PAD_Rumble(ISIDevice::m_iDeviceNumber, uType, uStrength); + if (pad->PAD_Rumble) + pad->PAD_Rumble(ISIDevice::m_iDeviceNumber, uType, uStrength); } break; diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp index 48c6bdbae9..55a161b6a3 100644 --- a/Source/Core/Core/Src/HW/SystemTimers.cpp +++ b/Source/Core/Core/Src/HW/SystemTimers.cpp @@ -17,7 +17,7 @@ ///////////////////////////////////////////////////////////////////////////// -// File description: This file control all system timers +// File description: This file controls all system timers /* ------------- "Time" is measured in frames, not time: These update frequencies are determined by the passage of frames. So if a game runs slow, on a slow computer for example, these updates will occur @@ -38,7 +38,7 @@ frame. - IPC_HLE_PERIOD: For the Wiimote this is the call scedule: + IPC_HLE_PERIOD: For the Wiimote this is the call scedule: IPC_HLE_UpdateCallback() // In this file // This function seems to call all devices' Update() function four times per frame @@ -63,8 +63,7 @@ #include "Common.h" #include "../PatchEngine.h" #include "SystemTimers.h" -#include "../Plugins/Plugin_DSP.h" -#include "../Plugins/Plugin_Video.h" +#include "../PluginManager.h" #include "../HW/DSP.h" #include "../HW/AudioInterface.h" #include "../HW/VideoInterface.h" @@ -113,14 +112,14 @@ int et_FakeGPWD; // for DC watchdog hack // Feel free to experiment int // update VI often to let it go through its scanlines with decent accuracy - // Maybe should actually align this with the scanline update? Current method in + // Maybe should actually align this with the scanline update? Current method in // VideoInterface::Update is stupid! - VI_PERIOD = GetTicksPerSecond() / (60*120), + VI_PERIOD = GetTicksPerSecond() / (60*120), // TODO: The SI interfact actually has a register that determines the polling frequency. // We should obey that instead of arbitrarly checking at 60fps. SI_PERIOD = GetTicksPerSecond() / 60, //once a frame is good for controllers - + // This one should simply be determined by the increasing counter in AI. AI_PERIOD = GetTicksPerSecond() / 80, @@ -160,12 +159,12 @@ void AICallback(u64 userdata, int cyclesLate) void DSPCallback(u64 userdata, int cyclesLate) { // ~1/6th as many cycles as the period PPC-side. - PluginDSP::DSP_Update(DSP_PERIOD / 6); + CPluginManager::GetInstance().GetDSP()->DSP_Update(DSP_PERIOD / 6); CoreTiming::ScheduleEvent(DSP_PERIOD-cyclesLate, et_DSP); } void AudioFifoCallback(u64 userdata, int cyclesLate) -{ +{ int period = CPU_CORE_CLOCK / (AudioInterface::GetDSPSampleRate() * 4 / 32); DSP::UpdateAudioDMA(); // Push audio to speakers. @@ -173,7 +172,7 @@ void AudioFifoCallback(u64 userdata, int cyclesLate) } void IPC_HLE_UpdateCallback(u64 userdata, int cyclesLate) -{ +{ WII_IPC_HLE_Interface::Update(); CoreTiming::ScheduleEvent(IPC_HLE_PERIOD-cyclesLate, et_IPC_HLE); } @@ -233,7 +232,7 @@ void Init() if (Core::GetStartupParameter().bWii) { CPU_CORE_CLOCK = 721000000; - VI_PERIOD = GetTicksPerSecond() / (60*120); + VI_PERIOD = GetTicksPerSecond() / (60*120); SI_PERIOD = GetTicksPerSecond() / 60; // once a frame is good for controllers // These are the big question marks IMHO :) diff --git a/Source/Core/Core/Src/HW/VideoInterface.cpp b/Source/Core/Core/Src/HW/VideoInterface.cpp index f07479d1c0..3831bda0ba 100644 --- a/Source/Core/Core/Src/HW/VideoInterface.cpp +++ b/Source/Core/Core/Src/HW/VideoInterface.cpp @@ -23,7 +23,7 @@ #include "PeripheralInterface.h" #include "VideoInterface.h" #include "Memmap.h" -#include "../Plugins/Plugin_Video.h" +#include "../PluginManager.h" #include "../CoreTiming.h" #include "../HW/SystemTimers.h" @@ -66,7 +66,7 @@ union UVIVerticalTimingRegister union UVIDisplayControlRegister { u16 Hex; - struct + struct { unsigned ENB : 1; unsigned RST : 1; @@ -85,7 +85,7 @@ union UVIDisplayControlRegister union UVIInterruptRegister { u32 Hex; - struct + struct { u16 Lo; u16 Hi; @@ -129,7 +129,7 @@ union UVIHorizontalScaling union UVIFrameBufferAddress { u32 Hex; - struct + struct { u16 Lo; u16 Hi; @@ -172,9 +172,9 @@ void DoState(PointerWrap &p) p.Do(m_VIVerticalTimingRegister); p.Do(m_VIDisplayControlRegister); p.Do(m_FrameBufferTop); - p.Do(m_FrameBufferBottom); + p.Do(m_FrameBufferBottom); p.Do(m_VIInterruptRegister); - p.DoArray(m_UVIUnknownRegs, 0x1000); + p.DoArray(m_UVIUnknownRegs, 0x1000); p.Do(HorizontalBeamPos); p.Do(VerticalBeamPos); p.Do(TicksPerFrame); @@ -233,7 +233,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress) _uReturnValue = HorizontalBeamPos; return; - // RETRACE STUFF ... + // RETRACE STUFF ... case VI_PRERETRACE: _uReturnValue = m_VIInterruptRegister[0].Hi; return; @@ -273,7 +273,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress) void Write16(const u16 _iValue, const u32 _iAddress) { LOGV(VIDEOINTERFACE, 3, "(w16): 0x%04x, 0x%08x",_iValue,_iAddress); - + //Somewhere it sets screen width.. we need to communicate this to the gfx plugin... switch (_iAddress & 0xFFF) @@ -307,7 +307,7 @@ void Write16(const u16 _iValue, const u32 _iAddress) case VI_FRAMEBUFFER_TOP_LO: m_FrameBufferTop.Lo = _iValue; - break; + break; case VI_FRAMEBUFFER_BOTTOM_HI: m_FrameBufferBottom.Hi = _iValue; @@ -325,7 +325,7 @@ void Write16(const u16 _iValue, const u32 _iAddress) _dbg_assert_(VIDEOINTERFACE,0); break; - // RETRACE STUFF ... + // RETRACE STUFF ... case VI_PRERETRACE: m_VIInterruptRegister[0].Hi = _iValue; UpdateInterrupts(); @@ -392,12 +392,12 @@ void Read32(u32& _uReturnValue, const u32 _iAddress) void Write32(const u32 _iValue, const u32 _iAddress) { LOG(VIDEOINTERFACE, "(w32): 0x%08x, 0x%08x",_iValue,_iAddress); - + // Allow 32-bit writes to the VI: although this is officially not // allowed, the hardware seems to accept it (for example, DesktopMan GC // Tetris uses it). Write16(_iValue >> 16, _iAddress); - Write16(_iValue & 0xFFFF, _iAddress + 2); + Write16(_iValue & 0xFFFF, _iAddress + 2); } void UpdateInterrupts() @@ -417,7 +417,7 @@ void UpdateInterrupts() void GenerateVIInterrupt(VIInterruptType _VIInterrupt) { - switch(_VIInterrupt) + switch(_VIInterrupt) { case INT_PRERETRACE: m_VIInterruptRegister[0].IR_INT = 1; break; case INT_POSTRETRACE: m_VIInterruptRegister[1].IR_INT = 1; break; @@ -432,7 +432,7 @@ void GenerateVIInterrupt(VIInterruptType _VIInterrupt) (m_VIInterruptRegister[3].IR_MASK == 1)) { PanicAlert("m_VIInterruptRegister[2 and 3] activated - Tell F|RES :)"); - } + } } u8* GetFrameBufferPointer() @@ -455,7 +455,7 @@ void PreInit(bool _bNTSC) Write16(0x0005, 0xcc00200c); Write16(0x01f7, 0xcc002012); Write16(0x0004, 0xcc002010); - Write16(0x410c, 0xcc002016); + Write16(0x410c, 0xcc002016); Write16(0x410c, 0xcc002014); Write16(0x40ed, 0xcc00201a); Write16(0x40ed, 0xcc002018); @@ -470,7 +470,7 @@ void PreInit(bool _bNTSC) if (_bNTSC) Write16(0x0001, 0xcc002002); // STATUS REG else - Write16(0x0101, 0xcc002002); // STATUS REG + Write16(0x0101, 0xcc002002); // STATUS REG } void UpdateTiming() @@ -519,7 +519,7 @@ void Update() NextXFBRender = LinesPerField; // The & mask is a hack for mario kart u32 addr = (VideoInterface::m_FrameBufferTop.Hex & 0xFFFFFFF) | 0x80000000; - if (addr >= 0x80000000 && + if (addr >= 0x80000000 && addr <= (0x81800000-640*480*2)) xfbPtr = Memory::GetPointer(addr); } @@ -527,20 +527,20 @@ void Update() { NextXFBRender = 1; u32 addr = (VideoInterface::m_FrameBufferBottom.Hex & 0xFFFFFFF) | 0x80000000; - if (addr >= 0x80000000 && + if (addr >= 0x80000000 && addr <= (0x81800000-640*480*2)) xfbPtr = Memory::GetPointer(addr); yOffset = -1; } - - if (xfbPtr && PluginVideo::IsLoaded()) + Common::PluginVideo* video = CPluginManager::GetInstance().GetVideo(); + if (xfbPtr && video->IsValid()) { int fbWidth = m_VIHorizontalStepping.FieldSteps * 16; int fbHeight = (m_VIHorizontalStepping.FbSteps / m_VIHorizontalStepping.FieldSteps) * m_VIVerticalTimingRegister.ACV; - PluginVideo::Video_UpdateXFB(xfbPtr, fbWidth, fbHeight, yOffset); + video->Video_UpdateXFB(xfbPtr, fbWidth, fbHeight, yOffset); } } - + // check INT_PRERETRACE if (m_VIInterruptRegister[0].VCT == VerticalBeamPos) { @@ -556,6 +556,5 @@ void Update() } } } - -} +} diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index 3422f21f7d..1c61df2ea4 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -20,7 +20,7 @@ // Include // ŻŻŻŻŻŻŻŻŻŻŻŻŻ #include "WII_IPC_HLE_Device_usb.h" -#include "../Plugins/Plugin_Wiimote.h" +#include "../PluginManager.h" #include "../Core.h" // Local core functions #include "../Debugger/Debugger_SymbolMap.h" @@ -95,10 +95,10 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtl(u32 _CommandAddress) // =================================================== /* IOCtlV */ // ---------------- -bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) -{ +bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) +{ /* - + Memory::Write_U8(255, 0x80149950); // BTM LOG // 3 logs L2Cap // 4 logs l2_csm$ @@ -107,8 +107,8 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) Memory::Write_U8(255, 0x80149048); // HID - Memory::Write_U8(3, 0x80152058); // low ?? // >= 4 and you will get a lot of event messages of the same type - + Memory::Write_U8(3, 0x80152058); // low ?? // >= 4 and you will get a lot of event messages of the same type + Memory::Write_U8(1, 0x80152018); // WUD Memory::Write_U8(1, 0x80151FC8); // DEBUGPrint */ @@ -128,7 +128,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) { SHCICommandMessage CtrlSetup; - // the USB stuff is little endian.. + // the USB stuff is little endian.. CtrlSetup.bRequestType = *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[0].m_Address); CtrlSetup.bRequest = *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[1].m_Address); CtrlSetup.wValue = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[2].m_Address); @@ -138,7 +138,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) CtrlSetup.m_PayLoadSize = CommandBuffer.PayloadBuffer[0].m_Size; // check termination - _dbg_assert_msg_(WII_IPC_WIIMOTE, *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[5].m_Address) == 0, + _dbg_assert_msg_(WII_IPC_WIIMOTE, *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[5].m_Address) == 0, "WIIMOTE: Termination != 0"); #if 0 @@ -202,7 +202,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) case USB_IOCTL_INTRMSG: - { + { u8 Command = Memory::Read_U8(CommandBuffer.InBuffer[0].m_Address); switch (Command) { @@ -236,7 +236,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress) LOG(WII_IPC_WIIMOTE, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer); LOG(WII_IPC_WIIMOTE, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer); LOG(WII_IPC_WIIMOTE, " BufferVector: 0x%08x", CommandBuffer.BufferVector); - LOG(WII_IPC_WIIMOTE, " BufferSize: 0x%08x", CommandBuffer.BufferSize); + LOG(WII_IPC_WIIMOTE, " BufferSize: 0x%08x", CommandBuffer.BufferSize); DumpAsync(CommandBuffer.BufferVector, _CommandAddress, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer); } break; @@ -297,7 +297,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendACLFrame(u16 _ConnectionHandle, u8 } LOGV(WII_IPC_WIIMOTE, 1, " Size: 0x%08x", _Size); LOGV(WII_IPC_WIIMOTE, 1, " Data: %s", Temp.c_str()); */ - + g_HCICount++; } @@ -332,11 +332,11 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() return Addr; } - + // check if we can fill the aclbuffer - if(!m_AclFrameQue.empty() && m_pACLBuffer) + if(!m_AclFrameQue.empty() && m_pACLBuffer) { - ACLFrame& frame = m_AclFrameQue.front(); + ACLFrame& frame = m_AclFrameQue.front(); LOGV(WII_IPC_WIIMOTE, 1, "Sending ACL frame."); UACLHeader* pHeader = (UACLHeader*)Memory::GetPointer(m_pACLBuffer->PayloadBuffer[0].m_Address); @@ -392,13 +392,13 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() if (m_AclFrameQue.empty()) { - PluginWiimote::Wiimote_Update(); + CPluginManager::GetInstance().GetWiimote(0)->Wiimote_Update(); } // -------------------------------------------------------------------- /* We wait for ScanEnable to be sent from the game through HCI_CMD_WRITE_SCAN_ENABLE before we initiate the connection. To avoid doing this for GC games we also - want m_LocalName from CommandWriteLocalName() to be "Wii". + want m_LocalName from CommandWriteLocalName() to be "Wii". FiRES: TODO find a good solution to do this JP: Solution to what? When to run SendEventRequestConnection()? @@ -432,7 +432,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update() } } - return 0; + return 0; } @@ -484,7 +484,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventCommandComplete(u16 _OpCode, // add the payload if ((_pData != NULL) && (_DataSize > 0)) { - u8* pPayload = Event.m_buffer + sizeof(SHCIEventCommand); + u8* pPayload = Event.m_buffer + sizeof(SHCIEventCommand); memcpy(pPayload, _pData, _DataSize); } @@ -506,7 +506,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryResponse() SHCIEventInquiryResult* pInquiryResult = (SHCIEventInquiryResult*)Event.m_buffer; pInquiryResult->EventType = 0x02; - pInquiryResult->PayloadLength = (u8)(sizeof(SHCIEventInquiryResult) - 2 + (m_WiiMotes.size() * sizeof(hci_inquiry_response))); + pInquiryResult->PayloadLength = (u8)(sizeof(SHCIEventInquiryResult) - 2 + (m_WiiMotes.size() * sizeof(hci_inquiry_response))); pInquiryResult->num_responses = (u8)m_WiiMotes.size(); for (size_t i=0; iclock_offset = 0x3818; LOG(WII_IPC_WIIMOTE, "Event: Send Fake Inquriy of one controller"); - LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pResponse->bdaddr.b[0], pResponse->bdaddr.b[1], pResponse->bdaddr.b[2], pResponse->bdaddr.b[3], pResponse->bdaddr.b[4], pResponse->bdaddr.b[5]); } @@ -544,7 +544,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryComplete() SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Event.m_buffer; pInquiryComplete->EventType = 0x01; - pInquiryComplete->PayloadLength = sizeof(SHCIEventInquiryComplete) - 2; + pInquiryComplete->PayloadLength = sizeof(SHCIEventInquiryComplete) - 2; pInquiryComplete->Status = 0x00; AddEventToQueue(Event); @@ -577,7 +577,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq(bdaddr_t _bd) AddEventToQueue(Event); LOG(WII_IPC_WIIMOTE, "Event: SendEventRemoteNameReq"); - LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRemoteNameReq->bdaddr.b[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq->bdaddr.b[2], pRemoteNameReq->bdaddr.b[3], pRemoteNameReq->bdaddr.b[4], pRemoteNameReq->bdaddr.b[5]); LOG(WII_IPC_WIIMOTE, " remotename: %s", pRemoteNameReq->RemoteName); @@ -600,7 +600,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HL pEventRequestConnection->EventType = 0x04; pEventRequestConnection->PayloadLength = sizeof(SHCIEventRequestConnection) - 2; - pEventRequestConnection->bdaddr = _rWiiMote.GetBD(); + pEventRequestConnection->bdaddr = _rWiiMote.GetBD(); pEventRequestConnection->uclass[0] = _rWiiMote.GetClass()[0]; pEventRequestConnection->uclass[1] = _rWiiMote.GetClass()[1]; pEventRequestConnection->uclass[2] = _rWiiMote.GetClass()[2]; @@ -611,8 +611,8 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HL // Log #ifdef LOGGING static char LinkType[][128] = - { - { "HCI_LINK_SCO 0x00 - Voice"}, + { + { "HCI_LINK_SCO 0x00 - Voice"}, { "HCI_LINK_ACL 0x01 - Data"}, { "HCI_LINK_eSCO 0x02 - eSCO"}, }; @@ -713,8 +713,8 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(bdaddr_t _ #ifdef LOGGING static char s_szLinkType[][128] = - { - { "HCI_LINK_SCO 0x00 - Voice"}, + { + { "HCI_LINK_SCO 0x00 - Voice"}, { "HCI_LINK_ACL 0x01 - Data"}, { "HCI_LINK_eSCO 0x02 - eSCO"}, }; @@ -722,7 +722,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(bdaddr_t _ LOG(WII_IPC_WIIMOTE, "Event: SendEventConnectionComplete"); LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pConnectionComplete->Connection_Handle); - LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pConnectionComplete->bdaddr.b[0], pConnectionComplete->bdaddr.b[1], pConnectionComplete->bdaddr.b[2], pConnectionComplete->bdaddr.b[3], pConnectionComplete->bdaddr.b[4], pConnectionComplete->bdaddr.b[5]); LOG(WII_IPC_WIIMOTE, " LinkType: %s", s_szLinkType[pConnectionComplete->LinkType]); @@ -755,7 +755,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRoleChange(bdaddr_t _bd, bool AddEventToQueue(Event); LOG(WII_IPC_WIIMOTE, "Event: SendEventRoleChange"); - LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRoleChange->bdaddr.b[0], pRoleChange->bdaddr.b[1], pRoleChange->bdaddr.b[2], pRoleChange->bdaddr.b[3], pRoleChange->bdaddr.b[4], pRoleChange->bdaddr.b[5]); LOG(WII_IPC_WIIMOTE, " NewRole: %i", pRoleChange->NewRole); @@ -778,7 +778,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadClockOffsetComplete(u16 _ SHCIEventReadClockOffsetComplete* pReadClockOffsetComplete = (SHCIEventReadClockOffsetComplete*)Event.m_buffer; pReadClockOffsetComplete->EventType = 0x1C; - pReadClockOffsetComplete->PayloadLength = sizeof(SHCIEventReadClockOffsetComplete) - 2; + pReadClockOffsetComplete->PayloadLength = sizeof(SHCIEventReadClockOffsetComplete) - 2; pReadClockOffsetComplete->Status = 0x00; pReadClockOffsetComplete->ConnectionHandle = pWiiMote->GetConnectionHandle(); pReadClockOffsetComplete->ClockOffset = 0x3818; @@ -806,7 +806,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteVerInfo(u16 _connec SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Event.m_buffer; pReadRemoteVerInfo->EventType = 0x0C; - pReadRemoteVerInfo->PayloadLength = sizeof(SHCIEventReadRemoteVerInfo) - 2; + pReadRemoteVerInfo->PayloadLength = sizeof(SHCIEventReadRemoteVerInfo) - 2; pReadRemoteVerInfo->Status = 0x00; pReadRemoteVerInfo->ConnectionHandle = pWiiMote->GetConnectionHandle(); pReadRemoteVerInfo->lmp_version = pWiiMote->GetLMPVersion(); @@ -838,7 +838,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteFeatures(u16 _conne SHCIEventReadRemoteFeatures* pReadRemoteFeatures = (SHCIEventReadRemoteFeatures*)Event.m_buffer; pReadRemoteFeatures->EventType = 0x0C; - pReadRemoteFeatures->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2; + pReadRemoteFeatures->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2; pReadRemoteFeatures->Status = 0x00; pReadRemoteFeatures->ConnectionHandle = pWiiMote->GetConnectionHandle(); pReadRemoteFeatures->features[0] = pWiiMote->GetFeatures()[0]; @@ -857,7 +857,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventReadRemoteFeatures(u16 _conne LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pReadRemoteFeatures->ConnectionHandle); LOG(WII_IPC_WIIMOTE, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", pReadRemoteFeatures->features[0], pReadRemoteFeatures->features[1], pReadRemoteFeatures->features[2], - pReadRemoteFeatures->features[3], pReadRemoteFeatures->features[4], pReadRemoteFeatures->features[5], + pReadRemoteFeatures->features[3], pReadRemoteFeatures->features[4], pReadRemoteFeatures->features[5], pReadRemoteFeatures->features[6], pReadRemoteFeatures->features[7]); return true; @@ -876,7 +876,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets(u16 SHCIEventNumberOfCompletedPackets* pNumberOfCompletedPackets = (SHCIEventNumberOfCompletedPackets*)Event.m_buffer; pNumberOfCompletedPackets->EventType = 0x13; - pNumberOfCompletedPackets->PayloadLength = sizeof(SHCIEventNumberOfCompletedPackets) - 2; + pNumberOfCompletedPackets->PayloadLength = sizeof(SHCIEventNumberOfCompletedPackets) - 2; pNumberOfCompletedPackets->NumberOfHandles = 1; pNumberOfCompletedPackets->Connection_Handle = _connectionHandle; pNumberOfCompletedPackets->Number_Of_Completed_Packets = _count; @@ -904,7 +904,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventAuthenticationCompleted(u16 _ SHCIEventAuthenticationCompleted* pEventAuthenticationCompleted = (SHCIEventAuthenticationCompleted*)Event.m_buffer; pEventAuthenticationCompleted->EventType = 0x06; - pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventAuthenticationCompleted) - 2; + pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventAuthenticationCompleted) - 2; pEventAuthenticationCompleted->Status = 0; pEventAuthenticationCompleted->Connection_Handle = _connectionHandle; @@ -930,7 +930,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventModeChange(u16 _connectionHan SHCIEventModeChange* pModeChange = (SHCIEventModeChange*)Event.m_buffer; pModeChange->EventType = 0x14; - pModeChange->PayloadLength = sizeof(SHCIEventModeChange) - 2; + pModeChange->PayloadLength = sizeof(SHCIEventModeChange) - 2; pModeChange->Status = 0; pModeChange->Connection_Handle = _connectionHandle; pModeChange->CurrentMode = _mode; @@ -959,7 +959,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventDisconnect(u16 _connectionHan SHCIEventDisconnectCompleted* pDisconnect = (SHCIEventDisconnectCompleted*)Event.m_buffer; pDisconnect->EventType = 0x06; - pDisconnect->PayloadLength = sizeof(SHCIEventDisconnectCompleted) - 2; + pDisconnect->PayloadLength = sizeof(SHCIEventDisconnectCompleted) - 2; pDisconnect->Status = 0; pDisconnect->Connection_Handle = _connectionHandle; pDisconnect->Reason = _Reason; @@ -979,7 +979,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventDisconnect(u16 _connectionHan // Command dispacther // ----------------- // This is called from the USB_IOCTL_HCI_COMMAND_MESSAGE Ioctlv -// +// // //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -996,7 +996,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom switch(pMsg->Opcode) { - // + // // --- read commandos --- // case HCI_CMD_RESET: @@ -1069,11 +1069,11 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom // vendor specific... case 0xFC4C: - CommandVendorSpecific_FC4C(pInput, _rHCICommandMessage.m_PayLoadSize - 3); + CommandVendorSpecific_FC4C(pInput, _rHCICommandMessage.m_PayLoadSize - 3); break; case 0xFC4F: - CommandVendorSpecific_FC4F(pInput, _rHCICommandMessage.m_PayLoadSize - 3); + CommandVendorSpecific_FC4F(pInput, _rHCICommandMessage.m_PayLoadSize - 3); break; case HCI_CMD_INQUIRY_CANCEL: @@ -1133,7 +1133,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom break; - // + // // --- default --- // default: @@ -1233,7 +1233,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadBDAdrr(u8* _Input) LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_BDADDR:"); LOG(WII_IPC_WIIMOTE, "return:"); - LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", Reply.bdaddr.b[0], Reply.bdaddr.b[1], Reply.bdaddr.b[2], Reply.bdaddr.b[3], Reply.bdaddr.b[4], Reply.bdaddr.b[5]); @@ -1258,7 +1258,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadLocalFeatures(u8* _Input) LOG(WII_IPC_WIIMOTE, "return:"); LOG(WII_IPC_WIIMOTE, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", Reply.features[0], Reply.features[1], Reply.features[2], - Reply.features[3], Reply.features[4], Reply.features[5], + Reply.features[3], Reply.features[4], Reply.features[5], Reply.features[6], Reply.features[7]); SendEventCommandComplete(HCI_CMD_READ_LOCAL_FEATURES, &Reply, sizeof(hci_read_local_features_rp)); @@ -1277,15 +1277,15 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandReadStoredLinkKey(u8* _Input) { Reply.num_keys_read = (u16)m_WiiMotes.size(); } - else + else { PanicAlert("CommandReadStoredLinkKey"); } - + // logging LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_STORED_LINK_KEY:"); LOG(WII_IPC_WIIMOTE, "input:"); - LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", ReadStoredLinkKey->bdaddr.b[0], ReadStoredLinkKey->bdaddr.b[1], ReadStoredLinkKey->bdaddr.b[2], ReadStoredLinkKey->bdaddr.b[3], ReadStoredLinkKey->bdaddr.b[4], ReadStoredLinkKey->bdaddr.b[5]); LOG(WII_IPC_WIIMOTE, " read_all: %i", ReadStoredLinkKey->read_all); @@ -1528,7 +1528,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandInquiry(u8* _Input) SendEventCommandStatus(HCI_CMD_INQUIRY); SendEventInquiryResponse(); - SendEventInquiryComplete(); + SendEventInquiryComplete(); } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryScanType(u8* _Input) @@ -1600,7 +1600,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandRemoteNameReq(u8* _Input) LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_REMOTE_NAME_REQ"); LOG(WII_IPC_WIIMOTE, "Input:"); - LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pRemoteNameReq->bdaddr.b[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq->bdaddr.b[2], pRemoteNameReq->bdaddr.b[3], pRemoteNameReq->bdaddr.b[4], pRemoteNameReq->bdaddr.b[5]); LOG(WII_IPC_WIIMOTE, " page_scan_rep_mode: %i", pRemoteNameReq->page_scan_rep_mode); @@ -1618,7 +1618,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandCreateCon(u8* _Input) LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_CREATE_CON"); LOG(WII_IPC_WIIMOTE, "Input:"); - LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pCreateCon->bdaddr.b[0], pCreateCon->bdaddr.b[1], pCreateCon->bdaddr.b[2], pCreateCon->bdaddr.b[3], pCreateCon->bdaddr.b[4], pCreateCon->bdaddr.b[5]); @@ -1639,7 +1639,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAcceptCon(u8* _Input) #ifdef LOGGING static char s_szRole[][128] = - { + { { "Master (0x00)"}, { "Slave (0x01)"}, }; @@ -1647,7 +1647,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAcceptCon(u8* _Input) LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_ACCEPT_CON"); LOG(WII_IPC_WIIMOTE, "Input:"); - LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pAcceptCon->bdaddr.b[0], pAcceptCon->bdaddr.b[1], pAcceptCon->bdaddr.b[2], pAcceptCon->bdaddr.b[3], pAcceptCon->bdaddr.b[4], pAcceptCon->bdaddr.b[5]); LOG(WII_IPC_WIIMOTE, " role: %s", s_szRole[pAcceptCon->role]); @@ -1659,7 +1659,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAcceptCon(u8* _Input) { SendEventRoleChange(pAcceptCon->bdaddr, true); } - + SendEventConnectionComplete(pAcceptCon->bdaddr); } @@ -1722,7 +1722,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkPolicy(u8* _Input) if (pWiimote) { pWiimote->EventCommandWriteLinkPolicy(); - } + } } void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAuthenticationRequested(u8* _Input) @@ -1810,7 +1810,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandLinkKeyNegRep(u8* _Input) LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_LINK_KEY_NEG_REP"); LOG(WII_IPC_WIIMOTE, "Input:"); - LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pKeyNeg->bdaddr.b[0], pKeyNeg->bdaddr.b[1], pKeyNeg->bdaddr.b[2], pKeyNeg->bdaddr.b[3], pKeyNeg->bdaddr.b[4], pKeyNeg->bdaddr.b[5]); @@ -1828,7 +1828,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandLinkKeyRep(u8* _Input) LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_LINK_KEY_REP"); LOG(WII_IPC_WIIMOTE, "Input:"); - LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", + LOG(WII_IPC_WIIMOTE, " bd: %02x:%02x:%02x:%02x:%02x:%02x", pKeyRep->bdaddr.b[0], pKeyRep->bdaddr.b[1], pKeyRep->bdaddr.b[2], pKeyRep->bdaddr.b[3], pKeyRep->bdaddr.b[4], pKeyRep->bdaddr.b[5]); LOG_LinkKey(pKeyRep->key); @@ -1919,8 +1919,8 @@ bool CWII_IPC_HLE_Device_usb_oh0::IOCtl(u32 _CommandAddress) // =================================================== /* IOCtlV */ // ---------------- -bool CWII_IPC_HLE_Device_usb_oh0::IOCtlV(u32 _CommandAddress) -{ +bool CWII_IPC_HLE_Device_usb_oh0::IOCtlV(u32 _CommandAddress) +{ // write return value Memory::Write_U32(0, _CommandAddress + 0x4); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp index 67c03f39d6..2d33e129ea 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp @@ -20,11 +20,11 @@ #include "WII_IPC_HLE_WiiMote.h" // Core #include "WII_IPC_HLE_Device_usb.h" -#include "../Plugins/Plugin_Wiimote.h" +#include "../PluginManager.h" #include "../Host.h" #include "../Core.h" -#include "l2cap.h" // Local +#include "l2cap.h" // Local #include "WiiMote_HID_Attr.h" #if defined(_MSC_VER) @@ -333,7 +333,7 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size) LOGV(WII_IPC_WIIMOTE, 2, "L2Cap-SendFrame: Channel 0x%04x, Len 0x%x, DataSize 0x%x", pHeader->CID, pHeader->Length, DataSize); - if(pHeader->Length != DataSize) + if(pHeader->Length != DataSize) { LOGV(WII_IPC_WIIMOTE, 2, "Faulty packet. It is dropped."); return; @@ -349,6 +349,7 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size) { _dbg_assert_msg_(WII_IPC_WIIMOTE, DoesChannelExist(pHeader->CID), "SendACLFrame to unknown channel %i", pHeader->CID); CChannelMap::iterator itr= m_Channel.find(pHeader->CID); + Common::PluginWiimote* mote = CPluginManager::GetInstance().GetWiimote(0); if (itr != m_Channel.end()) { SChannel& rChannel = itr->second; @@ -358,13 +359,13 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size) HandleSDP(pHeader->CID, pData, DataSize); break; - case HIDP_CONTROL_CHANNEL: - PluginWiimote::Wiimote_ControlChannel(rChannel.DCID, pData, DataSize); + case HIDP_CONTROL_CHANNEL: + mote->Wiimote_ControlChannel(rChannel.DCID, pData, DataSize); break; case HID_INTERRUPT_CHANNEL: ShowStatus(pData); - PluginWiimote::Wiimote_InterruptChannel(rChannel.DCID, pData, DataSize); + mote->Wiimote_InterruptChannel(rChannel.DCID, pData, DataSize); break; default: @@ -446,7 +447,7 @@ void CWII_IPC_HLE_WiiMote::UpdateStatus() void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size) { - while (_Size >= sizeof(SL2CAP_Command)) + while (_Size >= sizeof(SL2CAP_Command)) { SL2CAP_Command* pCommand = (SL2CAP_Command*)_pData; _pData += sizeof(SL2CAP_Command); @@ -632,7 +633,7 @@ void CWII_IPC_HLE_WiiMote::CommandConnectionResponse(u8 _Ident, u8* _pData, u32 m_HIDInterruptChannel_Connected = true; } -void CWII_IPC_HLE_WiiMote::CommandCofigurationResponse(u8 _Ident, u8* _pData, u32 _Size) +void CWII_IPC_HLE_WiiMote::CommandCofigurationResponse(u8 _Ident, u8* _pData, u32 _Size) { l2cap_conf_rsp* rsp = (l2cap_conf_rsp*)_pData; @@ -688,7 +689,7 @@ void CWII_IPC_HLE_WiiMote::CommandDisconnectionReq(u8 _Ident, u8* _pData, u32 _S ///////////////////////////////////////////////////////////////////////////////////////////////// -void CWII_IPC_HLE_WiiMote::SendConnectionRequest(u16 scid, u16 psm) +void CWII_IPC_HLE_WiiMote::SendConnectionRequest(u16 scid, u16 psm) { // create the channel SChannel& rChannel = m_Channel[scid]; @@ -706,7 +707,7 @@ void CWII_IPC_HLE_WiiMote::SendConnectionRequest(u16 scid, u16 psm) SendCommandToACL(L2CAP_CONN_REQ, L2CAP_CONN_REQ, sizeof(l2cap_conn_req), (u8*)&cr); } -void CWII_IPC_HLE_WiiMote::SendDisconnectRequest(u16 scid) +void CWII_IPC_HLE_WiiMote::SendDisconnectRequest(u16 scid) { // create the channel SChannel& rChannel = m_Channel[scid]; @@ -722,7 +723,7 @@ void CWII_IPC_HLE_WiiMote::SendDisconnectRequest(u16 scid) SendCommandToACL(L2CAP_DISCONN_REQ, L2CAP_DISCONN_REQ, sizeof(l2cap_disconn_req), (u8*)&cr); } -void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16* MTU, u16* FlushTimeOut) +void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16* MTU, u16* FlushTimeOut) { _dbg_assert_(WII_IPC_WIIMOTE, DoesChannelExist(scid)); SChannel& rChannel = m_Channel[scid]; @@ -810,7 +811,7 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceSearchResponse(u16 cid, u16 Transaction buffer.Write16(Offset, TransactionID); Offset += 2; // transaction ID buffer.Write16(Offset, 0x0009); Offset += 2; // param length buffer.Write16(Offset, 0x0001); Offset += 2; // TotalServiceRecordCount - buffer.Write16(Offset, 0x0001); Offset += 2; // CurrentServiceRecordCount + buffer.Write16(Offset, 0x0001); Offset += 2; // CurrentServiceRecordCount buffer.Write32(Offset, 0x10000); Offset += 4; // ServiceRecordHandleList[4] buffer.Write8(Offset, 0x00); Offset++; // no continuation state; @@ -823,7 +824,7 @@ u32 ParseCont(u8* pCont) { u32 attribOffset = 0; CBigEndianBuffer attribList(pCont); - u8 typeID = attribList.Read8(attribOffset); attribOffset++; + u8 typeID = attribList.Read8(attribOffset); attribOffset++; if (typeID == 0x02) { @@ -846,7 +847,7 @@ int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID) u8 sequence = attribList.Read8(attribOffset); attribOffset++; _dbg_assert_(WII_IPC_WIIMOTE, sequence == SDP_SEQ8); u8 seqSize = attribList.Read8(attribOffset); attribOffset++; - u8 typeID = attribList.Read8(attribOffset); attribOffset++; + u8 typeID = attribList.Read8(attribOffset); attribOffset++; if (typeID == SDP_UINT32) { @@ -864,8 +865,8 @@ int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID) } -void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 TransactionID, u32 ServiceHandle, - u16 startAttrID, u16 endAttrID, +void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 TransactionID, u32 ServiceHandle, + u16 startAttrID, u16 endAttrID, u16 MaximumAttributeByteCount, u8* pContinuationState) { if (ServiceHandle != 0x10000) @@ -948,7 +949,7 @@ void CWII_IPC_HLE_WiiMote::HandleSDP(u16 cid, u8* _pData, u32 _Size) PanicAlert("Unknown SDP command %x", _pData[0]); break; } -} +} ///////////////////////////////////////////////////////////////////////////////////////////////// // @@ -974,9 +975,9 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng pHeader->Length = sizeof(SL2CAP_Command) + _CommandLength; SL2CAP_Command* pCommand = (SL2CAP_Command*)&DataFrame[Offset]; Offset += sizeof(SL2CAP_Command); - pCommand->len = _CommandLength; + pCommand->len = _CommandLength; pCommand->ident = _Ident; - pCommand->code = _Code; + pCommand->code = _Code; memcpy(&DataFrame[Offset], _pCommandData, _CommandLength); @@ -1016,11 +1017,11 @@ void CWII_IPC_HLE_WiiMote::SendL2capData(u16 scid, const void* _pData, u32 _Size } -namespace Core +namespace Core { /* This is called continously from the Wiimote plugin as soon as it has received a reporting mode */ - void Callback_WiimoteInput(u16 _channelID, const void* _pData, u32 _Size) + void Callback_WiimoteInput(u16 _channelID, const void* _pData, u32 _Size) { LOGV(WII_IPC_WIIMOTE, 3, "========================================================="); const u8* pData = (const u8*)_pData; @@ -1038,4 +1039,4 @@ namespace Core s_Usb->m_WiiMotes[0].SendL2capData(_channelID, _pData, _Size); LOGV(WII_IPC_WIIMOTE, 3, "========================================================="); } -} \ No newline at end of file +} diff --git a/Source/Core/Core/Src/LogManager.cpp b/Source/Core/Core/Src/LogManager.cpp index bd672884c4..e297af9701 100644 --- a/Source/Core/Core/Src/LogManager.cpp +++ b/Source/Core/Core/Src/LogManager.cpp @@ -29,10 +29,6 @@ #include "PowerPC/PowerPC.h" // Core #include "PowerPC/SymbolDB.h" // for g_symbolDB #include "Debugger/Debugger_SymbolMap.h" - -#if defined(HAVE_WX) && HAVE_WX && defined(WX_CORE) // wxWidgets - #include // for the timestamps -#endif ///////////////////////// @@ -103,7 +99,7 @@ void CDebugger_Log::Init() #endif } -void CDebugger_Log::Shutdown() +void CDebugger_Log::Shutdown() { #ifdef LOGGING if (m_pFile != NULL) @@ -143,7 +139,7 @@ void LogManager::Init() m_Log[LogTypes::VIDEO + i*100] = new CDebugger_Log("Video", "Video Plugin", i); m_Log[LogTypes::AUDIO + i*100] = new CDebugger_Log("Audio", "Audio Plugin", i); m_Log[LogTypes::DYNA_REC + i*100] = new CDebugger_Log("DYNA", "Dynamic Recompiler", i); - m_Log[LogTypes::CONSOLE + i*100] = new CDebugger_Log("CONSOLE", "Dolphin Console", i); + m_Log[LogTypes::CONSOLE + i*100] = new CDebugger_Log("CONSOLE", "Dolphin Console", i); m_Log[LogTypes::OSREPORT + i*100] = new CDebugger_Log("OSREPORT", "OSReport", i); m_Log[LogTypes::WII_IOB + i*100] = new CDebugger_Log("WII_IOB", "WII IO Bridge", i); m_Log[LogTypes::WII_IPC + i*100] = new CDebugger_Log("WII_IPC", "WII IPC", i); @@ -166,7 +162,7 @@ void LogManager::Init() { m_Log[j*100 + i]->Init(); } - } + } m_bInitialized = true; } @@ -230,7 +226,7 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...) // security checks if (m_Log[_type] == NULL || !m_Log[_type]->m_bEnable || _type > (LogTypes::NUMBER_OF_LOGS + LogManager::VERBOSITY_LEVELS * 100) - || _type < 0) + || _type < 0) return; // prepare message @@ -243,9 +239,6 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...) static u32 count = 0; char* Msg2 = (char*)alloca(strlen(_fmt)+512); - #if defined(HAVE_WX) && HAVE_WX && defined(WX_CORE) - wxDateTime datetime = wxDateTime::UNow(); // get timestamp - #endif // Here's the old symbol request //Debugger::FindSymbol(PC); @@ -257,7 +250,7 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...) // added a simple caching function so that we don't search again if we get the same // question again. std::string symbol; - + if ((v == 0 || v == 1) && lastPC != PC && LogManager::m_LogSettings->bResolve) { symbol = g_symbolDB.GetDescription(PC); @@ -276,21 +269,13 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...) int Index = 1; const char *eol = "\n"; if (Index > 0) - { - #if defined(HAVE_WX) && HAVE_WX && defined(WX_CORE) - sprintf(Msg2, "%i %02i:%02i:%03i: %x %s (%s, %08x) : %s%s", - #else - sprintf(Msg2, "%i %llu: %x %s (%s, %08x) : %s%s", - #endif + { + sprintf(Msg2, "%i %s: %x %s (%s, %08x) : %s%s", ++count, - #if defined(HAVE_WX) && HAVE_WX && defined(WX_CORE) - datetime.GetMinute(), datetime.GetSecond(), datetime.GetMillisecond(), - #else - Common::Timer::GetTimeSinceJan1970(), - #endif - PowerPC::ppcState.DebugCount, - m_Log[_type]->m_szShortName_, // (CONSOLE etc) - symbol.c_str(), PC, // current PC location (name, address) + Common::Timer::GetTimeFormatted().c_str(), + PowerPC::ppcState.DebugCount, + m_Log[_type]->m_szShortName_, // (CONSOLE etc) + symbol.c_str(), PC, // current PC location (name, address) Msg, eol); } diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp index b07fd2c279..9f0fbbffc2 100644 --- a/Source/Core/Core/Src/PluginManager.cpp +++ b/Source/Core/Core/Src/PluginManager.cpp @@ -24,38 +24,85 @@ #include "PluginManager.h" #include "StringUtil.h" -/* Why does it crash if we try to open the debugger in the same instance like this? */ -namespace PluginVideo -{ - extern DynamicLibrary plugin; - extern bool IsLoaded(); - extern bool LoadPlugin(const char *_Filename); - extern void Debug(HWND _hwnd, bool Show); -} - - -namespace PluginDSP -{ - extern DynamicLibrary plugin; - extern bool IsLoaded(); - extern bool LoadPlugin(const char *_Filename); - extern void Debug(HWND _hwnd, bool Show); -} - - -//void(__cdecl * m_DllDebugger) (HWND _hParent) = 0; - CPluginManager CPluginManager::m_Instance; CPluginManager::CPluginManager() -{} +{ + m_PluginGlobals = new PLUGIN_GLOBALS; + m_PluginGlobals->eventHandler = EventHandler::GetInstance(); + m_PluginGlobals->config = NULL; + m_PluginGlobals->messageLogger = NULL; +} CPluginManager::~CPluginManager() -{} +{ + if (m_PluginGlobals) + delete m_PluginGlobals; + if (m_dsp) + delete m_dsp; + + if (m_video) + delete m_video; + + for (int i=0;i<1;i++) { + if (m_pad[i]) + delete m_pad[i]; + + if (m_wiimote[i]) + delete m_wiimote[i]; +} +} + +bool CPluginManager::InitPlugins(SCoreStartupParameter scsp) { + + // TODO error checking + m_dsp = (Common::PluginDSP*)LoadPlugin(scsp.m_strDSPPlugin.c_str()); + if (!m_dsp) { + return false; + } + + m_video = (Common::PluginVideo*)LoadPlugin(scsp.m_strVideoPlugin.c_str()); + if (!m_video) + return false; + + for (int i=0;i<1;i++) { + m_pad[i] = (Common::PluginPAD*)LoadPlugin(scsp.m_strPadPlugin.c_str()); + if (m_pad[i] == NULL) + return false; + + if (scsp.bWii) { + m_wiimote[i] = (Common::PluginWiimote*)LoadPlugin + (scsp.m_strWiimotePlugin.c_str()); + if (m_wiimote[i] == NULL) + return false; + } + } + + return true; +} + +void CPluginManager::ShutdownPlugins() { + for (int i=0;i<1;i++) { + if (m_pad[i]) + m_pad[i]->Shutdown(); + if (m_wiimote[i]) + m_wiimote[i]->Shutdown(); + } + + if (m_video) + m_video->Shutdown(); + + if (m_dsp) + m_dsp->Shutdown(); +} + +PLUGIN_GLOBALS* CPluginManager::GetGlobals() { + return m_PluginGlobals; +} // ---------------------------------------- // Create list of available plugins @@ -95,40 +142,119 @@ void CPluginManager::ScanForPlugins() } } +Common::PluginPAD *CPluginManager::GetPAD(int controller) { + // if (m_pad[controller] == NULL) + // InitPlugins(); + + return m_pad[controller]; +} + +Common::PluginWiimote *CPluginManager::GetWiimote(int controller) { + // if (m_wiimote[controller] == NULL) + // InitPlugins(); + + return m_wiimote[controller]; +} + +Common::PluginDSP *CPluginManager::GetDSP() { + // if (m_dsp == NULL) + // InitPlugins(); + + return m_dsp; +} + +Common::PluginVideo *CPluginManager::GetVideo() { + // if (m_video == NULL) + // InitPlugins(); + + return m_video; +} + +void *CPluginManager::LoadPlugin(const char *_rFilename)//, PLUGIN_TYPE type) +{ + CPluginInfo info(_rFilename); + PLUGIN_TYPE type = info.GetPluginInfo().Type; + Common::CPlugin *plugin = NULL; + switch (type) { + case PLUGIN_TYPE_VIDEO: + plugin = new Common::PluginVideo(_rFilename); + break; + + case PLUGIN_TYPE_PAD: + plugin = new Common::PluginPAD(_rFilename); + break; + + case PLUGIN_TYPE_DSP: + plugin = new Common::PluginDSP(_rFilename); + break; + + case PLUGIN_TYPE_WIIMOTE: + plugin = new Common::PluginWiimote(_rFilename); + break; + default: + PanicAlert("Trying to load unsupported type %d", type); + } + + if (!plugin->IsValid()) { + PanicAlert("Can't open %s", _rFilename); + return NULL; + } + + plugin->SetGlobals(m_PluginGlobals); + + + return plugin; +} // ---------------------------------------- // Open config window. _rFilename = plugin filename ,ret = the dll slot number // ------------- void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename) { - Common::CPlugin::Load(_rFilename); - Common::CPlugin::Config((HWND)_Parent); - Common::CPlugin::Release(); + Common::CPlugin *plugin = new Common::CPlugin(_rFilename); + plugin->SetGlobals(m_PluginGlobals); + plugin->Config((HWND)_Parent); + delete plugin; } // ---------------------------------------- // Open debugging window. Type = Video or DSP. Show = Show or hide window. // ------------- -void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, bool Type, bool Show) +void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show) { //int ret = 1; //int ret = Common::CPlugin::Load(_rFilename, true); //int ret = PluginVideo::LoadPlugin(_rFilename); //int ret = PluginDSP::LoadPlugin(_rFilename); - if (Type) + + if (Type == PLUGIN_TYPE_VIDEO) { + if(!m_video) + m_video = (Common::PluginVideo*)LoadPlugin(_rFilename); + m_video->Debug((HWND)_Parent, Show); + } else if (Type == PLUGIN_TYPE_DSP) { + if (!m_dsp) + m_dsp = (Common::PluginDSP*)LoadPlugin(_rFilename); + m_dsp->Debug((HWND)_Parent, Show); + } + /* if (Type) { //Common::CPlugin::Debug((HWND)_Parent); if (!PluginVideo::IsLoaded()) PluginVideo::LoadPlugin(_rFilename); + + //PluginVideo::SetDllGlobals(m_PluginGlobals); PluginVideo::Debug((HWND)_Parent, Show); } else { - if(!PluginDSP::IsLoaded()) PluginDSP::LoadPlugin(_rFilename); + if(!PluginDSP::IsLoaded()) + PluginDSP::LoadPlugin(_rFilename); + + //PluginDSP::SetDllGlobals(m_PluginGlobals); PluginDSP::Debug((HWND)_Parent, Show); - } + }*/ //Common::CPlugin::Release(); // this is only if the wx dialog is called with ShowModal() //m_DllDebugger = (void (__cdecl*)(HWND))PluginVideo::plugin.Get("DllDebugger"); @@ -142,14 +268,15 @@ CPluginInfo::CPluginInfo(const char *_rFileName) : m_FileName(_rFileName) , m_Valid(false) { - if (Common::CPlugin::Load(_rFileName)) + Common::CPlugin *plugin = new Common::CPlugin(_rFileName); + if (plugin->IsValid()) { - if (Common::CPlugin::GetInfo(m_PluginInfo)) + if (plugin->GetInfo(m_PluginInfo)) m_Valid = true; else PanicAlert("Could not get info about plugin %s", _rFileName); - Common::CPlugin::Release(); + delete plugin; } /* The DLL loading code provides enough error messages already. Possibly make some return codes diff --git a/Source/Core/Core/Src/PluginManager.h b/Source/Core/Core/Src/PluginManager.h index f523e9b1c3..85123b880d 100644 --- a/Source/Core/Core/Src/PluginManager.h +++ b/Source/Core/Core/Src/PluginManager.h @@ -19,6 +19,12 @@ #define __PLUGIN_MANAGER_H_ #include "Plugin.h" +#include "PluginDSP.h" +#include "PluginPAD.h" +#include "PluginVideo.h" +#include "PluginWiimote.h" +#include "EventHandler.h" +#include "CoreParameter.h" class CPluginInfo { @@ -40,19 +46,33 @@ class CPluginManager { public: static CPluginManager& GetInstance() {return(m_Instance);} + Common::PluginPAD *GetPAD(int controller); + Common::PluginWiimote *GetWiimote(int controller); + Common::PluginDSP *GetDSP(); + Common::PluginVideo *GetVideo(); + + bool InitPlugins(SCoreStartupParameter scsp); + void ShutdownPlugins(); void ScanForPlugins(); void OpenConfig(void* _Parent, const char *_rFilename); - void OpenDebug(void* _Parent, const char *_rFilename, bool Type, bool Show); + void OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show); const CPluginInfos& GetPluginInfos() {return(m_PluginInfos);} - + PLUGIN_GLOBALS* GetGlobals(); private: static CPluginManager m_Instance; bool m_Initialized; CPluginInfos m_PluginInfos; + PLUGIN_GLOBALS* m_PluginGlobals; + Common::PluginPAD *m_pad[4]; + Common::PluginVideo *m_video; + Common::PluginWiimote *m_wiimote[4]; + Common::PluginDSP *m_dsp; CPluginManager(); ~CPluginManager(); + void *LoadPlugin(const char *_rFilename); + }; diff --git a/Source/Core/Core/Src/Plugins/Plugin_DSP.cpp b/Source/Core/Core/Src/Plugins/Plugin_DSP.cpp deleted file mode 100644 index c76dac7d84..0000000000 --- a/Source/Core/Core/Src/Plugins/Plugin_DSP.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// 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/ - -#include "Common.h" -#include "DynamicLibrary.h" -#include "Plugin_DSP.h" - -namespace PluginDSP -{ - -// Function Pointer -TGetDllInfo GetDllInfo = 0; -TSetDllGlobals SetDllGlobals = 0; -TDllConfig DllConfig = 0; -TDllDebugger DllDebugger = 0; -TDSP_Initialize DSP_Initialize = 0; -TDSP_Shutdown DSP_Shutdown = 0; -TDSP_ReadMailBox DSP_ReadMailboxHigh = 0; -TDSP_ReadMailBox DSP_ReadMailboxLow = 0; -TDSP_WriteMailBox DSP_WriteMailboxHigh = 0; -TDSP_WriteMailBox DSP_WriteMailboxLow = 0; -TDSP_ReadControlRegister DSP_ReadControlRegister = 0; -TDSP_WriteControlRegister DSP_WriteControlRegister = 0; -TDSP_Update DSP_Update = 0; -TDSP_SendAIBuffer DSP_SendAIBuffer = 0; -TDSP_DoState DSP_DoState = 0; - -//! Library Instance -DynamicLibrary plugin; - -bool IsLoaded() -{ - return plugin.IsLoaded(); -} - -void Debug(HWND _hwnd, bool Show) -{ - DllDebugger(_hwnd, Show); -} - -void UnloadPlugin() -{ - plugin.Unload(); - - // Set Functions to NULL - GetDllInfo = 0; - SetDllGlobals = 0; - DllConfig = 0; - DllDebugger = 0; - DSP_Initialize = 0; - DSP_Shutdown = 0; - DSP_ReadMailboxHigh = 0; - DSP_ReadMailboxLow = 0; - DSP_WriteMailboxHigh = 0; - DSP_WriteMailboxLow = 0; - DSP_ReadControlRegister = 0; - DSP_WriteControlRegister = 0; - DSP_Update = 0; - DSP_SendAIBuffer = 0; - DSP_DoState = 0; -} - -bool LoadPlugin(const char *_Filename) -{ - int ret = plugin.Load(_Filename); // we may have alredy loaded this to open the debugger - - if (ret == 1) - { - GetDllInfo = reinterpret_cast (plugin.Get("GetDllInfo")); - SetDllGlobals = reinterpret_cast (plugin.Get("SetDllGlobals")); - DllConfig = reinterpret_cast (plugin.Get("DllConfig")); - DllDebugger = reinterpret_cast (plugin.Get("DllDebugger")); - DSP_Initialize = reinterpret_cast (plugin.Get("DSP_Initialize")); - DSP_Shutdown = reinterpret_cast (plugin.Get("DSP_Shutdown")); - DSP_ReadMailboxHigh = reinterpret_cast (plugin.Get("DSP_ReadMailboxHigh")); - DSP_ReadMailboxLow = reinterpret_cast (plugin.Get("DSP_ReadMailboxLow")); - DSP_WriteMailboxHigh = reinterpret_cast (plugin.Get("DSP_WriteMailboxHigh")); - DSP_WriteMailboxLow = reinterpret_cast (plugin.Get("DSP_WriteMailboxLow")); - DSP_ReadControlRegister = reinterpret_cast (plugin.Get("DSP_ReadControlRegister")); - DSP_WriteControlRegister = reinterpret_cast (plugin.Get("DSP_WriteControlRegister")); - DSP_Update = reinterpret_cast (plugin.Get("DSP_Update")); - DSP_SendAIBuffer = reinterpret_cast (plugin.Get("DSP_SendAIBuffer")); - DSP_DoState = reinterpret_cast (plugin.Get("DSP_DoState")); - - if ((GetDllInfo != 0) && - (DSP_Initialize != 0) && - (DSP_Shutdown != 0) && - (DSP_ReadMailboxHigh != 0) && - (DSP_ReadMailboxLow != 0) && - (DSP_WriteMailboxHigh != 0) && - (DSP_WriteMailboxLow != 0) && - (DSP_ReadControlRegister != 0) && - (DSP_WriteControlRegister != 0) && - (DSP_Update != 0) && - (DSP_SendAIBuffer != 0) && - (DSP_DoState != 0)) - { - //PanicAlert("return true: %i", ret); - return true; - } - else - { - UnloadPlugin(); - return false; - } - } - else if (ret == 2) - { - //PanicAlert("return true: %i", ret); - return true; - } - else if (ret == 0) - return false; - - return false; -} - -} // namespace diff --git a/Source/Core/Core/Src/Plugins/Plugin_DSP.h b/Source/Core/Core/Src/Plugins/Plugin_DSP.h deleted file mode 100644 index 6d9f40ca97..0000000000 --- a/Source/Core/Core/Src/Plugins/Plugin_DSP.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// 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/ - -#ifndef _PLUGIN_DSP_H -#define _PLUGIN_DSP_H - -#include "pluginspecs_dsp.h" - -namespace PluginDSP -{ -bool IsLoaded(); -bool LoadPlugin(const char *_Filename); -void UnloadPlugin(); - -// Function Types -typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); -typedef void (__cdecl* TSetDllGlobals)(PLUGIN_GLOBALS*); -typedef void (__cdecl* TDllConfig)(HWND); -typedef void (__cdecl* TDllDebugger)(HWND, bool); -typedef void (__cdecl* TDSP_Initialize)(DSPInitialize); -typedef void (__cdecl* TDSP_Shutdown)(); -typedef void (__cdecl* TDSP_WriteMailBox)(bool _CPUMailbox, unsigned short); -typedef unsigned short (__cdecl* TDSP_ReadMailBox)(bool _CPUMailbox); -typedef unsigned short (__cdecl* TDSP_ReadControlRegister)(); -typedef unsigned short (__cdecl* TDSP_WriteControlRegister)(unsigned short); -typedef void (__cdecl* TDSP_Update)(int cycles); -typedef void (__cdecl* TDSP_SendAIBuffer)(unsigned int address, int sample_rate); -typedef void (__cdecl* TDSP_DoState)(unsigned char **ptr, int mode); - -// Function Pointers -extern TGetDllInfo GetDllInfo; -extern TSetDllGlobals SetDllGlobals; -extern TDllConfig DllConfig; -extern TDllDebugger DllDebugger; -extern TDSP_Initialize DSP_Initialize; -extern TDSP_Shutdown DSP_Shutdown; -extern TDSP_ReadMailBox DSP_ReadMailboxHigh; -extern TDSP_ReadMailBox DSP_ReadMailboxLow; -extern TDSP_WriteMailBox DSP_WriteMailboxHigh; -extern TDSP_WriteMailBox DSP_WriteMailboxLow; -extern TDSP_ReadControlRegister DSP_ReadControlRegister; -extern TDSP_WriteControlRegister DSP_WriteControlRegister; -extern TDSP_Update DSP_Update; -extern TDSP_SendAIBuffer DSP_SendAIBuffer; -extern TDSP_DoState DSP_DoState; - -} // end of namespace PluginDSP - -#endif diff --git a/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp b/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp deleted file mode 100644 index add7163cb6..0000000000 --- a/Source/Core/Core/Src/Plugins/Plugin_PAD.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// 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/ - -#include "DynamicLibrary.h" -#include "Plugin_PAD.h" - -namespace PluginPAD -{ - -// Function Pointers -TGetDllInfo GetDllInfo = 0; -TSetDllGlobals SetDllGlobals = 0; -TPAD_Shutdown PAD_Shutdown = 0; -TDllConfig DllConfig = 0; -TPAD_Initialize PAD_Initialize = 0; -TPAD_GetStatus PAD_GetStatus = 0; -TPAD_Input PAD_Input = 0; -TPAD_Rumble PAD_Rumble = 0; -TPAD_GetAttachedPads PAD_GetAttachedPads = 0; - -// Library Instance -DynamicLibrary plugin; - -bool IsLoaded() -{ - return plugin.IsLoaded(); -} - -void UnloadPlugin() -{ - plugin.Unload(); - // Set Functions to 0 - GetDllInfo = 0; - SetDllGlobals = 0; - PAD_Shutdown = 0; - DllConfig = 0; - PAD_Initialize = 0; - PAD_GetStatus = 0; - PAD_Input = 0; - PAD_Rumble = 0; -} - -bool LoadPlugin(const char *_Filename) -{ - if (plugin.Load(_Filename)) - { - GetDllInfo = reinterpret_cast (plugin.Get("GetDllInfo")); - SetDllGlobals = reinterpret_cast (plugin.Get("SetDllGlobals")); - DllConfig = reinterpret_cast (plugin.Get("DllConfig")); - PAD_Initialize = reinterpret_cast (plugin.Get("PAD_Initialize")); - PAD_Shutdown = reinterpret_cast (plugin.Get("PAD_Shutdown")); - PAD_GetStatus = reinterpret_cast (plugin.Get("PAD_GetStatus")); - PAD_Input = reinterpret_cast (plugin.Get("PAD_Input")); - PAD_Rumble = reinterpret_cast (plugin.Get("PAD_Rumble")); - PAD_GetAttachedPads = reinterpret_cast(plugin.Get("PAD_GetAttachedPads")); - - if ((GetDllInfo != 0) && - (DllConfig != 0) && - (PAD_Initialize != 0) && - (PAD_Shutdown != 0) && - (PAD_GetStatus != 0) && - (PAD_Input != 0)) - { - return true; - } - else - { - UnloadPlugin(); - return false; - } - } - - return false; -} - -} // end of namespace PluginPAD diff --git a/Source/Core/Core/Src/Plugins/Plugin_PAD.h b/Source/Core/Core/Src/Plugins/Plugin_PAD.h deleted file mode 100644 index 7f0303d9cb..0000000000 --- a/Source/Core/Core/Src/Plugins/Plugin_PAD.h +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// 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/ -#ifndef _PLUGIN_DVD -#define _PLUGIN_DVD - -#include - -#include "pluginspecs_pad.h" - -namespace PluginPAD -{ -bool IsLoaded(); -bool LoadPlugin(const char * _Filename); -void UnloadPlugin(); - -// Function Types -typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); -typedef void (__cdecl* TSetDllGlobals)(PLUGIN_GLOBALS*); -typedef void (__cdecl* TDllConfig)(HWND); -typedef void (__cdecl* TPAD_Initialize)(SPADInitialize); -typedef void (__cdecl* TPAD_Shutdown)(); -typedef void (__cdecl* TPAD_GetStatus)(u8, SPADStatus*); -typedef void (__cdecl* TPAD_Input)(u8, u8); -typedef void (__cdecl* TPAD_Rumble)(u8, unsigned int, unsigned int); -typedef unsigned int (__cdecl* TPAD_GetAttachedPads)(); - -// Function Pointers -extern TGetDllInfo GetDllInfo; -extern TSetDllGlobals SetDllGlobals; -extern TPAD_Shutdown PAD_Shutdown; -extern TDllConfig DllConfig; -extern TPAD_Initialize PAD_Initialize; -extern TPAD_GetStatus PAD_GetStatus; -extern TPAD_Input PAD_Input; -extern TPAD_Rumble PAD_Rumble; -extern TPAD_GetAttachedPads PAD_GetAttachedPads; - -} // end of namespace PluginPAD - -#endif diff --git a/Source/Core/Core/Src/Plugins/Plugin_Video.cpp b/Source/Core/Core/Src/Plugins/Plugin_Video.cpp deleted file mode 100644 index 86fd9b8e68..0000000000 --- a/Source/Core/Core/Src/Plugins/Plugin_Video.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// 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/ - -#include "Common.h" -#include "DynamicLibrary.h" -#include "Plugin_Video.h" -#include "Plugin.h" - -extern DynamicLibrary Common::CPlugin; - -namespace PluginVideo -{ - -// Function Pointer -TGetDllInfo GetDllInfo = 0; -TSetDllGlobals SetDllGlobals = 0; -TDllConfig DllConfig = 0; -TDllDebugger DllDebugger = 0; -TVideo_Initialize Video_Initialize = 0; -TVideo_Prepare Video_Prepare = 0; -TVideo_Shutdown Video_Shutdown = 0; -TVideo_SendFifoData Video_SendFifoData = 0; -TVideo_UpdateXFB Video_UpdateXFB = 0; -TVideo_Screenshot Video_Screenshot = 0; -TVideo_EnterLoop Video_EnterLoop = 0; -TVideo_AddMessage Video_AddMessage = 0; -TVideo_DoState Video_DoState = 0; -TVideo_Stop Video_Stop = 0; - -// Library Instance -DynamicLibrary plugin; - -void Debug(HWND _hwnd, bool Show) -{ - DllDebugger(_hwnd, Show); -} - -bool IsLoaded() -{ - return plugin.IsLoaded(); -} - -void UnloadPlugin() -{ - //PanicAlert("Video UnloadPlugin"); - - // set Functions to 0 - GetDllInfo = 0; - SetDllGlobals = 0; - DllConfig = 0; - DllDebugger = 0; - Video_Initialize = 0; - Video_Prepare = 0; - Video_Shutdown = 0; - Video_SendFifoData = 0; - Video_UpdateXFB = 0; - Video_AddMessage = 0; - Video_DoState = 0; - Video_Stop = 0; - - plugin.Unload(); -} - -// ============================================== -/* Load the plugin, but first check if we have already loaded the plugin for - the sake of showing the debugger. - - ret values: - 0 = failed - 1 = loaded successfully - 2 = already loaded from PluginManager.cpp, use it as it is */ -// ------------ -bool LoadPlugin(const char *_Filename) -{ - int ret = plugin.Load(_Filename); - - if (ret == 1) - { - GetDllInfo = reinterpret_cast (plugin.Get("GetDllInfo")); - SetDllGlobals = reinterpret_cast (plugin.Get("SetDllGlobals")); - DllConfig = reinterpret_cast (plugin.Get("DllConfig")); - DllDebugger = reinterpret_cast (plugin.Get("DllDebugger")); - Video_Initialize = reinterpret_cast (plugin.Get("Video_Initialize")); - Video_Prepare = reinterpret_cast (plugin.Get("Video_Prepare")); - Video_Shutdown = reinterpret_cast (plugin.Get("Video_Shutdown")); - Video_SendFifoData = reinterpret_cast (plugin.Get("Video_SendFifoData")); - Video_UpdateXFB = reinterpret_cast (plugin.Get("Video_UpdateXFB")); - Video_Screenshot = reinterpret_cast (plugin.Get("Video_Screenshot")); - Video_EnterLoop = reinterpret_cast (plugin.Get("Video_EnterLoop")); - Video_AddMessage = reinterpret_cast (plugin.Get("Video_AddMessage")); - Video_DoState = reinterpret_cast (plugin.Get("Video_DoState")); - Video_Stop = reinterpret_cast (plugin.Get("Video_Stop")); - if ((GetDllInfo != 0) && - (DllConfig != 0) && - (DllDebugger != 0) && - (Video_Initialize != 0) && - (Video_Prepare != 0) && - (Video_Shutdown != 0) && - (Video_SendFifoData != 0) && - (Video_UpdateXFB != 0) && - (Video_EnterLoop != 0) && - (Video_Screenshot != 0) && - (Video_AddMessage != 0) && - (Video_DoState != 0) && - (Video_Stop != 0)) - { - //PanicAlert("return true: %i", ret); - return true; - } - else - { - UnloadPlugin(); - return false; - } - } - else if(ret == 2) - { - //PanicAlert("return true: %i", ret); - return true; - } - else if(ret == 0) - { - //PanicAlert("return false: %i", ret); - return false; - } - - return false; -} -// ============ - - -} // namespace diff --git a/Source/Core/Core/Src/Plugins/Plugin_Video.h b/Source/Core/Core/Src/Plugins/Plugin_Video.h deleted file mode 100644 index 7605be4629..0000000000 --- a/Source/Core/Core/Src/Plugins/Plugin_Video.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// 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/ - -#ifndef _PLUGIN_VIDEO_H -#define _PLUGIN_VIDEO_H - -#include "Common.h" - -#include "pluginspecs_video.h" - -#include "ChunkFile.h" - -namespace PluginVideo -{ -bool IsLoaded(); -bool LoadPlugin(const char *_Filename); -void UnloadPlugin(); - -// Function Types -typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); -typedef void (__cdecl* TSetDllGlobals)(PLUGIN_GLOBALS*); -typedef void (__cdecl* TDllConfig)(HWND); -typedef void (__cdecl* TDllDebugger)(HWND, bool); -typedef void (__cdecl* TVideo_Initialize)(SVideoInitialize*); -typedef void (__cdecl* TVideo_Prepare)(); -typedef void (__cdecl* TVideo_Shutdown)(); -typedef void (__cdecl* TVideo_SendFifoData)(u8*,u32); -typedef void (__cdecl* TVideo_UpdateXFB)(u8*, u32, u32, s32); -typedef bool (__cdecl* TVideo_Screenshot)(const char* filename); -typedef void (__cdecl* TVideo_EnterLoop)(); -typedef void (__cdecl* TVideo_AddMessage)(const char* pstr, unsigned int milliseconds); -typedef void (__cdecl* TVideo_DoState)(unsigned char **ptr, int mode); -typedef void (__cdecl* TVideo_Stop)(); - -// Function Pointers -extern TGetDllInfo GetDllInfo; -extern TSetDllGlobals SetDllGlobals; -extern TDllConfig DllConfig; -extern TDllDebugger DllDebugger; -extern TVideo_Initialize Video_Initialize; -extern TVideo_Prepare Video_Prepare; -extern TVideo_Shutdown Video_Shutdown; -extern TVideo_SendFifoData Video_SendFifoData; -extern TVideo_UpdateXFB Video_UpdateXFB; -extern TVideo_Screenshot Video_Screenshot; -extern TVideo_EnterLoop Video_EnterLoop; -extern TVideo_AddMessage Video_AddMessage; -extern TVideo_DoState Video_DoState; -extern TVideo_Stop Video_Stop; - -} // end of namespace PluginVideo - -#endif diff --git a/Source/Core/Core/Src/Plugins/Plugin_Wiimote.cpp b/Source/Core/Core/Src/Plugins/Plugin_Wiimote.cpp deleted file mode 100644 index be5f9c938a..0000000000 --- a/Source/Core/Core/Src/Plugins/Plugin_Wiimote.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// 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/ - -#include "Common.h" -#include "DynamicLibrary.h" -#include "Plugin_Wiimote.h" - -namespace PluginWiimote -{ - - // Function Pointer - TGetDllInfo GetDllInfo = 0; - TSetDllGlobals SetDllGlobals = 0; - TDllConfig DllConfig = 0; - TWiimote_Initialize Wiimote_Initialize = 0; - TWiimote_Shutdown Wiimote_Shutdown = 0; - TWiimote_Output Wiimote_ControlChannel = 0; - TWiimote_Input Wiimote_InterruptChannel = 0; - TWiimote_Update Wiimote_Update = 0; - TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers = 0; - TWiimote_DoState Wiimote_DoState = 0; - - //! Library Instance - DynamicLibrary plugin; - - bool IsLoaded() - { - return plugin.IsLoaded(); - } - - void UnloadPlugin() - { - plugin.Unload(); - - // Set Functions to NULL - GetDllInfo = 0; - SetDllGlobals = 0; - DllConfig = 0; - Wiimote_Initialize = 0; - Wiimote_Shutdown = 0; - Wiimote_ControlChannel = 0; - Wiimote_InterruptChannel = 0; - Wiimote_Update = 0; - Wiimote_GetAttachedControllers = 0; - Wiimote_DoState = 0; - } - - bool LoadPlugin(const char *_Filename) - { - if (plugin.Load(_Filename)) - { - GetDllInfo = reinterpret_cast (plugin.Get("GetDllInfo")); - SetDllGlobals = reinterpret_cast (plugin.Get("SetDllGlobals")); - DllConfig = reinterpret_cast (plugin.Get("DllConfig")); - Wiimote_Initialize = reinterpret_cast (plugin.Get("Wiimote_Initialize")); - Wiimote_Shutdown = reinterpret_cast (plugin.Get("Wiimote_Shutdown")); - Wiimote_ControlChannel = reinterpret_cast (plugin.Get("Wiimote_ControlChannel")); - Wiimote_InterruptChannel = reinterpret_cast (plugin.Get("Wiimote_InterruptChannel")); - Wiimote_Update = reinterpret_cast (plugin.Get("Wiimote_Update")); - Wiimote_GetAttachedControllers = reinterpret_cast (plugin.Get("Wiimote_GetAttachedControllers")); - Wiimote_DoState = reinterpret_cast (plugin.Get("Wiimote_DoState")); - - - if ((GetDllInfo != 0) && - (Wiimote_Initialize != 0) && - (Wiimote_Shutdown != 0) && - (Wiimote_ControlChannel != 0) && - (Wiimote_InterruptChannel != 0) && - (Wiimote_Update != 0) && - (Wiimote_GetAttachedControllers != 0) && - (Wiimote_DoState != 0)) - { - return true; - } - else - { - UnloadPlugin(); - return false; - } - } - - return false; - } - -} // namespace diff --git a/Source/Core/Core/Src/Plugins/Plugin_Wiimote.h b/Source/Core/Core/Src/Plugins/Plugin_Wiimote.h deleted file mode 100644 index e5ccea2e2b..0000000000 --- a/Source/Core/Core/Src/Plugins/Plugin_Wiimote.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// 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/ - -#ifndef _PLUGIN_WIIMOTE_H -#define _PLUGIN_WIIMOTE_H - -#include "pluginspecs_wiimote.h" - -namespace PluginWiimote -{ -bool IsLoaded(); -bool LoadPlugin(const char *_Filename); -void UnloadPlugin(); - -// Function Types -typedef void (__cdecl* TGetDllInfo)(PLUGIN_INFO*); -typedef void (__cdecl* TSetDllGlobals)(PLUGIN_GLOBALS*); -typedef void (__cdecl* TDllConfig)(HWND); -typedef bool (__cdecl* TWiimote_Initialize)(SWiimoteInitialize); -typedef void (__cdecl* TWiimote_Shutdown)(); -typedef void (__cdecl* TWiimote_Update)(); -typedef void (__cdecl* TWiimote_Output)(u16 _channelID, const void* _pData, u32 _Size); -typedef void (__cdecl* TWiimote_Input)(u16 _channelID, const void* _pData, u32 _Size); -typedef unsigned int (__cdecl* TWiimote_GetAttachedControllers)(); -typedef void (__cdecl* TWiimote_DoState)(void *ptr, int mode); - -// Function Pointers -extern TGetDllInfo GetDllInfo; -extern TSetDllGlobals SetDllGlobals; -extern TDllConfig DllConfig; -extern TWiimote_Initialize Wiimote_Initialize; -extern TWiimote_Shutdown Wiimote_Shutdown; -extern TWiimote_Output Wiimote_ControlChannel; -extern TWiimote_Input Wiimote_InterruptChannel; -extern TWiimote_Update Wiimote_Update; -extern TWiimote_GetAttachedControllers Wiimote_GetAttachedControllers; -extern TWiimote_DoState Wiimote_DoState; - -} // end of namespace PluginWiimote - -#endif //_PLUGIN_WIIMOTE_H diff --git a/Source/Core/Core/Src/SConscript b/Source/Core/Core/Src/SConscript index fdad0da377..a1d2ad94da 100644 --- a/Source/Core/Core/Src/SConscript +++ b/Source/Core/Core/Src/SConscript @@ -1,11 +1,11 @@ -# -*- python -*- +# -*- python -*- Import('env') files = ["Console.cpp", "Core.cpp", - "CoreTiming.cpp", - "CoreParameter.cpp", + "CoreTiming.cpp", + "CoreParameter.cpp", "Host.cpp", "LogManager.cpp", "MemTools.cpp", @@ -64,10 +64,10 @@ files = ["Console.cpp", "IPC_HLE/WII_IPC_HLE_WiiMote.cpp", "IPC_HLE/WII_IPC_HLE_Device_usb.cpp", "IPC_HLE/WiiMote_HID_Attr.cpp", - "Plugins/Plugin_DSP.cpp", - "Plugins/Plugin_PAD.cpp", - "Plugins/Plugin_Video.cpp", - "Plugins/Plugin_Wiimote.cpp", +# "Plugins/Plugin_DSP.cpp", +# "Plugins/Plugin_PAD.cpp", +# "Plugins/Plugin_Video.cpp", +# "Plugins/Plugin_Wiimote.cpp", "PowerPC/PowerPC.cpp", "PowerPC/PPCAnalyst.cpp", "PowerPC/PPCTables.cpp", diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index d6dc4ceea6..ffeabd1fa2 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -25,8 +25,7 @@ #include "PowerPC/PowerPC.h" #include "PowerPC/Jit64/Jit.h" -#include "Plugins/Plugin_Video.h" -#include "Plugins/Plugin_DSP.h" +#include "PluginManager.h" #include @@ -70,8 +69,9 @@ void DoState(PointerWrap &p) return; } // Begin with video plugin, so that it gets a chance to clear it's caches and writeback modified things to RAM - PluginVideo::Video_DoState(p.GetPPtr(), p.GetMode()); - PluginDSP::DSP_DoState(p.GetPPtr(), p.GetMode()); + CPluginManager &pm = CPluginManager::GetInstance(); + pm.GetVideo()->DoState(p.GetPPtr(), p.GetMode()); + pm.GetDSP()->DoState(p.GetPPtr(), p.GetMode()); PowerPC::DoState(p); HW::DoState(p); CoreTiming::DoState(p); @@ -137,7 +137,7 @@ void SaveStateCallback(u64 userdata, int cyclesLate) delete [] buffer; - Core::DisplayMessage(StringFromFormat("Saved State to %s", + Core::DisplayMessage(StringFromFormat("Saved State to %s", cur_filename.c_str()).c_str(), 2000); } @@ -153,7 +153,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate) Core::DisplayMessage("State not found", 2000); return; } - + jit.ClearCache(); u8 *buffer = NULL; diff --git a/Source/Core/DebuggerWX/DebuggerWX.vcproj b/Source/Core/DebuggerWX/DebuggerWX.vcproj index 88b49ed796..b0b3ac5552 100644 --- a/Source/Core/DebuggerWX/DebuggerWX.vcproj +++ b/Source/Core/DebuggerWX/DebuggerWX.vcproj @@ -1,7 +1,7 @@ Append(IDM_DUALCORE, _T("&DualCore"), wxEmptyString, wxITEM_CHECK); // dualcore->Check(_LocalCoreStartupParameter.bUseDualCore); - + pMenuBar->Append(pCoreMenu, _T("&CPU Mode")); // ----------------- @@ -647,7 +645,7 @@ void CCodeWindow::OnCPUMode(wxCommandEvent& event) } // Clear the JIT cache to enable these changes - jit.ClearCache(); + jit.ClearCache(); } void CCodeWindow::OnJitMenu(wxCommandEvent& event) @@ -670,7 +668,7 @@ void CCodeWindow::OnJitMenu(wxCommandEvent& event) // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ // ======================================================================================= -// The Play, Stop, Step, Skip, Go to PC and Show PC buttons all go here +// The Play, Stop, Step, Skip, Go to PC and Show PC buttons all go here // -------------- void CCodeWindow::OnCodeStep(wxCommandEvent& event) { diff --git a/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp b/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp index 1c739f7fe3..7c3f59e9ce 100644 --- a/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp +++ b/Source/Core/DebuggerWX/Src/CodeWindowSJP.cpp @@ -63,8 +63,6 @@ #include "PowerPC/Jit64/Jit.h" #include "PowerPC/Jit64/JitCache.h" // for ClearCache() -#include "Plugins/Plugin_DSP.h" // new stuff, to let us open the DLLDebugger -#include "Plugins/Plugin_Video.h" // new stuff, to let us open the DLLDebugger #include "PluginManager.h" #include "../../DolphinWX/Src/Config.h" @@ -109,8 +107,8 @@ void CCodeWindow::CreateSymbolsMenu() " that are in the first 4 MB of memory, if you are debugging a game that load .rel" " files with code to memory you may want to increase that to perhaps 8 MB, you can do" " that from SymbolDB::SaveMap().") - ); - + ); + pSymbolsMenu->AppendSeparator(); pSymbolsMenu->Append(IDM_CREATESIGNATUREFILE, _T("&Create signature file...")); pSymbolsMenu->Append(IDM_USESIGNATUREFILE, _T("&Use signature file...")); @@ -152,7 +150,7 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event) } } -void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) +void CCodeWindow::OnSymbolsMenu(wxCommandEvent& event) { if (Core::GetState() == Core::CORE_UNINITIALIZED) { @@ -360,7 +358,7 @@ void CCodeWindow::OnToggleSoundWindow(wxCommandEvent& event) CPluginManager::GetInstance().OpenDebug( GetHandle(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(), - false, true // DSP, show + PLUGIN_TYPE_DSP, true // DSP, show ); } else // hide @@ -369,7 +367,7 @@ void CCodeWindow::OnToggleSoundWindow(wxCommandEvent& event) CPluginManager::GetInstance().OpenDebug( GetHandle(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(), - false, false // DSP, hide + PLUGIN_TYPE_DSP, false // DSP, hide ); } } @@ -390,14 +388,14 @@ void CCodeWindow::OnToggleVideoWindow(wxCommandEvent& event) /*if(Core::GetState() == Core::CORE_UNINITIALIZED) { wxMessageBox(_T("Warning, opening this window before a game is started \n\ -may cause a crash when a game is later started. Todo: figure out why and fix it."), wxT("OpenGL Debugging Window")); +may cause a crash when a game is later started. Todo: figure out why and fix it."), wxT("OpenGL Debugging Window")); }*/ // TODO: add some kind of if() check here to? CPluginManager::GetInstance().OpenDebug( GetHandle(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(), - true, true // Video, show + PLUGIN_TYPE_VIDEO, true // Video, show ); } else // hide @@ -406,7 +404,7 @@ may cause a crash when a game is later started. Todo: figure out why and fix it. CPluginManager::GetInstance().OpenDebug( GetHandle(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(), - true, false // Video, hide + PLUGIN_TYPE_VIDEO, false // Video, hide ); } } diff --git a/Source/Core/DebuggerWX/Src/SConscript b/Source/Core/DebuggerWX/Src/SConscript index 1cb5e4dd08..59ec56c32a 100644 --- a/Source/Core/DebuggerWX/Src/SConscript +++ b/Source/Core/DebuggerWX/Src/SConscript @@ -1,11 +1,11 @@ -# -*- python -*- +# -*- python -*- Import('env') if not env['HAVE_WX']: Return() -files = ["LogWindow.cpp", +files = ["LogWindow.cpp", "BreakPointDlg.cpp", "BreakpointView.cpp", "CodeView.cpp", @@ -13,7 +13,7 @@ files = ["LogWindow.cpp", "CodeWindow.cpp", "CodeWindowSJP.cpp", "CodeView.cpp", - "Debugger.cpp", + "Debugger.cpp", "MemoryCheckDlg.cpp", "MemoryView.cpp", "MemoryWindow.cpp", diff --git a/Source/Core/DiscIO/Src/SConscript b/Source/Core/DiscIO/Src/SConscript index 8c542f588a..1e50b95154 100644 --- a/Source/Core/DiscIO/Src/SConscript +++ b/Source/Core/DiscIO/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') diff --git a/Source/Core/DolphinWX/DolphinWX.vcproj b/Source/Core/DolphinWX/DolphinWX.vcproj index eb48dcc021..8dfcf72d5c 100644 --- a/Source/Core/DolphinWX/DolphinWX.vcproj +++ b/Source/Core/DolphinWX/DolphinWX.vcproj @@ -1,7 +1,7 @@ Disable(); + // Disable the Core stuff on GeneralPage + AllwaysHLEBIOS->Disable(); + UseDynaRec->Disable(); + UseDualCore->Disable(); + LockThreads->Disable(); + OptimizeQuantizers->Disable(); + SkipIdle->Disable(); + EnableCheats->Disable(); + // -------- GamecubePage->Disable(); WiiPage->Disable(); PathsPage->Disable(); @@ -158,7 +166,7 @@ void CConfigMain::CreateGUIControls() Notebook->AddPage(WiiPage, wxT("Wii")); Notebook->AddPage(PathsPage, wxT("Paths")); Notebook->AddPage(PluginPage, wxT("Plugins")); - + ////////////////////////////////// // General page @@ -396,7 +404,7 @@ void CConfigMain::CreateGUIControls() sbWiimotePlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Wiimote")); WiimoteSelection = new wxChoice(PluginPage, ID_WIIMOTE_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator); WiimoteConfig = new wxButton(PluginPage, ID_WIIMOTE_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - + FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin); FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin); FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin); @@ -428,11 +436,11 @@ void CConfigMain::CreateGUIControls() wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL); sButtons->Add(0, 0, 1, wxEXPAND, 5); sButtons->Add(m_Close, 0, wxALL, 5); - + wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL); sMain->Add(Notebook, 1, wxEXPAND|wxALL, 5); sMain->Add(sButtons, 0, wxEXPAND, 5); - + UpdateGUI(); this->SetSizer(sMain); @@ -446,7 +454,7 @@ void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event)) { Destroy(); - /* First check that we did successfully populate m_SYSCONF earlier, otherwise don't + /* First check that we did successfully populate m_SYSCONF earlier, otherwise don't save anything, it will be a corrupted file */ if(m_bSysconfOK) { diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index 5efce41492..d4edf8c837 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -86,7 +86,6 @@ class CConfigMain wxNotebook *Notebook; wxPanel *GeneralPage; - wxPanel *CorePage; wxPanel *GamecubePage; wxPanel *WiiPage; wxPanel *PathsPage; @@ -197,7 +196,6 @@ class CConfigMain { ID_NOTEBOOK = 1000, ID_GENERALPAGE, - ID_COREPAGE, ID_GAMECUBEPAGE, ID_WIIPAGE, ID_PATHSPAGE, diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index c0ae5bc9cd..d5c6f884b3 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -51,7 +51,6 @@ be accessed from Core::GetWindowHandle(). #include "Config.h" // Core #include "Core.h" #include "HW/DVDInterface.h" -#include "Plugins/Plugin_PAD.h" #include "State.h" #include "VolumeHandler.h" @@ -305,12 +304,12 @@ CFrame::CFrame(wxFrame* parent, // Create the toolbar RecreateToolbar(); - + Show(); // Show the window CPluginManager::GetInstance().ScanForPlugins(); - //if we are ever going back to optional iso caching: + //if we are ever going back to optional iso caching: //m_GameListCtrl->Update(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache); m_GameListCtrl->Update(); //sizerPanel->SetSizeHints(m_Panel); @@ -339,7 +338,7 @@ CFrame::CFrame(wxFrame* parent, (wxObject*)0, this); #endif // ---------- - + UpdateGUI(); } @@ -381,7 +380,7 @@ void CFrame::OnClose(wxCloseEvent& event) switch (nMsg) { case WM_SYSCOMMAND: - switch (wParam) + switch (wParam) { case SC_SCREENSAVE: case SC_MONITORPOWER: @@ -436,7 +435,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event) else { if(Core::GetState() != Core::CORE_UNINITIALIZED) - PluginPAD::PAD_Input(event.GetKeyCode(), 1); // 1 = Down + CPluginManager::GetInstance().GetPAD(0)->PAD_Input(event.GetKeyCode(), 1); // 1 = Down event.Skip(); } } @@ -444,7 +443,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event) void CFrame::OnKeyUp(wxKeyEvent& event) { if(Core::GetState() != Core::CORE_UNINITIALIZED) - PluginPAD::PAD_Input(event.GetKeyCode(), 0); // 0 = Up + CPluginManager::GetInstance().GetPAD(0)->PAD_Input(event.GetKeyCode(), 0); // 0 = Up event.Skip(); } @@ -455,7 +454,7 @@ double GetDoubleTime() { wxDateTime datetime = wxDateTime::UNow(); // Get timestamp u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); // Get continous timestamp - + /* Remove a few years. We only really want enough seconds to make sure that we are detecting actual actions, perhaps 60 seconds is enough really, but I leave a year of seconds anyway, in case the user's clock is incorrect or something like that */ @@ -518,7 +517,7 @@ void CFrame::OnDoubleClick(wxMouseEvent& event) // Check for mouse motion. Here we process the bHideCursor setting. // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void CFrame::OnMotion(wxMouseEvent& event) -{ +{ event.Skip(); // The following is only interesting when a game is running @@ -567,7 +566,7 @@ void CFrame::OnMotion(wxMouseEvent& event) else PostMessage((HWND)Core::GetWindowHandle(), WM_USER, 10, 1); #endif } - + } // Check for mouse status a couple of times per second for the auto hide option @@ -603,13 +602,13 @@ void CFrame::BootGame() } // Start the default ISO, or if we don't have a default ISO, start the last started ISO - else if (!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty() && + else if (!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty() && wxFileExists(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.c_str(), wxConvUTF8))) { BootManager::BootCore(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM); } - else if (!SConfig::GetInstance().m_LastFilename.empty() && + else if (!SConfig::GetInstance().m_LastFilename.empty() && wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8))) { BootManager::BootCore(SConfig::GetInstance().m_LastFilename); diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index a21f589b36..0701902eaa 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -51,7 +51,6 @@ be accessed from Core::GetWindowHandle(). #include "Config.h" // Core #include "Core.h" #include "HW/DVDInterface.h" -#include "Plugins/Plugin_PAD.h" #include "State.h" #include "VolumeHandler.h" @@ -152,7 +151,7 @@ void CFrame::CreateMenu() miscMenu->Check(IDM_TOGGLE_STATUSBAR, true); miscMenu->AppendSeparator(); miscMenu->Append(IDM_MEMCARD, _T("&Memcard manager")); - miscMenu->Append(IDM_CHEATS, _T("Action &Replay Manager")); + miscMenu->Append(IDM_CHEATS, _T("Action &Replay Manager")); m_pMenuBar->Append(miscMenu, _T("&Misc")); // Help menu @@ -182,9 +181,9 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar) toolBar->AddTool(wxID_OPEN, _T("Open"), m_Bitmaps[Toolbar_FileOpen], _T("Open file...")); toolBar->AddTool(wxID_REFRESH, _T("Refresh"), m_Bitmaps[Toolbar_Refresh], _T("Refresh")); toolBar->AddTool(IDM_BROWSE, _T("Browse"), m_Bitmaps[Toolbar_Browse], _T("Browse for an ISO directory...")); - toolBar->AddSeparator(); - - m_pToolPlay = toolBar->AddTool(IDM_PLAY, _T("Play"), m_Bitmaps[Toolbar_Play], _T("Play")); + toolBar->AddSeparator(); + + m_pToolPlay = toolBar->AddTool(IDM_PLAY, _T("Play"), m_Bitmaps[Toolbar_Play], _T("Play")); toolBar->AddTool(IDM_STOP, _T("Stop"), m_Bitmaps[Toolbar_Stop], _T("Stop")); @@ -220,8 +219,8 @@ void CFrame::PopulateToolbar(wxToolBar* toolBar) // Delete and recreate the toolbar // ŻŻŻŻŻŻŻŻŻŻ void CFrame::RecreateToolbar() -{ - +{ + wxToolBarBase* toolBar = GetToolBar(); long style = toolBar ? toolBar->GetWindowStyle() : TOOLBAR_STYLE; @@ -472,13 +471,13 @@ void CFrame::OnPlay(wxCommandEvent& WXUNUSED (event)) } /* Start the default ISO, or if we don't have a default ISO, start the last started ISO */ - else if (!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty() && + else if (!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty() && wxFileExists(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter. m_strDefaultGCM.c_str(), wxConvUTF8))) { BootManager::BootCore(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM); } - else if (!SConfig::GetInstance().m_LastFilename.empty() && + else if (!SConfig::GetInstance().m_LastFilename.empty() && wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8))) { BootManager::BootCore(SConfig::GetInstance().m_LastFilename); @@ -497,7 +496,7 @@ void CFrame::DoStop() { Core::Stop(); - /* This is needed to let GetState() == CORE_UNINITIALIZED together with the + /* This is needed to let GetState() == CORE_UNINITIALIZED together with the "delete g_pThread" in Core.cpp. Todo: Please feel free to fix it some other way. */ //PanicAlert("%i", (int)bRenderToMain); #ifdef _WIN32 @@ -656,8 +655,8 @@ void CFrame::OnSaveState(wxCommandEvent& event) // ------------- void CFrame::OnToggleToolbar(wxCommandEvent& event) { - wxToolBarBase* toolBar = GetToolBar(); - + wxToolBarBase* toolBar = GetToolBar(); + if (event.IsChecked()) { CFrame::RecreateToolbar(); diff --git a/Source/Core/DolphinWX/Src/SConscript b/Source/Core/DolphinWX/Src/SConscript index fe71f02c8d..9726ee2964 100644 --- a/Source/Core/DolphinWX/Src/SConscript +++ b/Source/Core/DolphinWX/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') import sys @@ -12,7 +12,7 @@ files = [ ] libs = [ - 'core', 'minilzo', 'discio', 'bdisasm', 'videocommon', 'inputcommon', + 'core', 'minilzo', 'discio', 'bdisasm', 'videocommon', 'inputcommon', 'common', 'z' ] diff --git a/Source/Core/InputCommon/Src/SConscript b/Source/Core/InputCommon/Src/SConscript index 0fa6c10cdc..e5fe35e802 100644 --- a/Source/Core/InputCommon/Src/SConscript +++ b/Source/Core/InputCommon/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') diff --git a/Source/Core/VideoCommon/Src/SConscript b/Source/Core/VideoCommon/Src/SConscript index 0328d6595d..b1bc0ebef2 100644 --- a/Source/Core/VideoCommon/Src/SConscript +++ b/Source/Core/VideoCommon/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') diff --git a/Source/Dolphin.sln b/Source/Dolphin.sln index 36921f6f51..ee1dbaff94 100644 --- a/Source/Dolphin.sln +++ b/Source/Dolphin.sln @@ -43,6 +43,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_VideoOGL", "Plugins\Plugin_VideoOGL\Plugin_VideoOGL.vcproj", "{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}" ProjectSection(ProjectDependencies) = postProject {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} = {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} + {C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA} {0318BA30-EF48-441A-9E10-DC85EFAE39F0} = {0318BA30-EF48-441A-9E10-DC85EFAE39F0} {71B16F46-0B00-4EDA-B253-D6D9D03A215C} = {71B16F46-0B00-4EDA-B253-D6D9D03A215C} {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA} = {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA} @@ -54,6 +55,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DolphinWX", "Core\DolphinWX\DolphinWX.vcproj", "{A72606EF-C5C1-4954-90AD-F0F93A8D97D9}" ProjectSection(ProjectDependencies) = postProject {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} = {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} + {C7E5D50A-2916-464B-86A7-E10B3CC88ADA} = {C7E5D50A-2916-464B-86A7-E10B3CC88ADA} {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160} = {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160} {D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8} = {D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8} {0318BA30-EF48-441A-9E10-DC85EFAE39F0} = {0318BA30-EF48-441A-9E10-DC85EFAE39F0} @@ -423,11 +425,17 @@ Global {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}.Release|x64.ActiveCfg = Release|x64 {C7E5D50A-2916-464B-86A7-E10B3CC88ADA}.Release|x64.Build.0 = Release|x64 {58E81545-241B-416E-8088-E62452EB25FA}.Debug|Win32.ActiveCfg = Debug|Win32 + {58E81545-241B-416E-8088-E62452EB25FA}.Debug|Win32.Build.0 = Debug|Win32 {58E81545-241B-416E-8088-E62452EB25FA}.Debug|x64.ActiveCfg = Debug|x64 + {58E81545-241B-416E-8088-E62452EB25FA}.Debug|x64.Build.0 = Debug|x64 {58E81545-241B-416E-8088-E62452EB25FA}.DebugFast|Win32.ActiveCfg = DebugFast|Win32 + {58E81545-241B-416E-8088-E62452EB25FA}.DebugFast|Win32.Build.0 = DebugFast|Win32 {58E81545-241B-416E-8088-E62452EB25FA}.DebugFast|x64.ActiveCfg = DebugFast|x64 + {58E81545-241B-416E-8088-E62452EB25FA}.DebugFast|x64.Build.0 = DebugFast|x64 {58E81545-241B-416E-8088-E62452EB25FA}.Release|Win32.ActiveCfg = Release|Win32 + {58E81545-241B-416E-8088-E62452EB25FA}.Release|Win32.Build.0 = Release|Win32 {58E81545-241B-416E-8088-E62452EB25FA}.Release|x64.ActiveCfg = Release|x64 + {58E81545-241B-416E-8088-E62452EB25FA}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Source/PluginSpecs/PluginSpecs.h b/Source/PluginSpecs/PluginSpecs.h index 75d7aebf65..bfd7a92e49 100644 --- a/Source/PluginSpecs/PluginSpecs.h +++ b/Source/PluginSpecs/PluginSpecs.h @@ -41,13 +41,15 @@ extern "C" { #endif // plugin types -#define PLUGIN_TYPE_VIDEO 1 -#define PLUGIN_TYPE_DVD 2 -#define PLUGIN_TYPE_PAD 3 -#define PLUGIN_TYPE_AUDIO 4 -#define PLUGIN_TYPE_COMPILER 5 -#define PLUGIN_TYPE_DSP 6 -#define PLUGIN_TYPE_WIIMOTE 7 +enum PLUGIN_TYPE { + PLUGIN_TYPE_VIDEO = 1, + PLUGIN_TYPE_DVD, + PLUGIN_TYPE_PAD, + PLUGIN_TYPE_AUDIO, + PLUGIN_TYPE_COMPILER, + PLUGIN_TYPE_DSP, + PLUGIN_TYPE_WIIMOTE, +}; #define STATE_MODE_READ 1 #define STATE_MODE_WRITE 2 @@ -56,7 +58,7 @@ extern "C" { typedef struct { u16 Version; // Set to 0x0100 - u16 Type; // Set to PLUGIN_TYPE_DVD + PLUGIN_TYPE Type; // Set to PLUGIN_TYPE_DVD char Name[100]; // Name of the DLL } PLUGIN_INFO; @@ -103,6 +105,31 @@ EXPORT void CALL DllDebugger(HWND _hParent, bool Show); // output: none // EXPORT void CALL SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals); +// __________________________________________________________________________________________________ + +// Function: Initialize +// Purpose: Initialize the plugin +// input: Init +// output: none +// +EXPORT void CALL Initialize(void *init); +// __________________________________________________________________________________________________ +// Function: Shutdown +// Purpose: This function is called when the emulator is shutting down +// a game allowing the dll to de-initialise. +// input: none +// output: none +// +EXPORT void CALL Shutdown(void); + +// __________________________________________________________________________________________________ +// Function: DoState +// Purpose: Saves/load state +// input/output: ptr +// input: mode +// +EXPORT void CALL DoState(unsigned char **ptr, int mode); + #if defined(__cplusplus) } #endif diff --git a/Source/PluginSpecs/pluginspecs_dsp.h b/Source/PluginSpecs/pluginspecs_dsp.h index 7350299444..6fb9e6a023 100644 --- a/Source/PluginSpecs/pluginspecs_dsp.h +++ b/Source/PluginSpecs/pluginspecs_dsp.h @@ -30,22 +30,6 @@ typedef struct TAudioGetStreaming pGetAudioStreaming; } DSPInitialize; -// __________________________________________________________________________________________________ - -// Function: DSP_Initialize -// Purpose: -// input: DSPInitialize -// output: none -// -EXPORT void CALL DSP_Initialize(DSPInitialize _dspInitialize); -// __________________________________________________________________________________________________ -// Function: DSP_Shutdown -// Purpose: This function is called when the emulator is shutting down -// a game allowing the dll to de-initialise. -// input: none -// output: none -// -EXPORT void CALL DSP_Shutdown(void); // __________________________________________________________________________________________________ // Function: DSP_ReadMailboxHigh @@ -110,13 +94,6 @@ EXPORT void CALL DSP_Update(int cycles); // EXPORT void CALL DSP_SendAIBuffer(unsigned int address, int sample_rate); -// __________________________________________________________________________________________________ -// Function: DSP_DoState -// Purpose: Saves/load state -// input/output: ptr -// input: mode -// -EXPORT void CALL DSP_DoState(unsigned char **ptr, int mode); #include "ExportEpilog.h" #endif diff --git a/Source/PluginSpecs/pluginspecs_pad.h b/Source/PluginSpecs/pluginspecs_pad.h index 0dfd6af645..4ba867cef5 100644 --- a/Source/PluginSpecs/pluginspecs_pad.h +++ b/Source/PluginSpecs/pluginspecs_pad.h @@ -56,24 +56,7 @@ typedef struct // I N T E R F A C E /////////////////////////////////////////////////////////// // __________________________________________________________________________________________________ -// Function: -// Purpose: -// input: SPADInitialize -// output: none -// -EXPORT void CALL PAD_Initialize(SPADInitialize _PADInitialize); - -// __________________________________________________________________________________________________ -// Function: PAD_Shutdown -// Purpose: This function is called when the emulator is closing -// down allowing the DLL to de-initialise. -// input: none -// output: none -// -EXPORT void CALL PAD_Shutdown(); - -// __________________________________________________________________________________________________ -// Function: +// Function: // Purpose: // input: // output: @@ -91,7 +74,7 @@ EXPORT void CALL PAD_Input(u8 _Key, u8 _UpDown); // __________________________________________________________________________________________________ // Function: PAD_Rumble // Purpose: Pad rumble! -// input: PAD number, Command type (Stop=0, Rumble=1, Stop Hard=2) and strength of Rumble +// input: PAD number, Command type (Stop=0, Rumble=1, Stop Hard=2) and strength of Rumble // output: none // EXPORT void CALL PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength); @@ -104,13 +87,5 @@ EXPORT void CALL PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStre // EXPORT unsigned int CALL PAD_GetAttachedPads(); -// __________________________________________________________________________________________________ -// Function: PAD_DoState -// Purpose: Saves/load state -// input/output: ptr -// input: mode -// -EXPORT void CALL PAD_DoState(void *ptr, int mode); - #include "ExportEpilog.h" #endif diff --git a/Source/PluginSpecs/pluginspecs_video.h b/Source/PluginSpecs/pluginspecs_video.h index 37bbf98a74..1baffbabeb 100644 --- a/Source/PluginSpecs/pluginspecs_video.h +++ b/Source/PluginSpecs/pluginspecs_video.h @@ -78,14 +78,6 @@ typedef struct // I N T E R F A C E //////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// -// __________________________________________________________________________________________________ -// Function: Video_Initialize -// Purpose: -// input: SVideoInitialize* - pointer because window data will be passed back -// output: none -// -EXPORT void CALL Video_Initialize(SVideoInitialize* _pvideoInitialize); - // __________________________________________________________________________________________________ // Function: Video_Prepare // Purpose: This function is called from the EmuThread before the @@ -96,15 +88,6 @@ EXPORT void CALL Video_Initialize(SVideoInitialize* _pvideoInitialize); // EXPORT void CALL Video_Prepare(void); -// __________________________________________________________________________________________________ -// Function: Video_Shutdown -// Purpose: This function is called when the emulator is shutting down -// a game allowing the dll to de-initialise. -// input: none -// output: none -// -EXPORT void CALL Video_Shutdown(void); - // __________________________________________________________________________________________________ // Function: Video_ExecuteFifoBuffer // Purpose: This function is called if data is inside the fifo-buffer @@ -147,14 +130,6 @@ EXPORT void CALL Video_EnterLoop(void); // EXPORT void CALL Video_AddMessage(const char* pstr, unsigned int milliseconds); -// __________________________________________________________________________________________________ -// Function: Video_DoState -// Purpose: Saves/Loads the current video data state (depends on mode parameter) -// input/output: ptr -// input: mode -// -EXPORT void CALL Video_DoState(unsigned char **ptr, int mode); - // __________________________________________________________________________________________________ // Function: Video_Stop // Purpose: Stop the video plugin before shutdown diff --git a/Source/PluginSpecs/pluginspecs_wiimote.h b/Source/PluginSpecs/pluginspecs_wiimote.h index 03a218d319..cc54f97847 100644 --- a/Source/PluginSpecs/pluginspecs_wiimote.h +++ b/Source/PluginSpecs/pluginspecs_wiimote.h @@ -46,23 +46,6 @@ typedef struct // I N T E R F A C E //////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// -// __________________________________________________________________________________________________ -// Function: -// Purpose: -// input: WiimoteInitialize -// output: If at least one real Wiimote was found or not -// -EXPORT bool CALL Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize); - -// __________________________________________________________________________________________________ -// Function: Wiimote_Shutdown -// Purpose: This function is called when the emulator is closing -// down allowing the DLL to de-initialise. -// input: none -// output: none -// -EXPORT void CALL Wiimote_Shutdown(); - // __________________________________________________________________________________________________ // Function: Wiimote_Output // Purpose: An L2CAP packet is passed from the Core to the Wiimote, @@ -97,14 +80,6 @@ EXPORT void CALL Wiimote_Update(); // EXPORT unsigned int CALL Wiimote_GetAttachedControllers(); -// __________________________________________________________________________________________________ -// Function: Wiimote_DoState -// Purpose: Saves/load state -// input/output: ptr -// input: mode -// -EXPORT void CALL Wiimote_DoState(void *ptr, int mode); - #include "ExportEpilog.h" #endif //_WIIMOTE_H_INCLUDED__ diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript index e760cefa11..8439ff39e7 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/SConscript +++ b/Source/Plugins/Plugin_DSP_HLE/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') import sys diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp index 48067cc762..91c7b397bf 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp @@ -85,7 +85,7 @@ class wxDLLApp : public wxApp } }; -IMPLEMENT_APP_NO_MAIN(wxDLLApp) +IMPLEMENT_APP_NO_MAIN(wxDLLApp) WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); /////////////////// #endif @@ -163,7 +163,7 @@ void DllDebugger(HWND _hParent, bool Show) { m_frame->DoShow(); } - else if(!m_frame && Show) + else if(!m_frame && Show) { m_frame = new CDebugger(NULL); m_frame->Show(); @@ -181,7 +181,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo) { _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_DSP; -#ifdef DEBUGFAST +#ifdef DEBUGFAST sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin (DebugFast) "); #else #ifndef _DEBUG @@ -203,18 +203,18 @@ void DllConfig(HWND _hParent) #endif } -void DSP_Initialize(DSPInitialize _dspInitialize) +void Initialize(void *init) { g_Config.LoadDefaults(); g_Config.Load(); - g_dspInitialize = _dspInitialize; + g_dspInitialize = *(DSPInitialize*)init; g_pMemory = g_dspInitialize.pGetMemoryPointer(0); #if defined(_DEBUG) || defined(DEBUGFAST) gpName = g_dspInitialize.pName(); // save the game name globally - for (int i = 0; i < gpName.length(); ++i) // and fix it + for (u32 i = 0; i < gpName.length(); ++i) // and fix it { wprintf(L"%c", gpName[i]); std::cout << gpName[i]; @@ -242,7 +242,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize) #endif } -void DSP_Shutdown() +void Shutdown() { if (log_ai) g_wave_writer.Stop(); @@ -266,7 +266,7 @@ void DSP_Shutdown() #endif } -void DSP_DoState(unsigned char **ptr, int mode) { +void DoState(unsigned char **ptr, int mode) { PointerWrap p(ptr, mode); } diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/SConscript b/Source/Plugins/Plugin_DSP_LLE/Src/SConscript index c528b3c1b4..97769e1463 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/SConscript +++ b/Source/Plugins/Plugin_DSP_LLE/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') import sys diff --git a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp index c8db232515..395dc6c9c3 100644 --- a/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_LLE/Src/main.cpp @@ -99,7 +99,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo) _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_DSP; -#ifdef DEBUGFAST +#ifdef DEBUGFAST sprintf(_PluginInfo->Name, "Dolphin DSP-LLE Plugin (DebugFast)"); #else #ifndef _DEBUG @@ -121,7 +121,7 @@ void DllConfig(HWND _hParent) {} -void DSP_DoState(unsigned char **ptr, int mode) { +void DoState(unsigned char **ptr, int mode) { PointerWrap p(ptr, mode); } @@ -196,7 +196,7 @@ void* dsp_thread_debug(void* lpParameter) Sleep(100); } } -#endif +#endif return NULL; } // ============== @@ -217,11 +217,10 @@ void dspi_req_dsp_irq() g_dspInitialize.pGenerateDSPInterrupt(); } - -void DSP_Initialize(DSPInitialize _dspInitialize) +void Initialize(void *init) { bCanWork = true; - g_dspInitialize = _dspInitialize; + g_dspInitialize = *(DSPInitialize*)init; gdsp_init(); g_dsp.step_counter = 0; @@ -247,7 +246,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize) return; // TODO: Don't let it work // --------------------------------------------------------------------------------------- -// First create DSP_UCode.bin by setting "#define DUMP_DSP_IMEM 1" in Globals.h. Then +// First create DSP_UCode.bin by setting "#define DUMP_DSP_IMEM 1" in Globals.h. Then // make the disassembled file here. // -------------- // Dump UCode to file... @@ -289,7 +288,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize) } -void DSP_Shutdown(void) +void Shutdown(void) { if (log_ai) g_wave_writer.Stop(); diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/SConscript b/Source/Plugins/Plugin_DSP_NULL/Src/SConscript index 5bc79e6aef..8123ae755e 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/SConscript +++ b/Source/Plugins/Plugin_DSP_NULL/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') import sys diff --git a/Source/Plugins/Plugin_DSP_NULL/Src/main.cpp b/Source/Plugins/Plugin_DSP_NULL/Src/main.cpp index 5e6d01d1fe..29e9af123e 100644 --- a/Source/Plugins/Plugin_DSP_NULL/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_NULL/Src/main.cpp @@ -79,7 +79,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo) { _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_DSP; -#ifdef DEBUGFAST +#ifdef DEBUGFAST sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin (DebugFast) "); #else #ifndef _DEBUG @@ -101,22 +101,22 @@ void DllConfig(HWND _hParent) { } -void DSP_Initialize(DSPInitialize _dspInitialize) +void Initialize(void *init) { - g_dspInitialize = _dspInitialize; + g_dspInitialize = *(DSPInitialize*)init; g_pMemory = g_dspInitialize.pGetMemoryPointer(0); CDSPHandler::CreateInstance(); } -void DSP_Shutdown() +void Shutdown() { CDSPHandler::Destroy(); } -void DSP_DoState(unsigned char **ptr, int mode) { +void DoState(unsigned char **ptr, int mode) { PointerWrap p(ptr, mode); } diff --git a/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp b/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp index 992615c462..4b2be37006 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp +++ b/Source/Plugins/Plugin_PadSimple/Src/PadSimple.cpp @@ -131,10 +131,10 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle if ( !wxTheApp || !wxTheApp->CallOnInit() ) return FALSE; } - break; + break; case DLL_PROCESS_DETACH: - wxEntryCleanup(); //use wxUninitialize() if you don't want GUI + wxEntryCleanup(); //use wxUninitialize() if you don't want GUI break; default: break; @@ -152,7 +152,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo) _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_PAD; -#ifdef DEBUGFAST +#ifdef DEBUGFAST sprintf(_PluginInfo->Name, "Dolphin KB/X360pad (DebugFast)"); #else #ifndef _DEBUG @@ -189,25 +189,27 @@ void DllConfig(HWND _hParent) void DllDebugger(HWND _hParent, bool Show) { } -void PAD_Initialize(SPADInitialize _PADInitialize) +void Initialize(void *init) { #ifdef RECORD_REPLAY LoadRecord(); #endif - g_PADInitialize = _PADInitialize; + g_PADInitialize = *(SPADInitialize*)init; #ifdef _WIN32 dinput.Init((HWND)g_PADInitialize.hWnd); #elif defined(HAVE_X11) && HAVE_X11 GXdsp = (Display*)g_PADInitialize.hWnd; #elif defined(HAVE_COCOA) && HAVE_COCOA #endif - + LoadConfig(); } +void DoState(unsigned char **ptr, int mode) { +} -void PAD_Shutdown() +void Shutdown() { #ifdef RECORD_STORE SaveRecord(); @@ -267,7 +269,7 @@ void DInput_Read(int _numPAD, SPADStatus* _pPADStatus) int stickvalue = (dinput.diks[pad[_numPAD].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 40 : 100; int triggervalue = (dinput.diks[pad[_numPAD].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 100 : 255; - + // get the new keys if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINLEFT]] & 0xFF){_pPADStatus->stickX -= stickvalue;} if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINRIGHT]] & 0xFF){_pPADStatus->stickX += stickvalue;} @@ -389,7 +391,7 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus) key = XLookupKeysym((XKeyEvent*)&E, 0); - if((key >= XK_F1 && key <= XK_F9) || + if((key >= XK_F1 && key <= XK_F9) || key == XK_Shift_L || key == XK_Shift_R || key == XK_Control_L || key == XK_Control_R) { XPutBackEvent(GXdsp, &E); @@ -411,7 +413,7 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus) key = XLookupKeysym((XKeyEvent*)&E, 0); - if((key >= XK_F1 && key <= XK_F9) || + if((key >= XK_F1 && key <= XK_F9) || key == XK_Shift_L || key == XK_Shift_R || key == XK_Control_L || key == XK_Control_R) { XPutBackEvent(GXdsp, &E); @@ -464,7 +466,7 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus) if (KeyStatus[CTL_X]){_pPADStatus->button |= PAD_BUTTON_X;} if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;} if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;} - + if (KeyStatus[CTL_L]) { _pPADStatus->button |= PAD_TRIGGER_L; _pPADStatus->triggerLeft = triggervalue; @@ -564,7 +566,7 @@ void cocoa_Read(int _numPAD, SPADStatus* _pPADStatus) if (KeyStatus[CTL_X]){_pPADStatus->button |= PAD_BUTTON_X;} if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;} if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;} - + if (KeyStatus[CTL_L]) { _pPADStatus->button |= PAD_TRIGGER_L; _pPADStatus->triggerLeft = triggervalue; @@ -674,7 +676,7 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength) unsigned int PAD_GetAttachedPads() { unsigned int connected = 0; - + LoadConfig(); if(pad[0].bAttached) @@ -693,7 +695,7 @@ unsigned int PAD_GetAttachedPads() void LoadConfig() { // Initialize first pad to standard controls -#ifdef _WIN32 +#ifdef _WIN32 const int defaultKeyForControl[NUMCONTROLS] = { DIK_X, //A @@ -731,7 +733,7 @@ void LoadConfig() XK_w, XK_Up, //mainstick XK_Down, - XK_Left, + XK_Left, XK_Right, XK_i, //substick XK_K, @@ -785,12 +787,12 @@ void LoadConfig() file.Get(SectionName, "Rumble", &pad[i].bRumble, true); file.Get(SectionName, "XPad#", &pad[i].XPadPlayer); - for (int x = 0; x < NUMCONTROLS; x++) + for (int x = 0; x < NUMCONTROLS; x++) { - file.Get(SectionName, controlNames[x], &pad[i].keyForControl[x], + file.Get(SectionName, controlNames[x], &pad[i].keyForControl[x], (i==0)?defaultKeyForControl[x]:0); #if defined(HAVE_X11) && HAVE_X11 - // In linux we have a problem assigning the upper case of the + // In linux we have a problem assigning the upper case of the // keys because they're not being recognized pad[i].keyForControl[x] = tolower(pad[i].keyForControl[x]); #endif diff --git a/Source/Plugins/Plugin_PadSimple/Src/SConscript b/Source/Plugins/Plugin_PadSimple/Src/SConscript index a7bcaabb3b..626f33398a 100644 --- a/Source/Plugins/Plugin_PadSimple/Src/SConscript +++ b/Source/Plugins/Plugin_PadSimple/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') import sys @@ -10,10 +10,6 @@ if not env['HAVE_X11']: print name + " must have X11 to be built" Return() -if env['GLTEST']: - print name + " Doesn't work with testgl" - Return() - files = [ "PadSimple.cpp", @@ -28,12 +24,12 @@ if padenv['HAVE_COCOA']: ] if padenv['HAVE_WX']: - files += [ + files += [ "GUI/ConfigDlg.cpp", ] if env['HAVE_X11']: - files += [ + files += [ "XInputBase.cpp", ] diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Plugin_PadSimpleEvnt.vcproj b/Source/Plugins/Plugin_PadSimpleEvnt/Plugin_PadSimpleEvnt.vcproj index 45bae0213c..c81ddfdfc6 100644 --- a/Source/Plugins/Plugin_PadSimpleEvnt/Plugin_PadSimpleEvnt.vcproj +++ b/Source/Plugins/Plugin_PadSimpleEvnt/Plugin_PadSimpleEvnt.vcproj @@ -53,7 +53,7 @@ Name="VCCLCompilerTool" Optimization="3" InlineFunctionExpansion="1" - AdditionalIncludeDirectories="../../PluginSpecs;..\..\Core\InputCommon\Src;../../Core/Common/Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc" + AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" StringPooling="true" RuntimeLibrary="0" @@ -155,7 +155,7 @@ Optimization="3" InlineFunctionExpansion="1" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="../../PluginSpecs;..\..\Core\InputCommon\Src;../../Core/Common/Src;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc" + AdditionalIncludeDirectories="..\..\Core\Common\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\include;..\..\..\Externals\wxWidgets\lib\vc_lib\msw;..\..\..\Externals\wxWidgets\include\msvc" PreprocessorDefinitions="_SECURE_SCL=0;WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;__WXMSW__;NOPCH" StringPooling="true" RuntimeLibrary="0" @@ -254,7 +254,7 @@ Add(new wxStaticText(pan, 0, wxString::FromAscii(name), + hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name), wxDefaultPosition, wxDefaultSize), 0, wxALIGN_CENTER_VERTICAL|wxALL); ((EventHandler *)globals->eventHandler)->SFKeyToString (pad[controller].keyForControl[ctl], keyStr); - *button = new wxButton(pan, ctl, wxString::FromAscii(keyStr), + *button = new wxButton(pan, ctl, wxString::FromAscii(keyStr), wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS); hButton->Add(*button, 0, wxALIGN_RIGHT|wxALL); @@ -115,7 +115,7 @@ void ConfigDialog::CreateGUIControls() { this->SetSizer(sMain); this->Layout(); - + for(int i = 0; i < 4; i++) { sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings")); sDevice[i] = new wxBoxSizer(wxHORIZONTAL); @@ -123,51 +123,51 @@ void ConfigDialog::CreateGUIControls() { m_Disable[i] = new wxCheckBox(m_Controller[i], ID_DISABLE, wxT("Disable when Dolphin is not in focus"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_Attached[i]->SetValue(pad[i].bAttached); m_Disable[i]->SetValue(pad[i].bDisable); - + sDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1); sDevice[i]->AddStretchSpacer(); sDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1); sbDevice[i]->Add(sDevice[i], 0, wxEXPAND|wxALL, 1); - + sButtons[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Buttons")); - + AddControl(m_Controller[i], &(m_ButtonA[i]), sButtons[i], "A: ", CTL_A, i); AddControl(m_Controller[i], &(m_ButtonB[i]), sButtons[i], "B: ", CTL_B, i); AddControl(m_Controller[i], &(m_ButtonX[i]), sButtons[i], "X: ", CTL_X, i); AddControl(m_Controller[i], &(m_ButtonY[i]), sButtons[i], "Y: ", CTL_Y, i); AddControl(m_Controller[i], &(m_ButtonZ[i]), sButtons[i], "Z: ", CTL_Z, i); AddControl(m_Controller[i], &(m_ButtonStart[i]), sButtons[i], "Start: ", CTL_START, i); - + sTriggers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Triggers")); - + AddControl(m_Controller[i], &(m_ButtonL[i]), sTriggers[i], " L: ", CTL_L, i); AddControl(m_Controller[i], &(m_ButtonR[i]), sTriggers[i], " R: ", CTL_R, i); - + sModifiers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Modifiers")); - + AddControl(m_Controller[i], &(m_HalfPress[i]), sModifiers[i], "1/2 Press: ", CTL_HALFPRESS, i); - + sStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Main Stick")); - + AddControl(m_Controller[i], &(m_StickUp[i]), sStick[i], "Up: ", CTL_MAINUP, i); AddControl(m_Controller[i], &(m_StickDown[i]), sStick[i], "Down: ", CTL_MAINDOWN, i); AddControl(m_Controller[i], &(m_StickLeft[i]), sStick[i], "Left: ", CTL_MAINLEFT, i); AddControl(m_Controller[i], &(m_StickRight[i]), sStick[i], "Right: ", CTL_MAINRIGHT, i); - + sDPad[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("D-Pad")); - + AddControl(m_Controller[i], &(m_DPadUp[i]), sDPad[i], "Up: ", CTL_DPADUP, i); AddControl(m_Controller[i], &(m_DPadDown[i]), sDPad[i], "Down: ", CTL_DPADDOWN, i); AddControl(m_Controller[i], &(m_DPadLeft[i]), sDPad[i], "Left: ", CTL_DPADLEFT, i); AddControl(m_Controller[i], &(m_DPadRight[i]), sDPad[i], "Right: ", CTL_DPADRIGHT, i); - + sCStick[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("C-Stick")); - + AddControl(m_Controller[i], &(m_CStickUp[i]), sCStick[i], "Up: ", CTL_SUBUP, i); AddControl(m_Controller[i], &(m_CStickDown[i]), sCStick[i], "Down: ", CTL_SUBDOWN, i); AddControl(m_Controller[i], &(m_CStickLeft[i]), sCStick[i], "Left: ", CTL_SUBLEFT, i); AddControl(m_Controller[i], &(m_CStickRight[i]), sCStick[i], "Right: ", CTL_SUBRIGHT, i); - + sPage[i] = new wxGridBagSizer(0, 0); sPage[i]->SetFlexibleDirection(wxBOTH); sPage[i]->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED); @@ -190,13 +190,12 @@ void ConfigDialog::OnClose(wxCloseEvent& event) { void ConfigDialog::OnKeyDown(wxKeyEvent& event) { if(clickedButton != NULL) { int page = m_Notebook->GetSelection(); - static EventHandler *eventHandler = (EventHandler *)globals->eventHandler; - fprintf(stderr, "Got key code %d\n",event.GetKeyCode()); + EventHandler *eventHandler = (EventHandler *)globals->eventHandler; + fprintf(stderr, "Got key code %d\n",event.GetKeyCode()); sf::Key::Code sfcode = eventHandler->wxCharCodeToSF(event.GetKeyCode()); char sfstr[100]; eventHandler->SFKeyToString(sfcode, sfstr); - - // pad[page].keyForControl[clickedButton->GetId()] = sfcode; + if (registerKey(page, clickedButton->GetId(), sfcode)) clickedButton->SetLabel(wxString::FromAscii(sfstr)); clickedButton->Disconnect(); diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp index ddb3f552d1..26a2440cd0 100644 --- a/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp +++ b/Source/Plugins/Plugin_PadSimpleEvnt/Src/PadSimple.cpp @@ -54,7 +54,7 @@ static const char* controlNames[] = "Mic-button", }; -PLUGIN_GLOBALS* globals; +PLUGIN_GLOBALS* globals = NULL; SPads pad[4]; bool KeyStatus[NUMCONTROLS]; @@ -92,7 +92,7 @@ const SPADStatus& PlayRecord() bool registerKey(int nPad, int id, sf::Key::Code code, int mods) { Keys key, oldKey; - static EventHandler *eventHandler = (EventHandler *)globals->eventHandler; + EventHandler *eventHandler = (EventHandler *)globals->eventHandler; key.inputType = KeyboardInput; key.keyCode = code; @@ -111,7 +111,7 @@ bool registerKey(int nPad, int id, sf::Key::Code code, int mods) { } - // FIXME: unregister old event + // FIXME: unregister old event // We need to handle mod change // and double registers if (pad[nPad].keyForControl[id] != 0) { @@ -120,9 +120,9 @@ bool registerKey(int nPad, int id, sf::Key::Code code, int mods) { oldKey.keyCode = pad[nPad].keyForControl[id]; oldKey.mods = mods; - + // Might be not be registered yet - // eventHandler->RemoveEventListener(oldKey); + // eventHandler->RemoveEventListener(oldKey); } pad[nPad].keyForControl[id] = code; @@ -182,10 +182,10 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle if ( !wxTheApp || !wxTheApp->CallOnInit() ) return FALSE; } - break; + break; case DLL_PROCESS_DETACH: - wxEntryCleanup(); //use wxUninitialize() if you don't want GUI + wxEntryCleanup(); //use wxUninitialize() if you don't want GUI break; default: break; @@ -203,7 +203,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo) _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_PAD; -#ifdef DEBUGFAST +#ifdef DEBUGFAST sprintf(_PluginInfo->Name, "Dolphin event pad (DebugFast)"); #elif defined _DEBUG sprintf(_PluginInfo->Name, "Dolphin event pad (Debug)"); @@ -228,17 +228,20 @@ void DllConfig(HWND _hParent) void DllDebugger(HWND _hParent, bool Show) { } -void PAD_Initialize(SPADInitialize _PADInitialize) +void DoState(unsigned char **ptr, int mode) { +} + +void Initialize(void *init) { #ifdef RECORD_REPLAY LoadRecord(); #endif - + g_PADInitialize = *(SPADInitialize*)init; LoadConfig(); } -void PAD_Shutdown() +void Shutdown() { #ifdef RECORD_STORE SaveRecord(); @@ -318,7 +321,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) if (KeyStatus[CTL_X]){_pPADStatus->button |= PAD_BUTTON_X;} if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;} if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;} - + if (KeyStatus[CTL_L]) { _pPADStatus->button |= PAD_TRIGGER_L; _pPADStatus->triggerLeft = triggervalue; @@ -348,7 +351,7 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength) { unsigned int PAD_GetAttachedPads() { unsigned int connected = 0; - + LoadConfig(); if(pad[0].bAttached) @@ -377,7 +380,7 @@ void LoadConfig() sf::Key::W, sf::Key::Up, //mainstick sf::Key::Down, - sf::Key::Left, + sf::Key::Left, sf::Key::Right, sf::Key::I, //substick sf::Key::K, diff --git a/Source/Plugins/Plugin_PadSimpleEvnt/Src/SConscript b/Source/Plugins/Plugin_PadSimpleEvnt/Src/SConscript index aa0b2be1cf..43e294a24e 100644 --- a/Source/Plugins/Plugin_PadSimpleEvnt/Src/SConscript +++ b/Source/Plugins/Plugin_PadSimpleEvnt/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') import sys @@ -15,7 +15,7 @@ files = [ padeenv = env.Clone() if padeenv['HAVE_WX']: - files += [ + files += [ "GUI/ConfigDlg.cpp", ] diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index 409241760c..b1759fd58f 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -143,11 +143,11 @@ void DeInit() } } -void GetDllInfo (PLUGIN_INFO* _PluginInfo) +void GetDllInfo (PLUGIN_INFO* _PluginInfo) { _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_VIDEO; -#ifdef DEBUGFAST +#ifdef DEBUGFAST sprintf_s(_PluginInfo->Name, 100, "Dolphin Direct3D9 (DebugFast)"); #else #ifndef _DEBUG @@ -161,7 +161,7 @@ void GetDllInfo (PLUGIN_INFO* _PluginInfo) void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) { } -void DllAbout(HWND _hParent) +void DllAbout(HWND _hParent) { DialogBox(g_hInstance,(LPCSTR)IDD_ABOUT,_hParent,(DLGPROC)AboutProc); } @@ -175,11 +175,10 @@ void DllConfig(HWND _hParent) } } -void Video_Initialize(SVideoInitialize* _pVideoInitialize) +void Initialize(void *init) { - if (_pVideoInitialize == NULL) - return; + SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init; frameCount = 0; g_VideoInitialize = *_pVideoInitialize; Init(); @@ -191,7 +190,7 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize) } -void Video_DoState(unsigned char **ptr, int mode) { +void DoState(unsigned char **ptr, int mode) { // Clear all caches TextureCache::Invalidate(); @@ -219,7 +218,7 @@ void Video_Prepare(void) OpcodeDecoder_Init(); } -void Video_Shutdown(void) +void Shutdown(void) { Fifo_Shutdown(); OpcodeDecoder_Shutdown(); @@ -230,7 +229,7 @@ void Video_Shutdown(void) DeInit(); } -void Video_Stop(void) +void Video_Stop(void) { } @@ -278,7 +277,7 @@ void __Log(int log, const char *format, ...) } -HRESULT ScreenShot(TCHAR *File) +HRESULT ScreenShot(TCHAR *File) { if (D3D::dev == NULL) return S_FALSE; @@ -293,13 +292,13 @@ HRESULT ScreenShot(TCHAR *File) if (FAILED(D3D::dev->GetFrontBufferData(0, surf))) { - surf->Release(); + surf->Release(); return S_FALSE; } RECT rect; ::GetWindowRect(EmuWindow::GetWnd(), &rect); - if (FAILED(D3DXSaveSurfaceToFile(File, D3DXIFF_JPG, surf, NULL, &rect))) + if (FAILED(D3DXSaveSurfaceToFile(File, D3DXIFF_JPG, surf, NULL, &rect))) { surf->Release(); return S_FALSE; diff --git a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj index 165737a46e..0a62821176 100644 --- a/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj +++ b/Source/Plugins/Plugin_VideoOGL/Plugin_VideoOGL.vcproj @@ -1,7 +1,7 @@ + + diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index 5fc19a5483..15a16a47b1 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -98,7 +98,7 @@ void OpenGL_SetSize(u32 width, u32 height) { } -void OpenGL_SetWindowText(const char *text) +void OpenGL_SetWindowText(const char *text) { #if USE_SDL SDL_WM_SetCaption(text, NULL); @@ -113,7 +113,7 @@ void OpenGL_SetWindowText(const char *text) * Tell X to ask the window manager to set the window title. (X * itself doesn't provide window title functionality.) */ - XStoreName(GLWin.dpy, GLWin.win, text); + XStoreName(GLWin.dpy, GLWin.win, text); #endif } @@ -130,7 +130,7 @@ unsigned int Callback_PeekMessages() DispatchMessage(&msg); } return TRUE; -#else +#else return FALSE; #endif } @@ -147,7 +147,7 @@ void UpdateFPSDisplay(const char *text) // Create rendering window. // Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize() // ------------------ -bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight) +bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight) { // -------------------------------------------- // Check for fullscreen mode @@ -238,12 +238,12 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0}; wxSize size(_iwidth, _iheight); - if (!g_Config.renderToMainframe || + if (!g_Config.renderToMainframe || g_VideoInitialize.pWindowHandle == NULL) { - GLWin.frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle, + GLWin.frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle, -1, _("Dolphin"), wxPoint(0,0), size); } else { - GLWin.frame = new wxFrame((wxWindow *)NULL, + GLWin.frame = new wxFrame((wxWindow *)NULL, -1, _("Dolphin"), wxPoint(0,0), size); } GLWin.glCanvas = new wxGLCanvas(GLWin.frame, wxID_ANY, args, @@ -280,7 +280,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight g_VideoInitialize.pSysMessage("failed to create window"); return false; } - + GLuint PixelFormat; // Holds The Results After Searching For A Match DWORD dwExStyle; // Window Extended Style DWORD dwStyle; // Window Style @@ -387,18 +387,18 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight // attributes for a single buffered visual in RGBA format with at least // 8 bits per color and a 24 bit depth buffer - int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, + int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 24, None}; - // attributes for a double buffered visual in RGBA format with at least + // attributes for a double buffered visual in RGBA format with at least // 8 bits per color and a 24 bit depth buffer - int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER, - GLX_RED_SIZE, 8, - GLX_GREEN_SIZE, 8, - GLX_BLUE_SIZE, 8, + int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 24, GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode, GLX_SAMPLES_ARB, 1, None }; GLWin.dpy = XOpenDisplay(0); @@ -563,7 +563,7 @@ bool OpenGL_MakeCurrent() XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y, &GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth); ERROR_LOG("GLWin Depth %d", GLWin.depth); - if (glXIsDirect(GLWin.dpy, GLWin.ctx)) + if (glXIsDirect(GLWin.dpy, GLWin.ctx)) ERROR_LOG("you have Direct Rendering!"); else ERROR_LOG("no Direct Rendering possible!"); @@ -657,10 +657,10 @@ void OpenGL_Update() break; case KeyPress: key = XLookupKeysym((XKeyEvent*)&event, 0); - if(key >= XK_F1 && key <= XK_F9) + if(key >= XK_F1 && key <= XK_F9) FKeyPressed = key - 0xff4e; else { - if(key == XK_Shift_L || key == XK_Shift_R) + if(key == XK_Shift_L || key == XK_Shift_R) ShiftPressed = true; else if(key == XK_Control_L || key == XK_Control_R) ControlPressed = true; @@ -685,8 +685,8 @@ void OpenGL_Update() rcWindow.bottom = GLWin.height; break; case ClientMessage: //TODO: We aren't reading this correctly, It could be anything, highest chance is that it's a close event though - Video_Shutdown(); // Calling from here since returning false does nothing - return; + Shutdown(); // Calling from here since returning false does nothing + return; break; default: //TODO: Should we put the event back if we don't handle it? @@ -709,7 +709,7 @@ void OpenGL_Update() // ------------------ /* MValueX and MValueY will be used in TextureMngr and VertexShaderManager: Rescale textures on resolution changes - BPStructs.cpp: Control glScissor() + BPStructs.cpp: Control glScissor() */ // ------------------ float FactorW = 640.0f / (float)nBackbufferWidth; @@ -731,7 +731,7 @@ void OpenGL_Update() nXoff = (int)((nBackbufferWidth - (640 * MValueX)) / 2); nYoff = (int)((nBackbufferHeight - (480 * MValueY)) / 2); } - + // tell the debugger gleft = rcWindow.left; gright = rcWindow.right; gtop = rcWindow.top; gbottom = rcWindow.bottom; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLWindow.h b/Source/Plugins/Plugin_VideoOGL/Src/GLWindow.h index c763b77f78..46580d01f1 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLWindow.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLWindow.h @@ -8,9 +8,9 @@ #include "Config.h" #include "pluginspecs_video.h" -#include +#include -#if defined(__APPLE__) +#if defined(__APPLE__) #include #else #include @@ -38,16 +38,17 @@ class GLWindow { protected: - res origRes, currFullRes, currWinRes; + EventHandler* eventHandler; + res origRes, currFullRes, currWinRes; std::vector fullResolutions; std::vector winResolutions; virtual void SetRender(u32 x, u32 y) { xRender = x; yRender = y; } - + public: - + virtual void SwapBuffers() {}; virtual void SetWindowText(const char *text) {}; virtual bool PeekMessages() {return false;}; @@ -55,15 +56,15 @@ public: virtual bool MakeCurrent() {return false;}; virtual void updateDim() { - if (GetProperty(OGL_FULLSCREEN)) + if (GetProperty(OGL_FULLSCREEN)) SetWinSize(currFullRes.x, currFullRes.y); else SetWinSize(currWinRes.x, currWinRes.y); - + float FactorX = 640.0f / (float)GetXwin(); float FactorY = 480.0f / (float)GetYwin(); float Max = (FactorX < FactorY) ? FactorX : FactorY; - + if(GetProperty(OGL_STRETCHTOFIT)) { SetMax(1.0f / FactorX, 1.0f / FactorY); SetOffset(0,0); @@ -74,8 +75,9 @@ public: } } - bool GetProperty(OGL_Props prop) {return properties[prop];} - virtual bool SetProperty(OGL_Props prop, bool value) + void SetEventHandler(EventHandler *eh) { eventHandler = eh;} + bool GetProperty(OGL_Props prop) {return properties[prop];} + virtual bool SetProperty(OGL_Props prop, bool value) {return properties[prop] = value;} u32 GetXrender() {return xRender;} @@ -84,8 +86,8 @@ public: u32 GetXwin() {return xWin;} u32 GetYwin() {return yWin;} void SetWinSize(u32 x, u32 y) { - xWin = x; - yWin = y; + xWin = x; + yWin = y; } int GetYoff() {return yOffset;} @@ -102,16 +104,16 @@ public: float GetXmax() {return xMax;} float GetYmax() {return yMax;} - + static bool valid() { return false;} GLWindow() { - + // Load defaults - sscanf(g_Config.iFSResolution, "%dx%d", + sscanf(g_Config.iFSResolution, "%dx%d", &currFullRes.x, &currFullRes.y); - - sscanf(g_Config.iWindowedRes, "%dx%d", + + sscanf(g_Config.iWindowedRes, "%dx%d", &currWinRes.x, &currWinRes.y); SetProperty(OGL_FULLSCREEN, g_Config.bFullscreen); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/SConscript b/Source/Plugins/Plugin_VideoOGL/Src/SConscript index 009d7ca8e2..6f8c4a4dfa 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/SConscript +++ b/Source/Plugins/Plugin_VideoOGL/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') # can we import path in one place? @@ -47,7 +47,7 @@ else: files += [ 'main.cpp', 'GLUtil.cpp', - ] + ] if gfxenv['HAVE_WX']: files += [ 'GUI/ConfigDlg.cpp', @@ -79,11 +79,11 @@ if sys.platform == 'darwin': Return() else: - if not (conf.CheckPKG('GL') and conf.CheckPKG('GLU')): + if not (conf.CheckPKG('GL') and conf.CheckPKG('GLU')): print name + " must have opengl and glu to be build" Return() - if not conf.CheckPKG('Cg') or not conf.CheckPKG('CgGL'): + if not conf.CheckPKG('Cg') or not conf.CheckPKG('CgGL'): print name + " must have cg and cggl to be build" Return() @@ -101,7 +101,7 @@ conf.Finish() if gfxenv['GLTEST']: if gfxenv['HAVE_XXF86VM']: - files += [ + files += [ 'X11Window.cpp', ] diff --git a/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp b/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp index 3275c148d3..bbe3fd5287 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/X11Window.cpp @@ -1,7 +1,5 @@ #include "X11Window.h" -static EventHandler *eventHandler = (EventHandler *)globals->eventHandler; - X11Window::X11Window() : GLWindow() { XVisualInfo *vi; @@ -175,7 +173,6 @@ bool X11Window::PeekMessages() { // Taken from sfml code void X11Window::ProcessEvent(XEvent WinEvent) { - // static EventHandler *eventHandler = EventHandler::GetInstance(); switch (WinEvent.type) { case KeyPress : diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 443b5cabfb..4cddd5e083 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -69,7 +69,7 @@ void DllDebugger(HWND _hParent, bool Show) { m_frame->DoShow(); } - else if(!m_frame && Show) + else if(!m_frame && Show) { m_frame = new CDebugger(NULL); m_frame->Show(); @@ -91,11 +91,11 @@ void DoDllDebugger() { } #endif -void GetDllInfo (PLUGIN_INFO* _PluginInfo) +void GetDllInfo (PLUGIN_INFO* _PluginInfo) { _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_VIDEO; -#ifdef DEBUGFAST +#ifdef DEBUGFAST sprintf(_PluginInfo->Name, "Dolphin OpenGL (DebugFast)"); #else #ifndef _DEBUG @@ -125,9 +125,9 @@ void DllConfig(HWND _hParent) dmi.dmSize = sizeof(dmi); std::string resos[100]; int i = 0; - + while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0) - { + { char szBuffer[100]; sprintf(szBuffer,"%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight); std::string strBuffer(szBuffer); @@ -157,9 +157,9 @@ void DllConfig(HWND _hParent) g_Config.Load(); frame.ShowModal(); -#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XXF86VM) &&\ +#elif defined(HAVE_X11) && HAVE_X11 && defined(HAVE_XXF86VM) &&\ HAVE_XXF86VM && defined(HAVE_WX) && HAVE_WX - + ConfigDialog frame(NULL); g_Config.Load(); int glxMajorVersion, glxMinorVersion; @@ -176,9 +176,9 @@ void DllConfig(HWND _hParent) bestMode = 0; XF86VidModeGetAllModeLines(GLWin.dpy, GLWin.screen, &modeNum, &modes); int px = 0, py = 0; - if (modeNum > 0 && modes != NULL) + if (modeNum > 0 && modes != NULL) { - for (int i = 0; i < modeNum; i++) + for (int i = 0; i < modeNum; i++) { if(px != modes[i]->hdisplay && py != modes[i]->vdisplay) { @@ -200,11 +200,8 @@ void DllConfig(HWND _hParent) ////////////////////////////////////////////////////////////////////////////////////////// // Initialize video // ŻŻŻŻŻŻŻŻŻŻ -void Video_Initialize(SVideoInitialize* _pVideoInitialize) +void Initialize(void *init) { - // When will this happen? - if (_pVideoInitialize == NULL) return; - // -------------------------------------------------- /* Dolphin currently crashes if the dll is loaded when a game is started so we close the debugger and open it again after loading @@ -214,12 +211,13 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize) if(m_frame) { m_frame->EndModal(0); wxEntryCleanup(); - }//use wxUninitialize() if you don't want GUI + }//use wxUninitialize() if you don't want GUI */ - // -------------------------------------------------- + // -------------------------------------------------- frameCount = 0; - g_VideoInitialize = *_pVideoInitialize; // Create a shortcut to _pVideoInitialize that can also update it + SVideoInitialize *_pVideoInitialize = (SVideoInitialize*)init; + g_VideoInitialize = *(_pVideoInitialize); // Create a shortcut to _pVideoInitialize that can also update it InitLUTs(); InitXFBConvTables(); g_Config.Load(); @@ -238,7 +236,7 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize) Renderer::AddMessage("Dolphin OpenGL Video Plugin" ,5000); } -void Video_DoState(unsigned char **ptr, int mode) { +void DoState(unsigned char **ptr, int mode) { //#ifdef _WIN32 // What is this code doing here? // if (!wglMakeCurrent(hDC,hRC)) { @@ -249,7 +247,7 @@ void Video_DoState(unsigned char **ptr, int mode) { // cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin); //#elif defined(HAVE_X11) && HAVE_X11 // glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx); -//#endif +//#endif #ifndef _WIN32 // WHY is this here?? OpenGL_MakeCurrent(); @@ -293,7 +291,7 @@ void Video_Prepare(void) TextureConverter::Init(); } -void Video_Shutdown(void) +void Shutdown(void) { TextureConverter::Shutdown(); VertexLoaderManager::Shutdown(); @@ -309,7 +307,7 @@ void Video_Shutdown(void) OpenGL_Shutdown(); } -void Video_Stop(void) +void Video_Stop(void) { Fifo_Stop(); } @@ -334,7 +332,7 @@ void DebugLog(const char* _fmt, ...) #endif } -bool ScreenShot(TCHAR *File) +bool ScreenShot(TCHAR *File) { char str[64]; int left = 200, top = 15; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/nGLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/nGLUtil.cpp index b78388f4d1..7d526e9035 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/nGLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/nGLUtil.cpp @@ -67,6 +67,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, if (! glWin) return false; + glWin->SetEventHandler((EventHandler *)globals->eventHandler); return true; } diff --git a/Source/Plugins/Plugin_Wiimote/Src/main.cpp b/Source/Plugins/Plugin_Wiimote/Src/main.cpp index 4662bac0d9..5bc22a5681 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/main.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/main.cpp @@ -57,7 +57,7 @@ class wxDLLApp : public wxApp return true; } }; -IMPLEMENT_APP_NO_MAIN(wxDLLApp) +IMPLEMENT_APP_NO_MAIN(wxDLLApp) WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); #endif @@ -83,10 +83,10 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle if ( !wxTheApp || !wxTheApp->CallOnInit() ) return FALSE; } - break; + break; case DLL_PROCESS_DETACH: - wxEntryCleanup(); //use wxUninitialize() if you don't want GUI + wxEntryCleanup(); //use wxUninitialize() if you don't want GUI break; default: break; @@ -102,11 +102,11 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle //****************************************************************************** // Exports //****************************************************************************** -extern "C" void GetDllInfo (PLUGIN_INFO* _PluginInfo) +extern "C" void GetDllInfo (PLUGIN_INFO* _PluginInfo) { _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_WIIMOTE; -#ifdef DEBUGFAST +#ifdef DEBUGFAST sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (DebugFast)"); #else #ifndef _DEBUG @@ -138,8 +138,9 @@ void DllConfig(HWND _hParent) #endif } -extern "C" bool Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize) +extern "C" void Initialize(void *init) { + SWiimoteInitialize _WiimoteInitialize = *(SWiimoteInitialize *)init; // ---------------------------------------- // Debugging window // ---------- @@ -153,11 +154,12 @@ extern "C" bool Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize) g_WiimoteInitialize = _WiimoteInitialize; - /* We will run WiiMoteReal::Initialize() even if we are not using a real wiimote, - we will initiate wiiuse.dll, but we will return before creating a new thread - for it if we find no real Wiimotes. Then g_UseRealWiiMote will also be false - This function call will be done instantly if there is no real Wiimote connected. - I'm not sure how long time it takes if a Wiimote is connected. */ + /* We will run WiiMoteReal::Initialize() even if we are not using a + real wiimote, we will initiate wiiuse.dll, but we will return before + creating a new thread for it if we find no real Wiimotes. Then + g_UseRealWiiMote will also be false This function call will be done + instantly if there is no real Wiimote connected. I'm not sure how + long time it takes if a Wiimote is connected. */ #if HAVE_WIIUSE g_UseRealWiiMote = WiiMoteReal::Initialize() > 0; #endif @@ -165,11 +167,10 @@ extern "C" bool Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize) WiiMoteEmu::Initialize(); - return g_UseRealWiiMote; } -extern "C" void Wiimote_DoState(void* ptr, int mode) +extern "C" void DoState(unsigned char **ptr, int mode) { #if HAVE_WIIUSE WiiMoteReal::DoState(ptr, mode); @@ -177,7 +178,7 @@ extern "C" void Wiimote_DoState(void* ptr, int mode) WiiMoteEmu::DoState(ptr, mode); } -extern "C" void Wiimote_Shutdown(void) +extern "C" void Shutdown(void) { #if HAVE_WIIUSE WiiMoteReal::Shutdown(); @@ -189,8 +190,8 @@ extern "C" void Wiimote_Shutdown(void) /* This function produce Wiimote Input (reports from the Wiimote) in response to Output from the Wii. It's called from WII_IPC_HLE_WiiMote.cpp. */ // ---------------- -extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size) -{ +extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 _Size) +{ LOGV(WII_IPC_WIIMOTE, 3, "============================================================="); const u8* data = (const u8*)_pData; @@ -213,7 +214,7 @@ extern "C" void Wiimote_InterruptChannel(u16 _channelID, const void* _pData, u32 LOGV(WII_IPC_WIIMOTE, 3, "============================================================="); } -extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size) +extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _Size) { LOGV(WII_IPC_WIIMOTE, 3, "============================================================="); const u8* data = (const u8*)_pData; @@ -241,7 +242,7 @@ extern "C" void Wiimote_ControlChannel(u16 _channelID, const void* _pData, u32 _ /* This sends a Data Report from the Wiimote. See SystemTimers.cpp for the documentation of this update. */ // ---------------- -extern "C" void Wiimote_Update() +extern "C" void Wiimote_Update() { if (! g_UseRealWiiMote) WiiMoteEmu::Update(); @@ -251,7 +252,7 @@ extern "C" void Wiimote_Update() #endif } -extern "C" unsigned int Wiimote_GetAttachedControllers() +extern "C" unsigned int Wiimote_GetAttachedControllers() { return 1; } @@ -270,7 +271,7 @@ void __Log(int log, const char *_fmt, ...) vsprintf( Msg, _fmt, ap ); va_end( ap ); - g_WiimoteInitialize.pLog(Msg, 0); + g_WiimoteInitialize.pLog(Msg, 0); } @@ -283,6 +284,6 @@ void __Logv(int log, int v, const char *_fmt, ...) vsprintf( Msg, _fmt, ap ); va_end( ap ); - g_WiimoteInitialize.pLog(Msg, v); + g_WiimoteInitialize.pLog(Msg, v); } // ================ diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp index ac4e656471..72a7aeea82 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/GUI/ConfigBox.cpp @@ -1,7 +1,7 @@ ////////////////////////////////////////////////////////////////////////////////////////// // Project description // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -// Name: nJoy +// Name: nJoy // Description: A Dolphin Compatible Input Plugin // // Author: Falcon4ever (nJoy@falcon4ever.com) @@ -69,8 +69,8 @@ BEGIN_EVENT_TABLE(ConfigBox,wxDialog) EVT_CHECKBOX(IDC_SAVEBYID, ConfigBox::ChangeSettings) // Settings EVT_CHECKBOX(IDC_SAVEBYIDNOTICE, ConfigBox::ChangeSettings) EVT_CHECKBOX(IDC_SHOWADVANCED, ConfigBox::ChangeSettings) - EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, ConfigBox::ChangeSettings) - EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, ConfigBox::ChangeSettings) + EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, ConfigBox::ChangeSettings) + EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, ConfigBox::ChangeSettings) EVT_BUTTON(IDB_SHOULDER_L, ConfigBox::GetButtons) EVT_BUTTON(IDB_SHOULDER_R, ConfigBox::GetButtons) @@ -142,7 +142,7 @@ void ConfigBox::OnKeyDown(wxKeyEvent& event) void ConfigBox::OnClose(wxCloseEvent& /*event*/) { EndModal(0); - if(!emulator_running) PAD_Shutdown(); // Close pads, unless we are running a game + if(!emulator_running) Shutdown(); // Close pads, unless we are running a game } // Call about dialog @@ -158,11 +158,11 @@ void ConfigBox::AboutClick(wxCommandEvent& event) frame.ShowModal(); win.Enable(true); - win.SetHWND(0); + win.SetHWND(0); #else AboutBox frame(NULL); frame.ShowModal(); - #endif + #endif } // Click OK @@ -211,7 +211,7 @@ void ConfigBox::ChangeSettings( wxCommandEvent& event ) g_Config.bSaveByIDNotice = m_CBSaveByIDNotice[notebookpage]->IsChecked(); break; - case IDC_SHOWADVANCED: + case IDC_SHOWADVANCED: g_Config.bShowAdvanced = m_CBShowAdvanced[notebookpage]->IsChecked(); for(int i = 0; i < 4; i++) { @@ -236,7 +236,7 @@ void ConfigBox::EnableDisable(wxCommandEvent& event) { // First save the settings as they are now, disabled controls will not be saved later g_Config.Save(); - + // Update the enable / disable status DoEnableDisable(notebookpage); @@ -276,7 +276,7 @@ void ConfigBox::DoEnableDisable(int _notebookpage) // Notebook page changed // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void ConfigBox::NotebookPageChanged(wxNotebookEvent& event) -{ +{ notebookpage = event.GetSelection(); } @@ -335,7 +335,7 @@ void ConfigBox::CreateGUIControls() #else SetTitle(wxT("Configure: nJoy v"INPUT_VERSION" (Debug) Input Plugin")); #endif - + SetIcon(wxNullIcon); //WxStaticBitmap1_BITMAP(ConfigBox_WxStaticBitmap1_XPM); @@ -360,7 +360,7 @@ void ConfigBox::CreateGUIControls() // Notebook m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize); - + // Controller pages m_Controller[0] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1, wxDefaultPosition, wxDefaultSize); m_Notebook->AddPage(m_Controller[0], wxT("Controller 1")); @@ -381,7 +381,7 @@ void ConfigBox::CreateGUIControls() WxStaticBitmap1_BITMAPGray = wxBitmap(WxImageGray); // -------------------------------------------------------------------- - // Search for devices and add them to the device list + // Search for devices and add them to the device list // ----------------------------- wxArrayString arrayStringFor_Joyname; // The string array if(SDL_NumJoysticks() > 0) @@ -405,7 +405,7 @@ void ConfigBox::CreateGUIControls() // arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_JOYSTICK_XBOX360])); // arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_KEYBOARD])); - + // -------------------------------------------------------------------- // Populate the deadzone list // ----------------------------- @@ -420,7 +420,7 @@ void ConfigBox::CreateGUIControls() // Populate all four pages for(int i=0; i<4 ;i++) - { + { // -------------------------------------------------------------------- // Populate keys sizer // ----------------------------- @@ -614,7 +614,7 @@ void ConfigBox::CreateGUIControls() m_sSettings[i] = new wxBoxSizer ( wxHORIZONTAL ); m_sSettings[i]->Add(m_gExtrasettings[i], 0, wxEXPAND | wxALL, 0); m_sSettings[i]->Add(m_gControllertype[i], 0, wxEXPAND | wxLEFT, 5); - m_sSettings[i]->Add(m_gGenSettings[i], 0, wxEXPAND | wxLEFT, 5); + m_sSettings[i]->Add(m_gGenSettings[i], 0, wxEXPAND | wxLEFT, 5); ////////////////////////////////////// @@ -714,7 +714,7 @@ void ConfigBox::CreateGUIControls() DoEnableDisable(i); } // end of loop - + // -------------------------------------------------------------------- // Populate buttons sizer. // ----------------------------- @@ -736,8 +736,8 @@ void ConfigBox::CreateGUIControls() // -------------------------------------------------------------------- // Debugging // ----------------------------- - //m_pStatusBar = new wxStaticText(this, IDT_DEBUGGING, wxT("Debugging"), wxPoint(100, 510), wxDefaultSize); - //m_pStatusBar2 = new wxStaticText(this, IDT_DEBUGGING2, wxT("Debugging2"), wxPoint(100, 530), wxDefaultSize); + //m_pStatusBar = new wxStaticText(this, IDT_DEBUGGING, wxT("Debugging"), wxPoint(100, 510), wxDefaultSize); + //m_pStatusBar2 = new wxStaticText(this, IDT_DEBUGGING2, wxT("Debugging2"), wxPoint(100, 530), wxDefaultSize); //m_pStatusBar->SetLabel(wxString::Format("Debugging text")); // -------------------------------------------------------------------- diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript b/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript index 8e9806d0d3..e5e96b3d71 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') import sys diff --git a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp index 6b9b0ba63f..b5f5847e47 100644 --- a/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_SDL/Src/nJoy.cpp @@ -1,7 +1,7 @@ ////////////////////////////////////////////////////////////////////////////////////////// // Project description // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -// Name: nJoy +// Name: nJoy // Description: A Dolphin Compatible Input Plugin // // Author: Falcon4ever (nJoy@falcon4ever.com) @@ -29,7 +29,7 @@ // ////////////////////////////////////////////////////////////////////////////////////////// - + //////////////////////////////////////////////////////////////////////////////////////// // Issues @@ -41,7 +41,7 @@ ////////////////////////*/ - + //////////////////////////////////////////////////////////////////////////////////////// // Variables guide @@ -58,7 +58,7 @@ ////////////////////////*/ - + ////////////////////////////////////////////////////////////////////////////////////////// // Include @@ -71,7 +71,7 @@ #endif ///////////////////////// - + ////////////////////////////////////////////////////////////////////////////////////////// // Variables // ŻŻŻŻŻŻŻŻŻ @@ -97,7 +97,7 @@ void __Logv(int log, int v, const char *format, ...) {} extern int fd; #endif - + ////////////////////////////////////////////////////////////////////////////////////////// // wxWidgets // ŻŻŻŻŻŻŻŻŻ @@ -110,19 +110,19 @@ void __Logv(int log, int v, const char *format, ...) {} } }; - IMPLEMENT_APP_NO_MAIN(wxDLLApp) + IMPLEMENT_APP_NO_MAIN(wxDLLApp) WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); #endif - + ////////////////////////////////////////////////////////////////////////////////////////// -// DllMain +// DllMain // ŻŻŻŻŻŻŻ #ifdef _WIN32 BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle DWORD dwReason, // reason called LPVOID lpvReserved) // reserved -{ +{ switch (dwReason) { case DLL_PROCESS_ATTACH: @@ -136,17 +136,17 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle if (!wxTheApp || !wxTheApp->CallOnInit() ) return FALSE; } - break; + break; case DLL_PROCESS_DETACH: - wxEntryCleanup(); //use wxUninitialize() if you don't want GUI + wxEntryCleanup(); //use wxUninitialize() if you don't want GUI break; default: break; } - - nJoy_hInst = hinstDLL; + + nJoy_hInst = hinstDLL; return TRUE; } #endif @@ -162,7 +162,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo) _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_PAD; -#ifdef DEBUGFAST +#ifdef DEBUGFAST sprintf(_PluginInfo->Name, "nJoy v"INPUT_VERSION" (DebugFast) by Falcon4ever"); #else #ifndef _DEBUG @@ -179,7 +179,7 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) { // Call config dialog // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void DllConfig(HWND _hParent) -{ +{ #ifdef _WIN32 if (SDL_Init(SDL_INIT_JOYSTICK ) < 0) { @@ -193,7 +193,7 @@ void DllConfig(HWND _hParent) SPADInitialize _PADInitialize; _PADInitialize.hWnd = NULL; _PADInitialize.pLog = NULL; - PAD_Initialize(_PADInitialize); + Initialize((void*)&_PADInitialize); emulator_running = FALSE; // Set it back to false } @@ -206,7 +206,7 @@ void DllConfig(HWND _hParent) //win.SetHWND(0); m_frame = new ConfigBox(NULL); - m_frame->ShowModal(); + m_frame->ShowModal(); #else if (SDL_Init(SDL_INIT_JOYSTICK ) < 0) @@ -222,34 +222,35 @@ void DllConfig(HWND _hParent) frame.ShowModal(); #endif - #endif + #endif } void DllDebugger(HWND _hParent, bool Show) { } - + // Init PAD (start emulation) // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void PAD_Initialize(SPADInitialize _PADInitialize) -{ +void Initialize(void *init) +{ + SPADInitialize _PADInitialize = *(SPADInitialize*)init; emulator_running = TRUE; #ifdef _DEBUG DEBUG_INIT(); #endif - + if (SDL_Init(SDL_INIT_JOYSTICK) < 0) { #ifdef _WIN32 MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR); - #else - printf("Could not initialize SDL! (%s)\n", SDL_GetError()); + #else + printf("Could not initialize SDL! (%s)\n", SDL_GetError()); #endif return; } - + #ifdef _WIN32 - m_hWnd = (HWND)_PADInitialize.hWnd; + m_hWnd = (HWND)_PADInitialize.hWnd; #endif Search_Devices(); // Populate joyinfo for all attached devices @@ -264,7 +265,7 @@ void PAD_Initialize(SPADInitialize _PADInitialize) joystate[3].joy = SDL_JoystickOpen(joysticks[3].ID); } - + // Search attached devices. Populate joyinfo for all attached physical devices. // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ int Search_Devices() @@ -291,8 +292,8 @@ int Search_Devices() { #ifdef _WIN32 //MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING); - #else - printf("No Joystick detected!\n"); + #else + printf("No Joystick detected!\n"); #endif return 0; } @@ -301,7 +302,7 @@ int Search_Devices() fprintf(pFile, "Scanning for devices\n"); fprintf(pFile, "ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\n"); #endif - + for(int i = 0; i < numjoy; i++ ) { // Open the device to be able to read the values @@ -312,7 +313,7 @@ int Search_Devices() joyinfo[i].NumBalls = SDL_JoystickNumBalls(joyinfo[i].joy); joyinfo[i].NumHats = SDL_JoystickNumHats(joyinfo[i].joy); joyinfo[i].Name = SDL_JoystickName(i); - + #ifdef _DEBUG fprintf(pFile, "ID: %d\n", i); fprintf(pFile, "Name: %s\n", joyinfo[i].Name); @@ -320,7 +321,7 @@ int Search_Devices() fprintf(pFile, "Axes: %d\n", joyinfo[i].NumAxes); fprintf(pFile, "Hats: %d\n", joyinfo[i].NumHats); fprintf(pFile, "Balls: %d\n\n", joyinfo[i].NumBalls); - #endif + #endif // We have now read the values we need so we close the device if (SDL_JoystickOpened(i)) SDL_JoystickClose(joyinfo[i].joy); @@ -329,10 +330,10 @@ int Search_Devices() return numjoy; } - + // Shutdown PAD (stop emulation) // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void PAD_Shutdown() +void Shutdown() { if (joysticks[0].enabled) SDL_JoystickClose(joystate[0].joy); @@ -344,15 +345,15 @@ void PAD_Shutdown() SDL_JoystickClose(joystate[3].joy); SDL_Quit(); - + #ifdef _DEBUG DEBUG_QUIT(); #endif - delete [] joyinfo; + delete [] joyinfo; emulator_running = FALSE; - + #ifdef _WIN32 #ifdef USE_RUMBLE_DINPUT_HACK FreeDirectInput(); @@ -362,6 +363,7 @@ void PAD_Shutdown() #endif } + // Set buttons status from wxWidgets in the main application // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ @@ -378,6 +380,8 @@ void PAD_Input(u8 _Key, u8 _UpDown) } } +void DoState(unsigned char **ptr, int mode) { +} // Set PAD status. This is called from SerialInterface_Devices.cpp // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ @@ -385,14 +389,14 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) { if (!joysticks[_numPAD].enabled) return; - + // Clear pad status memset(_pPADStatus, 0, sizeof(SPADStatus)); // Get pad status GetJoyState(_numPAD); - + /////////////////////////////////////////////////// // Set analog controllers // ----------- @@ -427,7 +431,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) if ((sub_stick_x < deadzone2) || (sub_stick_x > deadzone)) _pPADStatus->substickX = sub_stick_x; if ((sub_stick_y < deadzone2) || (sub_stick_y > deadzone)) _pPADStatus->substickY = sub_stick_y; - + /////////////////////////////////////////////////// // Set buttons // ----------- @@ -444,7 +448,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) _pPADStatus->button|=PAD_TRIGGER_L; _pPADStatus->triggerLeft = triggervalue; } - if (joystate[_numPAD].buttons[CTL_R_SHOULDER]) + if (joystate[_numPAD].buttons[CTL_R_SHOULDER]) { _pPADStatus->button|=PAD_TRIGGER_R; _pPADStatus->triggerRight = triggervalue; @@ -484,7 +488,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) if (joystate[_numPAD].dpad2[CTL_D_PAD_RIGHT]) _pPADStatus->button |= PAD_BUTTON_RIGHT; } - + // _pPADStatus->err = PAD_ERR_NONE; @@ -492,7 +496,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) Pad_Use_Rumble(_numPAD, _pPADStatus); } - + ////////////////////////////////////////////////////////////////////////////////////////// // Convert stick values, for example from circle to square analog stick radius // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ @@ -500,7 +504,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) /* Convert stick values. The value returned by SDL_JoystickGetAxis is a signed integer s16 - (-32768 to 32767). The value used for the gamecube controller is an unsigned + (-32768 to 32767). The value used for the gamecube controller is an unsigned char u8 (0 to 255) with neutral at 0x80 (128), so that it's equivalent to a signed -128 to 127. */ // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ @@ -520,7 +524,7 @@ u8 Pad_Convert(int _val) return val; } - + /* Convert the stick raidus from a circular to a square. I don't know what input values the actual GC controller produce for the GC, it may be a square, a circle or something in between. But one thing that is certain is that PC pads differ in their output (as @@ -600,13 +604,13 @@ std::vector Pad_Square_to_Circle(int _x, int _y) } ////////////////////////////////////////////////////////////////////////////////////////// - + // Set PAD attached pads // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ unsigned int PAD_GetAttachedPads() { unsigned int connected = 0; - + g_Config.Load(); if (joysticks[0].enabled) connected |= 1; @@ -617,7 +621,7 @@ unsigned int PAD_GetAttachedPads() return connected; } - + ////////////////////////////////////////////////////////////////////////////////////////// // Read current joystick status @@ -646,7 +650,7 @@ void GetJoyState(int controller) joystate[controller].axis[CTL_MAIN_Y] = SDL_JoystickGetAxis(joystate[controller].joy, joysticks[controller].axis[CTL_MAIN_Y]); joystate[controller].axis[CTL_SUB_X] = SDL_JoystickGetAxis(joystate[controller].joy, joysticks[controller].axis[CTL_SUB_X]); joystate[controller].axis[CTL_SUB_Y] = SDL_JoystickGetAxis(joystate[controller].joy, joysticks[controller].axis[CTL_SUB_Y]); - + ReadButton(controller, CTL_L_SHOULDER); ReadButton(controller, CTL_R_SHOULDER); ReadButton(controller, CTL_A_BUTTON); @@ -655,7 +659,7 @@ void GetJoyState(int controller) ReadButton(controller, CTL_Y_BUTTON); ReadButton(controller, CTL_Z_TRIGGER); ReadButton(controller, CTL_START); - + // if (joysticks[controller].halfpress < joyinfo[controller].NumButtons) joystate[controller].halfpress = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].halfpress); diff --git a/Source/Plugins/Plugin_nJoy_Testing/Src/SConscript b/Source/Plugins/Plugin_nJoy_Testing/Src/SConscript index 00c940c08e..cf15c92e53 100644 --- a/Source/Plugins/Plugin_nJoy_Testing/Src/SConscript +++ b/Source/Plugins/Plugin_nJoy_Testing/Src/SConscript @@ -1,4 +1,4 @@ -# -*- python -*- +# -*- python -*- Import('env') import sys @@ -12,7 +12,7 @@ if not env['HAVE_SDL']: files = [ 'nJoy.cpp', ] - + if env['HAVE_WX']: files +=[ 'GUI/AboutBox.cpp', 'GUI/ConfigBox.cpp', diff --git a/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.cpp b/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.cpp index 397a111e71..96bdcfb30f 100644 --- a/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.cpp +++ b/Source/Plugins/Plugin_nJoy_Testing/Src/nJoy.cpp @@ -1,7 +1,7 @@ ////////////////////////////////////////////////////////////////////////////////////////// // Project description // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -// Name: nJoy +// Name: nJoy // Description: A Dolphin Compatible Input Plugin // // Author: Falcon4ever (nJoy@falcon4ever.com) @@ -92,18 +92,18 @@ class wxDLLApp : public wxApp } }; -IMPLEMENT_APP_NO_MAIN(wxDLLApp) +IMPLEMENT_APP_NO_MAIN(wxDLLApp) WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); #endif ////////////////////////////////////////////////////////////////////////////////////////// -// DllMain +// DllMain // ŻŻŻŻŻŻŻ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle DWORD dwReason, // reason called LPVOID lpvReserved) // reserved -{ +{ switch (dwReason) { case DLL_PROCESS_ATTACH: @@ -119,19 +119,19 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle return FALSE; #endif } - break; + break; case DLL_PROCESS_DETACH: #if defined(HAVE_WX) && HAVE_WX - wxEntryCleanup(); //use wxUninitialize() if you don't want GUI + wxEntryCleanup(); //use wxUninitialize() if you don't want GUI #endif break; default: break; } - - nJoy_hInst = hinstDLL; + + nJoy_hInst = hinstDLL; return TRUE; } #endif @@ -147,7 +147,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo) _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_PAD; -#ifdef DEBUGFAST +#ifdef DEBUGFAST sprintf(_PluginInfo->Name, "nJoy v"INPUT_VERSION" (DebugFast) by Falcon4ever"); #else #ifndef _DEBUG @@ -194,7 +194,7 @@ void DllConfig(HWND _hParent) ConfigBox frame(NULL); frame.ShowModal(); #endif - #endif + #endif } void DllDebugger(HWND _hParent, bool Show) { @@ -202,29 +202,30 @@ void DllDebugger(HWND _hParent, bool Show) { // Init PAD (start emulation) // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void PAD_Initialize(SPADInitialize _PADInitialize) -{ +void Initialize(void *init) +{ + SPADInitialize _PADInitialize = *(SPADInitialize*)init; emulator_running = TRUE; #ifdef _DEBUG DEBUG_INIT(); #endif - + if(SDL_Init(SDL_INIT_JOYSTICK ) < 0) { #ifdef _WIN32 MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR); - #else - printf("Could not initialize SDL! (%s)\n", SDL_GetError()); + #else + printf("Could not initialize SDL! (%s)\n", SDL_GetError()); #endif return; } - + #ifdef _WIN32 - m_hWnd = (HWND)_PADInitialize.hWnd; + m_hWnd = (HWND)_PADInitialize.hWnd; #endif LoadConfig(); // Load joystick mapping - + if(joysticks[0].enabled) joystate[0].joy = SDL_JoystickOpen(joysticks[0].ID); if(joysticks[1].enabled) @@ -237,7 +238,7 @@ void PAD_Initialize(SPADInitialize _PADInitialize) // Shutdown PAD (stop emulation) // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ -void PAD_Shutdown() +void Shutdown() { if(joysticks[0].enabled) SDL_JoystickClose(joystate[0].joy); @@ -249,15 +250,15 @@ void PAD_Shutdown() SDL_JoystickClose(joystate[3].joy); SDL_Quit(); - + #ifdef _DEBUG DEBUG_QUIT(); #endif - delete [] joyinfo; + delete [] joyinfo; emulator_running = FALSE; - + #ifdef _WIN32 #ifdef USE_RUMBLE_DINPUT_HACK FreeDirectInput(); @@ -267,13 +268,14 @@ void PAD_Shutdown() #endif } - +void DoState(unsigned char **ptr, int mode) { +} // Set buttons status from wxWidgets in the main application // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ void PAD_Input(u8 _Key, u8 _UpDown) {} - + // Set PAD status // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻ @@ -281,13 +283,13 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) { if(!joysticks[_numPAD].enabled) return; - + // clear pad status memset(_pPADStatus, 0, sizeof(SPADStatus)); // get pad status GetJoyState(_numPAD); - + // Reset! int base = 0x80; _pPADStatus->stickY = base; @@ -326,8 +328,8 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) { //Do a panicAlert here? } - + // Quick fix if(main_stick_x > 127) main_stick_x = 127; @@ -398,7 +400,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) if(Pressed == true) { int TriggerValue = 0; - + if(joysticks[_numPAD].buttons[a].c_str()[1] == '+') { if(joystate[_numPAD].buttons[a] >= 0) @@ -416,7 +418,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) _pPADStatus->button |= ButtonArray[a]; _pPADStatus->triggerLeft = TriggerValue; } - else if(a == CTL_R_SHOULDER) + else if(a == CTL_R_SHOULDER) { if(TriggerValue == 255) _pPADStatus->button |= ButtonArray[a]; @@ -445,7 +447,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) // Digital L and R if(a == CTL_L_SHOULDER) _pPADStatus->triggerLeft = 255; //TODO: Do half press with these - else if(a == CTL_R_SHOULDER) + else if(a == CTL_R_SHOULDER) _pPADStatus->triggerRight = 255; //TODO: Half Press with these else if(a == CTL_A_BUTTON) _pPADStatus->analogA = 255; @@ -464,7 +466,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) _pPADStatus->button|=PAD_TRIGGER_L; _pPADStatus->triggerLeft = triggervalue; } - if (joystate[_numPAD].buttons[CTL_R_SHOULDER]) + if (joystate[_numPAD].buttons[CTL_R_SHOULDER]) { _pPADStatus->button|=PAD_TRIGGER_R; _pPADStatus->triggerRight = triggervalue; @@ -497,10 +499,10 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) else { } - + _pPADStatus->err = PAD_ERR_NONE; - + #ifdef _WIN32 #ifdef USE_RUMBLE_DINPUT_HACK if(joystate[_numPAD].halfpress) @@ -517,7 +519,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus) if (g_rumbleEnable) { g_pDevice->Acquire(); - + if(g_pEffect) g_pEffect->Start(1, 0); } @@ -625,7 +627,7 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength) unsigned int PAD_GetAttachedPads() { unsigned int connected = 0; - + LoadConfig(); if(joysticks[0].enabled) @@ -640,7 +642,7 @@ unsigned int PAD_GetAttachedPads() return connected; } - + ////////////////////////////////////////////////////////////////////////////////////////// // Custom Functions // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ @@ -698,8 +700,8 @@ int Search_Devices() { #ifdef _WIN32 MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING); - #else - printf("No Joystick detected!\n"); + #else + printf("No Joystick detected!\n"); #endif return 0; } @@ -712,7 +714,7 @@ int Search_Devices() fprintf(pFile, "Scanning for devices\n"); fprintf(pFile, "ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ\n"); #endif - + for(int i = 0; i < numjoy; i++ ) { joyinfo[i].joy = SDL_JoystickOpen(i); @@ -722,7 +724,7 @@ int Search_Devices() joyinfo[i].NumBalls = SDL_JoystickNumBalls(joyinfo[i].joy); joyinfo[i].NumHats = SDL_JoystickNumHats(joyinfo[i].joy); joyinfo[i].Name = SDL_JoystickName(i); - + printf("ID: %d\n", i); printf("Name: %s\n", joyinfo[i].Name); printf("Buttons: %d\n", joyinfo[i].NumButtons); @@ -746,9 +748,9 @@ void DEBUG_INIT() return; #ifdef _WIN32 - char dateStr [9]; + char dateStr [9]; _strdate( dateStr); - char timeStr [9]; + char timeStr [9]; _strtime( timeStr ); #endif @@ -768,7 +770,7 @@ void DEBUG_QUIT() return; #ifdef _WIN32 - char timeStr [9]; + char timeStr [9]; _strtime(timeStr); fprintf(pFile, "_______________\n"); @@ -797,7 +799,7 @@ void SaveConfig() file.Set(SectionName, "y_button", joysticks[i].buttons[CTL_Y_BUTTON]); file.Set(SectionName, "z_trigger", joysticks[i].buttons[CTL_Z_TRIGGER]); file.Set(SectionName, "start_button", joysticks[i].buttons[CTL_START]); - file.Set(SectionName, "dpad", joysticks[i].dpad); + file.Set(SectionName, "dpad", joysticks[i].dpad); file.Set(SectionName, "dpad_up", joysticks[i].buttons[CTL_D_PAD_UP]); file.Set(SectionName, "dpad_down", joysticks[i].buttons[CTL_D_PAD_DOWN]); file.Set(SectionName, "dpad_left", joysticks[i].buttons[CTL_D_PAD_LEFT]); @@ -840,23 +842,23 @@ void LoadConfig() file.Get(SectionName, "l_shoulder", &joysticks[i].buttons[CTL_L_SHOULDER], "B4"); file.Get(SectionName, "r_shoulder", &joysticks[i].buttons[CTL_R_SHOULDER], "B5"); file.Get(SectionName, "a_button", &joysticks[i].buttons[CTL_A_BUTTON], "B0"); - file.Get(SectionName, "b_button", &joysticks[i].buttons[CTL_B_BUTTON], "B1"); + file.Get(SectionName, "b_button", &joysticks[i].buttons[CTL_B_BUTTON], "B1"); file.Get(SectionName, "x_button", &joysticks[i].buttons[CTL_X_BUTTON], "B3"); - file.Get(SectionName, "y_button", &joysticks[i].buttons[CTL_Y_BUTTON], "B2"); + file.Get(SectionName, "y_button", &joysticks[i].buttons[CTL_Y_BUTTON], "B2"); file.Get(SectionName, "z_trigger", &joysticks[i].buttons[CTL_Z_TRIGGER], "B7"); - file.Get(SectionName, "start_button", &joysticks[i].buttons[CTL_START], "B9"); - file.Get(SectionName, "dpad", &joysticks[i].dpad, 0); + file.Get(SectionName, "start_button", &joysticks[i].buttons[CTL_START], "B9"); + file.Get(SectionName, "dpad", &joysticks[i].dpad, 0); file.Get(SectionName, "dpad_up", &joysticks[i].buttons[CTL_D_PAD_UP], 0); file.Get(SectionName, "dpad_down", &joysticks[i].buttons[CTL_D_PAD_DOWN], 0); file.Get(SectionName, "dpad_left", &joysticks[i].buttons[CTL_D_PAD_LEFT], 0); file.Get(SectionName, "dpad_right", &joysticks[i].buttons[CTL_D_PAD_RIGHT], 0); - file.Get(SectionName, "main_x", &joysticks[i].buttons[CTL_MAIN_X], "A0"); - file.Get(SectionName, "main_y", &joysticks[i].buttons[CTL_MAIN_Y], "A1"); - file.Get(SectionName, "sub_x", &joysticks[i].buttons[CTL_SUB_X], "A2"); - file.Get(SectionName, "sub_y", &joysticks[i].buttons[CTL_SUB_Y], "A3"); - file.Get(SectionName, "enabled", &joysticks[i].enabled, 1); - file.Get(SectionName, "deadzone", &joysticks[i].deadzone, 9); - file.Get(SectionName, "halfpress", &joysticks[i].halfpress, 6); + file.Get(SectionName, "main_x", &joysticks[i].buttons[CTL_MAIN_X], "A0"); + file.Get(SectionName, "main_y", &joysticks[i].buttons[CTL_MAIN_Y], "A1"); + file.Get(SectionName, "sub_x", &joysticks[i].buttons[CTL_SUB_X], "A2"); + file.Get(SectionName, "sub_y", &joysticks[i].buttons[CTL_SUB_Y], "A3"); + file.Get(SectionName, "enabled", &joysticks[i].enabled, 1); + file.Get(SectionName, "deadzone", &joysticks[i].deadzone, 9); + file.Get(SectionName, "halfpress", &joysticks[i].halfpress, 6); file.Get(SectionName, "joy_id", &joysticks[i].ID, 0); file.Get(SectionName, "controllertype", &joysticks[i].controllertype, 0); file.Get(SectionName, "eventnum", &joysticks[i].eventnum, 0); @@ -875,7 +877,7 @@ void LoadConfig() } } - + #ifdef _WIN32 ////////////////////////////////////////////////////////////////////////////////////////// // Rumble stuff :D! @@ -903,7 +905,7 @@ HRESULT InitDirectInput( HWND hDlg ) { MessageBox(NULL, "Force feedback device not found. nJoy will now disable rumble." ,"FFConst" , MB_ICONERROR | MB_OK); g_rumbleEnable = FALSE; - + return S_OK; } @@ -923,7 +925,7 @@ HRESULT InitDirectInput( HWND hDlg ) // Exclusive access is required in order to perform force feedback. //if(FAILED(hr = g_pDevice->SetCooperativeLevel(hDlg, DISCL_EXCLUSIVE | DISCL_FOREGROUND))) - if(FAILED(hr = g_pDevice->SetCooperativeLevel(hDlg, DISCL_EXCLUSIVE | DISCL_FOREGROUND))) + if(FAILED(hr = g_pDevice->SetCooperativeLevel(hDlg, DISCL_EXCLUSIVE | DISCL_FOREGROUND))) { return hr; } @@ -939,7 +941,7 @@ HRESULT InitDirectInput( HWND hDlg ) if(FAILED(hr = g_pDevice->SetProperty(DIPROP_AUTOCENTER, &dipdw.diph))) return hr; - // Enumerate and count the axes of the joystick + // Enumerate and count the axes of the joystick if(FAILED(hr = g_pDevice->EnumObjects(EnumAxesCallback, (VOID*)&g_dwNumForceFeedbackAxis, DIDFT_AXIS))) return hr; @@ -983,7 +985,7 @@ HRESULT InitDirectInput( HWND hDlg ) VOID FreeDirectInput() { - // Unacquire the device one last time just in case + // Unacquire the device one last time just in case // the app tried to exit while the device is still acquired. if(g_pDevice) g_pDevice->Unacquire(); @@ -1037,7 +1039,7 @@ HRESULT SetDeviceForcesXY() } else { - // If two force feedback axis, then apply magnitude from both directions + // If two force feedback axis, then apply magnitude from both directions rglDirection[0] = g_nXForce; rglDirection[1] = g_nYForce; cf.lMagnitude = (DWORD)sqrt((double)g_nXForce * (double)g_nXForce + (double)g_nYForce * (double)g_nYForce );