Your Ad Here

Subscribe
 Post #1
 5th October 2009 Last edited by VoiDeD; 30th March 2010 at 09:53PM..
VoiDeD's Avatar
August 2005
949 Posts

(Thanks to stgn/gngbng for the awesome logo)

Hello everyone, I've been meaning to start a thread about this project but haven't found there to be enough content revolving around the project up until now.

Update:
I've started work on yet another new aspect of Open Steamworks that will enable more developers to get access to the code base: dotnetworks.

dotnetworks is a managed C++/CLI wrapper of the OSW code that allows developers in the .NET environment to access the interfaces.

The dotnetworks project will allow C# programmers, for example, to get the same features and functionality from OSW.
    static class Program
    {
        static void Main()
        {
            if ( !Steamworks.Init() )
            {
                MessageBox.Show( "Unable to initialize steamworks." );
                return;
            }

            SteamUserStats002 stats = Steamworks.GetSteamUserStats002();

            GameID tf2 = new GameID( 440 );

            if ( !stats.RequestCurrentStats( tf2 ) )
                Console.WriteLine( "Can't get stats." );

            uint numStats = stats.GetNumStats( tf2 );
            for ( uint x = 0 ; x < numStats ; x++ )
            {
                string name = stats.GetStatName( tf2, x );
                int value = 0;
                bool success = stats.GetStat( tf2, name, ref value );

                if ( success )
                    Console.WriteLine( name + ": " + value );
            }
        }
    }

But, mind you, this project is only in its infancy, and will require a great deal of work until the major features are implemented.

In order for dotnetworks to expand, I need alot of assistance. The process of writing wrapper classes for each of the interfaces in OSW is a very lengthy process that requires a large investment of time.

Currently the OSW team looks like this: http://osw.limetech.org/?page=team, and I'm always looking for anyone who is willing to put forward any amount of effort to help support the project.

So I'm asking for anyone that can help commit code changes and new classes to dotnetworks, so that aspect of the project can expand. Please send me a PM, contact me on IRC, or send off an email to voidedweasel@gmail.com if you are interested. Thanks!
Any who, here's the project I've been working on recently. It's called Open Steamworks. Here's an excerpt explaining what Open Steamworks is:



What is Open Steamworks?

Open Steamworks is an open implementation of the Valve's Steamworks API. In a sense it provides the same client only functionality you would receive if you or your company applied for Valve's Steamworks.

This project has been obtained from reverse engineering and scourging of existing code and projects.

Keep in mind that this project only provides code, and very little documentation. The only documentation provided is that of code comments, and not all features are documented. If documentation and the other features are a must, have your company contact Valve to sign up for the real Steamworks.

Furthermore, you do not get access to the Steamworks back-end. You cannot create achievements, register a game, or do other back-end related activities.

More details on Valve's Steamworks is available here: https://partner.steamgames.com/


Interested in Helping or Getting Help?

If you're interested in helping the project, the primary means of reaching me is through email. If you're looking to submit patches and code changes, please email me with a subject that describes these intentions. Suggestions and comments are always welcome.

If you need help using the API, I can provide only basic help, the majority of the work should be done by you.

Update: I'm currently looking for people who would be interested in taking testing positions and working through the API and testing features. Please email me if you are interested!

You may reach me at: voidedweasel@gmail.com


You can find the project's code base here: http://svn.limetech.org/web/opensteamworks/.

The project is in its preliminary stage, but there are still many projects that are evolving out of it.

Here's some screen shots of things that are in development:



stgn/gngbng's MSN messenger status changer






my steam friend's name theft device





A garrymod module created by Chrisaster that is built on top of this API:
http://www.facepunch.com/showthread.php?t=823783
This is my binding to VoiDeD's Steamworks API, Open Steamworks.

Download

http://bit.ly/luxOe (Last updated 18/11/09 19:30)

Function List
steamworks.CSteamID()
steamworks.ISteamClient()
steamworks.Steam_BGetCallback()
steamworks.Steam_FreeLastCallback()

ISteamClient007:CreateSteamPipe()
ISteamClient007:ConnectToGlobalUser(hSteamPipe)
ISteamClient007:GetISteamUser(hSteamUser, hSteamPipe, interfaceVersion)
ISteamClient007:GetISteamFriends(hSteamUser, hSteamPipe, interfaceVersion)

ISteamUser005:IsPrimaryChatDestination()
ISteamUser005:GetHSteamUser()
ISteamUser005:GetCSteamID()
ISteamUser005:LoggedOn()
ISteamUser005:SetSelfAsPrimaryChatDestination()

ISteamUser012:GetHSteamUser()
ISteamUser012:GetCSteamID()
ISteamUser012:LoggedOn()

ISteamFriends002:AcknowledgeInviteToClan(CSID, bool)
ISteamFriends002:AddFriend(CSID)
ISteamFriends002:AddFriendByName(nameOrEmail)
ISteamFriends002:GetChatMessage(friendCSID, chatID)
ISteamFriends002:InviteFriendToClan(friendCSID, groupCSID)
ISteamFriends002:RemoveFriend(friendCSID)
ISteamFriends002:SendMsgToFriend(friendCSID, messageType, messageBody)
ISteamFriends002:SetPersonaState(personaState)

ISteamFriends005:ActivateGameOverlay(pchDialog)
ISteamFriends005:ActivateGameOverlayToStore(appID)
ISteamFriends005:ActivateGameOverlayToUser(pchDial og, friendCSID)
ISteamFriends005:ActivateGameOverlayToWebPage(pchU RL)
ISteamFriends005:GetClanByIndex(clanIndex)
ISteamFriends005:GetClanCount()
ISteamFriends005:GetClanName(groupCSID)
ISteamFriends005:GetFriendByIndex(friendIndex, friendFlags)
ISteamFriends005:GetFriendCount(friendFlags)
ISteamFriends005:GetFriendCountFromSource(sourceCS ID)
ISteamFriends005:GetFriendFromSourceByIndex(source CSID, friendIndex)
ISteamFriends005:GetFriendGamePlayed(friendCSID)
ISteamFriends005:GetFriendPersonaName(friendCSID)
ISteamFriends005:GetFriendPersonaNameHistory(frien dCSID, historyIndex)
ISteamFriends005:GetFriendPersonaState(friendCSID)
ISteamFriends005:GetFriendRelationship(friendCSID)
ISteamFriends005:GetPersonaName()
ISteamFriends005:GetPersonaState()
ISteamFriends005:HasFriend(friendCSID, friendFlags)
ISteamFriends005:IsUserInSource(userCSID, sourceCSID)
ISteamFriends005:SetInGameVoiceSpeaking(userCSID, bSpeaking)
ISteamFriends005:SetPersonaName(personaName)

CSteamID:GetAccountID()
CSteamID:GetEAccountType()
CSteamID:GetEUniverse()
CSteamID:GetUnAccountInstance()
CSteamID:InstancedSet(accountID, accountInstance, eUniverse, eAccountType)
CSteamID:IsValid()
CSteamID:Render()
CSteamID:Set(accountID, eUniverse, accountType)
CSteamID:SetAccountID(accountID)
CSteamID:SetEUniverse(eUniverse)

PubParam:To(newTypeMetaID)

CallbackMsg_t:GetCubParam()
CallbackMsg_t:GetHSteamUser()
CallbackMsg_t:GetCallback()
CallbackMsg_t:GetPubParam()

GameOverlayActivated_t:IsActive()

PersonaStateChange_t:GetSteamID()
PersonaStateChange_t:GetFlags()

FriendChatMsg_t:GetReceiver()
FriendChatMsg_t:GetSender()
FriendChatMsg_t:GetChatID()

FriendEndChatSession_t:GetCSteamID()

FriendAdded_t:GetSuccess()
FriendAdded_t:GetSteamID()

UserRequestingFriendship_t:GetSteamID()

FriendGameInfo_t:GetCGameID()
FriendGameInfo_t:GetGameIP()
FriendGameInfo_t:GetGamePort()
FriendGameInfo_t:GetQueryPort()

CGameID:AppID()
CGameID:IsMod()
CGameID:IsP2PFile()
CGameID:IsShortcut()
CGameID:IsSteamApp()
CGameID:IsValid()
CGameID:ModID()




Chatlogs!

Alright, seems the chat logger is ready for beta testing.

You can grab it here:
http://dl.dropbox.com/u/99606/steam_chat_logger_b1.rar


This is the main settings dialog used for controlling the logging.

The corresponding output found in the logged text file:


Primary control of the logger is handled through a notification icon in the taskbar, through a context menu. Double clicking the icon will also open the settings dialog.

The string formatting is pretty straight forward, {Name} replaces to what you'd expect, and the majority of the formatting is explained on the settings dialog.

However, here's the full list of formatting options:
Code:
{SteamID} - Replaces to the sender's SteamID. (In a filename context all ':'s are replaced with '_'s)
{Name} - The sender's name. (Made filename safe for the directory and filenames)
{Date} - Date, all invalid chars are replaced with '_'s in filename contexts.
{Time} - Time, same replacement.
{Message} - The logged message, only valid in the log formats.
{NewLine} - Writes a new line for formatting logs.
{Tab} - Tab character for formatting logs.
{MyName} - Writes your name in a log context.
{UnixTime} - Unix time in log context.
There's plenty of things that still need to be added:
Code:
* Single process mutex, so only one logger can be run at a time.
* Options such as a toggle for XML output.
* Additional formatting options.
* Group chat support? (This is unlikely. It requires use of the IClientFriends interface and is bound to cause lots of problems when an update rolls out)
This is a beta release for the sole purpose of bug testing, so PLEASE report any issues that any of you encounter while using this.

Additionally, I welcome comments, suggestions, and other to-do additions!

The full source code is available on the SVN, as with all other projects: http://code.assembla.com/steamworks/...t%20Log?rev=30


In essence, anything possible with steam (on the client side) is possible with Open Steamworks.

As always, if you are interested in contributing or just want to toss your opinion out, I'd always be glad to hear it. Also if you work on a project that involves the API, let me know and I'll add it to the post.
 Post #2
 5th October 2009
Dennab
September 2009
265 Posts
a very nice api, a++ would use again
 Post #3
 5th October 2009
Gold Member
PvtCupcakes's Avatar
May 2008
7,077 Posts
Furthermore, you do not get access to the Steamworks back-end. You cannot create achievements, register a game, or do other back-end related activities.
Why not?
 Post #4
 5th October 2009
Zaktaman's Avatar
March 2006
222 Posts
Maybe because that would be using Valve's servers
 Post #5
 5th October 2009 Last edited by VoiDeD; 5th October 2009 at 04:22AM..
VoiDeD's Avatar
August 2005
949 Posts
Exactly for that reason. You'd need a Steamworks developer account with Valve in order to access the back-end. This project only provides the client-end of Steamworks.

Finally figured out the steam friends chat callbacks.



Steam chatlog storage anyone? (Major WIP, don't expect a release anytime soon)


int main()
{
	SetDllDirectory("C:\\Program Files\\Steam\\");

	eInitError errorCode;
	if (!Steamworks_Init(eInitSteamClient, errorCode))
	{
		std::string errMsg = "Unable to init steamworks : ";
		errMsg += EnumString<eInitError>::From(errorCode);
		errMsg += "\n";

		Error(errMsg);
	}

	int error;
	ISteamClient008 *steamClient = (ISteamClient008 *)CreateInterface(STEAMCLIENT_INTERFACE_VERSION_008, &error);
	if (!steamClient)
		Error("Unable to get steam client.", error);

	HSteamPipe hSteamPipe = steamClient->CreateSteamPipe();
	HSteamUser hSteamUser = steamClient->ConnectToGlobalUser(hSteamPipe);

	ISteamFriends001 *steamFriends = (ISteamFriends001 *)steamClient->GetISteamFriends( hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION_001 );

	HSteamCall hSteamCall;
	CallbackMsg_t CallbackMsg;

	while (true)
	{
		if (Steam_BGetCallback(hSteamPipe, &CallbackMsg, &hSteamCall))
		{
			if (CallbackMsg.m_iCallback == FriendChatMsg_t::k_iCallback)
			{
				FriendChatMsg_t *chatMsg = (FriendChatMsg_t *)CallbackMsg.m_pubParam;
				EFriendMsgType msgType;

				// allocate data for message
				char *pvData = new char[256];
				memset(pvData, 0, 256);

				// i have no clue if steam dellocates this or if we should
				const char *friendName = steamFriends->GetFriendPersonaName(chatMsg->m_ulOtherID);
				steamFriends->GetChatMessage(chatMsg->m_ulSteamID, chatMsg->m_iChatID, pvData, 256, &msgType);

				if (msgType & k_EFriendMsgTypeTyping)
				{
					//steamFriends->SendMsgToFriend(chatMsg->m_ulOtherID, k_EFriendMsgTypeChatSent, "");
					std::cout << "* " << friendName << " is typing a message..." << std::endl;
				}
				else
					std::cout << "* Message from " << friendName << ": " << pvData << std::endl;

				// clean up
				delete [] pvData;

			}

			Steam_FreeLastCallback( hSteamPipe );
		}
		
		Sleep(1);
	}

	// yeah we never get here, sue me
	Steamworks_Shutdown();

	return 0;
}
 Post #6
 5th October 2009
Gold Member
DementNeo's Avatar
April 2006
7,578 Posts
Ooh, please release that MSN plugin when it's done :]
 Post #7
 5th October 2009
efeX's Avatar
April 2009
2,205 Posts
Exactly for that reason. You'd need a Steamworks developer account with Valve in order to access the back-end. This project only provides the client-end of Steamworks.

Finally figured out the steam friends chat callbacks.



Steam chatlog storage anyone? (Major WIP, don't expect a release anytime soon)


int main()
{
	SetDllDirectory("C:\\Program Files\\Steam\\");

	eInitError errorCode;
	if (!Steamworks_Init(eInitSteamClient, errorCode))
	{
		std::string errMsg = "Unable to init steamworks : ";
		errMsg += EnumString<eInitError>::From(errorCode);
		errMsg += "\n";

		Error(errMsg);
	}

	int error;
	ISteamClient008 *steamClient = (ISteamClient008 *)CreateInterface(STEAMCLIENT_INTERFACE_VERSION_008, &error);
	if (!steamClient)
		Error("Unable to get steam client.", error);

	HSteamPipe hSteamPipe = steamClient->CreateSteamPipe();
	HSteamUser hSteamUser = steamClient->ConnectToGlobalUser(hSteamPipe);

	ISteamFriends001 *steamFriends = (ISteamFriends001 *)steamClient->GetISteamFriends( hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION_001 );

	HSteamCall hSteamCall;
	CallbackMsg_t CallbackMsg;

	while (true)
	{
		if (Steam_BGetCallback(hSteamPipe, &CallbackMsg, &hSteamCall))
		{
			if (CallbackMsg.m_iCallback == FriendChatMsg_t::k_iCallback)
			{
				FriendChatMsg_t *chatMsg = (FriendChatMsg_t *)CallbackMsg.m_pubParam;
				EFriendMsgType msgType;

				// allocate data for message
				char *pvData = new char[256];
				memset(pvData, 0, 256);

				// i have no clue if steam dellocates this or if we should
				const char *friendName = steamFriends->GetFriendPersonaName(chatMsg->m_ulOtherID);
				steamFriends->GetChatMessage(chatMsg->m_ulSteamID, chatMsg->m_iChatID, pvData, 256, &msgType);

				if (msgType & k_EFriendMsgTypeTyping)
				{
					//steamFriends->SendMsgToFriend(chatMsg->m_ulOtherID, k_EFriendMsgTypeChatSent, "");
					std::cout << "* " << friendName << " is typing a message..." << std::endl;
				}
				else
					std::cout << "* Message from " << friendName << ": " << pvData << std::endl;

				// clean up
				delete [] pvData;

			}

			Steam_FreeLastCallback( hSteamPipe );
		}
		
		Sleep(1);
	}

	// yeah we never get here, sue me
	Steamworks_Shutdown();

	return 0;
}

Whoa, someone was finally able to do this, nice!
 Post #8
 5th October 2009
Gold Member
PvtCupcakes's Avatar
May 2008
7,077 Posts


int main()
{
...
				// allocate data for message
				char *pvData = new char[256];
				memset(pvData, 0, 256);

				steamFriends->GetChatMessage(chatMsg->m_ulSteamID, chatMsg->m_iChatID, pvData, 256, &msgType);

					std::cout << "* Message from " << friendName << ": " << pvData 
}
How is the data being stored in pvData?
I just did some testing of something like this in C and if you pass a char* to a function it doesn't get changed.

I did this
#include <stdio.h>

void doStuff(char* c)
{
    c = "test";
}

int main()
{
    char* c = "null";
    doStuff(c);
    printf("c: %s\n", c);
}

And the output is null
If I do this, the output is test, like it should be.
#include <stdio.h>

void doStuff(char** c)
{
    *c = "test";
}

int main()
{
    char* c = "null";
    doStuff(&c);
    printf("c: %s\n", c);
}
 Post #9
 5th October 2009 Last edited by Deco Da Man; 5th October 2009 at 05:43AM..
Gold Member
Deco Da Man's Avatar
July 2007
2,246 Posts
A way to get CSteamIDs by their Steam community ID or SteamID would be awesome... is such a thing possible?
 Post #10
 5th October 2009 Last edited by VoiDeD; 5th October 2009 at 05:50AM..
VoiDeD's Avatar
August 2005
949 Posts
The 64bit representation of a CSteamID is a community ID.

CSteamID id((uint64)76561197969249708L);

As for string representations, you'll have to manually parse them.
 Post #11
 5th October 2009 Last edited by ComWalk; 5th October 2009 at 06:02AM.. (not worth it)
ComWalk's Avatar
August 2005
403 Posts
-snip-
 Post #12
 5th October 2009 Last edited by jA_cOp; 5th October 2009 at 07:22AM..
Gold Member
jA_cOp's Avatar
May 2006
5,573 Posts
A pointer is a memory address. All you have to do, is write to the address space provided.

Read over this:
#include <stdio.h>

void doStuff(char* c) /*c is now a new local variable - pointers are passed by value (copied) */
{
    c = "test"; /* assigns our new local pointer */
}

int main()
{
    char* c = "null"; /*creates a new local pointer */
    doStuff(c); /* passes it on by value, thus 'c' - the pointer itself, cannot be changed in doStuff */
    printf("c: %s\n", c);
    return 1;
}

All we have to do is write to the area 'c' points to:
#include <stdio.h>
#include <string.h>

void doStuff(char* c)
{
    strcpy(c, "test"); /* writes "test\0" to wherever c is pointing */
}

int main()
{
    char buffer[32];
    doStuff(buffer);
    printf("buffer: %s\n", buffer);
    return 0;
}

edit:

Oh, and yeah this looks pretty awesome.

Maybe make a function to send replies in Steam chat, people could make Steam chat bots
 Post #13
 5th October 2009
efeX's Avatar
April 2009
2,205 Posts
you had to give them ideas?
 Post #14
 5th October 2009
Gold Member
HiddenMyst's Avatar
June 2006
8,111 Posts
Steam equivalent of MSN viruses are just around the corner. I can feel it in my bones...
 Post #15
 5th October 2009
Dennab
November 2008
1,017 Posts
Don't worry, only about 10% of the retarded MSN population is on Steam I would assume. That probably only makes 90% of the Steam population.
 Post #16
 5th October 2009
Super Moderator
SteveUK's Avatar
May 2005
4,348 Posts
Don't worry, only about 10% of the retarded MSN population is on Steam I would assume. That probably only makes 90% of the Steam population.
If that was true why is phishing a constant problem on Steam?
 Post #17
 5th October 2009
Gold Member
ZomBuster's Avatar
June 2006
9,250 Posts
Cool, I'll look at it.
 Post #18
 5th October 2009
Games Moderator
Jimbomcb's Avatar
February 2005
14,063 Posts
shit, this might be exactly what i've been looking for
 Post #19
 5th October 2009
Gold Member
Dennab
November 2006
7,368 Posts
Wonder if I can program a version of the MSN plugin for aMSN in tcl
 Post #20
 5th October 2009
Gold Member
ZomBuster's Avatar
June 2006
9,250 Posts
lol this works good
Code:
while (!GetAsyncKeyState(VK_ESCAPE)) // loop until we escape
	{
		int numfriends = steamFriends->GetFriendCount();
		for(int p=1;p < numfriends;p++){
		CSteamID friendp = steamFriends->GetFriendByIndex(p);
		EFriendMsgType Testmsg(k_EFriendMsgTypeChat);
		steamFriends->SendMsgToFriend(friendp,Testmsg,"This is a test, please keep calm");
		}
		Sleep(1);
	}
maybe I had to remove the while loop
 Post #21
 5th October 2009 Last edited by Samuelgames; 5th October 2009 at 03:33PM..
Gold Member
Samuelgames's Avatar
November 2007
3,882 Posts
Amazing work VoiDeD, even that all we can do now is play with the Friends list and AppID's, Can you make a way to Sync data with the Steam servers/Some third party server to have something like Steam Cloud?

lol this works good
Code:
while (!GetAsyncKeyState(VK_ESCAPE)) // loop until we escape
	{
		int numfriends = steamFriends->GetFriendCount();
		for(int p=1;p < numfriends;p++){
		CSteamID friendp = steamFriends->GetFriendByIndex(p);
		EFriendMsgType Testmsg(k_EFriendMsgTypeChat);
		steamFriends->SendMsgToFriend(friendp,Testmsg,"This is a test, please keep calm");
		}
		Sleep(1);
	}
maybe I had to remove the while loop
 Post #22
 5th October 2009 Last edited by VoiDeD; 5th October 2009 at 05:25PM..
VoiDeD's Avatar
August 2005
949 Posts
Amazing work VoiDeD, even that all we can do now is play with the Friends list and AppID's, Can you make a way to Sync data with the Steam servers/Some third party server to have something like Steam Cloud?
Check the ISteamRemoteStorage002 interface: http://code.assembla.com/steamworks/...teStorage002.h

Edit: I just recently committed ISteamRemoteStorage001, it has additional write/delete functions.
 Post #23
 5th October 2009
Gold Member
Dr Nick's Avatar
November 2007
6,648 Posts
Pardon my ignorance, but with this, we'll be able to use Steam Friends on other devices than PCs and laptops, right?

I've been thinking Steam Friends on my PSP.
 Post #24
 5th October 2009 Last edited by Samuelgames; 5th October 2009 at 03:40PM..
Gold Member
Samuelgames's Avatar
November 2007
3,882 Posts
Pardon my ignorance, but with this, we'll be able to use Steam Friends on other devices than PCs and laptops, right?

I've been thinking Steam Friends on my PSP.
Well you need to be connected to the Steam service to use the OpenSteamworks I guess, They even tried to make something gimmicky for the iPhone with an app named Gears:

http://www.gamertell.com/gaming/comm...vity-on-steam/

Edit:

But you can make a frontend to make the PSP connect to your PC running Steam and your PSP Steam Chat Streamer
 Post #25
 5th October 2009 Last edited by VoiDeD; 5th October 2009 at 03:40PM..
VoiDeD's Avatar
August 2005
949 Posts
You'd need to port the actual steam/steamclient code over to the platform you want to run it on. It's theoretically possible but not feasible.

Edited:

Ninja'd.

It looks like Gear's runs on top of the XML API in steam community. http://steamcommunity.com/id/VoiDeD?xml=1 as an example.
 Post #26
 5th October 2009
Games Moderator
Jimbomcb's Avatar
February 2005
14,063 Posts
now's the point where i'm wishing i knew more C, lovely work though
 Post #27
 5th October 2009
raBBish's Avatar
March 2007
897 Posts
Automatic 'away' message!

http://codepad.org/6gFXtNLi
 Post #28
 5th October 2009
Sir_Lulzalot's Avatar
December 2008
40 Posts
Does this perhaps mean that sometime in the future we may see support for Steam Chat on other platforms, or through 3rd party IM clients?
 Post #29
 5th October 2009
DrTaxi's Avatar
September 2009
1,689 Posts
Does this perhaps mean that sometime in the future we may see support for Steam Chat on other platforms, or through 3rd party IM clients?
As far as I have understood it interfaces with the Steam client, not the server.
 Post #30
 5th October 2009 Last edited by ZeekyHBomb; 5th October 2009 at 04:30PM..
ZeekyHBomb's Avatar
June 2006
1,943 Posts
Automatic 'away' message!

http://codepad.org/6gFXtNLi
I forked it. I'm on Linux atm, but the hard coded C:\Program Files\Steam-path annoyed me.
Also changed some other stuff.
link

Just skipped over it, so there might be some errors in my code.

Edited:
Also, you need to link against shlwapi.lib now.

Edited:

I forked it. I'm on Linux atm, but the hard coded C:\Program Files\Steam-path annoyed me.
Also changed some other stuff.
link

Just skipped over it, so there might be some errors in my code.
As far as I have understood it interfaces with the Steam client, not the server.
Yeah. You'd need a Steam-application for you platform.. or someone to hack the Steam-interface.
 Post #31
 5th October 2009
Games Moderator
Jimbomcb's Avatar
February 2005
14,063 Posts
I assume InviteFriendToClan( CSteamID steamIDfriend, CSteamID steamIDclan ) is the invite to group... in that case, how do you get the ID for particular groups (or even better, have an example?)
 Post #32
 5th October 2009 Last edited by VoiDeD; 5th October 2009 at 04:51PM..
VoiDeD's Avatar
August 2005
949 Posts
I introduced a new article describing the available interfaces: http://steamworks.assembla.com/wiki/...rface_Overview

I'm adding more articles as I go to describe/document some features.

Eventually I plan to implement doxygen comments, but this is far in the future.

I assume InviteFriendToClan( CSteamID steamIDfriend, CSteamID steamIDclan ) is the invite to group... in that case, how do you get the ID for particular groups (or even better, have an example?)
ISteamFriends 003 and 005 contain
	virtual int GetClanCount() = 0;
	virtual CSteamID GetClanByIndex( int iClan ) = 0;
	virtual const char *GetClanName( CSteamID steamIDClan ) = 0;

But these only allow access to groups that the local user is in. Other than that I'm not sure, haven't looked at anything related to that.

Groups have their own identifier based off of a CSteamID, you can normally find these on steamcommunity website.

Check: https://partner.steamgames.com/docum...community_data for more details.

Once you've got a group ID you want, simply construct it with

CSteamID group(gid);

Edited:

I forked it. I'm on Linux atm, but the hard coded C:\Program Files\Steam-path annoyed me.
Also changed some other stuff.
link

Just skipped over it, so there might be some errors in my code.

Edited:
Also, you need to link against shlwapi.lib now.
Yeah, I tried a little to make the code cross-platform, but eventually considered the fact that not many people would be running steam on *nix platforms anyways.

I'm interested in writing cross-platform compatible code, but it isn't my strong suite so I often don't go too far with it do to my lack of knowledge on *nix.
 Post #33
 5th October 2009 Last edited by Jimbomcb; 5th October 2009 at 04:57PM..
Games Moderator
Jimbomcb's Avatar
February 2005
14,063 Posts
cheers, new to the language pretty much so i'm sure this isn't the best place to start but anyway, if you can put up with these questions

I see that for example, SendMsgToFriend is part of steamFriends, declared here,
ISteamFriends001 *steamFriends = (ISteamFriends001 *)steamClient->GetISteamFriends( hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION_001 );

while the stuff you showed for the clan ids, names etc are part of ISteamFriends003/5 but the invite function is only found in IClientFriends. How would I go about getting the IClientFriends the same way ISteamFriends001 is so I can use the Invite function
 Post #34
 5th October 2009
iPope's Avatar
October 2008
1,427 Posts
Awesome thread, nicely presented. I have no use for this tool but it is really awesome.
 Post #35
 5th October 2009 Last edited by VoiDeD; 5th October 2009 at 05:29PM..
VoiDeD's Avatar
August 2005
949 Posts
cheers, new to the language pretty much so i'm sure this isn't the best place to start but anyway, if you can put up with these questions

I see that for example, SendMsgToFriend is part of steamFriends, declared here,
ISteamFriends001 *steamFriends = (ISteamFriends001 *)steamClient->GetISteamFriends( hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION_001 );

while the stuff you showed for the clan ids, names etc are part of ISteamFriends003/5 but the invite function is only found in IClientFriends. How would I go about getting the IClientFriends the same way ISteamFriends001 is so I can use the Invite function
The Invite function seems to be located in version 002, which I haven't created yet. I'm going to start work on that after I post this.

The reason I mention this is because the IClient* interfaces are not reliable. They're interfaces to internal classes that map the ISteam* calls to calls within internal classes. As such, these interfaces are bound to change without warning, so it's not safe to use them.

The ISteam* interfaces are version safe, and thus have multiple instances with version numbers appended.

Anyhow, here's how you'd do it:

	int error;
	ISteamClient008 *steamClient = (ISteamClient008 *)CreateInterface(STEAMCLIENT_INTERFACE_VERSION_008, &error);
	if (!steamClient)
		Error("Unable to get steam client.", error);

	IClientEngine *clientEngine = (IClientEngine *)CreateInterface(CLIENTENGINE_INTERFACE_VERSION, &error);
	if (!clientEngine)
		Error("Unable to get client engine.", error);


	HSteamPipe hSteamPipe = steamClient->CreateSteamPipe();
	HSteamUser hSteamUser = steamClient->ConnectToGlobalUser(hSteamPipe);

	IClientFriends *clientFriends = clientEngine->GetIClientFriends(hSteamUser, hSteamPipe, CLIENTFRIENDS_INTERFACE_VERSION);
	if (!clientFriends)
		Error("Unable to get client friends.");

Be sure to replace this when ISteamFriends002 is committed.

Edit:
Committed ISteamFriends002. Along with that I committed ISteamRemoteStorage001, this version allows the write/delete access that version 002 lacks. They're both untested but hopefully will work right out of the box. :)

	ISteamFriends002 *steamFriends = (ISteamFriends002 *)steamClient->GetISteamFriends( hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION_002 );
 Post #36
 5th October 2009
Games Moderator
Jimbomcb's Avatar
February 2005
14,063 Posts
thanks, you've been a great help
 Post #37
 5th October 2009 Last edited by Darkimmortal; 19th March 2010 at 01:01AM..
Darkimmortal's Avatar
April 2009
809 Posts
-snip-
 Post #38
 5th October 2009 Last edited by VoiDeD; 5th October 2009 at 06:59PM..
VoiDeD's Avatar
August 2005
949 Posts
I've been messing with the ISteamRemoteStorage interfaces.

Code:
Steam Cloud Quota, Current: 131072, Max: 35825
Loading Steam Cloud details for 3 files...
 File #0: cfg/config.cfg (7469 bytes)
 File #1: materials/vgui/logos/spray.vtf (87640 bytes)
 File #2: materials/vgui/logos/spray.vmt (138 bytes)
Total Size: 95247
The numbers don't add up for me either...
Here's what my friend figures:
ExileLord: Maybe they had a max
ExileLord: And then they were like
ExileLord: FUCK IT
ExileLord: LETS GO WAY OVER
	int error;
	ISteamClient008 *steamClient = (ISteamClient008 *)CreateInterface(STEAMCLIENT_INTERFACE_VERSION_008, &error);
	if (!steamClient)
		Error("Unable to get steam client.", error);

	IClientEngine *clientEngine = (IClientEngine *)CreateInterface(CLIENTENGINE_INTERFACE_VERSION, &error);

	HSteamPipe hSteamPipe = steamClient->CreateSteamPipe();
	HSteamUser hSteamUser = steamClient->ConnectToGlobalUser(hSteamPipe);

	ISteamFriends002 *steamFriends = (ISteamFriends002 *)steamClient->GetISteamFriends( hSteamUser, hSteamPipe, STEAMFRIENDS_INTERFACE_VERSION_002 );

	IClientUtils *clientUtils = (IClientUtils *)clientEngine->GetIClientUtils(hSteamPipe, CLIENTUTILS_INTERFACE_VERSION);
	clientUtils->SetAppIDForCurrentPipe(500); // l4d

	ISteamRemoteStorage001 *remoteStore = (ISteamRemoteStorage001 *)steamClient->GetISteamGenericInterface(hSteamUser, hSteamPipe, STEAMREMOTESTORAGE_INTERFACE_VERSION_001);

	uint32 fileCount = remoteStore->GetFileCount();

	int curr, max, total = 0;
	remoteStore->GetQuota(&curr, &max);

	std::cout << "Steam Cloud Quota, Current: " << curr << ", Max: " << max << std::endl;
	
	std::cout << "Loading Steam Cloud details for " << fileCount << " files..." << std::endl;

	for (uint32 x = 0; x < fileCount; x++)
	{
		int fileSize;
		const char *fileName = remoteStore->GetFileNameAndSize(x, &fileSize);
		total += fileSize;
		std::cout << " File #" << x << ": " << fileName << " (" << fileSize << " bytes)" << std::endl;
	}
	std::cout << "Total Size: " << total << std::endl;

Edit:

Code:
Writing new file...
File contents: this is a test file.
	std::cout << "Writing new file...";

	char test[] = "this is a test file.";
	if (!remoteStore->FileWrite("test.txt", test, sizeof(test)))
		std::cout << "Unable to write file." << std::endl;

	std::cout << std::endl;

	char buff[256];
	remoteStore->FileRead("test.txt", buff, sizeof(buff));

	std::cout << "File contents: " << buff << std::endl;

Cool stuff. :)
 Post #39
 5th October 2009
Dennab
September 2009
265 Posts

meh, making progress slow
 Post #40
 5th October 2009
Gold Member
AzuiSleet's Avatar
September 2007
825 Posts
My thread died, but since people seemed interested in the steam API, this is an example of using the ISteamGameServer interface along with the TF2 items interface. http://www.facepunch.com/showthread.php?t=813736
Reply

All times are GMT. The time now is 06:30AM.

Facepunch Studios 2010 - Server 'MARGE'