Darkvater@4218: /* $Id$ */ Darkvater@4218: Darkvater@4218: #ifndef FIOS_H Darkvater@4218: #define FIOS_H Darkvater@4218: Darkvater@4223: /* Deals with finding savegames */ Darkvater@4223: typedef struct { Darkvater@4223: byte type; Darkvater@4223: uint64 mtime; Darkvater@4223: char title[64]; Darkvater@4223: char name[256 - 12 - 64]; Darkvater@4223: } FiosItem; Darkvater@4223: Darkvater@4223: enum { rubidium@4344: FIOS_TYPE_DRIVE = 0, rubidium@4344: FIOS_TYPE_PARENT = 1, rubidium@4344: FIOS_TYPE_DIR = 2, rubidium@4344: FIOS_TYPE_FILE = 3, rubidium@4344: FIOS_TYPE_OLDFILE = 4, rubidium@4344: FIOS_TYPE_SCENARIO = 5, rubidium@4344: FIOS_TYPE_OLD_SCENARIO = 6, rubidium@4344: FIOS_TYPE_DIRECT = 7, rubidium@4344: FIOS_TYPE_PNG = 8, rubidium@4344: FIOS_TYPE_BMP = 9, rubidium@4344: FIOS_TYPE_INVALID = 255, Darkvater@4223: }; Darkvater@4223: Darkvater@4223: /* Variables to display file lists */ Darkvater@4223: extern FiosItem *_fios_list; // defined in misc_gui.c Darkvater@4223: extern int _fios_num; // defined in fios.c, read_only version of _fios_count Darkvater@4223: extern int _saveload_mode; // defined in misc_gui.c Darkvater@4223: Darkvater@4223: // Get a list of savegames Darkvater@4223: FiosItem *FiosGetSavegameList(int mode); Darkvater@4223: // Get a list of scenarios Darkvater@4223: FiosItem *FiosGetScenarioList(int mode); truelight@4300: // Get a list of Heightmaps truelight@4300: FiosItem *FiosGetHeightmapList(int mode); Darkvater@4223: // Free the list of savegames Darkvater@4223: void FiosFreeSavegameList(void); Darkvater@4223: // Browse to. Returns a filename w/path if we reached a file. Darkvater@4223: char *FiosBrowseTo(const FiosItem *item); Darkvater@4223: // Return path, free space and stringID Darkvater@4223: StringID FiosGetDescText(const char **path, uint32 *total_free); Darkvater@4223: // Delete a name Darkvater@4223: bool FiosDelete(const char *name); Darkvater@4223: // Make a filename from a name Darkvater@4223: void FiosMakeSavegameName(char *buf, const char *name, size_t size); Darkvater@4223: // Allocate a new FiosItem Darkvater@4223: FiosItem *FiosAlloc(void); Darkvater@4223: Darkvater@4223: int CDECL compare_FiosItems(const void *a, const void *b); Darkvater@4223: Darkvater@4218: /* Implementation of opendir/readdir/closedir for Windows */ Darkvater@4218: #if defined(WIN32) Darkvater@4218: #include Darkvater@4218: typedef struct DIR DIR; Darkvater@4218: Darkvater@4218: typedef struct dirent { // XXX - only d_name implemented Darkvater@5167: wchar_t *d_name; /* name of found file */ Darkvater@4218: /* little hack which will point to parent DIR struct which will Darkvater@4218: * save us a call to GetFileAttributes if we want information Darkvater@4218: * about the file (for example in function fio_bla */ Darkvater@4218: DIR *dir; Darkvater@4218: } dirent; Darkvater@4218: Darkvater@4218: struct DIR { Darkvater@4218: HANDLE hFind; Darkvater@4218: /* the dirent returned by readdir. Darkvater@4218: * note: having only one global instance is not possible because Darkvater@4218: * multiple independent opendir/readdir sequences must be supported. */ Darkvater@4218: dirent ent; Darkvater@5167: WIN32_FIND_DATAW fd; Darkvater@4218: /* since opendir calls FindFirstFile, we need a means of telling the Darkvater@4218: * first call to readdir that we already have a file. Darkvater@4218: * that's the case iff this is true */ Darkvater@4218: bool at_first_entry; Darkvater@4218: }; Darkvater@4218: Darkvater@4218: DIR *opendir(const char *path); Darkvater@4218: struct dirent *readdir(DIR *d); Darkvater@4218: int closedir(DIR *d); Darkvater@4218: Darkvater@4218: #endif /* defined(WIN32) */ Darkvater@4218: Darkvater@4218: #endif /* FIOS_H */