From 623ed04fc8c7d15d164d4a91ea3f2c5e408c3e6c Mon Sep 17 00:00:00 2001
From: illusion0001 <37698908+illusion0001@users.noreply.github.com>
Date: Sun, 21 May 2023 15:49:41 -0500
Subject: [PATCH] BFV: No TAA Patch
---
.github/README.md | 13 ++
Windows-Game-Patches.sln | 28 +++
source/BFV.NoTAA/BFV.NoTAA.sln | 31 ++++
source/BFV.NoTAA/BFV.NoTAA.vcxproj | 191 +++++++++++++++++++++
source/BFV.NoTAA/BFV.NoTAA.vcxproj.filters | 38 ++++
source/BFV.NoTAA/BFV.NoTAA.vcxproj.user | 4 +
source/BFV.NoTAA/dllmain.cpp | 174 +++++++++++++++++++
7 files changed, 479 insertions(+)
create mode 100644 source/BFV.NoTAA/BFV.NoTAA.sln
create mode 100644 source/BFV.NoTAA/BFV.NoTAA.vcxproj
create mode 100644 source/BFV.NoTAA/BFV.NoTAA.vcxproj.filters
create mode 100644 source/BFV.NoTAA/BFV.NoTAA.vcxproj.user
create mode 100644 source/BFV.NoTAA/dllmain.cpp
diff --git a/.github/README.md b/.github/README.md
index e28a3d9..2ece47d 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -6,6 +6,19 @@
# Patches
+### **Battlefield V**
+ - Disable TAA
+ - Custom Internal AA Options.
+ - PostProcessAAMode_None: `0`
+ - PostProcessAAMode_FxaaLow: `1`
+ - PostProcessAAMode_FxaaMedium: `2`
+ - PostProcessAAMode_FxaaHigh: `3`
+ - PostProcessAAMode_FxaaCompute: `4`
+ - PostProcessAAMode_FxaaComputeExtreme: `5`
+ - PostProcessAAMode_Smaa1x: `6`
+ - PostProcessAAMode_SmaaT2x: `7`
+ - PostProcessAAMode_TemporalAA: `8`
+
### **Bright Memory: Infinite**
- Disable TAA
- Disable Sharpness
diff --git a/Windows-Game-Patches.sln b/Windows-Game-Patches.sln
index b1469b4..48a24df 100644
--- a/Windows-Game-Patches.sln
+++ b/Windows-Game-Patches.sln
@@ -11,28 +11,56 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RE4.Sharpness", "source\RE4
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "T1X.DebugFeatures", "source\T1X.DebugFeatures\T1X.DebugFeatures.vcxproj", "{DAD6F012-4CAF-4697-9FF6-BF9B6B570365}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BFV.NoTAA", "source\BFV.NoTAA\BFV.NoTAA.vcxproj", "{FAC97ED2-0898-4796-8608-5AA4B22AD75D}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
Release|x64 = Release|x64
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Debug|x64.ActiveCfg = Debug|x64
{AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Debug|x64.Build.0 = Debug|x64
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Debug|x86.ActiveCfg = Debug|Win32
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Debug|x86.Build.0 = Debug|Win32
{AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Release|x64.ActiveCfg = Release|x64
{AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Release|x64.Build.0 = Release|x64
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Release|x86.ActiveCfg = Release|Win32
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Release|x86.Build.0 = Release|Win32
{79A1474E-D401-4FCA-AD8F-0081E94750DA}.Debug|x64.ActiveCfg = Debug|x64
{79A1474E-D401-4FCA-AD8F-0081E94750DA}.Debug|x64.Build.0 = Debug|x64
+ {79A1474E-D401-4FCA-AD8F-0081E94750DA}.Debug|x86.ActiveCfg = Debug|Win32
+ {79A1474E-D401-4FCA-AD8F-0081E94750DA}.Debug|x86.Build.0 = Debug|Win32
{79A1474E-D401-4FCA-AD8F-0081E94750DA}.Release|x64.ActiveCfg = Release|x64
{79A1474E-D401-4FCA-AD8F-0081E94750DA}.Release|x64.Build.0 = Release|x64
+ {79A1474E-D401-4FCA-AD8F-0081E94750DA}.Release|x86.ActiveCfg = Release|Win32
+ {79A1474E-D401-4FCA-AD8F-0081E94750DA}.Release|x86.Build.0 = Release|Win32
{D9DB74DD-4579-4244-BA7A-4236CF585026}.Debug|x64.ActiveCfg = Debug|x64
{D9DB74DD-4579-4244-BA7A-4236CF585026}.Debug|x64.Build.0 = Debug|x64
+ {D9DB74DD-4579-4244-BA7A-4236CF585026}.Debug|x86.ActiveCfg = Debug|Win32
+ {D9DB74DD-4579-4244-BA7A-4236CF585026}.Debug|x86.Build.0 = Debug|Win32
{D9DB74DD-4579-4244-BA7A-4236CF585026}.Release|x64.ActiveCfg = Release|x64
{D9DB74DD-4579-4244-BA7A-4236CF585026}.Release|x64.Build.0 = Release|x64
+ {D9DB74DD-4579-4244-BA7A-4236CF585026}.Release|x86.ActiveCfg = Release|Win32
+ {D9DB74DD-4579-4244-BA7A-4236CF585026}.Release|x86.Build.0 = Release|Win32
{DAD6F012-4CAF-4697-9FF6-BF9B6B570365}.Debug|x64.ActiveCfg = Debug|x64
{DAD6F012-4CAF-4697-9FF6-BF9B6B570365}.Debug|x64.Build.0 = Debug|x64
+ {DAD6F012-4CAF-4697-9FF6-BF9B6B570365}.Debug|x86.ActiveCfg = Debug|Win32
+ {DAD6F012-4CAF-4697-9FF6-BF9B6B570365}.Debug|x86.Build.0 = Debug|Win32
{DAD6F012-4CAF-4697-9FF6-BF9B6B570365}.Release|x64.ActiveCfg = Release|x64
{DAD6F012-4CAF-4697-9FF6-BF9B6B570365}.Release|x64.Build.0 = Release|x64
+ {DAD6F012-4CAF-4697-9FF6-BF9B6B570365}.Release|x86.ActiveCfg = Release|Win32
+ {DAD6F012-4CAF-4697-9FF6-BF9B6B570365}.Release|x86.Build.0 = Release|Win32
+ {FAC97ED2-0898-4796-8608-5AA4B22AD75D}.Debug|x64.ActiveCfg = Debug|x64
+ {FAC97ED2-0898-4796-8608-5AA4B22AD75D}.Debug|x64.Build.0 = Debug|x64
+ {FAC97ED2-0898-4796-8608-5AA4B22AD75D}.Debug|x86.ActiveCfg = Debug|Win32
+ {FAC97ED2-0898-4796-8608-5AA4B22AD75D}.Debug|x86.Build.0 = Debug|Win32
+ {FAC97ED2-0898-4796-8608-5AA4B22AD75D}.Release|x64.ActiveCfg = Release|x64
+ {FAC97ED2-0898-4796-8608-5AA4B22AD75D}.Release|x64.Build.0 = Release|x64
+ {FAC97ED2-0898-4796-8608-5AA4B22AD75D}.Release|x86.ActiveCfg = Release|Win32
+ {FAC97ED2-0898-4796-8608-5AA4B22AD75D}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/source/BFV.NoTAA/BFV.NoTAA.sln b/source/BFV.NoTAA/BFV.NoTAA.sln
new file mode 100644
index 0000000..c32729c
--- /dev/null
+++ b/source/BFV.NoTAA/BFV.NoTAA.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.33424.131
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BFV.NoTAA", "BFV.NoTAA.vcxproj", "{AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Debug|x64.ActiveCfg = Debug|x64
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Debug|x64.Build.0 = Debug|x64
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Debug|x86.ActiveCfg = Debug|Win32
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Debug|x86.Build.0 = Debug|Win32
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Release|x64.ActiveCfg = Release|x64
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Release|x64.Build.0 = Release|x64
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Release|x86.ActiveCfg = Release|Win32
+ {AB7A871D-2A06-48C6-863F-B8A0FE8F8E0B}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {CDD207AD-54BC-44A9-933A-5DFEDBD97F44}
+ EndGlobalSection
+EndGlobal
diff --git a/source/BFV.NoTAA/BFV.NoTAA.vcxproj b/source/BFV.NoTAA/BFV.NoTAA.vcxproj
new file mode 100644
index 0000000..69b1f94
--- /dev/null
+++ b/source/BFV.NoTAA/BFV.NoTAA.vcxproj
@@ -0,0 +1,191 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {FAC97ED2-0898-4796-8608-5AA4B22AD75D}
+ BrightMemoryInfiniteNoTAA
+ 10.0.22000.0
+
+
+
+ DynamicLibrary
+ true
+ v143
+ Unicode
+
+
+ DynamicLibrary
+ false
+ v143
+ true
+ Unicode
+
+
+ DynamicLibrary
+ true
+ ClangCL
+ Unicode
+
+
+ DynamicLibrary
+ false
+ ClangCL
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ \..\include\;$(IncludePath)
+ .asi
+ $(SolutionDir)$(Configuration)\
+ $(Configuration)\
+
+
+ \..\include\;$(IncludePath)
+ .asi
+ $(SolutionDir)$(Configuration)\
+ $(Configuration)\
+
+
+ .asi
+ $(Configuration)\
+
+
+ .asi
+ $(Configuration)\
+
+
+
+ Level3
+ true
+ UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS;_USRDLL
+ true
+ NotUsing
+ pch.h
+ ..\..\include\;..\..\external\;%(AdditionalIncludeDirectories)
+
+
+ Windows
+ true
+ false
+
+
+
+
+ Level3
+ true
+ true
+ true
+ UNICODE;_UNICODE;_CRT_SECURE_NO_WARNINGS;_USRDLL
+ true
+ NotUsing
+ pch.h
+ ..\..\include\;..\..\external\;%(AdditionalIncludeDirectories)
+
+
+ Windows
+ true
+ true
+ true
+ false
+
+
+
+
+ Level3
+ true
+ UNICODE;_UNICODE;_USRDLL
+ true
+ NotUsing
+ pch.h
+ ..\..\include\;..\..\external\;%(AdditionalIncludeDirectories)
+ Default
+
+
+ NotSet
+
+
+ Windows
+ true
+ false
+
+
+
+
+ Level3
+ true
+ false
+ true
+ UNICODE;_UNICODE;_USRDLL
+ true
+ NotUsing
+ pch.h
+ ..\..\include\;..\..\external\;%(AdditionalIncludeDirectories)
+ Default
+
+
+ Disabled
+ NotSet
+
+
+ Windows
+ true
+ true
+ true
+ false
+
+
+ call $(MSBuildStartupDirectory)\set_git_ver.cmd
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/BFV.NoTAA/BFV.NoTAA.vcxproj.filters b/source/BFV.NoTAA/BFV.NoTAA.vcxproj.filters
new file mode 100644
index 0000000..780a707
--- /dev/null
+++ b/source/BFV.NoTAA/BFV.NoTAA.vcxproj.filters
@@ -0,0 +1,38 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
\ No newline at end of file
diff --git a/source/BFV.NoTAA/BFV.NoTAA.vcxproj.user b/source/BFV.NoTAA/BFV.NoTAA.vcxproj.user
new file mode 100644
index 0000000..88a5509
--- /dev/null
+++ b/source/BFV.NoTAA/BFV.NoTAA.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/source/BFV.NoTAA/dllmain.cpp b/source/BFV.NoTAA/dllmain.cpp
new file mode 100644
index 0000000..da757e5
--- /dev/null
+++ b/source/BFV.NoTAA/dllmain.cpp
@@ -0,0 +1,174 @@
+#include "stdafx.h"
+#include "helper.hpp"
+#include "memory.hpp"
+#include "git_ver.h"
+
+HMODULE baseModule = GetModuleHandle(NULL);
+
+#define wstr(s) L#s
+#define wxstr(s) wstr(s)
+#define PROJECT_NAME "BFV.NoTAA"
+#define PROJECT_LOG_PATH PROJECT_NAME ".log"
+
+wchar_t exePath[_MAX_PATH] = { 0 };
+
+// INI Variables
+bool bDisableTAA;
+uint32_t uInjection_Delay;
+uint32_t uPostAA_Mode;
+
+enum PostAA_Type
+{
+ PostProcessAAMode_None = 0,
+ PostProcessAAMode_FxaaLow = 1,
+ PostProcessAAMode_FxaaMedium = 2,
+ PostProcessAAMode_FxaaHigh = 3,
+ PostProcessAAMode_FxaaCompute = 4,
+ PostProcessAAMode_FxaaComputeExtreme = 5,
+ PostProcessAAMode_Smaa1x = 6,
+ PostProcessAAMode_SmaaT2x = 7,
+ PostProcessAAMode_TemporalAA = 8
+};
+
+const wchar_t* GetPostAA_Mode(uint32_t mode)
+{
+ switch (mode)
+ {
+ case PostProcessAAMode_None:
+ return L"PostProcessAAMode_None";
+ case PostProcessAAMode_FxaaLow:
+ return L"PostProcessAAMode_FxaaLow";
+ case PostProcessAAMode_FxaaMedium:
+ return L"PostProcessAAMode_FxaaMedium";
+ case PostProcessAAMode_FxaaHigh:
+ return L"PostProcessAAMode_FxaaHigh";
+ case PostProcessAAMode_FxaaCompute:
+ return L"PostProcessAAMode_FxaaCompute";
+ case PostProcessAAMode_FxaaComputeExtreme:
+ return L"PostProcessAAMode_FxaaComputeExtreme";
+ case PostProcessAAMode_Smaa1x:
+ return L"PostProcessAAMode_Smaa1x";
+ case PostProcessAAMode_SmaaT2x:
+ return L"PostProcessAAMode_SmaaT2x";
+ case PostProcessAAMode_TemporalAA:
+ return L"PostProcessAAMode_TemporalAA";
+ default:
+ return L"Unknown";
+ }
+}
+
+void ReadConfig(void)
+{
+ inipp::Ini ini;
+ // Get game name and exe path
+ LOG(L"" PROJECT_NAME " Built: " __TIME__ " @ " __DATE__ "\n");
+ LOG(L"" GIT_COMMIT "\n");
+ LOG(L"" GIT_VER "\n");
+ LOG(L"" GIT_NUM "\n");
+ LOG(L"Game Name: %s\n", Memory::GetVersionProductName().c_str());
+ LOG(L"Game Path: %s\n", exePath);
+
+ // Initialize config
+ // UE4 games use launchers so config path is relative to launcher
+ std::wstring config_path = L"" PROJECT_NAME L".ini";
+ std::wifstream iniFile(config_path);
+ if (!iniFile)
+ {
+ // no ini, lets generate one.
+ LOG(L"Failed to load config file.\n");
+ std::wstring ini_defaults = L"[Settings]\n"
+ wstr(uInjection_Delay)" = 2 ; wait amount of seconds for patch\n"
+ wstr(bDisableTAA)" = true\n"
+ wstr(uPostAA_Mode)" = 0\n"
+ "; input corresponding numbers below\n"
+ "; Valid PostAA Mode:\n"
+ "; PostProcessAAMode_None = 0\n"
+ "; PostProcessAAMode_FxaaLow = 1\n"
+ "; PostProcessAAMode_FxaaMedium = 2\n"
+ "; PostProcessAAMode_FxaaHigh = 3\n"
+ "; PostProcessAAMode_FxaaCompute = 4\n"
+ "; PostProcessAAMode_FxaaComputeExtreme = 5\n"
+ "; PostProcessAAMode_Smaa1x = 6\n"
+ "; PostProcessAAMode_SmaaT2x = 7\n"
+ "; PostProcessAAMode_TemporalAA = 8\n";
+ std::wofstream iniFile(config_path);
+ iniFile << ini_defaults;
+ uInjection_Delay = 2;
+ bDisableTAA = true;
+ uPostAA_Mode = 0;
+ LOG(L"Created default config file.\n");
+ }
+ else
+ {
+ ini.parse(iniFile);
+ inipp::get_value(ini.sections[L"Settings"], wstr(uInjection_Delay), uInjection_Delay);
+ inipp::get_value(ini.sections[L"Settings"], wstr(bDisableTAA), bDisableTAA);
+ inipp::get_value(ini.sections[L"Settings"], wstr(uPostAA_Mode), uPostAA_Mode);
+ }
+
+ // Log config parse
+ LOG(L"%s: %u seconds\n", wstr(uInjection_Delay), uInjection_Delay);
+ LOG(L"%s: %s (%u)\n", wstr(bDisableTAA), GetBoolStr(bDisableTAA) , bDisableTAA);
+ LOG(L"%s: %s (%u)\n", wstr(uPostAA_Mode), GetPostAA_Mode(uPostAA_Mode), uPostAA_Mode);
+}
+
+void DisableTAA(void)
+{
+ if (uPostAA_Mode == PostProcessAAMode_TemporalAA)
+ {
+ LOG(L"Using PostAA Mode %u (%s). No changes made.\n", uPostAA_Mode, GetPostAA_Mode(uPostAA_Mode));
+ return;
+ }
+ unsigned char PostAA_Mode0[] = { 0xC6, 0x87, 0xE8, 0x02, 0x00, 0x00, 0x00, 0xEB, 0x1D };
+ if (uPostAA_Mode >= 0 && uPostAA_Mode <= 8)
+ {
+ PostAA_Mode0[6] = (uint8_t)uPostAA_Mode;
+ }
+ else
+ {
+ uPostAA_Mode = 0;
+ PostAA_Mode0[6] = (uint8_t)uPostAA_Mode;
+ LOG(L"Invalid PostAA mode! %u (%s)", uPostAA_Mode, GetPostAA_Mode(uPostAA_Mode));
+ LOG(L"Using default post AA mode of 0: %s", GetPostAA_Mode(uPostAA_Mode));
+ }
+ WritePatchPattern(L"83 BF E8 02 00 00 08 75 ??", PostAA_Mode0, sizeof(PostAA_Mode0), L"Disable TAA", 0);
+}
+
+DWORD __stdcall Main(void*)
+{
+ bLoggingEnabled = false;
+ uInjection_Delay = 0;
+ bDisableTAA = false;
+ uPostAA_Mode = 0;
+ wchar_t LogPath[_MAX_PATH] = { 0 };
+ wcscpy_s(exePath, _countof(exePath), GetRunningPath(exePath));
+ _snwprintf_s(LogPath, _countof(LogPath), _TRUNCATE, L"%s\\%s", exePath, L"" PROJECT_LOG_PATH);
+ LoggingInit(L"" PROJECT_NAME, LogPath);
+ ReadConfig();
+ if (uInjection_Delay > 0)
+ Sleep(uInjection_Delay * 1000);
+ if (bDisableTAA)
+ DisableTAA();
+ LOG(L"Shutting down " wstr(fp_log) " file handle.\n");
+ fclose(fp_log);
+ return true;
+}
+
+BOOL APIENTRY DllMain( HMODULE hModule,
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
+ )
+{
+ switch (ul_reason_for_call)
+ {
+ case DLL_PROCESS_ATTACH:
+ {
+ CreateThread(NULL, 0, Main, 0, NULL, 0);
+ }
+ case DLL_THREAD_ATTACH:
+ case DLL_THREAD_DETACH:
+ case DLL_PROCESS_DETACH:
+ break;
+ }
+ return TRUE;
+}