sys_null.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. // sys_null.h -- null system driver to aid porting efforts
  2. #include "quakedef.h"
  3. #include "errno.h"
  4. /*
  5. ================
  6. filelength
  7. ================
  8. */
  9. int filelength (FILE *f)
  10. {
  11. int pos;
  12. int end;
  13. pos = ftell (f);
  14. fseek (f, 0, SEEK_END);
  15. end = ftell (f);
  16. fseek (f, pos, SEEK_SET);
  17. return end;
  18. }
  19. int Sys_FileTime (char *path)
  20. {
  21. FILE *f;
  22. f = fopen(path, "rb");
  23. if (f)
  24. {
  25. fclose(f);
  26. return 1;
  27. }
  28. return -1;
  29. }
  30. void Sys_mkdir (char *path)
  31. {
  32. }
  33. /*
  34. ===============================================================================
  35. SYSTEM IO
  36. ===============================================================================
  37. */
  38. void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
  39. {
  40. }
  41. void Sys_DebugLog(char *file, char *fmt, ...)
  42. {
  43. }
  44. void Sys_Error (char *error, ...)
  45. {
  46. va_list argptr;
  47. printf ("I_Error: ");
  48. va_start (argptr,error);
  49. vprintf (error,argptr);
  50. va_end (argptr);
  51. printf ("\n");
  52. exit (1);
  53. }
  54. void Sys_Printf (char *fmt, ...)
  55. {
  56. va_list argptr;
  57. va_start (argptr,fmt);
  58. vprintf (fmt,argptr);
  59. va_end (argptr);
  60. }
  61. void Sys_Quit (void)
  62. {
  63. exit (0);
  64. }
  65. double Sys_FloatTime (void)
  66. {
  67. static double t;
  68. t += 0.1;
  69. return t;
  70. }
  71. char *Sys_ConsoleInput (void)
  72. {
  73. return NULL;
  74. }
  75. void Sys_Sleep (void)
  76. {
  77. }
  78. void Sys_SendKeyEvents (void)
  79. {
  80. }
  81. void Sys_HighFPPrecision (void)
  82. {
  83. }
  84. void Sys_LowFPPrecision (void)
  85. {
  86. }
  87. //=============================================================================
  88. void main (int argc, char **argv)
  89. {
  90. quakeparms_t parms;
  91. parms.memsize = 5861376;
  92. parms.membase = malloc (parms.memsize);
  93. parms.basedir = ".";
  94. COM_InitArgv (argc, argv);
  95. parms.argc = com_argc;
  96. parms.argv = com_argv;
  97. printf ("Host_Init\n");
  98. Host_Init (&parms);
  99. while (1)
  100. {
  101. Host_Frame (0.1);
  102. }
  103. }