Initial MSVC 2008 projects workspace

This commit is contained in:
alexey.min
2012-02-01 05:25:08 +00:00
commit 03de3bdc95
1446 changed files with 476853 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
#include "pch.h"
#include "RadarDisplay.h"
WNDPROC g_l2OriginalWndProc = (WNDPROC)NULL;
LRESULT CALLBACK ProxyWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
void InstallProxyWndProc( HWND hWndL2 )
{
if( g_l2OriginalWndProc == NULL )
g_l2OriginalWndProc = (WNDPROC)(void *)GetWindowLongPtr( hWndL2, GWLP_WNDPROC );
else
log_error( LOG_WARNING, "InstallProxyWndProc(): g_l2OriginalWndProc already is not NULL (called twice? HOW???)\n" );
// check if already intercepted
if( (void *)GetWindowLongPtr( hWndL2, GWLP_WNDPROC ) == (void *)ProxyWndProc )
log_error( LOG_WARNING, "InstallProxyWndProc(): wndproc already intercepted (called twice? HOW???)\n" );
else // intercept!
{
SetWindowLongPtr( hWndL2, GWLP_WNDPROC, (LONG_PTR)(void *)ProxyWndProc );
if( (void *)GetWindowLongPtr( hWndL2, GWLP_WNDPROC ) == (void *)ProxyWndProc )
log_error( LOG_OK, "InstallProxyWndProc(): Window procedure intercepted, new wndproc = 0x%08X\n",
(unsigned int)ProxyWndProc );
else
log_error( LOG_ERROR, "InstallProxyWndProc(): Window procedure interception failed!\n" );
}
}
LRESULT CALLBACK ProxyWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch( uMsg )
{
case WM_KEYUP:
{
int vkey = (int)wParam;
switch( vkey )
{
case VK_PAUSE:
RadarDisplay::getInstance()->toggleShowRadar();
return 0;
break;
case 'Q':
RadarDisplay::getInstance()->toggleShowCur();
return 0;
break;
}
} break;
//case WM_LBUTTONUP:
//{
//log_error( LOG_DEBUG, "WM_LBUTTONUP ( %d, %d )\n", GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) );
//} break;
}
return CallWindowProc( g_l2OriginalWndProc, hWnd, uMsg, wParam, lParam );
}

193
L2Detect_2/RadarDisplay.cpp Normal file
View File

@@ -0,0 +1,193 @@
#include "pch.h"
#include "RadarDisplay.h"
#include "l2d.h"
RadarDisplay *RadarDisplay::s_instance = NULL;
int RadarDisplay::s_refCount = 0;
RadarDisplay *RadarDisplay::getInstance()
{
if( RadarDisplay::s_instance == NULL )
{
RadarDisplay::s_instance = new RadarDisplay();
RadarDisplay::s_refCount++;
}
return RadarDisplay::s_instance;
}
void RadarDisplay::freeInstance()
{
if( RadarDisplay::s_instance )
{
RadarDisplay::s_refCount--;
if( RadarDisplay::s_refCount == 0 )
{
delete RadarDisplay::s_instance;
RadarDisplay::s_instance = NULL;
}
}
}
RadarDisplay::RadarDisplay()
{
m_hWndL2 = NULL;
// display opts
m_ui_show_radar = m_ui_show_cur = false;
// d3d9 resources
m_res_loaded = false;
m_radarTex = NULL;
m_spr = NULL;
}
RadarDisplay::~RadarDisplay()
{
}
void RadarDisplay::toggleShowRadar()
{
m_ui_show_radar = !m_ui_show_radar;
}
void RadarDisplay::toggleShowCur()
{
m_ui_show_cur = !m_ui_show_cur;
}
void RadarDisplay::preload_resources( IDirect3DDevice9 *pdevice )
{
// main radar texture
if( !m_radarTex )
{
if( preload_texture_from_file( pdevice, &m_radarTex, L"transp_r.png" ) )
log_error( LOG_OK, "RadarDisplay::preload_resources(): Loaded texture transp_r.png OK\n" );
}
if( !m_spr )
{
if( D3DXCreateSprite( pdevice, &m_spr ) != S_OK )
log_error( LOG_ERROR, "D3DXCreateSprite() FAILED!\n" );
}
m_res_loaded = true;
}
void RadarDisplay::onD3D_Release( IDirect3DDevice9 *pdevice )
{
UNREFERENCED_PARAMETER(pdevice);
// release our resources
if( m_spr )
{
m_spr->Release();
m_spr = NULL;
}
if( m_radarTex )
{
m_radarTex->Release();
m_radarTex = NULL;
}
m_res_loaded = false;
}
void RadarDisplay::onD3D_CreateDevice( HWND hWndFocus, IDirect3DDevice9 *pdevice )
{
if( hWndFocus )
{
m_hWndL2 = hWndFocus;
WINDOWINFO wi;
memset( &wi, 0, sizeof(wi) );
wi.cbSize = sizeof(WINDOWINFO);
GetWindowInfo( m_hWndL2, &wi );
LONG_PTR ptrWndProc = GetWindowLongPtr( m_hWndL2, GWLP_WNDPROC );
TCHAR className[256] = {0};
GetClassName( m_hWndL2, className, 255 );
//
log_error( LOG_DEBUG, "RadarDisplay::onD3D_CreateDevice(): got Lineage client window,\n"
" handle 0x%08X [class %S]\n"
" client rect (%d,%d)-(%d,%d) [%d x %d]; WndProc 0x%08X\n",
(unsigned int)m_hWndL2, className,
wi.rcClient.left, wi.rcClient.top, wi.rcClient.right, wi.rcClient.right,
wi.rcClient.right - wi.rcClient.left, wi.rcClient.bottom - wi.rcClient.top,
ptrWndProc );
// hook wndproc
InstallProxyWndProc( m_hWndL2 );
}
log_error( LOG_DEBUG, "RadarDisplay::onD3D_CreateDevice(): try to preload resources..\n" );
preload_resources( pdevice );
log_error( LOG_DEBUG, "RadarDisplay::onD3D_CreateDevice(): end.\n" );
}
void RadarDisplay::onD3D_Present( IDirect3DDevice9 *pdevice )
{
if( m_res_loaded ) preload_resources( pdevice );
m_spr->Begin( D3DXSPRITE_ALPHABLEND );
// follow mouse
if( m_ui_show_cur )
{
POINT pt;
GetCursorPos( &pt );
RECT rc;
GetWindowRect( m_hWndL2, &rc );
//
D3DRECT rec;
rec.x1 = pt.x - rc.left;
rec.y1 = pt.y - rc.top;
rec.x2 = rec.x1 + 50;
rec.y2 = rec.y1 + 50;
pdevice->Clear( 1, &rec, D3DCLEAR_TARGET, D3DCOLOR_ARGB(128,255,255,0), 0, 0 );
}
if( m_ui_show_radar)
{
RECT rc;
GetClientRect( m_hWndL2, &rc );
D3DXVECTOR3 pos;
pos.x = (float)(rc.right - 173);
pos.y = 0;
pos.z = 0;
m_spr->Draw( m_radarTex, NULL, NULL, &pos, 0xFFFFFFFF );
}
m_spr->End();
}
bool RadarDisplay::preload_surface_from_file( IDirect3DDevice9 *pdevice, IDirect3DSurface9 **ppSur,
const wchar_t *fileName,
UINT width, UINT height, D3DXIMAGE_FILEFORMAT fmt )
{
HRESULT hr = NO_ERROR;
hr = pdevice->CreateOffscreenPlainSurface( width, height, D3DFMT_X8R8G8B8, D3DPOOL_SYSTEMMEM, ppSur, NULL );
//hr = pdevice->CreateOffscreenPlainSurface( width, height, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, ppSur, NULL );
if( SUCCEEDED( hr ) )
{
D3DXIMAGE_INFO imageInfo;
memset( &imageInfo, 0, sizeof(imageInfo) );
imageInfo.Width = width;
imageInfo.Height = height;
imageInfo.Depth = 24;
imageInfo.ImageFileFormat = fmt;
//imageInfo.Format = D3DFMT_X8R8G8B8;
imageInfo.Format = D3DFMT_A8R8G8B8;
imageInfo.MipLevels = 1;
imageInfo.ResourceType = D3DRTYPE_SURFACE;
// ColorKey
// [in] D3DCOLOR value to replace with transparent black, or 0 to disable the colorkey.
// This is always a 32-bit ARGB color, independent of the source image format.
// Alpha is significant and should usually be set to FF for opaque color keys Thus,
// for opaque black, the value would be equal to 0xFF000000.
hr = D3DXLoadSurfaceFromFile( *ppSur, NULL, NULL,
fileName, NULL,
D3DX_FILTER_NONE, // D3DX_FILTER_TRIANGLE | D3DX_FILTER_DITHER,
D3DCOLOR_ARGB(0,0,0,0), &imageInfo );
if( FAILED( hr ) )
log_error( LOG_ERROR, "RadarDisplay::preload_surface_from_file(): Failed to load [%ux%u] [%S]! Error: %d\n",
width, height, fileName, hr );
}
else log_error( LOG_ERROR, "RadarDisplay::preload_surface_from_file(): Failed to create surface! Error: %d\n", hr );
return (hr == NO_ERROR);
}
bool RadarDisplay::preload_texture_from_file( IDirect3DDevice9 *pdevice, IDirect3DTexture9 **ppTex, const wchar_t *fileName )
{
if( D3DXCreateTextureFromFileEx( pdevice, fileName, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2,
D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, ppTex ) == S_OK )
return true;
log_error( LOG_ERROR, "RadarDisplay::preload_surface_from_file(): Failed to create texture!\n" );
return false;
}

41
L2Detect_2/RadarDisplay.h Normal file
View File

@@ -0,0 +1,41 @@
#pragma once
class RadarDisplay
{
protected:
RadarDisplay();
~RadarDisplay();
protected:
static RadarDisplay *s_instance;
static int s_refCount;
public:
static RadarDisplay *getInstance();
static void freeInstance();
public: // handlers
void onD3D_CreateDevice( HWND hWndFocus, IDirect3DDevice9 *pdevice );
void onD3D_Release( IDirect3DDevice9 *pdevice );
void onD3D_Present( IDirect3DDevice9 *pdevice );
public:
void toggleShowRadar();
void toggleShowCur();
protected:
void preload_resources( IDirect3DDevice9 *pdevice );
static bool preload_surface_from_file( IDirect3DDevice9 *pdevice, IDirect3DSurface9 **ppSur,
const wchar_t *fileName,
UINT width, UINT height, D3DXIMAGE_FILEFORMAT fmt );
static bool preload_texture_from_file( IDirect3DDevice9 *pdevice, IDirect3DTexture9 **ppTex, const wchar_t *fileName );
protected:
// render window
HWND m_hWndL2;
// show options
bool m_ui_show_radar;
bool m_ui_show_cur;
// Direct3D resources
bool m_res_loaded;
IDirect3DTexture9 *m_radarTex;
ID3DXSprite *m_spr;
};

View File

@@ -0,0 +1,154 @@
#include "pch.h"
#include "l2d.h"
#include "RadarDisplay.h"
myIDirect3D9::myIDirect3D9(IDirect3D9 *pOriginal)
{
m_pIDirect3D9 = pOriginal;
}
myIDirect3D9::~myIDirect3D9(void)
{
}
HRESULT __stdcall myIDirect3D9::QueryInterface(REFIID riid, void** ppvObj)
{
*ppvObj = NULL;
log_error( LOG_WARNING, "myIDirect3D9::QueryInterface()\n" );
// call this to increase AddRef at original object
// and to check if such an interface is there
HRESULT hRes = m_pIDirect3D9->QueryInterface(riid, ppvObj);
if (hRes == NOERROR) // if OK, send our "fake" address
{
*ppvObj = this;
}
return hRes;
}
ULONG __stdcall myIDirect3D9::AddRef(void)
{
return(m_pIDirect3D9->AddRef());
}
ULONG __stdcall myIDirect3D9::Release(void)
{
// call original routine
ULONG count = m_pIDirect3D9->Release();
// in case no further Ref is there, the Original Object has deleted itself
// so do we here
if (count == 0)
{
gl_pmyIDirect3D9 = NULL;
delete(this);
}
return(count);
}
HRESULT __stdcall myIDirect3D9::RegisterSoftwareDevice(void* pInitializeFunction)
{
return(m_pIDirect3D9->RegisterSoftwareDevice(pInitializeFunction));
}
UINT __stdcall myIDirect3D9::GetAdapterCount(void)
{
return(m_pIDirect3D9->GetAdapterCount());
}
HRESULT __stdcall myIDirect3D9::GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier)
{
return(m_pIDirect3D9->GetAdapterIdentifier(Adapter,Flags,pIdentifier));
}
UINT __stdcall myIDirect3D9::GetAdapterModeCount(UINT Adapter, D3DFORMAT Format)
{
return(m_pIDirect3D9->GetAdapterModeCount(Adapter, Format));
}
HRESULT __stdcall myIDirect3D9::EnumAdapterModes(UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode)
{
return(m_pIDirect3D9->EnumAdapterModes(Adapter,Format,Mode,pMode));
}
HRESULT __stdcall myIDirect3D9::GetAdapterDisplayMode( UINT Adapter,D3DDISPLAYMODE* pMode)
{
return(m_pIDirect3D9->GetAdapterDisplayMode(Adapter,pMode));
}
HRESULT __stdcall myIDirect3D9::CheckDeviceType(UINT iAdapter,D3DDEVTYPE DevType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed)
{
return(m_pIDirect3D9->CheckDeviceType(iAdapter,DevType,DisplayFormat,BackBufferFormat,bWindowed));
}
HRESULT __stdcall myIDirect3D9::CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat)
{
return(m_pIDirect3D9->CheckDeviceFormat(Adapter,DeviceType,AdapterFormat,Usage,RType,CheckFormat));
}
HRESULT __stdcall myIDirect3D9::CheckDeviceMultiSampleType(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels)
{
return(m_pIDirect3D9->CheckDeviceMultiSampleType(Adapter,DeviceType,SurfaceFormat,Windowed,MultiSampleType,pQualityLevels));
}
HRESULT __stdcall myIDirect3D9::CheckDepthStencilMatch(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat)
{
return(m_pIDirect3D9->CheckDepthStencilMatch(Adapter,DeviceType,AdapterFormat,RenderTargetFormat,DepthStencilFormat));
}
HRESULT __stdcall myIDirect3D9::CheckDeviceFormatConversion(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat)
{
return(m_pIDirect3D9->CheckDeviceFormatConversion(Adapter,DeviceType,SourceFormat,TargetFormat));
}
HRESULT __stdcall myIDirect3D9::GetDeviceCaps(UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps)
{
return(m_pIDirect3D9->GetDeviceCaps(Adapter,DeviceType,pCaps));
}
HMONITOR __stdcall myIDirect3D9::GetAdapterMonitor(UINT Adapter)
{
return(m_pIDirect3D9->GetAdapterMonitor(Adapter));
}
HRESULT __stdcall myIDirect3D9::CreateDevice(UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface)
{
log_error( LOG_DEBUG, "myIDirect3D9::CreateDevice() called... " );
if( pPresentationParameters->Windowed )
log_error_np( LOG_DEBUG, "Windowed mode\n" );
else
log_error_np( LOG_DEBUG, "Full-screen; RefreshRate: %u Hz\n", pPresentationParameters->FullScreen_RefreshRateInHz );
// fix back buffer format (WARNING e6aHa!!! may crash client!)
pPresentationParameters->BackBufferFormat = D3DFMT_A8R8G8B8;
// we intercept this call and provide our own "fake" Device Object
HRESULT hres = m_pIDirect3D9->CreateDevice( Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface);
#ifdef _DEBUG
log_error( LOG_DEBUG, " BackBufferCount = %u\n", pPresentationParameters->BackBufferCount );
log_error( LOG_DEBUG, " BackBufferFormat = %d\n", (int)pPresentationParameters->BackBufferFormat );
log_error( LOG_DEBUG, " BackBufferWidth = %u\n", pPresentationParameters->BackBufferWidth );
log_error( LOG_DEBUG, " BackBufferHeight = %u\n", pPresentationParameters->BackBufferHeight );
log_error( LOG_DEBUG, " MultiSampleType = 0x%08X\n", (UINT)pPresentationParameters->MultiSampleType );
log_error( LOG_DEBUG, " Flags = 0x%08X\n", pPresentationParameters->Flags );
log_error( LOG_DEBUG, " SwapEffect = 0x%08X\n", (UINT)pPresentationParameters->SwapEffect );
#endif
// Create our own Device object and store it in global pointer
// note: the object will delete itself once Ref count is zero (similar to COM objects)
gl_pmyIDirect3DDevice9 = new myIDirect3DDevice9(*ppReturnedDeviceInterface);
// store our pointer (the fake one) for returning it to the calling progam
*ppReturnedDeviceInterface = gl_pmyIDirect3DDevice9;
// notify our radar display where L2 window is
RadarDisplay::getInstance()->onD3D_CreateDevice( hFocusWindow, (*ppReturnedDeviceInterface) );
return hres;
}

View File

@@ -0,0 +1,31 @@
#pragma once
class myIDirect3D9 : public IDirect3D9
{
public:
myIDirect3D9(IDirect3D9 *pOriginal);
virtual ~myIDirect3D9(void);
// The original DX9 function definitions
HRESULT __stdcall QueryInterface(REFIID riid, void** ppvObj);
ULONG __stdcall AddRef(void);
ULONG __stdcall Release(void);
HRESULT __stdcall RegisterSoftwareDevice(void* pInitializeFunction);
UINT __stdcall GetAdapterCount(void);
HRESULT __stdcall GetAdapterIdentifier(UINT Adapter,DWORD Flags,D3DADAPTER_IDENTIFIER9* pIdentifier) ;
UINT __stdcall GetAdapterModeCount(UINT Adapter, D3DFORMAT Format);
HRESULT __stdcall EnumAdapterModes(UINT Adapter,D3DFORMAT Format,UINT Mode,D3DDISPLAYMODE* pMode) ;
HRESULT __stdcall GetAdapterDisplayMode( UINT Adapter,D3DDISPLAYMODE* pMode) ;
HRESULT __stdcall CheckDeviceType(UINT iAdapter,D3DDEVTYPE DevType,D3DFORMAT DisplayFormat,D3DFORMAT BackBufferFormat,BOOL bWindowed) ;
HRESULT __stdcall CheckDeviceFormat(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,DWORD Usage,D3DRESOURCETYPE RType,D3DFORMAT CheckFormat) ;
HRESULT __stdcall CheckDeviceMultiSampleType(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SurfaceFormat,BOOL Windowed,D3DMULTISAMPLE_TYPE MultiSampleType,DWORD* pQualityLevels) ;
HRESULT __stdcall CheckDepthStencilMatch(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT AdapterFormat,D3DFORMAT RenderTargetFormat,D3DFORMAT DepthStencilFormat) ;
HRESULT __stdcall CheckDeviceFormatConversion(UINT Adapter,D3DDEVTYPE DeviceType,D3DFORMAT SourceFormat,D3DFORMAT TargetFormat);
HRESULT __stdcall GetDeviceCaps(UINT Adapter,D3DDEVTYPE DeviceType,D3DCAPS9* pCaps) ;
HMONITOR __stdcall GetAdapterMonitor(UINT Adapter) ;
HRESULT __stdcall CreateDevice(UINT Adapter,D3DDEVTYPE DeviceType,HWND hFocusWindow,DWORD BehaviorFlags,D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DDevice9** ppReturnedDeviceInterface) ;
// The original DX9 function definitions
private:
IDirect3D9 *m_pIDirect3D9;
};

View File

@@ -0,0 +1,663 @@
#include "pch.h"
#include "l2d.h"
#include "myIDirect3DDevice9.h"
#include "RadarDisplay.h"
myIDirect3DDevice9::myIDirect3DDevice9(IDirect3DDevice9* pOriginal)
{
m_pIDirect3DDevice9 = pOriginal; // store the pointer to original object
}
myIDirect3DDevice9::~myIDirect3DDevice9(void)
{
}
HRESULT myIDirect3DDevice9::QueryInterface (REFIID riid, void** ppvObj)
{
// check if original dll can provide interface. then send *our* address
*ppvObj = NULL;
HRESULT hRes = m_pIDirect3DDevice9->QueryInterface(riid, ppvObj);
if (hRes == NOERROR)
{
*ppvObj = this;
}
return hRes;
}
ULONG myIDirect3DDevice9::AddRef(void)
{
return(m_pIDirect3DDevice9->AddRef());
}
ULONG myIDirect3DDevice9::Release(void)
{
log_error( LOG_DEBUG, "myIDirect3DDevice9::Release()\n" );
// ATTENTION: This is a booby-trap ! Watch out !
// If we create our own sprites, surfaces, etc. (thus increasing the ref counter
// by external action), we need to delete that objects before calling the original
// Release function
// release/delete own objects
RadarDisplay::getInstance()->onD3D_Release( m_pIDirect3DDevice9 );
// Calling original function now
ULONG count = m_pIDirect3DDevice9->Release();
if( count > 0 )
{
log_error( LOG_WARNING, "myIDirect3DDevice9::Release(): count = %u after IDirect3DDevice9::Release()!!\n", count );
}
// now, the Original Object has deleted itself, so do we here
gl_pmyIDirect3DDevice9 = NULL;
delete(this); // destructor will be called automatically
return (count);
}
HRESULT myIDirect3DDevice9::TestCooperativeLevel(void)
{
return(m_pIDirect3DDevice9->TestCooperativeLevel());
}
UINT myIDirect3DDevice9::GetAvailableTextureMem(void)
{
return(m_pIDirect3DDevice9->GetAvailableTextureMem());
}
HRESULT myIDirect3DDevice9::EvictManagedResources(void)
{
return(m_pIDirect3DDevice9->EvictManagedResources());
}
HRESULT myIDirect3DDevice9::GetDirect3D(IDirect3D9** ppD3D9)
{
return(m_pIDirect3DDevice9->GetDirect3D(ppD3D9));
}
HRESULT myIDirect3DDevice9::GetDeviceCaps(D3DCAPS9* pCaps)
{
return(m_pIDirect3DDevice9->GetDeviceCaps(pCaps));
}
HRESULT myIDirect3DDevice9::GetDisplayMode(UINT iSwapChain,D3DDISPLAYMODE* pMode)
{
return(m_pIDirect3DDevice9->GetDisplayMode(iSwapChain, pMode));
}
HRESULT myIDirect3DDevice9::GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters)
{
return(m_pIDirect3DDevice9->GetCreationParameters(pParameters));
}
HRESULT myIDirect3DDevice9::SetCursorProperties(UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap)
{
return(m_pIDirect3DDevice9->SetCursorProperties(XHotSpot,YHotSpot,pCursorBitmap));
}
void myIDirect3DDevice9::SetCursorPosition(int X,int Y,DWORD Flags)
{
return(m_pIDirect3DDevice9->SetCursorPosition(X,Y,Flags));
}
BOOL myIDirect3DDevice9::ShowCursor(BOOL bShow)
{
return(m_pIDirect3DDevice9->ShowCursor(bShow));
}
HRESULT myIDirect3DDevice9::CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain)
{
return(m_pIDirect3DDevice9->CreateAdditionalSwapChain(pPresentationParameters,pSwapChain));
}
HRESULT myIDirect3DDevice9::GetSwapChain(UINT iSwapChain,IDirect3DSwapChain9** pSwapChain)
{
return(m_pIDirect3DDevice9->GetSwapChain(iSwapChain,pSwapChain));
}
UINT myIDirect3DDevice9::GetNumberOfSwapChains(void)
{
return(m_pIDirect3DDevice9->GetNumberOfSwapChains());
}
HRESULT myIDirect3DDevice9::Reset(D3DPRESENT_PARAMETERS* pPresentationParameters)
{
return(m_pIDirect3DDevice9->Reset(pPresentationParameters));
}
HRESULT myIDirect3DDevice9::Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
{
// we may want to draw own things here before flipping surfaces
RadarDisplay::getInstance()->onD3D_Present( m_pIDirect3DDevice9 );
// call original routine
HRESULT hres = m_pIDirect3DDevice9->Present( pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
return (hres);
}
HRESULT myIDirect3DDevice9::GetBackBuffer(UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer)
{
return(m_pIDirect3DDevice9->GetBackBuffer(iSwapChain,iBackBuffer,Type,ppBackBuffer));
}
HRESULT myIDirect3DDevice9::GetRasterStatus(UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus)
{
return(m_pIDirect3DDevice9->GetRasterStatus(iSwapChain,pRasterStatus));
}
HRESULT myIDirect3DDevice9::SetDialogBoxMode(BOOL bEnableDialogs)
{
return(m_pIDirect3DDevice9->SetDialogBoxMode(bEnableDialogs));
}
void myIDirect3DDevice9::SetGammaRamp(UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp)
{
return(m_pIDirect3DDevice9->SetGammaRamp(iSwapChain,Flags,pRamp));
}
void myIDirect3DDevice9::GetGammaRamp(UINT iSwapChain,D3DGAMMARAMP* pRamp)
{
return(m_pIDirect3DDevice9->GetGammaRamp(iSwapChain,pRamp));
}
HRESULT myIDirect3DDevice9::CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle)
{
return(m_pIDirect3DDevice9->CreateTexture(Width,Height,Levels,Usage,Format,Pool,ppTexture,pSharedHandle));
}
HRESULT myIDirect3DDevice9::CreateVolumeTexture(UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle)
{
return(m_pIDirect3DDevice9->CreateVolumeTexture(Width,Height,Depth,Levels,Usage,Format,Pool,ppVolumeTexture,pSharedHandle));
}
HRESULT myIDirect3DDevice9::CreateCubeTexture(UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle)
{
return(m_pIDirect3DDevice9->CreateCubeTexture(EdgeLength,Levels,Usage,Format,Pool,ppCubeTexture,pSharedHandle));
}
HRESULT myIDirect3DDevice9::CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle)
{
return(m_pIDirect3DDevice9->CreateVertexBuffer(Length,Usage,FVF,Pool,ppVertexBuffer,pSharedHandle));
}
HRESULT myIDirect3DDevice9::CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle)
{
return(m_pIDirect3DDevice9->CreateIndexBuffer(Length,Usage,Format,Pool,ppIndexBuffer,pSharedHandle));
}
HRESULT myIDirect3DDevice9::CreateRenderTarget(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle)
{
HRESULT hr = m_pIDirect3DDevice9->CreateRenderTarget(Width,Height,Format,MultiSample,MultisampleQuality,Lockable,ppSurface,pSharedHandle);
//log_error( LOG_DEBUG, "CreateRenderTarget (%u x %u), lockable: %d, format: %d\n",
// Width, Height, Lockable, Format );
return hr;
}
HRESULT myIDirect3DDevice9::CreateDepthStencilSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle)
{
return(m_pIDirect3DDevice9->CreateDepthStencilSurface(Width,Height,Format,MultiSample,MultisampleQuality,Discard,ppSurface,pSharedHandle));
}
HRESULT myIDirect3DDevice9::UpdateSurface(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint)
{
return(m_pIDirect3DDevice9->UpdateSurface(pSourceSurface,pSourceRect,pDestinationSurface,pDestPoint));
}
HRESULT myIDirect3DDevice9::UpdateTexture(IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture)
{
return(m_pIDirect3DDevice9->UpdateTexture(pSourceTexture,pDestinationTexture));
}
HRESULT myIDirect3DDevice9::GetRenderTargetData(IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface)
{
return(m_pIDirect3DDevice9->GetRenderTargetData(pRenderTarget,pDestSurface));
}
HRESULT myIDirect3DDevice9::GetFrontBufferData(UINT iSwapChain,IDirect3DSurface9* pDestSurface)
{
return(m_pIDirect3DDevice9->GetFrontBufferData(iSwapChain,pDestSurface));
}
HRESULT myIDirect3DDevice9::StretchRect(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter)
{
return(m_pIDirect3DDevice9->StretchRect(pSourceSurface,pSourceRect,pDestSurface,pDestRect,Filter));
}
HRESULT myIDirect3DDevice9::ColorFill(IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color)
{
return(m_pIDirect3DDevice9->ColorFill(pSurface,pRect,color));
}
HRESULT myIDirect3DDevice9::CreateOffscreenPlainSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle)
{
HRESULT hRes = m_pIDirect3DDevice9->CreateOffscreenPlainSurface(Width,Height,Format,Pool,ppSurface,pSharedHandle);
//log_error( LOG_DEBUG, "called CreateOffscreenPlainSurface (%u x %u) fmt %d, pool %d\n",
// Width, Height, Format, Pool );
// D3DFMT_A8R8G8B8 21
// D3DPOOL_SYSTEMMEM 2
//log_error( LOG_DEBUG, " D3DFORMAT %u\n", Format );
//log_error( LOG_DEBUG, " D3DPOOL %u\n", Pool );
return hRes;
}
HRESULT myIDirect3DDevice9::SetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget)
{
return(m_pIDirect3DDevice9->SetRenderTarget(RenderTargetIndex,pRenderTarget));
}
HRESULT myIDirect3DDevice9::GetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget)
{
return(m_pIDirect3DDevice9->GetRenderTarget(RenderTargetIndex,ppRenderTarget));
}
HRESULT myIDirect3DDevice9::SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil)
{
return(m_pIDirect3DDevice9->SetDepthStencilSurface(pNewZStencil));
}
HRESULT myIDirect3DDevice9::GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface)
{
return(m_pIDirect3DDevice9->GetDepthStencilSurface(ppZStencilSurface));
}
HRESULT myIDirect3DDevice9::BeginScene(void)
{
return(m_pIDirect3DDevice9->BeginScene());
}
HRESULT myIDirect3DDevice9::EndScene(void)
{
return(m_pIDirect3DDevice9->EndScene());
}
HRESULT myIDirect3DDevice9::Clear(DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil)
{
return(m_pIDirect3DDevice9->Clear(Count,pRects,Flags,Color,Z,Stencil));
}
HRESULT myIDirect3DDevice9::SetTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix)
{
return(m_pIDirect3DDevice9->SetTransform(State,pMatrix));
}
HRESULT myIDirect3DDevice9::GetTransform(D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix)
{
return(m_pIDirect3DDevice9->GetTransform(State,pMatrix));
}
HRESULT myIDirect3DDevice9::MultiplyTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix)
{
return(m_pIDirect3DDevice9->MultiplyTransform(State,pMatrix));
}
HRESULT myIDirect3DDevice9::SetViewport(CONST D3DVIEWPORT9* pViewport)
{
return(m_pIDirect3DDevice9->SetViewport(pViewport));
}
HRESULT myIDirect3DDevice9::GetViewport(D3DVIEWPORT9* pViewport)
{
return(m_pIDirect3DDevice9->GetViewport(pViewport));
}
HRESULT myIDirect3DDevice9::SetMaterial(CONST D3DMATERIAL9* pMaterial)
{
return(m_pIDirect3DDevice9->SetMaterial(pMaterial));
}
HRESULT myIDirect3DDevice9::GetMaterial(D3DMATERIAL9* pMaterial)
{
return(m_pIDirect3DDevice9->GetMaterial(pMaterial));
}
HRESULT myIDirect3DDevice9::SetLight(DWORD Index,CONST D3DLIGHT9* pLight)
{
return(m_pIDirect3DDevice9->SetLight(Index,pLight));
}
HRESULT myIDirect3DDevice9::GetLight(DWORD Index,D3DLIGHT9* pLight)
{
return(m_pIDirect3DDevice9->GetLight(Index,pLight));
}
HRESULT myIDirect3DDevice9::LightEnable(DWORD Index,BOOL Enable)
{
return(m_pIDirect3DDevice9->LightEnable(Index,Enable));
}
HRESULT myIDirect3DDevice9::GetLightEnable(DWORD Index,BOOL* pEnable)
{
return(m_pIDirect3DDevice9->GetLightEnable(Index, pEnable));
}
HRESULT myIDirect3DDevice9::SetClipPlane(DWORD Index,CONST float* pPlane)
{
return(m_pIDirect3DDevice9->SetClipPlane(Index, pPlane));
}
HRESULT myIDirect3DDevice9::GetClipPlane(DWORD Index,float* pPlane)
{
return(m_pIDirect3DDevice9->GetClipPlane(Index,pPlane));
}
HRESULT myIDirect3DDevice9::SetRenderState(D3DRENDERSTATETYPE State,DWORD Value)
{
//switch( State )
//{
//case D3DRS_ALPHABLENDENABLE: log_error( LOG_DEBUG, "SetRenderState( D3DRS_ALPHABLENDENABLE, 0x%08X )\n", Value ); break;
//case D3DRS_SRCBLEND: log_error( LOG_DEBUG, "SetRenderState( D3DRS_SRCBLEND, 0x%08X )\n", Value ); break;
//case D3DRS_SRCBLENDALPHA: log_error( LOG_DEBUG, "SetRenderState( D3DRS_SRCBLENDALPHA, 0x%08X )\n", Value ); break;
//case D3DRS_DESTBLEND: log_error( LOG_DEBUG, "SetRenderState( D3DRS_DESTBLEND, 0x%08X )\n", Value ); break;
//case D3DRS_DESTBLENDALPHA: log_error( LOG_DEBUG, "SetRenderState( D3DRS_DESTBLENDALPHA, 0x%08X )\n", Value ); break;
//}
return(m_pIDirect3DDevice9->SetRenderState(State, Value));
}
HRESULT myIDirect3DDevice9::GetRenderState(D3DRENDERSTATETYPE State,DWORD* pValue)
{
return(m_pIDirect3DDevice9->GetRenderState(State, pValue));
}
HRESULT myIDirect3DDevice9::CreateStateBlock(D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB)
{
return(m_pIDirect3DDevice9->CreateStateBlock(Type,ppSB));
}
HRESULT myIDirect3DDevice9::BeginStateBlock(void)
{
return(m_pIDirect3DDevice9->BeginStateBlock());
}
HRESULT myIDirect3DDevice9::EndStateBlock(IDirect3DStateBlock9** ppSB)
{
return(m_pIDirect3DDevice9->EndStateBlock(ppSB));
}
HRESULT myIDirect3DDevice9::SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus)
{
return(m_pIDirect3DDevice9->SetClipStatus(pClipStatus));
}
HRESULT myIDirect3DDevice9::GetClipStatus(D3DCLIPSTATUS9* pClipStatus)
{
return(m_pIDirect3DDevice9->GetClipStatus( pClipStatus));
}
HRESULT myIDirect3DDevice9::GetTexture(DWORD Stage,IDirect3DBaseTexture9** ppTexture)
{
return(m_pIDirect3DDevice9->GetTexture(Stage,ppTexture));
}
HRESULT myIDirect3DDevice9::SetTexture(DWORD Stage,IDirect3DBaseTexture9* pTexture)
{
return(m_pIDirect3DDevice9->SetTexture(Stage,pTexture));
}
HRESULT myIDirect3DDevice9::GetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue)
{
return(m_pIDirect3DDevice9->GetTextureStageState(Stage,Type, pValue));
}
HRESULT myIDirect3DDevice9::SetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value)
{
return(m_pIDirect3DDevice9->SetTextureStageState(Stage,Type,Value));
}
HRESULT myIDirect3DDevice9::GetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue)
{
return(m_pIDirect3DDevice9->GetSamplerState(Sampler,Type, pValue));
}
HRESULT myIDirect3DDevice9::SetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value)
{
return(m_pIDirect3DDevice9->SetSamplerState(Sampler,Type,Value));
}
HRESULT myIDirect3DDevice9::ValidateDevice(DWORD* pNumPasses)
{
return(m_pIDirect3DDevice9->ValidateDevice( pNumPasses));
}
HRESULT myIDirect3DDevice9::SetPaletteEntries(UINT PaletteNumber,CONST PALETTEENTRY* pEntries)
{
return(m_pIDirect3DDevice9->SetPaletteEntries(PaletteNumber, pEntries));
}
HRESULT myIDirect3DDevice9::GetPaletteEntries(UINT PaletteNumber,PALETTEENTRY* pEntries)
{
return(m_pIDirect3DDevice9->GetPaletteEntries(PaletteNumber, pEntries));
}
HRESULT myIDirect3DDevice9::SetCurrentTexturePalette(UINT PaletteNumber)
{
return(m_pIDirect3DDevice9->SetCurrentTexturePalette(PaletteNumber));
}
HRESULT myIDirect3DDevice9::GetCurrentTexturePalette(UINT *PaletteNumber)
{
return(m_pIDirect3DDevice9->GetCurrentTexturePalette(PaletteNumber));
}
HRESULT myIDirect3DDevice9::SetScissorRect(CONST RECT* pRect)
{
return(m_pIDirect3DDevice9->SetScissorRect( pRect));
}
HRESULT myIDirect3DDevice9::GetScissorRect( RECT* pRect)
{
return(m_pIDirect3DDevice9->GetScissorRect( pRect));
}
HRESULT myIDirect3DDevice9::SetSoftwareVertexProcessing(BOOL bSoftware)
{
return(m_pIDirect3DDevice9->SetSoftwareVertexProcessing(bSoftware));
}
BOOL myIDirect3DDevice9::GetSoftwareVertexProcessing(void)
{
return(m_pIDirect3DDevice9->GetSoftwareVertexProcessing());
}
HRESULT myIDirect3DDevice9::SetNPatchMode(float nSegments)
{
return(m_pIDirect3DDevice9->SetNPatchMode(nSegments));
}
float myIDirect3DDevice9::GetNPatchMode(void)
{
return(m_pIDirect3DDevice9->GetNPatchMode());
}
HRESULT myIDirect3DDevice9::DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount)
{
return(m_pIDirect3DDevice9->DrawPrimitive(PrimitiveType,StartVertex,PrimitiveCount));
}
HRESULT myIDirect3DDevice9::DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{
return(m_pIDirect3DDevice9->DrawIndexedPrimitive(PrimitiveType,BaseVertexIndex,MinVertexIndex,NumVertices,startIndex,primCount));
}
HRESULT myIDirect3DDevice9::DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride)
{
return(m_pIDirect3DDevice9->DrawPrimitiveUP(PrimitiveType,PrimitiveCount,pVertexStreamZeroData,VertexStreamZeroStride));
}
HRESULT myIDirect3DDevice9::DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride)
{
return(m_pIDirect3DDevice9->DrawIndexedPrimitiveUP(PrimitiveType,MinVertexIndex,NumVertices,PrimitiveCount, pIndexData, IndexDataFormat, pVertexStreamZeroData,VertexStreamZeroStride));
}
HRESULT myIDirect3DDevice9::ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags)
{
return(m_pIDirect3DDevice9->ProcessVertices( SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags));
}
HRESULT myIDirect3DDevice9::CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl)
{
return(m_pIDirect3DDevice9->CreateVertexDeclaration( pVertexElements,ppDecl));
}
HRESULT myIDirect3DDevice9::SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl)
{
return(m_pIDirect3DDevice9->SetVertexDeclaration(pDecl));
}
HRESULT myIDirect3DDevice9::GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl)
{
return(m_pIDirect3DDevice9->GetVertexDeclaration(ppDecl));
}
HRESULT myIDirect3DDevice9::SetFVF(DWORD FVF)
{
return(m_pIDirect3DDevice9->SetFVF(FVF));
}
HRESULT myIDirect3DDevice9::GetFVF(DWORD* pFVF)
{
return(m_pIDirect3DDevice9->GetFVF(pFVF));
}
HRESULT myIDirect3DDevice9::CreateVertexShader(CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader)
{
return(m_pIDirect3DDevice9->CreateVertexShader(pFunction,ppShader));
}
HRESULT myIDirect3DDevice9::SetVertexShader(IDirect3DVertexShader9* pShader)
{
return(m_pIDirect3DDevice9->SetVertexShader(pShader));
}
HRESULT myIDirect3DDevice9::GetVertexShader(IDirect3DVertexShader9** ppShader)
{
return(m_pIDirect3DDevice9->GetVertexShader(ppShader));
}
HRESULT myIDirect3DDevice9::SetVertexShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount)
{
return(m_pIDirect3DDevice9->SetVertexShaderConstantF(StartRegister,pConstantData, Vector4fCount));
}
HRESULT myIDirect3DDevice9::GetVertexShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount)
{
return(m_pIDirect3DDevice9->GetVertexShaderConstantF(StartRegister,pConstantData,Vector4fCount));
}
HRESULT myIDirect3DDevice9::SetVertexShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount)
{
return(m_pIDirect3DDevice9->SetVertexShaderConstantI(StartRegister,pConstantData,Vector4iCount));
}
HRESULT myIDirect3DDevice9::GetVertexShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount)
{
return(m_pIDirect3DDevice9->GetVertexShaderConstantI(StartRegister,pConstantData,Vector4iCount));
}
HRESULT myIDirect3DDevice9::SetVertexShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount)
{
return(m_pIDirect3DDevice9->SetVertexShaderConstantB(StartRegister,pConstantData,BoolCount));
}
HRESULT myIDirect3DDevice9::GetVertexShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount)
{
return(m_pIDirect3DDevice9->GetVertexShaderConstantB(StartRegister,pConstantData,BoolCount));
}
HRESULT myIDirect3DDevice9::SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride)
{
return(m_pIDirect3DDevice9->SetStreamSource(StreamNumber,pStreamData,OffsetInBytes,Stride));
}
HRESULT myIDirect3DDevice9::GetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* OffsetInBytes,UINT* pStride)
{
return(m_pIDirect3DDevice9->GetStreamSource(StreamNumber,ppStreamData,OffsetInBytes,pStride));
}
HRESULT myIDirect3DDevice9::SetStreamSourceFreq(UINT StreamNumber,UINT Divider)
{
return(m_pIDirect3DDevice9->SetStreamSourceFreq(StreamNumber,Divider));
}
HRESULT myIDirect3DDevice9::GetStreamSourceFreq(UINT StreamNumber,UINT* Divider)
{
return(m_pIDirect3DDevice9->GetStreamSourceFreq(StreamNumber,Divider));
}
HRESULT myIDirect3DDevice9::SetIndices(IDirect3DIndexBuffer9* pIndexData)
{
return(m_pIDirect3DDevice9->SetIndices(pIndexData));
}
HRESULT myIDirect3DDevice9::GetIndices(IDirect3DIndexBuffer9** ppIndexData)
{
return(m_pIDirect3DDevice9->GetIndices(ppIndexData));
}
HRESULT myIDirect3DDevice9::CreatePixelShader(CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader)
{
return(m_pIDirect3DDevice9->CreatePixelShader(pFunction,ppShader));
}
HRESULT myIDirect3DDevice9::SetPixelShader(IDirect3DPixelShader9* pShader)
{
return(m_pIDirect3DDevice9->SetPixelShader(pShader));
}
HRESULT myIDirect3DDevice9::GetPixelShader(IDirect3DPixelShader9** ppShader)
{
return(m_pIDirect3DDevice9->GetPixelShader(ppShader));
}
HRESULT myIDirect3DDevice9::SetPixelShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount)
{
return(m_pIDirect3DDevice9->SetPixelShaderConstantF(StartRegister,pConstantData,Vector4fCount));
}
HRESULT myIDirect3DDevice9::GetPixelShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount)
{
return(m_pIDirect3DDevice9->GetPixelShaderConstantF(StartRegister,pConstantData,Vector4fCount));
}
HRESULT myIDirect3DDevice9::SetPixelShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount)
{
return(m_pIDirect3DDevice9->SetPixelShaderConstantI(StartRegister,pConstantData,Vector4iCount));
}
HRESULT myIDirect3DDevice9::GetPixelShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount)
{
return(m_pIDirect3DDevice9->GetPixelShaderConstantI(StartRegister,pConstantData,Vector4iCount));
}
HRESULT myIDirect3DDevice9::SetPixelShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount)
{
return(m_pIDirect3DDevice9->SetPixelShaderConstantB(StartRegister,pConstantData,BoolCount));
}
HRESULT myIDirect3DDevice9::GetPixelShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount)
{
return(m_pIDirect3DDevice9->GetPixelShaderConstantB(StartRegister,pConstantData,BoolCount));
}
HRESULT myIDirect3DDevice9::DrawRectPatch(UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo)
{
return(m_pIDirect3DDevice9->DrawRectPatch(Handle,pNumSegs, pRectPatchInfo));
}
HRESULT myIDirect3DDevice9::DrawTriPatch(UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo)
{
return(m_pIDirect3DDevice9->DrawTriPatch(Handle, pNumSegs, pTriPatchInfo));
}
HRESULT myIDirect3DDevice9::DeletePatch(UINT Handle)
{
return(m_pIDirect3DDevice9->DeletePatch(Handle));
}
HRESULT myIDirect3DDevice9::CreateQuery(D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery)
{
return(m_pIDirect3DDevice9->CreateQuery(Type,ppQuery));
}

View File

@@ -0,0 +1,134 @@
#pragma once
class myIDirect3DDevice9 : public IDirect3DDevice9
{
public:
myIDirect3DDevice9(IDirect3DDevice9* pOriginal);
virtual ~myIDirect3DDevice9(void);
// START: The original DX9 function definitions
HRESULT __stdcall QueryInterface (REFIID riid, void** ppvObj);
ULONG __stdcall AddRef(void);
ULONG __stdcall Release(void);
HRESULT __stdcall TestCooperativeLevel(void);
UINT __stdcall GetAvailableTextureMem(void);
HRESULT __stdcall EvictManagedResources(void);
HRESULT __stdcall GetDirect3D(IDirect3D9** ppD3D9);
HRESULT __stdcall GetDeviceCaps(D3DCAPS9* pCaps);
HRESULT __stdcall GetDisplayMode(UINT iSwapChain,D3DDISPLAYMODE* pMode);
HRESULT __stdcall GetCreationParameters(D3DDEVICE_CREATION_PARAMETERS *pParameters);
HRESULT __stdcall SetCursorProperties(UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap);
void __stdcall SetCursorPosition(int X,int Y,DWORD Flags);
BOOL __stdcall ShowCursor(BOOL bShow);
HRESULT __stdcall CreateAdditionalSwapChain(D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) ;
HRESULT __stdcall GetSwapChain(UINT iSwapChain,IDirect3DSwapChain9** pSwapChain);
UINT __stdcall GetNumberOfSwapChains(void);
HRESULT __stdcall Reset(D3DPRESENT_PARAMETERS* pPresentationParameters);
HRESULT __stdcall Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion);
HRESULT __stdcall GetBackBuffer(UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer);
HRESULT __stdcall GetRasterStatus(UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus);
HRESULT __stdcall SetDialogBoxMode(BOOL bEnableDialogs);
void __stdcall SetGammaRamp(UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp);
void __stdcall GetGammaRamp(UINT iSwapChain,D3DGAMMARAMP* pRamp);
HRESULT __stdcall CreateTexture(UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle);
HRESULT __stdcall CreateVolumeTexture(UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle);
HRESULT __stdcall CreateCubeTexture(UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle);
HRESULT __stdcall CreateVertexBuffer(UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle);
HRESULT __stdcall CreateIndexBuffer(UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle);
HRESULT __stdcall CreateRenderTarget(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle);
HRESULT __stdcall CreateDepthStencilSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle);
HRESULT __stdcall UpdateSurface(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint);
HRESULT __stdcall UpdateTexture(IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture);
HRESULT __stdcall GetRenderTargetData(IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface);
HRESULT __stdcall GetFrontBufferData(UINT iSwapChain,IDirect3DSurface9* pDestSurface);
HRESULT __stdcall StretchRect(IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter);
HRESULT __stdcall ColorFill(IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color);
HRESULT __stdcall CreateOffscreenPlainSurface(UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle);
HRESULT __stdcall SetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget);
HRESULT __stdcall GetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget);
HRESULT __stdcall SetDepthStencilSurface(IDirect3DSurface9* pNewZStencil);
HRESULT __stdcall GetDepthStencilSurface(IDirect3DSurface9** ppZStencilSurface);
HRESULT __stdcall BeginScene(void);
HRESULT __stdcall EndScene(void);
HRESULT __stdcall Clear(DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil);
HRESULT __stdcall SetTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix);
HRESULT __stdcall GetTransform(D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix);
HRESULT __stdcall MultiplyTransform(D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix);
HRESULT __stdcall SetViewport(CONST D3DVIEWPORT9* pViewport);
HRESULT __stdcall GetViewport(D3DVIEWPORT9* pViewport);
HRESULT __stdcall SetMaterial(CONST D3DMATERIAL9* pMaterial);
HRESULT __stdcall GetMaterial(D3DMATERIAL9* pMaterial);
HRESULT __stdcall SetLight(DWORD Index,CONST D3DLIGHT9* pLight);
HRESULT __stdcall GetLight(DWORD Index,D3DLIGHT9* pLight);
HRESULT __stdcall LightEnable(DWORD Index,BOOL Enable);
HRESULT __stdcall GetLightEnable(DWORD Index,BOOL* pEnable);
HRESULT __stdcall SetClipPlane(DWORD Index,CONST float* pPlane);
HRESULT __stdcall GetClipPlane(DWORD Index,float* pPlane);
HRESULT __stdcall SetRenderState(D3DRENDERSTATETYPE State,DWORD Value);
HRESULT __stdcall GetRenderState(D3DRENDERSTATETYPE State,DWORD* pValue);
HRESULT __stdcall CreateStateBlock(D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB);
HRESULT __stdcall BeginStateBlock(void);
HRESULT __stdcall EndStateBlock(IDirect3DStateBlock9** ppSB);
HRESULT __stdcall SetClipStatus(CONST D3DCLIPSTATUS9* pClipStatus);
HRESULT __stdcall GetClipStatus(D3DCLIPSTATUS9* pClipStatus);
HRESULT __stdcall GetTexture(DWORD Stage,IDirect3DBaseTexture9** ppTexture);
HRESULT __stdcall SetTexture(DWORD Stage,IDirect3DBaseTexture9* pTexture);
HRESULT __stdcall GetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue);
HRESULT __stdcall SetTextureStageState(DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value);
HRESULT __stdcall GetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue);
HRESULT __stdcall SetSamplerState(DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value);
HRESULT __stdcall ValidateDevice(DWORD* pNumPasses);
HRESULT __stdcall SetPaletteEntries(UINT PaletteNumber,CONST PALETTEENTRY* pEntries);
HRESULT __stdcall GetPaletteEntries(UINT PaletteNumber,PALETTEENTRY* pEntries);
HRESULT __stdcall SetCurrentTexturePalette(UINT PaletteNumber);
HRESULT __stdcall GetCurrentTexturePalette(UINT *PaletteNumber);
HRESULT __stdcall SetScissorRect(CONST RECT* pRect);
HRESULT __stdcall GetScissorRect( RECT* pRect);
HRESULT __stdcall SetSoftwareVertexProcessing(BOOL bSoftware);
BOOL __stdcall GetSoftwareVertexProcessing(void);
HRESULT __stdcall SetNPatchMode(float nSegments);
float __stdcall GetNPatchMode(void);
HRESULT __stdcall DrawPrimitive(D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount);
HRESULT __stdcall DrawIndexedPrimitive(D3DPRIMITIVETYPE PrimitiveType,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount);
HRESULT __stdcall DrawPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride);
HRESULT __stdcall DrawIndexedPrimitiveUP(D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride);
HRESULT __stdcall ProcessVertices(UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags);
HRESULT __stdcall CreateVertexDeclaration(CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl);
HRESULT __stdcall SetVertexDeclaration(IDirect3DVertexDeclaration9* pDecl);
HRESULT __stdcall GetVertexDeclaration(IDirect3DVertexDeclaration9** ppDecl);
HRESULT __stdcall SetFVF(DWORD FVF);
HRESULT __stdcall GetFVF(DWORD* pFVF);
HRESULT __stdcall CreateVertexShader(CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader);
HRESULT __stdcall SetVertexShader(IDirect3DVertexShader9* pShader);
HRESULT __stdcall GetVertexShader(IDirect3DVertexShader9** ppShader);
HRESULT __stdcall SetVertexShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount);
HRESULT __stdcall GetVertexShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount);
HRESULT __stdcall SetVertexShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount);
HRESULT __stdcall GetVertexShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount);
HRESULT __stdcall SetVertexShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount);
HRESULT __stdcall GetVertexShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount);
HRESULT __stdcall SetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride);
HRESULT __stdcall GetStreamSource(UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* OffsetInBytes,UINT* pStride);
HRESULT __stdcall SetStreamSourceFreq(UINT StreamNumber,UINT Divider);
HRESULT __stdcall GetStreamSourceFreq(UINT StreamNumber,UINT* Divider);
HRESULT __stdcall SetIndices(IDirect3DIndexBuffer9* pIndexData);
HRESULT __stdcall GetIndices(IDirect3DIndexBuffer9** ppIndexData);
HRESULT __stdcall CreatePixelShader(CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader);
HRESULT __stdcall SetPixelShader(IDirect3DPixelShader9* pShader);
HRESULT __stdcall GetPixelShader(IDirect3DPixelShader9** ppShader);
HRESULT __stdcall SetPixelShaderConstantF(UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount);
HRESULT __stdcall GetPixelShaderConstantF(UINT StartRegister,float* pConstantData,UINT Vector4fCount);
HRESULT __stdcall SetPixelShaderConstantI(UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount);
HRESULT __stdcall GetPixelShaderConstantI(UINT StartRegister,int* pConstantData,UINT Vector4iCount);
HRESULT __stdcall SetPixelShaderConstantB(UINT StartRegister,CONST BOOL* pConstantData,UINT BoolCount);
HRESULT __stdcall GetPixelShaderConstantB(UINT StartRegister,BOOL* pConstantData,UINT BoolCount);
HRESULT __stdcall DrawRectPatch(UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo);
HRESULT __stdcall DrawTriPatch(UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo);
HRESULT __stdcall DeletePatch(UINT Handle);
HRESULT __stdcall CreateQuery(D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery);
// END: The original DX9 function definitions
private:
IDirect3DDevice9 *m_pIDirect3DDevice9;
//void ShowWeAreHere();
};

View File

@@ -0,0 +1,137 @@
#include "pch.h"
#include "l2d.h"
// global variables
#pragma data_seg (".d3d9_shared")
myIDirect3DDevice9* gl_pmyIDirect3DDevice9;
myIDirect3D9* gl_pmyIDirect3D9;
HINSTANCE gl_hOriginalDll;
HINSTANCE gl_hThisInstance;
#pragma data_seg ()
FILE *g_fLog = NULL;
BOOL WINAPI DllMain( HINSTANCE hInstDLL, DWORD reason, LPVOID lpvReserved )
{
lpvReserved = NULL;
switch( reason )
{
case DLL_PROCESS_ATTACH:
{
gl_hThisInstance = hInstDLL;
DisableThreadLibraryCalls( hInstDLL );
L2D_Initialize();
} break;
case DLL_PROCESS_DETACH:
{
L2D_Uninitialize();
} break;
}
return TRUE;
}
void L2D_Initialize()
{
// init Logger
ErrorLogger_Init();
ErrorLogger_Enable( true );
#ifdef _DEBUG
ErrorLogger_EnableLoggingToConsole( true );
#endif
g_fLog = fopen( "L2Detect2.log", "at" );
ErrorLogger_SetLogFile( g_fLog );
ErrorLogger_SetAutoPrependErrorType( true );
#ifdef _DEBUG
ErrorLogger_SetWarnMessageLevel( LOG_DEBUGDUMP );
#else
ErrorLogger_SetWarnMessageLevel( LOG_WARNING );
#endif
log_error( LOG_OK, "L2D_Initialize() called.\n" );
// Initialisation
gl_hOriginalDll = NULL;
gl_hThisInstance = NULL;
gl_pmyIDirect3D9 = NULL;
gl_pmyIDirect3DDevice9 = NULL;
// start thread that will run all other
L2D_ThreadStart();
}
void L2D_Uninitialize()
{
log_error( LOG_OK, "L2D_Uninitialize() called.\n" );
// Release the system's d3d9.dll
if( gl_hOriginalDll )
{
::FreeLibrary( gl_hOriginalDll );
gl_hOriginalDll = NULL;
log_error( LOG_DEBUG, "gl_hOriginalDll (d3d9) unloaded.\n" );
}
// close logger
log_error( LOG_OK, "Closing log. Last message! Bye!\n=======================\n" );
ErrorLogger_FlushLogFile();
ErrorLogger_Enable( false );
#ifdef _DEBUG
ErrorLogger_EnableLoggingToConsole( false );
#endif
if( g_fLog )
{
ErrorLogger_SetLogFile( NULL );
fflush( g_fLog );
fclose( g_fLog );
g_fLog = NULL;
}
}
void LoadOriginalDll()
{
wchar_t buffer[MAX_PATH];
buffer[0] = 0;
// Getting path to system dir and to d3d8.dll
::GetSystemDirectory( buffer, MAX_PATH );
// Append dll name
wcscat( buffer, L"\\d3d9.dll" );
// try to load the system's d3d9.dll, if pointer empty
if( !gl_hOriginalDll ) gl_hOriginalDll = ::LoadLibrary( buffer );
// Debug
if( !gl_hOriginalDll )
{
log_error( LOG_ERROR, "LoadOriginalDll(): Original d3d9.dll not loaded!\n");
ErrorLogger_FlushLogFile();
::ExitProcess(0);
}
}
// Exported function (faking d3d9.dll's one-and-only export)
IDirect3D9* WINAPI Direct3DCreate9( UINT SDKVersion )
{
if( !gl_hOriginalDll ) LoadOriginalDll(); // looking for the "right d3d9.dll"
// Hooking IDirect3D Object from Original Library
typedef IDirect3D9 *(WINAPI* D3D9_Type)(UINT SDKVersion);
D3D9_Type D3DCreate9_fn = (D3D9_Type)GetProcAddress( gl_hOriginalDll, "Direct3DCreate9" );
// Debug
if( !D3DCreate9_fn )
{
log_error( LOG_ERROR, "Direct3DCreate9(): Pointer to original Direct3DCreate9 function not received!\n" );
ErrorLogger_FlushLogFile();
::ExitProcess(0); // exit the hard way
}
// Request pointer from Original Dll.
IDirect3D9 *pIDirect3D9_orig = D3DCreate9_fn( SDKVersion );
// Create my IDirect3D8 object and store pointer to original object there.
// note: the object will delete itself once Ref count is zero (similar to COM objects)
gl_pmyIDirect3D9 = new myIDirect3D9( pIDirect3D9_orig );
// Return pointer to hooking Object instead of "real one"
return gl_pmyIDirect3D9;
}

View File

@@ -0,0 +1,34 @@
#include "pch.h"
#include "l2d.h"
#include "hooks/hooks.h"
DWORD WINAPI DllThread( LPVOID lpvParam );
void L2D_ThreadStart()
{
unsigned int tid = 0;
HANDLE h = (HANDLE)_beginthreadex( NULL, 0,
(unsigned int (__stdcall *)(void *)) DllThread, NULL, 0, &tid );
if( h ) CloseHandle( h );
}
void test_hooks( int maxLoops, int delay )
{
int i = 0;
for( i=0; i<maxLoops; i++ )
{
Hook_dbg_displayInterceptionState();
Sleep( delay );
}
ErrorLogger_FlushLogFile();
}
DWORD WINAPI DllThread( LPVOID lpvParam )
{
UNREFERENCED_PARAMETER(lpvParam);
//
Hook_connect( false );
//test_hooks( 100, 500 );
//
return 0;
}

View File

@@ -0,0 +1,4 @@
LIBRARY "d3d9"
EXPORTS
Direct3DCreate9 @1

249
L2Detect_2/hooks/hooks.cpp Normal file
View File

@@ -0,0 +1,249 @@
#include "pch.h"
#include "hooks.h"
unsigned int hook_addr_ws2_connect = 0;
unsigned int hook_addr_ws2_send = 0;
unsigned int hook_addr_ws2_recv = 0;
unsigned int hook_addr_ws2_WSAconnect = 0;
unsigned int hook_addr_ws2_WSAsend = 0;
unsigned int hook_addr_ws2_WSArecv = 0;
const unsigned char hook_original_connect_6_bytes[6] = { 0x8B, 0xFF, 0x55, 0x8B, 0xEC, 0x83 };
const unsigned char hook_original_send_6_bytes[6] = { 0x8B, 0xFF, 0x55, 0x8B, 0xEC, 0x83 };
const unsigned char hook_original_recv_6_bytes[6] = { 0x8B, 0xFF, 0x55, 0x8B, 0xEC, 0x83 };
const unsigned char hook_original_WSAconnect_6_bytes[6] = { 0x8B, 0xFF, 0x55, 0x8B, 0xEC, 0x51 };
const unsigned char hook_original_WSArecv_6_bytes[6] = { 0x8B, 0xFF, 0x55, 0x8B, 0xEC, 0x51 };
const unsigned char hook_original_WSAsend_6_bytes[6] = { 0x8B, 0xFF, 0x55, 0x8B, 0xEC, 0x51 };
const unsigned char hook_original_vpex_6_bytes[6] = { 0x8B, 0xFF, 0x55, 0x8B, 0xEC, 0x56 };
unsigned char hook_my_connect_prolog[5] = {0,0,0,0,0};
#pragma pack( push, 1 )
struct hook_jmp_addr
{
unsigned char instr_jmp;
unsigned int jmp_addr;
};
#pragma pack( pop )
int __stdcall connect_hook( int sock, void *psockaddr, int addrlen );
int __stdcall call_real_connect( int s, void *a, int l );
void Hook_connect( bool write_hook )
{
BOOL bRet = FALSE;
DWORD oldProtect = 0;
HINSTANCE hws2 = LoadLibraryW( L"ws2_32.dll" );
if( !hws2 )
{
ErrorLogger_LogLastError( "Hook_connect(): cannot load ws2_32.dll!", GetLastError() );
return;
}
// find ws_32.dll!connect() address
hook_addr_ws2_connect = (unsigned int)GetProcAddress( hws2, "connect" );
if( hook_addr_ws2_connect == 0 )
{
ErrorLogger_LogLastError( "Hook_connect(): cannot find address of connect()!", GetLastError() );
return;
}
hook_addr_ws2_send = (unsigned int)GetProcAddress( hws2, "send" );
hook_addr_ws2_recv = (unsigned int)GetProcAddress( hws2, "recv" );
hook_addr_ws2_WSAconnect = (unsigned int)GetProcAddress( hws2, "WSAConnect" );
hook_addr_ws2_WSAsend = (unsigned int)GetProcAddress( hws2, "WSASend" );
hook_addr_ws2_WSArecv = (unsigned int)GetProcAddress( hws2, "WSARecv" );
log_error( LOG_DEBUG, "hooks: ws2_32.dll loaded at 0x%08X, connect() found at 0x%08X\n", hws2, hook_addr_ws2_connect );
if( write_hook )
{
bRet = VirtualProtectEx( (HANDLE)-1, (LPVOID)hook_addr_ws2_connect, 5, PAGE_EXECUTE_READWRITE, &oldProtect );
if( !bRet )
{
ErrorLogger_LogLastError( "Hook_connect(): VirtualProtectEx() failed!", GetLastError() );
return;
}
}
hook_jmp_addr st;
st.instr_jmp = 0xE9;
st.jmp_addr = (unsigned int)connect_hook - (unsigned int)hook_addr_ws2_connect - 5;
// save my prolog bytes
memcpy( (void *)&hook_my_connect_prolog, (const void *)&st, sizeof(hook_jmp_addr) );
if( write_hook )
{
unsigned char *src = (unsigned char *)&st;
unsigned char *dst = (unsigned char *)hook_addr_ws2_connect;
// write hook code
dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3]; dst[4] = src[4];
log_error( LOG_DEBUG, "Hook_connect(): connect hook written\n" );
}
ErrorLogger_FlushLogFile();
}
int __stdcall connect_hook( int sock, void *psockaddr, int addrlen )
{
sockaddr_in *psaddr = (sockaddr_in *)psockaddr;
char ip[16] = {0};
strcpy( ip, inet_ntoa( psaddr->sin_addr ) );
int port = psaddr->sin_port;
int host_port = ntohs( psaddr->sin_port );
log_error( LOG_DEBUG, "connect_hook( %d, 0x%p (%s:%d), %d );\n", sock, psaddr, ip, host_port, addrlen );
ErrorLogger_FlushLogFile();
// check if we should change connect address
if( host_port == 7777 )
{
log_error( LOG_DEBUG, "Intercepting GS connection...\n" );
int real_ip = psaddr->sin_addr.s_addr;
//GameListener *gl = GameListener::getInstance();
//gl->setRealPlayServerInfo( real_ip, port );
//psaddr->sin_port = htons( (unsigned short)GameListener::LISTEN_PORT );
psaddr->sin_addr.s_addr = inet_addr( "127.0.0.1" );
}
//
int result = call_real_connect( sock, psockaddr, addrlen );
log_error( LOG_DEBUG, "connect_hook(): orig. connect returned %d\n", result );
ErrorLogger_FlushLogFile();
return result;
}
__declspec(naked) int __stdcall call_real_connect( int s, void *a, int l )
{
UNREFERENCED_PARAMETER( s );
UNREFERENCED_PARAMETER( a );
UNREFERENCED_PARAMETER( l );
__asm
{
mov edi, edi
push ebp
mov ebp, esp
mov eax, [hook_addr_ws2_connect]
add eax, 5
//jmp eax
//jmp [addr_ws2_connect]
call eax
mov esp, ebp
pop ebp
ret
}
}
/////////////////////////////////////////////////////////////////////////////
//
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> JMP-<2D><><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//
// old_ptr - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// new_ptr - <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// jmp_ptr - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//
/*void Hook_InterceptCall( DWORD old_ptr, DWORD new_ptr, DWORD *jmp_ptr )
{
hook_jmp_addr jump;
jump.instr_jmp = 0xE9;
jump.jmp_addr = new_ptr - old_ptr - 5;
DWORD oldProtect, prot;
GetCurrentProcess();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
prot = PAGE_EXECUTE_WRITECOPY; // PAGE_READWRITE;
BOOL vp_res = VirtualProtectEx( (HANDLE)-1, (LPVOID)old_ptr, 5, prot, &oldProtect );
if( !vp_res )
{
DWORD le = GetLastError();
ErrorLogger_LogLastError( "Hook_InterceptCall(): VirtualProtectEx() failed", le );
ErrorLogger_FlushLogFile();
return;
}
// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
//WriteProcessMemory(hprocess, (LPVOID)old_ptr, (void*)(&jump), 5, &written);
unsigned char *po = (unsigned char *)old_ptr;
unsigned char *pj = (unsigned char *)&jump;
po[0] = pj[0];
po[1] = pj[1];
po[2] = pj[2];
po[3] = pj[3];
po[4] = pj[4];
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
prot = oldProtect;
VirtualProtectEx( (HANDLE)-1, (LPVOID)old_ptr, 5, prot, &oldProtect );
(*jmp_ptr) = old_ptr + 5;
}*/
int hook_compare_bytes( unsigned int addr, const unsigned char *bytes, size_t size )
{
unsigned char *pcur = (unsigned char *)addr;
return memcmp( pcur, bytes, size );
}
void hook_log_bytes_uint( unsigned int addr, size_t sz )
{
unsigned char *b = (unsigned char *)addr;
size_t s = 0;
while( s < sz )
{
log_error_np( LOG_OK, "%02X", (unsigned int)(b[s]) );
s++;
if( s < sz ) log_error_np( LOG_OK, " " );
}
}
bool Hook_validateIntercept_connect()
{
int r = hook_compare_bytes( hook_addr_ws2_connect, hook_my_connect_prolog, 5 );
if( r == 0 )
{
log_error( LOG_OK, "Hooks: ws2_32!connect is hooked by us!\n" );
ErrorLogger_FlushLogFile();
return true;
}
else
{
log_error( LOG_WARNING, "Hooks: our ws2_32!connect hook is not installed!\n" );
r = hook_compare_bytes( hook_addr_ws2_connect, hook_original_connect_6_bytes, 6 );
if( r == 0 ) log_error( LOG_WARNING, "Hooks: ws_32!connect is original\n" );
else
{
log_error( LOG_WARNING, "Hooks: ws_32!connect hook unknown!\n" );
log_error( LOG_WARNING, "Hooks: bytes: " );
hook_log_bytes_uint( hook_addr_ws2_connect, 6 );
log_error_np( LOG_WARNING, "\n" );
}
}
ErrorLogger_FlushLogFile();
return false;
}
void Hook_dbg_displayInterceptionState()
{
int r = 0;
log_error( LOG_DEBUG, "Hook_dbg_displayInterceptionState(): 0 if original, 1 if hooked\n" );
// connect
r = hook_compare_bytes( hook_addr_ws2_connect, hook_original_connect_6_bytes, 6 );
log_error( LOG_DEBUG, "connect: %d (", r ); hook_log_bytes_uint( hook_addr_ws2_connect, 6 ); log_error_np( LOG_DEBUG, ")\n" );
// send
r = hook_compare_bytes( hook_addr_ws2_send, hook_original_send_6_bytes, 6 );
log_error( LOG_DEBUG, "send: %d (", r ); hook_log_bytes_uint( hook_addr_ws2_send, 6 ); log_error_np( LOG_DEBUG, ")\n" );
// recv
r = hook_compare_bytes( hook_addr_ws2_recv, hook_original_recv_6_bytes, 6 );
log_error( LOG_DEBUG, "recv: %d (", r ); hook_log_bytes_uint( hook_addr_ws2_recv, 6 ); log_error_np( LOG_DEBUG, ")\n" );
// WSConnect
r = hook_compare_bytes( hook_addr_ws2_WSAconnect, hook_original_WSAconnect_6_bytes, 6 );
log_error( LOG_DEBUG, "WSAConnect: %d (", r ); hook_log_bytes_uint( hook_addr_ws2_WSAconnect, 6 ); log_error_np( LOG_DEBUG, ")\n" );
// WSASend
r = hook_compare_bytes( hook_addr_ws2_WSAsend, hook_original_WSAsend_6_bytes, 6 );
log_error( LOG_DEBUG, "WSASend: %d (", r ); hook_log_bytes_uint( hook_addr_ws2_WSAsend, 6 ); log_error_np( LOG_DEBUG, ")\n" );
// WSARecv
r = hook_compare_bytes( hook_addr_ws2_WSArecv, hook_original_WSArecv_6_bytes, 6 );
log_error( LOG_DEBUG, "WSARecv: %d (", r ); hook_log_bytes_uint( hook_addr_ws2_WSArecv, 6 ); log_error_np( LOG_DEBUG, ")\n" );
//
log_error_np( LOG_DEBUG, "===================\n" );
}

8
L2Detect_2/hooks/hooks.h Normal file
View File

@@ -0,0 +1,8 @@
#pragma once
void Hook_connect( bool write_hook );
int __stdcall call_real_connect( int s, void *a, int l );
bool Hook_validateIntercept_connect();
void Hook_dbg_displayInterceptionState();

14
L2Detect_2/l2d.h Normal file
View File

@@ -0,0 +1,14 @@
#pragma once
extern HINSTANCE gl_hThisInstance;
extern myIDirect3DDevice9* gl_pmyIDirect3DDevice9;
extern myIDirect3D9* gl_pmyIDirect3D9;
extern HINSTANCE gl_hOriginalDll;
extern HINSTANCE gl_hThisInstance;
void L2D_Initialize();
void L2D_Uninitialize();
void L2D_ThreadStart();
// wndproc hook
void InstallProxyWndProc( HWND hWndL2 );

View File

@@ -0,0 +1,195 @@
#include "pch.h"
#include "Logger.h"
// global ErrorLogger vars
bool g_error_logger_enabled;
bool g_error_logger_enabled_console;
FILE *g_error_logger_file;
bool g_error_logger_auto_prepend;
CRITICAL_SECTION g_error_logger_cs;
HANDLE g_error_logger_stdout;
// strings
char g_error_logger_strtype_unknown[16];
char g_error_logger_strtype[LOG_LEVELS][16];
//
LOG_LEVEL g_errorLogger_WarnMessageLevel;
void ErrorLogger_InitStrings()
{
strcpy( g_error_logger_strtype_unknown, "[??] " );
strcpy( g_error_logger_strtype[LOG_OK], "[++] " );
strcpy( g_error_logger_strtype[LOG_ERROR], "[--] " );
strcpy( g_error_logger_strtype[LOG_WARNING], "[WARN] " );
strcpy( g_error_logger_strtype[LOG_USERAI], "[AI] " );
strcpy( g_error_logger_strtype[LOG_PACKETNAME], "[PACK] " );
strcpy( g_error_logger_strtype[LOG_DEBUG], "[DBG] " );
strcpy( g_error_logger_strtype[LOG_DEBUGDUMP], "[DUMP] " );
}
void ErrorLogger_Init()
{
g_error_logger_enabled = false;
g_error_logger_enabled_console = false;
g_error_logger_file = stdout;
g_error_logger_auto_prepend = false;
g_error_logger_stdout = INVALID_HANDLE_VALUE;
g_errorLogger_WarnMessageLevel = LOG_DEBUG;
InitializeCriticalSection( &g_error_logger_cs );
ErrorLogger_InitStrings();
}
void ErrorLogger_Enable( bool bEnable )
{
g_error_logger_enabled = bEnable;
}
void ErrorLogger_SetWarnMessageLevel( LOG_LEVEL level )
{
g_errorLogger_WarnMessageLevel = level;
}
void ErrorLogger_EnableLoggingToConsole( bool bEnable )
{
EnterCriticalSection( &g_error_logger_cs );
if( bEnable )
{
if( g_error_logger_enabled_console == false ) AllocConsole();
g_error_logger_stdout = GetStdHandle( STD_OUTPUT_HANDLE );
}
else
{
g_error_logger_stdout = INVALID_HANDLE_VALUE;
if( g_error_logger_enabled_console == true ) FreeConsole();
}
g_error_logger_enabled_console = bEnable;
LeaveCriticalSection( &g_error_logger_cs );
}
void ErrorLogger_SetLogFile( FILE *f )
{
EnterCriticalSection( &g_error_logger_cs );
if( !f ) g_error_logger_file = stdout; else g_error_logger_file = f;
LeaveCriticalSection( &g_error_logger_cs );
}
FILE *ErrorLogger_GetLogFile()
{
return g_error_logger_file;
}
void ErrorLogger_FlushLogFile()
{
EnterCriticalSection( &g_error_logger_cs );
if( g_error_logger_file ) fflush( g_error_logger_file );
LeaveCriticalSection( &g_error_logger_cs );
}
void ErrorLogger_SetAutoPrependErrorType( bool bPrepend )
{
g_error_logger_auto_prepend = bPrepend;
}
int log_error( LOG_LEVEL logLevel, const char *_Format, ... )
{
if( !g_error_logger_enabled ) return 0;
int ret = 0;
if( (logLevel < 0) || (!_Format) ) return 0;
if( logLevel > g_errorLogger_WarnMessageLevel ) return 0;
EnterCriticalSection( &g_error_logger_cs );
va_list l;
va_start( l, _Format );
if( g_error_logger_auto_prepend )
{
char *szPrepend = g_error_logger_strtype_unknown;
if( (logLevel >= LOG_OK) && (logLevel <= LOGLEVEL_LAST) )
szPrepend = g_error_logger_strtype[logLevel];
fprintf( g_error_logger_file, "%s", szPrepend );
// also write to console, if enabled
if( g_error_logger_enabled_console )
{
DWORD numWritten = 0;
WriteConsoleA( g_error_logger_stdout, szPrepend, (DWORD)strlen(szPrepend), &numWritten, NULL );
}
}
ret = vfprintf( g_error_logger_file, _Format, l );
// also write to console, if enabled
if( g_error_logger_enabled_console )
{
char *cbuffer = (char *)malloc( 20480 ); // 20 Kb >_<
if( cbuffer )
{
va_list l2;
va_start( l2, _Format );
vsprintf( cbuffer, _Format, l2 );
DWORD numWritten = 0;
WriteConsoleA( g_error_logger_stdout, cbuffer, (DWORD)strlen(cbuffer), &numWritten, NULL );
free( cbuffer );
}
}
LeaveCriticalSection( &g_error_logger_cs );
return ret;
}
// forces NO prepend even if set to
int log_error_np( LOG_LEVEL logLevel, const char *_Format, ... )
{
if( !g_error_logger_enabled ) return 0;
int ret = 0;
if( (logLevel < 0) || (!_Format) ) return 0;
if( logLevel > g_errorLogger_WarnMessageLevel ) return 0;
EnterCriticalSection( &g_error_logger_cs );
va_list l;
va_start( l, _Format );
// no prepend, just vfprintf
ret = vfprintf( g_error_logger_file, _Format, l );
// also write to console, if enabled?
if( g_error_logger_enabled_console )
{
char *cbuffer = (char *)malloc( 20480 );
if( cbuffer )
{
va_list l2;
va_start( l2, _Format );
vsprintf( cbuffer, _Format, l2 );
DWORD numWritten = 0;
WriteConsoleA( g_error_logger_stdout, cbuffer, (DWORD)strlen(cbuffer), &numWritten, NULL );
free( cbuffer );
}
}
LeaveCriticalSection( &g_error_logger_cs );
return ret;
}
//int log_console( LOG_LEVEL logLevel, const char *_Format, ... )
//{
// if( !g_error_logger_enabled_console ) return 0;
//}
//
//int log_console_np( LOG_LEVEL logLevel, const char *_Format, ... )
//{
// if( !g_error_logger_enabled_console ) return 0;
//}
void ErrorLogger_FormatLastError( char *msg, size_t nMaxCount, DWORD error_code )
{
FormatMessageA( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, error_code, 0/*MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT)*/, msg, nMaxCount, NULL );
}
void ErrorLogger_LogLastError( char *comment, DWORD error_code )
{
char errbuf[512];
errbuf[0] = 0;
ErrorLogger_FormatLastError( errbuf, 511, error_code );
errbuf[511] = 0;
size_t ll = strlen( errbuf );
if( ll > 0 )
{
if( errbuf[ll-1] == '\n' || errbuf[ll-1] == '\r' ) errbuf[ll-1] = 0;
if( ll > 1 )
{
if( errbuf[ll-2] == '\n' || errbuf[ll-2] == '\r' ) errbuf[ll-2] = 0;
}
}
log_error( LOG_ERROR, "%s: error code: %u (%s)\n", comment, (unsigned int)error_code, errbuf );
}

View File

@@ -0,0 +1,37 @@
#ifndef FL_ERRORLOGGER_H_
#define FL_ERRORLOGGER_H_
typedef enum eLOG_LEVEL
{
LOG_OK = 0,
LOG_ERROR, // 1
LOG_WARNING, // 2
LOG_USERAI, // 3
LOG_PACKETNAME, // 4
LOG_DEBUG, // 5
LOG_DEBUGDUMP, // 6
LOGLEVEL_LAST = LOG_DEBUGDUMP
} LOG_LEVEL;
#define LOG_LEVELS 7
void ErrorLogger_Init();
void ErrorLogger_Enable( bool bEnable );
void ErrorLogger_EnableLoggingToConsole( bool bEnable );
void ErrorLogger_SetLogFile( FILE *f );
FILE *ErrorLogger_GetLogFile();
void ErrorLogger_FlushLogFile();
void ErrorLogger_SetWarnMessageLevel( LOG_LEVEL level );
void ErrorLogger_SetAutoPrependErrorType( bool bPrepend );
int log_error( LOG_LEVEL logLevel, const char *_Format, ... );
int log_error_np( LOG_LEVEL logLevel, const char *_Format, ... ); // forces NO prepend even if set to
//int log_console( LOG_LEVEL logLevel, const char *_Format, ... );
//int log_console_np( LOG_LEVEL logLevel, const char *_Format, ... );
void ErrorLogger_FormatLastError( char *msg, size_t nMaxCount, DWORD error_code );
void ErrorLogger_LogLastError( char *comment, DWORD error_code );
#endif /*FL_ERRORLOGGER_H_*/

1
L2Detect_2/pch.cpp Normal file
View File

@@ -0,0 +1 @@
#include "pch.h"

36
L2Detect_2/pch.h Normal file
View File

@@ -0,0 +1,36 @@
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#define _WIN32_IE 0x0600
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
// C++ RTL
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
#include <errno.h>
// WinAPI
#include <windows.h>
#include <windowsx.h>
#include <wchar.h>
#include <process.h>
#include <commctrl.h>
#include <mmsystem.h>
#include <ddraw.h>
// STL
#include <vector>
#include <map>
#include <list>
#include <string>
// logger
#include "logger/Logger.h"
// local Direct3D 9 Interface
#include <d3d9.h>
#include <d3dx9.h>
#include "d3d/myIDirect3D9.h"
#include "d3d/myIDirect3DDevice9.h"

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

BIN
L2Detect_2/res/radar.xcf Normal file

Binary file not shown.

BIN
L2Detect_2/res/transp_r.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
L2Detect_2/res/transp_r.xcf Normal file

Binary file not shown.