2021-11-24 20:59:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
2023-01-11 14:19:15 +08:00
|
|
|
#include "Emu/system_utils.hpp"
|
2021-11-24 20:59:48 +00:00
|
|
|
#include "Emu/Io/usb_device.h"
|
|
|
|
|
|
|
|
|
|
class usb_device_usio : public usb_device_emulated
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-11-23 15:52:41 +01:00
|
|
|
usb_device_usio(const std::array<u8, 7>& location);
|
2021-11-24 20:59:48 +00:00
|
|
|
~usb_device_usio();
|
|
|
|
|
|
|
|
|
|
void control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, u32 buf_size, u8* buf, UsbTransfer* transfer) override;
|
|
|
|
|
void interrupt_transfer(u32 buf_size, u8* buf, u32 endpoint, UsbTransfer* transfer) override;
|
|
|
|
|
|
|
|
|
|
private:
|
2022-09-30 00:38:16 +08:00
|
|
|
void load_backup();
|
2022-09-28 08:37:37 +08:00
|
|
|
void save_backup();
|
2021-11-24 20:59:48 +00:00
|
|
|
void translate_input();
|
2023-01-11 00:04:42 +08:00
|
|
|
void usio_write(u8 channel, u16 reg, std::vector<u8>& data);
|
2021-11-24 20:59:48 +00:00
|
|
|
void usio_read(u8 channel, u16 reg, u16 size);
|
|
|
|
|
|
|
|
|
|
private:
|
2022-10-21 01:50:14 +08:00
|
|
|
bool test_on = false;
|
|
|
|
|
bool test_key_pressed = false;
|
|
|
|
|
bool coin_key_pressed = false;
|
2023-01-11 14:19:15 +08:00
|
|
|
bool is_used = false;
|
2022-10-21 01:50:14 +08:00
|
|
|
le_t<u16> coin_counter = 0;
|
2023-01-11 14:19:15 +08:00
|
|
|
const std::string usio_backup_path = rpcs3::utils::get_hdd1_dir() + "/caches/usiobackup.bin";
|
2023-01-11 00:04:42 +08:00
|
|
|
std::vector<u8> response;
|
2021-11-24 20:59:48 +00:00
|
|
|
};
|