Quake II RTX doxygen
1.0 dev
|
|
Go to the documentation of this file.
20 #include "common/files.h"
21 #include "common/mdfour.h"
31 #define DEMO_EXTENSIONS ".dm2;.dm2.gz;.mvd2;.mvd2.gz"
33 #define DEMO_EXTRASIZE q_offsetof(demoEntry_t, name)
35 #define DEMO_MVD_POV "\x90\xcd\xd6\xc4\x91" // [MVD]
36 #define DEMO_DIR_SIZE "\x90\xc4\xc9\xd2\x91" // [DIR]
74 static void BuildName(
const file_info_t *info,
char **cache)
76 char buffer[MAX_OSPATH];
83 memset(&demo, 0,
sizeof(demo));
84 strcpy(demo.map,
"???");
85 strcpy(demo.pov,
"???");
89 char *p = strchr(s,
'\\');
111 len = strlen(demo.map);
119 len = strlen(demo.pov);
126 if ((tm = localtime(&info->mtime)) != NULL) {
128 len = strftime(date,
sizeof(date),
"%b %d %H:%M", tm);
130 len = strftime(date,
sizeof(date),
"%b %d %Y", tm);
140 info->name, date, buffer, demo.map, demo.pov, NULL);
142 e->
size = info->size;
143 e->
mtime = info->mtime;
163 char buffer[MAX_OSPATH], *cache;
169 if (len >=
sizeof(buffer)) {
172 len =
FS_LoadFileEx(buffer, (
void **)&cache, FS_TYPE_REAL | FS_PATH_GAME, TAG_FILESYSTEM);
180 for (i = 0; i < 16; i++) {
181 int c1 = Q_charhex(cache[i * 2 + 0]);
182 int c2 = Q_charhex(cache[i * 2 + 1]);
183 hash[i] = (c1 << 4) | c2;
186 if (cache[32] !=
'\\') {
194 Com_DPrintf(
"%s: loading from cache\n", __func__);
204 char buffer[MAX_OSPATH];
216 if (len >=
sizeof(buffer)) {
224 for (i = 0; i < 16; i++) {
247 len =
sizeof(*info) + strlen(info->name) - 1;
277 int numDirs, numDemos;
278 void **dirlist, **demolist;
293 FS_SEARCH_DIRSONLY, &numDirs);
295 FS_SEARCH_EXTRAINFO, &numDemos);
316 for (i = 0; i < numDirs; i++) {
327 if ((cache =
LoadCache(demolist)) != NULL) {
329 for (i = 0; i < numDemos; i++) {
334 for (i = 0; i < numDemos; i++) {
358 "%d demo%s, ", i, i == 1 ?
"" :
"s");
403 if (!strcmp(e->
name, s + 1)) {
417 len = strlen(e->
name);
437 char buffer[MAX_STRING_CHARS];
440 len =
Q_snprintf(buffer,
sizeof(buffer),
"demo \"%s/%s\"\n",
443 if (len >=
sizeof(buffer)) {
472 static int sizecmp(
const void *p1,
const void *p2)
486 static int timecmp(
const void *p1,
const void *p2)
500 static int namecmp(
const void *p1,
const void *p2)
540 if (w2 > 8 * CHAR_WIDTH) {
562 if (key == K_BACKSPACE) {
588 time_t now = time(NULL);
589 struct tm *tm = localtime(&now);
static int timecmp(const void *p1, const void *p2)
static cvar_t * ui_listalldemos
static char * LoadCache(void **list)
static int namecmp(const void *p1, const void *p2)
size_t Q_snprintf(char *dest, size_t size, const char *fmt,...)
static void Size(menuFrameWork_t *self)
size_t Com_FormatSizeLong(char *dest, size_t destsize, off_t bytes)
demoInfo_t * CL_GetDemoInfo(const char *path, demoInfo_t *info)
void S_StopAllSounds(void)
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags)
static menuSound_t Activate(menuCommon_t *self)
static menuSound_t LeaveDirectory(void)
void FS_FreeList(void **list)
void SCR_UpdateScreen(void)
static void FreeList(void)
ssize_t FS_FPrintf(qhandle_t f, const char *format,...)
static int sizecmp(const void *p1, const void *p2)
static void ui_sortdemos_changed(cvar_t *self)
char * UI_GetColumn(char *s, int n)
void * UI_FormatColumns(int extrasize,...)
static void Expose(menuFrameWork_t *self)
static menuSound_t Keydown(menuFrameWork_t *self, int key)
#define MLIST_SCROLLBAR_WIDTH
ssize_t FS_FOpenFile(const char *name, qhandle_t *f, unsigned mode)
static void Draw(menuFrameWork_t *self)
static void Pop(menuFrameWork_t *self)
static void CalcHash(void **list)
void Cbuf_AddText(cmdbuf_t *buf, const char *text)
char * va(const char *format,...)
static menuSound_t Sort(menuList_t *self)
void UI_DrawString(int x, int y, int flags, const char *string)
void ** FS_ListFiles(const char *path, const char *filter, unsigned flags, int *count_p)
size_t Q_strlcpy(char *dst, const char *src, size_t size)
void mdfour_result(struct mdfour *md, uint8_t *out)
static void Free(menuFrameWork_t *self)
struct m_demos_s m_demos_t
struct uiStatic_s::@9 color
static void BuildList(void)
static void BuildDir(const char *name, int type)
int Cvar_ClampInteger(cvar_t *var, int min, int max)
size_t Com_FormatSize(char *dest, size_t destsize, off_t bytes)
static void WriteCache(void)
static menuSound_t PlayDemo(demoEntry_t *e)
qhandle_t backgroundHandle
static menuSound_t Change(menuCommon_t *self)
void FS_FCloseFile(qhandle_t f)
size_t Q_concat(char *dest, size_t size,...)
static void BuildName(const file_info_t *info, char **cache)
size_t Q_scnprintf(char *dest, size_t size, const char *fmt,...)
char fs_gamedir[MAX_OSPATH]
ssize_t FS_LoadFileEx(const char *path, void **buffer, unsigned flags, memtag_t tag)
void mdfour_update(struct mdfour *md, uint8_t *in, size_t n)
static cvar_t * ui_sortdemos
void mdfour_begin(struct mdfour *md)
static menuSound_t EnterDirectory(demoEntry_t *e)