diff --git a/rpcs3/Emu/Cell/SPUInterpreter.h b/rpcs3/Emu/Cell/SPUInterpreter.h index f6b7e9266f..01b7fb8866 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.h +++ b/rpcs3/Emu/Cell/SPUInterpreter.h @@ -7,12 +7,12 @@ #define UNIMPLEMENTED() UNK(__FUNCTION__) -typedef union _CRT_ALIGN(16) __u32x4 { - unsigned __int32 _u32[4]; +/* typedef union _CRT_ALIGN(16) __u32x4 { + u32 _u32[4]; __m128i m128i; __m128 m128; __m128d m128d; - } __u32x4; + } __u32x4; */ class SPUInterpreter : public SPUOpcodes { @@ -378,17 +378,16 @@ private: } void FREST(u32 rt, u32 ra) { - //(SSE) RCPPS - Compute Reciprocals of Packed Single-Precision Floating-Point Values - //rt = approximate(1/ra) - CPU.GPR[rt]._m128 = _mm_rcp_ps(CPU.GPR[ra]._m128); + //CPU.GPR[rt]._m128 = _mm_rcp_ps(CPU.GPR[ra]._m128); + for (int i = 0; i < 4; i++) + CPU.GPR[rt]._f[i] = 1 / CPU.GPR[ra]._f[i]; } void FRSQEST(u32 rt, u32 ra) { - //(SSE) RSQRTPS - Compute Reciprocals of Square Roots of Packed Single-Precision Floating-Point Values - //rt = approximate(1/sqrt(abs(ra))) - //abs(ra) === ra & FloatAbsMask - const __u32x4 FloatAbsMask = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; - CPU.GPR[rt]._m128 = _mm_rsqrt_ps(_mm_and_ps(CPU.GPR[ra]._m128, FloatAbsMask.m128)); + //const __u32x4 FloatAbsMask = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; + //CPU.GPR[rt]._m128 = _mm_rsqrt_ps(_mm_and_ps(CPU.GPR[ra]._m128, FloatAbsMask.m128)); + for (int i = 0; i < 4; i++) + CPU.GPR[rt]._f[i] = 1 / sqrt(abs(CPU.GPR[ra]._f[i])); } void LQX(u32 rt, u32 ra, u32 rb) { @@ -999,9 +998,10 @@ private: exp = 255; CPU.GPR[rt]._u32[i] = (CPU.GPR[ra]._u32[i] & 0x807fffff) | (exp << 23); + + CPU.GPR[rt]._u32[i] = (u32)CPU.GPR[rt]._f[i]; //trunc } - //(SSE2) CVTTPS2DQ - Convert with Truncation Packed Single FP to Packed Dword Int - CPU.GPR[rt]._m128i = _mm_cvttps_epi32(CPU.GPR[rt]._m128); + //CPU.GPR[rt]._m128i = _mm_cvttps_epi32(CPU.GPR[rt]._m128); } void CFLTU(u32 rt, u32 ra, s32 i8) { @@ -1028,11 +1028,12 @@ private: } void CSFLT(u32 rt, u32 ra, s32 i8) { - //(SSE2) CVTDQ2PS - Convert Packed Dword Integers to Packed Single-Precision FP Values - CPU.GPR[rt]._m128 = _mm_cvtepi32_ps(CPU.GPR[ra]._m128i); + //CPU.GPR[rt]._m128 = _mm_cvtepi32_ps(CPU.GPR[ra]._m128i); const u32 scale = 155 - (i8 & 0xff); //unsigned immediate for (int i = 0; i < 4; i++) { + CPU.GPR[rt]._f[i] = (s32)CPU.GPR[ra]._i32[i]; + u32 exp = ((CPU.GPR[rt]._u32[i] >> 23) & 0xff) - scale; if (exp > 255) //< 0 diff --git a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp index e7993cd422..92be21e5c3 100644 --- a/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp +++ b/rpcs3/Emu/SysCalls/lv2/SC_SPU_Thread.cpp @@ -37,7 +37,7 @@ u32 LoadSpuImage(vfsStream& stream) //156 int sys_spu_image_open(mem_ptr_t img, u32 path_addr) { - const std::string& path = Memory.ReadString(path_addr).mb_str(); + const wxString path = Memory.ReadString(path_addr).mb_str(); sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path); if(!img.IsGood() || !Memory.IsGoodAddr(path_addr)) @@ -122,7 +122,7 @@ int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t< ConLog.Write("New SPU Thread:"); ConLog.Write("ls_entry = 0x%x", ls_entry); - ConLog.Write("name = %s", name); + ConLog.Write("name = %s", wxString(name)); ConLog.Write("a1 = 0x%x", a1); ConLog.Write("a2 = 0x%x", a2); ConLog.Write("a3 = 0x%x", a3); @@ -196,7 +196,7 @@ int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_ttype.ToLE()); ConLog.Write("*** attr.option.ct=%d", attr->option.ct.ToLE()); - const std::string& name = Memory.ReadString(attr->name_addr, attr->name_len).mb_str(); + const wxString name = Memory.ReadString(attr->name_addr, attr->name_len).mb_str(); ConLog.Write("*** name='%s'", name); id = Emu.GetIdManager().GetNewID(wxString::Format("sys_spu_thread_group '%s'", name), new SpuGroupInfo(*attr));