GS/HW: Move Tekken 5 CRC hack to the GSC

This commit is contained in:
Stenzek 2023-07-30 01:33:43 +10:00 committed by Connor McLaughlin
parent 061ea30199
commit b2dc31ba80
2 changed files with 31 additions and 31 deletions

View File

@ -195,6 +195,36 @@ bool GSHwHack::GSC_Tekken5(GSRendererHW& r, int& skip)
{ {
if (skip == 0) if (skip == 0)
{ {
if (r.IsPossibleChannelShuffle())
{
pxAssertMsg((RTBP0 & 31) == 0, "TEX0 should be page aligned");
GSTextureCache::Target* rt = g_texture_cache->LookupTarget(GIFRegTEX0::Create(RTBP0, RFBW, RFPSM),
GSVector2i(1, 1), r.GetTextureScaleFactor(), GSTextureCache::RenderTarget);
if (!rt)
return false;
GL_INS("GSC_Tekken5(): HLE channel shuffle");
// have to set up the palette ourselves too, since GSC executes before it does
r.m_mem.m_clut.Read32(RTEX0, r.m_draw_env->TEXA);
std::shared_ptr<GSTextureCache::Palette> palette =
g_texture_cache->LookupPaletteObject(r.m_mem.m_clut, GSLocalMemory::m_psm[RTEX0.PSM].pal, true);
if (!palette)
return false;
GSHWDrawConfig& conf = r.BeginHLEHardwareDraw(
rt->GetTexture(), nullptr, rt->GetScale(), rt->GetTexture(), rt->GetScale(), rt->GetUnscaledRect());
conf.pal = palette->GetPaletteGSTexture();
conf.ps.channel = ChannelFetch_RGB;
conf.colormask.wa = false;
r.EndHLEHardwareDraw(false);
// 12 pages: 2 calls by channel, 3 channels, 1 blit
skip = 12 * (3 + 3 + 1);
return true;
}
if (!s_nativeres && RTME && (RFBP == 0x02d60 || RFBP == 0x02d80 || RFBP == 0x02ea0 || RFBP == 0x03620 || RFBP == 0x03640) && RFPSM == RTPSM && RTBP0 == 0x00000 && RTPSM == PSMCT32) if (!s_nativeres && RTME && (RFBP == 0x02d60 || RFBP == 0x02d80 || RFBP == 0x02ea0 || RFBP == 0x03620 || RFBP == 0x03640) && RFPSM == RTPSM && RTBP0 == 0x00000 && RTPSM == PSMCT32)
{ {
// Don't enable hack on native res if crc is below aggressive. // Don't enable hack on native res if crc is below aggressive.

View File

@ -3137,37 +3137,7 @@ bool GSRendererHW::TestChannelShuffle(GSTextureCache::Target* src)
__ri bool GSRendererHW::EmulateChannelShuffle(GSTextureCache::Target* src, bool test_only) __ri bool GSRendererHW::EmulateChannelShuffle(GSTextureCache::Target* src, bool test_only)
{ {
// First let's check we really have a channel shuffle effect if ((src->m_texture->GetType() == GSTexture::Type::DepthStencil) && !src->m_32_bits_fmt)
if (m_game.title == CRC::Tekken5)
{
if (m_cached_ctx.FRAME.FBW == 1)
{
// Used in stages: Secret Garden, Acid Rain, Moonlit Wilderness
GL_INS("Tekken5 RGB Channel");
if (test_only)
{
pxAssertMsg((m_context->TEX0.TBP0 & 31) == 0, "TEX0 should be page aligned");
m_cached_ctx.FRAME.FBP = m_context->TEX0.TBP0 >> 5;
return true;
}
m_conf.ps.channel = ChannelFetch_RGB;
m_cached_ctx.FRAME.FBMSK = 0xFF000000;
// 12 pages: 2 calls by channel, 3 channels, 1 blit
// Minus current draw call
m_skip = 12 * (3 + 3 + 1) - 1;
}
else
{
// Could skip model drawing if wrongly detected
if (test_only)
return false;
m_channel_shuffle = false;
return false;
}
}
else if ((src->m_texture->GetType() == GSTexture::Type::DepthStencil) && !src->m_32_bits_fmt)
{ {
// So far 2 games hit this code path. Urban Chaos and Tales of Abyss // So far 2 games hit this code path. Urban Chaos and Tales of Abyss
// UC: will copy depth to green channel // UC: will copy depth to green channel