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;
}
problem (newbee)
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
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
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 ...
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 ...