sub_80E6CA0

This commit is contained in:
PikalaxALT 2017-11-03 21:56:18 -04:00
parent ca2bc94c2b
commit f8486b31c5
8 changed files with 49 additions and 71 deletions

View File

@ -101,6 +101,8 @@ $(C_BUILDDIR)/agb_flash_mx.o: CFLAGS := -O -mthumb-interwork
$(C_BUILDDIR)/m4a_2.o: CC1 := tools/agbcc/bin/old_agbcc
$(C_BUILDDIR)/m4a_4.o: CC1 := tools/agbcc/bin/old_agbcc
$(C_BUILDDIR)/record_mixing.o: CFLAGS += -ffreestanding
ifeq ($(NODEP),)
$(C_BUILDDIR)/%.o: c_dep = $(shell $(SCANINC) -I include $(C_SUBDIR)/$*.c)
else

View File

@ -5,67 +5,6 @@
.text
thumb_func_start sub_80E6CA0
sub_80E6CA0: @ 80E6CA0
push {r4,r5,lr}
adds r5, r0, 0
ldr r0, =gUnknown_03001134
ldr r1, [r0]
movs r4, 0xC8
lsls r4, 4
adds r0, r5, 0
adds r2, r4, 0
bl memcpy
adds r4, r5, r4
ldr r0, =gUnknown_03001138
ldr r1, [r0]
movs r2, 0xE1
lsls r2, 2
adds r0, r4, 0
bl memcpy
adds r0, r4, 0
bl sub_80F14F8
ldr r1, =0x00001004
adds r0, r5, r1
ldr r1, =gUnknown_0300113C
ldr r1, [r1]
movs r2, 0x40
bl memcpy
ldr r2, =0x00001044
adds r0, r5, r2
ldr r1, =gUnknown_03001140
ldr r1, [r1]
movs r2, 0x40
bl memcpy
ldr r1, =0x00001084
adds r0, r5, r1
ldr r1, =gUnknown_03001144
ldr r1, [r1]
movs r2, 0x28
bl memcpy
ldr r2, =0x000010ac
adds r0, r5, r2
bl sub_80E89F8
ldr r0, =gUnknown_0300114C
ldr r0, [r0]
ldr r2, =0x00001124
adds r1, r5, r2
bl sub_81659DC
bl GetMultiplayerId
lsls r0, 24
cmp r0, 0
bne _080E6D1C
bl sub_81539D4
ldr r2, =0x000011c8
adds r1, r5, r2
strh r0, [r1]
_080E6D1C:
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_80E6CA0
thumb_func_start sub_80E6D54
sub_80E6D54: @ 80E6D54
push {r4,r5,lr}

View File

@ -2,5 +2,6 @@
#define GUARD_BATTLE_TOWER_H
u16 sub_8164FCC(u8, u8);
void sub_81659DC(void *a0, void *a1);
#endif //GUARD_BATTLE_TOWER_H

View File

@ -7,5 +7,6 @@
#include "gba/multiboot.h"
#include "gba/syscall.h"
#include "gba/macro.h"
#include "gba/libc.h"
#endif // GUARD_GBA_GBA_H

10
include/gba/libc.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef GUARD_LIBC_H
#define GUARD_LIBC_H
void *memset(void *dst, int val, size_t size);
void *memcpy(void *dst, const void *src, size_t size);
int strcmp(const char *s1, const char *s2);
char *strcpy(char *dst0, const char *src0);
#define abs(x) ((x) >= 0 ? (x) : -(x))
#endif //GUARD_LIBC_H

View File

@ -11,13 +11,6 @@
#define asm_comment(x) asm volatile("@ -- " x " -- ")
#define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided")
#if defined (__APPLE__) || defined (__CYGWIN__)
void *memset(void *, int, size_t);
void *memcpy(void *, const void *, size_t);
int strcmp(const char *s1, const char *s2);
char* strcpy(char *dst0, const char *src0);
#endif // __APPLE__
#define ARRAY_COUNT(array) (sizeof(array) / sizeof((array)[0]))
// useful math macros

View File

@ -4,5 +4,6 @@
u32 RunMysteryEventScript(u8 *);
void SetMysteryEventScriptStatus(u32 val);
u16 GetRecordMixingGift(void);
u16 sub_81539D4(void);
#endif // GUARD_MYSTERY_EVENT_SCRIPT_H

View File

@ -3,10 +3,26 @@
#include "global.h"
#include "task.h"
#include "cable_club.h"
#include "link.h"
#include "tv.h"
#include "battle_tower.h"
#include "mystery_event_script.h"
#include "record_mixing.h"
// Static type declarations
struct RecordMixingData {
struct SecretBaseRecord secretBases[20];
TVShow tvShows[25];
PokeNews pokeNews[16];
OldMan oldMan;
struct EasyChatPair easyChatPair[5];
u8 unk_10ac[0x78];
u8 unk_1124[0xa4];
u16 unk_11c8;
u8 unk_11ca[0x27a];
};
// Static RAM declarations
IWRAM_DATA bool8 gUnknown_03001130;
@ -28,13 +44,12 @@ EWRAM_DATA struct DayCareMailRecordMixing gUnknown_02039F9C[2] = {};
EWRAM_DATA struct {
/*0x0000*/ u8 filler_0000[0x5110];
} *gUnknown_0203A014 = NULL;
EWRAM_DATA struct {
/*0x0000*/ u8 filler_0000[0x1444];
} *gUnknown_0203A018 = NULL;
EWRAM_DATA struct RecordMixingData *gUnknown_0203A018 = NULL;
// Static ROM declarations
void sub_80E715C(u8 taskId);
void sub_80E89F8(void *dest);
// .rodata
@ -58,3 +73,19 @@ void sub_80E6BF8(void)
gUnknown_03001154 = gSaveBlock2Ptr->field_0DC;
gUnknown_03001158 = gSaveBlock2Ptr->field_64C;
}
void sub_80E6CA0(struct RecordMixingData *dest)
{
memcpy(dest->secretBases, gUnknown_03001134, sizeof(struct SecretBaseRecord) * 20);
memcpy(dest->tvShows, gUnknown_03001138, sizeof(TVShow) * 25);
sub_80F14F8(dest->tvShows);
memcpy(dest->pokeNews, gUnknown_0300113C, sizeof(PokeNews) * 16);
memcpy(&dest->oldMan, gUnknown_03001140, sizeof(OldMan));
memcpy(dest->easyChatPair, gUnknown_03001144, sizeof(struct EasyChatPair) * 5);
sub_80E89F8(dest->unk_10ac);
sub_81659DC(gUnknown_0300114C, dest->unk_1124);
if (GetMultiplayerId() == 0)
{
dest->unk_11c8 = sub_81539D4();
}
}