Implement SteamController Wrapper. Update Blitz-side files. Remove obsolete files.

This commit is contained in:
Michael Dirks
2015-06-06 21:15:41 +02:00
parent 7418113032
commit 9c80d60c1e
31 changed files with 637 additions and 110 deletions
+129
View File
@@ -0,0 +1,129 @@
// BlitzSteam - Steam wrapper for Blitz.
// Copyright (C) 2015 Project Kube (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 "dllmain.h"
#include <string>
#include <sstream>
#pragma region Construction & Destruction
DLL_EXPORT double_t* BlitzSteamDouble_New() {
return new double_t;
}
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_New=_BlitzSteamDouble_New@0")
DLL_EXPORT double_t* BlitzSteamDouble_Copy(double_t* other) {
double_t* pthis = new double_t;
*pthis = *other;
return pthis;
}
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_Copy=_BlitzSteamDouble_Copy@4")
DLL_EXPORT void BlitzSteamDouble_Delete(double_t* pthis) {
delete pthis;
}
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_Delete=_BlitzSteamDouble_Delete@4")
#pragma endregion Construction & Destruction
#pragma region Math
DLL_EXPORT void BlitzSteamDouble_SetP(double_t* pthis, double_t* other) { *pthis = *other; }
DLL_EXPORT void BlitzSteamDouble_SetF(double_t* pthis, float_t other) { *pthis = other; }
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_SetP=_BlitzSteamDouble_SetP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_SetF=_BlitzSteamDouble_SetF@8")
DLL_EXPORT void BlitzSteamDouble_AddP(double_t* pthis, double_t* other) { *pthis += *other; }
DLL_EXPORT void BlitzSteamDouble_AddF(double_t* pthis, float_t other) { *pthis += other; }
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_AddP=_BlitzSteamDouble_AddP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_AddF=_BlitzSteamDouble_AddF@8")
DLL_EXPORT void BlitzSteamDouble_SubP(double_t* pthis, double_t* other) { *pthis -= *other; }
DLL_EXPORT void BlitzSteamDouble_SubF(double_t* pthis, float_t other) { *pthis -= other; }
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_SubP=_BlitzSteamDouble_SubP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_SubF=_BlitzSteamDouble_SubF@8")
DLL_EXPORT void BlitzSteamDouble_MulP(double_t* pthis, double_t* other) { *pthis *= *other; }
DLL_EXPORT void BlitzSteamDouble_MulF(double_t* pthis, float_t other) { *pthis *= other; }
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_MulP=_BlitzSteamDouble_MulP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_MulF=_BlitzSteamDouble_MulF@8")
DLL_EXPORT void BlitzSteamDouble_DivP(double_t* pthis, double_t* other) { *pthis /= *other; }
DLL_EXPORT void BlitzSteamDouble_DivF(double_t* pthis, float_t other) { *pthis /= other; }
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_DivP=_BlitzSteamDouble_DivP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_DivF=_BlitzSteamDouble_DivF@8")
#pragma endregion Math
#pragma region Comparison
DLL_EXPORT uint32_t BlitzSteamDouble_EqualsP(double_t* pthis, double_t* other) { return *pthis == *other; }
DLL_EXPORT uint32_t BlitzSteamDouble_EqualsF(double_t* pthis, float_t other) { return *pthis == other; }
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_EqualsP=_BlitzSteamDouble_EqualsP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_EqualsF=_BlitzSteamDouble_EqualsF@8")
DLL_EXPORT uint32_t BlitzSteamDouble_GEqualsP(double_t* pthis, double_t* other) { return *pthis >= *other; }
DLL_EXPORT uint32_t BlitzSteamDouble_GEqualsF(double_t* pthis, float_t other) { return *pthis >= other; }
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_GEqualsP=_BlitzSteamDouble_GEqualsP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_GEqualsF=_BlitzSteamDouble_GEqualsF@8")
DLL_EXPORT uint32_t BlitzSteamDouble_SEqualsP(double_t* pthis, double_t* other) { return *pthis <= *other; }
DLL_EXPORT uint32_t BlitzSteamDouble_SEqualsF(double_t* pthis, float_t other) { return *pthis <= other; }
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_SEqualsP=_BlitzSteamDouble_SEqualsP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_SEqualsF=_BlitzSteamDouble_SEqualsF@8")
DLL_EXPORT uint32_t BlitzSteamDouble_GreaterP(double_t* pthis, double_t* other) { return *pthis > *other; }
DLL_EXPORT uint32_t BlitzSteamDouble_GreaterF(double_t* pthis, float_t other) { return *pthis > other; }
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_GreaterP=_BlitzSteamDouble_GreaterP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_GreaterF=_BlitzSteamDouble_GreaterF@8")
DLL_EXPORT uint32_t BlitzSteamDouble_SmallerP(double_t* pthis, double_t* other) { return *pthis < *other; }
DLL_EXPORT uint32_t BlitzSteamDouble_SmallerF(double_t* pthis, float_t other) { return *pthis < other; }
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_SmallerP=_BlitzSteamDouble_SmallerP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_SmallerF=_BlitzSteamDouble_SmallerF@8")
#pragma endregion Comparison
#pragma region Conversion
DLL_EXPORT const char* BlitzSteamDouble_ToString(double_t* pthis) {
std::stringstream stream;
stream << *pthis;
return stream.str().c_str();
}
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_ToString=_BlitzSteamDouble_ToString@4")
// Double <-> Float
DLL_EXPORT float_t BlitzSteamDouble_ToFloat(double_t* pthis) { return (float_t)*pthis; }
DLL_EXPORT double_t* BlitzSteamDouble_FromFloat(float_t other) {
double_t* val = new double_t;
*val = (double_t)other;
return val;
}
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_ToFloat=_BlitzSteamDouble_ToFloat@4")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_FromFloat=_BlitzSteamDouble_FromFloat@4")
// Double <-> Int32
DLL_EXPORT int32_t BlitzSteamDouble_ToInt32(double_t* pthis) { return (int32_t)*pthis; }
DLL_EXPORT double_t* BlitzSteamDouble_FromInt32(int32_t other) {
double_t* val = new double_t;
*val = (double_t)other;
return val;
}
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_ToInt32=_BlitzSteamDouble_ToInt32@4")
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_FromInt32=_BlitzSteamDouble_FromInt32@4")
// Double -> Int64
DLL_EXPORT int64_t* BlitzSteamDouble_ToInt64(double_t* pthis) {
int64_t* val = new int64_t;
*val = (int64_t)*pthis;
return val;
}
#pragma comment(linker, "/EXPORT:BlitzSteamDouble_ToInt64=_BlitzSteamDouble_ToInt64@4")
#pragma endregion Conversion
+62
View File
@@ -0,0 +1,62 @@
// BlitzSteam - Steam wrapper for Blitz.
// Copyright (C) 2015 Project Kube (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 "dllmain.h"
#include "Libraries/BlitzPointer.h"
#include <time.h>
// Callbacks
class BlitzSteamCallback : CCallbackBase {
public:
uint32_t blitzFunctionPointer;
virtual void Run(void *pvParam) {
BlitzPointer_CallFunction4((uint32_t)blitzFunctionPointer, (uint32_t)pvParam, 0, 0, 0);
}
virtual void Run(void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall) {
BlitzPointer_CallFunction4((uint32_t)blitzFunctionPointer, (uint32_t)pvParam, bIOFailure, (uint32_t)(hSteamAPICall & 0xFFFFFFFF), (uint32_t)(hSteamAPICall >> 32));
}
virtual int GetCallbackSizeBytes() {
return sizeof(BlitzSteamCallback);
}
};
DLL_EXPORT void* BlitzSteamHelper_CreateCallback(uint32_t fpFunctionPointer) {
BlitzSteamCallback* lpBSCallback = new BlitzSteamCallback();
lpBSCallback->blitzFunctionPointer = fpFunctionPointer;
return lpBSCallback;
}
#pragma comment(linker, "/EXPORT:BlitzSteamHelper_CreateCallback=_BlitzSteamHelper_CreateCallback@4")
DLL_EXPORT void BlitzSteamHelper_DestroyCallback(uint32_t lpCallback) {
BlitzSteamCallback* lpBSCallback = (BlitzSteamCallback*)lpCallback;
if (lpBSCallback != nullptr) {
delete lpBSCallback;
}
}
#pragma comment(linker, "/EXPORT:BlitzSteamHelper_DestroyCallback=_BlitzSteamHelper_DestroyCallback@4")
DLL_EXPORT const char* BlitzSteamHelper_FormatUnixTime(uint32_t unTime, const char* pchFormat) {
char* output = new char[strlen(pchFormat) * 4];
time_t t = unTime;
struct tm *tm = localtime(&t);
strftime(output, sizeof(output), pchFormat, tm);
delete tm;
return output;
}
#pragma comment(linker, "/EXPORT:BlitzSteamHelper_FormatUnixTime=_BlitzSteamHelper_FormatUnixTime@8")
+124
View File
@@ -0,0 +1,124 @@
// BlitzSteam - Steam wrapper for Blitz.
// Copyright (C) 2015 Project Kube (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 "dllmain.h"
#include <string>
#include <sstream>
#pragma region Construction & Destruction
DLL_EXPORT int64_t* BlitzSteamInt64_New() {
return new int64_t;
}
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_New=_BlitzSteamInt64_New@0")
DLL_EXPORT int64_t* BlitzSteamInt64_Copy(int64_t* other) {
int64_t* pthis = new int64_t;
*pthis = *other;
return pthis;
}
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_Copy=_BlitzSteamInt64_Copy@4")
DLL_EXPORT void BlitzSteamInt64_Destroy(int64_t* pthis) {
delete pthis;
}
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_Destroy=_BlitzSteamInt64_Destroy@4")
#pragma endregion Construction & Destruction
#pragma region Math
DLL_EXPORT void BlitzSteamInt64_SetP(int64_t* pthis, int64_t* other) { *pthis = *other; }
DLL_EXPORT void BlitzSteamInt64_SetV(int64_t* pthis, uint32_t left, uint32_t right) { *pthis = ((int64_t)left << 32) + right; }
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_SetP=_BlitzSteamInt64_SetP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_SetV=_BlitzSteamInt64_SetV@12")
DLL_EXPORT void BlitzSteamInt64_AddP(int64_t* pthis, int64_t* other) { *pthis += *other; }
DLL_EXPORT void BlitzSteamInt64_AddV(int64_t* pthis, uint32_t left, uint32_t right) { *pthis += ((int64_t)left << 32) + right; }
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_AddP=_BlitzSteamInt64_AddP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_AddV=_BlitzSteamInt64_AddV@12")
DLL_EXPORT void BlitzSteamInt64_SubP(int64_t* pthis, int64_t* other) { *pthis -= *other; }
DLL_EXPORT void BlitzSteamInt64_SubV(int64_t* pthis, uint32_t left, uint32_t right) { *pthis -= ((int64_t)left << 32) + right; }
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_SubP=_BlitzSteamInt64_SubP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_SubV=_BlitzSteamInt64_SubV@12")
DLL_EXPORT void BlitzSteamInt64_MulP(int64_t* pthis, int64_t* other) { *pthis *= *other; }
DLL_EXPORT void BlitzSteamInt64_MulV(int64_t* pthis, uint32_t left, uint32_t right) { *pthis *= ((int64_t)left << 32) + right; }
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_MulP=_BlitzSteamInt64_MulP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_MulV=_BlitzSteamInt64_MulV@12")
DLL_EXPORT void BlitzSteamInt64_DivP(int64_t* pthis, int64_t* other) { *pthis *= *other; }
DLL_EXPORT void BlitzSteamInt64_DivV(int64_t* pthis, uint32_t left, uint32_t right) { *pthis *= ((int64_t)left << 32) + right; }
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_DivP=_BlitzSteamInt64_DivP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_DivV=_BlitzSteamInt64_DivV@12")
#pragma endregion Math
#pragma region Comparison
DLL_EXPORT uint32_t BlitzSteamInt64_EqualsP(int64_t* pthis, int64_t* other) { return (*pthis == *other); }
DLL_EXPORT uint32_t BlitzSteamInt64_EqualsV(int64_t* pthis, uint32_t left, uint32_t right) { return (*pthis == ((int64_t)left << 32) + right); }
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_EqualsP=_BlitzSteamInt64_EqualsP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_EqualsV=_BlitzSteamInt64_EqualsV@12")
DLL_EXPORT uint32_t BlitzSteamInt64_GEqualsP(int64_t* pthis, int64_t* other) { return (*pthis >= *other); }
DLL_EXPORT uint32_t BlitzSteamInt64_GEqualsV(int64_t* pthis, uint32_t left, uint32_t right) { return (*pthis >= ((int64_t)left << 32) + right); }
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_GEqualsP=_BlitzSteamInt64_GEqualsP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_GEqualsV=_BlitzSteamInt64_GEqualsV@12")
DLL_EXPORT uint32_t BlitzSteamInt64_SEqualsP(int64_t* pthis, int64_t* other) { return (*pthis <= *other); }
DLL_EXPORT uint32_t BlitzSteamInt64_SEqualsV(int64_t* pthis, uint32_t left, uint32_t right) { return (*pthis <= ((int64_t)left << 32) + right); }
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_SEqualsP=_BlitzSteamInt64_SEqualsP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_SEqualsV=_BlitzSteamInt64_SEqualsV@12")
DLL_EXPORT uint32_t BlitzSteamInt64_GreaterP(int64_t* pthis, int64_t* other) { return (*pthis > *other); }
DLL_EXPORT uint32_t BlitzSteamInt64_GreaterV(int64_t* pthis, uint32_t left, uint32_t right) { return (*pthis > ((int64_t)left << 32) + right); }
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_GreaterP=_BlitzSteamInt64_GreaterP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_GreaterV=_BlitzSteamInt64_GreaterV@12")
DLL_EXPORT uint32_t BlitzSteamInt64_SmallerP(int64_t* pthis, int64_t* other) { return (*pthis < *other); }
DLL_EXPORT uint32_t BlitzSteamInt64_SmallerV(int64_t* pthis, uint32_t left, uint32_t right) { return (*pthis < ((int64_t)left << 32) + right); }
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_SmallerP=_BlitzSteamInt64_SmallerP@8")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_SmallerV=_BlitzSteamInt64_SmallerV@12")
#pragma endregion Comparison
#pragma region Conversion
DLL_EXPORT const char* BlitzSteamInt64_ToString(int64_t* pthis) {
std::stringstream stream;
stream << *pthis;
return stream.str().c_str();
}
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_ToString=_BlitzSteamInt64_ToString@4")
// Int64 -> Int32
DLL_EXPORT int32_t BlitzSteamInt64_ValueL(int64_t* pthis) { return (int32_t)((*pthis) >> 32); }
DLL_EXPORT int32_t BlitzSteamInt64_ValueR(int64_t* pthis) { return (int32_t)((*pthis) && 0xFFFFFFFF); }
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_ValueL=_BlitzSteamInt64_ValueL@4")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_ValueR=_BlitzSteamInt64_ValueR@4")
// Int64 <-> Float
DLL_EXPORT float BlitzSteamInt64_ToFloat(int64_t* pthis) { return (float)*pthis; }
DLL_EXPORT int64_t* BlitzSteamInt64_FromFloat(float_t other) {
int64_t val = (int64_t)other;
return BlitzSteamInt64_Copy(&val);
}
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_ToFloat=_BlitzSteamInt64_ToFloat@4")
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_FromFloat=_BlitzSteamInt64_FromFloat@4")
// Int64 -> Double
DLL_EXPORT double_t* BlitzSteamInt64_ToDouble(int64_t* pthis) {
double_t* val = new double_t;
*val = (double_t)*pthis;
return val;
}
#pragma comment(linker, "/EXPORT:BlitzSteamInt64_ToDouble=_BlitzSteamInt64_ToDouble@4")
#pragma endregion Conversion