From f8d309ec996b332f3dc630a87a4dbbbe22abb958 Mon Sep 17 00:00:00 2001 From: The Dax Date: Fri, 21 Jun 2013 01:19:47 -0400 Subject: [PATCH 01/16] Add HD Remaster support. It's a HUGE hack right now, and needs to be properly rewritten so that allocation and stuff work better. This is based off the work of BlackDaemon, and I added in the auto check to switch the code on/off depending on if the game is a remaster or not. It does not affect or break any games that I know of. --- Core/Core.vcxproj | 2 ++ Core/Core.vcxproj.filters | 6 +++++ Core/HDRemaster.cpp | 20 ++++++++++++++ Core/HDRemaster.h | 41 +++++++++++++++++++++++++++++ Core/MemMap.cpp | 2 ++ Core/MemMap.h | 6 +++-- Core/MemMapFunctions.cpp | 18 +++++++++++++ Core/PSPLoaders.cpp | 11 +++++++- GPU/GLES/DisplayListInterpreter.cpp | 9 ++++++- 9 files changed, 111 insertions(+), 4 deletions(-) create mode 100644 Core/HDRemaster.cpp create mode 100644 Core/HDRemaster.h diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 4997efdf63..e2fb23c1b0 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -188,6 +188,7 @@ + @@ -368,6 +369,7 @@ + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 4cf70aa22e..bf8e25e7ca 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -436,6 +436,9 @@ HLE\Libraries + + Core + @@ -807,6 +810,9 @@ HLE\Libraries + + Core + diff --git a/Core/HDRemaster.cpp b/Core/HDRemaster.cpp new file mode 100644 index 0000000000..5bf731b87f --- /dev/null +++ b/Core/HDRemaster.cpp @@ -0,0 +1,20 @@ +// Copyright (c) 2012- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#include "HDRemaster.h" + +bool g_RemasterMode = false; \ No newline at end of file diff --git a/Core/HDRemaster.h b/Core/HDRemaster.h new file mode 100644 index 0000000000..0e89c33ce1 --- /dev/null +++ b/Core/HDRemaster.h @@ -0,0 +1,41 @@ +// Copyright (c) 2012- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +#include + +const int REMASTER_COUNT = 9; + +// This bool is the key to having the HD remasters work. +// We keep it set to false by default in PSPLoaders.cpp +// in order to keep the 99% of other PSP games working happily. +extern bool g_RemasterMode; + +// TODO: Are those BLJM* IDs really valid? I haven't seen any +// HD Remasters with them, but they're included for safety. +const std::string g_RemastersGameIDs[REMASTER_COUNT] = { + "NPJB40001", // MONSTER HUNTER PORTABLE 3rd HD Ver. + "BLJM85002", // K-ON Houkago Live HD Ver + "NPJB40002", // K-ON Houkago Live HD Ver + "BLJM85003", // Shin Sangoku Musou Multi Raid 2 HD Ver + "NPJB40003", // Shin Sangoku Musou Multi Raid 2 HD Ver + "BLJM85004", // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition + "NPJB40004", // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition + "BLJM85005", // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition + "NPJB40005", // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition +}; diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 0879b20bcf..ba79340e02 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -90,6 +90,8 @@ void DoState(PointerWrap &p) p.DoMarker("VRAM"); p.DoArray(m_pScratchPad, SCRATCHPAD_SIZE); p.DoMarker("ScratchPad"); + p.Do(g_RemasterMode); + p.DoMarker("RemasterMode"); } void Shutdown() diff --git a/Core/MemMap.h b/Core/MemMap.h index 016c95e51b..ffa8042ce9 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -23,6 +23,8 @@ #include "Common.h" #include "CommonTypes.h" +#include "HDRemaster.h" + // Enable memory checks in the Debug/DebugFast builds, but NOT in release #if defined(_DEBUG) || defined(DEBUGFAST) #define ENABLE_MEM_CHECK @@ -64,7 +66,7 @@ inline u32 PSP_GetKernelMemoryEnd() { return 0x08400000;} // game through sceKernelVolatileMemTryLock. inline u32 PSP_GetUserMemoryBase() { return 0x08800000;} -inline u32 PSP_GetUserMemoryEnd() { return 0x0A000000;} +inline u32 PSP_GetUserMemoryEnd() { return g_RemasterMode? 0x0B8FFFFF : 0x0A000000;} inline u32 PSP_GetDefaultLoadAddress() { return 0x08804000;} //inline u32 PSP_GetDefaultLoadAddress() { return 0x0898dab0;} @@ -100,7 +102,7 @@ extern u8 *m_pUncachedVRAM; // TODO: Later PSP models got more RAM. enum { - RAM_SIZE = 0x2000000, // 32 MB - although only the upper 24 are available for the user. + RAM_SIZE = 0x4000000, // 32 MB - although only the upper 24 are available for the user. RAM_MASK = RAM_SIZE - 1, VRAM_SIZE = 0x200000, diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index 7858ce3bae..5ae51a106c 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -24,6 +24,8 @@ #include "MIPS/MIPS.h" +#include "Core/HDRemaster.h" + // TODO: Fix this #undef ENABLE_MEM_CHECK @@ -45,6 +47,10 @@ u8 *GetPointer(const u32 address) { return m_pRAM + (address & RAM_MASK); } + else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) + { + return m_pRAM + (address & RAM_MASK); + } else if ((address & 0x3F800000) == 0x04000000) { return m_pVRAM + (address & VRAM_MASK); @@ -76,6 +82,10 @@ inline void ReadFromHardware(T &var, const u32 address) { var = *((const T*)&m_pRAM[address & RAM_MASK]); } + else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) + { + var = *((const T*)&m_pRAM[address & RAM_MASK]); + } else if ((address & 0x3F800000) == 0x04000000) { var = *((const T*)&m_pVRAM[address & VRAM_MASK]); @@ -109,6 +119,10 @@ inline void WriteToHardware(u32 address, const T data) { *(T*)&m_pRAM[address & RAM_MASK] = data; } + else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) + { + *(T*)&m_pRAM[address & RAM_MASK] = data; + } else if ((address & 0x3F800000) == 0x04000000) { *(T*)&m_pVRAM[address & VRAM_MASK] = data; @@ -139,6 +153,10 @@ bool IsValidAddress(const u32 address) { return true; } + else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) + { + return true; + } else if ((address & 0x3F800000) == 0x04000000) { return true; diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 1f8a7703f4..79466850b5 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -63,9 +63,18 @@ bool Load_PSP_ISO(const char *filename, std::string *error_string) if (g_paramSFO.ReadSFO(paramsfo, (size_t)fileInfo.size)) { char title[1024]; - sprintf(title, "%s : %s", g_paramSFO.GetValueString("DISC_ID").c_str(), g_paramSFO.GetValueString("TITLE").c_str()); + std::string gameID = g_paramSFO.GetValueString("DISC_ID"); + sprintf(title, "%s : %s", gameID.c_str(), g_paramSFO.GetValueString("TITLE").c_str()); INFO_LOG(LOADER, "%s", title); host->SetWindowTitle(title); + g_RemasterMode = false; + for(int i = 0; i < REMASTER_COUNT; i++) { + if(g_RemastersGameIDs[i] == gameID) { + g_RemasterMode = true; + break; + } + } + DEBUG_LOG(LOADER, "HDRemaster mode is %s", g_RemasterMode? "true": "false"); } delete [] paramsfo; } diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index 77c118f7de..54a4e256e8 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -36,6 +36,8 @@ #include "../../Core/HLE/sceKernelInterrupt.h" #include "../../Core/HLE/sceGe.h" +#include "../../Core/HDRemaster.h" + extern u32 curTextureWidth; extern u32 curTextureHeight; @@ -315,9 +317,14 @@ u32 GLES_GPU::DrawSync(int mode) return GPUCommon::DrawSync(mode); } +// TODO: Fix this so it doesn't crash void GLES_GPU::FastRunLoop(DisplayList &list) { for (; downcount > 0; --downcount) { - u32 op = Memory::ReadUnchecked_U32(list.pc); + u32 op; + if(g_RemasterMode) + op = Memory::Read_U32(list.pc); + else + op = Memory::ReadUnchecked_U32(list.pc); u32 cmd = op >> 24; u32 diff = op ^ gstate.cmdmem[cmd]; From 2da4c01ea9b79dde8911b9f602ac5ca8a2a325a7 Mon Sep 17 00:00:00 2001 From: The Dax Date: Fri, 21 Jun 2013 02:10:36 -0400 Subject: [PATCH 02/16] Fix styling issues. --- Core/MemMap.h | 4 +++- Core/MemMapFunctions.cpp | 51 ++++++++++++++-------------------------- 2 files changed, 20 insertions(+), 35 deletions(-) diff --git a/Core/MemMap.h b/Core/MemMap.h index ffa8042ce9..6e857cdd86 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -100,9 +100,11 @@ extern u8 *m_pPhysicalVRAM; extern u8 *m_pUncachedVRAM; // TODO: Later PSP models got more RAM. +// Done, but we still need an emulator-wide rewrite for more RAM support/larger allocations +// to remove the remaster hack.. enum { - RAM_SIZE = 0x4000000, // 32 MB - although only the upper 24 are available for the user. + RAM_SIZE = 0x4000000, // 64 MB - although only the upper 24 are available for the user. RAM_MASK = RAM_SIZE - 1, VRAM_SIZE = 0x200000, diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index 5ae51a106c..e8d7575464 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -43,24 +43,19 @@ namespace Memory u8 *GetPointer(const u32 address) { - if ((address & 0x3E000000) == 0x08000000) - { + if ((address & 0x3E000000) == 0x08000000) { return m_pRAM + (address & RAM_MASK); } - else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) - { + else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) { return m_pRAM + (address & RAM_MASK); } - else if ((address & 0x3F800000) == 0x04000000) - { + else if ((address & 0x3F800000) == 0x04000000) { return m_pVRAM + (address & VRAM_MASK); } - else if ((address & 0xBFFF0000) == 0x00010000) - { + else if ((address & 0xBFFF0000) == 0x00010000) { return m_pScratchPad + (address & SCRATCHPAD_MASK); } - else - { + else { ERROR_LOG(MEMMAP, "Unknown GetPointer %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); if (!g_Config.bIgnoreBadMemAccess) { Core_EnableStepping(true); @@ -78,20 +73,16 @@ inline void ReadFromHardware(T &var, const u32 address) // Could just do a base-relative read, too.... TODO - if ((address & 0x3E000000) == 0x08000000) - { + if ((address & 0x3E000000) == 0x08000000) { var = *((const T*)&m_pRAM[address & RAM_MASK]); } - else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) - { + else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) { var = *((const T*)&m_pRAM[address & RAM_MASK]); } - else if ((address & 0x3F800000) == 0x04000000) - { + else if ((address & 0x3F800000) == 0x04000000) { var = *((const T*)&m_pVRAM[address & VRAM_MASK]); } - else if ((address & 0xBFFF0000) == 0x00010000) - { + else if ((address & 0xBFFF0000) == 0x00010000) { // Scratchpad var = *((const T*)&m_pScratchPad[address & SCRATCHPAD_MASK]); } @@ -115,20 +106,16 @@ inline void WriteToHardware(u32 address, const T data) { // Could just do a base-relative write, too.... TODO - if ((address & 0x3E000000) == 0x08000000) - { + if ((address & 0x3E000000) == 0x08000000) { *(T*)&m_pRAM[address & RAM_MASK] = data; } - else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) - { + else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) { *(T*)&m_pRAM[address & RAM_MASK] = data; } - else if ((address & 0x3F800000) == 0x04000000) - { + else if ((address & 0x3F800000) == 0x04000000) { *(T*)&m_pVRAM[address & VRAM_MASK] = data; } - else if ((address & 0xBFFF0000) == 0x00010000) - { + else if ((address & 0xBFFF0000) == 0x00010000) { *(T*)&m_pScratchPad[address & SCRATCHPAD_MASK] = data; } else @@ -149,20 +136,16 @@ inline void WriteToHardware(u32 address, const T data) bool IsValidAddress(const u32 address) { - if ((address & 0x3E000000) == 0x08000000) - { + if ((address & 0x3E000000) == 0x08000000) { return true; } - else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) - { + else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) { return true; } - else if ((address & 0x3F800000) == 0x04000000) - { + else if ((address & 0x3F800000) == 0x04000000) { return true; } - else if ((address & 0xBFFF0000) == 0x00010000) - { + else if ((address & 0xBFFF0000) == 0x00010000) { return true; } else From 96401eae1e9705dbfe299e4fcd2a13d294e8e746 Mon Sep 17 00:00:00 2001 From: The Dax Date: Fri, 21 Jun 2013 13:34:57 -0400 Subject: [PATCH 03/16] Make the hack less intrusive, but there's a chicken and egg problem: Memory::Init is called before LOAD_PSP_ISO, so I'm slightly perplexed on how to proceed at the moment. --- Core/HDRemaster.cpp | 2 +- Core/HDRemaster.h | 35 +++++++++++++++++------------ Core/MemMap.cpp | 22 +++++++++++++----- Core/MemMap.h | 14 ++++++------ Core/MemMapFunctions.cpp | 12 +++++----- Core/PSPLoaders.cpp | 8 ++++++- GPU/GLES/DisplayListInterpreter.cpp | 6 +---- GPU/GPUCommon.cpp | 2 +- 8 files changed, 60 insertions(+), 41 deletions(-) diff --git a/Core/HDRemaster.cpp b/Core/HDRemaster.cpp index 5bf731b87f..8b62719e00 100644 --- a/Core/HDRemaster.cpp +++ b/Core/HDRemaster.cpp @@ -17,4 +17,4 @@ #include "HDRemaster.h" -bool g_RemasterMode = false; \ No newline at end of file +bool g_RemasterMode = false; diff --git a/Core/HDRemaster.h b/Core/HDRemaster.h index 0e89c33ce1..4fced19876 100644 --- a/Core/HDRemaster.h +++ b/Core/HDRemaster.h @@ -18,24 +18,31 @@ #pragma once #include - -const int REMASTER_COUNT = 9; +#include "CommonTypes.h" // This bool is the key to having the HD remasters work. // We keep it set to false by default in PSPLoaders.cpp // in order to keep the 99% of other PSP games working happily. extern bool g_RemasterMode; -// TODO: Are those BLJM* IDs really valid? I haven't seen any -// HD Remasters with them, but they're included for safety. -const std::string g_RemastersGameIDs[REMASTER_COUNT] = { - "NPJB40001", // MONSTER HUNTER PORTABLE 3rd HD Ver. - "BLJM85002", // K-ON Houkago Live HD Ver - "NPJB40002", // K-ON Houkago Live HD Ver - "BLJM85003", // Shin Sangoku Musou Multi Raid 2 HD Ver - "NPJB40003", // Shin Sangoku Musou Multi Raid 2 HD Ver - "BLJM85004", // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition - "NPJB40004", // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition - "BLJM85005", // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition - "NPJB40005", // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition +struct HDRemaster { + std::string gameID; + u64 MemorySize; + u64 MemoryEnd; //Seems to be different for each game as well +}; + +// TODO: Are those BLJM* IDs really valid? They seem to be the physical PS3 disk IDs, +// but they're included for safety. +const u32 REMASTER_COUNT = 9; + +const struct HDRemaster g_HDRemasters[REMASTER_COUNT] = { + { "NPJB40001", 0x2800000, 0x0B8FFFFF }, // MONSTER HUNTER PORTABLE 3rd HD Ver. + { "BLJM85002", 0x2800000, 0x0B8FFFFF }, // K-ON Houkago Live HD Ver + { "NPJB40002", 0x2800000, 0x0B8FFFFF }, // K-ON Houkago Live HD Ver + { "BLJM85003", 0x2800000, 0x0B8FFFFF }, // Shin Sangoku Musou Multi Raid 2 HD Ver + { "NPJB40003", 0x2800000, 0x0B8FFFFF }, // Shin Sangoku Musou Multi Raid 2 HD Ver + { "BLJM85004", 0x3000000, 0x0B8FFFFF }, // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition + { "NPJB40004", 0x3000000, 0x0B8FFFFF }, // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition + { "BLJM85005", 0x4000000, 0x0B8FFFFF }, // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition + { "NPJB40005", 0x4000000, 0x0B8FFFFF }, // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition }; diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index ba79340e02..ce20352bd1 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -55,17 +55,22 @@ u8 *m_pKernelRAM; // RAM mirrored up to "kernel space". Fully accessible at all u8 *m_pPhysicalVRAM; u8 *m_pUncachedVRAM; +// Holds the ending address of the PSP's user space. +// Required for HD Remasters to work properly. +u32 g_MemoryEnd; +u32 g_MemoryMask; +u32 g_MemorySize; // We don't declare the IO region in here since its handled by other means. -static const MemoryView views[] = +static 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) - {NULL, &m_pUncachedRAM, 0x48000000, RAM_SIZE, MV_MIRROR_PREVIOUS}, - {NULL, &m_pKernelRAM, 0x88000000, RAM_SIZE, MV_MIRROR_PREVIOUS}, + {&m_pRAM, &m_pPhysicalRAM, 0x08000000, g_MemorySize, 0}, // only from 0x08800000 is it usable (last 24 megs) + {NULL, &m_pUncachedRAM, 0x48000000, g_MemorySize, MV_MIRROR_PREVIOUS}, + {NULL, &m_pKernelRAM, 0x88000000, g_MemorySize, MV_MIRROR_PREVIOUS}, // TODO: There are a few swizzled mirrors of VRAM, not sure about the best way to // implement those. @@ -76,6 +81,11 @@ static const int num_views = sizeof(views) / sizeof(MemoryView); void Init() { int flags = 0; + + g_MemoryMask = g_MemorySize - 1; + for(int i = 4; i < 7; i++) + views[i].size = g_MemorySize; + base = MemoryMap_Setup(views, num_views, flags, &g_arena); INFO_LOG(MEMMAP, "Memory system initialized. RAM at %p (mirror at 0 @ %p, uncached @ %p)", @@ -84,7 +94,7 @@ void Init() void DoState(PointerWrap &p) { - p.DoArray(m_pRAM, RAM_SIZE); + p.DoArray(m_pRAM, g_MemorySize); p.DoMarker("RAM"); p.DoArray(m_pVRAM, VRAM_SIZE); p.DoMarker("VRAM"); @@ -106,7 +116,7 @@ void Shutdown() void Clear() { if (m_pRAM) - memset(m_pRAM, 0, RAM_SIZE); + memset(m_pRAM, 0, g_MemorySize); if (m_pScratchPad) memset(m_pScratchPad, 0, SCRATCHPAD_SIZE); if (m_pVRAM) diff --git a/Core/MemMap.h b/Core/MemMap.h index 6e857cdd86..9cf4f26ab7 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -66,7 +66,7 @@ inline u32 PSP_GetKernelMemoryEnd() { return 0x08400000;} // game through sceKernelVolatileMemTryLock. inline u32 PSP_GetUserMemoryBase() { return 0x08800000;} -inline u32 PSP_GetUserMemoryEnd() { return g_RemasterMode? 0x0B8FFFFF : 0x0A000000;} +inline u32 PSP_GetKernelMemoryEnd(); inline u32 PSP_GetDefaultLoadAddress() { return 0x08804000;} //inline u32 PSP_GetDefaultLoadAddress() { return 0x0898dab0;} @@ -99,14 +99,12 @@ extern u8 *m_pUncachedRAM; extern u8 *m_pPhysicalVRAM; extern u8 *m_pUncachedVRAM; -// TODO: Later PSP models got more RAM. -// Done, but we still need an emulator-wide rewrite for more RAM support/larger allocations -// to remove the remaster hack.. +extern u32 g_MemoryEnd; // End of PSP Userspace +extern u32 g_MemorySize; // Replaces RAM_SIZE +extern u32 g_MemoryMask; // Replaces RAM_MASK + enum { - RAM_SIZE = 0x4000000, // 64 MB - although only the upper 24 are available for the user. - RAM_MASK = RAM_SIZE - 1, - VRAM_SIZE = 0x200000, VRAM_MASK = VRAM_SIZE - 1, @@ -359,6 +357,8 @@ struct PSPPointer } }; +inline u32 PSP_GetUserMemoryEnd() { return Memory::g_MemoryEnd;} + template inline bool operator==(const PSPPointer &lhs, const PSPPointer &rhs) { diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index e8d7575464..e29c0e9760 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -44,10 +44,10 @@ namespace Memory u8 *GetPointer(const u32 address) { if ((address & 0x3E000000) == 0x08000000) { - return m_pRAM + (address & RAM_MASK); + return m_pRAM + (address & g_MemoryMask); } else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) { - return m_pRAM + (address & RAM_MASK); + return m_pRAM + (address & g_MemoryMask); } else if ((address & 0x3F800000) == 0x04000000) { return m_pVRAM + (address & VRAM_MASK); @@ -74,10 +74,10 @@ inline void ReadFromHardware(T &var, const u32 address) // Could just do a base-relative read, too.... TODO if ((address & 0x3E000000) == 0x08000000) { - var = *((const T*)&m_pRAM[address & RAM_MASK]); + var = *((const T*)&m_pRAM[address & g_MemoryMask]); } else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) { - var = *((const T*)&m_pRAM[address & RAM_MASK]); + var = *((const T*)&m_pRAM[address & g_MemoryMask]); } else if ((address & 0x3F800000) == 0x04000000) { var = *((const T*)&m_pVRAM[address & VRAM_MASK]); @@ -107,10 +107,10 @@ inline void WriteToHardware(u32 address, const T data) // Could just do a base-relative write, too.... TODO if ((address & 0x3E000000) == 0x08000000) { - *(T*)&m_pRAM[address & RAM_MASK] = data; + *(T*)&m_pRAM[address & g_MemoryMask] = data; } else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) { - *(T*)&m_pRAM[address & RAM_MASK] = data; + *(T*)&m_pRAM[address & g_MemoryMask] = data; } else if ((address & 0x3F800000) == 0x04000000) { *(T*)&m_pVRAM[address & VRAM_MASK] = data; diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 79466850b5..0e670e84c5 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -40,6 +40,8 @@ #include "HLE/sceKernelMemory.h" #include "ELF/ParamSFO.h" +#include "Core/MemMap.h" + bool Load_PSP_ISO(const char *filename, std::string *error_string) { ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, constructBlockDevice(filename)); @@ -68,9 +70,13 @@ bool Load_PSP_ISO(const char *filename, std::string *error_string) INFO_LOG(LOADER, "%s", title); host->SetWindowTitle(title); g_RemasterMode = false; + Memory::g_MemoryEnd = 0x0A000000; + Memory::g_MemorySize = 0x2000000; for(int i = 0; i < REMASTER_COUNT; i++) { - if(g_RemastersGameIDs[i] == gameID) { + if(g_HDRemasters[i].gameID == gameID) { g_RemasterMode = true; + Memory::g_MemoryEnd = g_HDRemasters[i].MemoryEnd; + Memory::g_MemorySize = g_HDRemasters[i].MemorySize; break; } } diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index 54a4e256e8..7e8fc508c2 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -320,11 +320,7 @@ u32 GLES_GPU::DrawSync(int mode) // TODO: Fix this so it doesn't crash void GLES_GPU::FastRunLoop(DisplayList &list) { for (; downcount > 0; --downcount) { - u32 op; - if(g_RemasterMode) - op = Memory::Read_U32(list.pc); - else - op = Memory::ReadUnchecked_U32(list.pc); + u32 op = Memory::ReadUnchecked_U32(list.pc); u32 cmd = op >> 24; u32 diff = op ^ gstate.cmdmem[cmd]; diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index a53cb18eb8..ed5cd7f1eb 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -399,7 +399,7 @@ bool GPUCommon::InterpretList(DisplayList &list) const bool dumpThisFrame = dumpThisFrame_; // TODO: Add check for displaylist debugger. - const bool useFastRunLoop = !dumpThisFrame; + const bool useFastRunLoop = !dumpThisFrame && !g_RemasterMode; while (gpuState == GPUSTATE_RUNNING) { if (list.pc == list.stall) From 8ab734d516ee2b7de8cb0b1ba1c9a1e2ba1afc9f Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 22 Jun 2013 04:05:28 -0400 Subject: [PATCH 04/16] Restructure the hack to be more correct, and add support for double texture coordinates. Fixes #2314. Also address various coding style issues. --- Core/HDRemaster.cpp | 3 +- Core/HDRemaster.h | 22 +++++++++------ Core/MemMap.cpp | 25 +++++++++++++++- Core/MemMap.h | 32 ++++++++++----------- Core/MemMapFunctions.cpp | 26 +++++++++-------- Core/PSPLoaders.cpp | 58 +++++++++++++++++++++++++++----------- Core/PSPLoaders.h | 1 + Core/System.cpp | 2 +- GPU/GLES/VertexDecoder.cpp | 38 ++++++++++++++++++++++++- GPU/GLES/VertexDecoder.h | 2 ++ 10 files changed, 150 insertions(+), 59 deletions(-) diff --git a/Core/HDRemaster.cpp b/Core/HDRemaster.cpp index 8b62719e00..88e2a13edb 100644 --- a/Core/HDRemaster.cpp +++ b/Core/HDRemaster.cpp @@ -17,4 +17,5 @@ #include "HDRemaster.h" -bool g_RemasterMode = false; +bool g_RemasterMode; +bool g_DoubleTextureCoordinates; diff --git a/Core/HDRemaster.h b/Core/HDRemaster.h index 4fced19876..7bfce1606b 100644 --- a/Core/HDRemaster.h +++ b/Core/HDRemaster.h @@ -24,25 +24,29 @@ // We keep it set to false by default in PSPLoaders.cpp // in order to keep the 99% of other PSP games working happily. extern bool g_RemasterMode; +extern bool g_DoubleTextureCoordinates; struct HDRemaster { std::string gameID; u64 MemorySize; u64 MemoryEnd; //Seems to be different for each game as well + bool DoubleTextureCoordinates; }; // TODO: Are those BLJM* IDs really valid? They seem to be the physical PS3 disk IDs, // but they're included for safety. +// TODO: Do all of the remasters aside from Monster Hunter use double texture coordinates? +// TODO: Are all remasters happy with this end address? const u32 REMASTER_COUNT = 9; const struct HDRemaster g_HDRemasters[REMASTER_COUNT] = { - { "NPJB40001", 0x2800000, 0x0B8FFFFF }, // MONSTER HUNTER PORTABLE 3rd HD Ver. - { "BLJM85002", 0x2800000, 0x0B8FFFFF }, // K-ON Houkago Live HD Ver - { "NPJB40002", 0x2800000, 0x0B8FFFFF }, // K-ON Houkago Live HD Ver - { "BLJM85003", 0x2800000, 0x0B8FFFFF }, // Shin Sangoku Musou Multi Raid 2 HD Ver - { "NPJB40003", 0x2800000, 0x0B8FFFFF }, // Shin Sangoku Musou Multi Raid 2 HD Ver - { "BLJM85004", 0x3000000, 0x0B8FFFFF }, // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition - { "NPJB40004", 0x3000000, 0x0B8FFFFF }, // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition - { "BLJM85005", 0x4000000, 0x0B8FFFFF }, // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition - { "NPJB40005", 0x4000000, 0x0B8FFFFF }, // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition + { "NPJB40001", 0x4000000, 0x0BBFFFFF, false }, // MONSTER HUNTER PORTABLE 3rd HD Ver. + { "BLJM85002", 0x4000000, 0x0BBFFFFF, true }, // K-ON Houkago Live HD Ver + { "NPJB40002", 0x4000000, 0x0BBFFFFF, true }, // K-ON Houkago Live HD Ver + { "BLJM85003", 0x4000000, 0x0BBFFFFF, true }, // Shin Sangoku Musou Multi Raid 2 HD Ver + { "NPJB40003", 0x4000000, 0x0BBFFFFF, true }, // Shin Sangoku Musou Multi Raid 2 HD Ver + { "BLJM85004", 0x4000000, 0x0BBFFFFF, true }, // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition + { "NPJB40004", 0x4000000, 0x0BBFFFFF, true }, // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition + { "BLJM85005", 0x4000000, 0x0BBFFFFF, true }, // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition + { "NPJB40005", 0x4000000, 0x0BBFFFFF, true }, // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition }; diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index ce20352bd1..2ad39aa58b 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -28,6 +28,10 @@ #include "CPU.h" #include "Debugger/SymbolMap.h" +#include +#include "Loaders.h" +#include "PSPLoaders.h" + namespace Memory { @@ -78,10 +82,25 @@ static MemoryView views[] = static const int num_views = sizeof(views) / sizeof(MemoryView); -void Init() +void Init(std::string fileToStart) { int flags = 0; + // Default memory settings + // TODO: Should DoubleTex really be initialized here? + // Seems to be the safest place currently.. + g_MemoryEnd = 0x0A000000; + g_MemorySize = 0x2000000; + g_RemasterMode = false; + g_DoubleTextureCoordinates = false; + + switch(Identify_File(fileToStart)) { + case FILETYPE_PSP_ISO: + case FILETYPE_PSP_ISO_NP: + InitGameISO(fileToStart); + break; + } + g_MemoryMask = g_MemorySize - 1; for(int i = 4; i < 7; i++) views[i].size = g_MemorySize; @@ -102,6 +121,10 @@ void DoState(PointerWrap &p) p.DoMarker("ScratchPad"); p.Do(g_RemasterMode); p.DoMarker("RemasterMode"); + p.Do(g_MemoryEnd); + p.DoMarker("MemoryEnd"); + p.Do(g_MemoryMask); + p.DoMarker("MemoryMask"); } void Shutdown() diff --git a/Core/MemMap.h b/Core/MemMap.h index 9cf4f26ab7..e752dc47cb 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -57,22 +57,6 @@ typedef void (*readFn16)(u16&, const u32); typedef void (*readFn32)(u32&, const u32); typedef void (*readFn64)(u64&, const u32); -inline u32 PSP_GetScratchpadMemoryBase() { return 0x00010000;} -inline u32 PSP_GetScratchpadMemoryEnd() { return 0x00014000;} - -inline u32 PSP_GetKernelMemoryBase() { return 0x08000000;} -inline u32 PSP_GetKernelMemoryEnd() { return 0x08400000;} -// "Volatile" RAM is between 0x08400000 and 0x08800000, can be requested by the -// game through sceKernelVolatileMemTryLock. - -inline u32 PSP_GetUserMemoryBase() { return 0x08800000;} -inline u32 PSP_GetKernelMemoryEnd(); - -inline u32 PSP_GetDefaultLoadAddress() { return 0x08804000;} -//inline u32 PSP_GetDefaultLoadAddress() { return 0x0898dab0;} -inline u32 PSP_GetVidMemBase() { return 0x04000000;} -inline u32 PSP_GetVidMemEnd() { return 0x04800000;} - namespace Memory { // Base is a pointer to the base of the memory map. Yes, some MMU tricks @@ -118,7 +102,7 @@ enum }; // Init and Shutdown -void Init(); +void Init(std::string fileToStart); void Shutdown(); void DoState(PointerWrap &p); void Clear(); @@ -358,6 +342,20 @@ struct PSPPointer }; inline u32 PSP_GetUserMemoryEnd() { return Memory::g_MemoryEnd;} +inline u32 PSP_GetScratchpadMemoryBase() { return 0x00010000;} +inline u32 PSP_GetScratchpadMemoryEnd() { return 0x00014000;} + +inline u32 PSP_GetKernelMemoryBase() { return 0x08000000;} +inline u32 PSP_GetKernelMemoryEnd() { return 0x08400000;} +// "Volatile" RAM is between 0x08400000 and 0x08800000, can be requested by the +// game through sceKernelVolatileMemTryLock. + +inline u32 PSP_GetUserMemoryBase() { return 0x08800000;} + +inline u32 PSP_GetDefaultLoadAddress() { return 0x08804000;} +//inline u32 PSP_GetDefaultLoadAddress() { return 0x0898dab0;} +inline u32 PSP_GetVidMemBase() { return 0x04000000;} +inline u32 PSP_GetVidMemEnd() { return 0x04800000;} template inline bool operator==(const PSPPointer &lhs, const PSPPointer &rhs) diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index e29c0e9760..6b7016e2c0 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -46,15 +46,16 @@ u8 *GetPointer(const u32 address) if ((address & 0x3E000000) == 0x08000000) { return m_pRAM + (address & g_MemoryMask); } - else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) { - return m_pRAM + (address & g_MemoryMask); - } + else if ((address & 0x3F800000) == 0x04000000) { return m_pVRAM + (address & VRAM_MASK); } else if ((address & 0xBFFF0000) == 0x00010000) { return m_pScratchPad + (address & SCRATCHPAD_MASK); } + else if (g_RemasterMode && (address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { + return m_pRAM + (address & g_MemoryMask); + } else { ERROR_LOG(MEMMAP, "Unknown GetPointer %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); if (!g_Config.bIgnoreBadMemAccess) { @@ -76,9 +77,6 @@ inline void ReadFromHardware(T &var, const u32 address) if ((address & 0x3E000000) == 0x08000000) { var = *((const T*)&m_pRAM[address & g_MemoryMask]); } - else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) { - var = *((const T*)&m_pRAM[address & g_MemoryMask]); - } else if ((address & 0x3F800000) == 0x04000000) { var = *((const T*)&m_pVRAM[address & VRAM_MASK]); } @@ -86,6 +84,9 @@ inline void ReadFromHardware(T &var, const u32 address) // Scratchpad var = *((const T*)&m_pScratchPad[address & SCRATCHPAD_MASK]); } + else if (g_RemasterMode && (address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { + var = *((const T*)&m_pRAM[address & g_MemoryMask]); + } else { if (g_Config.bJit) { @@ -109,15 +110,15 @@ inline void WriteToHardware(u32 address, const T data) if ((address & 0x3E000000) == 0x08000000) { *(T*)&m_pRAM[address & g_MemoryMask] = data; } - else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) { - *(T*)&m_pRAM[address & g_MemoryMask] = data; - } else if ((address & 0x3F800000) == 0x04000000) { *(T*)&m_pVRAM[address & VRAM_MASK] = data; } else if ((address & 0xBFFF0000) == 0x00010000) { *(T*)&m_pScratchPad[address & SCRATCHPAD_MASK] = data; } + else if (g_RemasterMode && (address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { + *(T*)&m_pRAM[address & g_MemoryMask] = data; + } else { if (g_Config.bJit) { @@ -139,15 +140,16 @@ bool IsValidAddress(const u32 address) if ((address & 0x3E000000) == 0x08000000) { return true; } - else if (g_RemasterMode && (address & 0x3E000000) != 0x08000000) { - return true; - } + else if ((address & 0x3F800000) == 0x04000000) { return true; } else if ((address & 0xBFFF0000) == 0x00010000) { return true; } + else if (g_RemasterMode && (address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { + return true; + } else return false; } diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 0e670e84c5..159e4d20b3 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -42,9 +42,12 @@ #include "Core/MemMap.h" -bool Load_PSP_ISO(const char *filename, std::string *error_string) -{ - ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, constructBlockDevice(filename)); +// TODO: Come up with a better name for this thing +// We gather the game info before actually loading/booting the ISO +// to determine if the emulator should enable extra memory and +// double-sized texture coordinates. +void InitGameISO(std::string fileToStart) { + ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, constructBlockDevice(fileToStart.c_str())); // Parse PARAM.SFO @@ -53,6 +56,40 @@ bool Load_PSP_ISO(const char *filename, std::string *error_string) pspFileSystem.Mount("umd1:", umd2); pspFileSystem.Mount("disc0:", umd2); pspFileSystem.Mount("umd:", umd2); + std::string gameID; + + std::string sfoPath("disc0:/PSP_GAME/PARAM.SFO"); + PSPFileInfo fileInfo = pspFileSystem.GetFileInfo(sfoPath.c_str()); + + if (fileInfo.exists) + { + u8 *paramsfo = new u8[(size_t)fileInfo.size]; + u32 fd = pspFileSystem.OpenFile(sfoPath, FILEACCESS_READ); + pspFileSystem.ReadFile(fd, paramsfo, fileInfo.size); + pspFileSystem.CloseFile(fd); + if (g_paramSFO.ReadSFO(paramsfo, (size_t)fileInfo.size)) + { + gameID = g_paramSFO.GetValueString("DISC_ID"); + + for(int i = 0; i < REMASTER_COUNT; i++) { + if(g_HDRemasters[i].gameID == gameID) { + g_RemasterMode = true; + Memory::g_MemoryEnd = g_HDRemasters[i].MemoryEnd; + Memory::g_MemorySize = g_HDRemasters[i].MemorySize; + if(g_HDRemasters[i].DoubleTextureCoordinates) + g_DoubleTextureCoordinates = true; + break; + } + } + ERROR_LOG(LOADER, "HDRemaster mode is %s", g_RemasterMode? "true": "false"); + } + delete [] paramsfo; + } +} + +bool Load_PSP_ISO(const char *filename, std::string *error_string) +{ + //Mounting stuff removed due to HD Remaster restructuring of code. std::string sfoPath("disc0:/PSP_GAME/PARAM.SFO"); PSPFileInfo fileInfo = pspFileSystem.GetFileInfo(sfoPath.c_str()); @@ -65,22 +102,9 @@ bool Load_PSP_ISO(const char *filename, std::string *error_string) if (g_paramSFO.ReadSFO(paramsfo, (size_t)fileInfo.size)) { char title[1024]; - std::string gameID = g_paramSFO.GetValueString("DISC_ID"); - sprintf(title, "%s : %s", gameID.c_str(), g_paramSFO.GetValueString("TITLE").c_str()); + sprintf(title, "%s : %s", g_paramSFO.GetValueString("DISC_ID").c_str(), g_paramSFO.GetValueString("TITLE").c_str()); INFO_LOG(LOADER, "%s", title); host->SetWindowTitle(title); - g_RemasterMode = false; - Memory::g_MemoryEnd = 0x0A000000; - Memory::g_MemorySize = 0x2000000; - for(int i = 0; i < REMASTER_COUNT; i++) { - if(g_HDRemasters[i].gameID == gameID) { - g_RemasterMode = true; - Memory::g_MemoryEnd = g_HDRemasters[i].MemoryEnd; - Memory::g_MemorySize = g_HDRemasters[i].MemorySize; - break; - } - } - DEBUG_LOG(LOADER, "HDRemaster mode is %s", g_RemasterMode? "true": "false"); } delete [] paramsfo; } diff --git a/Core/PSPLoaders.h b/Core/PSPLoaders.h index 4de0f2cb3e..b679e38169 100644 --- a/Core/PSPLoaders.h +++ b/Core/PSPLoaders.h @@ -23,3 +23,4 @@ bool Load_PSP_ISO(const char *filename, std::string *error_string); bool Load_PSP_ELF_PBP(const char *filename, std::string *error_string); +void InitGameISO(std::string fileToStart); diff --git a/Core/System.cpp b/Core/System.cpp index d4d4e22d87..35674a1a37 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -72,7 +72,7 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) coreParameter = coreParam; currentCPU = &mipsr4k; numCPUs = 1; - Memory::Init(); + Memory::Init(coreParam.fileToStart); mipsr4k.Reset(); mipsr4k.pc = 0; diff --git a/GPU/GLES/VertexDecoder.cpp b/GPU/GLES/VertexDecoder.cpp index a037b2570b..a208b57bc6 100644 --- a/GPU/GLES/VertexDecoder.cpp +++ b/GPU/GLES/VertexDecoder.cpp @@ -156,6 +156,15 @@ void VertexDecoder::Step_TcU16() const *uv = *uvdata; } +void VertexDecoder::Step_TcU16Double() const +{ + u16 *uv = (u16*)(decoded_ + decFmt.uvoff); + const u16 *uvdata = (const u16*)(ptr_ + tcoff); + *uv = *uvdata; + uv[0] = uvdata[0] * 2; + uv[1] = uvdata[1] * 2; +} + void VertexDecoder::Step_TcU16Through() const { u16 *uv = (u16 *)(decoded_ + decFmt.uvoff); @@ -164,6 +173,14 @@ void VertexDecoder::Step_TcU16Through() const uv[1] = uvdata[1]; } +void VertexDecoder::Step_TcU16ThroughDouble() const +{ + u16 *uv = (u16 *)(decoded_ + decFmt.uvoff); + const u16 *uvdata = (const u16*)(ptr_ + tcoff); + uv[0] = uvdata[0] * 2; + uv[1] = uvdata[1] * 2; +} + void VertexDecoder::Step_TcFloat() const { float *uv = (float *)(decoded_ + decFmt.uvoff); @@ -476,6 +493,21 @@ static const StepFunction tcstep_through[4] = { &VertexDecoder::Step_TcFloatThrough, }; +// Some HD Remaster games double the u16 vertex coordinates. +static const StepFunction tcstep_Remaster[4] = { + 0, + &VertexDecoder::Step_TcU8, + &VertexDecoder::Step_TcU16Double, + &VertexDecoder::Step_TcFloat, +}; + +static const StepFunction tcstep_through_Remaster[4] = { + 0, + &VertexDecoder::Step_TcU8, + &VertexDecoder::Step_TcU16ThroughDouble, + &VertexDecoder::Step_TcFloatThrough, +}; + // TODO: Tc Morph static const StepFunction colstep[8] = { @@ -589,9 +621,13 @@ void VertexDecoder::SetVertexType(u32 fmt) { if (tcalign[tc] > biggest) biggest = tcalign[tc]; - steps_[numSteps_++] = throughmode ? tcstep_through[tc] : tcstep[tc]; + if(g_DoubleTextureCoordinates) + steps_[numSteps_++] = throughmode ? tcstep_through_Remaster[tc] : tcstep_Remaster[tc]; + else + steps_[numSteps_++] = throughmode ? tcstep_through[tc] : tcstep[tc]; switch (tc) { + case GE_VTYPE_TC_8BIT >> GE_VTYPE_TC_SHIFT: decFmt.uvfmt = throughmode ? DEC_U8A_2 : DEC_U8_2; break; diff --git a/GPU/GLES/VertexDecoder.h b/GPU/GLES/VertexDecoder.h index 309e4f3369..770797af73 100644 --- a/GPU/GLES/VertexDecoder.h +++ b/GPU/GLES/VertexDecoder.h @@ -116,8 +116,10 @@ public: void Step_TcU8() const; void Step_TcU16() const; + void Step_TcU16Double() const; void Step_TcFloat() const; void Step_TcU16Through() const; + void Step_TcU16ThroughDouble() const; void Step_TcFloatThrough() const; // TODO: tcmorph From 51f387eee736b9631d525d08fda9d34b72999d3c Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 22 Jun 2013 04:07:25 -0400 Subject: [PATCH 05/16] Remove unnecessary include. --- Core/MemMap.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 2ad39aa58b..f2e3146b2b 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -28,7 +28,6 @@ #include "CPU.h" #include "Debugger/SymbolMap.h" -#include #include "Loaders.h" #include "PSPLoaders.h" From 1260d761673d6a79b7d8fae99978ec524eef1782 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 22 Jun 2013 04:10:42 -0400 Subject: [PATCH 06/16] Remove magic numbers from loop, thus fixing more coding style issues. --- Core/MemMap.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index f2e3146b2b..36d0cbf1e6 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -65,7 +65,8 @@ u32 g_MemoryMask; u32 g_MemorySize; // We don't declare the IO region in here since its handled by other means. -static MemoryView views[] = +const int VIEWS_COUNT = 7; +static MemoryView views[VIEWS_COUNT] = { {&m_pScratchPad, &m_pPhysicalScratchPad, 0x00010000, SCRATCHPAD_SIZE, 0}, {NULL, &m_pUncachedScratchPad, 0x40010000, SCRATCHPAD_SIZE, MV_MIRROR_PREVIOUS}, @@ -101,9 +102,10 @@ void Init(std::string fileToStart) } g_MemoryMask = g_MemorySize - 1; - for(int i = 4; i < 7; i++) - views[i].size = g_MemorySize; - + for(int i = 0; i < VIEWS_COUNT; i++) { + if(views[i].size == 0) + views[i].size = g_MemorySize; + } base = MemoryMap_Setup(views, num_views, flags, &g_arena); INFO_LOG(MEMMAP, "Memory system initialized. RAM at %p (mirror at 0 @ %p, uncached @ %p)", From 7ade9f6ceba90963d6ac272aa59242a6ba124aac Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 22 Jun 2013 04:23:34 -0400 Subject: [PATCH 07/16] Remove old TODOs. Re-enable FastRunLoop for HD Remasters. --- GPU/GLES/DisplayListInterpreter.cpp | 1 - GPU/GPUCommon.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index 7e8fc508c2..ea64baa8b0 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -317,7 +317,6 @@ u32 GLES_GPU::DrawSync(int mode) return GPUCommon::DrawSync(mode); } -// TODO: Fix this so it doesn't crash void GLES_GPU::FastRunLoop(DisplayList &list) { for (; downcount > 0; --downcount) { u32 op = Memory::ReadUnchecked_U32(list.pc); diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index ed5cd7f1eb..a53cb18eb8 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -399,7 +399,7 @@ bool GPUCommon::InterpretList(DisplayList &list) const bool dumpThisFrame = dumpThisFrame_; // TODO: Add check for displaylist debugger. - const bool useFastRunLoop = !dumpThisFrame && !g_RemasterMode; + const bool useFastRunLoop = !dumpThisFrame; while (gpuState == GPUSTATE_RUNNING) { if (list.pc == list.stall) From 695f7eeec5dfa360fae13b45669510c995f49962 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 22 Jun 2013 05:14:01 -0400 Subject: [PATCH 08/16] Fix more style issues, and abstract most of the init code from MemMap.cpp. --- Core/MemMap.cpp | 25 +++++-------------------- Core/MemMap.h | 2 +- Core/PSPLoaders.cpp | 11 +++++++++-- Core/PSPLoaders.h | 2 +- Core/System.cpp | 11 +++++++++-- GPU/GLES/VertexDecoder.cpp | 1 - 6 files changed, 25 insertions(+), 27 deletions(-) diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 36d0cbf1e6..1a6500a5ed 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -65,8 +65,7 @@ u32 g_MemoryMask; u32 g_MemorySize; // We don't declare the IO region in here since its handled by other means. -const int VIEWS_COUNT = 7; -static MemoryView views[VIEWS_COUNT] = +static MemoryView views[] = { {&m_pScratchPad, &m_pPhysicalScratchPad, 0x00010000, SCRATCHPAD_SIZE, 0}, {NULL, &m_pUncachedScratchPad, 0x40010000, SCRATCHPAD_SIZE, MV_MIRROR_PREVIOUS}, @@ -82,27 +81,11 @@ static MemoryView views[VIEWS_COUNT] = static const int num_views = sizeof(views) / sizeof(MemoryView); -void Init(std::string fileToStart) +void Init() { int flags = 0; - // Default memory settings - // TODO: Should DoubleTex really be initialized here? - // Seems to be the safest place currently.. - g_MemoryEnd = 0x0A000000; - g_MemorySize = 0x2000000; - g_RemasterMode = false; - g_DoubleTextureCoordinates = false; - - switch(Identify_File(fileToStart)) { - case FILETYPE_PSP_ISO: - case FILETYPE_PSP_ISO_NP: - InitGameISO(fileToStart); - break; - } - - g_MemoryMask = g_MemorySize - 1; - for(int i = 0; i < VIEWS_COUNT; i++) { + for(int i = 0; i < ARRAY_SIZE(views); i++) { if(views[i].size == 0) views[i].size = g_MemorySize; } @@ -126,6 +109,8 @@ void DoState(PointerWrap &p) p.DoMarker("MemoryEnd"); p.Do(g_MemoryMask); p.DoMarker("MemoryMask"); + p.Do(g_DoubleTextureCoordinates); // TODO: Is there a more appropriate place for this? + p.DoMarker("DoubleTextureCoordinates"); } void Shutdown() diff --git a/Core/MemMap.h b/Core/MemMap.h index e752dc47cb..fb35e30df2 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -102,7 +102,7 @@ enum }; // Init and Shutdown -void Init(std::string fileToStart); +void Init(); void Shutdown(); void DoState(PointerWrap &p); void Clear(); diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 159e4d20b3..dc0dc1df2f 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -42,11 +42,18 @@ #include "Core/MemMap.h" -// TODO: Come up with a better name for this thing // We gather the game info before actually loading/booting the ISO // to determine if the emulator should enable extra memory and // double-sized texture coordinates. -void InitGameISO(std::string fileToStart) { +void InitMemoryForGameISO(std::string fileToStart) { + // Default memory settings + // Seems to be the safest place currently.. + Memory::g_MemoryEnd = 0x0A000000; + Memory::g_MemorySize = 0x2000000; + g_RemasterMode = false; + g_DoubleTextureCoordinates = false; + Memory::g_MemoryMask = Memory::g_MemorySize - 1; + ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, constructBlockDevice(fileToStart.c_str())); // Parse PARAM.SFO diff --git a/Core/PSPLoaders.h b/Core/PSPLoaders.h index b679e38169..5ebf339520 100644 --- a/Core/PSPLoaders.h +++ b/Core/PSPLoaders.h @@ -23,4 +23,4 @@ bool Load_PSP_ISO(const char *filename, std::string *error_string); bool Load_PSP_ELF_PBP(const char *filename, std::string *error_string); -void InitGameISO(std::string fileToStart); +void InitMemoryForGameISO(std::string fileToStart); diff --git a/Core/System.cpp b/Core/System.cpp index 35674a1a37..92d0017b4a 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -44,6 +44,7 @@ #include "CoreParameter.h" #include "FileSystems/MetaFileSystem.h" #include "Loaders.h" +#include "PSPLoaders.h" #include "ELF/ParamSFO.h" #include "../Common/LogManager.h" @@ -72,7 +73,14 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) coreParameter = coreParam; currentCPU = &mipsr4k; numCPUs = 1; - Memory::Init(coreParam.fileToStart); + + std::string filename = coreParameter.fileToStart; + EmuFileType type = Identify_File(filename); + + if(type == FILETYPE_PSP_ISO || type == FILETYPE_PSP_ISO_NP) + InitMemoryForGameISO(filename); + + Memory::Init(); mipsr4k.Reset(); mipsr4k.pc = 0; @@ -96,7 +104,6 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) // TODO: Check Game INI here for settings, patches and cheats, and modify coreParameter accordingly - std::string filename = coreParameter.fileToStart; if (!LoadFile(filename, error_string) || coreState == CORE_POWERDOWN) { pspFileSystem.Shutdown(); diff --git a/GPU/GLES/VertexDecoder.cpp b/GPU/GLES/VertexDecoder.cpp index a208b57bc6..65e73eed27 100644 --- a/GPU/GLES/VertexDecoder.cpp +++ b/GPU/GLES/VertexDecoder.cpp @@ -627,7 +627,6 @@ void VertexDecoder::SetVertexType(u32 fmt) { steps_[numSteps_++] = throughmode ? tcstep_through[tc] : tcstep[tc]; switch (tc) { - case GE_VTYPE_TC_8BIT >> GE_VTYPE_TC_SHIFT: decFmt.uvfmt = throughmode ? DEC_U8A_2 : DEC_U8_2; break; From 6b3534026501f85c3cca58a401d7ac0024b1c4ea Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 22 Jun 2013 05:27:50 -0400 Subject: [PATCH 09/16] ..And another. --- GPU/GLES/DisplayListInterpreter.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/GPU/GLES/DisplayListInterpreter.cpp b/GPU/GLES/DisplayListInterpreter.cpp index ea64baa8b0..77c118f7de 100644 --- a/GPU/GLES/DisplayListInterpreter.cpp +++ b/GPU/GLES/DisplayListInterpreter.cpp @@ -36,8 +36,6 @@ #include "../../Core/HLE/sceKernelInterrupt.h" #include "../../Core/HLE/sceGe.h" -#include "../../Core/HDRemaster.h" - extern u32 curTextureWidth; extern u32 curTextureHeight; From d11deba3cd7e7472845773ae608032829bdb1535 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 23 Jun 2013 00:17:33 -0400 Subject: [PATCH 10/16] Fix HD Remasters and tidy up. This should be the final commit for the preliminary support, no further coding style issues withstanding. --- Core/MemMap.cpp | 1 + Core/MemMapFunctions.cpp | 2 -- Core/PSPLoaders.cpp | 10 +--------- Core/System.cpp | 9 ++++++++- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 1a6500a5ed..240fac7ee5 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -84,6 +84,7 @@ static const int num_views = sizeof(views) / sizeof(MemoryView); void Init() { int flags = 0; + Memory::g_MemoryMask = Memory::g_MemorySize - 1; for(int i = 0; i < ARRAY_SIZE(views); i++) { if(views[i].size == 0) diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index 6b7016e2c0..aa421ef033 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -46,7 +46,6 @@ u8 *GetPointer(const u32 address) if ((address & 0x3E000000) == 0x08000000) { return m_pRAM + (address & g_MemoryMask); } - else if ((address & 0x3F800000) == 0x04000000) { return m_pVRAM + (address & VRAM_MASK); } @@ -140,7 +139,6 @@ bool IsValidAddress(const u32 address) if ((address & 0x3E000000) == 0x08000000) { return true; } - else if ((address & 0x3F800000) == 0x04000000) { return true; } diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index dc0dc1df2f..0559a7dcd0 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -46,14 +46,6 @@ // to determine if the emulator should enable extra memory and // double-sized texture coordinates. void InitMemoryForGameISO(std::string fileToStart) { - // Default memory settings - // Seems to be the safest place currently.. - Memory::g_MemoryEnd = 0x0A000000; - Memory::g_MemorySize = 0x2000000; - g_RemasterMode = false; - g_DoubleTextureCoordinates = false; - Memory::g_MemoryMask = Memory::g_MemorySize - 1; - ISOFileSystem *umd2 = new ISOFileSystem(&pspFileSystem, constructBlockDevice(fileToStart.c_str())); // Parse PARAM.SFO @@ -96,7 +88,7 @@ void InitMemoryForGameISO(std::string fileToStart) { bool Load_PSP_ISO(const char *filename, std::string *error_string) { - //Mounting stuff removed due to HD Remaster restructuring of code. + //Mounting stuff relocated to InitMemoryForGameISO due to HD Remaster restructuring of code. std::string sfoPath("disc0:/PSP_GAME/PARAM.SFO"); PSPFileInfo fileInfo = pspFileSystem.GetFileInfo(sfoPath.c_str()); diff --git a/Core/System.cpp b/Core/System.cpp index 92d0017b4a..2242f660a6 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -74,7 +74,14 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) currentCPU = &mipsr4k; numCPUs = 1; - std::string filename = coreParameter.fileToStart; + // Default memory settings + // Seems to be the safest place currently.. + Memory::g_MemoryEnd = 0x0A000000; //End of PSP User space memory + Memory::g_MemorySize = 0x2000000; //32 MB of ram by default + g_RemasterMode = false; + g_DoubleTextureCoordinates = false; + + std::string filename = coreParam.fileToStart; EmuFileType type = Identify_File(filename); if(type == FILETYPE_PSP_ISO || type == FILETYPE_PSP_ISO_NP) From dfd70d993c308349814867944429b22d4e272ba9 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 23 Jun 2013 00:25:55 -0400 Subject: [PATCH 11/16] Add HDRemaster.cpp/.h to Android.mk and CMakeLists.txt. --- CMakeLists.txt | 2 ++ android/jni/Android.mk | 1 + 2 files changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index edd0178b47..c5ef9c9d1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -735,6 +735,8 @@ add_library(${CoreLibName} ${CoreLinkType} Core/CoreTiming.h Core/CwCheat.cpp Core/CwCheat.h + Core/HDRemaster.cpp + Core/HDRemaster.h Core/Debugger/Breakpoints.cpp Core/Debugger/Breakpoints.h Core/Debugger/DebugInterface.h diff --git a/android/jni/Android.mk b/android/jni/Android.mk index ab1e76df51..143c6fc9c0 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -193,6 +193,7 @@ LOCAL_SRC_FILES := \ $(SRC)/Core/CoreTiming.cpp \ $(SRC)/Core/CPU.cpp \ $(SRC)/Core/CwCheat.cpp \ + $(SRC)/Core/HDRemaster.cpp \ $(SRC)/Core/Host.cpp \ $(SRC)/Core/Loaders.cpp \ $(SRC)/Core/PSPLoaders.cpp \ From cc78160ff16ef2cf7f7fe3118295db4ed8b40ed9 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 23 Jun 2013 00:26:52 -0400 Subject: [PATCH 12/16] Forgot QT. --- Qt/Core.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Qt/Core.pro b/Qt/Core.pro index a81eea68dc..c8c8d9cb63 100755 --- a/Qt/Core.pro +++ b/Qt/Core.pro @@ -37,6 +37,7 @@ SOURCES += ../Core/CPU.cpp \ # Core ../Core/Core.cpp \ ../Core/CoreTiming.cpp \ ../Core/CwCheat.cpp \ + ../Core/HDRemaster.cpp \ ../Core/Host.cpp \ ../Core/Loaders.cpp \ ../Core/MemMap.cpp \ @@ -71,6 +72,7 @@ HEADERS += ../Core/CPU.h \ ../Core/CoreParameter.h \ ../Core/CoreTiming.h \ ../Core/CwCheat.h \ + ../Core/HDRemaster.h \ ../Core/Host.h \ ../Core/Loaders.h \ ../Core/MemMap.h \ From bd0944fc494676b26e1120fbb8cbf88aec446e8f Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 23 Jun 2013 01:26:39 -0400 Subject: [PATCH 13/16] Remove a few more unneeded includes and change a loop to use ARRAY_SIZE instead of a variable. --- Core/HDRemaster.h | 4 +--- Core/MemMap.cpp | 3 --- Core/MemMapFunctions.cpp | 2 -- Core/PSPLoaders.cpp | 2 +- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Core/HDRemaster.h b/Core/HDRemaster.h index 7bfce1606b..e6b6b4cadb 100644 --- a/Core/HDRemaster.h +++ b/Core/HDRemaster.h @@ -37,9 +37,7 @@ struct HDRemaster { // but they're included for safety. // TODO: Do all of the remasters aside from Monster Hunter use double texture coordinates? // TODO: Are all remasters happy with this end address? -const u32 REMASTER_COUNT = 9; - -const struct HDRemaster g_HDRemasters[REMASTER_COUNT] = { +const struct HDRemaster g_HDRemasters[] = { { "NPJB40001", 0x4000000, 0x0BBFFFFF, false }, // MONSTER HUNTER PORTABLE 3rd HD Ver. { "BLJM85002", 0x4000000, 0x0BBFFFFF, true }, // K-ON Houkago Live HD Ver { "NPJB40002", 0x4000000, 0x0BBFFFFF, true }, // K-ON Houkago Live HD Ver diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 240fac7ee5..82e2f85f14 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -28,9 +28,6 @@ #include "CPU.h" #include "Debugger/SymbolMap.h" -#include "Loaders.h" -#include "PSPLoaders.h" - namespace Memory { diff --git a/Core/MemMapFunctions.cpp b/Core/MemMapFunctions.cpp index aa421ef033..b5622af7da 100644 --- a/Core/MemMapFunctions.cpp +++ b/Core/MemMapFunctions.cpp @@ -24,8 +24,6 @@ #include "MIPS/MIPS.h" -#include "Core/HDRemaster.h" - // TODO: Fix this #undef ENABLE_MEM_CHECK diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 0559a7dcd0..23501c5430 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -70,7 +70,7 @@ void InitMemoryForGameISO(std::string fileToStart) { { gameID = g_paramSFO.GetValueString("DISC_ID"); - for(int i = 0; i < REMASTER_COUNT; i++) { + for(int i = 0; i < ARRAY_SIZE(g_HDRemasters); i++) { if(g_HDRemasters[i].gameID == gameID) { g_RemasterMode = true; Memory::g_MemoryEnd = g_HDRemasters[i].MemoryEnd; From ad1323c6ec0830bbbdbcac20928b6b2fc814fa21 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 23 Jun 2013 01:33:42 -0400 Subject: [PATCH 14/16] Change logging in PSPLoaders.cpp to debug instead of error; it was a remnant of the debugging process. --- Core/PSPLoaders.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 23501c5430..2c58ff540b 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -80,7 +80,7 @@ void InitMemoryForGameISO(std::string fileToStart) { break; } } - ERROR_LOG(LOADER, "HDRemaster mode is %s", g_RemasterMode? "true": "false"); + DEBUG_LOG(LOADER, "HDRemaster mode is %s", g_RemasterMode? "true": "false"); } delete [] paramsfo; } From 0bbcec9ad4b0b75b411e7d6fceb3b84b6b7592ca Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 23 Jun 2013 01:37:24 -0400 Subject: [PATCH 15/16] Remove redundant include and fix comments. --- Core/PSPLoaders.cpp | 4 +--- Core/System.cpp | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 2c58ff540b..3234ae6baf 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -40,8 +40,6 @@ #include "HLE/sceKernelMemory.h" #include "ELF/ParamSFO.h" -#include "Core/MemMap.h" - // We gather the game info before actually loading/booting the ISO // to determine if the emulator should enable extra memory and // double-sized texture coordinates. @@ -88,7 +86,7 @@ void InitMemoryForGameISO(std::string fileToStart) { bool Load_PSP_ISO(const char *filename, std::string *error_string) { - //Mounting stuff relocated to InitMemoryForGameISO due to HD Remaster restructuring of code. + // Mounting stuff relocated to InitMemoryForGameISO due to HD Remaster restructuring of code. std::string sfoPath("disc0:/PSP_GAME/PARAM.SFO"); PSPFileInfo fileInfo = pspFileSystem.GetFileInfo(sfoPath.c_str()); diff --git a/Core/System.cpp b/Core/System.cpp index 2242f660a6..d1f094b932 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -76,8 +76,8 @@ bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) // Default memory settings // Seems to be the safest place currently.. - Memory::g_MemoryEnd = 0x0A000000; //End of PSP User space memory - Memory::g_MemorySize = 0x2000000; //32 MB of ram by default + Memory::g_MemoryEnd = 0x0A000000; // End of PSP User space memory + Memory::g_MemorySize = 0x2000000; // 32 MB of ram by default g_RemasterMode = false; g_DoubleTextureCoordinates = false; From 0d8833500f6266a5da6b5d360b1c2cdd436f1127 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 23 Jun 2013 01:48:23 -0400 Subject: [PATCH 16/16] Fix incorrect comment. --- GPU/GLES/VertexDecoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GPU/GLES/VertexDecoder.cpp b/GPU/GLES/VertexDecoder.cpp index 65e73eed27..eb7ff4f589 100644 --- a/GPU/GLES/VertexDecoder.cpp +++ b/GPU/GLES/VertexDecoder.cpp @@ -493,7 +493,7 @@ static const StepFunction tcstep_through[4] = { &VertexDecoder::Step_TcFloatThrough, }; -// Some HD Remaster games double the u16 vertex coordinates. +// Some HD Remaster games double the u16 texture coordinates. static const StepFunction tcstep_Remaster[4] = { 0, &VertexDecoder::Step_TcU8,