mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 15:13:42 +01:00
finish mevent_server.s
This commit is contained in:
parent
a455d98385
commit
dabd1f6177
@ -1,425 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start mevent_srv_free_resources
|
||||
mevent_srv_free_resources: @ 801D158
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
ldr r0, [r4, 0x18]
|
||||
bl Free
|
||||
ldr r0, [r4, 0x1C]
|
||||
bl Free
|
||||
ldr r0, [r4, 0x14]
|
||||
bl Free
|
||||
ldr r0, [r4, 0x20]
|
||||
bl Free
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end mevent_srv_free_resources
|
||||
|
||||
thumb_func_start mevent_srv_814501C
|
||||
mevent_srv_814501C: @ 801D17C
|
||||
push {lr}
|
||||
adds r0, 0x38
|
||||
bl sub_801D904
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end mevent_srv_814501C
|
||||
|
||||
thumb_func_start sub_801D188
|
||||
sub_801D188: @ 801D188
|
||||
push {lr}
|
||||
cmp r0, 0
|
||||
bne _0801D190
|
||||
adds r0, r1, 0
|
||||
_0801D190:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801D188
|
||||
|
||||
thumb_func_start sub_801D194
|
||||
sub_801D194: @ 801D194
|
||||
push {lr}
|
||||
cmp r1, r0
|
||||
bcs _0801D19E
|
||||
movs r0, 0
|
||||
b _0801D1A8
|
||||
_0801D19E:
|
||||
cmp r1, r0
|
||||
beq _0801D1A6
|
||||
movs r0, 0x2
|
||||
b _0801D1A8
|
||||
_0801D1A6:
|
||||
movs r0, 0x1
|
||||
_0801D1A8:
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801D194
|
||||
|
||||
thumb_func_start sub_801D1AC
|
||||
sub_801D1AC: @ 801D1AC
|
||||
movs r1, 0x4
|
||||
str r1, [r0, 0x8]
|
||||
movs r0, 0
|
||||
bx lr
|
||||
thumb_func_end sub_801D1AC
|
||||
|
||||
thumb_func_start sub_801D1B4
|
||||
sub_801D1B4: @ 801D1B4
|
||||
movs r0, 0x3
|
||||
bx lr
|
||||
thumb_func_end sub_801D1B4
|
||||
|
||||
thumb_func_start sub_801D1B8
|
||||
sub_801D1B8: @ 801D1B8
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
adds r0, 0x38
|
||||
bl sub_801D8C0
|
||||
cmp r0, 0
|
||||
beq _0801D1CA
|
||||
movs r0, 0x4
|
||||
str r0, [r4, 0x8]
|
||||
_0801D1CA:
|
||||
movs r0, 0x1
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801D1B8
|
||||
|
||||
thumb_func_start sub_801D1D4
|
||||
sub_801D1D4: @ 801D1D4
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
adds r0, 0x38
|
||||
bl sub_801D8CC
|
||||
cmp r0, 0
|
||||
beq _0801D1E6
|
||||
movs r0, 0x4
|
||||
str r0, [r4, 0x8]
|
||||
_0801D1E6:
|
||||
movs r0, 0x1
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801D1D4
|
||||
|
||||
thumb_func_start sub_801D1F0
|
||||
sub_801D1F0: @ 801D1F0
|
||||
push {r4,r5,lr}
|
||||
adds r5, r0, 0
|
||||
ldr r0, [r5, 0xC]
|
||||
lsls r1, r0, 1
|
||||
adds r1, r0
|
||||
lsls r1, 2
|
||||
ldr r2, [r5, 0x10]
|
||||
adds r3, r2, r1
|
||||
adds r0, 0x1
|
||||
str r0, [r5, 0xC]
|
||||
ldr r0, [r3]
|
||||
cmp r0, 0x1E
|
||||
bls _0801D20C
|
||||
b _0801D464
|
||||
_0801D20C:
|
||||
lsls r0, 2
|
||||
ldr r1, =_0801D21C
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_0801D21C:
|
||||
.4byte _0801D298
|
||||
.4byte _0801D2A2
|
||||
.4byte _0801D2A8
|
||||
.4byte _0801D2E2
|
||||
.4byte _0801D2D8
|
||||
.4byte _0801D2BA
|
||||
.4byte _0801D2C6
|
||||
.4byte _0801D2EC
|
||||
.4byte _0801D300
|
||||
.4byte _0801D308
|
||||
.4byte _0801D31E
|
||||
.4byte _0801D32E
|
||||
.4byte _0801D33A
|
||||
.4byte _0801D360
|
||||
.4byte _0801D348
|
||||
.4byte _0801D390
|
||||
.4byte _0801D378
|
||||
.4byte _0801D3DC
|
||||
.4byte _0801D3A8
|
||||
.4byte _0801D3C0
|
||||
.4byte _0801D3CE
|
||||
.4byte _0801D406
|
||||
.4byte _0801D3EA
|
||||
.4byte _0801D3F8
|
||||
.4byte _0801D40E
|
||||
.4byte _0801D418
|
||||
.4byte _0801D422
|
||||
.4byte _0801D43C
|
||||
.4byte _0801D450
|
||||
.4byte _0801D458
|
||||
.4byte _0801D2CC
|
||||
_0801D298:
|
||||
movs r0, 0x1
|
||||
str r0, [r5, 0x8]
|
||||
ldr r0, [r3, 0x4]
|
||||
str r0, [r5, 0x4]
|
||||
b _0801D464
|
||||
_0801D2A2:
|
||||
movs r0, 0x3
|
||||
str r0, [r5, 0x8]
|
||||
b _0801D464
|
||||
_0801D2A8:
|
||||
adds r0, r5, 0
|
||||
adds r0, 0x38
|
||||
ldr r1, [r3, 0x4]
|
||||
ldr r2, [r5, 0x14]
|
||||
bl sub_801D928
|
||||
movs r0, 0x2
|
||||
str r0, [r5, 0x8]
|
||||
b _0801D464
|
||||
_0801D2BA:
|
||||
ldr r0, [r5, 0x20]
|
||||
ldr r1, [r5, 0x14]
|
||||
movs r2, 0x64
|
||||
bl memcpy
|
||||
b _0801D464
|
||||
_0801D2C6:
|
||||
ldr r0, [r5, 0x20]
|
||||
movs r1, 0
|
||||
b _0801D2D0
|
||||
_0801D2CC:
|
||||
ldr r0, [r5, 0x20]
|
||||
movs r1, 0x1
|
||||
_0801D2D0:
|
||||
bl sub_801B6A0
|
||||
str r0, [r5, 0x4]
|
||||
b _0801D464
|
||||
_0801D2D8:
|
||||
ldr r1, [r5, 0x4]
|
||||
ldr r0, [r3, 0x4]
|
||||
cmp r1, r0
|
||||
beq _0801D2E2
|
||||
b _0801D464
|
||||
_0801D2E2:
|
||||
movs r0, 0
|
||||
str r0, [r5, 0xC]
|
||||
ldr r0, [r3, 0x8]
|
||||
str r0, [r5, 0x10]
|
||||
b _0801D464
|
||||
_0801D2EC:
|
||||
ldr r0, [r3, 0x8]
|
||||
ldr r1, [r5, 0x18]
|
||||
bl sub_801D188
|
||||
adds r2, r0, 0
|
||||
ldr r1, [r5, 0x20]
|
||||
bl sub_801B6EC
|
||||
str r0, [r5, 0x4]
|
||||
b _0801D464
|
||||
_0801D300:
|
||||
ldr r0, [r5, 0x14]
|
||||
ldr r0, [r0]
|
||||
str r0, [r5, 0x4]
|
||||
b _0801D464
|
||||
_0801D308:
|
||||
ldr r0, [r3, 0x8]
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x34
|
||||
bl sub_801D188
|
||||
adds r2, r0, 0
|
||||
ldr r1, [r5, 0x20]
|
||||
bl sub_801B708
|
||||
str r0, [r5, 0x4]
|
||||
b _0801D464
|
||||
_0801D31E:
|
||||
ldr r0, [r5, 0x20]
|
||||
ldr r1, [r3, 0x4]
|
||||
bl sub_801B784
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
str r0, [r5, 0x4]
|
||||
b _0801D464
|
||||
_0801D32E:
|
||||
ldr r0, [r5, 0x20]
|
||||
ldr r1, [r3, 0x8]
|
||||
bl sub_801B748
|
||||
str r0, [r5, 0x4]
|
||||
b _0801D464
|
||||
_0801D33A:
|
||||
ldr r0, [r3, 0x8]
|
||||
ldr r1, [r5, 0x14]
|
||||
ldr r1, [r1]
|
||||
bl sub_801D194
|
||||
str r0, [r5, 0x4]
|
||||
b _0801D464
|
||||
_0801D348:
|
||||
ldr r0, [r3, 0x8]
|
||||
ldr r1, [r5, 0x1C]
|
||||
bl sub_801D188
|
||||
adds r2, r0, 0
|
||||
movs r3, 0xDE
|
||||
lsls r3, 1
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x17
|
||||
bl mevent_srv_814501C
|
||||
b _0801D464
|
||||
_0801D360:
|
||||
ldr r0, [r3, 0x8]
|
||||
ldr r1, [r5, 0x18]
|
||||
bl sub_801D188
|
||||
adds r2, r0, 0
|
||||
movs r3, 0xA6
|
||||
lsls r3, 1
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x16
|
||||
bl mevent_srv_814501C
|
||||
b _0801D464
|
||||
_0801D378:
|
||||
ldr r0, [r3, 0x8]
|
||||
adds r1, r5, 0
|
||||
adds r1, 0x34
|
||||
bl sub_801D188
|
||||
adds r2, r0, 0
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x18
|
||||
movs r3, 0x4
|
||||
bl mevent_srv_814501C
|
||||
b _0801D464
|
||||
_0801D390:
|
||||
ldr r2, [r3, 0x8]
|
||||
cmp r2, 0
|
||||
bne _0801D39C
|
||||
ldr r2, [r5, 0x24]
|
||||
ldr r3, [r5, 0x28]
|
||||
b _0801D39E
|
||||
_0801D39C:
|
||||
ldr r3, [r3, 0x4]
|
||||
_0801D39E:
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x19
|
||||
bl mevent_srv_814501C
|
||||
b _0801D464
|
||||
_0801D3A8:
|
||||
ldr r2, [r3, 0x8]
|
||||
cmp r2, 0
|
||||
bne _0801D3B4
|
||||
ldr r2, [r5, 0x2C]
|
||||
ldr r3, [r5, 0x30]
|
||||
b _0801D3B6
|
||||
_0801D3B4:
|
||||
ldr r3, [r3, 0x4]
|
||||
_0801D3B6:
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x10
|
||||
bl mevent_srv_814501C
|
||||
b _0801D464
|
||||
_0801D3C0:
|
||||
ldr r2, [r3, 0x8]
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x1A
|
||||
movs r3, 0xBC
|
||||
bl mevent_srv_814501C
|
||||
b _0801D464
|
||||
_0801D3CE:
|
||||
ldr r2, [r3, 0x8]
|
||||
ldr r3, [r3, 0x4]
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x15
|
||||
bl mevent_srv_814501C
|
||||
b _0801D464
|
||||
_0801D3DC:
|
||||
ldr r2, [r3, 0x8]
|
||||
ldr r3, [r3, 0x4]
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x1C
|
||||
bl mevent_srv_814501C
|
||||
b _0801D464
|
||||
_0801D3EA:
|
||||
ldr r0, [r5, 0x18]
|
||||
ldr r1, [r3, 0x8]
|
||||
movs r2, 0xA6
|
||||
lsls r2, 1
|
||||
bl memcpy
|
||||
b _0801D464
|
||||
_0801D3F8:
|
||||
ldr r0, [r5, 0x1C]
|
||||
ldr r1, [r3, 0x8]
|
||||
movs r2, 0xDE
|
||||
lsls r2, 1
|
||||
bl memcpy
|
||||
b _0801D464
|
||||
_0801D406:
|
||||
ldr r0, [r3, 0x8]
|
||||
ldr r0, [r0]
|
||||
str r0, [r5, 0x34]
|
||||
b _0801D464
|
||||
_0801D40E:
|
||||
ldr r0, [r3, 0x8]
|
||||
str r0, [r5, 0x24]
|
||||
ldr r0, [r3, 0x4]
|
||||
str r0, [r5, 0x28]
|
||||
b _0801D464
|
||||
_0801D418:
|
||||
ldr r0, [r3, 0x8]
|
||||
str r0, [r5, 0x2C]
|
||||
ldr r0, [r3, 0x4]
|
||||
str r0, [r5, 0x30]
|
||||
b _0801D464
|
||||
_0801D422:
|
||||
ldr r4, [r5, 0x18]
|
||||
bl sav1_get_mevent_buffer_1
|
||||
adds r1, r0, 0
|
||||
movs r2, 0xA6
|
||||
lsls r2, 1
|
||||
adds r0, r4, 0
|
||||
bl memcpy
|
||||
ldr r0, [r5, 0x18]
|
||||
bl sub_801B3C0
|
||||
b _0801D464
|
||||
_0801D43C:
|
||||
ldr r4, [r5, 0x1C]
|
||||
bl sav1_get_mevent_buffer_0
|
||||
adds r1, r0, 0
|
||||
movs r2, 0xDE
|
||||
lsls r2, 1
|
||||
adds r0, r4, 0
|
||||
bl memcpy
|
||||
b _0801D464
|
||||
_0801D450:
|
||||
bl sub_8099244
|
||||
str r0, [r5, 0x24]
|
||||
b _0801D464
|
||||
_0801D458:
|
||||
ldr r2, [r3, 0x8]
|
||||
ldr r3, [r3, 0x4]
|
||||
adds r0, r5, 0
|
||||
movs r1, 0x1B
|
||||
bl mevent_srv_814501C
|
||||
_0801D464:
|
||||
movs r0, 0x1
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801D1F0
|
||||
|
||||
thumb_func_start mevent_srv_exec_common
|
||||
mevent_srv_exec_common: @ 801D46C
|
||||
push {lr}
|
||||
ldr r2, =gUnknown_082F2548
|
||||
ldr r1, [r0, 0x8]
|
||||
lsls r1, 2
|
||||
adds r1, r2
|
||||
ldr r1, [r1]
|
||||
bl _call_via_r1
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end mevent_srv_exec_common
|
||||
|
||||
.align 2, 0 @ don't pad with nop
|
@ -5,23 +5,23 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_801D8C0
|
||||
sub_801D8C0: @ 801D8C0
|
||||
thumb_func_start mevent_srv_sub_recv
|
||||
mevent_srv_sub_recv: @ 801D8C0
|
||||
push {lr}
|
||||
ldr r1, [r0, 0x20]
|
||||
bl _call_via_r1
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801D8C0
|
||||
thumb_func_end mevent_srv_sub_recv
|
||||
|
||||
thumb_func_start sub_801D8CC
|
||||
sub_801D8CC: @ 801D8CC
|
||||
thumb_func_start mevent_srv_sub_send
|
||||
mevent_srv_sub_send: @ 801D8CC
|
||||
push {lr}
|
||||
ldr r1, [r0, 0x24]
|
||||
bl _call_via_r1
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_801D8CC
|
||||
thumb_func_end mevent_srv_sub_send
|
||||
|
||||
thumb_func_start mevent_srv_sub_init
|
||||
mevent_srv_sub_init: @ 801D8D8
|
||||
@ -45,8 +45,8 @@ mevent_srv_sub_init: @ 801D8D8
|
||||
.pool
|
||||
thumb_func_end mevent_srv_sub_init
|
||||
|
||||
thumb_func_start sub_801D904
|
||||
sub_801D904: @ 801D904
|
||||
thumb_func_start mevent_srv_sub_init_send
|
||||
mevent_srv_sub_init_send: @ 801D904
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
movs r0, 0
|
||||
@ -67,10 +67,10 @@ _0801D920:
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_801D904
|
||||
thumb_func_end mevent_srv_sub_init_send
|
||||
|
||||
thumb_func_start sub_801D928
|
||||
sub_801D928: @ 801D928
|
||||
thumb_func_start mevent_srv_sub_init_recv
|
||||
mevent_srv_sub_init_recv: @ 801D928
|
||||
movs r3, 0
|
||||
str r3, [r0]
|
||||
strh r1, [r0, 0x6]
|
||||
@ -79,7 +79,7 @@ sub_801D928: @ 801D928
|
||||
strh r3, [r0, 0xC]
|
||||
str r2, [r0, 0x18]
|
||||
bx lr
|
||||
thumb_func_end sub_801D928
|
||||
thumb_func_end mevent_srv_sub_init_recv
|
||||
|
||||
thumb_func_start sub_801D938
|
||||
sub_801D938: @ 801D938
|
||||
|
@ -175,7 +175,7 @@ sub_801D59C: @ 801D59C
|
||||
adds r0, r4, 0
|
||||
adds r1, r6, 0
|
||||
movs r3, 0x4
|
||||
bl sub_801D904
|
||||
bl mevent_srv_sub_init_send
|
||||
add sp, 0x4
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
@ -215,7 +215,7 @@ sub_801D5FC: @ 801D5FC
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
adds r0, 0x24
|
||||
bl sub_801D8C0
|
||||
bl mevent_srv_sub_recv
|
||||
cmp r0, 0
|
||||
beq _0801D612
|
||||
movs r0, 0x4
|
||||
@ -234,7 +234,7 @@ sub_801D61C: @ 801D61C
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
adds r0, 0x24
|
||||
bl sub_801D8CC
|
||||
bl mevent_srv_sub_send
|
||||
cmp r0, 0
|
||||
beq _0801D632
|
||||
movs r0, 0x4
|
||||
@ -303,7 +303,7 @@ _0801D6C4:
|
||||
adds r0, 0x24
|
||||
ldr r1, [r2, 0x4]
|
||||
ldr r2, [r4, 0x18]
|
||||
bl sub_801D928
|
||||
bl mevent_srv_sub_init_recv
|
||||
movs r0, 0x2
|
||||
b _0801D7FE
|
||||
_0801D6D4:
|
||||
@ -315,7 +315,7 @@ _0801D6D8:
|
||||
ldr r2, [r4, 0x14]
|
||||
movs r1, 0x14
|
||||
movs r3, 0
|
||||
bl sub_801D904
|
||||
bl mevent_srv_sub_init_send
|
||||
movs r0, 0x3
|
||||
b _0801D7FE
|
||||
_0801D6EA:
|
||||
@ -391,7 +391,7 @@ _0801D764:
|
||||
ldr r2, [r4, 0x14]
|
||||
movs r1, 0x11
|
||||
movs r3, 0x64
|
||||
bl sub_801D904
|
||||
bl mevent_srv_sub_init_send
|
||||
b _0801D804
|
||||
_0801D77C:
|
||||
ldr r2, [r4, 0x4]
|
||||
|
@ -3,14 +3,6 @@
|
||||
|
||||
.section .rodata
|
||||
|
||||
.align 2
|
||||
gUnknown_082F2548:: @ 82F2548
|
||||
.4byte sub_801D1AC
|
||||
.4byte sub_801D1B4
|
||||
.4byte sub_801D1B8
|
||||
.4byte sub_801D1D4
|
||||
.4byte sub_801D1F0
|
||||
|
||||
.align 2
|
||||
gUnknown_082F255C:: @ 82F255C
|
||||
.4byte sub_801D5D0
|
||||
|
@ -2,5 +2,9 @@
|
||||
#define GUARD_MEVENT_SERVER_HELPERS_H
|
||||
|
||||
void mevent_srv_sub_init(struct mevent_srv_sub *, u32, u32);
|
||||
void mevent_srv_sub_init_send(struct mevent_srv_sub * manager, u32 ident, const void * src, u32 size);
|
||||
bool32 mevent_srv_sub_recv(struct mevent_srv_sub * manager);
|
||||
bool32 mevent_srv_sub_send(struct mevent_srv_sub * manager);
|
||||
void mevent_srv_sub_init_recv(struct mevent_srv_sub *, u32, void *);
|
||||
|
||||
#endif //GUARD_MEVENT_SERVER_HELPERS_H
|
||||
|
@ -61,7 +61,7 @@ SECTIONS {
|
||||
src/mevent2.o(.text);
|
||||
src/mevent_801BAAC.o(.text);
|
||||
src/mevent_server.o(.text);
|
||||
asm/mevent_server.o(.text);
|
||||
src/mevent_server_ish.o(.text);
|
||||
asm/mevent_server_ish.o(.text);
|
||||
asm/mevent_server_helpers.o(.text);
|
||||
src/mevent_news.o(.text);
|
||||
@ -418,6 +418,8 @@ SECTIONS {
|
||||
src/mevent2.o(.rodata);
|
||||
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/union_room_chat.o(.rodata);
|
||||
data/union_room_chat.o(.rodata);
|
||||
|
@ -1,15 +1,15 @@
|
||||
#include "global.h"
|
||||
#include "alloc.h"
|
||||
#include "script.h"
|
||||
#include "mevent.h"
|
||||
#include "mevent_server.h"
|
||||
#include "mevent_server_helpers.h"
|
||||
|
||||
EWRAM_DATA struct mevent_srv_common * s_mevent_srv_common_ptr = NULL;
|
||||
EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL;
|
||||
|
||||
static void mevent_srv_init_common(struct mevent_srv_common *, const void *, u32, u32);
|
||||
u32 mevent_srv_exec_common(struct mevent_srv_common *);
|
||||
u32 mevent_srv_free_resources(struct mevent_srv_common *);
|
||||
static void mevent_srv_free_resources(struct mevent_srv_common *);
|
||||
static u32 mevent_srv_exec_common(struct mevent_srv_common *);
|
||||
|
||||
extern const struct mevent_cmd s_mevent_wonder_news[];
|
||||
extern const struct mevent_cmd s_mevent_wonder_card[];
|
||||
@ -54,3 +54,232 @@ static void mevent_srv_init_common(struct mevent_srv_common * svr, const void *
|
||||
svr->cmdidx = 0;
|
||||
mevent_srv_sub_init(&svr->manager, sendPlayerNo, recvPlayerNo);
|
||||
}
|
||||
|
||||
static void mevent_srv_free_resources(struct mevent_srv_common * svr)
|
||||
{
|
||||
Free(svr->mevent_32e0);
|
||||
Free(svr->mevent_3120);
|
||||
Free(svr->recvBuffer);
|
||||
Free(svr->mevent_unk1442cc);
|
||||
}
|
||||
|
||||
void mevent_srv_common_init_send(struct mevent_srv_common * svr, u32 ident, const void * src, u32 size)
|
||||
{
|
||||
AGB_ASSERT(size <= ME_SEND_BUF_SIZE);
|
||||
mevent_srv_sub_init_send(&svr->manager, ident, src, size);
|
||||
}
|
||||
|
||||
static void * mevent_first_if_not_null_else_second(void * a0, void * a1)
|
||||
{
|
||||
if (a0 != NULL)
|
||||
return a0;
|
||||
else
|
||||
return a1;
|
||||
}
|
||||
|
||||
static u32 mevent_compare_pointers(void * a0, void * a1)
|
||||
{
|
||||
if (a1 < a0)
|
||||
return 0;
|
||||
else if (a1 == a0)
|
||||
return 1;
|
||||
else
|
||||
return 2;
|
||||
}
|
||||
|
||||
static u32 common_mainseq_0(struct mevent_srv_common * svr)
|
||||
{
|
||||
// start
|
||||
svr->mainseqno = 4;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 common_mainseq_1(struct mevent_srv_common * svr)
|
||||
{
|
||||
// done
|
||||
return 3;
|
||||
}
|
||||
|
||||
static u32 common_mainseq_2(struct mevent_srv_common * svr)
|
||||
{
|
||||
// do recv
|
||||
if (mevent_srv_sub_recv(&svr->manager))
|
||||
svr->mainseqno = 4;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static u32 common_mainseq_3(struct mevent_srv_common * svr)
|
||||
{
|
||||
// do send
|
||||
if (mevent_srv_sub_send(&svr->manager))
|
||||
svr->mainseqno = 4;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static u32 common_mainseq_4(struct mevent_srv_common * svr)
|
||||
{
|
||||
// process command
|
||||
const struct mevent_cmd * cmd = &svr->cmdBuffer[svr->cmdidx];
|
||||
void * ptr;
|
||||
svr->cmdidx++;
|
||||
|
||||
switch (cmd->instr)
|
||||
{
|
||||
case 0:
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
svr->mainseqno = 1;
|
||||
svr->param = cmd->flag;
|
||||
break;
|
||||
case 1:
|
||||
svr->mainseqno = 3;
|
||||
break;
|
||||
case 2:
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
mevent_srv_sub_init_recv(&svr->manager, cmd->flag, svr->recvBuffer);
|
||||
svr->mainseqno = 2;
|
||||
break;
|
||||
case 3:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
svr->cmdidx = 0;
|
||||
svr->cmdBuffer = cmd->parameter;
|
||||
break;
|
||||
case 5:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
memcpy(svr->mevent_unk1442cc, svr->recvBuffer, sizeof(struct MEventStruct_Unk1442CC));
|
||||
break;
|
||||
case 6:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
svr->param = sub_801B6A0(svr->mevent_unk1442cc, FALSE);
|
||||
break;
|
||||
case 30:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
svr->param = sub_801B6A0(svr->mevent_unk1442cc, TRUE);
|
||||
break;
|
||||
case 4:
|
||||
if (svr->param == cmd->flag)
|
||||
{
|
||||
svr->cmdidx = 0;
|
||||
svr->cmdBuffer = cmd->parameter;
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
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:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
svr->param = *(u32 *)svr->recvBuffer;
|
||||
break;
|
||||
case 9:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
ptr = mevent_first_if_not_null_else_second(cmd->parameter, &svr->sendWord);
|
||||
svr->param = sub_801B708(ptr, svr->mevent_unk1442cc, ptr);
|
||||
break;
|
||||
case 10:
|
||||
AGB_ASSERT(cmd->parameter == NULL);
|
||||
svr->param = sub_801B784(svr->mevent_unk1442cc, cmd->flag);
|
||||
break;
|
||||
case 11:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
svr->param = sub_801B748(svr->mevent_unk1442cc, cmd->parameter);
|
||||
break;
|
||||
case 12:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
svr->param = mevent_compare_pointers(cmd->parameter, *(void **)svr->recvBuffer);
|
||||
break;
|
||||
case 14:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
mevent_srv_common_init_send(svr, 0x17, mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_3120), sizeof(struct MEventBuffer_3120_Sub));
|
||||
break;
|
||||
case 13:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
mevent_srv_common_init_send(svr, 0x16, mevent_first_if_not_null_else_second(cmd->parameter, svr->mevent_32e0), sizeof(struct MEventBuffer_32E0_Sub));
|
||||
break;
|
||||
case 16:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
mevent_srv_common_init_send(svr, 0x18, mevent_first_if_not_null_else_second(cmd->parameter, &svr->sendWord), 4);
|
||||
break;
|
||||
case 15:
|
||||
if (cmd->parameter == NULL)
|
||||
mevent_srv_common_init_send(svr, 0x19, svr->sendBuffer1, svr->sendBuffer1Size);
|
||||
else
|
||||
mevent_srv_common_init_send(svr, 0x19, cmd->parameter, cmd->flag);
|
||||
break;
|
||||
case 18:
|
||||
if (cmd->parameter == NULL)
|
||||
mevent_srv_common_init_send(svr, 0x10, svr->sendBuffer2, svr->sendBuffer2Size);
|
||||
else
|
||||
mevent_srv_common_init_send(svr, 0x10, cmd->parameter, cmd->flag);
|
||||
break;
|
||||
case 19:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
mevent_srv_common_init_send(svr, 0x1a, cmd->parameter, 188);
|
||||
break;
|
||||
case 20:
|
||||
mevent_srv_common_init_send(svr, 0x15, cmd->parameter, cmd->flag);
|
||||
break;
|
||||
case 17:
|
||||
mevent_srv_common_init_send(svr, 0x1c, cmd->parameter, cmd->flag);
|
||||
break;
|
||||
case 22:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
memcpy(svr->mevent_32e0, cmd->parameter, 332);
|
||||
break;
|
||||
case 23:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
memcpy(svr->mevent_3120, cmd->parameter, 444);
|
||||
break;
|
||||
case 21:
|
||||
AGB_ASSERT(cmd->flag == FALSE);
|
||||
svr->sendWord = *(u32 *)cmd->parameter;
|
||||
break;
|
||||
case 24:
|
||||
svr->sendBuffer1 = cmd->parameter;
|
||||
svr->sendBuffer1Size = cmd->flag;
|
||||
break;
|
||||
case 25:
|
||||
svr->sendBuffer2 = cmd->parameter;
|
||||
svr->sendBuffer2Size = cmd->flag;
|
||||
break;
|
||||
case 26:
|
||||
AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL);
|
||||
memcpy(svr->mevent_32e0, sav1_get_mevent_buffer_1(), 332);
|
||||
sub_801B3C0(svr->mevent_32e0);
|
||||
break;
|
||||
case 27:
|
||||
AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL);
|
||||
memcpy(svr->mevent_3120, sav1_get_mevent_buffer_0(), 444);
|
||||
break;
|
||||
case 28:
|
||||
AGB_ASSERT(cmd->flag == FALSE && cmd->parameter == NULL);
|
||||
svr->sendBuffer1 = sub_8099244();
|
||||
break;
|
||||
case 29:
|
||||
mevent_srv_common_init_send(svr, 0x1b, cmd->parameter, cmd->flag);
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static u32 (*const func_tbl[])(struct mevent_srv_common *) = {
|
||||
common_mainseq_0,
|
||||
common_mainseq_1,
|
||||
common_mainseq_2,
|
||||
common_mainseq_3,
|
||||
common_mainseq_4
|
||||
};
|
||||
|
||||
static u32 mevent_srv_exec_common(struct mevent_srv_common * svr)
|
||||
{
|
||||
u32 response;
|
||||
AGB_ASSERT(svr->mainseqno < NELEMS(func_tbl));
|
||||
response = func_tbl[svr->mainseqno](svr);
|
||||
AGB_ASSERT(svr->mainseqno < NELEMS(func_tbl));
|
||||
return response;
|
||||
}
|
||||
|
1
src/mevent_server_helpers.c
Normal file
1
src/mevent_server_helpers.c
Normal file
@ -0,0 +1 @@
|
||||
#include "global.h"
|
7
src/mevent_server_ish.c
Normal file
7
src/mevent_server_ish.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "alloc.h"
|
||||
#include "mevent.h"
|
||||
#include "mevent_server.h"
|
||||
#include "mevent_server_helpers.h"
|
||||
|
||||
EWRAM_DATA struct mevent_srv_ish * s_mevent_srv_ish_ptr = NULL;
|
@ -13,6 +13,7 @@
|
||||
.include "src/mevent2.o"
|
||||
.include "src/mevent_801BAAC.o"
|
||||
.include "src/mevent_server.o"
|
||||
.include "src/mevent_server_ish.o"
|
||||
|
||||
@ union_room_chat
|
||||
.align 2
|
||||
|
Loading…
x
Reference in New Issue
Block a user