Problems with HDD access

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

Moderators: cheriff, Herben

Post Reply
MrSiir[S]
Posts: 32
Joined: Tue Sep 14, 2004 11:08 am

Problems with HDD access

Post by MrSiir[S] »

Hello, i have problems with HDD access:

When start application, no load the HDD access modules, load SIO2MAN, PADMAN, MCMAN and MCSERV with "SifLoadModule", and NPM-USBD and USB_MASS with "SifExecModuleBuffer", if user presses one button, I need load HDD modules, I write another function with load of poweroff, iomanX, fileXio, ps2dev9, ps2atad, ps2hdd and ps2fs in this order, modules load with "SifExecModuleBuffer", if try to run application across ps2link or pukklink, works fine, but, if copy the application in the MC and run, freeze in loading HDD modules screen.

I try to load ps2ip and ps2map modules and same freeze.
Any one helps to me?

Thanks in advance,
MrSiir
MrSiir[S]
Posts: 32
Joined: Tue Sep 14, 2004 11:08 am

Post by MrSiir[S] »

I have a small example of access to the hard disk that works to me with ps2link, but does not work to me from memory card, which I am making bad?

Code: Select all

/******************************************************************
 *
 * PS2 HDD Test - MrSiir / Siirlabs (mrsiir@gmail.com)
 *
 ******************************************************************/
#include <kernel.h>
#include <sifrpc.h>
#include <loadfile.h>
#include <libhdd.h>
#include <sbv_patches.h>
#include <debug.h>
#include <fileio.h>
#include <iopheap.h>
#include <iopcontrol.h>

#define MAX_PARTITIONS	100
t_hddFilesystem parties&#91;MAX_PARTITIONS&#93; __attribute__&#40;&#40;aligned&#40;64&#41;&#41;&#41;;

extern u8 *iomanx_irx;
extern int size_iomanx_irx;
extern u8 *filexio_irx;
extern int size_filexio_irx;
extern u8 *ps2dev9_irx;
extern int size_ps2dev9_irx;
extern u8 *ps2atad_irx;
extern int size_ps2atad_irx;
extern u8 *ps2hdd_irx;
extern int size_ps2hdd_irx;
extern u8 *ps2fs_irx;
extern int size_ps2fs_irx;
extern u8 *poweroff_irx;
extern int size_poweroff_irx;

void poweroffHandler&#40;int i&#41;
&#123;
	hddPowerOff&#40;&#41;;
&#125;

void LoadModules&#40;&#41;
&#123;
	int ret;
	static char hddarg&#91;&#93; = "-o" "\0" "4" "\0" "-n" "\0" "20";
	static char pfsarg&#91;&#93; = "-m" "\0" "4" "\0" "-o" "\0" "10" "\0" "-n" "\0" "40" /*"\0" "-debug"*/;

	scr_printf&#40;"SIO2MAN\n"&#41;;
	SifLoadModule&#40;"rom0&#58;SIO2MAN", 0, NULL&#41;;
	scr_printf&#40;"MCMAN\n"&#41;;
	SifLoadModule&#40;"rom0&#58;MCMAN", 0, NULL&#41;;
	scr_printf&#40;"MCSERV\n"&#41;;
	SifLoadModule&#40;"rom0&#58;MCSERV", 0, NULL&#41;;
	scr_printf&#40;"PADMAN\n"&#41;;
	SifLoadModule&#40;"rom0&#58;PADMAN", 0, NULL&#41;;
	scr_printf&#40;"poweroff.irx %i bytes\n", size_poweroff_irx&#41;;
	SifExecModuleBuffer&#40;&poweroff_irx, size_poweroff_irx, 0, NULL, &ret&#41;;
	scr_printf&#40;"iomanx.irx %i bytes\n", size_iomanx_irx&#41;;
	SifExecModuleBuffer&#40;&iomanx_irx, size_iomanx_irx, 0, NULL, &ret&#41;;
	scr_printf&#40;"filexio.irx %i bytes\n", size_filexio_irx&#41;;
	SifExecModuleBuffer&#40;&filexio_irx, size_filexio_irx, 0, NULL, &ret&#41;;
	scr_printf&#40;"ps2dev9.irx %i bytes\n", size_ps2dev9_irx&#41;;
	SifExecModuleBuffer&#40;&ps2dev9_irx, size_ps2dev9_irx, 0, NULL, &ret&#41;;
	scr_printf&#40;"ps2atad.irx %i bytes\n", size_ps2atad_irx&#41;;
	SifExecModuleBuffer&#40;&ps2atad_irx, size_ps2atad_irx, 0, NULL, &ret&#41;;
	scr_printf&#40;"ps2hdd.irx %i bytes\n", size_ps2hdd_irx&#41;;
	SifExecModuleBuffer&#40;&ps2hdd_irx, size_ps2hdd_irx, sizeof&#40;hddarg&#41;, hddarg, &ret&#41;;
	scr_printf&#40;"ps2fs.irx %i bytes\n", size_ps2fs_irx&#41;;
	SifExecModuleBuffer&#40;&ps2fs_irx, size_ps2fs_irx, sizeof&#40;pfsarg&#41;, pfsarg, &ret&#41;;
&#125; 

int main&#40;&#41;
&#123;
	int i=0,nparty;
	const char *eeloadimg = "rom0&#58;UDNL rom0&#58;EELOADCNF";
	char *imgcmd = &#40;char *&#41;eeloadimg;

	SifInitRpc&#40;0&#41;;
	fioExit&#40;&#41;;
	SifExitIopHeap&#40;&#41;;
	SifLoadFileExit&#40;&#41;;
	SifExitRpc&#40;&#41;;
	SifIopReset&#40;imgcmd, 0&#41;;
	while &#40;SifIopSync&#40;&#41;&#41; ;
	SifInitRpc&#40;0&#41;;
	sbv_patch_enable_lmb&#40;&#41;;
	sbv_patch_disable_prefix_check&#40;&#41;;
	init_scr&#40;&#41;;
	scr_printf&#40;"HDD Test\n"&#41;;
	hddPreparePoweroff&#40;&#41;;
	hddSetUserPoweroffCallback&#40;&#40;void *&#41;poweroffHandler,&#40;void *&#41;i&#41;;
	LoadModules&#40;&#41;;
	if&#40;hddCheckPresent&#40;&#41; < 0&#41; &#123;
		scr_printf&#40;"NO HDD\n"&#41;;
		while&#40;1&#41;;
	&#125;
	if&#40;hddCheckFormatted&#40;&#41; < 0&#41; &#123;
		scr_printf&#40;"HDD no formateado\n"&#41;;
		while&#40;1&#41;;
	&#125;
	i = hddGetFilesystemList&#40;parties, MAX_PARTITIONS&#41;;
	scr_printf&#40;"%i particiones\n", i&#41;;
	nparty=i-1;
	for&#40;i=nparty;i>=0;i--&#41; &#123;
		scr_printf&#40;"Particion&#58; %s\n", parties&#91;i&#93;.name&#41;;
	&#125;
	scr_printf&#40;"The End\n"&#41;;
	while&#40;1&#41;; //forever
	return 0;
&#125;
Thanks in advance,
MrSiir
MrSiir[S]
Posts: 32
Joined: Tue Sep 14, 2004 11:08 am

Post by MrSiir[S] »

Arranged the topic of the HD, it was through the fault of the IRX, was using the IRX compiled for my of the SDK of the CVS and me they do not work well, I have used other IRX and they have worked to the first one.
Post Reply