1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

Merge pull request #960 from Nekotekina/master

PKG installer fixed
This commit is contained in:
Hykem 2015-01-13 18:08:41 +00:00
commit 8df825abc5
38 changed files with 264 additions and 183 deletions

View File

@ -551,12 +551,12 @@ private:
}
};
public:
const stype& ToBE() const
{
return m_data;
}
public:
type ToLE() const
{
return se_t<type, sizeof(T2)>::from_be(m_data);
@ -605,11 +605,7 @@ public:
const stype& data() const
{
#ifdef IS_LE_MACHINE
return ToBE();
#else
return ToLE();
#endif
}
be_t& operator = (const be_t& value) = default;

View File

@ -131,13 +131,19 @@ inline void log_message(Log::LogType type, Log::LogSeverity sev, const char* tex
//another msvc bug makes this not work, uncomment this and delete everything else in this function when it's fixed
//Log::LogManager::getInstance().log({logType, severity, text})
Log::LogMessage msg{type, sev, text};
Log::LogMessage msg{ type, sev, text };
Log::LogManager::getInstance().log(msg);
}
inline void log_message(Log::LogType type, Log::LogSeverity sev, const std::string& text)
{
Log::LogMessage msg{ type, sev, text };
Log::LogManager::getInstance().log(msg);
}
template<typename T, typename... Ts>
inline void log_message(Log::LogType type, Log::LogSeverity sev, const char* text, T arg, Ts... args)
{
Log::LogMessage msg{type, sev, fmt::format(text, arg, args...)};
Log::LogMessage msg{ type, sev, fmt::format(text, arg, args...) };
Log::LogManager::getInstance().log(msg);
}

View File

@ -300,7 +300,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (u8)";
throw "Invalid formatting (u8): " + std::string(fmt, len);
}
return{};
@ -322,7 +322,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (u16)";
throw "Invalid formatting (u16): " + std::string(fmt, len);
}
return{};
@ -344,7 +344,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (u32)";
throw "Invalid formatting (u32): " + std::string(fmt, len);
}
return{};
@ -366,7 +366,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (u64)";
throw "Invalid formatting (u64): " + std::string(fmt, len);
}
return{};
@ -388,7 +388,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (s8)";
throw "Invalid formatting (s8): " + std::string(fmt, len);
}
return{};
@ -410,7 +410,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (s16)";
throw "Invalid formatting (s16): " + std::string(fmt, len);
}
return{};
@ -432,7 +432,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (s32)";
throw "Invalid formatting (s32): " + std::string(fmt, len);
}
return{};
@ -454,7 +454,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (s64)";
throw "Invalid formatting (s64): " + std::string(fmt, len);
}
return{};
@ -476,7 +476,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (float)";
throw "Invalid formatting (float): " + std::string(fmt, len);
}
return{};
@ -498,7 +498,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (double)";
throw "Invalid formatting (double): " + std::string(fmt, len);
}
return{};
@ -524,7 +524,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (bool)";
throw "Invalid formatting (bool): " + std::string(fmt, len);
}
return{};
@ -542,7 +542,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (char*)";
throw "Invalid formatting (char*): " + std::string(fmt, len);
}
return{};
@ -560,7 +560,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (const char*)";
throw "Invalid formatting (const char*): " + std::string(fmt, len);
}
return{};
@ -578,7 +578,7 @@ namespace fmt
// }
// else
// {
// throw "Invalid formatting (char[size])";
// throw "Invalid formatting (char[size]): " + std::string(fmt, len);
// }
// return{};
@ -596,7 +596,7 @@ namespace fmt
// }
// else
// {
// throw "Invalid formatting (const char[size])";
// throw "Invalid formatting (const char[size]): " + std::string(fmt, len);
// }
// return{};
@ -614,7 +614,7 @@ namespace fmt
}
else
{
throw "Invalid formatting (std::string)";
throw "Invalid formatting (std::string): " + std::string(fmt, len);
}
return{};
@ -654,6 +654,11 @@ namespace fmt
char*, const char*, std::string (%s)
be_t<> of any appropriate type in this list
enum of any appropriate type in this list
External specializations (can be found in another headers):
vm::ps3::ptr (vm_ptr.h) (of appropriate address type, writing .addr() for printing can be avoided)
vm::ps3::bptr (vm_ptr.h)
vm::psv::ptr (vm_ptr.h)
Supported formatting:
%d - decimal; only basic std::to_string() functionality

View File

@ -164,12 +164,12 @@ bool UnpackEntry(rFile& dec_pkg_f, const PKGEntry& entry, std::string dir)
dec_pkg_f.Read(buf, entry.name_size);
buf[entry.name_size] = 0;
switch (entry.type.data())
switch (entry.type.data() >> 24)
{
case se32(PKG_FILE_ENTRY_NPDRM):
case se32(PKG_FILE_ENTRY_NPDRMEDAT):
case se32(PKG_FILE_ENTRY_SDAT):
case se32(PKG_FILE_ENTRY_REGULAR):
case PKG_FILE_ENTRY_NPDRM:
case PKG_FILE_ENTRY_NPDRMEDAT:
case PKG_FILE_ENTRY_SDAT:
case PKG_FILE_ENTRY_REGULAR:
{
rFile out;
auto path = dir + std::string(buf, entry.name_size);
@ -199,7 +199,7 @@ bool UnpackEntry(rFile& dec_pkg_f, const PKGEntry& entry, std::string dir)
}
}
case se32(PKG_FILE_ENTRY_FOLDER):
case PKG_FILE_ENTRY_FOLDER:
{
auto path = dir + std::string(buf, entry.name_size);
if (!rExists(path) && !rMkdir(path))

View File

@ -95,8 +95,8 @@ s32 sceKernelCreateThread(
s32 cpuAffinityMask,
vm::psv::ptr<const SceKernelThreadOptParam> pOptParam)
{
sceLibKernel.Error("sceKernelCreateThread(pName_addr=0x%x ('%s'), entry_addr=0x%x, initPriority=%d, stackSize=0x%x, attr=0x%x, cpuAffinityMask=0x%x, pOptParam_addr=0x%x)",
pName.addr(), pName.get_ptr(), entry.addr(), initPriority, stackSize, attr, cpuAffinityMask, pOptParam.addr());
sceLibKernel.Error("sceKernelCreateThread(pName=0x%x ('%s'), entry=0x%x, initPriority=%d, stackSize=0x%x, attr=0x%x, cpuAffinityMask=0x%x, pOptParam=0x%x)",
pName, pName.get_ptr(), entry, initPriority, stackSize, attr, cpuAffinityMask, pOptParam);
std::string name = pName.get_ptr();
@ -119,7 +119,7 @@ s32 sceKernelCreateThread(
s32 sceKernelStartThread(s32 threadId, u32 argSize, vm::psv::ptr<const void> pArgBlock)
{
sceLibKernel.Error("sceKernelStartThread(threadId=%d, argSize=%d, pArgBlock_addr=0x%x)", threadId, argSize, pArgBlock.addr());
sceLibKernel.Error("sceKernelStartThread(threadId=%d, argSize=%d, pArgBlock=0x%x)", threadId, argSize, pArgBlock);
std::shared_ptr<CPUThread> t = Emu.GetCPU().GetThread(threadId);
@ -208,7 +208,7 @@ s32 sceKernelChangeCurrentThreadAttr(u32 clearAttr, u32 setAttr)
s32 sceKernelGetThreadExitStatus(s32 threadId, vm::psv::ptr<s32> pExitStatus)
{
sceLibKernel.Todo("sceKernelGetThreadExitStatus(threadId=%d, pExitStatus_addr=0x%x)", threadId, pExitStatus.addr());
sceLibKernel.Todo("sceKernelGetThreadExitStatus(threadId=%d, pExitStatus=0x%x)", threadId, pExitStatus);
return SCE_OK;
}
@ -229,21 +229,21 @@ s32 sceKernelCheckWaitableStatus()
s32 sceKernelGetThreadInfo(s32 threadId, vm::psv::ptr<SceKernelThreadInfo> pInfo)
{
sceLibKernel.Todo("sceKernelGetThreadInfo(threadId=%d, pInfo_addr=0x%x)", threadId, pInfo.addr());
sceLibKernel.Todo("sceKernelGetThreadInfo(threadId=%d, pInfo=0x%x)", threadId, pInfo);
return SCE_OK;
}
s32 sceKernelGetThreadRunStatus(vm::psv::ptr<SceKernelThreadRunStatus> pStatus)
{
sceLibKernel.Todo("sceKernelGetThreadRunStatus(pStatus_addr=0x%x)", pStatus.addr());
sceLibKernel.Todo("sceKernelGetThreadRunStatus(pStatus=0x%x)", pStatus);
return SCE_OK;
}
s32 sceKernelGetSystemInfo(vm::psv::ptr<SceKernelSystemInfo> pInfo)
{
sceLibKernel.Todo("sceKernelGetSystemInfo(pInfo_addr=0x%x)", pInfo.addr());
sceLibKernel.Todo("sceKernelGetSystemInfo(pInfo=0x%x)", pInfo);
return SCE_OK;
}
@ -285,14 +285,14 @@ s32 sceKernelDelayThreadCB(u32 usec)
s32 sceKernelWaitThreadEnd(s32 threadId, vm::psv::ptr<s32> pExitStatus, vm::psv::ptr<u32> pTimeout)
{
sceLibKernel.Todo("sceKernelWaitThreadEnd(threadId=%d, pExitStatus_addr=0x%x, pTimeout_addr=0x%x)", threadId, pExitStatus.addr(), pTimeout.addr());
sceLibKernel.Todo("sceKernelWaitThreadEnd(threadId=%d, pExitStatus=0x%x, pTimeout=0x%x)", threadId, pExitStatus, pTimeout);
return SCE_OK;
}
s32 sceKernelWaitThreadEndCB(s32 threadId, vm::psv::ptr<s32> pExitStatus, vm::psv::ptr<u32> pTimeout)
{
sceLibKernel.Todo("sceKernelWaitThreadEndCB(threadId=%d, pExitStatus_addr=0x%x, pTimeout_addr=0x%x)", threadId, pExitStatus.addr(), pTimeout.addr());
sceLibKernel.Todo("sceKernelWaitThreadEndCB(threadId=%d, pExitStatus=0x%x, pTimeout=0x%x)", threadId, pExitStatus, pTimeout);
return SCE_OK;
}

View File

@ -28,7 +28,7 @@ namespace sce_libc_func
void printf(vm::psv::ptr<const char> fmt)
{
sceLibc.Error("printf(fmt_addr=0x%x)", fmt.addr());
sceLibc.Error("printf(fmt=0x%x)", fmt);
LOG_NOTICE(TTY, "%s", fmt.get_ptr());
}
@ -40,14 +40,14 @@ namespace sce_libc_func
void memcpy(vm::psv::ptr<void> dst, vm::psv::ptr<const void> src, u32 size)
{
sceLibc.Error("memcpy(dst_addr=0x%x, src_addr=0x%x, size=0x%x)", dst.addr(), src.addr(), size);
sceLibc.Error("memcpy(dst=0x%x, src=0x%x, size=0x%x)", dst, src, size);
::memcpy(dst.get_ptr(), src.get_ptr(), size);
}
void _Assert(vm::psv::ptr<const char> text, vm::psv::ptr<const char> func)
{
sceLibc.Error("_Assert(text_addr=0x%x, func_addr=0x%x)", text.addr(), func.addr());
sceLibc.Error("_Assert(text=0x%x, func=0x%x)", text, func);
LOG_ERROR(TTY, "%s : %s", func.get_ptr(), text.get_ptr());
Emu.Pause();

View File

@ -292,8 +292,8 @@ void SPUThread::ProcessCmd(u32 cmd, u32 tag, u32 lsa, u64 ea, u32 size)
void SPUThread::ListCmd(u32 lsa, u64 ea, u16 tag, u16 size, u32 cmd, MFCReg& MFCArgs)
{
u32 list_addr = ea & 0x3ffff;
u32 list_size = size / 8;
const u32 list_addr = ea & 0x3ffff;
const u32 list_size = size / 8;
lsa &= 0x3fff0;
struct list_element
@ -309,27 +309,31 @@ void SPUThread::ListCmd(u32 lsa, u64 ea, u16 tag, u16 size, u32 cmd, MFCReg& MFC
{
auto rec = vm::ptr<list_element>::make(ls_offset + list_addr + i * 8);
u32 size = rec->ts;
if (!(rec->s.ToBE() & se16(0x8000)) && size < 16 && size != 1 && size != 2 && size != 4 && size != 8)
const u32 size = rec->ts;
if (!(rec->s.data() & se16(0x8000)) && size < 16 && size != 1 && size != 2 && size != 4 && size != 8)
{
LOG_ERROR(Log::SPU, "DMA List: invalid transfer size(%d)", size);
result = MFC_PPU_DMA_CMD_SEQUENCE_ERROR;
break;
}
u32 addr = rec->ea;
const u32 addr = rec->ea;
if (size)
{
ProcessCmd(cmd, tag, lsa | (addr & 0xf), addr, size);
}
if (Ini.HLELogging.GetValue() || rec->s.ToBE())
LOG_NOTICE(Log::SPU, "*** list element(%d/%d): s = 0x%x, ts = 0x%x, low ea = 0x%x (lsa = 0x%x)",
i, list_size, (u16)rec->s, (u16)rec->ts, (u32)rec->ea, lsa | (addr & 0xf));
if (Ini.HLELogging.GetValue() || rec->s.data())
{
LOG_NOTICE(Log::SPU, "*** list element(%d/%d): s = 0x%x, ts = 0x%x, low ea = 0x%x (lsa = 0x%x)", i, list_size, rec->s, rec->ts, rec->ea, lsa | (addr & 0xf));
}
if (size)
lsa += std::max(size, (u32)16);
{
lsa += std::max<u32>(size, 16);
}
if (rec->s.ToBE() & se16(0x8000))
if (rec->s.data() & se16(0x8000))
{
StallStat.PushUncond_OR(1 << tag);
@ -339,12 +343,12 @@ void SPUThread::ListCmd(u32 lsa, u64 ea, u16 tag, u16 size, u32 cmd, MFCReg& MFC
result = MFC_PPU_DMA_CMD_SEQUENCE_ERROR;
break;
}
StallList[tag].MFCArgs = &MFCArgs;
StallList[tag].cmd = cmd;
StallList[tag].ea = (ea & ~0xffffffff) | (list_addr + (i + 1) * 8);
StallList[tag].lsa = lsa;
StallList[tag].size = (list_size - i - 1) * 8;
break;
}
}

View File

@ -494,4 +494,38 @@ namespace vm
//PS3 emulation is main now, so lets it be as default
using namespace ps3;
}
}
namespace fmt
{
// external specializations for fmt::format function
namespace detail
{
template<typename T, int lvl, typename AT>
struct get_fmt<vm::ps3::ptr<T, lvl, AT>, false>
{
__forceinline static std::string text(const char* fmt, size_t len, const vm::ps3::ptr<T, lvl, AT>& arg)
{
return get_fmt<AT>::text(fmt, len, arg.addr());
}
};
template<typename T, int lvl, typename AT>
struct get_fmt<vm::ps3::bptr<T, lvl, AT>, false>
{
__forceinline static std::string text(const char* fmt, size_t len, const vm::ps3::bptr<T, lvl, AT>& arg)
{
return get_fmt<AT>::text(fmt, len, arg.addr());
}
};
template<typename T, int lvl, typename AT>
struct get_fmt<vm::psv::ptr<T, lvl, AT>, false>
{
__forceinline static std::string text(const char* fmt, size_t len, const vm::psv::ptr<T, lvl, AT>& arg)
{
return get_fmt<AT>::text(fmt, len, arg.addr());
}
};
}
}

View File

@ -108,4 +108,38 @@ namespace vm
//PS3 emulation is main now, so lets it be as default
using namespace ps3;
}
}
namespace fmt
{
// external specializations for fmt::format function
namespace detail
{
template<typename T, typename AT>
struct get_fmt<vm::ps3::ref<T, AT>, false>
{
__forceinline static std::string text(const char* fmt, size_t len, const vm::ps3::ref<T, AT>& arg)
{
return get_fmt<AT>::text(fmt, len, arg.addr());
}
};
template<typename T, typename AT>
struct get_fmt<vm::ps3::bref<T, AT>, false>
{
__forceinline static std::string text(const char* fmt, size_t len, const vm::ps3::bref<T, AT>& arg)
{
return get_fmt<AT>::text(fmt, len, arg.addr());
}
};
template<typename T, typename AT>
struct get_fmt<vm::psv::ref<T, AT>, false>
{
__forceinline static std::string text(const char* fmt, size_t len, const vm::psv::ref<T, AT>& arg)
{
return get_fmt<AT>::text(fmt, len, arg.addr());
}
};
}
}

View File

@ -48,7 +48,7 @@ std::string GLVertexDecompilerThread::GetDST(bool isSca)
default:
if (d3.dst > 15)
LOG_ERROR(RSX, "dst index out of range: %u", d3.dst);
LOG_ERROR(RSX, fmt::Format("dst index out of range: %u", d3.dst));
ret += m_parr.AddParam(PARAM_NONE, "vec4", std::string("dst_reg") + std::to_string(d3.dst), d3.dst == 0 ? "vec4(0.0f, 0.0f, 0.0f, 1.0f)" : "vec4(0.0)");
break;
}
@ -92,7 +92,7 @@ std::string GLVertexDecompilerThread::GetSRC(const u32 n)
break;
default:
LOG_ERROR(RSX, "Bad src%u reg type: %d", n, fmt::by_value(src[n].reg_type));
LOG_ERROR(RSX, fmt::Format("Bad src%u reg type: %d", n, fmt::by_value(src[n].reg_type)));
Emu.Pause();
break;
}

View File

@ -177,7 +177,7 @@ u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count, cons
debug += "(";
for (u32 i = 0; i < count; ++i) debug += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i));
debug += ")";
LOG_NOTICE(RSX, "OutOfArgsCount(x=%u, count=%u): %s", x, count, debug.c_str());
LOG_NOTICE(RSX, "OutOfArgsCount(x=%d, count=%d): %s", x, count, debug.c_str());
return 0;
}

View File

@ -60,22 +60,22 @@ void hle::error::print(const char* func)
{
if (func)
{
base->Error("%s(): %s (0x%X)", func, text.c_str(), code);
base->Error("%s(): %s (0x%x)", func, text.c_str(), code);
}
else
{
base->Error("%s (0x%X)", text.c_str(), code);
base->Error("%s (0x%x)", text.c_str(), code);
}
}
else
{
if (func)
{
LOG_ERROR(HLE, "%s(): %s (0x%X)", func, text.c_str(), code);
LOG_ERROR(HLE, "%s(): %s (0x%x)", func, text.c_str(), code);
}
else
{
LOG_ERROR(HLE, "%s (0x%X)", text.c_str(), code);
LOG_ERROR(HLE, "%s (0x%x)", text.c_str(), code);
}
}
}

View File

@ -30,7 +30,7 @@ int cellGifDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellGifDecSrc
current_subHandle->fd = 0;
current_subHandle->src = *src;
switch(src->srcSelect.ToBE())
switch(src->srcSelect.data())
{
case se32(CELL_GIFDEC_BUFFER):
current_subHandle->fileSize = src->streamSize.ToLE();
@ -74,7 +74,7 @@ int cellGifDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellGifDecInfo>
vm::var<u8[13]> buffer; // Alloc buffer for GIF header
vm::var<be_t<u64>> pos, nread;
switch(subHandle_data->src.srcSelect.ToBE())
switch(subHandle_data->src.srcSelect.data())
{
case se32(CELL_GIFDEC_BUFFER):
memmove(buffer.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), buffer.size());
@ -156,7 +156,7 @@ int cellGifDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::pt
vm::var<unsigned char[]> gif((u32)fileSize);
vm::var<be_t<u64>> pos, nread;
switch(subHandle_data->src.srcSelect.ToBE())
switch(subHandle_data->src.srcSelect.data())
{
case se32(CELL_GIFDEC_BUFFER):
memmove(gif.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), gif.size());

View File

@ -36,7 +36,7 @@ int cellJpgDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellJpgDecSrc
current_subHandle->fd = 0;
current_subHandle->src = *src;
switch(src->srcSelect.ToBE())
switch(src->srcSelect.data())
{
case se32(CELL_JPGDEC_BUFFER):
current_subHandle->fileSize = src->streamSize.ToLE();
@ -94,7 +94,7 @@ int cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellJpgDecInfo>
vm::var<u8[]> buffer((u32)fileSize);
vm::var<be_t<u64>> pos, nread;
switch(subHandle_data->src.srcSelect.ToBE())
switch(subHandle_data->src.srcSelect.data())
{
case se32(CELL_JPGDEC_BUFFER):
memmove(buffer.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), buffer.size());
@ -163,7 +163,7 @@ int cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::pt
vm::var<unsigned char[]> jpg((u32)fileSize);
vm::var<be_t<u64>> pos, nread;
switch(subHandle_data->src.srcSelect.ToBE())
switch(subHandle_data->src.srcSelect.data())
{
case se32(CELL_JPGDEC_BUFFER):
memmove(jpg.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), jpg.size());

View File

@ -386,7 +386,7 @@ int cellPadInfoSensorMode(u32 port_no)
int cellPadSetPressMode(u32 port_no, u32 mode)
{
sys_io->Log("cellPadSetPressMode(port_no=%u, mode=%u)", port_no, mode);
sys_io->Log("cellPadSetPressMode(port_no=%d, mode=%d)", port_no, mode);
if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
@ -405,7 +405,7 @@ int cellPadSetPressMode(u32 port_no, u32 mode)
int cellPadSetSensorMode(u32 port_no, u32 mode)
{
sys_io->Log("cellPadSetSensorMode(port_no=%u, mode=%u)", port_no, mode);
sys_io->Log("cellPadSetSensorMode(port_no=%d, mode=%d)", port_no, mode);
if (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo();

View File

@ -77,7 +77,7 @@ s64 pngDecOpen(
stream->fd = 0;
stream->src = *src;
switch (src->srcSelect.ToBE())
switch (src->srcSelect.data())
{
case se32(CELL_PNGDEC_BUFFER):
stream->fileSize = src->streamSize.ToLE();
@ -145,7 +145,7 @@ s64 pngReadHeader(
auto buffer_32 = buffer.To<be_t<u32>>();
vm::var<be_t<u64>> pos, nread;
switch (stream->src.srcSelect.ToBE())
switch (stream->src.srcSelect.data())
{
case se32(CELL_PNGDEC_BUFFER):
memmove(buffer.begin(), stream->src.streamPtr.get_ptr(), buffer.size());
@ -156,9 +156,9 @@ s64 pngReadHeader(
break;
}
if (buffer_32[0].ToBE() != se32(0x89504E47) ||
buffer_32[1].ToBE() != se32(0x0D0A1A0A) || // Error: The first 8 bytes are not a valid PNG signature
buffer_32[3].ToBE() != se32(0x49484452)) // Error: The PNG file does not start with an IHDR chunk
if (buffer_32[0].data() != se32(0x89504E47) ||
buffer_32[1].data() != se32(0x0D0A1A0A) || // Error: The first 8 bytes are not a valid PNG signature
buffer_32[3].data() != se32(0x49484452)) // Error: The PNG file does not start with an IHDR chunk
{
return CELL_PNGDEC_ERROR_HEADER;
}
@ -206,7 +206,7 @@ s64 pngDecSetParameter(
current_outParam.outputHeight = current_info.imageHeight;
current_outParam.outputColorSpace = inParam->outputColorSpace;
switch (current_outParam.outputColorSpace.ToBE())
switch (current_outParam.outputColorSpace.data())
{
case se32(CELL_PNGDEC_PALETTE):
case se32(CELL_PNGDEC_GRAYSCALE):
@ -254,7 +254,7 @@ s64 pngDecodeData(
vm::var<unsigned char[]> png((u32)fileSize);
vm::var<be_t<u64>> pos, nread;
switch (stream->src.srcSelect.ToBE())
switch (stream->src.srcSelect.data())
{
case se32(CELL_PNGDEC_BUFFER):
memmove(png.begin(), stream->src.streamPtr.get_ptr(), png.size());
@ -283,7 +283,7 @@ s64 pngDecodeData(
const int bytesPerLine = (u32)dataCtrlParam->outputBytesPerLine;
uint image_size = width * height;
switch (current_outParam.outputColorSpace.ToBE())
switch (current_outParam.outputColorSpace.data())
{
case se32(CELL_PNGDEC_RGB):
case se32(CELL_PNGDEC_RGBA):

View File

@ -81,7 +81,7 @@ int cellRtcFormatRfc2822(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc, s
date.Add(tz);
// Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000).
const std::string& str = date.Format("%a, %d %b %Y %T %z", rDateTime::TZ::UTC);
const std::string str = date.Format("%a, %d %b %Y %T %z", rDateTime::TZ::UTC);
memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1);
return CELL_OK;
@ -95,7 +95,7 @@ int cellRtcFormatRfc2822LocalTime(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick
rDateTime date = rDateTime((time_t)pUtc->tick);
// Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000).
const std::string& str = date.Format("%a, %d %b %Y %T %z", rDateTime::TZ::Local);
const std::string str = date.Format("%a, %d %b %Y %T %z", rDateTime::TZ::Local);
memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1);
return CELL_OK;
@ -113,7 +113,7 @@ int cellRtcFormatRfc3339(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc, s
date.Add(tz);
// Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z).
const std::string& str = date.Format("%FT%T.%zZ", rDateTime::TZ::UTC);
const std::string str = date.Format("%FT%T.%zZ", rDateTime::TZ::UTC);
memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1);
return CELL_OK;
@ -127,7 +127,7 @@ int cellRtcFormatRfc3339LocalTime(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick
rDateTime date = rDateTime((time_t) pUtc->tick);
// Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z).
const std::string& str = date.Format("%FT%T.%zZ", rDateTime::TZ::Local);
const std::string str = date.Format("%FT%T.%zZ", rDateTime::TZ::Local);
memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1);
return CELL_OK;

View File

@ -825,7 +825,7 @@ int cellSailPlayerIsPaused(vm::ptr<CellSailPlayer> pSelf)
int cellSailPlayerSetRepeatMode(vm::ptr<CellSailPlayer> pSelf, s32 repeatMode, vm::ptr<CellSailStartCommand> pCommand)
{
cellSail->Warning("cellSailPlayerSetRepeatMode(pSelf_addr=0x%x, repeatMode=%i, pCommand_addr=0x%x)", pSelf.addr(), repeatMode, pCommand.addr());
cellSail->Warning("cellSailPlayerSetRepeatMode(pSelf_addr=0x%x, repeatMode=%d, pCommand_addr=0x%x)", pSelf.addr(), repeatMode, pCommand.addr());
pSelf->repeatMode = repeatMode;
pSelf->playbackCommand = pCommand;

View File

@ -576,13 +576,13 @@ s64 spursInit(
if (Emu.IsStopped()) break;
spurs->m.xD64.exchange(0);
if (spurs->m.exception.ToBE() == 0)
if (spurs->m.exception.data() == 0)
{
bool do_break = false;
for (u32 i = 0; i < 16; i++)
{
if (spurs->m.wklStat1[i].read_relaxed() == 2 &&
spurs->m.wklG1[i].priority.ToBE() != 0 &&
spurs->m.wklG1[i].priority.data() != 0 &&
spurs->m.wklMaxCnt[i].read_relaxed() & 0xf
)
{
@ -600,7 +600,7 @@ s64 spursInit(
if (spurs->m.flags1 & SF1_IS_SECOND) for (u32 i = 0; i < 16; i++)
{
if (spurs->m.wklStat2[i].read_relaxed() == 2 &&
spurs->m.wklG2[i].priority.ToBE() != 0 &&
spurs->m.wklG2[i].priority.data() != 0 &&
spurs->m.wklMaxCnt[i].read_relaxed() & 0xf0
)
{
@ -1040,7 +1040,7 @@ s64 spursAttachLv2EventQueue(vm::ptr<CellSpurs> spurs, u32 queue, vm::ptr<u8> po
{
return CELL_SPURS_CORE_ERROR_ALIGN;
}
if (spurs->m.exception.ToBE())
if (spurs->m.exception.data())
{
return CELL_SPURS_CORE_ERROR_STAT;
}
@ -1280,7 +1280,7 @@ s64 spursWakeUp(PPUThread& CPU, vm::ptr<CellSpurs> spurs)
{
return CELL_SPURS_POLICY_MODULE_ERROR_ALIGN;
}
if (spurs->m.exception.ToBE())
if (spurs->m.exception.data())
{
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
}
@ -1343,7 +1343,7 @@ s32 spursAddWorkload(
{
return CELL_SPURS_POLICY_MODULE_ERROR_INVAL;
}
if (spurs->m.exception.ToBE())
if (spurs->m.exception.data())
{
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
}
@ -1689,7 +1689,7 @@ s64 _cellSpursWorkloadFlagReceiver(vm::ptr<CellSpurs> spurs, u32 wid, u32 is_set
{
return CELL_SPURS_POLICY_MODULE_ERROR_SRCH;
}
if (spurs->m.exception.ToBE())
if (spurs->m.exception.data())
{
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
}
@ -1801,7 +1801,7 @@ s64 cellSpursReadyCountStore(vm::ptr<CellSpurs> spurs, u32 wid, u32 value)
{
return CELL_SPURS_POLICY_MODULE_ERROR_SRCH;
}
if (spurs->m.exception.ToBE() || spurs->wklStat(wid).read_relaxed() != 2)
if (spurs->m.exception.data() || spurs->wklStat(wid).read_relaxed() != 2)
{
return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
}

View File

@ -308,7 +308,7 @@ s32 cellSyncRwmInitialize(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer, u32 bu
s32 syncRwmTryReadBeginOp(CellSyncRwm::data_t& rwm)
{
if (rwm.m_writers.ToBE())
if (rwm.m_writers.data())
{
return CELL_SYNC_ERROR_BUSY;
}
@ -319,7 +319,7 @@ s32 syncRwmTryReadBeginOp(CellSyncRwm::data_t& rwm)
s32 syncRwmReadEndOp(CellSyncRwm::data_t& rwm)
{
if (!rwm.m_readers.ToBE())
if (!rwm.m_readers.data())
{
cellSync->Error("syncRwmReadEndOp(rwm_addr=0x%x): m_readers == 0 (m_writers=%d)", Memory.RealToVirtualAddr(&rwm), (u16)rwm.m_writers);
return CELL_SYNC_ERROR_ABORT;
@ -392,7 +392,7 @@ s32 cellSyncRwmTryRead(vm::ptr<CellSyncRwm> rwm, vm::ptr<void> buffer)
s32 syncRwmTryWriteBeginOp(CellSyncRwm::data_t& rwm)
{
if (rwm.m_writers.ToBE())
if (rwm.m_writers.data())
{
return CELL_SYNC_ERROR_BUSY;
}
@ -422,7 +422,7 @@ s32 cellSyncRwmWrite(vm::ptr<CellSyncRwm> rwm, vm::ptr<const void> buffer)
// prx: wait until m_readers == 0
g_sync_rwm_write_wm.wait_op(rwm.addr(), [rwm]()
{
return rwm->data.read_relaxed().m_readers.ToBE() == 0;
return rwm->data.read_relaxed().m_readers.data() == 0;
});
// prx: copy data from buffer_addr
@ -934,7 +934,7 @@ s32 syncLFQueueInitialize(vm::ptr<CellSyncLFQueue> queue, vm::ptr<u8> buffer, u3
const auto old = queue->init.read_relaxed();
auto init = old;
if (old.ToBE())
if (old.data())
{
if (sdk_ver > 0x17ffff && old != 2)
{
@ -1030,7 +1030,7 @@ s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
s32 var2 = (s32)(s16)push.m_h8;
s32 res;
if (useEventQueue && ((s32)push.m_h5 != var2 || push.m_h7.ToBE() != 0))
if (useEventQueue && ((s32)push.m_h5 != var2 || push.m_h7.data() != 0))
{
res = CELL_SYNC_ERROR_BUSY;
}
@ -1058,7 +1058,7 @@ s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
else if (!isBlocking)
{
res = CELL_SYNC_ERROR_AGAIN;
if (!push.m_h7.ToBE() || res)
if (!push.m_h7.data() || res)
{
return res;
}
@ -1081,7 +1081,7 @@ s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
if (queue->push1.compare_and_swap_test(old, push))
{
if (!push.m_h7.ToBE() || res)
if (!push.m_h7.data() || res)
{
return res;
}
@ -1406,7 +1406,7 @@ s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 i
s32 var2 = (s32)(s16)pop.m_h4;
s32 res;
if (useEventQueue && ((s32)(u16)pop.m_h1 != var2 || pop.m_h3.ToBE() != 0))
if (useEventQueue && ((s32)(u16)pop.m_h1 != var2 || pop.m_h3.data() != 0))
{
res = CELL_SYNC_ERROR_BUSY;
}
@ -1434,7 +1434,7 @@ s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 i
else if (!isBlocking)
{
res = CELL_SYNC_ERROR_AGAIN;
if (!pop.m_h3.ToBE() || res)
if (!pop.m_h3.data() || res)
{
return res;
}
@ -1457,7 +1457,7 @@ s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 i
if (queue->pop1.compare_and_swap_test(old, pop))
{
if (!pop.m_h3.ToBE() || res)
if (!pop.m_h3.data() || res)
{
return res;
}

View File

@ -240,7 +240,7 @@ int cellVideoOutGetConfiguration(u32 videoOut, vm::ptr<CellVideoOutConfiguration
int cellVideoOutGetDeviceInfo(u32 videoOut, u32 deviceIndex, vm::ptr<CellVideoOutDeviceInfo> info)
{
cellSysutil->Warning("cellVideoOutGetDeviceInfo(videoOut=%u, deviceIndex=%u, info_addr=0x%x)",
cellSysutil->Warning("cellVideoOutGetDeviceInfo(videoOut=%d, deviceIndex=%d, info_addr=0x%x)",
videoOut, deviceIndex, info.addr());
if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND;

View File

@ -378,7 +378,7 @@ int sceNpTrophyGetTrophyIcon()
int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptr<SceNpTrophyDetails> details, vm::ptr<SceNpTrophyData> data)
{
sceNpTrophy->Warning("sceNpTrophyGetTrophyInfo(context=%u, handle=%u, trophyId=%d, details_addr=0x%x, data_addr=0x%x)",
sceNpTrophy->Warning("sceNpTrophyGetTrophyInfo(context=%d, handle=%d, trophyId=%d, details_addr=0x%x, data_addr=0x%x)",
context, handle, trophyId, details.addr(), data.addr());
if (!sceNpTrophyInstance.m_bInitialized)

View File

@ -114,7 +114,7 @@ int sys_net_accept(s32 s, vm::ptr<sys_net_sockaddr> addr, vm::ptr<pck_len_t> pad
int sys_net_bind(s32 s, vm::ptr<sys_net_sockaddr_in> addr, u32 addrlen)
{
sys_net->Warning("bind(s=%d, family_addr=0x%x, addrlen=%u)", s, addr.addr(), addrlen);
sys_net->Warning("bind(s=%d, family_addr=0x%x, addrlen=%d)", s, addr.addr(), addrlen);
sockaddr_in saddr;
memcpy(&saddr, addr.get_ptr(), sizeof(sockaddr_in));
saddr.sin_family = addr->sin_family;
@ -127,7 +127,7 @@ int sys_net_bind(s32 s, vm::ptr<sys_net_sockaddr_in> addr, u32 addrlen)
int sys_net_connect(s32 s, vm::ptr<sys_net_sockaddr_in> addr, u32 addrlen)
{
sys_net->Warning("connect(s=%d, family_addr=0x%x, addrlen=%u)", s, addr.addr(), addrlen);
sys_net->Warning("connect(s=%d, family_addr=0x%x, addrlen=%d)", s, addr.addr(), addrlen);
sockaddr_in saddr;
memcpy(&saddr, addr.get_ptr(), sizeof(sockaddr_in));
saddr.sin_family = addr->sin_family;
@ -242,7 +242,7 @@ int sys_net_recv(s32 s, vm::ptr<char> buf, u32 len, s32 flags)
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)",
sys_net->Warning("recvfrom(s=%d, buf_addr=0x%x, len=%d, flags=0x%x, addr_addr=0x%x, paddrlen=0x%x)",
s, buf.addr(), len, flags, addr.addr(), paddrlen.addr());
sockaddr _addr;
@ -278,7 +278,7 @@ int sendmsg()
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)",
sys_net->Warning("sendto(s=%d, buf_addr=0x%x, len=%d, flags=0x%x, addr=0x%x, addrlen=%d)",
s, buf.addr(), len, flags, addr.addr(), addrlen);
sockaddr _addr;
@ -291,7 +291,7 @@ int sys_net_sendto(s32 s, vm::ptr<const char> buf, u32 len, s32 flags, vm::ptr<s
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);
sys_net->Warning("socket(s=%d, level=%d, optname=%d, optval_addr=0x%x, optlen=%d)", s, level, optname, optval.addr(), optlen);
int ret = setsockopt(s, level, optname, optval.get_ptr(), optlen);
*g_lastError = getLastError();

View File

@ -930,8 +930,8 @@ void fsAioRead(u32 fd, vm::ptr<CellFsAio> aio, int xid, vm::ptr<void(*)(vm::ptr<
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)",
fd, (u64)aio->offset, aio->buf.addr().ToLE(), (u64)aio->size, error, res, xid);
sys_fs->Log("*** fsAioRead(fd=%d, offset=0x%llx, buf_addr=0x%x, size=0x%llx, error=0x%x, res=0x%llx, xid=0x%x)",
fd, aio->offset, aio->buf, aio->size, error, res, xid);
}
if (func)
@ -945,9 +945,9 @@ void fsAioRead(u32 fd, vm::ptr<CellFsAio> aio, int xid, vm::ptr<void(*)(vm::ptr<
g_FsAioReadCur++;
}
int cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<u32> aio_id, vm::ptr<void(*)(vm::ptr<CellFsAio> xaio, int error, int xid, u64 size)> func)
int cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ref<u32> id, vm::ptr<void(*)(vm::ptr<CellFsAio> xaio, int error, int xid, u64 size)> func)
{
sys_fs->Warning("cellFsAioRead(aio_addr=0x%x, id_addr=0x%x, func_addr=0x%x)", aio.addr(), aio_id.addr(), func.addr());
sys_fs->Warning("cellFsAioRead(aio=0x%x, id=0x%x, func=0x%x)", aio, id, func);
if (!aio_init)
{
@ -964,7 +964,7 @@ int cellFsAioRead(vm::ptr<CellFsAio> aio, vm::ptr<u32> aio_id, vm::ptr<void(*)(v
//get a unique id for the callback (may be used by cellFsAioCancel)
const u32 xid = g_FsAioReadID++;
*aio_id = xid;
id = xid;
{
thread t("fsAioRead", std::bind(fsAioRead, fd, aio, xid, func));

View File

@ -17,9 +17,9 @@ s32 sys_cond_create(vm::ptr<u32> cond_id, u32 mutex_id, vm::ptr<sys_cond_attribu
{
sys_cond.Log("sys_cond_create(cond_id_addr=0x%x, mutex_id=%d, attr_addr=0x%x)", cond_id.addr(), mutex_id, attr.addr());
if (attr->pshared.ToBE() != se32(0x200))
if (attr->pshared.data() != se32(0x200))
{
sys_cond.Error("Invalid pshared attribute(0x%x)", (u32)attr->pshared);
sys_cond.Error("Unknown pshared attribute (0x%x)", attr->pshared);
return CELL_EINVAL;
}

View File

@ -39,20 +39,20 @@ s32 sys_event_queue_create(vm::ptr<u32> equeue_id, vm::ptr<sys_event_queue_attr>
return CELL_EINVAL;
}
switch (attr->protocol.ToBE())
switch (attr->protocol.data())
{
case se32(SYS_SYNC_PRIORITY): break;
case se32(SYS_SYNC_RETRY): sys_event.Error("Invalid SYS_SYNC_RETRY protocol attr"); return CELL_EINVAL;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_event.Error("Invalid SYS_SYNC_PRIORITY_INHERIT protocol attr"); return CELL_EINVAL;
case se32(SYS_SYNC_RETRY): sys_event.Error("Invalid protocol (SYS_SYNC_RETRY)"); return CELL_EINVAL;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_event.Error("Invalid protocol (SYS_SYNC_PRIORITY_INHERIT)"); return CELL_EINVAL;
case se32(SYS_SYNC_FIFO): break;
default: sys_event.Error("Unknown 0x%x protocol attr", (u32)attr->protocol); return CELL_EINVAL;
default: sys_event.Error("Unknown protocol (0x%x)", attr->protocol); return CELL_EINVAL;
}
switch (attr->type.ToBE())
switch (attr->type.data())
{
case se32(SYS_PPU_QUEUE): break;
case se32(SYS_SPU_QUEUE): break;
default: sys_event.Error("Unknown 0x%x type attr", (s32)attr->type); return CELL_EINVAL;
default: sys_event.Error("Unknown event queue type (0x%x)", attr->type); return CELL_EINVAL;
}
if (event_queue_key && Emu.GetEventManager().CheckKey(event_queue_key))

View File

@ -69,32 +69,32 @@ s32 sys_event_flag_create(vm::ptr<u32> eflag_id, vm::ptr<sys_event_flag_attr> at
return CELL_EFAULT;
}
switch (attr->protocol.ToBE())
switch (attr->protocol.data())
{
case se32(SYS_SYNC_PRIORITY): break;
case se32(SYS_SYNC_RETRY): sys_event_flag.Todo("sys_event_flag_create(): SYS_SYNC_RETRY"); break;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_event_flag.Todo("sys_event_flag_create(): SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_RETRY): sys_event_flag.Todo("SYS_SYNC_RETRY"); break;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_event_flag.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_FIFO): break;
default: return CELL_EINVAL;
default: sys_event_flag.Error("Unknown protocol (0x%x)", attr->protocol); return CELL_EINVAL;
}
if (attr->pshared.ToBE() != se32(0x200))
if (attr->pshared.data() != se32(0x200))
{
sys_event_flag.Error("Unknown pshared attribute (0x%x)", attr->pshared);
return CELL_EINVAL;
}
switch (attr->type.ToBE())
switch (attr->type.data())
{
case se32(SYS_SYNC_WAITER_SINGLE): break;
case se32(SYS_SYNC_WAITER_MULTIPLE): break;
default: return CELL_EINVAL;
default: sys_event_flag.Error("Unknown event flag type (0x%x)", attr->type); return CELL_EINVAL;
}
std::shared_ptr<EventFlag> ef(new EventFlag(init, (u32)attr->protocol, (s32)attr->type, attr->name_u64));
std::shared_ptr<EventFlag> ef(new EventFlag(init, attr->protocol, attr->type, attr->name_u64));
u32 id = sys_event_flag.GetNewId(ef, TYPE_EVENT_FLAG);
*eflag_id = id;
sys_event_flag.Warning("*** event_flag created [%s] (protocol=0x%x, type=0x%x): id = %d",
std::string(attr->name, 8).c_str(), (u32)attr->protocol, (s32)attr->type, id);
sys_event_flag.Warning("*** event_flag created [%s] (protocol=0x%x, type=0x%x): id = %d", std::string(attr->name, 8).c_str(), attr->protocol, attr->type, id);
return CELL_OK;
}

View File

@ -41,10 +41,10 @@ struct EventFlag
std::vector<EventFlagWaiter> waiters;
const u32 protocol;
const int type;
const s32 type;
const u64 name;
EventFlag(u64 pattern, u32 protocol, int type, u64 name)
EventFlag(u64 pattern, u32 protocol, s32 type, u64 name)
: protocol(protocol)
, type(type)
, name(name)

View File

@ -33,20 +33,20 @@ s32 sys_lwmutex_create(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex, vm::ptr<s
{
sys_lwmutex.Warning("sys_lwmutex_create(lwmutex_addr=0x%x, attr_addr=0x%x)", lwmutex.addr(), attr.addr());
switch (attr->recursive.ToBE())
switch (attr->recursive.data())
{
case se32(SYS_SYNC_RECURSIVE): break;
case se32(SYS_SYNC_NOT_RECURSIVE): break;
default: sys_lwmutex.Error("Unknown recursive attribute(0x%x)", (u32)attr->recursive); return CELL_EINVAL;
default: sys_lwmutex.Error("Unknown recursive attribute (0x%x)", attr->recursive); return CELL_EINVAL;
}
switch (attr->protocol.ToBE())
switch (attr->protocol.data())
{
case se32(SYS_SYNC_PRIORITY): break;
case se32(SYS_SYNC_RETRY): break;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_lwmutex.Error("Invalid SYS_SYNC_PRIORITY_INHERIT protocol attr"); return CELL_EINVAL;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_lwmutex.Error("Invalid protocol (SYS_SYNC_PRIORITY_INHERIT)"); return CELL_EINVAL;
case se32(SYS_SYNC_FIFO): break;
default: sys_lwmutex.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
default: sys_lwmutex.Error("Unknown protocol (0x%x)", attr->protocol); return CELL_EINVAL;
}
return lwmutex_create(*lwmutex, attr->protocol, attr->recursive, attr->name_u64);
@ -97,7 +97,10 @@ s32 sys_lwmutex_unlock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex)
s32 sys_lwmutex_t::trylock(be_t<u32> tid)
{
if (attribute.ToBE() == se32(0xDEADBEEF)) return CELL_EINVAL;
if (attribute.data() == se32(0xDEADBEEF))
{
return CELL_EINVAL;
}
if (!Emu.GetIdManager().CheckID(sleep_queue))
{
@ -108,10 +111,10 @@ s32 sys_lwmutex_t::trylock(be_t<u32> tid)
if (old_owner == tid)
{
if (attribute.ToBE() & se32(SYS_SYNC_RECURSIVE))
if (attribute.data() & se32(SYS_SYNC_RECURSIVE))
{
auto rv = recursive_count.read_relaxed();
if (!~(rv++).ToBE())
if (!~(rv++).data())
{
return CELL_EKRESOURCE;
}
@ -142,7 +145,7 @@ s32 sys_lwmutex_t::unlock(be_t<u32> tid)
}
auto rv = recursive_count.read_relaxed();
if (!rv.ToBE() || (rv.ToBE() != se32(1) && (attribute.ToBE() & se32(SYS_SYNC_NOT_RECURSIVE))))
if (!rv.data() || (rv.data() != se32(1) && (attribute.data() & se32(SYS_SYNC_NOT_RECURSIVE))))
{
sys_lwmutex.Error("sys_lwmutex_t::unlock(%d): wrong recursive value fixed (%d)", (u32)sleep_queue, (u32)rv);
rv = 1;
@ -150,7 +153,7 @@ s32 sys_lwmutex_t::unlock(be_t<u32> tid)
rv--;
recursive_count.exchange(rv);
if (!rv.ToBE())
if (!rv.data())
{
std::shared_ptr<sleep_queue_t> sq;
if (!Emu.GetIdManager().GetIDData(sleep_queue, sq))
@ -188,7 +191,7 @@ s32 sys_lwmutex_t::lock(be_t<u32> tid, u64 timeout)
while (true)
{
auto old_owner = owner.compare_and_swap(be_t<u32>::make(0), tid);
if (!old_owner.ToBE() || old_owner == tid)
if (!old_owner.data() || old_owner == tid)
{
break;
}

View File

@ -29,38 +29,37 @@ s32 sys_mutex_create(PPUThread& CPU, vm::ptr<u32> mutex_id, vm::ptr<sys_mutex_at
{
sys_mutex.Log("sys_mutex_create(mutex_id_addr=0x%x, attr_addr=0x%x)", mutex_id.addr(), attr.addr());
switch (attr->protocol.ToBE())
switch (attr->protocol.data())
{
case se32(SYS_SYNC_FIFO): break;
case se32(SYS_SYNC_PRIORITY): break;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_mutex.Todo("sys_mutex_create(): SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_RETRY): sys_mutex.Error("sys_mutex_create(): SYS_SYNC_RETRY"); return CELL_EINVAL;
default: sys_mutex.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_mutex.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_RETRY): sys_mutex.Error("Invalid protocol (SYS_SYNC_RETRY)"); return CELL_EINVAL;
default: sys_mutex.Error("Unknown protocol (0x%x)", attr->protocol); return CELL_EINVAL;
}
bool is_recursive;
switch (attr->recursive.ToBE())
switch (attr->recursive.data())
{
case se32(SYS_SYNC_RECURSIVE): is_recursive = true; break;
case se32(SYS_SYNC_NOT_RECURSIVE): is_recursive = false; break;
default: sys_mutex.Error("Unknown recursive attribute(0x%x)", (u32)attr->recursive); return CELL_EINVAL;
default: sys_mutex.Error("Unknown recursive attribute (0x%x)", attr->recursive); return CELL_EINVAL;
}
if (attr->pshared.ToBE() != se32(0x200))
if (attr->pshared.data() != se32(0x200))
{
sys_mutex.Error("Unknown pshared attribute(0x%x)", (u32)attr->pshared);
sys_mutex.Error("Unknown pshared attribute (0x%x)", attr->pshared);
return CELL_EINVAL;
}
std::shared_ptr<Mutex> mutex(new Mutex((u32)attr->protocol, is_recursive, attr->name_u64));
std::shared_ptr<Mutex> mutex(new Mutex(attr->protocol, is_recursive, attr->name_u64));
const u32 id = sys_mutex.GetNewId(mutex, TYPE_MUTEX);
mutex->id.exchange(id);
*mutex_id = id;
mutex->queue.set_full_name(fmt::Format("Mutex(%d)", id));
sys_mutex.Warning("*** mutex created [%s] (protocol=0x%x, recursive=%s): id = %d",
std::string(attr->name, 8).c_str(), (u32) attr->protocol, (is_recursive ? "true" : "false"), id);
sys_mutex.Warning("*** mutex created [%s] (protocol=0x%x, recursive=%s): id = %d", std::string(attr->name, 8).c_str(), attr->protocol, is_recursive, id);
// TODO: unlock mutex when owner thread does exit
return CELL_OK;
}

View File

@ -113,7 +113,7 @@ s32 sys_rsx_context_iounmap(u32 context_id, u32 a2, u32 io_addr, u32 size)
*/
s32 sys_rsx_context_attribute(s32 context_id, u32 package_id, u64 a3, u64 a4, u64 a5, u64 a6)
{
sys_rsx.Todo("sys_rsx_context_attribute(context_id=0x%x, package_id=0x%x, a3=%llu, a4=%llu, a5=%llu, a6=%llu)",
sys_rsx.Todo("sys_rsx_context_attribute(context_id=0x%x, package_id=0x%x, a3=0x%llx, a4=0x%llx, a5=0x%llx, a6=0x%llx)",
context_id, package_id, a3, a4, a5, a6);
switch(package_id)

View File

@ -21,22 +21,22 @@ s32 sys_rwlock_create(vm::ptr<u32> rw_lock_id, vm::ptr<sys_rwlock_attribute_t> a
return CELL_EFAULT;
}
switch (attr->protocol.ToBE())
switch (attr->protocol.data())
{
case se32(SYS_SYNC_PRIORITY): break;
case se32(SYS_SYNC_RETRY): sys_rwlock.Error("SYS_SYNC_RETRY"); return CELL_EINVAL;
case se32(SYS_SYNC_RETRY): sys_rwlock.Error("Invalid protocol (SYS_SYNC_RETRY)"); return CELL_EINVAL;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_rwlock.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_FIFO): break;
default: return CELL_EINVAL;
default: sys_rwlock.Error("Unknown protocol (0x%x)", attr->protocol); return CELL_EINVAL;
}
if (attr->pshared.ToBE() != se32(0x200))
if (attr->pshared.data() != se32(0x200))
{
sys_rwlock.Error("Invalid pshared value (0x%x)", (u32)attr->pshared);
sys_rwlock.Error("Unknown pshared attribute (0x%x)", attr->pshared);
return CELL_EINVAL;
}
std::shared_ptr<RWLock> rw(new RWLock((u32)attr->protocol, attr->name_u64));
std::shared_ptr<RWLock> rw(new RWLock(attr->protocol, attr->name_u64));
const u32 id = sys_rwlock.GetNewId(rw, TYPE_RWLOCK);
*rw_lock_id = id;
rw->wqueue.set_full_name(fmt::Format("Rwlock(%d)", id));

View File

@ -45,20 +45,20 @@ s32 sys_semaphore_create(vm::ptr<u32> sem, vm::ptr<sys_semaphore_attribute> attr
sys_semaphore.Error("sys_semaphore_create(): invalid parameters (initial_count=%d, max_count=%d)", initial_count, max_count);
return CELL_EINVAL;
}
if (attr->pshared.ToBE() != se32(0x200))
{
sys_semaphore.Error("sys_semaphore_create(): invalid pshared value(0x%x)", (u32)attr->pshared);
return CELL_EINVAL;
}
switch (attr->protocol.ToBE())
switch (attr->protocol.data())
{
case se32(SYS_SYNC_FIFO): break;
case se32(SYS_SYNC_PRIORITY): break;
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_semaphore.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_RETRY): sys_semaphore.Error("SYS_SYNC_RETRY"); return CELL_EINVAL;
default: sys_semaphore.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
case se32(SYS_SYNC_RETRY): sys_semaphore.Error("Invalid protocol (SYS_SYNC_RETRY)"); return CELL_EINVAL;
default: sys_semaphore.Error("Unknown protocol attribute (0x%x)", attr->protocol); return CELL_EINVAL;
}
if (attr->pshared.data() != se32(0x200))
{
sys_semaphore.Error("Unknown pshared attribute (0x%x)", attr->pshared);
return CELL_EINVAL;
}
*sem = semaphore_create(initial_count, max_count, attr->protocol, attr->name_u64);

View File

@ -21,9 +21,9 @@ void sys_spinlock_lock(vm::ptr<atomic_t<u32>> lock)
sys_spinlock.Log("sys_spinlock_lock(lock_addr=0x%x)", lock.addr());
// prx: exchange with 0xabadcafe, repeat until exchanged with 0
while (lock->exchange(be_t<u32>::make(0xabadcafe)).ToBE())
while (lock->exchange(be_t<u32>::make(0xabadcafe)).data())
{
while (lock->read_relaxed().ToBE())
while (lock->read_relaxed().data())
{
std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped())
@ -45,7 +45,7 @@ s32 sys_spinlock_trylock(vm::ptr<atomic_t<u32>> lock)
sys_spinlock.Log("sys_spinlock_trylock(lock_addr=0x%x)", lock.addr());
// prx: exchange with 0xabadcafe, translate exchanged value
if (lock->exchange(be_t<u32>::make(0xabadcafe)).ToBE())
if (lock->exchange(be_t<u32>::make(0xabadcafe)).data())
{
return CELL_EBUSY;
}

View File

@ -41,7 +41,7 @@ s32 sys_timer_get_information(u32 timer_id, vm::ptr<sys_timer_information_t> inf
s32 sys_timer_start(u32 timer_id, s64 base_time, u64 period)
{
sys_timer.Warning("sys_timer_start_periodic_absolute(timer_id=%d, basetime=%lld, period=%llu)", timer_id, base_time, period);
sys_timer.Warning("sys_timer_start_periodic_absolute(timer_id=%d, basetime=%lld, period=%lld)", timer_id, base_time, period);
std::shared_ptr<timer> timer_data = nullptr;
if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH;
@ -76,7 +76,7 @@ s32 sys_timer_stop(u32 timer_id)
s32 sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data1, u64 data2)
{
sys_timer.Warning("sys_timer_connect_event_queue(timer_id=%d, queue_id=%d, name=%llu, data1=%llu, data2=%llu)",
sys_timer.Warning("sys_timer_connect_event_queue(timer_id=%d, queue_id=%d, name=0x%llx, data1=0x%llx, data2=0x%llx)",
timer_id, queue_id, name, data1, data2);
std::shared_ptr<timer> timer_data = nullptr;

View File

@ -34,7 +34,7 @@ namespace loader
be_t<u16> e_shnum;
be_t<u16> e_shstrndx;
bool check() const { return e_magic.ToBE() == se32(0x7F454C46); }
bool check() const { return e_magic.data() == se32(0x7F454C46); }
} m_ehdr;
struct phdr

View File

@ -67,7 +67,7 @@ const std::string Ehdr_OS_ABIToString(const u8 os_abi)
case 0x66: return "Cell OS LV-2";
};
return fmt::Format("Unknown (%x)", os_abi);
return fmt::Format("Unknown (0x%x)", os_abi);
}
const std::string Ehdr_MachineToString(const u16 machine)
@ -80,7 +80,7 @@ const std::string Ehdr_MachineToString(const u16 machine)
case MACHINE_ARM: return "ARM";
};
return fmt::Format("Unknown (%x)", machine);
return fmt::Format("Unknown (0x%x)", machine);
}
const std::string Phdr_FlagsToString(u32 flags)
@ -105,7 +105,7 @@ const std::string Phdr_FlagsToString(u32 flags)
flags &= ~spu << 0x14;
flags &= ~rsx << 0x18;
if(flags != 0) return fmt::Format("Unknown %s PPU[%x] SPU[%x] RSX[%x]", ret.c_str(), ppu, spu, rsx);
if(flags != 0) return fmt::Format("Unknown %s PPU[0x%x] SPU[0x%x] RSX[0x%x]", ret.c_str(), ppu, spu, rsx);
ret += "PPU[" + FLAGS_TO_STRING(ppu) + "] ";
ret += "SPU[" + FLAGS_TO_STRING(spu) + "] ";
@ -125,5 +125,5 @@ const std::string Phdr_TypeToString(const u32 type)
case 0x60000002: return "LOOS+2";
};
return fmt::Format("Unknown (%x)", type);
return fmt::Format("Unknown (0x%x)", type);
}

View File

@ -168,7 +168,7 @@ void compile_shader(std::string path)
}
CgBinaryProgram& prog = vm::get_ref<CgBinaryProgram>(ptr);
LOG_ERROR(GENERAL, "%d - %x", (u32)prog.profile, (u32)prog.binaryFormatRevision);
LOG_ERROR(GENERAL, "%d - 0x%x", (u32)prog.profile, (u32)prog.binaryFormatRevision);
std::string shader;
GLParamArray param_array;