[saco] Implement ID3DXFontHook functions

This commit is contained in:
RD42 2024-03-14 23:48:25 +08:00
parent abced1233f
commit e8c56e3085
4 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,96 @@
#include "ID3DXFontHook.h"
#include "../main.h"
INT __stdcall ID3DXFontHook::DrawTextA(LPD3DXSPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color)
{
// TODO: ID3DXFontHook::DrawTextA
return m_pD3DFont->DrawTextA(pSprite, pString, Count, pRect, Format, Color);
}
HRESULT __stdcall ID3DXFontHook::QueryInterface(REFIID iid, LPVOID *ppv)
{
return m_pD3DFont->QueryInterface(iid, ppv);
}
ULONG __stdcall ID3DXFontHook::AddRef()
{
return m_pD3DFont->AddRef();
}
ULONG __stdcall ID3DXFontHook::Release()
{
return m_pD3DFont->Release();
}
HRESULT __stdcall ID3DXFontHook::GetDevice(LPDIRECT3DDEVICE9 *ppDevice)
{
return m_pD3DFont->GetDevice(ppDevice);
}
HRESULT __stdcall ID3DXFontHook::GetDescA(D3DXFONT_DESCA *pDesc)
{
return m_pD3DFont->GetDescA(pDesc);
}
HRESULT __stdcall ID3DXFontHook::GetDescW(D3DXFONT_DESCW *pDesc)
{
return m_pD3DFont->GetDescW(pDesc);
}
BOOL __stdcall ID3DXFontHook::GetTextMetricsA(TEXTMETRICA *pTextMetrics)
{
return m_pD3DFont->GetTextMetricsA(pTextMetrics);
}
BOOL __stdcall ID3DXFontHook::GetTextMetricsW(TEXTMETRICW *pTextMetrics)
{
return m_pD3DFont->GetTextMetricsW(pTextMetrics);
}
HDC __stdcall ID3DXFontHook::GetDC()
{
return m_pD3DFont->GetDC();
}
HRESULT __stdcall ID3DXFontHook::GetGlyphData(UINT Glyph, LPDIRECT3DTEXTURE9 *ppTexture, RECT *pBlackBox, POINT *pCellInc)
{
return m_pD3DFont->GetGlyphData(Glyph, ppTexture, pBlackBox, pCellInc);
}
HRESULT __stdcall ID3DXFontHook::PreloadCharacters(UINT First, UINT Last)
{
return m_pD3DFont->PreloadCharacters(First, Last);
}
HRESULT __stdcall ID3DXFontHook::PreloadGlyphs(UINT First, UINT Last)
{
return m_pD3DFont->PreloadGlyphs(First, Last);
}
HRESULT __stdcall ID3DXFontHook::PreloadTextA(LPCSTR pString, INT Count)
{
return m_pD3DFont->PreloadTextA(pString, Count);
}
HRESULT __stdcall ID3DXFontHook::PreloadTextW(LPCWSTR pString, INT Count)
{
return m_pD3DFont->PreloadTextW(pString, Count);
}
INT __stdcall ID3DXFontHook::DrawTextW(LPD3DXSPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color)
{
return m_pD3DFont->DrawTextW(pSprite, pString, Count, pRect, Format, Color);
}
HRESULT __stdcall ID3DXFontHook::OnLostDevice()
{
return m_pD3DFont->OnLostDevice();
}
HRESULT __stdcall ID3DXFontHook::OnResetDevice()
{
return m_pD3DFont->OnResetDevice();
}

View File

@ -0,0 +1,34 @@
#pragma once
#ifndef ID3DXFONTHOOK_H
#define ID3DXFONTHOOK_H
#include <d3d9.h>
#include <d3dx9.h>
interface ID3DXFontHook : public ID3DXFont
{
public:
HRESULT __stdcall QueryInterface(REFIID iid, LPVOID *ppv);
ULONG __stdcall AddRef();
ULONG __stdcall Release();
HRESULT __stdcall GetDevice(LPDIRECT3DDEVICE9 *ppDevice);
HRESULT __stdcall GetDescA(D3DXFONT_DESCA *pDesc);
HRESULT __stdcall GetDescW(D3DXFONT_DESCW *pDesc);
BOOL __stdcall GetTextMetricsA(TEXTMETRICA *pTextMetrics);
BOOL __stdcall GetTextMetricsW(TEXTMETRICW *pTextMetrics);
HDC __stdcall GetDC();
HRESULT __stdcall GetGlyphData(UINT Glyph, LPDIRECT3DTEXTURE9 *ppTexture, RECT *pBlackBox, POINT *pCellInc);
HRESULT __stdcall PreloadCharacters(UINT First, UINT Last);
HRESULT __stdcall PreloadGlyphs(UINT First, UINT Last);
HRESULT __stdcall PreloadTextA(LPCSTR pString, INT Count);
HRESULT __stdcall PreloadTextW(LPCWSTR pString, INT Count);
INT __stdcall DrawTextA(LPD3DXSPRITE pSprite, LPCSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color);
INT __stdcall DrawTextW(LPD3DXSPRITE pSprite, LPCWSTR pString, INT Count, LPRECT pRect, DWORD Format, D3DCOLOR Color);
HRESULT __stdcall OnLostDevice();
HRESULT __stdcall OnResetDevice();
ID3DXFont *m_pD3DFont;
};
#endif

View File

@ -321,6 +321,8 @@ void DoInitStuff()
pD3DDevice->ShowCursor(FALSE);
// Create instances of the chat and input classes.
pDefaultFont = new CFontRender(pD3DDevice);

View File

@ -23,6 +23,7 @@ typedef struct _GAME_SETTINGS {
} GAME_SETTINGS;
#include "d3dhook/IDirect3DDevice9Hook.h"
#include "d3dhook/ID3DXFontHook.h"
#include "d3d9/include/d3d9.h"
#include "d3d9/include/d3dx9core.h"