// open the demo file
Con_Printf("recording to %s.\n", name);
- cls.demofile = FS_Open (name, "wb", false);
+ cls.demofile = FS_Open (name, "wb", false, false);
if (!cls.demofile)
{
Con_Print("ERROR: couldn't open.\n");
FS_DefaultExtension (name, ".dem", sizeof (name));
Con_Printf("Playing demo from %s.\n", name);
- cls.demofile = FS_Open (name, "rb", false);
+ cls.demofile = FS_Open (name, "rb", false, false);
if (!cls.demofile)
{
Con_Print("ERROR: couldn't open.\n");
cls.timedemo = true;
// get first message this frame
- cls.td_lastframe = -1;
+ cls.td_lastframe = -1;
}
if (cl_capturevideo_rawrgb.integer)
{
cl_capturevideo_format = CAPTUREVIDEOFORMAT_RAWRGB;
- cl_capturevideo_videofile = FS_Open ("video/dpvideo.rgb", "wb", false);
+ cl_capturevideo_videofile = FS_Open ("video/dpvideo.rgb", "wb", false, true);
}
else if (cl_capturevideo_rawyv12.integer)
{
cl_capturevideo_format = CAPTUREVIDEOFORMAT_RAWYV12;
- cl_capturevideo_videofile = FS_Open ("video/dpvideo.yv12", "wb", false);
+ cl_capturevideo_videofile = FS_Open ("video/dpvideo.yv12", "wb", false, true);
}
else if (scr_screenshot_jpeg.integer)
{
cl_capturevideo_videofile = NULL;
}
- cl_capturevideo_soundfile = FS_Open ("video/dpvideo.wav", "wb", false);
+ cl_capturevideo_soundfile = FS_Open ("video/dpvideo.wav", "wb", false, true);
// wave header will be filled out when video ends
memset(out, 0, 44);
if (logfile != NULL || log_file.string[0] == '\0')
return;
- logfile = FS_Open (log_file.string, "ab", false);
+ logfile = FS_Open (log_file.string, "ab", false, false);
if (logfile != NULL)
{
strlcpy (crt_log_file, log_file.string, sizeof (crt_log_file));
{
qfile_t *file;
- file = FS_Open (logfilename, "ab", true);
+ file = FS_Open (logfilename, "ab", true, false);
if (file != NULL)
{
va_list argptr;
color = _con_colors[index];
// we dont want to display the color tag and the color index
first = last;
- }
+ }
}
}
rows = (lines-16)>>3; // rows of text to draw
y = lines - 16 - (rows<<3); // may start slightly negative
-
+
for (i = con_current - rows + 1;i <= con_current;i++, y += 8)
{
j = max(i - con_backscroll, 0);
{
qfile_t *file;
hz_bitstream_read_t *stream;
- if ((file = FS_Open (filename, "rb", false)))
+ if ((file = FS_Open (filename, "rb", false, false)))
{
stream = malloc(sizeof(hz_bitstream_read_t));
memset(stream, 0, sizeof(*stream));
Internal function used to create a qfile_t and open the relevant non-packed file on disk
====================
*/
-static qfile_t* FS_SysOpen (const char* filepath, const char* mode)
+static qfile_t* FS_SysOpen (const char* filepath, const char* mode, qboolean nonblocking)
{
qfile_t* file;
int mod, opt;
}
}
+ if (nonblocking)
+ opt |= O_NONBLOCK;
+
file = Mem_Alloc (fs_mempool, sizeof (*file));
memset (file, 0, sizeof (*file));
file->ungetc = EOF;
Sets fs_filesize
===========
*/
-qfile_t *FS_OpenReadFile (const char *filename, qboolean quiet)
+qfile_t *FS_OpenReadFile (const char *filename, qboolean quiet, qboolean nonblocking)
{
searchpath_t *search;
int pack_ind;
{
char path [MAX_OSPATH];
dpsnprintf (path, sizeof (path), "%s/%s", search->filename, filename);
- return FS_SysOpen (path, "rb");
+ return FS_SysOpen (path, "rb", nonblocking);
}
// So, we found it in a package...
Open a file. The syntax is the same as fopen
====================
*/
-qfile_t* FS_Open (const char* filepath, const char* mode, qboolean quiet)
+qfile_t* FS_Open (const char* filepath, const char* mode, qboolean quiet, qboolean nonblocking)
{
qfile_t* file;
// Create directories up to the file
FS_CreatePath (real_path);
- return FS_SysOpen (real_path, mode);
+ return FS_SysOpen (real_path, mode, nonblocking);
}
// Else, we look at the various search paths and open the file in read-only mode
- file = FS_OpenReadFile (filepath, quiet);
+ file = FS_OpenReadFile (filepath, quiet, nonblocking);
if (file != NULL)
fs_filesize = file->real_length;
qfile_t *file;
qbyte *buf;
- file = FS_Open (path, "rb", quiet);
+ file = FS_Open (path, "rb", quiet, false);
if (!file)
return NULL;
{
qfile_t *file;
- file = FS_Open (filename, "wb", false);
+ file = FS_Open (filename, "wb", false, false);
if (!file)
{
Con_Printf("FS_WriteFile: failed on %s\n", filename);
// IMPORTANT: the file path is automatically prefixed by the current game directory for
// each file created by FS_WriteFile, or opened in "write" or "append" mode by FS_Open
-qfile_t *FS_Open (const char* filepath, const char* mode, qboolean quiet);
+qfile_t *FS_Open (const char* filepath, const char* mode, qboolean quiet, qboolean nonblocking);
int FS_Close (qfile_t* file);
size_t FS_Write (qfile_t* file, const void* data, size_t datasize);
size_t FS_Read (qfile_t* file, void* buffer, size_t buffersize);
// config.cfg cvars
if (host_initialized && cls.state != ca_dedicated)
{
- f = FS_Open ("config.cfg", "wb", false);
+ f = FS_Open ("config.cfg", "wb", false, false);
if (!f)
{
Con_Print("Couldn't write config.cfg.\n");
FS_DefaultExtension (name, ".sav", sizeof (name));
Con_Printf("Saving game to %s...\n", name);
- f = FS_Open (name, "wb", false);
+ f = FS_Open (name, "wb", false, false);
if (!f)
{
Con_Print("ERROR: couldn't open.\n");
}
// Open the file
- file = FS_Open (filename, "wb", true);
+ file = FS_Open (filename, "wb", true, false);
if (!file)
return false;
case 0:
M_Menu_Transfusion_Episode_f ();
break;
-
+
case 1:
M_Menu_MultiPlayer_f ();
break;
-
+
case 2:
M_Menu_Options_f ();
break;
case 4:
M_Menu_Help_f ();
break;
-
+
case 5:
M_Menu_Credits_f ();
break;
case 0:
M_Menu_Transfusion_Episode_f ();
break;
-
+
case 1:
M_Menu_MultiPlayer_f ();
break;
-
+
case 2:
M_Menu_Options_f ();
break;
case 4:
M_Menu_Load_f ();
break;
-
+
case 5:
M_Menu_Help_f ();
break;
strcpy (m_filenames[i], "--- UNUSED SLOT ---");
loadable[i] = false;
sprintf (name, "s%i.sav", i);
- f = FS_Open (name, "rb", false);
+ f = FS_Open (name, "rb", false, false);
if (!f)
continue;
// read enough to get the comment
int y;
cachepic_t *p;
M_Background(640, 480);
-
+
p = Draw_CachePic ("gfx/tb-episodes");
M_DrawPic (640/2 - p->width/2, 40, "gfx/tb-episodes");
for (y = 0; y < EPISODE_ITEMS; y++){
M_DrawPic (0, 160 + y * 40, va("gfx/episode%i", y+1));
}
-
+
M_DrawPic (0, 120 + (m_episode_cursor + 1) * 40, va("gfx/episode%iselected", m_episode_cursor + 1));
}
}
filename = G_STRING(OFS_PARM0);
// -4 failure (dangerous/non-portable filename) removed, FS_Open checks
- pr_files[filenum] = FS_Open(va("data/%s", filename), modestring, false);
+ pr_files[filenum] = FS_Open(va("data/%s", filename), modestring, false, false);
if (pr_files[filenum] == NULL && modestring == "rb")
- pr_files[filenum] = FS_Open(filename, modestring, false);
+ pr_files[filenum] = FS_Open(filename, modestring, false, false);
if (pr_files[filenum] == NULL)
G_FLOAT(OFS_RETURN) = -1;
PRVM_G_FLOAT(OFS_RETURN) = -4;
return;
}
- VM_FILES[filenum] = FS_Open(va("data/%s", filename), modestring, false);
+ VM_FILES[filenum] = FS_Open(va("data/%s", filename), modestring, false, false);
if (VM_FILES[filenum] == NULL && mode == 0)
- VM_FILES[filenum] = FS_Open(va("%s", filename), modestring, false);
+ VM_FILES[filenum] = FS_Open(va("%s", filename), modestring, false, false);
if (VM_FILES[filenum] == NULL)
PRVM_G_FLOAT(OFS_RETURN) = -1;
qfile_t *file;
int numlumps;
- file = FS_Open (filename, "rb", false);
+ file = FS_Open (filename, "rb", false, false);
if (!file)
{
if (complain)