This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

MW - Fix tetris demo


The tetris demo would often crash on startup, especially on 
PowerPC targets.  This is because the internal structure it 
used was filled with garbage...

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates
Index: services/gfx/mw/current/ChangeLog
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/services/gfx/mw/current/ChangeLog,v
retrieving revision 1.9
diff -u -5 -p -r1.9 ChangeLog
--- services/gfx/mw/current/ChangeLog	3 Sep 2003 12:32:00 -0000	1.9
+++ services/gfx/mw/current/ChangeLog	24 Oct 2003 18:15:14 -0000
@@ -1,5 +1,11 @@
+2003-10-24  Gary Thomas  <gary@mlbassoc.com>
+
+	* src/demos/nanox/ntetris.c (main): Start with a good known
+	state (by zeroing) - otherwise, the results are unpredictable
+	and often crash.
+
 2003-09-03  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/ecos/nanox_thread.c (nanox_thread): Fill in program
 	name - also from Eric Doenges.
 
Index: services/gfx/mw/current/src/demos/nanox/ntetris.c
===================================================================
RCS file: /misc/cvsfiles/ecos/packages/services/gfx/mw/current/src/demos/nanox/ntetris.c,v
retrieving revision 1.3
diff -u -5 -p -r1.3 ntetris.c
--- services/gfx/mw/current/src/demos/nanox/ntetris.c	2 Sep 2003 02:42:37 -0000	1.3
+++ services/gfx/mw/current/src/demos/nanox/ntetris.c	24 Oct 2003 18:08:20 -0000
@@ -428,11 +428,11 @@ static void block_reached_bottom(nstate 
 		if((LEVELS > (state->level + 1)) && (((state->level + 1) *
 					LEVEL_DIVISOR) <= state->score))
 			state->level++;
 		draw_score(state);
 		y++;
-		nr:
+        nr: ;
 	}
 
 	choose_new_shape(state);
 	draw_next_shape(state);
 }
@@ -698,11 +698,10 @@ static int random8(int limit)
 	return ret;
 }
 
 static void choose_new_shape(nstate *state)
 {
-    diag_printf("%s - state: %x\n", __FUNCTION__, state);
 	state->current_shape.type = state->next_shape.type;
 	state->current_shape.orientation = state->next_shape.orientation;
 	state->current_shape.colour = state->next_shape.colour;
 	state->current_shape.x = (WELL_WIDTH / 2) - 2;
 	state->current_shape.y = WELL_NOTVISIBLE -
@@ -973,11 +972,11 @@ static void main_game_loop(nstate *state
 
 int main(int argc, char *argv[])
 {
 	nstate *state = my_malloc(sizeof(nstate));
 
-        printf("state = %x\n", state);
+        bzero(state, sizeof(*state));
 	init_game(state);
 	main_game_loop(state);
 
 	write_hiscore(state);
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]