Piñata Vision barcode/Encoded data

From PinataIsland.info, the Viva Piñata wiki
Revision as of 07:28, 21 February 2011 by FeralKitty (talk | contribs) (Use cost magnitude is 3 bits)
Jump to: navigation, search

Accessory flag

Accessory flag
Optional: No
Parent: PlaceTag
Offset: 29
Size: 1 bit
See also
Accessory

The accessory flag indicates whether or not optional accessory data is encoded on the card. The accessory flag is present for all PlaceTag cards, even if the item being placed is not a pinata.

Decoding

  • If the accessory flag is clear, no optional accessory data is encoded on the card
  • If the accessory flag is set, accessory data is encoded on the card. The inclusion of this optional data appears to shift offsets for fields that follow.

Encoding

  • If the pinata will be wearing accessories, set the accessory flag, and encode the accessory details.
  • If the pinata won't be wearing accessories, clear the accessory flag. No further encoding needs to be done, as the optional accessory data will not be present.

Use cost

Use cost
Optional: No
Parent: PlaceTag
Offset: Varies

41 (AF=0)
?? (AF=1)

Size: 10 bits
Use cost value
Optional: No
Parent: Use cost
Offset: 0
Size: 7 bits
Use cost magnitude
Optional: No
Parent: Use cost
Offset: 7
Size: 3 bits
See also
Use cost flag, accessory flag

The use cost holds the cost to scan the card (if the card is not flagged as free to scan).

Its offset appears to vary, based on other optional data such as accessory information.

Decoding

  • If the use cost flag is clear, the card is free to scan, and the (non-zero) use cost data should be ignored.
  • If the use cost flag is set, use the encoded use cost as the cost to scan the card.

To obtain the use cost, multiply the value by the order of magnitude (power of 10). For example, a use cost value of 18 and a use cost magnitude of 2 would be a use cost of 18 x 102 = 18 x 100 = 1800.

Encoding

  • If the card has a cost to scan, ensure that the use cost flag is set, and encode the use cost value and magnitude.

There does seem to be some variance on how a use cost of 1000 is encoded. Some cards have it stored as 100 x 10, while others have it encoded as 10 x 100. It's uncertain whether the representations are interchangeable or not, although a particular representation may affect other fields such as a checksum.

  • If the card is free to scan, ensure that the use cost flag is clear, and store an ID-derived non-zero value in the use cost to possibly help mask a noticable barcode pattern due to a run of 0s occurring within the encoded data.
Bit(s) Value to encode
V6 to V3 0
V2 to V1 1
V0 !ID10
M2 ID9
M1 ID8
M0 ID7

Use cost flag

Use cost flag
Optional: No
Parent: PlaceTag
Offset: 35
Size: 1 bit
See also
Use cost

The use cost flag indicates whether or not there is a cost to scan the card.

Decoding

  • If the use cost flag is clear, the card is free to scan (and the non-zero encoded use cost should be ignored).
  • If the use cost flag is set, the cost to scan the card is encoded in the use cost.

Encoding

  • If the card will have a cost to scan, set the use cost flag, and encode the use cost.
  • If the card will be free to scan, clear the use cost flag, and store an ID-derived non-zero value in the use cost.

It's uncertain whether the game ignores the use cost data for free cards, or checks it to see if it was encoded properly.