Small changes

SC_FUNC changes (done by DH)
PPUInterpreter changes (copied from main, done by elisha464)
Log() using fixed
This commit is contained in:
Nekotekina 2014-01-31 16:46:49 +04:00
parent 6efe751d4c
commit 432c6cf206
6 changed files with 47 additions and 16 deletions

View File

@ -1209,11 +1209,15 @@ private:
}
void VPERM(u32 vd, u32 va, u32 vb, u32 vc)
{
u8 tmpSRC[32];
memcpy(tmpSRC, CPU.VPR[vb]._u8, 16);
memcpy(tmpSRC + 16, CPU.VPR[va]._u8, 16);
for (uint b = 0; b < 16; b++)
{
u8 index = CPU.VPR[vc]._u8[b] & 0x1f;
CPU.VPR[vd]._u8[b] = index < 0x10 ? CPU.VPR[va]._u8[0xf - index] : CPU.VPR[vb]._u8[0xf - (index - 0x10)];
CPU.VPR[vd]._u8[b] = tmpSRC[0x1f - index];
}
}
void VPKPX(u32 vd, u32 va, u32 vb)
@ -1552,13 +1556,13 @@ private:
}
void VSLDOI(u32 vd, u32 va, u32 vb, u32 sh)
{
for (uint b = 0; b < 16 - sh; b++)
u8 tmpSRC[32];
memcpy(tmpSRC, CPU.VPR[vb]._u8, 16);
memcpy(tmpSRC + 16, CPU.VPR[va]._u8, 16);
for(uint b=0; b<16; b++)
{
CPU.VPR[vd]._u8[15 - b] = CPU.VPR[va]._u8[15 - (b + sh)];
}
for (uint b = 16 - sh; b < 16; b++)
{
CPU.VPR[vd]._u8[15 - b] = CPU.VPR[vb]._u8[15 - (b - (16 - sh))];
CPU.VPR[vd]._u8[15 - b] = tmpSRC[31 - (b + sh)];
}
}
void VSLH(u32 vd, u32 va, u32 vb)

View File

@ -2,19 +2,40 @@
#define RESULT(x) SC_ARGS_1 = (x)
template<bool is_fp, bool is_ptr, typename T>
template<bool is_in_sp, bool is_fp, bool is_ptr, typename T, int i>
struct get_arg;
template<typename T>
struct get_arg<false, false, T> { static __forceinline T func(PPUThread& CPU, int i) { return (T&)CPU.GPR[i + 2]; } };
template<typename T, int i>
struct get_arg<false, false, false, T, i> // not fp, not ptr, 1..8
{
static __forceinline T func(PPUThread& CPU) { return (T&)CPU.GPR[i + 2]; }
};
template<bool is_fp, typename T>
struct get_arg<is_fp, true, T> { static __forceinline T func(PPUThread& CPU, int i) { return CPU.GPR[i + 2] ? (T)&Memory[CPU.GPR[i + 2]] : nullptr; } };
template<bool is_fp, typename T, int i>
struct get_arg<false, is_fp, true, T, i> // ptr, 1..8
{
static __forceinline T func(PPUThread& CPU) { return CPU.GPR[i + 2] ? (T)&Memory[CPU.GPR[i + 2]] : nullptr; }
};
template<typename T>
struct get_arg<true, false, T> { static __forceinline T func(PPUThread& CPU, int i) { return CPU.FPR[i]; } };
template<bool is_in_sp, typename T, int i>
struct get_arg<is_in_sp, true, false, T, i> // fp, 1..12
{
static __forceinline T func(PPUThread& CPU) { return CPU.FPR[i]; }
};
#define ARG(n) get_arg<std::is_floating_point<T##n>::value, std::is_pointer<T##n>::value, T##n>::func(CPU, n)
template<typename T, int i>
struct get_arg<true, false, false, T, i> // not fp, not ptr, 9..12
{
static __forceinline T func(PPUThread& CPU) { u64 res = Memory.Read64(CPU.GPR[1] + 0x70 + 0x8 * (i - 9)); return (T&)res; }
};
template<bool is_fp, typename T, int i>
struct get_arg<true, is_fp, true, T, i> // ptr, 9..12
{
static __forceinline T func(PPUThread& CPU) { u64 addr = Memory.Read64(CPU.GPR[1] + 0x70 + 0x8 * (i - 9)); return addr ? (T)&Memory[addr] : nullptr; }
};
#define ARG(n) get_arg<((n) > 8), std::is_floating_point<T##n>::value, std::is_pointer<T##n>::value, T##n, n>::func(CPU)
template<typename TR>
class binder_func_0 : public func_caller

View File

@ -376,10 +376,12 @@ extern int sys_rsx_attribute();
#define SC_ARG_5 CPU.GPR[8]
#define SC_ARG_6 CPU.GPR[9]
#define SC_ARG_7 CPU.GPR[10]
/* // these definitions are wrong:
#define SC_ARG_8 CPU.GPR[11]
#define SC_ARG_9 CPU.GPR[12]
#define SC_ARG_10 CPU.GPR[13]
#define SC_ARG_11 CPU.GPR[14]
*/
#define SC_ARGS_1 SC_ARG_0
#define SC_ARGS_2 SC_ARGS_1,SC_ARG_1
@ -389,10 +391,12 @@ extern int sys_rsx_attribute();
#define SC_ARGS_6 SC_ARGS_5,SC_ARG_5
#define SC_ARGS_7 SC_ARGS_6,SC_ARG_6
#define SC_ARGS_8 SC_ARGS_7,SC_ARG_7
/*
#define SC_ARGS_9 SC_ARGS_8,SC_ARG_8
#define SC_ARGS_10 SC_ARGS_9,SC_ARG_9
#define SC_ARGS_11 SC_ARGS_10,SC_ARG_10
#define SC_ARGS_12 SC_ARGS_11,SC_ARG_11
*/
extern bool dump_enable;

View File

@ -162,6 +162,7 @@ int sys_mmapper_map_memory(u32 start_addr, u32 mem_id, u64 flags)
int sys_memory_get_user_memory_size(u32 mem_info_addr)
{
sc_mem.Warning("sys_memory_get_user_memory_size(mem_info_addr=0x%x)", mem_info_addr);
sys_memory_info info;
info.total_user_memory = re(Memory.GetUserMemTotalSize());
info.available_user_memory = re(Memory.GetUserMemAvailSize());

View File

@ -74,7 +74,7 @@ int cellPadClearBuf(u32 port_no)
int cellPadGetData(u32 port_no, u32 data_addr)
{
//ConLog.Warning("cellPadGetData[port_no: %d, data_addr: 0x%x]", port_no, data_addr);
sys_io.Log("cellPadGetData[port_no: %d, data_addr: 0x%x]", port_no, data_addr);
const Array<Pad>& pads = Emu.GetPadManager().GetPads();
if(!Emu.GetPadManager().IsInited()) return CELL_PAD_ERROR_UNINITIALIZED;
if(port_no >= pads.GetCount()) return CELL_PAD_ERROR_INVALID_PARAMETER;

View File

@ -458,6 +458,7 @@ int sys_spu_thread_get_spu_cfg(u32 id, mem64_t value)
//184
int sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
{
sc_spu.Log("sys_spu_thread_write_snr(id=0x%x, number=%d, value=0x%x)", id, number, value);
CPUThread* thr = Emu.GetCPU().GetThread(id);
if(!thr || (thr->GetType() != CPU_THREAD_SPU && thr->GetType() != CPU_THREAD_RAW_SPU))