Add more ewram and iwram

This commit is contained in:
Seth Barberee 2024-05-27 07:33:35 -07:00
parent 6317c20380
commit 55f516ec5e
33 changed files with 370 additions and 505 deletions

View File

@ -5,45 +5,6 @@
.text
thumb_func_start sub_8094D28
sub_8094D28:
push {r4-r7,lr}
ldr r2, _08094D64
str r0, [r2]
ldr r1, _08094D68
movs r0, 0x1
str r0, [r1]
ldr r7, _08094D6C
adds r5, r2, 0
adds r4, r1, 0
ldr r6, _08094D70
_08094D3C:
ldr r2, [r4]
lsls r3, r2, 2
adds r3, r5
subs r0, r2, 0x1
lsls r0, 2
adds r0, r5
ldr r0, [r0]
lsrs r1, r0, 30
eors r0, r1
muls r0, r6
adds r0, r2
str r0, [r3]
adds r2, 0x1
str r2, [r4]
cmp r2, r7
ble _08094D3C
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08094D64: .4byte gUnknown_3001198
_08094D68: .4byte gUnknown_203B470
_08094D6C: .4byte 0x0000026f
_08094D70: .4byte 0x6c078965
thumb_func_end sub_8094D28
thumb_func_start sub_8094D74
sub_8094D74:
push {r4-r7,lr}

View File

@ -3349,286 +3349,4 @@ _0809C394:
bx r1
thumb_func_end sub_809B648
thumb_func_start sub_809C39C
sub_809C39C:
push {lr}
bl sub_801D178
ldr r1, _0809C3D4
ldr r1, [r1]
movs r2, 0x86
lsls r2, 3
adds r1, r2
str r0, [r1]
cmp r0, 0x3
bne _0809C3CC
bl sub_801D1D4
lsls r0, 24
lsrs r0, 24
bl sub_8002694
lsls r0, 16
asrs r0, 16
movs r2, 0x1
negs r2, r2
movs r1, 0
bl GroundMainGroundRequest
_0809C3CC:
bl sub_801D1E0
pop {r0}
bx r0
.align 2, 0
_0809C3D4: .4byte gUnknown_3001B64
thumb_func_end sub_809C39C
thumb_func_start sub_809C3D8
sub_809C3D8:
push {lr}
bl sub_801D178
ldr r1, _0809C410
ldr r1, [r1]
movs r2, 0x86
lsls r2, 3
adds r1, r2
str r0, [r1]
cmp r0, 0x3
bne _0809C408
bl sub_801D1D4
lsls r0, 24
lsrs r0, 24
bl sub_8002694
lsls r0, 16
asrs r0, 16
movs r2, 0x1
negs r2, r2
movs r1, 0
bl GroundMainGroundRequest
_0809C408:
bl sub_801D1E0
pop {r0}
bx r0
.align 2, 0
_0809C410: .4byte gUnknown_3001B64
thumb_func_end sub_809C3D8
thumb_func_start sub_809C414
sub_809C414:
push {lr}
bl sub_802540C
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0
beq _0809C448
ldr r0, _0809C444
ldr r0, [r0]
movs r2, 0x86
lsls r2, 3
adds r0, r2
str r1, [r0]
adds r0, r1, 0
bl sub_8002694
lsls r0, 16
asrs r0, 16
movs r2, 0x1
negs r2, r2
movs r1, 0
bl GroundMainGroundRequest
b _0809C458
.align 2, 0
_0809C444: .4byte gUnknown_3001B64
_0809C448:
ldr r0, _0809C460
ldr r0, [r0]
movs r1, 0x86
lsls r1, 3
adds r0, r1
movs r1, 0x1
negs r1, r1
str r1, [r0]
_0809C458:
bl sub_8025418
pop {r0}
bx r0
.align 2, 0
_0809C460: .4byte gUnknown_3001B64
thumb_func_end sub_809C414
thumb_func_start sub_809C464
sub_809C464:
push {lr}
bl DeleteTestTracker
bl sub_8001064
bl sub_809965C
pop {r0}
bx r0
thumb_func_end sub_809C464
thumb_func_start sub_809C478
sub_809C478:
push {lr}
sub sp, 0x8
bl sub_80356A0
cmp r0, 0x3
bne _0809C492
ldr r0, _0809C4AC
bl PlaySound
bl InitFlash
bl ClearFlashData
_0809C492:
bl sub_8035758
add r2, sp, 0x4
movs r0, 0x3
mov r1, sp
bl sub_8001B88
movs r0, 0
bl sub_80993C0
add sp, 0x8
pop {r0}
bx r0
.align 2, 0
_0809C4AC: .4byte 0x00000313
thumb_func_end sub_809C478
thumb_func_start sub_809C4B0
sub_809C4B0:
push {r4,r5,lr}
movs r4, 0x1
negs r4, r4
ldr r5, _0809C4FC
ldr r0, [r5]
movs r2, 0x86
lsls r2, 3
adds r1, r0, r2
ldr r0, [r1]
cmp r0, 0
bne _0809C4DE
bl sub_803B168
lsls r0, 16
ldr r1, [r5]
ldr r3, _0809C500
adds r2, r1, r3
asrs r4, r0, 16
lsrs r0, 16
strh r0, [r2]
movs r0, 0x86
lsls r0, 3
adds r1, r0
_0809C4DE:
str r4, [r1]
bl sub_803B1BC
movs r0, 0x1
negs r0, r0
cmp r4, r0
beq _0809C4F4
adds r0, r4, 0
movs r1, 0
bl GroundMap_ExecuteEvent
_0809C4F4:
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_0809C4FC: .4byte gUnknown_3001B64
_0809C500: .4byte 0x000005a4
thumb_func_end sub_809C4B0
thumb_func_start sub_809C504
sub_809C504:
push {r4,lr}
sub sp, 0x4
mov r0, sp
bl sub_80282DC
adds r4, r0, 0
cmp r4, 0x1
bne _0809C530
mov r0, sp
ldrb r0, [r0]
bl sub_809927C
ldr r0, _0809C52C
ldr r0, [r0]
movs r1, 0x86
lsls r1, 3
adds r0, r1
str r4, [r0]
b _0809C540
.align 2, 0
_0809C52C: .4byte gUnknown_3001B64
_0809C530:
ldr r0, _0809C54C
ldr r0, [r0]
movs r1, 0x86
lsls r1, 3
adds r0, r1
movs r1, 0x1
negs r1, r1
str r1, [r0]
_0809C540:
bl sub_80282FC
add sp, 0x4
pop {r4}
pop {r0}
bx r0
.align 2, 0
_0809C54C: .4byte gUnknown_3001B64
thumb_func_end sub_809C504
thumb_func_start sub_809C550
sub_809C550:
push {r4,r5,lr}
bl sub_802E90C
adds r4, r0, 0
movs r5, 0
bl sub_802E918
cmp r4, 0x2
beq _0809C586
cmp r4, 0x2
bhi _0809C56C
cmp r4, 0x1
beq _0809C572
b _0809C5AC
_0809C56C:
cmp r4, 0x3
beq _0809C59A
b _0809C5AC
_0809C572:
movs r0, 0x4
movs r1, 0x1D
movs r2, 0x3
bl sub_8001CC4
lsls r0, 24
cmp r0, 0
beq _0809C5AC
movs r5, 0x1
b _0809C5AC
_0809C586:
movs r0, 0x4
movs r1, 0x1F
movs r2, 0x2
bl sub_8001CC4
lsls r0, 24
cmp r0, 0
beq _0809C5AC
movs r5, 0x2
b _0809C5AC
_0809C59A:
movs r0, 0xB
movs r1, 0x33
movs r2, 0x8
bl sub_8001CC4
lsls r0, 24
cmp r0, 0
beq _0809C5AC
movs r5, 0x3
_0809C5AC:
ldr r0, _0809C5C0
ldr r0, [r0]
movs r1, 0x86
lsls r1, 3
adds r0, r1
str r5, [r0]
pop {r4,r5}
pop {r0}
bx r0
.align 2, 0
_0809C5C0: .4byte gUnknown_3001B64
thumb_func_end sub_809C550
.align 2,0

View File

@ -48,5 +48,6 @@ void sub_807A96C(Entity *pokemon, Entity *target);
void WakeUpPokemon(Entity * pokemon);
void SendThawedMessage(Entity *pokemon, Entity *target);
void sub_807AA30(void);
void sub_8079E34(Entity * pokemon, Entity * target, bool8 param_3);
#endif // !GUARD_CODE_8077274_1_H

View File

@ -2,7 +2,7 @@
#define GUARD_CODE_8094D28_H
// code_8094D28.s
extern void sub_8094D28(s32);
void sub_8094D28(s32 r0);
extern s32 sub_8094E4C(void);
#endif // GUARD_CODE_8094D28_H
#endif // GUARD_CODE_8094D28_H

View File

@ -4,6 +4,8 @@
#include "structs/dungeon_entity.h"
#include "structs/map.h"
extern u8 gWalkableTileToCrossableTerrain[8];
u8 GetCrossableTerrain(s16 species);
u8 sub_807034C(s16 id, struct Tile *tile);
u8 sub_80703A0(Entity *pokemon, Position *pos);

View File

@ -13,5 +13,6 @@ typedef struct unkStruct_811BAF4
bool8 sub_8098F88(void);
const char *sub_8098FB4(void);
bool8 GroundMainGroundRequest(s16 r0, u32 r1, s32 r2);
#endif // GUARD_GROUND_MAIN_H
#endif // GUARD_GROUND_MAIN_H

View File

@ -0,0 +1,48 @@
#ifndef GUARD_STR_3001B64_H
#define GUARD_STR_3001B64_H
#include "file_system.h"
struct unkStruct_3001B64_sub
{
// size: 0x24
u16 unk0;
/* 0x2 */ s16 speciesID;
u8 unk4;
u8 unk5;
u8 unk6;
u8 unk7;
u32 unk8;
u32 unkC;
u32 unk10;
/* 0x14 */ u8 *faceData;
u32 fill18;
u8 unk1C;
u8 fill1D[0x20 - 0x1D];
/* 0x20 */ OpenedFile *faceFile;
};
struct unkStruct_3001B64
{
// size: 0x5A8
u32 unk0;
u32 unk4;
u32 unk8;
u32 unkC;
u8 fill10[0x414 - 0x10];
u32 unk414;
u32 unk418;
u32 unk41C;
u32 unk420;
u32 unk424;
u32 unk428;
u32 unk42C;
u32 unk430;
u32 unk434;
u32 fill438;
struct unkStruct_3001B64_sub unk43C[10];
u16 unk5A4;
};
#endif // GUARD_STR_3001B61_H

View File

@ -1,10 +1,39 @@
#ifndef GUARD_TRAP_H
#define GUARD_TRAP_H
#include "structs/dungeon_entity.h"
#include "structs/map.h"
#include "structs/str_position.h"
bool8 CanLayTrap(Position *pos);
bool8 LayTrap(Position *pos, u8 trapID, u8 param_3);
bool8 sub_807FD84(Entity *entity);
bool8 sub_807FE04(Position *pos, char param_2);
bool8 sub_807FE44(Position *pos, char param_2);
void GetTrapName(u8 *buffer, u8 trapIndex);
void sub_807FE9C(Entity *pokemon, Position *pos, int param_3, char param_4);
void HandleMudTrap(Entity *pokemon, Entity *target);
void HandleStickyTrap(Entity *pokemon, Entity *target);
void HandleGrimyTrap(Entity *pokemon, Entity *target);
void HandleSummonTrap(Entity *pokemon, Position *pos);
void HandlePitfallTrap(Entity *pokemon,Entity *target,Tile *tile);
void HandleWarpTrap(Entity *pokemon, Entity *target);
void HandleSpinTrap(Entity *pokemon, Entity *target);
void HandleSlumberTrap(Entity *pokemon, Entity *target);
void HandleSlowTrap(Entity *pokemon, Entity *target);
void HandlePoisonTrap(Entity *pokemon, Entity *target);
void HandleSelfdestructTrap(Entity *pokemon, Entity *target);
void HandleExplosionTrap(Entity *pokemon, Entity *target);
void HandlePPZeroTrap(Entity *pokemon, Entity *target);
void HandleWonderTile(Entity *pokemon, Entity *target);
// code_807FCD4.s
extern void HandleSealTrap(Entity *pokemon, Entity *target);
extern void HandleWhirlwindTrap(Entity *entity, Entity *target);
extern void HandlePokemonTrap(Entity *pokemon, Position *pos);
// trap_1.c
void HandleTripTrap(Entity *pokemon, Entity *target);
void SetTrap(Tile *tile, u8 id);
#endif

View File

@ -316,6 +316,7 @@ SECTIONS {
src/code_809447C.o(.text);
src/code_8092334.o(.text);
src/game_options.o(.text);
src/code_8094D28.o(.text);
asm/code_8094D28.o(.text);
src/play_time.o(.text);
src/code_8094F88.o(.text);
@ -340,6 +341,7 @@ SECTIONS {
asm/code_8098BDC.o(.text);
src/code_809A560.o(.text);
asm/code_809A560.o(.text);
src/code_809A560_1.o(.text);
src/code_809C5C4.o(.text);
asm/code_809C5C4.o(.text);
src/code_809D148.o(.text);

View File

@ -3,8 +3,8 @@
#include "random.h"
#include "reg_control.h"
extern u32 gUnknown_203B0B8;
extern u16 gRawKeyInput;
EWRAM_DATA_2 u32 gUnknown_203B0B8 = {0};
EWRAM_DATA_2 u16 gRawKeyInput = {0};
void sub_800CB20(void)
{

View File

@ -18,8 +18,8 @@
#include "pokemon_3.h"
#include "pokemon.h"
#include "position_util.h"
#include "structs/dungeon_entity.h"
#include "structs/str_dungeon.h"
#include "exclusive_pokemon.h"
#include "trap.h"
extern u32 gUnknown_202EDC8;
extern u8 gUnknown_202E038[0x50];
@ -457,7 +457,6 @@ extern void sub_8046860(Entity *, Position *, Item *, u32);
extern u32 sub_803D73C(u32);
extern void sub_80460F8(Position *, Item *, u8);
extern void sub_807FE04(Position *, u8);
void ZapdosReFightDialogue(void)
{

View File

@ -15,10 +15,10 @@
#include "structs/str_dungeon.h"
#include "tile_types.h"
#include "position_util.h"
#include "trap.h"
extern void sub_8049ED4(void);
extern void sub_8073D14(Entity *);
extern void sub_807FE9C(Entity *, Position *, u32, u32);
void sub_8075680(void)
{

View File

@ -20,7 +20,7 @@ extern void sub_80426C8(u32, u32);
extern void sub_8068FE0(Entity *, u32, Entity *r2);
extern void nullsub_93(Position *);
extern void sub_80522F4(Entity *, Entity *, u8 *);
extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32);
extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32);
extern void sub_80694C0(Entity *, s32, s32, u32);
extern void sub_804535C(Entity *, u32);
extern void sub_804AC20(Position *);
@ -35,7 +35,7 @@ extern u8 *gUnknown_80F9CBC[];
extern u8 gAvailablePokemonNames[];
extern u8 *gUnknown_80FCAC0[];
void sub_807E1A0(Entity *pokemon,Entity *target,u8 param_3,s16 param_4,s32 param_5)
void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s16 param_4,s32 param_5)
{
EntityInfo *targetInfo;
u8 flag;
@ -65,7 +65,7 @@ void sub_807E1A0(Entity *pokemon,Entity *target,u8 param_3,s16 param_4,s32 param
newHP /= 2;
}
}
sub_806F370(pokemon,target,newHP,0,&flag,param_3,param_4_s32,0,0,0);
sub_806F370(pokemon,target,newHP,0,&flag,moveType,param_4_s32,0,0,0);
}
}
}

View File

@ -1,19 +1,19 @@
#include "global.h"
#include "code_8092334.h"
#include "structs/str_position.h"
extern void sub_8082FE0(u32, void *, u32);
extern void sub_8082FA8(void *, void *, u32);
extern void sub_8082FE0(unkStruct_8094924 *, void *, u32 size);
extern void sub_8082FA8(unkStruct_8094924 *, void *, u32);
void nullsub_98()
void nullsub_98(unkStruct_8094924 *param_1)
{}
void sub_808300C(u32 *param_1, u32 *param_2)
void sub_808300C(unkStruct_8094924 *param_1, u8 *param_2)
{
sub_8082FA8(param_1, param_2, 8);
}
void sub_8083018(u32 param_1)
void sub_8083018(unkStruct_8094924 *param_1)
{
u8 auStack_10 [12];
@ -21,7 +21,7 @@ void sub_8083018(u32 param_1)
auStack_10[8] = 0;
}
void sub_8083030(u32 *param_1, u32 param_2)
void sub_8083030(unkStruct_8094924 *param_1, u16 param_2)
{
u16 uStack_8;
@ -29,7 +29,7 @@ void sub_8083030(u32 *param_1, u32 param_2)
sub_8082FA8(param_1,&uStack_8,2);
}
void sub_8083048(u32 *param_1, u32 param_2)
void sub_8083048(unkStruct_8094924 *param_1, u32 param_2)
{
u16 uStack_8;
@ -37,7 +37,7 @@ void sub_8083048(u32 *param_1, u32 param_2)
sub_8082FA8(param_1,&uStack_8,2);
}
void sub_8083060(u32 *param_1, u32 param_2)
void sub_8083060(unkStruct_8094924 *param_1, u32 param_2)
{
u8 uStack_8;
@ -45,7 +45,7 @@ void sub_8083060(u32 *param_1, u32 param_2)
sub_8082FA8(param_1,&uStack_8,1);
}
void sub_8083078(u32 *param_1, u32 param_2)
void sub_8083078(unkStruct_8094924 *param_1, u32 param_2)
{
u32 uStack_8;
@ -53,7 +53,7 @@ void sub_8083078(u32 *param_1, u32 param_2)
sub_8082FA8(param_1,&uStack_8,4);
}
void sub_808308C(u32 *param_1, u32 param_2)
void sub_808308C(unkStruct_8094924 *param_1, u32 param_2)
{
u32 uStack_8;
@ -61,7 +61,7 @@ void sub_808308C(u32 *param_1, u32 param_2)
sub_8082FA8(param_1,&uStack_8,4);
}
void sub_80830A0(u32 *param_1, u32 param_2)
void sub_80830A0(unkStruct_8094924 *param_1, u32 param_2)
{
u32 uStack_8;
@ -69,7 +69,7 @@ void sub_80830A0(u32 *param_1, u32 param_2)
sub_8082FA8(param_1,&uStack_8,4);
}
void sub_80830B4(u32 *param_1, u8 param_2)
void sub_80830B4(unkStruct_8094924 *param_1, u8 param_2)
{
u8 local_8;
@ -77,13 +77,13 @@ void sub_80830B4(u32 *param_1, u8 param_2)
sub_8082FA8(param_1,&local_8,1);
}
void SavePosition(u32 *param_1, Position *param_2)
void SavePosition(unkStruct_8094924 *param_1, Position *param_2)
{
sub_8082FA8(param_1, &param_2->x, 1);
sub_8082FA8(param_1, &param_2->y, 1);
}
void sub_80830F8(u32 *param_1, u32 *param_2)
void sub_80830F8(unkStruct_8094924 *param_1, u32 *param_2)
{
sub_8082FA8(param_1, &param_2[0], 1);
sub_8082FA8(param_1, &param_2[1], 1);
@ -91,18 +91,18 @@ void sub_80830F8(u32 *param_1, u32 *param_2)
sub_8082FA8(param_1, &param_2[3], 1);
}
void sub_808312C(u32 *param_1, u16 *param_2)
void sub_808312C(unkStruct_8094924 *param_1, u16 *param_2)
{
sub_8082FA8(param_1, &param_2[0], 1);
sub_8082FA8(param_1, &param_2[1], 1);
}
void SaveSpeedCounters(u32 *param_1, u32 *speedCounters, u32 numCounters)
void SaveSpeedCounters(unkStruct_8094924 *param_1, u32 *speedCounters, u32 numCounters)
{
sub_8082FA8(param_1, speedCounters, numCounters);
}
u16 sub_8083158(u32 param_1)
u16 sub_8083158(unkStruct_8094924 *param_1)
{
u16 local_8;
@ -110,7 +110,7 @@ u16 sub_8083158(u32 param_1)
return local_8;
}
s16 sub_8083170(u32 param_1)
s16 sub_8083170(unkStruct_8094924 *param_1)
{
s16 local_8;
@ -118,7 +118,7 @@ s16 sub_8083170(u32 param_1)
return local_8;
}
u8 sub_8083188(u32 param_1)
u8 sub_8083188(unkStruct_8094924 *param_1)
{
u8 local_8;
@ -126,7 +126,7 @@ u8 sub_8083188(u32 param_1)
return local_8;
}
u32 sub_80831A0(u32 param_1)
u32 sub_80831A0(unkStruct_8094924 *param_1)
{
u32 local_8;
@ -134,7 +134,7 @@ u32 sub_80831A0(u32 param_1)
return local_8;
}
u32 sub_80831B4(u32 param_1)
u32 sub_80831B4(unkStruct_8094924 *param_1)
{
u32 local_8;
@ -142,7 +142,7 @@ u32 sub_80831B4(u32 param_1)
return local_8;
}
u32 sub_80831C8(u32 param_1)
u32 sub_80831C8(unkStruct_8094924 *param_1)
{
u32 local_8;
@ -150,7 +150,7 @@ u32 sub_80831C8(u32 param_1)
return local_8;
}
bool8 sub_80831DC(u32 param_1)
bool8 sub_80831DC(unkStruct_8094924 *param_1)
{
u8 local_8;
@ -158,7 +158,7 @@ bool8 sub_80831DC(u32 param_1)
return local_8 != 0;
}
void sub_80831F8(u32 param_1,u16 *param_2)
void sub_80831F8(unkStruct_8094924 *param_1,u16 *param_2)
{
param_2[0] = 0;
param_2[1] = 0;
@ -167,7 +167,7 @@ void sub_80831F8(u32 param_1,u16 *param_2)
}
void sub_8083220(u32 param_1,u32 *param_2)
void sub_8083220(unkStruct_8094924 *param_1,u32 *param_2)
{
param_2[0] = 0;
param_2[1] = 0;
@ -179,7 +179,7 @@ void sub_8083220(u32 param_1,u32 *param_2)
sub_8082FE0(param_1,&param_2[3],1);
}
void sub_8083260(u32 param_1,u16 *param_2)
void sub_8083260(unkStruct_8094924 *param_1,u16 *param_2)
{
param_2[0] = 0;
param_2[1] = 0;
@ -187,8 +187,8 @@ void sub_8083260(u32 param_1,u16 *param_2)
sub_8082FE0(param_1,&param_2[1],1);
}
void sub_8083288(u32 r0, u16 *r1, u32 r2)
void sub_8083288(unkStruct_8094924 *r0, u16 *r1, u32 size)
{
sub_8082FE0(r0, r1, r2);
sub_8082FE0(r0, r1, size);
}

18
src/code_8094D28.c Normal file
View File

@ -0,0 +1,18 @@
#include "global.h"
IWRAM_DATA u32 gUnknown_3001198[0x270] = {0};
EWRAM_DATA_2 s32 gUnknown_203B470 = {0};
EWRAM_DATA_2 s32 gUnknown_203B474 = {0};
void sub_8094D28(s32 r0) {
gUnknown_3001198[0] = r0;
gUnknown_203B470 = 1;
for(; gUnknown_203B470 < 0x270; gUnknown_203B470++)
{
gUnknown_3001198[gUnknown_203B470] =
(gUnknown_3001198[gUnknown_203B470 - 1] ^
(gUnknown_3001198[gUnknown_203B470 - 1] >> 0x1e)) * 0x6c078965 + gUnknown_203B470;
}
}

View File

@ -1,50 +1,9 @@
#include "global.h"
#include "text1.h"
#include "memory.h"
#include "file_system.h"
#include "structs/str_3001B64.h"
struct unkStruct_3001B64_sub
{
// size: 0x24
u16 unk0;
/* 0x2 */ s16 speciesID;
u8 unk4;
u8 unk5;
u8 unk6;
u8 unk7;
u32 unk8;
u32 unkC;
u32 unk10;
/* 0x14 */ u8 *faceData;
u32 fill18;
u8 unk1C;
u8 fill1D[0x20 - 0x1D];
/* 0x20 */ OpenedFile *faceFile;
};
struct unkStruct_3001B64
{
// size: 0x5A8
u32 unk0;
u32 unk4;
u32 unk8;
u32 unkC;
u8 fill10[0x414 - 0x10];
u32 unk414;
u32 unk418;
u32 unk41C;
u32 unk420;
u32 unk424;
u32 unk428;
u32 unk42C;
u32 unk430;
u32 unk434;
u32 fill438;
struct unkStruct_3001B64_sub unk43C[10];
u16 unk5A4;
};
extern struct unkStruct_3001B64 *gUnknown_3001B64;
IWRAM_DATA struct unkStruct_3001B64 *gUnknown_3001B64 = {0};
extern u16 gUnknown_20399DC;
extern u16 gUnknown_20399DE;

170
src/code_809A560_1.c Normal file
View File

@ -0,0 +1,170 @@
#include "global.h"
#include "structs/str_3001B64.h"
#include "code_80118A4.h"
#include "code_801D014.h"
#include "credits2.h"
#include "event_flag.h"
#include "flash.h"
#include "friend_list_menu.h"
#include "ground_main.h"
#include "personality_test1.h"
extern struct unkStruct_3001B64 *gUnknown_3001B64;
u32 sub_802E90C();
void sub_802E918();
u32 sub_80282DC(u8 *r0);
void sub_809927C(u8);
void sub_80282FC(void);
void sub_80993C0(u32);
void sub_8001064(void);
void sub_809965C(void);
void sub_809C39C(void) {
gUnknown_3001B64->unk430 = sub_801D178();
if(gUnknown_3001B64->unk430 == 3)
GroundMainGroundRequest(sub_8002694(sub_801D1D4()), 0, -1);
sub_801D1E0();
}
void sub_809C3D8(void)
{
gUnknown_3001B64->unk430 = sub_801D178();
if(gUnknown_3001B64->unk430 == 3)
GroundMainGroundRequest(sub_8002694(sub_801D1D4()), 0, -1);
sub_801D1E0();
}
void sub_809C414(void)
{
u8 val;
val = sub_802540C();
if(val != 0)
{
gUnknown_3001B64->unk430 = val;
GroundMainGroundRequest(sub_8002694(val), 0, -1);
}
else
{
gUnknown_3001B64->unk430 = -1;
}
sub_8025418();
}
void sub_809C464(void)
{
DeleteTestTracker();
sub_8001064();
sub_809965C();
}
void sub_809C478(void)
{
s32 temp;
s32 temp1;
if(sub_80356A0() == 0x3)
{
PlaySound(0x313);
InitFlash();
ClearFlashData();
}
sub_8035758();
sub_8001B88(3, &temp, &temp1);
sub_80993C0(0);
}
// https://decomp.me/scratch/WyHAL - (84.32% matching - Seth)
NAKED
void sub_809C4B0(void)
{
asm_unified(
"\tpush {r4,r5,lr}\n"
"\tmovs r4, 0x1\n"
"\tnegs r4, r4\n"
"\tldr r5, _0809C4FC\n"
"\tldr r0, [r5]\n"
"\tmovs r2, 0x86\n"
"\tlsls r2, 3\n"
"\tadds r1, r0, r2\n"
"\tldr r0, [r1]\n"
"\tcmp r0, 0\n"
"\tbne _0809C4DE\n"
"\tbl sub_803B168\n"
"\tlsls r0, 16\n"
"\tldr r1, [r5]\n"
"\tldr r3, _0809C500\n"
"\tadds r2, r1, r3\n"
"\tasrs r4, r0, 16\n"
"\tlsrs r0, 16\n"
"\tstrh r0, [r2]\n"
"\tmovs r0, 0x86\n"
"\tlsls r0, 3\n"
"\tadds r1, r0\n"
"_0809C4DE:\n"
"\tstr r4, [r1]\n"
"\tbl sub_803B1BC\n"
"\tmovs r0, 0x1\n"
"\tnegs r0, r0\n"
"\tcmp r4, r0\n"
"\tbeq _0809C4F4\n"
"\tadds r0, r4, 0\n"
"\tmovs r1, 0\n"
"\tbl GroundMap_ExecuteEvent\n"
"_0809C4F4:\n"
"\tpop {r4,r5}\n"
"\tpop {r0}\n"
"\tbx r0\n"
"\t.align 2, 0\n"
"_0809C4FC: .4byte gUnknown_3001B64\n"
"_0809C500: .4byte 0x000005a4");
}
void sub_809C504(void)
{
u8 temp;
if(sub_80282DC(&temp) == 1)
{
sub_809927C(temp);
gUnknown_3001B64->unk430 = 1;
}
else
{
gUnknown_3001B64->unk430 = -1;
}
sub_80282FC();
}
void sub_809C550(void)
{
u32 ret;
s32 val;
ret = sub_802E90C();
val = 0;
sub_802E918();
switch(ret)
{
case 1:
if(sub_8001CC4(4, 0x1D, 0x3))
val = 1;
break;
case 2:
if(sub_8001CC4(4, 0x1F, 0x2))
val = 2;
break;
case 3:
if(sub_8001CC4(0xB, 0x33, 0x8))
val = 3;
break;
}
gUnknown_3001B64->unk430 = val;
}

View File

@ -23,7 +23,7 @@ struct unkStruct_3001B68
u8 unk20;
};
extern struct unkStruct_3001B68 *gUnknown_3001B68;
IWRAM_DATA struct unkStruct_3001B68 *gUnknown_3001B68 = {0};
struct unkStruct_20399E0

View File

@ -2,7 +2,7 @@
#include "bg_control.h"
#include "cpu.h"
extern u32 gUnknown_202D800;
EWRAM_DATA u32 gUnknown_202D800 = {0};
extern u16 gUnknown_203B0BE[];
extern u16 *gUnknown_2026E3C;
extern u8 gUnknown_2026E38;

View File

@ -34,10 +34,12 @@ enum ItemTargetFlag
ITEM_TARGET_ALLY = 1 << 1
};
extern s32 gNumPotentialTargets;
extern u32 gPotentialItemTargetWeights[NUM_DIRECTIONS];
extern u32 gPotentialItemTargetDirections[NUM_DIRECTIONS];
extern bool8 gTargetAhead[NUM_DIRECTIONS];
EWRAM_DATA_2 s32 gNumPotentialTargets = {0};
EWRAM_DATA u32 gPotentialItemTargetDirections[NUM_DIRECTIONS] = {0};
EWRAM_DATA bool8 gTargetAhead[NUM_DIRECTIONS] = {0};
EWRAM_DATA u32 gPotentialItemTargetWeights[NUM_DIRECTIONS] = {0};
extern TeamInventory *gTeamInventoryRef;
void sub_807360C(void)

View File

@ -23,6 +23,8 @@
#include "dungeon_visibility.h"
#include "pokemon_3.h"
#include "pokemon.h"
#include "code_8077274_1.h"
#include "trap.h"
extern u8 gUnknown_202F221;
extern u8 gUnknown_202F222;
@ -55,7 +57,6 @@ void HandlePickUpPlayerAction(Entity *);
void sub_8066E14(Entity * );
void sub_807348C(void);
void sub_80732F0(void);
void sub_807FD84(Entity *);
void sub_8066BD4(Entity*);
void HandleTalkFieldAction(Entity *);
void HandleUseMovePlayerAction(Entity *);
@ -67,7 +68,6 @@ void HandleUseItemAction(Entity *);
void sub_8066FA4(Entity *);
void HandleSetItemAction(Entity *,bool8);
void HandleUnsetItemAction(Entity *,bool8);
void sub_807FE9C(Entity *,Position *,u32,u32);
extern u8 sub_8044B28(void);
extern u8 UseAttack(Entity *);
void sub_8052740(u32);

View File

@ -7,25 +7,28 @@
#include "tile_types.h"
#include "random.h"
#include "dungeon_engine.h"
#include "dungeon_movement.h"
extern unkStruct_202F190 gUnknown_202F190;
extern unkStruct_202F190 *gUnknown_203B430;
extern unkStruct_202F190 gUnknown_80F69D4;
extern unkStruct_202F190 gUnknown_80F69EC;
extern u8 gUnknown_8108EC0[];
extern u8 gUnknown_80F6A04[];
extern u8 gUnknown_80F6A10[];
extern u8 gUnknown_80F6A28[];
extern u8 gUnknown_80F6A1C[];
extern u8 gUnknown_80F6A34[];
extern u8 gUnknown_80F6A40[];
extern u8 gUnknown_8108EC0[];
extern const struct FileArchive gDungeonFileArchive;
extern OpenedFile *gUnknown_202F18C;
extern OpenedFile *gDungeonPaletteFile;
extern unkStruct_202EE8C gUnknown_202EE8C[32];
extern u8 gWalkableTileToCrossableTerrain[8];
// ewram
EWRAM_DATA OpenedFile *gDungeonPaletteFile = {0};
EWRAM_DATA unkStruct_202EE8C gUnknown_202EE8C[32] = {0};
EWRAM_DATA OpenedFile *gUnknown_202F18C = {0};
EWRAM_DATA unkStruct_202F190 gUnknown_202F190 = {0};
// ewram2
EWRAM_DATA_2 unkStruct_202F190 *gUnknown_203B430 = {0};
extern u8 sub_8043CE4(u32);
extern int sprintf(char *, const char *, ...);
@ -331,4 +334,4 @@ void sub_8049B8C(void)
sub_8049BB0(XCoord,YCoord);
}
}
}
}

View File

@ -16,7 +16,7 @@
#include "pokemon.h"
#include "weather.h"
extern u8 gWalkableTileToCrossableTerrain[8];
EWRAM_DATA u8 gWalkableTileToCrossableTerrain[8] = {0};
u8 GetCrossableTerrain(s16 species)
{

View File

@ -144,7 +144,7 @@ void sub_8098CC8(void)
ClearAllItems_8091FB4();
}
bool8 GroundMainGroundRequest(s16 r0, u32 r1, u32 r2)
bool8 GroundMainGroundRequest(s16 r0, u32 r1, s32 r2)
{
s32 temp;
temp = r0; // force a asr shift

View File

@ -8,6 +8,8 @@
#include "memory.h"
#include "sprite.h"
IWRAM_DATA unkStruct_3001B7C *gUnknown_3001B7C = {0};
extern unkStruct_2039DB0 gUnknown_2039DB0;
extern unkStruct_2039DB0 gUnknown_2039DC0;
extern u16 gUnknown_2039DCC;
@ -15,7 +17,6 @@ extern u16 gUnknown_2039DCE;
extern u8 gUnknown_2039DD0;
extern u32 gUnknown_2039DD4;
extern OpenedFile *gUnknown_203B4B4;
extern unkStruct_3001B7C *gUnknown_3001B7C;
// dungeon_sbin.s
extern const struct FileArchive gDungeonFileArchive;
@ -204,4 +205,4 @@ UNUSED static u16 sub_80A65D8(u16 *a0)
u16 sub_80A65E0(u32 a0)
{
return (a0 >> 16) & 0x337F;
}
}

View File

@ -214,7 +214,6 @@ extern u8 sub_806F4A4(Entity *, u32);
extern void sub_807DF38(Entity *pokemon, Entity *target, Position *pos, u32, u8 moveType, s16);
extern void nullsub_92(Entity *);
extern u32 sub_8055864(Entity *pokemon, Entity *target, Move *param_3, s32 param_4, s32 param_5);
void sub_8079E34(Entity * pokemon, Entity * target, bool8 param_3);
extern u8 sub_807EAA0(u32, u32);
extern void sub_80522F4(Entity *r1, Entity *r2, const char[]);
extern s32 sub_80556BC(Entity *, Entity *, u8, Move *, u32, u32);

View File

@ -409,4 +409,4 @@ static void PersonalityTest_DisplayStarterSprite(void)
sub_800836C(1, r6, 14);
CloseFile(faceFile);
sub_80073E0(1);
}
}

View File

@ -51,7 +51,6 @@ extern void sub_8049BB0(s32, s32);
extern s16 sub_8057600(Move*, u32);
extern u32 sub_8055864(Entity *pokemon, Entity *target, Move *param_3, s32 param_4, s32 param_5);
extern void sub_807D148(Entity *pokemon, Entity *r1, u32 r2, Position *r3);
extern void sub_807FE04(Position *, u32);
extern void sub_807DB74(Entity *);
extern void HandleLuminousOrbAction(Entity *pokemon);
extern void sub_807D510(Entity *, Entity *);

View File

@ -3,6 +3,7 @@
#include "code_8045A00.h"
#include "code_80521D0.h"
#include "code_8077274_1.h"
#include "code_808417C.h"
#include "constants/trap.h"
#include "constants/type.h"
@ -64,37 +65,17 @@ extern Entity* sub_806B7F8(struct unkStruct_806B7F8 *, bool8);
void sub_806A9B4(Entity *, u32);
void sub_8079E34(Entity *param_1, Entity *param_2, u32);
s16 sub_803D970(u32);
bool8 sub_806AA0C(s32, s32);
void sub_80421EC(Position *, u32);
bool8 sub_8045888(Entity *);
void SetTrap(Tile *, u32);
void sub_803E708(u32, u32);
u8 sub_8043D10(void);
void sub_8068FE0(Entity *, u32, Entity *);
void sub_805239C(Entity *, u8 *);
void sub_8045C28(Item *, u8 , u8);
void sub_8045BF8(u8 *, Item *);
void HandleTripTrap(Entity *pokemon,Entity *target);
void HandleMudTrap(Entity *pokemon,Entity *target);
void HandleStickyTrap(Entity *pokemon,Entity *target);
void HandleGrimyTrap(Entity *pokemon,Entity *target);
void HandleSummonTrap(Entity *pokemon,Position *pos);
void HandlePitfallTrap(Entity *pokemon,Entity *target,Tile *tile);
void HandleWarpTrap(Entity *pokemon,Entity *target);
void HandleWhirlwindTrap(Entity *entity,Entity *target);
void HandleSpinTrap(Entity *pokemon,Entity *target);
void HandleSlumberTrap(Entity *pokemon,Entity *target);
void HandleSlowTrap(Entity *pokemon,Entity *target);
void HandleSealTrap(Entity *pokemon,Entity *target);
void HandlePoisonTrap(Entity *pokemon,Entity *target);
void HandleSelfdestructTrap(Entity *pokemon,Entity *target);
void HandleExplosionTrap(Entity *pokemon,Entity *target);
void HandlePPZeroTrap(Entity *pokemon,Entity *target);
void HandleWonderTile(Entity *pokemon,Entity *target);
void HandlePokemonTrap(Entity *pokemon,Position *pos);
void sub_806F324(Entity *,s16,u32,u32);
void sub_806F480(Entity *, u32);
extern void sub_80421C0(Entity *, u32);
@ -104,7 +85,7 @@ extern u8 sub_803F428(Position *pos);
void sub_806A1E8(Entity *pokemon);
void sub_8052364(Entity *, Position *, u8 *);
void sub_8049ED4(void);
void sub_80522F4(Entity *r0, Entity *r1, const char r2[]);
void sub_80522F4(Entity *pokemon, Entity *target, const char r2[]);
u8 sub_803D6FC(void);
Entity *sub_8045684(u8, Position *, u8);
extern void sub_807D148(Entity *pokemon, Entity *target, u32 r2, Position *r3);
@ -690,7 +671,7 @@ void HandlePPZeroTrap(Entity *param_1,Entity *param_2)
}
}
void HandleWonderTile(Entity *param_1, Entity *param_2)
void HandleWonderTile(Entity *pokemon, Entity *target)
{
sub_8079E34(param_1, param_2, 0);
sub_8079E34(pokemon, target, FALSE);
}

View File

@ -1,4 +1,6 @@
#include "global.h"
#include "structs/dungeon_entity.h"
#include "structs/map.h"
#include "trap.h"
#include "code_806CD90.h"
#include "code_8092334.h"
@ -10,7 +12,7 @@
extern u8 gUnknown_81071E0[];
extern u8 gUnknown_81071D4[];
extern void sub_8082FA8(void *, void *, u32);
extern void sub_8082FA8(unkStruct_8094924 *, void *, s32);
void sub_8081B60(void *, Tile *);
void sub_80830F8(void * , u32*);
@ -70,27 +72,27 @@ void sub_803E708(u32, u32);
void sub_80421C0(Entity *, u32);
void sub_804687C(Entity *, Position *, Position *, Item *, u32);
void HandleTripTrap(Entity *param_1, Entity *param_2)
void HandleTripTrap(Entity *pokemon, Entity *target)
{
u32 direction;
EntityInfo *info;
Position pos;
Item item;
if (param_2 != NULL) {
sub_806CDD4(param_2, 6, NUM_DIRECTIONS);
if (target != NULL) {
sub_806CDD4(target, 6, NUM_DIRECTIONS);
sub_803E708(0x10, 0x55);
sub_806CE68(param_2, NUM_DIRECTIONS);
info = param_2->info;
sub_806CE68(target, NUM_DIRECTIONS);
info = target->info;
if ((info->heldItem).flags & ITEM_FLAG_EXISTS) {
item = (info->heldItem);
(info->heldItem).flags = 0;
FillInventoryGaps();
sub_80421C0(param_2, 400);
sub_80421C0(target, 400);
direction = (info->action).direction & DIRECTION_MASK;
pos.x = (param_2->pos).x + gAdjacentTileOffsets[direction].x;
pos.y = (param_2->pos).y + gAdjacentTileOffsets[direction].y;
sub_804687C(param_1, &param_2->pos, &pos, &item, 1);
pos.x = (target->pos).x + gAdjacentTileOffsets[direction].x;
pos.y = (target->pos).y + gAdjacentTileOffsets[direction].y;
sub_804687C(pokemon, &target->pos, &pos, &item, 1);
}
}
}

View File

@ -141,8 +141,8 @@ gBldCnt: /* 202D7FC (AgbMain - VBlank_CB) */
gUnknown_202D7FE: /* 202D7FE (AgbMain - sub_800CD64) */
.space 0x2
gUnknown_202D800: /* 202D800 (sub_800CDA8 - sub_800CDC8) */
.space 0x8
.include "src/cpu.o"
.space 0x4
gUnknown_202D808: /* 202D808 (sub_800D2EC - sub_800D59C) */
.space 0x108
@ -362,14 +362,7 @@ gUnknown_202EE70: /* 202EE70 (sub_804513C - sub_80828E0) */
gUnknown_202EE76: /* 202EE76 (sub_804513C - sub_8082A08) */
.space 0x12
gDungeonPaletteFile: /* 202EE88 (sub_803E874 - SetDungeonBGColorRGB) */
.space 0x4
gUnknown_202EE8C: /* 202EE8C (sub_803E490 - SetDungeonBGColorRGB) */
.space 0x300
gUnknown_202F18C: /* 202F18C (LoadDungeonTilesetAssets - sub_8049820) */
.space 0x4
gUnknown_202F190: /* 202F190 (GetTileSafe) */
.space 0x18
.include "src/dungeon_map_access.o"
gUnknown_202F1A8: /* 202F1A8 (sub_8043CE4 - sub_8051A74) */
.space 0x1
@ -506,8 +499,7 @@ gUnknown_202F30C: /* 202F30C (sub_8067A80 - sub_8067A80) */
gUnknown_202F310: /* 202F310 (sub_8067A80 - sub_8068310) */
.space 0x4
gWalkableTileToCrossableTerrain: /* 202F314 (LoadDungeonTilesetAssets - GetCrossableTerrain) */
.space 0x8
.include "src/dungeon_movement.o"
gUnknown_202F31C: /* 202F31C (sub_80723D0 - sub_80725A4) */
.space 0x8
@ -519,12 +511,7 @@ gUnknown_202F32C: /* 202F32C (xxx_dungeon_8042F6C - sub_8072CF4) */
gUnknown_202F32D: /* 202F32D (sub_8072CF4 - UseAttack) */
.space 0x3
gPotentialItemTargetDirections: /* 202F330 (DecideUseItem - TargetThrownItem) */
.space 0x20
gTargetAhead: /* 202F350 (FindStraightThrowableTargets - TargetThrownItem) */
.space 0x8
gPotentialItemTargetWeights: /* 202F358 (DecideUseItem - TargetThrownItem) */
.space 0x20
.include "src/dungeon_ai_items.o"
gUnknown_202F378: /* 202F378 (sub_8074FB0 - UseAttack) */
.space 0x8

View File

@ -72,11 +72,7 @@ gUnknown_203B0B2: /* 203B0B2 */
.include "src/flash.o"
.space 0x3
gUnknown_203B0B8: /* 203B0B8 (sub_800CB20 - sub_800CB50) */
.space 0x4
gRawKeyInput: /* 203B0BC (sub_800CB20 - ReadKeyInput) */
.space 0x2
.include "src/code_800C9CC.o"
gUnknown_203B0BE: /* 203B0BE (sub_800CDA8) */
.space 0xE
@ -260,8 +256,7 @@ gUnknown_203B420: /* 203B420 (sub_80462AC) */
gUnknown_203B428: /* 203B428 (sub_80462AC) */
.space 0x8
gUnknown_203B430: /* 203B430 (GetTile - sub_8049840) */
.space 0x4
.include "src/dungeon_map_access.o"
gUnknown_203B434: /* 203B434 (sub_80521D0 - sub_8072CF4) */
.space 0x4
@ -272,8 +267,7 @@ gUnknown_203B438: /* 203B438 (sub_8055FA0 - sub_8056F80) */
gUnknown_203B43C: /* 203B43C (sub_8065FB4) */
.space 0x4
gNumPotentialTargets: /* 203B440 (DecideUseItem - TargetThrownItem) */
.space 0x4
.include "src/dungeon_ai_items.o"
gUnknown_203B444: /* 203B444 (sub_807DF38) */
.space 0xC
@ -288,13 +282,10 @@ gLeaderPointer: /* 203B450 (xxx_dungeon_8042F6C - sub_8082280) */
.include "src/rescue_team_info.o"
.include "src/friend_area.o"
.include "src/game_options.o"
.include "src/code_8094D28.o"
gUnknown_203B470: /* 203B470 (sub_8094D28 - sub_8094E4C) */
.space 0x4
gUnknown_203B474: /* 203B474 (sub_8094E4C) */
.space 0x8
.include "src/play_time.o"
.include "src/code_8094F88.o"
.include "src/code_80958E8.o"

View File

@ -14,8 +14,7 @@ gUnknown_3000E94: /* 3000E94 */
gUnknown_3001018: /* 3001018 */
.space 0x180
gUnknown_3001198: /* 3001198 */
.space 0x9C0
.include "src/code_8094D28.o"
iwramClearEnd:
unk_code_ram: /* 3001B58 */
@ -28,18 +27,11 @@ gUnknown_3001B5A: /* 3001B5A */
.include "src/code_8023144.o"
.include "src/code_8023868.o"
gUnknown_3001B64: /* 3001B64 */
.space 0x4
gUnknown_3001B68: /* 3001B68 */
.space 0x4
.include "src/code_809A560.o"
.include "src/code_809C5C4.o"
.include "src/ground_map.o"
.include "src/ground_map_2.o"
gUnknown_3001B7C: /* 3001B7C */
.space 0x4
.include "src/ground_sprite.o"
gUnknown_3001B80: /* 3001B80 */
.space 0x4