Changes

735 bytes added ,  17:26, 11 April 2011
Line 43: Line 43:  
=== Filesystem ===
 
=== Filesystem ===
 
   
 
   
Savefiles stored on the FLASH are using a custom FS.
+
Savefiles are stored on the FLASH in a custom filesystem called SAVE. SAVE has a header which describes where the various bits of the filesystem live. The most important is the FST or filesystem table. You can find the FST by first finding the file base offset which is the offset to which all the entries in the FST are relative. The file base offset is a uint16_t at 0x58 from the filesystem start. The FST offset is a uint32_t at 0x6C and is in blocks (which are 0x200 bytes large).
  −
It seems the file entries are stored somewhere in the third block.  
     −
The first entry is the root directory, stored with a filename of '!'.
+
Once you've found the FST, parsing it is fairly straightforward.
    
<pre>
 
<pre>
 
  struct fs_entry {
 
  struct fs_entry {
     u32 nodes;
+
     u32 node_cnt;
 
     u8  filename[0x10];
 
     u8  filename[0x10];
 
     u32 index;
 
     u32 index;
Line 62: Line 60:  
  }
 
  }
 
</pre>
 
</pre>
 +
 +
The first entry is the root directory, easily identifiable by the node_cnt being larger than 1. The node_cnt includes the root directory itself, so there are node_cnt - 1 files in the root directory. The entries that follow after the root directory are the actual files. Reading them out is as simple as taking the file base offset and adding (block_offset * 0x200) to it.
    
Example from Super MonkeyBall 3D:
 
Example from Super MonkeyBall 3D:
25

edits