This might be a stupid question but steamtools has this native like this:
native bool:Steam_SendHTTPRequest(HTTPRequestHandle: HTTPRequest, HTTPRequestComplete:callbackFunction, any:contextData = 0);
But the steamworks one is like this:
native bool:SteamWorks_SendHTTPRequest(Handle:hReque st);
and what is the equivalent to native
Steam_ReleaseHTTPRequest(HTTPRequestHandle:HT TPRequest);?
I'm just mucking around with updater and using steamworks instead of steamtools
PHP Code:
/* Extension Helper - SteamWorks */
Download_SteamWorks(const String:url[], const String:dest[])
{
decl String:sURL[MAX_URL_LENGTH];
PrefixURL(sURL, sizeof(sURL), url);
new Handle:hDLPack = CreateDataPack();
WritePackString(hDLPack, dest);
new HTTPRequestHandle:hRequest = SteamWorks_CreateHTTPRequest(HTTPMethod_GET, sURL);
SteamWorks_SetHTTPRequestHeaderValue(hRequest, "Pragma", "no-cache");
SteamWorks_SetHTTPRequestHeaderValue(hRequest, "Cache-Control", "no-cache");
// need to change this to steamworks
Steam_SendHTTPRequest(hRequest, OnSteamHTTPComplete, hDLPack);
}
public OnSteamHTTPComplete(HTTPRequestHandle:HTTPRequest, bool:requestSuccessful, HTTPStatusCode:statusCode, any:hDLPack)
{
decl String:sDest[PLATFORM_MAX_PATH];
ResetPack(hDLPack);
ReadPackString(hDLPack, sDest, sizeof(sDest));
CloseHandle(hDLPack);
if (requestSuccessful && statusCode == HTTPStatusCode_OK)
{
SteamWorks_WriteHTTPResponseBodyToFile(HTTPRequest, sDest);
DownloadEnded(true);
}
else
{
decl String:sError[256];
FormatEx(sError, sizeof(sError), "SteamTools error (status code %i). Request successful: %s", _:statusCode, requestSuccessful ? "True" : "False");
DownloadEnded(false, sError);
}
// need to change this to steamworks
Steam_ReleaseHTTPRequest(HTTPRequest);
}
// need to change this to steamworks if possible?
/* Keep track of SteamTools load state.
new bool:g_bSteamLoaded;
public Steam_FullyLoaded()
{
g_bSteamLoaded = true;
}
public Steam_Shutdown()
{
g_bSteamLoaded = false;
} */
__________________