Skip to content

Commit

Permalink
DD2: Sharpness Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
illusion0001 committed Sep 26, 2024
1 parent d3edef6 commit 3ad092c
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 23 additions & 0 deletions source/DD2.Sharpness/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 $<TARGET_PDB_FILE:${PROJECT_NAME}>
DESTINATION ${PROJECT_NAME} OPTIONAL
)

install(
TARGETS ${PROJECT_NAME}
DESTINATION ${PROJECT_NAME}
)
47 changes: 47 additions & 0 deletions source/DD2.Sharpness/dllmain.cpp
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 3ad092c

Please sign in to comment.