Fix title encoding for fivem fixes #83

This commit is contained in:
mmorrison 2018-05-05 03:31:25 -05:00
parent e2c734577a
commit 52ad7b1fd5
2 changed files with 3 additions and 2 deletions

View File

@ -5,6 +5,7 @@ class FiveM extends require('./quake2') {
super();
this.sendHeader = 'getinfo xxx';
this.responseHeader = 'infoResponse';
this.encoding = 'utf8';
}
finish(state) {

View File

@ -12,14 +12,14 @@ class Quake2 extends require('./core') {
this.udpSend('\xff\xff\xff\xff'+this.sendHeader+'\x00', (buffer) => {
const reader = this.reader(buffer);
const header = reader.string({length:4});
const header = reader.string({length:4,encoding:'latin1'});
if(header !== '\xff\xff\xff\xff') return;
let response;
if(this.isQuake1) {
response = reader.string({length:this.responseHeader.length});
} else {
response = reader.string();
response = reader.string({encoding:'latin1'});
}
if(response !== this.responseHeader) return;