Help with using BfW for Mac OS X with command-line arguments

Having trouble with the game? Report issues and get help here. Read this first!

Moderators: Forum Moderators, Developers

Forum rules
Before reporting issues in this section, you must read the following topic:
Invisible Philosopher
Posts: 873
Joined: July 4th, 2004, 9:14 pm
Location: My imagination
Contact:

Help with using BfW for Mac OS X with command-line arguments

Post by Invisible Philosopher »

Mac OS X 10.3.7
Battle for Wesnoth 0.8.10, Sithrandel's build

1) Start up Terminal
2) Enter this:

Code: Select all

cd ~/Applications/Battle\ for\ Wesnoth/Battle\ For\ Wesnoth.app/Contents/Resources
../MacOS/Battle\ For\ Wesnoth --help
Wesnoth starts up as if it had been double-clicked.

Am I doing something wrong? Any command-line arguments I try to give it are ignored. Or is there something about the build that makes it impossible?
Play a Silver Mage in the Wesvoid campaign.
Sithrandel
Posts: 537
Joined: September 15th, 2003, 2:54 pm
Location: Sheffield (UK)
Contact:

Post by Sithrandel »

Yes there is something about the build which prevents this. The build itself is feeding Wesnoth command line parameters. so it will ignore the ones you type in. This is necessary to minimise the about of Mac specific source code in the general Wesnoth sources whilst at the same time maximising the Mac behaviour.
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

Is there any possibility of allowing command line arguments to work on OSX?

Alot of valuable functionality for power users and developers is found in command line arguments.

David
“At Gambling, the deadly sin is to mistake bad play for bad luck.” -- Ian Fleming
Sithrandel
Posts: 537
Joined: September 15th, 2003, 2:54 pm
Location: Sheffield (UK)
Contact:

Post by Sithrandel »

Dave wrote:Is there any possibility of allowing command line arguments to work on OSX?

Alot of valuable functionality for power users and developers is found in command line arguments.

David
It certainly is possible. The question is the best way to do it effectively and easily for all :)

I'll have a think and see if there is a nicer way than just allowing Invisible Philosoper's Way to work which would be the easiest way. The current code there was put in place @ version 4 when command line args were less important than getting a Mac version :)
Sithrandel
Posts: 537
Joined: September 15th, 2003, 2:54 pm
Location: Sheffield (UK)
Contact:

Post by Sithrandel »

OK... a simple typo is causing the lack of command line arguments falling through. Turns out I had been thinking I was passing them through ;)

basically line 562 of the cocoa file, change

Code: Select all

for (tmp = 0; tmp<myArgc ;tmp++) myArgv[tmp] = gArgv[tmp];
to

Code: Select all

for (tmp = 0; tmp<gArgc ;tmp++) myArgv[tmp] = gArgv[tmp];
Strangely enough, having just set myArgc to zero before this had meant nothing was happening in the original loop ;)

This change will be incorporated into my future builds.

How many plan to make use of these? Would it be worth building the option of command line input into the debug dialog box?
defsy
Posts: 34
Joined: December 3rd, 2004, 12:27 am
Location: Germany

Post by defsy »

Sithrandel wrote:How many plan to make use of these? Would it be worth building the option of command line input into the debug dialog box?
I will be using the --fps option at least once :-D

For the other options... I don't even know what they are
since I couldn't get --help to work ;-)

[Edit: hit the wrong button...]
It would be very nice to be able to type options into the debug dialog,
if that's what you had in mind. (maybe with the --help output in some hidable area above)
Personally I have no problem with terminals, but I must admit,
the Mac way of doing things graphically is infesting my mind :)

But if the debug dialog is much trouble, I'm pleased with CLI working, too :D

cheers
defsy

P.S.: Thanks for the OSX builds! I'm just not sure if I should finally download 0.8.10 or wait a few days(?) for 0.8.11?
Sithrandel
Posts: 537
Joined: September 15th, 2003, 2:54 pm
Location: Sheffield (UK)
Contact:

Post by Sithrandel »

Code: Select all

-d, --debug       Shows debugging information in-game
-f, --fullscreen  Runs the game in full-screen
-h, --help        Prints this message and exits
--path            Prints the name of the game data directory and exits
-t, --test        Runs the game in a small example scenario
-w, --windowed    Runs the game in windowed mode
-v, --version     Prints the game's version number and exits
--log-error="domain1,domain2,...", --log-warning=..., --log-info=...
                    Set the severity level of the debug domains
                    "all" can be used to match any debug domain
--nocache         Disables caching of game data
Currently:

-f / -w can be set in game.
-d is accessed by holding down Option / Alt when launching.

So what is missing is log-error, test and no cache
defsy
Posts: 34
Joined: December 3rd, 2004, 12:27 am
Location: Germany

Post by defsy »

Thank you, Sithrandel for the information.
For me, you don't have to implement them into the debug
dialog. I won't need them (regularly) - I hope ;).
defsy.
sanna
Posts: 425
Joined: June 5th, 2004, 9:59 am
Location: Halmstad, Sweden

Post by sanna »

Sithrandel wrote: How many plan to make use of these? Would it be worth building the option of command line input into the debug dialog box?
I would most certainly use them, and I would love to have a debug dialog box. :D
(Will be nice not having to recompile to use --fps anymore.)
Sithrandel
Posts: 537
Joined: September 15th, 2003, 2:54 pm
Location: Sheffield (UK)
Contact:

Post by Sithrandel »

sanna wrote:
Sithrandel wrote: How many plan to make use of these? Would it be worth building the option of command line input into the debug dialog box?
I would most certainly use them, and I would love to have a debug dialog box. :D
By the Debug Dialog Box, I just meant the dialog box which appears to tell you that the debug mode is on (i.e. you held down Option / Alt) at launch. It has been there for some time now.

I'll see how many other people might be interested before adding the CL option to that :)
sanna
Posts: 425
Joined: June 5th, 2004, 9:59 am
Location: Halmstad, Sweden

Post by sanna »

Sithrandel wrote: By the Debug Dialog Box, I just meant the dialog box which appears to tell you that the debug mode is on (i.e. you held down Option / Alt) at launch. It has been there for some time now.

I'll see how many other people might be interested before adding the CL option to that :)
Well, I do know that there is such a box, so to make my point very clear; I would love it if you added the CL option to that box. :D
ott
Inactive Developer
Posts: 838
Joined: September 28th, 2004, 10:20 am

Post by ott »

I currently run the game with a commandline

Code: Select all

wesnoth --fps -d --log-error="all" --log-warning="all" --log-info="all" > /tmp/wesnoth.log.$$ 2>&1
and would find it important that I could do something similar once I move over to a Mac. The heavy duty logging and saving the output to a file is really useful to pick up problems for any developer. As you point out, debug mode is simple to toggle on launch (and in-game with the :debug command) but the verbose logging is something I am not sure the current MacOS builds support.
Sithrandel
Posts: 537
Joined: September 15th, 2003, 2:54 pm
Location: Sheffield (UK)
Contact:

Post by Sithrandel »

ott wrote:I currently run the game with a commandline

Code: Select all

wesnoth --fps -d --log-error="all" --log-warning="all" --log-info="all" > /tmp/wesnoth.log.$$ 2>&1
and would find it important that I could do something similar once I move over to a Mac. The heavy duty logging and saving the output to a file is really useful to pick up problems for any developer. As you point out, debug mode is simple to toggle on launch (and in-game with the :debug command) but the verbose logging is something I am not sure the current MacOS builds support.
With the bug fix mentioned above, yes it does.

I am a great believer in making the app as Mac like as possible. There are, however, some things which are best done with a CLI and are not worth trying to implement in a GUI.

Once you start mentioning pipes, then the CLI is the best place for you to stay :)

A GUI based systems is useful for when there are those who are unfamiliar with CLIs, but who might benefit from some of the CLI switches.
sanna
Posts: 425
Joined: June 5th, 2004, 9:59 am
Location: Halmstad, Sweden

Post by sanna »

Well, when I try to launch the game from cmd line, it cannot find the data dir. If I try to specify the data dir (as the first unprefixed argument), it reacts as if I had dragged'n'dropped a user campaign on the icon.

What am I doing wrong?
Sithrandel
Posts: 537
Joined: September 15th, 2003, 2:54 pm
Location: Sheffield (UK)
Contact:

Post by Sithrandel »

You need to CD to the Contents/Resources directory before launching
Post Reply