From 24b08b10439d233aa2fbe4caf51071d3abc433bc Mon Sep 17 00:00:00 2001 From: fgenesis Date: Tue, 10 Jul 2012 22:18:21 +0200 Subject: [PATCH] Hackish fix to load glf files even if corrupt (this is required or the next commit...) --- ExternalLibs/glfont2/glfont2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ExternalLibs/glfont2/glfont2.cpp b/ExternalLibs/glfont2/glfont2.cpp index 803d618..3126bed 100644 --- a/ExternalLibs/glfont2/glfont2.cpp +++ b/ExternalLibs/glfont2/glfont2.cpp @@ -47,7 +47,7 @@ GLFont::~GLFont () //******************************************************************* bool GLFont::Create (const char *file_name, int tex, bool loadTexture) { - int num_chars, num_tex_bytes; + ByteBuffer::uint32 num_chars, num_tex_bytes; char *tex_bytes; //Destroy the old font if there was one, just to be safe @@ -102,8 +102,8 @@ bool GLFont::Create (const char *file_name, int tex, bool loadTexture) //Read texture pixel data num_tex_bytes = header.tex_width * header.tex_height * 2; tex_bytes = new char[num_tex_bytes]; - //input.read(tex_bytes, num_tex_bytes); - bb.read(tex_bytes, num_tex_bytes); + // HACK: Aquaria uses override textures, so we can live with the truncation. + bb.read(tex_bytes, std::min(num_tex_bytes, bb.readable())); //Build2DMipmaps(3, header.tex_width, header.tex_height, GL_UNSIGNED_BYTE, tex_bytes, 1);