Hey,
I've been experimenting with ASM and D3D of late and am requesting help regarding the accessing of member functions within the IDirect3D9 interfance.
I sometimes struggle to describe my problem, so here's the code;
.CONST
D3DADAPTER_DEFAULT equ 0
;______________________________________________________
;
; d3d9.dll!Direct3DCreate9 returns pointer
; to a pointer of the 'IDirect3D9' Interface
;______________________________________________________
comment $
IUnknown Methods
$
QueryInterface equ 1-1*4
AddRef equ 2-1*4
Release equ 3-1*4
comment $
IDirect3D9 Methods
$
RegisterSoftwareDevice equ 4-1*4
GetAdapterCount equ 5-1*4
GetAdapterIdentifier equ 6-1*4
GetAdapterModeCount equ 7-1*4
EnumAdapterModes equ 8-1*4
GetAdapterDisplayMode equ 9-1*4
CheckDeviceType equ 10-1*4
CheckDeviceFormat equ 11-1*4
CheckDeviceMultiSampleType equ 12-1*4
CheckDepthStencilMatch equ 13-1*4
CheckDeviceFormatConversion equ 14-1*4
GetDeviceCaps equ 15-1*4
GetAdapterMonitor equ 16-1*4
CreateDevice equ 17-1*4
;
;____________________________________________________
.DATA
pD3D_DisplayMode DWORD 0
.CODE
INVOKE LoadLibrary, CTEXT("d3d9.dll")
INVOKE GetProcAddress, eax, CTEXT("Direct3DCreate9")
mov pD3D, eax
;
; pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, pD3D_DisplayMode)
;
push OFFSET pD3D_DisplayMode
push D3DADAPTER_DEFAULT
mov eax, pD3D
push eax
mov ecx, [eax]
call DWORD PTR [ecx+GetAdapterDisplayMode]
In C you can access the members to the interface via;
QuotepD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, pD3D_DisplayMode)
Where pD3D is just a pointer to the start of the address table and GetAdapterDisplayMode is a pointer to a function within the interface. Is there a macro or something in ASM that would enable one to reference the members in the interface using this "->", without taking the long route (so to speak) as shown in the example above.
Cheers
To use interfaces in asm,you need to know and do more things than in c++
Quote
IDirect3D9::GetAdapterDisplayMode
This mean that you need to get the IDirect3D9 interface pointer before call of the
GetAdapterDisplayMode function.
A sample can help you.
http://www.masm32.com/board/index.php?topic=8040.0