From 2d103407f8715a4feff64012bd2d195878965822 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sun, 13 Sep 2026 18:24:32 +0200 Subject: [PATCH] cellMic: add EyeToy and PsEye types --- rpcs3/Emu/Cell/Modules/cellAudioIn.h | 2 ++ rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp | 44 ++++++++++++++++++++++++ rpcs3/Emu/Cell/Modules/cellMic.cpp | 16 ++++++++- rpcs3/Emu/Cell/Modules/cellMic.h | 13 +++++-- rpcs3/Emu/Cell/lv2/sys_usbd.cpp | 6 ++++ rpcs3/Emu/Io/usb_microphone.h | 2 ++ rpcs3/Emu/system_config_types.cpp | 2 ++ rpcs3/Emu/system_config_types.h | 2 ++ rpcs3/rpcs3qt/emu_settings.cpp | 2 ++ rpcs3/rpcs3qt/settings_dialog.cpp | 2 ++ 10 files changed, 88 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellAudioIn.h b/rpcs3/Emu/Cell/Modules/cellAudioIn.h index 7ceaa2d2bd..512fa73a84 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudioIn.h +++ b/rpcs3/Emu/Cell/Modules/cellAudioIn.h @@ -25,6 +25,8 @@ enum CellAudioInDeviceMode enum CellAudioInPortType { + CELL_AUDIO_IN_PORT_EYETOY1 = 1, // speculative, EyeToy + CELL_AUDIO_IN_PORT_EYETOY2 = 2, // speculative, PS EYE CELL_AUDIO_IN_PORT_USB = 3, CELL_AUDIO_IN_PORT_BLUETOOTH = 4, }; diff --git a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp index ce7f9fd6c9..0b2a16ffa4 100644 --- a/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAvconfExt.cpp @@ -89,6 +89,50 @@ avconf_manager::avconf_manager() } break; } + case microphone_handler::eye_toy: + { + for (u32 index = 0; index < mic_list.size(); index++) + { + device_info device {}; + device.info.portType = CELL_AUDIO_IN_PORT_EYETOY1; + device.info.availableModeCount = 1; + device.info.state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE; + device.info.deviceId = 0xE11CC0DE + curindex; + device.info.type = 0xC0DEE11C; + device.info.availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM; + device.info.availableModes[0].channel = CELL_AUDIO_IN_CHNUM_2; + device.info.availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ; + device.info.deviceNumber = curindex; + device.full_device_name = mic_list[index]; + strcpy_trunc(device.info.name, device.full_device_name); + + devices.push_back(std::move(device)); + curindex++; + } + break; + } + case microphone_handler::ps_eye: + { + for (u32 index = 0; index < mic_list.size(); index++) + { + device_info device {}; + device.info.portType = CELL_AUDIO_IN_PORT_EYETOY2; + device.info.availableModeCount = 1; + device.info.state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE; + device.info.deviceId = 0xE11CC0DE + curindex; + device.info.type = 0xC0DEE11C; + device.info.availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM; + device.info.availableModes[0].channel = CELL_AUDIO_IN_CHNUM_2; + device.info.availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ; + device.info.deviceNumber = curindex; + device.full_device_name = mic_list[index]; + strcpy_trunc(device.info.name, device.full_device_name); + + devices.push_back(std::move(device)); + curindex++; + } + break; + } case microphone_handler::real_singstar: case microphone_handler::singstar: { diff --git a/rpcs3/Emu/Cell/Modules/cellMic.cpp b/rpcs3/Emu/Cell/Modules/cellMic.cpp index 0c58d2ec7e..2d4efa9aa5 100644 --- a/rpcs3/Emu/Cell/Modules/cellMic.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMic.cpp @@ -208,6 +208,8 @@ u32 mic_context::register_device(const std::string& device_name) case microphone_handler::standard: case microphone_handler::real_singstar: case microphone_handler::rocksmith: + case microphone_handler::eye_toy: + case microphone_handler::ps_eye: { microphone_device& device = ::at32(mic_list, index); device = microphone_device(g_cfg.audio.microphone_type.get()); @@ -328,6 +330,8 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co switch (device_type) { case microphone_handler::standard: + case microphone_handler::eye_toy: + case microphone_handler::ps_eye: break; case microphone_handler::singstar: case microphone_handler::real_singstar: @@ -729,6 +733,8 @@ void microphone_device::get_data(const u32 num_samples) } case microphone_handler::standard: case microphone_handler::rocksmith: + case microphone_handler::eye_toy: + case microphone_handler::ps_eye: { constexpr u8 channel_size = bit_resolution / 8; const usz bufsize = num_samples * sample_size; @@ -1458,7 +1464,15 @@ error_code cellMicGetType(s32 dev_num, vm::ptr ptr_type) return CELL_MICIN_ERROR_NOT_INIT; // TODO: get proper type (log message is trace because of massive spam) - *ptr_type = CELLMIC_TYPE_USBAUDIO; // Needed for Guitar Hero: Warriors of Rock (BLUS30487) + if (dev_num < static_cast(mic_thr.mic_list.size())) + { + const microphone_device& device = ::at32(mic_thr.mic_list, dev_num); + *ptr_type = device.get_mic_type(); + } + else + { + *ptr_type = CELLMIC_TYPE_UNDEF; + } return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellMic.h b/rpcs3/Emu/Cell/Modules/cellMic.h index 7d09546580..5f9eb79549 100644 --- a/rpcs3/Emu/Cell/Modules/cellMic.h +++ b/rpcs3/Emu/Cell/Modules/cellMic.h @@ -114,8 +114,8 @@ enum CellMicType : s32 { CELLMIC_TYPE_UNDEF = -1, CELLMIC_TYPE_UNKNOWN = 0, - CELLMIC_TYPE_EYETOY1 = 1, - CELLMIC_TYPE_EYETOY2 = 2, + CELLMIC_TYPE_EYETOY1 = 1, // EyeToy + CELLMIC_TYPE_EYETOY2 = 2, // PS EYE CELLMIC_TYPE_USBAUDIO = 3, CELLMIC_TYPE_BLUETOOTH = 4, CELLMIC_TYPE_A2DP = 5, @@ -311,6 +311,15 @@ public: return 1; // BE } } + s32 get_mic_type() const + { + switch(device_type) + { + case microphone_handler::eye_toy: return CELLMIC_TYPE_EYETOY1; + case microphone_handler::ps_eye: return CELLMIC_TYPE_EYETOY2; + default: return CELLMIC_TYPE_USBAUDIO; // Needed for Guitar Hero: Warriors of Rock (BLUS30487) + } + } u32 read_raw(u8* buf, u32 size) { return rbuf_raw.read_bytes(buf, size); } u32 read_dsp(u8* buf, u32 size) { return rbuf_dsp.read_bytes(buf, size); } diff --git a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp index 5a1e8148cb..373fd020af 100644 --- a/rpcs3/Emu/Cell/lv2/sys_usbd.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_usbd.cpp @@ -575,6 +575,12 @@ usb_handler_thread::usb_handler_thread() case microphone_handler::standard: usb_devices.push_back(std::make_shared(0, get_new_location(), MicType::Logitech)); break; + case microphone_handler::eye_toy: + usb_devices.push_back(std::make_shared(0, get_new_location(), MicType::EyeToy)); + break; + case microphone_handler::ps_eye: + usb_devices.push_back(std::make_shared(0, get_new_location(), MicType::PsEye)); + break; case microphone_handler::real_singstar: case microphone_handler::singstar: usb_devices.push_back(std::make_shared(0, get_new_location(), MicType::SingStar)); diff --git a/rpcs3/Emu/Io/usb_microphone.h b/rpcs3/Emu/Io/usb_microphone.h index d8819a099b..374aa642df 100644 --- a/rpcs3/Emu/Io/usb_microphone.h +++ b/rpcs3/Emu/Io/usb_microphone.h @@ -7,6 +7,8 @@ enum class MicType SingStar, Logitech, Rocksmith, + EyeToy, + PsEye, }; enum diff --git a/rpcs3/Emu/system_config_types.cpp b/rpcs3/Emu/system_config_types.cpp index ccb029d94d..0f40e72369 100644 --- a/rpcs3/Emu/system_config_types.cpp +++ b/rpcs3/Emu/system_config_types.cpp @@ -358,6 +358,8 @@ void fmt_class_string::format(std::string& out, u64 arg) case microphone_handler::singstar: return "SingStar"; case microphone_handler::real_singstar: return "Real SingStar"; case microphone_handler::rocksmith: return "Rocksmith"; + case microphone_handler::eye_toy: return "Eye Toy"; + case microphone_handler::ps_eye: return "PS Eye"; } return unknown; diff --git a/rpcs3/Emu/system_config_types.h b/rpcs3/Emu/system_config_types.h index 49c529caa7..4fa7eed507 100644 --- a/rpcs3/Emu/system_config_types.h +++ b/rpcs3/Emu/system_config_types.h @@ -178,6 +178,8 @@ enum class microphone_handler singstar, real_singstar, rocksmith, + eye_toy, + ps_eye, }; enum class pad_handler_mode diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index 1195dfeab7..bd91926d38 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -1142,6 +1142,8 @@ QString emu_settings::GetLocalizedSetting(const QString& original, emu_settings_ case microphone_handler::singstar: return tr("SingStar", "Microphone handler"); case microphone_handler::real_singstar: return tr("Real SingStar", "Microphone handler"); case microphone_handler::rocksmith: return tr("Rocksmith", "Microphone handler"); + case microphone_handler::eye_toy: return tr("Eye Toy", "Microphone handler"); + case microphone_handler::ps_eye: return tr("PS Eye", "Microphone handler"); } break; case emu_settings_type::KeyboardHandler: diff --git a/rpcs3/rpcs3qt/settings_dialog.cpp b/rpcs3/rpcs3qt/settings_dialog.cpp index d6196130b2..f384ec47cd 100644 --- a/rpcs3/rpcs3qt/settings_dialog.cpp +++ b/rpcs3/rpcs3qt/settings_dialog.cpp @@ -880,6 +880,8 @@ settings_dialog::settings_dialog(std::shared_ptr gui_settings, std break; case microphone_handler::real_singstar: case microphone_handler::rocksmith: + case microphone_handler::eye_toy: + case microphone_handler::ps_eye: max = 1; break; case microphone_handler::null: