From 7a9387269e3b123b1647cf59c78cc6c998a9a330 Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 3 Jun 2014 05:55:54 +0200 Subject: experimental 3DS support --- layoutgl/texturemanager.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'layoutgl') diff --git a/layoutgl/texturemanager.cpp b/layoutgl/texturemanager.cpp index 80a8186..896c40f 100644 --- a/layoutgl/texturemanager.cpp +++ b/layoutgl/texturemanager.cpp @@ -1,4 +1,5 @@ #include "texturemanager.h" +#include "ctr/image.h" LGLTextureManager::LGLTextureManager() { } @@ -16,12 +17,16 @@ void LGLTextureManager::setup(QGLWidget *gl, const LYTLayout *layout) { qDebug() << texName; QByteArray tplData = m_package->getTexture(texName); + if (tplData.isEmpty()) { + qDebug() << "[[[ NON-EXISTENT TEXTURE! ]]]"; + continue; + } QDataStream tplStream(tplData); - WiiTexPalette tpl(tplStream); + CTRImageCollection tpl(tplStream); - const QImage &image = tpl.textures.first().image; - image.save(QString("tpl/%2__%1.png").arg(texName).arg((int)tpl.textures.first().format)); + const QImage &image = tpl.images.first().image; + image.save(QString("tpl/%2__%1.png").arg(texName).arg((int)tpl.images.first().format)); // dirty, dirty hack, TODO: FIXME GLuint tex = gl->bindTexture(image, GL_TEXTURE_2D); -- cgit v1.2.3