Compare commits

...

3 Commits

Author SHA1 Message Date
Mr_Goldberg 39cb2c7c17
Implement the promoitems functions. 2020-06-25 11:26:40 -04:00
Mr_Goldberg 833510fbf1
Very basic implementations of a few steamhttp functions. 2020-06-25 11:26:19 -04:00
Mr_Goldberg d531e27ac0
Fixed potential bug. Thanks to Nemirtingas for finding it. 2020-06-23 07:19:45 -04:00
3 changed files with 35 additions and 6 deletions

View File

@ -116,7 +116,7 @@ bool Steam_HTTP::SetHTTPRequestGetOrPostParameter( HTTPRequestHandle hRequest, c
// header and only do a local cache lookup rather than sending any actual remote request.
bool Steam_HTTP::SendHTTPRequest( HTTPRequestHandle hRequest, SteamAPICall_t *pCallHandle )
{
PRINT_DEBUG("SendHTTPRequest\n");
PRINT_DEBUG("SendHTTPRequest %u %p\n", hRequest, pCallHandle);
Steam_Http_Request *request = get_request(hRequest);
if (!request) {
return false;
@ -276,7 +276,12 @@ bool Steam_HTTP::GetHTTPDownloadProgressPct( HTTPRequestHandle hRequest, float *
bool Steam_HTTP::SetHTTPRequestRawPostBody( HTTPRequestHandle hRequest, const char *pchContentType, uint8 *pubBody, uint32 unBodyLen )
{
PRINT_DEBUG("SetHTTPRequestRawPostBody\n");
return false;
Steam_Http_Request *request = get_request(hRequest);
if (!request) {
return false;
}
return true;
}
@ -360,5 +365,11 @@ bool Steam_HTTP::SetHTTPRequestAbsoluteTimeoutMS( HTTPRequestHandle hRequest, ui
bool Steam_HTTP::GetHTTPRequestWasTimedOut( HTTPRequestHandle hRequest, bool *pbWasTimedOut )
{
PRINT_DEBUG("GetHTTPRequestWasTimedOut\n");
return false;
Steam_Http_Request *request = get_request(hRequest);
if (!request) {
return false;
}
if (pbWasTimedOut) *pbWasTimedOut = false;
return true;
}

View File

@ -453,6 +453,11 @@ STEAM_METHOD_DESC(GrantPromoItems() checks the list of promotional items for whi
bool GrantPromoItems( SteamInventoryResult_t *pResultHandle )
{
PRINT_DEBUG("GrantPromoItems\n");
std::lock_guard<std::recursive_mutex> lock(global_mutex);
struct Steam_Inventory_Requests* request = new_inventory_result(false);
if (pResultHandle != nullptr)
*pResultHandle = request->inventory_result;
return true;
}
@ -464,13 +469,25 @@ bool GrantPromoItems( SteamInventoryResult_t *pResultHandle )
bool AddPromoItem( SteamInventoryResult_t *pResultHandle, SteamItemDef_t itemDef )
{
PRINT_DEBUG("AddPromoItem\n");
return false;
//TODO
std::lock_guard<std::recursive_mutex> lock(global_mutex);
struct Steam_Inventory_Requests* request = new_inventory_result(false);
if (pResultHandle != nullptr)
*pResultHandle = request->inventory_result;
return true;
}
bool AddPromoItems( SteamInventoryResult_t *pResultHandle, STEAM_ARRAY_COUNT(unArrayLength) const SteamItemDef_t *pArrayItemDefs, uint32 unArrayLength )
{
PRINT_DEBUG("AddPromoItems\n");
return false;
//TODO
std::lock_guard<std::recursive_mutex> lock(global_mutex);
struct Steam_Inventory_Requests* request = new_inventory_result(false);
if (pResultHandle != nullptr)
*pResultHandle = request->inventory_result;
return true;
}

View File

@ -149,8 +149,9 @@ void remove_connection(CSteamID id)
SNetSocket_t create_connection_socket(CSteamID target, int nVirtualPort, uint32 nIP, uint16 nPort, SNetListenSocket_t id=0, enum steam_socket_connection_status status=SOCKET_CONNECTING, SNetSocket_t other_id=0)
{
static SNetSocket_t socket_number = 0;
bool found = 0;
bool found;
do {
found = false;
++socket_number;
for (auto & c: connection_sockets) {
if (c.id == socket_number || socket_number == 0) {