diff --git a/Core/HDRemaster.cpp b/Core/HDRemaster.cpp index 88e2a13edb..87afe24a38 100644 --- a/Core/HDRemaster.cpp +++ b/Core/HDRemaster.cpp @@ -15,7 +15,20 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "HDRemaster.h" +#include "base/basictypes.h" +#include "Core/HDRemaster.h" bool g_RemasterMode; bool g_DoubleTextureCoordinates; + +// TODO: Do all of the remasters aside from Monster Hunter/Shin Sangoku use double texture coordinates? +extern const struct HDRemaster g_HDRemasters[] = { + { "NPJB40001", 0x04000000, false }, // MONSTER HUNTER PORTABLE 3rd HD Ver. + { "NPJB40002", 0x04000000, true }, // K-ON Houkago Live HD Ver + { "NPJB40003", 0x04000000, false }, // Shin Sangoku Musou Multi Raid 2 HD Ver + { "ULJM05170", 0x04000000, true, "ULJM-05170|55C069C631B22685|0001|G" }, // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition + { "ULJM05277", 0x04C00000, true, "ULJM-05277|0E8D71AFAA4F62D8|0001|G" }, // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition + { "ULJM05353", 0x04C00000, true, "ULJM-05353|0061DA67EBD6B9C6|0001|G" }, // Eiyuu Densetsu: Sora no Kiseki 3rd Kai HD Edition +}; + +const size_t g_HDRemastersCount = ARRAY_SIZE(g_HDRemasters); diff --git a/Core/HDRemaster.h b/Core/HDRemaster.h index c2f85c345b..8d6939f91c 100644 --- a/Core/HDRemaster.h +++ b/Core/HDRemaster.h @@ -17,7 +17,7 @@ #pragma once -#include "CommonTypes.h" +#include "Common/CommonTypes.h" // This bool is the key to having the HD remasters work. // We keep it set to false by default in PSPLoaders.cpp @@ -28,17 +28,10 @@ extern bool g_DoubleTextureCoordinates; struct HDRemaster { const char *gameID; - u32 MemorySize; - bool DoubleTextureCoordinates; + u32 memorySize; + bool doubleTextureCoordinates; + const char *umdDataValue; }; -// TODO: Use UMD_DATA.bin to differentiate the Eiyuu games from the regular PSP editions. -// TODO: Do all of the remasters aside from Monster Hunter/Shin Sangoku use double texture coordinates? -const struct HDRemaster g_HDRemasters[] = { - { "NPJB40001", 0x04000000, false }, // MONSTER HUNTER PORTABLE 3rd HD Ver. - { "NPJB40002", 0x04000000, true }, // K-ON Houkago Live HD Ver - { "NPJB40003", 0x04000000, false }, // Shin Sangoku Musou Multi Raid 2 HD Ver - // { "ULJM05170", 0x04000000, true }, // Eiyuu Densetsu Sora no Kiseki FC Kai HD Edition - // { "ULJM05277", 0x04C00000, true }, // Eiyuu Densetsu: Sora no Kiseki SC Kai HD Edition, game needs 76 MB - // { "ULJM05353", 0x04C00000, true }, // Eiyuu Densetsu: Sora no Kiseki 3rd Kai HD Edition, game needs 76 MB -}; +extern const struct HDRemaster g_HDRemasters[]; +extern const size_t g_HDRemastersCount; diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 2d2087aaa2..9bb517a37c 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -98,6 +98,7 @@ void InitMemoryForGameISO(FileLoader *fileLoader) { //pspFileSystem.Mount("host0:", fileSystem); std::string gameID; + std::string umdData; std::string sfoPath("disc0:/PSP_GAME/PARAM.SFO"); PSPFileInfo fileInfo = pspFileSystem.GetFileInfo(sfoPath.c_str()); @@ -107,19 +108,28 @@ void InitMemoryForGameISO(FileLoader *fileLoader) { pspFileSystem.ReadEntireFile(sfoPath, paramsfo); if (g_paramSFO.ReadSFO(paramsfo)) { UseLargeMem(g_paramSFO.GetValueInt("MEMSIZE")); - // TODO: Check the SFO for other parameters that might be useful for identifying? gameID = g_paramSFO.GetValueString("DISC_ID"); } + + std::vector umdDataBin; + if (pspFileSystem.ReadEntireFile("disc0:/UMD_DATA.BIN", umdDataBin) >= 0) { + umdData = std::string((const char *)&umdDataBin[0], umdDataBin.size()); + } } - for (size_t i = 0; i < ARRAY_SIZE(g_HDRemasters); i++) { - if (g_HDRemasters[i].gameID == gameID) { - g_RemasterMode = true; - Memory::g_MemorySize = g_HDRemasters[i].MemorySize; - if (g_HDRemasters[i].DoubleTextureCoordinates) - g_DoubleTextureCoordinates = true; - break; + for (size_t i = 0; i < g_HDRemastersCount; i++) { + const auto &entry = g_HDRemasters[i]; + if (entry.gameID != gameID) { + continue; } + if (entry.umdDataValue && umdData.find(entry.umdDataValue) != umdData.npos) { + continue; + } + + g_RemasterMode = true; + Memory::g_MemorySize = entry.memorySize; + g_DoubleTextureCoordinates = entry.doubleTextureCoordinates; + break; } if (g_RemasterMode) { INFO_LOG(LOADER, "HDRemaster found, using increased memory");