2019-10-31 18:00:42 +00:00
|
|
|
#include "SwitchVirtualGamepadHandler.h"
|
|
|
|
|
|
|
|
SwitchVirtualGamepadHandler::SwitchVirtualGamepadHandler(std::unique_ptr<IController> &&controller)
|
|
|
|
: m_controllerHandler(std::move(controller))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwitchVirtualGamepadHandler::~SwitchVirtualGamepadHandler()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Result SwitchVirtualGamepadHandler::Initialize()
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwitchVirtualGamepadHandler::Exit()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-12-04 18:44:01 +00:00
|
|
|
void SwitchVirtualGamepadHandler::InputThreadLoop(void *handler)
|
2019-10-31 18:00:42 +00:00
|
|
|
{
|
2019-12-04 18:44:01 +00:00
|
|
|
static_cast<SwitchVirtualGamepadHandler *>(handler)->UpdateInput();
|
2019-10-31 18:00:42 +00:00
|
|
|
}
|
|
|
|
|
2019-12-04 18:44:01 +00:00
|
|
|
void SwitchVirtualGamepadHandler::OutputThreadLoop(void *handler)
|
2019-10-31 18:00:42 +00:00
|
|
|
{
|
2019-12-04 18:44:01 +00:00
|
|
|
static_cast<SwitchVirtualGamepadHandler *>(handler)->UpdateOutput();
|
2019-10-31 18:00:42 +00:00
|
|
|
}
|
|
|
|
|
2019-11-06 12:28:56 +00:00
|
|
|
Result SwitchVirtualGamepadHandler::InitInputThread()
|
2019-10-31 18:00:42 +00:00
|
|
|
{
|
2019-12-04 18:44:01 +00:00
|
|
|
Result rc = m_inputThread.Initialize(0x400, 0x3B);
|
|
|
|
if (R_SUCCEEDED(rc))
|
|
|
|
rc = m_inputThread.Start(&SwitchVirtualGamepadHandler::InputThreadLoop, this);
|
|
|
|
|
|
|
|
return rc;
|
2019-10-31 18:00:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwitchVirtualGamepadHandler::ExitInputThread()
|
|
|
|
{
|
2019-12-04 18:44:01 +00:00
|
|
|
m_inputThread.Exit();
|
2019-10-31 18:00:42 +00:00
|
|
|
}
|
|
|
|
|
2019-11-06 12:28:56 +00:00
|
|
|
Result SwitchVirtualGamepadHandler::InitOutputThread()
|
2019-10-31 18:00:42 +00:00
|
|
|
{
|
2019-12-04 18:44:01 +00:00
|
|
|
Result rc = m_outputThread.Initialize(0x400, 0x3B);
|
|
|
|
if (R_SUCCEEDED(rc))
|
|
|
|
rc = m_outputThread.Start(&SwitchVirtualGamepadHandler::OutputThreadLoop, this);
|
|
|
|
|
|
|
|
return rc;
|
2019-10-31 18:00:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwitchVirtualGamepadHandler::ExitOutputThread()
|
|
|
|
{
|
2019-12-04 18:44:01 +00:00
|
|
|
m_outputThread.Exit();
|
2019-10-31 18:00:42 +00:00
|
|
|
}
|