Currently Online

Latest Posts

Topic: What, if any, command line options are there?

Casteele
Avatar
Topic Opener
Joined: 2022-12-16, 04:16
Posts: 3
OS: Debian Linux
Version: 1.2? (Latest update now shows 1.1?)
Ranking
Just found this site
Posted at: 2022-12-16, 04:27

While messing around with several things (modding, customization, debugging/tracing), I came across some issues...

Because of the way the Debian Linux package is distributed as a FlatPak, I have to write some custom commands to launch both the FlatPak launcher and the game itself. This requires me to do a song-and-dance to properly get the different log files (i.e., one log for the FlatPak launcher, another log for WL itself...)

What command line options, if any, exist in the Widelands binary? Ideally, I hope there are some to control logging output, such as "to a file", and logging levels, such as "info, warnings, errors, fatal".


Top Quote
niektory
Avatar
Joined: 2019-06-03, 20:06
Posts: 206
Ranking
Widelands-Forum-Junkie
Location: Poland
Posted at: 2022-12-16, 07:03

Running widelands --help-all shows the available command line options. In the 1.1 version there are only 2 options related to logging:

 --verbose             Enable verbose debug messages

 --verbose-i18n        Print all strings as they are translated. This
                       helps with tracing down bugs with
                       internationalization.
Edited: 2022-12-16, 07:04

Top Quote
Casteele
Avatar
Topic Opener
Joined: 2022-12-16, 04:16
Posts: 3
OS: Debian Linux
Version: 1.2? (Latest update now shows 1.1?)
Ranking
Just found this site
Posted at: 2022-12-16, 09:25

niektory wrote:

Running widelands --help-all shows the available command line options. In the 1.1 version there are only 2 options related to logging:

``` --verbose Enable verbose debug messages

--verbose-i18n Print all strings as they are translated. This helps with tracing down bugs with internationalization. ```

Thank you. Being a FlatPak made it difficult to execute the binary with "--help-all" and still see the output. I finally managed it, but maybe there should be a Wiki entry listing the options (at least the common and important ones), somewhere.

(I might do it, myself, and submit it. Depends on my available time...)


Top Quote
mxb2001
Avatar
Joined: 2019-05-20, 18:49
Posts: 303
OS: Linux
Version: 1.2
Ranking
Tribe Member
Location: The land of the thirsty spider
Posted at: 2022-12-18, 22:16

This may not be useful but since I've had some problems myself with flatpak and logging I'll just submit an example of what I did with another game:

/usr/bin/flatpak run --branch=stable org.wesnoth.Wesnoth --log-none deprecation >weslog16.txt 2>&1

The first option is for flatpack. org.w.W is sort of the game executable and is followed by a option as well as a pipe for the log.


--
To Boldly Go Where No Man Has Gone Before

Top Quote
tothxa
Avatar
Joined: 2021-03-24, 12:44
Posts: 485
OS: antix / Debian
Version: some new PR I'm testing
Ranking
Tribe Member
Posted at: 2022-12-19, 01:33

Actually flatpak doesn't normally write anything on stdout. But if you want to do special things, you may consider doing them from inside the flatpak runtime: flatpak run --command=bash org.widelands.Widelands. It's even better if you install the org.freedesktop.Sdk too, and do flatpak run --devel --command=bash org.widelands.Widelands, so you have debugging tools as well. If you save your logs or anything else in ~/.widelands of the flatpak environment, then they will be kept after you quit under your real home dir in ~/.var/app/org.widelands.Widelands/.widelands.

BTW there IS a real Debian package. v1.1 is in unstable: https://packages.debian.org/widelands face-smile.png


Top Quote
Casteele
Avatar
Topic Opener
Joined: 2022-12-16, 04:16
Posts: 3
OS: Debian Linux
Version: 1.2? (Latest update now shows 1.1?)
Ranking
Just found this site
Posted at: 2022-12-19, 09:52

I think I have things figured out. To document it all, I am posting here the issues and solutions that worked for me.

First issue, WL is distributed in the upstream repository, but the build is either months or years out-of-date. The only way around this is to either compile it myself (another issue in itself...), or download it from the WL website. But...

Second issue, reasonably up-to-date versions of WL are distributed as a FlatPak for my operating system. This caused several issues because FlatPak creates a separate runtime environment (a chroot jail type thing) for the game, where common techniques such as direct command line starting of the game, input/out redirection, and even using specialized commands/tools/shell scripts do not work normally. FlatPak's are not very well documented, either (there exists a lot of documentation--but frankly, it sucks).

To get around this, I wrote a custom script (in TCL, but I could have used Perl, Python, etc) that let me type just "wl [options]", where my script would create a proper FlatPak command line to properly launch WL with the desired options. It would also handle properly setting up I/O redirection and log files.

Third issue, under my default GUI desktop (X11+Gnome+KDE), the *.desktop launcher+FlatPak acted weird: I could edit the application, but it ignored my edits. At one point, I even set the target application in the *.desktop to literally execute the command "argh die die die" -- This should have caused it to fail executing at all when click the launcher icon/menu. However, it still launched WL as if I never edited it at all. I suspect this is something with how FlatPak sets things up, and has nothing to do with WL itself.

But the problem was that it would not execute my custom written "wl [options]" command.

To get around this, I renamed my "/usr/bin/flatpak" command to "/usr/bin/flatpak.real", and then set up another script as "/usr/bin/flatpak". This script would parse the command line options, change them as needed, then pass them on to the "flatpak.real" command. (I needed this because WL is not the only FlatPak app on my system; I also have DOSBOX-X).

Fourth issue, both WL Stable (ver. 1.1) and WL Beta (ver. 1.2) are installed on my system. To choose which to execute, I modified my "wl" script to select the proper "--branch=..." to tell FlatPak to use.

I might have forgotten some more minor issues, but I finally got everything working, logging, etc.

If there is enough interest, I might consider contributing my scripts, or maybe better... Developing a WL launcher similar to the MineCraft launcher, which can can detect and choose different base installations, etc... Hard to say right now since my free time is in flux due to the holiday season.


Top Quote