Remove legacy network code
This commit is contained in:
@@ -1,13 +1,6 @@
|
||||
StepMania has a few compile flags that are helpful to know, as well as one
|
||||
inherited from sm-ssc that should be nuked.
|
||||
|
||||
================================================================================
|
||||
stepmania:
|
||||
================================================================================
|
||||
WITHOUT_NETWORKING
|
||||
Disables all networking stuff (e.g. StepMania Online).
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
================================================================================
|
||||
sm-ssc:
|
||||
================================================================================
|
||||
|
||||
@@ -1,466 +0,0 @@
|
||||
|
||||
PRELIMINARY - - - - - - - - 05/03/2004
|
||||
Protocol version 4
|
||||
But 0x04 will be its version for inter-protocol purposes.
|
||||
|
||||
This protocol is only intended to replace current protocol. Because current protocol
|
||||
not expanable
|
||||
|
||||
SMLAN PROTCOL TCP/8765
|
||||
|
||||
Protcol is entirelly packaged in EzSockets Data Packets (use send and receive packet)
|
||||
|
||||
This will prevent any out-of-sync errors with future or past versions.
|
||||
|
||||
The protocol is impervious to fragmented, or bonded TCP packets.
|
||||
|
||||
Basic Representation:
|
||||
|
||||
Octet 0123 4 5
|
||||
+----+-+---//--+
|
||||
|ssss|C|Payload|
|
||||
+----+-+---//--+
|
||||
|
||||
ssss - size of packet, handled by ezsockets (if you're using C++)
|
||||
C - Command.
|
||||
Payload - variable size based on command
|
||||
|
||||
The payload may contain more data than expected, i.e. new protocol version.
|
||||
|
||||
|
||||
In the following protocol, the term size means the size of the chunk of data.
|
||||
If the "size" is "NT" then that means it's a null-terminating string.
|
||||
"MSN" most significant 4 bits (byte/16)
|
||||
"LSN" least significant 4 bits (byte%16)
|
||||
|
||||
|
||||
Note: Primary player is 0x0, secondary player is 0x1
|
||||
|
||||
CLIENT to SERVER protocol:
|
||||
|
||||
000: No Operation
|
||||
Desc: This command will cause server to respond with a no op response.
|
||||
Payload: None
|
||||
Response: Server 001
|
||||
|
||||
001: No Operation Response
|
||||
Desc: This command is used to respond to a no operation.
|
||||
Payload: None
|
||||
Response: None
|
||||
|
||||
002: Hello
|
||||
Desc: This is the first packet from a client to server, stating below
|
||||
information (NOTE: Names are no longer sent in this packet)
|
||||
Payload:
|
||||
Size Description:
|
||||
1 Client protocol version
|
||||
NT Name of build of StepMania
|
||||
Response: Server 002
|
||||
|
||||
|
||||
|
||||
003: Game Start Request
|
||||
Desc: This command is called once after most loading is done, and
|
||||
again immediately before the sound starts.
|
||||
Payload:
|
||||
Size Description
|
||||
MSN Primary player difficulty (feet) (0 for no player)
|
||||
LSN Secondary player difficulty (feet) (0 for no player)
|
||||
MSN Primary player difficulty (0=Beginner, 1=easy, etc.)
|
||||
LSN Second player difficulty (0=Beginner, 1=easy, etc.)
|
||||
MSN Start Position (0 is pre-sync, 1 is for sync)
|
||||
LSN Reserved
|
||||
NT Song Title
|
||||
NT Song Subtitle
|
||||
NT Song Artist
|
||||
NT Course Title (If none exists; make it just a null)
|
||||
NT Song Options (in string-format)
|
||||
NT Primary Player's options (Null if non-existant)
|
||||
NT Secondary Player's Options (Null if non-existant)
|
||||
|
||||
Response: Server 003
|
||||
|
||||
|
||||
004: Game Over Notice
|
||||
Desc: This command is sent when end of game is encounterd
|
||||
Payload: None.
|
||||
Response: None.
|
||||
|
||||
005: Game Status update
|
||||
Desc: Updates game info for each step
|
||||
Payload:
|
||||
Size Description
|
||||
MSN Player #
|
||||
Protocol <= 2
|
||||
LSN StepID
|
||||
1: Miss
|
||||
2: W5
|
||||
3: W4
|
||||
4: W3
|
||||
5: W2
|
||||
6: W1
|
||||
7: LetGo
|
||||
8: Held
|
||||
Protocol >= 3
|
||||
LSN StepID
|
||||
1: HitMine
|
||||
2: AvoidMine
|
||||
3: Miss
|
||||
4: W5
|
||||
5: W4
|
||||
6: W3
|
||||
7: W2
|
||||
8: W1
|
||||
9: LetGo
|
||||
10: Held
|
||||
|
||||
MSN Projected Grade (StepMania enum int)
|
||||
LSN Reserved
|
||||
4 Net-order long containing score.
|
||||
2 Net-order int containing combo.
|
||||
2 Net-order int containing health.
|
||||
2 Net-order # containing offset
|
||||
32767 would be DEAD on the note
|
||||
If the user is hitting late, the # will be higher
|
||||
It if the user is exactly 0.25 seconds off, the
|
||||
number will be different by 500, if 0.5, it will be
|
||||
different by 1000.
|
||||
Response: None.
|
||||
|
||||
006: Style Update (PLEASE NOTE THIS HAS NOTHING TO DO WITH SERVER COMMAND 6)
|
||||
Desc: This is sent when a style is chosen.
|
||||
Size:
|
||||
1 # of enabled players (1 means 1, 2 means 2)
|
||||
1 Player # (0 means 1st, 1 means 2nd)
|
||||
NT Player Name for #
|
||||
(Additional player's and #'s) (enabled players ONLY)
|
||||
|
||||
Response: None
|
||||
|
||||
007: Chat message
|
||||
Desc: The user typed a message for general chat.
|
||||
Size:
|
||||
NT Message
|
||||
|
||||
008: Request Start Game and Tell server existance/non existance of song.
|
||||
Desc: The user selected a song on a Net-enabled selection
|
||||
Size:
|
||||
1 Usage of message
|
||||
0: (in response to server 8) User has specified song
|
||||
1: (in response to server 8) User does NOT have specified song
|
||||
2: User requested a start game on given song
|
||||
NT Song Title (As gotten by GetTranslitMainTitle)
|
||||
NT Song Artist (As Gotten by GetTranslitArtist)
|
||||
NT Song Subtitle (As gotten by GetTranslitSubTitle)
|
||||
|
||||
009: //Reserved
|
||||
|
||||
010: User entered/exited Network Music Selection Screen
|
||||
Size:
|
||||
1
|
||||
0: exited ScreenNetSelectMusic
|
||||
1: entered ScreenNetSelectMusic
|
||||
2: **Not Sent**
|
||||
3: entered options screen
|
||||
4: exited the evaluation screen
|
||||
5: entered evaluation screen
|
||||
6: exited ScreenNetRoom
|
||||
7: entered ScreenNetRoom
|
||||
|
||||
011: User has changed player options
|
||||
Size:
|
||||
NT Player 0's options
|
||||
NT Player 1's options
|
||||
|
||||
|
||||
012: SMOnline Packet. //SPECIAL CASE!!!
|
||||
NOTE: The smonline packet is not defined here.
|
||||
The SMLan packet 12 is a wrapper for the SMOnline packet.
|
||||
This is so that we can have "protection" of sorts when
|
||||
it comes to the coding of SMOnline, so we don't have to
|
||||
use the lower level commands when dealing with SMOnline.
|
||||
Size:
|
||||
1 SMOnline command //This used to say 2, but it looks like 1 in all cases
|
||||
<VARIABLE> SMOnline data
|
||||
|
||||
|
||||
013: Reserved
|
||||
|
||||
014: Reserved
|
||||
|
||||
015: XML Packet. This packet contains data in XML format.
|
||||
Size:
|
||||
NT XML
|
||||
|
||||
SERVER to CLIENT protocol: (begins at 128)
|
||||
|
||||
NOTE: Server responses always add 128, thus a server response for no operation
|
||||
is 128, not 000
|
||||
|
||||
000(128):No Operation
|
||||
Desc: This command will cause server to respond with a no op response.
|
||||
Payload: None
|
||||
Response: Server 001
|
||||
|
||||
001(129):No Operation Response
|
||||
Desc: This command is used to respond to a no operation.
|
||||
Payload: None
|
||||
Response: None
|
||||
|
||||
002(130):Server Hello Response
|
||||
Desc: This introduces the server.
|
||||
Payload:
|
||||
Size Description
|
||||
1 Server protocol version //NOTE: if protocol version is 128+, then this
|
||||
server is an SMOnline server
|
||||
NT Server Name
|
||||
4 Random key ( at the moment only used for an alternate login method )
|
||||
|
||||
003(131):Allow Start
|
||||
Desc: This will cause the client to start the game.
|
||||
Payload: None
|
||||
Response: None
|
||||
|
||||
004(132):Game over stats
|
||||
Desc: this packet is send in response to the game over packet
|
||||
it contains information regarding how well each player did.
|
||||
Payload:
|
||||
1 # of players sent in this packet (active players)
|
||||
The way this works is to send every player's info for a given
|
||||
field. Like every player's score will be sent first, then every
|
||||
player's grade.
|
||||
1 First player's player ID
|
||||
<Other player's IDs>
|
||||
4 Score
|
||||
<Other player's scores>
|
||||
1 Grade
|
||||
<Other player's Grades>
|
||||
1 Difficulty (0=beginner, 1=light, etc.)
|
||||
<Other player's difficulties>
|
||||
|
||||
#this next chunk of step types is actually reversed
|
||||
2 miss
|
||||
<Other player's misses>
|
||||
2 boo
|
||||
<Other player's boos>
|
||||
2 good (All players)
|
||||
2 great (All players)
|
||||
2 perfect (All players)
|
||||
2 marvelous (All players)
|
||||
|
||||
2 ok (All players)
|
||||
2 max_combo (All players)
|
||||
NT Player's options
|
||||
<Other player's options>
|
||||
|
||||
|
||||
005:(133)Scoreboard update
|
||||
Desc: This will update the client's scoreboard.
|
||||
Payload:
|
||||
Size
|
||||
1 Which section
|
||||
0: Names
|
||||
1: Combos
|
||||
2: Projected Grades
|
||||
1 # of players to display
|
||||
|
||||
If Names, then:
|
||||
1 Player in first place's index
|
||||
1 Player in second place's index
|
||||
...
|
||||
1 Last player's index
|
||||
If Combos, then:
|
||||
2 First player's combo
|
||||
2 Second Player's combo
|
||||
...
|
||||
2 Last player's combo
|
||||
If Project grades
|
||||
1 Player 1's grade (in the same format used when reporting projected grades)
|
||||
1 Player 2's grade
|
||||
...
|
||||
1 Last player's projected grade
|
||||
|
||||
|
||||
006:(134)System Message (PLEASE NOTE THIS HAS NOTHING TO DO WITH CLIENT COMMAND 6)
|
||||
Desc: Send system message to user
|
||||
Payload:
|
||||
Size Description
|
||||
NT Message
|
||||
|
||||
007:(135)Chat Message
|
||||
Desc: Add a chat message to the chat window on some StepMania screens.
|
||||
Payload:
|
||||
Size Description
|
||||
NT Message
|
||||
|
||||
008:(136)Tell client to start song/ask if client has song
|
||||
Desc: The user selected a song on a Net-enabled selection
|
||||
Size:
|
||||
1 Usage of message
|
||||
0: See if client has song
|
||||
1: See if client has song, if so, scroll to song
|
||||
2: See if client has song, if so, scroll to song, and play that song
|
||||
3: Blindly start song
|
||||
NT Song Title (As gotten by GetTranslitMainTitle)
|
||||
NT Song Artist (As Gotten by GetTranslitArtist)
|
||||
NT Song Subtitle (As gotten by GetTranslitSubTitle)
|
||||
|
||||
009:(137)Update user list
|
||||
Desc: This sends all the users currently connected
|
||||
Size:
|
||||
1 Max # of players
|
||||
1 # of players in this packet
|
||||
1 Player 0's status
|
||||
NT Player 0's name (if there is no player here... make it a null (""))
|
||||
1 Player 1's status
|
||||
NT Player 1's name
|
||||
...
|
||||
1 Last player's status
|
||||
NT Last player's name
|
||||
Status:
|
||||
0 Inative (no info on this user yet)
|
||||
1 Active (you know who it is)
|
||||
2 In Selection Screen
|
||||
3 In Options
|
||||
4 In Evaluation
|
||||
|
||||
010:(138)Force change to Networking select music screen.
|
||||
Size:
|
||||
NT Set Specified gametype
|
||||
NT Set Specified style
|
||||
|
||||
011:(139)Reserved
|
||||
|
||||
|
||||
012:(140)SMOnline Packet. //SPECIAL CASE!!!
|
||||
NOTE: The smonline packet is not defined here.
|
||||
The SMLan packet 12 is a wrapper for the SMOnline packet.
|
||||
This is so that we can have "protection" of sorts when
|
||||
it comes to the coding of SMOnline, so we don't have to
|
||||
use the lower level commands when dealing with SMOnline.
|
||||
Size:
|
||||
1 SMOnline command
|
||||
<VARIABLE> SMOnline data
|
||||
|
||||
|
||||
013:(141)Formatted information packet
|
||||
Desc: Send formatted information regarding the server back to the player.
|
||||
NOTE: The purpose of this function is alternatively to be a broadcast
|
||||
packet. (You can expect it via UDP broadcast)
|
||||
Size:
|
||||
NT Server Name
|
||||
2 Port the server is listening on
|
||||
2 Number of players connected
|
||||
|
||||
014:(142)Attack Client
|
||||
Size:
|
||||
1 Player Number
|
||||
4 Time to Last (in MS)
|
||||
NT Text describing modifiers.
|
||||
|
||||
015:(143) XML reply. Contains XML
|
||||
Size:
|
||||
NT XML
|
||||
|
||||
|
||||
----------------------------------------------------------------
|
||||
Client SMOnline packets:
|
||||
000: Send Login Information
|
||||
Size:
|
||||
1 Player Number
|
||||
1 Encryption text
|
||||
0: MD5 hash
|
||||
1: MD5 ( MD5 hash + salt ) (salt is plain text, base 10 string )
|
||||
NT Username
|
||||
NT Password
|
||||
|
||||
Note: The client is not permitted to use method (1) for authentication
|
||||
if the salt it received from the server is 0
|
||||
|
||||
001: User asks to enter room
|
||||
Size:
|
||||
1 Enter/Exit?
|
||||
0: User wishes to exit room
|
||||
1: User wishes to enter room
|
||||
NT Room Name (Used when entering rooms)
|
||||
NT Password (Empty if password not used)
|
||||
|
||||
002: Create a new Room
|
||||
Size:
|
||||
1 Room Type
|
||||
0: Normal room (has sub rooms)
|
||||
1: Game room (no sub rooms)
|
||||
NT Room Title
|
||||
NT Room Description
|
||||
NT Room Password (blank if no password)
|
||||
|
||||
003: Requests Room Info
|
||||
Size:
|
||||
NT Room Name
|
||||
|
||||
|
||||
Server SMOnline packets:
|
||||
000: Login Response
|
||||
1 Approval Status
|
||||
0: Approved
|
||||
1: Approval Failed
|
||||
NT Login response (plain text)
|
||||
|
||||
001: Room Update (Changing rooms)
|
||||
Size:
|
||||
1 Type of update
|
||||
0: Change Room Title
|
||||
1: Update List of other rooms (or games)
|
||||
|
||||
If Room Title Update:
|
||||
NT Room Title
|
||||
NT Room Description
|
||||
1 Type of room:
|
||||
0: Chat room
|
||||
1: Game room
|
||||
1 Allows creation of sub room.
|
||||
0: Does not allow creation of subrooms
|
||||
1: Allows creation of subrooms
|
||||
|
||||
If Room List Update:
|
||||
1 Number of rooms
|
||||
NT Room1 Title
|
||||
NT Room1 Description
|
||||
NT Room2 Title
|
||||
NT Room2 Description
|
||||
...
|
||||
NT RoomN Title
|
||||
NT RoomN Description
|
||||
|
||||
Room Status appended for reverse compatibility
|
||||
1 Room1 Status
|
||||
0: Normal Room
|
||||
1: Unused
|
||||
2: Room in game
|
||||
3: First stage of song selection has been done
|
||||
4: Second stage of song selection has been done
|
||||
1 Room2 Status
|
||||
...
|
||||
1 RoomN Status
|
||||
|
||||
Room Flags appended for reverse compatibility
|
||||
1 Room1 Flags
|
||||
bit 0: Passworded if true
|
||||
1 Room2 Status
|
||||
...
|
||||
1 RoomN Status
|
||||
|
||||
002: Request general information from server.
|
||||
1 Format for stats
|
||||
0: Normal unformatted stats
|
||||
|
||||
003: Room Info
|
||||
Size:
|
||||
NT Last Song Title
|
||||
NT Last Song Subtitle
|
||||
NT Last Song Artist
|
||||
1 Num Players
|
||||
1 Max Players
|
||||
NT Player1 Name
|
||||
...
|
||||
NT PlayerN Name
|
||||
@@ -1,554 +0,0 @@
|
||||
A re-writing of the SMLan Protocol, because I wish to understand it in
|
||||
my own words. -aj
|
||||
|
||||
Protocol version: 0x04 (v4)
|
||||
This has nothing to do with the server versions (see below)
|
||||
|
||||
==Client Versions==
|
||||
(NETPROTOCOLVERSION in NetworkSyncManager.h)
|
||||
1: StepMania 3.9 (SMLan?)
|
||||
2: StepMania 3.95
|
||||
3: StepMania 4 alphas, sm-ssc v1.0-v1.2.5, StepMania 5
|
||||
|
||||
==Server Versions==
|
||||
1: SMLan (old)
|
||||
128: SMOnline
|
||||
129: SMOnline with "better song identification using chart hashes"
|
||||
|
||||
==Notes==
|
||||
I use the term "client" and "player" interchangeably.
|
||||
The original document used "client" and "user" interchangeably.
|
||||
|
||||
These two notes are from the SMOCaml project:
|
||||
https://sourceforge.net/projects/smocaml/
|
||||
|
||||
Command S2C 004 (132): The data from miss to marvelous are reversed
|
||||
|
||||
Commands C2S 012-001 and 012-001: when there is no password the 'password' field
|
||||
isn't sended at all, not even a NULL character
|
||||
|
||||
==Information==
|
||||
The default port is 8765/tcp, though this is actually assigned to Ultraseek HTTP
|
||||
by the IANA (see http://www.iana.org/assignments/port-numbers).
|
||||
|
||||
A modern/official online server for StepMania will use the currently unassigned
|
||||
port 48040/tcp (and/or udp if the need arises). (Port number subject to change.)
|
||||
|
||||
The protocol is packaged in "EzSockets Data Packets".
|
||||
|
||||
A basic representation
|
||||
|
||||
0123 4 5...... [Octets]
|
||||
+----+-+---//--+
|
||||
|ssss|C|Payload| [data]
|
||||
+----+-+---//--+
|
||||
where:
|
||||
ssss = Size of packet (handled by EzSockets if using C++)
|
||||
C = Command
|
||||
Payload = (variable size based on command)
|
||||
|
||||
The payload may contain more data than expected, for instance, if it's a new
|
||||
protocol version.
|
||||
|
||||
"Size" refers to the size of the data chunk.
|
||||
Some commonly referred to size types:
|
||||
NT = Null-terminated string
|
||||
MSN = Most significant 4 bits (byte/16)
|
||||
LSN = Least significant 4 bits (byte%16)
|
||||
|
||||
The primary player is 0x0, secondary is 0x1. This does not take into account
|
||||
Multiplayer notefields.
|
||||
|
||||
==[ Client -> Server Communication Protocol ]===================================
|
||||
0x00 (000) No Operation
|
||||
This command will case the server to respond with a nop.
|
||||
|
||||
Payload: None
|
||||
Expected response: Server 0x01 (001)
|
||||
________________________________________________________________________________
|
||||
0x01 (001) No Operation Response
|
||||
This command is used to respond to a no operation.
|
||||
|
||||
Payload: None
|
||||
Expected response: None
|
||||
________________________________________________________________________________
|
||||
0x02 (002) Hello
|
||||
This is the first packet a client sends to the server.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Client Protocol Version (see Client Versions above)
|
||||
NT StepMania build name (PRODUCT_ID)
|
||||
|
||||
Expected response: Server 0x02 (002)
|
||||
________________________________________________________________________________
|
||||
0x03 (003) Game Start Request
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
MSN Primary Player Meter [0 if no player]
|
||||
LSN Secondary Player Meter [0 if no player]
|
||||
MSN Primary Player Difficulty
|
||||
0 = Beginner
|
||||
1 = Easy
|
||||
2 = Medium
|
||||
3 = Hard
|
||||
4 = Expert
|
||||
LSN Secondary Player Difficulty (values same as primary)
|
||||
MSN Start Position:
|
||||
0 = pre-sync
|
||||
1 = sync
|
||||
LSN Reserved
|
||||
NT Song Title
|
||||
NT Song Subtitle
|
||||
NT Song Artist
|
||||
NT Course Title (null if doesn't exist)
|
||||
NT Song options string
|
||||
NT Primary player's options (null if doesn't exist)
|
||||
NT Secondary player's options (null if doesn't exist)
|
||||
|
||||
Expected response: Server 0x03 (003)
|
||||
________________________________________________________________________________
|
||||
0x04 (004) Game Over Notice
|
||||
Sent when end of game is encountered. I think technically this is round over.
|
||||
|
||||
Payload: None
|
||||
Expected response: None (though later in the document you'd assume Server 0x04)
|
||||
________________________________________________________________________________
|
||||
0x05 (005) Game Status Update
|
||||
|
||||
The payload changes between protocols, and it will likely have to change again
|
||||
to account for some more StepIDs.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
MSN Player Number
|
||||
LSN StepID
|
||||
(if Protocol >= 3)
|
||||
1 = HitMine
|
||||
2 = AvoidMine
|
||||
3 = Miss
|
||||
4 = W5
|
||||
5 = W4
|
||||
6 = W3
|
||||
7 = W2
|
||||
8 = W1
|
||||
9 = LetGo
|
||||
10 = Held
|
||||
|
||||
(if Protocol <= 2; Don't support these in any new server software)
|
||||
1 = Miss
|
||||
2 = W5
|
||||
3 = W4
|
||||
4 = W3
|
||||
5 = W2
|
||||
6 = W1
|
||||
7 = LetGo
|
||||
8 = Held
|
||||
|
||||
MSN Projected Grade (StepMania enum int, which can cause problems with themes.)
|
||||
LSN Reserved (so discuss it with people if changing)
|
||||
0x04 Score (net-order long)
|
||||
0x02 Combo (net-order int; songs with large combos may cause issues?)
|
||||
0x02 Health (net-order int)
|
||||
0x02 Offset (net-order number. huh)
|
||||
32767 would be DEAD on the note
|
||||
If the user is hitting late, the # will be higher.
|
||||
It if the user is exactly 0.25 seconds off, the number will be
|
||||
different by 500. With this pattern 0.5 seconds gives a difference of 1000.
|
||||
|
||||
Expected response: None
|
||||
________________________________________________________________________________
|
||||
0x06 (006) Style Update
|
||||
!IMPORTANT! This command is unrelated to Server Command 0x06 (006). !IMPORTANT!
|
||||
This is sent when a style is chosen.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Number of enabled players (1 or 2)
|
||||
0x01 Player Number (0 = P1, 1 = P2)
|
||||
NT Player name for specified player number
|
||||
|
||||
Expected response: None
|
||||
________________________________________________________________________________
|
||||
0x07 (007) Chat Message
|
||||
Send a general chat message.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
NT Message
|
||||
|
||||
Expected response: none?
|
||||
________________________________________________________________________________
|
||||
0x08 (008) Request Start Game, Tell server if Song exists or not.
|
||||
The player selected a song on a net-enabled screen.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Message Use:
|
||||
0 = User has specified song (response to Server 0x08)
|
||||
1 = User does not have specified song (response to Server 0x08)
|
||||
2 = User has requested start game for the song
|
||||
NT Song Title (GetTranslitMainTitle)
|
||||
NT Song Artist (GetTranslitArtist)
|
||||
NT Song Subtitle (GetTranslitSubTitle)
|
||||
|
||||
Expected response: none?
|
||||
________________________________________________________________________________
|
||||
0x09 (009) [Reserved]
|
||||
________________________________________________________________________________
|
||||
0x0A (010) User entered/exited a network screen
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Status:
|
||||
0 = exited ScreenNetSelectMusic
|
||||
1 = entered ScreenNetSelectMusic
|
||||
2 = not sent
|
||||
3 = entered Options
|
||||
4 = exited ScreenNetEvaluation
|
||||
5 = entered ScreenNetEvaluation
|
||||
6 = exited ScreenNetRoom
|
||||
7 = entered ScreenNetRoom
|
||||
|
||||
Expected response: none?
|
||||
________________________________________________________________________________
|
||||
0x0B (011) Player options changed
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
NT Player 0's options (PLAYER_1)
|
||||
NT Player 1's options (PLAYER_2)
|
||||
|
||||
Expected response: none?
|
||||
________________________________________________________________________________
|
||||
0x0C (012) SMOnline Packet (Special Case)
|
||||
The SMOnline Packet is not defined here.
|
||||
SMLan packet 12 is a wrapper for the SMOnline packet. It is used for
|
||||
"protection" of sorts for the SMO coders.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 SMOnline command
|
||||
<...> SMOnline data (<...> = "<VARIABLE>" in original docs)
|
||||
|
||||
Expected response: none?
|
||||
________________________________________________________________________________
|
||||
0x0D (013) [Reserved]
|
||||
________________________________________________________________________________
|
||||
0x0E (014) [Reserved]
|
||||
________________________________________________________________________________
|
||||
0x0F (015) XML Packet
|
||||
This packet contains data in XML format.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
NT XML
|
||||
|
||||
Expected response: none?
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
==[ Server -> Client Communication Protocol ]===================================
|
||||
The Server->Client Communication Protocol begins at 0x80 (128). References to
|
||||
protocol numbers based on 000 will appear here as well.
|
||||
________________________________________________________________________________
|
||||
0x80 (128) [0x00 (000)] No Operation
|
||||
This command makes the server respond with a nop.
|
||||
|
||||
Expected Response: Server 0x01 (001; so really 0x81/129?)
|
||||
________________________________________________________________________________
|
||||
0x81 (129) [0x01 (001)] No Operation Response
|
||||
The response the server gives to a client nop.
|
||||
________________________________________________________________________________
|
||||
0x82 (130) [0x02 (002)] Server Hello Response
|
||||
Introduces the server to the client.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Server Protocol version (if >= 128; server is SMOnline.)
|
||||
NT Server Name
|
||||
0x04 Random Key (or Salt, iirc. Used for alternate login method.)
|
||||
________________________________________________________________________________
|
||||
0x83 (131) [0x03 (003)] Allow Start
|
||||
Causes the client to start the game.
|
||||
________________________________________________________________________________
|
||||
0x84 (132) [0x04 (004)] Game over stats
|
||||
Sent in response to the game over packet.
|
||||
(Technically, this is the evaluation stats.)
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Number of players in this packet (active)
|
||||
Send every player's information for a given field.
|
||||
0x01 First player's PlayerID
|
||||
<other PlayerIDs>
|
||||
0x04 Score
|
||||
<other Scores>
|
||||
0x01 Grade
|
||||
<other Grades>
|
||||
0x01 Difficulty (0 = Beginner, &c.)
|
||||
<other Difficulties>
|
||||
|
||||
(the steps type section is reversed. We may need to do some packet analysis.)
|
||||
0x02 Judgement_Miss
|
||||
<other Miss counts>
|
||||
0x02 Judgement_W5 (Boo)
|
||||
<other W5s>
|
||||
0x02 Judgement_W4 (Good)
|
||||
<other W4s>
|
||||
0x02 Judgement_W3 (Great)
|
||||
<other W3s>
|
||||
0x02 Judgement_W2 (Perfect)
|
||||
<other W2s>
|
||||
0x02 Judgement_W1 (Marvelous)
|
||||
<other W1s>
|
||||
0x02 Judgement_Held (OK)
|
||||
<other Helds>
|
||||
(LetGo doesn't seem to be handled.)
|
||||
0x02 Max Combo
|
||||
<other MaxCombos>
|
||||
NT Player options
|
||||
<other Player Options>
|
||||
________________________________________________________________________________
|
||||
0x85 (133) [0x05 (005)] Scoreboard update
|
||||
Update the client's scoreboard.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Section
|
||||
0 = names
|
||||
1 = combos
|
||||
2 = grades (Projected)
|
||||
0x01 Number of players to display
|
||||
|
||||
The rest of the payload depends on section.
|
||||
switch(section)
|
||||
{
|
||||
case Names:
|
||||
0x01 Index of Player in 1st place
|
||||
0x01 Index of Player in 2nd place
|
||||
...
|
||||
0x01 Last player's index
|
||||
break;
|
||||
|
||||
case Combos:
|
||||
0x01 Player 1's combo
|
||||
0x01 Player 2's combo
|
||||
...
|
||||
0x01 Last player's combo
|
||||
break;
|
||||
|
||||
case Grades: // uses same format as other Grade reports
|
||||
0x01 Player 1's grade
|
||||
0x01 Player 2's grade
|
||||
...
|
||||
0x01 Last player's grade
|
||||
break;
|
||||
}
|
||||
________________________________________________________________________________
|
||||
0x86 (134) [0x06 (006)] System Message
|
||||
!IMPORTANT! This command is unrelated to Server Command 0x06 (006). !IMPORTANT!
|
||||
Send a system message to the user.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
NT Message
|
||||
________________________________________________________________________________
|
||||
0x87 (135) [0x07 (007)] Chat Message
|
||||
Add a message to the chat window. ("on some StepMania screens.")
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
NT Message
|
||||
________________________________________________________________________________
|
||||
0x88 (136) [0x08 (008)] Ask if client has song/Tell client to start song
|
||||
The player selected a song on a net-enabled screen.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Message Type
|
||||
0 = See if client has song.
|
||||
1 = See if client has song. If so, scroll to it.
|
||||
2 = See if client has song. If so, scroll to it and play it.
|
||||
3 = Blindly start song. (Probably assumes everyone has the song.)
|
||||
NT Song Title (GetTranslitMainTitle)
|
||||
NT Song Artist (GetTranslitArtist)
|
||||
NT Song Subtitle (GetTranslitSubTitle)
|
||||
|
||||
________________________________________________________________________________
|
||||
0x89 (137) [0x09 (009)] Update user list
|
||||
Sends all the players currently connected.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Max number of players
|
||||
0x01 Number of players in this packet
|
||||
0x01 Player 0's status
|
||||
NT Player 0's name (if no player, it should be an empty string ("").)
|
||||
...
|
||||
0x01 Last player's status
|
||||
NT Last player's name
|
||||
|
||||
The status flag:
|
||||
0x00 = Inactive (user unknown)
|
||||
0x01 = Active (user known)
|
||||
0x02 = On a selection screen
|
||||
0x02 = In options
|
||||
0x02 = On Eval.
|
||||
________________________________________________________________________________
|
||||
0x8A (138) [0x0A (010)] Force change to NetSelectMusic
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
NT Gametype to set
|
||||
NT Style to set
|
||||
________________________________________________________________________________
|
||||
0x8B (139) [0x0B (011)] Reserved
|
||||
________________________________________________________________________________
|
||||
0x8C (140) [0x0C (012)] SMOnline Packet (Special Case)
|
||||
The SMOnline Packet is not defined here.
|
||||
SMLan packet 12 is a wrapper for the SMOnline packet. It is used for
|
||||
"protection" of sorts for the SMO coders.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
1 SMOnline command
|
||||
<...> SMOnline data (<...> = "<VARIABLE>" in original docs)
|
||||
________________________________________________________________________________
|
||||
0x8D (141) [0x0D (013)] Formatted information packet
|
||||
Send formatted information about the server back to the player.
|
||||
This function is alternatively a broadcast packet (via UDP).
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
NT Server name
|
||||
0x02 Server port
|
||||
0x02 Number of players connected
|
||||
________________________________________________________________________________
|
||||
0x8E (142) [0x0E (014)] Attack client
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Player number
|
||||
0x04 Attack length (milliseconds)
|
||||
NT Modifier string
|
||||
________________________________________________________________________________
|
||||
0x8F (143) [0x0F (015)] XML reply
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
NT XML data
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
==[ Client SMOnline Packets ]===================================================
|
||||
0x00 (000) Send Login Information
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Player Number
|
||||
0x01 Encryption Text:
|
||||
0 = MD5 hash
|
||||
1 = MD5(MD5 hash + salt), where salt is a plaintext base 10 string.
|
||||
NT Username
|
||||
NT Password
|
||||
|
||||
If the server's salt is 0, Encryption Text can't be 1. Block login.
|
||||
________________________________________________________________________________
|
||||
0x01 (001) Ask to enter room
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Enter or Exit?:
|
||||
0 = Exit
|
||||
1 = Enter
|
||||
NT Room Name (only when entering)
|
||||
NT Password (empty if unused)
|
||||
|
||||
________________________________________________________________________________
|
||||
0x02 (002) Create a new room
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Room Type:
|
||||
0 = Normal (with subrooms)
|
||||
1 = Game (no subrooms)
|
||||
NT Room Title
|
||||
NT Room Description
|
||||
NR Room Password (blank if no password)
|
||||
|
||||
________________________________________________________________________________
|
||||
0x03 (003) Request room info
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
NT Room name
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
==[ Server SMOnline Packets ]===================================================
|
||||
0x00 (000) Login Response
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Approval status:
|
||||
0 = Login OK
|
||||
1 = Login Failed
|
||||
NT Login Response (plaintext)
|
||||
________________________________________________________________________________
|
||||
0x01 (001)
|
||||
|
||||
Payload:
|
||||
The payload changes depending on the type of update.
|
||||
[Size] [Description]
|
||||
0x01 Update Type:
|
||||
0 = Change Room Title
|
||||
1 = Update List of rooms/games
|
||||
|
||||
if Update Type == 0 (Change Room Title)
|
||||
[Size] [Description]
|
||||
NT Room Title
|
||||
NT Room Description
|
||||
0x01 Room Type:
|
||||
0 = Chat
|
||||
1 = Game
|
||||
0x01 Allow Subroom creation?
|
||||
0 = No
|
||||
1 = Yes
|
||||
|
||||
if Update Type == 1 (Update room/game list)
|
||||
[Size] [Description]
|
||||
0x01 Number of rooms
|
||||
for 1 to Number of Rooms where room number = # do
|
||||
NT Room# Title
|
||||
NT Room# Description
|
||||
|
||||
Reverse compatiblity Room Status
|
||||
[Size] [Description]
|
||||
0x01 Room# Status
|
||||
0 = Normal
|
||||
1 = unused
|
||||
2 = Playing Game
|
||||
3 = Song Selection Stage1
|
||||
4 = Song Selection Stage2
|
||||
|
||||
Reverse compatiblity Room Flags
|
||||
[Size] [Description]
|
||||
0x01 Room# Flags
|
||||
if bit 0, Passworded
|
||||
________________________________________________________________________________
|
||||
0x02 (002) Request general information from server.
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
0x01 Stats format
|
||||
0 = Normal unformatted stats
|
||||
________________________________________________________________________________
|
||||
0x03 (003) Request room information
|
||||
|
||||
Payload:
|
||||
[Size] [Description]
|
||||
NT Last Song Title
|
||||
NT Last Song Subtitle
|
||||
NT Last Song Artist
|
||||
0x01 Number of players
|
||||
0x01 Max players
|
||||
NT Player1 name
|
||||
...
|
||||
NT Last player (PlayerN) name
|
||||
@@ -1,14 +1,10 @@
|
||||
Code that uses ScreenTextEntry::TextEntry()
|
||||
-------------------------------------------
|
||||
RoomWheel.cpp
|
||||
ScreenEdit.cpp
|
||||
ScreenEditMenu.cpp
|
||||
ScreenNetRoom.cpp
|
||||
ScreenNetworkOptions.cpp
|
||||
ScreenOptionsCourseOverview.cpp
|
||||
ScreenOptionsManageCourses.cpp
|
||||
ScreenOptionsManageEditSteps.cpp
|
||||
ScreenOptionsManageProfiles.cpp
|
||||
ScreenOptionsReviewWorkout.cpp
|
||||
ScreenPackages.cpp
|
||||
ScreenTestFonts.cpp
|
||||
ScreenTestFonts.cpp
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
[How to Use EzSockets by freem]
|
||||
|
||||
Hey there. ezsockets is the socket library used in StepMania. If you are going to
|
||||
develop any extended network functionality, it would be good to know about
|
||||
ezsockets. This is by no means an exhaustive guide, as it just covers what's
|
||||
contained in the header, as well as what that code does.
|
||||
|
||||
Section 1: low level commands===================================================
|
||||
These are typically used for connecting to the server, according to a cursory
|
||||
glance at ScreenPackages code.
|
||||
|
||||
=="Crating" a socket== (lol typos in the comments)
|
||||
There are three functions here, each with different arguments (yay overloading).
|
||||
All of them return a bool.
|
||||
|
||||
bool create(int Protocol, int Type);
|
||||
This shows what's needed to make a socket. Consult the internet for complete
|
||||
documentation as to possible values, but here are some ones to know:
|
||||
|
||||
[Protocol]
|
||||
TCP = IPPROTO_TCP
|
||||
UDP = IPPROTO_UDP
|
||||
Raw sockets = IPPROTO_RAW (though "Protocol" is used in the code. Raw sockets
|
||||
are not supported on Xbox)
|
||||
|
||||
bool create();
|
||||
Creates a socket using (IPPROTO_TCP, SOCK_STREAM) as the parameters.
|
||||
|
||||
bool create(int Protocol);
|
||||
This picks the right Type for you based on what Protocol you choose.
|
||||
TCP uses SOCK_STREAM, UDP uses SOCK_DGRAM for the Type value.
|
||||
|
||||
==Binding Sockets to a Local Port==
|
||||
bool bind(unsigned short port);
|
||||
|
||||
==Listening==
|
||||
bool listen()
|
||||
|
||||
==Accepting==
|
||||
bool accept(EzSockets &socket);
|
||||
If it's not blocking and you can't read it, this will return false.
|
||||
Other than that... ??
|
||||
|
||||
==Connecting to Server==
|
||||
bool connect(const string& host, unsigned short port);
|
||||
Connects to the server at host using port.
|
||||
|
||||
==Closing/Killing Sockets==
|
||||
void close();
|
||||
Sets the state to disconnected, sets the buffers to empty strings,
|
||||
then closes the socket.
|
||||
|
||||
==Checking Socket Status==
|
||||
bool check();
|
||||
"see if socket has been created". It checks (sock != INVALID_SOCKET) on the
|
||||
Xbox and (sock > SOCKET_NONE) on every other platform.
|
||||
|
||||
bool CanRead();
|
||||
Returns true if you can read from the socket.
|
||||
|
||||
bool DataAvailable() { return ( ( inBuffer.length()>0 ) || CanRead() ); }
|
||||
Yeah that's it in a nutshell. If the input buffer has data or you can read,
|
||||
there's data available.
|
||||
|
||||
bool IsError();
|
||||
Returns true if there's an error.
|
||||
|
||||
bool CanWrite();
|
||||
Returns true if you can write to the socket.
|
||||
|
||||
==???==
|
||||
long uAddr();
|
||||
void update();
|
||||
|
||||
Section 2: Higher Level Commands================================================
|
||||
These are higher level, since they assume you've already gotten the socket up
|
||||
and running (see check() in Section 1).
|
||||
|
||||
//Raw data system
|
||||
void SendData(const string& outData);
|
||||
void SendData(const char *data, unsigned int bytes);
|
||||
Send off some data that's either a string or a char buffer + num bytes.
|
||||
|
||||
int ReadData(char *data, unsigned int bytes);
|
||||
Reads data, returns number of bytes read.
|
||||
|
||||
int PeekData(char *data, unsigned int bytes);
|
||||
Peeks at the data, returns number of bytes read.
|
||||
|
||||
//Packet system (for structures and classes)
|
||||
void SendPack(const char *data, unsigned int bytes);
|
||||
int ReadPack(char *data, unsigned int max);
|
||||
int PeekPack(char *data, unsigned int max);
|
||||
Similar to the raw data system above, but... you guessed it, for structures and classes.
|
||||
|
||||
//String (Flash) system / Null-terminated strings
|
||||
void SendStr(const string& data, char delim = '\0');
|
||||
int ReadStr(string& data, char delim = '\0');
|
||||
int PeekStr(string& data, char delim = '\0');
|
||||
Similar to above, with null terminated strings.
|
||||
|
||||
Section 3: putting it all together==============================================
|
||||
okay i didn't test this; this is based on ScreenPackages code (specifically
|
||||
ScreenPackages::EnterURL()), which assumes you have a private EzSockets object
|
||||
named m_wSocket.
|
||||
|
||||
{
|
||||
// defaults
|
||||
RString sProto;
|
||||
RString sServer;
|
||||
int iPort=80;
|
||||
RString sAddress;
|
||||
|
||||
m_wSocket.create(); // will create a TCP socket
|
||||
m_wSocket.blocking = true; // you want to set this so that nothing else can use this socket and fuck things up
|
||||
m_wSocket.connect( sServer, (short)iPort ); // connect uses an unsigned short, so a cast is needed. (int was used because of other code) check if this returns true/false, pls
|
||||
|
||||
// makin' headers (using SendData with raw data; http 1.0 in this case)
|
||||
RString Header="";
|
||||
|
||||
Header = "GET "+sAddress+" HTTP/1.0\r\n";
|
||||
Header+= "Host: " + Server + "\r\n";
|
||||
Header+= "Connection: closed\r\n\r\n";
|
||||
|
||||
m_wSocket.SendData( Header.c_str(), Header.length() );
|
||||
|
||||
m_wSocket.blocking = false; // once you're done, you don't need to have the socket blocking anymore
|
||||
|
||||
// some other code can go here...
|
||||
|
||||
m_wSocket.close(); // and if you're done, you can close the socket.
|
||||
}
|
||||
Reference in New Issue
Block a user