StreetPass: Difference between revisions
Meleemeister (talk | contribs) |
m typo |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 113: | Line 113: | ||
Sims 3: 00 03 65 00 30 | Sims 3: 00 03 65 00 30 | ||
Street Fighter: 00 03 05 00 02 (FF FF FF FF FF FF) | Street Fighter: 00 03 05 00 02 (FF FF FF FF FF FF) | ||
Tomodachi life: 00 08 C5 00 30 (Tested on EUR region) | |||
Animal crossing new leaf: 00 19 8D 00 30 (Tested on EUR region) | |||
The first 4 bytes are the titleID of the service, the last byte seems to contain flags. | The first 4 bytes are the titleID of the service, the last byte seems to contain flags. | ||
Line 126: | Line 128: | ||
Only the bits 2,5,6 were used. | Only the bits 2,5,6 were used. | ||
When set, the bit n°2 indicates the presence of a | When set, the bit n°2 indicates the presence of a following 6-byte field filled with 0xff. | ||
Some services have a 6-byte field succeeding the StreetPass service that is just FF bytes (e.g. FF FF FF FF FF FF). The purpose of these is unknown, although may be used as data for a service, or as separator of some sort for different types of StreetPass services. | Some services have a 6-byte field succeeding the StreetPass service that is just FF bytes (e.g. FF FF FF FF FF FF). The purpose of these is unknown, although may be used as data for a service, or as separator of some sort for different types of StreetPass services. | ||
Line 407: | Line 409: | ||
The 3DS (#1) that the Initial Probe Response is directed to will send an 802.11 Action frame back to the device. The sequence numbers at this point stop stepping up by 3, and instead increase by one based from each originating device's SN. It will then send another Probe Request, this time sent directly to the responding 3DS (#2) by specifying its MAC address in the destination field, and setting its own MAC address in the source address field. It also does not have a SSID specified in the frame, except the frame will contain a BSSID with the value of the 3DS (#2) that responded to the initial Probe, and thus acts as the master in the 802.11 exchange. | The 3DS (#1) that the Initial Probe Response is directed to will send an 802.11 Action frame back to the device. The sequence numbers at this point stop stepping up by 3, and instead increase by one based from each originating device's SN. It will then send another Probe Request, this time sent directly to the responding 3DS (#2) by specifying its MAC address in the destination field, and setting its own MAC address in the source address field. It also does not have a SSID specified in the frame, except the frame will contain a BSSID with the value of the 3DS (#2) that responded to the initial Probe, and thus acts as the master in the 802.11 exchange. | ||
=== Send Mode === | |||
The 3DS can mark StreetPass data with one of 4 Send Modes | |||
{| class="wikitable" border="1" | |||
!ID!!Send Mode!!Description | |||
|- | |||
|0||EXCHANGE||StreetPass message exchange will only happen if both consoles can store the message of the other. E.g. the inbox isn't full. Example title: StreetPass Mii Plaza | |||
|- | |||
|1||RECV_ONLY||3DS doesn't have anything in its outbox so it is only receiving messages. | |||
|- | |||
|2||SEND_ONLY|| | |||
|- | |||
|3||SEND_RECV|| | |||
|} | |||
== StreetPass Spoofing == | == StreetPass Spoofing == | ||
Line 426: | Line 442: | ||
</Priority> | </Priority> | ||
</pre> | </pre> | ||
===Request=== | |||
The following additional headers will be send in the request: | |||
{| class=wikitable | |||
|X-Boss-Apinfo||Access Point Info. The same number that is send with the policylist GET parameter ap. Probably identifies the SSID of connected Nintendo Zone Hotspot. If not connected to Nintendo Zone Hotspot this will be an empty string.||02012600000 | |||
|- | |||
|X-Boss-Bssid||The MAC address of the access point the 3DS is connected to.||11:22:33:44:55:66 | |||
|- | |||
|X-Boss-Country||2 letter country code of the set language.||ES | |||
|- | |||
|X-Boss-Region||3 letter region code of the 3DS' region.||EUR | |||
|- | |||
|X-Boss-Userid||A unique 16 character long hexadecimal string that represents a 64-bit integer. It is unknown how this number is generated.||6966442DE2EED063 | |||
|} | |||
In the request body there will be a file named ''spr-meta'' and a file per registered StreetPass game ''spr-slotXX'' where XX is an incrementing number. If the game contains not messages in its outbox so the size of the file would be 0 then no file is created and sent but it will still be listed in the spr-meta file. | In the request body there will be a file named ''spr-meta'' and a file per registered StreetPass game ''spr-slotXX'' where XX is an incrementing number. If the game contains not messages in its outbox so the size of the file would be 0 then no file is created and sent but it will still be listed in the spr-meta file. | ||
Line 441: | Line 471: | ||
The comma seperated list after each spr-slotXX has the following meaning | The comma seperated list after each spr-slotXX has the following meaning | ||
{| class=wikitable | {| class=wikitable | ||
| | |Send Mode||StreetPass ID (Low title ID of the game. May be from a different region like japan.)||Size of the file in bytes | ||
|} | |} | ||
Line 455: | Line 485: | ||
|0x08||0x04||StreetPass ID (Low title ID of the game. May be from a different region like japan.) | |0x08||0x04||StreetPass ID (Low title ID of the game. May be from a different region like japan.) | ||
|- | |- | ||
|0x0C||0x04||Unknown | |0x0C||0x04||Unknown | ||
|- | |- | ||
|0x10||0x04||Number of messages after this header | |0x10||0x04||Number of messages after this header | ||
|} | |||
After the header follows the StreetPass message exactly as it is stored in the outbox of [[CECD_Savegame#File_.3C12-char_ID.3E|CEC Save]]. | |||
===Response=== | |||
The following headers are expected: | |||
{| class=wikitable | |||
!Key!!colspan=3|Value!!Example | |||
|- | |||
|X-Spr-SlotXX-Result||StreetPass ID||Send Mode||Size of the file in bytes||X-Spr-Slot01-Result: 000EC400,3,17760 | |||
|} | |||
It expects a header for every game it sent in the request. | |||
The body is expected to contain binary data with the same structure as the spr-slotXX files in the request. The order of these must be the same as the reponse header order. | |||
== Structs, Data Types == | |||
Streetpass uses multiple different structs and data types for storing and transporting data. | |||
=== MessageId === | |||
This datatype holds a per-console-per-title unique message id. | |||
{| class="wikitable" border="1" | |||
! Type | |||
! Description | |||
|- | |||
| u8[8] | |||
| The message id | |||
|} | |||
=== Timestamp12 === | |||
This holds a timestamp in 12 bytes | |||
{| class="wikitable" border="1" | |||
! Offset | |||
! Size | |||
! Type | |||
! Name | |||
|- | |||
| 0x0 | |||
| 0x4 | |||
| u32 | |||
| Year | |||
|- | |||
| 0x4 | |||
| 0x1 | |||
| u8 | |||
| Month | |||
|- | |||
| 0x5 | |||
| 0x1 | |||
| u8 | |||
| Day | |||
|- | |||
| 0x6 | |||
| 0x1 | |||
| u8 | |||
| Weekday | |||
|- | |||
| 0x7 | |||
| 0x1 | |||
| u8 | |||
| Hour | |||
|- | |||
| 0x8 | |||
| 0x1 | |||
| u8 | |||
| Minute | |||
|- | |||
| 0x9 | |||
| 0x1 | |||
| u8 | |||
| Second | |||
|- | |||
| 0xA | |||
| 0x2 | |||
| u16 | |||
| Millisecond | |||
|} | |||
=== Message (0x6060) === | |||
MessageHeader: | |||
{| class="wikitable" border="1" | |||
! Offset | |||
! Size | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| 0x00 | |||
| 0x2 | |||
| u16 | |||
| magic | |||
| Equals 0x6060 (<code>``</code>) | |||
|- | |||
| 0x02 | |||
| 0x2 | |||
| u16 | |||
| Padding | |||
| | |||
|- | |||
| 0x04 | |||
| 0x04 | |||
| u32 | |||
| message_size | |||
| The size in bytes of the entire message, including all headers and hmac | |||
|- | |||
| 0x08 | |||
| 0x04 | |||
| u32 | |||
| total_header_size | |||
| The size in bytes of all headers, including the extra headers | |||
|- | |||
| 0x0C | |||
| 0x04 | |||
| u32 | |||
| body_size | |||
| The size in bytes of the body of the message | |||
|- | |||
| 0x10 | |||
| 0x04 | |||
| u32 | |||
| title_id | |||
| The title id of the message | |||
|- | |||
| 0x14 | |||
| 0x04 | |||
| u32 | |||
| title_id2 | |||
| ??? | |||
|- | |||
| 0x18 | |||
| 0x04 | |||
| u32 | |||
| batch_id | |||
| The sending client sets an ID here if multiple messages should be batched together into one transaction | |||
|- | |||
| 0x1C | |||
| 0x04 | |||
| u32 | |||
| transfer_id | |||
| All messages from the same transfer (That is, sending the messages) contain the same transfer id | |||
|- | |||
| 0x20 | |||
| 0x08 | |||
| MessageId | |||
| message_id | |||
| The ID of the sending message | |||
|- | |||
| 0x28 | |||
| 0x04 | |||
| u32 | |||
| message_version | |||
| ??? | |||
|- | |||
| 0x2C | |||
| 0x08 | |||
| MessageId | |||
| message_id_2 | |||
| The message ID that this message is referring to, e.g. the individual responses in Streetpass Mii Plaza | |||
|- | |||
| 0x34 | |||
| 0x01 | |||
| u8 | |||
| recipients | |||
| bitfield: 0x01: everyone; 0x02: friends | |||
|- | |||
| 0x35 | |||
| 0x01 | |||
| SendMethod | |||
| send_method | |||
| | |||
|- | |||
| 0x36 | |||
| 0x01 | |||
| bool | |||
| unopened | |||
| Set if the message hasn't been opened yet | |||
|- | |||
| 0x37 | |||
| 0x01 | |||
| bool | |||
| is_new | |||
| Set if the message is new | |||
|- | |||
| 0x38 | |||
| 0x08 | |||
| u64 | |||
| sender_id | |||
| | |||
|- | |||
| 0x40 | |||
| 0x08 | |||
| u64 | |||
| sender_id_2 | |||
| | |||
|- | |||
| 0x48 | |||
| 0x0C | |||
| Timestamp12 | |||
| sent | |||
| | |||
|- | |||
| 0x54 | |||
| 0x0C | |||
| Timestamp12 | |||
| received | |||
| | |||
|- | |||
| 0x60 | |||
| 0x0C | |||
| Timestamp12 | |||
| created | |||
| | |||
|- | |||
| 0x6C | |||
| 0x01 | |||
| u8 | |||
| send_count | |||
| How often this message can be sent | |||
|- | |||
| 0x6D | |||
| 0x01 | |||
| u8 | |||
| forward_count | |||
| How often this message can be forwarded | |||
|- | |||
| 0x6E | |||
| 0x02 | |||
| u16 | |||
| user_data | |||
| ??? | |||
|} | |||
ExtMessageHeader: | |||
{| class="wikitable" border="1" | |||
! Offset | |||
! Size | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| 0x00 | |||
| 0x04 | |||
| u32 | |||
| type | |||
| The type of the extra header | |||
|- | |||
| 0x04 | |||
| 0x04 | |||
| u32 | |||
| size | |||
| Size, in bytes, of the extra header | |||
|- | |||
| 0x08 | |||
| | |||
| | |||
| body | |||
| The body of the extra header | |||
|} | |||
Message: | |||
{| class="wikitable" border="1" | |||
! Offset | |||
! Size | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| 0x00 | |||
| 0x70 | |||
| MessageHeader | |||
| header | |||
| The header of the message | |||
|- | |||
| 0x70 | |||
| | |||
| ExtMessageHeader[] | |||
| ext_headers | |||
| An array of the extra headers for the message. The array keeps filling until the length no more until <code>header.total_header_size</code> | |||
|- | |||
| | |||
| | |||
| | |||
| body | |||
| The actual body/payload of the message | |||
|- | |||
| | |||
| 0x20 | |||
| u8[0x20] | |||
| hmac | |||
| The hmac over the body with the hmac_key | |||
|} | |} | ||
=== Slot (0x6161) === | |||
The slot groups multiple messages of one title id together into a single struct | |||
{| class="wikitable" border="1" | |||
! Offset | |||
! Size | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| 0x00 | |||
| 0x02 | |||
| u16 | |||
| magic | |||
| Equals 0x6161 (<code>aa</code>) | |||
|- | |||
| 0x02 | |||
| 0x02 | |||
| u16 | |||
| padding | |||
| | |||
|- | |||
| 0x04 | |||
| 0x04 | |||
| u32 | |||
| size | |||
| The size of bytes of the entire slot, including the header and all messages it contains | |||
|- | |||
| 0x08 | |||
| 0x04 | |||
| u32 | |||
| title_id | |||
| The title id of the slot | |||
|- | |||
| 0x0C | |||
| 0x04 | |||
| u32 | |||
| batch_id | |||
| If the slot contains batched messages, the batch id is set to the same one as those messages | |||
|- | |||
| 0x10 | |||
| 0x04 | |||
| u32 | |||
| message_count | |||
| The total number of messages in this slot | |||
|- | |||
| 0x14 | |||
| | |||
| Message[] | |||
| messages | |||
| An array of length <code>message_count</code> all the messages of this slot | |||
|} | |||
=== BoxInfo (0x6262) === | |||
{| class="wikitable" border="1" | |||
! Offset | |||
! Size | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| 0x00 | |||
| 0x02 | |||
| u16 | |||
| magic | |||
| Equals 0x6262 (<code>bb</code>) | |||
|- | |||
| 0x02 | |||
| 0x02 | |||
| u16 | |||
| padding | |||
| | |||
|- | |||
| 0x04 | |||
| 0x04 | |||
| u32 | |||
| file_size | |||
| The size of the box info in bytes | |||
|- | |||
| 0x08 | |||
| 0x04 | |||
| u32 | |||
| max_box_size | |||
| The maximum allowed size of the box in bytes | |||
|- | |||
| 0x0C | |||
| 0x04 | |||
| u32 | |||
| box_size | |||
| The current size of the box in bytes | |||
|- | |||
| 0x10 | |||
| 0x04 | |||
| u32 | |||
| max_num_messages | |||
| The maximum number of messages that the box can hold | |||
|- | |||
| 0x14 | |||
| 0x04 | |||
| u32 | |||
| num_messages | |||
| The current number of messages in the box | |||
|- | |||
| 0x18 | |||
| 0x04 | |||
| u32 | |||
| max_batch_size | |||
| The maximum size of a bach, in number of messages | |||
|- | |||
| 0x1C | |||
| 0x04 | |||
| u32 | |||
| max_message_size | |||
| The maximum size of a message, in bytes | |||
|- | |||
| 0x20 | |||
| | |||
| MessageHeader[] | |||
| message_headers | |||
| An array of all message headers in this box of length <code>num_messages</code> | |||
|} | |||
=== MBoxInfo (0x6363) === | |||
This holds information on the message box, including both inbox and outbox | |||
{| class="wikitable" border="1" | |||
! Offset | |||
! Size | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| 0x00 | |||
| 0x02 | |||
| u16 | |||
| magic | |||
| Equals 0x6363 (<code>cc</code>) | |||
|- | |||
| 0x02 | |||
| 0x02 | |||
| u16 | |||
| padding | |||
| | |||
|- | |||
| 0x04 | |||
| 0x04 | |||
| u32 | |||
| title_id | |||
| The title id for this mbox | |||
|- | |||
| 0x08 | |||
| 0x04 | |||
| u32 | |||
| private_id | |||
| ??? | |||
|- | |||
| 0x0C | |||
| 0x01 | |||
| u8 | |||
| mbox_type_flags | |||
| 0x01: normal programs, 0x06: system programs, 0x80: silent notif | |||
|- | |||
| 0x0D | |||
| 0x01 | |||
| bool | |||
| enabled | |||
| Weather this message box is enabled | |||
|- | |||
| 0x0E | |||
| 0x02 | |||
| u16 | |||
| padding | |||
| | |||
|- | |||
| 0x10 | |||
| 0x20 | |||
| u8[0x20] | |||
| hmac_key | |||
| The hmac key to make hmacs for messages. These are unique per title, however they are the same for all consoles. | |||
|- | |||
| 0x30 | |||
| 0x04 | |||
| u32 | |||
| padding | |||
| | |||
|- | |||
| 0x34 | |||
| 0x0C | |||
| Timestamp12 | |||
| last_accessed | |||
| | |||
|- | |||
| 0x40 | |||
| 0x01 | |||
| bool | |||
| flag_unread | |||
| Does this message box contain unread messages? | |||
|- | |||
| 0x41 | |||
| 0x01 | |||
| bool | |||
| flag_new | |||
| Does this message box contain new messages? | |||
|- | |||
| 0x42 | |||
| 0x01 | |||
| bool | |||
| flag_unknown | |||
| ??? | |||
|- | |||
| 0x43 | |||
| 0x01 | |||
| bool | |||
| flag_unknown | |||
| ??? | |||
|- | |||
| 0x44 | |||
| 0x0C | |||
| Timestamp12 | |||
| last_received | |||
| | |||
|- | |||
| 0x50 | |||
| 0x04 | |||
| u32 | |||
| padding | |||
| | |||
|- | |||
| 0x54 | |||
| 0x0C | |||
| Timestamp12 | |||
| unknown_timestamp | |||
| ??? | |||
|} | |||
=== 0x6565 === | |||
SlotMetadata: | |||
{| class="wikitable" border="1" | |||
! Offset | |||
! Size | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| 0x00 | |||
| 0x04 | |||
| u32 | |||
| title_id | |||
| The title id of the slot | |||
|- | |||
| 0x04 | |||
| 0x04 | |||
| SendMethod | |||
| send_method | |||
| The send method for the slot | |||
|- | |||
| 0x08 | |||
| 0x04 | |||
| u32 | |||
| body_size | |||
| The size of the slot body in bytes | |||
|- | |||
| 0x0C | |||
| 0x04 | |||
| u32 | |||
| count | |||
| Number of messages | |||
|- | |||
| 0x10 | |||
| 0x14 | |||
| '''unknown''' | |||
| '''unknown''' | |||
| | |||
|} | |||
Struct: | |||
{| class="wikitable" border="1" | |||
! Offset | |||
! Length | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| 0x00 | |||
| 0x02 | |||
| u16 | |||
| magic | |||
| Equals 0x6565 (<code>ee</code>) | |||
|- | |||
| 0x02 | |||
| 0x02 | |||
| u16 | |||
| padding | |||
| | |||
|- | |||
| 0x04 | |||
| 0x28 | |||
| '''unknown''' | |||
| '''unknown''' | |||
| | |||
|- | |||
| 0x2C | |||
| 0x360 | |||
| SlotMetadata[0x18] | |||
| slots | |||
| Metadata of all slots | |||
|} | |||
=== OBIndex (0x6767) === | |||
{| class="wikitable" border="1" | |||
! Offset | |||
! Size | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| 0x00 | |||
| 0x02 | |||
| u16 | |||
| magic | |||
| Equals 0x6767 (<code>gg</code>) | |||
|- | |||
| 0x02 | |||
| 0x02 | |||
| u16 | |||
| padding | |||
| | |||
|- | |||
| 0x04 | |||
| 0x04 | |||
| u32 | |||
| num_messages | |||
| The number of messages in the outbox | |||
|- | |||
| 0x08 | |||
| | |||
| MessageId[] | |||
| message_ids | |||
| An array of the message IDs in the outbox, of length <code>num_messages</code> | |||
|} | |||
=== MBoxList (0x6868) === | |||
{| class="wikitable" border="1" | |||
! Offset | |||
! Size | |||
! Type | |||
! Name | |||
! Description | |||
|- | |||
| 0x00 | |||
| 0x02 | |||
| u16 | |||
| magic | |||
| Equals 0x6868 (<code>hh</code>) | |||
|- | |||
| 0x02 | |||
| 0x02 | |||
| u16 | |||
| padding | |||
| | |||
|- | |||
| 0x04 | |||
| 0x04 | |||
| u32 | |||
| version | |||
| | |||
|- | |||
| 0x08 | |||
| 0x04 | |||
| u32 | |||
| num_boxes | |||
| The number of boxes (= games with streetpass enabled) | |||
|- | |||
| 0x0C | |||
| 0x180 | |||
| char[0x18][0x10] | |||
| box_names | |||
| A 0x18-long array of all the box names (= hex encoded title ids) of games with streetpass enabled | |||
|} | |||
[[Category:Nintendo Software]] | [[Category:Nintendo Software]] |