Forum    News    Downloads    Saved Games


Can anyone figure this out?

<<

Mailas

Post Thu Oct 12, 2006 4:31 pm

Can anyone figure this out?

  Code:
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspiofilemgr.h>
#include <pspgu.h>
#include <png.h>
#include <stdlib.h>
#include <string.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include <psppower.h>
#include <psprtc.h>
extern "C"
{
#include "graphics.h"
}
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))

PSP_MODULE_INFO("MailasProduct", 0, 1, 1);

/* 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 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;
}

//GLOBAL VARIABLES
int main(void) {
    SetupCallbacks();
    initGraphics();

    SceCtrlData pad, lastpad;

    sceCtrlReadBufferPositive(&lastpad, 1);
   
    int MegaX = 27;
    int MegaY = 136;
   
    int ProtoX = 427;
    int ProtoY = 136;
   
    Image* MegaImage;
MegaImage = loadImage("./Images/M_Plat.png");

    Image* ProtoImage;
ProtoImage = loadImage("./Images/P_Plat.png");

    Image* PelletImage;
PelletImage = loadImage("./Images/pellet.png");

Image * Background;
Background = loadImage("./Images/Back.png");

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

      if(pad.Buttons != lastpad.Buttons) { // 1
      lastpad = pad;
     

      if(pad.Buttons & PSP_CTRL_UP)
      {
       MegaY-=3;                     
      }
     
      if(pad.Buttons & PSP_CTRL_DOWN)
      {
       MegaY+=3;                     
      }
      } // 2
     
      blitAlphaImageToScreen(0, 0, 480, 272, Background, 0, 0);
      blitAlphaImageToScreen(0, 0, 33, 26, MegaImage, MegaX, MegaY);
      blitAlphaImageToScreen(0, 0, 24, 25, ProtoImage, ProtoX, ProtoY);
     
       sceDisplayWaitVblankStart();
flipScreen();
      }
      }


Its all down and my cygwin batch file is able to compile it and everything but it just doesnt want to show on my PSP screen, just shows it as black. Anyone know how to fix?
<<

.Vault

User avatar

Brew Guru
Brew Guru

Posts: 3693

Joined: September 02 2005

Location: NJ

Thanks given: 0

Thanks received: 2 times

Post Thu Oct 12, 2006 6:13 pm

looks like u are missing a psp boot up file...

and i really have no idea how to fix it..
<<

Mailas

Post Fri Oct 13, 2006 4:45 pm

I have no idea what you're talking about but I was able to compile it.

EDIT:

Ah got it I just had to press in return 0;, but now it just freezes, anyone here know what to do?
<<

crait

User avatar

Brewology Administrator
Brewology Administrator

Posts: 6488

Joined: August 11 2006

Location: Narnia!

Thanks given: 195 times

Thanks received: 52 times

Post Fri Oct 13, 2006 8:00 pm

i think the "sceDisplayWaitVblankStart();" may be in the wrong spot
hmm... also check out your make file...
you may want to put this lil peice of code in too
"pspDebugScreenClear();"

oh, and im going to copy some of that code because i couldn't figure out how to make an image become a variable... lol
<<

Mailas

Post Fri Oct 13, 2006 8:03 pm

Well to make it become a variable you save its X and Y position and let them blit to the screen.
And no the screDisplayWaitVBlankStart is in the right spot.
<<

crait

User avatar

Brewology Administrator
Brewology Administrator

Posts: 6488

Joined: August 11 2006

Location: Narnia!

Thanks given: 195 times

Thanks received: 52 times

Post Fri Oct 13, 2006 8:50 pm

all i needed was an example to go by
i was talking about this though
Image* MegaImage;
MegaImage = loadImage("./Images/M_Plat.png");

silly head

also, did you check the makefile
maybe you didnt include all the #include thingermajigers in the make file?
and try adding this at the end of your code
  Code:
pspDebugScreenClear();
<<

Mailas

Post Fri Oct 13, 2006 9:16 pm

Umm no the game runs fine I fixed it myself with the return0;
You don't need that if you're usng call backs.

And no theres nothing wrong with the makefile.
<<

crait

User avatar

Brewology Administrator
Brewology Administrator

Posts: 6488

Joined: August 11 2006

Location: Narnia!

Thanks given: 195 times

Thanks received: 52 times

Post Fri Oct 13, 2006 9:42 pm

ok
lol, its always good to dowble check

Return to PlayStation Portable

Who is online

Users browsing this forum: No registered users and 253 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for blacklist.org.