mirror of
https://github.com/redstrate/Kawari.git
synced 2025-07-19 11:17:46 +00:00
Fix various issues with the Lobby packets
Everything should be more consistent now, in regards to "tickets" and actor ids.
This commit is contained in:
parent
822f693f8c
commit
c339c89c41
11 changed files with 42 additions and 23 deletions
|
@ -303,7 +303,8 @@ async fn main() {
|
||||||
..
|
..
|
||||||
} => {
|
} => {
|
||||||
connection.selected_service_account = Some(
|
connection.selected_service_account = Some(
|
||||||
connection.service_accounts[*account_index as usize].id,
|
connection.service_accounts[*account_index as usize].id
|
||||||
|
as u32,
|
||||||
);
|
);
|
||||||
connection.send_lobby_info(*sequence).await
|
connection.send_lobby_info(*sequence).await
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,9 +154,9 @@ async fn client_loop(
|
||||||
for segment in &segments {
|
for segment in &segments {
|
||||||
match &segment.data {
|
match &segment.data {
|
||||||
SegmentData::None() => {},
|
SegmentData::None() => {},
|
||||||
SegmentData::Setup { ticket } => {
|
SegmentData::Setup { actor_id } => {
|
||||||
// for some reason they send a string representation
|
// for some reason they send a string representation
|
||||||
let actor_id = ticket.parse::<u32>().unwrap();
|
let actor_id = actor_id.parse::<u32>().unwrap();
|
||||||
|
|
||||||
// initialize player data if it doesn't exist'
|
// initialize player data if it doesn't exist'
|
||||||
if connection.player_data.actor_id == 0 {
|
if connection.player_data.actor_id == 0 {
|
||||||
|
@ -193,7 +193,7 @@ async fn client_loop(
|
||||||
connection.send_chat_segment(PacketSegment {
|
connection.send_chat_segment(PacketSegment {
|
||||||
segment_type: SegmentType::Initialize,
|
segment_type: SegmentType::Initialize,
|
||||||
data: SegmentData::Initialize {
|
data: SegmentData::Initialize {
|
||||||
player_id: connection.player_data.actor_id,
|
actor_id: connection.player_data.actor_id,
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -6,8 +6,7 @@ use crate::common::{read_string, write_string};
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
|
||||||
pub struct ServiceAccount {
|
pub struct ServiceAccount {
|
||||||
pub id: u32,
|
pub id: u64,
|
||||||
pub unk1: u32,
|
|
||||||
pub index: u32,
|
pub index: u32,
|
||||||
#[bw(pad_size_to = 0x44)]
|
#[bw(pad_size_to = 0x44)]
|
||||||
#[br(count = 0x44)]
|
#[br(count = 0x44)]
|
||||||
|
|
|
@ -103,7 +103,8 @@ pub enum ClientLobbyIpcData {
|
||||||
unk1: u8,
|
unk1: u8,
|
||||||
unk2: u16,
|
unk2: u16,
|
||||||
unk3: u32, // TODO: probably multiple params
|
unk3: u32, // TODO: probably multiple params
|
||||||
account_id: u64,
|
account_id: u32,
|
||||||
|
unk4: u32,
|
||||||
},
|
},
|
||||||
/// Sent by the client when it requests to enter a world.
|
/// Sent by the client when it requests to enter a world.
|
||||||
#[br(pre_assert(*magic == ClientLobbyIpcType::GameLogin))]
|
#[br(pre_assert(*magic == ClientLobbyIpcType::GameLogin))]
|
||||||
|
@ -111,8 +112,10 @@ pub enum ClientLobbyIpcData {
|
||||||
sequence: u64,
|
sequence: u64,
|
||||||
content_id: u64,
|
content_id: u64,
|
||||||
// TODO: what else is in here?
|
// TODO: what else is in here?
|
||||||
unk1: u64,
|
unk1: u32,
|
||||||
unk2: u64,
|
unk2: u32,
|
||||||
|
unk3: u32,
|
||||||
|
unk4: u32,
|
||||||
},
|
},
|
||||||
/// Sent by the client after exchanging encryption information with the lobby server.
|
/// Sent by the client after exchanging encryption information with the lobby server.
|
||||||
#[br(pre_assert(*magic == ClientLobbyIpcType::LoginEx))]
|
#[br(pre_assert(*magic == ClientLobbyIpcType::LoginEx))]
|
||||||
|
@ -304,6 +307,7 @@ mod tests {
|
||||||
unk2: 0,
|
unk2: 0,
|
||||||
account_id: 0,
|
account_id: 0,
|
||||||
unk3: 0,
|
unk3: 0,
|
||||||
|
unk4: 0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
@ -313,6 +317,8 @@ mod tests {
|
||||||
content_id: 0,
|
content_id: 0,
|
||||||
unk1: 0,
|
unk1: 0,
|
||||||
unk2: 0,
|
unk2: 0,
|
||||||
|
unk3: 0,
|
||||||
|
unk4: 0,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
|
|
@ -36,8 +36,7 @@ impl Default for CharacterFlag {
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct CharacterDetails {
|
pub struct CharacterDetails {
|
||||||
#[brw(pad_after = 4)]
|
pub player_id: u64,
|
||||||
pub actor_id: u32,
|
|
||||||
pub content_id: u64,
|
pub content_id: u64,
|
||||||
pub index: u8,
|
pub index: u8,
|
||||||
pub flags: CharacterFlag,
|
pub flags: CharacterFlag,
|
||||||
|
|
|
@ -128,7 +128,10 @@ impl Default for ClientZoneIpcSegment {
|
||||||
op_code: ClientZoneIpcType::InitRequest,
|
op_code: ClientZoneIpcType::InitRequest,
|
||||||
option: 0,
|
option: 0,
|
||||||
timestamp: 0,
|
timestamp: 0,
|
||||||
data: ClientZoneIpcData::InitRequest { unk: [0; 120] },
|
data: ClientZoneIpcData::InitRequest {
|
||||||
|
unk1: String::default(),
|
||||||
|
unk2: String::default(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -472,8 +475,17 @@ pub enum ClientZoneIpcData {
|
||||||
/// Sent by the client when they successfully initialize with the server, and they need several bits of information (e.g. what zone to load)
|
/// Sent by the client when they successfully initialize with the server, and they need several bits of information (e.g. what zone to load)
|
||||||
#[br(pre_assert(*magic == ClientZoneIpcType::InitRequest))]
|
#[br(pre_assert(*magic == ClientZoneIpcType::InitRequest))]
|
||||||
InitRequest {
|
InitRequest {
|
||||||
// TODO: full of possibly interesting information
|
#[brw(pad_before = 40)] // seems to be empty?
|
||||||
unk: [u8; 120],
|
#[brw(pad_size_to = 32)]
|
||||||
|
#[br(count = 32)]
|
||||||
|
#[br(map = read_string)]
|
||||||
|
#[bw(map = write_string)]
|
||||||
|
unk1: String,
|
||||||
|
#[br(count = 48)]
|
||||||
|
#[brw(pad_size_to = 48)]
|
||||||
|
#[br(map = read_string)]
|
||||||
|
#[bw(map = write_string)]
|
||||||
|
unk2: String,
|
||||||
},
|
},
|
||||||
/// Sent by the client when they're done loading and they need to be spawned in
|
/// Sent by the client when they're done loading and they need to be spawned in
|
||||||
#[br(pre_assert(*magic == ClientZoneIpcType::FinishLoading))]
|
#[br(pre_assert(*magic == ClientZoneIpcType::FinishLoading))]
|
||||||
|
@ -952,7 +964,10 @@ mod tests {
|
||||||
let ipc_types = [
|
let ipc_types = [
|
||||||
(
|
(
|
||||||
ClientZoneIpcType::InitRequest,
|
ClientZoneIpcType::InitRequest,
|
||||||
ClientZoneIpcData::InitRequest { unk: [0; 120] },
|
ClientZoneIpcData::InitRequest {
|
||||||
|
unk1: String::default(),
|
||||||
|
unk2: String::default(),
|
||||||
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
ClientZoneIpcType::FinishLoading,
|
ClientZoneIpcType::FinishLoading,
|
||||||
|
|
|
@ -412,7 +412,7 @@ impl LobbyConnection {
|
||||||
unk2: 0x1,
|
unk2: 0x1,
|
||||||
action: LobbyCharacterActionKind::Create,
|
action: LobbyCharacterActionKind::Create,
|
||||||
details: CharacterDetails {
|
details: CharacterDetails {
|
||||||
actor_id: our_actor_id,
|
player_id: our_actor_id as u64, // TODO: not correct
|
||||||
content_id: our_content_id,
|
content_id: our_content_id,
|
||||||
character_name: character_action.name.clone(),
|
character_name: character_action.name.clone(),
|
||||||
origin_server_name: self.world_name.clone(),
|
origin_server_name: self.world_name.clone(),
|
||||||
|
@ -458,7 +458,7 @@ impl LobbyConnection {
|
||||||
unk2: 0x1,
|
unk2: 0x1,
|
||||||
action: LobbyCharacterActionKind::Delete,
|
action: LobbyCharacterActionKind::Delete,
|
||||||
details: CharacterDetails {
|
details: CharacterDetails {
|
||||||
actor_id: 0, // TODO: fill maybe?
|
player_id: 0, // TODO: fill maybe?
|
||||||
content_id: character_action.content_id,
|
content_id: character_action.content_id,
|
||||||
character_name: character_action.name.clone(),
|
character_name: character_action.name.clone(),
|
||||||
origin_server_name: self.world_name.clone(),
|
origin_server_name: self.world_name.clone(),
|
||||||
|
@ -506,7 +506,7 @@ impl LobbyConnection {
|
||||||
unk2: 0x1,
|
unk2: 0x1,
|
||||||
action: LobbyCharacterActionKind::RemakeChara,
|
action: LobbyCharacterActionKind::RemakeChara,
|
||||||
details: CharacterDetails {
|
details: CharacterDetails {
|
||||||
actor_id: 0, // TODO: fill maybe?
|
player_id: 0, // TODO: fill maybe?
|
||||||
content_id: character_action.content_id,
|
content_id: character_action.content_id,
|
||||||
character_name: character_action.name.clone(),
|
character_name: character_action.name.clone(),
|
||||||
origin_server_name: self.world_name.clone(),
|
origin_server_name: self.world_name.clone(),
|
||||||
|
|
|
@ -166,7 +166,6 @@ impl LoginDatabase {
|
||||||
for (index, id) in accounts.enumerate() {
|
for (index, id) in accounts.enumerate() {
|
||||||
service_accounts.push(ServiceAccount {
|
service_accounts.push(ServiceAccount {
|
||||||
id: id.unwrap(),
|
id: id.unwrap(),
|
||||||
unk1: 0,
|
|
||||||
index: index as u32,
|
index: index as u32,
|
||||||
name: format!("FINAL FANTASY XIV {}", index + 1), // TODO: don't add the "1" if you only have one service account
|
name: format!("FINAL FANTASY XIV {}", index + 1), // TODO: don't add the "1" if you only have one service account
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,11 +57,11 @@ pub enum SegmentData<T: ReadWriteIpcSegment> {
|
||||||
#[br(count = 36)]
|
#[br(count = 36)]
|
||||||
#[br(map = read_string)]
|
#[br(map = read_string)]
|
||||||
#[bw(map = write_string)]
|
#[bw(map = write_string)]
|
||||||
ticket: String, // square enix in their infinite wisdom has this as a STRING REPRESENTATION of an integer. what
|
actor_id: String, // square enix in their infinite wisdom has this as a STRING REPRESENTATION of an integer. what
|
||||||
},
|
},
|
||||||
#[br(pre_assert(kind == SegmentType::Initialize))]
|
#[br(pre_assert(kind == SegmentType::Initialize))]
|
||||||
Initialize {
|
Initialize {
|
||||||
player_id: u32,
|
actor_id: u32,
|
||||||
#[brw(pad_after = 32)]
|
#[brw(pad_after = 32)]
|
||||||
timestamp: u32,
|
timestamp: u32,
|
||||||
},
|
},
|
||||||
|
|
|
@ -199,7 +199,7 @@ impl ZoneConnection {
|
||||||
self.send_segment(PacketSegment {
|
self.send_segment(PacketSegment {
|
||||||
segment_type: SegmentType::Initialize,
|
segment_type: SegmentType::Initialize,
|
||||||
data: SegmentData::Initialize {
|
data: SegmentData::Initialize {
|
||||||
player_id: self.player_data.actor_id,
|
actor_id: self.player_data.actor_id,
|
||||||
timestamp: timestamp_secs(),
|
timestamp: timestamp_secs(),
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -447,7 +447,7 @@ impl WorldDatabase {
|
||||||
};
|
};
|
||||||
|
|
||||||
characters.push(CharacterDetails {
|
characters.push(CharacterDetails {
|
||||||
actor_id: *actor_id,
|
player_id: *actor_id as u64, // TODO: not correct
|
||||||
content_id: *content_id as u64,
|
content_id: *content_id as u64,
|
||||||
index: index as u8,
|
index: index as u8,
|
||||||
flags: CharacterFlag::NONE,
|
flags: CharacterFlag::NONE,
|
||||||
|
|
Loading…
Add table
Reference in a new issue