Skip to content

Commit

Permalink
Add CMyFontVtbl
Browse files Browse the repository at this point in the history
Add g_CMyFont
  • Loading branch information
kss1 committed Dec 4, 2024
1 parent 23dddf1 commit 1e8fbba
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 78 deletions.
6 changes: 3 additions & 3 deletions src/th06_102h.exe/CMyFont/Clean.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
void __thiscall th06::CMyFont::Clean(CMyFont *this)

{
if (this[1].m_lpFont != (LPD3DXFONT)NULL) {
(*(this[1].m_lpFont)->lpVtbl->Release)((IDirect3DVolume8 *)this[1].m_lpFont);
this[1].m_lpFont = (LPD3DXFONT)NULL;
if (this->m_lpFont != (LPD3DXFONT)NULL) {
(*this->m_lpFont->lpVtbl->Release)((IDirect3DVolume8 *)this->m_lpFont);
this->m_lpFont = (LPD3DXFONT)NULL;
}
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/th06_102h.exe/CMyFont/Init.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void __thiscall th06::CMyFont::Init(CMyFont *this,LPDIRECT3DDEVICE8 lpD3DDEV,int
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"MS ゴシック");
if (hFont != (HFONT)NULL) {
hOldFont = SelectObject(hTextDC,hFont);
HVar1 = D3DXCreateFont(lpD3DDEV,(HFONT)hFont,&this[1].m_lpFont);
HVar1 = D3DXCreateFont(lpD3DDEV,(HFONT)hFont,&this->m_lpFont);
if (HVar1 < 0) {
MessageBoxA((HWND)0x0,"D3DXCreateFontIndirect FALSE","ok",MB_OK);
}
Expand Down
4 changes: 2 additions & 2 deletions src/th06_102h.exe/CMyFont/Print.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ void __thiscall th06::CMyFont::Print(CMyFont *this,char *str,int x,int y,D3DCOLO
local_14.right = 0x280;
local_14.top = y;
local_14.bottom = 0x1e0;
(*(this[1].m_lpFont)->lpVtbl->DrawTextA)
((IDirect3DVolume8 *)this[1].m_lpFont,str,-1,(LPRECT)&local_14,0x40,color);
(*this->m_lpFont->lpVtbl->DrawTextA)
((IDirect3DVolume8 *)this->m_lpFont,str,-1,(LPRECT)&local_14,0x40,color);
return;
}

151 changes: 80 additions & 71 deletions src/th06_102h.exe/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1102,47 +1102,15 @@ struct AsciiManagerString {

typedef struct CMyFont CMyFont, *PCMyFont;

typedef struct ID3DXFont ID3DXFont, *PID3DXFont;

typedef struct ID3DXFont *LPD3DXFONT;

typedef struct ID3DXFontVtbl ID3DXFontVtbl, *PID3DXFontVtbl;

typedef struct IDirect3DVolume8 IDirect3DVolume8, *PIDirect3DVolume8;
typedef struct CMyFontVtbl CMyFontVtbl, *PCMyFontVtbl;

typedef struct IDirect3DDevice8 IDirect3DDevice8, *PIDirect3DDevice8;

typedef struct IDirect3DDevice8 *LPDIRECT3DDEVICE8;

typedef struct tagLOGFONTA tagLOGFONTA, *PtagLOGFONTA;

typedef struct tagLOGFONTA LOGFONTA;

typedef LOGFONTA LOGFONT;

typedef int INT;

typedef struct tagRECT tagRECT, *PtagRECT;

typedef struct tagRECT *LPRECT;

typedef wchar_t WCHAR;

typedef WCHAR *LPCWSTR;

typedef struct IDirect3DVolume8Vtbl IDirect3DVolume8Vtbl, *PIDirect3DVolume8Vtbl;

typedef struct _D3DVOLUME_DESC _D3DVOLUME_DESC, *P_D3DVOLUME_DESC;

typedef struct _D3DVOLUME_DESC D3DVOLUME_DESC;

typedef struct _D3DLOCKED_BOX _D3DLOCKED_BOX, *P_D3DLOCKED_BOX;

typedef struct _D3DLOCKED_BOX D3DLOCKED_BOX;

typedef struct _D3DBOX _D3DBOX, *P_D3DBOX;
typedef struct ID3DXFont ID3DXFont, *PID3DXFont;

typedef struct _D3DBOX D3DBOX;
typedef struct ID3DXFont *LPD3DXFONT;

typedef struct IDirect3DDevice8Vtbl IDirect3DDevice8Vtbl, *PIDirect3DDevice8Vtbl;

Expand All @@ -1168,6 +1136,8 @@ typedef struct _D3DPRESENT_PARAMETERS_ D3DPRESENT_PARAMETERS;

typedef struct IDirect3DSwapChain8 IDirect3DSwapChain8, *PIDirect3DSwapChain8;

typedef struct tagRECT tagRECT, *PtagRECT;

typedef struct tagRECT RECT;

typedef struct _RGNDATA _RGNDATA, *P_RGNDATA;
Expand Down Expand Up @@ -1420,18 +1390,23 @@ typedef struct _D3DTRIPATCH_INFO _D3DTRIPATCH_INFO, *P_D3DTRIPATCH_INFO;

typedef struct _D3DTRIPATCH_INFO D3DTRIPATCH_INFO;

typedef enum _D3DRESOURCETYPE {
D3DRTYPE_SURFACE=1,
D3DRTYPE_VOLUME=2,
D3DRTYPE_TEXTURE=3,
D3DRTYPE_VOLUMETEXTURE=4,
D3DRTYPE_CUBETEXTURE=5,
D3DRTYPE_VERTEXBUFFER=6,
D3DRTYPE_INDEXBUFFER=7,
D3DRTYPE_FORCE_DWORD=2147483647
} _D3DRESOURCETYPE;
typedef struct ID3DXFontVtbl ID3DXFontVtbl, *PID3DXFontVtbl;

typedef enum _D3DRESOURCETYPE D3DRESOURCETYPE;
typedef struct IDirect3DVolume8 IDirect3DVolume8, *PIDirect3DVolume8;

typedef struct tagLOGFONTA tagLOGFONTA, *PtagLOGFONTA;

typedef struct tagLOGFONTA LOGFONTA;

typedef LOGFONTA LOGFONT;

typedef int INT;

typedef struct tagRECT *LPRECT;

typedef wchar_t WCHAR;

typedef WCHAR *LPCWSTR;

typedef struct IDirect3D8Vtbl IDirect3D8Vtbl, *PIDirect3D8Vtbl;

Expand All @@ -1448,6 +1423,19 @@ typedef enum _D3DDEVTYPE {

typedef enum _D3DDEVTYPE D3DDEVTYPE;

typedef enum _D3DRESOURCETYPE {
D3DRTYPE_SURFACE=1,
D3DRTYPE_VOLUME=2,
D3DRTYPE_TEXTURE=3,
D3DRTYPE_VOLUMETEXTURE=4,
D3DRTYPE_CUBETEXTURE=5,
D3DRTYPE_VERTEXBUFFER=6,
D3DRTYPE_INDEXBUFFER=7,
D3DRTYPE_FORCE_DWORD=2147483647
} _D3DRESOURCETYPE;

typedef enum _D3DRESOURCETYPE D3DRESOURCETYPE;

typedef struct HMONITOR__ HMONITOR__, *PHMONITOR__;

typedef struct HMONITOR__ *HMONITOR;
Expand Down Expand Up @@ -1482,6 +1470,18 @@ typedef struct IDirect3DTexture8Vtbl IDirect3DTexture8Vtbl, *PIDirect3DTexture8V

typedef struct IDirect3DVolumeTexture8Vtbl IDirect3DVolumeTexture8Vtbl, *PIDirect3DVolumeTexture8Vtbl;

typedef struct _D3DVOLUME_DESC _D3DVOLUME_DESC, *P_D3DVOLUME_DESC;

typedef struct _D3DVOLUME_DESC D3DVOLUME_DESC;

typedef struct _D3DLOCKED_BOX _D3DLOCKED_BOX, *P_D3DLOCKED_BOX;

typedef struct _D3DLOCKED_BOX D3DLOCKED_BOX;

typedef struct _D3DBOX _D3DBOX, *P_D3DBOX;

typedef struct _D3DBOX D3DBOX;

typedef struct IDirect3DCubeTexture8Vtbl IDirect3DCubeTexture8Vtbl, *PIDirect3DCubeTexture8Vtbl;

typedef enum _D3DCUBEMAP_FACES {
Expand Down Expand Up @@ -1543,6 +1543,8 @@ typedef enum _D3DORDERTYPE {

typedef enum _D3DORDERTYPE D3DORDERTYPE;

typedef struct IDirect3DVolume8Vtbl IDirect3DVolume8Vtbl, *PIDirect3DVolume8Vtbl;

typedef union _LARGE_INTEGER _LARGE_INTEGER, *P_LARGE_INTEGER;

typedef union _LARGE_INTEGER LARGE_INTEGER;
Expand Down Expand Up @@ -1743,6 +1745,12 @@ struct IDirect3DDevice8Vtbl {
HRESULT (*DeletePatch)(struct IDirect3DDevice8 *, UINT);
};

struct CMyFontVtbl {
void (*Init)(LPDIRECT3DDEVICE8, int, int);
void (*Print)(char *, int, int, D3DCOLOR);
void (*Clean)(void);
};

struct IDirect3D8 {
struct IDirect3D8Vtbl *lpVtbl;
};
Expand Down Expand Up @@ -1772,20 +1780,6 @@ struct _D3DRASTER_STATUS {
UINT ScanLine;
};

struct IDirect3DVolume8Vtbl {
HRESULT (*QueryInterface)(struct IDirect3DVolume8 *, IID *, void **);
ULONG (*AddRef)(struct IDirect3DVolume8 *);
ULONG (*Release)(struct IDirect3DVolume8 *);
HRESULT (*GetDevice)(struct IDirect3DVolume8 *, struct IDirect3DDevice8 **);
HRESULT (*SetPrivateData)(struct IDirect3DVolume8 *, GUID *, void *, DWORD, DWORD);
HRESULT (*GetPrivateData)(struct IDirect3DVolume8 *, GUID *, void *, DWORD *);
HRESULT (*FreePrivateData)(struct IDirect3DVolume8 *, GUID *);
HRESULT (*GetContainer)(struct IDirect3DVolume8 *, IID *, void **);
HRESULT (*GetDesc)(struct IDirect3DVolume8 *, D3DVOLUME_DESC *);
HRESULT (*LockBox)(struct IDirect3DVolume8 *, D3DLOCKED_BOX *, D3DBOX *, DWORD);
HRESULT (*UnlockBox)(struct IDirect3DVolume8 *);
};

struct IDirect3DSurface8Vtbl {
HRESULT (*QueryInterface)(struct IDirect3DSurface8 *, IID *, void **);
ULONG (*AddRef)(struct IDirect3DSurface8 *);
Expand All @@ -1800,6 +1794,20 @@ struct IDirect3DSurface8Vtbl {
HRESULT (*UnlockRect)(struct IDirect3DSurface8 *);
};

struct IDirect3DVolume8Vtbl {
HRESULT (*QueryInterface)(struct IDirect3DVolume8 *, IID *, void **);
ULONG (*AddRef)(struct IDirect3DVolume8 *);
ULONG (*Release)(struct IDirect3DVolume8 *);
HRESULT (*GetDevice)(struct IDirect3DVolume8 *, struct IDirect3DDevice8 **);
HRESULT (*SetPrivateData)(struct IDirect3DVolume8 *, GUID *, void *, DWORD, DWORD);
HRESULT (*GetPrivateData)(struct IDirect3DVolume8 *, GUID *, void *, DWORD *);
HRESULT (*FreePrivateData)(struct IDirect3DVolume8 *, GUID *);
HRESULT (*GetContainer)(struct IDirect3DVolume8 *, IID *, void **);
HRESULT (*GetDesc)(struct IDirect3DVolume8 *, D3DVOLUME_DESC *);
HRESULT (*LockBox)(struct IDirect3DVolume8 *, D3DLOCKED_BOX *, D3DBOX *, DWORD);
HRESULT (*UnlockBox)(struct IDirect3DVolume8 *);
};

struct _D3DCOLORVALUE {
float r;
float g;
Expand Down Expand Up @@ -1916,6 +1924,10 @@ struct _D3DADAPTER_IDENTIFIER8 {
DWORD WHQLLevel;
};

struct IDirect3DBaseTexture8 {
struct IDirect3DBaseTexture8Vtbl *lpVtbl;
};

struct tagLOGFONTA {
LONG lfHeight;
LONG lfWidth;
Expand All @@ -1933,10 +1945,6 @@ struct tagLOGFONTA {
CHAR lfFaceName[32];
};

struct IDirect3DBaseTexture8 {
struct IDirect3DBaseTexture8Vtbl *lpVtbl;
};

struct IDirect3DVolumeTexture8Vtbl {
HRESULT (*QueryInterface)(struct IDirect3DVolumeTexture8 *, IID *, void **);
ULONG (*AddRef)(struct IDirect3DVolumeTexture8 *);
Expand Down Expand Up @@ -2023,6 +2031,7 @@ struct _D3DLOCKED_RECT {
};

struct CMyFont {
struct CMyFontVtbl *vtbl;
LPD3DXFONT m_lpFont;
};

Expand Down Expand Up @@ -2107,6 +2116,13 @@ struct ID3DXFontVtbl {
HRESULT (*End)(struct IDirect3DVolume8 *);
};

struct _D3DDEVICE_CREATION_PARAMETERS {
UINT AdapterOrdinal;
D3DDEVTYPE DeviceType;
HWND hFocusWindow;
DWORD BehaviorFlags;
};

struct _D3DVOLUME_DESC {
D3DFORMAT Format;
D3DRESOURCETYPE Type;
Expand All @@ -2118,13 +2134,6 @@ struct _D3DVOLUME_DESC {
UINT Depth;
};

struct _D3DDEVICE_CREATION_PARAMETERS {
UINT AdapterOrdinal;
D3DDEVTYPE DeviceType;
HWND hFocusWindow;
DWORD BehaviorFlags;
};

struct _D3DVERTEXBUFFER_DESC {
D3DFORMAT Format;
D3DRESOURCETYPE Type;
Expand Down
2 changes: 1 addition & 1 deletion th06_102h.exe.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
316
317

0 comments on commit 1e8fbba

Please sign in to comment.