Steam SDK

Please note: Valve, the Valve logo, Steam and the Steam logo are trademarks and/or registered trademarks of Valve Corporation. Please have a look at the homepage to read about and download the SDK.

To use this header file, you will additionally need this unit for the initialization.

Code date: 14th April 2021, SDK date: 8th January 2021

As of 1st September 2021 some features of the SDK are not yet included.

 

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
unit SteamAPI;

{$Z4}

interface

//------------------------------------------------------------------------------
// Deklarationen aus originalen SteamAPI-Headern:

const

{$IFDEF Win64}
  STEAM_DLL_FILENAME = 'steam_api64.dll';
{$ENDIF}
{$IFDEF Win32}
  STEAM_DLL_FILENAME = 'steam_api.dll';
{$ENDIF}

  k_cchPublishedDocumentTitleMax = 128 + 1;
  k_cchPublishedDocumentDescriptionMax = 8000;
  k_cchTagListMax = 1024 + 1;
  k_cchFilenameMax = 260;
  k_cchPublishedFileURLMax = 256;

  k_STEAMGAMESERVER_INTERFACE_VERSION: PAnsiChar = 'SteamGameServer012';

  k_iSteamUserCallbacks = 100;
  k_iSteamGameServerCallbacks = 200;
  k_iSteamFriendsCallbacks = 300;
  k_iSteamBillingCallbacks = 400;
  k_iSteamMatchmakingCallbacks = 500;
  k_iSteamContentServerCallbacks = 600;
  k_iSteamUtilsCallbacks = 700;
  k_iClientFriendsCallbacks = 800;
  k_iClientUserCallbacks = 900;
  k_iSteamAppsCallbacks = 1000;
  k_iSteamUserStatsCallbacks = 1100;
  k_iSteamNetworkingCallbacks = 1200;
  k_iClientRemoteStorageCallbacks = 1300;
  k_iClientDepotBuilderCallbacks = 1400;
  k_iSteamGameServerItemsCallbacks = 1500;
  k_iClientUtilsCallbacks = 1600;
  k_iSteamGameCoordinatorCallbacks = 1700;
  k_iSteamGameServerStatsCallbacks = 1800 ;
  k_iSteam2AsyncCallbacks = 1900 ;
  k_iSteamGameStatsCallbacks = 2000 ;
  k_iClientHTTPCallbacks = 2100 ;
  k_iClientScreenshotsCallbacks = 2200 ;
  k_iSteamScreenshotsCallbacks = 2300 ;
  k_iClientAudioCallbacks = 2400 ;
  k_iClientUnifiedMessagesCallbacks = 2500 ;
  k_iSteamStreamLauncherCallbacks = 2600;
  k_iClientControllerCallbacks = 2700 ;
  k_iSteamControllerCallbacks = 2800 ;
  k_iClientParentalSettingsCallbacks = 2900 ;
  k_iClientDeviceAuthCallbacks = 3000 ;
  k_iClientNetworkDeviceManagerCallbacks = 3100 ;
  k_iClientMusicCallbacks = 3200 ;
  k_iClientRemoteClientManagerCallbacks = 3300 ;
  k_iClientUGCCallbacks = 3400 ;
  k_iSteamStreamClientCallbacks = 3500 ;
  k_IClientProductBuilderCallbacks = 3600 ;
  k_iClientShortcutsCallbacks = 3700 ;
  k_iClientRemoteControlManagerCallbacks = 3800 ;
  k_iSteamAppListCallbacks = 3900 ;
  k_iSteamMusicCallbacks = 4000 ;
  k_iSteamMusicRemoteCallbacks = 4100 ;
  k_iClientVRCallbacks = 4200 ;
  k_iClientReservedCallbacks = 4300 ;
  k_iSteamReservedCallbacks = 4400 ;
  k_iSteamHTMLSurfaceCallbacks = 4500;
  k_iClientVideoCallbacks = 4600;
  k_iClientInventoryCallbacks = 4700;


  k_CreateItemResult = k_iClientUGCCallbacks + 3;
  k_SubmitItemUpdateResult = k_iClientUGCCallbacks + 4;
  k_GameOverlayActivated = k_iSteamFriendsCallbacks + 31;
  k_SteamUGCQueryCompleted = k_iClientUGCCallbacks + 1;
  k_EncryptedAppTicketResponse = k_iSteamUserCallbacks + 54;
  k_GetAuthSessionTicketResponse = k_iSteamUserCallbacks + 63;
  k_AddUGCDependencyResult = k_iClientUGCCallbacks + 12;
  k_RemoveUGCDependencyResult = k_iClientUGCCallbacks + 13;
type
  intptr_t = pointer;
  intptr = pointer;
  float = single;

  PUInt32 = ^UInt32;
  PInt32 = ^Int32;

  TSteamFriends = pointer;
  TSteamUGC = pointer;
  TSteamUser = pointer;
  TSteamUserStats = pointer;
  TSteamUtils = pointer;
  TSteamGameServer = pointer;
  TSteamNetworking = pointer;
  TSteamApps = pointer;

  TAppId = UInt32;
  TCSteamID = UInt64;
  PCSteamID = ^TCSteamID;
  PPublishedFileID = ^TPublishedFileID;
  TPublishedFileId = UInt64;
  TSteamAPICall = UInt64;
  TAccountID = UInt32;

	TAuthTicket = UInt32;

  TEResult = (
    k_EResultOK = 1,
    k_EResultFail = 2,
    k_EResultNoConnection = 3,
    k_EResultInvalidPassword = 5,
    k_EResultLoggedInElsewhere = 6,
    k_EResultInvalidProtocolVer = 7,
    k_EResultInvalidParam = 8,
    k_EResultFileNotFound = 9,
    k_EResultBusy = 10,
    k_EResultInvalidState = 11,
    k_EResultInvalidName = 12,
    k_EResultInvalidEmail = 13,
    k_EResultDuplicateName = 14,
    k_EResultAccessDenied = 15,
    k_EResultTimeout = 16,
    k_EResultBanned = 17,
    k_EResultAccountNotFound = 18,
    k_EResultInvalidSteamID = 19,
    k_EResultServiceUnavailable = 20,
    k_EResultNotLoggedOn = 21,
    k_EResultPending = 22,
    k_EResultEncryptionFailure = 23,
    k_EResultInsufficientPrivilege = 24,
    k_EResultLimitExceeded = 25,
    k_EResultRevoked = 26,
    k_EResultExpired = 27,
    k_EResultAlreadyRedeemed = 28,
    k_EResultDuplicateRequest = 29,
    k_EResultAlreadyOwned = 30,
    k_EResultIPNotFound = 31,
    k_EResultPersistFailed = 32,
    k_EResultLockingFailed = 33,
    k_EResultLogonSessionReplaced = 34,
    k_EResultConnectFailed = 35,
    k_EResultHandshakeFailed = 36,
    k_EResultIOFailure = 37,
    k_EResultRemoteDisconnect = 38,
    k_EResultShoppingCartNotFound = 39,
    k_EResultBlocked = 40,
    k_EResultIgnored = 41,
    k_EResultNoMatch = 42,
    k_EResultAccountDisabled = 43,
    k_EResultServiceReadOnly = 44,
    k_EResultAccountNotFeatured = 45,
    k_EResultAdministratorOK = 46,
    k_EResultContentVersion = 47,
    k_EResultTryAnotherCM = 48,
    k_EResultPasswordRequiredToKickSession = 49,
    k_EResultAlreadyLoggedInElsewhere = 50,
    k_EResultSuspended = 51,
    k_EResultCancelled = 52,
    k_EResultDataCorruption = 53,
    k_EResultDiskFull = 54,
    k_EResultRemoteCallFailed = 55,
    k_EResultPasswordUnset = 56,
    k_EResultExternalAccountUnlinked = 57,
    k_EResultPSNTicketInvalid = 58,
    k_EResultExternalAccountAlreadyLinked = 59,
    k_EResultRemoteFileConflict = 60,
    k_EResultIllegalPassword = 61,
    k_EResultSameAsPreviousValue = 62,
    k_EResultAccountLogonDenied = 63,
    k_EResultCannotUseOldPassword = 64,
    k_EResultInvalidLoginAuthCode = 65,
    k_EResultAccountLogonDeniedNoMail = 66,
    k_EResultHardwareNotCapableOfIPT = 67,
    k_EResultIPTInitError = 68,
    k_EResultParentalControlRestricted = 69,
    k_EResultFacebookQueryError = 70,
    k_EResultExpiredLoginAuthCode = 71,
    k_EResultIPLoginRestrictionFailed = 72,
    k_EResultAccountLockedDown = 73,
    k_EResultAccountLogonDeniedVerifiedEmailRequired = 74,
    k_EResultNoMatchingURL = 75,
    k_EResultBadResponse = 76,
    k_EResultRequirePasswordReEntry = 77,
    k_EResultValueOutOfRange = 78,
    k_EResultUnexpectedError = 79,
    k_EResultDisabled = 80,
    k_EResultInvalidCEGSubmission = 81,
    k_EResultRestrictedDevice = 82,
    k_EResultRegionLocked = 83,
    k_EResultRateLimitExceeded = 84,
    k_EResultAccountLoginDeniedNeedTwoFactor = 85,
    k_EResultItemDeleted = 86,
    k_EResultAccountLoginDeniedThrottle = 87,
    k_EResultTwoFactorCodeMismatch = 88,
    k_EResultTwoFactorActivationCodeMismatch = 89,
    k_EResultAccountAssociatedToMultiplePartners = 90,
    k_EResultNotModified = 91);

  PCCallbackInt = ^TCCallbackInt;
  TCCallbackInt = record
    vtable: pointer;
    m_nCallbackFlags: byte;
    m_iCallback: integer;
    delphiclass: TObject;
  end;

  PP2PSessionState_t = ^TP2PSessionState_t;
  TP2PSessionState_t = record
    m_bConnectionActive: UInt8;		// true if we've got an active open connection
    m_bConnecting: UInt8;			// true if we're currently trying to establish a connection
    m_eP2PSessionError: UInt8;		// last error recorded (see enum above)
    m_bUsingRelay: UInt8;			// true if it's going through a relay server (TURN)
    m_nBytesQueuedForSend: Int32;
    m_nPacketsQueuedForSend: Int32;
    m_nRemoteIP: UInt32;				// potential IP:Port of remote host. Could be TURN server.
    m_nRemotePort: UInt16;			// Only exists for compatibility with older authentication api's
  end;

  PSteamParamStringArray_t = ^TSteamParamStringArray_t;
  TSteamParamStringArray_t = record
  	m_ppStrings: PPAnsichar;
  	m_nNumStrings: int32;
  end;

  TUGCUpdateHandle = UInt64;
  TUGCQueryHandle = UInt64;
  TUGCHandle = UInt64;

  TEWorkshopFileType = (
    k_EWorkshopFileTypeFirst = 0,

    k_EWorkshopFileTypeCommunity			  = 0,
    k_EWorkshopFileTypeMicrotransaction		  = 1,
    k_EWorkshopFileTypeCollection			  = 2,
    k_EWorkshopFileTypeArt					  = 3,
    k_EWorkshopFileTypeVideo				  = 4,
    k_EWorkshopFileTypeScreenshot			  = 5,
    k_EWorkshopFileTypeGame					  = 6,
    k_EWorkshopFileTypeSoftware				  = 7,
    k_EWorkshopFileTypeConcept				  = 8,
    k_EWorkshopFileTypeWebGuide				  = 9,
    k_EWorkshopFileTypeIntegratedGuide		  = 10,
    k_EWorkshopFileTypeMerch				  = 11,
    k_EWorkshopFileTypeControllerBinding	  = 12,
    k_EWorkshopFileTypeSteamworksAccessInvite = 13,
    k_EWorkshopFileTypeSteamVideo			  = 14,

    // Update k_EWorkshopFileTypeMax if you add values.
    k_EWorkshopFileTypeMax = 15);

  TEVoiceResult = (
    k_EVoiceResultOK = 0,
    k_EVoiceResultNotInitialized = 1,
    k_EVoiceResultNotRecording = 2,
    k_EVoiceResultNoData = 3,
    k_EVoiceResultBufferTooSmall = 4,
    k_EVoiceResultDataCorrupted = 5,
    k_EVoiceResultRestricted = 6,
    k_EVoiceResultUnsupportedCodec = 7,
    k_EVoiceResultReceiverOutOfDate = 8,
    k_EVoiceResultReceiverDidNotAnswer = 9
  );

  TERemoteStoragePublishedFileVisibility =
  (
    k_ERemoteStoragePublishedFileVisibilityPublic = 0,
    k_ERemoteStoragePublishedFileVisibilityFriendsOnly = 1,
    k_ERemoteStoragePublishedFileVisibilityPrivate = 2,
    k_ERemoteStoragePublishedFileVisibilityNotListet = 3
  );

// Details for a single published file/UGC
  PSteamUGCDetails = ^TSteamUGCDetails;
  TSteamUGCDetails = {packed }record
    m_nPublishedFileId: TPublishedFileId;
    m_eResult: TEResult;												// The result of the operation.
    m_eFileType: TEWorkshopFileType;									// Type of the file
    m_nCreatorAppID: TAppId;										// ID of the app that created this file.
    m_nConsumerAppID: TAppId;										// ID of the app that will consume this file.
    m_rgchTitle: array[0..pred(k_cchPublishedDocumentTitleMax)] of ansichar;				// title of document
    m_rgchDescription: array[0..pred(k_cchPublishedDocumentDescriptionMax)] of ansichar;	// description of document
    m_ulSteamIDOwner: UInt64;										// Steam ID of the user who created this content.
    m_rtimeCreated: UInt32;											// time when the published file was created
    m_rtimeUpdated: UInt32;											// time when the published file was last updated
    m_rtimeAddedToUserList: UInt32;									// time when the user added the published file to their list (not always applicable)
    m_eVisibility: TERemoteStoragePublishedFileVisibility;			// visibility
    m_bBanned: boolean;													// whether the file was banned
    m_bAcceptedForUse: boolean;											// developer has specifically flagged this item as accepted in the Workshop
    m_bTagsTruncated: boolean;											// whether the list of tags was too long to be returned in the provided buffer
    m_rgchTags: array[0..pred(k_cchTagListMax)] of ansichar;								// comma separated list of all tags associated with this file
    // file/url information
    m_hFile: TUGCHandle;											// The handle of the primary file
    m_hPreviewFile: TUGCHandle;										// The handle of the preview file
    m_pchFileName: array[0..pred(k_cchFilenameMax)] of ansichar;							// The cloud filename of the primary file
    m_nFileSize: int32;												// Size of the primary file
    m_nPreviewFileSize: int32;										// Size of the preview file
    m_rgchURL: array[0..pred(k_cchPublishedFileURLMax)] of ansichar;						// URL (for a video or a website)
    // voting information
    m_unVotesUp: uint32;												// number of votes up
    m_unVotesDown: uint32;											// number of votes down
    m_flScore: float;												// calculated score
    m_unNumChildren: uint32;											// if m_eFileType == k_EWorkshopFileTypeCollection, then this number will be the number of children contained within the collection
  end;

  TEUserUGCList = (
    k_EUserUGCList_Published,
    k_EUserUGCList_VotedOn,
    k_EUserUGCList_VotedUp,
    k_EUserUGCList_VotedDown,
    k_EUserUGCList_WillVoteLater,
    k_EUserUGCList_Favorited,
    k_EUserUGCList_Subscribed,
    k_EUserUGCList_UsedOrPlayed,
    k_EUserUGCList_Followed);

  TEUGCQuery = (
    k_EUGCQuery_RankedByVote,
    k_EUGCQuery_RankedByPublicationDate,
    k_EUGCQuery_AcceptedForGameRankedByAcceptanceDate,
    k_EUGCQuery_RankedByTrend,
    k_EUGCQuery_FavoritedByFriendsRankedByPublicationDate,
    k_EUGCQuery_CreatedByFriendsRankedByPublicationDate,
    k_EUGCQuery_RankedByNumTimesReported,
    k_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate,
    k_EUGCQuery_NotYetRated,
    k_EUGCQuery_RankedByTotalVotesAsc,
    k_EUGCQuery_RankedByVotesUp,
    k_EUGCQuery_RankedByTextSearch,
    k_EUGCQuery_RankedByTotalUniqueSubscriptions);

  TEUGCMatchingUGCType = (
    k_EUGCMatchingUGCType_Items				 = 0,		// both mtx items and ready-to-use items
    k_EUGCMatchingUGCType_Items_Mtx			 = 1,
    k_EUGCMatchingUGCType_Items_ReadyToUse	 = 2,
    k_EUGCMatchingUGCType_Collections		 = 3,
    k_EUGCMatchingUGCType_Artwork			 = 4,
    k_EUGCMatchingUGCType_Videos			 = 5,
    k_EUGCMatchingUGCType_Screenshots		 = 6,
    k_EUGCMatchingUGCType_AllGuides			 = 7,		// both web guides and integrated guides
    k_EUGCMatchingUGCType_WebGuides			 = 8,
    k_EUGCMatchingUGCType_IntegratedGuides	 = 9,
    k_EUGCMatchingUGCType_UsableInGame		 = 10,		// ready-to-use items and integrated guides
    k_EUGCMatchingUGCType_ControllerBindings = 11
  );

// Sort order for user published UGC lists (defaults to creation order descending)
  TEUserUGCListSortOrder = (
    k_EUserUGCListSortOrder_CreationOrderDesc,
    k_EUserUGCListSortOrder_CreationOrderAsc,
    k_EUserUGCListSortOrder_TitleAsc,
    k_EUserUGCListSortOrder_LastUpdatedDesc,
    k_EUserUGCListSortOrder_SubscriptionDateDesc,
    k_EUserUGCListSortOrder_VoteScoreDesc,
    k_EUserUGCListSortOrder_ForModeration);

  TESteamServerMode = (
		eServerModeInvalid = 0,	// DO NOT USE
		eServerModeNoAuthentication = 1,	// Don't authenticate user logins and don't list on the server list
		eServerModeAuthentication = 2,	// Authenticate users, list on the server list, don't run VAC on clients that connect
		eServerModeAuthenticationAndSecure = 3	// Authenticate users, list on the server list and VAC protect clients
	);

  TESteamBeginAuthSessionResult = (
		SteamBeginAuthSessionResultOK = 0,	// Ticket is valid for this game and this steamID.
		SteamBeginAuthSessionResultInvalidTicket = 1,	// Ticket is not valid.
		SteamBeginAuthSessionResultDuplicateRequest = 2,	// A ticket has already been submitted for this steamID
		SteamBeginAuthSessionResultInvalidVersion = 3,	// Ticket is from an incompatible interface version
		SteamBeginAuthSessionResultGameMismatch = 4,	// Ticket is not for this game
		SteamBeginAuthSessionResultExpiredTicket = 5	// Ticket has expired
	);

  TEOverlayToStoreFlag = (
  	k_EOverlayToStoreFlag_None = 0,
	  k_EOverlayToStoreFlag_AddToCart = 1,
  	k_EOverlayToStoreFlag_AddToCartAndShow = 2
  );

// SendP2PPacket() send types
// Typically k_EP2PSendUnreliable is what you want for UDP-like packets, k_EP2PSendReliable for TCP-like packets
  TEP2PSend = (
    // Basic UDP send. Packets can't be bigger than 1200 bytes (your typical MTU size). Can be lost, or arrive out of order (rare).
    // The sending API does have some knowledge of the underlying connection, so if there is no NAT-traversal accomplished or
    // there is a recognized adjustment happening on the connection, the packet will be batched until the connection is open again.
    k_EP2PSendUnreliable = 0,

    // As above, but if the underlying p2p connection isn't yet established the packet will just be thrown away. Using this on the first
    // packet sent to a remote host almost guarantees the packet will be dropped.
    // This is only really useful for kinds of data that should never buffer up, i.e. voice payload packets
    k_EP2PSendUnreliableNoDelay = 1,

    // Reliable message send. Can send up to 1MB of data in a single message.
    // Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for efficient sends of large chunks of data.
    k_EP2PSendReliable = 2,

    // As above, but applies the Nagle algorithm to the send - sends will accumulate
    // until the current MTU size (typically ~1200 bytes, but can change) or ~200ms has passed (Nagle algorithm).
    // Useful if you want to send a set of smaller messages but have the coalesced into a single packet
    // Since the reliable stream is all ordered, you can do several small message sends with k_EP2PSendReliableWithBuffering and then
    // do a normal k_EP2PSendReliable to force all the buffered data to be sent.
    k_EP2PSendReliableWithBuffering = 3
  );

//..............................
// Sämtliche Callback-Typen:

  TCreateItemResult = record
	  m_eResult: TEResult;
  	m_nPublishedFileId: TPublishedFileId; // new item got this UGC PublishFileID
    m_bUserNeedsToAcceptWorkshopLegalAgreement: boolean;
  end;

  TSubmitItemUpdateResult = record
	  m_eResult: TEResult;
    m_bUserNeedsToAcceptWorkshopLegalAgreement: boolean;
  end;

  PGameOverlayActivated = ^TGameOverlayActivated;
  TGameOverlayActivated = record
    m_bActive: uint8; // true if it's just been activated, false otherwise
  end;

  PEncryptedAppTicketResponse = ^TEncryptedAppTicketResponse;
  TEncryptedAppTicketResponse = record
    m_eResult: TEResult;
  end;

  TSteamUGCQueryCompleted = record
    m_handle: TUGCQueryHandle;
    m_eResult: TEResult;
    m_unNumResultReturned: uint32;
    m_unTotalMathingResults: uint32;
    m_bCachedData: boolean; // indicates whether this data was retrieved from the local on-disk cache
  end;

  TSteamAddUGCDependencyResult_t = record
	  m_eResult: TEResult;
    m_nPublishedFileId: TPublishedFileId;
    m_nChildPublishedFileId: TPublishedFileId;
  end;

  TSteamRemoveUGCDependencyResult_t = record
	  m_eResult: TEResult;
    m_nPublishedFileId: TPublishedFileId;
    m_nChildPublishedFileId: TPublishedFileId;
  end;

// EOF Deklarationen aus originalen SteamAPI-Headern:
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
// Verknüpfung mit DLL - Steam-Hauptfunktionen:

function _SteamAPI_Init: boolean; cdecl; external STEAM_DLL_FILENAME name 'SteamAPI_Init';
procedure SteamAPI_Shutdown; cdecl; external STEAM_DLL_FILENAME;

function _SteamGameServer_Init(unIP: uint32; usSteamPort: uint16; usGamePort: uint16; usQueryPort: uint16; eServerMode: TESteamServerMode; pchVersionString: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME name 'SteamGameServer_Init';
procedure SteamGameServer_Shutdown; cdecl; external STEAM_DLL_FILENAME;
function _SteamGameServer: TSteamGameServer; cdecl; external STEAM_DLL_FILENAME name 'SteamGameServer';

procedure SteamAPI_RunCallbacks; cdecl; external STEAM_DLL_FILENAME;
procedure SteamAPI_RegisterCallResult(pCallback: PCCallbackInt; hAPICall: TSteamAPICall); cdecl; external STEAM_DLL_FILENAME;
procedure SteamAPI_RegisterCallback(pCallback: PCCallbackInt; iCallback: integer); cdecl; external STEAM_DLL_FILENAME;
procedure SteamAPI_UnregisterCallback(pCallback: PCCallbackInt); cdecl; external STEAM_DLL_FILENAME;

//------------------------------------------------------------------------------
// Verknüpfung mit DLL - Normale Funktionen


function SteamAPI_ISteamUtils_GetAPICallResult(inst: TSteamUtils; hSteamAPICall: TSteamAPICall; pCallback: pointer; cubCallback: integer; iCallbackExpected: integer; var pbFailed: boolean): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUtils_IsAPICallCompleted(inst: TSteamUtils; hSteamAPICall: TSteamAPICall; pbFailed: PBoolean): boolean; cdecl; external STEAM_DLL_FILENAME;

function WaitForAPICallResult(hSteamAPICall: TSteamAPICall; pCallback: pointer; cubCallback: integer; iCallbackExpected: integer): boolean;

function SteamAPI_ISteamUtils_GetAppID(inst: TSteamUtils): cardinal; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUtils_IsSteamRunningInVR(inst: TSteamUtils): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUtils_IsOverlayEnabled(inst: TSteamUtils): boolean; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamApps_GetDLCCount(inst: TSteamApps): integer; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamApps_BGetDLCDataByIndex(inst: TSteamApps; iDLC: integer; var pAppID: TAppID; var pbAvailable: boolean; pchName: PAnsiChar; cchNameBufferSize: integer): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamApps_GetCurrentGameLanguage(inst: TSteamApps): PAnsiChar; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamApps_BIsDlcInstalled(inst: TSteamApps; appID: TAppId): boolean; cdecl; external STEAM_DLL_FILENAME;

procedure SteamAPI_ISteamFriends_ActivateGameOverlay(inst: TSteamFriends; pchDialog: PAnsiChar); cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamFriends_GetPersonaName(inst: TSteamFriends): PAnsiChar; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamFriends_RequestUserInformation(inst: TSteamFriends; steamIDUser: TCSteamID; bRequireNameOnly: boolean): boolean; cdecl; external STEAM_DLL_FILENAME;
procedure SteamAPI_ISteamFriends_SetInGameVoiceSpeaking(inst: TSteamFriends; steamIDUser: TCSteamID; bSpeaking: boolean); cdecl; external STEAM_DLL_FILENAME;
procedure SteamAPI_ISteamFriends_ActivateGameOverlayToStore(inst: TSteamFriends; apID: TAppID; eFlag: TEOverlayToStoreFlag); cdecl; external STEAM_DLL_FILENAME;
procedure SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage(inst: TSteamFriends; pchURL: PAnsiChar); cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUser_GetSteamID(inst: TSteamUser): UInt64; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUser_GetAuthSessionTicket(inst: TSteamUser; pTicket:PByte; cbMaxTicket:Integer; Var pcbTicket:Cardinal):TAuthTicket; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUser_BLoggedOn(inst: TSteamUser): boolean; cdecl; external STEAM_DLL_FILENAME;

procedure SteamAPI_ISteamUser_CancelAuthTicket(inst: TSteamUser; hAuthTicket: TAuthTicket); cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUser_RequestEncryptedAppTicket(inst: TSteamUser; pDataToInclude: pointer; cbDataToInclude: integer): TSteamAPICall; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUser_GetEncryptedAppTicket(inst: TSteamUser; pTicket: pointer; cbMaxTicket: integer; pcbTicket: PCardinal): boolean; cdecl; external STEAM_DLL_FILENAME;

procedure SteamAPI_ISteamUser_StartVoiceRecording(inst: TSteamUser); cdecl; external STEAM_DLL_FILENAME;
procedure SteamAPI_ISteamUser_StopVoiceRecording(inst: TSteamUser); cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUser_GetVoice(inst: TSteamUser; bWantCompressed: boolean; pDestBuffer: pointer; cbDestBufferSize: UInt32; nBytesWritten: PUInt32; bWantUncompressed: boolean; pUncompressedDestBuffer: pointer; cbUncompressedDestBufferSize: UInt32; nUncompressBytesWritten: PUInt32; nUncompressedVoiceDesiredSampleRate: UInt32): TEVoiceResult; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUser_GetAvailableVoice(inst: TSteamUser; pcbCompressed: PUInt32; pcbUncompressed: PUint32; nUncompressedVoiceDesiredSampleRate: uint32): TEVoiceResult; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUser_DecompressVoice(inst: TSteamUser; const pCompressed: pointer; cbCompressed: UInt32; pDestBuffer: pointer; cbDestBufferSize: UInt32; nBytesWritten: PUInt32; nDesiredSampleRate: UInt32): TEVoiceResult; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUser_BeginAuthSession(inst: TSteamUser; pAuthTicket: PByte; cbAuthTicket:Integer; steamID: TCSteamID): TESteamBeginAuthSessionResult; cdecl; external STEAM_DLL_FILENAME;
procedure SteamAPI_ISteamUser_EndAuthSession(inst: TSteamUser; steamID: TCSteamID); cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUserStats_RequestCurrentStats(inst: TSteamUserStats): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUserStats_SetStat(inst: TSteamUserStats; pchName: PAnsiChar; nData: Int32): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUserStats_GetStat(inst: TSteamUserStats; pchName: PAnsiChar; pData: PInt32): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUserStats_SetAchievement(inst: TSteamUserStats; pchName: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUserStats_StoreStats(inst: TSteamUserStats): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUserStats_ResetAllStats(inst: TSteamUserStats; bAchievementsToo: boolean): boolean; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_CreateItem(inst: TSteamUGC; nConsumerAppId: TAppId; eFileType: TEWorkshopFileType): TSteamAPICall; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_StartItemUpdate(inst: TSteamUGC; nConsumerAppId: TAppId; nPublishedFileID: TPublishedFileId): TUGCUpdateHandle; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SetItemTitle(inst: TSteamUGC; handle: TUGCUpdateHandle; pchTitle: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SetItemDescription(inst: TSteamUGC; handle: TUGCUpdateHandle; pchDescription: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SetItemUpdateLanguage(inst: TSteamUGC; handle: TUGCUpdateHandle; pchLanguage: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SetLanguage(inst: TSteamUGC; handle: TUGCUpdateHandle; pchLanguage: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SetItemMetadata(inst: TSteamUGC; handle: TUGCUpdateHandle; pchMetaData: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SetItemVisibility(inst: TSteamUGC; handle: TUGCUpdateHandle; eVisibility: TERemoteStoragePublishedFileVisibility): boolean; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_SetItemTags(inst: TSteamUGC; handle: TUGCUpdateHandle; pTags: PSteamParamStringArray_t): boolean; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_SetItemContent(inst: TSteamUGC; handle: TUGCUpdateHandle; pszContentFolder: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SetItemPreview(inst: TSteamUGC; handle: TUGCUpdateHandle; pszPreviewFile: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_AddItemKeyValueTag(inst: TSteamUGC; handle: TUGCUpdateHandle; pchKey, pchValue: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_RemoveItemKeyValueTags(inst: TSteamUGC; handle: TUGCUpdateHandle; pchKey: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_SubmitItemUpdate(inst: TSteamUGC; handle: TUGCUpdateHandle; pchChangeNote: PAnsiChar): TSteamAPICall; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_CreateQueryUserUGCRequest(inst: TSteamUGC; unAccountID: TAccountID; eListType: TEUserUGCList; eMatchingUGCType: TEUGCMatchingUGCType; eSortOrder: TEUserUGCListSortOrder; nCreatorAppID: TAppId; nConsumerAppID: TAppId; unPage: UInt32): TUGCQueryHandle; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_CreateQueryAllUGCRequest(inst: TSteamUGC; eQueryType: TEUGCQuery; eMatchingUGCTypeFileType: TEUGCMatchingUGCType; nCreatorAppID: TAppId; nConsumerAppID: TAppId; unPage: UInt32): TUGCQueryHandle; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest(inst: TSteamUGC; pvecPublishedFileID: PPublishedFileId; unNumPublishedFileIDs: UInt32): TUGCQueryHandle; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_SendQueryUGCRequest(inst: TSteamUGC; handle: TUGCQueryHandle): TSteamAPICall; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_GetQueryUGCResult(inst: TSteamUGC; handle: TUGCQueryHandle; index: UInt32; pDetails: PSteamUGCDetails): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_GetQueryUGCMetadata(inst: TSteamUGC; handle: TUGCQueryHandle; index: UInt32; pchMetadata: PAnsiChar; cchMetadatasize: UInt32): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_GetQueryUGCNumKeyValueTags(inst: TSteamUGC; handle: TUGCQueryHandle; index: UInt32): UInt32; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_GetQueryUGCKeyValueTag(inst: TSteamUGC; handle: TUGCQueryHandle; index: UInt32; keyValueTagIndex: UInt32; pchKey: PAnsiChar; cchKeySize: UInt32; pchValue: PAnsiChar; cchValueSize: UInt32): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_GetQueryUGCChildren(inst: TSteamUGC; handle: TUGCQueryHandle; index: UInt32; pvecPublishedFileID: PPublishedFileID; cMaxEntries: UInt32): boolean; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_SetReturnOnlyIDs(inst: TSteamUGC; handle: TUGCQueryHandle; bReturnOnlyIDs: boolean): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SetReturnKeyValueTags(inst: TSteamUGC; handle: TUGCQueryHandle; bReturnKeyValueTags: boolean): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SetReturnMetadata(inst: TSteamUGC; handle: TUGCQueryHandle; bReturnMetadata: boolean): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SetReturnChildren(inst: TSteamUGC; handle: TUGCQueryHandle; bReturnChildren: boolean): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SetSearchText(inst: TSteamUGC; handle: TUGCQueryHandle; pSearchText: PAnsiChar): boolean; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_GetItemState(inst: TSteamUGC; nPublishedFileID: TPublishedFileId): UInt32; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_DownloadItem(inst: TSteamUGC; nPublishedFileID: TPublishedFileId; bHighPriority: boolean): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_SubscribeItem(inst: TSteamUGC; nPublishedFileID: TPublishedFileId): boolean; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_ReleaseQueryUGCRequest(inst: TSteamUGC; handle: TUGCQueryHandle): boolean; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_StartPlaytimeTracking(inst: TSteamUGC; pvecPublishedFileID: PPublishedFileID; unNumPublishedFileIDs: UInt32): TSteamAPICall; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_StopPlaytimeTracking(inst: TSteamUGC; pvecPublishedFileID: PPublishedFileID; unNumPublishedFileIDs: UInt32): TSteamAPICall; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_StopPlaytimeTrackingForAllItems(inst: TSteamUGC): TSteamAPICall; cdecl; external STEAM_DLL_FILENAME;
//function SteamAPI_ISteamUGC_SetReturnPlaytimeStats(inst: TSteamUGC): TSteamAPICall; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_AddDependency(inst: TSteamUGC; nParentPublishedFileID: TPublishedFileId; nChildPublishedFileID: TPublishedFileId): TSteamAPICall; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_RemoveDependency(inst: TSteamUGC; nParentPublishedFileID: TPublishedFileId; nChildPublishedFileID: TPublishedFileId): TSteamAPICall; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_GetAppDependencies(inst: TSteamUGC; nPublishedFileID: TPublishedFileId): TSteamAPICall; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamUGC_GetNumSubscribedItems(instancePtr: TSteamUGC): UInt32; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_GetSubscribedItems(instancePtr: TSteamUGC; pvecPublishedFileID: PPublishedFileID; cMaxEntries: UInt32): UInt32; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamUGC_GetItemInstallInfo(instancePtr: TSteamUGC; nPublishedFileID: TPublishedFileID; punSizeOnDisk: PUInt64; pchFolder: PAnsiChar; cchFolderSize: UInt32; punTimeStamp: PUInt32): boolean; cdecl; external STEAM_DLL_FILENAME;

function SteamAPI_ISteamNetworking_SendP2PPacket(inst: TSteamNetworking; steamIDRemote: TCSteamID; const pubData: pointer; cubData: UInt32; eP2PSendType: TEP2PSend; nChannel: integer): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamNetworking_AcceptP2PSessionWithUser(inst: TSteamNetworking; steamIDRemote: TCSteamID): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamNetworking_IsP2PPacketAvailable(inst: TSteamNetworking; pcubMsgSize: PUint32; nChannel: integer): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamNetworking_ReadP2PPacket(inst: TSteamNetworking; pubDest: pointer; cubDest: UInt32; pcubMsgSize: PUInt32; psteamIDRemote: PCSteamID; nChannel: integer): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamNetworking_GetP2PSessionState(inst: TSteamNetworking; steamIDRemote: TCSteamID; pConnectionState: PP2PSessionState_t): boolean; cdecl; external STEAM_DLL_FILENAME;
function SteamAPI_ISteamNetworking_CloseP2PSessionWithUser(inst: TSteamNetworking; steamIDRemote: TCSteamID): boolean; cdecl; external STEAM_DLL_FILENAME;

//------------------------------------------------------------------------------
// Verknüpfung mit DLL - Server-Funktionen

function SteamAPI_ISteamGameServer_BeginAuthSession(inst: TSteamGameServer; pAuthTicket: PByte; cbAuthTicket:Integer; steamID: TCSteamID): TESteamBeginAuthSessionResult; cdecl; external STEAM_DLL_FILENAME;
procedure SteamAPI_ISteamGameServer_EndAuthSession(inst: TSteamGameServer; steamID: TCSteamID); cdecl; external STEAM_DLL_FILENAME;

procedure SteamAPI_ISteamGameServer_LogOn(inst: TSteamGameServer; pszToken: PChar); cdecl; external STEAM_DLL_FILENAME;
procedure SteamAPI_ISteamGameServer_LogOnAnonymous(inst: TSteamGameServer); cdecl; external STEAM_DLL_FILENAME;

// EOF Verknüpfung mit DLL:
//------------------------------------------------------------------------------

function SteamAPI_Init: boolean;
function SteamGameServer_Init(unIP: uint32; usSteamPort: uint16; usGamePort: uint16; usQueryPort: uint16; eServerMode: TESteamServerMode; pchVersionString: PAnsiChar): boolean;


function SteamGetResultString(res: TEResult): string;
function SteamGetUGCItemName(id: TPublishedFileID): string;


var
  SteamFriends: TSteamFriends;
  SteamUGC: TSteamUGC;
  SteamUser: TSteamUser;
  SteamUserStats: TSteamUserStats;
  SteamUtils: TSteamUtils;
  SteamApps: TSteamApps;
  SteamGameServer: TSteamGameServer;
  SteamNetworking: TSteamNetworking;

implementation

uses System.SysUtils, System.Classes, Windows, SteamAPINewInit;

const
  STD_TIMEOUT = 5000;

function SteamAPI_Init: boolean;
begin
  result := _SteamAPI_Init;
  SteamContext.Init;
end;

function SteamGameServer_Init(unIP: uint32; usSteamPort: uint16; usGamePort: uint16; usQueryPort: uint16; eServerMode: TESteamServerMode; pchVersionString: PAnsiChar): boolean;
begin
  result := _SteamGameServer_Init(unIP, usSteamPort, usGamePort, usQueryPort, eServerMode, pchVersionString);
  SteamGameServer := _SteamGameServer;
end;

function WaitForAPICallResult(hSteamAPICall: TSteamAPICall; pCallback: pointer; cubCallback: integer; iCallbackExpected: integer): boolean;
var
  start: cardinal;
  errors: boolean;
begin
  result := true;
  start := GetTickCount;
  while not SteamAPI_ISteamUtils_IsAPICallCompleted(SteamUtils, hSteamAPICall, @errors) do
  begin
    if GetTickCount > start + STD_TIMEOUT then
    begin
      result := false;
      break;
    end;
    Sleep(10);
  end;

  result := result and (not errors);
  if result then
  begin
    result := SteamAPI_ISteamUtils_GetAPICallResult(SteamUtils, hSteamAPICall, pCallback, cubCallback, iCallbackExpected, errors) and not errors;
  end;
end;

function SteamGetResultString(res: TEResult): string;
begin
  case ord(res) of
    1: result := 'OK';
    2: result := 'Fail (2)';
    3: result := 'No connection';
    5: result := 'Invalid password';
    6: result := 'Logged In Elsewhere';
    7: result := 'Invalid Protocol Version';
    8: result := 'Invalid Param';
    9: result := 'File Not Found';
    10: result := 'Busy';
    11: result := 'Invalid State';
    12: result := 'Invalid Name';
    13: result := 'Invalid Email';
    14: result := 'Duplicate Name';
    15: result := 'Access Denied';
    16: result := 'Timeout';
    17: result := 'Banned';
    18: result := 'Account Not Found';
    19: result := 'Invalid Steam ID';
    20: result := 'Service Unavailable';
    21: result := 'Not Logged On';
    22: result := 'Pending';
    23: result := 'EncryptionFailure';
    24: result := 'Insufficient Privilege';
    25: result := 'Limit Exceeded';
    26: result := 'Revoked';
    27: result := 'Expired';
    28: result := 'Already Redeemed';
    29: result := 'Duplicate Request';
    30: result := 'Already Owned';
    31: result := 'IP Not Found';
    32: result := 'Persist Failed';
    33: result := 'LockingFailed';
    34: result := 'LogonSessionReplaced';
    35: result := 'ConnectFailed';
    36: result := 'HandshakeFailed';
    37: result := 'IOFailure';
    38: result := 'RemoteDisconnect';
    39: result := 'ShoppingCartNotFound';
    40: result := 'Blocked';
    41: result := 'Ignored';
    42: result := 'NoMatch';
    43: result := 'AccountDisabled';
    44: result := 'ServiceReadOnly';
    45: result := 'AccountNotFeatured';
    46: result := 'AdministratorOK';
    47: result := 'ContentVersion';
    48: result := 'TryAnotherCM';
    49: result := 'PasswordRequiredToKickSession';
    50: result := 'AlreadyLoggedInElsewhere';
    51: result := 'Suspended';
    52: result := 'Cancelled';
    53: result := 'DataCorruption';
    54: result := 'DiskFull';
    55: result := 'RemoteCallFailed';
    56: result := 'PasswordUnset';
    57: result := 'ExternalAccountUnlinked';
    58: result := 'PSNTicketInvalid';
    59: result := 'ExternalAccountAlreadyLinked';
    60: result := 'RemoteFileConflict';
    61: result := 'IllegalPassword';
    62: result := 'SameAsPreviousValue';
    63: result := 'AccountLogonDenied';
    64: result := 'CannotUseOldPassword';
    65: result := 'InvalidLoginAuthCode';
    66: result := 'AccountLogonDeniedNoMail';
    67: result := 'HardwareNotCapableOfIPT';
    68: result := 'IPTInitError';
    69: result := 'ParentalControlRestricted';
    70: result := 'FacebookQueryError';
    71: result := 'ExpiredLoginAuthCode';
    72: result := 'IPLoginRestrictionFailed';
    73: result := 'AccountLockedDown';
    74: result := 'AccountLogonDeniedVerifiedEmailRequired';
    75: result := 'NoMatchingURL';
    76: result := 'BadResponse';
    77: result := 'RequirePasswordReEntry';
    78: result := 'ValueOutOfRange';
    79: result := 'UnexpectedError';
    80: result := 'Disabled';
    81: result := 'InvalidCEGSubmission';
    82: result := 'RestrictedDevice';
    83: result := 'RegionLocked';
    84: result := 'RateLimitExceeded';
    85: result := 'AccountLoginDeniedNeedTwoFactor';
    86: result := 'ItemDeleted';
    87: result := 'AccountLoginDeniedThrottle';
    88: result := 'TwoFactorCodeMismatch';
    89: result := 'TwoFactorActivationCodeMismatch';
    90: result := 'AccountAssociatedToMultiplePartners';
    91: result := 'NotModified';
  else
    result := inttostr(ord(res));
  end;
end;




function SteamGetUGCItemName(id: TPublishedFileID): string;
var
  queryhandle: TUGCQueryHandle;
  callid: TSteamAPICall;
  callbackresult: TSteamUGCQueryCompleted;
  details: TSteamUGCDetails;
begin
  result := '<id=' + inttostr(id) + '>';

  queryhandle := SteamAPI_ISteamUGC_CreateQueryUGCDetailsRequest(SteamUGC,
    @id,
    1);

  try
    callid := SteamAPI_ISteamUGC_SendQueryUGCRequest(SteamUGC,queryhandle);

    if not WaitForAPICallResult(callid, @callbackresult, sizeof(callbackresult), k_SteamUGCQueryCompleted) then
    begin
      exit;
    end;

    if not SteamAPI_ISteamUGC_GetQueryUGCResult(SteamUGC, queryhandle, 0, @details) then
      exit;

    result := String(details.m_rgchTitle);
  finally
    SteamAPI_ISteamUGC_ReleaseQueryUGCRequest(SteamUGC, queryhandle);
  end;
end;




end.