add enums for palette loading

This commit is contained in:
Akashi Akira
2023-05-06 19:11:58 +01:00
parent ba1d834ab7
commit 03bc9fb6df
11 changed files with 60 additions and 23 deletions

View File

@@ -1021,8 +1021,8 @@ THUMB_FUNC void MOD59_LoadInitialTilemap(MOD59_IntroOverlayData *data)
mainPal = NARC_intro_main_background_pearl_NCLR;
subPal = NARC_intro_sub_background_pearl_NCLR;
}
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, mainPal, GF_BG_LYR_MAIN_0, 0, 0x60, data->heap_id);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, subPal, GF_BG_LYR_SUB_0, 0, 0xa0, data->heap_id);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, mainPal, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_0, 0x60, data->heap_id);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, subPal, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_OFFSET_0, 0xa0, data->heap_id);
MOD59_LoadMainScrnData(data);
MOD59_LoadCharDataFromIndex(data);
MOD59_LoadSubScrnData(data);
@@ -1046,14 +1046,14 @@ THUMB_FUNC void MOD59_LoadCharDataFromIndex(MOD59_IntroOverlayData *data)
if (data->spriteDataIndex0 != 0 && data->spriteDataIndex0 < 12)
{
GfGfxLoader_LoadCharData(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex0].charNum, data->bgConfig, GF_BG_LYR_MAIN_1, 0, 0, FALSE, data->heap_id);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex0].palNum, GF_BG_LYR_MAIN_0, 0xE0, 0x20, data->heap_id);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex0].palNum, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_7, 0x20, data->heap_id);
GfGfxLoader_LoadScrnData(NARC_DEMO_INTRO_INTRO, NARC_intro_character_screen_NSCR, data->bgConfig, GF_BG_LYR_MAIN_1, 0, 0, FALSE, data->heap_id);
MOD59_TilemapChangePalette(data, GF_BG_LYR_MAIN_1, 7);
}
if (data->spriteDataIndex1 != 0 && data->spriteDataIndex1 < 12)
{
GfGfxLoader_LoadCharData(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex1].charNum, data->bgConfig, GF_BG_LYR_MAIN_2, 0, 0, FALSE, data->heap_id);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex1].palNum, GF_BG_LYR_MAIN_0, 0x100, 0x20, data->heap_id);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, graphicsPaletteMap.map[data->spriteDataIndex1].palNum, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_8, 0x20, data->heap_id);
GfGfxLoader_LoadScrnData(NARC_DEMO_INTRO_INTRO, NARC_intro_character_screen_NSCR, data->bgConfig, GF_BG_LYR_MAIN_2, 0, 0, FALSE, data->heap_id);
MOD59_TilemapChangePalette(data, GF_BG_LYR_MAIN_2, 8);
}
@@ -1266,9 +1266,9 @@ THUMB_FUNC void MOD59_LoadPokeballButton(MOD59_IntroOverlayData *data)
{
GfGfxLoader_LoadScrnData(NARC_DEMO_INTRO_INTRO, NARC_intro_narc_0038_NSCR, data->bgConfig, GF_BG_LYR_SUB_2, 0, 0, FALSE, data->heap_id);
MOD59_TilemapChangePalette(data, GF_BG_LYR_SUB_2, 9);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, NARC_intro_narc_0039_NCLR, GF_BG_LYR_SUB_0, 0xe0, 0x60, data->heap_id);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO, NARC_intro_narc_0039_NCLR, GF_PAL_LOCATION_SUB_BG, GF_PAL_SLOT_OFFSET_7, 0x60, data->heap_id);
BG_ClearCharDataRange(GF_BG_LYR_SUB_2, 0x20, 0, data->heap_id);
GfGfxLoader_LoadCharData(NARC_DEMO_INTRO_INTRO, NARC_intro_narc_0030_NCGR, data->bgConfig, GF_BG_LYR_SUB_2, 0x20, 0, FALSE, data->heap_id);
GfGfxLoader_LoadCharData(NARC_DEMO_INTRO_INTRO, NARC_intro_pokeball_button_1_NCGR, data->bgConfig, GF_BG_LYR_SUB_2, 0x20, 0, FALSE, data->heap_id);
}
THUMB_FUNC BOOL MOD59_MoveSprite(MOD59_IntroOverlayData *data, u32 layer, u32 param2)

View File

@@ -456,7 +456,7 @@ THUMB_FUNC void MOD59_TVSetupGraphics(MOD59_TVOverlayData *data)
GfGfxLoader_LoadCharData(NARC_DEMO_INTRO_INTRO_TV, NARC_intro_tv_narc_0000_NCGR, data->bgConfig, GF_BG_LYR_MAIN_3, 0, 0, FALSE, data->heap_id);
GfGfxLoader_LoadScrnData(NARC_DEMO_INTRO_INTRO_TV, NARC_intro_tv_narc_0003_NSCR, data->bgConfig, GF_BG_LYR_MAIN_3, 0, 0, FALSE, data->heap_id);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO_TV, NARC_intro_tv_narc_0006_NCLR, GF_BG_LYR_MAIN_0, 0, 0, data->heap_id);
GfGfxLoader_GXLoadPal(NARC_DEMO_INTRO_INTRO_TV, NARC_intro_tv_narc_0006_NCLR, GF_PAL_LOCATION_MAIN_BG, GF_PAL_SLOT_OFFSET_0, 0, data->heap_id);
FUN_02002ED0(GF_BG_LYR_MAIN_0, 0x20, data->heap_id);

View File

@@ -38,12 +38,12 @@ THUMB_FUNC void GfGfxLoader_LoadScrnData(NarcId narcId, s32 memberNo, struct BgC
}
}
THUMB_FUNC void GfGfxLoader_GXLoadPal(NarcId narcId, s32 memberNo, u32 layer, u32 baseAddr, u32 szByte, u32 heap_id)
THUMB_FUNC void GfGfxLoader_GXLoadPal(NarcId narcId, s32 memberNo, enum GFPalLoadLocation location, enum GFPalSlotOffset palSlotOffset, u32 szByte, u32 heap_id)
{
GfGfxLoader_GXLoadPalWithSrcOffset(narcId, memberNo, layer, 0, baseAddr, szByte, heap_id);
GfGfxLoader_GXLoadPalWithSrcOffset(narcId, memberNo, location, 0, palSlotOffset, szByte, heap_id);
}
THUMB_FUNC void GfGfxLoader_GXLoadPalWithSrcOffset(NarcId narcId, s32 memberNo, u32 layer, u32 srcOffset, u32 baseAddr, u32 szByte, u32 heap_id)
THUMB_FUNC void GfGfxLoader_GXLoadPalWithSrcOffset(NarcId narcId, s32 memberNo, enum GFPalLoadLocation location, u32 srcOffset, enum GFPalSlotOffset palSlotOffset, u32 szByte, u32 heap_id)
{
static void (*const load_funcs[])(void *, u32, u32) = {
GX_LoadBGPltt,
@@ -65,30 +65,30 @@ THUMB_FUNC void GfGfxLoader_GXLoadPalWithSrcOffset(NarcId narcId, s32 memberNo,
if (szByte == 0)
szByte = pPltData->szByte - srcOffset;
DC_FlushRange(pPltData->pRawData, szByte);
switch (layer)
switch (location)
{
case 2:
case GF_PAL_LOCATION_MAIN_BGEXT:
GX_BeginLoadBGExtPltt();
load_funcs[layer](pPltData->pRawData, baseAddr, szByte);
load_funcs[location](pPltData->pRawData, palSlotOffset, szByte);
GX_EndLoadBGExtPltt();
break;
case 6:
case GF_PAL_LOCATION_SUB_BGEXT:
GXS_BeginLoadBGExtPltt();
load_funcs[layer](pPltData->pRawData, baseAddr, szByte);
load_funcs[location](pPltData->pRawData, palSlotOffset, szByte);
GXS_EndLoadBGExtPltt();
break;
case 3:
case GF_PAL_LOCATION_MAIN_OBJEXT:
GX_BeginLoadOBJExtPltt();
load_funcs[layer](pPltData->pRawData, baseAddr, szByte);
load_funcs[location](pPltData->pRawData, palSlotOffset, szByte);
GX_EndLoadOBJExtPltt();
break;
case 7:
case GF_PAL_LOCATION_SUB_OBJEXT:
GXS_BeginLoadOBJExtPltt();
load_funcs[layer](pPltData->pRawData, baseAddr, szByte);
load_funcs[location](pPltData->pRawData, palSlotOffset, szByte);
GXS_EndLoadOBJExtPltt();
break;
default:
load_funcs[layer](pPltData->pRawData, baseAddr, szByte);
load_funcs[location](pPltData->pRawData, palSlotOffset, szByte);
break;
}
}

View File

@@ -18,3 +18,4 @@ barry_front.NCLR
sub_background_tileset.NCGR
sub_background_diamond.NCLR
sub_background_pearl.NCLR
pokeball_button_1.NCGR

View File

@@ -28,3 +28,4 @@ sub_background_1.NSCR
sub_background_2.NSCR
sub_background_3.NSCR
sub_background_4.NSCR
pokeball_button_1.NCGR

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

View File

@@ -3364,7 +3364,8 @@ files/demo/intro/intro.narc: \
files/demo/intro/intro/barry_front.NCLR \
files/demo/intro/intro/sub_background_tileset.NCGR \
files/demo/intro/intro/sub_background_diamond.NCLR \
files/demo/intro/intro/sub_background_pearl.NCLR
files/demo/intro/intro/sub_background_pearl.NCLR \
files/demo/intro/intro/pokeball_button_1.NCGR
files/graphic/field_board.narc: \
files/graphic/field_board/narc_0000.NCGR \

View File

@@ -216,6 +216,7 @@ VERSION101_SOPC_NCGR_FILES := files/application/wifi_earth/wifi_earth/narc_0005.
files/demo/intro/intro/rowan_front.NCGR \
files/demo/intro/intro/barry_front.NCGR \
files/demo/intro/intro/sub_background_tileset.NCGR \
files/demo/intro/intro/pokeball_button_1.NCGR \
files/demo/title/titledemo/narc_0007.NCGR \
files/demo/title/titledemo/narc_0011.NCGR \
files/demo/title/titledemo/narc_0015.NCGR \
@@ -563,6 +564,7 @@ NCGR_CLEAN_LIST := files/application/wifi_earth/wifi_earth/narc_0005.NCGR \
files/demo/intro/intro/rowan_front.NCGR \
files/demo/intro/intro/barry_front.NCGR \
files/demo/intro/intro/sub_background_tileset.NCGR \
files/demo/intro/intro/pokeball_button_1.NCGR \
files/demo/title/titledemo/narc_0001.NCGR \
files/demo/title/titledemo/narc_0003.NCGR \
files/demo/title/titledemo/narc_0007.NCGR \

View File

@@ -122,6 +122,38 @@ enum GFBgLayer
GF_BG_LYR_UNALLOC = 0xFF,
};
enum GFPalLoadLocation
{
GF_PAL_LOCATION_MAIN_BG = 0,
GF_PAL_LOCATION_MAIN_OBJ,
GF_PAL_LOCATION_MAIN_BGEXT,
GF_PAL_LOCATION_MAIN_OBJEXT,
GF_PAL_LOCATION_SUB_BG,
GF_PAL_LOCATION_SUB_OBJ,
GF_PAL_LOCATION_SUB_BGEXT,
GF_PAL_LOCATION_SUB_OBJEXT,
};
enum GFPalSlotOffset
{
GF_PAL_SLOT_OFFSET_0 = 0x00,
GF_PAL_SLOT_OFFSET_1 = 0x20,
GF_PAL_SLOT_OFFSET_2 = 0x40,
GF_PAL_SLOT_OFFSET_3 = 0x60,
GF_PAL_SLOT_OFFSET_4 = 0x80,
GF_PAL_SLOT_OFFSET_5 = 0xA0,
GF_PAL_SLOT_OFFSET_6 = 0xC0,
GF_PAL_SLOT_OFFSET_7 = 0xE0,
GF_PAL_SLOT_OFFSET_8 = 0x100,
GF_PAL_SLOT_OFFSET_9 = 0x120,
GF_PAL_SLOT_OFFSET_10 = 0x140,
GF_PAL_SLOT_OFFSET_11 = 0x160,
GF_PAL_SLOT_OFFSET_12 = 0x180,
GF_PAL_SLOT_OFFSET_13 = 0x1A0,
GF_PAL_SLOT_OFFSET_14 = 0X1C0,
GF_PAL_SLOT_OFFSET_15 = 0X1E0
};
enum GFBgType
{
GF_BG_TYPE_TEXT = 0,

View File

@@ -6,8 +6,8 @@
u32 GfGfxLoader_LoadCharData(NarcId narcId, s32 memberNo, struct BgConfig * unkStruct02016B94_2, u32 layer, u32 numTiles, u32 szByte, BOOL isCompressed, u32 heap_id);
void GfGfxLoader_LoadScrnData(NarcId narcId, s32 memberNo, struct BgConfig * unkStruct02016B94_2, u32 layer, u32 tileOffset, u32 szByte, BOOL isCompressed, u32 heap_id);
void GfGfxLoader_GXLoadPal(NarcId narcId, s32 memberNo, u32 layer, u32 baseAddr, u32 szByte, u32 heap_id);
void GfGfxLoader_GXLoadPalWithSrcOffset(NarcId narcId, s32 memberNo, u32 layer, u32 srcOffset, u32 baseAddr, u32 szByte, u32 heap_id);
void GfGfxLoader_GXLoadPal(NarcId narcId, s32 memberNo, enum GFPalLoadLocation location, enum GFPalSlotOffset palSlotOffset, u32 szByte, u32 heap_id);
void GfGfxLoader_GXLoadPalWithSrcOffset(NarcId narcId, s32 memberNo, enum GFPalLoadLocation location, u32 srcOffset, enum GFPalSlotOffset palSlotOffset, u32 szByte, u32 heap_id);
u32 GfGfxLoader_LoadWholePalette(NarcId narcId, s32 memberId, u32 layer, u32 baseAddr, u32 szByte, BOOL isCompressed, u32 heap_id);
void GfGfxLoader_PartiallyLoadPalette(NarcId narcId, s32 memberId, NNS_G2D_VRAM_TYPE vramType, u32 baseAddr, u32 heap_id, NNSG2dImagePaletteProxy * pPltProxy);
u32 GfGfxLoader_LoadImageMapping(NarcId narcId, s32 memberId, BOOL isCompressed, u32 layer, u32 szByte, NNS_G2D_VRAM_TYPE type, u32 baseAddr, u32 heap_id, NNSG2dImageProxy *pImgProxy);