Start decompiling logo.c

This commit is contained in:
Egor Ananyin 2020-05-07 20:54:23 +03:00
parent 57fcb895aa
commit 4bde1bb74a
4 changed files with 55 additions and 141 deletions

View File

@ -337,144 +337,3 @@ sub_081389FC: @ 0x081389FC
.align 2, 0
_08138A28: .4byte 0x000001FF
_08138A2C: .4byte 0x01000400
thumb_func_start sub_08138A30
sub_08138A30: @ 0x08138A30
push {r4, r5, r6, r7, lr}
lsls r0, r0, #0x18
lsls r1, r1, #0x10
lsls r2, r2, #0x10
ldr r3, _08138A9C @ =gUnk_082D7850
lsrs r1, r1, #0xe
adds r1, r1, r3
ldr r1, [r1]
ldr r4, [r1, #8]
ldr r7, [r1, #0x18]
ldrh r5, [r1, #2]
ldr r1, _08138AA0 @ =gBgCntRegs
lsrs r0, r0, #0x17
adds r0, r0, r1
ldrh r0, [r0]
lsls r0, r0, #0x10
lsrs r1, r0, #0x12
movs r3, #3
ands r1, r3
lsrs r0, r0, #0x18
movs r3, #0x1f
ands r0, r3
lsls r0, r0, #0xb
lsrs r2, r2, #0x13
lsls r2, r2, #6
movs r3, #0xc0
lsls r3, r3, #0x13
adds r2, r2, r3
adds r6, r0, r2
lsls r1, r1, #0xe
adds r1, r1, r3
adds r0, r4, #0
bl LZ77UnCompVram
movs r4, #0
cmp r4, r5
bhs _08138A96
_08138A7A:
lsls r0, r4, #4
subs r0, r0, r4
lsls r0, r0, #2
adds r0, r7, r0
lsls r1, r4, #6
adds r1, r6, r1
movs r2, #0x1e
bl CpuSet
adds r0, r4, #1
lsls r0, r0, #0x10
lsrs r4, r0, #0x10
cmp r4, r5
blo _08138A7A
_08138A96:
pop {r4, r5, r6, r7}
pop {r0}
bx r0
.align 2, 0
_08138A9C: .4byte gUnk_082D7850
_08138AA0: .4byte gBgCntRegs
thumb_func_start sub_08138AA4
sub_08138AA4: @ 0x08138AA4
push {r4, r5, r6, r7, lr}
mov r7, sl
mov r6, sb
mov r5, r8
push {r5, r6, r7}
lsls r0, r0, #0x10
lsrs r5, r0, #0x10
mov ip, r5
lsls r1, r1, #0x18
lsrs r6, r1, #0x18
mov r8, r6
lsls r2, r2, #0x18
lsrs r7, r2, #0x18
mov sb, r7
lsls r3, r3, #0x10
lsrs r2, r3, #0x10
adds r3, r2, #0
cmp r2, #0
beq _08138B2A
ldr r0, _08138AF0 @ =gUnk_03002440
mov sl, r0
ldr r4, [r0]
movs r0, #0x80
lsls r0, r0, #9
ands r0, r4
cmp r0, #0
beq _08138AF8
ldr r1, _08138AF4 @ =gUnk_082D7850
lsls r0, r5, #2
adds r0, r0, r1
ldr r0, [r0]
lsls r1, r6, #1
ldr r0, [r0, #0x10]
adds r0, r0, r1
adds r1, r7, #0
bl sub_08158334
b _08138B2A
.align 2, 0
_08138AF0: .4byte gUnk_03002440
_08138AF4: .4byte gUnk_082D7850
_08138AF8:
ldr r2, _08138B38 @ =0x040000D4
ldr r1, _08138B3C @ =gUnk_082D7850
mov r5, ip
lsls r0, r5, #2
adds r0, r0, r1
ldr r0, [r0]
mov r5, r8
lsls r1, r5, #1
ldr r0, [r0, #0x10]
adds r0, r0, r1
str r0, [r2]
mov r1, sb
lsls r0, r1, #1
ldr r1, _08138B40 @ =gBgPalette
adds r0, r0, r1
str r0, [r2, #4]
movs r0, #0x80
lsls r0, r0, #0x18
orrs r3, r0
str r3, [r2, #8]
ldr r0, [r2, #8]
movs r0, #1
orrs r4, r0
mov r5, sl
str r4, [r5]
_08138B2A:
pop {r3, r4, r5}
mov r8, r3
mov sb, r4
mov sl, r5
pop {r4, r5, r6, r7}
pop {r0}
bx r0
.align 2, 0
_08138B38: .4byte 0x040000D4
_08138B3C: .4byte gUnk_082D7850
_08138B40: .4byte gBgPalette

22
include/logo.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef GUARD_LOGO_H
#define GUARD_LOGO_H
#include "global.h"
struct Unk_082D7850 {
u8 filler0[2];
u16 unk2;
u8 filler4[4];
u32 unk8;
u8 fillerC[4];
u16* unk10;
u8 filler14[4];
u32 unk18;
};
extern struct Unk_082D7850* gUnk_082D7850[];
extern u16 gBgCntRegs[4];
extern u16 gBgPalette[];
extern u32 gUnk_03002440;
#endif

View File

@ -282,6 +282,7 @@ SECTIONS {
asm/code_0803024C.o(.text);
asm/code_08030C94.o(.text);
asm/logo.o(.text);
src/logo.o(.text);
asm/code_08138B44.o(.text);
asm/m4a_asm.o(.text);
src/m4a.o(.text);

32
src/logo.c Normal file
View File

@ -0,0 +1,32 @@
#include "global.h"
#include "logo.h"
void sub_08138A30(u8 arg0, u16 arg1, u16 arg2) {
u16 i;
u16 r5, r1_2, r0_2;
u32 r4, r7, r6;
struct Unk_082D7850* r1 = gUnk_082D7850[arg1];
r4 = r1->unk8;
r7 = r1->unk18;
r5 = r1->unk2;
r1_2 = (gBgCntRegs[arg0] >> 2) & 3;
r0_2 = (gBgCntRegs[arg0] >> 8) & 0x1f;
r6 = VRAM + (r0_2 << 0xb) + (arg2 >> 3 << 6);
LZ77UnCompVram(r4, (r1_2 << 0xe) + VRAM);
for (i = 0; i < r5; i++) {
CpuCopy16(r7 + (i * 60), r6 + (i * 64), 0x3c);
}
}
void sub_08138AA4(u16 arg0, u8 arg1, u8 arg2, u16 arg3) {
asm("":::"r4");
if (arg3 != 0) {
if (gUnk_03002440 & 0x10000) {
sub_08158334(gUnk_082D7850[arg0]->unk10 + arg1, arg2, arg3);
}
else {
DmaCopy16(3, gUnk_082D7850[arg0]->unk10 + arg1, gBgPalette + arg2, arg3 * 2);
gUnk_03002440 |= 1;
}
}
}