Skip to content

Commit

Permalink
BDM: add MX4SIO support
Browse files Browse the repository at this point in the history
  • Loading branch information
rickgaiser authored and uyjulian committed Jul 21, 2021
1 parent 54f85e6 commit 883fc18
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ MISC_OBJS = icon_sys_A.o icon_sys_J.o icon_sys_C.o conf_theme_OPL.o \
boot.o cancel.o confirm.o cursor.o message.o transition.o

IOP_OBJS = iomanx.o filexio.o ps2fs.o usbd.o bdmevent.o \
bdm.o bdmfs_vfat.o usbmass_bd.o iLinkman.o IEEE1394_bd.o \
bdm.o bdmfs_vfat.o usbmass_bd.o iLinkman.o IEEE1394_bd.o mx4sio_bd.o \
ps2atad.o hdpro_atad.o poweroff.o ps2hdd.o xhdd.o genvmc.o lwnbdsvr.o \
ps2dev9.o smsutils.o ps2ip.o smap.o isofs.o nbns-iop.o \
sio2man.o padman.o mcman.o mcserv.o \
Expand Down Expand Up @@ -530,13 +530,19 @@ $(EE_ASM_DIR)usbmass_bd.s: $(PS2SDK)/iop/irx/usbmass_bd.irx | $(EE_ASM_DIR)

$(EE_ASM_DIR)IEEE1394_bd.s: $(PS2SDK)/iop/irx/IEEE1394_bd.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ IEEE1394_bd_irx

$(EE_ASM_DIR)mx4sio_bd.s: $(PS2SDK)/iop/irx/mx4sio_bd.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ mx4sio_bd_irx
else
# block device drivers without printf's
$(EE_ASM_DIR)usbmass_bd.s: $(PS2SDK)/iop/irx/usbmass_bd_mini.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ usbmass_bd_irx

$(EE_ASM_DIR)IEEE1394_bd.s: $(PS2SDK)/iop/irx/IEEE1394_bd_mini.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ IEEE1394_bd_irx

$(EE_ASM_DIR)mx4sio_bd.s: $(PS2SDK)/iop/irx/mx4sio_bd_mini.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ mx4sio_bd_irx
endif

modules/bdmevent/bdmevent.irx: modules/bdmevent
Expand Down
1 change: 1 addition & 0 deletions ee_core/include/ee_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ extern char GameID[16];
extern int GameMode;
enum GAME_MODE {
BDM_ILK_MODE,
BDM_M4S_MODE,
BDM_USB_MODE,
ETH_MODE,
HDD_MODE,
Expand Down
5 changes: 4 additions & 1 deletion ee_core/include/modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ enum OPL_MODULE_ID {
OPL_MODULE_ID_ILINK,
OPL_MODULE_ID_ILINKBD,

// SMB mode modules
//mx4sio mode modules
OPL_MODULE_ID_MX4SIOBD,

//SMB mode modules
OPL_MODULE_ID_SMSTCPIP,
OPL_MODULE_ID_SMAP,
OPL_MODULE_ID_SMBINIT,
Expand Down
3 changes: 3 additions & 0 deletions ee_core/src/iopmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ static void ResetIopSpecial(const char *args, unsigned int arglen)
LoadOPLModule(OPL_MODULE_ID_ILINK, 0, 0, NULL);
LoadOPLModule(OPL_MODULE_ID_ILINKBD, 0, 0, NULL);
break;
case BDM_M4S_MODE:
LoadOPLModule(OPL_MODULE_ID_MX4SIOBD, 0, 0, NULL);
break;
};
}

Expand Down
2 changes: 2 additions & 0 deletions ee_core/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ static int eecoreInit(int argc, char **argv)
p = _strtok(argv[i], " ");
if (!_strncmp(argv[i], "BDM_ILK_MODE", 12))
GameMode = BDM_ILK_MODE;
else if (!_strncmp(argv[i], "BDM_M4S_MODE", 12))
GameMode = BDM_M4S_MODE;
else if (!_strncmp(p, "BDM_USB_MODE", 12))
GameMode = BDM_USB_MODE;
else if (!_strncmp(p, "ETH_MODE", 8))
Expand Down
3 changes: 3 additions & 0 deletions include/extern_irx.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ extern int size_resetspu_irx;
extern void *sio2man_irx;
extern int size_sio2man_irx;

extern void *mx4sio_bd_irx;
extern int size_mx4sio_bd_irx;

extern void *smap_irx;
extern int size_smap_irx;

Expand Down
5 changes: 5 additions & 0 deletions src/bdmsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ void bdmLoadModules(void)
// Load Optional Block Device drivers
bdmLoadBlockDeviceModules();

// Load MX4SIO Block Device drivers
sysLoadModuleBuffer(&mx4sio_bd_irx, size_mx4sio_bd_irx, 0, NULL);

sysLoadModuleBuffer(&bdmevent_irx, size_bdmevent_irx, 0, NULL);
SifAddCmdHandler(0, &bdmEventHandler, NULL);

Expand Down Expand Up @@ -378,6 +381,8 @@ static void bdmLaunchGame(int id, config_set_t *configSet)
sysLaunchLoaderElf(filename, "BDM_USB_MODE", irx_size, irx, size_mcemu_irx, &bdm_mcemu_irx, EnablePS2Logo, compatmask);
else if (!strcmp(bdmDriver, "sd") && strlen(bdmDriver) == 2)
sysLaunchLoaderElf(filename, "BDM_ILK_MODE", irx_size, irx, size_mcemu_irx, &bdm_mcemu_irx, EnablePS2Logo, compatmask);
else if (!strcmp(bdmDriver, "sdc") && strlen(bdmDriver) == 3)
sysLaunchLoaderElf(filename, "BDM_M4S_MODE", irx_size, irx, size_mcemu_irx, &bdm_mcemu_irx, EnablePS2Logo, compatmask);
}

static config_set_t *bdmGetConfig(int id)
Expand Down
7 changes: 7 additions & 0 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ void sysExecExit(void)
#define CORE_IRX_DEBUG 0x20
#define CORE_IRX_DECI2 0x40
#define CORE_IRX_ILINK 0x80
#define CORE_IRX_MX4SIO 0x100

typedef struct
{
Expand Down Expand Up @@ -439,6 +440,8 @@ static unsigned int sendIrxKernelRAM(const char *startup, const char *mode_str,
modules |= CORE_IRX_USB;
else if (!strcmp(mode_str, "BDM_ILK_MODE"))
modules |= CORE_IRX_ILINK;
else if (!strcmp(mode_str, "BDM_M4S_MODE"))
modules |= CORE_IRX_MX4SIO;
else if (!strcmp(mode_str, "ETH_MODE"))
modules |= CORE_IRX_ETH | CORE_IRX_SMB;
else
Expand Down Expand Up @@ -482,6 +485,10 @@ static unsigned int sendIrxKernelRAM(const char *startup, const char *mode_str,
irxptr_tab[modcount].info = size_IEEE1394_bd_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_ILINKBD);
irxptr_tab[modcount++].ptr = (void *)&IEEE1394_bd_irx;
}
if (modules & CORE_IRX_MX4SIO) {
irxptr_tab[modcount].info = size_mx4sio_bd_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_MX4SIOBD);
irxptr_tab[modcount++].ptr = (void *)&mx4sio_bd_irx;
}
if (modules & CORE_IRX_ETH) {
irxptr_tab[modcount].info = size_smap_ingame_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_SMAP);
irxptr_tab[modcount++].ptr = (void *)&smap_ingame_irx;
Expand Down

0 comments on commit 883fc18

Please sign in to comment.