View Single Post
versatile_bfg
Veteran Member
Join Date: Feb 2012
Old 07-17-2014 , 20:29   Re: [ANY] SteamWorks
Reply With Quote #127

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(sURLsizeof(sURL), url);
    
    new 
Handle:hDLPack CreateDataPack();
    
WritePackString(hDLPackdest);

    new 
HTTPRequestHandle:hRequest SteamWorks_CreateHTTPRequest(HTTPMethod_GETsURL);
    
SteamWorks_SetHTTPRequestHeaderValue(hRequest"Pragma""no-cache");
    
SteamWorks_SetHTTPRequestHeaderValue(hRequest"Cache-Control""no-cache");
// need to change this to steamworks
    
Steam_SendHTTPRequest(hRequestOnSteamHTTPCompletehDLPack);
}

public 
OnSteamHTTPComplete(HTTPRequestHandle:HTTPRequestbool:requestSuccessfulHTTPStatusCode:statusCodeany:hDLPack)
{
    
decl String:sDest[PLATFORM_MAX_PATH];
    
ResetPack(hDLPack);
    
ReadPackString(hDLPacksDestsizeof(sDest));
    
CloseHandle(hDLPack);
    
    if (
requestSuccessful && statusCode == HTTPStatusCode_OK)
    {
        
SteamWorks_WriteHTTPResponseBodyToFile(HTTPRequestsDest);
        
DownloadEnded(true);
    }
    else
    {
        
decl String:sError[256];
        
FormatEx(sErrorsizeof(sError), "SteamTools error (status code %i). Request successful: %s"_:statusCoderequestSuccessful "True" "False");
        
DownloadEnded(falsesError);
    }
    
// 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;
} */ 
__________________

Last edited by versatile_bfg; 07-17-2014 at 21:58.
versatile_bfg is offline