Decompile din, farore and nayru

This commit is contained in:
octorock 2021-05-08 00:25:17 +02:00
parent 3147427c73
commit 30232481d9
8 changed files with 163 additions and 419 deletions

139
asm/din.s
View File

@ -1,139 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Din
Din: @ 0x08064790
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xc]
cmp r0, #1
beq _080647C2
cmp r0, #1
bgt _080647A4
cmp r0, #0
beq _080647AA
b _08064824
_080647A4:
cmp r0, #2
beq _0806480A
b _08064824
_080647AA:
movs r2, #1
movs r0, #1
strb r0, [r4, #0xc]
ldrb r1, [r4, #0x18]
subs r0, #5
ands r0, r1
orrs r0, r2
strb r0, [r4, #0x18]
adds r0, r4, #0
bl sub_0807DD50
b _08064824
_080647C2:
adds r2, r4, #0
adds r2, #0x39
movs r1, #0
ldrsb r1, [r2, r1]
cmp r1, #2
bne _08064800
movs r0, #0
strb r1, [r4, #0xc]
strb r0, [r2]
adds r0, r4, #0
bl sub_0806F118
adds r0, r4, #0
adds r0, #0x58
ldrb r1, [r0]
adds r0, #0x10
strb r1, [r0]
ldr r1, _080647FC @ =gPlayerEntity
adds r0, r4, #0
bl GetFacingDirection
bl sub_0806F5A4
adds r1, r0, #0
adds r0, r4, #0
bl InitAnimationForceUpdate
b _08064824
.align 2, 0
_080647FC: .4byte gPlayerEntity
_08064800:
adds r0, r4, #0
movs r1, #0
bl sub_0807DD94
b _08064824
_0806480A:
adds r0, r4, #0
bl UpdateFuseInteraction
cmp r0, #0
beq _08064824
movs r0, #1
strb r0, [r4, #0xc]
adds r0, r4, #0
adds r0, #0x68
ldrb r1, [r0]
adds r0, r4, #0
bl InitAnimationForceUpdate
_08064824:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_08064828
sub_08064828: @ 0x08064828
push {r4, r5, r6, lr}
adds r4, r0, #0
bl sub_0801E99C
adds r5, r0, #0
ldr r6, _08064858 @ =gSave
adds r0, r4, #0
bl sub_08002632
ldr r2, _0806485C @ =0x00000141
adds r1, r6, r2
adds r0, r0, r1
ldrb r0, [r0]
cmp r0, #0
beq _0806484E
ldrb r0, [r6, #8]
cmp r0, #6
bhi _0806484E
movs r5, #0
_0806484E:
adds r0, r4, #0
adds r1, r5, #0
bl sub_08078784
pop {r4, r5, r6, pc}
.align 2, 0
_08064858: .4byte gSave
_0806485C: .4byte 0x00000141
thumb_func_start Din_Fusion
Din_Fusion: @ 0x08064860
push {lr}
adds r2, r0, #0
ldrb r0, [r2, #0xc]
cmp r0, #0
bne _08064886
adds r0, #1
strb r0, [r2, #0xc]
ldrb r1, [r2, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r1
movs r1, #1
orrs r0, r1
strb r0, [r2, #0x18]
adds r0, r2, #0
movs r1, #6
bl InitAnimationForceUpdate
b _0806488C
_08064886:
adds r0, r2, #0
bl UpdateAnimationSingleFrame
_0806488C:
pop {pc}
.align 2, 0

View File

@ -1,139 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Farore
Farore: @ 0x08064990
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xc]
cmp r0, #1
beq _080649C2
cmp r0, #1
bgt _080649A4
cmp r0, #0
beq _080649AA
b _08064A24
_080649A4:
cmp r0, #2
beq _08064A0A
b _08064A24
_080649AA:
movs r2, #1
movs r0, #1
strb r0, [r4, #0xc]
ldrb r1, [r4, #0x18]
subs r0, #5
ands r0, r1
orrs r0, r2
strb r0, [r4, #0x18]
adds r0, r4, #0
bl sub_0807DD50
b _08064A24
_080649C2:
adds r2, r4, #0
adds r2, #0x39
movs r1, #0
ldrsb r1, [r2, r1]
cmp r1, #2
bne _08064A00
movs r0, #0
strb r1, [r4, #0xc]
strb r0, [r2]
adds r0, r4, #0
bl sub_0806F118
adds r0, r4, #0
adds r0, #0x58
ldrb r1, [r0]
adds r0, #0x10
strb r1, [r0]
ldr r1, _080649FC @ =gPlayerEntity
adds r0, r4, #0
bl GetFacingDirection
bl sub_0806F5A4
adds r1, r0, #0
adds r0, r4, #0
bl InitAnimationForceUpdate
b _08064A24
.align 2, 0
_080649FC: .4byte gPlayerEntity
_08064A00:
adds r0, r4, #0
movs r1, #0
bl sub_0807DD94
b _08064A24
_08064A0A:
adds r0, r4, #0
bl UpdateFuseInteraction
cmp r0, #0
beq _08064A24
movs r0, #1
strb r0, [r4, #0xc]
adds r0, r4, #0
adds r0, #0x68
ldrb r1, [r0]
adds r0, r4, #0
bl InitAnimationForceUpdate
_08064A24:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_08064A28
sub_08064A28: @ 0x08064A28
push {r4, r5, r6, lr}
adds r4, r0, #0
bl sub_0801E99C
adds r5, r0, #0
ldr r6, _08064A58 @ =gSave
adds r0, r4, #0
bl sub_08002632
ldr r2, _08064A5C @ =0x00000141
adds r1, r6, r2
adds r0, r0, r1
ldrb r0, [r0]
cmp r0, #0
beq _08064A4E
ldrb r0, [r6, #8]
cmp r0, #6
bhi _08064A4E
movs r5, #0
_08064A4E:
adds r0, r4, #0
adds r1, r5, #0
bl sub_08078784
pop {r4, r5, r6, pc}
.align 2, 0
_08064A58: .4byte gSave
_08064A5C: .4byte 0x00000141
thumb_func_start Farore_Fusion
Farore_Fusion: @ 0x08064A60
push {lr}
adds r2, r0, #0
ldrb r0, [r2, #0xc]
cmp r0, #0
bne _08064A86
adds r0, #1
strb r0, [r2, #0xc]
ldrb r1, [r2, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r1
movs r1, #1
orrs r0, r1
strb r0, [r2, #0x18]
adds r0, r2, #0
movs r1, #6
bl InitAnimationForceUpdate
b _08064A8C
_08064A86:
adds r0, r2, #0
bl UpdateAnimationSingleFrame
_08064A8C:
pop {pc}
.align 2, 0

View File

@ -1,139 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Nayru
Nayru: @ 0x08064890
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xc]
cmp r0, #1
beq _080648C2
cmp r0, #1
bgt _080648A4
cmp r0, #0
beq _080648AA
b _08064924
_080648A4:
cmp r0, #2
beq _0806490A
b _08064924
_080648AA:
movs r2, #1
movs r0, #1
strb r0, [r4, #0xc]
ldrb r1, [r4, #0x18]
subs r0, #5
ands r0, r1
orrs r0, r2
strb r0, [r4, #0x18]
adds r0, r4, #0
bl sub_0807DD50
b _08064924
_080648C2:
adds r2, r4, #0
adds r2, #0x39
movs r1, #0
ldrsb r1, [r2, r1]
cmp r1, #2
bne _08064900
movs r0, #0
strb r1, [r4, #0xc]
strb r0, [r2]
adds r0, r4, #0
bl sub_0806F118
adds r0, r4, #0
adds r0, #0x58
ldrb r1, [r0]
adds r0, #0x10
strb r1, [r0]
ldr r1, _080648FC @ =gPlayerEntity
adds r0, r4, #0
bl GetFacingDirection
bl sub_0806F5A4
adds r1, r0, #0
adds r0, r4, #0
bl InitAnimationForceUpdate
b _08064924
.align 2, 0
_080648FC: .4byte gPlayerEntity
_08064900:
adds r0, r4, #0
movs r1, #0
bl sub_0807DD94
b _08064924
_0806490A:
adds r0, r4, #0
bl UpdateFuseInteraction
cmp r0, #0
beq _08064924
movs r0, #1
strb r0, [r4, #0xc]
adds r0, r4, #0
adds r0, #0x68
ldrb r1, [r0]
adds r0, r4, #0
bl InitAnimationForceUpdate
_08064924:
pop {r4, pc}
.align 2, 0
thumb_func_start sub_08064928
sub_08064928: @ 0x08064928
push {r4, r5, r6, lr}
adds r4, r0, #0
bl sub_0801E99C
adds r5, r0, #0
ldr r6, _08064958 @ =gSave
adds r0, r4, #0
bl sub_08002632
ldr r2, _0806495C @ =0x00000141
adds r1, r6, r2
adds r0, r0, r1
ldrb r0, [r0]
cmp r0, #0
beq _0806494E
ldrb r0, [r6, #8]
cmp r0, #6
bhi _0806494E
movs r5, #0
_0806494E:
adds r0, r4, #0
adds r1, r5, #0
bl sub_08078784
pop {r4, r5, r6, pc}
.align 2, 0
_08064958: .4byte gSave
_0806495C: .4byte 0x00000141
thumb_func_start Nayru_Fusion
Nayru_Fusion: @ 0x08064960
push {lr}
adds r2, r0, #0
ldrb r0, [r2, #0xc]
cmp r0, #0
bne _08064986
adds r0, #1
strb r0, [r2, #0xc]
ldrb r1, [r2, #0x18]
movs r0, #4
rsbs r0, r0, #0
ands r0, r1
movs r1, #1
orrs r0, r1
strb r0, [r2, #0x18]
adds r0, r2, #0
movs r1, #6
bl InitAnimationForceUpdate
b _0806498C
_08064986:
adds r0, r2, #0
bl UpdateAnimationSingleFrame
_0806498C:
pop {pc}
.align 2, 0

View File

@ -37,7 +37,8 @@ typedef struct {
/*0x080*/ u8 playerName[FILENAME_LENGTH];
/*0x086*/ u8 filler86[0x22];
/*0x0A8*/ Stats stats;
/*0x0D0*/ u8 fillerD0[0x3c0];
/*0x0D0*/ u8 fillerD0[0x71];
/*0x141*/ u8 unk141[0x34f];
/*0x490*/ u32 unk490;
/*0x494*/ u8 filler494[0x20];
} SaveFile;

View File

@ -554,6 +554,7 @@ SECTIONS {
src/npc/forestMinish.o(.text);
src/npc/postman.o(.text);
asm/postman.o(.text);
src/npc/npc5.o(.text);
asm/npc5.o(.text);
src/npc/townsperson.o(.text);
asm/kid.o(.text);
@ -571,7 +572,7 @@ SECTIONS {
src/npc/guard.o(.text);
asm/guardWithSpear.o(.text);
asm/castleMaid.o(.text);
asm/din.o(.text);
src/npc/din.o(.text);
asm/nayru.o(.text);
asm/farore.o(.text);
asm/sturgeon.o(.text);

53
src/npc/din.c Normal file
View File

@ -0,0 +1,53 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "script.h"
#include "functions.h"
#include "save.h"
extern u32 sub_08002632(Entity*);
void Din(Entity* this) {
switch(this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_0807DD50(this);
break;
case 1:
if (this->interactType ==2) {
this->action = 2;
this->interactType = 0;
sub_0806F118(this);
this->field_0x68.HALF.LO = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
} else {
sub_0807DD94(this, NULL);
}
break;
case 2:
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
InitAnimationForceUpdate(this, this->field_0x68.HALF.LO);
}
break;
}
}
void sub_08064828(Entity* this) {
u32 tmp = sub_0801E99C(this);
if ((gSave.unk141[sub_08002632(this)] != 0) && (gSave.unk8 < 7)) {
tmp = 0;
}
sub_08078784(this, tmp);
}
void Din_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 6);
} else {
UpdateAnimationSingleFrame(this);
}
}

53
src/npc/farore.c Normal file
View File

@ -0,0 +1,53 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "script.h"
#include "functions.h"
#include "save.h"
extern u32 sub_08002632(Entity*);
void Farore(Entity* this) {
switch(this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_0807DD50(this);
break;
case 1:
if (this->interactType ==2) {
this->action = 2;
this->interactType = 0;
sub_0806F118(this);
this->field_0x68.HALF.LO = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
} else {
sub_0807DD94(this, NULL);
}
break;
case 2:
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
InitAnimationForceUpdate(this, this->field_0x68.HALF.LO);
}
break;
}
}
void sub_08064A28(Entity* this) {
u32 tmp = sub_0801E99C(this);
if ((gSave.unk141[sub_08002632(this)] != 0) && (gSave.unk8 < 7)) {
tmp = 0;
}
sub_08078784(this, tmp);
}
void Farore_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 6);
} else {
UpdateAnimationSingleFrame(this);
}
}

53
src/npc/nayru.c Normal file
View File

@ -0,0 +1,53 @@
#include "global.h"
#include "entity.h"
#include "npc.h"
#include "script.h"
#include "functions.h"
#include "save.h"
extern u32 sub_08002632(Entity*);
void Nayru(Entity* this) {
switch(this->action) {
case 0:
this->action = 1;
this->spriteSettings.b.draw = 1;
sub_0807DD50(this);
break;
case 1:
if (this->interactType ==2) {
this->action = 2;
this->interactType = 0;
sub_0806F118(this);
this->field_0x68.HALF.LO = this->animIndex;
InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity)));
} else {
sub_0807DD94(this, NULL);
}
break;
case 2:
if (UpdateFuseInteraction(this) != 0) {
this->action = 1;
InitAnimationForceUpdate(this, this->field_0x68.HALF.LO);
}
break;
}
}
void sub_08064928(Entity* this) {
u32 tmp = sub_0801E99C(this);
if ((gSave.unk141[sub_08002632(this)] != 0) && (gSave.unk8 < 7)) {
tmp = 0;
}
sub_08078784(this, tmp);
}
void Nayru_Fusion(Entity* this) {
if (this->action == 0) {
this->action += 1;
this->spriteSettings.b.draw = 1;
InitAnimationForceUpdate(this, 6);
} else {
UpdateAnimationSingleFrame(this);
}
}