Screen not resetting after HOME key exit

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
ggmoney
Posts: 4
Joined: Wed Oct 05, 2005 4:07 am

Screen not resetting after HOME key exit

Post by ggmoney »

i have this in as my main func and it works and i have the starned call backs that come with all the samples

and after i exit with the home key it does the "please wait" and then shows the black screen with "Simple test" flickering....

any one know whats up

Code: Select all

#include <pspkernel.h>
#include <pspdebug.h>
#include <stdlib.h>
#include <string.h>

#include "pg.h"
#include "bitmap.c"


PSP_MODULE_INFO&#40;"AA", 0x1000, 1, 1&#41;;
/* Define the main thread's attribute value &#40;optional&#41; */
PSP_MAIN_THREAD_ATTR&#40;0&#41;;

/* Define printf, just to make typing easier */
#define printf	pspDebugScreenPrintf

void delay_loop&#40;int num&#41; &#123;
	if &#40;num <= 0&#41; return;
	for &#40;; num > 0; num--&#41;
		sceDisplayWaitVblankStart&#40;&#41;;
&#125;
/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41;
&#123;
	sceKernelExitGame&#40;&#41;;
	return 0;
&#125;

/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41;
&#123;
	int cbid;

	cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
	sceKernelRegisterExitCallback&#40;cbid&#41;;

	sceKernelSleepThreadCB&#40;&#41;;

	return 0;
&#125;

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41;
&#123;
	int thid = 0;

	thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, THREAD_ATTR_USER, 0&#41;;
	if&#40;thid >= 0&#41;
	&#123;
		sceKernelStartThread&#40;thid, 0, 0&#41;;
	&#125;

	return thid;
&#125;


int main&#40;void&#41;
&#123;
	SetupCallbacks&#40;&#41;;
	pgInit&#40;&#41;;
	pgScreenFrame&#40;2,0&#41;;

	while&#40;1&#41;&#123;
		pgFillvram&#40;0&#41;;
		pgPrint&#40;0,1,0xffff,"Simple test"&#41;;
		pgScreenFlipV&#40;&#41;;
		pgWaitVn&#40;160&#41;;
	&#125;
	
	return 0;
&#125;
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

it is because you are running a kernel mode thread. As you seem not to be using kernel mode at all anyway change PSP_MODULE_INFO's 2nd parameter to 0 and it should work.
ggmoney
Posts: 4
Joined: Wed Oct 05, 2005 4:07 am

Post by ggmoney »

yea thats what it was thansk.
User avatar
Shazz
Posts: 244
Joined: Tue Aug 31, 2004 11:42 pm
Location: Somewhere over the rainbow
Contact:

Post by Shazz »

Tyranid,

Do you have any idea why when your main prog is running in kernel mode AND the CallbackThread too (needed if you want it to kill some kernel functions in the main) that the exit callback is really sent but the thread who registered it never receives it ?

Not a big deal, write your own exit manager but...just to understand where the callback dies....
- TiTAN Art Division -
http://www.titandemo.org
Post Reply