pret / pokeplatinum

Decompilation of Pokémon Platinum
164 stars 56 forks source link

Document Resource Manager + Texture Resource Manager (Cell Actor Part 1) #240

Closed Fexty12573 closed 1 month ago

Fexty12573 commented 1 month ago

Documents the ResourceManager and TextureResourceManager structs.

ResourceManager

Still debating on that name (opinions welcome), since it is less of a manager and more just a collection. It keeps an internal array of Resource objects, which can be "allocated" from and "deallocated" to at will. Potential name would be ResourceCollection. Resources are stored with an ID and the raw data from the file.

TextureResourceManager

This one manages textures exclusively (duh) and has some additional capabilities. It serves as a wrapper around ResourceManager but also allows storing textures in a different way where the actual texture data can be deallocated after it has been uploaded to VRAM (see enum TextureResourceMode), which saves a lot of memory. Normally this isn't possible with just the G2D API.

It also handles allocating and deallocating VRAM, keeping track of texture/palette keys, and performing the actual VRAM upload.

This is part 1 of a 3 (probably 4) part PR to document the Cell Actor/Sprite system.