![]() |
Il-2 Dedicated Server mission load problems
Hi guys,
Would really appreciate some help on an issue I am having getting missions to load with the Il-2 DS. Free Saitek Aviator (PS3 version, postage paid) to the person who finds the solution to this issue, no matter how stupid or trivial it turns out to be. I am writing a server controller in Clojure and Java using the JavaFX toolkit as the UI (original thread here). The problem is that missions entered manually by the user into a text field seem to load fine all the time, however: Missions selected by a file chooser dialog fail every time, but only the first time. Then they work every time, until you select a different mission with the file chooser dialog, whereupon they fail again, but only the first time. YouTube video here. I just cannot find the solution to this bug! It's driving me insane! I have compared the two LOAD commands using the same mission from the text field and from the file chooser with a huge variety of different methods. I've tried searching for hidden characters (both Unicode and ASCII non-printable, hidden or whitespace), changing the new line separator from \r\n to \n and even to \n\r\n, explicitly flushing my Writer even though I use a writer with autoflush on newline characters, and a number of different path normalisation, canonisation and relativisation methods. Java String comparison shows that the LOAD commands I am using are the same, Wireshark TCP data is the same, logs on the server side show that the characters received are the same: Manual File Chooser Code:
[Feb 17, 2014 12:29:15 AM] ------------ BEGIN log session ------------- What can possibly cause sending the same command to the IL-2 DS and getting different results? Could this be a character encoding issue? How is it possible to send the same LOAD command to the server and it will fail the first time, every time, then succeed the second and all subsequent times until another mission is chosen? Would really appreciate any help or advice with this problem as I'd love to continue with this development. |
Without insight into the source code, it's nigh impossible to diagnose this.
It could have something to do with how the file dialog returns the path, it could be a windows->Linux(like you said, encoding) issue, it could be a ridiculous number of things without knowing how the program actually works. I'd like to see the code that retrieves values from the textbox and the file chooser at least, the difference is likely to be there, as by the way you describe it they do the same thing(I'm assuming here the file is always on the server, you're just getting the location in different ways, correct?). |
Seems to be some kind of problem with relative paths
Long shot but try running the dedicated server through strace. For example: strace -e open <name of the dedicated server executable> that will print a line for every file the dedicated server tries to open. |
Pfeil, thanks for taking an interest! The relevant code is as follows:
Server path chooser; this is a javafx.stage.FileChooser instance, which returns a java.io.File object. The UI objects are retrieved from a map of controls by key and "file" is bound to the results of showing the file chooser dialog using the .showOpenDialog method (this is all that is in ui/show-chooser). This is just to keep the UI and the application logic separate. The file is then converted to an absolute path String using File.getCanonicalPath. Code:
(defn server-choose-command Code:
(defn server-path-select Code:
(defn get-text Code:
(defn set-single-remote Code:
(defn set-label Code:
(defn single-choose-command Then the path is relativized against the missions directory, normalised to remove any redundant elements and converted to a String object, before replacing all backward slash characters with forward slash characters. The Clojure function str calls the .toString method for x when it is given the single object x. The methods used for canonisation and relativisation can be found in java.nio.file.Path. Code:
(defn get-resolved-path This is the same global state atom update logic as with the server chooser, triggered by an InvalidationListener attached to the Label object: Code:
(defn single-path-select Code:
(defn load-unload-command Code:
(defn unload-mission Code:
(defn load-mission Code:
(defn write-socket Code:
(.print @socket-out (str text "\\n")) Output stream definition here: Code:
(reset! socket-out (PrintWriter. Hope this is a decent enough outline of what goes on (I'm not cagey about the code as I intend to open the repo to all once the basic feature set is complete). One of the methods that I used to try and detect any differences in the path was to set a comparator function on the single-choose-command function using clojure.data/diff, which compared the text content of the single mission path TextField to the return value of the get-resolved-path function. I loaded the mission using the TextField, loaded a different mission using the chooser (to trigger the bug), then loaded the original mission from the TextField using the FileChooser. In every instance it indicated that the value in the TextField (which worked every time) was the same as that returned by the FileChooser (which didn't), i.e. it returned (nil nil "Net/dogfight/DCG/dcgmission.mis"). The_WOZ, I will give your suggestion a try once I get home, thanks! |
The_WOZ, output was as follows:
Code:
% env WINEPREFIX=/home/david/Servers/il2-4.12/ strace -eopen wineconsole --backend=curses /home/david/Servers/il2-4.12/drive_d/il2server/il2server.exe |
Seems I can't be of much help I'm afraid. While I get the basic gist of what you're doing, Java isn't my cup of tea, shall we say.
Something that did occur to me: Have you tried running the server from a windows machine? Perhaps Wine is somehow "translating" one way or the other, and getting it wrong the first time. When you compared packets in Wireshark, did you compare the first and second packet sent using the file selection dialog, or the difference(lack thereof) between textbox and dialog? |
Hi Pfeil,
I tried both, and it seems I can't find any difference in either output. :confused: I haven't tried running the server from a Windows machine and it's quite possible that this is the culprit. However, I would still want to solve the issue as it's my main platform for running the server personally. :grin: Signs are pointing against this as my original implementation in Java worked fine with the same server using much the same methods (please excuse the horrors which follow as it was pretty much the first GUI application I ever wrote and it's rather crufty about accessing the UI and the config in the application logic): Server interaction: Code:
public class Command { Code:
public void connect() { Code:
public void serverPathButtonAction() { Code:
public String resolveMissionPath() { Code:
public void startStopButtonAction() {
Just tried using all of these with no luck. :( |
Quote:
Try loading missions both ways, then a second time from the file chooser. Then look in the output from strace, if the open path for the .mis file differs. |
The_WOZ, tried loading using both methods before, text field first and then chooser; perhaps wineconsole is interfering with the output. Is there a way I could send the output to a file?
Sent from my ST23i using Tapatalk |
Ah, it must be because the server is a child process to the wine executable, so strace is only logging the system calls from wine itself, and not the server.
Try this: strace -o <logfilename> -e file -f <program> the -o option outputs the log to a file -e file now logs all file related operations, not just calls to file open. -f logs system calls from child processes. |
All times are GMT. The time now is 10:51 AM. |
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.