mirror of https://github.com/stenzek/duckstation
Split MemoryCard and PadDevice (now Controller)
parent
c1710482df
commit
da14b10e72
@ -0,0 +1,38 @@
|
||||
#include "controller.h"
|
||||
#include "common/state_wrapper.h"
|
||||
#include "digital_controller.h"
|
||||
|
||||
Controller::Controller() = default;
|
||||
|
||||
Controller::~Controller() = default;
|
||||
|
||||
void Controller::Reset() {}
|
||||
|
||||
bool Controller::DoState(StateWrapper& sw)
|
||||
{
|
||||
return !sw.HasError();
|
||||
}
|
||||
|
||||
void Controller::ResetTransferState() {}
|
||||
|
||||
bool Controller::Transfer(const u8 data_in, u8* data_out)
|
||||
{
|
||||
*data_out = 0xFF;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<Controller> Controller::Create(std::string_view type_name)
|
||||
{
|
||||
if (type_name == "DigitalController")
|
||||
return DigitalController::Create();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<s32> Controller::GetButtonCodeByName(std::string_view type_name, std::string_view button_name)
|
||||
{
|
||||
if (type_name == "DigitalController")
|
||||
return DigitalController::GetButtonCodeByName(button_name);
|
||||
|
||||
return {};
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
#include "pad_device.h"
|
||||
#include "common/state_wrapper.h"
|
||||
#include "digital_controller.h"
|
||||
|
||||
PadDevice::PadDevice() = default;
|
||||
|
||||
PadDevice::~PadDevice() = default;
|
||||
|
||||
void PadDevice::Reset() {}
|
||||
|
||||
bool PadDevice::DoState(StateWrapper& sw)
|
||||
{
|
||||
return !sw.HasError();
|
||||
}
|
||||
|
||||
void PadDevice::ResetTransferState() {}
|
||||
|
||||
bool PadDevice::Transfer(const u8 data_in, u8* data_out)
|
||||
{
|
||||
*data_out = 0xFF;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<PadDevice> PadDevice::Create(std::string_view type_name)
|
||||
{
|
||||
if (type_name == "DigitalController")
|
||||
return DigitalController::Create();
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<s32> PadDevice::GetButtonCodeByName(std::string_view type_name, std::string_view button_name)
|
||||
{
|
||||
if (type_name == "DigitalController")
|
||||
return DigitalController::GetButtonCodeByName(button_name);
|
||||
|
||||
return {};
|
||||
}
|
||||
Loading…
Reference in New Issue