Repository navigation
Sprite offset list archive
An archive that stores all sprite sheets of the game. It is constructed very similar to Offset List Archive, however after the address pointer, that point to each .sh file, there is a list of ids (unsigned short - 2 byte) of equal length. There are no filenames so the id acts as one.
It is possible to add new sprites, for a new character or effect, however the game only allocates a fixed memory size. Exceeding it will crash the game. Sprites changed or added via the modded version don't have that problem.
| Type | Size | Description |
|---|---|---|
| uInt | 4 byte | Number of files |
- For each file:
| Type | Size | Description |
|---|---|---|
| uInt | 4 byte | Pointer to file (file size: nextPointer-currentPointer) |
- For each file:
| Type | Size | Description |
|---|---|---|
| uShort | 2 byte | Id of sprite |
- For each file:
- .sh files, no padding in between
Internally the game has several buckets to load the different archives, with "ANM00.DAT" being permanently loaded into the very first one. Other archives are dynamically loaded into the other free buckets. The game then searches throw the buckets backwards (FUN_004de880) to find the requested sprite by id.
struct DisaSpriteLoaderInfo {
int count; //0x0 number of sprites inside anmData
int initialized; //0x4 true when processed
char* data; //0x8 processed data after FUN_004de780 was called, each having length of 0x1200
DisaSpriteOffsetListArchiveData* anmData; //0x0C double array: unit size, unit[size] addresses offset, ushort[size] ids, .sh files
unsigned short* spriteIds; //0x10 points to the sprite ids inside anmData
/**
* @brief Will traverse over each sprite and write a processedresult into data
* data must be preallocated with the appropriate size (count * 0x1200)
*/
void FUN_004de780_processANM(int param_2);
};
/**
* @brief Find sprite data for given id
*/
char* __fastcall FUN_004de880_getSpriteData(unsigned int spriteId) {
DisaSpriteLoaderInfo* spriteBucketBegin = &FP::getData<DisaSpriteLoaderInfo>(0x00749afc - sizeof(DisaSpriteLoaderInfo) * 3); //0x00749abf
DisaSpriteLoaderInfo* spriteBucketEnd = &FP::getData<DisaSpriteLoaderInfo>(0x00749afc);
for (DisaSpriteLoaderInfo& info : std::ranges::subrange(spriteBucketBegin, spriteBucketEnd + 1) | std::views::reverse ) {
if (info.count == 0) continue;
auto idsRange = std::ranges::subrange(info.spriteIds, info.spriteIds + info.count);
auto findIt = std::ranges::find(idsRange, spriteId);
if (findIt == idsRange.end()) continue;
//each processed data has a fixed length of 0x1200
const unsigned int offset = std::distance(idsRange.begin(), findIt) * 0x1200;
return info.data + offset;
}
return nullptr;
}