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

@ -927,7 +927,9 @@ bool evdev_joystick_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std
CELL_PAD_STATUS_DISCONNECTED,
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
CELL_PAD_DEV_TYPE_STANDARD,
p_profile->device_class_type
p_profile->device_class_type,
p_profile->vendor_id,
p_profile->product_id
);
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, find_key(p_profile->triangle), CELL_PAD_CTRL_TRIANGLE);

View file

@ -612,7 +612,9 @@ bool keyboard_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::
CELL_PAD_STATUS_DISCONNECTED,
CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_HP_ANALOG_STICK | CELL_PAD_CAPABILITY_ACTUATOR | CELL_PAD_CAPABILITY_SENSOR_MODE,
CELL_PAD_DEV_TYPE_STANDARD,
p_profile->device_class_type
p_profile->device_class_type,
p_profile->vendor_id,
p_profile->product_id
);
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, find_key(p_profile->left), CELL_PAD_CTRL_LEFT);

130
rpcs3/Input/product_info.h Normal file
View file

@ -0,0 +1,130 @@
#pragma once
#include <vector>
namespace input
{
enum class product_type
{
playstation_3_controller,
red_octane_gh_guitar,
red_octane_gh_drum_kit,
dance_dance_revolution_mat,
dj_hero_turntable,
harmonix_rockband_guitar,
harmonix_rockband_drum_kit,
};
enum vendor_id
{
sony_corp = 0x054C, // Sony Corp.
sony_cea = 0x12BA, // Sony Computer Entertainment America
konami_de = 0x1CCF, // Konami Digital Entertainment
};
enum product_id
{
red_octane_gh_guitar = 0x0100, // RedOctane Guitar (Guitar Hero)
red_octane_gh_drum_kit = 0x0120, // RedOctane Drum Kit (Guitar Hero)
dance_dance_revolution_mat = 0x0140, // Dance Dance Revolution Mat
dj_hero_turntable = 0x0140, // DJ Hero Turntable
harmonix_rockband_guitar = 0x0200, // Harmonix Guitar (Rock Band)
harmonix_rockband_drum_kit = 0x0210, // Harmonix Drum Kit (Rock Band)
playstation_3_controller = 0x0268, // PlayStation 3 Controller
};
struct product_info
{
product_type type;
uint16_t vendor_id;
uint16_t product_id;
};
static product_info get_product_info(product_type type)
{
switch (type)
{
default:
case product_type::playstation_3_controller:
{
return product_info{ type, vendor_id::sony_corp, product_id::playstation_3_controller };
}
case product_type::dance_dance_revolution_mat:
{
return product_info{ type, vendor_id::konami_de, product_id::dance_dance_revolution_mat };
}
case product_type::dj_hero_turntable:
{
return product_info{ type, vendor_id::sony_cea, product_id::dj_hero_turntable };
}
case product_type::harmonix_rockband_drum_kit:
{
return product_info{ type, vendor_id::sony_cea, product_id::harmonix_rockband_drum_kit };
}
case product_type::harmonix_rockband_guitar:
{
return product_info{ type, vendor_id::sony_cea, product_id::harmonix_rockband_guitar };
}
case product_type::red_octane_gh_drum_kit:
{
return product_info{ type, vendor_id::sony_cea, product_id::red_octane_gh_drum_kit };
}
case product_type::red_octane_gh_guitar:
{
return product_info{ type, vendor_id::sony_cea, product_id::red_octane_gh_guitar };
}
}
}
static std::vector<product_info> get_products_by_class(int class_id)
{
switch (class_id)
{
default:
case 0: // CELL_PAD_PCLASS_TYPE_STANDARD
{
return
{
get_product_info(product_type::playstation_3_controller)
};
}
case 1: // CELL_PAD_PCLASS_TYPE_GUITAR
{
return
{
get_product_info(product_type::red_octane_gh_guitar),
get_product_info(product_type::harmonix_rockband_guitar)
};
}
case 2: // CELL_PAD_PCLASS_TYPE_DRUM
{
return
{
get_product_info(product_type::red_octane_gh_drum_kit),
get_product_info(product_type::harmonix_rockband_drum_kit)
};
}
case 3: // CELL_PAD_PCLASS_TYPE_DJ
{
return
{
get_product_info(product_type::dj_hero_turntable)
};
}
case 4: // CELL_PAD_PCLASS_TYPE_DANCEMAT
{
return
{
get_product_info(product_type::dance_dance_revolution_mat)
};
}
case 5: // CELL_PAD_PCLASS_TYPE_NAVIGATION
{
return
{
get_product_info(product_type::playstation_3_controller)
};
}
}
}
};