Decompile mevent server scripts
This commit is contained in:
@@ -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)
|
||||
|
||||
191
src/mevent_scripts.c
Normal file
191
src/mevent_scripts.c
Normal file
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user