Identify some more link.asm labels (syncing to pokegold)

This commit is contained in:
Rangi 2020-10-23 13:36:54 -04:00
parent 8a73bb9ab2
commit 7991db972b
6 changed files with 47 additions and 38 deletions

View File

@ -12,7 +12,7 @@ SpecialsPointers::
; Communications ; Communications
add_special SetBitsForLinkTradeRequest add_special SetBitsForLinkTradeRequest
add_special WaitForLinkedFriend add_special WaitForLinkedFriend
add_special CheckLinkTimeout add_special CheckLinkTimeout_Receptionist
add_special TryQuickSave add_special TryQuickSave
add_special CheckBothSelectedSameRoom add_special CheckBothSelectedSameRoom
add_special FailedLinkToPast add_special FailedLinkToPast

View File

@ -182,7 +182,7 @@ Gen2ToGen2LinkComms:
call ClearLinkData call ClearLinkData
call Link_PrepPartyData_Gen2 call Link_PrepPartyData_Gen2
call FixDataForLinkTransfer call FixDataForLinkTransfer
call Function29dba call CheckLinkTimeout_Gen2
ld a, [wScriptVar] ld a, [wScriptVar]
and a and a
jp z, LinkTimeout jp z, LinkTimeout
@ -1170,7 +1170,7 @@ Link_FindFirstNonControlCharacter_AllowZero:
InitTradeMenuDisplay: InitTradeMenuDisplay:
call ClearScreen call ClearScreen
call LoadTradeScreenBorder call LoadTradeScreenBorderGFX
farcall InitTradeSpeciesList farcall InitTradeSpeciesList
xor a xor a
ld hl, wOtherPlayerLinkMode ld hl, wOtherPlayerLinkMode
@ -1879,7 +1879,7 @@ LinkTrade:
ld [wCurPartyMon], a ld [wCurPartyMon], a
callfar EvolvePokemon callfar EvolvePokemon
call ClearScreen call ClearScreen
call LoadTradeScreenBorder call LoadTradeScreenBorderGFX
call SetTradeRoomBGPals call SetTradeRoomBGPals
farcall Link_WaitBGMap farcall Link_WaitBGMap
@ -1969,8 +1969,8 @@ LinkTextboxAtHL:
farcall LinkTextbox farcall LinkTextbox
ret ret
LoadTradeScreenBorder: LoadTradeScreenBorderGFX:
farcall _LoadTradeScreenBorder farcall _LoadTradeScreenBorderGFX
ret ret
SetTradeRoomBGPals: SetTradeRoomBGPals:
@ -1978,7 +1978,7 @@ SetTradeRoomBGPals:
call SetPalettes call SetPalettes
ret ret
Function28f09: ; unreferenced PlaceTradeScreenTextbox: ; unreferenced
hlcoord 0, 0 hlcoord 0, 0
ld b, 6 ld b, 6
ld c, 18 ld c, 18
@ -2061,19 +2061,20 @@ CheckTimeCapsuleCompatibility:
call GetMoveName call GetMoveName
call CopyName1 call CopyName1
pop bc pop bc
call Function29c67 call GetIncompatibleMonName
ld a, $2 ld a, $2
jr .done jr .done
.mon_has_mail .mon_has_mail
call Function29c67 call GetIncompatibleMonName
ld a, $3 ld a, $3
.done .done
ld [wScriptVar], a ld [wScriptVar], a
ret ret
Function29c67: GetIncompatibleMonName:
; Calulate which pokemon is incompatible, and get that pokemon's name
ld a, [wPartyCount] ld a, [wPartyCount]
sub b sub b
ld c, a ld c, a
@ -2243,7 +2244,7 @@ WaitForLinkedFriend:
ld [wScriptVar], a ld [wScriptVar], a
ret ret
CheckLinkTimeout: CheckLinkTimeout_Receptionist:
ld a, $1 ld a, $1
ld [wPlayerLinkAction], a ld [wPlayerLinkAction], a
ld hl, wLinkTimeoutFrames ld hl, wLinkTimeoutFrames
@ -2264,11 +2265,12 @@ CheckLinkTimeout:
ret nz ret nz
jp Link_ResetSerialRegistersAfterLinkClosure jp Link_ResetSerialRegistersAfterLinkClosure
Function29dba: CheckLinkTimeout_Gen2:
; if wScriptVar = 0 on exit, link connection is closed
ld a, $5 ld a, $5
ld [wPlayerLinkAction], a ld [wPlayerLinkAction], a
ld hl, wLinkTimeoutFrames ld hl, wLinkTimeoutFrames
ld a, $3 ld a, 3
ld [hli], a ld [hli], a
xor a xor a
ld [hl], a ld [hl], a
@ -2280,33 +2282,39 @@ Function29dba:
call Link_CheckCommunicationError call Link_CheckCommunicationError
ld a, [wScriptVar] ld a, [wScriptVar]
and a and a
jr z, .vblank jr z, .exit
ld bc, -1
; Wait for ~$70000 cycles to give the other GB time to be ready
ld bc, $ffff
.wait .wait
dec bc dec bc
ld a, b ld a, b
or c or c
jr nz, .wait jr nz, .wait
; If other GB is not ready at this point, disconnect due to timeout
ld a, [wOtherPlayerLinkMode] ld a, [wOtherPlayerLinkMode]
cp $5 cp $5
jr nz, .script_var jr nz, .timeout
; Another check to increase reliability
ld a, $6 ld a, $6
ld [wPlayerLinkAction], a ld [wPlayerLinkAction], a
ld hl, wLinkTimeoutFrames ld hl, wLinkTimeoutFrames
ld a, $1 ld a, 1
ld [hli], a ld [hli], a
ld [hl], $32 ld [hl], 50
call Link_CheckCommunicationError call Link_CheckCommunicationError
ld a, [wOtherPlayerLinkMode] ld a, [wOtherPlayerLinkMode]
cp $6 cp $6
jr z, .vblank jr z, .exit
.script_var .timeout
xor a xor a
ld [wScriptVar], a ld [wScriptVar], a
ret ret
.vblank .exit
xor a xor a
ldh [hVBlank], a ldh [hVBlank], a
ret ret
@ -2327,13 +2335,13 @@ Link_CheckCommunicationError:
call .CheckConnected call .CheckConnected
jr nz, .load_true jr nz, .load_true
call .AcknowledgeSerial call .AcknowledgeSerial
xor a xor a ; FALSE
jr .load_scriptvar jr .done
.load_true .load_true
ld a, $1 ld a, TRUE
.load_scriptvar .done
ld [wScriptVar], a ld [wScriptVar], a
ld hl, wLinkTimeoutFrames ld hl, wLinkTimeoutFrames
xor a xor a
@ -2513,10 +2521,11 @@ CableClubCheckWhichChris:
GSLinkCommsBorderGFX: ; unreferenced GSLinkCommsBorderGFX: ; unreferenced
INCBIN "gfx/trade/unused_gs_border_tiles.2bpp" INCBIN "gfx/trade/unused_gs_border_tiles.2bpp"
Function29fe4: ; unreferenced CheckSRAM0Flag: ; unreferenced
ld a, BANK(sPartyMail) ; input: hl = unknown flag array in "SRAM Bank 0"
ld a, BANK("SRAM Bank 0")
call OpenSRAM call OpenSRAM
ld d, FALSE ld d, 0
ld b, CHECK_FLAG ld b, CHECK_FLAG
predef SmallFarFlagAction predef SmallFarFlagAction
call CloseSRAM call CloseSRAM

View File

@ -10,7 +10,7 @@ LinkMonStatsScreen:
call ClearScreen call ClearScreen
call ClearBGPalettes call ClearBGPalettes
call MaxVolume call MaxVolume
farcall LoadTradeScreenBorder farcall LoadTradeScreenBorderGFX
farcall Link_WaitBGMap farcall Link_WaitBGMap
farcall InitTradeSpeciesList farcall InitTradeSpeciesList
farcall SetTradeRoomBGPals farcall SetTradeRoomBGPals

View File

@ -1,7 +1,7 @@
LinkCommsBorderGFX: LinkCommsBorderGFX:
INCBIN "gfx/trade/border_tiles.2bpp" INCBIN "gfx/trade/border_tiles.2bpp"
__LoadTradeScreenBorder: __LoadTradeScreenBorderGFX:
ld de, LinkCommsBorderGFX ld de, LinkCommsBorderGFX
ld hl, vTiles2 ld hl, vTiles2
lb bc, BANK(LinkCommsBorderGFX), 70 lb bc, BANK(LinkCommsBorderGFX), 70
@ -20,7 +20,7 @@ Function16d43b:
call ClearBGPalettes call ClearBGPalettes
call ClearTilemap call ClearTilemap
call ClearSprites call ClearSprites
farcall __LoadTradeScreenBorder ; useless to farcall farcall __LoadTradeScreenBorderGFX ; useless to farcall
farcall Function16d42e ; useless to farcall farcall Function16d42e ; useless to farcall
ld b, SCGB_DIPLOMA ld b, SCGB_DIPLOMA
call GetSGBLayout call GetSGBLayout
@ -110,7 +110,7 @@ _LinkTextbox:
ret ret
InitTradeSpeciesList: InitTradeSpeciesList:
call _LoadTradeScreenBorder call _LoadTradeScreenBorderGFX
call Function16d6ae call Function16d6ae
farcall InitMG_Mobile_LinkTradePalMap farcall InitMG_Mobile_LinkTradePalMap
farcall PlaceTradePartnerNamesAndParty farcall PlaceTradePartnerNamesAndParty
@ -122,8 +122,8 @@ InitTradeSpeciesList:
.CancelString: .CancelString:
db "CANCEL@" db "CANCEL@"
_LoadTradeScreenBorder: _LoadTradeScreenBorderGFX:
call __LoadTradeScreenBorder call __LoadTradeScreenBorderGFX
ret ret
LinkComms_LoadPleaseWaitTextboxBorderGFX: LinkComms_LoadPleaseWaitTextboxBorderGFX:

View File

@ -91,7 +91,7 @@ LinkReceptionistScript_Trade:
special TryQuickSave special TryQuickSave
iffalse .DidNotSave iffalse .DidNotSave
writetext Text_PleaseWait writetext Text_PleaseWait
special CheckLinkTimeout special CheckLinkTimeout_Receptionist
iffalse .LinkTimedOut iffalse .LinkTimedOut
readmem wOtherPlayerLinkMode readmem wOtherPlayerLinkMode
iffalse .LinkedToFirstGen iffalse .LinkedToFirstGen
@ -193,7 +193,7 @@ LinkReceptionistScript_Battle:
special TryQuickSave special TryQuickSave
iffalse .DidNotSave iffalse .DidNotSave
writetext Text_PleaseWait writetext Text_PleaseWait
special CheckLinkTimeout special CheckLinkTimeout_Receptionist
iffalse .LinkTimedOut iffalse .LinkTimedOut
readmem wOtherPlayerLinkMode readmem wOtherPlayerLinkMode
iffalse .LinkedToFirstGen iffalse .LinkedToFirstGen
@ -320,7 +320,7 @@ LinkReceptionistScript_TimeCapsule:
special TryQuickSave special TryQuickSave
iffalse .DidNotSave iffalse .DidNotSave
writetext Text_PleaseWait writetext Text_PleaseWait
special CheckLinkTimeout special CheckLinkTimeout_Receptionist
iffalse .LinkTimedOut iffalse .LinkTimedOut
readmem wOtherPlayerLinkMode readmem wOtherPlayerLinkMode
iffalse .OK iffalse .OK

View File

@ -6443,7 +6443,7 @@ Function102dd3:
ld hl, vTiles0 ld hl, vTiles0
lb bc, BANK(MobileTradeLightsGFX), 4 lb bc, BANK(MobileTradeLightsGFX), 4
call Get2bpp call Get2bpp
farcall __LoadTradeScreenBorder farcall __LoadTradeScreenBorderGFX
call EnableLCD call EnableLCD
ret ret