Qt/input/cellpad: enable product choice

This commit is contained in:
Megamouse 2020-04-24 22:49:36 +02:00
parent 256c74def2
commit 4e6d95c5b8
12 changed files with 306 additions and 43 deletions

View file

@ -5,6 +5,7 @@
#include "Emu/Io/pad_types.h"
#include "Input/pad_thread.h"
#include "Input/product_info.h"
#include "cellPad.h"
LOG_CHANNEL(sys_io);
@ -636,43 +637,40 @@ error_code cellPadGetInfo(vm::ptr<CellPadInfo> info)
pads[i]->m_port_status &= ~CELL_PAD_STATUS_ASSIGN_CHANGES; // TODO: should ASSIGN flags be cleared here?
info->status[i] = pads[i]->m_port_status;
// TODO: Allow selecting different product IDs
switch (pads[i]->m_class_type)
if (pads[i]->m_vendor_id == 0 || pads[i]->m_product_id == 0)
{
case CELL_PAD_PCLASS_TYPE_GUITAR:
// Sony Computer Entertainment America
info->vendor_id[i] = 0x12BA;
// RedOctane Guitar (Guitar Hero)
info->product_id[i] = 0x0100;
// Harmonix Guitar (Rock Band)
// info->product_id[i] = 0x0200;
break;
case CELL_PAD_PCLASS_TYPE_DRUM:
// Sony Computer Entertainment America
info->vendor_id[i] = 0x12BA;
// RedOctane Drum Kit (Guitar Hero)
info->product_id[i] = 0x0120;
// Harmonix Drum Kit (Rock Band)
// info->product_id[i] = 0x0210;
break;
case CELL_PAD_PCLASS_TYPE_DJ:
// Sony Computer Entertainment America
info->vendor_id[i] = 0x12BA;
// DJ Hero Turntable
info->product_id[i] = 0x0140;
break;
case CELL_PAD_PCLASS_TYPE_DANCEMAT:
// Konami Digital Entertainment
info->vendor_id[i] = 0x1CCF;
// Dance Dance Revolution Mat
info->product_id[i] = 0x0140;
break;
default:
// Sony Corp.
info->vendor_id[i] = 0x054C;
// PlayStation 3 Controller
info->product_id[i] = 0x0268;
break;
// Fallback to defaults
input::product_info product;
switch (pads[i]->m_class_type)
{
case CELL_PAD_PCLASS_TYPE_GUITAR:
product = input::get_product_info(input::product_type::red_octane_gh_guitar);
break;
case CELL_PAD_PCLASS_TYPE_DRUM:
product = input::get_product_info(input::product_type::red_octane_gh_drum_kit);
break;
case CELL_PAD_PCLASS_TYPE_DJ:
product = input::get_product_info(input::product_type::dj_hero_turntable);
break;
case CELL_PAD_PCLASS_TYPE_DANCEMAT:
product = input::get_product_info(input::product_type::dance_dance_revolution_mat);
break;
case CELL_PAD_PCLASS_TYPE_NAVIGATION:
case CELL_PAD_PCLASS_TYPE_STANDARD:
default:
product = input::get_product_info(input::product_type::playstation_3_controller);
break;
}
info->vendor_id[i] = product.vendor_id;
info->product_id[i] = product.product_id;
}
else
{
info->vendor_id[i] = pads[i]->m_vendor_id;
info->product_id[i] = pads[i]->m_product_id;
}
}
@ -927,8 +925,18 @@ error_code cellPadLddRegisterController()
if (handle < 0)
return CELL_PAD_ERROR_TOO_MANY_DEVICES;
const auto product = input::get_product_info(input::product_type::playstation_3_controller);
auto& pads = handler->GetPads();
pads[handle]->Init(CELL_PAD_STATUS_CONNECTED | CELL_PAD_STATUS_ASSIGN_CHANGES | CELL_PAD_STATUS_CUSTOM_CONTROLLER, CELL_PAD_CAPABILITY_PS3_CONFORMITY, CELL_PAD_DEV_TYPE_LDD, 0);
pads[handle]->Init
(
CELL_PAD_STATUS_CONNECTED | CELL_PAD_STATUS_ASSIGN_CHANGES | CELL_PAD_STATUS_CUSTOM_CONTROLLER,
CELL_PAD_CAPABILITY_PS3_CONFORMITY,
CELL_PAD_DEV_TYPE_LDD,
CELL_PAD_PCLASS_TYPE_STANDARD,
product.vendor_id,
product.product_id
);
config->port_setting[handle] = 0;
return not_an_error(handle);