adspartan: texture manager: use placeholder texture instead of throwing an exception for unsupported blp compression formats

ebd3835523
This commit is contained in:
T1ti
2024-08-26 05:47:14 +02:00
parent ffd1256d5a
commit a7cb7e9d79
2 changed files with 26 additions and 5 deletions

View File

@@ -3125,10 +3125,10 @@ MapView::MapView( math::degrees camera_yaw0
_startup_time.start(); _startup_time.start();
int _fps_limit = _settings->value("fps_limit", 60).toInt(); int _fps_limit = _settings->value("fps_limit", 60).toInt();
int _fps_calcul = (int)((1.f / (float)_fps_limit) * 1000.f); int _frametime = static_cast<int>((1.f / static_cast<float>(_fps_limit)) * 1000.f);
std::cout << "FPS limit is set to : " << _fps_limit << " (" << _fps_calcul << ")" << std::endl; std::cout << "FPS limit is set to : " << _fps_limit << " (" << _frametime << ")" << std::endl;
_update_every_event_loop.start (_fps_calcul); _update_every_event_loop.start (_frametime);
connect(&_update_every_event_loop, &QTimer::timeout,[=] connect(&_update_every_event_loop, &QTimer::timeout,[=]
{ {
_needs_redraw = true; _needs_redraw = true;

View File

@@ -442,9 +442,30 @@ void blp_texture::finishLoading()
} }
else else
{ {
finished = true; BlizzardArchive::ClientFile fallback("textures/shanecube.blp", Noggit::Application::NoggitApplication::instance()->clientData());
throw std::logic_error ("unimplemented BLP colorEncoding");
char const* lData_f = fallback.getPointer();
BLPHeader const* lHeader_f = reinterpret_cast<BLPHeader const*>(lData_f);
_width = lHeader_f->resx;
_height = lHeader_f->resy;
if (lHeader_f->attr_0_compression == 1)
{
loadFromUncompressedData(lHeader_f, lData_f);
}
else if (lHeader_f->attr_0_compression == 2)
{
loadFromCompressedData(lHeader_f, lData_f);
}
else
{
finished = true;
throw std::logic_error("Unsupported BLP compression");
}
fallback.close();
LogError << "Unsupported BLP compression: " << _file_key.filepath() << std::endl;
} }
f.close(); f.close();