From f5ea953e95d6744cfab21d4248885b4e61c20260 Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 1 Aug 2014 20:24:42 +0200 Subject: [PATCH] plugin-sdk compatibility fix --- SilentPatch/dllmain.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/SilentPatch/dllmain.cpp b/SilentPatch/dllmain.cpp index 8052f19..d172831 100644 --- a/SilentPatch/dllmain.cpp +++ b/SilentPatch/dllmain.cpp @@ -1711,11 +1711,14 @@ WRAPPER RwBool _rpD3D9VertexDeclarationInstColor(RwUInt8 *mem, WRAPPER bool IsVisionFXActive() { EAXJMP(0x7034F0); } +static BOOL (*IsAlreadyRunning)(); +static void (*TheScriptsLoad)(); +static bool (*InitialiseRenderWare)(); + bool ShaderAttach() { // CGame::InitialiseRenderWare - // TODO: EXEs - if ( ((bool(*)())0x5BD600)() ) + if ( InitialiseRenderWare() ) { RwD3D9CreateVertexShader(reinterpret_cast(g_vs20_NVC_vertex_shader), reinterpret_cast(&pNVCShader)); return true; @@ -2001,9 +2004,6 @@ void __declspec(naked) LightMaterialsFix() } } -static BOOL (*IsAlreadyRunning)(); -static void (*TheScriptsLoad)(); - static unsigned char* ScriptSpace = *(unsigned char**)0x5D5380; static int* ScriptParams = *(int**)0x48995B; @@ -2132,6 +2132,9 @@ BOOL InjectDelayedPatches_10() if ( !bSAMP && GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", TRUE, wcModulePath) != FALSE ) { // Shaders! + // plugin-sdk compatibility + InitialiseRenderWare = (bool(*)())(*(int*)0x5BF3A2 + 0x5BF3A1 + 5); + InjectHook(0x5DA743, SetShader); InjectHook(0x5D66F1, SetShader2); InjectHook(0x5D6116, UsageIndex1, PATCH_JUMP);