1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2025-01-31 12:31:45 +01:00

Adds class type to controller options

This commit is contained in:
RipleyTom 2019-02-25 18:47:16 +01:00 committed by Ani
parent b107718869
commit ad6b0ee122
9 changed files with 59 additions and 15 deletions

View File

@ -1,4 +1,4 @@
#include "stdafx.h"
#include "stdafx.h"
#include "Emu/System.h"
#include "Emu/IdManager.h"
#include "Emu/Cell/PPUModule.h"
@ -394,7 +394,7 @@ error_code cellPadPeriphGetInfo(vm::ptr<CellPadPeriphInfo> info)
info->port_setting[i] = config->port_setting[i];
info->device_capability[i] = pads[i]->m_device_capability;
info->device_type[i] = pads[i]->m_device_type;
info->pclass_type[i] = CELL_PAD_PCLASS_TYPE_STANDARD;
info->pclass_type[i] = pads[i]->m_class_type;
info->pclass_profile[i] = 0x0;
}
@ -429,7 +429,7 @@ error_code cellPadPeriphGetData(u32 port_no, vm::ptr<CellPadPeriphData> data)
return CELL_PAD_ERROR_NO_DEVICE;
// todo: support for 'unique' controllers, which goes in offsets 24+ in padData
data->pclass_type = CELL_PAD_PCLASS_TYPE_STANDARD;
data->pclass_type = pad->m_class_type;
data->pclass_profile = 0x0;
return cellPadGetData(port_no, vm::get_addr(&data->cellpad_data));

View File

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <cmath>
#include <vector>
@ -169,6 +169,7 @@ struct Pad
u32 m_port_status;
u32 m_device_capability;
u32 m_device_type;
u32 m_class_type;
// Cable State: 0 - 1 plugged in ?
u8 m_cable_state;
@ -212,11 +213,12 @@ struct Pad
u16 m_sensor_z;
u16 m_sensor_g;
void Init(u32 port_status, u32 device_capability, u32 device_type)
void Init(u32 port_status, u32 device_capability, u32 device_type, u32 class_type)
{
m_port_status = port_status;
m_device_capability = device_capability;
m_device_type = device_type;
m_class_type = class_type;
}
Pad(u32 port_status, u32 device_capability, u32 device_type)
@ -348,6 +350,8 @@ struct pad_config final : cfg::node
cfg::_int<0, 100> l_stick_lerp_factor{ this, "Left Stick Lerp Factor", 100 };
cfg::_int<0, 100> r_stick_lerp_factor{ this, "Right Stick Lerp Factor", 100 };
cfg::_int<0, 5> device_class_type{ this, "Device Class Type", 0 };
bool load()
{
if (fs::file cfg_file{ cfg_name, fs::read })

View File

@ -1,4 +1,4 @@
#include "ds4_pad_handler.h"
#include "ds4_pad_handler.h"
#include <thread>
@ -805,7 +805,8 @@ bool ds4_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::strin
(
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
CELL_PAD_DEV_TYPE_STANDARD,
p_profile->device_class_type
);
// 'keycode' here is just 0 as we have to manually calculate this

View File

@ -1,4 +1,4 @@
// This makes debugging on windows less painful
// This makes debugging on windows less painful
//#define HAVE_LIBEVDEV
#ifdef HAVE_LIBEVDEV
@ -940,7 +940,8 @@ 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
CELL_PAD_DEV_TYPE_STANDARD,
p_profile->device_class_type
);
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL2, find_key(p_profile->triangle), CELL_PAD_CTRL_TRIANGLE);

View File

@ -545,7 +545,8 @@ 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
CELL_PAD_DEV_TYPE_STANDARD,
p_profile->device_class_type
);
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, find_key(p_profile->left), CELL_PAD_CTRL_LEFT);

View File

@ -1,4 +1,4 @@
#ifdef _WIN32
#ifdef _WIN32
#include "mm_joystick_handler.h"
mm_joystick_handler::mm_joystick_handler() : PadHandlerBase(pad_handler::mm)
@ -148,7 +148,8 @@ bool mm_joystick_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::s
(
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
CELL_PAD_DEV_TYPE_STANDARD,
p_profile->device_class_type
);
joy_device->trigger_left = find_key(p_profile->l2);

View File

@ -1,4 +1,4 @@
#include <QCheckBox>
#include <QCheckBox>
#include <QGroupBox>
#include <QPushButton>
#include <QVBoxLayout>
@ -169,6 +169,13 @@ pad_settings_dialog::pad_settings_dialog(QWidget *parent)
// Refresh Button
connect(ui->b_refresh, &QPushButton::clicked, this, &pad_settings_dialog::RefreshInputTypes);
ui->chooseClass->addItem(tr("Standard (Pad)"));
ui->chooseClass->addItem(tr("Guitar"));
ui->chooseClass->addItem(tr("Drum"));
ui->chooseClass->addItem(tr("DJ"));
ui->chooseClass->addItem(tr("Dance Mat"));
ui->chooseClass->addItem(tr("Navigation"));
// Initialize configurable buttons
InitButtons();
@ -467,6 +474,8 @@ void pad_settings_dialog::ReloadButtons()
m_min_force = m_handler->vibration_min;
m_max_force = m_handler->vibration_max;
ui->chooseClass->setCurrentIndex(m_handler_cfg.device_class_type);
// Enable Mouse Deadzones
std::vector<std::string> mouse_dz_range_x = m_handler_cfg.mouse_deadzone_x.to_list();
ui->mouse_dz_x->setRange(std::stoi(mouse_dz_range_x.front()), std::stoi(mouse_dz_range_x.back()));
@ -551,6 +560,7 @@ void pad_settings_dialog::ReactivateButtons()
ui->chooseProfile->setFocusPolicy(Qt::WheelFocus);
ui->chooseHandler->setFocusPolicy(Qt::WheelFocus);
ui->chooseDevice->setFocusPolicy(Qt::WheelFocus);
ui->chooseClass->setFocusPolicy(Qt::WheelFocus);
}
void pad_settings_dialog::RepaintPreviewLabel(QLabel* l, int dz, int w, int x, int y)
@ -726,6 +736,8 @@ void pad_settings_dialog::UpdateLabel(bool is_reset)
m_padButtons->button(entry.first)->setText(entry.second.text);
}
ui->chooseClass->setCurrentIndex(m_handler_cfg.device_class_type);
}
void pad_settings_dialog::SwitchButtons(bool is_enabled)
@ -778,6 +790,7 @@ void pad_settings_dialog::OnPadButtonClicked(int id)
ui->chooseProfile->setFocusPolicy(Qt::ClickFocus);
ui->chooseHandler->setFocusPolicy(Qt::ClickFocus);
ui->chooseDevice->setFocusPolicy(Qt::ClickFocus);
ui->chooseClass->setFocusPolicy(Qt::ClickFocus);
m_last_pos = QCursor::pos();
@ -892,6 +905,7 @@ void pad_settings_dialog::ChangeInputType()
// Handle empty device list
bool config_enabled = force_enable || (m_handler->m_type != pad_handler::null && ui->chooseDevice->count() > 0);
ui->chooseDevice->setEnabled(config_enabled);
ui->chooseClass->setEnabled(config_enabled);
if (config_enabled)
{
@ -1062,6 +1076,8 @@ void pad_settings_dialog::SaveProfile()
m_handler_cfg.r_stick_lerp_factor.set(ui->right_stick_lerp->value() * 100);
}
m_handler_cfg.device_class_type.set(ui->chooseClass->currentIndex());
m_handler_cfg.save();
}

View File

@ -1458,6 +1458,25 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_29">
<property name="spacing">
<number>10</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Device Class:</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_26">
<item>
<widget class="QComboBox" name="chooseClass"/>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View File

@ -1,4 +1,4 @@

#ifdef _WIN32
#include "xinput_pad_handler.h"
@ -485,7 +485,8 @@ bool xinput_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::st
(
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
CELL_PAD_DEV_TYPE_STANDARD,
p_profile->device_class_type
);
pad->m_buttons.emplace_back(CELL_PAD_BTN_OFFSET_DIGITAL1, FindKeyCode(button_list, p_profile->up), CELL_PAD_CTRL_UP);