Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS (WIN) Input - Fcn Bind.cpp
    »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
    »Version«   4.51 / »GUID« A9981407-3EC9-42AF-8B6F-8BE6DD919615                                                                                                        */
/*   -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*  Copyright: © 2002-2017, Andrew Aye.  All Rights Reserved.
    This software is free for non-commercial use.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
      following conditions are met:
        Redistribution of source code must retain this copyright notice, this list of conditions and the following disclaimers.
        Redistribution in binary form must reproduce this copyright notice, this list of conditions and the following disclaimers in the documentation and other materials
          provided with the distribution.
    The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
    The intellectual property rights of the algorithms used reside with Andrew Aye.
    You may not use this software, in whole or in part, in support of any commercial product without the express written consent of the author.
    There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */

#if defined(__DINPUT_INCLUDED__)
#error dinput.h should only be included at this point
#endif

#undef DIDFT_MAKEINSTANCE
#define DIRECTINPUT_VERSION 0x0800

#pragma warning( push, 3 )
#define CINTERFACE
#include <dinput.h>
#include <windows.h>
TgEXTN TgMS_HINSTANCE                       g_hInstance;
TgEXTN TgMS_HWND                            g_hWnd;
#pragma warning( pop )


/* == Input ============================================================================================================================================================= */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Internal Functions                                                                                                                                                    */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

/* ---- tgIN_PM_Init_Function_Table ------------------------------------------------------------------------------------------------------------------------------------- */
/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
TgRESULT tgIN_PM_Init_Function_Table( TgVOID )
{
    /*
    const GUID                          MS_GUID_SysKeyboard = { 0x6F1D2B61L,0xD5A0,0x11CF,{0xBF,0xC7,0x44,0x45,0x53,0x54,0x00,0x00} };
    LPDIRECTINPUTDEVICE8                dxDID;
    LPDIRECTINPUT8                      dxDI;
    */

    /* Map the Direct Input System Functions */
    /*
    dxDI = (LPDIRECTINPUT8)g_pdxDI;

    g_pfnDIN8_Release = dxDI->lpVtbl->Release;
    g_pfnDIN8_CreateDevice = dxDI->lpVtbl->CreateDevice;
    g_pfnDIN8_RunControlPanel = dxDI->lpVtbl->RunControlPanel;
    */

    /* Map the Direct Input Device Functions */
    /*
    if (TgFAILED( g_pfnDIN8_CreateDevice( (LPDIRECTINPUT8)g_pdxDI, MS_GUID_SysKeyboard, &dxDID, nullptr ) ))
    {
        return (KTgE_FAIL);
    };

    g_pfnDID8_Release = dxDID->lpVtbl->Release;
    g_pfnDID8_Acquire = dxDID->lpVtbl->Acquire;
    g_pfnDID8_Unacquire = dxDID->lpVtbl->Unacquire;
    g_pfnDID8_GetDeviceState = dxDID->lpVtbl->GetDeviceState;
    g_pfnDID8_SetDataFormat = dxDID->lpVtbl->SetDataFormat;
    g_pfnDID8_SetCooperativeLevel = dxDID->lpVtbl->SetCooperativeLevel;

    g_pfnDID8_Release( dxDID );
    */
    /* #HACK: BIND FUNC CORRECT */

    return (KTgS_OK);
}




/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Validation                                                                                                                                                            */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

CLANG_WARN_DISABLE_PUSH(extended-offsetof)
CLANG_WARN_DISABLE_PUSH(old-style-cast)
TgCOMPILER_ASSERT( offsetof(TgMS_DIOBJECTDATAFORMAT, pguid )            == offsetof(DIOBJECTDATAFORMAT, pguid ) ,0);
TgCOMPILER_ASSERT( sizeof( ((TgMS_DIOBJECTDATAFORMAT*)0)->pguid )       == sizeof( ((DIOBJECTDATAFORMAT*)0)->pguid ) ,0);
TgCOMPILER_ASSERT( offsetof(TgMS_DIOBJECTDATAFORMAT, dwOfs )            == offsetof(DIOBJECTDATAFORMAT, dwOfs ) ,0);
TgCOMPILER_ASSERT( sizeof( ((TgMS_DIOBJECTDATAFORMAT*)0)->dwOfs )       == sizeof( ((DIOBJECTDATAFORMAT*)0)->dwOfs ) ,0);
TgCOMPILER_ASSERT( offsetof(TgMS_DIOBJECTDATAFORMAT, dwType )           == offsetof(DIOBJECTDATAFORMAT, dwType ) ,0);
TgCOMPILER_ASSERT( sizeof( ((TgMS_DIOBJECTDATAFORMAT*)0)->dwType )      == sizeof( ((DIOBJECTDATAFORMAT*)0)->dwType ) ,0);
TgCOMPILER_ASSERT( offsetof(TgMS_DIOBJECTDATAFORMAT, dwFlags )          == offsetof(DIOBJECTDATAFORMAT, dwFlags ) ,0);
TgCOMPILER_ASSERT( sizeof( ((TgMS_DIOBJECTDATAFORMAT*)0)->dwFlags )     == sizeof( ((DIOBJECTDATAFORMAT*)0)->dwFlags ) ,0);
TgCOMPILER_ASSERT( sizeof(TgMS_DIOBJECTDATAFORMAT)                      == sizeof(DIOBJECTDATAFORMAT) ,0);


TgCOMPILER_ASSERT( offsetof(TgMS_DIDATAFORMAT, dwSize )                 == offsetof(DIDATAFORMAT, dwSize ) ,0);
TgCOMPILER_ASSERT( sizeof( ((TgMS_DIDATAFORMAT*)0)->dwSize )            == sizeof( ((DIDATAFORMAT*)0)->dwSize ) ,0);
TgCOMPILER_ASSERT( offsetof(TgMS_DIDATAFORMAT, dwObjSize )              == offsetof(DIDATAFORMAT, dwObjSize ) ,0);
TgCOMPILER_ASSERT( sizeof( ((TgMS_DIDATAFORMAT*)0)->dwObjSize )         == sizeof( ((DIDATAFORMAT*)0)->dwObjSize ) ,0);
TgCOMPILER_ASSERT( offsetof(TgMS_DIDATAFORMAT, dwFlags )                == offsetof(DIDATAFORMAT, dwFlags ) ,0);
TgCOMPILER_ASSERT( sizeof( ((TgMS_DIDATAFORMAT*)0)->dwFlags )           == sizeof( ((DIDATAFORMAT*)0)->dwFlags ) ,0);
TgCOMPILER_ASSERT( offsetof(TgMS_DIDATAFORMAT, dwDataSize )             == offsetof(DIDATAFORMAT, dwDataSize ) ,0);
TgCOMPILER_ASSERT( sizeof( ((TgMS_DIDATAFORMAT*)0)->dwDataSize )        == sizeof( ((DIDATAFORMAT*)0)->dwDataSize ) ,0);
TgCOMPILER_ASSERT( offsetof(TgMS_DIDATAFORMAT, dwNumObjs )              == offsetof(DIDATAFORMAT, dwNumObjs ) ,0);
TgCOMPILER_ASSERT( sizeof( ((TgMS_DIDATAFORMAT*)0)->dwNumObjs )         == sizeof( ((DIDATAFORMAT*)0)->dwNumObjs ) ,0);
TgCOMPILER_ASSERT( offsetof(TgMS_DIDATAFORMAT, rgodf )                  == offsetof(DIDATAFORMAT, rgodf ) ,0);
TgCOMPILER_ASSERT( sizeof( ((TgMS_DIDATAFORMAT*)0)->rgodf )             == sizeof( ((DIDATAFORMAT*)0)->rgodf ) ,0);
TgCOMPILER_ASSERT( sizeof(TgMS_DIDATAFORMAT)                            == sizeof(DIDATAFORMAT) ,0);
CLANG_WARN_DISABLE_POP(old-style-cast)
CLANG_WARN_DISABLE_POP(extended-offsetof)