#pragma once

#include "Direct3D9TypeDefs.h"
#include "../Interfaces/IDirect3DHijack.h"
#include "../Core/DetourHelper.h"


class k_Direct3D9Hijack
	: public IDirect3DHijack
{
public:
	k_Direct3D9Hijack();
	virtual ~k_Direct3D9Hijack();

	// IObject
	void* QueryInterface(const GUID& ar_InterfaceGuid);

	// IService
	virtual void Initialize(IServiceLocator& ar_ServiceLocator);
	virtual void Deinitialize();
	virtual bool get_IsInitialized() const;

	virtual bool get_HasDeviceCreated() const;
	virtual void set_HasDeviceCreated(bool ab_State);

	// IDirect3DHijack
	virtual HRESULT CallEndScene(IDirect3DDevice9* ar_Device_);

	static IServiceLocator& get_ServiceLocator() { return *smr_ServiceLocator_; }

private:
	bool mb_Initialized;
	bool mb_HasDeviceCreated;
	static IServiceLocator* smr_ServiceLocator_;

public:
	static HRESULT WINAPI CreateDeviceReplace(typeCreateDeviceParam);
	static ULONG WINAPI ReleaseReplace(typeReleaseParam);
	static LPDIRECT3D9 WINAPI Direct3DCreate9Replace(unsigned int SDKVersion);
	static HRESULT WINAPI ResetReplace(typeResetParam);
	static HRESULT WINAPI EndSceneReplace(typeEndSceneParam);
	static HRESULT WINAPI SetFVFReplace(typeSetFVFParam);
	static HRESULT WINAPI SetVertexDeclarationReplace(typeSetVertexDeclarationParam);

	static void RenderHelan(IDirect3DDevice9* lpd3dd);
};


