This time, mymoduleGetVersion is OK now, and the library seems to be loaded OK, but mymoduleKernelModuleCount returns 0x8002013A(SCE_KERNEL_ERROR_LIBRARY_NOT_YET_LINKED). What happend?
int mymoduleKernelModuleCount(void)
{
int k1 = pspSdkSetK1(0);
int ret = sceKernelModuleCount();
pspSdkSetK1(k1);
return ret;
}
The problem remains, and here is my export.exp for the module:
# Define the exports for the prx
PSP_BEGIN_EXPORTS
# These four lines are mandatory (although you can add other functions like module_stop)
# syslib is a psynonym for the single mandatory export.
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_END
PSP_EXPORT_START(MyModule, 0, 0x4001)
PSP_EXPORT_FUNC_HASH(mymoduleGetVersionNumber)
PSP_EXPORT_FUNC_HASH(mymoduleKernelModuleCount)
PSP_EXPORT_END
PSP_END_EXPORTS
The reason of Sony deleting this function is probably the introducion of sceKernelGetModuleListWithAlloc in 1.50. Maybe before the "user" of the function used sceKernelModuleCount to allocate a buffer with enough size, and then sceKernelGetModuleList to get the module list. Then they just make a function to do all at same time, making sceKernelModuleCount useless for them.
I've been having this problem also, but I've not been able to find my error, I'm not sure whats causing it, but I'm 99% sure its the actual kmode plugin and not the loader.
# Define the exports for the prx
PSP_BEGIN_EXPORTS
# These four lines are mandatory (although you can add other functions like module_stop)
# syslib is a psynonym for the single mandatory export.
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC_HASH(module_start)
PSP_EXPORT_VAR_HASH(module_info)
PSP_EXPORT_END
PSP_EXPORT_START(KMode, 0, 0x4001)
PSP_EXPORT_FUNC(unloadmod)
PSP_EXPORT_END
PSP_END_EXPORTS
This, too, returns the 0x8002013A, and I'm not sure why.