e0e756333f
Viewport fix without patching (1440p+ issues) Now default to d3d9.dll wrapper, delete old dinput8.dll Possibility to use DXVK on Windows - rename 32bit DXVK d3d9.dll as dxvk.dll Disable triple buffering by default for DXVK Code refactoring MinHook as git submodule
42 lines
853 B
C++
42 lines
853 B
C++
#pragma once
|
|
#include <Windows.h>
|
|
|
|
namespace MemPatch
|
|
{
|
|
class CUnprotect
|
|
{
|
|
public:
|
|
CUnprotect(void* address, unsigned long size) : m_adress(address), m_size(size)
|
|
{
|
|
VirtualProtect(m_adress, m_size, PAGE_EXECUTE_READWRITE, &m_oldprotect);
|
|
}
|
|
|
|
~CUnprotect()
|
|
{
|
|
DWORD oldProtect;
|
|
VirtualProtect(m_adress, m_size, m_oldprotect, &oldProtect);
|
|
}
|
|
private:
|
|
void* m_adress;
|
|
unsigned long m_size;
|
|
DWORD m_oldprotect;
|
|
};
|
|
|
|
__forceinline static void Patch(void* address, void* data, unsigned long size)
|
|
{
|
|
CUnprotect unp(address, size);
|
|
memcpy(address, data, size);
|
|
}
|
|
|
|
__forceinline static void Fill(void* address, unsigned char byte, unsigned long size)
|
|
{
|
|
CUnprotect unp(address, size);
|
|
memset(address, byte, size);
|
|
}
|
|
|
|
__forceinline static void Nop(void* address, unsigned long size)
|
|
{
|
|
Fill(address, 0x90, size);
|
|
}
|
|
|
|
} |