mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 04:02:42 +01:00
re32/se32/... macro eliminated, some fixes
This commit is contained in:
parent
ef6f9f6ded
commit
39f836b495
@ -443,34 +443,16 @@ static force_inline u128 sync_fetch_and_xor(volatile u128* dest, u128 value)
|
||||
}
|
||||
}
|
||||
|
||||
#define re16(val) _byteswap_ushort(val)
|
||||
#define re32(val) _byteswap_ulong(val)
|
||||
#define re64(val) _byteswap_uint64(val)
|
||||
#define re128(val) u128::byteswap(val)
|
||||
|
||||
template<typename T, int size = sizeof(T)> struct se_t;
|
||||
|
||||
template<typename T> struct se_t<T, 1>
|
||||
{
|
||||
static force_inline u8 to_be(const T& src)
|
||||
{
|
||||
return (u8&)src;
|
||||
}
|
||||
|
||||
static force_inline T from_be(const u8 src)
|
||||
{
|
||||
return (T&)src;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T> struct se_t<T, 2>
|
||||
{
|
||||
static force_inline u16 to_be(const T& src)
|
||||
static force_inline u16 to(const T& src)
|
||||
{
|
||||
return _byteswap_ushort((u16&)src);
|
||||
}
|
||||
|
||||
static force_inline T from_be(const u16 src)
|
||||
static force_inline T from(const u16 src)
|
||||
{
|
||||
const u16 res = _byteswap_ushort(src);
|
||||
return (T&)res;
|
||||
@ -479,12 +461,12 @@ template<typename T> struct se_t<T, 2>
|
||||
|
||||
template<typename T> struct se_t<T, 4>
|
||||
{
|
||||
static force_inline u32 to_be(const T& src)
|
||||
static force_inline u32 to(const T& src)
|
||||
{
|
||||
return _byteswap_ulong((u32&)src);
|
||||
}
|
||||
|
||||
static force_inline T from_be(const u32 src)
|
||||
static force_inline T from(const u32 src)
|
||||
{
|
||||
const u32 res = _byteswap_ulong(src);
|
||||
return (T&)res;
|
||||
@ -493,12 +475,12 @@ template<typename T> struct se_t<T, 4>
|
||||
|
||||
template<typename T> struct se_t<T, 8>
|
||||
{
|
||||
static force_inline u64 to_be(const T& src)
|
||||
static force_inline u64 to(const T& src)
|
||||
{
|
||||
return _byteswap_uint64((u64&)src);
|
||||
}
|
||||
|
||||
static force_inline T from_be(const u64 src)
|
||||
static force_inline T from(const u64 src)
|
||||
{
|
||||
const u64 res = _byteswap_uint64(src);
|
||||
return (T&)res;
|
||||
@ -507,12 +489,12 @@ template<typename T> struct se_t<T, 8>
|
||||
|
||||
template<typename T> struct se_t<T, 16>
|
||||
{
|
||||
static force_inline u128 to_be(const T& src)
|
||||
static force_inline u128 to(const T& src)
|
||||
{
|
||||
return u128::byteswap((u128&)src);
|
||||
}
|
||||
|
||||
static force_inline T from_be(const u128& src)
|
||||
static force_inline T from(const u128& src)
|
||||
{
|
||||
const u128 res = u128::byteswap(src);
|
||||
return (T&)res;
|
||||
@ -582,6 +564,7 @@ template<typename T> using be_storage_t = typename be_storage<T>::type;
|
||||
|
||||
template<typename T> class be_t
|
||||
{
|
||||
// TODO (complicated cases like int-float conversions are not handled correctly)
|
||||
template<typename Tto, typename Tfrom, int mode>
|
||||
struct _convert
|
||||
{
|
||||
@ -634,9 +617,9 @@ public:
|
||||
|
||||
be_t(const be_t&) = default;
|
||||
|
||||
template<typename CT, typename = std::enable_if_t<std::is_constructible<type, CT>::value>> be_t(const CT& value)
|
||||
template<typename = std::enable_if_t<std::is_constructible<type, type>::value>> be_t(const type& value)
|
||||
#ifdef IS_LE_MACHINE
|
||||
: m_data(se_t<type, sizeof(stype)>::to_be(value))
|
||||
: m_data(se_t<type, sizeof(stype)>::to(value))
|
||||
#else
|
||||
: m_data(value)
|
||||
#endif
|
||||
@ -647,7 +630,7 @@ public:
|
||||
force_inline type value() const
|
||||
{
|
||||
#ifdef IS_LE_MACHINE
|
||||
return se_t<type, sizeof(stype)>::from_be(m_data);
|
||||
return se_t<type, sizeof(stype)>::from(m_data);
|
||||
#else
|
||||
return m_data;
|
||||
#endif
|
||||
@ -667,7 +650,11 @@ public:
|
||||
|
||||
template<typename CT> std::enable_if_t<std::is_assignable<type&, CT>::value, be_t&> operator =(const CT& value)
|
||||
{
|
||||
m_data = se_t<type, sizeof(stype)>::to_be(value);
|
||||
#ifdef IS_LE_MACHINE
|
||||
m_data = se_t<type, sizeof(stype)>::to(value);
|
||||
#else
|
||||
m_data = value;
|
||||
#endif
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -683,13 +670,11 @@ public:
|
||||
}
|
||||
|
||||
// conversion to another be_t type
|
||||
template<typename T1> operator be_t<T1>() const
|
||||
{
|
||||
return value();
|
||||
|
||||
// TODO (complicated cases like int-float conversions are not handled correctly)
|
||||
//return _convert<T1, T, ((sizeof(T1) > sizeof(T)) ? 1 : (sizeof(T1) < sizeof(T) ? 2 : 0))>::func(m_data);
|
||||
}
|
||||
//template<typename T1> operator be_t<T1>() const
|
||||
//{
|
||||
// return value();
|
||||
// //return _convert<T1, T, ((sizeof(T1) > sizeof(T)) ? 1 : (sizeof(T1) < sizeof(T) ? 2 : 0))>::func(m_data);
|
||||
//}
|
||||
|
||||
template<typename T1> be_t& operator +=(const T1& right) { return *this = value() + right; }
|
||||
template<typename T1> be_t& operator -=(const T1& right) { return *this = value() - right; }
|
||||
@ -791,11 +776,6 @@ template<> struct to_be<char> { using type = char; };
|
||||
template<> struct to_be<u8> { using type = u8; };
|
||||
template<> struct to_be<s8> { using type = s8; };
|
||||
|
||||
template<typename T, typename T1, T1 value> struct _se : public const_se_t<T, value> {};
|
||||
template<typename T, typename T1, T1 value> struct _se<be_t<T>, T1, value> : public const_se_t<T, value> {};
|
||||
|
||||
#define se32(x) _se<u32, decltype(x), x>::value
|
||||
|
||||
template<typename T> class le_t
|
||||
{
|
||||
public:
|
||||
@ -816,7 +796,7 @@ public:
|
||||
|
||||
le_t(const le_t&) = default;
|
||||
|
||||
template<typename CT, typename = std::enable_if_t<std::is_constructible<type, CT>::value>> le_t(const CT& value)
|
||||
template<typename = std::enable_if_t<std::is_constructible<type, type>::value>> le_t(const type& value)
|
||||
: m_data(value)
|
||||
{
|
||||
}
|
||||
@ -845,10 +825,10 @@ public:
|
||||
}
|
||||
|
||||
// conversion to another le_t type
|
||||
template<typename T1> operator le_t<T1>() const
|
||||
{
|
||||
return value();
|
||||
}
|
||||
//template<typename T1> operator le_t<T1>() const
|
||||
//{
|
||||
// return value();
|
||||
//}
|
||||
|
||||
template<typename T1> le_t& operator +=(const T1& right) { return *this = value() + right; }
|
||||
template<typename T1> le_t& operator -=(const T1& right) { return *this = value() - right; }
|
||||
|
@ -827,7 +827,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
|
||||
case X64OP_LOAD:
|
||||
{
|
||||
u32 value;
|
||||
if (is_writing || !spu.ReadReg(addr, value) || !put_x64_reg_value(context, reg, d_size, re32(value)))
|
||||
if (is_writing || !spu.ReadReg(addr, value) || !put_x64_reg_value(context, reg, d_size, _byteswap_ulong(value)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -837,7 +837,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
|
||||
case X64OP_STORE:
|
||||
{
|
||||
u64 reg_value;
|
||||
if (!is_writing || !get_x64_reg_value(context, reg, d_size, i_size, reg_value) || !spu.WriteReg(addr, re32((u32)reg_value)))
|
||||
if (!is_writing || !get_x64_reg_value(context, reg, d_size, i_size, reg_value) || !spu.WriteReg(addr, _byteswap_ulong((u32)reg_value)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ bool UnpackEntry(const fs::file& dec_pkg_f, const PKGEntry& entry, std::string d
|
||||
dec_pkg_f.read(buf, entry.name_size);
|
||||
buf[entry.name_size] = 0;
|
||||
|
||||
switch (entry.type.data() >> 24)
|
||||
switch (entry.type & 0xff)
|
||||
{
|
||||
case PKG_FILE_ENTRY_NPDRM:
|
||||
case PKG_FILE_ENTRY_NPDRMEDAT:
|
||||
|
@ -102,34 +102,34 @@ force_inline void Write64LE(const fs::file& f, const u64 data)
|
||||
f.write(&data, sizeof(data));
|
||||
}
|
||||
|
||||
force_inline void Write16(vfsStream& f, const u16 data)
|
||||
force_inline void Write16(vfsStream& f, const be_t<u16> data)
|
||||
{
|
||||
Write16LE(f, re16(data));
|
||||
f.Write(&data, sizeof(data));
|
||||
}
|
||||
|
||||
force_inline void Write16(const fs::file& f, const u16 data)
|
||||
force_inline void Write16(const fs::file& f, const be_t<u16> data)
|
||||
{
|
||||
Write16LE(f, re16(data));
|
||||
f.write(&data, sizeof(data));
|
||||
}
|
||||
|
||||
force_inline void Write32(vfsStream& f, const u32 data)
|
||||
force_inline void Write32(vfsStream& f, const be_t<u32> data)
|
||||
{
|
||||
Write32LE(f, re32(data));
|
||||
f.Write(&data, sizeof(data));
|
||||
}
|
||||
|
||||
force_inline void Write32(const fs::file& f, const u32 data)
|
||||
force_inline void Write32(const fs::file& f, const be_t<u32> data)
|
||||
{
|
||||
Write32LE(f, re32(data));
|
||||
f.write(&data, sizeof(data));
|
||||
}
|
||||
|
||||
force_inline void Write64(vfsStream& f, const u64 data)
|
||||
force_inline void Write64(vfsStream& f, const be_t<u64> data)
|
||||
{
|
||||
Write64LE(f, re64(data));
|
||||
f.Write(&data, sizeof(data));
|
||||
}
|
||||
|
||||
force_inline void Write64(const fs::file& f, const u64 data)
|
||||
force_inline void Write64(const fs::file& f, const be_t<u64> data)
|
||||
{
|
||||
Write64LE(f, re64(data));
|
||||
f.write(&data, sizeof(data));
|
||||
}
|
||||
|
||||
void WriteEhdr(const fs::file& f, Elf64_Ehdr& ehdr)
|
||||
|
@ -3699,7 +3699,7 @@ void ARMv7_instrs::REV(ARMv7Context& context, const ARMv7Code code, const ARMv7_
|
||||
|
||||
if (ConditionPassed(context, cond))
|
||||
{
|
||||
context.write_gpr(d, re32(context.read_gpr(m)));
|
||||
context.write_gpr(d, _byteswap_ulong(context.read_gpr(m)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ Executable Compiler::Compile(const std::string & name, const ControlFlowGraph &
|
||||
}
|
||||
|
||||
if (instr_bb->empty()) {
|
||||
u32 instr = re32(vm::get_ref<u32>(m_state.current_instruction_address));
|
||||
u32 instr = vm::ps3::read32(m_state.current_instruction_address);
|
||||
Decode(instr);
|
||||
if (!m_state.hit_branch_instruction) {
|
||||
m_ir_builder->CreateBr(GetBasicBlockFromAddress(m_state.current_instruction_address + 4));
|
||||
@ -6025,7 +6025,7 @@ u32 ppu_recompiler_llvm::ExecutionEngine::ExecuteTillReturn(PPUThread * ppu_stat
|
||||
}
|
||||
} else {
|
||||
execution_engine->m_tracer.Trace(Tracer::TraceType::Instruction, ppu_state->PC, 0);
|
||||
auto instruction = re32(vm::get_ref<u32>(ppu_state->PC));
|
||||
u32 instruction = vm::ps3::read32(ppu_state->PC);
|
||||
execution_engine->m_decoder.Decode(instruction);
|
||||
branch_type = ppu_state->m_is_branch ? GetBranchTypeFromInstruction(instruction) : BranchType::NonBranch;
|
||||
ppu_state->NextPc(4);
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
struct SPURecEntry
|
||||
{
|
||||
u32 count; // count of instructions compiled from current point (and to be checked)
|
||||
u32 valid; // copy of valid opcode for validation
|
||||
be_t<u32> _valid; // copy of valid opcode for validation
|
||||
void* pointer; // pointer to executable memory object
|
||||
};
|
||||
|
||||
|
@ -95,9 +95,9 @@ void SPURecompilerCore::Compile(u16 pos)
|
||||
|
||||
while (true)
|
||||
{
|
||||
const u32 opcode = vm::ps3::read32(CPU.offset + pos * 4);
|
||||
const be_t<u32> opcode = vm::ps3::read32(CPU.offset + pos * 4);
|
||||
m_enc->do_finalize = false;
|
||||
if (opcode)
|
||||
if (opcode.data())
|
||||
{
|
||||
//const u64 stamp1 = get_system_time();
|
||||
// disasm for logging:
|
||||
@ -120,11 +120,11 @@ void SPURecompilerCore::Compile(u16 pos)
|
||||
m_enc->do_finalize = true;
|
||||
}
|
||||
bool fin = m_enc->do_finalize;
|
||||
//if (entry[pos].valid == re32(opcode))
|
||||
//if (entry[pos]._valid == opcode)
|
||||
//{
|
||||
// excess++;
|
||||
//}
|
||||
entry[pos].valid = re32(opcode);
|
||||
entry[pos]._valid = opcode;
|
||||
|
||||
if (fin) break;
|
||||
CPU.PC += 4;
|
||||
@ -169,7 +169,7 @@ void SPURecompilerCore::Compile(u16 pos)
|
||||
u32 SPURecompilerCore::DecodeMemory(const u32 address)
|
||||
{
|
||||
const u32 pos = CPU.PC >> 2; // 0x0..0xffff
|
||||
const auto ls = vm::get_ptr<u32>(CPU.offset);
|
||||
const auto _ls = vm::get_ptr<be_t<u32>>(CPU.offset);
|
||||
|
||||
assert(CPU.offset == address - CPU.PC && pos < 0x10000);
|
||||
|
||||
@ -182,7 +182,7 @@ u32 SPURecompilerCore::DecodeMemory(const u32 address)
|
||||
{
|
||||
for (u32 i = 0; i < 0x10000; i++)
|
||||
{
|
||||
if (entry[i].valid && entry[i].valid != ls[i])
|
||||
if (entry[i]._valid.data() && entry[i]._valid != _ls[i])
|
||||
{
|
||||
is_valid = false;
|
||||
break;
|
||||
@ -199,14 +199,14 @@ u32 SPURecompilerCore::DecodeMemory(const u32 address)
|
||||
{
|
||||
if (!entry[i].pointer) continue;
|
||||
|
||||
if (!entry[i].valid || entry[i].valid != ls[i] || (i + entry[i].count > pos && i < pos + entry[pos].count))
|
||||
if (!entry[i]._valid.data() || entry[i]._valid != _ls[i] || (i + entry[i].count > pos && i < pos + entry[pos].count))
|
||||
{
|
||||
m_jit->release(entry[i].pointer);
|
||||
entry[i].pointer = nullptr;
|
||||
|
||||
for (u32 j = i; j < i + entry[i].count; j++)
|
||||
{
|
||||
entry[j].valid = 0;
|
||||
entry[j]._valid = 0;
|
||||
}
|
||||
|
||||
//need_check = true;
|
||||
@ -225,9 +225,9 @@ u32 SPURecompilerCore::DecodeMemory(const u32 address)
|
||||
return 0;
|
||||
}
|
||||
|
||||
const auto func = asmjit_cast<u32(*)(SPUThread& _cpu, u32* _ls, const void* _imm, const void* _g_imm)>(entry[pos].pointer);
|
||||
const auto func = asmjit_cast<u32(*)(SPUThread& _cpu, be_t<u32>* _ls, const void* _imm, const void* _g_imm)>(entry[pos].pointer);
|
||||
|
||||
u32 res = func(CPU, ls, imm_table.data(), &g_spu_imm);
|
||||
u32 res = func(CPU, _ls, imm_table.data(), &g_spu_imm);
|
||||
|
||||
if (res & 0x1000000)
|
||||
{
|
||||
|
@ -227,7 +227,7 @@ void CgBinaryDisasm::TaskFP()
|
||||
assert((m_buffer_size - m_offset) % sizeof(u32) == 0);
|
||||
for (u32 i = 0; i < (m_buffer_size - m_offset) / sizeof(u32); i++)
|
||||
{
|
||||
data[i] = re32(data[i]);
|
||||
data[i] = _byteswap_ulong(data[i]); // WTF, cannot use be_t<> there?
|
||||
}
|
||||
|
||||
enum
|
||||
|
@ -365,7 +365,7 @@ public:
|
||||
assert((m_buffer_size - m_offset) % sizeof(u32) == 0);
|
||||
for (u32 i = 0; i < (m_buffer_size - m_offset) / sizeof(u32); i++)
|
||||
{
|
||||
vdata[i] = re32(vdata[i]);
|
||||
vdata[i] = _byteswap_ulong(vdata[i]); // WTF, cannot use be_t<> there?
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < prog.ucodeSize / sizeof(u32); i++)
|
||||
|
@ -101,17 +101,17 @@ void RSXVertexData::Load(u32 start, u32 count, u32 baseOffset, u32 baseIndex = 0
|
||||
|
||||
case 2:
|
||||
{
|
||||
const u16* c_src = (const u16*)src;
|
||||
u16* c_dst = (u16*)dst;
|
||||
for (u32 j = 0; j < size; ++j) *c_dst++ = re16(*c_src++);
|
||||
auto c_src = (const be_t<u16>*)src;
|
||||
auto c_dst = (u16*)dst;
|
||||
for (u32 j = 0; j < size; ++j) *c_dst++ = *c_src++;
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
{
|
||||
const u32* c_src = (const u32*)src;
|
||||
u32* c_dst = (u32*)dst;
|
||||
for (u32 j = 0; j < size; ++j) *c_dst++ = re32(*c_src++);
|
||||
auto c_src = (const be_t<u32>*)src;
|
||||
auto c_dst = (u32*)dst;
|
||||
for (u32 j = 0; j < size; ++j) *c_dst++ = *c_src++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -59,8 +59,8 @@ u32 add_ppu_func_sub(const char group[8], const SearchPatternEntry ops[], const
|
||||
{
|
||||
SearchPatternEntry op;
|
||||
op.type = ops[i].type;
|
||||
op.data = re32(ops[i].data);
|
||||
op.mask = re32(ops[i].mask);
|
||||
op.data = _byteswap_ulong(ops[i].data); // TODO: use be_t<>
|
||||
op.mask = _byteswap_ulong(ops[i].mask);
|
||||
op.num = ops[i].num;
|
||||
assert(!op.mask || (op.data & ~op.mask) == 0);
|
||||
sf.ops.push_back(op);
|
||||
@ -250,7 +250,7 @@ void hook_ppu_func(vm::ptr<u32> base, u32 pos, u32 size)
|
||||
}
|
||||
|
||||
// skip NOP
|
||||
if (base[k].data() == se32(0x60000000))
|
||||
if (base[k] == 0x60000000)
|
||||
{
|
||||
x--;
|
||||
continue;
|
||||
@ -308,7 +308,7 @@ void hook_ppu_func(vm::ptr<u32> base, u32 pos, u32 size)
|
||||
break;
|
||||
}
|
||||
|
||||
const auto addr = (base[k].data() & se32(2) ? 0 : (base + k).addr()) + ((s32)base[k] << cntlz32(mask) >> (cntlz32(mask) + 2));
|
||||
const auto addr = (base[k] & 2 ? 0 : (base + k).addr()) + ((s32)base[k] << cntlz32(mask) >> (cntlz32(mask) + 2));
|
||||
const auto lnum = sub.ops[x].num;
|
||||
const auto label = sub.labels.find(lnum);
|
||||
|
||||
@ -331,7 +331,7 @@ void hook_ppu_func(vm::ptr<u32> base, u32 pos, u32 size)
|
||||
// break;
|
||||
// }
|
||||
|
||||
// const auto addr = (base[k].data() & se32(2) ? 0 : (base + k).addr()) + ((s32)base[k] << cntlz32(mask) >> (cntlz32(mask) + 2));
|
||||
// const auto addr = (base[k] & 2 ? 0 : (base + k).addr()) + ((s32)base[k] << cntlz32(mask) >> (cntlz32(mask) + 2));
|
||||
// const auto nid = sub.ops[x].num;
|
||||
// // TODO: recursive call
|
||||
//}
|
||||
@ -376,7 +376,7 @@ void hook_ppu_funcs(vm::ptr<u32> base, u32 size)
|
||||
for (u32 i = 0; i < size; i++)
|
||||
{
|
||||
// skip NOP
|
||||
if (base[i].data() == se32(0x60000000))
|
||||
if (base[i] == 0x60000000)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ s32 cellFsStReadInit(u32 fd, vm::cptr<CellFsRingBuffer> ringbuf)
|
||||
{
|
||||
cellFs.Warning("cellFsStReadInit(fd=0x%x, ringbuf=*0x%x)", fd, ringbuf);
|
||||
|
||||
if (ringbuf->copy.data() & ~se32(CELL_FS_ST_COPYLESS))
|
||||
if (ringbuf->copy & ~CELL_FS_ST_COPYLESS)
|
||||
{
|
||||
return CELL_FS_EINVAL;
|
||||
}
|
||||
@ -352,7 +352,7 @@ s32 cellFsStReadInit(u32 fd, vm::cptr<CellFsRingBuffer> ringbuf)
|
||||
file->st_ringbuf_size = ringbuf->ringbuf_size;
|
||||
file->st_block_size = ringbuf->ringbuf_size;
|
||||
file->st_trans_rate = ringbuf->transfer_rate;
|
||||
file->st_copyless = ringbuf->copy.data() == se32(CELL_FS_ST_COPYLESS);
|
||||
file->st_copyless = ringbuf->copy == CELL_FS_ST_COPYLESS;
|
||||
|
||||
const u64 alloc_size = align(file->st_ringbuf_size, file->st_ringbuf_size < 1024 * 1024 ? 64 * 1024 : 1024 * 1024);
|
||||
|
||||
@ -776,17 +776,17 @@ int sdata_unpack(const std::string& packed_file, const std::string& unpacked_fil
|
||||
|
||||
char buffer[10200];
|
||||
packed_stream->Read(buffer, 256);
|
||||
u32 format = re32(*(u32*)&buffer[0]);
|
||||
u32 format = *(be_t<u32>*)&buffer[0];
|
||||
if (format != 0x4E504400) // "NPD\x00"
|
||||
{
|
||||
cellFs.Error("Illegal format. Expected 0x4E504400, but got 0x%08x", format);
|
||||
return CELL_EFSSPECIFIC;
|
||||
}
|
||||
|
||||
u32 version = re32(*(u32*)&buffer[0x04]);
|
||||
u32 flags = re32(*(u32*)&buffer[0x80]);
|
||||
u32 blockSize = re32(*(u32*)&buffer[0x84]);
|
||||
u64 filesizeOutput = re64(*(u64*)&buffer[0x88]);
|
||||
u32 version = *(be_t<u32>*)&buffer[0x04];
|
||||
u32 flags = *(be_t<u32>*)&buffer[0x80];
|
||||
u32 blockSize = *(be_t<u32>*)&buffer[0x84];
|
||||
u64 filesizeOutput = *(be_t<u64>*)&buffer[0x88];
|
||||
u64 filesizeInput = packed_stream->GetSize();
|
||||
u32 blockCount = (u32)((filesizeOutput + blockSize - 1) / blockSize);
|
||||
|
||||
|
@ -50,13 +50,13 @@ s32 cellGifDecOpen(
|
||||
current_subHandle->fd = 0;
|
||||
current_subHandle->src = *src;
|
||||
|
||||
switch(src->srcSelect.data())
|
||||
switch (src->srcSelect.value())
|
||||
{
|
||||
case se32(CELL_GIFDEC_BUFFER):
|
||||
case CELL_GIFDEC_BUFFER:
|
||||
current_subHandle->fileSize = src->streamSize;
|
||||
break;
|
||||
|
||||
case se32(CELL_GIFDEC_FILE):
|
||||
case CELL_GIFDEC_FILE:
|
||||
{
|
||||
// Get file descriptor and size
|
||||
std::shared_ptr<vfsStream> file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead));
|
||||
@ -95,13 +95,13 @@ s32 cellGifDecReadHeader(
|
||||
//Write the header to buffer
|
||||
vm::var<u8[13]> buffer; // Alloc buffer for GIF header
|
||||
|
||||
switch(subHandle_data->src.srcSelect.data())
|
||||
switch(subHandle_data->src.srcSelect.value())
|
||||
{
|
||||
case se32(CELL_GIFDEC_BUFFER):
|
||||
case CELL_GIFDEC_BUFFER:
|
||||
memmove(buffer.begin(), subHandle_data->src.streamPtr.get_ptr(), buffer.size());
|
||||
break;
|
||||
|
||||
case se32(CELL_GIFDEC_FILE):
|
||||
case CELL_GIFDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(fd);
|
||||
file->file->Seek(0);
|
||||
@ -192,13 +192,13 @@ s32 cellGifDecDecodeData(
|
||||
//Copy the GIF file to a buffer
|
||||
vm::var<unsigned char[]> gif((u32)fileSize);
|
||||
|
||||
switch(subHandle_data->src.srcSelect.data())
|
||||
switch(subHandle_data->src.srcSelect.value())
|
||||
{
|
||||
case se32(CELL_GIFDEC_BUFFER):
|
||||
case CELL_GIFDEC_BUFFER:
|
||||
memmove(gif.begin(), subHandle_data->src.streamPtr.get_ptr(), gif.size());
|
||||
break;
|
||||
|
||||
case se32(CELL_GIFDEC_FILE):
|
||||
case CELL_GIFDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(fd);
|
||||
file->file->Seek(0);
|
||||
|
@ -44,13 +44,13 @@ s32 cellJpgDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellJpgDecSrc
|
||||
current_subHandle->fd = 0;
|
||||
current_subHandle->src = *src;
|
||||
|
||||
switch(src->srcSelect.data())
|
||||
switch(src->srcSelect.value())
|
||||
{
|
||||
case se32(CELL_JPGDEC_BUFFER):
|
||||
case CELL_JPGDEC_BUFFER:
|
||||
current_subHandle->fileSize = src->streamSize;
|
||||
break;
|
||||
|
||||
case se32(CELL_JPGDEC_FILE):
|
||||
case CELL_JPGDEC_FILE:
|
||||
{
|
||||
// Get file descriptor and size
|
||||
std::shared_ptr<vfsStream> file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead));
|
||||
@ -103,13 +103,13 @@ s32 cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellJpgDecInfo>
|
||||
//Write the header to buffer
|
||||
vm::var<u8[]> buffer((u32)fileSize);
|
||||
|
||||
switch(subHandle_data->src.srcSelect.data())
|
||||
switch(subHandle_data->src.srcSelect.value())
|
||||
{
|
||||
case se32(CELL_JPGDEC_BUFFER):
|
||||
case CELL_JPGDEC_BUFFER:
|
||||
memmove(buffer.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), buffer.size());
|
||||
break;
|
||||
|
||||
case se32(CELL_JPGDEC_FILE):
|
||||
case CELL_JPGDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(fd);
|
||||
file->file->Seek(0);
|
||||
@ -177,13 +177,13 @@ s32 cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data, vm::cp
|
||||
//Copy the JPG file to a buffer
|
||||
vm::var<unsigned char[]> jpg((u32)fileSize);
|
||||
|
||||
switch(subHandle_data->src.srcSelect.data())
|
||||
switch(subHandle_data->src.srcSelect.value())
|
||||
{
|
||||
case se32(CELL_JPGDEC_BUFFER):
|
||||
case CELL_JPGDEC_BUFFER:
|
||||
memmove(jpg.begin(), vm::get_ptr<void>(subHandle_data->src.streamPtr), jpg.size());
|
||||
break;
|
||||
|
||||
case se32(CELL_JPGDEC_FILE):
|
||||
case CELL_JPGDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(fd);
|
||||
file->file->Seek(0);
|
||||
|
@ -76,13 +76,13 @@ s32 pngDecOpen(
|
||||
stream->fd = 0;
|
||||
stream->src = *src;
|
||||
|
||||
switch (src->srcSelect.data())
|
||||
switch (src->srcSelect.value())
|
||||
{
|
||||
case se32(CELL_PNGDEC_BUFFER):
|
||||
case CELL_PNGDEC_BUFFER:
|
||||
stream->fileSize = src->streamSize;
|
||||
break;
|
||||
|
||||
case se32(CELL_PNGDEC_FILE):
|
||||
case CELL_PNGDEC_FILE:
|
||||
{
|
||||
// Get file descriptor and size
|
||||
std::shared_ptr<vfsStream> file_s(Emu.GetVFS().OpenFile(src->fileName.get_ptr(), vfsRead));
|
||||
@ -141,12 +141,12 @@ s32 pngReadHeader(
|
||||
vm::var<u8[34]> buffer; // Alloc buffer for PNG header
|
||||
auto buffer_32 = buffer.To<be_t<u32>>();
|
||||
|
||||
switch (stream->src.srcSelect.data())
|
||||
switch (stream->src.srcSelect.value())
|
||||
{
|
||||
case se32(CELL_PNGDEC_BUFFER):
|
||||
case CELL_PNGDEC_BUFFER:
|
||||
memmove(buffer.begin(), stream->src.streamPtr.get_ptr(), buffer.size());
|
||||
break;
|
||||
case se32(CELL_PNGDEC_FILE):
|
||||
case CELL_PNGDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(stream->fd);
|
||||
file->file->Seek(0);
|
||||
@ -155,9 +155,9 @@ s32 pngReadHeader(
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
if (buffer_32[0] != 0x89504E47 ||
|
||||
buffer_32[1] != 0x0D0A1A0A || // Error: The first 8 bytes are not a valid PNG signature
|
||||
buffer_32[3] != 0x49484452) // Error: The PNG file does not start with an IHDR chunk
|
||||
{
|
||||
return CELL_PNGDEC_ERROR_HEADER;
|
||||
}
|
||||
@ -205,20 +205,20 @@ s32 pngDecSetParameter(
|
||||
current_outParam.outputHeight = current_info.imageHeight;
|
||||
current_outParam.outputColorSpace = inParam->outputColorSpace;
|
||||
|
||||
switch (current_outParam.outputColorSpace.data())
|
||||
switch (current_outParam.outputColorSpace.value())
|
||||
{
|
||||
case se32(CELL_PNGDEC_PALETTE):
|
||||
case se32(CELL_PNGDEC_GRAYSCALE):
|
||||
case CELL_PNGDEC_PALETTE:
|
||||
case CELL_PNGDEC_GRAYSCALE:
|
||||
current_outParam.outputComponents = 1; break;
|
||||
|
||||
case se32(CELL_PNGDEC_GRAYSCALE_ALPHA):
|
||||
case CELL_PNGDEC_GRAYSCALE_ALPHA:
|
||||
current_outParam.outputComponents = 2; break;
|
||||
|
||||
case se32(CELL_PNGDEC_RGB):
|
||||
case CELL_PNGDEC_RGB:
|
||||
current_outParam.outputComponents = 3; break;
|
||||
|
||||
case se32(CELL_PNGDEC_RGBA):
|
||||
case se32(CELL_PNGDEC_ARGB):
|
||||
case CELL_PNGDEC_RGBA:
|
||||
case CELL_PNGDEC_ARGB:
|
||||
current_outParam.outputComponents = 4; break;
|
||||
|
||||
default:
|
||||
@ -252,13 +252,13 @@ s32 pngDecodeData(
|
||||
//Copy the PNG file to a buffer
|
||||
vm::var<unsigned char[]> png((u32)fileSize);
|
||||
|
||||
switch (stream->src.srcSelect.data())
|
||||
switch (stream->src.srcSelect.value())
|
||||
{
|
||||
case se32(CELL_PNGDEC_BUFFER):
|
||||
case CELL_PNGDEC_BUFFER:
|
||||
memmove(png.begin(), stream->src.streamPtr.get_ptr(), png.size());
|
||||
break;
|
||||
|
||||
case se32(CELL_PNGDEC_FILE):
|
||||
case CELL_PNGDEC_FILE:
|
||||
{
|
||||
auto file = Emu.GetIdManager().get<lv2_file_t>(stream->fd);
|
||||
file->file->Seek(0);
|
||||
@ -284,10 +284,10 @@ s32 pngDecodeData(
|
||||
const int bytesPerLine = (u32)dataCtrlParam->outputBytesPerLine;
|
||||
uint image_size = width * height;
|
||||
|
||||
switch (current_outParam.outputColorSpace.data())
|
||||
switch (current_outParam.outputColorSpace.value())
|
||||
{
|
||||
case se32(CELL_PNGDEC_RGB):
|
||||
case se32(CELL_PNGDEC_RGBA):
|
||||
case CELL_PNGDEC_RGB:
|
||||
case CELL_PNGDEC_RGBA:
|
||||
{
|
||||
const char nComponents = current_outParam.outputColorSpace == CELL_PNGDEC_RGBA ? 4 : 3;
|
||||
image_size *= nComponents;
|
||||
@ -308,7 +308,7 @@ s32 pngDecodeData(
|
||||
break;
|
||||
}
|
||||
|
||||
case se32(CELL_PNGDEC_ARGB):
|
||||
case CELL_PNGDEC_ARGB:
|
||||
{
|
||||
const int nComponents = 4;
|
||||
image_size *= nComponents;
|
||||
@ -350,9 +350,9 @@ s32 pngDecodeData(
|
||||
break;
|
||||
}
|
||||
|
||||
case se32(CELL_PNGDEC_GRAYSCALE):
|
||||
case se32(CELL_PNGDEC_PALETTE):
|
||||
case se32(CELL_PNGDEC_GRAYSCALE_ALPHA):
|
||||
case CELL_PNGDEC_GRAYSCALE:
|
||||
case CELL_PNGDEC_PALETTE:
|
||||
case CELL_PNGDEC_GRAYSCALE_ALPHA:
|
||||
cellPngDec.Error("pngDecodeData: Unsupported color space (%d)", current_outParam.outputColorSpace);
|
||||
break;
|
||||
|
||||
|
@ -555,7 +555,7 @@ never_inline s32 savedata_op(
|
||||
}
|
||||
}
|
||||
|
||||
psf.SetInteger("*" + file_path, fileSet->fileType.data() == se32(CELL_SAVEDATA_FILETYPE_SECUREFILE));
|
||||
psf.SetInteger("*" + file_path, fileSet->fileType == CELL_SAVEDATA_FILETYPE_SECUREFILE);
|
||||
|
||||
std::string local_path;
|
||||
|
||||
|
@ -2311,7 +2311,7 @@ s32 spursAddWorkload(
|
||||
v &= ~0xf;
|
||||
v |= (maxContention > 8 ? 8 : maxContention);
|
||||
});
|
||||
spurs->wklSignal1._and_not({ 0x8000 >> index }); // clear bit in wklFlag1
|
||||
spurs->wklSignal1._and_not(0x8000 >> index); // clear bit in wklFlag1
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2320,7 +2320,7 @@ s32 spursAddWorkload(
|
||||
v &= ~0xf0;
|
||||
v |= (maxContention > 8 ? 8 : maxContention) << 4;
|
||||
});
|
||||
spurs->wklSignal2._and_not({ 0x8000 >> index }); // clear bit in wklFlag2
|
||||
spurs->wklSignal2._and_not(0x8000 >> index); // clear bit in wklFlag2
|
||||
}
|
||||
|
||||
spurs->wklFlagReceiver.compare_and_swap(wnum, 0xff);
|
||||
@ -2386,7 +2386,7 @@ s32 cellSpursAddWorkloadWithAttribute(vm::ptr<CellSpurs> spurs, vm::ptr<u32> wid
|
||||
return CELL_SPURS_POLICY_MODULE_ERROR_ALIGN;
|
||||
}
|
||||
|
||||
if (attr->revision.data() != se32(1))
|
||||
if (attr->revision != 1)
|
||||
{
|
||||
return CELL_SPURS_POLICY_MODULE_ERROR_INVAL;
|
||||
}
|
||||
|
@ -94,9 +94,9 @@ s32 sys_lwmutex_create(vm::ptr<sys_lwmutex_t> lwmutex, vm::ptr<sys_lwmutex_attri
|
||||
{
|
||||
sysPrxForUser.Warning("sys_lwmutex_create(lwmutex=*0x%x, attr=*0x%x)", lwmutex, attr);
|
||||
|
||||
const bool recursive = attr->recursive.data() == se32(SYS_SYNC_RECURSIVE);
|
||||
const bool recursive = attr->recursive == SYS_SYNC_RECURSIVE;
|
||||
|
||||
if (!recursive && attr->recursive.data() != se32(SYS_SYNC_NOT_RECURSIVE))
|
||||
if (!recursive && attr->recursive != SYS_SYNC_NOT_RECURSIVE)
|
||||
{
|
||||
sysPrxForUser.Error("sys_lwmutex_create(): invalid recursive attribute (0x%x)", attr->recursive);
|
||||
return CELL_EINVAL;
|
||||
@ -160,7 +160,7 @@ s32 sys_lwmutex_lock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex, u64 timeout
|
||||
// try to lock lightweight mutex
|
||||
const be_t<u32> old_owner = lwmutex->vars.owner.compare_and_swap(lwmutex_free, tid);
|
||||
|
||||
if (old_owner.data() == se32(lwmutex_free))
|
||||
if (old_owner == lwmutex_free)
|
||||
{
|
||||
// locking succeeded
|
||||
return CELL_OK;
|
||||
@ -170,7 +170,7 @@ s32 sys_lwmutex_lock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex, u64 timeout
|
||||
{
|
||||
// recursive locking
|
||||
|
||||
if ((lwmutex->attribute.data() & se32(SYS_SYNC_RECURSIVE)) == 0)
|
||||
if ((lwmutex->attribute & SYS_SYNC_RECURSIVE) == 0)
|
||||
{
|
||||
// if not recursive
|
||||
return CELL_EDEADLK;
|
||||
@ -189,7 +189,7 @@ s32 sys_lwmutex_lock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex, u64 timeout
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (old_owner.data() == se32(lwmutex_dead))
|
||||
if (old_owner == lwmutex_dead)
|
||||
{
|
||||
// invalid or deleted mutex
|
||||
return CELL_EINVAL;
|
||||
@ -197,7 +197,7 @@ s32 sys_lwmutex_lock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex, u64 timeout
|
||||
|
||||
for (u32 i = 0; i < 300; i++)
|
||||
{
|
||||
if (lwmutex->vars.owner.read_relaxed().data() == se32(lwmutex_free))
|
||||
if (lwmutex->vars.owner.read_relaxed() == lwmutex_free)
|
||||
{
|
||||
if (lwmutex->vars.owner.compare_and_swap_test(lwmutex_free, tid))
|
||||
{
|
||||
@ -228,7 +228,7 @@ s32 sys_lwmutex_lock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex, u64 timeout
|
||||
// locking succeeded
|
||||
auto old = lwmutex->vars.owner.exchange(tid);
|
||||
|
||||
if (old.data() != se32(lwmutex_reserved) && !Emu.IsStopped())
|
||||
if (old != lwmutex_reserved && !Emu.IsStopped())
|
||||
{
|
||||
sysPrxForUser.Fatal("sys_lwmutex_lock(lwmutex=*0x%x): locking failed (owner=0x%x)", lwmutex, old);
|
||||
}
|
||||
@ -236,7 +236,7 @@ s32 sys_lwmutex_lock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex, u64 timeout
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (res == CELL_EBUSY && lwmutex->attribute.data() & se32(SYS_SYNC_RETRY))
|
||||
if (res == CELL_EBUSY && lwmutex->attribute & SYS_SYNC_RETRY)
|
||||
{
|
||||
// TODO (protocol is ignored in current implementation)
|
||||
throw __FUNCTION__;
|
||||
@ -254,7 +254,7 @@ s32 sys_lwmutex_trylock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex)
|
||||
// try to lock lightweight mutex
|
||||
const be_t<u32> old_owner = lwmutex->vars.owner.compare_and_swap(lwmutex_free, tid);
|
||||
|
||||
if (old_owner.data() == se32(lwmutex_free))
|
||||
if (old_owner == lwmutex_free)
|
||||
{
|
||||
// locking succeeded
|
||||
return CELL_OK;
|
||||
@ -264,7 +264,7 @@ s32 sys_lwmutex_trylock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex)
|
||||
{
|
||||
// recursive locking
|
||||
|
||||
if ((lwmutex->attribute.data() & se32(SYS_SYNC_RECURSIVE)) == 0)
|
||||
if ((lwmutex->attribute & SYS_SYNC_RECURSIVE) == 0)
|
||||
{
|
||||
// if not recursive
|
||||
return CELL_EDEADLK;
|
||||
@ -283,13 +283,13 @@ s32 sys_lwmutex_trylock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (old_owner.data() == se32(lwmutex_dead))
|
||||
if (old_owner == lwmutex_dead)
|
||||
{
|
||||
// invalid or deleted mutex
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (old_owner.data() == se32(lwmutex_reserved))
|
||||
if (old_owner == lwmutex_reserved)
|
||||
{
|
||||
// should be locked by the syscall
|
||||
const s32 res = _sys_lwmutex_trylock(lwmutex->sleep_queue);
|
||||
@ -299,7 +299,7 @@ s32 sys_lwmutex_trylock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex)
|
||||
// locking succeeded
|
||||
auto old = lwmutex->vars.owner.exchange(tid);
|
||||
|
||||
if (old.data() != se32(lwmutex_reserved) && !Emu.IsStopped())
|
||||
if (old != lwmutex_reserved && !Emu.IsStopped())
|
||||
{
|
||||
sysPrxForUser.Fatal("sys_lwmutex_trylock(lwmutex=*0x%x): locking failed (owner=0x%x)", lwmutex, old);
|
||||
}
|
||||
@ -339,7 +339,7 @@ s32 sys_lwmutex_unlock(PPUThread& CPU, vm::ptr<sys_lwmutex_t> lwmutex)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (lwmutex->attribute.data() & se32(SYS_SYNC_RETRY))
|
||||
if (lwmutex->attribute & SYS_SYNC_RETRY)
|
||||
{
|
||||
// TODO (protocol is ignored in current implementation)
|
||||
}
|
||||
@ -386,7 +386,7 @@ s32 sys_lwcond_signal(PPUThread& CPU, vm::ptr<sys_lwcond_t> lwcond)
|
||||
|
||||
const vm::ptr<sys_lwmutex_t> lwmutex = lwcond->lwmutex;
|
||||
|
||||
if ((lwmutex->attribute.data() & se32(SYS_SYNC_ATTR_PROTOCOL_MASK)) == se32(SYS_SYNC_RETRY))
|
||||
if ((lwmutex->attribute & SYS_SYNC_ATTR_PROTOCOL_MASK) == SYS_SYNC_RETRY)
|
||||
{
|
||||
// TODO (protocol ignored)
|
||||
//return _sys_lwcond_signal(lwcond->lwcond_queue, 0, -1, 2);
|
||||
@ -444,7 +444,7 @@ s32 sys_lwcond_signal_all(PPUThread& CPU, vm::ptr<sys_lwcond_t> lwcond)
|
||||
|
||||
const vm::ptr<sys_lwmutex_t> lwmutex = lwcond->lwmutex;
|
||||
|
||||
if ((lwmutex->attribute.data() & se32(SYS_SYNC_ATTR_PROTOCOL_MASK)) == se32(SYS_SYNC_RETRY))
|
||||
if ((lwmutex->attribute & SYS_SYNC_ATTR_PROTOCOL_MASK) == SYS_SYNC_RETRY)
|
||||
{
|
||||
// TODO (protocol ignored)
|
||||
//return _sys_lwcond_signal_all(lwcond->lwcond_queue, lwmutex->sleep_queue, 2);
|
||||
@ -501,7 +501,7 @@ s32 sys_lwcond_signal_to(PPUThread& CPU, vm::ptr<sys_lwcond_t> lwcond, u32 ppu_t
|
||||
|
||||
const vm::ptr<sys_lwmutex_t> lwmutex = lwcond->lwmutex;
|
||||
|
||||
if ((lwmutex->attribute.data() & se32(SYS_SYNC_ATTR_PROTOCOL_MASK)) == se32(SYS_SYNC_RETRY))
|
||||
if ((lwmutex->attribute & SYS_SYNC_ATTR_PROTOCOL_MASK) == SYS_SYNC_RETRY)
|
||||
{
|
||||
// TODO (protocol ignored)
|
||||
//return _sys_lwcond_signal(lwcond->lwcond_queue, 0, ppu_thread_id, 2);
|
||||
@ -588,7 +588,7 @@ s32 sys_lwcond_wait(PPUThread& CPU, vm::ptr<sys_lwcond_t> lwcond, u64 timeout)
|
||||
const auto old = lwmutex->vars.owner.exchange(tid);
|
||||
lwmutex->recursive_count = recursive_value;
|
||||
|
||||
if (old.data() != se32(lwmutex_reserved) && !Emu.IsStopped())
|
||||
if (old != lwmutex_reserved && !Emu.IsStopped())
|
||||
{
|
||||
sysPrxForUser.Fatal("sys_lwcond_wait(lwcond=*0x%x): locking failed (lwmutex->owner=0x%x)", lwcond, old);
|
||||
}
|
||||
@ -617,7 +617,7 @@ s32 sys_lwcond_wait(PPUThread& CPU, vm::ptr<sys_lwcond_t> lwcond, u64 timeout)
|
||||
const auto old = lwmutex->vars.owner.exchange(tid);
|
||||
lwmutex->recursive_count = recursive_value;
|
||||
|
||||
if (old.data() != se32(lwmutex_reserved) && !Emu.IsStopped())
|
||||
if (old != lwmutex_reserved && !Emu.IsStopped())
|
||||
{
|
||||
sysPrxForUser.Fatal("sys_lwcond_wait(lwcond=*0x%x): locking failed after timeout (lwmutex->owner=0x%x)", lwcond, old);
|
||||
}
|
||||
|
@ -31,7 +31,14 @@ enum
|
||||
// attr_pshared
|
||||
enum
|
||||
{
|
||||
SYS_SYNC_NOT_PROCESS_SHARED = 0x200
|
||||
SYS_SYNC_NOT_PROCESS_SHARED = 0x200,
|
||||
};
|
||||
|
||||
// attr_adaptive
|
||||
enum
|
||||
{
|
||||
SYS_SYNC_ADAPTIVE = 0x1000,
|
||||
SYS_SYNC_NOT_ADAPTIVE = 0x2000,
|
||||
};
|
||||
|
||||
class sleep_queue_t
|
||||
|
@ -26,7 +26,7 @@ s32 sys_cond_create(vm::ptr<u32> cond_id, u32 mutex_id, vm::ptr<sys_cond_attribu
|
||||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
if (attr->pshared.data() != se32(0x200) || attr->ipc_key.data() || attr->flags.data())
|
||||
if (attr->pshared != SYS_SYNC_NOT_PROCESS_SHARED || attr->ipc_key.data() || attr->flags.data())
|
||||
{
|
||||
sys_cond.Error("sys_cond_create(): unknown attributes (pshared=0x%x, ipc_key=0x%llx, flags=0x%x)", attr->pshared, attr->ipc_key, attr->flags);
|
||||
return CELL_EINVAL;
|
||||
|
@ -32,7 +32,7 @@ s32 sys_event_flag_create(vm::ptr<u32> id, vm::ptr<sys_event_flag_attr> attr, u6
|
||||
default: sys_event_flag.Error("sys_event_flag_create(): unknown protocol (0x%x)", attr->protocol); return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (attr->pshared.data() != se32(0x200) || attr->ipc_key.data() || attr->flags.data())
|
||||
if (attr->pshared != SYS_SYNC_NOT_PROCESS_SHARED || attr->ipc_key.data() || attr->flags.data())
|
||||
{
|
||||
sys_event_flag.Error("sys_event_flag_create(): unknown attributes (pshared=0x%x, ipc_key=0x%llx, flags=0x%x)", attr->pshared, attr->ipc_key, attr->flags);
|
||||
return CELL_EINVAL;
|
||||
|
@ -31,9 +31,9 @@ s32 sys_mutex_create(vm::ptr<u32> mutex_id, vm::ptr<sys_mutex_attribute_t> attr)
|
||||
default: sys_mutex.Error("sys_mutex_create(): unknown protocol (0x%x)", protocol); return CELL_EINVAL;
|
||||
}
|
||||
|
||||
const bool recursive = attr->recursive.data() == se32(SYS_SYNC_RECURSIVE);
|
||||
const bool recursive = attr->recursive == SYS_SYNC_RECURSIVE;
|
||||
|
||||
if ((!recursive && attr->recursive.data() != se32(SYS_SYNC_NOT_RECURSIVE)) || attr->pshared.data() != se32(0x200) || attr->adaptive.data() != se32(0x2000) || attr->ipc_key.data() || attr->flags.data())
|
||||
if ((!recursive && attr->recursive != SYS_SYNC_NOT_RECURSIVE) || attr->pshared.data() != SYS_SYNC_NOT_PROCESS_SHARED || attr->adaptive != SYS_SYNC_NOT_ADAPTIVE || attr->ipc_key.data() || attr->flags.data())
|
||||
{
|
||||
sys_mutex.Error("sys_mutex_create(): unknown attributes (recursive=0x%x, pshared=0x%x, adaptive=0x%x, ipc_key=0x%llx, flags=0x%x)",
|
||||
attr->recursive, attr->pshared, attr->adaptive, attr->ipc_key, attr->flags);
|
||||
|
@ -30,7 +30,7 @@ s32 sys_rwlock_create(vm::ptr<u32> rw_lock_id, vm::ptr<sys_rwlock_attribute_t> a
|
||||
default: sys_rwlock.Error("sys_rwlock_create(): unknown protocol (0x%x)", protocol); return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (attr->pshared.data() != se32(0x200) || attr->ipc_key.data() || attr->flags.data())
|
||||
if (attr->pshared != SYS_SYNC_NOT_PROCESS_SHARED || attr->ipc_key.data() || attr->flags.data())
|
||||
{
|
||||
sys_rwlock.Error("sys_rwlock_create(): unknown attributes (pshared=0x%x, ipc_key=0x%llx, flags=0x%x)", attr->pshared, attr->ipc_key, attr->flags);
|
||||
return CELL_EINVAL;
|
||||
|
@ -37,7 +37,7 @@ s32 sys_semaphore_create(vm::ptr<u32> sem, vm::ptr<sys_semaphore_attribute_t> at
|
||||
default: sys_semaphore.Error("sys_semaphore_create(): unknown protocol (0x%x)", protocol); return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (attr->pshared.data() != se32(0x200) || attr->ipc_key.data() || attr->flags.data())
|
||||
if (attr->pshared != SYS_SYNC_NOT_PROCESS_SHARED || attr->ipc_key.data() || attr->flags.data())
|
||||
{
|
||||
sys_semaphore.Error("sys_semaphore_create(): unknown attributes (pshared=0x%x, ipc_key=0x%x, flags=0x%x)", attr->pshared, attr->ipc_key, attr->flags);
|
||||
return CELL_EINVAL;
|
||||
|
@ -32,7 +32,7 @@ namespace loader
|
||||
be_t<u16> e_shnum;
|
||||
be_t<u16> e_shstrndx;
|
||||
|
||||
bool check() const { return e_magic.data() == se32(0x7F454C46); }
|
||||
bool check() const { return e_magic == 0x7F454C46; }
|
||||
} m_ehdr;
|
||||
|
||||
struct phdr
|
||||
|
Loading…
Reference in New Issue
Block a user