Skip to content

Commit

Permalink
support new ISteamUser API argument in Steam SDK 1.57
Browse files Browse the repository at this point in the history
  • Loading branch information
hylje authored and yancouto committed Jan 15, 2024
1 parent 473695b commit 92a555a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
5 changes: 1 addition & 4 deletions docs/user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Function Reference

.. function:: user.getAuthSessionTicket ()

:param string identityRemote: String representing the remote system that will authenticate the ticket.
:returns: (`data`) A result table if successful, otherwise nil

* **data.ticket** (`number`) The handle for the auth session ticket (only has meaning on the client on where you called this, is NOT an auth ticket)
Expand All @@ -72,10 +73,6 @@ Function Reference
-- Now do something with it
end

.. warning::

This function does not return a `SteamNetworkingIdentity` object. If this is needed, it needs to be implemented on the luasteam side.

.. function:: user.cancelAuthTicket ()

:param number ticketHandle: The ticket handle to cancel the auth ticket for. You need to call this once you are done using a requested or scheduled ticket. Make sure to call this for any open ticket handles when quitting your application.
Expand Down
11 changes: 6 additions & 5 deletions src/user.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ EXTERN int luasteam_getSteamID(lua_State *L) {
return 1;
}

// HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket );
// HAuthTicket GetAuthSessionTicket( void *pTicket, int cbMaxTicket, uint32 *pcbTicket, const SteamNetworkingIdentity *pIdentityRemote );
EXTERN int luasteam_getAuthSessionTicket(lua_State *L) {
uint32 pcbTicket = 0;
void *pTicket = malloc(1024);
// For now we're not returning this.
SteamNetworkingIdentity id;
SteamNetworkingIdentity *identityRemote = new SteamNetworkingIdentity();
identityRemote->ParseString(luaL_checkstring(L, 1));
HAuthTicket ticket = SteamUser()->GetAuthSessionTicket(pTicket, 1024, &pcbTicket, identityRemote);

HAuthTicket ticket = SteamUser()->GetAuthSessionTicket(pTicket, 1024, &pcbTicket, &id);
identityRemote->Clear();
free(identityRemote);

if (ticket != k_HAuthTicketInvalid) {
std::string hexTicket = bufferToHex(pTicket, pcbTicket);
Expand All @@ -84,7 +86,6 @@ EXTERN int luasteam_getAuthSessionTicket(lua_State *L) {
free(pTicket);
return 1;
}

free(pTicket);
lua_pushnil(L);
return 1;
Expand Down

0 comments on commit 92a555a

Please sign in to comment.