All of that for a constant

This commit is contained in:
Kermalis
2025-11-25 00:36:29 -05:00
parent 57721a29e4
commit 58b6d793e4
263 changed files with 1239 additions and 1146 deletions

View File

@@ -128,7 +128,7 @@ typedef struct axObject
typedef struct Palette256
{
RGB pal[256];
RGB_Struct pal[256];
} Palette256;
// size: 0x20
@@ -140,7 +140,7 @@ typedef struct EfoFileData
/* 0xC */ void *spriteData; // ?
/* 0x10 */ Palette256 *unk10; // ?
/* 0x14 */ const u32 *tiles;
/* 0x18 */ const RGB *pal;
/* 0x18 */ const RGB_Struct *pal;
/* 0x1C */ s32 tileCount;
} EfoFileData;
@@ -150,7 +150,7 @@ typedef struct EfbFileData
const u16 *const *frames;
s32 tileCount;
const u32 *tiles;
const RGB *pal;
const RGB_Struct *pal;
} EfbFileData;
#endif // GUARD_AXDATA_H

View File

@@ -101,22 +101,22 @@ typedef struct MenuHeaderWindow
// These macros are used for updating menu windows, as the last page can have less entries than other pages, so the window's height needs to reflect that.
// Note: In order to get matching ASM, this macro had to be created.
// It's probable the code below is not exactly how it was originally written, but it generates the same asm.
#define UPDATE_MENU_WINDOW_HEIGHT_INTERNAL(ptr, _newHeight) \
{ \
UNUSED s32 new10; \
s16 newHeight; \
s16 newHeightVal = (_newHeight); \
UNUSED s32 dummyMatch = newHeightVal; \
UNUSED s16 oldHeight = (ptr).windows.id[(ptr).menuWinId].height; \
dummyMatch = 0; \
new10 = newHeightVal + 2; \
newHeight = newHeightVal; \
\
(ptr).windows.id[(ptr).menuWinId].height = newHeight; \
(ptr).windows.id[(ptr).menuWinId].unk10 = newHeightVal + 2; \
\
ResetUnusedInputStruct(); \
ShowWindows(&(ptr).windows, TRUE, TRUE); \
#define UPDATE_MENU_WINDOW_HEIGHT_INTERNAL(ptr, _newHeight) \
{ \
UNUSED s32 newheightInTiles; \
s16 newHeight; \
s16 newHeightVal = (_newHeight); \
UNUSED s32 dummyMatch = newHeightVal; \
UNUSED s16 oldHeight = (ptr).windows.id[(ptr).menuWinId].height; \
dummyMatch = 0; \
newheightInTiles = newHeightVal + 2; \
newHeight = newHeightVal; \
\
(ptr).windows.id[(ptr).menuWinId].height = newHeight; \
(ptr).windows.id[(ptr).menuWinId].heightInTiles = newHeightVal + 2; \
\
ResetUnusedInputStruct(); \
ShowWindows(&(ptr).windows, TRUE, TRUE); \
}
#define UPDATE_MENU_WINDOW_HEIGHT(ptr) \
@@ -125,22 +125,22 @@ typedef struct MenuHeaderWindow
}
// For Windows where height is the same as unk10.
#define UPDATE_MENU_WINDOW_HEIGHT_2(ptr) \
{ \
s32 newHeightVal = CalcEntriesTotalHeight((ptr).input.currPageEntries, DEFAULT_MENU_ENTRY_HEIGHT) + 2; \
UNUSED s16 oldHeight = (ptr).windows.id[(ptr).menuWinId].height; \
s16 newHeight = newHeightVal; \
\
(ptr).windows.id[(ptr).menuWinId].height = newHeight; \
(ptr).windows.id[(ptr).menuWinId].unk10 = newHeight; \
\
ResetUnusedInputStruct(); \
ShowWindows(&(ptr).windows, TRUE, TRUE); \
#define UPDATE_MENU_WINDOW_HEIGHT_2(ptr) \
{ \
s32 newHeightVal = CalcEntriesTotalHeight((ptr).input.currPageEntries, DEFAULT_MENU_ENTRY_HEIGHT) + 2; \
UNUSED s16 oldHeight = (ptr).windows.id[(ptr).menuWinId].height; \
s16 newHeight = newHeightVal; \
\
(ptr).windows.id[(ptr).menuWinId].height = newHeight; \
(ptr).windows.id[(ptr).menuWinId].heightInTiles = newHeight; \
\
ResetUnusedInputStruct(); \
ShowWindows(&(ptr).windows, TRUE, TRUE); \
}
// For menu windows with two lines entries(for example job mail)
#define UPDATE_TWO_LINES_MENU_WINDOW_HEIGHT(ptr) \
{ \
#define UPDATE_TWO_LINES_MENU_WINDOW_HEIGHT(ptr) \
{ \
UPDATE_MENU_WINDOW_HEIGHT_INTERNAL(ptr, CalcTwoLinesEntriesTotalHeight((ptr).input.currPageEntries, TWO_LINES_MENU_ENTRY_HEIGHT) + 2) \
}

View File

@@ -1,13 +1,14 @@
#ifndef GUARD_RGB_H
#define GUARD_RGB_H
typedef struct RGB
// 0x4
typedef struct RGB_Struct
{
u8 r;
u8 g;
u8 b;
u8 unk4; // Never read, always 0x80. Unused transparency/alpha flag?
} RGB;
} RGB_Struct;
#define RGB_R 0
#define RGB_G 1
@@ -23,7 +24,7 @@ typedef struct RGB_Array
typedef union RGB_Union
{
RGB_Array asArr;
RGB separate;
RGB_Struct separate;
} RGB_Union;
#define RGB_TO_GBA(r, g, b) RGB2(((u32)(r) & 0xF8) >> 3, ((g) & 0xF8) >> 3, ((b) & 0xF8) >> 3)

View File

@@ -9,10 +9,10 @@ typedef struct unkStruct_202EE8C
u32 unk0;
u16 unk4;
s16 unk6;
RGB *unk8;
RGB *unkC;
RGB *unk10;
RGB unk14;
RGB_Struct *unk8;
RGB_Struct *unkC;
RGB_Struct *unk10;
RGB_Struct unk14;
} unkStruct_202EE8C;
#endif // GUARD_STR_202EE8C_H

View File

@@ -404,7 +404,7 @@ typedef struct Dungeon
Entity *unkBC;
Entity unkC0;
struct unkStruct_Dungeon134_sub unk134;
/* 0x17C */ RGB colorRamp[COLOR_RAMP_COUNT];
/* 0x17C */ RGB_Struct colorRamp[COLOR_RAMP_COUNT];
/* 0x57C */ unkDungeon57C unk57C;
/* 0x5C0 */ s32 unk5C0;
/* 0x5C4 */ struct unkStruct_Dungeon5C4_sub unk5C4[3];

View File

@@ -8,7 +8,7 @@
// size: 0x8
typedef struct PortraitGfxSub
{
/* 0x0 */ const RGB *pal;
/* 0x0 */ const RGB_Struct *pal;
/* 0x4 */ const u8 *gfx;
} PortraitGfxSub;

View File

@@ -22,11 +22,11 @@ typedef struct Window
/* 0x2 */ s16 y;
/* 0x4 */ s16 width;
/* 0x6 */ s16 height;
/* 0x8 */ s16 unk8;
/* 0x8 */ s16 heightInTiles;
/* 0xC */ s32 type;
/* 0x10 */ u32 unk10;
/* 0x14 */ u32 unk14;
/* 0x18 */ u32 *unk18;
/* 0x18 */ u32 *unk18; // Appears to be window graphics data
/* 0x1C */ u32 *unk1C;
/* 0x20 */ s32 unk20;
/* 0x24 */ s32 unk24;
@@ -54,14 +54,14 @@ typedef struct WindowHeader
// size: 0x18
typedef struct WindowTemplate
{
u8 unk0;
/* 0x4 */ s32 type;
/* 0x8 */ DungeonPos pos;
/* 0xC */ s16 width;
/* 0xE */ s16 height;
s16 unk10; // In most cases it's the same as height. If it's smaller than height, the window may look glitchy. Maybe something with tile allocation/how the window is filled?
s16 unk12;
const WindowHeader *header;
/* 0x00 */ u8 unk0; // Appears to be some bit flags
/* 0x04 */ s32 type;
/* 0x08 */ DungeonPos pos;
/* 0x0C */ s16 width;
/* 0x0E */ s16 height;
/* 0x10 */ s16 heightInTiles;
/* 0x12 */ s16 unk12;
/* 0x14 */ const WindowHeader *header;
} WindowTemplate;
#define WINDOW_TYPE_0 0
@@ -76,7 +76,7 @@ typedef struct WindowTemplate
#define MAX_WINDOWS 4
// All fields are zeroed out except for type which is set to WINDOW_TYPE_NORMAL.
#define WIN_TEMPLATE_DUMMY (WindowTemplate) { .unk0 = 0, .type = WINDOW_TYPE_NORMAL, .pos = { .x = 0, .y = 0 }, .width = 0, .height = 0, .unk10 = 0, .unk12 = 0, .header = NULL }
#define WIN_TEMPLATE_DUMMY (WindowTemplate) { .unk0 = 0, .type = WINDOW_TYPE_NORMAL, .pos = { .x = 0, .y = 0 }, .width = 0, .height = 0, .heightInTiles = 0, .unk12 = 0, .header = NULL }
// size: 0x60
typedef struct WindowTemplates