Author SHA1 Message Date
Nicholas Hastings 8eaea7217c Update EResult and EHTTPStatusCode 2026-07-12 13:16:28 -04:00
Nicholas Hastings 482491616f Update plugins/inc to use transitional syntax (#1)
* Update plugins/inc to use transitional syntax

* Add CI job for validating plugins/inc

* ci: work around broken entrypoint in sourcemod-spcomp image

* ci: only compile Pawn plugins against master includes

* ci: restore per-version compile-plugins matrix now that spcomp images are fixed

* ci: reuse sm.branch as the image tag directly
2026-07-12 17:11:09 +00:00
4 changed files with 294 additions and 244 deletions
+35
View File
@@ -101,6 +101,41 @@ jobs:
path: build/package/addons path: build/package/addons
if-no-files-found: error if-no-files-found: error
compile-plugins:
name: compile-plugins-sm${{ matrix.sm.label }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sm:
- label: "1.12"
branch: "1.12-dev"
- label: "1.13"
branch: "master"
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Clone SourceMod includes
run: |
git clone --depth 1 -b ${{ matrix.sm.branch }} https://github.com/alliedmodders/sourcemod.git sourcemod
- name: Compile Pawn plugins
run: |
mkdir -p compiled
status=0
for f in Pawn/*.sp; do
echo "::group::${f}"
docker run --rm -v "${{ github.workspace }}:/work" -w /work \
ghcr.io/alliedmodders/sourcemod-spcomp:${{ matrix.sm.branch }} \
-i Pawn/includes -i sourcemod/plugins/include \
"${f}" -o "compiled/$(basename "${f%.sp}.smx")" \
|| status=1
echo "::endgroup::"
done
exit "${status}"
release: release:
name: Release name: Release
needs: build needs: build
+129 -129
View File
@@ -1,129 +1,129 @@
#pragma semicolon 1 #pragma semicolon 1
#include <sourcemod> #include <sourcemod>
#include <SteamWorks> #include <SteamWorks>
new g_iPatchVersion = 0; int g_iPatchVersion = 0;
new g_iAppID = 0; int g_iAppID = 0;
new Handle:g_hForward = INVALID_HANDLE; Handle g_hForward = INVALID_HANDLE;
public Plugin:myinfo = public Plugin myinfo =
{ {
name = "SteamWorks Update Check", /* https://www.youtube.com/watch?v=Tq_0ht8HCcM */ name = "SteamWorks Update Check", /* https://www.youtube.com/watch?v=Tq_0ht8HCcM */
author = "Kyle Sanderson", author = "Kyle Sanderson",
description = "Queries SteamWeb for Updates.", description = "Queries SteamWeb for Updates.",
version = "1.0b", version = "1.0b",
url = "https://AlliedMods.net" url = "https://AlliedMods.net"
}; };
static stock bool:ReadSteamINF(const String:sPath[], &iAppID, &iPatchVersion) static stock bool ReadSteamINF(const char[] sPath, int &iAppID, int &iPatchVersion)
{ {
new Handle:hFile = OpenFile(sPath, "r"); Handle hFile = OpenFile(sPath, "r");
if (hFile == INVALID_HANDLE) if (hFile == INVALID_HANDLE)
{ {
return false; return false;
} }
decl String:sBuffer[256]; char sBuffer[256];
do do
{ {
if (!ReadFileLine(hFile, sBuffer, sizeof(sBuffer))) if (!ReadFileLine(hFile, sBuffer, sizeof(sBuffer)))
{ {
continue; continue;
} }
TrimString(sBuffer); TrimString(sBuffer);
ReplaceString(sBuffer, sizeof(sBuffer), ".", ""); /* CS:GO uses decimals in steam.inf, WebAPI is Steam| style. */ ReplaceString(sBuffer, sizeof(sBuffer), ".", ""); /* CS:GO uses decimals in steam.inf, WebAPI is Steam| style. */
new iPos = FindCharInString(sBuffer, '='); int iPos = FindCharInString(sBuffer, '=');
if (iPos == -1) if (iPos == -1)
{ {
continue; continue;
} }
sBuffer[iPos++] = '\0'; sBuffer[iPos++] = '\0';
switch (CharToLower(sBuffer[0])) switch (CharToLower(sBuffer[0]))
{ {
case 'a': case 'a':
{ {
if (!StrEqual(sBuffer, "appID", false)) if (!StrEqual(sBuffer, "appID", false))
{ {
continue; continue;
} }
iAppID = StringToInt(sBuffer[iPos]); iAppID = StringToInt(sBuffer[iPos]);
} }
case 'p': case 'p':
{ {
if (!StrEqual(sBuffer, "PatchVersion", false)) if (!StrEqual(sBuffer, "PatchVersion", false))
{ {
continue; continue;
} }
iPatchVersion = StringToInt(sBuffer[iPos]); iPatchVersion = StringToInt(sBuffer[iPos]);
} }
} }
} while (!IsEndOfFile(hFile)); } while (!IsEndOfFile(hFile));
CloseHandle(hFile); CloseHandle(hFile);
return true; return true;
} }
public OnPluginStart() public void OnPluginStart()
{ {
if (!ReadSteamINF("steam.inf", g_iAppID, g_iPatchVersion) && !ReadSteamINF("../steam.inf", g_iAppID, g_iPatchVersion)) if (!ReadSteamINF("steam.inf", g_iAppID, g_iPatchVersion) && !ReadSteamINF("../steam.inf", g_iAppID, g_iPatchVersion))
{ {
SetFailState("Unable to read steam.inf"); SetFailState("Unable to read steam.inf");
} }
g_hForward = CreateGlobalForward("SteamWorks_RestartRequested", ET_Ignore); g_hForward = CreateGlobalForward("SteamWorks_RestartRequested", ET_Ignore);
} }
public OnMapStart() public void OnMapStart()
{ {
CreateTimer(120.0, OnCheckForUpdate, _, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); CreateTimer(120.0, OnCheckForUpdate, _, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
} }
public Action:OnCheckForUpdate(Handle:hTimer) public Action OnCheckForUpdate(Handle hTimer)
{ {
static String:sRequest[256]; static char sRequest[256];
if (sRequest[0] == '\0') if (sRequest[0] == '\0')
{ {
FormatEx(sRequest, sizeof(sRequest), "http://api.steampowered.com/ISteamApps/UpToDateCheck/v0001/?appid=%u&version=%u&format=xml", g_iAppID, g_iPatchVersion); FormatEx(sRequest, sizeof(sRequest), "http://api.steampowered.com/ISteamApps/UpToDateCheck/v0001/?appid=%u&version=%u&format=xml", g_iAppID, g_iPatchVersion);
} }
new Handle:hRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodGET, sRequest); Handle hRequest = SteamWorks_CreateHTTPRequest(k_EHTTPMethodGET, sRequest);
if (!hRequest || !SteamWorks_SetHTTPCallbacks(hRequest, OnTransferComplete) || !SteamWorks_SendHTTPRequest(hRequest)) if (!hRequest || !SteamWorks_SetHTTPCallbacks(hRequest, OnTransferComplete) || !SteamWorks_SendHTTPRequest(hRequest))
{ {
CloseHandle(hRequest); CloseHandle(hRequest);
} }
return Plugin_Continue; return Plugin_Continue;
} }
public OnTransferComplete(Handle:hRequest, bool:bFailure, bool:bRequestSuccessful, EHTTPStatusCode:eStatusCode) public void OnTransferComplete(Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode)
{ {
if (!bFailure && bRequestSuccessful && eStatusCode == k_EHTTPStatusCode200OK) if (!bFailure && bRequestSuccessful && eStatusCode == k_EHTTPStatusCode200OK)
{ {
SteamWorks_GetHTTPResponseBodyCallback(hRequest, APIWebResponse); SteamWorks_GetHTTPResponseBodyCallback(hRequest, APIWebResponse);
} }
CloseHandle(hRequest); CloseHandle(hRequest);
} }
public APIWebResponse(const String:sData[]) public void APIWebResponse(const char[] sData)
{ {
new iPos = StrContains(sData, "<required_version>"); int iPos = StrContains(sData, "<required_version>");
if (iPos == -1) if (iPos == -1)
{ {
return; return;
} }
if (g_iPatchVersion != StringToInt(sData[iPos+18])) if (g_iPatchVersion != StringToInt(sData[iPos+18]))
{ {
Call_StartForward(g_hForward); Call_StartForward(g_hForward);
Call_Finish(); Call_Finish();
} }
} }
+109 -94
View File
@@ -117,7 +117,34 @@ enum EResult
k_EResultNeedCaptcha = 101, // Needs to provide a valid captcha k_EResultNeedCaptcha = 101, // Needs to provide a valid captcha
k_EResultGSLTDenied = 102, // a game server login token owned by this token's owner has been banned k_EResultGSLTDenied = 102, // a game server login token owned by this token's owner has been banned
k_EResultGSOwnerDenied = 103, // game server owner is denied for other reason (account lock, community ban, vac ban, missing phone) k_EResultGSOwnerDenied = 103, // game server owner is denied for other reason (account lock, community ban, vac ban, missing phone)
k_EResultInvalidItemType = 104 // the type of thing we were requested to act on is invalid k_EResultInvalidItemType = 104, // the type of thing we were requested to act on is invalid
k_EResultIPBanned = 105, // the ip address has been banned from taking this action
k_EResultGSLTExpired = 106, // this token has expired from disuse; can be reset for use
k_EResultInsufficientFunds = 107, // user doesn't have enough wallet funds to complete the action
k_EResultTooManyPending = 108, // There are too many of this thing pending already
k_EResultNoSiteLicensesFound = 109, // No site licenses found
k_EResultWGNetworkSendExceeded = 110, // the WG couldn't send a response because we exceeded max network send size
k_EResultAccountNotFriends = 111, // the user is not mutually friends
k_EResultLimitedUserAccount = 112, // the user is limited
k_EResultCantRemoveItem = 113, // item can't be removed
k_EResultAccountDeleted = 114, // account has been deleted
k_EResultExistingUserCancelledLicense = 115, // A license for this already exists, but cancelled
k_EResultCommunityCooldown = 116, // access is denied because of a community cooldown (probably from support profile data resets)
k_EResultNoLauncherSpecified = 117, // No launcher was specified, but a launcher was needed to choose correct realm for operation.
k_EResultMustAgreeToSSA = 118, // User must agree to china SSA or global SSA before login
k_EResultLauncherMigrated = 119, // The specified launcher type is no longer supported; the user should be directed elsewhere
k_EResultSteamRealmMismatch = 120, // The user's realm does not match the realm of the requested resource
k_EResultInvalidSignature = 121, // signature check did not match
k_EResultParseFailure = 122, // Failed to parse input
k_EResultNoVerifiedPhone = 123, // account does not have a verified phone number
k_EResultInsufficientBattery = 124, // user device doesn't have enough battery charge currently to complete the action
k_EResultChargerRequired = 125, // The operation requires a charger to be plugged in, which wasn't present
k_EResultCachedCredentialInvalid = 126, // Cached credential was invalid - user must reauthenticate
K_EResultPhoneNumberIsVOIP = 127, // The phone number provided is a Voice Over IP number
k_EResultNotSupported = 128, // The data being accessed is not supported by this API
k_EResultFamilySizeLimitExceeded = 129, // Reached the maximum size of the family
k_EResultOfflineAppCacheInvalid = 130, // The local data for the offline mode cache is insufficient to login
k_EResultTryLater = 131 // retry the operation later
}; };
/* This enum is used in client API methods, do not re-number existing values. */ /* This enum is used in client API methods, do not re-number existing values. */
@@ -169,6 +196,7 @@ enum EHTTPStatusCode
k_EHTTPStatusCode305UseProxy = 305, k_EHTTPStatusCode305UseProxy = 305,
//k_EHTTPStatusCode306Unused = 306, (used in old HTTP spec, now unused in 1.1) //k_EHTTPStatusCode306Unused = 306, (used in old HTTP spec, now unused in 1.1)
k_EHTTPStatusCode307TemporaryRedirect = 307, k_EHTTPStatusCode307TemporaryRedirect = 307,
k_EHTTPStatusCode308PermanentRedirect = 308,
// Error codes // Error codes
k_EHTTPStatusCode400BadRequest = 400, k_EHTTPStatusCode400BadRequest = 400,
@@ -190,7 +218,17 @@ enum EHTTPStatusCode
k_EHTTPStatusCode416RequestedRangeNotSatisfiable = 416, k_EHTTPStatusCode416RequestedRangeNotSatisfiable = 416,
k_EHTTPStatusCode417ExpectationFailed = 417, k_EHTTPStatusCode417ExpectationFailed = 417,
k_EHTTPStatusCode4xxUnknown = 418, // 418 is reserved, so we'll use it to mean unknown k_EHTTPStatusCode4xxUnknown = 418, // 418 is reserved, so we'll use it to mean unknown
k_EHTTPStatusCode421MisdirectedRequest = 421,
k_EHTTPStatusCode422UnprocessableContent = 422,
k_EHTTPStatusCode423Locked = 423,
k_EHTTPStatusCode424FailedDependency = 424,
k_EHTTPStatusCode425TooEarly = 425,
k_EHTTPStatusCode426UpgradeRequired = 426,
k_EHTTPStatusCode428PreconditionRequired = 428,
k_EHTTPStatusCode429TooManyRequests = 429, k_EHTTPStatusCode429TooManyRequests = 429,
k_EHTTPStatusCode431RequestHeaderFieldsTooLarge = 431,
k_EHTTPStatusCode444ConnectionClosed = 444, // nginx only?
k_EHTTPStatusCode451UnavailableForLegalReasons = 451,
// Server error codes // Server error codes
k_EHTTPStatusCode500InternalServerError = 500, k_EHTTPStatusCode500InternalServerError = 500,
@@ -199,9 +237,19 @@ enum EHTTPStatusCode
k_EHTTPStatusCode503ServiceUnavailable = 503, k_EHTTPStatusCode503ServiceUnavailable = 503,
k_EHTTPStatusCode504GatewayTimeout = 504, k_EHTTPStatusCode504GatewayTimeout = 504,
k_EHTTPStatusCode505HTTPVersionNotSupported = 505, k_EHTTPStatusCode505HTTPVersionNotSupported = 505,
k_EHTTPStatusCode506VariantAlsoNegotiates = 506,
k_EHTTPStatusCode507InsufficientStorage = 507,
k_EHTTPStatusCode508LoopDetected = 508,
k_EHTTPStatusCode510NotExtended = 510,
k_EHTTPStatusCode511NetworkAuthenticationRequired = 511,
k_EHTTPStatusCode5xxUnknown = 599, k_EHTTPStatusCode5xxUnknown = 599,
}; };
stock bool IsHTTPStatusSuccess(EHTTPStatusCode eStatusCode)
{
return (eStatusCode >= k_EHTTPStatusCode200OK && eStatusCode < k_EHTTPStatusCode300MultipleChoices);
}
/* list of possible return values from the ISteamGameCoordinator API */ /* list of possible return values from the ISteamGameCoordinator API */
enum EGCResults enum EGCResults
{ {
@@ -212,42 +260,41 @@ enum EGCResults
k_EGCResultInvalidMessage = 4, // Something was wrong with the message being sent with SendMessage k_EGCResultInvalidMessage = 4, // Something was wrong with the message being sent with SendMessage
}; };
native bool:SteamWorks_IsVACEnabled(); native bool SteamWorks_IsVACEnabled();
native bool:SteamWorks_GetPublicIP(ipaddr[4]); native bool SteamWorks_GetPublicIP(int ipaddr[4]);
native SteamWorks_GetPublicIPCell(); native int SteamWorks_GetPublicIPCell();
native bool:SteamWorks_IsLoaded(); native bool SteamWorks_IsLoaded();
native bool:SteamWorks_SetGameData(const String:sData[]); native bool SteamWorks_SetGameData(const char[] sData);
native bool:SteamWorks_SetGameDescription(const String:sDesc[]); native bool SteamWorks_SetGameDescription(const char[] sDesc);
native bool:SteamWorks_SetMapName(const String:sMapName[]); native bool SteamWorks_SetMapName(const char[] sMapName);
native bool:SteamWorks_IsConnected(); native bool SteamWorks_IsConnected();
native bool:SteamWorks_SetRule(const String:sKey[], const String:sValue[]); native bool SteamWorks_SetRule(const char[] sKey, const char[] sValue);
native bool:SteamWorks_ClearRules(); native bool SteamWorks_ClearRules();
#pragma deprecated This function is deprecated in the SDK and no longer does anything in this extension #pragma deprecated This function is deprecated in the SDK and no longer does anything in this extension
native bool:SteamWorks_ForceHeartbeat(); native bool SteamWorks_ForceHeartbeat();
native bool:SteamWorks_GetUserGroupStatus(client, groupid); native bool SteamWorks_GetUserGroupStatus(int client, int groupid);
native bool:SteamWorks_GetUserGroupStatusAuthID(authid, groupid); native bool SteamWorks_GetUserGroupStatusAuthID(int authid, int groupid);
native EUserHasLicenseForAppResult:SteamWorks_HasLicenseForApp(client, app); native EUserHasLicenseForAppResult SteamWorks_HasLicenseForApp(int client, int app);
native EUserHasLicenseForAppResult:SteamWorks_HasLicenseForAppId(authid, app); native EUserHasLicenseForAppResult SteamWorks_HasLicenseForAppId(int authid, int app);
native SteamWorks_GetClientSteamID(client, String:sSteamID[], length); native int SteamWorks_GetClientSteamID(int client, char[] sSteamID, int length);
native bool:SteamWorks_RequestStatsAuthID(authid, appid); native bool SteamWorks_RequestStatsAuthID(int authid, int appid);
native bool:SteamWorks_RequestStats(client, appid); native bool SteamWorks_RequestStats(int client, int appid);
native bool:SteamWorks_GetStatCell(client, const String:sKey[], &value); native bool SteamWorks_GetStatCell(int client, const char[] sKey, int &value);
native bool:SteamWorks_GetStatAuthIDCell(authid, const String:sKey[], &value); native bool SteamWorks_GetStatAuthIDCell(int authid, const char[] sKey, int &value);
native bool:SteamWorks_GetStatFloat(client, const String:sKey[], &Float:value); native bool SteamWorks_GetStatFloat(int client, const char[] sKey, float &value);
native bool:SteamWorks_GetStatAuthIDFloat(authid, const String:sKey[], &Float:value); native bool SteamWorks_GetStatAuthIDFloat(int authid, const char[] sKey, float &value);
native Handle:SteamWorks_CreateHTTPRequest(EHTTPMethod:method, const String:sURL[]); native Handle SteamWorks_CreateHTTPRequest(EHTTPMethod method, const char[] sURL);
native bool:SteamWorks_SetHTTPRequestContextValue(Handle:hHandle, any:data1, any:data2=0); native bool SteamWorks_SetHTTPRequestContextValue(Handle hHandle, any data1, any data2=0);
native bool:SteamWorks_SetHTTPRequestNetworkActivityTimeout(Handle:hHandle, timeout); native bool SteamWorks_SetHTTPRequestNetworkActivityTimeout(Handle hHandle, int timeout);
native bool:SteamWorks_SetHTTPRequestHeaderValue(Handle:hHandle, const String:sName[], const String:sValue[]); native bool SteamWorks_SetHTTPRequestHeaderValue(Handle hHandle, const char[] sName, const char[] sValue);
native bool:SteamWorks_SetHTTPRequestGetOrPostParameter(Handle:hHandle, const String:sName[], const String:sValue[]); native bool SteamWorks_SetHTTPRequestGetOrPostParameter(Handle hHandle, const char[] sName, const char[] sValue);
native bool:SteamWorks_SetHTTPRequestUserAgentInfo(Handle:hHandle, const String:sUserAgentInfo[]); native bool SteamWorks_SetHTTPRequestUserAgentInfo(Handle hHandle, const char[] sUserAgentInfo);
native bool:SteamWorks_SetHTTPRequestRequiresVerifiedCertificate(Handle:hHandle, bool:bRequireVerifiedCertificate); native bool SteamWorks_SetHTTPRequestRequiresVerifiedCertificate(Handle hHandle, bool bRequireVerifiedCertificate);
native bool:SteamWorks_SetHTTPRequestAbsoluteTimeoutMS(Handle:hHandle, unMilliseconds); native bool SteamWorks_SetHTTPRequestAbsoluteTimeoutMS(Handle hHandle, int unMilliseconds);
#if SOURCEMOD_V_MAJOR >= 1 && SOURCEMOD_V_MINOR >= 9
typeset SteamWorksHTTPRequestCompleted typeset SteamWorksHTTPRequestCompleted
{ {
function void (Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode); function void (Handle hRequest, bool bFailure, bool bRequestSuccessful, EHTTPStatusCode eStatusCode);
@@ -276,74 +323,42 @@ typeset SteamWorksHTTPBodyCallback
function void (const int[] data, any value, int datalen); function void (const int[] data, any value, int datalen);
}; };
#else native bool SteamWorks_SetHTTPCallbacks(Handle hHandle, SteamWorksHTTPRequestCompleted fCompleted = INVALID_FUNCTION, SteamWorksHTTPHeadersReceived fHeaders = INVALID_FUNCTION, SteamWorksHTTPDataReceived fData = INVALID_FUNCTION, Handle hCalling = INVALID_HANDLE);
native bool SteamWorks_SendHTTPRequest(Handle hRequest);
native bool SteamWorks_SendHTTPRequestAndStreamResponse(Handle hRequest);
native bool SteamWorks_DeferHTTPRequest(Handle hRequest);
native bool SteamWorks_PrioritizeHTTPRequest(Handle hRequest);
native bool SteamWorks_GetHTTPResponseHeaderSize(Handle hRequest, const char[] sHeader, int &size);
native bool SteamWorks_GetHTTPResponseHeaderValue(Handle hRequest, const char[] sHeader, char[] sValue, int size);
native bool SteamWorks_GetHTTPResponseBodySize(Handle hRequest, int &size);
native bool SteamWorks_GetHTTPResponseBodyData(Handle hRequest, char[] sBody, int length);
native bool SteamWorks_GetHTTPStreamingResponseBodyData(Handle hRequest, int cOffset, char[] sBody, int length);
native bool SteamWorks_GetHTTPDownloadProgressPct(Handle hRequest, float &percent);
native bool SteamWorks_GetHTTPRequestWasTimedOut(Handle hRequest, bool &bWasTimedOut);
native bool SteamWorks_SetHTTPRequestRawPostBody(Handle hRequest, const char[] sContentType, const char[] sBody, int bodylen);
native bool SteamWorks_SetHTTPRequestRawPostBodyFromFile(Handle hRequest, const char[] sContentType, const char[] sFileName);
funcenum SteamWorksHTTPRequestCompleted native bool SteamWorks_GetHTTPResponseBodyCallback(Handle hRequest, SteamWorksHTTPBodyCallback fCallback, any data = 0, Handle hPlugin = INVALID_HANDLE);
{ native bool SteamWorks_WriteHTTPResponseBodyToFile(Handle hRequest, const char[] sFileName);
public(Handle:hRequest, bool:bFailure, bool:bRequestSuccessful, EHTTPStatusCode:eStatusCode),
public(Handle:hRequest, bool:bFailure, bool:bRequestSuccessful, EHTTPStatusCode:eStatusCode, any:data1),
public(Handle:hRequest, bool:bFailure, bool:bRequestSuccessful, EHTTPStatusCode:eStatusCode, any:data1, any:data2)
};
funcenum SteamWorksHTTPHeadersReceived forward void SW_OnValidateClient(int ownerauthid, int authid);
{ forward void SteamWorks_OnValidateClient(int ownerauthid, int authid);
public(Handle:hRequest, bool:bFailure), forward void SteamWorks_SteamServersConnected();
public(Handle:hRequest, bool:bFailure, any:data1), forward void SteamWorks_SteamServersConnectFailure(EResult result);
public(Handle:hRequest, bool:bFailure, any:data1, any:data2) forward void SteamWorks_SteamServersDisconnected(EResult result);
};
funcenum SteamWorksHTTPDataReceived forward Action SteamWorks_RestartRequested();
{ forward void SteamWorks_TokenRequested(char[] sToken, int maxlen);
public(Handle:hRequest, bool:bFailure, offset, bytesreceived),
public(Handle:hRequest, bool:bFailure, offset, bytesreceived, any:data1),
public(Handle:hRequest, bool:bFailure, offset, bytesreceived, any:data1, any:data2)
};
funcenum SteamWorksHTTPBodyCallback forward void SteamWorks_OnClientGroupStatus(int authid, int groupid, bool isMember, bool isOfficer);
{
public(const String:sData[]),
public(const String:sData[], any:value),
public(const data[], any:value, datalen)
};
#endif forward EGCResults SteamWorks_GCSendMessage(int unMsgType, const char[] pubData, int cubData);
forward void SteamWorks_GCMsgAvailable(int cubData);
forward EGCResults SteamWorks_GCRetrieveMessage(int punMsgType, const char[] pubDest, int cubDest, int pcubMsgSize);
native bool:SteamWorks_SetHTTPCallbacks(Handle:hHandle, SteamWorksHTTPRequestCompleted:fCompleted = INVALID_FUNCTION, SteamWorksHTTPHeadersReceived:fHeaders = INVALID_FUNCTION, SteamWorksHTTPDataReceived:fData = INVALID_FUNCTION, Handle:hCalling = INVALID_HANDLE); native EGCResults SteamWorks_SendMessageToGC(int unMsgType, const char[] pubData, int cubData);
native bool:SteamWorks_SendHTTPRequest(Handle:hRequest);
native bool:SteamWorks_SendHTTPRequestAndStreamResponse(Handle:hRequest);
native bool:SteamWorks_DeferHTTPRequest(Handle:hRequest);
native bool:SteamWorks_PrioritizeHTTPRequest(Handle:hRequest);
native bool:SteamWorks_GetHTTPResponseHeaderSize(Handle:hRequest, const String:sHeader[], &size);
native bool:SteamWorks_GetHTTPResponseHeaderValue(Handle:hRequest, const String:sHeader[], String:sValue[], size);
native bool:SteamWorks_GetHTTPResponseBodySize(Handle:hRequest, &size);
native bool:SteamWorks_GetHTTPResponseBodyData(Handle:hRequest, String:sBody[], length);
native bool:SteamWorks_GetHTTPStreamingResponseBodyData(Handle:hRequest, cOffset, String:sBody[], length);
native bool:SteamWorks_GetHTTPDownloadProgressPct(Handle:hRequest, &Float:percent);
native bool:SteamWorks_GetHTTPRequestWasTimedOut(Handle:hRequest, &bool:bWasTimedOut);
native bool:SteamWorks_SetHTTPRequestRawPostBody(Handle:hRequest, const String:sContentType[], const String:sBody[], bodylen);
native bool:SteamWorks_SetHTTPRequestRawPostBodyFromFile(Handle:hRequest, const String:sContentType[], const String:sFileName[]);
native bool:SteamWorks_GetHTTPResponseBodyCallback(Handle:hRequest, SteamWorksHTTPBodyCallback:fCallback, any:data = 0, Handle:hPlugin = INVALID_HANDLE); /* Look up, moved definition for 1.7+ compat. */ public Extension __ext_SteamWorks =
native bool:SteamWorks_WriteHTTPResponseBodyToFile(Handle:hRequest, const String:sFileName[]);
forward SW_OnValidateClient(ownerauthid, authid);
forward SteamWorks_OnValidateClient(ownerauthid, authid);
forward SteamWorks_SteamServersConnected();
forward SteamWorks_SteamServersConnectFailure(EResult:result);
forward SteamWorks_SteamServersDisconnected(EResult:result);
forward Action:SteamWorks_RestartRequested();
forward SteamWorks_TokenRequested(String:sToken[], maxlen);
forward SteamWorks_OnClientGroupStatus(authid, groupid, bool:isMember, bool:isOfficer);
forward EGCResults:SteamWorks_GCSendMessage(unMsgType, const String:pubData[], cubData);
forward SteamWorks_GCMsgAvailable(cubData);
forward EGCResults:SteamWorks_GCRetrieveMessage(punMsgType, const String:pubDest[], cubDest, pcubMsgSize);
native EGCResults:SteamWorks_SendMessageToGC(unMsgType, const String:pubData[], cubData);
public Extension:__ext_SteamWorks =
{ {
name = "SteamWorks", name = "SteamWorks",
file = "SteamWorks.ext", file = "SteamWorks.ext",
@@ -360,7 +375,7 @@ public Extension:__ext_SteamWorks =
}; };
#if !defined REQUIRE_EXTENSIONS #if !defined REQUIRE_EXTENSIONS
public __ext_SteamWorks_SetNTVOptional() public void __ext_SteamWorks_SetNTVOptional()
{ {
MarkNativeAsOptional("SteamWorks_IsVACEnabled"); MarkNativeAsOptional("SteamWorks_IsVACEnabled");
MarkNativeAsOptional("SteamWorks_GetPublicIP"); MarkNativeAsOptional("SteamWorks_GetPublicIP");
+21 -21
View File
@@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with SourcePawn SteamWorks. If not, see <http://www.gnu.org/licenses/>. along with SourcePawn SteamWorks. If not, see <http://www.gnu.org/licenses/>.
Author: Kyle Sanderson (KyleS). Author: Kyle Sanderson (KyleS).
*/ */
@@ -20,10 +20,10 @@
#include <sourcemod> #include <sourcemod>
#include <SteamWorks> #include <SteamWorks>
new Handle:g_hSteamServersConnected = INVALID_HANDLE; Handle g_hSteamServersConnected = INVALID_HANDLE;
new Handle:g_hSteamServersDisconnected = INVALID_HANDLE; Handle g_hSteamServersDisconnected = INVALID_HANDLE;
public Plugin:myinfo = { public Plugin myinfo = {
name = "SteamWorks Additive Glider", /* SWAG */ name = "SteamWorks Additive Glider", /* SWAG */
author = "Kyle Sanderson", author = "Kyle Sanderson",
description = "Translates SteamTools calls into SteamWorks calls.", description = "Translates SteamTools calls into SteamWorks calls.",
@@ -31,7 +31,7 @@ public Plugin:myinfo = {
url = "http://AlliedMods.net" url = "http://AlliedMods.net"
}; };
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{ {
CreateNative("Steam_IsVACEnabled", native_IsVACEnabled); CreateNative("Steam_IsVACEnabled", native_IsVACEnabled);
CreateNative("Steam_GetPublicIP", native_GetPublicIP); CreateNative("Steam_GetPublicIP", native_GetPublicIP);
@@ -40,73 +40,73 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
CreateNative("Steam_SetRule", native_SetRule); CreateNative("Steam_SetRule", native_SetRule);
CreateNative("Steam_ClearRules", native_ClearRules); CreateNative("Steam_ClearRules", native_ClearRules);
CreateNative("Steam_ForceHeartbeat", native_ForceHeartbeat); CreateNative("Steam_ForceHeartbeat", native_ForceHeartbeat);
g_hSteamServersConnected = CreateGlobalForward("Steam_SteamServersConnected", ET_Ignore); g_hSteamServersConnected = CreateGlobalForward("Steam_SteamServersConnected", ET_Ignore);
g_hSteamServersDisconnected = CreateGlobalForward("Steam_SteamServersDisconnected", ET_Ignore); g_hSteamServersDisconnected = CreateGlobalForward("Steam_SteamServersDisconnected", ET_Ignore);
return APLRes_Success; return APLRes_Success;
} }
public native_IsVACEnabled(Handle:plugin, numParams) public int native_IsVACEnabled(Handle plugin, int numParams)
{ {
return SteamWorks_IsVACEnabled(); return SteamWorks_IsVACEnabled();
} }
public native_GetPublicIP(Handle:plugin, numParams) public int native_GetPublicIP(Handle plugin, int numParams)
{ {
new addr[4]; int addr[4];
SteamWorks_GetPublicIP(addr); SteamWorks_GetPublicIP(addr);
SetNativeArray(1, addr, sizeof(addr)); SetNativeArray(1, addr, sizeof(addr));
return 1; return 1;
} }
public native_SetGameDescription(Handle:plugin, numParams) public int native_SetGameDescription(Handle plugin, int numParams)
{ {
decl String:sDesc[PLATFORM_MAX_PATH]; char sDesc[PLATFORM_MAX_PATH];
GetNativeString(1, sDesc, sizeof(sDesc)); GetNativeString(1, sDesc, sizeof(sDesc));
return SteamWorks_SetGameDescription(sDesc); return SteamWorks_SetGameDescription(sDesc);
} }
public native_IsConnected(Handle:plugin, numParams) public int native_IsConnected(Handle plugin, int numParams)
{ {
return SteamWorks_IsConnected(); return SteamWorks_IsConnected();
} }
public native_SetRule(Handle:plugin, numParams) public int native_SetRule(Handle plugin, int numParams)
{ {
decl String:sKey[PLATFORM_MAX_PATH], String:sValue[PLATFORM_MAX_PATH]; char sKey[PLATFORM_MAX_PATH], sValue[PLATFORM_MAX_PATH];
GetNativeString(1, sKey, sizeof(sKey)); GetNativeString(1, sKey, sizeof(sKey));
GetNativeString(2, sValue, sizeof(sValue)); GetNativeString(2, sValue, sizeof(sValue));
return SteamWorks_SetRule(sKey, sValue); return SteamWorks_SetRule(sKey, sValue);
} }
public native_ClearRules(Handle:plugin, numParams) public int native_ClearRules(Handle plugin, int numParams)
{ {
return SteamWorks_ClearRules(); return SteamWorks_ClearRules();
} }
public native_ForceHeartbeat(Handle:plugin, numParams) public int native_ForceHeartbeat(Handle plugin, int numParams)
{ {
return SteamWorks_ForceHeartbeat(); return 0;
} }
public SteamWorks_SteamServersConnected() public void SteamWorks_SteamServersConnected()
{ {
if (GetForwardFunctionCount(g_hSteamServersConnected) == 0) if (GetForwardFunctionCount(g_hSteamServersConnected) == 0)
{ {
return; return;
} }
Call_StartForward(g_hSteamServersConnected); Call_StartForward(g_hSteamServersConnected);
Call_Finish(); Call_Finish();
} }
public SteamWorks_SteamServersDisconnected() public void SteamWorks_SteamServersDisconnected()
{ {
if (GetForwardFunctionCount(g_hSteamServersDisconnected) == 0) if (GetForwardFunctionCount(g_hSteamServersDisconnected) == 0)
{ {
return; return;
} }
Call_StartForward(g_hSteamServersDisconnected); Call_StartForward(g_hSteamServersDisconnected);
Call_Finish(); Call_Finish();
} }