mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 04:02:42 +01:00
EXCEPTION() macro usage, sceNpTrophy improved
This commit is contained in:
parent
6f1e76198a
commit
32d3d1fbe5
@ -1097,7 +1097,7 @@ void _se_translator(unsigned int u, EXCEPTION_POINTERS* pExp)
|
||||
|
||||
if (u == EXCEPTION_ACCESS_VIOLATION && (u32)addr64 == addr64)
|
||||
{
|
||||
throw fmt::format("Access violation %s location 0x%llx", is_writing ? "writing" : "reading", addr64);
|
||||
throw EXCEPTION("Access violation %s location 0x%llx", is_writing ? "writing" : "reading", addr64);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1146,7 +1146,7 @@ void signal_handler(int sig, siginfo_t* info, void* uct)
|
||||
}
|
||||
|
||||
// TODO: this may be wrong
|
||||
throw fmt::format("Access violation %s location 0x%llx", is_writing ? "writing" : "reading", addr64);
|
||||
throw EXCEPTION("Access violation %s location 0x%llx", is_writing ? "writing" : "reading", addr64);
|
||||
}
|
||||
|
||||
// else some fatal error
|
||||
@ -1297,11 +1297,11 @@ void thread_t::start(std::function<std::string()> name, std::function<void()> fu
|
||||
|
||||
func();
|
||||
}
|
||||
catch (const char* e)
|
||||
catch (const char* e) // obsolete
|
||||
{
|
||||
error(e);
|
||||
}
|
||||
catch (const std::string& e)
|
||||
catch (const std::string& e) // obsolete
|
||||
{
|
||||
error(e.c_str());
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ void rImage::SaveFile(const std::string& name, rImageType type)
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::string("unsupported type");
|
||||
throw EXCEPTION("unsupported type");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ wxDateTime::TimeZone convertTZ(rDateTime::rTimeZone tz)
|
||||
case rDateTime::UTC:
|
||||
return wxDateTime::UTC;
|
||||
default:
|
||||
throw std::string("WRONG DATETIME");
|
||||
throw EXCEPTION("WRONG DATETIME");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1183,7 +1183,7 @@ struct ARMv7_op4t_table_t
|
||||
}
|
||||
}
|
||||
|
||||
throw "HACK instruction not found";
|
||||
throw EXCEPTION("HACK instruction not found");
|
||||
}
|
||||
|
||||
} g_op4t;
|
||||
@ -1221,6 +1221,8 @@ void armv7_decoder_initialize(u32 addr, u32 end_addr, bool dump)
|
||||
//g_opct.clear();
|
||||
//g_opct.reserve(end_addr - addr);
|
||||
|
||||
const auto hack = g_op4t.HACK();
|
||||
|
||||
while (addr < end_addr)
|
||||
{
|
||||
ARMv7Code code = {};
|
||||
@ -1288,7 +1290,7 @@ void armv7_decoder_initialize(u32 addr, u32 end_addr, bool dump)
|
||||
// replace BLX with "HACK" instruction directly (in Thumb form), it can help to see where it was called from
|
||||
const u32 index = (instr & 0xfff00) >> 4 | (instr & 0xf);
|
||||
vm::psv::write32(addr, 0xf870 | index << 16);
|
||||
g_opct[0xf8700000 | index] = g_op4t.HACK();
|
||||
g_opct[0xf8700000 | index] = hack;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1355,7 +1357,7 @@ u32 ARMv7Decoder::DecodeMemory(const u32 address)
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "ARMv7Decoder::DecodeMemory() failed (invalid instruction set set)";
|
||||
throw EXCEPTION("Invalid instruction set");
|
||||
}
|
||||
|
||||
ARMv7_instrs::UNK(m_ctx, code);
|
||||
|
@ -108,7 +108,7 @@ namespace ARMv7_instrs
|
||||
u32 LSL_C(u32 x, s32 shift, bool& carry_out)
|
||||
{
|
||||
assert(shift > 0);
|
||||
carry_out = shift <= 32 ? x & (1 << (32 - shift)) : false;
|
||||
carry_out = shift <= 32 ? (x & (1 << (32 - shift))) != 0 : false;
|
||||
return shift < 32 ? x << shift : 0;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ namespace ARMv7_instrs
|
||||
u32 LSR_C(u32 x, s32 shift, bool& carry_out)
|
||||
{
|
||||
assert(shift > 0);
|
||||
carry_out = shift <= 32 ? x & (1 << (shift - 1)) : false;
|
||||
carry_out = shift <= 32 ? (x & (1 << (shift - 1))) != 0 : false;
|
||||
return shift < 32 ? x >> shift : 0;
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ namespace ARMv7_instrs
|
||||
s32 ASR_C(s32 x, s32 shift, bool& carry_out)
|
||||
{
|
||||
assert(shift > 0);
|
||||
carry_out = shift <= 32 ? x & (1 << (shift - 1)) : x < 0;
|
||||
carry_out = shift <= 32 ? (x & (1 << (shift - 1))) != 0 : x < 0;
|
||||
return shift < 32 ? x >> shift : x >> 31;
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ namespace ARMv7_instrs
|
||||
{
|
||||
assert(shift);
|
||||
const u32 result = x >> shift | x << (32 - shift);
|
||||
carry_out = result >> 31;
|
||||
carry_out = (result >> 31) != 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -200,8 +200,8 @@ namespace ARMv7_instrs
|
||||
const T sign_mask = (T)1 << (sizeof(T) * 8 - 1);
|
||||
|
||||
T result = x + y;
|
||||
carry_out = ((x & y) | ((x ^ y) & ~result)) & sign_mask;
|
||||
overflow = (x ^ result) & (y ^ result) & sign_mask;
|
||||
carry_out = (((x & y) | ((x ^ y) & ~result)) & sign_mask) != 0;
|
||||
overflow = ((x ^ result) & (y ^ result) & sign_mask) != 0;
|
||||
if (carry_in)
|
||||
{
|
||||
result += 1;
|
||||
@ -283,7 +283,7 @@ namespace ARMv7_instrs
|
||||
{
|
||||
if (found->second != context.debug_str)
|
||||
{
|
||||
throw context.debug_str;
|
||||
throw EXCEPTION("Disasm inconsistency: '%s' != '%s'", found->second.c_str(), context.debug_str.c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -487,11 +487,11 @@ void ARMv7_instrs::UNK(ARMv7Context& context, const ARMv7Code code)
|
||||
{
|
||||
if (context.ISET == Thumb)
|
||||
{
|
||||
throw fmt::format("Unknown/illegal opcode: 0x%04X 0x%04X", code.code1, code.code0);
|
||||
throw EXCEPTION("Unknown/illegal opcode: 0x%04X 0x%04X", code.code1, code.code0);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw fmt::format("Unknown/illegal opcode: 0x%08X", code.data);
|
||||
throw EXCEPTION("Unknown/illegal opcode: 0x%08X", code.data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -613,7 +613,7 @@ void ARMv7_instrs::ADC_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
imm32 = ThumbExpandImm((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff));
|
||||
|
||||
reject(d == 13 || d == 15 || n == 13 || n == 15, "UNPREDICTABLE");
|
||||
@ -667,7 +667,7 @@ void ARMv7_instrs::ADC_REG(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(d == 13 || d == 15 || n == 13 || n == 15 || m == 13 || m == 15, "UNPREDICTABLE");
|
||||
@ -737,7 +737,7 @@ void ARMv7_instrs::ADD_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
imm32 = ThumbExpandImm((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff));
|
||||
|
||||
reject(d == 15 && set_flags, "CMN (immediate)");
|
||||
@ -821,7 +821,7 @@ void ARMv7_instrs::ADD_REG(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(d == 15 && set_flags, "CMN (register)");
|
||||
@ -892,7 +892,7 @@ void ARMv7_instrs::ADD_SPI(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
{
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
imm32 = ThumbExpandImm((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff));
|
||||
|
||||
reject(d == 15 && set_flags, "CMN (immediate)");
|
||||
@ -968,7 +968,7 @@ void ARMv7_instrs::ADD_SPR(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(d == 13 && (shift_t != SRType_LSL || shift_n > 3), "UNPREDICTABLE");
|
||||
@ -1070,7 +1070,7 @@ void ARMv7_instrs::AND_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
imm32 = ThumbExpandImm_C((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff), carry, carry);
|
||||
|
||||
reject(d == 15 && set_flags, "TST (immediate)");
|
||||
@ -1123,7 +1123,7 @@ void ARMv7_instrs::AND_REG(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(d == 15 && set_flags, "TST (register)");
|
||||
@ -1289,7 +1289,7 @@ void ARMv7_instrs::BIC_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
imm32 = ThumbExpandImm_C((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff), carry, carry);
|
||||
|
||||
reject(d == 13 || d == 15 || n == 13 || n == 15, "UNPREDICTABLE");
|
||||
@ -1341,7 +1341,7 @@ void ARMv7_instrs::BIC_REG(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(d == 13 || d == 15 || n == 13 || n == 15 || m == 13 || m == 15, "UNPREDICTABLE");
|
||||
@ -1556,7 +1556,7 @@ void ARMv7_instrs::CB_Z(ARMv7Context& context, const ARMv7Code code, const ARMv7
|
||||
{
|
||||
n = code.data & 0x7;
|
||||
imm32 = (code.data & 0xf8) >> 2 | (code.data & 0x200) >> 3;
|
||||
nonzero = (code.data & 0x800);
|
||||
nonzero = (code.data & 0x800) != 0;
|
||||
|
||||
reject(context.ITSTATE, "UNPREDICTABLE");
|
||||
break;
|
||||
@ -1797,7 +1797,7 @@ void ARMv7_instrs::EOR_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
imm32 = ThumbExpandImm_C((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff), carry, carry);
|
||||
|
||||
reject(d == 15 && set_flags, "TEQ (immediate)");
|
||||
@ -1850,7 +1850,7 @@ void ARMv7_instrs::EOR_REG(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(d == 15 && set_flags, "TEQ (register)");
|
||||
@ -1943,7 +1943,7 @@ void ARMv7_instrs::LDM(ARMv7Context& context, const ARMv7Code code, const ARMv7_
|
||||
cond = context.ITSTATE.advance();
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
reg_list = (code.data & 0xdfff);
|
||||
wback = (code.data & 0x200000);
|
||||
wback = (code.data & 0x200000) != 0;
|
||||
|
||||
reject(wback && n == 13, "POP");
|
||||
reject(n == 15 || BitCount(reg_list, 16) < 2 || reg_list >= 0xc000, "UNPREDICTABLE");
|
||||
@ -2057,9 +2057,9 @@ void ARMv7_instrs::LDR_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
t = (code.data & 0xf000) >> 12;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
imm32 = (code.data & 0xff);
|
||||
index = (code.data & 0x400);
|
||||
add = (code.data & 0x200);
|
||||
wback = (code.data & 0x100);
|
||||
index = (code.data & 0x400) != 0;
|
||||
add = (code.data & 0x200) != 0;
|
||||
wback = (code.data & 0x100) != 0;
|
||||
|
||||
reject(n == 15, "LDR (literal)");
|
||||
reject(index && add && !wback, "LDRT");
|
||||
@ -2111,7 +2111,7 @@ void ARMv7_instrs::LDR_LIT(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
t = (code.data & 0xf000) >> 12;
|
||||
imm32 = (code.data & 0xfff);
|
||||
add = (code.data & 0x800000);
|
||||
add = (code.data & 0x800000) != 0;
|
||||
|
||||
reject(t == 15 && context.ITSTATE, "UNPREDICTABLE");
|
||||
break;
|
||||
@ -2237,9 +2237,9 @@ void ARMv7_instrs::LDRB_IMM(ARMv7Context& context, const ARMv7Code code, const A
|
||||
t = (code.data & 0xf000) >> 12;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
imm32 = (code.data & 0xff);
|
||||
index = (code.data & 0x400);
|
||||
add = (code.data & 0x200);
|
||||
wback = (code.data & 0x100);
|
||||
index = (code.data & 0x400) != 0;
|
||||
add = (code.data & 0x200) != 0;
|
||||
wback = (code.data & 0x100) != 0;
|
||||
|
||||
reject(t == 15 && index && !add && !wback, "PLD");
|
||||
reject(n == 15, "LDRB (literal)");
|
||||
@ -2356,9 +2356,9 @@ void ARMv7_instrs::LDRD_IMM(ARMv7Context& context, const ARMv7Code code, const A
|
||||
t2 = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
imm32 = (code.data & 0xff) << 2;
|
||||
index = (code.data & 0x1000000);
|
||||
add = (code.data & 0x800000);
|
||||
wback = (code.data & 0x200000);
|
||||
index = (code.data & 0x1000000) != 0;
|
||||
add = (code.data & 0x800000) != 0;
|
||||
wback = (code.data & 0x200000) != 0;
|
||||
|
||||
reject(!index && !wback, "Related encodings");
|
||||
reject(n == 15, "LDRD (literal)");
|
||||
@ -2404,7 +2404,7 @@ void ARMv7_instrs::LDRD_LIT(ARMv7Context& context, const ARMv7Code code, const A
|
||||
t = (code.data & 0xf000) >> 12;
|
||||
t2 = (code.data & 0xf00) >> 8;
|
||||
imm32 = (code.data & 0xff) << 2;
|
||||
add = (code.data & 0x800000);
|
||||
add = (code.data & 0x800000) != 0;
|
||||
|
||||
reject(!(code.data & 0x1000000), "Related encodings"); // ???
|
||||
reject(t == 13 || t == 15 || t2 == 13 || t2 == 15 || t == t2, "UNPREDICTABLE");
|
||||
@ -2480,9 +2480,9 @@ void ARMv7_instrs::LDRH_IMM(ARMv7Context& context, const ARMv7Code code, const A
|
||||
t = (code.data & 0xf000) >> 12;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
imm32 = (code.data & 0xff);
|
||||
index = (code.data & 0x400);
|
||||
add = (code.data & 0x200);
|
||||
wback = (code.data & 0x100);
|
||||
index = (code.data & 0x400) != 0;
|
||||
add = (code.data & 0x200) != 0;
|
||||
wback = (code.data & 0x100) != 0;
|
||||
|
||||
reject(n == 15, "LDRH (literal)");
|
||||
reject(t == 15 && index && !add && !wback, "Unallocated memory hints");
|
||||
@ -2561,9 +2561,9 @@ void ARMv7_instrs::LDRSB_IMM(ARMv7Context& context, const ARMv7Code code, const
|
||||
t = (code.data & 0xf000) >> 12;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
imm32 = (code.data & 0xff);
|
||||
index = (code.data & 0x400);
|
||||
add = (code.data & 0x200);
|
||||
wback = (code.data & 0x100);
|
||||
index = (code.data & 0x400) != 0;
|
||||
add = (code.data & 0x200) != 0;
|
||||
wback = (code.data & 0x100) != 0;
|
||||
|
||||
reject(t == 15 && index && !add && !wback, "PLI");
|
||||
reject(n == 15, "LDRSB (literal)");
|
||||
@ -2730,7 +2730,7 @@ void ARMv7_instrs::LSL_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
DecodeImmShift(0, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(!shift_n, "MOV (register)");
|
||||
@ -2782,7 +2782,7 @@ void ARMv7_instrs::LSL_REG(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
|
||||
reject(d == 13 || d == 15 || n == 13 || n == 15 || m == 13 || m == 15, "UNPREDICTABLE");
|
||||
break;
|
||||
@ -2833,7 +2833,7 @@ void ARMv7_instrs::LSR_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
DecodeImmShift(1, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(d == 13 || d == 15 || m == 13 || m == 15, "UNPREDICTABLE");
|
||||
@ -2911,7 +2911,7 @@ void ARMv7_instrs::MOV_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
case T2:
|
||||
{
|
||||
cond = context.ITSTATE.advance();
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
d = (code.data >> 8) & 0xf;
|
||||
imm32 = ThumbExpandImm_C((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff), carry, carry);
|
||||
|
||||
@ -2990,7 +2990,7 @@ void ARMv7_instrs::MOV_REG(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
|
||||
reject((d == 13 || m == 13 || m == 15) && set_flags, "UNPREDICTABLE");
|
||||
reject((d == 13 && (m == 13 || m == 15)) || d == 15, "UNPREDICTABLE");
|
||||
@ -3144,7 +3144,7 @@ void ARMv7_instrs::MVN_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
{
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
imm32 = ThumbExpandImm_C((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff), context.APSR.C, carry);
|
||||
|
||||
reject(d == 13 || d == 15, "UNPREDICTABLE");
|
||||
@ -3195,7 +3195,7 @@ void ARMv7_instrs::MVN_REG(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(d == 13 || d == 15 || m == 13 || m == 15, "UNPREDICTABLE");
|
||||
@ -3304,7 +3304,7 @@ void ARMv7_instrs::ORR_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
imm32 = ThumbExpandImm_C((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff), carry, carry);
|
||||
|
||||
reject(n == 15, "MOV (immediate)");
|
||||
@ -3357,7 +3357,7 @@ void ARMv7_instrs::ORR_REG(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(n == 15, "ROR (immediate)");
|
||||
@ -3725,7 +3725,7 @@ void ARMv7_instrs::ROR_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
const u32 shift_t = DecodeImmShift(3, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(shift_t == SRType_RRX, "RRX");
|
||||
@ -3777,7 +3777,7 @@ void ARMv7_instrs::ROR_REG(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
|
||||
reject(d == 13 || d == 15 || n == 13 || n == 15 || m == 13 || m == 15, "UNPREDICTABLE");
|
||||
break;
|
||||
@ -3839,7 +3839,7 @@ void ARMv7_instrs::RSB_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
imm32 = ThumbExpandImm((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff));
|
||||
|
||||
reject(d == 13 || d == 15 || n == 13 || n == 15, "UNPREDICTABLE");
|
||||
@ -4272,7 +4272,7 @@ void ARMv7_instrs::STM(ARMv7Context& context, const ARMv7Code code, const ARMv7_
|
||||
cond = context.ITSTATE.advance();
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
reg_list = (code.data & 0x5fff);
|
||||
wback = (code.data & 0x200000);
|
||||
wback = (code.data & 0x200000) != 0;
|
||||
|
||||
reject(n == 15 || BitCount(reg_list, 16) < 2, "UNPREDICTABLE");
|
||||
reject(wback && reg_list & (1 << n), "UNPREDICTABLE");
|
||||
@ -4384,9 +4384,9 @@ void ARMv7_instrs::STR_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
t = (code.data & 0xf000) >> 12;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
imm32 = (code.data & 0xff);
|
||||
index = (code.data & 0x400);
|
||||
add = (code.data & 0x200);
|
||||
wback = (code.data & 0x100);
|
||||
index = (code.data & 0x400) != 0;
|
||||
add = (code.data & 0x200) != 0;
|
||||
wback = (code.data & 0x100) != 0;
|
||||
|
||||
reject(index && add && !wback, "STRT");
|
||||
reject(n == 13 && index && !add && wback && imm32 == 4, "PUSH");
|
||||
@ -4516,9 +4516,9 @@ void ARMv7_instrs::STRB_IMM(ARMv7Context& context, const ARMv7Code code, const A
|
||||
t = (code.data & 0xf000) >> 12;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
imm32 = (code.data & 0xff);
|
||||
index = (code.data & 0x400);
|
||||
add = (code.data & 0x200);
|
||||
wback = (code.data & 0x100);
|
||||
index = (code.data & 0x400) != 0;
|
||||
add = (code.data & 0x200) != 0;
|
||||
wback = (code.data & 0x100) != 0;
|
||||
|
||||
reject(index && add && !wback, "STRBT");
|
||||
reject(n == 15 || (!index && !wback), "UNDEFINED");
|
||||
@ -4623,9 +4623,9 @@ void ARMv7_instrs::STRD_IMM(ARMv7Context& context, const ARMv7Code code, const A
|
||||
t2 = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
imm32 = (code.data & 0xff) << 2;
|
||||
index = (code.data & 0x1000000);
|
||||
add = (code.data & 0x800000);
|
||||
wback = (code.data & 0x200000);
|
||||
index = (code.data & 0x1000000) != 0;
|
||||
add = (code.data & 0x800000) != 0;
|
||||
wback = (code.data & 0x200000) != 0;
|
||||
|
||||
reject(!index && !wback, "Related encodings");
|
||||
reject(wback && (n == t || n == t2), "UNPREDICTABLE");
|
||||
@ -4704,9 +4704,9 @@ void ARMv7_instrs::STRH_IMM(ARMv7Context& context, const ARMv7Code code, const A
|
||||
t = (code.data & 0xf000) >> 12;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
imm32 = (code.data & 0xff);
|
||||
index = (code.data & 0x400);
|
||||
add = (code.data & 0x200);
|
||||
wback = (code.data & 0x100);
|
||||
index = (code.data & 0x400) != 0;
|
||||
add = (code.data & 0x200) != 0;
|
||||
wback = (code.data & 0x100) != 0;
|
||||
|
||||
reject(index && add && !wback, "STRHT");
|
||||
reject(n == 15 || (!index && !wback), "UNDEFINED");
|
||||
@ -4888,7 +4888,7 @@ void ARMv7_instrs::SUB_IMM(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
imm32 = ThumbExpandImm((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff));
|
||||
|
||||
reject(d == 15 && set_flags, "CMP (immediate)");
|
||||
@ -4958,7 +4958,7 @@ void ARMv7_instrs::SUB_REG(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
n = (code.data & 0xf0000) >> 16;
|
||||
m = (code.data & 0xf);
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
shift_t = DecodeImmShift((code.data & 0x30) >> 4, (code.data & 0x7000) >> 10 | (code.data & 0xc0) >> 6, &shift_n);
|
||||
|
||||
reject(d == 15 && set_flags, "CMP (register)");
|
||||
@ -5021,7 +5021,7 @@ void ARMv7_instrs::SUB_SPI(ARMv7Context& context, const ARMv7Code code, const AR
|
||||
{
|
||||
cond = context.ITSTATE.advance();
|
||||
d = (code.data & 0xf00) >> 8;
|
||||
set_flags = (code.data & 0x100000);
|
||||
set_flags = (code.data & 0x100000) != 0;
|
||||
imm32 = ThumbExpandImm((code.data & 0x4000000) >> 15 | (code.data & 0x7000) >> 4 | (code.data & 0xff));
|
||||
|
||||
reject(d == 15 && set_flags, "CMP (immediate)");
|
||||
|
@ -60,7 +60,7 @@ u32 armv7_get_tls(u32 thread)
|
||||
}
|
||||
}
|
||||
|
||||
throw "Out of TLS memory";
|
||||
throw EXCEPTION("Out of TLS memory");
|
||||
}
|
||||
|
||||
void armv7_free_tls(u32 thread)
|
||||
|
@ -137,7 +137,7 @@ std::string armv7_fmt(ARMv7Context& context, vm::cptr<char> fmt, u32 g_count, u3
|
||||
}
|
||||
}
|
||||
|
||||
throw fmt::format("armv7_fmt(): unknown formatting: '%s'", start.get_ptr());
|
||||
throw EXCEPTION("Unknown formatting '%s'", start.get_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,10 @@ s32 scePerfArmPmonSelectEvent(ARMv7Context& context, s32 threadId, u32 counter,
|
||||
break;
|
||||
}
|
||||
|
||||
default: throw "scePerfArmPmonSelectEvent(): unknown event requested";
|
||||
default:
|
||||
{
|
||||
throw EXCEPTION("Unknown event requested");
|
||||
}
|
||||
}
|
||||
|
||||
context.counters[counter].event = eventCode;
|
||||
|
@ -79,7 +79,7 @@ void execute_psv_func_by_index(ARMv7Context& context, u32 index)
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "Unimplemented function";
|
||||
throw EXCEPTION("Unimplemented function");
|
||||
}
|
||||
|
||||
// rough error code processing
|
||||
@ -92,7 +92,7 @@ void execute_psv_func_by_index(ARMv7Context& context, u32 index)
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "Invalid function index";
|
||||
throw EXCEPTION("Invalid function index");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,11 +28,6 @@ class psv_object_list_t // Class for managing object data
|
||||
std::atomic<u32> m_hint; // guessing next free position
|
||||
std::mutex m_mutex;
|
||||
|
||||
void error(s32 uid)
|
||||
{
|
||||
throw fmt::format("Invalid UID requested (type=0x%x, uid=0x%x)", uid_class, uid);
|
||||
}
|
||||
|
||||
public:
|
||||
psv_object_list_t()
|
||||
: m_hint(0)
|
||||
|
@ -199,7 +199,7 @@ public:
|
||||
//u64 join()
|
||||
//{
|
||||
// if (!joinable())
|
||||
// throw "thread must be joinable for join";
|
||||
// throw EXCEPTION("thread must be joinable for join");
|
||||
|
||||
// thread->SetJoinable(false);
|
||||
|
||||
|
@ -109,7 +109,7 @@ private:
|
||||
|
||||
void NULL_OP()
|
||||
{
|
||||
throw "Null operation";
|
||||
throw EXCEPTION("Null operation");
|
||||
}
|
||||
|
||||
void NOP()
|
||||
@ -173,7 +173,7 @@ private:
|
||||
case 0x117: return CPU.SPRG[n - 0x110];
|
||||
}
|
||||
|
||||
throw fmt::Format("ReadSPR(0x%x) error: unknown SPR (0x%x)", spr, n);
|
||||
throw EXCEPTION("Unknown SPR (spr=0x%x, n=0x%x)", spr, n);
|
||||
}
|
||||
|
||||
void WriteSPR(u32 spr, u64 value)
|
||||
@ -186,10 +186,10 @@ private:
|
||||
case 0x008: CPU.LR = value; return;
|
||||
case 0x009: CPU.CTR = value; return;
|
||||
case 0x100: CPU.VRSAVE = (u32)value; return;
|
||||
case 0x103: throw fmt::Format("WriteSPR(0x103, 0x%llx): Write to read-only SPR", value);
|
||||
case 0x103: throw EXCEPTION("WriteSPR(0x103, 0x%llx): Write to read-only SPR", value);
|
||||
|
||||
case 0x10C: throw fmt::Format("WriteSPR(0x10C, 0x%llx): Write to time-based SPR", value);
|
||||
case 0x10D: throw fmt::Format("WriteSPR(0x10D, 0x%llx): Write to time-based SPR", value);
|
||||
case 0x10C: throw EXCEPTION("WriteSPR(0x10C, 0x%llx): Write to time-based SPR", value);
|
||||
case 0x10D: throw EXCEPTION("WriteSPR(0x10D, 0x%llx): Write to time-based SPR", value);
|
||||
|
||||
case 0x110:
|
||||
case 0x111:
|
||||
@ -201,7 +201,7 @@ private:
|
||||
case 0x117: CPU.SPRG[n - 0x110] = value; return;
|
||||
}
|
||||
|
||||
throw fmt::Format("WriteSPR(0x%x, 0x%llx) error: unknown SPR (0x%x)", spr, value, n);
|
||||
throw EXCEPTION("Unknown SPR (spr=0x%x, n=0x%x, value=0x%llx)", spr, n, value);
|
||||
}
|
||||
|
||||
void TDI(u32 to, u32 ra, s32 simm16)
|
||||
@ -214,7 +214,7 @@ private:
|
||||
((u64)a < (u64)simm16 && (to & 0x2)) ||
|
||||
((u64)a > (u64)simm16 && (to & 0x1)) )
|
||||
{
|
||||
throw fmt::Format("Trap! (tdi 0x%x, r%d, 0x%x)", to, ra, simm16);
|
||||
throw EXCEPTION("Trap! (tdi 0x%x, r%d, 0x%x)", to, ra, simm16);
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,7 +228,7 @@ private:
|
||||
((u32)a < (u32)simm16 && (to & 0x2)) ||
|
||||
((u32)a > (u32)simm16 && (to & 0x1)) )
|
||||
{
|
||||
throw fmt::Format("Trap! (twi 0x%x, r%d, 0x%x)", to, ra, simm16);
|
||||
throw EXCEPTION("Trap! (twi 0x%x, r%d, 0x%x)", to, ra, simm16);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2239,9 +2239,9 @@ private:
|
||||
switch (lev)
|
||||
{
|
||||
case 0x0: SysCalls::DoSyscall(CPU, CPU.GPR[11]); break;
|
||||
case 0x1: throw "SC(): HyperCall LV1";
|
||||
case 0x1: throw EXCEPTION("HyperCall LV1");
|
||||
case 0x3: CPU.FastStop(); break;
|
||||
default: throw fmt::Format("SC(): unknown level (0x%x)", lev);
|
||||
default: throw EXCEPTION("Unknown level (0x%x)", lev);
|
||||
}
|
||||
}
|
||||
void B(s32 ll, u32 aa, u32 lk)
|
||||
@ -2405,7 +2405,7 @@ private:
|
||||
((u32)a < (u32)b && (to & 0x2)) ||
|
||||
((u32)a > (u32)b && (to & 0x1)) )
|
||||
{
|
||||
throw fmt::Format("Trap! (tw 0x%x, r%d, r%d)", to, ra, rb);
|
||||
throw EXCEPTION("Trap! (tw 0x%x, r%d, r%d)", to, ra, rb);
|
||||
}
|
||||
}
|
||||
void LVSL(u32 vd, u32 ra, u32 rb)
|
||||
@ -2608,7 +2608,7 @@ private:
|
||||
}
|
||||
void TD(u32 to, u32 ra, u32 rb)
|
||||
{
|
||||
throw "TD()";
|
||||
throw EXCEPTION("");
|
||||
}
|
||||
void LVEWX(u32 vd, u32 ra, u32 rb)
|
||||
{
|
||||
@ -2661,8 +2661,6 @@ private:
|
||||
}
|
||||
void LBZUX(u32 rd, u32 ra, u32 rb)
|
||||
{
|
||||
//if(ra == 0 || ra == rd) throw "Bad instruction [LBZUX]";
|
||||
|
||||
const u64 addr = CPU.GPR[ra] + CPU.GPR[rb];
|
||||
CPU.GPR[rd] = vm::read8(vm::cast(addr));
|
||||
CPU.GPR[ra] = addr;
|
||||
@ -2930,7 +2928,7 @@ private:
|
||||
{
|
||||
case 0x10C: CPU.GPR[rd] = CPU.TB; break;
|
||||
case 0x10D: CPU.GPR[rd] = CPU.TB >> 32; break;
|
||||
default: throw fmt::Format("mftb r%d, %d", rd, spr);
|
||||
default: throw EXCEPTION("mftb r%d, %d", rd, spr);
|
||||
}
|
||||
}
|
||||
void LWAUX(u32 rd, u32 ra, u32 rb)
|
||||
@ -4403,6 +4401,6 @@ private:
|
||||
|
||||
void UNK(const u32 code, const u32 opcode, const u32 gcode)
|
||||
{
|
||||
throw fmt::Format("Unknown/Illegal opcode! (0x%08x : 0x%x : 0x%x)", code, opcode, gcode);
|
||||
throw EXCEPTION("Unknown/Illegal opcode! (0x%08x : 0x%x : 0x%x)", code, opcode, gcode);
|
||||
}
|
||||
};
|
||||
|
@ -509,12 +509,12 @@ void PPUThread::DumpInformation() const
|
||||
{
|
||||
if (hle_code < 0)
|
||||
{
|
||||
LOG_SUCCESS(HLE, "Information: syscall %lld (%s)", ~hle_code, SysCalls::GetFuncName(hle_code));
|
||||
LOG_SUCCESS(HLE, "Last function: syscall %lld (%s)", ~hle_code, SysCalls::GetFuncName(hle_code));
|
||||
}
|
||||
|
||||
if (hle_code > 0)
|
||||
{
|
||||
LOG_SUCCESS(HLE, "Information: function 0x%llx (%s)", hle_code, SysCalls::GetFuncName(hle_code));
|
||||
LOG_SUCCESS(HLE, "Last function: %s (0x%llx)", SysCalls::GetFuncName(hle_code), hle_code);
|
||||
}
|
||||
|
||||
CPUThread::DumpInformation();
|
||||
|
@ -363,7 +363,7 @@ struct PPCdouble
|
||||
case _FPCLASS_PD: return FPR_PD;
|
||||
case _FPCLASS_PN: return FPR_PN;
|
||||
case _FPCLASS_PINF: return FPR_PINF;
|
||||
default: throw fmt::Format("PPCdouble::UpdateType() -> unknown fpclass (0x%04x).", fpc);
|
||||
default: throw EXCEPTION("Unknown fpclass (0x%04x)", fpc);
|
||||
}
|
||||
#else
|
||||
switch (fpc)
|
||||
|
@ -69,26 +69,16 @@ public:
|
||||
|
||||
struct XmmLink
|
||||
{
|
||||
asmjit::X86XmmVar* data;
|
||||
s8 reg;
|
||||
bool taken;
|
||||
mutable bool got;
|
||||
mutable u32 access;
|
||||
|
||||
XmmLink()
|
||||
: data(nullptr)
|
||||
, reg(-1)
|
||||
, taken(false)
|
||||
, got(false)
|
||||
, access(0)
|
||||
{
|
||||
}
|
||||
asmjit::X86XmmVar* data = nullptr;
|
||||
s8 reg = -1;
|
||||
bool taken = false;
|
||||
mutable bool got = false;
|
||||
mutable u32 access = 0;
|
||||
|
||||
const asmjit::X86XmmVar& get() const
|
||||
{
|
||||
assert(data);
|
||||
assert(taken);
|
||||
if (!taken) throw "XmmLink::get(): wrong use";
|
||||
if (!taken) throw EXCEPTION("Register not taken");
|
||||
got = true;
|
||||
return *data;
|
||||
}
|
||||
|
@ -303,6 +303,7 @@ const SPURecompiler::XmmLink& SPURecompiler::XmmAlloc(s8 pref) // get empty xmm
|
||||
return xmm_var[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < 16; i++)
|
||||
{
|
||||
if ((xmm_var[i].reg == -1) && !xmm_var[i].taken)
|
||||
@ -314,6 +315,7 @@ const SPURecompiler::XmmLink& SPURecompiler::XmmAlloc(s8 pref) // get empty xmm
|
||||
return xmm_var[i];
|
||||
}
|
||||
}
|
||||
|
||||
int last = -1, max = -1;
|
||||
for (u32 i = 0; i < 16; i++)
|
||||
{
|
||||
@ -326,6 +328,7 @@ const SPURecompiler::XmmLink& SPURecompiler::XmmAlloc(s8 pref) // get empty xmm
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (last >= 0)
|
||||
{
|
||||
// (saving cached data?)
|
||||
@ -337,7 +340,8 @@ const SPURecompiler::XmmLink& SPURecompiler::XmmAlloc(s8 pref) // get empty xmm
|
||||
xmm_var[last].access = 0;
|
||||
return xmm_var[last];
|
||||
}
|
||||
throw "XmmAlloc() failed";
|
||||
|
||||
throw EXCEPTION("Failure");
|
||||
}
|
||||
|
||||
const SPURecompiler::XmmLink* SPURecompiler::XmmRead(const s8 reg) const // get xmm register with specific SPU reg or nullptr
|
||||
@ -348,7 +352,7 @@ const SPURecompiler::XmmLink* SPURecompiler::XmmRead(const s8 reg) const // get
|
||||
if (xmm_var[i].reg == reg)
|
||||
{
|
||||
//assert(!xmm_var[i].got);
|
||||
//if (xmm_var[i].got) throw "XmmRead(): wrong reuse";
|
||||
//if (xmm_var[i].got) throw EXCEPTION("Wrong reuse");
|
||||
LOG4_OPCODE("GPR[%d] has been read (i=%d)", reg, i);
|
||||
xmm_var[i].access++;
|
||||
return &xmm_var[i];
|
||||
@ -369,13 +373,13 @@ const SPURecompiler::XmmLink& SPURecompiler::XmmGet(s8 reg, s8 target) // get xm
|
||||
if (xmm_var[i].reg == reg)
|
||||
{
|
||||
res = &xmm_var[i];
|
||||
if (xmm_var[i].taken) throw "XmmGet(): xmm_var is taken";
|
||||
if (xmm_var[i].taken) throw EXCEPTION("xmm_var is taken");
|
||||
xmm_var[i].taken = true;
|
||||
xmm_var[i].got = false;
|
||||
//xmm_var[i].reg = -1;
|
||||
for (u32 j = i + 1; j < 16; j++)
|
||||
{
|
||||
if (xmm_var[j].reg == reg) throw "XmmGet(): xmm_var duplicate";
|
||||
if (xmm_var[j].reg == reg) throw EXCEPTION("xmm_var duplicate");
|
||||
}
|
||||
LOG4_OPCODE("cached GPR[%d] used (i=%d)", reg, i);
|
||||
break;
|
||||
@ -422,7 +426,7 @@ void SPURecompiler::XmmInvalidate(const s8 reg) // invalidate cached register
|
||||
{
|
||||
if (xmm_var[i].reg == reg)
|
||||
{
|
||||
if (xmm_var[i].taken) throw "XmmInvalidate(): xmm_var is taken";
|
||||
if (xmm_var[i].taken) throw EXCEPTION("xmm_var is taken");
|
||||
LOG4_OPCODE("GPR[%d] invalidated (i=%d)", reg, i);
|
||||
xmm_var[i].reg = -1;
|
||||
xmm_var[i].access = 0;
|
||||
@ -3324,10 +3328,6 @@ void SPURecompiler::FMA(u32 rt, u32 ra, u32 rb, u32 rc)
|
||||
XmmFinalize(va, rt);
|
||||
XmmFinalize(vc);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "FMA: invalid case"; // should never happen
|
||||
}
|
||||
LOG_OPCODE();
|
||||
}
|
||||
|
||||
@ -3410,10 +3410,6 @@ void SPURecompiler::FMS(u32 rt, u32 ra, u32 rb, u32 rc)
|
||||
XmmFinalize(va, rt);
|
||||
XmmFinalize(vc);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "FMS: invalid case"; // should never happen
|
||||
}
|
||||
LOG_OPCODE();
|
||||
}
|
||||
|
||||
|
@ -1184,7 +1184,7 @@ void SPUThread::halt()
|
||||
}
|
||||
|
||||
status |= SPU_STATUS_STOPPED_BY_HALT;
|
||||
throw "HALT";
|
||||
throw EXCEPTION("Halt");
|
||||
}
|
||||
|
||||
spu_thread::spu_thread(u32 entry, const std::string& name, u32 stack_size, u32 prio)
|
||||
|
@ -452,8 +452,7 @@ public:
|
||||
return this->_u32[3] >> 10 & 0x3;
|
||||
|
||||
default:
|
||||
throw fmt::Format("Unexpected slice value in FPSCR::checkSliceRounding(): %d", slice);
|
||||
return 0;
|
||||
throw EXCEPTION("Unexpected slice value (%d)", slice);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,16 +91,6 @@ public:
|
||||
m_id_map.clear();
|
||||
m_cur_id = 1; // first ID
|
||||
}
|
||||
|
||||
//// add new ID using existing std::shared_ptr (not recommended, use make() instead)
|
||||
//template<typename T> u32 add(std::shared_ptr<T> data, u32 type = ID_type<T>::type)
|
||||
//{
|
||||
// std::lock_guard<std::mutex> lock(m_mutex);
|
||||
|
||||
// m_id_map.emplace(m_cur_id, ID_data_t(std::move(data), type));
|
||||
|
||||
// return m_cur_id++;
|
||||
//}
|
||||
|
||||
// add new ID of specified type with specified constructor arguments (returns object)
|
||||
template<typename T, typename... Args, typename = std::enable_if_t<std::is_constructible<T, Args...>::value>> std::shared_ptr<T> make_ptr(Args&&... args)
|
||||
|
@ -147,7 +147,7 @@ namespace vm
|
||||
if (mprotect(vm::get_ptr(addr & ~0xfff), 4096, no_access ? PROT_NONE : PROT_READ))
|
||||
#endif
|
||||
{
|
||||
throw fmt::format("vm::_reservation_set() failed (addr=0x%x)", addr);
|
||||
throw EXCEPTION("System failure (addr=0x%x)", addr);
|
||||
}
|
||||
|
||||
//LOG_NOTICE(MEMORY, "VirtualProtect: %f us", (get_time() - stamp0) / 80.f);
|
||||
@ -166,7 +166,7 @@ namespace vm
|
||||
if (mprotect(vm::get_ptr(addr & ~0xfff), 4096, PROT_READ | PROT_WRITE))
|
||||
#endif
|
||||
{
|
||||
throw fmt::format("vm::_reservation_break() failed (addr=0x%x)", addr);
|
||||
throw EXCEPTION("System failure (addr=0x%x)", addr);
|
||||
}
|
||||
|
||||
//LOG_NOTICE(MEMORY, "VirtualAlloc: %f us", (get_time() - stamp0) / 80.f);
|
||||
@ -209,7 +209,7 @@ namespace vm
|
||||
u8 flags = g_page_info[addr >> 12].load();
|
||||
if (!(flags & page_writable) || !(flags & page_allocated) || (flags & page_no_reservations))
|
||||
{
|
||||
throw fmt::format("vm::reservation_acquire(addr=0x%x, size=0x%x) failed (invalid page flags: 0x%x)", addr, size, flags);
|
||||
throw EXCEPTION("Invalid page flags (addr=0x%x, size=0x%x, flags=0x%x)", addr, size, flags);
|
||||
}
|
||||
|
||||
// silent unlocking to prevent priority boost for threads going to break reservation
|
||||
@ -355,7 +355,7 @@ namespace vm
|
||||
{
|
||||
if (g_page_info[i].load())
|
||||
{
|
||||
throw fmt::format("vm::page_map(addr=0x%x, size=0x%x, flags=0x%x) failed (already mapped at 0x%x)", addr, size, flags, i * 4096);
|
||||
throw EXCEPTION("Memory already mapped (addr=0x%x, size=0x%x, flags=0x%x, current_addr=0x%x)", addr, size, flags, i * 4096);
|
||||
}
|
||||
}
|
||||
|
||||
@ -370,14 +370,14 @@ namespace vm
|
||||
if (mprotect(priv_addr, size, PROT_READ | PROT_WRITE) || mprotect(real_addr, size, protection))
|
||||
#endif
|
||||
{
|
||||
throw fmt::format("vm::page_map(addr=0x%x, size=0x%x, flags=0x%x) failed (API)", addr, size, flags);
|
||||
throw EXCEPTION("System failure (addr=0x%x, size=0x%x, flags=0x%x)", addr, size, flags);
|
||||
}
|
||||
|
||||
for (u32 i = addr / 4096; i < addr / 4096 + size / 4096; i++)
|
||||
{
|
||||
if (g_page_info[i].exchange(flags | page_allocated))
|
||||
{
|
||||
throw fmt::format("vm::page_map(addr=0x%x, size=0x%x, flags=0x%x) failed (concurrent access at 0x%x)", addr, size, flags, i * 4096);
|
||||
throw EXCEPTION("Concurrent access (addr=0x%x, size=0x%x, flags=0x%x, current_addr=0x%x)", addr, size, flags, i * 4096);
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,7 +429,7 @@ namespace vm
|
||||
if (mprotect(real_addr, 4096, protection))
|
||||
#endif
|
||||
{
|
||||
throw fmt::format("vm::page_protect(addr=0x%x, size=0x%x, flags_test=0x%x, flags_set=0x%x, flags_clear=0x%x) failed (API)", addr, size, flags_test, flags_set, flags_clear);
|
||||
throw EXCEPTION("System failure (addr=0x%x, size=0x%x, flags_test=0x%x, flags_set=0x%x, flags_clear=0x%x)", addr, size, flags_test, flags_set, flags_clear);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -447,7 +447,7 @@ namespace vm
|
||||
{
|
||||
if (!(g_page_info[i].load() & page_allocated))
|
||||
{
|
||||
throw fmt::format("vm::page_unmap(addr=0x%x, size=0x%x) failed (not mapped at 0x%x)", addr, size, i * 4096);
|
||||
throw EXCEPTION("Memory not mapped (addr=0x%x, size=0x%x, current_addr=0x%x)", addr, size, i * 4096);
|
||||
}
|
||||
}
|
||||
|
||||
@ -457,7 +457,7 @@ namespace vm
|
||||
|
||||
if (!(g_page_info[i].exchange(0) & page_allocated))
|
||||
{
|
||||
throw fmt::format("vm::page_unmap(addr=0x%x, size=0x%x) failed (concurrent access at 0x%x)", addr, size, i * 4096);
|
||||
throw EXCEPTION("Concurrent access (addr=0x%x, size=0x%x, current_addr=0x%x)", addr, size, i * 4096);
|
||||
}
|
||||
}
|
||||
|
||||
@ -472,7 +472,7 @@ namespace vm
|
||||
if (mprotect(real_addr, size, PROT_NONE) || mprotect(priv_addr, size, PROT_NONE))
|
||||
#endif
|
||||
{
|
||||
throw fmt::format("vm::page_unmap(addr=0x%x, size=0x%x) failed (API)", addr, size);
|
||||
throw EXCEPTION("System failure (addr=0x%x, size=0x%x)", addr, size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -524,29 +524,6 @@ namespace vm
|
||||
return g_locations[location].deallocator(addr);
|
||||
}
|
||||
|
||||
u32 get_addr(const void* real_pointer)
|
||||
{
|
||||
const u64 diff = (u64)real_pointer - (u64)g_base_addr;
|
||||
const u32 res = (u32)diff;
|
||||
|
||||
if (res == diff)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
if (real_pointer)
|
||||
{
|
||||
throw fmt::format("vm::get_addr(0x%016llx) failed: not a part of virtual memory", (u64)real_pointer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void error(const u64 addr, const char* func)
|
||||
{
|
||||
throw fmt::format("%s(): failed to cast 0x%llx (too big value)", func, addr);
|
||||
}
|
||||
|
||||
namespace ps3
|
||||
{
|
||||
u32 main_alloc(u32 size)
|
||||
|
@ -64,36 +64,45 @@ namespace vm
|
||||
u32 alloc(u32 addr, u32 size, memory_location location = user_space);
|
||||
void dealloc(u32 addr, memory_location location = user_space);
|
||||
|
||||
template<typename T = void>
|
||||
T* get_ptr(u32 addr)
|
||||
template<typename T = void> T* get_ptr(u32 addr)
|
||||
{
|
||||
return reinterpret_cast<T*>(static_cast<u8*>(g_base_addr) + addr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& get_ref(u32 addr)
|
||||
template<typename T> T& get_ref(u32 addr)
|
||||
{
|
||||
return *get_ptr<T>(addr);
|
||||
}
|
||||
|
||||
template<typename T = void>
|
||||
T* priv_ptr(u32 addr)
|
||||
template<typename T = void> T* priv_ptr(u32 addr)
|
||||
{
|
||||
return reinterpret_cast<T*>(static_cast<u8*>(g_priv_addr) + addr);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T& priv_ref(u32 addr)
|
||||
template<typename T> T& priv_ref(u32 addr)
|
||||
{
|
||||
return *priv_ptr<T>(addr);
|
||||
}
|
||||
|
||||
u32 get_addr(const void* real_pointer);
|
||||
inline u32 get_addr(const void* real_pointer)
|
||||
{
|
||||
const uintptr_t diff = reinterpret_cast<uintptr_t>(real_pointer) - reinterpret_cast<uintptr_t>(g_base_addr);
|
||||
const u32 res = static_cast<u32>(diff);
|
||||
|
||||
never_inline void error(const u64 addr, const char* func);
|
||||
if (res == diff)
|
||||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
struct cast_ptr
|
||||
if (real_pointer)
|
||||
{
|
||||
throw EXCEPTION("Not a virtual memory pointer (%p)", real_pointer);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template<typename T> struct cast_ptr
|
||||
{
|
||||
static_assert(std::is_same<T, u32>::value, "Unsupported vm::cast() type");
|
||||
|
||||
@ -103,8 +112,7 @@ namespace vm
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct cast_ptr<u32>
|
||||
template<> struct cast_ptr<u32>
|
||||
{
|
||||
force_inline static u32 cast(const u32 addr, const char* func)
|
||||
{
|
||||
@ -112,23 +120,22 @@ namespace vm
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct cast_ptr<u64>
|
||||
template<> struct cast_ptr<u64>
|
||||
{
|
||||
force_inline static u32 cast(const u64 addr, const char* func)
|
||||
{
|
||||
const u32 res = static_cast<u32>(addr);
|
||||
|
||||
if (res != addr)
|
||||
{
|
||||
vm::error(addr, func);
|
||||
throw EXCEPTION("%s(): failed to cast 0x%llx (too big value)", func, addr);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct cast_ptr<be_t<T>>
|
||||
template<typename T> struct cast_ptr<be_t<T>>
|
||||
{
|
||||
force_inline static u32 cast(const be_t<T>& addr, const char* func)
|
||||
{
|
||||
@ -136,8 +143,7 @@ namespace vm
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct cast_ptr<le_t<T>>
|
||||
template<typename T> struct cast_ptr<le_t<T>>
|
||||
{
|
||||
force_inline static u32 cast(const le_t<T>& addr, const char* func)
|
||||
{
|
||||
@ -145,8 +151,7 @@ namespace vm
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
force_inline static u32 cast(const T& addr, const char* func = "vm::cast")
|
||||
template<typename T> force_inline static u32 cast(const T& addr, const char* func = "vm::cast")
|
||||
{
|
||||
return cast_ptr<T>::cast(addr, func);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ u32 GetAddress(u32 offset, u32 location)
|
||||
res = (u32)Memory.RSXIOMem.RealAddr(offset); // TODO: Error Check?
|
||||
if (res == 0)
|
||||
{
|
||||
throw fmt::format("GetAddress(offset=0x%x, location=0x%x): RSXIO memory not mapped", offset, location);
|
||||
throw EXCEPTION("RSXIO memory not mapped (offset=0x%x)", offset);
|
||||
}
|
||||
|
||||
if (Emu.GetGSManager().GetRender().m_strict_ordering[offset >> 20])
|
||||
@ -51,7 +51,7 @@ u32 GetAddress(u32 offset, u32 location)
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw fmt::format("GetAddress(offset=0x%x, location=0x%x): invalid location", offset, location);
|
||||
throw EXCEPTION("Invalid location (offset=0x%x, location=0x%x)", offset, location);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2594,10 +2594,12 @@ void RSXThread::Init(const u32 ioAddress, const u32 ioSize, const u32 ctrlAddres
|
||||
u32 RSXThread::ReadIO32(u32 addr)
|
||||
{
|
||||
u32 value;
|
||||
|
||||
if (!Memory.RSXIOMem.Read32(addr, &value))
|
||||
{
|
||||
throw fmt::Format("%s(addr=0x%x): RSXIO memory not mapped", __FUNCTION__, addr);
|
||||
throw EXCEPTION("RSXIO memory not mapped (addr=0x%x)", addr);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -2605,6 +2607,6 @@ void RSXThread::WriteIO32(u32 addr, u32 value)
|
||||
{
|
||||
if (!Memory.RSXIOMem.Write32(addr, value))
|
||||
{
|
||||
throw fmt::Format("%s(addr=0x%x): RSXIO memory not mapped", __FUNCTION__, addr);
|
||||
throw EXCEPTION("RSXIO memory not mapped (addr=0x%x)", addr);
|
||||
}
|
||||
}
|
||||
|
@ -18,56 +18,6 @@ void LogBase::LogOutput(LogType type, const std::string& text) const
|
||||
case LogWarning: LOG_WARNING(HLE, GetName() + ": " + text); break;
|
||||
case LogError: LOG_ERROR(HLE, GetName() + " error: " + text); break;
|
||||
case LogTodo: LOG_ERROR(HLE, GetName() + " TODO: " + text); break;
|
||||
case LogFatal: throw GetName() + " error: " + text;
|
||||
}
|
||||
}
|
||||
|
||||
hle::error::error(s32 errorCode, const char* errorText)
|
||||
: code(errorCode)
|
||||
, base(nullptr)
|
||||
, text(errorText ? errorText : "")
|
||||
{
|
||||
}
|
||||
|
||||
hle::error::error(s32 errorCode, const LogBase& errorBase, const char* errorText)
|
||||
: code(errorCode)
|
||||
, base(&errorBase)
|
||||
, text(errorText ? errorText : "")
|
||||
{
|
||||
}
|
||||
|
||||
hle::error::error(s32 errorCode, const LogBase* errorBase, const char* errorText)
|
||||
: code(errorCode)
|
||||
, base(errorBase)
|
||||
, text(errorText ? errorText : "")
|
||||
{
|
||||
}
|
||||
|
||||
void hle::error::print(const char* func)
|
||||
{
|
||||
if (!text.empty())
|
||||
{
|
||||
if (base)
|
||||
{
|
||||
if (func)
|
||||
{
|
||||
base->Error("%s(): %s (0x%x)", func, text.c_str(), code);
|
||||
}
|
||||
else
|
||||
{
|
||||
base->Error("%s (0x%x)", text.c_str(), code);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (func)
|
||||
{
|
||||
LOG_ERROR(HLE, "%s(): %s (0x%x)", func, text.c_str(), code);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR(HLE, "%s (0x%x)", text.c_str(), code);
|
||||
}
|
||||
}
|
||||
case LogFatal: throw EXCEPTION("%s error: %s", GetName().c_str(), text.c_str());
|
||||
}
|
||||
}
|
||||
|
@ -73,19 +73,3 @@ public:
|
||||
LogPrepare(LogTodo, fmt, fmt::do_unveil(args)...);
|
||||
}
|
||||
};
|
||||
|
||||
namespace hle
|
||||
{
|
||||
struct error
|
||||
{
|
||||
const s32 code;
|
||||
const LogBase* const base;
|
||||
const std::string text;
|
||||
|
||||
error(s32 errorCode, const char* errorText = nullptr);
|
||||
error(s32 errorCode, const LogBase& base, const char* errorText = nullptr);
|
||||
error(s32 errorCode, const LogBase* base, const char* errorText = nullptr);
|
||||
|
||||
void print(const char* func = nullptr);
|
||||
};
|
||||
}
|
||||
|
@ -119,31 +119,27 @@ void execute_ppu_func_by_index(PPUThread& CPU, u32 index)
|
||||
|
||||
if (last_code)
|
||||
{
|
||||
CPU.hle_code = func->id;
|
||||
throw "Unfortunately, this function cannot be called from the callback.";
|
||||
throw EXCEPTION("This function cannot be called from the callback: %s (0x%llx)", SysCalls::GetFuncName(func->id), func->id);
|
||||
}
|
||||
|
||||
if (!func->lle_func)
|
||||
{
|
||||
CPU.hle_code = func->id;
|
||||
throw "Wrong usage: LLE function not set.";
|
||||
throw EXCEPTION("LLE function not set: %s (0x%llx)", SysCalls::GetFuncName(func->id), func->id);
|
||||
}
|
||||
|
||||
if (func->flags & MFF_FORCED_HLE)
|
||||
{
|
||||
CPU.hle_code = func->id;
|
||||
throw "Wrong usage: Forced HLE enabled.";
|
||||
throw EXCEPTION("Forced HLE enabled: %s (0x%llx)", SysCalls::GetFuncName(func->id), func->id);
|
||||
}
|
||||
|
||||
if (Ini.HLELogging.GetValue())
|
||||
{
|
||||
LOG_NOTICE(HLE, "Branch to LLE function: %s", SysCalls::GetFuncName(func->id));
|
||||
LOG_NOTICE(HLE, "Branch to LLE function: %s (0x%llx)", SysCalls::GetFuncName(func->id), func->id);
|
||||
}
|
||||
|
||||
if (index & EIF_PERFORM_BLR)
|
||||
{
|
||||
CPU.hle_code = func->id;
|
||||
throw EXCEPTION("TODO: Branch with link (%s)", SysCalls::GetFuncName(func->id));
|
||||
throw EXCEPTION("TODO: Branch with link: %s (0x%llx)", SysCalls::GetFuncName(func->id), func->id);
|
||||
// CPU.LR = CPU.PC + 4;
|
||||
}
|
||||
|
||||
@ -207,7 +203,7 @@ void execute_ppu_func_by_index(PPUThread& CPU, u32 index)
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "Invalid function index";
|
||||
throw EXCEPTION("Invalid function index (0x%x)", index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ s32 cellAudioInit()
|
||||
AudioDumper m_dump;
|
||||
if (do_dump && !m_dump.Init(2)) // Init AudioDumper for 2 channels
|
||||
{
|
||||
throw "AudioDumper::Init() failed";
|
||||
throw EXCEPTION("AudioDumper::Init() failed");
|
||||
}
|
||||
|
||||
float buf2ch[2 * BUFFER_SIZE]; // intermediate buffer for 2 channels
|
||||
@ -335,7 +335,7 @@ s32 cellAudioInit()
|
||||
}
|
||||
else
|
||||
{
|
||||
throw fmt::format("Unknown channel count (port=%d, channel=%d)", &port - g_audio.ports, port.channel);
|
||||
throw EXCEPTION("Unknown channel count (port=%lld, channel=%d)", &port - g_audio.ports, port.channel);
|
||||
}
|
||||
|
||||
memset(buf, 0, block_size * sizeof(float));
|
||||
@ -410,19 +410,19 @@ s32 cellAudioInit()
|
||||
{
|
||||
if (m_dump.WriteData(&buf8ch, sizeof(buf8ch)) != sizeof(buf8ch)) // write file data (8 ch)
|
||||
{
|
||||
throw "AudioDumper::WriteData() failed (8 ch)";
|
||||
throw EXCEPTION("AudioDumper::WriteData() failed (8 ch)");
|
||||
}
|
||||
}
|
||||
else if (m_dump.GetCh() == 2)
|
||||
{
|
||||
if (m_dump.WriteData(&buf2ch, sizeof(buf2ch)) != sizeof(buf2ch)) // write file data (2 ch)
|
||||
{
|
||||
throw "AudioDumper::WriteData() failed (2 ch)";
|
||||
throw EXCEPTION("AudioDumper::WriteData() failed (2 ch)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw fmt::format("AudioDumper::GetCh() returned unknown value (%d)", m_dump.GetCh());
|
||||
throw EXCEPTION("AudioDumper::GetCh() returned unknown value (%d)", m_dump.GetCh());
|
||||
}
|
||||
}
|
||||
|
||||
@ -576,7 +576,7 @@ s32 cellAudioGetPortConfig(u32 portNum, vm::ptr<CellAudioPortConfig> portConfig)
|
||||
case AUDIO_PORT_STATE_CLOSED: portConfig->status = CELL_AUDIO_STATUS_CLOSE; break;
|
||||
case AUDIO_PORT_STATE_OPENED: portConfig->status = CELL_AUDIO_STATUS_READY; break;
|
||||
case AUDIO_PORT_STATE_STARTED: portConfig->status = CELL_AUDIO_STATUS_RUN; break;
|
||||
default: throw fmt::format("cellAudioGetPortConfig(%d): invalid port state (%d)", portNum, state);
|
||||
default: throw EXCEPTION("Invalid port state (%d: %d)", portNum, state);
|
||||
}
|
||||
|
||||
portConfig->nChannel = port.channel;
|
||||
@ -605,7 +605,7 @@ s32 cellAudioPortStart(u32 portNum)
|
||||
case AUDIO_PORT_STATE_CLOSED: return CELL_AUDIO_ERROR_PORT_NOT_OPEN;
|
||||
case AUDIO_PORT_STATE_STARTED: return CELL_AUDIO_ERROR_PORT_ALREADY_RUN;
|
||||
case AUDIO_PORT_STATE_OPENED: return CELL_OK;
|
||||
default: throw fmt::format("cellAudioPortStart(%d): invalid port state (%d)", portNum, state);
|
||||
default: throw EXCEPTION("Invalid port state (%d: %d)", portNum, state);
|
||||
}
|
||||
}
|
||||
|
||||
@ -628,7 +628,7 @@ s32 cellAudioPortClose(u32 portNum)
|
||||
case AUDIO_PORT_STATE_CLOSED: return CELL_AUDIO_ERROR_PORT_NOT_OPEN;
|
||||
case AUDIO_PORT_STATE_STARTED: return CELL_OK;
|
||||
case AUDIO_PORT_STATE_OPENED: return CELL_OK;
|
||||
default: throw fmt::format("cellAudioPortClose(%d): invalid port state (%d)", portNum, state);
|
||||
default: throw EXCEPTION("Invalid port state (%d: %d)", portNum, state);
|
||||
}
|
||||
}
|
||||
|
||||
@ -651,7 +651,7 @@ s32 cellAudioPortStop(u32 portNum)
|
||||
case AUDIO_PORT_STATE_CLOSED: return CELL_AUDIO_ERROR_PORT_NOT_RUN;
|
||||
case AUDIO_PORT_STATE_STARTED: return CELL_OK;
|
||||
case AUDIO_PORT_STATE_OPENED: return CELL_AUDIO_ERROR_PORT_NOT_RUN;
|
||||
default: throw fmt::format("cellAudioPortStop(%d): invalid port state (%d)", portNum, state);
|
||||
default: throw EXCEPTION("Invalid port state (%d: %d)", portNum, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ bool spursKernelEntry(SPUThread & spu);
|
||||
//
|
||||
// SPURS utility functions
|
||||
//
|
||||
void spursPpuThreadExit(PPUThread& CPU, u64 errorStatus);
|
||||
u32 spursGetSdkVersion();
|
||||
bool spursIsLibProfLoaded();
|
||||
|
||||
@ -260,13 +259,6 @@ s32 cellSpursAddUrgentCall();
|
||||
// SPURS utility functions
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
/// Terminate a SPURS PPU thread
|
||||
void spursPpuThreadExit(PPUThread& CPU, u64 errorStatus)
|
||||
{
|
||||
sys_ppu_thread_exit(CPU, errorStatus);
|
||||
throw SpursModuleExit();
|
||||
}
|
||||
|
||||
/// Get the version of SDK used by this process
|
||||
u32 spursGetSdkVersion()
|
||||
{
|
||||
@ -433,7 +425,7 @@ void spursHandlerWaitReady(PPUThread& CPU, vm::ptr<CellSpurs> spurs)
|
||||
{
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
spursPpuThreadExit(CPU, 0);
|
||||
sys_ppu_thread_exit(CPU, 0);
|
||||
}
|
||||
|
||||
if (spurs->handlerExiting.load())
|
||||
@ -443,7 +435,7 @@ void spursHandlerWaitReady(PPUThread& CPU, vm::ptr<CellSpurs> spurs)
|
||||
throw EXCEPTION("sys_lwmutex_unlock() failed (0x%x)", rc);
|
||||
}
|
||||
|
||||
spursPpuThreadExit(CPU, 0);
|
||||
sys_ppu_thread_exit(CPU, 0);
|
||||
}
|
||||
|
||||
// Find a runnable workload
|
||||
@ -519,49 +511,43 @@ void spursHandlerEntry(PPUThread& CPU)
|
||||
{
|
||||
auto spurs = vm::ptr<CellSpurs>::make(vm::cast(CPU.GPR[3]));
|
||||
|
||||
try
|
||||
if (spurs->flags & SAF_UNKNOWN_FLAG_30)
|
||||
{
|
||||
if (spurs->flags & SAF_UNKNOWN_FLAG_30)
|
||||
{
|
||||
spursPpuThreadExit(CPU, 0);
|
||||
}
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (spurs->flags1 & SF1_EXIT_IF_NO_WORK)
|
||||
{
|
||||
spursHandlerWaitReady(CPU, spurs);
|
||||
}
|
||||
|
||||
if (s32 rc = sys_spu_thread_group_start(spurs->spuTG))
|
||||
{
|
||||
throw EXCEPTION("sys_spu_thread_group_start() failed (0x%x)", rc);
|
||||
}
|
||||
|
||||
if (s32 rc = sys_spu_thread_group_join(spurs->spuTG, vm::null, vm::null))
|
||||
{
|
||||
if (rc == CELL_ESTAT)
|
||||
{
|
||||
spursPpuThreadExit(CPU, 0);
|
||||
}
|
||||
|
||||
throw EXCEPTION("sys_spu_thread_group_join() failed (0x%x)", rc);
|
||||
}
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((spurs->flags1 & SF1_EXIT_IF_NO_WORK) == 0)
|
||||
{
|
||||
assert(spurs->handlerExiting.load() == 1 || Emu.IsStopped());
|
||||
spursPpuThreadExit(CPU, 0);
|
||||
}
|
||||
}
|
||||
sys_ppu_thread_exit(CPU, 0);
|
||||
}
|
||||
catch(SpursModuleExit)
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (spurs->flags1 & SF1_EXIT_IF_NO_WORK)
|
||||
{
|
||||
spursHandlerWaitReady(CPU, spurs);
|
||||
}
|
||||
|
||||
if (s32 rc = sys_spu_thread_group_start(spurs->spuTG))
|
||||
{
|
||||
throw EXCEPTION("sys_spu_thread_group_start() failed (0x%x)", rc);
|
||||
}
|
||||
|
||||
if (s32 rc = sys_spu_thread_group_join(spurs->spuTG, vm::null, vm::null))
|
||||
{
|
||||
if (rc == CELL_ESTAT)
|
||||
{
|
||||
sys_ppu_thread_exit(CPU, 0);
|
||||
}
|
||||
|
||||
throw EXCEPTION("sys_spu_thread_group_join() failed (0x%x)", rc);
|
||||
}
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((spurs->flags1 & SF1_EXIT_IF_NO_WORK) == 0)
|
||||
{
|
||||
assert(spurs->handlerExiting.load() == 1 || Emu.IsStopped());
|
||||
sys_ppu_thread_exit(CPU, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ enum
|
||||
SCE_NP_COMMUNITY_ERROR_TOO_MANY_SLOTID = 0x8002a1b1,
|
||||
};
|
||||
|
||||
typedef int(*SceNpBasicEventHandler)(s32 event, s32 retCode, u32 reqId, vm::ptr<void> arg);
|
||||
using SceNpBasicEventHandler = func_def<s32(s32 event, s32 retCode, u32 reqId, vm::ptr<void> arg)>;
|
||||
|
||||
// NP Manager Utility statuses
|
||||
enum
|
||||
@ -692,41 +692,41 @@ enum
|
||||
// NP communication ID structure
|
||||
struct SceNpCommunicationId
|
||||
{
|
||||
s8 data[9];
|
||||
s8 term;
|
||||
char data[9];
|
||||
char term;
|
||||
u8 num;
|
||||
//s8 dummy;
|
||||
char dummy;
|
||||
};
|
||||
|
||||
// OnlineId structure
|
||||
struct SceNpOnlineId
|
||||
{
|
||||
s8 data[16];
|
||||
s8 term;
|
||||
//s8 dummy[3];
|
||||
char data[16];
|
||||
char term;
|
||||
char dummy[3];
|
||||
};
|
||||
|
||||
// NP ID structure
|
||||
struct SceNpId
|
||||
{
|
||||
SceNpOnlineId handle;
|
||||
//u8 opt[8];
|
||||
//u8 reserved[8];
|
||||
u8 opt[8];
|
||||
u8 reserved[8];
|
||||
};
|
||||
|
||||
// Online Name structure
|
||||
struct SceNpOnlineName
|
||||
{
|
||||
s8 data[48];
|
||||
s8 term;
|
||||
s8 padding[3];
|
||||
char data[48];
|
||||
char term;
|
||||
char padding[3];
|
||||
};
|
||||
|
||||
// Avatar structure
|
||||
struct SceNpAvatarUrl
|
||||
{
|
||||
s8 data[127];
|
||||
s8 term;
|
||||
char data[127];
|
||||
char term;
|
||||
};
|
||||
|
||||
// Avatar image structure
|
||||
@ -734,14 +734,14 @@ struct SceNpAvatarImage
|
||||
{
|
||||
u8 data[SCE_NET_NP_AVATAR_IMAGE_MAX_SIZE];
|
||||
be_t<u32> size;
|
||||
//u8 reserved[12];
|
||||
u8 reserved[12];
|
||||
};
|
||||
|
||||
// Self introduction structure
|
||||
struct SceNpAboutMe
|
||||
{
|
||||
s8 data[SCE_NET_NP_ABOUT_ME_MAX_LENGTH];
|
||||
s8 term;
|
||||
char data[SCE_NET_NP_ABOUT_ME_MAX_LENGTH];
|
||||
char term;
|
||||
};
|
||||
|
||||
// User information structure
|
||||
@ -752,12 +752,12 @@ struct SceNpUserInfo
|
||||
SceNpAvatarUrl icon;
|
||||
};
|
||||
|
||||
// User information structure (pointer version)
|
||||
// User information structure
|
||||
struct SceNpUserInfo2
|
||||
{
|
||||
SceNpId npId;
|
||||
SceNpOnlineName onlineName;
|
||||
SceNpAvatarUrl avatarUrl;
|
||||
vm::bptr<SceNpOnlineName> onlineName;
|
||||
vm::bptr<SceNpAvatarUrl> avatarUrl;
|
||||
};
|
||||
|
||||
// Often used languages structure
|
||||
@ -784,6 +784,7 @@ struct SceNpCommunicationSignature
|
||||
// NP cache information structure
|
||||
struct SceNpManagerCacheParam
|
||||
{
|
||||
be_t<u32> size;
|
||||
SceNpOnlineId onlineId;
|
||||
SceNpId npId;
|
||||
SceNpOnlineName onlineName;
|
||||
@ -793,7 +794,7 @@ struct SceNpManagerCacheParam
|
||||
// Message attachment data
|
||||
struct SceNpBasicAttachmentData
|
||||
{
|
||||
be_t<u32> id;
|
||||
be_t<u32> id; // SceNpBasicAttachmentDataId
|
||||
be_t<u32> size;
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "stdafx.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/CB_FUNC.h"
|
||||
|
||||
@ -18,156 +19,157 @@
|
||||
extern Module sceNpTrophy;
|
||||
|
||||
// Internal Structs
|
||||
struct sceNpTrophyInternalContext
|
||||
struct trophy_context_t
|
||||
{
|
||||
// TODO
|
||||
const u32 id;
|
||||
|
||||
std::string trp_name;
|
||||
std::unique_ptr<vfsStream> trp_stream;
|
||||
|
||||
std::unique_ptr<TROPUSRLoader> tropusr;
|
||||
|
||||
// TODO: remove the following code when Visual C++ no longer generates
|
||||
// compiler errors for it. All of this should be auto-generated
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
sceNpTrophyInternalContext()
|
||||
: trp_stream(),
|
||||
tropusr()
|
||||
trophy_context_t()
|
||||
: id(Emu.GetIdManager().get_current_id())
|
||||
{
|
||||
}
|
||||
|
||||
sceNpTrophyInternalContext(sceNpTrophyInternalContext&& other)
|
||||
{
|
||||
std::swap(trp_stream,other.trp_stream);
|
||||
std::swap(tropusr, other.tropusr);
|
||||
std::swap(trp_name, other.trp_name);
|
||||
}
|
||||
|
||||
sceNpTrophyInternalContext& operator =(sceNpTrophyInternalContext&& other)
|
||||
{
|
||||
std::swap(trp_stream, other.trp_stream);
|
||||
std::swap(tropusr, other.tropusr);
|
||||
std::swap(trp_name, other.trp_name);
|
||||
return *this;
|
||||
}
|
||||
|
||||
sceNpTrophyInternalContext(sceNpTrophyInternalContext& other) = delete;
|
||||
sceNpTrophyInternalContext& operator =(sceNpTrophyInternalContext& other) = delete;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
struct sceNpTrophyInternal
|
||||
struct trophy_handle_t
|
||||
{
|
||||
bool m_bInitialized;
|
||||
std::vector<sceNpTrophyInternalContext> contexts;
|
||||
const u32 id;
|
||||
|
||||
sceNpTrophyInternal()
|
||||
: m_bInitialized(false)
|
||||
trophy_handle_t()
|
||||
: id(Emu.GetIdManager().get_current_id())
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
sceNpTrophyInternal sceNpTrophyInstance;
|
||||
|
||||
static sceNpTrophyInternalContext& getContext(u32 context) {
|
||||
// The invalid context is 0, so remap contexts 1... to indices 0...
|
||||
if (context == 0)
|
||||
throw "getContext: context == 0";
|
||||
return sceNpTrophyInstance.contexts[context - 1];
|
||||
}
|
||||
|
||||
// Functions
|
||||
int sceNpTrophyInit(u32 pool_addr, u32 poolSize, u32 containerId, u64 options)
|
||||
s32 sceNpTrophyInit(vm::ptr<void> pool, u32 poolSize, u32 containerId, u64 options)
|
||||
{
|
||||
sceNpTrophy.Log("sceNpTrophyInit(pool_addr=0x%x, poolSize=%d, containerId=0x%x, options=0x%llx)", pool_addr, poolSize, containerId, options);
|
||||
|
||||
if (sceNpTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_ALREADY_INITIALIZED;
|
||||
if (options)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED;
|
||||
|
||||
sceNpTrophyInstance.m_bInitialized = true;
|
||||
sceNpTrophy.Warning("sceNpTrophyInit(pool=*0x%x, poolSize=0x%x, containerId=0x%x, options=0x%llx)", pool, poolSize, containerId, options);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyCreateContext(vm::ptr<u32> context, vm::cptr<SceNpCommunicationId> commID, vm::cptr<SceNpCommunicationSignature> commSign, u64 options)
|
||||
s32 sceNpTrophyTerm()
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyCreateContext(context=*0x%x, commID=*0x%x, commSign=*0x%x, options=0x%llx)", context, commID, commSign, options);
|
||||
sceNpTrophy.Warning("sceNpTrophyTerm()");
|
||||
|
||||
if (!sceNpTrophyInstance.m_bInitialized)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpTrophyCreateHandle(vm::ptr<u32> handle)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyCreateHandle(handle=*0x%x)", handle);
|
||||
|
||||
if (!handle)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
if (options & ~1)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
// TODO: There are other possible errors
|
||||
*handle = Emu.GetIdManager().make<trophy_handle_t>();
|
||||
|
||||
// TODO: Is the TROPHY.TRP file necessarily located in this path?
|
||||
if (!Emu.GetVFS().ExistsDir("/app_home/../TROPDIR/"))
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpTrophyDestroyHandle(u32 handle)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyDestroyHandle(handle=0x%x)", handle);
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().remove<trophy_handle_t>(handle);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpTrophyAbortHandle(u32 handle)
|
||||
{
|
||||
sceNpTrophy.Todo("sceNpTrophyAbortHandle(handle=0x%x)", handle);
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpTrophyCreateContext(vm::ptr<u32> context, vm::cptr<SceNpCommunicationId> commId, vm::cptr<SceNpCommunicationSignature> commSign, u64 options)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyCreateContext(context=*0x%x, commId=*0x%x, commSign=*0x%x, options=0x%llx)", context, commId, commSign, options);
|
||||
|
||||
// rough checks for further fmt::format call
|
||||
if (commId->term || commId->num > 99)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_NP_COMM_ID;
|
||||
}
|
||||
|
||||
// generate trophy context name
|
||||
std::string name = fmt::format("%s_%02d", commId->data, commId->num);
|
||||
|
||||
// open trophy pack file
|
||||
std::unique_ptr<vfsStream> stream(Emu.GetVFS().OpenFile("/app_home/../TROPDIR/" + name + "/TROPHY.TRP", vfsRead));
|
||||
|
||||
// check if exists and opened
|
||||
if (!stream || !stream->IsOpened())
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
|
||||
}
|
||||
|
||||
// TODO: Following method will retrieve the TROPHY.TRP of the first folder that contains such file
|
||||
for (const auto entry : vfsDir("/app_home/../TROPDIR/"))
|
||||
{
|
||||
if (entry->flags & DirEntry_TypeDir)
|
||||
{
|
||||
vfsStream* stream = Emu.GetVFS().OpenFile("/app_home/../TROPDIR/" + entry->name + "/TROPHY.TRP", vfsRead);
|
||||
// create trophy context
|
||||
const auto ctxt = Emu.GetIdManager().make_ptr<trophy_context_t>();
|
||||
|
||||
if (stream && stream->IsOpened())
|
||||
{
|
||||
sceNpTrophyInstance.contexts.emplace_back();
|
||||
sceNpTrophyInternalContext& ctxt = sceNpTrophyInstance.contexts.back();
|
||||
ctxt.trp_stream.reset(stream);
|
||||
ctxt.trp_name = entry->name;
|
||||
stream = nullptr;
|
||||
*context = sceNpTrophyInstance.contexts.size(); // contexts start from 1
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
|
||||
}
|
||||
|
||||
int sceNpTrophyCreateHandle(vm::ptr<u32> handle)
|
||||
{
|
||||
sceNpTrophy.Todo("sceNpTrophyCreateHandle(handle_addr=0x%x)", handle.addr());
|
||||
|
||||
if (!sceNpTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
// TODO: There are other possible errors
|
||||
|
||||
// TODO: ?
|
||||
// set trophy context parameters (could be passed to constructor through make_ptr call)
|
||||
ctxt->trp_name = std::move(name);
|
||||
ctxt->trp_stream = std::move(stream);
|
||||
*context = ctxt->id;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<SceNpTrophyStatusCallback> statusCb, u32 arg_addr, u64 options)
|
||||
s32 sceNpTrophyDestroyContext(u32 context)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyRegisterContext(context=0x%x, handle=0x%x, statusCb_addr=0x%x, arg_addr=0x%x, options=0x%llx)",
|
||||
context, handle, statusCb.addr(), arg_addr, options);
|
||||
sceNpTrophy.Warning("sceNpTrophyDestroyContext(context=0x%x)", context);
|
||||
|
||||
if (!(sceNpTrophyInstance.m_bInitialized))
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
if (options & (~(u64)1))
|
||||
return SCE_NP_TROPHY_ERROR_NOT_SUPPORTED;
|
||||
if (context == 0 || context > sceNpTrophyInstance.contexts.size()) {
|
||||
sceNpTrophy.Warning("sceNpTrophyRegisterContext: invalid context (%d)", context);
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
// TODO: There are other possible errors
|
||||
|
||||
sceNpTrophyInternalContext& ctxt = getContext(context);
|
||||
if (!ctxt.trp_stream)
|
||||
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
|
||||
Emu.GetIdManager().remove<trophy_context_t>(context);
|
||||
|
||||
TRPLoader trp(*(ctxt.trp_stream));
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<SceNpTrophyStatusCallback> statusCb, vm::ptr<u32> arg, u64 options)
|
||||
{
|
||||
sceNpTrophy.Error("sceNpTrophyRegisterContext(context=0x%x, handle=0x%x, statusCb=*0x%x, arg=*0x%x, options=0x%llx)", context, handle, statusCb, arg, options);
|
||||
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
TRPLoader trp(*ctxt->trp_stream);
|
||||
if (!trp.LoadHeader())
|
||||
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
|
||||
|
||||
@ -191,14 +193,14 @@ int sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<
|
||||
}
|
||||
|
||||
// Discard unnecessary TROP_XX.SFM files
|
||||
for (int i=0; i<=18; i++) {
|
||||
for (s32 i=0; i<=18; i++) {
|
||||
strcpy_trunc(target, fmt::Format("TROP_%02d.SFM", i));
|
||||
if (i != Ini.SysLanguage.GetValue())
|
||||
trp.RemoveEntry(target);
|
||||
}
|
||||
|
||||
// TODO: Get the path of the current user
|
||||
std::string trophyPath = "/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name;
|
||||
std::string trophyPath = "/dev_hdd0/home/00000001/trophy/" + ctxt->trp_name;
|
||||
if (!trp.Install(trophyPath))
|
||||
return SCE_NP_TROPHY_ERROR_ILLEGAL_UPDATE;
|
||||
|
||||
@ -206,79 +208,67 @@ int sceNpTrophyRegisterContext(PPUThread& CPU, u32 context, u32 handle, vm::ptr<
|
||||
std::string trophyUsrPath = trophyPath + "/TROPUSR.DAT";
|
||||
std::string trophyConfPath = trophyPath + "/TROPCONF.SFM";
|
||||
tropusr->Load(trophyUsrPath, trophyConfPath);
|
||||
ctxt.tropusr.reset(tropusr);
|
||||
ctxt->tropusr.reset(tropusr);
|
||||
|
||||
// TODO: Callbacks
|
||||
statusCb(CPU, context, SCE_NP_TROPHY_STATUS_INSTALLED, 100, 100, arg_addr);
|
||||
statusCb(CPU, context, SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE, 100, 100, arg_addr);
|
||||
statusCb(CPU, context, SCE_NP_TROPHY_STATUS_INSTALLED, 100, 100, arg);
|
||||
statusCb(CPU, context, SCE_NP_TROPHY_STATUS_PROCESSING_COMPLETE, 100, 100, arg);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyGetGameProgress()
|
||||
s32 sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64> reqspace, u64 options)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(sceNpTrophy);
|
||||
return CELL_OK;
|
||||
}
|
||||
sceNpTrophy.Error("sceNpTrophyGetRequiredDiskSpace(context=0x%x, handle=0x%x, reqspace*=0x%x, options=0x%llx)", context, handle, reqspace, options);
|
||||
|
||||
int sceNpTrophySetSoundLevel()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(sceNpTrophy);
|
||||
return CELL_OK;
|
||||
}
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
|
||||
int sceNpTrophyGetRequiredDiskSpace(u32 context, u32 handle, vm::ptr<u64> reqspace, u64 options)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyGetRequiredDiskSpace(context=0x%x, handle=0x%x, reqspace_addr=0x%x, options=0x%llx)",
|
||||
context, handle, reqspace.addr(), options);
|
||||
|
||||
if (!sceNpTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
if (context == 0 || context > sceNpTrophyInstance.contexts.size()) {
|
||||
sceNpTrophy.Warning("sceNpTrophyGetRequiredDiskSpace: invalid context (%d)", context);
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
// TODO: There are other possible errors
|
||||
|
||||
const sceNpTrophyInternalContext& ctxt = getContext(context);
|
||||
if (!ctxt.trp_stream)
|
||||
return SCE_NP_TROPHY_ERROR_CONF_DOES_NOT_EXIST;
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
|
||||
*reqspace = ctxt.trp_stream->GetSize(); // TODO: This is not accurate. It's just an approximation of the real value
|
||||
return CELL_OK;
|
||||
}
|
||||
if (!hndl)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
int sceNpTrophyDestroyContext()
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(sceNpTrophy);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyAbortHandle(u32 handle)
|
||||
{
|
||||
sceNpTrophy.Todo("sceNpTrophyAbortHandle(handle=0x%x)", handle);
|
||||
|
||||
// TODO: ?
|
||||
|
||||
if (!sceNpTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
// TODO: This is not accurate. It's just an approximation of the real value
|
||||
*reqspace = ctxt->trp_stream->GetSize();
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr<SceNpTrophyGameDetails> details, vm::ptr<SceNpTrophyGameData> data)
|
||||
s32 sceNpTrophySetSoundLevel(u32 context, u32 handle, u32 level, u64 options)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyGetGameInfo(context=0x%x, handle=0x%x, details_addr=0x%x, data_addr=0x%x)",
|
||||
context, handle, details.addr(), data.addr());
|
||||
sceNpTrophy.Todo("sceNpTrophySetSoundLevel(context=0x%x, handle=0x%x, level=%d, options=0x%llx)", context, handle, level, options);
|
||||
|
||||
if (!sceNpTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
// TODO: There are other possible errors
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr<SceNpTrophyGameDetails> details, vm::ptr<SceNpTrophyGameData> data)
|
||||
{
|
||||
sceNpTrophy.Error("sceNpTrophyGetGameInfo(context=0x%x, handle=0x%x, details=*0x%x, data=*0x%x)", context, handle, details, data);
|
||||
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
std::string path;
|
||||
rXmlDocument doc;
|
||||
const sceNpTrophyInternalContext& ctxt = getContext(context);
|
||||
Emu.GetVFS().GetDevice("/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name + "/TROPCONF.SFM", path); // TODO: Get the path of the current user
|
||||
Emu.GetVFS().GetDevice("/dev_hdd0/home/00000001/trophy/" + ctxt->trp_name + "/TROPCONF.SFM", path); // TODO: Get the path of the current user
|
||||
doc.Load(path);
|
||||
|
||||
std::string titleName;
|
||||
@ -300,7 +290,7 @@ int sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr<SceNpTrophyGameDetai
|
||||
case 'P': details->numPlatinum++; break;
|
||||
}
|
||||
|
||||
if (ctxt.tropusr->GetTrophyUnlockState(trophy_id))
|
||||
if (ctxt->tropusr->GetTrophyUnlockState(trophy_id))
|
||||
{
|
||||
data->unlockedTrophies++;
|
||||
switch (n->GetAttribute("ttype")[0]) {
|
||||
@ -313,77 +303,71 @@ int sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr<SceNpTrophyGameDetai
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(details->title, titleName.c_str(), std::min((size_t) SCE_NP_TROPHY_NAME_MAX_SIZE, titleName.length() + 1));
|
||||
memcpy(details->description, titleDetail.c_str(), std::min((size_t) SCE_NP_TROPHY_DESCR_MAX_SIZE, titleDetail.length() + 1));
|
||||
strcpy_trunc(details->title, titleName);
|
||||
strcpy_trunc(details->description, titleDetail);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyDestroyHandle()
|
||||
s32 sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr<u32> platinumId)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(sceNpTrophy);
|
||||
return CELL_OK;
|
||||
}
|
||||
sceNpTrophy.Error("sceNpTrophyUnlockTrophy(context=0x%x, handle=0x%x, trophyId=%d, platinumId=*0x%x)", context, handle, trophyId, platinumId);
|
||||
|
||||
int sceNpTrophyUnlockTrophy(u32 context, u32 handle, s32 trophyId, vm::ptr<u32> platinumId)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyUnlockTrophy(context=0x%x, handle=0x%x, trophyId=%d, platinumId_addr=0x%x)",
|
||||
context, handle, trophyId, platinumId.addr());
|
||||
|
||||
if (!sceNpTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
// TODO: There are other possible errors
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
|
||||
sceNpTrophyInternalContext& ctxt = getContext(context);
|
||||
if (trophyId >= (s32)ctxt.tropusr->GetTrophiesCount())
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
if (trophyId >= (s32)ctxt->tropusr->GetTrophiesCount())
|
||||
return SCE_NP_TROPHY_ERROR_INVALID_TROPHY_ID;
|
||||
if (ctxt.tropusr->GetTrophyUnlockState(trophyId))
|
||||
if (ctxt->tropusr->GetTrophyUnlockState(trophyId))
|
||||
return SCE_NP_TROPHY_ERROR_ALREADY_UNLOCKED;
|
||||
|
||||
u64 timestamp1 = get_system_time(); // TODO: Either timestamp1 or timestamp2 is wrong
|
||||
u64 timestamp2 = get_system_time(); // TODO: Either timestamp1 or timestamp2 is wrong
|
||||
ctxt.tropusr->UnlockTrophy(trophyId, timestamp1, timestamp2);
|
||||
std::string trophyPath = "/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name + "/TROPUSR.DAT";
|
||||
ctxt.tropusr->Save(trophyPath);
|
||||
ctxt->tropusr->UnlockTrophy(trophyId, timestamp1, timestamp2);
|
||||
std::string trophyPath = "/dev_hdd0/home/00000001/trophy/" + ctxt->trp_name + "/TROPUSR.DAT";
|
||||
ctxt->tropusr->Save(trophyPath);
|
||||
|
||||
*platinumId = SCE_NP_TROPHY_INVALID_TROPHY_ID; // TODO
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyTerm()
|
||||
s32 sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr<SceNpTrophyFlagArray> flags, vm::ptr<u32> count)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyTerm()");
|
||||
sceNpTrophy.Error("sceNpTrophyGetTrophyUnlockState(context=0x%x, handle=0x%x, flags=*0x%x, count=*0x%x)", context, handle, flags, count);
|
||||
|
||||
if (!sceNpTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
|
||||
sceNpTrophyInstance.m_bInitialized = false;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr<SceNpTrophyFlagArray> flags, vm::ptr<u32> count)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyGetTrophyUnlockState(context=0x%x, handle=0x%x, flags_addr=0x%x, count_addr=0x%x)",
|
||||
context, handle, flags.addr(), count.addr());
|
||||
|
||||
if (!sceNpTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
if (context == 0 || context > sceNpTrophyInstance.contexts.size()) {
|
||||
sceNpTrophy.Warning("sceNpTrophyGetTrophyUnlockState: invalid context (%d)", context);
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
// TODO: There are other possible errors
|
||||
|
||||
const sceNpTrophyInternalContext& ctxt = getContext(context);
|
||||
u32 count_ = ctxt.tropusr->GetTrophiesCount();
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
u32 count_ = ctxt->tropusr->GetTrophiesCount();
|
||||
*count = count_;
|
||||
if (count_ > 128)
|
||||
sceNpTrophy.Warning("sceNpTrophyGetTrophyUnlockState: More than 128 trophies detected!");
|
||||
sceNpTrophy.Error("sceNpTrophyGetTrophyUnlockState: More than 128 trophies detected!");
|
||||
|
||||
// Pack up to 128 bools in u32 flag_bits[4]
|
||||
for (u32 id = 0; id < count_; id++)
|
||||
{
|
||||
if (ctxt.tropusr->GetTrophyUnlockState(id))
|
||||
if (ctxt->tropusr->GetTrophyUnlockState(id))
|
||||
flags->flag_bits[id/32] |= 1<<(id%32);
|
||||
else
|
||||
flags->flag_bits[id/32] &= ~(1<<(id%32));
|
||||
@ -392,25 +376,27 @@ int sceNpTrophyGetTrophyUnlockState(u32 context, u32 handle, vm::ptr<SceNpTrophy
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyGetTrophyIcon()
|
||||
s32 sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptr<SceNpTrophyDetails> details, vm::ptr<SceNpTrophyData> data)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(sceNpTrophy);
|
||||
return CELL_OK;
|
||||
}
|
||||
sceNpTrophy.Warning("sceNpTrophyGetTrophyInfo(context=0x%x, handle=0x%x, trophyId=%d, details=*0x%x, data=*0x%x)", context, handle, trophyId, details, data);
|
||||
|
||||
int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptr<SceNpTrophyDetails> details, vm::ptr<SceNpTrophyData> data)
|
||||
{
|
||||
sceNpTrophy.Warning("sceNpTrophyGetTrophyInfo(context=0x%x, handle=0x%x, trophyId=%d, details_addr=0x%x, data_addr=0x%x)",
|
||||
context, handle, trophyId, details.addr(), data.addr());
|
||||
const auto ctxt = Emu.GetIdManager().get<trophy_context_t>(context);
|
||||
|
||||
if (!sceNpTrophyInstance.m_bInitialized)
|
||||
return SCE_NP_TROPHY_ERROR_NOT_INITIALIZED;
|
||||
// TODO: There are other possible errors
|
||||
if (!ctxt)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_CONTEXT;
|
||||
}
|
||||
|
||||
const auto hndl = Emu.GetIdManager().get<trophy_handle_t>(handle);
|
||||
|
||||
if (!hndl)
|
||||
{
|
||||
return SCE_NP_TROPHY_ERROR_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
std::string path;
|
||||
rXmlDocument doc;
|
||||
const sceNpTrophyInternalContext& ctxt = getContext(context);
|
||||
Emu.GetVFS().GetDevice("/dev_hdd0/home/00000001/trophy/" + ctxt.trp_name + "/TROPCONF.SFM", path); // TODO: Get the path of the current user
|
||||
Emu.GetVFS().GetDevice("/dev_hdd0/home/00000001/trophy/" + ctxt->trp_name + "/TROPCONF.SFM", path); // TODO: Get the path of the current user
|
||||
doc.Load(path);
|
||||
|
||||
std::string name;
|
||||
@ -437,8 +423,8 @@ int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptr<SceN
|
||||
}
|
||||
|
||||
data->trophyId = trophyId;
|
||||
data->unlocked = ctxt.tropusr->GetTrophyUnlockState(trophyId) ? true : false; // ???
|
||||
data->timestamp.tick = ctxt.tropusr->GetTrophyTimestamp(trophyId);
|
||||
data->unlocked = ctxt->tropusr->GetTrophyUnlockState(trophyId) != 0; // ???
|
||||
data->timestamp = ctxt->tropusr->GetTrophyTimestamp(trophyId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -447,16 +433,30 @@ int sceNpTrophyGetTrophyInfo(u32 context, u32 handle, s32 trophyId, vm::ptr<SceN
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sceNpTrophyGetGameIcon()
|
||||
s32 sceNpTrophyGetGameProgress(u32 context, u32 handle, vm::ptr<s32> percentage)
|
||||
{
|
||||
UNIMPLEMENTED_FUNC(sceNpTrophy);
|
||||
sceNpTrophy.Todo("sceNpTrophyGetGameProgress(context=0x%x, handle=0x%x, percentage=*0x%x)", context, handle, percentage);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpTrophyGetGameIcon(u32 context, u32 handle, vm::ptr<void> buffer, vm::ptr<u32> size)
|
||||
{
|
||||
sceNpTrophy.Todo("sceNpTrophyGetGameIcon(context=0x%x, handle=0x%x, buffer=*0x%x, size=*0x%x)", context, handle, buffer, size);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sceNpTrophyGetTrophyIcon(u32 context, u32 handle, s32 trophyId, vm::ptr<void> buffer, vm::ptr<u32> size)
|
||||
{
|
||||
sceNpTrophy.Todo("sceNpTrophyGetTrophyIcon(context=0x%x, handle=0x%x, trophyId=%d, buffer=*0x%x, size=*0x%x)", context, handle, trophyId, buffer, size);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
||||
Module sceNpTrophy("sceNpTrophy", []()
|
||||
{
|
||||
sceNpTrophyInstance.m_bInitialized = false;
|
||||
|
||||
REG_FUNC(sceNpTrophy, sceNpTrophyGetGameProgress);
|
||||
REG_FUNC(sceNpTrophy, sceNpTrophyRegisterContext);
|
||||
REG_FUNC(sceNpTrophy, sceNpTrophyCreateHandle);
|
||||
|
@ -82,8 +82,8 @@ struct SceNpTrophyGameDetails
|
||||
be_t<u32> numGold;
|
||||
be_t<u32> numSilver;
|
||||
be_t<u32> numBronze;
|
||||
u8 title[SCE_NP_TROPHY_TITLE_MAX_SIZE];
|
||||
u8 description[SCE_NP_TROPHY_GAME_DESCR_MAX_SIZE];
|
||||
char title[SCE_NP_TROPHY_TITLE_MAX_SIZE];
|
||||
char description[SCE_NP_TROPHY_GAME_DESCR_MAX_SIZE];
|
||||
u8 reserved[4];
|
||||
};
|
||||
|
||||
@ -100,17 +100,17 @@ struct SceNpTrophyDetails
|
||||
{
|
||||
be_t<s32> trophyId; // SceNpTrophyId
|
||||
be_t<u32> trophyGrade; // SceNpTrophyGrade
|
||||
u8 name[SCE_NP_TROPHY_NAME_MAX_SIZE];
|
||||
u8 description[SCE_NP_TROPHY_DESCR_MAX_SIZE];
|
||||
bool hidden;
|
||||
char name[SCE_NP_TROPHY_NAME_MAX_SIZE];
|
||||
char description[SCE_NP_TROPHY_DESCR_MAX_SIZE];
|
||||
b8 hidden;
|
||||
u8 reserved[3];
|
||||
};
|
||||
|
||||
struct SceNpTrophyData
|
||||
{
|
||||
CellRtcTick timestamp;
|
||||
be_t<u64> timestamp; // CellRtcTick
|
||||
be_t<s32> trophyId; // SceNpTrophyId
|
||||
bool unlocked;
|
||||
b8 unlocked;
|
||||
u8 reserved[3];
|
||||
};
|
||||
|
||||
@ -136,4 +136,4 @@ enum
|
||||
SCE_NP_TROPHY_STATUS_CHANGES_DETECTED = 9,
|
||||
};
|
||||
|
||||
typedef s32 (SceNpTrophyStatusCallback)(u32 context, u32 status, s32 completed, s32 total, u32 arg_addr);
|
||||
using SceNpTrophyStatusCallback = func_def<s32(u32 context, u32 status, s32 completed, s32 total, vm::ptr<void> arg)>;
|
||||
|
@ -75,7 +75,7 @@ u32 ppu_get_tls(u32 thread)
|
||||
}
|
||||
}
|
||||
|
||||
throw "Out of TLS memory";
|
||||
throw EXCEPTION("Out of TLS memory");
|
||||
}
|
||||
|
||||
void ppu_free_tls(u32 thread)
|
||||
@ -752,7 +752,7 @@ std::string ps3_fmt(PPUThread& context, vm::cptr<char> fmt, u32 g_count, u32 f_c
|
||||
}
|
||||
}
|
||||
|
||||
throw fmt::format("ps3_fmt(): unknown formatting: '%s'", start.get_ptr());
|
||||
throw EXCEPTION("Unknown formatting: '%s'", start.get_ptr());
|
||||
}
|
||||
}
|
||||
|
||||
@ -981,7 +981,7 @@ vm::ptr<char> _sys_strcat(vm::ptr<char> dest, vm::cptr<char> source)
|
||||
|
||||
if (strcat(dest.get_ptr(), source.get_ptr()) != dest.get_ptr())
|
||||
{
|
||||
throw "_sys_strcat() failed: unexpected strcat() result";
|
||||
throw EXCEPTION("Unexpected strcat() result");
|
||||
}
|
||||
|
||||
return dest;
|
||||
@ -1000,7 +1000,7 @@ vm::ptr<char> _sys_strncat(vm::ptr<char> dest, vm::cptr<char> source, u32 len)
|
||||
|
||||
if (strncat(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr())
|
||||
{
|
||||
throw "_sys_strncat() failed: unexpected strncat() result";
|
||||
throw EXCEPTION("Unexpected strncat() result");
|
||||
}
|
||||
|
||||
return dest;
|
||||
@ -1012,7 +1012,7 @@ vm::ptr<char> _sys_strcpy(vm::ptr<char> dest, vm::cptr<char> source)
|
||||
|
||||
if (strcpy(dest.get_ptr(), source.get_ptr()) != dest.get_ptr())
|
||||
{
|
||||
throw "_sys_strcpy() failed: unexpected strcpy() result";
|
||||
throw EXCEPTION("Unexpected strcpy() result");
|
||||
}
|
||||
|
||||
return dest;
|
||||
@ -1029,7 +1029,7 @@ vm::ptr<char> _sys_strncpy(vm::ptr<char> dest, vm::cptr<char> source, u32 len)
|
||||
|
||||
if (strncpy(dest.get_ptr(), source.get_ptr(), len) != dest.get_ptr())
|
||||
{
|
||||
throw "_sys_strncpy() failed: unexpected strncpy() result";
|
||||
throw EXCEPTION("Unexpected strncpy() result");
|
||||
}
|
||||
|
||||
return dest;
|
||||
|
@ -13,12 +13,6 @@
|
||||
|
||||
SysCallBase sys_lwcond("sys_lwcond");
|
||||
|
||||
void lwcond_create(sys_lwcond_t& lwcond, sys_lwmutex_t& lwmutex, u64 name)
|
||||
{
|
||||
lwcond.lwmutex.set(vm::get_addr(&lwmutex));
|
||||
lwcond.lwcond_queue = Emu.GetIdManager().make<lv2_lwcond_t>(name);
|
||||
}
|
||||
|
||||
s32 _sys_lwcond_create(vm::ptr<u32> lwcond_id, u32 lwmutex_id, vm::ptr<sys_lwcond_t> control, u64 name, u32 arg5)
|
||||
{
|
||||
sys_lwcond.Warning("_sys_lwcond_create(lwcond_id=*0x%x, lwmutex_id=0x%x, control=*0x%x, name=0x%llx, arg5=0x%x)", lwcond_id, lwmutex_id, control, name, arg5);
|
||||
|
Loading…
Reference in New Issue
Block a user