Page 1 of 1

Using the Network API in your own APP to send control messages

Posted: Sun Jul 01, 2018 5:40 pm
by christdonnelly
Hey guys, apologies if you've already had this request, but I've searched and can't quite find what I'm looking for.

So, viewtopic.php?f=3&t=1163&p=7557&hilit=byte+array#p7557 states how to send an input report over UDP to an instance of GIMX (I'm guessing the instance is running using --src xxx.xxx.xxx.xxx:xxx).

I'm trying to write my own app to communicate with GIMX over 127.0.0.1 - but I'm having trouble connecting or sending the correct messages, so I'm hoping you guys can straighten me out a bit?

Here's my setup:

XBOX 360 is connected to GIMX, GIMX to my Windows PC. XBOX 360 pad is also connected to PC. Software runs fine, as both keyboard and mouse can control the XBOX 360.

I listen on 127.0.0.1:51914 which is set by the gimx launcher UI (input=network)
My VC++ app opens a UDP socket:

Code: Select all

	struct sockaddr_in connectedSocket;
	int length = sizeof(connectedSocket);

	char receiveBuffer[1000];
	char message[1000];

	WSADATA wsa;
	if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0)
	{
		printf("\nFailed. Error Code : %d", WSAGetLastError());
		exit(EXIT_FAILURE);
	}

	//create socket
	if ((s = socket(AF_INET, SOCK_DGRAM, 0)) == SOCKET_ERROR)
	{
		printf("\n\nsocket() failed with error code : %d", WSAGetLastError());
		exit(EXIT_FAILURE);
	}

	//setup address structure
	memset((char *)&connectedSocket, 0, sizeof(connectedSocket));
	connectedSocket.sin_family = AF_INET;
	connectedSocket.sin_port = htons(PORT);
	connectedSocket.sin_addr.S_un.S_addr = inet_addr(SERVER);
Now I enter an endless loop to send my data packets. My recv function here receives 2 bytes -- 0 then 1

I send packets of data:
0xff, (header type)
0x9c (header size + packet size: 39*4)
then the remaining bytes of data to represent the pad state

No response, nothing.

I'm clearly doing something wrong here. I'm expecting either {0x00, 0x00} to query the controller type (where I would answer, then send the data packets), or no commands, so I can just send the data packets.

I would really like to know which steps I need to perform to get this up and running if possible, I've read the Network API page through and through, and the setup wiki.

(Note: I'm using VC++ because of the hardware device I want to send commands to GIMX - it only has VC++ libraries, and it's closed source)

Re: Using the Network API in your own APP to send control messages

Posted: Sun Jul 01, 2018 5:45 pm
by christdonnelly
Just to be clear, I sent a packet with a guide button press state, and a packet with a b button press state, and neither produced a reaction.

Any help is appreciated - I'm aiming to write an application to send messages from various devices I have (even a Kinect) to translate into joypad states, over 127.0.0.1 to a running instance of GIMX which is connected to an XBOX 360 or XBOX One.

All firmware is loaded and correct according to the console, as keyboard and physical device mode work perfectly.

Re: Using the Network API in your own APP to send control messages

Posted: Mon Jul 02, 2018 6:37 pm
by Matlo
Hello,

The packet structure has changed since GIMX 7.1.
http://gimx.fr/wiki/index.php?title=Net ... end_report

Re: Using the Network API in your own APP to send control messages

Posted: Mon Jul 02, 2018 9:23 pm
by christdonnelly
Thanks for the help