some renames

This commit is contained in:
DizzyEggg
2025-06-06 18:13:18 +02:00
parent a443314d48
commit bf077a679a
8 changed files with 174 additions and 158 deletions

View File

@@ -26,7 +26,7 @@ GroundMap_Select:
ldr r0, [r4]
cmp r0, 0
beq _080A4E08
bl sub_80A2D00
bl GroundBg_FreeAll
ldr r0, [r4]
bl MemoryFree
movs r0, 0
@@ -47,7 +47,7 @@ _080A4E08:
bne _080A4E4C
ldr r1, _080A4E48
adds r0, r2, 0
bl sub_80A2B40
bl GroundBg_Init
ldr r0, [r4]
adds r1, r5, 0
bl sub_80A2FBC
@@ -97,7 +97,7 @@ _080A4EA8:
ldr r0, _080A4EC0
ldr r0, [r0]
ldr r1, _080A4EC4
bl sub_80A2B40
bl GroundBg_Init
ldr r1, _080A4EC8
movs r2, 0x80
lsls r2, 5
@@ -152,7 +152,7 @@ _080A4F20:
ldr r0, _080A4FA0
ldr r0, [r0]
ldr r1, _080A4FA4
bl sub_80A2B40
bl GroundBg_Init
movs r0, 0x1
bl sub_80A5EDC
_080A4F30:
@@ -385,7 +385,7 @@ GroundMap_SelectDungeon:
ldr r0, [r7]
cmp r0, 0
beq _080A5110
bl sub_80A2D00
bl GroundBg_FreeAll
ldr r0, [r7]
bl MemoryFree
movs r0, 0
@@ -413,7 +413,7 @@ _080A5110:
_080A5138:
ldr r1, _080A515C
adds r0, r2, 0
bl sub_80A2B40
bl GroundBg_Init
ldr r0, [r7]
adds r1, r6, 0
bl sub_80A2FBC
@@ -447,7 +447,7 @@ _080A5188: .4byte gUnknown_8117740
_080A518C:
ldr r1, _080A51FC
adds r0, r2, 0
bl sub_80A2B40
bl GroundBg_Init
movs r0, 0x1
bl sub_80A5EDC
ldr r0, [r7]

9
include/ground_bg.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef GUARD_GROUND_BG_H
#define GUARD_GROUND_BG_H
#include "structs/str_ground_bg.h"
void GroundBg_Init(GroundBg *groundBg, const SubStruct_52C *a1);
void GroundBg_FreeAll(GroundBg *groundBg);
#endif // GUARD_GROUND_BG_H

View File

@@ -1,138 +1,6 @@
#ifndef GUARD_GROUND_MAP_H
#define GUARD_GROUND_MAP_H
#include "structs/str_file_system.h"
#include "structs/str_202EE8C.h"
#include "structs/str_position.h"
#define UNK_0_ARR_COUNT 14
#define UNK_E0_ARR_COUNT 32
#define UNK_3E0_ARR_COUNT 2
#define UNK_54C_ARR_COUNT 2
#define UNK_545_UNK6_ARR_COUNT 4
typedef struct SubStruct_0
{
s16 unk0;
s16 unk2;
const void *unk4;
const void *unk8;
u8 fillC;
} SubStruct_0;
struct UnkFileStruct
{
u8 unk0;
s16 unk2;
void *unk4[0]; // This is most likely wrong, will need to be fixed.
};
typedef struct SubStruct_3E0
{
u8 unk0;
u8 unk1;
s16 unk2;
s16 unk4;
OpenedFile *unk8;
const struct UnkFileStruct *unkC;
const void *unk10;
const void *unk14;
const void *unk18;
const void *unk1C;
void *unk20;
u32 unk24;
} SubStruct_3E0;
typedef struct SubStruct_488
{
s16 unk0;
s16 unk2;
s16 unk4;
bool8 unk6;
s32 unk8;
s32 unkC;
PixelPos unk10;
void (*unk18)(struct SubStruct_488 *);
u16 *unk1C;
u16 *unk20[UNK_54C_ARR_COUNT];
u16 *unk28[UNK_54C_ARR_COUNT];
PixelPos unk30;
PixelPos unk38;
PixelPos unk40;
PixelPos bgRegOffsets; // Either bg2 or bg3
} SubStruct_488;
// size: 0x18?
typedef struct SubStruct_52C
{
s16 unk0; // 0x52C
s16 unk2; // 0x52E
s16 unk4; // 0x530
s16 unk6; // 0x532
s16 unk8; // 0x534
s16 unkA; // 0x536
s16 unkC; // 0x538
s16 unkE; // 0x53A
s16 unk10; // 0x53C
s16 unk12; // 0x53E
void (*unk14)(void *, const void *, void *, s32); // TODO: fix void * to proper ptr types 0x540
} SubStruct_52C;
typedef struct SubStruct_448
{
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
u8 unk4;
u8 unk5;
u16 unk6;
u16 unk8;
u16 unkA;
} SubStruct_448;
typedef struct SubStruct_545
{
s16 unk0;
s16 unk2;
s16 unk4;
s16 unk6[UNK_545_UNK6_ARR_COUNT];
s16 unkE;
} SubStruct_545;
// size: 0x55C
typedef struct GroundBg
{
SubStruct_0 unk0[UNK_0_ARR_COUNT];
unkStruct_202EE8C unkE0[UNK_E0_ARR_COUNT];
SubStruct_3E0 unk3E0[UNK_3E0_ARR_COUNT];
OpenedFile *unk430;
OpenedFile *unk434;
OpenedFile *unk438;
OpenedFile *unk43C;
OpenedFile *unk440;
s16 unk444;
SubStruct_448 unk448;
SubStruct_545 unk454;
s16 unk464[2];
const void *unk468;
const void *unk46C;
u8 unk470;
u8 unk471;
s32 unk474;
PixelPos unk478[UNK_54C_ARR_COUNT];
struct SubStruct_488 unk488[UNK_54C_ARR_COUNT];
u16 unk528;
u8 unk52A;
SubStruct_52C unk52C;
u16 *unk544;
u16 *unk548;
u16 *unk54C[UNK_54C_ARR_COUNT];
u16 *unk554[UNK_54C_ARR_COUNT];
} GroundBg;
extern GroundBg *gGroundMapDungeon_3001B70;
void GroundMap_Reset(void);
void AllocGroundMapAction(void);

View File

@@ -0,0 +1,136 @@
#ifndef GUARD_STR_GROUND_BG_H
#define GUARD_STR_GROUND_BG_H
#include "structs/str_file_system.h"
#include "structs/str_202EE8C.h"
#include "structs/str_position.h"
#define UNK_0_ARR_COUNT 14
#define UNK_E0_ARR_COUNT 32
#define UNK_3E0_ARR_COUNT 2
#define UNK_54C_ARR_COUNT 2
#define UNK_545_UNK6_ARR_COUNT 4
typedef struct SubStruct_0
{
s16 unk0;
s16 unk2;
const void *unk4;
const void *unk8;
u8 fillC;
} SubStruct_0;
struct UnkFileStruct
{
u8 unk0;
s16 unk2;
void *unk4[0]; // This is most likely wrong, will need to be fixed.
};
typedef struct SubStruct_3E0
{
u8 unk0;
u8 unk1;
s16 unk2;
s16 unk4;
OpenedFile *unk8;
const struct UnkFileStruct *unkC;
const void *unk10;
const void *unk14;
const void *unk18;
const void *unk1C;
void *unk20;
u32 unk24;
} SubStruct_3E0;
typedef struct SubStruct_488
{
s16 unk0;
s16 unk2;
s16 unk4;
bool8 unk6;
s32 unk8;
s32 unkC;
PixelPos unk10;
void (*unk18)(struct SubStruct_488 *);
u16 *unk1C;
u16 *unk20[UNK_54C_ARR_COUNT];
u16 *unk28[UNK_54C_ARR_COUNT];
PixelPos unk30;
PixelPos unk38;
PixelPos unk40;
PixelPos bgRegOffsets; // Either bg2 or bg3
} SubStruct_488;
// size: 0x18?
typedef struct SubStruct_52C
{
s16 unk0; // 0x52C
s16 unk2; // 0x52E
s16 unk4; // 0x530
s16 unk6; // 0x532
s16 unk8; // 0x534
s16 unkA; // 0x536
s16 unkC; // 0x538
s16 unkE; // 0x53A
s16 unk10; // 0x53C
s16 unk12; // 0x53E
void (*unk14)(void *, const void *, void *, s32); // TODO: fix void * to proper ptr types 0x540
} SubStruct_52C;
typedef struct SubStruct_448
{
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
u8 unk4;
u8 unk5;
u16 unk6;
u16 unk8;
u16 unkA;
} SubStruct_448;
typedef struct SubStruct_545
{
s16 unk0;
s16 unk2;
s16 unk4;
s16 unk6[UNK_545_UNK6_ARR_COUNT];
s16 unkE;
} SubStruct_545;
// size: 0x55C
typedef struct GroundBg
{
SubStruct_0 unk0[UNK_0_ARR_COUNT];
unkStruct_202EE8C unkE0[UNK_E0_ARR_COUNT];
SubStruct_3E0 unk3E0[UNK_3E0_ARR_COUNT];
OpenedFile *unk430;
OpenedFile *unk434;
OpenedFile *unk438;
OpenedFile *unk43C;
OpenedFile *unk440;
s16 unk444;
SubStruct_448 unk448;
SubStruct_545 unk454;
s16 unk464[2];
const void *unk468;
const void *unk46C;
u8 unk470;
u8 unk471;
s32 unk474;
PixelPos unk478[UNK_54C_ARR_COUNT];
struct SubStruct_488 unk488[UNK_54C_ARR_COUNT];
u16 unk528;
u8 unk52A;
SubStruct_52C unk52C;
u16 *unk544;
u16 *unk548;
u16 *unk54C[UNK_54C_ARR_COUNT];
u16 *unk554[UNK_54C_ARR_COUNT];
} GroundBg;
extern GroundBg *gGroundMapDungeon_3001B70;
#endif // GUARD_STR_GROUND_BG_H

View File

@@ -1,5 +1,6 @@
#include "global.h"
#include "globaldata.h"
#include "ground_bg.h"
#include "ground_map.h"
#include "text_1.h"
#include "memory.h"
@@ -13,11 +14,13 @@
#include "unk_dungeon_load.h"
#include "constants/dungeon.h"
// This file most likely deals with map loading and writing to VRAM. It even has a custom decompression function.
extern const struct unkStruct_81188F0 gUnknown_81188F0[10];
extern const FileArchive gGroundFileArchive;
void sub_80A456C(GroundBg *groundBg, s32 id, const PixelPos *srcPos);
static void sub_80A2DD4(GroundBg *groundBg);
static void CloseOpenedFiles(GroundBg *groundBg);
void sub_80A3BB0(GroundBg *groundBg, s32 a0);
static void sub_80A3EB0(SubStruct_488 *map488);
static const u8 *sub_80A3908(u16 **dstArray, const void *src_, SubStruct_52C *a2, SubStruct_448 *a3);
@@ -38,7 +41,7 @@ extern void sub_809971C(u16 a0, const void *a1, int a2);
static const PixelPos sPositionZero = {0, 0};
void sub_80A2B40(GroundBg *groundBg, const SubStruct_52C *a1)
void GroundBg_Init(GroundBg *groundBg, const SubStruct_52C *a1)
{
SubStruct_0 *unk0Ptr;
s32 id, unk0Id, unk3E0Id;
@@ -109,11 +112,11 @@ void sub_80A2B40(GroundBg *groundBg, const SubStruct_52C *a1)
}
}
void sub_80A2D00(GroundBg *groundBg)
void GroundBg_FreeAll(GroundBg *groundBg)
{
s32 i;
sub_80A2DD4(groundBg);
CloseOpenedFiles(groundBg);
TRY_FREE_AND_SET_NULL(groundBg->unk544);
FREE_AND_SET_NULL(groundBg->unk548);
@@ -139,7 +142,7 @@ void sub_80A2D88(GroundBg *groundBg)
}
}
void sub_80A2DD4(GroundBg *groundBg)
static void CloseOpenedFiles(GroundBg *groundBg)
{
s32 i;
@@ -161,7 +164,7 @@ void sub_80A2E64(GroundBg *groundBg)
SubStruct_0 *unk0Ptr;
s32 unk0Id, unk3E0Id;
sub_80A2DD4(groundBg);
CloseOpenedFiles(groundBg);
groundBg->unk444 = -1;
groundBg->unk528 = 0;
groundBg->unk448.unk0 = 0;
@@ -240,7 +243,7 @@ void sub_80A2FBC(GroundBg *groundBg, s32 a1_)
return;
}
sub_80A2DD4(groundBg);
CloseOpenedFiles(groundBg);
groundBg->unk444 = a1;
dataPtr = &gUnknown_81188F0[a1];
groundBg->unk430 = OpenFileAndGetFileDataPtr(dataPtr->text1, &gGroundFileArchive);
@@ -421,7 +424,7 @@ void sub_80A3440(GroundBg *groundBg, s32 a1_, DungeonLocation *dungLoc, s32 a3)
}
sub_80A2FBC(groundBg, a1);
sub_80A2DD4(groundBg);
CloseOpenedFiles(groundBg);
groundBg->unk444 = a1;
dataPtr = &gUnknown_81188F0[a1];
groundBg->unk430 = OpenFileAndGetFileDataPtr(dataPtr->text1, &gGroundFileArchive);
@@ -601,7 +604,7 @@ static void _UncompressCell(void *dst_, u16 *a1, const void *src_, SubStruct_52C
}
// Tilemap decompression algorhitm?
static const u8 *sub_80A3908(u16 **dstArray, const void *src_, SubStruct_52C *a2, SubStruct_448 *a3)
static const u8 *sub_80A3908(u16 **dstArray, const void *src_, SubStruct_52C *a2, SubStruct_448 *mapPtr_448)
{
s32 i, j, k, l;
const u8 *src = src_;
@@ -609,10 +612,10 @@ static const u8 *sub_80A3908(u16 **dstArray, const void *src_, SubStruct_52C *a2
for (i = 0; i < a2->unkC; i++) {
u16 *dst = dstArray[i];
for (j = 0; j < a3->unk5; j++) {
for (j = 0; j < mapPtr_448->unk5; j++) {
k = 0;
if (j == 0) {
while (k < a3->unk4) {
while (k < mapPtr_448->unk4) {
s32 val = *src++;
if (val > 191) {
for (l = 191; l < val; l++) {
@@ -641,7 +644,7 @@ static const u8 *sub_80A3908(u16 **dstArray, const void *src_, SubStruct_52C *a2
}
else {
u16 *ptrVal = dst - 64;
while (k < a3->unk4) {
while (k < mapPtr_448->unk4) {
s32 val = *src++;
if (val > 191) {
for (l = 191; l < val; l++) {

View File

@@ -1,6 +1,7 @@
#include "global.h"
#include "debug.h"
#include "event_flag.h"
#include "ground_bg.h"
#include "ground_main.h"
#include "ground_map.h"
#include "ground_map_2.h"
@@ -31,7 +32,6 @@ extern bool8 GroundScriptNotify(void *, s32);
extern const CallbackData gGroundScriptNullCallbacks;
extern const DebugLocation gUnknown_8117538[];
extern void sub_80A2D00(GroundBg *);
extern void sub_80A2D68(GroundBg *);
extern void sub_80A2D88(GroundBg *);
@@ -60,7 +60,7 @@ void GroundMap_Reset(void)
ActionResetScriptData((Action *)gGroundMapAction, gUnknown_8117538);
if (gGroundMapDungeon_3001B70 != NULL) {
sub_80A2D00(gGroundMapDungeon_3001B70);
GroundBg_FreeAll(gGroundMapDungeon_3001B70);
MemoryFree(gGroundMapDungeon_3001B70);
gGroundMapDungeon_3001B70 = NULL;
}

View File

@@ -1,4 +1,5 @@
#include "global.h"
#include "ground_bg.h"
#include "ground_map.h"
#include "ground_map_2.h"
#include "ground_script.h"

View File

@@ -2,6 +2,7 @@
#include "code_800558C.h"
#include "debug.h"
#include "event_flag.h"
#include "ground_bg.h"
#include "ground_map.h"
#include "ground_map_2.h"
#include "memory.h"
@@ -9,14 +10,12 @@
IWRAM_INIT unkStruct_3001B74 *gUnknown_3001B74 = {NULL};
IWRAM_INIT GroundBg *gUnknown_3001B78 = {NULL};
extern const u8 gUnknown_8117784[];
extern const SubStruct_52C gUnknown_8117784;
extern const s16 gUnknown_811E5F4[][2];
extern const u8 gGroundWeatherSelect[];
extern const s32 gUnknown_81177BC[];
extern void sub_80A3BB0(GroundBg *, u32);
extern void sub_80A2D00(GroundBg *);
extern void sub_80A2B40(GroundBg *, const u8 *);
extern void sub_80A2FBC(GroundBg *, u32);
extern void sub_80A49E8(GroundBg *);
extern void sub_80A456C(GroundBg *, u32, const s32 *);
@@ -56,14 +55,14 @@ void sub_80A5EDC(u8 param_1)
gUnknown_3001B74->unk2 = param_1;
if (gUnknown_3001B78 != NULL) {
sub_80A2D00(gUnknown_3001B78);
GroundBg_FreeAll(gUnknown_3001B78);
MemoryFree(gUnknown_3001B78);
gUnknown_3001B78 = NULL;
}
if (param_1) {
gUnknown_3001B78 = MemoryAlloc(sizeof(GroundBg), 6);
sub_80A2B40(gUnknown_3001B78, gUnknown_8117784);
GroundBg_Init(gUnknown_3001B78, &gUnknown_8117784);
sub_80A2FBC(gUnknown_3001B78, -1);
}
}