Skip to content

A library to interface with CFSI Archives from ZE: Zero Time Dilemma

Notifications You must be signed in to change notification settings

morgana-x/ZeroEscape_CFSI_Lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZeroEscape_CFSI_Lib

A library to interface with CFSI Archives from ZE: Zero Time Dilemma

Other tools for Zero Time Dilemma:

Capabilities

  • Extracting all files
  • Repacking all files (including modded regardless of extra files / larger / smaller size)
  • Extracting individual files via API in code

Credit

While I Reverse-Engineered 95% of the archive and it's quirks on my own, I wasn't able to figure out the padding and alignment, as such when I looked at ALuigi's BMS script it ended up helping me quite a bit. (Before that when extracting I just skipped any zero bytes when padding was present, and was unable to progress in repacking)

Resources used:

CFSI DOCUMENTATION

CFSI_VInt (1-3 Bytes)

Short for CFSI_Variable_Integer

  • Read unsigned byte, if the byte doesn't equal 252, that is the value
  • If initial byte equals 252, then the real value is an UInt16/UShort that comes after it

CFSI_String

  • Byte For Length
  • Array of bytes for text

CFSI_Archive

  • CFSI_VINT - Number of Folders
    • For number of folders:
      • CFSI_String - Folder Name
      • CFSI_VINT - Number of Files
        • For Number of files:
          • CFSI_String Name
            • Filepath can be assumed as Foldername + Filename
          • Int32 - Offset (Needs to be multiplied by 16)
          • Int32 - File Size
  • DATA_OFFSET = The cursor position of the stream at this point is the start of the data section
  • Use the algorithm on https://en.wikipedia.org/wiki/Data_structure_alignment#Computing_padding for alignment on DATA_OFFSET, with Align 0x10
  • foreach file:
    • fileDataLocation = DATA_OFFSET + file_Offset
    • byte[fileSize] - raw file data @fileDataLocation

About

A library to interface with CFSI Archives from ZE: Zero Time Dilemma

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages