mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 05:22:32 +01:00
III/VC/SA: Disable alpha test for stored shadows too
This commit is contained in:
parent
86f1c60267
commit
2be613a75b
@ -56,6 +56,18 @@ namespace StaticShadowAlphaFix
|
||||
|
||||
RwD3D8SetRenderState( 15, alphaTestVal );
|
||||
}
|
||||
|
||||
static void (*orgRenderStoredShadows)();
|
||||
static void RenderStoredShadows_StateFix()
|
||||
{
|
||||
RwUInt32 alphaTestVal = 0;
|
||||
RwD3D8GetRenderState( 15, &alphaTestVal ); // D3DRS_ALPHATESTENABLE
|
||||
|
||||
RwD3D8SetRenderState( 15, FALSE );
|
||||
orgRenderStoredShadows();
|
||||
|
||||
RwD3D8SetRenderState( 15, alphaTestVal );
|
||||
}
|
||||
};
|
||||
|
||||
// ============= Delayed patches =============
|
||||
@ -147,16 +159,19 @@ namespace Common {
|
||||
{
|
||||
using namespace StaticShadowAlphaFix;
|
||||
|
||||
// TODO: Offset for III
|
||||
#if _GTA_III
|
||||
constexpr ptrdiff_t offset = 0xF;
|
||||
#elif _GTA_VC
|
||||
constexpr ptrdiff_t offset = 0x14;
|
||||
#endif
|
||||
|
||||
void* renderStaticShadows = ReadCallFrom( get_pattern( "E8 ? ? ? ? A1 ? ? ? ? 85 C0 74 05" ), offset );
|
||||
uintptr_t renderStaticShadows = reinterpret_cast<uintptr_t>(ReadCallFrom( get_pattern( "E8 ? ? ? ? A1 ? ? ? ? 85 C0 74 05" ), offset ));
|
||||
ReadCall( renderStaticShadows, orgRenderStaticShadows );
|
||||
InjectHook( renderStaticShadows, RenderStaticShadows_StateFix );
|
||||
|
||||
renderStaticShadows += 5;
|
||||
ReadCall( renderStaticShadows, orgRenderStoredShadows );
|
||||
InjectHook( renderStaticShadows, RenderStoredShadows_StateFix );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1627,6 +1627,15 @@ namespace StaticShadowAlphaFix
|
||||
RwRenderStateSet( rwRENDERSTATEALPHATESTFUNCTION, (void*)rwALPHATESTFUNCTIONALWAYS );
|
||||
orgRenderStaticShadows();
|
||||
}
|
||||
|
||||
static void (*orgRenderStoredShadows)();
|
||||
static void RenderStoredShadows_StateFix()
|
||||
{
|
||||
RwScopedRenderState state(rwRENDERSTATEALPHATESTFUNCTION);
|
||||
|
||||
RwRenderStateSet( rwRENDERSTATEALPHATESTFUNCTION, (void*)rwALPHATESTFUNCTIONALWAYS );
|
||||
orgRenderStoredShadows();
|
||||
}
|
||||
};
|
||||
|
||||
// ============= LS-RP Mode stuff =============
|
||||
@ -4210,6 +4219,9 @@ void Patch_SA_10()
|
||||
|
||||
ReadCall( 0x53E0C3, orgRenderStaticShadows );
|
||||
InjectHook( 0x53E0C3, RenderStaticShadows_StateFix );
|
||||
|
||||
ReadCall( 0x53E0C8, orgRenderStoredShadows );
|
||||
InjectHook( 0x53E0C8, RenderStoredShadows_StateFix );
|
||||
}
|
||||
|
||||
#if FULL_PRECISION_D3D
|
||||
@ -5647,9 +5659,12 @@ void Patch_SA_NewBinaries_Common()
|
||||
{
|
||||
using namespace StaticShadowAlphaFix;
|
||||
|
||||
auto renderStaticShadows = get_pattern( "52 E8 ? ? ? ? E8 ? ? ? ? E8", 1 + 5 + 5 );
|
||||
ReadCall( renderStaticShadows, orgRenderStaticShadows );
|
||||
InjectHook( renderStaticShadows, RenderStaticShadows_StateFix );
|
||||
auto renderStaticShadows = pattern( "52 E8 ? ? ? ? E8 ? ? ? ? E8" ).get_one();
|
||||
ReadCall( renderStaticShadows.get<void>( 1 + 5 + 5 ), orgRenderStaticShadows );
|
||||
InjectHook( renderStaticShadows.get<void>( 1 + 5 + 5 ), RenderStaticShadows_StateFix );
|
||||
|
||||
ReadCall( renderStaticShadows.get<void>( 1 + 5 + 5 + 5 ), orgRenderStoredShadows );
|
||||
InjectHook( renderStaticShadows.get<void>( 1 + 5 + 5 + 5 ), RenderStoredShadows_StateFix );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user