Difference between revisions of "Pokémon Mystery Dungeon: Red Rescue Team:pksdir0"

From Data Crystal
Jump to navigation Jump to search
m
m (some amendmends as i learn a bit more)
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
"pksdir0" is a 7-characters string with a null ending character, present several hundreds of times in the ROM, with different amount for different region localization.
 
"pksdir0" is a 7-characters string with a null ending character, present several hundreds of times in the ROM, with different amount for different region localization.
  
Its use is unknown, but it is probably just a development leftover with no use whatsoever. It can probably be modified or removed without consequences to game functionality.
+
In some instances, it is part of a pseudo-directory structure used by the game to compensate the GBAs lack of built-in file/directory support, but also occurs a lot more often outside of such a structure with no known purpose. In fact, the game only seems to contain 9 such structures total in contrast to the many times the string occurs in each version.
 +
Modifying or removing these strings might be safe in instances when it is '''not''' part of a directory structure, but care should still be taken as the reason for their presence is still unknown.
  
It is not present in [[Pokémon Mystery Dungeon: Blue Rescue Team|Blue Rescue Team]].
+
The directory structure is laid out as follows:
 +
<pre>
 +
offset    length    description
 +
---------  ------  -------------
 +
00 (0x00)    8    null-terminated "pksdir0" string (the game checks for this string, and refuses to load/find files if it is incorrect)
 +
08 (0x08)    4    a four-byte integer holding the number of file entries in this pksdir structure
 +
12 (0x0B)    4    little-endian GBA pointer to the table of file entries
 +
</pre>
 +
 
 +
The file entry structure referenced by the last pointer is similarly simple, each entry being 8 bytes in size:
 +
<pre>
 +
offset    length    description
 +
---------  ------  -------------
 +
00 (0x00)    4    pointer to a string with the filename
 +
04 (0x04)    4    pointer to the actual file data
 +
</pre>
 +
The file entries in the file entry table '''have''' to be in alphabetical order, more specifically in an ascending order according to their ANSI values with shorter names first (the game uses a special search algorithm that takes advantage of this ordering).
 +
 
 +
 
 +
The code reading those directory structures has special handling for files with a [[Pokémon Mystery Dungeon: Red Rescue Team|SIRO Data Header]] (also see this [https://projectpokemon.org/home/docs/mystery-dungeon-nds/sir0siro-format-r46/ SIR0/SIRO format decription]). Red Rescue Team contains only the "pre-loaded" SIRO headers, and the function that is supposed to take a SIR0 header and load it into memory (becoming a SIRO header in the process) is a stub that simply returns without doing anything.
 +
 
 +
These strings are not present in [[Pokémon Mystery Dungeon: Blue Rescue Team|Blue Rescue Team]].

Latest revision as of 10:49, 1 August 2021


"pksdir0" is a 7-characters string with a null ending character, present several hundreds of times in the ROM, with different amount for different region localization.

In some instances, it is part of a pseudo-directory structure used by the game to compensate the GBAs lack of built-in file/directory support, but also occurs a lot more often outside of such a structure with no known purpose. In fact, the game only seems to contain 9 such structures total in contrast to the many times the string occurs in each version. Modifying or removing these strings might be safe in instances when it is not part of a directory structure, but care should still be taken as the reason for their presence is still unknown.

The directory structure is laid out as follows:

 offset    length    description
---------  ------   -------------
00 (0x00)     8     null-terminated "pksdir0" string (the game checks for this string, and refuses to load/find files if it is incorrect)
08 (0x08)     4     a four-byte integer holding the number of file entries in this pksdir structure
12 (0x0B)     4     little-endian GBA pointer to the table of file entries

The file entry structure referenced by the last pointer is similarly simple, each entry being 8 bytes in size:

 offset    length    description
---------  ------   -------------
00 (0x00)     4     pointer to a string with the filename
04 (0x04)     4     pointer to the actual file data

The file entries in the file entry table have to be in alphabetical order, more specifically in an ascending order according to their ANSI values with shorter names first (the game uses a special search algorithm that takes advantage of this ordering).


The code reading those directory structures has special handling for files with a SIRO Data Header (also see this SIR0/SIRO format decription). Red Rescue Team contains only the "pre-loaded" SIRO headers, and the function that is supposed to take a SIR0 header and load it into memory (becoming a SIRO header in the process) is a stub that simply returns without doing anything.

These strings are not present in Blue Rescue Team.