Re: [hatari-devel] Updating to Hatari 2.0.0 in Fedora

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi Andrea,

Thanks for subscribing to the mailing list!

For Hatari UI issue, could you try the attached patch?

(In case of real time clock & keep ST resolution options it
may be better option to remove support for them completely
than try to support also older Hatari configs.  I need to
think about that a bit.)


	- Eero

On 12/17/2016 06:56 PM, Andrea Musuruane wrote:
Hi guys,
    I'm the Hatari maintainer in Fedora.

Some of you already know me because I privately mailed them in the past.

Now, hoping to speed up the process of including Hatari 2.0.0 in
Fedora, I subscribed to this mailing list.

I have the following problems with Hatari 2.0.0.

The first issue is that Hatari no longer builds on aarch64:
https://koji.fedoraproject.org/koji/taskinfo?taskID=16928574
https://kojipkgs.fedoraproject.org//work/tasks/8574/16928574/build.log

For comparison, v1.9.0 built fine:
https://koji.fedoraproject.org/koji/buildinfo?buildID=720136

The second one is that in v2.0.0 hatariui will no longer embed the
hatari window inside its own but it will create a separate window. I
think this is not the expected behaviour.

This is what I get in the console when I run hatariui:

$ hatariui
Reading configuration file '/home/andrea/.hatari/hatari.cfg'...
('--right', 'about,|,run,pause,forward,|,reset,|,quit')
('--embed', '')
/usr/bin/../share/hatari/hatariui/hatariui.py:606: GtkWarning:
IA__gtk_accel_label_set_accel_closure: assertion
'gtk_accel_group_from_accel_closure (accel_closure) != NULL' failed
  item = action.create_menu_item()
WAIT hatari to connect to control socket...
('RUN:', ['hatari', '--confirm-quit', 'off', '--control-socket',
'/tmp/hatari-ui-5555.socket', '--configfile',
'/home/andrea/.hatari/hatari.cfg'])
Connecting to control socket '/tmp/hatari-ui-5555.socket'...
new control socket is '/tmp/hatari-ui-5555.socket'
connected!
Video_SetSystemTimings1 1 3
Video_SetSystemTimings2 1 3 -> 2 (WS3) 503 503 64
Hatari v2.0.0, compiled on:  Nov 27 2016, 16:29:34
Video_SetSystemTimings1 1 3
Video_SetSystemTimings2 1 3 -> 2 (WS3) 503 503 64
Configured max Hatari resolution = 1920x1080, optimal for ST = 832x588
Embedded window ID change messages = ON
New 832x588 SDL window with ID: 2200007
New size = 832 x 588
[...]

Another problem regarding hatariui is about reading the configuration
file. It seems it can only read ~/.hatari/hatari.cfg. But now hatari
saves it by default in .config/hatari/hatari.cfg on my system.

Bye,

Andrea



diff -r ab292f790325 python-ui/config.py
--- a/python-ui/config.py	Sun Dec 18 17:31:30 2016 +0100
+++ b/python-ui/config.py	Mon Dec 19 01:11:54 2016 +0200
@@ -67,22 +67,23 @@
 # Handle INI style configuration files as used by Hatari
 
 class ConfigStore:
-    def __init__(self, userconfdir, defaults = {}, miss_is_error = True):
+    def __init__(self, confdirs, defaults = {}, miss_is_error = True):
         "ConfigStore(userconfdir, fgfile[,defaults,miss_is_error])"
         self.defaults = defaults
-        self.userpath = self._get_full_userpath(userconfdir)
+        self.userpath = self._get_full_userpath(confdirs)
         self.miss_is_error = miss_is_error
     
-    def _get_full_userpath(self, leafdir):
+    def _get_full_userpath(self, confdirs):
         "get_userpath(leafdir) -> config file default save path from HOME, CWD or their subdir"
         # user's hatari.cfg can be in home or current work dir,
         # current dir is used only if $HOME fails
         for path in (os.getenv("HOME"), os.getenv("HOMEPATH"), os.getcwd()):
             if path and os.path.exists(path) and os.path.isdir(path):
-                if leafdir:
-                    hpath = "%s%c%s" % (path, os.path.sep, leafdir)
-                    if os.path.exists(hpath) and os.path.isdir(hpath):
-                        return hpath
+                for leafdir in confdirs:
+                    if leafdir:
+                        hpath = "%s%c%s" % (path, os.path.sep, leafdir)
+                        if os.path.exists(hpath) and os.path.isdir(hpath):
+                            return hpath
                 return path
         return None
 
diff -r ab292f790325 python-ui/hatari.py
--- a/python-ui/hatari.py	Sun Dec 18 17:31:30 2016 +0100
+++ b/python-ui/hatari.py	Mon Dec 19 01:11:54 2016 +0200
@@ -267,10 +267,13 @@
         "printout": ("[Printer]", "szPrintToFileName", "Printer output"),
         "soundout": ("[Sound]", "szYMCaptureFileName", "Sound output")
     }
+    has_modeltype = True  # from v2.0 onwards
+    has_keepstres = True  # only with SDL1
+    has_realclock = True  # only before v2.0
     "access methods to Hatari configuration file variables and command line options"
     def __init__(self, hatari):
-        userconfdir = ".hatari"
-        ConfigStore.__init__(self, userconfdir)
+        confdirs = [".config/hatari", ".hatari"]
+        ConfigStore.__init__(self, confdirs)
         conffilename = "hatari.cfg"
         self.load(self.get_filepath(conffilename))
 
@@ -279,6 +282,11 @@
         self._desktop_w = 0
         self._desktop_h = 0
         self._options = []
+        # 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()
+        self.get_rtc()
 
     def validate(self):
         "exception is thrown if the loaded configuration isn't compatible"
@@ -291,7 +299,7 @@
                 continue
             # but ignore getters for other things than config
             ends = method[method.rfind("_")+1:]
-            if ends in ("types", "names", "values", "changes", "checkpoint", "filepath"):
+            if ends in ("types", "names", "values", "changes", "checkpoint", "filepath", "winsize"):
                 continue
             if ends in ("floppy", "joystick"):
                 # use port '0' for checks
@@ -358,14 +366,31 @@
 
     # ------------ 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):
@@ -425,11 +450,16 @@
 
     # ------------ RTC ---------------
     def get_rtc(self):
-        return self.get("[System]", "bRealTimeClock")
+        try:
+            return self.get("[System]", "bRealTimeClock")
+        except KeyError:
+            self.has_realclock = False
+            return False
 
     def set_rtc(self, value):
-        self.set("[System]", "bRealTimeClock", value)
-        self._change_option("--rtc %s" % str(value))
+        if self.has_realclock:
+            self.set("[System]", "bRealTimeClock", value)
+            self._change_option("--rtc %s" % str(value))
 
     # ------------ fastforward ---------------
     def get_fastforward(self):
@@ -756,18 +786,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 +898,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:


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/