Thank you a ton BlackShark for this breakdown. In combination with other resources, it's been very helpful for this novice to understand the basic structure of the e-cards. I'm wondering if there's any additional details you can go into regarding what the VPK is and how it works? I'm assuming this is the machine code for the e-Reader to parse, but I wouldn't know where to start in regards to editing something beyond just a trainer or berry.
In particular, I've been curious about how multi-strip programs work for Mystery Event. It's hard enough to find any documentation regarding the e-Reader, much less about Mystery Event e-cards with more than one strip, since to my knowledge only two exist and they're both Japanese. The trainer cards, berry cards, and Eon Ticket are all one strip to scan. However, the Japanese 08-O001 Regi Doll Decoration Present is two strips, and the oft-forgotten Japanese 16-A001/2 "Berry Problem Repair Program" is a whopping four strips to scan.
Against my better judgement, I wanted to start my e-card analysis with the Berry Problem Repair Program. Since it supposedly just shifts the RTC timestamp of the save game, I found it curious that it somehow requires four strips to scan. Instead, I've discovered that the BPRP appears to not follow the same VPK rules that all other Mystery Event e-cards do.
Firstly, I should mention how these multi-strip cards differ from the single-strip ones. For every e-card .bin file, the compressed data VPK + padding is a total of 2029 bytes after the VPK size bytes. With more than one strip, the only strip that actually has padding is the final one (ie, the second strip for the Decoration Present, and the fourth strip for the BPRP), with all other strips containing VPK data in the full 2029 bytes. In addition, the VPK size bytes only seem to apply for the first strip, which denotes the combined VPK size of all strips. Every other strip has weird VPK size bytes that I don't understand.
Strip
VPK Byte
VPK Byte (Decimal)
VPK Size
Size Info Byte
08-O001 1
0x0DA4
3,492
2,029
0x021B4C42
08-O001 2
0x0D00
3,328
1,461
0x021B4C44
16-A001 1
0x19D5
6,613
2,029
0x0233B682
16-A001 2
0x087E
2,174
2,029
0x0233B684
16-A002 1
0xC203
49,667
2,029
0x0233B686
16-A002 2
0x708F
28.815
524
0x0233B688
The total VPK size for the Decoration Present is 3,490, but the first strip's VPK byte has it two bytes larger at 3,492. Likewise, the BPRP's total VPK size is 6,611 yet the first strip's VPK byte also has it two bytes larger at 6,613. I thought I miscounted multiple times, but it's peculiar that two separate strip sizes are both two bytes less. I ensured this was a trait not shared with other cards; for reference, both the English and Japanese Eggant Berry cards' VPK byte matches their VPK size (0x053F to 1,343 and 0x054B to 1,355, respectively).
This oddity aside, I was able to take the two strips from the Decoration Present e-card, cut their VPKs from each, paste the two together, and it successfully decompiled into a VPK that has "GameFreak inc," so I assume it was done properly.
On the other hand, the BPRP can't be decompiled in the same manner. The VPK tool says "Invalid vpk data" when I try decompressing a file composed of the four VPK pieces from each strip of the BPRP. Perhaps most importantly, the VPK of the first strip does lacks something every other strip does: leading with 0x306B7076, aka the text "vpk0." After the VPK size bytes, every VPK starts with that, and this includes strip 1 of the Decoration Goods (but not strip 2, likely because it's a direct continuation of the full VPK). It seems possible that the Berry Problem Repair Program uses some unique format or something, and if it doesn't follow the same format that the rest do, then this novice is immediately out of ideas.
Decoration Goods' header and VPK start, with the standard "vpk0" begin:
Berry Problem Repair Program's header and alleged VPK start, lacking the standard "vpk0":
I've included the sets of .bin files for the BPRP and Decoration Goods to look at or check my work.
berry_prog_bin_files.rar
deco_goods_bin_files.rar