Add SteamWorks_SendMessageToGC (untested as well).

This commit is contained in:
Kyle Sanderson
2016-03-05 17:32:16 -08:00
committed by Josh Allard
parent 3da8a5d831
commit 5cd391a31b
6 changed files with 96 additions and 0 deletions
+1
View File
@@ -11,6 +11,7 @@ project.sources += [
'swgshooks.cpp',
'swgsdetours.cpp',
'ssnatives.cpp',
'gcnatives.cpp',
'swhttp.cpp',
'swhttprequest.cpp',
'swgchooks.cpp',
+2
View File
@@ -56,11 +56,13 @@ bool SteamWorks::SDK_OnLoad(char *error, size_t maxlength, bool late)
this->pGSDetours = new SteamWorksGSDetours;
this->pSSNatives = new SteamWorksSSNatives;
this->pGCHooks = new SteamWorksGCHooks;
this->pGCNatives = new SteamWorksGCNatives;
return true;
}
void SteamWorks::SDK_OnUnload()
{
delete this->pGCNatives;
delete this->pGCHooks;
delete this->pSSNatives;
delete this->pGSDetours;
+2
View File
@@ -49,6 +49,7 @@
#include "swgshooks.h"
#include "swgchooks.h"
#include "ssnatives.h"
#include "gcnatives.h"
#include "swgsdetours.h"
#include "swhttp.h"
@@ -144,6 +145,7 @@ public:
SteamWorksHTTP *pSWHTTP;
SteamWorksHTTPNatives *pSWHTTPNatives;
SteamWorksGCHooks *pGCHooks;
SteamWorksGCNatives *pGCNatives;
};
extern SteamWorks g_SteamWorks;
+53
View File
@@ -0,0 +1,53 @@
/*
This file is part of SourcePawn SteamWorks.
SourcePawn SteamWorks is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, as per version 3 of the License.
SourcePawn SteamWorks 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 General Public License
along with SourcePawn SteamWorks. If not, see <http://www.gnu.org/licenses/>.
Author: Kyle Sanderson (KyleS).
*/
#include "gcnatives.h"
static ISteamGameCoordinator *GetSteamGCPointer(void)
{
return g_SteamWorks.pSWGameServer->GetGameCoordinator();
}
static cell_t sm_GCSendMessage(IPluginContext *pContext, const cell_t *params)
{
ISteamGameCoordinator *pGC = GetSteamGCPointer();
if (pGC == NULL)
{
return static_cast<cell_t>(k_EGCResultNotLoggedOn);
}
char *pData;
pContext->LocalToString(params[2], &pData);
return static_cast<cell_t>(pGC->SendMessage(params[1], pData, params[3]));
}
static sp_nativeinfo_t gcnatives[] = {
{"SteamWorks_SendMessageToGC", sm_GCSendMessage},
{NULL, NULL}
};
SteamWorksGCNatives::SteamWorksGCNatives()
{
sharesys->AddNatives(myself, gcnatives);
}
SteamWorksGCNatives::~SteamWorksGCNatives()
{
/* We tragically can't remove ourselves... hopefully no one uses this class, you know, like a class. */
}
+36
View File
@@ -0,0 +1,36 @@
/*
This file is part of SourcePawn SteamWorks.
SourcePawn SteamWorks is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, as per version 3 of the License.
SourcePawn SteamWorks 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 General Public License
along with SourcePawn SteamWorks. If not, see <http://www.gnu.org/licenses/>.
Author: Kyle Sanderson (KyleS).
*/
#pragma once
#include "steam_gameserver.h"
#include "isteamgamecoordinator.h"
#include "smsdk_ext.h"
#ifdef _WIN32
#undef SendMessage
#endif
class SteamWorksGCNatives
{
public:
SteamWorksGCNatives();
~SteamWorksGCNatives();
};
#include "extension.h"