diff --git a/rpcs3/Emu/Cell/Modules/cellMic.cpp b/rpcs3/Emu/Cell/Modules/cellMic.cpp index fd0bce6eae..bdcc0ef2df 100644 --- a/rpcs3/Emu/Cell/Modules/cellMic.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMic.cpp @@ -931,6 +931,8 @@ error_code cellMicReadRaw(s32 dev_num, vm::ptr data, s32 max_bytes) { cellMic.trace("cellMicReadRaw(dev_num=%d, data=0x%x, maxBytes=%d)", dev_num, data, max_bytes); + // TODO: CELL_MICIN_ERROR_PARAM + auto& mic_thr = g_fxo->get(); const std::lock_guard lock(mic_thr.mutex); if (!mic_thr.init) @@ -944,13 +946,15 @@ error_code cellMicReadRaw(s32 dev_num, vm::ptr data, s32 max_bytes) if (!mic.is_opened() || !(mic.get_signal_types() & CELLMIC_SIGTYPE_RAW)) return CELL_MICIN_ERROR_NOT_OPEN; - return mic.read_raw(vm::_ptr(data.addr()), max_bytes); + return not_an_error(mic.read_raw(vm::_ptr(data.addr()), max_bytes)); } error_code cellMicRead(s32 dev_num, vm::ptr data, u32 max_bytes) { cellMic.warning("cellMicRead(dev_num=%d, data=0x%x, maxBytes=0x%x)", dev_num, data, max_bytes); + // TODO: CELL_MICIN_ERROR_PARAM + auto& mic_thr = g_fxo->get(); const std::lock_guard lock(mic_thr.mutex); if (!mic_thr.init) @@ -964,7 +968,7 @@ error_code cellMicRead(s32 dev_num, vm::ptr data, u32 max_bytes) if (!mic.is_opened() || !(mic.get_signal_types() & CELLMIC_SIGTYPE_DSP)) return CELL_MICIN_ERROR_NOT_OPEN; - return mic.read_dsp(vm::_ptr(data.addr()), max_bytes); + return not_an_error(mic.read_dsp(vm::_ptr(data.addr()), max_bytes)); } error_code cellMicReadAux(s32 dev_num, vm::ptr data, s32 max_bytes) diff --git a/rpcs3/Emu/Cell/Modules/cellMic.h b/rpcs3/Emu/Cell/Modules/cellMic.h index 10adb2df1d..483f8fdff5 100644 --- a/rpcs3/Emu/Cell/Modules/cellMic.h +++ b/rpcs3/Emu/Cell/Modules/cellMic.h @@ -121,8 +121,7 @@ enum CellMicType : s32 enum { - MaxNumMicInputs = 8, - CELL_MAX_MICS = MaxNumMicInputs, + CELL_MAX_MICS = 8, MAX_MICS_PERMISSABLE = 4, NullDeviceID = -1, @@ -198,6 +197,8 @@ public: u32 read_bytes(u8* buf, const u32 size) { + ensure(buf); + u32 to_read = size > m_used ? m_used : size; if (!to_read) return 0;