More minor consistency changes
This commit is contained in:
parent
cb86db7b68
commit
f31b688cf5
|
@ -366,7 +366,7 @@ void EmuThread()
|
||||||
{
|
{
|
||||||
Wiimote::Initialize(s_window_handle, !s_state_filename.empty());
|
Wiimote::Initialize(s_window_handle, !s_state_filename.empty());
|
||||||
|
|
||||||
// Activate wiimotes which don't have source set to "None"
|
// Activate Wiimotes which don't have source set to "None"
|
||||||
for (unsigned int i = 0; i != MAX_BBMOTES; ++i)
|
for (unsigned int i = 0; i != MAX_BBMOTES; ++i)
|
||||||
if (g_wiimote_sources[i])
|
if (g_wiimote_sources[i])
|
||||||
GetUsbPointer()->AccessWiiMote(i | 0x100)->Activate(true);
|
GetUsbPointer()->AccessWiiMote(i | 0x100)->Activate(true);
|
||||||
|
@ -432,7 +432,7 @@ void EmuThread()
|
||||||
// The EmuThread is thus an idle thread, which sleeps while
|
// The EmuThread is thus an idle thread, which sleeps while
|
||||||
// waiting for the program to terminate. Without this extra
|
// waiting for the program to terminate. Without this extra
|
||||||
// thread, the video backend window hangs in single core mode
|
// thread, the video backend window hangs in single core mode
|
||||||
// because noone is pumping messages.
|
// because no one is pumping messages.
|
||||||
Common::SetCurrentThreadName("Emuthread - Idle");
|
Common::SetCurrentThreadName("Emuthread - Idle");
|
||||||
|
|
||||||
// Spawn the CPU+GPU thread
|
// Spawn the CPU+GPU thread
|
||||||
|
|
|
@ -87,7 +87,7 @@ void dsp_write_aram_d3(u16 value)
|
||||||
// Zelda ucode writes a bunch of zeros to ARAM through d3 during
|
// Zelda ucode writes a bunch of zeros to ARAM through d3 during
|
||||||
// initialization. Don't know if it ever does it later, too.
|
// initialization. Don't know if it ever does it later, too.
|
||||||
// Pikmin 2 Wii writes non-stop to 0x10008000-0x1000801f (non-zero values too)
|
// Pikmin 2 Wii writes non-stop to 0x10008000-0x1000801f (non-zero values too)
|
||||||
// Zelda TP WII writes non-stop to 0x10000000-0x1000001f (non-zero values too)
|
// Zelda TP Wii writes non-stop to 0x10000000-0x1000001f (non-zero values too)
|
||||||
u32 Address = (g_dsp.ifx_regs[DSP_ACCAH] << 16) | g_dsp.ifx_regs[DSP_ACCAL];
|
u32 Address = (g_dsp.ifx_regs[DSP_ACCAH] << 16) | g_dsp.ifx_regs[DSP_ACCAL];
|
||||||
|
|
||||||
switch (g_dsp.ifx_regs[DSP_FORMAT])
|
switch (g_dsp.ifx_regs[DSP_FORMAT])
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Ext
|
||||||
|
|
||||||
inline bool IsSameMemArea(u16 a, u16 b)
|
inline bool IsSameMemArea(u16 a, u16 b)
|
||||||
{
|
{
|
||||||
//LM: tested on WII
|
// LM: tested on Wii
|
||||||
if ((a>>10)==(b>>10))
|
if ((a>>10)==(b>>10))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
|
|
|
@ -509,7 +509,7 @@ void DSPEmitter::decrease_addr_reg(int reg)
|
||||||
|
|
||||||
|
|
||||||
// EAX - destination address
|
// EAX - destination address
|
||||||
// ECX - Base of dram
|
// ECX - Base of DRAM
|
||||||
void DSPEmitter::dmem_write(X64Reg value)
|
void DSPEmitter::dmem_write(X64Reg value)
|
||||||
{
|
{
|
||||||
// if (saddr == 0)
|
// if (saddr == 0)
|
||||||
|
|
|
@ -646,7 +646,7 @@ static void Do_ARAM_DMA()
|
||||||
|
|
||||||
// (shuffle2) I still don't believe that this hack is actually needed... :(
|
// (shuffle2) I still don't believe that this hack is actually needed... :(
|
||||||
// Maybe the Wii Sports ucode is processed incorrectly?
|
// Maybe the Wii Sports ucode is processed incorrectly?
|
||||||
// (LM) It just means that DSP reads via '0xffdd' on WII can end up in EXRAM or main RAM
|
// (LM) It just means that DSP reads via '0xffdd' on Wii can end up in EXRAM or main RAM
|
||||||
u8 ReadARAM(u32 _iAddress)
|
u8 ReadARAM(u32 _iAddress)
|
||||||
{
|
{
|
||||||
//NOTICE_LOG(DSPINTERFACE, "ReadARAM 0x%08x", _iAddress);
|
//NOTICE_LOG(DSPINTERFACE, "ReadARAM 0x%08x", _iAddress);
|
||||||
|
@ -666,7 +666,7 @@ u8 ReadARAM(u32 _iAddress)
|
||||||
void WriteARAM(u8 value, u32 _uAddress)
|
void WriteARAM(u8 value, u32 _uAddress)
|
||||||
{
|
{
|
||||||
// NOTICE_LOG(DSPINTERFACE, "WriteARAM 0x%08x", _uAddress);
|
// NOTICE_LOG(DSPINTERFACE, "WriteARAM 0x%08x", _uAddress);
|
||||||
// TODO: verify this on WII
|
// TODO: verify this on Wii
|
||||||
g_ARAM.ptr[_uAddress & g_ARAM.mask] = value;
|
g_ARAM.ptr[_uAddress & g_ARAM.mask] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ void GBAUCode::HandleMail(u32 mail)
|
||||||
u32 pad[3];
|
u32 pad[3];
|
||||||
} sec_params;
|
} sec_params;
|
||||||
|
|
||||||
// 32 bytes from mram addr to dram @ 0
|
// 32 bytes from mram addr to DRAM @ 0
|
||||||
for (int i = 0; i < 8; i++, mramaddr += 4)
|
for (int i = 0; i < 8; i++, mramaddr += 4)
|
||||||
((u32*)&sec_params)[i] = HLEMemory_Read_U32(mramaddr);
|
((u32*)&sec_params)[i] = HLEMemory_Read_U32(mramaddr);
|
||||||
|
|
||||||
|
|
|
@ -66,11 +66,11 @@ UCodeInterface* UCodeFactory(u32 crc, DSPHLE* dsphle, bool wii)
|
||||||
INFO_LOG(DSPHLE, "CRC %08x: Zelda ucode chosen", crc);
|
INFO_LOG(DSPHLE, "CRC %08x: Zelda ucode chosen", crc);
|
||||||
return new ZeldaUCode(dsphle, crc);
|
return new ZeldaUCode(dsphle, crc);
|
||||||
|
|
||||||
// WII CRCs
|
// Wii CRCs
|
||||||
case 0xb7eb9a9c: // Wii Pikmin - PAL
|
case 0xb7eb9a9c: // Wii Pikmin - PAL
|
||||||
case 0xeaeb38cc: // Wii Pikmin 2 - PAL
|
case 0xeaeb38cc: // Wii Pikmin 2 - PAL
|
||||||
case 0x6c3f6f94: // Zelda TP - PAL
|
case 0x6c3f6f94: // Zelda TP - PAL
|
||||||
case 0xd643001f: // Mario Galaxy - PAL / WII DK Jungle Beat - PAL
|
case 0xd643001f: // Mario Galaxy - PAL / Wii DK Jungle Beat - PAL
|
||||||
INFO_LOG(DSPHLE, "CRC %08x: Zelda Wii ucode chosen\n", crc);
|
INFO_LOG(DSPHLE, "CRC %08x: Zelda Wii ucode chosen\n", crc);
|
||||||
return new ZeldaUCode(dsphle, crc);
|
return new ZeldaUCode(dsphle, crc);
|
||||||
|
|
||||||
|
@ -166,12 +166,12 @@ void UCodeInterface::PrepareBootUCode(u32 mail)
|
||||||
if (m_next_ucode.mram_size)
|
if (m_next_ucode.mram_size)
|
||||||
{
|
{
|
||||||
WARN_LOG(DSPHLE,
|
WARN_LOG(DSPHLE,
|
||||||
"Trying to boot new ucode with dram download - not implemented");
|
"Trying to boot new ucode with DRAM download - not implemented");
|
||||||
}
|
}
|
||||||
if (m_next_ucode.dram_size)
|
if (m_next_ucode.dram_size)
|
||||||
{
|
{
|
||||||
WARN_LOG(DSPHLE,
|
WARN_LOG(DSPHLE,
|
||||||
"Trying to boot new ucode with dram upload - not implemented");
|
"Trying to boot new ucode with DRAM upload - not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dsphle->SwapUCode(ector_crc);
|
m_dsphle->SwapUCode(ector_crc);
|
||||||
|
|
|
@ -353,7 +353,7 @@ void ZeldaUCode::HandleMail_NormalVersion(u32 mail)
|
||||||
case 0x0003: // Do nothing - continue normally
|
case 0x0003: // Do nothing - continue normally
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 0x0001: // accepts params to either dma to iram and/or dram (used for hotbooting a new ucode)
|
case 0x0001: // accepts params to either DMA to iram and/or DRAM (used for hotbooting a new ucode)
|
||||||
// TODO find a better way to protect from HLEMixer?
|
// TODO find a better way to protect from HLEMixer?
|
||||||
m_upload_setup_in_progress = true;
|
m_upload_setup_in_progress = true;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -296,7 +296,7 @@ void CEXIIPL::TransferByte(u8& _uByte)
|
||||||
case REGION_WRTC0:
|
case REGION_WRTC0:
|
||||||
case REGION_WRTC1:
|
case REGION_WRTC1:
|
||||||
case REGION_WRTC2:
|
case REGION_WRTC2:
|
||||||
// WII only RTC flags... afaik just the Wii menu initialize it
|
// Wii only RTC flags... afaik just the Wii Menu initialize it
|
||||||
default:
|
default:
|
||||||
if ((m_uAddress >> 6) < ROM_SIZE)
|
if ((m_uAddress >> 6) < ROM_SIZE)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ void Shutdown()
|
||||||
// if plugin isn't initialized, init and load config
|
// if plugin isn't initialized, init and load config
|
||||||
void Initialize(void* const hwnd, bool wait)
|
void Initialize(void* const hwnd, bool wait)
|
||||||
{
|
{
|
||||||
// add 4 wiimotes
|
// add 4 Wiimotes
|
||||||
for (unsigned int i = WIIMOTE_CHAN_0; i<MAX_BBMOTES; ++i)
|
for (unsigned int i = WIIMOTE_CHAN_0; i<MAX_BBMOTES; ++i)
|
||||||
s_config.controllers.push_back(new WiimoteEmu::Wiimote(i));
|
s_config.controllers.push_back(new WiimoteEmu::Wiimote(i));
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ void Wiimote::HidOutputReport(const wm_report* const sr, const bool send_ack)
|
||||||
{
|
{
|
||||||
INFO_LOG(WIIMOTE, "HidOutputReport (page: %i, cid: 0x%02x, wm: 0x%02x)", m_index, m_reporting_channel, sr->wm);
|
INFO_LOG(WIIMOTE, "HidOutputReport (page: %i, cid: 0x%02x, wm: 0x%02x)", m_index, m_reporting_channel, sr->wm);
|
||||||
|
|
||||||
// wiibrew:
|
// WiiBrew:
|
||||||
// In every single Output Report, bit 0 (0x01) of the first byte controls the Rumble feature.
|
// In every single Output Report, bit 0 (0x01) of the first byte controls the Rumble feature.
|
||||||
m_rumble_on = sr->rumble;
|
m_rumble_on = sr->rumble;
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ void Wiimote::RequestStatus(const wm_request_status* const rs)
|
||||||
// status values
|
// status values
|
||||||
*(wm_status_report*)(data + 2) = m_status;
|
*(wm_status_report*)(data + 2) = m_status;
|
||||||
|
|
||||||
// hybrid wiimote stuff
|
// hybrid Wiimote stuff
|
||||||
if (WIIMOTE_SRC_REAL & g_wiimote_sources[m_index] && (m_extension->switch_extension <= 0))
|
if (WIIMOTE_SRC_REAL & g_wiimote_sources[m_index] && (m_extension->switch_extension <= 0))
|
||||||
{
|
{
|
||||||
using namespace WiimoteReal;
|
using namespace WiimoteReal;
|
||||||
|
@ -380,13 +380,13 @@ void Wiimote::ReadData(const wm_read_data* const rd)
|
||||||
// ignore the 0x010000 bit
|
// ignore the 0x010000 bit
|
||||||
address &= 0xFEFFFF;
|
address &= 0xFEFFFF;
|
||||||
|
|
||||||
// hybrid wiimote stuff
|
// hybrid Wiimote stuff
|
||||||
// relay the read data request to real-wiimote
|
// relay the read data request to real-Wiimote
|
||||||
if (WIIMOTE_SRC_REAL & g_wiimote_sources[m_index] && ((0xA4 != (address >> 16)) || (m_extension->switch_extension <= 0)))
|
if (WIIMOTE_SRC_REAL & g_wiimote_sources[m_index] && ((0xA4 != (address >> 16)) || (m_extension->switch_extension <= 0)))
|
||||||
{
|
{
|
||||||
WiimoteReal::InterruptChannel(m_index, m_reporting_channel, ((u8*)rd) - 2, sizeof(wm_read_data) + 2); // hacky
|
WiimoteReal::InterruptChannel(m_index, m_reporting_channel, ((u8*)rd) - 2, sizeof(wm_read_data) + 2); // hacky
|
||||||
|
|
||||||
// don't want emu-wiimote to send reply
|
// don't want emu-Wiimote to send reply
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -338,17 +338,17 @@ bool Wiimote::Step()
|
||||||
m_read_requests.pop();
|
m_read_requests.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
// dont send any other reports
|
// don't send any other reports
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if a status report needs to be sent
|
// check if a status report needs to be sent
|
||||||
// this happens on wiimote sync and when extensions are switched
|
// this happens on Wiimote sync and when extensions are switched
|
||||||
if (m_extension->active_extension != m_extension->switch_extension)
|
if (m_extension->active_extension != m_extension->switch_extension)
|
||||||
{
|
{
|
||||||
RequestStatus();
|
RequestStatus();
|
||||||
|
|
||||||
// Wiibrew: Following a connection or disconnection event on the Extension Port,
|
// WiiBrew: Following a connection or disconnection event on the Extension Port,
|
||||||
// data reporting is disabled and the Data Reporting Mode must be reset before new data can arrive.
|
// data reporting is disabled and the Data Reporting Mode must be reset before new data can arrive.
|
||||||
// after a game receives an unrequested status report,
|
// after a game receives an unrequested status report,
|
||||||
// it expects data reports to stop until it sets the reporting mode again
|
// it expects data reports to stop until it sets the reporting mode again
|
||||||
|
@ -655,7 +655,7 @@ void Wiimote::Update()
|
||||||
if (rptf.ext)
|
if (rptf.ext)
|
||||||
GetExtData(data + rptf.ext);
|
GetExtData(data + rptf.ext);
|
||||||
|
|
||||||
// hybrid wiimote stuff (for now, it's not supported while recording)
|
// hybrid Wiimote stuff (for now, it's not supported while recording)
|
||||||
if (WIIMOTE_SRC_HYBRID == g_wiimote_sources[m_index] && !Movie::IsRecordingInput())
|
if (WIIMOTE_SRC_HYBRID == g_wiimote_sources[m_index] && !Movie::IsRecordingInput())
|
||||||
{
|
{
|
||||||
using namespace WiimoteReal;
|
using namespace WiimoteReal;
|
||||||
|
@ -675,7 +675,7 @@ void Wiimote::Update()
|
||||||
{
|
{
|
||||||
const ReportFeatures& real_rptf = reporting_mode_features[real_data[1] - WM_REPORT_CORE];
|
const ReportFeatures& real_rptf = reporting_mode_features[real_data[1] - WM_REPORT_CORE];
|
||||||
|
|
||||||
// force same report type from real-wiimote
|
// force same report type from real-Wiimote
|
||||||
if (&real_rptf != &rptf)
|
if (&real_rptf != &rptf)
|
||||||
rptf_size = 0;
|
rptf_size = 0;
|
||||||
|
|
||||||
|
@ -723,7 +723,7 @@ void Wiimote::Update()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy over report from real-wiimote
|
// copy over report from real-Wiimote
|
||||||
if (-1 == rptf_size)
|
if (-1 == rptf_size)
|
||||||
{
|
{
|
||||||
std::copy(rpt.begin(), rpt.end(), data);
|
std::copy(rpt.begin(), rpt.end(), data);
|
||||||
|
@ -760,7 +760,7 @@ void Wiimote::ControlChannel(const u16 _channelID, const void* _pData, u32 _Size
|
||||||
// Check for custom communication
|
// Check for custom communication
|
||||||
if (99 == _channelID)
|
if (99 == _channelID)
|
||||||
{
|
{
|
||||||
// wiimote disconnected
|
// Wiimote disconnected
|
||||||
//PanicAlert( "Wiimote Disconnected" );
|
//PanicAlert( "Wiimote Disconnected" );
|
||||||
|
|
||||||
// reset eeprom/register/reporting mode
|
// reset eeprom/register/reporting mode
|
||||||
|
|
|
@ -169,10 +169,10 @@ private:
|
||||||
Extension* m_extension;
|
Extension* m_extension;
|
||||||
ControlGroup* m_options;
|
ControlGroup* m_options;
|
||||||
|
|
||||||
// WiiMote accel data
|
// Wiimote accel data
|
||||||
AccelData m_accel;
|
AccelData m_accel;
|
||||||
|
|
||||||
// wiimote index, 0-3
|
// Wiimote index, 0-3
|
||||||
const u8 m_index;
|
const u8 m_index;
|
||||||
|
|
||||||
double ir_sin, ir_cos; //for the low pass filter
|
double ir_sin, ir_cos; //for the low pass filter
|
||||||
|
|
|
@ -40,7 +40,7 @@ WiimoteScanner::WiimoteScanner()
|
||||||
, device_id(-1)
|
, device_id(-1)
|
||||||
, device_sock(-1)
|
, device_sock(-1)
|
||||||
{
|
{
|
||||||
// Get the id of the first bluetooth device.
|
// Get the id of the first Bluetooth device.
|
||||||
device_id = hci_get_route(nullptr);
|
device_id = hci_get_route(nullptr);
|
||||||
if (device_id < 0)
|
if (device_id < 0)
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,7 @@ WiimoteScanner::WiimoteScanner()
|
||||||
device_sock = hci_open_dev(device_id);
|
device_sock = hci_open_dev(device_id);
|
||||||
if (device_sock < 0)
|
if (device_sock < 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WIIMOTE, "Unable to open bluetooth.");
|
ERROR_LOG(WIIMOTE, "Unable to open Bluetooth.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,15 +81,15 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
|
||||||
auto* scan_infos_ptr = scan_infos;
|
auto* scan_infos_ptr = scan_infos;
|
||||||
found_board = nullptr;
|
found_board = nullptr;
|
||||||
|
|
||||||
// Scan for bluetooth devices
|
// Scan for Bluetooth devices
|
||||||
int const found_devices = hci_inquiry(device_id, wait_len, max_infos, nullptr, &scan_infos_ptr, IREQ_CACHE_FLUSH);
|
int const found_devices = hci_inquiry(device_id, wait_len, max_infos, nullptr, &scan_infos_ptr, IREQ_CACHE_FLUSH);
|
||||||
if (found_devices < 0)
|
if (found_devices < 0)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WIIMOTE, "Error searching for bluetooth devices.");
|
ERROR_LOG(WIIMOTE, "Error searching for Bluetooth devices.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(WIIMOTE, "Found %i bluetooth device(s).", found_devices);
|
DEBUG_LOG(WIIMOTE, "Found %i Bluetooth device(s).", found_devices);
|
||||||
|
|
||||||
// Display discovered devices
|
// Display discovered devices
|
||||||
for (int i = 0; i < found_devices; ++i)
|
for (int i = 0; i < found_devices; ++i)
|
||||||
|
@ -111,7 +111,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
|
||||||
|
|
||||||
// TODO: do this
|
// TODO: do this
|
||||||
|
|
||||||
// Determine if this wiimote has already been found.
|
// Determine if this Wiimote has already been found.
|
||||||
//for (int j = 0; j < MAX_WIIMOTES && new_wiimote; ++j)
|
//for (int j = 0; j < MAX_WIIMOTES && new_wiimote; ++j)
|
||||||
//{
|
//{
|
||||||
// if (wm[j] && bacmp(&scan_infos[i].bdaddr,&wm[j]->bdaddr) == 0)
|
// if (wm[j] && bacmp(&scan_infos[i].bdaddr,&wm[j]->bdaddr) == 0)
|
||||||
|
@ -133,7 +133,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
found_wiimotes.push_back(wm);
|
found_wiimotes.push_back(wm);
|
||||||
NOTICE_LOG(WIIMOTE, "Found wiimote (%s).", bdaddr_str);
|
NOTICE_LOG(WIIMOTE, "Found Wiimote (%s).", bdaddr_str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ WiimoteLinux::~WiimoteLinux()
|
||||||
close(m_wakeup_pipe_r);
|
close(m_wakeup_pipe_r);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to a wiimote with a known address.
|
// Connect to a Wiimote with a known address.
|
||||||
bool WiimoteLinux::ConnectInternal()
|
bool WiimoteLinux::ConnectInternal()
|
||||||
{
|
{
|
||||||
sockaddr_l2 addr = {};
|
sockaddr_l2 addr = {};
|
||||||
|
@ -176,7 +176,7 @@ bool WiimoteLinux::ConnectInternal()
|
||||||
if ((m_cmd_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 ||
|
if ((m_cmd_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 ||
|
||||||
connect(m_cmd_sock, (sockaddr*)&addr, sizeof(addr)) < 0)
|
connect(m_cmd_sock, (sockaddr*)&addr, sizeof(addr)) < 0)
|
||||||
{
|
{
|
||||||
WARN_LOG(WIIMOTE, "Unable to open output socket to wiimote: %s", strerror(errno));
|
WARN_LOG(WIIMOTE, "Unable to open output socket to Wiimote: %s", strerror(errno));
|
||||||
close(m_cmd_sock);
|
close(m_cmd_sock);
|
||||||
m_cmd_sock = -1;
|
m_cmd_sock = -1;
|
||||||
return false;
|
return false;
|
||||||
|
@ -187,7 +187,7 @@ bool WiimoteLinux::ConnectInternal()
|
||||||
if ((m_int_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 ||
|
if ((m_int_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 ||
|
||||||
connect(m_int_sock, (sockaddr*)&addr, sizeof(addr)) < 0)
|
connect(m_int_sock, (sockaddr*)&addr, sizeof(addr)) < 0)
|
||||||
{
|
{
|
||||||
WARN_LOG(WIIMOTE, "Unable to open input socket from wiimote: %s", strerror(errno));
|
WARN_LOG(WIIMOTE, "Unable to open input socket from Wiimote: %s", strerror(errno));
|
||||||
close(m_int_sock);
|
close(m_int_sock);
|
||||||
close(m_cmd_sock);
|
close(m_cmd_sock);
|
||||||
m_int_sock = m_cmd_sock = -1;
|
m_int_sock = m_cmd_sock = -1;
|
||||||
|
@ -234,7 +234,7 @@ int WiimoteLinux::IORead(u8* buf)
|
||||||
|
|
||||||
if (select(m_int_sock + 1, &fds, nullptr, nullptr, nullptr) == -1)
|
if (select(m_int_sock + 1, &fds, nullptr, nullptr, nullptr) == -1)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WIIMOTE, "Unable to select wiimote %i input socket.", m_index + 1);
|
ERROR_LOG(WIIMOTE, "Unable to select Wiimote %i input socket.", m_index + 1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,11 +256,11 @@ int WiimoteLinux::IORead(u8* buf)
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
{
|
{
|
||||||
// Error reading data
|
// Error reading data
|
||||||
ERROR_LOG(WIIMOTE, "Receiving data from wiimote %i.", m_index + 1);
|
ERROR_LOG(WIIMOTE, "Receiving data from Wiimote %i.", m_index + 1);
|
||||||
|
|
||||||
if (errno == ENOTCONN)
|
if (errno == ENOTCONN)
|
||||||
{
|
{
|
||||||
// This can happen if the bluetooth dongle is disconnected
|
// This can happen if the Bluetooth dongle is disconnected
|
||||||
ERROR_LOG(WIIMOTE, "Bluetooth appears to be disconnected. "
|
ERROR_LOG(WIIMOTE, "Bluetooth appears to be disconnected. "
|
||||||
"Wiimote %i will be disconnected.", m_index + 1);
|
"Wiimote %i will be disconnected.", m_index + 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ inline void init_lib()
|
||||||
if (!load_hid() || !load_bthprops())
|
if (!load_hid() || !load_bthprops())
|
||||||
{
|
{
|
||||||
NOTICE_LOG(WIIMOTE,
|
NOTICE_LOG(WIIMOTE,
|
||||||
"Failed to load bluetooth support libraries, wiimotes will not function");
|
"Failed to load Bluetooth support libraries, Wiimotes will not function");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,11 +202,11 @@ protected:
|
||||||
int IOWrite(u8 const* buf, size_t len) override;
|
int IOWrite(u8 const* buf, size_t len) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::basic_string<TCHAR> m_devicepath; // Unique wiimote reference
|
std::basic_string<TCHAR> m_devicepath; // Unique Wiimote reference
|
||||||
HANDLE m_dev_handle; // HID handle
|
HANDLE m_dev_handle; // HID handle
|
||||||
OVERLAPPED m_hid_overlap_read; // Overlap handles
|
OVERLAPPED m_hid_overlap_read; // Overlap handles
|
||||||
OVERLAPPED m_hid_overlap_write;
|
OVERLAPPED m_hid_overlap_write;
|
||||||
enum win_bt_stack_t m_stack; // Type of bluetooth stack to use
|
enum win_bt_stack_t m_stack; // Type of Bluetooth stack to use
|
||||||
};
|
};
|
||||||
|
|
||||||
int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, size_t len, DWORD* written);
|
int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stack_t &stack, const u8* buf, size_t len, DWORD* written);
|
||||||
|
@ -250,15 +250,15 @@ void WiimoteScanner::Update()
|
||||||
});
|
});
|
||||||
|
|
||||||
// Some hacks that allows disconnects to be detected before connections are handled
|
// Some hacks that allows disconnects to be detected before connections are handled
|
||||||
// workaround for wiimote 1 moving to slot 2 on temporary disconnect
|
// workaround for Wiimote 1 moving to slot 2 on temporary disconnect
|
||||||
if (forgot_some)
|
if (forgot_some)
|
||||||
SLEEP(100);
|
SLEEP(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find and connect wiimotes.
|
// Find and connect Wiimotes.
|
||||||
// Does not replace already found wiimotes even if they are disconnected.
|
// Does not replace already found Wiimotes even if they are disconnected.
|
||||||
// wm is an array of max_wiimotes wiimotes
|
// wm is an array of max_wiimotes Wiimotes
|
||||||
// Returns the total number of found and connected wiimotes.
|
// Returns the total number of found and connected Wiimotes.
|
||||||
void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimote* & found_board)
|
void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimote* & found_board)
|
||||||
{
|
{
|
||||||
if (!s_loaded_ok)
|
if (!s_loaded_ok)
|
||||||
|
@ -359,7 +359,7 @@ int CheckDeviceType_Read(HANDLE &dev_handle, u8* buf, int attempts)
|
||||||
|
|
||||||
// A convoluted way of checking if a device is a Wii Balance Board and if it is a connectible Wiimote.
|
// A convoluted way of checking if a device is a Wii Balance Board and if it is a connectible Wiimote.
|
||||||
// Because nothing on Windows should be easy.
|
// Because nothing on Windows should be easy.
|
||||||
// (We can't seem to easily identify the bluetooth device an HID device belongs to...)
|
// (We can't seem to easily identify the Bluetooth device an HID device belongs to...)
|
||||||
void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool &real_wiimote, bool &is_bb)
|
void WiimoteScanner::CheckDeviceType(std::basic_string<TCHAR> &devicepath, bool &real_wiimote, bool &is_bb)
|
||||||
{
|
{
|
||||||
real_wiimote = false;
|
real_wiimote = false;
|
||||||
|
@ -519,7 +519,7 @@ bool WiimoteScanner::IsReady() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to a wiimote with a known device path.
|
// Connect to a Wiimote with a known device path.
|
||||||
bool WiimoteWindows::ConnectInternal()
|
bool WiimoteWindows::ConnectInternal()
|
||||||
{
|
{
|
||||||
if (IsConnected())
|
if (IsConnected())
|
||||||
|
@ -532,8 +532,8 @@ bool WiimoteWindows::ConnectInternal()
|
||||||
|
|
||||||
auto const open_flags = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
auto const open_flags = FILE_SHARE_READ | FILE_SHARE_WRITE;
|
||||||
#else
|
#else
|
||||||
// Having no FILE_SHARE_WRITE disallows us from connecting to the same wiimote twice.
|
// Having no FILE_SHARE_WRITE disallows us from connecting to the same Wiimote twice.
|
||||||
// (And disallows using wiimotes in use by other programs)
|
// (And disallows using Wiimotes in use by other programs)
|
||||||
// This is what "WiiYourself" does.
|
// This is what "WiiYourself" does.
|
||||||
// Apparently this doesn't work for everyone. It might be their fault.
|
// Apparently this doesn't work for everyone. It might be their fault.
|
||||||
auto const open_flags = FILE_SHARE_READ;
|
auto const open_flags = FILE_SHARE_READ;
|
||||||
|
@ -727,7 +727,7 @@ int _IOWrite(HANDLE &dev_handle, OVERLAPPED &hid_overlap_write, enum win_bt_stac
|
||||||
NOTICE_LOG(WIIMOTE, "WiimoteIOWrite[MSBT_STACK_MS]: Unable to send data to the Wiimote");
|
NOTICE_LOG(WIIMOTE, "WiimoteIOWrite[MSBT_STACK_MS]: Unable to send data to the Wiimote");
|
||||||
}
|
}
|
||||||
else if (err != 0x1F) // Some third-party adapters (DolphinBar) use this
|
else if (err != 0x1F) // Some third-party adapters (DolphinBar) use this
|
||||||
// error code to signal the absence of a WiiMote
|
// error code to signal the absence of a Wiimote
|
||||||
// linked to the HID device.
|
// linked to the HID device.
|
||||||
{
|
{
|
||||||
WARN_LOG(WIIMOTE, "IOWrite[MSBT_STACK_MS]: ERROR: %08x", err);
|
WARN_LOG(WIIMOTE, "IOWrite[MSBT_STACK_MS]: ERROR: %08x", err);
|
||||||
|
@ -795,7 +795,7 @@ int WiimoteWindows::IOWrite(const u8* buf, size_t len)
|
||||||
return _IOWrite(m_dev_handle, m_hid_overlap_write, m_stack, buf, len, nullptr);
|
return _IOWrite(m_dev_handle, m_hid_overlap_write, m_stack, buf, len, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// invokes callback for each found wiimote bluetooth device
|
// invokes callback for each found Wiimote Bluetooth device
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ProcessWiimotes(bool new_scan, T& callback)
|
void ProcessWiimotes(bool new_scan, T& callback)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,7 +68,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
|
||||||
bth = [[IOBluetoothHostController alloc] init];
|
bth = [[IOBluetoothHostController alloc] init];
|
||||||
if ([bth addressAsString] == nil)
|
if ([bth addressAsString] == nil)
|
||||||
{
|
{
|
||||||
WARN_LOG(WIIMOTE, "No bluetooth host controller");
|
WARN_LOG(WIIMOTE, "No Bluetooth host controller");
|
||||||
[bth release];
|
[bth release];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
|
||||||
|
|
||||||
if ([bti start] != kIOReturnSuccess)
|
if ([bti start] != kIOReturnSuccess)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WIIMOTE, "Unable to do bluetooth discovery");
|
ERROR_LOG(WIIMOTE, "Unable to do Bluetooth discovery");
|
||||||
[bth release];
|
[bth release];
|
||||||
[sbt release];
|
[sbt release];
|
||||||
return;
|
return;
|
||||||
|
@ -96,7 +96,7 @@ void WiimoteScanner::FindWiimotes(std::vector<Wiimote*> & found_wiimotes, Wiimot
|
||||||
int found_devices = [[bti foundDevices] count];
|
int found_devices = [[bti foundDevices] count];
|
||||||
|
|
||||||
if (found_devices)
|
if (found_devices)
|
||||||
NOTICE_LOG(WIIMOTE, "Found %i bluetooth devices", found_devices);
|
NOTICE_LOG(WIIMOTE, "Found %i Bluetooth devices", found_devices);
|
||||||
|
|
||||||
en = [[bti foundDevices] objectEnumerator];
|
en = [[bti foundDevices] objectEnumerator];
|
||||||
for (int i = 0; i < found_devices; i++)
|
for (int i = 0; i < found_devices; i++)
|
||||||
|
@ -149,7 +149,7 @@ WiimoteDarwin::~WiimoteDarwin()
|
||||||
DisablePowerAssertionInternal();
|
DisablePowerAssertionInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect to a wiimote with a known address.
|
// Connect to a Wiimote with a known address.
|
||||||
bool WiimoteDarwin::ConnectInternal()
|
bool WiimoteDarwin::ConnectInternal()
|
||||||
{
|
{
|
||||||
if (IsConnected())
|
if (IsConnected())
|
||||||
|
@ -162,7 +162,7 @@ bool WiimoteDarwin::ConnectInternal()
|
||||||
IOReturn ret = [m_btd openConnection];
|
IOReturn ret = [m_btd openConnection];
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WIIMOTE, "Unable to open Bluetooth connection to wiimote %i: %x",
|
ERROR_LOG(WIIMOTE, "Unable to open Bluetooth connection to Wiimote %i: %x",
|
||||||
m_index + 1, ret);
|
m_index + 1, ret);
|
||||||
[cbt release];
|
[cbt release];
|
||||||
return false;
|
return false;
|
||||||
|
@ -172,7 +172,7 @@ bool WiimoteDarwin::ConnectInternal()
|
||||||
withPSM: kBluetoothL2CAPPSMHIDControl delegate: cbt];
|
withPSM: kBluetoothL2CAPPSMHIDControl delegate: cbt];
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
ERROR_LOG(WIIMOTE, "Unable to open control channel for wiimote %i: %x",
|
ERROR_LOG(WIIMOTE, "Unable to open control channel for Wiimote %i: %x",
|
||||||
m_index + 1, ret);
|
m_index + 1, ret);
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
@ -187,13 +187,13 @@ bool WiimoteDarwin::ConnectInternal()
|
||||||
withPSM: kBluetoothL2CAPPSMHIDInterrupt delegate: cbt];
|
withPSM: kBluetoothL2CAPPSMHIDInterrupt delegate: cbt];
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
WARN_LOG(WIIMOTE, "Unable to open interrupt channel for wiimote %i: %x",
|
WARN_LOG(WIIMOTE, "Unable to open interrupt channel for Wiimote %i: %x",
|
||||||
m_index + 1, ret);
|
m_index + 1, ret);
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
[m_ichan retain];
|
[m_ichan retain];
|
||||||
|
|
||||||
NOTICE_LOG(WIIMOTE, "Connected to wiimote %i at %s",
|
NOTICE_LOG(WIIMOTE, "Connected to Wiimote %i at %s",
|
||||||
m_index + 1, [[m_btd addressString] UTF8String]);
|
m_index + 1, [[m_btd addressString] UTF8String]);
|
||||||
|
|
||||||
m_connected = true;
|
m_connected = true;
|
||||||
|
@ -210,7 +210,7 @@ bad:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disconnect a wiimote.
|
// Disconnect a Wiimote.
|
||||||
void WiimoteDarwin::DisconnectInternal()
|
void WiimoteDarwin::DisconnectInternal()
|
||||||
{
|
{
|
||||||
[m_ichan closeChannel];
|
[m_ichan closeChannel];
|
||||||
|
@ -226,7 +226,7 @@ void WiimoteDarwin::DisconnectInternal()
|
||||||
if (!IsConnected())
|
if (!IsConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NOTICE_LOG(WIIMOTE, "Disconnecting wiimote %i", m_index + 1);
|
NOTICE_LOG(WIIMOTE, "Disconnecting Wiimote %i", m_index + 1);
|
||||||
|
|
||||||
m_connected = false;
|
m_connected = false;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ void WiimoteDarwin::DisablePowerAssertionInternal()
|
||||||
- (void) deviceInquiryDeviceFound: (IOBluetoothDeviceInquiry *) sender
|
- (void) deviceInquiryDeviceFound: (IOBluetoothDeviceInquiry *) sender
|
||||||
device: (IOBluetoothDevice *) device
|
device: (IOBluetoothDevice *) device
|
||||||
{
|
{
|
||||||
NOTICE_LOG(WIIMOTE, "Discovered bluetooth device at %s: %s",
|
NOTICE_LOG(WIIMOTE, "Discovered Bluetooth device at %s: %s",
|
||||||
[[device addressString] UTF8String],
|
[[device addressString] UTF8String],
|
||||||
[[device name] UTF8String]);
|
[[device name] UTF8String]);
|
||||||
|
|
||||||
|
@ -330,18 +330,18 @@ void WiimoteDarwin::DisablePowerAssertionInternal()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wm == nullptr) {
|
if (wm == nullptr) {
|
||||||
ERROR_LOG(WIIMOTE, "Received packet for unknown wiimote");
|
ERROR_LOG(WIIMOTE, "Received packet for unknown Wiimote");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (length > MAX_PAYLOAD) {
|
if (length > MAX_PAYLOAD) {
|
||||||
WARN_LOG(WIIMOTE, "Dropping packet for wiimote %i, too large",
|
WARN_LOG(WIIMOTE, "Dropping packet for Wiimote %i, too large",
|
||||||
wm->m_index + 1);
|
wm->m_index + 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wm->m_inputlen != -1) {
|
if (wm->m_inputlen != -1) {
|
||||||
WARN_LOG(WIIMOTE, "Dropping packet for wiimote %i, queue full",
|
WARN_LOG(WIIMOTE, "Dropping packet for Wiimote %i, queue full",
|
||||||
wm->m_index + 1);
|
wm->m_index + 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -369,11 +369,11 @@ void WiimoteDarwin::DisablePowerAssertionInternal()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wm == nullptr) {
|
if (wm == nullptr) {
|
||||||
ERROR_LOG(WIIMOTE, "Channel for unknown wiimote was closed");
|
ERROR_LOG(WIIMOTE, "Channel for unknown Wiimote was closed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
WARN_LOG(WIIMOTE, "Lost channel to wiimote %i", wm->m_index + 1);
|
WARN_LOG(WIIMOTE, "Lost channel to Wiimote %i", wm->m_index + 1);
|
||||||
|
|
||||||
wm->DisconnectInternal();
|
wm->DisconnectInternal();
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
|
|
||||||
// connecting and disconnecting from physical devices
|
// connecting and disconnecting from physical devices
|
||||||
// (using address inserted by FindWiimotes)
|
// (using address inserted by FindWiimotes)
|
||||||
// these are called from the wiimote's thread.
|
// these are called from the Wiimote's thread.
|
||||||
virtual bool ConnectInternal() = 0;
|
virtual bool ConnectInternal() = 0;
|
||||||
virtual void DisconnectInternal() = 0;
|
virtual void DisconnectInternal() = 0;
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ public:
|
||||||
|
|
||||||
void FindWiimotes(std::vector<Wiimote*>&, Wiimote*&);
|
void FindWiimotes(std::vector<Wiimote*>&, Wiimote*&);
|
||||||
|
|
||||||
// function called when not looking for more wiimotes
|
// function called when not looking for more Wiimotes
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -81,8 +81,8 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::CWII_IPC_HLE_Device_usb_oh1_57e_305(u32 _De
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// save now so that when games load sysconf file it includes the new wiimotes
|
// save now so that when games load sysconf file it includes the new Wiimotes
|
||||||
// and the correct order for connected wiimotes
|
// and the correct order for connected Wiimotes
|
||||||
if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)) || !SConfig::GetInstance().m_SYSCONF->Save())
|
if (!SConfig::GetInstance().m_SYSCONF->SetArrayData("BT.DINF", (u8*)&BT_DINF, sizeof(_conf_pads)) || !SConfig::GetInstance().m_SYSCONF->Save())
|
||||||
PanicAlertT("Failed to write BT.DINF to SYSCONF");
|
PanicAlertT("Failed to write BT.DINF to SYSCONF");
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
|
||||||
packet_transferred = true;
|
packet_transferred = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We wait for ScanEnable to be sent from the bt stack through HCI_CMD_WRITE_SCAN_ENABLE
|
// We wait for ScanEnable to be sent from the Bluetooth stack through HCI_CMD_WRITE_SCAN_ENABLE
|
||||||
// before we initiate the connection.
|
// before we initiate the connection.
|
||||||
//
|
//
|
||||||
// FiRES: TODO find a better way to do this
|
// FiRES: TODO find a better way to do this
|
||||||
|
@ -1857,8 +1857,8 @@ CWII_IPC_HLE_WiiMote* CWII_IPC_HLE_Device_usb_oh1_57e_305::AccessWiiMote(u16 _Co
|
||||||
return &wiimote;
|
return &wiimote;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR_LOG(WII_IPC_WIIMOTE, "Can't find WiiMote by connection handle %02x", _ConnectionHandle);
|
ERROR_LOG(WII_IPC_WIIMOTE, "Can't find Wiimote by connection handle %02x", _ConnectionHandle);
|
||||||
PanicAlertT("Can't find WiiMote by connection handle %02x", _ConnectionHandle);
|
PanicAlertT("Can't find Wiimote by connection handle %02x", _ConnectionHandle);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct SQueuedEvent
|
||||||
// Important to remember that this class is for /dev/usb/oh1/57e/305 ONLY
|
// Important to remember that this class is for /dev/usb/oh1/57e/305 ONLY
|
||||||
// /dev/usb/oh1 -> internal usb bus
|
// /dev/usb/oh1 -> internal usb bus
|
||||||
// 57e/305 -> VendorID/ProductID of device on usb bus
|
// 57e/305 -> VendorID/ProductID of device on usb bus
|
||||||
// This device is ONLY the internal bluetooth module (based on BCM2045 chip)
|
// This device is ONLY the internal Bluetooth module (based on BCM2045 chip)
|
||||||
class CWII_IPC_HLE_Device_usb_oh1_57e_305 : public IWII_IPC_HLE_Device
|
class CWII_IPC_HLE_Device_usb_oh1_57e_305 : public IWII_IPC_HLE_Device
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -60,12 +60,12 @@ public:
|
||||||
|
|
||||||
static void EnqueueReply(u32 CommandAddress);
|
static void EnqueueReply(u32 CommandAddress);
|
||||||
|
|
||||||
// Send ACL data back to bt stack
|
// Send ACL data back to Bluetooth stack
|
||||||
void SendACLPacket(u16 _ConnectionHandle, u8* _pData, u32 _Size);
|
void SendACLPacket(u16 _ConnectionHandle, u8* _pData, u32 _Size);
|
||||||
|
|
||||||
bool RemoteDisconnect(u16 _connectionHandle);
|
bool RemoteDisconnect(u16 _connectionHandle);
|
||||||
|
|
||||||
// hack for wiimote plugin
|
// hack for Wiimote plugin
|
||||||
public:
|
public:
|
||||||
std::vector<CWII_IPC_HLE_WiiMote> m_WiiMotes;
|
std::vector<CWII_IPC_HLE_WiiMote> m_WiiMotes;
|
||||||
CWII_IPC_HLE_WiiMote* AccessWiiMote(const bdaddr_t& _rAddr);
|
CWII_IPC_HLE_WiiMote* AccessWiiMote(const bdaddr_t& _rAddr);
|
||||||
|
|
|
@ -546,7 +546,7 @@ void CWII_IPC_HLE_WiiMote::ReceiveDisconnectionReq(u8 _Ident, u8* _pData, u32 _S
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
||||||
// We assume WiiMote is always connected
|
// We assume Wiimote is always connected
|
||||||
void CWII_IPC_HLE_WiiMote::SendConnectionRequest(u16 scid, u16 psm)
|
void CWII_IPC_HLE_WiiMote::SendConnectionRequest(u16 scid, u16 psm)
|
||||||
{
|
{
|
||||||
// create the channel
|
// create the channel
|
||||||
|
@ -604,7 +604,7 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
|
||||||
// (shuffle2) currently we end up not appending options. this is because we don't
|
// (shuffle2) currently we end up not appending options. this is because we don't
|
||||||
// negotiate after trying to set MTU = 0 fails (stack will respond with
|
// negotiate after trying to set MTU = 0 fails (stack will respond with
|
||||||
// "configuration failed" msg...). This is still fine, we'll just use whatever the
|
// "configuration failed" msg...). This is still fine, we'll just use whatever the
|
||||||
// bt stack defaults to.
|
// Bluetooth stack defaults to.
|
||||||
if (MTU || rChannel.MTU)
|
if (MTU || rChannel.MTU)
|
||||||
{
|
{
|
||||||
if (MTU == 0)
|
if (MTU == 0)
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
void ResetChannels();
|
void ResetChannels();
|
||||||
void Activate(bool ready);
|
void Activate(bool ready);
|
||||||
void ExecuteL2capCmd(u8* _pData, u32 _Size); // From CPU
|
void ExecuteL2capCmd(u8* _pData, u32 _Size); // From CPU
|
||||||
void ReceiveL2capData(u16 scid, const void* _pData, u32 _Size); // From wiimote
|
void ReceiveL2capData(u16 scid, const void* _pData, u32 _Size); // From Wiimote
|
||||||
|
|
||||||
int NetPlay_GetWiimoteNum(int _number);
|
int NetPlay_GetWiimoteNum(int _number);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Added some info from bluetooth.h
|
// Added some info from bluetooth.h
|
||||||
// All packet headers have had the packet type field removed. This is because
|
// All packet headers have had the packet type field removed. This is because
|
||||||
// IOS adds the packet type to the header, and strips it before returning the
|
// IOS adds the packet type to the header, and strips it before returning the
|
||||||
// packet to the overlying bt stack.
|
// packet to the overlying Bluetooth stack.
|
||||||
|
|
||||||
/* $NetBSD: hci.h,v 1.33 2009/09/11 18:35:50 plunky Exp $ */
|
/* $NetBSD: hci.h,v 1.33 2009/09/11 18:35:50 plunky Exp $ */
|
||||||
|
|
||||||
|
|
|
@ -213,7 +213,7 @@ unsigned int NetPlayClient::OnData(sf::Packet& packet)
|
||||||
delete[] data;
|
delete[] data;
|
||||||
|
|
||||||
// trusting server for good map value (>=0 && <4)
|
// trusting server for good map value (>=0 && <4)
|
||||||
// add to wiimote buffer
|
// add to Wiimote buffer
|
||||||
m_wiimote_buffer[(unsigned)map].Push(nw);
|
m_wiimote_buffer[(unsigned)map].Push(nw);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -620,9 +620,9 @@ bool NetPlayClient::WiimoteUpdate(int _number, u8* data, const u8 size)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lkp(m_crit.players);
|
std::lock_guard<std::recursive_mutex> lkp(m_crit.players);
|
||||||
|
|
||||||
// in game mapping for this local wiimote
|
// in game mapping for this local Wiimote
|
||||||
unsigned int in_game_num = LocalWiimoteToInGameWiimote(_number);
|
unsigned int in_game_num = LocalWiimoteToInGameWiimote(_number);
|
||||||
// does this local wiimote map in game?
|
// does this local Wiimote map in game?
|
||||||
if (in_game_num < 4)
|
if (in_game_num < 4)
|
||||||
{
|
{
|
||||||
if (previousSize[in_game_num] == size)
|
if (previousSize[in_game_num] == size)
|
||||||
|
|
|
@ -416,7 +416,7 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
|
||||||
|
|
||||||
case NP_MSG_WIIMOTE_DATA :
|
case NP_MSG_WIIMOTE_DATA :
|
||||||
{
|
{
|
||||||
// if this is wiimote data from the last game still being received, ignore it
|
// if this is Wiimote data from the last game still being received, ignore it
|
||||||
if (player.current_game != m_current_game)
|
if (player.current_game != m_current_game)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ IVolume::ECountry CountrySwitch(u8 CountryCode)
|
||||||
// NTSC
|
// NTSC
|
||||||
case 'E':
|
case 'E':
|
||||||
case 'N': // Japanese import to USA and other NTSC regions
|
case 'N': // Japanese import to USA and other NTSC regions
|
||||||
case 'Z': // Prince Of Persia - The Forgotten Sands (WII)
|
case 'Z': // Prince of Persia - The Forgotten Sands (Wii)
|
||||||
case 'B': // Ufouria: The Saga (Virtual Console)
|
case 'B': // Ufouria: The Saga (Virtual Console)
|
||||||
return IVolume::COUNTRY_USA;
|
return IVolume::COUNTRY_USA;
|
||||||
|
|
||||||
|
|
|
@ -290,8 +290,8 @@ wxStaticBoxSizer* ControllerConfigDiag::CreateRealWiimoteSizer()
|
||||||
wxBoxSizer* const real_wiimotes_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer* const real_wiimotes_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
if (!WiimoteReal::g_wiimote_scanner.IsReady())
|
if (!WiimoteReal::g_wiimote_scanner.IsReady())
|
||||||
real_wiimotes_group->Add(new wxStaticText(this, wxID_ANY, _("A supported bluetooth device could not be found.\n"
|
real_wiimotes_group->Add(new wxStaticText(this, wxID_ANY, _("A supported Bluetooth device could not be found.\n"
|
||||||
"You must manually connect your wiimotes.")), 0, wxALIGN_CENTER | wxALL, 5);
|
"You must manually connect your Wiimotes.")), 0, wxALIGN_CENTER | wxALL, 5);
|
||||||
|
|
||||||
wxCheckBox* const continuous_scanning = new wxCheckBox(this, wxID_ANY, _("Continuous Scanning"));
|
wxCheckBox* const continuous_scanning = new wxCheckBox(this, wxID_ANY, _("Continuous Scanning"));
|
||||||
continuous_scanning->Bind(wxEVT_CHECKBOX, &ControllerConfigDiag::OnContinuousScanning, this);
|
continuous_scanning->Bind(wxEVT_CHECKBOX, &ControllerConfigDiag::OnContinuousScanning, this);
|
||||||
|
|
|
@ -1190,7 +1190,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||||
// On OS X, we claim all keyboard events while
|
// On OS X, we claim all keyboard events while
|
||||||
// emulation is running to avoid wxWidgets sounding
|
// emulation is running to avoid wxWidgets sounding
|
||||||
// the system beep for unhandled key events when
|
// the system beep for unhandled key events when
|
||||||
// receiving pad/wiimote keypresses which take an
|
// receiving pad/Wiimote keypresses which take an
|
||||||
// entirely different path through the HID subsystem.
|
// entirely different path through the HID subsystem.
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
// On other platforms, we leave the key event alone
|
// On other platforms, we leave the key event alone
|
||||||
|
@ -1200,7 +1200,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Actually perform the wiimote connection or disconnection
|
// Actually perform the Wiimote connection or disconnection
|
||||||
if (WiimoteId >= 0)
|
if (WiimoteId >= 0)
|
||||||
{
|
{
|
||||||
wxCommandEvent evt;
|
wxCommandEvent evt;
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#define PREVIEW_UPDATE_TIME 25
|
#define PREVIEW_UPDATE_TIME 25
|
||||||
#define DEFAULT_HIGH_VALUE 100
|
#define DEFAULT_HIGH_VALUE 100
|
||||||
|
|
||||||
// might have to change this setup for wiimote
|
// might have to change this setup for Wiimote
|
||||||
#define PROFILES_PATH "Profiles/"
|
#define PROFILES_PATH "Profiles/"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
|
@ -125,7 +125,7 @@ NetPlaySetupDiag::NetPlaySetupDiag(wxWindow* const parent, const CGameListCtrl*
|
||||||
"Netplay will only work with the following settings:\n"
|
"Netplay will only work with the following settings:\n"
|
||||||
" - DSP Emulator Engine Must be the same on all computers!\n"
|
" - DSP Emulator Engine Must be the same on all computers!\n"
|
||||||
" - DSP on Dedicated Thread [OFF]\n"
|
" - DSP on Dedicated Thread [OFF]\n"
|
||||||
" - Manually set the extensions for each wiimote\n"
|
" - Manually set the extensions for each Wiimote\n"
|
||||||
"\n"
|
"\n"
|
||||||
"All players should use the same Dolphin version and settings.\n"
|
"All players should use the same Dolphin version and settings.\n"
|
||||||
"All memory cards must be identical between players or disabled.\n"
|
"All memory cards must be identical between players or disabled.\n"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
// DSPCR bits
|
// DSPCR bits
|
||||||
#define DSPCR_DSPRESET 0x0800 // Reset DSP
|
#define DSPCR_DSPRESET 0x0800 // Reset DSP
|
||||||
#define DSPCR_ARDMA 0x0200 // ARAM dma in progress, if set
|
#define DSPCR_ARDMA 0x0200 // ARAM DMA in progress, if set
|
||||||
#define DSPCR_DSPINTMSK 0x0100 // * interrupt mask (RW)
|
#define DSPCR_DSPINTMSK 0x0100 // * interrupt mask (RW)
|
||||||
#define DSPCR_DSPINT 0x0080 // * interrupt active (RWC)
|
#define DSPCR_DSPINT 0x0080 // * interrupt active (RWC)
|
||||||
#define DSPCR_ARINTMSK 0x0040
|
#define DSPCR_ARINTMSK 0x0040
|
||||||
|
|
|
@ -53,13 +53,13 @@ call 0x8078
|
||||||
lrs $AX0.L, @CMBL
|
lrs $AX0.L, @CMBL
|
||||||
andi $AC0.M, #0x0fff
|
andi $AC0.M, #0x0fff
|
||||||
mrr $AX0.H, $AC0.M
|
mrr $AX0.H, $AC0.M
|
||||||
lri $AX1.H, #0x0000 ; DSP-dram addr
|
lri $AX1.H, #0x0000 ; DSP-DRAM addr
|
||||||
lri $AX1.L, #0x0020 ; length (32 bytes = 16 words, word 9 and 10 are addr where result should DMA'd to in main mem)
|
lri $AX1.L, #0x0020 ; length (32 bytes = 16 words, word 9 and 10 are addr where result should DMA'd to in main mem)
|
||||||
lri $IX3, #0x0000 ; there will be no ucode/iram upload
|
lri $IX3, #0x0000 ; there will be no ucode/iram upload
|
||||||
lri $AR0, #do_main ; return addr after dram upload
|
lri $AR0, #do_main ; return addr after DRAM upload
|
||||||
jmp 0x80bc ; DRAM upload !!
|
jmp 0x80bc ; DRAM upload !!
|
||||||
; $AX0.H-$AX0.L - CPU(PPC) addr = mail & 0x0fffffff
|
; $AX0.H-$AX0.L - CPU(PPC) addr = mail & 0x0fffffff
|
||||||
; upload data from mainmem to DSP dram and jump to 0x41 after that
|
; upload data from mainmem to DSP DRAM and jump to 0x41 after that
|
||||||
|
|
||||||
; ucode addr 0x0041
|
; ucode addr 0x0041
|
||||||
do_main:
|
do_main:
|
||||||
|
@ -127,7 +127,7 @@ jmp 0x80b5 ; BootUcode()
|
||||||
halt
|
halt
|
||||||
|
|
||||||
|
|
||||||
; does some crazy stuff with data at dram @0x3/0x5/0x6/0x7 with help of some values from drom :)
|
; does some crazy stuff with data at DRAM @0x3/0x5/0x6/0x7 with help of some values from drom :)
|
||||||
; result is @0x22,@0x23 and written back to main memory to dmem-0x08:dmem-0x09
|
; result is @0x22,@0x23 and written back to main memory to dmem-0x08:dmem-0x09
|
||||||
BigCrazyFunction:
|
BigCrazyFunction:
|
||||||
; {
|
; {
|
||||||
|
@ -586,9 +586,9 @@ lri $AX1.H, #0x0020 ; DSP addr
|
||||||
call send_back
|
call send_back
|
||||||
lri $AX1.L, #0x0008 ; length
|
lri $AX1.L, #0x0008 ; length
|
||||||
call send_back
|
call send_back
|
||||||
lri $IX3, #0x0000 ; there will be no iram dma
|
lri $IX3, #0x0000 ; there will be no iram DMA
|
||||||
call send_back
|
call send_back
|
||||||
call 0x808b ; dram->CPU <<<--- important!!
|
call 0x808b ; DRAM->CPU <<<--- important!!
|
||||||
call send_back
|
call send_back
|
||||||
ret
|
ret
|
||||||
; }
|
; }
|
||||||
|
|
|
@ -353,7 +353,7 @@ void handle_dsp_mail(void)
|
||||||
}
|
}
|
||||||
else if (mail == 0x8888dead)
|
else if (mail == 0x8888dead)
|
||||||
{
|
{
|
||||||
// Send memory dump (DSP dram from someone's cube?)
|
// Send memory dump (DSP DRAM from someone's GameCube?)
|
||||||
// not really sure why this is important - I guess just to try to keep tests predictable
|
// not really sure why this is important - I guess just to try to keep tests predictable
|
||||||
u16* tmpBuf = (u16 *)MEM_VIRTUAL_TO_PHYSICAL(mem_dump);
|
u16* tmpBuf = (u16 *)MEM_VIRTUAL_TO_PHYSICAL(mem_dump);
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ void handle_dsp_mail(void)
|
||||||
}
|
}
|
||||||
else if (mail == 0x8888beef)
|
else if (mail == 0x8888beef)
|
||||||
{
|
{
|
||||||
// Provide register base to DSP (if using dsp_base.inc, it will dma them to the correct place)
|
// Provide register base to DSP (if using dsp_base.inc, it will DMA them to the correct place)
|
||||||
while (real_dsp.CheckMailTo());
|
while (real_dsp.CheckMailTo());
|
||||||
real_dsp.SendMailTo((u32)dspbufP);
|
real_dsp.SendMailTo((u32)dspbufP);
|
||||||
while (real_dsp.CheckMailTo());
|
while (real_dsp.CheckMailTo());
|
||||||
|
@ -385,14 +385,14 @@ void handle_dsp_mail(void)
|
||||||
// ROM dumping mails
|
// ROM dumping mails
|
||||||
else if (mail == 0x8888c0de)
|
else if (mail == 0x8888c0de)
|
||||||
{
|
{
|
||||||
// DSP has copied irom to its dram...send address so it can dma it back
|
// DSP has copied irom to its DRAM...send address so it can dma it back
|
||||||
while (real_dsp.CheckMailTo());
|
while (real_dsp.CheckMailTo());
|
||||||
real_dsp.SendMailTo((u32)dspbufP);
|
real_dsp.SendMailTo((u32)dspbufP);
|
||||||
while (real_dsp.CheckMailTo());
|
while (real_dsp.CheckMailTo());
|
||||||
}
|
}
|
||||||
else if (mail == 0x8888da7a)
|
else if (mail == 0x8888da7a)
|
||||||
{
|
{
|
||||||
// DSP has copied coef to its dram...send address so it can dma it back
|
// DSP has copied coef to its DRAM...send address so it can DMA it back
|
||||||
while (real_dsp.CheckMailTo());
|
while (real_dsp.CheckMailTo());
|
||||||
real_dsp.SendMailTo((u32)&dspbufP[0x1000]);
|
real_dsp.SendMailTo((u32)&dspbufP[0x1000]);
|
||||||
while (real_dsp.CheckMailTo());
|
while (real_dsp.CheckMailTo());
|
||||||
|
@ -525,7 +525,7 @@ void InitGeneral()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Obtain the preferred video mode from the system
|
// Obtain the preferred video mode from the system
|
||||||
// This will correspond to the settings in the Wii menu
|
// This will correspond to the settings in the Wii Menu
|
||||||
rmode = VIDEO_GetPreferredMode(nullptr);
|
rmode = VIDEO_GetPreferredMode(nullptr);
|
||||||
|
|
||||||
// Allocate memory for the display in the uncached region
|
// Allocate memory for the display in the uncached region
|
||||||
|
|
Loading…
Reference in New Issue