mirror of
https://github.com/gryf/e-uae-wrapper.git
synced 2026-02-13 06:05:44 +01:00
Introduced floppy class
This commit is contained in:
@@ -35,19 +35,22 @@ class Base(object):
|
|||||||
"""
|
"""
|
||||||
Main function which accepts config file for e-uae
|
Main function which accepts config file for e-uae
|
||||||
It will do as follows:
|
It will do as follows:
|
||||||
- set needed full path for asset files
|
- set needed paths for templates
|
||||||
- extract archive file
|
- validate options
|
||||||
|
- [extract archive file]
|
||||||
- copy configuration
|
- copy configuration
|
||||||
- [copy save if exists]
|
|
||||||
- run the emulation
|
- run the emulation
|
||||||
- archive save state
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
self.config['wrapper_tmp_dir'] = self.dir = tempfile.mkdtemp()
|
||||||
|
self.config['wrapper_config_path'] = self.conf_path
|
||||||
|
self._interpolate_options()
|
||||||
|
|
||||||
if not self._validate_options():
|
if not self._validate_options():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.config['wrapper_tmp_dir'] = self.dir = tempfile.mkdtemp()
|
if not self._copy_conf():
|
||||||
self._interpolate_options()
|
return False
|
||||||
# self._set_assets_paths()
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
30
e_uae_wrapper/floppy.py
Normal file
30
e_uae_wrapper/floppy.py
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Floppy class for executing e-uae with specified parameters. This is useful for
|
||||||
|
running things from floppies. It creates new .uaerc file with substituted all
|
||||||
|
templates with proper values and run. Floppies usually are unpacked or only
|
||||||
|
gzipped (which is supported by emulator itsef) so there is no need to copy
|
||||||
|
them to temporary place.
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
|
||||||
|
from e_uae_wrapper import base
|
||||||
|
from e_uae_wrapper import utils
|
||||||
|
|
||||||
|
|
||||||
|
class Wrapper(base.Base):
|
||||||
|
"""Floppy class for running e-uae"""
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
"""
|
||||||
|
Main function which run e-uae
|
||||||
|
"""
|
||||||
|
if not super(Wrapper, self).run():
|
||||||
|
return False
|
||||||
|
|
||||||
|
self._run_emulator()
|
||||||
|
|
||||||
|
def _run_emulator(self):
|
||||||
|
"""execute e-uae"""
|
||||||
|
utils.run_command(['e-uae', '-f', os.path.join(self.dir, '.uaerc')])
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
|
||||||
Simple class for executing e-uae with specified parameters. This is a
|
|
||||||
failsafe class for running e-uae.
|
|
||||||
"""
|
|
||||||
from e_uae_wrapper import base
|
|
||||||
from e_uae_wrapper import utils
|
|
||||||
|
|
||||||
|
|
||||||
class Wrapper(base.Base):
|
|
||||||
"""Simple class for running e-uae"""
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
"""
|
|
||||||
Main function which run e-uae
|
|
||||||
"""
|
|
||||||
if not self._copy_conf():
|
|
||||||
return False
|
|
||||||
|
|
||||||
self._run_emulator()
|
|
||||||
|
|
||||||
def _run_emulator(self):
|
|
||||||
"""execute e-uae"""
|
|
||||||
utils.run_command(['e-uae', self.conf_file])
|
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
"""Do the cleanup. Here - just do nothing"""
|
|
||||||
return
|
|
||||||
Reference in New Issue
Block a user