Identify remaining Mystery Gift labels and constants

Source: https://projectpokemon.org/home/forums/topic/43930-mystery-gift-reverse-engineering-of-ir-protocol/
This commit is contained in:
Rangi
2020-10-27 13:22:27 -04:00
parent 2738858985
commit 446f1846b1
11 changed files with 667 additions and 519 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
PrepMysteryGiftDataToSend:
StageDataForMysteryGift:
ld de, wMysteryGiftStaging
ld a, $1 + GS_VERSION
ld a, GS_VERSION + 1
ld [de], a
inc de ; wMysteryGiftStaging+1
ld a, BANK(sGameData)
@@ -46,10 +46,10 @@ PrepMysteryGiftDataToSend:
ld a, [sBackupMysteryGiftItem]
ld [de], a
inc de
ld a, [sBackupMysteryGiftItem + 1]
ld a, [sNumDailyMysteryGiftPartnerIDs]
ld [de], a
ld a, $14
ld [wca00], a
ld a, wMysteryGiftPlayerDataEnd - wMysteryGiftPlayerData
ld [wUnusedMysteryGiftStagedDataLength], a
call CloseSRAM
ld hl, wMysteryGiftStaging
ld de, wMysteryGiftPlayerData
@@ -121,7 +121,7 @@ PrepMysteryGiftDataToSend:
pop de
ret
MysteryGiftGetItemHeldEffect:
MysteryGiftGetItem:
ld a, c
cp MysteryGiftItems.End - MysteryGiftItems
jr nc, MysteryGiftFallbackItem

View File

@@ -173,12 +173,13 @@ _ResetWRAM:
ld [wRoamMon2MapNumber], a
ld [wRoamMon3MapNumber], a
ld a, BANK(sMysteryGiftItem)
ld a, BANK(sMysteryGiftItem) ; aka BANK(sMysteryGiftUnlocked)
call OpenSRAM
ld hl, sMysteryGiftItem
xor a
ld [hli], a
dec a
assert sMysteryGiftItem + 1 == sMysteryGiftUnlocked
dec a ; -1
ld [hl], a
call CloseSRAM
@@ -370,7 +371,7 @@ Continue:
ld c, 20
call DelayFrames
farcall JumpRoamMons
farcall MysteryGift_CopyReceivedDecosToPC
farcall CopyMysteryGiftReceivedDecorationsToPC
farcall ClockContinue
ld a, [wSpawnAfterChampion]
cp SPAWN_LANCE

View File

@@ -206,7 +206,7 @@ MainMenu_GetWhichMenu:
ld a, BANK(sNumDailyMysteryGiftPartnerIDs)
call OpenSRAM
ld a, [sNumDailyMysteryGiftPartnerIDs]
cp -1
cp -1 ; locked?
call CloseSRAM
jr nz, .mystery_gift
; This check makes no difference.

View File

@@ -272,7 +272,7 @@ DoMysteryGiftIfDayHasPassed:
ld hl, wBuffer1
call InitOneDayCountdown
call CloseSRAM
farcall Function1050c8
farcall ResetDailyMysteryGiftLimitIfUnlocked
.not_timed_out
ld a, BANK(sMysteryGiftTimer)