FAQ FAQ   Search Search  Register Register   Login Login  
   Main Site   Wiki  



Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

Author Message
 PostPosted: Wed Oct 25, 2006 3:07 pm  Post subject: Bug?
Offline
Round Winner
User avatar

Joined: Sat Apr 15, 2006 2:59 pm
Posts: 291
Location: a random empty server playing with bots
I took a look in the server list at the bottom of the forum and I noticed that the system was showing my nick (°°rain) as °°qain.

odd...

Screenshot attached.


Attachments:
qain.jpg
qain.jpg [ 61.33 KiB | Viewed 877 times ]
Top
Profile
 
 PostPosted: Wed Oct 25, 2006 5:32 pm  Post subject:
Offline
Forum & Project Admin, MEng
User avatar

Joined: Thu Dec 18, 2003 7:03 pm
Posts: 6566
Location: /home/sweden
"Oh my."

Not a clue. Sure that was you? That aside, querying isn't exactly perfect. Not sure what could cause it to be just one letter off...

_________________
Image
Armapitron, a Raspberry Pi port of Armagetron.


Top
Profile
 
 PostPosted: Wed Nov 01, 2006 3:26 pm  Post subject:
Offline
Round Winner
User avatar

Joined: Sat Apr 15, 2006 2:59 pm
Posts: 291
Location: a random empty server playing with bots
yes, it was me.
not worried about it, qain is good for me, just informing...
greetings


Top
Profile
 
 PostPosted: Wed Nov 01, 2006 11:35 pm  Post subject:
Offline
Round Winner
User avatar

Joined: Sat Apr 15, 2006 2:59 pm
Posts: 291
Location: a random empty server playing with bots
Happened again with °°Plato, showed as °°Olato.
Seems that the first letter is changed in one position back after the °°.
For ex rain to qain
lmnop q<----r st
and Plato to Olato
lmn o<----p qrst

greetings


Top
Profile
 
 PostPosted: Thu Nov 02, 2006 1:04 am  Post subject:
Offline
Forum & Project Admin, MEng
User avatar

Joined: Thu Dec 18, 2003 7:03 pm
Posts: 6566
Location: /home/sweden
Just names with the °°?

_________________
Image
Armapitron, a Raspberry Pi port of Armagetron.


Top
Profile
 
 PostPosted: Thu Nov 02, 2006 9:39 am  Post subject:
Offline
A Brave Victim
User avatar

Joined: Thu Feb 03, 2005 12:50 am
Posts: 3362
Location: Not really lurking anymore
Square degrees eat too many resources, including part of the next character. Square radians should solve your problem.

_________________
ˌɑrməˈɡɛˌtrɑn


Top
Profile
 
 PostPosted: Thu Nov 02, 2006 10:07 am  Post subject:
Offline
Round Winner
User avatar

Joined: Sat Apr 15, 2006 2:59 pm
Posts: 291
Location: a random empty server playing with bots
Tank: yea, I've noticed it only in nicks with °°.

Jonathan: as I said, it is not a problem for me. just informating about that. thanks anyway.


Top
Profile
 
 PostPosted: Wed Dec 12, 2007 10:34 pm  Post subject:
Offline
Reverse Outside Corner Grinder
User avatar

Joined: Thu Jun 08, 2006 3:33 pm
Posts: 1602
Location: Indiana, USA, Earth, Milky Way Galaxy, Universe, Multiverse
WRTL has it fixed


Last edited by kyle on Wed Dec 12, 2007 10:48 pm, edited 8 times in total.

Top
Profile
 
 PostPosted: Wed Dec 12, 2007 10:39 pm  Post subject:
Offline
Reverse Outside Corner Grinder
User avatar

Joined: Wed Jan 04, 2006 4:42 am
Posts: 1679
Location: 0x08048000
I finally figured it out:

Arma encodes all network traffic as 16- bit integers. Therefore, to send a string (like the player names), the individual characters are paired together, the first char of each pair becoming the lower byte of the new short, the second thar becoming the upper byte.

At least that's what tank was probably thinking when he originally wrote the script (and nobody noticed it afterwards).

Well, what actually happens is this:
Code:
    char const * sRaw = s;
 
    // write first pairs of bytes
    for(i=0;i+1<len;i+=2)
        Write(sRaw[i]+(sRaw[i+1] << 8));
(nNetwork.cpp:~985)
It multiplies the second char by 256 and adds that to the first char to get the short to be sent. This works alright until the first char gets bigger than 127. Because sRaw is a signed char* sRaw[i] is actually a negative number and gets subtracted from (sRaw[i+1] << 8), therefore causing some mess (the second char's ascii value gets lowered by 1).

Anyways, here's my fix. I don't know exactly how robust/correct/ugly it is, but it appears to work:
Code:
              for ($c = 0; $c < strlen($this->rawpacket); $c = $c + 2)
                {
                        $this->swappedpacket[$c] = $this->rawpacket[$c + 1];
                        $this->swappedpacket[$c + 1] = $this->rawpacket[$c];
                }
becomes
Code:
              for ($c = 0; $c < strlen($this->rawpacket); $c = $c + 2)
                {
                        $this->swappedpacket[$c] = $this->rawpacket[$c + 1];
                        $this->swappedpacket[$c + 1] = $this->rawpacket[$c];
                        if(ord($this->swappedpacket[$c]) > 127) {
                                $this->swappedpacket[$c + 1] = chr(1 + ord($this->swappedpacket[$c + 1])) ;
                        }
                }

_________________
There's no place like ::1


Top
Profile
 
 PostPosted: Thu Dec 13, 2007 1:16 am  Post subject:
Offline
God & Project Admin
User avatar

Joined: Sun Jan 23, 2005 6:01 pm
Posts: 10579
Location: Cologne, Jabber: z-man@amessage.de
Interesting, I did not realize that :)


Top
Profile
 
 PostPosted: Thu Dec 13, 2007 7:44 am  Post subject:
Offline
Reverse Outside Corner Grinder
User avatar

Joined: Wed Jan 04, 2006 4:42 am
Posts: 1679
Location: 0x08048000
I guess it was luck that the receiving code compensates for that ;)

_________________
There's no place like ::1


Top
Profile
 
 PostPosted: Thu Dec 13, 2007 9:35 am  Post subject:
Offline
God & Project Admin
User avatar

Joined: Sun Jan 23, 2005 6:01 pm
Posts: 10579
Location: Cologne, Jabber: z-man@amessage.de
Nah, luck had nothing to do with it :) The sending code uses signed arithmetics, so the receiving code uses signed arithmetics too.


Top
Profile
 
 PostPosted: Thu Dec 13, 2007 5:50 pm  Post subject:
Offline
Forum & Project Admin, MEng
User avatar

Joined: Thu Dec 18, 2003 7:03 pm
Posts: 6566
Location: /home/sweden
I believe what I was thinking was that all the letters in the packets were backwards in pairs of two. I (think) I reverse engineered the master server protocol almost exclusively from packet capturing rather than reading the code. Something like crazy byte swapping never even occurred to me.

_________________
Image
Armapitron, a Raspberry Pi port of Armagetron.


Top
Profile
 
 PostPosted: Thu Dec 13, 2007 6:04 pm  Post subject:
Offline
Reverse Outside Corner Grinder
User avatar

Joined: Wed Jan 04, 2006 4:42 am
Posts: 1679
Location: 0x08048000
It appears to work so I committed it to aabeta. I also changed
Code:
      $query = pack("xCxxxxxC", 0x35, 0x11);
to
Code:
      $query = pack("xCxxxx", 0x35);
. I don't think that extra short is used from anywhere inside arma. Just because it took me a while to figure out, here's what the first shorts of a nMessage mean:
  • Packet “type”
  • Packet ID
  • Length of the actual message
Let me know if it had any meaning…

_________________
There's no place like ::1


Top
Profile
 
 PostPosted: Fri Dec 14, 2007 12:20 pm  Post subject:
Offline
Forum & Project Admin, MEng
User avatar

Joined: Thu Dec 18, 2003 7:03 pm
Posts: 6566
Location: /home/sweden
About that, I don't know. Again, I was just emulating what I saw my client doing.

_________________
Image
Armapitron, a Raspberry Pi port of Armagetron.


Top
Profile
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by two camels and phpBB © 2000, 2002, 2005, 2007 phpBB Group