1
0
mirror of https://github.com/cathery/sys-con.git synced 2024-11-05 17:26:28 +00:00
sys-con/source/ControllerSwitch/SwitchVirtualGamepadHandler.cpp

57 lines
1.3 KiB
C++
Raw Normal View History

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()
{
}
void SwitchVirtualGamepadHandler::InputThreadLoop(void *handler)
2019-10-31 18:00:42 +00:00
{
static_cast<SwitchVirtualGamepadHandler *>(handler)->UpdateInput();
2019-10-31 18:00:42 +00:00
}
void SwitchVirtualGamepadHandler::OutputThreadLoop(void *handler)
2019-10-31 18:00:42 +00:00
{
static_cast<SwitchVirtualGamepadHandler *>(handler)->UpdateOutput();
2019-10-31 18:00:42 +00:00
}
Result SwitchVirtualGamepadHandler::InitInputThread()
2019-10-31 18:00:42 +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()
{
m_inputThread.Exit();
2019-10-31 18:00:42 +00:00
}
Result SwitchVirtualGamepadHandler::InitOutputThread()
2019-10-31 18:00:42 +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()
{
m_outputThread.Exit();
2019-10-31 18:00:42 +00:00
}