===== About ===== cxdf (compact cross differentiation format) was developed for JuraviS in order to streamline a compact and effective format for modifying game files based on their original counterparts. This format aims to give an alternative to including copyrighted data into patch files. ===== Structure ===== All values are stored in Little-Endian. - Identifier [2 bytes] * String ''J5'' or [''0x4A'',''0x35''] - Version [1 byte] * Current Version: 0x01 - Settings [1 byte] * ''00001000'': Resize on filesize mismatch * ''00000111'': New filesize byte count - Filesize [0-7 bytes, unsigned] - Patch Instructions [varies, multiple] ===== Patch Instructions ===== - Header [1 byte] * ''11110000'': Instruction ID * ''00001000'': * 0 = Seek (absolute jump to offset) * 1 = Hop (relative jump from current offset) * ''00000111'': Seek/Hop offset byte count - Seek/Hop Offset [0-7 bytes, unsigned] - Instruction Data [varies] ==== Instruction Data ==== === 0x0 Write Byte === Writes a single byte with the given value to the current offset of the modification buffer. - Byte Value [1 byte] === 0x2 Repeat Byte === Writes a single byte repeating for a given length to the current offset of the modification buffer. - Repeat count [1 byte, unsigned] * 1-256 - Byte Value [1 byte] === 0x3 Repeat Byte (long) === Same as above; long version; - Repeat count [2 bytes, unsigned] * 1-65536 - Byte Value [1 byte] === 0x4 Write Buffer === Writes a buffer of bytes to the current offset of the modification buffer. - Buffer length [1 byte, unsigned] * 1-256 - Buffer [1-256 bytes] === 0x5 Write Buffer (long) === Same as above; long version; - Buffer length [2 bytes, unsigned] * 1-65536 - Buffer [1-65536 bytes] === 0x6 Repeat Buffer === Writes a buffer of bytes repeating a number of times to the current offset of the modification buffer. - Repeat count [1 byte, unsigned] * 1-256 - Buffer length [1 byte, unsigned] * 1-256 - Buffer [1-256 bytes] === 0x7 Repeat Buffer (long) === Same as above; long version; - Repeat count [2 bytes, unsigned] * 1-65536 - Buffer length [1 byte, unsigned] * 1-256 - Buffer [1-256 bytes] === 0x8 Copy Vanilla Range === Copies a buffer of bytes from the unmodified buffer back to the current position in the modification buffer. - Parameters * ''10000000'': * 0 = Absolute Offset (unsigned) * 1 = Relative Offset (signed) * ''00111000'': Offset byte size * ''00000111'': Copy length byte size - Offset [0-7 bytes, unsigned or signed, see first parameter] - Copy length [0-7 bytes, unsigned] * Read value is +1 (examples: ''0x00'' → 1, ''0xFF'' → 256)