diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2021-11-11 14:51:54 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2021-11-11 14:51:54 -0500 |
commit | 94edcc1b5496a41478e10bd6aa4ff84f5c2ee5aa (patch) | |
tree | ab56adaea3a1d2f67a78ecdc4af4805d6ad8d584 | |
parent | 31601eb58e96adc717069135cecbe405dd25c2c1 (diff) | |
parent | 2e8f24c114893c871b6295f283d14b087e862b1a (diff) |
Merge branch 'pikalax_work' of github.com:PikalaxALT/pokediamond into pikalax_work
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | arm9/arm9.lsf | 2 | ||||
-rw-r--r-- | arm9/global.inc | 6 | ||||
-rw-r--r-- | arm9/modules/52/src/module_52.c | 6 | ||||
-rw-r--r-- | arm9/src/main.c | 8 | ||||
-rw-r--r-- | arm9/src/play_timer.c | 37 | ||||
-rw-r--r-- | arm9/src/unk_02015E30.c | 37 | ||||
-rw-r--r-- | files/data/.gitignore | 2 | ||||
-rw-r--r-- | files/data/dp_areawindow.png | bin | 249 -> 224 bytes | |||
-rw-r--r-- | graphics_rules.mk | 6 | ||||
-rw-r--r-- | include/constants/trdata.h | 8 | ||||
-rw-r--r-- | include/main.h | 13 | ||||
-rw-r--r-- | include/play_timer.h | 12 | ||||
-rw-r--r-- | include/unk_02015E30.h | 22 | ||||
-rw-r--r-- | tools/nitrogfx/gfx.c | 14 | ||||
-rw-r--r-- | tools/nitrogfx/gfx.h | 4 | ||||
-rw-r--r-- | tools/nitrogfx/main.c | 7 | ||||
-rw-r--r-- | tools/nitrogfx/options.h | 1 |
18 files changed, 96 insertions, 93 deletions
@@ -257,12 +257,15 @@ $(CLOBBER_SIZE_VERSION101_NCGR_FILES): GFX_FLAGS = -clobbersize -version101 $(VERSION101_SOPC_8BPP_NCGR_FILES): GFX_FLAGS = -version101 -sopc -bitdepth 8 $(VERSION101_SOPC_NCGR_FILES): GFX_FLAGS = -version101 -sopc $(SCANNED_NCGR_FILES): GFX_FLAGS = -scanned +$(NOBYTEORDER_NCGR_FILES): GFX_FLAGS = -nobyteorder +$(NOBYTEORDER_WRONGSIZE_NCGR_FILES): GFX_FLAGS = -nobyteorder -wrongsize $(IR_NCLR_FILES): GFX_FLAGS = -ir $(4BPP_NCLR_FILES): GFX_FLAGS = -bitdepth 4 $(8BPP_NSCR_FILES): GFX_FLAGS = -bitdepth 8 $(8BPP_COMP10_NOPAD_NCLR_PNG_FILES): GFX_FLAGS = -bitdepth 8 -nopad -comp 10 $(8BPP_COMP10_NOPAD_NCLR_PAL_FILES): GFX_FLAGS = -bitdepth 8 -nopad -comp 10 +$(NCPR_NCLR_FILES): GFX_FLAGS = -ncpr %.NCGR: %.png $(GFX) $< $@ $(GFX_FLAGS) @@ -301,3 +304,4 @@ diamond: ; @$(HOST_VARS) $(MAKE) GAME_VERSION=DIAMOND pearl: ; @$(HOST_VARS) $(MAKE) GAME_VERSION=PEARL compare_diamond: ; @$(HOST_VARS) $(MAKE) GAME_VERSION=DIAMOND COMPARE=1 compare_pearl: ; @$(HOST_VARS) $(MAKE) GAME_VERSION=PEARL COMPARE=1 +compare: compare_diamond diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index 002ad8c9..f2988147 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -51,7 +51,7 @@ Static arm9 Object unk_02014BF4.o Object unk_02015CC0.o Object rs_migrate_string.o - Object unk_02015E30.o + Object play_timer.o Object game_init.o Object heap.o Object bg_window.o diff --git a/arm9/global.inc b/arm9/global.inc index b0d5df7e..a50a3113 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -1003,9 +1003,9 @@ .extern FUN_02015CE0 .extern FUN_02015CF8 .extern ConvertRSStringToDPStringInternational -.extern FUN_02015E30 -.extern FUN_02015E3C -.extern FUN_02015E60 +.extern PlayTimerInit +.extern PlayTimerStart +.extern PlayTimerUpdate .extern FUN_02015EF4 .extern Main_SetVBlankIntrCB .extern FUN_02015F1C diff --git a/arm9/modules/52/src/module_52.c b/arm9/modules/52/src/module_52.c index d96697e9..a9fdb810 100644 --- a/arm9/modules/52/src/module_52.c +++ b/arm9/modules/52/src/module_52.c @@ -1,7 +1,7 @@ #include "module_52.h" #include "heap.h" #include "unk_0205FA2C.h" -#include "unk_02015E30.h" +#include "play_timer.h" extern struct Unk21DBE18 UNK_020FD144; @@ -202,7 +202,7 @@ THUMB_FUNC BOOL MOD52_021D7540(struct UnkStruct_02006234 *param0, u32 *unused) MOD52_021D7604(0x4d, sav2, 1); struct IGT *igt = Sav2_PlayerData_GetIGTAddr(sav2); - FUN_02015E3C(igt); + PlayTimerStart(igt); return 1; } @@ -243,7 +243,7 @@ THUMB_FUNC BOOL MOD52_021D7594(struct UnkStruct_02006234 *param0, u32 *unused) Sav2_SysInfo_InitFromSystem(sav2_info); } - FUN_02015E3C(Sav2_PlayerData_GetIGTAddr(sav2)); + PlayTimerStart(Sav2_PlayerData_GetIGTAddr(sav2)); return 1; } diff --git a/arm9/src/main.c b/arm9/src/main.c index 3b3b0dd6..2930e801 100644 --- a/arm9/src/main.c +++ b/arm9/src/main.c @@ -33,10 +33,10 @@ struct UnkStruct_02016FA8 UNK_02016FA8; extern void FUN_02022294(void); extern void GF_InitRTCWork(void); extern int FUN_020337E8(int); -extern void FUN_02015E30(void); +extern void PlayTimerInit(void); extern void FUN_0201B5CC(void *); extern void GF_RTC_UpdateOnFrame(void); -extern void FUN_02015E60(void); +extern void PlayTimerUpdate(void); extern void FUN_020222C4(void); extern void FUN_0200E2D8(void); @@ -97,7 +97,7 @@ THUMB_FUNC void NitroMain(void) gMain.unk30 = 0; InitializeMainRNG(); InitAllScreenBrightnessData(); - FUN_02015E30(); + PlayTimerInit(); UNK_02016FA4 = 0; for (;;) { @@ -120,7 +120,7 @@ THUMB_FUNC void NitroMain(void) } } GF_RTC_UpdateOnFrame(); - FUN_02015E60(); + PlayTimerUpdate(); FUN_020222C4(); FUN_0201B5CC(gMain.unk24); OS_WaitIrq(1, 1); diff --git a/arm9/src/play_timer.c b/arm9/src/play_timer.c new file mode 100644 index 00000000..9675e179 --- /dev/null +++ b/arm9/src/play_timer.c @@ -0,0 +1,37 @@ + +#include "play_timer.h" + +u64 sTimer3Start; +u64 sUnused; +u64 sDuration; +struct IGT * sIGT_p; +BOOL sTimerActive; + +THUMB_FUNC void PlayTimerInit() +{ + sTimerActive = FALSE; +} + +THUMB_FUNC void PlayTimerStart(struct IGT *igt) +{ + sTimerActive = TRUE; + sUnused = 0; + sDuration = 0; + sIGT_p = igt; + + sTimer3Start = GetTimer3Count(); +} + +THUMB_FUNC void PlayTimerUpdate(void) +{ + if (sTimerActive) + { + u64 res = Timer3CountToSeconds(GetTimer3Count() - sTimer3Start); + + if (sDuration < res) + { + AddIGTSeconds(sIGT_p, (u32)(res - sDuration)); + sDuration = res; + } + } +} diff --git a/arm9/src/unk_02015E30.c b/arm9/src/unk_02015E30.c deleted file mode 100644 index 2f7b5bb5..00000000 --- a/arm9/src/unk_02015E30.c +++ /dev/null @@ -1,37 +0,0 @@ - -#include "unk_02015E30.h" - -u64 UNK_021C48B0; -u64 UNK_021C48A8; -u64 UNK_021C48A0; -struct IGT * UNK_021C489C; -u32 UNK_021C4898; - -THUMB_FUNC void FUN_02015E30() -{ - UNK_021C4898 = 0; -} - -THUMB_FUNC void FUN_02015E3C(struct IGT *igt) -{ - UNK_021C4898 = 1; - UNK_021C48A8 = 0; - UNK_021C48A0 = 0; - UNK_021C489C = igt; - - UNK_021C48B0 = GetTimer3Count(); -} - -THUMB_FUNC void FUN_02015E60() -{ - if (UNK_021C4898 != 0) - { - u64 res = Timer3CountToSeconds(GetTimer3Count() - UNK_021C48B0); - - if (UNK_021C48A0 < res) - { - AddIGTSeconds(UNK_021C489C, (u32)(res - UNK_021C48A0)); - UNK_021C48A0 = res; - } - } -} diff --git a/files/data/.gitignore b/files/data/.gitignore index e405595a..af81751d 100644 --- a/files/data/.gitignore +++ b/files/data/.gitignore @@ -1,2 +1,4 @@ cell0.NCGR cell0.NCLR +dp_areawindow.NCGR +dp_areawindow.NCLR diff --git a/files/data/dp_areawindow.png b/files/data/dp_areawindow.png Binary files differindex ab2b74c8..a4514abd 100644 --- a/files/data/dp_areawindow.png +++ b/files/data/dp_areawindow.png diff --git a/graphics_rules.mk b/graphics_rules.mk index 5bad9e5e..74327449 100644 --- a/graphics_rules.mk +++ b/graphics_rules.mk @@ -1,4 +1,3 @@ -#todo data/dp_areawindow.NCGR (weirdness with size) #todo data/graphic/bag_gra/narc_0007.NCGR (SOPC section) (width 32, palette narc_0003.NCLR) CLOBBER_SIZE_NCGR_FILES := files/data/cell0.NCGR @@ -122,7 +121,7 @@ CLOBBER_SIZE_VERSION101_NCGR_FILES := files/graphic/bag_gra/narc_0002.NCGR \ files/poketool/icongra/poke_icon/narc_0000.NCLR \ files/resource/eng/trial/trial/narc_0000.NCLR \ files/resource/eng/trial/trial/narc_0003.NCLR \ - files/resource/eng/trial/trial/narc_0006.NCLR \ + files/resource/eng/trial/trial/narc_0006.NCLR 8BPP_NSCR_FILES := files/demo/title/titledemo/narc_0000.NSCR @@ -157,6 +156,9 @@ IR_NCLR_FILES := files/itemtool/itemdata/item_icon/narc_0028.NCLR \ files/itemtool/itemdata/item_icon/narc_0111.NCLR \ files/itemtool/itemdata/item_icon/narc_0114.NCLR +NCPR_NCLR_FILES := files/data/dp_areawindow.NCLR +NOBYTEORDER_WRONGSIZE_NCGR_FILES := files/data/dp_areawindow.NCGR + VERSION101_SOPC_8BPP_NCGR_FILES := files/demo/title/titledemo/narc_0001.NCGR \ files/demo/title/titledemo/narc_0003.NCGR diff --git a/include/constants/trdata.h b/include/constants/trdata.h new file mode 100644 index 00000000..659423cf --- /dev/null +++ b/include/constants/trdata.h @@ -0,0 +1,8 @@ +// +// Created by scott on 16-Sep-21. +// + +#ifndef POKEDIAMOND_TRDATA_H +#define POKEDIAMOND_TRDATA_H + +#endif //POKEDIAMOND_TRDATA_H diff --git a/include/main.h b/include/main.h index 87110de5..6333744c 100644 --- a/include/main.h +++ b/include/main.h @@ -26,19 +26,6 @@ struct UnkStruct_02006234 u32 unk24; }; -struct Unk2106FA0 -{ - PMBackLightSwitch unk0; - s32 unk4; - FSOverlayID unk8; - struct UnkStruct_02006234 *unkC; - FSOverlayID unk10; - const struct Unk21DBE18 * unk14; - s32 unk18; - s32 unk1C; - struct SaveBlock2 * unk20; -}; - struct Unk21C4818 { u32 unk0; diff --git a/include/play_timer.h b/include/play_timer.h new file mode 100644 index 00000000..f6cfcbba --- /dev/null +++ b/include/play_timer.h @@ -0,0 +1,12 @@ +#ifndef POKEDIAMOND_PLAY_TIMER_H +#define POKEDIAMOND_PLAY_TIMER_H + +#include "global.h" +#include "igt.h" +#include "timer3.h" + +void PlayTimerInit(void); +void PlayTimerStart(struct IGT *igt); +void PlayTimerUpdate(void); + +#endif //POKEDIAMOND_PLAY_TIMER_H diff --git a/include/unk_02015E30.h b/include/unk_02015E30.h deleted file mode 100644 index 67a7aaaf..00000000 --- a/include/unk_02015E30.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef POKEDIAMOND_UNK_02015E30_H -#define POKEDIAMOND_UNK_02015E30_H - -#include "global.h" -#include "igt.h" -#include "timer3.h" - -struct UnkStruct_02015E30 -{ - u32 unk00; - struct IGT *unk04; - u64 unk08; - u32 unk10; - u32 unk14; - u64 unk18; -}; - -void FUN_02015E30(); -void FUN_02015E3C(struct IGT *igt); -void FUN_02015E60(); - -#endif //POKEDIAMOND_UNK_02015E30_H diff --git a/tools/nitrogfx/gfx.c b/tools/nitrogfx/gfx.c index ee7e0d6f..43e8f83c 100644 --- a/tools/nitrogfx/gfx.c +++ b/tools/nitrogfx/gfx.c @@ -433,7 +433,9 @@ void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int m free(buffer); } -void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors, bool clobberSize, bool byteOrder, bool version101, bool sopc, bool scanned, uint32_t key) +void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, + bool invertColors, bool clobberSize, bool byteOrder, bool version101, bool sopc, bool scanned, + uint32_t key, bool wrongSize) { FILE *fp = fopen(path, "wb"); @@ -499,15 +501,15 @@ void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, in } } - WriteGenericNtrHeader(fp, "RGCN", bufferSize + (sopc ? 0x30 : 0x20), byteOrder, version101, sopc ? 2 : 1); + WriteGenericNtrHeader(fp, "RGCN", bufferSize + (sopc ? 0x30 : 0x20) + (wrongSize ? -8 : 0), byteOrder, version101, sopc ? 2 : 1); unsigned char charHeader[0x20] = { 0x52, 0x41, 0x48, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00 }; - charHeader[4] = (bufferSize + 0x20) & 0xFF; - charHeader[5] = ((bufferSize + 0x20) >> 8) & 0xFF; - charHeader[6] = ((bufferSize + 0x20) >> 16) & 0xFF; - charHeader[7] = ((bufferSize + 0x20) >> 24) & 0xFF; + charHeader[4] = (bufferSize + 0x20 + (wrongSize ? -8 : 0)) & 0xFF; + charHeader[5] = ((bufferSize + 0x20 + (wrongSize ? -8 : 0)) >> 8) & 0xFF; + charHeader[6] = ((bufferSize + 0x20 + (wrongSize ? -8 : 0)) >> 16) & 0xFF; + charHeader[7] = ((bufferSize + 0x20 + (wrongSize ? -8 : 0)) >> 24) & 0xFF; if (!clobberSize) { diff --git a/tools/nitrogfx/gfx.h b/tools/nitrogfx/gfx.h index d0e6521a..389aec41 100644 --- a/tools/nitrogfx/gfx.h +++ b/tools/nitrogfx/gfx.h @@ -32,7 +32,9 @@ struct Image { void ReadImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); uint32_t ReadNtrImage(char *path, int tilesWidth, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); void WriteImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors); -void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, bool invertColors, bool clobberSize, bool byteOrder, bool version101, bool sopc, bool scanned, uint32_t key); +void WriteNtrImage(char *path, int numTiles, int bitDepth, int metatileWidth, int metatileHeight, struct Image *image, + bool invertColors, bool clobberSize, bool byteOrder, bool version101, bool sopc, bool scanned, + uint32_t key, bool wrongSize); void FreeImage(struct Image *image); void ReadGbaPalette(char *path, struct Palette *palette); void ReadNtrPalette(char *path, struct Palette *palette, int bitdepth, int palIndex); diff --git a/tools/nitrogfx/main.c b/tools/nitrogfx/main.c index b2d3352a..b52aa48b 100644 --- a/tools/nitrogfx/main.c +++ b/tools/nitrogfx/main.c @@ -116,7 +116,9 @@ void ConvertPngToNtr(char *inputPath, char *outputPath, struct PngToNtrOptions * free(string); } - WriteNtrImage(outputPath, options->numTiles, image.bitDepth, options->metatileWidth, options->metatileHeight, &image, !image.hasPalette, options->clobberSize, options->byteOrder, options->version101, options->sopc, options->scanned, key); + WriteNtrImage(outputPath, options->numTiles, image.bitDepth, options->metatileWidth, options->metatileHeight, + &image, !image.hasPalette, options->clobberSize, options->byteOrder, options->version101, + options->sopc, options->scanned, key, options->wrongSize); FreeImage(&image); } @@ -442,6 +444,9 @@ void HandlePngToNtrCommand(char *inputPath, char *outputPath, int argc, char **a { options.scanned = true; } + else if (strcmp(option, "-wrongsize") == 0) { + options.wrongSize = true; + } else { FATAL_ERROR("Unrecognized option \"%s\".\n", option); diff --git a/tools/nitrogfx/options.h b/tools/nitrogfx/options.h index 66e9895d..e6721766 100644 --- a/tools/nitrogfx/options.h +++ b/tools/nitrogfx/options.h @@ -32,6 +32,7 @@ struct PngToNtrOptions { bool version101; bool sopc; bool scanned; + bool wrongSize; }; struct Attr0 { |