cellAdec implementation part 1: abstraction layer#16332
cellAdec implementation part 1: abstraction layer#16332elad335 merged 7 commits intoRPCS3:masterfrom
Conversation
rpcs3/Emu/Cell/Modules/cellAdec.cpp
Outdated
| [[noreturn]] error_code _SceAdecCorrectPtsValue_truehd(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); } | ||
| [[noreturn]] error_code _SceAdecCorrectPtsValue_wma(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); } | ||
| [[noreturn]] error_code _SceAdecCorrectPtsValue_WmaLsl(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); } | ||
| [[noreturn]] error_code _SceAdecCorrectPtsValue_WmaPro(ppu_thread&, vm::ptr<void>, vm::ptr<CellCodecTimeStamp>){ fmt::throw_exception("Unreachable"); } |
There was a problem hiding this comment.
These functions are only called within the adecNotifyPcmOut() callback, which is called by the decoders, not the user. Since none of these decoders are implemented, we won't ever receive the callback.
There was a problem hiding this comment.
I had refrrain from putting noreturn attribute on any guest function, you should replace it with UNIMPLEMENTED_FUNC(cellAdec);
It's technically reachable using imports.
rpcs3/Emu/Cell/Modules/cellAdec.cpp
Outdated
| { | ||
| AdecTask task; | ||
| if (!adec.job.peek(task, 0, &adec.is_closed)) | ||
| 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; } |
There was a problem hiding this comment.
Don't put it on the same line, also there are so many you may want to use a macro
rpcs3/Emu/Cell/Modules/cellAdec.h
Outdated
| const be_t<u32> bitstream_info_size; | ||
|
|
||
| u64 mutex_attribute[5]{}; // sys_mutex_attribute_t | ||
| shared_mutex mutex; // sys_mutex_t |
There was a problem hiding this comment.
Do not use this type on PS3 structures, you can make it an index to some shared_index array or something
9961a16 to
b63d85d
Compare
|
You need to invalidate savestate version globally because of the additions of vm::gvar and modules, its in savestate_utls.cpp |
rpcs3/Emu/Cell/Modules/cellAdec.h
Outdated
| vm::bcptr<CellAdecCoreOps> core_ops, s32 frames_num, vm::bptr<AdecFrame> 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()); |
There was a problem hiding this comment.
It's better to keep PS3 structures trivial (as std::is_trivial), you can make the constructor a static function instead.
rpcs3/Emu/Cell/Modules/cellAdec.cpp
Outdated
|
|
||
| for (s32 i = 0; i < pcm_handle_num; i++) | ||
| { | ||
| new (&frames[i]) AdecFrame(i, bitstream_infos_addr + bitstream_info_size * i); |
There was a problem hiding this comment.
Same, avoid using non-default constructor
I'll need a new gvar + module for cellDmuxPamf as well, do you want me to add those in this PR so I won't have to invalidate savestates again? |
Yes 👍 |
Here's my Ghidra program data export if anyone wants to look at the decompilation:
libadec.prx.xml.zip