Blob Blame History Raw

# HG changeset patch
# User Eero Tamminen <oak@helsinkinet.fi>
# Date 1482449178 -7200
# Node ID d1668fda4200fcaf79c67ca2eb32a7023227cab4
# Parent  7b3bcc42bc811241b0579d71bca0256b63f0e17c
PythonUI: Support for Hatari v2.0 option changes

- no RTC option, instead there's new ModelType option
  that includes MegaST/E (which has RTC)
- WinUAE & oldUAE support different set of CPUs
- Keep ST resolution option is valid only with
  SDL1 builds

diff -r 7b3bcc42bc81 -r d1668fda4200 python-ui/dialogs.py
--- a/python-ui/dialogs.py	Fri Dec 23 00:57:01 2016 +0200
+++ b/python-ui/dialogs.py	Fri Dec 23 01:26:18 2016 +0200
@@ -2,7 +2,7 @@
 #
 # Classes for the Hatari UI dialogs
 #
-# Copyright (C) 2008-2015 by Eero Tamminen
+# Copyright (C) 2008-2016 by Eero Tamminen
 #
 # 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
@@ -954,14 +954,11 @@
 
         vbox = gtk.VBox()
         self.compatible = gtk.CheckButton("Compatible CPU")
-        self.rtc = gtk.CheckButton("Real-time clock")
         self.timerd = gtk.CheckButton("Patch Timer-D")
         self.compatible.set_tooltip_text("Needed for overscan and other timing sensitive things to work correctly")
-        self.rtc.set_tooltip_text("Some rare games and demos don't work with this")
         self.timerd.set_tooltip_text("Improves ST/STE emulation performance, but some rare demos/games don't work with this")
         vbox.add(self.compatible)
         vbox.add(self.timerd)
-        vbox.add(self.rtc)
         table_add_widget_row(table, row, "Misc.:", vbox, fullspan)
         row += 1
 
@@ -988,7 +985,6 @@
             self.tos.set_filename(tos)
         self.compatible.set_active(config.get_compatible())
         self.timerd.set_active(config.get_timerd())
-        self.rtc.set_active(config.get_rtc())
 
     def _get_active_radio(self, radios):
         idx = 0
@@ -1009,7 +1005,6 @@
         config.set_tos(self.tos.get_filename())
         config.set_compatible(self.compatible.get_active())
         config.set_timerd(self.timerd.get_active())
-        config.set_rtc(self.rtc.get_active())
         config.flush_updates()
 
     def run(self, config):
diff -r 7b3bcc42bc81 -r d1668fda4200 python-ui/hatari.py
--- a/python-ui/hatari.py	Fri Dec 23 00:57:01 2016 +0200
+++ b/python-ui/hatari.py	Fri Dec 23 01:26:18 2016 +0200
@@ -3,7 +3,7 @@
 # Classes for Hatari emulator instance and mapping its congfiguration
 # variables with its command line option.
 #
-# Copyright (C) 2008-2015 by Eero Tamminen
+# Copyright (C) 2008-2016 by Eero Tamminen
 #
 # 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
@@ -60,6 +60,20 @@
             pass
         return error
 
+    def is_winuae(self):
+        "check whether Hatari has WinUAE CPU core (=more features) or oldUAE one"
+        result = False
+        pipe = os.popen(self.hataribin + " -h")
+        for line in pipe.readlines():
+            if line.find("--mmu") >= 0:
+                result = True
+                break
+        try:
+            pipe.close()
+        except IOError:
+            pass
+        return result
+
     def save_config(self):
         os.popen(self.hataribin + " --saveconfig")
 
@@ -267,6 +281,8 @@
         "printout": ("[Printer]", "szPrintToFileName", "Printer output"),
         "soundout": ("[Sound]", "szYMCaptureFileName", "Sound output")
     }
+    has_modeltype = True  # from v2.0 onwards
+    has_keepstres = True  # only with SDL1
     "access methods to Hatari configuration file variables and command line options"
     def __init__(self, hatari):
         confdirs = [".config/hatari", ".hatari"]
@@ -279,6 +295,11 @@
         self._desktop_w = 0
         self._desktop_h = 0
         self._options = []
+        self._winuae = hatari.is_winuae()
+        # initialize has_* attribs for things that may not be anymore
+        # valid on Hatari config file and/or command line
+        self.get_machine()
+        self.get_desktop_st()
 
     def validate(self):
         "exception is thrown if the loaded configuration isn't compatible"
@@ -358,23 +379,45 @@
 
     # ------------ machine ---------------
     def get_machine_types(self):
-        return ("ST", "STE", "TT", "Falcon")
+        if self.has_modeltype:
+            return ("ST", "MegaST", "STE", "MegaSTE", "TT", "Falcon")
+        else:
+            return ("ST", "STE", "TT", "Falcon")
 
     def get_machine(self):
-        return self.get("[System]", "nMachineType")
+        try:
+            return self.get("[System]", "nModelType")
+        except KeyError:
+            self.has_modeltype = False
+            return self.get("[System]", "nMachineType")
+
+    def has_accurate_winsize(self):
+        if self.has_modeltype:
+            return (self.get_machine() < 4)
+        else:
+            return (self.get_machine() < 2)
 
     def set_machine(self, value):
-        self.set("[System]", "nMachineType", value)
-        self._change_option("--machine %s" % ("st", "ste", "tt", "falcon")[value])
+        if self.has_modeltype:
+            self.set("[System]", "nModelType", value)
+            self._change_option("--machine %s" % ("st", "megast", "ste", "megaste", "tt", "falcon")[value])
+        else:
+            self.set("[System]", "nMachineType", value)
+            self._change_option("--machine %s" % ("st", "ste", "tt", "falcon")[value])
 
     # ------------ CPU level ---------------
     def get_cpulevel_types(self):
-        return ("68000", "68010", "68020", "68EC030+FPU", "68040")
+        if self._winuae:
+            return ("68000", "68010", "68020", "68E030", "68040", "68060")
+        else:
+            return ("68000", "68010", "68020", "68EC030+FPU", "68040")
 
     def get_cpulevel(self):
         return self.get("[System]", "nCpuLevel")
 
     def set_cpulevel(self, value):
+        if value == 5: # WinUAE 060
+            value = 6
         self.set("[System]", "nCpuLevel", value)
         self._change_option("--cpulevel %d" % value)
 
@@ -423,14 +466,6 @@
         self.set("[System]", "bPatchTimerD", value)
         self._change_option("--timer-d %s" % str(value))
 
-    # ------------ RTC ---------------
-    def get_rtc(self):
-        return self.get("[System]", "bRealTimeClock")
-
-    def set_rtc(self, value):
-        self.set("[System]", "bRealTimeClock", value)
-        self._change_option("--rtc %s" % str(value))
-
     # ------------ fastforward ---------------
     def get_fastforward(self):
         return self.get("[System]", "bFastForward")
@@ -756,18 +791,23 @@
     # --------- keep desktop res -----------
     def get_desktop(self):
         return self.get("[Screen]", "bKeepResolution")
-    
+
     def set_desktop(self, value):
         self.set("[Screen]", "bKeepResolution", value)
         self._change_option("--desktop %s" % str(value))
 
     # --------- keep desktop res - st ------
     def get_desktop_st(self):
-        return self.get("[Screen]", "bKeepResolutionST")
-    
+        try:
+            return self.get("[Screen]", "bKeepResolutionST")
+        except KeyError:
+            self.has_keepstres = False
+            return False
+
     def set_desktop_st(self, value):
-        self.set("[Screen]", "bKeepResolutionST", value)
-        self._change_option("--desktop-st %s" % str(value))
+        if self.has_keepstres:
+            self.set("[Screen]", "bKeepResolutionST", value)
+            self._change_option("--desktop-st %s" % str(value))
 
     # ------------ force max ---------------
     def get_force_max(self):
@@ -863,11 +903,11 @@
             return (width, height)
         
         # window sizes for other than ST & STE can differ
-        if self.get("[System]", "nMachineType") not in (0, 1):
-            print("WARNING: neither ST nor STE machine, window size inaccurate!")
+        if self.has_accurate_winsize():
+            videl = False
+        else:
+            print("WARNING: With Videl, window size is unknown -> may be inaccurate!")
             videl = True
-        else:
-            videl = False
 
         # mono monitor?
         if self.get_monitor() == 0:
diff -r 7b3bcc42bc81 -r d1668fda4200 python-ui/release-notes.txt
--- a/python-ui/release-notes.txt	Fri Dec 23 00:57:01 2016 +0200
+++ b/python-ui/release-notes.txt	Fri Dec 23 01:26:18 2016 +0200
@@ -2,6 +2,14 @@
 User visible changes in Hatari (Python Gtk) UI
 ----------------------------------------------
 
+2016-12 (Hatari v2.0 fixes):
+- Add support for new nModelType config option (with MegaST/STE
+  options), but still support also old nMachineType option
+- Hatari doesn't anymore support separate RTC option, remove
+- Support for keeping ST resolution option is enabled based on
+  config file content (it's supported only by Hatari SDL1 builds)
+- Initial WinUAE vs. OldUAE CPU core support
+
 2015-05:
 - Add support for --gemdos-drive, --ttram option features
   and new tracepoints