ppu_syscall_code type added (for fmt)

This commit is contained in:
Nekotekina 2017-06-26 01:44:05 +03:00
parent f49a30bc1a
commit 8034196c25
4 changed files with 15 additions and 7 deletions

View file

@ -763,7 +763,6 @@ const ppu_decoder<ppu_itype> s_ppu_itype;
extern u64 get_timebased_time(); extern u64 get_timebased_time();
extern ppu_function_t ppu_get_syscall(u64 code); extern ppu_function_t ppu_get_syscall(u64 code);
extern std::string ppu_get_syscall_name(u64 code);
extern __m128 sse_exp2_ps(__m128 A); extern __m128 sse_exp2_ps(__m128 A);
extern __m128 sse_log2_ps(__m128 A); extern __m128 sse_log2_ps(__m128 A);
@ -957,7 +956,7 @@ extern void ppu_initialize(const ppu_module& info)
{ {
if (auto sc = ppu_get_syscall(index)) if (auto sc = ppu_get_syscall(index))
{ {
link_table.emplace(ppu_get_syscall_name(index), (u64)sc); link_table.emplace(fmt::format("%s", ppu_syscall_code(index)), (u64)sc);
} }
} }

View file

@ -18,6 +18,11 @@ enum class ppu_cmd : u32
sleep, sleep,
}; };
// Formatting helper
enum class ppu_syscall_code : u64
{
};
class ppu_thread : public cpu_thread class ppu_thread : public cpu_thread
{ {
public: public:

View file

@ -7,8 +7,6 @@
#include "../Utilities/Log.h" #include "../Utilities/Log.h"
#include <algorithm> #include <algorithm>
extern std::string ppu_get_syscall_name(u64 code);
using namespace llvm; using namespace llvm;
const ppu_decoder<PPUTranslator> s_ppu_decoder; const ppu_decoder<PPUTranslator> s_ppu_decoder;
@ -1647,7 +1645,7 @@ void PPUTranslator::SC(ppu_opcode_t op)
if (index < 1024) if (index < 1024)
{ {
// Call the syscall directly // Call the syscall directly
Call(GetType<void>(), ppu_get_syscall_name(index), m_thread); Call(GetType<void>(), fmt::format("%s", ppu_syscall_code(index)), m_thread);
m_ir->CreateRetVoid(); m_ir->CreateRetVoid();
return; return;
} }

View file

@ -33,9 +33,15 @@
extern std::string ppu_get_syscall_name(u64 code); extern std::string ppu_get_syscall_name(u64 code);
template <>
void fmt_class_string<ppu_syscall_code>::format(std::string& out, u64 arg)
{
out += ppu_get_syscall_name(arg);
}
static bool null_func(ppu_thread& ppu) static bool null_func(ppu_thread& ppu)
{ {
LOG_TODO(HLE, "Unimplemented syscall %s -> CELL_OK", ppu_get_syscall_name(ppu.gpr[11])); LOG_TODO(HLE, "Unimplemented syscall %s -> CELL_OK", ppu_syscall_code(ppu.gpr[11]));
ppu.gpr[3] = 0; ppu.gpr[3] = 0;
ppu.cia += 4; ppu.cia += 4;
return false; return false;
@ -979,7 +985,7 @@ extern void ppu_execute_syscall(ppu_thread& ppu, u64 code)
if (auto func = g_ppu_syscall_table[code]) if (auto func = g_ppu_syscall_table[code])
{ {
func(ppu); func(ppu);
LOG_TRACE(PPU, "Syscall '%s' (%llu) finished, r3=0x%llx", ppu_get_syscall_name(code), code, ppu.gpr[3]); LOG_TRACE(PPU, "Syscall '%s' (%llu) finished, r3=0x%llx", ppu_syscall_code(code), code, ppu.gpr[3]);
return; return;
} }
} }