Merge branch 'master' into sln

This commit is contained in:
Elad 2024-11-23 17:02:51 +02:00 committed by GitHub
commit 68753826d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 1562 additions and 961 deletions

View file

@ -252,6 +252,7 @@ target_sources(rpcs3_emu PRIVATE
Cell/Modules/cellCrossController.cpp
Cell/Modules/cellDaisy.cpp
Cell/Modules/cellDmux.cpp
Cell/Modules/cellDmuxPamf.cpp
Cell/Modules/cellDtcpIpUtility.cpp
Cell/Modules/cellFiber.cpp
Cell/Modules/cellFont.cpp

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,8 @@
#pragma once
#include "Emu/Memory/vm_ptr.h"
#include "cellPamf.h" // CellCodecTimeStamp
#include "../lv2/sys_mutex.h"
#include "../lv2/sys_cond.h"
// Error Codes
enum CellAdecError : u32
@ -222,14 +224,6 @@ enum AudioCodecType : s32
CELL_ADEC_TYPE_ATRAC3MULTI,
};
inline bool adecIsAtracX(s32 type)
{
return type == CELL_ADEC_TYPE_ATRACX
|| type == CELL_ADEC_TYPE_ATRACX_2CH
|| type == CELL_ADEC_TYPE_ATRACX_6CH
|| type == CELL_ADEC_TYPE_ATRACX_8CH;
}
// Output Channel Number
enum CellAdecChannel : s32
{
@ -295,14 +289,14 @@ struct CellAdecResourceEx
be_t<u32> ppuThreadPriority;
be_t<u32> ppuThreadStackSize;
be_t<u32> spurs_addr;
u8 priority[8];
be_t<u64, 1> priority;
be_t<u32> maxContention;
};
struct CellAdecResourceSpurs
{
be_t<u32> spurs_addr; // CellSpurs*
u8 priority[8];
be_t<u64, 1> priority;
be_t<u32> maxContention;
};
@ -315,7 +309,7 @@ enum CellAdecMsgType : s32
CELL_ADEC_MSG_TYPE_SEQDONE,
};
using CellAdecCbMsg = s32(u32 handle, CellAdecMsgType msgType, s32 msgData, u32 cbArg);
using CellAdecCbMsg = s32(vm::ptr<void> handle, CellAdecMsgType msgType, s32 msgData, vm::ptr<void> cbArg);
// Used for internal callbacks as well
template <typename F>
@ -339,14 +333,14 @@ struct CellAdecAuInfo
// BSI Info
struct CellAdecPcmAttr
{
be_t<u32> bsiInfo_addr;
vm::bptr<void> bsiInfo;
};
struct CellAdecPcmItem
{
be_t<u32> pcmHandle;
be_t<s32> pcmHandle;
be_t<u32> status;
be_t<u32> startAddr;
vm::bcptr<void> startAddr;
be_t<u32> size;
CellAdecPcmAttr pcmAttr;
CellAdecAuInfo auInfo;
@ -363,36 +357,31 @@ enum AdecCorrectPtsValueType : s8
ADEC_CORRECT_PTS_VALUE_TYPE_ATRACX_48000Hz = 2,
ADEC_CORRECT_PTS_VALUE_TYPE_ATRACX_44100Hz = 3,
ADEC_CORRECT_PTS_VALUE_TYPE_ATRACX_32000Hz = 4,
// 5: Dolby Digital
// 6: ATRAC3
// 7: MP3
// 8: MP3
// 9: MP3
// 39: ATRAC3 multi-track
ADEC_CORRECT_PTS_VALUE_TYPE_AC3 = 5,
ADEC_CORRECT_PTS_VALUE_TYPE_ATRAC3 = 6,
ADEC_CORRECT_PTS_VALUE_TYPE_MP3_48000Hz = 7,
ADEC_CORRECT_PTS_VALUE_TYPE_MP3_44100Hz = 8,
ADEC_CORRECT_PTS_VALUE_TYPE_MP3_32000Hz = 9,
ADEC_CORRECT_PTS_VALUE_TYPE_ATRAC3MULTI = 39,
// Calls a decoder function (_SceAdecCorrectPtsValue_codec())
// 17: Dolby Digital Plus
// 18
// 19
// 20
// 21: DTS HD
// 22
// 23
// 24: CELP
// 25: MPEG-2 AAC
// 26: MPEG-2 BC
// 27: Dolby TrueHD
// 28: DTS
// 29: MPEG-4 AAC
// 30: Windows Media Audio
// 31: DTS Express
// 32: MP1
// 33: MP3 Surround
// 34: CELP8
// 35: Windows Media Audio Professional
// 36: Windows Media Audio Lossless
// 37: DTS HD Core
// 38: DTS HD Core
ADEC_CORRECT_PTS_VALUE_TYPE_EAC3 = 17,
ADEC_CORRECT_PTS_VALUE_TYPE_DTSHD = 21,
ADEC_CORRECT_PTS_VALUE_TYPE_CELP = 24,
ADEC_CORRECT_PTS_VALUE_TYPE_M2AAC = 25,
ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L2 = 26,
ADEC_CORRECT_PTS_VALUE_TYPE_TRUEHD = 27,
ADEC_CORRECT_PTS_VALUE_TYPE_DTS = 28,
ADEC_CORRECT_PTS_VALUE_TYPE_M4AAC = 29,
ADEC_CORRECT_PTS_VALUE_TYPE_WMA = 30,
ADEC_CORRECT_PTS_VALUE_TYPE_DTSLBR = 31,
ADEC_CORRECT_PTS_VALUE_TYPE_MPEG_L1 = 32,
ADEC_CORRECT_PTS_VALUE_TYPE_MP3S = 33,
ADEC_CORRECT_PTS_VALUE_TYPE_CELP8 = 34,
ADEC_CORRECT_PTS_VALUE_TYPE_WMAPRO = 35,
ADEC_CORRECT_PTS_VALUE_TYPE_WMALSL = 36,
ADEC_CORRECT_PTS_VALUE_TYPE_DTSHDCORE_UNK1 = 37,
ADEC_CORRECT_PTS_VALUE_TYPE_DTSHDCORE_UNK2 = 38,
};
// Internal callbacks
@ -471,6 +460,194 @@ struct AdecCmdQueue
bool full() const { return size >= 4; }
};
struct AdecFrame
{
b8 in_use; // True after issuing a decode command until the frame is consumed
be_t<s32> this_index; // Set when initialized in cellAdecOpen(), unused afterward
// Set when the corresponding callback is received, unused afterward
b8 au_done;
b8 unk1;
b8 pcm_out;
b8 unk2;
CellAdecAuInfo au_info;
CellAdecPcmItem pcm_item;
u32 reserved1;
u32 reserved2;
// Frames that are ready to be consumed form a linked list. However, this list is not used (AdecOutputQueue is used instead)
be_t<s32> next; // Index of the next frame that can be consumed
be_t<s32> prev; // Index of the previous frame that can be consumed
};
CHECK_SIZE(AdecFrame, 0x68);
class AdecOutputQueue
{
struct entry
{
be_t<s32> this_index; // Unused
be_t<s32> state; // 0xff = empty, 0x10 = filled
vm::bptr<CellAdecPcmItem> pcm_item;
be_t<s32> pcm_handle;
}
entries[4];
be_t<s32> front;
be_t<s32> back;
be_t<s32> size;
be_t<u32> mutex; // sys_mutex_t
be_t<u32> cond; // sys_cond_t, unused
public:
void init(ppu_thread& ppu, vm::ptr<AdecOutputQueue> _this)
{
this->front = 0;
this->back = 0;
this->size = 0;
const vm::var<sys_mutex_attribute_t> mutex_attr = {{ SYS_SYNC_PRIORITY, SYS_SYNC_NOT_RECURSIVE, SYS_SYNC_NOT_PROCESS_SHARED, SYS_SYNC_NOT_ADAPTIVE, 0, 0, 0, { "_adem07"_u64 } }};
ensure(sys_mutex_create(ppu, _this.ptr(&AdecOutputQueue::mutex), mutex_attr) == CELL_OK); // Error code isn't checked on LLE
const vm::var<sys_cond_attribute_t> cond_attr = {{ SYS_SYNC_NOT_PROCESS_SHARED, 0, 0, { "_adec05"_u64 } }};
ensure(sys_cond_create(ppu, _this.ptr(&AdecOutputQueue::cond), mutex, cond_attr) == CELL_OK); // Error code isn't checked on LLE
for (s32 i = 0; i < 4; i++)
{
entries[i] = { i, 0xff, vm::null, -1 };
}
}
error_code finalize(ppu_thread& ppu) const
{
if (error_code ret = sys_cond_destroy(ppu, cond); ret != CELL_OK)
{
return ret;
}
if (error_code ret = sys_mutex_destroy(ppu, mutex); ret != CELL_OK)
{
return ret;
}
return CELL_OK;
}
error_code push(ppu_thread& ppu, vm::ptr<CellAdecPcmItem> pcm_item, s32 pcm_handle)
{
ensure(sys_mutex_lock(ppu, mutex, 0) == CELL_OK); // Error code isn't checked on LLE
if (entries[back].state != 0xff)
{
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
return true; // LLE returns the result of the comparison above
}
entries[back].state = 0x10;
entries[back].pcm_item = pcm_item;
entries[back].pcm_handle = pcm_handle;
back = (back + 1) & 3;
size++;
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
return CELL_OK;
}
const entry* pop(ppu_thread& ppu)
{
ensure(sys_mutex_lock(ppu, mutex, 0) == CELL_OK); // Error code isn't checked on LLE
if (entries[front].state == 0xff)
{
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
return nullptr;
}
const entry* const ret = &entries[front];
entries[front].state = 0xff;
entries[front].pcm_handle = -1;
front = (front + 1) & 3;
size--;
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
return ret;
}
const entry& peek(ppu_thread& ppu) const
{
ensure(sys_mutex_lock(ppu, mutex, 0) == CELL_OK); // Error code isn't checked on LLE
const entry& ret = entries[front];
ensure(sys_mutex_unlock(ppu, mutex) == CELL_OK); // Error code isn't checked on LLE
return ret;
}
};
CHECK_SIZE(AdecOutputQueue, 0x54);
enum class AdecSequenceState : u32
{
dormant = 0x100,
ready = 0x200,
closed = 0xa00,
};
struct AdecContext // CellAdecHandle = AdecContext*
{
vm::bptr<AdecContext> _this;
be_t<u32> this_size; // Size of this struct + AdecFrames + bitstream info structs
u32 unk; // Unused
be_t<AdecSequenceState> sequence_state;
CellAdecType type;
CellAdecResource res;
CellAdecCb callback;
vm::bptr<void> core_handle;
vm::bcptr<CellAdecCoreOps> core_ops;
CellCodecTimeStamp previous_pts;
be_t<s32> frames_num;
u32 reserved1;
be_t<s32> frames_head; // Index of the oldest frame that can be consumed
be_t<s32> frames_tail; // Index of the most recent frame that can be consumed
vm::bptr<AdecFrame> frames; // Array of AdecFrames, number of elements is return value of CellAdecCoreOps::getPcmHandleNum
be_t<u32> bitstream_info_size;
sys_mutex_attribute_t mutex_attribute;
be_t<u32> mutex; // sys_mutex_t
AdecOutputQueue pcm_queue; // Output queue for cellAdecGetPcm()
AdecOutputQueue pcm_item_queue; // Output queue for cellAdecGetPcmItem()
u8 reserved2[1028];
[[nodiscard]] error_code get_new_pcm_handle(vm::ptr<CellAdecAuInfo> au_info) const;
error_code verify_pcm_handle(s32 pcm_handle) const;
vm::ptr<CellAdecAuInfo> get_au_info(s32 pcm_handle) const;
void set_state(s32 pcm_handle, u32 state) const;
error_code get_pcm_item(s32 pcm_handle, vm::ptr<CellAdecPcmItem>& pcm_item) const;
error_code set_pcm_item(s32 pcm_handle, vm::ptr<void> pcm_addr, u32 pcm_size, vm::cpptr<void> bitstream_info) const;
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);
};
static_assert(std::is_standard_layout_v<AdecContext> && std::is_trivial_v<AdecContext>);
CHECK_SIZE_ALIGN(AdecContext, 0x530, 8);
struct CellAdecParamLpcm
{
be_t<u32> channelNumber;
@ -1024,106 +1201,3 @@ struct CellAdecMpmcInfo
be_t<u32> lfePresent;
be_t<u32> channelCoufiguration;
};
/* Audio Decoder Thread Classes */
enum AdecJobType : u32
{
adecStartSeq,
adecEndSeq,
adecDecodeAu,
adecClose,
};
struct AdecTask
{
AdecJobType type;
union
{
struct
{
u32 auInfo_addr;
u32 addr;
u32 size;
u64 pts;
u64 userdata;
} au;
struct
{
s32 sample_rate;
s32 channel_config;
s32 channels;
s32 frame_size;
std::array<u8, 4> extra_config;
s32 output;
u8 downmix;
u8 ats_header;
} at3p;
};
AdecTask(AdecJobType type)
: type(type)
{
}
AdecTask()
{
}
};
struct AdecFrame
{
struct AVFrame* data;
u64 pts;
u64 userdata;
u32 auAddr;
u32 auSize;
u32 size;
};
int adecRead(void* opaque, u8* buf, int buf_size);
static const u32 at3freq[8] = { 32000, 44100, 48000, 88200, 96000, 0, 0, 0 };
struct OMAHeader // OMA Header
{
u32 magic; // 0x01334145
u16 size; // 96 << 8
u16 unk0; // 0xffff
u64 unk1; // 0x00500f0100000000ULL
u64 unk2; // 0xcef5000000000400ULL
u64 unk3; // 0x1c458024329192d2ULL
u8 codecId; // 1 for ATRAC3P
u8 code0; // 0
u8 code1;
u8 code2;
u32 reserved[15]; // 0
OMAHeader(u8 codec_id, u32 freq, u8 channel_count, u32 frame_size)
: magic(0x01334145)
, size(96 << 8)
, unk0(0xffff)
, unk1(0x00500f0100000000ULL)
, unk2(0xcef5000000000400ULL)
, unk3(0x1c458024329192d2ULL)
, codecId(codec_id)
, code0(0)
{
memset(reserved, 0, sizeof(reserved));
u8 freq_code;
for (freq_code = 0; freq_code < 5; freq_code++)
{
if (at3freq[freq_code] == freq)
{
break;
}
}
u32 prepared_frame_size = (frame_size - 8) / 8;
code1 = ((prepared_frame_size >> 8) & 0x3) | ((channel_count & 0x7) << 2) | (freq_code << 5);
code2 = prepared_frame_size & 0xff;
}
};
CHECK_SIZE(OMAHeader, 96);

View file

@ -1175,7 +1175,7 @@ error_code cellDmuxEnableEs(u32 handle, vm::cptr<CellCodecEsFilterId> esFilterId
const auto es = idm::make_ptr<ElementaryStream>(dmux.get(), esResourceInfo->memAddr, esResourceInfo->memSize,
esFilterId->filterIdMajor, esFilterId->filterIdMinor, esFilterId->supplementalInfo1, esFilterId->supplementalInfo2,
esCb->cbEsMsgFunc, esCb->cbArg, esSpecificInfo);
esCb->cbFunc, esCb->cbArg, esSpecificInfo);
*esHandle = es->id;
@ -1359,8 +1359,6 @@ error_code cellDmuxFlushEs(u32 esHandle)
DECLARE(ppu_module_manager::cellDmux)("cellDmux", []()
{
static ppu_static_module cellDmuxPamf("cellDmuxPamf");
REG_FUNC(cellDmux, cellDmuxQueryAttr);
REG_FUNC(cellDmux, cellDmuxQueryAttr2);
REG_FUNC(cellDmux, cellDmuxOpen);

View file

@ -195,6 +195,13 @@ struct CellDmuxResourceEx
be_t<u32> maxContention;
};
struct CellDmuxResourceSpurs
{
vm::bptr<void> spurs; // CellSpurs*
be_t<u64, 1> priority;
be_t<u32> maxContention;
};
/*
struct CellDmuxResource2Ex
{
@ -221,20 +228,20 @@ struct CellDmuxResource2
using CellDmuxCbMsg = u32(u32 demuxerHandle, vm::ptr<CellDmuxMsg> demuxerMsg, u32 cbArg);
struct CellDmuxCb
{
vm::bptr<CellDmuxCbMsg> cbMsgFunc;
be_t<u32> cbArg;
};
using CellDmuxCbEsMsg = u32(u32 demuxerHandle, u32 esHandle, vm::ptr<CellDmuxEsMsg> esMsg, u32 cbArg);
struct CellDmuxEsCb
// Used for internal callbacks as well
template <typename F>
struct DmuxCb
{
vm::bptr<CellDmuxCbEsMsg> cbEsMsgFunc;
vm::bptr<F> cbFunc;
be_t<u32> cbArg;
};
using CellDmuxCb = DmuxCb<CellDmuxCbMsg>;
using CellDmuxEsCb = DmuxCb<CellDmuxCbEsMsg>;
struct CellDmuxAttr
{
be_t<u32> memSize;
@ -275,3 +282,46 @@ struct CellDmuxAuInfoEx
CellCodecTimeStamp pts;
CellCodecTimeStamp dts;
};
struct CellDmuxPamfAttr;
struct CellDmuxPamfEsAttr;
using DmuxNotifyDemuxDone = error_code(vm::ptr<void>, u32, vm::ptr<void>);
using DmuxNotifyFatalErr = error_code(vm::ptr<void>, u32, vm::ptr<void>);
using DmuxNotifyProgEndCode = error_code(vm::ptr<void>, vm::ptr<void>);
using DmuxEsNotifyAuFound = error_code(vm::ptr<void>, vm::cptr<void>, vm::ptr<void>);
using DmuxEsNotifyFlushDone = error_code(vm::ptr<void>, vm::ptr<void>);
using CellDmuxCoreOpQueryAttr = error_code(vm::cptr<void>, vm::ptr<CellDmuxPamfAttr>);
using CellDmuxCoreOpOpen = error_code(vm::cptr<void>, vm::cptr<CellDmuxResource>, vm::cptr<CellDmuxResourceSpurs>, vm::cptr<DmuxCb<DmuxNotifyDemuxDone>>, vm::cptr<DmuxCb<DmuxNotifyProgEndCode>>, vm::cptr<DmuxCb<DmuxNotifyFatalErr>>, vm::pptr<void>);
using CellDmuxCoreOpClose = error_code(vm::ptr<void>);
using CellDmuxCoreOpResetStream = error_code(vm::ptr<void>);
using CellDmuxCoreOpCreateThread = error_code(vm::ptr<void>);
using CellDmuxCoreOpJoinThread = error_code(vm::ptr<void>);
using CellDmuxCoreOpSetStream = error_code(vm::ptr<void>, vm::cptr<void>, u32, b8, u64);
using CellDmuxCoreOpFreeMemory = error_code(vm::ptr<void>, vm::ptr<void>, u32);
using CellDmuxCoreOpQueryEsAttr = error_code(vm::cptr<void>, vm::cptr<void>, vm::ptr<CellDmuxPamfEsAttr>);
using CellDmuxCoreOpEnableEs = error_code(vm::ptr<void>, vm::cptr<void>, vm::cptr<CellDmuxEsResource>, vm::cptr<DmuxCb<DmuxEsNotifyAuFound>>, vm::cptr<DmuxCb<DmuxEsNotifyFlushDone>>, vm::cptr<void>, vm::pptr<void>);
using CellDmuxCoreOpDisableEs = u32(vm::ptr<void>);
using CellDmuxCoreOpFlushEs = u32(vm::ptr<void>);
using CellDmuxCoreOpResetEs = u32(vm::ptr<void>);
using CellDmuxCoreOpResetStreamAndWaitDone = u32(vm::ptr<void>);
struct CellDmuxCoreOps
{
vm::bptr<CellDmuxCoreOpQueryAttr> queryAttr;
vm::bptr<CellDmuxCoreOpOpen> open;
vm::bptr<CellDmuxCoreOpClose> close;
vm::bptr<CellDmuxCoreOpResetStream> resetStream;
vm::bptr<CellDmuxCoreOpCreateThread> createThread;
vm::bptr<CellDmuxCoreOpJoinThread> joinThread;
vm::bptr<CellDmuxCoreOpSetStream> setStream;
vm::bptr<CellDmuxCoreOpFreeMemory> freeMemory;
vm::bptr<CellDmuxCoreOpQueryEsAttr> queryEsAttr;
vm::bptr<CellDmuxCoreOpEnableEs> enableEs;
vm::bptr<CellDmuxCoreOpDisableEs> disableEs;
vm::bptr<CellDmuxCoreOpFlushEs> flushEs;
vm::bptr<CellDmuxCoreOpResetEs> resetEs;
vm::bptr<CellDmuxCoreOpResetStreamAndWaitDone> resetStreamAndWaitDone;
};

View file

@ -0,0 +1,170 @@
#include "stdafx.h"
#include "Emu/Cell/PPUModule.h"
#include "Emu/IdManager.h"
#include "cellPamf.h"
#include "cellDmux.h"
#include "cellDmuxPamf.h"
vm::gvar<CellDmuxCoreOps> g_cell_dmux_core_ops_pamf;
vm::gvar<CellDmuxCoreOps> g_cell_dmux_core_ops_raw_es;
LOG_CHANNEL(cellDmuxPamf)
error_code _CellDmuxCoreOpQueryAttr(vm::cptr<CellDmuxPamfSpecificInfo> pamfSpecificInfo, vm::ptr<CellDmuxPamfAttr> pamfAttr)
{
cellDmuxPamf.todo("_CellDmuxCoreOpQueryAttr(pamfSpecificInfo=*0x%x, pamfAttr=*0x%x)", pamfSpecificInfo, pamfAttr);
return CELL_OK;
}
error_code _CellDmuxCoreOpOpen(vm::cptr<CellDmuxPamfSpecificInfo> pamfSpecificInfo, vm::cptr<CellDmuxResource> demuxerResource, vm::cptr<CellDmuxResourceSpurs> demuxerResourceSpurs, vm::cptr<DmuxCb<DmuxNotifyDemuxDone>> notifyDemuxDone,
vm::cptr<DmuxCb<DmuxNotifyProgEndCode>> notifyProgEndCode, vm::cptr<DmuxCb<DmuxNotifyFatalErr>> notifyFatalErr, vm::pptr<void> handle)
{
cellDmuxPamf.todo("_CellDmuxCoreOpOpen(pamfSpecificInfo=*0x%x, demuxerResource=*0x%x, demuxerResourceSpurs=*0x%x, notifyDemuxDone=*0x%x, notifyProgEndCode=*0x%x, notifyFatalErr=*0x%x, handle=**0x%x)",
pamfSpecificInfo, demuxerResource, demuxerResourceSpurs, notifyDemuxDone, notifyProgEndCode, notifyFatalErr, handle);
return CELL_OK;
}
error_code _CellDmuxCoreOpClose(vm::ptr<void> handle)
{
cellDmuxPamf.todo("_CellDmuxCoreOpClose(handle=*0x%x)", handle);
return CELL_OK;
}
error_code _CellDmuxCoreOpResetStream(vm::ptr<void> handle)
{
cellDmuxPamf.todo("_CellDmuxCoreOpResetStream(handle=*0x%x)", handle);
return CELL_OK;
}
error_code _CellDmuxCoreOpCreateThread(vm::ptr<void> handle)
{
cellDmuxPamf.todo("_CellDmuxCoreOpCreateThread(handle=*0x%x)", handle);
return CELL_OK;
}
error_code _CellDmuxCoreOpJoinThread(vm::ptr<void> handle)
{
cellDmuxPamf.todo("_CellDmuxCoreOpJoinThread(handle=*0x%x)", handle);
return CELL_OK;
}
template <bool raw_es>
error_code _CellDmuxCoreOpSetStream(vm::ptr<void> handle, vm::cptr<void> streamAddress, u32 streamSize, b8 discontinuity, u64 userData)
{
cellDmuxPamf.todo("_CellDmuxCoreOpSetStream<raw_es=%d>(handle=*0x%x, streamAddress=*0x%x, streamSize=0x%x, discontinuity=%d, userData=0x%llx)", raw_es, handle, streamAddress, streamSize, +discontinuity, userData);
return CELL_OK;
}
error_code _CellDmuxCoreOpFreeMemory(vm::ptr<void> esHandle, vm::ptr<void> memAddr, u32 memSize)
{
cellDmuxPamf.todo("_CellDmuxCoreOpFreeMemory(esHandle=*0x%x, memAddr=*0x%x, memSize=0x%x)", esHandle, memAddr, memSize);
return CELL_OK;
}
template <bool raw_es>
error_code _CellDmuxCoreOpQueryEsAttr(vm::cptr<void> esFilterId, vm::cptr<void> esSpecificInfo, vm::ptr<CellDmuxPamfEsAttr> attr)
{
cellDmuxPamf.todo("_CellDmuxCoreOpQueryEsAttr<raw_es=%d>(esFilterId=*0x%x, esSpecificInfo=*0x%x, attr=*0x%x)", raw_es, esFilterId, esSpecificInfo, attr);
return CELL_OK;
}
template <bool raw_es>
error_code _CellDmuxCoreOpEnableEs(vm::ptr<void> handle, vm::cptr<void> esFilterId, vm::cptr<CellDmuxEsResource> esResource, vm::cptr<DmuxCb<DmuxEsNotifyAuFound>> notifyAuFound,
vm::cptr<DmuxCb<DmuxEsNotifyFlushDone>> notifyFlushDone, vm::cptr<void> esSpecificInfo, vm::pptr<void> esHandle)
{
cellDmuxPamf.todo("_CellDmuxCoreOpEnableEs<raw_es=%d>(handle=*0x%x, esFilterId=*0x%x, esResource=*0x%x, notifyAuFound=*0x%x, notifyFlushDone=*0x%x, esSpecificInfo=*0x%x, esHandle)",
raw_es, handle, esFilterId, esResource, notifyAuFound, notifyFlushDone, esSpecificInfo, esHandle);
return CELL_OK;
}
error_code _CellDmuxCoreOpDisableEs(vm::ptr<void> esHandle)
{
cellDmuxPamf.todo("_CellDmuxCoreOpDisableEs(esHandle=*0x%x)", esHandle);
return CELL_OK;
}
error_code _CellDmuxCoreOpFlushEs(vm::ptr<void> esHandle)
{
cellDmuxPamf.todo("_CellDmuxCoreOpFlushEs(esHandle=*0x%x)", esHandle);
return CELL_OK;
}
error_code _CellDmuxCoreOpResetEs(vm::ptr<void> esHandle)
{
cellDmuxPamf.todo("_CellDmuxCoreOpResetEs(esHandle=*0x%x)", esHandle);
return CELL_OK;
}
error_code _CellDmuxCoreOpResetStreamAndWaitDone(vm::ptr<void> handle)
{
cellDmuxPamf.todo("_CellDmuxCoreOpResetStreamAndWaitDone(handle=*0x%x)", handle);
return CELL_OK;
}
static void init_gvar(const vm::gvar<CellDmuxCoreOps>& var)
{
var->queryAttr.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpQueryAttr)));
var->open.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpOpen)));
var->close.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpClose)));
var->resetStream.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpResetStream)));
var->createThread.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpCreateThread)));
var->joinThread.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpJoinThread)));
var->freeMemory.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpFreeMemory)));
var->disableEs.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpDisableEs)));
var->flushEs.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpFlushEs)));
var->resetEs.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpResetEs)));
var->resetStreamAndWaitDone.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpResetStreamAndWaitDone)));
}
DECLARE(ppu_module_manager::cellDmuxPamf)("cellDmuxPamf", []
{
REG_VNID(cellDmuxPamf, 0x28b2b7b2, g_cell_dmux_core_ops_pamf).init = []
{
g_cell_dmux_core_ops_pamf->setStream.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpSetStream<false>)));
g_cell_dmux_core_ops_pamf->queryEsAttr.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpQueryEsAttr<false>)));
g_cell_dmux_core_ops_pamf->enableEs.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpEnableEs<false>)));
init_gvar(g_cell_dmux_core_ops_pamf);
};
REG_VNID(cellDmuxPamf, 0x9728a0e9, g_cell_dmux_core_ops_raw_es).init = []
{
g_cell_dmux_core_ops_raw_es->setStream.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpSetStream<true>)));
g_cell_dmux_core_ops_raw_es->queryEsAttr.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpQueryEsAttr<true>)));
g_cell_dmux_core_ops_raw_es->enableEs.set(g_fxo->get<ppu_function_manager>().func_addr(FIND_FUNC(_CellDmuxCoreOpEnableEs<true>)));
init_gvar(g_cell_dmux_core_ops_raw_es);
};
REG_HIDDEN_FUNC(_CellDmuxCoreOpQueryAttr);
REG_HIDDEN_FUNC(_CellDmuxCoreOpOpen);
REG_HIDDEN_FUNC(_CellDmuxCoreOpClose);
REG_HIDDEN_FUNC(_CellDmuxCoreOpResetStream);
REG_HIDDEN_FUNC(_CellDmuxCoreOpCreateThread);
REG_HIDDEN_FUNC(_CellDmuxCoreOpJoinThread);
REG_HIDDEN_FUNC(_CellDmuxCoreOpSetStream<false>);
REG_HIDDEN_FUNC(_CellDmuxCoreOpSetStream<true>);
REG_HIDDEN_FUNC(_CellDmuxCoreOpFreeMemory);
REG_HIDDEN_FUNC(_CellDmuxCoreOpQueryEsAttr<false>);
REG_HIDDEN_FUNC(_CellDmuxCoreOpQueryEsAttr<true>);
REG_HIDDEN_FUNC(_CellDmuxCoreOpEnableEs<false>);
REG_HIDDEN_FUNC(_CellDmuxCoreOpEnableEs<true>);
REG_HIDDEN_FUNC(_CellDmuxCoreOpDisableEs);
REG_HIDDEN_FUNC(_CellDmuxCoreOpFlushEs);
REG_HIDDEN_FUNC(_CellDmuxCoreOpResetEs);
REG_HIDDEN_FUNC(_CellDmuxCoreOpResetStreamAndWaitDone);
});

View file

@ -0,0 +1,15 @@
#pragma once
struct CellDmuxPamfAttr
{
be_t<u32> maxEnabledEsNum;
be_t<u32> version;
be_t<u32> memSize;
};
struct CellDmuxPamfEsAttr
{
be_t<u32> auQueueMaxSize;
be_t<u32> memSize;
be_t<u32> specificInfoSize;
};

View file

@ -66,9 +66,9 @@ namespace ppu_cb_detail
static inline void set_value(ppu_thread& CPU, const T& arg)
{
const s64 stack_pos = (g_count - 1) * 0x8 + 0x30 - FIXED_STACK_FRAME_SIZE;
const s64 stack_pos = (static_cast<s64>(g_count) - 1) * 0x8 + 0x30 - FIXED_STACK_FRAME_SIZE;
static_assert(stack_pos < 0, "TODO: Increase FIXED_STACK_FRAME_SIZE (arg count limit broken)");
vm::write64(CPU.gpr[1] + stack_pos, ppu_gpr_cast(arg)); // TODO
vm::write64(static_cast<u32>(CPU.gpr[1] + stack_pos), ppu_gpr_cast(arg)); // TODO
}
};

View file

@ -182,6 +182,8 @@ static void ppu_initialize_modules(ppu_linkage_info* link, utils::serial* ar = n
{
&ppu_module_manager::cellAdec,
&ppu_module_manager::cellAtrac,
&ppu_module_manager::cellAtrac3dec,
&ppu_module_manager::cellAtrac3multidec,
&ppu_module_manager::cellAtracMulti,
&ppu_module_manager::cellAtracXdec,
&ppu_module_manager::cellAudio,
@ -189,12 +191,20 @@ static void ppu_initialize_modules(ppu_linkage_info* link, utils::serial* ar = n
&ppu_module_manager::cellAuthDialogUtility,
&ppu_module_manager::cellBGDL,
&ppu_module_manager::cellCamera,
&ppu_module_manager::cellCelp8Dec,
&ppu_module_manager::cellCelp8Enc,
&ppu_module_manager::cellCelpDec,
&ppu_module_manager::cellCelpEnc,
&ppu_module_manager::cellCrossController,
&ppu_module_manager::cellDaisy,
&ppu_module_manager::cellDDPdec,
&ppu_module_manager::cellDmux,
&ppu_module_manager::cellDmuxPamf,
&ppu_module_manager::cellDtcpIpUtility,
&ppu_module_manager::cellDTSdec,
&ppu_module_manager::cellDTSHDCOREdec,
&ppu_module_manager::cellDTSHDdec,
&ppu_module_manager::cellDTSLBRdec,
&ppu_module_manager::cellFiber,
&ppu_module_manager::cellFont,
&ppu_module_manager::cellFontFT,
@ -213,8 +223,16 @@ static void ppu_initialize_modules(ppu_linkage_info* link, utils::serial* ar = n
&ppu_module_manager::cellJpgEnc,
&ppu_module_manager::cellKey2char,
&ppu_module_manager::cellL10n,
&ppu_module_manager::cell_libac3dec,
&ppu_module_manager::cellLibprof,
&ppu_module_manager::cellM2AACdec,
&ppu_module_manager::cellM2BCdec,
&ppu_module_manager::cellM4AacDec,
&ppu_module_manager::cellM4AacDec2ch,
&ppu_module_manager::cellM4AacDec2chmod,
&ppu_module_manager::cellMic,
&ppu_module_manager::cellMP3dec,
&ppu_module_manager::cellMP3Sdec,
&ppu_module_manager::cellMusic,
&ppu_module_manager::cellMusicDecode,
&ppu_module_manager::cellMusicExport,
@ -258,6 +276,7 @@ static void ppu_initialize_modules(ppu_linkage_info* link, utils::serial* ar = n
&ppu_module_manager::cellSysutilAvcExt,
&ppu_module_manager::cellSysutilNpEula,
&ppu_module_manager::cellSysutilMisc,
&ppu_module_manager::cellTRHDdec,
&ppu_module_manager::cellUsbd,
&ppu_module_manager::cellUsbPspcm,
&ppu_module_manager::cellUserInfo,
@ -267,6 +286,9 @@ static void ppu_initialize_modules(ppu_linkage_info* link, utils::serial* ar = n
&ppu_module_manager::cellVideoUpload,
&ppu_module_manager::cellVoice,
&ppu_module_manager::cellVpost,
&ppu_module_manager::cellWMAdec,
&ppu_module_manager::cellWMALSLdec,
&ppu_module_manager::cellWMAPROdec,
&ppu_module_manager::libad_async,
&ppu_module_manager::libad_core,
&ppu_module_manager::libfs_utility_init,

View file

@ -167,6 +167,8 @@ public:
static const ppu_static_module cellAdec;
static const ppu_static_module cellAtrac;
static const ppu_static_module cellAtrac3dec;
static const ppu_static_module cellAtrac3multidec;
static const ppu_static_module cellAtracMulti;
static const ppu_static_module cellAtracXdec;
static const ppu_static_module cellAudio;
@ -174,12 +176,20 @@ public:
static const ppu_static_module cellAuthDialogUtility;
static const ppu_static_module cellBGDL;
static const ppu_static_module cellCamera;
static const ppu_static_module cellCelp8Dec;
static const ppu_static_module cellCelp8Enc;
static const ppu_static_module cellCelpDec;
static const ppu_static_module cellCelpEnc;
static const ppu_static_module cellCrossController;
static const ppu_static_module cellDaisy;
static const ppu_static_module cellDDPdec;
static const ppu_static_module cellDmux;
static const ppu_static_module cellDmuxPamf;
static const ppu_static_module cellDtcpIpUtility;
static const ppu_static_module cellDTSdec;
static const ppu_static_module cellDTSHDCOREdec;
static const ppu_static_module cellDTSHDdec;
static const ppu_static_module cellDTSLBRdec;
static const ppu_static_module cellFiber;
static const ppu_static_module cellFont;
static const ppu_static_module cellFontFT;
@ -198,8 +208,17 @@ public:
static const ppu_static_module cellJpgEnc;
static const ppu_static_module cellKey2char;
static const ppu_static_module cellL10n;
static const ppu_static_module cell_libac3dec;
static const ppu_static_module cellLibprof;
static const ppu_static_module cellM2AACdec;
static const ppu_static_module cellM2BCdec;
static const ppu_static_module cellM4AacDec;
static const ppu_static_module cellM4AacDec2ch;
static const ppu_static_module cellM4AacDec2chmod;
static const ppu_static_module cellMic;
static const ppu_static_module cellMP3dec;
static const ppu_static_module cellMP3Sdec;
static const ppu_static_module cellMPL1dec;
static const ppu_static_module cellMusic;
static const ppu_static_module cellMusicDecode;
static const ppu_static_module cellMusicExport;
@ -243,6 +262,7 @@ public:
static const ppu_static_module cellSysutilAvcExt;
static const ppu_static_module cellSysutilNpEula;
static const ppu_static_module cellSysutilMisc;
static const ppu_static_module cellTRHDdec;
static const ppu_static_module cellUsbd;
static const ppu_static_module cellUsbPspcm;
static const ppu_static_module cellUserInfo;
@ -252,6 +272,9 @@ public:
static const ppu_static_module cellVideoUpload;
static const ppu_static_module cellVoice;
static const ppu_static_module cellVpost;
static const ppu_static_module cellWMAdec;
static const ppu_static_module cellWMALSLdec;
static const ppu_static_module cellWMAPROdec;
static const ppu_static_module libad_async;
static const ppu_static_module libad_core;
static const ppu_static_module libfs_utility_init;

View file

@ -42,7 +42,7 @@ static std::array<serial_ver_t, 27> s_serial_versions;
return ::s_serial_versions[identifier].current_version;\
}
SERIALIZATION_VER(global_version, 0, 16) // For stuff not listed here
SERIALIZATION_VER(global_version, 0, 17) // For stuff not listed here
SERIALIZATION_VER(ppu, 1, 1, 2/*PPU sleep order*/, 3/*PPU FNID and module*/)
SERIALIZATION_VER(spu, 2, 1)
SERIALIZATION_VER(lv2_sync, 3, 1)

View file

@ -300,6 +300,7 @@
<ClCompile Include="Emu\Cell\Modules\cellCrossController.cpp" />
<ClCompile Include="Emu\Cell\Modules\cellDaisy.cpp" />
<ClCompile Include="Emu\Cell\Modules\cellDmux.cpp" />
<ClCompile Include="Emu\Cell\Modules\cellDmuxPamf.cpp" />
<ClCompile Include="Emu\Cell\Modules\cellDtcpIpUtility.cpp" />
<ClCompile Include="Emu\Cell\Modules\cellFiber.cpp" />
<ClCompile Include="Emu\Cell\Modules\cellFont.cpp" />
@ -820,6 +821,7 @@
<ClInclude Include="Emu\Cell\Modules\cellBgdl.h" />
<ClInclude Include="Emu\Cell\Modules\cellCamera.h" />
<ClInclude Include="Emu\Cell\Modules\cellDmux.h" />
<ClInclude Include="Emu\Cell\Modules\cellDmuxPamf.h" />
<ClInclude Include="Emu\Cell\Modules\cellFiber.h" />
<ClInclude Include="Emu\Cell\Modules\cellFont.h" />
<ClInclude Include="Emu\Cell\Modules\cellFontFT.h" />

View file

@ -393,6 +393,9 @@
<ClCompile Include="Emu\Cell\Modules\cellDmux.cpp">
<Filter>Emu\Cell\Modules</Filter>
</ClCompile>
<ClCompile Include="Emu\Cell\Modules\cellDmuxPamf.cpp">
<Filter>Emu\Cell\Modules</Filter>
</ClCompile>
<ClCompile Include="Emu\Cell\Modules\cellDtcpIpUtility.cpp">
<Filter>Emu\Cell\Modules</Filter>
</ClCompile>
@ -1641,6 +1644,9 @@
<ClInclude Include="Emu\Cell\Modules\cellDmux.h">
<Filter>Emu\Cell\Modules</Filter>
</ClInclude>
<ClInclude Include="Emu\Cell\Modules\cellDmuxPamf.h">
<Filter>Emu\Cell\Modules</Filter>
</ClInclude>
<ClInclude Include="Emu\Cell\Modules\cellFiber.h">
<Filter>Emu\Cell\Modules</Filter>
</ClInclude>