Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ PSX ?= 0 # PSX DESR support
HDD ?= 0 #wether to add internal HDD support
MMCE ?= 0
MX4SIO ?= 0
HDD_BD ?= 0 # use ata_bd instead of ps2atad for HDD support
PROHBIT_DVD_0100 ?= 0 # prohibit the DVD Players v1.00 and v1.01 from being booted.
XCDVD_READKEY ?= 0 # Enable the newer sceCdReadKey checks, which are only supported by a newer CDVDMAN module.
UDPTTY ?= 0 # printf over UDP
Expand Down Expand Up @@ -100,6 +101,23 @@ ifeq ($(MMCE), 1)
endif
endif

ifeq ($(HDD), 1)
$(info --- compiling with HDD support)
ifeq ($(HDD_BD), 1)
EE_OBJS += ata_bd_irx.o
EE_CFLAGS += -DHDD_BD
else
EE_OBJS += ps2atad_irx.o
endif

EE_LIBS += -lpoweroff
EE_OBJS += ps2fs_irx.o ps2hdd_irx.o poweroff_irx.o
EE_CFLAGS += -DHDD
FILEXIO_NEED = 1
DEV9_NEED = 1
KELFTYPE = HDD
endif

ifeq ($(HOMEBREW_IRX), 1)
$(info --- enforcing usage of homebrew IRX modules)
USE_ROM_PADMAN = 0
Expand Down Expand Up @@ -161,16 +179,6 @@ else
$(info --- USB drivers will be external)
endif

ifeq ($(HDD), 1)
$(info --- compiling with HDD support)
EE_LIBS += -lpoweroff
EE_OBJS += ps2fs_irx.o ps2hdd_irx.o ps2atad_irx.o poweroff_irx.o
EE_CFLAGS += -DHDD
FILEXIO_NEED = 1
DEV9_NEED = 1
KELFTYPE = HDD
endif

ifeq ($(UDPTTY), 1)
$(info --- UDPTTY enabled)
EE_CFLAGS += -DUDPTTY
Expand Down
9 changes: 9 additions & 0 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ enum
#ifdef MX4SIO
SOURCE_MX4SIO,
#endif
#ifdef HDD_BD
SOURCE_HDD_BD,
#endif
#ifdef HDD
SOURCE_HDD,
#endif
Expand All @@ -33,6 +36,9 @@ char *CONFIG_PATHS[SOURCE_COUNT] = {
#ifdef MX4SIO
"massX:/PS2BBL/CONFIG.INI",
#endif
#ifdef HDD_BD
"massH:/PS2BBL/CONFIG.INI",
#endif
#ifdef HDD
"hdd0:__sysconf:pfs:/PS2BBL/CONFIG.INI",
#endif
Expand All @@ -57,6 +63,9 @@ static const char *SOURCES[SOURCE_COUNT] = {
#ifdef MX4SIO
"mx4sio",
#endif
#ifdef HDD_BD
"hdd_bd",
#endif
#ifdef HDD
"hdd",
#endif
Expand Down
4 changes: 4 additions & 0 deletions include/irx_import.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ IMPORT_BIN2C(fileXio_irx);

#ifdef HDD
IMPORT_BIN2C(poweroff_irx);
#ifdef HDD_BD
IMPORT_BIN2C(ata_bd_irx);
#else
IMPORT_BIN2C(ps2atad_irx);
#endif
IMPORT_BIN2C(ps2hdd_irx);
IMPORT_BIN2C(ps2fs_irx);
#endif
Expand Down
4 changes: 2 additions & 2 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ void poweroffCallback(void *arg);
#define MPART NULL
#endif

#ifdef MX4SIO
int LookForBDMDevice(void);
#if defined(MX4SIO) || defined(HDD_BD)
int LookForBDMDevice(char *driver_name);
#endif

#ifdef FILEXIO
Expand Down
2 changes: 1 addition & 1 deletion src/elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
void RunLoaderElf(const char *filename, const char *party)
{
DPRINTF("%s\n", __FUNCTION__);
if (party == NULL) {
if (party == NULL || strnlen(party, 2) == 0) {
DPRINTF("LoadELFFromFile(%s, 0, NULL)\n", filename);
DBGWAIT(2);
LoadELFFromFile(filename, 0, NULL);
Expand Down
42 changes: 26 additions & 16 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ int main(int argc, char *argv[])
scr_clear();
sleep(4);
}
#if defined(HDD) || defined(HDD_BD)
else if (LoadHDDIRX() < 0) // only load HDD crap if filexio and iomanx are up and running
{
scr_setbgcolor(0x0000ff);
scr_clear();
sleep(4);
}
#endif
#endif

#ifdef MMCE
Expand All @@ -109,15 +117,6 @@ int main(int argc, char *argv[])
DPRINTF(" [MX4SIO_BD]: ID=%d, ret=%d\n", j, x);
#endif

#ifdef HDD
else if (LoadHDDIRX() < 0) // only load HDD crap if filexio and iomanx are up and running
{
scr_setbgcolor(0x0000ff);
scr_clear();
sleep(4);
}
#endif

if ((fd = open("rom0:ROMVER", O_RDONLY)) >= 0) {
read(fd, ROMVER, sizeof(ROMVER));
close(fd);
Expand Down Expand Up @@ -474,9 +473,17 @@ char *CheckPath(char *path)
if (!MountParty(path))
return strstr(path, "pfs:");
#endif
#ifdef HDD_BD
} else if (!strncmp("massH:", path, 6)) {
int x = LookForBDMDevice("ata");
if (x >= 0) {
path[4] = '0' + x;
PART[0] = '\0';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is needed but I need to build a smaller test program to confirm what I think I'm seeing without it. getcwd appears to return something unexpected (ex. hdd0:__sysconf/mass0:athena instead of mass0:/athena) but I'm not certain that it's not something weird going on in Athena.

If having the partition argument present is doing this for ATA_BD devices, I suspect that MX4SIO and USB would both have a similar problem. I'll file a bug if I can reproduce on them.

}
#endif
#ifdef MX4SIO
} else if (!strncmp("massX:", path, 6)) {
int x = LookForBDMDevice();
int x = LookForBDMDevice("sdc");
if (x >= 0)
path[4] = '0' + x;
#endif
Expand Down Expand Up @@ -553,9 +560,8 @@ int LoadUSBIRX(void)
return 0;
}


#ifdef MX4SIO
int LookForBDMDevice(void)
#if defined(MX4SIO) || defined(HDD_BD)
int LookForBDMDevice(char *driver_name)
{
static char mass_path[] = "massX:";
static char DEVID[5];
Expand All @@ -567,8 +573,8 @@ int LookForBDMDevice(void)
int *intptr_ctl = (int *)DEVID;
*intptr_ctl = fileXioIoctl(dd, USBMASS_IOCTL_GET_DRIVERNAME, "");
close(dd);
if (!strncmp(DEVID, "sdc", 3)) {
DPRINTF("%s: Found MX4SIO device at mass%d:/\n", __func__, x);
if (!strncmp(DEVID, driver_name, 3)) {
DPRINTF("%s: Found %s device at mass%d:/\n", __func__, driver_name, x);
return x;
}
}
Expand All @@ -577,7 +583,6 @@ int LookForBDMDevice(void)
}
#endif


#ifdef FILEXIO
int LoadFIO(void)
{
Expand Down Expand Up @@ -665,8 +670,13 @@ int LoadHDDIRX(void)
poweroffSetCallback(&poweroffCallback, NULL);
DPRINTF("PowerOFF Callback installed...\n");

#ifdef HDD_BD
ID = SifExecModuleBuffer(ata_bd_irx, size_ata_bd_irx, 0, NULL, &RET);
DPRINTF(" [ATA_BD]: ID=%d, ret=%d\n", ID, RET);
#else
ID = SifExecModuleBuffer(&ps2atad_irx, size_ps2atad_irx, 0, NULL, &RET);
DPRINTF(" [ATAD]: ret=%d, ID=%d\n", RET, ID);
#endif
if (ID < 0 || RET == 1)
return -3;

Expand Down