actually use PHYSFSX_openRead/WriteBuffered
This commit is contained in:
parent
f6e0153a80
commit
47b70f7298
4
2d/pcx.c
4
2d/pcx.c
|
@ -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
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
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.Ymax = bmp->bm_h-1;
|
||||||
header.BytesPerLine = bmp->bm_w;
|
header.BytesPerLine = bmp->bm_w;
|
||||||
|
|
||||||
PCXfile = PHYSFS_openWrite(filename);
|
PCXfile = PHYSFSX_openWriteBuffered(filename);
|
||||||
if ( !PCXfile )
|
if ( !PCXfile )
|
||||||
return PCX_ERROR_OPENING;
|
return PCX_ERROR_OPENING;
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
|
|
||||||
2005-02-24 Chris Taylor <chris@icculus.org>
|
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
|
PHYSFSX_openWriteBuffered, where appropriate
|
||||||
|
|
||||||
2005-02-11 Bradley Bell <btb@icculus.org>
|
2005-02-11 Bradley Bell <btb@icculus.org>
|
||||||
|
|
|
@ -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
|
* 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){
|
void write_bmp(char *savename,int w,int h,unsigned char *buf){
|
||||||
PHYSFS_file *f;
|
PHYSFS_file *f;
|
||||||
|
|
||||||
f = cfopen(savename, "wb");
|
f = PHYSFSX_openWriteBuffered(savename);
|
||||||
|
|
||||||
if (f>=0){
|
if (f>=0){
|
||||||
GLubyte targaMagic[12] = { 0, //no identification field
|
GLubyte targaMagic[12] = { 0, //no identification field
|
||||||
|
|
|
@ -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
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||||
|
@ -59,7 +59,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
|
|
||||||
|
|
||||||
#ifdef RCS
|
#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
|
#endif
|
||||||
|
|
||||||
ubyte Config_digi_volume = 8;
|
ubyte Config_digi_volume = 8;
|
||||||
|
@ -237,7 +237,7 @@ int ReadConfigFile()
|
||||||
SaveMovieHires = MovieHires;
|
SaveMovieHires = MovieHires;
|
||||||
save_redbook_enabled = Redbook_enabled;
|
save_redbook_enabled = Redbook_enabled;
|
||||||
|
|
||||||
infile = cfopen("descent.cfg", "rb");
|
infile = PHYSFSX_openReadBuffered("descent.cfg");
|
||||||
if (infile == NULL) {
|
if (infile == NULL) {
|
||||||
WIN(CheckMovieAttributes());
|
WIN(CheckMovieAttributes());
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -413,7 +413,7 @@ int ReadConfigFile()
|
||||||
} else
|
} else
|
||||||
digi_driver_board = digi_driver_board;
|
digi_driver_board = digi_driver_board;
|
||||||
#else
|
#else
|
||||||
infile = cfopen("descentw.cfg", "rb");
|
infile = PHYSFSX_openReadBuffered("descentw.cfg");
|
||||||
if (infile) {
|
if (infile) {
|
||||||
while (!PHYSFS_eof(infile))
|
while (!PHYSFS_eof(infile))
|
||||||
{
|
{
|
||||||
|
@ -463,7 +463,7 @@ int WriteConfigFile()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
infile = cfopen("descent.cfg", "wb");
|
infile = PHYSFSX_openWriteBuffered("descent.cfg");
|
||||||
if (infile == NULL) {
|
if (infile == NULL) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ int WriteConfigFile()
|
||||||
|
|
||||||
joy_get_cal_vals(joy_axis_min, joy_axis_center, joy_axis_max);
|
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;
|
if (infile == NULL) return 1;
|
||||||
|
|
||||||
sprintf(str, "%s=%d,%d,%d,%d,%d,%d,%d\n", joystick_min_str,
|
sprintf(str, "%s=%d,%d,%d,%d,%d,%d,%d\n", joystick_min_str,
|
||||||
|
@ -589,7 +589,7 @@ int WriteConfigFile()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RCS
|
#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
|
#endif
|
||||||
|
|
||||||
#define MAX_CTB_LEN 512
|
#define MAX_CTB_LEN 512
|
||||||
|
|
|
@ -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
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
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
|
"enemyorb.raw","enemyorb.r22", //SOUND_OPPONENT_GOT_ORB
|
||||||
"OPSCORE1.raw","OPSCORE1.r22"}; //SOUND_OPPONENT_HAS_SCORED
|
"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);
|
iff_error = iff_read_animbrush("orb.abm",bm,MAX_BITMAPS_PER_BRUSH,&nframes,palette);
|
||||||
Assert(iff_error == IFF_NO_ERROR);
|
Assert(iff_error == IFF_NO_ERROR);
|
||||||
|
|
|
@ -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
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||||
|
@ -2958,7 +2958,7 @@ void newdemo_start_recording()
|
||||||
Newdemo_num_written = 0;
|
Newdemo_num_written = 0;
|
||||||
Newdemo_no_space=0;
|
Newdemo_no_space=0;
|
||||||
Newdemo_state = ND_STATE_RECORDING;
|
Newdemo_state = ND_STATE_RECORDING;
|
||||||
outfile = cfopen(DEMO_FILENAME, "wb");
|
outfile = PHYSFSX_openWriteBuffered(DEMO_FILENAME);
|
||||||
|
|
||||||
#if !defined(MACINTOSH) && !defined(_WIN32_WCE)
|
#if !defined(MACINTOSH) && !defined(_WIN32_WCE)
|
||||||
if (outfile == NULL && errno == ENOENT) { //dir doesn't exist?
|
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!
|
if (outfile == NULL) { //dir doesn't exist and no errno on mac!
|
||||||
#endif
|
#endif
|
||||||
PHYSFS_mkdir(DEMO_DIR); //try making directory
|
PHYSFS_mkdir(DEMO_DIR); //try making directory
|
||||||
outfile = cfopen(DEMO_FILENAME, "wb");
|
outfile = PHYSFSX_openWriteBuffered(DEMO_FILENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outfile == NULL)
|
if (outfile == NULL)
|
||||||
|
@ -3196,7 +3196,7 @@ void newdemo_start_playback(char * filename)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
infile = cfopen(filename2, "rb");
|
infile = PHYSFSX_openReadBuffered(filename2);
|
||||||
|
|
||||||
if (infile==NULL) {
|
if (infile==NULL) {
|
||||||
mprintf( (0, "Error reading '%s'\n", filename ));
|
mprintf( (0, "Error reading '%s'\n", filename ));
|
||||||
|
@ -3260,7 +3260,7 @@ void newdemo_strip_frames(char *outname, int bytes_to_strip)
|
||||||
|
|
||||||
bytes_done = 0;
|
bytes_done = 0;
|
||||||
total_size = PHYSFS_fileLength(infile);
|
total_size = PHYSFS_fileLength(infile);
|
||||||
outfile = PHYSFS_openWrite(outname);
|
outfile = PHYSFSX_openWriteBuffered(outname);
|
||||||
if (outfile == NULL) {
|
if (outfile == NULL) {
|
||||||
newmenu_item m[1];
|
newmenu_item m[1];
|
||||||
|
|
||||||
|
|
|
@ -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
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||||
|
@ -329,7 +329,7 @@ int read_player_file()
|
||||||
if (!PHYSFS_exists(filename))
|
if (!PHYSFS_exists(filename))
|
||||||
return ENOENT;
|
return ENOENT;
|
||||||
|
|
||||||
file = cfopen(filename, "rb");
|
file = PHYSFSX_openReadBuffered(filename);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
#ifndef MACINTOSH
|
#ifndef MACINTOSH
|
||||||
|
@ -338,7 +338,7 @@ int read_player_file()
|
||||||
//if the callsign is the name of a tty device, prepend a char
|
//if the callsign is the name of a tty device, prepend a char
|
||||||
PHYSFS_close(file);
|
PHYSFS_close(file);
|
||||||
sprintf(filename,"$%.7s.plr",Players[Player_num].callsign);
|
sprintf(filename,"$%.7s.plr",Players[Player_num].callsign);
|
||||||
file = PHYSFS_openRead(filename);
|
file = PHYSFSX_openReadBuffered(filename);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -654,7 +654,7 @@ int write_player_file()
|
||||||
#else
|
#else
|
||||||
sprintf(filename, ":Players:%.8s.plr",Players[Player_num].callsign);
|
sprintf(filename, ":Players:%.8s.plr",Players[Player_num].callsign);
|
||||||
#endif
|
#endif
|
||||||
file = cfopen(filename, "wb");
|
file = PHYSFSX_openWriteBuffered(filename);
|
||||||
|
|
||||||
#if 0 //ndef MACINTOSH
|
#if 0 //ndef MACINTOSH
|
||||||
//check filename
|
//check filename
|
||||||
|
@ -664,7 +664,7 @@ int write_player_file()
|
||||||
|
|
||||||
PHYSFS_close(file);
|
PHYSFS_close(file);
|
||||||
sprintf(filename,"$%.7s.plr",Players[Player_num].callsign);
|
sprintf(filename,"$%.7s.plr",Players[Player_num].callsign);
|
||||||
file = PHYSFS_openWrite(filename);
|
file = PHYSFSX_openWriteBuffered(filename);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
12
main/state.c
12
main/state.c
|
@ -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
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
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 );
|
sprintf( filename[i], ":Players:%s.mg%x", Players[Player_num].callsign, i );
|
||||||
#endif
|
#endif
|
||||||
valid = 0;
|
valid = 0;
|
||||||
fp = PHYSFS_openRead(filename[i]);
|
fp = PHYSFSX_openReadBuffered(filename[i]);
|
||||||
if ( fp ) {
|
if ( fp ) {
|
||||||
//Read id
|
//Read id
|
||||||
//FIXME: check for swapped file, react accordingly...
|
//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 );
|
sprintf( filename[i], ":Players:%s.mg%x", Players[Player_num].callsign, i );
|
||||||
#endif
|
#endif
|
||||||
valid = 0;
|
valid = 0;
|
||||||
fp = PHYSFS_openRead(filename[i]);
|
fp = PHYSFSX_openReadBuffered(filename[i]);
|
||||||
if ( fp ) {
|
if ( fp ) {
|
||||||
//Read id
|
//Read id
|
||||||
//FIXME: check for swapped file, react accordingly...
|
//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) {
|
if (!filename_override) {
|
||||||
PHYSFS_file *tfp;
|
PHYSFS_file *tfp;
|
||||||
|
|
||||||
tfp = PHYSFS_openWrite(filename);
|
tfp = PHYSFSX_openWriteBuffered(filename);
|
||||||
|
|
||||||
if ( tfp ) {
|
if ( tfp ) {
|
||||||
char newname[128];
|
char newname[128];
|
||||||
|
@ -622,7 +622,7 @@ int state_save_all_sub(char *filename, char *desc, int between_levels)
|
||||||
Int3();
|
Int3();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fp = PHYSFS_openWrite(filename);
|
fp = PHYSFSX_openWriteBuffered(filename);
|
||||||
if ( !fp ) {
|
if ( !fp ) {
|
||||||
if ( !(Game_mode & GM_MULTI) )
|
if ( !(Game_mode & GM_MULTI) )
|
||||||
nm_messagebox(NULL, 1, TXT_OK, "Error writing savegame.\nPossibly out of disk\nspace.");
|
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();
|
Int3();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fp = cfopen(filename, "rb");
|
fp = PHYSFSX_openReadBuffered(filename);
|
||||||
if ( !fp ) return 0;
|
if ( !fp ) return 0;
|
||||||
|
|
||||||
//Read id
|
//Read id
|
||||||
|
|
10
misc/args.c
10
misc/args.c
|
@ -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
|
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
|
||||||
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
|
||||||
|
@ -23,13 +23,13 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RCS
|
#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
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "cfile.h"
|
#include "physfsx.h"
|
||||||
#include "args.h"
|
#include "args.h"
|
||||||
#include "u_mem.h"
|
#include "u_mem.h"
|
||||||
#include "strio.h"
|
#include "strio.h"
|
||||||
|
@ -111,9 +111,9 @@ void AppendArgs(void)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if((i=FindArg("-ini")))
|
if((i=FindArg("-ini")))
|
||||||
f = cfopen(Args[i+1], "rb");
|
f = PHYSFSX_openReadBuffered(Args[i+1]);
|
||||||
else
|
else
|
||||||
f = cfopen("d2x.ini", "rb");
|
f = PHYSFSX_openReadBuffered("d2x.ini");
|
||||||
|
|
||||||
if(f) {
|
if(f) {
|
||||||
while(!PHYSFS_eof(f) && Num_args < MAX_ARGS)
|
while(!PHYSFS_eof(f) && Num_args < MAX_ARGS)
|
||||||
|
|
Loading…
Reference in a new issue