Quick Game Launch & Load

For discussion of ports to POSIX based systems, especially using GNUStep.

Moderators: winston, another_commander, Getafix

Post Reply
User avatar
CommRLock78
---- E L I T E ----
---- E L I T E ----
Posts: 1138
Joined: Sat Apr 07, 2012 7:35 pm
Location: US
Contact:

Quick Game Launch & Load

Post 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 :(.
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
User avatar
CommRLock78
---- E L I T E ----
---- E L I T E ----
Posts: 1138
Joined: Sat Apr 07, 2012 7:35 pm
Location: US
Contact:

Re: Quick Game Launch & Load

Post 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'
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Quick Game Launch & Load

Post by Diziet Sma »

Useful to know.. thanks! 8)
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
CommRLock78
---- E L I T E ----
---- E L I T E ----
Posts: 1138
Joined: Sat Apr 07, 2012 7:35 pm
Location: US
Contact:

Re: Quick Game Launch & Load

Post 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 :( ))
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Quick Game Launch & Load

Post 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.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
CommRLock78
---- E L I T E ----
---- E L I T E ----
Posts: 1138
Joined: Sat Apr 07, 2012 7:35 pm
Location: US
Contact:

Re: Quick Game Launch & Load

Post 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:.
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Quick Game Launch & Load

Post 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.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
Walbrigg
Competent
Competent
Posts: 37
Joined: Sun Dec 30, 2012 1:58 pm
Location: Beds, England

Re: Quick Game Launch & Load

Post 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
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Quick Game Launch & Load

Post 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"


# 
...
Last edited by Diziet Sma on Sun Jan 27, 2013 4:52 pm, edited 1 time in total.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
Walbrigg
Competent
Competent
Posts: 37
Joined: Sun Dec 30, 2012 1:58 pm
Location: Beds, England

Re: Quick Game Launch & Load

Post 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'
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Quick Game Launch & Load

Post 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.
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
cim
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 4072
Joined: Fri Nov 11, 2011 6:19 pm

Re: Quick Game Launch & Load

Post by cim »

Fixed in r5627. Thanks!
User avatar
Diziet Sma
---- E L I T E ----
---- E L I T E ----
Posts: 6311
Joined: Mon Apr 06, 2009 12:20 pm
Location: Aboard the Pitviper S.E. "Blackwidow"

Re: Quick Game Launch & Load

Post by Diziet Sma »

cim wrote:
Fixed in r5627. Thanks!
Just one of the many reasons I love this game.. :D :D :D :D :D
Most games have some sort of paddling-pool-and-water-wings beginning to ease you in: Oolite takes the rather more Darwinian approach of heaving you straight into the ocean, often with a brick or two in your pockets for luck. ~ Disembodied
User avatar
CommRLock78
---- E L I T E ----
---- E L I T E ----
Posts: 1138
Joined: Sat Apr 07, 2012 7:35 pm
Location: US
Contact:

Re: Quick Game Launch & Load

Post 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.
"I'll laser the mark all while munching a fistful of popcorn." - Markgräf von Ededleen, Marquess, Brutal Great One, Assassins' Guild Exterminator
---------------------------
At the helm of the Caduceus Omega, 'Murderous Morrígan'
Post Reply