Format of the SPF DIF file (last updated in v0.70 dev 0604): 0000h 0020h Header 0020h ???? Block data (plain for SPFD, ZLib-compressed for SPFZ) Header: 0000h 0004h 'SPFD' or 'SPFZ' or 'SPFX' (see *7 for 'SPFX') DIF signature 0004h 0004h ASCII Phone ID 0008h 0010h ASCIIZ (00h) right-padded software ID 0018h 0004h Reserved 001Ch 0004h Number of blocks in block data area Block: 0000h 000Ch Block header 000Ch ???? Data Block header: 0000h 0004h 'FBLK' signature 0004h 0004h Block type 0008h 0004h Block size Common dIFC type block data: 0000h ???? RTF comment Common class dChK checking block data: 0000h 0004h Reserved (00000000h) SGHA class NORD/nOrR type block data: 0000h 0004h Starting address in NOR flash (see *8) 0004h ???? NOR data SGHA class TFSF type block data: 0000h 0004h Filename length 0004h ???? Full TFS filename ???? ???? TFS file data SGHA class fLDR type block data: 0000h ???? Full TFS folder name Comments: 1. Phone ID is phone class ID. If SGHFD (or other software) does not know how to process phone class specified, it must display an error and stop processing. You can not intermix multiple phone classes in one DIF file. Phone classes currently known by SGHFD: 'SGHA': Samsung SGH series phones 2. Software ID must be right-padded by zeros up to 16 bytes length. It is given just for informational purposes and is not processed by SGHFD in any way. Examples: 'X100XEDG1', 0, 0, 0, 0, 0, 0, 0. 'AUTODIFF TOOL', 0, 0, 0 3. Block naming conventions: First block name letter defines 'mandatory' block if it is capital and 'optional' block if it is small. If the first letter is capital and SGHFD (or other software) does not know how to parse that block, it must stop parsing here and display an error message. If the first letter is small and software does not know how to parse it, it must skip and ignore that block. Second block name letter defines 'author' block if it is capital and 'third-party' block if it is small. 'Author' blocks are blocks defined by the author of SGHFD. If you want to make your own private block extension to DIF, you must keep second letter small to ensure it will not conflict with future SGHFD versions. Third block name letter defines 'safe to copy' block if it is capital and 'unsafe to copy' block if it is small. When processing DIF file to include it into other DIF file, or when modifying DIF file someway, blocks marked with small third letter ('unsafe to copy' blocks) which are not known by the processing software must not be processed, and must be thrown out. Common author blocks currently known by SGHFD: 'dIFC' - DIF comment in RTF (Rich Text Format), multiple dIFC blocks are joined by SGHFD into single comment 'dChK' - DIF checking enable flag, if it is present then checking is performed in Normal checking mode using nOrR data from the DIF. Checking ensures that the DIF is compatible with other DIF's and firmware present in phone (or BIN file, during depacking). v0.70 and higher only, unsafe to copy non-mandatory block. Author blocks known by SGHFD for 'SGHA' class phones: 'NORD' - NOR flash data 'nOrR' - NOR reversal (undo) data 'TFSF' - TFS file 'fLDR' - TFS folder (NOTE! Folders present in 'TFSF' blocks must be created in filesystem too. 'fLDR' is optional block type that can be used to create empty folders). This block type has meaning in SGHFD 0.70 or higher only. 4. Starting address in the is the linear address in phone flash. 5. For 'SGHA' class phones, internal NOR flash blocks have 10000h bytes granularity (not all the blocks, really, but the flasher emulates 10000h granularity where needed). If the NOR block being written is not granular on start/end, remaining granularity unit data will be read from the phone itself at the flashing stage. This makes patching a few bytes pretty easy. 6. 'SPFZ' files are generic SPF DIF files where the block data itself is compressed with ZLib as a single datastream. 7. 'SPFX' files are XML DIF files, their format greatly differ from the standard DIF. If you see 'SPFX' in the first 4 bytes, you must follow recommendations in dif-xml-format.txt for further DIF processing. 8. NORD/nOrR address is FLASH address. There is common mistake with Swift series to make these addresses starting at not at 0x0 but at 0x10000000. Such DIFs will be tolerated only if they are ResMan ones (and the workaround will be completely removed in SGHFD v0.72. Real flash addresses start at 0x0 and never at any other address.