mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-02 09:03:37 +00:00
Add support for blend modes, which can't be emulated with shader blender.
Add a hack for blend mode 0x0150 in Tony Hawk 2: Spiderman uses the same blend mode, but has no problems with it.
This commit is contained in:
parent
b18ae00bfd
commit
8cb25b1fed
|
@ -194,6 +194,7 @@ struct Config
|
|||
#define hack_MK64 (1<<18) //Hack for load MK64 HD textures properly.
|
||||
#define hack_RE2 (1<<19) //RE2 hacks.
|
||||
#define hack_ZeldaMonochrome (1<<20) //Hack for Zeldas monochrome effects.
|
||||
#define hack_TonyHawk (1<<21) //Hack for Tony Hawk blend mode.
|
||||
|
||||
extern Config config;
|
||||
|
||||
|
|
|
@ -527,14 +527,6 @@ public:
|
|||
;
|
||||
#endif
|
||||
}
|
||||
|
||||
void write(std::stringstream & shader) const override
|
||||
{
|
||||
if (g_cycleType == G_CYC_2CYCLE)
|
||||
shader << " muxPM[1] = clampedColor; \n";
|
||||
|
||||
ShaderPart::write(shader);
|
||||
}
|
||||
};
|
||||
|
||||
class ShaderBlender2 : public ShaderPart
|
||||
|
|
|
@ -306,12 +306,6 @@ public:
|
|||
|
||||
void update(bool _force) override
|
||||
{
|
||||
if ((gDP.otherMode.l & 0xFFFF0000) == 0x01500000) {
|
||||
uForceBlendCycle1.set(0, _force);
|
||||
uForceBlendCycle2.set(0, _force);
|
||||
return;
|
||||
}
|
||||
|
||||
uBlendMux1.set(gDP.otherMode.c1_m1a,
|
||||
gDP.otherMode.c1_m1b,
|
||||
gDP.otherMode.c1_m2a,
|
||||
|
@ -328,6 +322,31 @@ public:
|
|||
uForceBlendCycle1.set(forceBlend1, _force);
|
||||
const int forceBlend2 = gDP.otherMode.forceBlender;
|
||||
uForceBlendCycle2.set(forceBlend2, _force);
|
||||
|
||||
// Modes, which shader blender can't emulate
|
||||
const u32 mode = _SHIFTR(gDP.otherMode.l, 16, 16);
|
||||
switch (mode) {
|
||||
case 0x0040:
|
||||
// Mia Hamm Soccer
|
||||
// clr_in * a_in + clr_mem * (1-a)
|
||||
// clr_in * a_in + clr_in * (1-a)
|
||||
case 0x0050:
|
||||
// A Bug's Life
|
||||
// clr_in * a_in + clr_mem * (1-a)
|
||||
// clr_in * a_in + clr_mem * (1-a)
|
||||
uForceBlendCycle1.set(0, _force);
|
||||
uForceBlendCycle2.set(0, _force);
|
||||
break;
|
||||
case 0x0150:
|
||||
// Tony Hawk
|
||||
// clr_in * a_in + clr_mem * (1-a)
|
||||
// clr_in * a_fog + clr_mem * (1-a_fog)
|
||||
if ((config.generalEmulation.hacks & hack_TonyHawk) != 0) {
|
||||
uForceBlendCycle1.set(0, _force);
|
||||
uForceBlendCycle2.set(0, _force);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -441,6 +441,36 @@ void _legacySetBlendMode()
|
|||
}
|
||||
}
|
||||
|
||||
bool GraphicsDrawer::_setUnsupportedBlendMode() const
|
||||
{
|
||||
// Modes, which shader blender can't emulate
|
||||
const u32 mode = _SHIFTR(gDP.otherMode.l, 16, 16);
|
||||
switch (mode) {
|
||||
case 0x0040:
|
||||
// Mia Hamm Soccer
|
||||
// clr_in * a_in + clr_mem * (1-a)
|
||||
// clr_in * a_in + clr_in * (1-a)
|
||||
case 0x0050:
|
||||
// A Bug's Life
|
||||
// clr_in * a_in + clr_mem * (1-a)
|
||||
// clr_in * a_in + clr_mem * (1-a)
|
||||
gfxContext.enable(enable::BLEND, true);
|
||||
gfxContext.setBlending(blend::SRC_ALPHA, blend::ONE_MINUS_SRC_ALPHA);
|
||||
return true;
|
||||
case 0x0150:
|
||||
// Tony Hawk
|
||||
// clr_in * a_in + clr_mem * (1-a)
|
||||
// clr_in * a_fog + clr_mem * (1-a_fog)
|
||||
if ((config.generalEmulation.hacks & hack_TonyHawk) != 0) {
|
||||
gfxContext.enable(enable::BLEND, true);
|
||||
gfxContext.setBlending(blend::SRC_ALPHA, blend::ONE_MINUS_SRC_ALPHA);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void GraphicsDrawer::_setBlendMode() const
|
||||
{
|
||||
if (config.generalEmulation.enableLegacyBlending != 0) {
|
||||
|
@ -448,16 +478,8 @@ void GraphicsDrawer::_setBlendMode() const
|
|||
return;
|
||||
}
|
||||
|
||||
if ((gDP.otherMode.l & 0xFFFF0000) == 0x01500000) {
|
||||
// clr_in * a_in + clr_mem * (1-a)
|
||||
// clr_in * a_fog + clr_mem * (1-a)
|
||||
// impossible to emulate
|
||||
if (gDP.otherMode.forceBlender != 0 && gDP.otherMode.cycleType < G_CYC_COPY) {
|
||||
gfxContext.enable(enable::BLEND, true);
|
||||
gfxContext.setBlending(blend::SRC_ALPHA, blend::ONE_MINUS_SRC_ALPHA);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (_setUnsupportedBlendMode())
|
||||
return;
|
||||
|
||||
if (gDP.otherMode.forceBlender != 0 && gDP.otherMode.cycleType < G_CYC_COPY) {
|
||||
BlendParam srcFactor = blend::ONE;
|
||||
|
|
|
@ -169,6 +169,7 @@ private:
|
|||
void _setSpecialTexrect() const;
|
||||
|
||||
void _setBlendMode() const;
|
||||
bool _setUnsupportedBlendMode() const;
|
||||
void _updateCullFace() const;
|
||||
void _updateViewport() const;
|
||||
void _updateScreenCoordsViewport() const;
|
||||
|
|
|
@ -334,6 +334,8 @@ void RSP_Init()
|
|||
else if (strstr(RSP.romname, (const char *)"Resident Evil II") ||
|
||||
strstr(RSP.romname, (const char *)"BioHazard II"))
|
||||
config.generalEmulation.hacks |= hack_RE2 | hack_ModifyVertexXyInShader | hack_LoadDepthTextures;
|
||||
else if (strstr(RSP.romname, (const char *)"THPS") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_TonyHawk;
|
||||
|
||||
api().FindPluginPath(RSP.pluginpath);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user