From 49c0d6a261aa1e839cc560fb40fb52b13563d5d9 Mon Sep 17 00:00:00 2001 From: mht8355 Date: Mon, 30 Mar 2020 23:51:11 -0400 Subject: [PATCH] Added 0x83 (LobbyList), LobbyEntry, 0x84 (LobbySelect) minor struct changes minor struct changes minor struct changes sd oops --- src/packet/ship.rs | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/packet/ship.rs b/src/packet/ship.rs index b62e58e..d050a41 100644 --- a/src/packet/ship.rs +++ b/src/packet/ship.rs @@ -9,6 +9,7 @@ use std::io::Read; const BLOCK_MENU_ID: u32 = 1; pub const ROOM_MENU_ID: u32 = 2; +pub const LOBBY_MENU_ID: u32 = 3; #[pso_packet(0x03)] pub struct ShipWelcome { @@ -88,6 +89,12 @@ pub struct MenuSelect { pub item: u32, } +#[pso_packet(0x84)] +pub struct LobbySelect { + pub menu: u32, + pub lobby: u32, +} + #[pso_packet(0xE7)] pub struct FullCharacter { #[no_debug] @@ -359,3 +366,41 @@ pub struct RoomListResponse { pub baseroom: RoomList, pub rooms: Vec, } + +#[derive(PSOPacketData, Clone, Copy, Default)] +pub struct LobbyEntry { + menu_id: u32, + item_id: u32, + padding: u32, +} + +impl LobbyEntry { + pub fn new(menu_id: u32, lobby_id: u32) -> LobbyEntry { + LobbyEntry { + menu_id: menu_id, + item_id: lobby_id, + padding: 0, + } + } +} + +#[pso_packet(0x83, manual_flag)] +pub struct LobbyList { + flag: u32, + entries: [LobbyEntry; 16], +} + +impl LobbyList { + pub fn new() -> LobbyList { + let lobbies = (0..16).fold([LobbyEntry::default(); 16], + |mut acc, index| { + acc[index].menu_id = LOBBY_MENU_ID; + acc[index].item_id = index as u32; + acc + }); + LobbyList { + flag: 0x0F, + entries: lobbies, + } + } +} \ No newline at end of file