emoved PHYSFSX_getFreeDiskSpace and relying on success of buffered writing to see if demo recording must be stopped

This commit is contained in:
zicodxx 2010-06-18 08:22:45 +00:00
parent e4a0c20f76
commit c3d91ceeca
3 changed files with 38 additions and 62 deletions

View file

@ -2,7 +2,8 @@ D1X-Rebirth Changelog
20100618
--------
2d/bitblt.c, include/gr.h, main/game.c, main/gauges.c: Introducing gr_bitblt_find_transparent_area to dynamically detect boundaries of sub cancas used for CM_REAR_VIEW; On the way also allowing to create weapon box sub bitmaps from uncompressed cockpit bitmaps
2d/bitblt.c, include/gr.h, main/game.c, main/gauges.c: Introducing gr_bitblt_find_transparent_area to dynamically detect boundaries of sub canvas used for CM_REAR_VIEW; On the way also allowing to create weapon box sub bitmaps from uncompressed cockpit bitmaps
include/physfsx.h, main/newdemo.c: Removed PHYSFSX_getFreeDiskSpace and relying on success of buffered writing to see if demo recording must be stopped
20100617
--------

View file

@ -12,9 +12,7 @@
#if !defined(macintosh) && !defined(_MSC_VER)
#include <sys/param.h>
#endif
#if defined(__LINUX__)
#include <sys/vfs.h>
#elif defined(__MACH__) && defined(__APPLE__)
#if defined(__MACH__) && defined(__APPLE__)
#include <sys/mount.h>
#include <unistd.h> // for chdir hack
#endif
@ -375,6 +373,7 @@ static inline char **PHYSFSX_findabsoluteFiles(char *path, char *realpath, char
return list;
}
#if 0
// returns -1 if error
// Gets bytes free in current write dir
static inline PHYSFS_sint64 PHYSFSX_getFreeDiskSpace()
@ -390,6 +389,7 @@ static inline PHYSFS_sint64 PHYSFSX_getFreeDiskSpace()
return 0x7FFFFFFF;
#endif
}
#endif
//Open a file for reading, set up a buffer
static inline PHYSFS_file *PHYSFSX_openReadBuffered(char *filename)

View file

@ -254,13 +254,7 @@ int newdemo_write( void *buffer, int elsize, int nelem )
Newdemo_num_written += total_size;
Assert(outfile != NULL);
num_written = PHYSFS_write(outfile, buffer, elsize, nelem);
//if ((Newdemo_num_written > Newdemo_size) && !Newdemo_no_space) {
// Newdemo_no_space=1;
// newdemo_stop_recording();
// return -1;
//}
if ((Newdemo_num_written > Newdemo_size) && !Newdemo_no_space)
Newdemo_no_space=1;
if (num_written == nelem && !Newdemo_no_space)
return num_written;
@ -3082,22 +3076,6 @@ void newdemo_playback_one_frame()
void newdemo_start_recording()
{
Newdemo_size = PHYSFSX_getFreeDiskSpace();
con_printf(CON_VERBOSE, "Free space = %d\n", Newdemo_size);
Newdemo_size -= 100000;
if ((Newdemo_size+100000) < 2000000000) {
if (((int)(Newdemo_size)) < 500000) {
#if !(defined(__APPLE__) || defined(macintosh))
nm_messagebox(NULL, 1, TXT_OK, TXT_DEMO_NO_SPACE);
#else
nm_messagebox(NULL, 1, TXT_OK, "Not enough space on current\ndrive to start demo recording.");
#endif
return;
}
}
Newdemo_num_written = 0;
Newdemo_no_space=0;
Newdemo_state = ND_STATE_RECORDING;
@ -3195,10 +3173,11 @@ void newdemo_stop_recording()
exit = 0;
newdemo_record_oneframeevent_update(0);
if (!Newdemo_no_space)
{
newdemo_record_oneframeevent_update(0);
newdemo_write_end();
}
PHYSFS_close(outfile);
outfile = NULL;
@ -3230,10 +3209,6 @@ try_again:
if (!Newdemo_no_space) {
m[0].type=NM_TYPE_INPUT; m[0].text_len = PATH_MAX - 1; m[0].text = filename;
exit = newmenu_do( NULL, TXT_SAVE_DEMO_AS, 1, &(m[0]), NULL, NULL );
} else if (Newdemo_no_space == 1) {
m[ 0].type = NM_TYPE_TEXT; m[ 0].text = TXT_DEMO_SAVE_BAD;
m[ 1].type = NM_TYPE_INPUT;m[ 1].text_len = PATH_MAX - 1; m[1].text = filename;
exit = newmenu_do( NULL, NULL, 2, m, NULL, NULL );
} else if (Newdemo_no_space == 2) {
m[ 0].type = NM_TYPE_TEXT; m[ 0].text = TXT_DEMO_SAVE_NOSPACE;
m[ 1].type = NM_TYPE_INPUT;m[ 1].text_len = PATH_MAX - 1; m[1].text = filename;