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
This commit is contained in:
Shawn Hoffman 2009-01-15 06:48:15 +00:00
commit ba8c2aa7e4
83 changed files with 1293 additions and 1657 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9,00" Version="9.00"
Name="Common" Name="Common"
ProjectGUID="{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}" ProjectGUID="{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}"
RootNamespace="Common" RootNamespace="Common"
@ -602,6 +602,38 @@
RelativePath=".\Src\Plugin.h" RelativePath=".\Src\Plugin.h"
> >
</File> </File>
<File
RelativePath=".\Src\PluginDSP.cpp"
>
</File>
<File
RelativePath=".\Src\PluginDSP.h"
>
</File>
<File
RelativePath=".\Src\PluginPAD.cpp"
>
</File>
<File
RelativePath=".\Src\PluginPAD.h"
>
</File>
<File
RelativePath=".\Src\PluginVideo.cpp"
>
</File>
<File
RelativePath=".\Src\PluginVideo.h"
>
</File>
<File
RelativePath=".\Src\PluginWiimote.cpp"
>
</File>
<File
RelativePath=".\Src\PluginWiimote.h"
>
</File>
<File <File
RelativePath=".\Src\SConscript" RelativePath=".\Src\SConscript"
> >

View file

@ -38,7 +38,7 @@ and stopped.
#include "FileUtil.h" #include "FileUtil.h"
#include "StringUtil.h" #include "StringUtil.h"
#include "DynamicLibrary.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 #ifdef _WIN32
LPVOID lpMsgBuf = 0; LPVOID lpMsgBuf = 0;
DWORD error = GetLastError(); DWORD error = GetLastError();
FormatMessage( FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, NULL,
error, error,
@ -155,7 +155,7 @@ void* DynamicLibrary::Get(const char* funcname) const
if (!retval) if (!retval)
{ {
LOG(MASTER_LOG, "Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str()); 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; return retval;

View file

@ -237,7 +237,7 @@ bool Rename(const char *srcFilename, const char *destFilename)
bool Copy(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; return (CopyFile(srcFilename, destFilename, FALSE) == TRUE) ? true : false;
#else #else
@ -259,7 +259,7 @@ bool Copy(const char *srcFilename, const char *destFilename)
return false; return false;
} }
while(! feof(input)) { while(! feof(input)) {
if((rnum = fread(buffer, sizeof(char), BSIZE, input)) != BSIZE) { if((rnum = fread(buffer, sizeof(char), BSIZE, input)) != BSIZE) {
if(ferror(input) != 0){ if(ferror(input) != 0){
PanicAlert("can't read source file\n"); PanicAlert("can't read source file\n");
@ -293,7 +293,7 @@ bool Copy(const char *srcFilename, const char *destFilename)
std::string GetUserDirectory() std::string GetUserDirectory()
{ {
char path[MAX_PATH]; char path[MAX_PATH];
#ifdef _WIN32 #ifdef _WIN32
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path))) if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path)))
{ {
//return std::string(path); //return std::string(path);
@ -337,7 +337,7 @@ u64 GetSize(const char *filename)
} }
int err = errno; int err = errno;
PanicAlert("Error accessing %s: %s", filename, strerror(err)); PanicAlert("Error accessing %s: %s", filename, strerror(err));
#endif #endif
return 0; return 0;
} }
@ -408,7 +408,7 @@ u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry)
// Find the first file in the directory. // Find the first file in the directory.
DIR *dirp = opendir(_Directory.c_str()); DIR *dirp = opendir(_Directory.c_str());
while (!readdir_r(dirp, &dirent, &result) && result) { while (!readdir_r(dirp, &dirent, &result) && result) {
FSTEntry entry; FSTEntry entry;
if (result->d_name[0]=='.') continue; if (result->d_name[0]=='.') continue;
@ -428,7 +428,7 @@ u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry)
parentEntry.children.push_back(entry); parentEntry.children.push_back(entry);
} }
closedir(dirp); closedir(dirp);
return foundEntries; return foundEntries;
} }
#endif #endif
@ -494,29 +494,29 @@ error_jmp:
return Result; return Result;
#else #else
// taken from http://www.dreamincode.net/code/snippet2700.htm // taken from http://www.dreamincode.net/code/snippet2700.htm
DIR *pdir = NULL; DIR *pdir = NULL;
pdir = opendir (_Directory.c_str()); pdir = opendir (_Directory.c_str());
struct dirent *pent = NULL; struct dirent *pent = NULL;
if (pdir == NULL) { if (pdir == NULL) {
return false; return false;
} }
char file[256]; char file[256];
int counter = 1; int counter = 1;
while ((pent = readdir(pdir))) { while ((pent = readdir(pdir))) {
if (counter > 2) { if (counter > 2) {
for (int i = 0; i < 256; i++) file[i] = '\0'; for (int i = 0; i < 256; i++) file[i] = '\0';
strcat(file, _Directory.c_str()); strcat(file, _Directory.c_str());
if (pent == NULL) { if (pent == NULL) {
return false; return false;
} }
strcat(file, pent->d_name); strcat(file, pent->d_name);
if (IsDirectory(file) == true) { if (IsDirectory(file) == true) {
DeleteDir(file); DeleteDir(file);
} else { } else {
remove(file); remove(file);
} }
} }

View file

@ -15,7 +15,7 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
// ======================================================= // =======================================================
// File description // File description
@ -24,79 +24,91 @@
the config and debugging windows and works with all plugins. */ the config and debugging windows and works with all plugins. */
// ============= // =============
#include "Plugin.h" #include "Plugin.h"
namespace Common namespace Common
{ {
DynamicLibrary CPlugin::m_hInstLib;
void(__cdecl * CPlugin::m_GetDllInfo) (PLUGIN_INFO * _PluginInfo) = 0; CPlugin::~CPlugin() {
void(__cdecl * CPlugin::m_DllConfig) (HWND _hParent) = 0; m_hInstLib.Unload();
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();
} }
bool CPlugin::CPlugin(const char* _szName) : valid(false) {
CPlugin::Load(const char* _szName) if (m_hInstLib.Load(_szName)) {
{
if (m_hInstLib.Load(_szName)) m_GetDllInfo = reinterpret_cast<TGetDllInfo>
{ (m_hInstLib.Get("GetDllInfo"));
m_GetDllInfo = (void (__cdecl*)(PLUGIN_INFO*)) m_hInstLib.Get("GetDllInfo"); m_DllConfig = reinterpret_cast<TDllConfig>
m_DllConfig = (void (__cdecl*)(HWND)) m_hInstLib.Get("DllConfig"); (m_hInstLib.Get("DllConfig"));
m_DllDebugger = (void (__cdecl*)(HWND, bool)) m_hInstLib.Get("DllDebugger"); m_DllDebugger = reinterpret_cast<TDllDebugger>
m_SetDllGlobals = (void (__cdecl*)(PLUGIN_GLOBALS*)) m_hInstLib.Get("SetDllGlobals"); (m_hInstLib.Get("DllDebugger"));
return(true); m_SetDllGlobals = reinterpret_cast<TSetDllGlobals>
(m_hInstLib.Get("SetDllGlobals"));
m_Initialize = reinterpret_cast<TInitialize>
(m_hInstLib.Get("Initialize"));
m_Shutdown = reinterpret_cast<TShutdown>
(m_hInstLib.Get("Shutdown"));
m_DoState = reinterpret_cast<TDoState>
(m_hInstLib.Get("DoState"));
} }
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;
} }
void *CPlugin::LoadSymbol(const char *sym) {
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) return m_hInstLib.Get(sym);
{
if (m_GetDllInfo != 0)
{
m_GetDllInfo(&_pluginInfo);
return(true);
}
return(false);
} }
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) {
if (m_GetDllInfo != 0) {
m_GetDllInfo(&_pluginInfo);
return(true);
}
void CPlugin::Config(HWND _hwnd) return(false);
{
if (m_DllConfig != 0)
{
m_DllConfig(_hwnd);
}
} }
void CPlugin::Debug(HWND _hwnd, bool Show)
{ void CPlugin::Config(HWND _hwnd) {
if (m_DllDebugger != 0) if (m_DllConfig != 0)
{ m_DllConfig(_hwnd);
m_DllDebugger(_hwnd, Show);
}
} }
void CPlugin::SetGlobals(PLUGIN_GLOBALS& _pluginGlobals) void CPlugin::Debug(HWND _hwnd, bool Show) {
{ if (m_DllDebugger != 0)
if (m_SetDllGlobals != 0) m_DllDebugger(_hwnd, Show);
{
m_SetDllGlobals(&_pluginGlobals);
}
} }
} // 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

View file

@ -19,35 +19,52 @@
#define _PLUGIN_H #define _PLUGIN_H
#include "Common.h" #include "Common.h"
#include "../../../PluginSpecs/PluginSpecs.h" #include "PluginSpecs.h"
#include "DynamicLibrary.h" #include "DynamicLibrary.h"
namespace Common 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 class CPlugin
{ {
public: public:
static void Release(void); CPlugin(const char* _szName);
static bool Load(const char* _szName); ~CPlugin();
static bool GetInfo(PLUGIN_INFO& _pluginInfo); virtual bool IsValid() {return valid;};
static void SetGlobals(PLUGIN_GLOBALS& _PluginGlobals);
static void Config(HWND _hwnd); bool GetInfo(PLUGIN_INFO& _pluginInfo);
static void About(HWND _hwnd); void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals);
static void Debug(HWND _hwnd, bool Show); 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: private:
static DynamicLibrary m_hInstLib; DynamicLibrary m_hInstLib;
bool valid;
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);
// 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 } // end of namespace Common

View file

@ -0,0 +1,36 @@
#include "PluginDSP.h"
namespace Common {
PluginDSP::PluginDSP(const char *_Filename) : CPlugin(_Filename), validDSP(false) {
DSP_ReadMailboxHigh = reinterpret_cast<TDSP_ReadMailBox>
(LoadSymbol("DSP_ReadMailboxHigh"));
DSP_ReadMailboxLow = reinterpret_cast<TDSP_ReadMailBox>
(LoadSymbol("DSP_ReadMailboxLow"));
DSP_WriteMailboxHigh = reinterpret_cast<TDSP_WriteMailBox>
(LoadSymbol("DSP_WriteMailboxHigh"));
DSP_WriteMailboxLow = reinterpret_cast<TDSP_WriteMailBox>
(LoadSymbol("DSP_WriteMailboxLow"));
DSP_ReadControlRegister = reinterpret_cast<TDSP_ReadControlRegister>
(LoadSymbol("DSP_ReadControlRegister"));
DSP_WriteControlRegister = reinterpret_cast<TDSP_WriteControlRegister>
(LoadSymbol("DSP_WriteControlRegister"));
DSP_Update = reinterpret_cast<TDSP_Update>
(LoadSymbol("DSP_Update"));
DSP_SendAIBuffer = reinterpret_cast<TDSP_SendAIBuffer>
(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() {
}
}

View file

@ -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

View file

@ -0,0 +1,24 @@
#include "PluginPAD.h"
namespace Common {
PluginPAD::PluginPAD(const char *_Filename) : CPlugin(_Filename), validPAD(false) {
PAD_GetStatus = reinterpret_cast<TPAD_GetStatus>
(LoadSymbol("PAD_GetStatus"));
PAD_Input = reinterpret_cast<TPAD_Input>
(LoadSymbol("PAD_Input"));
PAD_Rumble = reinterpret_cast<TPAD_Rumble>
(LoadSymbol("PAD_Rumble"));
PAD_GetAttachedPads = reinterpret_cast<TPAD_GetAttachedPads>
(LoadSymbol("PAD_GetAttachedPads"));
if ((PAD_GetStatus != 0) &&
(PAD_Input != 0) &&
(PAD_Rumble != 0) &&
(PAD_GetAttachedPads != 0))
validPAD = true;
}
PluginPAD::~PluginPAD() {
}
}

View file

@ -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

View file

@ -0,0 +1,33 @@
#include "PluginVideo.h"
namespace Common {
PluginVideo::PluginVideo(const char *_Filename) : CPlugin(_Filename), validVideo(false) {
Video_Prepare = reinterpret_cast<TVideo_Prepare>
(LoadSymbol("Video_Prepare"));
Video_SendFifoData = reinterpret_cast<TVideo_SendFifoData>
(LoadSymbol("Video_SendFifoData"));
Video_UpdateXFB = reinterpret_cast<TVideo_UpdateXFB>
(LoadSymbol("Video_UpdateXFB"));
Video_Screenshot = reinterpret_cast<TVideo_Screenshot>
(LoadSymbol("Video_Screenshot"));
Video_EnterLoop = reinterpret_cast<TVideo_EnterLoop>
(LoadSymbol("Video_EnterLoop"));
Video_AddMessage = reinterpret_cast<TVideo_AddMessage>
(LoadSymbol("Video_AddMessage"));
Video_Stop = reinterpret_cast<TVideo_Stop>
(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() {
}
}

View file

@ -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

View file

@ -0,0 +1,24 @@
#include "PluginWiimote.h"
namespace Common {
PluginWiimote::PluginWiimote(const char *_Filename) : CPlugin(_Filename), validWiimote(false) {
Wiimote_ControlChannel = reinterpret_cast<TWiimote_Output>
(LoadSymbol("Wiimote_ControlChannel"));
Wiimote_InterruptChannel = reinterpret_cast<TWiimote_Input>
(LoadSymbol("Wiimote_InterruptChannel"));
Wiimote_Update = reinterpret_cast<TWiimote_Update>
(LoadSymbol("Wiimote_Update"));
Wiimote_GetAttachedControllers = reinterpret_cast<TWiimote_GetAttachedControllers>
(LoadSymbol("Wiimote_GetAttachedControllers"));
if ((Wiimote_ControlChannel != 0) &&
(Wiimote_InterruptChannel != 0) &&
(Wiimote_Update != 0) &&
(Wiimote_GetAttachedControllers != 0))
validWiimote = true;
}
PluginWiimote::~PluginWiimote() {
}
}

View file

@ -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

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
@ -17,6 +17,10 @@ files = [
"MemArena.cpp", "MemArena.cpp",
"MemoryUtil.cpp", "MemoryUtil.cpp",
"Plugin.cpp", "Plugin.cpp",
"PluginDSP.cpp",
"PluginWiimote.cpp",
"PluginVideo.cpp",
"PluginPAD.cpp",
"StringUtil.cpp", "StringUtil.cpp",
"TestFramework.cpp", "TestFramework.cpp",
"Thunk.cpp", "Thunk.cpp",

View file

@ -20,21 +20,18 @@
#endif #endif
#include <time.h> #include <time.h>
#include <sys/timeb.h>
#include "Common.h" #include "Common.h"
#include "Timer.h" #include "Timer.h"
#ifdef __GNUC__ #ifdef __GNUC__
#include <sys/timeb.h>
u32 timeGetTime() u32 timeGetTime()
{ {
struct timeb t; struct timeb t;
ftime(&t); ftime(&t);
return((u32)(t.time * 1000 + t.millitm)); return((u32)(t.time * 1000 + t.millitm));
} }
#endif #endif
@ -88,7 +85,6 @@ void _time64(u64* t)
#endif #endif
u64 Timer::GetTimeSinceJan1970(void) u64 Timer::GetTimeSinceJan1970(void)
{ {
time_t ltime; time_t ltime;
@ -108,4 +104,14 @@ u64 Timer::GetLocalTimeSinceJan1970(void)
return (u64)(sysTime + tzDiff); 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 } // end of namespace Common

View file

@ -39,6 +39,8 @@ class Timer
static u64 GetTimeSinceJan1970(); static u64 GetTimeSinceJan1970();
static u64 GetLocalTimeSinceJan1970(); static u64 GetLocalTimeSinceJan1970();
static std::string GetTimeFormatted();
public: public:

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9,00" Version="9.00"
Name="Core" Name="Core"
ProjectGUID="{F0B874CB-4476-4199-9315-8343D05AE684}" ProjectGUID="{F0B874CB-4476-4199-9315-8343D05AE684}"
RootNamespace="Core" RootNamespace="Core"
@ -45,7 +45,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\Core\InputCommon\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib" AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -116,7 +116,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\Core\InputCommon\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib" AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -191,7 +191,7 @@
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
EnableFiberSafeOptimizations="false" EnableFiberSafeOptimizations="false"
AdditionalIncludeDirectories="..\..\Core\InputCommon\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib" AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -268,7 +268,7 @@
OmitFramePointers="true" OmitFramePointers="true"
EnableFiberSafeOptimizations="false" EnableFiberSafeOptimizations="false"
WholeProgramOptimization="false" WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\Core\InputCommon\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib" AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -343,7 +343,7 @@
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
EnableFiberSafeOptimizations="false" EnableFiberSafeOptimizations="false"
AdditionalIncludeDirectories="..\..\Core\InputCommon\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib" AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
PreprocessorDefinitions="NDEBUG;_LIB;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" PreprocessorDefinitions="NDEBUG;_LIB;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
RuntimeLibrary="0" RuntimeLibrary="0"
BufferSecurityCheck="true" BufferSecurityCheck="true"
@ -418,7 +418,7 @@
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
EnableFiberSafeOptimizations="false" EnableFiberSafeOptimizations="false"
AdditionalIncludeDirectories="..\..\Core\InputCommon\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\LZO;..\Common\Src;..\DiscIO\Src;..\..\PluginSpecs;..\Debugger\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib" AdditionalIncludeDirectories=".\Core\Core\Src\Debugger;..\Common\Src;..\DiscIO\Src;..\..\Core\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\LZO;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\zlib"
PreprocessorDefinitions="NDEBUG;_LIB;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" PreprocessorDefinitions="NDEBUG;_LIB;DEBUGFAST;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
RuntimeLibrary="0" RuntimeLibrary="0"
BufferSecurityCheck="false" BufferSecurityCheck="false"
@ -772,74 +772,6 @@
</File> </File>
</Filter> </Filter>
</Filter> </Filter>
<Filter
Name="Plugins"
>
<File
RelativePath=".\Src\Plugins\Plugin_DSP.cpp"
>
</File>
<File
RelativePath=".\Src\Plugins\Plugin_DSP.h"
>
</File>
<File
RelativePath=".\Src\Plugins\Plugin_PAD.cpp"
>
</File>
<File
RelativePath=".\Src\Plugins\Plugin_PAD.h"
>
</File>
<File
RelativePath=".\Src\Plugins\Plugin_Video.cpp"
>
</File>
<File
RelativePath=".\Src\Plugins\Plugin_Video.h"
>
</File>
<File
RelativePath=".\Src\Plugins\Plugin_Wiimote.cpp"
>
</File>
<File
RelativePath=".\Src\Plugins\Plugin_Wiimote.h"
>
</File>
<Filter
Name="Specs"
>
<File
RelativePath="..\..\PluginSpecs\CommonTypes.h"
>
</File>
<File
RelativePath="..\..\PluginSpecs\ExportProlog.h"
>
</File>
<File
RelativePath="..\..\PluginSpecs\PluginSpecs.h"
>
</File>
<File
RelativePath="..\..\PluginSpecs\pluginspecs_dsp.h"
>
</File>
<File
RelativePath="..\..\PluginSpecs\pluginspecs_pad.h"
>
</File>
<File
RelativePath="..\..\PluginSpecs\pluginspecs_video.h"
>
</File>
<File
RelativePath="..\..\PluginSpecs\pluginspecs_wiimote.h"
>
</File>
</Filter>
</Filter>
<Filter <Filter
Name="PowerPC" Name="PowerPC"
> >

View file

@ -27,7 +27,7 @@
// it will automatically relatch and fire a new interrupt. // it will automatically relatch and fire a new interrupt.
// Then there's the DSP... what likely happens is that the fifo-latched-interrupt handler // 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). // whatever it might be called in Nintendo games).
#include "DSP.h" #include "DSP.h"
@ -40,7 +40,7 @@
#include "PeripheralInterface.h" #include "PeripheralInterface.h"
#include "AudioInterface.h" #include "AudioInterface.h"
#include "../PowerPC/PowerPC.h" #include "../PowerPC/PowerPC.h"
#include "../Plugins/Plugin_DSP.h" #include "../PluginManager.h"
namespace DSP namespace DSP
{ {
@ -63,7 +63,7 @@ enum
AR_DMA_ARADDR_H = 0x5024, AR_DMA_ARADDR_H = 0x5024,
AR_DMA_ARADDR_L = 0x5026, AR_DMA_ARADDR_L = 0x5026,
AR_DMA_CNT_H = 0x5028, AR_DMA_CNT_H = 0x5028,
AR_DMA_CNT_L = 0x502A AR_DMA_CNT_L = 0x502A
}; };
// aram size and mask // aram size and mask
@ -79,7 +79,7 @@ enum
union UARAMCount union UARAMCount
{ {
u32 Hex; u32 Hex;
struct struct
{ {
unsigned count : 31; unsigned count : 31;
unsigned dir : 1; unsigned dir : 1;
@ -93,7 +93,7 @@ union UDSPControl
u16 Hex; u16 Hex;
struct 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 DSPAssertInt : 1;
unsigned DSPHalt : 1; unsigned DSPHalt : 1;
@ -122,7 +122,7 @@ struct DSPState
IntControl = 0; IntControl = 0;
DSPControl.Hex = 0; DSPControl.Hex = 0;
} }
}; };
// Blocks are 32 bytes. // Blocks are 32 bytes.
union UAudioDMAControl union UAudioDMAControl
@ -189,7 +189,7 @@ void DoState(PointerWrap &p)
void UpdateInterrupts(); void UpdateInterrupts();
void Update_ARAM_DMA(); void Update_ARAM_DMA();
void WriteARAM(u8 _iValue, u32 _iAddress); void WriteARAM(u8 _iValue, u32 _iAddress);
bool Update_DSP_ReadRegister(); bool Update_DSP_ReadRegister();
void Update_DSP_WriteRegister(); void Update_DSP_WriteRegister();
@ -233,31 +233,31 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
if (_iAddress != 0xCC005004) { if (_iAddress != 0xCC005004) {
LOGV(DSPINTERFACE, 3, "DSPInterface(r16) 0x%08x", _iAddress); LOGV(DSPINTERFACE, 3, "DSPInterface(r16) 0x%08x", _iAddress);
} }
Common::PluginDSP *dsp = CPluginManager::GetInstance().GetDSP();
switch (_iAddress & 0xFFFF) switch (_iAddress & 0xFFFF)
{ {
// ================================================================================== // ==================================================================================
// AI_REGS 0x5000+ // AI_REGS 0x5000+
// ================================================================================== // ==================================================================================
case DSP_MAIL_TO_DSP_HI: case DSP_MAIL_TO_DSP_HI:
_uReturnValue = PluginDSP::DSP_ReadMailboxHigh(true); _uReturnValue = dsp->DSP_ReadMailboxHigh(true);
return; return;
case DSP_MAIL_TO_DSP_LO: case DSP_MAIL_TO_DSP_LO:
_uReturnValue = PluginDSP::DSP_ReadMailboxLow(true); _uReturnValue = dsp->DSP_ReadMailboxLow(true);
return; return;
case DSP_MAIL_FROM_DSP_HI: case DSP_MAIL_FROM_DSP_HI:
_uReturnValue = PluginDSP::DSP_ReadMailboxHigh(false); _uReturnValue = dsp->DSP_ReadMailboxHigh(false);
return; return;
case DSP_MAIL_FROM_DSP_LO: case DSP_MAIL_FROM_DSP_LO:
_uReturnValue = PluginDSP::DSP_ReadMailboxLow(false); _uReturnValue = dsp->DSP_ReadMailboxLow(false);
return; return;
case DSP_CONTROL: case DSP_CONTROL:
_uReturnValue = (g_dspState.DSPControl.Hex & ~DSP_CONTROL_MASK) | _uReturnValue = (g_dspState.DSPControl.Hex & ~DSP_CONTROL_MASK) |
(PluginDSP::DSP_ReadControlRegister() & DSP_CONTROL_MASK); (dsp->DSP_ReadControlRegister() & DSP_CONTROL_MASK);
return; return;
// ================================================================================== // ==================================================================================
@ -317,7 +317,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
void Write16(const u16 _Value, const u32 _Address) void Write16(const u16 _Value, const u32 _Address)
{ {
LOGV(DSPINTERFACE, 3, "DSPInterface(w16) 0x%04x 0x%08x", _Value, _Address); LOGV(DSPINTERFACE, 3, "DSPInterface(w16) 0x%04x 0x%08x", _Value, _Address);
Common::PluginDSP *dsp = CPluginManager::GetInstance().GetDSP();
switch(_Address & 0xFFFF) switch(_Address & 0xFFFF)
{ {
// ================================================================================== // ==================================================================================
@ -325,18 +325,18 @@ void Write16(const u16 _Value, const u32 _Address)
// ================================================================================== // ==================================================================================
case DSP_MAIL_TO_DSP_HI: case DSP_MAIL_TO_DSP_HI:
PluginDSP::DSP_WriteMailboxHigh(true, _Value); dsp->DSP_WriteMailboxHigh(true, _Value);
break; break;
case DSP_MAIL_TO_DSP_LO: case DSP_MAIL_TO_DSP_LO:
PluginDSP::DSP_WriteMailboxLow(true, _Value); dsp->DSP_WriteMailboxLow(true, _Value);
break; break;
case DSP_MAIL_FROM_DSP_HI: case DSP_MAIL_FROM_DSP_HI:
_dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_HI"); _dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_HI");
break; break;
case DSP_MAIL_FROM_DSP_LO: case DSP_MAIL_FROM_DSP_LO:
_dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_LO"); _dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_LO");
break; break;
@ -346,8 +346,8 @@ void Write16(const u16 _Value, const u32 _Address)
case DSP_CONTROL: case DSP_CONTROL:
{ {
UDSPControl tmpControl; UDSPControl tmpControl;
tmpControl.Hex = (_Value& ~DSP_CONTROL_MASK) | tmpControl.Hex = (_Value& ~DSP_CONTROL_MASK) |
(PluginDSP::DSP_WriteControlRegister(_Value) & DSP_CONTROL_MASK); (dsp->DSP_WriteControlRegister(_Value) & DSP_CONTROL_MASK);
// Update DSP related flags // Update DSP related flags
g_dspState.DSPControl.DSPReset = tmpControl.DSPReset; g_dspState.DSPControl.DSPReset = tmpControl.DSPReset;
@ -379,7 +379,7 @@ void Write16(const u16 _Value, const u32 _Address)
UpdateInterrupts(); UpdateInterrupts();
} }
break; break;
// ================================================================================== // ==================================================================================
// AR_REGS 0x501x+ // AR_REGS 0x501x+
@ -397,9 +397,9 @@ void Write16(const u16 _Value, const u32 _Address)
case 0x501a: case 0x501a:
break; break;
case AR_DMA_MMADDR_H: case AR_DMA_MMADDR_H:
g_arDMA.MMAddr = (g_arDMA.MMAddr & 0xFFFF) | (_Value<<16); break; 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; g_arDMA.MMAddr = (g_arDMA.MMAddr & 0xFFFF0000) | (_Value); break;
case AR_DMA_ARADDR_H: 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; g_arDMA.ARAddr = (g_arDMA.ARAddr & 0xFFFF0000) | (_Value); break;
case AR_DMA_CNT_H: 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; g_arDMA.CntValid[0] = true;
Update_ARAM_DMA(); Update_ARAM_DMA();
break; break;
@ -421,7 +421,7 @@ void Write16(const u16 _Value, const u32 _Address)
// ================================================================================== // ==================================================================================
// Audio DMA_REGS 0x5030+ // 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: case AUDIO_DMA_START_HI:
g_audioDMA.SourceAddress = (g_audioDMA.SourceAddress & 0xFFFF) | (_Value<<16); g_audioDMA.SourceAddress = (g_audioDMA.SourceAddress & 0xFFFF) | (_Value<<16);
@ -462,9 +462,9 @@ void UpdateAudioDMA()
if (g_audioDMA.AudioDMAControl.Enabled && g_audioDMA.BlocksLeft) { 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, // 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. // 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 // 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.ReadAddress += 32;
g_audioDMA.BlocksLeft--; g_audioDMA.BlocksLeft--;
@ -506,19 +506,19 @@ void Write32(const u32 _iValue, const u32 _iAddress)
switch (_iAddress & 0xFFFF) 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: case AR_DMA_MMADDR_H:
g_arDMA.MMAddr = _iValue; g_arDMA.MMAddr = _iValue;
break; break;
case AR_DMA_ARADDR_H: case AR_DMA_ARADDR_H:
g_arDMA.ARAddr = _iValue; g_arDMA.ARAddr = _iValue;
break; break;
case AR_DMA_CNT_H: case AR_DMA_CNT_H:
g_arDMA.Cnt.Hex = _iValue; g_arDMA.Cnt.Hex = _iValue;
g_arDMA.CntValid[0] = g_arDMA.CntValid[1] = true; g_arDMA.CntValid[0] = g_arDMA.CntValid[1] = true;
Update_ARAM_DMA(); Update_ARAM_DMA();
break; break;
@ -531,7 +531,7 @@ void Write32(const u32 _iValue, const u32 _iAddress)
// __________________________________________________________________________________________________ // __________________________________________________________________________________________________
// UpdateInterrupts // UpdateInterrupts
// //
void UpdateInterrupts() void UpdateInterrupts()
{ {
if ((g_dspState.DSPControl.AID & g_dspState.DSPControl.AID_mask) || if ((g_dspState.DSPControl.AID & g_dspState.DSPControl.AID_mask) ||
@ -648,7 +648,7 @@ u8 ReadARAM(u32 _iAddress)
return g_ARAM[_iAddress & ARAM_MASK]; return g_ARAM[_iAddress & ARAM_MASK];
} }
u8* GetARAMPtr() u8* GetARAMPtr()
{ {
return g_ARAM; return g_ARAM;
} }

View file

@ -33,7 +33,7 @@
#include "AudioInterface.h" #include "AudioInterface.h"
#include "VideoInterface.h" #include "VideoInterface.h"
#include "WII_IPC.h" #include "WII_IPC.h"
#include "../Plugins/Plugin_Video.h" #include "../PluginManager.h"
#include "../CoreTiming.h" #include "../CoreTiming.h"
#include "SystemTimers.h" #include "SystemTimers.h"
#include "../IPC_HLE/WII_IPC_HLE.h" #include "../IPC_HLE/WII_IPC_HLE.h"

View file

@ -20,7 +20,7 @@
#include "PeripheralInterface.h" #include "PeripheralInterface.h"
#include "../Plugins/Plugin_PAD.h" #include "../PluginManager.h"
#include "SI.h" #include "SI.h"
#include "SI_Device.h" #include "SI_Device.h"
@ -111,13 +111,13 @@ struct SSIChannel
USIChannelIn_Hi m_InHi; USIChannelIn_Hi m_InHi;
USIChannelIn_Lo m_InLo; USIChannelIn_Lo m_InLo;
ISIDevice* m_pDevice; ISIDevice* m_pDevice;
}; };
// SI Poll: Controls how often a device is polled // SI Poll: Controls how often a device is polled
union USIPoll union USIPoll
{ {
u32 Hex; u32 Hex;
struct struct
{ {
unsigned VBCPY3 : 1; unsigned VBCPY3 : 1;
unsigned VBCPY2 : 1; unsigned VBCPY2 : 1;
@ -137,7 +137,7 @@ union USIPoll
union USIComCSR union USIComCSR
{ {
u32 Hex; u32 Hex;
struct struct
{ {
unsigned TSTART : 1; unsigned TSTART : 1;
unsigned CHANNEL : 2; // determines which SI channel will be used the communication interface. unsigned CHANNEL : 2; // determines which SI channel will be used the communication interface.
@ -200,7 +200,7 @@ union USIStatusReg
union USIEXIClockCount union USIEXIClockCount
{ {
u32 Hex; u32 Hex;
struct struct
{ {
unsigned LOCK : 1; unsigned LOCK : 1;
unsigned : 30; unsigned : 30;
@ -225,7 +225,7 @@ void DoState(PointerWrap &p)
p.Do(g_SIBuffer); p.Do(g_SIBuffer);
} }
static void GenerateSIInterrupt(SIInterruptType _SIInterrupt); static void GenerateSIInterrupt(SIInterruptType _SIInterrupt);
void RunSIBuffer(); void RunSIBuffer();
void UpdateInterrupts(); void UpdateInterrupts();
@ -236,17 +236,24 @@ void Init()
g_Channel[i].m_Out.Hex = 0; g_Channel[i].m_Out.Hex = 0;
g_Channel[i].m_InHi.Hex = 0; g_Channel[i].m_InHi.Hex = 0;
g_Channel[i].m_InLo.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++) for (int i = 0; i < 4; i++)
{ {
if (AttachedPadMask & (1 << i)) if (AttachedPadMask & (1 << i))
g_Channel[i].m_pDevice = new CSIDevice_GCController(i); g_Channel[i].m_pDevice = new CSIDevice_GCController(i);
else else
g_Channel[i].m_pDevice = new CSIDevice_Dummy(i); g_Channel[i].m_pDevice = new CSIDevice_Dummy(i);
} }
g_Poll.Hex = 0; g_Poll.Hex = 0;
g_ComCSR.Hex = 0; g_ComCSR.Hex = 0;
g_StatusReg.Hex = 0; g_StatusReg.Hex = 0;
@ -285,13 +292,13 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
_uReturnValue = g_Channel[0].m_Out.Hex; _uReturnValue = g_Channel[0].m_Out.Hex;
return; return;
case SI_CHANNEL_0_IN_HI: case SI_CHANNEL_0_IN_HI:
g_StatusReg.RDST0 = 0; g_StatusReg.RDST0 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[0].m_InHi.Hex; _uReturnValue = g_Channel[0].m_InHi.Hex;
return; return;
case SI_CHANNEL_0_IN_LO: case SI_CHANNEL_0_IN_LO:
g_StatusReg.RDST0 = 0; g_StatusReg.RDST0 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[0].m_InLo.Hex; _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; _uReturnValue = g_Channel[1].m_Out.Hex;
return; return;
case SI_CHANNEL_1_IN_HI: case SI_CHANNEL_1_IN_HI:
g_StatusReg.RDST1 = 0; g_StatusReg.RDST1 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[1].m_InHi.Hex; _uReturnValue = g_Channel[1].m_InHi.Hex;
return; return;
case SI_CHANNEL_1_IN_LO: case SI_CHANNEL_1_IN_LO:
g_StatusReg.RDST1 = 0; g_StatusReg.RDST1 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[1].m_InLo.Hex; _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; _uReturnValue = g_Channel[2].m_Out.Hex;
return; return;
case SI_CHANNEL_2_IN_HI: case SI_CHANNEL_2_IN_HI:
g_StatusReg.RDST2 = 0; g_StatusReg.RDST2 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[2].m_InHi.Hex; _uReturnValue = g_Channel[2].m_InHi.Hex;
return; return;
case SI_CHANNEL_2_IN_LO: case SI_CHANNEL_2_IN_LO:
g_StatusReg.RDST2 = 0; g_StatusReg.RDST2 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[2].m_InLo.Hex; _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; _uReturnValue = g_Channel[3].m_InHi.Hex;
return; return;
case SI_CHANNEL_3_IN_LO: case SI_CHANNEL_3_IN_LO:
g_StatusReg.RDST3 = 0; g_StatusReg.RDST3 = 0;
UpdateInterrupts(); UpdateInterrupts();
_uReturnValue = g_Channel[3].m_InLo.Hex; _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); LOG(SERIALINTERFACE, "(r32-unk): 0x%08x", _iAddress);
_dbg_assert_(SERIALINTERFACE,0); _dbg_assert_(SERIALINTERFACE,0);
break; break;
} }
// error // error
_uReturnValue = 0xdeadbeef; _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_CHANNEL_3_IN_LO: g_Channel[3].m_InLo.Hex = _iValue; break;
case SI_POLL: case SI_POLL:
g_Poll.Hex = _iValue; g_Poll.Hex = _iValue;
break; break;
case SI_COM_CSR: case SI_COM_CSR:
@ -423,7 +430,7 @@ void Write32(const u32 _iValue, const u32 _iAddress)
} }
break; break;
case SI_STATUS_REG: case SI_STATUS_REG:
{ {
USIStatusReg tmpStatus(_iValue); USIStatusReg tmpStatus(_iValue);
@ -465,8 +472,8 @@ void Write32(const u32 _iValue, const u32 _iAddress)
} }
break; break;
case SI_EXI_CLOCK_COUNT: case SI_EXI_CLOCK_COUNT:
g_EXIClockCount.Hex = _iValue; g_EXIClockCount.Hex = _iValue;
break; break;
case 0x80: case 0x80:
@ -476,7 +483,7 @@ void Write32(const u32 _iValue, const u32 _iAddress)
default: default:
_dbg_assert_(SERIALINTERFACE,0); _dbg_assert_(SERIALINTERFACE,0);
break; break;
} }
} }
void UpdateInterrupts() void UpdateInterrupts()
@ -502,7 +509,7 @@ void UpdateInterrupts()
void GenerateSIInterrupt(SIInterruptType _SIInterrupt) void GenerateSIInterrupt(SIInterruptType _SIInterrupt)
{ {
switch(_SIInterrupt) switch(_SIInterrupt)
{ {
case INT_RDSTINT: g_ComCSR.RDSTINT = 1; break; case INT_RDSTINT: g_ComCSR.RDSTINT = 1; break;
case INT_TCINT: g_ComCSR.TCINT = 1; break; case INT_TCINT: g_ComCSR.TCINT = 1; break;
@ -524,23 +531,23 @@ void UpdateDevices()
} }
void RunSIBuffer() void RunSIBuffer()
{ {
// math inLength // math inLength
int inLength = g_ComCSR.INLNGTH; int inLength = g_ComCSR.INLNGTH;
if (inLength == 0) if (inLength == 0)
inLength = 128; inLength = 128;
else else
inLength++; inLength++;
// math outLength // math outLength
int outLength = g_ComCSR.OUTLNGTH; int outLength = g_ComCSR.OUTLNGTH;
if (outLength == 0) if (outLength == 0)
outLength = 128; outLength = 128;
else else
outLength++; outLength++;
#ifdef LOGGING #ifdef LOGGING
int numOutput = int numOutput =
#endif #endif
g_Channel[g_ComCSR.CHANNEL].m_pDevice->RunBuffer(g_SIBuffer, inLength); g_Channel[g_ComCSR.CHANNEL].m_pDevice->RunBuffer(g_SIBuffer, inLength);
LOGV(SERIALINTERFACE, 2, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, outLength, numOutput); LOGV(SERIALINTERFACE, 2, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, outLength, numOutput);

View file

@ -20,7 +20,7 @@
#include "SI_Device.h" #include "SI_Device.h"
#include "SI_DeviceGCController.h" #include "SI_DeviceGCController.h"
#include "../Plugins/Plugin_PAD.h" #include "../PluginManager.h"
#include "EXI_Device.h" #include "EXI_Device.h"
#include "EXI_DeviceMic.h" #include "EXI_DeviceMic.h"
@ -50,7 +50,7 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
int iPosition = 0; int iPosition = 0;
while(iPosition < _iLength) while(iPosition < _iLength)
{ {
// read the command // read the command
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]); EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
iPosition++; iPosition++;
@ -114,12 +114,13 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
// //
// return true on new data (max 7 Bytes and 6 bits ;) // return true on new data (max 7 Bytes and 6 bits ;)
// //
bool bool
CSIDevice_GCController::GetData(u32& _Hi, u32& _Low) CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
{ {
SPADStatus PadStatus; SPADStatus PadStatus;
memset(&PadStatus, 0 ,sizeof(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.stickY);
_Hi |= (u32)((u8)PadStatus.stickX << 8); _Hi |= (u32)((u8)PadStatus.stickX << 8);
@ -141,11 +142,13 @@ CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
// __________________________________________________________________________________________________ // __________________________________________________________________________________________________
// SendCommand // SendCommand
// //
void void
CSIDevice_GCController::SendCommand(u32 _Cmd) CSIDevice_GCController::SendCommand(u32 _Cmd)
{ {
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(0);
UCommand command(_Cmd); UCommand command(_Cmd);
switch(command.Command) switch(command.Command)
{ {
// Costis sent it in some demos :) // 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 uType = command.Parameter1; // 0 = stop, 1 = rumble, 2 = stop hard
unsigned int uStrength = command.Parameter2; unsigned int uStrength = command.Parameter2;
if (PluginPAD::PAD_Rumble) if (pad->PAD_Rumble)
PluginPAD::PAD_Rumble(ISIDevice::m_iDeviceNumber, uType, uStrength); pad->PAD_Rumble(ISIDevice::m_iDeviceNumber, uType, uStrength);
} }
break; break;

View file

@ -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 "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 of frames. So if a game runs slow, on a slow computer for example, these updates will occur
@ -38,7 +38,7 @@
frame. 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 IPC_HLE_UpdateCallback() // In this file
// This function seems to call all devices' Update() function four times per frame // This function seems to call all devices' Update() function four times per frame
@ -63,8 +63,7 @@
#include "Common.h" #include "Common.h"
#include "../PatchEngine.h" #include "../PatchEngine.h"
#include "SystemTimers.h" #include "SystemTimers.h"
#include "../Plugins/Plugin_DSP.h" #include "../PluginManager.h"
#include "../Plugins/Plugin_Video.h"
#include "../HW/DSP.h" #include "../HW/DSP.h"
#include "../HW/AudioInterface.h" #include "../HW/AudioInterface.h"
#include "../HW/VideoInterface.h" #include "../HW/VideoInterface.h"
@ -113,14 +112,14 @@ int et_FakeGPWD; // for DC watchdog hack
// Feel free to experiment // Feel free to experiment
int int
// update VI often to let it go through its scanlines with decent accuracy // 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! // 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. // TODO: The SI interfact actually has a register that determines the polling frequency.
// We should obey that instead of arbitrarly checking at 60fps. // We should obey that instead of arbitrarly checking at 60fps.
SI_PERIOD = GetTicksPerSecond() / 60, //once a frame is good for controllers SI_PERIOD = GetTicksPerSecond() / 60, //once a frame is good for controllers
// This one should simply be determined by the increasing counter in AI. // This one should simply be determined by the increasing counter in AI.
AI_PERIOD = GetTicksPerSecond() / 80, AI_PERIOD = GetTicksPerSecond() / 80,
@ -160,12 +159,12 @@ void AICallback(u64 userdata, int cyclesLate)
void DSPCallback(u64 userdata, int cyclesLate) void DSPCallback(u64 userdata, int cyclesLate)
{ {
// ~1/6th as many cycles as the period PPC-side. // ~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); CoreTiming::ScheduleEvent(DSP_PERIOD-cyclesLate, et_DSP);
} }
void AudioFifoCallback(u64 userdata, int cyclesLate) void AudioFifoCallback(u64 userdata, int cyclesLate)
{ {
int period = CPU_CORE_CLOCK / (AudioInterface::GetDSPSampleRate() * 4 / 32); int period = CPU_CORE_CLOCK / (AudioInterface::GetDSPSampleRate() * 4 / 32);
DSP::UpdateAudioDMA(); // Push audio to speakers. DSP::UpdateAudioDMA(); // Push audio to speakers.
@ -173,7 +172,7 @@ void AudioFifoCallback(u64 userdata, int cyclesLate)
} }
void IPC_HLE_UpdateCallback(u64 userdata, int cyclesLate) void IPC_HLE_UpdateCallback(u64 userdata, int cyclesLate)
{ {
WII_IPC_HLE_Interface::Update(); WII_IPC_HLE_Interface::Update();
CoreTiming::ScheduleEvent(IPC_HLE_PERIOD-cyclesLate, et_IPC_HLE); CoreTiming::ScheduleEvent(IPC_HLE_PERIOD-cyclesLate, et_IPC_HLE);
} }
@ -233,7 +232,7 @@ void Init()
if (Core::GetStartupParameter().bWii) if (Core::GetStartupParameter().bWii)
{ {
CPU_CORE_CLOCK = 721000000; 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 SI_PERIOD = GetTicksPerSecond() / 60; // once a frame is good for controllers
// These are the big question marks IMHO :) // These are the big question marks IMHO :)

View file

@ -23,7 +23,7 @@
#include "PeripheralInterface.h" #include "PeripheralInterface.h"
#include "VideoInterface.h" #include "VideoInterface.h"
#include "Memmap.h" #include "Memmap.h"
#include "../Plugins/Plugin_Video.h" #include "../PluginManager.h"
#include "../CoreTiming.h" #include "../CoreTiming.h"
#include "../HW/SystemTimers.h" #include "../HW/SystemTimers.h"
@ -66,7 +66,7 @@ union UVIVerticalTimingRegister
union UVIDisplayControlRegister union UVIDisplayControlRegister
{ {
u16 Hex; u16 Hex;
struct struct
{ {
unsigned ENB : 1; unsigned ENB : 1;
unsigned RST : 1; unsigned RST : 1;
@ -85,7 +85,7 @@ union UVIDisplayControlRegister
union UVIInterruptRegister union UVIInterruptRegister
{ {
u32 Hex; u32 Hex;
struct struct
{ {
u16 Lo; u16 Lo;
u16 Hi; u16 Hi;
@ -129,7 +129,7 @@ union UVIHorizontalScaling
union UVIFrameBufferAddress union UVIFrameBufferAddress
{ {
u32 Hex; u32 Hex;
struct struct
{ {
u16 Lo; u16 Lo;
u16 Hi; u16 Hi;
@ -172,9 +172,9 @@ void DoState(PointerWrap &p)
p.Do(m_VIVerticalTimingRegister); p.Do(m_VIVerticalTimingRegister);
p.Do(m_VIDisplayControlRegister); p.Do(m_VIDisplayControlRegister);
p.Do(m_FrameBufferTop); p.Do(m_FrameBufferTop);
p.Do(m_FrameBufferBottom); p.Do(m_FrameBufferBottom);
p.Do(m_VIInterruptRegister); p.Do(m_VIInterruptRegister);
p.DoArray(m_UVIUnknownRegs, 0x1000); p.DoArray(m_UVIUnknownRegs, 0x1000);
p.Do(HorizontalBeamPos); p.Do(HorizontalBeamPos);
p.Do(VerticalBeamPos); p.Do(VerticalBeamPos);
p.Do(TicksPerFrame); p.Do(TicksPerFrame);
@ -233,7 +233,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
_uReturnValue = HorizontalBeamPos; _uReturnValue = HorizontalBeamPos;
return; return;
// RETRACE STUFF ... // RETRACE STUFF ...
case VI_PRERETRACE: case VI_PRERETRACE:
_uReturnValue = m_VIInterruptRegister[0].Hi; _uReturnValue = m_VIInterruptRegister[0].Hi;
return; return;
@ -273,7 +273,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
void Write16(const u16 _iValue, const u32 _iAddress) void Write16(const u16 _iValue, const u32 _iAddress)
{ {
LOGV(VIDEOINTERFACE, 3, "(w16): 0x%04x, 0x%08x",_iValue,_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... //Somewhere it sets screen width.. we need to communicate this to the gfx plugin...
switch (_iAddress & 0xFFF) switch (_iAddress & 0xFFF)
@ -307,7 +307,7 @@ void Write16(const u16 _iValue, const u32 _iAddress)
case VI_FRAMEBUFFER_TOP_LO: case VI_FRAMEBUFFER_TOP_LO:
m_FrameBufferTop.Lo = _iValue; m_FrameBufferTop.Lo = _iValue;
break; break;
case VI_FRAMEBUFFER_BOTTOM_HI: case VI_FRAMEBUFFER_BOTTOM_HI:
m_FrameBufferBottom.Hi = _iValue; m_FrameBufferBottom.Hi = _iValue;
@ -325,7 +325,7 @@ void Write16(const u16 _iValue, const u32 _iAddress)
_dbg_assert_(VIDEOINTERFACE,0); _dbg_assert_(VIDEOINTERFACE,0);
break; break;
// RETRACE STUFF ... // RETRACE STUFF ...
case VI_PRERETRACE: case VI_PRERETRACE:
m_VIInterruptRegister[0].Hi = _iValue; m_VIInterruptRegister[0].Hi = _iValue;
UpdateInterrupts(); UpdateInterrupts();
@ -392,12 +392,12 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
void Write32(const u32 _iValue, const u32 _iAddress) void Write32(const u32 _iValue, const u32 _iAddress)
{ {
LOG(VIDEOINTERFACE, "(w32): 0x%08x, 0x%08x",_iValue,_iAddress); LOG(VIDEOINTERFACE, "(w32): 0x%08x, 0x%08x",_iValue,_iAddress);
// Allow 32-bit writes to the VI: although this is officially not // Allow 32-bit writes to the VI: although this is officially not
// allowed, the hardware seems to accept it (for example, DesktopMan GC // allowed, the hardware seems to accept it (for example, DesktopMan GC
// Tetris uses it). // Tetris uses it).
Write16(_iValue >> 16, _iAddress); Write16(_iValue >> 16, _iAddress);
Write16(_iValue & 0xFFFF, _iAddress + 2); Write16(_iValue & 0xFFFF, _iAddress + 2);
} }
void UpdateInterrupts() void UpdateInterrupts()
@ -417,7 +417,7 @@ void UpdateInterrupts()
void GenerateVIInterrupt(VIInterruptType _VIInterrupt) void GenerateVIInterrupt(VIInterruptType _VIInterrupt)
{ {
switch(_VIInterrupt) switch(_VIInterrupt)
{ {
case INT_PRERETRACE: m_VIInterruptRegister[0].IR_INT = 1; break; case INT_PRERETRACE: m_VIInterruptRegister[0].IR_INT = 1; break;
case INT_POSTRETRACE: m_VIInterruptRegister[1].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)) (m_VIInterruptRegister[3].IR_MASK == 1))
{ {
PanicAlert("m_VIInterruptRegister[2 and 3] activated - Tell F|RES :)"); PanicAlert("m_VIInterruptRegister[2 and 3] activated - Tell F|RES :)");
} }
} }
u8* GetFrameBufferPointer() u8* GetFrameBufferPointer()
@ -455,7 +455,7 @@ void PreInit(bool _bNTSC)
Write16(0x0005, 0xcc00200c); Write16(0x0005, 0xcc00200c);
Write16(0x01f7, 0xcc002012); Write16(0x01f7, 0xcc002012);
Write16(0x0004, 0xcc002010); Write16(0x0004, 0xcc002010);
Write16(0x410c, 0xcc002016); Write16(0x410c, 0xcc002016);
Write16(0x410c, 0xcc002014); Write16(0x410c, 0xcc002014);
Write16(0x40ed, 0xcc00201a); Write16(0x40ed, 0xcc00201a);
Write16(0x40ed, 0xcc002018); Write16(0x40ed, 0xcc002018);
@ -470,7 +470,7 @@ void PreInit(bool _bNTSC)
if (_bNTSC) if (_bNTSC)
Write16(0x0001, 0xcc002002); // STATUS REG Write16(0x0001, 0xcc002002); // STATUS REG
else else
Write16(0x0101, 0xcc002002); // STATUS REG Write16(0x0101, 0xcc002002); // STATUS REG
} }
void UpdateTiming() void UpdateTiming()
@ -519,7 +519,7 @@ void Update()
NextXFBRender = LinesPerField; NextXFBRender = LinesPerField;
// The & mask is a hack for mario kart // The & mask is a hack for mario kart
u32 addr = (VideoInterface::m_FrameBufferTop.Hex & 0xFFFFFFF) | 0x80000000; u32 addr = (VideoInterface::m_FrameBufferTop.Hex & 0xFFFFFFF) | 0x80000000;
if (addr >= 0x80000000 && if (addr >= 0x80000000 &&
addr <= (0x81800000-640*480*2)) addr <= (0x81800000-640*480*2))
xfbPtr = Memory::GetPointer(addr); xfbPtr = Memory::GetPointer(addr);
} }
@ -527,20 +527,20 @@ void Update()
{ {
NextXFBRender = 1; NextXFBRender = 1;
u32 addr = (VideoInterface::m_FrameBufferBottom.Hex & 0xFFFFFFF) | 0x80000000; u32 addr = (VideoInterface::m_FrameBufferBottom.Hex & 0xFFFFFFF) | 0x80000000;
if (addr >= 0x80000000 && if (addr >= 0x80000000 &&
addr <= (0x81800000-640*480*2)) addr <= (0x81800000-640*480*2))
xfbPtr = Memory::GetPointer(addr); xfbPtr = Memory::GetPointer(addr);
yOffset = -1; yOffset = -1;
} }
Common::PluginVideo* video = CPluginManager::GetInstance().GetVideo();
if (xfbPtr && PluginVideo::IsLoaded()) if (xfbPtr && video->IsValid())
{ {
int fbWidth = m_VIHorizontalStepping.FieldSteps * 16; int fbWidth = m_VIHorizontalStepping.FieldSteps * 16;
int fbHeight = (m_VIHorizontalStepping.FbSteps / m_VIHorizontalStepping.FieldSteps) * m_VIVerticalTimingRegister.ACV; 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 // check INT_PRERETRACE
if (m_VIInterruptRegister[0].VCT == VerticalBeamPos) if (m_VIInterruptRegister[0].VCT == VerticalBeamPos)
{ {
@ -556,6 +556,5 @@ void Update()
} }
} }
} }
}
}

View file

@ -20,7 +20,7 @@
// Include // Include
// ¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯
#include "WII_IPC_HLE_Device_usb.h" #include "WII_IPC_HLE_Device_usb.h"
#include "../Plugins/Plugin_Wiimote.h" #include "../PluginManager.h"
#include "../Core.h" // Local core functions #include "../Core.h" // Local core functions
#include "../Debugger/Debugger_SymbolMap.h" #include "../Debugger/Debugger_SymbolMap.h"
@ -95,10 +95,10 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtl(u32 _CommandAddress)
// =================================================== // ===================================================
/* IOCtlV */ /* 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 Memory::Write_U8(255, 0x80149950); // BTM LOG
// 3 logs L2Cap // 3 logs L2Cap
// 4 logs l2_csm$ // 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(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, 0x80152018); // WUD
Memory::Write_U8(1, 0x80151FC8); // DEBUGPrint */ Memory::Write_U8(1, 0x80151FC8); // DEBUGPrint */
@ -128,7 +128,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress)
{ {
SHCICommandMessage CtrlSetup; 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.bRequestType = *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[0].m_Address);
CtrlSetup.bRequest = *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[1].m_Address); CtrlSetup.bRequest = *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[1].m_Address);
CtrlSetup.wValue = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[2].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; CtrlSetup.m_PayLoadSize = CommandBuffer.PayloadBuffer[0].m_Size;
// check termination // 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"); "WIIMOTE: Termination != 0");
#if 0 #if 0
@ -202,7 +202,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress)
case USB_IOCTL_INTRMSG: case USB_IOCTL_INTRMSG:
{ {
u8 Command = Memory::Read_U8(CommandBuffer.InBuffer[0].m_Address); u8 Command = Memory::Read_U8(CommandBuffer.InBuffer[0].m_Address);
switch (Command) 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, " NumberIn: 0x%08x", CommandBuffer.NumberInBuffer);
LOG(WII_IPC_WIIMOTE, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer); LOG(WII_IPC_WIIMOTE, " NumberOut: 0x%08x", CommandBuffer.NumberPayloadBuffer);
LOG(WII_IPC_WIIMOTE, " BufferVector: 0x%08x", CommandBuffer.BufferVector); 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); DumpAsync(CommandBuffer.BufferVector, _CommandAddress, CommandBuffer.NumberInBuffer, CommandBuffer.NumberPayloadBuffer);
} }
break; 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, " Size: 0x%08x", _Size);
LOGV(WII_IPC_WIIMOTE, 1, " Data: %s", Temp.c_str()); */ LOGV(WII_IPC_WIIMOTE, 1, " Data: %s", Temp.c_str()); */
g_HCICount++; g_HCICount++;
} }
@ -332,11 +332,11 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
return Addr; return Addr;
} }
// check if we can fill the aclbuffer // 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."); LOGV(WII_IPC_WIIMOTE, 1, "Sending ACL frame.");
UACLHeader* pHeader = (UACLHeader*)Memory::GetPointer(m_pACLBuffer->PayloadBuffer[0].m_Address); 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()) 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 /* 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 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 FiRES: TODO find a good solution to do this
JP: Solution to what? When to run SendEventRequestConnection()? 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 // add the payload
if ((_pData != NULL) && (_DataSize > 0)) if ((_pData != NULL) && (_DataSize > 0))
{ {
u8* pPayload = Event.m_buffer + sizeof(SHCIEventCommand); u8* pPayload = Event.m_buffer + sizeof(SHCIEventCommand);
memcpy(pPayload, _pData, _DataSize); memcpy(pPayload, _pData, _DataSize);
} }
@ -506,7 +506,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryResponse()
SHCIEventInquiryResult* pInquiryResult = (SHCIEventInquiryResult*)Event.m_buffer; SHCIEventInquiryResult* pInquiryResult = (SHCIEventInquiryResult*)Event.m_buffer;
pInquiryResult->EventType = 0x02; 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(); pInquiryResult->num_responses = (u8)m_WiiMotes.size();
for (size_t i=0; i<m_WiiMotes.size(); i++) for (size_t i=0; i<m_WiiMotes.size(); i++)
@ -528,7 +528,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventInquiryResponse()
pResponse->clock_offset = 0x3818; pResponse->clock_offset = 0x3818;
LOG(WII_IPC_WIIMOTE, "Event: Send Fake Inquriy of one controller"); 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[0], pResponse->bdaddr.b[1], pResponse->bdaddr.b[2],
pResponse->bdaddr.b[3], pResponse->bdaddr.b[4], pResponse->bdaddr.b[5]); 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; SHCIEventInquiryComplete* pInquiryComplete = (SHCIEventInquiryComplete*)Event.m_buffer;
pInquiryComplete->EventType = 0x01; pInquiryComplete->EventType = 0x01;
pInquiryComplete->PayloadLength = sizeof(SHCIEventInquiryComplete) - 2; pInquiryComplete->PayloadLength = sizeof(SHCIEventInquiryComplete) - 2;
pInquiryComplete->Status = 0x00; pInquiryComplete->Status = 0x00;
AddEventToQueue(Event); AddEventToQueue(Event);
@ -577,7 +577,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRemoteNameReq(bdaddr_t _bd)
AddEventToQueue(Event); AddEventToQueue(Event);
LOG(WII_IPC_WIIMOTE, "Event: SendEventRemoteNameReq"); 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[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq->bdaddr.b[2],
pRemoteNameReq->bdaddr.b[3], pRemoteNameReq->bdaddr.b[4], pRemoteNameReq->bdaddr.b[5]); pRemoteNameReq->bdaddr.b[3], pRemoteNameReq->bdaddr.b[4], pRemoteNameReq->bdaddr.b[5]);
LOG(WII_IPC_WIIMOTE, " remotename: %s", pRemoteNameReq->RemoteName); 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->EventType = 0x04;
pEventRequestConnection->PayloadLength = sizeof(SHCIEventRequestConnection) - 2; pEventRequestConnection->PayloadLength = sizeof(SHCIEventRequestConnection) - 2;
pEventRequestConnection->bdaddr = _rWiiMote.GetBD(); pEventRequestConnection->bdaddr = _rWiiMote.GetBD();
pEventRequestConnection->uclass[0] = _rWiiMote.GetClass()[0]; pEventRequestConnection->uclass[0] = _rWiiMote.GetClass()[0];
pEventRequestConnection->uclass[1] = _rWiiMote.GetClass()[1]; pEventRequestConnection->uclass[1] = _rWiiMote.GetClass()[1];
pEventRequestConnection->uclass[2] = _rWiiMote.GetClass()[2]; pEventRequestConnection->uclass[2] = _rWiiMote.GetClass()[2];
@ -611,8 +611,8 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventRequestConnection(CWII_IPC_HL
// Log // Log
#ifdef LOGGING #ifdef LOGGING
static char LinkType[][128] = static char LinkType[][128] =
{ {
{ "HCI_LINK_SCO 0x00 - Voice"}, { "HCI_LINK_SCO 0x00 - Voice"},
{ "HCI_LINK_ACL 0x01 - Data"}, { "HCI_LINK_ACL 0x01 - Data"},
{ "HCI_LINK_eSCO 0x02 - eSCO"}, { "HCI_LINK_eSCO 0x02 - eSCO"},
}; };
@ -713,8 +713,8 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventConnectionComplete(bdaddr_t _
#ifdef LOGGING #ifdef LOGGING
static char s_szLinkType[][128] = static char s_szLinkType[][128] =
{ {
{ "HCI_LINK_SCO 0x00 - Voice"}, { "HCI_LINK_SCO 0x00 - Voice"},
{ "HCI_LINK_ACL 0x01 - Data"}, { "HCI_LINK_ACL 0x01 - Data"},
{ "HCI_LINK_eSCO 0x02 - eSCO"}, { "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, "Event: SendEventConnectionComplete");
LOG(WII_IPC_WIIMOTE, " Connection_Handle: 0x%04x", pConnectionComplete->Connection_Handle); 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[0], pConnectionComplete->bdaddr.b[1], pConnectionComplete->bdaddr.b[2],
pConnectionComplete->bdaddr.b[3], pConnectionComplete->bdaddr.b[4], pConnectionComplete->bdaddr.b[5]); pConnectionComplete->bdaddr.b[3], pConnectionComplete->bdaddr.b[4], pConnectionComplete->bdaddr.b[5]);
LOG(WII_IPC_WIIMOTE, " LinkType: %s", s_szLinkType[pConnectionComplete->LinkType]); 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); AddEventToQueue(Event);
LOG(WII_IPC_WIIMOTE, "Event: SendEventRoleChange"); 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[0], pRoleChange->bdaddr.b[1], pRoleChange->bdaddr.b[2],
pRoleChange->bdaddr.b[3], pRoleChange->bdaddr.b[4], pRoleChange->bdaddr.b[5]); pRoleChange->bdaddr.b[3], pRoleChange->bdaddr.b[4], pRoleChange->bdaddr.b[5]);
LOG(WII_IPC_WIIMOTE, " NewRole: %i", pRoleChange->NewRole); 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; SHCIEventReadClockOffsetComplete* pReadClockOffsetComplete = (SHCIEventReadClockOffsetComplete*)Event.m_buffer;
pReadClockOffsetComplete->EventType = 0x1C; pReadClockOffsetComplete->EventType = 0x1C;
pReadClockOffsetComplete->PayloadLength = sizeof(SHCIEventReadClockOffsetComplete) - 2; pReadClockOffsetComplete->PayloadLength = sizeof(SHCIEventReadClockOffsetComplete) - 2;
pReadClockOffsetComplete->Status = 0x00; pReadClockOffsetComplete->Status = 0x00;
pReadClockOffsetComplete->ConnectionHandle = pWiiMote->GetConnectionHandle(); pReadClockOffsetComplete->ConnectionHandle = pWiiMote->GetConnectionHandle();
pReadClockOffsetComplete->ClockOffset = 0x3818; 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; SHCIEventReadRemoteVerInfo* pReadRemoteVerInfo = (SHCIEventReadRemoteVerInfo*)Event.m_buffer;
pReadRemoteVerInfo->EventType = 0x0C; pReadRemoteVerInfo->EventType = 0x0C;
pReadRemoteVerInfo->PayloadLength = sizeof(SHCIEventReadRemoteVerInfo) - 2; pReadRemoteVerInfo->PayloadLength = sizeof(SHCIEventReadRemoteVerInfo) - 2;
pReadRemoteVerInfo->Status = 0x00; pReadRemoteVerInfo->Status = 0x00;
pReadRemoteVerInfo->ConnectionHandle = pWiiMote->GetConnectionHandle(); pReadRemoteVerInfo->ConnectionHandle = pWiiMote->GetConnectionHandle();
pReadRemoteVerInfo->lmp_version = pWiiMote->GetLMPVersion(); 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; SHCIEventReadRemoteFeatures* pReadRemoteFeatures = (SHCIEventReadRemoteFeatures*)Event.m_buffer;
pReadRemoteFeatures->EventType = 0x0C; pReadRemoteFeatures->EventType = 0x0C;
pReadRemoteFeatures->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2; pReadRemoteFeatures->PayloadLength = sizeof(SHCIEventReadRemoteFeatures) - 2;
pReadRemoteFeatures->Status = 0x00; pReadRemoteFeatures->Status = 0x00;
pReadRemoteFeatures->ConnectionHandle = pWiiMote->GetConnectionHandle(); pReadRemoteFeatures->ConnectionHandle = pWiiMote->GetConnectionHandle();
pReadRemoteFeatures->features[0] = pWiiMote->GetFeatures()[0]; 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, " Connection_Handle: 0x%04x", pReadRemoteFeatures->ConnectionHandle);
LOG(WII_IPC_WIIMOTE, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", LOG(WII_IPC_WIIMOTE, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
pReadRemoteFeatures->features[0], pReadRemoteFeatures->features[1], pReadRemoteFeatures->features[2], 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]); pReadRemoteFeatures->features[6], pReadRemoteFeatures->features[7]);
return true; return true;
@ -876,7 +876,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets(u16
SHCIEventNumberOfCompletedPackets* pNumberOfCompletedPackets = (SHCIEventNumberOfCompletedPackets*)Event.m_buffer; SHCIEventNumberOfCompletedPackets* pNumberOfCompletedPackets = (SHCIEventNumberOfCompletedPackets*)Event.m_buffer;
pNumberOfCompletedPackets->EventType = 0x13; pNumberOfCompletedPackets->EventType = 0x13;
pNumberOfCompletedPackets->PayloadLength = sizeof(SHCIEventNumberOfCompletedPackets) - 2; pNumberOfCompletedPackets->PayloadLength = sizeof(SHCIEventNumberOfCompletedPackets) - 2;
pNumberOfCompletedPackets->NumberOfHandles = 1; pNumberOfCompletedPackets->NumberOfHandles = 1;
pNumberOfCompletedPackets->Connection_Handle = _connectionHandle; pNumberOfCompletedPackets->Connection_Handle = _connectionHandle;
pNumberOfCompletedPackets->Number_Of_Completed_Packets = _count; 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; SHCIEventAuthenticationCompleted* pEventAuthenticationCompleted = (SHCIEventAuthenticationCompleted*)Event.m_buffer;
pEventAuthenticationCompleted->EventType = 0x06; pEventAuthenticationCompleted->EventType = 0x06;
pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventAuthenticationCompleted) - 2; pEventAuthenticationCompleted->PayloadLength = sizeof(SHCIEventAuthenticationCompleted) - 2;
pEventAuthenticationCompleted->Status = 0; pEventAuthenticationCompleted->Status = 0;
pEventAuthenticationCompleted->Connection_Handle = _connectionHandle; 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; SHCIEventModeChange* pModeChange = (SHCIEventModeChange*)Event.m_buffer;
pModeChange->EventType = 0x14; pModeChange->EventType = 0x14;
pModeChange->PayloadLength = sizeof(SHCIEventModeChange) - 2; pModeChange->PayloadLength = sizeof(SHCIEventModeChange) - 2;
pModeChange->Status = 0; pModeChange->Status = 0;
pModeChange->Connection_Handle = _connectionHandle; pModeChange->Connection_Handle = _connectionHandle;
pModeChange->CurrentMode = _mode; 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; SHCIEventDisconnectCompleted* pDisconnect = (SHCIEventDisconnectCompleted*)Event.m_buffer;
pDisconnect->EventType = 0x06; pDisconnect->EventType = 0x06;
pDisconnect->PayloadLength = sizeof(SHCIEventDisconnectCompleted) - 2; pDisconnect->PayloadLength = sizeof(SHCIEventDisconnectCompleted) - 2;
pDisconnect->Status = 0; pDisconnect->Status = 0;
pDisconnect->Connection_Handle = _connectionHandle; pDisconnect->Connection_Handle = _connectionHandle;
pDisconnect->Reason = _Reason; pDisconnect->Reason = _Reason;
@ -979,7 +979,7 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventDisconnect(u16 _connectionHan
// Command dispacther // Command dispacther
// ----------------- // -----------------
// This is called from the USB_IOCTL_HCI_COMMAND_MESSAGE Ioctlv // 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) switch(pMsg->Opcode)
{ {
// //
// --- read commandos --- // --- read commandos ---
// //
case HCI_CMD_RESET: case HCI_CMD_RESET:
@ -1069,11 +1069,11 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom
// vendor specific... // vendor specific...
case 0xFC4C: case 0xFC4C:
CommandVendorSpecific_FC4C(pInput, _rHCICommandMessage.m_PayLoadSize - 3); CommandVendorSpecific_FC4C(pInput, _rHCICommandMessage.m_PayLoadSize - 3);
break; break;
case 0xFC4F: case 0xFC4F:
CommandVendorSpecific_FC4F(pInput, _rHCICommandMessage.m_PayLoadSize - 3); CommandVendorSpecific_FC4F(pInput, _rHCICommandMessage.m_PayLoadSize - 3);
break; break;
case HCI_CMD_INQUIRY_CANCEL: case HCI_CMD_INQUIRY_CANCEL:
@ -1133,7 +1133,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ExecuteHCICommandMessage(const SHCICom
break; break;
// //
// --- default --- // --- default ---
// //
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, "Command: HCI_CMD_READ_BDADDR:");
LOG(WII_IPC_WIIMOTE, "return:"); 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[0], Reply.bdaddr.b[1], Reply.bdaddr.b[2],
Reply.bdaddr.b[3], Reply.bdaddr.b[4], Reply.bdaddr.b[5]); 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, "return:");
LOG(WII_IPC_WIIMOTE, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", LOG(WII_IPC_WIIMOTE, " features: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
Reply.features[0], Reply.features[1], Reply.features[2], 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]); Reply.features[6], Reply.features[7]);
SendEventCommandComplete(HCI_CMD_READ_LOCAL_FEATURES, &Reply, sizeof(hci_read_local_features_rp)); 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(); Reply.num_keys_read = (u16)m_WiiMotes.size();
} }
else else
{ {
PanicAlert("CommandReadStoredLinkKey"); PanicAlert("CommandReadStoredLinkKey");
} }
// logging // logging
LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_STORED_LINK_KEY:"); LOG(WII_IPC_WIIMOTE, "Command: HCI_CMD_READ_STORED_LINK_KEY:");
LOG(WII_IPC_WIIMOTE, "input:"); 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[0], ReadStoredLinkKey->bdaddr.b[1], ReadStoredLinkKey->bdaddr.b[2],
ReadStoredLinkKey->bdaddr.b[3], ReadStoredLinkKey->bdaddr.b[4], ReadStoredLinkKey->bdaddr.b[5]); ReadStoredLinkKey->bdaddr.b[3], ReadStoredLinkKey->bdaddr.b[4], ReadStoredLinkKey->bdaddr.b[5]);
LOG(WII_IPC_WIIMOTE, " read_all: %i", ReadStoredLinkKey->read_all); 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); SendEventCommandStatus(HCI_CMD_INQUIRY);
SendEventInquiryResponse(); SendEventInquiryResponse();
SendEventInquiryComplete(); SendEventInquiryComplete();
} }
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteInquiryScanType(u8* _Input) 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, "Command: HCI_CMD_REMOTE_NAME_REQ");
LOG(WII_IPC_WIIMOTE, "Input:"); 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[0], pRemoteNameReq->bdaddr.b[1], pRemoteNameReq->bdaddr.b[2],
pRemoteNameReq->bdaddr.b[3], pRemoteNameReq->bdaddr.b[4], pRemoteNameReq->bdaddr.b[5]); 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); 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, "Command: HCI_CMD_CREATE_CON");
LOG(WII_IPC_WIIMOTE, "Input:"); 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[0], pCreateCon->bdaddr.b[1], pCreateCon->bdaddr.b[2],
pCreateCon->bdaddr.b[3], pCreateCon->bdaddr.b[4], pCreateCon->bdaddr.b[5]); 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 #ifdef LOGGING
static char s_szRole[][128] = static char s_szRole[][128] =
{ {
{ "Master (0x00)"}, { "Master (0x00)"},
{ "Slave (0x01)"}, { "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, "Command: HCI_CMD_ACCEPT_CON");
LOG(WII_IPC_WIIMOTE, "Input:"); 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[0], pAcceptCon->bdaddr.b[1], pAcceptCon->bdaddr.b[2],
pAcceptCon->bdaddr.b[3], pAcceptCon->bdaddr.b[4], pAcceptCon->bdaddr.b[5]); pAcceptCon->bdaddr.b[3], pAcceptCon->bdaddr.b[4], pAcceptCon->bdaddr.b[5]);
LOG(WII_IPC_WIIMOTE, " role: %s", s_szRole[pAcceptCon->role]); 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); SendEventRoleChange(pAcceptCon->bdaddr, true);
} }
SendEventConnectionComplete(pAcceptCon->bdaddr); SendEventConnectionComplete(pAcceptCon->bdaddr);
} }
@ -1722,7 +1722,7 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkPolicy(u8* _Input)
if (pWiimote) if (pWiimote)
{ {
pWiimote->EventCommandWriteLinkPolicy(); pWiimote->EventCommandWriteLinkPolicy();
} }
} }
void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandAuthenticationRequested(u8* _Input) 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, "Command: HCI_CMD_LINK_KEY_NEG_REP");
LOG(WII_IPC_WIIMOTE, "Input:"); 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[0], pKeyNeg->bdaddr.b[1], pKeyNeg->bdaddr.b[2],
pKeyNeg->bdaddr.b[3], pKeyNeg->bdaddr.b[4], pKeyNeg->bdaddr.b[5]); 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, "Command: HCI_CMD_LINK_KEY_REP");
LOG(WII_IPC_WIIMOTE, "Input:"); 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[0], pKeyRep->bdaddr.b[1], pKeyRep->bdaddr.b[2],
pKeyRep->bdaddr.b[3], pKeyRep->bdaddr.b[4], pKeyRep->bdaddr.b[5]); pKeyRep->bdaddr.b[3], pKeyRep->bdaddr.b[4], pKeyRep->bdaddr.b[5]);
LOG_LinkKey(pKeyRep->key); LOG_LinkKey(pKeyRep->key);
@ -1919,8 +1919,8 @@ bool CWII_IPC_HLE_Device_usb_oh0::IOCtl(u32 _CommandAddress)
// =================================================== // ===================================================
/* IOCtlV */ /* IOCtlV */
// ---------------- // ----------------
bool CWII_IPC_HLE_Device_usb_oh0::IOCtlV(u32 _CommandAddress) bool CWII_IPC_HLE_Device_usb_oh0::IOCtlV(u32 _CommandAddress)
{ {
// write return value // write return value
Memory::Write_U32(0, _CommandAddress + 0x4); Memory::Write_U32(0, _CommandAddress + 0x4);

View file

@ -20,11 +20,11 @@
#include "WII_IPC_HLE_WiiMote.h" // Core #include "WII_IPC_HLE_WiiMote.h" // Core
#include "WII_IPC_HLE_Device_usb.h" #include "WII_IPC_HLE_Device_usb.h"
#include "../Plugins/Plugin_Wiimote.h" #include "../PluginManager.h"
#include "../Host.h" #include "../Host.h"
#include "../Core.h" #include "../Core.h"
#include "l2cap.h" // Local #include "l2cap.h" // Local
#include "WiiMote_HID_Attr.h" #include "WiiMote_HID_Attr.h"
#if defined(_MSC_VER) #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", LOGV(WII_IPC_WIIMOTE, 2, "L2Cap-SendFrame: Channel 0x%04x, Len 0x%x, DataSize 0x%x",
pHeader->CID, pHeader->Length, DataSize); pHeader->CID, pHeader->Length, DataSize);
if(pHeader->Length != DataSize) if(pHeader->Length != DataSize)
{ {
LOGV(WII_IPC_WIIMOTE, 2, "Faulty packet. It is dropped."); LOGV(WII_IPC_WIIMOTE, 2, "Faulty packet. It is dropped.");
return; 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); _dbg_assert_msg_(WII_IPC_WIIMOTE, DoesChannelExist(pHeader->CID), "SendACLFrame to unknown channel %i", pHeader->CID);
CChannelMap::iterator itr= m_Channel.find(pHeader->CID); CChannelMap::iterator itr= m_Channel.find(pHeader->CID);
Common::PluginWiimote* mote = CPluginManager::GetInstance().GetWiimote(0);
if (itr != m_Channel.end()) if (itr != m_Channel.end())
{ {
SChannel& rChannel = itr->second; SChannel& rChannel = itr->second;
@ -358,13 +359,13 @@ void CWII_IPC_HLE_WiiMote::SendACLFrame(u8* _pData, u32 _Size)
HandleSDP(pHeader->CID, pData, DataSize); HandleSDP(pHeader->CID, pData, DataSize);
break; break;
case HIDP_CONTROL_CHANNEL: case HIDP_CONTROL_CHANNEL:
PluginWiimote::Wiimote_ControlChannel(rChannel.DCID, pData, DataSize); mote->Wiimote_ControlChannel(rChannel.DCID, pData, DataSize);
break; break;
case HID_INTERRUPT_CHANNEL: case HID_INTERRUPT_CHANNEL:
ShowStatus(pData); ShowStatus(pData);
PluginWiimote::Wiimote_InterruptChannel(rChannel.DCID, pData, DataSize); mote->Wiimote_InterruptChannel(rChannel.DCID, pData, DataSize);
break; break;
default: default:
@ -446,7 +447,7 @@ void CWII_IPC_HLE_WiiMote::UpdateStatus()
void CWII_IPC_HLE_WiiMote::SignalChannel(u8* _pData, u32 _Size) 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; SL2CAP_Command* pCommand = (SL2CAP_Command*)_pData;
_pData += sizeof(SL2CAP_Command); _pData += sizeof(SL2CAP_Command);
@ -632,7 +633,7 @@ void CWII_IPC_HLE_WiiMote::CommandConnectionResponse(u8 _Ident, u8* _pData, u32
m_HIDInterruptChannel_Connected = true; 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; 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 // create the channel
SChannel& rChannel = m_Channel[scid]; 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); 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 // create the channel
SChannel& rChannel = m_Channel[scid]; 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); 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)); _dbg_assert_(WII_IPC_WIIMOTE, DoesChannelExist(scid));
SChannel& rChannel = m_Channel[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, TransactionID); Offset += 2; // transaction ID
buffer.Write16(Offset, 0x0009); Offset += 2; // param length buffer.Write16(Offset, 0x0009); Offset += 2; // param length
buffer.Write16(Offset, 0x0001); Offset += 2; // TotalServiceRecordCount 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.Write32(Offset, 0x10000); Offset += 4; // ServiceRecordHandleList[4]
buffer.Write8(Offset, 0x00); Offset++; // no continuation state; buffer.Write8(Offset, 0x00); Offset++; // no continuation state;
@ -823,7 +824,7 @@ u32 ParseCont(u8* pCont)
{ {
u32 attribOffset = 0; u32 attribOffset = 0;
CBigEndianBuffer attribList(pCont); CBigEndianBuffer attribList(pCont);
u8 typeID = attribList.Read8(attribOffset); attribOffset++; u8 typeID = attribList.Read8(attribOffset); attribOffset++;
if (typeID == 0x02) 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 sequence = attribList.Read8(attribOffset); attribOffset++; _dbg_assert_(WII_IPC_WIIMOTE, sequence == SDP_SEQ8);
u8 seqSize = attribList.Read8(attribOffset); attribOffset++; u8 seqSize = attribList.Read8(attribOffset); attribOffset++;
u8 typeID = attribList.Read8(attribOffset); attribOffset++; u8 typeID = attribList.Read8(attribOffset); attribOffset++;
if (typeID == SDP_UINT32) 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, void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 TransactionID, u32 ServiceHandle,
u16 startAttrID, u16 endAttrID, u16 startAttrID, u16 endAttrID,
u16 MaximumAttributeByteCount, u8* pContinuationState) u16 MaximumAttributeByteCount, u8* pContinuationState)
{ {
if (ServiceHandle != 0x10000) 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]); PanicAlert("Unknown SDP command %x", _pData[0]);
break; break;
} }
} }
///////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////
// //
@ -974,9 +975,9 @@ void CWII_IPC_HLE_WiiMote::SendCommandToACL(u8 _Ident, u8 _Code, u8 _CommandLeng
pHeader->Length = sizeof(SL2CAP_Command) + _CommandLength; pHeader->Length = sizeof(SL2CAP_Command) + _CommandLength;
SL2CAP_Command* pCommand = (SL2CAP_Command*)&DataFrame[Offset]; Offset += sizeof(SL2CAP_Command); SL2CAP_Command* pCommand = (SL2CAP_Command*)&DataFrame[Offset]; Offset += sizeof(SL2CAP_Command);
pCommand->len = _CommandLength; pCommand->len = _CommandLength;
pCommand->ident = _Ident; pCommand->ident = _Ident;
pCommand->code = _Code; pCommand->code = _Code;
memcpy(&DataFrame[Offset], _pCommandData, _CommandLength); 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 /* This is called continously from the Wiimote plugin as soon as it has received
a reporting mode */ 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, "========================================================="); LOGV(WII_IPC_WIIMOTE, 3, "=========================================================");
const u8* pData = (const u8*)_pData; const u8* pData = (const u8*)_pData;
@ -1038,4 +1039,4 @@ namespace Core
s_Usb->m_WiiMotes[0].SendL2capData(_channelID, _pData, _Size); s_Usb->m_WiiMotes[0].SendL2capData(_channelID, _pData, _Size);
LOGV(WII_IPC_WIIMOTE, 3, "========================================================="); LOGV(WII_IPC_WIIMOTE, 3, "=========================================================");
} }
} }

View file

@ -29,10 +29,6 @@
#include "PowerPC/PowerPC.h" // Core #include "PowerPC/PowerPC.h" // Core
#include "PowerPC/SymbolDB.h" // for g_symbolDB #include "PowerPC/SymbolDB.h" // for g_symbolDB
#include "Debugger/Debugger_SymbolMap.h" #include "Debugger/Debugger_SymbolMap.h"
#if defined(HAVE_WX) && HAVE_WX && defined(WX_CORE) // wxWidgets
#include <wx/datetime.h> // for the timestamps
#endif
///////////////////////// /////////////////////////
@ -103,7 +99,7 @@ void CDebugger_Log::Init()
#endif #endif
} }
void CDebugger_Log::Shutdown() void CDebugger_Log::Shutdown()
{ {
#ifdef LOGGING #ifdef LOGGING
if (m_pFile != NULL) 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::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::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::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::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_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); 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_Log[j*100 + i]->Init();
} }
} }
m_bInitialized = true; m_bInitialized = true;
} }
@ -230,7 +226,7 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
// security checks // security checks
if (m_Log[_type] == NULL || !m_Log[_type]->m_bEnable if (m_Log[_type] == NULL || !m_Log[_type]->m_bEnable
|| _type > (LogTypes::NUMBER_OF_LOGS + LogManager::VERBOSITY_LEVELS * 100) || _type > (LogTypes::NUMBER_OF_LOGS + LogManager::VERBOSITY_LEVELS * 100)
|| _type < 0) || _type < 0)
return; return;
// prepare message // prepare message
@ -243,9 +239,6 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
static u32 count = 0; static u32 count = 0;
char* Msg2 = (char*)alloca(strlen(_fmt)+512); 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 // Here's the old symbol request
//Debugger::FindSymbol(PC); //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 // added a simple caching function so that we don't search again if we get the same
// question again. // question again.
std::string symbol; std::string symbol;
if ((v == 0 || v == 1) && lastPC != PC && LogManager::m_LogSettings->bResolve) if ((v == 0 || v == 1) && lastPC != PC && LogManager::m_LogSettings->bResolve)
{ {
symbol = g_symbolDB.GetDescription(PC); symbol = g_symbolDB.GetDescription(PC);
@ -276,21 +269,13 @@ void LogManager::Log(LogTypes::LOG_TYPE _type, const char *_fmt, ...)
int Index = 1; int Index = 1;
const char *eol = "\n"; const char *eol = "\n";
if (Index > 0) if (Index > 0)
{ {
#if defined(HAVE_WX) && HAVE_WX && defined(WX_CORE) sprintf(Msg2, "%i %s: %x %s (%s, %08x) : %s%s",
sprintf(Msg2, "%i %02i:%02i:%03i: %x %s (%s, %08x) : %s%s",
#else
sprintf(Msg2, "%i %llu: %x %s (%s, %08x) : %s%s",
#endif
++count, ++count,
#if defined(HAVE_WX) && HAVE_WX && defined(WX_CORE) Common::Timer::GetTimeFormatted().c_str(),
datetime.GetMinute(), datetime.GetSecond(), datetime.GetMillisecond(), PowerPC::ppcState.DebugCount,
#else m_Log[_type]->m_szShortName_, // (CONSOLE etc)
Common::Timer::GetTimeSinceJan1970(), symbol.c_str(), PC, // current PC location (name, address)
#endif
PowerPC::ppcState.DebugCount,
m_Log[_type]->m_szShortName_, // (CONSOLE etc)
symbol.c_str(), PC, // current PC location (name, address)
Msg, eol); Msg, eol);
} }

View file

@ -24,38 +24,85 @@
#include "PluginManager.h" #include "PluginManager.h"
#include "StringUtil.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_Instance;
CPluginManager::CPluginManager() CPluginManager::CPluginManager()
{} {
m_PluginGlobals = new PLUGIN_GLOBALS;
m_PluginGlobals->eventHandler = EventHandler::GetInstance();
m_PluginGlobals->config = NULL;
m_PluginGlobals->messageLogger = NULL;
}
CPluginManager::~CPluginManager() 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 // 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 // Open config window. _rFilename = plugin filename ,ret = the dll slot number
// ------------- // -------------
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename) void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
{ {
Common::CPlugin::Load(_rFilename);
Common::CPlugin::Config((HWND)_Parent); Common::CPlugin *plugin = new Common::CPlugin(_rFilename);
Common::CPlugin::Release(); plugin->SetGlobals(m_PluginGlobals);
plugin->Config((HWND)_Parent);
delete plugin;
} }
// ---------------------------------------- // ----------------------------------------
// Open debugging window. Type = Video or DSP. Show = Show or hide window. // Open debugging window. Type = Video or DSP. Show = Show or hide window.
// ------------- // -------------
void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, bool Type, bool Show) void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show)
{ {
//int ret = 1; //int ret = 1;
//int ret = Common::CPlugin::Load(_rFilename, true); //int ret = Common::CPlugin::Load(_rFilename, true);
//int ret = PluginVideo::LoadPlugin(_rFilename); //int ret = PluginVideo::LoadPlugin(_rFilename);
//int ret = PluginDSP::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); //Common::CPlugin::Debug((HWND)_Parent);
if (!PluginVideo::IsLoaded()) if (!PluginVideo::IsLoaded())
PluginVideo::LoadPlugin(_rFilename); PluginVideo::LoadPlugin(_rFilename);
//PluginVideo::SetDllGlobals(m_PluginGlobals);
PluginVideo::Debug((HWND)_Parent, Show); PluginVideo::Debug((HWND)_Parent, Show);
} }
else else
{ {
if(!PluginDSP::IsLoaded()) PluginDSP::LoadPlugin(_rFilename); if(!PluginDSP::IsLoaded())
PluginDSP::LoadPlugin(_rFilename);
//PluginDSP::SetDllGlobals(m_PluginGlobals);
PluginDSP::Debug((HWND)_Parent, Show); PluginDSP::Debug((HWND)_Parent, Show);
} }*/
//Common::CPlugin::Release(); // this is only if the wx dialog is called with ShowModal() //Common::CPlugin::Release(); // this is only if the wx dialog is called with ShowModal()
//m_DllDebugger = (void (__cdecl*)(HWND))PluginVideo::plugin.Get("DllDebugger"); //m_DllDebugger = (void (__cdecl*)(HWND))PluginVideo::plugin.Get("DllDebugger");
@ -142,14 +268,15 @@ CPluginInfo::CPluginInfo(const char *_rFileName)
: m_FileName(_rFileName) : m_FileName(_rFileName)
, m_Valid(false) , 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; m_Valid = true;
else else
PanicAlert("Could not get info about plugin %s", _rFileName); 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 The DLL loading code provides enough error messages already. Possibly make some return codes

View file

@ -19,6 +19,12 @@
#define __PLUGIN_MANAGER_H_ #define __PLUGIN_MANAGER_H_
#include "Plugin.h" #include "Plugin.h"
#include "PluginDSP.h"
#include "PluginPAD.h"
#include "PluginVideo.h"
#include "PluginWiimote.h"
#include "EventHandler.h"
#include "CoreParameter.h"
class CPluginInfo class CPluginInfo
{ {
@ -40,19 +46,33 @@ class CPluginManager
{ {
public: public:
static CPluginManager& GetInstance() {return(m_Instance);} 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 ScanForPlugins();
void OpenConfig(void* _Parent, const char *_rFilename); 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);} const CPluginInfos& GetPluginInfos() {return(m_PluginInfos);}
PLUGIN_GLOBALS* GetGlobals();
private: private:
static CPluginManager m_Instance; static CPluginManager m_Instance;
bool m_Initialized; bool m_Initialized;
CPluginInfos m_PluginInfos; 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();
~CPluginManager(); ~CPluginManager();
void *LoadPlugin(const char *_rFilename);
}; };

View file

@ -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<TGetDllInfo> (plugin.Get("GetDllInfo"));
SetDllGlobals = reinterpret_cast<TSetDllGlobals> (plugin.Get("SetDllGlobals"));
DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
DllDebugger = reinterpret_cast<TDllDebugger> (plugin.Get("DllDebugger"));
DSP_Initialize = reinterpret_cast<TDSP_Initialize> (plugin.Get("DSP_Initialize"));
DSP_Shutdown = reinterpret_cast<TDSP_Shutdown> (plugin.Get("DSP_Shutdown"));
DSP_ReadMailboxHigh = reinterpret_cast<TDSP_ReadMailBox> (plugin.Get("DSP_ReadMailboxHigh"));
DSP_ReadMailboxLow = reinterpret_cast<TDSP_ReadMailBox> (plugin.Get("DSP_ReadMailboxLow"));
DSP_WriteMailboxHigh = reinterpret_cast<TDSP_WriteMailBox> (plugin.Get("DSP_WriteMailboxHigh"));
DSP_WriteMailboxLow = reinterpret_cast<TDSP_WriteMailBox> (plugin.Get("DSP_WriteMailboxLow"));
DSP_ReadControlRegister = reinterpret_cast<TDSP_ReadControlRegister> (plugin.Get("DSP_ReadControlRegister"));
DSP_WriteControlRegister = reinterpret_cast<TDSP_WriteControlRegister> (plugin.Get("DSP_WriteControlRegister"));
DSP_Update = reinterpret_cast<TDSP_Update> (plugin.Get("DSP_Update"));
DSP_SendAIBuffer = reinterpret_cast<TDSP_SendAIBuffer> (plugin.Get("DSP_SendAIBuffer"));
DSP_DoState = reinterpret_cast<TDSP_DoState> (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

View file

@ -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

View file

@ -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<TGetDllInfo> (plugin.Get("GetDllInfo"));
SetDllGlobals = reinterpret_cast<TSetDllGlobals> (plugin.Get("SetDllGlobals"));
DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
PAD_Initialize = reinterpret_cast<TPAD_Initialize> (plugin.Get("PAD_Initialize"));
PAD_Shutdown = reinterpret_cast<TPAD_Shutdown> (plugin.Get("PAD_Shutdown"));
PAD_GetStatus = reinterpret_cast<TPAD_GetStatus> (plugin.Get("PAD_GetStatus"));
PAD_Input = reinterpret_cast<TPAD_Input> (plugin.Get("PAD_Input"));
PAD_Rumble = reinterpret_cast<TPAD_Rumble> (plugin.Get("PAD_Rumble"));
PAD_GetAttachedPads = reinterpret_cast<TPAD_GetAttachedPads>(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

View file

@ -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 <string.h>
#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

View file

@ -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<TGetDllInfo> (plugin.Get("GetDllInfo"));
SetDllGlobals = reinterpret_cast<TSetDllGlobals> (plugin.Get("SetDllGlobals"));
DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
DllDebugger = reinterpret_cast<TDllDebugger> (plugin.Get("DllDebugger"));
Video_Initialize = reinterpret_cast<TVideo_Initialize> (plugin.Get("Video_Initialize"));
Video_Prepare = reinterpret_cast<TVideo_Prepare> (plugin.Get("Video_Prepare"));
Video_Shutdown = reinterpret_cast<TVideo_Shutdown> (plugin.Get("Video_Shutdown"));
Video_SendFifoData = reinterpret_cast<TVideo_SendFifoData> (plugin.Get("Video_SendFifoData"));
Video_UpdateXFB = reinterpret_cast<TVideo_UpdateXFB> (plugin.Get("Video_UpdateXFB"));
Video_Screenshot = reinterpret_cast<TVideo_Screenshot> (plugin.Get("Video_Screenshot"));
Video_EnterLoop = reinterpret_cast<TVideo_EnterLoop> (plugin.Get("Video_EnterLoop"));
Video_AddMessage = reinterpret_cast<TVideo_AddMessage> (plugin.Get("Video_AddMessage"));
Video_DoState = reinterpret_cast<TVideo_DoState> (plugin.Get("Video_DoState"));
Video_Stop = reinterpret_cast<TVideo_Stop> (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

View file

@ -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

View file

@ -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<TGetDllInfo> (plugin.Get("GetDllInfo"));
SetDllGlobals = reinterpret_cast<TSetDllGlobals> (plugin.Get("SetDllGlobals"));
DllConfig = reinterpret_cast<TDllConfig> (plugin.Get("DllConfig"));
Wiimote_Initialize = reinterpret_cast<TWiimote_Initialize> (plugin.Get("Wiimote_Initialize"));
Wiimote_Shutdown = reinterpret_cast<TWiimote_Shutdown> (plugin.Get("Wiimote_Shutdown"));
Wiimote_ControlChannel = reinterpret_cast<TWiimote_Output> (plugin.Get("Wiimote_ControlChannel"));
Wiimote_InterruptChannel = reinterpret_cast<TWiimote_Input> (plugin.Get("Wiimote_InterruptChannel"));
Wiimote_Update = reinterpret_cast<TWiimote_Update> (plugin.Get("Wiimote_Update"));
Wiimote_GetAttachedControllers = reinterpret_cast<TWiimote_GetAttachedControllers> (plugin.Get("Wiimote_GetAttachedControllers"));
Wiimote_DoState = reinterpret_cast<TWiimote_DoState> (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

View file

@ -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

View file

@ -1,11 +1,11 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
files = ["Console.cpp", files = ["Console.cpp",
"Core.cpp", "Core.cpp",
"CoreTiming.cpp", "CoreTiming.cpp",
"CoreParameter.cpp", "CoreParameter.cpp",
"Host.cpp", "Host.cpp",
"LogManager.cpp", "LogManager.cpp",
"MemTools.cpp", "MemTools.cpp",
@ -64,10 +64,10 @@ files = ["Console.cpp",
"IPC_HLE/WII_IPC_HLE_WiiMote.cpp", "IPC_HLE/WII_IPC_HLE_WiiMote.cpp",
"IPC_HLE/WII_IPC_HLE_Device_usb.cpp", "IPC_HLE/WII_IPC_HLE_Device_usb.cpp",
"IPC_HLE/WiiMote_HID_Attr.cpp", "IPC_HLE/WiiMote_HID_Attr.cpp",
"Plugins/Plugin_DSP.cpp", # "Plugins/Plugin_DSP.cpp",
"Plugins/Plugin_PAD.cpp", # "Plugins/Plugin_PAD.cpp",
"Plugins/Plugin_Video.cpp", # "Plugins/Plugin_Video.cpp",
"Plugins/Plugin_Wiimote.cpp", # "Plugins/Plugin_Wiimote.cpp",
"PowerPC/PowerPC.cpp", "PowerPC/PowerPC.cpp",
"PowerPC/PPCAnalyst.cpp", "PowerPC/PPCAnalyst.cpp",
"PowerPC/PPCTables.cpp", "PowerPC/PPCTables.cpp",

View file

@ -25,8 +25,7 @@
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "PowerPC/Jit64/Jit.h" #include "PowerPC/Jit64/Jit.h"
#include "Plugins/Plugin_Video.h" #include "PluginManager.h"
#include "Plugins/Plugin_DSP.h"
#include <string> #include <string>
@ -70,8 +69,9 @@ void DoState(PointerWrap &p)
return; return;
} }
// Begin with video plugin, so that it gets a chance to clear it's caches and writeback modified things to RAM // 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()); CPluginManager &pm = CPluginManager::GetInstance();
PluginDSP::DSP_DoState(p.GetPPtr(), p.GetMode()); pm.GetVideo()->DoState(p.GetPPtr(), p.GetMode());
pm.GetDSP()->DoState(p.GetPPtr(), p.GetMode());
PowerPC::DoState(p); PowerPC::DoState(p);
HW::DoState(p); HW::DoState(p);
CoreTiming::DoState(p); CoreTiming::DoState(p);
@ -137,7 +137,7 @@ void SaveStateCallback(u64 userdata, int cyclesLate)
delete [] buffer; delete [] buffer;
Core::DisplayMessage(StringFromFormat("Saved State to %s", Core::DisplayMessage(StringFromFormat("Saved State to %s",
cur_filename.c_str()).c_str(), 2000); cur_filename.c_str()).c_str(), 2000);
} }
@ -153,7 +153,7 @@ void LoadStateCallback(u64 userdata, int cyclesLate)
Core::DisplayMessage("State not found", 2000); Core::DisplayMessage("State not found", 2000);
return; return;
} }
jit.ClearCache(); jit.ClearCache();
u8 *buffer = NULL; u8 *buffer = NULL;

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9,00" Version="9.00"
Name="DebuggerWX" Name="DebuggerWX"
ProjectGUID="{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}" ProjectGUID="{4D3CD4C5-412B-4B49-9B1B-A68A2A129C77}"
RootNamespace="DebuggerWX" RootNamespace="DebuggerWX"
@ -46,7 +46,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
WholeProgramOptimization="false" WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;..\Common\Src;..\..\..\Externals\Bochs_disasm" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__WXMSW__;_SECURE_SCL=0" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__WXMSW__;_SECURE_SCL=0"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -113,7 +113,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
WholeProgramOptimization="false" WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;..\Common\Src;..\..\..\Externals\Bochs_disasm" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__WXMSW__;_SECURE_SCL=0" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;__WXMSW__;_SECURE_SCL=0"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -178,7 +178,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
WholeProgramOptimization="false" WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;..\Common\Src;..\..\..\Externals\Bochs_disasm" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0" RuntimeLibrary="0"
BufferSecurityCheck="false" BufferSecurityCheck="false"
@ -244,7 +244,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
WholeProgramOptimization="false" WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;..\Common\Src;..\..\..\Externals\Bochs_disasm" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;__WXMSW__;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
RuntimeLibrary="0" RuntimeLibrary="0"
BufferSecurityCheck="false" BufferSecurityCheck="false"
@ -309,7 +309,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
WholeProgramOptimization="false" WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;..\Common\Src;..\..\..\Externals\Bochs_disasm" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;DEBUGFAST" PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;DEBUGFAST"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="0" BasicRuntimeChecks="0"
@ -378,7 +378,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
WholeProgramOptimization="false" WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\Core\Src;..\Common\Src;..\..\..\Externals\Bochs_disasm" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;DEBUGFAST" PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;DEBUGFAST"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"

View file

@ -63,8 +63,6 @@
#include "PowerPC/Jit64/Jit.h" #include "PowerPC/Jit64/Jit.h"
#include "PowerPC/Jit64/JitCache.h" // for ClearCache() #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 "PluginManager.h"
#include "../../DolphinWX/Src/Config.h" #include "../../DolphinWX/Src/Config.h"
@ -144,7 +142,7 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_MENU(IDM_LOADMAPFILE, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_LOADMAPFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_SCANFUNCTIONS, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_SCANFUNCTIONS, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_SAVEMAPFILE, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_SAVEMAPFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_SAVEMAPFILEWITHCODES, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_SAVEMAPFILEWITHCODES, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_CREATESIGNATUREFILE, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_CREATESIGNATUREFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_USESIGNATUREFILE, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_USESIGNATUREFILE, CCodeWindow::OnSymbolsMenu)
EVT_MENU(IDM_PATCHHLEFUNCTIONS, CCodeWindow::OnSymbolsMenu) EVT_MENU(IDM_PATCHHLEFUNCTIONS, CCodeWindow::OnSymbolsMenu)
@ -163,7 +161,7 @@ BEGIN_EVENT_TABLE(CCodeWindow, wxFrame)
EVT_MENU(IDM_SETPC, CCodeWindow::OnCodeStep) EVT_MENU(IDM_SETPC, CCodeWindow::OnCodeStep)
EVT_MENU(IDM_GOTOPC, CCodeWindow::OnCodeStep) EVT_MENU(IDM_GOTOPC, CCodeWindow::OnCodeStep)
EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange) EVT_TEXT(IDM_ADDRBOX, CCodeWindow::OnAddrBoxChange)
EVT_COMMAND(ID_CODEVIEW, wxEVT_CODEVIEW_CHANGE, CCodeWindow::OnCodeViewChange) EVT_COMMAND(ID_CODEVIEW, wxEVT_CODEVIEW_CHANGE, CCodeWindow::OnCodeViewChange)
END_EVENT_TABLE() END_EVENT_TABLE()
/////////////////////////////// ///////////////////////////////
@ -231,7 +229,7 @@ void CCodeWindow::OnKeyDown(wxKeyEvent& event)
{ {
if ((event.GetKeyCode() == WXK_SPACE) && IsActive()) if ((event.GetKeyCode() == WXK_SPACE) && IsActive())
{ {
SingleCPUStep(); SingleCPUStep();
} }
else else
{ {
@ -419,8 +417,8 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
CPluginManager::GetInstance().OpenDebug( CPluginManager::GetInstance().OpenDebug(
GetHandle(), GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
false, true PLUGIN_TYPE_DSP, true
); );
} // don't have any else, just ignore it } // don't have any else, just ignore it
if (bVideoWindow) if (bVideoWindow)
@ -429,7 +427,7 @@ void CCodeWindow::CreateGUIControls(const SCoreStartupParameter& _LocalCoreStart
CPluginManager::GetInstance().OpenDebug( CPluginManager::GetInstance().OpenDebug(
GetHandle(), GetHandle(),
_LocalCoreStartupParameter.m_strVideoPlugin.c_str(), _LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
true, true PLUGIN_TYPE_VIDEO, true
); );
} // don't have any else, just ignore it } // don't have any else, just ignore it
} }
@ -443,7 +441,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
pMenuBar = new wxMenuBar(wxMB_DOCKABLE); pMenuBar = new wxMenuBar(wxMB_DOCKABLE);
// -------------------------------- // --------------------------------
// CPU Mode // CPU Mode
// ------------- // -------------
wxMenu* pCoreMenu = new wxMenu; wxMenu* pCoreMenu = new wxMenu;
@ -494,7 +492,7 @@ void CCodeWindow::CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParam
// wxMenuItem* dualcore = pDebugMenu->Append(IDM_DUALCORE, _T("&DualCore"), wxEmptyString, wxITEM_CHECK); // wxMenuItem* dualcore = pDebugMenu->Append(IDM_DUALCORE, _T("&DualCore"), wxEmptyString, wxITEM_CHECK);
// dualcore->Check(_LocalCoreStartupParameter.bUseDualCore); // dualcore->Check(_LocalCoreStartupParameter.bUseDualCore);
pMenuBar->Append(pCoreMenu, _T("&CPU Mode")); pMenuBar->Append(pCoreMenu, _T("&CPU Mode"));
// ----------------- // -----------------
@ -647,7 +645,7 @@ void CCodeWindow::OnCPUMode(wxCommandEvent& event)
} }
// Clear the JIT cache to enable these changes // Clear the JIT cache to enable these changes
jit.ClearCache(); jit.ClearCache();
} }
void CCodeWindow::OnJitMenu(wxCommandEvent& event) 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) void CCodeWindow::OnCodeStep(wxCommandEvent& event)
{ {

View file

@ -63,8 +63,6 @@
#include "PowerPC/Jit64/Jit.h" #include "PowerPC/Jit64/Jit.h"
#include "PowerPC/Jit64/JitCache.h" // for ClearCache() #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 "PluginManager.h"
#include "../../DolphinWX/Src/Config.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" " 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" " files with code to memory you may want to increase that to perhaps 8 MB, you can do"
" that from SymbolDB::SaveMap().") " that from SymbolDB::SaveMap().")
); );
pSymbolsMenu->AppendSeparator(); pSymbolsMenu->AppendSeparator();
pSymbolsMenu->Append(IDM_CREATESIGNATUREFILE, _T("&Create signature file...")); pSymbolsMenu->Append(IDM_CREATESIGNATUREFILE, _T("&Create signature file..."));
pSymbolsMenu->Append(IDM_USESIGNATUREFILE, _T("&Use 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) if (Core::GetState() == Core::CORE_UNINITIALIZED)
{ {
@ -360,7 +358,7 @@ void CCodeWindow::OnToggleSoundWindow(wxCommandEvent& event)
CPluginManager::GetInstance().OpenDebug( CPluginManager::GetInstance().OpenDebug(
GetHandle(), GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(),
false, true // DSP, show PLUGIN_TYPE_DSP, true // DSP, show
); );
} }
else // hide else // hide
@ -369,7 +367,7 @@ void CCodeWindow::OnToggleSoundWindow(wxCommandEvent& event)
CPluginManager::GetInstance().OpenDebug( CPluginManager::GetInstance().OpenDebug(
GetHandle(), GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin.c_str(), 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) /*if(Core::GetState() == Core::CORE_UNINITIALIZED)
{ {
wxMessageBox(_T("Warning, opening this window before a game is started \n\ 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? // TODO: add some kind of if() check here to?
CPluginManager::GetInstance().OpenDebug( CPluginManager::GetInstance().OpenDebug(
GetHandle(), GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
true, true // Video, show PLUGIN_TYPE_VIDEO, true // Video, show
); );
} }
else // hide 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( CPluginManager::GetInstance().OpenDebug(
GetHandle(), GetHandle(),
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin.c_str(),
true, false // Video, hide PLUGIN_TYPE_VIDEO, false // Video, hide
); );
} }
} }

View file

@ -1,11 +1,11 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
if not env['HAVE_WX']: if not env['HAVE_WX']:
Return() Return()
files = ["LogWindow.cpp", files = ["LogWindow.cpp",
"BreakPointDlg.cpp", "BreakPointDlg.cpp",
"BreakpointView.cpp", "BreakpointView.cpp",
"CodeView.cpp", "CodeView.cpp",
@ -13,7 +13,7 @@ files = ["LogWindow.cpp",
"CodeWindow.cpp", "CodeWindow.cpp",
"CodeWindowSJP.cpp", "CodeWindowSJP.cpp",
"CodeView.cpp", "CodeView.cpp",
"Debugger.cpp", "Debugger.cpp",
"MemoryCheckDlg.cpp", "MemoryCheckDlg.cpp",
"MemoryView.cpp", "MemoryView.cpp",
"MemoryWindow.cpp", "MemoryWindow.cpp",

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9,00" Version="9.00"
Name="DolphinWX" Name="DolphinWX"
ProjectGUID="{A72606EF-C5C1-4954-90AD-F0F93A8D97D9}" ProjectGUID="{A72606EF-C5C1-4954-90AD-F0F93A8D97D9}"
RootNamespace="DolphinWX" RootNamespace="DolphinWX"
@ -56,7 +56,7 @@
Optimization="3" Optimization="3"
InlineFunctionExpansion="0" InlineFunctionExpansion="0"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\Common\Src;..\Core\Src;..\DiscIO\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerWX\src" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\DebuggerWX\src;..\DiscIO\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="false" StringPooling="false"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -174,7 +174,7 @@
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="false" OmitFramePointers="false"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\Common\Src;..\Core\Src;..\DiscIO\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerWX\src" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\DebuggerWX\src;..\DiscIO\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS" PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -283,7 +283,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHsc " AdditionalOptions="/EHsc "
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\Common\Src;..\Core\Src;..\DiscIO\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerWX\src" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\DebuggerWX\src;..\DiscIO\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;__WXMSW__;__WXDEBUG__;_WINDOWS;NOPCH;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" PreprocessorDefinitions="WIN32;_DEBUG;__WXMSW__;__WXDEBUG__;_WINDOWS;NOPCH;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -394,7 +394,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/EHsc " AdditionalOptions="/EHsc "
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\Common\Src;..\Core\Src;..\DiscIO\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerWX\src" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\DebuggerWX\src;..\DiscIO\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;_DEBUG;__WXMSW__;__WXDEBUG__;_WINDOWS;NOPCH;_SECURE_SCL=0" PreprocessorDefinitions="WIN32;_DEBUG;__WXMSW__;__WXDEBUG__;_WINDOWS;NOPCH;_SECURE_SCL=0"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
@ -506,7 +506,7 @@
Optimization="2" Optimization="2"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\Common\Src;..\Core\Src;..\DiscIO\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerWX\src" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\DebuggerWX\src;..\DiscIO\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -621,7 +621,7 @@
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\PluginSpecs;..\..\..\Externals\LZO;..\Common\Src;..\Core\Src;..\DiscIO\Src;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\DebuggerWX\src" AdditionalIncludeDirectories="..\Common\Src;..\Core\Src;..\DebuggerWX\src;..\DiscIO\Src;..\InputCommon\Src;..\..\PluginSpecs;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc"
PreprocessorDefinitions="DEBUGFAST;WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS" PreprocessorDefinitions="DEBUGFAST;WIN32;__WXMSW__;_WINDOWS;NOPCH;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"

View file

@ -96,7 +96,7 @@ CConfigMain::CConfigMain(wxWindow* parent, wxWindowID id, const wxString& title,
{ {
// Control refreshing of the ISOs list // Control refreshing of the ISOs list
bRefreshList = false; bRefreshList = false;
// Load Wii SYSCONF // Load Wii SYSCONF
FullSYSCONFPath = FULL_WII_USER_DIR "shared2/sys/SYSCONF"; FullSYSCONFPath = FULL_WII_USER_DIR "shared2/sys/SYSCONF";
pStream = NULL; pStream = NULL;
@ -135,7 +135,15 @@ void CConfigMain::UpdateGUI()
{ {
if(Core::GetState() != Core::CORE_UNINITIALIZED) if(Core::GetState() != Core::CORE_UNINITIALIZED)
{ {
CorePage->Disable(); // Disable the Core stuff on GeneralPage
AllwaysHLEBIOS->Disable();
UseDynaRec->Disable();
UseDualCore->Disable();
LockThreads->Disable();
OptimizeQuantizers->Disable();
SkipIdle->Disable();
EnableCheats->Disable();
// --------
GamecubePage->Disable(); GamecubePage->Disable();
WiiPage->Disable(); WiiPage->Disable();
PathsPage->Disable(); PathsPage->Disable();
@ -158,7 +166,7 @@ void CConfigMain::CreateGUIControls()
Notebook->AddPage(WiiPage, wxT("Wii")); Notebook->AddPage(WiiPage, wxT("Wii"));
Notebook->AddPage(PathsPage, wxT("Paths")); Notebook->AddPage(PathsPage, wxT("Paths"));
Notebook->AddPage(PluginPage, wxT("Plugins")); Notebook->AddPage(PluginPage, wxT("Plugins"));
////////////////////////////////// //////////////////////////////////
// General page // General page
@ -396,7 +404,7 @@ void CConfigMain::CreateGUIControls()
sbWiimotePlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Wiimote")); sbWiimotePlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Wiimote"));
WiimoteSelection = new wxChoice(PluginPage, ID_WIIMOTE_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator); 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); 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(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin);
FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin); FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin);
FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin); FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin);
@ -428,11 +436,11 @@ void CConfigMain::CreateGUIControls()
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
sButtons->Add(0, 0, 1, wxEXPAND, 5); sButtons->Add(0, 0, 1, wxEXPAND, 5);
sButtons->Add(m_Close, 0, wxALL, 5); sButtons->Add(m_Close, 0, wxALL, 5);
wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL); wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(Notebook, 1, wxEXPAND|wxALL, 5); sMain->Add(Notebook, 1, wxEXPAND|wxALL, 5);
sMain->Add(sButtons, 0, wxEXPAND, 5); sMain->Add(sButtons, 0, wxEXPAND, 5);
UpdateGUI(); UpdateGUI();
this->SetSizer(sMain); this->SetSizer(sMain);
@ -446,7 +454,7 @@ void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event))
{ {
Destroy(); 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 */ save anything, it will be a corrupted file */
if(m_bSysconfOK) if(m_bSysconfOK)
{ {

View file

@ -86,7 +86,6 @@ class CConfigMain
wxNotebook *Notebook; wxNotebook *Notebook;
wxPanel *GeneralPage; wxPanel *GeneralPage;
wxPanel *CorePage;
wxPanel *GamecubePage; wxPanel *GamecubePage;
wxPanel *WiiPage; wxPanel *WiiPage;
wxPanel *PathsPage; wxPanel *PathsPage;
@ -197,7 +196,6 @@ class CConfigMain
{ {
ID_NOTEBOOK = 1000, ID_NOTEBOOK = 1000,
ID_GENERALPAGE, ID_GENERALPAGE,
ID_COREPAGE,
ID_GAMECUBEPAGE, ID_GAMECUBEPAGE,
ID_WIIPAGE, ID_WIIPAGE,
ID_PATHSPAGE, ID_PATHSPAGE,

View file

@ -51,7 +51,6 @@ be accessed from Core::GetWindowHandle().
#include "Config.h" // Core #include "Config.h" // Core
#include "Core.h" #include "Core.h"
#include "HW/DVDInterface.h" #include "HW/DVDInterface.h"
#include "Plugins/Plugin_PAD.h"
#include "State.h" #include "State.h"
#include "VolumeHandler.h" #include "VolumeHandler.h"
@ -305,12 +304,12 @@ CFrame::CFrame(wxFrame* parent,
// Create the toolbar // Create the toolbar
RecreateToolbar(); RecreateToolbar();
Show(); // Show the window Show(); // Show the window
CPluginManager::GetInstance().ScanForPlugins(); 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(SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableIsoCache);
m_GameListCtrl->Update(); m_GameListCtrl->Update();
//sizerPanel->SetSizeHints(m_Panel); //sizerPanel->SetSizeHints(m_Panel);
@ -339,7 +338,7 @@ CFrame::CFrame(wxFrame* parent,
(wxObject*)0, this); (wxObject*)0, this);
#endif #endif
// ---------- // ----------
UpdateGUI(); UpdateGUI();
} }
@ -381,7 +380,7 @@ void CFrame::OnClose(wxCloseEvent& event)
switch (nMsg) switch (nMsg)
{ {
case WM_SYSCOMMAND: case WM_SYSCOMMAND:
switch (wParam) switch (wParam)
{ {
case SC_SCREENSAVE: case SC_SCREENSAVE:
case SC_MONITORPOWER: case SC_MONITORPOWER:
@ -436,7 +435,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
else else
{ {
if(Core::GetState() != Core::CORE_UNINITIALIZED) 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(); event.Skip();
} }
} }
@ -444,7 +443,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
void CFrame::OnKeyUp(wxKeyEvent& event) void CFrame::OnKeyUp(wxKeyEvent& event)
{ {
if(Core::GetState() != Core::CORE_UNINITIALIZED) 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(); event.Skip();
} }
@ -455,7 +454,7 @@ double GetDoubleTime()
{ {
wxDateTime datetime = wxDateTime::UNow(); // Get timestamp wxDateTime datetime = wxDateTime::UNow(); // Get timestamp
u64 TmpSeconds = Common::Timer::GetTimeSinceJan1970(); // Get continous 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 /* 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 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 */ 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. // Check for mouse motion. Here we process the bHideCursor setting.
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::OnMotion(wxMouseEvent& event) void CFrame::OnMotion(wxMouseEvent& event)
{ {
event.Skip(); event.Skip();
// The following is only interesting when a game is running // 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); else PostMessage((HWND)Core::GetWindowHandle(), WM_USER, 10, 1);
#endif #endif
} }
} }
// Check for mouse status a couple of times per second for the auto hide option // 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 // 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))) wxFileExists(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.c_str(), wxConvUTF8)))
{ {
BootManager::BootCore(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM); 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))) wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8)))
{ {
BootManager::BootCore(SConfig::GetInstance().m_LastFilename); BootManager::BootCore(SConfig::GetInstance().m_LastFilename);

View file

@ -51,7 +51,6 @@ be accessed from Core::GetWindowHandle().
#include "Config.h" // Core #include "Config.h" // Core
#include "Core.h" #include "Core.h"
#include "HW/DVDInterface.h" #include "HW/DVDInterface.h"
#include "Plugins/Plugin_PAD.h"
#include "State.h" #include "State.h"
#include "VolumeHandler.h" #include "VolumeHandler.h"
@ -152,7 +151,7 @@ void CFrame::CreateMenu()
miscMenu->Check(IDM_TOGGLE_STATUSBAR, true); miscMenu->Check(IDM_TOGGLE_STATUSBAR, true);
miscMenu->AppendSeparator(); miscMenu->AppendSeparator();
miscMenu->Append(IDM_MEMCARD, _T("&Memcard manager")); 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")); m_pMenuBar->Append(miscMenu, _T("&Misc"));
// Help menu // 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_OPEN, _T("Open"), m_Bitmaps[Toolbar_FileOpen], _T("Open file..."));
toolBar->AddTool(wxID_REFRESH, _T("Refresh"), m_Bitmaps[Toolbar_Refresh], _T("Refresh")); 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->AddTool(IDM_BROWSE, _T("Browse"), m_Bitmaps[Toolbar_Browse], _T("Browse for an ISO directory..."));
toolBar->AddSeparator(); toolBar->AddSeparator();
m_pToolPlay = toolBar->AddTool(IDM_PLAY, _T("Play"), m_Bitmaps[Toolbar_Play], _T("Play")); 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")); 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 // Delete and recreate the toolbar
// ¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯
void CFrame::RecreateToolbar() void CFrame::RecreateToolbar()
{ {
wxToolBarBase* toolBar = GetToolBar(); wxToolBarBase* toolBar = GetToolBar();
long style = toolBar ? toolBar->GetWindowStyle() : TOOLBAR_STYLE; 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 /* Start the default ISO, or if we don't have a default ISO, start the last
started ISO */ 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. wxFileExists(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.
m_strDefaultGCM.c_str(), wxConvUTF8))) m_strDefaultGCM.c_str(), wxConvUTF8)))
{ {
BootManager::BootCore(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM); 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))) wxFileExists(wxString(SConfig::GetInstance().m_LastFilename.c_str(), wxConvUTF8)))
{ {
BootManager::BootCore(SConfig::GetInstance().m_LastFilename); BootManager::BootCore(SConfig::GetInstance().m_LastFilename);
@ -497,7 +496,7 @@ void CFrame::DoStop()
{ {
Core::Stop(); 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. */ "delete g_pThread" in Core.cpp. Todo: Please feel free to fix it some other way. */
//PanicAlert("%i", (int)bRenderToMain); //PanicAlert("%i", (int)bRenderToMain);
#ifdef _WIN32 #ifdef _WIN32
@ -656,8 +655,8 @@ void CFrame::OnSaveState(wxCommandEvent& event)
// ------------- // -------------
void CFrame::OnToggleToolbar(wxCommandEvent& event) void CFrame::OnToggleToolbar(wxCommandEvent& event)
{ {
wxToolBarBase* toolBar = GetToolBar(); wxToolBarBase* toolBar = GetToolBar();
if (event.IsChecked()) if (event.IsChecked())
{ {
CFrame::RecreateToolbar(); CFrame::RecreateToolbar();

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import sys import sys
@ -12,7 +12,7 @@ files = [
] ]
libs = [ libs = [
'core', 'minilzo', 'discio', 'bdisasm', 'videocommon', 'inputcommon', 'core', 'minilzo', 'discio', 'bdisasm', 'videocommon', 'inputcommon',
'common', 'z' 'common', 'z'
] ]

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')

View file

@ -43,6 +43,7 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_VideoOGL", "Plugins\Plugin_VideoOGL\Plugin_VideoOGL.vcproj", "{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin_VideoOGL", "Plugins\Plugin_VideoOGL\Plugin_VideoOGL.vcproj", "{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{48AD7E0A-25B1-4974-A1E3-03F8C438D34F} = {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} {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} {0318BA30-EF48-441A-9E10-DC85EFAE39F0} = {0318BA30-EF48-441A-9E10-DC85EFAE39F0}
{71B16F46-0B00-4EDA-B253-D6D9D03A215C} = {71B16F46-0B00-4EDA-B253-D6D9D03A215C} {71B16F46-0B00-4EDA-B253-D6D9D03A215C} = {71B16F46-0B00-4EDA-B253-D6D9D03A215C}
{E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA} = {E5D1F0C0-AA07-4841-A4EB-4CF4DAA6B0FA} {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}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DolphinWX", "Core\DolphinWX\DolphinWX.vcproj", "{A72606EF-C5C1-4954-90AD-F0F93A8D97D9}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{48AD7E0A-25B1-4974-A1E3-03F8C438D34F} = {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} {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} {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160} = {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}
{D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8} = {D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8} {D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8} = {D6E56527-BBB9-4EAD-A6EC-49D4BF6AFCD8}
{0318BA30-EF48-441A-9E10-DC85EFAE39F0} = {0318BA30-EF48-441A-9E10-DC85EFAE39F0} {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.ActiveCfg = Release|x64
{C7E5D50A-2916-464B-86A7-E10B3CC88ADA}.Release|x64.Build.0 = 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.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.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.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.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.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.ActiveCfg = Release|x64
{58E81545-241B-416E-8088-E62452EB25FA}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -41,13 +41,15 @@ extern "C" {
#endif #endif
// plugin types // plugin types
#define PLUGIN_TYPE_VIDEO 1 enum PLUGIN_TYPE {
#define PLUGIN_TYPE_DVD 2 PLUGIN_TYPE_VIDEO = 1,
#define PLUGIN_TYPE_PAD 3 PLUGIN_TYPE_DVD,
#define PLUGIN_TYPE_AUDIO 4 PLUGIN_TYPE_PAD,
#define PLUGIN_TYPE_COMPILER 5 PLUGIN_TYPE_AUDIO,
#define PLUGIN_TYPE_DSP 6 PLUGIN_TYPE_COMPILER,
#define PLUGIN_TYPE_WIIMOTE 7 PLUGIN_TYPE_DSP,
PLUGIN_TYPE_WIIMOTE,
};
#define STATE_MODE_READ 1 #define STATE_MODE_READ 1
#define STATE_MODE_WRITE 2 #define STATE_MODE_WRITE 2
@ -56,7 +58,7 @@ extern "C" {
typedef struct typedef struct
{ {
u16 Version; // Set to 0x0100 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 char Name[100]; // Name of the DLL
} PLUGIN_INFO; } PLUGIN_INFO;
@ -103,6 +105,31 @@ EXPORT void CALL DllDebugger(HWND _hParent, bool Show);
// output: none // output: none
// //
EXPORT void CALL SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals); 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) #if defined(__cplusplus)
} }
#endif #endif

View file

@ -30,22 +30,6 @@ typedef struct
TAudioGetStreaming pGetAudioStreaming; TAudioGetStreaming pGetAudioStreaming;
} DSPInitialize; } 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 // 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); 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" #include "ExportEpilog.h"
#endif #endif

View file

@ -56,24 +56,7 @@ typedef struct
// I N T E R F A C E /////////////////////////////////////////////////////////// // I N T E R F A C E ///////////////////////////////////////////////////////////
// __________________________________________________________________________________________________ // __________________________________________________________________________________________________
// Function: // 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:
// Purpose: // Purpose:
// input: // input:
// output: // output:
@ -91,7 +74,7 @@ EXPORT void CALL PAD_Input(u8 _Key, u8 _UpDown);
// __________________________________________________________________________________________________ // __________________________________________________________________________________________________
// Function: PAD_Rumble // Function: PAD_Rumble
// Purpose: 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 // output: none
// //
EXPORT void CALL PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength); 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(); 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" #include "ExportEpilog.h"
#endif #endif

View file

@ -78,14 +78,6 @@ typedef struct
// I N T E R F A C E //////////////////////////////////////////////////////////////////////////////// // 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 // Function: Video_Prepare
// Purpose: This function is called from the EmuThread before the // 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); 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 // Function: Video_ExecuteFifoBuffer
// Purpose: This function is called if data is inside the fifo-buffer // 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); 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 // Function: Video_Stop
// Purpose: Stop the video plugin before shutdown // Purpose: Stop the video plugin before shutdown

View file

@ -46,23 +46,6 @@ typedef struct
// I N T E R F A C E //////////////////////////////////////////////////////////////////////////////// // 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 // Function: Wiimote_Output
// Purpose: An L2CAP packet is passed from the Core to the Wiimote, // 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(); 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" #include "ExportEpilog.h"
#endif //_WIIMOTE_H_INCLUDED__ #endif //_WIIMOTE_H_INCLUDED__

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import sys import sys

View file

@ -85,7 +85,7 @@ class wxDLLApp : public wxApp
} }
}; };
IMPLEMENT_APP_NO_MAIN(wxDLLApp) IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
/////////////////// ///////////////////
#endif #endif
@ -163,7 +163,7 @@ void DllDebugger(HWND _hParent, bool Show)
{ {
m_frame->DoShow(); m_frame->DoShow();
} }
else if(!m_frame && Show) else if(!m_frame && Show)
{ {
m_frame = new CDebugger(NULL); m_frame = new CDebugger(NULL);
m_frame->Show(); m_frame->Show();
@ -181,7 +181,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{ {
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_DSP; _PluginInfo->Type = PLUGIN_TYPE_DSP;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin (DebugFast) "); sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin (DebugFast) ");
#else #else
#ifndef _DEBUG #ifndef _DEBUG
@ -203,18 +203,18 @@ void DllConfig(HWND _hParent)
#endif #endif
} }
void DSP_Initialize(DSPInitialize _dspInitialize) void Initialize(void *init)
{ {
g_Config.LoadDefaults(); g_Config.LoadDefaults();
g_Config.Load(); g_Config.Load();
g_dspInitialize = _dspInitialize; g_dspInitialize = *(DSPInitialize*)init;
g_pMemory = g_dspInitialize.pGetMemoryPointer(0); g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)
gpName = g_dspInitialize.pName(); // save the game name globally 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]); wprintf(L"%c", gpName[i]);
std::cout << gpName[i]; std::cout << gpName[i];
@ -242,7 +242,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize)
#endif #endif
} }
void DSP_Shutdown() void Shutdown()
{ {
if (log_ai) if (log_ai)
g_wave_writer.Stop(); g_wave_writer.Stop();
@ -266,7 +266,7 @@ void DSP_Shutdown()
#endif #endif
} }
void DSP_DoState(unsigned char **ptr, int mode) { void DoState(unsigned char **ptr, int mode) {
PointerWrap p(ptr, mode); PointerWrap p(ptr, mode);
} }

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import sys import sys

View file

@ -99,7 +99,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_DSP; _PluginInfo->Type = PLUGIN_TYPE_DSP;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin DSP-LLE Plugin (DebugFast)"); sprintf(_PluginInfo->Name, "Dolphin DSP-LLE Plugin (DebugFast)");
#else #else
#ifndef _DEBUG #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); PointerWrap p(ptr, mode);
} }
@ -196,7 +196,7 @@ void* dsp_thread_debug(void* lpParameter)
Sleep(100); Sleep(100);
} }
} }
#endif #endif
return NULL; return NULL;
} }
// ============== // ==============
@ -217,11 +217,10 @@ void dspi_req_dsp_irq()
g_dspInitialize.pGenerateDSPInterrupt(); g_dspInitialize.pGenerateDSPInterrupt();
} }
void Initialize(void *init)
void DSP_Initialize(DSPInitialize _dspInitialize)
{ {
bCanWork = true; bCanWork = true;
g_dspInitialize = _dspInitialize; g_dspInitialize = *(DSPInitialize*)init;
gdsp_init(); gdsp_init();
g_dsp.step_counter = 0; g_dsp.step_counter = 0;
@ -247,7 +246,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize)
return; // TODO: Don't let it work 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. // make the disassembled file here.
// -------------- // --------------
// Dump UCode to file... // Dump UCode to file...
@ -289,7 +288,7 @@ void DSP_Initialize(DSPInitialize _dspInitialize)
} }
void DSP_Shutdown(void) void Shutdown(void)
{ {
if (log_ai) if (log_ai)
g_wave_writer.Stop(); g_wave_writer.Stop();

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import sys import sys

View file

@ -79,7 +79,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
{ {
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_DSP; _PluginInfo->Type = PLUGIN_TYPE_DSP;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin (DebugFast) "); sprintf(_PluginInfo->Name, "Dolphin DSP-NULL Plugin (DebugFast) ");
#else #else
#ifndef _DEBUG #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); g_pMemory = g_dspInitialize.pGetMemoryPointer(0);
CDSPHandler::CreateInstance(); CDSPHandler::CreateInstance();
} }
void DSP_Shutdown() void Shutdown()
{ {
CDSPHandler::Destroy(); CDSPHandler::Destroy();
} }
void DSP_DoState(unsigned char **ptr, int mode) { void DoState(unsigned char **ptr, int mode) {
PointerWrap p(ptr, mode); PointerWrap p(ptr, mode);
} }

View file

@ -131,10 +131,10 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
if ( !wxTheApp || !wxTheApp->CallOnInit() ) if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE; return FALSE;
} }
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
break; break;
default: default:
break; break;
@ -152,7 +152,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_PAD; _PluginInfo->Type = PLUGIN_TYPE_PAD;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin KB/X360pad (DebugFast)"); sprintf(_PluginInfo->Name, "Dolphin KB/X360pad (DebugFast)");
#else #else
#ifndef _DEBUG #ifndef _DEBUG
@ -189,25 +189,27 @@ void DllConfig(HWND _hParent)
void DllDebugger(HWND _hParent, bool Show) { void DllDebugger(HWND _hParent, bool Show) {
} }
void PAD_Initialize(SPADInitialize _PADInitialize) void Initialize(void *init)
{ {
#ifdef RECORD_REPLAY #ifdef RECORD_REPLAY
LoadRecord(); LoadRecord();
#endif #endif
g_PADInitialize = _PADInitialize; g_PADInitialize = *(SPADInitialize*)init;
#ifdef _WIN32 #ifdef _WIN32
dinput.Init((HWND)g_PADInitialize.hWnd); dinput.Init((HWND)g_PADInitialize.hWnd);
#elif defined(HAVE_X11) && HAVE_X11 #elif defined(HAVE_X11) && HAVE_X11
GXdsp = (Display*)g_PADInitialize.hWnd; GXdsp = (Display*)g_PADInitialize.hWnd;
#elif defined(HAVE_COCOA) && HAVE_COCOA #elif defined(HAVE_COCOA) && HAVE_COCOA
#endif #endif
LoadConfig(); LoadConfig();
} }
void DoState(unsigned char **ptr, int mode) {
}
void PAD_Shutdown() void Shutdown()
{ {
#ifdef RECORD_STORE #ifdef RECORD_STORE
SaveRecord(); 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 stickvalue = (dinput.diks[pad[_numPAD].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 40 : 100;
int triggervalue = (dinput.diks[pad[_numPAD].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 100 : 255; int triggervalue = (dinput.diks[pad[_numPAD].keyForControl[CTL_HALFPRESS]] & 0xFF) ? 100 : 255;
// get the new keys // get the new keys
if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINLEFT]] & 0xFF){_pPADStatus->stickX -= stickvalue;} if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINLEFT]] & 0xFF){_pPADStatus->stickX -= stickvalue;}
if (dinput.diks[pad[_numPAD].keyForControl[CTL_MAINRIGHT]] & 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); 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_Shift_L || key == XK_Shift_R ||
key == XK_Control_L || key == XK_Control_R) { key == XK_Control_L || key == XK_Control_R) {
XPutBackEvent(GXdsp, &E); XPutBackEvent(GXdsp, &E);
@ -411,7 +413,7 @@ void X11_Read(int _numPAD, SPADStatus* _pPADStatus)
key = XLookupKeysym((XKeyEvent*)&E, 0); 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_Shift_L || key == XK_Shift_R ||
key == XK_Control_L || key == XK_Control_R) { key == XK_Control_L || key == XK_Control_R) {
XPutBackEvent(GXdsp, &E); 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_X]){_pPADStatus->button |= PAD_BUTTON_X;}
if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;} if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;}
if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;} if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;}
if (KeyStatus[CTL_L]) { if (KeyStatus[CTL_L]) {
_pPADStatus->button |= PAD_TRIGGER_L; _pPADStatus->button |= PAD_TRIGGER_L;
_pPADStatus->triggerLeft = triggervalue; _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_X]){_pPADStatus->button |= PAD_BUTTON_X;}
if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;} if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;}
if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;} if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;}
if (KeyStatus[CTL_L]) { if (KeyStatus[CTL_L]) {
_pPADStatus->button |= PAD_TRIGGER_L; _pPADStatus->button |= PAD_TRIGGER_L;
_pPADStatus->triggerLeft = triggervalue; _pPADStatus->triggerLeft = triggervalue;
@ -674,7 +676,7 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength)
unsigned int PAD_GetAttachedPads() unsigned int PAD_GetAttachedPads()
{ {
unsigned int connected = 0; unsigned int connected = 0;
LoadConfig(); LoadConfig();
if(pad[0].bAttached) if(pad[0].bAttached)
@ -693,7 +695,7 @@ unsigned int PAD_GetAttachedPads()
void LoadConfig() void LoadConfig()
{ {
// Initialize first pad to standard controls // Initialize first pad to standard controls
#ifdef _WIN32 #ifdef _WIN32
const int defaultKeyForControl[NUMCONTROLS] = const int defaultKeyForControl[NUMCONTROLS] =
{ {
DIK_X, //A DIK_X, //A
@ -731,7 +733,7 @@ void LoadConfig()
XK_w, XK_w,
XK_Up, //mainstick XK_Up, //mainstick
XK_Down, XK_Down,
XK_Left, XK_Left,
XK_Right, XK_Right,
XK_i, //substick XK_i, //substick
XK_K, XK_K,
@ -785,12 +787,12 @@ void LoadConfig()
file.Get(SectionName, "Rumble", &pad[i].bRumble, true); file.Get(SectionName, "Rumble", &pad[i].bRumble, true);
file.Get(SectionName, "XPad#", &pad[i].XPadPlayer); 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); (i==0)?defaultKeyForControl[x]:0);
#if defined(HAVE_X11) && HAVE_X11 #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 // keys because they're not being recognized
pad[i].keyForControl[x] = tolower(pad[i].keyForControl[x]); pad[i].keyForControl[x] = tolower(pad[i].keyForControl[x]);
#endif #endif

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import sys import sys
@ -10,10 +10,6 @@ if not env['HAVE_X11']:
print name + " must have X11 to be built" print name + " must have X11 to be built"
Return() Return()
if env['GLTEST']:
print name + " Doesn't work with testgl"
Return()
files = [ files = [
"PadSimple.cpp", "PadSimple.cpp",
@ -28,12 +24,12 @@ if padenv['HAVE_COCOA']:
] ]
if padenv['HAVE_WX']: if padenv['HAVE_WX']:
files += [ files += [
"GUI/ConfigDlg.cpp", "GUI/ConfigDlg.cpp",
] ]
if env['HAVE_X11']: if env['HAVE_X11']:
files += [ files += [
"XInputBase.cpp", "XInputBase.cpp",
] ]

View file

@ -53,7 +53,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="3" Optimization="3"
InlineFunctionExpansion="1" 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" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -155,7 +155,7 @@
Optimization="3" Optimization="3"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true" 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" PreprocessorDefinitions="_SECURE_SCL=0;WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;__WXMSW__;NOPCH"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -254,7 +254,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
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;_DEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@ -352,7 +352,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
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;_DEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE" PreprocessorDefinitions="_SECURE_SCL=0;WIN32;_DEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
@ -451,7 +451,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="3" Optimization="3"
InlineFunctionExpansion="1" 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;DEBUGFAST;_SECURE_SCL=0" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;DEBUGFAST;_SECURE_SCL=0"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -553,7 +553,7 @@
Optimization="3" Optimization="3"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true" 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;DEBUGFAST" PreprocessorDefinitions="_SECURE_SCL=0;WIN32;NDEBUG;_WINDOWS;_USRDLL;PAD_SIMPLE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;DEBUGFAST"
StringPooling="true" StringPooling="true"
RuntimeLibrary="0" RuntimeLibrary="0"

View file

@ -24,7 +24,7 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CLOSE(ConfigDialog::OnClose) EVT_CLOSE(ConfigDialog::OnClose)
EVT_BUTTON(ID_CLOSE,ConfigDialog::OnCloseClick) EVT_BUTTON(ID_CLOSE,ConfigDialog::OnCloseClick)
EVT_BUTTON(ID_PAD_ABOUT,ConfigDialog::DllAbout) EVT_BUTTON(ID_PAD_ABOUT,ConfigDialog::DllAbout)
EVT_CHECKBOX(ID_ATTACHED,ConfigDialog::ControllerSettingsChanged) EVT_CHECKBOX(ID_ATTACHED,ConfigDialog::ControllerSettingsChanged)
EVT_CHECKBOX(ID_X360PAD,ConfigDialog::ControllerSettingsChanged) EVT_CHECKBOX(ID_X360PAD,ConfigDialog::ControllerSettingsChanged)
EVT_CHOICE(ID_X360PAD_CHOICE,ConfigDialog::ControllerSettingsChanged) EVT_CHOICE(ID_X360PAD_CHOICE,ConfigDialog::ControllerSettingsChanged)
EVT_CHECKBOX(ID_RUMBLE,ConfigDialog::ControllerSettingsChanged) EVT_CHECKBOX(ID_RUMBLE,ConfigDialog::ControllerSettingsChanged)
@ -69,13 +69,13 @@ inline void AddControl(wxPanel *pan, wxButton **button, wxStaticBoxSizer *sizer,
wxBoxSizer *hButton = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer *hButton = new wxBoxSizer(wxHORIZONTAL);
char keyStr[10] = {0}; char keyStr[10] = {0};
hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name), hButton->Add(new wxStaticText(pan, 0, wxString::FromAscii(name),
wxDefaultPosition, wxDefaultSize), 0, wxDefaultPosition, wxDefaultSize), 0,
wxALIGN_CENTER_VERTICAL|wxALL); wxALIGN_CENTER_VERTICAL|wxALL);
((EventHandler *)globals->eventHandler)->SFKeyToString ((EventHandler *)globals->eventHandler)->SFKeyToString
(pad[controller].keyForControl[ctl], keyStr); (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); wxDefaultPosition, wxDefaultSize, wxWANTS_CHARS);
hButton->Add(*button, 0, wxALIGN_RIGHT|wxALL); hButton->Add(*button, 0, wxALIGN_RIGHT|wxALL);
@ -115,7 +115,7 @@ void ConfigDialog::CreateGUIControls() {
this->SetSizer(sMain); this->SetSizer(sMain);
this->Layout(); this->Layout();
for(int i = 0; i < 4; i++) { for(int i = 0; i < 4; i++) {
sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings")); sbDevice[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Controller Settings"));
sDevice[i] = new wxBoxSizer(wxHORIZONTAL); 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_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_Attached[i]->SetValue(pad[i].bAttached);
m_Disable[i]->SetValue(pad[i].bDisable); m_Disable[i]->SetValue(pad[i].bDisable);
sDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1); sDevice[i]->Add(m_Attached[i], 0, wxEXPAND|wxALL, 1);
sDevice[i]->AddStretchSpacer(); sDevice[i]->AddStretchSpacer();
sDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1); sDevice[i]->Add(m_Disable[i], 0, wxEXPAND|wxALL, 1);
sbDevice[i]->Add(sDevice[i], 0, wxEXPAND|wxALL, 1); sbDevice[i]->Add(sDevice[i], 0, wxEXPAND|wxALL, 1);
sButtons[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Buttons")); 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_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_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_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_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_ButtonZ[i]), sButtons[i], "Z: ", CTL_Z, i);
AddControl(m_Controller[i], &(m_ButtonStart[i]), sButtons[i], "Start: ", CTL_START, i); AddControl(m_Controller[i], &(m_ButtonStart[i]), sButtons[i], "Start: ", CTL_START, i);
sTriggers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Triggers")); 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_ButtonL[i]), sTriggers[i], " L: ", CTL_L, i);
AddControl(m_Controller[i], &(m_ButtonR[i]), sTriggers[i], " R: ", CTL_R, i); AddControl(m_Controller[i], &(m_ButtonR[i]), sTriggers[i], " R: ", CTL_R, i);
sModifiers[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Modifiers")); 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); 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")); 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_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_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_StickLeft[i]), sStick[i], "Left: ", CTL_MAINLEFT, i);
AddControl(m_Controller[i], &(m_StickRight[i]), sStick[i], "Right: ", CTL_MAINRIGHT, 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")); 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_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_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_DPadLeft[i]), sDPad[i], "Left: ", CTL_DPADLEFT, i);
AddControl(m_Controller[i], &(m_DPadRight[i]), sDPad[i], "Right: ", CTL_DPADRIGHT, 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")); 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_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_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_CStickLeft[i]), sCStick[i], "Left: ", CTL_SUBLEFT, i);
AddControl(m_Controller[i], &(m_CStickRight[i]), sCStick[i], "Right: ", CTL_SUBRIGHT, i); AddControl(m_Controller[i], &(m_CStickRight[i]), sCStick[i], "Right: ", CTL_SUBRIGHT, i);
sPage[i] = new wxGridBagSizer(0, 0); sPage[i] = new wxGridBagSizer(0, 0);
sPage[i]->SetFlexibleDirection(wxBOTH); sPage[i]->SetFlexibleDirection(wxBOTH);
sPage[i]->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED); sPage[i]->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
@ -190,13 +190,12 @@ void ConfigDialog::OnClose(wxCloseEvent& event) {
void ConfigDialog::OnKeyDown(wxKeyEvent& event) { void ConfigDialog::OnKeyDown(wxKeyEvent& event) {
if(clickedButton != NULL) { if(clickedButton != NULL) {
int page = m_Notebook->GetSelection(); int page = m_Notebook->GetSelection();
static EventHandler *eventHandler = (EventHandler *)globals->eventHandler; EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
fprintf(stderr, "Got key code %d\n",event.GetKeyCode()); fprintf(stderr, "Got key code %d\n",event.GetKeyCode());
sf::Key::Code sfcode = eventHandler->wxCharCodeToSF(event.GetKeyCode()); sf::Key::Code sfcode = eventHandler->wxCharCodeToSF(event.GetKeyCode());
char sfstr[100]; char sfstr[100];
eventHandler->SFKeyToString(sfcode, sfstr); eventHandler->SFKeyToString(sfcode, sfstr);
// pad[page].keyForControl[clickedButton->GetId()] = sfcode;
if (registerKey(page, clickedButton->GetId(), sfcode)) if (registerKey(page, clickedButton->GetId(), sfcode))
clickedButton->SetLabel(wxString::FromAscii(sfstr)); clickedButton->SetLabel(wxString::FromAscii(sfstr));
clickedButton->Disconnect(); clickedButton->Disconnect();

View file

@ -54,7 +54,7 @@ static const char* controlNames[] =
"Mic-button", "Mic-button",
}; };
PLUGIN_GLOBALS* globals; PLUGIN_GLOBALS* globals = NULL;
SPads pad[4]; SPads pad[4];
bool KeyStatus[NUMCONTROLS]; bool KeyStatus[NUMCONTROLS];
@ -92,7 +92,7 @@ const SPADStatus& PlayRecord()
bool registerKey(int nPad, int id, sf::Key::Code code, int mods) { bool registerKey(int nPad, int id, sf::Key::Code code, int mods) {
Keys key, oldKey; Keys key, oldKey;
static EventHandler *eventHandler = (EventHandler *)globals->eventHandler; EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
key.inputType = KeyboardInput; key.inputType = KeyboardInput;
key.keyCode = code; 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 // We need to handle mod change
// and double registers // and double registers
if (pad[nPad].keyForControl[id] != 0) { 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.keyCode = pad[nPad].keyForControl[id];
oldKey.mods = mods; oldKey.mods = mods;
// Might be not be registered yet // Might be not be registered yet
// eventHandler->RemoveEventListener(oldKey); // eventHandler->RemoveEventListener(oldKey);
} }
pad[nPad].keyForControl[id] = code; pad[nPad].keyForControl[id] = code;
@ -182,10 +182,10 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
if ( !wxTheApp || !wxTheApp->CallOnInit() ) if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE; return FALSE;
} }
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
break; break;
default: default:
break; break;
@ -203,7 +203,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_PAD; _PluginInfo->Type = PLUGIN_TYPE_PAD;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin event pad (DebugFast)"); sprintf(_PluginInfo->Name, "Dolphin event pad (DebugFast)");
#elif defined _DEBUG #elif defined _DEBUG
sprintf(_PluginInfo->Name, "Dolphin event pad (Debug)"); sprintf(_PluginInfo->Name, "Dolphin event pad (Debug)");
@ -228,17 +228,20 @@ void DllConfig(HWND _hParent)
void DllDebugger(HWND _hParent, bool Show) { 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 #ifdef RECORD_REPLAY
LoadRecord(); LoadRecord();
#endif #endif
g_PADInitialize = *(SPADInitialize*)init;
LoadConfig(); LoadConfig();
} }
void PAD_Shutdown() void Shutdown()
{ {
#ifdef RECORD_STORE #ifdef RECORD_STORE
SaveRecord(); SaveRecord();
@ -318,7 +321,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
if (KeyStatus[CTL_X]){_pPADStatus->button |= PAD_BUTTON_X;} if (KeyStatus[CTL_X]){_pPADStatus->button |= PAD_BUTTON_X;}
if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;} if (KeyStatus[CTL_Y]){_pPADStatus->button |= PAD_BUTTON_Y;}
if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;} if (KeyStatus[CTL_Z]){_pPADStatus->button |= PAD_TRIGGER_Z;}
if (KeyStatus[CTL_L]) { if (KeyStatus[CTL_L]) {
_pPADStatus->button |= PAD_TRIGGER_L; _pPADStatus->button |= PAD_TRIGGER_L;
_pPADStatus->triggerLeft = triggervalue; _pPADStatus->triggerLeft = triggervalue;
@ -348,7 +351,7 @@ void PAD_Rumble(u8 _numPAD, unsigned int _uType, unsigned int _uStrength) {
unsigned int PAD_GetAttachedPads() unsigned int PAD_GetAttachedPads()
{ {
unsigned int connected = 0; unsigned int connected = 0;
LoadConfig(); LoadConfig();
if(pad[0].bAttached) if(pad[0].bAttached)
@ -377,7 +380,7 @@ void LoadConfig()
sf::Key::W, sf::Key::W,
sf::Key::Up, //mainstick sf::Key::Up, //mainstick
sf::Key::Down, sf::Key::Down,
sf::Key::Left, sf::Key::Left,
sf::Key::Right, sf::Key::Right,
sf::Key::I, //substick sf::Key::I, //substick
sf::Key::K, sf::Key::K,

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import sys import sys
@ -15,7 +15,7 @@ files = [
padeenv = env.Clone() padeenv = env.Clone()
if padeenv['HAVE_WX']: if padeenv['HAVE_WX']:
files += [ files += [
"GUI/ConfigDlg.cpp", "GUI/ConfigDlg.cpp",
] ]

View file

@ -143,11 +143,11 @@ void DeInit()
} }
} }
void GetDllInfo (PLUGIN_INFO* _PluginInfo) void GetDllInfo (PLUGIN_INFO* _PluginInfo)
{ {
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_VIDEO; _PluginInfo->Type = PLUGIN_TYPE_VIDEO;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf_s(_PluginInfo->Name, 100, "Dolphin Direct3D9 (DebugFast)"); sprintf_s(_PluginInfo->Name, 100, "Dolphin Direct3D9 (DebugFast)");
#else #else
#ifndef _DEBUG #ifndef _DEBUG
@ -161,7 +161,7 @@ void GetDllInfo (PLUGIN_INFO* _PluginInfo)
void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) { void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
} }
void DllAbout(HWND _hParent) void DllAbout(HWND _hParent)
{ {
DialogBox(g_hInstance,(LPCSTR)IDD_ABOUT,_hParent,(DLGPROC)AboutProc); 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; frameCount = 0;
g_VideoInitialize = *_pVideoInitialize; g_VideoInitialize = *_pVideoInitialize;
Init(); 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 // Clear all caches
TextureCache::Invalidate(); TextureCache::Invalidate();
@ -219,7 +218,7 @@ void Video_Prepare(void)
OpcodeDecoder_Init(); OpcodeDecoder_Init();
} }
void Video_Shutdown(void) void Shutdown(void)
{ {
Fifo_Shutdown(); Fifo_Shutdown();
OpcodeDecoder_Shutdown(); OpcodeDecoder_Shutdown();
@ -230,7 +229,7 @@ void Video_Shutdown(void)
DeInit(); 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) if (D3D::dev == NULL)
return S_FALSE; return S_FALSE;
@ -293,13 +292,13 @@ HRESULT ScreenShot(TCHAR *File)
if (FAILED(D3D::dev->GetFrontBufferData(0, surf))) if (FAILED(D3D::dev->GetFrontBufferData(0, surf)))
{ {
surf->Release(); surf->Release();
return S_FALSE; return S_FALSE;
} }
RECT rect; RECT rect;
::GetWindowRect(EmuWindow::GetWnd(), &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(); surf->Release();
return S_FALSE; return S_FALSE;

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9,00" Version="9.00"
Name="Plugin_VideoOGL" Name="Plugin_VideoOGL"
ProjectGUID="{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}" ProjectGUID="{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}"
RootNamespace="Plugin_VideoOGL" RootNamespace="Plugin_VideoOGL"
@ -165,7 +165,7 @@
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="false" OmitFramePointers="false"
WholeProgramOptimization="true" WholeProgramOptimization="true"
AdditionalIncludeDirectories="../../PluginSpecs;../../Core/Common/Src;../../Core/VideoCommon/Src;./Src;./Src/Windows;../../../Externals;..\..\..\Externals\libjpeg;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\Glew" AdditionalIncludeDirectories="../../Core/InputCommon/Src;../../PluginSpecs;../../Core/Common/Src;../../Core/VideoCommon/Src;./Src;./Src/Windows;../../../Externals;..\..\..\Externals\libjpeg;..\..\..\Externals\wxWidgets\Include;..\..\..\Externals\wxWidgets\Include\msvc;..\..\..\Externals\Glew"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_SECURE_SCL=0"
StringPooling="true" StringPooling="true"
ExceptionHandling="1" ExceptionHandling="1"
@ -937,6 +937,10 @@
RelativePath=".\Src\GLUtil.h" RelativePath=".\Src\GLUtil.h"
> >
</File> </File>
<File
RelativePath=".\Src\GLWindow.h"
>
</File>
<File <File
RelativePath=".\Src\main.cpp" RelativePath=".\Src\main.cpp"
> >

View file

@ -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 #if USE_SDL
SDL_WM_SetCaption(text, NULL); 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 * Tell X to ask the window manager to set the window title. (X
* itself doesn't provide window title functionality.) * itself doesn't provide window title functionality.)
*/ */
XStoreName(GLWin.dpy, GLWin.win, text); XStoreName(GLWin.dpy, GLWin.win, text);
#endif #endif
} }
@ -130,7 +130,7 @@ unsigned int Callback_PeekMessages()
DispatchMessage(&msg); DispatchMessage(&msg);
} }
return TRUE; return TRUE;
#else #else
return FALSE; return FALSE;
#endif #endif
} }
@ -147,7 +147,7 @@ void UpdateFPSDisplay(const char *text)
// Create rendering window. // Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize() // 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 // 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}; int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0};
wxSize size(_iwidth, _iheight); wxSize size(_iwidth, _iheight);
if (!g_Config.renderToMainframe || if (!g_Config.renderToMainframe ||
g_VideoInitialize.pWindowHandle == NULL) { 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); -1, _("Dolphin"), wxPoint(0,0), size);
} else { } else {
GLWin.frame = new wxFrame((wxWindow *)NULL, GLWin.frame = new wxFrame((wxWindow *)NULL,
-1, _("Dolphin"), wxPoint(0,0), size); -1, _("Dolphin"), wxPoint(0,0), size);
} }
GLWin.glCanvas = new wxGLCanvas(GLWin.frame, wxID_ANY, args, 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"); g_VideoInitialize.pSysMessage("failed to create window");
return false; return false;
} }
GLuint PixelFormat; // Holds The Results After Searching For A Match GLuint PixelFormat; // Holds The Results After Searching For A Match
DWORD dwExStyle; // Window Extended Style DWORD dwExStyle; // Window Extended Style
DWORD dwStyle; // Window 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 // attributes for a single buffered visual in RGBA format with at least
// 8 bits per color and a 24 bit depth buffer // 8 bits per color and a 24 bit depth buffer
int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8, int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8, GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8, GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24, GLX_DEPTH_SIZE, 24,
None}; 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 // 8 bits per color and a 24 bit depth buffer
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER, int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
GLX_RED_SIZE, 8, GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8, GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8, GLX_BLUE_SIZE, 8,
GLX_DEPTH_SIZE, 24, GLX_DEPTH_SIZE, 24,
GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode, GLX_SAMPLES_ARB, 1, None }; GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode, GLX_SAMPLES_ARB, 1, None };
GLWin.dpy = XOpenDisplay(0); GLWin.dpy = XOpenDisplay(0);
@ -563,7 +563,7 @@ bool OpenGL_MakeCurrent()
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y, XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth); &GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
ERROR_LOG("GLWin Depth %d", 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!"); ERROR_LOG("you have Direct Rendering!");
else else
ERROR_LOG("no Direct Rendering possible!"); ERROR_LOG("no Direct Rendering possible!");
@ -657,10 +657,10 @@ void OpenGL_Update()
break; break;
case KeyPress: case KeyPress:
key = XLookupKeysym((XKeyEvent*)&event, 0); key = XLookupKeysym((XKeyEvent*)&event, 0);
if(key >= XK_F1 && key <= XK_F9) if(key >= XK_F1 && key <= XK_F9)
FKeyPressed = key - 0xff4e; FKeyPressed = key - 0xff4e;
else { else {
if(key == XK_Shift_L || key == XK_Shift_R) if(key == XK_Shift_L || key == XK_Shift_R)
ShiftPressed = true; ShiftPressed = true;
else if(key == XK_Control_L || key == XK_Control_R) else if(key == XK_Control_L || key == XK_Control_R)
ControlPressed = true; ControlPressed = true;
@ -685,8 +685,8 @@ void OpenGL_Update()
rcWindow.bottom = GLWin.height; rcWindow.bottom = GLWin.height;
break; break;
case ClientMessage: //TODO: We aren't reading this correctly, It could be anything, highest chance is that it's a close event though 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 Shutdown(); // Calling from here since returning false does nothing
return; return;
break; break;
default: default:
//TODO: Should we put the event back if we don't handle it? //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 /* MValueX and MValueY will be used in
TextureMngr and VertexShaderManager: Rescale textures on resolution changes TextureMngr and VertexShaderManager: Rescale textures on resolution changes
BPStructs.cpp: Control glScissor() BPStructs.cpp: Control glScissor()
*/ */
// ------------------ // ------------------
float FactorW = 640.0f / (float)nBackbufferWidth; float FactorW = 640.0f / (float)nBackbufferWidth;
@ -731,7 +731,7 @@ void OpenGL_Update()
nXoff = (int)((nBackbufferWidth - (640 * MValueX)) / 2); nXoff = (int)((nBackbufferWidth - (640 * MValueX)) / 2);
nYoff = (int)((nBackbufferHeight - (480 * MValueY)) / 2); nYoff = (int)((nBackbufferHeight - (480 * MValueY)) / 2);
} }
// tell the debugger // tell the debugger
gleft = rcWindow.left; gright = rcWindow.right; gleft = rcWindow.left; gright = rcWindow.right;
gtop = rcWindow.top; gbottom = rcWindow.bottom; gtop = rcWindow.top; gbottom = rcWindow.bottom;

View file

@ -8,9 +8,9 @@
#include "Config.h" #include "Config.h"
#include "pluginspecs_video.h" #include "pluginspecs_video.h"
#include <GL/glew.h> #include <GLew/glew.h>
#if defined(__APPLE__) #if defined(__APPLE__)
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#else #else
#include <GL/gl.h> #include <GL/gl.h>
@ -38,16 +38,17 @@ class GLWindow {
protected: protected:
res origRes, currFullRes, currWinRes; EventHandler* eventHandler;
res origRes, currFullRes, currWinRes;
std::vector<res> fullResolutions; std::vector<res> fullResolutions;
std::vector<res> winResolutions; std::vector<res> winResolutions;
virtual void SetRender(u32 x, u32 y) { virtual void SetRender(u32 x, u32 y) {
xRender = x; xRender = x;
yRender = y; yRender = y;
} }
public: public:
virtual void SwapBuffers() {}; virtual void SwapBuffers() {};
virtual void SetWindowText(const char *text) {}; virtual void SetWindowText(const char *text) {};
virtual bool PeekMessages() {return false;}; virtual bool PeekMessages() {return false;};
@ -55,15 +56,15 @@ public:
virtual bool MakeCurrent() {return false;}; virtual bool MakeCurrent() {return false;};
virtual void updateDim() { virtual void updateDim() {
if (GetProperty(OGL_FULLSCREEN)) if (GetProperty(OGL_FULLSCREEN))
SetWinSize(currFullRes.x, currFullRes.y); SetWinSize(currFullRes.x, currFullRes.y);
else else
SetWinSize(currWinRes.x, currWinRes.y); SetWinSize(currWinRes.x, currWinRes.y);
float FactorX = 640.0f / (float)GetXwin(); float FactorX = 640.0f / (float)GetXwin();
float FactorY = 480.0f / (float)GetYwin(); float FactorY = 480.0f / (float)GetYwin();
float Max = (FactorX < FactorY) ? FactorX : FactorY; float Max = (FactorX < FactorY) ? FactorX : FactorY;
if(GetProperty(OGL_STRETCHTOFIT)) { if(GetProperty(OGL_STRETCHTOFIT)) {
SetMax(1.0f / FactorX, 1.0f / FactorY); SetMax(1.0f / FactorX, 1.0f / FactorY);
SetOffset(0,0); SetOffset(0,0);
@ -74,8 +75,9 @@ public:
} }
} }
bool GetProperty(OGL_Props prop) {return properties[prop];} void SetEventHandler(EventHandler *eh) { eventHandler = eh;}
virtual bool SetProperty(OGL_Props prop, bool value) bool GetProperty(OGL_Props prop) {return properties[prop];}
virtual bool SetProperty(OGL_Props prop, bool value)
{return properties[prop] = value;} {return properties[prop] = value;}
u32 GetXrender() {return xRender;} u32 GetXrender() {return xRender;}
@ -84,8 +86,8 @@ public:
u32 GetXwin() {return xWin;} u32 GetXwin() {return xWin;}
u32 GetYwin() {return yWin;} u32 GetYwin() {return yWin;}
void SetWinSize(u32 x, u32 y) { void SetWinSize(u32 x, u32 y) {
xWin = x; xWin = x;
yWin = y; yWin = y;
} }
int GetYoff() {return yOffset;} int GetYoff() {return yOffset;}
@ -102,16 +104,16 @@ public:
float GetXmax() {return xMax;} float GetXmax() {return xMax;}
float GetYmax() {return yMax;} float GetYmax() {return yMax;}
static bool valid() { return false;} static bool valid() { return false;}
GLWindow() { GLWindow() {
// Load defaults // Load defaults
sscanf(g_Config.iFSResolution, "%dx%d", sscanf(g_Config.iFSResolution, "%dx%d",
&currFullRes.x, &currFullRes.y); &currFullRes.x, &currFullRes.y);
sscanf(g_Config.iWindowedRes, "%dx%d", sscanf(g_Config.iWindowedRes, "%dx%d",
&currWinRes.x, &currWinRes.y); &currWinRes.x, &currWinRes.y);
SetProperty(OGL_FULLSCREEN, g_Config.bFullscreen); SetProperty(OGL_FULLSCREEN, g_Config.bFullscreen);

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
# can we import path in one place? # can we import path in one place?
@ -47,7 +47,7 @@ else:
files += [ files += [
'main.cpp', 'main.cpp',
'GLUtil.cpp', 'GLUtil.cpp',
] ]
if gfxenv['HAVE_WX']: if gfxenv['HAVE_WX']:
files += [ files += [
'GUI/ConfigDlg.cpp', 'GUI/ConfigDlg.cpp',
@ -79,11 +79,11 @@ if sys.platform == 'darwin':
Return() Return()
else: 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" print name + " must have opengl and glu to be build"
Return() 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" print name + " must have cg and cggl to be build"
Return() Return()
@ -101,7 +101,7 @@ conf.Finish()
if gfxenv['GLTEST']: if gfxenv['GLTEST']:
if gfxenv['HAVE_XXF86VM']: if gfxenv['HAVE_XXF86VM']:
files += [ files += [
'X11Window.cpp', 'X11Window.cpp',
] ]

View file

@ -1,7 +1,5 @@
#include "X11Window.h" #include "X11Window.h"
static EventHandler *eventHandler = (EventHandler *)globals->eventHandler;
X11Window::X11Window() : GLWindow() { X11Window::X11Window() : GLWindow() {
XVisualInfo *vi; XVisualInfo *vi;
@ -175,7 +173,6 @@ bool X11Window::PeekMessages() {
// Taken from sfml code // Taken from sfml code
void X11Window::ProcessEvent(XEvent WinEvent) { void X11Window::ProcessEvent(XEvent WinEvent) {
// static EventHandler *eventHandler = EventHandler::GetInstance();
switch (WinEvent.type) { switch (WinEvent.type) {
case KeyPress : case KeyPress :

View file

@ -69,7 +69,7 @@ void DllDebugger(HWND _hParent, bool Show)
{ {
m_frame->DoShow(); m_frame->DoShow();
} }
else if(!m_frame && Show) else if(!m_frame && Show)
{ {
m_frame = new CDebugger(NULL); m_frame = new CDebugger(NULL);
m_frame->Show(); m_frame->Show();
@ -91,11 +91,11 @@ void DoDllDebugger() { }
#endif #endif
void GetDllInfo (PLUGIN_INFO* _PluginInfo) void GetDllInfo (PLUGIN_INFO* _PluginInfo)
{ {
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_VIDEO; _PluginInfo->Type = PLUGIN_TYPE_VIDEO;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin OpenGL (DebugFast)"); sprintf(_PluginInfo->Name, "Dolphin OpenGL (DebugFast)");
#else #else
#ifndef _DEBUG #ifndef _DEBUG
@ -125,9 +125,9 @@ void DllConfig(HWND _hParent)
dmi.dmSize = sizeof(dmi); dmi.dmSize = sizeof(dmi);
std::string resos[100]; std::string resos[100];
int i = 0; int i = 0;
while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0) while (EnumDisplaySettings(NULL, iModeNum++, &dmi) != 0)
{ {
char szBuffer[100]; char szBuffer[100];
sprintf(szBuffer,"%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight); sprintf(szBuffer,"%dx%d", dmi.dmPelsWidth, dmi.dmPelsHeight);
std::string strBuffer(szBuffer); std::string strBuffer(szBuffer);
@ -157,9 +157,9 @@ void DllConfig(HWND _hParent)
g_Config.Load(); g_Config.Load();
frame.ShowModal(); 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 HAVE_XXF86VM && defined(HAVE_WX) && HAVE_WX
ConfigDialog frame(NULL); ConfigDialog frame(NULL);
g_Config.Load(); g_Config.Load();
int glxMajorVersion, glxMinorVersion; int glxMajorVersion, glxMinorVersion;
@ -176,9 +176,9 @@ void DllConfig(HWND _hParent)
bestMode = 0; bestMode = 0;
XF86VidModeGetAllModeLines(GLWin.dpy, GLWin.screen, &modeNum, &modes); XF86VidModeGetAllModeLines(GLWin.dpy, GLWin.screen, &modeNum, &modes);
int px = 0, py = 0; 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) if(px != modes[i]->hdisplay && py != modes[i]->vdisplay)
{ {
@ -200,11 +200,8 @@ void DllConfig(HWND _hParent)
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Initialize video // 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 /* Dolphin currently crashes if the dll is loaded when a game is started so we close the
debugger and open it again after loading debugger and open it again after loading
@ -214,12 +211,13 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize)
if(m_frame) if(m_frame)
{ {
m_frame->EndModal(0); wxEntryCleanup(); m_frame->EndModal(0); wxEntryCleanup();
}//use wxUninitialize() if you don't want GUI }//use wxUninitialize() if you don't want GUI
*/ */
// -------------------------------------------------- // --------------------------------------------------
frameCount = 0; 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(); InitLUTs();
InitXFBConvTables(); InitXFBConvTables();
g_Config.Load(); g_Config.Load();
@ -238,7 +236,7 @@ void Video_Initialize(SVideoInitialize* _pVideoInitialize)
Renderer::AddMessage("Dolphin OpenGL Video Plugin" ,5000); Renderer::AddMessage("Dolphin OpenGL Video Plugin" ,5000);
} }
void Video_DoState(unsigned char **ptr, int mode) { void DoState(unsigned char **ptr, int mode) {
//#ifdef _WIN32 //#ifdef _WIN32
// What is this code doing here? // What is this code doing here?
// if (!wglMakeCurrent(hDC,hRC)) { // if (!wglMakeCurrent(hDC,hRC)) {
@ -249,7 +247,7 @@ void Video_DoState(unsigned char **ptr, int mode) {
// cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin); // cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
//#elif defined(HAVE_X11) && HAVE_X11 //#elif defined(HAVE_X11) && HAVE_X11
// glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx); // glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
//#endif //#endif
#ifndef _WIN32 #ifndef _WIN32
// WHY is this here?? // WHY is this here??
OpenGL_MakeCurrent(); OpenGL_MakeCurrent();
@ -293,7 +291,7 @@ void Video_Prepare(void)
TextureConverter::Init(); TextureConverter::Init();
} }
void Video_Shutdown(void) void Shutdown(void)
{ {
TextureConverter::Shutdown(); TextureConverter::Shutdown();
VertexLoaderManager::Shutdown(); VertexLoaderManager::Shutdown();
@ -309,7 +307,7 @@ void Video_Shutdown(void)
OpenGL_Shutdown(); OpenGL_Shutdown();
} }
void Video_Stop(void) void Video_Stop(void)
{ {
Fifo_Stop(); Fifo_Stop();
} }
@ -334,7 +332,7 @@ void DebugLog(const char* _fmt, ...)
#endif #endif
} }
bool ScreenShot(TCHAR *File) bool ScreenShot(TCHAR *File)
{ {
char str[64]; char str[64];
int left = 200, top = 15; int left = 200, top = 15;

View file

@ -67,6 +67,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize,
if (! glWin) if (! glWin)
return false; return false;
glWin->SetEventHandler((EventHandler *)globals->eventHandler);
return true; return true;
} }

View file

@ -57,7 +57,7 @@ class wxDLLApp : public wxApp
return true; return true;
} }
}; };
IMPLEMENT_APP_NO_MAIN(wxDLLApp) IMPLEMENT_APP_NO_MAIN(wxDLLApp)
WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif #endif
@ -83,10 +83,10 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
if ( !wxTheApp || !wxTheApp->CallOnInit() ) if ( !wxTheApp || !wxTheApp->CallOnInit() )
return FALSE; return FALSE;
} }
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
break; break;
default: default:
break; break;
@ -102,11 +102,11 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle
//****************************************************************************** //******************************************************************************
// Exports // Exports
//****************************************************************************** //******************************************************************************
extern "C" void GetDllInfo (PLUGIN_INFO* _PluginInfo) extern "C" void GetDllInfo (PLUGIN_INFO* _PluginInfo)
{ {
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_WIIMOTE; _PluginInfo->Type = PLUGIN_TYPE_WIIMOTE;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (DebugFast)"); sprintf(_PluginInfo->Name, "Dolphin Wiimote Plugin (DebugFast)");
#else #else
#ifndef _DEBUG #ifndef _DEBUG
@ -138,8 +138,9 @@ void DllConfig(HWND _hParent)
#endif #endif
} }
extern "C" bool Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize) extern "C" void Initialize(void *init)
{ {
SWiimoteInitialize _WiimoteInitialize = *(SWiimoteInitialize *)init;
// ---------------------------------------- // ----------------------------------------
// Debugging window // Debugging window
// ---------- // ----------
@ -153,11 +154,12 @@ extern "C" bool Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize)
g_WiimoteInitialize = _WiimoteInitialize; g_WiimoteInitialize = _WiimoteInitialize;
/* We will run WiiMoteReal::Initialize() even if we are not using a real wiimote, /* We will run WiiMoteReal::Initialize() even if we are not using a
we will initiate wiiuse.dll, but we will return before creating a new thread real wiimote, we will initiate wiiuse.dll, but we will return before
for it if we find no real Wiimotes. Then g_UseRealWiiMote will also be false creating a new thread for it if we find no real Wiimotes. Then
This function call will be done instantly if there is no real Wiimote connected. g_UseRealWiiMote will also be false This function call will be done
I'm not sure how long time it takes if a Wiimote is connected. */ 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 #if HAVE_WIIUSE
g_UseRealWiiMote = WiiMoteReal::Initialize() > 0; g_UseRealWiiMote = WiiMoteReal::Initialize() > 0;
#endif #endif
@ -165,11 +167,10 @@ extern "C" bool Wiimote_Initialize(SWiimoteInitialize _WiimoteInitialize)
WiiMoteEmu::Initialize(); 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 #if HAVE_WIIUSE
WiiMoteReal::DoState(ptr, mode); WiiMoteReal::DoState(ptr, mode);
@ -177,7 +178,7 @@ extern "C" void Wiimote_DoState(void* ptr, int mode)
WiiMoteEmu::DoState(ptr, mode); WiiMoteEmu::DoState(ptr, mode);
} }
extern "C" void Wiimote_Shutdown(void) extern "C" void Shutdown(void)
{ {
#if HAVE_WIIUSE #if HAVE_WIIUSE
WiiMoteReal::Shutdown(); WiiMoteReal::Shutdown();
@ -189,8 +190,8 @@ extern "C" void Wiimote_Shutdown(void)
/* This function produce Wiimote Input (reports from the Wiimote) in response /* 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. */ 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, "============================================================="); LOGV(WII_IPC_WIIMOTE, 3, "=============================================================");
const u8* data = (const u8*)_pData; 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, "============================================================="); 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, "============================================================="); LOGV(WII_IPC_WIIMOTE, 3, "=============================================================");
const u8* data = (const u8*)_pData; 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 /* This sends a Data Report from the Wiimote. See SystemTimers.cpp for the documentation of this
update. */ update. */
// ---------------- // ----------------
extern "C" void Wiimote_Update() extern "C" void Wiimote_Update()
{ {
if (! g_UseRealWiiMote) if (! g_UseRealWiiMote)
WiiMoteEmu::Update(); WiiMoteEmu::Update();
@ -251,7 +252,7 @@ extern "C" void Wiimote_Update()
#endif #endif
} }
extern "C" unsigned int Wiimote_GetAttachedControllers() extern "C" unsigned int Wiimote_GetAttachedControllers()
{ {
return 1; return 1;
} }
@ -270,7 +271,7 @@ void __Log(int log, const char *_fmt, ...)
vsprintf( Msg, _fmt, ap ); vsprintf( Msg, _fmt, ap );
va_end( 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 ); vsprintf( Msg, _fmt, ap );
va_end( ap ); va_end( ap );
g_WiimoteInitialize.pLog(Msg, v); g_WiimoteInitialize.pLog(Msg, v);
} }
// ================ // ================

View file

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Project description // Project description
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Name: nJoy // Name: nJoy
// Description: A Dolphin Compatible Input Plugin // Description: A Dolphin Compatible Input Plugin
// //
// Author: Falcon4ever (nJoy@falcon4ever.com) // Author: Falcon4ever (nJoy@falcon4ever.com)
@ -69,8 +69,8 @@ BEGIN_EVENT_TABLE(ConfigBox,wxDialog)
EVT_CHECKBOX(IDC_SAVEBYID, ConfigBox::ChangeSettings) // Settings EVT_CHECKBOX(IDC_SAVEBYID, ConfigBox::ChangeSettings) // Settings
EVT_CHECKBOX(IDC_SAVEBYIDNOTICE, ConfigBox::ChangeSettings) EVT_CHECKBOX(IDC_SAVEBYIDNOTICE, ConfigBox::ChangeSettings)
EVT_CHECKBOX(IDC_SHOWADVANCED, ConfigBox::ChangeSettings) EVT_CHECKBOX(IDC_SHOWADVANCED, ConfigBox::ChangeSettings)
EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, ConfigBox::ChangeSettings) EVT_COMBOBOX(IDCB_MAINSTICK_DIAGONAL, ConfigBox::ChangeSettings)
EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, ConfigBox::ChangeSettings) EVT_CHECKBOX(IDCB_MAINSTICK_S_TO_C, ConfigBox::ChangeSettings)
EVT_BUTTON(IDB_SHOULDER_L, ConfigBox::GetButtons) EVT_BUTTON(IDB_SHOULDER_L, ConfigBox::GetButtons)
EVT_BUTTON(IDB_SHOULDER_R, ConfigBox::GetButtons) EVT_BUTTON(IDB_SHOULDER_R, ConfigBox::GetButtons)
@ -142,7 +142,7 @@ void ConfigBox::OnKeyDown(wxKeyEvent& event)
void ConfigBox::OnClose(wxCloseEvent& /*event*/) void ConfigBox::OnClose(wxCloseEvent& /*event*/)
{ {
EndModal(0); 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 // Call about dialog
@ -158,11 +158,11 @@ void ConfigBox::AboutClick(wxCommandEvent& event)
frame.ShowModal(); frame.ShowModal();
win.Enable(true); win.Enable(true);
win.SetHWND(0); win.SetHWND(0);
#else #else
AboutBox frame(NULL); AboutBox frame(NULL);
frame.ShowModal(); frame.ShowModal();
#endif #endif
} }
// Click OK // Click OK
@ -211,7 +211,7 @@ void ConfigBox::ChangeSettings( wxCommandEvent& event )
g_Config.bSaveByIDNotice = m_CBSaveByIDNotice[notebookpage]->IsChecked(); g_Config.bSaveByIDNotice = m_CBSaveByIDNotice[notebookpage]->IsChecked();
break; break;
case IDC_SHOWADVANCED: case IDC_SHOWADVANCED:
g_Config.bShowAdvanced = m_CBShowAdvanced[notebookpage]->IsChecked(); g_Config.bShowAdvanced = m_CBShowAdvanced[notebookpage]->IsChecked();
for(int i = 0; i < 4; i++) 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 // First save the settings as they are now, disabled controls will not be saved later
g_Config.Save(); g_Config.Save();
// Update the enable / disable status // Update the enable / disable status
DoEnableDisable(notebookpage); DoEnableDisable(notebookpage);
@ -276,7 +276,7 @@ void ConfigBox::DoEnableDisable(int _notebookpage)
// Notebook page changed // Notebook page changed
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void ConfigBox::NotebookPageChanged(wxNotebookEvent& event) void ConfigBox::NotebookPageChanged(wxNotebookEvent& event)
{ {
notebookpage = event.GetSelection(); notebookpage = event.GetSelection();
} }
@ -335,7 +335,7 @@ void ConfigBox::CreateGUIControls()
#else #else
SetTitle(wxT("Configure: nJoy v"INPUT_VERSION" (Debug) Input Plugin")); SetTitle(wxT("Configure: nJoy v"INPUT_VERSION" (Debug) Input Plugin"));
#endif #endif
SetIcon(wxNullIcon); SetIcon(wxNullIcon);
//WxStaticBitmap1_BITMAP(ConfigBox_WxStaticBitmap1_XPM); //WxStaticBitmap1_BITMAP(ConfigBox_WxStaticBitmap1_XPM);
@ -360,7 +360,7 @@ void ConfigBox::CreateGUIControls()
// Notebook // Notebook
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize); m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
// Controller pages // Controller pages
m_Controller[0] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1, wxDefaultPosition, wxDefaultSize); m_Controller[0] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1, wxDefaultPosition, wxDefaultSize);
m_Notebook->AddPage(m_Controller[0], wxT("Controller 1")); m_Notebook->AddPage(m_Controller[0], wxT("Controller 1"));
@ -381,7 +381,7 @@ void ConfigBox::CreateGUIControls()
WxStaticBitmap1_BITMAPGray = wxBitmap(WxImageGray); 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 wxArrayString arrayStringFor_Joyname; // The string array
if(SDL_NumJoysticks() > 0) 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_JOYSTICK_XBOX360]));
// arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_KEYBOARD])); // arrayStringFor_Controltype.Add(wxString::FromAscii(ControllerType[CTL_TYPE_KEYBOARD]));
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Populate the deadzone list // Populate the deadzone list
// ----------------------------- // -----------------------------
@ -420,7 +420,7 @@ void ConfigBox::CreateGUIControls()
// Populate all four pages // Populate all four pages
for(int i=0; i<4 ;i++) for(int i=0; i<4 ;i++)
{ {
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Populate keys sizer // Populate keys sizer
// ----------------------------- // -----------------------------
@ -614,7 +614,7 @@ void ConfigBox::CreateGUIControls()
m_sSettings[i] = new wxBoxSizer ( wxHORIZONTAL ); m_sSettings[i] = new wxBoxSizer ( wxHORIZONTAL );
m_sSettings[i]->Add(m_gExtrasettings[i], 0, wxEXPAND | wxALL, 0); 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_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); DoEnableDisable(i);
} // end of loop } // end of loop
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Populate buttons sizer. // Populate buttons sizer.
// ----------------------------- // -----------------------------
@ -736,8 +736,8 @@ void ConfigBox::CreateGUIControls()
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Debugging // Debugging
// ----------------------------- // -----------------------------
//m_pStatusBar = new wxStaticText(this, IDT_DEBUGGING, wxT("Debugging"), wxPoint(100, 510), 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_pStatusBar2 = new wxStaticText(this, IDT_DEBUGGING2, wxT("Debugging2"), wxPoint(100, 530), wxDefaultSize);
//m_pStatusBar->SetLabel(wxString::Format("Debugging text")); //m_pStatusBar->SetLabel(wxString::Format("Debugging text"));
// -------------------------------------------------------------------- // --------------------------------------------------------------------

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import sys import sys

View file

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Project description // Project description
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Name: nJoy // Name: nJoy
// Description: A Dolphin Compatible Input Plugin // Description: A Dolphin Compatible Input Plugin
// //
// Author: Falcon4ever (nJoy@falcon4ever.com) // Author: Falcon4ever (nJoy@falcon4ever.com)
@ -29,7 +29,7 @@
// //
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// Issues // Issues
@ -41,7 +41,7 @@
////////////////////////*/ ////////////////////////*/
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// Variables guide // Variables guide
@ -58,7 +58,7 @@
////////////////////////*/ ////////////////////////*/
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Include // Include
@ -71,7 +71,7 @@
#endif #endif
///////////////////////// /////////////////////////
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Variables // Variables
// ¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯
@ -97,7 +97,7 @@ void __Logv(int log, int v, const char *format, ...) {}
extern int fd; extern int fd;
#endif #endif
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// wxWidgets // 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); WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif #endif
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// DllMain // DllMain
// ¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯
#ifdef _WIN32 #ifdef _WIN32
BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved LPVOID lpvReserved) // reserved
{ {
switch (dwReason) switch (dwReason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
@ -136,17 +136,17 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
if (!wxTheApp || !wxTheApp->CallOnInit() ) if (!wxTheApp || !wxTheApp->CallOnInit() )
return FALSE; return FALSE;
} }
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
wxEntryCleanup(); //use wxUninitialize() if you don't want GUI wxEntryCleanup(); //use wxUninitialize() if you don't want GUI
break; break;
default: default:
break; break;
} }
nJoy_hInst = hinstDLL; nJoy_hInst = hinstDLL;
return TRUE; return TRUE;
} }
#endif #endif
@ -162,7 +162,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_PAD; _PluginInfo->Type = PLUGIN_TYPE_PAD;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "nJoy v"INPUT_VERSION" (DebugFast) by Falcon4ever"); sprintf(_PluginInfo->Name, "nJoy v"INPUT_VERSION" (DebugFast) by Falcon4ever");
#else #else
#ifndef _DEBUG #ifndef _DEBUG
@ -179,7 +179,7 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) {
// Call config dialog // Call config dialog
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void DllConfig(HWND _hParent) void DllConfig(HWND _hParent)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (SDL_Init(SDL_INIT_JOYSTICK ) < 0) if (SDL_Init(SDL_INIT_JOYSTICK ) < 0)
{ {
@ -193,7 +193,7 @@ void DllConfig(HWND _hParent)
SPADInitialize _PADInitialize; SPADInitialize _PADInitialize;
_PADInitialize.hWnd = NULL; _PADInitialize.hWnd = NULL;
_PADInitialize.pLog = NULL; _PADInitialize.pLog = NULL;
PAD_Initialize(_PADInitialize); Initialize((void*)&_PADInitialize);
emulator_running = FALSE; // Set it back to false emulator_running = FALSE; // Set it back to false
} }
@ -206,7 +206,7 @@ void DllConfig(HWND _hParent)
//win.SetHWND(0); //win.SetHWND(0);
m_frame = new ConfigBox(NULL); m_frame = new ConfigBox(NULL);
m_frame->ShowModal(); m_frame->ShowModal();
#else #else
if (SDL_Init(SDL_INIT_JOYSTICK ) < 0) if (SDL_Init(SDL_INIT_JOYSTICK ) < 0)
@ -222,34 +222,35 @@ void DllConfig(HWND _hParent)
frame.ShowModal(); frame.ShowModal();
#endif #endif
#endif #endif
} }
void DllDebugger(HWND _hParent, bool Show) { void DllDebugger(HWND _hParent, bool Show) {
} }
// Init PAD (start emulation) // Init PAD (start emulation)
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PAD_Initialize(SPADInitialize _PADInitialize) void Initialize(void *init)
{ {
SPADInitialize _PADInitialize = *(SPADInitialize*)init;
emulator_running = TRUE; emulator_running = TRUE;
#ifdef _DEBUG #ifdef _DEBUG
DEBUG_INIT(); DEBUG_INIT();
#endif #endif
if (SDL_Init(SDL_INIT_JOYSTICK) < 0) if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
{ {
#ifdef _WIN32 #ifdef _WIN32
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR); MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
#else #else
printf("Could not initialize SDL! (%s)\n", SDL_GetError()); printf("Could not initialize SDL! (%s)\n", SDL_GetError());
#endif #endif
return; return;
} }
#ifdef _WIN32 #ifdef _WIN32
m_hWnd = (HWND)_PADInitialize.hWnd; m_hWnd = (HWND)_PADInitialize.hWnd;
#endif #endif
Search_Devices(); // Populate joyinfo for all attached devices 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); joystate[3].joy = SDL_JoystickOpen(joysticks[3].ID);
} }
// Search attached devices. Populate joyinfo for all attached physical devices. // Search attached devices. Populate joyinfo for all attached physical devices.
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
int Search_Devices() int Search_Devices()
@ -291,8 +292,8 @@ int Search_Devices()
{ {
#ifdef _WIN32 #ifdef _WIN32
//MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING); //MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING);
#else #else
printf("No Joystick detected!\n"); printf("No Joystick detected!\n");
#endif #endif
return 0; return 0;
} }
@ -301,7 +302,7 @@ int Search_Devices()
fprintf(pFile, "Scanning for devices\n"); fprintf(pFile, "Scanning for devices\n");
fprintf(pFile, "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n"); fprintf(pFile, "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n");
#endif #endif
for(int i = 0; i < numjoy; i++ ) for(int i = 0; i < numjoy; i++ )
{ {
// Open the device to be able to read the values // 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].NumBalls = SDL_JoystickNumBalls(joyinfo[i].joy);
joyinfo[i].NumHats = SDL_JoystickNumHats(joyinfo[i].joy); joyinfo[i].NumHats = SDL_JoystickNumHats(joyinfo[i].joy);
joyinfo[i].Name = SDL_JoystickName(i); joyinfo[i].Name = SDL_JoystickName(i);
#ifdef _DEBUG #ifdef _DEBUG
fprintf(pFile, "ID: %d\n", i); fprintf(pFile, "ID: %d\n", i);
fprintf(pFile, "Name: %s\n", joyinfo[i].Name); 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, "Axes: %d\n", joyinfo[i].NumAxes);
fprintf(pFile, "Hats: %d\n", joyinfo[i].NumHats); fprintf(pFile, "Hats: %d\n", joyinfo[i].NumHats);
fprintf(pFile, "Balls: %d\n\n", joyinfo[i].NumBalls); fprintf(pFile, "Balls: %d\n\n", joyinfo[i].NumBalls);
#endif #endif
// We have now read the values we need so we close the device // We have now read the values we need so we close the device
if (SDL_JoystickOpened(i)) SDL_JoystickClose(joyinfo[i].joy); if (SDL_JoystickOpened(i)) SDL_JoystickClose(joyinfo[i].joy);
@ -329,10 +330,10 @@ int Search_Devices()
return numjoy; return numjoy;
} }
// Shutdown PAD (stop emulation) // Shutdown PAD (stop emulation)
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PAD_Shutdown() void Shutdown()
{ {
if (joysticks[0].enabled) if (joysticks[0].enabled)
SDL_JoystickClose(joystate[0].joy); SDL_JoystickClose(joystate[0].joy);
@ -344,15 +345,15 @@ void PAD_Shutdown()
SDL_JoystickClose(joystate[3].joy); SDL_JoystickClose(joystate[3].joy);
SDL_Quit(); SDL_Quit();
#ifdef _DEBUG #ifdef _DEBUG
DEBUG_QUIT(); DEBUG_QUIT();
#endif #endif
delete [] joyinfo; delete [] joyinfo;
emulator_running = FALSE; emulator_running = FALSE;
#ifdef _WIN32 #ifdef _WIN32
#ifdef USE_RUMBLE_DINPUT_HACK #ifdef USE_RUMBLE_DINPUT_HACK
FreeDirectInput(); FreeDirectInput();
@ -362,6 +363,7 @@ void PAD_Shutdown()
#endif #endif
} }
// Set buttons status from wxWidgets in the main application // 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 // 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) if (!joysticks[_numPAD].enabled)
return; return;
// Clear pad status // Clear pad status
memset(_pPADStatus, 0, sizeof(SPADStatus)); memset(_pPADStatus, 0, sizeof(SPADStatus));
// Get pad status // Get pad status
GetJoyState(_numPAD); GetJoyState(_numPAD);
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// Set analog controllers // 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_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; if ((sub_stick_y < deadzone2) || (sub_stick_y > deadzone)) _pPADStatus->substickY = sub_stick_y;
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
// Set buttons // Set buttons
// ----------- // -----------
@ -444,7 +448,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
_pPADStatus->button|=PAD_TRIGGER_L; _pPADStatus->button|=PAD_TRIGGER_L;
_pPADStatus->triggerLeft = triggervalue; _pPADStatus->triggerLeft = triggervalue;
} }
if (joystate[_numPAD].buttons[CTL_R_SHOULDER]) if (joystate[_numPAD].buttons[CTL_R_SHOULDER])
{ {
_pPADStatus->button|=PAD_TRIGGER_R; _pPADStatus->button|=PAD_TRIGGER_R;
_pPADStatus->triggerRight = triggervalue; _pPADStatus->triggerRight = triggervalue;
@ -484,7 +488,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
if (joystate[_numPAD].dpad2[CTL_D_PAD_RIGHT]) if (joystate[_numPAD].dpad2[CTL_D_PAD_RIGHT])
_pPADStatus->button |= PAD_BUTTON_RIGHT; _pPADStatus->button |= PAD_BUTTON_RIGHT;
} }
// //
_pPADStatus->err = PAD_ERR_NONE; _pPADStatus->err = PAD_ERR_NONE;
@ -492,7 +496,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
Pad_Use_Rumble(_numPAD, _pPADStatus); Pad_Use_Rumble(_numPAD, _pPADStatus);
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Convert stick values, for example from circle to square analog stick radius // 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. /* Convert stick values.
The value returned by SDL_JoystickGetAxis is a signed integer s16 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 char u8 (0 to 255) with neutral at 0x80 (128), so that it's equivalent to a signed
-128 to 127. */ -128 to 127. */
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@ -520,7 +524,7 @@ u8 Pad_Convert(int _val)
return val; return val;
} }
/* Convert the stick raidus from a circular to a square. I don't know what input values /* 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 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 in between. But one thing that is certain is that PC pads differ in their output (as
@ -600,13 +604,13 @@ std::vector<int> Pad_Square_to_Circle(int _x, int _y)
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Set PAD attached pads // Set PAD attached pads
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
unsigned int PAD_GetAttachedPads() unsigned int PAD_GetAttachedPads()
{ {
unsigned int connected = 0; unsigned int connected = 0;
g_Config.Load(); g_Config.Load();
if (joysticks[0].enabled) connected |= 1; if (joysticks[0].enabled) connected |= 1;
@ -617,7 +621,7 @@ unsigned int PAD_GetAttachedPads()
return connected; return connected;
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Read current joystick status // 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_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_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]); 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_L_SHOULDER);
ReadButton(controller, CTL_R_SHOULDER); ReadButton(controller, CTL_R_SHOULDER);
ReadButton(controller, CTL_A_BUTTON); ReadButton(controller, CTL_A_BUTTON);
@ -655,7 +659,7 @@ void GetJoyState(int controller)
ReadButton(controller, CTL_Y_BUTTON); ReadButton(controller, CTL_Y_BUTTON);
ReadButton(controller, CTL_Z_TRIGGER); ReadButton(controller, CTL_Z_TRIGGER);
ReadButton(controller, CTL_START); ReadButton(controller, CTL_START);
// //
if (joysticks[controller].halfpress < joyinfo[controller].NumButtons) if (joysticks[controller].halfpress < joyinfo[controller].NumButtons)
joystate[controller].halfpress = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].halfpress); joystate[controller].halfpress = SDL_JoystickGetButton(joystate[controller].joy, joysticks[controller].halfpress);

View file

@ -1,4 +1,4 @@
# -*- python -*- # -*- python -*-
Import('env') Import('env')
import sys import sys
@ -12,7 +12,7 @@ if not env['HAVE_SDL']:
files = [ files = [
'nJoy.cpp', 'nJoy.cpp',
] ]
if env['HAVE_WX']: if env['HAVE_WX']:
files +=[ 'GUI/AboutBox.cpp', files +=[ 'GUI/AboutBox.cpp',
'GUI/ConfigBox.cpp', 'GUI/ConfigBox.cpp',

View file

@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Project description // Project description
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
// Name: nJoy // Name: nJoy
// Description: A Dolphin Compatible Input Plugin // Description: A Dolphin Compatible Input Plugin
// //
// Author: Falcon4ever (nJoy@falcon4ever.com) // 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); WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst);
#endif #endif
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// DllMain // DllMain
// ¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯
BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
DWORD dwReason, // reason called DWORD dwReason, // reason called
LPVOID lpvReserved) // reserved LPVOID lpvReserved) // reserved
{ {
switch (dwReason) switch (dwReason)
{ {
case DLL_PROCESS_ATTACH: case DLL_PROCESS_ATTACH:
@ -119,19 +119,19 @@ BOOL APIENTRY DllMain( HINSTANCE hinstDLL, // DLL module handle
return FALSE; return FALSE;
#endif #endif
} }
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
#if defined(HAVE_WX) && HAVE_WX #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 #endif
break; break;
default: default:
break; break;
} }
nJoy_hInst = hinstDLL; nJoy_hInst = hinstDLL;
return TRUE; return TRUE;
} }
#endif #endif
@ -147,7 +147,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo)
_PluginInfo->Version = 0x0100; _PluginInfo->Version = 0x0100;
_PluginInfo->Type = PLUGIN_TYPE_PAD; _PluginInfo->Type = PLUGIN_TYPE_PAD;
#ifdef DEBUGFAST #ifdef DEBUGFAST
sprintf(_PluginInfo->Name, "nJoy v"INPUT_VERSION" (DebugFast) by Falcon4ever"); sprintf(_PluginInfo->Name, "nJoy v"INPUT_VERSION" (DebugFast) by Falcon4ever");
#else #else
#ifndef _DEBUG #ifndef _DEBUG
@ -194,7 +194,7 @@ void DllConfig(HWND _hParent)
ConfigBox frame(NULL); ConfigBox frame(NULL);
frame.ShowModal(); frame.ShowModal();
#endif #endif
#endif #endif
} }
void DllDebugger(HWND _hParent, bool Show) { void DllDebugger(HWND _hParent, bool Show) {
@ -202,29 +202,30 @@ void DllDebugger(HWND _hParent, bool Show) {
// Init PAD (start emulation) // Init PAD (start emulation)
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PAD_Initialize(SPADInitialize _PADInitialize) void Initialize(void *init)
{ {
SPADInitialize _PADInitialize = *(SPADInitialize*)init;
emulator_running = TRUE; emulator_running = TRUE;
#ifdef _DEBUG #ifdef _DEBUG
DEBUG_INIT(); DEBUG_INIT();
#endif #endif
if(SDL_Init(SDL_INIT_JOYSTICK ) < 0) if(SDL_Init(SDL_INIT_JOYSTICK ) < 0)
{ {
#ifdef _WIN32 #ifdef _WIN32
MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR); MessageBox(NULL, SDL_GetError(), "Could not initialize SDL!", MB_ICONERROR);
#else #else
printf("Could not initialize SDL! (%s)\n", SDL_GetError()); printf("Could not initialize SDL! (%s)\n", SDL_GetError());
#endif #endif
return; return;
} }
#ifdef _WIN32 #ifdef _WIN32
m_hWnd = (HWND)_PADInitialize.hWnd; m_hWnd = (HWND)_PADInitialize.hWnd;
#endif #endif
LoadConfig(); // Load joystick mapping LoadConfig(); // Load joystick mapping
if(joysticks[0].enabled) if(joysticks[0].enabled)
joystate[0].joy = SDL_JoystickOpen(joysticks[0].ID); joystate[0].joy = SDL_JoystickOpen(joysticks[0].ID);
if(joysticks[1].enabled) if(joysticks[1].enabled)
@ -237,7 +238,7 @@ void PAD_Initialize(SPADInitialize _PADInitialize)
// Shutdown PAD (stop emulation) // Shutdown PAD (stop emulation)
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PAD_Shutdown() void Shutdown()
{ {
if(joysticks[0].enabled) if(joysticks[0].enabled)
SDL_JoystickClose(joystate[0].joy); SDL_JoystickClose(joystate[0].joy);
@ -249,15 +250,15 @@ void PAD_Shutdown()
SDL_JoystickClose(joystate[3].joy); SDL_JoystickClose(joystate[3].joy);
SDL_Quit(); SDL_Quit();
#ifdef _DEBUG #ifdef _DEBUG
DEBUG_QUIT(); DEBUG_QUIT();
#endif #endif
delete [] joyinfo; delete [] joyinfo;
emulator_running = FALSE; emulator_running = FALSE;
#ifdef _WIN32 #ifdef _WIN32
#ifdef USE_RUMBLE_DINPUT_HACK #ifdef USE_RUMBLE_DINPUT_HACK
FreeDirectInput(); FreeDirectInput();
@ -267,13 +268,14 @@ void PAD_Shutdown()
#endif #endif
} }
void DoState(unsigned char **ptr, int mode) {
}
// Set buttons status from wxWidgets in the main application // Set buttons status from wxWidgets in the main application
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void PAD_Input(u8 _Key, u8 _UpDown) {} void PAD_Input(u8 _Key, u8 _UpDown) {}
// Set PAD status // Set PAD status
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@ -281,13 +283,13 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
{ {
if(!joysticks[_numPAD].enabled) if(!joysticks[_numPAD].enabled)
return; return;
// clear pad status // clear pad status
memset(_pPADStatus, 0, sizeof(SPADStatus)); memset(_pPADStatus, 0, sizeof(SPADStatus));
// get pad status // get pad status
GetJoyState(_numPAD); GetJoyState(_numPAD);
// Reset! // Reset!
int base = 0x80; int base = 0x80;
_pPADStatus->stickY = base; _pPADStatus->stickY = base;
@ -326,8 +328,8 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
{ {
//Do a panicAlert here? //Do a panicAlert here?
} }
// Quick fix // Quick fix
if(main_stick_x > 127) if(main_stick_x > 127)
main_stick_x = 127; main_stick_x = 127;
@ -398,7 +400,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
if(Pressed == true) if(Pressed == true)
{ {
int TriggerValue = 0; int TriggerValue = 0;
if(joysticks[_numPAD].buttons[a].c_str()[1] == '+') if(joysticks[_numPAD].buttons[a].c_str()[1] == '+')
{ {
if(joystate[_numPAD].buttons[a] >= 0) if(joystate[_numPAD].buttons[a] >= 0)
@ -416,7 +418,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
_pPADStatus->button |= ButtonArray[a]; _pPADStatus->button |= ButtonArray[a];
_pPADStatus->triggerLeft = TriggerValue; _pPADStatus->triggerLeft = TriggerValue;
} }
else if(a == CTL_R_SHOULDER) else if(a == CTL_R_SHOULDER)
{ {
if(TriggerValue == 255) if(TriggerValue == 255)
_pPADStatus->button |= ButtonArray[a]; _pPADStatus->button |= ButtonArray[a];
@ -445,7 +447,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
// Digital L and R // Digital L and R
if(a == CTL_L_SHOULDER) if(a == CTL_L_SHOULDER)
_pPADStatus->triggerLeft = 255; //TODO: Do half press with these _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 _pPADStatus->triggerRight = 255; //TODO: Half Press with these
else if(a == CTL_A_BUTTON) else if(a == CTL_A_BUTTON)
_pPADStatus->analogA = 255; _pPADStatus->analogA = 255;
@ -464,7 +466,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
_pPADStatus->button|=PAD_TRIGGER_L; _pPADStatus->button|=PAD_TRIGGER_L;
_pPADStatus->triggerLeft = triggervalue; _pPADStatus->triggerLeft = triggervalue;
} }
if (joystate[_numPAD].buttons[CTL_R_SHOULDER]) if (joystate[_numPAD].buttons[CTL_R_SHOULDER])
{ {
_pPADStatus->button|=PAD_TRIGGER_R; _pPADStatus->button|=PAD_TRIGGER_R;
_pPADStatus->triggerRight = triggervalue; _pPADStatus->triggerRight = triggervalue;
@ -497,10 +499,10 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
else else
{ {
} }
_pPADStatus->err = PAD_ERR_NONE; _pPADStatus->err = PAD_ERR_NONE;
#ifdef _WIN32 #ifdef _WIN32
#ifdef USE_RUMBLE_DINPUT_HACK #ifdef USE_RUMBLE_DINPUT_HACK
if(joystate[_numPAD].halfpress) if(joystate[_numPAD].halfpress)
@ -517,7 +519,7 @@ void PAD_GetStatus(u8 _numPAD, SPADStatus* _pPADStatus)
if (g_rumbleEnable) if (g_rumbleEnable)
{ {
g_pDevice->Acquire(); g_pDevice->Acquire();
if(g_pEffect) if(g_pEffect)
g_pEffect->Start(1, 0); 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 PAD_GetAttachedPads()
{ {
unsigned int connected = 0; unsigned int connected = 0;
LoadConfig(); LoadConfig();
if(joysticks[0].enabled) if(joysticks[0].enabled)
@ -640,7 +642,7 @@ unsigned int PAD_GetAttachedPads()
return connected; return connected;
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Custom Functions // Custom Functions
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ // ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@ -698,8 +700,8 @@ int Search_Devices()
{ {
#ifdef _WIN32 #ifdef _WIN32
MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING); MessageBox(NULL, "No Joystick detected!", NULL, MB_ICONWARNING);
#else #else
printf("No Joystick detected!\n"); printf("No Joystick detected!\n");
#endif #endif
return 0; return 0;
} }
@ -712,7 +714,7 @@ int Search_Devices()
fprintf(pFile, "Scanning for devices\n"); fprintf(pFile, "Scanning for devices\n");
fprintf(pFile, "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n"); fprintf(pFile, "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\n");
#endif #endif
for(int i = 0; i < numjoy; i++ ) for(int i = 0; i < numjoy; i++ )
{ {
joyinfo[i].joy = SDL_JoystickOpen(i); joyinfo[i].joy = SDL_JoystickOpen(i);
@ -722,7 +724,7 @@ int Search_Devices()
joyinfo[i].NumBalls = SDL_JoystickNumBalls(joyinfo[i].joy); joyinfo[i].NumBalls = SDL_JoystickNumBalls(joyinfo[i].joy);
joyinfo[i].NumHats = SDL_JoystickNumHats(joyinfo[i].joy); joyinfo[i].NumHats = SDL_JoystickNumHats(joyinfo[i].joy);
joyinfo[i].Name = SDL_JoystickName(i); joyinfo[i].Name = SDL_JoystickName(i);
printf("ID: %d\n", i); printf("ID: %d\n", i);
printf("Name: %s\n", joyinfo[i].Name); printf("Name: %s\n", joyinfo[i].Name);
printf("Buttons: %d\n", joyinfo[i].NumButtons); printf("Buttons: %d\n", joyinfo[i].NumButtons);
@ -746,9 +748,9 @@ void DEBUG_INIT()
return; return;
#ifdef _WIN32 #ifdef _WIN32
char dateStr [9]; char dateStr [9];
_strdate( dateStr); _strdate( dateStr);
char timeStr [9]; char timeStr [9];
_strtime( timeStr ); _strtime( timeStr );
#endif #endif
@ -768,7 +770,7 @@ void DEBUG_QUIT()
return; return;
#ifdef _WIN32 #ifdef _WIN32
char timeStr [9]; char timeStr [9];
_strtime(timeStr); _strtime(timeStr);
fprintf(pFile, "_______________\n"); fprintf(pFile, "_______________\n");
@ -797,7 +799,7 @@ void SaveConfig()
file.Set(SectionName, "y_button", joysticks[i].buttons[CTL_Y_BUTTON]); 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, "z_trigger", joysticks[i].buttons[CTL_Z_TRIGGER]);
file.Set(SectionName, "start_button", joysticks[i].buttons[CTL_START]); 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_up", joysticks[i].buttons[CTL_D_PAD_UP]);
file.Set(SectionName, "dpad_down", joysticks[i].buttons[CTL_D_PAD_DOWN]); file.Set(SectionName, "dpad_down", joysticks[i].buttons[CTL_D_PAD_DOWN]);
file.Set(SectionName, "dpad_left", joysticks[i].buttons[CTL_D_PAD_LEFT]); 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, "l_shoulder", &joysticks[i].buttons[CTL_L_SHOULDER], "B4");
file.Get(SectionName, "r_shoulder", &joysticks[i].buttons[CTL_R_SHOULDER], "B5"); 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, "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, "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, "z_trigger", &joysticks[i].buttons[CTL_Z_TRIGGER], "B7");
file.Get(SectionName, "start_button", &joysticks[i].buttons[CTL_START], "B9"); file.Get(SectionName, "start_button", &joysticks[i].buttons[CTL_START], "B9");
file.Get(SectionName, "dpad", &joysticks[i].dpad, 0); 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_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_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_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, "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_x", &joysticks[i].buttons[CTL_MAIN_X], "A0");
file.Get(SectionName, "main_y", &joysticks[i].buttons[CTL_MAIN_Y], "A1"); 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_x", &joysticks[i].buttons[CTL_SUB_X], "A2");
file.Get(SectionName, "sub_y", &joysticks[i].buttons[CTL_SUB_Y], "A3"); file.Get(SectionName, "sub_y", &joysticks[i].buttons[CTL_SUB_Y], "A3");
file.Get(SectionName, "enabled", &joysticks[i].enabled, 1); file.Get(SectionName, "enabled", &joysticks[i].enabled, 1);
file.Get(SectionName, "deadzone", &joysticks[i].deadzone, 9); file.Get(SectionName, "deadzone", &joysticks[i].deadzone, 9);
file.Get(SectionName, "halfpress", &joysticks[i].halfpress, 6); file.Get(SectionName, "halfpress", &joysticks[i].halfpress, 6);
file.Get(SectionName, "joy_id", &joysticks[i].ID, 0); file.Get(SectionName, "joy_id", &joysticks[i].ID, 0);
file.Get(SectionName, "controllertype", &joysticks[i].controllertype, 0); file.Get(SectionName, "controllertype", &joysticks[i].controllertype, 0);
file.Get(SectionName, "eventnum", &joysticks[i].eventnum, 0); file.Get(SectionName, "eventnum", &joysticks[i].eventnum, 0);
@ -875,7 +877,7 @@ void LoadConfig()
} }
} }
#ifdef _WIN32 #ifdef _WIN32
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
// Rumble stuff :D! // 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); MessageBox(NULL, "Force feedback device not found. nJoy will now disable rumble." ,"FFConst" , MB_ICONERROR | MB_OK);
g_rumbleEnable = FALSE; g_rumbleEnable = FALSE;
return S_OK; return S_OK;
} }
@ -923,7 +925,7 @@ HRESULT InitDirectInput( HWND hDlg )
// Exclusive access is required in order to perform force feedback. // 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))) if(FAILED(hr = g_pDevice->SetCooperativeLevel(hDlg, DISCL_EXCLUSIVE | DISCL_FOREGROUND)))
{ {
return hr; return hr;
} }
@ -939,7 +941,7 @@ HRESULT InitDirectInput( HWND hDlg )
if(FAILED(hr = g_pDevice->SetProperty(DIPROP_AUTOCENTER, &dipdw.diph))) if(FAILED(hr = g_pDevice->SetProperty(DIPROP_AUTOCENTER, &dipdw.diph)))
return hr; 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))) if(FAILED(hr = g_pDevice->EnumObjects(EnumAxesCallback, (VOID*)&g_dwNumForceFeedbackAxis, DIDFT_AXIS)))
return hr; return hr;
@ -983,7 +985,7 @@ HRESULT InitDirectInput( HWND hDlg )
VOID FreeDirectInput() 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. // the app tried to exit while the device is still acquired.
if(g_pDevice) if(g_pDevice)
g_pDevice->Unacquire(); g_pDevice->Unacquire();
@ -1037,7 +1039,7 @@ HRESULT SetDeviceForcesXY()
} }
else 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[0] = g_nXForce;
rglDirection[1] = g_nYForce; rglDirection[1] = g_nYForce;
cf.lMagnitude = (DWORD)sqrt((double)g_nXForce * (double)g_nXForce + (double)g_nYForce * (double)g_nYForce ); cf.lMagnitude = (DWORD)sqrt((double)g_nXForce * (double)g_nXForce + (double)g_nYForce * (double)g_nYForce );