Code: Select all
#include <pspkernel.h>
#include <pspmodulemgr_kernel.h>
#include <psppower.h>
#include <pspgu.h>
#include <pspwlan.h>
#include <pspnet.h>
#include <pspnet_inet.h>
#include <pspnet_apctl.h>
#include <arpa/inet.h>
#include <pspthreadman_kernel.h>
#include <pspsdk.h>
#include <string.h>
PSP_MODULE_INFO("TestPRX", 0x1000, 0, 2);
PSP_MAIN_THREAD_ATTR(0);
PSP_HEAP_SIZE_KB( 2048);
PSP_MAIN_THREAD_STACK_SIZE_KB( 2048);
int main(int argc, char **argv)
{
return 1;
}
int Test()
{
return 1;
}
int getMode()
{
u32 k1;
k1 = pspSdkSetK1(0);
int ret = sceKernelIsUserModeThread();
pspSdkSetK1(k1);
return ret;
}
Code: Select all
TARGET = TestPRX
OBJS = main.o
USE_KERNEL_LIBC=1
BUILD_PRX=1
PSP_FW_VERSION=371
PRX_EXPORTS=exports.exp
USE_PSPSDK_LIBC = 1
LIBS = -lpspgu -lpsppower -lpspwlan
INCDIR = $(srcdir)
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code: Select all
PSP_BEGIN_EXPORTS
PSP_EXPORT_START(syslib, 0, 0x8000)
PSP_EXPORT_FUNC(module_start)
PSP_EXPORT_VAR(module_info)
PSP_EXPORT_END
# Name
PSP_EXPORT_START(TestPRX, 0, 0x4001)
# Functions
PSP_EXPORT_FUNC(Test)
PSP_EXPORT_FUNC(getMode)
PSP_EXPORT_END
PSP_END_EXPORTS
Code: Select all
SceUID mod = pspSdkLoadStartModule("TestPRX.prx", PSP_MEMORY_PARTITION_KERNEL);
When the PRX is loaded it can be accessed fine but when I run:
getMode();
It returns 1, meaning the PRX is in User Mode.
What went wrong?