예제 #1
0
 def decode(self, stream):
     self.game_mode = stream.u32()
     self.session_id = stream.u32()
     self.attributes = stream.repeat(stream.u32, 6)
     self.num_participants = stream.u16()
     self.min_participants = stream.u16()
     self.max_participants = stream.u16()
     if stream.settings.get("pia.version") < 50300:
         self.session_type = stream.u32()
     else:
         self.system_version = stream.u8()
         self.application_version = stream.u8()
         self.session_type = stream.u16()
     self.application_data = stream.read(0x180)
     self.application_data = self.application_data[:stream.u32()]
     self.is_opened = stream.bool()
     if stream.settings.get("pia.version") < 51000:
         self.host_location = stream.extract(StationLocation)
     else:
         type = InetAddress.IPV4
         if stream.settings.get("pia.lan_version") == 2:
             type = InetAddress.IPV6
         self.host_location = StationLocation()
         self.host_location.local = stream.extract(StationAddress, type)
         self.host_location.pid = stream.pid()
         self.host_location.cid = stream.u32()
         self.host_location.rvcid = stream.u32()
     self.players = stream.repeat(lambda: stream.extract(LanStationInfo),
                                  16)
     self.session_param = stream.read(32)
예제 #2
0
    def prepare_station_location(self):
        host = util.local_address()
        port = self.transport.local_address()[1]

        location = StationLocation()
        location.local = StationAddress(host, port)
        location.pid = self.get_principal_id()
        location.cid = random.randint(0, 0xFFFFFFFF)
        location.rvcid = self.generate_session_id()
        location.type = 0
        return location
예제 #3
0
 def __init__(self):
     self.game_mode = None
     self.session_id = None
     self.attributes = [0] * 6
     self.num_participants = 0
     self.min_participants = None
     self.max_participants = None
     self.system_version = None
     self.application_version = None
     self.session_type = None
     self.application_data = b""
     self.is_opened = None
     self.host_location = StationLocation()
     self.stations = [LanStationInfo() for i in range(16)]
     self.session_param = bytes(32)
예제 #4
0
 def prepare_station_location(self):
     location = StationLocation()
     location.set_station_url(self.backend.local_station)
     return location
예제 #5
0
 def join(self, session):
     key = self.matchmake_ext.join_matchmake_session(session.id, "Hello!")
     url = self.matchmaker.get_session_urls(session.id)[0]
     location = StationLocation()
     location.set_station_url(url)
     self.join_mesh(key, location)