Skip to content

Commit

Permalink
BDM: add GUI option for MX4SIO
Browse files Browse the repository at this point in the history
  • Loading branch information
KrahJohlito authored and uyjulian committed Jul 21, 2021
1 parent 883fc18 commit 897a837
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 13 deletions.
4 changes: 2 additions & 2 deletions ee_core/include/modules.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ enum OPL_MODULE_ID {
OPL_MODULE_ID_ILINK,
OPL_MODULE_ID_ILINKBD,

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

//SMB mode modules
// SMB mode modules
OPL_MODULE_ID_SMSTCPIP,
OPL_MODULE_ID_SMAP,
OPL_MODULE_ID_SMBINIT,
Expand Down
1 change: 1 addition & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ enum CONFIG_INDEX {
#define CONFIG_OPL_ETH_MODE "eth_mode"
#define CONFIG_OPL_APP_MODE "app_mode"
#define CONFIG_OPL_ENABLE_FW "enable_firewire"
#define CONFIG_OPL_ENABLE_MX4SIO "enable_mx4sio"
#define CONFIG_OPL_SWAP_SEL_BUTTON "swap_select_btn"
#define CONFIG_OPL_PARENTAL_LOCK_PWD "parental_lock_password"
#define CONFIG_OPL_SFX "enable_sfx"
Expand Down
1 change: 1 addition & 0 deletions include/dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ enum UI_ITEMS {
CFG_ETHMODE,
CFG_APPMODE,
CFG_ENABLEFW,
CFG_ENABLEMX4SIO,
CFG_LASTPLAYED,
CFG_LBL_AUTOSTARTLAST,
CFG_AUTOSTARTLAST,
Expand Down
1 change: 1 addition & 0 deletions include/opl.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ extern int gETHStartMode;
extern int gAPPStartMode;

extern int gEnableFW;
extern int gEnableMX4SIO;

extern int gAutosort;
extern int gAutoRefresh;
Expand Down
11 changes: 8 additions & 3 deletions src/bdmsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ static base_game_info_t *bdmGames;
static char bdmDriver[5];

static int fireWireModLoaded = 0;
static int mx4sioModLoaded = 0;

// forward declaration
static item_list_t bdmGameList;
Expand Down Expand Up @@ -78,6 +79,13 @@ static void bdmLoadBlockDeviceModules(void)

fireWireModLoaded = 1;
}

if (gEnableMX4SIO && !mx4sioModLoaded) {
// Load MX4SIO Block Device drivers
sysLoadModuleBuffer(&mx4sio_bd_irx, size_mx4sio_bd_irx, 0, NULL);

mx4sioModLoaded = 1;
}
}

void bdmLoadModules(void)
Expand All @@ -97,9 +105,6 @@ 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
5 changes: 5 additions & 0 deletions src/dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ struct UIItem diaBlockDevicesConfig[] = {
{UI_BOOL, CFG_ENABLEFW, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}},
{UI_BREAK},

{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {"MX4SIO", -1}}},
{UI_SPACER},
{UI_BOOL, CFG_ENABLEMX4SIO, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}},
{UI_BREAK},

// buttons
{UI_OK, 0, 1, 1, -1, 0, 0, {.label = {NULL, _STR_OK}}},
{UI_BREAK},
Expand Down
2 changes: 2 additions & 0 deletions src/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,12 @@ static void guiShowBlockDeviceConfig(void)
int ret;

diaSetInt(diaBlockDevicesConfig, CFG_ENABLEFW, gEnableFW);
diaSetInt(diaBlockDevicesConfig, CFG_ENABLEMX4SIO, gEnableMX4SIO);

ret = diaExecuteDialog(diaBlockDevicesConfig, -1, 1, NULL);
if (ret) {
diaGetInt(diaBlockDevicesConfig, CFG_ENABLEFW, &gEnableFW);
diaGetInt(diaBlockDevicesConfig, CFG_ENABLEMX4SIO, &gEnableMX4SIO);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/opl.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ int gHDDStartMode;
int gETHStartMode;
int gAPPStartMode;
int gEnableFW;
int gEnableMX4SIO;
int gAutosort;
int gAutoRefresh;
int gEnableNotifications;
Expand Down Expand Up @@ -852,6 +853,7 @@ static void _loadConfig()
configGetInt(configOPL, CONFIG_OPL_ETH_MODE, &gETHStartMode);
configGetInt(configOPL, CONFIG_OPL_APP_MODE, &gAPPStartMode);
configGetInt(configOPL, CONFIG_OPL_ENABLE_FW, &gEnableFW);
configGetInt(configOPL, CONFIG_OPL_ENABLE_MX4SIO, &gEnableMX4SIO);
configGetInt(configOPL, CONFIG_OPL_SFX, &gEnableSFX);
configGetInt(configOPL, CONFIG_OPL_BOOT_SND, &gEnableBootSND);
configGetInt(configOPL, CONFIG_OPL_SFX_VOLUME, &gSFXVolume);
Expand Down Expand Up @@ -1002,6 +1004,7 @@ static void _saveConfig()
configSetInt(configOPL, CONFIG_OPL_ETH_MODE, gETHStartMode);
configSetInt(configOPL, CONFIG_OPL_APP_MODE, gAPPStartMode);
configSetInt(configOPL, CONFIG_OPL_ENABLE_FW, gEnableFW);
configSetInt(configOPL, CONFIG_OPL_ENABLE_MX4SIO, gEnableMX4SIO);
configSetInt(configOPL, CONFIG_OPL_SFX, gEnableSFX);
configSetInt(configOPL, CONFIG_OPL_BOOT_SND, gEnableBootSND);
configSetInt(configOPL, CONFIG_OPL_SFX_VOLUME, gSFXVolume);
Expand Down Expand Up @@ -1592,6 +1595,7 @@ static void setDefaults(void)
gAPPStartMode = START_MODE_DISABLED;

gEnableFW = 0;
gEnableMX4SIO = 0;

frameCounter = 0;

Expand Down
16 changes: 8 additions & 8 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,14 @@ void sysExecExit(void)
}

// Module bits
#define CORE_IRX_USB 0x01
#define CORE_IRX_ETH 0x02
#define CORE_IRX_SMB 0x04
#define CORE_IRX_HDD 0x08
#define CORE_IRX_VMC 0x10
#define CORE_IRX_DEBUG 0x20
#define CORE_IRX_DECI2 0x40
#define CORE_IRX_ILINK 0x80
#define CORE_IRX_USB 0x01
#define CORE_IRX_ETH 0x02
#define CORE_IRX_SMB 0x04
#define CORE_IRX_HDD 0x08
#define CORE_IRX_VMC 0x10
#define CORE_IRX_DEBUG 0x20
#define CORE_IRX_DECI2 0x40
#define CORE_IRX_ILINK 0x80
#define CORE_IRX_MX4SIO 0x100

typedef struct
Expand Down

0 comments on commit 897a837

Please sign in to comment.