+ sys_handles[i] = f;
+ *handle = i;
+ retval = Sys_FileLength(f);
+ }
+
+ return retval;
+}
+
+int Sys_FileOpenWrite (const char *path)
+{
+ QFile *f;
+ int i;
+
+ i = findhandle ();
+
+ f = Qopen(path, "wb");
+ if (!f)
+ {
+ Con_Printf("Sys_FileOpenWrite: Error opening %s: %s", path, strerror(errno));
+ return 0;
+ }
+ sys_handles[i] = f;
+
+ return i;
+}
+
+void Sys_FileClose (int handle)
+{
+ Qclose (sys_handles[handle]);
+ sys_handles[handle] = NULL;
+}
+
+void Sys_FileSeek (int handle, int position)
+{
+ Qseek (sys_handles[handle], position, SEEK_SET);
+}
+
+int Sys_FileRead (int handle, void *dest, int count)
+{
+ return Qread (sys_handles[handle], dest, count);
+}
+
+int Sys_FileWrite (int handle, void *data, int count)
+{
+ return Qwrite (sys_handles[handle], data, count);
+}
+
+int Sys_FileTime (const char *path)
+{
+#if WIN32
+ QFile *f;
+
+ f = Qopen(path, "rb");
+ if (f)
+ {
+ Qclose(f);
+ return 1;
+ }
+
+ return -1;
+#else
+ struct stat buf;
+
+ if (stat (path,&buf) == -1)
+ return -1;
+
+ return buf.st_mtime;
+#endif
+}
+
+void Sys_mkdir (const char *path)
+{
+#if WIN32
+ _mkdir (path);
+#else
+ mkdir (path, 0777);
+#endif
+}
+
+char engineversion[128];
+
+void Sys_Shared_EarlyInit(void)
+{
+ Memory_Init ();
+
+ COM_InitArgv();
+ COM_InitGameType();
+