GetHSteamUser() public static méthode

public static GetHSteamUser ( ) : HSteamUser
Résultat HSteamUser
        public virtual void InitClient()
        {
            var user = SteamAPI.GetHSteamUser();

            Self = SteamInternal.FindOrCreateUserInterface(user, InterfaceName);

            if (Self == IntPtr.Zero)
            {
                throw new System.Exception($"Couldn't find interface {InterfaceName}");
            }

            VTable = Marshal.ReadIntPtr(Self, 0);
            if (Self == IntPtr.Zero)
            {
                throw new System.Exception($"Invalid VTable for {InterfaceName}");
            }

            InitInternals();
        }
 public void InitClient()
 {
     this.Self = SteamInternal.CreateInterface(this.InterfaceName);
     if (this.Self == IntPtr.Zero)
     {
         HSteamUser hSteamUser = SteamAPI.GetHSteamUser();
         this.Self = SteamInternal.FindOrCreateUserInterface(hSteamUser, this.InterfaceName);
     }
     if (this.Self == IntPtr.Zero)
     {
         throw new Exception(String.Concat("Couldn't find interface ", this.InterfaceName));
     }
     this.VTable = Marshal.ReadIntPtr(this.Self, 0);
     if (this.Self == IntPtr.Zero)
     {
         throw new Exception(String.Concat("Invalid VTable for ", this.InterfaceName));
     }
     this.InitInternals();
     SteamClient.WatchInterface(this);
 }
        public void InitClient()
        {
            //
            // There's an issue for us using FindOrCreateUserInterface on Rust.
            // We have a different appid for our staging branch, but we use Rust's
            // appid so we can still test with the live data/setup. The issue is
            // if we run the staging branch and get interfaces using FindOrCreate
            // then some callbacks don't work. I assume this is because these interfaces
            // have already been initialized using the old appid pipe, but since I
            // can't see inside Steam this is just a gut feeling. Either way using
            // CreateInterface doesn't seem to have caused any fires, so we'll just use that.
            //

            //
            // var pipe = SteamAPI.GetHSteamPipe();
            //

            Self = SteamInternal.CreateInterface(InterfaceName);

            if (Self == IntPtr.Zero)
            {
                var user = SteamAPI.GetHSteamUser();
                Self = SteamInternal.FindOrCreateUserInterface(user, InterfaceName);
            }

            if (Self == IntPtr.Zero)
            {
                throw new System.Exception($"Couldn't find interface {InterfaceName}");
            }

            VTable = Marshal.ReadIntPtr(Self, 0);
            if (Self == IntPtr.Zero)
            {
                throw new System.Exception($"Invalid VTable for {InterfaceName}");
            }

            InitInternals();
            SteamClient.WatchInterface(this);
        }
Exemple #4
0
        public SteamInterface(bool server = false)
        {
            //
            // If teh client isn't initialized but the server is,
            // try to open this interface in server mode
            //
            if (!SteamClient.IsValid && SteamServer.IsValid)
            {
                server = true;
            }

            var hUser = server ?
                        SteamGameServer.GetHSteamUser() :
                        SteamAPI.GetHSteamUser();

            if (hUser == 0)
            {
                throw new System.Exception("Steamworks is uninitialized");
            }

            Self = server ?
                   SteamInternal.FindOrCreateGameServerInterface(hUser, InterfaceName) :
                   SteamInternal.FindOrCreateUserInterface(hUser, InterfaceName);

            if (Self == IntPtr.Zero)
            {
                throw new System.Exception($"Couldn't find interface {InterfaceName} (server:{server})");
            }


            VTable = Marshal.ReadIntPtr(Self, 0);
            if (Self == IntPtr.Zero)
            {
                throw new System.Exception($"Invalid VTable for {InterfaceName}");
            }

            InitInternals();
        }
Exemple #5
0
        internal static bool Init()
        {
            HSteamUser hSteamUser = SteamAPI.GetHSteamUser();
            HSteamPipe hSteamPipe = SteamAPI.GetHSteamPipe();

            if (hSteamPipe == (HSteamPipe)0)
            {
                return(false);
            }

            using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMCLIENT_INTERFACE_VERSION)) {
                m_pSteamClient = NativeMethods.SteamInternal_CreateInterface(pchVersionString);
            }

            if (m_pSteamClient == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamUser = SteamClient.GetISteamUser(hSteamUser, hSteamPipe, Constants.STEAMUSER_INTERFACE_VERSION);
            if (m_pSteamUser == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamFriends = SteamClient.GetISteamFriends(hSteamUser, hSteamPipe, Constants.STEAMFRIENDS_INTERFACE_VERSION);
            if (m_pSteamFriends == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamUtils = SteamClient.GetISteamUtils(hSteamPipe, Constants.STEAMUTILS_INTERFACE_VERSION);
            if (m_pSteamUtils == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamMatchmaking = SteamClient.GetISteamMatchmaking(hSteamUser, hSteamPipe, Constants.STEAMMATCHMAKING_INTERFACE_VERSION);
            if (m_pSteamMatchmaking == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamMatchmakingServers = SteamClient.GetISteamMatchmakingServers(hSteamUser, hSteamPipe, Constants.STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION);
            if (m_pSteamMatchmakingServers == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamUserStats = SteamClient.GetISteamUserStats(hSteamUser, hSteamPipe, Constants.STEAMUSERSTATS_INTERFACE_VERSION);
            if (m_pSteamUserStats == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamApps = SteamClient.GetISteamApps(hSteamUser, hSteamPipe, Constants.STEAMAPPS_INTERFACE_VERSION);
            if (m_pSteamApps == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamNetworking = SteamClient.GetISteamNetworking(hSteamUser, hSteamPipe, Constants.STEAMNETWORKING_INTERFACE_VERSION);
            if (m_pSteamNetworking == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamRemoteStorage = SteamClient.GetISteamRemoteStorage(hSteamUser, hSteamPipe, Constants.STEAMREMOTESTORAGE_INTERFACE_VERSION);
            if (m_pSteamRemoteStorage == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamScreenshots = SteamClient.GetISteamScreenshots(hSteamUser, hSteamPipe, Constants.STEAMSCREENSHOTS_INTERFACE_VERSION);
            if (m_pSteamScreenshots == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamGameSearch = SteamClient.GetISteamGameSearch(hSteamUser, hSteamPipe, Constants.STEAMGAMESEARCH_INTERFACE_VERSION);
            if (m_pSteamGameSearch == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamHTTP = SteamClient.GetISteamHTTP(hSteamUser, hSteamPipe, Constants.STEAMHTTP_INTERFACE_VERSION);
            if (m_pSteamHTTP == IntPtr.Zero)
            {
                return(false);
            }

            m_pController = SteamClient.GetISteamController(hSteamUser, hSteamPipe, Constants.STEAMCONTROLLER_INTERFACE_VERSION);
            if (m_pController == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamUGC = SteamClient.GetISteamUGC(hSteamUser, hSteamPipe, Constants.STEAMUGC_INTERFACE_VERSION);
            if (m_pSteamUGC == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamAppList = SteamClient.GetISteamAppList(hSteamUser, hSteamPipe, Constants.STEAMAPPLIST_INTERFACE_VERSION);
            if (m_pSteamAppList == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamMusic = SteamClient.GetISteamMusic(hSteamUser, hSteamPipe, Constants.STEAMMUSIC_INTERFACE_VERSION);
            if (m_pSteamMusic == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamMusicRemote = SteamClient.GetISteamMusicRemote(hSteamUser, hSteamPipe, Constants.STEAMMUSICREMOTE_INTERFACE_VERSION);
            if (m_pSteamMusicRemote == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamHTMLSurface = SteamClient.GetISteamHTMLSurface(hSteamUser, hSteamPipe, Constants.STEAMHTMLSURFACE_INTERFACE_VERSION);
            if (m_pSteamHTMLSurface == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamInventory = SteamClient.GetISteamInventory(hSteamUser, hSteamPipe, Constants.STEAMINVENTORY_INTERFACE_VERSION);
            if (m_pSteamInventory == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamVideo = SteamClient.GetISteamVideo(hSteamUser, hSteamPipe, Constants.STEAMVIDEO_INTERFACE_VERSION);
            if (m_pSteamVideo == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamParentalSettings = SteamClient.GetISteamParentalSettings(hSteamUser, hSteamPipe, Constants.STEAMPARENTALSETTINGS_INTERFACE_VERSION);
            if (m_pSteamParentalSettings == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamInput = SteamClient.GetISteamInput(hSteamUser, hSteamPipe, Constants.STEAMINPUT_INTERFACE_VERSION);
            if (m_pSteamInput == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamParties = SteamClient.GetISteamParties(hSteamUser, hSteamPipe, Constants.STEAMPARTIES_INTERFACE_VERSION);
            if (m_pSteamParties == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamRemotePlay = SteamClient.GetISteamRemotePlay(hSteamUser, hSteamPipe, Constants.STEAMREMOTEPLAY_INTERFACE_VERSION);
            if (m_pSteamRemotePlay == IntPtr.Zero)
            {
                return(false);
            }

            return(true);
        }
        internal static FailureReason Init()
        {
            HSteamUser hSteamUser    = SteamAPI.GetHSteamUser();
            HSteamPipe hSteamPipe    = SteamAPI.GetHSteamPipe();
            var        failureReason = FailureReason.None;

            if (hSteamPipe == (HSteamPipe)0)
            {
                failureReason |= FailureReason.hSteamPipe;
            }

            using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMCLIENT_INTERFACE_VERSION)) {
                m_pSteamClient = NativeMethods.SteamInternal_CreateInterface(pchVersionString);
            }

            if (m_pSteamClient == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamClient;
            }

            m_pSteamUser = SteamClient.GetISteamUser(hSteamUser, hSteamPipe, Constants.STEAMUSER_INTERFACE_VERSION);
            if (m_pSteamUser == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamUser;
            }

            m_pSteamFriends = SteamClient.GetISteamFriends(hSteamUser, hSteamPipe, Constants.STEAMFRIENDS_INTERFACE_VERSION);
            if (m_pSteamFriends == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamFriends;
            }

            m_pSteamUtils = SteamClient.GetISteamUtils(hSteamPipe, Constants.STEAMUTILS_INTERFACE_VERSION);
            if (m_pSteamUtils == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamUtils;
            }

            m_pSteamMatchmaking = SteamClient.GetISteamMatchmaking(hSteamUser, hSteamPipe, Constants.STEAMMATCHMAKING_INTERFACE_VERSION);
            if (m_pSteamMatchmaking == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamMatchmaking;
            }

            m_pSteamMatchmakingServers = SteamClient.GetISteamMatchmakingServers(hSteamUser, hSteamPipe, Constants.STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION);
            if (m_pSteamMatchmakingServers == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamMatchmakingServers;
            }

            m_pSteamUserStats = SteamClient.GetISteamUserStats(hSteamUser, hSteamPipe, Constants.STEAMUSERSTATS_INTERFACE_VERSION);
            if (m_pSteamUserStats == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamUserStats;
            }

            m_pSteamApps = SteamClient.GetISteamApps(hSteamUser, hSteamPipe, Constants.STEAMAPPS_INTERFACE_VERSION);
            if (m_pSteamApps == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamApps;
            }

            m_pSteamNetworking = SteamClient.GetISteamNetworking(hSteamUser, hSteamPipe, Constants.STEAMNETWORKING_INTERFACE_VERSION);
            if (m_pSteamNetworking == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamNetworking;
            }

            m_pSteamRemoteStorage = SteamClient.GetISteamRemoteStorage(hSteamUser, hSteamPipe, Constants.STEAMREMOTESTORAGE_INTERFACE_VERSION);
            if (m_pSteamRemoteStorage == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamRemoteStorage;
            }

            m_pSteamScreenshots = SteamClient.GetISteamScreenshots(hSteamUser, hSteamPipe, Constants.STEAMSCREENSHOTS_INTERFACE_VERSION);
            if (m_pSteamScreenshots == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamScreenshots;
            }

            m_pSteamGameSearch = SteamClient.GetISteamGameSearch(hSteamUser, hSteamPipe, Constants.STEAMGAMESEARCH_INTERFACE_VERSION);
            if (m_pSteamGameSearch == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamGameSearch;
            }

            m_pSteamHTTP = SteamClient.GetISteamHTTP(hSteamUser, hSteamPipe, Constants.STEAMHTTP_INTERFACE_VERSION);
            if (m_pSteamHTTP == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamHTTP;
            }

            m_pSteamUGC = SteamClient.GetISteamUGC(hSteamUser, hSteamPipe, Constants.STEAMUGC_INTERFACE_VERSION);
            if (m_pSteamUGC == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamUGC;
            }

            m_pSteamAppList = SteamClient.GetISteamAppList(hSteamUser, hSteamPipe, Constants.STEAMAPPLIST_INTERFACE_VERSION);
            if (m_pSteamAppList == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamAppList;
            }

            m_pSteamMusic = SteamClient.GetISteamMusic(hSteamUser, hSteamPipe, Constants.STEAMMUSIC_INTERFACE_VERSION);
            if (m_pSteamMusic == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamMusic;
            }

            m_pSteamMusicRemote = SteamClient.GetISteamMusicRemote(hSteamUser, hSteamPipe, Constants.STEAMMUSICREMOTE_INTERFACE_VERSION);
            if (m_pSteamMusicRemote == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamMusicRemote;
            }

            m_pSteamHTMLSurface = SteamClient.GetISteamHTMLSurface(hSteamUser, hSteamPipe, Constants.STEAMHTMLSURFACE_INTERFACE_VERSION);
            if (m_pSteamHTMLSurface == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamHTMLSurface;
            }

            m_pSteamInventory = SteamClient.GetISteamInventory(hSteamUser, hSteamPipe, Constants.STEAMINVENTORY_INTERFACE_VERSION);
            if (m_pSteamInventory == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamInventory;
            }

            m_pSteamVideo = SteamClient.GetISteamVideo(hSteamUser, hSteamPipe, Constants.STEAMVIDEO_INTERFACE_VERSION);
            if (m_pSteamVideo == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamVideo;
            }

            m_pSteamParentalSettings = SteamClient.GetISteamParentalSettings(hSteamUser, hSteamPipe, Constants.STEAMPARENTALSETTINGS_INTERFACE_VERSION);
            if (m_pSteamParentalSettings == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamParentalSettings;
            }

            m_pSteamInput = SteamClient.GetISteamInput(hSteamUser, hSteamPipe, Constants.STEAMINPUT_INTERFACE_VERSION);
            if (m_pSteamInput == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamInput;
            }

            m_pSteamParties = SteamClient.GetISteamParties(hSteamUser, hSteamPipe, Constants.STEAMPARTIES_INTERFACE_VERSION);
            if (m_pSteamParties == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamParties;
            }

            m_pSteamRemotePlay = SteamClient.GetISteamRemotePlay(hSteamUser, hSteamPipe, Constants.STEAMREMOTEPLAY_INTERFACE_VERSION);
            if (m_pSteamRemotePlay == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamRemotePlay;
            }

            using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMNETWORKINGUTILS_INTERFACE_VERSION))
            {
                m_pSteamNetworkingUtils =
                    NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pchVersionString) != IntPtr.Zero ?
                    NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pchVersionString) :
                    NativeMethods.SteamInternal_FindOrCreateGameServerInterface(hSteamUser, pchVersionString);
            }

            if (m_pSteamNetworkingUtils == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamNetworkingUtils;
            }

            using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMNETWORKINGSOCKETS_INTERFACE_VERSION))
            {
                m_pSteamNetworkingSockets =
                    NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pchVersionString);
            }

            if (m_pSteamNetworkingSockets == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamNetworkingSockets;
            }

            using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMNETWORKINGMESSAGES_INTERFACE_VERSION))
            {
                m_pSteamNetworkingMessages =
                    NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pchVersionString);
            }

            if (m_pSteamNetworkingMessages == IntPtr.Zero)
            {
                failureReason |= FailureReason.m_pSteamNetworkingMessages;
            }

            return(failureReason);
        }
Exemple #7
0
        internal static bool Init()
        {
            HSteamUser hSteamUser = SteamAPI.GetHSteamUser();
            HSteamPipe hSteamPipe = SteamAPI.GetHSteamPipe();

            if (hSteamPipe == (HSteamPipe)0)
            {
                return(false);
            }
            using (InteropHelp.UTF8StringHandle ver = new InteropHelp.UTF8StringHandle("SteamClient020"))
            {
                m_pSteamClient = NativeMethods.SteamInternal_CreateInterface(ver);
            }
            if (m_pSteamClient == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamUser = SteamClient.GetISteamUser(hSteamUser, hSteamPipe, "SteamUser021");
            if (m_pSteamUser == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamFriends = SteamClient.GetISteamFriends(hSteamUser, hSteamPipe, "SteamFriends017");
            if (m_pSteamFriends == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamUtils = SteamClient.GetISteamUtils(hSteamPipe, "SteamUtils009");
            if (m_pSteamUtils == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamMatchmaking = SteamClient.GetISteamMatchmaking(hSteamUser, hSteamPipe, "SteamMatchMaking009");
            if (m_pSteamMatchmaking == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamMatchmakingServers = SteamClient.GetISteamMatchmakingServers(hSteamUser, hSteamPipe, "SteamMatchMakingServers002");
            if (m_pSteamMatchmakingServers == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamUserStats = SteamClient.GetISteamUserStats(hSteamUser, hSteamPipe, "STEAMUSERSTATS_INTERFACE_VERSION012");
            if (m_pSteamUserStats == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamApps = SteamClient.GetISteamApps(hSteamUser, hSteamPipe, "STEAMAPPS_INTERFACE_VERSION008");
            if (m_pSteamApps == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamNetworking = SteamClient.GetISteamNetworking(hSteamUser, hSteamPipe, "SteamNetworking006");
            if (m_pSteamNetworking == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamRemoteStorage = SteamClient.GetISteamRemoteStorage(hSteamUser, hSteamPipe, "STEAMREMOTESTORAGE_INTERFACE_VERSION014");
            if (m_pSteamRemoteStorage == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamScreenshots = SteamClient.GetISteamScreenshots(hSteamUser, hSteamPipe, "STEAMSCREENSHOTS_INTERFACE_VERSION003");
            if (m_pSteamScreenshots == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamGameSearch = SteamClient.GetISteamGameSearch(hSteamUser, hSteamPipe, "SteamMatchGameSearch001");
            if (m_pSteamGameSearch == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamHTTP = SteamClient.GetISteamHTTP(hSteamUser, hSteamPipe, "STEAMHTTP_INTERFACE_VERSION003");
            if (m_pSteamHTTP == IntPtr.Zero)
            {
                return(false);
            }
            m_pController = SteamClient.GetISteamController(hSteamUser, hSteamPipe, "SteamController007");
            if (m_pController == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamUGC = SteamClient.GetISteamUGC(hSteamUser, hSteamPipe, "STEAMUGC_INTERFACE_VERSION014");
            if (m_pSteamUGC == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamAppList = SteamClient.GetISteamAppList(hSteamUser, hSteamPipe, "STEAMAPPLIST_INTERFACE_VERSION001");
            if (m_pSteamAppList == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamMusic = SteamClient.GetISteamMusic(hSteamUser, hSteamPipe, "STEAMMUSIC_INTERFACE_VERSION001");
            if (m_pSteamMusic == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamMusicRemote = SteamClient.GetISteamMusicRemote(hSteamUser, hSteamPipe, "STEAMMUSICREMOTE_INTERFACE_VERSION001");
            if (m_pSteamMusicRemote == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamHTMLSurface = SteamClient.GetISteamHTMLSurface(hSteamUser, hSteamPipe, "STEAMHTMLSURFACE_INTERFACE_VERSION_005");
            if (m_pSteamHTMLSurface == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamInventory = SteamClient.GetISteamInventory(hSteamUser, hSteamPipe, "STEAMINVENTORY_INTERFACE_V003");
            if (m_pSteamInventory == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamVideo = SteamClient.GetISteamVideo(hSteamUser, hSteamPipe, "STEAMVIDEO_INTERFACE_V002");
            if (m_pSteamVideo == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamParentalSettings = SteamClient.GetISteamParentalSettings(hSteamUser, hSteamPipe, "STEAMPARENTALSETTINGS_INTERFACE_VERSION001");
            if (m_pSteamParentalSettings == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamInput = SteamClient.GetISteamInput(hSteamUser, hSteamPipe, "SteamInput001");
            if (m_pSteamInput == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamParties = SteamClient.GetISteamParties(hSteamUser, hSteamPipe, "SteamParties002");
            if (m_pSteamParties == IntPtr.Zero)
            {
                return(false);
            }
            m_pSteamRemotePlay = SteamClient.GetISteamRemotePlay(hSteamUser, hSteamPipe, "STEAMREMOTEPLAY_INTERFACE_VERSION001");
            if (m_pSteamRemotePlay == IntPtr.Zero)
            {
                return(false);
            }
            using (InteropHelp.UTF8StringHandle pszVersion = new InteropHelp.UTF8StringHandle("SteamNetworkingUtils003"))
            {
                m_pSteamNetworkingUtils = ((NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pszVersion) != IntPtr.Zero) ? NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pszVersion) : NativeMethods.SteamInternal_FindOrCreateGameServerInterface(hSteamUser, pszVersion));
            }
            if (m_pSteamNetworkingUtils == IntPtr.Zero)
            {
                return(false);
            }
            using (InteropHelp.UTF8StringHandle pszVersion2 = new InteropHelp.UTF8StringHandle("SteamNetworkingSockets008"))
            {
                m_pSteamNetworkingSockets = NativeMethods.SteamInternal_FindOrCreateUserInterface(hSteamUser, pszVersion2);
            }
            if (m_pSteamNetworkingSockets == IntPtr.Zero)
            {
                return(false);
            }
            return(true);
        }
Exemple #8
0
        internal static bool Init()
        {
            HSteamUser hSteamUser = SteamAPI.GetHSteamUser();
            HSteamPipe hSteamPipe = SteamAPI.GetHSteamPipe();

            if (hSteamPipe == (HSteamPipe)0)
            {
                return(false);
            }

            using (var pchVersionString = new InteropHelp.UTF8StringHandle(Constants.STEAMCLIENT_INTERFACE_VERSION)) {
                m_pSteamClient = NativeMethods.SteamInternal_CreateInterface(pchVersionString);
            }

            if (m_pSteamClient == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamUser = SteamClient.GetISteamUser(hSteamUser, hSteamPipe, Constants.STEAMUSER_INTERFACE_VERSION);
            if (m_pSteamUser == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamFriends = SteamClient.GetISteamFriends(hSteamUser, hSteamPipe, Constants.STEAMFRIENDS_INTERFACE_VERSION);
            if (m_pSteamFriends == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamUtils = SteamClient.GetISteamUtils(hSteamPipe, Constants.STEAMUTILS_INTERFACE_VERSION);
            if (m_pSteamUtils == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamMatchmaking = SteamClient.GetISteamMatchmaking(hSteamUser, hSteamPipe, Constants.STEAMMATCHMAKING_INTERFACE_VERSION);
            if (m_pSteamMatchmaking == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamMatchmakingServers = SteamClient.GetISteamMatchmakingServers(hSteamUser, hSteamPipe, Constants.STEAMMATCHMAKINGSERVERS_INTERFACE_VERSION);
            if (m_pSteamMatchmakingServers == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamUserStats = SteamClient.GetISteamUserStats(hSteamUser, hSteamPipe, Constants.STEAMUSERSTATS_INTERFACE_VERSION);
            if (m_pSteamUserStats == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamApps = SteamClient.GetISteamApps(hSteamUser, hSteamPipe, Constants.STEAMAPPS_INTERFACE_VERSION);
            if (m_pSteamApps == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamNetworking = SteamClient.GetISteamNetworking(hSteamUser, hSteamPipe, Constants.STEAMNETWORKING_INTERFACE_VERSION);
            if (m_pSteamNetworking == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamRemoteStorage = SteamClient.GetISteamRemoteStorage(hSteamUser, hSteamPipe, Constants.STEAMREMOTESTORAGE_INTERFACE_VERSION);
            if (m_pSteamRemoteStorage == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamScreenshots = SteamClient.GetISteamScreenshots(hSteamUser, hSteamPipe, Constants.STEAMSCREENSHOTS_INTERFACE_VERSION);
            if (m_pSteamScreenshots == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamHTTP = SteamClient.GetISteamHTTP(hSteamUser, hSteamPipe, Constants.STEAMHTTP_INTERFACE_VERSION);
            if (m_pSteamHTTP == IntPtr.Zero)
            {
                return(false);
            }

            // Unified Messages are deprecated in latest Steamworks.  Additionally, this API fails to initialize on Mac platforms.
            // If this problem should become evident on other platforms, it may be wise to remove this entire section of code for
            // those platforms (if not all) as well.
            #if !UNITY_EDITOR_OSX && !UNITY_STANDALONE_OSX
            m_pSteamUnifiedMessages = SteamClient.GetISteamUnifiedMessages(hSteamUser, hSteamPipe, Constants.STEAMUNIFIEDMESSAGES_INTERFACE_VERSION);
            if (m_pSteamUnifiedMessages == IntPtr.Zero)
            {
                return(false);
            }
            #endif

            m_pController = SteamClient.GetISteamController(hSteamUser, hSteamPipe, Constants.STEAMCONTROLLER_INTERFACE_VERSION);
            if (m_pController == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamUGC = SteamClient.GetISteamUGC(hSteamUser, hSteamPipe, Constants.STEAMUGC_INTERFACE_VERSION);
            if (m_pSteamUGC == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamAppList = SteamClient.GetISteamAppList(hSteamUser, hSteamPipe, Constants.STEAMAPPLIST_INTERFACE_VERSION);
            if (m_pSteamAppList == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamMusic = SteamClient.GetISteamMusic(hSteamUser, hSteamPipe, Constants.STEAMMUSIC_INTERFACE_VERSION);
            if (m_pSteamMusic == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamMusicRemote = SteamClient.GetISteamMusicRemote(hSteamUser, hSteamPipe, Constants.STEAMMUSICREMOTE_INTERFACE_VERSION);
            if (m_pSteamMusicRemote == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamHTMLSurface = SteamClient.GetISteamHTMLSurface(hSteamUser, hSteamPipe, Constants.STEAMHTMLSURFACE_INTERFACE_VERSION);
            if (m_pSteamHTMLSurface == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamInventory = SteamClient.GetISteamInventory(hSteamUser, hSteamPipe, Constants.STEAMINVENTORY_INTERFACE_VERSION);
            if (m_pSteamInventory == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamVideo = SteamClient.GetISteamVideo(hSteamUser, hSteamPipe, Constants.STEAMVIDEO_INTERFACE_VERSION);
            if (m_pSteamVideo == IntPtr.Zero)
            {
                return(false);
            }

            m_pSteamParentalSettings = SteamClient.GetISteamParentalSettings(hSteamUser, hSteamPipe, Constants.STEAMPARENTALSETTINGS_INTERFACE_VERSION);
            if (m_pSteamParentalSettings == IntPtr.Zero)
            {
                return(false);
            }

            return(true);
        }