You've already forked fuse-utils
mirror of
https://git.code.sf.net/p/fuse-emulator/fuse-utils
synced 2025-08-09 00:42:13 +03:00
Preliminary support for 64-bits binaries for Windows (patch #301).
Legacy-ID: 4785
This commit is contained in:
62
fmfconv.c
62
fmfconv.c
@@ -91,7 +91,7 @@ int verbose = 0;
|
|||||||
int do_info = 0; /* no output and verbose 2 */
|
int do_info = 0; /* no output and verbose 2 */
|
||||||
do_t do_now = DO_FILE;
|
do_t do_now = DO_FILE;
|
||||||
|
|
||||||
FILE *inp = NULL, *out = NULL, *snd = NULL;
|
FILE *inp_file = NULL, *out = NULL, *snd = NULL;
|
||||||
|
|
||||||
type_t inp_t = TYPE_UNSET, out_t = TYPE_UNSET, snd_t = TYPE_UNSET, scr_t = TYPE_UNSET, prg_t = TYPE_NONE;
|
type_t inp_t = TYPE_UNSET, out_t = TYPE_UNSET, snd_t = TYPE_UNSET, scr_t = TYPE_UNSET, prg_t = TYPE_NONE;
|
||||||
|
|
||||||
@@ -224,14 +224,14 @@ fread_buff( libspectrum_byte *ptr, size_t size, int how ) /* read from inp, how
|
|||||||
if( how == INTO_BUFF ) {
|
if( how == INTO_BUFF ) {
|
||||||
n = size > FBUFF_SIZE ? FBUFF_SIZE : size;
|
n = size > FBUFF_SIZE ? FBUFF_SIZE : size;
|
||||||
|
|
||||||
s = fread( fbuff, n, 1, inp );
|
s = fread( fbuff, n, 1, inp_file );
|
||||||
if( s != 1 ) return s;
|
if( s != 1 ) return s;
|
||||||
fbuff_size = n;
|
fbuff_size = n;
|
||||||
memcpy( ptr, fbuff, n );
|
memcpy( ptr, fbuff, n );
|
||||||
if( size > FBUFF_SIZE ) {
|
if( size > FBUFF_SIZE ) {
|
||||||
ptr += n;
|
ptr += n;
|
||||||
n = size - FBUFF_SIZE;
|
n = size - FBUFF_SIZE;
|
||||||
return fread( ptr, n, 1, inp );
|
return fread( ptr, n, 1, inp_file );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
n = size <= fbuff_size ? size : fbuff_size;
|
n = size <= fbuff_size ? size : fbuff_size;
|
||||||
@@ -245,7 +245,7 @@ fread_buff( libspectrum_byte *ptr, size_t size, int how ) /* read from inp, how
|
|||||||
ptr += n;
|
ptr += n;
|
||||||
}
|
}
|
||||||
if( size > 0 ) {
|
if( size > 0 ) {
|
||||||
return fread( ptr, size, 1, inp );
|
return fread( ptr, size, 1, inp_file );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@@ -280,7 +280,7 @@ fgetc_compr( FILE *f )
|
|||||||
zstream.next_out = zbuf_o;
|
zstream.next_out = zbuf_o;
|
||||||
do {
|
do {
|
||||||
if( zstream.avail_in == 0 && !fmf_compr_feof ) {
|
if( zstream.avail_in == 0 && !fmf_compr_feof ) {
|
||||||
zstream.avail_in = fread( zbuf_i, 1, ZBUF_INP_SIZE, inp );
|
zstream.avail_in = fread( zbuf_i, 1, ZBUF_INP_SIZE, inp_file );
|
||||||
zstream.next_in = zbuf_i;
|
zstream.next_in = zbuf_i;
|
||||||
if( zstream.avail_in == 0 )
|
if( zstream.avail_in == 0 )
|
||||||
fmf_compr_feof = 1;
|
fmf_compr_feof = 1;
|
||||||
@@ -802,16 +802,16 @@ open_snd( void )
|
|||||||
int
|
int
|
||||||
open_inp( void )
|
open_inp( void )
|
||||||
{
|
{
|
||||||
if( inp ) { /* we have to close before last */
|
if( inp_file ) { /* we have to close before last */
|
||||||
if( inp != stdin ) {
|
if( inp_file != stdin ) {
|
||||||
fclose( inp );
|
fclose( inp_file );
|
||||||
} else { /* reopen stdin???? */
|
} else { /* reopen stdin???? */
|
||||||
do_now = DO_EOP;
|
do_now = DO_EOP;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( inp_name ) {
|
if( inp_name ) {
|
||||||
if( ( inp = fopen( inp_name, "rb" ) ) == NULL ) {
|
if( ( inp_file = fopen( inp_name, "rb" ) ) == NULL ) {
|
||||||
printe( "Cannot open input file '%s'...\n", inp_name );
|
printe( "Cannot open input file '%s'...\n", inp_name );
|
||||||
return ERR_OPEN_INP;
|
return ERR_OPEN_INP;
|
||||||
}
|
}
|
||||||
@@ -819,18 +819,18 @@ open_inp( void )
|
|||||||
snd_t = TYPE_FFMPEG;
|
snd_t = TYPE_FFMPEG;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
inp = stdin;
|
inp_file = stdin;
|
||||||
inp_name = "(-=stdin=-)";
|
inp_name = "(-=stdin=-)";
|
||||||
}
|
}
|
||||||
if( fseek( inp, 0, SEEK_END ) == -1 ) {
|
if( fseek( inp_file, 0, SEEK_END ) == -1 ) {
|
||||||
printi( 4, "open_inp(): cannot seek to the end of the input file (not seekable).\n" );
|
printi( 4, "open_inp(): cannot seek to the end of the input file (not seekable).\n" );
|
||||||
inp_ftell = 0;
|
inp_ftell = 0;
|
||||||
} else if( ( inp_ftell = ftell( inp ) ) == -1 ) {
|
} else if( ( inp_ftell = ftell( inp_file ) ) == -1 ) {
|
||||||
printi( 4, "open_inp(): cannot ftell input file??.\n" );
|
printi( 4, "open_inp(): cannot ftell input file??.\n" );
|
||||||
fseek( inp, 0, SEEK_SET );
|
fseek( inp_file, 0, SEEK_SET );
|
||||||
inp_ftell = 0;
|
inp_ftell = 0;
|
||||||
} else {
|
} else {
|
||||||
fseek( inp, 0, SEEK_SET );
|
fseek( inp_file, 0, SEEK_SET );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( inp_t == TYPE_UNSET ) { /* try to identify the file type */
|
if( inp_t == TYPE_UNSET ) { /* try to identify the file type */
|
||||||
@@ -953,9 +953,9 @@ fmf_read_head( void )
|
|||||||
int
|
int
|
||||||
fmf_read_frame_head( void )
|
fmf_read_frame_head( void )
|
||||||
{
|
{
|
||||||
if( fread_compr( fhead, 3, 1, inp ) != 1 ) {
|
if( fread_compr( fhead, 3, 1, inp_file ) != 1 ) {
|
||||||
printe( "\n\nfmf_read_frame_head(): Corrupt input file (N) @0x%08lx.\n",
|
printe( "\n\nfmf_read_frame_head(): Corrupt input file (N) @0x%08lx.\n",
|
||||||
(unsigned long)ftell( inp ) );
|
(unsigned long)ftell( inp_file ) );
|
||||||
return ERR_CORRUPT_INP;
|
return ERR_CORRUPT_INP;
|
||||||
}
|
}
|
||||||
if( fhead[0] < 1 ) {
|
if( fhead[0] < 1 ) {
|
||||||
@@ -995,9 +995,9 @@ fmf_read_frame_head( void )
|
|||||||
int
|
int
|
||||||
fmf_read_chunk_head( void )
|
fmf_read_chunk_head( void )
|
||||||
{
|
{
|
||||||
if( fread_compr( fhead, 1, 1, inp ) != 1 ) { /* */
|
if( fread_compr( fhead, 1, 1, inp_file ) != 1 ) { /* */
|
||||||
printe( "Unexpected end of input file @0x%08lx.\n",
|
printe( "Unexpected end of input file @0x%08lx.\n",
|
||||||
(unsigned long)ftell( inp ) );
|
(unsigned long)ftell( inp_file ) );
|
||||||
return ERR_ENDOFFILE;
|
return ERR_ENDOFFILE;
|
||||||
}
|
}
|
||||||
if( fhead[0] != 'N' && fhead[0] != '$' && fhead[0] != 'S' && fhead[0] != 'X' ) {
|
if( fhead[0] != 'N' && fhead[0] != '$' && fhead[0] != 'S' && fhead[0] != 'X' ) {
|
||||||
@@ -1017,7 +1017,7 @@ fmf_read_init( void ) /* read first N */
|
|||||||
if( ( err = fmf_read_chunk_head() ) ) return err;
|
if( ( err = fmf_read_chunk_head() ) ) return err;
|
||||||
|
|
||||||
if( fhead[0] != 'N' ) { /* end of record... */
|
if( fhead[0] != 'N' ) { /* end of record... */
|
||||||
printe( "\n\nfmf_read_init(): Corrupt input file (N) @0x%08lx.\n", (unsigned long)ftell( inp ) );
|
printe( "\n\nfmf_read_init(): Corrupt input file (N) @0x%08lx.\n", (unsigned long)ftell( inp_file ) );
|
||||||
return ERR_CORRUPT_INP;
|
return ERR_CORRUPT_INP;
|
||||||
}
|
}
|
||||||
return fmf_read_frame_head();
|
return fmf_read_frame_head();
|
||||||
@@ -1030,8 +1030,8 @@ fmf_read_sound( void )
|
|||||||
int len;
|
int len;
|
||||||
static int fmf_snd_head_read = 0;
|
static int fmf_snd_head_read = 0;
|
||||||
|
|
||||||
if( !fmf_snd_head_read && fread_compr( fhead, 6, 1, inp ) != 1 ) {
|
if( !fmf_snd_head_read && fread_compr( fhead, 6, 1, inp_file ) != 1 ) {
|
||||||
printe( "\n\nCorrupt input file (S) @0x%08lx.\n", (unsigned long)ftell( inp ) );
|
printe( "\n\nCorrupt input file (S) @0x%08lx.\n", (unsigned long)ftell( inp_file ) );
|
||||||
return ERR_CORRUPT_INP;
|
return ERR_CORRUPT_INP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1066,8 +1066,8 @@ fmf_read_sound( void )
|
|||||||
|
|
||||||
if( sound_stereo == -1 ) out_chn = snd_chn;
|
if( sound_stereo == -1 ) out_chn = snd_chn;
|
||||||
if( ( err = alloc_sound_buff( snd_len + len ) ) ) return err;
|
if( ( err = alloc_sound_buff( snd_len + len ) ) ) return err;
|
||||||
if( fread_compr( (void *)( sound8 + snd_len ), len, 1, inp ) != 1 ) {
|
if( fread_compr( (void *)( sound8 + snd_len ), len, 1, inp_file ) != 1 ) {
|
||||||
printe( "\n\nCorrupt input file (S) @0x%08lx.\n", (unsigned long)ftell( inp ) );
|
printe( "\n\nCorrupt input file (S) @0x%08lx.\n", (unsigned long)ftell( inp_file ) );
|
||||||
return ERR_CORRUPT_INP;
|
return ERR_CORRUPT_INP;
|
||||||
}
|
}
|
||||||
fmf_sound_no++;
|
fmf_sound_no++;
|
||||||
@@ -1163,13 +1163,13 @@ fmf_read_slice_blokk( libspectrum_byte *scrl, int w, int h )
|
|||||||
w = width; /* restore width */
|
w = width; /* restore width */
|
||||||
while( w > 0 ) {
|
while( w > 0 ) {
|
||||||
if( len == 0 ) {
|
if( len == 0 ) {
|
||||||
if( ( d = fgetc_compr( inp ) ) == -1 ) {
|
if( ( d = fgetc_compr( inp_file ) ) == -1 ) {
|
||||||
printe( "\n\nCorrupt input file ($) @0x%08lx.\n", (unsigned long)ftell( inp ) );
|
printe( "\n\nCorrupt input file ($) @0x%08lx.\n", (unsigned long)ftell( inp_file ) );
|
||||||
return ERR_CORRUPT_INP; /* read a byte */
|
return ERR_CORRUPT_INP; /* read a byte */
|
||||||
}
|
}
|
||||||
if( d == last ) { /* compressed chunk... */
|
if( d == last ) { /* compressed chunk... */
|
||||||
if( ( len = fgetc_compr( inp ) ) == -1 ) {
|
if( ( len = fgetc_compr( inp_file ) ) == -1 ) {
|
||||||
printe( "\n\nCorrupt input file ($) @0x%08lx.\n", (unsigned long)ftell( inp ) );
|
printe( "\n\nCorrupt input file ($) @0x%08lx.\n", (unsigned long)ftell( inp_file ) );
|
||||||
return ERR_CORRUPT_INP; /* read a byte */
|
return ERR_CORRUPT_INP; /* read a byte */
|
||||||
}
|
}
|
||||||
len++;
|
len++;
|
||||||
@@ -1193,8 +1193,8 @@ fmf_read_screen( void )
|
|||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if( fread_compr( fhead, 6, 1, inp ) != 1 ) {
|
if( fread_compr( fhead, 6, 1, inp_file ) != 1 ) {
|
||||||
printe( "\n\nCorrupt input file ($) @0x%08lx.\n", (unsigned long)ftell( inp ) );
|
printe( "\n\nCorrupt input file ($) @0x%08lx.\n", (unsigned long)ftell( inp_file ) );
|
||||||
return ERR_CORRUPT_INP;
|
return ERR_CORRUPT_INP;
|
||||||
}
|
}
|
||||||
if( fhead[0] > 39 ) {
|
if( fhead[0] > 39 ) {
|
||||||
@@ -1541,7 +1541,7 @@ print_progress( int force )
|
|||||||
|
|
||||||
if( !inp_ftell ) return;
|
if( !inp_ftell ) return;
|
||||||
|
|
||||||
npos = ftell( inp );
|
npos = ftell( inp_file );
|
||||||
if( npos <= fpos ) return;
|
if( npos <= fpos ) return;
|
||||||
|
|
||||||
perc = (libspectrum_signed_qword)npos * 1009 / inp_ftell / 10;
|
perc = (libspectrum_signed_qword)npos * 1009 / inp_ftell / 10;
|
||||||
@@ -1969,7 +1969,7 @@ main( int argc, char *argv[] )
|
|||||||
if( inp_t == TYPE_FMF ) {
|
if( inp_t == TYPE_FMF ) {
|
||||||
if( do_now == DO_LAST_FRAME ) {
|
if( do_now == DO_LAST_FRAME ) {
|
||||||
fread_buff( fhead, 1, INTO_BUFF ); /* check concatenation */
|
fread_buff( fhead, 1, INTO_BUFF ); /* check concatenation */
|
||||||
if( feof_compr( inp ) )
|
if( feof_compr( inp_file ) )
|
||||||
do_now = DO_FILE;
|
do_now = DO_FILE;
|
||||||
else
|
else
|
||||||
do_now = DO_HEAD;
|
do_now = DO_HEAD;
|
||||||
|
@@ -375,3 +375,5 @@
|
|||||||
with other checks (Sergio).
|
with other checks (Sergio).
|
||||||
20121206 configure.ac: allow dynamic linking against system libraries for
|
20121206 configure.ac: allow dynamic linking against system libraries for
|
||||||
audio2tape on Windows to fix the build with libaudiofile 0.3 (Sergio).
|
audio2tape on Windows to fix the build with libaudiofile 0.3 (Sergio).
|
||||||
|
20121208 fmfconv.c: preliminary support for 64-bits binaries for Windows (patch
|
||||||
|
#3591613) (Sergio).
|
||||||
|
Reference in New Issue
Block a user