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 

[SOLVED] List of loaded prx?

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



Joined: 28 Apr 2006
Posts: 190

PostPosted: Tue Dec 18, 2007 9:06 pm    Post subject: [SOLVED] List of loaded prx? Reply with quote

Hi! :)

Is there a way to know which plugins (prx) are loaded?
I tried sceKernelGetModuleIdList but it dosent return my prx (only sceKernelLibrary and my app's module).

I'd like to get a list of loaded prx, then disable one and then enable it. Is it possible?

Many thanks.

Ciaooo
Sakya


Last edited by sakya on Thu Dec 20, 2007 6:22 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Tue Dec 18, 2007 10:05 pm    Post subject: Reply with quote

That function only returns the list of user mode modules.

Use sceKernelGetModuleList or sceKernelGetModuleListWithAlloc in kernel mode.
Back to top
View user's profile Send private message
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Wed Dec 19, 2007 1:18 am    Post subject: Reply with quote

Hi! :)
moonlight wrote:
Use sceKernelGetModuleList or sceKernelGetModuleListWithAlloc in kernel mode.

How stupid, I didn't try in kernel mode! :)
Many thanks for your help, I'll try later.

Ciaooo
Sakya
Back to top
View user's profile Send private message Visit poster's website
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Wed Dec 19, 2007 8:25 pm    Post subject: Reply with quote

Hi! :)

Sorry for the double post...

I tried using sceKernelGetModuleList in a kernel mode prx but it returns the same IDs returned by sceKernelGetModuleIdList in user mode.
I cannot find sceKernelGetModuleListWithAlloc in kernel > 2.7x

Any idea?
Many thanks. :)

Ciaooo
Sakya
Back to top
View user's profile Send private message Visit poster's website
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Wed Dec 19, 2007 9:01 pm    Post subject: Reply with quote

Well, you could do a sceKernelFindModuleByName("sceSystemMemoryManager"). It will return a ptr to a SceModule structure, which is a linked list, just follow it until NULL.

But be careful, the description of the SceModule structure in the pspsdk is wrong. (well not wrong, it is done for 1.00 only).

This is the correct struct for 1.50+

Code:

typedef struct SceModule2
{
  struct SceModule2  *next; // 0
  u16               attribute; // 4
  u8                version[2]; // 6
  char              modname[27]; // 8
  char              terminal; // 0x23
  char              mod_state;   // 0x24
  char              unk1;    // 0x25
  char              unk2[2]; // 0x26
  u32               unk3;   // 0x28
  SceUID            modid; // 0x2C
  u32               unk4; // 0x30
  SceUID            mem_id; // 0x34
  u32               mpid_text;   // 0x38
  u32               mpid_data; // 0x3C
  void *            ent_top; // 0x40
  unsigned int      ent_size; // 0x44
  void *            stub_top; // 0x48
  u32               stub_size; // 0x4C
  u32               entry_addr_; // 0x50
  u32               unk5[4]; // 0x54
  u32               entry_addr; // 0x64
  u32               gp_value; // 0x68
  u32               text_addr; // 0x6C
  u32               text_size; // 0x70
  u32               data_size;   // 0x74
  u32               bss_size; // 0x78
  u32               nsegment; // 0x7C
  u32               segmentaddr[4]; // 0x80
  u32               segmentsize[4]; // 0x90
} SceModule2;
Back to top
View user's profile Send private message
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Wed Dec 19, 2007 10:47 pm    Post subject: Reply with quote

Hi! :)

Many thanks for your help. :)
I tried with this code in a kernel mode prx:
Code:
int getModuleList(SceUID modid[100], int *modcount){
    k1 = pspSdkSetK1(0);
    int i = 0;
    SceModule2 *ptr = sceKernelFindModuleByName("sceSystemMemoryManager");
    while (ptr){
        modid[i++] = ptr->modid;
        ptr = ptr->next;
    }
    modcount = &i;
   
    pspSdkSetK1(k1);
    return 0;
}

but it still returns the same IDs returned by sceKernelGetModuleIdList. ;)

Any (other) idea?

EDIT: Sorry for my mistake: it doesen't returns the same IDs.
It returns sceSystemMemoryManager and sceLoaderCore.
I have capture.prx enabled in GAME, but I cannot see it.

Ciaooo
Sakya
Back to top
View user's profile Send private message Visit poster's website
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Thu Dec 20, 2007 6:06 am    Post subject: Reply with quote

Well, probably the linked list is splitted.

anyways the kernel function sceKernelGetModuleIdList should work. Are you using it correctly?

psplink uses it and it works:

Code:
 memset(ids, 0, 100 * sizeof(SceUID));
        ret = g_GetModuleIdList(ids, 100 * sizeof(SceUID), &count);
        if(ret >= 0)
        {
                printf("<Module List (%d modules)>\n", count);
                for(i = 0; i < count; i++)
                {
                        print_modinfo(ids[i], verbose);
                }
        }


where g_GetModuleList is set to sceKernelGetModuleIdList in 1.50+, and to a internal pspsdk function in 1.00 where the function was broken.
Back to top
View user's profile Send private message
KickinAezz



Joined: 03 Jun 2007
Posts: 328

PostPosted: Thu Dec 20, 2007 10:35 am    Post subject: Reply with quote

moonlight wrote:
Well, you could do a sceKernelFindModuleByName("sceSystemMemoryManager"). It will return a ptr to a SceModule structure, which is a linked list, just follow it until NULL.

But be careful, the description of the SceModule structure in the pspsdk is wrong. (well not wrong, it is done for 1.00 only).
This is the correct struct for 1.5+

Oho! Thanx for this. Finally I can make use of text_addr offsets.How bout data_addr?
_________________
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Back to top
View user's profile Send private message
sakya



Joined: 28 Apr 2006
Posts: 190

PostPosted: Thu Dec 20, 2007 6:21 pm    Post subject: Reply with quote

Hi! :)

moonlight wrote:
anyways the kernel function sceKernelGetModuleIdList should work. Are you using it correctly?

I tried with sceKernelGetModuleIdList in the kernel prx and it works fine (before I tried with sceKernelGetModuleList).

Many thanks. :D

Ciaooo
Sakya
Back to top
View user's profile Send private message Visit poster's website
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Thu Dec 20, 2007 7:04 pm    Post subject: Reply with quote

KickinAezz wrote:
moonlight wrote:
Well, you could do a sceKernelFindModuleByName("sceSystemMemoryManager"). It will return a ptr to a SceModule structure, which is a linked list, just follow it until NULL.

But be careful, the description of the SceModule structure in the pspsdk is wrong. (well not wrong, it is done for 1.00 only).
This is the correct struct for 1.5+

Oho! Thanx for this. Finally I can make use of text_addr offsets.How bout data_addr?


It is probably segmentaddr[1]
Back to top
View user's profile Send private message
skarab



Joined: 30 Sep 2007
Posts: 5

PostPosted: Fri Aug 22, 2008 9:45 pm    Post subject: Reply with quote

I've got the same problems using sceKernelGetModuleIdList, but thats because the doc is false :

Code:

/**
  * Get a list of module IDs. NOTE: This is only available on 1.5 firmware
  * and above. For V1 use ::pspSdkGetModuleIdList.
  *
  * @param readbuf - Buffer to store the module list.
  * @param readbufsize - Number of elements in the readbuffer.
  * @param idcount - Returns the number of module ids
  *
  * @return >= 0 on success
  */

int sceKernelGetModuleIdList(SceUID *readbuf, int readbufsize, int *idcount);


@param readbufsize - Number of elements in the readbuffer.
-> here its not the number of elements, it should be the size of the buffer.
( parameter name is clear between )
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