Skip to content

Commit

Permalink
Initial xfrom0: support
Browse files Browse the repository at this point in the history
  • Loading branch information
uyjulian committed Aug 11, 2021
1 parent 74675a0 commit f75a19c
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ EE_BIN = BOOT-UNC.ELF
EE_BIN_PKD = BOOT.ELF
EE_OBJS = main.o pad.o config.o elf.o draw.o loader_elf.o filer.o \
poweroff_irx.o iomanx_irx.o filexio_irx.o ps2atad_irx.o ps2dev9_irx.o ps2ip_irx.o netman_irx.o \
ps2smap_irx.o ps2hdd_irx.o ps2fs_irx.o ps2netfs_irx.o usbd_irx.o usbhdfsd_irx.o mcman_irx.o mcserv_irx.o\
ps2smap_irx.o ps2hdd_irx.o ps2fs_irx.o ps2netfs_irx.o usbd_irx.o usbhdfsd_irx.o mcman_irx.o mcserv_irx.o extflash_irx.o xfromman_irx.o\
cdfs_irx.o ps2ftpd_irx.o ps2host_irx.o vmc_fs_irx.o ps2kbd_irx.o\
hdd.o hdl_rpc.o hdl_info_irx.o editor.o timer.o jpgviewer.o icon.o lang.o\
font_uLE.o makeicon.o chkesr.o sior_irx.o allowdvdv_irx.o
Expand Down Expand Up @@ -60,6 +60,12 @@ mcman_irx.s: $(PS2SDK)/iop/irx/mcman.irx
mcserv_irx.s: $(PS2SDK)/iop/irx/mcserv.irx
$(BIN2S) $< $@ mcserv_irx

extflash_irx.s: $(PS2SDK)/iop/irx/extflash.irx
$(BIN2S) $< $@ extflash_irx

xfromman_irx.s: $(PS2SDK)/iop/irx/xfromman.irx
$(BIN2S) $< $@ xfromman_irx

usbd_irx.s: $(PS2SDK)/iop/irx/usbd.irx
$(BIN2S) $< $@ usbd_irx

Expand Down
50 changes: 50 additions & 0 deletions filer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,52 @@ int readHDD(const char *path, FILEINFO *info, int max)
//------------------------------
//endfunc readHDD
//--------------------------------------------------------------
int readXFROM(const char *path, FILEINFO *info, int max)
{
iox_dirent_t dirbuf;
char dir[MAX_PATH];
int i = 0, fd;
volatile int j;

loadFlashModules();

strcpy(dir, path);
if ((fd = fileXioDopen(path)) < 0)
return 0;

while (fileXioDread(fd, &dirbuf) > 0) {
if (dirbuf.stat.mode & FIO_S_IFDIR &&
(!strcmp(dirbuf.name, ".") || !strcmp(dirbuf.name, "..")))
continue; //Skip pseudopaths "." and ".."

strcpy(info[i].name, dirbuf.name);
clear_mcTable(&info[i].stats);
if (dirbuf.stat.mode & FIO_S_IFDIR) {
info[i].stats.AttrFile = MC_ATTR_norm_folder;
} else if (dirbuf.stat.mode & FIO_S_IFREG) {
info[i].stats.AttrFile = MC_ATTR_norm_file;
info[i].stats.FileSizeByte = dirbuf.stat.size;
info[i].stats.Reserve2 = dirbuf.stat.hisize;
} else
continue; //Skip entry which is neither a file nor a folder
strncpy((char *)info[i].stats.EntryName, info[i].name, 32);
memcpy((void *)&info[i].stats._Create, dirbuf.stat.ctime, 8);
memcpy((void *)&info[i].stats._Modify, dirbuf.stat.mtime, 8);
i++;
if (i == max)
break;
}

fileXioDclose(fd);

size_valid = 1;
time_valid = 1;

return i;
}
//------------------------------
//endfunc readXFROM
//--------------------------------------------------------------
void scan_USB_mass(void)
{
int i;
Expand Down Expand Up @@ -1294,6 +1340,8 @@ int getDir(const char *path, FILEINFO *info)
n = readHOST(path, info, max);
else if (!strncmp(path, "vmc", 3))
n = readVMC(path, info, max);
else if (!strncmp(path, "xfrom", 3))
n = readXFROM(path, info, max);
else
return 0;

Expand Down Expand Up @@ -3077,6 +3125,8 @@ int setFileList(const char *path, const char *ext, FILEINFO *files, int cnfmode)
files[nfiles++].stats.AttrFile = sceMcFileAttrSubdir;
}
}
strcpy(files[nfiles].name, "xfrom0:");
files[nfiles++].stats.AttrFile = sceMcFileAttrSubdir;
if (cnfmode < 2) {
//This condition blocks use of MISC pseudo-device for drivers and skins
//And allows this device only for launch keys and for normal browsing
Expand Down
2 changes: 2 additions & 0 deletions lang.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,5 +375,7 @@ lang(0, Net_Config, "Net Config")
// New status message for HDD information read, when there are too many partitions.
lang(326, HDD_Information_Read_Overflow, "HDD Information Read (truncated)")
//---------------------------------------------------------------------------
lang(327, Loading_Flash_Modules, "Loading Flash Modules...")
//---------------------------------------------------------------------------
//End of file: lang.h
//---------------------------------------------------------------------------
33 changes: 33 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ extern u8 sior_irx[];
extern int size_sior_irx;
extern u8 allowdvdv_irx[];
extern int size_allowdvdv_irx;
extern u8 extflash_irx[];
extern int size_extflash_irx;
extern u8 xfromman_irx[];
extern int size_xfromman_irx;

//#define DEBUG
#ifdef DEBUG
Expand Down Expand Up @@ -111,6 +115,7 @@ char netConfig[IPCONF_MAX_LEN + 64]; //Adjust size as needed
//State of module collections
static u8 have_NetModules = 0;
static u8 have_HDD_modules = 0;
static u8 have_Flash_modules = 0;
//State of Uncheckable Modules (invalid header)
static u8 have_cdvd = 0;
static u8 have_usbd = 0;
Expand Down Expand Up @@ -736,6 +741,14 @@ static void load_ps2atad(void)
//------------------------------
//endfunc load_ps2atad
//---------------------------------------------------------------------------
static void load_pflash(void)
{
SifExecModuleBuffer(extflash_irx, size_extflash_irx, 0, NULL, NULL);
SifExecModuleBuffer(xfromman_irx, size_xfromman_irx, 0, NULL, NULL);
}
//------------------------------
//endfunc load_pflash
//---------------------------------------------------------------------------
void load_ps2host(void)
{
int ret;
Expand Down Expand Up @@ -1230,6 +1243,19 @@ void loadHddModules(void)
//------------------------------
//endfunc loadHddModules
//---------------------------------------------------------------------------
void loadFlashModules(void)
{
if (!have_Flash_modules) {
if (!is_early_init) //Do not draw any text before the UI is initialized.
drawMsg(LNG(Loading_Flash_Modules));
setupPowerOff();
load_pflash();
have_Flash_modules = TRUE;
}
}
//------------------------------
//endfunc loadFlashModules
//---------------------------------------------------------------------------
// Load Network modules by EP (modified by RA)
//------------------------------
static void loadNetModules(void)
Expand Down Expand Up @@ -1716,6 +1742,12 @@ static void Execute(char *pathin)
*p = 0;
goto ELFchecked;

} else if (!strncmp(path, "xfrom", 5)) {
loadFlashModules();
if ((t = checkELFheader(path)) <= 0)
goto ELFnotFound;
strcpy(fullpath, path);
goto ELFchecked;
} else if (!strncmp(path, "mass", 4)) {
if ((t = checkELFheader(path)) <= 0)
goto ELFnotFound;
Expand Down Expand Up @@ -2035,6 +2067,7 @@ static void Reset()
have_ps2kbd = 0;
have_NetModules = 0;
have_HDD_modules = 0;
have_Flash_modules = 0;

loadBasicModules();
loadCdModules();
Expand Down

0 comments on commit f75a19c

Please sign in to comment.