-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unpack resdat and cldat files, create C headers for offsets into palette resdats #279
base: main
Are you sure you want to change the base?
Conversation
res/data/plist_canm.json
Outdated
"narc": 20, | ||
"member": 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be nice to reference the NARC and member by name here and have the build step convert them into IDs on the fly, but need to figure out where the data mapping NARCs and members to indices would be available at this point in the build
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move them from the C constants in include/constants/narc.h
to be a generated multi-lang constant in consts/
. Then, you'd have access to these in the Python script that builds the NARCs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any documentation on what these files actually represent? Are they just packs of resources that should always be loaded together?
src/unk_0208EA44.c
Outdated
@@ -430,7 +431,7 @@ void sub_0208F16C(PokemonSummaryApp *param0) | |||
static void sub_0208F194(PokemonSummaryApp *param0, u8 param1, u8 param2, u8 param3) | |||
{ | |||
sub_0200D948(param0->renderer, param0->gfxHandler, sub_0207C944(), sub_0207C908(param3), 1, param2); | |||
sub_0200D414(param0->unk_41C[param1], sub_0207C92C(param3) + 3); | |||
sub_0200D414(param0->unk_41C[param1], sub_0207C92C(param3) + RESDAT_PST_PAL_NARC_27_MEMBER_74_1_OFFSET); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be an naix
value?
8991602
to
d429b1c
Compare
yes! if I understand it right,
so all of these |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some cursory questions and basic polish comments.
typedef struct CellActorPropsTemplate { | ||
int resourceIndex; | ||
s16 x; | ||
s16 y; | ||
s16 z; | ||
u16 anim; | ||
int priority; | ||
int palette; | ||
int vramType; | ||
int unk_18; | ||
int unk_1C; | ||
int unk_20; | ||
int unk_24; | ||
} CellActorPropsTemplate; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: How does this differ from the existing SpriteTemplate
?
#ifndef POKEPLATINUM_UNK_0200C6E4_H | ||
#define POKEPLATINUM_UNK_0200C6E4_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polish: Modify the include guards (and the comment at the end of this file).
@@ -68,3 +68,4 @@ subdir('items') | |||
subdir('pokemon') | |||
subdir('sound') | |||
subdir('trainers') | |||
subdir('data') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polish: Keep this list sorted in lexicographical order, unless a specific processing order is needed.
@@ -7,8 +7,7 @@ | |||
|
|||
#include "applications/pokemon_summary_screen/main.h" | |||
#include "applications/pokemon_summary_screen/subscreen.h" | |||
#include "overlay007/struct_ov7_0224F2EC.h" | |||
#include "overlay007/struct_ov7_0224F358.h" | |||
#include "data/pst_pal.naix" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polish: #include "res/data/pst_pal.naix"
will sort this to the bottom of the includes, which I think is preferable.
|
||
BOOL SpriteRenderer_CreateCellActorList(SpriteRenderer *renderer, SpriteGfxHandler *gfxHandler, int numCells) | ||
{ | ||
if ((renderer == NULL) || (gfxHandler == NULL)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polish: Unnecessary parens.
{ | ||
UnkStruct_ov22_022559F8 v0; | ||
|
||
v0.unk_00 = param2->unk_00; | ||
v0.unk_04 = param2->unk_04; | ||
v0.unk_08 = param2->unk_08; | ||
v0.unk_0C = renderer->heapID; | ||
|
||
sub_0201E88C(&v0, param2->unk_0C, param2->unk_10); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polish: I'll leave it up to you if you want to break down this unnecessary scope-block or not; since the inner struct here is undocumented, I can let it slide.
static BOOL sub_0200D27C(SpriteResourceCollection *resourceCollection, SpriteResourceList *resourceList, int resourceID) | ||
{ | ||
for (int i = 0; i < resourceList->capacity; i++) { | ||
if (resourceList->resources[i] == NULL) { | ||
continue; | ||
} | ||
|
||
int spriteResourceID = SpriteResource_GetID(resourceList->resources[i]); | ||
|
||
if (spriteResourceID == resourceID) { | ||
sub_0201EB50(resourceID); | ||
SpriteResourceCollection_Remove(resourceCollection, resourceList->resources[i]); | ||
|
||
resourceList->resources[i] = NULL; | ||
resourceList->count--; | ||
|
||
return TRUE; | ||
} | ||
} | ||
|
||
return FALSE; | ||
} | ||
|
||
static BOOL sub_0200D2D0(SpriteResourceCollection *resourceCollection, SpriteResourceList *resourceList, int resourceID) | ||
{ | ||
for (int i = 0; i < resourceList->capacity; i++) { | ||
if (resourceList->resources[i] == NULL) { | ||
continue; | ||
} | ||
|
||
int spriteResourceID = SpriteResource_GetID(resourceList->resources[i]); | ||
|
||
if (spriteResourceID == resourceID) { | ||
sub_0201F9F0(resourceID); | ||
SpriteResourceCollection_Remove(resourceCollection, resourceList->resources[i]); | ||
|
||
resourceList->resources[i] = NULL; | ||
resourceList->count--; | ||
|
||
return TRUE; | ||
} | ||
} | ||
|
||
return FALSE; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
polish: Can we name these functions?
{ | ||
"narc": 123, | ||
"file": 3, | ||
"compressed": false, | ||
"id": 0 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I think that, in general, I would rather we get these to map to NARCs and NAIX files. Maybe this means that the conversion utility should be in C code so that we can easily import the necessary header files.
Uncovered how the resdat files and palette offsets were being used while I was working on #269 so figured I would unpack the files + add a build step while it was fresh in the brain
shoutout to the txt files such as
res/data/tmapn_celact.txt
which were probably left in the filesystem by mistake and contain a direct explanation for the binary format for resdat/cldat files, lolI'll probably extend this to do a bit more documentation in the files I've already modified, specifically around
unk_0200C6E4.c
. I need to check if the other gen4 projects already did work in this area (I think pokeheartgold does have a bunch of this file documented already)