diff --git a/Other Hook Styles/Graphics.cpp b/Other Hook Styles/Graphics.cpp new file mode 100644 index 0000000..ab6467c --- /dev/null +++ b/Other Hook Styles/Graphics.cpp @@ -0,0 +1,121 @@ +#include "Graphics.hpp" + +Graphics::Graphics(IDirect3DDevice9* device) : Device(device), Sprite(nullptr), Texture(nullptr), StateBlock(nullptr), VertexBuffer(nullptr) {} + +Graphics::~Graphics() +{ + SafeRelease(this->Sprite); + SafeRelease(this->Texture); + SafeRelease(this->StateBlock); + SafeRelease(this->VertexBuffer); +} + +void Graphics::SaveState() +{ + if (this->StateBlock) + { + this->StateBlock->Release(); + this->StateBlock = nullptr; + } + + this->Device->CreateStateBlock(D3DSBT_ALL, &this->StateBlock); + this->StateBlock->Capture(); +} + +void Graphics::RestoreState() +{ + if (this->StateBlock) + { + this->StateBlock->Apply(); + this->StateBlock->Release(); + this->StateBlock = nullptr; + } +} + +void Graphics::SetTextureRenderState() +{ + this->Device->SetRenderState(D3DRS_LIGHTING, false); + this->Device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); + this->Device->SetRenderState(D3DRS_ZENABLE, false); + this->Device->SetRenderState(D3DRS_ALPHABLENDENABLE, true); + this->Device->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); + this->Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); + this->Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); +} + +void Graphics::SpriteFromFile(const char* FilePath) +{ + this->TextureFromFile(FilePath); + D3DXCreateSprite(this->Device, &this->Sprite); +} + +void Graphics::SpriteFromBuffer(std::uint8_t* Buffer, int Width, int Height) +{ + this->TextureFromBuffer(Buffer, Width, Height); + D3DXCreateSprite(this->Device, &this->Sprite); +} + +void Graphics::TextureFromFile(const char* FilePath) +{ + D3DXCreateTextureFromFileEx(this->Device, FilePath, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 1, 0, D3DFMT_FROM_FILE, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0xFF000000, nullptr, nullptr, &this->Texture); +} + +void Graphics::TextureFromBuffer(std::uint8_t* Buffer, int Width, int Height) +{ + this->Device->CreateTexture(Width, Height, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &this->Texture, 0); + + D3DLOCKED_RECT rect; + this->Texture->LockRect(0, &rect, nullptr, D3DLOCK_DISCARD); + std::uint8_t* TexturePixels = static_cast(rect.pBits); + this->Texture->UnlockRect(0); + memcpy(&TexturePixels[0], &Buffer[0], Width * Height * 4); +} + +void Graphics::CreateVertexBuffer(D3DVertex* Vertices, std::size_t VertexCount, int FVF) +{ + void* pVertices = nullptr; + this->Device->CreateVertexBuffer(VertexCount * sizeof(D3DVertex), 0, FVF, D3DPOOL_MANAGED, &this->VertexBuffer, nullptr); + this->VertexBuffer->Lock(0, VertexCount * sizeof(D3DVertex), &pVertices, 0); + std::memcpy(pVertices, Vertices, VertexCount * sizeof(D3DVertex)); + this->VertexBuffer->Unlock(); +} + +void Graphics::DrawVertexBuffer(D3DPRIMITIVETYPE PrimitiveType, int PrimitiveCount, int FVF) +{ + this->Device->SetFVF(FVF); + this->Device->SetStreamSource(0, this->VertexBuffer, 0, sizeof(D3DVertex)); + this->Device->DrawPrimitive(PrimitiveType, 0, PrimitiveCount); +} + +void Graphics::DrawRectangleUP(float X1, float Y1, float X2, float Y2, D3DCOLOR Colour) +{ + D3DVertex Vertices[] = + { + {X1, Y1, 1.0f, 1.0f, Colour, 0.0f, 0.0f}, + {X2, Y1, 1.0f, 1.0f, Colour, 1.0f, 0.0f}, + {X1, Y2, 1.0f, 1.0f, Colour, 0.0f, 1.0f}, + {X2, Y2, 1.0f, 1.0f, Colour, 1.0f, 1.0f} + }; + + this->Device->SetFVF(FVF_TEX); + this->Device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, Vertices, sizeof(D3DVertex)); +} + +void Graphics::DrawCircleUP(float CX, float CY, float Radius, D3DCOLOR Colour, int Resolution) +{ + D3DVertex Vertices[Resolution]; + + for (int I = 0; I < Resolution; ++I) + { + Vertices[I].X = CX + Radius * std::cos(D3DX_PI * (I / (Resolution / 2.0f))); + Vertices[I].Y = CX + Radius * std::sin(D3DX_PI * (I / (Resolution / 2.0f))); + Vertices[I].Z = 0.0f; + Vertices[I].RHW = 1.0f; + Vertices[I].Colour = Colour; + Vertices[I].U = 1.0f; + Vertices[I].V = 1.0f; + } + + this->Device->SetFVF(FVF_TEX); + this->Device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, Resolution - 2, Vertices, sizeof(D3DVertex)); +} diff --git a/Other Hook Styles/Graphics.hpp b/Other Hook Styles/Graphics.hpp new file mode 100644 index 0000000..1366f28 --- /dev/null +++ b/Other Hook Styles/Graphics.hpp @@ -0,0 +1,61 @@ +#ifndef GRAPHICS_HPP_INCLUDED +#define GRAPHICS_HPP_INCLUDED + +#include +#include +#include +#include +#include + +template +void SafeRelease(T*& ptr) +{ + if (ptr) + { + ptr->Release(); + ptr = nullptr; + } +} + +struct D3DVertex +{ + float X, Y, Z, RHW; + unsigned int Colour; + float U, V; +}; + +class Graphics +{ + private: + IDirect3DDevice9* Device; + + ID3DXSprite* Sprite; + IDirect3DTexture9* Texture; + IDirect3DStateBlock9* StateBlock; + IDirect3DVertexBuffer9* VertexBuffer; + + public: + const static int FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE; + const static int FVF_TEX = D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1; + + Graphics(IDirect3DDevice9* device); + ~Graphics(); + + void SaveState(); + void RestoreState(); + void SetTextureRenderState(); + + void SpriteFromFile(const char* FilePath); + void SpriteFromBuffer(std::uint8_t* Buffer, int Width, int Height); + + void TextureFromFile(const char* FilePath); + void TextureFromBuffer(std::uint8_t* Buffer, int Width, int Height); + + void CreateVertexBuffer(D3DVertex* Vertices, std::size_t VertexCount, int FVF = FVF_TEX); + void DrawVertexBuffer(D3DPRIMITIVETYPE PrimitiveType, int PrimitiveCount, int FVF = FVF_TEX); + + void DrawRectangleUP(float X1, float Y1, float X2, float Y2, D3DCOLOR Colour = D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF)); + void DrawCircleUP(float CX, float CY, float Radius, D3DCOLOR Colour = D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), int Resolution = 10); +}; + +#endif // GRAPHICS_HPP_INCLUDED diff --git a/Other Hook Styles/Test.cpp b/Other Hook Styles/Test.cpp new file mode 100644 index 0000000..782f9af --- /dev/null +++ b/Other Hook Styles/Test.cpp @@ -0,0 +1,238 @@ +#include +#include +#include + +int WindowWidth = 500; +int WindowHeight = 500; + +IDirect3D9* d3dinterface = nullptr; +IDirect3DDevice9* d3ddevice = nullptr; +IDirect3DTexture9* texture = nullptr; +IDirect3DVertexBuffer9* vertexbuffer = nullptr; + +#define VERTEX_FVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE) +#define VERTEX_FVF_TEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1) + +struct D3DVertex +{ + float X, Y, Z, RHW; + unsigned int Colour; + float U, V; +}; + +template +void SafeRelease(T*& ptr) +{ + if (ptr) + { + ptr->Release(); + ptr = nullptr; + } +} + +void EnableDrawing(IDirect3DStateBlock9*& block) +{ + d3ddevice->CreateStateBlock(D3DSBT_ALL, &block); + block->Capture(); +} + +void DisableDrawing(IDirect3DStateBlock9*& block) +{ + if (block) + { + block->Apply(); + block->Release(); + block = nullptr; + } +} + +void DrawVertexBuffer(float X1, float Y1, float X2, float Y2) +{ + if (!vertexbuffer) + { + D3DVertex vertices[] = + { + {X1, Y1, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 0.0f, 0.0f}, + {X2, Y1, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 1.0f, 0.0f}, + {X1, Y2, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 0.0f, 1.0f}, + {X2, Y2, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 1.0f, 1.0f} + }; + + void* pVertices = nullptr; + d3ddevice->CreateVertexBuffer(sizeof(vertices), 0, VERTEX_FVF_TEX, D3DPOOL_MANAGED, &vertexbuffer, nullptr); + vertexbuffer->Lock(0, sizeof(vertices), &pVertices, 0); + memcpy(pVertices, vertices, sizeof(vertices)); + vertexbuffer->Unlock(); + } + + d3ddevice->SetFVF(VERTEX_FVF_TEX); + d3ddevice->SetStreamSource(0, vertexbuffer, 0, sizeof(D3DVertex)); + d3ddevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2); +} + +void DrawTexture(float X1, float Y1, float X2, float Y2) +{ + D3DVertex vertices[] = + { + {X1, Y1, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 0.0f, 0.0f}, + {X2, Y1, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 1.0f, 0.0f}, + {X1, Y2, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 0.0f, 1.0f}, + {X2, Y2, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 1.0f, 1.0f} + }; + + d3ddevice->SetRenderState(D3DRS_LIGHTING, false); + d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); + d3ddevice->SetRenderState(D3DRS_ZENABLE, false); + d3ddevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true); + d3ddevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); + d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); + d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); + + d3ddevice->SetFVF(VERTEX_FVF_TEX); + d3ddevice->SetTexture(0, texture); + d3ddevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, vertices, sizeof(D3DVertex)); +} + +void DrawCircle(float mx, float my, float r, D3DCOLOR colour) +{ + static const int CIRCLE_RESOLUTION = 10; + D3DVertex verts[CIRCLE_RESOLUTION]; + + for (int i = 0; i < CIRCLE_RESOLUTION; ++i) + { + verts[i].X = mx + r * cos(D3DX_PI * (i / (CIRCLE_RESOLUTION / 2.0f))); + verts[i].Y = my + r * sin(D3DX_PI * (i / (CIRCLE_RESOLUTION / 2.0f))); + verts[i].Z = 0.0f; + verts[i].RHW = 1.0f; + verts[i].Colour = colour; + verts[i].U = 1.0f; + verts[i].V = 1.0f; + } + + d3ddevice->SetFVF(VERTEX_FVF); + d3ddevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, CIRCLE_RESOLUTION - 2, verts, sizeof(D3DVertex)); +} + +POINT P; +void RenderD3D() +{ + d3ddevice->Clear(0, nullptr, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 255), 1.0f, 0); + d3ddevice->BeginScene(); + + IDirect3DStateBlock9* block = nullptr; + EnableDrawing(block); + + d3ddevice->SetRenderState(D3DRS_LIGHTING, false); + d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); + d3ddevice->SetRenderState(D3DRS_ZENABLE, false); + d3ddevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true); + d3ddevice->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); + d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); + d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); + DrawCircle(P.x, P.y, 2.5, D3DCOLOR_RGBA(0xFF, 0x00, 0x00, 0xFF)); + DisableDrawing(block); + + d3ddevice->EndScene(); + d3ddevice->Present(nullptr, nullptr, nullptr, nullptr); +} + +void LoadTexture(const char* FilePath, IDirect3DTexture9*& Texture) +{ + D3DXCreateTextureFromFileEx(d3ddevice, FilePath, D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 1, 0, D3DFMT_FROM_FILE, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0xFF000000, nullptr, nullptr, &Texture); +} + +void InitD3D(HWND WindowHandle) +{ + D3DPRESENT_PARAMETERS d3dpp = {0}; + memset(&d3dpp, 0, sizeof(d3dpp)); + + d3dpp.Windowed = true; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + d3dpp.hDeviceWindow = WindowHandle; + d3dpp.BackBufferWidth = WindowWidth; + d3dpp.BackBufferHeight = WindowHeight; + d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8; + + d3dinterface = Direct3DCreate9(D3D_SDK_VERSION); + d3dinterface->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, WindowHandle, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &d3ddevice); + + /*D3DXMATRIX World, View, Projection; + D3DXVECTOR3 Camera = {0.0f, 0.0f, 10.0f}; + D3DXVECTOR3 LookAt = {0.0f, 0.0f, 0.0f}; + D3DXVECTOR3 UpVector = {0.0f, 1.0f, 0.0f}; + + D3DXMatrixIdentity(&World); + D3DXMatrixLookAtLH(&View, &Camera, &LookAt, &UpVector); + D3DXMatrixPerspectiveFovLH(&Projection, D3DXToRadian(45), static_cast(WindowWidth) / static_cast(WindowHeight), 1.0f, 100.0f); + + d3ddevice->SetTransform(D3DTS_WORLD, &World); + d3ddevice->SetTransform(D3DTS_VIEW, &View); + d3ddevice->SetTransform(D3DTS_PROJECTION, &Projection); + LoadTexture("C:/Users/School/Desktop/Foo.png", texture);*/ +} + + + +void CleanUpD3d() +{ + SafeRelease(texture); + SafeRelease(vertexbuffer); + SafeRelease(d3ddevice); + SafeRelease(d3dinterface); +} + +LRESULT __stdcall WindowProcedure(HWND Hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) +{ + switch(Msg) + { + case WM_MOUSEMOVE: + P = {LOWORD(lParam), HIWORD(lParam)}; + break; + + case WM_DESTROY: + PostQuitMessage(0); + return 0; + + default: + return DefWindowProc(Hwnd, Msg, wParam, lParam); + } + return 0; +} + +int __stdcall WinMain(HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow) +{ + WNDCLASSEX WndClass = + { + sizeof(WNDCLASSEX), CS_DBLCLKS, WindowProcedure, + 0, 0, GetModuleHandle(nullptr), LoadIcon(nullptr, IDI_APPLICATION), + LoadCursor(nullptr, IDC_ARROW), reinterpret_cast(COLOR_BACKGROUND), + nullptr, "Direct-X", LoadIcon(nullptr, IDI_APPLICATION) + }; + + if(RegisterClassEx(&WndClass)) + { + HWND WindowHandle = CreateWindow("Direct-X", "Direct-X", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, WindowWidth, WindowHeight, nullptr, nullptr, hThisInstance, nullptr); + ShowWindow(WindowHandle, nCmdShow); + UpdateWindow(WindowHandle); + InitD3D(WindowHandle); + } + + MSG Messages = {0}; + + while(true) + { + while(PeekMessage(&Messages, nullptr, 0, 0, PM_REMOVE)) + { + TranslateMessage(&Messages); + DispatchMessage(&Messages); + } + + if (Messages.message == WM_QUIT) + break; + + RenderD3D(); + } + + CleanUpD3d(); + return Messages.wParam; +} diff --git a/d3d9/Graphics.cpp b/d3d9/Deprecated/Graphics.cpp.bak similarity index 100% rename from d3d9/Graphics.cpp rename to d3d9/Deprecated/Graphics.cpp.bak diff --git a/d3d9/Graphics.hpp b/d3d9/Deprecated/Graphics.hpp.bak similarity index 100% rename from d3d9/Graphics.hpp rename to d3d9/Deprecated/Graphics.hpp.bak diff --git a/d3d9/Deprecated/SmartJNI.cpp.bak b/d3d9/Deprecated/SmartJNI.cpp.bak new file mode 100644 index 0000000..87980ef --- /dev/null +++ b/d3d9/Deprecated/SmartJNI.cpp.bak @@ -0,0 +1,218 @@ +/** © 2013, Brandon T. All Rights Reserved. + * + * This file is part of the DXI Library. + * DXI is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * DXI is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with DXI. If not, see . + */ + +#include "SmartPlugin.hpp" +#include + +ID3DXSprite* Sprite = nullptr; +IDirect3DTexture9* Texture = nullptr; +unsigned char* TexturePixels = nullptr; +SMARTInfo* SmartGlobal = nullptr; +bool SmartDebugEnabled = false; +bool SmartDirectXEnabled = true; + +void SMARTButtonPressed(int ID, bool State) +{ + switch(ID) + { + case 100: + if (State) + { + SmartGlobal->setCapture(false); + SmartDirectXEnabled = true; + } + else + { + SmartGlobal->setCapture(true); + SmartDirectXEnabled = false; + } + break; + + case 101: + SmartDebugEnabled = State ? false : true; + break; + + } +} + +extern "C" void SMARTPluginInit(SMARTInfo* ptr, bool* ReplaceButtons, int* ButtonCount, char** * ButtonText, int** ButtonIDs, _SMARTButtonPressed* ButtonCallback) +{ + SmartGlobal = ptr; + if (ptr) + { + *ReplaceButtons = true; + char** ButtonTexts = new char* [2]; + ButtonTexts[0] = const_cast("Disable Direct-X_Enable Direct-X"); + ButtonTexts[1] = const_cast("Enable Debug_Disable Debug"); + + int* IDs = new int[2]; + IDs[0] = 100; + IDs[1] = 101; + + *ButtonCount = 2; + *ButtonText = ButtonTexts; + *ButtonIDs = IDs; + *ButtonCallback = &SMARTButtonPressed; + } +} + +void LoadTexture(IDirect3DDevice9* Device, unsigned char* buffer, int width, int height, IDirect3DTexture9*& Texture, ID3DXSprite*& Sprite) +{ + Device->CreateTexture(width, height, 1, 0, /*D3DFMT_X8R8G8B8*/D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &Texture, 0); + D3DXCreateSprite(Device, &Sprite); + + D3DLOCKED_RECT rect; + Texture->LockRect(0, &rect, nullptr, D3DLOCK_DISCARD); + TexturePixels = static_cast(rect.pBits); + Texture->UnlockRect(0); + + memcpy(TexturePixels, &buffer[0], width * height * 4); +} + +void LoadTexture(IDirect3DDevice9* Device, const char* FilePath, IDirect3DTexture9*& Texture, ID3DXSprite*& Sprite) +{ + D3DXCreateTextureFromFileEx(Device, FilePath, + D3DX_DEFAULT_NONPOW2, //width + D3DX_DEFAULT_NONPOW2, //height + 1, //mip map levels + 0, //usage + D3DFMT_FROM_FILE, //D3DFMT_X8B8G8R8, //format + D3DPOOL_MANAGED,//D3DPOOL_DEFAULT,//D3DPOOL_MANAGED, //pool + D3DX_DEFAULT, + D3DX_DEFAULT, + 0xFF000000, //alpha is FF + nullptr, //D3DXIMAGE_INFO* + nullptr, + &Texture); + D3DXCreateSprite(Device, &Sprite); +} + +void DrawTextureSprite(IDirect3DDevice9* Device, IDirect3DTexture9* Texture, ID3DXSprite* Sprite) +{ + if (Sprite && Texture) + { + /*D3DXMATRIX world = {0}, rotation = {0}, scale = {0}, translation = {0}; + D3DXMatrixIdentity(&world); + + D3DXMatrixScaling(&scale, 1.0f, 1.0f, 1.0f); + D3DXMatrixRotationYawPitchRoll(&rotation, 0.0f, 0.0f, 0.0f); + D3DXMatrixTranslation(&translation, 0.0f, 0.0f, 0.0f); + world = rotation * scale * translation; + + Sprite->SetTransform(&world);*/ + + /*Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); + Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); + Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); + Device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);*/ + + //Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); + //Device->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); + + D3DXVECTOR3 Position = D3DXVECTOR3(0, 0, 0); + Sprite->Begin(D3DXSPRITE_ALPHABLEND); + Sprite->Draw(Texture, nullptr, nullptr, &Position, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF)); //0xFFFFFFFF - white.. + Sprite->End(); + } +} + +void BltSmartBuffer(IDirect3DDevice9* Device) +{ + if (SmartGlobal != nullptr) + { + std::uint8_t* Ptr = reinterpret_cast(SmartGlobal->dbg); + for (int I = 0; I < SmartGlobal->height; ++I) + { + for (int J = 0; J < SmartGlobal->width; ++J) + { + std::uint8_t B = *(Ptr++); + std::uint8_t G = *(Ptr++); + std::uint8_t R = *(Ptr++); + *(Ptr++) = (B == 0 && G == 0 && R == 0) ? 0 : 0xFF; + } + } + + if (!Sprite || !Texture) + { + LoadTexture(Device, static_cast(SmartGlobal->dbg), SmartGlobal->width, SmartGlobal->height, Texture, Sprite); + } + else + { + memcpy(TexturePixels, SmartGlobal->dbg, SmartGlobal->width * SmartGlobal->height * 4); + } + + DrawTextureSprite(Device, Texture, Sprite); + } +} + +HRESULT dxReadPixels(IDirect3DDevice9* Device, void* Buffer, HDC& DC, int& Width, int& Height, D3DFORMAT Format) +{ + IDirect3DSurface9* RenderTarget = nullptr; + IDirect3DSurface9* DestTarget = nullptr; + HRESULT result = Device->GetRenderTarget(0, &RenderTarget); + + if (result == S_OK) + { + if (Width == 0 || Height == 0 || Format == D3DFMT_UNKNOWN) + { + D3DSURFACE_DESC descriptor = {}; + RenderTarget->GetDesc(&descriptor); + Width = descriptor.Width; + Height = descriptor.Height; + Format = descriptor.Format; + } + + RenderTarget->GetDC(&DC); + result = Device->CreateOffscreenPlainSurface(Width, Height, Format, D3DPOOL_SYSTEMMEM, &DestTarget, nullptr); + result = Device->GetRenderTargetData(RenderTarget, DestTarget); + + D3DLOCKED_RECT rect; + DestTarget->LockRect(&rect, 0, D3DLOCK_READONLY); + memcpy(Buffer, rect.pBits, Width * Height * 4); + DestTarget->UnlockRect(); + } + + SafeRelease(RenderTarget); + SafeRelease(DestTarget); + return result; +} + +struct VERTEX_2D_DIF +{ + float x, y, z, rhw; + D3DCOLOR color; + static const DWORD FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE; +}; + +void DrawCircle(IDirect3DDevice9* Device, float mx, float my, float r, D3DCOLOR color) +{ + static const int CIRCLE_RESOLUTION = 50; + + VERTEX_2D_DIF verts[CIRCLE_RESOLUTION + 1]; + + for (int i = 0; i < CIRCLE_RESOLUTION + 1; ++i) + { + verts[i].x = mx + r * cos(D3DX_PI * (i / (CIRCLE_RESOLUTION / 2.0f))); + verts[i].y = my + r * sin(D3DX_PI * (i / (CIRCLE_RESOLUTION / 2.0f))); + verts[i].z = 0; + verts[i].rhw = 1; + verts[i].color = color; + } + + Device->SetFVF(VERTEX_2D_DIF::FVF); + Device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, CIRCLE_RESOLUTION-1, &verts, sizeof(VERTEX_2D_DIF)); +} diff --git a/d3d9/Hooks/Direct3DDevice9Proxy.cpp b/d3d9/Hooks/Direct3DDevice9Proxy.cpp index 1bd4023..0b3d574 100644 --- a/d3d9/Hooks/Direct3DDevice9Proxy.cpp +++ b/d3d9/Hooks/Direct3DDevice9Proxy.cpp @@ -96,6 +96,7 @@ UINT Direct3DDevice9Proxy::GetNumberOfSwapChains() HRESULT Direct3DDevice9Proxy::Reset(D3DPRESENT_PARAMETERS* pPresentationParameters) { + SafeRelease(Texture); return ptr_Direct3DDevice9->Reset(pPresentationParameters); } @@ -230,43 +231,41 @@ HRESULT Direct3DDevice9Proxy::EndScene() if (SmartGlobal && SmartGlobal->version) { dxReadPixels(ptr_Direct3DDevice9, SmartGlobal->img, hdc, SmartGlobal->width, SmartGlobal->height); - if (!IsIconic(WindowFromDC(hdc))) - { - if (SmartDebugEnabled) - { - BltSmartBuffer(ptr_Direct3DDevice9); - } - - int X = 0, Y = 0; - SmartGlobal->getMousePos(X, Y); - if (X != -1 && Y != -1) - { - //SetRenderState(D3DRS_POINTSIZE,...). //Not cross-hardware compatible.. - //ptr_Direct3DDevice9->DrawPrimitive(D3DPT_POINTLIST, 0, 6); - //DrawCircle(ptr_Direct3DDevice9, X, Y, 2); //Weird behaviour - } - } - } + IDirect3DStateBlock9* block; + ptr_Direct3DDevice9->CreateStateBlock(D3DSBT_ALL, &block); + block->Capture(); - /**Removed because Direct-X can be captured from Targets without plugins**/ - /*else - { - if (!SharedImageData || !SharedImageData->GetDataPointer()) + ptr_Direct3DDevice9->SetRenderState(D3DRS_LIGHTING, FALSE); + ptr_Direct3DDevice9->SetRenderState(D3DRS_FOGENABLE, FALSE); + ptr_Direct3DDevice9->SetRenderState(D3DRS_ZENABLE, D3DZB_FALSE); + ptr_Direct3DDevice9->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); + ptr_Direct3DDevice9->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); + ptr_Direct3DDevice9->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); + ptr_Direct3DDevice9->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); + ptr_Direct3DDevice9->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); + + + if (SmartDebugEnabled) { - CreateSharedMemory(getpid()) || OpenSharedMemory(getpid()); + BltSmartBuffer(ptr_Direct3DDevice9); } - int Width = 0, Height = 0; - void* ImgPtr = SharedImageData->GetDataPointer(); - dxReadPixels(ptr_Direct3DDevice9, ImgPtr, hdc, Width, Height); + int X = -1, Y = -1; + SmartGlobal->getMousePos(X, Y); - if (!IsIconic(WindowFromDC(hdc))) + if (X > -1 && Y > -1) { - void* DbgPtr = reinterpret_cast(SharedImageData->GetDataPointer()) + SharedImageSize; - BltMappedBuffer(DbgPtr, Width, Height); + //ptr_Direct3DDevice9->SetRenderState(D3DRS_ZFUNC,D3DCMP_NEVER); + ptr_Direct3DDevice9->SetTexture(0, nullptr); + ptr_Direct3DDevice9->SetPixelShader(nullptr); + ptr_Direct3DDevice9->SetVertexShader(nullptr); + DrawCircle(ptr_Direct3DDevice9, X, Y, 2.5f); } - }*/ + + block->Apply(); + block->Release(); + } return ptr_Direct3DDevice9->EndScene(); } diff --git a/d3d9/Hooks/Direct3DDevice9Proxy.hpp b/d3d9/Hooks/Direct3DDevice9Proxy.hpp index 8e424ac..92e8dc2 100644 --- a/d3d9/Hooks/Direct3DDevice9Proxy.hpp +++ b/d3d9/Hooks/Direct3DDevice9Proxy.hpp @@ -2,7 +2,6 @@ #define DIRECT3DDEVICE9PROXY_HPP_INCLUDED #include -#include "../Graphics.hpp" #include "../SMARTPlugin.hpp" class Direct3DDevice9Proxy : public IDirect3DDevice9 diff --git a/d3d9/SMARTPlugin.hpp b/d3d9/SMARTPlugin.hpp index ada09b9..03f9f72 100644 --- a/d3d9/SMARTPlugin.hpp +++ b/d3d9/SMARTPlugin.hpp @@ -18,9 +18,10 @@ #ifndef _SMART_PLUGIN #define _SMART_PLUGIN -#include +#include #include -#include "Graphics.hpp" +#include +#include typedef void (*_SMARTGetMousePos)(int &x, int &y); typedef void (*_SMARTSetCapture)(bool enabled); @@ -35,19 +36,27 @@ typedef struct _SMARTSetCapture setCapture; } SMARTInfo; - +template +void SafeRelease(T* &Ptr) +{ + if (Ptr) + { + Ptr->Release(); + Ptr = nullptr; + } +} typedef void (*_SMARTPluginInit)(SMARTInfo* ptr, bool* ReplaceButtons, int* ButtonCount, char*** ButtonText, int** ButtonIDs, _SMARTButtonPressed* ButtonCallback); -extern ID3DXSprite* Sprite; extern IDirect3DTexture9* Texture; -extern unsigned char* TexturePixels; +extern std::uint8_t* TexturePixels; + extern SMARTInfo* SmartGlobal; extern bool SmartDebugEnabled; extern bool SmartDirectXEnabled; + void BltSmartBuffer(IDirect3DDevice9* Device); -void FlipImageBytes(void* In, void* &Out, int width, int height, unsigned int Bpp = 32); HRESULT dxReadPixels(IDirect3DDevice9* Device, void* Buffer, HDC &DC, int &Width, int &Height, D3DFORMAT Format = D3DFMT_UNKNOWN); -void DrawCircle(IDirect3DDevice9* Device, float mx, float my, float r, D3DCOLOR color = D3DCOLOR_XRGB(255, 0, 0)); +void DrawCircle(IDirect3DDevice9* Device, float mx, float my, float r, D3DCOLOR colour = D3DCOLOR_RGBA(0xFF, 0x00, 0x00, 0xFF)); #endif diff --git a/d3d9/SmartJNI.cpp b/d3d9/SmartJNI.cpp index 74f461c..894f16c 100644 --- a/d3d9/SmartJNI.cpp +++ b/d3d9/SmartJNI.cpp @@ -16,11 +16,10 @@ */ #include "SmartPlugin.hpp" -#include -ID3DXSprite* Sprite = nullptr; IDirect3DTexture9* Texture = nullptr; -unsigned char* TexturePixels = nullptr; +std::uint8_t* TexturePixels = nullptr; + SMARTInfo* SmartGlobal = nullptr; bool SmartDebugEnabled = false; bool SmartDirectXEnabled = true; @@ -57,7 +56,7 @@ extern "C" void SMARTPluginInit(SMARTInfo* ptr, bool* ReplaceButtons, int* Butto *ReplaceButtons = true; char** ButtonTexts = new char* [2]; ButtonTexts[0] = const_cast("Disable Direct-X_Enable Direct-X"); - ButtonTexts[1] = const_cast("Enable Debug_Disable Debug"); + ButtonTexts[1] = const_cast("Enable Debug_Disable dxDebug"); int* IDs = new int[2]; IDs[0] = 100; @@ -70,64 +69,67 @@ extern "C" void SMARTPluginInit(SMARTInfo* ptr, bool* ReplaceButtons, int* Butto } } -void LoadTexture(IDirect3DDevice9* Device, unsigned char* buffer, int width, int height, IDirect3DTexture9*& Texture, ID3DXSprite*& Sprite) +#define VERTEX_FVF (D3DFVF_XYZRHW | D3DFVF_DIFFUSE) +#define VERTEX_FVF_TEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1) + +struct D3DVertex { - Device->CreateTexture(width, height, 1, 0, /*D3DFMT_X8R8G8B8*/D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &Texture, 0); - D3DXCreateSprite(Device, &Sprite); + float X, Y, Z, RHW; + unsigned int Colour; + float U, V; +}; + +void LoadTexture(IDirect3DDevice9* Device, std::uint8_t* buffer, int width, int height, IDirect3DTexture9* &Texture) +{ + Device->CreateTexture(width, height, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &Texture, 0); D3DLOCKED_RECT rect; Texture->LockRect(0, &rect, nullptr, D3DLOCK_DISCARD); - TexturePixels = static_cast(rect.pBits); + TexturePixels = static_cast(rect.pBits); Texture->UnlockRect(0); - memcpy(TexturePixels, &buffer[0], width * height * 4); } -void LoadTexture(IDirect3DDevice9* Device, const char* FilePath, IDirect3DTexture9*& Texture, ID3DXSprite*& Sprite) -{ - D3DXCreateTextureFromFileEx(Device, FilePath, - D3DX_DEFAULT_NONPOW2, //width - D3DX_DEFAULT_NONPOW2, //height - 1, //mip map levels - 0, //usage - D3DFMT_FROM_FILE, //D3DFMT_X8B8G8R8, //format - D3DPOOL_MANAGED,//D3DPOOL_DEFAULT,//D3DPOOL_MANAGED, //pool - D3DX_DEFAULT, - D3DX_DEFAULT, - 0xFF000000, //alpha is FF - nullptr, //D3DXIMAGE_INFO* - nullptr, - &Texture); - D3DXCreateSprite(Device, &Sprite); -} - -void DrawTextureSprite(IDirect3DDevice9* Device, IDirect3DTexture9* Texture, ID3DXSprite* Sprite) +void DrawTexture(IDirect3DDevice9* Device, IDirect3DTexture9* Texture, float X1, float Y1, float X2, float Y2) { - if (Sprite && Texture) - { - /*D3DXMATRIX world = {0}, rotation = {0}, scale = {0}, translation = {0}; - D3DXMatrixIdentity(&world); - - D3DXMatrixScaling(&scale, 1.0f, 1.0f, 1.0f); - D3DXMatrixRotationYawPitchRoll(&rotation, 0.0f, 0.0f, 0.0f); - D3DXMatrixTranslation(&translation, 0.0f, 0.0f, 0.0f); - world = rotation * scale * translation; + /**http://msdn.microsoft.com/en-us/library/windows/desktop/bb219690%28v=vs.85%29.aspx**/ + /**Offsets needed because of the above**/ - Sprite->SetTransform(&world);*/ + float UOffset = 0.5f / (float)(X2 - X1); + float VOffset = 0.5f / (float)(Y2 - Y1); - /*Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); - Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); - Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); - Device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);*/ + D3DVertex Vertices[] = + { + {X1, Y1, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 0.0f + UOffset, 0.0f + VOffset}, + {X2, Y1, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 1.0f + UOffset, 0.0f + VOffset}, + {X1, Y2, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 0.0f + UOffset, 1.0f + VOffset}, + {X2, Y2, 1.0f, 1.0f, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF), 1.0f + UOffset, 1.0f + VOffset} + }; + + Device->SetFVF(VERTEX_FVF_TEX); + Device->SetTexture(0, Texture); + Device->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, Vertices, sizeof(D3DVertex)); + Device->SetTexture(0, nullptr); +} - //Device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); - //Device->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD); +void DrawCircle(IDirect3DDevice9* Device, float CX, float CY, float Radius, D3DCOLOR Colour) +{ + static const int Resolution = 10; + D3DVertex Vertices[Resolution]; - D3DXVECTOR3 Position = D3DXVECTOR3(0, 0, 0); - Sprite->Begin(D3DXSPRITE_ALPHABLEND); - Sprite->Draw(Texture, nullptr, nullptr, &Position, D3DCOLOR_RGBA(0xFF, 0xFF, 0xFF, 0xFF)); //0xFFFFFFFF - white.. - Sprite->End(); + for (int I = 0; I < Resolution; ++I) + { + Vertices[I].X = CX + Radius * std::cos(3.141592654f * (I / (Resolution / 2.0f))); + Vertices[I].Y = CY + Radius * std::sin(3.141592654f * (I / (Resolution / 2.0f))); + Vertices[I].Z = 0.0f; + Vertices[I].RHW = 1.0f; + Vertices[I].Colour = Colour; + Vertices[I].U = 0.0f; + Vertices[I].V = 0.0f; } + + Device->SetFVF(VERTEX_FVF_TEX); + Device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, Resolution - 2, Vertices, sizeof(D3DVertex)); } void BltSmartBuffer(IDirect3DDevice9* Device) @@ -146,18 +148,16 @@ void BltSmartBuffer(IDirect3DDevice9* Device) } } - if (!Texture) + if (!Texture) /**Set Device->Reset for more info.**/ { - LoadTexture(Device, static_cast(SmartGlobal->dbg), SmartGlobal->width, SmartGlobal->height, Texture, Sprite); + LoadTexture(Device, static_cast(SmartGlobal->dbg), SmartGlobal->width, SmartGlobal->height, Texture); } else { memcpy(TexturePixels, SmartGlobal->dbg, SmartGlobal->width * SmartGlobal->height * 4); } - DrawTextureSprite(Device, Texture, Sprite); - SafeRelease(Texture); - SafeRelease(Sprite); + DrawTexture(Device, Texture, 0, 0, SmartGlobal->width, SmartGlobal->height); } } @@ -192,29 +192,3 @@ HRESULT dxReadPixels(IDirect3DDevice9* Device, void* Buffer, HDC& DC, int& Width SafeRelease(DestTarget); return result; } - -struct VERTEX_2D_DIF -{ - float x, y, z, rhw; - D3DCOLOR color; - static const DWORD FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE; -}; - -void DrawCircle(IDirect3DDevice9* Device, float mx, float my, float r, D3DCOLOR color) -{ - static const int CIRCLE_RESOLUTION = 50; - - VERTEX_2D_DIF verts[CIRCLE_RESOLUTION + 1]; - - for (int i = 0; i < CIRCLE_RESOLUTION + 1; ++i) - { - verts[i].x = mx + r * cos(D3DX_PI * (i / (CIRCLE_RESOLUTION / 2.0f))); - verts[i].y = my + r * sin(D3DX_PI * (i / (CIRCLE_RESOLUTION / 2.0f))); - verts[i].z = 0; - verts[i].rhw = 1; - verts[i].color = color; - } - - Device->SetFVF(VERTEX_2D_DIF::FVF); - Device->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, CIRCLE_RESOLUTION-1, &verts, sizeof(VERTEX_2D_DIF)); -} diff --git a/d3d9/d3d9.cbp b/d3d9/d3d9.cbp index 2372cfc..c2561b5 100644 --- a/d3d9/d3d9.cbp +++ b/d3d9/d3d9.cbp @@ -50,12 +50,9 @@ - - - diff --git a/d3d9/d3d9.depend b/d3d9/d3d9.depend index 620e2ae..478d0eb 100644 --- a/d3d9/d3d9.depend +++ b/d3d9/d3d9.depend @@ -242,3 +242,175 @@ 1390554680 source:c:\users\school\desktop\direct-x\d3d9\main.cpp "Hooks/Exports.hpp" +1391233088 source:c:\users\school\desktop\d3d9\graphics.cpp + "Graphics.hpp" + +1391233088 c:\users\school\desktop\d3d9\graphics.hpp + + + + + "Images.hpp" + +1391233088 c:\users\school\desktop\d3d9\images.hpp + + + + + + + +1391233088 source:c:\users\school\desktop\d3d9\hooks\exports.cpp + "Exports.hpp" + +1391233088 c:\users\school\desktop\d3d9\hooks\exports.hpp + + + "Library.hpp" + "IDirect3D9Proxy.hpp" + +1391233088 c:\users\school\desktop\d3d9\hooks\library.hpp + + + + + +1391233088 c:\users\school\desktop\d3d9\hooks\idirect3d9proxy.hpp + + "Direct3DDevice9Proxy.hpp" + +1391233088 c:\users\school\desktop\d3d9\hooks\direct3ddevice9proxy.hpp + + "../Graphics.hpp" + "../SMARTPlugin.hpp" + +1391233088 c:\users\school\desktop\d3d9\smartplugin.hpp + + + "Graphics.hpp" + +1391233088 source:c:\users\school\desktop\d3d9\hooks\hooks.cpp + "Hooks.hpp" + +1391233088 c:\users\school\desktop\d3d9\hooks\hooks.hpp + + + + "Exports.hpp" + "../SharedMemory.hpp" + "../SMARTPlugin.hpp" + +1391233088 c:\users\school\desktop\d3d9\sharedmemory.hpp + + + + + + + + + + +1391233088 source:c:\users\school\desktop\d3d9\hooks\idirect3d9proxy.cpp + "IDirect3D9Proxy.hpp" + +1391233088 source:c:\users\school\desktop\d3d9\hooks\library.cpp + "Library.hpp" + +1391233088 source:c:\users\school\desktop\d3d9\main.cpp + "Hooks/Exports.hpp" + +1391233088 source:c:\users\school\desktop\d3d9\sharedmemory.cpp + "SharedMemory.hpp" + +1391233252 source:c:\users\school\desktop\d3d9\smartjni.cpp + "SmartPlugin.hpp" + + +1391233088 source:c:\users\school\desktop\d3d9 - copy\graphics.cpp + "Graphics.hpp" + +1391233088 c:\users\school\desktop\d3d9 - copy\graphics.hpp + + + + + "Images.hpp" + +1391233088 c:\users\school\desktop\d3d9 - copy\images.hpp + + + + + + + +1391233088 source:c:\users\school\desktop\d3d9 - copy\hooks\exports.cpp + "Exports.hpp" + +1391233088 c:\users\school\desktop\d3d9 - copy\hooks\exports.hpp + + + "Library.hpp" + "IDirect3D9Proxy.hpp" + +1391233088 c:\users\school\desktop\d3d9 - copy\hooks\library.hpp + + + + + +1391233088 c:\users\school\desktop\d3d9 - copy\hooks\idirect3d9proxy.hpp + + "Direct3DDevice9Proxy.hpp" + +1391282057 c:\users\school\desktop\d3d9 - copy\hooks\direct3ddevice9proxy.hpp + + "../SMARTPlugin.hpp" + +1391282007 c:\users\school\desktop\d3d9 - copy\smartplugin.hpp + + + + + +1391233088 source:c:\users\school\desktop\d3d9 - copy\hooks\hooks.cpp + "Hooks.hpp" + +1391233088 c:\users\school\desktop\d3d9 - copy\hooks\hooks.hpp + + + + "Exports.hpp" + "../SharedMemory.hpp" + "../SMARTPlugin.hpp" + +1391233088 c:\users\school\desktop\d3d9 - copy\sharedmemory.hpp + + + + + + + + + + +1391233088 source:c:\users\school\desktop\d3d9 - copy\hooks\idirect3d9proxy.cpp + "IDirect3D9Proxy.hpp" + +1391233088 source:c:\users\school\desktop\d3d9 - copy\hooks\library.cpp + "Library.hpp" + +1391281937 source:c:\users\school\desktop\d3d9 - copy\main.cpp + "Hooks/Exports.hpp" + +1391233088 source:c:\users\school\desktop\d3d9 - copy\sharedmemory.cpp + "SharedMemory.hpp" + +1391282746 source:c:\users\school\desktop\d3d9 - copy\hooks\direct3ddevice9proxy.cpp + "Direct3DDevice9Proxy.hpp" + +1391281889 source:c:\users\school\desktop\d3d9 - copy\smartjni.cpp + "SmartPlugin.hpp" + diff --git a/d3d9/d3d9.layout b/d3d9/d3d9.layout index 3983fea..89a67bb 100644 --- a/d3d9/d3d9.layout +++ b/d3d9/d3d9.layout @@ -1,49 +1,39 @@ - - - - - - - - - - - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -51,19 +41,19 @@ - + - + - + - + - + - + @@ -71,14 +61,14 @@ - + - + - + - + diff --git a/d3d9/main.cpp b/d3d9/main.cpp index c707bcf..48674d3 100644 --- a/d3d9/main.cpp +++ b/d3d9/main.cpp @@ -11,7 +11,6 @@ extern "C" bool __stdcall DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lp } case DLL_PROCESS_DETACH: - SafeRelease(Sprite); SafeRelease(Texture); DeInitialize(); break;