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 

Compiles, but shuts down when booted..

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



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Fri Feb 24, 2006 6:25 am    Post subject: Compiles, but shuts down when booted.. Reply with quote

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
View user's profile Send private message MSN Messenger
seventoes



Joined: 02 Oct 2005
Posts: 79

PostPosted: Fri Feb 24, 2006 9:30 am    Post subject: Reply with quote

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
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Fri Feb 24, 2006 9:34 am    Post subject: Reply with quote

where is your PSP_MODULE_INFO?
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
JesusXP



Joined: 17 Jan 2006
Posts: 80
Location: Ontario, Canada

PostPosted: Fri Feb 24, 2006 9:49 am    Post subject: Reply with quote

thanks dot_blank, I completely missed that :P sorry for the mistake
Back to top
View user's profile Send private message MSN Messenger
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