 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
annerajb
Joined: 31 Mar 2005 Posts: 40
|
Posted: Fri May 13, 2005 7:20 am Post subject: help:having problem compiling modified simple turn demo |
|
|
hello i am having some problems compiling the simple turn demo. from a modified source code i am modifiying it to use the controller library by skippy911. but it give me an error because the files arent been build.
| Code: |
D:\controller\SIMPLETURN-PSP-050510\source>d:\ps2dev\ee\bin\ee-gcc -march=r4000
-g -mgp32 -mlong32 -c main.c
main.c: In function `rgb2col':
main.c(198) : parse error at end of input
D:\controller\SIMPLETURN-PSP-050510\source>d:\ps2dev\ee\bin\ee-gcc -march=r4000
-g -mgp32 -mlong32 -c pg.c
D:\controller\SIMPLETURN-PSP-050510\source>d:\ps2dev\ee\bin\ee-gcc -march=r4000
-g -mgp32 -c -xassembler -O -o startup.o startup.s
D:\controller\SIMPLETURN-PSP-050510\source>d:\ps2dev\ee\bin\ee-ld -O0 startup.o
main.o pg.o -M -Ttext 8900000 -q -o out 1>SimpleTurn.map
/cygdrive/d/ps2dev/ee/bin/ee-ld: cannot open main.o: No such file or directory
D:\controller\SIMPLETURN-PSP-050510\source>pause
Press any key to continue . . .
|
if somebody can help me i will really apreciate it.
[url]pspfreaks.broadphase.com/public_html/download/source.rar[/url] |
|
| Back to top |
|
 |
Warren
Joined: 24 Jan 2004 Posts: 173 Location: San Diego, CA
|
Posted: Fri May 13, 2005 7:43 am Post subject: |
|
|
| Erm you have an error in the rgb2col funtion in main.cpp? |
|
| Back to top |
|
 |
annerajb
Joined: 31 Mar 2005 Posts: 40
|
Posted: Fri May 13, 2005 8:00 am Post subject: |
|
|
in the link at the end is the code. i already know that i have an error there but i cannot find out was is wrong with it .btw my text editor says that the programs has 197 lines of code.
| Code: | #include "pg.h"
#include "controller.c"
#define SCOREFILE_PATH "fatms0:/PSP/GAME/SIMPLETURN/HIGHSCORE.DAT"
static int high_score;
unsigned short rgb2col(unsigned char r,unsigned char g,unsigned char b) {
return ((((b>>3) & 0x1F)<<10)+(((g>>3) & 0x1F)<<5)+(((r>>3) & 0x1F)<<0)+0x8000);
/*
}
void wait_button(void) {
ctrl_data_t ctl;
int btn;
//all of this is commented
btn=1;
while(btn!=0){
pgWaitV();
sceCtrlRead(&ctl,1);
btn = ((ctl.buttons & 0xF000) != 0);
}
btn=0;
while(btn==0){
pgWaitV();
sceCtrlRead(&ctl,1);
btn = ((ctl.buttons & 0xF000) != 0);
}
}// all of this is commented
*/
//Display score
void DisplayScore(int x,int y,int back_col,int col,int num) {
unsigned char str[4];
int px,py,n;
unsigned short *vr;
for(py=0;py<8;py++) {
vr = (unsigned short *)pgGetVramAddr(x*8,y*8+py);
for(px=0;px<24;px++) *vr++ = back_col;
}
n = (num / 100) % 10;
if (n==0) { str[0] = ' '; } else { str[0] = '0'+n; }
n = (num / 10) % 10;
if (n==0) { str[1] = ' '; } else { str[1] = '0'+n; }
str[2] = '0'+(num % 10);
str[3] = 0;
pgPrint(x,y,col,str);
}
// Hiscore
void ReadHighScore(void) {
int fd;
fd = sceIoOpen(SCOREFILE_PATH,O_RDWR);
if (fd>=0) {
sceIoRead(fd, (void *)&high_score, sizeof(int));
sceIoClose(fd);
} else {
pgFillvram(rgb2col(0,0,0));
pgPrint(0,0,rgb2col(255,0,0),"ERROR : CANNOT READ");
pgPrint(0,1,rgb2col(255,0,0),SCOREFILE_PATH);
wait_button();
pgFillvram(rgb2col(0,0,0));
}
}
void WriteHighScore(void) {
int fd;
fd = sceIoOpen(SCOREFILE_PATH,O_RDWR);
if (fd>=0) {
sceIoWrite(fd, (void *)&high_score, sizeof(int));
sceIoClose(fd);
}
}
// title
void Title(void) {
pgWaitV();
pgFillvram(rgb2col(0,0,0));
pgPrint(20,12,0xffff,"S i m p l e T u r n");
pgPrint(22,24,0xffff,"High Score : ");
DisplayScore(35,24,rgb2col(0,0,0),0xffff,high_score);
wait_button();
}
// game
void Game(void) {
int x,y,my_x,my_y,btn,flg,dir,score;
unsigned short *vr,*vr2,col;
int back_col;
ctrl_data_t ctl;
// ‰Šú‰»
my_x = 0;
my_y = 0;
dir = 0;
score = 0;
back_col = rgb2col(0,0,64);
// ƒQ[ƒ€ƒtƒB[ƒ‹ƒh•`‰æ
pgWaitV();
pgFillvram(back_col);
col = rgb2col(128,128,128);
for(y=0;y<8;y++) {
vr = (unsigned short *)pgGetVramAddr(0,y);
for(x=0;x<SCREEN_WIDTH;x++) *vr++ = col;
}
for(y=8;y<(SCREEN_HEIGHT-16);y++) {
vr = (unsigned short *)pgGetVramAddr(0,y);
vr2 = (unsigned short *)pgGetVramAddr(SCREEN_WIDTH-8,y);
for(x=0;x<8;x++) { *vr++ = col; *vr2++ = col; }
}
for(y=0;y<8;y++) {
vr = (unsigned short *)pgGetVramAddr(0,(SCREEN_HEIGHT-16)+y);
for(x=0;x<SCREEN_WIDTH;x++) *vr++ = col;
}
pgPrint(49,33,0xffff,"Score : ");
DisplayScore(57,33,back_col,0xffff,score);
//help here
sceCtrlRead(&ctl,1);
btn = ((ctl.buttons & 0xF000) != 0);
flg = btn;
// help her how do i point out the btn
while(1) {
// Ž©‹@•`‰æ
col = rgb2col(255,255,255);
for(y=0;y<8;y++) {
vr = (unsigned short *)pgGetVramAddr(my_x*8+8,my_y*8+8+y);
for(x=0;x<8;x++) *vr++ = col;
}
// ƒ{ƒ^ƒ“”»’è
sceCtrlRead(&ctl,1);//help here
btn = ((ctl.buttons & 0xF000) != 0);
if (btn) {
if (!flg) {
dir = (dir+1) % 4;
score++;
DisplayScore(57,33,back_col,0xffff,score);
}
flg = 1;
} else {
flg = 0;
}
// is
switch(dir) {
case 0: my_x++; break;
case 1: my_y++; break;
case 2: my_x--; break;
default: my_y--; break;
}
// Õ“Ë”»’è
vr = (unsigned short *)pgGetVramAddr(my_x*8+8,my_y*8+8);
if (*vr != back_col) break;
// VSync‘Ò‚¿
pgWaitV();
}
// ƒQ[ƒ€ƒI[ƒo[
pgWaitV();
pgPrint4(3,3,rgb2col(255,255,0),"GAME OVER");
if (high_score < score) {
pgPrint2(6,9,rgb2col(255,0,0),"--- HIGH SCORE! ---");
high_score = score;
WriteHighScore();
}
pgWaitVn(30);
pgPrint(23,21,rgb2col(255,255,0),"PRESS ANY KEY");
wait_button();
}
int xmain(void)
{
// Initialize
pgInit();
pgScreenFrame(1,0);
sceCtrlInit(0);
sceCtrlSetAnalogMode(0);
high_score = 0;
ReadHighScore();
while(1) {
Title();
Game();
}
return 0;
} |
|
|
| Back to top |
|
 |
skippy911
Joined: 06 May 2005 Posts: 46
|
Posted: Fri May 13, 2005 8:11 am Post subject: |
|
|
Your problem is you have part of a comment remaining:
unsigned short rgb2col(unsigned char r,unsigned char g,unsigned char b) {
return ((((b>>3) & 0x1F)<<10)+(((g>>3) & 0x1F)<<5)+(((r>>3) & 0x1F)<<0)+0x8000);
}
Make you code look like the above with the /* removed |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|