diff --git a/DDraw/DDraw.def b/DDraw/DDraw.def
new file mode 100644
index 0000000..7eb9b71
--- /dev/null
+++ b/DDraw/DDraw.def
@@ -0,0 +1,3 @@
+LIBRARY DDRAW
+EXPORTS
+ DirectDrawCreateEx=_DirectDrawCreateEx@16 @10
\ No newline at end of file
diff --git a/ResSock/ResSock.vcxproj b/DDraw/DDraw.vcxproj
similarity index 97%
rename from ResSock/ResSock.vcxproj
rename to DDraw/DDraw.vcxproj
index b0471eb..fa6f842 100644
--- a/ResSock/ResSock.vcxproj
+++ b/DDraw/DDraw.vcxproj
@@ -9,6 +9,7 @@
{B695EC1B-7258-426A-81CF-9323C016ACFB}
ResSock
+ DDraw
@@ -54,7 +55,7 @@
5.0
DllMain@12
ntdllp.lib;shlwapi.lib;%(AdditionalDependencies)
- ResSock.def
+ DDraw.def
copy /y "$(TargetPath)" "D:\gry\Steam\steamapps\common\Grand Theft Auto Vice City\ddraw.dll"
diff --git a/ResSock/ResSock.vcxproj.filters b/DDraw/DDraw.vcxproj.filters
similarity index 100%
rename from ResSock/ResSock.vcxproj.filters
rename to DDraw/DDraw.vcxproj.filters
diff --git a/ResSock/dllmain.cpp b/DDraw/dllmain.cpp
similarity index 91%
rename from ResSock/dllmain.cpp
rename to DDraw/dllmain.cpp
index 2146b0f..236b1fd 100644
--- a/ResSock/dllmain.cpp
+++ b/DDraw/dllmain.cpp
@@ -196,15 +196,23 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
InjectHook(0x601A40, GetMyDocumentsPath, PATCH_CALL);
InjectHook(0x601A45, 0x601B2F, PATCH_JUMP);
}
- else if (*(DWORD*)0x667C40 == 0x53E58955)
+ else if (*(DWORD*)0x667C45 == 0xB85548EC)
{
// VC 1.1
+ ppUserFilesDir = (char**)0x60228A;
+ InjectHook(0x602220, GetMyDocumentsPath, PATCH_JUMP);
+ InjectHook(0x601A70, GetMyDocumentsPath, PATCH_CALL);
+ InjectHook(0x601A75, 0x601B5F, PATCH_JUMP);
}
- else if (*(DWORD*)0x666BA0 == 0x53E58955)
+ else if (*(DWORD*)0x666BA5 == 0xB85548EC)
{
// VC Steam
+ ppUserFilesDir = (char**)0x601ECA;
+ InjectHook(0x601E60, GetMyDocumentsPath, PATCH_JUMP);
+ InjectHook(0x6016B0, GetMyDocumentsPath, PATCH_CALL);
+ InjectHook(0x6016B5, 0x60179F, PATCH_JUMP);
}
}
diff --git a/ResSock/ntdllp.lib b/DDraw/ntdllp.lib
similarity index 100%
rename from ResSock/ntdllp.lib
rename to DDraw/ntdllp.lib
diff --git a/ResSock/ResSock.def b/ResSock/ResSock.def
deleted file mode 100644
index ef1f607..0000000
--- a/ResSock/ResSock.def
+++ /dev/null
@@ -1,3 +0,0 @@
-LIBRARY DDRAW
-EXPORTS
- DirectDrawCreateEx=_DirectDrawCreateEx@16
\ No newline at end of file
diff --git a/SilentPatch.sln b/SilentPatch.sln
index 83c8923..1369aa0 100644
--- a/SilentPatch.sln
+++ b/SilentPatch.sln
@@ -1,13 +1,13 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IIIFix", "IIIFix\IIIFix.vcxproj", "{652975D8-60B0-48E4-A973-4F10BA54FFCB}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DDraw", "DDraw\DDraw.vcxproj", "{B695EC1B-7258-426A-81CF-9323C016ACFB}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VCFix", "VCFix\VCFix.vcxproj", "{374D4CB4-548A-4DA0-AB68-8EA356424626}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SilentPatchIII", "SilentPatchIII\SilentPatchIII.vcxproj", "{652975D8-60B0-48E4-A973-4F10BA54FFCB}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SAFix", "SAFix\SAFix.vcxproj", "{D3E18BC0-A120-451D-A16A-F77072625D66}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SilentPatchSA", "SilentPatchSA\SilentPatchSA.vcxproj", "{D3E18BC0-A120-451D-A16A-F77072625D66}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ResSock", "ResSock\ResSock.vcxproj", "{B695EC1B-7258-426A-81CF-9323C016ACFB}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SilentPatchVC", "SilentPatchVC\SilentPatchVC.vcxproj", "{374D4CB4-548A-4DA0-AB68-8EA356424626}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,21 +15,22 @@ Global
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {B695EC1B-7258-426A-81CF-9323C016ACFB}.Debug|Win32.ActiveCfg = Release|Win32
+ {B695EC1B-7258-426A-81CF-9323C016ACFB}.Debug|Win32.Build.0 = Release|Win32
+ {B695EC1B-7258-426A-81CF-9323C016ACFB}.Release|Win32.ActiveCfg = Release|Win32
+ {B695EC1B-7258-426A-81CF-9323C016ACFB}.Release|Win32.Build.0 = Release|Win32
{652975D8-60B0-48E4-A973-4F10BA54FFCB}.Debug|Win32.ActiveCfg = Debug|Win32
{652975D8-60B0-48E4-A973-4F10BA54FFCB}.Debug|Win32.Build.0 = Debug|Win32
{652975D8-60B0-48E4-A973-4F10BA54FFCB}.Release|Win32.ActiveCfg = Release|Win32
{652975D8-60B0-48E4-A973-4F10BA54FFCB}.Release|Win32.Build.0 = Release|Win32
- {374D4CB4-548A-4DA0-AB68-8EA356424626}.Debug|Win32.ActiveCfg = Debug|Win32
- {374D4CB4-548A-4DA0-AB68-8EA356424626}.Debug|Win32.Build.0 = Debug|Win32
- {374D4CB4-548A-4DA0-AB68-8EA356424626}.Release|Win32.ActiveCfg = Release|Win32
- {374D4CB4-548A-4DA0-AB68-8EA356424626}.Release|Win32.Build.0 = Release|Win32
{D3E18BC0-A120-451D-A16A-F77072625D66}.Debug|Win32.ActiveCfg = Debug|Win32
{D3E18BC0-A120-451D-A16A-F77072625D66}.Debug|Win32.Build.0 = Debug|Win32
{D3E18BC0-A120-451D-A16A-F77072625D66}.Release|Win32.ActiveCfg = Release|Win32
{D3E18BC0-A120-451D-A16A-F77072625D66}.Release|Win32.Build.0 = Release|Win32
- {B695EC1B-7258-426A-81CF-9323C016ACFB}.Debug|Win32.ActiveCfg = Release|Win32
- {B695EC1B-7258-426A-81CF-9323C016ACFB}.Release|Win32.ActiveCfg = Release|Win32
- {B695EC1B-7258-426A-81CF-9323C016ACFB}.Release|Win32.Build.0 = Release|Win32
+ {374D4CB4-548A-4DA0-AB68-8EA356424626}.Debug|Win32.ActiveCfg = Debug|Win32
+ {374D4CB4-548A-4DA0-AB68-8EA356424626}.Debug|Win32.Build.0 = Debug|Win32
+ {374D4CB4-548A-4DA0-AB68-8EA356424626}.Release|Win32.ActiveCfg = Release|Win32
+ {374D4CB4-548A-4DA0-AB68-8EA356424626}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/IIIFix/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp
similarity index 100%
rename from IIIFix/SilentPatchIII.cpp
rename to SilentPatchIII/SilentPatchIII.cpp
diff --git a/IIIFix/IIIFix.vcxproj b/SilentPatchIII/SilentPatchIII.vcxproj
similarity index 96%
rename from IIIFix/IIIFix.vcxproj
rename to SilentPatchIII/SilentPatchIII.vcxproj
index 1a18626..1716fc9 100644
--- a/IIIFix/IIIFix.vcxproj
+++ b/SilentPatchIII/SilentPatchIII.vcxproj
@@ -30,6 +30,7 @@
{652975D8-60B0-48E4-A973-4F10BA54FFCB}
IIIFix
+ SilentPatchIII
@@ -56,9 +57,11 @@
.asi
+ SilentPatchIII
.asi
+ SilentPatchIII
@@ -100,7 +103,7 @@
StdAfx.h
- true
+ false
true
true
false
diff --git a/IIIFix/IIIFix.vcxproj.filters b/SilentPatchIII/SilentPatchIII.vcxproj.filters
similarity index 100%
rename from IIIFix/IIIFix.vcxproj.filters
rename to SilentPatchIII/SilentPatchIII.vcxproj.filters
diff --git a/IIIFix/StdAfxIII.cpp b/SilentPatchIII/StdAfxIII.cpp
similarity index 100%
rename from IIIFix/StdAfxIII.cpp
rename to SilentPatchIII/StdAfxIII.cpp
diff --git a/SAFix/AudioHardwareSA.cpp b/SilentPatchSA/AudioHardwareSA.cpp
similarity index 100%
rename from SAFix/AudioHardwareSA.cpp
rename to SilentPatchSA/AudioHardwareSA.cpp
diff --git a/SAFix/AudioHardwareSA.h b/SilentPatchSA/AudioHardwareSA.h
similarity index 100%
rename from SAFix/AudioHardwareSA.h
rename to SilentPatchSA/AudioHardwareSA.h
diff --git a/SAFix/GeneralSA.cpp b/SilentPatchSA/GeneralSA.cpp
similarity index 100%
rename from SAFix/GeneralSA.cpp
rename to SilentPatchSA/GeneralSA.cpp
diff --git a/SAFix/GeneralSA.h b/SilentPatchSA/GeneralSA.h
similarity index 100%
rename from SAFix/GeneralSA.h
rename to SilentPatchSA/GeneralSA.h
diff --git a/SAFix/LinkListSA.h b/SilentPatchSA/LinkListSA.h
similarity index 100%
rename from SAFix/LinkListSA.h
rename to SilentPatchSA/LinkListSA.h
diff --git a/SAFix/Maths.h b/SilentPatchSA/Maths.h
similarity index 100%
rename from SAFix/Maths.h
rename to SilentPatchSA/Maths.h
diff --git a/SAFix/ModelInfoSA.cpp b/SilentPatchSA/ModelInfoSA.cpp
similarity index 100%
rename from SAFix/ModelInfoSA.cpp
rename to SilentPatchSA/ModelInfoSA.cpp
diff --git a/SAFix/ModelInfoSA.h b/SilentPatchSA/ModelInfoSA.h
similarity index 100%
rename from SAFix/ModelInfoSA.h
rename to SilentPatchSA/ModelInfoSA.h
diff --git a/SAFix/PNGFile.cpp b/SilentPatchSA/PNGFile.cpp
similarity index 100%
rename from SAFix/PNGFile.cpp
rename to SilentPatchSA/PNGFile.cpp
diff --git a/SAFix/PNGFile.h b/SilentPatchSA/PNGFile.h
similarity index 100%
rename from SAFix/PNGFile.h
rename to SilentPatchSA/PNGFile.h
diff --git a/SAFix/PedSA.cpp b/SilentPatchSA/PedSA.cpp
similarity index 100%
rename from SAFix/PedSA.cpp
rename to SilentPatchSA/PedSA.cpp
diff --git a/SAFix/PedSA.h b/SilentPatchSA/PedSA.h
similarity index 100%
rename from SAFix/PedSA.h
rename to SilentPatchSA/PedSA.h
diff --git a/SAFix/ScriptSA.cpp b/SilentPatchSA/ScriptSA.cpp
similarity index 100%
rename from SAFix/ScriptSA.cpp
rename to SilentPatchSA/ScriptSA.cpp
diff --git a/SAFix/ScriptSA.h b/SilentPatchSA/ScriptSA.h
similarity index 100%
rename from SAFix/ScriptSA.h
rename to SilentPatchSA/ScriptSA.h
diff --git a/SAFix/Shaders.rc b/SilentPatchSA/Shaders.rc
similarity index 96%
rename from SAFix/Shaders.rc
rename to SilentPatchSA/Shaders.rc
index 7de812c..f308f40 100644
--- a/SAFix/Shaders.rc
+++ b/SilentPatchSA/Shaders.rc
@@ -1,4 +1,4 @@
-#include "resource.h"
-
-IDR_NVCSHADER RCDATA "..\\SilentPatch\\nvc.cso"
-IDR_LUNAR64 RCDATA "lunar64.png"
+#include "resource.h"
+
+IDR_NVCSHADER RCDATA "..\\SilentPatch\\nvc.cso"
+IDR_LUNAR64 RCDATA "lunar64.png"
diff --git a/SAFix/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp
similarity index 96%
rename from SAFix/SilentPatchSA.cpp
rename to SilentPatchSA/SilentPatchSA.cpp
index 363d54b..9cc8a96 100644
--- a/SAFix/SilentPatchSA.cpp
+++ b/SilentPatchSA/SilentPatchSA.cpp
@@ -1,3207 +1,3207 @@
-#include "StdAfxSA.h"
-#include
-
-#include "ScriptSA.h"
-#include "GeneralSA.h"
-#include "ModelInfoSA.h"
-#include "VehicleSA.h"
-#include "PedSA.h"
-#include "AudioHardwareSA.h"
-#include "LinkListSA.h"
-#include "PNGFile.h"
-
-// RW wrappers
-static void* varAtomicDefaultRenderCallBack = AddressByVersion(0x7491C0, 0x749AD0, 0x783180);
-WRAPPER RpAtomic* AtomicDefaultRenderCallBack(RpAtomic* atomic) { WRAPARG(atomic); VARJMP(varAtomicDefaultRenderCallBack); }
-static void* varRtPNGImageRead = AddressByVersion(0x7CF9B0, 0x7D02B0, 0x809970);
-WRAPPER RwImage* RtPNGImageRead(const RwChar* imageName) { WRAPARG(imageName); VARJMP(varRtPNGImageRead); }
-static void* varRwTextureCreate = AddressByVersion(0x7F37C0, 0x7F40C0, 0x82D780);
-WRAPPER RwTexture* RwTextureCreate(RwRaster* raster) { WRAPARG(raster); VARJMP(varRwTextureCreate); }
-static void* varRwRasterCreate = AddressByVersion(0x7FB230, 0x7FBB30, 0x8351F0);
-WRAPPER RwRaster* RwRasterCreate(RwInt32 width, RwInt32 height, RwInt32 depth, RwInt32 flags) { WRAPARG(width); WRAPARG(height); WRAPARG(depth); WRAPARG(flags); VARJMP(varRwRasterCreate); }
-static void* varRwImageDestroy = AddressByVersion(0x802740, 0x803040, 0x83C700);
-WRAPPER RwBool RwImageDestroy(RwImage* image) { WRAPARG(image); VARJMP(varRwImageDestroy); }
-static void* varRpMaterialSetTexture = AddressByVersion(0x74DBC0, 0x74E4D0, 0x787B80);
-WRAPPER RpMaterial* RpMaterialSetTexture(RpMaterial* material, RwTexture* texture) { VARJMP(varRpMaterialSetTexture); }
-static void* varRwFrameGetLTM = AddressByVersion(0x7F0990, 0x7F1290, 0x82A950);
-WRAPPER RwMatrix* RwFrameGetLTM(RwFrame* frame) { VARJMP(varRwFrameGetLTM); }
-static void* varRwMatrixTranslate = AddressByVersion(0x7F2450, 0x7F2D50, 0x82C410);
-WRAPPER RwMatrix* RwMatrixTranslate(RwMatrix* matrix, const RwV3d* translation, RwOpCombineType combineOp) { WRAPARG(matrix); WRAPARG(translation); WRAPARG(combineOp); VARJMP(varRwMatrixTranslate); }
-static void* varRwMatrixRotate = AddressByVersion(0x7F1FD0, 0x7F28D0, 0x82BF90);
-WRAPPER RwMatrix* RwMatrixRotate(RwMatrix* matrix, const RwV3d* axis, RwReal angle, RwOpCombineType combineOp) { WRAPARG(matrix); WRAPARG(axis); WRAPARG(angle); WRAPARG(combineOp); VARJMP(varRwMatrixRotate); }
-static void* varRwD3D9SetRenderState = AddressByVersion(0x7FC2D0, 0x7FCBD0, 0x836290);
-WRAPPER void RwD3D9SetRenderState(RwUInt32 state, RwUInt32 value) { WRAPARG(state); WRAPARG(value); VARJMP(varRwD3D9SetRenderState); }
-static void* var_rwD3D9SetVertexShader = AddressByVersion(0x7F9FB0, 0x7FA8B0, 0x833F70);
-WRAPPER void _rwD3D9SetVertexShader(void *shader) { VARJMP(var_rwD3D9SetVertexShader); }
-static void* varRwD3D9CreateVertexShader = AddressByVersion(0x7FAC60, 0x7FB560, 0x834C20);
-WRAPPER RwBool RwD3D9CreateVertexShader(const RwUInt32 *function, void **shader) { VARJMP(varRwD3D9CreateVertexShader); }
-static void* varRwD3D9DeleteVertexShader = AddressByVersion(0x7FAC90, 0x7FB590, 0x834C50);
-WRAPPER void RwD3D9DeleteVertexShader(void *shader) { VARJMP(varRwD3D9DeleteVertexShader); }
-static void* var_rwD3D9SetVertexShaderConstant = AddressByVersion(0x7FACA0, 0x7FB5A0, 0x834C60);
-WRAPPER void _rwD3D9SetVertexShaderConstant(RwUInt32 registerAddress,
- const void *constantData,
- RwUInt32 constantCount) { VARJMP(var_rwD3D9SetVertexShaderConstant); }
-static void* var_rpD3D9VertexDeclarationInstColor = AddressByVersion(0x754AE0, 0x7553F0, 0x78EAA0);
-WRAPPER RwBool _rpD3D9VertexDeclarationInstColor(RwUInt8 *mem,
- const RwRGBA *color,
- RwInt32 numVerts,
- RwUInt32 stride) { VARJMP(var_rpD3D9VertexDeclarationInstColor); }
-
-static void* varRwD3D9GetTransform = AddressByVersion(0x7FA4F0, 0x7FADF0, 0x8344B0);
-WRAPPER void _RwD3D9GetTransform(RwUInt32 state, void* matrix) { VARJMP(varRwD3D9GetTransform); }
-
-RwCamera* RwCameraBeginUpdate(RwCamera* camera)
-{
- return camera->beginUpdate(camera);
-}
-
-RwCamera* RwCameraEndUpdate(RwCamera* camera)
-{
- return camera->endUpdate(camera);
-}
-
-RwCamera* RwCameraClear(RwCamera* camera, RwRGBA* colour, RwInt32 clearMode)
-{
- return RWSRCGLOBAL(stdFunc[rwSTANDARDCAMERACLEAR])(camera, colour, clearMode) != FALSE ? camera : NULL;
-}
-
-RwFrame* RwFrameForAllChildren(RwFrame* frame, RwFrameCallBack callBack, void* data)
-{
- for ( RwFrame* curFrame = frame->child; curFrame; curFrame = curFrame->next )
- {
- if ( !callBack(curFrame, data) )
- break;
- }
- return frame;
-}
-
-RwFrame* RwFrameForAllObjects(RwFrame* frame, RwObjectCallBack callBack, void* data)
-{
- for ( RwLLLink* link = rwLinkListGetFirstLLLink(&frame->objectList); link != rwLinkListGetTerminator(&frame->objectList); link = rwLLLinkGetNext(link) )
- {
- if ( !callBack(&rwLLLinkGetData(link, RwObjectHasFrame, lFrame)->object, data) )
- break;
- }
-
- return frame;
-}
-
-RwFrame* RwFrameUpdateObjects(RwFrame* frame)
-{
- if ( !rwObjectTestPrivateFlags(&frame->root->object, rwFRAMEPRIVATEHIERARCHYSYNCLTM|rwFRAMEPRIVATEHIERARCHYSYNCOBJ) )
- rwLinkListAddLLLink(&RWSRCGLOBAL(dirtyFrameList), &frame->root->inDirtyListLink);
-
- rwObjectSetPrivateFlags(&frame->root->object, rwObjectGetPrivateFlags(&frame->root->object) | (rwFRAMEPRIVATEHIERARCHYSYNCLTM|rwFRAMEPRIVATEHIERARCHYSYNCOBJ));
- rwObjectSetPrivateFlags(&frame->object, rwObjectGetPrivateFlags(&frame->object) | (rwFRAMEPRIVATESUBTREESYNCLTM|rwFRAMEPRIVATESUBTREESYNCOBJ));
- return frame;
-}
-
-RwMatrix* RwMatrixUpdate(RwMatrix* matrix)
-{
- matrix->flags &= ~(rwMATRIXTYPEMASK|rwMATRIXINTERNALIDENTITY);
- return matrix;
-}
-
-RwRaster* RwRasterSetFromImage(RwRaster* raster, RwImage* image)
-{
- if ( RWSRCGLOBAL(stdFunc[rwSTANDARDRASTERSETIMAGE])(raster, image, 0) != FALSE )
- {
- if ( image->flags & rwIMAGEGAMMACORRECTED )
- raster->privateFlags |= rwRASTERGAMMACORRECTED;
- return raster;
- }
- return NULL;
-}
-
-RwImage* RwImageFindRasterFormat(RwImage* ipImage, RwInt32 nRasterType, RwInt32* npWidth, RwInt32* npHeight, RwInt32* npDepth, RwInt32* npFormat)
-{
- RwRaster outRaster;
- if ( RWSRCGLOBAL(stdFunc[rwSTANDARDIMAGEFINDRASTERFORMAT])(&outRaster, ipImage, nRasterType) != FALSE )
- {
- *npFormat = RwRasterGetFormat(&outRaster) | outRaster.cType;
- *npWidth = RwRasterGetWidth(&outRaster);
- *npHeight = RwRasterGetHeight(&outRaster);
- *npDepth = RwRasterGetDepth(&outRaster);
- return ipImage;
- }
- return NULL;
-}
-
-RpClump* RpClumpForAllAtomics(RpClump* clump, RpAtomicCallBack callback, void* pData)
-{
- for ( RwLLLink* link = rwLinkListGetFirstLLLink(&clump->atomicList); link != rwLinkListGetTerminator(&clump->atomicList); link = rwLLLinkGetNext(link) )
- {
- if ( !callback(rwLLLinkGetData(link, RpAtomic, inClumpLink), pData) )
- break;
- }
- return clump;
-}
-
-RpClump* RpClumpRender(RpClump* clump)
-{
- RpClump* retClump = clump;
-
- for ( RwLLLink* link = rwLinkListGetFirstLLLink(&clump->atomicList); link != rwLinkListGetTerminator(&clump->atomicList); link = rwLLLinkGetNext(link) )
- {
- RpAtomic* curAtomic = rwLLLinkGetData(link, RpAtomic, inClumpLink);
- if ( RpAtomicGetFlags(curAtomic) & rpATOMICRENDER )
- {
- // Not sure why they need this
- RwFrameGetLTM(RpAtomicGetFrame(curAtomic));
- if ( !RpAtomicRender(curAtomic) )
- retClump = NULL;
- }
- }
- return retClump;
-}
-
-RpGeometry* RpGeometryForAllMaterials(RpGeometry* geometry, RpMaterialCallBack fpCallBack, void* pData)
-{
- for ( RwInt32 i = 0, j = geometry->matList.numMaterials; i < j; i++ )
- {
- if ( !fpCallBack(geometry->matList.materials[i], pData) )
- break;
- }
- return geometry;
-}
-
-RwInt32 RpHAnimIDGetIndex(RpHAnimHierarchy* hierarchy, RwInt32 ID)
-{
- for ( RwInt32 i = 0, j = hierarchy->numNodes; i < j; i++ )
- {
- if ( ID == hierarchy->pNodeInfo[i].nodeID )
- return i;
- }
- return -1;
-}
-
-RwMatrix* RpHAnimHierarchyGetMatrixArray(RpHAnimHierarchy* hierarchy)
-{
- return hierarchy->pMatrixArray;
-}
-
-// Other wrappers
-void (*GTAdelete)(void*) = AddressByVersion(0x82413F, 0x824EFF, 0x85E58C);
-const char* (*GetFrameNodeName)(RwFrame*) = AddressByVersion(0x72FB30, 0x730360, 0x769C20);
-RpHAnimHierarchy* (*GetAnimHierarchyFromSkinClump)(RpClump*) = AddressByVersion(0x734A40, 0x735270, 0x7671B0);
-auto SetVolume = AddressByVersion(0x4D7C60, 0x4D7E60, 0x4E2750);
-auto InitializeUtrax = AddressByVersion(0x4F35B0, 0x4F3A10, 0x4FFA80);
-auto CanSeeOutSideFromCurrArea = AddressByVersion(0x53C4A0, 0x53C940, 0x54E440);
-
-auto __rwD3D9TextureHasAlpha = AddressByVersion(0x4C9EA0, 0x4CA090, 0x4D47E0);
-auto RenderOneXLUSprite = AddressByVersion(0x70D000, 0x70D830, 0x7592C0);
-
-static BOOL (*IsAlreadyRunning)();
-static void (*TheScriptsLoad)();
-static void (*WipeLocalVariableMemoryForMissionScript)();
-static bool (*InitialiseRenderWare)();
-static void (*ShutdownRenderWare)();
-static void (*DoSunAndMoon)();
-static void (*sub_5DA6A0)(void*, void*, void*, void*);
-
-
-// SA variables
-void** rwengine = *AddressByVersion(0x58FFC0, 0x53F032, 0x48C194);
-signed int& ms_extraVertColourPluginOffset = **AddressByVersion(0x5D6362, 0x5D6B42, 0x5F2B65);
-
-unsigned char& nGameClockDays = **AddressByVersion(0x4E841D, 0x4E886D, 0x4F3871);
-unsigned char& nGameClockMonths = **AddressByVersion(0x4E842D, 0x4E887D, 0x4F3861);
-void*& pUserTracksStuff = **AddressByVersion(0x4D9B7B, 0x4DA06C, 0x4E4A43);
-bool& CCutsceneMgr__ms_running = **AddressByVersion(0x53F92D, 0x434241, 0x422061);
-unsigned char* ScriptSpace = *AddressByVersion(0x5D5380, 0x5D5B60, 0x450E34);
-int* ScriptParams = *AddressByVersion(0x48995B, 0x46410A, 0x46979A);
-
-float& fFarClipZ = **AddressByVersion(0x70D21F, 0x70DA4F, 0x421AB2);
-RwTexture** const gpCoronaTexture = *AddressByVersion(0x6FAA8C, 0x6FB2BC, 0x5480BF);
-int& MoonSize = **AddressByVersion(0x713B0C, 0x71433C, 0x72F0AB);
-
-CZoneInfo*& pCurrZoneInfo = **AddressByVersion(0x58ADB1, 0x58B581, 0x407F93);
-CRGBA* HudColour = *AddressByVersion(0x58ADF6, 0x58B5C6, 0x440648);
-unsigned char* ZonesVisited = *AddressByVersion(0x57216A, 0, 0x5870E8) - 9; // 1.01 fixed it!
-
-float& m_fDNBalanceParam = **AddressByVersion(0x4A9062, 0x4A90F2, 0x4B2512);
-RpLight*& pAmbient = **AddressByVersion(0x5BA53A, 0x735D11, 0x5D90F0);
-
-CLinkListSA& ms_weaponPedsForPC = **AddressByVersion**>(0x53EACA, 0x53EF6A, 0x551101);
-CLinkListSA& m_alphaList = **AddressByVersion**>(0x733A4D, 0x73427D, 0x76DCA3);
-
-
-// Custom variables
-static float fSunFarClip;
-static RwTexture* gpMoonMask = nullptr;
-static HMODULE hDLLModule;
-static struct
-{
- char Extension[8];
- unsigned int Codec;
-} UserTrackExtensions[] = { { ".ogg", DECODER_VORBIS }, { ".mp3", DECODER_QUICKTIME },
- { ".wav", DECODER_WAVE }, { ".wma", DECODER_WINDOWSMEDIA },
- { ".wmv", DECODER_WINDOWSMEDIA }, { ".aac", DECODER_QUICKTIME },
- { ".m4a", DECODER_QUICKTIME }, { ".mov", DECODER_QUICKTIME },
- { ".fla", DECODER_FLAC }, { ".flac", DECODER_FLAC } };
-
-
-// Regular functions
-static RpMaterial* AlphaTest(RpMaterial* pMaterial, void* pData)
-{
- if ( RpMaterialGetTexture(pMaterial) )
- {
- if ( __rwD3D9TextureHasAlpha(RpMaterialGetTexture(pMaterial)) )
- {
- *static_cast(pData) = TRUE;
- return nullptr;
- }
- }
- else if ( RpMaterialGetColor(pMaterial)->alpha < 255 )
- {
- *static_cast(pData) = TRUE;
- return nullptr;
- }
-
- return pMaterial;
-}
-
-static RpAtomic* RenderAtomic(RpAtomic* pAtomic, float fComp)
-{
- UNREFERENCED_PARAMETER(fComp);
- return AtomicDefaultRenderCallBack(pAtomic);
-}
-
-RpAtomic* OnePassAlphaRender(RpAtomic* atomic)
-{
- BOOL nAlphaBlending;
-
- RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &nAlphaBlending);
-
- // RW caches those anyway, no need to duplicate caching
- //if ( nAlphaBlending != TRUE )
- // RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(TRUE));
- atomic = AtomicDefaultRenderCallBack(atomic);
-
- //if ( nAlphaBlending != TRUE )
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(nAlphaBlending));
-
- return atomic;
-}
-
-RpAtomic* TwoPassAlphaRender_aap(RpAtomic* atomic)
-{
- // For cutscenes, fall back to one-pass render
- if ( CCutsceneMgr__ms_running && !CanSeeOutSideFromCurrArea() )
- return AtomicDefaultRenderCallBack(atomic);
-
- int nPushedAlpha, nAlphaFunction;
- int nZWrite;
- int nAlphaBlending;
-
- RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTIONREF, &nPushedAlpha);
- RwRenderStateGet(rwRENDERSTATEZWRITEENABLE, &nZWrite);
- RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &nAlphaBlending);
- RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTION, &nAlphaFunction);
-
- // 1st pass
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(TRUE));
- if (nPushedAlpha == 100) // or should we just force it? do we ever use something else anyway?
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(128));
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(rwALPHATESTFUNCTIONGREATEREQUAL));
-
- atomic = AtomicDefaultRenderCallBack(atomic);
-
- if ( atomic )
- {
- // 2nd pass
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(rwALPHATESTFUNCTIONLESS));
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
-
- AtomicDefaultRenderCallBack(atomic);
- }
-
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(nPushedAlpha));
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(nAlphaFunction));
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, reinterpret_cast(nZWrite));
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(nAlphaBlending));
-
- return atomic;
-}
-
-RpAtomic* TwoPassAlphaRender_Silent(RpAtomic* atomic)
-{
- // For cutscenes, fall back to one-pass render
- if ( CCutsceneMgr__ms_running && !CanSeeOutSideFromCurrArea() )
- return AtomicDefaultRenderCallBack(atomic);
-
- int nPushedAlpha, nAlphaFunction;
- int nZWrite;
- int nAlphaBlending;
-
- RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTIONREF, &nPushedAlpha);
- RwRenderStateGet(rwRENDERSTATEZWRITEENABLE, &nZWrite);
- RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &nAlphaBlending);
- RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTION, &nAlphaFunction);
-
- // 1st pass
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(FALSE));
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(255));
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(rwALPHATESTFUNCTIONEQUAL));
-
- atomic = AtomicDefaultRenderCallBack(atomic);
-
- if ( atomic )
- {
- // 2nd pass
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(TRUE));
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(rwALPHATESTFUNCTIONLESS));
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
-
- AtomicDefaultRenderCallBack(atomic);
- }
-
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(nPushedAlpha));
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(nAlphaFunction));
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, reinterpret_cast(nZWrite));
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(nAlphaBlending));
-
- return atomic;
-}
-
-RpAtomic* StaticPropellerRender(RpAtomic* pAtomic)
-{
- int nPushedAlpha;
-
- RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTIONREF, &nPushedAlpha);
-
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, 0);
- pAtomic = AtomicDefaultRenderCallBack(pAtomic);
-
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(nPushedAlpha));
- return pAtomic;
-}
-
-template
-RpAtomic* RenderBigVehicleActomic(RpAtomic* pAtomic, float fComp)
-{
- UNREFERENCED_PARAMETER(fComp);
-
- const char* pNodeName = GetFrameNodeName(RpAtomicGetFrame(pAtomic));
-
- if ( !strncmp(pNodeName, "moving_prop", 11) )
- return renderer(pAtomic);
-
- if ( !strncmp(pNodeName, "static_prop", 11) )
- return StaticPropellerRender(pAtomic);
-
- return AtomicDefaultRenderCallBack(pAtomic);
-}
-
-void RenderVehicleHiDetailAlphaCB_HunterDoor(RpAtomic* pAtomic)
-{
- AlphaObjectInfo NewObject;
-
- NewObject.callback = RenderAtomic;
- NewObject.fCompareValue = -std::numeric_limits::infinity();
- NewObject.pAtomic = pAtomic;
-
- m_alphaList.InsertSorted(NewObject);
-}
-
-template
-void SetRendererForAtomic(RpAtomic* pAtomic)
-{
- BOOL bHasAlpha = FALSE;
-
- RpGeometryForAllMaterials(RpAtomicGetGeometry(pAtomic), AlphaTest, &bHasAlpha);
- if ( bHasAlpha )
- RpAtomicSetRenderCallBack(pAtomic, renderer);
-}
-
-template
-void SetRendererForAtomic_NoTest(RpAtomic* pAtomic)
-{
- RpAtomicSetRenderCallBack(pAtomic, renderer);
-}
-
-void RenderWeapon(CPed* pPed)
-{
- pPed->RenderWeapon(false, false);
- ms_weaponPedsForPC.Insert(pPed);
-}
-
-void RenderWeaponPedsForPC()
-{
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(TRUE));
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
-
- for ( auto it = ms_weaponPedsForPC.m_lnListHead.m_pNext; it != &ms_weaponPedsForPC.m_lnListTail; it = it->m_pNext )
- {
- it->V()->SetupLighting();
- it->V()->RenderWeapon(true, false);
- it->V()->RemoveLighting();
- }
-}
-
-/*void RenderWeaponsList()
-{
- int nPushedAlpha, nAlphaFunction;
- int nZWrite;
- int nAlphaBlending;
-
- RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTIONREF, &nPushedAlpha);
- RwRenderStateGet(rwRENDERSTATEZWRITEENABLE, &nZWrite);
- RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &nAlphaBlending);
- RwRenderStateGet(rwRENDERSTATEALPHATESTFUNCTION, &nAlphaFunction);
-
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(255));
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(TRUE));
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(rwALPHATESTFUNCTIONLESS));
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
-
- for ( auto i = ms_weaponPedsForPC.m_lnListHead.m_pNext; i != &ms_weaponPedsForPC.m_lnListTail; i = i->m_pNext )
- {
- i->V()->SetupLighting();
- RenderWeaponHooked(i->V());
- i->V()->RemoveLighting();
- }
-
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTIONREF, reinterpret_cast(nPushedAlpha));
- RwRenderStateSet(rwRENDERSTATEALPHATESTFUNCTION, reinterpret_cast(nAlphaFunction));
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, reinterpret_cast(nZWrite));
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, reinterpret_cast(nAlphaBlending));
-}*/
-
-template
-RpAtomic* RenderPedCB(RpAtomic* pAtomic)
-{
- BOOL bHasAlpha = FALSE;
-
- RpGeometryForAllMaterials(RpAtomicGetGeometry(pAtomic), AlphaTest, &bHasAlpha);
- if ( bHasAlpha )
- return renderer(pAtomic);
-
- return AtomicDefaultRenderCallBack(pAtomic);
-}
-
-static CAEFLACDecoder* __stdcall DecoderCtor(CAEDataStream* pData)
-{
- return new CAEFLACDecoder(pData);
-}
-
-static CAEWaveDecoder* __stdcall CAEWaveDecoderInit(CAEDataStream* pStream)
-{
- return new CAEWaveDecoder(pStream);
-}
-
-static void BasketballFix(unsigned char* pBuf, int nSize)
-{
- for ( int i = 0, hits = 0; i < nSize && hits < 7; i++, pBuf++ )
- {
- // Pattern check for save pickup XYZ
- if ( *(unsigned int*)pBuf == 0x449DE19A ) // Save pickup X
- {
- hits++;
- *(float*)pBuf = 1291.8f;
- }
- else if ( *(unsigned int*)pBuf == 0xC4416AE1 ) // Save pickup Y
- {
- hits++;
- *(float*)pBuf = -797.8284f;
- }
- else if ( *(unsigned int*)pBuf == 0x44886C7B ) // Save pickup Z
- {
- hits++;
- *(float*)pBuf = 1089.5f;
- }
- else if ( *(unsigned int*)pBuf == 0x449DF852 ) // Save point X
- {
- hits++;
- *(float*)pBuf = 1286.8f;
- }
- else if ( *(unsigned int*)pBuf == 0xC44225C3 ) // Save point Y
- {
- hits++;
- *(float*)pBuf = -797.69f;
- }
- else if ( *(unsigned int*)pBuf == 0x44885C7B ) // Save point Z
- {
- hits++;
- *(float*)pBuf = 1089.1f;
- }
- else if ( *(unsigned int*)pBuf == 0x43373AE1 ) // Save point A
- {
- hits++;
- *(float*)pBuf = 90.0f;
- }
- }
-}
-
-void TheScriptsLoad_BasketballFix()
-{
- TheScriptsLoad();
-
- BasketballFix(ScriptSpace+8, *(int*)(ScriptSpace+3));
-}
-
-void StartNewMission_BasketballFix()
-{
- WipeLocalVariableMemoryForMissionScript();
-
- if ( ScriptParams[0] == 0 )
- BasketballFix(ScriptSpace+200000, 69000);
-}
-
-// 1.01 kinda fixed it
-bool GetCurrentZoneLockedOrUnlocked(float fPosX, float fPosY)
-{
- int Xindex = (fPosX+3000.0f) * (1.0f/600.0f);
- int Yindex = (fPosY+3000.0f) * (1.0f/600.0f);
-
- // "Territories fix"
- if ( (Xindex >= 0 && Xindex < 10) && (Yindex >= 0 && Yindex < 10) )
- return ZonesVisited[10*Xindex - Yindex + 9] != 0;
-
- // Outside of map bounds
- return true;
-}
-
-// By NTAuthority
-void DrawMoonWithPhases(int moonColor, float* screenPos, float sizeX, float sizeY)
-{
- if ( !gpMoonMask )
- {
-
- if ( GetFileAttributes("lunar.png") != INVALID_FILE_ATTRIBUTES )
- {
- // load from file
- gpMoonMask = CPNGFile::ReadFromFile("lunar.png");
- }
- else
- {
- // Load from memory
-
- HMODULE thisModule;
- GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)DrawMoonWithPhases, &thisModule);
-
- HRSRC resource = FindResource(thisModule, MAKEINTRESOURCE(IDR_LUNAR64), RT_RCDATA);
- void* pMoonMask = static_cast(LoadResource(thisModule, resource));
-
- gpMoonMask = CPNGFile::ReadFromMemory(pMoonMask, SizeofResource(thisModule, resource));
-
- FreeResource(pMoonMask);
- }
- }
- //D3DPERF_BeginEvent(D3DCOLOR_ARGB(0,0,0,0), L"render moon");
-
- float currentDayFraction = nGameClockDays / 31.0f;
-
- RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nullptr);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
-
- float a10 = 1.0f / fFarClipZ;
- float size = (MoonSize * 2) + 4.0f;
-
- RwD3D9SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA);
-
- RenderOneXLUSprite(screenPos[0], screenPos[1], fFarClipZ, sizeX * size, sizeY * size, 0, 0, 0, 0, a10, -1, 0, 0);
-
- RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpMoonMask));
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDINVSRCCOLOR);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCCOLOR);
-
- float maskX = (sizeX * size) * 5.4f * (currentDayFraction - 0.5f) + screenPos[0];
- float maskY = screenPos[1] + ((sizeY * size) * 0.7f);
-
- RenderOneXLUSprite(maskX, maskY, fFarClipZ, sizeX * size * 1.7f, sizeY * size * 1.7f, 0, 0, 0, 255, a10, -1, 0, 0);
-
- RwD3D9SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
-
- RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[2]));
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDDESTALPHA);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, 0);
-
- RenderOneXLUSprite(screenPos[0], screenPos[1], fFarClipZ, sizeX * size, sizeY * size, moonColor, moonColor, moonColor * 0.85f, 255, a10, -1, 0, 0);
-
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
-
- //D3DPERF_EndEvent();
-}
-
-CRGBA* CRGBA::BlendGangColour(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
-{
- *this = Blend(CRGBA(r, g, b), pCurrZoneInfo->ZoneColour.a, HudColour[3], static_cast(255-pCurrZoneInfo->ZoneColour.a));
- this->a = a;
-
- return this;
-}
-
-void SunAndMoonFarClip()
-{
- fSunFarClip = min(1500.0f, fFarClipZ);
- DoSunAndMoon();
-}
-
-// STEAM ONLY
-template
-void DrawRect_HalfPixel_Steam(CRect& rect, const CRGBA& rgba)
-{
- if ( bX1 )
- rect.x1 -= 0.5f;
-
- if ( bY1 )
- rect.y1 -= 0.5f;
-
- if ( bX2 )
- rect.x2 -= 0.5f;
-
- if ( bY2 )
- rect.y2 -= 0.5f;
-
- // Steam CSprite2d::DrawRect
- ((void(*)(const CRect&, const CRGBA&))0x75CDA0)(rect, rgba);
-}
-
-static IDirect3DVertexShader9* pNVCShader = nullptr;
-static bool bRenderNVC = false;
-static RpAtomic* pRenderedAtomic;
-
-bool ShaderAttach()
-{
- // CGame::InitialiseRenderWare
- if ( InitialiseRenderWare() )
- {
- HMODULE thisModule;
- GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCSTR)ShaderAttach, &thisModule);
-
- HRSRC resource = FindResource(thisModule, MAKEINTRESOURCE(IDR_NVCSHADER), RT_RCDATA);
- RwUInt32* shader = static_cast(LoadResource(thisModule, resource));
-
- RwD3D9CreateVertexShader(shader, reinterpret_cast(&pNVCShader));
-
- FreeResource(shader);
- return true;
- }
- return false;
-}
-
-void ShaderDetach()
-{
- if ( pNVCShader )
- RwD3D9DeleteVertexShader(pNVCShader);
-
- // PluginDetach?
- ShutdownRenderWare();
-}
-
-// Function for 1.01
-BOOL Initialise3D(void* pParam)
-{
- RwBool (*RsRwInitialize)(void*) = (RwBool(*)(void*))(*(int*)0x5BFB93 + 0x5BFB92 + 5);
- if ( RsRwInitialize(pParam) )
- return ShaderAttach();
- return false;
-}
-
-void SetShader(RxD3D9InstanceData* pInstData)
-{
- if (bRenderNVC )
- {
- float fEnvVars[2] = { m_fDNBalanceParam, RpMaterialGetColor(pInstData->material)->alpha * (1.0f/255.0f) };
- RwRGBAReal* AmbientLight = RpLightGetColor(pAmbient);
-
- // Normalise the balance
- if ( fEnvVars[0] < 0.0f )
- fEnvVars[0] = 0.0f;
- else if ( fEnvVars[0] > 1.0f )
- fEnvVars[0] = 1.0f;
-
- RwD3D9SetVertexShader(pNVCShader);
-
- //_rwD3D9VSSetActiveWorldMatrix(RwFrameGetLTM(RpAtomicGetFrame(pRenderedAtomic)));
- //_rwD3D9VSSetActiveWorldMatrix(RwFrameGetMatrix(RpAtomicGetFrame(pRenderedAtomic)));
- //_rwD3D9VSGetComposedTransformMatrix(&outMat);
-
- D3DMATRIX worldMat, viewMat, projMat;
- _RwD3D9GetTransform(D3DTS_WORLD, &worldMat);
- _RwD3D9GetTransform(D3DTS_VIEW, &viewMat);
- _RwD3D9GetTransform(D3DTS_PROJECTION, &projMat);
- RwD3D9SetVertexShaderConstant(2, &worldMat, 4);
- RwD3D9SetVertexShaderConstant(6, &viewMat, 4);
- RwD3D9SetVertexShaderConstant(10, &projMat, 4);
-
- RwD3D9SetVertexShaderConstant(0, fEnvVars, 1);
- RwD3D9SetVertexShaderConstant(1, AmbientLight, 1);
- }
- else
- RwD3D9SetVertexShader(pInstData->vertexShader);
-}
-
-static void* HijackAtomic_JumpBack = AddressByVersion(0x5D6480, 0x5D6C60, 0x5F2C80);
-void __declspec(naked) HijackAtomic()
-{
- _asm
- {
- mov eax, [esp+8]
- mov pRenderedAtomic, eax
- jmp HijackAtomic_JumpBack
- }
-}
-
-void __declspec(naked) SetShader2()
-{
- _asm
- {
- mov bRenderNVC, 1
- push ecx
- push edx
- push edi
- push ebp
- call sub_5DA6A0
- add esp, 10h
- mov bRenderNVC, 0
- retn
- }
-}
-
-static void* pJackedEsi;
-static void* PassDayColoursToShader_NextIt = AddressByVersion(0x5D6382, 0x5D6B62, 0x5F2B81);
-static void* PassDayColoursToShader_Return = AddressByVersion(0x5D63BD, 0x5D6B9D, 0x5F2BB4);
-void __declspec(naked) HijackEsi()
-{
- _asm
- {
- mov [esp+48h-2Ch], eax
- mov pJackedEsi, esi
- lea esi, [ebp+44h]
-
- jmp PassDayColoursToShader_NextIt
- }
-}
-
-void __declspec(naked) PassDayColoursToShader()
-{
- _asm
- {
- mov [esp+54h],eax
- jz PassDayColoursToShader_FindDayColours
- jmp PassDayColoursToShader_NextIt
-
-PassDayColoursToShader_FindDayColours:
- xor eax, eax
-
-PassDayColoursToShader_FindDayColours_Loop:
- cmp byte ptr [esp+eax*8+48h-28h+6], D3DDECLUSAGE_COLOR
- jnz PassDayColoursToShader_FindDayColours_Next
- cmp byte ptr [esp+eax*8+48h-28h+7], 1
- jz PassDayColoursToShader_DoDayColours
-
-PassDayColoursToShader_FindDayColours_Next:
- inc eax
- jmp PassDayColoursToShader_FindDayColours_Loop
-
-PassDayColoursToShader_DoDayColours:
- mov esi, pJackedEsi
- mov edx, [ms_extraVertColourPluginOffset]
- mov edx, dword ptr [edx]
- mov edx, dword ptr [edx+esi+4]
- mov edi, dword ptr [ebp+18h]
- mov [esp+48h+4], edx
- mov edx, dword ptr [ebp+4]
- lea eax, [esp+eax*8+48h-26h]
- mov [esp+48h+0Ch], edx
- mov [esp+48h-2Ch], eax
- lea esi, [ebp+44h]
-
-PassDayColoursToShader_Iterate:
- mov edx, dword ptr [esi+14h]
- mov eax, dword ptr [esi]
- push edi
- push edx
- mov edx, dword ptr [esp+50h+4]
- lea edx, [edx+eax*4]
- imul eax, edi
- push edx
- mov edx, dword ptr [esp+54h-2Ch]
- movzx edx, word ptr [edx]
- add ecx, eax
- add edx, ecx
- push edx
- call _rpD3D9VertexDeclarationInstColor
- mov ecx, dword ptr [esp+58h-34h]
- mov [esi+8], eax
- mov eax, dword ptr [esp+58h+0Ch]
- add esp, 10h
- add esi, 24h
- dec eax
- mov [esp+48h+0Ch], eax
- jnz PassDayColoursToShader_Iterate
-
- jmp PassDayColoursToShader_Return
- }
-}
-
-void __declspec(naked) PassDayColoursToShader_Steam()
-{
- _asm
- {
- dec ebx
- jz PassDayColoursToShader_FindDayColours
- jmp PassDayColoursToShader_NextIt
-
-PassDayColoursToShader_FindDayColours:
- xor eax, eax
-
-PassDayColoursToShader_FindDayColours_Loop:
- cmp byte ptr [esp+eax*8+48h-28h+6], D3DDECLUSAGE_COLOR
- jnz PassDayColoursToShader_FindDayColours_Next
- cmp byte ptr [esp+eax*8+48h-28h+7], 1
- jz PassDayColoursToShader_DoDayColours
-
-PassDayColoursToShader_FindDayColours_Next:
- inc eax
- jmp PassDayColoursToShader_FindDayColours_Loop
-
-PassDayColoursToShader_DoDayColours:
- mov esi, pJackedEsi
- mov edx, [ms_extraVertColourPluginOffset]
- mov edx, dword ptr [edx]
- mov edx, dword ptr [edx+esi+4]
- mov edi, dword ptr [ebp+18h]
- mov [esp+48h+0Ch], edx
- mov ebx, dword ptr [ebp+4]
- lea eax, [esp+eax*8+48h-26h]
- mov [esp+48h-2Ch], eax
- lea esi, [ebp+44h]
-
-PassDayColoursToShader_Iterate:
- mov edx, dword ptr [esi+14h]
- mov eax, dword ptr [esi]
- push edi
- push edx
- mov edx, dword ptr [esp+50h+0Ch]
- lea edx, [edx+eax*4]
- imul eax, edi
- push edx
- mov edx, dword ptr [esp+54h-2Ch]
- add eax, dword ptr [esp+54h-34h]
- movzx edx, word ptr [edx]
- add edx, eax
- push edx
- call _rpD3D9VertexDeclarationInstColor
- mov [esi+8], eax
- add esp, 10h
- add esi, 24h
- dec ebx
- jnz PassDayColoursToShader_Iterate
-
- jmp PassDayColoursToShader_Return
- }
-}
-
-void __declspec(naked) ChangeEdi_Steam()
-{
- _asm
- {
- mov edi, SIZE D3DCOLOR
- cmp byte ptr [esp+4Ch-35h], 0
- retn
- }
-}
-
-// Hooks
-void __declspec(naked) LightMaterialsFix()
-{
- _asm
- {
- mov [esi], edi
- mov ebx, [ecx]
- lea esi, [edx+4]
- mov [ebx+4], esi
- mov edi, [esi]
- mov [ebx+8], edi
- add esi, 4
- mov [ebx+12], esi
- mov edi, [esi]
- mov [ebx+16], edi
- add ebx, 20
- mov [ecx], ebx
- retn
- }
-}
-
-void __declspec(naked) UserTracksFix()
-{
- _asm
- {
- push [esp+4]
- call SetVolume
- mov ecx, [pUserTracksStuff]
- mov byte ptr [ecx+0Dh], 1
- call InitializeUtrax
- retn 4
- }
-}
-
-void __declspec(naked) UserTracksFix_Steam()
-{
- _asm
- {
- push [esp+4]
- call SetVolume
- mov ecx, [pUserTracksStuff]
- mov byte ptr [ecx+5], 1
- call InitializeUtrax
- retn 4
- }
-}
-
-// Unused on Steam EXE
-static void* UsageIndex1_JumpBack = AddressByVersion(0x5D611B, 0x5D68FB, 1);
-void __declspec(naked) UsageIndex1()
-{
- _asm
- {
- mov byte ptr [esp+eax*8+27h], 1
- inc eax
-
- jmp UsageIndex1_JumpBack
- }
-}
-
-void __declspec(naked) ResetAlphaFuncRefAfterRender()
-{
- _asm
- {
- mov edx, [rwengine]
- mov edx, [edx]
- mov ecx, [esp+7Ch-74h]
- push ecx
- push rwRENDERSTATEALPHATESTFUNCTIONREF
- call dword ptr [edx+20h]
- add esp, 8
- pop edi
- pop esi
- add esp, 74h
- retn
- }
-}
-
-void __declspec(naked) ResetAlphaFuncRefAfterRender_Steam()
-{
- _asm
- {
- mov edx, [rwengine]
- mov edx, [edx]
- mov ecx, [esp+80h-74h]
- push ecx
- push rwRENDERSTATEALPHATESTFUNCTIONREF
- call dword ptr [edx+20h]
- add esp, 8
- pop edi
- pop esi
- add esp, 78h
- retn
- }
-}
-
-static void* PlaneAtomicRendererSetup_JumpBack = AddressByVersion(0x4C7986, 0x4C7A06, 0x4D2275);
-static void* RenderVehicleHiDetailAlphaCB_BigVehicle = AddressByVersion(0x734370, 0x734BA0, 0x76E400);
-static void* RenderVehicleHiDetailCB_BigVehicle = AddressByVersion(0x733420, 0x733C50, 0x76D6C0);
-void __declspec(naked) PlaneAtomicRendererSetup()
-{
- static const char aStaticProp[] = "static_prop";
- static const char aMovingProp[] = "moving_prop";
- _asm
- {
- mov eax, [esi+4]
- push eax
- call GetFrameNodeName
- //push eax
- mov [esp+8+8], eax
- push 11
- push offset aStaticProp
- push eax
- call strncmp
- add esp, 10h
- 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
-
-PlaneAtomicRendererSetup_Alpha:
- push [RenderVehicleHiDetailAlphaCB_BigVehicle]
- jmp PlaneAtomicRendererSetup_Return
-
-PlaneAtomicRendererSetup_NoAlpha:
- push [RenderVehicleHiDetailCB_BigVehicle]
-
-PlaneAtomicRendererSetup_Return:
- jmp PlaneAtomicRendererSetup_JumpBack
- }
-}
-
-static unsigned int nCachedCRC;
-
-static void* RenderVehicleHiDetailCB = AddressByVersion(0x733240, 0x733A70, 0x76D4C0);
-static void* RenderVehicleHiDetailAlphaCB = AddressByVersion(0x733F80, 0x7347B0, 0x76DFE0);
-static void* RenderHeliRotorAlphaCB = AddressByVersion(0x7340B0, 0x7348E0, 0x76E110);
-static void* RenderHeliTailRotorAlphaCB = AddressByVersion(0x734170, 0x7349A0, 0x76E1E0);
-static void* HunterTest_JumpBack = AddressByVersion(0x4C7914, 0x4C7994, 0x4D2203);
-void __declspec(naked) HunterTest()
-{
- static const char aDoorDummy[] = "door_lf_ok";
- static const char aStaticRotor[] = "static_rotor";
- static const char aStaticRotor2[] = "static_rotor2";
- static const char aWindscreen[] = "windscreen";
- _asm
- {
- setnz al
- movzx di, al
-
- push 10
- push offset aWindscreen
- push ebp
- call strncmp
- add esp, 0Ch
- test eax, eax
- jz HunterTest_RegularAlpha
-
- push 13
- push offset aStaticRotor2
- push ebp
- call strncmp
- add esp, 0Ch
- test eax, eax
- jz HunterTest_StaticRotor2AlphaSet
-
- push 12
- push offset aStaticRotor
- push ebp
- call strncmp
- add esp, 0Ch
- test eax, eax
- jz HunterTest_StaticRotorAlphaSet
-
- test di, di
- jnz HunterTest_DoorTest
-
- push [RenderVehicleHiDetailCB]
- jmp HunterTest_JumpBack
-
-HunterTest_DoorTest:
- cmp nCachedCRC, 0x45D0B41C
- jnz HunterTest_RegularAlpha
- push 10
- push offset aDoorDummy
- push ebp
- call strncmp
- add esp, 0Ch
- test eax, eax
- jnz HunterTest_RegularAlpha
- push RenderVehicleHiDetailAlphaCB_HunterDoor
- jmp HunterTest_JumpBack
-
-HunterTest_RegularAlpha:
- push [RenderVehicleHiDetailAlphaCB]
- jmp HunterTest_JumpBack
-
-HunterTest_StaticRotorAlphaSet:
- push [RenderHeliRotorAlphaCB]
- jmp HunterTest_JumpBack
-
-HunterTest_StaticRotor2AlphaSet:
- push [RenderHeliTailRotorAlphaCB]
- jmp HunterTest_JumpBack
- }
-}
-
-static void* CacheCRC32_JumpBack = AddressByVersion(0x4C7B10, 0x4C7B90, 0x4D2400);
-void __declspec(naked) CacheCRC32()
-{
- _asm
- {
- mov eax, [ecx+4]
- mov nCachedCRC, eax
- jmp CacheCRC32_JumpBack
- }
-}
-
-static void* const TrailerDoubleRWheelsFix_ReturnFalse = AddressByVersion(0x4C9333, 0x4C9533, 0x4D3C59);
-static void* const TrailerDoubleRWheelsFix_ReturnTrue = AddressByVersion(0x4C9235, 0x4C9435, 0x4D3B59);
-void __declspec(naked) TrailerDoubleRWheelsFix()
-{
- _asm
- {
- cmp [edi]CVehicleModelInfo.m_dwType, VEHICLE_TRAILER
- je TrailerDoubleRWheelsFix_DoWheels
- cmp eax, 2
- je TrailerDoubleRWheelsFix_False
- cmp eax, 5
- je TrailerDoubleRWheelsFix_False
-
-TrailerDoubleRWheelsFix_DoWheels:
- jmp TrailerDoubleRWheelsFix_ReturnTrue
-
-TrailerDoubleRWheelsFix_False:
- jmp TrailerDoubleRWheelsFix_ReturnFalse
- }
-}
-
-void __declspec(naked) TrailerDoubleRWheelsFix2()
-{
- _asm
- {
- add esp, 18h
- mov eax, [ebx]
- mov eax, [esi+eax+4]
- jmp TrailerDoubleRWheelsFix
- }
-}
-
-void __declspec(naked) TrailerDoubleRWheelsFix_Steam()
-{
- _asm
- {
- cmp [esi]CVehicleModelInfo.m_dwType, VEHICLE_TRAILER
- je TrailerDoubleRWheelsFix_DoWheels
- cmp eax, 2
- je TrailerDoubleRWheelsFix_False
- cmp eax, 5
- je TrailerDoubleRWheelsFix_False
-
-TrailerDoubleRWheelsFix_DoWheels:
- jmp TrailerDoubleRWheelsFix_ReturnTrue
-
-TrailerDoubleRWheelsFix_False:
- jmp TrailerDoubleRWheelsFix_ReturnFalse
- }
-}
-
-void __declspec(naked) TrailerDoubleRWheelsFix2_Steam()
-{
- _asm
- {
- add esp, 18h
- mov eax, [ebp]
- mov eax, [ebx+eax+4]
- jmp TrailerDoubleRWheelsFix_Steam
- }
-}
-
-static void* LoadFLAC_JumpBack = AddressByVersion(0x4F3743, *GetVer() == 1 ? (*(BYTE*)0x4F3A50 == 0x6A ? 0x4F3BA3 : 0x5B6B81) : 0, 0x4FFC3F);
-void __declspec(naked) LoadFLAC()
-{
- _asm
- {
- jz LoadFLAC_WindowsMedia
- sub ebp, 2
- jnz LoadFLAC_Return
- push esi
- call DecoderCtor
- jmp LoadFLAC_Success
-
-LoadFLAC_WindowsMedia:
- jmp LoadFLAC_JumpBack
-
-LoadFLAC_Success:
- test eax, eax
- mov [esp+20h+4], eax
- jnz LoadFLAC_Return_NoDelete
-
-LoadFLAC_Return:
- mov ecx, esi
- call CAEDataStreamOld::~CAEDataStreamOld
- push esi
- call GTAdelete
- add esp, 4
-
-LoadFLAC_Return_NoDelete:
- mov eax, [esp+20h+4]
- mov ecx, [esp+20h-0Ch]
- pop esi
- pop ebp
- pop edi
- pop ebx
- mov fs:0, ecx
- add esp, 10h
- retn 4
- }
-}
-
-// 1.01 securom butchered this func, might not be reliable
-void __declspec(naked) LoadFLAC_11()
-{
- _asm
- {
- jz LoadFLAC_WindowsMedia
- sub ebp, 2
- jnz LoadFLAC_Return
- push esi
- call DecoderCtor
- jmp LoadFLAC_Success
-
-LoadFLAC_WindowsMedia:
- jmp LoadFLAC_JumpBack
-
-LoadFLAC_Success:
- test eax, eax
- mov [esp+20h+4], eax
- jnz LoadFLAC_Return_NoDelete
-
-LoadFLAC_Return:
- mov ecx, esi
- call CAEDataStreamNew::~CAEDataStreamNew
- push esi
- call GTAdelete
- add esp, 4
-
-LoadFLAC_Return_NoDelete:
- mov eax, [esp+20h+4]
- mov ecx, [esp+20h-0Ch]
- pop esi
- pop ebp
- pop edi
- pop ebx
- mov fs:0, ecx
- add esp, 10h
- retn 4
- }
-}
-
-
-void __declspec(naked) LoadFLAC_Steam()
-{
- _asm
- {
- jz LoadFLAC_WindowsMedia
- sub ebp, 2
- jnz LoadFLAC_Return
- push esi
- call DecoderCtor
- jmp LoadFLAC_Success
-
-LoadFLAC_WindowsMedia:
- jmp LoadFLAC_JumpBack
-
-LoadFLAC_Success:
- test eax, eax
- mov [esp+20h+4], eax
- jnz LoadFLAC_Return_NoDelete
-
-LoadFLAC_Return:
- mov ecx, esi
- call CAEDataStreamOld::~CAEDataStreamOld
- push esi
- call GTAdelete
- add esp, 4
-
-LoadFLAC_Return_NoDelete:
- mov eax, [esp+20h+4]
- mov ecx, [esp+20h-0Ch]
- pop ebx
- pop esi
- pop ebp
- pop edi
- mov fs:0, ecx
- add esp, 10h
- retn 4
- }
-}
-
-void __declspec(naked) FLACInit()
-{
- _asm
- {
- mov byte ptr [ecx+0Dh], 1
- jmp InitializeUtrax
- }
-}
-
-void __declspec(naked) FLACInit_Steam()
-{
- _asm
- {
- mov byte ptr [ecx+5], 1
- jmp InitializeUtrax
- }
-}
-
-
-// Only 1.0/1.01
-static void* HandleMoonStuffStub_JumpBack = AddressByVersion(0x713D24, 0x714554, 0x72F17F);
-void __declspec(naked) HandleMoonStuffStub()
-{
- __asm
- {
- mov eax, [esp + 78h - 64h] // screen x size
- mov ecx, [esp + 78h - 68h] // screen y size
-
- push ecx
- push eax
-
- lea ecx, [esp + 80h - 54h] // screen coord vector
-
- push ecx
-
- push esi
-
- call DrawMoonWithPhases
-
- add esp, 10h
-
- jmp HandleMoonStuffStub_JumpBack
- }
-}
-
-void __declspec(naked) HandleMoonStuffStub_Steam()
-{
- __asm
- {
- mov eax, [esp + 70h - 58h] // screen x size
- mov ecx, [esp + 70h - 5Ch] // screen y size
-
- push ecx
- push eax
-
- lea ecx, [esp + 78h - 48h] // screen coord vector
-
- push ecx
-
- push esi
-
- call DrawMoonWithPhases
-
- add esp, 10h
-
- jmp HandleMoonStuffStub_JumpBack
- }
-}
-
-// 1.0 ONLY BEGINS HERE
-static bool bDarkVehicleThing;
-static RpLight** pDirect;
-
-static void* DarkVehiclesFix1_JumpBack;
-void __declspec(naked) DarkVehiclesFix1()
-{
- _asm
- {
- shr eax, 0Eh
- test al, 1
- jz DarkVehiclesFix1_DontAppply
- mov ecx, [pDirect]
- mov ecx, [ecx]
- mov al, [ecx+2]
- test al, 1
- jnz DarkVehiclesFix1_DontAppply
- mov bDarkVehicleThing, 1
- jmp DarkVehiclesFix1_Return
-
-DarkVehiclesFix1_DontAppply:
- mov bDarkVehicleThing, 0
-
-DarkVehiclesFix1_Return:
- jmp DarkVehiclesFix1_JumpBack
- }
-}
-
-void __declspec(naked) DarkVehiclesFix2()
-{
- _asm
- {
- jz DarkVehiclesFix2_MakeItDark
- mov al, bDarkVehicleThing
- test al, al
- jnz DarkVehiclesFix2_MakeItDark
- mov eax, 5D9A7Ah
- jmp eax
-
-DarkVehiclesFix2_MakeItDark:
- mov eax, 5D9B09h
- jmp eax
- }
-}
-
-void __declspec(naked) DarkVehiclesFix3()
-{
- _asm
- {
- jz DarkVehiclesFix3_MakeItDark
- mov al, bDarkVehicleThing
- test al, al
- jnz DarkVehiclesFix3_MakeItDark
- mov eax, 5D9B4Ah
- jmp eax
-
-DarkVehiclesFix3_MakeItDark:
- mov eax, 5D9CACh
- jmp eax
- }
-}
-
-void __declspec(naked) DarkVehiclesFix4()
-{
- _asm
- {
- jz DarkVehiclesFix4_MakeItDark
- mov al, bDarkVehicleThing
- test al, al
- jnz DarkVehiclesFix4_MakeItDark
- mov eax, 5D9CB8h
- jmp eax
-
-DarkVehiclesFix4_MakeItDark:
- mov eax, 5D9E0Dh
- jmp eax
- }
-}
-// 1.0 ONLY ENDS HERE
-
-static void* const FPSLimit_ReturnTrue = AddressByVersion(0x748D98, 0x74969D, 0x782D22);
-static void* const FPSLimit_ReturnFalse = AddressByVersion(0x748DA3, 0x7496A8, 0x782D2D);
-static int& FPSLimitVal = **AddressByVersion(0x619622, 0x619E42, 0x63B112);
-void __declspec(naked) YesFPSLimit()
-{
- static const double f1000 = 1000.0;
- _asm
- {
- mov eax, [FPSLimitVal]
- fild [eax]
- fdivr [f1000]
- fcomp [esp+94h-80h]
- fnstsw ax
- test ah, 5
- jp YesFPSLimit_Skip
-
- jmp FPSLimit_ReturnTrue
-
-YesFPSLimit_Skip:
- jmp FPSLimit_ReturnFalse
- }
-}
-
-void __declspec(naked) NoFPSLimit()
-{
- _asm
- {
- test al, al
- jnz YesFPSLimit
-
- fld1
- fcomp [esp+94h-80h]
- fnstsw ax
- test ah, 5
- jp NoFPSLimit_Skip
-
- jmp FPSLimit_ReturnTrue
-
-NoFPSLimit_Skip:
- jmp FPSLimit_ReturnFalse
- }
-}
-
-void __declspec(naked) YesFPSLimit_11()
-{
- static const double f1000 = 1000.0;
- _asm
- {
- mov eax, [FPSLimitVal]
- fild [eax]
- fdivr [f1000]
- fcomp [esp+1Ch]
- fnstsw ax
- test ah, 5
- jp YesFPSLimit_Skip
-
- jmp FPSLimit_ReturnTrue
-
-YesFPSLimit_Skip:
- jmp FPSLimit_ReturnFalse
- }
-}
-
-void __declspec(naked) NoFPSLimit_11()
-{
- _asm
- {
- test al, al
- jnz YesFPSLimit_11
-
- fld1
- fcomp [esp+1Ch]
- fnstsw ax
- test ah, 5
- jp NoFPSLimit_Skip
-
- jmp FPSLimit_ReturnTrue
-
-NoFPSLimit_Skip:
- jmp FPSLimit_ReturnFalse
- }
-}
-
-void __declspec(naked) YesFPSLimit_Steam()
-{
- static const double f1000 = 1000.0;
- _asm
- {
- mov eax, [FPSLimitVal]
- fild [eax]
- fdivr [f1000]
- fcomp [esp+90h-78h]
- fnstsw ax
- test ah, 5
- jp YesFPSLimit_Skip
-
- jmp FPSLimit_ReturnTrue
-
-YesFPSLimit_Skip:
- jmp FPSLimit_ReturnFalse
- }
-}
-
-void __declspec(naked) NoFPSLimit_Steam()
-{
- _asm
- {
- test al, al
- jnz YesFPSLimit_Steam
-
- fld1
- fcomp [esp+90h-78h]
- fnstsw ax
- test ah, 5
- jp NoFPSLimit_Skip
-
- jmp FPSLimit_ReturnTrue
-
-NoFPSLimit_Skip:
- jmp FPSLimit_ReturnFalse
- }
-}
-
-static void* const g_fx = *AddressByVersion(0x4A9649, 0x4AA4EF, 0x4B2BB9);
-void __declspec(naked) GetMaxExtraDirectionals()
-{
- _asm
- {
- call CanSeeOutSideFromCurrArea
- test al, al
- jz GetMaxExtraDirectionals_Six
-
- // Low details?
- mov eax, [g_fx]
- cmp dword ptr [eax+54h], 0
- jne GetMaxExtraDirectionals_Six
- mov ebx, 4
- retn
-
-GetMaxExtraDirectionals_Six:
- mov ebx, 6
- retn
- }
-}
-
-
-static const float fSteamSubtitleSizeX = 0.45f;
-static const float fSteamSubtitleSizeY = 0.9f;
-static const float fSteamRadioNamePosY = 33.0f;
-static const float fSteamRadioNameSizeX = 0.4f;
-static const float fSteamRadioNameSizeY = 0.6f;
-
-static const double dRetailSubtitleSizeX = 0.58;
-static const double dRetailSubtitleSizeY = 1.2;
-static const double dRetailSubtitleSizeY2 = 1.22;
-static const double dRetailRadioNamePosY = 22.0;
-static const double dRetailRadioNameSizeX = 0.6;
-static const double dRetailRadioNameSizeY = 0.9;
-
-BOOL InjectDelayedPatches_10()
-{
- if ( !IsAlreadyRunning() )
- {
- using namespace MemoryVP;
-
- // Obtain a path to the ASI
- wchar_t wcModulePath[MAX_PATH];
-
- GetModuleFileNameW(hDLLModule, wcModulePath, MAX_PATH);
-
- // ASI -> INI
- size_t nLen = wcslen(wcModulePath);
- wcModulePath[nLen-1] = L'i';
- wcModulePath[nLen-2] = L'n';
- wcModulePath[nLen-3] = L'i';
-
- bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr;
- bool bSAMP = GetModuleHandle("samp") != nullptr;
- bool bSARender = GetModuleHandle("SARender.asi") != nullptr;
-
- // PS2 sun - more
- if ( !bSAMP )
- {
- DoSunAndMoon = (void(*)())(*(int*)0x53C137 + 0x53C136 + 5);
- InjectHook(0x53C136, SunAndMoonFarClip);
- Patch(0x6FC5AA, &fSunFarClip);
- }
-
- if ( !bSARender )
- {
- // Twopass rendering (experimental)
- unsigned int dwTwoPassMethod = GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", 0, wcModulePath);
- Patch(0x4C441E, 0x57);
- Patch(0x4C4424, 0x5F04C483);
- Patch(0x4C4428, 0x0004C25E);
- if ( dwTwoPassMethod == 1 )
- {
- // Silent's twopass
- InjectHook(0x4C441F, SetRendererForAtomic, PATCH_CALL);
- Patch(0x7341D9, TwoPassAlphaRender_Silent);
- Patch(0x734127, TwoPassAlphaRender_Silent);
- Patch(0x73445E, RenderBigVehicleActomic);
- // Twopass for peds
- InjectHook(0x733614, RenderPedCB);
- }
- else if ( dwTwoPassMethod == 2 )
- {
- // aap's twopass
- InjectHook(0x4C441F, SetRendererForAtomic_NoTest, PATCH_CALL);
- Patch(0x7341D9, TwoPassAlphaRender_aap);
- Patch(0x734127, TwoPassAlphaRender_aap);
- Patch(0x73445E, RenderBigVehicleActomic);
- // Twopass for peds
- InjectHook(0x733614, RenderPedCB);
- }
- else
- {
- Patch(0x7341D9, TwoPassAlphaRender_aap);
- Patch(0x734127, TwoPassAlphaRender_aap);
- Patch(0x73445E, RenderBigVehicleActomic);
- InjectHook(0x4C441F, SetRendererForAtomic, PATCH_CALL);
- }
-
-
- if ( !bSAMP && GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", TRUE, wcModulePath) != FALSE )
- {
- // Shaders!
- // plugin-sdk compatibility
- InitialiseRenderWare = (bool(*)())(*(int*)0x5BF3A2 + 0x5BF3A1 + 5);
- ShutdownRenderWare = (void(*)())(*(int*)0x53D911 + 0x53D910 + 5);
- sub_5DA6A0 = (void(*)(void*,void*,void*,void*))(*(int*)0x5D66F2 + 0x5D66F1 + 5);
-
- InjectHook(0x5DA743, SetShader);
- InjectHook(0x5D66F1, SetShader2);
- InjectHook(0x5D6116, UsageIndex1, PATCH_JUMP);
- InjectHook(0x5D63B7, PassDayColoursToShader, PATCH_JUMP);
- InjectHook(0x5D637B, HijackEsi, PATCH_JUMP);
- InjectHook(0x5BF3A1, ShaderAttach);
- InjectHook(0x53D910, ShaderDetach);
- Patch(0x5D67F4, HijackAtomic);
- Patch(0x5D7200, 0xC3);
- Patch(0x5D67BB, 0x6890);
- Patch(0x5D67D7, 0x6890);
- Patch(0x5D67BD, 0x5D5FE0);
- Patch(0x5D67D9, 0x5D5FE0);
- Patch(0x5DA73F, 0x90909056);
-
- Patch(0x5D60D9, D3DDECLTYPE_D3DCOLOR);
- Patch(0x5D60E2, D3DDECLUSAGE_COLOR);
- Patch(0x5D60CF, sizeof(D3DCOLOR));
- Patch(0x5D60EA, sizeof(D3DCOLOR));
- Patch(0x5D60C2, 0x13);
- Patch(0x5D62F0, 0xEB);
-
- // PostFX fix
- Patch(*(float**)0x7034C0, 0.0);
- }
-
- // Weapons rendering
- InjectHook(0x5E7859, RenderWeapon);
- InjectHook(0x732F30, RenderWeaponPedsForPC, PATCH_JUMP);
- }
-
- if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableScriptFixes", TRUE, wcModulePath) != FALSE )
- {
- // Gym glitch fix
- Patch(0x470B03, 0xCD8B);
- Patch(0x470B0A, 0x8B04508B);
- Patch(0x470B0E, 0x9000);
- Nop(0x470B10, 1);
- InjectHook(0x470B05, &CRunningScript::GetDay_GymGlitch, PATCH_CALL);
-
- // Basketball fix
- WipeLocalVariableMemoryForMissionScript = (void(*)())(*(int*)0x489A71 + 0x489A70 + 5);
- TheScriptsLoad = (void(*)())(*(int*)0x5D18F1 + 0x5D18F0 + 5);
- InjectHook(0x5D18F0, TheScriptsLoad_BasketballFix);
- // Fixed for Hoodlum
- InjectHook(0x489A70, StartNewMission_BasketballFix);
- InjectHook(0x4899F0, StartNewMission_BasketballFix);
- }
-
- if ( GetPrivateProfileIntW(L"SilentPatch", L"SkipIntroSplashes", TRUE, wcModulePath) != FALSE )
- {
- // Skip the damn intro splash
- Patch(AddressByRegion_10(0x748AA8), 0x3DEB);
- }
-
- if ( GetPrivateProfileIntW(L"SilentPatch", L"SmallSteamTexts", TRUE, wcModulePath) != FALSE )
- {
- // We're on 1.0 - make texts smaller
- Patch(0x58C387, &fSteamSubtitleSizeY);
- Patch(0x58C40F, &fSteamSubtitleSizeY);
- Patch(0x58C4CE, &fSteamSubtitleSizeY);
-
- Patch(0x58C39D, &fSteamSubtitleSizeX);
- Patch(0x58C425, &fSteamSubtitleSizeX);
- Patch(0x58C4E4, &fSteamSubtitleSizeX);
-
- Patch(0x4E9FD8, &fSteamRadioNamePosY);
- Patch(0x4E9F22, &fSteamRadioNameSizeY);
- Patch(0x4E9F38, &fSteamRadioNameSizeX);
- }
-
- if ( GetPrivateProfileIntW(L"SilentPatch", L"ColouredZoneNames", FALSE, wcModulePath) != FALSE )
- {
- // Coloured zone names
- Patch(0x58ADBE, 0x0E75);
- Patch(0x58ADC5, 0x0775);
-
- InjectHook(0x58ADE4, &CRGBA::BlendGangColour);
- }
- else
- {
- Patch(0x58ADAE, 0xEB);
- }
-
- // ImVehFt conflicts
- if ( !bHasImVehFt )
- {
- // Lights
- InjectHook(0x4C830C, LightMaterialsFix, PATCH_CALL);
-
- // Flying components
- InjectHook(0x59F180, &CObject::Render_Stub, PATCH_JUMP);
-
- // Cars getting dirty
- // Only 1.0 and Steam
- InjectHook(0x4C9648, &CVehicleModelInfo::FindEditableMaterialList, PATCH_CALL);
- Patch(0x4C964D, 0x0FEBCE8B);
- Patch(0x5D5DC2, 32); // 1.0 ONLY
- }
-
- if ( !bHasImVehFt && !bSAMP )
- {
- // Properly random numberplates
- DWORD* pVMT = *(DWORD**)0x4C75FC;
- Patch(&pVMT[7], &CVehicleModelInfo::Shutdown_Stub);
- Patch(0x6D0E43, 0xEB);
- InjectHook(0x4C9660, &CVehicleModelInfo::SetCarCustomPlate);
- InjectHook(0x6D6A58, &CVehicle::CustomCarPlate_TextureCreate);
- InjectHook(0x6D651C, &CVehicle::CustomCarPlate_BeforeRenderingStart);
- InjectHook(0x6FDFE0, CCustomCarPlateMgr::SetupClumpAfterVehicleUpgrade, PATCH_JUMP);
- //InjectMethodVP(0x6D0E53, CVehicle::CustomCarPlate_AfterRenderingStop, PATCH_NOTHING);
- Nop(0x6D6517, 2);
- }
-
- // SSE conflicts
- if ( GetModuleHandle("shadows.asi") == nullptr )
- {
- Patch(0x70665C, 0x52909090);
- InjectHook(0x706662, &CShadowCamera::Update);
- }
-
- // Bigger streamed entity linked lists
- // Increase only if they're not increased already
- if ( *(DWORD*)0x5B8E55 == 12000 )
- {
- Patch(0x5B8E55, 15000);
- Patch(0x5B8EB0, 15000);
- }
-
- return FALSE;
- }
- return TRUE;
-}
-
-BOOL InjectDelayedPatches_11()
-{
- if ( !IsAlreadyRunning() )
- {
- using namespace MemoryVP;
-
- // Obtain a path to the ASI
- wchar_t wcModulePath[MAX_PATH];
-
- GetModuleFileNameW(hDLLModule, wcModulePath, MAX_PATH);
-
- // ASI -> INI
- size_t nLen = wcslen(wcModulePath);
- wcModulePath[nLen-1] = L'i';
- wcModulePath[nLen-2] = L'n';
- wcModulePath[nLen-3] = L'i';
-
- bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr;
- bool bSAMP = GetModuleHandle("samp") != nullptr;
- bool bSARender = GetModuleHandle("SARender.asi") != nullptr;
-
- // PS2 sun - more
- if ( !bSAMP )
- {
- DoSunAndMoon = (void(*)())(*(int*)0x53C5D7 + 0x53C5D6 + 5);
- InjectHook(0x53C5D6, SunAndMoonFarClip);
-
- Patch(0x6FCDDA, &fSunFarClip);
- }
-
- if ( !bSARender )
- {
- // Twopass rendering (experimental)
- unsigned int dwTwoPassMethod = GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", 0, wcModulePath);
- Patch(0x4C449E, 0x57);
- Patch(0x4C44A4, 0x5F04C483);
- Patch(0x4C44A8, 0x0004C25E);
-
- if ( dwTwoPassMethod == 1 )
- {
- // Silent's twopass
- InjectHook(0x4C449F, SetRendererForAtomic, PATCH_CALL);
- Patch(0x734A09, TwoPassAlphaRender_Silent);
- Patch(0x734957, TwoPassAlphaRender_Silent);
- Patch(0x734C8E, RenderBigVehicleActomic);
- // Twopass for peds
- InjectHook(0x733E44, RenderPedCB);
- }
- else if ( dwTwoPassMethod == 2 )
- {
- // aap's twopass
- InjectHook(0x4C449F, SetRendererForAtomic_NoTest, PATCH_CALL);
- Patch(0x734A09, TwoPassAlphaRender_aap);
- Patch(0x734957, TwoPassAlphaRender_aap);
- Patch(0x734C8E, RenderBigVehicleActomic);
- // Twopass for peds
- InjectHook(0x733E44, RenderPedCB);
- }
- else
- {
- InjectHook(0x4C449F, SetRendererForAtomic, PATCH_CALL);
- Patch(0x734A09, TwoPassAlphaRender_aap);
- Patch(0x734957, TwoPassAlphaRender_aap);
- Patch(0x734C8E, RenderBigVehicleActomic);
- }
-
- if ( !bSAMP && GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", TRUE, wcModulePath) != FALSE )
- {
- // Shaders!
- // plugin-sdk compatibility
- // 1.01 needs to reverse Initialise3D
- InitialiseRenderWare = (bool(*)())(*(int*)0x5BFB9F + 0x5BFB9E + 5);
- ShutdownRenderWare = (void(*)())(*(int*)0x53DDB1 + 0x53DDB0 + 5);
- sub_5DA6A0 = (void(*)(void*,void*,void*,void*))(*(int*)0x5D6ED2 + 0x5D6ED1 + 5);
-
- InjectHook(0x5BFB70, Initialise3D, PATCH_JUMP);
- InjectHook(0x5D6ED1, SetShader2);
- InjectHook(0x5D68F6, UsageIndex1, PATCH_JUMP);
- InjectHook(0x5D6B97, PassDayColoursToShader, PATCH_JUMP);
- InjectHook(0x5D6B5B, HijackEsi, PATCH_JUMP);
- //InjectHook(0x5BF3A1, ShaderAttach);
- InjectHook(0x53DDB0, ShaderDetach);
- Patch(0x5D6FD4, HijackAtomic);
- Patch(0x5D79E0, 0xC3);
- Patch(0x5D6F9B, 0x6890);
- Patch(0x5D6FB7, 0x6890);
- Patch(0x5D6F9D, 0x5D67C0);
- Patch(0x5D6FB9, 0x5D67C0);
-
- Patch(0x5D68B9, D3DDECLTYPE_D3DCOLOR);
- Patch(0x5D68C2, D3DDECLUSAGE_COLOR);
- Patch(0x5D68AF, sizeof(D3DCOLOR));
- Patch(0x5D68CA, sizeof(D3DCOLOR));
- Patch(0x5D68A2, 0x13);
- Patch(0x5D6AD0, 0xEB);
-
- if ( *(DWORD*)0x5DAEC0 == 0x0C2444F6 )
- {
- InjectHook(0x5DAEC0 + 0xA3, SetShader);
- Patch(0x5DAEC0 + 0x9F, 0x90909056);
- }
- else
- {
- // securom'd EXE
- if ( *(DWORD*)0x14D0882 == 0x51104E8B )
- {
- InjectHook(0x14D088B, SetShader, PATCH_JUMP);
- Patch(0x14D0882, 0x90909056);
- }
- }
-
- // PostFX fix
- Patch(*(float**)0x703CF0, 0.0);
- }
-
- // Weapons rendering
- InjectHook(0x5E8079, RenderWeapon);
- InjectHook(0x733760, RenderWeaponPedsForPC, PATCH_JUMP);
- }
-
- if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableScriptFixes", TRUE, wcModulePath) != FALSE )
- {
- // Gym glitch fix
- Patch(0x470B83, 0xCD8B);
- Patch(0x470B8A, 0x8B04508B);
- Patch(0x470B8E, 0x9000);
- Nop(0x470B90, 1);
- InjectHook(0x470B85, &CRunningScript::GetDay_GymGlitch, PATCH_CALL);
-
- // Basketball fix
- WipeLocalVariableMemoryForMissionScript = (void(*)())(*(int*)0x489AF1 + 0x489AF0 + 5);
- TheScriptsLoad = (void(*)())(*(int*)0x5D20D1 + 0x5D20D0 + 5);
- InjectHook(0x5D20D0, TheScriptsLoad_BasketballFix);
- // Fixed for Hoodlum
- InjectHook(0x489A70, StartNewMission_BasketballFix);
- InjectHook(0x489AF0, StartNewMission_BasketballFix);
- }
-
- if ( GetPrivateProfileIntW(L"SilentPatch", L"SkipIntroSplashes", TRUE, wcModulePath) != FALSE )
- {
- // Skip the damn intro splash
- Patch(AddressByRegion_11(0x749388), 0x62EB);
- }
-
- if ( GetPrivateProfileIntW(L"SilentPatch", L"SmallSteamTexts", TRUE, wcModulePath) != FALSE )
- {
- // We're on 1.01 - make texts smaller
- Patch(0x58CB57, &fSteamSubtitleSizeY);
- Patch(0x58CBDF, &fSteamSubtitleSizeY);
- Patch(0x58CC9E, &fSteamSubtitleSizeY);
-
- Patch(0x58CB6D, &fSteamSubtitleSizeX);
- Patch(0x58CBF5, &fSteamSubtitleSizeX);
- Patch(0x58CCB4, &fSteamSubtitleSizeX);
-
- Patch(0x4EA428, &fSteamRadioNamePosY);
- Patch(0x4EA372, &fSteamRadioNameSizeY);
- Patch(0x4EA388, &fSteamRadioNameSizeX);
- }
-
- if ( GetPrivateProfileIntW(L"SilentPatch", L"ColouredZoneNames", FALSE, wcModulePath) != FALSE )
- {
- // Coloured zone names
- Patch(0x58B58E, 0x0E75);
- Patch(0x58B595, 0x0775);
-
- InjectHook(0x58B5B4, &CRGBA::BlendGangColour);
- }
- else
- {
- Patch(0x58B57E, 0xEB);
- }
-
- // ImVehFt conflicts
- if ( !bHasImVehFt )
- {
- // Lights
- InjectHook(0x4C838C, LightMaterialsFix, PATCH_CALL);
-
- // Flying components
- InjectHook(0x59F950, &CObject::Render_Stub, PATCH_JUMP);
- }
-
- if ( !bHasImVehFt && !bSAMP )
- {
- // Properly random numberplates
- DWORD* pVMT = *(DWORD**)0x4C767C;
- Patch(&pVMT[7], &CVehicleModelInfo::Shutdown_Stub);
- Patch(0x6D1663, 0xEB);
- InjectHook(0x4C984D, &CVehicleModelInfo::SetCarCustomPlate);
- InjectHook(0x6D7288, &CVehicle::CustomCarPlate_TextureCreate);
- InjectHook(0x6D6D4C, &CVehicle::CustomCarPlate_BeforeRenderingStart);
- InjectHook(0x6FE810, CCustomCarPlateMgr::SetupClumpAfterVehicleUpgrade, PATCH_JUMP);
- Nop(0x6D6D47, 2);
- }
-
- // SSE conflicts
- if ( GetModuleHandle("shadows.asi") == nullptr )
- {
- Patch(0x706E8C, 0x52909090);
- InjectHook(0x706E92, &CShadowCamera::Update);
- }
-
- // Bigger streamed entity linked lists
- // Increase only if they're not increased already
- if ( *(DWORD*)0x5B9635 == 12000 )
- {
- Patch(0x5B9635, 15000);
- Patch(0x5B9690, 15000);
- }
-
- return FALSE;
- }
- return TRUE;
-}
-
-BOOL InjectDelayedPatches_Steam()
-{
- if ( !IsAlreadyRunning() )
- {
- using namespace MemoryVP;
-
- // Obtain a path to the ASI
- wchar_t wcModulePath[MAX_PATH];
-
- GetModuleFileNameW(hDLLModule, wcModulePath, MAX_PATH);
-
- // ASI -> INI
- size_t nLen = wcslen(wcModulePath);
- wcModulePath[nLen-1] = L'i';
- wcModulePath[nLen-2] = L'n';
- wcModulePath[nLen-3] = L'i';
-
- bool bHasImVehFt = GetModuleHandle("ImVehFt.asi") != nullptr;
- bool bSAMP = GetModuleHandle("samp") != nullptr;
- bool bSARender = GetModuleHandle("SARender.asi") != nullptr;
-
- // PS2 sun - more
- if ( !bSAMP )
- {
- DoSunAndMoon = (void(*)())(*(int*)0x54E0B7 + 0x54E0B6 + 5);
- InjectHook(0x54E0B6, SunAndMoonFarClip);
-
- Patch(0x734DEA, &fSunFarClip);
- }
-
- if ( !bSARender )
- {
- // Twopass rendering (experimental)
- unsigned int dwTwoPassMethod = GetPrivateProfileIntW(L"SilentPatch", L"TwoPassRendering", 0, wcModulePath);
- Patch(0x4CEBF3, 0x57);
- Patch(0x4CEBF9, 0xC25E5F5F);
- Patch(0x4CEBFD, 0x0004);
-
- if ( dwTwoPassMethod == 1 )
- {
- // Silent's twopass
- InjectHook(0x4CEBF4, SetRendererForAtomic, PATCH_CALL);
- Patch(0x76E230, TwoPassAlphaRender_Silent);
- Patch(0x76E160, TwoPassAlphaRender_Silent);
- Patch(0x76E4F0, RenderBigVehicleActomic);
- // Twopass for peds
- InjectHook(0x76D88E, RenderPedCB);
- }
- else if ( dwTwoPassMethod == 2 )
- {
- // aap's twopass
- InjectHook(0x4CEBF4, SetRendererForAtomic_NoTest, PATCH_CALL);
- Patch(0x76E230, TwoPassAlphaRender_aap);
- Patch(0x76E160, TwoPassAlphaRender_aap);
- Patch(0x76E4F0, RenderBigVehicleActomic);
- // Twopass for peds
- InjectHook(0x76D88E, RenderPedCB);
- }
- else
- {
- InjectHook(0x4CEBF4, SetRendererForAtomic, PATCH_CALL);
- Patch(0x76E230, TwoPassAlphaRender_aap);
- Patch(0x76E160, TwoPassAlphaRender_aap);
- Patch(0x76E4F0, RenderBigVehicleActomic);
- }
-
- if ( !bSAMP && GetPrivateProfileIntW(L"SilentPatch", L"NVCShader", TRUE, wcModulePath) != FALSE )
- {
- // Shaders!
- // plugin-sdk compatibility
- InitialiseRenderWare = (bool(*)())(*(int*)0x5DE5A2 + 0x5DE5A1 + 5);
- ShutdownRenderWare = (void(*)())(*(int*)0x550071 + 0x550070 + 5);
- sub_5DA6A0 = (void(*)(void*,void*,void*,void*))(*(int*)0x5F663F + 0x5F663E + 5);
-
- InjectHook(0x5F6EB3, SetShader);
- InjectHook(0x5F2F02, SetShader2);
- //InjectHook(0x5F292C, UsageIndex1, PATCH_JUMP);
- InjectHook(0x5F2BAF, PassDayColoursToShader_Steam, PATCH_JUMP);
- InjectHook(0x5F2B7A, HijackEsi, PATCH_JUMP);
- InjectHook(0x5DE5A1, ShaderAttach);
- InjectHook(0x550070, ShaderDetach);
- Patch(0x5F3004, HijackAtomic);
- Patch(0x5F3760, 0xC3);
- Patch(0x5F2FCB, 0x6890);
- Patch(0x5F2FE7, 0x6890);
- Patch(0x5F2FCD, 0x5F27C0);
- Patch(0x5F2FE9, 0x5F27C0);
- Patch(0x5F6EAF, 0x90909056);
-
- Patch(0x5F28D0, 1);
- Patch(0x5F28C1, D3DDECLTYPE_D3DCOLOR);
- Patch(0x5F28CB, D3DDECLUSAGE_COLOR);
- //Patch(0x5D60CF, sizeof(D3DCOLOR));
- //Patch(0x5D60EA, sizeof(D3DCOLOR));
- InjectHook(0x5F28A7, ChangeEdi_Steam, PATCH_CALL);
- //Patch(0x5D60C2, 0x13);
- Patch(0x5F2AE7, 0xEB);
-
- // PostFX fix
- Patch(*(float**)0x746E57, 0.0);
- }
-
- // Weapons rendering
- InjectHook(0x604DD9, RenderWeapon);
- InjectHook(0x76D170, RenderWeaponPedsForPC, PATCH_JUMP);
- }
-
- if ( GetPrivateProfileIntW(L"SilentPatch", L"EnableScriptFixes", TRUE, wcModulePath) != FALSE )
- {
- // Gym glitch fix
- Patch(0x476C2A, 0xCD8B);
- Patch