quickly saved

This commit is contained in:
Mathieu Comandon 2010-02-23 23:54:05 +01:00
parent dbf3fb9508
commit 024fc54238
22 changed files with 207 additions and 71 deletions

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
lutris (0.2~public2) lucid; urgency=low
* New release.
-- Mathieu Comandon <strycore@gmail.com> Sun, 21 Feb 2010 00:42:31 +0100
lutris (0.2~public2) lucid; urgency=low
* New release.

View file

@ -118,10 +118,10 @@ class LutrisDesktopControl():
#Restore resolution
if self.default_resolution is None:
os.popen("xrandr -s 1")
#os.popen("xrandr -s 1")
os.popen("xrandr -s 0")
else:
os.popen("xrandr -s 1")
#os.popen("xrandr -s 1")
os.popen("xrandr -s %s" % self.default_resolution)
#Restore gamma

View file

@ -58,8 +58,13 @@ class LutrisGame():
return False
try:
self.machine = eval(self.runner_name+"."+self.runner_name+"(self.game_config)")
except AttributeError:
print "Malformed configuration file : %s" % self.name
except AttributeError,msg:
logging.error("Malformed configuration file : %s" % self.name)
logging.error(msg)
return False
except KeyError,msg:
logging.error("Malformed configuration file : %s" % self.name)
logging.error(msg)
return False
return True
@ -128,4 +133,6 @@ class LutrisGame():
self.game_thread.game_process.terminate()
self.lutris_desktop_control.reset_desktop()
pathname = os.path.dirname(sys.argv[0])
logging.debug("Remove me after debug : %s on %s" %( sys.argv[0],pathname))
logging.debug("line 2 : %s " % os.path.abspath(pathname))
os.chdir(os.path.abspath(pathname))

View file

@ -25,6 +25,7 @@ import gtk
import runners
import os
import logging
import subprocess
from lutris.config import LutrisConfig
from lutris.installer_config_vbox import InstallerConfigVBox
from lutris.runner_config_vbox import RunnerConfigVBox
@ -63,7 +64,7 @@ class InstallerDialog(gtk.Dialog):
else:
logging.debug("Please fix % and add a machine attribute" % runner_cls)
machine = ""
if runner.is_installed():
if runner.is_installed() and runner.is_installable:
runner_liststore.append((machine+" ("+ description +")" ,runner_cls))
self.runner_combobox = gtk.ComboBox(runner_liststore)
@ -109,16 +110,25 @@ class InstallerDialog(gtk.Dialog):
self.run()
def install_game(self, button):
"""OK button pressed in the Add Game Dialog"""
"""OK button pressed in the Installer Dialog"""
#Get name
realname = self.realname_entry.get_text()
#Get runner
self.lutris_config.config["realname"] = realname
self.lutris_config.config["runner"] = self.runner_class
#Run the installer
runner = eval("runners."+self.runner_class+"."+self.runner_class+"()")
command = runner.get_install_command(self.lutris_config.config["game"]["installer"])
if command:
logging.debug("Running installer : %s" % command)
subprocess.Popen(command,shell=True)
else:
logging.debug("No command given for installation")
if self.runner_class and realname:
game_identifier = self.lutris_config.save(type="game")
self.game_info = {"Game Name": realname,"Runner": self.runner_class , "name": game_identifier}
#game_identifier = self.lutris_config.save(type="game")
#self.game_info = {"Game Name": realname,"Runner": self.runner_class , "name": game_identifier}
self.destroy()

View file

@ -49,7 +49,7 @@ class RunnersDialog(gtk.Dialog):
def on_install_clicked(self,widget,runner):
runner_instance = eval("runners."+runner+"."+runner+"()")
runner_instance.install()
runner_instance.install_runner()
def on_configure_clicked(self,widget,runner):
RunnerConfigDialog(runner)

View file

@ -38,7 +38,7 @@ class SystemConfigVBox(ConfigVBox):
("Metacity","metacity"),("Metacity (Composited)","metacity_composited")]
#TODO : Same thing for OSS Wrappers
oss_list = [("None (don't use OSS)","none"),("aoss (OSS Wrapper for Alsa)","aoss"),("padsp (OSS Wrapper for PulseAudio)","padsp")]
oss_list = [("None (don't use OSS)","none"),("aoss (OSS Wrapper for Alsa)","aoss"),("esddsp (OSS Wrapper for esound)","esddsp"),("padsp (OSS Wrapper for PulseAudio)","padsp")]
self.options = [{"option":"game_path","type":"directory_chooser","label":"Default game path"},
{"option":"user_wm","type":"one_choice","label":"Desktop Window Manager","choices":wm_list},

View file

@ -65,7 +65,7 @@ class LutrisThread(threading.Thread):
if self.return_code is not None and not self.cedega:
logging.debug("Game quit")
if self.output:
for stdout in self.output.split("\n"):
for stdout in self.output.read().split("\n"):
logging.debug(stdout)
self.pid = None
return False

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-02-12 13:28+0100\n"
"POT-Creation-Date: 2010-02-21 00:42+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View file

@ -1,4 +1,4 @@
__all__ = ["linux","wine","sdlmame","mednafen",\
"scummvm","cedega","snes9x", "steam",\
"uae","nulldc","vavoom","openmsx",\
"dosbox","pcsx"]
"dosbox","pcsx","o2em"]

View file

@ -29,6 +29,7 @@ class cedega(Runner):
self.executable = "cedega"
self.description = "Runs Windows games with Cedega"
self.machine = "Windows games"
self.is_installable = False
self.game_options = [ {"option":"shortcut", "type": "string","label": "Shortcut"},
{"option":"folder", "type": "string","label": "Folder"}]
self.runner_options = []

View file

@ -24,12 +24,12 @@ from runner import Runner
class dosbox(Runner):
'''Runner for MSX games'''
def __init__(self,settings = None):
'''Constructor'''
self.package = "dosbox"
self.executable = "dosbox"
self.machine = "MS DOS"
self.is_installable = False
self.description = "DOS Emulator"
self.game_options = [{"option":"exe","type":"single","label":"EXE File"}]
self.runner_options = []

View file

@ -1,3 +1,5 @@
import logging
import os.path
# -*- coding:Utf-8 -*-
###############################################################################
## Lutris
@ -22,19 +24,33 @@
from runner import Runner
import os
import stat
class linux(Runner):
def __init__(self,settings=None):
self.description = "Runs native games"
self.machine = "Linux games"
self.is_installable = True
self.installer_options = [{"option": "installer","type": "single","label": "Executable"}]
self.game_options = [ {"option": "exe", "type":"single", "label":"Executable"},
{"option": "args", "type": "string", "name": "args", "label": "Arguments" }]
self.runner_options = []
if settings:
if settings:
self.executable = settings["game"]["exe"]
def get_install_command(self,installer_path):
#Check if installer exists
if not os.path.exists(installer_path):
raise IOError
#Check if script is executable and make it executable if not
if not os.access(installer_path,os.X_OK):
logging.debug("%s is not executable, setting it executable")
os.chmod(installer_path, stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR)
return "x-terminal-emulator -e %s" % installer_path
def is_installed(self):
"""Well of course Linux is installed, you're using Linux right ?"""
return True

View file

@ -1,39 +0,0 @@
from lutris.config import LutrisConfig
import subprocess
class machine:
def __init__(self,settings):
self.executable = ""
def load(self,game):
self.game = game
def config(self):
subprocess.Popen([self.configscript],stdout=subprocess.PIPE).communicate()[0]
def play(self):
pass
def isInstalled(self):
cmdline = "which " + self.executable
cmdline = str.split(cmdline," ")
result = subprocess.Popen(cmdline,stdout=subprocess.PIPE).communicate()[0]
if result == '' :
result = "not installed"
return result
def installDebPackage(self):
result = subprocess.Popen(["gksu","apt-get","install",self.package],stdout=subprocess.PIPE).communicate()[0]
def write_config(self,id,name,fullpath):
"""Writes game config to settings directory"""
system = self.__class__.__name__
index= fullpath.rindex("/")
exe = fullpath[index+1:]
path = fullpath[:index]
if path.startswith("file://"):
path = path[7:]
gameConfig = LutrisConfig()
values = {"main":{ "path":path, "exe":exe, "realname" : name, "system":system }}
gameConfig.write_game_config(id, values)

View file

@ -11,6 +11,9 @@ class nulldc(wine):
def __init__(self,settings=None):
self.description = "Runs Dreamcast games with nullDC emulator"
self.machine = "Sega Dreamcast"
self.is_installable = False
self.requires = ["wine","joy2key"]
self.nulldc_path = "/mnt/seagate/games/nullDC/"
self.executable = "nullDC_1.0.3_mmu.exe"

69
runners/o2em.py Normal file
View file

@ -0,0 +1,69 @@
import os.path
# -*- coding:Utf-8 -*-
###############################################################################
## Lutris
##
## Copyright (C) 2009 Mathieu Comandon strycore@gmail.com
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
###############################################################################
from runner import Runner
class o2em(Runner):
'''Runner for MSX games'''
def __init__(self,settings = None):
'''Constructor'''
self.package = "o2em"
self.executable = "o2em"
self.machine = "Odyssey 2"
#o2em is not yet available as a package in Debian and Ubuntu,
#it requires some packaging
self.is_installable = False
self.bios_path = os.path.join(os.path.expanduser("~"),".o2em/bios/")
self.description = "Magnavox Oyssey² Emulator"
bios_choices = [("Odyssey² bios","o2rom"),("French odyssey² Bios","c52"),("VP+ Bios","g7400"),("French VP+ Bios","jopac")]
controller_choices = [("Diasble","0"),("Arrows keys and right shift","1"),("W,S,A,D,SPACE","2"),("Joystick","3")]
self.game_options = [{"option":"rom","type":"single","label":"Rom File"}]
self.runner_options = [{"option": "bios", "type":"one_choice", "choices":bios_choices,"label":"Bios"},
{"option": "first_controller", "type":"one_choice","choices":controller_choices,"label":"First controller"},
{"option": "second_controller", "type":"one_choice", "choices":controller_choices,"label":"Second controller"},
{"option": "fullscreen", "type":"bool", "label":"Fullscreen"},
{"option": "scanlines", "type":"bool", "label":"Scanlines"}]
self.arguments = ["-biosdir=\"%s\"" % self.bios_path]
if settings:
if "fullscreen" in settings["o2em"]:
if settings["o2em"]["fullscreen"]:
self.arguments = self.arguments + ["-fullscreen"]
if "scanlines" in settings["o2em"]:
if settings["o2em"]["scanlines"]:
self.arguments = self.arguments + ["-scanlines"]
if "first_controller" in settings["o2em"]:
self.arguments = self.arguments + ["-s1=%s" % settings["o2em"]["first_controller"]]
if "second_controller" in settings["o2em"]:
self.arguments = self.arguments + ["-s2=%s" % settings["o2em"]["second_controller"]]
romdir = os.path.dirname(settings["game"]["rom"])
romfile = os.path.basename(settings["game"]["rom"])
self.arguments = self.arguments + ["-romdir=\"%s\"" % romdir+"/"]
self.arguments = self.arguments + ["\""+romfile+"\""]
def play(self):
command = [self.executable] + self.arguments
return command

View file

@ -34,6 +34,7 @@ class pcsx(Runner):
"""
self.executable = "pcsx"
self.package = "pcsx-df"
self.is_installable = False
self.description = "Runs PlayStation games"
self.machine = "Playstation"
self.game_options = [{"option":"iso","type":"single","label":"iso"}]

View file

@ -1,22 +1,39 @@
'''
Created on Sep 16, 2009
# -*- coding:Utf-8 -*-
###############################################################################
## Lutris
##
## Copyright (C) 2009 Mathieu Comandon strycore@gmail.com
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
###############################################################################
@author: strider
'''
from lutris.config import LutrisConfig
import subprocess
import platform
from lutris.config import LutrisConfig
class Runner(object):
'''Generic runner (base class for other runners) '''
def __init__(self,settings=None):
''' Initialize runner'''
self.executable = None
self.is_installable = False
def load(self,game):
self.game = game
def config(self):
"""this is dumb and useless i guess"""
subprocess.Popen([self.configscript],stdout=subprocess.PIPE).communicate()[0]
@ -45,7 +62,7 @@ class Runner(object):
return None
def install(self):
def install_runner(self):
"""Generic install method, for use with package management systems"""
#Return false if runner has no package, must be then another method and
# install method should be overridden by the specific runner

View file

@ -16,6 +16,7 @@ class scummvm(Runner):
self.scummvm_config_file = os.path.join(os.path.expanduser("~"),".scummvmrc")
self.executable = "scummvm"
self.package = "scummvm"
self.is_installable = False
self.description = "Runs LucasArts games based on the Scumm engine"
self.machine = "LucasArts point and click games"
self.gfxmode = "--gfx-mode=normal"

View file

@ -1,8 +1,23 @@
'''
Created on Apr 25, 2009
@author: strider
'''
# -*- coding:Utf-8 -*-
###############################################################################
## Lutris
##
## Copyright (C) 2009 Mathieu Comandon strycore@gmail.com
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
###############################################################################
import os
import subprocess
@ -14,7 +29,8 @@ class sdlmame(Runner):
self.package = "sdlmame"
self.description = "Runs arcade games with SDLMame"
self.machine = "Arcade"
self.is_installable = False
self.game_options = [{"option": "file", "type":"single", "name":"rom", "label":"Rom file"}]
self.runner_options = []

View file

@ -42,6 +42,7 @@ class snes9x(Runner):
self.package = "snes9x-gtk"
self.description = "Runs Super Nintendo games with Snes9x"
self.machine = "Super Nintendo"
self.is_installable = False
self.game_options = [{"option":"rom","type":"single","label":"ROM"}]
self.runner_options = [{"option":"fullscreen", "type":"bool", "label":"Fullscreen"}]
if settings:

View file

@ -2,12 +2,12 @@
# and open the template in the editor.
from wine import wine
from runners.runner import Runner
import os
__author__ = "strider"
__date__ = "$Oct 6, 2009 12:23:49 PM$"
class steam(wine):
class steam(Runner):
def __init__(self,settings = None):
self.executable = "Steam.exe"
self.description = "Runs Steam games with Wine"

View file

@ -1,3 +1,23 @@
# -*- coding:Utf-8 -*-
###############################################################################
## Lutris
##
## Copyright (C) 2009 Mathieu Comandon strycore@gmail.com
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
###############################################################################
import os
import logging
@ -9,7 +29,10 @@ class wine(Runner):
self.package = "wine"
self.machine = "Windows games"
self.description = "Run Windows games with Wine"
self.installer_options = [{"option": "exe","type": "single","label": "Executable"}]
self.is_installable = True
self.installer_options = [{"option": "installer","type": "single","label": "Executable"}]
self.game_options = [ {"option": "exe", "type":"single", "label":"Executable"},
{"option": "args", "type": "string", "label": "Arguments" }]
@ -58,6 +81,10 @@ class wine(Runner):
"""The kill command runs wineserver -k"""
os.popen("winserver -k")
def get_install_command(self):
command = "%s %s" % (self.executable, self.installer_executable)
return command
def play(self):
if "MouseWarpOverride" in self.wine_config:
self.set_regedit(r"HKEY_CURRENT_USER\Software\Wine\DirectInput", "MouseWarpOverride", self.wine_config["MouseWarpOverride"])