From bc29e6d6923792ebd970bc68574959ac6c056860 Mon Sep 17 00:00:00 2001 From: illusion0001 <37698908+illusion0001@users.noreply.github.com> Date: Thu, 26 Sep 2024 04:32:17 -0500 Subject: [PATCH] DD2: Sharpness Patch --- CMakeLists.txt | 1 + source/DD2.Sharpness/CMakeLists.txt | 23 ++++++++++++++ source/DD2.Sharpness/dllmain.cpp | 47 +++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 source/DD2.Sharpness/CMakeLists.txt create mode 100644 source/DD2.Sharpness/dllmain.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index a088699..29c45df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,7 @@ add_subdirectory(source/APT2.Patches) add_subdirectory(source/BFV.NoTAA) add_subdirectory(source/BrightMemoryInfinite.NoTAA) add_subdirectory(source/Control.Patches) +add_subdirectory(source/DD2.Sharpness) add_subdirectory(source/DeadSpace.NoTAA) add_subdirectory(source/DeathStranding.Fix) add_subdirectory(source/EldenRing.NoTAA) diff --git a/source/DD2.Sharpness/CMakeLists.txt b/source/DD2.Sharpness/CMakeLists.txt new file mode 100644 index 0000000..3f89069 --- /dev/null +++ b/source/DD2.Sharpness/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_path(GET CMAKE_CURRENT_SOURCE_DIR FILENAME PROJECT_NAME) +string(REPLACE " " "_" ProjectId ${PROJECT_NAME}) +project(${PROJECT_NAME}) + +file(GLOB SOURCES "*.cpp" "*.h" "../Shared/*.cpp" "../../include/*.h" "../../include/*.hpp") +add_library(${PROJECT_NAME} SHARED ${SOURCES}) + +set_target_properties( + ${PROJECT_NAME} + PROPERTIES + OUTPUT_NAME ${PROJECT_NAME} + SUFFIX ".dll" +) + +install( + FILES $ + DESTINATION ${PROJECT_NAME} OPTIONAL +) + +install( + TARGETS ${PROJECT_NAME} + DESTINATION ${PROJECT_NAME} +) diff --git a/source/DD2.Sharpness/dllmain.cpp b/source/DD2.Sharpness/dllmain.cpp new file mode 100644 index 0000000..1f7c163 --- /dev/null +++ b/source/DD2.Sharpness/dllmain.cpp @@ -0,0 +1,47 @@ +#include "stdafx.h" +#include "helper.hpp" +#include "memory.hpp" + +HMODULE baseModule{}; + +#define wstr(s) L#s +#define wxstr(s) wstr(s) +#define _PROJECT_NAME "DD2.Sharpness" +#define _PROJECT_LOG_PATH _PROJECT_NAME L".log" + +const wchar_t* g_ProgramName = L"" _PROJECT_NAME; + +static void DisableSharpness() +{ + const unsigned char patch[] = { 0x0F, 0x57, 0xC0, 0x90, 0x90 }; + WritePatchPattern(L"E8 ? ? ? ? 43 8D 04 12 0F 28 D0", patch, sizeof(patch), L"Disable Sharpness", 0); +} + +static DWORD __stdcall Main(void*) +{ + baseModule = GetModuleHandle(L"DD2.exe"); + if (baseModule) + { + DisableSharpness(); + } + return false; +} + +BOOL APIENTRY DllMain(HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved +) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + { + return Main(0); + } + default: + { + break; + } + } + return TRUE; +}