Commits

Ryan Kistner committed 7ff2ec2

Remember steam_bgetcallback? you'll love Steam_GetAPICallResult

Comments (0)

Files changed (5)

Open Steamworks/Interface.h

 
 		return steamclient.GetFactory(m_pchSteamDir);
 	}
+
+	const char *GetSteamDir() { return m_pchSteamDir; }
 private:
 	void TryGetSteamDir()
 	{

Open Steamworks/Steamclient.h

 S_API int STEAM_CALL Steam_InitiateGameConnection( HSteamUser hUser, HSteamPipe hSteamPipe, void *pBlob, int cbMaxBlob, uint64 steamID, int nGameAppID, uint32 unIPServer, uint16 usPortServer, bool bSecure );
 S_API void STEAM_CALL Steam_TerminateGameConnection( HSteamUser hUser, HSteamPipe hSteamPipe, uint32 unIPServer, uint16 usPortServer );
 
+// Steam APICallResult
+S_API bool STEAM_CALL Steam_GetAPICallResult( HSteamPipe hSteamPipe, SteamAPICall_t hSteamAPICall, void* pCallback, int cubCallback, int iCallbackExpected, bool* pbFailed );
+
 // Steam client
 S_API HSteamPipe STEAM_CALL Steam_CreateSteamPipe();
 S_API bool STEAM_CALL Steam_BReleaseSteamPipe( HSteamPipe );

steam_api/steam_api.cpp

 #include "stdafx.h"
 #include "interfaces.h"
 
-CSteamAPILoader *loader = NULL;
+CSteamAPILoader loader;
 CreateInterfaceFn clientFactory = NULL;
 
 STEAMCLIENT_ICLASS *steamclient = NULL;
-STEAMUTILS_ICLASS *steamutils = NULL;
 
 HSteamPipe pipe = 0;
 HSteamUser user = 0;
 
 S_API bool STEAM_CALL SteamAPI_InitSafe()
 {
-	if(loader != NULL)
-		delete loader;
-
-	loader = new CSteamAPILoader();
-	clientFactory = loader->Load();
+	clientFactory = loader.Load();
 
 	if(clientFactory == NULL)
 		return false;
 	if(user == NULL)
 		return false;
 
-	steamutils = (STEAMUTILS_ICLASS *)steamclient->GetISteamUtils(pipe, STEAMUTILS_IFACE);
-
-	if(steamutils == NULL)
-		return false;
-
 	return true;
 }
 
 S_API void SteamAPI_Shutdown()
 {
-	if(loader == NULL)
-		return;
+	if(user)
+	{
+		steamclient->ReleaseUser(pipe, user);
+		user = NULL;
+	}
+	if(pipe)
+	{
+		steamclient->ReleaseSteamPipe(pipe);
+		pipe = NULL;
+	}
+}
 
-	delete loader;
+S_API const char* STEAM_CALL SteamAPI_GetSteamInstallPath()
+{
+	return loader.GetSteamDir();
 }
+
+S_API HSteamPipe STEAM_CALL SteamAPI_GetHSteamPipe()
+{
+	return pipe;
+}
+
+S_API HSteamUser STEAM_CALL SteamAPI_GetHSteamUser()
+{
+	return user;
+}
+
+S_API HSteamPipe STEAM_CALL GetHSteamPipe()
+{
+	return SteamAPI_GetHSteamPipe();
+}
+
+S_API HSteamUser STEAM_CALL GetHSteamUser()
+{
+	return SteamAPI_GetHSteamUser();
+}

steam_api/steam_api.h

 #define STEAMCLIENT_ICLASS	ISteamClient008
 #define STEAMCLIENT_IFACE	STEAMCLIENT_INTERFACE_VERSION_008
 
-#define STEAMUTILS_ICLASS	ISteamUtils004
-#define STEAMUTILS_IFACE	STEAMUTILS_INTERFACE_VERSION_004
-
-extern CSteamAPILoader *loader;
+extern CSteamAPILoader loader;
 extern CreateInterfaceFn clientFactory;
 
 extern STEAMCLIENT_ICLASS *steamclient;
-extern STEAMUTILS_ICLASS *steamutils;
 
 extern HSteamUser user;
 extern HSteamPipe pipe;
 S_API bool STEAM_CALL SteamAPI_Init();
 S_API bool STEAM_CALL SteamAPI_InitSafe();
 
-S_API void STEAM_CALL SteamAPI_Shutdown();
+S_API void STEAM_CALL SteamAPI_Shutdown();
+
+S_API const char* STEAM_CALL SteamAPI_GetSteamInstallPath();
+
+S_API HSteamPipe STEAM_CALL SteamAPI_GetHSteamPipe();
+S_API HSteamPipe STEAM_CALL GetHSteamPipe();
+
+S_API HSteamUser STEAM_CALL SteamAPI_GetHSteamUser();
+S_API HSteamUser STEAM_CALL GetHSteamUser();
+

steam_api/steam_api.vcproj

 			/>
 			<Tool
 				Name="VCLinkerTool"
+				AdditionalDependencies="steamclient.lib"
 				LinkIncremental="2"
+				AdditionalLibraryDirectories="../"
+				DelayLoadDLLs="steamclient.dll"
 				GenerateDebugInformation="true"
 				SubSystem="2"
 				TargetMachine="1"
 				Name="VCCLCompilerTool"
 				Optimization="2"
 				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="&quot;../Open Steamworks&quot;;../boost_1_40_0"
 				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;STEAM_API_EXPORTS"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
 			/>
 			<Tool
 				Name="VCLinkerTool"
+				AdditionalDependencies="steamclient.lib"
 				LinkIncremental="1"
+				AdditionalLibraryDirectories="../"
+				DelayLoadDLLs="steamclient.dll"
 				GenerateDebugInformation="true"
 				SubSystem="2"
 				OptimizeReferences="2"