From 48bc1afe264b0e7ae9038dd8977f705ab2887c24 Mon Sep 17 00:00:00 2001 From: Henrik Rydgard Date: Tue, 6 Nov 2012 16:01:41 +0100 Subject: [PATCH] Add vcmp ES condition code, uncached mirror of scratchpad --- Core/HLE/sceKernelTime.cpp | 12 ++++++++---- Core/MIPS/MIPSIntVFPU.cpp | 1 + Core/MemMap.cpp | 2 ++ Core/MemMapFunctions.cpp | 10 +++++----- Core/PSPLoaders.cpp | 2 +- 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Core/HLE/sceKernelTime.cpp b/Core/HLE/sceKernelTime.cpp index 62da410b64..23c8f93ef1 100644 --- a/Core/HLE/sceKernelTime.cpp +++ b/Core/HLE/sceKernelTime.cpp @@ -81,8 +81,10 @@ void sceKernelSysClock2USec() Memory::ReadStruct(PARAM(0), &clock); DEBUG_LOG(HLE, "sceKernelSysClock2USec(clock = , lo = %08x, hi = %08x)", PARAM(1), PARAM(2)); u64 time = clock.lo | ((u64)clock.hi << 32); - Memory::Write_U32((u32)(time / 1000000), PARAM(1)); - Memory::Write_U32((u32)(time % 1000000), PARAM(2)); + if (Memory::IsValidAddress(PARAM(1))) + Memory::Write_U32((u32)(time / 1000000), PARAM(1)); + if (Memory::IsValidAddress(PARAM(2))) + Memory::Write_U32((u32)(time % 1000000), PARAM(2)); RETURN(0); } @@ -90,8 +92,10 @@ void sceKernelSysClock2USecWide() { u64 clock = PARAM(0) | ((u64)PARAM(1) << 32); DEBUG_LOG(HLE, "sceKernelSysClock2USecWide(clock = %llu, lo = %08x, hi = %08x)", clock, PARAM(2), PARAM(3)); - Memory::Write_U32((u32)(clock / 1000000), PARAM(2)); - Memory::Write_U32((u32)(clock % 1000000), PARAM(3)); + if (Memory::IsValidAddress(PARAM(2))) + Memory::Write_U32((u32)(clock / 1000000), PARAM(2)); + if (Memory::IsValidAddress(PARAM(3))) + Memory::Write_U32((u32)(clock % 1000000), PARAM(3)); RETURN(0); } diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index 93852daa9b..bdf0016d1d 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -1052,6 +1052,7 @@ namespace MIPSInt case VC_GT: c = s[i] > t[i]; break; case VC_GE: c = s[i] >= t[i]; break; case VC_NZ: c = s[i] != 0; break; + case VC_ES: c = (s[i] != s[i]) || (s[i] == std::numeric_limits::infinity()); break; // Tekken Dark Resurrection default: _dbg_assert_msg_(CPU,0,"Unsupported vcmp condition code"); //, cond); return; diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index b6738aa05e..38a5027173 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -45,6 +45,7 @@ u8 *m_pScratchPad; u8 *m_pVRAM; u8 *m_pPhysicalScratchPad; +u8 *m_pUncachedScratchPad; // 64-bit: Pointers to high-mem mirrors // 32-bit: Same as above u8 *m_pPhysicalRAM; @@ -59,6 +60,7 @@ u8 *m_pUncachedVRAM; static const MemoryView views[] = { {&m_pScratchPad, &m_pPhysicalScratchPad, 0x00010000, SCRATCHPAD_SIZE, 0}, + {NULL, &m_pUncachedScratchPad, 0x40010000, SCRATCHPAD_SIZE, MV_MIRROR_PREVIOUS}, {&m_pVRAM, &m_pPhysicalVRAM, 0x04000000, 0x00800000, 0}, {NULL, &m_pUncachedVRAM, 0x44000000, 0x00800000, MV_MIRROR_PREVIOUS}, {&m_pRAM, &m_pPhysicalRAM, 0x08000000, RAM_SIZE, 0}, // only from 0x08800000 is it usable (last 24 megs) diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index 35e511988a..78f8262f0e 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -48,9 +48,9 @@ u8 *GetPointer(const u32 address) { return m_pVRAM + (address & VRAM_MASK); } - else if ((address & 0xFFFF0000) == 0x00010000) + else if ((address & 0xBFFF0000) == 0x00010000) { - return m_pScratchPad + (address & VRAM_MASK); + return m_pScratchPad + (address & SCRATCHPAD_MASK); } else { @@ -75,7 +75,7 @@ inline void ReadFromHardware(T &var, const u32 address) { var = *((const T*)&m_pVRAM[address & VRAM_MASK]); } - else if ((address & 0xFFFF0000) == 0x00010000) + else if ((address & 0xBFFF0000) == 0x00010000) { // Scratchpad var = *((const T*)&m_pScratchPad[address & SCRATCHPAD_MASK]); @@ -104,7 +104,7 @@ inline void WriteToHardware(u32 address, const T data) { *(T*)&m_pVRAM[address & VRAM_MASK] = data; } - else if ((address & 0xFFFF0000) == 0x00010000) + else if ((address & 0xBFFF0000) == 0x00010000) { *(T*)&m_pScratchPad[address & SCRATCHPAD_MASK] = data; } @@ -130,7 +130,7 @@ bool IsValidAddress(const u32 address) { return true; } - else if ((address & 0xFFFF0000) == 0x00010000) + else if ((address & 0xBFFF0000) == 0x00010000) { return true; } diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 051a410c1f..911549236a 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -71,7 +71,7 @@ bool Load_PSP_ISO(const char *filename, std::string *error_string) { u8 head[4]; pspFileSystem.ReadFile(fd, head, 4); - if (memcmp(head, "~PSP", 4) == 0) + if (memcmp(head, "~PSP", 4) == 0) // || memcmp(head + 1, "ELF", 3) == 0) { hasEncrypted = true; }