Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
israpps committed Jul 15, 2024
1 parent e31a9a3 commit 8884c2f
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 42 deletions.
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ UDPTTY ?= 0
MX4SIO ?= 0
SIO2MAN ?= 0
PPC_UART ?= 0
SD2PSX ?= 0
DEBUG ?= 0
LCDVD ?= LATEST#or LEGACY
# ----------------------------- #
.SILENT:

BIN_NAME = $(HAS_EXFAT)$(HAS_DS34)$(HAS_ETH)$(HAS_SMB)$(HAS_DVRP)$(HAS_XFROM)$(HAS_MX4SIO)$(HAS_EESIO)$(HAS_UDPTTY)$(HAS_PPCTTY)$(HAS_IOP_RESET)
BIN_NAME = $(HAS_EXFAT)$(HAS_DS34)$(HAS_ETH)$(HAS_SMB)$(HAS_DVRP)$(HAS_XFROM)$(HAS_MX4SIO)$(HAS_SD2PSX)$(HAS_EESIO)$(HAS_UDPTTY)$(HAS_PPCTTY)$(HAS_IOP_RESET)
ifeq ($(DEBUG), 0)
EE_BIN = UNC-BOOT$(BIN_NAME).ELF
EE_BIN_PKD = BOOT$(BIN_NAME).ELF
Expand Down Expand Up @@ -62,9 +63,17 @@ endif

ifeq ($(XFROM),1)
HAS_XFROM = -XFROM
GENERIC_READDIR = 1
EE_CFLAGS += -DXFROM
endif

ifeq ($(SD2PSX),1)
HAS_SD2PSX = -SD2PSX
GENERIC_READDIR = 1
EE_CFLAGS += -DSUPPORT_SPECIAL_MEMCARDS
EE_OBJS += sd2psxman.o
endif

ifeq ($(DS34),1)
EE_OBJS += ds34usb.o libds34usb.a ds34bt.o libds34bt.a pad_ds34.o
HAS_DS34 = -DS34
Expand Down Expand Up @@ -98,6 +107,10 @@ else
EE_LIBS += -lpad
endif

ifeq ($(GENERIC_READDIR),1)
EE_CFLAGS += -DGENERIC_READDIR
endif

ifeq ($(SIO_DEBUG),1)
EE_CFLAGS += -DSIO_DEBUG
HAS_EESIO = -SIO_DEBUG
Expand Down
3 changes: 3 additions & 0 deletions include/launchelf.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@

#define TRUE 1
#define FALSE 0
#define MODULE_LOADED_PENDING FALSE
#define MODULE_LOADED_SUCCESS 1
#define MODULE_LOADED_FAILURE 2

enum { // cnfmode values for getFilePath in browsing for configurable file paths
NON_CNF = 0, // Normal browser mode, not configuration mode
Expand Down
32 changes: 23 additions & 9 deletions src/filer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1233,20 +1233,18 @@ int readHDDDVRP(const char *path, FILEINFO *info, int max)
//endfunc readHDDDVRP
//--------------------------------------------------------------
#endif
#ifdef XFROM
int readXFROM(const char *path, FILEINFO *info, int max)
#ifdef GENERIC_READDIR
int genericReadDir(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)
{
DPRINTF("ERROR: Cannot open path '%s'\n", path);
DPRINTF("%s: Cannot open path '%s'\n", __FUNCTION__, path);
return 0;
}

Expand All @@ -1265,7 +1263,7 @@ int readXFROM(const char *path, FILEINFO *info, int max)
info[i].stats.Reserve2 = dirbuf.stat.hisize;
} else
{
DPRINTF("ERROR: Skipping entry wich is neither file or folder '%s'\n", path);
DPRINTF("%s: Skipping entry wich is neither file or folder '%s'\n", __FUNCTION__, path);
continue; //Skip entry which is neither a file nor a folder
}
strncpy((char *)info[i].stats.EntryName, info[i].name, 32);
Expand All @@ -1285,7 +1283,7 @@ int readXFROM(const char *path, FILEINFO *info, int max)
}
#endif
//------------------------------
//endfunc readXFROM
//endfunc genericReadDir
//--------------------------------------------------------------
#ifndef USBMASS_IOCTL_GET_DRIVERNAME
#define USBMASS_IOCTL_GET_DRIVERNAME 0x0003
Expand Down Expand Up @@ -1542,8 +1540,16 @@ int getDir(const char *path, FILEINFO *info)
n = readHOST(path, info, max);
#endif
#ifdef XFROM
else if (!strncmp(path, "xfrom", 5))
n = readXFROM(path, info, max);
else if (!strncmp(path, "xfrom", 5)) {
loadFlashModules();
n = genericReadDir(path, info, max);
}
#endif
#ifdef SUPPORT_SPECIAL_MEMCARDS
else if (!strncmp(path, "mmc", 5)) {
loadSD2PSXMAN();
n = genericReadDir(path, info, max);
}
#endif
else if (!strncmp(path, "vmc", 3))
n = readVMC(path, info, max);
Expand Down Expand Up @@ -3498,6 +3504,14 @@ int setFileList(const char *path, const char *ext, FILEINFO *files, int cnfmode)
files[nfiles++].stats.AttrFile = sceMcFileAttrSubdir;
#ifdef MX4SIO
}
#endif
#ifdef SUPPORT_SPECIAL_MEMCARDS
if (have_sd2psxman != MODULE_LOADED_FAILURE) {
strcpy(files[nfiles].name, "mmc" "0:");
files[nfiles++].stats.AttrFile = sceMcFileAttrSubdir;
strcpy(files[nfiles].name, "mmc" "1:");
files[nfiles++].stats.AttrFile = sceMcFileAttrSubdir;
}
#endif
strcpy(files[nfiles].name, "hdd0:");
files[nfiles++].stats.AttrFile = sceMcFileAttrSubdir;
Expand Down
83 changes: 51 additions & 32 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ IMPORT_BIN2C(ps2netfs_irx);
IMPORT_BIN2C(ps2ftpd_irx);
#endif

#ifdef SUPPORT_SPECIAL_MEMCARDS
IMPORT_BIN2C(sd2psxman_irx);
#endif

#ifdef IOPTRAP
IMPORT_BIN2C(ioptrap_irx);
#endif
Expand Down Expand Up @@ -129,49 +133,54 @@ char gw[16] = "192.168.0.1";

char netConfig[IPCONF_MAX_LEN + 64]; //Adjust size as needed

u8 GetModuleStatus(int id, int ret) {return (id > 0 && ret != 1) ? MODULE_LOADED_SUCCESS : MODULE_LOADED_FAILURE;}

//State of module collections
static u8 have_HDD_modules = 0;
static u8 have_HDD_modules = MODULE_LOADED_PENDING;
//State of Uncheckable Modules (invalid header)
static u8 have_cdvd = 0;
static u8 have_usbd = 0;
static u8 have_cdvd = MODULE_LOADED_PENDING;
static u8 have_usbd = MODULE_LOADED_PENDING;
#ifdef DS34
static u8 have_ds34 = 0;
static u8 have_ds34 = MODULE_LOADED_PENDING;
#endif
static u8 have_usb_mass = 0;
static u8 have_usb_mass = MODULE_LOADED_PENDING;

static u8 have_ps2smap = 0;
static u8 have_ps2host = 0;
static u8 have_ps2ip = 0;
static u8 have_NetModules = 0;
static u8 have_ps2netfs = 0;
static u8 have_ps2smap = MODULE_LOADED_PENDING;
static u8 have_ps2host = MODULE_LOADED_PENDING;
static u8 have_ps2ip = MODULE_LOADED_PENDING;
static u8 have_NetModules = MODULE_LOADED_PENDING;
static u8 have_ps2netfs = MODULE_LOADED_PENDING;

static u8 have_ps2ftpd = 0;
static u8 have_ps2kbd = 0;
static u8 have_hdl_info = 0;
static u8 have_ps2ftpd = MODULE_LOADED_PENDING;
static u8 have_ps2kbd = MODULE_LOADED_PENDING;
static u8 have_hdl_info = MODULE_LOADED_PENDING;
//State of Checkable Modules (valid header)
static u8 have_poweroff = 0;
static u8 have_ps2dev9 = 0;
static u8 have_ps2atad = 0;
static u8 have_ps2hdd = 0;
static u8 have_ps2fs = 0;
static u8 have_smbman = 0;
static u8 have_vmc_fs = 0;
static u8 have_poweroff = MODULE_LOADED_PENDING;
static u8 have_ps2dev9 = MODULE_LOADED_PENDING;
static u8 have_ps2atad = MODULE_LOADED_PENDING;
static u8 have_ps2hdd = MODULE_LOADED_PENDING;
static u8 have_ps2fs = MODULE_LOADED_PENDING;
static u8 have_smbman = MODULE_LOADED_PENDING;
static u8 have_vmc_fs = MODULE_LOADED_PENDING;

#ifdef XFROM
static u8 have_Flash_modules = 0;
static u8 have_Flash_modules = MODULE_LOADED_PENDING;
#endif
#ifdef SUPPORT_SPECIAL_MEMCARDS
u8 have_sd2psxman = MODULE_LOADED_PENDING;
#endif

#ifdef MX4SIO
u8 mx4sio_driver_running = 0;
#endif

//State of whether DEV9 was successfully loaded or not.
static u8 ps2dev9_loaded = 0;
static u8 ps2dev9_loaded = MODULE_LOADED_PENDING;

u8 console_is_PSX = 0;
#ifdef DVRP
static u8 have_DVRP_HDD_modules = 0;
static u8 have_dvrdrv = 0;
static u8 have_dvrfile = 0;
static u8 have_dvrdrv = MODULE_LOADED_PENDING;
static u8 have_dvrfile = MODULE_LOADED_PENDING;
#endif
//State of whether the UI has been initialized.
//Use this to determine whether code that loads a device's driver(s) can print onto the screen.
Expand Down Expand Up @@ -897,11 +906,12 @@ static void load_ps2atad(void)
#ifdef XFROM
static void load_pflash(void)
{
int ID;
ID = SifLoadModule("rom0:PFLASH", 0, NULL);
int ID, RET;
ID = SifLoadStartModule("rom0:PFLASH", 0, NULL, &RET);
DPRINTF(" [rom0:PFLASH]: ID=%d\n", ID);
ID = SifLoadModule("rom0:PXFROMMAN", 0, NULL);
ID = SifLoadStartModule("rom0:PXFROMMAN", 0, NULL, &RET);
DPRINTF(" [rom0:PXFROMMAN]: ID=%d\n", ID);
have_Flash_modules = GetModuleStatus(ID, RET);
}
//------------------------------
//endfunc load_pflash
Expand Down Expand Up @@ -1546,12 +1556,21 @@ void loadFlashModules(void)
load_ps2dev9();
setupPowerOff();
load_pflash();
have_Flash_modules = TRUE;
}
}
//------------------------------
//endfunc loadFlashModules
//---------------------------------------------------------------------------
#endif
#ifdef SUPPORT_SPECIAL_MEMCARDS
void loadSD2PSXMAN(void)
{
if (!have_sd2psxman) {
if (!is_early_init) //Do not draw any text before the UI is initialized.
drawMsg("SD2PSXMAN.IRX");
int ret, ID;
ID = SifExecModuleBuffer(sd2psxman_irx, size_sd2psxman_irx, 0, NULL, &ret);
DPRINTF(" [SD2PSXMAN]: ID=%d, ret=%d\n", ID, ret);
have_sd2psxman = GetModuleStatus(ID, ret);
}
}
#endif
#ifdef DVRP
void loadDVRPHddModules(void)
Expand Down

0 comments on commit 8884c2f

Please sign in to comment.