# Home

<figure><img src="/files/4s3tF6ApDLmdYpiGmLe3" alt=""><figcaption></figcaption></figure>

### Description

Preview icons are small images shown in the equipment menu when selecting weapons, shields, armor, helms, accessories, and more. The icon appears in the bottom interface bar next to the equipment description and provides a visual representation of the selected equipment.

In the vanilla game, these icons have a fixed resolution of 64×96 and are stored in compressed image packs. Each pack contains up to 64 icons that share a single color palette, meaning 256 colors are distributed across all icons in the file. This severely limits the color detail available for each individual icon.

Icons are also tied to equipment identifiers rather than the actual models used by certain equipment types. As a result, changing the model of a weapon or an offhand does not update its preview icon. Additionally, modifying or swapping icons requires decompressing the image packs, editing the grayscale image data, reconstructing the color palette, and rebuilding the files, making even simple changes unnecessarily complex.

### Features

This mod fully reworks the preview icon system by using individual texture files instead of shared packs and adds support for other inventory content such as items, loot, magicks, technicks, gambits, key items and bazaar goods.

#### Preview Icon System

The following summarizes the core functionality of the reworked preview icon system:

* Supports icons with a resolution of 128×192, doubling the size of the default icons.
* Every icon is stored as a separate texture file instead of being grouped with others.
* Every icon can use its own 256-color palette instead of sharing one with many others.
* Icons are assigned based on file names and mapped using their identifiers within their respective content type folders. For example, `.../equipment/1.tm2` is used for equipment with identifier 1.
* Swapping icons only requires renaming files, removing the need for rebuilding packs or reconstructing color palettes.
* Allows weapons and off-hands to use preview icons mapped by model identifier, so icons automatically update when their model changes. Equipment identifier mapping still takes priority to allow different icons for equipment that share the same model.
* Adds support for adding new icons to equipment that had none before.
* Inventory contents without icons no longer show an empty border.

#### Memory Savings

The game uses textures in the `.tm2` format to show images in menus. These textures are loaded into a memory region which is preallocated from the executable pool on game start.

This memory region is limited to only a few megabytes, and once it is exhausted, trying to load any files such as textures within it will result in a crash. Therefore, any memory that is saved delays reaching the limit and allows it to be used by other files.

The game already optimizes how icons are processed. Instead of loading a separate texture for each icon, it reuses a single base texture (`itemgra_c.tm2`) and replaces its image and palette data whenever a different icon needs to be shown. This approach lowers both memory usage and processing overhead.

This mod expands on that concept and frees 694,60 KB of executable memory through the following changes:

* The base texture is now loaded into memory from the main pool instead of the executable pool: `itemgra_c.tm2` (18,125 KB)
* Will no longer preload image data during game start: `item_gra00.as7` - `item_gra07.as7` (605,47 KB)
* Will no longer preload the color palette pack during game start: `item_clut.bin` (7 KB)
* Removed the temporary buffer for decompressed as7 image data in the menu section that processes the icon and description (64 KB).

In addition, the base texture has been optimized to further reduce memory consumption from the main pool through the following changes:

* Removed unused reserved space for a second icon in the base texture:
  * 64×96 icons now require a 64×128 base texture instead of 128×128 (8 KB).
  * 128×192 icons now require a 128×256 base texture instead of 256×256 (32 KB).
  * Removed the extra color palette that is no longer required (1 KB).
* Removed the color palette in the base texture, as it is replaced during runtime (1 KB).

### Variants

This mod is available in 2 variants which can be selected during installation.

#### Small Icons

Select this variant if icons should have a resolution of 64×96.

#### Big Icons

Select this variant if icons should have a resolution of 128×192.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xeavin.gitbook.io/dynamic-preview-icons/home.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
