-## Release types
+
+ Release types
+
Open PS2 Loader bundle included several types of the same OPL version. These
-types come with more or less features included.
+types come with more or fewer features included.
-| Type (can be a combination) | Description |
-| --------------------------- | ---------------------------------------------------------------------------------------------- |
-| "Release" | Regular OPL release with GSM, IGS, PADEMU, VMC, PS2RD Cheat Engine & Parental Controls. |
-| "DTL_T10000" | OPL for TOOLs (DevKit PS2) |
-| "IGS" | OPL with InGame Screenshot feature. |
-| "PADEMU" | OPL with Pad Emulation for DS3 & DS4. |
-| "RTL" | OPL with right to left language suppport. |
+| Type (can be a combination) | Description |
+| --------------------------- | --------------------------------------------------------------------------------------- |
+| `Release` | Regular OPL release with GSM, IGS, PADEMU, VMC, PS2RD Cheat Engine & Parental Controls. |
+| `DTL_T10000` | OPL for TOOLs (DevKit PS2) |
+| `IGS` | OPL with InGame Screenshot feature. |
+| `PADEMU` | OPL with Pad Emulation for DS3 & DS4. |
+| `RTL` | OPL with the right to left language support. |
-## How to use
+
+
+
+
+ How to use
+
OPL uses the following directory tree structure across HDD, SMB, and
USB modes:
-| Folder | Description | Modes |
-| ------ | ----------- | ----- |
-| "CD" | for games on CD media - i.e. blue-bottom discs | USB and SMB |
-| "DVD" | for DVD5 and DVD9 images if using the NTFS file system on USB or SMB ; DVD9 images must be split and placed into the device root if using the FAT32 file system on USB or SMB | USB and SMB |
-| "VMC" | for Virtual Memory Card images - from 8MB up to 64MB | all |
-| "CFG" | for saving per-game configuration files | all |
-| "ART" | for game art images | all |
-| "THM" | for themes support | all |
-| "LNG" | for translation support | all |
-| "CHT" | for cheats files | all |
-
-OPL will automatically create the above directory structure the first time you launch it and enable your favourite device.
-
-For HDD users, OPL will read hdd0:__common/OPL/conf_hdd.cfg for the config entry "hdd_partition" to use as your OPL partition.
-If not found a config file and a 128Mb +OPL partition will be created, you can edit the config if you wish to use/create a different partition.
+| Folder | Description | Modes |
+| ------ | ---------------------------------------------------- | ----------- |
+| `CD` | for games on CD media - i.e. blue-bottom discs | USB and SMB |
+| `DVD` | for DVD5 and DVD9 images if using the NTFS file system on USB or SMB; DVD9 images must be split and placed into the device root if using the FAT32 file system on USB or SMB | USB and SMB |
+| `VMC` | for Virtual Memory Card images - from 8MB up to 64MB | all |
+| `CFG` | for saving per-game configuration files | all |
+| `ART` | for game art images | all |
+| `THM` | for themes support | all |
+| `LNG` | for translation support | all |
+| `CHT` | for cheats files | all |
+
+OPL will automatically create the above directory structure the first time you launch it and enable your favorite device.
+
+For HDD users, OPL will read hdd0:\_\_common/OPL/conf_hdd.cfg for the config entry "hdd_partition" to use as your OPL partition.
+If not found a config file and a 128Mb +OPL partition will be created. You can edit the config if you wish to use/create a different partition.
All partitions created by OPL will be 128Mb (it is not recommended to enlarge partitions as it will break LBAs, instead remove and recreate manually with uLaunchELF at a larger size if needed).
-## USB
+
+
+
+
+ USB
+
Game files on USB must be perfectly defragmented either file by file or
by whole drive, and Dual Layer DVD9 images must be split to avoid the 4GB
-limitations of the FAT32 file system. We recommend Auslogics Disk Defrag
-for best defragging results.
-
-http://www.auslogics.com/en/software/disk-defrag/
+limitations of the FAT32 file system. We do not recommend using any programs.
+The best way for defragmenting - copy all files to pc, format USB, copy all files back.
+Repeat it once you faced defragmenting problem again.
You also need a PC program to convert or split games into USB Advance/Extreme
format, such as USBUtil 2.0.
-## SMB
+
+
-For loading games by SMB protocol you need to share a folder (ex: PS2SMB)
+
+ SMB
+
+
+For loading games by SMB protocol, you need to share a folder (ex: PS2SMB)
on the host machine or NAS device and make sure that it has full read and
write permissions. USB Advance/Extreme format is optional - \*.ISO images
-are supported using the folder structure above with the added bonus that
+are supported using the folder structure above with the bonus that
DVD9 images don't have to be split if your SMB device uses the NTFS or
EXT3/4 file system.
-## HDD
+
+
+
+
+ HDD
+
For PS2, 48-bit LBA internal HDDs up to 2TB are supported. They have to be
formatted with either HDLoader or uLaunchELF (uLaunchELF is recommended).
@@ -93,14 +116,19 @@ formatted with either HDLoader or uLaunchELF (uLaunchELF is recommended).
To launch OPL, you can use any of the existing methods for loading an
executable elf.
-## PS3
+
+
+
+
+ PS3
+
On PS3, you need an original SwapMagic 3.6+ or 3.8 disc (at the moment
there aren't any other options). The steps for loading OPL on a PS3 are:
-1. Rename OPNPS2LD.ELF to SMBOOT0.ELF
-2. Make a folder in root of USB device called SWAPMAGIC and copy SMBOOT0.ELF to it.
-3. Launch SwapMagic in PS3 and press UP+L1 then Open PS2 Loader should start.
+1. Rename OPNPS2LD.ELF to SMBOOT0.ELF
+2. Make a folder in the root of a USB device called SWAPMAGIC and copy SMBOOT0.ELF to it.
+3. Launch SwapMagic in PS3 and press UP+L1 then Open PS2 Loader should start.
There are 4 forms for launching elfs in SwapMagic.
@@ -111,8 +139,23 @@ SMBOOT3.ELF = UP + R2
Note: on PS3, only USB and SMB modes are supported.
-## Some notes for devs
+
+
+
+
+ Some notes for DEVS
+
+
+Open PS2 Loader needs the [**latest PS2SDK**](https://github.com/ps2dev/ps2sdk)
+
+
+
+
+
+ OPL Archive
+
-Open PS2 Loader needs the latest PS2SDK:
+Since 05/07/2021 every OPL build dispatched to the release section of this repository will be uploaded to a mega account, you can access the archive by clicking the mega badge on top of this readme
-https://github.com/ps2dev/ps2sdk
+
+
diff --git a/ee_core/include/ee_core.h b/ee_core/include/ee_core.h
index 72eb4186d..4cd6e1fd9 100644
--- a/ee_core/include/ee_core.h
+++ b/ee_core/include/ee_core.h
@@ -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,
diff --git a/ee_core/include/modules.h b/ee_core/include/modules.h
index fb0a0fbac..11a8f82d0 100644
--- a/ee_core/include/modules.h
+++ b/ee_core/include/modules.h
@@ -13,6 +13,9 @@ enum OPL_MODULE_ID {
OPL_MODULE_ID_ILINK,
OPL_MODULE_ID_ILINKBD,
+ // mx4sio mode modules
+ OPL_MODULE_ID_MX4SIOBD,
+
// SMB mode modules
OPL_MODULE_ID_SMSTCPIP,
OPL_MODULE_ID_SMAP,
diff --git a/ee_core/src/iopmgr.c b/ee_core/src/iopmgr.c
index 36fbb1911..5f54d7cdf 100644
--- a/ee_core/src/iopmgr.c
+++ b/ee_core/src/iopmgr.c
@@ -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;
};
}
diff --git a/ee_core/src/main.c b/ee_core/src/main.c
index bfa670024..d8250af17 100644
--- a/ee_core/src/main.c
+++ b/ee_core/src/main.c
@@ -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))
diff --git a/include/config.h b/include/config.h
index 827bd9499..333aa6809 100644
--- a/include/config.h
+++ b/include/config.h
@@ -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"
diff --git a/include/dialogs.h b/include/dialogs.h
index a045af43f..5437be2db 100644
--- a/include/dialogs.h
+++ b/include/dialogs.h
@@ -35,6 +35,7 @@ enum UI_ITEMS {
CFG_ETHMODE,
CFG_APPMODE,
CFG_ENABLEFW,
+ CFG_ENABLEMX4SIO,
CFG_LASTPLAYED,
CFG_LBL_AUTOSTARTLAST,
CFG_AUTOSTARTLAST,
@@ -43,6 +44,7 @@ enum UI_ITEMS {
CFG_BDMPREFIX,
CFG_ETHPREFIX,
CFG_HDDSPINDOWN,
+ BLOCKDEVICE_BUTTON,
ABOUT_TITLE,
ABOUT_BUILD_DETAILS,
@@ -192,5 +194,6 @@ extern struct UIItem diaAbout[];
extern struct UIItem diaVMC[];
extern struct UIItem diaNetCompatUpdate[];
extern struct UIItem diaParentalLockConfig[];
+extern struct UIItem diaBlockDevicesConfig[];
#endif
diff --git a/include/extern_irx.h b/include/extern_irx.h
index c82d27a57..1ca61eb21 100644
--- a/include/extern_irx.h
+++ b/include/extern_irx.h
@@ -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;
diff --git a/include/lang.h b/include/lang.h
index f7d37e904..2d143b84b 100644
--- a/include/lang.h
+++ b/include/lang.h
@@ -284,6 +284,7 @@ enum _STR_IDS {
_STR_INFO_DEVELOPER,
_STR_INFO_DESCRIPTION,
_STR_BDM_GAMES,
+ _STR_BLOCKDEVICE_SETTINGS,
_STR_CONTROLLER_SETTINGS,
LANG_STR_COUNT
diff --git a/include/opl.h b/include/opl.h
index 5101b1ae6..d99f3330e 100644
--- a/include/opl.h
+++ b/include/opl.h
@@ -115,6 +115,7 @@ extern int gETHStartMode;
extern int gAPPStartMode;
extern int gEnableFW;
+extern int gEnableMX4SIO;
extern int gAutosort;
extern int gAutoRefresh;
diff --git a/lng/lang_English.lng b/lng/lang_English.lng
index 3bea698d3..c9cc27eb0 100644
--- a/lng/lang_English.lng
+++ b/lng/lang_English.lng
@@ -301,4 +301,5 @@ Release
Developer
Description
BDM Games
+Select Block Devices
Controller Settings
diff --git a/src/bdmsupport.c b/src/bdmsupport.c
index 99fa6eec3..c30b46f60 100644
--- a/src/bdmsupport.c
+++ b/src/bdmsupport.c
@@ -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;
@@ -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)
@@ -378,6 +386,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)
diff --git a/src/dialogs.c b/src/dialogs.c
index b43d1b2fe..61d12571e 100644
--- a/src/dialogs.c
+++ b/src/dialogs.c
@@ -135,6 +135,33 @@ struct UIItem diaNetConfig[] = {
// end of dialog
{UI_TERMINATOR}};
+// Block Devices Settings Menu
+struct UIItem diaBlockDevicesConfig[] = {
+ {UI_LABEL, 0, 1, 1, -1, 0, 0, {.label = {NULL, _STR_BLOCKDEVICE_SETTINGS}}},
+ {UI_SPLITTER},
+
+ {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {"USB", -1}}},
+ {UI_SPACER},
+ {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_ON}}},
+ {UI_BREAK},
+
+ {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {"FireWire", -1}}},
+ {UI_SPACER},
+ {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},
+
+ // end of dialog
+ {UI_TERMINATOR}};
+
// Settings Menu
struct UIItem diaConfig[] = {
{UI_LABEL, 0, 1, 1, -1, 0, 0, {.label = {NULL, _STR_SETTINGS}}},
@@ -192,11 +219,8 @@ struct UIItem diaConfig[] = {
{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_BDMMODE}}},
{UI_SPACER},
{UI_ENUM, CFG_BDMMODE, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}},
- {UI_BREAK},
-
- {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {"- FireWire", -1}}},
{UI_SPACER},
- {UI_BOOL, CFG_ENABLEFW, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}},
+ {UI_BUTTON, BLOCKDEVICE_BUTTON, 1, 1, -1, 0, 0, {.label = {NULL, _STR_BLOCKDEVICE_SETTINGS}}},
{UI_BREAK},
{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_HDDMODE}}},
diff --git a/src/gui.c b/src/gui.c
index 50398fa44..0ba9aa780 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -417,6 +417,20 @@ void guiShowNetCompatUpdateSingle(int id, item_list_t *support, config_set_t *co
}
}
+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);
+ }
+}
+
static int guiUpdater(int modified)
{
int showAutoStartLast;
@@ -427,7 +441,7 @@ static int guiUpdater(int modified)
diaSetVisible(diaConfig, CFG_AUTOSTARTLAST, showAutoStartLast);
diaGetInt(diaConfig, CFG_BDMMODE, &gBDMStartMode);
- diaSetEnabled(diaConfig, CFG_ENABLEFW, gBDMStartMode);
+ diaSetVisible(diaConfig, BLOCKDEVICE_BUTTON, gBDMStartMode);
}
return 0;
}
@@ -459,12 +473,11 @@ void guiShowConfig()
diaSetInt(diaConfig, CFG_DEFDEVICE, gDefaultDevice);
diaSetInt(diaConfig, CFG_BDMMODE, gBDMStartMode);
+ diaSetVisible(diaConfig, BLOCKDEVICE_BUTTON, gBDMStartMode);
diaSetInt(diaConfig, CFG_HDDMODE, gHDDStartMode);
diaSetInt(diaConfig, CFG_ETHMODE, gETHStartMode);
diaSetInt(diaConfig, CFG_APPMODE, gAPPStartMode);
- diaSetInt(diaConfig, CFG_ENABLEFW, gEnableFW);
-
int ret = diaExecuteDialog(diaConfig, -1, 1, &guiUpdater);
if (ret) {
diaGetInt(diaConfig, CFG_DEBUG, &gDisableDebug);
@@ -483,7 +496,8 @@ void guiShowConfig()
diaGetInt(diaConfig, CFG_ETHMODE, &gETHStartMode);
diaGetInt(diaConfig, CFG_APPMODE, &gAPPStartMode);
- diaGetInt(diaConfig, CFG_ENABLEFW, &gEnableFW);
+ if (ret == BLOCKDEVICE_BUTTON)
+ guiShowBlockDeviceConfig();
applyConfig(-1, -1);
menuReinitMainMenu();
diff --git a/src/lang.c b/src/lang.c
index 38c00de2d..8ebacc4c4 100644
--- a/src/lang.c
+++ b/src/lang.c
@@ -288,6 +288,7 @@ static char *internalEnglish[LANG_STR_COUNT] = {
"Developer",
"Description",
"BDM Games",
+ "Select Block Devices",
"Controller Settings",
};
diff --git a/src/opl.c b/src/opl.c
index f71eb2fad..3371ffd2c 100644
--- a/src/opl.c
+++ b/src/opl.c
@@ -146,6 +146,7 @@ int gHDDStartMode;
int gETHStartMode;
int gAPPStartMode;
int gEnableFW;
+int gEnableMX4SIO;
int gAutosort;
int gAutoRefresh;
int gEnableNotifications;
@@ -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);
@@ -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);
@@ -1592,6 +1595,7 @@ static void setDefaults(void)
gAPPStartMode = START_MODE_DISABLED;
gEnableFW = 0;
+ gEnableMX4SIO = 0;
frameCounter = 0;
diff --git a/src/system.c b/src/system.c
index 016362988..c564e0dbd 100644
--- a/src/system.c
+++ b/src/system.c
@@ -352,14 +352,15 @@ 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
{
@@ -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
@@ -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;
@@ -907,19 +914,17 @@ int sysExecElf(const char *path)
int sysCheckMC(void)
{
- int dummy, ret;
-
- mcGetInfo(0, 0, &dummy, &dummy, &dummy);
- mcSync(0, NULL, &ret);
-
- if (-1 == ret || 0 == ret)
+ DIR *mc0_root_dir = opendir("mc0:");
+ if (mc0_root_dir != NULL) {
+ closedir(mc0_root_dir);
return 0;
+ }
- mcGetInfo(1, 0, &dummy, &dummy, &dummy);
- mcSync(0, NULL, &ret);
-
- if (-1 == ret || 0 == ret)
+ DIR *mc1_root_dir = opendir("mc1:");
+ if (mc1_root_dir != NULL) {
+ closedir(mc1_root_dir);
return 1;
+ }
return -11;
}
diff --git a/src/util.c b/src/util.c
index 3bb80201d..c6b53031e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -41,64 +41,53 @@ static int checkMC()
{
int mc0_is_ps2card, mc1_is_ps2card;
int mc0_has_folder, mc1_has_folder;
- int memcardtype, dummy;
- int i, ret;
- static sceMcTblGetDir mc_direntry[MAX_ENTRY] __attribute__((aligned(64)));
if (mcID == -1) {
- mcSync(0, NULL, NULL);
-
- mcGetInfo(0, 0, &memcardtype, &dummy, &dummy);
- mcSync(0, NULL, &ret);
- mc0_is_ps2card = (ret == -1 && memcardtype == 2);
- mc0_has_folder = 0;
+ mc0_is_ps2card = 0;
+ DIR *mc0_root_dir = opendir("mc0:");
+ if (mc0_root_dir != NULL) {
+ closedir(mc0_root_dir);
+ mc0_is_ps2card = 1;
+ }
- mcGetInfo(1, 0, &memcardtype, &dummy, &dummy);
- mcSync(0, NULL, &ret);
- mc1_is_ps2card = (ret == -1 && memcardtype == 2);
- mc1_has_folder = 0;
+ mc1_is_ps2card = 0;
+ DIR *mc1_root_dir = opendir("mc1:");
+ if (mc1_root_dir != NULL) {
+ closedir(mc1_root_dir);
+ mc1_is_ps2card = 1;
+ }
- if (mc0_is_ps2card) {
- memset(mc_direntry, 0, sizeof(mc_direntry));
- mcGetDir(0, 0, "*", 0, MAX_ENTRY - 2, mc_direntry);
- mcSync(0, NULL, &ret);
- for (i = 0; i < ret; i++) {
- if (mc_direntry[i].AttrFile & sceMcFileAttrSubdir && !strcmp((char *)mc_direntry[i].EntryName, "OPL")) {
- mc0_has_folder = 1;
- break;
- }
- }
+ mc0_has_folder = 0;
+ DIR *mc0_opl_dir = opendir("mc0:OPL/");
+ if (mc0_opl_dir != NULL) {
+ closedir(mc0_opl_dir);
+ mc0_has_folder = 1;
}
- if (mc1_is_ps2card) {
- memset(mc_direntry, 0, sizeof(mc_direntry));
- mcGetDir(1, 0, "*", 0, MAX_ENTRY - 2, mc_direntry);
- mcSync(0, NULL, &ret);
- for (i = 0; i < ret; i++) {
- if (mc_direntry[i].AttrFile & sceMcFileAttrSubdir && !strcmp((char *)mc_direntry[i].EntryName, "OPL")) {
- mc1_has_folder = 1;
- break;
- }
- }
+ mc1_has_folder = 0;
+ DIR *mc1_opl_dir = opendir("mc1:OPL/");
+ if (mc1_opl_dir != NULL) {
+ closedir(mc1_opl_dir);
+ mc1_has_folder = 1;
}
if (mc0_has_folder) {
- mcID = 0x30;
+ mcID = '0';
return mcID;
}
if (mc1_has_folder) {
- mcID = 0x31;
+ mcID = '1';
return mcID;
}
if (mc0_is_ps2card) {
- mcID = 0x30;
+ mcID = '0';
return mcID;
}
if (mc1_is_ps2card) {
- mcID = 0x31;
+ mcID = '1';
return mcID;
}
}
@@ -131,9 +120,8 @@ void checkMCFolder(void)
return;
}
- mcSync(0, NULL, NULL);
- mcMkDir(mcID & 1, 0, "OPL");
- mcSync(0, NULL, NULL);
+ snprintf(path, sizeof(path), "mc%d:OPL/", mcID & 1);
+ mkdir(path, 0777);
snprintf(path, sizeof(path), "mc%d:OPL/opl.icn", mcID & 1);
fd = open(path, O_RDONLY, 0666);
@@ -169,21 +157,10 @@ static int checkFile(char *path, int mode)
// in create mode, we check that the directory exist, or create it
if (mode & O_CREAT) {
- char dirPath[256];
- char *pos = strrchr(path, '/');
- if (pos) {
- memcpy(dirPath, path + 4, (pos - path) - 4);
- dirPath[(pos - path) - 4] = '\0';
- int ret = 0;
- mcSync(0, NULL, NULL);
- mcMkDir(path[2] - '0', 0, dirPath);
- mcSync(0, NULL, &ret);
- if (ret < 0) {
- // If the error is that the folder already exists, just pass through
- if (ret != -4) {
- return 0;
- }
- }
+ int res = mkdir(path, 0777);
+ // Non-standard POSIX check: the error value is supposed to be assigned to errno, not the return value
+ if (res >= 0 || res == -EEXIST) {
+ return 0;
}
}
}