![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
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 ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#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
|
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;
}
|
|
|
|
|
|
#2 |
![]() |
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.
}
|
|
|
|
|
|
#4 |
![]() ![]() I'm Baaaack!
|
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.
__________________
|
|
|
|
|
|
#5 |
![]() ![]() ...in a dream...
|
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?
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#6 | ||
![]() ![]() Developer
|
Quote:
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:
|
||
|
|
|
|
|
#7 |
![]() ![]() ...in a dream...
|
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.
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
![]() |
| Thread Tools | |
|
|