diff options
author | vulcandth <vulcandth@gmail.com> | 2022-03-14 16:03:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-14 17:03:15 -0400 |
commit | 3d58fb95569be74c6c229118a425fa22628f1dc3 (patch) | |
tree | 5ddb4fbcefce4610963397d82cef2fb3b470e956 /engine | |
parent | fddd1c132bd526cc9b15c14896becfc30288a049 (diff) |
Build the Virtual Console patches with `make gold_vc` and `make silver_vc` (#74)
Diffstat (limited to 'engine')
-rw-r--r-- | engine/battle/battle_transition.asm | 6 | ||||
-rw-r--r-- | engine/battle/core.asm | 17 | ||||
-rw-r--r-- | engine/battle_anims/anim_commands.asm | 3 | ||||
-rw-r--r-- | engine/events/print_unown.asm | 6 | ||||
-rw-r--r-- | engine/gfx/color.asm | 1 | ||||
-rw-r--r-- | engine/link/link.asm | 52 | ||||
-rw-r--r-- | engine/link/mystery_gift.asm | 36 | ||||
-rw-r--r-- | engine/menus/menu.asm | 2 | ||||
-rw-r--r-- | engine/overworld/scripting.asm | 1 | ||||
-rw-r--r-- | engine/pokedex/pokedex.asm | 1 | ||||
-rw-r--r-- | engine/pokemon/mail_2.asm | 6 |
11 files changed, 131 insertions, 0 deletions
diff --git a/engine/battle/battle_transition.asm b/engine/battle/battle_transition.asm index f5b4effe..a9d6468b 100644 --- a/engine/battle/battle_transition.asm +++ b/engine/battle/battle_transition.asm @@ -21,6 +21,7 @@ DoBattleTransition: ld hl, hVBlank ld a, [hl] push af + vc_hook FPA_link_fight_begin ld [hl], $1 .loop @@ -48,6 +49,7 @@ DoBattleTransition: ldh [hSCY], a pop af + vc_hook FPA_link_fight_End4 ldh [hVBlank], a call DelayFrame ret @@ -260,6 +262,7 @@ StartTrainerBattle_Flash: dc 0, 0, 0, 1 StartTrainerBattle_SetUpForWavyOutro: + vc_hook FPA_link_fight_End0 farcall RespawnPlayerAndOpponent call StartTrainerBattle_NextScene @@ -316,6 +319,7 @@ StartTrainerBattle_SineWave: ret StartTrainerBattle_SetUpForSpinOutro: + vc_hook FPA_link_fight_End1 farcall RespawnPlayerAndOpponent call StartTrainerBattle_NextScene xor a @@ -456,6 +460,7 @@ ENDM .wedge5: db 4, 0, 3, 0, 3, 0, 2, 0, 2, 0, 1, 0, 1, 0, 1, -1 StartTrainerBattle_SetUpForRandomScatterOutro: + vc_hook FPA_link_fight_End2 farcall RespawnPlayerAndOpponent call StartTrainerBattle_NextScene ld a, $10 @@ -674,6 +679,7 @@ StartTrainerBattle_DrawSineWave: calc_sine_wave StartTrainerBattle_ZoomToBlack: + vc_hook FPA_link_fight_End3 farcall RespawnPlayerAndOpponent ld de, .boxes diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 9f8c3421..e16ae0ad 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -5671,6 +5671,7 @@ LinkBattleSendReceiveAction: .use_move ld [wPlayerLinkAction], a + vc_hook send_byt2 callfar PlaceWaitingText .waiting @@ -5680,20 +5681,35 @@ LinkBattleSendReceiveAction: inc a jr z, .waiting + vc_hook send_byt2_ret + vc_patch send_byt2_wait +if DEF(_GOLD_VC) || DEF(_SILVER_VC) + ld b, 26 +else ld b, 10 +endc + vc_patch_end .receive call DelayFrame call LinkTransfer dec b jr nz, .receive + vc_hook send_dummy + vc_patch send_dummy_wait +if DEF(_GOLD_VC) || DEF(_SILVER_VC) + ld b, 26 +else ld b, 10 +endc + vc_patch_end .acknowledge call DelayFrame call LinkDataReceived dec b jr nz, .acknowledge + vc_hook send_dummy_end ret LoadEnemyMon: @@ -8544,6 +8560,7 @@ InitBattleDisplay: predef PlaceGraphic xor a ldh [hWY], a + vc_hook fight_begin ldh [rWY], a call WaitBGMap call HideSprites diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index a16c076a..5b2a0778 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -39,6 +39,7 @@ BattleAnimRunScript: bit 7, a jr nz, .disabled + vc_hook Reduce_move_anim_flashing call BattleAnimClearHud call RunBattleAnimScript @@ -142,6 +143,7 @@ BattleAnimRestoreHuds: call BattleAnimDelayFrame call BattleAnimDelayFrame call WaitTop + vc_hook Stop_reducing_move_anim_flashing ret BattleAnimRequestPals: @@ -646,6 +648,7 @@ BattleAnimCmd_5GFX: xor a ld [wBattleAnimGFXTempTileID], a .loop + vc_hook FPA_042801_Begin ld a, [wBattleAnimGFXTempTileID] cp (vTiles1 - vTiles0) / LEN_2BPP_TILE - BATTLEANIM_BASE_TILE ret nc diff --git a/engine/events/print_unown.asm b/engine/events/print_unown.asm index 0d67ae72..73b217b7 100644 --- a/engine/events/print_unown.asm +++ b/engine/events/print_unown.asm @@ -74,7 +74,13 @@ _UnownPrinter: jr nz, .pressed_b ldh a, [hJoyPressed] + vc_patch print_forbid_1 +if DEF(_GOLD_VC) || DEF(_SILVER_VC) + and 0 +else and A_BUTTON +endc + vc_patch_end jr nz, .pressed_a call .LeftRight diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm index 908a600b..9c0655e9 100644 --- a/engine/gfx/color.asm +++ b/engine/gfx/color.asm @@ -761,6 +761,7 @@ _PushSGBPals: InitSGBBorder: call CheckCGB + vc_hook Network_RESET ret nz ; SGB/DMG only diff --git a/engine/link/link.asm b/engine/link/link.asm index d549dc47..110d6013 100644 --- a/engine/link/link.asm +++ b/engine/link/link.asm @@ -65,7 +65,13 @@ Gen2ToGen1LinkComms: .player_1 ld de, MUSIC_NONE call PlayMusic + vc_patch NetworkDelay1 +if DEF(_GOLD_VC) || DEF(_SILVER_VC) + ld c, 26 +else ld c, 3 +endc + vc_patch_end call DelayFrames xor a ldh [rIF], a @@ -75,6 +81,7 @@ Gen2ToGen1LinkComms: ld hl, wLinkBattleRNPreamble ld de, wEnemyMon ld bc, SERIAL_RN_PREAMBLE_LENGTH + SERIAL_RNS_LENGTH + vc_hook Network358 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE ld [de], a @@ -82,6 +89,7 @@ Gen2ToGen1LinkComms: ld hl, wLinkData ld de, wOTPartyData ld bc, SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + 1 + PARTY_LENGTH + 1 + (REDMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH + 3 + vc_hook Network359 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE ld [de], a @@ -89,6 +97,7 @@ Gen2ToGen1LinkComms: ld hl, wPlayerPatchLists ld de, wOTPatchLists ld bc, 200 + vc_hook Network364 call Serial_ExchangeBytes xor a @@ -222,7 +231,13 @@ Gen2ToGen2LinkComms: .player_1 ld de, MUSIC_NONE call PlayMusic + vc_patch NetworkDelay4 +if DEF(_GOLD_VC) || DEF(_SILVER_VC) + ld c, 26 +else ld c, 3 +endc + vc_patch_end call DelayFrames xor a ldh [rIF], a @@ -232,6 +247,7 @@ Gen2ToGen2LinkComms: ld hl, wLinkBattleRNPreamble ld de, wEnemyMon ld bc, SERIAL_RN_PREAMBLE_LENGTH + SERIAL_RNS_LENGTH + vc_hook Network360 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE ld [de], a @@ -239,6 +255,7 @@ Gen2ToGen2LinkComms: ld hl, wLinkData ld de, wOTPartyData ld bc, SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + 1 + PARTY_LENGTH + 1 + 2 + (PARTYMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH + 3 + vc_hook Network361 call Serial_ExchangeBytes ld a, SERIAL_NO_DATA_BYTE ld [de], a @@ -246,6 +263,7 @@ Gen2ToGen2LinkComms: ld hl, wPlayerPatchLists ld de, wOTPatchLists ld bc, 200 + vc_hook Network362 call Serial_ExchangeBytes ld a, [wLinkMode] @@ -254,6 +272,7 @@ Gen2ToGen2LinkComms: ld hl, wLinkPlayerMail ld de, wLinkOTMail ld bc, wLinkPlayerMailEnd - wLinkPlayerMail + vc_hook Network363 call ExchangeBytes .not_trading @@ -1463,6 +1482,7 @@ ExitLinkCommunications: ldh [rSC], a ld a, (1 << rSC_ON) | (1 << rSC_CLOCK) ldh [rSC], a + vc_hook ret_heya ret PlaceTradeScreenFooter: @@ -1840,6 +1860,7 @@ LinkTrade: hlcoord 1, 14 ld de, String_TradeCompleted call PlaceString + vc_hook save_game_end ld c, 50 call DelayFrames ld a, [wLinkMode] @@ -2027,10 +2048,19 @@ GetIncompatibleMonName: ret EnterTimeCapsule: + vc_patch NetworkDelay2 +if DEF(_GOLD_VC) || DEF(_SILVER_VC) + ld c, 26 + call DelayFrames + ld a, $4 + call Link_EnsureSync +else ld a, $4 call Link_EnsureSync ld c, 40 call DelayFrames +endc + vc_patch_end xor a ldh [hVBlank], a inc a ; LINK_TIMECAPSULE @@ -2074,6 +2104,7 @@ WaitForOtherPlayerToExit: ld [hl], a ldh [hVBlank], a ld [wLinkMode], a + vc_hook term_exit ret SetBitsForLinkTradeRequest: @@ -2138,6 +2169,7 @@ WaitForLinkedFriend: ld a, (0 << rSC_ON) | (0 << rSC_CLOCK) ldh [rSC], a ld a, (1 << rSC_ON) | (0 << rSC_CLOCK) + vc_hook linkCable_fake_begin ldh [rSC], a ld a, [wLinkTimeoutFrames] dec a @@ -2230,7 +2262,13 @@ CheckLinkTimeout_Gen2: ld a, $6 ld [wPlayerLinkAction], a ld hl, wLinkTimeoutFrames + vc_patch NetworkDelay6 +if DEF(_GOLD_VC) || DEF(_SILVER_VC) + ld a, 3 +else ld a, 1 +endc + vc_patch_end ld [hli], a ld [hl], 50 call Link_CheckCommunicationError @@ -2251,9 +2289,11 @@ CheckLinkTimeout_Gen2: Link_CheckCommunicationError: xor a ldh [hSerialReceivedNewData], a + vc_hook linkCable_fake_end call WaitLinkTransfer ld hl, wLinkTimeoutFrames + vc_hook Network_RECHECK ld a, [hli] inc a jr nz, .load_true @@ -2261,7 +2301,13 @@ Link_CheckCommunicationError: inc a jr nz, .load_true + vc_patch NetworkDelay3 +if DEF(_GOLD_VC) || DEF(_SILVER_VC) + ld b, 26 +else ld b, 10 +endc + vc_patch_end .loop call DelayFrame call LinkDataReceived @@ -2287,8 +2333,10 @@ TryQuickSave: ld a, [wChosenCableClubRoom] push af farcall Link_SaveGame + vc_hook linkCable_block_input ld a, TRUE jr nc, .return_result + vc_hook linkCable_block_input2 xor a ; FALSE .return_result ld [wScriptVar], a @@ -2325,6 +2373,7 @@ CheckBothSelectedSameRoom: ret TimeCapsule: + vc_hook to_play2_mons1 ld a, LINK_TIMECAPSULE ld [wLinkMode], a call DisableSpriteUpdates @@ -2335,6 +2384,7 @@ TimeCapsule: ret TradeCenter: + vc_hook to_play2_trade ld a, LINK_TRADECENTER ld [wLinkMode], a call DisableSpriteUpdates @@ -2345,6 +2395,7 @@ TradeCenter: ret Colosseum: + vc_hook to_play2_battle ld a, LINK_COLOSSEUM ld [wLinkMode], a call DisableSpriteUpdates @@ -2357,6 +2408,7 @@ Colosseum: CloseLink: ld c, 3 call DelayFrames + vc_hook room_check jp Link_ResetSerialRegistersAfterLinkClosure FailedLinkToPast: diff --git a/engine/link/mystery_gift.asm b/engine/link/mystery_gift.asm index 08d7f060..5c99a096 100644 --- a/engine/link/mystery_gift.asm +++ b/engine/link/mystery_gift.asm @@ -35,14 +35,23 @@ DoMysteryGift: ; Prepare the first of two messages for wMysteryGiftPartnerData farcall StageDataForMysteryGift call ClearMysteryGiftTrainer + vc_patch infrared_fake_0 +if DEF(_GOLD_VC) || DEF(_SILVER_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 @@ -256,6 +265,31 @@ DoMysteryGift: ExchangeMysteryGiftData: farcall ClearChannels + vc_patch infrared_fake +if DEF(_GOLD_VC) || DEF(_SILVER_VC) + nop + vc_hook infrared_fake_5 + nop + nop + +.restart ; same location as unpatched .restart + ld d, 239 +.loop + dec d + ld a, d + or a + jr nz, .loop + vc_hook infrared_fake_3 + nop + cp MG_CANCELED + ret z + nop + nop + cp MG_OKAY + jr nz, .restart + ret + db LOW(hMGRole) ; unpatched byte left from 'ldh a, [hMGRole]' +else call InitializeIRCommunicationInterrupts .restart @@ -268,6 +302,8 @@ ExchangeMysteryGiftData: jr nz, .restart ldh a, [hMGRole] +endc + vc_patch_end cp IR_SENDER jr z, SenderExchangeMysteryGiftDataPayloads ; receiver diff --git a/engine/menus/menu.asm b/engine/menus/menu.asm index 7ff696c9..0017172d 100644 --- a/engine/menus/menu.asm +++ b/engine/menus/menu.asm @@ -215,6 +215,7 @@ _ScrollingMenuJoypad:: jr .loopRTC .pressed + vc_hook print_forbid_3 call _2DMenuInterpretJoypad jp c, .done ld a, [w2DMenuFlags1] @@ -244,6 +245,7 @@ Menu_WasButtonPressed: and a ret z scf + vc_hook print_forbid_2 ret _2DMenuInterpretJoypad: diff --git a/engine/overworld/scripting.asm b/engine/overworld/scripting.asm index c29961cf..ff060f85 100644 --- a/engine/overworld/scripting.asm +++ b/engine/overworld/scripting.asm @@ -370,6 +370,7 @@ Script_yesorno: ld a, TRUE .no ld [wScriptVar], a + vc_hook E_YESNO ret Script_loadmenu: diff --git a/engine/pokedex/pokedex.asm b/engine/pokedex/pokedex.asm index a895f357..c22775cb 100644 --- a/engine/pokedex/pokedex.asm +++ b/engine/pokedex/pokedex.asm @@ -356,6 +356,7 @@ Pokedex_UpdateDexEntryScreen: ld a, [hl] and B_BUTTON jr nz, .return_to_prev_screen + vc_hook print_forbid_5 ld a, [hl] and A_BUTTON jr nz, .do_menu_action diff --git a/engine/pokemon/mail_2.asm b/engine/pokemon/mail_2.asm index 95402ea1..353a230c 100644 --- a/engine/pokemon/mail_2.asm +++ b/engine/pokemon/mail_2.asm @@ -48,7 +48,13 @@ ReadAnyMail: ldh a, [hJoyPressed] and A_BUTTON | B_BUTTON | START jr z, .loop + vc_patch print_forbid_4 +if DEF(_GOLD_VC) || DEF(_SILVER_VC) + and 0 +else and START +endc + vc_patch_end jr nz, .pressed_start ret |