Add texture info lookup

This commit is contained in:
Phillip Stephens 2019-12-11 00:37:30 -08:00
parent f46648f1ec
commit b507799478
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
2 changed files with 13 additions and 8 deletions

View File

@ -59,7 +59,7 @@ private:
public:
CTexture(ETexelFormat, s16, s16, s32);
CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex);
CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex, const CTextureInfo* inf);
enum class EClampMode { None, One };
ETexelFormat GetTexelFormat() const { return x0_fmt; }
ETexelFormat GetMemoryCardTexelFormat() const {

View File

@ -1,8 +1,10 @@
#include "CTexture.hpp"
#include "CSimplePool.hpp"
#include "CToken.hpp"
#include "Graphics/CGraphics.hpp"
#include "Runtime/Graphics/CTexture.hpp"
#include "Runtime/CSimplePool.hpp"
#include "Runtime/CToken.hpp"
#include "Runtime/Graphics/CGraphics.hpp"
#include "Runtime/CTextureCache.hpp"
#include "Runtime/GameGlobalObjects.hpp"
namespace urde {
static logvisor::Module Log("urde::CTextureBoo");
@ -704,7 +706,8 @@ CTexture::CTexture(ETexelFormat fmt, s16 w, s16 h, s32 mips) : x0_fmt(fmt), x4_w
*/
}
CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex) {
CTexture::CTexture(std::unique_ptr<u8[]>&& in, u32 length, bool otex, const CTextureInfo* inf) {
m_textureInfo = inf;
std::unique_ptr<u8[]> owned = std::move(in);
athena::io::MemoryReader r(owned.get(), length);
x0_fmt = ETexelFormat(r.readUint32Big());
@ -864,7 +867,9 @@ const boo::ObjToken<boo::ITexture>& CTexture::GetFontTexture(EFontType tp) {
CFactoryFnReturn FTextureFactory(const urde::SObjectTag& tag, std::unique_ptr<u8[]>&& in, u32 len,
const urde::CVParamTransfer& vparms, CObjectReference* selfRef) {
u32 u32Owned = vparms.GetOwnedObj<u32>();
return TToken<CTexture>::GetIObjObjectFor(std::make_unique<CTexture>(std::move(in), len, u32Owned == SBIG('OTEX')));
const CTextureInfo* inf = g_TextureCache->GetTextureInfo(tag.id);
return TToken<CTexture>::GetIObjObjectFor(
std::make_unique<CTexture>(std::move(in), len, u32Owned == SBIG('OTEX'), inf));
}
} // namespace urde