From a8ada492b27cbeb7043a3475f32ffb9f7b7e3a90 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Tue, 28 Mar 2023 18:26:16 +0200 Subject: [PATCH] cellMic: fix registration index --- rpcs3/Emu/Cell/Modules/cellMic.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/Cell/Modules/cellMic.cpp b/rpcs3/Emu/Cell/Modules/cellMic.cpp index f1e14031e9..196e8e4fcb 100644 --- a/rpcs3/Emu/Cell/Modules/cellMic.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMic.cpp @@ -169,18 +169,21 @@ void mic_context::load_config_and_init() u32 mic_context::register_device(const std::string& device_name) { - usz index = 0; + usz index = mic_list.size(); for (usz i = 0; i < mic_list.size(); i++) { microphone_device& device = ::at32(mic_list, i); if (!device.is_registered()) { - index = i; + if (index == mic_list.size()) + { + index = i; + } } else if (device_name == device.get_device_name()) { // TODO: what happens if the device is registered twice? - return ::narrow(index); + return ::narrow(i); } }