 /*
 *	Defines the COM interfaces of Game Explorer
 *
 * Copyright (C) 2008 Alistair Leslie-Hughes
 * Copyright (C) 2010 Mariusz Pluciński
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

import "oaidl.idl";
import "ocidl.idl";
import "shobjidl.idl";

#ifndef __WIDL__
#define threading(model)
#define progid(str)
#define vi_progid(str)
#endif

[
  uuid(4F48A59C-942D-4F3C-83C9-4EFFE84E4959),
  version(1.0),
  helpstring("gameux public 1.0 Type Library")
]
library gameuxLib
{
    importlib("stdole2.tlb");

    cpp_quote("#define ID_GDF_XML __GDF_XML")
    cpp_quote("#define ID_GDF_THUMBNAIL __GDF_THUMBNAIL")
    cpp_quote("#define ID_ICON_ICO __ICON_ICO")

    cpp_quote("#if defined(__GNUC__)")
    cpp_quote("#define ID_GDF_XML_STR (const WCHAR[]){'_','_','G','D','F','_','X','M','L',0}")
    cpp_quote("#define ID_GDF_THUMBNAIL_STR (const WCHAR[]){'_','_','G','D','F','_','T','H','U','M','B','N','A','I','L',0}")
    cpp_quote("#elif defined(_MSC_VER)")
    cpp_quote("#define ID_GDF_XML_STR L\"__GDF_XML\"")
    cpp_quote("#define ID_GDF_THUMBNAIL_STR L\"__GDF_THUMBNAIL\"")
    cpp_quote("#endif")

    typedef enum
    {
        GIS_NOT_INSTALLED  = 1,
        GIS_CURRENT_USER   = 2,
        GIS_ALL_USERS      = 3
    } GAME_INSTALL_SCOPE;

    typedef enum
    {
        GAMESTATS_OPEN_OPENORCREATE = 0,
        GAMESTATS_OPEN_OPENONLY = 1
    } GAMESTATS_OPEN_TYPE;

    typedef enum
    {
        GAMESTATS_OPEN_CREATED = 0,
        GAMESTATS_OPEN_OPENED = 1
    } GAMESTATS_OPEN_RESULT;

    [
      object,
      uuid(E7B2FB72-D728-49B3-A5F2-18EBF5F1349E)
    ]
    interface IGameExplorer : IUnknown
    {
        HRESULT AddGame([in] BSTR sGDFBinaryPath,
                    [in] BSTR sInstallDirectory,
                    [in] GAME_INSTALL_SCOPE installScope,
                    [in, out] GUID* pguidInstanceID);

        HRESULT RemoveGame([in] GUID instanceID);

        HRESULT UpdateGame([in] GUID instanceID);

        HRESULT VerifyAccess([in] BSTR sGDFBinaryPath,
                    [out] BOOL* pHasAccess);
    };

    [
      object,
      uuid(3887C9CA-04A0-42ae-BC4C-5FA6C7721145)
    ]
    interface IGameStatistics : IUnknown
    {
        HRESULT GetMaxCategoryLength(
                    [retval, out] UINT* cch);

        HRESULT GetMaxNameLength(
                    [retval, out] UINT* cch);

        HRESULT GetMaxValueLength(
                    [retval, out] UINT* cch);

        HRESULT GetMaxCategories(
                    [retval, out] WORD* pMax);

        HRESULT GetMaxStatsPerCategory(
                    [retval, out] WORD* pMax);

        HRESULT SetCategoryTitle(
                    [in] WORD categoryIndex,
                    [string, in] LPCWSTR title);

        HRESULT GetCategoryTitle(
                    [in] WORD categoryIndex,
                    [retval, string, out] LPWSTR* pTitle);

        HRESULT GetStatistic(
                    [in] WORD categoryIndex,
                    [in] WORD statIndex,
                    [string, unique, out, in] LPWSTR* pName,
                    [string, unique, out, in] LPWSTR* pValue);

        HRESULT SetStatistic(
                    [in] WORD categoryIndex,
                    [in] WORD statIndex,
                    [string, in] LPCWSTR name,
                    [string, in] LPCWSTR value);

        HRESULT Save(
                    [in] BOOL trackChanges);

        HRESULT SetLastPlayedCategory(
                    [in] UINT categoryIndex);

        HRESULT GetLastPlayedCategory(
                    [retval, out] UINT* pCategoryIndex);
    };

    [
      object,
      uuid(AFF3EA11-E70E-407d-95DD-35E612C41CE2)
    ]
    interface IGameStatisticsMgr : IUnknown
    {
        HRESULT GetGameStatistics(
                    [string, in] LPCWSTR GDFBinaryPath,
                    [in] GAMESTATS_OPEN_TYPE openType,
                    [out] GAMESTATS_OPEN_RESULT* pOpenResult,
                    [retval, out] IGameStatistics** ppiStats);

        HRESULT RemoveGameStatistics(
                    [string, in] LPCWSTR GDFBinaryPath);
    };

    [
      object,
      uuid(86874AA7-A1ED-450d-A7EB-B89E20B2FFF3)
    ]
    interface IGameExplorer2 : IUnknown
    {
       HRESULT InstallGame(
                    [string, in] LPCWSTR binaryGDFPath,
                    [unique, in] LPCWSTR installDirectory,
                    [in] GAME_INSTALL_SCOPE installScope);

        HRESULT UninstallGame(
                    [string, in] LPCWSTR binaryGDFPath);

        HRESULT CheckAccess(
                    [string, in] LPCWSTR binaryGDFPath,
                    [retval, out] BOOL* pHasAccess);

    }

    [
      helpstring("GameExplorer Class"),
      threading(both),
      progid("gameux.GameExplorer.1"),
      vi_progid("gameux.GameExplorer"),
      uuid(9A5EA990-3034-4D6F-9128-01F3C61022BC)
    ]
    coclass GameExplorer
    {
        [default] interface IGameExplorer;
    };

    [
      helpstring("GameStatistics Class"),
      threading(apartment),
      progid("gameux.GameStatistics.1"),
      vi_progid("gameux.GameStatistics"),
      uuid(DBC85A2C-C0DC-4961-B6E2-D28B62C11AD4)
    ]
    coclass GameStatistics
    {
        [default] interface IGameStatistics;
    };
}
