Skip to content

Commit

Permalink
always reboot IOP when launching ELF
Browse files Browse the repository at this point in the history
before: IOP only gets a reboot if the ELF is located on `hdd0:`
now: IOP is always left clean for the launched app
  • Loading branch information
israpps committed Jan 11, 2025
1 parent 6778a79 commit 2166ca4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
21 changes: 17 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,23 @@ EE_ASM_DIR = asm/
EE_SRC_DIR = src/
EE_OBJS := $(EE_OBJS:%=$(EE_OBJS_DIR)%) # remap all EE_OBJ to obj subdir

.PHONY: all run reset clean rebuild isoclean iso

all: githash.h $(EE_BIN_PKD)

info:
$(info available build options:)
$(info EXFAT enable BDM and EXFAT support for it)
$(info ETH include network features?)
$(info DS34 include PS3/PS4 controller support)
$(info MX4SIO support for SDCard connected to memory card slot 2)
$(info MMCE support for direct SDCard access on SD2PSX or memcardpro2)
$(info ----------)
$(info IOPTRAP load exception handler module to IOP)
$(info UDPTTY transfer stdout to UDP broadcast)
$(info PPC_UART transfer stdout to DECKARD UART)
$(info SIO_DEBUG transfer EE stdout to EE UART)

.PHONY: all run reset clean rebuild isoclean iso

$(EE_BIN_PKD): $(EE_BIN)
ps2-packer $< $@
ifeq ($(IOP_RESET),0)
Expand Down Expand Up @@ -220,14 +233,14 @@ clean:

rebuild: clean all

info:
info2:
$(info -------- wLaunchELF 4.43x_isr --------)
$(info EE_BIN = $(EE_BIN))
$(info EE_BIN_PKD = $(EE_BIN_PKD))
$(info EE_OBJS = $(EE_OBJS))
$(info TMANIP=$(TMANIP), SIO_DEBUG=$(SIO_DEBUG), DS34=$(DS34), ETH=$(ETH))
$(info EXFAT=$(EXFAT), XFROM=$(XFROM), UDPTTY=$(UDPTTY), MX4SIO=$(MX4SIO))
$(info IOP_RESET=$(IOP_RESET))
$(info MMCE=$(MMCE), IOP_RESET=$(IOP_RESET))

#special recipe for compiling and dumping obj to subfolder
$(EE_OBJS_DIR)%.o: $(EE_SRC_DIR)%.c | $(EE_OBJS_DIR)
Expand Down
14 changes: 6 additions & 8 deletions loader/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,17 @@ int main(int argc, char *argv[])
ret = SifLoadElf(target, &elfdata);
if (ret == 0) {
args[0] = path;

if (strncmp(path, "hdd", 3) == 0 && (path[3] >= '0' && path[3] <= ':')) { /* Final IOP reset, to fill the IOP with the default modules.
///ISRA: reboot the IOP always, lots of apps dont have error handling on the RPC modules
/*if (strncmp(path, "hdd", 3) == 0 && (path[3] >= '0' && path[3] <= ':')) { /* Final IOP reset, to fill the IOP with the default modules.
It appears that it was once a thing for the booting software to leave the IOP with the required IOP modules.
This can be seen in OSDSYS v1.0x (no IOP reboot) and the mechanism to boot DVD player updates (OSDSYS will get LoadExecPS2 to load SIO2 modules).
However, it changed with the introduction of the HDD unit, as the software booted may be built with a different SDK revision.
Reboot the IOP, to leave it in a clean & consistent state.
But do not do that for boot targets on other devices, for backward-compatibility with older (homebrew) software. */
while (!SifIopReset("", 0)) {
};
while (!SifIopSync()) {
};
}
But do not do that for boot targets on other devices, for backward-compatibility with older (homebrew) software.
}*/
while (!SifIopReset("", 0));
while (!SifIopSync());

SifExitRpc();

Expand Down

0 comments on commit 2166ca4

Please sign in to comment.