Module will not load!

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

Moderators: cheriff, TyRaNiD

Post Reply
angelo
Posts: 168
Joined: Wed Aug 29, 2007 9:34 pm

Module will not load!

Post by angelo »

Hello guys. I'm trying to call IRDA.PRX in this EBOOT, but it just freezes. Not even an error message shows.

Any ideas?

Code:

Code: Select all

#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <stdlib.h>
#include <string.h>
#include <pspsircs.h>
#include <kubridge.h>
#include "pikeylibshim.h"
#include "../sdk/pikeytypes.h"

/* Define the module info section */
PSP_MODULE_INFO&#40;"PIKEYTEST", 0, 1, 1&#41;;
PSP_MAIN_THREAD_ATTR&#40;PSP_THREAD_ATTR_USER&#41;;

/* Define printf, just to make typing easier */
#define printf	pspDebugScreenPrintf

/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41;
&#123;
	sceKernelExitGame&#40;&#41;;

	return 0;
&#125;

/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41;
&#123;
	int cbid;

	cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
	sceKernelRegisterExitCallback&#40;cbid&#41;;
	sceKernelSleepThreadCB&#40;&#41;;

	return 0;
&#125;

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41;
&#123;
	int thid = 0;

	thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, 0, 0&#41;;
	if&#40;thid >= 0&#41;
	&#123;
		sceKernelStartThread&#40;thid, 0, 0&#41;;
	&#125;

	return thid;
&#125;

int done = 0;

int main&#40;void&#41;
&#123;
	pspDebugScreenInit&#40;&#41;;
	SetupCallbacks&#40;&#41;;
	int ii;
	
	SceUID mod = kuKernelLoadModule&#40;"flash0&#58;/kd/irda.prx", 0, 0&#41;;
	
	if &#40;mod < 0&#41; &#123; printf&#40;" ! Error 0x%08X loading/starting prx.\n", mod&#41;; 
		sceKernelDelayThread&#40;5*1000*1000&#41;;
		sceKernelExitGame&#40;&#41;;		
		&#125;

	pspSdkLoadStartModule&#40;"pikeylibshim.prx", PSP_MEMORY_PARTITION_KERNEL&#41;;


    	
		
	printf&#40;"piKey Sample.\n"&#41;;
	sceKernelDelayThread&#40;3*1000*1000&#41;;

	initPikey_3xx&#40;&#41;;

	sceKernelDelayThread&#40;1000000&#41;;

	printf&#40;"piKey is detected as &#58; %s\n", isPikeyLoaded_3xx&#40;&#41; ? "Running" &#58; "Not Running"&#41;;

	requestExclusive_3xx&#40;&#41;;

	setMode_3xx&#40;PIKEY_KEYMODE_KEYPRESS&#41;;

	sceKernelDelayThread&#40;1000000&#41;;


	printf&#40;"Waiting for keys to be pressed...\n\n"&#41;;

	while&#40;!done&#41;
	&#123;


	requestExclusive_3xx&#40;&#41;;
	pspDebugScreenPrintf&#40;"\n\n"&#41;;
		printf&#40;"Waiting for keys to be pressed...\n\n"&#41;;
		requestExclusive_3xx&#40;&#41;;
		sceKernelDelayThread&#40;100000&#41;;
		pspDebugScreenClear&#40;&#41;;

#if 0
		for &#40;ii = 7; ii < 20; ii++&#41;
		&#123;
			printf&#40;"                              \n"&#41;;
		&#125;
#endif

		// nothing to do if no keys pressed.
		if &#40;numKeysPressed_3xx&#40;&#41; == 0&#41;
		&#123;
			continue;
		&#125;
		pspDebugScreenPrintf&#40;"\n"&#41;;
		for &#40;ii = 0; ii < KEY_MAX; ii++&#41;
		&#123;
			if &#40;isKeyPressed_3xx&#40;ii&#41;&#41;
			&#123;
			printf&#40;"Pressed Scancode&#58; %d\n", ii&#41;;
			&#125;
		&#125;

		int ctrl, alt, shift;
		pspDebugScreenPrintf&#40;"\n"&#41;;
		getMetaKeys_3xx&#40;&alt, &ctrl, &shift&#41;;

		printf&#40;"  %s  %s  %s\n",
			     ctrl?  "CTRL"  &#58; "    ",
					 alt?   "ALT"   &#58; "   ",
					 shift? "Shift" &#58;	"     "&#41;;

		
	&#125;
	return 0;
	&#125;
Makefile

Code: Select all

TARGET = sample
OBJS = Main.o PikeyLibShim.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

LIBDIR =
LDFLAGS =
LIBS =

BUILD_PRX = 1
PSP_FW_VERSION = 380
PSP_LARGE_MEMORY = 1
PSP_EBOOT_ICON = ICON0.png

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = piKey IR Sample
LIBS += -lpspkubridge -lpspsystemctrl_kernel

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

This doesn't really solve your programming problem, but someone got IRDA.PRX to work by loading it via recovery plugins. I presume you can also load it by adding it to pspbt*nf.bin in all modes.
angelo
Posts: 168
Joined: Wed Aug 29, 2007 9:34 pm

Yeah...

Post by angelo »

Torch wrote:This doesn't really solve your programming problem, but someone got IRDA.PRX to work by loading it via recovery plugins. I presume you can also load it by adding it to pspbt*nf.bin in all modes.
Yeah... that person was ME! lol

The trouble is that when enabled in the recovery menu, it can conflict with other programs. NervOS is one of them.

Hopefully if I can get it working in the sample program the plugin will not have to load in recovery!

What am I doing wrong in my application?!?

It works fine with everybody else!

Even when I copy is to the memory stick and load it up with "pspSdkLoadStartModule" it fails!

Does anyboy know the answser?

Thanks

Angelo
darkness
Posts: 121
Joined: Sun Jun 15, 2008 8:42 pm

Post by darkness »

Try to load it in user memory partition!
angelo
Posts: 168
Joined: Wed Aug 29, 2007 9:34 pm

Partition

Post by angelo »

I tried this:

Code: Select all

	SceUID mod = kuKernelLoadModule&#40;"flash0&#58;/kd/irda.prx", 0, PSP_MEMORY_PARTITION_KERNEL&#41;;
...nothing... now it just freezes. Nothing shows on screen.
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

he said try USER instead of KERNEL, lol
Image
Upgrade your PSP
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Yeah, since the irda is a user level library, it probably needs to be loaded to user memory. The shim had to be loaded to kernel memory because it has kernel functions in it.

Try:

Code: Select all

   SceUID mod = pspSdkLoadStartModule&#40;"flash0&#58;/kd/irda.prx", PSP_MEMORY_PARTITION_USER&#41;;
   if &#40;mod < 0&#41; 
   &#123; 
      printf&#40;" ! Error 0x%08X loading/starting prx.\n", mod&#41;;
      sceKernelDelayThread&#40;5*1000*1000&#41;;
      sceKernelExitGame&#40;&#41;;      
   &#125;
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

I don't know if you will be able to load it to user mode since you are in user mode.
you may get a "partition mismatch" error.
Image
Upgrade your PSP
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Pirata Nervo wrote:I don't know if you will be able to load it to user mode since you are in user mode.
you may get a "partition mismatch" error.
So maybe load it from the shim, which is in kernel mode. Guess we'll have to wait until he tries it. :)
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

what's the shim? :P
does it mean anything or is it a technical word?
Image
Upgrade your PSP
angelo
Posts: 168
Joined: Wed Aug 29, 2007 9:34 pm

Busy

Post by angelo »

Been VERY busy lately with school stuff. (Explains your empty inbox J.F!)

I'll try it when I get a chance.

Hopefully once this is fixed in the sample, I can fix it in the piKey plugin!

=)

Thanks guys!

Angelo
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Pirata Nervo wrote:what's the shim? :P
does it mean anything or is it a technical word?
Oh, angelo knows as he's the one working on the project... the pikey library used for accessing pikey inside homebrew doesn't work in w user-mode 3.xx app as it (and pikey) use kernel functions. So I made a kernel-mode shim that just uses the pikey lib from within a kernel-mode prx you load in your 3.xx homebrew to use pikey. The problem is you still need to currently edit a file in the flash to load the irda.prx before any of the pikey stuff will work on firmwares newer than 3.70. Angelo's been trying to load the irda inside the homebrew to avoid needing to mess with the flash. That's what this thread is on. Now since the shim is a kernel-mode prx, if you need to load irda.prx from kernel mode, he should be able to add that to the shim code.
angelo
Posts: 168
Joined: Wed Aug 29, 2007 9:34 pm

And it's hard!

Post by angelo »

J.F. wrote:
Pirata Nervo wrote:what's the shim? :P
does it mean anything or is it a technical word?
Oh, angelo knows as he's the one working on the project... the pikey library used for accessing pikey inside homebrew doesn't work in w user-mode 3.xx app as it (and pikey) use kernel functions. So I made a kernel-mode shim that just uses the pikey lib from within a kernel-mode prx you load in your 3.xx homebrew to use pikey. The problem is you still need to currently edit a file in the flash to load the irda.prx before any of the pikey stuff will work on firmwares newer than 3.70. Angelo's been trying to load the irda inside the homebrew to avoid needing to mess with the flash. That's what this thread is on. Now since the shim is a kernel-mode prx, if you need to load irda.prx from kernel mode, he should be able to add that to the shim code.
And it hard!

I've tried so many solutions to this problem, but hopefully I'll get it to work.

I'll try it in a few days. I have a grade 6 guitar exam to revise for! =D

Thanks guys!

Angelo
angelo
Posts: 168
Joined: Wed Aug 29, 2007 9:34 pm

Error

Post by angelo »

OK as predicted by Pirata Nervo I get a "partition mismatch" when loading it with:

Code: Select all

SceUID mod = pspSdkLoadStartModule&#40;"flash0&#58;/kd/irda.prx", PSP_MEMORY_PARTITION_USER&#41;;
	
	if &#40;mod < 0&#41; &#123; printf&#40;" ! Error 0x%08X loading/starting prx.\n", mod&#41;; 
		sceKernelDelayThread&#40;5*1000*1000&#41;;
		sceKernelExitGame&#40;&#41;;		
		&#125;
Looks like I have to add it to the shim J.F.
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

or do this:
load a kernel mode prx from your application.
from the kernel mode prx load the irda to user mode partition.
may not work xD
Image
Upgrade your PSP
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Pirata Nervo wrote:or do this:
load a kernel mode prx from your application.
from the kernel mode prx load the irda to user mode partition.
may not work xD
That's what the shim is - it's a kernel-mode prx.
:)
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

oh LOL XD
Image
Upgrade your PSP
angelo
Posts: 168
Joined: Wed Aug 29, 2007 9:34 pm

Still acting strange...

Post by angelo »

Hmm...

Now when I try and add it to the shim it fails to compile.

Code: Select all

#include <pspsdk.h>
#include <pspkernel.h>
#include <string.h>
#include <pspuser.h> 

#include <pikeylib.h>

#define VERS 1
#define REVS 0
#define MAX_ARGS 2048


PSP_MODULE_INFO&#40;"PikeyLibShim", 0x1006, VERS, REVS&#41;;
PSP_MAIN_THREAD_ATTR&#40;0&#41;;



void putNextCharW_3xx&#40;int ch&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	putNextCharW&#40;ch&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

void putNextChar_3xx&#40;char ch&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	putNextChar&#40;ch&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

int numCharsAvailable_3xx&#40;void&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = numCharsAvailable&#40;&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

void flushBuffer_3xx&#40;void&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	flushBuffer&#40;&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

int getNextCharW_3xx&#40;void&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = getNextCharW&#40;&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

char getNextChar_3xx&#40;void&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	char retv = getNextChar&#40;&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

int peekNChars_3xx&#40;int n, int *buffer&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = peekNChars&#40;n, buffer&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

void throwAwayInput_3xx&#40;int numchars&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	throwAwayInput&#40;numchars&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

void sioPrint_3xx&#40;const char * str&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	sioPrint&#40;str&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

void sioPrintHex_3xx&#40;char ch&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	sioPrintHex&#40;ch&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

void sioPrintWord_3xx&#40;int word&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	sioPrintWord&#40;word&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

int waitForModule_3xx&#40;const char *name&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = waitForModule&#40;name&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

int requestExclusive_3xx&#40;void&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = requestExclusive&#40;&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

void releaseExclusive_3xx&#40;void&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	releaseExclusive&#40;&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

u32 apiHookByNid_3xx&#40;const char *modname, const char *libname, u32 nid, void *func&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	u32 retv = apiHookByNid&#40;modname, libname, nid, func&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

u32 callApiHook_3xx&#40;u32 hookid, ...&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	u32 retv = callApiHook&#40;hookid&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

void unHookApi_3xx&#40;u32 hookid&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	unHookApi&#40;hookid&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

int registerDisplayCallback_3xx&#40;SceUID callback&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = registerDisplayCallback&#40;callback&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

void drawKeyboardInfo_3xx&#40;DRAWINFO *drawinfo&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	drawKeyboardInfo&#40;drawinfo&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

void displayStatusText_3xx&#40;const char *text&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	displayStatusText&#40;text&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

int isVshMode_3xx&#40;&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = isVshMode&#40;&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

void  sendKeyPress_3xx&#40;int a,int b,int c,int d,int e&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	sendKeyPress&#40;a,b,c,d,e&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

void  flushKeyPresses_3xx&#40;void &#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	flushKeyPresses&#40;&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

int   setMode_3xx&#40;int a&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = setMode&#40;a&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

int   getMode_3xx&#40;void&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = getMode&#40;&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

int   isKeyPressed_3xx&#40;int a&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = isKeyPressed&#40;a&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

void getMetaKeys_3xx&#40;int *alt, int *ctrl, int *shift&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	getMetaKeys&#40;alt, ctrl, shift&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

int   numKeysPressed_3xx&#40;void&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = numKeysPressed&#40;&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

int configOpen_3xx&#40;const char *filename&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = configOpen&#40;filename&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

int configRead_3xx&#40;int cfgHandle, char *token, char *value&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = configRead&#40;cfgHandle, token, value&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

void configClose_3xx&#40;int cfgHandle&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	configClose&#40;cfgHandle&#41;;

	pspSdkSetK1&#40;k1&#41;;
&#125;

int isPikeyLoaded_3xx&#40;&#41;
&#123;
	unsigned int k1 = pspSdkSetK1&#40;0&#41;;

	int retv = isPikeyLoaded&#40;&#41;;

	pspSdkSetK1&#40;k1&#41;;
	return retv;
&#125;

SceUID myLoadStartModuleWithArgs&#40;const char *filename, int mpid, int argc, char * const argv&#91;&#93;&#41; 
&#123; 
   SceKernelLMOption option; 
   SceUID modid = 0; 
   int retVal = 0, mresult; 
   char args&#91;MAX_ARGS&#93;; 
   int  argpos = 0; 

   memset&#40;args, 0, MAX_ARGS&#41;; 
   strcpy&#40;args, filename&#41;; 
   argpos += strlen&#40;args&#41; + 1; 
//   for&#40;i = 0; &#40;i < argc&#41; && &#40;argpos < MAX_ARGS&#41;; i++&#41; 
//   &#123; 
//      int len; 
// 
//      snprintf&#40;&args&#91;argpos&#93;, MAX_ARGS-argpos, "%s", argv&#91;i&#93;&#41;; 
//      len = strlen&#40;&args&#91;argpos&#93;&#41;; 
//      argpos += len + 1; 
//   &#125; 

   memset&#40;&option, 0, sizeof&#40;option&#41;&#41;; 
   option.size = sizeof&#40;option&#41;; 
   option.mpidtext = mpid; 
   option.mpiddata = mpid; 
   option.position = 0; 
   option.access = 1; 

   retVal = sceKernelLoadModule&#40;filename, 0, &option&#41;; 
   if&#40;retVal < 0&#41;&#123; 
      return retVal; 
   &#125; 

   modid = retVal; 

   retVal = sceKernelStartModule&#40;modid, argpos, args, &mresult, NULL&#41;; 
   if&#40;retVal < 0&#41;&#123; 
      return retVal; 
   &#125; 

   return modid; 
&#125; 

int initPikey_3xx&#40;&#41; 
&#123; 
   int retv; 
   unsigned int k1 = pspSdkSetK1&#40;0&#41;; 

   SceUID mod = myLoadStartModuleWithArgs&#40;"flash0&#58;/kd/irda.prx", PSP_MEMORY_PARTITION_USER, 0, NULL&#41;; 
   if &#40;mod < 0&#41; 
      retv = mod; 
   else 
      retv = initPikey&#40;&#41;; 

   pspSdkSetK1&#40;k1&#41;; 
   return retv; 
&#125;

int module_start&#40;SceSize args, void *argp&#41;
&#123;
	return 0;
&#125;

int module_stop&#40;&#41;
&#123;
	return 0;
&#125;
The error:

Code: Select all

> "make" 
psp-gcc -I/c/devkitPro/devkitPSP/psp/sdk/include/libc -I. -I/c/devkitPro/devkitPSP/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150   -c -o main.o main.c
main.c&#58; In function 'sioPrintWord_3xx'&#58;
main.c&#58;116&#58; warning&#58; implicit declaration of function 'sioPrintWord'
psp-build-exports -b pikeylibshim.exp > pikeylibshim.c
psp-gcc -I/c/devkitPro/devkitPSP/psp/sdk/include/libc -I. -I/c/devkitPro/devkitPSP/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150   -c -o pikeylibshim.o pikeylibshim.c
psp-gcc -I/c/devkitPro/devkitPSP/psp/sdk/include/libc -I. -I/c/devkitPro/devkitPSP/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150  -L. -L/c/devkitPro/devkitPSP/psp/sdk/lib -specs=/c/devkitPro/devkitPSP/psp/sdk/lib/prxspecs -Wl,-q,-T/c/devkitPro/devkitPSP/psp/sdk/lib/linkfile.prx -mno-crt0 -nostartfiles  main.o pikeylibshim.o -lpspkernel -lpikey -lpspdebug -lpspdisplay_driver -lpspctrl_driver -lpspsdk  -lpspkernel -o pikeylibshim.elf
psp-fixup-imports pikeylibshim.elf
Error, could not fixup imports, stubs out of order.
Ensure the SDK libraries are linked in last to correct this error
"make"&#58; *** &#91;pikeylibshim.elf&#93; Error 1
rm pikeylibshim.c

> Process Exit Code&#58; 2
> Time Taken&#58; 00&#58;03
But then when I make again, it compiles the ELF into a PRX:

Code: Select all

> "make" 
psp-prxgen pikeylibshim.elf pikeylibshim.prx

> Process Exit Code&#58; 0
> Time Taken&#58; 00&#58;00
I test the PRX and as suspected it fails!

Any ideas?

If you want more code, let me know!

Angelo
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

Is that makefile part of the main code?
because the library/driver should be prx and exporting functions to user mode pbp (usually) and in your makefile you say:

Code: Select all

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = piKey IR Sample 
PSP_EBOOT_ICON = ICON0.Png
Image
Upgrade your PSP
angelo
Posts: 168
Joined: Wed Aug 29, 2007 9:34 pm

To clear up

Post by angelo »

Let me just clear up...

The shim in a kernel mode PRX.

The sample is a user mode EBOOT that loads the shim fine.

The trouble is making the shim load IRDA.PRX as it cannot be loaded in user mode.

Here's the shim makefile:

Code: Select all

TARGET = pikeylibshim
OBJS = main.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

BUILD_PRX = 1
PRX_EXPORTS = pikeylibshim.exp

USE_KERNEL_LIBC=1
USE_KERNEL_LIBS=1

LIBDIR =
LDFLAGS = -mno-crt0 -nostartfiles
LIBS = -lpspkernel -lpikey


PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
Here's the sample makefile:

Code: Select all

TARGET = sample
OBJS = Main.o PikeyLibShim.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

LIBDIR =
LDFLAGS =
LIBS =

BUILD_PRX = 1
PSP_FW_VERSION = 380
PSP_LARGE_MEMORY = 1

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = piKey IR Sample

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
With that said, I was looking on how ZX81 loads IRDA in his applications.

Code: Select all

/* Load irda PRX for CFW >= 3.80 */ 
u32 mod_id = sceKernelLoadModule&#40;"flash0&#58;/kd/irda.prx", 0, NULL&#41;; 
sceKernelStartModule&#40;mod_id, 0, NULL, NULL, NULL&#41;; 
I'll try adding that to the sample and see what happeneds. As always, finding time is hard. I HATE schoolwork sometimes!

Angelo
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

but you still get the error, right?
and you are getting the error compiling the prx?
Image
Upgrade your PSP
angelo
Posts: 168
Joined: Wed Aug 29, 2007 9:34 pm

Yes

Post by angelo »

I still gt an error when compiling the PRX, howeverever an ELF file is made!

If I re make the semi compiled source, it converts the ELF to a PRX.

Ahh this is driving me crazy!
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

remove -lpspkernel from your makefile and try again
Image
Upgrade your PSP
Rangu2057
Posts: 87
Joined: Mon Jul 23, 2007 8:37 am
Location: wilmington, NC

Re: Yes

Post by Rangu2057 »

angelo wrote:I still gt an error when compiling the PRX, howeverever an ELF file is made!

If I re make the semi compiled source, it converts the ELF to a PRX.

Ahh this is driving me crazy!
i know what u mean man, but dont go crazy now :P

hopefully removing -lpspkernel like Pirata said will fix the problem, but im not sure

btw, whats with the K1 shit checks? its everywhere, and thats enough to drive me crazy right there, lol
the questions of today are awnswered by the blood and bullets of tomorrow! ---EagleEye--- (Socom FTB2)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

You posted a clip from zx81 that you say he uses in his apps (from the user level)... try putting that in the sample instead of the shim.
angelo
Posts: 168
Joined: Wed Aug 29, 2007 9:34 pm

Damn!

Post by angelo »

Damn nothing!

Grrr!

I'm going to restore the shim and the application back to normal J.F and I'll get into contact with ZX81. We talk sometimes on MSN.

Anywho, I'll be working on the generic stuff in piKey, adding some new features and fixing some bugs.

Thanks guys for all yoru help!

Angelo
Post Reply