QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

whats going wrong here...

This is a discussion on whats going wrong here... within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; ok, so im working my way thought the psp-programming.com tutorials, and trying to write a program.... and so... this is ...

Reply
 
LinkBack Thread Tools
Old 08-07-2007, 06:17 PM   #1
 
Join Date: Oct 2006
Posts: 18
Trader Feedback: 0
Default whats going wrong here...

ok, so im working my way thought the psp-programming.com tutorials, and trying to write a program.... and so... this is what my program is supposed to do....
start up
display a picture
write a greeting on the picture
stay up for 5 sec or so...
and close

exsept... what its doing is
all of the above but this time the program stops about 1 or 2 sec after startup.... ok, it almost made it to 1sec (just timed it, came in at .92 sec on my watch)
and yea, i have tryed playing with all of the varibles for time... its seen its way up to 10000(0?) even... no effect....
and now your asking yourselves... whats the code look like allrety....
so here it comes
Code:
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"
PSP_MODULE_INFO("Frogless Toad", 0, 1, 1);
#define printf pspDebugScreenPrintf
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
/* 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;
}

int main() {
pspDebugScreenInit();
SetupCallbacks();
initGraphics();
char buffer[200];
char text[100];
char text2[100];
Image* ourImage;
//main body
sprintf(buffer, "wallpaper.png");
ourImage = loadImage(buffer);
          if (!ourImage) {
                    //Image load failed
                    printf("Image load failed!\n");
          } else {
                    sceDisplayWaitVblankStart();
                    blitAlphaImageToScreen(0 ,0 ,480 , 272, ourImage, 0, 0);
}
Color text1 = RGB(0,0,0);
sprintf(text, "Hello User...");
printTextScreen(230,20,text,text1);
flipScreen();
int count = 0;
while (1){
if (count >= 5000) {
break;
}
count++;
}
sceKernelExitGame();
//done
sceKernelSleepThread();
return 0;
}
so... if anyone has any ideas... im open to sudgestions.... (and if you need the file thats the picture... il send you it)
epl696 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Best prices available for:
Price Range:
$13.00 - $25.00
at 10 Stores

Price Range:
$17.00 - $48.00
at 10 Stores

Old 08-07-2007, 07:15 PM   #2
 
3vi1's Avatar
 
Join Date: May 2007
Posts: 81
Trader Feedback: 0
Default

At first glance: You seemed to have confused going through a loop with delaying for 1 ms. That loop will not take 5 seconds, and will not even complete in the same timeframe if your PSP is over/underclocked. That is, if the loop even ends up in the compiled code at all because it might just be optimized out during compilation into a simple count=5000.

You need to use an actual timer function. If you just want to quick and dirty make sure it actually causes a noticable delay, throw a wait for vblank into the middle of your loop.

If you want to ignore the delay portion altogether, move the SleepThread up before the ExitGame. The SleepThread's doing nothing now because of it's position behind the ExitGame. That should cause it to at least leave your image or the error on the screen until you press 'home'.

One more thing - you probably want to add "disableGraphics(); pspDebugScreenInit();" right before the portion where you print your errormessage about the image failing to load, and get rid of the earlier pspDebugScreenInit(). I don't think you can use the debugging printf's while you're in graphics mode.

Last edited by 3vi1; 08-07-2007 at 07:35 PM..
3vi1 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2007, 07:43 PM   #3
 
Join Date: Oct 2006
Posts: 18
Trader Feedback: 0
Default

ok, so i tossed some data in the loop.... nothing happend
Code:
data = data * data - 2 + 3;
epl696 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 08-08-2007, 07:48 PM   #4
QJ Gamer Green
 
wrcsti's Avatar
 
Join Date: Oct 2006
Location: under the big rock
Posts: 485
Trader Feedback: 0
Default

i think it was something like vb blank start and something else which i dont recall atm, i did make something just like this as my first solo C project. erased it on a system restore tho and no main.c or makefile or eboot saved for that specific thing, im so stupid
__________________
PSN ID= elmataplata
add me...
[b]RIP Colin McRae, We'll never forget you! 555 [/b]
wrcsti is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
wrong

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 10:17 PM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2010, QJ.NET. All Rights Reserved.
Contact Us | Free Flash Games