C++ "Wrapper" for Steam DLL

oldfart

Member
Hi guys,

Thanks for your help and if you are interested I'm willing to share some C++ (VC++ 6.0) source code.

It's no so much a snippet as a full CWinThread class. Below is "screen capture" of the test harness dialog I used to test this class.

I have included the header file - the full class is about 3000 lines of code - which I'll make available if anyone is interested.

cheers
AnOldBloke

P.S. Big thanks to [FS]Erix920 for pointing me in the right direction.


vnetcafe119.jpg


Code:
#if !defined(AFX_STEAMDLLAPI_H__34117073_8FE0_4F68_AD17_3882C4F7D043__INCLUDED_)
#define AFX_STEAMDLLAPI_H__34117073_8FE0_4F68_AD17_3882C4F7D043__INCLUDED_

//	-------------------------------------------------------------
//
//
//		SteamDllApi.h: interface for the CSteamDllApi class.
//
//			Some parts plagiarized from Mitsukarina @ cs.rin.ru
//			Many thanks to [FS]Erix920 @ www.freesteam.org 
//
//	-------------------------------------------------------------
//
//		CVS - Tracking
//
//   MODULE     : $RCSfile: SteamDllApi.h,v $
//
//   CREATED    : $Author: CVSUser $
//
//   REVISION   : $Revision: 1.3 $, $Date: 2009/12/17 01:27:36 $
//   EDITEDBY   : $Author: CVSUser $
//
//
//	-------------------------------------------------------------
//
//	Version: $Log: SteamDllApi.h,v $
//	Version: Revision 1.3  2009/12/17 01:27:36  CVSUser
//	Version: Almost Final.
//	Version: Finish Launch Game + State Machine
//	Version: Finish Kill Game + State Machine
//	Version:
//	Version: Revision 1.2  2009/12/15 07:50:32  CVSUser
//	Version: no message
//	Version:
//	Version: Revision 1.1  2009/12/14 09:27:02  CVSUser
//	Version: Including SteamDllApi
//	Version:
//
//
//  ------------------------------------------------------------------------
//
//
//      (C) Copyright OldFart. 2000 - 2009
//
//            All rights reserved
//
//
//     OldFart makes no warranty of any kind with regard to this
//     software, including, but not limited to, the implied warranties of
//     merchantability and fitness for a particular purpose.
//     OldFart shall not be liable for errors contained herein or
//     direct, indirect, special, incidental or consequential damages in
//     connection with the furnishing, performance or use of this material.
//
//  ------------------------------------------------------------------------

//	-------------------------------------------------------------
//
//		Includes
//
//	-------------------------------------------------------------
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include	"Lock.h"

//	-------------------------------------------------------------
//
//		Defines & Typedefs
//
//	-------------------------------------------------------------
#define	GLOBAL
#define	LOCAL	static


//	What this Application listens for ?
#define ON_STEAMDLLAPI_REQUEST(memberFxn)	\
	ON_REGISTERED_THREAD_MESSAGE( CSteamDllApi::mg_nRequestMsg, memberFxn )

//	What the Parent is listening for
#define ON_STEAMDLLAPI_RESPONSE(memberFxn)	\
	ON_REGISTERED_MESSAGE( CSteamDllApi::mg_nResponseMsg, memberFxn )

//
//	Definitions to describe Some Steam App info
//
typedef enum	SDA_Type_Tag {
	Invalid		= -1,
	Game		= 0,
	Application	= 1,
	Video		= 2,
	Audio		= 3,
	Steam		= 4
} SDAType;

typedef enum	SDA_SteamType_Tag {
	Unknown			= 0,
	HalfLife		= 1,
	HalfLifeMod		= 2,
	Source			= 3,
	SourceMod		= 4,
	ThirdParty		= 5,
	ThirdPartyMod	= 6,
	SteamThirdParty	= 7,
	Tool			= 8,
	SteamMedia		= 9,
	Demo			= 10,
} SDASteamType;


typedef struct	GAME_ARRAY_TAG {
	DWORD			dwGameId;
	CString			csGameName;			// Name used by vNetCafe
	CString			csExeName;			// Exe Name used by vNetCafe
	SDAType			eType;				// Will be Steam
	SDASteamType	eSteamType;			// Game, Tools, Media etc
	BOOL			fSteamSubscribed;	// The games is subscribed to the current user 
	BOOL			fSteamValidated;	// This Game Id Exists and is a Game
	CString			csSteamGameName;	// Name used by Steam
	CString			csSteamExeName;		// Exe Name used by Steam
	CString			csSteamExeSubPath;	// Exe sub path - extracted from Arguments
	CString			csSteamExePath;		// Exe path
	CString			csSteamArguments;	// Launch options
	CString			csSteamStatus;		// the "state" of the game
	CString			csSteamIcon;		// Not sure
} GAME_ARRAY;


typedef	CArray< GAME_ARRAY, GAME_ARRAY &> SDA_GAME_ARRAY;

		typedef enum	RequestType_tag {
			ReqSteamLogin,
			ReqSteamLogout,
			ReqSteamValidateGameArray,
			ReqSteamGetGameArray,
			ReqSteamGetSubscriptionArray,
			ReqSteamLaunchGame,
			ReqSteamKillGame,
			ReqExitNow,
		} RequestType;

		typedef enum	ResponseType_tag {
			RspSteamLoginSucceeds,
			RspSteamLoginFails,
			RspSteamLogoutSucceeds,
			RspSteamLogoutFails,
			RspSteamValidateGameArraySucceeds,
			RspSteamValidateGameArrayFails,
			RspSteamGetGameArraySucceeds,
			RspSteamGetGameArrayFails,
			RspSteamGetSubscriptionArraySucceeds,
			RspSteamGetSubscriptionArrayFails,
			RspSteamLaunchGameSucceeds,
			RspSteamLaunchGameFails,
			RspSteamKillGameSucceeds,
			RspSteamKillGameFails,
			RspSteamGameVanished,
			RspThreadExits,
			RspUnknownRequestFails,
			//RspExitNowFails,
		} ResponseType;

//	-------------------------------------------------------------
//
//		GLOBAL Type Data
//
//	-------------------------------------------------------------
typedef	enum	SDA_ERROR_Tag {
	SDA_NO_ERROR		= 0,
	SDA_LOAD_DLL_FAILS,
	SDA_DLL_NOT_READY,
	SDA_NOT_LOGGED_IN,
	SDA_LOGGING_IN,
	SDA_STEAM_FAILS,
	SDA_STEAM_USER_SET,
	SDA_STEAM_LOGIN_FAILS,
	SDA_LOGGED_IN_ACTIVE,
	SDA_APP_NOT_SUBSCRIBED,
	SDA_VALIDATE_GAME_ACTIVE,
	SDA_VALIDATE_GAME_ARRAY_ACTIVE,
	SDA_LOGGING_OUT_ACTIVE,
	SDA_NOT_VALID_GAME,
	SDA_NO_TERMINATE_RIGHTS,
	SDA_GAME_CLOSED,
	SDA_GAME_TERMINATED,
	SDA_GAME_TERMINATE_FAILS,
	SDA_GAME_NOT_RUNNING,
} SDA_ERROR;

//	----------------------------------------------------------------
//
//		CLASS DEFINITIONS & GLOBAL Function Prototypes
//
//	----------------------------------------------------------------

class CSteamDllApi : public CWinThread
{
		DECLARE_DYNCREATE(CSteamDllApi)

	protected:
		CSteamDllApi();           // protected constructor used by dynamic creation

	// Attributes
	public:

		// Default Parent notification message
		static const UINT mg_nRequestMsg;
		static const UINT mg_nResponseMsg;

	// Operations
	public:
		BOOL	SetSteamAccount(HWND hWndParent,
								LPCTSTR	pszSteamDir,
								LPCTSTR pszSteamUsername, 
								LPCTSTR pszSteamPassword );

		// Overrides
		// ClassWizard generated virtual function overrides
		//{{AFX_VIRTUAL(CSteamDllApi)
		public:
		virtual BOOL InitInstance();
		virtual int ExitInstance();
		//}}AFX_VIRTUAL

	//	Attributes
	protected:
		CCriticalSection	m_CSLockSDA;

		HWND			m_hWndParent;
		LPCTSTR			m_pszSteamUsername;
		LPCTSTR			m_pszSteamPassword;
		CString			m_csSteamDir;
		DWORD			m_dwGameId;
		GAME_ARRAY		m_tLaunchedGame;

		typedef	enum	{
			SDA_Unknown,
			SDA_Idle,
			SDA_Ready,
			SDA_LoggingIn,
			SDA_LoggedIn,
			SDA_LoggingOut,
			SDA_ValidatingGameArray,
			SDA_GettingGameArray,
			SDA_GettingSubscriptionArray,
			SDA_LaunchingGame,
			SDA_InGame,
			SDA_KillingGame,
		} SDA_STATE;

		SDA_STATE		m_eState;
		BOOL			m_fSteamDllLoaded;
		HINSTANCE		m_hInstSteam;
		DWORD			m_dwError;

	// Implementation
	protected:
		BOOL	KillPid( DWORD dwPid, ULONG ulTimo );
		void	SetNewState( SDA_STATE eNewState );
		void	PostRequestFailMessage( RequestType eType, DWORD dwData );

		//	State Processing
		void	ProcessIdleState( RequestType eRequest, DWORD dwData );
		void	ProcessReadyState( RequestType eRequest, DWORD dwData );
		void	ProcessLoggingInState( RequestType eRequest, DWORD dwData );
		void	ProcessLoggedInState( RequestType eRequest, DWORD dwData );
		void	ProcessLoggingOutState( RequestType eRequest, DWORD dwData );
		void	ProcessValidatingGameArrayState(RequestType eRequest, DWORD dwData);
		void	ProcessGettingGameArrayState( RequestType eRequest, DWORD dwData );
		void	ProcessGettingSubscriptionArrayState(RequestType eRequest, DWORD dwData);
		void	ProcessInGameState( RequestType eRequest, DWORD dwData );
		void	ProcessLaunchingGameState( RequestType eRequest, DWORD dwData );
		void	ProcessKillingGameState( RequestType eRequest, DWORD dwData );

		//	Utility Functions
		BOOL	LoadSteamDll( LPCTSTR pszSteamDir );
		BOOL	UnloadSteamDll();
		bool	PostMessageToParent( ResponseType eType, LPARAM lMessageCode );

		virtual ~CSteamDllApi();

		//
		//		Worker thread stuff here
		//
		CEvent			m_EvThreadTerminated;
		CEvent			m_EvTerminate;
		CEvent			m_EvRequest;
		CWinThread	*m_ptWorkerThread;
		static	unsigned	WorkerThreadFunc( LPVOID thisClient )
		{
			CSteamDllApi* pThis = reinterpret_cast<CSteamDllApi*>(thisClient);
			return pThis->WorkerRun();
		}
		unsigned    WorkerRun();
		BOOL		GotoSleep();
		BOOL		FindProcessId( CString &rcProcessName, DWORD &rdwFoundPID );
		BOOL		DoSteamLogin();
		BOOL		DoSteamLogout();
		BOOL		DoSteamValidateGameArray( SDA_GAME_ARRAY *ptGameArray );
		BOOL		DoSteamGetGameArray( SDA_GAME_ARRAY *ptGameArray );
		BOOL		DoSteamGetSubscriptionArray( SDA_GAME_ARRAY *ptGameArray );
		BOOL		DoSteamLaunchGame( DWORD dwGameId, BOOL &rfMonitorGame );
		BOOL		DoSteamKillGame();

		BOOL		GetAppInfo( DWORD dwGameId, GAME_ARRAY &rtGA );
		BOOL		GetAppType( GAME_ARRAY &rtGA );

		//
		//	Enum Windows Callback Handler
		//
		static	BOOL CALLBACK	MyEnumWindowsProc( HWND hwnd, LPARAM lParam )
		{
			DWORD	dwRC;
			DWORD	dwProcessId;
			dwRC	= GetWindowThreadProcessId( hwnd, &dwProcessId );
			if	(( DWORD)lParam == dwProcessId )
			{
				::PostMessage( hwnd, WM_CLOSE, 0, 0 );
			}
			return	TRUE;
		};

	//	----------------------------------------------------------------
	//
	//		DEBUGGING Functions
	//
	//	----------------------------------------------------------------
	public:

//#	ifdef	_DEBUG
#	define FIND_RESPONSE_TYPE_STRING(a) if (eType == a ) return ""#a"";

		CString GetResponseTypeAsString( ResponseType eType)
		{
			FIND_RESPONSE_TYPE_STRING( RspSteamLoginSucceeds );
			FIND_RESPONSE_TYPE_STRING( RspSteamLoginFails );
			FIND_RESPONSE_TYPE_STRING( RspSteamLogoutSucceeds );
			FIND_RESPONSE_TYPE_STRING( RspSteamLogoutFails );
			FIND_RESPONSE_TYPE_STRING( RspSteamValidateGameArraySucceeds );
			FIND_RESPONSE_TYPE_STRING( RspSteamValidateGameArrayFails );
			FIND_RESPONSE_TYPE_STRING( RspSteamGetGameArraySucceeds );
			FIND_RESPONSE_TYPE_STRING( RspSteamGetGameArrayFails );
			FIND_RESPONSE_TYPE_STRING( RspSteamGetSubscriptionArraySucceeds );
			FIND_RESPONSE_TYPE_STRING( RspSteamGetSubscriptionArrayFails );
			FIND_RESPONSE_TYPE_STRING( RspSteamLaunchGameSucceeds );
			FIND_RESPONSE_TYPE_STRING( RspSteamLaunchGameFails );
			FIND_RESPONSE_TYPE_STRING( RspSteamKillGameSucceeds );
			FIND_RESPONSE_TYPE_STRING( RspSteamKillGameFails );
			FIND_RESPONSE_TYPE_STRING( RspSteamGameVanished );
			FIND_RESPONSE_TYPE_STRING( RspThreadExits );
			FIND_RESPONSE_TYPE_STRING( RspUnknownRequestFails );
			return "Unknown ResponseType";
		}

#	define FIND_REQUEST_TYPE_STRING(a) if (eType == a ) return ""#a"";

		CString GetRequestTypeAsString( RequestType eType)
		{
			FIND_REQUEST_TYPE_STRING( ReqSteamLogin );
			FIND_REQUEST_TYPE_STRING( ReqSteamLogout );
			FIND_REQUEST_TYPE_STRING( ReqSteamValidateGameArray );
			FIND_REQUEST_TYPE_STRING( ReqSteamGetGameArray );
			FIND_REQUEST_TYPE_STRING( ReqSteamGetSubscriptionArray );
			FIND_REQUEST_TYPE_STRING( ReqSteamLaunchGame );
			FIND_REQUEST_TYPE_STRING( ReqSteamKillGame );
			FIND_REQUEST_TYPE_STRING( ReqExitNow );
			return "Unknown RequestType";
		}

#	define FIND_STATE_STRING(a) if (eState == a ) return ""#a"";

		CString GetStateAsString( SDA_STATE eState )
		{
			FIND_STATE_STRING( SDA_Unknown );
			FIND_STATE_STRING( SDA_Idle );
			FIND_STATE_STRING( SDA_Ready );
			FIND_STATE_STRING( SDA_LoggingIn );
			FIND_STATE_STRING( SDA_LoggedIn );
			FIND_STATE_STRING( SDA_LoggingOut );
			FIND_STATE_STRING( SDA_ValidatingGameArray );
			FIND_STATE_STRING( SDA_GettingGameArray );
			FIND_STATE_STRING( SDA_GettingSubscriptionArray );
			FIND_STATE_STRING( SDA_LaunchingGame );
			FIND_STATE_STRING( SDA_InGame );
			FIND_STATE_STRING( SDA_KillingGame );
			return	"Unknown SDA_STATE";
		}

#	define FIND_ERROR_STRING(a) if (eError == a ) return ""#a"";

		CString GetErrorAsString( SDA_ERROR eError )
		{
			FIND_ERROR_STRING( SDA_NO_ERROR );
			FIND_ERROR_STRING( SDA_LOAD_DLL_FAILS );
			FIND_ERROR_STRING( SDA_DLL_NOT_READY );
			FIND_ERROR_STRING( SDA_NOT_LOGGED_IN );
			FIND_ERROR_STRING( SDA_LOGGING_IN );
			FIND_ERROR_STRING( SDA_STEAM_FAILS );
			FIND_ERROR_STRING( SDA_STEAM_USER_SET );
			FIND_ERROR_STRING( SDA_STEAM_LOGIN_FAILS );
			FIND_ERROR_STRING( SDA_LOGGED_IN_ACTIVE );
			FIND_ERROR_STRING( SDA_APP_NOT_SUBSCRIBED );
			FIND_ERROR_STRING( SDA_VALIDATE_GAME_ARRAY_ACTIVE );
			FIND_ERROR_STRING( SDA_VALIDATE_GAME_ACTIVE );
			FIND_ERROR_STRING( SDA_LOGGING_OUT_ACTIVE );
			FIND_ERROR_STRING( SDA_NOT_VALID_GAME );
			FIND_ERROR_STRING( SDA_NO_TERMINATE_RIGHTS );
			FIND_ERROR_STRING( SDA_GAME_CLOSED );
			FIND_ERROR_STRING( SDA_GAME_TERMINATED );
			FIND_ERROR_STRING( SDA_GAME_TERMINATE_FAILS );
			FIND_ERROR_STRING( SDA_GAME_NOT_RUNNING );

			return	"Unknown Error";
		}

#	define FIND_STEAM_TYPE_STRING(a) if (eSteamType == a ) return ""#a"";

		CString GetSteamTypeAsString( SDASteamType eSteamType )
		{
	
			FIND_STEAM_TYPE_STRING( Unknown );
			FIND_STEAM_TYPE_STRING( HalfLife );
			FIND_STEAM_TYPE_STRING( HalfLifeMod );
			FIND_STEAM_TYPE_STRING( Source );
			FIND_STEAM_TYPE_STRING( SourceMod );
			FIND_STEAM_TYPE_STRING( ThirdParty );
			FIND_STEAM_TYPE_STRING( ThirdPartyMod );
			FIND_STEAM_TYPE_STRING( SteamThirdParty );
			FIND_STEAM_TYPE_STRING( Tool );
			FIND_STEAM_TYPE_STRING( SteamMedia );
			FIND_STEAM_TYPE_STRING( Demo );
			return	"Unknown SDASteamType";
		}
//#	endif	//ifdef	_DEBUG

		// Generated message map functions
		//{{AFX_MSG(CSteamDllApi)
			// NOTE - the ClassWizard will add and remove member functions here.
		//}}AFX_MSG

		afx_msg LRESULT ProcessUserMessage(WPARAM, LPARAM);
		afx_msg LRESULT ProcessParentRequest(WPARAM, LPARAM);


		DECLARE_MESSAGE_MAP()
};


//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

//	----------------------------------------------------------------

#endif // !defined(AFX_STEAMDLLAPI_H__34117073_8FE0_4F68_AD17_3882C4F7D043__INCLUDED_)

//	----------------------------------------------------------------
//
//		EOF
//
//	----------------------------------------------------------------
 
Hi psuchris,

The C++ wrapper is an independent, event driven, state machine that is wrapped around the steam.dll API's.

The "Steam Tester" is a small application I have written to test logging into Steam using both the dll and the command line. It has enabled me to test the wrapper in a controlled environment before I add it to my main application.

The Steam tester was also used to test various methods of shutting down both Steam and Steam games in a "controlled" manner.

I hope that explains it a bit better. Explanations are not really my forte. ;)

cheers
AnOldBloke
 
Hi guys,

You can download the zipped source at this link:
Welcome to VNetCafe

Select SteamDllApi.zip.

Please note that this is only the class mentioned - if any one is interested in the entire "Steam Tester" project I will organise that as well.

cheers
AnOldBloke

P.S. Response to a request at http://cs.rin.ru
 
Here's a very vague wiki from the Devs. The Non Steam Developer Community

Steamcooker seems to know everything about the protocol but is too busy to document it. We could always develop our own network :).

I sent the attached file to steamcooker but he was busy like usual. Maybe you can figure something out. Its the basics of how my network runs but i'd like to have the server part able to run on linux.
 

Attachments

  • vapnet.zip
    11.7 KB · Views: 9
Here's a very vague wiki from the Devs. The Non Steam Developer Community

Steamcooker seems to know everything about the protocol but is too busy to document it. We could always develop our own network :).

I sent the attached file to steamcooker but he was busy like usual. Maybe you can figure something out. Its the basics of how my network runs but i'd like to have the server part able to run on linux.
Hi [FS]Erix920,

I have read your vapnet.docx and I would like to know -
Q1. are all servers Linux ?
Q2. is the SQL server MySQL (I have some experience with that).
Q3. what protocol does the WAN clients use to access both the Master Server and the File servers ?

Please note that my recent Linux type knowledge was based on embedded OS's like pSOS and QNX.

I'll be away for the weekend and will probably not respond until Monday PM @ +10 GMT.

cheers
AnOldBloke
 
Well FWIW the P2P part of my current project "appears" to be working ;) so ...

If anyone would like the entire "Steam Tester" project made available, please let me know - it is a MS VS 6 project (dsw), which can be easily imported to some of the more recent versions. I may even port it when I have less on my plate.

It may give you the foundation to do something 'interesting" ..

Steam Tester:
1. Hunts for steam's installation path (several methods)
2. Will Launch Steam 2 x ways
2a. As a GUI via the command line
2b. Via the Steam DLL
3. Process watcher
4. Process terminator
5. Kill Steam and games "gracefully" ie. sometimes with a WM_CLOSE, sometime with a "Logout" and sometime with a plain "Terminate" :roll:

Refer the above Dialog image for some idea of what it does.

cheers
AnOldBloke
 
Well ...

Today, I am finally happy that the Peer-Peer comms channel's Asymmetric Key passing protocol (Diffie-Hellman) and Symmetric Encryption (Rijndael) are working fine - whew a long haul - porting and testing the parts I needed from this project:-
IOCP Server/Client system written by Amin Gholiha. Copyright (C) 2005
- so thanks Amin Gholiha.

So there may be another Win32 C++ snippet in the offering .. "Secure Peer-Peer comms" WinThreadClass ;)

cheers
OldFart
 
Hi Erix920 et al,

I have examined the snippets you have supplied (plus those on cs.rin.ru) quite thoroughly and I still have a problem.

I am trying to determine what legit games a legit steam account has.

I have a couple of questions which I hope you can answer.

Overview
1. I am using a legit Steam Account which has only 1 x game DOD 1.3
2. I am using what I consider to be the correct Steam Dll Api call sequence
2.a) Login etc - works fine
2.b) The code snippet below to check each game (AppId) returned by
Code:
...
...
	nRet	= pfnSteamGetAppIds( pauAppIds, tSteamAppStats.uNumApps, tSteamError );

	for	( uLoop = 0; uLoop < tSteamAppStats.uNumApps; uLoop++ )
	{
		dwGameId	= pauAppIds[ uLoop ];
...
...
...
...
	nRet	= pfnSteamEnumerateApp( dwGameId, tSteamApp, tSteamError );

	if	( tSteamError.eSteamError == eSteamErrorNone )
	{
		fRC	= TRUE;		// It exists
		rtGA.csSteamGameName	= szName;

		if	( tSteamApp.uNumDependencies != 0 )
		{
			tAppLO.pszDescription			= szDescription;
			tAppLO.uMaxDescChars			= sizeof( szDescription );
			tAppLO.pszCmdLine				= szCommandLine;
			tAppLO.uMaxCmdLineChars			= sizeof( szCommandLine );
			tAppLO.uIndex					= 0;
			tAppLO.uIconIndex				= 0;
			tAppLO.uNoDesktopShortcut		= 0;
			tAppLO.uNoStartMenuShortcut		= 0;
			tAppLO.uIsLongRunningUnattended	= 0;
			
			nRet	= pfnSteamEnumerateAppLaunchOption( dwGameId, 0, tAppLO, tSteamError );
			rtGA.csSteamArguments	= szCommandLine;
			rtGA.fSteamValidated	= GetAppType( rtGA );
		}

		//
		//	Check if game is available
		//
		nRet	= pfnSteamIsAppSubscribed( (int)dwGameId, fIsAppSubscribed, fIsAppReady, tSteamError );
#		ifdef	LOG_ENABLE
		if	(memicmp( szName, "Day Of Defeat", sizeof( "Day Of Defeat" ) -1 ) == 0 )
		{
			TRACE( "Found DOD\n" );
			ON_LOG_EVENT( va_string( " *** GameId: %5d [sub:%d][rdy:%d][dep%d] \"%s\" \n", 
					dwGameId, 
					fIsAppSubscribed, fIsAppReady, 
					tSteamApp.uNumDependencies, szName ));
			Sleep( 5 );
		}
#		endif	//ifdef	LOG_ENABLE

3. The debug output is generated only if it detects "Day of defeat"

BTW:
sub: means fIsSubscribed
rdy: means fIsReady
sub: means tSteamApp.uNumDependencies

Code:
steamdllapi.cpp:1585 ==> Event      -  ======= State Change (SDA_LoggedIn) --> (SDA_GettingGameArray)
steamdllapi.cpp:2325 ==> Event      -  *** GameId:    30 [sub:0][rdy:0][dep:4] "Day of Defeat" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:    31 [sub:1][rdy:0][dep:0] "Day of Defeat Base Content" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:    32 [sub:1][rdy:0][dep:0] "Day of Defeat French" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:    33 [sub:1][rdy:0][dep:0] "Day of Defeat Italian" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:    34 [sub:1][rdy:0][dep:0] "Day of Defeat German" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:    35 [sub:1][rdy:0][dep:0] "Day of Defeat Spanish" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:   300 [sub:0][rdy:0][dep:8] "Day of Defeat: Source" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:   301 [sub:1][rdy:0][dep:0] "Day of Defeat Source Base Content" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:   302 [sub:0][rdy:0][dep:8] "Day of Defeat: Source Beta" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:   303 [sub:0][rdy:0][dep:0] "Day of Defeat Source Beta Content" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:   304 [sub:0][rdy:0][dep:6] "Day of Defeat: Source Press Review"
steamdllapi.cpp:2325 ==> Event      -  *** GameId:   901 [sub:1][rdy:0][dep:2] "Day of Defeat: Prelude to Victory" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:   917 [sub:1][rdy:0][dep:2] "Day of Defeat: Jagd Trailer" 
steamdllapi.cpp:2325 ==> Event      -  *** GameId:   918 [sub:1][rdy:0][dep:2] "Day of Defeat: Colmar Trailer" 
steamdllapi.cpp:1585 ==> Event      -  ======= State Change (SDA_GettingGameArray) --> (SDA_LoggedIn)

I am confused about the meaning of "IsSubscribed" and "IsReady" because I can launch GameId: 30 and it works just fine - I'm still wondering how to find what legit games belong to a legit account.

Any guidance here would be appreciated.

Note:
I have also tried this using SteamEnumerateSubscription the results from that don't have the fIsSubscribed bit set for "Day Of Defeat" games.

cheers
OldFart
 
IsAppSubscribed is different then IsSubscribed. The app is an, for example, a GCF file. By using IsSubscribed it determines whether or not a game for example is subscribed. I'll post more info when I get back.
 
nice advertising there :)

Hi psuchris,

As you may see - that has not been released yet nor will it be - without the permission of both Erix920 and the "boss" of www.freesteam.org. ;)


Now back to my problem ...
Erix920, I have checked my code, your code and the examples by Mitsukarina at cs.rin.ru and I can't seem to spot the problem - I am using a legit steam.dll and not an emu.
(I did find 1 x bug though :eek: I was using NumDependencies instead of NumLaunchOptions in getting game information.)

cheers
OldFart

P.S. The Steam.dll may have changed because I found that I had to make this change as my program was being trashed due to the change in structure size ..

Code:
//	[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 4)]
struct TSteamSubscription
{
    LPCTSTR	pszName;
	UINT	uMaxNameChars;
	UINT	*puAppIDs;
	UINT	uMaxAppIDs;
	UINT	uID;
	UINT	uNumApps;
	UINT	uDurationInSeconds;
	UINT	uCostInCents;
	UINT	uIsAutoRenewing;
	//	Requires approx additional 0x120 bytes
	UINT	auFiller[ 128 ];
};
 
I was unable to write in my thread today as my new pc arrived today
so I was setting it up. I checked my app as recent as yesterday and the method I posted worked just fine.
 
I was unable to write in my thread today as my new pc arrived today
so I was setting it up. I checked my app as recent as yesterday and the method I posted worked just fine.

Thanks for that!

I'll check it again tomorrow - I'll actually create a VB vs C++ step x step - so we can see where I'm failing!

BTW: good luck setting up the new "big boy's toy" ;)

cheers
OldFart
 
Just to be clear, you're trying to find out what code will give you the subscribed games such as Counter Strike Source and not the appids which for example would be source sounds.gcf, correct?
 
Just to be clear, you're trying to find out what code will give you the subscribed games such as Counter Strike Source and not the appids which for example would be source sounds.gcf, correct?

Hi Erix920,

Yes! That is correct!

I am currently allowing the user to manually select the games in their account!

I am happily logging in via the DLL - this validates the username and password that they have entered for that account.

I am then trying to validate their game selections (or initialize/update their selections).

cheers
OldFart
 
I was unable to scroll to the right on your output you posted before. You are getting the right output, for example "Day Of Defeat". What ever method you're using to get those names I suggest you add it to something like a string array and then iterate through it by checking for the game name chosen in the drop menu.

If TSteamSubscription.pszName = dropmenu.Selecteditem.ToString Then
raiseEvent gameSubscribed
End if
 
Back
Top