loading an irx from ee memory

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
Ramja
Posts: 6
Joined: Fri Dec 12, 2008 9:06 pm

loading an irx from ee memory

Post by Ramja »

EDIT: Problem Solved :)
Last edited by Ramja on Tue Dec 16, 2008 6:22 am, edited 1 time in total.
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post by Lukasz »

IOP module loading from EE memory is not supported in the BIOS modules by default, you need to use the sbv patches library in PS2SDK which enables it by patching the running modules.

You can check my mplus loader source as a reference on how to use sbv:

http://lukasz.dk/2008/04/22/datel-memory-plus-64-mb/
Ramja
Posts: 6
Joined: Fri Dec 12, 2008 9:06 pm

Post by Ramja »

hi thanks for the reply

the same thing still happens.

here is wat my files look like nw:

main.c

Code: Select all

#include <tamtypes.h>
#include <debug.h>
#include <fileio.h>
#include <iopcontrol.h>
#include <kernel.h>
#include <loadfile.h>
#include <sbv_patches.h>

extern u32 ps2ips_irx;
extern u32 size_ps2ips_irx;

int main&#40;&#41;
&#123;
	int ret;

	init_scr&#40;&#41;;

	SifLoadFileInit&#40;&#41;;

	SifExecModuleBuffer&#40;&ps2ips_irx, &size_ps2ips_irx, 0, NULL, &ret&#41;;

        scr_printf&#40;"Module Loaded"&#41;;

	SleepThread&#40;&#41;;
&#125;

Makefile:

Code: Select all

EE_BIN = test.elf
EE_OBJS = test.o ps2ips.o

EE_LDFLAGS = -s -Ttext 0x01800000 # Load ELF at 24 MB offset
EE_LIBS += -lps2ip -lc -ldebug -lpatches
EE_CFLAGS = -DRESETIOP #-DDEBUG


all&#58; $&#40;EE_BIN&#41;
	
clean&#58;
	rm -f $&#40;EE_BIN&#41; ORG_$&#40;EE_BIN&#41; $&#40;EE_OBJS&#41; ps2ips.s

ps2ips.s&#58;
	bin2s ps2ips.irx ps2ips.s ps2ips_irx

$&#40;EE_BIN&#41; &#58; $&#40;EE_OBJS&#41;
	$&#40;EE_CC&#41; -mno-crt0 -T$&#40;PS2SDK&#41;/ee/startup/linkfile $&#40;EE_LDFLAGS&#41; \
		-o ORG_$&#40;EE_BIN&#41; $&#40;EE_OBJS&#41; $&#40;EE_LIBS&#41;
	ps2-packer-lite ORG_$&#40;EE_BIN&#41; $&#40;EE_BIN&#41;


include $&#40;PS2SDK&#41;/samples/Makefile.pref
include $&#40;PS2SDK&#41;/samples/Makefile.eeglobal
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post by Lukasz »

You havn't called the patch function sbv_patch_enable_lmb

Check the header sbv header:

sbv_patches.h
Ramja
Posts: 6
Joined: Fri Dec 12, 2008 9:06 pm

Post by Ramja »

greetings lukasz,

we still have no luck.

Thanks agan

Code: Select all

int main&#40;&#41;
&#123;
	init_scr&#40;&#41;;

	
	scr_printf&#40;"   Loading Modules...\n"&#41;;

	int ret;

	SifLoadFileInit&#40;&#41;;

	sbv_patch_enable_lmb&#40;&#41;;

	SifExecModuleBuffer&#40;&ps2ips_irx, &size_ps2ips_irx, 0, NULL, &ret&#41;;

        scr_printf&#40;"   Loaded Modules...\n"&#41;;

&#125;
Ramja
Posts: 6
Joined: Fri Dec 12, 2008 9:06 pm

Post by Ramja »

Further greetings,

It turns out the IRX has been loaded successfully (I know because I added a scr_printf afterwards), but when calling ps2ip_init() it just hangs.

I am not using Ps2link to test this.

Thankz
User avatar
Lukasz
Posts: 248
Joined: Mon Jan 19, 2004 8:37 pm
Location: Denmark
Contact:

Post by Lukasz »

You need to load some modules before ps2ip.irx. SifExecModuleBuffer in your case probably returns -203, which is a dependency error.

As suggested in this thread, take a look at existing source code and go from there.

You need to research more on your own, look at existing source code etc. Instead of asking very basic questions you can easily find the answer for yourself, because eventually people will just stop caring and answering them :-)
Post Reply