Files
BlitzSteam/Types/BlitzCallback.h
T

96 lines
3.4 KiB
C++
Raw Normal View History

// BlitzSteam - Steam wrapper for Blitz
// Copyright (C) 2015 Xaymar (Michael Fabian Dirks)
//
// This program 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 3 of the
// License, or (at your option) any later version.
//
// This program 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 General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
2016-03-11 14:13:25 +01:00
#pragma once
#include "BlitzSteamInternal.h"
#include "../Helpers/BlitzPointer.h"
#include <list>
#include <vector>
#include <map>
class BlitzCallback : public CCallbackBase {
2016-03-11 14:13:25 +01:00
// Static Parts
public:
/// Initializes the CallbackSizes list for future use.
static void Initialize();
static std::map<int32_t, size_t> Sizes;
// Class Parts
public:
2016-03-11 14:13:25 +01:00
// Constructor
BlitzCallback(BP_BlitzFunction3_t pFunctionPointer);
2016-03-11 14:13:25 +01:00
// Destructor
~BlitzCallback();
2016-03-11 14:13:25 +01:00
// Run
virtual void Run(void *pvParam);
virtual void Run(void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall);
2016-03-11 14:13:25 +01:00
// Callback Size
virtual int GetCallbackSizeBytes();
2016-03-11 14:13:25 +01:00
// Accessors
void SetCallback(int32_t iCallback);
int32_t GetCallback();
void SetFunction(BP_BlitzFunction3_t pFunction);
BP_BlitzFunction3_t GetFunction();
bool IsRegistered();
2016-03-11 14:13:25 +01:00
void SetRegistered(bool bIsRegistered);
bool IsGameServer();
void SetGameServer(bool bIsGameServer);
2016-03-11 14:13:25 +01:00
// Registration in Steam
/// Register as Callback
void Register(uint32_t iCallback);
void Unregister();
2016-03-11 14:13:25 +01:00
/// Register as CallResult
void RegisterResult(SteamAPICall_t hSteamAPICall, uint32_t iCallback);
void UnregisterResult();
private:
2016-03-11 14:13:25 +01:00
/// Function to Call
BP_BlitzFunction3_t m_pFunctionPointer;
2016-03-11 14:13:25 +01:00
/// Assigned SteamAPICall
SteamAPICall_t m_hSteamAPICall;
};
2016-03-11 14:13:25 +01:00
//-----------------------------------------------------------------------------
// C-Callables
//-----------------------------------------------------------------------------
DLL_FUNCTION(BlitzCallback*) BS_Callback_New(BP_BlitzFunction3_t pFunctionPointer);
DLL_FUNCTION(void) BS_Callback_Destroy(BlitzCallback* pCallback);
2016-03-11 14:13:25 +01:00
DLL_FUNCTION(int32_t) BS_Callback_GetCallbackSizeBytes(BlitzCallback* pCallback);
DLL_FUNCTION(void) BS_Callback_SetCallback(BlitzCallback* pCallback, int32_t iCallback);
DLL_FUNCTION(int32_t) BS_Callback_GetCallback(BlitzCallback* pCallback);
DLL_FUNCTION(void) BS_Callback_SetFunction(BlitzCallback* pCallback, BP_BlitzFunction3_t pFunction);
DLL_FUNCTION(BP_BlitzFunction3_t) BS_Callback_GetFunction(BlitzCallback* pCallback);
DLL_FUNCTION(void) BS_Callback_SetRegistered(BlitzCallback* pCallback, int32_t bIsRegistered);
DLL_FUNCTION(int32_t) BS_Callback_IsRegistered(BlitzCallback* pCallback);
2016-03-11 14:13:25 +01:00
DLL_FUNCTION(void) BS_Callback_SetGameServer(BlitzCallback* pCallback, int32_t bIsGameServer);
DLL_FUNCTION(int32_t) BS_Callback_IsGameServer(BlitzCallback* pCallback);
DLL_FUNCTION(void) BS_Callback_Register(BlitzCallback* pCallback, uint32_t iCallback);
DLL_FUNCTION(void) BS_Callback_Unregister(BlitzCallback* pCallback);
DLL_FUNCTION(void) BS_Callback_RegisterResult(BlitzCallback* pCallback, SteamAPICall_t* pSteamAPICall, uint32_t iCallback);
DLL_FUNCTION(void) BS_Callback_UnregisterResult(BlitzCallback* pCallback);