mem64_t replaced

Added conversion from vm::var to vm::ptr of the same type.
This commit is contained in:
Nekotekina 2014-09-01 02:58:08 +04:00
parent 0d94c78e63
commit 0b5ef1d8f9
22 changed files with 177 additions and 169 deletions

View file

@ -769,7 +769,6 @@ public:
};
typedef mem_t<u32, u32> mem32_t;
typedef mem_t<u64, u32> mem64_t;
#include "vm.h"

View file

@ -105,6 +105,11 @@ namespace vm
return addr();
}
*/
template<typename AT> operator ptr<T, 1, AT>() const
{
return ptr<T, 1, AT>::make(m_addr);
}
operator T&()
{

View file

@ -387,17 +387,17 @@ int cellAudioInit()
{
std::lock_guard<std::mutex> lock(audioMutex);
// update indexes:
auto indexes = vm::ptr<be_t<u64>>::make(m_config.m_indexes);
for (u32 i = 0; i < m_config.AUDIO_PORT_COUNT; i++)
{
if (!m_config.m_ports[i].m_is_audio_port_started) continue;
AudioPortConfig& port = m_config.m_ports[i];
mem64_t index(m_config.m_indexes + i * sizeof(u64));
u32 position = port.tag % port.block; // old value
port.counter = m_config.counter;
port.tag++; // absolute index of block that will be read
index = (position + 1) % port.block; // write new value
indexes[i] = (position + 1) % port.block; // write new value
}
// load keys:
keys.resize(m_config.m_keys.size());
@ -659,9 +659,9 @@ int cellAudioPortStop(u32 portNum)
return CELL_OK;
}
int cellAudioGetPortTimestamp(u32 portNum, u64 tag, mem64_t stamp)
int cellAudioGetPortTimestamp(u32 portNum, u64 tag, vm::ptr<be_t<u64>> stamp)
{
cellAudio->Log("cellAudioGetPortTimestamp(portNum=0x%x, tag=0x%llx, stamp_addr=0x%x)", portNum, tag, stamp.GetAddr());
cellAudio->Log("cellAudioGetPortTimestamp(portNum=0x%x, tag=0x%llx, stamp_addr=0x%x)", portNum, tag, stamp.addr());
if (portNum >= m_config.AUDIO_PORT_COUNT)
{
@ -682,14 +682,14 @@ int cellAudioGetPortTimestamp(u32 portNum, u64 tag, mem64_t stamp)
std::lock_guard<std::mutex> lock(audioMutex);
stamp = m_config.start_time + (port.counter + (tag - port.tag)) * 256000000 / 48000;
*stamp = m_config.start_time + (port.counter + (tag - port.tag)) * 256000000 / 48000;
return CELL_OK;
}
int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, mem64_t tag)
int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, vm::ptr<be_t<u64>> tag)
{
cellAudio->Log("cellAudioGetPortBlockTag(portNum=0x%x, blockNo=0x%llx, tag_addr=0x%x)", portNum, blockNo, tag.GetAddr());
cellAudio->Log("cellAudioGetPortBlockTag(portNum=0x%x, blockNo=0x%llx, tag_addr=0x%x)", portNum, blockNo, tag.addr());
if (portNum >= m_config.AUDIO_PORT_COUNT)
{
@ -726,7 +726,7 @@ int cellAudioGetPortBlockTag(u32 portNum, u64 blockNo, mem64_t tag)
{
tag_base &= ~(port.block-1);
}
tag = tag_base + blockNo;
*tag = tag_base + blockNo;
return CELL_OK;
}
@ -738,9 +738,9 @@ int cellAudioSetPortLevel(u32 portNum, float level)
}
// Utility Functions
int cellAudioCreateNotifyEventQueue(mem32_t id, mem64_t key)
int cellAudioCreateNotifyEventQueue(mem32_t id, vm::ptr<be_t<u64>> key)
{
cellAudio->Warning("cellAudioCreateNotifyEventQueue(id_addr=0x%x, key_addr=0x%x)", id.GetAddr(), key.GetAddr());
cellAudio->Warning("cellAudioCreateNotifyEventQueue(id_addr=0x%x, key_addr=0x%x)", id.GetAddr(), key.addr());
std::lock_guard<std::mutex> lock(audioMutex);
@ -761,14 +761,14 @@ int cellAudioCreateNotifyEventQueue(mem32_t id, mem64_t key)
}
id = cellAudio->GetNewId(eq);
key = event_key;
*key = event_key;
return CELL_OK;
}
int cellAudioCreateNotifyEventQueueEx(mem32_t id, mem64_t key, u32 iFlags)
int cellAudioCreateNotifyEventQueueEx(mem32_t id, vm::ptr<be_t<u64>> key, u32 iFlags)
{
cellAudio->Todo("cellAudioCreateNotifyEventQueueEx(id_addr=0x%x, key_addr=0x%x, iFlags=0x%x)", id.GetAddr(), key.GetAddr(), iFlags);
cellAudio->Todo("cellAudioCreateNotifyEventQueueEx(id_addr=0x%x, key_addr=0x%x, iFlags=0x%x)", id.GetAddr(), key.addr(), iFlags);
return CELL_OK;
}

View file

@ -34,7 +34,7 @@ int cellFontInitializeWithRevision(u64 revisionFlags, mem_ptr_t<CellFontConfig>
return CELL_FONT_OK;
}
int cellFontGetRevisionFlags(mem64_t revisionFlags)
int cellFontGetRevisionFlags(vm::ptr<be_t<u64>> revisionFlags)
{
UNIMPLEMENTED_FUNC(cellFont);
return CELL_FONT_OK;
@ -44,10 +44,10 @@ int cellFontInit(mem_ptr_t<CellFontConfig> config)
{
cellFont->Log("cellFontInit(config=0x%x)", config.GetAddr());
vm::var<u64> revisionFlags;
vm::var<be_t<u64>> revisionFlags;
revisionFlags.value() = 0;
cellFontGetRevisionFlags(revisionFlags.addr());
return cellFontInitializeWithRevision(revisionFlags, config.GetAddr());
cellFontGetRevisionFlags(revisionFlags);
return cellFontInitializeWithRevision(revisionFlags.value(), config.GetAddr());
}
int cellFontEnd()
@ -183,7 +183,7 @@ int cellFontOpenFontset(mem_ptr_t<CellFontLibrary> library, mem_ptr_t<CellFontTy
vm::var<const char> f((u32)file.length() + 1, 1);
Memory.WriteString(f.addr(), file);
int ret = cellFontOpenFontFile(library.GetAddr(), vm::ptr<const char>::make(f.addr()), 0, 0, font.GetAddr()); //TODO: Find the correct values of subNum, uniqueId
int ret = cellFontOpenFontFile(library.GetAddr(), f, 0, 0, font.GetAddr()); //TODO: Find the correct values of subNum, uniqueId
font->origin = CELL_FONT_OPEN_FONTSET;
return ret;
}

View file

@ -83,8 +83,8 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellGifDecInfo
break;
case se32(CELL_GIFDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos.addr());
cellFsRead(fd, buffer.addr(), buffer.size(), nread.addr());
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, buffer.addr(), buffer.size(), nread);
break;
}
@ -156,7 +156,7 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const
//Copy the GIF file to a buffer
vm::var<unsigned char[]> gif((u32)fileSize);
vm::var<u64> pos, nread;
vm::var<be_t<u64>> pos, nread;
switch(subHandle_data->src.srcSelect.ToBE())
{
@ -165,8 +165,8 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const
break;
case se32(CELL_GIFDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos.addr());
cellFsRead(fd, gif.addr(), gif.size(), nread.addr());
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, gif.addr(), gif.size(), nread);
break;
}

View file

@ -103,8 +103,8 @@ int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellJpgDecInfo
break;
case se32(CELL_JPGDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos.addr());
cellFsRead(fd, buffer.addr(), buffer.size(), nread.addr());
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, buffer.addr(), buffer.size(), nread);
break;
}
@ -163,7 +163,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const
//Copy the JPG file to a buffer
vm::var<unsigned char[]> jpg((u32)fileSize);
vm::var<u64> pos, nread;
vm::var<be_t<u64>> pos, nread;
switch(subHandle_data->src.srcSelect.ToBE())
{
@ -172,8 +172,8 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const
break;
case se32(CELL_JPGDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos.addr());
cellFsRead(fd, jpg.addr(), jpg.size(), nread.addr());
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, jpg.addr(), jpg.size(), nread);
break;
}

View file

@ -18,24 +18,24 @@
//Module cellL10n(0x001e, cellL10n_init);
Module *cellL10n = nullptr;
int UTF16stoUTF8s(vm::ptr<const be_t<u16>> utf16, mem64_t utf16_len, vm::ptr<char> utf8, mem64_t utf8_len)
int UTF16stoUTF8s(vm::ptr<const char16_t> utf16, vm::ptr<be_t<u32>> utf16_len, vm::ptr<char> utf8, vm::ptr<be_t<u32>> utf8_len)
{
cellL10n->Warning("UTF16stoUTF8s(utf16_addr=0x%x, utf16_len_addr=0x%x, utf8_addr=0x%x, utf8_len_addr=0x%x)",
utf16.addr(), utf16_len.GetAddr(), utf8.addr(), utf8_len.GetAddr());
utf16.addr(), utf16_len.addr(), utf8.addr(), utf8_len.addr());
std::u16string wstr =(char16_t*)utf16.get_ptr();
wstr.resize(utf16_len.GetValue()); // TODO: Is this really the role of utf16_len in this function?
std::u16string wstr = utf16.get_ptr(); // ???
wstr.resize(*utf16_len); // TODO: Is this really the role of utf16_len in this function?
#ifdef _MSC_VER
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
std::string str = convert.to_bytes(wstr);
if (utf8_len.GetValue() < str.size())
if (*utf8_len < str.size())
{
utf8_len = str.size();
*utf8_len = str.size();
return DSTExhausted;
}
utf8_len = str.size();
*utf8_len = str.size();
Memory.WriteString(utf8.addr(), str);
#endif
return ConversionOK;

View file

@ -124,41 +124,41 @@ u8 pamfGetStreamChannel(mem_ptr_t<CellPamfReader> pSelf, u8 stream)
}
int cellPamfGetHeaderSize(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, mem64_t pSize)
int cellPamfGetHeaderSize(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, vm::ptr<be_t<u64>> pSize)
{
cellPamf->Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, pSize.GetAddr());
cellPamf->Warning("cellPamfGetHeaderSize(pAddr=0x%x, fileSize=%d, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, pSize.addr());
//if ((u32)pAddr->magic != 0x464d4150)
//return CELL_PAMF_ERROR_UNKNOWN_TYPE;
const u64 offset = (u64)pAddr->data_offset << 11;
pSize = offset;
*pSize = offset;
return CELL_OK;
}
int cellPamfGetHeaderSize2(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, u32 attribute, mem64_t pSize)
int cellPamfGetHeaderSize2(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, u32 attribute, vm::ptr<be_t<u64>> pSize)
{
cellPamf->Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, attribute, pSize.GetAddr());
cellPamf->Warning("cellPamfGetHeaderSize2(pAddr=0x%x, fileSize=%d, attribute=0x%x, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, attribute, pSize.addr());
//if ((u32)pAddr->magic != 0x464d4150)
//return CELL_PAMF_ERROR_UNKNOWN_TYPE;
const u64 offset = (u64)pAddr->data_offset << 11;
pSize = offset;
*pSize = offset;
return CELL_OK;
}
int cellPamfGetStreamOffsetAndSize(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, mem64_t pOffset, mem64_t pSize)
int cellPamfGetStreamOffsetAndSize(mem_ptr_t<PamfHeader> pAddr, u64 fileSize, vm::ptr<be_t<u64>> pOffset, vm::ptr<be_t<u64>> pSize)
{
cellPamf->Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, pOffset.GetAddr(), pSize.GetAddr());
cellPamf->Warning("cellPamfGetStreamOffsetAndSize(pAddr=0x%x, fileSize=%d, pOffset_addr=0x%x, pSize_addr=0x%x)", pAddr.GetAddr(), fileSize, pOffset.addr(), pSize.addr());
//if ((u32)pAddr->magic != 0x464d4150)
//return CELL_PAMF_ERROR_UNKNOWN_TYPE;
const u64 offset = (u64)pAddr->data_offset << 11;
pOffset = offset;
*pOffset = offset;
const u64 size = (u64)pAddr->data_size << 11;
pSize = size;
*pSize = size;
return CELL_OK;
}

View file

@ -143,8 +143,8 @@ int cellPngDecReadHeader(u32 mainHandle, u32 subHandle, mem_ptr_t<CellPngDecInfo
memmove(Memory + buffer.addr(), Memory + subHandle_data->src.streamPtr.ToLE(), buffer.size());
break;
case se32(CELL_PNGDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos.addr());
cellFsRead(fd, buffer.addr(), buffer.size(), nread.addr());
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, buffer.addr(), buffer.size(), nread);
break;
}
@ -200,7 +200,7 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const
//Copy the PNG file to a buffer
vm::var<unsigned char[]> png((u32)fileSize);
vm::var<u64> pos, nread;
vm::var<be_t<u64>> pos, nread;
switch(subHandle_data->src.srcSelect.ToBE())
{
@ -209,8 +209,8 @@ int cellPngDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, const
break;
case se32(CELL_PNGDEC_FILE):
cellFsLseek(fd, 0, CELL_SEEK_SET, pos.addr());
cellFsRead(fd, png.addr(), png.size(), nread.addr());
cellFsLseek(fd, 0, CELL_SEEK_SET, pos);
cellFsRead(fd, png.addr(), png.size(), nread);
break;
}

View file

@ -9,14 +9,16 @@
//Module cellRtc(0x0009, cellRtc_init);
Module *cellRtc = nullptr;
long convertToUNIXTime(u16 seconds, u16 minutes, u16 hours, u16 days, int years)
s64 convertToUNIXTime(u16 seconds, u16 minutes, u16 hours, u16 days, int years)
{
return (seconds + minutes*60 + hours*3600 + days*86400 + (years-70)*31536000 + ((years-69)/4)*86400 - ((years-1)/100)*86400 + ((years+299)/400)*86400);
return (s64)seconds + (s64)minutes * 60 + (s64)hours * 3600 + (s64)days * 86400 +
(s64)(years - 70) * 31536000 + (s64)((years - 69) / 4) * 86400 -
(s64)((years - 1) / 100) * 86400 + (s64)((years + 299) / 400) * 86400;
}
u64 convertToWin32FILETIME(u16 seconds, u16 minutes, u16 hours, u16 days, int years)
{
long unixtime = convertToUNIXTime(seconds, minutes, hours, days, years);
s64 unixtime = convertToUNIXTime(seconds, minutes, hours, days, years);
u64 win32time = u64(unixtime) * u64(10000000) + u64(116444736000000000);
u64 win32filetime = win32time | win32time >> 32;
return win32filetime;
@ -323,25 +325,25 @@ int cellRtcGetDosTime(mem_ptr_t<CellRtcDateTime> pDateTime, mem32_t puiDosTime)
return CELL_OK;
}
int cellRtcGetTime_t(mem_ptr_t<CellRtcDateTime> pDateTime, mem64_t piTime)
int cellRtcGetTime_t(mem_ptr_t<CellRtcDateTime> pDateTime, vm::ptr<be_t<s64>> piTime)
{
cellRtc->Log("cellRtcGetTime_t(pDateTime=0x%x, piTime=0x%x)", pDateTime.GetAddr(), piTime.GetAddr());
cellRtc->Log("cellRtcGetTime_t(pDateTime=0x%x, piTime=0x%x)", pDateTime.GetAddr(), piTime.addr());
// Convert to POSIX time_t.
rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000));
piTime = convertToUNIXTime(date_time.GetSecond(rDateTime::TZ::UTC), date_time.GetMinute(rDateTime::TZ::UTC),
*piTime = convertToUNIXTime(date_time.GetSecond(rDateTime::TZ::UTC), date_time.GetMinute(rDateTime::TZ::UTC),
date_time.GetHour(rDateTime::TZ::UTC), date_time.GetDay(rDateTime::TZ::UTC), date_time.GetYear(rDateTime::TZ::UTC));
return CELL_OK;
}
int cellRtcGetWin32FileTime(mem_ptr_t<CellRtcDateTime> pDateTime, mem64_t pulWin32FileTime)
int cellRtcGetWin32FileTime(mem_ptr_t<CellRtcDateTime> pDateTime, vm::ptr<be_t<u64>> pulWin32FileTime)
{
cellRtc->Log("cellRtcGetWin32FileTime(pDateTime=0x%x, pulWin32FileTime=0x%x)", pDateTime.GetAddr(), pulWin32FileTime.GetAddr());
cellRtc->Log("cellRtcGetWin32FileTime(pDateTime=0x%x, pulWin32FileTime=0x%x)", pDateTime.GetAddr(), pulWin32FileTime.addr());
// Convert to WIN32 FILETIME.
rDateTime date_time = rDateTime(pDateTime->day, (rDateTime::Month)pDateTime->month.ToLE(), pDateTime->year, pDateTime->hour, pDateTime->minute, pDateTime->second, (pDateTime->microsecond / 1000));
pulWin32FileTime = convertToWin32FILETIME(date_time.GetSecond(rDateTime::TZ::UTC), date_time.GetMinute(rDateTime::TZ::UTC),
*pulWin32FileTime = convertToWin32FILETIME(date_time.GetSecond(rDateTime::TZ::UTC), date_time.GetMinute(rDateTime::TZ::UTC),
date_time.GetHour(rDateTime::TZ::UTC), date_time.GetDay(rDateTime::TZ::UTC), date_time.GetYear(rDateTime::TZ::UTC));
return CELL_OK;

View file

@ -574,19 +574,19 @@ int cellSurMixerPause(u32 type)
return CELL_OK;
}
int cellSurMixerGetCurrentBlockTag(mem64_t tag)
int cellSurMixerGetCurrentBlockTag(vm::ptr<be_t<u64>> tag)
{
libmixer->Log("cellSurMixerGetCurrentBlockTag(tag_addr=0x%x)", tag.GetAddr());
libmixer->Log("cellSurMixerGetCurrentBlockTag(tag_addr=0x%x)", tag.addr());
tag = mixcount;
*tag = mixcount;
return CELL_OK;
}
int cellSurMixerGetTimestamp(u64 tag, mem64_t stamp)
int cellSurMixerGetTimestamp(u64 tag, vm::ptr<be_t<u64>> stamp)
{
libmixer->Log("cellSurMixerGetTimestamp(tag=0x%llx, stamp_addr=0x%x)", tag, stamp.GetAddr());
libmixer->Log("cellSurMixerGetTimestamp(tag=0x%llx, stamp_addr=0x%x)", tag, stamp.addr());
stamp = m_config.start_time + (tag) * 256000000 / 48000; // ???
*stamp = m_config.start_time + (tag) * 256000000 / 48000; // ???
return CELL_OK;
}

View file

@ -177,7 +177,7 @@ int sceNpDrmExecuteGamePurchase()
return CELL_OK;
}
int sceNpDrmGetTimelimit(u32 drm_path_addr, mem64_t time_remain_usec)
int sceNpDrmGetTimelimit(u32 drm_path_addr, vm::ptr<be_t<u64>> time_remain_usec)
{
UNIMPLEMENTED_FUNC(sceNp);
return CELL_OK;

View file

@ -213,10 +213,10 @@ int sceNpTrophySetSoundLevel()
return CELL_OK;
}
int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, mem64_t reqspace, u64 options)
int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<be_t<u64>> reqspace, u64 options)
{
sceNpTrophy->Warning("sceNpTrophyGetRequiredDiskSpace(context=%d, handle=%d, reqspace_addr=0x%x, options=0x%llx)",
context, handle, reqspace.GetAddr(), options);
context, handle, reqspace.addr(), options);
if (!s_npTrophyInstance.m_bInitialized)
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
@ -228,7 +228,7 @@ int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, mem64_t reqspace, u
if (!ctxt.trp_stream)
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
reqspace = ctxt.trp_stream->GetSize(); // TODO: This is not accurate. It's just an approximation of the real value
*reqspace = ctxt.trp_stream->GetSize(); // TODO: This is not accurate. It's just an approximation of the real value
return CELL_OK;
}

View file

@ -250,20 +250,20 @@ int cellFsAioFinish(vm::ptr<const char> mount_point)
return CELL_OK;
}
int cellFsReadWithOffset(u32 fd, u64 offset, u32 buf_addr, u64 buffer_size, mem64_t nread)
int cellFsReadWithOffset(u32 fd, u64 offset, u32 buf_addr, 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.GetAddr());
fd, offset, buf_addr, buffer_size, nread.addr());
int ret;
vm::var<be_t<u64>> oldPos, newPos;
ret = cellFsLseek(fd, 0, CELL_SEEK_CUR, oldPos.addr()); // Save the current position
ret = cellFsLseek(fd, 0, CELL_SEEK_CUR, oldPos); // Save the current position
if (ret) return ret;
ret = cellFsLseek(fd, offset, CELL_SEEK_SET, newPos.addr()); // Move to the specified offset
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.GetAddr()); // Read the file
ret = cellFsRead(fd, buf_addr, buffer_size, nread); // Read the file
if (ret) return ret;
ret = cellFsLseek(fd, oldPos.value(), CELL_SEEK_SET, newPos.addr()); // Return to the old position
ret = cellFsLseek(fd, oldPos.value(), CELL_SEEK_SET, newPos); // Return to the old position
if (ret) return ret;
return CELL_OK;

View file

@ -115,10 +115,10 @@ s32 cellFsOpen(u32 path_addr, s32 flags, mem32_t fd, mem32_t arg, u64 size)
return CELL_OK;
}
s32 cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread)
s32 cellFsRead(u32 fd, u32 buf_addr, 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.GetAddr());
fd, buf_addr, nbytes, nread.addr());
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -128,15 +128,15 @@ s32 cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread)
const u64 res = nbytes ? file->Read(Memory.GetMemFromAddr(buf_addr), nbytes) : 0;
if (nread.GetAddr()) nread = res; // write value if not NULL
if (nread) *nread = res;
return CELL_OK;
}
s32 cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite)
s32 cellFsWrite(u32 fd, u32 buf_addr, 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.GetAddr());
fd, buf_addr, nbytes, nwrite.addr());
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
@ -146,7 +146,7 @@ s32 cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite)
const u64 res = nbytes ? file->Write(Memory.GetMemFromAddr(buf_addr), nbytes) : 0;
if (nwrite.GetAddr()) nwrite = res; // write value if not NULL
if (nwrite) *nwrite = res;
return CELL_OK;
}
@ -177,9 +177,9 @@ s32 cellFsOpendir(u32 path_addr, mem32_t fd)
return CELL_OK;
}
s32 cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, mem64_t nread)
s32 cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, vm::ptr<be_t<u64>> nread)
{
sys_fs->Log("cellFsReaddir(fd=%d, dir_addr=0x%x, nread_addr=0x%x)", fd, dir.GetAddr(), nread.GetAddr());
sys_fs->Log("cellFsReaddir(fd=%d, dir_addr=0x%x, nread_addr=0x%x)", fd, dir.GetAddr(), nread.addr());
vfsDirBase* directory;
if(!sys_fs->CheckId(fd, directory))
@ -188,14 +188,14 @@ s32 cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, mem64_t nread)
const DirEntryInfo* info = directory->Read();
if(info)
{
nread = 1;
*nread = 1;
Memory.WriteString(dir.GetAddr()+2, info->name);
dir->d_namlen = info->name.length();
dir->d_type = (info->flags & DirEntry_TypeFile) ? CELL_FS_TYPE_REGULAR : CELL_FS_TYPE_DIRECTORY;
}
else
{
nread = 0;
*nread = 0;
}
return CELL_OK;
@ -378,10 +378,10 @@ s32 cellFsUnlink(u32 path_addr)
return CELL_OK;
}
s32 cellFsLseek(u32 fd, s64 offset, u32 whence, mem64_t pos)
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.GetAddr());
sys_fs->Log("cellFsLseek(fd=%d, offset=0x%llx, whence=0x%x, pos_addr=0x%x)", fd, offset, whence, pos.addr());
switch(whence)
{
case CELL_SEEK_SET: seek_mode = vfsSeekSet; break;
@ -397,7 +397,7 @@ s32 cellFsLseek(u32 fd, s64 offset, u32 whence, mem64_t pos)
if (!sys_fs->CheckId(fd, file, type) || type != TYPE_FS_FILE) {
return CELL_ESRCH;
}
pos = file->Seek(offset, seek_mode);
*pos = file->Seek(offset, seek_mode);
return CELL_OK;
}
@ -461,41 +461,43 @@ s32 cellFsTruncate(u32 path_addr, u64 size)
return CELL_OK;
}
s32 cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size)
s32 cellFsFGetBlockSize(u32 fd, vm::ptr<be_t<u64>> sector_size, vm::ptr<be_t<u64>> block_size)
{
sys_fs->Log("cellFsFGetBlockSize(fd=%d, sector_size_addr: 0x%x, block_size_addr: 0x%x)", fd, sector_size.GetAddr(), block_size.GetAddr());
sys_fs->Log("cellFsFGetBlockSize(fd=%d, sector_size_addr: 0x%x, block_size_addr: 0x%x)",
fd, sector_size.addr(), block_size.addr());
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
sector_size = 4096; // ?
block_size = 4096; // ?
*sector_size = 4096; // ?
*block_size = 4096; // ?
return CELL_OK;
}
s32 cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size)
s32 cellFsGetBlockSize(u32 path_addr, vm::ptr<be_t<u64>> sector_size, vm::ptr<be_t<u64>> block_size)
{
sys_fs->Log("cellFsGetBlockSize(file: %s, sector_size_addr: 0x%x, block_size_addr: 0x%x)", Memory.ReadString(path_addr).c_str(), sector_size.GetAddr(), block_size.GetAddr());
sys_fs->Log("cellFsGetBlockSize(file: %s, sector_size_addr: 0x%x, block_size_addr: 0x%x)",
Memory.ReadString(path_addr).c_str(), sector_size.addr(), block_size.addr());
sector_size = 4096; // ?
block_size = 4096; // ?
*sector_size = 4096; // ?
*block_size = 4096; // ?
return CELL_OK;
}
s32 cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count)
s32 cellFsGetFreeSize(u32 path_addr, vm::ptr<be_t<u32>> block_size, vm::ptr<be_t<u64>> block_count)
{
const std::string& ps3_path = Memory.ReadString(path_addr);
sys_fs->Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)",
ps3_path.c_str(), block_size.GetAddr(), block_count.GetAddr());
ps3_path.c_str(), block_size.addr(), block_count.addr());
if (ps3_path.empty())
return CELL_EINVAL;
// TODO: Get real values. Currently, it always returns 40 GB of free space divided in 4 KB blocks
block_size = 4096; // ?
block_count = 10485760; // ?
*block_size = 4096; // ?
*block_count = 10485760; // ?
return CELL_OK;
}
@ -585,26 +587,26 @@ s32 cellFsStReadGetRingBuf(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf)
return CELL_OK;
}
s32 cellFsStReadGetStatus(u32 fd, mem64_t status)
s32 cellFsStReadGetStatus(u32 fd, vm::ptr<be_t<u64>> status)
{
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, status_addr=0x%x)", fd, status.GetAddr());
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, status_addr=0x%x)", fd, status.addr());
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
status = fs_config.m_fs_status;
*status = fs_config.m_fs_status;
return CELL_OK;
}
s32 cellFsStReadGetRegid(u32 fd, mem64_t regid)
s32 cellFsStReadGetRegid(u32 fd, vm::ptr<be_t<u64>> regid)
{
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, regid_addr=0x%x)", fd, regid.GetAddr());
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, regid_addr=0x%x)", fd, regid.addr());
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
regid = fs_config.m_regid;
*regid = fs_config.m_regid;
return CELL_OK;
}
@ -634,22 +636,22 @@ s32 cellFsStReadStop(u32 fd)
return CELL_OK;
}
s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize)
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.GetAddr());
sys_fs->Todo("cellFsStRead(fd=%d, buf_addr=0x%x, size=0x%llx, rsize_addr = 0x%x)", fd, buf_addr, size, rsize.addr());
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
fs_config.m_regid += size;
rsize = fs_config.m_regid;
*rsize = fs_config.m_regid;
return CELL_OK;
}
s32 cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size)
s32 cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, vm::ptr<be_t<u64>> size)
{
sys_fs->Todo("cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr = 0x%x)", fd, addr_addr.GetAddr(), size.GetAddr());
sys_fs->Todo("cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr = 0x%x)", fd, addr_addr.GetAddr(), size.addr());
vfsStream* file;
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;

View file

@ -125,11 +125,11 @@ struct CellFsRingBuffer
// SysCalls
s32 cellFsOpen(u32 path_addr, s32 flags, mem32_t fd, mem32_t arg, u64 size);
s32 cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread);
s32 cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite);
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 cellFsClose(u32 fd);
s32 cellFsOpendir(u32 path_addr, mem32_t fd);
s32 cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, mem64_t nread);
s32 cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, vm::ptr<be_t<u64>> nread);
s32 cellFsClosedir(u32 fd);
s32 cellFsStat(u32 path_addr, mem_ptr_t<CellFsStat> sb);
s32 cellFsFstat(u32 fd, mem_ptr_t<CellFsStat> sb);
@ -139,22 +139,22 @@ s32 cellFsChmod(u32 path_addr, u32 mode);
s32 cellFsFsync(u32 fd);
s32 cellFsRmdir(u32 path_addr);
s32 cellFsUnlink(u32 path_addr);
s32 cellFsLseek(u32 fd, s64 offset, u32 whence, mem64_t pos);
s32 cellFsLseek(u32 fd, s64 offset, u32 whence, vm::ptr<be_t<u64>> pos);
s32 cellFsFtruncate(u32 fd, u64 size);
s32 cellFsTruncate(u32 path_addr, u64 size);
s32 cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size);
s32 cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size);
s32 cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count);
s32 cellFsFGetBlockSize(u32 fd, vm::ptr<be_t<u64>> sector_size, vm::ptr<be_t<u64>> block_size);
s32 cellFsGetBlockSize(u32 path_addr, vm::ptr<be_t<u64>> sector_size, vm::ptr<be_t<u64>> block_size);
s32 cellFsGetFreeSize(u32 path_addr, vm::ptr<be_t<u32>> block_size, vm::ptr<be_t<u64>> block_count);
s32 cellFsGetDirectoryEntries(u32 fd, mem_ptr_t<CellFsDirectoryEntry> entries, u32 entries_size, mem32_t data_count);
s32 cellFsStReadInit(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf);
s32 cellFsStReadFinish(u32 fd);
s32 cellFsStReadGetRingBuf(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf);
s32 cellFsStReadGetStatus(u32 fd, mem64_t status);
s32 cellFsStReadGetRegid(u32 fd, mem64_t regid);
s32 cellFsStReadGetStatus(u32 fd, vm::ptr<be_t<u64>> status);
s32 cellFsStReadGetRegid(u32 fd, vm::ptr<be_t<u64>> regid);
s32 cellFsStReadStart(u32 fd, u64 offset, u64 size);
s32 cellFsStReadStop(u32 fd);
s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize);
s32 cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size);
s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, vm::ptr<be_t<u64>> rsize);
s32 cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, vm::ptr<be_t<u64>> size);
s32 cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size);
s32 cellFsStReadWait(u32 fd, u64 size);
s32 cellFsStReadWaitCallback(u32 fd, u64 size, mem_func_ptr_t<void (*)(int xfd, u64 xsize)> func);

View file

@ -88,12 +88,12 @@ s32 sys_event_flag_destroy(u32 eflag_id)
return CELL_OK;
}
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 timeout)
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<be_t<u64>> result, u64 timeout)
{
sys_event_flag.Log("sys_event_flag_wait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x, timeout=%lld)",
eflag_id, bitptn, mode, result.GetAddr(), timeout);
eflag_id, bitptn, mode, result.addr(), timeout);
if (result.GetAddr()) result = 0;
if (result) *result = 0;
switch (mode & 0xf)
{
@ -142,7 +142,7 @@ s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64
ef->flags = 0;
}
if (result.GetAddr()) result = flags;
if (result) *result = flags;
return CELL_OK;
}
@ -185,7 +185,7 @@ s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64
ef->signal.unlock(tid);
}
if (result.GetAddr()) result = flags;
if (result) *result = flags;
return CELL_OK;
}
@ -220,12 +220,12 @@ s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64
}
}
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result)
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<be_t<u64>> result)
{
sys_event_flag.Log("sys_event_flag_trywait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x)",
eflag_id, bitptn, mode, result.GetAddr());
eflag_id, bitptn, mode, result.addr());
if (result.GetAddr()) result = 0;
if (result) *result = 0;
switch (mode & 0xf)
{
@ -261,7 +261,7 @@ s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result)
ef->flags = 0;
}
if (result.GetAddr()) result = flags;
if (result) *result = flags;
return CELL_OK;
}
@ -342,15 +342,15 @@ s32 sys_event_flag_cancel(u32 eflag_id, mem32_t num)
return CELL_OK;
}
s32 sys_event_flag_get(u32 eflag_id, mem64_t flags)
s32 sys_event_flag_get(u32 eflag_id, vm::ptr<be_t<u64>> flags)
{
sys_event_flag.Log("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.GetAddr());
sys_event_flag.Log("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.addr());
EventFlag* ef;
if (!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
SMutexLocker lock(ef->m_mutex);
flags = ef->flags;
*flags = ef->flags;
return CELL_OK;
}

View file

@ -52,9 +52,9 @@ struct EventFlag
s32 sys_event_flag_create(mem32_t eflag_id, mem_ptr_t<sys_event_flag_attr> attr, u64 init);
s32 sys_event_flag_destroy(u32 eflag_id);
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 timeout);
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result);
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<be_t<u64>> result, u64 timeout);
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, vm::ptr<be_t<u64>> result);
s32 sys_event_flag_set(u32 eflag_id, u64 bitptn);
s32 sys_event_flag_clear(u32 eflag_id, u64 bitptn);
s32 sys_event_flag_cancel(u32 eflag_id, mem32_t num);
s32 sys_event_flag_get(u32 eflag_id, mem64_t flags);
s32 sys_event_flag_get(u32 eflag_id, vm::ptr<be_t<u64>> flags);

View file

@ -48,9 +48,9 @@ s32 sys_ppu_thread_yield()
return CELL_OK;
}
s32 sys_ppu_thread_join(u64 thread_id, mem64_t vptr)
s32 sys_ppu_thread_join(u64 thread_id, vm::ptr<be_t<u64>> vptr)
{
sys_ppu_thread.Warning("sys_ppu_thread_join(thread_id=%lld, vptr_addr=0x%x)", thread_id, vptr.GetAddr());
sys_ppu_thread.Warning("sys_ppu_thread_join(thread_id=%lld, vptr_addr=0x%x)", thread_id, vptr.addr());
CPUThread* thr = Emu.GetCPU().GetThread(thread_id);
if(!thr) return CELL_ESRCH;
@ -65,7 +65,7 @@ s32 sys_ppu_thread_join(u64 thread_id, mem64_t vptr)
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
vptr = thr->GetExitStatus();
*vptr = thr->GetExitStatus();
return CELL_OK;
}
@ -150,13 +150,13 @@ s32 sys_ppu_thread_restart(u64 thread_id)
return CELL_OK;
}
s32 sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, u32 threadname_addr)
s32 sys_ppu_thread_create(vm::ptr<be_t<u64>> thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, u32 threadname_addr)
{
std::string threadname = "";
if (threadname_addr) threadname = Memory.ReadString(threadname_addr);
sys_ppu_thread.Log("sys_ppu_thread_create(thread_id_addr=0x%x, entry=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x('%s'))",
thread_id.GetAddr(), entry, arg, prio, stacksize, flags, threadname_addr, threadname.c_str());
thread_id.addr(), entry, arg, prio, stacksize, flags, threadname_addr, threadname.c_str());
bool is_joinable = false;
bool is_interrupt = false;
@ -179,7 +179,7 @@ s32 sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, s32 prio, u32 s
CPUThread& new_thread = Emu.GetCPU().AddThread(CPU_THREAD_PPU);
thread_id = new_thread.GetId();
*thread_id = new_thread.GetId();
new_thread.SetEntry(entry);
new_thread.SetArg(0, arg);
new_thread.SetPrio(prio);
@ -211,11 +211,11 @@ void sys_ppu_thread_once(mem_ptr_t<std::atomic<be_t<u32>>> once_ctrl, u32 entry)
}
}
s32 sys_ppu_thread_get_id(mem64_t thread_id)
s32 sys_ppu_thread_get_id(vm::ptr<be_t<u64>> thread_id)
{
sys_ppu_thread.Log("sys_ppu_thread_get_id(thread_id_addr=0x%x)", thread_id.GetAddr());
sys_ppu_thread.Log("sys_ppu_thread_get_id(thread_id_addr=0x%x)", thread_id.addr());
thread_id = GetCurrentPPUThread().GetId();
*thread_id = GetCurrentPPUThread().GetId();
return CELL_OK;
}

View file

@ -16,7 +16,7 @@ enum ppu_thread_flags : u64
void sys_ppu_thread_exit(u64 errorcode);
void sys_internal_ppu_thread_exit(u64 errorcode);
s32 sys_ppu_thread_yield();
s32 sys_ppu_thread_join(u64 thread_id, mem64_t vptr);
s32 sys_ppu_thread_join(u64 thread_id, vm::ptr<be_t<u64>> vptr);
s32 sys_ppu_thread_detach(u64 thread_id);
void sys_ppu_thread_get_join_state(u32 isjoinable_addr);
s32 sys_ppu_thread_set_priority(u64 thread_id, s32 prio);
@ -24,7 +24,7 @@ s32 sys_ppu_thread_get_priority(u64 thread_id, u32 prio_addr);
s32 sys_ppu_thread_get_stack_information(u32 info_addr);
s32 sys_ppu_thread_stop(u64 thread_id);
s32 sys_ppu_thread_restart(u64 thread_id);
s32 sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, u32 threadname_addr);
s32 sys_ppu_thread_create(vm::ptr<be_t<u64>> thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, u32 threadname_addr);
void sys_ppu_thread_once(mem_ptr_t<std::atomic<be_t<u32>>> once_ctrl, u32 entry);
s32 sys_ppu_thread_get_id(mem64_t thread_id);
s32 sys_ppu_thread_get_id(vm::ptr<be_t<u64>> thread_id);
s32 sys_ppu_thread_rename(u64 thread_id, u32 name_addr);

View file

@ -527,10 +527,10 @@ s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
}
//182
s32 sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
s32 sys_spu_thread_read_ls(u32 id, u32 address, vm::ptr<be_t<u64>> value, u32 type)
{
sys_spu.Log("sys_spu_thread_read_ls(id=%d, address=0x%x, value_addr=0x%x, type=0x%x)",
id, address, value.GetAddr(), type);
id, address, value.addr(), type);
CPUThread* thr = Emu.GetCPU().GetThread(id);
@ -551,10 +551,10 @@ s32 sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
switch (type)
{
case 1: value = (*(SPUThread*)thr).ReadLS8(address); return CELL_OK;
case 2: value = (*(SPUThread*)thr).ReadLS16(address); return CELL_OK;
case 4: value = (*(SPUThread*)thr).ReadLS32(address); return CELL_OK;
case 8: value = (*(SPUThread*)thr).ReadLS64(address); return CELL_OK;
case 1: *value = (*(SPUThread*)thr).ReadLS8(address); return CELL_OK;
case 2: *value = (*(SPUThread*)thr).ReadLS16(address); return CELL_OK;
case 4: *value = (*(SPUThread*)thr).ReadLS32(address); return CELL_OK;
case 8: *value = (*(SPUThread*)thr).ReadLS64(address); return CELL_OK;
default: return CELL_EINVAL;
}
}
@ -599,9 +599,9 @@ s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value)
}
//188
s32 sys_spu_thread_get_spu_cfg(u32 id, mem64_t value)
s32 sys_spu_thread_get_spu_cfg(u32 id, vm::ptr<be_t<u64>> value)
{
sys_spu.Warning("sys_spu_thread_get_spu_cfg(id=%d, value_addr=0x%x)", id, value.GetAddr());
sys_spu.Warning("sys_spu_thread_get_spu_cfg(id=%d, value_addr=0x%x)", id, value.addr());
CPUThread* thr = Emu.GetCPU().GetThread(id);
@ -610,7 +610,7 @@ s32 sys_spu_thread_get_spu_cfg(u32 id, mem64_t value)
return CELL_ESRCH;
}
value = (*(SPUThread*)thr).cfg.value;
*value = (*(SPUThread*)thr).cfg.value;
return CELL_OK;
}
@ -957,9 +957,9 @@ s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask)
return CELL_OK;
}
s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, mem64_t mask)
s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ptr<be_t<u64>> mask)
{
sys_spu.Log("sys_raw_spu_get_int_mask(id=%d, class_id=%d, mask_addr=0x%x)", id, class_id, mask.GetAddr());
sys_spu.Log("sys_raw_spu_get_int_mask(id=%d, class_id=%d, mask_addr=0x%x)", id, class_id, mask.addr());
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
if (!t)
@ -972,7 +972,7 @@ s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, mem64_t mask)
return CELL_EINVAL;
}
mask = t->m_intrtag[class_id].mask;
*mask = t->m_intrtag[class_id].mask;
return CELL_OK;
}
@ -995,9 +995,9 @@ s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat)
return CELL_OK;
}
s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, mem64_t stat)
s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr<be_t<u64>> stat)
{
sys_spu.Log("sys_raw_spu_get_int_stat(id=%d, class_id=%d, stat_addr=0xx)", id, class_id, stat.GetAddr());
sys_spu.Log("sys_raw_spu_get_int_stat(id=%d, class_id=%d, stat_addr=0xx)", id, class_id, stat.addr());
RawSPUThread* t = Emu.GetCPU().GetRawSPUThread(id);
if (!t)
@ -1010,7 +1010,7 @@ s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, mem64_t stat)
return CELL_EINVAL;
}
stat = t->m_intrtag[class_id].stat;
*stat = t->m_intrtag[class_id].stat;
return CELL_OK;
}

View file

@ -127,10 +127,10 @@ s32 sys_spu_thread_group_disconnect_event(u32 id, u32 et);
s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq_id, u64 req, vm::ptr<u8> spup);
s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup);
s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type);
s32 sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type);
s32 sys_spu_thread_read_ls(u32 id, u32 address, vm::ptr<be_t<u64>> value, u32 type);
s32 sys_spu_thread_write_spu_mb(u32 id, u32 value);
s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value);
s32 sys_spu_thread_get_spu_cfg(u32 id, mem64_t value);
s32 sys_spu_thread_get_spu_cfg(u32 id, vm::ptr<be_t<u64>> value);
s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value);
s32 sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup);
s32 sys_spu_thread_disconnect_event(u32 id, u32 event_type, u8 spup);
@ -142,9 +142,9 @@ s32 sys_raw_spu_create(mem32_t id, u32 attr_addr);
s32 sys_raw_spu_destroy(u32 id);
s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t intrtag);
s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask);
s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, mem64_t mask);
s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, vm::ptr<be_t<u64>> mask);
s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat);
s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, mem64_t stat);
s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, vm::ptr<be_t<u64>> stat);
s32 sys_raw_spu_read_puint_mb(u32 id, mem32_t value);
s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value);
s32 sys_raw_spu_get_spu_cfg(u32 id, mem32_t value);