Identify Black Box functions

This commit is contained in:
earthoul
2025-12-01 17:53:44 +09:00
committed by dannye
parent 55ad9d2b35
commit eaeff3ed8b
11 changed files with 1227 additions and 764 deletions

View File

@@ -10,6 +10,7 @@ INCLUDE "constants/deck_ai_constants.asm"
INCLUDE "constants/deck_constants.asm"
INCLUDE "constants/duel_constants.asm"
INCLUDE "constants/duel_interface_constants.asm"
INCLUDE "constants/game_center_constants.asm"
INCLUDE "constants/gfx_constants.asm"
INCLUDE "constants/intro_constants.asm"
INCLUDE "constants/map_constants.asm"

View File

@@ -91,10 +91,11 @@ DEF PKMN_CARD_DATA_LENGTH EQU _RS ; $42
const WATER ; $03
const FIGHTING ; $04
const PSYCHIC ; $05
DEF NUM_COLORED_TYPES EQU const_value
DEF NUM_COLORED_TYPES EQU const_value ; $06
const COLORLESS ; $06
DEF NUM_PKMN_TYPES EQU const_value ; $07
const RAINBOW ; $07
DEF NUM_TYPES EQU const_value
DEF NUM_TYPES EQU const_value ; $08
; generic type (color) flag constants
DEF FIRE_F EQU $1 << FIRE ; $01
@@ -195,10 +196,12 @@ DEF PRESENT_PACK EQU 7
DEF NUM_CARDS_IN_BOOSTER EQU 10
; CARD_DATA_STAGE constants
DEF BASIC EQU $00
DEF STAGE1 EQU $01
DEF STAGE2 EQU $02
DEF STAGE2_WITHOUT_STAGE1 EQU $03
const_def
const BASIC ; 0
const STAGE1 ; 1
const STAGE2 ; 2
DEF NUM_REGULAR_EVO_STAGES EQU const_value
const STAGE2_WITHOUT_STAGE1 ; 3
; CARD_DATA_WEAKNESS and CARD_DATA_RESISTANCE constants
DEF WR_FIRE EQU $80

View File

@@ -0,0 +1,31 @@
DEF MAX_CHIPS EQU 9999
; bet / chips per play
DEF CHIPS_BET_BLACK_BOX EQU 5
DEF CHIPS_BET_BILLS_PC EQU 20
DEF CHIPS_BET_COIN_FLIP EQU 1
DEF CHIPS_BET_SLOT_1 EQU 1
DEF CHIPS_BET_SLOT_5 EQU 5
DEF CHIPS_BET_DUNGEON_10 EQU 10
DEF CHIPS_BET_DUNGEON_20 EQU 20
DEF CHIPS_BET_DUNGEON_30 EQU 30
DEF CHIPS_BET_DUNGEON_50 EQU 50
DEF CHIPS_BET_DUNGEON_100 EQU 100
; coin flip
DEF MIN_NUM_GAMECENTER_COIN_FLIP_STREAK EQU 3
DEF CHIPS_COIN_FLIP_STREAK_3 EQU 20
DEF CHIPS_COIN_FLIP_STREAK_4 EQU 40
DEF CHIPS_COIN_FLIP_STREAK_5 EQU 100
DEF CHIPS_COIN_FLIP_STREAK_6 EQU 200
DEF CHIPS_COIN_FLIP_STREAK_7 EQU 500
DEF CHIPS_COIN_FLIP_STREAK_8 EQU 1000
DEF CHIPS_COIN_FLIP_STREAK_9 EQU 3000
DEF MAX_NUM_GAMECENTER_COIN_FLIP_STREAK EQU 10
; black box
; insert 5 promos -> +[1, 5] bonus cards
DEF MAX_NUM_BLACK_BOX_INPUT EQU 5
DEF MAX_NUM_BLACK_BOX_OUTPUT EQU 10

View File

@@ -64,6 +64,11 @@ DEF FILTER_ENERGY EQU $20
DEF NUM_FILTERS EQU 9
; for FilterCardListInHL
DEF FILTER_ONLY_PKMN EQU 0
DEF FILTER_ONLY_TRAINER EQU FILTER_TRAINER >> 4 ; 1
DEF FILTER_ONLY_ENERGY EQU FILTER_ENERGY >> 4 ; 2, or any number > 1
DEF NUM_DECK_CONFIRMATION_VISIBLE_CARDS EQU 7
DEF NUM_FILTERED_LIST_VISIBLE_CARDS EQU 6

View File

@@ -26,8 +26,6 @@ DEF MAX_NUM_CARDPOP_RECORDS EQU 98
DEF CARDPOP_RECORD_SIZE EQU $20
DEF CARDPOP_RECORD_STATS_SIZE EQU $05
DEF MAX_CHIPS EQU 9999
; rJOYP constants to read IR signals
DEF P15 EQU %00100000
DEF P14 EQU %00010000

View File

@@ -336,7 +336,7 @@ DEF MAIL_MAX_NUM EQU 8
DEF MAIL_MAX_ON_SCREEN EQU 4
DEF MAIL_BUFFER_SIZE EQU MAIL_MAX_NUM + 1
DEF MAIL_QUEUE_BUFFER_SIZE EQU 25
DEF BLACK_BOX_CARDS_BUFFER_SIZE EQU 20
DEF BLACK_BOX_CARDS_BUFFER_SIZE EQU 20 ; 2 * MAX_NUM_BLACK_BOX_OUTPUT
DEF NEW_MAIL EQU $ff
DEF B_MAIL_READ EQU 7

View File

@@ -66,7 +66,7 @@ Mail:
tx MailMailboxIntroSubjectText
mail MailMailboxIntroBody1Text
mail MailMailboxIntroBody2Text
mail MailMailboxIntroBody3Text, BOOSTER_PRESENT_PACK_1, MAIL_COMMAND_GIVE_BOOSTER
mail MailMailboxIntroBody3Text, BOOSTER_PRESENT_10_ENERGY, MAIL_COMMAND_GIVE_BOOSTER
end_mail
.MailDeckDiagnosis1

View File

@@ -5316,52 +5316,59 @@ CountIfListedCardsInDeck:
or a
ret
Func_260e7:
; for a card in de,
; create in wDuelTempList a list of its unique evo cards
; also set carry if at least 1
_ListUniqueEvoCardsFromDE:
call LoadCardDataToBuffer1_FromCardID
ld hl, wLoadedCard1Name
ld c, [hl]
inc hl
ld b, [hl]
ld hl, wDuelTempList
ld de, $0
.asm_260f6
ld de, GRASS_ENERGY - 1 ; 0
.loop_cards
inc de
push hl
push de
call LoadCardDataToBuffer1_FromCardID
jr c, .asm_2611d
jr c, .exit
ld a, [wLoadedCard1Type]
cp $08
jr nc, .asm_26119
cp TYPE_ENERGY
jr nc, .next_card
ld hl, wLoadedCard1PreEvoName
ld a, c
cp [hl]
jr nz, .asm_26119
jr nz, .next_card
inc hl
ld a, b
cp [hl]
jr nz, .asm_26119
jr nz, .next_card
; found evo
pop de
pop hl
ld [hl], e
inc hl
ld [hl], d
inc hl
jr .asm_260f6
.asm_26119
jr .loop_cards
.next_card
pop de
pop hl
jr .asm_260f6
.asm_2611d
jr .loop_cards
.exit
pop de
pop hl
; append $0000 terminator
xor a
ld [hli], a
ld [hl], a
ld hl, wDuelTempList
ld a, [hli]
or [hl]
ret z
ret z ; empty
; not empty
scf
ret

View File

@@ -1560,8 +1560,8 @@ GameCenter1_NPCInteractions:
db $ff
GameCenter1_OWInteractions:
ow_script 5, 4, Func_34d15
ow_script 6, 4, Func_34d15
ow_script 5, 4, Script_BlackBox
ow_script 6, 4, Script_BlackBox
ow_script 2, 9, Func_34d35
db $ff
@@ -1695,7 +1695,7 @@ Script_34c4c:
end_script
ret
Func_34d15:
Script_BlackBox:
xor a
start_script
script_command_01
@@ -1704,7 +1704,7 @@ Func_34d15:
end_script
farcall Func_1312e
jr c, .asm_34d2f
farcall Func_4569f
farcall ProcessBlackBoxInputAndOutput
ld a, $81 ; priority black box mail
farcall AddMailToQueue
.asm_34d2f

File diff suppressed because it is too large Load Diff

View File

@@ -2266,6 +2266,9 @@ wd554:: ; d554
wCurrentNPCDuelistData:: ; d555
ds NPC_DUELIST_STRUCT_SIZE
; TODO: is this really union?
UNION
wd561:: ; d561
ds $1
@@ -2278,11 +2281,21 @@ wd563:: ; d563
wd565:: ; d565
ds $1
ds $f
NEXTU
wNumBlackBoxInputPkmnPerType:: ; d561
ds NUM_PKMN_TYPES
ENDU
ds $d
wFilteredListPtr:: ; d575
ds $2
; TODO: is this really union?
UNION
wRemainingIntroCards:: ; d577
ds $1
@@ -2295,15 +2308,34 @@ wd579:: ; d579
wIntroCardsRepeatsAllowed:: ; d57b
ds $1
wd57c:: ; d57c
NEXTU
wBlackBoxOutputCountCircle:: ; d577
ds $1
wBlackBoxOutputCountDiamond:: ; d578
ds $1
wBlackBoxOutputCountStar:: ; d579
ds $1
ds $2
wd57e:: ; d57e
wTempBlackBoxInputEvoLine:: ; d57c
wTempBlackBoxInputBasic:: ; d57c
ds $2
wd580:: ; d580
wTempBlackBoxInputStage1:: ; d57e
ds $2
wTempBlackBoxInputStage2:: ; d580
ds $2
wTempBlackBoxInputEvoLineEnd:: ; d582
ENDU
wd582:: ; d582
ds $1
@@ -2399,6 +2431,8 @@ wEventVars:: ; d59e
wGeneralVars:: ; d5d2
ds GENERAL_VAR_BYTES
; various temp flags
; e.g. blackbox input type flags, evo stage flags, etc.
wd606:: ; d606
ds wD606_STRUCT_SIZE