diff --git a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp index acf0d6aa8c..7a6efe29f7 100644 --- a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp @@ -495,12 +495,6 @@ usb_handler_thread::usb_handler_thread() sys_usbd.notice("Adding emulated Buzz! buzzer (5-7 players)"); usb_devices.push_back(std::make_shared(4, 6, get_new_location())); } - - if (g_cfg.io.gametablet == gametablet_handler::enabled) - { - sys_usbd.notice("Adding emulated uDraw GameTablet"); - usb_devices.push_back(std::make_shared(get_new_location())); - } } usb_handler_thread::~usb_handler_thread() @@ -868,17 +862,27 @@ void connect_usb_controller(u8 index, input::product_type type) } } - if (!already_connected && type == input::product_type::guncon_3) + if (!already_connected) { - if (!g_cfg_guncon3.load()) + if (type == input::product_type::guncon_3) { - sys_usbd.notice("Could not load GunCon3 config. Using defaults."); - } + if (!g_cfg_guncon3.load()) + { + sys_usbd.notice("Could not load GunCon3 config. Using defaults."); + } - sys_usbd.success("Adding emulated GunCon3 (controller %d)", index); - std::shared_ptr dev = std::make_shared(index, usbh->get_new_location()); - usbh->connect_usb_device(dev, true); - usbh->pad_to_usb.emplace(index, std::pair(type, dev)); + sys_usbd.success("Adding emulated GunCon3 (controller %d)", index); + std::shared_ptr dev = std::make_shared(index, usbh->get_new_location()); + usbh->connect_usb_device(dev, true); + usbh->pad_to_usb.emplace(index, std::pair(type, dev)); + } + if (type == input::product_type::udraw_gametablet) + { + sys_usbd.success("Adding emulated uDraw GameTablet (controller %d)", index); + std::shared_ptr dev = std::make_shared(index, usbh->get_new_location()); + usbh->connect_usb_device(dev, true); + usbh->pad_to_usb.emplace(index, std::pair(type, dev)); + } } } diff --git a/rpcs3/Emu/Io/GameTablet.cpp b/rpcs3/Emu/Io/GameTablet.cpp index e1f76d1acd..56286a8bff 100644 --- a/rpcs3/Emu/Io/GameTablet.cpp +++ b/rpcs3/Emu/Io/GameTablet.cpp @@ -62,8 +62,9 @@ enum Dpad_None = 0x0f }; -usb_device_gametablet::usb_device_gametablet(const std::array& location) +usb_device_gametablet::usb_device_gametablet(u32 controller_index, const std::array& location) : usb_device_emulated(location) + , m_controller_index(controller_index) { device = UsbDescriptorNode(USB_DESCRIPTOR_DEVICE, UsbDeviceDescriptor { @@ -163,7 +164,7 @@ void usb_device_gametablet::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endp ensure(buf_size >= sizeof(GameTablet_data)); transfer->fake = true; - transfer->expected_count = 27; + transfer->expected_count = sizeof(GameTablet_data); transfer->expected_result = HC_CC_NOERR; // Interrupt transfers are slow (6ms, TODO accurate measurement) transfer->expected_time = get_timestamp() + 6000; @@ -196,9 +197,7 @@ void usb_device_gametablet::interrupt_transfer(u32 buf_size, u8* buf, u32 /*endp std::lock_guard lock(pad::g_pad_mutex); const auto gamepad_handler = pad::get_current_handler(); const auto& pads = gamepad_handler->GetPads(); - - constexpr s32 pad_index = 1; // Player2 - const auto& pad = ::at32(pads, pad_index); + const auto& pad = ::at32(pads, m_controller_index); if (pad->m_port_status & CELL_PAD_STATUS_CONNECTED) { for (Button& button : pad->m_buttons) diff --git a/rpcs3/Emu/Io/GameTablet.h b/rpcs3/Emu/Io/GameTablet.h index 832e31853c..7fdbf8eaa6 100644 --- a/rpcs3/Emu/Io/GameTablet.h +++ b/rpcs3/Emu/Io/GameTablet.h @@ -5,9 +5,12 @@ class usb_device_gametablet : public usb_device_emulated { public: - usb_device_gametablet(const std::array& location); + usb_device_gametablet(u32 controller_index, const std::array& location); ~usb_device_gametablet(); void control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue, u16 wIndex, u16 wLength, u32 buf_size, u8* buf, UsbTransfer* transfer) override; void interrupt_transfer(u32 buf_size, u8* buf, u32 endpoint, UsbTransfer* transfer) override; + +private: + u32 m_controller_index; }; diff --git a/rpcs3/Emu/Io/pad_types.h b/rpcs3/Emu/Io/pad_types.h index cfda7cf6c0..dd00c3de10 100644 --- a/rpcs3/Emu/Io/pad_types.h +++ b/rpcs3/Emu/Io/pad_types.h @@ -148,6 +148,7 @@ enum // these are used together with pad->is_fake_pad to capture input events for usbd/gem/move without conflicting with cellPad CELL_PAD_FAKE_TYPE_FIRST = 0xa000, CELL_PAD_FAKE_TYPE_GUNCON3 = 0xa000, + CELL_PAD_FAKE_TYPE_GAMETABLET = 0xa003, CELL_PAD_FAKE_TYPE_LAST, CELL_PAD_PCLASS_TYPE_MAX // last item diff --git a/rpcs3/Emu/system_config.h b/rpcs3/Emu/system_config.h index 8036dd38bb..9028772dd8 100644 --- a/rpcs3/Emu/system_config.h +++ b/rpcs3/Emu/system_config.h @@ -273,7 +273,6 @@ struct cfg_root : cfg::node cfg::_enum buzz{ this, "Buzz emulated controller", buzz_handler::null }; cfg::_enum turntable{this, "Turntable emulated controller", turntable_handler::null}; cfg::_enum ghltar{this, "GHLtar emulated controller", ghltar_handler::null}; - cfg::_enum gametablet{this, "GameTablet emulated controller", gametablet_handler::disabled}; cfg::_enum pad_mode{this, "Pad handler mode", pad_handler_mode::single_threaded, true}; cfg::_bool keep_pads_connected{this, "Keep pads connected", false, true}; cfg::uint<0, 100'000> pad_sleep{this, "Pad handler sleep (microseconds)", 1'000, true}; diff --git a/rpcs3/Emu/system_config_types.cpp b/rpcs3/Emu/system_config_types.cpp index f093885a7a..a71e2abde9 100644 --- a/rpcs3/Emu/system_config_types.cpp +++ b/rpcs3/Emu/system_config_types.cpp @@ -510,21 +510,6 @@ void fmt_class_string::format(std::string& out, u64 arg) }); } -template <> -void fmt_class_string::format(std::string& out, u64 arg) -{ - format_enum(out, arg, [](auto value) - { - switch (value) - { - case gametablet_handler::disabled: return "Disabled"; - case gametablet_handler::enabled: return "Enabled"; - } - - return unknown; - }); -} - template <> void fmt_class_string::format(std::string& out, u64 arg) { diff --git a/rpcs3/Emu/system_config_types.h b/rpcs3/Emu/system_config_types.h index 048289f274..f1aedbdde4 100644 --- a/rpcs3/Emu/system_config_types.h +++ b/rpcs3/Emu/system_config_types.h @@ -167,12 +167,6 @@ enum class ghltar_handler two_controllers, }; -enum class gametablet_handler -{ - disabled, - enabled, -}; - enum class microphone_handler { null, diff --git a/rpcs3/Input/product_info.cpp b/rpcs3/Input/product_info.cpp index 3757239be3..fa0e847989 100644 --- a/rpcs3/Input/product_info.cpp +++ b/rpcs3/Input/product_info.cpp @@ -204,6 +204,17 @@ namespace input .pclass_profile = 0x0, .capabilites = 0x0 } + }, + { + product_type::udraw_gametablet, + { + .type = product_type::udraw_gametablet, + .class_id = CELL_PAD_FAKE_TYPE_GAMETABLET, + .vendor_id = vendor_id::bda, + .product_id = product_id::udraw_gametablet, + .pclass_profile = 0x0, + .capabilites = 0x0 + } } }; diff --git a/rpcs3/Input/product_info.h b/rpcs3/Input/product_info.h index 2ae8a937ec..f9f2126fa3 100644 --- a/rpcs3/Input/product_info.h +++ b/rpcs3/Input/product_info.h @@ -19,6 +19,7 @@ namespace input ps_move_navigation, ride_skateboard, guncon_3, + udraw_gametablet, }; enum vendor_id @@ -27,6 +28,7 @@ namespace input namco = 0x0B9A, // Namco sony_cea = 0x12BA, // Sony Computer Entertainment America konami_de = 0x1CCF, // Konami Digital Entertainment + bda = 0x20D6, // Bensussen Deutsch & Associates }; enum product_id @@ -43,6 +45,7 @@ namespace input dance_dance_revolution_mat = 0x1010, // Dance Dance Revolution Dance Mat Controller ride_skateboard = 0x0400, // Tony Hawk RIDE Skateboard Controller guncon_3 = 0x0800, // GunCon 3 Controller + udraw_gametablet = 0xCB17, // uDraw GameTablet Controller }; struct product_info diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index 2cf3252215..fc5c0a103a 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -1088,13 +1088,6 @@ QString emu_settings::GetLocalizedSetting(const QString& original, emu_settings_ case ghltar_handler::two_controllers: return tr("2 controllers", "GHLtar handler"); } break; - case emu_settings_type::GameTablet: - switch (static_cast(index)) - { - case gametablet_handler::disabled: return tr("Disabled", "GameTablet handler"); - case gametablet_handler::enabled: return tr("Enabled", "GameTablet handler"); - } - break; case emu_settings_type::InternetStatus: switch (static_cast(index)) { diff --git a/rpcs3/rpcs3qt/emu_settings_type.h b/rpcs3/rpcs3qt/emu_settings_type.h index 38b19a0691..3885dfa9a3 100644 --- a/rpcs3/rpcs3qt/emu_settings_type.h +++ b/rpcs3/rpcs3qt/emu_settings_type.h @@ -160,7 +160,6 @@ enum class emu_settings_type Buzz, Turntable, GHLtar, - GameTablet, MidiDevices, SDLMappings, @@ -350,7 +349,6 @@ inline static const QMap settings_location = { emu_settings_type::Buzz, { "Input/Output", "Buzz emulated controller" }}, { emu_settings_type::Turntable, { "Input/Output", "Turntable emulated controller" }}, { emu_settings_type::GHLtar, { "Input/Output", "GHLtar emulated controller" }}, - { emu_settings_type::GameTablet, { "Input/Output", "GameTablet emulated controller" }}, { emu_settings_type::MidiDevices, { "Input/Output", "Emulated Midi devices" }}, { emu_settings_type::SDLMappings, { "Input/Output", "Load SDL GameController Mappings" }}, diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.cpp b/rpcs3/rpcs3qt/pad_settings_dialog.cpp index 5cbfdff864..018b3d26be 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/pad_settings_dialog.cpp @@ -182,6 +182,7 @@ pad_settings_dialog::pad_settings_dialog(std::shared_ptr gui_setti ui->chooseClass->addItem(tr("PS Move Navigation"), u32{CELL_PAD_PCLASS_TYPE_NAVIGATION}); ui->chooseClass->addItem(tr("Skateboard"), u32{CELL_PAD_PCLASS_TYPE_SKATEBOARD}); ui->chooseClass->addItem(tr("GunCon 3"), u32{CELL_PAD_FAKE_TYPE_GUNCON3}); + ui->chooseClass->addItem(tr("uDraw GameTablet"), u32{CELL_PAD_FAKE_TYPE_GAMETABLET}); connect(ui->chooseClass, QOverload::of(&QComboBox::currentIndexChanged), this, [this](int index) { @@ -1724,6 +1725,11 @@ void pad_settings_dialog::HandleDeviceClassChange(u32 class_id) const ui->chooseProduct->addItem(tr("GunCon 3", "GunCon 3 Controller"), static_cast(product.type)); break; } + case input::product_type::udraw_gametablet: + { + ui->chooseProduct->addItem(tr("uDraw GameTablet", "uDraw GameTablet Controller"), static_cast(product.type)); + break; + } } } } diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index 3bdfd7246a..e8fee6403f 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -1224,9 +1224,6 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std m_emu_settings->EnhanceComboBox(ui->ghltarBox, emu_settings_type::GHLtar); SubscribeTooltip(ui->gb_ghltar_emulated, tooltips.settings.ghltar); - m_emu_settings->EnhanceComboBox(ui->gameTabletBox, emu_settings_type::GameTablet); - SubscribeTooltip(ui->gametablet_emulated, tooltips.settings.gametablet); - m_emu_settings->EnhanceCheckBox(ui->backgroundInputBox, emu_settings_type::BackgroundInput); SubscribeTooltip(ui->backgroundInputBox, tooltips.settings.background_input); diff --git a/rpcs3/rpcs3qt/settings_dialog.ui b/rpcs3/rpcs3qt/settings_dialog.ui index ef7115c67f..86b54687ae 100644 --- a/rpcs3/rpcs3qt/settings_dialog.ui +++ b/rpcs3/rpcs3qt/settings_dialog.ui @@ -1731,18 +1731,6 @@ - - - - GameTablet - - - - - - - - diff --git a/rpcs3/rpcs3qt/tooltips.h b/rpcs3/rpcs3qt/tooltips.h index 94dc6c497d..cf69a5eb5f 100644 --- a/rpcs3/rpcs3qt/tooltips.h +++ b/rpcs3/rpcs3qt/tooltips.h @@ -231,7 +231,6 @@ public: const QString buzz = tr("Buzz! support.\nSelect 1 or 2 controllers if the game requires Buzz! controllers and you don't have real controllers.\nSelect Null if the game has support for DualShock or if you have real Buzz! controllers."); const QString turntable = tr("DJ Hero Turntable controller support.\nSelect 1 or 2 controllers if the game requires DJ Hero Turntable controllers and you don't have real turntable controllers.\nSelect Null if the game has support for DualShock or if you have real turntable controllers.\nA real turntable controller can be used at the same time as an emulated turntable controller."); const QString ghltar = tr("Guitar Hero Live (GHL) Guitar controller support.\nSelect 1 or 2 controllers if the game requires GHL Guitar controllers and you don't have real guitar controllers.\nSelect Null if the game has support for DualShock or if you have real guitar controllers.\nA real guitar controller can be used at the same time as an emulated guitar controller."); - const QString gametablet = tr("uDraw GameTablet emulated controller support. It requires a Mouse Handler enabled.\nDisable to use a physical uDraw GameTablet device.\n• uDraw Studio: Instant Artist requires Pad1=Connected and Pad2=Null.\n• Marvel Super Hero Squad: Comic Combat requires Pad1=Null and Pad2=Connected."); const QString background_input = tr("Allows pad and keyboard input while the game window is unfocused."); const QString show_move_cursor = tr("Shows the raw position of the PS Move input.\nThis can be very helpful during calibration screens."); const QString midi_devices = tr("Select up to 3 emulated MIDI devices and their types.");