Skip to content

ADCG textures

Gong Xian edited this page Jun 17, 2023 · 5 revisions

ADC files within SYSLIST.AFS are PRS-compressed images comprised of a number of smaller PVR textures, placed on the screen according to coordinates in the header. The files CG_ALL1.DAT and NC_ALL1.DAT contain a large number of ADCG chunks.

Information on the PVR format is documented at https://github.com/nickworonekin/puyotools/wiki/PVR-Texture.

Header

Before an ADCG chunk, there may be an 8-byte sequence consisting of AGR1 or AGR2 followed by 4 00 bytes.

The first 32 bytes consist of the following:

Offset Length Description
0x0 4 The signature 41 44 43 47, or ADCG in ASCII
0x4 4 The size of this ADCG chunk, starting after the first 8 bytes
0x8 4 An unknown value
0xC 4 The number of subtextures in this chunk
0x10 2 Subtexture width
0x12 2 Subtexture height
0x14 4 An unknown value, usually 18 00 00 00
0x18 1 PVR pixel format
0x19 1 PVR data format
0x1A 2 00 00
0x1C 2 Total texture width
0x1E 2 Total texture height

Offset Tables and Data

Following the header is an offset table for each subtexture.

Offset Length Description
0x0 4 Subtexture index
0x4 4 Offset for the pixel data, minus 16 * (index + 1)
0x8 2 X position of subtexture
0xA 2 Y position of subtexture
0xC 4 An unknown value

See this page for information on PVR pixel and data formats. Some formats contained in these chunks are not supported by current tools.

Following the tables is the PVR texture data for each entry, one after another. The subtextures are typically placed vertically, starting from the top-left corner and going down, then toward the right. Most textures begin at (0,0), but textures that do not use the full screen will begin lower on the screen and thus contain fewer subtextures.

These textures can be edited by extracting the PVR textures based on the information on the header, weaving them into a full image, and then editing the image and reconstructing it back into the original arrangement of subtextures from the original ADCG header and compressing it. The compressed chunk can then be pasted over the original location, and any leftover data from the previous chunk overwritten with 00.