On Wed, 29 Aug 2018 01:01:38 +0200, Martijn van Duren
<openbsd+po...@list.imperialat.at> wrote:

> I agree that we should mention that radeon cards are known to cause 
> issues, but I don't know the best place for them. Diff below places
> them in the Makefile, but maybe we want them somewhere where users
> can find them more easily (readme?).

I tried your diff and it failed:

$ fretsonfire                                                                   
                                                                      
Traceback (most recent call last):
  File "/usr/local/share/fretsonfire/src/GameEngine.py", line 355, in run
    return self.mainloop()
  File "/usr/local/share/fretsonfire/src/GameEngine.py", line 347, in main
    self.view.render()
  File "/usr/local/share/fretsonfire/src/View.py", line 183, in render
    layer.render(self.visibility[layer], layer == self.layers[-1])
  File "/usr/local/share/fretsonfire/src/Menu.py", line 207, in render
    font.render(text, (x - v / 4, y))
  File "/usr/local/share/fretsonfire/src/Font.py", line 179, in render
    self._renderString(text, (pos[0] + 0.003, pos[1] + 0.003), direction, scale)
  File "/usr/local/share/fretsonfire/src/Font.py", line 112, in _renderString
    g, coordinates     = self.getGlyph(ch)
  File "/usr/local/share/fretsonfire/src/Font.py", line 233, in getGlyph
    coordinates = texture.add(s)
  File "/usr/local/share/fretsonfire/src/Texture.py", line 379, in add
    self.texture.loadSubsurface(surface, position = (x, y), alphaChannel = True)
  File "/usr/local/share/fretsonfire/src/Texture.py", line 282, in 
loadSubsurface
    string = pygame.image.tobytes(surface, "RGBA", True)
AttributeError: 'module' object has no attribute 'tobytes'


I tried the diff tb send off list and it has a patch for Font.py. With
it, the game would at least start. I think you have your luck to audit
everything and become the new upstream ;)

I don't really have an opinion on to where to mark it for radeon card.

Here's tb diff for the Font.py patch.

Index: Makefile
===================================================================
RCS file: /cvs/ports/games/fretsonfire/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- Makefile    29 Sep 2015 10:52:12 -0000      1.15
+++ Makefile    29 Aug 2018 00:40:22 -0000
@@ -1,6 +1,6 @@
 # $OpenBSD: Makefile,v 1.15 2015/09/29 10:52:12 sthen Exp $
 
-BROKEN = fails at runtime "python2.7 in free(): error: modified chunk-pointer 
0x..."
+#BROKEN = fails at runtime "python2.7 in free(): error: modified chunk-pointer 
0x..."
 
 V =                    1.3.110
 COMMENT =              guitar hero clone
Index: patches/patch-src_Font_py
===================================================================
RCS file: /cvs/ports/games/fretsonfire/patches/patch-src_Font_py,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_Font_py
--- patches/patch-src_Font_py   6 Apr 2014 21:10:25 -0000       1.1
+++ patches/patch-src_Font_py   29 Aug 2018 00:40:22 -0000
@@ -1,12 +1,26 @@
 $OpenBSD: patch-src_Font_py,v 1.1 2014/04/06 21:10:25 sthen Exp $
---- src/Font.py.orig   Sun Apr  6 18:28:33 2014
-+++ src/Font.py        Sun Apr  6 18:28:40 2014
-@@ -206,7 +206,7 @@ class Font:
+Index: src/Font.py
+--- src/Font.py.orig
++++ src/Font.py
+@@ -206,9 +206,9 @@ class Font:
  
        # Draw outlines
        """
 -      import Image, ImageFilter
+-      srcImg = Image.fromstring("RGBA", s.get_size(), 
pygame.image.tostring(s, "RGBA"))
+-      img    = Image.fromstring("RGBA", s.get_size(), 
pygame.image.tostring(s, "RGBA"))
 +      from PIL import Image, ImageFilter
-       srcImg = Image.fromstring("RGBA", s.get_size(), 
pygame.image.tostring(s, "RGBA"))
-       img    = Image.fromstring("RGBA", s.get_size(), 
pygame.image.tostring(s, "RGBA"))
++      srcImg = Image.fromstring("RGBA", s.get_size(), pygame.image.tobytes(s, 
"RGBA"))
++      img    = Image.fromstring("RGBA", s.get_size(), pygame.image.tobytes(s, 
"RGBA"))
        for y in xrange(img.size[1]):
+         for x in xrange(img.size[0]):
+           a = 0
+@@ -220,7 +220,7 @@ class Font:
+               n += 1
+           if a and srcImg.getpixel((x, y))[3] == 0:
+             img.putpixel((x, y), (0, 0, 0, a / n))
+-      s = pygame.image.fromstring(img.tostring(), s.get_size(), "RGBA")
++      s = pygame.image.fromstring(img.tobytes(), s.get_size(), "RGBA")
+       """
+ 
+       if not self.glyphTextures:
Index: patches/patch-src_Texture_py
===================================================================
RCS file: /cvs/ports/games/fretsonfire/patches/patch-src_Texture_py,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_Texture_py
--- patches/patch-src_Texture_py        6 Apr 2014 21:10:25 -0000       1.1
+++ patches/patch-src_Texture_py        29 Aug 2018 00:40:22 -0000
@@ -1,6 +1,7 @@
 $OpenBSD: patch-src_Texture_py,v 1.1 2014/04/06 21:10:25 sthen Exp $
---- src/Texture.py.orig        Sun Apr  6 18:28:33 2014
-+++ src/Texture.py     Sun Apr  6 18:29:48 2014
+Index: src/Texture.py
+--- src/Texture.py.orig
++++ src/Texture.py
 @@ -24,10 +24,10 @@ from __future__ import division
  
  import Log
@@ -14,3 +15,41 @@ $OpenBSD: patch-src_Texture_py,v 1.1 201
  from OpenGL.GL import *
  from OpenGL.GLU import *
  from Queue import Queue, Empty
+@@ -210,13 +210,13 @@ class Texture:
+     """Load the texture from a PIL image"""
+     image = image.transpose(Image.FLIP_TOP_BOTTOM)
+     if image.mode == "RGBA":
+-      string = image.tostring('raw', 'RGBA', 0, -1)
++      string = image.tobytes('raw', 'RGBA', 0, -1)
+       self.loadRaw(image.size, string, GL_RGBA, 4)
+     elif image.mode == "RGB":
+-      string = image.tostring('raw', 'RGB', 0, -1)
++      string = image.tobytes('raw', 'RGB', 0, -1)
+       self.loadRaw(image.size, string, GL_RGB, 3)
+     elif image.mode == "L":
+-      string = image.tostring('raw', 'L', 0, -1)
++      string = image.tobytes('raw', 'L', 0, -1)
+       self.loadRaw(image.size, string, GL_LUMINANCE, 1)
+     else:
+       raise TextureException("Unsupported image mode '%s'" % image.mode)
+@@ -254,16 +254,16 @@ class Texture:
+     if monochrome:
+       # pygame doesn't support monochrome, so the fastest way
+       # appears to be using PIL to do the conversion.
+-      string = pygame.image.tostring(surface, "RGB")
++      string = pygame.image.tobytes(surface, "RGB")
+       image = Image.fromstring("RGB", surface.get_size(), string).convert("L")
+-      string = image.tostring('raw', 'L', 0, -1)
++      string = image.tobytes('raw', 'L', 0, -1)
+       self.loadRaw(surface.get_size(), string, GL_LUMINANCE, GL_INTENSITY8)
+     else:
+       if alphaChannel:
+-        string = pygame.image.tostring(surface, "RGBA", True)
++        string = pygame.image.tobytes(surface, "RGBA", True)
+         self.loadRaw(surface.get_size(), string, GL_RGBA, 4)
+       else:
+-        string = pygame.image.tostring(surface, "RGB", True)
++        string = pygame.image.tobytes(surface, "RGB", True)
+         self.loadRaw(surface.get_size(), string, GL_RGB, 3)
+     self.size = (w / w2, h / h2)
+ 

Reply via email to