Match sub_8037810

This commit is contained in:
Kermalis 2024-11-30 21:14:52 -05:00
parent 7599f7d154
commit 1c70293fb8
42 changed files with 210 additions and 320 deletions

View File

@ -253,7 +253,7 @@ _080992CC: .4byte gUnknown_203B49C
_080992D0: .4byte gUnknown_203B49D
_080992D4: .4byte gUnknown_20398C4
_080992D8: .4byte gUnknown_2039950
_080992DC: .4byte gUnknown_20398D8
_080992DC: .4byte gUnknown_20398C8 + 0x10
thumb_func_end sub_809927C
thumb_func_start sub_80992E0

View File

@ -279,7 +279,7 @@ _0800177A:
bx r1
thumb_func_end GetScriptVarValue
@ https://decomp.me/scratch/xF3HH
@ https://decomp.me/scratch/5F0gW [100% - DizzyEggg]
thumb_func_start GetScriptVarArrayValue
GetScriptVarArrayValue:
push {r4,r5,lr}

View File

@ -5,6 +5,8 @@
.text
@ https://decomp.me/scratch/QRjxB - more up to date but incomplete
@ https://decomp.me/scratch/aOcQq - more complete but using outdated definitions
thumb_func_start HandleAction
HandleAction:
push {r4-r7,lr}

View File

@ -5,118 +5,6 @@
.text
thumb_func_start sub_8037810
sub_8037810:
push {r4-r6,lr}
ldr r6, _080378FC
ldr r0, [r6]
movs r5, 0xDE
lsls r5, 1
adds r0, r5
movs r1, 0
movs r2, 0x8
bl MemoryFill8
ldr r0, [r6]
movs r4, 0xE2
lsls r4, 1
adds r0, r4
movs r1, 0
movs r2, 0x8
bl MemoryFill8
ldr r0, [r6]
adds r5, r0, r5
movs r1, 0
movs r2, 0
str r1, [r5]
str r2, [r5, 0x4]
adds r4, r0, r4
str r1, [r4]
str r2, [r4, 0x4]
movs r2, 0xE6
lsls r2, 1
adds r0, r2
movs r1, 0
movs r2, 0x30
bl MemoryFill8
ldr r0, [r6]
movs r3, 0xFE
lsls r3, 1
adds r0, r3
movs r1, 0
movs r2, 0x30
bl MemoryFill8
ldr r0, [r6]
movs r1, 0x8B
lsls r1, 2
adds r0, r1
movs r1, 0
movs r2, 0x30
bl MemoryFill8
ldr r0, [r6]
movs r2, 0x97
lsls r2, 2
adds r0, r2
movs r1, 0
movs r2, 0x30
bl MemoryFill8
ldr r0, [r6]
movs r3, 0xA3
lsls r3, 2
adds r0, r3
movs r1, 0
movs r2, 0x30
bl MemoryFill8
ldr r0, [r6]
movs r1, 0xC5
lsls r1, 2
adds r0, r1
movs r1, 0
movs r2, 0x30
bl MemoryFill8
ldr r0, [r6]
movs r2, 0xAF
lsls r2, 2
adds r0, r2
movs r1, 0
movs r2, 0x58
bl MemoryFill8
ldr r0, [r6]
movs r3, 0xD1
lsls r3, 2
adds r0, r3
movs r1, 0
movs r2, 0x58
bl MemoryFill8
ldr r0, [r6]
movs r1, 0xE7
lsls r1, 2
adds r0, r1
movs r1, 0
movs r2, 0xB4
bl MemoryFill8
ldr r0, [r6]
movs r2, 0x8A
lsls r2, 3
adds r0, r2
movs r1, 0
movs r2, 0xB4
bl MemoryFill8
ldr r2, [r6]
movs r3, 0xB1
lsls r3, 2
adds r0, r2, r3
movs r1, 0
strh r1, [r0]
adds r3, 0x88
adds r0, r2, r3
strh r1, [r0]
pop {r4-r6}
pop {r0}
bx r0
.align 2, 0
_080378FC: .4byte sUnknown_203B35C
thumb_func_end sub_8037810
thumb_func_start sub_8037900
sub_8037900:
push {r4,lr}

View File

@ -1012,7 +1012,14 @@ gUnknown_80B7DF8:
.global gVectorDirections
gVectorDirections: @ 80B7E3C
.4byte 0, 1, 1, 1, 1, 0, 1, -1, 0, -1, -1, -1, -1, 0, -1, 1
.4byte 0, 1 @N
.4byte 1, 1 @NE
.4byte 1, 0 @E
.4byte 1, -1 @SE
.4byte 0, -1 @S
.4byte -1, -1 @SW
.4byte -1, 0 @W
.4byte -1, 1 @NW
@ ???
.string "pksdir0\0"

View File

@ -8,10 +8,6 @@ void sub_80993C0(bool8);
void sub_80993D8(void);
void sub_80993E4(void);
// UNUSED
void sub_80993F0(void);
// ------
void sub_8099648(void);
void nullsub_103(void);
void sub_809965C(void);

View File

@ -3,8 +3,9 @@
#include "structs/str_position.h"
typedef struct ScriptCommand {
// size: 0x10
// size: 0x10
typedef struct ScriptCommand
{
/* 0x0 */ u8 op;
/* 0x1 */ u8 argByte;
/* 0x2 */ s16 argShort;
@ -13,49 +14,45 @@ typedef struct ScriptCommand {
/* 0xC */ const u8* argPtr;
} ScriptCommand;
// size: 0xC
typedef struct ScriptInfoSmall
{
// size: 0xC (3 padding)
/* 0x0 */ const ScriptCommand *ptr;
/* 0x4 */ s16 state;
/* 0x6 */ s16 group;
/* 0x8 */ s8 sector;
} ScriptInfoSmall;
// size: 0xC
typedef struct ScriptInfo
{
// size: 0xC (1 padding)
/* 0x0 */ const ScriptCommand *ptr;
/* 0x4 */ const ScriptCommand *ptr2;
/* 0x8 */ s16 group;
/* 0xA */ s8 sector;
} ScriptInfo;
// size: 0x4
typedef union ScriptUnion1632 {
s32 raw;
s16 arr[2];
} ScriptUnion1632;
// size: 0x60
typedef struct ScriptData
{
// size: 0x60
/* 0x00 */ s16 state;
/* 0x02 */ s16 savedState;
/* 0x04 */ ScriptInfo script;
// padding
/* 0x10 */ ScriptInfo savedScript;
// padding
/* 0x1C */ const ScriptCommand *curPtr;
/* 0x20 */ u8 curScriptOp;
// padding
/* 0x22 */ u16 unk22;
/* 0x22 */ s16 unk22;
/* 0x24 */ u16 unk24;
/* 0x26 */ s8 unk26;
// padding
/* 0x28 */ s16 branchDiscriminant;
/* 0x2A */ s16 unk2A;
/* 0x2C */ u16 unk2C;
// padding
/* 0x2C */ s16 unk2C;
/* 0x30 */ s32 unk30;
/* 0x34 */ PixelPos pos1;
/* 0x3C */ PixelPos pos2;
@ -63,7 +60,6 @@ typedef struct ScriptData
/* 0x48 */ s32 unk48;
/* 0x4C */ u8 unk4C;
/* 0x4D */ u8 unk4D;
// padding
// ultimately accessed as ldrb, doesn't work as array of u32-sized structs, needs union
/* 0x50 */ union {
u8 buf[16];
@ -71,11 +67,10 @@ typedef struct ScriptData
} localVars;
} ScriptData;
// size: 0x54
typedef struct CallbackData
{
// size: 0x54
/* 0x00 */ u16 maybeId;
// padding
// All callbacks take the parentObject as first parameter
/* 0x04 */ s16 (*getIndex)(void*); // id related
/* 0x08 */ void (*getSize)(void*, PixelPos *out);
@ -87,28 +82,27 @@ typedef struct CallbackData
/* 0x20 */ void (*setPositionBounds)(void*, PixelPos *from, PixelPos *to);
/* 0x24 */ bool8 (*moveReal)(void*, PixelPos*);
/* 0x28 */ void (*setPosHeight)(void*, u32 height);
/* 0x2C */ void (*setDirection)(void*, s8 dir); // direction must be signed char!
/* 0x2C */ s32 (*setDirection)(void*, s8 dir); // direction must be signed char!
/* 0x30 */ void (*setEventIndex)(void*, u16);
/* 0x34 */ void (*livesOnlyNullsub)(void*, u16);
/* 0x38 */ void (*func38)(void*, s16, u32);
/* 0x3C */ void (*setFlags)(void*, u32 bits);
/* 0x40 */ void (*clearFlags)(void*, u32 bits);
/* 0x44 */ void (*func44_livesOnlySpriteRelated)(void*, u32);
/* 0x48 */ void (*moveRelative)(void*, PixelPos*);
/* 0x48 */ s32 (*moveRelative)(void*, PixelPos*);
/* 0x4C */ bool8 (*func4C_spriteRelatedCheck)(void*);
/* 0x50 */ bool8 (*func50_spriteRelated)(void*);
} CallbackData;
// size: 0xE4
typedef struct Action
{
// size: 0xE4
/* 0x00 */ const struct CallbackData *callbacks;
/* 0x04 */ void *parentObject; // struct GroundObject *
/* 0x08 */ s16 unk8[2]; // id?
/* 0x0C */ ScriptUnion1632 unkC;
/* 0x10 */ s16 group;
/* 0x12 */ s8 sector;
// padding
/* 0x14 */ const ScriptCommand *predefinedScripts[4];
/* 0x24 */ ScriptData scriptData;
/* 0x84 */ ScriptData scriptData2;
@ -203,7 +197,7 @@ void InitScriptData(ScriptData *a0);
u8 GroundScriptCheckLockCondition(Action *param_1, s16 param_2);
void InitAction2(Action *action);
void GetFunctionScript(Action *param_1, ScriptInfoSmall *script, s16 index);
bool8 GroundScriptLockCond(Action *param_1, s16 index, u32 param_3);
bool8 GroundScriptLockCond(Action *param_1, s16 index, s32 param_3);
bool8 ActionResetScriptData(Action *param_1, const DebugLocation *unused);
bool8 GroundScript_ExecutePP(Action *, s32 *, ScriptInfoSmall *, const DebugLocation *unused);
const ScriptCommand *FindLabel(Action *action, s32 r1);

View File

@ -7,10 +7,7 @@
// size: 0x8
typedef struct unkStruct_8035D94
{
union {
u8 itemIndex_u8;
u32 itemIndex_u32;
} itemIndex;
u8 itemIndex;
s32 numItems;
} unkStruct_8035D94;

View File

@ -66,17 +66,11 @@ extern s32 gHeapCount;
void InitHeap(void);
void MemoryClear8(u8 *dest, s32 size);
void MemoryClear8(void *dest, s32 size);
void MemoryClear16(u16 *dest, s32 size);
void MemoryClear32(u32 *dest, s32 size);
void MemoryFill8(u8 *dest, u8 value, s32 size);
void MemoryFill8(void *dest, u8 value, s32 size);
void MemoryFill16(u16 *dest, u16 value, s32 size);
void MemoryFill32(u32 *dest, u32 value, s32 size);
void MemoryCopy8(u8 *dest, u8 *src, s32 size);
void MemoryCopy16(u16 *dest, u16 *src, s32 size);
void MemoryCopy32(u32 *dest, u32 *src, s32 size);
void MemoryCopy8(u8 *dest, u8 *src, s32 size);
void MemoryCopy16(u16 *dest, u16 *src, s32 size);
void MemoryCopy8(void *dest, void *src, s32 size);
void MemoryCopy32(u32 *dest, u32 *src, s32 size);
void InitHeapInternal(void);

View File

@ -28,8 +28,8 @@ typedef struct unkStruct_203B35C
PokemonStruct1 unk2BC;
unkStruct_203B480 unk314;
PokemonStruct1 unk344;
u8 unk39C[180];
u8 unk450[180];
u8 unk39C[0xB4]; // unkStruct_803B344?
u8 unk450[0xB4]; // unkStruct_803B344?
} unkStruct_203B35C;
void sub_8036FDC(s32);

View File

@ -194,13 +194,8 @@ typedef struct Moves
// size: 0x208
typedef struct EntityInfo
{
// This has different purposes for Pokémon, items, and traps.
// Pokemon: MovementFlag
// Items: ItemFlag
// Traps: TrapType
/* 0x0 */ u16 flags;
/* 0x2 */ s16 id; // Pokémon species or item ID.
// Everything from here on only applies to Pokémon.
/* 0x0 */ u16 flags; // MovementFlag
/* 0x2 */ s16 id; // Pokémon species.
/* 0x4 */ s16 apparentID; // Shows a different Pokémon when using Transform.
/* 0x6 */ bool8 isNotTeamMember;
/* 0x7 */ bool8 isTeamLeader;

View File

@ -25,11 +25,11 @@ typedef struct MenuInputStruct
s32 unk0;
u16 unk4;
s16 unk6;
DungeonPos unk8; // Maybe DungeonPos
DungeonPos unk8;
s16 unkC; // Maybe DungeonPos
s16 unkE;
u32 unk10;
DungeonPos unk14; // Maybe DungeonPos
DungeonPos unk14;
/* 0x18 */ s16 menuIndex;
s16 unk1A;
s16 unk1C;

View File

@ -44,7 +44,6 @@ typedef struct UnkTextStruct2_sub
} unk0;
} UnkTextStruct2_sub;
typedef struct UnkTextStruct2_sub2
{
u8 f0;

View File

@ -46,7 +46,7 @@ void sub_800DAC0(u32 fileSelection)
sub_800DB7C();
}
gUnknown_203B0CC = MemoryAlloc(sizeof(struct unkStruct_203B0CC), 0xb);
MemoryClear8((u8 *)gUnknown_203B0CC, sizeof(struct unkStruct_203B0CC));
MemoryClear8(gUnknown_203B0CC, sizeof(struct unkStruct_203B0CC));
gUnknown_203B0CC->fileSelection = fileSelection;
for(index = 0, preload = &gUnknown_203B0CC->unk0[index]; index < 0x20; index++, preload++)
{

View File

@ -37,7 +37,7 @@ void sub_800ED38(s32 r0)
if(gUnknown_203B0D0 == 0)
{
gUnknown_203B0D0 = MemoryAlloc(sizeof(struct unkStruct_203B0D0), 0xB);
MemoryClear8((u8 *)gUnknown_203B0D0, sizeof(struct unkStruct_203B0D0));
MemoryClear8(gUnknown_203B0D0, sizeof(struct unkStruct_203B0D0));
}
gUnknown_203B0D0->unk0 = r0;
}

View File

@ -46,14 +46,14 @@ void DeletePokemonDungeonSprite(s32 id)
{
DungeonPokemonSprite *dSprite;
if(gDungeonPokemonSprites == NULL)
if (gDungeonPokemonSprites == NULL)
return;
dSprite = GetDungeonPokemonSprite(id);
if(dSprite == NULL)
if (dSprite == NULL)
return;
MemoryClear8((u8 *)dSprite, sizeof(DungeonPokemonSprite));
MemoryClear8(dSprite, sizeof(DungeonPokemonSprite));
}
void sub_800F958(s32 dungeonSpriteID, DungeonPos *pos,

View File

@ -60,8 +60,8 @@ void sub_8095118(void)
s32 index;
unkStruct_203B480 *unused;
MemoryFill8((u8*)gUnknown_203B480,0, 0x20 * sizeof(unkStruct_203B480));
MemoryFill8((u8*)gUnknown_203B484,0, sizeof(unkStruct_203B484));
MemoryFill8(gUnknown_203B480, 0, 0x20 * sizeof(unkStruct_203B480));
MemoryFill8(gUnknown_203B484, 0, sizeof(unkStruct_203B484));
for(index = 0; index < 0x20; index++){
// NOTE: we use a temp variable here to force the match
@ -138,7 +138,7 @@ void DeleteMailAtIndex(u8 index)
{
unkStruct_203B480 *unused;
MemoryFill8((u8*)&gUnknown_203B480[index],0,sizeof(unkStruct_203B480));
MemoryFill8(&gUnknown_203B480[index], 0, sizeof(unkStruct_203B480));
unused = &gUnknown_203B480[index];
gUnknown_203B480[index].mailType = 0;
unused = &gUnknown_203B480[index];

View File

@ -62,7 +62,7 @@ void sub_80993E4(void) {
*/
void sub_8099648(void);
NAKED void sub_80993F0(void)
UNUSED static NAKED void sub_80993F0(void)
{
asm_unified(" .text\n"
" push {r4-r7,lr}\n"

View File

@ -245,7 +245,7 @@ void sub_809D220(s32 r0, s32 r1, s32 r2)
gUnknown_20399E8.unk4 = r1;
}
bool32 sub_809D234(void)
bool8 sub_809D234(void)
{
return gUnknown_20399E8.unk8 != 0;
}
@ -392,7 +392,7 @@ extern s16 gUnknown_2039A34;
extern u8 gAnyScriptLocked;
extern u8 gScriptLocks[];
extern u8 gScriptLockConds[];
extern u32 gUnlockBranchLabels[];
extern s32 gUnlockBranchLabels[];
void sub_809D4B0(void)
{

View File

@ -43,7 +43,7 @@ void CreateDebugMenu(void)
if (sDebugMenu == NULL) {
sDebugMenu = MemoryAlloc(sizeof(struct DebugMenu), 8);
MemoryFill8((u8 *)sDebugMenu, 0, sizeof(struct DebugMenu));
MemoryFill8(sDebugMenu, 0, sizeof(struct DebugMenu));
}
for (i = 0; i < 4; i++)

View File

@ -319,7 +319,7 @@ u32 CreateFriendRescueMenu(void)
ResetUnusedInputStruct();
xxx_call_save_unk_text_struct_800641C(NULL, TRUE, TRUE);
gUnknown_203B33C = MemoryAlloc(sizeof(WonderMailStruct_203B33C), 8);
MemoryFill8((u8 *) gUnknown_203B33C, 0, sizeof(WonderMailStruct_203B33C));
MemoryFill8(gUnknown_203B33C, 0, sizeof(WonderMailStruct_203B33C));
gUnknown_203B33C->unk530 = 0;
gUnknown_203B33C->unk218 = -1;
gUnknown_203B33C->speciesNum = -1;
@ -954,13 +954,13 @@ void sub_8032828(void)
#endif //NONMATCHING
switch (gUnknown_203B33C->unk40) {
case 0x3:
MemoryFill8((u8*)&gUnknown_203B33C->unk48, 0, sizeof(unkStruct_203B480));
MemoryFill8((u8*)&gUnknown_203B33C->unk78, 0, sizeof(unkStruct_203B480));
MemoryFill8(&gUnknown_203B33C->unk48, 0, sizeof(unkStruct_203B480));
MemoryFill8(&gUnknown_203B33C->unk78, 0, sizeof(unkStruct_203B480));
gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unk48, &gUnknown_203B33C->unk78);
break;
case 0x2:
MemoryFill8((u8*)&gUnknown_203B33C->unk48, 0, sizeof(unkStruct_203B480));
MemoryFill8((u8*)&gUnknown_203B33C->unk78, 0, sizeof(unkStruct_203B480));
MemoryFill8(&gUnknown_203B33C->unk48, 0, sizeof(unkStruct_203B480));
MemoryFill8(&gUnknown_203B33C->unk78, 0, sizeof(unkStruct_203B480));
#ifdef NONMATCHING
// Regswaps
gUnknown_203B33C->unk48 = *GetMailatIndex(gUnknown_203B33C->unk218);
@ -973,13 +973,13 @@ void sub_8032828(void)
gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unk48, &gUnknown_203B33C->unk78);
break;
case 0x5:
MemoryFill8((u8*)&gUnknown_203B33C->unkA8, 0, sizeof(WonderMailStruct_203B2C0_sub));
MemoryFill8((u8*)&gUnknown_203B33C->unk130, 0, sizeof(WonderMailStruct_203B2C0_sub));
MemoryFill8(&gUnknown_203B33C->unkA8, 0, sizeof(WonderMailStruct_203B2C0_sub));
MemoryFill8(&gUnknown_203B33C->unk130, 0, sizeof(WonderMailStruct_203B2C0_sub));
gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unkA8, &gUnknown_203B33C->unk130);
break;
case 0x4:
MemoryFill8((u8*)&gUnknown_203B33C->unkA8, 0, sizeof(WonderMailStruct_203B2C0_sub));
MemoryFill8((u8*)&gUnknown_203B33C->unk130, 0, sizeof(WonderMailStruct_203B2C0_sub));
MemoryFill8(&gUnknown_203B33C->unkA8, 0, sizeof(WonderMailStruct_203B2C0_sub));
MemoryFill8(&gUnknown_203B33C->unk130, 0, sizeof(WonderMailStruct_203B2C0_sub));
gUnknown_203B33C->unkA8.pokemon.speciesNum = 0;
gUnknown_203B33C->unk130.pokemon.speciesNum = 0;
gUnknown_203B33C->unkA8.mail = *GetMailatIndex(gUnknown_203B33C->unk218);
@ -1093,13 +1093,13 @@ void sub_8032828(void)
if (gUnknown_203B33C->status == 0) {
switch (gUnknown_203B33C->unk40) {
case 0x6:
MemoryFill8((u8*)&gUnknown_203B33C->unk1B8, 0, 0x30);
MemoryFill8(&gUnknown_203B33C->unk1B8, 0, 0x30);
gUnknown_203B33C->unk1B8 = *GetMailatIndex(gUnknown_203B33C->unk218);
gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unk1B8, &gUnknown_203B33C->unk1E8);
break;
case 0x7:
MemoryFill8((u8*)&gUnknown_203B33C->unk1B8, 0, 0x30);
MemoryFill8((u8*)&gUnknown_203B33C->unk1E8, 0, 0x30);
MemoryFill8(&gUnknown_203B33C->unk1B8, 0, 0x30);
MemoryFill8(&gUnknown_203B33C->unk1E8, 0, 0x30);
gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unk1B8, &gUnknown_203B33C->unk1E8);
break;
}
@ -1654,7 +1654,7 @@ void sub_8033DBC(void)
unkStruct_203B480 *mail2;
return_var = sub_80154F0();
MemoryFill8((u8 *)&mail, 0, sizeof(unkStruct_203B480));
MemoryFill8(&mail, 0, sizeof(unkStruct_203B480));
switch(return_var)
{
case 3:
@ -1704,7 +1704,7 @@ void sub_8033DBC(void)
sub_80951FC(&mail);
mail2 = GetMailatIndex(GetMailIndex(1, mail.unk10.unk10));
mail2->mailType = 7;
MemoryFill8((u8 *)gUnknown_203B484, 0, sizeof(unkStruct_203B484));
MemoryFill8(gUnknown_203B484, 0, sizeof(unkStruct_203B484));
SetFriendRescueMenuState(0x40);
break;
case 24:
@ -2269,7 +2269,7 @@ void sub_8034848(void)
s32 temp;
if(sub_80144A4(&temp) == 0)
{
MemoryFill8((u8 *)&gUnknown_203B33C->item, 0 , sizeof(Item));
MemoryFill8(&gUnknown_203B33C->item, 0 , sizeof(Item));
gUnknown_203B33C->item.id = ITEM_NOTHING;
gUnknown_203B33C->item.quantity = 1;
gUnknown_203B33C->item.flags = 0;
@ -2299,7 +2299,7 @@ void sub_80348C4(void)
s32 temp;
if(sub_80144A4(&temp) == 0)
{
MemoryFill8((u8 *)&gUnknown_203B33C->item, 0 , sizeof(Item));
MemoryFill8(&gUnknown_203B33C->item, 0 , sizeof(Item));
gUnknown_203B33C->item.id = ITEM_NOTHING;
gUnknown_203B33C->item.quantity = 1;
gUnknown_203B33C->item.flags = 0;
@ -2550,7 +2550,7 @@ void sub_8034D74(void)
unkStruct_203B480 *mail2;
return_var = sub_80154F0();
MemoryFill8((u8 *)&mail, 0, sizeof(unkStruct_203B480));
MemoryFill8(&mail, 0, sizeof(unkStruct_203B480));
switch(return_var)
{
case 3:

View File

@ -4,7 +4,7 @@
extern u8 gAnyScriptLocked;
extern u8 gScriptLocks[];
extern u32 gUnlockBranchLabels[];
extern s32 gUnlockBranchLabels[];
extern u8 gScriptLockConds[];
extern u32 gUnknown_8116588;
@ -352,7 +352,7 @@ void GroundScriptLock(s16 index, s32 r1)
gAnyScriptLocked = 1;
}
bool8 GroundScriptLockCond(Action *param_1, s16 index, u32 param_3)
bool8 GroundScriptLockCond(Action *param_1, s16 index, s32 param_3)
{
s32 index_s32;

View File

@ -16,6 +16,13 @@
#include "ground_main.h"
#include "code_80A26CC.h"
// Size: unknown
typedef struct UnkAction3D
{
u8 fill0[0x4C];
u8 unk4C[10];
} UnkAction3D;
void GroundMap_Select(s16);
void GroundMap_SelectDungeon(s16, DungeonLocation*, u8);
void GroundMap_ExecuteEnter(s16);
@ -45,9 +52,9 @@ void FatalError(void* loc, char* fmt, ...) __attribute__((noreturn));
// Beware of the declarations without specified arguments, returning u32 or s32, these were quickly hacked in to get the code to compile and link
// The return values are almost certainly NOT correct and will need to be rechecked when moving to header files
char sub_8002984(s32, u8);
u32 VecDirection8Radial();
u32 SizedDeltaDirection4();
u8 SizedDeltaDirection8(PixelPos*, PixelPos*, PixelPos*, PixelPos*);
s8 VecDirection8Radial(PixelPos*);
s8 SizedDeltaDirection4(PixelPos*, PixelPos*, PixelPos*, PixelPos*);
s8 SizedDeltaDirection8(PixelPos*, PixelPos*, PixelPos*, PixelPos*);
bool8 sub_8021700(s32);
bool8 sub_802FCF0(void);
@ -60,7 +67,7 @@ void sub_80975A8(s16, bool8);
void sub_8098D1C(s32, u32, s32);
void sub_8098E18(s32, s32);
u32 sub_80999E8();
u32 sub_80999FC();
void sub_80999FC(s32);
u32 sub_8099A10();
u32 sub_8099A34();
u32 sub_8099A48();
@ -105,7 +112,7 @@ void sub_80A87AC(s32, s32);
void sub_80A8BD8(s16, s32*);
u32 sub_80A8C2C();
u32 sub_80A8C98();
char *sub_80A8D54(s16);
UnkAction3D *sub_80A8D54(s16);
s16 sub_80A8FD8(s32, PixelPos*);
s16 sub_80A8F9C(s32, PixelPos*);
u32 sub_80A9050();
@ -114,14 +121,14 @@ s16 sub_80AC448(s16, PixelPos*);
s32 sub_80AC49C(s16, PixelPos*);
s16 sub_80AD360(s16, PixelPos*);
s16 sub_80AD3B4(s16, PixelPos*);
u32 GroundLink_GetPos();
u32 GroundLink_GetArea();
u32 GroundLink_GetPos(s32, PixelPos *);
u32 GroundLink_GetArea(s32, PixelPos *, PixelPos *, PixelPos *);
void DeleteGroundEvents(void);
void DeleteGroundLives(void);
void DeleteGroundObjects(void);
void DeleteGroundEffects(void);
u32 sub_80A14E8(u32, u8, u32, u32);
s32 sub_80A14E8(Action *, u8, s32, s32);
s16 HandleAction(void *, DebugLocation *);
extern int gFormatArgs[10];
@ -131,7 +138,7 @@ extern s16 gUnknown_2039A32;
extern s16 gUnknown_2039A34;
extern struct { const char *unk0; s32 unk4; } gChoices[9];
extern char gUnknown_2039D98[12];
extern u8 gUnknown_2039D98[12];
extern int gNumChoices;
extern PixelPos gUnknown_81164DC;
@ -549,8 +556,8 @@ s32 ExecuteScriptCommand(Action *action) {
action->callbacks->getSize(action->parentObject, &pos2);
sub_80A8FD8(ret, &pos3);
sub_80A8F9C(ret, &pos4);
if ((tmp = (s8)SizedDeltaDirection8(&pos3, &pos4, &pos1, &pos2)) != -1 ||
(tmp = (s8)SizedDeltaDirection4(&pos1, &gUnknown_81164DC, &pos3, &gUnknown_81164DC)) != -1) {
if ((tmp = SizedDeltaDirection8(&pos3, &pos4, &pos1, &pos2)) != -1 ||
(tmp = SizedDeltaDirection4(&pos1, &gUnknown_81164DC, &pos3, &gUnknown_81164DC)) != -1) {
sub_80A9090(ret, tmp);
}
}
@ -761,11 +768,11 @@ s32 ExecuteScriptCommand(Action *action) {
return 2;
}
case 0x3d: {
struct { u8 pad[0x4c]; u8 unk4C[10]; } *unk; // unknown struct
UnkAction3D *unk;
int i;
if ((s16)curCmd.arg1 != -1) {
unk = (void*)sub_80A8D54(curCmd.arg1);
if (unk) {
unk = sub_80A8D54(curCmd.arg1);
if (unk != NULL) {
for (i = 0; i < 10; i++) {
gUnknown_2039D98[i] = unk->unk4C[i];
}
@ -1615,7 +1622,7 @@ s32 ExecuteScriptCommand(Action *action) {
GroundLink_GetPos((s16)curCmd.arg1, &pos2);
pos3.x = pos2.x - pos.x;
pos3.y = pos2.y - pos.y;
val = (s8)VecDirection8Radial(&pos3);
val = VecDirection8Radial(&pos3);
break;
}
case 0xc8: {
@ -1626,9 +1633,9 @@ s32 ExecuteScriptCommand(Action *action) {
action->callbacks->getSize(action->parentObject, &pos2);
sub_80A8FD8(tmp, &pos3);
sub_80A8F9C(tmp, &pos4);
val = (s8)SizedDeltaDirection8(&pos1, &pos2, &pos3, &pos4);
val = SizedDeltaDirection8(&pos1, &pos2, &pos3, &pos4);
if (val == -1) {
val = (s8)SizedDeltaDirection4(&pos1, &gUnknown_81164DC, &pos3, &gUnknown_81164DC);
val = SizedDeltaDirection4(&pos1, &gUnknown_81164DC, &pos3, &gUnknown_81164DC);
}
} else {
val = -1;
@ -1642,9 +1649,9 @@ s32 ExecuteScriptCommand(Action *action) {
action->callbacks->getHitboxCenter(action->parentObject, &pos1);
action->callbacks->getSize(action->parentObject, &pos2);
sub_80A8FD8(tmp, &pos3);
val = (s8)SizedDeltaDirection8(&pos1, &pos2, &pos3, &gUnknown_81164DC);
val = SizedDeltaDirection8(&pos1, &pos2, &pos3, &gUnknown_81164DC);
if (val == -1) {
val = (s8)SizedDeltaDirection4(&pos1, &gUnknown_81164DC, &pos3, &gUnknown_81164DC);
val = SizedDeltaDirection4(&pos1, &gUnknown_81164DC, &pos3, &gUnknown_81164DC);
}
} else {
val = -1;
@ -1831,9 +1838,9 @@ s32 ExecuteScriptCommand(Action *action) {
}
}
UNUSED u32 sub_80A1440(u32 r0, u32 r1, u32 r2)
UNUSED u32 sub_80A1440(s32 r0, s32 r1, s32 r2)
{
return sub_80A14E8(0, r0, r1, r2);
return sub_80A14E8(NULL, r0, r1, r2);
}
UNUSED bool8 GroundScript_ExecuteTrigger(s16 r0)

View File

@ -6,7 +6,6 @@
extern u8 gAnyScriptLocked;
extern u8 gScriptLocks[];
extern u32 gUnlockBranchLabels[];
extern u8 gScriptLockConds[];
extern u8 gUnknown_8116848[];

View File

@ -155,8 +155,8 @@ void CreateLoadScreen(u32 currMenu)
int index;
if (gLoadScreen == NULL) {
gLoadScreen = MemoryAlloc(sizeof(struct LoadScreen),8);
MemoryFill8((u8 *)gLoadScreen,0,sizeof(struct LoadScreen));
gLoadScreen = MemoryAlloc(sizeof(struct LoadScreen), 8);
MemoryFill8(gLoadScreen, 0, sizeof(struct LoadScreen));
}
gLoadScreen->currMenu = currMenu;
for(index = 0; index < 4; index++){

View File

@ -46,7 +46,7 @@ void InitMainMenu(void)
{
if (sMainMenu == NULL) {
sMainMenu = MemoryAlloc(sizeof(MainMenu1Work), 8);
MemoryFill8((u8 *)sMainMenu, 0, sizeof(MainMenu1Work));
MemoryFill8(sMainMenu, 0, sizeof(MainMenu1Work));
}
sMainMenu->currMenu = MENU_NO_SCREEN_CHANGE;
@ -369,7 +369,7 @@ unkStruct_8035D94 *sub_8035D94(void)
void sub_8035DA0(void)
{
sMainMenu->unk30.itemIndex.itemIndex_u8 = ITEM_NOTHING;
sMainMenu->unk30.itemIndex = ITEM_NOTHING;
sMainMenu->unk30.numItems = 0;
}

View File

@ -28,7 +28,7 @@ void DrawMainMenu(void)
if (sUnknown_203B34C == NULL) {
sUnknown_203B34C = MemoryAlloc(sizeof(MainMenu2Work), 8);
MemoryFill8((u8 *)sUnknown_203B34C, 0, sizeof(MainMenu2Work));
MemoryFill8(sUnknown_203B34C, 0, sizeof(MainMenu2Work));
}
for (i = 0; i < 4; i++)

View File

@ -17,68 +17,69 @@ void InitHeap(void)
InitHeapInternal();
}
void MemoryClear8(u8 *dest, s32 size)
void MemoryClear8(void *dest, s32 size)
{
while (size > 0)
{
u8 *cur = dest;
while (size > 0) {
size -= 1;
*dest++ = 0;
*cur++ = 0;
}
}
void MemoryClear16(u16 *dest, s32 size)
{
while (size > 0)
{
while (size > 0) {
size -= 2;
*dest++ = 0;
}
}
void MemoryClear32(u32 *dest, s32 size)
UNUSED static void MemoryClear32(u32 *dest, s32 size)
{
CpuClear(dest, size);
}
void MemoryFill8(u8 *dest, u8 value, s32 size)
void MemoryFill8(void *dest, u8 value, s32 size)
{
while (size > 0)
{
u8 *cur = dest;
while (size > 0) {
size -= 1;
*dest++ = value;
*cur++ = value;
}
}
void MemoryFill16(u16 *dest, u16 value, s32 size)
{
while (size > 0)
{
while (size > 0) {
size -= 2;
*dest++ = value;
}
}
void MemoryFill32(u32 *dest, u32 value, s32 size)
UNUSED static void MemoryFill32(u32 *dest, u32 value, s32 size)
{
while (size > 0)
{
while (size > 0) {
size -= 4;
*dest++ = value;
}
}
void MemoryCopy8(u8 *dest, u8 *src, s32 size)
void MemoryCopy8(void *dest, void *src, s32 size)
{
while (size > 0)
{
u8 *dCur = dest;
u8 *sCur = src;
while (size > 0) {
size -= 1;
*dest++ = *src++;
*dCur++ = *sCur++;
}
}
void MemoryCopy16(u16 *dest, u16 *src, s32 size)
UNUSED static void MemoryCopy16(u16 *dest, u16 *src, s32 size)
{
while (size > 0)
{
while (size > 0) {
size -= 2;
*dest++ = *src++;
}
@ -86,8 +87,7 @@ void MemoryCopy16(u16 *dest, u16 *src, s32 size)
void MemoryCopy32(u32 *dest, u32 *src, s32 size)
{
while (size > 0)
{
while (size > 0) {
size -= 4;
*dest++ = *src++;
}
@ -149,31 +149,22 @@ u8 xxx_memory_attr_related(u32 r0)
{
u32 temp;
u32 return_var;
if(r0 == 0)
{
return 0;
}
if((r0 & 8) != 0)
{
return 4;
}
temp = r0 & 7;
if(temp == 7)
{
return_var = 1;;
}
else if(temp == 1)
{
if (r0 == 0)
return 0;
if (r0 & 8)
return 4;
temp = r0 & 7; // Doesn't match with switch statement
if (temp == 7)
return_var = 1;
else if (temp == 1)
return_var = 2;
}
else if(temp == 3)
{
else if (temp == 3)
return_var = 3;
}
else
{
return_var = 5;
}
return return_var;
}
}

View File

@ -708,21 +708,21 @@ bool8 IsMoveEnabled(s32 index, Move *moves)
bool8 sub_8093318(s32 param_1, Move *moves)
{
Move dest_struct[MAX_MON_MOVES * 2];
MemoryCopy8((void *)dest_struct, (void *)moves, sizeof(Move) * MAX_MON_MOVES * 2);
MemoryCopy8(dest_struct, moves, sizeof(dest_struct));
return TryLinkMovesAfter(param_1, dest_struct);
}
bool8 sub_809333C(s32 param_1, Move *moves)
{
Move dest_struct[MAX_MON_MOVES * 2];
MemoryCopy8((void *)dest_struct, (void *)moves, sizeof(Move) * MAX_MON_MOVES * 2);
MemoryCopy8(dest_struct, moves, sizeof(dest_struct));
return UnlinkMovesAfter(param_1, dest_struct);
}
UNUSED static bool8 sub_8093360(s32 param_1, Move *moves)
{
Move dest_struct[MAX_MON_MOVES * 2];
MemoryCopy8((void *)dest_struct, (void *)moves, sizeof(Move) * MAX_MON_MOVES * 2);
MemoryCopy8(dest_struct, moves, sizeof(dest_struct));
return sub_80933D8(param_1, dest_struct);
}

View File

@ -19,12 +19,11 @@
#include "text1.h"
// TODO: MAKE STATIC WHEN other_menus1.s IS DED
EWRAM_DATA_2 unkStruct_203B35C *sUnknown_203B35C = {0};
/*static*/ EWRAM_DATA_2 unkStruct_203B35C *sUnknown_203B35C = {0};
#include "data/other_menus1.h"
// other_menus1.s
extern void sub_8037810(void);
extern void sub_8037900(void);
// text.s
extern void xxx_call_update_bg_vram();
@ -36,6 +35,7 @@ static void sub_8037400(void);
static void sub_80376CC(void);
static void sub_8037748(void);
static u32 sub_8037798(void);
static void sub_8037810(void);
void sub_8036FDC(s32 param_1)
{
@ -48,7 +48,7 @@ void sub_8036FDC(s32 param_1)
if (sUnknown_203B35C == NULL) {
sUnknown_203B35C = MemoryAlloc(sizeof(unkStruct_203B35C), 8);
MemoryFill8((u8 *)sUnknown_203B35C, 0, sizeof(unkStruct_203B35C));
MemoryFill8(sUnknown_203B35C, 0, sizeof(unkStruct_203B35C));
}
sUnknown_203B35C->unk0 = param_1;
@ -57,7 +57,7 @@ void sub_8036FDC(s32 param_1)
for (index1 = 0; index1 < 2; index1++) {
sUnknown_203B35C->unk1BC[index1].numItems = 0;
sUnknown_203B35C->unk1BC[index1].itemIndex.itemIndex_u8 = ITEM_NOTHING;
sUnknown_203B35C->unk1BC[index1].itemIndex = ITEM_NOTHING;
}
for (index2 = 0; index2 < 4; index2++)
@ -206,8 +206,8 @@ static void sub_80371B8(void)
if (sUnknown_203B35C->linkStatus != COMMS_GOOD && sUnknown_203B35C->unk0 == 0) {
item = sub_8035D94();
if (item->itemIndex.itemIndex_u8 != ITEM_NOTHING && item->numItems != 0)
gTeamInventoryRef->teamStorage[item->itemIndex.itemIndex_u8] += item->numItems;
if (item->itemIndex != ITEM_NOTHING && item->numItems != 0)
gTeamInventoryRef->teamStorage[item->itemIndex] += item->numItems;
}
}
}
@ -432,3 +432,27 @@ static u32 sub_8037798(void)
}
return nextMenu;
}
static void sub_8037810(void)
{
unkStruct_8035D94 blank = {0, 0};
MemoryFill8(&sUnknown_203B35C->unk1BC[0], 0, sizeof(unkStruct_8035D94));
MemoryFill8(&sUnknown_203B35C->unk1BC[1], 0, sizeof(unkStruct_8035D94));
sUnknown_203B35C->unk1BC[0] = blank;
sUnknown_203B35C->unk1BC[1] = blank;
MemoryFill8(&sUnknown_203B35C->unk1CC, 0, sizeof(unkStruct_203B480));
MemoryFill8(&sUnknown_203B35C->unk1FC, 0, sizeof(unkStruct_203B480));
MemoryFill8(&sUnknown_203B35C->unk22C, 0, sizeof(unkStruct_203B480));
MemoryFill8(&sUnknown_203B35C->unk25C, 0, sizeof(unkStruct_203B480));
MemoryFill8(&sUnknown_203B35C->unk28C, 0, sizeof(unkStruct_203B480));
MemoryFill8(&sUnknown_203B35C->unk314, 0, sizeof(unkStruct_203B480));
MemoryFill8(&sUnknown_203B35C->unk2BC, 0, sizeof(PokemonStruct1));
MemoryFill8(&sUnknown_203B35C->unk344, 0, sizeof(PokemonStruct1));
MemoryFill8(sUnknown_203B35C->unk39C, 0, 0xb4); // unkStruct_803B344?
MemoryFill8(sUnknown_203B35C->unk450, 0, 0xb4); // unkStruct_803B344?
sUnknown_203B35C->unk2BC.speciesNum = 0;
sUnknown_203B35C->unk344.speciesNum = 0;
}

View File

@ -191,15 +191,15 @@ static void sub_8037E38(unkStruct_8035D94 *param_1,unkStruct_8035D94 *param_2)
r4 = sub_800D588() == 0 ? param_2 : param_1;
r3 = sub_800D588() == 0 ? param_1 : param_2;
if ((r4->itemIndex).itemIndex_u8 == (r3->itemIndex).itemIndex_u8) {
load = gTeamInventoryRef->teamStorage[r4->itemIndex.itemIndex_u8];
if (r4->itemIndex == r3->itemIndex) {
load = gTeamInventoryRef->teamStorage[r4->itemIndex];
load += r3->numItems;
gTeamInventoryRef->teamStorage[r4->itemIndex.itemIndex_u8] = load;
gTeamInventoryRef->teamStorage[r4->itemIndex] = load;
}
else {
load = gTeamInventoryRef->teamStorage[r3->itemIndex.itemIndex_u8];
load = gTeamInventoryRef->teamStorage[r3->itemIndex];
load += r3->numItems;
gTeamInventoryRef->teamStorage[r3->itemIndex.itemIndex_u8] = load;
gTeamInventoryRef->teamStorage[r3->itemIndex] = load;
}
}
@ -246,7 +246,7 @@ static void sub_8037EBC(WonderMailStruct_203B2C0_sub *param_1, WonderMailStruct
}
else
{
MemoryFill8((u8 *)gUnknown_203B484, 0, sizeof(unkStruct_203B484));
MemoryFill8(gUnknown_203B484, 0, sizeof(unkStruct_203B484));
gUnknown_203B484->unk4.speciesNum = MONSTER_NONE;
}
}
@ -303,8 +303,8 @@ static s32 sub_8038014(unkStruct_8035D94 *param_1,unkStruct_8035D94 *param_2)
r4 = sub_800D588() == 0 ? param_2 : param_1;
r3 = sub_800D588() == 0 ? param_1 : param_2;
if ((r4->itemIndex).itemIndex_u8 == (r3->itemIndex).itemIndex_u8) {
r2 = gTeamInventoryRef->teamStorage[r4->itemIndex.itemIndex_u8];
if (r4->itemIndex == r3->itemIndex) {
r2 = gTeamInventoryRef->teamStorage[r4->itemIndex];
r2 += r3->numItems;
if (r2 > 999) {
linkStatus = COMMS_NO_ROOM_STORAGE;
@ -313,7 +313,7 @@ static s32 sub_8038014(unkStruct_8035D94 *param_1,unkStruct_8035D94 *param_2)
linkStatus = COMMS_GOOD;
}
else {
r2 = gTeamInventoryRef->teamStorage[r3->itemIndex.itemIndex_u8];
r2 = gTeamInventoryRef->teamStorage[r3->itemIndex];
r2 += r3->numItems;
if (r2 > 999) {
linkStatus = COMMS_NO_ROOM_STORAGE;

View File

@ -262,7 +262,7 @@ void CreateRescuePasswordMenu(u32 currMenu)
if(gRescuePasswordMenu == NULL)
{
gRescuePasswordMenu = MemoryAlloc(sizeof(struct RescuePasswordMenu), 8);
MemoryFill8((u8 *)gRescuePasswordMenu, 0, sizeof(struct RescuePasswordMenu));
MemoryFill8(gRescuePasswordMenu, 0, sizeof(struct RescuePasswordMenu));
}
for(counter = 0; counter < 4; counter++)
@ -296,7 +296,7 @@ void CreateRescuePasswordMenu(u32 currMenu)
break;
case MENU_DISPLAY_RESCUE_PASSWORD:
temp = GetMailatIndex(0x1F);
MemoryFill8((u8 *)temp, 0, sizeof(unkStruct_203B480));
MemoryFill8(temp, 0, sizeof(unkStruct_203B480));
temp->mailType = 2;
temp->item.id = ITEM_NOTHING;
sub_8031D70(0x1F, 0);
@ -359,7 +359,7 @@ s32 UpdateRescuePasswordMenu(void)
case 3:
case 5:
iVar7 = sub_80154F0();
MemoryFill8((u8 *)&mail, 0, sizeof(unkStruct_203B480));
MemoryFill8(&mail, 0, sizeof(unkStruct_203B480));
switch(iVar7)
{
case 1:
@ -426,7 +426,7 @@ s32 UpdateRescuePasswordMenu(void)
sub_80951FC(&mail);
mailPtr1 = GetMailatIndex(GetMailIndex(1, mail.unk10.unk10));
mailPtr1->mailType = WONDER_MAIL_TYPE_OKD;
MemoryFill8((u8 *)&gUnknown_203B484, 0, sizeof(unkStruct_203B484));
MemoryFill8(&gUnknown_203B484, 0, sizeof(unkStruct_203B484));
break;
case PASSWORD_ENTRY_NOT_THANK_YOU_MAIL:
nextMenu = PASSWORD_ENTRY_NOT_THANK_YOU_MAIL;

View File

@ -405,7 +405,7 @@ u32 sub_8012240(void)
{
s32 status;
struct unk_struct *r5 = MemoryAlloc(sizeof(struct unk_struct), 5);
MemoryFill8((u8 *)r5, 0xFF, 0x4);
MemoryFill8(r5, 0xFF, 0x4);
sub_8011830();
status = WriteFlashData(0x1F, (u8 *)r5, sizeof(struct unk_struct));
xxx_call_start_bg_music();

View File

@ -127,7 +127,7 @@ void CreateSaveMenu(s32 currMenu)
if (sUnknown_203B364 == NULL) {
sUnknown_203B364 = MemoryAlloc(sizeof(SaveMenuWork),8);
MemoryFill8((u8 *)sUnknown_203B364,0,sizeof(SaveMenuWork));
MemoryFill8(sUnknown_203B364,0,sizeof(SaveMenuWork));
}
for(index = 0; index < 4; index++){
sUnknown_203B364->unk148[index] = gUnknown_80E6F20;

View File

@ -241,7 +241,7 @@ u32 CreateThankYouMailPelipper(void)
ResetUnusedInputStruct();
xxx_call_save_unk_text_struct_800641C(NULL, TRUE, TRUE);
sUnknown_203B2C4 = MemoryAlloc(sizeof(WonderMailStruct_203B2C4), 8);
MemoryFill8((u8 *)sUnknown_203B2C4, 0, sizeof(WonderMailStruct_203B2C4));
MemoryFill8(sUnknown_203B2C4, 0, sizeof(WonderMailStruct_203B2C4));
CopyYellowMonsterNametoBuffer(gSpeakerNameBuffer, MONSTER_PELIPPER);
monName = GetMonSpecies(MONSTER_PELIPPER);
@ -483,7 +483,7 @@ void DisplayThankYouMailCommsOutcome(void)
if (sub_80144A4(&auStack20) != 0) {
return;
}
MemoryFill8((u8 *)&sUnknown_203B2C4->unk41C, 0, sizeof(Item));
MemoryFill8(&sUnknown_203B2C4->unk41C, 0, sizeof(Item));
sUnknown_203B2C4->unk41C.id = ITEM_NOTHING;
sUnknown_203B2C4->unk41C.quantity = 1;
sUnknown_203B2C4->unk41C.flags = 0;
@ -799,7 +799,7 @@ void HandleThankYouMailPasswordMenu(void)
unkStruct_203B480 mail1;
return_var = sub_80154F0();
MemoryFill8((u8 *)&mail1, 0, sizeof(unkStruct_203B480));
MemoryFill8(&mail1, 0, sizeof(unkStruct_203B480));
switch(return_var)
{
case 3:
@ -1306,13 +1306,13 @@ void UpdateThankYouMailText(void)
switch(sUnknown_203B2C4->unk40)
{
case 6:
MemoryFill8((u8 *)&sUnknown_203B2C4->unk1B8,0, sizeof(unkStruct_203B480));
MemoryFill8(&sUnknown_203B2C4->unk1B8,0, sizeof(unkStruct_203B480));
sUnknown_203B2C4->unk1B8 = *GetMailatIndex(sUnknown_203B2C4->mailIndex);
sUnknown_203B2C4->linkError = sub_8037D64(sUnknown_203B2C4->unk40,&sUnknown_203B2C4->unk1B8,&sUnknown_203B2C4->unk1E8);
break;
case 7:
MemoryFill8((u8 *)&sUnknown_203B2C4->unk1B8,0, sizeof(unkStruct_203B480));
MemoryFill8((u8 *)&sUnknown_203B2C4->unk1E8,0, sizeof(unkStruct_203B480));
MemoryFill8(&sUnknown_203B2C4->unk1B8,0, sizeof(unkStruct_203B480));
MemoryFill8(&sUnknown_203B2C4->unk1E8,0, sizeof(unkStruct_203B480));
sUnknown_203B2C4->linkError = sub_8037D64(sUnknown_203B2C4->unk40,&sUnknown_203B2C4->unk1B8,&sUnknown_203B2C4->unk1E8);
break;
}

View File

@ -52,7 +52,7 @@ s32 CreateTradeItemsMenu(void)
ResetUnusedInputStruct();
xxx_call_save_unk_text_struct_800641C(NULL, TRUE, TRUE);
sTradeItemsMenu = MemoryAlloc(sizeof(struct TradeItemsMenu), 8);
MemoryFill8((u8 *)sTradeItemsMenu, 0, sizeof(struct TradeItemsMenu));
MemoryFill8(sTradeItemsMenu, 0, sizeof(struct TradeItemsMenu));
sub_8035C1C();
sub_8035DA0();
sTradeItemsMenu->fallbackState = 0x13;

View File

@ -64,7 +64,7 @@ void sub_80382E4(s32 currMenu)
if (sUnknown_203B360 == NULL) {
sUnknown_203B360 = MemoryAlloc(sizeof(unkStruct_203B360), 8);
MemoryFill8((u8 *)sUnknown_203B360, 0, sizeof(unkStruct_203B360));
MemoryFill8(sUnknown_203B360, 0, sizeof(unkStruct_203B360));
}
for(index = 0; index < 4; index++){
sUnknown_203B360->unk148[index] = gUnknown_80E6E7C;

View File

@ -191,7 +191,7 @@ u32 sub_8027F88(void)
ResetUnusedInputStruct();
xxx_call_save_unk_text_struct_800641C(NULL, TRUE, TRUE);
sUnknown_203B2C0 = MemoryAlloc(sizeof(WonderMailStruct_203B2C0), 8);
MemoryFill8((u8 *)sUnknown_203B2C0, 0, sizeof(WonderMailStruct_203B2C0));
MemoryFill8(sUnknown_203B2C0, 0, sizeof(WonderMailStruct_203B2C0));
sUnknown_203B2C0->unk53C = 0;
sUnknown_203B2C0->mailIndex = -1;
sUnknown_203B2C0->speciesNum = -1;
@ -518,13 +518,13 @@ void sub_8028348(void)
switch(sUnknown_203B2C0->unk40)
{
case 3:
MemoryFill8((u8 *)&sUnknown_203B2C0->unk48, 0, sizeof(unkStruct_203B480));
MemoryFill8((u8 *)&sUnknown_203B2C0->unk78, 0, sizeof(unkStruct_203B480));
MemoryFill8(&sUnknown_203B2C0->unk48, 0, sizeof(unkStruct_203B480));
MemoryFill8(&sUnknown_203B2C0->unk78, 0, sizeof(unkStruct_203B480));
sUnknown_203B2C0->linkError = sub_8037D64(sUnknown_203B2C0->unk40, &sUnknown_203B2C0->unk48, &sUnknown_203B2C0->unk78);
break;
case 4:
MemoryFill8((u8 *)&sUnknown_203B2C0->unkA8, 0, sizeof(WonderMailStruct_203B2C0_sub));
MemoryFill8((u8 *)&sUnknown_203B2C0->unk130, 0, sizeof(WonderMailStruct_203B2C0_sub));
MemoryFill8(&sUnknown_203B2C0->unkA8, 0, sizeof(WonderMailStruct_203B2C0_sub));
MemoryFill8(&sUnknown_203B2C0->unk130, 0, sizeof(WonderMailStruct_203B2C0_sub));
sUnknown_203B2C0->unkA8.pokemon.speciesNum = 0;
sUnknown_203B2C0->unk130.pokemon.speciesNum = 0;
sUnknown_203B2C0->unkA8.mail = *GetMailatIndex(sUnknown_203B2C0->mailIndex);
@ -1359,7 +1359,7 @@ void sub_80293F4(void)
unkStruct_203B480 mail;
return_var = sub_80154F0();
MemoryFill8((u8 *)&mail, 0, sizeof(unkStruct_203B480));
MemoryFill8(&mail, 0, sizeof(unkStruct_203B480));
switch(return_var)
{
case 3:

View File

@ -81,7 +81,7 @@ s32 sub_802B2D4(void)
ResetUnusedInputStruct();
xxx_call_save_unk_text_struct_800641C(NULL, TRUE, TRUE);
sUnknown_203B2C8 = MemoryAlloc(sizeof(struct unkStruct_203B2C8),8);
MemoryFill8((u8 *)sUnknown_203B2C8,0,sizeof(struct unkStruct_203B2C8));
MemoryFill8(sUnknown_203B2C8,0,sizeof(struct unkStruct_203B2C8));
sUnknown_203B2C8->unk1 = -1;
CopyYellowMonsterNametoBuffer(gSpeakerNameBuffer, MONSTER_PELIPPER);
faceFile = GetDialogueSpriteDataPtr(MONSTER_PELIPPER);

View File

@ -105,7 +105,7 @@ bool8 sub_8030F58(u32 wonderMailType)
xxx_call_save_unk_text_struct_800641C(NULL, TRUE, TRUE);
if (gUnknown_203B328 == NULL) {
gUnknown_203B328 = MemoryAlloc(sizeof(struct unkStruct_203B328),8);
MemoryFill8((u8 *)gUnknown_203B328,0,sizeof(struct unkStruct_203B328));
MemoryFill8(gUnknown_203B328,0,sizeof(struct unkStruct_203B328));
}
gUnknown_203B328->wonderMailType = wonderMailType;
file = GetDialogueSpriteDataPtr(MONSTER_PELIPPER);

View File

@ -100,7 +100,7 @@ bool8 CreateWonderMailMenu(void)
xxx_call_save_unk_text_struct_800641C(NULL, TRUE, TRUE);
gUnknown_203B3E8 = MemoryAlloc(sizeof(struct unkStruct_203B3E8), 8);
MemoryFill8((u8 *)gUnknown_203B3E8, 0, sizeof(struct unkStruct_203B3E8));
MemoryFill8(gUnknown_203B3E8, 0, sizeof(struct unkStruct_203B3E8));
for(index = 0; index < PASSWORD_BUFFER_SIZE; index++){
gUnknown_203B3E8->PasswordEntryBuffer[index] = 0;
@ -522,18 +522,18 @@ void WonderMailMainMenuCallback(void)
switch(gUnknown_203B3E8->unk24C)
{
case 9:
MemoryFill8((u8 *)&gUnknown_203B3E8->unk254,0,0xb4);
MemoryFill8(&gUnknown_203B3E8->unk254,0,0xb4);
temp = sub_803B344(gUnknown_203B3E8->unk3BC);
if(temp->unk14 != NULL){
MemoryCopy8((u8 *)&gUnknown_203B3E8->unk254.unk14,temp->unk14,0x28);
MemoryCopy8((u8 *)&gUnknown_203B3E8->unk254.unk3C,temp->unk18,0x78);
MemoryCopy8(&gUnknown_203B3E8->unk254.unk14,temp->unk14,0x28);
MemoryCopy8(&gUnknown_203B3E8->unk254.unk3C,temp->unk18,0x78);
}
gUnknown_203B3E8->unk254.mail = temp->mail;
gUnknown_203B3E8->wonderMailStatus = sub_8037D64(gUnknown_203B3E8->unk24C,&gUnknown_203B3E8->unk254,&gUnknown_203B3E8->unk308);
break;
case 10:
MemoryFill8((u8 *)&gUnknown_203B3E8->unk254,0,0xb4);
MemoryFill8((u8 *)&gUnknown_203B3E8->unk308,0,0xb4);
MemoryFill8(&gUnknown_203B3E8->unk254,0,0xb4);
MemoryFill8(&gUnknown_203B3E8->unk308,0,0xb4);
gUnknown_203B3E8->wonderMailStatus = sub_8037D64(gUnknown_203B3E8->unk24C,&gUnknown_203B3E8->unk254,&gUnknown_203B3E8->unk308);
break;
}

View File

@ -364,11 +364,8 @@ gLevelCurrentData: /* 20384F0 (GetPokemonLevelData) */
.include "src/ground_main.o"
.space 0x2
gUnknown_20398C8: /* 20398C8 (sub_80991E0 - sub_8099220) */
.space 0x10
gUnknown_20398D8: /* 20398D8 (sub_809927C) */
.space 0x78
gUnknown_20398C8: /* 20398C8 (sub_80991E0 - sub_809927C) */
.space 0x88 /* This should be a "struct WonderMailStruct_203B2C0_sub", at least I think so due to its size. Kermalis */
gUnknown_2039950: /* 2039950 (xxx_script_related_8098468 - sub_809927C) */
.space 0x8