set svn:eol-style=native for **.h

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1438 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
bushing
2008-12-08 04:46:09 +00:00
parent e6fe5ec42f
commit 30c883bcfc
334 changed files with 30407 additions and 30407 deletions

View File

@ -1,41 +1,41 @@
// 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 _CONFIG_H
#define _CONFIG_H
#define CONF_LOG 1
#define CONF_PRIMLOG 2
#define CONF_SAVETEXTURES 4
#define CONF_SAVETARGETS 8
#define CONF_SAVESHADERS 16
struct Config
{
Config();
void Load();
void Save();
// General
bool bSidewaysDPad;
bool bWideScreen;
bool bNunchuckConnected, bClassicControllerConnected;
};
extern Config g_Config;
#endif // _CONFIG_H
// 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 _CONFIG_H
#define _CONFIG_H
#define CONF_LOG 1
#define CONF_PRIMLOG 2
#define CONF_SAVETEXTURES 4
#define CONF_SAVETARGETS 8
#define CONF_SAVESHADERS 16
struct Config
{
Config();
void Load();
void Save();
// General
bool bSidewaysDPad;
bool bWideScreen;
bool bNunchuckConnected, bClassicControllerConnected;
};
extern Config g_Config;
#endif // _CONFIG_H

View File

@ -1,86 +1,86 @@
// 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 __CONFIGDIALOG_h__
#define __CONFIGDIALOG_h__
#include <wx/wx.h>
#include <wx/dialog.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/filepicker.h>
#include <wx/gbsizer.h>
#undef ConfigDialog_STYLE
#define ConfigDialog_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class ConfigDialog : public wxDialog
{
public:
ConfigDialog(wxWindow *parent, wxWindowID id = 1,
const wxString &title = wxT("Wii Remote Plugin Configuration"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = ConfigDialog_STYLE);
virtual ~ConfigDialog();
void CloseClick(wxCommandEvent& event);
private:
DECLARE_EVENT_TABLE();
wxBoxSizer* sGeneral;
wxStaticBoxSizer* sbBasic;
wxGridBagSizer* sBasic;
wxButton *m_About;
wxButton *m_Close;
wxNotebook *m_Notebook;
wxPanel *m_PageEmu, *m_PageReal;
wxCheckBox *m_SidewaysDPad; // general settings
wxCheckBox *m_WideScreen;
wxCheckBox *m_NunchuckConnected, *m_ClassicControllerConnected;
enum
{
ID_CLOSE = 1000,
ID_ABOUTOGL,
ID_NOTEBOOK,
ID_PAGEEMU,
ID_PAGEREAL,
ID_SIDEWAYSDPAD,
ID_WIDESCREEN,
ID_NUNCHUCKCONNECTED, ID_CLASSICCONTROLLERCONNECTED
};
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
void AboutClick(wxCommandEvent& event);
void DoExtensionConnectedDisconnected();
void GeneralSettingsChanged(wxCommandEvent& event);
};
#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 __CONFIGDIALOG_h__
#define __CONFIGDIALOG_h__
#include <wx/wx.h>
#include <wx/dialog.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
#include <wx/notebook.h>
#include <wx/panel.h>
#include <wx/filepicker.h>
#include <wx/gbsizer.h>
#undef ConfigDialog_STYLE
#define ConfigDialog_STYLE wxCAPTION | wxSYSTEM_MENU | wxDIALOG_NO_PARENT | wxCLOSE_BOX
class ConfigDialog : public wxDialog
{
public:
ConfigDialog(wxWindow *parent, wxWindowID id = 1,
const wxString &title = wxT("Wii Remote Plugin Configuration"),
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = ConfigDialog_STYLE);
virtual ~ConfigDialog();
void CloseClick(wxCommandEvent& event);
private:
DECLARE_EVENT_TABLE();
wxBoxSizer* sGeneral;
wxStaticBoxSizer* sbBasic;
wxGridBagSizer* sBasic;
wxButton *m_About;
wxButton *m_Close;
wxNotebook *m_Notebook;
wxPanel *m_PageEmu, *m_PageReal;
wxCheckBox *m_SidewaysDPad; // general settings
wxCheckBox *m_WideScreen;
wxCheckBox *m_NunchuckConnected, *m_ClassicControllerConnected;
enum
{
ID_CLOSE = 1000,
ID_ABOUTOGL,
ID_NOTEBOOK,
ID_PAGEEMU,
ID_PAGEREAL,
ID_SIDEWAYSDPAD,
ID_WIDESCREEN,
ID_NUNCHUCKCONNECTED, ID_CLASSICCONTROLLERCONNECTED
};
void OnClose(wxCloseEvent& event);
void CreateGUIControls();
void AboutClick(wxCommandEvent& event);
void DoExtensionConnectedDisconnected();
void GeneralSettingsChanged(wxCommandEvent& event);
};
#endif

View File

@ -1,26 +1,26 @@
// 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/
void startConsoleWin(int width, int height, char* fname);
int wprintf(const char *fmt, ...);
int aprintf(int a, const char *fmt, ...);
void ClearScreen();
#ifdef _WIN32
HWND GetConsoleHwnd(void);
#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/
void startConsoleWin(int width, int height, char* fname);
int wprintf(const char *fmt, ...);
int aprintf(int a, const char *fmt, ...);
void ClearScreen();
#ifdef _WIN32
HWND GetConsoleHwnd(void);
#endif

View File

@ -1,64 +1,64 @@
// 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 _EMU_DEFINITIONS_
#define _EMU_DEFINITIONS_
#include "pluginspecs_wiimote.h"
#include <vector>
#include <string>
#include "Common.h"
#include "wiimote_hid.h"
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
extern SWiimoteInitialize g_WiimoteInitialize;
//extern void __Log(int log, const char *format, ...);
//extern void __Log(int log, int v, const char *format, ...);
namespace WiiMoteEmu
{
//******************************************************************************
// Definitions and variable declarations
//******************************************************************************
/* Libogc bounding box, in smoothed IR coordinates: 232,284 792,704, however, it was
possible for me to get a better calibration with these values, if they are not
universal for all PCs we have to make a setting for it. */
#define LEFT 266
#define TOP 211
#define RIGHT 752
#define BOTTOM 728
#define SENSOR_BAR_RADIUS 200
#define wLEFT 332
#define wTOP 348
#define wRIGHT 693
#define wBOTTOM 625
#define wSENSOR_BAR_RADIUS 200
// vars
#define WIIMOTE_EEPROM_SIZE (16*1024)
#define WIIMOTE_REG_SPEAKER_SIZE 10
#define WIIMOTE_REG_EXT_SIZE 0x100
#define WIIMOTE_REG_IR_SIZE 0x34
} // namespace
// 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 _EMU_DEFINITIONS_
#define _EMU_DEFINITIONS_
#include "pluginspecs_wiimote.h"
#include <vector>
#include <string>
#include "Common.h"
#include "wiimote_hid.h"
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
extern SWiimoteInitialize g_WiimoteInitialize;
//extern void __Log(int log, const char *format, ...);
//extern void __Log(int log, int v, const char *format, ...);
namespace WiiMoteEmu
{
//******************************************************************************
// Definitions and variable declarations
//******************************************************************************
/* Libogc bounding box, in smoothed IR coordinates: 232,284 792,704, however, it was
possible for me to get a better calibration with these values, if they are not
universal for all PCs we have to make a setting for it. */
#define LEFT 266
#define TOP 211
#define RIGHT 752
#define BOTTOM 728
#define SENSOR_BAR_RADIUS 200
#define wLEFT 332
#define wTOP 348
#define wRIGHT 693
#define wBOTTOM 625
#define wSENSOR_BAR_RADIUS 200
// vars
#define WIIMOTE_EEPROM_SIZE (16*1024)
#define WIIMOTE_REG_SPEAKER_SIZE 10
#define WIIMOTE_REG_EXT_SIZE 0x100
#define WIIMOTE_REG_IR_SIZE 0x34
} // namespace
#endif //_EMU_DEFINITIONS_

View File

@ -1,38 +1,38 @@
// 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 WIIMOTE_EMU_H
#define WIIMOTE_EMU_H
#include "wiimote_hid.h"
#include <string>
namespace WiiMoteEmu
{
void Initialize();
void DoState(void* ptr, int mode);
void Shutdown(void);
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size);
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ;
void Update();
std::string ArrayToString(const u8 *data, u32 size, u32 offset = 0, int line_len = 20);
};
#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 WIIMOTE_EMU_H
#define WIIMOTE_EMU_H
#include "wiimote_hid.h"
#include <string>
namespace WiiMoteEmu
{
void Initialize();
void DoState(void* ptr, int mode);
void Shutdown(void);
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size);
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ;
void Update();
std::string ArrayToString(const u8 *data, u32 size, u32 offset = 0, int line_len = 20);
};
#endif

View File

@ -1,159 +1,159 @@
// 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 _EMU_DECLARATIONS_
#define _EMU_DECLARATIONS_
#include "pluginspecs_wiimote.h"
#include <vector>
#include <string>
#include "Common.h"
#include "wiimote_hid.h"
#include "EmuDefinitions.h"
#include "Encryption.h"
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
extern SWiimoteInitialize g_WiimoteInitialize;
//extern void __Log(int log, const char *format, ...);
//extern void __Log(int log, int v, const char *format, ...);
namespace WiiMoteEmu
{
//******************************************************************************
// Definitions and variable declarations
//******************************************************************************
extern u8 g_Leds;
extern u8 g_IR;
extern u8 g_Eeprom[WIIMOTE_EEPROM_SIZE];
extern u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE];
extern u8 g_RegExt[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegIr[WIIMOTE_REG_IR_SIZE];
extern u8 g_ReportingMode;
extern u16 g_ReportingChannel;
extern wiimote_key g_ExtKey; // extension encryption key
static const u8 EepromData_0[] = {
0xA1, 0xAA, 0x8B, 0x99, 0xAE, 0x9E, 0x78, 0x30,
0xA7, 0x74, 0xD3, 0xA1, 0xAA, 0x8B, 0x99, 0xAE,
0x9E, 0x78, 0x30, 0xA7, 0x74, 0xD3, 0x82, 0x82,
0x82, 0x15, 0x9C, 0x9C, 0x9E, 0x38, 0x40, 0x3E,
0x82, 0x82, 0x82, 0x15, 0x9C, 0x9C, 0x9E, 0x38,
0x40, 0x3E
};
static const u8 EepromData_16D0[] = {
0x00, 0x00, 0x00, 0xFF, 0x11, 0xEE, 0x00, 0x00,
0x33, 0xCC, 0x44, 0xBB, 0x00, 0x00, 0x66, 0x99,
0x77, 0x88, 0x00, 0x00, 0x2B, 0x01, 0xE8, 0x13
};
/* Default calibration for the nunchuck. It should be written to 0x20 - 0x3f of the
extension register. 0x80 is the neutral x and y accelerators and 0xb3 is the
neutral z accelerometer that is adjusted for gravity. */
static const u8 nunchuck_calibration[] =
{
0x80,0x80,0x80,0x00, 0xb3,0xb3,0xb3,0x00,
0xe0,0x20,0x80,0xe0, 0x20,0x80,0xee,0x43,
0x80,0x80,0x80,0x00, 0xb3,0xb3,0xb3,0x00,
0xe0,0x20,0x80,0xe0, 0x20,0x80,0xee,0x43
};
/* Classic Controller calibration. 0x80 is the neutral for the analog triggers and
sticks. The left analog range is 0x1c - 0xe4 and the right is 0x28 - 0xd8.
We use this range because it's closest to the GC controller range. */
static const u8 classic_calibration[] =
{
0xe4,0x1c,0x80,0xe4, 0x1c,0x80,0xd8,0x28,
0x80,0xd8,0x28,0x80, 0x20,0x20,0x95,0xea,
0xe4,0x1c,0x80,0xe4, 0x1c,0x80,0xd8,0x28,
0x80,0xd8,0x28,0x80, 0x20,0x20,0x95,0xea
};
/* The Nunchuck id. It should be written to the last bytes of the
extension register */
static const u8 nunchuck_id[] =
{
0x00, 0x00, 0xa4, 0x20, 0x00, 0x00
};
/* The Classic Controller id. It should be written to the last bytes of the
extension register */
static const u8 classic_id[] =
{
0x00, 0x00, 0xa4, 0x20, 0x01, 0x01
};
/* The id for nothing inserted */
static const u8 nothing_id[] =
{
0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e
};
/* The id for a partially inserted extension */
static const u8 partially_id[] =
{
0x00, 0x00, 0x00, 0x00, 0xff, 0xff
};
void HidOutputReport(u16 _channelID, wm_report* sr);
void WmLeds(u16 _channelID, wm_leds* leds);
void WmReadData(u16 _channelID, wm_read_data* rd);
void WmWriteData(u16 _channelID, wm_write_data* wd);
void WmRequestStatus(u16 _channelID, wm_request_status* rs);
void WmRequestStatus_(u16 _channelID, int a);
void WmDataReporting(u16 _channelID, wm_data_reporting* dr);
void SendReadDataReply(u16 _channelID, void* _Base, u16 _Address, u8 _Size);
void SendReportCoreAccel(u16 _channelID);
void SendReportCoreAccelIr12(u16 _channelID);
void SendReportCore(u16 _channelID);
void SendReportCoreAccelExt16(u16 _channelID);
void SendReportCoreAccelIr10Ext(u16 _channelID);
int WriteWmReport(u8* dst, u8 channel);
void WmSendAck(u16 _channelID, u8 _reportID, u32 address);
void FillReportAcc(wm_accel& _acc);
void FillReportInfo(wm_core& _core);
void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1);
void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1);
void FillReportExtension(wm_extension& _ext);
void FillReportClassicExtension(wm_classic_extension& _ext);
u32 convert24bit(const u8* src);
u16 convert16bit(const u8* src);
void GetMousePos(float& x, float& y);
} // namespace
// 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 _EMU_DECLARATIONS_
#define _EMU_DECLARATIONS_
#include "pluginspecs_wiimote.h"
#include <vector>
#include <string>
#include "Common.h"
#include "wiimote_hid.h"
#include "EmuDefinitions.h"
#include "Encryption.h"
#include "Console.h" // for startConsoleWin, wprintf, GetConsoleHwnd
extern SWiimoteInitialize g_WiimoteInitialize;
//extern void __Log(int log, const char *format, ...);
//extern void __Log(int log, int v, const char *format, ...);
namespace WiiMoteEmu
{
//******************************************************************************
// Definitions and variable declarations
//******************************************************************************
extern u8 g_Leds;
extern u8 g_IR;
extern u8 g_Eeprom[WIIMOTE_EEPROM_SIZE];
extern u8 g_RegSpeaker[WIIMOTE_REG_SPEAKER_SIZE];
extern u8 g_RegExt[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegExtTmp[WIIMOTE_REG_EXT_SIZE];
extern u8 g_RegIr[WIIMOTE_REG_IR_SIZE];
extern u8 g_ReportingMode;
extern u16 g_ReportingChannel;
extern wiimote_key g_ExtKey; // extension encryption key
static const u8 EepromData_0[] = {
0xA1, 0xAA, 0x8B, 0x99, 0xAE, 0x9E, 0x78, 0x30,
0xA7, 0x74, 0xD3, 0xA1, 0xAA, 0x8B, 0x99, 0xAE,
0x9E, 0x78, 0x30, 0xA7, 0x74, 0xD3, 0x82, 0x82,
0x82, 0x15, 0x9C, 0x9C, 0x9E, 0x38, 0x40, 0x3E,
0x82, 0x82, 0x82, 0x15, 0x9C, 0x9C, 0x9E, 0x38,
0x40, 0x3E
};
static const u8 EepromData_16D0[] = {
0x00, 0x00, 0x00, 0xFF, 0x11, 0xEE, 0x00, 0x00,
0x33, 0xCC, 0x44, 0xBB, 0x00, 0x00, 0x66, 0x99,
0x77, 0x88, 0x00, 0x00, 0x2B, 0x01, 0xE8, 0x13
};
/* Default calibration for the nunchuck. It should be written to 0x20 - 0x3f of the
extension register. 0x80 is the neutral x and y accelerators and 0xb3 is the
neutral z accelerometer that is adjusted for gravity. */
static const u8 nunchuck_calibration[] =
{
0x80,0x80,0x80,0x00, 0xb3,0xb3,0xb3,0x00,
0xe0,0x20,0x80,0xe0, 0x20,0x80,0xee,0x43,
0x80,0x80,0x80,0x00, 0xb3,0xb3,0xb3,0x00,
0xe0,0x20,0x80,0xe0, 0x20,0x80,0xee,0x43
};
/* Classic Controller calibration. 0x80 is the neutral for the analog triggers and
sticks. The left analog range is 0x1c - 0xe4 and the right is 0x28 - 0xd8.
We use this range because it's closest to the GC controller range. */
static const u8 classic_calibration[] =
{
0xe4,0x1c,0x80,0xe4, 0x1c,0x80,0xd8,0x28,
0x80,0xd8,0x28,0x80, 0x20,0x20,0x95,0xea,
0xe4,0x1c,0x80,0xe4, 0x1c,0x80,0xd8,0x28,
0x80,0xd8,0x28,0x80, 0x20,0x20,0x95,0xea
};
/* The Nunchuck id. It should be written to the last bytes of the
extension register */
static const u8 nunchuck_id[] =
{
0x00, 0x00, 0xa4, 0x20, 0x00, 0x00
};
/* The Classic Controller id. It should be written to the last bytes of the
extension register */
static const u8 classic_id[] =
{
0x00, 0x00, 0xa4, 0x20, 0x01, 0x01
};
/* The id for nothing inserted */
static const u8 nothing_id[] =
{
0x00, 0x00, 0x00, 0x00, 0x2e, 0x2e
};
/* The id for a partially inserted extension */
static const u8 partially_id[] =
{
0x00, 0x00, 0x00, 0x00, 0xff, 0xff
};
void HidOutputReport(u16 _channelID, wm_report* sr);
void WmLeds(u16 _channelID, wm_leds* leds);
void WmReadData(u16 _channelID, wm_read_data* rd);
void WmWriteData(u16 _channelID, wm_write_data* wd);
void WmRequestStatus(u16 _channelID, wm_request_status* rs);
void WmRequestStatus_(u16 _channelID, int a);
void WmDataReporting(u16 _channelID, wm_data_reporting* dr);
void SendReadDataReply(u16 _channelID, void* _Base, u16 _Address, u8 _Size);
void SendReportCoreAccel(u16 _channelID);
void SendReportCoreAccelIr12(u16 _channelID);
void SendReportCore(u16 _channelID);
void SendReportCoreAccelExt16(u16 _channelID);
void SendReportCoreAccelIr10Ext(u16 _channelID);
int WriteWmReport(u8* dst, u8 channel);
void WmSendAck(u16 _channelID, u8 _reportID, u32 address);
void FillReportAcc(wm_accel& _acc);
void FillReportInfo(wm_core& _core);
void FillReportIR(wm_ir_extended& _ir0, wm_ir_extended& _ir1);
void FillReportIRBasic(wm_ir_basic& _ir0, wm_ir_basic& _ir1);
void FillReportExtension(wm_extension& _ext);
void FillReportClassicExtension(wm_classic_extension& _ext);
u32 convert24bit(const u8* src);
u16 convert16bit(const u8* src);
void GetMousePos(float& x, float& y);
} // namespace
#endif //_EMU_DECLARATIONS_

View File

@ -1,38 +1,38 @@
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) Hector Martin "marcan" (hector@marcansoft.com)
// 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 WIIMOTE_EXTENSION_ENCRYPTION_H
#define WIIMOTE_EXTENSION_ENCRYPTION_H
// ===================================================
/* They key structure to use with wiimote_gen_key() */
// ----------------
typedef struct {
u8 ft[8];
u8 sb[8];
} wiimote_key;
void wiimote_encrypt(wiimote_key *key, u8 *data, int addr, u8 len);
void wiimote_gen_key(wiimote_key *key, u8 *keydata);
// Copyright (C) 2003-2008 Dolphin Project.
// Copyright (C) Hector Martin "marcan" (hector@marcansoft.com)
// 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 WIIMOTE_EXTENSION_ENCRYPTION_H
#define WIIMOTE_EXTENSION_ENCRYPTION_H
// ===================================================
/* They key structure to use with wiimote_gen_key() */
// ----------------
typedef struct {
u8 ft[8];
u8 sb[8];
} wiimote_key;
void wiimote_encrypt(wiimote_key *key, u8 *data, int addr, u8 len);
void wiimote_gen_key(wiimote_key *key, u8 *keydata);
#endif

View File

@ -1,289 +1,289 @@
// 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 WIIMOTE_HID_H
#define WIIMOTE_HID_H
#include <CommonTypes.h>
#ifdef _MSC_VER
#pragma warning(disable:4200)
#pragma pack(push, 1)
#endif
//source: HID_010_SPC_PFL/1.0 (official HID specification)
struct hid_packet {
u8 param : 4;
u8 type : 4;
u8 data[0];
};
#define HID_TYPE_HANDSHAKE 0
#define HID_TYPE_SET_REPORT 5
#define HID_TYPE_DATA 0xA
#define HID_HANDSHAKE_SUCCESS 0
#define HID_PARAM_INPUT 1
#define HID_PARAM_OUTPUT 2
//source: http://wiibrew.org/wiki/Wiimote
struct wm_report {
u8 channel;
u8 data[0];
};
#define WM_LEDS 0x11
struct wm_leds {
u8 rumble : 1;
u8 : 3;
u8 leds : 4;
};
#define WM_DATA_REPORTING 0x12
struct wm_data_reporting {
u8 rumble : 1;
u8 continuous : 1;
u8 all_the_time : 1;
u8 : 5;
u8 mode;
};
#define WM_IR_PIXEL_CLOCK 0x13
#define WM_IR_LOGIC 0x1A
#define WM_REQUEST_STATUS 0x15
struct wm_request_status {
u8 rumble : 1;
u8 : 7;
};
#define WM_STATUS_REPORT 0x20
struct wm_status_report {
u8 padding1[2]; // two 00
u8 battery_low : 1;
u8 extension : 1;
u8 speaker : 1;
u8 ir : 1;
u8 leds : 4;
u8 padding2[2]; // two 00
u8 battery;
};
#define WM_WRITE_DATA 0x16
struct wm_write_data
{
u8 rumble : 1;
u8 space : 2; //see WM_SPACE_*
u8 : 5;
u8 address[3];
u8 size;
u8 data[16];
};
#define WM_WRITE_DATA_REPLY 0x22 //empty, afaik
struct wm_acknowledge
{
u8 Channel;
u8 unk0;
u8 unk1;
u8 reportID;
u8 errorID;
};
#define WM_READ_DATA 0x17
struct wm_read_data {
u8 rumble : 1;
u8 space : 2; //see WM_SPACE_*
u8 : 5;
u8 address[3];
u8 size[2];
};
#define WM_SPACE_EEPROM 0
#define WM_SPACE_REGS1 1
#define WM_SPACE_REGS2 2
#define WM_SPACE_INVALID 3
#define WM_READ_DATA_REPLY 0x21
struct wm_read_data_reply {
u16 buttons;
u8 error : 4; //see WM_RDERR_*
u8 size : 4;
u16 address;
u8 data[16];
};
#define WM_RDERR_WOREG 7
#define WM_RDERR_NOMEM 8
struct wm_core {
u8 left : 1;
u8 right : 1;
u8 down : 1;
u8 up : 1;
u8 plus : 1;
u8 : 3;
u8 two : 1;
u8 one : 1;
u8 b : 1;
u8 a : 1;
u8 minus : 1;
u8 : 2;
u8 home : 1;
};
struct wm_accel {
u8 x, y, z;
};
//filled with 0xFF if empty
struct wm_ir_basic
{
u8 x1;
u8 y1;
u8 x2Hi : 2;
u8 y2Hi : 2;
u8 x1Hi : 2;
u8 y1Hi : 2;
u8 x2;
u8 y2;
};
struct wm_ir_extended
{
u8 x;
u8 y;
u8 size : 4;
u8 xHi : 2;
u8 yHi : 2;
};
struct wm_extension
{
u8 jx; // joystick x, y
u8 jy;
u8 ax; // accelerometer
u8 ay;
u8 az;
u8 bt; // buttons
};
struct wm_cc_4
{
u8 padding : 1;
u8 bRT : 1;
u8 bP : 1;
u8 bH : 1;
u8 bM : 1;
u8 bLT : 1;
u8 bdD : 1;
u8 bdR : 1;
};
struct wm_cc_5
{
u8 bdU : 1;
u8 bdL : 1;
u8 bZR : 1;
u8 bX : 1;
u8 bA : 1;
u8 bY : 1;
u8 bB : 1;
u8 bZL : 1;
};
struct wm_classic_extension
{
u8 Lx : 6; // byte 0
u8 Rx : 2;
u8 Ly : 6; // byte 1
u8 Rx2 : 2;
u8 Ry : 5; // byte 2
u8 lT : 2;
u8 Rx3 : 1;
u8 rT : 5; // byte 3
u8 lT2 : 3;
wm_cc_4 b1; // byte 4
wm_cc_5 b2; // byte 5
};
#define WM_REPORT_CORE 0x30
struct wm_report_core {
wm_core c;
};
#define WM_REPORT_CORE_ACCEL 0x31
struct wm_report_core_accel {
wm_core c;
wm_accel a;
};
#define WM_REPORT_CORE_EXT8 0x32
#define WM_REPORT_CORE_ACCEL_IR12 0x33
struct wm_report_core_accel_ir12 {
wm_core c;
wm_accel a;
wm_ir_extended ir[4];
};
#define WM_REPORT_CORE_EXT19 0x34
#define WM_REPORT_CORE_ACCEL_EXT16 0x35
struct wm_report_core_accel_ext16
{
wm_core c;
wm_accel a;
wm_extension ext;
//wm_ir_basic ir[2];
u8 pad[10];
};
#define WM_REPORT_CORE_IR10_EXT9 0x36
#define WM_REPORT_CORE_ACCEL_IR10_EXT6 0x37
struct wm_report_core_accel_ir10_ext6
{
wm_core c;
wm_accel a;
wm_ir_basic ir[2];
//u8 ext[6];
wm_extension ext;
};
#define WM_REPORT_EXT21 0x3d // never used?
struct wm_report_ext21
{
u8 ext[21];
};
#define WM_REPORT_INTERLEAVE1 0x3e
#define WM_REPORT_INTERLEAVE2 0x3f
#define WM_SPEAKER_ENABLE 0x14
#define WM_SPEAKER_MUTE 0x19
#if defined(_MSC_VER)
#pragma pack(pop)
#endif
#endif //WIIMOTE_HID_H
// 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 WIIMOTE_HID_H
#define WIIMOTE_HID_H
#include <CommonTypes.h>
#ifdef _MSC_VER
#pragma warning(disable:4200)
#pragma pack(push, 1)
#endif
//source: HID_010_SPC_PFL/1.0 (official HID specification)
struct hid_packet {
u8 param : 4;
u8 type : 4;
u8 data[0];
};
#define HID_TYPE_HANDSHAKE 0
#define HID_TYPE_SET_REPORT 5
#define HID_TYPE_DATA 0xA
#define HID_HANDSHAKE_SUCCESS 0
#define HID_PARAM_INPUT 1
#define HID_PARAM_OUTPUT 2
//source: http://wiibrew.org/wiki/Wiimote
struct wm_report {
u8 channel;
u8 data[0];
};
#define WM_LEDS 0x11
struct wm_leds {
u8 rumble : 1;
u8 : 3;
u8 leds : 4;
};
#define WM_DATA_REPORTING 0x12
struct wm_data_reporting {
u8 rumble : 1;
u8 continuous : 1;
u8 all_the_time : 1;
u8 : 5;
u8 mode;
};
#define WM_IR_PIXEL_CLOCK 0x13
#define WM_IR_LOGIC 0x1A
#define WM_REQUEST_STATUS 0x15
struct wm_request_status {
u8 rumble : 1;
u8 : 7;
};
#define WM_STATUS_REPORT 0x20
struct wm_status_report {
u8 padding1[2]; // two 00
u8 battery_low : 1;
u8 extension : 1;
u8 speaker : 1;
u8 ir : 1;
u8 leds : 4;
u8 padding2[2]; // two 00
u8 battery;
};
#define WM_WRITE_DATA 0x16
struct wm_write_data
{
u8 rumble : 1;
u8 space : 2; //see WM_SPACE_*
u8 : 5;
u8 address[3];
u8 size;
u8 data[16];
};
#define WM_WRITE_DATA_REPLY 0x22 //empty, afaik
struct wm_acknowledge
{
u8 Channel;
u8 unk0;
u8 unk1;
u8 reportID;
u8 errorID;
};
#define WM_READ_DATA 0x17
struct wm_read_data {
u8 rumble : 1;
u8 space : 2; //see WM_SPACE_*
u8 : 5;
u8 address[3];
u8 size[2];
};
#define WM_SPACE_EEPROM 0
#define WM_SPACE_REGS1 1
#define WM_SPACE_REGS2 2
#define WM_SPACE_INVALID 3
#define WM_READ_DATA_REPLY 0x21
struct wm_read_data_reply {
u16 buttons;
u8 error : 4; //see WM_RDERR_*
u8 size : 4;
u16 address;
u8 data[16];
};
#define WM_RDERR_WOREG 7
#define WM_RDERR_NOMEM 8
struct wm_core {
u8 left : 1;
u8 right : 1;
u8 down : 1;
u8 up : 1;
u8 plus : 1;
u8 : 3;
u8 two : 1;
u8 one : 1;
u8 b : 1;
u8 a : 1;
u8 minus : 1;
u8 : 2;
u8 home : 1;
};
struct wm_accel {
u8 x, y, z;
};
//filled with 0xFF if empty
struct wm_ir_basic
{
u8 x1;
u8 y1;
u8 x2Hi : 2;
u8 y2Hi : 2;
u8 x1Hi : 2;
u8 y1Hi : 2;
u8 x2;
u8 y2;
};
struct wm_ir_extended
{
u8 x;
u8 y;
u8 size : 4;
u8 xHi : 2;
u8 yHi : 2;
};
struct wm_extension
{
u8 jx; // joystick x, y
u8 jy;
u8 ax; // accelerometer
u8 ay;
u8 az;
u8 bt; // buttons
};
struct wm_cc_4
{
u8 padding : 1;
u8 bRT : 1;
u8 bP : 1;
u8 bH : 1;
u8 bM : 1;
u8 bLT : 1;
u8 bdD : 1;
u8 bdR : 1;
};
struct wm_cc_5
{
u8 bdU : 1;
u8 bdL : 1;
u8 bZR : 1;
u8 bX : 1;
u8 bA : 1;
u8 bY : 1;
u8 bB : 1;
u8 bZL : 1;
};
struct wm_classic_extension
{
u8 Lx : 6; // byte 0
u8 Rx : 2;
u8 Ly : 6; // byte 1
u8 Rx2 : 2;
u8 Ry : 5; // byte 2
u8 lT : 2;
u8 Rx3 : 1;
u8 rT : 5; // byte 3
u8 lT2 : 3;
wm_cc_4 b1; // byte 4
wm_cc_5 b2; // byte 5
};
#define WM_REPORT_CORE 0x30
struct wm_report_core {
wm_core c;
};
#define WM_REPORT_CORE_ACCEL 0x31
struct wm_report_core_accel {
wm_core c;
wm_accel a;
};
#define WM_REPORT_CORE_EXT8 0x32
#define WM_REPORT_CORE_ACCEL_IR12 0x33
struct wm_report_core_accel_ir12 {
wm_core c;
wm_accel a;
wm_ir_extended ir[4];
};
#define WM_REPORT_CORE_EXT19 0x34
#define WM_REPORT_CORE_ACCEL_EXT16 0x35
struct wm_report_core_accel_ext16
{
wm_core c;
wm_accel a;
wm_extension ext;
//wm_ir_basic ir[2];
u8 pad[10];
};
#define WM_REPORT_CORE_IR10_EXT9 0x36
#define WM_REPORT_CORE_ACCEL_IR10_EXT6 0x37
struct wm_report_core_accel_ir10_ext6
{
wm_core c;
wm_accel a;
wm_ir_basic ir[2];
//u8 ext[6];
wm_extension ext;
};
#define WM_REPORT_EXT21 0x3d // never used?
struct wm_report_ext21
{
u8 ext[21];
};
#define WM_REPORT_INTERLEAVE1 0x3e
#define WM_REPORT_INTERLEAVE2 0x3f
#define WM_SPEAKER_ENABLE 0x14
#define WM_SPEAKER_MUTE 0x19
#if defined(_MSC_VER)
#pragma pack(pop)
#endif
#endif //WIIMOTE_HID_H

View File

@ -1,34 +1,34 @@
// 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 WIIMOTE_REAL_H
#define WIIMOTE_REAL_H
namespace WiiMoteReal
{
int Initialize();
void DoState(void* ptr, int mode);
void Shutdown(void);
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size);
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ;
void Update();
};
// 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 WIIMOTE_REAL_H
#define WIIMOTE_REAL_H
namespace WiiMoteReal
{
int Initialize();
void DoState(void* ptr, int mode);
void Shutdown(void);
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size);
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size) ;
void Update();
};
#endif