diff --git a/docs-mini/README.IO b/docs-mini/README.IO index 19fd13933..9388fcbba 100644 --- a/docs-mini/README.IO +++ b/docs-mini/README.IO @@ -29,7 +29,7 @@ Generic Communication: params can be: serial port communication: serial,dir,hz,device,baud,protocol socket communication: socket,dir,hz,machine,port,style,protocol - output to a file: file,dir,hz,filename,protocol + i/o to a file: file,dir,hz,filename,protocol[,repeat] See README.protocol for how to define a generic protocol. @@ -85,6 +85,11 @@ File I/O: --native=file,in,10,flight1.fgfs --fdm=external + You can make the replay from a file loop back to the beginning + when it reaches the end of the file with the "repeat" flag: + + --generic=file,in,20,flight.out,playback,repeat + Moving Map Example: diff --git a/src/Main/fg_io.cxx b/src/Main/fg_io.cxx index 82bcfeb35..ccecff71b 100644 --- a/src/Main/fg_io.cxx +++ b/src/Main/fg_io.cxx @@ -182,10 +182,14 @@ FGIO::parse_port_config( const string& config ) FGRUL *rul = new FGRUL; io = rul; } else if ( protocol == "generic" ) { - int n = 6; - if (tokens[1] == "socket") n++; - else if (tokens[1] == "file") n--; - FGGeneric *generic = new FGGeneric( tokens[n] ); + int configToken; + if (tokens[1] == "socket") + configToken = 7; + else if (tokens[1] == "file") + configToken = 5; + else + configToken = 6; + FGGeneric *generic = new FGGeneric( tokens[configToken] ); io = generic; } else if ( protocol == "multiplay" ) { if ( tokens.size() != 5 ) { @@ -249,8 +253,10 @@ FGIO::parse_port_config( const string& config ) string file = tokens[4]; SG_LOG( SG_IO, SG_INFO, " file name = " << file ); - - SGFile *ch = new SGFile( file ); + bool repeat = false; + if (tokens.size() >= 7 && tokens[6] == "repeat") + repeat = true; + SGFile *ch = new SGFile( file, repeat ); io->set_io_channel( ch ); } else if ( medium == "socket" ) { if ( tokens.size() < 6) {