This commit is contained in:
Nekotekina 2015-04-12 23:16:30 +03:00
parent ea5110cec3
commit fea6fd1a70
14 changed files with 323 additions and 303 deletions

View file

@ -509,11 +509,14 @@ bool adecCheckType(AudioCodecType type)
return true; return true;
} }
int cellAdecQueryAttr(vm::ptr<CellAdecType> type, vm::ptr<CellAdecAttr> attr) s32 cellAdecQueryAttr(vm::ptr<CellAdecType> type, vm::ptr<CellAdecAttr> attr)
{ {
cellAdec.Warning("cellAdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.addr(), attr.addr()); cellAdec.Warning("cellAdecQueryAttr(type=*0x%x, attr=*0x%x)", type, attr);
if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG; if (!adecCheckType(type->audioCodecType))
{
return CELL_ADEC_ERROR_ARG;
}
// TODO: check values // TODO: check values
attr->adecVerLower = 0x280000; // from dmux attr->adecVerLower = 0x280000; // from dmux
@ -523,36 +526,41 @@ int cellAdecQueryAttr(vm::ptr<CellAdecType> type, vm::ptr<CellAdecAttr> attr)
return CELL_OK; return CELL_OK;
} }
int cellAdecOpen(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResource> res, vm::ptr<CellAdecCb> cb, vm::ptr<u32> handle) s32 cellAdecOpen(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResource> res, vm::ptr<CellAdecCb> cb, vm::ptr<u32> handle)
{ {
cellAdec.Warning("cellAdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellAdec.Warning("cellAdecOpen(type=*0x%x, res=*0x%x, cb=*0x%x, handle=*0x%x)", type, res, cb, handle);
type.addr(), res.addr(), cb.addr(), handle.addr());
if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG; if (!adecCheckType(type->audioCodecType))
{
return CELL_ADEC_ERROR_ARG;
}
*handle = adecOpen(new AudioDecoder(type->audioCodecType, res->startAddr, res->totalMemSize, cb->cbFunc, cb->cbArg)); *handle = adecOpen(new AudioDecoder(type->audioCodecType, res->startAddr, res->totalMemSize, cb->cbFunc, cb->cbArg));
return CELL_OK; return CELL_OK;
} }
int cellAdecOpenEx(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResourceEx> res, vm::ptr<CellAdecCb> cb, vm::ptr<u32> handle) s32 cellAdecOpenEx(vm::ptr<CellAdecType> type, vm::ptr<CellAdecResourceEx> res, vm::ptr<CellAdecCb> cb, vm::ptr<u32> handle)
{ {
cellAdec.Warning("cellAdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellAdec.Warning("cellAdecOpenEx(type=*0x%x, res=*0x%x, cb=*0x%x, handle=*0x%x)", type, res, cb, handle);
type.addr(), res.addr(), cb.addr(), handle.addr());
if (!adecCheckType(type->audioCodecType)) return CELL_ADEC_ERROR_ARG; if (!adecCheckType(type->audioCodecType))
{
return CELL_ADEC_ERROR_ARG;
}
*handle = adecOpen(new AudioDecoder(type->audioCodecType, res->startAddr, res->totalMemSize, cb->cbFunc, cb->cbArg)); *handle = adecOpen(new AudioDecoder(type->audioCodecType, res->startAddr, res->totalMemSize, cb->cbFunc, cb->cbArg));
return CELL_OK; return CELL_OK;
} }
int cellAdecClose(u32 handle) s32 cellAdecClose(u32 handle)
{ {
cellAdec.Warning("cellAdecClose(handle=%d)", handle); cellAdec.Warning("cellAdecClose(handle=%d)", handle);
std::shared_ptr<AudioDecoder> adec; const auto adec = Emu.GetIdManager().GetIDData<AudioDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, adec))
if (!adec)
{ {
return CELL_ADEC_ERROR_ARG; return CELL_ADEC_ERROR_ARG;
} }
@ -575,12 +583,13 @@ int cellAdecClose(u32 handle)
return CELL_OK; return CELL_OK;
} }
int cellAdecStartSeq(u32 handle, u32 param_addr) s32 cellAdecStartSeq(u32 handle, u32 param)
{ {
cellAdec.Warning("cellAdecStartSeq(handle=%d, param_addr=0x%x)", handle, param_addr); cellAdec.Warning("cellAdecStartSeq(handle=%d, param=*0x%x)", handle, param);
std::shared_ptr<AudioDecoder> adec; const auto adec = Emu.GetIdManager().GetIDData<AudioDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, adec))
if (!adec)
{ {
return CELL_ADEC_ERROR_ARG; return CELL_ADEC_ERROR_ARG;
} }
@ -594,25 +603,25 @@ int cellAdecStartSeq(u32 handle, u32 param_addr)
case CELL_ADEC_TYPE_ATRACX_6CH: case CELL_ADEC_TYPE_ATRACX_6CH:
case CELL_ADEC_TYPE_ATRACX_8CH: case CELL_ADEC_TYPE_ATRACX_8CH:
{ {
auto param = vm::ptr<const CellAdecParamAtracX>::make(param_addr); const auto atx = vm::ptr<const CellAdecParamAtracX>::make(param);
task.at3p.sample_rate = param->sampling_freq; task.at3p.sample_rate = atx->sampling_freq;
task.at3p.channel_config = param->ch_config_idx; task.at3p.channel_config = atx->ch_config_idx;
task.at3p.channels = param->nch_out; task.at3p.channels = atx->nch_out;
task.at3p.frame_size = param->nbytes; task.at3p.frame_size = atx->nbytes;
task.at3p.extra_config = param->extra_config_data; task.at3p.extra_config = atx->extra_config_data;
task.at3p.output = param->bw_pcm; task.at3p.output = atx->bw_pcm;
task.at3p.downmix = param->downmix_flag; task.at3p.downmix = atx->downmix_flag;
task.at3p.ats_header = param->au_includes_ats_hdr_flg; task.at3p.ats_header = atx->au_includes_ats_hdr_flg;
cellAdec.Todo("*** CellAdecParamAtracX: sr=%d, ch_cfg=%d(%d), frame_size=0x%x, extra=0x%x, output=%d, downmix=%d, ats_header=%d", cellAdec.Todo("*** CellAdecParamAtracX: sr=%d, ch_cfg=%d(%d), frame_size=0x%x, extra=0x%x, output=%d, downmix=%d, ats_header=%d",
task.at3p.sample_rate, task.at3p.channel_config, task.at3p.channels, task.at3p.frame_size, (u32&)task.at3p.extra_config, task.at3p.output, task.at3p.downmix, task.at3p.ats_header); task.at3p.sample_rate, task.at3p.channel_config, task.at3p.channels, task.at3p.frame_size, (u32&)task.at3p.extra_config, task.at3p.output, task.at3p.downmix, task.at3p.ats_header);
break; break;
} }
case CELL_ADEC_TYPE_MP3: case CELL_ADEC_TYPE_MP3:
{ {
auto param = vm::ptr<const CellAdecParamMP3>::make(param_addr); const auto mp3 = vm::ptr<const CellAdecParamMP3>::make(param);
cellAdec.Todo("*** CellAdecParamMP3: bw_pcm=%d", param->bw_pcm); cellAdec.Todo("*** CellAdecParamMP3: bw_pcm=%d", mp3->bw_pcm);
break; break;
} }
default: default:
@ -627,12 +636,13 @@ int cellAdecStartSeq(u32 handle, u32 param_addr)
return CELL_OK; return CELL_OK;
} }
int cellAdecEndSeq(u32 handle) s32 cellAdecEndSeq(u32 handle)
{ {
cellAdec.Warning("cellAdecEndSeq(handle=%d)", handle); cellAdec.Warning("cellAdecEndSeq(handle=%d)", handle);
std::shared_ptr<AudioDecoder> adec; const auto adec = Emu.GetIdManager().GetIDData<AudioDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, adec))
if (!adec)
{ {
return CELL_ADEC_ERROR_ARG; return CELL_ADEC_ERROR_ARG;
} }
@ -641,12 +651,13 @@ int cellAdecEndSeq(u32 handle)
return CELL_OK; return CELL_OK;
} }
int cellAdecDecodeAu(u32 handle, vm::ptr<CellAdecAuInfo> auInfo) s32 cellAdecDecodeAu(u32 handle, vm::ptr<CellAdecAuInfo> auInfo)
{ {
cellAdec.Log("cellAdecDecodeAu(handle=%d, auInfo_addr=0x%x)", handle, auInfo.addr()); cellAdec.Log("cellAdecDecodeAu(handle=%d, auInfo=*0x%x)", handle, auInfo);
std::shared_ptr<AudioDecoder> adec; const auto adec = Emu.GetIdManager().GetIDData<AudioDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, adec))
if (!adec)
{ {
return CELL_ADEC_ERROR_ARG; return CELL_ADEC_ERROR_ARG;
} }
@ -663,12 +674,13 @@ int cellAdecDecodeAu(u32 handle, vm::ptr<CellAdecAuInfo> auInfo)
return CELL_OK; return CELL_OK;
} }
int cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer) s32 cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer)
{ {
cellAdec.Log("cellAdecGetPcm(handle=%d, outBuffer_addr=0x%x)", handle, outBuffer.addr()); cellAdec.Log("cellAdecGetPcm(handle=%d, outBuffer=*0x%x)", handle, outBuffer);
std::shared_ptr<AudioDecoder> adec; const auto adec = Emu.GetIdManager().GetIDData<AudioDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, adec))
if (!adec)
{ {
return CELL_ADEC_ERROR_ARG; return CELL_ADEC_ERROR_ARG;
} }
@ -778,12 +790,13 @@ int cellAdecGetPcm(u32 handle, vm::ptr<float> outBuffer)
return CELL_OK; return CELL_OK;
} }
int cellAdecGetPcmItem(u32 handle, vm::ptr<u32> pcmItem_ptr) s32 cellAdecGetPcmItem(u32 handle, vm::ptr<vm::bptr<CellAdecPcmItem>> pcmItem)
{ {
cellAdec.Log("cellAdecGetPcmItem(handle=%d, pcmItem_ptr_addr=0x%x)", handle, pcmItem_ptr.addr()); cellAdec.Log("cellAdecGetPcmItem(handle=%d, pcmItem=**0x%x)", handle, pcmItem);
std::shared_ptr<AudioDecoder> adec; const auto adec = Emu.GetIdManager().GetIDData<AudioDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, adec))
if (!adec)
{ {
return CELL_ADEC_ERROR_ARG; return CELL_ADEC_ERROR_ARG;
} }
@ -797,7 +810,7 @@ int cellAdecGetPcmItem(u32 handle, vm::ptr<u32> pcmItem_ptr)
AVFrame* frame = af.data; AVFrame* frame = af.data;
auto pcm = vm::ptr<CellAdecPcmItem>::make(adec->memAddr + adec->memBias); const auto pcm = vm::ptr<CellAdecPcmItem>::make(adec->memAddr + adec->memBias);
adec->memBias += 512; adec->memBias += 512;
if (adec->memBias + 512 > adec->memSize) if (adec->memBias + 512 > adec->memSize)
@ -852,7 +865,7 @@ int cellAdecGetPcmItem(u32 handle, vm::ptr<u32> pcmItem_ptr)
memset(mp3.get_ptr(), 0, sizeof(CellAdecMP3Info)); memset(mp3.get_ptr(), 0, sizeof(CellAdecMP3Info));
} }
*pcmItem_ptr = pcm.addr(); *pcmItem = pcm;
return CELL_OK; return CELL_OK;
} }

View file

@ -389,7 +389,7 @@ s32 cellAudioInit()
for (auto key : g_audio.keys) for (auto key : g_audio.keys)
{ {
if (std::shared_ptr<event_queue_t> queue = Emu.GetEventManager().GetEventQueue(key)) if (const auto queue = Emu.GetEventManager().GetEventQueue(key))
{ {
queue->push(0, 0, 0, 0); // TODO: check arguments queue->push(0, 0, 0, 0); // TODO: check arguments
} }

View file

@ -285,16 +285,18 @@ void dmuxQueryAttr(u32 info_addr /* may be 0 */, vm::ptr<CellDmuxAttr> attr)
attr->memSize = 0x10000; // 0x3e8e6 from ps3 attr->memSize = 0x10000; // 0x3e8e6 from ps3
} }
void dmuxQueryEsAttr(u32 info_addr /* may be 0 */, vm::ptr<const CellCodecEsFilterId> esFilterId, void dmuxQueryEsAttr(u32 info /* may be 0 */, vm::ptr<const CellCodecEsFilterId> esFilterId, u32 esSpecificInfo, vm::ptr<CellDmuxEsAttr> attr)
const u32 esSpecificInfo_addr, vm::ptr<CellDmuxEsAttr> attr)
{ {
if (esFilterId->filterIdMajor >= 0xe0) if (esFilterId->filterIdMajor >= 0xe0)
{
attr->memSize = 0x500000; // 0x45fa49 from ps3 attr->memSize = 0x500000; // 0x45fa49 from ps3
}
else else
{
attr->memSize = 0x7000; // 0x73d9 from ps3 attr->memSize = 0x7000; // 0x73d9 from ps3
}
cellDmux.Warning("*** filter(0x%x, 0x%x, 0x%x, 0x%x)", (u32)esFilterId->filterIdMajor, (u32)esFilterId->filterIdMinor, cellDmux.Warning("*** filter(0x%x, 0x%x, 0x%x, 0x%x)", esFilterId->filterIdMajor, esFilterId->filterIdMinor, esFilterId->supplementalInfo1, esFilterId->supplementalInfo2);
(u32)esFilterId->supplementalInfo1, (u32)esFilterId->supplementalInfo2);
} }
u32 dmuxOpen(Demuxer* dmux_ptr) u32 dmuxOpen(Demuxer* dmux_ptr)
@ -775,92 +777,87 @@ u32 dmuxOpen(Demuxer* dmux_ptr)
return dmux_id; return dmux_id;
} }
int cellDmuxQueryAttr(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<CellDmuxAttr> demuxerAttr) s32 cellDmuxQueryAttr(vm::ptr<const CellDmuxType> type, vm::ptr<CellDmuxAttr> attr)
{ {
cellDmux.Warning("cellDmuxQueryAttr(demuxerType_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType.addr(), demuxerAttr.addr()); cellDmux.Warning("cellDmuxQueryAttr(type=*0x%x, attr=*0x%x)", type, attr);
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (type->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
dmuxQueryAttr(0, demuxerAttr); dmuxQueryAttr(0, attr);
return CELL_OK; return CELL_OK;
} }
int cellDmuxQueryAttr2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<CellDmuxAttr> demuxerAttr) s32 cellDmuxQueryAttr2(vm::ptr<const CellDmuxType2> type2, vm::ptr<CellDmuxAttr> attr)
{ {
cellDmux.Warning("cellDmuxQueryAttr2(demuxerType2_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType2.addr(), demuxerAttr.addr()); cellDmux.Warning("cellDmuxQueryAttr2(demuxerType2=*0x%x, demuxerAttr=*0x%x)", type2, attr);
if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (type2->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
dmuxQueryAttr(demuxerType2->streamSpecificInfo_addr, demuxerAttr); dmuxQueryAttr(type2->streamSpecificInfo, attr);
return CELL_OK; return CELL_OK;
} }
int cellDmuxOpen(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResource> demuxerResource, s32 cellDmuxOpen(vm::ptr<const CellDmuxType> type, vm::ptr<const CellDmuxResource> res, vm::ptr<const CellDmuxCb> cb, vm::ptr<u32> handle)
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle)
{ {
cellDmux.Warning("cellDmuxOpen(demuxerType_addr=0x%x, demuxerResource_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", cellDmux.Warning("cellDmuxOpen(type=*0x%x, res=*0x%x, cb=*0x%x, handle=*0x%x)", type, res, cb, handle);
demuxerType.addr(), demuxerResource.addr(), demuxerCb.addr(), demuxerHandle.addr());
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (type->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
// TODO: check demuxerResource and demuxerCb arguments // TODO: check demuxerResource and demuxerCb arguments
*demuxerHandle = dmuxOpen(new Demuxer(demuxerResource->memAddr, demuxerResource->memSize, demuxerCb->cbMsgFunc, demuxerCb->cbArg)); *handle = dmuxOpen(new Demuxer(res->memAddr, res->memSize, cb->cbMsgFunc, cb->cbArg));
return CELL_OK; return CELL_OK;
} }
int cellDmuxOpenEx(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResourceEx> demuxerResourceEx, s32 cellDmuxOpenEx(vm::ptr<const CellDmuxType> type, vm::ptr<const CellDmuxResourceEx> resEx, vm::ptr<const CellDmuxCb> cb, vm::ptr<u32> handle)
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle)
{ {
cellDmux.Warning("cellDmuxOpenEx(demuxerType_addr=0x%x, demuxerResourceEx_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", cellDmux.Warning("cellDmuxOpenEx(type=*0x%x, resEx=*0x%x, cb=*0x%x, handle=*0x%x)", type, resEx, cb, handle);
demuxerType.addr(), demuxerResourceEx.addr(), demuxerCb.addr(), demuxerHandle.addr());
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (type->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
// TODO: check demuxerResourceEx and demuxerCb arguments // TODO: check demuxerResourceEx and demuxerCb arguments
*demuxerHandle = dmuxOpen(new Demuxer(demuxerResourceEx->memAddr, demuxerResourceEx->memSize, demuxerCb->cbMsgFunc, demuxerCb->cbArg)); *handle = dmuxOpen(new Demuxer(resEx->memAddr, resEx->memSize, cb->cbMsgFunc, cb->cbArg));
return CELL_OK; return CELL_OK;
} }
int cellDmuxOpen2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<const CellDmuxResource2> demuxerResource2, s32 cellDmuxOpen2(vm::ptr<const CellDmuxType2> type2, vm::ptr<const CellDmuxResource2> res2, vm::ptr<const CellDmuxCb> cb, vm::ptr<u32> handle)
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<u32> demuxerHandle)
{ {
cellDmux.Warning("cellDmuxOpen2(demuxerType2_addr=0x%x, demuxerResource2_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)", cellDmux.Warning("cellDmuxOpen2(type2=*0x%x, res2=*0x%x, cb=*0x%x, handle=*0x%x)", type2, res2, cb, handle);
demuxerType2.addr(), demuxerResource2.addr(), demuxerCb.addr(), demuxerHandle.addr());
if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (type2->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
// TODO: check demuxerType2, demuxerResource2 and demuxerCb arguments // TODO: check demuxerType2, demuxerResource2 and demuxerCb arguments
*demuxerHandle = dmuxOpen(new Demuxer(demuxerResource2->memAddr, demuxerResource2->memSize, demuxerCb->cbMsgFunc, demuxerCb->cbArg)); *handle = dmuxOpen(new Demuxer(res2->memAddr, res2->memSize, cb->cbMsgFunc, cb->cbArg));
return CELL_OK; return CELL_OK;
} }
int cellDmuxClose(u32 demuxerHandle) s32 cellDmuxClose(u32 handle)
{ {
cellDmux.Warning("cellDmuxClose(demuxerHandle=%d)", demuxerHandle); cellDmux.Warning("cellDmuxClose(handle=%d)", handle);
std::shared_ptr<Demuxer> dmux; const auto dmux = Emu.GetIdManager().GetIDData<Demuxer>(handle);
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
if (!dmux)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -872,7 +869,7 @@ int cellDmuxClose(u32 demuxerHandle)
{ {
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
cellDmux.Warning("cellDmuxClose(%d) aborted", demuxerHandle); cellDmux.Warning("cellDmuxClose(%d) aborted", handle);
return CELL_OK; return CELL_OK;
} }
@ -880,17 +877,17 @@ int cellDmuxClose(u32 demuxerHandle)
} }
if (dmux->dmuxCb) Emu.GetCPU().RemoveThread(dmux->dmuxCb->GetId()); if (dmux->dmuxCb) Emu.GetCPU().RemoveThread(dmux->dmuxCb->GetId());
Emu.GetIdManager().RemoveID<Demuxer>(demuxerHandle); Emu.GetIdManager().RemoveID<Demuxer>(handle);
return CELL_OK; return CELL_OK;
} }
int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize, bool discontinuity, u64 userData) s32 cellDmuxSetStream(u32 handle, u32 streamAddress, u32 streamSize, bool discontinuity, u64 userData)
{ {
cellDmux.Log("cellDmuxSetStream(demuxerHandle=%d, streamAddress=0x%x, streamSize=%d, discontinuity=%d, userData=0x%llx", cellDmux.Log("cellDmuxSetStream(handle=%d, streamAddress=0x%x, streamSize=%d, discontinuity=%d, userData=0x%llx)", handle, streamAddress, streamSize, discontinuity, userData);
demuxerHandle, streamAddress, streamSize, discontinuity, userData);
std::shared_ptr<Demuxer> dmux; const auto dmux = Emu.GetIdManager().GetIDData<Demuxer>(handle);
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
if (!dmux)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -912,12 +909,13 @@ int cellDmuxSetStream(u32 demuxerHandle, const u32 streamAddress, u32 streamSize
return CELL_OK; return CELL_OK;
} }
int cellDmuxResetStream(u32 demuxerHandle) s32 cellDmuxResetStream(u32 handle)
{ {
cellDmux.Warning("cellDmuxResetStream(demuxerHandle=%d)", demuxerHandle); cellDmux.Warning("cellDmuxResetStream(handle=%d)", handle);
std::shared_ptr<Demuxer> dmux; const auto dmux = Emu.GetIdManager().GetIDData<Demuxer>(handle);
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
if (!dmux)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -926,12 +924,13 @@ int cellDmuxResetStream(u32 demuxerHandle)
return CELL_OK; return CELL_OK;
} }
int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle) s32 cellDmuxResetStreamAndWaitDone(u32 handle)
{ {
cellDmux.Warning("cellDmuxResetStreamAndWaitDone(demuxerHandle=%d)", demuxerHandle); cellDmux.Warning("cellDmuxResetStreamAndWaitDone(handle=%d)", handle);
std::shared_ptr<Demuxer> dmux; const auto dmux = Emu.GetIdManager().GetIDData<Demuxer>(handle);
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
if (!dmux)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -949,7 +948,7 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
{ {
if (Emu.IsStopped()) if (Emu.IsStopped())
{ {
cellDmux.Warning("cellDmuxResetStreamAndWaitDone(%d) aborted", demuxerHandle); cellDmux.Warning("cellDmuxResetStreamAndWaitDone(%d) aborted", handle);
return CELL_OK; return CELL_OK;
} }
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
@ -958,48 +957,41 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
return CELL_OK; return CELL_OK;
} }
int cellDmuxQueryEsAttr(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellCodecEsFilterId> esFilterId, s32 cellDmuxQueryEsAttr(vm::ptr<const CellDmuxType> type, vm::ptr<const CellCodecEsFilterId> esFilterId, u32 esSpecificInfo, vm::ptr<CellDmuxEsAttr> esAttr)
const u32 esSpecificInfo_addr, vm::ptr<CellDmuxEsAttr> esAttr)
{ {
cellDmux.Warning("cellDmuxQueryEsAttr(demuxerType_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)", cellDmux.Warning("cellDmuxQueryEsAttr(demuxerType=*0x%x, esFilterId=*0x%x, esSpecificInfo=*0x%x, esAttr=*0x%x)", type, esFilterId, esSpecificInfo, esAttr);
demuxerType.addr(), esFilterId.addr(), esSpecificInfo_addr, esAttr.addr());
if (demuxerType->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (type->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
// TODO: check esFilterId and esSpecificInfo correctly // TODO: check esFilterId and esSpecificInfo correctly
dmuxQueryEsAttr(0, esFilterId, esSpecificInfo_addr, esAttr); dmuxQueryEsAttr(0, esFilterId, esSpecificInfo, esAttr);
return CELL_OK; return CELL_OK;
} }
int cellDmuxQueryEsAttr2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<const CellCodecEsFilterId> esFilterId, s32 cellDmuxQueryEsAttr2(vm::ptr<const CellDmuxType2> type2, vm::ptr<const CellCodecEsFilterId> esFilterId, u32 esSpecificInfo, vm::ptr<CellDmuxEsAttr> esAttr)
const u32 esSpecificInfo_addr, vm::ptr<CellDmuxEsAttr> esAttr)
{ {
cellDmux.Warning("cellDmuxQueryEsAttr2(demuxerType2_addr=0x%x, esFilterId_addr=0x%x, esSpecificInfo_addr=0x%x, esAttr_addr=0x%x)", cellDmux.Warning("cellDmuxQueryEsAttr2(type2=*0x%x, esFilterId=*0x%x, esSpecificInfo=*0x%x, esAttr=*0x%x)", type2, esFilterId, esSpecificInfo, esAttr);
demuxerType2.addr(), esFilterId.addr(), esSpecificInfo_addr, esAttr.addr());
if (demuxerType2->streamType != CELL_DMUX_STREAM_TYPE_PAMF) if (type2->streamType != CELL_DMUX_STREAM_TYPE_PAMF)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
// TODO: check demuxerType2, esFilterId and esSpecificInfo correctly // TODO: check demuxerType2, esFilterId and esSpecificInfo correctly
dmuxQueryEsAttr(demuxerType2->streamSpecificInfo_addr, esFilterId, esSpecificInfo_addr, esAttr); dmuxQueryEsAttr(type2->streamSpecificInfo, esFilterId, esSpecificInfo, esAttr);
return CELL_OK; return CELL_OK;
} }
int cellDmuxEnableEs(u32 demuxerHandle, vm::ptr<const CellCodecEsFilterId> esFilterId, s32 cellDmuxEnableEs(u32 handle, vm::ptr<const CellCodecEsFilterId> esFilterId, vm::ptr<const CellDmuxEsResource> esResourceInfo, vm::ptr<const CellDmuxEsCb> esCb, u32 esSpecificInfo, vm::ptr<u32> esHandle)
vm::ptr<const CellDmuxEsResource> esResourceInfo, vm::ptr<const CellDmuxEsCb> esCb,
const u32 esSpecificInfo_addr, vm::ptr<u32> esHandle)
{ {
cellDmux.Warning("cellDmuxEnableEs(demuxerHandle=%d, esFilterId_addr=0x%x, esResourceInfo_addr=0x%x, esCb_addr=0x%x, " cellDmux.Warning("cellDmuxEnableEs(handle=%d, esFilterId=*0x%x, esResourceInfo=*0x%x, esCb=*0x%x, esSpecificInfo=*0x%x, esHandle=*0x%x)", handle, esFilterId, esResourceInfo, esCb, esSpecificInfo, esHandle);
"esSpecificInfo_addr=0x%x, esHandle_addr=0x%x)", demuxerHandle, esFilterId.addr(), esResourceInfo.addr(),
esCb.addr(), esSpecificInfo_addr, esHandle.addr());
std::shared_ptr<Demuxer> dmux; const auto dmux = Emu.GetIdManager().GetIDData<Demuxer>(handle);
if (!Emu.GetIdManager().GetIDData(demuxerHandle, dmux))
if (!dmux)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -1008,14 +1000,14 @@ int cellDmuxEnableEs(u32 demuxerHandle, vm::ptr<const CellCodecEsFilterId> esFil
std::shared_ptr<ElementaryStream> es(new ElementaryStream(dmux.get(), esResourceInfo->memAddr, esResourceInfo->memSize, std::shared_ptr<ElementaryStream> es(new ElementaryStream(dmux.get(), esResourceInfo->memAddr, esResourceInfo->memSize,
esFilterId->filterIdMajor, esFilterId->filterIdMinor, esFilterId->supplementalInfo1, esFilterId->supplementalInfo2, esFilterId->filterIdMajor, esFilterId->filterIdMinor, esFilterId->supplementalInfo1, esFilterId->supplementalInfo2,
esCb->cbEsMsgFunc, esCb->cbArg, esSpecificInfo_addr)); esCb->cbEsMsgFunc, esCb->cbArg, esSpecificInfo));
u32 id = Emu.GetIdManager().GetNewID(es); u32 id = Emu.GetIdManager().GetNewID(es);
es->id = id; es->id = id;
*esHandle = id; *esHandle = id;
cellDmux.Warning("*** New ES(dmux=%d, addr=0x%x, size=0x%x, filter(0x%x, 0x%x, 0x%x, 0x%x), cb=0x%x(arg=0x%x), spec=0x%x): id = %d", cellDmux.Warning("*** New ES(dmux=%d, addr=0x%x, size=0x%x, filter={0x%x, 0x%x, 0x%x, 0x%x}, cb=0x%x, arg=0x%x, spec=0x%x): id = %d",
demuxerHandle, es->memAddr, es->memSize, es->fidMajor, es->fidMinor, es->sup1, es->sup2, es->cbFunc, es->cbArg, es->spec, id); handle, es->memAddr, es->memSize, es->fidMajor, es->fidMinor, es->sup1, es->sup2, es->cbFunc, es->cbArg, es->spec, id);
DemuxerTask task(dmuxEnableEs); DemuxerTask task(dmuxEnableEs);
task.es.es = id; task.es.es = id;
@ -1025,12 +1017,13 @@ int cellDmuxEnableEs(u32 demuxerHandle, vm::ptr<const CellCodecEsFilterId> esFil
return CELL_OK; return CELL_OK;
} }
int cellDmuxDisableEs(u32 esHandle) s32 cellDmuxDisableEs(u32 esHandle)
{ {
cellDmux.Warning("cellDmuxDisableEs(esHandle=0x%x)", esHandle); cellDmux.Warning("cellDmuxDisableEs(esHandle=%d)", esHandle);
std::shared_ptr<ElementaryStream> es; const auto es = Emu.GetIdManager().GetIDData<ElementaryStream>(esHandle);
if (!Emu.GetIdManager().GetIDData(esHandle, es))
if (!es)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -1043,12 +1036,13 @@ int cellDmuxDisableEs(u32 esHandle)
return CELL_OK; return CELL_OK;
} }
int cellDmuxResetEs(u32 esHandle) s32 cellDmuxResetEs(u32 esHandle)
{ {
cellDmux.Log("cellDmuxResetEs(esHandle=0x%x)", esHandle); cellDmux.Log("cellDmuxResetEs(esHandle=%d)", esHandle);
std::shared_ptr<ElementaryStream> es; const auto es = Emu.GetIdManager().GetIDData<ElementaryStream>(esHandle);
if (!Emu.GetIdManager().GetIDData(esHandle, es))
if (!es)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -1061,13 +1055,13 @@ int cellDmuxResetEs(u32 esHandle)
return CELL_OK; return CELL_OK;
} }
int cellDmuxGetAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecificInfo_ptr) s32 cellDmuxGetAu(u32 esHandle, vm::ptr<u32> auInfo, vm::ptr<u32> auSpecificInfo)
{ {
cellDmux.Log("cellDmuxGetAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux.Log("cellDmuxGetAu(esHandle=%d, auInfo=**0x%x, auSpecificInfo=**0x%x)", esHandle, auInfo, auSpecificInfo);
esHandle, auInfo_ptr.addr(), auSpecificInfo_ptr.addr());
std::shared_ptr<ElementaryStream> es; const auto es = Emu.GetIdManager().GetIDData<ElementaryStream>(esHandle);
if (!Emu.GetIdManager().GetIDData(esHandle, es))
if (!es)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -1079,18 +1073,18 @@ int cellDmuxGetAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecific
return CELL_DMUX_ERROR_EMPTY; return CELL_DMUX_ERROR_EMPTY;
} }
*auInfo_ptr = info; *auInfo = info;
*auSpecificInfo_ptr = spec; *auSpecificInfo = spec;
return CELL_OK; return CELL_OK;
} }
int cellDmuxPeekAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecificInfo_ptr) s32 cellDmuxPeekAu(u32 esHandle, vm::ptr<u32> auInfo, vm::ptr<u32> auSpecificInfo)
{ {
cellDmux.Log("cellDmuxPeekAu(esHandle=0x%x, auInfo_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux.Log("cellDmuxPeekAu(esHandle=%d, auInfo=**0x%x, auSpecificInfo=**0x%x)", esHandle, auInfo, auSpecificInfo);
esHandle, auInfo_ptr.addr(), auSpecificInfo_ptr.addr());
std::shared_ptr<ElementaryStream> es; const auto es = Emu.GetIdManager().GetIDData<ElementaryStream>(esHandle);
if (!Emu.GetIdManager().GetIDData(esHandle, es))
if (!es)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -1102,18 +1096,18 @@ int cellDmuxPeekAu(u32 esHandle, vm::ptr<u32> auInfo_ptr, vm::ptr<u32> auSpecifi
return CELL_DMUX_ERROR_EMPTY; return CELL_DMUX_ERROR_EMPTY;
} }
*auInfo_ptr = info; *auInfo = info;
*auSpecificInfo_ptr = spec; *auSpecificInfo = spec;
return CELL_OK; return CELL_OK;
} }
int cellDmuxGetAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpecificInfo_ptr) s32 cellDmuxGetAuEx(u32 esHandle, vm::ptr<u32> auInfoEx, vm::ptr<u32> auSpecificInfo)
{ {
cellDmux.Log("cellDmuxGetAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux.Log("cellDmuxGetAuEx(esHandle=%d, auInfoEx=**0x%x, auSpecificInfo=**0x%x)", esHandle, auInfoEx, auSpecificInfo);
esHandle, auInfoEx_ptr.addr(), auSpecificInfo_ptr.addr());
std::shared_ptr<ElementaryStream> es; const auto es = Emu.GetIdManager().GetIDData<ElementaryStream>(esHandle);
if (!Emu.GetIdManager().GetIDData(esHandle, es))
if (!es)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -1125,18 +1119,18 @@ int cellDmuxGetAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpec
return CELL_DMUX_ERROR_EMPTY; return CELL_DMUX_ERROR_EMPTY;
} }
*auInfoEx_ptr = info; *auInfoEx = info;
*auSpecificInfo_ptr = spec; *auSpecificInfo = spec;
return CELL_OK; return CELL_OK;
} }
int cellDmuxPeekAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpecificInfo_ptr) s32 cellDmuxPeekAuEx(u32 esHandle, vm::ptr<u32> auInfoEx, vm::ptr<u32> auSpecificInfo)
{ {
cellDmux.Log("cellDmuxPeekAuEx(esHandle=0x%x, auInfoEx_ptr_addr=0x%x, auSpecificInfo_ptr_addr=0x%x)", cellDmux.Log("cellDmuxPeekAuEx(esHandle=%d, auInfoEx=**0x%x, auSpecificInfo=**0x%x)", esHandle, auInfoEx, auSpecificInfo);
esHandle, auInfoEx_ptr.addr(), auSpecificInfo_ptr.addr());
std::shared_ptr<ElementaryStream> es; const auto es = Emu.GetIdManager().GetIDData<ElementaryStream>(esHandle);
if (!Emu.GetIdManager().GetIDData(esHandle, es))
if (!es)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -1148,17 +1142,18 @@ int cellDmuxPeekAuEx(u32 esHandle, vm::ptr<u32> auInfoEx_ptr, vm::ptr<u32> auSpe
return CELL_DMUX_ERROR_EMPTY; return CELL_DMUX_ERROR_EMPTY;
} }
*auInfoEx_ptr = info; *auInfoEx = info;
*auSpecificInfo_ptr = spec; *auSpecificInfo = spec;
return CELL_OK; return CELL_OK;
} }
int cellDmuxReleaseAu(u32 esHandle) s32 cellDmuxReleaseAu(u32 esHandle)
{ {
cellDmux.Log("cellDmuxReleaseAu(esHandle=0x%x)", esHandle); cellDmux.Log("cellDmuxReleaseAu(esHandle=%d)", esHandle);
std::shared_ptr<ElementaryStream> es; const auto es = Emu.GetIdManager().GetIDData<ElementaryStream>(esHandle);
if (!Emu.GetIdManager().GetIDData(esHandle, es))
if (!es)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }
@ -1170,12 +1165,13 @@ int cellDmuxReleaseAu(u32 esHandle)
return CELL_OK; return CELL_OK;
} }
int cellDmuxFlushEs(u32 esHandle) s32 cellDmuxFlushEs(u32 esHandle)
{ {
cellDmux.Warning("cellDmuxFlushEs(esHandle=0x%x)", esHandle); cellDmux.Warning("cellDmuxFlushEs(esHandle=%d)", esHandle);
std::shared_ptr<ElementaryStream> es; const auto es = Emu.GetIdManager().GetIDData<ElementaryStream>(esHandle);
if (!Emu.GetIdManager().GetIDData(esHandle, es))
if (!es)
{ {
return CELL_DMUX_ERROR_ARG; return CELL_DMUX_ERROR_ARG;
} }

View file

@ -169,7 +169,7 @@ struct CellDmuxPamfSpecificInfo
struct CellDmuxType2 struct CellDmuxType2
{ {
be_t<CellDmuxStreamType> streamType; be_t<CellDmuxStreamType> streamType;
be_t<u32> streamSpecificInfo_addr; be_t<u32> streamSpecificInfo;
}; };
struct CellDmuxResource struct CellDmuxResource

View file

@ -210,9 +210,9 @@ s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32
{ {
cellFs.Warning("cellFsGetDirectoryEntries(fd=0x%x, entries=*0x%x, entries_size=0x%x, data_count=*0x%x)", fd, entries, entries_size, data_count); cellFs.Warning("cellFsGetDirectoryEntries(fd=0x%x, entries=*0x%x, entries_size=0x%x, data_count=*0x%x)", fd, entries, entries_size, data_count);
std::shared_ptr<vfsDirBase> directory; const auto directory = Emu.GetIdManager().GetIDData<vfsDirBase>(fd);
if (!Emu.GetIdManager().GetIDData(fd, directory)) if (!directory)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -251,9 +251,9 @@ s32 cellFsReadWithOffset(u32 fd, u64 offset, vm::ptr<void> buf, u64 buffer_size,
// TODO: use single sys_fs_fcntl syscall // TODO: use single sys_fs_fcntl syscall
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file) || file->flags & CELL_FS_O_WRONLY) if (!file || file->flags & CELL_FS_O_WRONLY)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -282,9 +282,9 @@ s32 cellFsWriteWithOffset(u32 fd, u64 offset, vm::ptr<const void> buf, u64 data_
// TODO: use single sys_fs_fcntl syscall // TODO: use single sys_fs_fcntl syscall
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file) || !(file->flags & CELL_FS_O_ACCMODE)) if (!file || !(file->flags & CELL_FS_O_ACCMODE))
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -326,9 +326,9 @@ s32 cellFsStReadInit(u32 fd, vm::ptr<const CellFsRingBuffer> ringbuf)
return CELL_FS_EINVAL; return CELL_FS_EINVAL;
} }
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -364,9 +364,9 @@ s32 cellFsStReadFinish(u32 fd)
{ {
cellFs.Warning("cellFsStReadFinish(fd=0x%x)", fd); cellFs.Warning("cellFsStReadFinish(fd=0x%x)", fd);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; // ??? return CELL_FS_EBADF; // ???
} }
@ -387,9 +387,9 @@ s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
{ {
cellFs.Warning("cellFsStReadGetRingBuf(fd=0x%x, ringbuf=*0x%x)", fd, ringbuf); cellFs.Warning("cellFsStReadGetRingBuf(fd=0x%x, ringbuf=*0x%x)", fd, ringbuf);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -411,9 +411,9 @@ s32 cellFsStReadGetStatus(u32 fd, vm::ptr<u64> status)
{ {
cellFs.Warning("cellFsStReadGetRingBuf(fd=0x%x, status=*0x%x)", fd, status); cellFs.Warning("cellFsStReadGetRingBuf(fd=0x%x, status=*0x%x)", fd, status);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -445,9 +445,9 @@ s32 cellFsStReadGetRegid(u32 fd, vm::ptr<u64> regid)
{ {
cellFs.Warning("cellFsStReadGetRingBuf(fd=0x%x, regid=*0x%x)", fd, regid); cellFs.Warning("cellFsStReadGetRingBuf(fd=0x%x, regid=*0x%x)", fd, regid);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -466,9 +466,9 @@ s32 cellFsStReadStart(u32 fd, u64 offset, u64 size)
{ {
cellFs.Warning("cellFsStReadStart(fd=0x%x, offset=0x%llx, size=0x%llx)", fd, offset, size); cellFs.Warning("cellFsStReadStart(fd=0x%x, offset=0x%llx, size=0x%llx)", fd, offset, size);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -548,9 +548,9 @@ s32 cellFsStReadStop(u32 fd)
{ {
cellFs.Warning("cellFsStReadStop(fd=0x%x)", fd); cellFs.Warning("cellFsStReadStop(fd=0x%x)", fd);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -579,9 +579,9 @@ s32 cellFsStRead(u32 fd, vm::ptr<u8> buf, u64 size, vm::ptr<u64> rsize)
{ {
cellFs.Warning("cellFsStRead(fd=0x%x, buf=*0x%x, size=0x%llx, rsize=*0x%x)", fd, buf, size, rsize); cellFs.Warning("cellFsStRead(fd=0x%x, buf=*0x%x, size=0x%llx, rsize=*0x%x)", fd, buf, size, rsize);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -613,9 +613,9 @@ s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<u32> addr, vm::ptr<u64> size)
{ {
cellFs.Warning("cellFsStReadGetCurrentAddr(fd=0x%x, addr=*0x%x, size=*0x%x)", fd, addr, size); cellFs.Warning("cellFsStReadGetCurrentAddr(fd=0x%x, addr=*0x%x, size=*0x%x)", fd, addr, size);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -646,9 +646,9 @@ s32 cellFsStReadPutCurrentAddr(u32 fd, vm::ptr<u8> addr, u64 size)
{ {
cellFs.Warning("cellFsStReadPutCurrentAddr(fd=0x%x, addr=*0x%x, size=0x%llx)", fd, addr, size); cellFs.Warning("cellFsStReadPutCurrentAddr(fd=0x%x, addr=*0x%x, size=0x%llx)", fd, addr, size);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -673,9 +673,9 @@ s32 cellFsStReadWait(u32 fd, u64 size)
{ {
cellFs.Warning("cellFsStReadWait(fd=0x%x, size=0x%llx)", fd, size); cellFs.Warning("cellFsStReadWait(fd=0x%x, size=0x%llx)", fd, size);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -707,9 +707,9 @@ s32 cellFsStReadWaitCallback(u32 fd, u64 size, fs_st_cb_t func)
{ {
cellFs.Warning("cellFsStReadWaitCallback(fd=0x%x, size=0x%llx, func=*0x%x)", fd, size, func); cellFs.Warning("cellFsStReadWaitCallback(fd=0x%x, size=0x%llx, func=*0x%x)", fd, size, func);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
return CELL_FS_EBADF; return CELL_FS_EBADF;
} }
@ -875,9 +875,9 @@ void fsAio(vm::ptr<CellFsAio> aio, bool write, s32 xid, fs_aio_cb_t func)
s32 error = CELL_OK; s32 error = CELL_OK;
u64 result = 0; u64 result = 0;
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(aio->fd);
if (!Emu.GetIdManager().GetIDData(aio->fd, file) || (!write && file->flags & CELL_FS_O_WRONLY) || (write && !(file->flags & CELL_FS_O_ACCMODE))) if (!file || (!write && file->flags & CELL_FS_O_WRONLY) || (write && !(file->flags & CELL_FS_O_ACCMODE)))
{ {
error = CELL_FS_EBADF; error = CELL_FS_EBADF;
} }
@ -979,11 +979,11 @@ s32 cellFsSetIoBufferFromDefaultContainer(u32 fd, u32 buffer_size, u32 page_type
{ {
cellFs.Todo("cellFsSetIoBufferFromDefaultContainer(fd=%d, buffer_size=%d, page_type=%d)", fd, buffer_size, page_type); cellFs.Todo("cellFsSetIoBufferFromDefaultContainer(fd=%d, buffer_size=%d, page_type=%d)", fd, buffer_size, page_type);
std::shared_ptr<fs_file_t> file; const auto file = Emu.GetIdManager().GetIDData<fs_file_t>(fd);
if (!Emu.GetIdManager().GetIDData(fd, file)) if (!file)
{ {
CELL_FS_EBADF; return CELL_FS_EBADF;
} }
return CELL_OK; return CELL_OK;

View file

@ -4,8 +4,11 @@
#include "Emu/IdManager.h" #include "Emu/IdManager.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
extern "C"
{
#include "stblib/stb_image.h" #include "stblib/stb_image.h"
#include "stblib/stb_image.c" // (TODO: Should we put this elsewhere?) #include "stblib/stb_image.c"
}
#include "Emu/FS/VFS.h" #include "Emu/FS/VFS.h"
#include "Emu/FS/vfsFileBase.h" #include "Emu/FS/vfsFileBase.h"

View file

@ -4,7 +4,10 @@
#include "Emu/IdManager.h" #include "Emu/IdManager.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
extern "C"
{
#include "stblib/stb_image.h" #include "stblib/stb_image.h"
}
#include "Emu/FS/VFS.h" #include "Emu/FS/VFS.h"
#include "Emu/FS/vfsFileBase.h" #include "Emu/FS/vfsFileBase.h"

View file

@ -4,7 +4,10 @@
#include "Emu/IdManager.h" #include "Emu/IdManager.h"
#include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/Modules.h"
extern "C"
{
#include "stblib/stb_image.h" #include "stblib/stb_image.h"
}
#include "Emu/FS/VFS.h" #include "Emu/FS/VFS.h"
#include "Emu/FS/vfsFileBase.h" #include "Emu/FS/vfsFileBase.h"

View file

@ -268,12 +268,6 @@ u32 vdecOpen(VideoDecoder* vdec_ptr)
{ {
int err; int err;
if (task.mode != CELL_VDEC_DEC_MODE_NORMAL)
{
cellVdec.Error("vdecDecodeAu: unsupported decoding mode(%d)", task.mode);
break;
}
vdec.reader.addr = task.addr; vdec.reader.addr = task.addr;
vdec.reader.size = task.size; vdec.reader.size = task.size;
//LOG_NOTICE(HLE, "Video AU: size = 0x%x, pts = 0x%llx, dts = 0x%llx", task.size, task.pts, task.dts); //LOG_NOTICE(HLE, "Video AU: size = 0x%x, pts = 0x%llx, dts = 0x%llx", task.size, task.pts, task.dts);
@ -557,46 +551,45 @@ u32 vdecOpen(VideoDecoder* vdec_ptr)
return vdec_id; return vdec_id;
} }
int cellVdecQueryAttr(vm::ptr<const CellVdecType> type, vm::ptr<CellVdecAttr> attr) s32 cellVdecQueryAttr(vm::ptr<const CellVdecType> type, vm::ptr<CellVdecAttr> attr)
{ {
cellVdec.Warning("cellVdecQueryAttr(type_addr=0x%x, attr_addr=0x%x)", type.addr(), attr.addr()); cellVdec.Warning("cellVdecQueryAttr(type=*0x%x, attr=*0x%x)", type, attr);
return vdecQueryAttr(type->codecType, type->profileLevel, 0, attr); return vdecQueryAttr(type->codecType, type->profileLevel, 0, attr);
} }
int cellVdecQueryAttrEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<CellVdecAttr> attr) s32 cellVdecQueryAttrEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<CellVdecAttr> attr)
{ {
cellVdec.Warning("cellVdecQueryAttrEx(type_addr=0x%x, attr_addr=0x%x)", type.addr(), attr.addr()); cellVdec.Warning("cellVdecQueryAttrEx(type=*0x%x, attr=*0x%x)", type, attr);
return vdecQueryAttr(type->codecType, type->profileLevel, type->codecSpecificInfo_addr, attr); return vdecQueryAttr(type->codecType, type->profileLevel, type->codecSpecificInfo_addr, attr);
} }
int cellVdecOpen(vm::ptr<const CellVdecType> type, vm::ptr<const CellVdecResource> res, vm::ptr<const CellVdecCb> cb, vm::ptr<u32> handle) s32 cellVdecOpen(vm::ptr<const CellVdecType> type, vm::ptr<const CellVdecResource> res, vm::ptr<const CellVdecCb> cb, vm::ptr<u32> handle)
{ {
cellVdec.Warning("cellVdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellVdec.Warning("cellVdecOpen(type=*0x%x, res=*0x%x, cb=*0x%x, handle=*0x%x)", type, res, cb, handle);
type.addr(), res.addr(), cb.addr(), handle.addr());
*handle = vdecOpen(new VideoDecoder(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg)); *handle = vdecOpen(new VideoDecoder(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg));
return CELL_OK; return CELL_OK;
} }
int cellVdecOpenEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<const CellVdecResourceEx> res, vm::ptr<const CellVdecCb> cb, vm::ptr<u32> handle) s32 cellVdecOpenEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<const CellVdecResourceEx> res, vm::ptr<const CellVdecCb> cb, vm::ptr<u32> handle)
{ {
cellVdec.Warning("cellVdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)", cellVdec.Warning("cellVdecOpenEx(type=*0x%x, res=*0x%x, cb=*0x%x, handle=*0x%x)", type, res, cb, handle);
type.addr(), res.addr(), cb.addr(), handle.addr());
*handle = vdecOpen(new VideoDecoder(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg)); *handle = vdecOpen(new VideoDecoder(type->codecType, type->profileLevel, res->memAddr, res->memSize, cb->cbFunc, cb->cbArg));
return CELL_OK; return CELL_OK;
} }
int cellVdecClose(u32 handle) s32 cellVdecClose(u32 handle)
{ {
cellVdec.Warning("cellVdecClose(handle=%d)", handle); cellVdec.Warning("cellVdecClose(handle=%d)", handle);
std::shared_ptr<VideoDecoder> vdec; const auto vdec = Emu.GetIdManager().GetIDData<VideoDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, vdec))
if (!vdec)
{ {
return CELL_VDEC_ERROR_ARG; return CELL_VDEC_ERROR_ARG;
} }
@ -619,12 +612,13 @@ int cellVdecClose(u32 handle)
return CELL_OK; return CELL_OK;
} }
int cellVdecStartSeq(u32 handle) s32 cellVdecStartSeq(u32 handle)
{ {
cellVdec.Log("cellVdecStartSeq(handle=%d)", handle); cellVdec.Log("cellVdecStartSeq(handle=%d)", handle);
std::shared_ptr<VideoDecoder> vdec; const auto vdec = Emu.GetIdManager().GetIDData<VideoDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, vdec))
if (!vdec)
{ {
return CELL_VDEC_ERROR_ARG; return CELL_VDEC_ERROR_ARG;
} }
@ -633,12 +627,13 @@ int cellVdecStartSeq(u32 handle)
return CELL_OK; return CELL_OK;
} }
int cellVdecEndSeq(u32 handle) s32 cellVdecEndSeq(u32 handle)
{ {
cellVdec.Warning("cellVdecEndSeq(handle=%d)", handle); cellVdec.Warning("cellVdecEndSeq(handle=%d)", handle);
std::shared_ptr<VideoDecoder> vdec; const auto vdec = Emu.GetIdManager().GetIDData<VideoDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, vdec))
if (!vdec)
{ {
return CELL_VDEC_ERROR_ARG; return CELL_VDEC_ERROR_ARG;
} }
@ -647,16 +642,22 @@ int cellVdecEndSeq(u32 handle)
return CELL_OK; return CELL_OK;
} }
int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, vm::ptr<const CellVdecAuInfo> auInfo) s32 cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, vm::ptr<const CellVdecAuInfo> auInfo)
{ {
cellVdec.Log("cellVdecDecodeAu(handle=%d, mode=0x%x, auInfo_addr=0x%x)", handle, mode, auInfo.addr()); cellVdec.Log("cellVdecDecodeAu(handle=%d, mode=%d, auInfo=*0x%x)", handle, mode, auInfo);
std::shared_ptr<VideoDecoder> vdec; const auto vdec = Emu.GetIdManager().GetIDData<VideoDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, vdec))
if (!vdec || mode > CELL_VDEC_DEC_MODE_PB_SKIP)
{ {
return CELL_VDEC_ERROR_ARG; return CELL_VDEC_ERROR_ARG;
} }
if (mode != CELL_VDEC_DEC_MODE_NORMAL)
{
cellVdec.Fatal("cellVdecDecodeAu(): unsupported decoding mode (%d)", mode);
}
// TODO: check info // TODO: check info
VdecTask task(vdecDecodeAu); VdecTask task(vdecDecodeAu);
task.mode = mode; task.mode = mode;
@ -671,12 +672,13 @@ int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, vm::ptr<const CellVdec
return CELL_OK; return CELL_OK;
} }
int cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::ptr<u8> outBuff) s32 cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::ptr<u8> outBuff)
{ {
cellVdec.Log("cellVdecGetPicture(handle=%d, format_addr=0x%x, outBuff_addr=0x%x)", handle, format.addr(), outBuff.addr()); cellVdec.Log("cellVdecGetPicture(handle=%d, format=*0x%x, outBuff=*0x%x)", handle, format, outBuff);
std::shared_ptr<VideoDecoder> vdec; const auto vdec = Emu.GetIdManager().GetIDData<VideoDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, vdec))
if (!vdec)
{ {
return CELL_VDEC_ERROR_ARG; return CELL_VDEC_ERROR_ARG;
} }
@ -726,12 +728,13 @@ int cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::
return CELL_OK; return CELL_OK;
} }
int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr) s32 cellVdecGetPicItem(u32 handle, vm::ptr<vm::bptr<CellVdecPicItem>> picItem)
{ {
cellVdec.Log("cellVdecGetPicItem(handle=%d, picItem_ptr_addr=0x%x)", handle, picItem_ptr.addr()); cellVdec.Log("cellVdecGetPicItem(handle=%d, picItem=**0x%x)", handle, picItem);
std::shared_ptr<VideoDecoder> vdec; const auto vdec = Emu.GetIdManager().GetIDData<VideoDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, vdec))
if (!vdec)
{ {
return CELL_VDEC_ERROR_ARG; return CELL_VDEC_ERROR_ARG;
} }
@ -745,7 +748,7 @@ int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr)
AVFrame& frame = *vf.data; AVFrame& frame = *vf.data;
auto info = vm::ptr<CellVdecPicItem>::make(vdec->memAddr + vdec->memBias); const auto info = vm::ptr<CellVdecPicItem>::make(vdec->memAddr + vdec->memBias);
vdec->memBias += 512; vdec->memBias += 512;
if (vdec->memBias + 512 > vdec->memSize) if (vdec->memBias + 512 > vdec->memSize)
@ -866,16 +869,17 @@ int cellVdecGetPicItem(u32 handle, vm::ptr<u32> picItem_ptr)
cellVdec.Fatal("cellVdecGetPicItem(MPEG2)"); cellVdec.Fatal("cellVdecGetPicItem(MPEG2)");
} }
*picItem_ptr = info.addr(); *picItem = info;
return CELL_OK; return CELL_OK;
} }
int cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc) s32 cellVdecSetFrameRate(u32 handle, CellVdecFrameRate frc)
{ {
cellVdec.Log("cellVdecSetFrameRate(handle=%d, frc=0x%x)", handle, frc); cellVdec.Log("cellVdecSetFrameRate(handle=%d, frc=0x%x)", handle, frc);
std::shared_ptr<VideoDecoder> vdec; const auto vdec = Emu.GetIdManager().GetIDData<VideoDecoder>(handle);
if (!Emu.GetIdManager().GetIDData(handle, vdec))
if (!vdec)
{ {
return CELL_VDEC_ERROR_ARG; return CELL_VDEC_ERROR_ARG;
} }

View file

@ -13,9 +13,9 @@ extern "C"
extern Module cellVpost; extern Module cellVpost;
int cellVpostQueryAttr(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<CellVpostAttr> attr) s32 cellVpostQueryAttr(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<CellVpostAttr> attr)
{ {
cellVpost.Warning("cellVpostQueryAttr(cfgParam_addr=0x%x, attr_addr=0x%x)", cfgParam.addr(), attr.addr()); cellVpost.Warning("cellVpostQueryAttr(cfgParam=*0x%x, attr=*0x%x)", cfgParam, attr);
// TODO: check cfgParam and output values // TODO: check cfgParam and output values
@ -37,32 +37,31 @@ u32 vpostOpen(VpostInstance* data)
return id; return id;
} }
int cellVpostOpen(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResource> resource, vm::ptr<u32> handle) s32 cellVpostOpen(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResource> resource, vm::ptr<u32> handle)
{ {
cellVpost.Warning("cellVpostOpen(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)", cellVpost.Warning("cellVpostOpen(cfgParam=*0x%x, resource=*0x%x, handle=*0x%x)", cfgParam, resource, handle);
cfgParam.addr(), resource.addr(), handle.addr());
// TODO: check values // TODO: check values
*handle = vpostOpen(new VpostInstance(cfgParam->outPicFmt == CELL_VPOST_PIC_FMT_OUT_RGBA_ILV)); *handle = vpostOpen(new VpostInstance(cfgParam->outPicFmt == CELL_VPOST_PIC_FMT_OUT_RGBA_ILV));
return CELL_OK; return CELL_OK;
} }
int cellVpostOpenEx(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResourceEx> resource, vm::ptr<u32> handle) s32 cellVpostOpenEx(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResourceEx> resource, vm::ptr<u32> handle)
{ {
cellVpost.Warning("cellVpostOpenEx(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)", cellVpost.Warning("cellVpostOpenEx(cfgParam=*0x%x, resource=*0x%x, handle=*0x%x)", cfgParam, resource, handle);
cfgParam.addr(), resource.addr(), handle.addr());
// TODO: check values // TODO: check values
*handle = vpostOpen(new VpostInstance(cfgParam->outPicFmt == CELL_VPOST_PIC_FMT_OUT_RGBA_ILV)); *handle = vpostOpen(new VpostInstance(cfgParam->outPicFmt == CELL_VPOST_PIC_FMT_OUT_RGBA_ILV));
return CELL_OK; return CELL_OK;
} }
int cellVpostClose(u32 handle) s32 cellVpostClose(u32 handle)
{ {
cellVpost.Warning("cellVpostClose(handle=0x%x)", handle); cellVpost.Warning("cellVpostClose(handle=%d)", handle);
std::shared_ptr<VpostInstance> vpost; const auto vpost = Emu.GetIdManager().GetIDData<VpostInstance>(handle);
if (!Emu.GetIdManager().GetIDData(handle, vpost))
if (!vpost)
{ {
return CELL_VPOST_ERROR_C_ARG_HDL_INVALID; return CELL_VPOST_ERROR_C_ARG_HDL_INVALID;
} }
@ -71,14 +70,13 @@ int cellVpostClose(u32 handle)
return CELL_OK; return CELL_OK;
} }
int cellVpostExec(u32 handle, vm::ptr<const u8> inPicBuff, vm::ptr<const CellVpostCtrlParam> ctrlParam, s32 cellVpostExec(u32 handle, vm::ptr<const u8> inPicBuff, vm::ptr<const CellVpostCtrlParam> ctrlParam, vm::ptr<u8> outPicBuff, vm::ptr<CellVpostPictureInfo> picInfo)
vm::ptr<u8> outPicBuff, vm::ptr<CellVpostPictureInfo> picInfo)
{ {
cellVpost.Log("cellVpostExec(handle=0x%x, inPicBuff_addr=0x%x, ctrlParam_addr=0x%x, outPicBuff_addr=0x%x, picInfo_addr=0x%x)", cellVpost.Log("cellVpostExec(handle=%d, inPicBuff=*0x%x, ctrlParam=*0x%x, outPicBuff=*0x%x, picInfo=*0x%x)", handle, inPicBuff, ctrlParam, outPicBuff, picInfo);
handle, inPicBuff.addr(), ctrlParam.addr(), outPicBuff.addr(), picInfo.addr());
std::shared_ptr<VpostInstance> vpost; const auto vpost = Emu.GetIdManager().GetIDData<VpostInstance>(handle);
if (!Emu.GetIdManager().GetIDData(handle, vpost))
if (!vpost)
{ {
return CELL_VPOST_ERROR_E_ARG_HDL_INVALID; return CELL_VPOST_ERROR_E_ARG_HDL_INVALID;
} }

View file

@ -17,14 +17,14 @@ enum : u64
struct sys_ppu_thread_stack_t struct sys_ppu_thread_stack_t
{ {
u32 pst_addr; be_t<u32> pst_addr;
u32 pst_size; be_t<u32> pst_size;
}; };
struct ppu_thread_param_t struct ppu_thread_param_t
{ {
u32 entry; be_t<u32> entry; // vm::bptr<void(u64)>
u32 tls; be_t<u32> tls; // vm::bptr<void>
}; };
// Aux // Aux

View file

@ -49,9 +49,9 @@ s32 sys_rwlock_destroy(u32 rw_lock_id)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<rwlock_t> rwlock; const auto rwlock = Emu.GetIdManager().GetIDData<rwlock_t>(rw_lock_id);
if (!Emu.GetIdManager().GetIDData(rw_lock_id, rwlock)) if (!rwlock)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -74,9 +74,9 @@ s32 sys_rwlock_rlock(u32 rw_lock_id, u64 timeout)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<rwlock_t> rwlock; const auto rwlock = Emu.GetIdManager().GetIDData<rwlock_t>(rw_lock_id);
if (!Emu.GetIdManager().GetIDData(rw_lock_id, rwlock)) if (!rwlock)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -113,9 +113,9 @@ s32 sys_rwlock_tryrlock(u32 rw_lock_id)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<rwlock_t> rwlock; const auto rwlock = Emu.GetIdManager().GetIDData<rwlock_t>(rw_lock_id);
if (!Emu.GetIdManager().GetIDData(rw_lock_id, rwlock)) if (!rwlock)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -136,9 +136,9 @@ s32 sys_rwlock_runlock(u32 rw_lock_id)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<rwlock_t> rwlock; const auto rwlock = Emu.GetIdManager().GetIDData<rwlock_t>(rw_lock_id);
if (!Emu.GetIdManager().GetIDData(rw_lock_id, rwlock)) if (!rwlock)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -164,9 +164,9 @@ s32 sys_rwlock_wlock(PPUThread& CPU, u32 rw_lock_id, u64 timeout)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<rwlock_t> rwlock; const auto rwlock = Emu.GetIdManager().GetIDData<rwlock_t>(rw_lock_id);
if (!Emu.GetIdManager().GetIDData(rw_lock_id, rwlock)) if (!rwlock)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -208,9 +208,9 @@ s32 sys_rwlock_trywlock(PPUThread& CPU, u32 rw_lock_id)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<rwlock_t> rwlock; const auto rwlock = Emu.GetIdManager().GetIDData<rwlock_t>(rw_lock_id);
if (!Emu.GetIdManager().GetIDData(rw_lock_id, rwlock)) if (!rwlock)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -236,9 +236,9 @@ s32 sys_rwlock_wunlock(PPUThread& CPU, u32 rw_lock_id)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<rwlock_t> rwlock; const auto rwlock = Emu.GetIdManager().GetIDData<rwlock_t>(rw_lock_id);
if (!Emu.GetIdManager().GetIDData(rw_lock_id, rwlock)) if (!rwlock)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }

View file

@ -61,9 +61,9 @@ s32 sys_semaphore_destroy(u32 sem)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<semaphore_t> semaphore; const auto semaphore = Emu.GetIdManager().GetIDData<semaphore_t>(sem);
if (!Emu.GetIdManager().GetIDData(sem, semaphore)) if (!semaphore)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -86,9 +86,9 @@ s32 sys_semaphore_wait(u32 sem, u64 timeout)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<semaphore_t> semaphore; const auto semaphore = Emu.GetIdManager().GetIDData<semaphore_t>(sem);
if (!Emu.GetIdManager().GetIDData(sem, semaphore)) if (!semaphore)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -125,9 +125,9 @@ s32 sys_semaphore_trywait(u32 sem)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<semaphore_t> semaphore; const auto semaphore = Emu.GetIdManager().GetIDData<semaphore_t>(sem);
if (!Emu.GetIdManager().GetIDData(sem, semaphore)) if (!semaphore)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -148,9 +148,9 @@ s32 sys_semaphore_post(u32 sem, s32 count)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<semaphore_t> semaphore; const auto semaphore = Emu.GetIdManager().GetIDData<semaphore_t>(sem);
if (!Emu.GetIdManager().GetIDData(sem, semaphore)) if (!semaphore)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -189,9 +189,9 @@ s32 sys_semaphore_get_value(u32 sem, vm::ptr<s32> count)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<semaphore_t> semaphore; const auto semaphore = Emu.GetIdManager().GetIDData<semaphore_t>(sem);
if (!Emu.GetIdManager().GetIDData(sem, semaphore)) if (!semaphore)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }

View file

@ -28,7 +28,7 @@ s32 sys_timer_create(vm::ptr<u32> timer_id)
{ {
if (get_system_time() >= timer->start) if (get_system_time() >= timer->start)
{ {
std::shared_ptr<event_queue_t> queue = timer->port.lock(); const auto queue = timer->port.lock();
if (queue) if (queue)
{ {
@ -62,9 +62,9 @@ s32 sys_timer_destroy(u32 timer_id)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<lv2_timer_t> timer; const auto timer = Emu.GetIdManager().GetIDData<lv2_timer_t>(timer_id);
if (!Emu.GetIdManager().GetIDData(timer_id, timer)) if (!timer)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -85,9 +85,9 @@ s32 sys_timer_get_information(u32 timer_id, vm::ptr<sys_timer_information_t> inf
LV2_LOCK; LV2_LOCK;
std::shared_ptr<lv2_timer_t> timer; const auto timer = Emu.GetIdManager().GetIDData<lv2_timer_t>(timer_id);
if (!Emu.GetIdManager().GetIDData(timer_id, timer)) if (!timer)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -108,9 +108,9 @@ s32 _sys_timer_start(u32 timer_id, u64 base_time, u64 period)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<lv2_timer_t> timer; const auto timer = Emu.GetIdManager().GetIDData<lv2_timer_t>(timer_id);
if (!Emu.GetIdManager().GetIDData(timer_id, timer)) if (!timer)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -160,9 +160,9 @@ s32 sys_timer_stop(u32 timer_id)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<lv2_timer_t> timer; const auto timer = Emu.GetIdManager().GetIDData<lv2_timer_t>(timer_id);
if (!Emu.GetIdManager().GetIDData(timer_id, timer)) if (!timer)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -178,10 +178,10 @@ s32 sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data
LV2_LOCK; LV2_LOCK;
std::shared_ptr<lv2_timer_t> timer; const auto timer = Emu.GetIdManager().GetIDData<lv2_timer_t>(timer_id);
std::shared_ptr<event_queue_t> queue; const auto queue = Emu.GetIdManager().GetIDData<event_queue_t>(queue_id);
if (!Emu.GetIdManager().GetIDData(timer_id, timer) || !Emu.GetIdManager().GetIDData(queue_id, queue)) if (!timer || !queue)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }
@ -205,9 +205,9 @@ s32 sys_timer_disconnect_event_queue(u32 timer_id)
LV2_LOCK; LV2_LOCK;
std::shared_ptr<lv2_timer_t> timer; const auto timer = Emu.GetIdManager().GetIDData<lv2_timer_t>(timer_id);
if (!Emu.GetIdManager().GetIDData(timer_id, timer)) if (!timer)
{ {
return CELL_ESRCH; return CELL_ESRCH;
} }