From f6f6bdafedab08bfba038b8427a62481b9aa3357 Mon Sep 17 00:00:00 2001 From: smtddr Date: Mon, 1 Sep 2014 15:08:16 -0700 Subject: [PATCH] Support PAL/NTSC or international or something... A Tatsunok-vsCapcom(TvC) player in Croatia, using the PAL version the game, was never able to play other people until these changes were made. This is probably how the official servers worked. --- gamespy_qr_server.py | 5 +++++ other/utils.py | 3 +++ 2 files changed, 8 insertions(+) diff --git a/gamespy_qr_server.py b/gamespy_qr_server.py index 2a46034..6f433ba 100644 --- a/gamespy_qr_server.py +++ b/gamespy_qr_server.py @@ -324,6 +324,11 @@ class GameSpyQRServer(object): be = self.sessions[session_id].console != 0 k['publicip'] = str(utils.get_ip(bytearray([int(x) for x in address[0].split('.')]), 0, be)) + if 'publicport' in k and 'localport' in k and k['publicport'] != k['localport']: + self.log(logging.DEBUG, address, "publicport %s doesn't match localport %s, so changing publicport to %s..." \ + % (k['publicport'], k['localport'], str(address[1]))) + k['publicport'] = str(address[1]) + if "statechanged" in k: if k['statechanged'] == "2": # Close server self.server_manager.delete_server(k['gamename'] , session_id) diff --git a/other/utils.py b/other/utils.py index b53fdfd..26f69a7 100644 --- a/other/utils.py +++ b/other/utils.py @@ -75,6 +75,9 @@ def base32_encode(num, reverse=True): encoded += alpha[num & 0x1f] num = num >> 5 + while len(encoded) < 9: + encoded += "0" + if reverse == True: encoded = encoded[::-1] # Reverse string