Skip to content

Steam SDK Wrapper (Beta)

Introduction

As you know from the previous article, there are some essential differences between GOG and Steam. With this tool we aim to decrease the time needed to implement additional features on GOG. If you already have a Steam version of your product, you can get it up and running on our platform within minutes, not hours. No replacing one API methods with another in the code — all you need is to use our Steam SDK Wrapper (Beta).

Steam SDK Wrapper (Beta) is a middle layer that intercepts Steam API calls and translates them into calls that can be understood by the GOG backends. Not all Steam features are supported yet — and, obviously, some will never be — but basic functionality is preserved. Currently, Steam SDK Wrapper (Beta) allows to use the following features out of the box:

  • achievements,
  • leaderboards,
  • stats,
  • friends.

Offline mode

Games on GOG being DRM-free require that the game is playable even without installed Galaxy Client. So it should be possible to play the game even when SteamAPI_Init returns false which isn't the case for Steam. It's a special case that could imply game's code changes.

Implementation

  1. Make sure you’re using a supported Steam API version.
  2. Add achievements to DevPortal, ideally using the VDF file from Steam.
  3. Download Steam SDK Wrapper (Beta)
  4. Add Steam SDK Wrapper (Beta) to your game. There are two ways to achieve that. Do one of the following:
    1. Rename file GalaxySteamWrapper/Libraries/GalaxySteamWrapper[64].dll to steam_api[64].dll and use it to replace the original steam_api[64].dll file in your game build
    2. Recompile your game linking against GalaxySteamWrapper/Libraries/GalaxySteamWrapper[64].lib
  5. Copy GalaxySteamWrapper/Libraries/Galaxy[64].dll to the same directory as steam_api[64].dll
  6. Create a GalaxyConfig.json file where you specify client_id and either client_secret or client_code and place it in the same directory as steam_api[64].dll
  7. Your build is now ready to upload to Devportal

Supported Steam API Versions

Steam SDK Wrapper (Beta) can support only specific versions of the Steam API headers and your game must be built with one of them. Currently, the supported versions are:

  • 1.32 to 1.53

If your game already uses one of the above, no action is necessary. Otherwise, support for other versions of the Steam API headers can be added to Steam SDK Wrapper (Beta) or you may update your current pipeline (your existing build) or set up a new one with a different Steam API version. Whichever you choose, you can find the list of all Steamworks releases here.

Configuration File

In order for Steam SDK Wrapper (Beta) to know the SDK credentials of your game, they must be specified in GalaxyConfig.json (you can obtain them in Devportal). It is a flat JSON file used for configurations which should be distributed along with the game and located in its working directory — usually where the EXE file is. The only required properties are client_id and either client_secret or client_code. The remaining options are read and parsed during SteamAPI_Init.

client_code

Plaintext client_secret can be used for testing purposes, but it is recommended to use client_code instead when releasing. client_code is an encrypted version of client_secret. You can obtain it by accessing SDK credentials in the games menu.

Minimal Config Example

{
    "client_id": "XXXXXXXXXXXXXXXXX",
    "client_code": "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
}

Available Options

Option Type Default Description
client_id string required ID of the client
client_secret string "" Secret of the client (required unless client_code is specified)
client_code string "" Code of the client (required unless client_secret is specified)
config_file_path string "." Path to the folder containing GOG GALAXY configuration files
storage_path string "" Path to the folder for storing internal SDK data
host string "" Local IP address this peer would bind to
port number 0 Local port used for communication with servers and peers
auth_on_init bool true SteamAPI_Init will attempt blocking SignInGalaxy
require_online bool false Indicates if sign in with GOG GALAXY backend is required
dlcs array [] Array of DlcInfo struct {steam_id:number, name:string, galaxy_id:number}

Methods Implemented

Note: Unlisted methods are not implemented.

SteamClient Interface

Method Supported Remarks
SetWarningMessageHook Yes Does the same as SteamUtils::SetWarningMessageHook: outputs GOG GALAXY error messages

SteamMatchmaking Interface

Method Supported Remarks
JoinLobby Yes
RequestLobbyList Partially Does not request data for each lobby automatically
GetLobbyByIndex Yes
CreateLobby Yes

SteamRemoteStorage Interface

Method Supported Remarks
FileExists Yes
FileRead Yes
FileWrite Partially No checking for reaching file limits or invalid paths/filenames
GetFileCount Yes
GetFileSize Yes
GetQuota No

SteamUser Interface

Method Supported Remarks
BLoggedOn Yes
RequestEncryptedAppTicket Yes

SteamUserStats Interface

Method Supported Remarks
RequestCurrentStats Yes
GetStat (integer) Yes
GetStat (float) Yes
SetStat (integer) Yes
SetStat (float) Yes
UpdateAvgRateStat Yes
GetAchievement Yes
SetAchievement Yes
ClearAchievements Yes
GetAchievementAndUnlockTime Yes
StoreStats Yes
GetAchievementDisplayAttribute Yes
FindOrCreateLeaderboard Yes
FindLeaderboard Yes
GetLeaderboardName Yes
GetLeaderboardEntryCount Yes
GetLeaderboardSortMethod Yes
GetLeaderboardDisplayType Yes
DownloadLeaderboardEntries Yes Cannot be called with k_ELeaderboardDataRequestUsers, as in Steam
DownloadLeaderboardEntriesForUsers Yes
GetDownloadedLeaderboardEntry Yes
UploadLeaderboardScore Yes

SteamUtils Interface

Method Supported Remarks
SetWarningMessageHook Yes Does the same as SteamClient::SetWarningMessageHook: outputs GOG GALAXY error messages

SteamFriends Interface

Method Supported Remarks
GetClanActivityCounts No Always sets arguments to 0
GetFriendsGroupName Simplified Assumes everybody is in a single group, always returns Friends.
GetFriendPersonaNameHistory Simplified Assumes no history exists
GetPlayerNickname Simplified Assumes no nickname is set
GetFriendsGroupCount Simplified Groups are not supported; assumes everybody is in a single group
GetFriendCount Partially In the friend flags passed to this method, only k_EFriendFlagImmediate is supported
GetFriendByIndex Partially In the friend flags passed to this method, only k_EFriendFlagImmediate is supported
HasFriend Partially In the friend flags passed to this method, only k_EFriendFlagImmediate is supported
SetRichPresence Partially No custom keys, only status, metadata and connect allowed
GetFriendRichPresence Partially No custom keys, only status, metadata and connect allowed
GetFriendSteamLevel No Returns 0
GetClanCount Simplified Returns 0
GetFriendsGroupMembersCount Partially Returns friend count regardless of a group
GetFriendsGroupMembersList Partially Returns friend list regardless of a group
GetFriendRelationship Partially Returns only k_EFriendRelationshipFriend or k_EFriendRelationshipNone
GetPersonaState Partially Returns only k_EPersonaStateOnline or k_EPersonaStateOffline
GetFriendPersonaState Partially Returns only k_EPersonaStateOnline or k_EPersonaStateOffline
GetUserRestrictions Partially Returns only k_nUserRestrictionNone or k_nUserRestrictionUnknown
GetPersonaName Yes
SetPersonaName No
GetFriendPersonaName Yes
GetFriendGamePlayed No
GetFriendsGroupIDByIndex No
GetClanByIndex No
GetClanName No
GetClanTag No
DownloadClanActivityCounts No
SetInGameVoiceSpeaking No
SetPlayedWith No
GetSmallFriendAvatar Yes
GetMediumFriendAvatar Yes
GetLargeFriendAvatar Yes
RequestUserInformation Yes
RequestClanOfficerList No
GetClanOwner No
GetClanOfficerCount No
GetClanOfficerByIndex No
ClearRichPresence Yes
GetFriendRichPresenceKeyCount Yes
GetFriendRichPresenceKeyByIndex Yes
RequestFriendRichPresence Yes
GetCoplayFriendCount No
GetCoplayFriend No
GetFriendCoplayTime No
GetFriendCoplayGame No
GetFollowerCount No
IsFollowing No
EnumerateFollowingList No
IsClanPublic No
IsClanOfficialGameGroup No

Flat API

From version 1.32 the flat API functions shipped with Steamworks are supported with some exceptions:

Method
DestructISteamHTMLSurface
RequestPublisherOwnedAppData
GetPublisherOwnedAppData
Set_SteamAPI_CPostAPIResultInProcess
Remove_SteamAPI_CPostAPIResultInProcess
RunFrame
Set_SteamAPI_CCheckCallbackRegisteredInProcess
SetXboxPairwiseID
GetXboxPairwiseID
SetPSNID
GetPSNID
SetStadiaID
GetStadiaID
ShowModalGamepadTextInput
GetConfigValueInfo
IterateGenericEditableConfigValues
ResetIdentity
SetIPv4Addr
GetFakeIPType
GetIPv4
IsFakeIP

Also SteamTV and SteamVR interfaces are not supported

Bindings to other programming languages

As of 1.32 flat API is supported so projects like Steamworks.NET or Facepunch.Steamworks should work without and additional tinkering. Same goes with other projects that utilizes steam_api.dll's calls to flat API.

CSteamworks is not currently supported.

Back to top