added hatari runner

This commit is contained in:
Mathieu Comandon 2010-04-25 16:33:18 +02:00
parent a2fc592ca3
commit 226e2706e3
6 changed files with 102 additions and 27 deletions

1
.bzrignore Normal file
View file

@ -0,0 +1 @@
nbproject

View file

@ -62,23 +62,9 @@ class LutrisWindow(gtk.Window):
__gtype_name__ = "LutrisWindow"
def __init__(self):
"""__init__ - This function is typically not called directly.
Creation a LutrisWindow requires redeading the associated ui
file and parsing the ui definition extrenally,
and then calling LutrisWindow.finish_initializing().
Use the convenience function NewLutrisWindow to create
LutrisWindow object.
"""
pass
def finish_initializing(self, builder):
"""finish_initalizing should be called after parsing the ui definition
and creating a LutrisWindow object with it in order to finish
initializing the start of the new LutrisWindow instance.
"""
#get a reference to the builder and set up the signals
self.builder = builder
self.builder.connect_signals(self)

View file

@ -28,7 +28,7 @@ class ConfigVBox(gtk.VBox):
gtk.VBox.__init__(self)
self.options = None
logging.debug("caller:"+caller)
#Section of the configuration file to save options in. Can be "game", "runner" or "system"
self.save_in_key= save_in_key
@ -36,8 +36,6 @@ class ConfigVBox(gtk.VBox):
def generate_widgets(self):
#Select what data to load based on caller.
logging.debug("Caller : %s" % self.caller)
logging.debug("Save in key : %s" % self.save_in_key)
if self.caller == "system":
self.real_config = self.lutris_config.system_config
elif self.caller == "runner":
@ -49,7 +47,6 @@ class ConfigVBox(gtk.VBox):
if self.save_in_key in self.real_config:
config = self.real_config[self.save_in_key]
else:
logging.debug("Creating key : %s" % self.save_in_key)
config = self.real_config[self.save_in_key] = {}
#Go thru all options.
@ -120,7 +117,6 @@ class ConfigVBox(gtk.VBox):
hbox = gtk.HBox()
liststore = gtk.ListStore(str,str)
for choice in choices:
logging.debug(type(choice))
if type(choice) is str:
choice = [choice, choice]
liststore.append(choice)
@ -131,7 +127,6 @@ class ConfigVBox(gtk.VBox):
combobox.add_attribute(cell, 'text', 0)
index = selected_index = -1
if value:
logging.debug(value)
for choice in choices:
if choice[1] == value:
selected_index = index +1
@ -174,8 +169,6 @@ class ConfigVBox(gtk.VBox):
#File chooser
def generate_file_chooser(self,option_name,label,value=None):
"""Generates a file chooser button to choose a file"""
logging.debug("File chooser")
logging.debug(value)
hbox = gtk.HBox()
gtklabel = gtk.Label(label)
gtklabel.set_size_request(200,30)
@ -183,8 +176,7 @@ class ConfigVBox(gtk.VBox):
file_chooser.set_size_request(200,30)
file_chooser.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
file_chooser.set_current_folder("/media/seagate300")
file_chooser.set_current_folder(self.lutris_config.get_path(self.runner_class))
#file_chooser.set_current_folder(self.lutris_config.get_path(self.runner_class))
file_chooser.connect("file-set",self.on_chooser_file_set,option_name)
if value:
file_chooser.unselect_all()

View file

@ -2,4 +2,4 @@ __all__ = ["linux","wine","sdlmame","mednafen",\
"scummvm","cedega","snes9x", "steam",\
"uae","nulldc","vavoom","openmsx",\
"dosbox","pcsx","o2em","jzintv","stella","atari800",\
"frotz","browser",'osmose','vice']
"frotz","browser",'osmose','vice','hatari']

98
runners/hatari.py Normal file
View file

@ -0,0 +1,98 @@
# -*- 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
from lutris.desktop_control import LutrisDesktopControl
import os
import os.path
import logging
class hatari(Runner):
'''Runner for intellivision games'''
def __init__(self,settings = None):
'''Constructor'''
super(hatari,self).__init__()
self.package = "hatari"
self.executable = "hatari"
self.machine = "Atari ST computers"
self.is_installable = True
self.description = "AtariST emulator."
self.game_options = [ {"option": "disk-a", "type":"single", "label": "Floppy Disk A"},
{"option": "disk-b", "type":"single", "label": "Floppy Disk B"},
]
self.screen_resolutions = []
desktop_control = LutrisDesktopControl()
resolutions_available = desktop_control.get_resolutions()
for resolution in resolutions_available:
self.screen_resolutions = self.screen_resolutions + [(resolution,resolution)]
joystick_choices = [('None','none'),('Keyboard','keys'),('Joystick','real')]
self.runner_options = [{"option": "bios_file", "type":"file_chooser", "label": "Bios File (TOS.img)"},
{"option": "fullscreen", "type":"bool", "label": "Fullscreen"},
{"option": "zoom", "type": "bool", "label": "Double ST low resolution"},
{"option": "borders", "type": "bool", 'label': 'Add borders to display'},
{"option": "status", "type": "bool", 'label': 'Display status bar'},
{"option": "joy1", "type": "one_choice", "label": "Joystick 1", "choices": joystick_choices },
{"option": "joy2", "type": "one_choice", "label": "Joystick 2", "choices": joystick_choices },
]
if settings:
if "fullscreen" in settings["hatari"]:
if settings["hatari"]["fullscreen"]:
self.arguments = self.arguments + ["--fullscreen"]
else:
self.arguments = self.arguments + ["--window"]
if "zoom" in settings["hatari"]:
if settings["hatari"]["zoom"]:
self.arguments = self.arguments + ["--zoom 2"]
else:
self.arguments = self.arguments + ["--zoom 1"]
if 'borders' in settings['hatari'] and settings["hatari"]["borders"]:
self.arguments = self.arguments + ['--borders true']
else:
self.arguments = self.arguments + ['--borders false']
if 'status' in settings['hatari'] and settings["hatari"]["status"]:
self.arguments = self.arguments + ['--statusbar true']
else:
self.arguments = self.arguments + ['--statusbar false']
if "joy1" in settings["hatari"]:
self.arguments = self.arguments + ["--joy0 "+settings["hatari"]['joy1']]
if "joy2" in settings["hatari"]:
self.arguments = self.arguments + ["--joy1 "+settings["hatari"]['joy2']]
if "bios_file" in settings["hatari"]:
self.arguments = self.arguments + ["--tos "+settings["hatari"]["bios_file"]]
else:
self.error_messages = self.error_messages + [ "TOS path not set."]
if "disk-a" in settings['game']:
self.diska = settings['game']['disk-a']
def play(self):
self.arguments = self.arguments + [ "--disk-a \"%s\"" % self.diska ]
command = [self.executable] + self.arguments
return_val = { "command": command ,"error_messages": self.error_messages}
return return_val

View file

@ -23,8 +23,6 @@ import os
from runner import Runner
class uae(Runner):
def __init__(self,settings = None):
self.package = "uae"
self.executable = "uae"