Skip to content

Commit 1ef7a70

Browse files
clean up cfile
- replace a lot of platform specific code with SDL filesystem functions - remove support for memory-mapped files (not actually used) - only do special case-sensitive filesystem handling if required - support case-sensitive roots on Windows
1 parent 11be04d commit 1ef7a70

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+220
-452
lines changed

code/anim/animplay.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -667,12 +667,11 @@ void anim_read_header(anim *ptr, CFILE *fp)
667667
*
668668
* @param real_filename Filename of animation
669669
* @param cf_dir_type
670-
* @param file_mapped Whether to use memory-mapped file or not.
671670
*
672671
* @details Memory-mapped files will page in the animation from disk as it is needed, but performance is not as good.
673672
* @return Pointer to anim that is loaded if success, NULL if failure.
674673
*/
675-
anim *anim_load(const char *real_filename, int cf_dir_type, int file_mapped)
674+
anim *anim_load(const char *real_filename, int cf_dir_type)
676675
{
677676
anim *ptr;
678677
CFILE *fp;
@@ -697,7 +696,7 @@ anim *anim_load(const char *real_filename, int cf_dir_type, int file_mapped)
697696
}
698697

699698
if (!ptr) {
700-
fp = cfopen(name, "rb", CFILE_NORMAL, cf_dir_type);
699+
fp = cfopen(name, "rb", cf_dir_type);
701700
if ( !fp )
702701
return NULL;
703702

@@ -743,18 +742,9 @@ anim *anim_load(const char *real_filename, int cf_dir_type, int file_mapped)
743742

744743
ptr->cfile_ptr = NULL;
745744

746-
if ( file_mapped == PAGE_FROM_MEM) {
747-
// Try mapping the file to memory
748-
ptr->flags |= ANF_MEM_MAPPED;
749-
ptr->cfile_ptr = cfopen(name, "rb", CFILE_MEMORY_MAPPED, cf_dir_type);
750-
}
751-
752-
// couldn't memory-map file... must be in a packfile, so stream manually
753-
if ( file_mapped == PAGE_FROM_MEM && !ptr->cfile_ptr ) {
754-
ptr->flags &= ~ANF_MEM_MAPPED;
755-
ptr->flags |= ANF_STREAMED;
756-
ptr->cfile_ptr = cfopen(name, "rb", CFILE_NORMAL, cf_dir_type);
757-
}
745+
// NOTE: mapped files no longer supported!!
746+
ptr->flags |= ANF_STREAMED;
747+
ptr->cfile_ptr = cfopen(name, "rb", cf_dir_type);
758748

759749
ptr->cache = NULL;
760750

code/anim/animplay.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ typedef struct {
3838
int ping_pong;
3939
} anim_play_struct;
4040

41-
enum
42-
{
43-
PAGE_FROM_DISK = 0,
44-
PAGE_FROM_MEM = 1
45-
};
46-
4741
extern int Anim_paused;
4842

4943
void anim_init();
@@ -57,7 +51,7 @@ void anim_ignore_next_frametime();
5751
int anim_show_next_frame(anim_instance *instance, float frametime);
5852
void anim_release_all_instances(int screen_id = 0);
5953
void anim_release_render_instance(anim_instance* instance);
60-
anim *anim_load(const char *name, int cf_dir_type = CF_TYPE_ANY, int file_mapped = PAGE_FROM_DISK);
54+
anim *anim_load(const char *name, int cf_dir_type = CF_TYPE_ANY);
6155
int anim_free(anim *ptr);
6256
void anim_read_header(anim *ptr, CFILE *fp);
6357
void anim_reverse_direction(anim_instance *ai); // called automatically for ping-ponging, and can also be called externally

0 commit comments

Comments
 (0)