Skip to content

Commit

Permalink
Revert "Revert "kr_ps2: remove UDNL (ps2homebrew#1198)""
Browse files Browse the repository at this point in the history
This reverts commit 034a3a1.
  • Loading branch information
KrahJohlito committed Sep 12, 2024
1 parent 0a613d8 commit 3b1a8e3
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 54 deletions.
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ IOP_OBJS = iomanx.o filexio.o ps2fs.o usbd.o bdmevent.o \
iremsndpatch.o apemodpatch.o f2techioppatch.o cleareffects.o resetspu.o \
libsd.o audsrv.o

EECORE_OBJS = ee_core.o ioprp.o util.o \
udnl.o imgdrv.o eesync.o \
EECORE_OBJS = ee_core.o ioprp.o util.o imgdrv.o eesync.o \
bdm_cdvdman.o IOPRP_img.o smb_cdvdman.o \
hdd_cdvdman.o hdd_hdpro_cdvdman.o cdvdfsv.o \
ingame_smstcpip.o smap_ingame.o smbman.o smbinit.o
Expand Down Expand Up @@ -133,9 +132,6 @@ endif
ifeq ($(DTL_T10000),1)
EE_CFLAGS += -D_DTL_T10000
EECORE_EXTRA_FLAGS += DTL_T10000=1
UDNL_OUT = $(PS2SDK)/iop/irx/udnl-t300.irx
else
UDNL_OUT = $(PS2SDK)/iop/irx/udnl.irx
endif

ifeq ($(IGS),1)
Expand Down Expand Up @@ -365,9 +361,6 @@ ee_core/ee_core.elf: ee_core
$(EE_ASM_DIR)ee_core.c: ee_core/ee_core.elf | $(EE_ASM_DIR)
$(BIN2C) $< $@ eecore_elf

$(EE_ASM_DIR)udnl.c: $(UDNL_OUT) | $(EE_ASM_DIR)
$(BIN2C) $(UDNL_OUT) $@ udnl_irx

modules/iopcore/imgdrv/imgdrv.irx: modules/iopcore/imgdrv
$(MAKE) -C $<

Expand Down
2 changes: 1 addition & 1 deletion ee_core/include/modmgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ typedef struct

int LoadFileInit();
void LoadFileExit();
int LoadModule(const char *path, int arg_len, const char *args);
int LoadModule(const char *path, int arg_len, const char *args, int mode);
int LoadMemModule(int mode, void *modptr, unsigned int modsize, int arg_len, const char *args);
int GetOPLModInfo(int id, void **pointer, unsigned int *size);
int LoadOPLModule(int id, int mode, int arg_len, const char *args);
Expand Down
3 changes: 1 addition & 2 deletions ee_core/include/modules.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
enum OPL_MODULE_ID {
// Basic modules
OPL_MODULE_ID_UDNL = 1,
OPL_MODULE_ID_IOPRP,
OPL_MODULE_ID_IOPRP = 1,
OPL_MODULE_ID_IMGDRV,
OPL_MODULE_ID_RESETSPU,

Expand Down
4 changes: 2 additions & 2 deletions ee_core/src/igs_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,8 @@ int InGameScreenshot(void)

// Load modules.
LoadFileInit();
LoadModule("rom0:SIO2MAN", 0, NULL);
LoadModule("rom0:MCMAN", 0, NULL);
LoadModule("rom0:SIO2MAN", 0, NULL, 0);
LoadModule("rom0:MCMAN", 0, NULL, 0);

// Save IGS Bitmap File first, since it's the bigger file)
intffmd = GET_SMODE2_INTFFMD(smode2);
Expand Down
19 changes: 7 additions & 12 deletions ee_core/src/iopmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ static void ResetIopSpecial(const char *args, unsigned int arglen)
command[arglen] = '\0'; /* In a normal IOP reset process, the IOP reset command line will be NULL-terminated properly somewhere.
Since we're now taking things into our own hands, NULL terminate it here.
Some games like SOCOM3 will use a command line that isn't NULL terminated, resulting in things like "cdrom0:\RUN\IRX\DNAS300.IMGG;1" */
_strcpy(&command[arglen + 1], "img0:");
CommandLen = arglen + 6;
_strcpy(&command[arglen + 1], "host0:");
CommandLen = arglen + 7;
} else {
_strcpy(command, "img0:");
CommandLen = 5;
_strcpy(command, "host0:");
CommandLen = 6;
}

GetOPLModInfo(OPL_MODULE_ID_IOPRP, &IOPRP_img, &size_IOPRP_img);
Expand All @@ -63,20 +63,15 @@ static void ResetIopSpecial(const char *args, unsigned int arglen)
*(void **)(UNCACHED_SEG(&((unsigned char *)imgdrv_irx)[imgdrv_offset_ioprpimg])) = pIOP_buffer;
*(u32 *)(UNCACHED_SEG(&((unsigned char *)imgdrv_irx)[imgdrv_offset_ioprpsiz])) = size_IOPRP_img;

LoadModule("rom0:SYSCLIB", 0, NULL, 0);
LoadMemModule(0, imgdrv_irx, size_imgdrv_irx, 0, NULL);

DIntr();
ee_kmode_enter();
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_BOOTEND);
ee_kmode_exit();
EIntr();

LoadOPLModule(OPL_MODULE_ID_UDNL, SIF_RPC_M_NOWAIT, CommandLen, command);
LoadModule("rom0:UDNL", CommandLen, command, 1);

DIntr();
ee_kmode_enter();
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_SIFINIT);
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_CMDINIT);
Old_SifSetReg(SIF_REG_SMFLAG, SIF_STAT_BOOTEND);
Old_SifSetReg(SIF_SYSREG_RPCINIT, 0);
Old_SifSetReg(SIF_SYSREG_SUBADDR, (int)NULL);
ee_kmode_exit();
Expand Down
4 changes: 2 additions & 2 deletions ee_core/src/modmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void LoadFileExit()
/*----------------------------------------------------------------------------------------*/
/* Load an irx module from path with waiting. */
/*----------------------------------------------------------------------------------------*/
int LoadModule(const char *path, int arg_len, const char *args)
int LoadModule(const char *path, int arg_len, const char *args, int mode)
{
struct _lf_module_load_arg arg;

Expand All @@ -68,7 +68,7 @@ int LoadModule(const char *path, int arg_len, const char *args)
} else
arg.p.arg_len = 0;

if (SifCallRpc(&_lf_cd, LF_F_MOD_LOAD, 0x0, &arg, sizeof(arg), &arg, 8, NULL, NULL) < 0)
if (SifCallRpc(&_lf_cd, LF_F_MOD_LOAD, mode, &arg, sizeof(arg), &arg, 8, NULL, NULL) < 0)
return -SCE_ECALLMISS;

return arg.p.result;
Expand Down
12 changes: 6 additions & 6 deletions ee_core/src/padhook.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ static void t_loadElf(void)
GS_BGCOLOUR = 0xFF8000; // Blue sky

// Load basic modules
LoadModule("rom0:SIO2MAN", 0, NULL);
LoadModule("rom0:MCMAN", 0, NULL);
LoadModule("rom0:SIO2MAN", 0, NULL, 0);
LoadModule("rom0:MCMAN", 0, NULL, 0);

if (config->ExitPath[1] == 'a') { // ie mass:
ret = LoadModule("mc0:SYS-CONF/USBD.IRX", 0, NULL);
ret = LoadModule("mc0:SYS-CONF/USBD.IRX", 0, NULL, 0);
if (ret >= 0)
LoadModule("mc0:SYS-CONF/USBHDFSD.IRX", 0, NULL);
LoadModule("mc0:SYS-CONF/USBHDFSD.IRX", 0, NULL, 0);
else {
LoadModule("mc1:SYS-CONF/USBD.IRX", 0, NULL);
LoadModule("mc1:SYS-CONF/USBHDFSD.IRX", 0, NULL);
LoadModule("mc1:SYS-CONF/USBD.IRX", 0, NULL, 0);
LoadModule("mc1:SYS-CONF/USBHDFSD.IRX", 0, NULL, 0);
}
delay(5); // Wait for device to be detected.
}
Expand Down
2 changes: 0 additions & 2 deletions include/extern_irx.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ IMPORT_BIN2C(udptty_irx);

IMPORT_BIN2C(udptty_ingame_irx);

IMPORT_BIN2C(udnl_irx);

IMPORT_BIN2C(usbd_irx);

IMPORT_BIN2C(usbmass_bd_irx);
Expand Down
4 changes: 2 additions & 2 deletions modules/iopcore/imgdrv/imgdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ iop_device_ops_t my_device_ops =
dummy_fs,//chstat*/
};

const char name[] = "img";
const char name[] = "host";
iop_device_t my_device = {
name,
IOP_DT_FS,
Expand All @@ -81,7 +81,7 @@ iop_device_t my_device = {

int _start(int argc, char **argv)
{
// DelDrv("img");
DelDrv("host");
AddDrv((iop_device_t *)&my_device);

return MODULE_RESIDENT_END;
Expand Down
2 changes: 1 addition & 1 deletion modules/iopcore/imgdrv/imports.lst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ioman_IMPORTS_start
I_AddDrv
/*I_DelDrv*/
I_DelDrv
ioman_IMPORTS_end

sysclib_IMPORTS_start
Expand Down
16 changes: 0 additions & 16 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,6 @@ static unsigned int sendIrxKernelRAM(const char *startup, const char *mode_str,

modcount = 0;
// Basic modules
irxptr_tab[modcount].info = size_udnl_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_UDNL);
irxptr_tab[modcount++].ptr = (void *)&udnl_irx;
irxptr_tab[modcount].info = size_ioprp_image | SET_OPL_MOD_ID(OPL_MODULE_ID_IOPRP);
irxptr_tab[modcount++].ptr = ioprp_image;
irxptr_tab[modcount].info = size_imgdrv_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_IMGDRV);
Expand Down Expand Up @@ -571,20 +569,6 @@ static unsigned int sendIrxKernelRAM(const char *startup, const char *mode_str,
irxtable->modules = irxptr_tab;
irxtable->count = modcount;

#ifdef __DECI2_DEBUG
// For DECI2 debugging mode, the UDNL module will have to be stored within kernel RAM because there isn't enough space below user RAM.
// total_size will hence not include the IOPRP image, but it's okay because the EE core is interested in protecting the module storage within user RAM.
irxptr = (void *)0x00033000;
LOG("SYSTEM DECI2 UDNL address start: %p end: %p\n", irxptr, (void *)((u8 *)irxptr + GET_OPL_MOD_SIZE(irxptr_tab[0].info)));
DI();
ee_kmode_enter();
memcpy((void *)(0x80000000 | (unsigned int)irxptr), irxptr_tab[0].ptr, GET_OPL_MOD_SIZE(irxptr_tab[0].info));
ee_kmode_exit();
EI();

irxptr_tab[0].ptr = irxptr; // UDNL is the first module.
#endif

total_size = (sizeof(irxtab_t) + sizeof(irxptr_t) * modcount + 0xF) & ~0xF;
irxptr = (void *)((((unsigned int)irxptr_tab + sizeof(irxptr_t) * modcount) + 0xF) & ~0xF);

Expand Down

0 comments on commit 3b1a8e3

Please sign in to comment.