mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Move UDPConfigDiag into Dolphin, to allow building of UDP Wiimote again.
Please test this, I don't have any phones or whatever capable of communicating with it. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6405 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -27,11 +27,7 @@ static const u8 nunchuk_button_bitmasks[] =
|
||||
Nunchuk::BUTTON_Z,
|
||||
};
|
||||
|
||||
#ifdef USE_UDP_WIIMOTE
|
||||
Nunchuk::Nunchuk(UDPWrapper *wrp) : Attachment("Nunchuk") , m_udpWrap(wrp)
|
||||
#else
|
||||
Nunchuk::Nunchuk() : Attachment("Nunchuk")
|
||||
#endif
|
||||
{
|
||||
// buttons
|
||||
groups.push_back(m_buttons = new Buttons("Buttons"));
|
||||
@ -89,7 +85,6 @@ void Nunchuk::GetState(u8* const data, const bool focus)
|
||||
// flip the button bits :/
|
||||
ncdata->bt ^= 0x03;
|
||||
|
||||
#ifdef USE_UDP_WIIMOTE
|
||||
if (m_udpWrap->inst)
|
||||
{
|
||||
if (m_udpWrap->updNun)
|
||||
@ -111,21 +106,19 @@ void Nunchuk::GetState(u8* const data, const bool focus)
|
||||
}
|
||||
if (m_udpWrap->updNunAccel)
|
||||
{
|
||||
float x,y,z;
|
||||
m_udpWrap->inst->getNunchuckAccel(x,y,z);
|
||||
accel.x=x;
|
||||
accel.y=y;
|
||||
accel.z=z;
|
||||
float x, y, z;
|
||||
m_udpWrap->inst->getNunchuckAccel(x, y, z);
|
||||
accel.x = x;
|
||||
accel.y = y;
|
||||
accel.z = z;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
wm_accel* dt = (wm_accel*)&ncdata->ax;
|
||||
accel_cal* calib = (accel_cal*)®[0x20];
|
||||
dt->x=u8(trim(accel.x*(calib->one_g.x-calib->zero_g.x)+calib->zero_g.x));
|
||||
dt->y=u8(trim(accel.y*(calib->one_g.y-calib->zero_g.y)+calib->zero_g.y));
|
||||
dt->z=u8(trim(accel.z*(calib->one_g.z-calib->zero_g.z)+calib->zero_g.z));
|
||||
dt->x = u8(trim(accel.x * (calib->one_g.x - calib->zero_g.x) + calib->zero_g.x));
|
||||
dt->y = u8(trim(accel.y * (calib->one_g.y - calib->zero_g.y) + calib->zero_g.y));
|
||||
dt->z = u8(trim(accel.z * (calib->one_g.z - calib->zero_g.z) + calib->zero_g.z));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -11,12 +11,7 @@ namespace WiimoteEmu
|
||||
class Nunchuk : public Attachment
|
||||
{
|
||||
public:
|
||||
|
||||
#ifdef USE_UDP_WIIMOTE
|
||||
Nunchuk(UDPWrapper * wrp);
|
||||
#else
|
||||
Nunchuk();
|
||||
#endif
|
||||
|
||||
virtual void GetState( u8* const data, const bool focus );
|
||||
|
||||
@ -37,9 +32,7 @@ private:
|
||||
|
||||
unsigned int m_shake_step[3];
|
||||
|
||||
#ifdef USE_UDP_WIIMOTE
|
||||
UDPWrapper* const m_udpWrap;
|
||||
#endif
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,56 +1,53 @@
|
||||
//UDP Wiimote Translation Layer
|
||||
|
||||
#if (defined(USE_UDP_WIIMOTE) && !defined(UDPTLAYER_H))
|
||||
#ifndef UDPTLAYER_H
|
||||
#define UDPTLAYER_H
|
||||
|
||||
#include "UDPWiimote.h"
|
||||
#include "WiimoteEmu.h"
|
||||
|
||||
using WiimoteEmu::Wiimote;
|
||||
|
||||
namespace UDPTLayer
|
||||
{
|
||||
void GetButtons(UDPWrapper * m , wm_core * butt)
|
||||
{
|
||||
if (!(m->inst)) return;
|
||||
if (!(m->updButt)) return;
|
||||
u32 mask=m->inst->getButtons();
|
||||
*butt|=(mask&UDPWM_BA)?Wiimote::BUTTON_A:0;
|
||||
*butt|=(mask&UDPWM_BB)?Wiimote::BUTTON_B:0;
|
||||
*butt|=(mask&UDPWM_B1)?Wiimote::BUTTON_ONE:0;
|
||||
*butt|=(mask&UDPWM_B2)?Wiimote::BUTTON_TWO:0;
|
||||
*butt|=(mask&UDPWM_BP)?Wiimote::BUTTON_PLUS:0;
|
||||
*butt|=(mask&UDPWM_BM)?Wiimote::BUTTON_MINUS:0;
|
||||
*butt|=(mask&UDPWM_BH)?Wiimote::BUTTON_HOME:0;
|
||||
*butt|=(mask&UDPWM_BU)?Wiimote::PAD_UP:0;
|
||||
*butt|=(mask&UDPWM_BD)?Wiimote::PAD_DOWN:0;
|
||||
*butt|=(mask&UDPWM_BL)?Wiimote::PAD_LEFT:0;
|
||||
*butt|=(mask&UDPWM_BR)?Wiimote::PAD_RIGHT:0;
|
||||
u32 mask = m->inst->getButtons();
|
||||
*butt |= (mask & UDPWM_BA) ? WiimoteEmu::Wiimote::BUTTON_A : 0;
|
||||
*butt |= (mask & UDPWM_BB) ? WiimoteEmu::Wiimote::BUTTON_B : 0;
|
||||
*butt |= (mask & UDPWM_B1) ? WiimoteEmu::Wiimote::BUTTON_ONE : 0;
|
||||
*butt |= (mask & UDPWM_B2) ? WiimoteEmu::Wiimote::BUTTON_TWO : 0;
|
||||
*butt |= (mask & UDPWM_BP) ? WiimoteEmu::Wiimote::BUTTON_PLUS : 0;
|
||||
*butt |= (mask & UDPWM_BM) ? WiimoteEmu::Wiimote::BUTTON_MINUS : 0;
|
||||
*butt |= (mask & UDPWM_BH) ? WiimoteEmu::Wiimote::BUTTON_HOME : 0;
|
||||
*butt |= (mask & UDPWM_BU) ? WiimoteEmu::Wiimote::PAD_UP : 0;
|
||||
*butt |= (mask & UDPWM_BD) ? WiimoteEmu::Wiimote::PAD_DOWN : 0;
|
||||
*butt |= (mask & UDPWM_BL) ? WiimoteEmu::Wiimote::PAD_LEFT : 0;
|
||||
*butt |= (mask & UDPWM_BR) ? WiimoteEmu::Wiimote::PAD_RIGHT : 0;
|
||||
}
|
||||
|
||||
void GetAcceleration(UDPWrapper * m , WiimoteEmu::AccelData * const data)
|
||||
{
|
||||
if (!(m->inst)) return;
|
||||
if (!(m->updAccel)) return;
|
||||
float x,y,z;
|
||||
m->inst->getAccel(x,y,z);
|
||||
data->x=x;
|
||||
data->y=y;
|
||||
data->z=z;
|
||||
float x, y, z;
|
||||
m->inst->getAccel(x, y, z);
|
||||
data->x = x;
|
||||
data->y = y;
|
||||
data->z = z;
|
||||
}
|
||||
|
||||
void GetIR( UDPWrapper * m, float * x, float * y, float * z)
|
||||
{
|
||||
if (!(m->inst)) return;
|
||||
if (!(m->updIR)) return;
|
||||
if ((*x>=-0.999)&&(*x<=0.999)&&(*y>=-0.999)&&(*y<=0.999)) return; //the recieved values are used ONLY when the normal pointer is offscreen
|
||||
float _x,_y;
|
||||
m->inst->getIR(_x,_y);
|
||||
*x=_x*2-1;
|
||||
*y=-(_y*2-1);
|
||||
*z=0;
|
||||
if ((*x >= -0.999) && (*x <= 0.999) && (*y >= -0.999) && (*y <= 0.999)) return; //the recieved values are used ONLY when the normal pointer is offscreen
|
||||
float _x, _y;
|
||||
m->inst->getIR(_x, _y);
|
||||
*x = _x * 2 - 1;
|
||||
*y = -(_y * 2 - 1);
|
||||
*z = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -251,10 +251,8 @@ Wiimote::Wiimote( const unsigned int index )
|
||||
// tilt
|
||||
groups.push_back(m_tilt = new Tilt("Tilt"));
|
||||
|
||||
#ifdef USE_UDP_WIIMOTE
|
||||
// udp
|
||||
groups.push_back(m_udp = new UDPWrapper(m_index, "UDP Wiimote"));
|
||||
#endif
|
||||
|
||||
// shake
|
||||
groups.push_back(m_shake = new Buttons("Shake"));
|
||||
@ -265,11 +263,7 @@ Wiimote::Wiimote( const unsigned int index )
|
||||
// extension
|
||||
groups.push_back(m_extension = new Extension("Extension"));
|
||||
m_extension->attachments.push_back(new WiimoteEmu::None());
|
||||
#ifdef USE_UDP_WIIMOTE
|
||||
m_extension->attachments.push_back(new WiimoteEmu::Nunchuk(m_udp));
|
||||
#else
|
||||
m_extension->attachments.push_back(new WiimoteEmu::Nunchuk());
|
||||
#endif
|
||||
m_extension->attachments.push_back(new WiimoteEmu::Classic());
|
||||
m_extension->attachments.push_back(new WiimoteEmu::Guitar());
|
||||
m_extension->attachments.push_back(new WiimoteEmu::Drums());
|
||||
@ -345,9 +339,7 @@ bool Wiimote::Step()
|
||||
{
|
||||
m_buttons->GetState(&m_status.buttons, button_bitmasks);
|
||||
m_dpad->GetState(&m_status.buttons, is_sideways ? dpad_sideways_bitmasks : dpad_bitmasks);
|
||||
#ifdef USE_UDP_WIIMOTE
|
||||
UDPTLayer::GetButtons(m_udp, &m_status.buttons);
|
||||
#endif
|
||||
}
|
||||
|
||||
// check if there is a read data request
|
||||
@ -407,9 +399,7 @@ void Wiimote::GetAccelData(u8* const data, u8* const buttons)
|
||||
{
|
||||
EmulateSwing(&m_accel, m_swing, is_sideways, is_upright);
|
||||
EmulateShake(&m_accel, m_shake, m_shake_step);
|
||||
#ifdef USE_UDP_WIIMOTE
|
||||
UDPTLayer::GetAcceleration(m_udp, &m_accel);
|
||||
#endif
|
||||
}
|
||||
wm_accel* dt = (wm_accel*)data;
|
||||
accel_cal* calib = (accel_cal*)&m_eeprom[0x16];
|
||||
@ -476,9 +466,7 @@ void Wiimote::GetIRData(u8* const data, bool use_accel)
|
||||
LowPassFilter(ir_cos,ncos,1.0f/60);
|
||||
|
||||
m_ir->GetState(&xx, &yy, &zz, true);
|
||||
#ifdef USE_UDP_WIIMOTE
|
||||
UDPTLayer::GetIR(m_udp, &xx, &yy, &zz);
|
||||
#endif
|
||||
|
||||
Vertex v[4];
|
||||
|
||||
|
@ -146,9 +146,7 @@ private:
|
||||
|
||||
double ir_sin,ir_cos; //for the low pass filter
|
||||
|
||||
#ifdef USE_UDP_WIIMOTE
|
||||
UDPWrapper* m_udp;
|
||||
#endif
|
||||
|
||||
bool m_rumble_on;
|
||||
bool m_speaker_mute;
|
||||
|
Reference in New Issue
Block a user