mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 15:02:01 +00:00
cdff5bdc08
The old code went through a list of predefined file names and looked each of them up in a list of predefined directories until it found a match. This made it nearly impossible to add custom IWAD support because the list of valid file names could not be extended. This has now been switched around to run a scan for matching files on each given directory. With this approach it can look for *.iwad and *.ipk3 as IWAD extensions as well and read an IWADINFO out of these files that can be added to the internal list of IWADs, making it finally possible to define custom IWADs without having to add them to the internal list. (This isn't fully tested yet so some errors may still occur.)
88 lines
2.1 KiB
C
88 lines
2.1 KiB
C
// cmdlib.h
|
|
|
|
#ifndef __CMDLIB__
|
|
#define __CMDLIB__
|
|
|
|
|
|
#include "doomtype.h"
|
|
#include "doomdef.h"
|
|
#include "m_fixed.h"
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
#include <ctype.h>
|
|
#include <stdarg.h>
|
|
|
|
// the dec offsetof macro doesnt work very well...
|
|
#define myoffsetof(type,identifier) ((size_t)&((type *)alignof(type))->identifier - alignof(type))
|
|
|
|
int Q_filelength (FILE *f);
|
|
bool FileExists (const char *filename);
|
|
bool DirExists(const char *filename);
|
|
bool DirEntryExists (const char *pathname);
|
|
|
|
extern FString progdir;
|
|
|
|
void FixPathSeperator (char *path);
|
|
static void inline FixPathSeperator (FString &path) { path.ReplaceChars('\\', '/'); }
|
|
|
|
void DefaultExtension (char *path, const char *extension);
|
|
void DefaultExtension (FString &path, const char *extension);
|
|
|
|
FString ExtractFilePath (const char *path);
|
|
FString ExtractFileBase (const char *path, bool keep_extension=false);
|
|
|
|
struct FScriptPosition;
|
|
int ParseHex(const char *str, FScriptPosition *sc = nullptr);
|
|
bool IsNum (const char *str); // [RH] added
|
|
|
|
char *copystring(const char *s);
|
|
void ReplaceString (char **ptr, const char *str);
|
|
|
|
bool CheckWildcards (const char *pattern, const char *text);
|
|
|
|
void FormatGUID (char *buffer, size_t buffsize, const GUID &guid);
|
|
|
|
const char *myasctime ();
|
|
|
|
int strbin (char *str);
|
|
FString strbin1 (const char *start);
|
|
char *CleanseString (char *str);
|
|
|
|
void CreatePath(const char * fn);
|
|
|
|
FString ExpandEnvVars(const char *searchpathstring);
|
|
FString NicePath(const char *path);
|
|
|
|
struct FFileList
|
|
{
|
|
FString Filename;
|
|
bool isDirectory;
|
|
};
|
|
|
|
void ScanDirectory(TArray<FFileList> &list, const char *dirpath);
|
|
|
|
|
|
//==========================================================================
|
|
//
|
|
// Functions to compensate for a tic being a bit short.
|
|
// Since ZDoom uses a milliseconds timer for game timing
|
|
// 35 tics are actually only 0.98 seconds.
|
|
// For real time display this needs to be adjusted
|
|
//
|
|
//==========================================================================
|
|
|
|
inline int AdjustTics(int tics)
|
|
{
|
|
return Scale(tics, 98, 100);
|
|
}
|
|
|
|
inline int Tics2Seconds(int tics)
|
|
{
|
|
return Scale(tics, 98, (100 * TICRATE));
|
|
}
|
|
|
|
|
|
#endif
|