Formatting fixes, ToBE() replaced with data()

This commit is contained in:
Nekotekina 2015-01-13 17:54:36 +03:00
parent f4c712dafc
commit 1c4e89d2bf
32 changed files with 166 additions and 158 deletions

View File

@ -551,12 +551,12 @@ private:
} }
}; };
public:
const stype& ToBE() const const stype& ToBE() const
{ {
return m_data; return m_data;
} }
public:
type ToLE() const type ToLE() const
{ {
return se_t<type, sizeof(T2)>::from_be(m_data); return se_t<type, sizeof(T2)>::from_be(m_data);
@ -605,11 +605,7 @@ public:
const stype& data() const const stype& data() const
{ {
#ifdef IS_LE_MACHINE
return ToBE(); return ToBE();
#else
return ToLE();
#endif
} }
be_t& operator = (const be_t& value) = default; 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 //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::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); Log::LogManager::getInstance().log(msg);
} }
template<typename T, typename... Ts> template<typename T, typename... Ts>
inline void log_message(Log::LogType type, Log::LogSeverity sev, const char* text, T arg, Ts... args) 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); Log::LogManager::getInstance().log(msg);
} }

View File

@ -300,7 +300,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (u8)"; throw "Invalid formatting (u8): " + std::string(fmt, len);
} }
return{}; return{};
@ -322,7 +322,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (u16)"; throw "Invalid formatting (u16): " + std::string(fmt, len);
} }
return{}; return{};
@ -344,7 +344,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (u32)"; throw "Invalid formatting (u32): " + std::string(fmt, len);
} }
return{}; return{};
@ -366,7 +366,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (u64)"; throw "Invalid formatting (u64): " + std::string(fmt, len);
} }
return{}; return{};
@ -388,7 +388,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (s8)"; throw "Invalid formatting (s8): " + std::string(fmt, len);
} }
return{}; return{};
@ -410,7 +410,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (s16)"; throw "Invalid formatting (s16): " + std::string(fmt, len);
} }
return{}; return{};
@ -432,7 +432,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (s32)"; throw "Invalid formatting (s32): " + std::string(fmt, len);
} }
return{}; return{};
@ -454,7 +454,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (s64)"; throw "Invalid formatting (s64): " + std::string(fmt, len);
} }
return{}; return{};
@ -476,7 +476,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (float)"; throw "Invalid formatting (float): " + std::string(fmt, len);
} }
return{}; return{};
@ -498,7 +498,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (double)"; throw "Invalid formatting (double): " + std::string(fmt, len);
} }
return{}; return{};
@ -524,7 +524,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (bool)"; throw "Invalid formatting (bool): " + std::string(fmt, len);
} }
return{}; return{};
@ -542,7 +542,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (char*)"; throw "Invalid formatting (char*): " + std::string(fmt, len);
} }
return{}; return{};
@ -560,7 +560,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (const char*)"; throw "Invalid formatting (const char*): " + std::string(fmt, len);
} }
return{}; return{};
@ -578,7 +578,7 @@ namespace fmt
// } // }
// else // else
// { // {
// throw "Invalid formatting (char[size])"; // throw "Invalid formatting (char[size]): " + std::string(fmt, len);
// } // }
// return{}; // return{};
@ -596,7 +596,7 @@ namespace fmt
// } // }
// else // else
// { // {
// throw "Invalid formatting (const char[size])"; // throw "Invalid formatting (const char[size]): " + std::string(fmt, len);
// } // }
// return{}; // return{};
@ -614,7 +614,7 @@ namespace fmt
} }
else else
{ {
throw "Invalid formatting (std::string)"; throw "Invalid formatting (std::string): " + std::string(fmt, len);
} }
return{}; return{};

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) void SPUThread::ListCmd(u32 lsa, u64 ea, u16 tag, u16 size, u32 cmd, MFCReg& MFCArgs)
{ {
u32 list_addr = ea & 0x3ffff; const u32 list_addr = ea & 0x3ffff;
u32 list_size = size / 8; const u32 list_size = size / 8;
lsa &= 0x3fff0; lsa &= 0x3fff0;
struct list_element 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); auto rec = vm::ptr<list_element>::make(ls_offset + list_addr + i * 8);
u32 size = rec->ts; const u32 size = rec->ts;
if (!(rec->s.ToBE() & se16(0x8000)) && size < 16 && size != 1 && size != 2 && size != 4 && size != 8) 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); LOG_ERROR(Log::SPU, "DMA List: invalid transfer size(%d)", size);
result = MFC_PPU_DMA_CMD_SEQUENCE_ERROR; result = MFC_PPU_DMA_CMD_SEQUENCE_ERROR;
break; break;
} }
u32 addr = rec->ea; const u32 addr = rec->ea;
if (size) if (size)
{
ProcessCmd(cmd, tag, lsa | (addr & 0xf), addr, size); ProcessCmd(cmd, tag, lsa | (addr & 0xf), addr, size);
}
if (Ini.HLELogging.GetValue() || rec->s.ToBE()) 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, (u16)rec->s, (u16)rec->ts, (u32)rec->ea, lsa | (addr & 0xf)); 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) 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); 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; result = MFC_PPU_DMA_CMD_SEQUENCE_ERROR;
break; break;
} }
StallList[tag].MFCArgs = &MFCArgs; StallList[tag].MFCArgs = &MFCArgs;
StallList[tag].cmd = cmd; StallList[tag].cmd = cmd;
StallList[tag].ea = (ea & ~0xffffffff) | (list_addr + (i + 1) * 8); StallList[tag].ea = (ea & ~0xffffffff) | (list_addr + (i + 1) * 8);
StallList[tag].lsa = lsa; StallList[tag].lsa = lsa;
StallList[tag].size = (list_size - i - 1) * 8; StallList[tag].size = (list_size - i - 1) * 8;
break; break;
} }
} }

View File

@ -48,7 +48,7 @@ std::string GLVertexDecompilerThread::GetDST(bool isSca)
default: default:
if (d3.dst > 15) 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)"); 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; break;
} }
@ -92,7 +92,7 @@ std::string GLVertexDecompilerThread::GetSRC(const u32 n)
break; break;
default: 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(); Emu.Pause();
break; break;
} }

View File

@ -177,7 +177,7 @@ u32 RSXThread::OutOfArgsCount(const uint x, const u32 cmd, const u32 count, cons
debug += "("; debug += "(";
for (u32 i = 0; i < count; ++i) debug += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i)); for (u32 i = 0; i < count; ++i) debug += (i ? ", " : "") + fmt::Format("0x%x", ARGS(i));
debug += ")"; 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; return 0;
} }

View File

@ -60,22 +60,22 @@ void hle::error::print(const char* func)
{ {
if (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 else
{ {
base->Error("%s (0x%X)", text.c_str(), code); base->Error("%s (0x%x)", text.c_str(), code);
} }
} }
else else
{ {
if (func) 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 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->fd = 0;
current_subHandle->src = *src; current_subHandle->src = *src;
switch(src->srcSelect.ToBE()) switch(src->srcSelect.data())
{ {
case se32(CELL_GIFDEC_BUFFER): case se32(CELL_GIFDEC_BUFFER):
current_subHandle->fileSize = src->streamSize.ToLE(); 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<u8[13]> buffer; // Alloc buffer for GIF header
vm::var<be_t<u64>> pos, nread; vm::var<be_t<u64>> pos, nread;
switch(subHandle_data->src.srcSelect.ToBE()) switch(subHandle_data->src.srcSelect.data())
{ {
case se32(CELL_GIFDEC_BUFFER): case se32(CELL_GIFDEC_BUFFER):
memmove(buffer.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), buffer.size()); 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<unsigned char[]> gif((u32)fileSize);
vm::var<be_t<u64>> pos, nread; vm::var<be_t<u64>> pos, nread;
switch(subHandle_data->src.srcSelect.ToBE()) switch(subHandle_data->src.srcSelect.data())
{ {
case se32(CELL_GIFDEC_BUFFER): case se32(CELL_GIFDEC_BUFFER):
memmove(gif.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), gif.size()); 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->fd = 0;
current_subHandle->src = *src; current_subHandle->src = *src;
switch(src->srcSelect.ToBE()) switch(src->srcSelect.data())
{ {
case se32(CELL_JPGDEC_BUFFER): case se32(CELL_JPGDEC_BUFFER):
current_subHandle->fileSize = src->streamSize.ToLE(); 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<u8[]> buffer((u32)fileSize);
vm::var<be_t<u64>> pos, nread; vm::var<be_t<u64>> pos, nread;
switch(subHandle_data->src.srcSelect.ToBE()) switch(subHandle_data->src.srcSelect.data())
{ {
case se32(CELL_JPGDEC_BUFFER): case se32(CELL_JPGDEC_BUFFER):
memmove(buffer.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), buffer.size()); 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<unsigned char[]> jpg((u32)fileSize);
vm::var<be_t<u64>> pos, nread; vm::var<be_t<u64>> pos, nread;
switch(subHandle_data->src.srcSelect.ToBE()) switch(subHandle_data->src.srcSelect.data())
{ {
case se32(CELL_JPGDEC_BUFFER): case se32(CELL_JPGDEC_BUFFER):
memmove(jpg.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), jpg.size()); 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) 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 (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER; if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); const PadInfo& rinfo = Emu.GetPadManager().GetInfo();
@ -405,7 +405,7 @@ int cellPadSetPressMode(u32 port_no, u32 mode)
int cellPadSetSensorMode(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 (!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER; if (mode != 0 && mode != 1) return CELL_PAD_ERROR_INVALID_PARAMETER;
const PadInfo& rinfo = Emu.GetPadManager().GetInfo(); const PadInfo& rinfo = Emu.GetPadManager().GetInfo();

View File

@ -77,7 +77,7 @@ s64 pngDecOpen(
stream->fd = 0; stream->fd = 0;
stream->src = *src; stream->src = *src;
switch (src->srcSelect.ToBE()) switch (src->srcSelect.data())
{ {
case se32(CELL_PNGDEC_BUFFER): case se32(CELL_PNGDEC_BUFFER):
stream->fileSize = src->streamSize.ToLE(); stream->fileSize = src->streamSize.ToLE();
@ -145,7 +145,7 @@ s64 pngReadHeader(
auto buffer_32 = buffer.To<be_t<u32>>(); auto buffer_32 = buffer.To<be_t<u32>>();
vm::var<be_t<u64>> pos, nread; vm::var<be_t<u64>> pos, nread;
switch (stream->src.srcSelect.ToBE()) switch (stream->src.srcSelect.data())
{ {
case se32(CELL_PNGDEC_BUFFER): case se32(CELL_PNGDEC_BUFFER):
memmove(buffer.begin(), stream->src.streamPtr.get_ptr(), buffer.size()); memmove(buffer.begin(), stream->src.streamPtr.get_ptr(), buffer.size());
@ -156,9 +156,9 @@ s64 pngReadHeader(
break; break;
} }
if (buffer_32[0].ToBE() != se32(0x89504E47) || if (buffer_32[0].data() != se32(0x89504E47) ||
buffer_32[1].ToBE() != se32(0x0D0A1A0A) || // Error: The first 8 bytes are not a valid PNG signature buffer_32[1].data() != 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 buffer_32[3].data() != se32(0x49484452)) // Error: The PNG file does not start with an IHDR chunk
{ {
return CELL_PNGDEC_ERROR_HEADER; return CELL_PNGDEC_ERROR_HEADER;
} }
@ -206,7 +206,7 @@ s64 pngDecSetParameter(
current_outParam.outputHeight = current_info.imageHeight; current_outParam.outputHeight = current_info.imageHeight;
current_outParam.outputColorSpace = inParam->outputColorSpace; current_outParam.outputColorSpace = inParam->outputColorSpace;
switch (current_outParam.outputColorSpace.ToBE()) switch (current_outParam.outputColorSpace.data())
{ {
case se32(CELL_PNGDEC_PALETTE): case se32(CELL_PNGDEC_PALETTE):
case se32(CELL_PNGDEC_GRAYSCALE): case se32(CELL_PNGDEC_GRAYSCALE):
@ -254,7 +254,7 @@ s64 pngDecodeData(
vm::var<unsigned char[]> png((u32)fileSize); vm::var<unsigned char[]> png((u32)fileSize);
vm::var<be_t<u64>> pos, nread; vm::var<be_t<u64>> pos, nread;
switch (stream->src.srcSelect.ToBE()) switch (stream->src.srcSelect.data())
{ {
case se32(CELL_PNGDEC_BUFFER): case se32(CELL_PNGDEC_BUFFER):
memmove(png.begin(), stream->src.streamPtr.get_ptr(), png.size()); memmove(png.begin(), stream->src.streamPtr.get_ptr(), png.size());
@ -283,7 +283,7 @@ s64 pngDecodeData(
const int bytesPerLine = (u32)dataCtrlParam->outputBytesPerLine; const int bytesPerLine = (u32)dataCtrlParam->outputBytesPerLine;
uint image_size = width * height; uint image_size = width * height;
switch (current_outParam.outputColorSpace.ToBE()) switch (current_outParam.outputColorSpace.data())
{ {
case se32(CELL_PNGDEC_RGB): case se32(CELL_PNGDEC_RGB):
case se32(CELL_PNGDEC_RGBA): 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); date.Add(tz);
// Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000). // 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); memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1);
return CELL_OK; return CELL_OK;
@ -95,7 +95,7 @@ int cellRtcFormatRfc2822LocalTime(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick
rDateTime date = rDateTime((time_t)pUtc->tick); rDateTime date = rDateTime((time_t)pUtc->tick);
// Format date string in RFC2822 format (e.g.: Mon, 01 Jan 1990 12:00:00 +0000). // 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); memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1);
return CELL_OK; return CELL_OK;
@ -113,7 +113,7 @@ int cellRtcFormatRfc3339(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick> pUtc, s
date.Add(tz); date.Add(tz);
// Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z). // 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); memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1);
return CELL_OK; return CELL_OK;
@ -127,7 +127,7 @@ int cellRtcFormatRfc3339LocalTime(vm::ptr<char> pszDateTime, vm::ptr<CellRtcTick
rDateTime date = rDateTime((time_t) pUtc->tick); rDateTime date = rDateTime((time_t) pUtc->tick);
// Format date string in RFC3339 format (e.g.: 1990-01-01T12:00:00.00Z). // 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); memcpy(pszDateTime.get_ptr(), str.c_str(), str.size() + 1);
return CELL_OK; 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) 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->repeatMode = repeatMode;
pSelf->playbackCommand = pCommand; pSelf->playbackCommand = pCommand;

View File

@ -576,13 +576,13 @@ s64 spursInit(
if (Emu.IsStopped()) break; if (Emu.IsStopped()) break;
spurs->m.xD64.exchange(0); spurs->m.xD64.exchange(0);
if (spurs->m.exception.ToBE() == 0) if (spurs->m.exception.data() == 0)
{ {
bool do_break = false; bool do_break = false;
for (u32 i = 0; i < 16; i++) for (u32 i = 0; i < 16; i++)
{ {
if (spurs->m.wklStat1[i].read_relaxed() == 2 && 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 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.flags1 & SF1_IS_SECOND) for (u32 i = 0; i < 16; i++)
{ {
if (spurs->m.wklStat2[i].read_relaxed() == 2 && 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 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; return CELL_SPURS_CORE_ERROR_ALIGN;
} }
if (spurs->m.exception.ToBE()) if (spurs->m.exception.data())
{ {
return CELL_SPURS_CORE_ERROR_STAT; 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; return CELL_SPURS_POLICY_MODULE_ERROR_ALIGN;
} }
if (spurs->m.exception.ToBE()) if (spurs->m.exception.data())
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_STAT; return CELL_SPURS_POLICY_MODULE_ERROR_STAT;
} }
@ -1343,7 +1343,7 @@ s32 spursAddWorkload(
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_INVAL; return CELL_SPURS_POLICY_MODULE_ERROR_INVAL;
} }
if (spurs->m.exception.ToBE()) if (spurs->m.exception.data())
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_STAT; 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; return CELL_SPURS_POLICY_MODULE_ERROR_SRCH;
} }
if (spurs->m.exception.ToBE()) if (spurs->m.exception.data())
{ {
return CELL_SPURS_POLICY_MODULE_ERROR_STAT; 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; 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; 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) s32 syncRwmTryReadBeginOp(CellSyncRwm::data_t& rwm)
{ {
if (rwm.m_writers.ToBE()) if (rwm.m_writers.data())
{ {
return CELL_SYNC_ERROR_BUSY; return CELL_SYNC_ERROR_BUSY;
} }
@ -319,7 +319,7 @@ s32 syncRwmTryReadBeginOp(CellSyncRwm::data_t& rwm)
s32 syncRwmReadEndOp(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); 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; 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) s32 syncRwmTryWriteBeginOp(CellSyncRwm::data_t& rwm)
{ {
if (rwm.m_writers.ToBE()) if (rwm.m_writers.data())
{ {
return CELL_SYNC_ERROR_BUSY; 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 // prx: wait until m_readers == 0
g_sync_rwm_write_wm.wait_op(rwm.addr(), [rwm]() 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 // 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(); const auto old = queue->init.read_relaxed();
auto init = old; auto init = old;
if (old.ToBE()) if (old.data())
{ {
if (sdk_ver > 0x17ffff && old != 2) 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 var2 = (s32)(s16)push.m_h8;
s32 res; 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; res = CELL_SYNC_ERROR_BUSY;
} }
@ -1058,7 +1058,7 @@ s32 syncLFQueueGetPushPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32
else if (!isBlocking) else if (!isBlocking)
{ {
res = CELL_SYNC_ERROR_AGAIN; res = CELL_SYNC_ERROR_AGAIN;
if (!push.m_h7.ToBE() || res) if (!push.m_h7.data() || res)
{ {
return 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 (queue->push1.compare_and_swap_test(old, push))
{ {
if (!push.m_h7.ToBE() || res) if (!push.m_h7.data() || res)
{ {
return 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 var2 = (s32)(s16)pop.m_h4;
s32 res; 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; res = CELL_SYNC_ERROR_BUSY;
} }
@ -1434,7 +1434,7 @@ s32 syncLFQueueGetPopPointer(vm::ptr<CellSyncLFQueue> queue, s32& pointer, u32 i
else if (!isBlocking) else if (!isBlocking)
{ {
res = CELL_SYNC_ERROR_AGAIN; res = CELL_SYNC_ERROR_AGAIN;
if (!pop.m_h3.ToBE() || res) if (!pop.m_h3.data() || res)
{ {
return 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 (queue->pop1.compare_and_swap_test(old, pop))
{ {
if (!pop.m_h3.ToBE() || res) if (!pop.m_h3.data() || res)
{ {
return 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) 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()); videoOut, deviceIndex, info.addr());
if(deviceIndex) return CELL_VIDEO_OUT_ERROR_DEVICE_NOT_FOUND; 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) 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()); context, handle, trophyId, details.addr(), data.addr());
if (!sceNpTrophyInstance.m_bInitialized) 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) 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; sockaddr_in saddr;
memcpy(&saddr, addr.get_ptr(), sizeof(sockaddr_in)); memcpy(&saddr, addr.get_ptr(), sizeof(sockaddr_in));
saddr.sin_family = addr->sin_family; 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) 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; sockaddr_in saddr;
memcpy(&saddr, addr.get_ptr(), sizeof(sockaddr_in)); memcpy(&saddr, addr.get_ptr(), sizeof(sockaddr_in));
saddr.sin_family = addr->sin_family; 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) 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()); s, buf.addr(), len, flags, addr.addr(), paddrlen.addr());
sockaddr _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) 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); s, buf.addr(), len, flags, addr.addr(), addrlen);
sockaddr _addr; 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) 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); int ret = setsockopt(s, level, optname, optval.get_ptr(), optlen);
*g_lastError = getLastError(); *g_lastError = getLastError();

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()); 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; 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; return CELL_EINVAL;
} }
switch (attr->protocol.ToBE()) switch (attr->protocol.data())
{ {
case se32(SYS_SYNC_PRIORITY): break; 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_RETRY): sys_event.Error("Invalid protocol (SYS_SYNC_RETRY)"); 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_PRIORITY_INHERIT): sys_event.Error("Invalid protocol (SYS_SYNC_PRIORITY_INHERIT)"); return CELL_EINVAL;
case se32(SYS_SYNC_FIFO): break; 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_PPU_QUEUE): break;
case se32(SYS_SPU_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)) 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; return CELL_EFAULT;
} }
switch (attr->protocol.ToBE()) switch (attr->protocol.data())
{ {
case se32(SYS_SYNC_PRIORITY): break; 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_RETRY): sys_event_flag.Todo("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_PRIORITY_INHERIT): sys_event_flag.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_FIFO): 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; return CELL_EINVAL;
} }
switch (attr->type.ToBE()) switch (attr->type.data())
{ {
case se32(SYS_SYNC_WAITER_SINGLE): break; case se32(SYS_SYNC_WAITER_SINGLE): break;
case se32(SYS_SYNC_WAITER_MULTIPLE): 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); u32 id = sys_event_flag.GetNewId(ef, TYPE_EVENT_FLAG);
*eflag_id = id; *eflag_id = id;
sys_event_flag.Warning("*** event_flag created [%s] (protocol=0x%x, type=0x%x): id = %d", 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);
std::string(attr->name, 8).c_str(), (u32)attr->protocol, (s32)attr->type, id);
return CELL_OK; return CELL_OK;
} }

View File

@ -41,10 +41,10 @@ struct EventFlag
std::vector<EventFlagWaiter> waiters; std::vector<EventFlagWaiter> waiters;
const u32 protocol; const u32 protocol;
const int type; const s32 type;
const u64 name; const u64 name;
EventFlag(u64 pattern, u32 protocol, int type, u64 name) EventFlag(u64 pattern, u32 protocol, s32 type, u64 name)
: protocol(protocol) : protocol(protocol)
, type(type) , type(type)
, name(name) , 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()); 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_RECURSIVE): break;
case se32(SYS_SYNC_NOT_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_PRIORITY): break;
case se32(SYS_SYNC_RETRY): 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; 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); 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) 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)) if (!Emu.GetIdManager().CheckID(sleep_queue))
{ {
@ -108,10 +111,10 @@ s32 sys_lwmutex_t::trylock(be_t<u32> tid)
if (old_owner == 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(); auto rv = recursive_count.read_relaxed();
if (!~(rv++).ToBE()) if (!~(rv++).data())
{ {
return CELL_EKRESOURCE; return CELL_EKRESOURCE;
} }
@ -142,7 +145,7 @@ s32 sys_lwmutex_t::unlock(be_t<u32> tid)
} }
auto rv = recursive_count.read_relaxed(); 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); sys_lwmutex.Error("sys_lwmutex_t::unlock(%d): wrong recursive value fixed (%d)", (u32)sleep_queue, (u32)rv);
rv = 1; rv = 1;
@ -150,7 +153,7 @@ s32 sys_lwmutex_t::unlock(be_t<u32> tid)
rv--; rv--;
recursive_count.exchange(rv); recursive_count.exchange(rv);
if (!rv.ToBE()) if (!rv.data())
{ {
std::shared_ptr<sleep_queue_t> sq; std::shared_ptr<sleep_queue_t> sq;
if (!Emu.GetIdManager().GetIDData(sleep_queue, 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) while (true)
{ {
auto old_owner = owner.compare_and_swap(be_t<u32>::make(0), tid); 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; 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()); 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_FIFO): break;
case se32(SYS_SYNC_PRIORITY): 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_PRIORITY_INHERIT): sys_mutex.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_RETRY): sys_mutex.Error("sys_mutex_create(): SYS_SYNC_RETRY"); return CELL_EINVAL; case se32(SYS_SYNC_RETRY): sys_mutex.Error("Invalid protocol (SYS_SYNC_RETRY)"); return CELL_EINVAL;
default: sys_mutex.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL; default: sys_mutex.Error("Unknown protocol (0x%x)", attr->protocol); return CELL_EINVAL;
} }
bool is_recursive; bool is_recursive;
switch (attr->recursive.ToBE()) switch (attr->recursive.data())
{ {
case se32(SYS_SYNC_RECURSIVE): is_recursive = true; break; case se32(SYS_SYNC_RECURSIVE): is_recursive = true; break;
case se32(SYS_SYNC_NOT_RECURSIVE): is_recursive = false; 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; 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); const u32 id = sys_mutex.GetNewId(mutex, TYPE_MUTEX);
mutex->id.exchange(id); mutex->id.exchange(id);
*mutex_id = id; *mutex_id = id;
mutex->queue.set_full_name(fmt::Format("Mutex(%d)", id)); mutex->queue.set_full_name(fmt::Format("Mutex(%d)", id));
sys_mutex.Warning("*** mutex created [%s] (protocol=0x%x, recursive=%s): id = %d", 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);
std::string(attr->name, 8).c_str(), (u32) attr->protocol, (is_recursive ? "true" : "false"), id);
// TODO: unlock mutex when owner thread does exit // TODO: unlock mutex when owner thread does exit
return CELL_OK; 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) 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); context_id, package_id, a3, a4, a5, a6);
switch(package_id) 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; return CELL_EFAULT;
} }
switch (attr->protocol.ToBE()) switch (attr->protocol.data())
{ {
case se32(SYS_SYNC_PRIORITY): break; 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_PRIORITY_INHERIT): sys_rwlock.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_FIFO): 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; 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); const u32 id = sys_rwlock.GetNewId(rw, TYPE_RWLOCK);
*rw_lock_id = id; *rw_lock_id = id;
rw->wqueue.set_full_name(fmt::Format("Rwlock(%d)", 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); sys_semaphore.Error("sys_semaphore_create(): invalid parameters (initial_count=%d, max_count=%d)", initial_count, max_count);
return CELL_EINVAL; 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_FIFO): break;
case se32(SYS_SYNC_PRIORITY): 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_PRIORITY_INHERIT): sys_semaphore.Todo("SYS_SYNC_PRIORITY_INHERIT"); break;
case se32(SYS_SYNC_RETRY): sys_semaphore.Error("SYS_SYNC_RETRY"); 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)", (u32)attr->protocol); 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); *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()); sys_spinlock.Log("sys_spinlock_lock(lock_addr=0x%x)", lock.addr());
// prx: exchange with 0xabadcafe, repeat until exchanged with 0 // 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 std::this_thread::sleep_for(std::chrono::milliseconds(1)); // hack
if (Emu.IsStopped()) 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()); sys_spinlock.Log("sys_spinlock_trylock(lock_addr=0x%x)", lock.addr());
// prx: exchange with 0xabadcafe, translate exchanged value // 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; 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) 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; std::shared_ptr<timer> timer_data = nullptr;
if(!sys_timer.CheckId(timer_id, timer_data)) return CELL_ESRCH; 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) 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); timer_id, queue_id, name, data1, data2);
std::shared_ptr<timer> timer_data = nullptr; std::shared_ptr<timer> timer_data = nullptr;

View File

@ -34,7 +34,7 @@ namespace loader
be_t<u16> e_shnum; be_t<u16> e_shnum;
be_t<u16> e_shstrndx; 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; } m_ehdr;
struct phdr 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"; 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) 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"; 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) const std::string Phdr_FlagsToString(u32 flags)
@ -105,7 +105,7 @@ const std::string Phdr_FlagsToString(u32 flags)
flags &= ~spu << 0x14; flags &= ~spu << 0x14;
flags &= ~rsx << 0x18; 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 += "PPU[" + FLAGS_TO_STRING(ppu) + "] ";
ret += "SPU[" + FLAGS_TO_STRING(spu) + "] "; ret += "SPU[" + FLAGS_TO_STRING(spu) + "] ";
@ -125,5 +125,5 @@ const std::string Phdr_TypeToString(const u32 type)
case 0x60000002: return "LOOS+2"; 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); 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; std::string shader;
GLParamArray param_array; GLParamArray param_array;