From 6db652a55ba9e394336c4d5c42bd5743cb07f413 Mon Sep 17 00:00:00 2001 From: israpps <57065102+israpps@users.noreply.github.com> Date: Fri, 1 Mar 2024 13:14:35 -0300 Subject: [PATCH 1/6] declare `SecrAuthDongle` on kernel headers --- iop/kernel/include/secrman.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/iop/kernel/include/secrman.h b/iop/kernel/include/secrman.h index de3ec4a9baf..9faf9b01fdc 100644 --- a/iop/kernel/include/secrman.h +++ b/iop/kernel/include/secrman.h @@ -32,6 +32,7 @@ extern void SecrSetMcCommandHandler(McCommandHandler_t handler); extern void SecrSetMcDevIDHandler(McDevIDHandler_t handler); extern int SecrAuthCard(int port, int slot, int cnum); +extern int SecrAuthDongle(int port, int slot, int cnum); extern void SecrResetAuthCard(int port, int slot, int cnum); #define secrman_IMPORTS_start DECLARE_IMPORT_TABLE(secrman, 1, 3) @@ -57,6 +58,9 @@ extern void SecrResetAuthCard(int port, int slot, int cnum); #define I_SecrDownloadGetKc DECLARE_IMPORT(18, SecrDownloadGetKc) #define I_SecrDownloadGetICVPS2 DECLARE_IMPORT(19, SecrDownloadGetICVPS2) +/* FOLLOWING EXPORTS ARE ONLY AVAILABLE IN ARCADE SECRMAN */ +#define I_SecrAuthDongle DECLARE_IMPORT(20, SecrAuthDongle) + #ifdef __cplusplus } #endif From 60eeab10f6181e1ddbe6ee889cb893daac697a77 Mon Sep 17 00:00:00 2001 From: israpps <57065102+israpps@users.noreply.github.com> Date: Fri, 1 Mar 2024 15:41:30 -0300 Subject: [PATCH 2/6] add dongleman implementation requires real hardware confirmation! --- iop/memorycard/mcman/Makefile | 11 ++++ iop/memorycard/mcman/src/exports.tab | 4 ++ iop/memorycard/mcman/src/imports.lst | 6 ++ iop/memorycard/mcman/src/main.c | 33 ++++++++-- iop/memorycard/mcman/src/mcman-internal.h | 14 ++++- iop/memorycard/mcman/src/mcsio2.c | 74 ++++++++++++++++++----- iop/system2x6/dongleman/Makefile | 19 ++++++ 7 files changed, 141 insertions(+), 20 deletions(-) create mode 100644 iop/system2x6/dongleman/Makefile diff --git a/iop/memorycard/mcman/Makefile b/iop/memorycard/mcman/Makefile index f647354feb2..45b47b79c36 100644 --- a/iop/memorycard/mcman/Makefile +++ b/iop/memorycard/mcman/Makefile @@ -29,8 +29,19 @@ MCMAN_BUILDING_XFROMMAN ?= 0 # Read from a file on the filesystem insead of the memory card? MCMAN_BUILDING_VMCMAN ?= 0 +# support for COH-H10020 +MCMAN_BUILDING_DONGLEMAN ?= 0 + ifneq (x$(MCMAN_BUILDING_XMCMAN),x0) IOP_CFLAGS += -DBUILDING_XMCMAN + +ifneq (x$(MCMAN_BUILDING_DONGLEMAN),x0)#because DONGLEMAN is based on XMCMAN +IOP_CFLAGS += -DBUILDING_DONGLEMAN + +ifneq (x$(DONGLEMAN_USE_SEMAPHORE),x0)#use semaphores to avoid issues with rom0:DAEMON +IOP_CFLAGS += -DDONGLEMAN_USE_SEMAPHORE +endif +endif endif ifneq (x$(MCMAN_BUILDING_XFROMMAN),x0) diff --git a/iop/memorycard/mcman/src/exports.tab b/iop/memorycard/mcman/src/exports.tab index a4b98ef3132..537de575fbb 100644 --- a/iop/memorycard/mcman/src/exports.tab +++ b/iop/memorycard/mcman/src/exports.tab @@ -44,7 +44,11 @@ DECLARE_EXPORT_TABLE(mcman, 1, 1) DECLARE_EXPORT(_dummy) DECLARE_EXPORT(_dummy) #endif +#if defined(BUILDING_DONGLEMAN) + DECLARE_EXPORT(mcman_export_26) +#else DECLARE_EXPORT(_dummy) +#endif DECLARE_EXPORT(_dummy) DECLARE_EXPORT(_dummy) DECLARE_EXPORT(McReadPS1PDACard) diff --git a/iop/memorycard/mcman/src/imports.lst b/iop/memorycard/mcman/src/imports.lst index e04cac15041..6a015cc4496 100644 --- a/iop/memorycard/mcman/src/imports.lst +++ b/iop/memorycard/mcman/src/imports.lst @@ -13,6 +13,9 @@ sior_IMPORTS_end #if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN) #ifndef BUILDING_XFROMMAN #ifdef BUILDING_XMCMAN +#ifdef BUILDING_DONGLEMAN +I_sio2_mtap_get_slot_max2 +#endif #ifndef SIO2MAN_V2 xsio2man_IMPORTS_start #else @@ -105,6 +108,9 @@ I_SecrSetMcCommandHandler I_SecrSetMcDevIDHandler I_SecrAuthCard secrman_IMPORTS_end +#ifdef BUILDING_DONGLEMAN +I_SecrAuthDongle +#endif #endif cdvdman_IMPORTS_start diff --git a/iop/memorycard/mcman/src/main.c b/iop/memorycard/mcman/src/main.c index a1099383ecd..60485a5b681 100644 --- a/iop/memorycard/mcman/src/main.c +++ b/iop/memorycard/mcman/src/main.c @@ -400,6 +400,14 @@ int McCloseAll(void) // Export #25 XMCMAN only return rv; } +//-------------------------------------------------------------- +#if defined(BUILDING_DONGLEMAN) +void mcman_export_26(u32 port) { //El_isra: i'm not sure if this appears on other MCMAN's, but I found this implementation on DONGLEMAN from BR3 + sio2_mtap_get_slot_max2((port & 1) | 2); //export 59 of XSIO2MAN? + return; +} +#endif + //-------------------------------------------------------------- int McDetectCard(int port, int slot) // Export #5 { @@ -415,7 +423,7 @@ int mcman_detectcard(int port, int slot) { register int r; register MCDevInfo *mcdi; - + DONGLEMAN_WAIT_SEMA(); DPRINTF("mcman_detectcard port%d slot%d\n", port, slot); mcdi = (MCDevInfo *)&mcman_devinfos[port][slot]; @@ -427,16 +435,19 @@ int mcman_detectcard(int port, int slot) if (!(r < -9)) { if (mcman_probePDACard(port, slot)) { mcdi->cardtype = sceMcTypePS1; + DONGLEMAN_SIGN_SEMA(); return (!PS1CardFlag) ? sceMcResDeniedPS1Permit : r; } else { mcdi->cardtype = sceMcTypePDA; + DONGLEMAN_SIGN_SEMA(); return r; } } } else { mcdi->cardtype = sceMcTypePS2; + DONGLEMAN_SIGN_SEMA(); return r; } } @@ -447,25 +458,33 @@ int mcman_detectcard(int port, int slot) r = mcman_probePS2Card2(port, slot); if (!(r < -9)) { mcdi->cardtype = sceMcTypePS2; + DONGLEMAN_SIGN_SEMA(); return r; } } else { if (mcman_probePDACard(port, slot)) { mcdi->cardtype = sceMcTypePS1; + DONGLEMAN_SIGN_SEMA(); return (!PS1CardFlag) ? sceMcResDeniedPS1Permit : r; } else { mcdi->cardtype = sceMcTypePDA; + DONGLEMAN_SIGN_SEMA(); return r; } } } else { - if (PS1CardFlag) + if (PS1CardFlag) { + DONGLEMAN_SIGN_SEMA(); return sceMcResSucceed; - if (mcdi->cardtype == sceMcTypePS1) + } + if (mcdi->cardtype == sceMcTypePS1) { + DONGLEMAN_SIGN_SEMA(); return sceMcResDeniedPS1Permit; + } + DONGLEMAN_SIGN_SEMA(); return sceMcResSucceed; } } @@ -481,7 +500,7 @@ int mcman_detectcard(int port, int slot) mcdi->cardform = 0; mcman_invhandles(port, slot); mcman_clearcache(port, slot); - + DONGLEMAN_SIGN_SEMA(); return r; } @@ -1109,7 +1128,11 @@ int McEraseBlock(int port, int block, void **pagebuf, void *eccbuf) // Export #1 //-------------------------------------------------------------- int McEraseBlock2(int port, int slot, int block, void **pagebuf, void *eccbuf) // Export #17 in XMCMAN { - return mcman_eraseblock(port, slot, block, (void **)pagebuf, eccbuf); + int x; + DONGLEMAN_WAIT_SEMA(); + x = mcman_eraseblock(port, slot, block, (void **)pagebuf, eccbuf); + DONGLEMAN_SIGN_SEMA(); + return x; } //-------------------------------------------------------------- diff --git a/iop/memorycard/mcman/src/mcman-internal.h b/iop/memorycard/mcman/src/mcman-internal.h index 4e929cdd42a..25759540616 100644 --- a/iop/memorycard/mcman/src/mcman-internal.h +++ b/iop/memorycard/mcman/src/mcman-internal.h @@ -57,12 +57,14 @@ #endif #endif -#if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN) +#if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN) && !defined(BUILDING_DONGLEMAN) #define MODNAME "mcman_cex" #elif defined(BUILDING_VMCMAN) #define MODNAME "vmcman" #elif defined(BUILDING_XFROMMAN) #define MODNAME "xfromman" +#elif defined(BUILDING_DONGLEMAN) +#define MODNAME "dongleman" #endif #define MODVER 0x20b @@ -360,4 +362,14 @@ extern u8 mcman_eccdata[512]; // size for 32 ecc // Defined in mcsio2.c extern u8 mcman_sio2outbufs_PS1PDA[0x90]; +#if defined(BUILDING_DONGLEMAN) && defined(DONGLEMAN_USE_SEMAPHORE) +/// probably they added this to avoid `rom0:DAEMON` from accessing the card at the same time than something else +extern int sema_hakama; +#define DONGLEMAN_WAIT_SEMA() WaitSema(sema_hakama) +#define DONGLEMAN_SIGN_SEMA() SignalSema(sema_hakama) +#else +#define DONGLEMAN_WAIT_SEMA() +#define DONGLEMAN_SIGN_SEMA() +#endif + #endif // __MCMAN_INTERNAL_H__ diff --git a/iop/memorycard/mcman/src/mcsio2.c b/iop/memorycard/mcman/src/mcsio2.c index b7c3c325cf4..86e8a146297 100644 --- a/iop/memorycard/mcman/src/mcsio2.c +++ b/iop/memorycard/mcman/src/mcsio2.c @@ -19,7 +19,9 @@ static flash_info_t dev9_flash_info; static sio2_transfer_data_t mcman_sio2packet; // buffer for mcman sio2 packet static u8 mcman_wdmabufs[0x0b * 0x90]; // buffer array for SIO2 DMA I/O (write) static u8 mcman_rdmabufs[0x0b * 0x90]; // not sure here for size, buffer array for SIO2 DMA I/O (read) - +#if defined(BUILDING_DONGLEMAN) && defined(DONGLEMAN_USE_SEMAPHORE)//placed it here because on decomp it's under mcman_rdmabufs +int sema_hakama; +#endif static sio2_transfer_data_t mcman_sio2packet_PS1PDA; static u8 mcman_sio2inbufs_PS1PDA[0x90]; u8 mcman_sio2outbufs_PS1PDA[0x90]; @@ -351,6 +353,15 @@ void mcman_initPS2com(void) flash_detect(); flash_get_info(&dev9_flash_info); #endif +#if defined(BUILDING_DONGLEMAN) && defined(DONGLEMAN_USE_SEMAPHORE) + DPRINTF("create sema hakama\n"); + iop_sema_t S; + S.attr = 1; + S.initial = 1; + S.max = 1; + S.option = 0; + sema_hakama = CreateSema(&S); +#endif } //-------------------------------------------------------------- @@ -525,6 +536,8 @@ int McWritePage(int port, int slot, int page, void *pagebuf, void *eccbuf) // Ex u8 *p = mcman_sio2packet.out_dma.addr; #endif + DONGLEMAN_WAIT_SEMA(); + #ifdef BUILDING_XFROMMAN (void)port; (void)slot; @@ -596,14 +609,17 @@ int McWritePage(int port, int slot, int page, void *pagebuf, void *eccbuf) // Ex if (flash_page_write(&dev9_flash_info, page, page_buf)) continue; #endif + DONGLEMAN_SIGN_SEMA(); return sceMcResSucceed; } while (++retries < 5); #if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN) - if (p[3] == 0x66) + if (p[3] == 0x66) { + DONGLEMAN_SIGN_SEMA(); return sceMcResFailReplace; - + } + DONGLEMAN_SIGN_SEMA(); return sceMcResNoFormat; #else return sceMcResFailReplace; @@ -614,6 +630,7 @@ int McWritePage(int port, int slot, int page, void *pagebuf, void *eccbuf) // Ex int mcman_readpage(int port, int slot, int page, void *buf, void *eccbuf) { #if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN) + DONGLEMAN_WAIT_SEMA(); register int index, count, retries, r, i; register MCDevInfo *mcdi = &mcman_devinfos[port][slot]; u8 *pbuf = (u8 *)buf; @@ -678,8 +695,10 @@ int mcman_readpage(int port, int slot, int page, void *buf, void *eccbuf) } while (++retries < 5); - if (retries < 5) + if (retries < 5) { + DONGLEMAN_SIGN_SEMA(); return sceMcResSucceed; + } #elif defined(BUILDING_VMCMAN) if (!mcman_iomanx_backing_read(port, slot, page, buf, eccbuf)) { return sceMcResSucceed; @@ -702,6 +721,8 @@ int mcman_readpage(int port, int slot, int page, void *buf, void *eccbuf) return sceMcResSucceed; } #endif + + DONGLEMAN_SIGN_SEMA(); return sceMcResChangedCard; } @@ -711,7 +732,8 @@ int McGetCardSpec(int port, int slot, s16 *pagesize, u16 *blocksize, int *cardsi #if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN) register int retries, r; u8 *p = mcman_sio2packet.out_dma.addr; - + + DONGLEMAN_WAIT_SEMA(); DPRINTF("McGetCardSpec sio2cmd port%d slot%d\n", port, slot); sio2packet_add(port, slot, 0xffffffff, NULL); @@ -731,8 +753,10 @@ int McGetCardSpec(int port, int slot, s16 *pagesize, u16 *blocksize, int *cardsi } } while (++retries < 5); - if (retries >= 5) + if (retries >= 5) { + DONGLEMAN_SIGN_SEMA(); return sceMcResChangedCard; + } *pagesize = (p[4] << 8) + p[3]; *blocksize = (p[6] << 8) + p[5]; @@ -754,7 +778,7 @@ int McGetCardSpec(int port, int slot, s16 *pagesize, u16 *blocksize, int *cardsi #endif DPRINTF("McGetCardSpec sio2cmd pagesize=%d blocksize=%u cardsize=%d flags%x\n", *pagesize, *blocksize, *cardsize, *flags); - + DONGLEMAN_SIGN_SEMA(); return sceMcResSucceed; } @@ -849,7 +873,6 @@ int mcman_probePS2Card2(int port, int slot) return sceMcResFailDetect2; } - //-------------------------------------------------------------- int mcman_probePS2Card(int port, int slot) //2 { @@ -858,12 +881,22 @@ int mcman_probePS2Card(int port, int slot) //2 register int retries; u8 *p = mcman_sio2packet.out_dma.addr; #endif - + DONGLEMAN_WAIT_SEMA(); DPRINTF("mcman_probePS2Card sio2cmd port%d slot%d\n", port, slot); r = mcman_cardchanged(port, slot); if (r == sceMcResSucceed) { - r = McGetFormat(port, slot); + r = McGetFormat(port, slot); +#if defined(BUILDING_DONGLEMAN) + if (r != sceMcTypeNoCard) { + if (port == 0) { + DPRINTF("SecrAuthDongle()\n"); + SecrAuthDongle(2, slot, mcman_getcnum(0,slot)); + } + DONGLEMAN_SIGN_SEMA(); + return sceMcResSucceed; + } +#else if (r > 0) { DPRINTF("mcman_probePS2Card sio2cmd succeeded\n"); @@ -876,18 +909,27 @@ int mcman_probePS2Card(int port, int slot) //2 return sceMcResNoFormat; } +#endif } #if !defined(BUILDING_XFROMMAN) && !defined(BUILDING_VMCMAN) if (mcman_resetauth(port, slot) != sceMcResSucceed) { DPRINTF("mcman_probePS2Card sio2cmd failed (auth reset failed)\n"); - + DONGLEMAN_SIGN_SEMA(); return sceMcResFailResetAuth; } - +#if defined(BUILDING_DONGLEMAN) + if (port == 0) { + DPRINTF("SecrAuthDongle()\n"); + if (SecrAuthDongle(2, slot, mcman_getcnum(0, slot)) == 0) { + DONGLEMAN_SIGN_SEMA(); + return sceMcResFailAuth; + } + } +#endif if (SecrAuthCard(port + 2, slot, mcman_getcnum(port, slot)) == 0) { DPRINTF("mcman_probePS2Card sio2cmd failed (auth failed)\n"); - + DONGLEMAN_SIGN_SEMA(); return sceMcResFailAuth; } @@ -905,6 +947,7 @@ int mcman_probePS2Card(int port, int slot) //2 if (retries >= 5) { DPRINTF("mcman_probePS2Card sio2cmd failed (mc detection failed)\n"); + DONGLEMAN_SIGN_SEMA(); return sceMcResFailDetect; } #endif @@ -929,7 +972,7 @@ int mcman_probePS2Card(int port, int slot) //2 if (retries >= 5) { DPRINTF("mcman_probePS2Card sio2cmd failed (mc detection failed)\n"); - + DONGLEMAN_SIGN_SEMA(); return sceMcResFailDetect2; } #endif @@ -937,15 +980,18 @@ int mcman_probePS2Card(int port, int slot) //2 r = mcman_setdevinfos(port, slot); if (r == 0) { DPRINTF("mcman_probePS2Card sio2cmd card changed!\n"); + DONGLEMAN_SIGN_SEMA(); return sceMcResChangedCard; } if (r != sceMcResNoFormat) { DPRINTF("mcman_probePS2Card sio2cmd failed (mc detection failed)\n"); + DONGLEMAN_SIGN_SEMA(); return sceMcResFailDetect2; } DPRINTF("mcman_probePS2Card sio2cmd succeeded\n"); + DONGLEMAN_SIGN_SEMA(); return r; } diff --git a/iop/system2x6/dongleman/Makefile b/iop/system2x6/dongleman/Makefile new file mode 100644 index 00000000000..aa7b18a7127 --- /dev/null +++ b/iop/system2x6/dongleman/Makefile @@ -0,0 +1,19 @@ +# _____ ___ ____ ___ ____ +# ____| | ____| | | |____| +# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. +#----------------------------------------------------------------------- +# Copyright 2001-2004, ps2dev - http://www.ps2dev.org +# Licenced under Academic Free License version 2.0 +# Review ps2sdk README & LICENSE files for further details. + +IOP_PAR_DIR = $(PS2SDKSRC)/iop/memorycard/mcman +IOP_SRC_DIR = $(IOP_PAR_DIR)/src/ +IOP_INC_DIR = $(IOP_PAR_DIR)/include/ + +IOP_BIN ?= dongleman.irx + +MCMAN_BUILDING_DONGLEMAN ?= 1 + +DONGLEMAN_USE_SEMAPHORE ?= 0 + +include $(IOP_PAR_DIR)/Makefile From 8923bb51335a41c83b217f9246cc6cde37246d72 Mon Sep 17 00:00:00 2001 From: israpps <57065102+israpps@users.noreply.github.com> Date: Mon, 4 Mar 2024 13:45:53 -0300 Subject: [PATCH 3/6] remove sema wait from function that shouldnt have it --- iop/memorycard/mcman/src/main.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/iop/memorycard/mcman/src/main.c b/iop/memorycard/mcman/src/main.c index 60485a5b681..ae6b85349fa 100644 --- a/iop/memorycard/mcman/src/main.c +++ b/iop/memorycard/mcman/src/main.c @@ -423,7 +423,6 @@ int mcman_detectcard(int port, int slot) { register int r; register MCDevInfo *mcdi; - DONGLEMAN_WAIT_SEMA(); DPRINTF("mcman_detectcard port%d slot%d\n", port, slot); mcdi = (MCDevInfo *)&mcman_devinfos[port][slot]; @@ -435,19 +434,16 @@ int mcman_detectcard(int port, int slot) if (!(r < -9)) { if (mcman_probePDACard(port, slot)) { mcdi->cardtype = sceMcTypePS1; - DONGLEMAN_SIGN_SEMA(); return (!PS1CardFlag) ? sceMcResDeniedPS1Permit : r; } else { mcdi->cardtype = sceMcTypePDA; - DONGLEMAN_SIGN_SEMA(); return r; } } } else { mcdi->cardtype = sceMcTypePS2; - DONGLEMAN_SIGN_SEMA(); return r; } } @@ -458,33 +454,27 @@ int mcman_detectcard(int port, int slot) r = mcman_probePS2Card2(port, slot); if (!(r < -9)) { mcdi->cardtype = sceMcTypePS2; - DONGLEMAN_SIGN_SEMA(); return r; } } else { if (mcman_probePDACard(port, slot)) { mcdi->cardtype = sceMcTypePS1; - DONGLEMAN_SIGN_SEMA(); return (!PS1CardFlag) ? sceMcResDeniedPS1Permit : r; } else { mcdi->cardtype = sceMcTypePDA; - DONGLEMAN_SIGN_SEMA(); return r; } } } else { if (PS1CardFlag) { - DONGLEMAN_SIGN_SEMA(); return sceMcResSucceed; } if (mcdi->cardtype == sceMcTypePS1) { - DONGLEMAN_SIGN_SEMA(); return sceMcResDeniedPS1Permit; } - DONGLEMAN_SIGN_SEMA(); return sceMcResSucceed; } } @@ -500,7 +490,6 @@ int mcman_detectcard(int port, int slot) mcdi->cardform = 0; mcman_invhandles(port, slot); mcman_clearcache(port, slot); - DONGLEMAN_SIGN_SEMA(); return r; } From c0cda5356e31ba932d2a85b9465cf7171d1fe551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Israelson?= <57065102+israpps@users.noreply.github.com> Date: Tue, 5 Mar 2024 12:59:56 -0300 Subject: [PATCH 4/6] change IRX_ID if building dongleman --- iop/memorycard/mcman/src/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/iop/memorycard/mcman/src/main.c b/iop/memorycard/mcman/src/main.c index 60485a5b681..e5c33f1ca52 100644 --- a/iop/memorycard/mcman/src/main.c +++ b/iop/memorycard/mcman/src/main.c @@ -17,7 +17,15 @@ // CRC32: EC5F33F9 // Note: currently is based on the last XMCMAN from BOOTROM: // 0x02,0x0a (looks like mistake, cause last XMCMAN is 0x02,0x09) -IRX_ID(MODNAME, 2, 11); + +#define MAJOR 2 +#if !defined(BUILDING_DONGLEMAN) //dongleman version is 0x204 +#define MINOR 11 +#else +#define MINOR 4 +#endif + +IRX_ID(MODNAME, MAJOR, MINOR); char SUPERBLOCK_MAGIC[] = "Sony PS2 Memory Card Format "; char SUPERBLOCK_VERSION[] = "1.2.0.0"; From 0315f7cacf7dd94ce9ace44a20e21873111c827e Mon Sep 17 00:00:00 2001 From: israpps <57065102+israpps@users.noreply.github.com> Date: Mon, 18 Mar 2024 12:29:20 -0300 Subject: [PATCH 5/6] update cnum getter --- iop/memorycard/mcman/src/main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/iop/memorycard/mcman/src/main.c b/iop/memorycard/mcman/src/main.c index ae6b85349fa..c1b5004d6d4 100644 --- a/iop/memorycard/mcman/src/main.c +++ b/iop/memorycard/mcman/src/main.c @@ -1211,7 +1211,12 @@ void McDataChecksum(void *buf, void *ecc) // Export #20 //-------------------------------------------------------------- int mcman_getcnum(int port, int slot) { +#if defined(BUILDING_DONGLEMAN) + DPRINTF("%s: port %d slot %d original ret would be 0x%x\n", __FUNCTION__, port, slot, (((port & 1) << 3) + slot)) + return 0xf; +#else return ((port & 1) << 3) + slot; +#endif } //-------------------------------------------------------------- From 138f8b9a133ca99976208911f9d6aec756281e89 Mon Sep 17 00:00:00 2001 From: israpps <57065102+israpps@users.noreply.github.com> Date: Mon, 18 Mar 2024 12:30:36 -0300 Subject: [PATCH 6/6] add missing block to probePS2Card --- iop/memorycard/mcman/src/mcsio2.c | 5 +++++ iop/system2x6/dongleman/Makefile | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/iop/memorycard/mcman/src/mcsio2.c b/iop/memorycard/mcman/src/mcsio2.c index 86e8a146297..4552c8f1de5 100644 --- a/iop/memorycard/mcman/src/mcsio2.c +++ b/iop/memorycard/mcman/src/mcsio2.c @@ -988,6 +988,11 @@ int mcman_probePS2Card(int port, int slot) //2 DONGLEMAN_SIGN_SEMA(); return sceMcResFailDetect2; } +#if !defined(BUILDING_DONGLEMAN) + else { + mcman_devinfos[port][slot].cardform = sceMcResNoFormat; // aditional step on dongleman? or its not set somewhere else unlike our implementation? + } +#endif DPRINTF("mcman_probePS2Card sio2cmd succeeded\n"); diff --git a/iop/system2x6/dongleman/Makefile b/iop/system2x6/dongleman/Makefile index aa7b18a7127..fce1366fb3a 100644 --- a/iop/system2x6/dongleman/Makefile +++ b/iop/system2x6/dongleman/Makefile @@ -12,8 +12,8 @@ IOP_INC_DIR = $(IOP_PAR_DIR)/include/ IOP_BIN ?= dongleman.irx -MCMAN_BUILDING_DONGLEMAN ?= 1 - +MCMAN_BUILDING_XMCMAN = 1 +MCMAN_BUILDING_DONGLEMAN = 1 DONGLEMAN_USE_SEMAPHORE ?= 0 include $(IOP_PAR_DIR)/Makefile