diff --git a/files/.gitignore b/files/.gitignore index e034667e0..2dfeed78d 100644 --- a/files/.gitignore +++ b/files/.gitignore @@ -51,6 +51,7 @@ a/2/1/4 a/2/2/9 a/2/5/2 a/2/5/4 +a/2/6/0 a/2/6/1 a/2/6/2 a/2/6/4 @@ -74,4 +75,5 @@ demo/opening/gs_opening.narc demo/legend.narc data/photo_data.narc graphic/camera_viewfinder.narc +application/guinness.narc *.NCLR diff --git a/files/a/2/6/0 b/files/a/2/6/0 deleted file mode 100644 index fdf5153d2..000000000 Binary files a/files/a/2/6/0 and /dev/null differ diff --git a/files/application/guinness.mk b/files/application/guinness.mk new file mode 100644 index 000000000..e36ece24b --- /dev/null +++ b/files/application/guinness.mk @@ -0,0 +1,21 @@ +GUINNESS_DIR := files/application/guinness +GUINNESS_NARC := $(GUINNESS_DIR).narc + +GUINNESS_FILES := \ + guinness_00000000.NCLR \ + guinness_00000001.NCLR \ + guinness_00000002.NCGR.lz \ + guinness_00000003.NCGR.lz \ + guinness_00000004.NSCR.lz \ + guinness_00000005.NSCR.lz \ + guinness_00000006.NCLR \ + guinness_00000007.NANR.lz \ + guinness_00000008.NCER.lz \ + guinness_00000009.NCGR.lz + +$(GUINNESS_NARC): $(addprefix $(GUINNESS_DIR)/,$(GUINNESS_FILES)) + $(KNARC) -p $@ -d $(GUINNESS_DIR) -i + +FS_CLEAN_TARGETS += \ + $(GUINNESS_NARC) \ + $(addprefix $(GUINNESS_DIR)/,$(filter %.lz,$(GUINNESS_FILES))) diff --git a/files/application/guinness/.gitignore b/files/application/guinness/.gitignore new file mode 100644 index 000000000..022e1d7af --- /dev/null +++ b/files/application/guinness/.gitignore @@ -0,0 +1 @@ +*.lz diff --git a/files/application/guinness/.knarcignore b/files/application/guinness/.knarcignore new file mode 100644 index 000000000..57934b36b --- /dev/null +++ b/files/application/guinness/.knarcignore @@ -0,0 +1,4 @@ +*.NCGR +*.NSCR +*.NCER +*.NANR diff --git a/files/application/guinness/guinness_00000000.NCLR b/files/application/guinness/guinness_00000000.NCLR new file mode 100644 index 000000000..6b9f5fe3c Binary files /dev/null and b/files/application/guinness/guinness_00000000.NCLR differ diff --git a/files/application/guinness/guinness_00000001.NCLR b/files/application/guinness/guinness_00000001.NCLR new file mode 100644 index 000000000..642f14b5f Binary files /dev/null and b/files/application/guinness/guinness_00000001.NCLR differ diff --git a/files/application/guinness/guinness_00000002.NCGR b/files/application/guinness/guinness_00000002.NCGR new file mode 100644 index 000000000..b8fe3900a Binary files /dev/null and b/files/application/guinness/guinness_00000002.NCGR differ diff --git a/files/application/guinness/guinness_00000003.NCGR b/files/application/guinness/guinness_00000003.NCGR new file mode 100644 index 000000000..67ffce3d1 Binary files /dev/null and b/files/application/guinness/guinness_00000003.NCGR differ diff --git a/files/application/guinness/guinness_00000004.NSCR b/files/application/guinness/guinness_00000004.NSCR new file mode 100644 index 000000000..5ea3e69f6 Binary files /dev/null and b/files/application/guinness/guinness_00000004.NSCR differ diff --git a/files/application/guinness/guinness_00000005.NSCR b/files/application/guinness/guinness_00000005.NSCR new file mode 100644 index 000000000..673e84938 Binary files /dev/null and b/files/application/guinness/guinness_00000005.NSCR differ diff --git a/files/application/guinness/guinness_00000006.NCLR b/files/application/guinness/guinness_00000006.NCLR new file mode 100644 index 000000000..c2bf792f3 Binary files /dev/null and b/files/application/guinness/guinness_00000006.NCLR differ diff --git a/files/application/guinness/guinness_00000007.NANR b/files/application/guinness/guinness_00000007.NANR new file mode 100644 index 000000000..843fc152a Binary files /dev/null and b/files/application/guinness/guinness_00000007.NANR differ diff --git a/files/application/guinness/guinness_00000008.NCER b/files/application/guinness/guinness_00000008.NCER new file mode 100644 index 000000000..8787feaa6 Binary files /dev/null and b/files/application/guinness/guinness_00000008.NCER differ diff --git a/files/application/guinness/guinness_00000009.NCGR b/files/application/guinness/guinness_00000009.NCGR new file mode 100644 index 000000000..b2a91cb18 Binary files /dev/null and b/files/application/guinness/guinness_00000009.NCGR differ diff --git a/filesystem.mk b/filesystem.mk index ce53f8531..e1bdd9faa 100644 --- a/filesystem.mk +++ b/filesystem.mk @@ -451,6 +451,7 @@ $(eval $(call arc_strip_name,files/demo/opening/gs_opening.narc,files/a/2/6/2)) $(eval $(call arc_strip_name,files/application/voltorb_flip.narc,files/a/2/6/4)) $(eval $(call arc_strip_name,files/poketool/icongra/poke_icon/poke_icon.narc,files/a/0/2/0)) $(eval $(call arc_strip_name,files/data/photo_data.narc,files/a/2/5/4)) +$(eval $(call arc_strip_name,files/application/guinness.narc,files/a/2/6/0)) $(eval $(call arc_strip_name,files/graphic/camera_viewfinder.narc,files/a/2/6/1)) $(DIFF_ARCS): @@ -515,6 +516,7 @@ include files/poketool/personal/personal.mk include files/fielddata/graphic/preview_graphic/preview_graphic.mk include files/data/photo_data.mk include files/graphic/camera_viewfinder.mk +include files/application/guinness.mk $(filter-out $(DIFF_ARCS) $(FS_RULE_OVERRIDES),$(NITROFS_FILES)): ; diff --git a/include/filesystem_files_def.h b/include/filesystem_files_def.h index b467c7eba..3af5caf9a 100644 --- a/include/filesystem_files_def.h +++ b/include/filesystem_files_def.h @@ -267,7 +267,7 @@ typedef enum NarcId NARC_a_2_5_7 = 259, NARC_a_2_5_8 = 260, NARC_a_2_5_9 = 261, - NARC_a_2_6_0 = 262, + NARC_application_guinness = 262, NARC_graphic_camera_viewfinder = 263, NARC_demo_opening_gs_opening = 264, NARC_a_2_6_3 = 265, diff --git a/scripts/resolve_nns_bins.sh b/scripts/resolve_nns_bins.sh new file mode 100755 index 000000000..c16998550 --- /dev/null +++ b/scripts/resolve_nns_bins.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if [ "$(uname -s)" = Darwin ]; then + SED=gsed + REALPATH=grealpath +else + SED=sed + REALPATH=realpath +fi + +HOME_DIR="$("$REALPATH" -P "$(dirname "${BASH_SOURCE[0]}")")" +REPO_DIR="$(dirname "${HOME_DIR}")" + +dir= +usage="usage: $(basename "$0") [opts] + + -d Directory to walk" +while getopts ":hd:" opt; do + case "$opt" in + h ) + echo -e "$usage" + exit 0 ;; + d ) + dir="$OPTARG" ;; + : ) + echo -e "ERR: -$OPTARG needs an argument\n$usage" 1>&2 + exit 1 ;; + \? ) + echo -e "ERR: unrecognized argument\n$usage" 1>&2 + exit 1 ;; + esac +done + +if [ -z "$dir" -o ! -d "$dir" ]; then + echo -e "missing required argument: -d \n$usage" 1>&2 + exit 1 +fi + +for fl in "$dir"/*.bin; do + lz= + if [ $(head -c1 "$fl" | hexdump -ve '1/1 "%02x"') = '10' ]; then + mv "$fl" "$fl.lz" + "$REPO_DIR/tools/nitrogfx/nitrogfx" "$fl.lz" "$fl" + lz=.lz + fi + ext="$(head -c4 "$fl")" + if [[ "$ext" ~ ^B[A-Z][A-Z]]0$ ]]; then + ext="NS${ext//0/}" + else if [[ "$(ext)" ~ ^R[A-Z][A-Z]N$ ]]; then + ext="$(echo "$ext" | rev)" + else + echo "$fl$lz" + continue + fi + echo "${fl%.*}$ext$lz" +done diff --git a/src/application/view_rankings.c b/src/application/view_rankings.c index 8e249ddf8..5b65ec8ae 100644 --- a/src/application/view_rankings.c +++ b/src/application/view_rankings.c @@ -25,6 +25,7 @@ #include "player_data.h" #include "msgdata/msg/msg_0421.h" #include "constants/ranking.h" +#include "application/guinness.naix" #define min(a, b) ((a) <= (b) ? (a) : (b)) @@ -628,14 +629,14 @@ static void VBlankCB_ViewRankings(void *cbData) { } static void ViewRankings_LoadBgGraphics(BgConfig *bgConfig, HeapID heapId) { - GfGfxLoader_GXLoadPal(NARC_a_2_6_0, 1, GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0, 0x40, heapId); - GfGfxLoader_LoadCharData(NARC_a_2_6_0, 3, bgConfig, GF_BG_LYR_MAIN_3, 0, 0x1000, TRUE, heapId); - GfGfxLoader_LoadScrnData(NARC_a_2_6_0, 5, bgConfig, GF_BG_LYR_MAIN_3, 0, 0x600, TRUE, heapId); + GfGfxLoader_GXLoadPal(NARC_application_guinness, NARC_guinness_guinness_00000001_NCLR, GF_PAL_LOCATION_MAIN_BG, (enum GFPalSlotOffset)0, 0x40, heapId); + GfGfxLoader_LoadCharData(NARC_application_guinness, NARC_guinness_guinness_00000003_NCGR_lz, bgConfig, GF_BG_LYR_MAIN_3, 0, 0x1000, TRUE, heapId); + GfGfxLoader_LoadScrnData(NARC_application_guinness, NARC_guinness_guinness_00000005_NSCR_lz, bgConfig, GF_BG_LYR_MAIN_3, 0, 0x600, TRUE, heapId); BgCommitTilemapBufferToVram(bgConfig, GF_BG_LYR_MAIN_3); - GfGfxLoader_GXLoadPal(NARC_a_2_6_0, 0, GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)0, 0x20, heapId); - GfGfxLoader_LoadCharData(NARC_a_2_6_0, 2, bgConfig, GF_BG_LYR_SUB_0, 0, 0x400, TRUE, heapId); - GfGfxLoader_LoadScrnData(NARC_a_2_6_0, 4, bgConfig, GF_BG_LYR_SUB_0, 0, 0x600, TRUE, heapId); + GfGfxLoader_GXLoadPal(NARC_application_guinness, NARC_guinness_guinness_00000000_NCLR, GF_PAL_LOCATION_SUB_BG, (enum GFPalSlotOffset)0, 0x20, heapId); + GfGfxLoader_LoadCharData(NARC_application_guinness, NARC_guinness_guinness_00000002_NCGR_lz, bgConfig, GF_BG_LYR_SUB_0, 0, 0x400, TRUE, heapId); + GfGfxLoader_LoadScrnData(NARC_application_guinness, NARC_guinness_guinness_00000004_NSCR_lz, bgConfig, GF_BG_LYR_SUB_0, 0, 0x600, TRUE, heapId); BgCommitTilemapBufferToVram(bgConfig, GF_BG_LYR_SUB_0); } @@ -644,10 +645,10 @@ static void ViewRankings_LoadSpriteGraphics(ViewRankingsAppData *appData, HeapID for (int i = 0; i < 6; ++i) { appData->gf2dGfxResManagers[i] = Create2DGfxResObjMan(1, (GfGfxResType)i, heapId); } - appData->gf2dGfxResObjects[GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromNarc(appData->gf2dGfxResManagers[GF_GFX_RES_TYPE_CHAR], NARC_a_2_6_0, 9, TRUE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, heapId); - appData->gf2dGfxResObjects[GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromNarc(appData->gf2dGfxResManagers[GF_GFX_RES_TYPE_PLTT], NARC_a_2_6_0, 6, FALSE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 4, heapId); - appData->gf2dGfxResObjects[GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromNarc(appData->gf2dGfxResManagers[GF_GFX_RES_TYPE_CELL], NARC_a_2_6_0, 8, TRUE, 0, GF_GFX_RES_TYPE_CELL, heapId); - appData->gf2dGfxResObjects[GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromNarc(appData->gf2dGfxResManagers[GF_GFX_RES_TYPE_ANIM], NARC_a_2_6_0, 7, TRUE, 0, GF_GFX_RES_TYPE_ANIM, heapId); + appData->gf2dGfxResObjects[GF_GFX_RES_TYPE_CHAR] = AddCharResObjFromNarc(appData->gf2dGfxResManagers[GF_GFX_RES_TYPE_CHAR], NARC_application_guinness, NARC_guinness_guinness_00000009_NCGR_lz, TRUE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, heapId); + appData->gf2dGfxResObjects[GF_GFX_RES_TYPE_PLTT] = AddPlttResObjFromNarc(appData->gf2dGfxResManagers[GF_GFX_RES_TYPE_PLTT], NARC_application_guinness, NARC_guinness_guinness_00000006_NCLR, FALSE, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 4, heapId); + appData->gf2dGfxResObjects[GF_GFX_RES_TYPE_CELL] = AddCellOrAnimResObjFromNarc(appData->gf2dGfxResManagers[GF_GFX_RES_TYPE_CELL], NARC_application_guinness, NARC_guinness_guinness_00000008_NCER_lz, TRUE, 0, GF_GFX_RES_TYPE_CELL, heapId); + appData->gf2dGfxResObjects[GF_GFX_RES_TYPE_ANIM] = AddCellOrAnimResObjFromNarc(appData->gf2dGfxResManagers[GF_GFX_RES_TYPE_ANIM], NARC_application_guinness, NARC_guinness_guinness_00000007_NANR_lz, TRUE, 0, GF_GFX_RES_TYPE_ANIM, heapId); sub_0200ADA4(appData->gf2dGfxResObjects[GF_GFX_RES_TYPE_CHAR]); sub_0200AF94(appData->gf2dGfxResObjects[GF_GFX_RES_TYPE_PLTT]); }