mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-25 16:54:15 +01:00
[util] Add helpers for GDI/DDI interop
This commit is contained in:
parent
c9a0f06ff4
commit
014870b1ff
@ -1,6 +1,7 @@
|
|||||||
util_src = files([
|
util_src = files([
|
||||||
'util_env.cpp',
|
'util_env.cpp',
|
||||||
'util_string.cpp',
|
'util_string.cpp',
|
||||||
|
'util_gdi.cpp',
|
||||||
|
|
||||||
'com/com_guid.cpp',
|
'com/com_guid.cpp',
|
||||||
'com/com_private_data.cpp',
|
'com/com_private_data.cpp',
|
||||||
|
33
src/util/util_gdi.cpp
Normal file
33
src/util/util_gdi.cpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#include "util_gdi.h"
|
||||||
|
#include "log/log.h"
|
||||||
|
|
||||||
|
namespace dxvk {
|
||||||
|
|
||||||
|
HMODULE GetGDIModule() {
|
||||||
|
static HMODULE module = LoadLibraryA("gdi32.dll");
|
||||||
|
return module;
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS D3DKMTCreateDCFromMemory(D3DKMT_CREATEDCFROMMEMORY* Arg1) {
|
||||||
|
static auto func = (D3DKMTCreateDCFromMemoryType)
|
||||||
|
GetProcAddress(GetGDIModule(), "D3DKMTCreateDCFromMemory");
|
||||||
|
|
||||||
|
if (func != nullptr)
|
||||||
|
return func(Arg1);
|
||||||
|
|
||||||
|
Logger::warn("D3DKMTCreateDCFromMemory: Unable to query proc address.");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
NTSTATUS D3DKMTDestroyDCFromMemory(D3DKMT_DESTROYDCFROMMEMORY* Arg1) {
|
||||||
|
static auto func = (D3DKMTDestroyDCFromMemoryType)
|
||||||
|
GetProcAddress(GetGDIModule(), "D3DKMTDestroyDCFromMemory");
|
||||||
|
|
||||||
|
if (func != nullptr)
|
||||||
|
return func(Arg1);
|
||||||
|
|
||||||
|
Logger::warn("D3DKMTDestroyDCFromMemory: Unable to query proc address.");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
32
src/util/util_gdi.h
Normal file
32
src/util/util_gdi.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <d3d9.h>
|
||||||
|
|
||||||
|
namespace dxvk {
|
||||||
|
using NTSTATUS = LONG;
|
||||||
|
|
||||||
|
// Slightly modified definitions...
|
||||||
|
struct D3DKMT_CREATEDCFROMMEMORY {
|
||||||
|
void* pMemory;
|
||||||
|
D3DFORMAT Format;
|
||||||
|
UINT Width;
|
||||||
|
UINT Height;
|
||||||
|
UINT Pitch;
|
||||||
|
HDC hDeviceDc;
|
||||||
|
PALETTEENTRY* pColorTable;
|
||||||
|
HDC hDc;
|
||||||
|
HANDLE hBitmap;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct D3DKMT_DESTROYDCFROMMEMORY {
|
||||||
|
HDC hDC = nullptr;
|
||||||
|
HANDLE hBitmap = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
using D3DKMTCreateDCFromMemoryType = NTSTATUS(STDMETHODCALLTYPE*) (D3DKMT_CREATEDCFROMMEMORY*);
|
||||||
|
NTSTATUS D3DKMTCreateDCFromMemory (D3DKMT_CREATEDCFROMMEMORY* Arg1);
|
||||||
|
|
||||||
|
using D3DKMTDestroyDCFromMemoryType = NTSTATUS(STDMETHODCALLTYPE*) (D3DKMT_DESTROYDCFROMMEMORY*);
|
||||||
|
NTSTATUS D3DKMTDestroyDCFromMemory(D3DKMT_DESTROYDCFROMMEMORY* Arg1);
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user