#include "namco_guncon.h" #include "common/assert.h" #include "common/log.h" #include "common/state_wrapper.h" #include "gpu.h" #include "imgui.h" #include "system.h" #include Log_SetChannel(NamcoGunCon); NamcoGunCon::NamcoGunCon(System* system) : m_system(system) {} NamcoGunCon::~NamcoGunCon() = default; ControllerType NamcoGunCon::GetType() const { return ControllerType::NamcoGunCon; } std::optional NamcoGunCon::GetAxisCodeByName(std::string_view axis_name) const { return StaticGetAxisCodeByName(axis_name); } std::optional NamcoGunCon::GetButtonCodeByName(std::string_view button_name) const { return StaticGetButtonCodeByName(button_name); } void NamcoGunCon::Reset() { m_transfer_state = TransferState::Idle; } bool NamcoGunCon::DoState(StateWrapper& sw) { if (!Controller::DoState(sw)) return false; sw.Do(&m_button_state); sw.Do(&m_position_x); sw.Do(&m_position_y); sw.Do(&m_transfer_state); return true; } void NamcoGunCon::SetAxisState(s32 axis_code, float value) {} void NamcoGunCon::SetButtonState(Button button, bool pressed) { static constexpr std::array(Button::Count)> indices = {{13, 3, 14}}; if (pressed) m_button_state &= ~(u16(1) << indices[static_cast(button)]); else m_button_state |= u16(1) << indices[static_cast(button)]; } void NamcoGunCon::SetButtonState(s32 button_code, bool pressed) { if (button_code < 0 || button_code >= static_cast(Button::Count)) return; SetButtonState(static_cast