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!

help..

This is a discussion on help.. within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; help when i compile it works but when i launch it on my psp it just shows a black screen ...

Reply
 
LinkBack Thread Tools
Old 10-04-2006, 04:45 PM   #1
likes kittens....awww....
 
Join Date: Sep 2006
Real First Name: Erik
Location: Detroit
Just Played: Call of Duty:World at War
Posts: 628
Trader Feedback: 0
Default help..

help when i compile it works but when i launch it on my psp it just shows a black screen
heres the code
Code:
#include <pspkernel.h>
#include <pspdebug.h>
#include <stdlib.h>
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("randomNumber", 0, 1, 1);

int exit_callback(int arg1, int arg2, void *common) {
          sceKernelExitGame();
          return 0;
}

int CallbackThread(SceSize args, void *argp) {
          int cbid;

          cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
          sceKernelRegisterExitCallback(cbid);

          sceKernelSleepThreadCB();

          return 0;
}

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(void)  {
          pspDebugScreenInit();
          SetupCallbacks();
        int randNumber;
          randNumber=rand()%100;
          sceKernelSleepThread();
          pspDebugScreenSetTextColor(0x00FFD800);
          pspDebugScreenPrintf("Generated Integer:%d",randNumber);
return 1;
}
psphacker12. is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2006, 05:03 PM   #2
 
M7thCC's Avatar
 
Join Date: Sep 2005
Posts: 2,223
Trader Feedback: 0
Default

I'm not too great at C but I'm pretty sure you need to have a loop in there to keep the info on the screen. Right now it's just printing the result to the screen and clearing it before you even have a chance to see it.

Something like this should be all you need:
Code:
while(1) {
pspDebugScreenClear();

//Code here.

}
Just put it right before the code you want to loop and it should continuously roll out new information to the screen. Be warned though that it will erase the screen every time the code loops, so while there will be information on the screen you probably won't be able to make out what it says since it'll be moving so fast.
M7thCC is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2006, 05:17 PM   #3
 
Twin891's Avatar
 
Join Date: Jul 2006
Location: Canada
Posts: 70
Trader Feedback: 0
Default

put the sceKernelSleepThread(); line after you print your text.....and you don't need a new thread for EVERY single question you have....
Twin891 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2006, 05:51 PM   #4

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

You've made two threads asking for help. This is why we have the C and Lua Programming help threads. Which happen to be a few posts below this. Use those next time.
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2006, 05:55 PM   #5

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

Mods, please warn him or something, he doesnt get special treatment just for having a C problem thats a simple fix. Making a new thread for EVERY little problem is reidiculous...

Anyway, your problem is your not paying attention to what your doing. sceKernelSleepThread makes the current 'thread' fall 'asleep', so to speak. Think of it as a 'crash' but on purpose and can only be stopped by PSPLink (i believe). If you want to DEALY a thread, use sceKernelDelayThread(#);. Simple fix would be to move the sleep call to the very end, before your return statement which will print out the random number, then freeze for ever (unless PSPLink or hard reset).


P.S. Stop making threads! If everyone with a problem, small or large, made threads like this, this thread would be nothing but problems, problems and problems. Sure, some answers, but why repeat yourself 20 times?
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2006, 07:35 PM   #6

Developer
 
Join Date: Mar 2006
Posts: 1,026
Trader Feedback: 0
Default

Quote:
Originally Posted by SG57
sceKernelSleepThread makes the current 'thread' fall 'asleep', so to speak. Think of it as a 'crash' but on purpose and can only be stopped by PSPLink (i believe).
That's incorrect.

sceKernelSleepThread does exactly what it says, it sleeps that thread.

The callback thread for the home button will still function.
__________________

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197

Quote:
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
Insert_Witty_Name is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-04-2006, 08:03 PM   #7

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

I stand corrected... But I never use the callbacks anymore... Well, actually, the base code for PSPGL has it built in pspsetup.c, so I suppose I do.
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

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 08:51 PM.



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