Skip to content

Commit

Permalink
Use unpacker chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
ChillerDragon committed Aug 24, 2024
1 parent 02cd80e commit a7be54c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/on_packet.asm
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,22 @@ on_message:
; payload pointer (todo: should not be at offset one but use int unpacker)
mov rdi, rax

; backup first byte in rcx

push rdi
mov rdi, 0
mov edi, [chunk_header_size]
unpacker_reset rax, rdi
pop rdi

; unpack msgid and system flag
call get_int

; backup msgid and sys flag int in rcx
; to be later checked for system flag
mov rcx, [rax]
mov rcx, rax

; extract message id
; todo: this should be int unpacker not reading only one byte
mov rbx, 0
mov byte bl, [rax]
shr ebx, 1
mov rax, 0
mov eax, ebx
shr eax, 1

is_rcx_flag CHUNK_SYSTEM
je .on_message_system
Expand Down
1 change: 1 addition & 0 deletions src/on_system.asm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ on_system_msg_map_change:
; on_system_msg_map_change [rax]
; rax = message payload
print_label s_map_change
call get_string
print_c_str rax
call print_newline

Expand Down

0 comments on commit a7be54c

Please sign in to comment.