Previous 199869 Revisions Next

r35414 Thursday 22nd January, 2015 at 19:48:48 UTC by Couriersud
png2bdc.py: Converted to python 2.5 syntax. (nw)
[/branches/kale/src/build]png2bdc.py

branches/kale/src/build/png2bdc.py
r243925r243926
116116    CACHED_CHAR_SIZE = 12
117117    CACHED_HEADER_SIZE = 16
118118   
119    try:
119    #try:
120    if 0 == 0:
120121        fp.write('f')
121122        fp.write('o')
122123        fp.write('n')
123124        fp.write('t')
124        fp.write(bytearray([hash32 >> 24 & 0xff]))
125        fp.write(bytearray([hash32 >> 16 & 0xff]))
126        fp.write(bytearray([hash32 >> 8 & 0xff]))
127        fp.write(bytearray([hash32 >> 0 & 0xff]))
128        fp.write(bytearray([font.height >> 8 & 0xff]))
129        fp.write(bytearray([font.height >> 0 & 0xff]))
130        fp.write(bytearray([font.yOffs >> 8 & 0xff]))
131        fp.write(bytearray([font.yOffs >> 0 & 0xff]))
132        fp.write(bytearray([numChars >> 24 & 0xff]))
133        fp.write(bytearray([numChars >> 16 & 0xff]))
134        fp.write(bytearray([numChars >> 8 & 0xff]))
135        fp.write(bytearray([numChars >> 0 & 0xff]))
125        fp.write(chr(hash32 >> 24 & 0xff))
126        fp.write(chr(hash32 >> 16 & 0xff))
127        fp.write(chr(hash32 >> 8 & 0xff))
128        fp.write(chr(hash32 >> 0 & 0xff))
129        fp.write(chr(font.height >> 8 & 0xff))
130        fp.write(chr(font.height >> 0 & 0xff))
131        fp.write(chr(font.yOffs >> 8 & 0xff))
132        fp.write(chr(font.yOffs >> 0 & 0xff))
133        fp.write(chr(numChars >> 24 & 0xff))
134        fp.write(chr(numChars >> 16 & 0xff))
135        fp.write(chr(numChars >> 8 & 0xff))
136        fp.write(chr(numChars >> 0 & 0xff))
136137       
137138        # Write a blank table at first (?)
138139        charTable = [0]*(numChars * CACHED_CHAR_SIZE)
139        fp.write(bytearray(charTable))
140        for i in range(numChars * CACHED_CHAR_SIZE):
141            fp.write(chr(charTable[i]))
140142       
141143        # Loop over all characters
142144        tableIndex = 0
r243925r243926
171173                    dBuffer.append(accum)
172174               
173175                # Write the data
174                fp.write(bytearray(dBuffer))
176                for j in range(len(dBuffer)):
177                    fp.write(chr(dBuffer[j]))
175178           
176179            destIndex = tableIndex * CACHED_CHAR_SIZE
177180            charTable[destIndex +  0] = i >> 8 & 0xff
r243925r243926
190193   
191194        # Seek back to the beginning and rewrite the table
192195        fp.seek(CACHED_HEADER_SIZE, 0)
193        fp.write(bytearray(charTable))
196        for i in range(numChars * CACHED_CHAR_SIZE):
197            fp.write(chr(charTable[i]))
194198   
195199        fp.close()
196200        return 0
197201
198    except:
202    #except:
199203        return 1
200204   
201205


Previous 199869 Revisions Next


© 1997-2024 The MAME Team