Merge pull request #110 from PikalaxALT/link

Link and some RFU
This commit is contained in:
Diegoisawesome 2018-02-11 21:10:32 -06:00 committed by GitHub
commit 98860220e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
80 changed files with 11243 additions and 19771 deletions

View File

@ -5264,7 +5264,7 @@ _08164D14:
ldrb r0, [r0]
cmp r0, 0
beq _08164DB0
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
bne _08164DB0
@ -5302,7 +5302,7 @@ _08164DB6:
thumb_func_start sub_8164DCC
sub_8164DCC: @ 8164DCC
push {lr}
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08164DDA

View File

@ -252,7 +252,7 @@ _0815226C:
ldrb r2, [r2]
cmp r3, r2
bcs _08152292
ldr r0, =gUnknown_030024F8
ldr r0, =gMain+0x238
mov r12, r0
ldr r4, =gDummyOamData
adds r2, r5, 0
@ -350,7 +350,7 @@ _08152322:
cmp r0, 0
beq _08152348
lsls r0, r6, 3
ldr r1, =gUnknown_030024F8
ldr r1, =gMain+0x238
adds r0, r1
ldr r1, =gDummyOamData
ldm r1!, {r2,r3}
@ -412,7 +412,7 @@ _08152348:
orrs r0, r1
strh r0, [r2, 0x4]
lsls r1, r6, 3
ldr r2, =gUnknown_030024F8
ldr r2, =gMain+0x238
ldr r0, [r4, 0x4]
adds r1, r2
adds r0, r5, r0
@ -746,7 +746,7 @@ _081525FC:
orrs r0, r2
strb r0, [r1, 0x19]
lsls r1, r5, 3
ldr r0, =gUnknown_030024F8
ldr r0, =gMain+0x238
adds r1, r0
ldr r0, =gDummyOamData
ldm r0!, {r2,r3}

View File

@ -143,7 +143,7 @@ sub_80B2478: @ 80B2478
lsrs r0, 24
lsls r1, 24
lsrs r1, 24
bl sub_800A0C8
bl GetLinkPlayerDataExchangeStatusTimed
lsls r0, 24
lsrs r0, 24
subs r0, 0x1
@ -205,7 +205,7 @@ sub_80B24F8: @ 80B24F8
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_800B33C
bl HasLinkErrorOccurred
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -274,7 +274,7 @@ sub_80B2578: @ 80B2578
cmp r0, 0
beq _080B258E
movs r0, 0x1
bl sub_800B330
bl SetSuppressLinkErrorMessage
_080B258E:
ldr r0, =gMain
ldrh r1, [r0, 0x2E]
@ -309,7 +309,7 @@ sub_80B25CC: @ 80B25CC
push {r4,lr}
lsls r0, 24
lsrs r4, r0, 24
bl sub_800B2E8
bl GetSioMultiSI
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -374,9 +374,9 @@ sub_80B2634: @ 80B2634
ldrsh r2, [r4, r3]
cmp r2, 0
bne _080B266C
bl sub_800A0AC
bl OpenLinkTimed
bl sub_800AB98
bl sub_800A2BC
bl ResetLinkPlayers
ldr r0, =gUnknown_08550594
bl AddWindow
strh r0, [r4, 0xA]
@ -418,7 +418,7 @@ sub_80B2688: @ 80B2688
cmp r5, 0x1
bls _080B26FC
movs r0, 0x1
bl sub_800B330
bl SetSuppressLinkErrorMessage
ldr r1, =gTasks
lsls r0, r4, 2
adds r0, r4
@ -1065,7 +1065,7 @@ _080B2C7E:
cmp r4, r0
bcc _080B2C5C
movs r0, 0
bl sub_800B330
bl SetSuppressLinkErrorMessage
bl ResetBlockReceivedFlags
ldr r0, =gSpecialVar_Result
adds r1, r5, 0
@ -1611,7 +1611,7 @@ sub_80B3144: @ 80B3144
cmp r2, 0
bne _080B3178
bl OpenLink
bl sub_800A2BC
bl ResetLinkPlayers
ldr r0, =task00_08081A90
movs r1, 0x50
bl CreateTask
@ -1710,7 +1710,7 @@ sub_80B3220: @ 80B3220
ldrb r0, [r0]
cmp r0, 0x1
bne _080B3248
bl sub_800A23C
bl IsLinkPlayerDataExchangeComplete
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -1813,7 +1813,7 @@ _080B32F8:
ldr r2, =0x00002211
adds r0, r2, 0
strh r0, [r1]
bl sub_8009FAC
bl ClearLinkCallback_2
b _080B3346
.pool
_080B3318:
@ -1926,7 +1926,7 @@ _080B3408:
ldr r2, =0x00002211
adds r1, r2, 0
strh r1, [r0]
bl sub_8009FAC
bl ClearLinkCallback_2
movs r0, 0x1
strh r0, [r6]
b _080B3532
@ -1945,7 +1945,7 @@ _080B343A:
b _080B3532
.pool
_080B3444:
ldr r1, =gUnknown_020229CC
ldr r1, =gLocalLinkPlayer
movs r0, 0
movs r2, 0x1C
bl SendBlock
@ -2172,7 +2172,7 @@ sub_80B360C: @ 80B360C
movs r5, 0x1
eors r0, r5
bl sub_813C2A0
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _080B36B2
@ -2400,7 +2400,7 @@ _080B382E:
movs r0, 0x1
movs r1, 0
bl FadeScreen
bl sub_8009FAC
bl ClearLinkCallback_2
b _080B3864
_080B3840:
ldr r0, =gPaletteFade
@ -2512,7 +2512,7 @@ _080B391C:
thumb_func_start sub_80B3924
sub_80B3924: @ 80B3924
push {lr}
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _080B3940
@ -2552,7 +2552,7 @@ sub_80B3968: @ 80B3968
ldr r2, =0x00002211
adds r0, r2, 0
strh r0, [r1]
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _080B3994
@ -2652,7 +2652,7 @@ task00_08081A90: @ 80B3A30
cmp r1, r0
ble _080B3A62
bl CloseLink
ldr r0, =c2_800ACD4
ldr r0, =CB2_LinkError
bl SetMainCallback2
adds r0, r4, 0
bl DestroyTask
@ -2661,7 +2661,7 @@ _080B3A62:
ldrb r0, [r0]
cmp r0, 0
beq _080B3AA6
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
bne _080B3AA0
@ -2670,7 +2670,7 @@ _080B3A62:
cmp r0, 0
bne _080B3A86
bl CloseLink
ldr r0, =c2_800ACD4
ldr r0, =CB2_LinkError
bl SetMainCallback2
_080B3A86:
adds r0, r4, 0
@ -2752,7 +2752,7 @@ _080B3B20:
beq _080B3B9E
b _080B3BB8
_080B3B2A:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _080B3B40
@ -2808,7 +2808,7 @@ _080B3B9E:
ldrb r0, [r0]
cmp r0, 0x1
bne _080B3BB8
bl sub_800A23C
bl IsLinkPlayerDataExchangeComplete
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -2825,7 +2825,7 @@ _080B3BB8:
thumb_func_start sub_80B3BC4
sub_80B3BC4: @ 80B3BC4
push {lr}
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
bne _080B3BD6

View File

@ -643,7 +643,7 @@ _080D7C04:
bl sub_800E0E8
movs r0, 0x8
movs r1, 0x8
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
_080D7C56:
pop {r4-r6}
pop {r0}

View File

@ -2128,9 +2128,9 @@ sub_80F6AE8: @ 80F6AE8
bl sub_800E0E8
movs r0, 0x8
movs r1, 0x8
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
ldr r4, =gSprites
ldr r0, =gUnknown_02022B10
ldr r0, =gWirelessStatusIndicatorSpriteId
ldrb r1, [r0]
lsls r0, r1, 4
adds r0, r1

View File

@ -147,7 +147,7 @@ sub_80FC5DC: @ 80FC5DC
ldr r1, =gUnknown_02039F2A
movs r0, 0x1
strb r0, [r1]
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0x1
bne _080FC60C

View File

@ -8987,7 +8987,7 @@ _080AF994:
beq _080AF9D0
b _080AF9E8
_080AF99A:
bl sub_8009FAC
bl ClearLinkCallback_2
movs r0, 0x1
movs r1, 0
bl FadeScreen

View File

@ -7126,7 +7126,7 @@ _0813B790:
b _0813B7C6
.pool
_0813B7A8:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
bne _0813B7B4

View File

@ -282,7 +282,7 @@ _0816CE6C:
.pool
_0816CE8C:
bl GameCubeMultiBoot_Quit
ldr r0, =sub_800BA38
ldr r0, =SerialCB
bl SetSerialCallback
_0816CE96:
movs r0, 0
@ -562,7 +562,7 @@ task_intro_2: @ 816D12C
movs r0, 0xCF
lsls r0, 1
bl m4aSongNumStart
bl sub_800B628
bl ResetSerial
add sp, 0x4
pop {r4,r5}
pop {r0}

File diff suppressed because it is too large Load Diff

2021
asm/link_rfu.s Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,20 @@
@ Does nothing.
.macro nop
.macro nop
.byte 0x00
.endm
@ Does nothing.
.macro nop1
.macro nop1
.byte 0x01
.endm
@ Terminates script execution.
.macro end
.macro end
.byte 0x02
.endm
@ Jumps back to after the last-executed call statement, and continues script execution from there.
.macro return
.macro return
.byte 0x03
.endm
@ -71,12 +71,12 @@
.endm
@ Executes a script stored in a default RAM location.
.macro gotoram
.macro gotoram
.byte 0x0c
.endm
@ Terminates script execution and "resets the script RAM".
.macro killscript
.macro killscript
.byte 0x0d
.endm
@ -271,7 +271,7 @@
.endm
@ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock state, the script will remain blocked indefinitely (essentially a hang).
.macro waitstate
.macro waitstate
.byte 0x27
.endm
@ -307,12 +307,12 @@
.endm
@ Runs time based events. In FireRed, this command is a nop.
.macro dodailyevents
.macro dodailyevents
.byte 0x2d
.endm
@ Sets the values of variables 0x8000, 0x8001, and 0x8002 to the current hour, minute, and second. In FRLG, this command sets those variables to zero.
.macro gettime
.macro gettime
.byte 0x2e
.endm
@ -323,7 +323,7 @@
.endm
@ Blocks script execution until the currently-playing sound (triggered by playse) finishes playing.
.macro waitse
.macro waitse
.byte 0x30
.endm
@ -334,7 +334,7 @@
.endm
@ Blocks script execution until all currently-playing fanfares finish.
.macro waitfanfare
.macro waitfanfare
.byte 0x32
.endm
@ -352,7 +352,7 @@
.endm
@ Crossfades the currently-playing song into the map's default song.
.macro fadedefaultbgm
.macro fadedefaultbgm
.byte 0x35
.endm
@ -460,7 +460,7 @@
.endm
@ Retrieves the number of Pokemon in the player's party, and stores that number in variable 0x800D (LASTRESULT).
.macro getpartysize
.macro getpartysize
.byte 0x43
.endm
@ -612,7 +612,7 @@
.endm
@ If the script was called by an Object, then that Object will turn to face toward the metatile that the player is standing on.
.macro faceplayer
.macro faceplayer
.byte 0x5a
.endm
@ -679,17 +679,17 @@
@ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this command behind-the-scenes), and blocks script execution until the battle finishes.
.macro trainerbattlebegin
.macro trainerbattlebegin
.byte 0x5d
.endm
@ Goes to address after the trainerbattle command (called by the battle functions, see battle_setup.c)
.macro gotopostbattlescript
.macro gotopostbattlescript
.byte 0x5e
.endm
@ Goes to address specified in the trainerbattle command (called by the battle functions, see battle_setup.c)
.macro gotobeatenscript
.macro gotobeatenscript
.byte 0x5f
.endm
@ -730,7 +730,7 @@
.endm
@ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the box and its text have been fully drawn.
.macro waitmessage
.macro waitmessage
.byte 0x66
.endm
@ -741,32 +741,32 @@
.endm
@ Closes the current message box.
.macro closemessage
.macro closemessage
.byte 0x68
.endm
@ Ceases movement for all Objects on-screen.
.macro lockall
.macro lockall
.byte 0x69
.endm
@ If the script was called by an Object, then that Object's movement will cease.
.macro lock
.macro lock
.byte 0x6a
.endm
@ Resumes normal movement for all Objects on-screen, and closes any standard message boxes that are still open.
.macro releaseall
.macro releaseall
.byte 0x6b
.endm
@ If the script was called by an Object, then that Object's movement will resume. This command also closes any standard message boxes that are still open.
.macro release
.macro release
.byte 0x6c
.endm
@ Blocks script execution until the player presses any key.
.macro waitbuttonpress
.macro waitbuttonpress
.byte 0x6d
.endm
@ -807,7 +807,7 @@
.endm
@ Nopped in Emerald.
.macro drawbox
.macro drawbox
.byte 0x72
.endm
@ -838,7 +838,7 @@
.endm
@ Hides all boxes displayed with drawmonpic.
.macro erasemonpic
.macro erasemonpic
.byte 0x76
.endm
@ -978,22 +978,22 @@
.endm
@ This allows you to choose a Pokemon to use in a contest. In FireRed, this command sets the byte at 0x03000EA8 to 0x01.
.macro choosecontestmon
.macro choosecontestmon
.byte 0x8b
.endm
@ Starts a contest. In FireRed, this command is a nop.
.macro startcontest
.macro startcontest
.byte 0x8c
.endm
@ Shows the results of a contest. In FireRed, this command is a nop.
.macro showcontestresults
.macro showcontestresults
.byte 0x8d
.endm
@ Starts a contest over a link connection. In FireRed, this command is a nop.
.macro contestlinktransfer
.macro contestlinktransfer
.byte 0x8e
.endm
@ -1033,7 +1033,7 @@
.endm
@ Hides the secondary box spawned by showmoney.
.macro hidemoneybox
.macro hidemoneybox
.byte 0x94
.endm
@ -1104,7 +1104,7 @@
.endm
@ Checks the player's gender. If male, then 0x0000 is stored in variable 0x800D (LASTRESULT). If female, then 0x0001 is stored in LASTRESULT.
.macro checkplayergender
.macro checkplayergender
.byte 0xa0
.endm
@ -1125,7 +1125,7 @@
.endm
@ Queues a weather change to the default weather for the map.
.macro resetweather
.macro resetweather
.byte 0xa3
.endm
@ -1136,7 +1136,7 @@
.endm
@ Executes the weather change queued with resetweather or setweather. The current weather will smoothly fade into the queued weather.
.macro doweather
.macro doweather
.byte 0xa5
.endm
@ -1195,7 +1195,7 @@
.endm
@ Waits for the door animation started with opendoor or closedoor to finish.
.macro waitdooranim
.macro waitdooranim
.byte 0xae
.endm
@ -1223,7 +1223,7 @@
.endm
@ In FireRed and Emerald, this command is a nop.
.macro showelevmenu
.macro showelevmenu
.byte 0xb2
.endm
@ -1251,7 +1251,7 @@
.endm
@ Starts a wild battle against the Pokemon generated by setwildbattle. Blocks script execution until the battle finishes.
.macro dowildbattle
.macro dowildbattle
.byte 0xb7
.endm
@ -1335,7 +1335,7 @@
.endm
@ Blocks script execution until cry finishes.
.macro waitmoncry
.macro waitmoncry
.byte 0xc5
.endm
@ -1359,17 +1359,17 @@
.endm
@ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
.macro unloadhelp
.macro unloadhelp
.byte 0xc9
.endm
@ After using this command, all standard message boxes will use the signpost frame.
.macro signmsg
.macro signmsg
.byte 0xca
.endm
@ Ends the effects of signmsg, returning message box frames to normal.
.macro normalmsg
.macro normalmsg
.byte 0xcb
.endm
@ -1393,7 +1393,7 @@
.endm
@ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the offset specified by the pointer at 0x020375C0.
.macro execram
.macro execram
.byte 0xcf
.endm
@ -1424,7 +1424,7 @@
.2byte \unknown
.endm
.macro mossdeepgym2
.macro mossdeepgym2
.byte 0xd4
.endm
@ -1434,7 +1434,7 @@
.2byte \var
.endm
.macro mossdeepgym4
.macro mossdeepgym4
.byte 0xd6
.endm
@ -1446,15 +1446,15 @@
.2byte \word2
.endm
.macro cmdD8
.macro cmdD8
.byte 0xd8
.endm
.macro cmdD9
.macro cmdD9
.byte 0xd9
.endm
.macro hidebox2
.macro hidebox2
.byte 0xda
.endm
@ -1519,7 +1519,7 @@
.endm
.macro case condition, dest
compare_var_to_value 0x8000, \condition
compare 0x8000, \condition
goto_eq \dest
.endm

View File

@ -3180,7 +3180,7 @@ CB2_NewGame: @ 8085EF8
ldr r1, =gUnknown_03005DB0
movs r0, 0
str r0, [r1]
ldr r0, =gUnknown_030026F8
ldr r0, =gMain+0x438
bl do_load_map_stuff_loop
bl SetFieldVBlankCallback
ldr r0, =c1_overworld
@ -3255,7 +3255,7 @@ c2_load_new_map: @ 8085FCC
thumb_func_start c2_load_new_map_2
c2_load_new_map_2: @ 8085FFC
push {lr}
ldr r0, =gUnknown_030026F8
ldr r0, =gMain+0x438
bl do_load_map_stuff_loop
bl SetFieldVBlankCallback
ldr r0, =c1_overworld
@ -3317,7 +3317,7 @@ sub_8086074: @ 8086074
thumb_func_start c2_80567AC
c2_80567AC: @ 8086098
push {lr}
ldr r0, =gUnknown_030026F8
ldr r0, =gMain+0x438
bl map_loading_iteration_3
cmp r0, 0
beq _080860B8
@ -3356,7 +3356,7 @@ _080860EA:
thumb_func_start c2_exit_to_overworld_2_local
c2_exit_to_overworld_2_local: @ 80860F4
push {lr}
ldr r0, =gUnknown_030026F8
ldr r0, =gMain+0x438
bl sub_8086638
cmp r0, 0
beq _0808610A
@ -3375,7 +3375,7 @@ c2_exit_to_overworld_2_link: @ 8086118
bl sub_8087598
cmp r0, 0
bne _08086132
ldr r0, =gUnknown_030026F8
ldr r0, =gMain+0x438
bl map_loading_iteration_2_link
cmp r0, 0
beq _08086132
@ -3395,7 +3395,7 @@ c2_8056854: @ 8086140
ldr r0, =c1_link_related
bl set_callback1
bl sub_8086C2C
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08086174
@ -3586,7 +3586,7 @@ sub_808631C: @ 808631C
bne _0808632E
bl CloseLink
_0808632E:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08086348
@ -3768,14 +3768,14 @@ _080864DA:
bl cur_mapheader_run_tileset_funcs_after_some_cpuset
b _08086506
_080864E0:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08086506
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
b _08086506
.pool
_080864FC:
@ -4056,14 +4056,14 @@ _08086766:
bl cur_mapheader_run_tileset_funcs_after_some_cpuset
b _08086792
_0808676C:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08086792
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
b _08086792
.pool
_08086788:
@ -4565,7 +4565,7 @@ _08086BCA:
thumb_func_start c1_link_related
c1_link_related: @ 8086BD8
push {r4,lr}
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08086BF2
@ -4578,7 +4578,7 @@ c1_link_related: @ 8086BD8
_08086BF2:
ldr r0, =gUnknown_03005DB4
ldrb r4, [r0]
ldr r0, =gUnknown_03003020
ldr r0, =gLinkPartnersHeldKeys
adds r1, r4, 0
bl sub_8086F38
ldr r0, =gUnknown_03000E14
@ -4610,7 +4610,7 @@ sub_8086C2C: @ 8086C2C
thumb_func_start sub_8086C40
sub_8086C40: @ 8086C40
push {lr}
ldr r0, =gUnknown_03003020
ldr r0, =gLinkPartnersHeldKeys
bl sub_808709C
pop {r0}
bx r0
@ -4631,7 +4631,7 @@ c1_link_related_func_set: @ 8086C50
thumb_func_start sub_8086C64
sub_8086C64: @ 8086C64
push {lr}
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08086C82
@ -5029,7 +5029,7 @@ _08086FC0:
movs r0, 0x11
strh r0, [r1]
_08086FC6:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08086FFC
@ -5926,7 +5926,7 @@ _08087666:
thumb_func_start sub_808766C
sub_808766C: @ 808766C
push {lr}
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
bne _08087688
@ -5946,11 +5946,11 @@ _0808768A:
thumb_func_start sub_8087690
sub_8087690: @ 8087690
push {lr}
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
bne _080876B0
ldr r0, =gUnknown_03003170
ldr r0, =gLink
ldr r1, =0x00000339
adds r0, r1
ldrb r0, [r0]

View File

@ -25789,7 +25789,7 @@ sub_81D3B54: @ 81D3B54
adds r5, r1, 0
bl sub_81D41A0
movs r7, 0x2
ldr r4, =gUnknown_03003144
ldr r4, =gShouldAdvanceLinkState
_081D3B64:
bl sub_81D4170
ldr r0, =gUnknown_030012E2
@ -25857,7 +25857,7 @@ sub_81D3BE8: @ 81D3BE8
adds r5, r0, 0
bl sub_81D41A0
movs r6, 0x2
ldr r4, =gUnknown_03003144
ldr r4, =gShouldAdvanceLinkState
_081D3BF6:
bl sub_81D4170
ldr r0, =gUnknown_030012E2
@ -26006,7 +26006,7 @@ sub_81D3D34: @ 81D3D34
movs r1, 0x8
orrs r0, r1
strh r0, [r2]
ldr r0, =gUnknown_03003144
ldr r0, =gShouldAdvanceLinkState
strb r3, [r0]
ldr r0, =gUnknown_030012E6
strh r3, [r0]
@ -26062,7 +26062,7 @@ _081D3DC8:
beq _081D3DD8
bl sub_81D413C
_081D3DD8:
ldr r0, =gUnknown_03003144
ldr r0, =gShouldAdvanceLinkState
ldrb r0, [r0]
cmp r0, 0x2
beq _081D3DE2
@ -26080,7 +26080,7 @@ _081D3DE8:
movs r0, 0x3
strb r0, [r1, 0x1]
_081D3DFC:
ldr r0, =gUnknown_03003144
ldr r0, =gShouldAdvanceLinkState
ldrb r0, [r0]
cmp r0, 0x2
bne _081D3E18
@ -28050,7 +28050,7 @@ _081D4E12:
beq _081D4E1C
movs r5, 0x3
_081D4E1C:
ldr r1, =gUnknown_03003144
ldr r1, =gShouldAdvanceLinkState
movs r0, 0
strb r0, [r1]
adds r0, r5, 0
@ -28074,7 +28074,7 @@ sub_81D4E30: @ 81D4E30
strh r0, [r1]
bl OpenLink
movs r0, 0x1
bl sub_800B330
bl SetSuppressLinkErrorMessage
pop {r0}
bx r0
.pool
@ -28090,7 +28090,7 @@ sub_81D4E60: @ 81D4E60
strh r0, [r1]
movs r0, 0
strh r0, [r2]
ldr r0, =gUnknown_03003174
ldr r0, =gLink+0x4
ldr r1, [r0, 0x4]
ldr r0, [r0]
str r0, [sp, 0x4]
@ -28157,7 +28157,7 @@ sub_81D4EE4: @ 81D4EE4
lsrs r0, 24
cmp r0, 0x2
bhi _081D4F08
bl sub_800B33C
bl HasLinkErrorOccurred
lsls r0, 24
cmp r0, 0
beq _081D4F08
@ -28256,7 +28256,7 @@ _081D4FB6:
ldrb r0, [r0]
cmp r0, 0
beq _081D4FE6
bl sub_800A23C
bl IsLinkPlayerDataExchangeComplete
lsls r0, 24
cmp r0, 0
beq _081D4FE0
@ -28665,7 +28665,7 @@ _081D5360:
strb r0, [r4, 0x8]
b _081D548A
_081D536A:
bl sub_800B33C
bl HasLinkErrorOccurred
lsls r0, 24
cmp r0, 0
beq _081D537A

View File

@ -621,7 +621,7 @@ _080E726C:
bne _080E730A
movs r0, 0x4
strh r0, [r5]
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
bne _080E7296
@ -664,7 +664,7 @@ _080E72C0:
ldr r0, [r0]
bl Free
bl sub_808729C
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _080E72F8
@ -747,7 +747,7 @@ _080E7384:
movs r0, 0xC8
lsls r0, 1
strh r0, [r5, 0x8]
bl sub_8009FAC
bl ClearLinkCallback_2
b _080E7566
.pool
_080E73A0:
@ -2393,7 +2393,7 @@ _080E80C0:
lsls r0, 24
cmp r0, 0
bne _080E810A
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _080E80E8

View File

@ -448,4 +448,5 @@ _081357EE:
.pool
thumb_func_end sub_81357BC
.align 2, 0 @ Don't pad with nop.

File diff suppressed because it is too large Load Diff

View File

@ -366,7 +366,7 @@ sub_8034EFC: @ 8034EFC
movs r0, 0
strh r0, [r1]
lsls r1, r5, 3
ldr r2, =gUnknown_030022F8
ldr r2, =gMain+0x38
mov r9, r2
add r1, r9
mov r0, r8

View File

@ -1100,7 +1100,7 @@ sub_80F90DC: @ 80F90DC
bl sub_800E0E8
movs r0, 0x8
movs r1, 0x8
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
_080F90FE:
pop {r0}
bx r0

View File

@ -1615,7 +1615,7 @@ _080A0506:
thumb_func_start sub_80A0514
sub_80A0514: @ 80A0514
push {lr}
ldr r0, =gUnknown_030026F8
ldr r0, =gMain+0x438
bl sub_80A03E4
cmp r0, 0
beq _080A052E
@ -1712,7 +1712,7 @@ _080A05AC:
movs r2, 0x10
movs r3, 0
bl BeginNormalPaletteFade
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _080A0620

View File

@ -136,7 +136,7 @@ _08077258:
thumb_func_start sub_8077260
sub_8077260: @ 8077260
push {lr}
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08077280
@ -410,7 +410,7 @@ _080774B2:
ldr r0, [r0]
adds r0, 0xA8
strb r2, [r0]
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08077528
@ -511,7 +511,7 @@ _080775E8:
beq _080775F2
b _08077B46
_080775F2:
bl sub_800A23C
bl IsLinkPlayerDataExchangeComplete
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -532,7 +532,7 @@ _08077600:
ldr r0, [r0]
adds r0, 0xA8
strb r2, [r0]
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
bne _0807762A
@ -544,7 +544,7 @@ _0807762A:
b _08077B46
.pool
_08077648:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08077680
@ -564,7 +564,7 @@ _0807765C:
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
b _08077B46
.pool
_08077680:
@ -1183,14 +1183,14 @@ _08077C28:
b _080780D8
.pool
_08077C3C:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08077C50
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
_08077C50:
ldr r1, =gMain
movs r3, 0x87
@ -1781,7 +1781,7 @@ sub_807816C: @ 807816C
adds r0, 0x7E
ldrb r0, [r0]
strb r0, [r1, 0x1]
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _080781B4
@ -1810,7 +1810,7 @@ sub_80781C8: @ 80781C8
ldr r5, =gMain
ldr r0, =sub_80773AC
str r0, [r5, 0x8]
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08078220
@ -4005,7 +4005,7 @@ sub_8079490: @ 8079490
ands r0, r1
cmp r0, 0
bne _080794C4
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _080794B4
@ -4030,7 +4030,7 @@ _080794C4:
thumb_func_start sub_80794CC
sub_80794CC: @ 80794CC
push {lr}
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _08079518
@ -7026,7 +7026,7 @@ _0807AC92:
cmp r1, r0
bls _0807ACC4
bl CloseLink
ldr r0, =c2_800ACD4
ldr r0, =CB2_LinkError
bl SetMainCallback2
ldr r1, [r4]
adds r3, r1, 0
@ -7408,7 +7408,7 @@ _0807B006:
beq _0807B014
b _0807B116
_0807B014:
bl sub_800A23C
bl IsLinkPlayerDataExchangeComplete
lsls r0, 24
lsrs r0, 24
cmp r0, 0x1
@ -7508,14 +7508,14 @@ _0807B0F0:
ands r0, r1
cmp r0, 0
bne _0807B116
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _0807B110
bl sub_800E0E8
movs r0, 0
movs r1, 0
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
_0807B110:
ldr r0, =sub_807EA2C
bl SetMainCallback2
@ -12857,7 +12857,7 @@ _0807E4AE:
_0807E4B2:
strb r0, [r1]
_0807E4B4:
bl sub_800B33C
bl HasLinkErrorOccurred
lsls r0, 24
cmp r0, 0
bne _0807E4C2
@ -13832,7 +13832,7 @@ _0807EDC0:
movs r0, 0x15
bl IncrementGameStat
_0807EDCE:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _0807EDF6
@ -14045,7 +14045,7 @@ _0807EFA4:
lsrs r0, 24
cmp r0, 0x1
bne _0807F03A
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _0807EFD8
@ -14072,7 +14072,7 @@ _0807EFE4:
b _0807F03A
.pool
_0807EFF0:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _0807F028
@ -14100,7 +14100,7 @@ _0807F028:
ldr r0, =c2_080543C4
bl SetMainCallback2
_0807F03A:
bl sub_800B33C
bl HasLinkErrorOccurred
lsls r0, 24
cmp r0, 0
bne _0807F048
@ -14142,7 +14142,7 @@ c2_080543C4: @ 807F068
ldr r0, [r4]
bl Free
str r5, [r4]
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0
beq _0807F0B6
@ -14884,7 +14884,7 @@ _0807F6F8:
ldr r0, =c2_080543C4
bl SetMainCallback2
_0807F70C:
bl sub_800B33C
bl HasLinkErrorOccurred
lsls r0, 24
cmp r0, 0
bne _0807F71A

View File

@ -187,7 +187,7 @@ _080C2830:
bl sub_80C4630
b _080C28D4
_080C2836:
ldr r0, =gLinkVSyncDisabled
ldr r0, =gWirelessCommType
ldrb r0, [r0]
cmp r0, 0x1
bne _080C2852
@ -198,7 +198,7 @@ _080C2836:
bl sub_800E0E8
movs r0, 0xE6
movs r1, 0x96
bl sub_800DFB4
bl CreateWirelessStatusIndicatorSprite
_080C2852:
movs r6, 0x1
negs r6, r6

37
common_syms/link.txt Normal file
View File

@ -0,0 +1,37 @@
gLinkPartnersHeldKeys
gLinkDebugSeed
gLocalLinkPlayerBlock
gLinkErrorOccurred
gLinkDebugFlags
gFiller_03003074
gRemoteLinkPlayersNotReceived
gBlockReceivedStatus
gFiller_03003080
gLinkHeldKeys
gRecvCmds
gLinkStatus
gUnknown_030030E4
gUnknown_030030E8
gUnknown_030030EC
gUnknown_030030F0
gUnknown_030030F4
gSuppressLinkErrorMessage
gWirelessCommType
gSavedLinkPlayerCount
gSendCmd
gSavedMultiplayerId
gReceivedRemoteLinkPlayers
gLinkTestBGInfo
gLinkCallback
gShouldAdvanceLinkState
gLinkTestBlockChecksums
gBlockRequestType
gFiller_03003154
gFiller_03003158
gFiller_0300315c
gLastSendQueueCount
gLink
gLastRecvQueueCount
gLinkSavedIme
gFiller_03004138
gFiller_0300413C

2
common_syms/link_rfu.txt Normal file
View File

@ -0,0 +1,2 @@
gUnknown_03004140
gUnknown_03005000

9
common_syms/main.txt Normal file
View File

@ -0,0 +1,9 @@
gKeyRepeatStartDelay
gLinkTransferringData
gMain
gKeyRepeatContinueDelay
gSoftResetDisabled
gIntrTable
gLinkVSyncDisabled
IntrMain_Buffer
gPcmDmaCounter

5
common_syms/window.txt Normal file
View File

@ -0,0 +1,5 @@
filler_03002F58
filler_03002F5C
gUnknown_03002F60
filler_03002F64
gUnknown_03002F70

View File

@ -7,306 +7,7 @@
.section .rodata
.align 2
gWirelessLinkDisplayPal:: @ 82EC86C
.incbin "graphics/interface/wireless_link_display.gbapal"
gWirelessLinkDisplayGfx:: @ 82EC88C
.incbin "graphics/interface/wireless_link_display.4bpp.lz"
gWirelessLinkDisplayTilemap:: @ 82ECD34
.incbin "graphics/interface/wireless_link_display.bin.lz"
gLinkTestDigitsPal:: @ 82ECF20
.incbin "graphics/interface/link_test_digits.gbapal"
gLinkTestDigitsGfx:: @ 82ECF40
.incbin "graphics/interface/link_test_digits.4bpp"
.string "{HIGHLIGHT TRANSPARENT}{COLOR WHITE}$"
.align 2
g2BlankTilesGfx:: @ 82ED168
.incbin "graphics/interface/blank_1x2.4bpp"
gUnknown_082ED1A8:: @ 82ED1A8
.4byte gBlockSendBuffer
.4byte 0x000000C8
.4byte gBlockSendBuffer
.4byte 0x000000C8
.4byte gBlockSendBuffer
.4byte 0x00000064
.4byte gBlockSendBuffer
.4byte 0x000000DC
.4byte gBlockSendBuffer
.4byte 0x00000028
gUnknown_082ED1D0:: @ 82ED1D0
.byte 0x8, 0xA, 0xC, 0xE
gASCIIGameFreakInc:: @ 82ED1D4
.ascii "GameFreak inc."
.align 2
gASCIITestPrint:: @ 82ED1E4
.ascii "TEST PRINT\nP0\nP1\nP2\nP3"
.align 2
gUnknown_082ED1FC:: @ 82ED1FC BgTemplate
.4byte 0x000001F8
.4byte 0x00001081
.align 2
gUnknown_082ED204:: @ 82ED204
window_template 0x00, 0x00, 0x00, 0x1E, 0x05, 0x0F, 0x0002
window_template 0x00, 0x00, 0x06, 0x1E, 0x07, 0x0F, 0x0098
window_template 0x00, 0x00, 0x0D, 0x1E, 0x07, 0x0F, 0x016A
null_window_template
.align 2
gUnknown_082ED224:: @ 82ED224
.byte 0x00, 0x01, 0x02, 0x00, 0xff, 0xfe, 0xff, 0x00
.align 2
gWirelessLinkIconPalette:: @ 82ED22C
.incbin "graphics/interface/wireless_link_icon.gbapal"
.align 2
gWirelessLinkIconPic:: @ 82ED22C
.incbin "graphics/interface/wireless_link_icon.4bpp.lz"
.align 2
gUnknown_082ED370:: @ 82ED370
.byte 0xff, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x37
.byte 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f
.byte 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47
.byte 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f
.byte 0x00, 0xab, 0xb5, 0xb6, 0xb1, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0xb2, 0xf1, 0x00, 0xae, 0xad, 0xba
.byte 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8
.byte 0xa9, 0xaa, 0x00, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
.byte 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, 0xc0, 0xc1
.byte 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9
.byte 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1
.byte 0xd2, 0xd3, 0xd4, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6
.byte 0x00, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb
.byte 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3
.byte 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb
.byte 0xec, 0xed, 0xee, 0x2d, 0x2f, 0x30, 0x31, 0x32
.byte 0x33, 0x34, 0x35, 0x36, 0x50, 0x00, 0x01, 0x02
.byte 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a
.byte 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12
.byte 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a
.byte 0x1b, 0xad, 0xb3, 0xb4, 0x00, 0xaf, 0x7d, 0x7f
.byte 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0xa0
.byte 0xae, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57
.byte 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f
.byte 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67
.byte 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f
.byte 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77
.byte 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7e, 0xb0, 0xac
.byte 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23
.byte 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b
.byte 0x2c, 0x2e, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c
.byte 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94
.align 2
gUnknown_082ED470:: @ 82ED470
.byte 0x20, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c
.byte 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94
.byte 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c
.byte 0x9d, 0x9e, 0x9f, 0xa0, 0xe0, 0xe1, 0xe2, 0xe3
.byte 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb
.byte 0xec, 0xed, 0xee, 0xef, 0xf0, 0x7b, 0xf1, 0x7c
.byte 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x07
.byte 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
.byte 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17
.byte 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
.byte 0x84, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7
.byte 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf
.byte 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7
.byte 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf
.byte 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7
.byte 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xa6, 0xdd, 0xa7
.byte 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xf2
.byte 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa
.byte 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0x01, 0x02, 0x03
.byte 0x04, 0x05, 0x06, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f
.byte 0xaf, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36
.byte 0x37, 0x38, 0x39, 0x21, 0xdf, 0xa1, 0xb0, 0xa5
.byte 0xde, 0x24, 0x2a, 0xa2, 0xa3, 0x22, 0x23, 0x20
.byte 0xa4, 0x20, 0x2f, 0x41, 0x42, 0x43, 0x44, 0x45
.byte 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d
.byte 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55
.byte 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63
.byte 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b
.byte 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73
.byte 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20
.byte 0x20, 0x2b, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, 0x20
.byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00
.align 2
gUnknown_082ED570:: @ 82ED570
.byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00
.align 2
gUnknown_082ED578:: @ 82ED578
.2byte 0x0004, 0x0005, 0x0008, 0x0005, 0x000c, 0x0005, 0x0010, 0x000a
.2byte 0x000c, 0x0005, 0x0008, 0x0005, 0xfffe, 0x0000
.align 2
gUnknown_082ED594:: @ 82ED594
.2byte 0x0004, 0x0005, 0x0008, 0x0005, 0x000c, 0x000a, 0x0008, 0x0005
.2byte 0xfffe, 0x0000
.align 2
gUnknown_082ED5A8:: @ 82ED5A8
.2byte 0x0004, 0x0005, 0x0008, 0x0005, 0xfffe, 0x0000
.align 2
gUnknown_082ED5B4:: @ 82ED5B4
.2byte 0x0004, 0x000a, 0x0014, 0x000a, 0xfffe, 0x0000
.align 2
gUnknown_082ED5C0:: @ 82ED5C0
.2byte 0x0018, 0x000a, 0x0004, 0x000a, 0xfffe, 0x0000
.align 2
gUnknown_082ED5CC:: @ 82ED5CC
.4byte gUnknown_082ED578
.4byte gUnknown_082ED594
.4byte gUnknown_082ED5A8
.4byte gUnknown_082ED5B4
.4byte gUnknown_082ED5C0
.align 2
gUnknown_082ED5E0:: @ 82ED5E0
obj_tiles gWirelessLinkIconPic, 0x0380, 0xD431
.align 2
gUnknown_082ED5E8:: @ 82ED5E8
obj_pal gWirelessLinkIconPalette, 0xD432
.align 2
gUnknown_082ED5F0:: @ 82ED5F0
spr_template 0xD431, 0xD432, gUnknown_082ED570, gUnknown_082ED5CC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy
.align 2
gUnknown_082ED608:: @ 82ED608
.byte 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00
.byte 0x14, 0x2b, 0x02, 0x02, 0x22, 0x2b, 0x02, 0x02
.byte 0x01, 0x00, 0x58, 0x02, 0x2c, 0x01, 0x00, 0x00
.align 2
gUnknown_082ED620:: @ 82ED620
.byte 0x00, 0x03, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00
.align 2
gUnknown_082ED628:: @ 82ED628
.4byte 0x00000000, 0x00000001, 0x00000003, 0x00000007
.4byte 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f
.4byte 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff
.4byte 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff
.4byte 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff
.4byte 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff
.4byte 0x00ffffff
gUnknown_082ED68C:: @ 82ED68C
.byte 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02
.byte 0x03
gUnknown_082ED695:: @ 82ED695
.byte 0x00, 0x01, 0x01, 0x02, 0x01, 0x02, 0x02, 0x03
.byte 0x01, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x04
gUnknown_082ED6A5:: @ 82ED6A5
.byte 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00
.byte 0x03, 0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00
.byte 0x00, 0x00, 0x00
.align 2
gUnknown_082ED6B8:: @ 82ED6B8
.4byte gBlockSendBuffer
.4byte 0x000000c8
.4byte gBlockSendBuffer
.4byte 0x000000c8
.4byte gBlockSendBuffer
.4byte 0x00000064
.4byte gBlockSendBuffer
.4byte 0x000000dc
.4byte gBlockSendBuffer
.4byte 0x00000028
.align 2
gUnknown_082ED6E0:: @ 82ED6E0
.2byte 0x0002, 0x7f7d, 0x0000, 0xffff
.ascii "RFU WAIT"
.space 7
.ascii "RFU BOOT"
.space 7
.ascii "RFU ERROR"
.space 6
.ascii "RFU RESET"
.space 6
.ascii "RFU CONFIG"
.space 5
.ascii "RFU START"
.space 6
.ascii "RFU SC POLL"
.space 4
.ascii "RFU SP POLL"
.space 4
.ascii "RFU START"
.space 6
.ascii "RFU SEND ERR"
.space 3
.ascii "RFU CP POLL"
.space 4
.ascii " "
.space 2
.ascii "RECOVER START "
.space 2
.ascii "DISSCONECT "
.space 2
.ascii "RECOVER SUUSES"
.space 2
.ascii "RECOVER FAILED"
.space 2
.align 2
gUnknown_082ED7E0:: @ 82ED7E0
.4byte sub_801084C
.4byte sub_8010AAC
.4byte sub_8010D0C
.align 2
gUnknown_082ED7EC:: @ 82ED7EC
.ascii "PokemonSioInfo"
.align 2
gUnknown_082ED7FC:: @ 82ED7FC
.ascii "LINK LOSS DISCONNECT!"
.align 2
gUnknown_082ED814:: @ 82ED814
.ascii "LINK LOSS RECOVERY NOW"
.align 2
gUnknown_082ED82C:: @ 82ED82C
.byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
.byte 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
@ -323,25 +24,25 @@ gUnknown_082ED85B:: @ 82ED85B
gUnknown_082ED868:: @ 82ED868
.asciz "NOWSLOT"
.asciz " "
.asciz "CLOCK DRIFT"
.asciz "BUSY SEND "
.asciz "CMD REJECT "
.asciz "CLOCK SLAVE"
.ascii "CHILD "
.align 2
.ascii "PARENT"
.align 2
.ascii "SEARCH"
.align 2
gText_EmptyString:: @ 82ED8C4
.string "$"
@ -371,7 +72,7 @@ gText_AwaitingCommunication:: @ 82ED960
gText_AwaitingLink:: @ 82ED990
.string "{STR_VAR_1}! Awaiting link!\nPress START when everyones ready.$"
.align 2
gJPText_SingleBattle:: @ 82ED9C8
.string " $" @ "shingurubatoruwo kaisaisuru" ("hold a single battle" in Japanese)
@ -387,7 +88,7 @@ gJPText_MultiBattle:: @ 82ED9E8
.align 2
gJPText_TradePokemon:: @ 82ED9F8
.string " $" @ "pokemonkoukanwo kaisaisuru" ("trade Pokémon" in Japanese)
.align 2
gJPText_Chat:: @ 82EDA0C
.string " $" @ "chattowo kaisaisuru" ("chat" in Japanese)
@ -459,7 +160,7 @@ gText_3PlayerMode:: @ 82EDB35
gText_4PlayerMode:: @ 82EDB43
.string "4-PLAYER\nMODE$"
gText_5PlayerMode:: @ 82EDB51
.string "5-PLAYER\nMODE$"
@ -710,7 +411,7 @@ gUnknown_082EE2E8:: @ 82EE2E8
.align 2
gUnknown_082EE308:: @ 82EE308
.string "{STR_VAR_1} has contacted you.{PAUSE 60}$"
.align 2
gUnknown_082EE324:: @ 82EE324
.4byte gUnknown_082EE2E8
@ -719,7 +420,7 @@ gUnknown_082EE324:: @ 82EE324
.align 2
gUnknown_082EE32C:: @ 82EE32C
.string "Awaiting a response from\nthe other TRAINER$"
.align 2
gUnknown_082EE358:: @ 82EE358
.string "Awaiting a response from\n{STR_VAR_1}$"
@ -1622,7 +1323,7 @@ gUnknown_082F0204:: @ 82F0204 struct ListMenuTemplate
.align 2
gUnknown_082F021C:: @ 82F021C
window_template 0x00, 0x14, 0x05, 0x10, 0x08, 0x0f, 0x0001
.align 2
gUnknown_082F0224:: @ 82F0224
.4byte gUnknown_082EFD70, 0x00000208
@ -1708,7 +1409,7 @@ gUnknown_082F0354:: @ 82F0354
.4byte gText_EmptyString, 0x00000006
.4byte gText_EmptyString, 0x00000007
.4byte gUnknown_082EFD84, 0x00000008
.align 2
gUnknown_082F03A4:: @ 82F03A4
.4byte gUnknown_082F0354
@ -1719,7 +1420,7 @@ gUnknown_082F03A4:: @ 82F03A4
.align 2
window_template 0x00, 0x01, 0x05, 0x1c, 0x0c, 0x0d, 0x0039
.align 2
gUnknown_082F03C4:: @ 82F03C4
.4byte gText_EmptyString, 0x00000000
@ -1745,7 +1446,7 @@ gUnknown_082F03C4:: @ 82F03C4
.4byte nullsub_14
.byte 0x10, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00
.byte 0x21, 0x31, 0x40, 0x01
.align 2
gUnknown_082F045C:: @ 82F045C
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
@ -2006,7 +1707,7 @@ gUnknown_082F06F8:: @ 82F06F8
.align 2
gUnknown_082F0720:: @ 82F0720
.byte 0x00, 0x01, 0x02
.align 2
.byte 0x00, 0x01, 0x02
@ -2185,7 +1886,7 @@ gWonderCardBgGfx3:: @ 82F1300
.align 2
gWonderCardBgTilemap3:: @ 82F13D4
.incbin "graphics/wonder_transfers/wonder_card_3.bin.lz"
.align 2
gWonderCardBgGfx7:: @ 82F14A8
.incbin "graphics/wonder_transfers/wonder_card_7.4bpp.lz"
@ -2193,7 +1894,7 @@ gWonderCardBgGfx7:: @ 82F14A8
.align 2
gWonderCardBgTilemap7:: @ 82F16DC
.incbin "graphics/wonder_transfers/wonder_card_7.bin.lz"
.align 2
gWonderCardBgGfx8:: @ 82F1824
.incbin "graphics/wonder_transfers/wonder_card_8.4bpp.lz"
@ -2233,7 +1934,7 @@ gWonderCardShadowPal7:: @ 82F1C5C
.align 2
gWonderCardShadowPal8:: @ 82F1C7C
.incbin "graphics/wonder_transfers/wonder_card_shadow_8.gbapal"
.align 2
gWonderCardShadowGfx:: @ 82F1C9C
.incbin "graphics/wonder_transfers/wonder_card_shadow.4bpp.lz"
@ -2248,31 +1949,31 @@ gUnknown_082F1D00:: @ 82F1D00 struct CompressedSpriteSheet
gUnknown_082F1D08:: @ 82F1D08 struct SpritePalette
.4byte gWonderCardShadowPal1
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal2
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal3
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal4
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal5
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal6
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal7
.2byte 0x8000
.align 2
.4byte gWonderCardShadowPal8
.2byte 0x8000
@ -2553,7 +2254,7 @@ gUnknown_082F2800:: @ 82F2800
.align 2
gUnknown_082F2884:: @ 82F2884
.byte 0x12, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00
.4byte gUnknown_082F25F8
.byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00
@ -2581,13 +2282,13 @@ gUnknown_082F28E4:: @ 82F28E4
.4byte gUnknown_082F2884
.byte 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.4byte gUnknown_082F2788
.align 2
gUnknown_082F292C:: @ 82F292C
.byte 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00
.4byte gUnknown_082F26A8
.byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
@ -2595,7 +2296,7 @@ gUnknown_082F292C:: @ 82F292C
.byte 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00
.byte 0x10, 0x00, 0x00, 0x00
.4byte gUnknown_082F25E8
.byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00
@ -2639,7 +2340,7 @@ gUnknown_082F29EC:: @ 82F29EC
.byte 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.4byte gUnknown_082F26F8
.byte 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00
@ -2836,15 +2537,15 @@ gUnknown_082F2DF0:: @ 82F2DF0
.align 2
gUnknown_082F2E10:: @ 82F2E10
.incbin "graphics/interface/unk_cursor.4bpp.lz"
.align 2
gUnknown_082F3094:: @ 82F3094
.incbin "graphics/interface/unk_dash.4bpp.lz"
.align 2
gUnknown_082F30B4:: @ 82F30B4
.incbin "graphics/interface/unk_cursor_arrow.4bpp.lz"
.align 2
gUnknown_082F30E0:: @ 82F30E0
.incbin "graphics/interface/unk_rbutton.4bpp.lz"
@ -2916,7 +2617,7 @@ gUnknown_082F31D4:: @ 82F31D4
.align 2
gUnknown_082F31EC:: @ 82F31EC
.byte 0x00, 0x00, 0x00, 0x40, 0x00, 0x08, 0x00, 0x00
.align 2
gUnknown_082F31F4:: @ 82F31F4
.byte 0x00, 0x40, 0x00, 0x80, 0x00, 0x08, 0x00, 0x00
@ -3192,25 +2893,25 @@ gUnknown_082F42D0:: @ 82F42D0
.align 2
gUnknown_082F42E8:: @ 82F42E8
.4byte gUnknown_082F423C
.align 2
gUnknown_082F42EC:: @ 82F42EC
.4byte gUnknown_082F4244
.4byte gUnknown_082F4254
.align 2
gUnknown_082F42F4:: @ 82F42F4
.4byte gUnknown_082F4268
.4byte gUnknown_082F4284
.align 2
gUnknown_082F42FC:: @ 82F42FC
.4byte gUnknown_082F42A8
.align 2
gUnknown_082F4300:: @ 82F4300
.4byte gUnknown_082F42B0
.align 2
gUnknown_082F4304:: @ 82F4304
.4byte gUnknown_082F42B8

12
include/agb_flash.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef GUARD_AGB_FLASH_H
#define GUARD_AGB_FLASH_H
// Exported type declarations
// Exported RAM declarations
// Exported ROM declarations
u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void));
#endif //GUARD_AGB_FLASH_H

11
include/crt0.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef GUARD_CRT0_H
#define GUARD_CRT0_H
// Exported type declarations
// Exported RAM declarations
// Exported ROM declarations
extern u32 IntrMain[];
#endif //GUARD_CRT0_H

View File

@ -28,6 +28,7 @@ void LoadSpecialPokePic(const struct CompressedSpriteSheet *src, void *dest, s32
void LoadSpecialPokePic_2(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic);
void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src, void *dest, s32 species, u32 personality, bool8 isFrontPic);
extern u8 gDecompressionBuffer[];
u32 sub_8034974(const u8 *ptr);
#endif // GUARD_DECOMPRESS_H

View File

@ -623,6 +623,23 @@
#define TIMER_INTR_ENABLE 0x40
#define TIMER_ENABLE 0x80
// BGCNT
#define BGCNT_PRIORITY(n) (n) // Values 0 - 3. Lower priority BGs will be drawn on top of higher priority BGs.
#define BGCNT_CHARBASE(n) ((n) << 2) // Values 0 - 3. Base block for tile pixel data.
#define BGCNT_MOSAIC 0x0040
#define BGCNT_16COLOR 0x0000 // 4 bits per pixel
#define BGCNT_256COLOR 0x0080 // 8 bits per pixel
#define BGCNT_SCREENBASE(n) ((n) << 8) // Values 0 - 31. Base block for tile map.
#define BGCNT_WRAP 0x2000 // Only affects affine BGs. Text BGs wrap by default.
#define BGCNT_TXT256x256 0x0000 // Internal screen size size of text mode BG in pixels.
#define BGCNT_TXT512x256 0x4000
#define BGCNT_TXT256x512 0x8000
#define BGCNT_TXT512x512 0xC000
#define BGCNT_AFF128x128 0x0000 // Internal screen size size of affine mode BG in pixels.
#define BGCNT_AFF256x256 0x4000
#define BGCNT_AFF512x512 0x8000
#define BGCNT_AFF1024x1024 0xC000
// serial
#define SIO_ID 0x0030 // Communication ID

View File

@ -11,6 +11,7 @@
// to help in decompiling
#define asm_comment(x) asm volatile("@ -- " x " -- ")
#define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided")
#define ASM_DIRECT __attribute__((naked))
// IDE support
#if defined (__APPLE__) || defined (__CYGWIN__)
@ -87,6 +88,7 @@ enum LanguageId
LANGUAGE_SPANISH = 7,
};
#define GAME_VERSION (VERSION_EMERALD)
#define GAME_LANGUAGE (LANGUAGE_ENGLISH)
enum
@ -605,6 +607,11 @@ struct WaldaPhrase
bool8 patternUnlocked;
};
struct UnkSaveSubstruct_3b98 {
u32 trainerId;
u8 trainerName[8];
};
struct SaveBlock1
{
/*0x00*/ struct Coords16 pos;
@ -689,7 +696,9 @@ struct SaveBlock1
/*0x3B14*/ struct RecordMixingGift recordMixingGift;
/*0x3B24*/ u8 seen2[52];
/*0x3B58*/ LilycoveLady lilycoveLady;
/*0x3B88*/ u8 filler_3B88[0x1E8];
/*0x3B88*/ u8 filler_3B88[0x10];
/*0x3B98*/ struct UnkSaveSubstruct_3b98 unk_3B98[20];
/*0x3C88*/ u8 filler_3C88[0xE8];
/*0x3D70*/ struct WaldaPhrase waldaPhrase;
// sizeof: 0x3D88
};

View File

@ -1,6 +1,12 @@
#ifndef GUARD_INTRO_H
#define GUARD_INTRO_H
// Exported type declarations
// Exported RAM declarations
// Exported ROM declarations
void c2_copyright_1(void);
void CB2_InitCopyrightScreenAfterBootup(void);
void CB2_InitCopyrightScreenAfterTitleScreen(void);
void sub_816F2A8(u16, u16, u16, u16);

View File

@ -17,6 +17,8 @@ extern struct BagStruct gUnknown_0203CE58;
// Exported RAM declarations
extern u16 gSpecialVar_ItemId;
// Exported ROM declarations
void sub_81AAC50(void);
void sub_81AAC70(void);

View File

@ -67,6 +67,28 @@ union RfuPacket
struct RfuPacket8 rfuPacket8;
};
struct __attribute__((packed)) UnkLinkRfuStruct_02022B14
{
u16 unk_00_0:4;
u16 unk_00_4:1;
u16 unk_00_5:1;
u16 unk_00_6:1;
u16 unk_00_7:1;
u16 unk_01_0:1;
u16 unk_01_1:1;
u16 unk_01_2:4;
u16 unk_01_6:2;
u8 playerTrainerId[2];
u8 unk_04[4];
u16 unk_08_0:10;
u16 unk_09_2:6;
u8 unk_0a_0:7;
u8 unk_0a_7:1;
u8 playerGender:1;
u8 unk_0b_1:7;
u8 unk_0c;
};
struct RfuStruct
{
vs32 unk_0;
@ -103,6 +125,127 @@ struct RfuIntrStruct
u8 block2[0x30];
};
struct RfuUnk1
{
u16 unk_0;
u8 unk_2;
u8 unk_3;
u8 fill_4[14];
u8 unk_12;
u32 unk_14;
u32 unk_18;
struct RfuIntrStruct unk_1c;
};
struct RfuUnk2
{
u16 unk_0;
u16 unk_2;
u8 fill_4[0x16];
u8 unk_1a;
u8 fill_1b[0x19];
u16 unk_34;
u16 unk_36;
u8 fill_38[0x16];
u8 unk_4e;
u8 fill_4f[0x12];
u8 unk_61;
u8 fill_62[6];
void *unk_68;
void *unk_6c;
u8 unk_70[0x70];
};
struct RfuUnk3
{
u32 unk_0;
u32 unk_4;
u8 unk_8[0xD4];
u32 unk_dc;
};
struct RfuUnk5Sub {
u16 unk_00;
u8 unk_02;
u16 unk_04;
struct UnkLinkRfuStruct_02022B14 unk_06;
u8 fill_13[2];
u8 unk_15[8];
};
struct RfuUnk5
{
u8 unk_00;
u8 unk_01;
u8 unk_02;
u8 unk_03;
u8 unk_04;
u8 unk_05;
u8 unk_06;
u8 unk_07;
u8 unk_08;
u8 filler_09[1];
u8 unk_0a[4];
u8 filler_0e[6];
struct RfuUnk5Sub unk_14[4];
};
extern struct RfuStruct *gRfuState;
extern struct RfuUnk5 *gUnknown_03007890;
extern u32 *gUnknown_03007894;
extern struct RfuUnk3* gUnknown_03007898;
extern struct RfuUnk2* gUnknown_03007880[4];
extern struct RfuUnk1* gUnknown_03007870[4];
extern void* sub_82E53F4;
extern void rfu_STC_clearAPIVariables(void);
struct UnkLinkRfuStruct_02022B14;
void STWI_init_all(struct RfuIntrStruct *interruptStruct, IntrFunc *interrupt, bool8 copyInterruptToRam);
void rfu_REQ_stopMode(void);
void rfu_waitREQComplete(void);
u32 rfu_REQBN_softReset_and_checkID(void);
void rfu_REQ_sendData(u8);
void rfu_setMSCCallback(void (*func)(u16));
void rfu_setREQCallback(void (*func)(u16, u16));
bool8 rfu_getMasterSlave(void);
void rfu_REQBN_watchLink(u16 a0, u8 *a1, u8 *a2, u8 *a3);
bool16 rfu_syncVBlank(void);
void rfu_REQ_reset(void);
void rfu_REQ_configSystem(u16, u8, u8);
void rfu_REQ_configGameData(u8, u16, struct UnkLinkRfuStruct_02022B14 *, u8 *);
void rfu_REQ_startSearchChild(void);
void rfu_REQ_pollSearchChild(void);
void rfu_REQ_endSearchChild(void);
void rfu_REQ_startSearchParent(void);
void rfu_REQ_pollSearchParent(void);
void rfu_REQ_endSearchParent(void);
void rfu_REQ_startConnectParent(u16);
void rfu_REQ_pollConnectParent(void);
void rfu_REQ_endConnectParent(void);
void rfu_REQ_CHILD_startConnectRecovery(u8);
void rfu_REQ_CHILD_pollConnectRecovery(void);
void rfu_REQ_CHILD_endConnectRecovery(void);
void rfu_REQ_changeMasterSlave(void);
void rfu_REQ_RFUStatus(void);
void rfu_getRFUStatus(u8 *status);
u8 *rfu_getSTWIRecvBuffer(void);
u8 rfu_NI_CHILD_setSendGameName(u8 a0, u8 a1);
void rfu_clearSlot(u8 a0, u8 a1);
void rfu_clearAllSlot(void);
bool16 rfu_CHILD_getConnectRecoveryStatus(u8 *status);
bool16 rfu_getConnectParentStatus(u8 *status, u8 *a1);
bool16 rfu_UNI_PARENT_getDRAC_ACK(u8 *a0);
void rfu_REQ_disconnect(u8 who);
void rfu_changeSendTarget(u8 a0, u8 who, u8 a2);
void rfu_NI_stopReceivingData(u8 who);
u16 rfu_initializeAPI(u32 *unk0, u16 unk1, IntrFunc *interrupt, bool8 copyInterruptToRam);
void rfu_setTimerInterrupt(u8 which, IntrFunc *intr);
void rfu_setRecvBuffer(u8 a0, u8 a1, void *a2, size_t a3);
bool16 rfu_UNI_setSendData(u8 flag, void *ptr, u8 size);
void rfu_REQ_recvData(void);
void rfu_UNI_readySendData(u8 a0);
void rfu_UNI_clearRecvNewDataFlag(u8 a0);
void rfu_REQ_PARENT_resumeRetransmitAndChange(void);
void rfu_NI_setSendData(u8, u8, u8 *, u8);

View File

@ -7,6 +7,9 @@
#define QUEUE_CAPACITY 50
#define BLOCK_BUFFER_SIZE 0x100
#define LINK_SLAVE 0
#define LINK_MASTER 8
#define LINK_STAT_LOCAL_ID 0x00000003
#define LINK_STAT_PLAYER_COUNT 0x0000001C
#define LINK_STAT_PLAYER_COUNT_SHIFT 2
@ -16,7 +19,23 @@
#define LINK_STAT_CONN_ESTABLISHED_SHIFT 6
#define LINK_STAT_RECEIVED_NOTHING 0x00000100
#define LINK_STAT_RECEIVED_NOTHING_SHIFT 8
#define LINK_STAT_UNK_FLAG_9 0x00000200
#define LINK_STAT_UNK_FLAG_9_SHIFT 9
#define LINK_STAT_ERRORS 0x0007F000
#define LINK_STAT_ERRORS_SHIFT 12
#define LINK_STAT_ERROR_HARDWARE 0x00001000
#define LINK_STAT_ERROR_HARDWARE_SHIFT 12
#define LINK_STAT_ERROR_CHECKSUM 0x00002000
#define LINK_STAT_ERROR_CHECKSUM_SHIFT 13
#define LINK_STAT_ERROR_QUEUE_FULL 0x00004000
#define LINK_STAT_ERROR_QUEUE_FULL_SHIFT 14
#define LINK_STAT_ERROR_LAG_MASTER 0x00010000
#define LINK_STAT_ERROR_LAG_MASTER_SHIFT 16
#define LINK_STAT_ERROR_INVALID_ID 0x00020000
#define LINK_STAT_ERROR_INVALID_ID_SHIFT 17
#define LINK_STAT_ERROR_LAG_SLAVE 0x00040000
#define LINK_STAT_ERROR_LAG_SLAVE_SHIFT 18
#define EXTRACT_PLAYER_COUNT(status) \
(((status) & LINK_STAT_PLAYER_COUNT) >> LINK_STAT_PLAYER_COUNT_SHIFT)
@ -26,10 +45,41 @@
(((status) >> LINK_STAT_CONN_ESTABLISHED_SHIFT) & 1)
#define EXTRACT_RECEIVED_NOTHING(status) \
(((status) >> LINK_STAT_RECEIVED_NOTHING_SHIFT) & 1)
#define EXTRACT_LINK_ERRORS(status) \
(((status) & LINK_STAT_ERRORS) >> LINK_STAT_ERRORS_SHIFT)
#define LINKCMD_SEND_LINK_TYPE 0x2222
#define LINKCMD_0x2FFE 0x2FFE
#define LINKCMD_SEND_HELD_KEYS 0x4444
#define LINKCMD_0x5555 0x5555
#define LINKCMD_0x5566 0x5566
#define LINKCMD_0x5FFF 0x5FFF
#define LINKCMD_0x6666 0x6666
#define LINKCMD_0x7777 0x7777
#define LINKCMD_CONT_BLOCK 0x8888
#define LINKCMD_0xAAAA 0xAAAA
#define LINKCMD_0xAAAB 0xAAAB
#define LINKCMD_INIT_BLOCK 0xBBBB
#define LINKCMD_SEND_HELD_KEYS_2 0xCAFE
#define LINKCMD_0xCCCC 0xCCCC
struct LinkStatus
{
u32 localId:2;
u32 playerCount:3;
u32 master:1;
u32 connEstablished:1;
u32 unused_7:1;
u32 receivedNothing:1;
u32 unused_9:7;
u32 errors:7;
};
#define MASTER_HANDSHAKE 0x8FFF
#define SLAVE_HANDSHAKE 0xB9A0
#define SIO_MULTI_CNT ((struct SioMultiCnt *)REG_ADDR_SIOCNT)
enum
{
LINK_STATE_START0,
@ -45,6 +95,9 @@ enum
EXCHANGE_COMPLETE,
EXCHANGE_TIMED_OUT,
EXCHANGE_IN_PROGRESS,
EXCHANGE_STAT_4,
EXCHANGE_STAT_5,
EXCHANGE_STAT_6
};
enum
@ -75,18 +128,18 @@ struct LinkPlayer
struct LinkPlayerBlock
{
u8 magic1[16];
char magic1[16];
struct LinkPlayer linkPlayer;
u8 magic2[16];
char magic2[16];
};
// circular queues
struct SendQueue
{
u16 data[CMD_LENGTH][QUEUE_CAPACITY];
u8 pos;
u8 count;
/* 0x000 */ u16 data[CMD_LENGTH][QUEUE_CAPACITY];
/* 0x320 */ u8 pos;
/* 0x321 */ u8 count;
};
struct RecvQueue
@ -98,29 +151,29 @@ struct RecvQueue
struct Link
{
u8 isMaster; // 0: slave, 8: master
u8 state;
u8 localId; // local multi-player ID
u8 playerCount;
u16 tempRecvBuffer[4];
bool8 receivedNothing;
s8 serialIntrCounter;
bool8 handshakeAsMaster;
u8 link_field_F;
/* 0x000 */ u8 isMaster; // 0: slave, 8: master
/* 0x001 */ u8 state;
/* 0x002 */ u8 localId; // local multi-player ID
/* 0x003 */ u8 playerCount;
/* 0x004 */ u16 tempRecvBuffer[4];
/* 0x00c */ bool8 receivedNothing;
/* 0x00d */ s8 serialIntrCounter;
/* 0x00e */ bool8 handshakeAsMaster;
/* 0x00f */ u8 link_field_F;
// error conditions
bool8 hardwareError; // hardware reported an error
bool8 badChecksum; // checksum didn't match between devices
u8 queueFull; // send or recv queue out of space
u8 lag; // connection is lagging
/* 0x010 */ bool8 hardwareError; // hardware reported an error
/* 0x011 */ bool8 badChecksum; // checksum didn't match between devices
/* 0x012 */ u8 queueFull; // send or recv queue out of space
/* 0x013 */ u8 lag; // connection is lagging
u16 checksum;
/* 0x014 */ u16 checksum;
u8 sendCmdIndex;
u8 recvCmdIndex;
/* 0x016 */ u8 sendCmdIndex;
/* 0x017 */ u8 recvCmdIndex;
struct SendQueue sendQueue;
struct RecvQueue recvQueue;
/* 0x018 */ struct SendQueue sendQueue;
/* 0x33c */ struct RecvQueue recvQueue;
};
struct BlockRequest
@ -136,26 +189,26 @@ extern u16 gRecvCmds[MAX_RFU_PLAYERS][CMD_LENGTH];
extern u8 gBlockSendBuffer[BLOCK_BUFFER_SIZE];
extern u16 gLinkType;
extern u32 gLinkStatus;
extern u16 gBlockRecvBuffer[MAX_LINK_PLAYERS][BLOCK_BUFFER_SIZE / 2];
extern u16 gBlockRecvBuffer[MAX_RFU_PLAYERS][BLOCK_BUFFER_SIZE / 2];
extern u16 gSendCmd[CMD_LENGTH];
extern u8 gShouldAdvanceLinkState;
extern struct LinkPlayer gLinkPlayers[];
extern struct LinkPlayer gLinkPlayers[5];
extern u16 word_3002910[];
extern bool8 gReceivedRemoteLinkPlayers;
extern u32 gUnknown_020223C0;
extern bool8 gLinkVSyncDisabled;
extern u32 gLinkStatus;
void Task_DestroySelf(u8 taskId);
void OpenLink(void);
void CloseLink(void);
u16 LinkMain2(u16 *);
u16 LinkMain2(const u16 *);
void sub_8007B14(void);
bool32 sub_8007B24(void);
void ClearLinkCallback(void);
void ClearLinkCallback_2(void);
u8 GetLinkPlayerCount(void);
void OpenLinkTimed(void);
u8 GetLinkPlayerDataExchangeStatusTimed(void);
u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper);
bool8 IsLinkPlayerDataExchangeComplete(void);
u32 GetLinkPlayerTrainerId(u8);
void ResetLinkPlayers(void);
@ -163,11 +216,10 @@ void sub_8007E24(void);
void sub_8007E4C(void);
u8 GetMultiplayerId(void);
u8 bitmask_all_link_players_but_self(void);
bool8 SendBlock(u8, void *, u16);
bool8 SendBlock(u8, const void *, u16);
u8 GetBlockReceivedStatus(void);
void ResetBlockReceivedFlags(void);
void ResetBlockReceivedFlag(u8);
void SetLinkDebugValues(u32, u32);
u8 GetLinkPlayerCount_2(void);
bool8 IsLinkMaster(void);
void CB2_LinkError(void);
@ -176,23 +228,64 @@ bool8 IsLinkConnectionEstablished(void);
void SetSuppressLinkErrorMessage(bool8);
bool8 HasLinkErrorOccurred(void);
void ResetSerial(void);
u32 LinkMain1(u8 *, u16 *, u16[CMD_LENGTH][MAX_LINK_PLAYERS]);
u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENGTH]);
void LinkVSync(void);
void Timer3Intr(void);
void SerialCB(void);
u8 GetLinkPlayerCount(void);
bool32 InUnionRoom(void);
void sub_800E0E8(void);
bool8 sub_800A520(void);
bool8 sub_8010500(void);
void sub_800DFB4(u8, u8);
void CreateWirelessStatusIndicatorSprite(u8, u8);
void sub_800ADF8(void);
void sub_800B488(void);
void OpenLink(void);
void sub_800A620(void);
void sub_8011BD0(void);
u8 IsLinkMaster(void);
void sub_800AC34(void);
u8 sub_800A0C8(s32, s32);
bool8 HandleLinkConnection(void);
void SetLinkDebugValues(u32 seed, u32 flags);
void sub_800A418(void);
void SetSuppressLinkErrorMessage(bool8 flag);
void sub_800B524(struct LinkPlayer *linkPlayer);
u8 GetSioMultiSI(void);
void sub_800AAF4(void);
void sub_800AF18(u32 status, u8 lastSendQueueCount, u8 lastRecvQueueCount, u8 unk_06);
void sub_800B348(void);
void sub_800B3A4(u32 who);
extern u16 gLinkPartnersHeldKeys[6];
extern u32 gLinkDebugSeed;
extern struct LinkPlayerBlock gLocalLinkPlayerBlock;
extern bool8 gLinkErrorOccurred;
extern u32 gLinkDebugFlags;
extern bool8 gRemoteLinkPlayersNotReceived[MAX_LINK_PLAYERS];
extern u8 gBlockReceivedStatus[MAX_LINK_PLAYERS];
extern u16 gLinkHeldKeys;
extern u32 gLinkStatus;
extern u8 gUnknown_030030E4;
extern u8 gUnknown_030030E8;
extern u8 gUnknown_030030EC[MAX_LINK_PLAYERS];
extern u8 gUnknown_030030F0[MAX_LINK_PLAYERS];
extern u16 gUnknown_030030F4;
extern u8 gSuppressLinkErrorMessage;
extern u8 gWirelessCommType;
extern bool8 gSavedLinkPlayerCount;
extern u8 gSavedMultiplayerId;
extern struct LinkTestBGInfo gLinkTestBGInfo;
extern void (*gLinkCallback)(void);
extern bool8 gShouldAdvanceLinkState;
extern u16 gLinkTestBlockChecksums[MAX_LINK_PLAYERS];
extern u8 gBlockRequestType;
extern u8 gLastSendQueueCount;
extern u8 gLastRecvQueueCount;
extern u16 gLinkSavedIme;
extern u32 gFiller_03003074;
extern u32 gFiller_03003154;
extern u32 gFiller_03003158;
extern u32 gFiller_0300315c;
extern u32 gFiller_03004138;
extern u32 gFiller_0300413C;
extern u32 gFiller_03003080;
#endif // GUARD_LINK_H

235
include/link_rfu.h Normal file
View File

@ -0,0 +1,235 @@
#ifndef GUARD_LINK_RFU_H
#define GUARD_LINK_RFU_H
// Exported type declarations
struct UnkLinkRfuStruct_02022B2C
{
u8 unk_00;
u8 unk_01;
u16 unk_02;
u8 unk_04;
u16 unk_06;
struct UnkLinkRfuStruct_02022B14 *unk_08;
u8 *unk_0c;
u8 unk_10;
u8 unk_11;
u16 unk_12;
u16 unk_14;
};
struct UnkLinkRfuStruct_02022B44
{
u8 fill_00[6];
u16 unk_06;
u8 fill_08[6];
vu8 unk_0e;
u8 unk_0f;
u8 fill_10[0x54];
u16 unk_64;
u8 fill_66[0x1d];
u8 unk_83;
u8 fill_84[0x58];
};
struct UnkRfuStruct_1 {
/* 0x000 */ u8 unk_00;
/* 0x001 */ u8 unk_01;
/* 0x002 */ vu8 unk_02;
/* 0x003 */ vu8 unk_03;
/* 0x004 */ u8 unk_04;
/* 0x005 */ u8 unk_05;
/* 0x006 */ u8 unk_06;
/* 0x007 */ u8 unk_07;
/* 0x008 */ u8 unk_08;
/* 0x009 */ u8 unk_09;
/* 0x00a */ u8 unk_0a;
/* 0x00b */ u8 unk_0b;
/* 0x00c */ u8 unk_0c;
/* 0x00d */ u8 unk_0d;
/* 0x00e */ u8 unk_0e;
/* 0x00f */ u8 unk_0f;
/* 0x010 */ u8 unk_10;
/* 0x011 */ u8 unk_11;
/* 0x012 */ u8 unk_12;
// aligned
/* 0x014 */ u16 unk_14;
/* 0x016 */ u16 unk_16;
/* 0x018 */ u16 unk_18;
/* 0x01a */ u16 unk_1a;
/* 0x01c */ u16 unk_1c;
/* 0x01e */ u16 unk_1e;
/* 0x020 */ const u16 *unk_20;
/* 0x024 */ u8 unk_24;
/* 0x026 */ u16 unk_26;
/* 0x028 */ u16 unk_28[4];
/* 0x030 */ u8 unk_30;
// aligned
/* 0x032 */ u16 unk_32;
/* 0x034 */ u16 unk_34[4];
/* 0x03c */ const struct UnkLinkRfuStruct_02022B2C *unk_3c;
/* 0x040 */ void (*unk_40)(u8, u8);
/* 0x044 */ void (*unk_44)(u16);
/* 0x048 */ u8 filler_48[8];
/* 0x050 */ u32 unk_50[0x399];
/* 0xeb4 */ u8 filler_e64[12];
};
struct UnkRfuStruct_2_Sub_6c {
/* 0x00 */ u16 unk_00;
/* 0x02 */ u16 unk_02;
/* 0x04 */ const u8 *unk_04;
/* 0x08 */ u32 unk_08;
/* 0x0c */ u32 unk_0c;
/* 0x10 */ u8 unk_10;
/* 0x11 */ u8 unk_11;
/* 0x12 */ u8 unk_12;
};
struct UnkRfuStruct_2_Sub_124 {
/* 0x000 */ u8 unk_00[32][70];
/* 0x8c0 */ vu8 unk_8c0;
/* 0x8c1 */ vu8 unk_8c1;
/* 0x8c2 */ vu8 unk_8c2;
/* 0x8c3 */ vu8 unk_8c3;
};
struct UnkRfuStruct_2_Sub_9e8 {
/* 0x000 */ u8 unk_00[40][14];
/* 0x230 */ vu8 unk_230;
/* 0x231 */ vu8 unk_231;
/* 0x232 */ vu8 unk_232;
/* 0x233 */ vu8 unk_233;
};
struct UnkRfuStruct_2_Sub_c1c {
/* 0x00 */ u8 unk_00[2][14];
/* 0x1c */ vu8 unk_1c;
/* 0x1d */ vu8 unk_1d;
/* 0x1e */ vu8 unk_1e;
};
struct UnkRfuStruct_Sub_Unused {
/* 0x000 */ u8 unk_00[2][256];
/* 0x200 */ vu8 unk_200;
/* 0x201 */ vu8 unk_201;
/* 0x202 */ vu8 unk_202;
/* 0x203 */ vu8 unk_203;
};
struct UnkRfuStruct_2 {
/* 0x000 */ void (*unk_00)(void);
/* 0x004 */ u16 unk_04;
/* 0x006 */ u8 filler_06[4];
/* 0x00a */ u16 unk_0a;
/* 0x00c */ u8 unk_0c;
/* 0x00d */ u8 playerCount;
/* 0x00e */ u8 unk_0e;
/* 0x00f */ u8 unk_0f;
/* 0x010 */ u16 unk_10;
/* 0x012 */ u16 unk_12;
/* 0x014 */ u8 unk_14[4][14];
/* 0x04c */ u8 unk_4c[14];
/* 0x05a */ u8 unk_5a;
/* 0x05b */ u8 unk_5b;
/* 0x05c */ u8 unk_5c[5];
/* 0x061 */ u8 unk_61[5];
/* 0x066 */ u8 unk_66;
/* 0x067 */ u8 unk_67;
/* 0x068 */ u8 filler_68[4];
/* 0x06c */ struct UnkRfuStruct_2_Sub_6c unk_6c;
/* 0x080 */ struct UnkRfuStruct_2_Sub_6c unk_80[5];
/* 0x0e4 */ u8 unk_e4[5];
/* 0x0e9 */ u8 unk_e9[5];
/* 0x0ee */ vu8 unk_ee;
/* 0x0ef */ u8 unk_ef;
/* 0x0f0 */ u8 unk_f0;
/* 0x0f1 */ u8 unk_f1;
/* 0x0f2 */ u16 unk_f2[6];
/* 0x0fe */ u16 unk_fe;
/* 0x100 */ u16 unk_100;
/* 0x102 */ u8 unk_102;
/* 0x103 */ u8 filler_103[0x21];
/* 0x124 */ struct UnkRfuStruct_2_Sub_124 unk_124;
/* 0x9e8 */ struct UnkRfuStruct_2_Sub_9e8 unk_9e8;
/* 0xc1c */ struct UnkRfuStruct_2_Sub_c1c unk_c1c;
/* 0xc3c */ vu8 unk_c3c;
/* 0xc3d */ u8 unk_c3d;
/* 0xc3e */ vu8 unk_c3e;
/* 0xc3f */ u8 unk_c3f[70];
/* 0xc85 */ u8 unk_c85;
/* 0xc86 */ u8 unk_c86;
/* 0xc87 */ u8 unk_c87[5][7][2];
/* 0xccd */ u8 unk_ccd;
/* 0xcce */ u8 unk_cce;
/* 0xccf */ u8 unk_ccf;
/* 0xcd0 */ vu8 unk_cd0;
/* 0xcd1 */ u8 unk_cd1[4];
/* 0xcd5 */ u8 unk_cd5[4];
/* 0xcd9 */ u8 unk_cd9;
/* 0xcda */ u8 unk_cda;
/* 0xcdb */ vu8 unk_cdb;
/* 0xcdc */ vu8 unk_cdc;
/* 0xcdd */ u8 unk_cdd;
/* 0xcde */ u8 unk_cde[4];
/* 0xce2 */ u8 unk_ce2;
/* 0xce2 */ u8 unk_ce3;
/* 0xce4 */ u8 unk_ce4;
/* 0xce5 */ u8 unk_ce5;
/* 0xce5 */ u8 unk_ce6;
/* 0xce7 */ u8 unk_ce7;
/* 0xce8 */ u8 unk_ce8;
/* 0xce9 */ u8 unk_ce9;
/* 0xcea */ u8 unk_cea[4];
/* 0xcee */ u8 unk_cee[4];
}; // size = 0xcf4
struct UnkRfuStruct_8010A14 {
char unk_00[15];
u8 unk_0f;
u8 unk_10[4];
struct LinkPlayer unk_14[5];
u8 fill_a0[0x5c];
};
// Exported RAM declarations
extern struct UnkRfuStruct_1 gUnknown_03004140;
extern struct UnkRfuStruct_2 gUnknown_03005000;
// Exported ROM declarations
u32 sub_800BEC0(void);
void sub_800E700(void);
void sub_800EDD4(void);
void sub_800F6FC(u8 who);
void sub_800F728(u8 who);
bool32 sub_800F7E4(void);
void sub_800F804(void);
void sub_800F850(void);
u8 sub_800FCD8(void);
bool32 sub_800FE84(const u8 *src, size_t size);
void Rfu_set_zero(void);
u8 sub_80104F4(void);
u8 rfu_get_multiplayer_id(void);
bool8 sub_8010100(u8 a0);
bool8 sub_8010500(void);
bool8 Rfu_IsMaster(void);
void task_add_05_task_del_08FA224_when_no_RfuFunc(void);
void sub_8010434(void);
void sub_800E604(void);
void sub_800E174(void);
void sub_800E6D0(void);
bool32 sub_8010EC0(void);
bool32 sub_8010F1C(void);
bool32 sub_8011A80(void);
bool32 sub_800F0B8(void);
u32 sub_80124D4(void);
void RfuVSync(void);
void sub_80111B0(bool32 a0);
u8 sub_8011A74(void);
struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void);
void sub_8011068(u8 a0);
void sub_8011170(u32 a0);
void sub_8011A64(u8 a0, u16 a1);
#endif //GUARD_LINK_RFU_H

View File

@ -2,6 +2,8 @@
#define GUARD_LOAD_SAVE_H
extern bool32 gFlashMemoryPresent;
extern struct SaveBlock2 gSaveblock2;
extern struct PokemonStorage gPokemonStorage;
void ClearSav2(void);
void ClearSav1(void);
@ -19,6 +21,5 @@ void LoadSerializedGame(void);
void LoadPlayerBag(void);
void SavePlayerBag(void);
void SetSaveBlocksPointers(u16);
void MoveSaveBlocks_ResetHeap(void);
#endif // GUARD_LOAD_SAVE_H

View File

@ -17,4 +17,9 @@ void m4aMPlayFadeOutTemporarily(struct MusicPlayerInfo *mplayInfo, u16 speed);
void m4aMPlayFadeIn(struct MusicPlayerInfo *mplayInfo, u16 speed);
void m4aMPlayImmInit(struct MusicPlayerInfo *mplayInfo);
extern struct MusicPlayerInfo gMPlayInfo_SE1;
extern struct MusicPlayerInfo gMPlayInfo_SE2;
extern struct MusicPlayerInfo gMPlayInfo_SE3;
extern struct SoundInfo gSoundInfo;
#endif //GUARD_M4A_H

View File

@ -42,14 +42,19 @@ struct Main
/*0x439*/ u8 field_439_x4:1;
};
extern u8 gUnknown_3001764;
extern struct Main gMain;
extern bool8 gSoftResetDisabled;
extern bool8 gLinkVSyncDisabled;
extern const u8 gGameVersion;
extern const u8 gGameLanguage;
extern u16 gKeyRepeatStartDelay;
extern bool8 gLinkTransferringData;
extern struct Main gMain;
extern u16 gKeyRepeatContinueDelay;
extern bool8 gSoftResetDisabled;
extern IntrFunc gIntrTable[];
extern u8 gLinkVSyncDisabled;
extern u32 IntrMain_Buffer[];
extern u8 gPcmDmaCounter;
void AgbMain(void);
void SetMainCallback2(MainCallback callback);
void InitKeys(void);
@ -60,6 +65,7 @@ void SetSerialCallback(IntrCallback callback);
void InitFlashTimer(void);
void DoSoftReset(void);
void ClearPokemonCrySongs(void);
void RestoreSerialTimer3IntrHandlers(void);
void StartTimer1(void);
void SeedRngAndSetTrainerId(void);

View File

@ -1,6 +1,7 @@
#ifndef GUARD_MALLOC_H
#define GUARD_MALLOC_H
#define HEAP_SIZE 0x1C000
#define malloc Alloc
#define calloc(ct, sz) AllocZeroed((ct) * (sz))
#define free Free

View File

@ -17,6 +17,8 @@ struct MenuAction
} func;
};
extern const u16 gUnknown_0860F074[];
void sub_81971D0(void);
void sub_8197200(void);
u16 sub_8197224(void);
@ -48,6 +50,7 @@ void *decompress_and_copy_tile_data_to_vram(u8 bgId, const void *src, int size,
bool8 free_temp_tile_data_buffers_if_possible(void);
struct WindowTemplate sub_8198A50(u8, u8, u8, u8, u8, u8, u16);
void CreateYesNoMenu(const struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos);
void copy_decompressed_tile_data_to_vram_autofree(u8 bgId, const void *src, int size, u16 offset, u8 mode);
s8 ProcessMenuInputNoWrap_(void);
void do_scheduled_bg_tilemap_copies_to_vram(void);
void clear_scheduled_bg_copies_to_vram(void);

View File

@ -25,8 +25,6 @@ struct UCoords32
extern struct LinkPlayerMapObject gLinkPlayerMapObjects[4];
extern MainCallback gFieldCallback;
void IncrementGameStat(u8 index);
void Overworld_SetMapObjTemplateCoords(u8, s16, s16);
void Overworld_SetMapObjTemplateMovementType(u8, u8);
@ -54,6 +52,7 @@ void Overworld_ChangeMusicToDefault(void);
void Overworld_ChangeMusicTo(u16);
bool32 is_c1_link_related_active(void);
extern u16 gUnknown_03005DA8;
void strange_npc_table_clear(void);
const struct MapHeader *get_mapheader_by_bank_and_number(u16, u16);
@ -73,6 +72,9 @@ void mapldr_default(void);
u8 get_map_light_from_warp0(void);
bool8 is_light_level_1_2_3_5_or_6(u8 a1);
bool32 sub_80875C8(void);
bool32 sub_8087634(void);
bool32 sub_808766C(void);
void IncrementGameStat(u8);
u32 GetGameStat(u8);

12
include/reset_save_heap.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef GUARD_RESET_SAVE_HEAP_H
#define GUARD_RESET_SAVE_HEAP_H
// Exported type declarations
// Exported RAM declarations
// Exported ROM declarations
void sub_81700F8(void);
#endif //GUARD_RESET_SAVE_HEAP_H

12
include/rom_8011DC0.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef GUARD_rom_8011DC0_H
#define GUARD_rom_8011DC0_H
// Exported type declarations
// Exported RAM declarations
// Exported ROM declarations
void sub_8018438(void);
#endif //GUARD_rom_8011DC0_H

View File

@ -101,6 +101,11 @@ extern const u8 gText_NoRegistry[];
extern const u8 gText_OkayToDeleteFromRegistry[];
extern const u8 gText_RegisteredDataDeleted[];
extern const u8 gUnknown_085EA79D[];
extern const u8 gText_CommErrorEllipsis[];
extern const u8 gText_MoveCloserToLinkPartner[];
extern const u8 gText_CommErrorCheckConnections[];
extern const u8 gText_ABtnTitleScreen[];
extern const u8 gText_ABtnRegistrationCounter[];
extern const u8 gText_EmptyString2[];
extern const u8 gText_Confirm3[];
extern const u8 gText_Cancel4[];

12
include/trade.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef GUARD_TRADE_H
#define GUARD_TRADE_H
// Exported type declarations
// Exported RAM declarations
// Exported ROM declarations
int sub_807A728(void);
#endif //GUARD_TRADE_H

View File

@ -68,5 +68,11 @@ void BlitBitmapRectToWindow4BitTo8Bit(u8 windowId, u8 *pixels, u16 srcX, u16 src
void CopyWindowToVram8Bit(u8 windowId, u8 mode);
extern struct Window gWindows[];
extern void* gUnknown_03002F70[];
extern u32 filler_03002F58;
extern u32 filler_03002F5C;
extern u32 filler_03002F64;
extern u8 gUnknown_03002F60;
#endif // GUARD_WINDOW_H

View File

@ -52,7 +52,10 @@ SECTIONS {
src/text.o(.text);
src/sprite.o(.text);
src/string_util.o(.text);
asm/link.o(.text);
src/link.o(.text);
src/link_rfu.o(.text);
asm/link_rfu.o(.text);
asm/rom_8011DC0.o(.text);
src/rtc.o(.text);
asm/main_menu.o(.text);
src/battle_controllers.o(.text);
@ -370,7 +373,9 @@ SECTIONS {
src/sprite.o(.rodata);
data/io_reg.o(.rodata);
src/string_util.o(.rodata);
data/link.o(.rodata);
src/link.o(.rodata);
src/link_rfu.o(.rodata);
data/rom_8011DC0.o(.rodata);
src/rtc.o(.rodata);
data/main_menu.o(.rodata);
data/battle_1.o(.rodata);

View File

@ -872,7 +872,7 @@ static void HandleMoveSwitchting(void)
static void sub_80586F8(void)
{
if (gLinkVSyncDisabled == 0)
if (gWirelessCommType == 0)
{
if (gReceivedRemoteLinkPlayers == 0)
{
@ -908,7 +908,7 @@ void sub_80587B0(void)
{
if (sub_800A520())
{
if (gLinkVSyncDisabled == 0)
if (gWirelessCommType == 0)
sub_800AC34();
else
sub_800ADF8();

View File

@ -12,13 +12,29 @@
#include "constants/abilities.h"
#include "battle_message.h"
extern u8 gBattleBuffersTransferData[0x100];
extern u8 gUnknown_0202428C;
extern u32 gUnknown_02022FF4;
extern u8 gUnknown_0203C7B4;
extern u32 gBattleExecBuffer;
extern void (*gBattleBankFunc[4])(void);
extern u8 gBanksByIdentity[4];
extern u8 gActionSelectionCursor[4];
extern u8 gMoveSelectionCursor[4];
extern u8 gNoOfAllBanks;
extern u8 gActiveBank;
extern u16 gBattlePartyID[4];
extern u8 gBattleBufferA[4][0x200];
extern u8 gBattleBufferB[4][0x200];
extern u8 gUnknown_02022D08;
extern u8 gUnknown_02022D09;
extern u8 gUnknown_02022D0A;
extern u8 gBankAttacker;
extern u8 gBankTarget;
extern u8 gAbsentBankFlags;
extern u8 gEffectBank;
extern struct BattlePokemon gBattleMons[4];
extern u16 gLastUsedMove;
extern u8 gStringBank;
extern u8 gBattleBuffersTransferData[0x100];
static EWRAM_DATA u8 sBattleBuffersTransferData[0x100] = {};
extern const struct BattleMove gBattleMoves[];
@ -37,7 +53,7 @@ void HandleLinkBattleSetup(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
if (gLinkVSyncDisabled)
if (gWirelessCommType)
sub_800B488();
if (!gReceivedRemoteLinkPlayers)
OpenLink();
@ -758,7 +774,7 @@ static void Task_HandleSendLinkBuffersData(u8 taskId)
gTasks[taskId].data[11]++;
break;
case 2:
if (gLinkVSyncDisabled)
if (gWirelessCommType)
{
gTasks[taskId].data[11]++;
}
@ -917,171 +933,171 @@ static void Task_HandleCopyReceivedLinkBuffersData(u8 taskId)
void BtlController_EmitGetMonData(u8 bufferId, u8 requestId, u8 monToCheck)
{
gBattleBuffersTransferData[0] = CONTROLLER_GETMONDATA;
gBattleBuffersTransferData[1] = requestId;
gBattleBuffersTransferData[2] = monToCheck;
gBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_GETMONDATA;
sBattleBuffersTransferData[1] = requestId;
sBattleBuffersTransferData[2] = monToCheck;
sBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitGetRawMonData(u8 bufferId, u8 monId, u8 bytes)
{
gBattleBuffersTransferData[0] = CONTROLLER_GETRAWMONDATA;
gBattleBuffersTransferData[1] = monId;
gBattleBuffersTransferData[2] = bytes;
gBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_GETRAWMONDATA;
sBattleBuffersTransferData[1] = monId;
sBattleBuffersTransferData[2] = bytes;
sBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitSetMonData(u8 bufferId, u8 requestId, u8 monToCheck, u8 bytes, void *data)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_SETMONDATA;
gBattleBuffersTransferData[1] = requestId;
gBattleBuffersTransferData[2] = monToCheck;
sBattleBuffersTransferData[0] = CONTROLLER_SETMONDATA;
sBattleBuffersTransferData[1] = requestId;
sBattleBuffersTransferData[2] = monToCheck;
for (i = 0; i < bytes; i++)
gBattleBuffersTransferData[3 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 3 + bytes);
sBattleBuffersTransferData[3 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 3 + bytes);
}
void BtlController_EmitSetRawMonData(u8 bufferId, u8 monId, u8 bytes, void *data)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_SETRAWMONDATA;
gBattleBuffersTransferData[1] = monId;
gBattleBuffersTransferData[2] = bytes;
sBattleBuffersTransferData[0] = CONTROLLER_SETRAWMONDATA;
sBattleBuffersTransferData[1] = monId;
sBattleBuffersTransferData[2] = bytes;
for (i = 0; i < bytes; i++)
gBattleBuffersTransferData[3 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, bytes + 3);
sBattleBuffersTransferData[3 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, bytes + 3);
}
void BtlController_EmitLoadMonSprite(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_LOADMONSPRITE;
gBattleBuffersTransferData[1] = CONTROLLER_LOADMONSPRITE;
gBattleBuffersTransferData[2] = CONTROLLER_LOADMONSPRITE;
gBattleBuffersTransferData[3] = CONTROLLER_LOADMONSPRITE;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_LOADMONSPRITE;
sBattleBuffersTransferData[1] = CONTROLLER_LOADMONSPRITE;
sBattleBuffersTransferData[2] = CONTROLLER_LOADMONSPRITE;
sBattleBuffersTransferData[3] = CONTROLLER_LOADMONSPRITE;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitSwitchInAnim(u8 bufferId, u8 partyId, bool8 dontClearSubstituteBit)
{
gBattleBuffersTransferData[0] = CONTROLLER_SWITCHINANIM;
gBattleBuffersTransferData[1] = partyId;
gBattleBuffersTransferData[2] = dontClearSubstituteBit;
gBattleBuffersTransferData[3] = 5;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_SWITCHINANIM;
sBattleBuffersTransferData[1] = partyId;
sBattleBuffersTransferData[2] = dontClearSubstituteBit;
sBattleBuffersTransferData[3] = 5;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitReturnMonToBall(u8 bufferId, u8 arg1)
{
gBattleBuffersTransferData[0] = CONTROLLER_RETURNMONTOBALL;
gBattleBuffersTransferData[1] = arg1;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2);
sBattleBuffersTransferData[0] = CONTROLLER_RETURNMONTOBALL;
sBattleBuffersTransferData[1] = arg1;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2);
}
void BtlController_EmitDrawTrainerPic(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_DRAWTRAINERPIC;
gBattleBuffersTransferData[1] = CONTROLLER_DRAWTRAINERPIC;
gBattleBuffersTransferData[2] = CONTROLLER_DRAWTRAINERPIC;
gBattleBuffersTransferData[3] = CONTROLLER_DRAWTRAINERPIC;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_DRAWTRAINERPIC;
sBattleBuffersTransferData[1] = CONTROLLER_DRAWTRAINERPIC;
sBattleBuffersTransferData[2] = CONTROLLER_DRAWTRAINERPIC;
sBattleBuffersTransferData[3] = CONTROLLER_DRAWTRAINERPIC;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitTrainerSlide(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDE;
gBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDE;
gBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDE;
gBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDE;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDE;
sBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDE;
sBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDE;
sBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDE;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitTrainerSlideBack(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDEBACK;
gBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDEBACK;
gBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDEBACK;
gBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDEBACK;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_TRAINERSLIDEBACK;
sBattleBuffersTransferData[1] = CONTROLLER_TRAINERSLIDEBACK;
sBattleBuffersTransferData[2] = CONTROLLER_TRAINERSLIDEBACK;
sBattleBuffersTransferData[3] = CONTROLLER_TRAINERSLIDEBACK;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitFaintAnimation(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_FAINTANIMATION;
gBattleBuffersTransferData[1] = CONTROLLER_FAINTANIMATION;
gBattleBuffersTransferData[2] = CONTROLLER_FAINTANIMATION;
gBattleBuffersTransferData[3] = CONTROLLER_FAINTANIMATION;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_FAINTANIMATION;
sBattleBuffersTransferData[1] = CONTROLLER_FAINTANIMATION;
sBattleBuffersTransferData[2] = CONTROLLER_FAINTANIMATION;
sBattleBuffersTransferData[3] = CONTROLLER_FAINTANIMATION;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitPaletteFade(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_PALETTEFADE;
gBattleBuffersTransferData[1] = CONTROLLER_PALETTEFADE;
gBattleBuffersTransferData[2] = CONTROLLER_PALETTEFADE;
gBattleBuffersTransferData[3] = CONTROLLER_PALETTEFADE;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_PALETTEFADE;
sBattleBuffersTransferData[1] = CONTROLLER_PALETTEFADE;
sBattleBuffersTransferData[2] = CONTROLLER_PALETTEFADE;
sBattleBuffersTransferData[3] = CONTROLLER_PALETTEFADE;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitSuccessBallThrowAnim(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_SUCCESSBALLTHROWANIM;
gBattleBuffersTransferData[1] = CONTROLLER_SUCCESSBALLTHROWANIM;
gBattleBuffersTransferData[2] = CONTROLLER_SUCCESSBALLTHROWANIM;
gBattleBuffersTransferData[3] = CONTROLLER_SUCCESSBALLTHROWANIM;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_SUCCESSBALLTHROWANIM;
sBattleBuffersTransferData[1] = CONTROLLER_SUCCESSBALLTHROWANIM;
sBattleBuffersTransferData[2] = CONTROLLER_SUCCESSBALLTHROWANIM;
sBattleBuffersTransferData[3] = CONTROLLER_SUCCESSBALLTHROWANIM;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitBallThrowAnim(u8 bufferId, u8 caseId)
{
gBattleBuffersTransferData[0] = CONTROLLER_BALLTHROWANIM;
gBattleBuffersTransferData[1] = caseId;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2);
sBattleBuffersTransferData[0] = CONTROLLER_BALLTHROWANIM;
sBattleBuffersTransferData[1] = caseId;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2);
}
void BtlController_EmitPause(u8 bufferId, u8 toWait, void *data)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_PAUSE;
gBattleBuffersTransferData[1] = toWait;
sBattleBuffersTransferData[0] = CONTROLLER_PAUSE;
sBattleBuffersTransferData[1] = toWait;
for (i = 0; i < toWait * 3; i++)
gBattleBuffersTransferData[2 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, toWait * 3 + 2);
sBattleBuffersTransferData[2 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, toWait * 3 + 2);
}
void BtlController_EmitMoveAnimation(u8 bufferId, u16 move, u8 turnOfMove, u16 movePower, s32 dmg, u8 friendship, struct DisableStruct *disableStructPtr, u8 multihit)
{
gBattleBuffersTransferData[0] = CONTROLLER_MOVEANIMATION;
gBattleBuffersTransferData[1] = move;
gBattleBuffersTransferData[2] = (move & 0xFF00) >> 8;
gBattleBuffersTransferData[3] = turnOfMove;
gBattleBuffersTransferData[4] = movePower;
gBattleBuffersTransferData[5] = (movePower & 0xFF00) >> 8;
gBattleBuffersTransferData[6] = dmg;
gBattleBuffersTransferData[7] = (dmg & 0x0000FF00) >> 8;
gBattleBuffersTransferData[8] = (dmg & 0x00FF0000) >> 16;
gBattleBuffersTransferData[9] = (dmg & 0xFF000000) >> 24;
gBattleBuffersTransferData[10] = friendship;
gBattleBuffersTransferData[11] = multihit;
sBattleBuffersTransferData[0] = CONTROLLER_MOVEANIMATION;
sBattleBuffersTransferData[1] = move;
sBattleBuffersTransferData[2] = (move & 0xFF00) >> 8;
sBattleBuffersTransferData[3] = turnOfMove;
sBattleBuffersTransferData[4] = movePower;
sBattleBuffersTransferData[5] = (movePower & 0xFF00) >> 8;
sBattleBuffersTransferData[6] = dmg;
sBattleBuffersTransferData[7] = (dmg & 0x0000FF00) >> 8;
sBattleBuffersTransferData[8] = (dmg & 0x00FF0000) >> 16;
sBattleBuffersTransferData[9] = (dmg & 0xFF000000) >> 24;
sBattleBuffersTransferData[10] = friendship;
sBattleBuffersTransferData[11] = multihit;
if (WEATHER_HAS_EFFECT2)
{
gBattleBuffersTransferData[12] = gBattleWeather;
gBattleBuffersTransferData[13] = (gBattleWeather & 0xFF00) >> 8;
sBattleBuffersTransferData[12] = gBattleWeather;
sBattleBuffersTransferData[13] = (gBattleWeather & 0xFF00) >> 8;
}
else
{
gBattleBuffersTransferData[12] = 0;
gBattleBuffersTransferData[13] = 0;
sBattleBuffersTransferData[12] = 0;
sBattleBuffersTransferData[13] = 0;
}
gBattleBuffersTransferData[14] = 0;
gBattleBuffersTransferData[15] = 0;
memcpy(&gBattleBuffersTransferData[16], disableStructPtr, sizeof(struct DisableStruct));
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 16 + sizeof(struct DisableStruct));
sBattleBuffersTransferData[14] = 0;
sBattleBuffersTransferData[15] = 0;
memcpy(&sBattleBuffersTransferData[16], disableStructPtr, sizeof(struct DisableStruct));
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 16 + sizeof(struct DisableStruct));
}
void BtlController_EmitPrintString(u8 bufferId, u16 stringID)
@ -1089,12 +1105,12 @@ void BtlController_EmitPrintString(u8 bufferId, u16 stringID)
s32 i;
struct StringInfoBattle* stringInfo;
gBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRING;
gBattleBuffersTransferData[1] = gBattleOutcome;
gBattleBuffersTransferData[2] = stringID;
gBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8;
sBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRING;
sBattleBuffersTransferData[1] = gBattleOutcome;
sBattleBuffersTransferData[2] = stringID;
sBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8;
stringInfo = (struct StringInfoBattle*)(&gBattleBuffersTransferData[4]);
stringInfo = (struct StringInfoBattle*)(&sBattleBuffersTransferData[4]);
stringInfo->currentMove = gCurrentMove;
stringInfo->originallyUsedMove = gChosenMove;
stringInfo->lastItem = gLastUsedItem;
@ -1113,7 +1129,7 @@ void BtlController_EmitPrintString(u8 bufferId, u16 stringID)
stringInfo->textBuffs[1][i] = gBattleTextBuff2[i];
stringInfo->textBuffs[2][i] = gBattleTextBuff3[i];
}
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4);
}
void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID)
@ -1121,12 +1137,12 @@ void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID)
s32 i;
struct StringInfoBattle *stringInfo;
gBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRINGPLAYERONLY;
gBattleBuffersTransferData[1] = CONTROLLER_PRINTSTRINGPLAYERONLY;
gBattleBuffersTransferData[2] = stringID;
gBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8;
sBattleBuffersTransferData[0] = CONTROLLER_PRINTSTRINGPLAYERONLY;
sBattleBuffersTransferData[1] = CONTROLLER_PRINTSTRINGPLAYERONLY;
sBattleBuffersTransferData[2] = stringID;
sBattleBuffersTransferData[3] = (stringID & 0xFF00) >> 8;
stringInfo = (struct StringInfoBattle*)(&gBattleBuffersTransferData[4]);
stringInfo = (struct StringInfoBattle*)(&sBattleBuffersTransferData[4]);
stringInfo->currentMove = gCurrentMove;
stringInfo->originallyUsedMove = gChosenMove;
stringInfo->lastItem = gLastUsedItem;
@ -1142,386 +1158,386 @@ void BtlController_EmitPrintSelectionString(u8 bufferId, u16 stringID)
stringInfo->textBuffs[1][i] = gBattleTextBuff2[i];
stringInfo->textBuffs[2][i] = gBattleTextBuff3[i];
}
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct StringInfoBattle) + 4);
}
void BtlController_EmitChooseAction(u8 bufferId, u8 arg1, u16 arg2)
{
gBattleBuffersTransferData[0] = CONTROLLER_CHOOSEACTION;
gBattleBuffersTransferData[1] = arg1;
gBattleBuffersTransferData[2] = arg2;
gBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_CHOOSEACTION;
sBattleBuffersTransferData[1] = arg1;
sBattleBuffersTransferData[2] = arg2;
sBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitUnknownYesNoBox(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_UNKNOWNYESNOBOX;
gBattleBuffersTransferData[1] = CONTROLLER_UNKNOWNYESNOBOX;
gBattleBuffersTransferData[2] = CONTROLLER_UNKNOWNYESNOBOX;
gBattleBuffersTransferData[3] = CONTROLLER_UNKNOWNYESNOBOX;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_UNKNOWNYESNOBOX;
sBattleBuffersTransferData[1] = CONTROLLER_UNKNOWNYESNOBOX;
sBattleBuffersTransferData[2] = CONTROLLER_UNKNOWNYESNOBOX;
sBattleBuffersTransferData[3] = CONTROLLER_UNKNOWNYESNOBOX;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitChooseMove(u8 bufferId, bool8 isDoubleBattle, bool8 NoPpNumber, struct ChooseMoveStruct *movePpData)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_CHOOSEMOVE;
gBattleBuffersTransferData[1] = isDoubleBattle;
gBattleBuffersTransferData[2] = NoPpNumber;
gBattleBuffersTransferData[3] = 0;
sBattleBuffersTransferData[0] = CONTROLLER_CHOOSEMOVE;
sBattleBuffersTransferData[1] = isDoubleBattle;
sBattleBuffersTransferData[2] = NoPpNumber;
sBattleBuffersTransferData[3] = 0;
for (i = 0; i < sizeof(*movePpData); i++)
gBattleBuffersTransferData[4 + i] = *((u8*)(movePpData) + i);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(*movePpData) + 4);
sBattleBuffersTransferData[4 + i] = *((u8*)(movePpData) + i);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(*movePpData) + 4);
}
void BtlController_EmitChooseItem(u8 bufferId, u8 *arg1)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_OPENBAG;
sBattleBuffersTransferData[0] = CONTROLLER_OPENBAG;
for (i = 0; i < 3; i++)
gBattleBuffersTransferData[1 + i] = arg1[i];
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[1 + i] = arg1[i];
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitChoosePokemon(u8 bufferId, u8 caseId, u8 arg2, u8 abilityId, u8* arg4)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_CHOOSEPOKEMON;
gBattleBuffersTransferData[1] = caseId;
gBattleBuffersTransferData[2] = arg2;
gBattleBuffersTransferData[3] = abilityId;
sBattleBuffersTransferData[0] = CONTROLLER_CHOOSEPOKEMON;
sBattleBuffersTransferData[1] = caseId;
sBattleBuffersTransferData[2] = arg2;
sBattleBuffersTransferData[3] = abilityId;
for (i = 0; i < 3; i++)
gBattleBuffersTransferData[4 + i] = arg4[i];
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 8); // but only 7 bytes were written
sBattleBuffersTransferData[4 + i] = arg4[i];
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 8); // but only 7 bytes were written
}
void BtlController_EmitCmd23(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_23;
gBattleBuffersTransferData[1] = CONTROLLER_23;
gBattleBuffersTransferData[2] = CONTROLLER_23;
gBattleBuffersTransferData[3] = CONTROLLER_23;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_23;
sBattleBuffersTransferData[1] = CONTROLLER_23;
sBattleBuffersTransferData[2] = CONTROLLER_23;
sBattleBuffersTransferData[3] = CONTROLLER_23;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
// why is the argument u16 if it's being cast to s16 anyway?
void BtlController_EmitHealthBarUpdate(u8 bufferId, u16 hpValue)
{
gBattleBuffersTransferData[0] = CONTROLLER_HEALTHBARUPDATE;
gBattleBuffersTransferData[1] = 0;
gBattleBuffersTransferData[2] = (s16)hpValue;
gBattleBuffersTransferData[3] = ((s16)hpValue & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_HEALTHBARUPDATE;
sBattleBuffersTransferData[1] = 0;
sBattleBuffersTransferData[2] = (s16)hpValue;
sBattleBuffersTransferData[3] = ((s16)hpValue & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
// why is the argument u16 if it's being cast to s16 anyway?
void BtlController_EmitExpUpdate(u8 bufferId, u8 partyId, u16 expPoints)
{
gBattleBuffersTransferData[0] = CONTROLLER_EXPUPDATE;
gBattleBuffersTransferData[1] = partyId;
gBattleBuffersTransferData[2] = (s16)expPoints;
gBattleBuffersTransferData[3] = ((s16)expPoints & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_EXPUPDATE;
sBattleBuffersTransferData[1] = partyId;
sBattleBuffersTransferData[2] = (s16)expPoints;
sBattleBuffersTransferData[3] = ((s16)expPoints & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitStatusIconUpdate(u8 bufferId, u32 status1, u32 status2)
{
gBattleBuffersTransferData[0] = CONTROLLER_STATUSICONUPDATE;
gBattleBuffersTransferData[1] = status1;
gBattleBuffersTransferData[2] = (status1 & 0x0000FF00) >> 8;
gBattleBuffersTransferData[3] = (status1 & 0x00FF0000) >> 16;
gBattleBuffersTransferData[4] = (status1 & 0xFF000000) >> 24;
gBattleBuffersTransferData[5] = status2;
gBattleBuffersTransferData[6] = (status2 & 0x0000FF00) >> 8;
gBattleBuffersTransferData[7] = (status2 & 0x00FF0000) >> 16;
gBattleBuffersTransferData[8] = (status2 & 0xFF000000) >> 24;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 9);
sBattleBuffersTransferData[0] = CONTROLLER_STATUSICONUPDATE;
sBattleBuffersTransferData[1] = status1;
sBattleBuffersTransferData[2] = (status1 & 0x0000FF00) >> 8;
sBattleBuffersTransferData[3] = (status1 & 0x00FF0000) >> 16;
sBattleBuffersTransferData[4] = (status1 & 0xFF000000) >> 24;
sBattleBuffersTransferData[5] = status2;
sBattleBuffersTransferData[6] = (status2 & 0x0000FF00) >> 8;
sBattleBuffersTransferData[7] = (status2 & 0x00FF0000) >> 16;
sBattleBuffersTransferData[8] = (status2 & 0xFF000000) >> 24;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 9);
}
void BtlController_EmitStatusAnimation(u8 bufferId, bool8 status2, u32 status)
{
gBattleBuffersTransferData[0] = CONTROLLER_STATUSANIMATION;
gBattleBuffersTransferData[1] = status2;
gBattleBuffersTransferData[2] = status;
gBattleBuffersTransferData[3] = (status & 0x0000FF00) >> 8;
gBattleBuffersTransferData[4] = (status & 0x00FF0000) >> 16;
gBattleBuffersTransferData[5] = (status & 0xFF000000) >> 24;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 6);
sBattleBuffersTransferData[0] = CONTROLLER_STATUSANIMATION;
sBattleBuffersTransferData[1] = status2;
sBattleBuffersTransferData[2] = status;
sBattleBuffersTransferData[3] = (status & 0x0000FF00) >> 8;
sBattleBuffersTransferData[4] = (status & 0x00FF0000) >> 16;
sBattleBuffersTransferData[5] = (status & 0xFF000000) >> 24;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 6);
}
void BtlController_EmitStatusXor(u8 bufferId, u8 b)
{
gBattleBuffersTransferData[0] = CONTROLLER_STATUSXOR;
gBattleBuffersTransferData[1] = b;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2);
sBattleBuffersTransferData[0] = CONTROLLER_STATUSXOR;
sBattleBuffersTransferData[1] = b;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2);
}
void BtlController_EmitDataTransfer(u8 bufferId, u16 size, void *data)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_DATATRANSFER;
gBattleBuffersTransferData[1] = CONTROLLER_DATATRANSFER;
gBattleBuffersTransferData[2] = size;
gBattleBuffersTransferData[3] = (size & 0xFF00) >> 8;
sBattleBuffersTransferData[0] = CONTROLLER_DATATRANSFER;
sBattleBuffersTransferData[1] = CONTROLLER_DATATRANSFER;
sBattleBuffersTransferData[2] = size;
sBattleBuffersTransferData[3] = (size & 0xFF00) >> 8;
for (i = 0; i < size; i++)
gBattleBuffersTransferData[4 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 4);
sBattleBuffersTransferData[4 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 4);
}
void BtlController_EmitDMA3Transfer(u8 bufferId, void *dst, u16 size, void *data)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_DMA3TRANSFER;
gBattleBuffersTransferData[1] = (u32)(dst);
gBattleBuffersTransferData[2] = ((u32)(dst) & 0x0000FF00) >> 8;
gBattleBuffersTransferData[3] = ((u32)(dst) & 0x00FF0000) >> 16;
gBattleBuffersTransferData[4] = ((u32)(dst) & 0xFF000000) >> 24;
gBattleBuffersTransferData[5] = size;
gBattleBuffersTransferData[6] = (size & 0xFF00) >> 8;
sBattleBuffersTransferData[0] = CONTROLLER_DMA3TRANSFER;
sBattleBuffersTransferData[1] = (u32)(dst);
sBattleBuffersTransferData[2] = ((u32)(dst) & 0x0000FF00) >> 8;
sBattleBuffersTransferData[3] = ((u32)(dst) & 0x00FF0000) >> 16;
sBattleBuffersTransferData[4] = ((u32)(dst) & 0xFF000000) >> 24;
sBattleBuffersTransferData[5] = size;
sBattleBuffersTransferData[6] = (size & 0xFF00) >> 8;
for (i = 0; i < size; i++)
gBattleBuffersTransferData[7 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 7);
sBattleBuffersTransferData[7 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 7);
}
void BtlController_EmitPlayBGM(u8 bufferId, u16 songId, void *unusedDumbDataParameter)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_31;
gBattleBuffersTransferData[1] = songId;
gBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8;
sBattleBuffersTransferData[0] = CONTROLLER_31;
sBattleBuffersTransferData[1] = songId;
sBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8;
for (i = 0; i < songId; i++) // ????
gBattleBuffersTransferData[3 + i] = *(u8*)(unusedDumbDataParameter++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, songId + 3);
sBattleBuffersTransferData[3 + i] = *(u8*)(unusedDumbDataParameter++);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, songId + 3);
}
void BtlController_EmitCmd32(u8 bufferId, u16 size, void *data)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_32;
gBattleBuffersTransferData[1] = size;
gBattleBuffersTransferData[2] = (size & 0xFF00) >> 8;
sBattleBuffersTransferData[0] = CONTROLLER_32;
sBattleBuffersTransferData[1] = size;
sBattleBuffersTransferData[2] = (size & 0xFF00) >> 8;
for (i = 0; i < size; i++)
gBattleBuffersTransferData[3 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, size + 3);
sBattleBuffersTransferData[3 + i] = *(u8*)(data++);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, size + 3);
}
void BtlController_EmitTwoReturnValues(u8 bufferId, u8 arg1, u16 arg2)
{
gBattleBuffersTransferData[0] = CONTROLLER_TWORETURNVALUES;
gBattleBuffersTransferData[1] = arg1;
gBattleBuffersTransferData[2] = arg2;
gBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_TWORETURNVALUES;
sBattleBuffersTransferData[1] = arg1;
sBattleBuffersTransferData[2] = arg2;
sBattleBuffersTransferData[3] = (arg2 & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitChosenMonReturnValue(u8 bufferId, u8 b, u8 *c)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_CHOSENMONRETURNVALUE;
gBattleBuffersTransferData[1] = b;
sBattleBuffersTransferData[0] = CONTROLLER_CHOSENMONRETURNVALUE;
sBattleBuffersTransferData[1] = b;
for (i = 0; i < 3; i++)
gBattleBuffersTransferData[2 + i] = c[i];
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 5);
sBattleBuffersTransferData[2 + i] = c[i];
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 5);
}
void BtlController_EmitOneReturnValue(u8 bufferId, u16 arg1)
{
gBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE;
gBattleBuffersTransferData[1] = arg1;
gBattleBuffersTransferData[2] = (arg1 & 0xFF00) >> 8;
gBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE;
sBattleBuffersTransferData[1] = arg1;
sBattleBuffersTransferData[2] = (arg1 & 0xFF00) >> 8;
sBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitOneReturnValue_Duplicate(u8 bufferId, u16 b)
{
gBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE_DUPLICATE;
gBattleBuffersTransferData[1] = b;
gBattleBuffersTransferData[2] = (b & 0xFF00) >> 8;
gBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_ONERETURNVALUE_DUPLICATE;
sBattleBuffersTransferData[1] = b;
sBattleBuffersTransferData[2] = (b & 0xFF00) >> 8;
sBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitCmd37(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_37;
gBattleBuffersTransferData[1] = CONTROLLER_37;
gBattleBuffersTransferData[2] = CONTROLLER_37;
gBattleBuffersTransferData[3] = CONTROLLER_37;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_37;
sBattleBuffersTransferData[1] = CONTROLLER_37;
sBattleBuffersTransferData[2] = CONTROLLER_37;
sBattleBuffersTransferData[3] = CONTROLLER_37;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitCmd38(u8 bufferId, u8 b)
{
gBattleBuffersTransferData[0] = CONTROLLER_38;
gBattleBuffersTransferData[1] = b;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2);
sBattleBuffersTransferData[0] = CONTROLLER_38;
sBattleBuffersTransferData[1] = b;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2);
}
void BtlController_EmitCmd39(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_39;
gBattleBuffersTransferData[1] = CONTROLLER_39;
gBattleBuffersTransferData[2] = CONTROLLER_39;
gBattleBuffersTransferData[3] = CONTROLLER_39;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_39;
sBattleBuffersTransferData[1] = CONTROLLER_39;
sBattleBuffersTransferData[2] = CONTROLLER_39;
sBattleBuffersTransferData[3] = CONTROLLER_39;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitCmd40(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_40;
gBattleBuffersTransferData[1] = CONTROLLER_40;
gBattleBuffersTransferData[2] = CONTROLLER_40;
gBattleBuffersTransferData[3] = CONTROLLER_40;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_40;
sBattleBuffersTransferData[1] = CONTROLLER_40;
sBattleBuffersTransferData[2] = CONTROLLER_40;
sBattleBuffersTransferData[3] = CONTROLLER_40;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitHitAnimation(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_HITANIMATION;
gBattleBuffersTransferData[1] = CONTROLLER_HITANIMATION;
gBattleBuffersTransferData[2] = CONTROLLER_HITANIMATION;
gBattleBuffersTransferData[3] = CONTROLLER_HITANIMATION;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_HITANIMATION;
sBattleBuffersTransferData[1] = CONTROLLER_HITANIMATION;
sBattleBuffersTransferData[2] = CONTROLLER_HITANIMATION;
sBattleBuffersTransferData[3] = CONTROLLER_HITANIMATION;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitCmd42(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_42;
gBattleBuffersTransferData[1] = CONTROLLER_42;
gBattleBuffersTransferData[2] = CONTROLLER_42;
gBattleBuffersTransferData[3] = CONTROLLER_42;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_42;
sBattleBuffersTransferData[1] = CONTROLLER_42;
sBattleBuffersTransferData[2] = CONTROLLER_42;
sBattleBuffersTransferData[3] = CONTROLLER_42;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitPlaySE(u8 bufferId, u16 songId)
{
gBattleBuffersTransferData[0] = CONTROLLER_EFFECTIVENESSSOUND;
gBattleBuffersTransferData[1] = songId;
gBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8;
gBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_EFFECTIVENESSSOUND;
sBattleBuffersTransferData[1] = songId;
sBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8;
sBattleBuffersTransferData[3] = 0;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitPlayFanfareOrBGM(u8 bufferId, u16 songId, bool8 playBGM)
{
gBattleBuffersTransferData[0] = CONTROLLER_PLAYFANFAREORBGM;
gBattleBuffersTransferData[1] = songId;
gBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8;
gBattleBuffersTransferData[3] = playBGM;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_PLAYFANFAREORBGM;
sBattleBuffersTransferData[1] = songId;
sBattleBuffersTransferData[2] = (songId & 0xFF00) >> 8;
sBattleBuffersTransferData[3] = playBGM;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitFaintingCry(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_FAINTINGCRY;
gBattleBuffersTransferData[1] = CONTROLLER_FAINTINGCRY;
gBattleBuffersTransferData[2] = CONTROLLER_FAINTINGCRY;
gBattleBuffersTransferData[3] = CONTROLLER_FAINTINGCRY;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_FAINTINGCRY;
sBattleBuffersTransferData[1] = CONTROLLER_FAINTINGCRY;
sBattleBuffersTransferData[2] = CONTROLLER_FAINTINGCRY;
sBattleBuffersTransferData[3] = CONTROLLER_FAINTINGCRY;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitIntroSlide(u8 bufferId, u8 terrainId)
{
gBattleBuffersTransferData[0] = CONTROLLER_INTROSLIDE;
gBattleBuffersTransferData[1] = terrainId;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2);
sBattleBuffersTransferData[0] = CONTROLLER_INTROSLIDE;
sBattleBuffersTransferData[1] = terrainId;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2);
}
void BtlController_EmitIntroTrainerBallThrow(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_INTROTRAINERBALLTHROW;
gBattleBuffersTransferData[1] = CONTROLLER_INTROTRAINERBALLTHROW;
gBattleBuffersTransferData[2] = CONTROLLER_INTROTRAINERBALLTHROW;
gBattleBuffersTransferData[3] = CONTROLLER_INTROTRAINERBALLTHROW;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_INTROTRAINERBALLTHROW;
sBattleBuffersTransferData[1] = CONTROLLER_INTROTRAINERBALLTHROW;
sBattleBuffersTransferData[2] = CONTROLLER_INTROTRAINERBALLTHROW;
sBattleBuffersTransferData[3] = CONTROLLER_INTROTRAINERBALLTHROW;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitDrawPartyStatusSummary(u8 bufferId, struct HpAndStatus* hpAndStatus, u8 arg2)
{
s32 i;
gBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY;
gBattleBuffersTransferData[1] = arg2 & 0x7F;
gBattleBuffersTransferData[2] = (arg2 & 0x80) >> 7;
gBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY;
sBattleBuffersTransferData[0] = CONTROLLER_DRAWPARTYSTATUSSUMMARY;
sBattleBuffersTransferData[1] = arg2 & 0x7F;
sBattleBuffersTransferData[2] = (arg2 & 0x80) >> 7;
sBattleBuffersTransferData[3] = CONTROLLER_DRAWPARTYSTATUSSUMMARY;
for (i = 0; i < (s32)(sizeof(struct HpAndStatus) * 6); i++)
gBattleBuffersTransferData[4 + i] = *(i + (u8*)(hpAndStatus));
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, sizeof(struct HpAndStatus) * 6 + 4);
sBattleBuffersTransferData[4 + i] = *(i + (u8*)(hpAndStatus));
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sizeof(struct HpAndStatus) * 6 + 4);
}
void BtlController_EmitCmd49(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_49;
gBattleBuffersTransferData[1] = CONTROLLER_49;
gBattleBuffersTransferData[2] = CONTROLLER_49;
gBattleBuffersTransferData[3] = CONTROLLER_49;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_49;
sBattleBuffersTransferData[1] = CONTROLLER_49;
sBattleBuffersTransferData[2] = CONTROLLER_49;
sBattleBuffersTransferData[3] = CONTROLLER_49;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitCmd50(u8 bufferId)
{
gBattleBuffersTransferData[0] = CONTROLLER_50;
gBattleBuffersTransferData[1] = CONTROLLER_50;
gBattleBuffersTransferData[2] = CONTROLLER_50;
gBattleBuffersTransferData[3] = CONTROLLER_50;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_50;
sBattleBuffersTransferData[1] = CONTROLLER_50;
sBattleBuffersTransferData[2] = CONTROLLER_50;
sBattleBuffersTransferData[3] = CONTROLLER_50;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitSpriteInvisibility(u8 bufferId, bool8 isInvisible)
{
gBattleBuffersTransferData[0] = CONTROLLER_SPRITEINVISIBILITY;
gBattleBuffersTransferData[1] = isInvisible;
gBattleBuffersTransferData[2] = CONTROLLER_SPRITEINVISIBILITY;
gBattleBuffersTransferData[3] = CONTROLLER_SPRITEINVISIBILITY;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_SPRITEINVISIBILITY;
sBattleBuffersTransferData[1] = isInvisible;
sBattleBuffersTransferData[2] = CONTROLLER_SPRITEINVISIBILITY;
sBattleBuffersTransferData[3] = CONTROLLER_SPRITEINVISIBILITY;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument)
{
gBattleBuffersTransferData[0] = CONTROLLER_BATTLEANIMATION;
gBattleBuffersTransferData[1] = animationId;
gBattleBuffersTransferData[2] = argument;
gBattleBuffersTransferData[3] = (argument & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 4);
sBattleBuffersTransferData[0] = CONTROLLER_BATTLEANIMATION;
sBattleBuffersTransferData[1] = animationId;
sBattleBuffersTransferData[2] = argument;
sBattleBuffersTransferData[3] = (argument & 0xFF00) >> 8;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 4);
}
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2)
{
bool8 arg2_ = arg2;
gBattleBuffersTransferData[0] = CONTROLLER_LINKSTANDBYMSG;
gBattleBuffersTransferData[1] = arg1;
sBattleBuffersTransferData[0] = CONTROLLER_LINKSTANDBYMSG;
sBattleBuffersTransferData[1] = arg1;
if (arg2_)
gBattleBuffersTransferData[3] = gBattleBuffersTransferData[2] = sub_81850DC(&gBattleBuffersTransferData[4]);
sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = sub_81850DC(&sBattleBuffersTransferData[4]);
else
gBattleBuffersTransferData[3] = gBattleBuffersTransferData[2] = 0;
sBattleBuffersTransferData[3] = sBattleBuffersTransferData[2] = 0;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, gBattleBuffersTransferData[2] + 4);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sBattleBuffersTransferData[2] + 4);
}
void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId)
{
gBattleBuffersTransferData[0] = CONTROLLER_RESETACTIONMOVESELECTION;
gBattleBuffersTransferData[1] = caseId;
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, 2);
sBattleBuffersTransferData[0] = CONTROLLER_RESETACTIONMOVESELECTION;
sBattleBuffersTransferData[1] = caseId;
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 2);
}
void BtlController_EmitCmd55(u8 bufferId, u8 arg1)
{
gBattleBuffersTransferData[0] = CONTROLLER_55;
gBattleBuffersTransferData[1] = arg1;
gBattleBuffersTransferData[2] = gSaveBlock2Ptr->field_CA9_b;
gBattleBuffersTransferData[3] = gSaveBlock2Ptr->field_CA9_b;
gBattleBuffersTransferData[5] = gBattleBuffersTransferData[4] = sub_81850DC(&gBattleBuffersTransferData[6]);
PrepareBufferDataTransfer(bufferId, gBattleBuffersTransferData, gBattleBuffersTransferData[4] + 6);
sBattleBuffersTransferData[0] = CONTROLLER_55;
sBattleBuffersTransferData[1] = arg1;
sBattleBuffersTransferData[2] = gSaveBlock2Ptr->field_CA9_b;
sBattleBuffersTransferData[3] = gSaveBlock2Ptr->field_CA9_b;
sBattleBuffersTransferData[5] = sBattleBuffersTransferData[4] = sub_81850DC(&sBattleBuffersTransferData[6]);
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sBattleBuffersTransferData[4] + 6);
}

View File

@ -650,7 +650,7 @@ static void sub_8072308(s16 arg0, u16 *arg1, u8 arg2)
}
#else
__attribute__((naked))
ASM_DIRECT
static void sub_8072308(s16 arg0, u16 *arg1, u8 arg2)
{
asm(".syntax unified\n\

View File

@ -20,6 +20,7 @@
#include "constants/hold_effects.h"
#include "constants/trainers.h"
#include "link.h"
#include "link_rfu.h"
#include "bg.h"
#include "dma3.h"
#include "string_util.h"
@ -738,7 +739,7 @@ static void CB2_HandleStartBattle(void)
sub_805EF14();
gBattleCommunication[MULTIUSE_STATE] = 1;
}
if (gLinkVSyncDisabled)
if (gWirelessCommType)
sub_800E0E8();
break;
case 1:
@ -762,8 +763,8 @@ static void CB2_HandleStartBattle(void)
SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32);
gBattleCommunication[MULTIUSE_STATE] = 2;
}
if (gLinkVSyncDisabled)
sub_800DFB4(0, 0);
if (gWirelessCommType)
CreateWirelessStatusIndicatorSprite(0, 0);
}
}
else
@ -933,7 +934,7 @@ static void CB2_HandleStartMultiPartnerBattle(void)
sub_805EF14();
gBattleCommunication[MULTIUSE_STATE] = 1;
}
if (gLinkVSyncDisabled)
if (gWirelessCommType)
sub_800E0E8();
// fall through
case 1:
@ -964,8 +965,8 @@ static void CB2_HandleStartMultiPartnerBattle(void)
gBattleCommunication[MULTIUSE_STATE] = 2;
}
if (gLinkVSyncDisabled)
sub_800DFB4(0, 0);
if (gWirelessCommType)
CreateWirelessStatusIndicatorSprite(0, 0);
}
}
else
@ -1241,14 +1242,14 @@ static void CB2_PreInitMultiBattle(void)
if (sub_800A520() && !gPaletteFade.active)
{
gBattleCommunication[MULTIUSE_STATE]++;
if (gLinkVSyncDisabled)
if (gWirelessCommType)
sub_800ADF8();
else
sub_800AC34();
}
break;
case 3:
if (gLinkVSyncDisabled)
if (gWirelessCommType)
{
if (sub_8010500())
{
@ -1333,7 +1334,7 @@ static void CB2_HandleStartMultiBattle(void)
sub_805EF14();
gBattleCommunication[MULTIUSE_STATE] = 1;
}
if (gLinkVSyncDisabled)
if (gWirelessCommType)
sub_800E0E8();
break;
case 1:
@ -1351,8 +1352,8 @@ static void CB2_HandleStartMultiBattle(void)
SendBlock(bitmask_all_link_players_but_self(), &gBattleStruct->field_180, 32);
gBattleCommunication[MULTIUSE_STATE]++;
}
if (gLinkVSyncDisabled)
sub_800DFB4(0, 0);
if (gWirelessCommType)
CreateWirelessStatusIndicatorSprite(0, 0);
}
}
else
@ -2136,12 +2137,12 @@ static void sub_8038F34(void)
}
break;
case 8:
if (!gLinkVSyncDisabled)
if (!gWirelessCommType)
sub_800AC34();
gBattleCommunication[MULTIUSE_STATE]++;
break;
case 9:
if (!gMain.field_439_x4 || gLinkVSyncDisabled || gReceivedRemoteLinkPlayers != 1)
if (!gMain.field_439_x4 || gWirelessCommType || gReceivedRemoteLinkPlayers != 1)
{
gMain.field_439_x4 = 0;
SetMainCallback2(gMain.savedCallback);
@ -2320,13 +2321,13 @@ static void sub_803939C(void)
case 8:
if (--gBattleCommunication[1] == 0)
{
if (gMain.field_439_x4 && !gLinkVSyncDisabled)
if (gMain.field_439_x4 && !gWirelessCommType)
sub_800AC34();
gBattleCommunication[MULTIUSE_STATE]++;
}
break;
case 9:
if (!gMain.field_439_x4 || gLinkVSyncDisabled || gReceivedRemoteLinkPlayers != 1)
if (!gMain.field_439_x4 || gWirelessCommType || gReceivedRemoteLinkPlayers != 1)
{
gMain.field_439_x4 = 0;
if (!gPaletteFade.active)
@ -3389,7 +3390,7 @@ static void BattleIntroOpponent1SendsOutMonAnimation(void)
}
#else
__attribute__((naked))
ASM_DIRECT
static void BattleIntroOpponent1SendsOutMonAnimation(void)
{
asm(".syntax unified\n\

View File

@ -3649,7 +3649,7 @@ static void atk24(void)
}
}
#else
__attribute__((naked))
ASM_DIRECT
static void atk24(void)
{
asm("\n\
@ -4529,7 +4529,7 @@ static void atk48_playstatchangeanimation(void)
}
}
#else
__attribute__((naked))
ASM_DIRECT
static void atk48_playstatchangeanimation(void)
{
asm("\n\
@ -9422,7 +9422,7 @@ static void atkC1_hiddenpowercalc(void)
}
#else
__attribute__((naked))
ASM_DIRECT
static void atkC1_hiddenpowercalc(void)
{
asm(".syntax unified\n\

View File

@ -160,7 +160,7 @@ extern void sub_809882C(u8, u16, u8);
extern void copy_textbox_border_tile_patterns_to_vram(u8, u16, u8);
extern void sub_81AABF0(void (*callback)(void));
extern void sub_800B4C0(void);
extern void sub_8009F8C(void);
extern void ClearLinkCallback(void);
extern void c2_exit_to_overworld_1_continue_scripts_restart_music(void);
extern void sub_8153430(void);
extern bool8 sub_8153474(void);
@ -952,10 +952,10 @@ static void sub_807FAC8(void)
sBerryBlenderData->syncArrowSpriteIds[i] = CreateSprite(&sBlenderSyncArrow_SpriteTemplate, sBlenderSyncArrowsPos[i][0], sBlenderSyncArrowsPos[i][1], 1);
StartSpriteAnim(&gSprites[sBerryBlenderData->syncArrowSpriteIds[i]], i + 8);
}
if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled)
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType)
{
sub_800E0E8();
sub_800DFB4(0, 0);
CreateWirelessStatusIndicatorSprite(0, 0);
}
SetVBlankCallback(VBlankCB0_BerryBlender);
sBerryBlenderData->mainState++;
@ -1158,10 +1158,10 @@ static void sub_8080018(void)
sBerryBlenderData->syncArrowSprite2Ids[i] = CreateSprite(&sBlenderSyncArrow_SpriteTemplate, sBlenderSyncArrowsPos[i][0], sBlenderSyncArrowsPos[i][1], 1);
StartSpriteAnim(&gSprites[sBerryBlenderData->syncArrowSprite2Ids[i]], i + 8);
}
if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled)
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType)
{
sub_800E0E8();
sub_800DFB4(0, 0);
CreateWirelessStatusIndicatorSprite(0, 0);
}
sBerryBlenderData->mainState++;
break;
@ -1874,7 +1874,7 @@ static void sub_8081370(u16 a0)
static bool32 sub_80814B0(u16 arg0, u16 arg1, u16 arg2)
{
if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled)
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType)
{
if ((arg0 & 0xFF00) == arg2)
return TRUE;
@ -2316,7 +2316,7 @@ static void sub_8081E20(void)
static void sub_8081F94(u16 *a0)
{
if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled)
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType)
*a0 = 0x2F00;
else
*a0 = 0x2FFF;
@ -2345,7 +2345,7 @@ static void CB2_HandleBlenderEndGame(void)
sBerryBlenderData->field_4C -= 32;
if (sBerryBlenderData->field_4C <= 0)
{
sub_8009F8C();
ClearLinkCallback();
sBerryBlenderData->field_4C = 0;
if (gReceivedRemoteLinkPlayers != 0)
@ -2365,7 +2365,7 @@ static void CB2_HandleBlenderEndGame(void)
}
else if (sub_800A520())
{
if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled)
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType)
{
sBerryBlenderData->gameBlock.timeRPM.time = sBerryBlenderData->gameFrameTime;
sBerryBlenderData->gameBlock.timeRPM.max_RPM = sBerryBlenderData->max_RPM;
@ -2394,7 +2394,7 @@ static void CB2_HandleBlenderEndGame(void)
ResetBlockReceivedFlags();
sBerryBlenderData->gameEndState++;
if (gReceivedRemoteLinkPlayers != 0 && gLinkVSyncDisabled)
if (gReceivedRemoteLinkPlayers != 0 && gWirelessCommType)
{
struct BlenderGameBlock *receivedBlock = (struct BlenderGameBlock*)(&gBlockRecvBuffer);
@ -2871,7 +2871,7 @@ static void sub_8082D28(void)
if (gReceivedRemoteLinkPlayers != 0)
playerId = GetMultiplayerId();
if (gLinkVSyncDisabled && gReceivedRemoteLinkPlayers != 0)
if (gWirelessCommType && gReceivedRemoteLinkPlayers != 0)
{
if (playerId == 0)
{

View File

@ -463,7 +463,7 @@ bool8 IsDma3ManagerBusyWithBgCopy(void)
return FALSE;
}
#else
__attribute__((naked))
ASM_DIRECT
bool8 IsDma3ManagerBusyWithBgCopy(void)
{
asm("push {r4-r7,lr}\n\
@ -1048,7 +1048,7 @@ void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8
}
}
}*/
__attribute__((naked))
ASM_DIRECT
void CopyRectToBgTilemapBufferRect(u8 bg, const void* src, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 destX, u8 destY, u8 rectWidth, u8 rectHeight, u8 palette1, u16 tileOffset, u16 palette2)
{
asm("push {r4-r7,lr}\n\
@ -1495,7 +1495,7 @@ void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 pal
*dest = test;
}
#else
__attribute__((naked))
ASM_DIRECT
void CopyTileMapEntry(u16 *src, u16 *dest, s32 palette1, u32 tileOffset, u32 palette2)
{
asm("push {r4-r6,lr}\n\

View File

@ -421,7 +421,7 @@ bool8 ShouldDoBrailleRegicePuzzle(void)
return FALSE;
}
#else
__attribute__((naked))
ASM_DIRECT
bool8 ShouldDoBrailleRegicePuzzle(void)
{
asm(".syntax unified\n\

View File

@ -14,8 +14,6 @@
extern u8 gText_ClearAllSaveData[];
extern u8 gText_ClearingData[];
extern u16 gUnknown_0860F074[];
static void Task_DoClearSaveDataScreenYesNo(u8);
static void Task_ClearSaveDataScreenYesNoChoice(u8);
static void Task_ClearSaveData(u8);

View File

@ -117,7 +117,7 @@ void Unused_LZDecompressWramIndirect(const void **src, void *dest)
}
// This one (unused) function is really challenging, won't even try to decompile it.
__attribute__((naked))
ASM_DIRECT
void sub_803471C()
{
asm(".syntax unified\n\

View File

@ -2542,7 +2542,7 @@ void sub_812A0E8(u8 taskId)
}
}
#else
__attribute__((naked)) void sub_812A0E8(u8 taskId)
ASM_DIRECT void sub_812A0E8(u8 taskId)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tlsls r0, 24\n"

View File

@ -58,20 +58,14 @@ extern const u8 gText_HatchedFromEgg[];
extern const u8 gText_NickHatchPrompt[];
extern u8 sav1_map_get_name(void);
extern s8 ProcessMenuInputNoWrap_(void);
extern void TVShowConvertInternationalString(u8* str1, u8* str2, u8);
extern void sub_806A068(u16, u8);
extern void FadeScreen(u8, u8);
extern void overworld_free_bg_tilemaps(void);
extern void sub_80AF168(void);
extern void AllocateMonSpritesGfx(void);
extern void FreeMonSpritesGfx(void);
extern void ScanlineEffect_Stop(void);
extern void reset_temp_tile_data_buffers(void);
extern void c2_exit_to_overworld_2_switch(void);
extern void play_some_sound(void);
extern void copy_decompressed_tile_data_to_vram_autofree(u8 bg_id, const void* src, u16 size, u16 offset, u8 mode);
extern void CreateYesNoMenu(const struct WindowTemplate*, u16, u8, u8);
extern void DoNamingScreen(u8, const u8*, u16, u8, u32, MainCallback);
extern u16 sub_80D22D0(void);
extern u8 CountPartyAliveNonEggMonsExcept(u8);

View File

@ -67,9 +67,6 @@ extern const u8 gText_PkmnStoppedEvolving[];
extern const u8 gText_EllipsisQuestionMark[];
extern const u8 gText_CommunicationStandby5[];
extern void copy_decompressed_tile_data_to_vram_autofree(u8 arg0, const void *arg1, bool32 arg2, u16 arg3, u8 arg4);
extern u32 sub_80391E0(u8, u8);
extern void SpriteCallbackDummy_2(struct Sprite *sprite);
extern void sub_80356D0(void);
extern void sub_807B154(void);
extern void sub_806A068(u16, u8);
@ -471,10 +468,10 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
}
break;
case 6:
if (gLinkVSyncDisabled)
if (gWirelessCommType)
{
sub_800E0E8();
sub_800DFB4(0, 0);
CreateWirelessStatusIndicatorSprite(0, 0);
}
BlendPalettes(-1,0x10, 0);
gMain.state++;
@ -1255,7 +1252,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
case 5:
if (!gPaletteFade.active)
{
if (gLinkVSyncDisabled)
if (gWirelessCommType)
sub_800E084();
Free(GetBgTilemapBuffer(3));

View File

@ -3,38 +3,6 @@
#include "librfu.h"
struct RfuUnk1
{
u8 unk_0[0x14];
u32 unk_14;
u32 unk_18;
struct RfuIntrStruct unk_1c;
};
struct RfuUnk2
{
u8 unk_0[0x68];
u32 unk_68;
u32 unk_6c;
u8 unk_70[0x70];
};
struct RfuUnk3
{
u32 unk_0;
u32 unk_4;
u8 unk_8[0xD4];
u32 unk_dc;
};
extern u32 *gUnknown_03007890;
extern u32 *gUnknown_03007894;
extern struct RfuUnk3* gUnknown_03007898;
extern struct RfuUnk2* gUnknown_03007880[4];
extern struct RfuUnk1* gUnknown_03007870[4];
extern void* sub_82E53F4;
extern void rfu_STC_clearAPIVariables(void);
// Nonmatching, only register differences
/*u16 rfu_initializeAPI(u32 *unk0, u16 unk1, IntrFunc *interrupt, bool8 copyInterruptToRam)
{

View File

@ -641,7 +641,7 @@ static u8 sub_818E13C(void)
return retval;
}
#else
__attribute__((naked)) static u8 sub_818E13C(void)
ASM_DIRECT static u8 sub_818E13C(void)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tmovs r7, 0x1\n"

2428
src/link.c

File diff suppressed because it is too large Load Diff

4940
src/link_rfu.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,50 +1,32 @@
#include "global.h"
#include "main.h"
#include "crt0.h"
#include "malloc.h"
#include "link.h"
#include "link_rfu.h"
#include "librfu.h"
#include "m4a.h"
#include "bg.h"
#include "rtc.h"
#include "scanline_effect.h"
#include "overworld.h"
#include "play_time.h"
#include "random.h"
#include "dma3.h"
#include "gba/flash_internal.h"
#include "load_save.h"
#include "gpu_regs.h"
#include "agb_flash.h"
#include "sound.h"
#include "battle.h"
#include "battle_controllers.h"
#include "text.h"
#include "intro.h"
#include "main.h"
extern u16 GetGpuReg(u8);
extern void SetGpuReg(u8, u16);
extern void LinkVSync(void);
extern void sub_800E174(void);
extern void sub_800B9B8(void);
extern void InitGpuRegManager(void);
extern void sub_800E6D0(void);
extern void CheckForFlashMemory(void);
extern void InitMapMusic(void);
extern void ResetBgs(void);
extern void SetDefaultFontsPointer(void);
extern void InitHeap(void *heapStart, u32 heapSize); // malloc.h
extern void rfu_REQ_stopMode(void);
extern void rfu_waitREQComplete(void);
extern bool32 sub_8087634(void);
extern bool32 sub_80875C8(void);
extern void ClearSpriteCopyRequests(void);
extern void PlayTimeCounter_Update(void);
extern void MapMusicMain(void);
extern void EnableInterrupts(u16);
extern void sub_8033648(void);
extern u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void));
extern void ScanlineEffect_Stop(void);
extern struct SoundInfo gSoundInfo;
extern u32 gFlashMemoryPresent;
extern u32 IntrMain[];
extern u8 gHeap[];
extern struct SaveBlock2 gSaveblock2;
extern struct PokemonStorage gPokemonStorage;
extern u32 gBattleTypeFlags;
extern u8 gUnknown_03002748;
extern u32 *gUnknown_0203CF5C;
void Timer3Intr(void);
bool8 HandleLinkConnection(void);
void c2_copyright_1(void);
static void VBlankIntr(void);
static void HBlankIntr(void);
static void VCountIntr(void);
@ -79,19 +61,19 @@ const IntrFunc gIntrTableTemplate[] =
static u16 gUnknown_03000000;
extern u16 gKeyRepeatStartDelay;
extern u8 gUnknown_030022B4;
extern struct Main gMain;
extern u16 gKeyRepeatContinueDelay;
extern u8 gSoftResetDisabled;
extern IntrFunc gIntrTable[INTR_COUNT];
extern bool8 gLinkVSyncDisabled;
extern u32 IntrMain_Buffer[0x200];
extern u8 gPcmDmaCounter;
u16 gKeyRepeatStartDelay;
bool8 gLinkTransferringData;
struct Main gMain;
u16 gKeyRepeatContinueDelay;
bool8 gSoftResetDisabled;
IntrFunc gIntrTable[INTR_COUNT];
u8 gLinkVSyncDisabled;
u32 IntrMain_Buffer[0x200];
u8 gPcmDmaCounter;
extern u16 gTrainerId;
static EWRAM_DATA u16 gTrainerId = 0;
EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL;
//EWRAM_DATA void (**gFlashTimerIntrFunc)(void) = NULL;
static void UpdateLinkAndCallCallbacks(void);
static void InitMainCallbacks(void);
@ -129,7 +111,7 @@ void AgbMain()
if (gFlashMemoryPresent != TRUE)
SetMainCallback2(NULL);
gUnknown_030022B4 = 0;
gLinkTransferringData = FALSE;
gUnknown_03000000 = 0xFC0;
for (;;)
@ -147,22 +129,22 @@ void AgbMain()
if (sub_8087634() == 1)
{
gUnknown_030022B4 = 1;
gLinkTransferringData = TRUE;
UpdateLinkAndCallCallbacks();
gUnknown_030022B4 = 0;
gLinkTransferringData = FALSE;
}
else
{
gUnknown_030022B4 = 0;
gLinkTransferringData = FALSE;
UpdateLinkAndCallCallbacks();
if (sub_80875C8() == 1)
{
gMain.newKeys = 0;
ClearSpriteCopyRequests();
gUnknown_030022B4 = 1;
gLinkTransferringData = TRUE;
UpdateLinkAndCallCallbacks();
gUnknown_030022B4 = 0;
gLinkTransferringData = FALSE;
}
}
@ -335,10 +317,10 @@ extern void CopyBufferedValuesToGpuRegs(void);
static void VBlankIntr(void)
{
if (gLinkVSyncDisabled != FALSE)
if (gWirelessCommType != 0)
RfuVSync();
else if (gLinkVSyncDisabled == FALSE)
LinkVSync();
else if (gUnknown_03002748 == FALSE)
sub_800B9B8();
gMain.vblankCounter1++;

View File

@ -189,7 +189,7 @@ static void CB2_MysteryEventMenu(void)
{
if (gReceivedRemoteLinkPlayers != 0)
{
if (sub_800A0C8(2, 2) == 3)
if (GetLinkPlayerDataExchangeStatusTimed(2, 2) == 3)
{
sub_800AC34();
GetEventLoadMessage(gStringVar4, 1);

View File

@ -1433,7 +1433,7 @@ void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId)
*ppBonusesPtr = localPpBonuses;
}
#else
__attribute__((naked))
ASM_DIRECT
void sub_81C14BC(struct Pokemon *mon, u8 swappingFromId, u8 swappingToId)
{
asm(".syntax unified\n\
@ -1644,7 +1644,7 @@ void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId)
*ppBonusesPtr = localPpBonuses;
}
#else
__attribute__((naked))
ASM_DIRECT
void sub_81C15EC(struct BoxPokemon *mon, u8 swappingFromId, u8 swappingToId)
{
asm(".syntax unified\n\
@ -2055,7 +2055,7 @@ void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d)
Free(alloced);
}
#else
__attribute__((naked))
ASM_DIRECT
void sub_81C1CB0(struct UnkStruct_61CC04 *a, u16 *b, u8 c, u8 d)
{
asm(".syntax unified\n\
@ -2357,7 +2357,7 @@ void sub_81C2194(u16 *a, u16 b, u8 c)
}
}
#else
__attribute__((naked))
ASM_DIRECT
void sub_81C2194(u16 *a, u16 b, u8 c)
{
asm(".syntax unified\n\
@ -2806,7 +2806,7 @@ u8 sub_81C2D2C(struct WindowTemplate *template, u8 a)
return r4[a];
}
#else
__attribute__((naked))
ASM_DIRECT
u8 sub_81C2D2C(struct WindowTemplate *template, u8 a)
{
asm(".syntax unified\n\
@ -2851,7 +2851,7 @@ void sub_81C2D68(u8 a)
}
}
#else
__attribute__((naked))
ASM_DIRECT
void sub_81C2D68(u8 a)
{
asm(".syntax unified\n\
@ -3108,7 +3108,7 @@ void sub_81C335C()
sub_81C25A4(r4, gText_FiveMarks, r5, 1, 0, 1);
}
#else
__attribute__((naked))
ASM_DIRECT
void sub_81C335C()
{
asm(".syntax unified\n\
@ -3451,7 +3451,7 @@ void sub_81C3B08(u8 a)
sub_81C25A4(sp, text, offset, (a<<4), 0, r5);
}
#else
__attribute__((naked))
ASM_DIRECT
void sub_81C3B08(u8 a)
{
asm(".syntax unified\n\

View File

@ -476,7 +476,7 @@ u32 MoveRecordedBattleToSaveData(void)
}
#else
__attribute__((naked))
ASM_DIRECT
u32 MoveRecordedBattleToSaveData(void)
{
asm(".syntax unified\n\

View File

@ -162,10 +162,10 @@ static void CB2_ReshowBattleScreenAfterMenu(void)
ActionSelectionCreateCursorAt(gActionSelectionCursor[gBattlerInMenuId], 0);
if (gLinkVSyncDisabled != 0 && gReceivedRemoteLinkPlayers != 0)
if (gWirelessCommType != 0 && gReceivedRemoteLinkPlayers != 0)
{
sub_800E0E8();
sub_800DFB4(0, 0);
CreateWirelessStatusIndicatorSprite(0, 0);
}
}
break;

18
src/rom_8011DC0.c Normal file
View File

@ -0,0 +1,18 @@
// Includes
#include "global.h"
// Static type declarations
// Static RAM declarations
IWRAM_DATA u32 gUnknown_03000DA0;
IWRAM_DATA u32 gUnknown_03000DA4;
IWRAM_DATA void *gUnknown_03000DA8;
IWRAM_DATA void *gUnknown_03000DAC;
IWRAM_DATA bool32 gUnknown_03000DB0;
// Static ROM declarations
// .rodata
// .text

View File

@ -1529,7 +1529,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
CopyWindowToVram(gUnknown_03000F30, 3);
return FALSE;
}*/
__attribute__((naked))
ASM_DIRECT
bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
{
asm("push {r4-r7,lr}\n\

View File

@ -379,7 +379,7 @@ void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
*(current++) = (shadowColor << 12) | (shadowColor << 8) | (shadowColor << 4) | shadowColor;
}
#else
__attribute__((naked))
ASM_DIRECT
void GenerateFontHalfRowLookupTable(u8 fgColor, u8 bgColor, u8 shadowColor)
{
asm("push {r4-r7,lr}\n\
@ -875,7 +875,7 @@ void DecompressGlyphTile(const u16 *src, u16 *dest)
*(dest) = (gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] & 0xFF]] << 16) | gFontHalfRowLookupTable[gFontHalfRowOffsets[src[1] >> 8]];
}
#else
__attribute__((naked))
ASM_DIRECT
void DecompressGlyphTile(const u16 *src, u16 *dest)
{
asm("push {r4-r7,lr}\n\
@ -1056,7 +1056,7 @@ u8 GetLastTextColor(u8 colorType)
}
}
__attribute__((naked))
ASM_DIRECT
void CopyGlyphToWindow(struct TextPrinter *x)
{
asm("push {r4-r7,lr}\n\
@ -2285,7 +2285,6 @@ u16 RenderText(struct TextPrinter *textPrinter)
else
textPrinter->subPrinter.currentX += gUnknown_03002F90[0x80];
}
return 0;
case 1: // _08005C78
if (TextPrinterWait(textPrinter))

View File

@ -2154,7 +2154,7 @@ void sub_80EDE98(TVShow *show)
}
}
#else
__attribute__((naked))
ASM_DIRECT
void sub_80EDE98(TVShow *show)
{
asm_unified("\tpush {r4-r7,lr}\n"
@ -4110,7 +4110,7 @@ void sub_80F0708(void) // FIXME: register allocation shenanigans
}
}
#else
__attribute__((naked)) void sub_80F0708(void)
ASM_DIRECT void sub_80F0708(void)
{
asm_unified("\tpush {r4-r7,lr}\n"
"\tmov r7, r9\n"

View File

@ -230,7 +230,7 @@ void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output)
}
#else
__attribute__((naked)) void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output)
ASM_DIRECT void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output)
{
asm("\n\
.syntax unified\n\

View File

@ -2,8 +2,11 @@
#include "window.h"
#include "malloc.h"
extern u8 gUnknown_03002F60;
extern void* gUnknown_03002F70[];
u32 filler_03002F58;
u32 filler_03002F5C;
u8 gUnknown_03002F60;
u32 filler_03002F64;
void *gUnknown_03002F70[4];
extern u32 gUnneededFireRedVariable;
#define WINDOWS_MAX 32

View File

@ -5,7 +5,9 @@
.include "src/bg.o"
.include "src/text.o"
.include "src/sprite.o"
.include "src/link.o"
.include "src/link.o"
.include "src/link_rfu.o"
.include "src/rom_8011DC0.o"
.include "src/rtc.o"
.include "src/main_menu.o"
.include "src/rom_8034C54.o"
@ -55,7 +57,7 @@ gUnknown_030011F7: @ 30011F7
.space 0x1
.include "src/starter_choose.o"
.align 0x2
gUnknown_030011FC: @ 30011FC

View File

@ -1,206 +1,11 @@
.space 0x8
gKeyRepeatStartDelay: @ 30022B0
.space 0x4
gUnknown_030022B4: @ 30022B4
.space 0xC
gMain: @ 30022C0
.space 0x2C
gUnknown_030022EC: @ 30022EC
.space 0xC
gUnknown_030022F8: @ 30022F8
.space 0x200
gUnknown_030024F8: @ 30024F8
.space 0x200
gUnknown_030026F8: @ 30026F8
.space 0x4
gKeyRepeatContinueDelay: @ 30026FC
.space 0x4
gSoftResetDisabled: @ 3002700
.space 0x10
gIntrTable: @ 3002710
.space 0x38
gUnknown_03002748: @ 3002748
.space 0x8
IntrMain_Buffer: @ 3002750
.space 0x800
gPcmDmaCounter: @ 3002F50
.space 0x4
.include "main.o"
.include "bg.o"
.align 4
gUnknown_03002F60: @ 3002F60
.space 0x10
gUnknown_03002F70: @ 3002F70
.space 0x10
.include "window.o"
.include "text.o"
.include "sprite.o"
gUnknown_03003020: @ 3003020
.space 0xC
gUnknown_0300302C: @ 300302C
.space 0x4
gUnknown_03003030: @ 3003030
.space 0x3C
gUnknown_0300306C: @ 300306C
.space 0x4
gUnknown_03003070: @ 3003070
.space 0x8
gUnknown_03003078: @ 3003078
.space 0x4
gUnknown_0300307C: @ 300307C
.space 0x8
gUnknown_03003084: @ 3003084
.space 0xC
gRecvCmds: @ 3003090
.space 0x2
gUnknown_03003092: @ 3003092
.space 0x2
gUnknown_03003094: @ 3003094
.space 0x4C
gLinkStatus: @ 30030E0
.space 0x4
gUnknown_030030E4: @ 30030E4
.space 0x4
gUnknown_030030E8: @ 30030E8
.space 0x4
gUnknown_030030EC: @ 30030EC
.space 0x4
gUnknown_030030F0: @ 30030F0
.space 0x4
gUnknown_030030F4: @ 30030F4
.space 0x4
gUnknown_030030F8: @ 30030F8
.space 0x4
gLinkVSyncDisabled: @ 30030FC
.space 0x4
gUnknown_03003100: @ 3003100
.space 0x10
gSendCmd: @ 3003110
.space 0x10
gUnknown_03003120: @ 3003120
.space 0x4
gReceivedRemoteLinkPlayers: @ 3003124
.space 0xC
gUnknown_03003130: @ 3003130
.space 0x10
gUnknown_03003140: @ 3003140
.space 0x4
gUnknown_03003144: @ 3003144
.space 0x4
gUnknown_03003148: @ 3003148
.space 0x8
gUnknown_03003150: @ 3003150
.space 0x10
gUnknown_03003160: @ 3003160
.space 0x10
gUnknown_03003170: @ 3003170
.space 0x4
gUnknown_03003174: @ 3003174
.space 0xFBC
gUnknown_03004130: @ 3004130
.space 0x4
gUnknown_03004134: @ 3004134
.space 0xC
gUnknown_03004140: @ 3004140
.space 0x10
gUnknown_03004150: @ 3004150
.space 0x40
gUnknown_03004190: @ 3004190
.space 0xE70
gUnknown_03005000: @ 3005000
.space 0x14
gUnknown_03005014: @ 3005014
.space 0x58
gUnknown_0300506C: @ 300506C
.space 0x2
gUnknown_0300506E: @ 300506E
.space 0x76
gUnknown_030050E4: @ 30050E4
.space 0xE
gUnknown_030050F2: @ 30050F2
.space 0x18
gUnknown_0300510A: @ 300510A
.space 0x1A
gUnknown_03005124: @ 3005124
.space 0x8C4
gUnknown_030059E8: @ 30059E8
.space 0x29F
gUnknown_03005C87: @ 3005C87
.space 0x47
gUnknown_03005CCE: @ 3005CCE
.space 0x3
gUnknown_03005CD1: @ 3005CD1
.space 0x4
gUnknown_03005CD5: @ 3005CD5
.space 0x9
gUnknown_03005CDE: @ 3005CDE
.space 0x1A
.include "link.o"
.include "link_rfu.o"
.include "rtc.o"
.include "battle_main.o"

View File

@ -1,8 +1,5 @@
.include "src/decompress.o"
gTrainerId: @ 2020000
.space 0x4
.include "src/main.o"
.include "src/window.o"
.include "src/text.o"
.include "src/sprite.o"
@ -21,66 +18,8 @@ gStringVar4: @ 2021FC4
.space 0x3E8
.include "src/string_util.o"
gUnknown_020223BC: @ 20223BC
.space 0x1
gUnknown_020223BD: @ 20223BD
.space 0x3
gUnknown_020223C0: @ 20223C0
.space 0x4
gBlockRecvBuffer: @ 20223C4
.space 0x500
gBlockSendBuffer: @ 20228C4 gBlockSendBuffer
.space 0x100
gUnknown_020229C4: @ 20229C4
.space 0x2
gLinkType: @ 20229C6
.space 0x2
gUnknown_020229C8: @ 20229C8
.space 0x4
gUnknown_020229CC: @ 20229CC
.space 0x1C
gLinkPlayers: @ 20229E8
.space 0x24
gUnknown_02022A0C: @ 2022A0C
.space 0x68
gUnknown_02022A74: @ 2022A74
.space 0x8C
gUnknown_02022B00: @ 2022B00
.space 0x8
gUnknown_02022B08: @ 2022B08
.space 0x4
gUnknown_02022B0C: @ 2022B0C
.space 0x4
gUnknown_02022B10: @ 2022B10
.space 0x4
gUnknown_02022B14: @ 2022B14
.space 0xE
gUnknown_02022B22: @ 2022B22
.space 0xA
gUnknown_02022B2C: @ 2022B2C
.space 0x18
gUnknown_02022B44: @ 2022B44
.space 0xDC
.include "src/link.o"
.include "src/link_rfu.o"
gUnknown_02022C20: @ 2022C20
.space 0xC
@ -178,6 +117,7 @@ gUnknown_02022CFC: @ 2022CFC
gUnknown_02022D00: @ 2022D00
.space 0x4
@ src/main_menu.c
gUnknown_02022D04: @ 2022D04
.space 0x2
@ -196,8 +136,7 @@ gUnknown_02022D0A: @ 2022D0A
gUnknown_02022D0C: @ 2022D0C
.space 0x4
gBattleBuffersTransferData: @ 2022D10
.space 0x100
.include "src/battle_controllers.o"
gUnknown_02022E10: @ 2022E10
.space 0x4