mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
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:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="Common"
|
||||
ProjectGUID="{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}"
|
||||
RootNamespace="Common"
|
||||
@@ -602,6 +602,38 @@
|
||||
RelativePath=".\Src\Plugin.h"
|
||||
>
|
||||
</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
|
||||
RelativePath=".\Src\SConscript"
|
||||
>
|
||||
|
||||
@@ -38,7 +38,7 @@ and stopped.
|
||||
#include "FileUtil.h"
|
||||
#include "StringUtil.h"
|
||||
#include "DynamicLibrary.h"
|
||||
#include "../../../../Branches/MusicMod/Common/Src/Console.h"
|
||||
#include "../../../../Branches/MusicMod/Common/Src/Console.h"
|
||||
///////////////////////////////////
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ std::string GetLastErrorAsString()
|
||||
#ifdef _WIN32
|
||||
LPVOID lpMsgBuf = 0;
|
||||
DWORD error = GetLastError();
|
||||
FormatMessage(
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
error,
|
||||
@@ -155,7 +155,7 @@ void* DynamicLibrary::Get(const char* funcname) const
|
||||
if (!retval)
|
||||
{
|
||||
LOG(MASTER_LOG, "Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
|
||||
//PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
|
||||
PanicAlert("Symbol %s missing in %s (error: %s)\n", funcname, library_file.c_str(), GetLastErrorAsString().c_str());
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
||||
@@ -237,7 +237,7 @@ bool Rename(const char *srcFilename, const char *destFilename)
|
||||
|
||||
bool Copy(const char *srcFilename, const char *destFilename)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
return (CopyFile(srcFilename, destFilename, FALSE) == TRUE) ? true : false;
|
||||
#else
|
||||
|
||||
@@ -259,7 +259,7 @@ bool Copy(const char *srcFilename, const char *destFilename)
|
||||
return false;
|
||||
}
|
||||
|
||||
while(! feof(input)) {
|
||||
while(! feof(input)) {
|
||||
if((rnum = fread(buffer, sizeof(char), BSIZE, input)) != BSIZE) {
|
||||
if(ferror(input) != 0){
|
||||
PanicAlert("can't read source file\n");
|
||||
@@ -293,7 +293,7 @@ bool Copy(const char *srcFilename, const char *destFilename)
|
||||
std::string GetUserDirectory()
|
||||
{
|
||||
char path[MAX_PATH];
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, 0, path)))
|
||||
{
|
||||
//return std::string(path);
|
||||
@@ -337,7 +337,7 @@ u64 GetSize(const char *filename)
|
||||
}
|
||||
int err = errno;
|
||||
PanicAlert("Error accessing %s: %s", filename, strerror(err));
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry)
|
||||
|
||||
// Find the first file in the directory.
|
||||
DIR *dirp = opendir(_Directory.c_str());
|
||||
|
||||
|
||||
while (!readdir_r(dirp, &dirent, &result) && result) {
|
||||
FSTEntry entry;
|
||||
if (result->d_name[0]=='.') continue;
|
||||
@@ -428,7 +428,7 @@ u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry)
|
||||
parentEntry.children.push_back(entry);
|
||||
}
|
||||
closedir(dirp);
|
||||
|
||||
|
||||
return foundEntries;
|
||||
}
|
||||
#endif
|
||||
@@ -494,29 +494,29 @@ error_jmp:
|
||||
return Result;
|
||||
#else
|
||||
// taken from http://www.dreamincode.net/code/snippet2700.htm
|
||||
DIR *pdir = NULL;
|
||||
DIR *pdir = NULL;
|
||||
pdir = opendir (_Directory.c_str());
|
||||
struct dirent *pent = NULL;
|
||||
|
||||
if (pdir == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (pdir == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char file[256];
|
||||
|
||||
int counter = 1;
|
||||
|
||||
while ((pent = readdir(pdir))) {
|
||||
while ((pent = readdir(pdir))) {
|
||||
if (counter > 2) {
|
||||
for (int i = 0; i < 256; i++) file[i] = '\0';
|
||||
strcat(file, _Directory.c_str());
|
||||
if (pent == NULL) {
|
||||
return false;
|
||||
}
|
||||
strcat(file, pent->d_name);
|
||||
if (pent == NULL) {
|
||||
return false;
|
||||
}
|
||||
strcat(file, pent->d_name);
|
||||
if (IsDirectory(file) == true) {
|
||||
DeleteDir(file);
|
||||
} else {
|
||||
} else {
|
||||
remove(file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
|
||||
|
||||
// =======================================================
|
||||
// File description
|
||||
@@ -24,79 +24,91 @@
|
||||
the config and debugging windows and works with all plugins. */
|
||||
// =============
|
||||
|
||||
|
||||
|
||||
#include "Plugin.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
DynamicLibrary CPlugin::m_hInstLib;
|
||||
|
||||
void(__cdecl * CPlugin::m_GetDllInfo) (PLUGIN_INFO * _PluginInfo) = 0;
|
||||
void(__cdecl * CPlugin::m_DllConfig) (HWND _hParent) = 0;
|
||||
void(__cdecl * CPlugin::m_DllDebugger) (HWND _hParent, bool Show) = 0;
|
||||
void(__cdecl * CPlugin::m_SetDllGlobals) (PLUGIN_GLOBALS* _PluginGlobals) = 0;
|
||||
|
||||
void
|
||||
CPlugin::Release(void)
|
||||
{
|
||||
m_GetDllInfo = 0;
|
||||
m_DllConfig = 0;
|
||||
m_DllDebugger = 0;
|
||||
m_SetDllGlobals = 0;
|
||||
|
||||
m_hInstLib.Unload();
|
||||
CPlugin::~CPlugin() {
|
||||
m_hInstLib.Unload();
|
||||
}
|
||||
|
||||
bool
|
||||
CPlugin::Load(const char* _szName)
|
||||
{
|
||||
if (m_hInstLib.Load(_szName))
|
||||
{
|
||||
m_GetDllInfo = (void (__cdecl*)(PLUGIN_INFO*)) m_hInstLib.Get("GetDllInfo");
|
||||
m_DllConfig = (void (__cdecl*)(HWND)) m_hInstLib.Get("DllConfig");
|
||||
m_DllDebugger = (void (__cdecl*)(HWND, bool)) m_hInstLib.Get("DllDebugger");
|
||||
m_SetDllGlobals = (void (__cdecl*)(PLUGIN_GLOBALS*)) m_hInstLib.Get("SetDllGlobals");
|
||||
return(true);
|
||||
CPlugin::CPlugin(const char* _szName) : valid(false) {
|
||||
if (m_hInstLib.Load(_szName)) {
|
||||
|
||||
m_GetDllInfo = reinterpret_cast<TGetDllInfo>
|
||||
(m_hInstLib.Get("GetDllInfo"));
|
||||
m_DllConfig = reinterpret_cast<TDllConfig>
|
||||
(m_hInstLib.Get("DllConfig"));
|
||||
m_DllDebugger = reinterpret_cast<TDllDebugger>
|
||||
(m_hInstLib.Get("DllDebugger"));
|
||||
m_SetDllGlobals = reinterpret_cast<TSetDllGlobals>
|
||||
(m_hInstLib.Get("SetDllGlobals"));
|
||||
m_Initialize = reinterpret_cast<TInitialize>
|
||||
(m_hInstLib.Get("Initialize"));
|
||||
m_Shutdown = reinterpret_cast<TShutdown>
|
||||
(m_hInstLib.Get("Shutdown"));
|
||||
m_DoState = reinterpret_cast<TDoState>
|
||||
(m_hInstLib.Get("DoState"));
|
||||
}
|
||||
|
||||
return(false);
|
||||
if (m_GetDllInfo != 0 &&
|
||||
m_DllConfig != 0 &&
|
||||
m_DllDebugger != 0 &&
|
||||
m_SetDllGlobals != 0 &&
|
||||
m_Initialize != 0 &&
|
||||
m_Shutdown != 0 &&
|
||||
m_DoState != 0)
|
||||
valid = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo)
|
||||
{
|
||||
if (m_GetDllInfo != 0)
|
||||
{
|
||||
m_GetDllInfo(&_pluginInfo);
|
||||
return(true);
|
||||
}
|
||||
|
||||
return(false);
|
||||
void *CPlugin::LoadSymbol(const char *sym) {
|
||||
return m_hInstLib.Get(sym);
|
||||
}
|
||||
|
||||
bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) {
|
||||
if (m_GetDllInfo != 0) {
|
||||
m_GetDllInfo(&_pluginInfo);
|
||||
return(true);
|
||||
}
|
||||
|
||||
void CPlugin::Config(HWND _hwnd)
|
||||
{
|
||||
if (m_DllConfig != 0)
|
||||
{
|
||||
m_DllConfig(_hwnd);
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
void CPlugin::Debug(HWND _hwnd, bool Show)
|
||||
{
|
||||
if (m_DllDebugger != 0)
|
||||
{
|
||||
m_DllDebugger(_hwnd, Show);
|
||||
}
|
||||
|
||||
void CPlugin::Config(HWND _hwnd) {
|
||||
if (m_DllConfig != 0)
|
||||
m_DllConfig(_hwnd);
|
||||
|
||||
}
|
||||
|
||||
void CPlugin::SetGlobals(PLUGIN_GLOBALS& _pluginGlobals)
|
||||
{
|
||||
if (m_SetDllGlobals != 0)
|
||||
{
|
||||
m_SetDllGlobals(&_pluginGlobals);
|
||||
}
|
||||
void CPlugin::Debug(HWND _hwnd, bool Show) {
|
||||
if (m_DllDebugger != 0)
|
||||
m_DllDebugger(_hwnd, Show);
|
||||
|
||||
}
|
||||
|
||||
} // end of namespace Common
|
||||
void CPlugin::SetGlobals(PLUGIN_GLOBALS* _pluginGlobals) {
|
||||
if (m_SetDllGlobals != 0)
|
||||
m_SetDllGlobals(_pluginGlobals);
|
||||
|
||||
}
|
||||
|
||||
void CPlugin::DoState(unsigned char **ptr, int mode) {
|
||||
if (m_DoState != 0)
|
||||
m_DoState(ptr, mode);
|
||||
}
|
||||
|
||||
void CPlugin::Initialize(void *init) {
|
||||
if (m_Initialize != 0)
|
||||
m_Initialize(init);
|
||||
}
|
||||
|
||||
void CPlugin::Shutdown() {
|
||||
if (m_Shutdown != 0)
|
||||
m_Shutdown();
|
||||
}
|
||||
|
||||
} // end of namespace Common
|
||||
@@ -19,35 +19,52 @@
|
||||
#define _PLUGIN_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "../../../PluginSpecs/PluginSpecs.h"
|
||||
#include "PluginSpecs.h"
|
||||
#include "DynamicLibrary.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
typedef void (__cdecl * TGetDllInfo)(PLUGIN_INFO*);
|
||||
typedef void (__cdecl * TDllConfig)(HWND);
|
||||
typedef void (__cdecl * TDllDebugger)(HWND, bool);
|
||||
typedef void (__cdecl * TSetDllGlobals)(PLUGIN_GLOBALS*);
|
||||
typedef void (__cdecl * TInitialize)(void *);
|
||||
typedef void (__cdecl * TShutdown)();
|
||||
typedef void (__cdecl * TDoState)(unsigned char**, int);
|
||||
|
||||
class CPlugin
|
||||
{
|
||||
public:
|
||||
|
||||
static void Release(void);
|
||||
static bool Load(const char* _szName);
|
||||
CPlugin(const char* _szName);
|
||||
~CPlugin();
|
||||
|
||||
static bool GetInfo(PLUGIN_INFO& _pluginInfo);
|
||||
static void SetGlobals(PLUGIN_GLOBALS& _PluginGlobals);
|
||||
virtual bool IsValid() {return valid;};
|
||||
|
||||
static void Config(HWND _hwnd);
|
||||
static void About(HWND _hwnd);
|
||||
static void Debug(HWND _hwnd, bool Show);
|
||||
bool GetInfo(PLUGIN_INFO& _pluginInfo);
|
||||
void SetGlobals(PLUGIN_GLOBALS* _PluginGlobals);
|
||||
void *LoadSymbol(const char *sym);
|
||||
|
||||
void Config(HWND _hwnd);
|
||||
void About(HWND _hwnd);
|
||||
void Debug(HWND _hwnd, bool Show);
|
||||
void DoState(unsigned char **ptr, int mode);
|
||||
void Initialize(void *init);
|
||||
void Shutdown();
|
||||
|
||||
private:
|
||||
|
||||
static DynamicLibrary m_hInstLib;
|
||||
|
||||
static void (__cdecl * m_GetDllInfo)(PLUGIN_INFO* _PluginInfo);
|
||||
static void (__cdecl * m_DllConfig)(HWND _hParent);
|
||||
static void (__cdecl * m_DllDebugger)(HWND _hParent, bool Show);
|
||||
static void (__cdecl * m_SetDllGlobals)(PLUGIN_GLOBALS* _PluginGlobals);
|
||||
DynamicLibrary m_hInstLib;
|
||||
bool valid;
|
||||
|
||||
// Functions
|
||||
TGetDllInfo m_GetDllInfo;
|
||||
TDllConfig m_DllConfig;
|
||||
TDllDebugger m_DllDebugger;
|
||||
TSetDllGlobals m_SetDllGlobals;
|
||||
TInitialize m_Initialize;
|
||||
TShutdown m_Shutdown;
|
||||
TDoState m_DoState;
|
||||
};
|
||||
} // end of namespace Common
|
||||
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -1,4 +1,4 @@
|
||||
# -*- python -*-
|
||||
# -*- python -*-
|
||||
|
||||
Import('env')
|
||||
|
||||
@@ -17,6 +17,10 @@ files = [
|
||||
"MemArena.cpp",
|
||||
"MemoryUtil.cpp",
|
||||
"Plugin.cpp",
|
||||
"PluginDSP.cpp",
|
||||
"PluginWiimote.cpp",
|
||||
"PluginVideo.cpp",
|
||||
"PluginPAD.cpp",
|
||||
"StringUtil.cpp",
|
||||
"TestFramework.cpp",
|
||||
"Thunk.cpp",
|
||||
|
||||
@@ -20,21 +20,18 @@
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/timeb.h>
|
||||
|
||||
#include "Common.h"
|
||||
#include "Timer.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <sys/timeb.h>
|
||||
|
||||
u32 timeGetTime()
|
||||
{
|
||||
struct timeb t;
|
||||
ftime(&t);
|
||||
return((u32)(t.time * 1000 + t.millitm));
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -88,7 +85,6 @@ void _time64(u64* t)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
u64 Timer::GetTimeSinceJan1970(void)
|
||||
{
|
||||
time_t ltime;
|
||||
@@ -108,4 +104,14 @@ u64 Timer::GetLocalTimeSinceJan1970(void)
|
||||
|
||||
return (u64)(sysTime + tzDiff);
|
||||
}
|
||||
|
||||
std::string Timer::GetTimeFormatted(void)
|
||||
{
|
||||
struct timeb tp;
|
||||
(void)::ftime(&tp);
|
||||
char temp[32];
|
||||
sprintf(temp, "%02hi:%02i:%03i", tp.time/60, tp.time%60, tp.millitm);
|
||||
|
||||
return std::string(temp);
|
||||
}
|
||||
} // end of namespace Common
|
||||
|
||||
@@ -39,6 +39,8 @@ class Timer
|
||||
static u64 GetTimeSinceJan1970();
|
||||
static u64 GetLocalTimeSinceJan1970();
|
||||
|
||||
static std::string GetTimeFormatted();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Version="9.00"
|
||||
Name="Core"
|
||||
ProjectGUID="{F0B874CB-4476-4199-9315-8343D05AE684}"
|
||||
RootNamespace="Core"
|
||||
@@ -45,7 +45,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -116,7 +116,7 @@
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
@@ -191,7 +191,7 @@
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
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"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
@@ -268,7 +268,7 @@
|
||||
OmitFramePointers="true"
|
||||
EnableFiberSafeOptimizations="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"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
@@ -343,7 +343,7 @@
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
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"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="true"
|
||||
@@ -418,7 +418,7 @@
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="true"
|
||||
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"
|
||||
RuntimeLibrary="0"
|
||||
BufferSecurityCheck="false"
|
||||
@@ -772,74 +772,6 @@
|
||||
</File>
|
||||
</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
|
||||
Name="PowerPC"
|
||||
>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
// it will automatically relatch and fire a new interrupt.
|
||||
|
||||
// Then there's the DSP... what likely happens is that the fifo-latched-interrupt handler
|
||||
// kicks off the DSP, requesting it to fill up the just used buffer through the AXList (or
|
||||
// kicks off the DSP, requesting it to fill up the just used buffer through the AXList (or
|
||||
// whatever it might be called in Nintendo games).
|
||||
|
||||
#include "DSP.h"
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "PeripheralInterface.h"
|
||||
#include "AudioInterface.h"
|
||||
#include "../PowerPC/PowerPC.h"
|
||||
#include "../Plugins/Plugin_DSP.h"
|
||||
#include "../PluginManager.h"
|
||||
|
||||
namespace DSP
|
||||
{
|
||||
@@ -63,7 +63,7 @@ enum
|
||||
AR_DMA_ARADDR_H = 0x5024,
|
||||
AR_DMA_ARADDR_L = 0x5026,
|
||||
AR_DMA_CNT_H = 0x5028,
|
||||
AR_DMA_CNT_L = 0x502A
|
||||
AR_DMA_CNT_L = 0x502A
|
||||
};
|
||||
|
||||
// aram size and mask
|
||||
@@ -79,7 +79,7 @@ enum
|
||||
union UARAMCount
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
struct
|
||||
{
|
||||
unsigned count : 31;
|
||||
unsigned dir : 1;
|
||||
@@ -93,7 +93,7 @@ union UDSPControl
|
||||
u16 Hex;
|
||||
struct
|
||||
{
|
||||
unsigned DSPReset : 1; // Write 1 to reset and waits for 0
|
||||
unsigned DSPReset : 1; // Write 1 to reset and waits for 0
|
||||
unsigned DSPAssertInt : 1;
|
||||
unsigned DSPHalt : 1;
|
||||
|
||||
@@ -122,7 +122,7 @@ struct DSPState
|
||||
IntControl = 0;
|
||||
DSPControl.Hex = 0;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Blocks are 32 bytes.
|
||||
union UAudioDMAControl
|
||||
@@ -189,7 +189,7 @@ void DoState(PointerWrap &p)
|
||||
|
||||
|
||||
void UpdateInterrupts();
|
||||
void Update_ARAM_DMA();
|
||||
void Update_ARAM_DMA();
|
||||
void WriteARAM(u8 _iValue, u32 _iAddress);
|
||||
bool Update_DSP_ReadRegister();
|
||||
void Update_DSP_WriteRegister();
|
||||
@@ -233,31 +233,31 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
|
||||
if (_iAddress != 0xCC005004) {
|
||||
LOGV(DSPINTERFACE, 3, "DSPInterface(r16) 0x%08x", _iAddress);
|
||||
}
|
||||
|
||||
Common::PluginDSP *dsp = CPluginManager::GetInstance().GetDSP();
|
||||
switch (_iAddress & 0xFFFF)
|
||||
{
|
||||
// ==================================================================================
|
||||
// AI_REGS 0x5000+
|
||||
// ==================================================================================
|
||||
case DSP_MAIL_TO_DSP_HI:
|
||||
_uReturnValue = PluginDSP::DSP_ReadMailboxHigh(true);
|
||||
_uReturnValue = dsp->DSP_ReadMailboxHigh(true);
|
||||
return;
|
||||
|
||||
case DSP_MAIL_TO_DSP_LO:
|
||||
_uReturnValue = PluginDSP::DSP_ReadMailboxLow(true);
|
||||
_uReturnValue = dsp->DSP_ReadMailboxLow(true);
|
||||
return;
|
||||
|
||||
case DSP_MAIL_FROM_DSP_HI:
|
||||
_uReturnValue = PluginDSP::DSP_ReadMailboxHigh(false);
|
||||
_uReturnValue = dsp->DSP_ReadMailboxHigh(false);
|
||||
return;
|
||||
|
||||
case DSP_MAIL_FROM_DSP_LO:
|
||||
_uReturnValue = PluginDSP::DSP_ReadMailboxLow(false);
|
||||
_uReturnValue = dsp->DSP_ReadMailboxLow(false);
|
||||
return;
|
||||
|
||||
case DSP_CONTROL:
|
||||
_uReturnValue = (g_dspState.DSPControl.Hex & ~DSP_CONTROL_MASK) |
|
||||
(PluginDSP::DSP_ReadControlRegister() & DSP_CONTROL_MASK);
|
||||
_uReturnValue = (g_dspState.DSPControl.Hex & ~DSP_CONTROL_MASK) |
|
||||
(dsp->DSP_ReadControlRegister() & DSP_CONTROL_MASK);
|
||||
return;
|
||||
|
||||
// ==================================================================================
|
||||
@@ -317,7 +317,7 @@ void Read16(u16& _uReturnValue, const u32 _iAddress)
|
||||
void Write16(const u16 _Value, const u32 _Address)
|
||||
{
|
||||
LOGV(DSPINTERFACE, 3, "DSPInterface(w16) 0x%04x 0x%08x", _Value, _Address);
|
||||
|
||||
Common::PluginDSP *dsp = CPluginManager::GetInstance().GetDSP();
|
||||
switch(_Address & 0xFFFF)
|
||||
{
|
||||
// ==================================================================================
|
||||
@@ -325,18 +325,18 @@ void Write16(const u16 _Value, const u32 _Address)
|
||||
// ==================================================================================
|
||||
|
||||
case DSP_MAIL_TO_DSP_HI:
|
||||
PluginDSP::DSP_WriteMailboxHigh(true, _Value);
|
||||
dsp->DSP_WriteMailboxHigh(true, _Value);
|
||||
break;
|
||||
|
||||
case DSP_MAIL_TO_DSP_LO:
|
||||
PluginDSP::DSP_WriteMailboxLow(true, _Value);
|
||||
case DSP_MAIL_TO_DSP_LO:
|
||||
dsp->DSP_WriteMailboxLow(true, _Value);
|
||||
break;
|
||||
|
||||
case DSP_MAIL_FROM_DSP_HI:
|
||||
case DSP_MAIL_FROM_DSP_HI:
|
||||
_dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_HI");
|
||||
break;
|
||||
|
||||
case DSP_MAIL_FROM_DSP_LO:
|
||||
case DSP_MAIL_FROM_DSP_LO:
|
||||
_dbg_assert_msg_(DSPINTERFACE, 0, "W16: DSP_MAIL_FROM_DSP_LO");
|
||||
break;
|
||||
|
||||
@@ -346,8 +346,8 @@ void Write16(const u16 _Value, const u32 _Address)
|
||||
case DSP_CONTROL:
|
||||
{
|
||||
UDSPControl tmpControl;
|
||||
tmpControl.Hex = (_Value& ~DSP_CONTROL_MASK) |
|
||||
(PluginDSP::DSP_WriteControlRegister(_Value) & DSP_CONTROL_MASK);
|
||||
tmpControl.Hex = (_Value& ~DSP_CONTROL_MASK) |
|
||||
(dsp->DSP_WriteControlRegister(_Value) & DSP_CONTROL_MASK);
|
||||
|
||||
// Update DSP related flags
|
||||
g_dspState.DSPControl.DSPReset = tmpControl.DSPReset;
|
||||
@@ -379,7 +379,7 @@ void Write16(const u16 _Value, const u32 _Address)
|
||||
|
||||
UpdateInterrupts();
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
// ==================================================================================
|
||||
// AR_REGS 0x501x+
|
||||
@@ -397,9 +397,9 @@ void Write16(const u16 _Value, const u32 _Address)
|
||||
case 0x501a:
|
||||
break;
|
||||
|
||||
case AR_DMA_MMADDR_H:
|
||||
case AR_DMA_MMADDR_H:
|
||||
g_arDMA.MMAddr = (g_arDMA.MMAddr & 0xFFFF) | (_Value<<16); break;
|
||||
case AR_DMA_MMADDR_L:
|
||||
case AR_DMA_MMADDR_L:
|
||||
g_arDMA.MMAddr = (g_arDMA.MMAddr & 0xFFFF0000) | (_Value); break;
|
||||
|
||||
case AR_DMA_ARADDR_H:
|
||||
@@ -408,7 +408,7 @@ void Write16(const u16 _Value, const u32 _Address)
|
||||
g_arDMA.ARAddr = (g_arDMA.ARAddr & 0xFFFF0000) | (_Value); break;
|
||||
|
||||
case AR_DMA_CNT_H:
|
||||
g_arDMA.Cnt.Hex = (g_arDMA.Cnt.Hex & 0xFFFF) | (_Value<<16);
|
||||
g_arDMA.Cnt.Hex = (g_arDMA.Cnt.Hex & 0xFFFF) | (_Value<<16);
|
||||
g_arDMA.CntValid[0] = true;
|
||||
Update_ARAM_DMA();
|
||||
break;
|
||||
@@ -421,7 +421,7 @@ void Write16(const u16 _Value, const u32 _Address)
|
||||
|
||||
// ==================================================================================
|
||||
// Audio DMA_REGS 0x5030+
|
||||
// This is the DMA that goes straight out the speaker.
|
||||
// This is the DMA that goes straight out the speaker.
|
||||
// ==================================================================================
|
||||
case AUDIO_DMA_START_HI:
|
||||
g_audioDMA.SourceAddress = (g_audioDMA.SourceAddress & 0xFFFF) | (_Value<<16);
|
||||
@@ -462,9 +462,9 @@ void UpdateAudioDMA()
|
||||
if (g_audioDMA.AudioDMAControl.Enabled && g_audioDMA.BlocksLeft) {
|
||||
// Read audio at g_audioDMA.ReadAddress in RAM and push onto an external audio fifo in the emulator,
|
||||
// to be mixed with the disc streaming output. If that audio queue fills up, we delay the emulator.
|
||||
|
||||
Common::PluginDSP *dsp = CPluginManager::GetInstance().GetDSP();
|
||||
// TO RESTORE OLD BEHAVIOUR, COMMENT OUT THIS LINE
|
||||
PluginDSP::DSP_SendAIBuffer(g_audioDMA.ReadAddress, AudioInterface::GetDSPSampleRate());
|
||||
dsp->DSP_SendAIBuffer(g_audioDMA.ReadAddress, AudioInterface::GetDSPSampleRate());
|
||||
|
||||
g_audioDMA.ReadAddress += 32;
|
||||
g_audioDMA.BlocksLeft--;
|
||||
@@ -506,19 +506,19 @@ void Write32(const u32 _iValue, const u32 _iAddress)
|
||||
switch (_iAddress & 0xFFFF)
|
||||
{
|
||||
// ==================================================================================
|
||||
// AR_REGS - i dont know why they are accessed 32 bit too ...
|
||||
// AR_REGS - i dont know why they are accessed 32 bit too ...
|
||||
// ==================================================================================
|
||||
|
||||
case AR_DMA_MMADDR_H:
|
||||
g_arDMA.MMAddr = _iValue;
|
||||
case AR_DMA_MMADDR_H:
|
||||
g_arDMA.MMAddr = _iValue;
|
||||
break;
|
||||
|
||||
case AR_DMA_ARADDR_H:
|
||||
g_arDMA.ARAddr = _iValue;
|
||||
g_arDMA.ARAddr = _iValue;
|
||||
break;
|
||||
|
||||
case AR_DMA_CNT_H:
|
||||
g_arDMA.Cnt.Hex = _iValue;
|
||||
g_arDMA.Cnt.Hex = _iValue;
|
||||
g_arDMA.CntValid[0] = g_arDMA.CntValid[1] = true;
|
||||
Update_ARAM_DMA();
|
||||
break;
|
||||
@@ -531,7 +531,7 @@ void Write32(const u32 _iValue, const u32 _iAddress)
|
||||
|
||||
// __________________________________________________________________________________________________
|
||||
// UpdateInterrupts
|
||||
//
|
||||
//
|
||||
void UpdateInterrupts()
|
||||
{
|
||||
if ((g_dspState.DSPControl.AID & g_dspState.DSPControl.AID_mask) ||
|
||||
@@ -648,7 +648,7 @@ u8 ReadARAM(u32 _iAddress)
|
||||
return g_ARAM[_iAddress & ARAM_MASK];
|
||||
}
|
||||
|
||||
u8* GetARAMPtr()
|
||||
u8* GetARAMPtr()
|
||||
{
|
||||
return g_ARAM;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "AudioInterface.h"
|
||||
#include "VideoInterface.h"
|
||||
#include "WII_IPC.h"
|
||||
#include "../Plugins/Plugin_Video.h"
|
||||
#include "../PluginManager.h"
|
||||
#include "../CoreTiming.h"
|
||||
#include "SystemTimers.h"
|
||||
#include "../IPC_HLE/WII_IPC_HLE.h"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "PeripheralInterface.h"
|
||||
|
||||
#include "../Plugins/Plugin_PAD.h"
|
||||
#include "../PluginManager.h"
|
||||
|
||||
#include "SI.h"
|
||||
#include "SI_Device.h"
|
||||
@@ -111,13 +111,13 @@ struct SSIChannel
|
||||
USIChannelIn_Hi m_InHi;
|
||||
USIChannelIn_Lo m_InLo;
|
||||
ISIDevice* m_pDevice;
|
||||
};
|
||||
};
|
||||
|
||||
// SI Poll: Controls how often a device is polled
|
||||
union USIPoll
|
||||
union USIPoll
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
struct
|
||||
{
|
||||
unsigned VBCPY3 : 1;
|
||||
unsigned VBCPY2 : 1;
|
||||
@@ -137,7 +137,7 @@ union USIPoll
|
||||
union USIComCSR
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
struct
|
||||
{
|
||||
unsigned TSTART : 1;
|
||||
unsigned CHANNEL : 2; // determines which SI channel will be used the communication interface.
|
||||
@@ -200,7 +200,7 @@ union USIStatusReg
|
||||
union USIEXIClockCount
|
||||
{
|
||||
u32 Hex;
|
||||
struct
|
||||
struct
|
||||
{
|
||||
unsigned LOCK : 1;
|
||||
unsigned : 30;
|
||||
@@ -225,7 +225,7 @@ void DoState(PointerWrap &p)
|
||||
p.Do(g_SIBuffer);
|
||||
}
|
||||
|
||||
static void GenerateSIInterrupt(SIInterruptType _SIInterrupt);
|
||||
static void GenerateSIInterrupt(SIInterruptType _SIInterrupt);
|
||||
void RunSIBuffer();
|
||||
void UpdateInterrupts();
|
||||
|
||||
@@ -236,17 +236,24 @@ void Init()
|
||||
g_Channel[i].m_Out.Hex = 0;
|
||||
g_Channel[i].m_InHi.Hex = 0;
|
||||
g_Channel[i].m_InLo.Hex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Common::PluginPAD* pad = CPluginManager::GetInstance().GetPAD(0);
|
||||
|
||||
unsigned int AttachedPadMask;
|
||||
if (pad != NULL)
|
||||
AttachedPadMask = pad->PAD_GetAttachedPads();
|
||||
else
|
||||
AttachedPadMask = 1;
|
||||
|
||||
unsigned int AttachedPadMask = PluginPAD::PAD_GetAttachedPads ? PluginPAD::PAD_GetAttachedPads() : 1;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (AttachedPadMask & (1 << i))
|
||||
g_Channel[i].m_pDevice = new CSIDevice_GCController(i);
|
||||
else
|
||||
g_Channel[i].m_pDevice = new CSIDevice_Dummy(i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
g_Poll.Hex = 0;
|
||||
g_ComCSR.Hex = 0;
|
||||
g_StatusReg.Hex = 0;
|
||||
@@ -285,13 +292,13 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
|
||||
_uReturnValue = g_Channel[0].m_Out.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_0_IN_HI:
|
||||
case SI_CHANNEL_0_IN_HI:
|
||||
g_StatusReg.RDST0 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[0].m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_0_IN_LO:
|
||||
case SI_CHANNEL_0_IN_LO:
|
||||
g_StatusReg.RDST0 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[0].m_InLo.Hex;
|
||||
@@ -304,13 +311,13 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
|
||||
_uReturnValue = g_Channel[1].m_Out.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_1_IN_HI:
|
||||
case SI_CHANNEL_1_IN_HI:
|
||||
g_StatusReg.RDST1 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[1].m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_1_IN_LO:
|
||||
case SI_CHANNEL_1_IN_LO:
|
||||
g_StatusReg.RDST1 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[1].m_InLo.Hex;
|
||||
@@ -323,13 +330,13 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
|
||||
_uReturnValue = g_Channel[2].m_Out.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_2_IN_HI:
|
||||
case SI_CHANNEL_2_IN_HI:
|
||||
g_StatusReg.RDST2 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[2].m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_2_IN_LO:
|
||||
case SI_CHANNEL_2_IN_LO:
|
||||
g_StatusReg.RDST2 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[2].m_InLo.Hex;
|
||||
@@ -348,7 +355,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
|
||||
_uReturnValue = g_Channel[3].m_InHi.Hex;
|
||||
return;
|
||||
|
||||
case SI_CHANNEL_3_IN_LO:
|
||||
case SI_CHANNEL_3_IN_LO:
|
||||
g_StatusReg.RDST3 = 0;
|
||||
UpdateInterrupts();
|
||||
_uReturnValue = g_Channel[3].m_InLo.Hex;
|
||||
@@ -364,7 +371,7 @@ void Read32(u32& _uReturnValue, const u32 _iAddress)
|
||||
LOG(SERIALINTERFACE, "(r32-unk): 0x%08x", _iAddress);
|
||||
_dbg_assert_(SERIALINTERFACE,0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// error
|
||||
_uReturnValue = 0xdeadbeef;
|
||||
@@ -399,7 +406,7 @@ void Write32(const u32 _iValue, const u32 _iAddress)
|
||||
case SI_CHANNEL_3_IN_LO: g_Channel[3].m_InLo.Hex = _iValue; break;
|
||||
|
||||
case SI_POLL:
|
||||
g_Poll.Hex = _iValue;
|
||||
g_Poll.Hex = _iValue;
|
||||
break;
|
||||
|
||||
case SI_COM_CSR:
|
||||
@@ -423,7 +430,7 @@ void Write32(const u32 _iValue, const u32 _iAddress)
|
||||
}
|
||||
break;
|
||||
|
||||
case SI_STATUS_REG:
|
||||
case SI_STATUS_REG:
|
||||
{
|
||||
USIStatusReg tmpStatus(_iValue);
|
||||
|
||||
@@ -465,8 +472,8 @@ void Write32(const u32 _iValue, const u32 _iAddress)
|
||||
}
|
||||
break;
|
||||
|
||||
case SI_EXI_CLOCK_COUNT:
|
||||
g_EXIClockCount.Hex = _iValue;
|
||||
case SI_EXI_CLOCK_COUNT:
|
||||
g_EXIClockCount.Hex = _iValue;
|
||||
break;
|
||||
|
||||
case 0x80:
|
||||
@@ -476,7 +483,7 @@ void Write32(const u32 _iValue, const u32 _iAddress)
|
||||
default:
|
||||
_dbg_assert_(SERIALINTERFACE,0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateInterrupts()
|
||||
@@ -502,7 +509,7 @@ void UpdateInterrupts()
|
||||
|
||||
void GenerateSIInterrupt(SIInterruptType _SIInterrupt)
|
||||
{
|
||||
switch(_SIInterrupt)
|
||||
switch(_SIInterrupt)
|
||||
{
|
||||
case INT_RDSTINT: g_ComCSR.RDSTINT = 1; break;
|
||||
case INT_TCINT: g_ComCSR.TCINT = 1; break;
|
||||
@@ -524,23 +531,23 @@ void UpdateDevices()
|
||||
}
|
||||
|
||||
void RunSIBuffer()
|
||||
{
|
||||
{
|
||||
// math inLength
|
||||
int inLength = g_ComCSR.INLNGTH;
|
||||
if (inLength == 0)
|
||||
if (inLength == 0)
|
||||
inLength = 128;
|
||||
else
|
||||
else
|
||||
inLength++;
|
||||
|
||||
// math outLength
|
||||
int outLength = g_ComCSR.OUTLNGTH;
|
||||
if (outLength == 0)
|
||||
if (outLength == 0)
|
||||
outLength = 128;
|
||||
else
|
||||
else
|
||||
outLength++;
|
||||
|
||||
#ifdef LOGGING
|
||||
int numOutput =
|
||||
int numOutput =
|
||||
#endif
|
||||
g_Channel[g_ComCSR.CHANNEL].m_pDevice->RunBuffer(g_SIBuffer, inLength);
|
||||
LOGV(SERIALINTERFACE, 2, "RunSIBuffer (intLen: %i outLen: %i) (processed: %i)", inLength, outLength, numOutput);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user