actually use PHYSFSX_openRead/WriteBuffered

This commit is contained in:
Chris Taylor 2005-02-25 05:20:36 +00:00
parent f6e0153a80
commit 47b70f7298
9 changed files with 37 additions and 35 deletions

View file

@ -1,4 +1,4 @@
/* $Id: pcx.c,v 1.10 2004-12-01 12:48:13 btb Exp $ */
/* $Id: pcx.c,v 1.11 2005-02-25 05:20:36 chris Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -349,7 +349,7 @@ int pcx_write_bitmap( char * filename, grs_bitmap * bmp, ubyte * palette )
header.Ymax = bmp->bm_h-1;
header.BytesPerLine = bmp->bm_w;
PCXfile = PHYSFS_openWrite(filename);
PCXfile = PHYSFSX_openWriteBuffered(filename);
if ( !PCXfile )
return PCX_ERROR_OPENING;

View file

@ -5,7 +5,9 @@
2005-02-24 Chris Taylor <chris@icculus.org>
* include/physfsx.h, main/state.c: use PHYSFSX_openReadBuffered and
* 2d/pcx.c, arch/ogl/gr.c, main/config.c, main/inferno.c,
main/newdemo.c, include/physfsx.h, main/playsave.c, main/state.c,
misc/args.c: use PHYSFSX_openReadBuffered and
PHYSFSX_openWriteBuffered, where appropriate
2005-02-11 Bradley Bell <btb@icculus.org>

View file

@ -1,4 +1,4 @@
/* $Id: gr.c,v 1.42 2005-02-11 22:15:58 btb Exp $ */
/* $Id: gr.c,v 1.43 2005-02-25 05:20:36 chris Exp $ */
/*
*
* OGL video functions. - Added 9/15/99 Matthew Mueller
@ -734,7 +734,7 @@ void gr_palette_read(ubyte * pal)
void write_bmp(char *savename,int w,int h,unsigned char *buf){
PHYSFS_file *f;
f = cfopen(savename, "wb");
f = PHYSFSX_openWriteBuffered(savename);
if (f>=0){
GLubyte targaMagic[12] = { 0, //no identification field

View file

@ -1,4 +1,4 @@
/* $Id: config.c,v 1.15 2005-01-23 14:38:04 schaffner Exp $ */
/* $Id: config.c,v 1.16 2005-02-25 05:20:36 chris Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -59,7 +59,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#ifdef RCS
static char rcsid[] = "$Id: config.c,v 1.15 2005-01-23 14:38:04 schaffner Exp $";
static char rcsid[] = "$Id: config.c,v 1.16 2005-02-25 05:20:36 chris Exp $";
#endif
ubyte Config_digi_volume = 8;
@ -237,7 +237,7 @@ int ReadConfigFile()
SaveMovieHires = MovieHires;
save_redbook_enabled = Redbook_enabled;
infile = cfopen("descent.cfg", "rb");
infile = PHYSFSX_openReadBuffered("descent.cfg");
if (infile == NULL) {
WIN(CheckMovieAttributes());
return 1;
@ -413,7 +413,7 @@ int ReadConfigFile()
} else
digi_driver_board = digi_driver_board;
#else
infile = cfopen("descentw.cfg", "rb");
infile = PHYSFSX_openReadBuffered("descentw.cfg");
if (infile) {
while (!PHYSFS_eof(infile))
{
@ -463,7 +463,7 @@ int WriteConfigFile()
}
#endif
infile = cfopen("descent.cfg", "wb");
infile = PHYSFSX_openWriteBuffered("descent.cfg");
if (infile == NULL) {
return 1;
}
@ -532,7 +532,7 @@ int WriteConfigFile()
joy_get_cal_vals(joy_axis_min, joy_axis_center, joy_axis_max);
infile = cfopen("descentw.cfg", "wt");
infile = PHYSFSX_openWriteBuffered("descentw.cfg");
if (infile == NULL) return 1;
sprintf(str, "%s=%d,%d,%d,%d,%d,%d,%d\n", joystick_min_str,
@ -589,7 +589,7 @@ int WriteConfigFile()
#endif
#ifdef RCS
static char rcsid[] = "$Id: config.c,v 1.15 2005-01-23 14:38:04 schaffner Exp $";
static char rcsid[] = "$Id: config.c,v 1.16 2005-02-25 05:20:36 chris Exp $";
#endif
#define MAX_CTB_LEN 512

View file

@ -1,4 +1,4 @@
/* $Id: inferno.c,v 1.96 2004-12-20 06:48:06 btb Exp $ */
/* $Id: inferno.c,v 1.97 2005-02-25 05:20:36 chris Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -980,7 +980,7 @@ int main(int argc, char *argv[])
"enemyorb.raw","enemyorb.r22", //SOUND_OPPONENT_GOT_ORB
"OPSCORE1.raw","OPSCORE1.r22"}; //SOUND_OPPONENT_HAS_SCORED
ofile = PHYSFS_openWrite("hoard.ham");
ofile = PHYSFSX_openWriteBuffered("hoard.ham");
iff_error = iff_read_animbrush("orb.abm",bm,MAX_BITMAPS_PER_BRUSH,&nframes,palette);
Assert(iff_error == IFF_NO_ERROR);

View file

@ -1,4 +1,4 @@
/* $Id: newdemo.c,v 1.19 2005-01-23 14:38:04 schaffner Exp $ */
/* $Id: newdemo.c,v 1.20 2005-02-25 05:20:36 chris Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -2958,7 +2958,7 @@ void newdemo_start_recording()
Newdemo_num_written = 0;
Newdemo_no_space=0;
Newdemo_state = ND_STATE_RECORDING;
outfile = cfopen(DEMO_FILENAME, "wb");
outfile = PHYSFSX_openWriteBuffered(DEMO_FILENAME);
#if !defined(MACINTOSH) && !defined(_WIN32_WCE)
if (outfile == NULL && errno == ENOENT) { //dir doesn't exist?
@ -2966,7 +2966,7 @@ void newdemo_start_recording()
if (outfile == NULL) { //dir doesn't exist and no errno on mac!
#endif
PHYSFS_mkdir(DEMO_DIR); //try making directory
outfile = cfopen(DEMO_FILENAME, "wb");
outfile = PHYSFSX_openWriteBuffered(DEMO_FILENAME);
}
if (outfile == NULL)
@ -3196,7 +3196,7 @@ void newdemo_start_playback(char * filename)
return;
}
infile = cfopen(filename2, "rb");
infile = PHYSFSX_openReadBuffered(filename2);
if (infile==NULL) {
mprintf( (0, "Error reading '%s'\n", filename ));
@ -3260,7 +3260,7 @@ void newdemo_strip_frames(char *outname, int bytes_to_strip)
bytes_done = 0;
total_size = PHYSFS_fileLength(infile);
outfile = PHYSFS_openWrite(outname);
outfile = PHYSFSX_openWriteBuffered(outname);
if (outfile == NULL) {
newmenu_item m[1];

View file

@ -1,4 +1,4 @@
/* $Id: playsave.c,v 1.22 2005-01-23 14:38:04 schaffner Exp $ */
/* $Id: playsave.c,v 1.23 2005-02-25 05:20:36 chris Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -329,7 +329,7 @@ int read_player_file()
if (!PHYSFS_exists(filename))
return ENOENT;
file = cfopen(filename, "rb");
file = PHYSFSX_openReadBuffered(filename);
#if 0
#ifndef MACINTOSH
@ -338,7 +338,7 @@ int read_player_file()
//if the callsign is the name of a tty device, prepend a char
PHYSFS_close(file);
sprintf(filename,"$%.7s.plr",Players[Player_num].callsign);
file = PHYSFS_openRead(filename);
file = PHYSFSX_openReadBuffered(filename);
}
#endif
#endif
@ -654,7 +654,7 @@ int write_player_file()
#else
sprintf(filename, ":Players:%.8s.plr",Players[Player_num].callsign);
#endif
file = cfopen(filename, "wb");
file = PHYSFSX_openWriteBuffered(filename);
#if 0 //ndef MACINTOSH
//check filename
@ -664,7 +664,7 @@ int write_player_file()
PHYSFS_close(file);
sprintf(filename,"$%.7s.plr",Players[Player_num].callsign);
file = PHYSFS_openWrite(filename);
file = PHYSFSX_openWriteBuffered(filename);
}
#endif

View file

@ -1,4 +1,4 @@
/* $Id: state.c,v 1.22 2005-02-25 03:58:32 chris Exp $ */
/* $Id: state.c,v 1.23 2005-02-25 05:20:36 chris Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -256,7 +256,7 @@ int state_get_save_file(char * fname, char * dsc, int multi, int blind_save)
sprintf( filename[i], ":Players:%s.mg%x", Players[Player_num].callsign, i );
#endif
valid = 0;
fp = PHYSFS_openRead(filename[i]);
fp = PHYSFSX_openReadBuffered(filename[i]);
if ( fp ) {
//Read id
//FIXME: check for swapped file, react accordingly...
@ -333,7 +333,7 @@ int state_get_restore_file(char * fname, int multi)
sprintf( filename[i], ":Players:%s.mg%x", Players[Player_num].callsign, i );
#endif
valid = 0;
fp = PHYSFS_openRead(filename[i]);
fp = PHYSFSX_openReadBuffered(filename[i]);
if ( fp ) {
//Read id
//FIXME: check for swapped file, react accordingly...
@ -569,7 +569,7 @@ int state_save_all(int between_levels, int secret_save, char *filename_override,
if (!filename_override) {
PHYSFS_file *tfp;
tfp = PHYSFS_openWrite(filename);
tfp = PHYSFSX_openWriteBuffered(filename);
if ( tfp ) {
char newname[128];
@ -622,7 +622,7 @@ int state_save_all_sub(char *filename, char *desc, int between_levels)
Int3();
#endif
fp = PHYSFS_openWrite(filename);
fp = PHYSFSX_openWriteBuffered(filename);
if ( !fp ) {
if ( !(Game_mode & GM_MULTI) )
nm_messagebox(NULL, 1, TXT_OK, "Error writing savegame.\nPossibly out of disk\nspace.");
@ -1090,7 +1090,7 @@ int state_restore_all_sub(char *filename, int multi, int secret_restore)
Int3();
#endif
fp = cfopen(filename, "rb");
fp = PHYSFSX_openReadBuffered(filename);
if ( !fp ) return 0;
//Read id

View file

@ -1,4 +1,4 @@
/* $Id: args.c,v 1.16 2005-01-23 14:38:04 schaffner Exp $ */
/* $Id: args.c,v 1.17 2005-02-25 05:20:36 chris Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -23,13 +23,13 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#endif
#ifdef RCS
static char rcsid[] = "$Id: args.c,v 1.16 2005-01-23 14:38:04 schaffner Exp $";
static char rcsid[] = "$Id: args.c,v 1.17 2005-02-25 05:20:36 chris Exp $";
#endif
#include <stdlib.h>
#include <string.h>
#include "cfile.h"
#include "physfsx.h"
#include "args.h"
#include "u_mem.h"
#include "strio.h"
@ -111,9 +111,9 @@ void AppendArgs(void)
int i;
if((i=FindArg("-ini")))
f = cfopen(Args[i+1], "rb");
f = PHYSFSX_openReadBuffered(Args[i+1]);
else
f = cfopen("d2x.ini", "rb");
f = PHYSFSX_openReadBuffered("d2x.ini");
if(f) {
while(!PHYSFS_eof(f) && Num_args < MAX_ARGS)