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 

How to hook sceGuFinish???

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



Joined: 21 Jul 2008
Posts: 34

PostPosted: Thu Aug 13, 2009 7:21 am    Post subject: How to hook sceGuFinish??? Reply with quote

After reading a lot about blitting on the XMB, I got that I have to hook sceGuFinish to do Gu things over the XMB, but No matter what I do, I can't get that function hooked.

I have two conclusion for my issue: the first one is that I'm using wrong module and library names (the NID for 5.00 was given by Silverspring in a post over this forum). The second conclusion is, if module and library names are correct, then maybe sceGuFinish is never call by the XMB.

This is the code I'm using to test if the function is being hooked:
Code:
#include <pspsdk.h>
#include <pspkernel.h>
#include <pspgu.h>
#include <systemctrl.h>
#include <stdio.h>
#include <string.h>

PSP_MODULE_INFO("test", 0x1000, 1, 0);

void myGuFinish()
   {
      int k1 = pspSdkSetK1(0);
      
      sceGuClearColor(GU_RGBA(255, 255, 255, 255));
      
      sceGuClear(GU_COLOR_BUFFER_BIT);
      
      pspSdkSetK1(k1);
      
      sceGuFinish();
   }

STMOD_HANDLER previous = NULL;
u32 orgaddr;

int OnModuleStart(SceModule2 *mod)
   {   
      if (strcmp(mod->modname, "scePaf_Module") == 0)
         {   
            orgaddr=sctrlHENFindFunction("scePaf_Module", "scePaf", 0x4170FB8F);
            sctrlHENPatchSyscall(orgaddr, myGuFinish);
   
            sceKernelDcacheWritebackAll();
            sceKernelIcacheClearAll();
         }
   
      if (!previous)
         return 0;
   
      return previous(mod);
   }

int module_start(SceSize args, void *argp)
{   
   previous = sctrlHENSetStartModuleHandler(OnModuleStart);
   
   return 0;
}


I'm hopping this code to clear the screen in white but nothing happens, no white screen, no errors, no crash, nothing.
_________________
"Libera eas de ore leonis, ne absorbeat eas tartarus, ne cadant in obscurum"
Back to top
View user's profile Send private message
crazyc



Joined: 17 Jun 2005
Posts: 410

PostPosted: Thu Aug 13, 2009 11:09 am    Post subject: Reply with quote

You can't because sceGuFinish is not a kernel function. It only places a finish command in the display list. Try hooking sceGeListUpdateStallAddr instead.
Back to top
View user's profile Send private message
ab5000



Joined: 06 May 2008
Posts: 74

PostPosted: Thu Aug 13, 2009 5:20 pm    Post subject: Reply with quote

yes, you can hook a user mode function, but not in that way. search "easy hook example user kernel" in this forum.
_________________
Code:
%:include<stdio.h>
int _(int __,int ___,int ____,int _____)
<%for(;____<___;_____=_____*__,____++);
return _____;%>main()<%printf
("%d\n",_(2,5,0,1));%>
Back to top
View user's profile Send private message
crazyc



Joined: 17 Jun 2005
Posts: 410

PostPosted: Fri Aug 14, 2009 12:59 am    Post subject: Reply with quote

ab5000 wrote:
yes, you can hook a user mode function, but not in that way. search "easy hook example user kernel" in this forum.
If he did want to override sceGuFinish, he could just change the order by linking his function before libgu, but that wouldn't enable him to do what he said he wanted.
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