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"
>
<File
RelativePath=".\Src\Hw\SerialInterface.cpp"
RelativePath=".\Src\HW\SI.cpp"
>
</File>
<File
RelativePath=".\Src\Hw\SerialInterface.h"
RelativePath=".\Src\HW\SI.h"
>
</File>
<File
RelativePath=".\Src\Hw\SerialInterface_Devices.cpp"
RelativePath=".\Src\HW\SI_Device.cpp"
>
</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>
</Filter>

View file

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

View file

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

View file

@ -1,39 +1,36 @@
// 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 _SERIALINTERFACE_H
#define _SERIALINTERFACE_H
#include "Common.h"
class PointerWrap;
namespace SerialInterface
{
void Init();
void Shutdown();
void DoState(PointerWrap &p);
void UpdateDevices();
void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
}; // end of namespace SerialInterface
#endif
// 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 _SERIALINTERFACE_H
#define _SERIALINTERFACE_H
#include "Common.h"
class PointerWrap;
namespace SerialInterface
{
void Init();
void Shutdown();
void DoState(PointerWrap &p);
void UpdateDevices();
void HWCALL Read32(u32& _uReturnValue, const u32 _iAddress);
void HWCALL Write32(const u32 _iValue, const u32 _iAddress);
}; // end of namespace SerialInterface
#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.
// 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 <stdio.h>
#include <stdlib.h>
#include "SerialInterface_Devices.h"
#include "EXI_Device.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 ---
// =====================================================================================================
CSIDevice_GCController::CSIDevice_GCController(int _iDeviceNumber) :
ISIDevice(_iDeviceNumber)
{
memset(&m_origin, 0, sizeof(SOrigin));
m_origin.uCommand = 0x41;
m_origin.uOriginStickX = 0x80;
m_origin.uOriginStickY = 0x80;
m_origin.uSubStickStickX = 0x80;
m_origin.uSubStickStickY = 0x80;
m_origin.uTrigger_L = 0x1F;
m_origin.uTrigger_R = 0x1F;
}
int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
{
// for debug logging only
ISIDevice::RunBuffer(_pBuffer, _iLength);
int iPosition = 0;
while(iPosition < _iLength)
{
// read the command
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
iPosition++;
// handle it
switch(command)
{
case CMD_RESET:
{
*(u32*)&_pBuffer[0] = SI_GC_CONTROLLER; // | SI_GC_NOMOTOR;
iPosition = _iLength; // break the while loop
}
break;
case CMD_ORIGIN:
{
LOG(SERIALINTERFACE, "SI - Get Origin");
u8* pCalibration = reinterpret_cast<u8*>(&m_origin);
for (int i = 0; i < (int)sizeof(SOrigin); i++)
{
_pBuffer[i ^ 3] = *pCalibration++;
}
}
iPosition = _iLength;
break;
// Recalibrate (FiRES: i am not 100 percent sure about this)
case CMD_RECALIBRATE:
{
LOG(SERIALINTERFACE, "SI - Recalibrate");
u8* pCalibration = reinterpret_cast<u8*>(&m_origin);
for (int i = 0; i < (int)sizeof(SOrigin); i++)
{
_pBuffer[i ^ 3] = *pCalibration++;
}
}
iPosition = _iLength;
break;
// WII Something
case 0xCE:
LOG(SERIALINTERFACE, "Unknown Wii SI Command");
break;
// DEFAULT
default:
{
LOG(SERIALINTERFACE, "unknown SI command (0x%x)", command);
PanicAlert("SI: Unknown command");
iPosition = _iLength;
}
break;
}
}
return iPosition;
}
// __________________________________________________________________________________________________
// GetData
//
// return true on new data (max 7 Bytes and 6 bits ;)
//
bool
CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
{
SPADStatus PadStatus;
memset(&PadStatus, 0 ,sizeof(PadStatus));
PluginPAD::PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
_Hi = (u32)((u8)PadStatus.stickY);
_Hi |= (u32)((u8)PadStatus.stickX << 8);
_Hi |= (u32)((u16)PadStatus.button << 16);
_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)
{
}
// 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 <stdio.h>
#include <stdlib.h>
#include "SI_Device.h"
#include "SI_DeviceGCController.h"
#include "../Plugins/Plugin_PAD.h"
#include "EXI_Device.h"
#include "EXI_DeviceMic.h"
// =====================================================================================================
// --- standard gamecube controller ---
// =====================================================================================================
CSIDevice_GCController::CSIDevice_GCController(int _iDeviceNumber) :
ISIDevice(_iDeviceNumber)
{
memset(&m_origin, 0, sizeof(SOrigin));
m_origin.uCommand = 0x41;
m_origin.uOriginStickX = 0x80;
m_origin.uOriginStickY = 0x80;
m_origin.uSubStickStickX = 0x80;
m_origin.uSubStickStickY = 0x80;
m_origin.uTrigger_L = 0x1F;
m_origin.uTrigger_R = 0x1F;
}
int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
{
// for debug logging only
ISIDevice::RunBuffer(_pBuffer, _iLength);
int iPosition = 0;
while(iPosition < _iLength)
{
// read the command
EBufferCommands command = static_cast<EBufferCommands>(_pBuffer[iPosition ^ 3]);
iPosition++;
// handle it
switch(command)
{
case CMD_RESET:
{
*(u32*)&_pBuffer[0] = SI_GC_CONTROLLER; // | SI_GC_NOMOTOR;
iPosition = _iLength; // break the while loop
}
break;
case CMD_ORIGIN:
{
LOG(SERIALINTERFACE, "PAD - Get Origin");
u8* pCalibration = reinterpret_cast<u8*>(&m_origin);
for (int i = 0; i < (int)sizeof(SOrigin); i++)
{
_pBuffer[i ^ 3] = *pCalibration++;
}
}
iPosition = _iLength;
break;
// Recalibrate (FiRES: i am not 100 percent sure about this)
case CMD_RECALIBRATE:
{
LOG(SERIALINTERFACE, "PAD - Recalibrate");
u8* pCalibration = reinterpret_cast<u8*>(&m_origin);
for (int i = 0; i < (int)sizeof(SOrigin); i++)
{
_pBuffer[i ^ 3] = *pCalibration++;
}
}
iPosition = _iLength;
break;
// WII Something
case 0xCE:
LOG(SERIALINTERFACE, "Unknown Wii SI Command");
break;
// DEFAULT
default:
{
LOG(SERIALINTERFACE, "unknown SI command (0x%x)", command);
PanicAlert("SI: Unknown command");
iPosition = _iLength;
}
break;
}
}
return iPosition;
}
// __________________________________________________________________________________________________
// GetData
//
// return true on new data (max 7 Bytes and 6 bits ;)
//
bool
CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
{
SPADStatus PadStatus;
memset(&PadStatus, 0 ,sizeof(PadStatus));
PluginPAD::PAD_GetStatus(ISIDevice::m_iDeviceNumber, &PadStatus);
_Hi = (u32)((u8)PadStatus.stickY);
_Hi |= (u32)((u8)PadStatus.stickX << 8);
_Hi |= (u32)((u16)PadStatus.button << 16);
_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;
}
}

View file

@ -1,139 +1,90 @@
// 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 _SERIALINTERFACE_DEVICES_H
#define _SERIALINTERFACE_DEVICES_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
// =====================================================================================================
class CSIDevice_GCController : public ISIDevice
{
private:
// commands
enum EBufferCommands
{
CMD_INVALID = 0xFFFFFFFF,
CMD_RESET = 0x00,
CMD_ORIGIN = 0x41,
CMD_RECALIBRATE = 0x42,
};
struct SOrigin
{
u8 uCommand;
u8 unk_1;
u8 uOriginStickX;
u8 uOriginStickY;
u8 uSubStickStickX; // ???
u8 uSubStickStickY; // ???
u8 uTrigger_L; // ???
u8 uTrigger_R; // ???
u8 unk_4;
u8 unk_5;
u8 unk_6;
u8 unk_7;
};
enum EDirectCommands
{
CMD_RUMBLE = 0x40
};
union UCommand
{
u32 Hex;
struct
{
unsigned Parameter1 : 8;
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
// 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 _SI_DEVICEGCCONTROLLER_H
#define _SI_DEVICEGCCONTROLLER_H
// =====================================================================================================
// standard gamecube controller
// =====================================================================================================
class CSIDevice_GCController : public ISIDevice
{
private:
// commands
enum EBufferCommands
{
CMD_INVALID = 0xFFFFFFFF,
CMD_RESET = 0x00,
CMD_ORIGIN = 0x41,
CMD_RECALIBRATE = 0x42,
};
struct SOrigin
{
u8 uCommand;
u8 unk_1;
u8 uOriginStickX;
u8 uOriginStickY;
u8 uSubStickStickX; // ???
u8 uSubStickStickY; // ???
u8 uTrigger_L; // ???
u8 uTrigger_R; // ???
u8 unk_4;
u8 unk_5;
u8 unk_6;
u8 unk_7;
};
enum EDirectCommands
{
CMD_RUMBLE = 0x40
};
union UCommand
{
u32 Hex;
struct
{
unsigned Parameter1 : 8;
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);
};
#endif

View file

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

View file

@ -46,7 +46,10 @@ files = ["Console.cpp",
"HW/PeripheralInterface.cpp",
"HW/PixelEngine.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/SystemTimers.cpp",
"HW/VideoInterface.cpp",

View file

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