Download Play: Difference between revisions
(4 intermediate revisions by the same user not shown) | |||
Line 66: | Line 66: | ||
The checksum stored in the above data frame header is then calculated using this checksum seed. | The checksum stored in the above data frame header is then calculated using this checksum seed. | ||
First, the calc_checksum is initialized to 0. Then calc_checksum is added with ''all'' words in the data frame loaded as big-endian, with the data-frame checksum cleared to zero here. If the frame_size isn't word-aligned, the remaining <4-bytes are loaded as big-endian for adding as well. | |||
Then this is run: | |||
//During init before the above adding, shift and count are initialized: | |||
//shift = (((u8*)&checksum_seed)[2] & 0xf) + 0x4; | |||
//count = (((u8*)&checksum_seed)[3] & 0x7) + 0x2; | |||
for(pos=0; pos<count; pos++)checksum = (checksum<<shift | checksum>>shift) ^ checksum_seed;//The u32 checksum_seed is byte-swapped on 3DS for this. | |||
Lastly the calculated checksum is written to output as big-endian(hence on 3DS it's byte-swapped before writing to output). | |||
==== Frames ==== | ==== Frames ==== | ||
Line 97: | Line 107: | ||
|- | |- | ||
| 0x0 | | 0x0 | ||
| | | 0x8 | ||
| | | u64 DLP-child titleID. Must be a CTR TID-high, with the TID-high set for DLP-child. The low 4-bits of the TID-low must be clear. | ||
|- | |- | ||
| 0x8 | | 0x8 | ||
| 0x2 | | 0x2 | ||
| u16, | | u16, probably the DLP-child title-version. | ||
|- | |- | ||
| 0xA | | 0xA | ||
Line 118: | Line 124: | ||
| 0xC | | 0xC | ||
| 0x4 | | 0x4 | ||
| u32, | | u32, chunk_size. This is the chunk_size used for transferring the CIA. This is the exact size used for the FS .cia file-reads on the host, and the exact size used for [[Application_Manager_Services|AM]] CIA file-writes on the client(s). Normally this is 0x0003FFC0. This appears to be validated by the client at some point, using a large value for this triggers an "connection interrupted" error when trying to connect. | ||
|- | |- | ||
| 0x10 | | 0x10 |