Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Snowberry: Dropped starting of a server
Servers are now started using the Shell, not through Snowberry. Removed
the options and code for launching a dedicated server in a terminal.
  • Loading branch information
skyjake committed Feb 16, 2013
1 parent 4e2dc7a commit 36cd760
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 97 deletions.
15 changes: 0 additions & 15 deletions snowberry/conf/doomsday.conf
Expand Up @@ -13,7 +13,6 @@ configure system (
#
configure doomsday (
binary: ..\Bin\Doomsday.exe
server-binary: ..\Bin\Doomsday-Server.exe
base: ..
)

Expand All @@ -38,20 +37,6 @@ group game-options
must-exist: yes
allowed types (file-type-iwad = wad)
)

toggle dedicated-server (
option: -dedicated -server
default: no
)

range server-port (
option: -port
default: 13209
min=1 max=65534
require equals (
dedicated-server: yes
)
)
)


Expand Down
15 changes: 0 additions & 15 deletions snowberry/conf/osx-doomsday.conf
Expand Up @@ -13,7 +13,6 @@ configure system (
#
configure doomsday (
binary: ../Doomsday.app/Contents/MacOS/Doomsday
server-binary: ../Doomsday.app/Contents/Resources/doomsday-server
base: ../Doomsday.app/Contents/Resources
)

Expand Down Expand Up @@ -42,20 +41,6 @@ group game-options
must-exist: yes
allowed types (file-type-iwad = wad)
)

toggle dedicated-server (
option: -dedicated -server
default: no
)

range server-port (
option: -port
default: 13209
min=1 max=65534
require equals (
dedicated-server: yes
)
)
)


Expand Down
15 changes: 0 additions & 15 deletions snowberry/conf/x-doomsday.conf
Expand Up @@ -13,7 +13,6 @@ configure system (
#
configure doomsday (
binary: doomsday
server-binary: doomsday-server
)


Expand All @@ -37,20 +36,6 @@ group game-options
must-exist: yes
allowed types (file-type-iwad = wad)
)

toggle dedicated-server (
option: -dedicated -server
default: no
)

range server-port (
option: -port
default: 13209
min=1 max=65534
require equals (
dedicated-server: yes
)
)
)


Expand Down
55 changes: 3 additions & 52 deletions snowberry/plugins/launcher.py
Expand Up @@ -204,15 +204,8 @@ def startGame(profile):

# Locate the paths and binaries. Most of these are configured in
# the .conf files.
isServer = '-dedicated' in options
if isServer:
idx = options.index('-dedicated')
options = options[:idx] + options[idx+11:]
engineBin = st.getSystemString('doomsday-server-binary')
userPath = paths.getUserPath(paths.SERVER_RUNTIME)
else:
engineBin = st.getSystemString('doomsday-binary')
userPath = paths.getUserPath(paths.RUNTIME)
engineBin = st.getSystemString('doomsday-binary')
userPath = paths.getUserPath(paths.RUNTIME)

options += ' -userdir ' + paths.quote(userPath)

Expand All @@ -223,44 +216,7 @@ def startGame(profile):

# Execute the command line.
if host.isWindows():
if isServer:
batFile = os.path.join(userPath, 'launch.bat')
bat = file(batFile, 'wt')
print >> bat, '@ECHO OFF'
print >> bat, 'ECHO Launching Doomsday...'
curDir = os.getcwd()
print >> bat, 'cd', paths.quote(curDir)
print >> bat, "%s @%s" % (paths.quote(engineBin), paths.quote(responseFile))
bat.close()
engineBin = batFile
spawnFunc = spawnWithTerminal
else:
spawnFunc = os.spawnv
elif host.isMac() and isServer:
# On the Mac, we'll tell Terminal to run it.
osaFile = os.path.join(userPath, 'Launch.scpt')
scpt = file(osaFile, 'w')
print >> scpt, 'tell application "Terminal"'
print >> scpt, ' activate'
def q1p(s): return '\\\"' + s + '\\\"'
def q2p(s): return '\\\\\\\"' + s + '\\\\\\\"'
curDir = os.getcwd()
print >> scpt, " do script \"cd %s; %s @%s\"" % \
(q1p(curDir), engineBin.replace(' ', '\\\\ '), responseFile.replace(' ', '\\\\ '))
print >> scpt, 'end tell'
scpt.close()
engineBin = osaFile
spawnFunc = spawnWithTerminal
elif host.isUnix() and isServer:
shFile = os.path.join(userPath, 'launch.sh')
sh = file(shFile, 'w')
print >> sh, '#!/bin/sh'
print >> sh, "cd %s" % (paths.quote(os.getcwd()))
print >> sh, "%s @%s" % (paths.quote(engineBin), responseFile.replace(' ', '\\ '))
sh.close()
os.chmod(shFile, 0744)
engineBin = paths.quote(shFile)
spawnFunc = spawnWithTerminal
spawnFunc = os.spawnv
else:
spawnFunc = os.spawnvp

Expand All @@ -276,11 +232,6 @@ def q2p(s): return '\\\\\\\"' + s + '\\\\\\\"'
events.sendAfter(events.Command('quit'))


def spawnWithTerminal(wait, launchScript, arguments):
term = st.getSystemString('system-terminal').split(' ')
subprocess.Popen(term + [launchScript])


def generateOptions(profile):
"""Generate a text string of all the command line options used
when launching a game.
Expand Down

0 comments on commit 36cd760

Please sign in to comment.