Jump to content

export.log


braden
 Share

Recommended Posts

Hello all,

quite happy that my first experiment with export.lua->export.log has worked tonight in game. I created a replica of the su25 configuration indicator (flaps/speedbrake/gear) for my g15 keyboard lcd. Thought that would b nice and simple before cracking on with other things i want to achieve.

 

Basically i have some c# code updating the g15 LCD every 5 f.p.s.

On each update, I copy export.log, find the last complete record in the copy, parse it and update the drawings on the LCD accordingly.

 

What i want to know is:

a) is that the normal way everyone reads the export.log ? i.e. make copy of file, find index of last record, check its a complete record in code. If i tried to read the export.log that fc2 is writing to with c# streamreader, i got access violations. Or is there a smarter way to find the last complete record only in export.log quick n easily?

 

b) can the export.log be truncated by flaming cliffs automatically so only the most recent X records are listed? i.e. with my current method outlined, i imagine the performance will start to suffer after an hours flight when the log file gets loooooooooooong!

 

cheers


Edited by braden
Link to comment
Share on other sites

Instead of using the export log you should be able to stream directly from lua to your app (or vice versa) using luasockets library.

 

That will take away the IO overheads of having to append to a file and then re-open it and scan/seek the end.

 

Outputting to a .log file would only be used for debugging purposes.

 

Doing this may only be suitable for playing singleplayer by the way, as the export.lua changes can be rejected by servers doing file checking.

[ i7 2600k 4.6GHz :: 16GB Mushkin Blackline LV :: EVGA GTX 1080ti 11GB ]

[ TM Warthog / Saitek Rudder :: Oculus Rift :: Obutto cockpit :: Acer HN274H 27" 120Hz :: 3D Vision Ready ]

Link to comment
Share on other sites

thanks for the response.

 

you've answered my 3rd un-posted question which was: "will file or sockets i/o be better for all this". went with the file method initally as thought it'd be quicker to code (didnt give much thought to the file contention issue, logs will be big etc). Will work on the socket stuff tonight.

Link to comment
Share on other sites

Have a look at the =RvE= Yoda's leavu2 utility (search these forums). That streams in real-time. I extended it to get the same mechanical information you do, but I was after tail-hook status and Angle-of-Attack indicator for VNAO carrier landings.

 

nb. leavu2 is written in Java (which means you can run it on your Mac, Linux/PC as I do - which is something C#/Mono can't do interoperably). Should be easy to port the bits you need to C# (since C# was designed from Java via an intermediate language called 'Cool').

Link to comment
Share on other sites

Still havent got mine working...my little csharp program seems to just hang waiting for some traffic on localhost or 127.0.0.1 at port X (same port number specified in export.lua) even though FC2 is running. Tried creating another program to send UDP traffic to same port, so i can test my 1st program reads it...but start getting errors that two programs cant be bound to same port at same time on same machine.

 

i'll have a look at the java code tomorrow. Reading Yodas spiel, he appears to utilise tcp, not udp. (i didnt really want to send anything back from my program to flaming cliffs...not at this point anyway).

 

To anyone who has got export.lua working with UDP... does the line:

c:setoption("tcp-nodelay",true)

need to remain commented out for UDP ?

 

cheers

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...