diff --git a/Makefile b/Makefile index 87728fe..8f71039 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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 @@ -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 diff --git a/include/common.h b/include/common.h index 4687902..9d4702a 100644 --- a/include/common.h +++ b/include/common.h @@ -8,6 +8,9 @@ enum #ifdef MX4SIO SOURCE_MX4SIO, #endif +#ifdef HDD_BD + SOURCE_HDD_BD, +#endif #ifdef HDD SOURCE_HDD, #endif @@ -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 @@ -57,6 +63,9 @@ static const char *SOURCES[SOURCE_COUNT] = { #ifdef MX4SIO "mx4sio", #endif +#ifdef HDD_BD + "hdd_bd", +#endif #ifdef HDD "hdd", #endif diff --git a/include/irx_import.h b/include/irx_import.h index a10ea3f..da2a006 100644 --- a/include/irx_import.h +++ b/include/irx_import.h @@ -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 diff --git a/include/main.h b/include/main.h index b28e2f9..29091c5 100644 --- a/include/main.h +++ b/include/main.h @@ -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 diff --git a/src/elf.c b/src/elf.c index 8981bd4..5907c5a 100644 --- a/src/elf.c +++ b/src/elf.c @@ -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); diff --git a/src/main.c b/src/main.c index 3f0b3d6..d27e706 100644 --- a/src/main.c +++ b/src/main.c @@ -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 @@ -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); @@ -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'; + } +#endif #ifdef MX4SIO } else if (!strncmp("massX:", path, 6)) { - int x = LookForBDMDevice(); + int x = LookForBDMDevice("sdc"); if (x >= 0) path[4] = '0' + x; #endif @@ -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]; @@ -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; } } @@ -577,7 +583,6 @@ int LookForBDMDevice(void) } #endif - #ifdef FILEXIO int LoadFIO(void) { @@ -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;