mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-22 05:22:32 +01:00
III/VC: Remade static shadow alpha fix properly
Now disables alpha test for these shadows instead of tweaking intensity "until it works"
This commit is contained in:
parent
c9e34d5761
commit
39df8343ca
@ -42,6 +42,22 @@ namespace CoronaLinesFix
|
||||
}
|
||||
}
|
||||
|
||||
// ============= Static shadow alpha fix =============
|
||||
namespace StaticShadowAlphaFix
|
||||
{
|
||||
static void (*orgRenderStaticShadows)();
|
||||
static void RenderStaticShadows_StateFix()
|
||||
{
|
||||
RwUInt32 alphaTestVal = 0;
|
||||
RwD3D8GetRenderState( 15, &alphaTestVal ); // D3DRS_ALPHATESTENABLE
|
||||
|
||||
RwD3D8SetRenderState( 15, FALSE );
|
||||
orgRenderStaticShadows();
|
||||
|
||||
RwD3D8SetRenderState( 15, alphaTestVal );
|
||||
}
|
||||
};
|
||||
|
||||
// ============= Delayed patches =============
|
||||
namespace DelayedPatches
|
||||
{
|
||||
@ -126,6 +142,22 @@ namespace Common {
|
||||
InjectHook( renderLine, RenderLine_SetRecipZ );
|
||||
}
|
||||
|
||||
|
||||
// Fixed static shadows not rendering under fire and pickups
|
||||
{
|
||||
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 );
|
||||
ReadCall( renderStaticShadows, orgRenderStaticShadows );
|
||||
InjectHook( renderStaticShadows, RenderStaticShadows_StateFix );
|
||||
}
|
||||
}
|
||||
|
||||
void III_VC_SetDelayedPatchesFunc( void(*func)() )
|
||||
|
@ -35,6 +35,16 @@ void** GTARwEngineInstance = []() -> void** {
|
||||
return nullptr;
|
||||
}();
|
||||
|
||||
static void* varRwD3D8SetRenderState = Memory::ReadCallFrom( hook::get_pattern( "0F 8C ? ? ? ? 6A 05 6A 19", 10 ) );
|
||||
WRAPPER RwBool RwD3D8SetRenderState(RwUInt32 state, RwUInt32 value) { VARJMP(varRwD3D8SetRenderState); }
|
||||
|
||||
static RwUInt32* _rwD3D8RenderStates = *static_cast<RwUInt32**>(Memory::ReadCallFrom( hook::get_pattern( "0F 8C ? ? ? ? 6A 05 6A 19", 10 ), 8 + 3 ));
|
||||
void RwD3D8GetRenderState(RwUInt32 state, void* value)
|
||||
{
|
||||
RwUInt32* valuePtr = static_cast<RwUInt32*>(value);
|
||||
*valuePtr = _rwD3D8RenderStates[ 2 * state ];
|
||||
}
|
||||
|
||||
|
||||
RwBool RwIm2DRenderLine(RwIm2DVertex *vertices, RwInt32 numVertices, RwInt32 vert1, RwInt32 vert2)
|
||||
{
|
||||
|
@ -551,13 +551,6 @@ void Patch_III_10(const RECT& desktop)
|
||||
|
||||
Patch<BYTE>(0x490F83, 1);
|
||||
|
||||
Patch<BYTE>(0x43177D, 16);
|
||||
Patch<BYTE>(0x431DBB, 16);
|
||||
Patch<BYTE>(0x432083, 16);
|
||||
Patch<BYTE>(0x432303, 16);
|
||||
Patch<BYTE>(0x479C9A, 16);
|
||||
Patch<BYTE>(0x4FAD35, 16);
|
||||
|
||||
Patch<WORD>(0x5382BF, 0x0EEB);
|
||||
InjectHook(0x5382EC, HeadlightsFix, PATCH_JUMP);
|
||||
|
||||
@ -696,13 +689,6 @@ void Patch_III_11(const RECT& desktop)
|
||||
|
||||
Patch<BYTE>(0x491043, 1);
|
||||
|
||||
Patch<BYTE>(0x43177D, 16);
|
||||
Patch<BYTE>(0x431DBB, 16);
|
||||
Patch<BYTE>(0x432083, 16);
|
||||
Patch<BYTE>(0x432303, 16);
|
||||
Patch<BYTE>(0x479C9A, 16);
|
||||
Patch<BYTE>(0x4FAE15, 16);
|
||||
|
||||
Patch<WORD>(0x5384FF, 0x0EEB);
|
||||
InjectHook(0x53852C, HeadlightsFix, PATCH_JUMP);
|
||||
|
||||
@ -820,13 +806,6 @@ void Patch_III_Steam(const RECT& desktop)
|
||||
|
||||
Patch<BYTE>(0x490FD3, 1);
|
||||
|
||||
Patch<BYTE>(0x43177D, 16);
|
||||
Patch<BYTE>(0x431DBB, 16);
|
||||
Patch<BYTE>(0x432083, 16);
|
||||
Patch<BYTE>(0x432303, 16);
|
||||
Patch<BYTE>(0x479C9A, 16);
|
||||
Patch<BYTE>(0x4FADA5, 16);
|
||||
|
||||
InjectHook(0x4A58F0, ShowRadarTrace, PATCH_JUMP);
|
||||
InjectHook(0x4209A7, SetScaleProperly);
|
||||
InjectHook(0x420A1F, SetScaleProperly);
|
||||
|
@ -379,14 +379,6 @@ void Patch_VC_10(const RECT& desktop)
|
||||
RosieAudioFix_JumpBack = (void*)0x42BFFE;
|
||||
SubtitlesShadowFix_JumpBack = (void*)0x551701;
|
||||
|
||||
Patch<BYTE>(0x43E983, 16);
|
||||
Patch<BYTE>(0x43EC03, 16);
|
||||
Patch<BYTE>(0x43EECB, 16);
|
||||
Patch<BYTE>(0x43F52B, 16);
|
||||
Patch<BYTE>(0x43F842, 16);
|
||||
Patch<BYTE>(0x48EB27, 16);
|
||||
Patch<BYTE>(0x541E7E, 16);
|
||||
|
||||
InjectHook(0x5433BD, FixedRefValue);
|
||||
|
||||
InjectHook(0x42BFF7, RosiesAudioFix, PATCH_JUMP);
|
||||
@ -494,14 +486,6 @@ void Patch_VC_11(const RECT& desktop)
|
||||
RosieAudioFix_JumpBack = (void*)0x42BFFE;
|
||||
SubtitlesShadowFix_JumpBack = (void*)0x551721;
|
||||
|
||||
Patch<BYTE>(0x43E983, 16);
|
||||
Patch<BYTE>(0x43EC03, 16);
|
||||
Patch<BYTE>(0x43EECB, 16);
|
||||
Patch<BYTE>(0x43F52B, 16);
|
||||
Patch<BYTE>(0x43F842, 16);
|
||||
Patch<BYTE>(0x48EB37, 16);
|
||||
Patch<BYTE>(0x541E9E, 16);
|
||||
|
||||
InjectHook(0x5433DD, FixedRefValue);
|
||||
|
||||
InjectHook(0x42BFF7, RosiesAudioFix, PATCH_JUMP);
|
||||
@ -599,14 +583,6 @@ void Patch_VC_Steam(const RECT& desktop)
|
||||
RosieAudioFix_JumpBack = (void*)0x42BFCE;
|
||||
SubtitlesShadowFix_JumpBack = (void*)0x5515F1;
|
||||
|
||||
Patch<BYTE>(0x43E8F3, 16);
|
||||
Patch<BYTE>(0x43EB73, 16);
|
||||
Patch<BYTE>(0x43EE3B, 16);
|
||||
Patch<BYTE>(0x43F49B, 16);
|
||||
Patch<BYTE>(0x43F7B2, 16);
|
||||
Patch<BYTE>(0x48EA37, 16);
|
||||
Patch<BYTE>(0x541D6E, 16);
|
||||
|
||||
InjectHook(0x5432AD, FixedRefValue);
|
||||
|
||||
InjectHook(0x42BFC7, RosiesAudioFix, PATCH_JUMP);
|
||||
|
Loading…
Reference in New Issue
Block a user