bugfixes for problems reported by philip: (thanks!)
file_cache: add warning to cache_allocator to catch incorrect usage / bugs vfs_optimizer.cpp: tweak miniarchive threshold (currently have config files in there; don't want those to trigger rebuild every time) zip: clarification tex_dds: we now bother checking the DDPIXELFORMAT mask bits because uncompressed DDS files may be stored in any pixel component order, but we require RGB for efficiency. wsdl: fix failure to update; was constantly queuing events if mouse was out of window This was SVN commit r3627.
This commit is contained in:
parent
e1d5b241f2
commit
1d5308316e
@ -321,13 +321,21 @@ public:
|
||||
|
||||
void* alloc(size_t size)
|
||||
{
|
||||
// safely handle 0 byte allocations. according to C/C++ tradition,
|
||||
// we allocate a unique address, which ends up wasting 1 page.
|
||||
// determine actual size to allocate
|
||||
// .. better not be more than MAX_CACHE_SIZE - file_buf_alloc will
|
||||
// fail because no amount of freeing up existing allocations
|
||||
// would make enough room. therefore, check for this here
|
||||
// (should never happen).
|
||||
debug_assert(size < MAX_CACHE_SIZE);
|
||||
// .. safely handle 0 byte allocations. according to C/C++ tradition,
|
||||
// we allocate a unique address, which ends up wasting 1 page.
|
||||
if(!size)
|
||||
size = 1;
|
||||
|
||||
// .. each allocation must be aligned to BUF_ALIGN, so
|
||||
// we round up all sizes to that.
|
||||
const size_t size_pa = round_up(size, BUF_ALIGN);
|
||||
const uint size_class = size_class_of(size_pa);
|
||||
|
||||
void* p;
|
||||
|
||||
// try to reuse a freed entry
|
||||
|
@ -476,7 +476,7 @@ public:
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
static const ssize_t REBUILD_MAIN_ARCHIVE_THRESHOLD = 50;
|
||||
static const ssize_t BUILD_MINI_ARCHIVE_THRESHOLD = 15;
|
||||
static const ssize_t BUILD_MINI_ARCHIVE_THRESHOLD = 20;
|
||||
|
||||
typedef std::vector<const char*> FnVector;
|
||||
static FnVector loose_files;
|
||||
|
@ -296,7 +296,7 @@ LibError zip_populate_archive(File* f, Archive* a)
|
||||
if(ret < 0)
|
||||
{
|
||||
ret = za_find_ecdr_impl(f, 66000u, &ecdr);
|
||||
// still failed - not a Zip file
|
||||
// still failed - not a valid Zip file
|
||||
if(ret < 0)
|
||||
goto completely_bogus;
|
||||
}
|
||||
|
@ -402,15 +402,37 @@ static LibError decode_pf(const DDPIXELFORMAT* pf, uint* bpp_, uint* flags_)
|
||||
// .. uncompressed
|
||||
if(pf_flags & DDPF_RGB)
|
||||
{
|
||||
const u32 pf_bpp = read_le32(&pf->dwRGBBitCount);
|
||||
bpp = pf_bpp; // checked below
|
||||
const u32 pf_bpp = read_le32(&pf->dwRGBBitCount);
|
||||
const u32 pf_r_mask = read_le32(&pf->dwRBitMask);
|
||||
const u32 pf_g_mask = read_le32(&pf->dwGBitMask);
|
||||
const u32 pf_b_mask = read_le32(&pf->dwBBitMask);
|
||||
const u32 pf_a_mask = read_le32(&pf->dwRGBAlphaBitMask);
|
||||
|
||||
// check for alpha channel
|
||||
const u32 alpha_mask = read_le32(&pf->dwRGBAlphaBitMask);
|
||||
if(alpha_mask && pf_flags & DDPF_ALPHAPIXELS)
|
||||
// (checked below; must be set in case below warning is to be
|
||||
// skipped)
|
||||
bpp = pf_bpp;
|
||||
|
||||
if(pf_flags & DDPF_ALPHAPIXELS)
|
||||
{
|
||||
// something weird other than RGBA or BGRA
|
||||
if(pf_a_mask != 0xFF000000)
|
||||
goto unsupported_component_ordering;
|
||||
flags |= TEX_ALPHA;
|
||||
}
|
||||
|
||||
// note: we don't bother validating *BitMask.
|
||||
// make sure component ordering is 0xBBGGRR = RGB (see below)
|
||||
if(pf_r_mask != 0xFF || pf_g_mask != 0xFF00 || pf_b_mask != 0xFF0000)
|
||||
{
|
||||
// DDPIXELFORMAT in theory supports any ordering of R,G,B,A.
|
||||
// we need to upload to OpenGL, which can only receive BGR(A) or
|
||||
// RBG(A). the latter still requires conversion (done by driver),
|
||||
// so it's slower. since the very purpose of supporting uncompressed
|
||||
// DDS is storing images in a format that requires no processessing,
|
||||
// we do not allow any weird orderings that require runtime work.
|
||||
// instead, the artists must export with the correct settings.
|
||||
unsupported_component_ordering:
|
||||
/*/*WARN_RETURN(ERR_TEX_FMT_INVALID)*/;
|
||||
}
|
||||
|
||||
CHECK_ERR(tex_validate_plain_format(bpp, flags));
|
||||
}
|
||||
|
@ -805,7 +805,7 @@ static void mouse_update()
|
||||
}
|
||||
// moved outside of window
|
||||
else
|
||||
queue_active_event(LOSE, SDL_APPMOUSEFOCUS);
|
||||
active_change_state(LOSE, SDL_APPMOUSEFOCUS);
|
||||
}
|
||||
|
||||
static uint mouse_buttons;
|
||||
|
Loading…
Reference in New Issue
Block a user