[SOLVED] List of loaded prx?

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

Moderators: cheriff, TyRaNiD

Post Reply
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

[SOLVED] List of loaded prx?

Post by sakya »

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.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

That function only returns the list of user mode modules.

Use sceKernelGetModuleList or sceKernelGetModuleListWithAlloc in kernel mode.
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

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
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

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
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

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: Select all

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;
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

Hi! :)

Many thanks for your help. :)
I tried with this code in a kernel mode prx:

Code: Select all

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
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

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: Select all

 memset(ids, 0, 100 * sizeof(SceUID));
        ret = g_GetModuleIdList(ids, 100 * sizeof(SceUID), &count);
        if(ret >= 0)
        {
                printf&#40;"<Module List &#40;%d modules&#41;>\n", count&#41;;
                for&#40;i = 0; i < count; i++&#41;
                &#123;
                        print_modinfo&#40;ids&#91;i&#93;, verbose&#41;;
                &#125;
        &#125;
where g_GetModuleList is set to sceKernelGetModuleIdList in 1.50+, and to a internal pspsdk function in 1.00 where the function was broken.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

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.
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

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
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

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]
skarab
Posts: 5
Joined: Sun Sep 30, 2007 4:35 am

Post by skarab »

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

Code: Select all

/**
  * Get a list of module IDs. NOTE&#58; This is only available on 1.5 firmware
  * and above. For V1 use &#58;&#58;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&#40;SceUID *readbuf, int readbufsize, int *idcount&#41;;
@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 )
Post Reply