Generate a dictionary of CallbackType's and the actual typeof the callback struct

This commit is contained in:
Garry Newman 2020-02-27 09:21:38 +00:00
parent 600c7dbcc4
commit 93e21a5f79
2 changed files with 226 additions and 3 deletions

View File

@ -6,7 +6,7 @@
namespace Steamworks
{
enum CallbackType
public enum CallbackType
{
SteamServersConnected = 101,
SteamServerConnectFailure = 102,
@ -214,4 +214,215 @@ enum CallbackType
SteamRemotePlaySessionConnected = 5701,
SteamRemotePlaySessionDisconnected = 5702,
}
internal static partial class CallbackTypeFactory
{
internal static System.Collections.Generic.Dictionary<CallbackType, System.Type> All = new System.Collections.Generic.Dictionary<CallbackType, System.Type>
{
{ CallbackType.SteamServersConnected, typeof( SteamServersConnected_t )},
{ CallbackType.SteamServerConnectFailure, typeof( SteamServerConnectFailure_t )},
{ CallbackType.SteamServersDisconnected, typeof( SteamServersDisconnected_t )},
{ CallbackType.ClientGameServerDeny, typeof( ClientGameServerDeny_t )},
{ CallbackType.GSPolicyResponse, typeof( GSPolicyResponse_t )},
{ CallbackType.IPCFailure, typeof( IPCFailure_t )},
{ CallbackType.LicensesUpdated, typeof( LicensesUpdated_t )},
{ CallbackType.ValidateAuthTicketResponse, typeof( ValidateAuthTicketResponse_t )},
{ CallbackType.MicroTxnAuthorizationResponse, typeof( MicroTxnAuthorizationResponse_t )},
{ CallbackType.EncryptedAppTicketResponse, typeof( EncryptedAppTicketResponse_t )},
{ CallbackType.GetAuthSessionTicketResponse, typeof( GetAuthSessionTicketResponse_t )},
{ CallbackType.GameWebCallback, typeof( GameWebCallback_t )},
{ CallbackType.StoreAuthURLResponse, typeof( StoreAuthURLResponse_t )},
{ CallbackType.MarketEligibilityResponse, typeof( MarketEligibilityResponse_t )},
{ CallbackType.DurationControl, typeof( DurationControl_t )},
{ CallbackType.GSClientApprove, typeof( GSClientApprove_t )},
{ CallbackType.GSClientDeny, typeof( GSClientDeny_t )},
{ CallbackType.GSClientKick, typeof( GSClientKick_t )},
{ CallbackType.GSClientAchievementStatus, typeof( GSClientAchievementStatus_t )},
{ CallbackType.GSGameplayStats, typeof( GSGameplayStats_t )},
{ CallbackType.GSClientGroupStatus, typeof( GSClientGroupStatus_t )},
{ CallbackType.GSReputation, typeof( GSReputation_t )},
{ CallbackType.AssociateWithClanResult, typeof( AssociateWithClanResult_t )},
{ CallbackType.ComputeNewPlayerCompatibilityResult, typeof( ComputeNewPlayerCompatibilityResult_t )},
{ CallbackType.PersonaStateChange, typeof( PersonaStateChange_t )},
{ CallbackType.GameOverlayActivated, typeof( GameOverlayActivated_t )},
{ CallbackType.GameServerChangeRequested, typeof( GameServerChangeRequested_t )},
{ CallbackType.GameLobbyJoinRequested, typeof( GameLobbyJoinRequested_t )},
{ CallbackType.AvatarImageLoaded, typeof( AvatarImageLoaded_t )},
{ CallbackType.ClanOfficerListResponse, typeof( ClanOfficerListResponse_t )},
{ CallbackType.FriendRichPresenceUpdate, typeof( FriendRichPresenceUpdate_t )},
{ CallbackType.GameRichPresenceJoinRequested, typeof( GameRichPresenceJoinRequested_t )},
{ CallbackType.GameConnectedClanChatMsg, typeof( GameConnectedClanChatMsg_t )},
{ CallbackType.GameConnectedChatJoin, typeof( GameConnectedChatJoin_t )},
{ CallbackType.GameConnectedChatLeave, typeof( GameConnectedChatLeave_t )},
{ CallbackType.DownloadClanActivityCountsResult, typeof( DownloadClanActivityCountsResult_t )},
{ CallbackType.JoinClanChatRoomCompletionResult, typeof( JoinClanChatRoomCompletionResult_t )},
{ CallbackType.GameConnectedFriendChatMsg, typeof( GameConnectedFriendChatMsg_t )},
{ CallbackType.FriendsGetFollowerCount, typeof( FriendsGetFollowerCount_t )},
{ CallbackType.FriendsIsFollowing, typeof( FriendsIsFollowing_t )},
{ CallbackType.FriendsEnumerateFollowingList, typeof( FriendsEnumerateFollowingList_t )},
{ CallbackType.SetPersonaNameResponse, typeof( SetPersonaNameResponse_t )},
{ CallbackType.UnreadChatMessagesChanged, typeof( UnreadChatMessagesChanged_t )},
{ CallbackType.FavoritesListChanged, typeof( FavoritesListChanged_t )},
{ CallbackType.LobbyInvite, typeof( LobbyInvite_t )},
{ CallbackType.LobbyEnter, typeof( LobbyEnter_t )},
{ CallbackType.LobbyDataUpdate, typeof( LobbyDataUpdate_t )},
{ CallbackType.LobbyChatUpdate, typeof( LobbyChatUpdate_t )},
{ CallbackType.LobbyChatMsg, typeof( LobbyChatMsg_t )},
{ CallbackType.LobbyGameCreated, typeof( LobbyGameCreated_t )},
{ CallbackType.LobbyMatchList, typeof( LobbyMatchList_t )},
{ CallbackType.LobbyKicked, typeof( LobbyKicked_t )},
{ CallbackType.LobbyCreated, typeof( LobbyCreated_t )},
{ CallbackType.PSNGameBootInviteResult, typeof( PSNGameBootInviteResult_t )},
{ CallbackType.FavoritesListAccountsUpdated, typeof( FavoritesListAccountsUpdated_t )},
{ CallbackType.IPCountry, typeof( IPCountry_t )},
{ CallbackType.LowBatteryPower, typeof( LowBatteryPower_t )},
{ CallbackType.SteamAPICallCompleted, typeof( SteamAPICallCompleted_t )},
{ CallbackType.SteamShutdown, typeof( SteamShutdown_t )},
{ CallbackType.CheckFileSignature, typeof( CheckFileSignature_t )},
{ CallbackType.GamepadTextInputDismissed, typeof( GamepadTextInputDismissed_t )},
{ CallbackType.DlcInstalled, typeof( DlcInstalled_t )},
{ CallbackType.RegisterActivationCodeResponse, typeof( RegisterActivationCodeResponse_t )},
{ CallbackType.NewUrlLaunchParameters, typeof( NewUrlLaunchParameters_t )},
{ CallbackType.AppProofOfPurchaseKeyResponse, typeof( AppProofOfPurchaseKeyResponse_t )},
{ CallbackType.FileDetailsResult, typeof( FileDetailsResult_t )},
{ CallbackType.UserStatsReceived, typeof( UserStatsReceived_t )},
{ CallbackType.UserStatsStored, typeof( UserStatsStored_t )},
{ CallbackType.UserAchievementStored, typeof( UserAchievementStored_t )},
{ CallbackType.LeaderboardFindResult, typeof( LeaderboardFindResult_t )},
{ CallbackType.LeaderboardScoresDownloaded, typeof( LeaderboardScoresDownloaded_t )},
{ CallbackType.LeaderboardScoreUploaded, typeof( LeaderboardScoreUploaded_t )},
{ CallbackType.NumberOfCurrentPlayers, typeof( NumberOfCurrentPlayers_t )},
{ CallbackType.UserStatsUnloaded, typeof( UserStatsUnloaded_t )},
{ CallbackType.GSStatsUnloaded, typeof( GSStatsUnloaded_t )},
{ CallbackType.UserAchievementIconFetched, typeof( UserAchievementIconFetched_t )},
{ CallbackType.GlobalAchievementPercentagesReady, typeof( GlobalAchievementPercentagesReady_t )},
{ CallbackType.LeaderboardUGCSet, typeof( LeaderboardUGCSet_t )},
{ CallbackType.PS3TrophiesInstalled, typeof( PS3TrophiesInstalled_t )},
{ CallbackType.GlobalStatsReceived, typeof( GlobalStatsReceived_t )},
// { CallbackType.SocketStatusCallback, typeof( SocketStatusCallback_t )},
{ CallbackType.P2PSessionRequest, typeof( P2PSessionRequest_t )},
{ CallbackType.P2PSessionConnectFail, typeof( P2PSessionConnectFail_t )},
{ CallbackType.SteamNetConnectionStatusChangedCallback, typeof( SteamNetConnectionStatusChangedCallback_t )},
{ CallbackType.SteamNetAuthenticationStatus, typeof( SteamNetAuthenticationStatus_t )},
{ CallbackType.SteamRelayNetworkStatus, typeof( SteamRelayNetworkStatus_t )},
{ CallbackType.RemoteStorageAppSyncedClient, typeof( RemoteStorageAppSyncedClient_t )},
{ CallbackType.RemoteStorageAppSyncedServer, typeof( RemoteStorageAppSyncedServer_t )},
{ CallbackType.RemoteStorageAppSyncProgress, typeof( RemoteStorageAppSyncProgress_t )},
{ CallbackType.RemoteStorageAppSyncStatusCheck, typeof( RemoteStorageAppSyncStatusCheck_t )},
{ CallbackType.RemoteStorageFileShareResult, typeof( RemoteStorageFileShareResult_t )},
{ CallbackType.RemoteStoragePublishFileResult, typeof( RemoteStoragePublishFileResult_t )},
{ CallbackType.RemoteStorageDeletePublishedFileResult, typeof( RemoteStorageDeletePublishedFileResult_t )},
{ CallbackType.RemoteStorageEnumerateUserPublishedFilesResult, typeof( RemoteStorageEnumerateUserPublishedFilesResult_t )},
{ CallbackType.RemoteStorageSubscribePublishedFileResult, typeof( RemoteStorageSubscribePublishedFileResult_t )},
{ CallbackType.RemoteStorageEnumerateUserSubscribedFilesResult, typeof( RemoteStorageEnumerateUserSubscribedFilesResult_t )},
{ CallbackType.RemoteStorageUnsubscribePublishedFileResult, typeof( RemoteStorageUnsubscribePublishedFileResult_t )},
{ CallbackType.RemoteStorageUpdatePublishedFileResult, typeof( RemoteStorageUpdatePublishedFileResult_t )},
{ CallbackType.RemoteStorageDownloadUGCResult, typeof( RemoteStorageDownloadUGCResult_t )},
{ CallbackType.RemoteStorageGetPublishedFileDetailsResult, typeof( RemoteStorageGetPublishedFileDetailsResult_t )},
{ CallbackType.RemoteStorageEnumerateWorkshopFilesResult, typeof( RemoteStorageEnumerateWorkshopFilesResult_t )},
{ CallbackType.RemoteStorageGetPublishedItemVoteDetailsResult, typeof( RemoteStorageGetPublishedItemVoteDetailsResult_t )},
{ CallbackType.RemoteStoragePublishedFileSubscribed, typeof( RemoteStoragePublishedFileSubscribed_t )},
{ CallbackType.RemoteStoragePublishedFileUnsubscribed, typeof( RemoteStoragePublishedFileUnsubscribed_t )},
{ CallbackType.RemoteStoragePublishedFileDeleted, typeof( RemoteStoragePublishedFileDeleted_t )},
{ CallbackType.RemoteStorageUpdateUserPublishedItemVoteResult, typeof( RemoteStorageUpdateUserPublishedItemVoteResult_t )},
{ CallbackType.RemoteStorageUserVoteDetails, typeof( RemoteStorageUserVoteDetails_t )},
{ CallbackType.RemoteStorageEnumerateUserSharedWorkshopFilesResult, typeof( RemoteStorageEnumerateUserSharedWorkshopFilesResult_t )},
{ CallbackType.RemoteStorageSetUserPublishedFileActionResult, typeof( RemoteStorageSetUserPublishedFileActionResult_t )},
{ CallbackType.RemoteStorageEnumeratePublishedFilesByUserActionResult, typeof( RemoteStorageEnumeratePublishedFilesByUserActionResult_t )},
{ CallbackType.RemoteStoragePublishFileProgress, typeof( RemoteStoragePublishFileProgress_t )},
{ CallbackType.RemoteStoragePublishedFileUpdated, typeof( RemoteStoragePublishedFileUpdated_t )},
{ CallbackType.RemoteStorageFileWriteAsyncComplete, typeof( RemoteStorageFileWriteAsyncComplete_t )},
{ CallbackType.RemoteStorageFileReadAsyncComplete, typeof( RemoteStorageFileReadAsyncComplete_t )},
{ CallbackType.GSStatsReceived, typeof( GSStatsReceived_t )},
{ CallbackType.GSStatsStored, typeof( GSStatsStored_t )},
{ CallbackType.HTTPRequestCompleted, typeof( HTTPRequestCompleted_t )},
{ CallbackType.HTTPRequestHeadersReceived, typeof( HTTPRequestHeadersReceived_t )},
{ CallbackType.HTTPRequestDataReceived, typeof( HTTPRequestDataReceived_t )},
{ CallbackType.ScreenshotReady, typeof( ScreenshotReady_t )},
{ CallbackType.ScreenshotRequested, typeof( ScreenshotRequested_t )},
{ CallbackType.SteamUGCQueryCompleted, typeof( SteamUGCQueryCompleted_t )},
{ CallbackType.SteamUGCRequestUGCDetailsResult, typeof( SteamUGCRequestUGCDetailsResult_t )},
{ CallbackType.CreateItemResult, typeof( CreateItemResult_t )},
{ CallbackType.SubmitItemUpdateResult, typeof( SubmitItemUpdateResult_t )},
{ CallbackType.ItemInstalled, typeof( ItemInstalled_t )},
{ CallbackType.DownloadItemResult, typeof( DownloadItemResult_t )},
{ CallbackType.UserFavoriteItemsListChanged, typeof( UserFavoriteItemsListChanged_t )},
{ CallbackType.SetUserItemVoteResult, typeof( SetUserItemVoteResult_t )},
{ CallbackType.GetUserItemVoteResult, typeof( GetUserItemVoteResult_t )},
{ CallbackType.StartPlaytimeTrackingResult, typeof( StartPlaytimeTrackingResult_t )},
{ CallbackType.StopPlaytimeTrackingResult, typeof( StopPlaytimeTrackingResult_t )},
{ CallbackType.AddUGCDependencyResult, typeof( AddUGCDependencyResult_t )},
{ CallbackType.RemoveUGCDependencyResult, typeof( RemoveUGCDependencyResult_t )},
{ CallbackType.AddAppDependencyResult, typeof( AddAppDependencyResult_t )},
{ CallbackType.RemoveAppDependencyResult, typeof( RemoveAppDependencyResult_t )},
{ CallbackType.GetAppDependenciesResult, typeof( GetAppDependenciesResult_t )},
{ CallbackType.DeleteItemResult, typeof( DeleteItemResult_t )},
{ CallbackType.SteamAppInstalled, typeof( SteamAppInstalled_t )},
{ CallbackType.SteamAppUninstalled, typeof( SteamAppUninstalled_t )},
{ CallbackType.PlaybackStatusHasChanged, typeof( PlaybackStatusHasChanged_t )},
{ CallbackType.VolumeHasChanged, typeof( VolumeHasChanged_t )},
{ CallbackType.MusicPlayerWantsVolume, typeof( MusicPlayerWantsVolume_t )},
{ CallbackType.MusicPlayerSelectsQueueEntry, typeof( MusicPlayerSelectsQueueEntry_t )},
{ CallbackType.MusicPlayerSelectsPlaylistEntry, typeof( MusicPlayerSelectsPlaylistEntry_t )},
{ CallbackType.MusicPlayerRemoteWillActivate, typeof( MusicPlayerRemoteWillActivate_t )},
{ CallbackType.MusicPlayerRemoteWillDeactivate, typeof( MusicPlayerRemoteWillDeactivate_t )},
{ CallbackType.MusicPlayerRemoteToFront, typeof( MusicPlayerRemoteToFront_t )},
{ CallbackType.MusicPlayerWillQuit, typeof( MusicPlayerWillQuit_t )},
{ CallbackType.MusicPlayerWantsPlay, typeof( MusicPlayerWantsPlay_t )},
{ CallbackType.MusicPlayerWantsPause, typeof( MusicPlayerWantsPause_t )},
{ CallbackType.MusicPlayerWantsPlayPrevious, typeof( MusicPlayerWantsPlayPrevious_t )},
{ CallbackType.MusicPlayerWantsPlayNext, typeof( MusicPlayerWantsPlayNext_t )},
{ CallbackType.MusicPlayerWantsShuffled, typeof( MusicPlayerWantsShuffled_t )},
{ CallbackType.MusicPlayerWantsLooped, typeof( MusicPlayerWantsLooped_t )},
{ CallbackType.MusicPlayerWantsPlayingRepeatStatus, typeof( MusicPlayerWantsPlayingRepeatStatus_t )},
{ CallbackType.HTML_BrowserReady, typeof( HTML_BrowserReady_t )},
{ CallbackType.HTML_NeedsPaint, typeof( HTML_NeedsPaint_t )},
{ CallbackType.HTML_StartRequest, typeof( HTML_StartRequest_t )},
{ CallbackType.HTML_CloseBrowser, typeof( HTML_CloseBrowser_t )},
{ CallbackType.HTML_URLChanged, typeof( HTML_URLChanged_t )},
{ CallbackType.HTML_FinishedRequest, typeof( HTML_FinishedRequest_t )},
{ CallbackType.HTML_OpenLinkInNewTab, typeof( HTML_OpenLinkInNewTab_t )},
{ CallbackType.HTML_ChangedTitle, typeof( HTML_ChangedTitle_t )},
{ CallbackType.HTML_SearchResults, typeof( HTML_SearchResults_t )},
{ CallbackType.HTML_CanGoBackAndForward, typeof( HTML_CanGoBackAndForward_t )},
{ CallbackType.HTML_HorizontalScroll, typeof( HTML_HorizontalScroll_t )},
{ CallbackType.HTML_VerticalScroll, typeof( HTML_VerticalScroll_t )},
{ CallbackType.HTML_LinkAtPosition, typeof( HTML_LinkAtPosition_t )},
{ CallbackType.HTML_JSAlert, typeof( HTML_JSAlert_t )},
{ CallbackType.HTML_JSConfirm, typeof( HTML_JSConfirm_t )},
{ CallbackType.HTML_FileOpenDialog, typeof( HTML_FileOpenDialog_t )},
{ CallbackType.HTML_NewWindow, typeof( HTML_NewWindow_t )},
{ CallbackType.HTML_SetCursor, typeof( HTML_SetCursor_t )},
{ CallbackType.HTML_StatusText, typeof( HTML_StatusText_t )},
{ CallbackType.HTML_ShowToolTip, typeof( HTML_ShowToolTip_t )},
{ CallbackType.HTML_UpdateToolTip, typeof( HTML_UpdateToolTip_t )},
{ CallbackType.HTML_HideToolTip, typeof( HTML_HideToolTip_t )},
{ CallbackType.HTML_BrowserRestarted, typeof( HTML_BrowserRestarted_t )},
{ CallbackType.BroadcastUploadStart, typeof( BroadcastUploadStart_t )},
{ CallbackType.BroadcastUploadStop, typeof( BroadcastUploadStop_t )},
{ CallbackType.GetVideoURLResult, typeof( GetVideoURLResult_t )},
{ CallbackType.GetOPFSettingsResult, typeof( GetOPFSettingsResult_t )},
{ CallbackType.SteamInventoryResultReady, typeof( SteamInventoryResultReady_t )},
{ CallbackType.SteamInventoryFullUpdate, typeof( SteamInventoryFullUpdate_t )},
{ CallbackType.SteamInventoryDefinitionUpdate, typeof( SteamInventoryDefinitionUpdate_t )},
{ CallbackType.SteamInventoryEligiblePromoItemDefIDs, typeof( SteamInventoryEligiblePromoItemDefIDs_t )},
{ CallbackType.SteamInventoryStartPurchaseResult, typeof( SteamInventoryStartPurchaseResult_t )},
{ CallbackType.SteamInventoryRequestPricesResult, typeof( SteamInventoryRequestPricesResult_t )},
{ CallbackType.SteamParentalSettingsChanged, typeof( SteamParentalSettingsChanged_t )},
{ CallbackType.SearchForGameProgressCallback, typeof( SearchForGameProgressCallback_t )},
{ CallbackType.SearchForGameResultCallback, typeof( SearchForGameResultCallback_t )},
{ CallbackType.RequestPlayersForGameProgressCallback, typeof( RequestPlayersForGameProgressCallback_t )},
{ CallbackType.RequestPlayersForGameResultCallback, typeof( RequestPlayersForGameResultCallback_t )},
{ CallbackType.RequestPlayersForGameFinalResultCallback, typeof( RequestPlayersForGameFinalResultCallback_t )},
{ CallbackType.SubmitPlayerResultResultCallback, typeof( SubmitPlayerResultResultCallback_t )},
{ CallbackType.EndGameResultCallback, typeof( EndGameResultCallback_t )},
{ CallbackType.JoinPartyCallback, typeof( JoinPartyCallback_t )},
{ CallbackType.CreateBeaconCallback, typeof( CreateBeaconCallback_t )},
{ CallbackType.ReservationNotificationCallback, typeof( ReservationNotificationCallback_t )},
{ CallbackType.ChangeNumOpenSlotsCallback, typeof( ChangeNumOpenSlotsCallback_t )},
{ CallbackType.AvailableBeaconLocationsUpdated, typeof( AvailableBeaconLocationsUpdated_t )},
{ CallbackType.ActiveBeaconsUpdated, typeof( ActiveBeaconsUpdated_t )},
{ CallbackType.SteamRemotePlaySessionConnected, typeof( SteamRemotePlaySessionConnected_t )},
{ CallbackType.SteamRemotePlaySessionDisconnected, typeof( SteamRemotePlaySessionDisconnected_t )},
};
}
}

View File

@ -10,12 +10,24 @@ public partial class CodeWriter
{
void CustomEnums()
{
StartBlock( "enum CallbackType" );
StartBlock( "public enum CallbackType" );
foreach ( var c in def.callback_structs.OrderBy( x => x.CallbackId ) )
{
WriteLine( $"{c.Name.Replace( "_t", "" ) } = {c.CallbackId}," );
}
EndBlock();
StartBlock( "internal static partial class CallbackTypeFactory" );
StartBlock( "internal static System.Collections.Generic.Dictionary<CallbackType, System.Type> All = new System.Collections.Generic.Dictionary<CallbackType, System.Type>" );
foreach ( var c in def.callback_structs.OrderBy( x => x.CallbackId ) )
{
if ( Cleanup.IsDeprecated( c.Name ) )
Write( "// " );
WriteLine( $"{{ CallbackType.{c.Name.Replace( "_t", "" ) }, typeof( {Cleanup.ConvertType(c.Name)} )}}," );
}
EndBlock( ";" );
EndBlock();
}
}
}