Skip to content

Commit 36b6550

Browse files
authored
Merge pull request ps2homebrew#444 from KrahJohlito/bdm
BDM: Make loading block device modules other than USB optional
2 parents 474fef8 + 5d24ec8 commit 36b6550

File tree

8 files changed

+40
-6
lines changed

8 files changed

+40
-6
lines changed

Diff for: include/config.h

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ enum CONFIG_INDEX {
8787
#define CONFIG_OPL_HDD_MODE "hdd_mode"
8888
#define CONFIG_OPL_ETH_MODE "eth_mode"
8989
#define CONFIG_OPL_APP_MODE "app_mode"
90+
#define CONFIG_OPL_ENABLE_FW "enable_firewire"
9091
#define CONFIG_OPL_SWAP_SEL_BUTTON "swap_select_btn"
9192
#define CONFIG_OPL_PARENTAL_LOCK_PWD "parental_lock_password"
9293
#define CONFIG_OPL_SFX "enable_sfx"

Diff for: include/dialogs.h

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ enum UI_ITEMS {
3434
CFG_HDDMODE,
3535
CFG_ETHMODE,
3636
CFG_APPMODE,
37+
CFG_ENABLEFW,
3738
CFG_LASTPLAYED,
3839
CFG_LBL_AUTOSTARTLAST,
3940
CFG_AUTOSTARTLAST,

Diff for: include/lang.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ enum _STR_IDS {
6565
_STR_SAVING_SETTINGS,
6666
_STR_START_DEVICE,
6767
_STR_REFRESH,
68-
_STR_USBMODE,
68+
_STR_BDMMODE,
6969
_STR_HDDMODE,
7070
_STR_ETHMODE,
7171
_STR_APPMODE,

Diff for: include/opl.h

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ extern int gHDDStartMode;
114114
extern int gETHStartMode;
115115
extern int gAPPStartMode;
116116

117+
extern int gEnableFW;
118+
117119
extern int gAutosort;
118120
extern int gAutoRefresh;
119121
extern int gEnableNotifications;

Diff for: src/bdmsupport.c

+17-3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ static int bdmGameCount = 0;
2323
static base_game_info_t *bdmGames;
2424
static char bdmDriver[5];
2525

26+
static int fireWireModLoaded = 0;
27+
2628
// forward declaration
2729
static item_list_t bdmGameList;
2830

@@ -67,6 +69,17 @@ static void bdmEventHandler(void *packet, void *opt)
6769
BdmGeneration++;
6870
}
6971

72+
static void bdmLoadBlockDeviceModules(void)
73+
{
74+
if (gEnableFW && !fireWireModLoaded) {
75+
// Load iLink Block Device drivers
76+
sysLoadModuleBuffer(&iLinkman_irx, size_iLinkman_irx, 0, NULL);
77+
sysLoadModuleBuffer(&IEEE1394_bd_irx, size_IEEE1394_bd_irx, 0, NULL);
78+
79+
fireWireModLoaded = 1;
80+
}
81+
}
82+
7083
void bdmLoadModules(void)
7184
{
7285
LOG("BDMSUPPORT LoadModules\n");
@@ -81,9 +94,8 @@ void bdmLoadModules(void)
8194
sysLoadModuleBuffer(&usbd_irx, size_usbd_irx, 0, NULL);
8295
sysLoadModuleBuffer(&usbmass_bd_irx, size_usbmass_bd_irx, 0, NULL);
8396

84-
// Load iLink Block Device drivers
85-
sysLoadModuleBuffer(&iLinkman_irx, size_iLinkman_irx, 0, NULL);
86-
sysLoadModuleBuffer(&IEEE1394_bd_irx, size_IEEE1394_bd_irx, 0, NULL);
97+
// Load Optional Block Device drivers
98+
bdmLoadBlockDeviceModules();
8799

88100
sysLoadModuleBuffer(&bdmevent_irx, size_bdmevent_irx, 0, NULL);
89101
SifAddCmdHandler(0, &bdmEventHandler, NULL);
@@ -119,6 +131,8 @@ static int bdmNeedsUpdate(void)
119131
int result = 0;
120132
struct stat st;
121133

134+
ioPutRequest(IO_CUSTOM_SIMPLEACTION, &bdmLoadBlockDeviceModules);
135+
122136
if (bdmULSizePrev != -2 && OldGeneration == BdmGeneration)
123137
return 0;
124138
OldGeneration = BdmGeneration;

Diff for: src/dialogs.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,16 @@ struct UIItem diaConfig[] = {
194194
{UI_INT, CFG_HDDSPINDOWN, 1, 1, _STR_HINT_SPINDOWN, 0, 0, {.intvalue = {20, 20, 0, 20}}},
195195
{UI_SPLITTER},
196196

197-
{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_USBMODE}}},
197+
{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_BDMMODE}}},
198198
{UI_SPACER},
199199
{UI_ENUM, CFG_BDMMODE, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}},
200200
{UI_BREAK},
201201

202+
{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {"- FireWire", -1}}},
203+
{UI_SPACER},
204+
{UI_BOOL, CFG_ENABLEFW, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}},
205+
{UI_BREAK},
206+
202207
{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_HDDMODE}}},
203208
{UI_SPACER},
204209
{UI_ENUM, CFG_HDDMODE, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}},

Diff for: src/gui.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,9 @@ static int guiUpdater(int modified)
425425
diaGetInt(diaConfig, CFG_LASTPLAYED, &showAutoStartLast);
426426
diaSetVisible(diaConfig, CFG_LBL_AUTOSTARTLAST, showAutoStartLast);
427427
diaSetVisible(diaConfig, CFG_AUTOSTARTLAST, showAutoStartLast);
428+
429+
diaGetInt(diaConfig, CFG_BDMMODE, &gBDMStartMode);
430+
diaSetEnabled(diaConfig, CFG_ENABLEFW, gBDMStartMode);
428431
}
429432
return 0;
430433
}
@@ -465,6 +468,8 @@ void guiShowConfig()
465468
diaSetInt(diaConfig, CFG_ETHMODE, gETHStartMode);
466469
diaSetInt(diaConfig, CFG_APPMODE, gAPPStartMode);
467470

471+
diaSetInt(diaConfig, CFG_ENABLEFW, gEnableFW);
472+
468473
int ret = diaExecuteDialog(diaConfig, -1, 1, &guiUpdater);
469474
if (ret) {
470475
diaGetInt(diaConfig, CFG_DEBUG, &gDisableDebug);
@@ -483,11 +488,12 @@ void guiShowConfig()
483488
else
484489
gSelectButton = KEY_CIRCLE;
485490
diaGetInt(diaConfig, CFG_DEFDEVICE, &gDefaultDevice);
486-
diaGetInt(diaConfig, CFG_BDMMODE, &gBDMStartMode);
487491
diaGetInt(diaConfig, CFG_HDDMODE, &gHDDStartMode);
488492
diaGetInt(diaConfig, CFG_ETHMODE, &gETHStartMode);
489493
diaGetInt(diaConfig, CFG_APPMODE, &gAPPStartMode);
490494

495+
diaGetInt(diaConfig, CFG_ENABLEFW, &gEnableFW);
496+
491497
applyConfig(-1, -1);
492498
menuReinitMainMenu();
493499
}

Diff for: src/opl.c

+5
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ int gBDMStartMode;
145145
int gHDDStartMode;
146146
int gETHStartMode;
147147
int gAPPStartMode;
148+
int gEnableFW;
148149
int gAutosort;
149150
int gAutoRefresh;
150151
int gEnableNotifications;
@@ -850,6 +851,7 @@ static void _loadConfig()
850851
configGetInt(configOPL, CONFIG_OPL_HDD_MODE, &gHDDStartMode);
851852
configGetInt(configOPL, CONFIG_OPL_ETH_MODE, &gETHStartMode);
852853
configGetInt(configOPL, CONFIG_OPL_APP_MODE, &gAPPStartMode);
854+
configGetInt(configOPL, CONFIG_OPL_ENABLE_FW, &gEnableFW);
853855
configGetInt(configOPL, CONFIG_OPL_SFX, &gEnableSFX);
854856
configGetInt(configOPL, CONFIG_OPL_BOOT_SND, &gEnableBootSND);
855857
configGetInt(configOPL, CONFIG_OPL_SFX_VOLUME, &gSFXVolume);
@@ -999,6 +1001,7 @@ static void _saveConfig()
9991001
configSetInt(configOPL, CONFIG_OPL_HDD_MODE, gHDDStartMode);
10001002
configSetInt(configOPL, CONFIG_OPL_ETH_MODE, gETHStartMode);
10011003
configSetInt(configOPL, CONFIG_OPL_APP_MODE, gAPPStartMode);
1004+
configSetInt(configOPL, CONFIG_OPL_ENABLE_FW, gEnableFW);
10021005
configSetInt(configOPL, CONFIG_OPL_SFX, gEnableSFX);
10031006
configSetInt(configOPL, CONFIG_OPL_BOOT_SND, gEnableBootSND);
10041007
configSetInt(configOPL, CONFIG_OPL_SFX_VOLUME, gSFXVolume);
@@ -1588,6 +1591,8 @@ static void setDefaults(void)
15881591
gETHStartMode = START_MODE_DISABLED;
15891592
gAPPStartMode = START_MODE_DISABLED;
15901593

1594+
gEnableFW = 0;
1595+
15911596
frameCounter = 0;
15921597

15931598
gVMode = 0;

0 commit comments

Comments
 (0)