Skip to content

Commit

Permalink
Add all system messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ChillerDragon committed Aug 24, 2024
1 parent 2ac99e9 commit 8b297d8
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/data/teeworlds.asm
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,25 @@ MSG_CTRL_CLOSE equ 4
MSG_CTRL_TOKEN equ 5

MSG_SYSTEM_INFO equ 1
MSG_SYSTEM_MAP_CHANGE equ 2
MSG_SYSTEM_MAP_DATA equ 3
MSG_SYSTEM_SERVERINFO equ 4
MSG_SYSTEM_CON_READY equ 5
MSG_SYSTEM_SNAP equ 6
MSG_SYSTEM_SNAPEMPTY equ 7
MSG_SYSTEM_SNAPSINGLE equ 8
MSG_SYSTEM_MAP_CHANGE equ 2
MSG_SYSTEM_INPUTTIMING equ 10
MSG_SYSTEM_RCON_AUTH_ON equ 11
MSG_SYSTEM_RCON_AUTH_OFF equ 12
MSG_SYSTEM_RCON_LINE equ 13
MSG_SYSTEM_RCON_CMD_ADD equ 14
MSG_SYSTEM_RCON_CMD_REM equ 15
MSG_SYSTEM_READY equ 18
MSG_SYSTEM_ENTERGAME equ 19
MSG_SYSTEM_INPUT equ 20
MSG_SYSTEM_PING_REPLY equ 27
MSG_SYSTEM_MAPLIST_ENTRY_ADD equ 29
MSG_SYSTEM_MAPLIST_ENTRY_REM equ 30

MSG_GAME_SV_MOTD equ 1
MSG_GAME_SV_BROADCAST equ 2
Expand Down
3 changes: 2 additions & 1 deletion src/data/teeworlds_strings.asm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ s_broadcast db "[broadcast] "
l_s_broadcast equ $ - s_broadcast
s_chat db "[chat] "
l_s_chat equ $ - s_chat

s_rcon db "[rcon] "
l_s_rcon equ $ - s_rcon

s_sending_packet_with_size db "[client] sending packet with size: "
l_s_sending_packet_with_size equ $ - s_sending_packet_with_size
Expand Down
77 changes: 77 additions & 0 deletions src/on_system.asm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ on_system_message:

cmp r9d, MSG_SYSTEM_MAP_CHANGE
je on_system_msg_map_change
cmp r9d, MSG_SYSTEM_MAP_DATA
je on_system_msg_map_data
cmp r9d, MSG_SYSTEM_SERVERINFO
je on_system_msg_serverinfo
cmp r9d, MSG_SYSTEM_CON_READY
Expand All @@ -28,6 +30,24 @@ on_system_message:
je on_system_msg_snapempty
cmp r9d, MSG_SYSTEM_SNAPSINGLE
je on_system_msg_snapsingle
cmp r9d, MSG_SYSTEM_INPUTTIMING
je on_system_msg_inputtiming
cmp r9d, MSG_SYSTEM_RCON_AUTH_ON
je on_system_msg_rcon_auth_on
cmp r9d, MSG_SYSTEM_RCON_AUTH_OFF
je on_system_msg_rcon_auth_off
cmp r9d, MSG_SYSTEM_RCON_LINE
je on_system_msg_rcon_line
cmp r9d, MSG_SYSTEM_RCON_CMD_ADD
je on_system_msg_rcon_cmd_add
cmp r9d, MSG_SYSTEM_RCON_CMD_REM
je on_system_msg_rcon_cmd_rem
cmp r9d, MSG_SYSTEM_PING_REPLY
je on_system_msg_ping_reply
cmp r9d, MSG_SYSTEM_MAPLIST_ENTRY_ADD
je on_system_msg_maplist_entry_add
cmp r9d, MSG_SYSTEM_MAPLIST_ENTRY_REM
je on_system_msg_maplist_entry_rem

print_label s_unknown_system_msg
mov rax, r9
Expand All @@ -50,6 +70,11 @@ on_system_msg_map_change:

jmp on_system_message_end

on_system_msg_map_data:
; on_system_msg_map_data [rax]
; rax = message payload
jmp on_system_message_end

on_system_msg_serverinfo:
; on_system_msg_serverinfo [rax]
; rax = message payload
Expand Down Expand Up @@ -144,3 +169,55 @@ on_system_msg_snapsingle:

jmp on_system_message_end

on_system_msg_inputtiming:
; on_system_msg_inputtiming [rax]
; rax = message payload
jmp on_system_message_end

on_system_msg_rcon_auth_on:
; on_system_msg_rcon_auth_on [rax]
; rax = message payload
jmp on_system_message_end

on_system_msg_rcon_auth_off:
; on_system_msg_rcon_auth_off [rax]
; rax = message payload
jmp on_system_message_end

on_system_msg_rcon_line:
; on_system_msg_rcon_auth_off [rax]
; rax = message payload

print_label s_rcon

call get_string
print_c_str rax
call print_newline

jmp on_system_message_end

on_system_msg_rcon_cmd_add:
; on_system_msg_rcon_cmd_add [rax]
; rax = message payload
jmp on_system_message_end

on_system_msg_rcon_cmd_rem:
; on_system_msg_rcon_cmd_rem [rax]
; rax = message payload
jmp on_system_message_end

on_system_msg_ping_reply:
; on_system_msg_ping_reply [rax]
; rax = message payload
jmp on_system_message_end

on_system_msg_maplist_entry_add:
; on_system_msg_maplist_entry_add [rax]
; rax = message payload
jmp on_system_message_end

on_system_msg_maplist_entry_rem:
; on_system_msg_maplist_entry_add [rax]
; rax = message payload
jmp on_system_message_end

0 comments on commit 8b297d8

Please sign in to comment.