Author | Message | Time |
---|---|---|
BreW | So on Bnetdocs, I looked up the 0x09 for getting a game list, and apparently there are four "product specific conditions", and it tells you what only the first condition is (game type), and none of the others. Does anyone have any idea what the other three are? | April 1, 2007, 11:43 AM |
Ersan | Try using search before asking dumb questions... | April 1, 2007, 3:24 PM |
BreW | Thanks, ersan. I didn't find out what they're for, but I found a topic of another person trying to parse the 0x09 and he showed his send0x09 sub... i'm still not sure where he got the values for the other 3 product specific parameters but it seems to be working for me. | April 1, 2007, 5:35 PM |
l2k-Shadow | Why don't you use a packet logger and see what the game sends? | April 1, 2007, 6:20 PM |
BreW | Because I have no idea where my starcraft disk is | April 1, 2007, 9:10 PM |
Explicit[nK] | [quote author=brew link=topic=16575.msg167540#msg167540 date=1175461823] Because I have no idea where my starcraft disk is [/quote] That still isn't an excuse. | April 1, 2007, 9:17 PM |
Barabajagal | [code]Packet.ClearOutbound s = &H0 G = &H0 If Config.Game = STAR Or Config.Game = SEXP Or Config.Game = SSHR Or Config.Game = JSTR Then l = &H30 Else l = &H0 End If C = &HFF Packet.InsertDWORD G Packet.InsertDWORD l Packet.InsertDWORD s Packet.InsertDWORD C Packet.InsertNTString GameName Packet.InsertNTString GamePass Packet.InsertNTString ""[/code] | April 1, 2007, 9:27 PM |
BreW | [quote author=[RealityRipple] link=topic=16575.msg167545#msg167545 date=1175462857] [code]Packet.ClearOutbound s = &H0 G = &H0 If Config.Game = STAR Or Config.Game = SEXP Or Config.Game = SSHR Or Config.Game = JSTR Then l = &H30 Else l = &H0 End If C = &HFF Packet.InsertDWORD G Packet.InsertDWORD l Packet.InsertDWORD s Packet.InsertDWORD C Packet.InsertNTString GameName Packet.InsertNTString GamePass Packet.InsertNTString ""[/code] [/quote] There are a number of things I would like to comment about that: 1. For the game statstring, it should not be "". It should be vbNullString, always, for many different reasons. 2. The first "dword" is acually two words: The first being the game type which you want to get the list for, the values for this are the same as in the 0x1C statstring. (for example, 0x000A = Use Map Settings) 3. The last dword is acually the max number of games you want to be returned. 4. "If Config.Game = STAR Or Config.Game = SEXP Or Config.Game = SSHR Or Config.Game = JSTR Then" Uh.... you should consider using short circuit evaluation or nested ifs. [code] Public Sub Send0x09() With pbuffer .InsertWORD &HA 'Product Specific 1 .InsertWORD 0 'Product Specific 2 .InsertDWORD &H1F 'Product Specific 3 .InsertDWORD 0 'Product Specific 4 .InsertDWORD 10 'Max games .InsertNTString vbNullString 'Game Name .InsertNTString vbNullString 'Game Password .InsertNTString vbNullString 'Game Statstring .sendPacket &H9 End With AddChat vbYellow, "Sending 0x09..." End Sub [/code] is the code I'm using. Thank you for helping, reality. | April 2, 2007, 1:27 AM |
Barabajagal | What I have works just fine for listing all games. The last DWord (C) is not max games for D1, it's what level to display at. When set to &HFF, it lists games for all levels, and lists all games for all other clients. As for not using vbNullString... I don't know why I didn't. Momentary lapse of reason I guess. | April 2, 2007, 1:44 AM |
warz | "" equates to a 'null string', most likely. i'd assume it's just the null byte, as well as vbnullstring. | April 2, 2007, 2:14 AM |
Barabajagal | No, "" is not a null string in Visual Basic. We've already had this discussion. | April 2, 2007, 2:55 AM |
warz | [quote author=[RealityRipple] link=topic=16575.msg167555#msg167555 date=1175482550] No, "" is not a null string in Visual Basic. We've already had this discussion. [/quote] So, what does it equate to? | April 2, 2007, 3:11 AM |
Barabajagal | A null terminator (00) I guess? Read in this topic for more info. Edit: There was another topic somewhere else where we went more in depth with it, but I can't find it... | April 2, 2007, 3:16 AM |
warz | [quote author=[RealityRipple] link=topic=16575.msg167559#msg167559 date=1175483794] A null terminator (00) I guess? Read in this topic for more info. Edit: There was another topic somewhere else where we went more in depth with it, but I can't find it... [/quote] Assuming we're talking about string related functions, is a single null terminating byte not a null string? A function looking for the null terminator in a string would stop on the first byte either way. '00' (a null terminator) and '00 00 00 00' (a null terminated array of null bytes) are both evaluated as a single null terminator, or null string (meaning a string with no content, other than the terminator) which might look like "" in-code. So, you know that "" does not equate to a null string, but you say it equates to a null terminator? What's the difference? Edit: After reading that post, I now know that visual basic stores strings as unicode. | April 2, 2007, 3:45 AM |
Barabajagal | "" takes up memory, vbNullString doesn't. Edit: http://forums.devx.com/showthread.php?t=70074 might clear some things up. | April 2, 2007, 3:47 AM |
warz | [quote author=[RealityRipple] link=topic=16575.msg167561#msg167561 date=1175485660] "" takes up memory, vbNullString doesn't. Edit: http://forums.devx.com/showthread.php?t=70074 might clear some things up. [/quote] both take up memory. unicode strings just take up a lot more. 4 + (length_of_string * 2), in fact. so, the header of a unicode string would be why "" would not equate to a single null terminating byte. | April 2, 2007, 3:56 AM |
Barabajagal | Did you even read the link? | April 2, 2007, 4:04 AM |
UserLoser | Brew, find your Starcraft CD and get to work. There's plenty of information out there about this message and it has been covered numerous of times. [quote author=[RealityRipple] link=topic=16575.msg167555#msg167555 date=1175482550] No, "" is not a null string in Visual Basic. We've already had this discussion. [/quote] Truth spoken | April 2, 2007, 5:40 PM |
warz | No, I didn't read the forum link you gave, but I read this, more helpful, page - http://www.aivosto.com/vbtips/stringopt2.html#memorylayout | April 2, 2007, 6:31 PM |
BreW | [quote author=UserLoser link=topic=16575.msg167573#msg167573 date=1175535656] Brew, find your Starcraft CD and get to work. There's plenty of information out there about this message and it has been covered numerous of times. [/quote] If there's plenty of information out there about this message, then how come I have to find my Starcraft CD and get to work? Shouldn't I just be able to use the search feature of this forum? Also... [code] FF 09 75 04 'header 0A 00 'game type 00 00 'parameter 0A 00 01 00 'unknown 09 04 'address family 00 00 02 00 'address family? C5 2C 'port? A2 53 66 3F 'ip address 00 00 00 00 'sin_zero 00 00 00 00 'sin_zero 04 00 00 00 'game status 45 00 00 00 'elapsed time 31 32 30 30 30 20 68 79 64 72 61 73 21 21 20 44 4F 4E 54 20 53 55 43 00 'game name 00 'game password 2C 31 34 2C 31 37 2C 36 2C 2C 61 2C 2C 31 2C 62 66 37 39 33 33 61 61 2C 36 2C 2C 78 44 61 4E 0D 07 48 79 64 72 61 6C 69 73 6B 20 41 74 74 61 63 6B 20 31 32 2C 30 30 30 0D 00 'game statstring [/code] According to bnet docs, half of the IP Address is really where the port would be, same with the address family.. etc, just doesn't make sense. Check for yourself. When really, I believe bnetdocs just might be wrong. I would have posted something about it there, but it doesn't allow the creation of new accounts.... go figure.... and someone PLEASE fix the documentation on the S > C 0x09. | April 2, 2007, 10:17 PM |
Barabajagal | Working on the Receive side now? Here's my crappy way of doing it: [code]Private Sub SID_Recv_GETADVLISTEX() Dim GameType() As Long Dim param() As Long Dim IP() As String Dim Status() As Long Dim Time() As Long Dim GameName() As String Dim Pass() As String Dim Statstring() As String Dim GameCount As Long Dim I As Long Dim tmp As Variant Dim NewData As String Dim TmpPort As Long Dim TmpIP As String On Error GoTo Erred GameCount = Packet.GetDWORD If GameCount = 0 Then Select Case Packet.GetDWORD Case 1 RaiseEvent BNetError("Game Doesn't Exist") Case 2 RaiseEvent BNetError("Incorrect Password") Case 3 RaiseEvent BNetError("Game Full") Case 4 RaiseEvent BNetError("Game Already Started") Case 6 RaiseEvent BNetError("Too Many Server Requests") Case Else RaiseEvent BNetError("Unknown Game Error") End Select Else For I = 0 To GameCount - 1 ReDim Preserve GameType(I) As Long ReDim Preserve param(I) As Long ReDim Preserve IP(I) As String ReDim Preserve Status(I) As Long ReDim Preserve Time(I) As Long ReDim Preserve GameName(I) As String ReDim Preserve Pass(I) As String ReDim Preserve Statstring(I) As String GameType(I) = Packet.GetWORD param(I) = Packet.GetWORD tmp = Packet.GetDWORD tmp = Packet.GetWORD TmpPort = htons(Packet.GetWORD) TmpIP = Packet.GetString(4) IP(I) = Asc(Mid$(TmpIP, 1, 1)) & "." & _ Asc(Mid$(TmpIP, 2, 1)) & "." & _ Asc(Mid$(TmpIP, 3, 1)) & "." & _ Asc(Mid$(TmpIP, 4, 1)) & ":" & TmpPort tmp = Packet.GetDWORD tmp = Packet.GetDWORD Status(I) = Packet.GetDWORD Time(I) = Packet.GetDWORD GameName(I) = Packet.GetNTString Pass(I) = Packet.GetNTString Statstring(I) = Packet.GetNTString If Config.Game = WAR3 Or Config.Game = W3XP Then DecodeMapData Mid$(Statstring(I), 2), NewData Statstring(I) = Mid$(NewData, 21) End If Next I RaiseEvent GameListing(GameType(), param(), IP(), Status(), Time(), GameName(), Pass(), Statstring()) End If Exit Sub Erred: RaiseEvent CritError(Err.Description, Err.Number, Err.Source, "SID_Recv_GETADVLISTEX") End Sub[/code] A few notes: htons is an API call ( Private Declare Function htons Lib "wsock32.dll" (ByVal hostshort As Long) As Long ), anything that says tmp=something means the value isn't important (I set it to a variable to make debug.print easier and see what they are). DecodeMapData is a function I found on here (I think it was in Java and I had to port it to VB). Edit: Some more notes I forgot to mention: The first unknown (DWORD) is the Language ID (Like 1033 (0x409) for enUS). The second unknown (WORD) is usually 2. The last two (DWORDS) are usually 0's. | April 2, 2007, 10:36 PM |
UserLoser | [quote author=brew link=topic=16575.msg167580#msg167580 date=1175552231] According to bnet docs, half of the IP Address is really where the port would be, same with the address family.. etc, just doesn't make sense. Check for yourself. When really, I believe bnetdocs just might be wrong. I would have posted something about it there, but it doesn't allow the creation of new accounts.... go figure.... and someone PLEASE fix the documentation on the S > C 0x09. [/quote] Last time I checked there was nothing wrong with the documentation on S->C 0x09. What does BnetDocs say as opposed to that log you just posted? I can't view BnetDocs at the moment. That log you posted with comments next to it look ok, are those comments lining up with the formatting BnetDocs has? | April 3, 2007, 1:36 AM |
Barabajagal | http://www.aznsoulja.com/bnetdocs/content8e9c.html?Section=m&Code=10 Except, the third field (Unknown) is the language ID of the game creator. | April 3, 2007, 1:53 AM |
BreW | [quote author=UserLoser link=topic=16575.msg167586#msg167586 date=1175564169] Last time I checked there was nothing wrong with the documentation on S->C 0x09. What does BnetDocs say as opposed to that log you just posted? I can't view BnetDocs at the moment. That log you posted with comments next to it look ok, are those comments lining up with the formatting BnetDocs has? [/quote] No, They are not. According to bnet docs, this would how the data would be parsed: [code] For each list item: (WORD) Game Type (WORD) Parameter (DWORD) Unknown (WORD) Address Family (Always AF_INET) (WORD) Port (DWORD) Host's IP (DWORD) sin_zero (0) (DWORD) sin_zero (0) (DWORD) Game Status (DWORD) Elapsed time (in seconds) (STRING) Game name (STRING) Game password (STRING) Game statstring FF 09 75 04 'header 0A 00 'game type 00 00 'parameter 0A 00 01 00 'unknown 09 04 'address family 00 00 'port <---this is where i knew it had to be wrong, the port just can't be 0. 02 00 C5 2C 'hosts ip A2 53 66 3F 'sin_zero 00 00 00 00 'sin_zero 00 00 00 00 'game status 04 00 00 00 'elapsed time 45 00 00 00 31 32 30 30 30 20 68 79 64 72 61 73 21 21 20 44 4F 4E 54 20 53 55 43 00 'game name 00 'game password 2C 31 34 2C 31 37 2C 36 2C 2C 61 2C 2C 31 2C 62 66 37 39 33 33 61 61 2C 36 2C 2C 78 44 61 4E 0D 07 48 79 64 72 61 6C 69 73 6B 20 41 74 74 61 63 6B 20 31 32 2C 30 30 30 0D 00 'game statstring [/code] As you can obviously see, this is an entire 4 bytes off! very misleading. And btw, thank you Reality for the help with parsing it. | April 3, 2007, 1:54 AM |
Barabajagal | Brew... you're reading the documentation wrong. The header is followed by a DWORD with the number of games listed. | April 3, 2007, 2:04 AM |
UserLoser | [quote author=[RealityRipple] link=topic=16575.msg167590#msg167590 date=1175565861] Brew... you're reading the documentation wrong. The header is followed by a DWORD with the number of games listed. [/quote] lol ::) | April 3, 2007, 2:23 AM |
BreW | oops...... ::) Then I assume the game type would be.... the first part of the "unknown". okay thank you lol :( i feel like a moron (which i should) | April 3, 2007, 7:18 PM |