summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm/save_menu_util.s149
-rw-r--r--baserom.ipsbin413412 -> 398989 bytes
-rw-r--r--data/berry_crush.s120
-rw-r--r--data/data_8466FB8.s12
-rw-r--r--data/field_effect_helpers.s20
-rw-r--r--data/field_map_obj.s10
-rw-r--r--data/fldeff_cut.s30
-rw-r--r--data/mevent/script_common.inc87
-rw-r--r--data/mevent/script_ish.inc65
-rw-r--r--data/pokemon_jump.s (renamed from data/data_8468C98.s)117
-rw-r--r--data/unknown_serial_data.s2
-rw-r--r--graphics/map_objects/fldeff_cut.pngbin0 -> 173 bytes
-rw-r--r--include/link_rfu.h3
-rw-r--r--include/mevent_server.h32
-rw-r--r--include/save_menu_util.h3
-rw-r--r--ld_script.txt7
-rw-r--r--src/mevent_client.c4
-rw-r--r--src/mevent_scripts.c192
-rw-r--r--src/save_menu_util.c58
19 files changed, 463 insertions, 448 deletions
diff --git a/asm/save_menu_util.s b/asm/save_menu_util.s
deleted file mode 100644
index 8ebfc3731..000000000
--- a/asm/save_menu_util.s
+++ /dev/null
@@ -1,149 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
- thumb_func_start SaveStatToString
-SaveStatToString: @ 80F7FCC
- push {r4-r7,lr}
- lsls r0, 24
- lsrs r3, r0, 24
- lsls r2, 24
- lsrs r2, 24
- adds r5, r1, 0
- movs r1, 0xFC
- strb r1, [r5]
- adds r5, 0x1
- movs r0, 0x1
- strb r0, [r5]
- adds r5, 0x1
- strb r2, [r5]
- adds r5, 0x1
- strb r1, [r5]
- adds r5, 0x1
- movs r0, 0x3
- strb r0, [r5]
- adds r5, 0x1
- adds r2, 0x1
- strb r2, [r5]
- adds r5, 0x1
- cmp r3, 0x5
- bhi _080F80D8
- lsls r0, r3, 2
- ldr r1, _080F8008 @ =_080F800C
- adds r0, r1
- ldr r0, [r0]
- mov pc, r0
- .align 2, 0
-_080F8008: .4byte _080F800C
- .align 2, 0
-_080F800C:
- .4byte _080F8024
- .4byte _080F8034
- .4byte _080F805C
- .4byte _080F8098
- .4byte _080F80A8
- .4byte _080F806C
-_080F8024:
- ldr r0, _080F8030 @ =gSaveBlock2Ptr
- ldr r1, [r0]
- adds r0, r5, 0
- bl StringCopy
- b _080F80D8
- .align 2, 0
-_080F8030: .4byte gSaveBlock2Ptr
-_080F8034:
- bl IsNationalPokedexEnabled
- cmp r0, 0
- beq _080F8044
- movs r0, 0x1
- bl GetNationalPokedexCount
- b _080F804A
-_080F8044:
- movs r0, 0x1
- bl GetKantoPokedexCount
-_080F804A:
- adds r1, r0, 0
- lsls r1, 16
- lsrs r1, 16
- adds r0, r5, 0
- movs r2, 0
- movs r3, 0x3
- bl ConvertIntToDecimalStringN
- b _080F80D8
-_080F805C:
- ldr r4, _080F8068 @ =gSaveBlock2Ptr
- ldr r0, [r4]
- ldrh r1, [r0, 0xE]
- adds r0, r5, 0
- movs r2, 0
- b _080F8076
- .align 2, 0
-_080F8068: .4byte gSaveBlock2Ptr
-_080F806C:
- ldr r4, _080F8094 @ =gSaveBlock2Ptr
- ldr r0, [r4]
- ldrh r1, [r0, 0xE]
- adds r0, r5, 0
- movs r2, 0x1
-_080F8076:
- movs r3, 0x3
- bl ConvertIntToDecimalStringN
- adds r5, r0, 0
- movs r0, 0xF0
- strb r0, [r5]
- adds r5, 0x1
- ldr r0, [r4]
- ldrb r1, [r0, 0x10]
- adds r0, r5, 0
- movs r2, 0x2
- movs r3, 0x2
- bl ConvertIntToDecimalStringN
- b _080F80D8
- .align 2, 0
-_080F8094: .4byte gSaveBlock2Ptr
-_080F8098:
- ldr r0, _080F80A4 @ =gMapHeader
- ldrb r1, [r0, 0x14]
- adds r0, r5, 0
- bl sub_80C4DF8
- b _080F80D8
- .align 2, 0
-_080F80A4: .4byte gMapHeader
-_080F80A8:
- movs r4, 0x82
- lsls r4, 4
- movs r6, 0
- adds r7, r5, 0x1
-_080F80B0:
- lsls r0, r4, 16
- lsrs r0, 16
- bl FlagGet
- lsls r0, 24
- cmp r0, 0
- beq _080F80C0
- adds r6, 0x1
-_080F80C0:
- adds r4, 0x1
- ldr r0, _080F80E0 @ =0x00000827
- cmp r4, r0
- ble _080F80B0
- adds r0, r6, 0
- subs r0, 0x5F
- strb r0, [r5]
- adds r5, r7, 0
- movs r0, 0xA
- strb r0, [r5]
- movs r0, 0xFF
- strb r0, [r5, 0x1]
-_080F80D8:
- pop {r4-r7}
- pop {r0}
- bx r0
- .align 2, 0
-_080F80E0: .4byte 0x00000827
- thumb_func_end SaveStatToString
-
- .align 2, 0 @ Don't pad with nop.
diff --git a/baserom.ips b/baserom.ips
index 4a40d3337..07a82d3b0 100644
--- a/baserom.ips
+++ b/baserom.ips
Binary files differ
diff --git a/data/berry_crush.s b/data/berry_crush.s
new file mode 100644
index 000000000..c17f2c8af
--- /dev/null
+++ b/data/berry_crush.s
@@ -0,0 +1,120 @@
+ .include "asm/macros.inc"
+ .include "constants/constants.inc"
+
+ .section .rodata
+gUnknown_846E2E0:: @ 846E2E0
+ .incbin "baserom.gba", 0x46E2E0, 0x8
+
+gUnknown_846E2E8:: @ 846E2E8
+ .incbin "baserom.gba", 0x46E2E8, 0x8
+
+gUnknown_846E2F0:: @ 846E2F0
+ .incbin "baserom.gba", 0x46E2F0, 0x24
+
+gUnknown_846E314:: @ 846E314
+ .incbin "baserom.gba", 0x46E314, 0x14
+
+gUnknown_846E328:: @ 846E328
+ .incbin "baserom.gba", 0x46E328, 0x24
+
+gUnknown_846E34C:: @ 846E34C
+ .incbin "baserom.gba", 0x46E34C, 0x68
+
+gUnknown_846E3B4:: @ 846E3B4
+ .incbin "baserom.gba", 0x46E3B4, 0x10
+
+gUnknown_846E3C4:: @ 846E3C4
+ .incbin "baserom.gba", 0x46E3C4, 0x4
+
+gUnknown_846E3C8:: @ 846E3C8
+ .incbin "baserom.gba", 0x46E3C8, 0x4
+
+gUnknown_846E3CC:: @ 846E3CC
+ .incbin "baserom.gba", 0x46E3CC, 0x4
+
+gUnknown_846E3D0:: @ 846E3D0
+ .incbin "baserom.gba", 0x46E3D0, 0xC
+
+gUnknown_846E3DC:: @ 846E3DC
+ .incbin "baserom.gba", 0x46E3DC, 0x3
+
+gUnknown_846E3DF:: @ 846E3DF
+ .incbin "baserom.gba", 0x46E3DF, 0x3
+
+gUnknown_846E3E2:: @ 846E3E2
+ .incbin "baserom.gba", 0x46E3E2, 0x3
+
+gUnknown_846E3E5:: @ 846E3E5
+ .incbin "baserom.gba", 0x46E3E5, 0x6
+
+gUnknown_846E3EB:: @ 846E3EB
+ .incbin "baserom.gba", 0x46E3EB, 0x5
+
+gUnknown_846E3F0:: @ 846E3F0
+ .incbin "baserom.gba", 0x46E3F0, 0x8
+
+gUnknown_846E3F8:: @ 846E3F8
+ .incbin "baserom.gba", 0x46E3F8, 0x50
+
+gUnknown_846E448:: @ 846E448
+ .incbin "baserom.gba", 0x46E448, 0x8
+
+gUnknown_846E450:: @ 846E450
+ .incbin "baserom.gba", 0x46E450, 0x940
+
+gUnknown_846ED90:: @ 846ED90
+ .incbin "baserom.gba", 0x46ED90, 0x130
+
+gUnknown_846EEC0:: @ 846EEC0
+ .incbin "baserom.gba", 0x46EEC0, 0x198
+
+gUnknown_846F058:: @ 846F058
+ .incbin "baserom.gba", 0x46F058, 0x228
+
+gUnknown_846F280:: @ 846F280
+ .incbin "baserom.gba", 0x46F280, 0x14
+
+gUnknown_846F294:: @ 846F294
+ .incbin "baserom.gba", 0x46F294, 0x3C
+
+gUnknown_846F2D0:: @ 846F2D0
+ .incbin "baserom.gba", 0x46F2D0, 0x1
+
+gUnknown_846F2D1:: @ 846F2D1
+ .incbin "baserom.gba", 0x46F2D1, 0x5
+
+gUnknown_846F2D6:: @ 846F2D6
+ .incbin "baserom.gba", 0x46F2D6, 0x1
+
+gUnknown_846F2D7:: @ 846F2D7
+ .incbin "baserom.gba", 0x46F2D7, 0x15
+
+gUnknown_846F2EC:: @ 846F2EC
+ .incbin "baserom.gba", 0x46F2EC, 0xC
+
+gUnknown_846F2F8:: @ 846F2F8
+ .incbin "baserom.gba", 0x46F2F8, 0x28
+
+gUnknown_846F320:: @ 846F320
+ .incbin "baserom.gba", 0x46F320, 0xF0
+
+gUnknown_846F410:: @ 846F410
+ .incbin "baserom.gba", 0x46F410, 0x18
+
+gUnknown_846F428:: @ 846F428
+ .incbin "baserom.gba", 0x46F428, 0x18
+
+gUnknown_846F440:: @ 846F440
+ .incbin "baserom.gba", 0x46F440, 0x18
+
+gUnknown_846F458:: @ 846F458
+ .incbin "baserom.gba", 0x46F458, 0x18
+
+gUnknown_846F470:: @ 846F470
+ .incbin "baserom.gba", 0x46F470, 0x18
+
+gUnknown_846F488:: @ 846F488
+ .incbin "baserom.gba", 0x46F488, 0x30
+
+gUnknown_846F4B8:: @ 846F4B8
+ .incbin "baserom.gba", 0x46F4B8, 0x18
diff --git a/data/data_8466FB8.s b/data/data_8466FB8.s
deleted file mode 100644
index 9436bc4fd..000000000
--- a/data/data_8466FB8.s
+++ /dev/null
@@ -1,12 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .section .rodata
-
- .align 2
-gUnknown_84687A0::
- .string "You have collected all STAMPs!\n"
- .string "Want to input a CARD as a prize?$"
-
- .include "data/mevent/script_ish.inc"
- .include "data/mevent/script_common.inc"
diff --git a/data/field_effect_helpers.s b/data/field_effect_helpers.s
index 429df9f61..7ad7b168a 100644
--- a/data/field_effect_helpers.s
+++ b/data/field_effect_helpers.s
@@ -7,22 +7,28 @@
.align 2
gUnknown_83FECCC:: @ 83FECCC
- .byte 0x0c, 0x00, 0x1c, 0x00, 0x2c, 0x00
+ .2byte 0x0c, 0x1c, 0x2c
gUnknown_83FECD2:: @ 83FECD2
- .incbin "baserom.gba", 0x3FECD2, 0x4
+ .byte 0, 1, 2, 3
gUnknown_83FECD6:: @ 83FECD6
- .incbin "baserom.gba", 0x3FECD6, 0xA
+ .2byte 0x0004, 0x0004, 0x0004, 0x0010
+ .align 2
gUnknown_83FECE0:: @ 83FECE0
- .incbin "baserom.gba", 0x3FECE0, 0x8
+ .4byte sub_80DBB18
+ .4byte sub_80DBB3C
+ .align 2
gUnknown_83FECE8:: @ 83FECE8
- .incbin "baserom.gba", 0x3FECE8, 0xC
+ .4byte sub_80DC318
+ .4byte sub_80DC348
+ .4byte sub_80DC3A8
gUnknown_83FECF4:: @ 83FECF4
- .incbin "baserom.gba", 0x3FECF4, 0x6
+ .byte 0, 0, 1, 2, 3
+ .align 1
gUnknown_83FECFA:: @ 83FECFA
- .incbin "baserom.gba", 0x3FECFA, 0x6
+ .2byte 0x0007, 0x000f
diff --git a/data/field_map_obj.s b/data/field_map_obj.s
index 9c36b523e..e4fe9ceca 100644
--- a/data/field_map_obj.s
+++ b/data/field_map_obj.s
@@ -531,7 +531,15 @@ gUnknown_8398008:: @ 8398008
gUnknown_8398028:: @ 8398028
.incbin "graphics/map_objects/12.gbapal"
- .incbin "baserom.gba", 0x398048, 0x1340
+ .incbin "baserom.gba", 0x398048, 0x600
+
+gUnknown_8398648::
+ .incbin "graphics/map_objects/fldeff_cut.4bpp"
+ .incbin "graphics/map_objects/fldeff_cut.4bpp"
+
+gUnknown_8398688::
+ .incbin "graphics/map_objects/fldeff_cut.gbapal"
+ .incbin "baserom.gba", 0x3986A8, 0xCE0
gUnknown_8399388:: @ 8399388
.incbin "baserom.gba", 0x399388, 0x908
diff --git a/data/fldeff_cut.s b/data/fldeff_cut.s
index 5436b51e4..ca25b396a 100644
--- a/data/fldeff_cut.s
+++ b/data/fldeff_cut.s
@@ -7,10 +7,34 @@
.align 2
gUnknown_83D4100:: @ 83D4100
- .incbin "baserom.gba", 0x3D4100, 0x44
+ .2byte 0x000d, 0x0001
+ .2byte 0x000a, 0x0013
+ .2byte 0x000b, 0x000e
+ .2byte 0x000c, 0x000f
+ .2byte 0x0352, 0x033e
+ .2byte 0x0300, 0x0310
+ .2byte 0x0301, 0x0311
+ .2byte 0x0302, 0x0312
+ .2byte 0x0284, 0x0281
+ .2byte 0xffff, 0xffff
+
+ .align 2
+gOamData_83D4128::
+ .4byte 0x00000000, 0x00001401
+
+gAnimCmd_83D4130::
+ obj_image_anim_frame 0, 30
+ obj_image_anim_jump 0
+
+gSpriteAnimTable_83D4138::
+ .4byte gAnimCmd_83D4130
+
+gUnknown_83D413C::
+ obj_frame_tiles gUnknown_8398648, 0x20
gUnknown_83D4144::
- .incbin "baserom.gba", 0x3D4144, 0x8
+ obj_pal gUnknown_8398688, 4096
gUnknown_83D414C:: @ 83D414C
- .incbin "baserom.gba", 0x3D414C, 0x18
+ spr_template 0xFFFF, 4096, gOamData_83D4128, gSpriteAnimTable_83D4138, gUnknown_83D413C, gDummySpriteAffineAnimTable, objc_8097BA8
+
diff --git a/data/mevent/script_common.inc b/data/mevent/script_common.inc
deleted file mode 100644
index f3ca09e3d..000000000
--- a/data/mevent/script_common.inc
+++ /dev/null
@@ -1,87 +0,0 @@
-gMEventSrvScript_UnableToSend::
- .4byte 0x12, 0x10, gMEventClientScript_UnableToRecv @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x14, NULL @ RECV
- .4byte 0x00, 0x0a, NULL @ RETURN (can't send)
-
- .4byte 0x12, 0x10, gMEventClientScript_CommError @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x14, NULL @ RECV
- .4byte 0x00, 0x0b, NULL @ RETURN (comm error)
-
- .4byte 0x12, 0x10, gMEventClientScript_OtherTrainerCanceled @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x14, NULL @ RECV
- .4byte 0x00, 0x09, NULL @ RETURN (other trn canceled)
-
-gMEventSrvScript_OtherTrnHasNews::
- .4byte 0x12, 0x10, gMEventClientScript_AlreadyHadNews @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x14, NULL @ RECV
- .4byte 0x00, 0x07, NULL @ RETURN (other trn has news)
-
-gMEventSrvScript_SentNewsSuccess::
- .4byte 0x12, 0x28, gMEventClientScript_ReceiveNewsAndValidate @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x0e, 0x00, NULL @ SEND_NEWS
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x13, NULL @ RECV
- .4byte 0x08, 0x00, NULL @ READWORD
- .4byte 0x04, 0x01, gMEventSrvScript_OtherTrnHasNews @ BRANCH_EQ
- .4byte 0x12, 0x10, gMEventClientScript_RecvNewsSuccess @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x14, NULL @ RECV
- .4byte 0x00, 0x03, NULL @ RETURN (news sent to)
-
-gMEventSrvScript_SendCardSuccess::
- .4byte 0x12, 0x30, gMEventClientScript_ReceiveCardAndReturnSuccess @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x0d, 0x00, NULL @ SEND_CARD
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x0f, 0x00, NULL @ BUFFER_SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x14, NULL @ RECV
- .4byte 0x00, 0x02, NULL @ RETURN (card sent to)
-
-gMEventSrvScript_AskClientToOverwriteCard::
- .4byte 0x12, 0x28, gMEventClientScript_AskWouldLikeToTossCard @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x13, NULL @ RECV
- .4byte 0x08, 0x00, NULL @ READWORD
- .4byte 0x04, 0x00, gMEventSrvScript_SendCardSuccess @ BRANCH_EQ
- .4byte 0x03, 0x00, gMEventSrvScript_OtherTrainerCanceled @ BRANCH
-
-gMEventSrvScript_OtherTrnHasCard::
- .4byte 0x12, 0x10, gMEventClientScript_AlreadyHadCard @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x14, NULL @ RECV
- .4byte 0x00, 0x05, NULL @ RETURN (other trn has card)
-
- .4byte 0x12, 0x10, gMEventClientScript_NothingSentOver @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x14, NULL @ RECV
- .4byte 0x00, 0x00, NULL @ RETURN (nothing sent over)
-
-gMEventSrvScript_SendNews:: @ 8468B6C
- .4byte 0x1b, 0x00, NULL @ BUFFER_SAVED_NEWS
- .4byte 0x12, 0x20, gMEventClientScript_Send1442CC @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x11, NULL @ RECV
- .4byte 0x05, 0x00, NULL @ READ_1442CC
- .4byte 0x06, 0x00, NULL @ VALID_1442CC
- .4byte 0x04, 0x00, gMEventSrvScript_UnableToSend @ BRANCH_EQ
- .4byte 0x03, 0x00, gMEventSrvScript_SentNewsSuccess @ BRANCH
-
-gMEventSrvScript_SendCard:: @ 8468BCC
- .4byte 0x1a, 0x00, NULL @ BUFFER_SAVED_CARD
- .4byte 0x1c, 0x00, NULL @ RAM_SCRIPT_IF_VALID
- .4byte 0x12, 0x20, gMEventClientScript_Send1442CC @ SEND
- .4byte 0x01, 0x00, NULL @ WAIT SEND
- .4byte 0x02, 0x11, NULL @ RECV
- .4byte 0x05, 0x00, NULL @ READ_1442CC
- .4byte 0x06, 0x00, NULL @ VALID_1442CC
- .4byte 0x04, 0x00, gMEventSrvScript_UnableToSend @ BRANCH_EQ
- .4byte 0x07, 0x00, NULL @ CHECK_1442CC_14
- .4byte 0x04, 0x02, gMEventSrvScript_AskClientToOverwriteCard @ BRANCH_EQ
- .4byte 0x04, 0x00, gMEventSrvScript_SendCardSuccess @ BRANCH_EQ
- .4byte 0x03, 0x00, gMEventSrvScript_OtherTrnHasCard @ BRANCH
diff --git a/data/mevent/script_ish.inc b/data/mevent/script_ish.inc
deleted file mode 100644
index ed6b639da..000000000
--- a/data/mevent/script_ish.inc
+++ /dev/null
@@ -1,65 +0,0 @@
-gMEventClientScript_InotialListen:: @ 84687E0
- .4byte 0x02, 0x10 @ RECEIVE ID(0x10)
- .4byte 0x04, 0x00 @ JUMP TO RECEIVE BUFFER
-
-gMEventClientScript_Send1442CC::
- .4byte 0x08, 0x00 @ SEND HEADER MAYBE
- .4byte 0x03, 0x00 @ WAIT SEND
- .4byte 0x02, 0x10 @ RECEIVE ID(0x10)
- .4byte 0x04, 0x00 @ JUMP TO RECEIVE BUFFER
-
-gMEventClientScript_UnableToRecv:: @ can't accept card or news
- .4byte 0x14, 0x00 @ SEND ALL
- .4byte 0x01, 0x0a @ RETURN 0x0a
-
-gMEventClientScript_CommError:: @ comm error
- .4byte 0x14, 0x00 @ SEND ALL
- .4byte 0x01, 0x0b @ RETURN 0x0b
-
-gMEventClientScript_NothingSentOver:: @ nothing sent
- .4byte 0x14, 0x00 @ SEND ALL
- .4byte 0x01, 0x00 @ RETURN 0x00
-
-gMEventClientScript_ReceiveCardAndReturnSuccess:: @ card success
- .4byte 0x02, 0x16 @ RECEIVE ID(0x16)
- .4byte 0x0a, 0x00 @ RECEIVE_TO_SAVE_FILE
- .4byte 0x02, 0x19 @ RECEIVE ID(0x19)
- .4byte 0x11, 0x00 @ RECEIVE_TO_RAM_SCRIPT
- .4byte 0x14, 0x00 @ SEND ALL
- .4byte 0x01, 0x02 @ RETURN 0x02
-
-gMEventClientScript_ReceiveNewsAndValidate::
- .4byte 0x02, 0x17 @ RECEIVE ID(0x17)
- .4byte 0x09, 0x00 @ VALIDATE NEWS
- .4byte 0x03, 0x00 @ WAIT SEND
- .4byte 0x02, 0x10 @ RECEIVE ID(0x10)
- .4byte 0x04, 0x00 @ JUMP TO RECEIVE BUFFER
-
-gMEventClientScript_AlreadyHadNews:: @ already had news
- .4byte 0x14, 0x00 @ SEND ALL
- .4byte 0x01, 0x07 @ RETURN 0x07
-
-gMEventClientScript_RecvNewsSuccess:: @ news success
- .4byte 0x14, 0x00 @ SEND ALL
- .4byte 0x01, 0x03 @ RETURN 0x03
-
-gMEventClientScript_AskWouldLikeToTossCard::
- .4byte 0x0d, 0x00 @ REQUEST PARAMETER
- .4byte 0x0e, 0x00 @ SEND PARAMETER
- .4byte 0x03, 0x00 @ WAIT SEND
- .4byte 0x02, 0x10 @ RECEIVE ID(0x10)
- .4byte 0x04, 0x00 @ JUMP TO RECEIVE BUFFER
-
-gMEventClientScript_OtherTrainerCanceled:: @ comm canceled
- .4byte 0x14, 0x00 @ SEND ALL
- .4byte 0x01, 0x09 @ RETURN 0x09
-
-gMEventClientScript_AlreadyHadCard:: @ already had card
- .4byte 0x14, 0x00 @ SEND ALL
- .4byte 0x01, 0x05 @ RETURN 0x05
-
-gMEventClientScript_SuccessFromBuffer:: @ success from buffer
- .4byte 0x02, 0x15 @ RECEIVE ID(0x15)
- .4byte 0x0c, 0x00 @ READ PACKET AND COMPUTE SOMETHING
- .4byte 0x14, 0x00 @ SEND ALL
- .4byte 0x01, 0x0d @ RETURN 0x0d
diff --git a/data/data_8468C98.s b/data/pokemon_jump.s
index 7ce7c3a02..bddff8c3a 100644
--- a/data/data_8468C98.s
+++ b/data/pokemon_jump.s
@@ -179,120 +179,3 @@ gUnknown_846E2CC:: @ 846E2CC
gUnknown_846E2D4:: @ 846E2D4
.incbin "baserom.gba", 0x46E2D4, 0xC
-
-gUnknown_846E2E0:: @ 846E2E0
- .incbin "baserom.gba", 0x46E2E0, 0x8
-
-gUnknown_846E2E8:: @ 846E2E8
- .incbin "baserom.gba", 0x46E2E8, 0x8
-
-gUnknown_846E2F0:: @ 846E2F0
- .incbin "baserom.gba", 0x46E2F0, 0x24
-
-gUnknown_846E314:: @ 846E314
- .incbin "baserom.gba", 0x46E314, 0x14
-
-gUnknown_846E328:: @ 846E328
- .incbin "baserom.gba", 0x46E328, 0x24
-
-gUnknown_846E34C:: @ 846E34C
- .incbin "baserom.gba", 0x46E34C, 0x68
-
-gUnknown_846E3B4:: @ 846E3B4
- .incbin "baserom.gba", 0x46E3B4, 0x10
-
-gUnknown_846E3C4:: @ 846E3C4
- .incbin "baserom.gba", 0x46E3C4, 0x4
-
-gUnknown_846E3C8:: @ 846E3C8
- .incbin "baserom.gba", 0x46E3C8, 0x4
-
-gUnknown_846E3CC:: @ 846E3CC
- .incbin "baserom.gba", 0x46E3CC, 0x4
-
-gUnknown_846E3D0:: @ 846E3D0
- .incbin "baserom.gba", 0x46E3D0, 0xC
-
-gUnknown_846E3DC:: @ 846E3DC
- .incbin "baserom.gba", 0x46E3DC, 0x3
-
-gUnknown_846E3DF:: @ 846E3DF
- .incbin "baserom.gba", 0x46E3DF, 0x3
-
-gUnknown_846E3E2:: @ 846E3E2
- .incbin "baserom.gba", 0x46E3E2, 0x3
-
-gUnknown_846E3E5:: @ 846E3E5
- .incbin "baserom.gba", 0x46E3E5, 0x6
-
-gUnknown_846E3EB:: @ 846E3EB
- .incbin "baserom.gba", 0x46E3EB, 0x5
-
-gUnknown_846E3F0:: @ 846E3F0
- .incbin "baserom.gba", 0x46E3F0, 0x8
-
-gUnknown_846E3F8:: @ 846E3F8
- .incbin "baserom.gba", 0x46E3F8, 0x50
-
-gUnknown_846E448:: @ 846E448
- .incbin "baserom.gba", 0x46E448, 0x8
-
-gUnknown_846E450:: @ 846E450
- .incbin "baserom.gba", 0x46E450, 0x940
-
-gUnknown_846ED90:: @ 846ED90
- .incbin "baserom.gba", 0x46ED90, 0x130
-
-gUnknown_846EEC0:: @ 846EEC0
- .incbin "baserom.gba", 0x46EEC0, 0x198
-
-gUnknown_846F058:: @ 846F058
- .incbin "baserom.gba", 0x46F058, 0x228
-
-gUnknown_846F280:: @ 846F280
- .incbin "baserom.gba", 0x46F280, 0x14
-
-gUnknown_846F294:: @ 846F294
- .incbin "baserom.gba", 0x46F294, 0x3C
-
-gUnknown_846F2D0:: @ 846F2D0
- .incbin "baserom.gba", 0x46F2D0, 0x1
-
-gUnknown_846F2D1:: @ 846F2D1
- .incbin "baserom.gba", 0x46F2D1, 0x5
-
-gUnknown_846F2D6:: @ 846F2D6
- .incbin "baserom.gba", 0x46F2D6, 0x1
-
-gUnknown_846F2D7:: @ 846F2D7
- .incbin "baserom.gba", 0x46F2D7, 0x15
-
-gUnknown_846F2EC:: @ 846F2EC
- .incbin "baserom.gba", 0x46F2EC, 0xC
-
-gUnknown_846F2F8:: @ 846F2F8
- .incbin "baserom.gba", 0x46F2F8, 0x28
-
-gUnknown_846F320:: @ 846F320
- .incbin "baserom.gba", 0x46F320, 0xF0
-
-gUnknown_846F410:: @ 846F410
- .incbin "baserom.gba", 0x46F410, 0x18
-
-gUnknown_846F428:: @ 846F428
- .incbin "baserom.gba", 0x46F428, 0x18
-
-gUnknown_846F440:: @ 846F440
- .incbin "baserom.gba", 0x46F440, 0x18
-
-gUnknown_846F458:: @ 846F458
- .incbin "baserom.gba", 0x46F458, 0x18
-
-gUnknown_846F470:: @ 846F470
- .incbin "baserom.gba", 0x46F470, 0x18
-
-gUnknown_846F488:: @ 846F488
- .incbin "baserom.gba", 0x46F488, 0x30
-
-gUnknown_846F4B8:: @ 846F4B8
- .incbin "baserom.gba", 0x46F4B8, 0x18
diff --git a/data/unknown_serial_data.s b/data/unknown_serial_data.s
index 57c979340..ec5818604 100644
--- a/data/unknown_serial_data.s
+++ b/data/unknown_serial_data.s
@@ -1,5 +1,5 @@
.section .rodata
gUnknownSerialData_Start:: @ 86FC50C
- .incbin "baserom.gba", 0x6FC50C, 0x3760
+ .incbin "data/unknown_serial_data.bin"
gUnknownSerialData_End::
diff --git a/graphics/map_objects/fldeff_cut.png b/graphics/map_objects/fldeff_cut.png
new file mode 100644
index 000000000..031d04b40
--- /dev/null
+++ b/graphics/map_objects/fldeff_cut.png
Binary files differ
diff --git a/include/link_rfu.h b/include/link_rfu.h
index 6e6e5f7a3..671488be0 100644
--- a/include/link_rfu.h
+++ b/include/link_rfu.h
@@ -43,4 +43,7 @@ void sub_80FBB20(void);
bool8 sub_80FA484(bool32 a0);
void var_800D_set_xB(void);
+#include "mevent_server.h"
+extern const struct mevent_server_cmd gMEventSrvScript_OtherTrainerCanceled[];
+
#endif //GUARD_LINK_RFU_H
diff --git a/include/mevent_server.h b/include/mevent_server.h
index ddc00b978..b691e9e1f 100644
--- a/include/mevent_server.h
+++ b/include/mevent_server.h
@@ -37,6 +37,20 @@ struct mevent_client_cmd
u32 parameter;
};
+// Client commands
+#define CLI_RETURN(x) {.instr = 1, .parameter = x}
+#define CLI_RECEIVE(x) {.instr = 2, .parameter = x}
+#define CLI_WAITSND {.instr = 3, .parameter = 0}
+#define CLI_JUMPBUF {.instr = 4, .parameter = 0}
+#define CLI_SNDHEAD {.instr = 8, .parameter = 0}
+#define CLI_VLDNEWS {.instr = 9, .parameter = 0}
+#define CLI_RECVSAV {.instr = 10, .parameter = 0}
+#define CLI_RECVBUF {.instr = 12, .parameter = 0}
+#define CLI_REQWORD {.instr = 13, .parameter = 0}
+#define CLI_SNDWORD {.instr = 14, .parameter = 0}
+#define CLI_RECVRAM {.instr = 17, .parameter = 0}
+#define CLI_SENDALL {.instr = 20, .parameter = 0}
+
struct mevent_client
{
u32 unk_00;
@@ -58,6 +72,24 @@ struct mevent_server_cmd
void * parameter;
};
+// Server commands
+#define SRV_RETURN(x) {.instr = 0, .flag = x}
+#define SRV_WAITSND {.instr = 1}
+#define SRV_RECV(x) {.instr = 2, .flag = x}
+#define SRV_BRANCH(y) {.instr = 3, .parameter = (void *)y}
+#define SRV_BRANCHIF(x, y) {.instr = 4, .flag = x, .parameter = (void *)y}
+#define SRV_READ_1442CC {.instr = 5}
+#define SRV_VALID_1442CC {.instr = 6}
+#define SRV_CHECK_1442CC_14 {.instr = 7}
+#define SRV_READWORD {.instr = 8}
+#define SRV_SEND_CARD {.instr = 13}
+#define SRV_SEND_NEWS {.instr = 14}
+#define SRV_BUFFER_SEND {.instr = 15}
+#define SRV_SEND(x, y) {.instr = 18, .flag = x, .parameter = (void *)y}
+#define SRV_BUFFER_CARD {.instr = 26}
+#define SRV_BUFFER_NEWS {.instr = 27}
+#define SRV_RAM_SCRIPT_IF_VALID {.instr = 28}
+
struct mevent_srv_common
{
u32 unk_00;
diff --git a/include/save_menu_util.h b/include/save_menu_util.h
index f2a18a777..7085520b4 100644
--- a/include/save_menu_util.h
+++ b/include/save_menu_util.h
@@ -7,7 +7,8 @@ enum SaveStat
SAVE_STAT_POKEDEX,
SAVE_STAT_TIME,
SAVE_STAT_LOCATION,
- SAVE_STAT_BADGES
+ SAVE_STAT_BADGES,
+ SAVE_STAT_TIME_HR_RT_ALIGN
};
void SaveStatToString(u8 a0, u8 *a1, u8 a2);
diff --git a/ld_script.txt b/ld_script.txt
index 03fab08a6..d40c88c0a 100644
--- a/ld_script.txt
+++ b/ld_script.txt
@@ -222,7 +222,7 @@ SECTIONS {
src/fldeff_teleport.o(.text);
src/new_menu_helpers.o(.text);
asm/box_party_pokemon_dropdown.o(.text);
- asm/save_menu_util.o(.text);
+ src/save_menu_util.o(.text);
src/map_preview_screen.o(.text);
asm/link_rfu_2.o(.text);
asm/link_rfu.o(.text);
@@ -536,12 +536,13 @@ SECTIONS {
src/mevent_client.o(.rodata);
src/mevent_server.o(.rodata);
src/mevent_8145654.o(.rodata);
- data/data_8466FB8.o(.rodata);
+ src/mevent_scripts.o(.rodata);
src/menews_jisan.o(.rodata);
src/menews_jisan.o(.rodata.str1.4);
. = ALIGN(4);
src/seagallop.o(.rodata);
- data/data_8468C98.o(.rodata);
+ data/pokemon_jump.o(.rodata);
+ data/berry_crush.o(.rodata);
src/wireless_communication_status_screen.o(.rodata);
src/braille_text.o(.rodata);
src/text_window_graphics.o(.rodata);
diff --git a/src/mevent_client.c b/src/mevent_client.c
index c2a86afdd..4da0b4bc1 100644
--- a/src/mevent_client.c
+++ b/src/mevent_client.c
@@ -14,7 +14,7 @@ static void mevent_client_init(struct mevent_client *, u32, u32);
static u32 mevent_client_exec(struct mevent_client *);
static void mevent_client_free_resources(struct mevent_client *);
-extern const struct mevent_client_cmd gMEventClientScript_InotialListen[];
+extern const struct mevent_client_cmd gMEventClientScript_InitialListen[];
void mevent_client_do_init(void)
{
@@ -89,7 +89,7 @@ static void mevent_client_send_word(struct mevent_client * svr, u32 ident, u32 w
static u32 client_mainseq_0(struct mevent_client * svr)
{
// init
- memcpy(svr->cmdBuffer, gMEventClientScript_InotialListen, ME_SEND_BUF_SIZE);
+ memcpy(svr->cmdBuffer, gMEventClientScript_InitialListen, ME_SEND_BUF_SIZE);
svr->cmdidx = 0;
svr->mainseqno = 4;
svr->flag = 0;
diff --git a/src/mevent_scripts.c b/src/mevent_scripts.c
new file mode 100644
index 000000000..04d44f603
--- /dev/null
+++ b/src/mevent_scripts.c
@@ -0,0 +1,192 @@
+#include "global.h"
+#include "mevent_server.h"
+
+extern const struct mevent_server_cmd gMEventSrvScript_OtherTrainerCanceled[];
+
+// Unreferenced
+const u8 gUnknown_84687A0[] = _("You have collected all STAMPs!\nWant to input a CARD as a prize?");
+
+/* CLIENT SCRIPTS */
+
+const struct mevent_client_cmd gMEventClientScript_InitialListen[] = { // 84687E0
+ CLI_RECEIVE(0x10),
+ CLI_JUMPBUF
+};
+
+const struct mevent_client_cmd gMEventClientScript_Send1442CC[] = {
+ CLI_SNDHEAD,
+ CLI_WAITSND,
+ CLI_RECEIVE(0x10),
+ CLI_JUMPBUF
+};
+
+const struct mevent_client_cmd gMEventClientScript_UnableToRecv[] = { // can't accept card or news
+ CLI_SENDALL,
+ CLI_RETURN(0x0a)
+};
+
+const struct mevent_client_cmd gMEventClientScript_CommError[] = { // comm error
+ CLI_SENDALL,
+ CLI_RETURN(0x0b)
+};
+
+const struct mevent_client_cmd gMEventClientScript_NothingSentOver[] = { // nothing sent
+ CLI_SENDALL,
+ CLI_RETURN(0x00)
+};
+
+const struct mevent_client_cmd gMEventClientScript_ReceiveCardAndReturnSuccess[] = { // card success
+ CLI_RECEIVE(0x16),
+ CLI_RECVSAV,
+ CLI_RECEIVE(0x19),
+ CLI_RECVRAM,
+ CLI_SENDALL,
+ CLI_RETURN(0x02)
+};
+
+const struct mevent_client_cmd gMEventClientScript_ReceiveNewsAndValidate[] = {
+ CLI_RECEIVE(0x17),
+ CLI_VLDNEWS,
+ CLI_WAITSND,
+ CLI_RECEIVE(0x10),
+ CLI_JUMPBUF
+};
+
+const struct mevent_client_cmd gMEventClientScript_AlreadyHadNews[] = { // already had news
+ CLI_SENDALL,
+ CLI_RETURN(0x07)
+};
+
+const struct mevent_client_cmd gMEventClientScript_RecvNewsSuccess[] = { // news success
+ CLI_SENDALL,
+ CLI_RETURN(0x03)
+};
+
+const struct mevent_client_cmd gMEventClientScript_AskWouldLikeToTossCard[] = {
+ CLI_REQWORD,
+ CLI_SNDWORD,
+ CLI_WAITSND,
+ CLI_RECEIVE(0x10),
+ CLI_JUMPBUF
+};
+
+const struct mevent_client_cmd gMEventClientScript_OtherTrainerCanceled[] = { // comm canceled
+ CLI_SENDALL,
+ CLI_RETURN(0x09)
+};
+
+const struct mevent_client_cmd gMEventClientScript_AlreadyHadCard[] = { // already had card
+ CLI_SENDALL,
+ CLI_RETURN(0x05)
+};
+
+const struct mevent_client_cmd gMEventClientScript_SuccessFromBuffer[] = { // success from buffer
+ CLI_RECEIVE(0x15),
+ CLI_RECVBUF,
+ CLI_SENDALL,
+ CLI_RETURN(0x0d)
+};
+
+/* SERVER SCRIPTS */
+
+const struct mevent_server_cmd gMEventSrvScript_UnableToSend[] = {
+ SRV_SEND(0x10, gMEventClientScript_UnableToRecv),
+ SRV_WAITSND,
+ SRV_RECV(0x14),
+ SRV_RETURN(0x0a)
+};
+
+const struct mevent_server_cmd gUnknown_8468950[] = {
+ SRV_SEND(0x10, gMEventClientScript_CommError),
+ SRV_WAITSND,
+ SRV_RECV(0x14),
+ SRV_RETURN(0x0b)
+};
+
+const struct mevent_server_cmd gUnknown_8468980[] = {
+ SRV_SEND(0x10, gMEventClientScript_OtherTrainerCanceled),
+ SRV_WAITSND,
+ SRV_RECV(0x14),
+ SRV_RETURN(0x09)
+};
+
+const struct mevent_server_cmd gMEventSrvScript_OtherTrnHasNews[] = {
+ SRV_SEND(0x10, gMEventClientScript_AlreadyHadNews),
+ SRV_WAITSND,
+ SRV_RECV(0x14),
+ SRV_RETURN(0x07)
+};
+
+const struct mevent_server_cmd gMEventSrvScript_SentNewsSuccess[] = {
+ SRV_SEND(0x28, gMEventClientScript_ReceiveNewsAndValidate),
+ SRV_WAITSND,
+ SRV_SEND_NEWS,
+ SRV_WAITSND,
+ SRV_RECV(0x13),
+ SRV_READWORD,
+ SRV_BRANCHIF(0x01, gMEventSrvScript_OtherTrnHasNews),
+ SRV_SEND(0x10, gMEventClientScript_RecvNewsSuccess),
+ SRV_WAITSND,
+ SRV_RECV(0x14),
+ SRV_RETURN(0x03)
+};
+
+const struct mevent_server_cmd gMEventSrvScript_SendCardSuccess[] = {
+ SRV_SEND(0x30, gMEventClientScript_ReceiveCardAndReturnSuccess),
+ SRV_WAITSND,
+ SRV_SEND_CARD,
+ SRV_WAITSND,
+ SRV_BUFFER_SEND,
+ SRV_WAITSND,
+ SRV_RECV(0x14),
+ SRV_RETURN(0x02)
+};
+
+const struct mevent_server_cmd gMEventSrvScript_AskClientToOverwriteCard[] = {
+ SRV_SEND(0x28, gMEventClientScript_AskWouldLikeToTossCard),
+ SRV_WAITSND,
+ SRV_RECV(0x13),
+ SRV_READWORD,
+ SRV_BRANCHIF(0x00, gMEventSrvScript_SendCardSuccess),
+ SRV_BRANCH(gMEventSrvScript_OtherTrainerCanceled)
+};
+
+const struct mevent_server_cmd gMEventSrvScript_OtherTrnHasCard[] = {
+ SRV_SEND(0x10, gMEventClientScript_AlreadyHadCard),
+ SRV_WAITSND,
+ SRV_RECV(0x14),
+ SRV_RETURN(0x05)
+};
+
+const struct mevent_server_cmd gUnknown_8468B3C[] = {
+ SRV_SEND(0x10, gMEventClientScript_NothingSentOver),
+ SRV_WAITSND,
+ SRV_RECV(0x14),
+ SRV_RETURN(0x00)
+};
+
+const struct mevent_server_cmd gMEventSrvScript_SendNews[] = {
+ SRV_BUFFER_NEWS,
+ SRV_SEND(0x20, gMEventClientScript_Send1442CC),
+ SRV_WAITSND,
+ SRV_RECV(0x11),
+ SRV_READ_1442CC,
+ SRV_VALID_1442CC,
+ SRV_BRANCHIF(0x00, gMEventSrvScript_UnableToSend),
+ SRV_BRANCH(gMEventSrvScript_SentNewsSuccess)
+};
+
+const struct mevent_server_cmd gMEventSrvScript_SendCard[] = {
+ SRV_BUFFER_CARD,
+ SRV_RAM_SCRIPT_IF_VALID,
+ SRV_SEND(0x20, gMEventClientScript_Send1442CC),
+ SRV_WAITSND,
+ SRV_RECV(0x11),
+ SRV_READ_1442CC,
+ SRV_VALID_1442CC,
+ SRV_BRANCHIF(0x00, gMEventSrvScript_UnableToSend),
+ SRV_CHECK_1442CC_14,
+ SRV_BRANCHIF(0x02, gMEventSrvScript_AskClientToOverwriteCard),
+ SRV_BRANCHIF(0x00, gMEventSrvScript_SendCardSuccess),
+ SRV_BRANCH(gMEventSrvScript_OtherTrnHasCard)
+};
diff --git a/src/save_menu_util.c b/src/save_menu_util.c
new file mode 100644
index 000000000..195b29b0c
--- /dev/null
+++ b/src/save_menu_util.c
@@ -0,0 +1,58 @@
+#include "global.h"
+#include "string_util.h"
+#include "text.h"
+#include "event_data.h"
+#include "pokedex.h"
+#include "region_map.h"
+#include "save_menu_util.h"
+#include "constants/flags.h"
+
+void SaveStatToString(u8 gameStatId, u8 *dest0, u8 color)
+{
+ int nBadges;
+ int flagId;
+
+ u8 *dest = dest0;
+ *dest++ = EXT_CTRL_CODE_BEGIN;
+ *dest++ = EXT_CTRL_CODE_COLOR;
+ *dest++ = color;
+ *dest++ = EXT_CTRL_CODE_BEGIN;
+ *dest++ = EXT_CTRL_CODE_SHADOW;
+ *dest++ = color + 1;
+ switch (gameStatId)
+ {
+ case SAVE_STAT_NAME:
+ dest = StringCopy(dest, gSaveBlock2Ptr->playerName);
+ break;
+ case SAVE_STAT_POKEDEX:
+ if (IsNationalPokedexEnabled())
+ dest = ConvertIntToDecimalStringN(dest, GetNationalPokedexCount(1), STR_CONV_MODE_LEFT_ALIGN, 3);
+ else
+ dest = ConvertIntToDecimalStringN(dest, GetKantoPokedexCount(1), STR_CONV_MODE_LEFT_ALIGN, 3);
+ break;
+ case SAVE_STAT_TIME:
+ dest = ConvertIntToDecimalStringN(dest, gSaveBlock2Ptr->playTimeHours, STR_CONV_MODE_LEFT_ALIGN, 3);
+ *dest++ = CHAR_COLON;
+ dest = ConvertIntToDecimalStringN(dest, gSaveBlock2Ptr->playTimeMinutes, STR_CONV_MODE_LEADING_ZEROS, 2);
+ break;
+ case SAVE_STAT_TIME_HR_RT_ALIGN:
+ dest = ConvertIntToDecimalStringN(dest, gSaveBlock2Ptr->playTimeHours, STR_CONV_MODE_RIGHT_ALIGN, 3);
+ *dest++ = CHAR_COLON;
+ dest = ConvertIntToDecimalStringN(dest, gSaveBlock2Ptr->playTimeMinutes, STR_CONV_MODE_LEADING_ZEROS, 2);
+ break;
+ case SAVE_STAT_LOCATION:
+ sub_80C4DF8(dest, gMapHeader.regionMapSectionId);
+ break;
+ case SAVE_STAT_BADGES:
+ for (flagId = FLAG_BADGE01_GET, nBadges = 0; flagId < FLAG_BADGE01_GET + 8; flagId++)
+ {
+ if (FlagGet(flagId))
+ nBadges++;
+ }
+ *dest++ = nBadges + CHAR_0;
+ *dest++ = 10; // 'こ'
+ *dest++ = EOS;
+ break;
+ }
+}
+