Port mevent scripts to C

This commit is contained in:
PikalaxALT
2019-11-11 11:09:24 -05:00
parent 012477cc5a
commit e560b55325
8 changed files with 383 additions and 145 deletions
-12
View File
@@ -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"
+88 -77
View File
@@ -1,87 +1,98 @@
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)
const struct mevent_server_cmd gMEventSrvScript_UnableToSend[] = {
SRV_SEND(0x10, gMEventClientScript_UnableToRecv),
SRV_WAITSND,
SRV_RECV(0x14),
SRV_RETURN(0x0a)
};
.4byte 0x12, 0x10, gMEventClientScript_CommError @ SEND
.4byte 0x01, 0x00, NULL @ WAIT SEND
.4byte 0x02, 0x14, NULL @ RECV
.4byte 0x00, 0x0b, NULL @ RETURN (comm error)
SRV_SEND(0x10, gMEventClientScript_CommError),
SRV_WAITSND,
SRV_RECV(0x14),
SRV_RETURN(0x0b)
};
.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)
SRV_SEND(0x10, gMEventClientScript_OtherTrainerCanceled),
SRV_WAITSND,
SRV_RECV(0x14),
SRV_RETURN(0x09)
};
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)
const struct mevent_server_cmd gMEventSrvScript_OtherTrnHasNews[] = {
SRV_SEND(0x10, gMEventClientScript_AlreadyHadNews),
SRV_WAITSND,
SRV_RECV(0x14),
SRV_RETURN(0x07)
};
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)
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)
};
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)
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)
};
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
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)
};
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)
const struct mevent_server_cmd gMEventSrvScript_OtherTrnHasCard[] = {
SRV_SEND(0x10, gMEventClientScript_AlreadyHadCard),
SRV_WAITSND,
SRV_RECV(0x14),
SRV_RETURN(0x05)
};
.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)
SRV_SEND(0x10, gMEventClientScript_NothingSentOver),
SRV_WAITSND,
SRV_RECV(0x14),
SRV_RETURN(0x00)
};
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
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)
};
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
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)
};
+65 -53
View File
@@ -1,65 +1,77 @@
gMEventClientScript_InotialListen:: @ 84687E0
.4byte 0x02, 0x10 @ RECEIVE ID(0x10)
.4byte 0x04, 0x00 @ JUMP TO RECEIVE BUFFER
const struct mevent_client_cmd gMEventClientScript_InitialListen[] = { // 84687E0
CLI_RECEIVE(0x10),
CLI_JUMPBUF
};
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
const struct mevent_client_cmd gMEventClientScript_Send1442CC[] = {
CLI_SNDHEAD,
CLI_WAITSND,
CLI_RECEIVE(0x10),
CLI_JUMPBUF
};
gMEventClientScript_UnableToRecv:: @ can't accept card or news
.4byte 0x14, 0x00 @ SEND ALL
.4byte 0x01, 0x0a @ RETURN 0x0a
const struct mevent_client_cmd gMEventClientScript_UnableToRecv[] = { // can't accept card or news
CLI_SENDALL,
CLI_RETURN(0x0a)
};
gMEventClientScript_CommError:: @ comm error
.4byte 0x14, 0x00 @ SEND ALL
.4byte 0x01, 0x0b @ RETURN 0x0b
const struct mevent_client_cmd gMEventClientScript_CommError[] = { // comm error
CLI_SENDALL,
CLI_RETURN(0x0b)
};
gMEventClientScript_NothingSentOver:: @ nothing sent
.4byte 0x14, 0x00 @ SEND ALL
.4byte 0x01, 0x00 @ RETURN 0x00
const struct mevent_client_cmd gMEventClientScript_NothingSentOver[] = { // nothing sent
CLI_SENDALL,
CLI_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
const struct mevent_client_cmd gMEventClientScript_ReceiveCardAndReturnSuccess[] = { // card success
CLI_RECEIVE(0x16),
CLI_RECVSAV,
CLI_RECEIVE(0x19),
CLI_RECVRAM,
CLI_SENDALL,
CLI_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
const struct mevent_client_cmd gMEventClientScript_ReceiveNewsAndValidate[] = {
CLI_RECEIVE(0x17),
CLI_VLDNEWS,
CLI_WAITSND,
CLI_RECEIVE(0x10),
CLI_JUMPBUF
};
gMEventClientScript_AlreadyHadNews:: @ already had news
.4byte 0x14, 0x00 @ SEND ALL
.4byte 0x01, 0x07 @ RETURN 0x07
const struct mevent_client_cmd gMEventClientScript_AlreadyHadNews[] = { // already had news
CLI_SENDALL,
CLI_RETURN(0x07)
};
gMEventClientScript_RecvNewsSuccess:: @ news success
.4byte 0x14, 0x00 @ SEND ALL
.4byte 0x01, 0x03 @ RETURN 0x03
const struct mevent_client_cmd gMEventClientScript_RecvNewsSuccess[] = { // news success
CLI_SENDALL,
CLI_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
const struct mevent_client_cmd gMEventClientScript_AskWouldLikeToTossCard[] = {
CLI_REQWORD,
CLI_SNDWORD,
CLI_WAITSND,
CLI_RECEIVE(0x10),
CLI_JUMPBUF
};
gMEventClientScript_OtherTrainerCanceled:: @ comm canceled
.4byte 0x14, 0x00 @ SEND ALL
.4byte 0x01, 0x09 @ RETURN 0x09
const struct mevent_client_cmd gMEventClientScript_OtherTrainerCanceled[] = { // comm canceled
CLI_SENDALL,
CLI_RETURN(0x09)
};
gMEventClientScript_AlreadyHadCard:: @ already had card
.4byte 0x14, 0x00 @ SEND ALL
.4byte 0x01, 0x05 @ RETURN 0x05
const struct mevent_client_cmd gMEventClientScript_AlreadyHadCard[] = { // already had card
CLI_SENDALL,
CLI_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
const struct mevent_client_cmd gMEventClientScript_SuccessFromBuffer[] = { // success from buffer
CLI_RECEIVE(0x15),
CLI_RECVBUF,
CLI_SENDALL,
CLI_RETURN(0x0d)
+3
View File
@@ -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
+32
View File
@@ -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;
+1 -1
View File
@@ -536,7 +536,7 @@ 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);
+2 -2
View File
@@ -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;
+192
View File
@@ -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)
};