Wiimote: reapply the Upright wiimote option
D3D: add the EFB Copy option to complete Rodolfo's commit plus add the Overlay FPS and the Disable Fog options also change the config dialog's behaviour a bit git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4622 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -273,6 +273,7 @@ void Config::Load(bool ChangePad)
|
||||
sprintf(SectionName, "Wiimote%i", i + 1);
|
||||
iniFile.Get(SectionName, "NoTriggerFilter", &bNoTriggerFilter, false);
|
||||
iniFile.Get(SectionName, "TriggerType", &Trigger.Type, Trigger.TRIGGER_OFF);
|
||||
iniFile.Get(SectionName, "TriggerUpright", &Trigger.Upright, false);
|
||||
iniFile.Get(SectionName, "TriggerRollRange", &Trigger.Range.Roll, 50);
|
||||
iniFile.Get(SectionName, "TriggerPitchRange", &Trigger.Range.Pitch, false);
|
||||
|
||||
@@ -375,6 +376,7 @@ void Config::Save(int Slot)
|
||||
iniFile.Set(SectionName, "Enabled", WiiMoteEmu::PadMapping[i].enabled);
|
||||
iniFile.Set(SectionName, "NoTriggerFilter", bNoTriggerFilter);
|
||||
iniFile.Set(SectionName, "TriggerType", Trigger.Type);
|
||||
iniFile.Set(SectionName, "TriggerUpright", Trigger.Upright);
|
||||
iniFile.Set(SectionName, "TriggerRollRange", Trigger.Range.Roll);
|
||||
iniFile.Set(SectionName, "TriggerPitchRange", Trigger.Range.Pitch);
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ struct Config
|
||||
TRIGGER
|
||||
};
|
||||
int Type;
|
||||
bool Upright;
|
||||
PadRange Range;
|
||||
};
|
||||
struct PadNunchuck
|
||||
|
||||
@@ -34,6 +34,7 @@ BEGIN_EVENT_TABLE(WiimoteBasicConfigDialog,wxDialog)
|
||||
EVT_CHECKBOX(ID_CONNECT_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_USE_REAL, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_SIDEWAYSDPAD, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_UPRIGHTWIIMOTE, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHECKBOX(ID_MOTIONPLUSCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
EVT_CHOICE(ID_EXTCONNECTED, WiimoteBasicConfigDialog::GeneralSettingsChanged)
|
||||
// IR cursor
|
||||
@@ -207,9 +208,9 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
|
||||
// Emulated Wiimote
|
||||
m_SidewaysDPad[i] = new wxCheckBox(m_Controller[i], ID_SIDEWAYSDPAD, wxT("Sideways D-Pad"));
|
||||
m_SidewaysDPad[i]->SetValue(g_Config.bSidewaysDPad);
|
||||
|
||||
m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Wiimote"));
|
||||
m_SizeEmu[i]->Add(m_SidewaysDPad[i], 0, wxEXPAND | wxALL, 5);
|
||||
m_UprightWiimote[i] = new wxCheckBox(m_Controller[i], ID_UPRIGHTWIIMOTE, wxT("Upright Wiimote"));
|
||||
m_UprightWiimote[i]->SetValue(g_Config.Trigger.Upright);
|
||||
m_UprightWiimote[i]->SetToolTip(wxT("Treat the upright position as neutral for roll and pitch"));
|
||||
|
||||
//IR Pointer
|
||||
m_TextScreenWidth[i] = new wxStaticText(m_Controller[i], wxID_ANY, wxT("Width: 000"));
|
||||
@@ -251,6 +252,12 @@ void WiimoteBasicConfigDialog::CreateGUIControls()
|
||||
m_CheckAR169[i]->Enable(false);
|
||||
m_Crop[i]->Enable(false);
|
||||
|
||||
// Sizers
|
||||
|
||||
m_SizeEmu[i] = new wxStaticBoxSizer(wxVERTICAL, m_Controller[i], wxT("Emulated Wiimote"));
|
||||
m_SizeEmu[i]->Add(m_SidewaysDPad[i], 0, wxEXPAND | wxALL, 5);
|
||||
m_SizeEmu[i]->Add(m_UprightWiimote[i], 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
|
||||
|
||||
m_SizerIRPointerScreen[i] = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_SizerIRPointerScreen[i]->Add(m_TextAR[i], 0, wxEXPAND | (wxTOP), 0);
|
||||
m_SizerIRPointerScreen[i]->Add(m_CheckAR43[i], 0, wxEXPAND | (wxLEFT), 5);
|
||||
@@ -391,6 +398,9 @@ void WiimoteBasicConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
||||
|
||||
case ID_SIDEWAYSDPAD:
|
||||
g_Config.bSidewaysDPad = m_SidewaysDPad[Page]->IsChecked();
|
||||
break;
|
||||
case ID_UPRIGHTWIIMOTE:
|
||||
g_Config.Trigger.Upright = m_UprightWiimote[Page]->IsChecked();
|
||||
break;
|
||||
|
||||
case ID_MOTIONPLUSCONNECTED:
|
||||
|
||||
@@ -79,6 +79,7 @@ class WiimoteBasicConfigDialog : public wxDialog
|
||||
|
||||
// Emulated Wiimote settings
|
||||
wxCheckBox *m_SidewaysDPad[4],
|
||||
*m_UprightWiimote[4],
|
||||
*m_WiimoteOnline[4],
|
||||
*m_WiiMotionPlusConnected[4],
|
||||
*m_CheckAR43[4],
|
||||
@@ -126,6 +127,7 @@ class WiimoteBasicConfigDialog : public wxDialog
|
||||
|
||||
// Emulated Wiimote
|
||||
ID_SIDEWAYSDPAD,
|
||||
ID_UPRIGHTWIIMOTE,
|
||||
ID_MOTIONPLUSCONNECTED,
|
||||
ID_EXTCONNECTED,
|
||||
IDC_WIMOTE_ON,
|
||||
|
||||
@@ -59,7 +59,7 @@ void TiltTest(u8 x, u8 y, u8 z)
|
||||
std::string To = StringFromFormat("%s\nTo: X:%i Y:%i Z:%i Roll:%s Pitch:%s", From.c_str(), x, y, z,
|
||||
(_Roll >= 0) ? StringFromFormat(" %03i", (int)_Roll).c_str() : StringFromFormat("%04i", (int)_Roll).c_str(),
|
||||
(_Pitch >= 0) ? StringFromFormat(" %03i", (int)_Pitch).c_str() : StringFromFormat("%04i", (int)_Pitch).c_str());
|
||||
DEBUG_LOG(WIIMOTE, "%s", To.c_str());
|
||||
NOTICE_LOG(CONSOLE, "\n%s", To.c_str());
|
||||
}
|
||||
|
||||
|
||||
@@ -100,14 +100,29 @@ void PitchDegreeToAccelerometer(float _Roll, float _Pitch, u8 &_x, u8 &_y, u8 &_
|
||||
// In these cases we can use the simple and accurate formula
|
||||
if(g_Config.Trigger.Range.Pitch == 0)
|
||||
{
|
||||
x = sin(_Roll);
|
||||
z = cos(_Roll);
|
||||
if (!g_Config.Trigger.Upright)
|
||||
{
|
||||
x = sin(_Roll);
|
||||
z = cos(_Roll);
|
||||
}
|
||||
else
|
||||
{
|
||||
z = sin(_Roll);
|
||||
y = -cos(_Roll);
|
||||
}
|
||||
}
|
||||
else if (g_Config.Trigger.Range.Roll == 0)
|
||||
{
|
||||
|
||||
y = sin(_Pitch);
|
||||
z = cos(_Pitch);
|
||||
if (!g_Config.Trigger.Upright)
|
||||
{
|
||||
y = sin(_Pitch);
|
||||
z = cos(_Pitch);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = -sin(_Pitch);
|
||||
y = -cos(_Pitch);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -118,16 +133,28 @@ void PitchDegreeToAccelerometer(float _Roll, float _Pitch, u8 &_x, u8 &_y, u8 &_
|
||||
and Pitch. But if we select a Z from the smallest of the absolute
|
||||
value of cos(Roll) and cos (Pitch) we get the right values. */
|
||||
// ---------
|
||||
if (abs(cos(_Roll)) < abs(cos(_Pitch))) z = cos(_Roll); else z = cos(_Pitch);
|
||||
/* I got these from reversing the calculation in
|
||||
PitchAccelerometerToDegree() in a math program I don't know if we
|
||||
can derive these from some kind of matrix or something */
|
||||
float x_num = 2 * tanf(0.5f * _Roll) * z;
|
||||
float x_den = pow2f(tanf(0.5f * _Roll)) - 1;
|
||||
x = - (x_num / x_den);
|
||||
float y_num = 2 * tanf(0.5f * _Pitch) * z;
|
||||
float y_den = pow2f(tanf(0.5f * _Pitch)) - 1;
|
||||
y = - (y_num / y_den);
|
||||
if (!g_Config.Trigger.Upright)
|
||||
{
|
||||
if (abs(cos(_Roll)) < abs(cos(_Pitch))) z = cos(_Roll); else z = cos(_Pitch);
|
||||
/* I got these from reversing the calculation in
|
||||
PitchAccelerometerToDegree() in a math program. */
|
||||
float x_num = 2 * tanf(0.5f * _Roll) * z;
|
||||
float x_den = pow2f(tanf(0.5f * _Roll)) - 1;
|
||||
x = - (x_num / x_den);
|
||||
float y_num = 2 * tanf(0.5f * _Pitch) * z;
|
||||
float y_den = pow2f(tanf(0.5f * _Pitch)) - 1;
|
||||
y = - (y_num / y_den);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (abs(-cos(_Roll)) < abs(-cos(_Pitch))) y = -cos(_Roll); else y = -cos(_Pitch);
|
||||
float z_num = 2 * tanf(0.5f * _Roll) * y;
|
||||
float z_den = pow2f(tanf(0.5f * _Roll)) - 1;
|
||||
z = (z_num / z_den);
|
||||
float x_num = 2 * tanf(0.5f * _Pitch) * y;
|
||||
float x_den = pow2f(tanf(0.5f * _Pitch)) - 1;
|
||||
x = - (x_num / x_den);
|
||||
}
|
||||
}
|
||||
|
||||
// Multiply with the neutral of z and its g
|
||||
@@ -145,9 +172,18 @@ void PitchDegreeToAccelerometer(float _Roll, float _Pitch, u8 &_x, u8 &_y, u8 &_
|
||||
if (ix < 0) ix = 0; if (ix > 255) ix = 255;
|
||||
if (iy < 0) iy = 0; if (iy > 255) iy = 255;
|
||||
if (iz < 0) iz = 0; if (iz > 255) iz = 255;
|
||||
if(g_Config.Trigger.Range.Roll != 0) _x = ix;
|
||||
if(g_Config.Trigger.Range.Pitch != 0) _y = iy;
|
||||
_z = iz;
|
||||
if (!g_Config.Trigger.Upright)
|
||||
{
|
||||
if(g_Config.Trigger.Range.Roll != 0) _x = ix;
|
||||
if(g_Config.Trigger.Range.Pitch != 0) _y = iy;
|
||||
_z = iz;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(g_Config.Trigger.Range.Roll != 0) _z = iz;
|
||||
if(g_Config.Trigger.Range.Pitch != 0) _x = ix;
|
||||
_y = iy;
|
||||
}
|
||||
}
|
||||
|
||||
// Accelerometer to roll and pitch angles
|
||||
@@ -167,17 +203,34 @@ void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, in
|
||||
float y = AccelerometerToG((float)_y, (float)g_wm.cal_zero.y, (float)g_wm.cal_g.y);
|
||||
float z = AccelerometerToG((float)_z, (float)g_wm.cal_zero.z, (float)g_wm.cal_g.z);
|
||||
|
||||
// If it is over 1g then it is probably accelerating and may not reliable
|
||||
//if (abs(accel->x - ac->cal_zero.x) <= ac->cal_g.x)
|
||||
if (!g_Config.Trigger.Upright)
|
||||
{
|
||||
// Calculate the degree
|
||||
Roll = InputCommon::Rad2Deg(atan2(x, z));
|
||||
}
|
||||
// If it is over 1g then it is probably accelerating and may not reliable
|
||||
//if (abs(accel->x - ac->cal_zero.x) <= ac->cal_g.x)
|
||||
{
|
||||
// Calculate the degree
|
||||
Roll = InputCommon::Rad2Deg(atan2(x, z));
|
||||
}
|
||||
|
||||
//if (abs(_y - g_wm.cal_zero.y) <= g_wm.cal_g.y)
|
||||
//if (abs(_y - g_wm.cal_zero.y) <= g_wm.cal_g.y)
|
||||
{
|
||||
// Calculate the degree
|
||||
Pitch = InputCommon::Rad2Deg(atan2(y, z));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Calculate the degree
|
||||
Pitch = InputCommon::Rad2Deg(atan2(y, z));
|
||||
//if (abs(accel->z - ac->cal_zero.z) <= ac->cal_g.x)
|
||||
{
|
||||
// Calculate the degree
|
||||
Roll = InputCommon::Rad2Deg(atan2(z, -y));
|
||||
}
|
||||
|
||||
//if (abs(_x - g_wm.cal_zero.x) <= g_wm.cal_g.x)
|
||||
{
|
||||
// Calculate the degree
|
||||
Pitch = InputCommon::Rad2Deg(atan2(-x, -y));
|
||||
}
|
||||
}
|
||||
|
||||
_Roll = (int)Roll;
|
||||
@@ -187,9 +240,16 @@ void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, in
|
||||
if (x < -1.0) x = -1.0; else if (x > 1.0) x = 1.0;
|
||||
if (y < -1.0) y = -1.0; else if (y > 1.0) y = 1.0;
|
||||
if (z < -1.0) z = -1.0; else if (z > 1.0) z = 1.0;
|
||||
Roll = InputCommon::Rad2Deg(atan2(x, z));
|
||||
Pitch = InputCommon::Rad2Deg(atan2(y, z));
|
||||
|
||||
if (!g_Config.Trigger.Upright)
|
||||
{
|
||||
Roll = InputCommon::Rad2Deg(atan2(x, z));
|
||||
Pitch = InputCommon::Rad2Deg(atan2(y, z));
|
||||
}
|
||||
else
|
||||
{
|
||||
Roll = InputCommon::Rad2Deg(atan2(z, -y));
|
||||
Pitch = InputCommon::Rad2Deg(atan2(-x, -y));
|
||||
}
|
||||
_RollAdj = (int)Roll;
|
||||
_PitchAdj = (int)Pitch;
|
||||
}
|
||||
|
||||
@@ -758,12 +758,15 @@ void ReadDebugging(bool Emu, const void* _pData, int Size)
|
||||
// ---------------------------------------------
|
||||
// Test the angles to x, y, z values formula by calculating the values back and forth
|
||||
// -----------
|
||||
/* //Console::ClearScreen();
|
||||
/*
|
||||
ConsoleListener* Console = LogManager::GetInstance()->getConsoleListener();
|
||||
Console->ClearScreen();
|
||||
// Show a test of our calculations
|
||||
WiiMoteEmu::TiltTest(data[4], data[5], data[6]);
|
||||
u8 x, y, z;
|
||||
WiiMoteEmu::Tilt(x, y, z);
|
||||
WiiMoteEmu::TiltTest(x, y, z);*/
|
||||
//WiiMoteEmu::Tilt(x, y, z);
|
||||
//WiiMoteEmu::TiltTest(x, y, z);
|
||||
*/
|
||||
// -------------------------
|
||||
|
||||
// ---------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user