diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index b92cf68e15..509ba0eb9d 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -165,7 +165,7 @@ static int Replace_memcpy_jak() { if (!dst || !src) { } else { // Jak style overlap. - for (int i = 0; i < bytes; i++) { + for (u32 i = 0; i < bytes; i++) { dst[i] = src[i]; } } @@ -1095,14 +1095,14 @@ static const ReplacementTableEntry entries[] = { static std::map replacedInstructions; -static std::map replacementNameLookup; +static std::map > replacementNameLookup; void Replacement_Init() { for (int i = 0; i < (int)ARRAY_SIZE(entries); i++) { const auto entry = &entries[i]; if (!entry->name || (entry->flags & REPFLAG_DISABLED) != 0) continue; - replacementNameLookup[entry->name] = i; + replacementNameLookup[entry->name].push_back(i); } } @@ -1117,17 +1117,18 @@ int GetNumReplacementFuncs() { return ARRAY_SIZE(entries); } -int GetReplacementFuncIndex(u64 hash, int funcSize) { +std::vector GetReplacementFuncIndexes(u64 hash, int funcSize) { const char *name = MIPSAnalyst::LookupHash(hash, funcSize); + std::vector emptyResult; if (!name) { - return -1; + return emptyResult; } auto index = replacementNameLookup.find(name); if (index != replacementNameLookup.end()) { return index->second; } - return -1; + return emptyResult; } const ReplacementTableEntry *GetReplacementFunc(int i) { @@ -1148,8 +1149,8 @@ static void WriteReplaceInstruction(u32 address, int index) { } void WriteReplaceInstructions(u32 address, u64 hash, int size) { - int index = GetReplacementFuncIndex(hash, size); - if (index >= 0) { + std::vector indexes = GetReplacementFuncIndexes(hash, size); + for (int index : indexes) { auto entry = GetReplacementFunc(index); if (entry->flags & REPFLAG_HOOKEXIT) { // When hooking func exit, we search for jr ra, and replace those. diff --git a/Core/HLE/ReplaceTables.h b/Core/HLE/ReplaceTables.h index 403cffea96..17490f69a8 100644 --- a/Core/HLE/ReplaceTables.h +++ b/Core/HLE/ReplaceTables.h @@ -61,7 +61,7 @@ void Replacement_Init(); void Replacement_Shutdown(); int GetNumReplacementFuncs(); -int GetReplacementFuncIndex(u64 hash, int funcSize); +std::vector GetReplacementFuncIndexes(u64 hash, int funcSize); const ReplacementTableEntry *GetReplacementFunc(int index); void WriteReplaceInstructions(u32 address, u64 hash, int size); diff --git a/GPU/GLES/StateMapping.cpp b/GPU/GLES/StateMapping.cpp index 57cab43d67..3c1e4008b8 100644 --- a/GPU/GLES/StateMapping.cpp +++ b/GPU/GLES/StateMapping.cpp @@ -482,9 +482,8 @@ void TransformDrawEngine::ApplyBlendState() { // At this point, through all paths above, glBlendFuncA and glBlendFuncB will be set right somehow. // The stencil-to-alpha in fragment shader doesn't apply here (blending is enabled), and we shouldn't - // do any blending in the alpha channel as that doesn't seem to happen on PSP. So lacking a better option, - // the only value we can set alpha to here without multipass and dual source alpha is zero (by setting - // the factors to zero). So let's do that. + // do any blending in the alpha channel as that doesn't seem to happen on PSP. So, we attempt to + // apply the stencil to the alpha, since that's what should be stored. GLenum alphaEq = GL_FUNC_ADD; if (replaceAlphaWithStencil != REPLACE_ALPHA_NO) { // Let the fragment shader take care of it.