prxutility++ and nkThreadSuspend (sceKernelGetThreadId ());

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

Moderators: cheriff, TyRaNiD

Post Reply
pspflashsystem
Posts: 31
Joined: Mon Mar 24, 2008 12:31 am

prxutility++ and nkThreadSuspend (sceKernelGetThreadId ());

Post by pspflashsystem »

Hi everybody :),
I would like to ask a question about nkThreadSuspend (sceKernelGetThreadId ());
When I press on LTRIGGER the battery menu is displayed and blocks the xmb but the problem is when I want to leave this menu by pressing on RTRIGGER this menu does not hide :< and the xmb is always blocked.

Here the "display" thread:

Code: Select all

    while&#40;1&#41; 
	&#123; 	
		
		if&#40;menubattery && affichage&#41;
		&#123;   
		    blit2_string&#40;2, 9, " prxutility++ version 4.0 by pspflashsystem",0x111fff,0x000000&#41;;
			blit2_string&#40;2, 11, " Battery Information&#58;",0x111fff,0x000000&#41;;
			blit2_string&#40;2, 23, " Other Information&#58;",0x111fff,0x000000&#41;;
			blit_string&#40;2,27,pinfo,0x000000,0x111fff&#41;;
            blit_string&#40;2,12,pinfo1,0x000000,0x111fff&#41;;
            blit_string&#40;2,13,pinfo2,0x000000,0x111fff&#41;;			
			blit_string&#40;2,14,pinfo3,0x000000,0x111fff&#41;;
            blit_string&#40;2,15,pinfo4,0x000000,0x111fff&#41;;
			blit_string&#40;2,18,pinfo5,0x000000,0x111fff&#41;;
			blit_string&#40;2,19,pinfo6,0x000000,0x111fff&#41;;
			blit_string&#40;2,20,pinfo7,0x000000,0x111fff&#41;;
			blit_string&#40;2,24,pinfo9,0x000000,0x111fff&#41;;
			blit_string&#40;2,25,pinfo8,0x000000,0x111fff&#41;;
			blit_string&#40;2,28,pinfo12,0x000000,0x111fff&#41;;
			blit_string&#40;2,26,pinfo13,0x000000,0x111fff&#41;;
			blit2_string&#40;2, 31, "NOTE + Volume Down to hide this menu",0x111fff,0x000000&#41;;
			blit2_string&#40;2, 32, "Visit my website&#58; http&#58;//www.pspgen.com/~pspflashsystem/",0x111fff,0x000000&#41;;		
		    nkThreadSuspend&#40;sceKernelGetThreadId&#40;&#41;&#41;;
		&#125;
And here the main thread

Code: Select all

if&#40;pad.Buttons & PSP_CTRL_LTRIGGER&#41;
&#123;
info = 1;
affichage = 1;
sprintf&#40;pinfo12, " Motherboard Model&#58; 0x%02X", Serial&#91;30&#93;&#41;;
if&#40;Serial&#91;30&#93;==0x01&#41;
&#123;
sprintf&#40;pinfo12, " Motherboard Model&#58; 0x%02X --> TA-079/TA-081", Serial&#91;30&#93;&#41;;
&#125;
if&#40;Serial&#91;30&#93;==0x02&#41;
&#123;
sprintf&#40;pinfo12, " Motherboard Model&#58; 0x%02X --> TA-082/TA-086", Serial&#91;30&#93;&#41;;
&#125;
if&#40;Serial&#91;30&#93;==0x03&#41;
&#123;
sprintf&#40;pinfo12, " Motherboard Model&#58; 0x%02X --> TA-85", Serial&#91;30&#93;&#41;;
&#125;	
&#125;
if&#40;info&#41; &#123;
if&#40;pad.Buttons & PSP_CTRL_RTRIGGER&#41; affichage = 0, menubattery=0, nkThreadResume&#40;sceKernelGetThreadId&#40;&#41;&#41;;
&#125;
Thanks to everyone who helped me

PS: I'm apologize for my bad english because I'm French :)
I'm apologize for my bad English because I am French :)

.::pspflashsystem::.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Don't use suspend thread for the current thread. Use sceKernelSleepThread.
pspflashsystem
Posts: 31
Joined: Mon Mar 24, 2008 12:31 am

Post by pspflashsystem »

Thanks moonlight but the display thread and the main thread are two different thread in my prx.
I don't use sceKernelSleepThread because with sceKernelSleepThread when I press on LTRIGGER the battery menu is displayed and hides after 1 second Oo and this menu doesn't block the xmb. But I want to do like Cross Extended 1.2 : Iwant to display the battery menu and block the xmb with nkThreadSuspend (sceKernelGetThreadId ()); and after I want to leave this menu by pressing on RTRRIGGER and resume with nkThreadResume(sceKernelGetThreadId());
I'm apologize for my bad English because I am French :)

.::pspflashsystem::.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

If nkSuspendThread is implemented using sceKernelSuspendThread, it will fail and return inmediatelly if you specify the current thread.
If you want to suspend a thread, you have to do that in other thread.
pspflashsystem
Posts: 31
Joined: Mon Mar 24, 2008 12:31 am

Post by pspflashsystem »

Ok many thanks again moonlight, I will try it :)
I'm apologize for my bad English because I am French :)

.::pspflashsystem::.
Allelujah
Posts: 10
Joined: Wed Jul 16, 2008 4:26 pm

Post by Allelujah »

@pspflashsystem:

I think you must first identify existing thread(s). this could be done with sceKernelGetThreadmanIdList(). Then you can now choose which thread to pause and resume using sceKernelSuspendThread() and sceKernelResumeThread().

If you intend to maintain your PRX's thread running, then just skip them as moonlight said.

Btw, why do you want to pause XMB's threads? just curious :)
Post Reply