#include "common.h" #include "asset.h" void asset_loadTexture(const u_long* tim, ps1texture_t *texture) { TIM_IMAGE* tparam; GetTimInfo(tim, tparam); // This freezes up if the TIM image has weird dimensions LoadImage(tparam->prect, tparam->paddr); // Upload CLUT for palettized images if (tparam->mode & 0x8) { LoadImage(tparam->crect, tparam->caddr); } DrawSync(0); if (texture != NULL) { texture->prect = *tparam->prect; texture->crect = *tparam->crect; texture->mode = tparam->mode; texture->uoffs = (texture->prect.x % 64) << (2 - (texture->mode & 0x3)); texture->voffs = (texture->prect.y & 0xFF); } }