From 2ec267d85a05bb21049c450a2a76b85bab4b277e Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 22 Apr 2018 16:35:20 -0700 Subject: Identify region in SaveBlock1 that is reserved for external games/events to write to --- include/global.h | 13 ++++++++++--- src/pokemon_size_record.c | 2 +- src/trade.c | 6 +++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/global.h b/include/global.h index 38ba50a2c..82c4916bd 100644 --- a/include/global.h +++ b/include/global.h @@ -698,9 +698,16 @@ struct SaveBlock1 /* 0x02025734 */ /*0x2EFC*/ struct ContestWinner museumPortraits[5]; /*0x2F9C*/ struct DayCare daycare; /*0x30B8*/ struct LinkBattleRecord linkBattleRecords[5]; - /*0x3108*/ u8 filler_3108[8]; - /*0x3110*/ u8 giftRibbons[11]; - /*0x3117*/ u8 filler_311B[0x29]; + struct { + /*0x3108*/ u8 unknown1[8]; + /*0x3110*/ u8 giftRibbons[11]; + /*0x311B*/ u8 unknown2[8]; + /*0x3123*/ u32 currentPokeCoupons; + /*0x3127*/ u32 totalEarnedPokeCoupons; + /*0x312B*/ u8 unknown3[6]; + /*0x3131*/ u8 receivedWishmakerJirachi; + /*0x3132*/ u8 unknown4[18]; + } __attribute__((packed)) externalReservedData; /*0x3144*/ struct Roamer roamer; /*0x3160*/ struct EnigmaBerry enigmaBerry; /*0x3690*/ struct RamScript ramScript; diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c index f92a95bfb..1b5b41c3d 100644 --- a/src/pokemon_size_record.c +++ b/src/pokemon_size_record.c @@ -200,7 +200,7 @@ void GiveGiftRibbonToParty(u8 index, u8 ribbonId) if (index < 11 && ribbonId < 65) { - gSaveBlock1.giftRibbons[index] = ribbonId; + gSaveBlock1.externalReservedData.giftRibbons[index] = ribbonId; for (i = 0; i < 6; i++) { struct Pokemon *pkmn = &gPlayerParty[i]; diff --git a/src/trade.c b/src/trade.c index 3245ec5b0..796a01b5b 100644 --- a/src/trade.c +++ b/src/trade.c @@ -1797,7 +1797,7 @@ static bool8 sub_8048D44(void) } break; case 13: - Trade_Memcpy(gBlockSendBuffer, gSaveBlock1.giftRibbons, 11); + Trade_Memcpy(gBlockSendBuffer, gSaveBlock1.externalReservedData.giftRibbons, 11); gUnknown_03004824->unk_0075 ++; break; case 14: @@ -3777,8 +3777,8 @@ static void sub_804AF84(void) { int i; for (i = 0; i < 11; i ++) - if (gSaveBlock1.giftRibbons[i] == 0 && gUnknown_03004824->unk_00b5[i] != 0) - gSaveBlock1.giftRibbons[i] = gUnknown_03004824->unk_00b5[i]; + if (gSaveBlock1.externalReservedData.giftRibbons[i] == 0 && gUnknown_03004824->unk_00b5[i] != 0) + gSaveBlock1.externalReservedData.giftRibbons[i] = gUnknown_03004824->unk_00b5[i]; } static void sub_804AFB8(const struct WindowTemplate *windowConfig, u8 *dest, const u8 *src, u8 size) -- cgit v1.2.3 From 067c52d262468cc9d4adfd31ee1a7645cc8bb97c Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 22 Apr 2018 16:41:48 -0700 Subject: Use mon gift ribbon constants --- src/pokemon_size_record.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pokemon_size_record.c b/src/pokemon_size_record.c index 1b5b41c3d..43ad39e6f 100644 --- a/src/pokemon_size_record.c +++ b/src/pokemon_size_record.c @@ -196,7 +196,15 @@ void GiveGiftRibbonToParty(u8 index, u8 ribbonId) s32 i; bool32 gotRibbon = FALSE; u8 data = 1; - u8 arr[] = { 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E }; + u8 arr[] = { + MON_DATA_GIFT_RIBBON_1, + MON_DATA_GIFT_RIBBON_2, + MON_DATA_GIFT_RIBBON_3, + MON_DATA_GIFT_RIBBON_4, + MON_DATA_GIFT_RIBBON_5, + MON_DATA_GIFT_RIBBON_6, + MON_DATA_GIFT_RIBBON_7, + }; if (index < 11 && ribbonId < 65) { -- cgit v1.2.3