falcon4:file_formats:rsc_idx_fileformat
Differences
This shows you the differences between two versions of the page.
falcon4:file_formats:rsc_idx_fileformat [2009/02/06 21:50] – created lightning | — | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== IDX/RSC file pairs====== | ||
- | .RSC files in Falcon are " | ||
- | |||
- | files, of varying types. | ||
- | |||
- | (and often does) contain multiple resources, potentially of mixed type (i.e. a resource bundle file could contain several images, | ||
- | |||
- | several sounds, and several binary files, all at once). | ||
- | |||
- | The correspondingly-named .IDX file (located in the same folder as the .RSC file in question), stores an index of the contents of the | ||
- | |||
- | .RSC file. This index provides offset information to the location within the .RSC file's DATA section, where a specific resource' | ||
- | |||
- | raw binary data begins, as well as the size, in bytes, of the resource' | ||
- | |||
- | type of resource that can be found at that location. | ||
- | |||
- | the information provided in the corresponding .IDX file. | ||
- | |||
- | **NOTE:** The .IDX file extension in Falcon refers to a variety of different kinds of index files. | ||
- | below ONLY APPLY to .IDX files that index a corresponding .RSC (resource bundle) file. Other types of .IDX files ARE NOT | ||
- | described below. | ||
- | |||
- | ===== .IDX FILE FORMAT (for .IDX files that index a corresponding .RSC file) ===== | ||
- | ==== .IDX FILE HEADER SECTION ==== | ||
- | ^Field Name ^Offset (Hex) ^Length (Bytes) | ||
- | |Size | ||
- | |||
- | (i.e. the file length minus the header length)| | ||
- | |Version | ||
- | |||
- | .IDX file\\ (must match the version number of the corresponding .RSC file)\\ example: '' | ||
- | |||
- | Immediately following the header section in the .IDX file, comes the data section. | ||
- | in the .IDX describes one resource that can be found in the corresponding .RSC file. | ||
- | |||
- | |||
- | ==== .IDX FILE DATA SECTION ==== | ||
- | The DATA section in the .IDX file contains one DATA record per embedded resource in the corresponding .RSC file. Each DATA record in | ||
- | |||
- | the .IDX file | ||
- | starts with 2 common fields (ResourceType and ResourceID). | ||
- | |||
- | record) depends | ||
- | on the specific ResourceType that is specified for that record. | ||
- | |||
- | === INDIVIDUAL .IDX FILE DATA RECORD -- COMMON FIELDS === | ||
- | NOTE: all field offsets given in the Offset column below, are relative to the start of the individual data record within the .IDX | ||
- | |||
- | file, not the start of the .IDX file itself. | ||
- | |||
- | begins at **relative offset** = '' | ||
- | |||
- | ---------------------------------------------------- | ||
- | ^Field^Offset(Hex)^Length (Bytes)^Data Type^Description^ | ||
- | |ResourceType|'' | ||
- | |||
- | the following: | ||
- | |||
- | **'' | ||
- | |||
- | binary content)| | ||
- | |ResourceID|'' | ||
- | |NOTE: ALL fields that follow, inside of a single .IDX data record, depend on the specific resource type that is being described by | ||
- | |||
- | that record.||||| | ||
- | |||
- | === ADDITIONAL FIELDS FOR | ||
- | **TOTAL RECORD LENGTH:** (including the ResourceType and ResourceID fields): 60 bytes | ||
- | ^Field Name^Offset (Hex)^Length (Bytes)^Data Type^Description^ | ||
- | |Flags|0x24|4|long|Bit flags that describe the image format.\\ \\ Bitmasks: \\ \\ **EightBit** = '' | ||
- | |||
- | 256-value (8-bit) palette; each image pixel is described by a single byte representing an index into the color palette array (stored | ||
- | |||
- | separately).\\ \\ **SixteenBit** = '' | ||
- | |||
- | integer, provide 16 bits of color information per pixel. | ||
- | |||
- | **UseColorKey** = '' | ||
- | |||
- | key (transparency color) -- any pixels using that color should be rendered as transparent| | ||
- | |CenterX|'' | ||
- | |CenterY|'' | ||
- | |Width|'' | ||
- | |Height|'' | ||
- | |ImageOffset|'' | ||
- | |||
- | DATA section. \\ \\ The actual size of the data starting at that location will be:\\ \\ (Width * Height) bytes long (for an 8-bit | ||
- | |||
- | paletted image), | ||
- | |||
- | the pixel data array in the .RSC file represents the upper-left pixel of the image. | ||
- | |||
- | .RSC file represents the lower-right pixel of the image. | ||
- | |||
- | first (i.e. byte 0=(row 0, column 0); byte 1=(row 0, column 1), byte M = (row 0, column =width)... (byte N = row=height, | ||
- | |||
- | column=width)| | ||
- | |PaletteSize|'' | ||
- | |||
- | info per palette entry). \\ **NOTE:** PaletteSize = 0 for non-paletted images.| | ||
- | |PaletteOffset|'' | ||
- | |||
- | the the .RSC file's DATA section. \\ \\ To convert the 16-bit color values from the palette data array (or from the raw pixel data, | ||
- | |||
- | in the case of non-paletted images) to 32-bit ARGB color values, use the following (pseudocode): | ||
- | byte A = 0xFF; //alpha byte | ||
- | byte R = (thisPixelPaletteEntryValue & 0x7C00) >> 7; //red byte | ||
- | byte G = (thisPixelPaletteEntryValue & 0x3E0) >> 2; //green byte | ||
- | byte B = (thisPixelPaletteEntryValue & 0x1F) << 3; //blue byte | ||
- | </ | ||
- | |||
- | low-order (rightmost) 5 bits are the blue bits.\\ | ||
- | |||
- | higher-order 5 bits after that (i.e. the leftmost 5 bits) are the red bits.\\ * The high-order bit is not used. \\ \\ The conversion | ||
- | |||
- | (described above) works by first masking off the relevant bits for a particular color, and then shifting those bits left or right so | ||
- | |||
- | that each color' | ||
- | |||
- | conversion, you can then combine all the component bytes togther into a single 32-bit integer, as follows (pseudocode): | ||
- | long argb = ((A << 24) | (R << 16) | (G <<8) | B); | ||
- | </ | ||
- | |||
- | === ADDITIONAL FIELDS FOR | ||
- | **TOTAL RECORD LENGTH:** (including the ResourceType and ResourceID fields): 52 bytes | ||
- | ^Field Name^Offset (Hex)^Length (Bytes)^Data Type^Description^ | ||
- | |Flags|'' | ||
- | |Channels|'' | ||
- | |||
- | \\ **NOTE:** This is actually redundant, because this information is also contained in the resource' | ||
- | |||
- | DATA section.| | ||
- | |SoundType|'' | ||
- | |||
- | **wFormatTag** member of the .WAV file's **WAVEFORMATEX** structure.\\ \\ **NOTE:** This is actually redundant, because this | ||
- | |||
- | information is also contained in the resource' | ||
- | |Offset|'' | ||
- | |||
- | file's DATA section.| | ||
- | |HeaderSize|'' | ||
- | |||
- | within the .RSC file's DATA section.\\ \\ **NOTE:** The length (in bytes) of the sound resource' | ||
- | |||
- | file's DATA section can be found by looking at the integer value occupying the 4 bytes starting at this resource' | ||
- | |||
- | .RSC file's DATA section itself. You need to add 8 to that value to get the total embedded .WAV file size, in bytes, starting at the | ||
- | |||
- | .Offset itself. \\ \\ **Example: | ||
- | |||
- | (Offset+4) in the .RSC file's DATA section, then read the next 4 bytes into a " | ||
- | |||
- | and that's the number of bytes, starting at this resource' | ||
- | |||
- | up the entire .WAV file binary for this resource.| | ||
- | |||
- | === ADDITIONAL FIELDS FOR | ||
- | **TOTAL RECORD LENGTH:** (including the ResourceType and ResourceID fields): 44 bytes | ||
- | ^Field Name^Offset (Hex)^Length (Bytes)^Data Type^Description^ | ||
- | |Offset|'' | ||
- | |||
- | DATA section| | ||
- | |Size|'' | ||
- | |||
- | ===== .RSC file format ===== | ||
- | ==== .RSC FILE HEADER SECTION ==== | ||
- | ^Field Name^Offset (Hex)^Length (Bytes)^Data Type^Description^ | ||
- | |Size|'' | ||
- | |Version|'' | ||
- | |||
- | the corresponding .IDX file)\\ example: '' | ||
- | |||
- | Immediately following the HEADER section in the .RSC file, comes the DATA section. | ||
- | |||
- | '' | ||
- | |||
- | corresponding .IDX file in order to understand the types of resources that the .RSC file contains data for, as well as discovering | ||
- | |||
- | those resources' | ||
- | |||
- | ==== .RSC FILE DATA SECTION ==== | ||
- | The .RSC file's DATA section begins at absolute offset '' | ||
- | |||
- | **NOTE:** all values of all .Offset fields within indidivual records in the .IDX file, specify offsets **relative** to the **start** | ||
- | |||
- | of the DATA section in the .RSC file. For example, if the .IDX record specifies an offset of '' | ||
- | |||
- | located in the .RSC file starting at **absolute offset** = '' | ||
- | |||
- | itself starts at **absolute offset**='' | ||
falcon4/file_formats/rsc_idx_fileformat.txt · Last modified: 2024/07/31 08:52 by snakeman