changeset 64:07bc996c8e49

fix t_dandy on ps3.
author koba <koba@cr.ie.u-ryukyu.ac.jp>
date Fri, 11 Feb 2011 18:20:30 +0900
parents 3c2fc35a6b55
children b97628fca317
files Character.c Makefile Makefile.def Makefile.ps3 state_task.cc
diffstat 5 files changed, 19 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/Character.c	Wed Feb 09 00:52:27 2011 +0900
+++ b/Character.c	Fri Feb 11 18:20:30 2011 +0900
@@ -18,12 +18,14 @@
 #include "debug_db.h"
 #include "Func.h"
 #include "StateList.h"
+#include "TaskManager.h"
 
 #define CHARACTER_MAX_POOL_SIZE 2048
 
 CHARACTER *active_chara_list;
 CHARACTER *free_chara_list;
 
+extern TaskManager* tmanager;
 extern DebugDB dtable[DEFOBJ];
 
 const table enemystate[] = ENEMY_STATUS_TABLE;
@@ -53,7 +55,7 @@
   
   for(i = 0; i<num ; i++)
     {
-      q[i] = (CHARACTER*)malloc(sizeof(CHARACTER));
+      q[i] = (CHARACTER*)tmanager->allocate(sizeof(CHARACTER));
       q[i]->f = FALSE;
       q[i]->state = noaction;
       q[i]->dt1 = 0;
@@ -70,7 +72,7 @@
     }
   
   q[num-1]->next = NULL;
-  active_chara_list = (CHARACTER*)malloc(sizeof(CHARACTER));
+  active_chara_list = (CHARACTER*)tmanager->allocate(sizeof(CHARACTER));
   active_chara_list->f = FALSE;
   active_chara_list->state = noaction;
   active_chara_list->collision = noaction;
--- a/Makefile	Wed Feb 09 00:52:27 2011 +0900
+++ b/Makefile	Fri Feb 11 18:20:30 2011 +0900
@@ -13,7 +13,7 @@
 	@$(MAKE) -f Makefile.mac t_dandy
 
 cell:
-	@$(MAKE) -f Makefile.ps3 t_dandy
+	@$(MAKE) -f Makefile.ps3
 
 clean:
 	@$(MAKE) -f Makefile.mac clean
--- a/Makefile.def	Wed Feb 09 00:52:27 2011 +0900
+++ b/Makefile.def	Fri Feb 11 18:20:30 2011 +0900
@@ -7,7 +7,7 @@
 ABIBIT = 32
 ABI = -m$(ABIBIT)
 CC      = g++
-OPT = -g
+OPT = -O9
 CFLAGS  =  -Wall $(OPT) $(ABI)
 
 
--- a/Makefile.ps3	Wed Feb 09 00:52:27 2011 +0900
+++ b/Makefile.ps3	Fri Feb 11 18:20:30 2011 +0900
@@ -13,7 +13,7 @@
 TASK_SRCS = $(filter-out $(TASK_SRCS_EXCLUDE),$(TASK_SRCS_TMP))
 TASK_OBJS = $(TASK_SRCS:.cc=.o)
 
-TARGET = dandy spe-main
+TARGET = t_dandy spe-main
 OBJS    =   StateList.o Cheat.o Character.o Bom.o tokuten.o count2.o schedule3.o tama2.o syokika.o Ss.o sound.o  profile.o debug.o trace.o LoadSprite.o xml.o b64_de.o tree_controll.o object.o sys.o #collision.o state_task.o
 
 all: $(TARGET)
@@ -39,8 +39,6 @@
 dandy: $(OBJS) Dandy.o collision.o  Character_state.o
 	$(CC) $(ABI) -o $@ $? $(LIBS)
 
-cell-dandy: t_dandy spe-main
-
 t_dandy: $(OBJS) $(TASK_OBJS) TaskDandy.o collision_task.o state_task.o 
 	 $(CC) $(ABI) -o $@ $? $(LIBS)
 
--- a/state_task.cc	Wed Feb 09 00:52:27 2011 +0900
+++ b/state_task.cc	Fri Feb 11 18:20:30 2011 +0900
@@ -94,8 +94,8 @@
 printState(SchedTask *s, void *chara, void *arg)
 {
     CHARACTER *p = (CHARACTER*)chara;
-    printf("[COORD]x= %f  y= %f  vx= %f  vy= %f\n",
-	   p->x, p->y, p->vx, p->vy);
+    printf("[ID]%d [COORD]x= %f  y= %f  vx= %f  vy= %f\n",
+	   p->chara_id, p->x, p->y, p->vx, p->vy);
 
     state_check(p);
 }
@@ -198,17 +198,22 @@
 {
     int task_num = p->state_task;
     HTaskPtr state_task = tmanager->create_task(task_num);
+
+    uint32 rand1 = random();
+    uint32 rand2 = random();
+    uint32 rand3 = random();
+    uint32 rand4 = random();
     
-    state_task->set_param(0, (memaddr)random());
-    state_task->set_param(1, (memaddr)random());
-    state_task->set_param(2, (memaddr)random());
-    state_task->set_param(3, (memaddr)random());
+    state_task->set_param(0, (memaddr)rand1);
+    state_task->set_param(1, (memaddr)rand2);
+    state_task->set_param(2, (memaddr)rand3);
+    state_task->set_param(3, (memaddr)rand4);
 
     state_task->set_inData(0, p, sizeof(CHARACTER));
 
     state_task->set_outData(0, p, sizeof(CHARACTER));
 
-    state_task->set_post(printState, (void*)p, NULL);
+    state_task->set_post(updateState, (void*)p, NULL);
 
 #ifndef PPE_ONLY
     state_task->set_cpu(get_cpunum());