Skip to content

Commit

Permalink
Merge branch 'rickgaiser:master' into u8
Browse files Browse the repository at this point in the history
  • Loading branch information
AKuHAK authored Oct 8, 2023
2 parents 5cf7126 + c9da431 commit 696f4b2
Show file tree
Hide file tree
Showing 38 changed files with 797 additions and 208 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ all:
$(MAKE) -C iop/cdvdman_esr2 all DEBUG=$(IOPCORE_DEBUG)
$(MAKE) -C iop/fakemod all DEBUG=$(IOPCORE_DEBUG)
$(MAKE) -C iop/fhi_bdm all DEBUG=$(IOPCORE_DEBUG)
$(MAKE) -C iop/hdlfs all DEBUG=$(IOPCORE_DEBUG)
$(MAKE) -C iop/imgdrv all DEBUG=$(IOPCORE_DEBUG)
$(MAKE) -C iop/isofs all DEBUG=$(IOPCORE_DEBUG)
$(MAKE) -C iop/mc_emu all DEBUG=$(IOPCORE_DEBUG)
Expand All @@ -30,6 +31,7 @@ clean:
$(MAKE) -C iop/cdvdman_esr2 clean
$(MAKE) -C iop/fakemod clean
$(MAKE) -C iop/fhi_bdm clean
$(MAKE) -C iop/hdlfs clean
$(MAKE) -C iop/imgdrv clean
$(MAKE) -C iop/isofs clean
$(MAKE) -C iop/mc_emu clean
Expand Down
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,19 @@ The following backing storage devices are supported:
- UDPBD
- iLink / IEEE1394

These are all BDM drivers, or "Block Devices". On all devices the following file systems are supported:
These are all BDM drivers, or "Block Devices". On all devices the following partitioning schemes are supported:
- MBR (Master Boot Record)
- GPT (GUID Partition Table)

And the following file systems:
- exFat
- FAT32 (/16/12)
- FAT32

During the loading phase, these drivers will be loaded and all files are accessable as `mass0:<file>` or `mass1:<file>`.

During the loading phase, the exFat driver will be loaded and all files are accessable as `mass0:<file>` or `mass1:<file>`.
For the ATA device there is also read-ony HDLoader compatibility. HDLoader uses APA partitioning and puts the iso files directly into the partitions, without using a filesystem.
During the loading phase, the drivers will be loaded and the iso's are accessable as `hdl:<file>`.
Note that the HDLoader backing store is currently read-ony, and limited to only emulating the DVD.

## CD/DVD emulation
The following CD/DVD emulation drivers are supported:
Expand All @@ -48,6 +56,7 @@ Options:
-bsd=<driver> Backing store drivers, supported are:
- no (default)
- ata
- ata-hdl
- usb
- mx4sio
- udpbd
Expand Down Expand Up @@ -91,14 +100,15 @@ Options:
- 5: IOP: Emulate DVD-DL
Multiple options possible, for example -gc=23
-eC Enable debug colors
-eL Enable logo (adds rom0:PS2LOGO to arguments)
-cfg=<file> Load extra user/game specific config file (without .toml extension)
-dbc Enable debug colors
-logo Enable logo (adds rom0:PS2LOGO to arguments)
--b Break, all following parameters are passed to the ELF
Usage examples:
neutrino.elf -bsd=usb -dvd=mass:path/to/filename.iso
neutrino.elf
neutrino.elf -dvd=esr
neutrino.elf -elf=rom0:OSDSYS --b SkipMc SkipHdd BootBrowser
neutrino.elf -bsd=ata -dvd=mass:path/to/filename.iso
neutrino.elf -bsd=ata-hdl -dvd=hdl:filename.iso
```
43 changes: 38 additions & 5 deletions ee/ee_core/src/iopmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,35 @@
extern int _iop_reboot_count;
extern void *ModStorageStart;

#ifdef __EESIO_DEBUG
static void print_iop_args(int arg_len, const char *args)
{
// Multiple null terminated strings together
int args_idx = 0;
int was_null = 1;

if (arg_len == 0)
return;

DPRINTF("IOP reboot arguments (arg_len=%d):\n", arg_len);

// Search strings
while(args_idx < arg_len) {
if (args[args_idx] == 0) {
if (was_null == 1) {
DPRINTF("- args[%d]=0\n", args_idx);
}
was_null = 1;
}
else if (was_null == 1) {
DPRINTF("- args[%d]='%s'\n", args_idx, &args[args_idx]);
was_null = 0;
}
args_idx++;
}
}
#endif

/*----------------------------------------------------------------*/
/* Reset IOP to include our modules. */
/*----------------------------------------------------------------*/
Expand All @@ -33,7 +62,11 @@ int New_Reset_Iop(const char *arg, int arglen)
irxtab_t *irxtable = (irxtab_t *)ModStorageStart;
static int imgdrv_offset = 0;

DPRINTF("New_Reset_Iop start!\n");
DPRINTF("%s()\n", __FUNCTION__);
#ifdef __EESIO_DEBUG
print_iop_args(arglen, arg);
#endif

if (EnableDebug)
GS_BGCOLOUR = 0xFF00FF; // Purple

Expand All @@ -45,20 +78,20 @@ int New_Reset_Iop(const char *arg, int arglen)
sbv_patch_enable_lmb();

udnl_cmdlen = 0;
if (arglen > 0) {
if (arglen >= 10) {
// Copy: rom0:UDNL or rom1:UDNL
// - Are these the only update modules? Always 9 chars long?
strncpy(udnl_mod, &arg[0], 10);
// Make sure it's 0 terminated
udnl_mod[9] = '\0';
udnl_mod[10-1] = '\0';

if (arglen > 10) {
// Copy: arguments
udnl_cmdlen = arglen-10; // length, including terminating 0
strncpy(udnl_cmd, &arg[10], udnl_cmdlen);

// Fix if 0 is not included
if (udnl_cmd[udnl_cmdlen-1] != 0) {
// Fix if 0 is not included in length
if (udnl_cmd[udnl_cmdlen-1] != '\0') {
udnl_cmd[udnl_cmdlen] = '\0';
udnl_cmdlen++;
}
Expand Down
19 changes: 12 additions & 7 deletions ee/ee_core/src/loadfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,14 +370,19 @@ int SifExecModuleBuffer(void *ptr, u32 size, u32 arg_len, const char *args, int
/* Round the size up to the nearest 16 bytes. */
size = (size + 15) & -16;

// Estimate free IOP RAM
// Estimate largest free IOP RAM block up to 256 byte accuracy
// 12 iterations are needed
void *ptemp = NULL;
u32 freemem = 1800*1024;
do {
freemem -= 4*1024;
ptemp = SifAllocIopHeap(freemem);
} while (ptemp == NULL);
SifFreeIopHeap(ptemp);
u32 freemem = 0;
u32 freecheck = 1024*1024;
while (freecheck > 256) {
ptemp = SifAllocIopHeap(freemem+freecheck);
if (ptemp != NULL) {
freemem += freecheck;
SifFreeIopHeap(ptemp);
}
freecheck /= 2;
}

// Allocate large buffer, forcing the module buffer to be allocated in 'middle' memory
ptemp = SifAllocIopHeap((freemem - size) / 2);
Expand Down
5 changes: 5 additions & 0 deletions ee/loader/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ all: $(EE_BIN_PACKED)
#GAME = 'DVD/Mobile Suit Gundam - Zeonic Front (U).iso'
#GAME = 'DVD/Inuyasha - Feudal Combat (U).iso'
#GAME = "DVD/Disney's Treasure Planet (E).iso"
#GAME = "CD/Pink Pong (E).iso" # BSOD on USB only. In PCSX2 with USB it works?

# Games that use the HDD in one way or another
#GAME = 'DVD/The Sims 2 (U).iso'
Expand Down Expand Up @@ -114,6 +115,7 @@ GAME = 'DVD/Ratchet Clank - Up Your Arsenal (U).iso'
#-bsd=udpbd -dvd=mass:$(GAME) -ata0=mass:$(ATA0)
#-bsd=udpbd -dvd=mass:$(GAME) -ata0=mass:$(ATA0) -mc0=mass:VMC/mymc.bin
#-bsd=udpbd -dvd=mass:"DVD/Splinter Cell (E).iso" -elf="cdrom0:\\LOADER.PS2;1" --b 0_0_2 -wantload -ll -diskimage -restart -l=1 -v=13117
#-bsd=ata-hdl -dvd=hdl:$(GAME)

# Exmaple arguments (not working yet)
#-bsd=udpbd -mc0=mass:VMC/mymc.bin -elf=rom0:OSDSYS --b SkipMc SkipHdd BootBrowser
Expand All @@ -139,6 +141,7 @@ copy:
cp ../../iop/cdvdman_esr2/irx/cdvdman_esr2.irx modules
cp ../../iop/fakemod/irx/fakemod.irx modules
cp ../../iop/fhi_bdm/irx/fhi_bdm.irx modules
cp ../../iop/hdlfs/irx/hdlfs.irx modules
cp ../../iop/imgdrv/irx/imgdrv.irx modules
cp ../../iop/isofs/irx/isofs.irx modules
cp ../../iop/mc_emu/irx/mc_emu.irx modules
Expand All @@ -150,6 +153,8 @@ copy:
cp $(PS2SDK)/iop/irx/bdm.irx modules
cp $(PS2SDK)/iop/irx/bdmfs_fatfs.irx modules
cp $(PS2SDK)/iop/irx/ata_bd.irx modules
cp $(PS2SDK)/iop/irx/ps2atad.irx modules
cp $(PS2SDK)/iop/irx/ps2hdd-osd.irx modules
cp $(PS2SDK)/iop/irx/usbd_mini.irx modules
cp $(PS2SDK)/iop/irx/usbmass_bd_mini.irx modules
cp $(PS2SDK)/iop/irx/mx4sio_bd_mini.irx modules
Expand Down
12 changes: 6 additions & 6 deletions ee/loader/config/bdm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ name = "Block Device Manager (with exFat and FHI)"
# Modules to load in load environment
# the end result of these drivers (in combination with the BDM BD drivers) must
# result in the "mass:" path being available to the load environment
[[module-load]]
[[module-le]]
file = "bdm.irx"
[[module-load]]
[[module-le]]
file = "bdmfs_fatfs.irx"
# These 3 drivers are needed for isofs
# it would be nice if we could remove that dependency
[[module-load]]
[[module-le]]
file = "iomanX.irx"
[[module-load]]
[[module-le]]
file = "fileXio.irx"
[[module-load]]
[[module-le]]
file = "isofs.irx"

# Modules to load in emulation environment
# the end result of these drivers (in combination with the BDM BD drivers) must
# result in the file handle interface (fhi) to be available to the emulation
# environment
[[module-emu]]
[[module-ee]]
file = "fhi_bdm.irx"
ioprp = "FHI" # ID used by loader
40 changes: 40 additions & 0 deletions ee/loader/config/bsd-ata-hdl.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Name of loaded config, to show to user
name = "ATA via DEV9 HDLoader driver"

# Modules to load in load environment
[[module-le]]
file = "iomanX.irx"
[[module-le]]
file = "fileXio.irx"
[[module-le]]
file = "isofs.irx"
[[module-le]]
file = "ps2dev9.irx"
[[module-le]]
file = "ps2atad.irx"
[[module-le]]
file = "ps2hdd-osd.irx"
args = ["-o", "4", "-n", "20"]
[[module-le]]
file = "hdlfs.irx"

# Modules to load in emulation environment
[[module-ee]]
file = "fhi_bdm.irx"
ioprp = "FHI" # ID used by loader
[[module-ee]]
file = "ps2dev9.irx"
[[module-ee]]
file = "ata_bd.irx"

# Modules of the game that are faked/blocked
[[fake]]
file = "DEV9.IRX"
name = "dev9"
version = 0x0208
startrv = 0 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
[[fake]]
file = "ATAD.IRX"
name = "atad_driver"
version = 0x0207
startrv = 0 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
2 changes: 0 additions & 2 deletions ee/loader/config/bsd-ata.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ file = "ata_bd.irx"
[[fake]]
file = "DEV9.IRX"
name = "dev9"
replace = true
version = 0x0208
startrv = 0 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
[[fake]]
file = "ATAD.IRX"
name = "atad_driver"
replace = true
version = 0x0207
startrv = 0 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
1 change: 0 additions & 1 deletion ee/loader/config/bsd-ilink.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ file = "IEEE1394_bd_mini.irx"
[[fake]]
file = "ILINK.IRX"
name = "iLINK_HW_Manager" # is this correct?
replace = true # is this correct?
version = 0x0202 # is this correct?
startrv = 2 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END # is this correct?
3 changes: 0 additions & 3 deletions ee/loader/config/bsd-udpbd-hdd.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,18 @@ args = ["ip=192.168.1.10"]
[[fake]]
file = "DEV9.IRX"
name = "dev9"
replace = true
version = 0x0208
loadrv = 0 # 0=ok, -xxx=error code (module not loaded)
startrv = 0 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
[[fake]]
file = "ENT_SMAP.IRX"
name = "ent_smap"
replace = false
version = 0x021f
loadrv = 0 # 0=ok, -xxx=error code (module not loaded)
startrv = 2 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
[[fake]]
file = "SMAP.IRX"
name = "INET_SMAP_driver"
replace = false
version = 0x0219
loadrv = 0 # 0=ok, -xxx=error code (module not loaded)
startrv = 2 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
3 changes: 0 additions & 3 deletions ee/loader/config/bsd-udpbd.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,18 @@ args = ["ip=192.168.1.10"]
[[fake]]
file = "DEV9.IRX"
name = "dev9"
replace = false
version = 0x0208
loadrv = 0 # 0=ok, -xxx=error code (module not loaded)
startrv = 1 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
[[fake]]
file = "ENT_SMAP.IRX"
name = "ent_smap"
replace = false
version = 0x021f
loadrv = -200 # KE_LINKERR becouse dev9 does not exist
startrv = 1 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
[[fake]]
file = "SMAP.IRX"
name = "INET_SMAP_driver"
replace = false
version = 0x0219
loadrv = -200 # KE_LINKERR becouse dev9 does not exist
startrv = 1 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
1 change: 0 additions & 1 deletion ee/loader/config/bsd-usb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ file = "usbmass_bd_mini.irx"
[[fake]]
file = "USBD.IRX"
name = "USB_driver"
replace = true
version = 0x0204
startrv = 2 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
3 changes: 1 addition & 2 deletions ee/loader/config/emu-ata-file.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
name = "ATA emulation using image file"

# Modules to load
[[module-emu]]
[[module-ee]]
file = "atad_emu.irx"

# Modules of the game that are faked/blocked
[[fake]]
file = "ATAD.IRX"
name = "atad_driver"
replace = true
version = 0x0207
startrv = 0 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END

Expand Down
6 changes: 2 additions & 4 deletions ee/loader/config/emu-dvd-file.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@
name = "CD/DVD emulation using image file"

# Modules to load
[[module-emu]]
[[module-ee]]
file = "cdvdman_emu.irx"
ioprp = "CDVDMAN"
[[module-emu]]
[[module-ee]]
file = "cdvdfsv.irx"
ioprp = "CDVDFSV"

# Modules of the game that are faked/blocked
[[fake]]
file = "CDVDFSV.IRX"
name = "cdvd_ee_driver"
replace = true
#unload = true // FIXME this is broken, can be tested with Jak X
version = 0x0202
startrv = 2 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
[[fake]]
file = "CDVDSTM.IRX"
name = "cdvd_st_driver"
replace = false
version = 0x0202
startrv = 2 # 0=RESIDENT_END, 1=NO_RESIDENT_END, 2=REMOVABLE_END
2 changes: 1 addition & 1 deletion ee/loader/config/emu-mc-file.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
name = "MC emulation using image file"

# Modules to load
[[module-emu]]
[[module-ee]]
file = "mc_emu.irx"
Loading

0 comments on commit 696f4b2

Please sign in to comment.