Buzz! emulated controller (#9504)

* Buzz emulated controller
Co-authored-by: Florin9doi <Florin9doi@users.noreply.github.com>
Co-authored-by: Ivan <nekotekina@gmail.com>
This commit is contained in:
Florin9doi 2020-12-31 20:02:03 +02:00 committed by GitHub
parent 8a5620592b
commit f1c61067bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 152 additions and 8 deletions

View file

@ -15,6 +15,7 @@
#include "Emu/Io/usb_device.h"
#include "Emu/Io/Skylander.h"
#include "Emu/Io/GHLtar.h"
#include "Emu/Io/Buzz.h"
#include <libusb.h>
@ -144,6 +145,7 @@ usb_handler_thread::usb_handler_thread()
bool found_skylander = false;
bool found_ghltar = false;
bool found_buzz = false;
for (ssize_t index = 0; index < ndev; index++)
{
@ -197,10 +199,14 @@ usb_handler_thread::usb_handler_thread()
check_device(0x044F, 0xB660, 0xB660, "Thrustmaster T500 RS Gear Shift");
// Buzz controllers
check_device(0x054C, 0x1000, 0x1040, "buzzer0");
check_device(0x054C, 0x0001, 0x0041, "buzzer1");
check_device(0x054C, 0x0042, 0x0042, "buzzer2");
check_device(0x046D, 0xC220, 0xC220, "buzzer9");
if (check_device(0x054C, 0x1000, 0x1040, "buzzer0"))
found_buzz = true;
if (check_device(0x054C, 0x0001, 0x0041, "buzzer1"))
found_buzz = true;
if (check_device(0x054C, 0x0042, 0x0042, "buzzer2"))
found_buzz = true;
if (check_device(0x046D, 0xC220, 0xC220, "buzzer9"))
found_buzz = true;
// GCon3 Gun
check_device(0x0B9A, 0x0800, 0x0800, "guncon3");
@ -223,6 +229,15 @@ usb_handler_thread::usb_handler_thread()
usb_devices.push_back(std::make_shared<usb_device_ghltar>());
}
if (!found_buzz)
{
sys_usbd.notice("Adding emulated Buzz! buzzer");
usb_devices.push_back(std::make_shared<usb_device_buzz>(0, 3));
// The current buzz emulation piggybacks on the pad input.
// Since there can only be 7 pads connected on a PS3 the 8th player is currently not supported
usb_devices.push_back(std::make_shared<usb_device_buzz>(4, 6));
}
for (u32 index = 0; index < MAX_SYS_USBD_TRANSFERS; index++)
{
transfers[index].transfer = libusb_alloc_transfer(8);