cellpad: add pclass_profile flags

This commit is contained in:
Megamouse 2020-04-25 02:12:19 +02:00
parent 4e6d95c5b8
commit e4cb9ef7cd
7 changed files with 196 additions and 19 deletions

View file

@ -3,6 +3,7 @@
#ifdef HAVE_LIBEVDEV
#include "Input/product_info.h"
#include "Emu/Io/pad_config.h"
#include "evdev_joystick_handler.h"
#include "util/logs.hpp"
@ -922,12 +923,23 @@ bool evdev_joystick_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std
return button;
};
u32 pclass_profile = 0x0;
for (const auto product : input::get_products_by_class(p_profile->device_class_type))
{
if (product.vendor_id == p_profile->vendor_id && product.product_id == p_profile->product_id)
{
pclass_profile = product.pclass_profile;
}
}
pad->Init
(
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,
pclass_profile,
p_profile->vendor_id,
p_profile->product_id
);

View file

@ -1,5 +1,6 @@
#include "keyboard_pad_handler.h"
#include "Emu/Io/pad_config.h"
#include "Input/product_info.h"
#include <QApplication>
@ -606,13 +607,24 @@ bool keyboard_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::
return key;
};
//Fixed assign change, default is both sensor and press off
u32 pclass_profile = 0x0;
for (const auto product : input::get_products_by_class(p_profile->device_class_type))
{
if (product.vendor_id == p_profile->vendor_id && product.product_id == p_profile->product_id)
{
pclass_profile = product.pclass_profile;
}
}
// Fixed assign change, default is both sensor and press off
pad->Init
(
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,
pclass_profile,
p_profile->vendor_id,
p_profile->product_id
);

View file

@ -24,12 +24,12 @@ namespace input
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)
red_octane_gh_guitar = 0x0100, // RedOctane Guitar (Guitar Hero 4 Guitar Controller)
red_octane_gh_drum_kit = 0x0120, // RedOctane Drum Kit (Guitar Hero 4 Drum Controller)
dance_dance_revolution_mat = 0x0140, // Dance Dance Revolution Dance Mat Controller
dj_hero_turntable = 0x0140, // DJ Hero Turntable Controller
harmonix_rockband_guitar = 0x0200, // Harmonix Guitar (Rock Band II Guitar Controller)
harmonix_rockband_drum_kit = 0x0210, // Harmonix Drum Kit (Rock Band II Drum Controller)
playstation_3_controller = 0x0268, // PlayStation 3 Controller
};
@ -38,6 +38,7 @@ namespace input
product_type type;
uint16_t vendor_id;
uint16_t product_id;
uint32_t pclass_profile; // See CELL_PAD_PCLASS_PROFILE flags
};
static product_info get_product_info(product_type type)
@ -47,31 +48,31 @@ namespace input
default:
case product_type::playstation_3_controller:
{
return product_info{ type, vendor_id::sony_corp, product_id::playstation_3_controller };
return product_info{ type, vendor_id::sony_corp, product_id::playstation_3_controller, 0x0 };
}
case product_type::dance_dance_revolution_mat:
{
return product_info{ type, vendor_id::konami_de, product_id::dance_dance_revolution_mat };
return product_info{ type, vendor_id::konami_de, product_id::dance_dance_revolution_mat, 0x000000FF };
}
case product_type::dj_hero_turntable:
{
return product_info{ type, vendor_id::sony_cea, product_id::dj_hero_turntable };
return product_info{ type, vendor_id::sony_cea, product_id::dj_hero_turntable, 0x000007FF };
}
case product_type::harmonix_rockband_drum_kit:
{
return product_info{ type, vendor_id::sony_cea, product_id::harmonix_rockband_drum_kit };
return product_info{ type, vendor_id::sony_cea, product_id::harmonix_rockband_drum_kit, 0x000000FF };
}
case product_type::harmonix_rockband_guitar:
{
return product_info{ type, vendor_id::sony_cea, product_id::harmonix_rockband_guitar };
return product_info{ type, vendor_id::sony_cea, product_id::harmonix_rockband_guitar, 0x00007FFF };
}
case product_type::red_octane_gh_drum_kit:
{
return product_info{ type, vendor_id::sony_cea, product_id::red_octane_gh_drum_kit };
return product_info{ type, vendor_id::sony_cea, product_id::red_octane_gh_drum_kit, 0x000000BB };
}
case product_type::red_octane_gh_guitar:
{
return product_info{ type, vendor_id::sony_cea, product_id::red_octane_gh_guitar };
return product_info{ type, vendor_id::sony_cea, product_id::red_octane_gh_guitar, 0x000000FF };
}
}
}