the legend will never die

This commit is contained in:
Mathieu Comandon 2010-09-23 03:21:27 +02:00
parent 89bc0d7a7c
commit cd10ff30ce
4 changed files with 57 additions and 17 deletions

View file

@ -166,7 +166,7 @@ class LutrisGame():
if "compiz_fullscreen" in config['system']:
self.lutris_desktop_control.set_compiz_fullscreen(title=config['system']['compiz_fullscreen'])
path = None
if hasattr(self.machine, 'game_path'):
path = self.machine.game_path
@ -180,6 +180,23 @@ class LutrisGame():
print "running " + command
self.game_thread = LutrisThread(command, path)
self.game_thread.start()
if 'joy2key' in gameplay_info:
self.run_joy2key(gameplay_info['joy2key'])
def run_joy2key(self, config):
win = "grep %s" % config['window']
if 'notwindow' in config:
win = win + ' | grep -v %s' % config['notwindow']
wid = "xwininfo -root -tree | %s | awk '{print $1}'" % win
buttons = config['buttons']
axis = "Left Right Up Down"
command = "sleep 5 && joy2key $(%s) -X -rcfile ~/.joy2keyrc -buttons %s -axis %s" % (
wid, buttons, axis
)
print command
self.joy2key_thread = LutrisThread(command, "/tmp")
self.joy2key_thread.start()
def write_conf(self, settings):
self.lutris_config.write_game_config(self.name, settings)

View file

@ -21,6 +21,8 @@
import os
from lutris.runners.wine import wine
from lutris.gui.common import DirectoryDialog
from lutris.config import LutrisConfig
class nulldc(wine):
"""Runner for the Dreamcast emulator NullDC
@ -29,6 +31,7 @@ class nulldc(wine):
emulator. It runs pretty well.
NullDC is now OpenSource ! Somebody please port it to Linux.
The open source NullDC version (1.0.4) doesn't work with wine !
Download link : http://nulldc.googlecode.com/files/nullDC_104_r50.7z
@ -53,23 +56,33 @@ class nulldc(wine):
self.is_installable = False
self.depends = "wine"
self.nulldc_path = "/mnt/seagate/games/nullDC/"
self.executable = "nullDC_1.0.3_mmu.exe"
config = LutrisConfig(runner=self.__class__.__name__)
self.nulldc_path = config.get_path()
self.executable = "nullDC_1.0.3_nommu.exe"
self.gamePath = "/mnt/seagate/games/Soul Calibur [NTSC-U]/"
self.gameIso = "disc.gdi"
self.args = ""
self.game_options = [{
'option': 'file',
'option': 'iso',
'type': 'single',
'name': 'iso',
'label': 'Disc image'
}]
self.runner_options = [{
self.runner_options = self.runner_options + [{
'option': 'fullscreen',
'type': 'bool',
'name': 'fullscreen',
'label': 'Fullscreen'
}]
if settings:
self.settings = settings
def install(self):
d = DirectoryDialog('Where is NullDC located ?')
config = LutrisConfig(runner=self.__class__.__name__)
config.runner_config = {'system': {'game_path': d.folder}}
config.save(type='runner')
def is_installed(self):
if not self.check_depends():
@ -83,23 +96,27 @@ class nulldc(wine):
def get_nulldc_path(self):
""" Return the full path for the NullDC executable.
TODO: Load from config
"""
return os.path.join(self.nulldc_path, self.executable)
def play(self):
os.chdir(self.nulldc_path)
#-config ImageReader:DefaultImage="[rompath]/[romfile]"
path = self.gamePath + self.gameIso
path = self.settings['game']['iso']
path = path.replace("/", "\\")
path = 'Z:' + path
command = ["WINEDEBUG=-all",
"wine",
self.get_nulldc_path(),
"-config",
" ImageReader:DefaultImage=\"" + path + "\"",
"-config", "drkpvr:Fullscreen.Enabled=1"]
command = [
"wine",
self.get_nulldc_path(),
"-config", "ImageReader:DefaultImage=\"%s\"" % path,
]
return command
self.check_regedit_keys() #From parent wine runner
return {
'command': command,
'joy2key': {
'buttons': 'y a b x c r l r o s',
'window': 'nullDC',
'notwindow': 'VMU'
}
}

View file

@ -71,6 +71,8 @@ class steam(wine):
if the steam executable is on the harddrive
"""
if not self.check_depends():
return False
if not os.path.exists(os.path.join(self.game_path, self.game_exe)):
return False
else:

View file

@ -54,6 +54,10 @@ class LutrisThread(threading.Thread):
stderr=subprocess.STDOUT,
cwd=self.path)
self.output = self.game_process.stdout
line = "1"
while line:
line = self.game_process.stdout.read(80)
print line
def poke_process(self):
if not self.game_process:
@ -79,7 +83,7 @@ class LutrisThread(threading.Thread):
self.pid = None
return False
return True
class ThreadProcessReader(threading.Thread):
def __init__(self, stdout):
threading.Thread.__init__(self)