separate SI to be more like EXI, this will be helpful to keep each device in it's own file(s), and fix some menu text. SI devices which are interesting (to me) are GC keyboard, GBA, and N64 devices. Possibly SI.cpp can have the channel part separated out like EXI? Just committing like this to see if this is ok.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1776 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Shawn Hoffman 2009-01-04 22:55:55 +00:00
parent 42bcdc4292
commit b2e96e1ca5
12 changed files with 1059 additions and 984 deletions

View File

@ -607,19 +607,35 @@
Name="SI - Serial Interface" Name="SI - Serial Interface"
> >
<File <File
RelativePath=".\Src\Hw\SerialInterface.cpp" RelativePath=".\Src\HW\SI.cpp"
> >
</File> </File>
<File <File
RelativePath=".\Src\Hw\SerialInterface.h" RelativePath=".\Src\HW\SI.h"
> >
</File> </File>
<File <File
RelativePath=".\Src\Hw\SerialInterface_Devices.cpp" RelativePath=".\Src\HW\SI_Device.cpp"
> >
</File> </File>
<File <File
RelativePath=".\Src\Hw\SerialInterface_Devices.h" RelativePath=".\Src\HW\SI_Device.h"
>
</File>
<File
RelativePath=".\Src\HW\SI_DeviceGBA.cpp"
>
</File>
<File
RelativePath=".\Src\HW\SI_DeviceGBA.h"
>
</File>
<File
RelativePath=".\Src\HW\SI_DeviceGCController.cpp"
>
</File>
<File
RelativePath=".\Src\HW\SI_DeviceGCController.h"
> >
</File> </File>
</Filter> </Filter>

View File

@ -29,7 +29,7 @@
#include "Memmap.h" #include "Memmap.h"
#include "PeripheralInterface.h" #include "PeripheralInterface.h"
#include "PixelEngine.h" #include "PixelEngine.h"
#include "SerialInterface.h" #include "SI.h"
#include "AudioInterface.h" #include "AudioInterface.h"
#include "VideoInterface.h" #include "VideoInterface.h"
#include "WII_IPC.h" #include "WII_IPC.h"

View File

@ -31,7 +31,7 @@
#include "DVDInterface.h" #include "DVDInterface.h"
#include "GPFifo.h" #include "GPFifo.h"
#include "VideoInterface.h" #include "VideoInterface.h"
#include "SerialInterface.h" #include "SI.h"
#include "EXI.h" #include "EXI.h"
#include "PixelEngine.h" #include "PixelEngine.h"
#include "CommandProcessor.h" #include "CommandProcessor.h"

View File

@ -15,20 +15,17 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <string.h>
#include "Common.h" #include "Common.h"
#include "ChunkFile.h" #include "ChunkFile.h"
#include "SerialInterface.h"
#include "SerialInterface_Devices.h"
#include "PeripheralInterface.h" #include "PeripheralInterface.h"
#include "CPU.h"
#include "../PowerPC/PowerPC.h"
#include "../Plugins/Plugin_PAD.h" #include "../Plugins/Plugin_PAD.h"
#include "SI.h"
#include "SI_Device.h"
#include "SI_DeviceGCController.h"
namespace SerialInterface namespace SerialInterface
{ {
@ -554,4 +551,3 @@ void RunSIBuffer()
} }
} // end of namespace SerialInterface } // end of namespace SerialInterface

View File

@ -14,7 +14,6 @@
// 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/
#ifndef _SERIALINTERFACE_H #ifndef _SERIALINTERFACE_H
#define _SERIALINTERFACE_H #define _SERIALINTERFACE_H
@ -34,6 +33,4 @@ void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
void HWCALL Write32(const u32 _iValue, const u32 _iAddress); void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
}; // end of namespace SerialInterface }; // end of namespace SerialInterface
#endif #endif

View File

@ -0,0 +1,70 @@
// 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 "SI_Device.h"
// =====================================================================================================
// --- base class ---
// =====================================================================================================
int ISIDevice::RunBuffer(u8* _pBuffer, int _iLength)
{
#ifdef _DEBUG
LOG(SERIALINTERFACE, "Send Data Device(%i) - Length(%i) ", ISIDevice::m_iDeviceNumber,_iLength);
char szTemp[256] = "";
int num = 0;
while(num < _iLength)
{
char szTemp2[128] = "";
sprintf(szTemp2, "0x%02x ", _pBuffer[num^3]);
strcat(szTemp, szTemp2);
num++;
if ((num % 8) == 0)
{
LOG(SERIALINTERFACE, szTemp);
szTemp[0] = '\0';
}
}
LOG(SERIALINTERFACE, szTemp);
#endif
return 0;
};
// =====================================================================================================
// --- dummy device ---
// =====================================================================================================
CSIDevice_Dummy::CSIDevice_Dummy(int _iDeviceNumber) :
ISIDevice(_iDeviceNumber)
{}
int CSIDevice_Dummy::RunBuffer(u8* _pBuffer, int _iLength)
{
reinterpret_cast<u32*>(_pBuffer)[0] = 0x00000000; // no device
return 4;
}
bool CSIDevice_Dummy::GetData(u32& _Hi, u32& _Low)
{
return false;
}
void CSIDevice_Dummy::SendCommand(u32 _Cmd)
{
}

View File

@ -0,0 +1,108 @@
// 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 _SIDEVICE_H
#define _SIDEVICE_H
#include "Common.h"
#define SI_ERROR_NO_RESPONSE 0x0008 // nothing is attached
#define SI_ERROR_UNKNOWN 0x0040 // unknown device is attached
#define SI_ERROR_BUSY 0x0080 // still detecting
// Device types
#define SI_TYPE_MASK 0x18000000u
#define SI_TYPE_N64 0x00000000u
#define SI_TYPE_GC 0x08000000u
// GameCube
#define SI_GC_WIRELESS 0x80000000u
#define SI_GC_NOMOTOR 0x20000000u // no rumble motor
#define SI_GC_STANDARD 0x01000000u
// WaveBird
#define SI_WIRELESS_RECEIVED 0x40000000u // 0: no wireless unit
#define SI_WIRELESS_IR 0x04000000u // 0: IR 1: RF
#define SI_WIRELESS_STATE 0x02000000u // 0: variable 1: fixed
#define SI_WIRELESS_ORIGIN 0x00200000u // 0: invalid 1: valid
#define SI_WIRELESS_FIX_ID 0x00100000u // 0: not fixed 1: fixed
#define SI_WIRELESS_TYPE 0x000f0000u
#define SI_WIRELESS_LITE_MASK 0x000c0000u // 0: normal 1: lite controller
#define SI_WIRELESS_LITE 0x00040000u // 0: normal 1: lite controller
#define SI_WIRELESS_CONT_MASK 0x00080000u // 0: non-controller 1: non-controller
#define SI_WIRELESS_CONT 0x00000000u
#define SI_WIRELESS_ID 0x00c0ff00u
#define SI_WIRELESS_TYPE_ID (SI_WIRELESS_TYPE | SI_WIRELESS_ID)
// "Complete" IDs
#define SI_N64_CONTROLLER (SI_TYPE_N64 | 0x05000000)
#define SI_N64_MIC (SI_TYPE_N64 | 0x00010000)
#define SI_N64_KEYBOARD (SI_TYPE_N64 | 0x00020000)
#define SI_N64_MOUSE (SI_TYPE_N64 | 0x02000000)
#define SI_GBA (SI_TYPE_N64 | 0x00040000)
#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD)
#define SI_GC_RECEIVER (SI_TYPE_GC | SI_GC_WIRELESS)
#define SI_GC_WAVEBIRD (SI_TYPE_GC | SI_GC_WIRELESS | SI_GC_STANDARD | SI_WIRELESS_STATE | SI_WIRELESS_FIX_ID)
#define SI_GC_KEYBOARD (SI_TYPE_GC | 0x00200000)
#define SI_GC_STEERING (SI_TYPE_GC | 0x00000000)
class ISIDevice
{
protected:
int m_iDeviceNumber;
public:
// constructor
ISIDevice(int _iDeviceNumber) :
m_iDeviceNumber(_iDeviceNumber)
{ }
virtual ~ISIDevice() { }
// run the SI Buffer
virtual int RunBuffer(u8* _pBuffer, int _iLength);
// return true on new data
virtual bool GetData(u32& _Hi, u32& _Low) = 0;
// send a command directly (no detour per buffer)
virtual void SendCommand(u32 _Cmd) = 0;
};
// =====================================================================================================
// dummy - no device attached
// =====================================================================================================
class CSIDevice_Dummy : public ISIDevice
{
public:
// constructor
CSIDevice_Dummy(int _iDeviceNumber);
// run the SI Buffer
virtual int RunBuffer(u8* _pBuffer, int _iLength);
// return true on new data
virtual bool GetData(u32& _Hi, u32& _Low);
// send a command directly
virtual void SendCommand(u32 _Cmd);
};
#endif

View File

@ -18,56 +18,13 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "SerialInterface_Devices.h" #include "SI_Device.h"
#include "SI_DeviceGCController.h"
#include "../Plugins/Plugin_PAD.h"
#include "EXI_Device.h" #include "EXI_Device.h"
#include "EXI_DeviceMic.h" #include "EXI_DeviceMic.h"
#include "../Plugins/Plugin_PAD.h"
#include "../PowerPC/PowerPC.h"
#include "CPU.h"
#define SI_TYPE_GC 0x08000000u
#define SI_GC_STANDARD 0x01000000u // dolphin standard controller
#define SI_GC_NOMOTOR 0x20000000u // no rumble motor
#define SI_GC_KEYBOARD (SI_TYPE_GC | 0x00200000)
#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD)
#define SI_MAX_COMCSR_INLNGTH 128
#define SI_MAX_COMCSR_OUTLNGTH 128
// =====================================================================================================
// --- base class ---
// =====================================================================================================
int ISIDevice::RunBuffer(u8* _pBuffer, int _iLength)
{
#ifdef _DEBUG
LOG(SERIALINTERFACE, "Send Data Device(%i) - Length(%i) ", ISIDevice::m_iDeviceNumber,_iLength);
char szTemp[256] = "";
int num = 0;
while(num < _iLength)
{
char szTemp2[128] = "";
sprintf(szTemp2, "0x%02x ", _pBuffer[num^3]);
strcat(szTemp, szTemp2);
num++;
if ((num % 8) == 0)
{
LOG(SERIALINTERFACE, szTemp);
szTemp[0] = '\0';
}
}
LOG(SERIALINTERFACE, szTemp);
#endif
return 0;
};
// ===================================================================================================== // =====================================================================================================
// --- standard gamecube controller --- // --- standard gamecube controller ---
// ===================================================================================================== // =====================================================================================================
@ -110,7 +67,7 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
case CMD_ORIGIN: case CMD_ORIGIN:
{ {
LOG(SERIALINTERFACE, "SI - Get Origin"); LOG(SERIALINTERFACE, "PAD - Get Origin");
u8* pCalibration = reinterpret_cast<u8*>(&m_origin); u8* pCalibration = reinterpret_cast<u8*>(&m_origin);
for (int i = 0; i < (int)sizeof(SOrigin); i++) for (int i = 0; i < (int)sizeof(SOrigin); i++)
{ {
@ -123,7 +80,7 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
// Recalibrate (FiRES: i am not 100 percent sure about this) // Recalibrate (FiRES: i am not 100 percent sure about this)
case CMD_RECALIBRATE: case CMD_RECALIBRATE:
{ {
LOG(SERIALINTERFACE, "SI - Recalibrate"); LOG(SERIALINTERFACE, "PAD - Recalibrate");
u8* pCalibration = reinterpret_cast<u8*>(&m_origin); u8* pCalibration = reinterpret_cast<u8*>(&m_origin);
for (int i = 0; i < (int)sizeof(SOrigin); i++) for (int i = 0; i < (int)sizeof(SOrigin); i++)
{ {
@ -212,27 +169,3 @@ CSIDevice_GCController::SendCommand(u32 _Cmd)
break; break;
} }
} }
// =====================================================================================================
// --- dummy device ---
// =====================================================================================================
CSIDevice_Dummy::CSIDevice_Dummy(int _iDeviceNumber) :
ISIDevice(_iDeviceNumber)
{}
int CSIDevice_Dummy::RunBuffer(u8* _pBuffer, int _iLength)
{
reinterpret_cast<u32*>(_pBuffer)[0] = 0x00000000; // no device
return 4;
}
bool CSIDevice_Dummy::GetData(u32& _Hi, u32& _Low)
{
return false;
}
void CSIDevice_Dummy::SendCommand(u32 _Cmd)
{
}

View File

@ -15,34 +15,8 @@
// 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/
#ifndef _SERIALINTERFACE_DEVICES_H #ifndef _SI_DEVICEGCCONTROLLER_H
#define _SERIALINTERFACE_DEVICES_H #define _SI_DEVICEGCCONTROLLER_H
#include "Common.h"
class PointerWrap;
class ISIDevice
{
protected:
int m_iDeviceNumber;
public:
// constructor
ISIDevice(int _iDeviceNumber) :
m_iDeviceNumber(_iDeviceNumber)
{ }
virtual ~ISIDevice() { }
// run the SI Buffer
virtual int RunBuffer(u8* _pBuffer, int _iLength);
// return true on new data
virtual bool GetData(u32& _Hi, u32& _Low) = 0;
// send a command directly (no detour per buffer)
virtual void SendCommand(u32 _Cmd) = 0;
};
// ===================================================================================================== // =====================================================================================================
// standard gamecube controller // standard gamecube controller
@ -113,27 +87,4 @@ public:
// send a command directly // send a command directly
virtual void SendCommand(u32 _Cmd); virtual void SendCommand(u32 _Cmd);
}; };
// =====================================================================================================
// dummy - no device attached
// =====================================================================================================
class CSIDevice_Dummy : public ISIDevice
{
public:
// constructor
CSIDevice_Dummy(int _iDeviceNumber);
// run the SI Buffer
virtual int RunBuffer(u8* _pBuffer, int _iLength);
// return true on new data
virtual bool GetData(u32& _Hi, u32& _Low);
// send a command directly
virtual void SendCommand(u32 _Cmd);
};
#endif #endif

View File

@ -23,7 +23,7 @@
#include "../HW/DSP.h" #include "../HW/DSP.h"
#include "../HW/AudioInterface.h" #include "../HW/AudioInterface.h"
#include "../HW/VideoInterface.h" #include "../HW/VideoInterface.h"
#include "../HW/SerialInterface.h" #include "../HW/SI.h"
#include "../HW/CommandProcessor.h" // for DC watchdog hack #include "../HW/CommandProcessor.h" // for DC watchdog hack
#include "../HW/EXI_DeviceIPL.h" #include "../HW/EXI_DeviceIPL.h"
#include "../PowerPC/PowerPC.h" #include "../PowerPC/PowerPC.h"

View File

@ -46,7 +46,10 @@ files = ["Console.cpp",
"HW/PeripheralInterface.cpp", "HW/PeripheralInterface.cpp",
"HW/PixelEngine.cpp", "HW/PixelEngine.cpp",
"HW/SerialInterface.cpp", "HW/SerialInterface.cpp",
"HW/SerialInterface_Devices.cpp", "HW/SI.cpp",
"HW/SI_Device.cpp",
"HW/SI_DeviceGBA.cpp",
"HW/SI_DeviceGCController.cpp",
"HW/StreamADPCM.cpp", "HW/StreamADPCM.cpp",
"HW/SystemTimers.cpp", "HW/SystemTimers.cpp",
"HW/VideoInterface.cpp", "HW/VideoInterface.cpp",

View File

@ -134,9 +134,10 @@ void CFrame::CreateMenu()
wxMenu* pOptionsMenu = new wxMenu; wxMenu* pOptionsMenu = new wxMenu;
m_pPluginOptions = pOptionsMenu->Append(IDM_CONFIG_MAIN, _T("Co&nfigure...")); m_pPluginOptions = pOptionsMenu->Append(IDM_CONFIG_MAIN, _T("Co&nfigure..."));
pOptionsMenu->AppendSeparator(); pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_CONFIG_GFX_PLUGIN, _T("&Toolbar_PluginGFX settings")); pOptionsMenu->Append(IDM_CONFIG_GFX_PLUGIN, _T("&GFX settings"));
pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&Toolbar_PluginDSP settings")); pOptionsMenu->Append(IDM_CONFIG_DSP_PLUGIN, _T("&DSP settings"));
pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _T("&Toolbar_PluginPAD settings")); pOptionsMenu->Append(IDM_CONFIG_PAD_PLUGIN, _T("&PAD settings"));
pOptionsMenu->Append(IDM_CONFIG_WIIMOTE_PLUGIN, _T("&Wiimote settings"));
#ifdef _WIN32 #ifdef _WIN32
pOptionsMenu->AppendSeparator(); pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter")); pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter"));