hide pages 2-4 of wiimote plugin
prepare some functions for >1 wiimote git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3251 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
fe5c9004e4
commit
b85353f684
|
@ -478,19 +478,15 @@ void ConfigDialog::CreateGUIControls()
|
|||
// ----------------
|
||||
m_Notebook = new wxNotebook(this, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
// Controller pages
|
||||
m_Controller[0] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1, wxDefaultPosition, wxDefaultSize);
|
||||
m_Controller[1] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE2, wxDefaultPosition, wxDefaultSize);
|
||||
m_Controller[2] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE3, wxDefaultPosition, wxDefaultSize);
|
||||
m_Controller[3] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE4, wxDefaultPosition, wxDefaultSize);
|
||||
m_PageRecording = new wxPanel(m_Notebook, ID_PAGE_RECORDING, wxDefaultPosition, wxDefaultSize);
|
||||
for (int i = 0; i < MAX_WIIMOTES; i++)
|
||||
{
|
||||
// Controller pages
|
||||
m_Controller[i] = new wxPanel(m_Notebook, ID_CONTROLLERPAGE1 + i, wxDefaultPosition, wxDefaultSize);
|
||||
m_Notebook->AddPage(m_Controller[i], wxString::Format(wxT("Wiimote %d"), i+1));
|
||||
}
|
||||
|
||||
m_Notebook->AddPage(m_Controller[0], wxT("Wiimote 1"));
|
||||
m_Notebook->AddPage(m_Controller[1], wxT("Wiimote 2"));
|
||||
m_Notebook->AddPage(m_Controller[2], wxT("Wiimote 3"));
|
||||
m_Notebook->AddPage(m_Controller[3], wxT("Wiimote 4"));
|
||||
m_PageRecording = new wxPanel(m_Notebook, ID_PAGE_RECORDING, wxDefaultPosition, wxDefaultSize);
|
||||
m_Notebook->AddPage(m_PageRecording, wxT("Recording"));
|
||||
///////////////////////////////
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -563,7 +559,7 @@ void ConfigDialog::CreateGUIControls()
|
|||
|
||||
/* Populate all four pages. Page 2, 3 and 4 are currently disabled since we can't use more than one
|
||||
Wiimote at the moment */
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < MAX_WIIMOTES; i++)
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
@ -1404,9 +1400,10 @@ void ConfigDialog::CreateGUIControls()
|
|||
m_MainSizer->Add(m_Notebook, 1, wxEXPAND | wxALL, 5);
|
||||
m_MainSizer->Add(sButtons, 0, wxEXPAND | (wxLEFT | wxRIGHT | wxDOWN), 5);
|
||||
|
||||
m_Controller[1]->Enable(false);
|
||||
m_Controller[2]->Enable(false);
|
||||
m_Controller[3]->Enable(false);
|
||||
for (int i = MAX_WIIMOTES - 1; i > 0; i--)
|
||||
{
|
||||
m_Controller[i]->Enable(false);
|
||||
}
|
||||
|
||||
this->SetSizer(m_MainSizer);
|
||||
this->Layout();
|
||||
|
@ -1760,3 +1757,4 @@ void ConfigDialog::UpdateGUI(int Slot)
|
|||
if(ControlsCreated) m_Notebook->FindItem(i)->Enable(ActiveRecording);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -272,4 +272,4 @@ class ConfigDialog : public wxDialog
|
|||
|
||||
extern ConfigDialog *frame;
|
||||
|
||||
#endif
|
||||
#endif
|
|
@ -277,7 +277,10 @@ void ReadWiimote()
|
|||
timing functions for recording playback that checks the time of the recording this should not
|
||||
be needed. But I still use it becase it seemed like state_changed() or the threshold values or
|
||||
something else might fail so that only huge status changed were reported. */
|
||||
handle_event(g_WiiMotesFromWiiUse[0]);
|
||||
for (int i = 0; i < g_NumberOfWiiMotes; i++)
|
||||
{
|
||||
handle_event(g_WiiMotesFromWiiUse[i]);
|
||||
}
|
||||
|
||||
// Declaration
|
||||
std::string Temp;
|
||||
|
@ -331,11 +334,11 @@ void ReadWiimote()
|
|||
* Take a look at wiimotes[i]->read_req
|
||||
* for the data.
|
||||
*/
|
||||
if(g_WiiMotesFromWiiUse[0]->read_req->size == sizeof(WiiMoteEmu::EepromData_0)
|
||||
&& g_WiiMotesFromWiiUse[0]->read_req->addr == 0)
|
||||
if(g_WiiMotesFromWiiUse[i]->read_req->size == sizeof(WiiMoteEmu::EepromData_0)
|
||||
&& g_WiiMotesFromWiiUse[i]->read_req->addr == 0)
|
||||
{
|
||||
Temp = ArrayToString(g_WiiMotesFromWiiUse[0]->read_req->buf, sizeof(WiiMoteEmu::EepromData_0), 0, 30);
|
||||
memcpy(WiiMoteEmu::g_Eeprom, g_WiiMotesFromWiiUse[0]->read_req->buf, sizeof(WiiMoteEmu::EepromData_0));
|
||||
Temp = ArrayToString(g_WiiMotesFromWiiUse[i]->read_req->buf, sizeof(WiiMoteEmu::EepromData_0), 0, 30);
|
||||
memcpy(WiiMoteEmu::g_Eeprom, g_WiiMotesFromWiiUse[i]->read_req->buf, sizeof(WiiMoteEmu::EepromData_0));
|
||||
INFO_LOG(CONSOLE, "EEPROM: %s\n", Temp.c_str());
|
||||
WiiMoteEmu::UpdateEeprom();
|
||||
g_RunTemporary = false;
|
||||
|
@ -382,4 +385,3 @@ void ReadWiimote()
|
|||
|
||||
}; // end of namespace
|
||||
|
||||
|
||||
|
|
|
@ -300,6 +300,7 @@ void SendAcc(u8 _ReportID)
|
|||
DataAcc[2] = 0x00;
|
||||
DataAcc[3] = _ReportID; // Reporting mode
|
||||
|
||||
// TODO: Update for multiple wiimotes?
|
||||
wiiuse_io_write(WiiMoteReal::g_WiiMotesFromWiiUse[0], (byte*)DataAcc, MAX_PAYLOAD);
|
||||
|
||||
std::string Temp = ArrayToString(DataAcc, 28, 0, 30);
|
||||
|
@ -318,16 +319,25 @@ void ClearEvents()
|
|||
// Flash lights, and if connecting, also rumble
|
||||
void FlashLights(bool Connect)
|
||||
{
|
||||
if(Connect) wiiuse_rumble(WiiMoteReal::g_WiiMotesFromWiiUse[0], 1);
|
||||
wiiuse_set_leds(WiiMoteReal::g_WiiMotesFromWiiUse[0], WIIMOTE_LED_1 | WIIMOTE_LED_2 | WIIMOTE_LED_3 | WIIMOTE_LED_4);
|
||||
sleep(100);
|
||||
if(Connect) wiiuse_rumble(WiiMoteReal::g_WiiMotesFromWiiUse[0], 0);
|
||||
|
||||
// End with light 1 or 4
|
||||
if(Connect)
|
||||
wiiuse_set_leds(WiiMoteReal::g_WiiMotesFromWiiUse[0], WIIMOTE_LED_1);
|
||||
else
|
||||
wiiuse_set_leds(WiiMoteReal::g_WiiMotesFromWiiUse[0], WIIMOTE_LED_4);
|
||||
for (int i = 0; i < g_NumberOfWiiMotes; i++)
|
||||
{
|
||||
if(Connect) wiiuse_rumble(WiiMoteReal::g_WiiMotesFromWiiUse[i], 1);
|
||||
wiiuse_set_leds(WiiMoteReal::g_WiiMotesFromWiiUse[i], WIIMOTE_LED_1 | WIIMOTE_LED_2 | WIIMOTE_LED_3 | WIIMOTE_LED_4);
|
||||
}
|
||||
sleep(100);
|
||||
|
||||
for (int i = 0; i < g_NumberOfWiiMotes; i++)
|
||||
{
|
||||
if(Connect)
|
||||
{
|
||||
wiiuse_rumble(WiiMoteReal::g_WiiMotesFromWiiUse[i], 0);
|
||||
|
||||
// End with light 1 or 4
|
||||
wiiuse_set_leds(WiiMoteReal::g_WiiMotesFromWiiUse[i], WIIMOTE_LED_1);
|
||||
}
|
||||
else wiiuse_set_leds(WiiMoteReal::g_WiiMotesFromWiiUse[i], WIIMOTE_LED_4);
|
||||
}
|
||||
}
|
||||
|
||||
int Initialize()
|
||||
|
@ -344,15 +354,17 @@ int Initialize()
|
|||
if (g_NumberOfWiiMotes > 0) g_RealWiiMotePresent = true;
|
||||
INFO_LOG(CONSOLE, "Found No of Wiimotes: %i\n", g_NumberOfWiiMotes);
|
||||
|
||||
// Remove the wiiuse_poll() threshold
|
||||
wiiuse_set_accel_threshold(g_WiiMotesFromWiiUse[0], 0);
|
||||
|
||||
// Set the sensor bar position, this should only affect the internal wiiuse api functions
|
||||
wiiuse_set_ir_position(g_WiiMotesFromWiiUse[0], WIIUSE_IR_ABOVE);
|
||||
|
||||
// Set flags
|
||||
//wiiuse_set_flags(g_WiiMotesFromWiiUse[0], NULL, WIIUSE_SMOOTHING);
|
||||
for (int i = 0; i < g_NumberOfWiiMotes; i++)
|
||||
{
|
||||
// Remove the wiiuse_poll() threshold
|
||||
wiiuse_set_accel_threshold(g_WiiMotesFromWiiUse[i], 0);
|
||||
|
||||
// Set the sensor bar position, this should only affect the internal wiiuse api functions
|
||||
wiiuse_set_ir_position(g_WiiMotesFromWiiUse[i], WIIUSE_IR_ABOVE);
|
||||
|
||||
// Set flags
|
||||
//wiiuse_set_flags(g_WiiMotesFromWiiUse[i], NULL, WIIUSE_SMOOTHING);
|
||||
}
|
||||
// I don't seem to need wiiuse_connect() in Windows. But Linux needs it.
|
||||
#ifndef _WIN32
|
||||
int Connect = wiiuse_connect(g_WiiMotesFromWiiUse, MAX_WIIMOTES);
|
||||
|
@ -378,6 +390,7 @@ int Initialize()
|
|||
is connected. Also, we can't change the neutral values the wiimote will report, I think, unless
|
||||
we update its eeprom? In any case it's probably better to let the current calibration be where it
|
||||
is and adjust the global values after that to avoid overwriting critical data on any Wiimote. */
|
||||
// TODO: Update for multiple wiimotes?
|
||||
byte *data = (byte*)malloc(sizeof(byte) * sizeof(WiiMoteEmu::EepromData_0));
|
||||
wiiuse_read_data(g_WiiMotesFromWiiUse[0], data, 0, sizeof(WiiMoteEmu::EepromData_0));
|
||||
|
||||
|
@ -426,7 +439,8 @@ void Shutdown(void)
|
|||
void InterruptChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||
{
|
||||
//INFO_LOG(CONSOLE, "Real InterruptChannel\n");
|
||||
g_WiiMotes[0]->SendData(_channelID, (const u8*)_pData, _Size);
|
||||
// TODO: Update for multiple Wiimotes
|
||||
g_WiiMotes[0]->SendData(_channelID, (const u8*)_pData, _Size);
|
||||
}
|
||||
|
||||
void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
|
||||
|
@ -442,10 +456,10 @@ void ControlChannel(u16 _channelID, const void* _pData, u32 _Size)
|
|||
void Update()
|
||||
{
|
||||
//INFO_LOG(CONSOLE, "Real Update\n");
|
||||
for (int i = 0; i < g_NumberOfWiiMotes; i++)
|
||||
{
|
||||
g_WiiMotes[i]->Update();
|
||||
}
|
||||
for (int i = 0; i < g_NumberOfWiiMotes; i++)
|
||||
{
|
||||
g_WiiMotes[i]->Update();
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
|
@ -459,8 +473,8 @@ void Update()
|
|||
void *ReadWiimote_ThreadFunc(void* arg)
|
||||
#endif
|
||||
{
|
||||
while (!g_Shutdown)
|
||||
{
|
||||
while (!g_Shutdown)
|
||||
{
|
||||
// We need g_ThreadGoing to do a manual WaitForSingleObject() from the configuration window
|
||||
g_ThreadGoing = true;
|
||||
if(g_Config.bUseRealWiimote && !g_RunTemporary)
|
||||
|
@ -468,11 +482,9 @@ void Update()
|
|||
else
|
||||
ReadWiimote();
|
||||
g_ThreadGoing = false;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
////////////////////
|
||||
|
||||
|
||||
}; // end of namespace
|
||||
|
||||
|
|
Loading…
Reference in New Issue