forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

problem (newbee)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
egorive



Joined: 22 Jun 2006
Posts: 24

PostPosted: Mon Jun 26, 2006 2:05 am    Post subject: problem (newbee) Reply with quote

Hi. I’ve done a very very small change in the example program of lesson 3 of Yeldarb but it doesn’t work (the original works fine ) if someone helps me I'll be very grateful ;) :

ERROR:

$ make
Psp-gcc –I. –I/usr/local/pspdev/psp/sdk/include –O2 –G0 –wall -c –o main.o main.c
Main.c: In function ´main´:
Main.c:59: warning: passing argument 1 of ´sceHprmPeekCurrentKey´from incompatible pointer type
main.c:60: warning: comparison between pointer and integer
main.c:61: error: ´brake´undeclared (first use in this function)
main.c:61: error: (Each undeclared identifier is reported only once
main.c:61: error: for each fonction it appears in.)
make:***[main.o] Error 1

Makefile:

TARGET = lprg
OBJS = main.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = lprg
PSPSDK=$(shell psp-config --pspsdk-path)

include $(PSPSDK)/lib/build.mak



Source code with change in (include hprm button):

//Hola mundo mi primera aplicación PSP
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <psphprm.h>

PSP_MODULE_INFO("Hola Mundo", 0, 1, 1);

#define printf pspDebugScreenPrintf

/* Llamada de salida */

int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame(); return 0;
}

/* Llamada thread */

int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();


return 0;
}

/* Configura llamada thread y vuelve a su thread id */

int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}


int main() {
pspDebugScreenInit();
SetupCallbacks();

//codigo nuevo
int counter = 0;
int i = 0; SceCtrlData pad;

printf("Pulsa [X] para iniciar el contador");

while(1) {

//******************************************************aquí empieza el codigo añadido.
if(sceHprmIsRemoteExist() ){ //miro que estan conectados
u32* key;
int err;
err = sceHprmPeekCurrentKey(&key);
if(key == PSP_HPRM_PLAYPAUSE){ //si se ha pulsado el play salte del while.
brake;
}
}
//******************************************************aquí termina el código añadido.
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS) {
break;
}
}

while(1) {
sceCtrlReadBufferPositive(&pad, 1);

if(pad.Buttons & PSP_CTRL_CIRCLE) {
break;
}

pspDebugScreenClear ();

printf("Pulsa [O] para parar el contador\n");
printf("Contador: %i", counter);

counter++;

for(i=0; i<5; i++) {
sceDisplayWaitVblankStart(); //esperar a que la pantalla haya sido actualizada 5 veces para evitar desincronización.
}
}

pspDebugScreenClear();
printf("Contador finalizado.");
printf("Resultado final: %i", counter);

sceKernelSleepThread();
return 0;
}
Back to top
View user's profile Send private message
Warren



Joined: 24 Jan 2004
Posts: 173
Location: San Diego, CA

PostPosted: Mon Jun 26, 2006 3:08 am    Post subject: Reply with quote

you have 'brake' instead of 'break'
Back to top
View user's profile Send private message
egorive



Joined: 22 Jun 2006
Posts: 24

PostPosted: Mon Jun 26, 2006 3:20 am    Post subject: Reply with quote

sorry I've repear it but stil 1 error.

main.c : in function 'main':
main.c:59: wrning:passing argument 1 of 'sceHprmPeekCurrentKey' from incompatible pointer type
main.c: wrning comparison between pointer and integer
psp-gcc...
main.c: in function 'main':
main.c: (.text+0xfc): undefined reference to 'sceHprmIsRemoteExist'
main.c: (.text+0x10c): undefined reference to 'sceHprmPeekCurrentKey'
collect: Id returned 1 exist status
Back to top
View user's profile Send private message
Percival



Joined: 26 Jun 2006
Posts: 1

PostPosted: Mon Jun 26, 2006 4:22 am    Post subject: Reply with quote

Add -lpsphprm_driver to your makefile.
Back to top
View user's profile Send private message
egorive



Joined: 22 Jun 2006
Posts: 24

PostPosted: Mon Jun 26, 2006 5:23 am    Post subject: Reply with quote

I have put it like this but I dont know if it is there where I must put it:

TARGET = lprg
OBJS = main.o
CFLAGS = -O2 -G0 -Wall -lpsphprm_driver
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = lprg
PSPSDK=$(shell psp-config --pspsdk-path)

include $(PSPSDK)/lib/build.mak

even so...I still have this error:

...undefined reference to: 'sceHprmIsRemoteExist'
...undefined reference to: 'sceHprmPeekCurrentKey'

Sorry for been soy silly XD and tedious ...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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