From d11deba3cd7e7472845773ae608032829bdb1535 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 23 Jun 2013 00:17:33 -0400 Subject: [PATCH] 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)