 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
JesusXP
Joined: 17 Jan 2006 Posts: 80 Location: Ontario, Canada
|
Posted: Fri Feb 24, 2006 6:25 am Post subject: Compiles, but shuts down when booted.. |
|
|
Hey guys,
My new prog im workin on, is basically just blending a few of the Yeldarb tut's, the Sprite, and MP3 . I boot it up, and after loading it just powers the PSP off.
| Code: |
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include <psppower.h>
#include <pspdisplay.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"
#include "mp3player.h"
#define printf pspDebugScreenPrintf
#define MAX(X,Y) ((X)>(Y)?(X):(Y))
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common){
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp){
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its threat id */
int SetupCallbacks(void){
int thid;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0){
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
int main(){
// Set the power frequency
scePowerSetClockFrequency(333, 333, 166);
SceCtrlData pad;
char hero_buffer[200];
/* char enemy_buffer[200]; */
Image* ourHero;
/* Image* ourEnemy; */
SetupCallbacks();
pspDebugScreenInit();
initGraphics();
pspAudioInit();
MP3_Init(1);
MP3_Load("Camron, Jim Jones - I Am Dame Dash.mp3");
MP3_Play();
sprintf(hero_buffer, "character.png");
ourHero = loadImage(hero_buffer);
/* sprintf(enemy_buffer, "enemyDude.png");
ourEnemy = loadImage(enemy_buffer); */
if(!ourHero){
//Image load failed
printf("Image load failed!\n");
}/*else if(!ourEnemy){
//Image load failed
printf("Image load failed!\n");
}*/else{
int hero_x = 0/*, enemy_x = 150*/;
int hero_y = 0/*, enemy_y = 0*/;
sceDisplayWaitVblankStart();
while(1){
clearScreen(0);
blitAlphaImageToScreen(0, 0, 32, 32, ourHero, hero_x, hero_y);
/* blitAlphaImageToScreen(0, 0, 32, 32, ourEnemy, enemy_x, enemy_y); */
sceCtrlReadBufferPositive(&pad, 1);
//meDude controls
if(pad.Buttons & PSP_CTRL_LEFT){
if(hero_x>0){hero_x--;}
}
if(pad.Buttons & PSP_CTRL_RIGHT){
if(hero_x<(480-32)){hero_x++;}
}
if(pad.Buttons & PSP_CTRL_UP){
if(hero_y>0){hero_y--;}
}
if(pad.Buttons & PSP_CTRL_DOWN){
if(hero_y<(272-32)){hero_y++;}
}
/* Enemy Controls
if(pad.Buttons & PSP_CTRL_SQUARE){
if(enemy_x>0){enemy_x--;}
}
if(pad.Buttons & PSP_CTRL_CIRCLE){
if(enemy_x<(480-32)){enemy_x++;}
}
if(pad.Buttons & PSP_CTRL_TRIANGLE){
if(enemy_y>0){enemy_y--;}
}
if(pad.Buttons & PSP_CTRL_CROSS){
if(enemy_y<(272-32)){enemy_y++;}
} */
//if the MP3 finishes, stop it.
if(MP3_EndOfStream() == 1){
MP3_Stop();
}
sceDisplayWaitVblank();
flipScreen();
}
}
/* Stop MP3 & Free Memory */
MP3_Stop();
MP3_FreeTune();
sceKernelSleepThread();
return 0;
}
|
Makefile:
| Code: |
TARGET = gamebeta
OBJS = mp3player.o graphics.o framebuffer.o game.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LIBS = -lpspgu -lpng -lz -lm -lmad -lpspaudiolib -lpspaudio -lpsppower
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = MP3 Player Example
PSPSDK=/usr/local/pspdev/psp/sdk
include $(PSPSDK)/lib/build.mak
|
any tips |
|
| Back to top |
|
 |
seventoes
Joined: 02 Oct 2005 Posts: 79
|
Posted: Fri Feb 24, 2006 9:30 am Post subject: |
|
|
| Are you sure the MP3 file is in your game directory on your psp? If it is, try removing spaces, im not sure if that is the problem but i dont see anything else. |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Fri Feb 24, 2006 9:34 am Post subject: |
|
|
where is your PSP_MODULE_INFO? _________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
JesusXP
Joined: 17 Jan 2006 Posts: 80 Location: Ontario, Canada
|
Posted: Fri Feb 24, 2006 9:49 am Post subject: |
|
|
| thanks dot_blank, I completely missed that :P sorry for the mistake |
|
| 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
|