Build the Virtual Console patch with make crystal11_vc (#882)

Fixes #813
This commit is contained in:
vulcandth
2022-03-12 17:34:04 -06:00
committed by GitHub
parent 775b5d046c
commit 31c3c94d64
28 changed files with 1538 additions and 8 deletions

View File

@@ -37,14 +37,23 @@ DoMysteryGift:
; Prepare the first of two messages for wMysteryGiftPartnerData
farcall StageDataForMysteryGift
call ClearMysteryGiftTrainer
vc_patch infrared_fake_0
if DEF(_CRYSTAL11_VC)
farcall StagePartyDataForMysteryGift
call ClearMysteryGiftTrainer
nop
else
ld a, 2
ld [wMysteryGiftMessageCount], a
ld a, wMysteryGiftPartnerDataEnd - wMysteryGiftPartnerData
ld [wMysteryGiftStagedDataLength], a
endc
vc_patch_end
ldh a, [rIE]
push af
call ExchangeMysteryGiftData
vc_hook infrared_fake_4
ld d, a
xor a
ldh [rIF], a
@@ -260,6 +269,26 @@ DoMysteryGift:
jp CloseSRAM
ExchangeMysteryGiftData:
vc_hook infrared_fake_2
vc_patch infrared_fake_1
if DEF(_CRYSTAL11_VC)
ld d, $ef
.loop
dec d
ld a, d
or a
jr nz, .loop
vc_hook infrared_fake_3
nop
cp MG_CANCELED
.restart ; same location as unpatched .restart
ret z
nop
nop
cp MG_OKAY
jr nz, ExchangeMysteryGiftData
ret
else
di
farcall ClearChannels
call InitializeIRCommunicationInterrupts
@@ -268,6 +297,8 @@ ExchangeMysteryGiftData:
call BeginIRCommunication
call InitializeIRCommunicationRoles
ldh a, [hMGStatusFlags]
endc
vc_patch_end
cp MG_CANCELED
jp z, EndOrContinueMysteryGiftIRCommunication
cp MG_OKAY