Skip to content

Commit f8e0385

Browse files
committed
Support other DN [DX11] Private Servers
1 parent fced13e commit f8e0385

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

impl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const DeviceProcs* getDeviceProcs(ID3D11Device* pDevice) {
5050
return &g_deviceProcs;
5151
}
5252

53-
// This game hates and crashes when other shaders
53+
// This game hates when other shaders
5454
// don't have a vertex shader when doing
5555
// pixel shader changes, but it's fine the other way around.
5656

impl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define IMPL_H
33

44
#include <bit>
5+
#include <cstdint>
56
#include <d3d11.h>
67

78
#include "log.h"
@@ -10,7 +11,6 @@ namespace atfix {
1011

1112
void hookDevice(ID3D11Device* pDevice);
1213
ID3D11DeviceContext* hookContext(ID3D11DeviceContext* pContext);
13-
inline const std::uintptr_t modulebase = std::bit_cast<std::uintptr_t>(GetModuleHandleA("dragonnest_x64.exe"));
1414
inline void* SettingsAddress = nullptr;
1515

1616
/* lives in main.cpp */

main.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,13 @@ D3D11Proc loadSystemD3D11() {
8585

8686
}
8787
void sigscan() {
88+
const std::uintptr_t modulebase = std::bit_cast<std::uintptr_t>(GetModuleHandleA(0));
8889
const auto scanner = LightningScanner::Scanner("83 3d ?? ?? ?? ?? ?? 41 0f 9c c0");
89-
void* result = scanner.Find(std::bit_cast<void*>(atfix::modulebase), 0x154B000).Get<void*>();
90+
void* result = scanner.Find(std::bit_cast<void*>(modulebase), 0x154B000).Get<void*>();
9091

91-
DWORD RVA = *std::bit_cast<DWORD*>(std::bit_cast<uintptr_t>(result) + 2);
92-
DWORD AbsoAddress = (DWORD)((RVA + (DWORD)(std::bit_cast<uintptr_t>(result) + 7)) - atfix::modulebase);
93-
atfix::SettingsAddress = (void*)(atfix::modulebase + AbsoAddress);
92+
const DWORD RVA = *std::bit_cast<DWORD*>(std::bit_cast<uintptr_t>(result) + 2);
93+
const DWORD AbsoAddress = static_cast<DWORD>((RVA + (DWORD)(std::bit_cast<uintptr_t>(result) + 7)) - modulebase);
94+
atfix::SettingsAddress = std::bit_cast<void*>(modulebase + AbsoAddress);
9495
}
9596
extern "C" {
9697

0 commit comments

Comments
 (0)