mirror of https://github.com/pret/pokeemerald.git
Decompile mevent server scripts
This commit is contained in:
parent
6c12d154e7
commit
28646ea64e
|
@ -1,193 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
|
||||
.align 2
|
||||
gText_CanceledReadingCard:: @ 82F257C
|
||||
.string "Canceled reading\nthe Card.$"
|
||||
|
||||
.align 2
|
||||
gUnknown_082F2598:: @ 82F2598
|
||||
.4byte 2, 16
|
||||
.4byte 4, 0
|
||||
|
||||
.align 2
|
||||
gUnknown_082F25A8:: @ 82F25A8
|
||||
.4byte 8, 0
|
||||
.4byte 3, 0
|
||||
.4byte 2, 16
|
||||
.4byte 4, 0
|
||||
|
||||
.align 2
|
||||
gUnknown_082F25C8:: @ 82F25C8
|
||||
.4byte 20, 0
|
||||
.4byte 1, 10
|
||||
|
||||
.align 2
|
||||
gUnknown_082F25D8:: @ 82F25D8
|
||||
.4byte 20, 0
|
||||
.4byte 1, 11
|
||||
|
||||
.align 2
|
||||
gUnknown_082F25E8:: @ 82F25E8
|
||||
.4byte 20, 0
|
||||
.4byte 1, 0
|
||||
|
||||
.align 2
|
||||
gUnknown_082F25F8:: @ 82F25F8
|
||||
.4byte 2, 22
|
||||
.4byte 10, 0
|
||||
.4byte 2, 25
|
||||
.4byte 17, 0
|
||||
.4byte 20, 0
|
||||
.4byte 1, 2
|
||||
|
||||
.align 2
|
||||
gUnknown_082F2628:: @ 82F2628
|
||||
.4byte 2, 23
|
||||
.4byte 9, 0
|
||||
.4byte 3, 0
|
||||
.4byte 2, 16
|
||||
.4byte 4, 0
|
||||
|
||||
.align 2
|
||||
gUnknown_082F2650:: @ 82F2650
|
||||
.4byte 20, 0
|
||||
.4byte 1, 7
|
||||
|
||||
.align 2
|
||||
gUnknown_082F2660:: @ 82F2660
|
||||
.4byte 20, 0
|
||||
.4byte 1, 3
|
||||
|
||||
.align 2
|
||||
gUnknown_082F2670:: @ 82F2670
|
||||
.4byte 13, 0
|
||||
.4byte 14, 0
|
||||
.4byte 3, 0
|
||||
.4byte 2, 16
|
||||
.4byte 4, 0
|
||||
|
||||
.align 2
|
||||
gUnknown_082F2698:: @ 82F2698
|
||||
.4byte 20, 0
|
||||
.4byte 1, 9
|
||||
|
||||
.align 2
|
||||
gUnknown_082F26A8:: @ 82F26A8
|
||||
.4byte 20, 0
|
||||
.4byte 1, 5
|
||||
|
||||
.align 2
|
||||
gUnknown_082F26B8:: @ 82F26B8
|
||||
.4byte 2, 21
|
||||
.4byte 12, 0
|
||||
.4byte 20, 0
|
||||
.4byte 1, 14
|
||||
.4byte 2, 21
|
||||
.4byte 12, 0
|
||||
.4byte 20, 0
|
||||
.4byte 1, 13
|
||||
|
||||
.align 2
|
||||
gUnknown_082F26F8:: @ 82F26F8
|
||||
.4byte 18, 0x10, gUnknown_082F25C8
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x14, NULL
|
||||
.4byte 0, 0x0a, NULL
|
||||
.4byte 18, 0x10, gUnknown_082F25D8
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x14, NULL
|
||||
.4byte 0, 0x0b, NULL
|
||||
.4byte 18, 0x10, gUnknown_082F2698
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x14, NULL
|
||||
.4byte 0, 0x09, NULL
|
||||
|
||||
.align 2
|
||||
gUnknown_082F2788:: @ 82F2788
|
||||
.4byte 18, 0x20, gUnknown_082F26B8
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 20, 0x1b, gText_CanceledReadingCard
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x14, NULL
|
||||
.4byte 0, 0x09, NULL
|
||||
|
||||
.align 2
|
||||
gUnknown_082F27D0:: @ 82F27D0
|
||||
.4byte 18, 0x10, gUnknown_082F2650
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x14, NULL
|
||||
.4byte 0, 0x07, NULL
|
||||
|
||||
.align 2
|
||||
gUnknown_082F2800:: @ 82F2800
|
||||
.4byte 18, 0x28, gUnknown_082F2628
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 14, 0x00, NULL
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x13, NULL
|
||||
.4byte 8, 0x00, NULL
|
||||
.4byte 4, 0x01, gUnknown_082F27D0
|
||||
.4byte 18, 0x10, gUnknown_082F2660
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x14, NULL
|
||||
.4byte 0, 0x03, NULL
|
||||
|
||||
.align 2
|
||||
gUnknown_082F2884:: @ 82F2884
|
||||
.4byte 18, 0x30, gUnknown_082F25F8
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 13, 0x00, NULL
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 15, 0x00, NULL
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x14, NULL
|
||||
.4byte 0, 0x02, NULL
|
||||
|
||||
.align 2
|
||||
gUnknown_082F28E4:: @ 82F28E4
|
||||
.4byte 18, 0x28, gUnknown_082F2670
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x13, NULL
|
||||
.4byte 8, 0x00, NULL
|
||||
.4byte 4, 0x00, gUnknown_082F2884
|
||||
.4byte 3, 0x00, gUnknown_082F2788
|
||||
|
||||
.align 2
|
||||
gUnknown_082F292C:: @ 82F292C
|
||||
.4byte 18, 0x10, gUnknown_082F26A8
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x14, NULL
|
||||
.4byte 0, 0x05, NULL
|
||||
.4byte 18, 0x10, gUnknown_082F25E8
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x14, NULL
|
||||
.4byte 0, 0x00, NULL
|
||||
|
||||
.align 2
|
||||
s_mevent_wonder_news:: @ 82F298C
|
||||
.4byte 27, 0x00, NULL
|
||||
.4byte 18, 0x20, gUnknown_082F25A8
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x11, NULL
|
||||
.4byte 5, 0x00, NULL
|
||||
.4byte 30, 0x00, NULL
|
||||
.4byte 4, 0x00, gUnknown_082F26F8
|
||||
.4byte 3, 0x00, gUnknown_082F2800
|
||||
|
||||
.align 2
|
||||
s_mevent_wonder_card:: @ 82F29EC
|
||||
.4byte 26, 0x00, NULL
|
||||
.4byte 28, 0x00, NULL
|
||||
.4byte 18, 0x20, gUnknown_082F25A8
|
||||
.4byte 1, 0x00, NULL
|
||||
.4byte 2, 0x11, NULL
|
||||
.4byte 5, 0x00, NULL
|
||||
.4byte 6, 0x00, NULL
|
||||
.4byte 4, 0x00, gUnknown_082F26F8
|
||||
.4byte 7, 0x00, NULL
|
||||
.4byte 4, 0x02, gUnknown_082F28E4
|
||||
.4byte 4, 0x00, gUnknown_082F2884
|
||||
.4byte 3, 0x00, gUnknown_082F292C
|
|
@ -52,8 +52,8 @@ bool32 CheckReceivedGiftFromWonderCard(void);
|
|||
bool32 sub_801B508(const u16 *data);
|
||||
void sub_801B580(struct MEventStruct_Unk1442CC *data, bool32 a1);
|
||||
bool32 sub_801B6A0(const struct MEventStruct_Unk1442CC *data, bool32 a1);
|
||||
u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused);
|
||||
u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused);
|
||||
u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused);
|
||||
u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused);
|
||||
bool32 sub_801B748(const struct MEventStruct_Unk1442CC *a0, const u16 *a1);
|
||||
u16 sub_801B784(const struct MEventStruct_Unk1442CC *a0, u32 command);
|
||||
u16 mevent_081445C0(u32 command);
|
||||
|
|
|
@ -7,7 +7,7 @@ struct mevent_cmd
|
|||
{
|
||||
u32 instr;
|
||||
bool32 flag;
|
||||
void * parameter;
|
||||
const void * parameter;
|
||||
};
|
||||
|
||||
struct mevent_srv_common
|
||||
|
@ -21,9 +21,9 @@ struct mevent_srv_common
|
|||
struct MEventBuffer_32E0_Sub * mevent_32e0;
|
||||
struct MEventBuffer_3120_Sub * mevent_3120;
|
||||
struct MEventStruct_Unk1442CC * mevent_unk1442cc;
|
||||
void * sendBuffer1;
|
||||
const void * sendBuffer1;
|
||||
u32 sendBuffer1Size;
|
||||
void * sendBuffer2;
|
||||
const void * sendBuffer2;
|
||||
u32 sendBuffer2Size;
|
||||
u32 sendWord;
|
||||
struct mevent_srv_sub manager;
|
||||
|
|
|
@ -418,8 +418,7 @@ SECTIONS {
|
|||
src/mevent_801BAAC.o(.rodata);
|
||||
src/mevent_server.o(.rodata);
|
||||
src/mevent_server_ish.o(.rodata);
|
||||
src/mevent_server_helpers.o(.rodata);
|
||||
data/mevent_server.o(.rodata);
|
||||
src/mevent_scripts.o(.rodata);
|
||||
src/union_room_chat.o(.rodata);
|
||||
data/union_room_chat.o(.rodata);
|
||||
data/berry_crush.o(.rodata);
|
||||
|
|
|
@ -399,7 +399,7 @@ bool32 sub_801B6A0(const struct MEventStruct_Unk1442CC *data, bool32 a1)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused)
|
||||
u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused)
|
||||
{
|
||||
if (a1->unk_14 == 0)
|
||||
return 0;
|
||||
|
@ -410,7 +410,7 @@ u32 sub_801B6EC(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *un
|
|||
return 2;
|
||||
}
|
||||
|
||||
u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, void *unused)
|
||||
u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const void *unused)
|
||||
{
|
||||
int r4 = a1->unk_44 - sub_801B438(&a1->unk_20, a1->unk_44);
|
||||
if (r4 == 0)
|
||||
|
|
|
@ -0,0 +1,191 @@
|
|||
#include "global.h"
|
||||
#include "mevent_server_ish.h"
|
||||
#include "mevent_server.h"
|
||||
|
||||
const u8 gText_CanceledReadingCard[] = _("Canceled reading\nthe Card.");
|
||||
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F2598[] = {
|
||||
{ 2, 16},
|
||||
{ 4, 0}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F25A8[] = {
|
||||
{ 8, 0},
|
||||
{ 3, 0},
|
||||
{ 2, 16},
|
||||
{ 4, 0}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F25C8[] = {
|
||||
{20, 0},
|
||||
{ 1, 10}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F25D8[] = {
|
||||
{20, 0},
|
||||
{ 1, 11}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F25E8[] = {
|
||||
{20, 0},
|
||||
{ 1, 0}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F25F8[] = {
|
||||
{ 2, 22},
|
||||
{10, 0},
|
||||
{ 2, 25},
|
||||
{17, 0},
|
||||
{20, 0},
|
||||
{ 1, 2}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F2628[] = {
|
||||
{ 2, 23},
|
||||
{ 9, 0},
|
||||
{ 3, 0},
|
||||
{ 2, 16},
|
||||
{ 4, 0}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F2650[] = {
|
||||
{20, 0},
|
||||
{ 1, 7}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F2660[] = {
|
||||
{20, 0},
|
||||
{ 1, 3}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F2670[] = {
|
||||
{13, 0},
|
||||
{14, 0},
|
||||
{ 3, 0},
|
||||
{ 2, 16},
|
||||
{ 4, 0}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F2698[] = {
|
||||
{20, 0},
|
||||
{ 1, 9}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F26A8[] = {
|
||||
{20, 0},
|
||||
{ 1, 5}
|
||||
};
|
||||
|
||||
const struct mevent_cmd_ish gUnknown_082F26B8[] = {
|
||||
{ 2, 21},
|
||||
{12, 0},
|
||||
{20, 0},
|
||||
{ 1, 14},
|
||||
{ 2, 21},
|
||||
{12, 0},
|
||||
{20, 0},
|
||||
{ 1, 13}
|
||||
};
|
||||
|
||||
const struct mevent_cmd gUnknown_082F26F8[] = {
|
||||
{18, 0x10, gUnknown_082F25C8},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x14, NULL},
|
||||
{ 0, 0x0a, NULL},
|
||||
{18, 0x10, gUnknown_082F25D8},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x14, NULL},
|
||||
{ 0, 0x0b, NULL},
|
||||
{18, 0x10, gUnknown_082F2698},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x14, NULL},
|
||||
{ 0, 0x09, NULL}
|
||||
};
|
||||
|
||||
const struct mevent_cmd gUnknown_082F2788[] = {
|
||||
{18, 0x20, gUnknown_082F26B8},
|
||||
{ 1, 0x00, NULL},
|
||||
{20, 0x1b, gText_CanceledReadingCard},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x14, NULL},
|
||||
{ 0, 0x09, NULL}
|
||||
};
|
||||
|
||||
const struct mevent_cmd gUnknown_082F27D0[] = {
|
||||
{18, 0x10, gUnknown_082F2650},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x14, NULL},
|
||||
{ 0, 0x07, NULL}
|
||||
};
|
||||
|
||||
const struct mevent_cmd gUnknown_082F2800[] = {
|
||||
{18, 0x28, gUnknown_082F2628},
|
||||
{ 1, 0x00, NULL},
|
||||
{14, 0x00, NULL},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x13, NULL},
|
||||
{ 8, 0x00, NULL},
|
||||
{ 4, 0x01, gUnknown_082F27D0},
|
||||
{18, 0x10, gUnknown_082F2660},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x14, NULL},
|
||||
{ 0, 0x03, NULL}
|
||||
};
|
||||
|
||||
const struct mevent_cmd gUnknown_082F2884[] = {
|
||||
{18, 0x30, gUnknown_082F25F8},
|
||||
{ 1, 0x00, NULL},
|
||||
{13, 0x00, NULL},
|
||||
{ 1, 0x00, NULL},
|
||||
{15, 0x00, NULL},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x14, NULL},
|
||||
{ 0, 0x02, NULL}
|
||||
};
|
||||
|
||||
const struct mevent_cmd gUnknown_082F28E4[] = {
|
||||
{18, 0x28, gUnknown_082F2670},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x13, NULL},
|
||||
{ 8, 0x00, NULL},
|
||||
{ 4, 0x00, gUnknown_082F2884},
|
||||
{ 3, 0x00, gUnknown_082F2788}
|
||||
};
|
||||
|
||||
const struct mevent_cmd gUnknown_082F292C[] = {
|
||||
{18, 0x10, gUnknown_082F26A8},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x14, NULL},
|
||||
{ 0, 0x05, NULL},
|
||||
{18, 0x10, gUnknown_082F25E8},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x14, NULL},
|
||||
{ 0, 0x00, NULL}
|
||||
};
|
||||
|
||||
const struct mevent_cmd s_mevent_wonder_news[] = {
|
||||
{27, 0x00, NULL},
|
||||
{18, 0x20, gUnknown_082F25A8},
|
||||
{ 1, 0x00, NULL},
|
||||
{ 2, 0x11, NULL},
|
||||
{ 5, 0x00, NULL},
|
||||
{30, 0x00, NULL},
|
||||
{ 4, 0x00, gUnknown_082F26F8},
|
||||
{ 3, 0x00, gUnknown_082F2800}
|
||||
};
|
||||
|
||||
const struct mevent_cmd s_mevent_wonder_card[] = {
|
||||
{26, 0x00, NULL},
|
||||
{28, 0x00, NULL},
|
||||
{18, 0x20, gUnknown_082F25A8},
|
||||
{1, 0x00, NULL},
|
||||
{2, 0x11, NULL},
|
||||
{5, 0x00, NULL},
|
||||
{6, 0x00, NULL},
|
||||
{4, 0x00, gUnknown_082F26F8},
|
||||
{7, 0x00, NULL},
|
||||
{4, 0x02, gUnknown_082F28E4},
|
||||
{4, 0x00, gUnknown_082F2884},
|
||||
{3, 0x00, gUnknown_082F292C},
|
||||
};
|
|
@ -69,7 +69,7 @@ void mevent_srv_common_init_send(struct mevent_srv_common * svr, u32 ident, cons
|
|||
mevent_srv_sub_init_send(&svr->manager, ident, src, size);
|
||||
}
|
||||
|
||||
static void * mevent_first_if_not_null_else_second(void * a0, void * a1)
|
||||
static const void * mevent_first_if_not_null_else_second(const void * a0, const void * a1)
|
||||
{
|
||||
if (a0 != NULL)
|
||||
return a0;
|
||||
|
@ -77,7 +77,7 @@ static void * mevent_first_if_not_null_else_second(void * a0, void * a1)
|
|||
return a1;
|
||||
}
|
||||
|
||||
static u32 mevent_compare_pointers(void * a0, void * a1)
|
||||
static u32 mevent_compare_pointers(const void * a0, const void * a1)
|
||||
{
|
||||
if (a1 < a0)
|
||||
return 0;
|
||||
|
@ -120,45 +120,53 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr)
|
|||
{
|
||||
// process command
|
||||
const struct mevent_cmd * cmd = &svr->cmdBuffer[svr->cmdidx];
|
||||
void * ptr;
|
||||
const void * ptr;
|
||||
svr->cmdidx++;
|
||||
|
||||
switch (cmd->instr)
|
||||
{
|
||||
case 0:
|
||||
// end
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
svr->mainseqno = 1;
|
||||
svr->param = cmd->flag;
|
||||
break;
|
||||
case 1:
|
||||
// wait_send
|
||||
svr->mainseqno = 3;
|
||||
break;
|
||||
case 2:
|
||||
// receive
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
mevent_srv_sub_init_recv(&svr->manager, cmd->flag, svr->recvBuffer);
|
||||
svr->mainseqno = 2;
|
||||
break;
|
||||
case 3:
|
||||
// jump
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
svr->cmdidx = 0;
|
||||
svr->cmdBuffer = cmd->parameter;
|
||||
break;
|
||||
case 5:
|
||||
// get_1442CC
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
memcpy(svr->mevent_unk1442cc, svr->recvBuffer, sizeof(struct MEventStruct_Unk1442CC));
|
||||
break;
|
||||
case 6:
|
||||
// check_header__pass_false
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
svr->param = sub_801B6A0(svr->mevent_unk1442cc, FALSE);
|
||||
break;
|
||||
case 30:
|
||||
// check_header__pass_true
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
svr->param = sub_801B6A0(svr->mevent_unk1442cc, TRUE);
|
||||
break;
|
||||
case 4:
|
||||
// jump_if_eq
|
||||
if (svr->param == cmd->flag)
|
||||
{
|
||||
svr->cmdidx = 0;
|
||||
|
@ -166,11 +174,13 @@ static u32 common_mainseq_4(struct mevent_srv_common * svr)
|
|||
}
|
||||
break;
|
||||
case 7:
|
||||
// check_crc
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
ptr = mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0);
|
||||
svr->param = sub_801B6EC(ptr, svr->mevent_unk1442cc, ptr);
|
||||
break;
|
||||
case 8:
|
||||
// read_word
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
svr->param = *(u32 *)svr->recvBuffer;
|
||||
|
|
Loading…
Reference in New Issue