Graphic library will be vlf.
i thought to load modules (in this example Plugin.prx) and call functions stored inside those.
this is the situation:
main module that loads all other submodules + vlf lib.
calling vlf functions from inside the main module is (ofcourse) everything ok.
BUT if i try to call a vlf function from a submodule it doesn't work.
here the main module (main.c)
Code: Select all
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspsdk.h>
#include <string.h>
#include <vlf.h>
PSP_MODULE_INFO("VLF_demo", 0x800, 2, 0);
PSP_MAIN_THREAD_ATTR(0);
int addText();
int OnCrossPress(void *param)
{
sceKernelExitGame();
return VLF_EV_RET_REMOVE_HANDLERS;
}
int OnSquarePress(void *param)
{
addText();
return VLF_EV_RET_NOTHING;
}
int app_main()
{
void *bi;
//vlfGuiSetBackgroundPlane(0xFF000000);
vlfGuiSetBackgroundSystem(0);
vlfGuiCacheResource("system_plugin");
vlfGuiCacheResource("system_plugin_fg");
vlfGuiSetModelSystem();
vlfGuiAddBatteryIconSystem(&bi, 10*1000*1000);
vlfGuiAddClock();
vlfGuiAddEventHandler(PSP_CTRL_CROSS, -1, OnCrossPress, NULL);
vlfGuiAddEventHandler(PSP_CTRL_SQUARE, -1, OnSquarePress, NULL);
while (1)
{
vlfGuiDrawFrame();
}
return 0;
}
Code: Select all
release: all
psppacker 400I VLF_Sample.prx
TARGET = VLF_Sample
OBJS = crt0.o main.o Plugin.o
INCDIR = ./include
CFLAGS = -O2 -G0 -Wall -fshort-wchar -fno-pic -mno-check-zero-division
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS) -c
LIBDIR = ./lib
LDFLAGS = -mno-crt0 -nostdlib -nodefaultlibs
LIBS = -lvlfgui -lvlfgu -lvlfutils -lvlflibc
BUILD_PRX = 1
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Vlf Sample
PSPSDK=$(shell psp-config --pspsdk-path)
include ./build.mak
Code: Select all
#include <pspsdk.h>
#include <pspkernel.h>
#include <kubridge.h>
#include <stdio.h>
#include <vlf.h>
extern int app_main(int argc, char *argv[]);
int start_thread(SceSize args, void *argp)
{
SceUID mod;
char *path = (char*) argp;
int last_trail = -1;
int i;
if(path)
{
for(i=0; path[i]; i++)
{
if(path[i] == '/')
last_trail = i;
}
}
if (last_trail >= 0)
path[last_trail] = 0;
sceIoChdir(path);
path[last_trail] = '/';
mod = sceKernelLoadModule("iop.prx", 0, NULL);
mod = sceKernelStartModule(mod, args, argp, NULL, NULL);
mod = sceKernelLoadModule("intraFont.prx", 0, NULL);
mod = sceKernelStartModule(mod, args, argp, NULL, NULL);
mod = sceKernelLoadModule("vlf.prx", 0, NULL);
mod = sceKernelStartModule(mod, args, argp, NULL, NULL);
mod = sceKernelLoadModule("Plugin.prx", 0, NULL);
mod = sceKernelStartModule(mod, args, argp, NULL, NULL);
vlfGuiInit(-1, app_main);
return sceKernelExitDeleteThread(0);
}
int module_start(SceSize args, void *argp)
{
SceUID thid = sceKernelCreateThread("start_thread", start_thread, 0x10, 0x4000, 0, NULL);
if (thid < 0)
return thid;
sceKernelStartThread(thid, args, argp);
return 0;
}
in this case a module called Plugin.prx that SHOULD display a text on the screen but it doesn't work (lol)
main.c
Code: Select all
#include <pspsdk.h>
#include <pspkernel.h>
#include <vlf.h>
PSP_MODULE_INFO("Plugin", 0x1006, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
u32 k1;
int addText(){
k1 = pspSdkSetK1(0);
vlfGuiAddText(200, 10, "Please display this!");
pspSdkSetK1(k1);
return 0;
}
int module_start(SceSize args, void *argp)
{
return 0;
}
int module_stop()
{
return 0;
}
Code: Select all
TARGET = Plugin
OBJS = main.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
BUILD_PRX = 1
PRX_EXPORTS = exports.exp
USE_KERNEL_LIBC=1
USE_KERNEL_LIBS=1
LIBDIR =
LDFLAGS = -mno-crt0 -nostartfiles
LIBS = -lvlfgui -lvlfgu -lvlfutils -lvlflibc
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Code: Select all
# 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
# Export our function
PSP_EXPORT_START(Plugin, 0, 0x4001)
PSP_EXPORT_FUNC(addText)
PSP_EXPORT_END
PSP_END_EXPORTS
please try to help me solve this problem.