Merge pull request #6668 from JosJuice/remove-hybrid-wiimote

Remove Hybrid Wii Remote
This commit is contained in:
Mat M
2018-04-17 18:09:58 -04:00
committed by GitHub
8 changed files with 14 additions and 117 deletions

View File

@ -290,7 +290,7 @@ bool BootCore(std::unique_ptr<BootParameters> boot)
{
controls_section->Get(StringFromFormat("WiimoteSource%u", i), &source, -1);
if (source != -1 && g_wiimote_sources[i] != (unsigned)source &&
source >= WIIMOTE_SRC_NONE && source <= WIIMOTE_SRC_HYBRID)
source >= WIIMOTE_SRC_NONE && source <= WIIMOTE_SRC_REAL)
{
config_cache.bSetWiimoteSource[i] = true;
g_wiimote_sources[i] = source;

View File

@ -135,17 +135,21 @@ void Pause()
// An L2CAP packet is passed from the Core to the Wiimote on the HID CONTROL channel.
void ControlChannel(int number, u16 channel_id, const void* data, u32 size)
{
if (WIIMOTE_SRC_HYBRID & g_wiimote_sources[number])
if (g_wiimote_sources[number])
{
static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))
->ControlChannel(channel_id, data, size);
}
}
// An L2CAP packet is passed from the Core to the Wiimote on the HID INTERRUPT channel.
void InterruptChannel(int number, u16 channel_id, const void* data, u32 size)
{
if (WIIMOTE_SRC_HYBRID & g_wiimote_sources[number])
if (g_wiimote_sources[number])
{
static_cast<WiimoteEmu::Wiimote*>(s_config.GetController(number))
->InterruptChannel(channel_id, data, size);
}
}
bool ButtonPressed(int number)

View File

@ -43,7 +43,6 @@ enum
WIIMOTE_SRC_NONE = 0,
WIIMOTE_SRC_EMU = 1,
WIIMOTE_SRC_REAL = 2,
WIIMOTE_SRC_HYBRID = 3, // emu + real
};
extern unsigned int g_wiimote_sources[MAX_BBMOTES];

View File

@ -722,84 +722,6 @@ void Wiimote::Update()
if (rptf.ext)
GetExtData(data + rptf.ext);
// hybrid Wii Remote stuff (for now, it's not supported while recording)
if (WIIMOTE_SRC_HYBRID == g_wiimote_sources[m_index] && !Movie::IsRecordingInput())
{
using namespace WiimoteReal;
std::lock_guard<std::mutex> lk(g_wiimotes_mutex);
if (g_wiimotes[m_index])
{
Report& rpt = g_wiimotes[m_index]->ProcessReadQueue();
if (!rpt.empty())
{
u8* real_data = rpt.data();
switch (real_data[1])
{
// use data reports
default:
if (real_data[1] >= RT_REPORT_CORE)
{
const ReportFeatures& real_rptf =
reporting_mode_features[real_data[1] - RT_REPORT_CORE];
// force same report type from real-Wiimote
if (&real_rptf != &rptf)
rptf_size = 0;
// core
// mix real-buttons with emu-buttons in the status struct, and in the report
if (real_rptf.core && rptf.core)
{
m_status.buttons.hex |=
reinterpret_cast<wm_buttons*>(real_data + real_rptf.core)->hex;
*reinterpret_cast<wm_buttons*>(data + rptf.core) = m_status.buttons;
}
// accel
// use real-accel data always i guess
if (real_rptf.accel && rptf.accel)
memcpy(data + rptf.accel, real_data + real_rptf.accel, sizeof(wm_accel));
// ir
// TODO
// ext
// use real-ext data if an emu-extention isn't chosen
if (real_rptf.ext && rptf.ext && (0 == m_extension->switch_extension))
memcpy(data + rptf.ext, real_data + real_rptf.ext,
sizeof(wm_nc)); // TODO: Why NC specific?
}
else if (real_data[1] != RT_ACK_DATA || m_extension->active_extension > 0)
rptf_size = 0;
else
// use real-acks if an emu-extension isn't chosen
rptf_size = -1;
break;
// use all status reports, after modification of the extension bit
case RT_STATUS_REPORT:
if (m_extension->active_extension)
reinterpret_cast<wm_status_report*>(real_data + 2)->extension = 1;
rptf_size = -1;
break;
// use all read-data replies
case RT_READ_DATA_REPLY:
rptf_size = -1;
break;
}
// copy over report from real-Wiimote
if (-1 == rptf_size)
{
std::copy(rpt.begin(), rpt.end(), data);
rptf_size = (s8)(rpt.size());
}
}
}
}
Movie::CallWiiInputManip(data, rptf, m_index, m_extension->active_extension, m_ext_key);
}
if (NetPlay::IsNetPlayRunning())