mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Add support compat to fake mipmap hacks.
This commit is contained in:
parent
7975addad0
commit
e2f9dc8f28
@ -51,6 +51,7 @@ void Compatibility::CheckSettings(IniFile &iniFile, const std::string &gameID) {
|
||||
CheckSetting(iniFile, gameID, "ClearToRAM", &flags_.ClearToRAM);
|
||||
CheckSetting(iniFile, gameID, "Force04154000Download", &flags_.Force04154000Download);
|
||||
CheckSetting(iniFile, gameID, "DrawSyncEatCycles", &flags_.DrawSyncEatCycles);
|
||||
CheckSetting(iniFile, gameID, "FakeMipmapChange", &flags_.FakeMipmapChange);
|
||||
}
|
||||
|
||||
void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) {
|
||||
|
@ -51,6 +51,7 @@ struct CompatFlags {
|
||||
bool ClearToRAM;
|
||||
bool Force04154000Download;
|
||||
bool DrawSyncEatCycles;
|
||||
bool FakeMipmapChange;
|
||||
};
|
||||
|
||||
class IniFile;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/MemoryUtil.h"
|
||||
#include "Core/TextureReplacer.h"
|
||||
#include "Core/System.h"
|
||||
#include "GPU/Common/GPUDebugInterface.h"
|
||||
#include "GPU/Common/TextureDecoder.h"
|
||||
|
||||
@ -102,6 +103,10 @@ public:
|
||||
return cache.size();
|
||||
}
|
||||
|
||||
bool IsFakeMipmapChange() {
|
||||
return PSP_CoreParameter().compat.flags().FakeMipmapChange && gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST;
|
||||
}
|
||||
|
||||
// Wow this is starting to grow big. Soon need to start looking at resizing it.
|
||||
// Must stay a POD.
|
||||
struct TexCacheEntry {
|
||||
|
@ -605,7 +605,7 @@ void TextureCacheDX9::SetTexture(bool force) {
|
||||
}
|
||||
|
||||
u8 level = 0;
|
||||
if (gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST)
|
||||
if (IsFakeMipmapChange())
|
||||
level = (gstate.texlevel >> 20) & 0xF;
|
||||
u32 texaddr = gstate.getTextureAddress(level);
|
||||
if (!Memory::IsValidAddress(texaddr)) {
|
||||
@ -1014,7 +1014,7 @@ void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry, bool replaceImage
|
||||
maxLevel = 0;
|
||||
}
|
||||
|
||||
if (gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST) {
|
||||
if (IsFakeMipmapChange()) {
|
||||
u8 level = (gstate.texlevel >> 20) & 0xF;
|
||||
LoadTextureLevel(*entry, replaced, level, maxLevel, replaceImages, scaleFactor, dstFmt);
|
||||
} else
|
||||
@ -1102,7 +1102,7 @@ void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &re
|
||||
int h = gstate.getTextureHeight(level);
|
||||
|
||||
LPDIRECT3DTEXTURE9 &texture = DxTex(&entry);
|
||||
if ((level == 0 || gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST) && (!replaceImages || texture == nullptr)) {
|
||||
if ((level == 0 || IsFakeMipmapChange()) && (!replaceImages || texture == nullptr)) {
|
||||
// Create texture
|
||||
D3DPOOL pool = D3DPOOL_MANAGED;
|
||||
int usage = 0;
|
||||
@ -1123,7 +1123,7 @@ void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &re
|
||||
}
|
||||
}
|
||||
HRESULT hr;
|
||||
if (gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST)
|
||||
if (IsFakeMipmapChange())
|
||||
hr = pD3Ddevice->CreateTexture(tw, th, 1, usage, tfmt, pool, &texture, NULL);
|
||||
else
|
||||
hr = pD3Ddevice->CreateTexture(tw, th, levels, usage, tfmt, pool, &texture, NULL);
|
||||
@ -1135,7 +1135,7 @@ void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &re
|
||||
}
|
||||
|
||||
D3DLOCKED_RECT rect;
|
||||
if (gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST)
|
||||
if (IsFakeMipmapChange())
|
||||
texture->LockRect(0, &rect, NULL, 0);
|
||||
else
|
||||
texture->LockRect(level, &rect, NULL, 0);
|
||||
@ -1205,7 +1205,7 @@ void TextureCacheDX9::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &re
|
||||
}
|
||||
}
|
||||
|
||||
if (gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST)
|
||||
if (IsFakeMipmapChange())
|
||||
texture->UnlockRect(0);
|
||||
else
|
||||
texture->UnlockRect(level);
|
||||
|
@ -687,7 +687,7 @@ void TextureCacheGLES::SetTexture(bool force) {
|
||||
}
|
||||
|
||||
u8 level = 0;
|
||||
if (gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST)
|
||||
if (IsFakeMipmapChange())
|
||||
level = (gstate.texlevel >> 20) & 0xF;
|
||||
u32 texaddr = gstate.getTextureAddress(level);
|
||||
if (!Memory::IsValidAddress(texaddr)) {
|
||||
@ -1058,7 +1058,7 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry, bool replaceImag
|
||||
// be as good quality as the game's own (might even be better in some cases though).
|
||||
|
||||
// Always load base level texture here
|
||||
if (gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST) {
|
||||
if (IsFakeMipmapChange()) {
|
||||
u8 level = (gstate.texlevel >> 20) & 0xF;
|
||||
LoadTextureLevel(*entry, replaced, level, replaceImages, scaleFactor, dstFmt);
|
||||
} else
|
||||
@ -1278,7 +1278,7 @@ void TextureCacheGLES::LoadTextureLevel(TexCacheEntry &entry, ReplacedTexture &r
|
||||
glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, w, h, components2, dstFmt, pixelData);
|
||||
} else {
|
||||
PROFILE_THIS_SCOPE("loadtex");
|
||||
if (gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST)
|
||||
if (IsFakeMipmapChange())
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, components, w, h, 0, components2, dstFmt, pixelData);
|
||||
else
|
||||
glTexImage2D(GL_TEXTURE_2D, level, components, w, h, 0, components2, dstFmt, pixelData);
|
||||
|
@ -624,7 +624,7 @@ void TextureCacheVulkan::SetTexture() {
|
||||
#endif
|
||||
|
||||
u8 level = 0;
|
||||
if (gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST)
|
||||
if (IsFakeMipmapChange())
|
||||
level = (gstate.texlevel >> 20) & 0xF;
|
||||
u32 texaddr = gstate.getTextureAddress(level);
|
||||
if (!Memory::IsValidAddress(texaddr)) {
|
||||
@ -1086,7 +1086,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry, VulkanPushBuff
|
||||
|
||||
if (entry->vkTex) {
|
||||
u8 level = (gstate.texlevel >> 20) & 0xF;
|
||||
bool fakeMipmap = gstate.getTexLevelMode() == GE_TEXLEVEL_MODE_CONST && level > 0;
|
||||
bool fakeMipmap = IsFakeMipmapChange() && level > 0;
|
||||
// Upload the texture data.
|
||||
for (int i = 0; i <= maxLevel; i++) {
|
||||
int mipWidth = gstate.getTextureWidth(i) * scaleFactor;
|
||||
|
@ -153,3 +153,12 @@ ULKS46183 = true
|
||||
ULJS00260 = true
|
||||
ULJS19041 = true
|
||||
NPJH50843 = true
|
||||
|
||||
[FakeMipmapChange]
|
||||
# This hacks separates each mipmap to independent textures to display wrong-size mipmaps.
|
||||
# For example this requires games like Tactics Ogre(Japanese) to display multi bytes fonts stored in mipmaps.
|
||||
# See issue #5350.
|
||||
# Tactics Ogre(Japanese)
|
||||
ULJM05753 = true
|
||||
NPJH50348 = true
|
||||
ULJM06009 = true
|
||||
|
Loading…
Reference in New Issue
Block a user