Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Ilici

DirectPlay problem

This topic is 5719 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

the directX forum is not into dplay so i took this here: i''m using the old style DirectPlayCreate(..) to init DPlay before i do the DirectPlayEnumarate(...) 2 get the guids. after i get the guids, i cannot init Dplay with DirectPlayCreate(...) it gives me DPERR_UNAVAILABLE here is the code
  
include "log.h"

#pragma comment (lib, "dplay.lib")
#pragma comment (lib, "dplayx.lib")
#pragma comment (lib, "dxguid.lib")

LPDIRECTPLAY	dp;

bool	mpIPX		= false;
bool	mpTCPIP		= false;
bool	mpSERIAL	= false;
bool	mpMODEM		= false;

GUID	mpIPXguid;
GUID	mpTCPIPguid;
GUID	mpSERIALguid;
GUID	mpMODEMguid;

BOOL FAR PASCAL mpEnumConnections( 
    LPGUID      lpguidSP,
    LPSTR       lpSPName,
    DWORD       dwMajorVersion,     
    DWORD       dwMinorVersion,
    LPVOID      lpContext)
{

	if (strcmp(lpSPName, "IPX Connection For DirectPlay") == 0)
	{
		mpIPX = true;
		mpIPXguid = *lpguidSP;
		return TRUE;
	}

	if (strcmp(lpSPName, "Internet TCP/IP Connection For DirectPlay") == 0)
	{
		mpTCPIP = true;
		mpTCPIPguid = *lpguidSP;
		return TRUE;
	}

	if (strcmp(lpSPName, "Modem Connection For DirectPlay") == 0)
	{
		mpMODEM = true;
		mpMODEMguid = *lpguidSP;
		return TRUE;
	}

	if (strcmp(lpSPName, "Serial Connection For DirectPlay") == 0)
	{
		mpSERIAL = true;
		mpSERIALguid = *lpguidSP;
		return TRUE;
	}
	return TRUE;
}

int mpGetConnections()
{
	int hr;

	hr = DirectPlayEnumerate(mpEnumConnections, 0);

	if (hr)
	{
		lprintf("Cannot Enumerate SPs\n");
		return SYS_ERR;
	}

	return SYS_OK;
}

int mpInitialize()
{
	if (mpGetConnections()) return SYS_ERR;

	int hr = DirectPlayCreate(&mpIPXguid, &dp, NULL);

	//{685BC400-9D2C-11cf-A9CD-00AA006886E3} GUID in registry and received from Enumerate


	if (hr != DP_OK)
	{
		switch (hr)
		{
			case CLASS_E_NOAGGREGATION :	lprintf("CLASS_E_NOAGGREGATION  "); break;
			case DPERR_EXCEPTION :			lprintf("DPERR_EXCEPTION  ");break;
			case DPERR_INVALIDPARAMS  :		lprintf("DPERR_INVALIDPARAMS  "); break;
			case DPERR_UNAVAILABLE :		lprintf("UNAVAIABLE CONNECTION"); break;
		}

		lprintf("Cannot initialize DirectPlay\n", hr);
		return SYS_ERR;
	}
	
	return SYS_OK;

}

  
i have DX9 i dont like the CoCreateInstance(...) it suxx coz it makes my app multi-threaded and stuff is there a prob with my code or is the damn DX?

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
- You should not use strcmp to find the providers: these strings can be localised and be different than what you expect.

- Use DirectPlay8 which is clearer than the previous versions.

- Check the tutorials in the docs to see how to do it.

I guess what was causing your problem is that you are using a Service Provider GUID to create a DirectPlay interface, and that''s not the way it worked, but my memory is fuzzy about older DPlay versions. In any case, throw all that code away because it is useless (don''t know how to put that nicely, it really IS crap) and restart based on the DX9 samples and tutorials. You''ll be up & running in no time.

Share this post


Link to post
Share on other sites
i took the dx8 samples, compiled them and it doesnt work, but an already compiled sampel works
so.. i think there are problems with the .lib files
dplay.lib and dplayx.lib are from 1998 (;0) and i dont think they work

in the Dx8 sdk there isa only a newer dplayx.lib but not dplay.lib
do i have to update dplay.lib also?

i tried updating dplayx.lib but still it doesnt work

and about strcmp it works fine , i tried it on many computers and the Service PRov for dplay have the same names

again i dont want to use CoCreateInstance because for a simple class init it also stuffs me with 2 more threads for the app

Share this post


Link to post
Share on other sites
ok i moved to dplay8 finally after finding out i cand use DirectPlay8Create

where can i get a decent DirectPlay8 tutorial ? coz dx8 sdk doesnt have tutorials just the code.

teh DX8 SDK samples are extremely stuffed with crap so i''m lookin 4 something simpler.

Share this post


Link to post
Share on other sites
In the DX8 help file it gives some more info on the tutorials. I am using DirectPlay very well, and learned it all from the samples/tutorials. It''s not that hard, and eventually you can make a wrapper class for it to make it even easier.

Share this post


Link to post
Share on other sites
Hi I"m trying to implement directplay using the sdk, but it won''t recognize the commands

CoInitializeEx(NULL, COINIT_MULTITHREADED);


I included all the files that they did in the .cpp of the documentatino. I added all the .lib files in the setting -> linker as well I don''t know if I''m missing something else its just not recognizing it. Can anyone help?

Share this post


Link to post
Share on other sites
try DirectPlay8Create(..)

there are many DirectPlay8Create functions, look for them in the sdk

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!