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

@ -1,39 +1,36 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// 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
#include "Common.h"
#include "Common.h" class PointerWrap;
class PointerWrap;
namespace SerialInterface
namespace SerialInterface {
{
void Init();
void Init(); void Shutdown();
void Shutdown(); void DoState(PointerWrap &p);
void DoState(PointerWrap &p);
void UpdateDevices();
void UpdateDevices();
void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
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

@ -1,238 +1,171 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// 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 <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "SerialInterface_Devices.h" #include "SI_Device.h"
#include "SI_DeviceGCController.h"
#include "EXI_Device.h" #include "../Plugins/Plugin_PAD.h"
#include "EXI_DeviceMic.h"
#include "EXI_Device.h"
#include "../Plugins/Plugin_PAD.h" #include "EXI_DeviceMic.h"
#include "../PowerPC/PowerPC.h" // =====================================================================================================
#include "CPU.h" // --- standard gamecube controller ---
// =====================================================================================================
#define SI_TYPE_GC 0x08000000u
CSIDevice_GCController::CSIDevice_GCController(int _iDeviceNumber) :
#define SI_GC_STANDARD 0x01000000u // dolphin standard controller ISIDevice(_iDeviceNumber)
#define SI_GC_NOMOTOR 0x20000000u // no rumble motor {
memset(&m_origin, 0, sizeof(SOrigin));
#define SI_GC_KEYBOARD (SI_TYPE_GC | 0x00200000)
#define SI_GC_CONTROLLER (SI_TYPE_GC | SI_GC_STANDARD) m_origin.uCommand = 0x41;
m_origin.uOriginStickX = 0x80;
#define SI_MAX_COMCSR_INLNGTH 128 m_origin.uOriginStickY = 0x80;
#define SI_MAX_COMCSR_OUTLNGTH 128 m_origin.uSubStickStickX = 0x80;
m_origin.uSubStickStickY = 0x80;
// ===================================================================================================== m_origin.uTrigger_L = 0x1F;
// --- base class --- m_origin.uTrigger_R = 0x1F;
// ===================================================================================================== }
int ISIDevice::RunBuffer(u8* _pBuffer, int _iLength) int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
{ {
#ifdef _DEBUG // for debug logging only
LOG(SERIALINTERFACE, "Send Data Device(%i) - Length(%i) ", ISIDevice::m_iDeviceNumber,_iLength); ISIDevice::RunBuffer(_pBuffer, _iLength);
char szTemp[256] = ""; int iPosition = 0;
int num = 0; while(iPosition < _iLength)
while(num < _iLength) {
{ // read the command
char szTemp2[128] = ""; EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
sprintf(szTemp2, "0x%02x ", _pBuffer[num^3]); iPosition++;
strcat(szTemp, szTemp2);
num++; // handle it
switch(command)
if ((num % 8) == 0) {
{ case CMD_RESET:
LOG(SERIALINTERFACE, szTemp); {
szTemp[0] = '\0'; *(u32*)&_pBuffer[0] = SI_GC_CONTROLLER; // | SI_GC_NOMOTOR;
} iPosition = _iLength; // break the while loop
} }
LOG(SERIALINTERFACE, szTemp); break;
#endif
return 0; case CMD_ORIGIN:
}; {
LOG(SERIALINTERFACE, "PAD - Get Origin");
// ===================================================================================================== u8* pCalibration = reinterpret_cast<u8*>(&m_origin);
// --- standard gamecube controller --- for (int i = 0; i < (int)sizeof(SOrigin); i++)
// ===================================================================================================== {
_pBuffer[i ^ 3] = *pCalibration++;
CSIDevice_GCController::CSIDevice_GCController(int _iDeviceNumber) : }
ISIDevice(_iDeviceNumber) }
{ iPosition = _iLength;
memset(&m_origin, 0, sizeof(SOrigin)); break;
m_origin.uCommand = 0x41; // Recalibrate (FiRES: i am not 100 percent sure about this)
m_origin.uOriginStickX = 0x80; case CMD_RECALIBRATE:
m_origin.uOriginStickY = 0x80; {
m_origin.uSubStickStickX = 0x80; LOG(SERIALINTERFACE, "PAD - Recalibrate");
m_origin.uSubStickStickY = 0x80; u8* pCalibration = reinterpret_cast<u8*>(&m_origin);
m_origin.uTrigger_L = 0x1F; for (int i = 0; i < (int)sizeof(SOrigin); i++)
m_origin.uTrigger_R = 0x1F; {
} _pBuffer[i ^ 3] = *pCalibration++;
}
int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength) }
{ iPosition = _iLength;
// for debug logging only break;
ISIDevice::RunBuffer(_pBuffer, _iLength);
// WII Something
int iPosition = 0; case 0xCE:
while(iPosition < _iLength) LOG(SERIALINTERFACE, "Unknown Wii SI Command");
{ break;
// read the command
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]); // DEFAULT
iPosition++; default:
{
// handle it LOG(SERIALINTERFACE, "unknown SI command (0x%x)", command);
switch(command) PanicAlert("SI: Unknown command");
{ iPosition = _iLength;
case CMD_RESET: }
{ break;
*(u32*)&_pBuffer[0] = SI_GC_CONTROLLER; // | SI_GC_NOMOTOR; }
iPosition = _iLength; // break the while loop }
}
break; return iPosition;
}
case CMD_ORIGIN:
{ // __________________________________________________________________________________________________
LOG(SERIALINTERFACE, "SI - Get Origin"); // GetData
u8* pCalibration = reinterpret_cast<u8*>(&m_origin); //
for (int i = 0; i < (int)sizeof(SOrigin); i++) // return true on new data (max 7 Bytes and 6 bits ;)
{ //
_pBuffer[i ^ 3] = *pCalibration++; bool
} CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
} {
iPosition = _iLength; SPADStatus PadStatus;
break; memset(&PadStatus, 0 ,sizeof(PadStatus));
PluginPAD::PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
// Recalibrate (FiRES: i am not 100 percent sure about this)
case CMD_RECALIBRATE: _Hi = (u32)((u8)PadStatus.stickY);
{ _Hi |= (u32)((u8)PadStatus.stickX << 8);
LOG(SERIALINTERFACE, "SI - Recalibrate"); _Hi |= (u32)((u16)PadStatus.button << 16);
u8* pCalibration = reinterpret_cast<u8*>(&m_origin);
for (int i = 0; i < (int)sizeof(SOrigin); i++) _Low = (u8)PadStatus.triggerRight;
{ _Low |= (u32)((u8)PadStatus.triggerLeft << 8);
_pBuffer[i ^ 3] = *pCalibration++; _Low |= (u32)((u8)PadStatus.substickY << 16);
} _Low |= (u32)((u8)PadStatus.substickX << 24);
} SetMic(PadStatus.MicButton);
iPosition = _iLength;
break; // F|RES:
// i dunno if i should force it here
// WII Something // means that the pad must be "combined" with the origin to math the "final" OSPad-Struct
case 0xCE: _Hi |= 0x00800000;
LOG(SERIALINTERFACE, "Unknown Wii SI Command");
break; return true;
}
// DEFAULT
default: // __________________________________________________________________________________________________
{ // SendCommand
LOG(SERIALINTERFACE, "unknown SI command (0x%x)", command); //
PanicAlert("SI: Unknown command"); void
iPosition = _iLength; CSIDevice_GCController::SendCommand(u32 _Cmd)
} {
break; UCommand command(_Cmd);
} switch(command.Command)
} {
// Costis sent it in some demos :)
return iPosition; case 0x00:
} break;
// __________________________________________________________________________________________________ case CMD_RUMBLE:
// GetData {
// unsigned int uType = command.Parameter1; // 0 = stop, 1 = rumble, 2 = stop hard
// return true on new data (max 7 Bytes and 6 bits ;) unsigned int uStrength = command.Parameter2;
// if (PluginPAD::PAD_Rumble)
bool PluginPAD::PAD_Rumble(ISIDevice::m_iDeviceNumber, uType, uStrength);
CSIDevice_GCController::GetData(u32& _Hi, u32& _Low) }
{ break;
SPADStatus PadStatus;
memset(&PadStatus, 0 ,sizeof(PadStatus)); default:
PluginPAD::PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus); {
LOG(SERIALINTERFACE, "unknown direct command (0x%x)", _Cmd);
_Hi = (u32)((u8)PadStatus.stickY); PanicAlert("SI: Unknown direct command");
_Hi |= (u32)((u8)PadStatus.stickX << 8); }
_Hi |= (u32)((u16)PadStatus.button << 16); break;
}
_Low = (u8)PadStatus.triggerRight; }
_Low |= (u32)((u8)PadStatus.triggerLeft << 8);
_Low |= (u32)((u8)PadStatus.substickY << 16);
_Low |= (u32)((u8)PadStatus.substickX << 24);
SetMic(PadStatus.MicButton);
// F|RES:
// i dunno if i should force it here
// means that the pad must be "combined" with the origin to math the "final" OSPad-Struct
_Hi |= 0x00800000;
return true;
}
// __________________________________________________________________________________________________
// SendCommand
//
void
CSIDevice_GCController::SendCommand(u32 _Cmd)
{
UCommand command(_Cmd);
switch(command.Command)
{
// Costis sent it in some demos :)
case 0x00:
break;
case CMD_RUMBLE:
{
unsigned int uType = command.Parameter1; // 0 = stop, 1 = rumble, 2 = stop hard
unsigned int uStrength = command.Parameter2;
if (PluginPAD::PAD_Rumble)
PluginPAD::PAD_Rumble(ISIDevice::m_iDeviceNumber, uType, uStrength);
}
break;
default:
{
LOG(SERIALINTERFACE, "unknown direct command (0x%x)", _Cmd);
PanicAlert("SI: Unknown direct command");
}
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

@ -1,139 +1,90 @@
// Copyright (C) 2003-2008 Dolphin Project. // Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0. // the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details. // GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program. // A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/ // If not, see http://www.gnu.org/licenses/
// 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; // standard gamecube controller
// =====================================================================================================
class ISIDevice
{ class CSIDevice_GCController : public ISIDevice
protected: {
int m_iDeviceNumber; private:
public: // commands
enum EBufferCommands
// constructor {
ISIDevice(int _iDeviceNumber) : CMD_INVALID = 0xFFFFFFFF,
m_iDeviceNumber(_iDeviceNumber) CMD_RESET = 0x00,
{ } CMD_ORIGIN = 0x41,
virtual ~ISIDevice() { } CMD_RECALIBRATE = 0x42,
};
// run the SI Buffer
virtual int RunBuffer(u8* _pBuffer, int _iLength); struct SOrigin
{
// return true on new data u8 uCommand;
virtual bool GetData(u32& _Hi, u32& _Low) = 0; u8 unk_1;
u8 uOriginStickX;
// send a command directly (no detour per buffer) u8 uOriginStickY;
virtual void SendCommand(u32 _Cmd) = 0; u8 uSubStickStickX; // ???
}; u8 uSubStickStickY; // ???
u8 uTrigger_L; // ???
// ===================================================================================================== u8 uTrigger_R; // ???
// standard gamecube controller u8 unk_4;
// ===================================================================================================== u8 unk_5;
u8 unk_6;
class CSIDevice_GCController : public ISIDevice u8 unk_7;
{ };
private:
enum EDirectCommands
// commands {
enum EBufferCommands CMD_RUMBLE = 0x40
{ };
CMD_INVALID = 0xFFFFFFFF,
CMD_RESET = 0x00, union UCommand
CMD_ORIGIN = 0x41, {
CMD_RECALIBRATE = 0x42, u32 Hex;
}; struct
{
struct SOrigin unsigned Parameter1 : 8;
{ unsigned Parameter2 : 8;
u8 uCommand; unsigned Command : 8;
u8 unk_1; unsigned : 8;
u8 uOriginStickX; };
u8 uOriginStickY; UCommand() {Hex = 0;}
u8 uSubStickStickX; // ??? UCommand(u32 _iValue) {Hex = _iValue;}
u8 uSubStickStickY; // ??? };
u8 uTrigger_L; // ???
u8 uTrigger_R; // ??? SOrigin m_origin;
u8 unk_4; int DeviceNum;
u8 unk_5;
u8 unk_6; public:
u8 unk_7;
}; // constructor
CSIDevice_GCController(int _iDeviceNumber);
enum EDirectCommands
{ // run the SI Buffer
CMD_RUMBLE = 0x40 virtual int RunBuffer(u8* _pBuffer, int _iLength);
};
// return true on new data
union UCommand virtual bool GetData(u32& _Hi, u32& _Low);
{
u32 Hex; // send a command directly
struct virtual void SendCommand(u32 _Cmd);
{ };
unsigned Parameter1 : 8; #endif
unsigned Parameter2 : 8;
unsigned Command : 8;
unsigned : 8;
};
UCommand() {Hex = 0;}
UCommand(u32 _iValue) {Hex = _iValue;}
};
SOrigin m_origin;
int DeviceNum;
public:
// constructor
CSIDevice_GCController(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);
};
// =====================================================================================================
// 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

@ -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"));