1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-22 07:19:21 +02:00

alpy: fix crash-bug in remove_counter(), remove workarounds in demo.py

This commit is contained in:
David Kühling 2012-04-01 23:56:58 +02:00
parent fe3094b009
commit d439fec5a1
2 changed files with 35 additions and 38 deletions

View File

@ -1,7 +1,16 @@
Index: Alpy-0.1.5/_alpymodule.c Index: Alpy-0.1.5/_alpymodule.c
=================================================================== ===================================================================
--- Alpy-0.1.5.orig/_alpymodule.c 2012-03-30 01:32:30.846018939 +0200 --- Alpy-0.1.5.orig/_alpymodule.c 2012-03-30 02:24:26.096706083 +0200
+++ Alpy-0.1.5/_alpymodule.c 2012-03-30 01:32:46.162091430 +0200 +++ Alpy-0.1.5/_alpymodule.c 2012-04-01 23:30:51.281818550 +0200
@@ -988,7 +988,7 @@
char* name;
int i;
- if(!PyArg_ParseTuple(args, "et", &name)) {
+ if(!PyArg_ParseTuple(args, "et", _utf8, &name)) {
return NULL;
}
@@ -1194,7 +1194,7 @@ @@ -1194,7 +1194,7 @@
break; break;
} }

View File

@ -1,7 +1,7 @@
Index: Alpy-0.1.5/examples/demo.py Index: Alpy-0.1.5/examples/demo.py
=================================================================== ===================================================================
--- Alpy-0.1.5.orig/examples/demo.py 2012-03-30 02:24:52.080821520 +0200 --- Alpy-0.1.5.orig/examples/demo.py 2012-04-01 23:29:57.989557335 +0200
+++ Alpy-0.1.5/examples/demo.py 2012-03-30 02:26:31.761264720 +0200 +++ Alpy-0.1.5/examples/demo.py 2012-04-01 23:45:58.686160740 +0200
@@ -13,7 +13,8 @@ @@ -13,7 +13,8 @@
MAX_SPEED = 32 MAX_SPEED = 32
@ -24,18 +24,16 @@ Index: Alpy-0.1.5/examples/demo.py
class Alien: class Alien:
bullet_exploded = 0 bullet_exploded = 0
def __init__(self, img): def __init__(self, img):
@@ -340,8 +343,8 @@ @@ -340,7 +343,7 @@
clear_keybuf() clear_keybuf()
set_palette(data[GAME_PAL].dat) set_palette(data[GAME_PAL].dat)
position_mouse(screen.w/2, screen.h/2) position_mouse(screen.w/2, screen.h/2)
- register_counter('game_time', speed = MSEC_TO_TIMER(6400/screen.w)) - register_counter('game_time', speed = MSEC_TO_TIMER(6400/screen.w))
- install_fps()
+ register_counter('game_time', speed = MSEC_TO_TIMER(50)) + register_counter('game_time', speed = MSEC_TO_TIMER(50))
+ #install_fps() install_fps()
counters.game_time = 0 counters.game_time = 0
esc = 0 esc = 0
#main game loop @@ -359,8 +362,8 @@
@@ -359,13 +362,14 @@
fade_out(5) fade_out(5)
sys.exit(0) sys.exit(0)
draw_screen() draw_screen()
@ -46,13 +44,7 @@ Index: Alpy-0.1.5/examples/demo.py
b.clear() b.clear()
b.textout(data[END_FONT].dat, "GAME OVER", 80, 50, 2, align='center') b.textout(data[END_FONT].dat, "GAME OVER", 80, 50, 2, align='center')
b.textout(data[END_FONT].dat, "SCORE: %d" % player.score, 80, 82, 2, align='center') b.textout(data[END_FONT].dat, "SCORE: %d" % player.score, 80, 82, 2, align='center')
clear_keybuf() @@ -388,7 +391,10 @@
c = 0
+ # todo: remove this counter once, remove_counter() works again
register_counter('scroll_count', MSEC_TO_TIMER(6000/screen.w))
counters.scroll_count = -160
while not keypressed():
@@ -388,7 +392,10 @@
h = screen.h / size h = screen.h / size
screen.clear() screen.clear()
@ -64,7 +56,7 @@ Index: Alpy-0.1.5/examples/demo.py
dest_width=w, dest_height=h) dest_width=w, dest_height=h)
@@ -400,11 +407,26 @@ @@ -400,11 +406,26 @@
set_palette(data[GAME_PAL].dat) set_palette(data[GAME_PAL].dat)
fade_out(fade_speed) fade_out(fade_speed)
@ -94,7 +86,7 @@ Index: Alpy-0.1.5/examples/demo.py
color = 0 color = 0
def title_screen(): def title_screen():
global color global color
@@ -445,25 +467,30 @@ @@ -445,25 +466,27 @@
if color > 3: color = 0 if color > 3: color = 0
screen.clear() screen.clear()
@ -114,11 +106,7 @@ Index: Alpy-0.1.5/examples/demo.py
+ t32.stretch_blit(screen, 0, 0, 320, 128, screen.w/2-c, + t32.stretch_blit(screen, 0, 0, 320, 128, screen.w/2-c,
screen.h/2-c*64/160-32, c*2, c*128/160) screen.h/2-c*64/160-32, c*2, c*128/160)
- remove_counter('scroll_count') remove_counter('scroll_count')
+ print >> sys.stderr, "remove_counter..."
+ # hmm, why does remove_counter crash?
+ # remove_counter('scroll_count')
+ print >> sys.stderr, "remove_counter done."
- t.blit(screen, screen.w/2-160, screen.h/2-96, width=320, height=128) - t.blit(screen, screen.w/2-160, screen.h/2-96, width=320, height=128)
- -
@ -131,7 +119,7 @@ Index: Alpy-0.1.5/examples/demo.py
text_bmp.clear() text_bmp.clear()
clear_keybuf() clear_keybuf()
@@ -473,7 +500,6 @@ @@ -473,7 +496,6 @@
buffer.blit() buffer.blit()
fade_out(5) fade_out(5)
@ -139,7 +127,7 @@ Index: Alpy-0.1.5/examples/demo.py
while keypressed(): while keypressed():
if readkey() & 0xff == 27: if readkey() & 0xff == 27:
return 0 return 0
@@ -496,18 +522,20 @@ @@ -496,18 +518,20 @@
allegro_init() allegro_init()
install_keyboard() install_keyboard()
install_timer() install_timer()
@ -163,7 +151,7 @@ Index: Alpy-0.1.5/examples/demo.py
except AlpyException, msg: except AlpyException, msg:
set_gfx_mode(GFX_TEXT, 0, 0) set_gfx_mode(GFX_TEXT, 0, 0)
allegro_message("Alpy `%s'. Allegro `%s'" % (msg, get_allegro_error())) allegro_message("Alpy `%s'. Allegro `%s'" % (msg, get_allegro_error()))
@@ -530,16 +558,18 @@ @@ -530,16 +554,18 @@
pass pass
fade_out(1) fade_out(1)
@ -187,8 +175,8 @@ Index: Alpy-0.1.5/examples/demo.py
Index: Alpy-0.1.5/examples/exbitmap.py Index: Alpy-0.1.5/examples/exbitmap.py
=================================================================== ===================================================================
--- Alpy-0.1.5.orig/examples/exbitmap.py 2012-03-30 02:24:52.356822747 +0200 --- Alpy-0.1.5.orig/examples/exbitmap.py 2012-04-01 23:29:58.481559747 +0200
+++ Alpy-0.1.5/examples/exbitmap.py 2012-03-30 02:25:09.140897332 +0200 +++ Alpy-0.1.5/examples/exbitmap.py 2012-04-01 23:31:13.897929383 +0200
@@ -6,7 +6,10 @@ @@ -6,7 +6,10 @@
import alpy, sys import alpy, sys
@ -212,8 +200,8 @@ Index: Alpy-0.1.5/examples/exbitmap.py
alpy.allegro_message("Unable to set any graphic mode. %s, %s." % (msg, alpy.allegro_message("Unable to set any graphic mode. %s, %s." % (msg,
Index: Alpy-0.1.5/examples/exblend.py Index: Alpy-0.1.5/examples/exblend.py
=================================================================== ===================================================================
--- Alpy-0.1.5.orig/examples/exblend.py 2012-03-30 02:24:52.432823085 +0200 --- Alpy-0.1.5.orig/examples/exblend.py 2012-04-01 23:29:57.953557157 +0200
+++ Alpy-0.1.5/examples/exblend.py 2012-03-30 02:25:09.160897422 +0200 +++ Alpy-0.1.5/examples/exblend.py 2012-04-01 23:31:13.925929521 +0200
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
if bpp > 0: if bpp > 0:
set_color_depth(bpp) set_color_depth(bpp)
@ -243,8 +231,8 @@ Index: Alpy-0.1.5/examples/exblend.py
set_color_conversion(COLORCONV_TOTAL) set_color_conversion(COLORCONV_TOTAL)
Index: Alpy-0.1.5/examples/excolmap.py Index: Alpy-0.1.5/examples/excolmap.py
=================================================================== ===================================================================
--- Alpy-0.1.5.orig/examples/excolmap.py 2012-03-30 02:24:52.500823387 +0200 --- Alpy-0.1.5.orig/examples/excolmap.py 2012-04-01 23:29:58.377559237 +0200
+++ Alpy-0.1.5/examples/excolmap.py 2012-03-30 02:25:09.172897476 +0200 +++ Alpy-0.1.5/examples/excolmap.py 2012-04-01 23:31:13.961929696 +0200
@@ -89,7 +89,7 @@ @@ -89,7 +89,7 @@
callback_func, 'blend') callback_func, 'blend')
@ -256,8 +244,8 @@ Index: Alpy-0.1.5/examples/excolmap.py
alpy.allegro_message('Unable to set any graphic mode. %s, %s' % (msg, alpy.allegro_message('Unable to set any graphic mode. %s, %s' % (msg,
Index: Alpy-0.1.5/examples/exdat.py Index: Alpy-0.1.5/examples/exdat.py
=================================================================== ===================================================================
--- Alpy-0.1.5.orig/examples/exdat.py 2012-03-30 02:24:52.648824045 +0200 --- Alpy-0.1.5.orig/examples/exdat.py 2012-04-01 23:29:57.921557001 +0200
+++ Alpy-0.1.5/examples/exdat.py 2012-03-30 02:25:09.200897599 +0200 +++ Alpy-0.1.5/examples/exdat.py 2012-04-01 23:31:13.989929835 +0200
@@ -13,9 +13,9 @@ @@ -13,9 +13,9 @@
install_sound() install_sound()
@ -272,8 +260,8 @@ Index: Alpy-0.1.5/examples/exdat.py
allegro_message('error: %s, %s' % (msg, get_allegro_error())) allegro_message('error: %s, %s' % (msg, get_allegro_error()))
Index: Alpy-0.1.5/examples/exfli.py Index: Alpy-0.1.5/examples/exfli.py
=================================================================== ===================================================================
--- Alpy-0.1.5.orig/examples/exfli.py 2012-03-30 02:24:52.840824898 +0200 --- Alpy-0.1.5.orig/examples/exfli.py 2012-04-01 23:29:58.341559061 +0200
+++ Alpy-0.1.5/examples/exfli.py 2012-03-30 02:25:09.236897760 +0200 +++ Alpy-0.1.5/examples/exfli.py 2012-04-01 23:31:14.025930011 +0200
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
try: try:
@ -285,8 +273,8 @@ Index: Alpy-0.1.5/examples/exfli.py
if keypressed(): break if keypressed(): break
Index: Alpy-0.1.5/examples/extimer.py Index: Alpy-0.1.5/examples/extimer.py
=================================================================== ===================================================================
--- Alpy-0.1.5.orig/examples/extimer.py 2012-03-30 02:24:53.816829234 +0200 --- Alpy-0.1.5.orig/examples/extimer.py 2012-04-01 23:29:58.197558355 +0200
+++ Alpy-0.1.5/examples/extimer.py 2012-03-30 02:25:09.344898239 +0200 +++ Alpy-0.1.5/examples/extimer.py 2012-04-01 23:31:14.061930188 +0200
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
install_timer() install_timer()