From 6f673c283f7587bbb354e2e663c13710f95d3236 Mon Sep 17 00:00:00 2001 From: uyjulian Date: Sun, 20 Jun 2021 16:49:48 -0500 Subject: [PATCH] Replace constants in imgdrv by searching instead of hardcoded offsets --- ee_core/src/iopmgr.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ee_core/src/iopmgr.c b/ee_core/src/iopmgr.c index 9e06d769d..dbe86924e 100644 --- a/ee_core/src/iopmgr.c +++ b/ee_core/src/iopmgr.c @@ -20,6 +20,7 @@ extern int _iop_reboot_count; static void ResetIopSpecial(const char *args, unsigned int arglen) { + int i; void *pIOP_buffer, *IOPRP_img, *imgdrv_irx; unsigned int length_rounded, CommandLen, size_IOPRP_img, size_imgdrv_irx; char command[RESET_ARG_MAX + 1]; @@ -44,8 +45,14 @@ static void ResetIopSpecial(const char *args, unsigned int arglen) CopyToIop(IOPRP_img, length_rounded, pIOP_buffer); - *(void **)(UNCACHED_SEG(&((unsigned char *)imgdrv_irx)[0x180])) = pIOP_buffer; - *(u32 *)(UNCACHED_SEG(&((unsigned char *)imgdrv_irx)[0x184])) = size_IOPRP_img; + for (i = 0; i < size_imgdrv_irx; i += 4) { + if (*(u32 *)((&((unsigned char *)imgdrv_irx)[i])) == 0xDEC1DEC1) { + *(void **)(UNCACHED_SEG(&((unsigned char *)imgdrv_irx)[i])) = pIOP_buffer; + } + if (*(u32 *)((&((unsigned char *)imgdrv_irx)[i])) == 0xDEC2DEC2) { + *(u32 *)(UNCACHED_SEG(&((unsigned char *)imgdrv_irx)[i])) = size_IOPRP_img; + } + } LoadMemModule(0, imgdrv_irx, size_imgdrv_irx, 0, NULL);