More Steam functionality, less renaming. functions now closely relate to the original function/class/method structure and many helper types have been added native to BlitzSteam (no need for BlitzUtility).

This commit is contained in:
Michael Fabian Dirks
2016-03-04 03:47:32 +01:00
parent 7209e0936e
commit 2bf8361797
67 changed files with 4507 additions and 3109 deletions
+169
View File
@@ -0,0 +1,169 @@
// 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/>.
#include "CSteamID.h"
DLL_FUNCTION(CSteamID*) BS_CSteamID_New() {
return new CSteamID();
}
DLL_FUNCTION(CSteamID*) BS_CSteamID_Copy(CSteamID* pOther) {
return new CSteamID(*pOther);
}
DLL_FUNCTION(void) BS_CSteamID_Destroy(CSteamID* pThis) {
delete pThis;
}
DLL_FUNCTION(CSteamID*) BS_CSteamID_New_IdUniverseType(AccountID_t iAccountId, EUniverse eUniverse, EAccountType eAccountType) {
return new CSteamID(iAccountId, eUniverse, eAccountType);
}
DLL_FUNCTION(CSteamID*) BS_CSteamID_New_IdInstanceUniverseType(AccountID_t iAccountId, uint32_t iInstance, EUniverse eUniverse, EAccountType eAccountType) {
return new CSteamID(iAccountId, iInstance, eUniverse, eAccountType);
}
DLL_FUNCTION(CSteamID*) BS_CSteamID_FromL(int64_t* pOther) {
return new CSteamID((uint64_t)*pOther);
}
DLL_FUNCTION(int64_t*) BS_CSteamID_ToL(CSteamID* pThis) {
return new int64_t(pThis->ConvertToUint64());
}
DLL_FUNCTION(void) BS_CSteamID_Set(CSteamID* pThis, AccountID_t iAccountID, EUniverse eUniverse, EAccountType eAccountType) {
pThis->Set(iAccountID, eUniverse, eAccountType);
}
DLL_FUNCTION(void) BS_CSteamID_InstancedSet(CSteamID* pThis, AccountID_t iAccountId, uint32_t iInstance, EUniverse eUniverse, EAccountType eAccountType) {
pThis->InstancedSet(iAccountId, iInstance, eUniverse, eAccountType);
}
DLL_FUNCTION(void) BS_CSteamID_FullSet(CSteamID* pThis, int64_t* plIdentifier, EUniverse eUniverse, EAccountType eAccountType) {
pThis->FullSet(*plIdentifier, eUniverse, eAccountType);
}
DLL_FUNCTION(void) BS_CSteamID_SetFromLong(CSteamID* pThis, int64_t* plSteamID) {
pThis->SetFromUint64(*plSteamID);
}
DLL_FUNCTION(void) BS_CSteamID_Clear(CSteamID* pThis) {
pThis->Clear();
}
DLL_FUNCTION(int64_t*) BS_CSteamID_GetStaticAccountKey(CSteamID* pThis) {
return new int64_t(pThis->GetStaticAccountKey());
}
DLL_FUNCTION(void) BS_CSteamID_CreateBlankAnonLogon(CSteamID* pThis, EUniverse eUniverse) {
pThis->CreateBlankAnonLogon(eUniverse);
}
DLL_FUNCTION(void) BS_CSteamID_CreateBlankAnonUserLogon(CSteamID* pThis, EUniverse eUniverse) {
pThis->CreateBlankAnonUserLogon(eUniverse);
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsBlankAnonAccount(CSteamID* pThis) {
return pThis->BBlankAnonAccount();
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsGameServerAccount(CSteamID* pThis) {
return pThis->BGameServerAccount();
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsPersistentGameServerAccount(CSteamID* pThis) {
return pThis->BPersistentGameServerAccount();
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsAnonGameServerAccount(CSteamID* pThis) {
return pThis->BAnonGameServerAccount();
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsContentServerAccount(CSteamID* pThis) {
return pThis->BContentServerAccount();
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsClanAccount(CSteamID* pThis) {
return pThis->BClanAccount();
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsChatAccount(CSteamID* pThis) {
return pThis->BChatAccount();
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsLobby(CSteamID* pThis) {
return pThis->IsLobby();
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsIndividualAccount(CSteamID* pThis) {
return pThis->BIndividualAccount();
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsAnonAccount(CSteamID* pThis) {
return pThis->BAnonAccount();
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsAnonUserAccount(CSteamID* pThis) {
return pThis->BAnonUserAccount();
}
DLL_FUNCTION(int32_t) BS_CSteamID_IsConsoleUserAccount(CSteamID* pThis) {
return pThis->BConsoleUserAccount();
}
DLL_FUNCTION(void) BS_CSteamID_SetAccountID(CSteamID* pThis, AccountID_t iAccountId) {
pThis->SetAccountID(iAccountId);
}
DLL_FUNCTION(AccountID_t) BS_CSteamID_GetAccountID(CSteamID* pThis) {
return pThis->GetAccountID();
}
DLL_FUNCTION(void) BS_CSteamID_SetAccountInstance(CSteamID* pThis, uint32_t iInstance) {
pThis->SetAccountInstance(iInstance);
}
DLL_FUNCTION(void) BS_CSteamID_ClearIndividualInstance(CSteamID* pThis) {
pThis->ClearIndividualInstance();
}
DLL_FUNCTION(int32_t) BS_CSteamID_HasNoIndividualInstance(CSteamID* pThis) {
return pThis->HasNoIndividualInstance();
}
DLL_FUNCTION(uint32_t) BS_CSteamID_GetAccountInstance(CSteamID* pThis) {
return pThis->GetUnAccountInstance();
}
DLL_FUNCTION(EAccountType) BS_CSteamID_GetEAccountType(CSteamID* pThis) {
return pThis->GetEAccountType();
}
DLL_FUNCTION(void) BS_CSteamID_SetEUniverse(CSteamID* pThis, EUniverse eUniverse) {
pThis->SetEUniverse(eUniverse);
}
DLL_FUNCTION(EUniverse) BS_CSteamID_GetEUniverse(CSteamID* pThis) {
return pThis->GetEUniverse();
}
DLL_FUNCTION(int32_t) BS_CSteamID_Compare(CSteamID* pThis, CSteamID* pOther) {
return /* It can either be Equal (0) or Smaller or Greater. Easy to check. */
/* Greater */
(*pThis > *pOther ? 1 : 0) +
/* Smaller */
(*pThis < *pOther ? -1 : 0);
}
+178
View File
@@ -0,0 +1,178 @@
// 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/>.
BS_I#include "BlitzSteam.h"
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
DLL_FUNCTION(CSteamID*) BS_CSteamID_New();
DLL_FUNCTION(CSteamID*) BS_CSteamID_Copy(CSteamID* pOther);
DLL_FUNCTION(void) BS_CSteamID_Destroy(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Constructor
// Input : unAccountID - 32-bit account ID
// eUniverse - Universe this account belongs to
// eAccountType - Type of account
//-----------------------------------------------------------------------------
DLL_FUNCTION(CSteamID*) BS_CSteamID_New_IdUniverseType(AccountID_t iAccountId, EUniverse eUniverse, EAccountType eAccountType);
//-----------------------------------------------------------------------------
// Purpose: Constructor
// Input : unAccountID - 32-bit account ID
// unAccountInstance - instance
// eUniverse - Universe this account belongs to
// eAccountType - Type of account
//-----------------------------------------------------------------------------
DLL_FUNCTION(CSteamID*) BS_CSteamID_New_IdInstanceUniverseType(AccountID_t iAccountId, uint32_t iInstance, EUniverse eUniverse, EAccountType eAccountType);
//-----------------------------------------------------------------------------
// Purpose: Constructor
// Input : ulSteamID - 64-bit representation of a Steam ID
// Note: Will not accept a uint32 or int32 as input, as that is a probable mistake.
// See the stubbed out overloads in the private: section for more info.
//-----------------------------------------------------------------------------
DLL_FUNCTION(CSteamID*) BS_CSteamID_FromL(int64_t* pOther);
DLL_FUNCTION(int64_t*) BS_CSteamID_ToL(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Sets parameters for steam ID
// Input : unAccountID - 32-bit account ID
// eUniverse - Universe this account belongs to
// eAccountType - Type of account
//-----------------------------------------------------------------------------
DLL_FUNCTION(void) BS_CSteamID_Set(CSteamID* pThis, AccountID_t iAccountID, EUniverse eUniverse, EAccountType eAccountType);
//-----------------------------------------------------------------------------
// Purpose: Sets parameters for steam ID
// Input : unAccountID - 32-bit account ID
// eUniverse - Universe this account belongs to
// eAccountType - Type of account
//-----------------------------------------------------------------------------
DLL_FUNCTION(void) BS_CSteamID_InstancedSet(CSteamID* pThis, AccountID_t iAccountId, uint32_t iInstance, EUniverse eUniverse, EAccountType eAccountType);
//-----------------------------------------------------------------------------
// Purpose: Initializes a steam ID from its 52 bit parts and universe/type
// Input : ulIdentifier - 52 bits of goodness
//-----------------------------------------------------------------------------
DLL_FUNCTION(void) BS_CSteamID_FullSet(CSteamID* pThis, int64_t* plIdentifier, EUniverse eUniverse, EAccountType eAccountType);
//-----------------------------------------------------------------------------
// Purpose: Initializes a steam ID from its 64-bit representation
// Input : ulSteamID - 64-bit representation of a Steam ID
//-----------------------------------------------------------------------------
DLL_FUNCTION(void) BS_CSteamID_SetFromLong(CSteamID* pThis, int64_t* plSteamID);
//-----------------------------------------------------------------------------
// Purpose: Clear all fields, leaving an invalid ID.
//-----------------------------------------------------------------------------
DLL_FUNCTION(void) BS_CSteamID_Clear(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Converts the static parts of a steam ID to a 64-bit representation.
// For multiseat accounts, all instances of that account will have the
// same static account key, so they can be grouped together by the static
// account key.
// Output : 64-bit static account key
//-----------------------------------------------------------------------------
DLL_FUNCTION(int64_t*) BS_CSteamID_GetStaticAccountKey(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: create an anonymous game server login to be filled in by the AM
//-----------------------------------------------------------------------------
DLL_FUNCTION(void) BS_CSteamID_CreateBlankAnonLogon(CSteamID* pThis, EUniverse eUniverse);
//-----------------------------------------------------------------------------
// Purpose: create an anonymous game server login to be filled in by the AM
//-----------------------------------------------------------------------------
DLL_FUNCTION(void) BS_CSteamID_CreateBlankAnonUserLogon(CSteamID* pThis, EUniverse eUniverse);
//-----------------------------------------------------------------------------
// Purpose: Is this an anonymous game server login that will be filled in?
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsBlankAnonAccount(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Is this a game server account id? (Either persistent or anonymous)
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsGameServerAccount(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Is this a persistent (not anonymous) game server account id?
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsPersistentGameServerAccount(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Is this an anonymous game server account id?
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsAnonGameServerAccount(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Is this a content server account id?
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsContentServerAccount(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Is this a clan account id?
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsClanAccount(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Is this a chat account id?
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsChatAccount(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Is this a Lobby?
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsLobby(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Is this an individual user account id?
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsIndividualAccount(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Is this an anonymous account?
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsAnonAccount(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Is this an anonymous user account? ( used to create an account or reset a password )
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsAnonUserAccount(CSteamID* pThis);
//-----------------------------------------------------------------------------
// Purpose: Is this a faked up Steam ID for a PSN friend account?
//-----------------------------------------------------------------------------
DLL_FUNCTION(int32_t) BS_CSteamID_IsConsoleUserAccount(CSteamID* pThis);
// simple accessors
DLL_FUNCTION(void) BS_CSteamID_SetAccountID(CSteamID* pThis, AccountID_t iAccountId);
DLL_FUNCTION(AccountID_t) BS_CSteamID_GetAccountID(CSteamID* pThis);
DLL_FUNCTION(void) BS_CSteamID_SetAccountInstance(CSteamID* pThis, uint32_t iInstance);
DLL_FUNCTION(void) BS_CSteamID_ClearIndividualInstance(CSteamID* pThis);
DLL_FUNCTION(int32_t) BS_CSteamID_HasNoIndividualInstance(CSteamID* pThis);
DLL_FUNCTION(uint32_t) BS_CSteamID_GetAccountInstance(CSteamID* pThis);
DLL_FUNCTION(EAccountType) BS_CSteamID_GetEAccountType(CSteamID* pThis);
DLL_FUNCTION(void) BS_CSteamID_SetEUniverse(CSteamID* pThis, EUniverse eUniverse);
DLL_FUNCTION(EUniverse) BS_CSteamID_GetEUniverse(CSteamID* pThis);
DLL_FUNCTION(int32_t) BS_CSteamID_Compare(CSteamID* pThis, CSteamID* pOther);
+122
View File
@@ -0,0 +1,122 @@
// 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/>.
#include "Long.h"
DLL_FUNCTION(double_t*) BS_Double_New() {
return new double_t;
}
DLL_FUNCTION(double_t*) BS_Double_Copy(double_t* pOther) {
return new double_t(*pOther);
}
DLL_FUNCTION(void) BS_Double_Destroy(double_t* pThis) {
delete pThis;
}
char* BS_Double_Buffer = new char[32];
DLL_FUNCTION(const char*) BS_Double_ToString(double_t* pThis) {
std::stringstream myStream;
myStream << (*pThis);
const char* myBuffer = myStream.str().c_str();
strcpy_s(BS_Double_Buffer, 32, myBuffer);
return BS_Double_Buffer;
}
DLL_FUNCTION(double_t*) BS_Double_FromString(const char* pString) {
double_t* pThis = new double_t;
std::stringstream myStream = std::stringstream(pString);
myStream >> *pThis;
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_FromF(float_t fOther) {
return new double_t(fOther);
}
DLL_FUNCTION(float_t) BS_Double_ToF(double_t* pThis) {
return (float_t)*pThis;
}
DLL_FUNCTION(double_t*) BS_Double_FromI(int32_t iOther) {
return new double_t(iOther);
}
DLL_FUNCTION(int32_t) BS_Double_ToI(double_t* pThis) {
return (int32_t)*pThis;
}
DLL_FUNCTION(double_t*) BS_Double_FromL(int64_t* pOther) {
return new double_t((double_t)*pOther);
}
DLL_FUNCTION(int64_t*) BS_Double_ToL(double_t* pThis) {
return new int64_t((int64_t)*pThis);
}
DLL_FUNCTION(int32_t) BS_Double_Compare(double_t* pThis, double_t* pOther) {
return /* It can either be Equal (0) or Smaller or Greater. Easy to check. */
/* Greater */
(*pThis > *pOther ? 1 : 0) +
/* Smaller */
(*pThis < *pOther ? -1 : 0);
}
DLL_FUNCTION(double_t*) BS_Double_Set(double_t* pThis, double_t* pOther) {
*pThis = *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_Add(double_t* pThis, double_t* pOther) {
*pThis += *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_Sub(double_t* pThis, double_t* pOther) {
*pThis -= *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_Div(double_t* pThis, double_t* pOther) {
*pThis /= *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_Mul(double_t* pThis, double_t* pOther) {
*pThis *= *pOther;
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_Mod(double_t* pThis, double_t* pOther) {
*pThis = fmod(*pThis, *pOther);
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_SetF(double_t* pThis, float_t fOther) {
*pThis = fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_AddF(double_t* pThis, float_t fOther) {
*pThis += fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_SubF(double_t* pThis, float_t fOther) {
*pThis -= fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_DivF(double_t* pThis, float_t fOther) {
*pThis /= fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_MulF(double_t* pThis, float_t fOther) {
*pThis *= fOther;
return pThis;
}
DLL_FUNCTION(double_t*) BS_Double_ModF(double_t* pThis, float_t fOther) {
*pThis = fmod(*pThis, fOther);
return pThis;
}
+50
View File
@@ -0,0 +1,50 @@
// 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/>.
BS_I#include "BlitzSteam.h"
#include <sstream>
DLL_FUNCTION(double_t*) BS_Double_New();
DLL_FUNCTION(double_t*) BS_Double_Copy(double_t* pRight);
DLL_FUNCTION(void) BS_Double_Destroy(double_t* pThis);
DLL_FUNCTION(const char*) BS_Double_ToString(double_t* pThis);
DLL_FUNCTION(double_t*) BS_Double_FromString(const char* pString);
DLL_FUNCTION(double_t*) BS_Double_FromF(float_t fOther);
DLL_FUNCTION(float_t) BS_Double_ToF(double_t* pThis);
DLL_FUNCTION(double_t*) BS_Double_FromI(int32_t iOther);
DLL_FUNCTION(int32_t) BS_Double_ToI(double_t* pThis);
DLL_FUNCTION(double_t*) BS_Double_FromL(int64_t* pOther);
DLL_FUNCTION(int64_t*) BS_Double_ToL(double_t* pThis);
DLL_FUNCTION(int32_t) BS_Double_Compare(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BS_Double_Set(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BS_Double_Add(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BS_Double_Sub(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BS_Double_Div(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BS_Double_Mul(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BS_Double_Mod(double_t* pThis, double_t* pOther);
DLL_FUNCTION(double_t*) BS_Double_SetF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BS_Double_AddF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BS_Double_SubF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BS_Double_DivF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BS_Double_MulF(double_t* pThis, float_t fOther);
DLL_FUNCTION(double_t*) BS_Double_ModF(double_t* pThis, float_t fOther);
+167
View File
@@ -0,0 +1,167 @@
// 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/>.
#include "Long.h"
DLL_FUNCTION(int64_t*) BS_Long_New() {
return new int64_t;
}
DLL_FUNCTION(int64_t*) BS_Long_Copy(int64_t* pOther) {
return new int64_t(*pOther);
}
DLL_FUNCTION(void) BS_Long_Destroy(int64_t* pThis) {
delete pThis;
}
char* BS_Long_Buffer = new char[32];
DLL_FUNCTION(const char*) BS_Long_ToString(int64_t* pThis) {
std::stringstream myStream;
myStream << (*pThis);
const char* myBuffer = myStream.str().c_str();
strcpy_s(BS_Long_Buffer, 32, myBuffer);
return BS_Long_Buffer;
}
DLL_FUNCTION(int64_t*) BS_Long_FromString(const char* pString) {
int64_t* pThis = new int64_t;
std::stringstream myStream = std::stringstream(pString);
myStream >> *pThis;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_FromI(int32_t iRight) {
return new int64_t(iRight);
}
DLL_FUNCTION(int64_t*) BS_Long_FromII(int32_t iLeft, int32_t iRight) {
return new int64_t(((int64_t)(iLeft) << 32) + iRight);
}
DLL_FUNCTION(int32_t) BS_Long_ToI(int64_t* pThis, int32_t iShift) {
if (iShift >= 0)
return (int32_t)(*pThis >> iShift);
else
return (int32_t)(*pThis << -iShift);
}
DLL_FUNCTION(int32_t) BS_Long_ToIH(int64_t* pThis) {
return (int32_t)(*pThis >> 32);
}
DLL_FUNCTION(int32_t) BS_Long_ToIL(int64_t* pThis) {
return (int32_t)*pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_FromF(float_t fOther) {
return new int64_t((int64_t)fOther);
}
DLL_FUNCTION(float_t) BS_Long_ToF(int64_t* pThis) {
return (float_t)*pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_FromD(double_t* pOther) {
return new int64_t((int64_t)*pOther);
}
DLL_FUNCTION(double_t*) BS_Long_ToD(int64_t* pThis) {
return new double_t((double_t)*pThis);
}
DLL_FUNCTION(int32_t) BS_Long_Compare(int64_t* pThis, int64_t* pOther) {
return /* It can either be Equal (0) or Smaller or Greater. Easy to check. */
/* Greater */
(*pThis > *pOther ? 1 : 0) +
/* Smaller */
(*pThis < *pOther ? -1 : 0);
}
DLL_FUNCTION(int64_t*) BS_Long_Set(int64_t* pThis, int64_t* pOther) {
*pThis = *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_Add(int64_t* pThis, int64_t* pOther) {
*pThis += *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_Sub(int64_t* pThis, int64_t* pOther) {
*pThis -= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_Div(int64_t* pThis, int64_t* pOther) {
*pThis /= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_Mul(int64_t* pThis, int64_t* pOther) {
*pThis *= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_Mod(int64_t* pThis, int64_t* pOther) {
*pThis %= *pOther;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_SetI(int64_t* pThis, int32_t iRight) {
*pThis = iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_AddI(int64_t* pThis, int32_t iRight) {
*pThis += iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_SubI(int64_t* pThis, int32_t iRight) {
*pThis -= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_DivI(int64_t* pThis, int32_t iRight) {
*pThis /= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_MulI(int64_t* pThis, int32_t iRight) {
*pThis *= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_ModI(int64_t* pThis, int32_t iRight) {
*pThis %= iRight;
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_SetII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis = (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_AddII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis += (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_SubII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis -= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_DivII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis /= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_MulII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis *= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_ModII(int64_t* pThis, int32_t iLeft, int32_t iRight) {
*pThis %= (((int64_t)iLeft << 32) + iRight);
return pThis;
}
DLL_FUNCTION(int64_t*) BS_Long_Shift(int64_t* pThis, int32_t iRight) {
if (iRight >= 0)
*pThis >>= iRight;
else
*pThis <<= -iRight;
return pThis;
}
+62
View File
@@ -0,0 +1,62 @@
// 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/>.
BS_I#include "BlitzSteam.h"
#include <sstream>
DLL_FUNCTION(int64_t*) BS_Long_New();
DLL_FUNCTION(int64_t*) BS_Long_Copy(int64_t* pRight);
DLL_FUNCTION(void) BS_Long_Destroy(int64_t* pThis);
DLL_FUNCTION(const char*) BS_Long_ToString(int64_t* pThis);
DLL_FUNCTION(int64_t*) BS_Long_FromString(const char* pString);
DLL_FUNCTION(int64_t*) BS_Long_FromI(int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_FromII(int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int32_t) BS_Long_ToI(int64_t* pThis, int32_t iShift);
DLL_FUNCTION(int32_t) BS_Long_ToIH(int64_t* pThis);
DLL_FUNCTION(int32_t) BS_Long_ToIL(int64_t* pThis);
DLL_FUNCTION(int64_t*) BS_Long_FromF(float_t fOther);
DLL_FUNCTION(float_t) BS_Long_ToF(int64_t* pThis);
DLL_FUNCTION(int64_t*) BS_Long_FromD(double_t* pOther);
DLL_FUNCTION(double_t*) BS_Long_ToD(int64_t* pThis);
DLL_FUNCTION(int32_t) BS_Long_Compare(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BS_Long_Set(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BS_Long_Add(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BS_Long_Sub(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BS_Long_Div(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BS_Long_Mul(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BS_Long_Mod(int64_t* pThis, int64_t* pOther);
DLL_FUNCTION(int64_t*) BS_Long_SetI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_AddI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_SubI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_DivI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_MulI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_ModI(int64_t* pThis, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_SetII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_AddII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_SubII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_DivII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_MulII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_ModII(int64_t* pThis, int32_t iLeft, int32_t iRight);
DLL_FUNCTION(int64_t*) BS_Long_Shift(int64_t* pThis, int32_t iShift);