Page 1 of 1

Quick Game Launch & Load

Posted: Sat Jan 26, 2013 6:55 pm
by CommRLock78
I posted this question in the 1.77 issues thread, but it's really a topic onto itself, so:

I never knew I could load my save-gave with a -load parameter. I can get

Code: Select all

~ $ oolite-trunk -load /home/robert/oolite-saves/RB_Lock.oolite-save
to work without quotes, however, I am having trouble with the space in my save file, which I replaced with a '_', but oolite doesn't allow writing those in file names, so every time I re-save it's reverted to 'RB Lock.oolite-save' :(.
Doing

Code: Select all

~ $ oolite-trunk -load '/home/robert/oolite-saves/RB Lock.oolite-save'
does not work unfortunately.
I have tried double quotation marks as well, to no avail :(.

Re: Quick Game Launch & Load

Posted: Sat Jan 26, 2013 11:19 pm
by CommRLock78
Since this seemingly simple thing to fix is not so easy to fix, I've just opted to add this to my .bash_aliases file

Code: Select all

alias commrlock='mv "/home/robert/oolite-saves/RB Lock.oolite-save" /home/robert/oolite-saves/RB_Lock.oolite-save & nohup oolite-trunk -load /home/robert/oolite-saves/RB_Lock.oolite-save & exit'

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 5:51 am
by Diziet Sma
Useful to know.. thanks! 8)

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 6:23 am
by CommRLock78
Diziet Sma wrote:
Useful to know.. thanks! 8)
You're welcome :D . Equally as useful, I created another alias, this one just renames the file that way I can launch the game from the menu:

Code: Select all

alias oosave='mv "/home/robert/oolite-saves/RB Lock.oolite-save" /home/robert/oolite-saves/RB_Lock.oolite-save'
in conjunction with the command oolite-trunk -load /home/robert/oolite-saves/RB_Lock.oolite-save in the program launcher command field.

(Like the terminal the menu launcher does not load the game with quotations using the -load parameter, nor does the menu launcher seem to like the alias (commrlock) directly (not even using the "application in terminal" option :( ))

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 6:48 am
by Diziet Sma
Isn't there a way in Linux to auto-run a command on program exit? That way you could set the rename to happen automatically, immediately after you quit the game.

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 8:52 am
by CommRLock78
Diziet Sma wrote:
Isn't there a way in Linux to auto-run a command on program exit? That way you could set the rename to happen automatically, immediately after you quit the game.
If there is a way (and I'm sure there is since you mention it :)) I haven't the foggiest idea how to do it :oops:.

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 10:35 am
by Diziet Sma
CommRLock78 wrote:
Diziet Sma wrote:
Isn't there a way in Linux to auto-run a command on program exit? That way you could set the rename to happen automatically, immediately after you quit the game.
If there is a way (and I'm sure there is since you mention it :)) I haven't the foggiest idea how to do it :oops:.
I'm flattered that you think that highly of my knowledge.. :oops:

However, I may have mis-remembered/misunderstood something I once saw, as a little digging doesn't turn anything up. This article may present an interesting solution, though. Launch Oolite via a script which automatically executes another command when Oolite exits.

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 4:31 pm
by Walbrigg
The workarounds are ingenious, and yes, you could write a script wrapper to rename the save file after running, but really, the second thing you tried, with the quotation marks, is the right solution and ought to have worked. (Double-quotes would perhaps be more natural, but either single or double should work).

I didn't see a mention in the other thread or here of what "oolite-trunk" is. I suspect it is a script wrapper around the actual oolite binary, and the way it is passing the command-line on to the application is causing problems with the spaces. If so, it should be fixed. If it has something like

Code: Select all

path/oolite.app/oolite $*
That needs to be changed to

Code: Select all

path/oolite.app/oolite "$@"
That is the correct way to pass on the arguments without having this problem. The $* thing works fine as long as no arguments have spaces in them.


Failing that, there is probably some number of backslashes you could put before the space which would fix it. My first guess would be three:

Code: Select all

oolite-trunk -load /home/robert/oolite-saves/RB\\\ Lock.oolite-save
But it depends on exactly what is going on between your command line and the process that's actually looking at ARGV

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 4:39 pm
by Diziet Sma
Thanks for that, Walbrigg.. I had a feeling the quotes should have worked, but couldn't figure out why it was failing. Your explanation makes sense. 8)
Walbrigg wrote:
I didn't see a mention in the other thread or here of what "oolite-trunk" is. I suspect it is a script wrapper around the actual oolite binary, and the way it is passing the command-line on to the application is causing problems with the spaces
Umm, no.. oolite-trunk is the current development branch of Oolite.

See these two threads for some more details:
https://bb.oolite.space/viewtopic.php?f=9&t=6853
https://bb.oolite.space/viewtopic.php?f=9&t=4595

But yes, there is a script wrapper. On my system, it looks like this:

Code: Select all

#!/bin/sh


TRUNK=""


# 
# Oolite Run Script
# This is to run Oolite with the standalone Dependencies Pack.
#
# Usage: ./oolite-wrapper
# Dylan Smith, 2005-09-03
#
# Konstantinos Sykas
# 2009-09-30: Added DTDs transport to $HOME/GNUstep/Library (Address DTD not found issue)
# 2010-04-23: Added x86_64 exports for GNUSTEP
# 2010-04-26: Command line arguments passing to oolite executable
# 2011-03-22: 1) Removed TOPLEVEL environment variable. A small fix in the default.*.apspec file
#                made TOPLEVEL obsolete. OOLITE_ROOT is more than enough.
#             2) Replaced any usage of ~ as homepath by $HOME
#             3) Fixed a problem where oolite needed to run twice before the
#                the $HOME/.Oolite/.oolite-run file could be created.
# 2011-03-26: Updated to support the new self-extractable package
# 2011-04-03: Updated to facilitate rsync repository setup for oolite-update script
# 


OOLITE_ROOT=$(cd $(dirname $0); cd ..; pwd -P)

if [ ! -f $HOME/.Oolite/.oolite${TRUNK}-run ]
then
   mkdir -p $HOME/.Oolite/
   touch $HOME/.Oolite/.oolite${TRUNK}-run
   cat ${OOLITE_ROOT}/doc/README-PREAMBLE.TXT \
        ${OOLITE_ROOT}/doc/README.TXT | more
fi

# Oolite fails with a black message box with no text with the title
# 'Critical' if this doesn't exist.
if [ ! -d $HOME/GNUstep/Library/DTDs ]; then
   mkdir -p $HOME/GNUstep/Library/DTDs
   cp -r ${OOLITE_ROOT}/oolite-deps/DTDs/* $HOME/GNUstep/Library/DTDs/.
fi

# Set GNUstep environment.
HOST_ARCH=`uname -m | sed -e s/amd64/x86_64/`
if [ "$HOST_ARCH" = "x86_64" ]; then
   export GNUSTEP_HOST=x86_64-pc-linux-gnu
   export GNUSTEP_HOST_CPU=x86_64
else
   export GNUSTEP_HOST=i686-pc-linux-gnu
   export GNUSTEP_HOST_CPU=ix86
fi
export GNUSTEP_FLATTENED=yes
export GNUSTEP_HOST_OS=linux-gnu
export GNUSTEP_HOST_VENDOR=pc
# export GNUSTEP_ROOT=${OOLITE_ROOT}/oolite-deps/GNUstep
# export GNUSTEP_PATHLIST=${OOLITE_ROOT}/oolite-deps/GNUstep:${OOLITE_ROOT}/oolite-deps/GNUstep/Local:${OOLITE_ROOT}/oolite-deps/GNUstep/System
# export GNUSTEP_USER_ROOT=${OOLITE_ROOT}/oolite-deps/GNUstep
# export GNUSTEP_SYSTEM_ROOT=${OOLITE_ROOT}/oolite-deps/GNUstep/System
# export GNUSTEP_NETWORK_ROOT=${OOLITE_ROOT}/oolite-deps/GNUstep/Local
# export GNUSTEP_LOCAL_ROOT=${OOLITE_ROOT}/oolite-deps/GNUstep/Local

export LD_LIBRARY_PATH=${OOLITE_ROOT}/oolite-deps/lib
export ESPEAK_DATA_PATH=${OOLITE_ROOT}/oolite.app/Resources/

cd ${OOLITE_ROOT}/
./oolite.app/oolite $@
if [ $? != 0 ]
then
   echo
   echo "Erk. It looks like Oolite${TRUNK} died with an error. When making an error"
   echo "report, please copy + paste the log above into the report."
   echo
   echo "(Press Ctrl-C to continue)"
   cat
fi
Edit: oops.. posted the wrong script. Fixed now.

The trunk wrapper varies from the above only slightly:

Code: Select all

#!/bin/sh


TRUNK="-trunk"


# 
...

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 4:50 pm
by Walbrigg
I must do my builds funny, I don't have that script.

Anyway, it's almost the same error.The line in the script

Code: Select all

./oolite.app/oolite $@
Needs to be

Code: Select all

./oolite.app/oolite "$@"
and then it will work with arguments with spaces in them. e.g.

Code: Select all

oolite-trunk -load '/home/robert/oolite-saves/RB Lock.oolite-save'

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 4:55 pm
by Diziet Sma
Walbrigg wrote:
I must do my builds funny, I don't have that script.
Something to do with this, perhaps?

Code: Select all

# This is to run Oolite with the standalone Dependencies Pack.
Anyway, thanks for your fix.. this is clearly something that ought to be passed along to the Higher-Ups..
until then, every time oolite-trunk-update is run, it will clobber the fix.

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 5:04 pm
by cim
Fixed in r5627. Thanks!

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 5:10 pm
by Diziet Sma
cim wrote:
Fixed in r5627. Thanks!
Just one of the many reasons I love this game.. :D :D :D :D :D

Re: Quick Game Launch & Load

Posted: Sun Jan 27, 2013 7:13 pm
by CommRLock78
Well I "fixed" the wrapper and the game still gives me the same BS :evil: . I even tried "escaping" the space using a backslash. I guess I'm still stuck where I was before. Thanks for trying :). I'm really beginning to regret even seeing this parameter... :| .

Here's a bash script I just made as a compromise. I think this is the only way it's going to work, seeing as "$@" had absolutely no affect:

Code: Select all

#!/bin/bash

mv "/home/robert/oolite-saves/RB Lock.oolite-save" /home/robert/oolite-saves/RB_Lock.oolite-save
oolite-trunk -load /home/robert/oolite-saves/RB_Lock.oolite-save
Thanks again Walbrigg for the sharp eye, and Dizzy for drawing attention to the thread :). Maybe I'll try to update the trunk to see if things work, but for now I'm just annoyed with this thing.