diff --git a/rpcs3/Emu/Cell/Modules/cellAdec.cpp b/rpcs3/Emu/Cell/Modules/cellAdec.cpp index 73275fc87b..6e8a637a72 100644 --- a/rpcs3/Emu/Cell/Modules/cellAdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAdec.cpp @@ -8,6 +8,8 @@ #include #include "util/asm.hpp" +LOG_CHANNEL(cellAdec); + // These need to be defined somewhere to access the LLE functions vm::gvar g_cell_adec_core_ops_ac3; vm::gvar g_cell_adec_core_ops_atrac3; @@ -31,26 +33,24 @@ vm::gvar g_cell_adec_core_ops_truehd; vm::gvar g_cell_adec_core_ops_wma; vm::gvar g_cell_adec_core_ops_WmaLsl; vm::gvar g_cell_adec_core_ops_WmaPro; -[[noreturn]] error_code _SceAdecCorrectPtsValue_Celp8(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_Celp(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_Ddp(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_DtsCore(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_DtsHd_Core(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_DtsHd(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_DtsLbr(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_Aac(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_mpmc(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_M4Aac(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_M4Aac2ch(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_M4Aac2chmod(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_Mp3s(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_mpmcl1(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_truehd(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_wma(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_WmaLsl(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } -[[noreturn]] error_code _SceAdecCorrectPtsValue_WmaPro(ppu_thread&, vm::ptr, vm::ptr){ fmt::throw_exception("Unreachable"); } - -LOG_CHANNEL(cellAdec); +error_code _SceAdecCorrectPtsValue_Celp8(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_Celp(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_Ddp(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_DtsCore(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_DtsHd_Core(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_DtsHd(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_DtsLbr(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_Aac(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_mpmc(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_M4Aac(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_M4Aac2ch(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_M4Aac2chmod(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_Mp3s(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_mpmcl1(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_truehd(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_wma(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_WmaLsl(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } +error_code _SceAdecCorrectPtsValue_WmaPro(ppu_thread&, vm::ptr, vm::ptr){ UNIMPLEMENTED_FUNC(cellAdec); return CELL_OK; } template <> void fmt_class_string::format(std::string& out, u64 arg) @@ -394,12 +394,13 @@ error_code AdecContext::set_pcm_item(s32 pcm_handle, vm::ptr pcm_addr, u32 return CELL_OK; } -error_code AdecContext::link_frame(s32 pcm_handle) +error_code AdecContext::link_frame(ppu_thread& ppu, s32 pcm_handle) { - std::lock_guard lock{mutex}; + ensure(sys_mutex_lock(ppu, mutex, 0) == CELL_OK); // Error code isn't checked on LLE if (verify_pcm_handle(pcm_handle) == static_cast(CELL_ADEC_ERROR_FATAL)) { + ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE return CELL_ADEC_ERROR_FATAL; } @@ -419,23 +420,27 @@ error_code AdecContext::link_frame(s32 pcm_handle) } else { + ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE return CELL_ADEC_ERROR_FATAL; } + ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE return CELL_OK; } -error_code AdecContext::unlink_frame(s32 pcm_handle) +error_code AdecContext::unlink_frame(ppu_thread& ppu, s32 pcm_handle) { - std::lock_guard lock{mutex}; + ensure(sys_mutex_lock(ppu, mutex, 0) == CELL_OK); // Error code isn't checked on LLE if (verify_pcm_handle(pcm_handle) == static_cast(CELL_ADEC_ERROR_FATAL)) { + ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE return CELL_ADEC_ERROR_FATAL; } if (frames_head == -1 || frames_tail == -1) { + ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE return CELL_ADEC_ERROR_FATAL; } @@ -446,6 +451,7 @@ error_code AdecContext::unlink_frame(s32 pcm_handle) { if (pcm_handle != frames_tail) { + ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE return CELL_ADEC_ERROR_FATAL; } @@ -470,6 +476,7 @@ error_code AdecContext::unlink_frame(s32 pcm_handle) frames[prev].next = next; } + ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE return CELL_OK; } @@ -493,31 +500,31 @@ error_code AdecContext::correct_pts_value(ppu_thread& ppu, s32 pcm_handle, s8 co switch (correct_pts_type) { - case ADEC_CORRECT_PTS_VALUE_TYPE_EAC3: if (ppu_execute<&_SceAdecCorrectPtsValue_Ddp>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHD: if (ppu_execute<&_SceAdecCorrectPtsValue_DtsHd>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_CELP: if (ppu_execute<&_SceAdecCorrectPtsValue_Celp>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_M2AAC: if (ppu_execute<&_SceAdecCorrectPtsValue_Aac>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L2: if (ppu_execute<&_SceAdecCorrectPtsValue_mpmc>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_TRUEHD: if (ppu_execute<&_SceAdecCorrectPtsValue_truehd>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_DTS: if (ppu_execute<&_SceAdecCorrectPtsValue_DtsCore>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } + case ADEC_CORRECT_PTS_VALUE_TYPE_EAC3: return ppu_execute<&_SceAdecCorrectPtsValue_Ddp>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHD: return ppu_execute<&_SceAdecCorrectPtsValue_DtsHd>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_CELP: return ppu_execute<&_SceAdecCorrectPtsValue_Celp>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_M2AAC: return ppu_execute<&_SceAdecCorrectPtsValue_Aac>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L2: return ppu_execute<&_SceAdecCorrectPtsValue_mpmc>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_TRUEHD: return ppu_execute<&_SceAdecCorrectPtsValue_truehd>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_DTS: return ppu_execute<&_SceAdecCorrectPtsValue_DtsCore>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); case ADEC_CORRECT_PTS_VALUE_TYPE_M4AAC: switch (type.audioCodecType) { - case CELL_ADEC_TYPE_M4AAC: if (ppu_execute<&_SceAdecCorrectPtsValue_M4Aac>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case CELL_ADEC_TYPE_M4AAC_2CH: if (ppu_execute<&_SceAdecCorrectPtsValue_M4Aac2ch>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case CELL_ADEC_TYPE_M4AAC_2CH_MOD: if (ppu_execute<&_SceAdecCorrectPtsValue_M4Aac2chmod>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } + case CELL_ADEC_TYPE_M4AAC: return ppu_execute<&_SceAdecCorrectPtsValue_M4Aac>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case CELL_ADEC_TYPE_M4AAC_2CH: return ppu_execute<&_SceAdecCorrectPtsValue_M4Aac2ch>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case CELL_ADEC_TYPE_M4AAC_2CH_MOD: return ppu_execute<&_SceAdecCorrectPtsValue_M4Aac2chmod>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); default: return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_WMA: if (ppu_execute<&_SceAdecCorrectPtsValue_wma>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_DTSLBR: if (ppu_execute<&_SceAdecCorrectPtsValue_DtsLbr>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L1: if (ppu_execute<&_SceAdecCorrectPtsValue_mpmcl1>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_MP3S: if (ppu_execute<&_SceAdecCorrectPtsValue_Mp3s>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_CELP8: if (ppu_execute<&_SceAdecCorrectPtsValue_Celp8>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_WMAPRO: if (ppu_execute<&_SceAdecCorrectPtsValue_WmaPro>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } - case ADEC_CORRECT_PTS_VALUE_TYPE_WMALSL: if (ppu_execute<&_SceAdecCorrectPtsValue_WmaLsl>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } + case ADEC_CORRECT_PTS_VALUE_TYPE_WMA: return ppu_execute<&_SceAdecCorrectPtsValue_wma>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_DTSLBR: return ppu_execute<&_SceAdecCorrectPtsValue_DtsLbr>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L1: return ppu_execute<&_SceAdecCorrectPtsValue_mpmcl1>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_MP3S: return ppu_execute<&_SceAdecCorrectPtsValue_Mp3s>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_CELP8: return ppu_execute<&_SceAdecCorrectPtsValue_Celp8>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_WMAPRO: return ppu_execute<&_SceAdecCorrectPtsValue_WmaPro>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); + case ADEC_CORRECT_PTS_VALUE_TYPE_WMALSL: return ppu_execute<&_SceAdecCorrectPtsValue_WmaLsl>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHDCORE_UNK1: // Same as below - case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHDCORE_UNK2: if (ppu_execute<&_SceAdecCorrectPtsValue_DtsHd_Core>(ppu, +core_handle, au_pts) != CELL_OK) { return CELL_ADEC_ERROR_FATAL; } else { return CELL_OK; } + case ADEC_CORRECT_PTS_VALUE_TYPE_DTSHDCORE_UNK2: return ppu_execute<&_SceAdecCorrectPtsValue_DtsHd_Core>(ppu, +core_handle, au_pts) != CELL_OK ? static_cast(CELL_ADEC_ERROR_FATAL) : static_cast(CELL_OK); } // If the user didn't set a PTS, we need to interpolate from the previous PTS @@ -670,7 +677,7 @@ error_code adecNotifyPcmOut(ppu_thread& ppu, s32 pcmHandle, vm::ptr pcmAdd return ret; } - if (handle->link_frame(pcmHandle) == static_cast(CELL_ADEC_ERROR_FATAL)) + if (handle->link_frame(ppu, pcmHandle) == static_cast(CELL_ADEC_ERROR_FATAL)) { return CELL_ADEC_ERROR_FATAL; } @@ -682,7 +689,7 @@ error_code adecNotifyPcmOut(ppu_thread& ppu, s32 pcmHandle, vm::ptr pcmAdd return CELL_ADEC_ERROR_FATAL; } - vm::ptr pcm_item; + vm::ptr pcm_item{}; if (handle->get_pcm_item(pcmHandle, pcm_item) == static_cast(CELL_ADEC_ERROR_FATAL)) { @@ -811,7 +818,7 @@ error_code adecOpen(ppu_thread& ppu, vm::ptr type, vm::cptr handle) return ret; } + if (error_code ret = sys_mutex_destroy(ppu, handle->mutex); ret != CELL_OK) + { + return ret; + } + + handle->_this = vm::null; handle->sequence_state = AdecSequenceState::closed; @@ -1060,7 +1073,7 @@ error_code cellAdecGetPcm(ppu_thread& ppu, vm::ptr handle, vm::ptr< return ret; } - if (handle->unlink_frame(pcm_item->pcmHandle) == static_cast(CELL_ADEC_ERROR_FATAL)) + if (handle->unlink_frame(ppu, pcm_item->pcmHandle) == static_cast(CELL_ADEC_ERROR_FATAL)) { return CELL_ADEC_ERROR_FATAL; } diff --git a/rpcs3/Emu/Cell/Modules/cellAdec.h b/rpcs3/Emu/Cell/Modules/cellAdec.h index 752dbbaf3c..2673d5179c 100644 --- a/rpcs3/Emu/Cell/Modules/cellAdec.h +++ b/rpcs3/Emu/Cell/Modules/cellAdec.h @@ -1,6 +1,7 @@ #pragma once #include "cellPamf.h" // CellCodecTimeStamp +#include "../lv2/sys_mutex.h" // Error Codes enum CellAdecError : u32 @@ -591,16 +592,16 @@ struct AdecContext // CellAdecHandle = AdecContext* const be_t bitstream_info_size; - u64 mutex_attribute[5]{}; // sys_mutex_attribute_t - shared_mutex mutex; // sys_mutex_t + sys_mutex_attribute_t mutex_attribute{ 2, 0x20, 0x200, 0x2000, 0, 0, 0, "_adem03"_u64 }; + be_t mutex; // sys_mutex_t AdecOutputQueue pcm_queue; // Output queue for cellAdecGetPcm() AdecOutputQueue pcm_item_queue; // Output queue for cellAdecGetPcmItem() u8 reserved2[1028]; - AdecContext(vm::bptr _this, u32 this_size, const CellAdecType& type, const CellAdecResource& res, const CellAdecCb& callback, vm::bptr core_handle, vm::bcptr core_ops, - s32 frames_num, vm::bptr frames, u32 bitstream_info_size, u32 bitstream_infos_addr) + AdecContext(ppu_thread& ppu, vm::bptr _this, u32 this_size, const CellAdecType& type, const CellAdecResource& res, const CellAdecCb& callback, vm::bptr core_handle, + vm::bcptr core_ops, s32 frames_num, vm::bptr frames, u32 bitstream_info_size, u32 bitstream_infos_addr) : _this(_this), this_size(this_size), type(type), res(res), callback(callback), core_handle(core_handle), core_ops(core_ops), frames_num(frames_num), frames(frames), bitstream_info_size(bitstream_info_size) { ensure(this == _this.get_ptr()); @@ -609,6 +610,8 @@ struct AdecContext // CellAdecHandle = AdecContext* { new (&frames[i]) AdecFrame(i, bitstream_infos_addr + bitstream_info_size * i); } + + ensure(sys_mutex_create(ppu, _this.ptr(&AdecContext::mutex), _this.ptr(&AdecContext::mutex_attribute)) == CELL_OK); // Error code isn't checked on LLE } [[nodiscard]] error_code get_new_pcm_handle(vm::ptr au_info) const; @@ -617,8 +620,8 @@ struct AdecContext // CellAdecHandle = AdecContext* void set_state(s32 pcm_handle, u32 state) const; error_code get_pcm_item(s32 pcm_handle, vm::ptr& pcm_item) const; error_code set_pcm_item(s32 pcm_handle, vm::ptr pcm_addr, u32 pcm_size, vm::cpptr bitstream_info) const; - error_code link_frame(s32 pcm_handle); - error_code unlink_frame(s32 pcm_handle); + error_code link_frame(ppu_thread& ppu, s32 pcm_handle); + error_code unlink_frame(ppu_thread& ppu, s32 pcm_handle); void reset_frame(s32 pcm_handle) const; error_code correct_pts_value(ppu_thread& ppu, s32 pcm_handle, s8 correct_pts_type); };