GetMemFromAddr, VirtualToRealAddr replaced

Some arg types changed
This commit is contained in:
Nekotekina 2014-09-05 21:23:00 +04:00
parent f298d0451e
commit 225dba754d
33 changed files with 263 additions and 185 deletions

View File

@ -3236,7 +3236,7 @@ private:
void DCBZ(u32 ra, u32 rb)
{
const u64 addr = ra ? CPU.GPR[ra] + CPU.GPR[rb] : CPU.GPR[rb];
u8 *const cache_line = Memory.GetMemFromAddr(addr & ~127);
auto const cache_line = vm::get_ptr<u8>(addr & ~127);
if (cache_line)
memset(cache_line, 0, 128);
_mm_mfence();

View File

@ -48,7 +48,7 @@ void SPURecompilerCore::Compile(u16 pos)
u64 time0 = 0;
SPUDisAsm dis_asm(CPUDisAsm_InterpreterMode);
dis_asm.offset = Memory.GetMemFromAddr(CPU.dmac.ls_offset);
dis_asm.offset = vm::get_ptr<u8>(CPU.dmac.ls_offset);
StringLogger stringLogger;
stringLogger.setOption(kLoggerOptionBinaryForm, true);

View File

@ -449,7 +449,7 @@ void SPUThread::EnqMfcCmd(MFCReg& MFCArgs)
for (s32 i = (s32)PC; i < (s32)PC + 4 * 7; i += 4)
{
dis_asm.dump_pc = i;
dis_asm.offset = Memory.GetMemFromAddr(dmac.ls_offset);
dis_asm.offset = vm::get_ptr<u8>(dmac.ls_offset);
const u32 opcode = Memory.Read32(i + dmac.ls_offset);
(*SPU_instr::rrr_list)(&dis_asm, opcode);
if (i >= 0 && i < 0x40000)

View File

@ -299,14 +299,14 @@ void MemoryBlock::Init()
range_start = 0;
range_size = 0;
mem = Memory.GetMemFromAddr(0);
mem = vm::get_ptr<u8>(0);
}
void MemoryBlock::InitMemory()
{
if (!range_size)
{
mem = Memory.GetMemFromAddr(range_start);
mem = vm::get_ptr<u8>(range_start);
}
else
{

View File

@ -108,11 +108,6 @@ public:
}
}
template<typename T> void* VirtualToRealAddr(const T vaddr)
{
return GetMemFromAddr<T>(vaddr);
}
u32 RealToVirtualAddr(const void* addr)
{
const u64 res = (u64)addr - (u64)GetBaseAddr();
@ -313,11 +308,6 @@ public:
}
}
//template<typename T> void WriteString(const T addr, const std::string& str)
//{
// memcpy((char*)GetMemFromAddr<T>(addr), str.c_str(), str.size() + 1);
//}
u32 GetUserMemTotalSize()
{
return UserMemory->GetSize();

View File

@ -116,7 +116,7 @@ void GLTexture::Init(RSXTexture& tex)
int format = tex.GetFormat() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
bool is_swizzled = !(tex.GetFormat() & CELL_GCM_TEXTURE_LN);
const u8 *pixels = const_cast<const u8 *>(Memory.GetMemFromAddr(texaddr));
auto pixels = vm::get_ptr<const u8>(texaddr);
u8 *unswizzledPixels;
static const GLint glRemapStandard[4] = { GL_ALPHA, GL_RED, GL_GREEN, GL_BLUE };
// NOTE: This must be in ARGB order in all forms below.
@ -2005,14 +2005,14 @@ void GLGSRender::Flip()
if (m_read_buffer)
{
format = GL_BGRA;
CellGcmDisplayInfo* buffers = (CellGcmDisplayInfo*)Memory.GetMemFromAddr(m_gcm_buffers_addr);
CellGcmDisplayInfo* buffers = vm::get_ptr<CellGcmDisplayInfo>(m_gcm_buffers_addr);
u32 addr = GetAddress(buffers[m_gcm_current_buffer].offset, CELL_GCM_LOCATION_LOCAL);
if (Memory.IsGoodAddr(addr))
{
width = buffers[m_gcm_current_buffer].width;
height = buffers[m_gcm_current_buffer].height;
src_buffer = (u8*)Memory.VirtualToRealAddr(addr);
src_buffer = vm::get_ptr<u8>(addr);
}
else
{

View File

@ -84,7 +84,7 @@ void RSXVertexData::Load(u32 start, u32 count, u32 baseOffset, u32 baseIndex=0)
for(u32 i=start; i<start + count; ++i)
{
const u8* src = Memory.GetMemFromAddr(addr) + baseOffset + stride * (i+baseIndex);
auto src = vm::get_ptr<const u8>(addr + baseOffset + stride * (i + baseIndex));
u8* dst = &data[i * tsize * size];
switch(tsize)
@ -1341,7 +1341,7 @@ void RSXThread::DoCmd(const u32 fcmd, const u32 cmd, const u32 args_addr, const
case 2: m_surface_pitch_a = ARGS(1);
}
CellGcmDisplayInfo* buffers = (CellGcmDisplayInfo*)Memory.GetMemFromAddr(m_gcm_buffers_addr);
auto buffers = vm::get_ptr<CellGcmDisplayInfo>(m_gcm_buffers_addr);
m_width = buffers[m_gcm_current_buffer].width;
m_height = buffers[m_gcm_current_buffer].height;

View File

@ -724,9 +724,9 @@ int cellAdecDecodeAu(u32 handle, vm::ptr<CellAdecAuInfo> auInfo)
return CELL_OK;
}
int cellAdecGetPcm(u32 handle, u32 outBuffer_addr)
int 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_addr=0x%x)", handle, outBuffer.addr());
AudioDecoder* adec;
if (!Emu.GetIdManager().GetIDData(handle, adec))
@ -752,11 +752,10 @@ int cellAdecGetPcm(u32 handle, u32 outBuffer_addr)
float* in_f[2];
in_f[0] = (float*)frame->extended_data[0];
in_f[1] = (float*)frame->extended_data[1];
be_t<float>* out_f = (be_t<float>*)Memory.GetMemFromAddr(outBuffer_addr);
for (u32 i = 0; i < af.size / 8; i++)
{
out_f[i*2] = in_f[0][i];
out_f[i*2+1] = in_f[1][i];
outBuffer[i * 2 + 0] = in_f[0][i];
outBuffer[i * 2 + 1] = in_f[1][i];
}
if (af.data)

View File

@ -276,7 +276,7 @@ void dmuxQueryAttr(u32 info_addr /* may be 0 */, vm::ptr<CellDmuxAttr> attr)
attr->memSize = 0x10000; // 0x3e8e6 from ps3
}
void dmuxQueryEsAttr(u32 info_addr /* may be 0 */, const vm::ptr<CellCodecEsFilterId> esFilterId,
void dmuxQueryEsAttr(u32 info_addr /* may be 0 */, vm::ptr<const CellCodecEsFilterId> esFilterId,
const u32 esSpecificInfo_addr, vm::ptr<CellDmuxEsAttr> attr)
{
if (esFilterId->filterIdMajor >= 0xe0)
@ -713,7 +713,7 @@ u32 dmuxOpen(Demuxer* data)
return dmux_id;
}
int cellDmuxQueryAttr(const vm::ptr<CellDmuxType> demuxerType, vm::ptr<CellDmuxAttr> demuxerAttr)
int cellDmuxQueryAttr(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<CellDmuxAttr> demuxerAttr)
{
cellDmux->Warning("cellDmuxQueryAttr(demuxerType_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType.addr(), demuxerAttr.addr());
@ -726,7 +726,7 @@ int cellDmuxQueryAttr(const vm::ptr<CellDmuxType> demuxerType, vm::ptr<CellDmuxA
return CELL_OK;
}
int cellDmuxQueryAttr2(const vm::ptr<CellDmuxType2> demuxerType2, vm::ptr<CellDmuxAttr> demuxerAttr)
int cellDmuxQueryAttr2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<CellDmuxAttr> demuxerAttr)
{
cellDmux->Warning("cellDmuxQueryAttr2(demuxerType2_addr=0x%x, demuxerAttr_addr=0x%x)", demuxerType2.addr(), demuxerAttr.addr());
@ -739,8 +739,8 @@ int cellDmuxQueryAttr2(const vm::ptr<CellDmuxType2> demuxerType2, vm::ptr<CellDm
return CELL_OK;
}
int cellDmuxOpen(const vm::ptr<CellDmuxType> demuxerType, const vm::ptr<CellDmuxResource> demuxerResource,
const vm::ptr<CellDmuxCb> demuxerCb, vm::ptr<be_t<u32>> demuxerHandle)
int cellDmuxOpen(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResource> demuxerResource,
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<be_t<u32>> demuxerHandle)
{
cellDmux->Warning("cellDmuxOpen(demuxerType_addr=0x%x, demuxerResource_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
demuxerType.addr(), demuxerResource.addr(), demuxerCb.addr(), demuxerHandle.addr());
@ -757,8 +757,8 @@ int cellDmuxOpen(const vm::ptr<CellDmuxType> demuxerType, const vm::ptr<CellDmux
return CELL_OK;
}
int cellDmuxOpenEx(const vm::ptr<CellDmuxType> demuxerType, const vm::ptr<CellDmuxResourceEx> demuxerResourceEx,
const vm::ptr<CellDmuxCb> demuxerCb, vm::ptr<be_t<u32>> demuxerHandle)
int cellDmuxOpenEx(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellDmuxResourceEx> demuxerResourceEx,
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<be_t<u32>> demuxerHandle)
{
cellDmux->Warning("cellDmuxOpenEx(demuxerType_addr=0x%x, demuxerResourceEx_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
demuxerType.addr(), demuxerResourceEx.addr(), demuxerCb.addr(), demuxerHandle.addr());
@ -775,8 +775,8 @@ int cellDmuxOpenEx(const vm::ptr<CellDmuxType> demuxerType, const vm::ptr<CellDm
return CELL_OK;
}
int cellDmuxOpen2(const vm::ptr<CellDmuxType2> demuxerType2, const vm::ptr<CellDmuxResource2> demuxerResource2,
const vm::ptr<CellDmuxCb> demuxerCb, vm::ptr<be_t<u32>> demuxerHandle)
int cellDmuxOpen2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<const CellDmuxResource2> demuxerResource2,
vm::ptr<const CellDmuxCb> demuxerCb, vm::ptr<be_t<u32>> demuxerHandle)
{
cellDmux->Warning("cellDmuxOpen2(demuxerType2_addr=0x%x, demuxerResource2_addr=0x%x, demuxerCb_addr=0x%x, demuxerHandle_addr=0x%x)",
demuxerType2.addr(), demuxerResource2.addr(), demuxerCb.addr(), demuxerHandle.addr());
@ -907,7 +907,7 @@ int cellDmuxResetStreamAndWaitDone(u32 demuxerHandle)
return CELL_OK;
}
int cellDmuxQueryEsAttr(const vm::ptr<CellDmuxType> demuxerType, const vm::ptr<CellCodecEsFilterId> esFilterId,
int cellDmuxQueryEsAttr(vm::ptr<const CellDmuxType> demuxerType, vm::ptr<const CellCodecEsFilterId> esFilterId,
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)",
@ -924,7 +924,7 @@ int cellDmuxQueryEsAttr(const vm::ptr<CellDmuxType> demuxerType, const vm::ptr<C
return CELL_OK;
}
int cellDmuxQueryEsAttr2(const vm::ptr<CellDmuxType2> demuxerType2, const vm::ptr<CellCodecEsFilterId> esFilterId,
int cellDmuxQueryEsAttr2(vm::ptr<const CellDmuxType2> demuxerType2, vm::ptr<const CellCodecEsFilterId> esFilterId,
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)",
@ -941,8 +941,8 @@ int cellDmuxQueryEsAttr2(const vm::ptr<CellDmuxType2> demuxerType2, const vm::pt
return CELL_OK;
}
int cellDmuxEnableEs(u32 demuxerHandle, const vm::ptr<CellCodecEsFilterId> esFilterId,
const vm::ptr<CellDmuxEsResource> esResourceInfo, const vm::ptr<CellDmuxEsCb> esCb,
int cellDmuxEnableEs(u32 demuxerHandle, vm::ptr<const CellCodecEsFilterId> esFilterId,
vm::ptr<const CellDmuxEsResource> esResourceInfo, vm::ptr<const CellDmuxEsCb> esCb,
const u32 esSpecificInfo_addr, vm::ptr<be_t<u32>> esHandle)
{
cellDmux->Warning("cellDmuxEnableEs(demuxerHandle=%d, esFilterId_addr=0x%x, esResourceInfo_addr=0x%x, esCb_addr=0x%x, "

View File

@ -316,7 +316,7 @@ struct DemuxerStream
{
if (sizeof(T) > size) return false;
out = *(T*)Memory.VirtualToRealAddr(addr);
out = vm::get_ref<T>(addr);
addr += sizeof(T);
size -= sizeof(T);
@ -328,7 +328,7 @@ struct DemuxerStream
{
if (sizeof(T) + shift > size) return false;
out = *(T*)Memory.VirtualToRealAddr(addr + shift);
out = vm::get_ref<T>(addr + shift);
return true;
}

View File

@ -78,7 +78,7 @@ int cellFontOpenFontMemory(vm::ptr<CellFontLibrary> library, u32 fontAddr, u32 f
font->stbfont = (stbtt_fontinfo*)((u8*)&(font->stbfont) + sizeof(void*)); // hack: use next bytes of the struct
if (!stbtt_InitFont(font->stbfont, (unsigned char*)Memory.VirtualToRealAddr(fontAddr), 0))
if (!stbtt_InitFont(font->stbfont, vm::get_ptr<unsigned char>(fontAddr), 0))
return CELL_FONT_ERROR_FONT_OPEN_FAILED;
font->renderer_addr = 0;
@ -99,7 +99,7 @@ int cellFontOpenFontFile(vm::ptr<CellFontLibrary> library, vm::ptr<const char> f
u32 fileSize = (u32)f.GetSize();
u32 bufferAddr = (u32)Memory.Alloc(fileSize, 1); // Freed in cellFontCloseFont
f.Read(Memory.VirtualToRealAddr(bufferAddr), fileSize);
f.Read(vm::get_ptr<void>(bufferAddr), fileSize);
int ret = cellFontOpenFontMemory(library, bufferAddr, fileSize, subNum, uniqueId, font);
font->origin = CELL_FONT_OPEN_FONT_FILE;
return ret;
@ -345,7 +345,7 @@ int cellFontRenderCharGlyphImage(vm::ptr<CellFont> font, u32 code, vm::ptr<CellF
baseLineY = (int)((float)ascent * scale); // ???
// Move the rendered character to the surface
unsigned char* buffer = (unsigned char*)Memory.VirtualToRealAddr(surface->buffer_addr);
unsigned char* buffer = vm::get_ptr<unsigned char>(surface->buffer_addr);
for (u32 ypos = 0; ypos < (u32)height; ypos++){
if ((u32)y + ypos + yoff + baseLineY >= surface->height)
break;

View File

@ -422,18 +422,11 @@ int cellGameGetLocalWebContentPath()
return CELL_OK;
}
int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr)
int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::ptr<const char> dirName)
{
cellGame->Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName_addr=0x%x)", type, errNeedSizeKB, dirName_addr);
cellGame->Warning("cellGameContentErrorDialog(type=%d, errNeedSizeKB=%d, dirName_addr=0x%x)", type, errNeedSizeKB, dirName.addr());
std::string errorName;
std::string errorMsg;
char* dirName = "Unknown";
if (type == CELL_GAME_ERRDIALOG_NOSPACE || type == CELL_GAME_ERRDIALOG_NOSPACE_EXIT && dirName_addr)
{
dirName = (char*)Memory.VirtualToRealAddr(dirName_addr);
}
switch (type)
{
case CELL_GAME_ERRDIALOG_BROKEN_GAMEDATA: errorName = "Game data is corrupted (can be continued)."; break;
@ -445,15 +438,21 @@ int cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, u32 dirName_addr)
default: return CELL_GAME_ERROR_PARAM;
}
std::string errorMsg;
if (type == CELL_GAME_ERRDIALOG_NOSPACE || type == CELL_GAME_ERRDIALOG_NOSPACE_EXIT)
{
errorMsg = fmt::Format("ERROR: %s\nSpace needed: %d KB\nDirectory name: %s", errorName.c_str(), errNeedSizeKB, dirName);
errorMsg = fmt::Format("ERROR: %s\nSpace needed: %d KB", errorName.c_str(), errNeedSizeKB, dirName);
}
else
{
errorMsg = fmt::Format("ERROR: %s", errorName.c_str());
}
if (dirName)
{
errorMsg += fmt::Format("\nDirectory name: %s", dirName.get_ptr());
}
rMessageBox(errorMsg, "Error", rICON_ERROR | rOK);
return CELL_OK;

View File

@ -434,7 +434,7 @@ int cellGcmSetDisplayBuffer(u32 id, u32 offset, u32 pitch, u32 width, u32 height
return CELL_EINVAL;
}
CellGcmDisplayInfo* buffers = (CellGcmDisplayInfo*)Memory.GetMemFromAddr(Emu.GetGSManager().GetRender().m_gcm_buffers_addr);
auto buffers = vm::get_ptr<CellGcmDisplayInfo>(Emu.GetGSManager().GetRender().m_gcm_buffers_addr);
buffers[id].offset = offset;
buffers[id].pitch = pitch;

View File

@ -84,7 +84,7 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellGifDecInfo>
case se32(CELL_GIFDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, buffer.addr(), buffer.size(), nread);
cellFsRead(fd, vm::ptr<void>::make(buffer.addr()), buffer.size(), nread);
break;
}
@ -109,7 +109,7 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellGifDecInfo>
return CELL_OK;
}
int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const vm::ptr<CellGifDecInParam> inParam, vm::ptr<CellGifDecOutParam> outParam)
int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellGifDecInParam> inParam, vm::ptr<CellGifDecOutParam> outParam)
{
cellGifDec->Warning("cellGifDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)",
mainHandle, subHandle, inParam.addr(), outParam.addr());
@ -139,7 +139,7 @@ int cellGifDecSetParameter(u32 mainHandle, u32 subHandle, const vm::ptr<CellGifD
return CELL_OK;
}
int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const vm::ptr<CellGifDecDataCtrlParam> dataCtrlParam, vm::ptr<CellGifDecDataOutInfo> dataOutInfo)
int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::ptr<const CellGifDecDataCtrlParam> dataCtrlParam, vm::ptr<CellGifDecDataOutInfo> dataOutInfo)
{
cellGifDec->Warning("cellGifDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)",
mainHandle, subHandle, data.addr(), dataCtrlParam.addr(), dataOutInfo.addr());
@ -166,7 +166,7 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const
case se32(CELL_GIFDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, gif.addr(), gif.size(), nread);
cellFsRead(fd, vm::ptr<void>::make(gif.addr()), gif.size(), nread);
break;
}

View File

@ -104,7 +104,7 @@ int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellJpgDecInfo>
case se32(CELL_JPGDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, buffer.addr(), buffer.size(), nread);
cellFsRead(fd, vm::ptr<void>::make(buffer.addr()), buffer.size(), nread);
break;
}
@ -147,7 +147,7 @@ int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellJpgDecInfo>
return CELL_OK;
}
int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const vm::ptr<CellJpgDecDataCtrlParam> dataCtrlParam, vm::ptr<CellJpgDecDataOutInfo> dataOutInfo)
int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::ptr<const CellJpgDecDataCtrlParam> dataCtrlParam, vm::ptr<CellJpgDecDataOutInfo> dataOutInfo)
{
cellJpgDec->Log("cellJpgDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)",
mainHandle, subHandle, data.addr(), dataCtrlParam.addr(), dataOutInfo.addr());
@ -173,7 +173,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const
case se32(CELL_JPGDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, jpg.addr(), jpg.size(), nread);
cellFsRead(fd, vm::ptr<void>::make(jpg.addr()), jpg.size(), nread);
break;
}
@ -278,7 +278,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const
return CELL_OK;
}
int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, const vm::ptr<CellJpgDecInParam> inParam, vm::ptr<CellJpgDecOutParam> outParam)
int cellJpgDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellJpgDecInParam> inParam, vm::ptr<CellJpgDecOutParam> outParam)
{
cellJpgDec->Log("cellJpgDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)",
mainHandle, subHandle, inParam.addr(), outParam.addr());

View File

@ -77,7 +77,7 @@ int pamfStreamTypeToEsFilterId(u8 type, u8 ch, vm::ptr<CellCodecEsFilterId> pEsF
u8 pamfGetStreamType(vm::ptr<CellPamfReader> pSelf, u8 stream)
{
//TODO: get stream type correctly
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
switch (pAddr->stream_headers[stream].type)
{
@ -94,7 +94,7 @@ u8 pamfGetStreamType(vm::ptr<CellPamfReader> pSelf, u8 stream)
u8 pamfGetStreamChannel(vm::ptr<CellPamfReader> pSelf, u8 stream)
{
//TODO: get stream channel correctly
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
switch (pAddr->stream_headers[stream].type)
{
@ -169,7 +169,7 @@ int cellPamfVerify(vm::ptr<PamfHeader> pAddr, u64 fileSize)
return CELL_OK;
}
int cellPamfReaderInitialize(vm::ptr<CellPamfReader> pSelf, vm::ptr<PamfHeader> pAddr, u64 fileSize, u32 attribute)
int cellPamfReaderInitialize(vm::ptr<CellPamfReader> pSelf, vm::ptr<const PamfHeader> pAddr, u64 fileSize, u32 attribute)
{
cellPamf->Warning("cellPamfReaderInitialize(pSelf=0x%x, pAddr=0x%x, fileSize=%d, attribute=0x%x)", pSelf.addr(), pAddr.addr(), fileSize, attribute);
@ -181,7 +181,7 @@ int cellPamfReaderInitialize(vm::ptr<CellPamfReader> pSelf, vm::ptr<PamfHeader>
{
pSelf->fileSize = ((u64)pAddr->data_offset << 11) + ((u64)pAddr->data_size << 11);
}
pSelf->pAddr = vm::ptr<PamfHeader>::make(pAddr.addr());
pSelf->pAddr = pAddr;
if (attribute & CELL_PAMF_ATTRIBUTE_VERIFY_ON)
{
@ -196,7 +196,7 @@ int cellPamfReaderGetPresentationStartTime(vm::ptr<CellPamfReader> pSelf, vm::pt
{
cellPamf->Warning("cellPamfReaderGetPresentationStartTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.addr(), pTimeStamp.addr());
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
const u32 upper = (u16)pAddr->start_pts_high;
pTimeStamp->upper = upper;
pTimeStamp->lower = pAddr->start_pts_low;
@ -207,7 +207,7 @@ int cellPamfReaderGetPresentationEndTime(vm::ptr<CellPamfReader> pSelf, vm::ptr<
{
cellPamf->Warning("cellPamfReaderGetPresentationEndTime(pSelf=0x%x, pTimeStamp_addr=0x%x)", pSelf.addr(), pTimeStamp.addr());
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
const u32 upper = (u16)pAddr->end_pts_high;
pTimeStamp->upper = upper;
pTimeStamp->lower = pAddr->end_pts_low;
@ -218,7 +218,7 @@ int cellPamfReaderGetMuxRateBound(vm::ptr<CellPamfReader> pSelf)
{
cellPamf->Warning("cellPamfReaderGetMuxRateBound(pSelf=0x%x)", pSelf.addr());
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
return pAddr->mux_rate_max;
}
@ -226,7 +226,7 @@ int cellPamfReaderGetNumberOfStreams(vm::ptr<CellPamfReader> pSelf)
{
cellPamf->Warning("cellPamfReaderGetNumberOfStreams(pSelf=0x%x)", pSelf.addr());
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
return pAddr->stream_count;
}
@ -234,7 +234,7 @@ int cellPamfReaderGetNumberOfSpecificStreams(vm::ptr<CellPamfReader> pSelf, u8 s
{
cellPamf->Warning("cellPamfReaderGetNumberOfSpecificStreams(pSelf=0x%x, streamType=%d)", pSelf.addr(), streamType);
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
int counts[6] = {0, 0, 0, 0, 0, 0};
@ -265,7 +265,7 @@ int cellPamfReaderSetStreamWithIndex(vm::ptr<CellPamfReader> pSelf, u8 streamInd
{
cellPamf->Warning("cellPamfReaderSetStreamWithIndex(pSelf=0x%x, streamIndex=%d)", pSelf.addr(), streamIndex);
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
if (streamIndex < pAddr->stream_count)
{
@ -283,7 +283,7 @@ int cellPamfReaderSetStreamWithTypeAndChannel(vm::ptr<CellPamfReader> pSelf, u8
{
cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndChannel(pSelf=0x%x, streamType=%d, ch=%d)", pSelf.addr(), streamType, ch);
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
if (streamType > 5)
{
@ -311,7 +311,7 @@ int cellPamfReaderSetStreamWithTypeAndIndex(vm::ptr<CellPamfReader> pSelf, u8 st
{
cellPamf->Warning("cellPamfReaderSetStreamWithTypeAndIndex(pSelf=0x%x, streamType=%d, streamIndex=%d)", pSelf.addr(), streamType, streamIndex);
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
u32 found = 0;
@ -390,7 +390,7 @@ int cellPamfReaderGetStreamInfo(vm::ptr<CellPamfReader> pSelf, u32 pInfo_addr, u
{
cellPamf->Warning("cellPamfReaderGetStreamInfo(pSelf=0x%x, stream=%d, pInfo_addr=0x%x, size=%d)", pSelf.addr(), pSelf->stream, pInfo_addr, size);
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
memset(Memory + pInfo_addr, 0, size);
@ -497,7 +497,7 @@ int cellPamfReaderGetNumberOfEp(vm::ptr<CellPamfReader> pSelf)
{
cellPamf->Warning("cellPamfReaderGetNumberOfEp(pSelf=0x%x, stream=%d)", pSelf.addr(), pSelf->stream);
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
return pAddr->stream_headers[pSelf->stream].ep_num;
}
@ -505,7 +505,7 @@ int cellPamfReaderGetEpIteratorWithIndex(vm::ptr<CellPamfReader> pSelf, u32 epIn
{
cellPamf->Todo("cellPamfReaderGetEpIteratorWithIndex(pSelf=0x%x, stream=%d, epIndex=%d, pIt_addr=0x%x)", pSelf.addr(), pSelf->stream, epIndex, pIt.addr());
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
//TODO:
return CELL_OK;
}
@ -514,7 +514,7 @@ int cellPamfReaderGetEpIteratorWithTimeStamp(vm::ptr<CellPamfReader> pSelf, vm::
{
cellPamf->Todo("cellPamfReaderGetEpIteratorWithTimeStamp(pSelf=0x%x, pTimeStamp_addr=0x%x, pIt_addr=0x%x)", pSelf.addr(), pTimeStamp.addr(), pIt.addr());
const vm::ptr<PamfHeader> pAddr(pSelf->pAddr);
vm::ptr<const PamfHeader> pAddr(pSelf->pAddr);
//TODO:

View File

@ -330,7 +330,7 @@ struct CellPamfReader
{
//this struct can be used in any way, if it is not accessed directly by virtual CPU
//be_t<u64> internalData[16];
vm::ptr<PamfHeader> pAddr;
vm::ptr<const PamfHeader> pAddr;
int stream;
u64 fileSize;
u32 internalData[28];

View File

@ -144,7 +144,7 @@ int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellPngDecInfo>
break;
case se32(CELL_PNGDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, buffer.addr(), buffer.size(), nread);
cellFsRead(fd, vm::ptr<void>::make(buffer.addr()), buffer.size(), nread);
break;
}
@ -184,7 +184,7 @@ int cellPngDecExtReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellPngDecInf
return cellPngDecReadHeader(mainHandle, subHandle, info);
}
int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const vm::ptr<CellPngDecDataCtrlParam> dataCtrlParam, vm::ptr<CellPngDecDataOutInfo> dataOutInfo)
int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::ptr<const CellPngDecDataCtrlParam> dataCtrlParam, vm::ptr<CellPngDecDataOutInfo> dataOutInfo)
{
cellPngDec->Warning("cellPngDecDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x)",
mainHandle, subHandle, data.addr(), dataCtrlParam.addr(), dataOutInfo.addr());
@ -210,7 +210,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const
case se32(CELL_PNGDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, png.addr(), png.size(), nread);
cellFsRead(fd, vm::ptr<void>::make(png.addr()), png.size(), nread);
break;
}
@ -308,7 +308,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const
return CELL_OK;
}
int cellPngDecExtDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const vm::ptr<CellPngDecDataCtrlParam> dataCtrlParam,
int cellPngDecExtDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::ptr<const CellPngDecDataCtrlParam> dataCtrlParam,
vm::ptr<CellPngDecDataOutInfo> dataOutInfo, vm::ptr<CellPngDecCbCtrlDisp> cbCtrlDisp, vm::ptr<CellPngDecDispParam> dispParam)
{
cellPngDec->Warning("cellPngDecExtDecodeData(mainHandle=0x%x, subHandle=0x%x, data_addr=0x%x, dataCtrlParam_addr=0x%x, dataOutInfo_addr=0x%x, cbCtrlDisp_addr=0x%x, dispParam=0x%x)",
@ -319,7 +319,7 @@ int cellPngDecExtDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, con
return cellPngDecDecodeData(mainHandle, subHandle, data, dataCtrlParam, dataOutInfo);
}
int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const vm::ptr<CellPngDecInParam> inParam, vm::ptr<CellPngDecOutParam> outParam)
int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellPngDecInParam> inParam, vm::ptr<CellPngDecOutParam> outParam)
{
cellPngDec->Warning("cellPngDecSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x)",
mainHandle, subHandle, inParam.addr(), outParam.addr());
@ -360,7 +360,7 @@ int cellPngDecSetParameter(u32 mainHandle, u32 subHandle, const vm::ptr<CellPngD
return CELL_OK;
}
int cellPngDecExtSetParameter(u32 mainHandle, u32 subHandle, const vm::ptr<CellPngDecInParam> inParam, vm::ptr<CellPngDecOutParam> outParam,
int cellPngDecExtSetParameter(u32 mainHandle, u32 subHandle, vm::ptr<const CellPngDecInParam> inParam, vm::ptr<CellPngDecOutParam> outParam,
vm::ptr<CellPngDecExtInParam> extInParam, vm::ptr<CellPngDecExtOutParam> extOutParam)
{
cellPngDec->Warning("cellPngDecExtSetParameter(mainHandle=0x%x, subHandle=0x%x, inParam_addr=0x%x, outParam_addr=0x%x, extInParam=0x%x, extOutParam=0x%x",

View File

@ -326,7 +326,7 @@ int cellSaveDataListSave2(u32 version, vm::ptr<CellSaveDataSetList> setList, vm:
// Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf.addr());
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
auto dirList = vm::get_ptr<CellSaveDataDirList>(listGet->dirList.addr());
for (u32 i=0; i<saveEntries.size(); i++) {
strcpy_trunc(dirList[i].dirName, saveEntries[i].dirName);
@ -412,7 +412,7 @@ int cellSaveDataListLoad2(u32 version, vm::ptr<CellSaveDataSetList> setList, vm:
// Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf.addr());
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
auto dirList = vm::get_ptr<CellSaveDataDirList>(listGet->dirList.addr());
for (u32 i=0; i<saveEntries.size(); i++) {
strcpy_trunc(dirList[i].dirName, saveEntries[i].dirName);
@ -496,7 +496,7 @@ int cellSaveDataFixedSave2(u32 version, vm::ptr<CellSaveDataSetList> setList, v
// Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf.addr());
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
auto dirList = vm::get_ptr<CellSaveDataDirList>(listGet->dirList.addr());
for (u32 i = 0; i<saveEntries.size(); i++) {
strcpy_trunc(dirList[i].dirName, saveEntries[i].dirName);
strcpy_trunc(dirList[i].listParam, saveEntries[i].listParam);
@ -566,7 +566,7 @@ int cellSaveDataFixedLoad2(u32 version, vm::ptr<CellSaveDataSetList> setList, v
// Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf.addr());
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
auto dirList = vm::get_ptr<CellSaveDataDirList>(listGet->dirList.addr());
for (u32 i = 0; i<saveEntries.size(); i++) {
strcpy_trunc(dirList[i].dirName, saveEntries[i].dirName);
strcpy_trunc(dirList[i].listParam, saveEntries[i].listParam);
@ -740,7 +740,7 @@ int cellSaveDataListAutoSave(u32 version, u32 errDialog, vm::ptr<CellSaveDataSet
// Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf.addr());
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
auto dirList = vm::get_ptr<CellSaveDataDirList>(listGet->dirList.addr());
for (u32 i = 0; i<saveEntries.size(); i++) {
strcpy_trunc(dirList[i].dirName, saveEntries[i].dirName.c_str());
@ -826,7 +826,7 @@ int cellSaveDataListAutoLoad(u32 version, u32 errDialog, vm::ptr<CellSaveDataSet
// Sort the entries and fill the listGet->dirList array
std::sort(saveEntries.begin(), saveEntries.end(), sortSaveDataEntry(setList->sortType, setList->sortOrder));
listGet->dirList = vm::bptr<CellSaveDataDirList>::make(setBuf->buf.addr());
CellSaveDataDirList* dirList = (CellSaveDataDirList*)Memory.VirtualToRealAddr(listGet->dirList.addr());
auto dirList = vm::get_ptr<CellSaveDataDirList>(listGet->dirList.addr());
for (u32 i = 0; i<saveEntries.size(); i++) {
strcpy_trunc(dirList[i].dirName, saveEntries[i].dirName);

View File

@ -41,7 +41,7 @@ s64 cellSpursFinalize(vm::ptr<CellSpurs> spurs)
#endif
}
s64 cellSpursInitializeWithAttribute(vm::ptr<CellSpurs> spurs, const vm::ptr<CellSpursAttribute> attr)
s64 cellSpursInitializeWithAttribute(vm::ptr<CellSpurs> spurs, vm::ptr<const CellSpursAttribute> attr)
{
cellSpurs->Warning("cellSpursInitializeWithAttribute(spurs_addr=0x%x, spurs_addr=0x%x)", spurs.addr(), attr.addr());
@ -54,7 +54,7 @@ s64 cellSpursInitializeWithAttribute(vm::ptr<CellSpurs> spurs, const vm::ptr<Cel
#endif
}
s64 cellSpursInitializeWithAttribute2(vm::ptr<CellSpurs2> spurs, const vm::ptr<CellSpursAttribute> attr)
s64 cellSpursInitializeWithAttribute2(vm::ptr<CellSpurs2> spurs, vm::ptr<const CellSpursAttribute> attr)
{
cellSpurs->Warning("cellSpursInitializeWithAttribute2(spurs_addr=0x%x, spurs_addr=0x%x)", spurs.addr(), attr.addr());

View File

@ -787,7 +787,7 @@ int cellSysutilGetBgmPlaybackStatus2(vm::ptr<CellSysutilBgmPlaybackStatus2> stat
return CELL_OK;
}
int cellWebBrowserEstimate2(const vm::ptr<const u8> _config, vm::ptr<be_t<u32>> memSize)
int cellWebBrowserEstimate2(vm::ptr<const const u8> _config, vm::ptr<be_t<u32>> memSize)
{
cellSysutil->Warning("cellWebBrowserEstimate2(config_addr=0x%x, memSize_addr=0x%x)", _config.addr(), memSize.addr());

View File

@ -482,21 +482,21 @@ u32 vdecOpen(VideoDecoder* data)
return vdec_id;
}
int cellVdecQueryAttr(const vm::ptr<CellVdecType> type, vm::ptr<CellVdecAttr> attr)
int 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());
return vdecQueryAttr(type->codecType, type->profileLevel, 0, attr);
}
int cellVdecQueryAttrEx(const vm::ptr<CellVdecTypeEx> type, vm::ptr<CellVdecAttr> attr)
int 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());
return vdecQueryAttr(type->codecType, type->profileLevel, type->codecSpecificInfo_addr, attr);
}
int cellVdecOpen(const vm::ptr<CellVdecType> type, const vm::ptr<CellVdecResource> res, const vm::ptr<CellVdecCb> cb, vm::ptr<be_t<u32>> handle)
int cellVdecOpen(vm::ptr<const CellVdecType> type, vm::ptr<const CellVdecResource> res, vm::ptr<const CellVdecCb> cb, vm::ptr<be_t<u32>> handle)
{
cellVdec->Warning("cellVdecOpen(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
type.addr(), res.addr(), cb.addr(), handle.addr());
@ -506,7 +506,7 @@ int cellVdecOpen(const vm::ptr<CellVdecType> type, const vm::ptr<CellVdecResourc
return CELL_OK;
}
int cellVdecOpenEx(const vm::ptr<CellVdecTypeEx> type, const vm::ptr<CellVdecResourceEx> res, const vm::ptr<CellVdecCb> cb, vm::ptr<be_t<u32>> handle)
int cellVdecOpenEx(vm::ptr<const CellVdecTypeEx> type, vm::ptr<const CellVdecResourceEx> res, vm::ptr<const CellVdecCb> cb, vm::ptr<be_t<u32>> handle)
{
cellVdec->Warning("cellVdecOpenEx(type_addr=0x%x, res_addr=0x%x, cb_addr=0x%x, handle_addr=0x%x)",
type.addr(), res.addr(), cb.addr(), handle.addr());
@ -593,7 +593,7 @@ int cellVdecEndSeq(u32 handle)
return CELL_OK;
}
int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, const vm::ptr<CellVdecAuInfo> auInfo)
int 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());
@ -617,9 +617,9 @@ int cellVdecDecodeAu(u32 handle, CellVdecDecodeMode mode, const vm::ptr<CellVdec
return CELL_OK;
}
int cellVdecGetPicture(u32 handle, const vm::ptr<CellVdecPicFormat> format, u32 out_addr)
int cellVdecGetPicture(u32 handle, vm::ptr<const CellVdecPicFormat> format, vm::ptr<u8> outBuff)
{
cellVdec->Log("cellVdecGetPicture(handle=%d, format_addr=0x%x, out_addr=0x%x)", handle, format.addr(), out_addr);
cellVdec->Log("cellVdecGetPicture(handle=%d, format_addr=0x%x, outBuff_addr=0x%x)", handle, format.addr(), outBuff.addr());
VideoDecoder* vdec;
if (!Emu.GetIdManager().GetIDData(handle, vdec))
@ -632,7 +632,7 @@ int cellVdecGetPicture(u32 handle, const vm::ptr<CellVdecPicFormat> format, u32
return CELL_VDEC_ERROR_EMPTY;
}
if (out_addr)
if (outBuff)
{
u32 buf_size = a128(av_image_get_buffer_size(vdec->ctx->pix_fmt, vdec->ctx->width, vdec->ctx->height, 1));
@ -656,7 +656,7 @@ int cellVdecGetPicture(u32 handle, const vm::ptr<CellVdecPicFormat> format, u32
// TODO: zero padding bytes
int err = av_image_copy_to_buffer(Memory.GetMemFromAddr(out_addr), buf_size, frame.data, frame.linesize, vdec->ctx->pix_fmt, frame.width, frame.height, 1);
int err = av_image_copy_to_buffer(outBuff.get_ptr(), buf_size, frame.data, frame.linesize, vdec->ctx->pix_fmt, frame.width, frame.height, 1);
if (err < 0)
{
cellVdec->Error("cellVdecGetPicture: av_image_copy_to_buffer failed(%d)", err);

View File

@ -14,7 +14,7 @@ extern "C"
//Module cellVpost(0x0008, cellVpost_init);
Module *cellVpost = nullptr;
int cellVpostQueryAttr(const vm::ptr<CellVpostCfgParam> cfgParam, vm::ptr<CellVpostAttr> attr)
int 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());
@ -37,7 +37,7 @@ u32 vpostOpen(VpostInstance* data)
return id;
}
int cellVpostOpen(const vm::ptr<CellVpostCfgParam> cfgParam, const vm::ptr<CellVpostResource> resource, vm::ptr<be_t<u32>> handle)
int cellVpostOpen(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResource> resource, vm::ptr<be_t<u32>> handle)
{
cellVpost->Warning("cellVpostOpen(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)",
cfgParam.addr(), resource.addr(), handle.addr());
@ -47,7 +47,7 @@ int cellVpostOpen(const vm::ptr<CellVpostCfgParam> cfgParam, const vm::ptr<CellV
return CELL_OK;
}
int cellVpostOpenEx(const vm::ptr<CellVpostCfgParam> cfgParam, const vm::ptr<CellVpostResourceEx> resource, vm::ptr<be_t<u32>> handle)
int cellVpostOpenEx(vm::ptr<const CellVpostCfgParam> cfgParam, vm::ptr<const CellVpostResourceEx> resource, vm::ptr<be_t<u32>> handle)
{
cellVpost->Warning("cellVpostOpenEx(cfgParam_addr=0x%x, resource_addr=0x%x, handle_addr=0x%x)",
cfgParam.addr(), resource.addr(), handle.addr());
@ -71,11 +71,11 @@ int cellVpostClose(u32 handle)
return CELL_OK;
}
int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const vm::ptr<CellVpostCtrlParam> ctrlParam,
u32 outPicBuff_addr, vm::ptr<CellVpostPictureInfo> picInfo)
int cellVpostExec(u32 handle, vm::ptr<const u8> inPicBuff, vm::ptr<const CellVpostCtrlParam> ctrlParam,
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)",
handle, inPicBuff_addr, ctrlParam.addr(), outPicBuff_addr, picInfo.addr());
handle, inPicBuff.addr(), ctrlParam.addr(), outPicBuff.addr(), picInfo.addr());
VpostInstance* vpost;
if (!Emu.GetIdManager().GetIDData(handle, vpost))
@ -137,9 +137,9 @@ int cellVpostExec(u32 handle, const u32 inPicBuff_addr, const vm::ptr<CellVpostC
//u64 stamp2 = get_system_time();
u8* in_data[4] = { Memory.GetMemFromAddr(inPicBuff_addr), Memory.GetMemFromAddr(inPicBuff_addr + w*h), Memory.GetMemFromAddr(inPicBuff_addr + w*h + w*h / 4), pA.get() };
const u8* in_data[4] = { &inPicBuff[0], &inPicBuff[w * h], &inPicBuff[w * h * 5 / 4], pA.get() };
int in_line[4] = { w, w/2, w/2, w };
u8* out_data[4] = { Memory.GetMemFromAddr(outPicBuff_addr), NULL, NULL, NULL };
u8* out_data[4] = { outPicBuff.get_ptr(), NULL, NULL, NULL };
int out_line[4] = { static_cast<int>(ow*4), 0, 0, 0 };
sws_scale(sws, in_data, in_line, 0, h, out_data, out_line);

View File

@ -295,7 +295,7 @@ int cellSSPlayerGetState(u32 handle)
return CELL_SSPLAYER_STATE_OFF;
}
int cellSurMixerCreate(const vm::ptr<CellSurMixerConfig> config)
int cellSurMixerCreate(vm::ptr<const CellSurMixerConfig> config)
{
libmixer->Warning("cellSurMixerCreate(config_addr=0x%x)", config.addr());

View File

@ -161,34 +161,40 @@ void fsAioRead(u32 fd, vm::ptr<CellFsAio> aio, int xid, vm::ptr<void (*)(vm::ptr
}
}
u32 error = CELL_OK;
u64 res = 0;
{
LV2_LOCK(0);
vfsFileBase* orig_file;
if(!sys_fs->CheckId(fd, orig_file)) return;
if (!sys_fs->CheckId(fd, orig_file))
{
sys_fs->Error("Wrong fd (%s)", fd);
Emu.Pause();
return;
}
u64 nbytes = aio->size;
u32 buf_addr = aio->buf_addr;
u32 error = CELL_OK;
vfsStream& file = *(vfsStream*)orig_file;
const u64 old_pos = file.Tell();
file.Seek((u64)aio->offset);
// TODO: use code from cellFsRead or something
u64 res = 0;
if (nbytes != (u32)nbytes)
{
error = CELL_ENOMEM;
}
else
{
res = nbytes ? file.Read(Memory.GetMemFromAddr(buf_addr), nbytes) : 0;
res = nbytes ? file.Read(aio->buf.get_ptr(), nbytes) : 0;
}
file.Seek(old_pos);
sys_fs->Log("*** fsAioRead(fd=%d, offset=0x%llx, buf_addr=0x%x, size=0x%x, error=0x%x, res=0x%x, xid=0x%x [%s])",
fd, (u64)aio->offset, buf_addr, (u64)aio->size, error, res, xid, orig_file->GetPath().c_str());
fd, (u64)aio->offset, aio->buf.addr(), (u64)aio->size, error, res, xid, orig_file->GetPath().c_str());
}
if (func) // start callback thread
{
@ -202,6 +208,8 @@ int cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<be_t<u32>> aio_id, vm::ptr<voi
{
sys_fs->Warning("cellFsAioRead(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.addr(), aio_id.addr(), func.addr());
LV2_LOCK(0);
if (!aio_init)
{
return CELL_ENXIO;
@ -231,6 +239,8 @@ int cellFsAioWrite(vm::ptr<CellFsAio> aio, vm::ptr<be_t<u32>> aio_id, vm::ptr<vo
{
sys_fs->Todo("cellFsAioWrite(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.addr(), aio_id.addr(), func.addr());
LV2_LOCK(0);
// TODO:
return CELL_OK;
@ -239,6 +249,9 @@ int cellFsAioWrite(vm::ptr<CellFsAio> aio, vm::ptr<be_t<u32>> aio_id, vm::ptr<vo
int cellFsAioInit(vm::ptr<const char> mount_point)
{
sys_fs->Warning("cellFsAioInit(mount_point_addr=0x%x (%s))", mount_point.addr(), mount_point.get_ptr());
LV2_LOCK(0);
aio_init = true;
return CELL_OK;
}
@ -246,14 +259,19 @@ int cellFsAioInit(vm::ptr<const char> mount_point)
int cellFsAioFinish(vm::ptr<const char> mount_point)
{
sys_fs->Warning("cellFsAioFinish(mount_point_addr=0x%x (%s))", mount_point.addr(), mount_point.get_ptr());
LV2_LOCK(0);
aio_init = false;
return CELL_OK;
}
int cellFsReadWithOffset(u32 fd, u64 offset, u32 buf_addr, u64 buffer_size, vm::ptr<be_t<u64>> nread)
int cellFsReadWithOffset(u32 fd, u64 offset, vm::ptr<void> buf, u64 buffer_size, vm::ptr<be_t<u64>> nread)
{
sys_fs->Warning("cellFsReadWithOffset(fd=%d, offset=0x%llx, buf_addr=0x%x, buffer_size=%lld nread=0x%llx)",
fd, offset, buf_addr, buffer_size, nread.addr());
fd, offset, buf.addr(), buffer_size, nread.addr());
LV2_LOCK(0);
int ret;
vm::var<be_t<u64>> oldPos, newPos;
@ -261,7 +279,7 @@ int cellFsReadWithOffset(u32 fd, u64 offset, u32 buf_addr, u64 buffer_size, vm::
if (ret) return ret;
ret = cellFsLseek(fd, offset, CELL_SEEK_SET, newPos); // Move to the specified offset
if (ret) return ret;
ret = cellFsRead(fd, buf_addr, buffer_size, nread); // Read the file
ret = cellFsRead(fd, buf, buffer_size, nread); // Read the file
if (ret) return ret;
ret = cellFsLseek(fd, oldPos.value(), CELL_SEEK_SET, newPos); // Return to the old position
if (ret) return ret;
@ -316,5 +334,7 @@ void sys_fs_init()
void sys_fs_load()
{
g_FsAioReadID = 0;
g_FsAioReadCur = 0;
aio_init = false;
}

View File

@ -94,7 +94,7 @@ using pck_len_t = u32;
#endif
// Functions
int sys_net_accept(s32 s, vm::ptr<sys_net_sockaddr> addr, vm::ptr<be_t<u32>> paddrlen)
int sys_net_accept(s32 s, vm::ptr<sys_net_sockaddr> addr, vm::ptr<pck_len_t> paddrlen)
{
sys_net->Warning("accept(s=%d, family_addr=0x%x, paddrlen=0x%x)", s, addr.addr(), paddrlen.addr());
if (!addr) {
@ -106,8 +106,9 @@ int sys_net_accept(s32 s, vm::ptr<sys_net_sockaddr> addr, vm::ptr<be_t<u32>> pad
sockaddr _addr;
memcpy(&_addr, addr.get_ptr(), sizeof(sockaddr));
_addr.sa_family = addr->sa_family;
pck_len_t *_paddrlen = (pck_len_t *)Memory.VirtualToRealAddr(paddrlen.addr());
int ret = accept(s, &_addr, _paddrlen);
pck_len_t _paddrlen;
int ret = accept(s, &_addr, &_paddrlen);
*paddrlen = _paddrlen;
*g_lastError = getLastError();
return ret;
}
@ -217,12 +218,11 @@ int inet_ntop()
return CELL_OK;
}
int sys_net_inet_pton(s32 af, u32 src_addr, u32 dst_addr)
int sys_net_inet_pton(s32 af, vm::ptr<const char> src, vm::ptr<char> dst)
{
sys_net->Warning("inet_pton(af=%d, src_addr=0x%x, dst_addr=0x%x)", af, src_addr, dst_addr);
char *src = (char *)Memory.VirtualToRealAddr(src_addr);
char *dst = (char *)Memory.VirtualToRealAddr(dst_addr);
return inet_pton(af, src, dst);
sys_net->Warning("inet_pton(af=%d, src_addr=0x%x, dst_addr=0x%x)", af, src.addr(), dst.addr());
return inet_pton(af, src.get_ptr(), dst.get_ptr());
}
int sys_net_listen(s32 s, s32 backlog)
@ -233,26 +233,26 @@ int sys_net_listen(s32 s, s32 backlog)
return ret;
}
int sys_net_recv(s32 s, u32 buf_addr, u32 len, s32 flags)
int sys_net_recv(s32 s, vm::ptr<char> buf, u32 len, s32 flags)
{
sys_net->Warning("recv(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf_addr, len, flags);
char *buf = (char *)Memory.VirtualToRealAddr(buf_addr);
int ret = recv(s, buf, len, flags);
sys_net->Warning("recv(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf.addr(), len, flags);
int ret = recv(s, buf.get_ptr(), len, flags);
*g_lastError = getLastError();
return ret;
}
int sys_net_recvfrom(s32 s, u32 buf_addr, u32 len, s32 flags, vm::ptr<sys_net_sockaddr> addr, vm::ptr<be_t<u32>> paddrlen)
int sys_net_recvfrom(s32 s, vm::ptr<char> buf, u32 len, s32 flags, vm::ptr<sys_net_sockaddr> addr, vm::ptr<pck_len_t> paddrlen)
{
sys_net->Warning("recvfrom(s=%d, buf_addr=0x%x, len=%u, flags=0x%x, addr_addr=0x%x, paddrlen=0x%x)",
s, buf_addr, len, flags, addr.addr(), paddrlen.addr());
s, buf.addr(), len, flags, addr.addr(), paddrlen.addr());
char *_buf_addr = (char *)Memory.VirtualToRealAddr(buf_addr);
sockaddr _addr;
memcpy(&_addr, addr.get_ptr(), sizeof(sockaddr));
_addr.sa_family = addr->sa_family;
pck_len_t *_paddrlen = (pck_len_t *) Memory.VirtualToRealAddr(paddrlen.addr());
int ret = recvfrom(s, _buf_addr, len, flags, &_addr, _paddrlen);
pck_len_t _paddrlen;
int ret = recvfrom(s, buf.get_ptr(), len, flags, &_addr, &_paddrlen);
*paddrlen = _paddrlen;
*g_lastError = getLastError();
return ret;
}
@ -263,11 +263,11 @@ int recvmsg()
return CELL_OK;
}
int sys_net_send(s32 s, u32 buf_addr, u32 len, s32 flags)
int sys_net_send(s32 s, vm::ptr<const char> buf, u32 len, s32 flags)
{
sys_net->Warning("send(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf_addr, len, flags);
char *buf = (char *)Memory.VirtualToRealAddr(buf_addr);
int ret = send(s, buf, len, flags);
sys_net->Warning("send(s=%d, buf_addr=0x%x, len=%d, flags=0x%x)", s, buf.addr(), len, flags);
int ret = send(s, buf.get_ptr(), len, flags);
*g_lastError = getLastError();
return ret;
}
@ -278,25 +278,24 @@ int sendmsg()
return CELL_OK;
}
int sys_net_sendto(s32 s, u32 buf_addr, u32 len, s32 flags, vm::ptr<sys_net_sockaddr> addr, u32 addrlen)
int sys_net_sendto(s32 s, vm::ptr<const char> buf, u32 len, s32 flags, vm::ptr<sys_net_sockaddr> addr, u32 addrlen)
{
sys_net->Warning("sendto(s=%d, buf_addr=0x%x, len=%u, flags=0x%x, addr=0x%x, addrlen=%u)",
s, buf_addr, len, flags, addr.addr(), addrlen);
s, buf.addr(), len, flags, addr.addr(), addrlen);
char *_buf_addr = (char *)Memory.VirtualToRealAddr(buf_addr);
sockaddr _addr;
memcpy(&_addr, addr.get_ptr(), sizeof(sockaddr));
_addr.sa_family = addr->sa_family;
int ret = sendto(s, _buf_addr, len, flags, &_addr, addrlen);
int ret = sendto(s, buf.get_ptr(), len, flags, &_addr, addrlen);
*g_lastError = getLastError();
return ret;
}
int sys_net_setsockopt(s32 s, s32 level, s32 optname, u32 optval_addr, u32 optlen)
int sys_net_setsockopt(s32 s, s32 level, s32 optname, vm::ptr<const char> optval, u32 optlen)
{
sys_net->Warning("socket(s=%d, level=%d, optname=%d, optval_addr=0x%x, optlen=%u)", s, level, optname, optval_addr, optlen);
char *_optval_addr = (char *)Memory.VirtualToRealAddr(optval_addr);
int ret = setsockopt(s, level, optname, _optval_addr, optlen);
sys_net->Warning("socket(s=%d, level=%d, optname=%d, optval_addr=0x%x, optlen=%u)", s, level, optname, optval.addr(), optlen);
int ret = setsockopt(s, level, optname, optval.get_ptr(), optlen);
*g_lastError = getLastError();
return ret;
}

View File

@ -37,6 +37,8 @@ s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::p
const std::string _path = path.get_ptr();
LV2_LOCK(0);
s32 _oflags = flags;
if(flags & CELL_O_CREAT)
{
@ -114,10 +116,13 @@ s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::p
return CELL_OK;
}
s32 cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, vm::ptr<be_t<u64>> nread)
s32 cellFsRead(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<be_t<u64>> nread)
{
sys_fs->Log("cellFsRead(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nread_addr=0x%x)",
fd, buf_addr, nbytes, nread.addr());
fd, buf.addr(), nbytes, nread.addr());
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -125,17 +130,20 @@ s32 cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, vm::ptr<be_t<u64>> nread)
// TODO: checks
const u64 res = nbytes ? file->Read(Memory.GetMemFromAddr(buf_addr), nbytes) : 0;
const u64 res = nbytes ? file->Read(buf.get_ptr(), nbytes) : 0;
if (nread) *nread = res;
return CELL_OK;
}
s32 cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, vm::ptr<be_t<u64>> nwrite)
s32 cellFsWrite(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<be_t<u64>> nwrite)
{
sys_fs->Log("cellFsWrite(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nwrite_addr=0x%x)",
fd, buf_addr, nbytes, nwrite.addr());
fd, buf.addr(), nbytes, nwrite.addr());
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -143,7 +151,7 @@ s32 cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, vm::ptr<be_t<u64>> nwrite)
// TODO: checks
const u64 res = nbytes ? file->Write(Memory.GetMemFromAddr(buf_addr), nbytes) : 0;
const u64 res = nbytes ? file->Write(buf.get_ptr(), nbytes) : 0;
if (nwrite) *nwrite = res;
@ -154,6 +162,8 @@ s32 cellFsClose(u32 fd)
{
sys_fs->Warning("cellFsClose(fd=%d)", fd);
LV2_LOCK(0);
if(!Emu.GetIdManager().RemoveID(fd))
return CELL_ESRCH;
@ -164,6 +174,8 @@ s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<be_t<u32>> fd)
{
sys_fs->Warning("cellFsOpendir(path=\"%s\", fd_addr=0x%x)", path.get_ptr(), fd.addr());
LV2_LOCK(0);
vfsDirBase* dir = Emu.GetVFS().OpenDir(path.get_ptr());
if(!dir || !dir->IsOpened())
{
@ -179,6 +191,8 @@ s32 cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<be_t<u64>> nread)
{
sys_fs->Warning("cellFsReaddir(fd=%d, dir_addr=0x%x, nread_addr=0x%x)", fd, dir.addr(), nread.addr());
LV2_LOCK(0);
vfsDirBase* directory;
if(!sys_fs->CheckId(fd, directory))
return CELL_ESRCH;
@ -203,6 +217,8 @@ s32 cellFsClosedir(u32 fd)
{
sys_fs->Warning("cellFsClosedir(fd=%d)", fd);
LV2_LOCK(0);
if(!Emu.GetIdManager().RemoveID(fd))
return CELL_ESRCH;
@ -213,6 +229,8 @@ s32 cellFsStat(vm::ptr<const char> path, vm::ptr<CellFsStat> sb)
{
sys_fs->Warning("cellFsStat(path=\"%s\", sb_addr: 0x%x)", path.get_ptr(), sb.addr());
LV2_LOCK(0);
const std::string _path = path.get_ptr();
sb->st_mode =
@ -254,6 +272,8 @@ s32 cellFsFstat(u32 fd, vm::ptr<CellFsStat> sb)
{
sys_fs->Warning("cellFsFstat(fd=%d, sb_addr: 0x%x)", fd, sb.addr());
LV2_LOCK(0);
IDType type;
vfsStream* file;
if(!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE) {
@ -281,6 +301,8 @@ s32 cellFsMkdir(vm::ptr<const char> path, u32 mode)
{
sys_fs->Warning("cellFsMkdir(path=\"%s\", mode=0x%x)", path.get_ptr(), mode);
LV2_LOCK(0);
const std::string _path = path.get_ptr();
if(Emu.GetVFS().ExistsDir(_path))
@ -295,6 +317,8 @@ s32 cellFsRename(vm::ptr<const char> from, vm::ptr<const char> to)
{
sys_fs->Warning("cellFsRename(from='%s', to='%s')", from.get_ptr(), to.get_ptr());
LV2_LOCK(0);
std::string _from = from.get_ptr();
std::string _to = to.get_ptr();
@ -327,6 +351,8 @@ s32 cellFsChmod(vm::ptr<const char> path, u32 mode)
{
sys_fs->Todo("cellFsChmod(path=\"%s\", mode=0x%x)", path.get_ptr(), mode);
LV2_LOCK(0);
// TODO:
return CELL_OK;
@ -336,6 +362,8 @@ s32 cellFsFsync(u32 fd)
{
sys_fs->Todo("cellFsFsync(fd=0x%x)", fd);
LV2_LOCK(0);
// TODO:
return CELL_OK;
@ -345,6 +373,8 @@ s32 cellFsRmdir(vm::ptr<const char> path)
{
sys_fs->Warning("cellFsRmdir(path=\"%s\")", path.get_ptr());
LV2_LOCK(0);
std::string _path = path.get_ptr();
vfsDir d;
@ -361,6 +391,8 @@ s32 cellFsUnlink(vm::ptr<const char> path)
{
sys_fs->Warning("cellFsUnlink(path=\"%s\")", path.get_ptr());
LV2_LOCK(0);
std::string _path = path.get_ptr();
if (Emu.GetVFS().ExistsDir(_path))
@ -377,8 +409,11 @@ s32 cellFsUnlink(vm::ptr<const char> path)
s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<be_t<u64>> pos)
{
vfsSeekMode seek_mode;
sys_fs->Log("cellFsLseek(fd=%d, offset=0x%llx, whence=0x%x, pos_addr=0x%x)", fd, offset, whence, pos.addr());
LV2_LOCK(0);
vfsSeekMode seek_mode;
switch(whence)
{
case CELL_SEEK_SET: seek_mode = vfsSeekSet; break;
@ -402,6 +437,8 @@ s32 cellFsFtruncate(u32 fd, u64 size)
{
sys_fs->Warning("cellFsFtruncate(fd=%d, size=%lld)", fd, size);
LV2_LOCK(0);
IDType type;
vfsStream* file;
if (!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE) {
@ -431,6 +468,8 @@ s32 cellFsTruncate(vm::ptr<const char> path, u64 size)
{
sys_fs->Warning("cellFsTruncate(path=\"%s\", size=%lld)", path.get_ptr(), size);
LV2_LOCK(0);
vfsFile f(path.get_ptr(), vfsReadWrite);
if(!f.IsOpened())
{
@ -462,6 +501,8 @@ s32 cellFsFGetBlockSize(u32 fd, vm::ptr<be_t<u64>> sector_size, vm::ptr<be_t<u64
sys_fs->Warning("cellFsFGetBlockSize(fd=%d, sector_size_addr=0x%x, block_size_addr=0x%x)",
fd, sector_size.addr(), block_size.addr());
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -476,6 +517,8 @@ s32 cellFsGetBlockSize(vm::ptr<const char> path, vm::ptr<be_t<u64>> sector_size,
sys_fs->Warning("cellFsGetBlockSize(file='%s', sector_size_addr=0x%x, block_size_addr=0x%x)",
path.get_ptr(), sector_size.addr(), block_size.addr());
LV2_LOCK(0);
*sector_size = 4096; // ?
*block_size = 4096; // ?
@ -487,6 +530,8 @@ s32 cellFsGetFreeSize(vm::ptr<const char> path, vm::ptr<be_t<u32>> block_size, v
sys_fs->Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)",
path.get_ptr(), block_size.addr(), block_count.addr());
LV2_LOCK(0);
// TODO: Get real values. Currently, it always returns 40 GB of free space divided in 4 KB blocks
*block_size = 4096; // ?
*block_count = 10485760; // ?
@ -499,6 +544,8 @@ s32 cellFsGetDirectoryEntries(u32 fd, vm::ptr<CellFsDirectoryEntry> entries, u32
sys_fs->Warning("cellFsGetDirectoryEntries(fd=%d, entries_addr=0x%x, entries_size=0x%x, data_count_addr=0x%x)",
fd, entries.addr(), entries_size, data_count.addr());
LV2_LOCK(0);
vfsDirBase* directory;
if(!sys_fs->CheckId(fd, directory))
return CELL_ESRCH;
@ -535,6 +582,8 @@ s32 cellFsStReadInit(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
{
sys_fs->Warning("cellFsStReadInit(fd=%d, ringbuf_addr=0x%x)", fd, ringbuf.addr());
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -557,6 +606,8 @@ s32 cellFsStReadFinish(u32 fd)
{
sys_fs->Warning("cellFsStReadFinish(fd=%d)", fd);
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -570,6 +621,8 @@ s32 cellFsStReadGetRingBuf(u32 fd, vm::ptr<CellFsRingBuffer> ringbuf)
{
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, ringbuf_addr=0x%x)", fd, ringbuf.addr());
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -584,6 +637,8 @@ s32 cellFsStReadGetStatus(u32 fd, vm::ptr<be_t<u64>> status)
{
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, status_addr=0x%x)", fd, status.addr());
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -596,6 +651,8 @@ s32 cellFsStReadGetRegid(u32 fd, vm::ptr<be_t<u64>> regid)
{
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, regid_addr=0x%x)", fd, regid.addr());
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -608,6 +665,8 @@ s32 cellFsStReadStart(u32 fd, u64 offset, u64 size)
{
sys_fs->Todo("cellFsStReadStart(fd=%d, offset=0x%llx, size=0x%llx)", fd, offset, size);
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -621,6 +680,8 @@ s32 cellFsStReadStop(u32 fd)
{
sys_fs->Warning("cellFsStReadStop(fd=%d)", fd);
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -633,6 +694,8 @@ s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, vm::ptr<be_t<u64>> rsize)
{
sys_fs->Todo("cellFsStRead(fd=%d, buf_addr=0x%x, size=0x%llx, rsize_addr = 0x%x)", fd, buf_addr, size, rsize.addr());
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -646,6 +709,8 @@ s32 cellFsStReadGetCurrentAddr(u32 fd, vm::ptr<be_t<u32>> addr, vm::ptr<be_t<u64
{
sys_fs->Todo("cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr = 0x%x)", fd, addr.addr(), size.addr());
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -656,6 +721,8 @@ s32 cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size)
{
sys_fs->Todo("cellFsStReadPutCurrentAddr(fd=%d, addr_addr=0x%x, size = 0x%llx)", fd, addr_addr, size);
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -666,6 +733,8 @@ s32 cellFsStReadWait(u32 fd, u64 size)
{
sys_fs->Todo("cellFsStReadWait(fd=%d, size = 0x%llx)", fd, size);
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -676,6 +745,8 @@ s32 cellFsStReadWaitCallback(u32 fd, u64 size, vm::ptr<void (*)(int xfd, u64 xsi
{
sys_fs->Todo("cellFsStReadWaitCallback(fd=%d, size = 0x%llx, func_addr = 0x%x)", fd, size, func.addr());
LV2_LOCK(0);
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;

View File

@ -104,7 +104,7 @@ struct CellFsAio
{
be_t<u32> fd;
be_t<u64> offset;
be_t<u32> buf_addr;
vm::bptr<void> buf;
be_t<u64> size;
be_t<u64> user_data;
};
@ -125,8 +125,8 @@ struct CellFsRingBuffer
// SysCalls
s32 cellFsOpen(vm::ptr<const char> path, s32 flags, vm::ptr<be_t<u32>> fd, vm::ptr<be_t<u32>> arg, u64 size);
s32 cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, vm::ptr<be_t<u64>> nread);
s32 cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, vm::ptr<be_t<u64>> nwrite);
s32 cellFsRead(u32 fd, vm::ptr<void> buf, u64 nbytes, vm::ptr<be_t<u64>> nread);
s32 cellFsWrite(u32 fd, vm::ptr<const void> buf, u64 nbytes, vm::ptr<be_t<u64>> nwrite);
s32 cellFsClose(u32 fd);
s32 cellFsOpendir(vm::ptr<const char> path, vm::ptr<be_t<u32>> fd);
s32 cellFsReaddir(u32 fd, vm::ptr<CellFsDirent> dir, vm::ptr<be_t<u64>> nread);

View File

@ -37,7 +37,7 @@ s32 sys_prx_load_module(vm::ptr<const char> path, u64 flags, vm::ptr<sys_prx_loa
prx->path = path;
// Load the PRX into memory
f.Read(Memory.VirtualToRealAddr(prx->address), prx->size);
f.Read(vm::get_ptr<void>(prx->address), prx->size);
u32 id = sys_prx.GetNewId(prx, TYPE_PRX);
return id;

View File

@ -248,7 +248,7 @@ void InterpreterDisAsmFrame::ShowAddr(const u64 addr)
}
else
{
disasm->offset = Memory.GetMemFromAddr(CPU->GetOffset());
disasm->offset = vm::get_ptr<u8>(CPU->GetOffset());
for(uint i=0, count = 4; i<m_item_count; ++i, PC += count)
{
if(!Memory.IsGoodAddr(CPU->GetOffset() + PC, 4))

View File

@ -233,7 +233,7 @@ void MemoryViewerPanel::ShowImage(wxWindow* parent, u32 addr, int mode, u32 widt
f_image_viewer->Show();
wxClientDC dc_canvas(f_image_viewer);
unsigned char* originalBuffer = (unsigned char*)Memory.VirtualToRealAddr(addr);
unsigned char* originalBuffer = vm::get_ptr<unsigned char>(addr);
unsigned char* convertedBuffer = (unsigned char*)malloc(width * height * 3);
switch(mode)
{

View File

@ -412,13 +412,13 @@ void RSXDebugger::GetBuffers()
if(!Memory.IsGoodAddr(render.m_gcm_buffers_addr))
continue;
CellGcmDisplayInfo* buffers = (CellGcmDisplayInfo*)Memory.GetMemFromAddr(render.m_gcm_buffers_addr);
auto buffers = vm::get_ptr<CellGcmDisplayInfo>(render.m_gcm_buffers_addr);
u32 RSXbuffer_addr = render.m_local_mem_addr + buffers[bufferId].offset;
if(!Memory.IsGoodAddr(RSXbuffer_addr))
continue;
unsigned char* RSXbuffer = (unsigned char*)Memory.VirtualToRealAddr(RSXbuffer_addr);
auto RSXbuffer = vm::get_ptr<unsigned char>(RSXbuffer_addr);
u32 width = buffers[bufferId].width;
u32 height = buffers[bufferId].height;
@ -470,7 +470,7 @@ void RSXDebugger::GetBuffers()
if(!Memory.IsGoodAddr(TexBuffer_addr))
return;
unsigned char* TexBuffer = (unsigned char*)Memory.VirtualToRealAddr(TexBuffer_addr);
unsigned char* TexBuffer = vm::get_ptr<unsigned char>(TexBuffer_addr);
u32 width = render.m_textures[m_cur_texture].GetWidth();
u32 height = render.m_textures[m_cur_texture].GetHeight();

View File

@ -418,7 +418,7 @@ bool ELF64Loader::LoadPhdrData(u64 offset)
for(u32 s=proc_prx_param.libstubstart; s<proc_prx_param.libstubend; s+=sizeof(Elf64_StubHeader))
{
Elf64_StubHeader stub = *(Elf64_StubHeader*)Memory.GetMemFromAddr(offset + s);
Elf64_StubHeader stub = vm::get_ref<Elf64_StubHeader>(offset + s);
const std::string module_name = vm::get_ptr<const char>(stub.s_modulename);
Module* module = Emu.GetModuleManager().GetModuleByName(module_name);