Menu

#2 Problems with HL2 Support

open
nobody
None
5
2012-11-25
2010-05-23
Mendez
No

There seems to be a problem with HL2 support.

I think the problem may relate to the string termination byte being missed off from the commands being sent to the server. After having had a poke around rewriting the getDatagram packet function in Util.java seems to have fixed it. I haven't checked whether this breaks any other games.

public static DatagramPacket getDatagramPacket(String request, InetAddress inet, int port) {

ByteBuffer Request = ByteBuffer.allocate(1400);

Charset charset = Charset.forName("ISO-8859-1");

Request.putInt(-1);
Request.put(charset.encode(request));

return new DatagramPacket(Request.array(), 1400, inet, port);
}

The following includes are also now required:

import java.nio.charset.Charset;
import java.nio.*;

Discussion


Log in to post a comment.

MongoDB Logo MongoDB