From da9472c486b2cfe4176688fd8b70a69ac4288811 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sun, 7 Jul 2013 03:07:29 -0400 Subject: [PATCH] Simplify the HDRemaster struct, eliminating the need for the g_MemoryEnd variable. --- Core/HDRemaster.h | 19 +++++++++---------- Core/MemMap.cpp | 7 ++----- Core/MemMap.h | 4 ++-- Core/PSPLoaders.cpp | 1 - Core/System.cpp | 1 - pspautotests | 2 +- 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/Core/HDRemaster.h b/Core/HDRemaster.h index e6b6b4cadb..310f23ba36 100644 --- a/Core/HDRemaster.h +++ b/Core/HDRemaster.h @@ -29,7 +29,6 @@ extern bool g_DoubleTextureCoordinates; struct HDRemaster { std::string gameID; u64 MemorySize; - u64 MemoryEnd; //Seems to be different for each game as well bool DoubleTextureCoordinates; }; @@ -38,13 +37,13 @@ struct HDRemaster { // TODO: Do all of the remasters aside from Monster Hunter use double texture coordinates? // TODO: Are all remasters happy with this end address? 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 - { "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 + { "NPJB40001", 0x4000000, false }, // MONSTER HUNTER PORTABLE 3rd HD Ver. + { "BLJM85002", 0x4000000, true }, // K-ON Houkago Live HD Ver + { "NPJB40002", 0x4000000, true }, // K-ON Houkago Live HD Ver + { "BLJM85003", 0x4000000, true }, // Shin Sangoku Musou Multi Raid 2 HD Ver + { "NPJB40003", 0x4000000, true }, // Shin Sangoku Musou Multi Raid 2 HD Ver + { "BLJM85004", 0x4000000, true }, // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition + { "NPJB40004", 0x4000000, true }, // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition + { "BLJM85005", 0x4000000, true }, // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition + { "NPJB40005", 0x4000000, true }, // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition }; diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 82e2f85f14..6464966478 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -57,7 +57,6 @@ 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; @@ -101,11 +100,9 @@ void DoState(PointerWrap &p) p.DoMarker("VRAM"); p.DoArray(m_pScratchPad, SCRATCHPAD_SIZE); p.DoMarker("ScratchPad"); - p.Do(g_RemasterMode); + p.Do(g_RemasterMode); // TODO: Need to test more if this and MemoryMask need to be saved in the state p.DoMarker("RemasterMode"); - p.Do(g_MemoryEnd); - p.DoMarker("MemoryEnd"); - p.Do(g_MemoryMask); + p.Do(g_MemoryMask); p.DoMarker("MemoryMask"); p.Do(g_DoubleTextureCoordinates); // TODO: Is there a more appropriate place for this? p.DoMarker("DoubleTextureCoordinates"); diff --git a/Core/MemMap.h b/Core/MemMap.h index fb35e30df2..bff051e25d 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -83,7 +83,6 @@ extern u8 *m_pUncachedRAM; extern u8 *m_pPhysicalVRAM; extern u8 *m_pUncachedVRAM; -extern u32 g_MemoryEnd; // End of PSP Userspace extern u32 g_MemorySize; // Replaces RAM_SIZE extern u32 g_MemoryMask; // Replaces RAM_MASK @@ -341,11 +340,12 @@ 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_GetUserMemoryEnd() { return PSP_GetKernelMemoryBase() + Memory::g_MemorySize;} inline u32 PSP_GetKernelMemoryEnd() { return 0x08400000;} // "Volatile" RAM is between 0x08400000 and 0x08800000, can be requested by the // game through sceKernelVolatileMemTryLock. diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 88b7d69553..6b04e80872 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -75,7 +75,6 @@ void InitMemoryForGameISO(std::string fileToStart) { 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; Memory::g_MemorySize = g_HDRemasters[i].MemorySize; if(g_HDRemasters[i].DoubleTextureCoordinates) g_DoubleTextureCoordinates = true; diff --git a/Core/System.cpp b/Core/System.cpp index d1f094b932..7a6c48ae92 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -76,7 +76,6 @@ 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 g_RemasterMode = false; g_DoubleTextureCoordinates = false; diff --git a/pspautotests b/pspautotests index 8b0c30efe5..d1038e00bd 160000 --- a/pspautotests +++ b/pspautotests @@ -1 +1 @@ -Subproject commit 8b0c30efe52e0c799a99a632e5e743a56375d3ec +Subproject commit d1038e00bdcf48e2ab057616bb2ec973980a7b3f