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 

disable buttons in XMB menu
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Tue Aug 04, 2009 11:10 pm    Post subject: Reply with quote

You're not calling the previous startmodulehandler in your code. You haven't assigned the previous function pointer when setting startmodulehandler.
Back to top
View user's profile Send private message
hyeokje



Joined: 04 Aug 2009
Posts: 3

PostPosted: Wed Aug 05, 2009 2:40 am    Post subject: Reply with quote

Torch wrote:
You're not calling the previous startmodulehandler in your code. You haven't assigned the previous function pointer when setting startmodulehandler.


Wow, you're very nice. Thank you very much Torch.

I got it ~!

Code:
previous = sctrlHENSetStartModuleHandler(OnModuleStart);
Back to top
View user's profile Send private message
zydeoN



Joined: 09 May 2009
Posts: 45

PostPosted: Sat Aug 08, 2009 10:27 am    Post subject: Reply with quote

Can you use the oldButtons (or paddata_old) method to avoid the psp executing the thread faster ? I can use it, but in this case of hooking it isnt working. I tried to use this (but it crashes and shutdown):

Code:
int vshReadButtons(SceCtrlData *pad_data, int count)
{
   int ret, intc;

   ret = vshCtrlReadBufferPositive(pad_data, count);
   if(ret <= 0)
   {
      return ret;
   }
   intc = pspSdkDisableInterrupts();

   
      if( pad_data[0].Buttons & PSP_CTRL_NOTE )
      {
         //my menu on/off
         if(a == 0) a = 1;
         else  a = 0;
      }
   while (pad_data[0].Buttons & PSP_CTRL_NOTE) vshCtrlReadBufferPositive(pad_data, count);

   //if my menu on block buttons
   if(a == 1) pad_data[0].Buttons = 0;
 
   pspSdkEnableInterrupts(intc);
   return ret;
}


Btw, i found that method on MDL Sample Kernel.
Back to top
View user's profile Send private message
hyeokje



Joined: 04 Aug 2009
Posts: 3

PostPosted: Sat Aug 08, 2009 1:45 pm    Post subject: Reply with quote

zydeoN wrote:
Can you use the oldButtons (or paddata_old) method to avoid the psp executing the thread faster ? I can use it, but in this case of hooking it isnt working. I tried to use this (but it crashes and shutdown):

Btw, i found that method on MDL Sample Kernel.

I think your problem is Note button presses repeatedly not slow thread.
This is a interrupt hooking method so it's fast enough.
Use above my post. That's fully working. See paddata_old.
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Sat Aug 08, 2009 1:57 pm    Post subject: Reply with quote

zydeoN wrote:
Can you use the oldButtons (or paddata_old) method to avoid the psp executing the thread faster ? I can use it, but in this case of hooking it isnt working. I tried to use this (but it crashes and shutdown):

Btw, i found that method on MDL Sample Kernel.


Why are you calling the original function twice???

AKAIK the correct method to hook the ctrl function is like this:

Code:
int vshCtrlReadBufferPositive_Patched(SceCtrlData *pad_data, int count)
{
   int ret,i,intc;
   
   ret = vshCtrlReadBufferPositive(pad_data, count);
   if(ret <= 0)
   {
      return ret;
   }

   intc = pspSdkDisableInterrupts();

   for(i = 0; i < count; i++)
   {
      if (pad_data[i].Buttons & PSP_CTRL_UP)
      {
         pad_data[i].Buttons = pad_data[i].Buttons ^ PSP_CTRL_UP; //modify your buttons here
      }
   }

   pspSdkEnableInterrupts(intc);

   return(ret);
}


You're supposed to loop though the pad_data array for the value of count. Though generally the value used is only 1, but you should hook safely.

For getting old buttons declare a static variable pad_dataold and store the current pad_data in it. Then in the next function call you can compare with the old buttons to see whats changed.
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
Goto page Previous  1, 2
Page 2 of 2

 
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