Quake II RTX doxygen  1.0 dev
demos.c File Reference
#include "ui.h"
#include "common/files.h"
#include "common/mdfour.h"

Go to the source code of this file.

Classes

struct  demoEntry_t
 
struct  m_demos_s
 

Macros

#define DEMO_EXTENSIONS   ".dm2;.dm2.gz;.mvd2;.mvd2.gz"
 
#define DEMO_EXTRASIZE   q_offsetof(demoEntry_t, name)
 
#define DEMO_MVD_POV   "\x90\xcd\xd6\xc4\x91"
 
#define DEMO_DIR_SIZE   "\x90\xc4\xc9\xd2\x91"
 
#define ENTRY_UP   1
 
#define ENTRY_DN   2
 
#define ENTRY_DEMO   3
 
#define COL_NAME   0
 
#define COL_DATE   1
 
#define COL_SIZE   2
 
#define COL_MAP   3
 
#define COL_POV   4
 
#define COL_MAX   5
 

Typedefs

typedef struct m_demos_s m_demos_t
 

Functions

static void BuildName (const file_info_t *info, char **cache)
 
static void BuildDir (const char *name, int type)
 
static char * LoadCache (void **list)
 
static void WriteCache (void)
 
static void CalcHash (void **list)
 
static menuSound_t Change (menuCommon_t *self)
 
static void BuildList (void)
 
static void FreeList (void)
 
static menuSound_t LeaveDirectory (void)
 
static menuSound_t EnterDirectory (demoEntry_t *e)
 
static menuSound_t PlayDemo (demoEntry_t *e)
 
static menuSound_t Activate (menuCommon_t *self)
 
static int sizecmp (const void *p1, const void *p2)
 
static int timecmp (const void *p1, const void *p2)
 
static int namecmp (const void *p1, const void *p2)
 
static menuSound_t Sort (menuList_t *self)
 
static void Size (menuFrameWork_t *self)
 
static menuSound_t Keydown (menuFrameWork_t *self, int key)
 
static void Draw (menuFrameWork_t *self)
 
static void Pop (menuFrameWork_t *self)
 
static void Expose (menuFrameWork_t *self)
 
static void Free (menuFrameWork_t *self)
 
static void ui_sortdemos_changed (cvar_t *self)
 
void M_Menu_Demos (void)
 

Variables

static m_demos_t m_demos
 
static cvar_t * ui_sortdemos
 
static cvar_t * ui_listalldemos
 

Macro Definition Documentation

◆ COL_DATE

#define COL_DATE   1

Definition at line 43 of file demos.c.

◆ COL_MAP

#define COL_MAP   3

Definition at line 45 of file demos.c.

◆ COL_MAX

#define COL_MAX   5

Definition at line 47 of file demos.c.

◆ COL_NAME

#define COL_NAME   0

Definition at line 42 of file demos.c.

◆ COL_POV

#define COL_POV   4

Definition at line 46 of file demos.c.

◆ COL_SIZE

#define COL_SIZE   2

Definition at line 44 of file demos.c.

◆ DEMO_DIR_SIZE

#define DEMO_DIR_SIZE   "\x90\xc4\xc9\xd2\x91"

Definition at line 36 of file demos.c.

◆ DEMO_EXTENSIONS

#define DEMO_EXTENSIONS   ".dm2;.dm2.gz;.mvd2;.mvd2.gz"

Definition at line 31 of file demos.c.

◆ DEMO_EXTRASIZE

#define DEMO_EXTRASIZE   q_offsetof(demoEntry_t, name)

Definition at line 33 of file demos.c.

◆ DEMO_MVD_POV

#define DEMO_MVD_POV   "\x90\xcd\xd6\xc4\x91"

Definition at line 35 of file demos.c.

◆ ENTRY_DEMO

#define ENTRY_DEMO   3

Definition at line 40 of file demos.c.

◆ ENTRY_DN

#define ENTRY_DN   2

Definition at line 39 of file demos.c.

◆ ENTRY_UP

#define ENTRY_UP   1

Definition at line 38 of file demos.c.

Typedef Documentation

◆ m_demos_t

typedef struct m_demos_s m_demos_t

Function Documentation

◆ Activate()

static menuSound_t Activate ( menuCommon_t self)
static

Definition at line 451 of file demos.c.

452 {
453  demoEntry_t *e;
454 
455  if (!m_demos.list.numItems) {
456  return QMS_BEEP;
457  }
458 
460  switch (e->type) {
461  case ENTRY_UP:
462  return LeaveDirectory();
463  case ENTRY_DN:
464  return EnterDirectory(e);
465  case ENTRY_DEMO:
466  return PlayDemo(e);
467  }
468 
469  return QMS_NOTHANDLED;
470 }

Referenced by M_Menu_Demos().

◆ BuildDir()

static void BuildDir ( const char *  name,
int  type 
)
static

Definition at line 150 of file demos.c.

151 {
152  demoEntry_t *e = UI_FormatColumns(DEMO_EXTRASIZE, name, "-", DEMO_DIR_SIZE, "-", "-", NULL);
153 
154  e->type = type;
155  e->size = 0;
156  e->mtime = 0;
157 
159 }

Referenced by BuildList().

◆ BuildList()

static void BuildList ( void  )
static

Definition at line 275 of file demos.c.

276 {
277  int numDirs, numDemos;
278  void **dirlist, **demolist;
279  char *cache, *p;
280  unsigned flags;
281  size_t len;
282  int i;
283 
284  // this can be a lengthy process
285  S_StopAllSounds();
286 
287  m_demos.menu.status = "Building list...";
289 
290  // list files
291  flags = ui_listalldemos->integer ? 0 : FS_TYPE_REAL | FS_PATH_GAME;
292  dirlist = FS_ListFiles(m_demos.browse, NULL, flags |
293  FS_SEARCH_DIRSONLY, &numDirs);
295  FS_SEARCH_EXTRAINFO, &numDemos);
296 
297  // alloc entries
298  m_demos.list.items = UI_Malloc(sizeof(demoEntry_t *) * (numDirs + numDemos + 1));
299  m_demos.list.numItems = 0;
300  m_demos.list.curvalue = 0;
301  m_demos.list.prestep = 0;
302 
303  m_demos.widest_map = 3;
304  m_demos.widest_pov = 3;
305  m_demos.total_bytes = 0;
306 
307  // start with minimum size
309 
310  if (strcmp(m_demos.browse, "/")) {
311  BuildDir("..", ENTRY_UP);
312  }
313 
314  // add directories
315  if (dirlist) {
316  for (i = 0; i < numDirs; i++) {
317  BuildDir(dirlist[i], ENTRY_DN);
318  }
319  FS_FreeList(dirlist);
320  }
321 
323 
324  // add demos
325  if (demolist) {
326  CalcHash(demolist);
327  if ((cache = LoadCache(demolist)) != NULL) {
328  p = cache + 32 + 1;
329  for (i = 0; i < numDemos; i++) {
330  BuildName(demolist[i], &p);
331  }
332  FS_FreeFile(cache);
333  } else {
334  for (i = 0; i < numDemos; i++) {
335  BuildName(demolist[i], NULL);
336  if ((i & 7) == 0) {
339  }
340  }
341  }
342  WriteCache();
343  FS_FreeList(demolist);
344  }
345 
346  // update status line and sort
348  if (m_demos.list.sortdir) {
350  }
351 
352  // resize columns
354 
355  // format our extra status line
357  len = Q_scnprintf(m_demos.status, sizeof(m_demos.status),
358  "%d demo%s, ", i, i == 1 ? "" : "s");
359  Com_FormatSizeLong(m_demos.status + len, sizeof(m_demos.status) - len,
361 
363 }

Referenced by EnterDirectory(), Expose(), and LeaveDirectory().

◆ BuildName()

static void BuildName ( const file_info_t *  info,
char **  cache 
)
static

Definition at line 74 of file demos.c.

75 {
76  char buffer[MAX_OSPATH];
77  char date[MAX_QPATH];
78  demoInfo_t demo;
79  demoEntry_t *e;
80  struct tm *tm;
81  size_t len;
82 
83  memset(&demo, 0, sizeof(demo));
84  strcpy(demo.map, "???");
85  strcpy(demo.pov, "???");
86 
87  if (cache) {
88  char *s = *cache;
89  char *p = strchr(s, '\\');
90  if (p) {
91  *p = 0;
92  Q_strlcpy(demo.map, s, sizeof(demo.map));
93  s = p + 1;
94  p = strchr(s, '\\');
95  if (p) {
96  *p = 0;
97  Q_strlcpy(demo.pov, s, sizeof(demo.pov));
98  s = p + 1;
99  }
100  }
101  *cache = s;
102  } else {
103  Q_concat(buffer, sizeof(buffer), m_demos.browse, "/", info->name, NULL);
104  CL_GetDemoInfo(buffer, &demo);
105  if (demo.mvd) {
106  strcpy(demo.pov, DEMO_MVD_POV);
107  }
108  }
109 
110  // resize columns
111  len = strlen(demo.map);
112  if (len > 8) {
113  len = 8;
114  }
115  if (len > m_demos.widest_map) {
116  m_demos.widest_map = len;
117  }
118 
119  len = strlen(demo.pov);
120  if (len > m_demos.widest_pov) {
121  m_demos.widest_pov = len;
122  }
123 
124  // format date
125  len = 0;
126  if ((tm = localtime(&info->mtime)) != NULL) {
127  if (tm->tm_year == m_demos.year) {
128  len = strftime(date, sizeof(date), "%b %d %H:%M", tm);
129  } else {
130  len = strftime(date, sizeof(date), "%b %d %Y", tm);
131  }
132  }
133  if (!len) {
134  strcpy(date, "???");
135  }
136 
137  Com_FormatSize(buffer, sizeof(buffer), info->size);
138 
140  info->name, date, buffer, demo.map, demo.pov, NULL);
141  e->type = ENTRY_DEMO;
142  e->size = info->size;
143  e->mtime = info->mtime;
144 
145  m_demos.total_bytes += info->size;
146 
148 }

Referenced by BuildList().

◆ CalcHash()

static void CalcHash ( void **  list)
static

Definition at line 238 of file demos.c.

239 {
240  struct mdfour md;
241  file_info_t *info;
242  size_t len;
243 
244  mdfour_begin(&md);
245  while (*list) {
246  info = *list++;
247  len = sizeof(*info) + strlen(info->name) - 1;
248  mdfour_update(&md, (uint8_t *)info, len);
249  }
250  mdfour_result(&md, m_demos.hash);
251 }

Referenced by BuildList().

◆ Change()

static menuSound_t Change ( menuCommon_t self)
static

Definition at line 253 of file demos.c.

254 {
255  demoEntry_t *e;
256 
257  if (!m_demos.list.numItems) {
258  m_demos.menu.status = "No demos found";
259  return QMS_BEEP;
260  }
261 
263  switch (e->type) {
264  case ENTRY_DEMO:
265  m_demos.menu.status = "Press Enter to play demo";
266  break;
267  default:
268  m_demos.menu.status = "Press Enter to change directory";
269  break;
270  }
271 
272  return QMS_SILENT;
273 }

Referenced by BuildList(), and M_Menu_Demos().

◆ Draw()

static void Draw ( menuFrameWork_t self)
static

Definition at line 570 of file demos.c.

571 {
572  Menu_Draw(self);
573  if (uis.width >= 640) {
574  UI_DrawString(uis.width, uis.height - CHAR_HEIGHT,
575  UI_RIGHT, m_demos.status);
576  }
577 }

Referenced by M_Menu_Demos().

◆ EnterDirectory()

static menuSound_t EnterDirectory ( demoEntry_t e)
static

Definition at line 412 of file demos.c.

413 {
414  size_t baselen, len;
415 
416  baselen = strlen(m_demos.browse);
417  len = strlen(e->name);
418  if (baselen + 1 + len >= sizeof(m_demos.browse)) {
419  return QMS_BEEP;
420  }
421 
422  if (baselen == 0 || m_demos.browse[baselen - 1] != '/') {
423  m_demos.browse[baselen++] = '/';
424  }
425 
426  memcpy(m_demos.browse + baselen, e->name, len + 1);
427 
428  // rebuild list
429  FreeList();
430  BuildList();
432  return QMS_IN;
433 }

Referenced by Activate().

◆ Expose()

static void Expose ( menuFrameWork_t self)
static

Definition at line 586 of file demos.c.

587 {
588  time_t now = time(NULL);
589  struct tm *tm = localtime(&now);
590 
591  if (tm) {
592  m_demos.year = tm->tm_year;
593  }
594 
595  // check that target directory exists
596  if (strcmp(m_demos.browse, "/")
597  && ui_listalldemos->integer == 0
598  && os_access(va("%s%s", fs_gamedir, m_demos.browse), F_OK)) {
599  strcpy(m_demos.browse, "/");
600  }
601 
602  BuildList();
603 
604  // move cursor to previous position
606 }

Referenced by M_Menu_Demos().

◆ Free()

static void Free ( menuFrameWork_t self)
static

Definition at line 608 of file demos.c.

609 {
610  memset(&m_demos, 0, sizeof(m_demos));
611 }

Referenced by M_Menu_Demos().

◆ FreeList()

static void FreeList ( void  )
static

Definition at line 365 of file demos.c.

366 {
367  int i;
368 
369  if (m_demos.list.items) {
370  for (i = 0; i < m_demos.list.numItems; i++) {
371  Z_Free(m_demos.list.items[i]);
372  }
374  m_demos.list.items = NULL;
375  m_demos.list.numItems = 0;
376  }
377 }

Referenced by EnterDirectory(), LeaveDirectory(), and Pop().

◆ Keydown()

static menuSound_t Keydown ( menuFrameWork_t self,
int  key 
)
static

Definition at line 560 of file demos.c.

561 {
562  if (key == K_BACKSPACE) {
563  LeaveDirectory();
564  return QMS_OUT;
565  }
566 
567  return QMS_NOTHANDLED;
568 }

Referenced by M_Menu_Demos().

◆ LeaveDirectory()

static menuSound_t LeaveDirectory ( void  )
static

Definition at line 379 of file demos.c.

380 {
381  char *s;
382  int i;
383 
384  s = strrchr(m_demos.browse, '/');
385  if (!s) {
386  return QMS_BEEP;
387  }
388 
389  if (s == m_demos.browse) {
390  strcpy(m_demos.browse, "/");
391  } else {
392  *s = 0;
393  }
394 
395  // rebuild list
396  FreeList();
397  BuildList();
399 
400  // move cursor to the previous directory
401  for (i = 0; i < m_demos.numDirs; i++) {
402  demoEntry_t *e = m_demos.list.items[i];
403  if (!strcmp(e->name, s + 1)) {
405  break;
406  }
407  }
408 
409  return QMS_OUT;
410 }

Referenced by Activate(), and Keydown().

◆ LoadCache()

static char* LoadCache ( void **  list)
static

Definition at line 161 of file demos.c.

162 {
163  char buffer[MAX_OSPATH], *cache;
164  int i;
165  size_t len;
166  uint8_t hash[16];
167 
168  len = Q_concat(buffer, sizeof(buffer), m_demos.browse, "/" COM_DEMOCACHE_NAME, NULL);
169  if (len >= sizeof(buffer)) {
170  return NULL;
171  }
172  len = FS_LoadFileEx(buffer, (void **)&cache, FS_TYPE_REAL | FS_PATH_GAME, TAG_FILESYSTEM);
173  if (!cache) {
174  return NULL;
175  }
176  if (len < 33) {
177  goto fail;
178  }
179 
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;
184  }
185 
186  if (cache[32] != '\\') {
187  goto fail;
188  }
189 
190  if (memcmp(hash, m_demos.hash, 16)) {
191  goto fail;
192  }
193 
194  Com_DPrintf("%s: loading from cache\n", __func__);
195  return cache;
196 
197 fail:
198  FS_FreeFile(cache);
199  return NULL;
200 }

Referenced by BuildList().

◆ M_Menu_Demos()

void M_Menu_Demos ( void  )

Definition at line 636 of file demos.c.

637 {
638  ui_sortdemos = Cvar_Get("ui_sortdemos", "1", 0);
640 
641  ui_listalldemos = Cvar_Get("ui_listalldemos", "0", 0);
642 
643  m_demos.menu.name = "demos";
644  m_demos.menu.title = "Demo Browser";
645 
646  strcpy(m_demos.browse, "/demos");
647 
648  m_demos.menu.draw = Draw;
650  m_demos.menu.pop = Pop;
651  m_demos.menu.size = Size;
653  m_demos.menu.free = Free;
655  m_demos.menu.color.u32 = uis.color.background.u32;
657 
663  m_demos.list.sortdir = 1;
666  m_demos.list.sort = Sort;
668 
670  m_demos.list.columns[0].uiFlags = UI_LEFT;
671  m_demos.list.columns[1].name = "Date";
672  m_demos.list.columns[1].uiFlags = UI_CENTER;
673  m_demos.list.columns[2].name = "Size";
674  m_demos.list.columns[2].uiFlags = UI_RIGHT;
675  m_demos.list.columns[3].name = "Map";
676  m_demos.list.columns[3].uiFlags = UI_CENTER;
677  m_demos.list.columns[4].name = "POV";
678  m_demos.list.columns[4].uiFlags = UI_CENTER;
679 
681 
683 
684  List_Append(&ui_menus, &m_demos.menu.entry);
685 }

Referenced by UI_Init().

◆ namecmp()

static int namecmp ( const void p1,
const void p2 
)
static

Definition at line 500 of file demos.c.

501 {
502  demoEntry_t *e1 = *(demoEntry_t **)p1;
503  demoEntry_t *e2 = *(demoEntry_t **)p2;
504  char *s1 = UI_GetColumn(e1->name, m_demos.list.sortcol);
505  char *s2 = UI_GetColumn(e2->name, m_demos.list.sortcol);
506 
507  return Q_stricmp(s1, s2) * m_demos.list.sortdir;
508 }

Referenced by Sort().

◆ PlayDemo()

static menuSound_t PlayDemo ( demoEntry_t e)
static

Definition at line 435 of file demos.c.

436 {
437  char buffer[MAX_STRING_CHARS];
438  size_t len;
439 
440  len = Q_snprintf(buffer, sizeof(buffer), "demo \"%s/%s\"\n",
441  strcmp(m_demos.browse, "/") ? m_demos.browse : "",
442  e->name);
443  if (len >= sizeof(buffer)) {
444  return QMS_BEEP;
445  }
446 
447  Cbuf_AddText(&cmd_buffer, buffer);
448  return QMS_SILENT;
449 }

Referenced by Activate().

◆ Pop()

static void Pop ( menuFrameWork_t self)
static

Definition at line 579 of file demos.c.

580 {
581  // save previous position
583  FreeList();
584 }

Referenced by M_Menu_Demos().

◆ Size()

static void Size ( menuFrameWork_t self)
static

Definition at line 529 of file demos.c.

530 {
531  int w1, w2;
532 
533  m_demos.list.generic.x = 0;
534  m_demos.list.generic.y = CHAR_HEIGHT;
536  m_demos.list.generic.height = uis.height - CHAR_HEIGHT * 2 - 1;
537 
538  w1 = 17 + m_demos.widest_map + m_demos.widest_pov;
539  w2 = uis.width - w1 * CHAR_WIDTH - MLIST_PADDING * 4 - MLIST_SCROLLBAR_WIDTH;
540  if (w2 > 8 * CHAR_WIDTH) {
541  // everything fits
542  m_demos.list.columns[0].width = w2;
543  m_demos.list.columns[1].width = 12 * CHAR_WIDTH + MLIST_PADDING;
544  m_demos.list.columns[2].width = 5 * CHAR_WIDTH + MLIST_PADDING;
548  } else {
549  // map and pov don't fit
550  w2 = uis.width - 17 * CHAR_WIDTH - MLIST_PADDING * 2 - MLIST_SCROLLBAR_WIDTH;
551  m_demos.list.columns[0].width = w2;
552  m_demos.list.columns[1].width = 12 * CHAR_WIDTH + MLIST_PADDING;
553  m_demos.list.columns[2].width = 5 * CHAR_WIDTH + MLIST_PADDING;
554  m_demos.list.columns[3].width = 0;
555  m_demos.list.columns[4].width = 0;
557  }
558 }

Referenced by M_Menu_Demos().

◆ sizecmp()

static int sizecmp ( const void p1,
const void p2 
)
static

Definition at line 472 of file demos.c.

473 {
474  demoEntry_t *e1 = *(demoEntry_t **)p1;
475  demoEntry_t *e2 = *(demoEntry_t **)p2;
476 
477  if (e1->size > e2->size) {
478  return m_demos.list.sortdir;
479  }
480  if (e1->size < e2->size) {
481  return -m_demos.list.sortdir;
482  }
483  return 0;
484 }

Referenced by Sort().

◆ Sort()

static menuSound_t Sort ( menuList_t self)
static

Definition at line 510 of file demos.c.

511 {
512  switch (m_demos.list.sortcol) {
513  case COL_NAME:
514  case COL_MAP:
515  case COL_POV:
517  break;
518  case COL_DATE:
520  break;
521  case COL_SIZE:
523  break;
524  }
525 
526  return QMS_SILENT;
527 }

Referenced by M_Menu_Demos().

◆ timecmp()

static int timecmp ( const void p1,
const void p2 
)
static

Definition at line 486 of file demos.c.

487 {
488  demoEntry_t *e1 = *(demoEntry_t **)p1;
489  demoEntry_t *e2 = *(demoEntry_t **)p2;
490 
491  if (e1->mtime > e2->mtime) {
492  return m_demos.list.sortdir;
493  }
494  if (e1->mtime < e2->mtime) {
495  return -m_demos.list.sortdir;
496  }
497  return 0;
498 }

Referenced by Sort().

◆ ui_sortdemos_changed()

static void ui_sortdemos_changed ( cvar_t *  self)
static

Definition at line 613 of file demos.c.

614 {
615  int i = Cvar_ClampInteger(self, -COL_MAX, COL_MAX);
616 
617  if (i > 0) {
618  // ascending
619  m_demos.list.sortdir = 1;
620  m_demos.list.sortcol = i - 1;
621  } else if (i < 0) {
622  // descending
623  m_demos.list.sortdir = -1;
624  m_demos.list.sortcol = -i - 1;
625  } else {
626  // don't sort
627  m_demos.list.sortdir = 0;
628  m_demos.list.sortcol = 0;
629  }
630 
633  }
634 }

Referenced by M_Menu_Demos().

◆ WriteCache()

static void WriteCache ( void  )
static

Definition at line 202 of file demos.c.

203 {
204  char buffer[MAX_OSPATH];
205  qhandle_t f;
206  int i;
207  char *map, *pov;
208  demoEntry_t *e;
209  size_t len;
210 
212  return;
213  }
214 
215  len = Q_concat(buffer, sizeof(buffer), m_demos.browse, "/" COM_DEMOCACHE_NAME, NULL);
216  if (len >= sizeof(buffer)) {
217  return;
218  }
219  FS_FOpenFile(buffer, &f, FS_MODE_WRITE);
220  if (!f) {
221  return;
222  }
223 
224  for (i = 0; i < 16; i++) {
225  FS_FPrintf(f, "%02x", m_demos.hash[i]);
226  }
227  FS_FPrintf(f, "\\");
228 
229  for (i = m_demos.numDirs; i < m_demos.list.numItems; i++) {
230  e = m_demos.list.items[i];
231  map = UI_GetColumn(e->name, COL_MAP);
232  pov = UI_GetColumn(e->name, COL_POV);
233  FS_FPrintf(f, "%s\\%s\\", map, pov);
234  }
235  FS_FCloseFile(f);
236 }

Referenced by BuildList().

Variable Documentation

◆ m_demos

◆ ui_listalldemos

cvar_t* ui_listalldemos
static

Definition at line 72 of file demos.c.

Referenced by BuildList(), Expose(), and M_Menu_Demos().

◆ ui_sortdemos

cvar_t* ui_sortdemos
static

Definition at line 71 of file demos.c.

Referenced by M_Menu_Demos().

timecmp
static int timecmp(const void *p1, const void *p2)
Definition: demos.c:486
menuList_s::sortcol
int sortcol
Definition: ui.h:224
menuFrameWork_s::title
char * title
Definition: ui.h:101
menuList_s::columns
menuListColumn_t columns[MAX_COLUMNS]
Definition: ui.h:222
uiStatic_s::transparent
qboolean transparent
Definition: ui.h:301
m_demos_s::numDirs
int numDirs
Definition: demos.c:59
QMS_NOTHANDLED
@ QMS_NOTHANDLED
Definition: ui.h:68
ui_listalldemos
static cvar_t * ui_listalldemos
Definition: demos.c:72
menuCommon_s::change
menuSound_t(* change)(struct menuCommon_s *)
Definition: ui.h:158
menuFrameWork_s::status
char * status
Definition: ui.h:101
menuCommon_s::type
menuType_t type
Definition: ui.h:141
LoadCache
static char * LoadCache(void **list)
Definition: demos.c:161
namecmp
static int namecmp(const void *p1, const void *p2)
Definition: demos.c:500
menuFrameWork_s::name
char * name
Definition: ui.h:101
COL_SIZE
#define COL_SIZE
Definition: demos.c:44
DEMO_DIR_SIZE
#define DEMO_DIR_SIZE
Definition: demos.c:36
Q_snprintf
size_t Q_snprintf(char *dest, size_t size, const char *fmt,...)
Definition: shared.c:846
Size
static void Size(menuFrameWork_t *self)
Definition: demos.c:529
Com_FormatSizeLong
size_t Com_FormatSizeLong(char *dest, size_t destsize, off_t bytes)
Definition: utils.c:482
MenuList_Sort
void MenuList_Sort(menuList_t *l, int offset, int(*cmpfunc)(const void *, const void *))
Definition: menu.c:1465
CL_GetDemoInfo
demoInfo_t * CL_GetDemoInfo(const char *path, demoInfo_t *info)
Definition: demo.c:1091
m_demos_s::widest_map
int widest_map
Definition: demos.c:64
menuList_s::generic
menuCommon_t generic
Definition: ui.h:204
menuFrameWork_s::size
void(* size)(struct menuFrameWork_s *)
Definition: ui.h:135
menuCommon_s::activate
menuSound_t(* activate)(struct menuCommon_s *)
Definition: ui.h:157
menuCommon_s::height
int height
Definition: ui.h:150
m_demos_s::selection
int selection
Definition: demos.c:62
S_StopAllSounds
void S_StopAllSounds(void)
Definition: main.c:932
Cvar_Get
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags)
Definition: cvar.c:257
ENTRY_DEMO
#define ENTRY_DEMO
Definition: demos.c:40
Activate
static menuSound_t Activate(menuCommon_t *self)
Definition: demos.c:451
LeaveDirectory
static menuSound_t LeaveDirectory(void)
Definition: demos.c:379
menuFrameWork_s::free
void(* free)(struct menuFrameWork_s *)
Definition: ui.h:136
demoEntry_t::name
char name[1]
Definition: demos.c:53
FS_FreeList
void FS_FreeList(void **list)
Definition: files.c:2939
SCR_UpdateScreen
void SCR_UpdateScreen(void)
Definition: screen.c:2142
uiStatic_s::height
int height
Definition: ui.h:292
menuFrameWork_s::expose
void(* expose)(struct menuFrameWork_s *)
Definition: ui.h:133
menuList_s::numcolumns
int numcolumns
Definition: ui.h:223
demoEntry_t::size
size_t size
Definition: demos.c:51
COL_DATE
#define COL_DATE
Definition: demos.c:43
FreeList
static void FreeList(void)
Definition: demos.c:365
FS_FPrintf
ssize_t FS_FPrintf(qhandle_t f, const char *format,...)
Definition: files.c:2039
m_demos_s::menu
menuFrameWork_t menu
Definition: demos.c:57
sizecmp
static int sizecmp(const void *p1, const void *p2)
Definition: demos.c:472
menuFrameWork_s::image
qhandle_t image
Definition: ui.h:110
QMS_SILENT
@ QMS_SILENT
Definition: ui.h:69
demoEntry_t
Definition: demos.c:49
ui_sortdemos_changed
static void ui_sortdemos_changed(cvar_t *self)
Definition: demos.c:613
UI_GetColumn
char * UI_GetColumn(char *s, int n)
Definition: ui.c:281
menuList_s::mlFlags
int mlFlags
Definition: ui.h:209
COL_MAX
#define COL_MAX
Definition: demos.c:47
menuList_s::items
void ** items
Definition: ui.h:206
UI_FormatColumns
void * UI_FormatColumns(int extrasize,...)
Definition: ui.c:251
UI_Malloc
#define UI_Malloc(s)
Definition: ui.h:33
Expose
static void Expose(menuFrameWork_t *self)
Definition: demos.c:586
Keydown
static menuSound_t Keydown(menuFrameWork_t *self, int key)
Definition: demos.c:560
m_demos_s::widest_pov
int widest_pov
Definition: demos.c:64
COL_MAP
#define COL_MAP
Definition: demos.c:45
demoEntry_t::type
unsigned type
Definition: demos.c:50
MLIST_SCROLLBAR_WIDTH
#define MLIST_SCROLLBAR_WIDTH
Definition: ui.h:189
menuCommon_s::width
int width
Definition: ui.h:150
FS_FOpenFile
ssize_t FS_FOpenFile(const char *name, qhandle_t *f, unsigned mode)
Definition: files.c:1692
cmd_buffer
cmdbuf_t cmd_buffer
Definition: cmd.c:49
Draw
static void Draw(menuFrameWork_t *self)
Definition: demos.c:570
uis
uiStatic_t uis
Definition: ui.c:24
Pop
static void Pop(menuFrameWork_t *self)
Definition: demos.c:579
menuListColumn_s::uiFlags
int uiFlags
Definition: ui.h:200
CalcHash
static void CalcHash(void **list)
Definition: demos.c:238
menuListColumn_s::width
int width
Definition: ui.h:199
ENTRY_DN
#define ENTRY_DN
Definition: demos.c:39
QMF_HASFOCUS
#define QMF_HASFOCUS
Definition: ui.h:62
DEMO_EXTRASIZE
#define DEMO_EXTRASIZE
Definition: demos.c:33
menuList_s::sort
menuSound_t(* sort)(struct menuList_s *)
Definition: ui.h:226
DEMO_MVD_POV
#define DEMO_MVD_POV
Definition: demos.c:35
Menu_Draw
void Menu_Draw(menuFrameWork_t *menu)
Definition: menu.c:2196
Cbuf_AddText
void Cbuf_AddText(cmdbuf_t *buf, const char *text)
Definition: cmd.c:95
menuCommon_s::x
int x
Definition: ui.h:149
va
char * va(const char *format,...)
Definition: shared.c:429
Z_Free
void Z_Free(void *ptr)
Definition: zone.c:147
Sort
static menuSound_t Sort(menuList_t *self)
Definition: demos.c:510
menuList_s::sortdir
int sortdir
Definition: ui.h:224
QMS_OUT
@ QMS_OUT
Definition: ui.h:72
UI_DrawString
void UI_DrawString(int x, int y, int flags, const char *string)
Definition: ui.c:314
FS_ListFiles
void ** FS_ListFiles(const char *path, const char *filter, unsigned flags, int *count_p)
Definition: files.c:2716
m_demos_s::year
int year
Definition: demos.c:63
m_demos_s::browse
char browse[MAX_OSPATH]
Definition: demos.c:61
Q_strlcpy
size_t Q_strlcpy(char *dst, const char *src, size_t size)
Definition: shared.c:715
menuList_s::numItems
int numItems
Definition: ui.h:207
Menu_AddItem
void Menu_AddItem(menuFrameWork_t *menu, void *item)
Definition: menu.c:1785
menuList_s::extrasize
int extrasize
Definition: ui.h:210
mdfour_result
void mdfour_result(struct mdfour *md, uint8_t *out)
Definition: mdfour.c:175
Free
static void Free(menuFrameWork_t *self)
Definition: demos.c:608
ui_menus
list_t ui_menus
MLF_SCROLLBAR
#define MLF_SCROLLBAR
Definition: ui.h:194
menuCommon_s::y
int y
Definition: ui.h:149
menuFrameWork_s::color
color_t color
Definition: ui.h:111
MLF_HEADER
#define MLF_HEADER
Definition: ui.h:193
QMS_BEEP
@ QMS_BEEP
Definition: ui.h:73
m_demos
static m_demos_t m_demos
Definition: demos.c:69
uiStatic_s::color
struct uiStatic_s::@9 color
menuCommon_s::flags
int flags
Definition: ui.h:152
BuildList
static void BuildList(void)
Definition: demos.c:275
BuildDir
static void BuildDir(const char *name, int type)
Definition: demos.c:150
COL_POV
#define COL_POV
Definition: demos.c:46
Cvar_ClampInteger
int Cvar_ClampInteger(cvar_t *var, int min, int max)
Definition: cvar.c:549
menuListColumn_s::name
char * name
Definition: ui.h:198
edict_s::flags
int flags
Definition: g_local.h:986
uiStatic_s::width
int width
Definition: ui.h:292
uiStatic_s::background
color_t background
Definition: ui.h:314
Com_FormatSize
size_t Com_FormatSize(char *dest, size_t destsize, off_t bytes)
Definition: utils.c:465
COL_NAME
#define COL_NAME
Definition: demos.c:42
m_demos_s::list
menuList_t list
Definition: demos.c:58
WriteCache
static void WriteCache(void)
Definition: demos.c:202
PlayDemo
static menuSound_t PlayDemo(demoEntry_t *e)
Definition: demos.c:435
uiStatic_s::backgroundHandle
qhandle_t backgroundHandle
Definition: ui.h:306
m_demos_s::status
char status[32]
Definition: demos.c:66
Change
static menuSound_t Change(menuCommon_t *self)
Definition: demos.c:253
DEMO_EXTENSIONS
#define DEMO_EXTENSIONS
Definition: demos.c:31
menuFrameWork_s::entry
list_t entry
Definition: ui.h:99
QMS_IN
@ QMS_IN
Definition: ui.h:70
MTYPE_LIST
@ MTYPE_LIST
Definition: ui.h:42
menuFrameWork_s::draw
void(* draw)(struct menuFrameWork_s *)
Definition: ui.h:134
m_demos_s::total_bytes
size_t total_bytes
Definition: demos.c:65
FS_FCloseFile
void FS_FCloseFile(qhandle_t f)
Definition: files.c:759
Q_concat
size_t Q_concat(char *dest, size_t size,...)
Definition: shared.c:758
ENTRY_UP
#define ENTRY_UP
Definition: demos.c:38
menuList_s::prestep
int prestep
Definition: ui.h:212
MenuList_SetValue
void MenuList_SetValue(menuList_t *l, int value)
Definition: menu.c:860
m_demos_s::hash
uint8_t hash[16]
Definition: demos.c:60
BuildName
static void BuildName(const file_info_t *info, char **cache)
Definition: demos.c:74
MLIST_PADDING
#define MLIST_PADDING
Definition: ui.h:191
demoEntry_t::mtime
time_t mtime
Definition: demos.c:52
menuFrameWork_s::pop
void(* pop)(struct menuFrameWork_s *)
Definition: ui.h:132
Q_scnprintf
size_t Q_scnprintf(char *dest, size_t size, const char *fmt,...)
Definition: shared.c:867
menuFrameWork_s::transparent
qboolean transparent
Definition: ui.h:107
fs_gamedir
char fs_gamedir[MAX_OSPATH]
Definition: files.c:171
FS_LoadFileEx
ssize_t FS_LoadFileEx(const char *path, void **buffer, unsigned flags, memtag_t tag)
Definition: files.c:1864
MenuList_Init
void MenuList_Init(menuList_t *l)
Definition: menu.c:820
menuFrameWork_s::keydown
menuSound_t(* keydown)(struct menuFrameWork_s *, int)
Definition: ui.h:137
menuList_s::curvalue
int curvalue
Definition: ui.h:213
mdfour_update
void mdfour_update(struct mdfour *md, uint8_t *in, size_t n)
Definition: mdfour.c:155
ui_sortdemos
static cvar_t * ui_sortdemos
Definition: demos.c:71
mdfour_begin
void mdfour_begin(struct mdfour *md)
Definition: mdfour.c:118
EnterDirectory
static menuSound_t EnterDirectory(demoEntry_t *e)
Definition: demos.c:412