mirror of
https://github.com/lutris/lutris
synced 2024-09-15 22:09:55 +00:00
Fix UAE floppy handling
This commit is contained in:
parent
dca6796828
commit
54370205f7
|
@ -308,9 +308,10 @@ class ConfigVBox(Gtk.VBox):
|
|||
def add_files_callback(self, button, option=None):
|
||||
"""Add several files to the configuration"""
|
||||
filenames = button.get_filenames()
|
||||
files = self.real_config[self.save_in_key].get(option, [])
|
||||
for filename in filenames:
|
||||
self.files_list_store.append([filename])
|
||||
if not filename in self.files:
|
||||
self.files.append(filename)
|
||||
self.real_config[self.save_in_key][option] = self.files
|
||||
self.files_chooser_dialog = None
|
||||
if not filename in files:
|
||||
files.append(filename)
|
||||
#self.real_config[self.save_in_key][option] = self.files
|
||||
#self.files_chooser_dialog = None
|
||||
|
|
|
@ -63,7 +63,7 @@ class linux(Runner):
|
|||
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)
|
||||
stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR)
|
||||
|
||||
return "x-terminal-emulator -e %s" % installer_path
|
||||
|
||||
|
|
|
@ -103,18 +103,16 @@ class uae(Runner):
|
|||
|
||||
def insert_floppies(self):
|
||||
#Insert floppies
|
||||
if "disk" in self.settings.config["game"]:
|
||||
drives = self.settings["uae"]["nr_floppies"]
|
||||
disks = len(self.settings["game"]["disk"])
|
||||
inserted_disks = 0
|
||||
for drive in range(0, drives):
|
||||
self.uae_options.update({
|
||||
"floppy%s" % str(drive): "\"%s\"" %
|
||||
os.path.join(self.settings["game"]["disk"][drive])
|
||||
})
|
||||
inserted_disks = inserted_disks + 1
|
||||
if inserted_disks == disks:
|
||||
break
|
||||
inserted_disks = 0
|
||||
drives = self.settings["uae"]["nr_floppies"]
|
||||
for drive, disk in enumerate(self.settings['game'].get('disk', [])):
|
||||
self.uae_options.update({
|
||||
"floppy%s" % str(drive): "\"%s\"" %
|
||||
os.path.join(self.settings["game"]["disk"][drive])
|
||||
})
|
||||
inserted_disks = inserted_disks + 1
|
||||
if inserted_disks == drives:
|
||||
break
|
||||
|
||||
def handle_settings(self):
|
||||
if "uae" in self.settings.config:
|
||||
|
|
56
tests/test_uae.py
Normal file
56
tests/test_uae.py
Normal file
|
@ -0,0 +1,56 @@
|
|||
import logging
|
||||
from unittest import TestCase
|
||||
|
||||
from lutris.runners import uae
|
||||
|
||||
LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class TestUae(TestCase):
|
||||
|
||||
def test_instanciate_runner(self):
|
||||
uae_runner = uae.uae()
|
||||
self.assertEqual(uae_runner.machine, "Amiga")
|
||||
|
||||
def test_insert_floppies(self):
|
||||
# Two disks, one floppy drive
|
||||
config = {
|
||||
'game': {
|
||||
'disk': ['foo.adf', 'bar.adf']
|
||||
},
|
||||
'uae': {
|
||||
'nr_floppies': 1
|
||||
}
|
||||
}
|
||||
uae_runner = uae.uae(config)
|
||||
uae_runner.insert_floppies()
|
||||
self.assertIn('floppy0', uae_runner.uae_options)
|
||||
self.assertNotIn('floppy1', uae_runner.uae_options)
|
||||
|
||||
# Two disks, two floppy drives
|
||||
config = {
|
||||
'game': {
|
||||
'disk': ['foo.adf', 'bar.adf']
|
||||
},
|
||||
'uae': {
|
||||
'nr_floppies': 2
|
||||
}
|
||||
}
|
||||
uae_runner = uae.uae(config)
|
||||
uae_runner.insert_floppies()
|
||||
self.assertIn('floppy0', uae_runner.uae_options)
|
||||
self.assertIn('floppy1', uae_runner.uae_options)
|
||||
|
||||
# Zero disk, two floppy drives
|
||||
config = {
|
||||
'game': {
|
||||
'disk': []
|
||||
},
|
||||
'uae': {
|
||||
'nr_floppies': 2
|
||||
}
|
||||
}
|
||||
uae_runner = uae.uae(config)
|
||||
uae_runner.insert_floppies()
|
||||
self.assertNotIn('floppy0', uae_runner.uae_options)
|
||||
self.assertNotIn('floppy1', uae_runner.uae_options)
|
Loading…
Reference in a new issue