mirror of
https://github.com/holub/mame
synced 2025-05-17 19:24:59 +03:00
02410: -aviwrite: files over 2 gigs sometimes get cut off
This commit is contained in:
parent
9ff6c5bb96
commit
c391ab646f
@ -1716,13 +1716,18 @@ static avi_error chunk_write(avi_file *file, UINT32 type, const void *data, UINT
|
|||||||
{
|
{
|
||||||
file_error filerr;
|
file_error filerr;
|
||||||
avi_error avierr;
|
avi_error avierr;
|
||||||
|
UINT32 idxreserve;
|
||||||
UINT32 written;
|
UINT32 written;
|
||||||
|
|
||||||
|
/* if we are the first RIFF, we must reserve enough space for the IDX chunk */
|
||||||
|
idxreserve = 0;
|
||||||
|
if (file->riffbase == 0 && type != CHUNKTYPE_IDX1)
|
||||||
|
idxreserve = compute_idx1_size(file);
|
||||||
|
|
||||||
/* if we are getting too big, split the RIFF */
|
/* if we are getting too big, split the RIFF */
|
||||||
/* note that we ignore writes before the current RIFF base, as those are assumed to be
|
/* note that we ignore writes before the current RIFF base, as those are assumed to be
|
||||||
overwrites of a chunk from the previous RIFF */
|
overwrites of a chunk from the previous RIFF */
|
||||||
if ((file->riffbase == 0 && file->writeoffs + length + compute_idx1_size(file) >= MAX_RIFF_SIZE) ||
|
if (file->writeoffs >= file->riffbase && file->writeoffs + length + idxreserve - file->riffbase >= MAX_RIFF_SIZE)
|
||||||
(file->writeoffs >= file->riffbase && file->writeoffs + length - file->riffbase >= MAX_RIFF_SIZE))
|
|
||||||
{
|
{
|
||||||
/* close the movi list */
|
/* close the movi list */
|
||||||
avierr = chunk_close(file);
|
avierr = chunk_close(file);
|
||||||
|
Loading…
Reference in New Issue
Block a user