forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

prxutility++ and nkThreadSuspend (sceKernelGetThreadId ());

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
pspflashsystem



Joined: 24 Mar 2008
Posts: 31

PostPosted: Mon Sep 01, 2008 4:46 am    Post subject: prxutility++ and nkThreadSuspend (sceKernelGetThreadId ()); Reply with quote

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:
    while(1)
   {    
      
      if(menubattery && affichage)
      {   
          blit2_string(2, 9, " prxutility++ version 4.0 by pspflashsystem",0x111fff,0x000000);
         blit2_string(2, 11, " Battery Information:",0x111fff,0x000000);
         blit2_string(2, 23, " Other Information:",0x111fff,0x000000);
         blit_string(2,27,pinfo,0x000000,0x111fff);
            blit_string(2,12,pinfo1,0x000000,0x111fff);
            blit_string(2,13,pinfo2,0x000000,0x111fff);         
         blit_string(2,14,pinfo3,0x000000,0x111fff);
            blit_string(2,15,pinfo4,0x000000,0x111fff);
         blit_string(2,18,pinfo5,0x000000,0x111fff);
         blit_string(2,19,pinfo6,0x000000,0x111fff);
         blit_string(2,20,pinfo7,0x000000,0x111fff);
         blit_string(2,24,pinfo9,0x000000,0x111fff);
         blit_string(2,25,pinfo8,0x000000,0x111fff);
         blit_string(2,28,pinfo12,0x000000,0x111fff);
         blit_string(2,26,pinfo13,0x000000,0x111fff);
         blit2_string(2, 31, "NOTE + Volume Down to hide this menu",0x111fff,0x000000);
         blit2_string(2, 32, "Visit my website: http://www.pspgen.com/~pspflashsystem/",0x111fff,0x000000);      
          nkThreadSuspend(sceKernelGetThreadId());
      }


And here the main thread


Code:
if(pad.Buttons & PSP_CTRL_LTRIGGER)
{
info = 1;
affichage = 1;
sprintf(pinfo12, " Motherboard Model: 0x%02X", Serial[30]);
if(Serial[30]==0x01)
{
sprintf(pinfo12, " Motherboard Model: 0x%02X --> TA-079/TA-081", Serial[30]);
}
if(Serial[30]==0x02)
{
sprintf(pinfo12, " Motherboard Model: 0x%02X --> TA-082/TA-086", Serial[30]);
}
if(Serial[30]==0x03)
{
sprintf(pinfo12, " Motherboard Model: 0x%02X --> TA-85", Serial[30]);
}   
}
if(info) {
if(pad.Buttons & PSP_CTRL_RTRIGGER) affichage = 0, menubattery=0, nkThreadResume(sceKernelGetThreadId());
}


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::.
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Mon Sep 01, 2008 5:04 am    Post subject: Reply with quote

Don't use suspend thread for the current thread. Use sceKernelSleepThread.
Back to top
View user's profile Send private message
pspflashsystem



Joined: 24 Mar 2008
Posts: 31

PostPosted: Mon Sep 01, 2008 5:22 am    Post subject: Reply with quote

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::.
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Mon Sep 01, 2008 6:16 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
pspflashsystem



Joined: 24 Mar 2008
Posts: 31

PostPosted: Mon Sep 01, 2008 10:21 pm    Post subject: Reply with quote

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

.::pspflashsystem::.
Back to top
View user's profile Send private message
Allelujah



Joined: 16 Jul 2008
Posts: 10

PostPosted: Tue Sep 02, 2008 5:16 pm    Post subject: Reply with quote

@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 :)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group