mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-12-29 15:23:02 +05:00
Rustler prop fix
Unwoking attempt to fix shader fighting issues Dirt now works properly with ImVehFt
This commit is contained in:
parent
e076a275b1
commit
99ca045bee
3 changed files with 50 additions and 28 deletions
|
@ -1300,18 +1300,30 @@ void __declspec(naked) CacheCRC32()
|
||||||
void __declspec(naked) PlaneAtomicRendererSetup()
|
void __declspec(naked) PlaneAtomicRendererSetup()
|
||||||
{
|
{
|
||||||
static const char aStaticProp[] = "static_prop";
|
static const char aStaticProp[] = "static_prop";
|
||||||
|
static const char aMovingProp[] = "moving_prop";
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
mov eax, [esi+4]
|
mov eax, [esi+4]
|
||||||
push eax
|
push eax
|
||||||
call GetFrameNodeName
|
call GetFrameNodeName
|
||||||
|
//push eax
|
||||||
|
mov [esp+8+8], eax
|
||||||
push 11
|
push 11
|
||||||
push offset aStaticProp
|
push offset aStaticProp
|
||||||
push eax
|
push eax
|
||||||
call strncmp
|
call strncmp
|
||||||
add esp, 10h
|
add esp, 10h
|
||||||
test eax, eax
|
test eax, eax
|
||||||
|
jz PlaneAtomicRendererSetup_Alpha
|
||||||
|
push 11
|
||||||
|
push offset aMovingProp
|
||||||
|
push [esp+12+8]
|
||||||
|
call strncmp
|
||||||
|
add esp, 0Ch
|
||||||
|
test eax, eax
|
||||||
jnz PlaneAtomicRendererSetup_NoAlpha
|
jnz PlaneAtomicRendererSetup_NoAlpha
|
||||||
|
|
||||||
|
PlaneAtomicRendererSetup_Alpha:
|
||||||
push 734370h
|
push 734370h
|
||||||
jmp PlaneAtomicRendererSetup_Return
|
jmp PlaneAtomicRendererSetup_Return
|
||||||
|
|
||||||
|
@ -1723,6 +1735,12 @@ void SetShader(RxD3D9InstanceData* pInstData)
|
||||||
float fEnvVars[2] = { *(float*)0x8D12C0, RpMaterialGetColor(pInstData->material)->alpha * (1.0f/255.0f) };
|
float fEnvVars[2] = { *(float*)0x8D12C0, RpMaterialGetColor(pInstData->material)->alpha * (1.0f/255.0f) };
|
||||||
RwRGBAReal* AmbientLight = RpLightGetColor(*(RpLight**)0xC886E8);
|
RwRGBAReal* AmbientLight = RpLightGetColor(*(RpLight**)0xC886E8);
|
||||||
|
|
||||||
|
// Normalise the balance
|
||||||
|
if ( fEnvVars[0] < 0.0f )
|
||||||
|
fEnvVars[0] = 0.0f;
|
||||||
|
else if ( fEnvVars[0] > 1.0f )
|
||||||
|
fEnvVars[0] = 1.0f;
|
||||||
|
|
||||||
RwD3D9SetVertexShader(pNVCShader);
|
RwD3D9SetVertexShader(pNVCShader);
|
||||||
|
|
||||||
_rwD3D9VSSetActiveWorldMatrix(RwFrameGetLTM(RpAtomicGetFrame(pRenderedAtomic)));
|
_rwD3D9VSSetActiveWorldMatrix(RwFrameGetLTM(RpAtomicGetFrame(pRenderedAtomic)));
|
||||||
|
@ -2168,8 +2186,17 @@ BOOL InjectDelayedPatches_10()
|
||||||
// ImVehFt conflicts
|
// ImVehFt conflicts
|
||||||
if ( GetModuleHandle("ImVehFt.asi") == nullptr )
|
if ( GetModuleHandle("ImVehFt.asi") == nullptr )
|
||||||
{
|
{
|
||||||
|
// Lights
|
||||||
InjectHook(0x4C830C, LightMaterialsFix, PATCH_CALL);
|
InjectHook(0x4C830C, LightMaterialsFix, PATCH_CALL);
|
||||||
|
|
||||||
|
// Flying components
|
||||||
InjectMethodVP(0x59F180, CObject::Render, PATCH_JUMP);
|
InjectMethodVP(0x59F180, CObject::Render, PATCH_JUMP);
|
||||||
|
|
||||||
|
// Cars getting dirty
|
||||||
|
// Only 1.0 and Steam
|
||||||
|
InjectMethodVP(0x4C9648, CVehicleModelInfo::FindEditableMaterialList, PATCH_CALL);
|
||||||
|
Patch<DWORD>(0x4C964D, 0x0FEBCE8B);
|
||||||
|
Patch<DWORD>(0x5D5DC2, 32); // 1.0 ONLY
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -2259,12 +2286,6 @@ __forceinline void Patch_SA_10()
|
||||||
InjectHook(0x5D9B44, DarkVehiclesFix3, PATCH_JUMP);
|
InjectHook(0x5D9B44, DarkVehiclesFix3, PATCH_JUMP);
|
||||||
InjectHook(0x5D9CB2, DarkVehiclesFix4, PATCH_JUMP);
|
InjectHook(0x5D9CB2, DarkVehiclesFix4, PATCH_JUMP);
|
||||||
|
|
||||||
// Cars getting dirty
|
|
||||||
// Only 1.0 and Steam
|
|
||||||
InjectMethodVP(0x4C9648, CVehicleModelInfo::FindEditableMaterialList, PATCH_CALL);
|
|
||||||
Patch<DWORD>(0x4C964D, 0x0FEBCE8B);
|
|
||||||
Patch<DWORD>(0x5D5DC2, 32); // 1.0 ONLY
|
|
||||||
|
|
||||||
// Bindable NUM5
|
// Bindable NUM5
|
||||||
// Only 1.0 and Steam
|
// Only 1.0 and Steam
|
||||||
Nop(0x57DC55, 2);
|
Nop(0x57DC55, 2);
|
||||||
|
|
|
@ -25,7 +25,8 @@ VS_OUTPUT NVC_vertex_shader( in VS_INPUT In )
|
||||||
Out.Texture = In.Texture;
|
Out.Texture = In.Texture;
|
||||||
|
|
||||||
Out.Color.rgb = (In.DayColor.rgb * (1.0-fEnvVars[0]) + In.NightColor.rgb * fEnvVars[0]) + AmbientLight.rgb;
|
Out.Color.rgb = (In.DayColor.rgb * (1.0-fEnvVars[0]) + In.NightColor.rgb * fEnvVars[0]) + AmbientLight.rgb;
|
||||||
Out.Color.a = fEnvVars[1];
|
Out.Color.a = In.DayColor.a * fEnvVars[1];
|
||||||
|
//Out.Color.rgb = In.DayColor.rgb + AmbientLight.rgb;
|
||||||
Out.Color = saturate(Out.Color);
|
Out.Color = saturate(Out.Color);
|
||||||
|
|
||||||
return Out;
|
return Out;
|
||||||
|
|
|
@ -32,14 +32,14 @@
|
||||||
dp4 oPos.y, v0, c1
|
dp4 oPos.y, v0, c1
|
||||||
dp4 oPos.z, v0, c2
|
dp4 oPos.z, v0, c2
|
||||||
dp4 oPos.w, v0, c3
|
dp4 oPos.w, v0, c3
|
||||||
mov r0.xy, c6
|
mov r0.x, c6.x
|
||||||
add r0.x, r0.x, -c4.x
|
add r0.x, r0.x, -c4.x
|
||||||
mul r1.xyz, v2, c4.x
|
mul r0.yzw, v2.xxyz, c4.x
|
||||||
mad r0.xzw, v3.xyyz, r0.x, r1.xyyz
|
mad r0.xyz, v3, r0.x, r0.yzww
|
||||||
add r0.xzw, r0, c5.xyyz
|
add r0.xyz, r0, c5
|
||||||
max r1.xyz, r0.xzww, c6.y
|
mul r0.w, v3.w, c4.y
|
||||||
max r1.w, r0.y, c4.y
|
max r0, r0, c6.y
|
||||||
min oD0, r1, c6.x
|
min oD0, r0, c6.x
|
||||||
mov oT0.xy, v1
|
mov oT0.xy, v1
|
||||||
|
|
||||||
// approximately 13 instruction slots used
|
// approximately 13 instruction slots used
|
||||||
|
@ -112,26 +112,26 @@ const BYTE g_vs20_NVC_vertex_shader[] =
|
||||||
0, 0, 8, 192, 0, 0,
|
0, 0, 8, 192, 0, 0,
|
||||||
228, 144, 3, 0, 228, 160,
|
228, 144, 3, 0, 228, 160,
|
||||||
1, 0, 0, 2, 0, 0,
|
1, 0, 0, 2, 0, 0,
|
||||||
3, 128, 6, 0, 228, 160,
|
1, 128, 6, 0, 0, 160,
|
||||||
2, 0, 0, 3, 0, 0,
|
2, 0, 0, 3, 0, 0,
|
||||||
1, 128, 0, 0, 0, 128,
|
1, 128, 0, 0, 0, 128,
|
||||||
4, 0, 0, 161, 5, 0,
|
4, 0, 0, 161, 5, 0,
|
||||||
0, 3, 1, 0, 7, 128,
|
0, 3, 0, 0, 14, 128,
|
||||||
2, 0, 228, 144, 4, 0,
|
2, 0, 144, 144, 4, 0,
|
||||||
0, 160, 4, 0, 0, 4,
|
0, 160, 4, 0, 0, 4,
|
||||||
0, 0, 13, 128, 3, 0,
|
0, 0, 7, 128, 3, 0,
|
||||||
148, 144, 0, 0, 0, 128,
|
228, 144, 0, 0, 0, 128,
|
||||||
1, 0, 148, 128, 2, 0,
|
0, 0, 249, 128, 2, 0,
|
||||||
0, 3, 0, 0, 13, 128,
|
0, 3, 0, 0, 7, 128,
|
||||||
0, 0, 228, 128, 5, 0,
|
0, 0, 228, 128, 5, 0,
|
||||||
148, 160, 11, 0, 0, 3,
|
228, 160, 5, 0, 0, 3,
|
||||||
1, 0, 7, 128, 0, 0,
|
0, 0, 8, 128, 3, 0,
|
||||||
248, 128, 6, 0, 85, 160,
|
255, 144, 4, 0, 85, 160,
|
||||||
11, 0, 0, 3, 1, 0,
|
11, 0, 0, 3, 0, 0,
|
||||||
8, 128, 0, 0, 85, 128,
|
15, 128, 0, 0, 228, 128,
|
||||||
4, 0, 85, 160, 10, 0,
|
6, 0, 85, 160, 10, 0,
|
||||||
0, 3, 0, 0, 15, 208,
|
0, 3, 0, 0, 15, 208,
|
||||||
1, 0, 228, 128, 6, 0,
|
0, 0, 228, 128, 6, 0,
|
||||||
0, 160, 1, 0, 0, 2,
|
0, 160, 1, 0, 0, 2,
|
||||||
0, 0, 3, 224, 1, 0,
|
0, 0, 3, 224, 1, 0,
|
||||||
228, 144, 255, 255, 0, 0
|
228, 144, 255, 255, 0, 0
|
||||||
|
|
Loading…
Reference in a new issue