diff --git a/SAFix/SAFix.vcxproj b/SAFix/SAFix.vcxproj
index cf9af38..ec721aa 100644
--- a/SAFix/SAFix.vcxproj
+++ b/SAFix/SAFix.vcxproj
@@ -114,12 +114,12 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio
Document
- fxc /T vs_2_0 /E NVC_vertex_shader /Fh ..\SilentPatch\nvc.h ..\SilentPatch\nvc.fx
- ..\SilentPatch\nvc.h
+ fxc /T vs_2_0 /E NVC_vertex_shader /Fo ..\SilentPatch\nvc.cso ..\SilentPatch\nvc.fx
+ ..\SilentPatch\nvc.cso
Compiling shaders...
- fxc /T vs_2_0 /E NVC_vertex_shader /Fh ..\SilentPatch\nvc.h ..\SilentPatch\nvc.fx
+ fxc /T vs_2_0 /E NVC_vertex_shader /Fo ..\SilentPatch\nvc.cso ..\SilentPatch\nvc.fx
Compiling shaders...
- ..\SilentPatch\nvc.h
+ ..\SilentPatch\nvc.cso
Document
@@ -141,11 +141,15 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio
+
+
+
+
diff --git a/SAFix/SAFix.vcxproj.filters b/SAFix/SAFix.vcxproj.filters
index adc650e..626bdd9 100644
--- a/SAFix/SAFix.vcxproj.filters
+++ b/SAFix/SAFix.vcxproj.filters
@@ -110,6 +110,9 @@
Header Files
+
+ Header Files
+
@@ -121,4 +124,9 @@
Source Files
+
+
+ Resource Files
+
+
\ No newline at end of file
diff --git a/SAFix/Shaders.rc b/SAFix/Shaders.rc
new file mode 100644
index 0000000..be9fe6e
Binary files /dev/null and b/SAFix/Shaders.rc differ
diff --git a/SAFix/SilentPatchSA.cpp b/SAFix/SilentPatchSA.cpp
index 61bc630..6d800f1 100644
--- a/SAFix/SilentPatchSA.cpp
+++ b/SAFix/SilentPatchSA.cpp
@@ -728,8 +728,6 @@ void DrawRect_HalfPixel_Steam(CRect& rect, const CRGBA& rgba)
((void(*)(const CRect&, const CRGBA&))0x75CDA0)(rect, rgba);
}
-#include "nvc.h"
-
static IDirect3DVertexShader9* pNVCShader = nullptr;
static bool bRenderNVC = false;
static RpAtomic* pRenderedAtomic;
@@ -739,7 +737,15 @@ bool ShaderAttach()
// CGame::InitialiseRenderWare
if ( InitialiseRenderWare() )
{
- RwD3D9CreateVertexShader(reinterpret_cast(g_vs20_NVC_vertex_shader), reinterpret_cast(&pNVCShader));
+ 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;
diff --git a/SAFix/StdAfxSA.h b/SAFix/StdAfxSA.h
index 4a42ebe..7d54a57 100644
--- a/SAFix/StdAfxSA.h
+++ b/SAFix/StdAfxSA.h
@@ -8,8 +8,8 @@
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
-#define WINVER 0x0500
-#define _WIN32_WINNT 0x0500
+#define WINVER 0x0501
+#define _WIN32_WINNT 0x0501
#include
#include
@@ -33,6 +33,8 @@
#include
+#include "resource.h"
+
#include "MemoryMgr.h"
#include "Maths.h"
diff --git a/SAFix/resource.h b/SAFix/resource.h
new file mode 100644
index 0000000..b26528c
--- /dev/null
+++ b/SAFix/resource.h
@@ -0,0 +1 @@
+#define IDR_NVCSHADER 101
diff --git a/SilentPatch/nvc.h b/SilentPatch/nvc.h
deleted file mode 100644
index 98af506..0000000
--- a/SilentPatch/nvc.h
+++ /dev/null
@@ -1,177 +0,0 @@
-#if 0
-//
-// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384
-//
-// Parameters:
-//
-// float4 AmbientLight;
-// float2 fEnvVars;
-// float4x4 proj;
-// float4x4 view;
-// float4x4 world;
-//
-//
-// Registers:
-//
-// Name Reg Size
-// ------------ ----- ----
-// fEnvVars c0 1
-// AmbientLight c1 1
-// world c2 4
-// view c6 4
-// proj c10 4
-//
-
- vs_2_0
- def c14, 0, 1, 0, 0
- dcl_position v0
- dcl_texcoord v1
- dcl_color v2
- dcl_color1 v3
- mul r0, v0.y, c3
- mad r0, c2, v0.x, r0
- mad r0, c4, v0.z, r0
- mad r0, c5, v0.w, r0
- mul r1, r0.y, c7
- mad r1, c6, r0.x, r1
- mad r1, c8, r0.z, r1
- mad r0, c9, r0.w, r1
- mul r1, r0.y, c11
- mad r1, c10, r0.x, r1
- mad r1, c12, r0.z, r1
- mad oPos, c13, r0.w, r1
- mov r0.xyz, v3
- add r0.xyz, -r0, v2
- mad r0.xyz, c0.x, r0, v3
- add r0.xyz, r0, c1
- mul r0.w, v2.w, c0.y
- max r0, r0, c14.x
- min oD0, r0, c14.y
- mov oT0.xy, v1
-
-// approximately 20 instruction slots used
-#endif
-
-const BYTE g_vs20_NVC_vertex_shader[] =
-{
- 0, 2, 254, 255, 254, 255,
- 71, 0, 67, 84, 65, 66,
- 28, 0, 0, 0, 230, 0,
- 0, 0, 0, 2, 254, 255,
- 5, 0, 0, 0, 28, 0,
- 0, 0, 0, 1, 0, 0,
- 223, 0, 0, 0, 128, 0,
- 0, 0, 2, 0, 1, 0,
- 1, 0, 6, 0, 144, 0,
- 0, 0, 0, 0, 0, 0,
- 160, 0, 0, 0, 2, 0,
- 0, 0, 1, 0, 2, 0,
- 172, 0, 0, 0, 0, 0,
- 0, 0, 188, 0, 0, 0,
- 2, 0, 10, 0, 4, 0,
- 42, 0, 196, 0, 0, 0,
- 0, 0, 0, 0, 212, 0,
- 0, 0, 2, 0, 6, 0,
- 4, 0, 26, 0, 196, 0,
- 0, 0, 0, 0, 0, 0,
- 217, 0, 0, 0, 2, 0,
- 2, 0, 4, 0, 10, 0,
- 196, 0, 0, 0, 0, 0,
- 0, 0, 65, 109, 98, 105,
- 101, 110, 116, 76, 105, 103,
- 104, 116, 0, 171, 171, 171,
- 1, 0, 3, 0, 1, 0,
- 4, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 102, 69,
- 110, 118, 86, 97, 114, 115,
- 0, 171, 171, 171, 1, 0,
- 3, 0, 1, 0, 2, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 112, 114, 111, 106,
- 0, 171, 171, 171, 3, 0,
- 3, 0, 4, 0, 4, 0,
- 1, 0, 0, 0, 0, 0,
- 0, 0, 118, 105, 101, 119,
- 0, 119, 111, 114, 108, 100,
- 0, 118, 115, 95, 50, 95,
- 48, 0, 77, 105, 99, 114,
- 111, 115, 111, 102, 116, 32,
- 40, 82, 41, 32, 72, 76,
- 83, 76, 32, 83, 104, 97,
- 100, 101, 114, 32, 67, 111,
- 109, 112, 105, 108, 101, 114,
- 32, 54, 46, 51, 46, 57,
- 54, 48, 48, 46, 49, 54,
- 51, 56, 52, 0, 81, 0,
- 0, 5, 14, 0, 15, 160,
- 0, 0, 0, 0, 0, 0,
- 128, 63, 0, 0, 0, 0,
- 0, 0, 0, 0, 31, 0,
- 0, 2, 0, 0, 0, 128,
- 0, 0, 15, 144, 31, 0,
- 0, 2, 5, 0, 0, 128,
- 1, 0, 15, 144, 31, 0,
- 0, 2, 10, 0, 0, 128,
- 2, 0, 15, 144, 31, 0,
- 0, 2, 10, 0, 1, 128,
- 3, 0, 15, 144, 5, 0,
- 0, 3, 0, 0, 15, 128,
- 0, 0, 85, 144, 3, 0,
- 228, 160, 4, 0, 0, 4,
- 0, 0, 15, 128, 2, 0,
- 228, 160, 0, 0, 0, 144,
- 0, 0, 228, 128, 4, 0,
- 0, 4, 0, 0, 15, 128,
- 4, 0, 228, 160, 0, 0,
- 170, 144, 0, 0, 228, 128,
- 4, 0, 0, 4, 0, 0,
- 15, 128, 5, 0, 228, 160,
- 0, 0, 255, 144, 0, 0,
- 228, 128, 5, 0, 0, 3,
- 1, 0, 15, 128, 0, 0,
- 85, 128, 7, 0, 228, 160,
- 4, 0, 0, 4, 1, 0,
- 15, 128, 6, 0, 228, 160,
- 0, 0, 0, 128, 1, 0,
- 228, 128, 4, 0, 0, 4,
- 1, 0, 15, 128, 8, 0,
- 228, 160, 0, 0, 170, 128,
- 1, 0, 228, 128, 4, 0,
- 0, 4, 0, 0, 15, 128,
- 9, 0, 228, 160, 0, 0,
- 255, 128, 1, 0, 228, 128,
- 5, 0, 0, 3, 1, 0,
- 15, 128, 0, 0, 85, 128,
- 11, 0, 228, 160, 4, 0,
- 0, 4, 1, 0, 15, 128,
- 10, 0, 228, 160, 0, 0,
- 0, 128, 1, 0, 228, 128,
- 4, 0, 0, 4, 1, 0,
- 15, 128, 12, 0, 228, 160,
- 0, 0, 170, 128, 1, 0,
- 228, 128, 4, 0, 0, 4,
- 0, 0, 15, 192, 13, 0,
- 228, 160, 0, 0, 255, 128,
- 1, 0, 228, 128, 1, 0,
- 0, 2, 0, 0, 7, 128,
- 3, 0, 228, 144, 2, 0,
- 0, 3, 0, 0, 7, 128,
- 0, 0, 228, 129, 2, 0,
- 228, 144, 4, 0, 0, 4,
- 0, 0, 7, 128, 0, 0,
- 0, 160, 0, 0, 228, 128,
- 3, 0, 228, 144, 2, 0,
- 0, 3, 0, 0, 7, 128,
- 0, 0, 228, 128, 1, 0,
- 228, 160, 5, 0, 0, 3,
- 0, 0, 8, 128, 2, 0,
- 255, 144, 0, 0, 85, 160,
- 11, 0, 0, 3, 0, 0,
- 15, 128, 0, 0, 228, 128,
- 14, 0, 0, 160, 10, 0,
- 0, 3, 0, 0, 15, 208,
- 0, 0, 228, 128, 14, 0,
- 85, 160, 1, 0, 0, 2,
- 0, 0, 3, 224, 1, 0,
- 228, 144, 255, 255, 0, 0
-};