Identify + document hardware_palette.c

This commit is contained in:
Rachel 2024-10-23 10:13:38 -07:00
parent 5f3e1eb7a0
commit 642baf1c7f
11 changed files with 64 additions and 64 deletions

View File

@ -0,0 +1,11 @@
#ifndef POKEPLATINUM_HARDWARE_PALETTE_H
#define POKEPLATINUM_HARDWARE_PALETTE_H
u16 *GetHardwareMainBgPaletteAddress(void);
u32 GetHardwareMainBgPaletteSize(void);
u16 *GetHardwareSubBgPaletteAddress(void);
u32 GetHardwareSubBgPaletteSize(void);
u16 *GetHardwareMainObjPaletteAddress(void);
u16 *GetHardwareSubObjPaletteAddress(void);
#endif // POKEPLATINUM_HARDWARE_PALETTE_H

View File

@ -1,11 +0,0 @@
#ifndef POKEPLATINUM_UNK_020241F0_H
#define POKEPLATINUM_UNK_020241F0_H
u32 sub_020241F0(void);
u32 sub_020241F8(void);
u32 sub_02024200(void);
u32 sub_02024208(void);
u32 sub_02024210(void);
u32 sub_02024218(void);
#endif // POKEPLATINUM_UNK_020241F0_H

View File

@ -98,7 +98,7 @@ Static main
Object main.nef.p/src_unk_02023FCC.c.o Object main.nef.p/src_unk_02023FCC.c.o
Object main.nef.p/src_unk_0202414C.c.o Object main.nef.p/src_unk_0202414C.c.o
Object main.nef.p/src_unk_0202419C.c.o Object main.nef.p/src_unk_0202419C.c.o
Object main.nef.p/src_unk_020241F0.c.o Object main.nef.p/src_hardware_palette.c.o
Object main.nef.p/src_unk_02024220.c.o Object main.nef.p/src_unk_02024220.c.o
Object main.nef.p/src_unk_02024358.c.o Object main.nef.p/src_unk_02024358.c.o
Object main.nef.p/src_savedata_save_table.c.o Object main.nef.p/src_savedata_save_table.c.o

View File

@ -48,6 +48,7 @@
#include "game_overlay.h" #include "game_overlay.h"
#include "game_records.h" #include "game_records.h"
#include "gx_layers.h" #include "gx_layers.h"
#include "hardware_palette.h"
#include "heap.h" #include "heap.h"
#include "message.h" #include "message.h"
#include "narc.h" #include "narc.h"
@ -79,7 +80,6 @@
#include "unk_0201DBEC.h" #include "unk_0201DBEC.h"
#include "unk_0201E3D8.h" #include "unk_0201E3D8.h"
#include "unk_0202419C.h" #include "unk_0202419C.h"
#include "unk_020241F0.h"
#include "unk_02024220.h" #include "unk_02024220.h"
#include "unk_0202631C.h" #include "unk_0202631C.h"
#include "unk_0202F1D4.h" #include "unk_0202F1D4.h"
@ -339,7 +339,7 @@ void ov16_0223B430(BattleSystem *param0)
} }
ov16_0223F314(param0, 0); ov16_0223F314(param0, 0);
MI_CpuFill16((void *)sub_02024200(), 0x0, sub_02024208()); MI_CpuFill16((void *)GetHardwareSubBgPaletteAddress(), 0x0, GetHardwareSubBgPaletteSize());
v0 = NARC_ctor(NARC_INDEX_BATTLE__GRAPHIC__PL_BATT_BG, 5); v0 = NARC_ctor(NARC_INDEX_BATTLE__GRAPHIC__PL_BATT_BG, 5);
v1 = NARC_ctor(NARC_INDEX_BATTLE__GRAPHIC__PL_BATT_OBJ, 5); v1 = NARC_ctor(NARC_INDEX_BATTLE__GRAPHIC__PL_BATT_OBJ, 5);
@ -526,8 +526,8 @@ static void ov16_0223B790(OverlayManager *param0)
RTCDate v4; RTCDate v4;
RTCTime v5; RTCTime v5;
MI_CpuFill16((void *)sub_020241F0(), 0x0, sub_020241F8()); MI_CpuFill16((void *)GetHardwareMainBgPaletteAddress(), 0x0, GetHardwareMainBgPaletteSize());
MI_CpuFill16((void *)sub_02024200(), 0x0, sub_02024208()); MI_CpuFill16((void *)GetHardwareSubBgPaletteAddress(), 0x0, GetHardwareSubBgPaletteSize());
v0->unk_00 = ov16_0223CD7C(); v0->unk_00 = ov16_0223CD7C();

34
src/hardware_palette.c Normal file
View File

@ -0,0 +1,34 @@
#include "hardware_palette.h"
#include <nitro.h>
#include <string.h>
u16 *GetHardwareMainBgPaletteAddress(void)
{
return (u16 *)HW_BG_PLTT;
}
u32 GetHardwareMainBgPaletteSize(void)
{
return HW_BG_PLTT_SIZE;
}
u16 *GetHardwareSubBgPaletteAddress(void)
{
return (u16 *)HW_DB_BG_PLTT;
}
u32 GetHardwareSubBgPaletteSize(void)
{
return HW_DB_BG_PLTT_SIZE;
}
u16 *GetHardwareMainObjPaletteAddress(void)
{
return (u16 *)HW_OBJ_PLTT;
}
u16 *GetHardwareSubObjPaletteAddress(void)
{
return (u16 *)HW_DB_OBJ_PLTT;
}

View File

@ -90,7 +90,7 @@ pokeplatinum_c = files(
'unk_02023FCC.c', 'unk_02023FCC.c',
'unk_0202414C.c', 'unk_0202414C.c',
'unk_0202419C.c', 'unk_0202419C.c',
'unk_020241F0.c', 'hardware_palette.c',
'unk_02024220.c', 'unk_02024220.c',
'unk_02024358.c', 'unk_02024358.c',
'savedata/save_table.c', 'savedata/save_table.c',

View File

@ -7,6 +7,7 @@
#include "core_sys.h" #include "core_sys.h"
#include "font.h" #include "font.h"
#include "gx_layers.h" #include "gx_layers.h"
#include "hardware_palette.h"
#include "heap.h" #include "heap.h"
#include "message.h" #include "message.h"
#include "overlay_manager.h" #include "overlay_manager.h"
@ -17,7 +18,6 @@
#include "unk_02006E3C.h" #include "unk_02006E3C.h"
#include "unk_0200F174.h" #include "unk_0200F174.h"
#include "unk_02017728.h" #include "unk_02017728.h"
#include "unk_020241F0.h"
typedef struct { typedef struct {
int unk_00; int unk_00;
@ -83,7 +83,7 @@ int ov73_021D3280 (OverlayManager * param0, int * param1)
GXLayers_TurnBothDispOn(); GXLayers_TurnBothDispOn();
{ {
u16 * v2 = (u16 *)sub_020241F0(); u16 *v2 = (u16 *)GetHardwareMainBgPaletteAddress();
BlendPalettes(v2, v2, 0xFFFC, 7, 0x0); BlendPalettes(v2, v2, 0xFFFC, 7, 0x0);
GX_LoadBGPltt((const void *)v2, 0, 16 * 0x20); GX_LoadBGPltt((const void *)v2, 0, 16 * 0x20);

View File

@ -3,11 +3,11 @@
#include <nitro.h> #include <nitro.h>
#include <string.h> #include <string.h>
#include "hardware_palette.h"
#include "heap.h" #include "heap.h"
#include "sys_task.h" #include "sys_task.h"
#include "sys_task_manager.h" #include "sys_task_manager.h"
#include "unk_02006E3C.h" #include "unk_02006E3C.h"
#include "unk_020241F0.h"
static u8 sub_0200327C(u16 param0, u16 param1); static u8 sub_0200327C(u16 param0, u16 param1);
static void sub_02003290(PaletteData *param0, u16 param1); static void sub_02003290(PaletteData *param0, u16 param1);
@ -97,16 +97,16 @@ void PaletteData_LoadBufferFromHardware(PaletteData *param0, int param1, u16 par
switch (param1) { switch (param1) {
case 0: case 0:
v0 = (u16 *)sub_020241F0(); v0 = (u16 *)GetHardwareMainBgPaletteAddress();
break; break;
case 1: case 1:
v0 = (u16 *)sub_02024200(); v0 = (u16 *)GetHardwareSubBgPaletteAddress();
break; break;
case 2: case 2:
v0 = (u16 *)sub_02024210(); v0 = (u16 *)GetHardwareMainObjPaletteAddress();
break; break;
case 3: case 3:
v0 = (u16 *)sub_02024218(); v0 = (u16 *)GetHardwareSubObjPaletteAddress();
break; break;
default: default:
GF_ASSERT(FALSE); GF_ASSERT(FALSE);

View File

@ -4,10 +4,10 @@
#include <string.h> #include <string.h>
#include "bg_window.h" #include "bg_window.h"
#include "hardware_palette.h"
#include "palette.h" #include "palette.h"
#include "sys_task_manager.h" #include "sys_task_manager.h"
#include "unk_0200679C.h" #include "unk_0200679C.h"
#include "unk_020241F0.h"
typedef void (*UnkFuncPtr_020157E4)(void *, u16 *); typedef void (*UnkFuncPtr_020157E4)(void *, u16 *);
@ -49,10 +49,10 @@ void *sub_0201567C(PaletteData *param0, u16 param1, u16 param2, u32 param3)
} }
} else { } else {
if (param1 == 0) { if (param1 == 0) {
v2 = (u16 *)sub_020241F0(); v2 = (u16 *)GetHardwareMainBgPaletteAddress();
v0->unk_04 = sub_02015840; v0->unk_04 = sub_02015840;
} else { } else {
v2 = (u16 *)sub_02024200(); v2 = (u16 *)GetHardwareSubBgPaletteAddress();
v0->unk_04 = sub_02015858; v0->unk_04 = sub_02015858;
} }
} }

View File

@ -1,34 +0,0 @@
#include "unk_020241F0.h"
#include <nitro.h>
#include <string.h>
u32 sub_020241F0(void)
{
return HW_BG_PLTT;
}
u32 sub_020241F8(void)
{
return HW_BG_PLTT_SIZE;
}
u32 sub_02024200(void)
{
return HW_DB_BG_PLTT;
}
u32 sub_02024208(void)
{
return HW_DB_BG_PLTT_SIZE;
}
u32 sub_02024210(void)
{
return HW_OBJ_PLTT;
}
u32 sub_02024218(void)
{
return HW_DB_OBJ_PLTT;
}

View File

@ -23,6 +23,7 @@
#include "game_options.h" #include "game_options.h"
#include "game_records.h" #include "game_records.h"
#include "gx_layers.h" #include "gx_layers.h"
#include "hardware_palette.h"
#include "heap.h" #include "heap.h"
#include "message.h" #include "message.h"
#include "narc.h" #include "narc.h"
@ -49,7 +50,6 @@
#include "unk_02017728.h" #include "unk_02017728.h"
#include "unk_0201DBEC.h" #include "unk_0201DBEC.h"
#include "unk_0202419C.h" #include "unk_0202419C.h"
#include "unk_020241F0.h"
#include "unk_02024220.h" #include "unk_02024220.h"
#include "unk_0202631C.h" #include "unk_0202631C.h"
#include "unk_02028124.h" #include "unk_02028124.h"
@ -97,8 +97,8 @@ UnkStruct_0207AE68 *sub_0207AE68(Party *param0, Pokemon *param1, int param2, Opt
v0 = (UnkStruct_0207AE68 *)Heap_AllocFromHeap(param11, sizeof(UnkStruct_0207AE68)); v0 = (UnkStruct_0207AE68 *)Heap_AllocFromHeap(param11, sizeof(UnkStruct_0207AE68));
MI_CpuClearFast(v0, sizeof(UnkStruct_0207AE68)); MI_CpuClearFast(v0, sizeof(UnkStruct_0207AE68));
MI_CpuFill16((void *)sub_020241F0(), 0x0, sub_020241F8()); MI_CpuFill16((void *)GetHardwareMainBgPaletteAddress(), 0x0, GetHardwareMainBgPaletteSize());
MI_CpuFill16((void *)sub_02024200(), 0x0, sub_02024208()); MI_CpuFill16((void *)GetHardwareSubBgPaletteAddress(), 0x0, GetHardwareSubBgPaletteSize());
v0->unk_24 = param0; v0->unk_24 = param0;
v0->unk_28 = param1; v0->unk_28 = param1;