openDecal/Native/Inject/InputBuffer.h
erik d1442e3747 Initial commit: Complete open-source Decal rebuild
All 5 phases of the open-source Decal rebuild:

Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil)
Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs
  - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters
  - Decal.Core, DecalControls, DecalRender, D3DService
Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL
Phase 4: DenAgent WinForms tray application
Phase 5: WiX installer and build script

25 C# projects building with 0 errors.
Native C++ projects require VS 2022 + Windows SDK (x86).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 18:27:56 +01:00

123 lines
2.9 KiB
C++

// InputBuffer.h : Declaration of the cInputBuffer
#ifndef __INPUTBUFFER_H_
#define __INPUTBUFFER_H_
#include "resource.h" // main symbols
#include "InjectCP.h"
typedef std::vector< INPUT > cInputVec;
/////////////////////////////////////////////////////////////////////////////
// cInputBuffer
class ATL_NO_VTABLE cInputBuffer :
public CComObjectRootEx<CComMultiThreadModel>,
public IDispatchImpl<IInputNotify, &IID_IInputNotify, &LIBID_DecalPlugins>,
public IDispatchImpl<IInputBuffer, &IID_IInputBuffer, &LIBID_DecalPlugins>,
public IProvideClassInfo2Impl< &CLSID_InputBuffer, &DIID_IInputEvents, &LIBID_DecalPlugins >,
public CProxyIInputEvents< cInputBuffer >,
public IConnectionPointContainerImpl<cInputBuffer>
{
public:
cInputBuffer()
: m_status( eInputIdle )
{
}
BEGIN_COM_MAP(cInputBuffer)
COM_INTERFACE_ENTRY(IInputNotify)
COM_INTERFACE_ENTRY(IInputBuffer)
COM_INTERFACE_ENTRY(IProvideClassInfo)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY2(IDispatch, IInputBuffer)
COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(cInputBuffer)
CONNECTION_POINT_ENTRY(DIID_IInputEvents)
END_CONNECTION_POINT_MAP()
// Global functions to set up the input processing
// thread
static HANDLE m_hThread;
static HANDLE m_hTerm;
static HANDLE m_hInputWaiting;
static CRITICAL_SECTION m_csQueue;
typedef std::deque< std::pair< cInputBuffer *, LPSTREAM > > cInputQueue;
static cInputQueue m_queue;
static void init();
static void term();
void postBuffer();
cInputVec *getLastInput();
// Quick and dirty class hierarchy for input operations
class cAction
{
public:
// Run the action
virtual void execute( IInputNotify *pib ) = 0;
};
enum eActionType
{
eActionInput,
eActionDelay,
eActionMouseMove
};
class cInput
: public cAction
{
public:
cInputVec m_input;
virtual void execute( IInputNotify *pib );
};
class cDelay
: public cAction
{
public:
long m_nMillis;
bool m_bAllowInput;
virtual void execute( IInputNotify *pib );
};
class cMouseMove
: public cAction
{
public:
POINT m_ptClient;
virtual void execute( IInputNotify *pib );
};
typedef std::list< std::pair< eActionType, VSBridge::auto_ptr< cAction > > > cActionList;
cActionList m_actions;
eInputStatus m_status;
public:
// IInputBuffer Methods
STDMETHOD(Run)();
STDMETHOD(get_Status)(/*[out, retval]*/ eInputStatus *pVal);
STDMETHOD(MouseClick)(long nX, long nY, eMouseInput eAction);
STDMETHOD(Delay)(long nMilliseconds, VARIANT_BOOL bAllowInput);
STDMETHOD(TypeText)(BSTR strText);
STDMETHOD(Clear)();
// IInputNotify Methods
STDMETHOD(NotifyBegin)();
STDMETHOD(NotifyEnd)();
STDMETHOD(SetMousePos)(long nX, long nY);
STDMETHOD(NotifyPause)();
};
#endif //__INPUTBUFFER_H_