Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 25 additions & 22 deletions src/DETHRACE/common/flicplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,24 +756,22 @@ int StartFlic(char* pFile_name, int pIndex, tFlic_descriptor_ptr pFlic_info, tU3
FatalError(kFatalError_LoadFlicFile_S, pFile_name);
}
total_size = GetFileLength(pFlic_info->f);
if (total_size >= 75000) {
pFlic_info->bytes_in_buffer = 75000;
} else {
if (total_size < 75000) {
pFlic_info->bytes_in_buffer = total_size;
} else {
pFlic_info->bytes_in_buffer = 75000;
}
if (pFlic_info->data_start == NULL) {
pFlic_info->data_start = BrMemAllocate(pFlic_info->bytes_in_buffer, kMem_flic_data);
}

pFlic_info->data = pFlic_info->data_start;
fread(pFlic_info->data, 1, pFlic_info->bytes_in_buffer, pFlic_info->f);
strcpy(gLast_flic_name, pFile_name);
fread(pFlic_info->data_start, 1, pFlic_info->bytes_in_buffer, pFlic_info->f);
pFlic_info->bytes_still_to_be_read = total_size - pFlic_info->bytes_in_buffer;
} else {
pFlic_info->f = NULL;
pFlic_info->data = (char*)pData_ptr;
// TODO: remove this - we added this line because of the padding hack in PlayNextFlicFrame2
pFlic_info->data_start = (char*)pData_ptr;

@dethrace-labs dethrace-labs Apr 9, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm need to investigate this padding hack...

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both functions are matching.
None of the fixes in flicplay.c have something to do with padding.

pFlic_info->f = NULL;
}
pFlic_info->bytes_remaining = MemReadU32(&pFlic_info->data);
magic_number = MemReadU16(&pFlic_info->data);
Expand All @@ -797,31 +795,36 @@ int StartFlic(char* pFile_name, int pIndex, tFlic_descriptor_ptr pFlic_info, tU3
MemSkipBytes(&pFlic_info->data, 0x6e);
pFlic_info->the_pixelmap = pDest_pixelmap;

if (pX_offset != -1) {
pFlic_info->x_offset = pX_offset;
} else if (pDest_pixelmap != NULL) {
pFlic_info->x_offset = (pDest_pixelmap->width - pFlic_info->width) / 2;
if (pX_offset == -1) {
if (pDest_pixelmap != NULL) {
pFlic_info->x_offset = (pDest_pixelmap->width - pFlic_info->width) / 2;
} else {
pFlic_info->x_offset = 0;
}
} else {
pFlic_info->x_offset = 0;
pFlic_info->x_offset = pX_offset;
}
if (pY_offset != -1) {
pFlic_info->y_offset = pY_offset;
} else if (pDest_pixelmap != NULL) {
pFlic_info->y_offset = (pDest_pixelmap->height - pFlic_info->height) / 2;
if (pY_offset == -1) {
if (pDest_pixelmap != NULL) {
pFlic_info->y_offset = (pDest_pixelmap->height - pFlic_info->height) / 2;
} else {
pFlic_info->y_offset = 0;
}
} else {
pFlic_info->y_offset = 0;
pFlic_info->y_offset = pY_offset;
}

if (pFrame_rate != 0) {
pFlic_info->frame_period = 1000 / pFrame_rate;
} else {
if (claimed_speed == 0) {
FatalError(kFatalError_FlicFileNoFrameRate_S, gLast_flic_name);
}
if (pFlic_info->new_format) {
pFlic_info->frame_period = claimed_speed;
} else {
pFlic_info->frame_period = 14 * claimed_speed;
if (pFlic_info->new_format) {
pFlic_info->frame_period = claimed_speed;
} else {
pFlic_info->frame_period = 14 * claimed_speed;
}
}
}
pFlic_info->the_index = pIndex;
Expand Down Expand Up @@ -1989,7 +1992,7 @@ void ServicePanelFlics(int pCopy_to_buffer) {
gPanel_flic[j].the_index,
&gPanel_flic[j],
gPanel_flic_data_length[j],
gPanel_flic_data[j],
(tS8*)gPanel_flic_data[j],
gPanel_buffer[j],
0,
0,
Expand Down
Loading