Added size in response for convenience

This commit is contained in:
techmetx11 2024-06-25 18:59:19 +01:00
parent fda0eeb863
commit 9784fdbafe
No known key found for this signature in database
GPG Key ID: E60B63635FF4E062
2 changed files with 11 additions and 5 deletions

View File

@ -14,6 +14,7 @@ The data afterwards depends on the supplied opcode, Please consult the **Operati
| Name | Size (bytes) | Description | | Name | Size (bytes) | Description |
|------------|--------------|---------------------------------------| |------------|--------------|---------------------------------------|
|request_id | 4 | The ID for the request that this response is meant for | |request_id | 4 | The ID for the request that this response is meant for |
|size | 4 | Size of the response (excluding size of request id)|
The data afterwards depends on the supplied opcode, Please consult the **Operations** chapter for more information. The data afterwards depends on the supplied opcode, Please consult the **Operations** chapter for more information.

View File

@ -96,18 +96,23 @@ impl Encoder<OpcodeResponse> for OpcodeDecoder {
) -> Result<(), Self::Error> { ) -> Result<(), Self::Error> {
dst.put_u32(item.request_id); dst.put_u32(item.request_id);
match item.opcode { match item.opcode {
JobOpcode::ForceUpdate => match item.update_status { JobOpcode::ForceUpdate => {
Ok(_x) => dst.put_u16(0xF44F), dst.put_u32(2);
Err(FetchUpdateStatus::PlayerAlreadyUpdated) => dst.put_u16(0xFFFF), match item.update_status {
Err(_x) => dst.put_u16(0x0000), Ok(_x) => dst.put_u16(0xF44F),
}, Err(FetchUpdateStatus::PlayerAlreadyUpdated) => dst.put_u16(0xFFFF),
Err(_x) => dst.put_u16(0x0000),
}
}
JobOpcode::DecryptSignature | JobOpcode::DecryptNSignature => { JobOpcode::DecryptSignature | JobOpcode::DecryptNSignature => {
dst.put_u32(2 + u32::try_from(item.signature.len()).unwrap());
dst.put_u16(u16::try_from(item.signature.len()).unwrap()); dst.put_u16(u16::try_from(item.signature.len()).unwrap());
if !item.signature.is_empty() { if !item.signature.is_empty() {
dst.put_slice(item.signature.as_bytes()); dst.put_slice(item.signature.as_bytes());
} }
} }
JobOpcode::GetSignatureTimestamp => { JobOpcode::GetSignatureTimestamp => {
dst.put_u32(8);
dst.put_u64(item.signature_timestamp); dst.put_u64(item.signature_timestamp);
} }
_ => {} _ => {}