Rise
The Vieneo Province
Loading...
Searching...
No Matches
isteamutils.h
Go to the documentation of this file.
1//====== Copyright � 1996-2008, Valve Corporation, All rights reserved. =======
2//
3// Purpose: interface to utility functions in Steam
4//
5//=============================================================================
6
7#ifndef ISTEAMUTILS_H
8#define ISTEAMUTILS_H
9
10#include "steam_api_common.h"
11
12
13// Steam API call failure results
15{
16 k_ESteamAPICallFailureNone = -1, // no failure
17 k_ESteamAPICallFailureSteamGone = 0, // the local Steam process has gone away
18 k_ESteamAPICallFailureNetworkFailure = 1, // the network connection to Steam has been broken, or was already broken
19 // SteamServersDisconnected_t callback will be sent around the same time
20 // SteamServersConnected_t will be sent when the client is able to talk to the Steam servers again
21 k_ESteamAPICallFailureInvalidHandle = 2, // the SteamAPICall_t handle passed in no longer exists
22 k_ESteamAPICallFailureMismatchedCallback = 3,// GetAPICallResult() was called with the wrong callback type for this API call
23};
24
25
26// Input modes for the Big Picture gamepad text entry
32
33
34// Controls number of allowed lines for the Big Picture gamepad text entry
40
42{
43 k_EFloatingGamepadTextInputModeModeSingleLine = 0, // Enter dismisses the keyboard
44 k_EFloatingGamepadTextInputModeModeMultipleLines = 1, // User needs to explictly close the keyboard
45 k_EFloatingGamepadTextInputModeModeEmail = 2, // Keyboard layout is email, enter dismisses the keyboard
46 k_EFloatingGamepadTextInputModeModeNumeric = 3, // Keyboard layout is numeric, enter dismisses the keyboard
47
48};
49
50// The context where text filtering is being done
52{
53 k_ETextFilteringContextUnknown = 0, // Unknown context
54 k_ETextFilteringContextGameContent = 1, // Game content, only legally required filtering is performed
55 k_ETextFilteringContextChat = 2, // Chat from another player
56 k_ETextFilteringContextName = 3, // Character or item name
57};
58
59// Steam device list
67
68// Default game settings profile
84
85//-----------------------------------------------------------------------------
86// Purpose: interface to user independent utility functions
87//-----------------------------------------------------------------------------
89{
90public:
91 // return the number of seconds since the user
94
95 // the universe this client is connecting to
97
98 // Steam server time. Number of seconds since January 1, 1970, GMT (i.e unix time)
100
101 // returns the 2 digit ISO 3166-1-alpha-2 format country code this client is running in (as looked up via an IP-to-location database)
102 // e.g "US" or "UK".
103 virtual const char *GetIPCountry() = 0;
104
105 // returns true if the image exists, and valid sizes were filled out
106 virtual bool GetImageSize( int iImage, uint32 *pnWidth, uint32 *pnHeight ) = 0;
107
108 // returns true if the image exists, and the buffer was successfully filled out
109 // results are returned in RGBA format
110 // the destination buffer size should be 4 * height * width * sizeof(char)
111 virtual bool GetImageRGBA( int iImage, uint8 *pubDest, int nDestBufferSize ) = 0;
112
113 // return the amount of battery power left in the current system in % [0..100], 255 for being on AC power
115
116 // returns the appID of the current process
117 virtual uint32 GetAppID() = 0;
118
119 // Sets the position where the overlay instance for the currently calling game should show notifications.
120 // This position is per-game and if this function is called from outside of a game context it will do nothing.
121 virtual void SetOverlayNotificationPosition( ENotificationPosition eNotificationPosition ) = 0;
122
123 // API asynchronous call results
124 // can be used directly, but more commonly used via the callback dispatch API (see steam_api.h)
125 virtual bool IsAPICallCompleted( SteamAPICall_t hSteamAPICall, bool *pbFailed ) = 0;
127 virtual bool GetAPICallResult( SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed ) = 0;
128
129 // Deprecated. Applications should use SteamAPI_RunCallbacks() instead. Game servers do not need to call this function.
130 STEAM_PRIVATE_API( virtual void RunFrame() = 0; )
131
132 // returns the number of IPC calls made since the last time this function was called
133 // Used for perf debugging so you can understand how many IPC calls your game makes per frame
134 // Every IPC call is at minimum a thread context switch if not a process one so you want to rate
135 // control how often you do them.
136 virtual uint32 GetIPCCallCount() = 0;
137
138 // API warning handling
139 // 'int' is the severity; 0 for msg, 1 for warning
140 // 'const char *' is the text of the message
141 // callbacks will occur directly after the API function is called that generated the warning or message
142 virtual void SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction ) = 0;
143
144 // Returns true if the overlay is running & the user can access it. The overlay process could take a few seconds to
145 // start & hook the game process, so this function will initially return false while the overlay is loading.
146 virtual bool IsOverlayEnabled() = 0;
147
148 // Normally this call is unneeded if your game has a constantly running frame loop that calls the
149 // D3D Present API, or OGL SwapBuffers API every frame.
150 //
151 // However, if you have a game that only refreshes the screen on an event driven basis then that can break
152 // the overlay, as it uses your Present/SwapBuffers calls to drive it's internal frame loop and it may also
153 // need to Present() to the screen any time an even needing a notification happens or when the overlay is
154 // brought up over the game by a user. You can use this API to ask the overlay if it currently need a present
155 // in that case, and then you can check for this periodically (roughly 33hz is desirable) and make sure you
156 // refresh the screen with Present or SwapBuffers to allow the overlay to do it's work.
157 virtual bool BOverlayNeedsPresent() = 0;
158
159 // Asynchronous call to check if an executable file has been signed using the public key set on the signing tab
160 // of the partner site, for example to refuse to load modified executable files.
161 // The result is returned in CheckFileSignature_t.
162 // k_ECheckFileSignatureNoSignaturesFoundForThisApp - This app has not been configured on the signing tab of the partner site to enable this function.
163 // k_ECheckFileSignatureNoSignaturesFoundForThisFile - This file is not listed on the signing tab for the partner site.
164 // k_ECheckFileSignatureFileNotFound - The file does not exist on disk.
165 // k_ECheckFileSignatureInvalidSignature - The file exists, and the signing tab has been set for this file, but the file is either not signed or the signature does not match.
166 // k_ECheckFileSignatureValidSignature - The file is signed and the signature is valid.
168 virtual SteamAPICall_t CheckFileSignature( const char *szFileName ) = 0;
169
170 // Activates the full-screen text input dialog which takes a initial text string and returns the text the user has typed
171 virtual bool ShowGamepadTextInput( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText ) = 0;
172
173 // Returns previously entered text & length
175 virtual bool GetEnteredGamepadTextInput( char *pchText, uint32 cchText ) = 0;
176
177 // returns the language the steam client is running in, you probably want ISteamApps::GetCurrentGameLanguage instead, this is for very special usage cases
178 virtual const char *GetSteamUILanguage() = 0;
179
180 // returns true if Steam itself is running in VR mode
181 virtual bool IsSteamRunningInVR() = 0;
182
183 // Sets the inset of the overlay notification from the corner specified by SetOverlayNotificationPosition.
184 virtual void SetOverlayNotificationInset( int nHorizontalInset, int nVerticalInset ) = 0;
185
186 // Returns true if Steam & the Steam Overlay are running in Big Picture mode, where the user is most likely using
187 // a gamepad to control the device in a living room like setting or at an increased viewing distance from the TV.
188 //
189 // Games must be launched through the Steam client to enable the Big Picture overlay. During development,
190 // a game can be added as a non-steam game to the developers library to test this feature.
191 virtual bool IsSteamInBigPictureMode() = 0;
192
193 // ask SteamUI to create and render its OpenVR dashboard
194 virtual void StartVRDashboard() = 0;
195
196 // Returns true if the HMD content will be streamed via Steam Remote Play
197 virtual bool IsVRHeadsetStreamingEnabled() = 0;
198
199 // Set whether the HMD content will be streamed via Steam Remote Play
200 // If this is set to true, then the scene in the HMD headset will be streamed, and remote input will not be allowed.
201 // If this is set to false, then the application window will be streamed instead, and remote input will be allowed.
202 // The default is true unless "VRHeadsetStreaming" "0" is in the extended appinfo for a game.
203 // (this is useful for games that have asymmetric multiplayer gameplay)
204 virtual void SetVRHeadsetStreamingEnabled( bool bEnabled ) = 0;
205
206 // Returns whether this steam client is a Steam China specific client, vs the global client.
207 virtual bool IsSteamChinaLauncher() = 0;
208
209 // Initializes text filtering, loading dictionaries for the language the game is running in.
210 // unFilterOptions are reserved for future use and should be set to 0
211 // Returns false if filtering is unavailable for the game's language, in which case FilterText() will act as a passthrough.
212 //
213 // Users can customize the text filter behavior in their Steam Account preferences:
214 // https://store.steampowered.com/account/preferences#CommunityContentPreferences
215 virtual bool InitFilterText( uint32 unFilterOptions = 0 ) = 0;
216
217 // Filters the provided input message and places the filtered result into pchOutFilteredText, using legally required filtering and additional filtering based on the context and user settings
218 // eContext is the type of content in the input string
219 // sourceSteamID is the Steam ID that is the source of the input string (e.g. the player with the name, or who said the chat text)
220 // pchInputText is the input string that should be filtered, which can be ASCII or UTF-8
221 // pchOutFilteredText is where the output will be placed, even if no filtering is performed
222 // nByteSizeOutFilteredText is the size (in bytes) of pchOutFilteredText, should be at least strlen(pchInputText)+1
223 // Returns the number of characters (not bytes) filtered
224 virtual int FilterText( ETextFilteringContext eContext, CSteamID sourceSteamID, const char *pchInputMessage, char *pchOutFilteredText, uint32 nByteSizeOutFilteredText ) = 0;
225
226 // Return what we believe your current ipv6 connectivity to "the internet" is on the specified protocol.
227 // This does NOT tell you if the Steam client is currently connected to Steam via ipv6.
229
230 // Opens a floating keyboard over the game content and sends OS keyboard keys directly to the game.
231 // The text field position is specified in pixels relative the origin of the game window and is used to position the floating keyboard in a way that doesn't cover the text field
232 virtual bool ShowFloatingGamepadTextInput( EFloatingGamepadTextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight ) = 0;
233
234 // In game launchers that don't have controller support you can call this to have Steam Input translate the controller input into mouse/kb to navigate the launcher
235 virtual void SetGameLauncherMode( bool bLauncherMode ) = 0;
236
237 // Dismisses the floating keyboard.
239
240 // Dismisses the full-screen text input dialog.
241 virtual bool DismissGamepadTextInput() = 0;
242
243 // Returns if your process is running on a Steam Deck, Machine, Frame or other hardware.
244 //
245 // This method is intended to be used for usage analytics, support, diagnostic and other non-functional decisions. If your process
246 // needs to make a feature or device capability related decision, the Steamworks SDK exposes a set of other methods. Using one of these
247 // alternate methods will enable your game to run correctly on future versions of Steam hardware where this method would return a
248 // hardware type not present in old SDK versions.
249 //
250 // Some alternate methods include:
251 // - ISteamUtils::GetSteamHardwareDefaultConfig()
252 // - ISteamUtils::IsSteamInBigPictureMode()
253 // - ISteamUtils::IsRunningUnderProton()
254 // - ISteamUtils::IsSteamRunningInVR()
255 // - ISteamUtils::GetCurrentBatteryPower()
256 // - ISteamUtils::GetConnectedControllers()
258
259 // Use this method to help choose default game settings (video and other) that you have tuned for specific Steam hardware. It also enables
260 // changing your default game settings on future Steam hardware without needing to recompile your game.
261 //
262 // This method returns an ESteamHardwareDefaultConfig, which has two categories of values:
263 // - Machine specific values: Map each of these values to a setting configuration tuned for that device.
264 // - General values (low, medium, high, max): Map these values to one of your game's user selectable setting presets. If your game has less
265 // than 4 presets, it is expected that multiple values might map to the same preset. For example, a game with 3 presets might map high and
266 // max to the game's 'high' user preset. For games that only have 1 preset and run great on any device, low, medium, high and max might all
267 // be mapped to that single preset.
268 //
269 // By default, this method will return a value corresponding to the device type returned by ISteamUtils::IsRunningOnSteamHardware(), such
270 // as returning k_ESteamHardwareDefaultConfigSteamDeck when running on a Steam Deck. It may also return a configuration value for 3rd party
271 // hardware that has similar performance characteristics to Steam hardware, such as returning k_ESteamHardwareDefaultConfigSteamDeck when
272 // running on a Legion Go S.
273 //
274 // You can also change what value the Steam Client returns per device through the Steamworks Partner Site. This allows you to customize the
275 // default configuration used on future Steam hardware without recompiling your game. For example, if your game runs well on Steam Machine
276 // using your 'high' user preset, but was released before that device became available, you could configure this method to return
277 // k_ESteamHardwareDefaultConfigHigh when run on those devices. Similarly if your game was released before Steam Frame, you could configure
278 // this method to return k_ESteamHardwareDefaultConfigSteamDeck so that when your game is run in 2d mode, it uses your tuned Steam Deck
279 // presets.
280 //
281 // The following example covers a common approach to choosing default settings when running on Steam hardware:
282 // 1. Call GetSteamHardwareDefaultConfig()
283 // 2. If the returned value is for hardware that you have a known configuration for, use a tuned matching configuration
284 // 3. If the returned value is low, medium, high or max, use a matching user preset
285 // 4. If the returned value had no match, fall back to your default setting heuristics
287
288 // Returns true if running under the Proton compatibility layer
289 virtual bool IsRunningUnderProton() = 0;
290};
291
292#define STEAMUTILS_INTERFACE_VERSION "SteamUtils011"
293
294// Global interface accessor
297
298// Global accessor for the gameserver client
301
302// callbacks
303#if defined( VALVE_CALLBACK_PACK_SMALL )
304#pragma pack( push, 4 )
305#elif defined( VALVE_CALLBACK_PACK_LARGE )
306#pragma pack( push, 8 )
307#else
308#error steam_api_common.h should define VALVE_CALLBACK_PACK_xxx
309#endif
310
311//-----------------------------------------------------------------------------
312// Purpose: The country of the user changed
313//-----------------------------------------------------------------------------
315{
317};
318
319
320//-----------------------------------------------------------------------------
321// Purpose: Fired when running on a handheld PC or laptop with less than 10 minutes of battery is left, fires then every minute
322//-----------------------------------------------------------------------------
328
329
330//-----------------------------------------------------------------------------
331// Purpose: called when a SteamAsyncCall_t has completed (or failed)
332//-----------------------------------------------------------------------------
340
341
342//-----------------------------------------------------------------------------
343// called when Steam wants to shutdown
344//-----------------------------------------------------------------------------
349
350//-----------------------------------------------------------------------------
351// results for CheckFileSignature
352//-----------------------------------------------------------------------------
361
362//-----------------------------------------------------------------------------
363// callback for CheckFileSignature
364//-----------------------------------------------------------------------------
370
371
372// k_iSteamUtilsCallbacks + 13 is taken
373
374
375//-----------------------------------------------------------------------------
376// Full Screen gamepad text input has been closed
377//-----------------------------------------------------------------------------
379{
381 bool m_bSubmitted; // true if user entered & accepted text (Call ISteamUtils::GetEnteredGamepadTextInput() for text), false if canceled input
384};
385
386// k_iSteamUtilsCallbacks + 15 through 35 are taken
387
388STEAM_CALLBACK_BEGIN( AppResumingFromSuspend_t, k_iSteamUtilsCallbacks + 36 )
390
391// k_iSteamUtilsCallbacks + 37 is taken
392
393//-----------------------------------------------------------------------------
394// The floating on-screen keyboard has been closed
395//-----------------------------------------------------------------------------
400
401//-----------------------------------------------------------------------------
402// The text filtering dictionary has changed
403//-----------------------------------------------------------------------------
405{
407 int m_eLanguage; // One of ELanguage, or k_LegallyRequiredFiltering
408};
409
410#pragma pack( pop )
411
412#endif // ISTEAMUTILS_H
virtual uint32 GetServerRealTime()=0
virtual bool InitFilterText(uint32 unFilterOptions=0)=0
virtual bool GetImageRGBA(int iImage, uint8 *pubDest, int nDestBufferSize)=0
virtual int FilterText(ETextFilteringContext eContext, CSteamID sourceSteamID, const char *pchInputMessage, char *pchOutFilteredText, uint32 nByteSizeOutFilteredText)=0
virtual uint32 GetSecondsSinceComputerActive()=0
virtual void SetOverlayNotificationPosition(ENotificationPosition eNotificationPosition)=0
virtual SteamAPICall_t CheckFileSignature(const char *szFileName)=0
virtual uint8 GetCurrentBatteryPower()=0
virtual bool ShowFloatingGamepadTextInput(EFloatingGamepadTextInputMode eKeyboardMode, int nTextFieldXPosition, int nTextFieldYPosition, int nTextFieldWidth, int nTextFieldHeight)=0
virtual bool ShowGamepadTextInput(EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, const char *pchDescription, uint32 unCharMax, const char *pchExistingText)=0
virtual bool IsSteamInBigPictureMode()=0
virtual bool DismissGamepadTextInput()=0
virtual void SetOverlayNotificationInset(int nHorizontalInset, int nVerticalInset)=0
virtual uint32 GetIPCCallCount()=0
virtual ESteamAPICallFailure GetAPICallFailureReason(SteamAPICall_t hSteamAPICall)=0
virtual bool BOverlayNeedsPresent()=0
virtual bool GetEnteredGamepadTextInput(char *pchText, uint32 cchText)=0
virtual bool IsOverlayEnabled()=0
virtual bool IsVRHeadsetStreamingEnabled()=0
virtual bool IsSteamRunningInVR()=0
virtual bool IsRunningUnderProton()=0
virtual ESteamHardwareType IsRunningOnSteamHardware()=0
virtual uint32 GetAppID()=0
virtual ESteamHardwareDefaultConfig GetSteamHardwareDefaultConfig()=0
virtual uint32 GetEnteredGamepadTextLength()=0
virtual bool GetImageSize(int iImage, uint32 *pnWidth, uint32 *pnHeight)=0
virtual const char * GetSteamUILanguage()=0
virtual ESteamIPv6ConnectivityState GetIPv6ConnectivityState(ESteamIPv6ConnectivityProtocol eProtocol)=0
virtual bool DismissFloatingGamepadTextInput()=0
virtual bool GetAPICallResult(SteamAPICall_t hSteamAPICall, void *pCallback, int cubCallback, int iCallbackExpected, bool *pbFailed)=0
virtual EUniverse GetConnectedUniverse()=0
virtual void SetWarningMessageHook(SteamAPIWarningMessageHook_t pFunction)=0
virtual bool IsAPICallCompleted(SteamAPICall_t hSteamAPICall, bool *pbFailed)=0
virtual void SetVRHeadsetStreamingEnabled(bool bEnabled)=0
virtual void StartVRDashboard()=0
virtual const char * GetIPCountry()=0
virtual bool IsSteamChinaLauncher()=0
virtual uint32 GetSecondsSinceAppActive()=0
virtual void SetGameLauncherMode(bool bLauncherMode)=0
ESteamHardwareType
Definition isteamutils.h:61
@ k_ESteamHardwareTypeSteamMachine
Definition isteamutils.h:64
@ k_ESteamHardwareTypeNone
Definition isteamutils.h:62
@ k_ESteamHardwareTypeSteamFrame
Definition isteamutils.h:65
@ k_ESteamHardwareTypeSteamDeck
Definition isteamutils.h:63
EGamepadTextInputLineMode
Definition isteamutils.h:36
@ k_EGamepadTextInputLineModeMultipleLines
Definition isteamutils.h:38
@ k_EGamepadTextInputLineModeSingleLine
Definition isteamutils.h:37
#define STEAMUTILS_INTERFACE_VERSION
ISteamUtils * SteamGameServerUtils()
ESteamAPICallFailure
Definition isteamutils.h:15
@ k_ESteamAPICallFailureMismatchedCallback
Definition isteamutils.h:22
@ k_ESteamAPICallFailureNone
Definition isteamutils.h:16
@ k_ESteamAPICallFailureSteamGone
Definition isteamutils.h:17
@ k_ESteamAPICallFailureNetworkFailure
Definition isteamutils.h:18
@ k_ESteamAPICallFailureInvalidHandle
Definition isteamutils.h:21
ECheckFileSignature
@ k_ECheckFileSignatureNoSignaturesFoundForThisFile
@ k_ECheckFileSignatureNoSignaturesFoundForThisApp
@ k_ECheckFileSignatureValidSignature
@ k_ECheckFileSignatureInvalidSignature
@ k_ECheckFileSignatureFileNotFound
EFloatingGamepadTextInputMode
Definition isteamutils.h:42
@ k_EFloatingGamepadTextInputModeModeEmail
Definition isteamutils.h:45
@ k_EFloatingGamepadTextInputModeModeMultipleLines
Definition isteamutils.h:44
@ k_EFloatingGamepadTextInputModeModeSingleLine
Definition isteamutils.h:43
@ k_EFloatingGamepadTextInputModeModeNumeric
Definition isteamutils.h:46
ETextFilteringContext
Definition isteamutils.h:52
@ k_ETextFilteringContextChat
Definition isteamutils.h:55
@ k_ETextFilteringContextGameContent
Definition isteamutils.h:54
@ k_ETextFilteringContextName
Definition isteamutils.h:56
@ k_ETextFilteringContextUnknown
Definition isteamutils.h:53
ESteamHardwareDefaultConfig
Definition isteamutils.h:70
@ k_ESteamHardwareDefaultConfigSteamDeck
Definition isteamutils.h:80
@ k_ESteamHardwareDefaultConfigMax
Definition isteamutils.h:77
@ k_ESteamHardwareDefaultConfigSteamFrame
Definition isteamutils.h:82
@ k_ESteamHardwareDefaultConfigMedium
Definition isteamutils.h:75
@ k_ESteamHardwareDefaultConfigHigh
Definition isteamutils.h:76
@ k_ESteamHardwareDefaultConfigNone
Definition isteamutils.h:71
@ k_ESteamHardwareDefaultConfigLow
Definition isteamutils.h:74
@ k_ESteamHardwareDefaultConfigSteamMachine
Definition isteamutils.h:81
ISteamUtils * SteamUtils()
EGamepadTextInputMode
Definition isteamutils.h:28
@ k_EGamepadTextInputModeNormal
Definition isteamutils.h:29
@ k_EGamepadTextInputModePassword
Definition isteamutils.h:30
const char *typedef uint32(S_CALLTYPE *SteamAPI_CheckCallbackRegistered_t)(int iCallbackNum)
#define STEAM_PRIVATE_API(...)
#define STEAM_CALLBACK_END(nArgs)
#define STEAM_CALL_RESULT(RESULT_TYPE)
S_API void *S_CALLTYPE SteamInternal_FindOrCreateGameServerInterface(HSteamUser hSteamUser, const char *pszVersion)
@ k_iSteamUtilsCallbacks
#define STEAM_CALLBACK_BEGIN(callbackname, callbackid)
S_API void *S_CALLTYPE SteamInternal_FindOrCreateUserInterface(HSteamUser hSteamUser, const char *pszVersion)
#define STEAM_DEFINE_INTERFACE_ACCESSOR(type, name, expr, kind, version)
ESteamIPv6ConnectivityProtocol
ENotificationPosition
ESteamIPv6ConnectivityState
uint32 AppId_t
Definition steamtypes.h:81
uint64 SteamAPICall_t
Definition steamtypes.h:93
unsigned char uint8
Definition steamtypes.h:11
EUniverse
ECheckFileSignature m_eCheckFileSignature
uint8 m_nMinutesBatteryLeft
SteamAPICall_t m_hAsyncCall