Consolidate input products in a single place

This commit is contained in:
Florin9doi 2024-05-15 22:06:35 +03:00 committed by Megamouse
parent 3e7ff4059e
commit ecedbc38ec
6 changed files with 247 additions and 335 deletions

View file

@ -76,6 +76,7 @@ target_sources(rpcs3
Input/keyboard_pad_handler.cpp
Input/mm_joystick_handler.cpp
Input/pad_thread.cpp
Input/product_info.cpp
Input/raw_mouse_handler.cpp
Input/sdl_pad_handler.cpp
Input/skateboard_pad_handler.cpp

View file

@ -129,38 +129,8 @@ void cellPad_NotifyStateChange(usz index, u64 /*state*/, bool locked)
if (pad->m_vendor_id == 0 || pad->m_product_id == 0)
{
// Fallback to defaults
input::product_info product;
switch (pad->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:
product = input::get_product_info(input::product_type::ps_move_navigation);
break;
case CELL_PAD_PCLASS_TYPE_SKATEBOARD:
product = input::get_product_info(input::product_type::ride_skateboard);
break;
case CELL_PAD_FAKE_TYPE_GUNCON3:
product = input::get_product_info(input::product_type::guncon_3);
break;
case CELL_PAD_PCLASS_TYPE_STANDARD:
default:
product = input::get_product_info(input::product_type::playstation_3_controller);
break;
}
const std::vector<input::product_info> input_products = input::get_products_by_class(pad->m_class_type);
const input::product_info& product = ::at32(input_products, 0);
reported_info.vendor_id = product.vendor_id;
reported_info.product_id = product.product_id;
}

View file

@ -0,0 +1,235 @@
#include "Input/product_info.h"
namespace input
{
static const std::map<product_type, product_info> input_products = {
{
product_type::playstation_3_controller,
{
.type = product_type::playstation_3_controller,
.class_id = CELL_PAD_PCLASS_TYPE_STANDARD,
.vendor_id = vendor_id::sony_corp,
.product_id = product_id::playstation_3_controller,
.pclass_profile = 0x0,
.capabilites = 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
}
},
{
product_type::red_octane_gh_guitar,
{
.type = product_type::red_octane_gh_guitar,
.class_id = CELL_PAD_PCLASS_TYPE_GUITAR,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::red_octane_gh_guitar,
.pclass_profile =
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_1 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_2 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_3 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_4 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_5 |
CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_UP |
CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_DOWN |
CELL_PAD_PCLASS_PROFILE_GUITAR_WHAMMYBAR,
.capabilites = 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
}
},
{
product_type::harmonix_rockband_guitar,
{
.type = product_type::harmonix_rockband_guitar,
.class_id = CELL_PAD_PCLASS_TYPE_GUITAR,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::harmonix_rockband_guitar,
.pclass_profile =
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_1 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_2 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_3 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_4 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_5 |
CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_UP |
CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_DOWN |
CELL_PAD_PCLASS_PROFILE_GUITAR_WHAMMYBAR |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H1 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H2 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H3 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H4 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H5 |
CELL_PAD_PCLASS_PROFILE_GUITAR_5WAY_EFFECT |
CELL_PAD_PCLASS_PROFILE_GUITAR_TILT_SENS,
.capabilites = 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
}
},
{
product_type::red_octane_gh_drum_kit,
{
.type = product_type::red_octane_gh_drum_kit,
.class_id = CELL_PAD_PCLASS_TYPE_DRUM,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::red_octane_gh_drum_kit,
.pclass_profile =
CELL_PAD_PCLASS_PROFILE_DRUM_SNARE |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM_FLOOR |
CELL_PAD_PCLASS_PROFILE_DRUM_KICK |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_HiHAT |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_RIDE,
.capabilites = 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
}
},
{
product_type::harmonix_rockband_drum_kit,
{
.type = product_type::harmonix_rockband_drum_kit,
.class_id = CELL_PAD_PCLASS_TYPE_DRUM,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::harmonix_rockband_drum_kit,
.pclass_profile =
CELL_PAD_PCLASS_PROFILE_DRUM_SNARE |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM2 |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM_FLOOR |
CELL_PAD_PCLASS_PROFILE_DRUM_KICK |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_HiHAT |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_CRASH |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_RIDE,
.capabilites = 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
}
},
{
product_type::harmonix_rockband_drum_kit_2,
{
.type = product_type::harmonix_rockband_drum_kit_2,
.class_id = CELL_PAD_PCLASS_TYPE_DRUM,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::harmonix_rockband_drum_kit_2,
.pclass_profile =
CELL_PAD_PCLASS_PROFILE_DRUM_SNARE |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM2 |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM_FLOOR |
CELL_PAD_PCLASS_PROFILE_DRUM_KICK |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_HiHAT |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_RIDE,
.capabilites = 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
}
},
{
product_type::rock_revolution_drum_kit,
{
.type = product_type::rock_revolution_drum_kit,
.class_id = CELL_PAD_PCLASS_TYPE_DRUM,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::rock_revolution_drum_kit,
.pclass_profile =
CELL_PAD_PCLASS_PROFILE_DRUM_SNARE |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM_FLOOR |
CELL_PAD_PCLASS_PROFILE_DRUM_KICK |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_HiHAT |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_CRASH |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_RIDE,
.capabilites = 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
}
},
{
product_type::dj_hero_turntable,
{
.type = product_type::dj_hero_turntable,
.class_id = CELL_PAD_PCLASS_TYPE_DJ,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::dj_hero_turntable,
.pclass_profile =
CELL_PAD_PCLASS_PROFILE_DJ_MIXER_ATTACK |
CELL_PAD_PCLASS_PROFILE_DJ_MIXER_CROSSFADER |
CELL_PAD_PCLASS_PROFILE_DJ_MIXER_DSP_DIAL |
CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM1 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM2 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM3 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK1_PLATTER |
CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM1 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM2 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM3 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK2_PLATTER,
.capabilites = 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
}
},
{
product_type::dance_dance_revolution_mat,
{
.type = product_type::dance_dance_revolution_mat,
.class_id = CELL_PAD_PCLASS_TYPE_DANCEMAT,
.vendor_id = vendor_id::konami_de,
.product_id = product_id::dance_dance_revolution_mat,
.pclass_profile =
CELL_PAD_PCLASS_PROFILE_DANCEMAT_CIRCLE |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_CROSS |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_TRIANGLE |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_SQUARE |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_RIGHT |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_LEFT |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_UP |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_DOWN,
.capabilites = 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
}
},
{
product_type::ps_move_navigation,
{
.type = product_type::ps_move_navigation,
.class_id = CELL_PAD_PCLASS_TYPE_NAVIGATION,
.vendor_id = vendor_id::sony_corp,
.product_id = product_id::ps_move_navigation,
.pclass_profile = 0x0,
.capabilites = 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
}
},
{
product_type::ride_skateboard,
{
.type = product_type::ride_skateboard,
.class_id = CELL_PAD_PCLASS_TYPE_SKATEBOARD,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::ride_skateboard,
.pclass_profile = 0x0,
.capabilites = CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_SENSOR_MODE
}
},
{
product_type::guncon_3,
{
.type = product_type::guncon_3,
.class_id = CELL_PAD_FAKE_TYPE_GUNCON3,
.vendor_id = vendor_id::namco,
.product_id = product_id::guncon_3,
.pclass_profile = 0x0,
.capabilites = 0x0
}
}
};
product_info get_product_info(product_type type)
{
return input_products.at(type);
}
product_type get_product_by_vid_pid(u16 vendor_id, u16 product_id)
{
for (const auto& [type, product] : input_products)
{
if (product.vendor_id == vendor_id && product.product_id == product_id)
return type;
}
return product_type::playstation_3_controller;
}
std::vector<product_info> get_products_by_class(int class_id)
{
std::vector<product_info> ret;
for (const auto& [type, product] : input_products)
{
if (product.class_id == class_id)
ret.push_back(product);
}
return ret;
}
}

View file

@ -48,312 +48,14 @@ namespace input
struct product_info
{
product_type type;
u16 class_id;
u16 vendor_id;
u16 product_id;
u32 pclass_profile; // See CELL_PAD_PCLASS_PROFILE flags
u32 capabilites; // See CELL_PAD_CAPABILITY flags
};
inline product_info get_product_info(product_type type)
{
switch (type)
{
case product_type::dance_dance_revolution_mat:
{
constexpr u32 profile =
CELL_PAD_PCLASS_PROFILE_DANCEMAT_CIRCLE |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_CROSS |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_TRIANGLE |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_SQUARE |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_RIGHT |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_LEFT |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_UP |
CELL_PAD_PCLASS_PROFILE_DANCEMAT_DOWN;
return product_info{
.type = type,
.vendor_id = vendor_id::konami_de,
.product_id = product_id::dance_dance_revolution_mat,
.pclass_profile = profile,
.capabilites = 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
};
}
case product_type::dj_hero_turntable:
{
constexpr u32 profile =
CELL_PAD_PCLASS_PROFILE_DJ_MIXER_ATTACK |
CELL_PAD_PCLASS_PROFILE_DJ_MIXER_CROSSFADER |
CELL_PAD_PCLASS_PROFILE_DJ_MIXER_DSP_DIAL |
CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM1 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM2 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK1_STREAM3 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK1_PLATTER |
CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM1 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM2 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK2_STREAM3 |
CELL_PAD_PCLASS_PROFILE_DJ_DECK2_PLATTER;
return product_info{
.type = type,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::dj_hero_turntable,
.pclass_profile = profile,
.capabilites = 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
};
}
case product_type::harmonix_rockband_drum_kit:
{
constexpr u32 profile =
CELL_PAD_PCLASS_PROFILE_DRUM_SNARE |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM2 |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM_FLOOR |
CELL_PAD_PCLASS_PROFILE_DRUM_KICK |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_HiHAT |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_CRASH |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_RIDE;
return product_info{
.type = type,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::harmonix_rockband_drum_kit,
.pclass_profile = profile,
.capabilites = 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
};
}
case product_type::harmonix_rockband_drum_kit_2:
{
constexpr u32 profile =
CELL_PAD_PCLASS_PROFILE_DRUM_SNARE |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM2 |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM_FLOOR |
CELL_PAD_PCLASS_PROFILE_DRUM_KICK |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_HiHAT |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_RIDE;
return product_info{
.type = type,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::harmonix_rockband_drum_kit_2,
.pclass_profile = profile,
.capabilites = 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
};
}
case product_type::harmonix_rockband_guitar:
{
constexpr u32 profile =
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_1 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_2 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_3 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_4 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_5 |
CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_UP |
CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_DOWN |
CELL_PAD_PCLASS_PROFILE_GUITAR_WHAMMYBAR |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H1 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H2 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H3 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H4 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_H5 |
CELL_PAD_PCLASS_PROFILE_GUITAR_5WAY_EFFECT |
CELL_PAD_PCLASS_PROFILE_GUITAR_TILT_SENS;
return product_info{
.type = type,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::harmonix_rockband_guitar,
.pclass_profile = profile,
.capabilites = 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
};
}
case product_type::red_octane_gh_drum_kit:
{
constexpr u32 profile =
CELL_PAD_PCLASS_PROFILE_DRUM_SNARE |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM_FLOOR |
CELL_PAD_PCLASS_PROFILE_DRUM_KICK |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_HiHAT |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_RIDE;
return product_info{
.type = type,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::red_octane_gh_drum_kit,
.pclass_profile = profile,
.capabilites = 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
};
}
case product_type::red_octane_gh_guitar:
{
constexpr u32 profile =
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_1 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_2 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_3 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_4 |
CELL_PAD_PCLASS_PROFILE_GUITAR_FRET_5 |
CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_UP |
CELL_PAD_PCLASS_PROFILE_GUITAR_STRUM_DOWN |
CELL_PAD_PCLASS_PROFILE_GUITAR_WHAMMYBAR;
return product_info{
.type = type,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::red_octane_gh_guitar,
.pclass_profile = profile,
.capabilites = 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
};
}
case product_type::rock_revolution_drum_kit:
{
constexpr u32 profile =
CELL_PAD_PCLASS_PROFILE_DRUM_SNARE |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM |
CELL_PAD_PCLASS_PROFILE_DRUM_TOM_FLOOR |
CELL_PAD_PCLASS_PROFILE_DRUM_KICK |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_HiHAT |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_CRASH |
CELL_PAD_PCLASS_PROFILE_DRUM_CYM_RIDE;
return product_info{
.type = type,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::rock_revolution_drum_kit,
.pclass_profile = profile,
.capabilites = 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
};
}
case product_type::ps_move_navigation:
{
return product_info{
.type = type,
.vendor_id = vendor_id::sony_corp,
.product_id = product_id::ps_move_navigation,
.pclass_profile = 0x0,
.capabilites = 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
};
}
case product_type::ride_skateboard:
{
return product_info{
.type = type,
.vendor_id = vendor_id::sony_cea,
.product_id = product_id::ride_skateboard,
.pclass_profile = 0x0,
.capabilites = CELL_PAD_CAPABILITY_PS3_CONFORMITY | CELL_PAD_CAPABILITY_PRESS_MODE | CELL_PAD_CAPABILITY_SENSOR_MODE
};
}
case product_type::guncon_3:
{
return product_info{
.type = type,
.vendor_id = vendor_id::namco,
.product_id = product_id::guncon_3,
.pclass_profile = 0x0,
.capabilites = 0x0
};
}
case product_type::playstation_3_controller:
default: // GCC doesn't like it when there is no return value if if all enum values are covered
{
return product_info{
.type = type,
.vendor_id = vendor_id::sony_corp,
.product_id = product_id::playstation_3_controller,
.pclass_profile = 0x0,
.capabilites = 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
};
}
}
}
inline product_type get_product_by_vid_pid(u16 vid, u16 pid)
{
if (vid == vendor_id::konami_de && pid == product_id::dance_dance_revolution_mat)
return product_type::dance_dance_revolution_mat;
if (vid == vendor_id::sony_cea && pid == product_id::dj_hero_turntable)
return product_type::dj_hero_turntable;
if (vid == vendor_id::sony_cea && pid == product_id::harmonix_rockband_drum_kit)
return product_type::harmonix_rockband_drum_kit;
if (vid == vendor_id::sony_cea && pid == product_id::harmonix_rockband_drum_kit_2)
return product_type::harmonix_rockband_drum_kit_2;
if (vid == vendor_id::sony_cea && pid == product_id::harmonix_rockband_guitar)
return product_type::harmonix_rockband_guitar;
if (vid == vendor_id::sony_cea && pid == product_id::red_octane_gh_drum_kit)
return product_type::red_octane_gh_drum_kit;
if (vid == vendor_id::sony_cea && pid == product_id::red_octane_gh_guitar)
return product_type::red_octane_gh_guitar;
if (vid == vendor_id::sony_cea && pid == product_id::rock_revolution_drum_kit)
return product_type::rock_revolution_drum_kit;
if (vid == vendor_id::sony_corp && pid == product_id::ps_move_navigation)
return product_type::ps_move_navigation;
if (vid == vendor_id::sony_cea && pid == product_id::ride_skateboard)
return product_type::ride_skateboard;
if (vid == vendor_id::namco && pid == product_id::guncon_3)
return product_type::guncon_3;
if (vid == vendor_id::sony_corp && pid == product_id::playstation_3_controller)
return product_type::playstation_3_controller;
return product_type::playstation_3_controller;
}
inline std::vector<product_info> get_products_by_class(int class_id)
{
switch (class_id)
{
default:
case CELL_PAD_PCLASS_TYPE_STANDARD:
{
return
{
get_product_info(product_type::playstation_3_controller)
};
}
case CELL_PAD_PCLASS_TYPE_GUITAR:
{
return
{
get_product_info(product_type::red_octane_gh_guitar),
get_product_info(product_type::harmonix_rockband_guitar)
};
}
case 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),
get_product_info(product_type::harmonix_rockband_drum_kit_2),
get_product_info(product_type::rock_revolution_drum_kit)
};
}
case CELL_PAD_PCLASS_TYPE_DJ:
{
return
{
get_product_info(product_type::dj_hero_turntable)
};
}
case CELL_PAD_PCLASS_TYPE_DANCEMAT:
{
return
{
get_product_info(product_type::dance_dance_revolution_mat)
};
}
case CELL_PAD_PCLASS_TYPE_NAVIGATION:
{
return
{
get_product_info(product_type::ps_move_navigation)
};
}
case CELL_PAD_PCLASS_TYPE_SKATEBOARD:
{
return
{
get_product_info(product_type::ride_skateboard)
};
}
case CELL_PAD_FAKE_TYPE_GUNCON3:
{
return
{
get_product_info(product_type::guncon_3)
};
}
}
}
};
product_info get_product_info(product_type type);
product_type get_product_by_vid_pid(u16 vid, u16 pid);
std::vector<product_info> get_products_by_class(int class_id);
}

View file

@ -192,6 +192,7 @@
<ClCompile Include="Input\keyboard_pad_handler.cpp" />
<ClCompile Include="Input\mm_joystick_handler.cpp" />
<ClCompile Include="Input\pad_thread.cpp" />
<ClCompile Include="Input\product_info.cpp" />
<ClCompile Include="QTGeneratedFiles\Debug\moc_about_dialog.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>

View file

@ -345,6 +345,9 @@
<ClCompile Include="Input\pad_thread.cpp">
<Filter>Io</Filter>
</ClCompile>
<ClCompile Include="Input\product_info.cpp">
<Filter>Io</Filter>
</ClCompile>
<ClCompile Include="rpcs3qt\about_dialog.cpp">
<Filter>Gui\misc dialogs</Filter>
</ClCompile>