Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
israpps committed Nov 25, 2024
1 parent fc9725a commit 06297f5
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 83 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# |___/ |_|
# security dongle dumper for PlayStation2 based namco system 246/256
.SILENT:
EE_BIN = KELF_BINDER_$(TTY).ELF
EE_BIN = CARDOGTEST.ELF

EE_OBJS = $(addprefix src/,$(addsuffix .o, main downloadfile ioprp usbd bdm bdmfs_fatfs usbmass_bd fileXio iomanX secrsif_mechaemu mcman mcserv sio2man))

Expand All @@ -32,12 +32,13 @@ endif

all: $(EE_BIN)
$(info $(EE_BIN): built)
ps2-packer $(EE_BIN) PS2_OG_CARD_TEST.ELF

clean:
rm -rf $(EE_OBJS) $(EE_BIN)
rm -rf $(EE_OBJS) $(EE_BIN) src/ioprp.c


src/ioprp.c: IOPRP_RETAIL.IMG
src/ioprp.c: IOPRP_DEVELOPER.IMG
bin2c $< $@ ioprp


Expand Down
11 changes: 11 additions & 0 deletions README.TXT
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
This application tries to auth memory cards on both ports with developer magicgate

Original memory cards support this, while no bootleg card seems to do so (tested with 7 of them)

If the card passes the test it could be a good sign that you have an og card


IMPORTANT NOTE:
To avoid issues, please make sure to unplug and replug the cards before running the test ELF. seems like when cards are authenticated once with retail keys they cant go back to developer keys untill theyre disconnected

Coded by El_isra
153 changes: 73 additions & 80 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* Copyright (c) 2024 Matias Israelson - MIT license
*/

#include <smem.h>
#include <smod.h>
#include <kernel.h>
#include <stdio.h>
#include <iopheap.h>
Expand Down Expand Up @@ -65,6 +67,7 @@ EXTERN_MODULE(udptty_standalone_irx);
#define INFORM(x) scr_setfontcolor(MODULE_OK(x.id, x.ret) ? 0x00cc00 : 0x0000cc);scr_printf(" %s: id:%d ret:%d - %-8s ", #x, x.id, x.ret, MODULE_OK(x.id, x.ret) ? "OK\r" : "ERR\n"); usleep(600000);
int loadusb();

smod_mod_info_t* GetIRXInfoByName(const char* name);
char ROMVER[15];
int loadmodulemc();
#define MCPORT 0
Expand Down Expand Up @@ -100,16 +103,23 @@ LOADMODULE(ppctty_irx, NULL);
LOADMODULE(ps2dev9_irx, NULL);
LOADMODULE(udptty_standalone_irx, NULL);
#endif
scr_printf(".\n\t ===== MECHAEMU Update binder =====\n");
scr_printf("\tCoded by El_isra. genvmc module borrowed from OPL\n");
scr_printf(".\n\t ============ OG Card Tester ============\n");
scr_printf("\tCoded by El_isra\n");
//scr_printf("\thttps://github.com/israpps/system2x6-dongle-dumper\n");
scr_printf("\tROMVER: %s\n", ROMVER);
scr_printf("\tConsole ROMVER: %s\n", ROMVER);
//ModelNameInit();
smod_mod_info_t* info = GetIRXInfoByName("secrman_nomecha");
if (info == NULL) {
scr_setfontcolor(0x0000CC);
scr_printf("\n\n\tCannot replace SECRMAN.IRX: Aborting\n");
goto brk;

}


if (!loadusb()) goto tosleep;
// if (!loadusb()) goto tosleep;

secrsif_mechaemu.id = LOADMODULE(secrsif_mechaemu_irx, &secrsif_mechaemu.ret);
/*secrsif_mechaemu.id = LOADMODULE(secrsif_mechaemu_irx, &secrsif_mechaemu.ret);
INFORM(secrsif_mechaemu);
if (mechaemu_init()) {
scr_printf("\tCannot connect to secrsif_mechaemu.irx\n");
Expand All @@ -125,69 +135,12 @@ LOADMODULE(udptty_standalone_irx, NULL);
} else {
scr_printf("\n\tFailed to load fileXio. aborting dump...\n");
goto brk;
}
if (loadmodulemc() == 0) {
scr_setfontcolor(0xFFFFFF);
scr_printf("\n");
uint8_t* buf;
const char* UNBOUND = "UNBOUND.KELF";
const char* BOUND = "BOUND.KELF";
int fd = open(UNBOUND, O_RDONLY);

if (fd < 0) {
scr_printf("\tcant open '%s' (%d %s)...\n", UNBOUND, fd, strerror(fd));
goto brk;
}
int size = lseek(fd, 0, SEEK_END);
scr_printf("\tKELF size is %d\n", size);
if (size < 0) {
goto brk;
}
lseek(fd, 0, SEEK_SET);
if ((buf = memalign(64, size)) != NULL) {
if ((read(fd, buf, size)) != size) {
close(fd);
scr_printf("\tcannot read whole KELF: %d bytes\n", size);
goto brk;
} else {
get_Kbit(buf, Kbit);
get_Kc(buf, Kc);
scr_printf("Unbound: \n"); hexdump("Kbit", Kbit, 16); hexdump("Kc", Kc, 16);
scr_printf("\tBinding update to memory card on mc%d:\n", MCPORT);
int result = mechaemu_downloadfile(MCPORT + 2, 0, buf);
if (result) {
scr_printf("\tBinding complete\n");
get_Kbit(buf, BKbit);
get_Kc(buf, BKc);
scr_printf("Bound: \n"); hexdump("Kbit", BKbit, 16); hexdump("Kc", BKc, 16);
scr_printf( "writing KELF to '%s'\n", BOUND);
int outfd = open(BOUND, O_WRONLY | O_CREAT | O_TRUNC);
if (outfd >= 0)
{
int written = write(outfd, buf, size);
if (written != size) {
scr_printf("\tI/O ERROR Writing output KELF\n");
result = -EIO;
}
close(outfd);
} else {
scr_printf("\tmechaemu_downloadfile(%d, 0): error\n", MCPORT);
result = -EIO;
}

} else {
scr_printf("\tmechaemu_downloadfile(%d, 0): error\n", MCPORT);
goto brk;
}
}
} else {
close(fd);
scr_printf("\tcannot allocate %d bytes\n", size);
goto brk;
}
}
}*/
loadmodulemc();
brk:
scr_printf("Program execution end. exiting to OSDSYS in 2 minutes\n");

scr_setfontcolor(0xFFFFFF);
scr_printf("\n\nProgram execution end. exiting to OSDSYS in 2 minutes\n");
sleep(120);
return 0;
tosleep:
Expand Down Expand Up @@ -245,21 +198,41 @@ int loadmodulemc() {
return -1;
}
mcInit(MC_TYPE_XMC);
for (int i = 0; i < 2; i++)
{
scr_printf("\n\n\tmc%d: ", i );
int a = 1;
int mcformatted= MC_UNFORMATTED, mctype = sceMcTypeNoCard, mcfreeSpace = 0, ret;
mcGetInfo(i, 0, &mctype, &mcfreeSpace, &mcformatted);
mcSync(0, NULL, &ret);
scr_setfontcolor(0xFFFFFF);

int mcformatted= MC_UNFORMATTED, mctype, mcfreeSpace, ret;
mcGetInfo(MCPORT, 0, &mctype, &mcfreeSpace, &mcformatted);
mcSync(0, NULL, &ret);
scr_setfontcolor(0xFFFFFF);

if (mctype != sceMcTypePS2 ) {scr_setfontcolor(0x0000CC); a=0;}
usleep(rand()%600000);
scr_printf("CardType:%d ", mctype );
scr_setfontcolor(0xFFFFFF);
usleep(rand()%600000);
scr_printf("FreeSpace:%04d ", mcfreeSpace );
if (mcformatted != MC_FORMATTED ) {scr_setfontcolor(0x0000CC); a=0;}
usleep(rand()%600000);
scr_printf("Formatted:%d\n", mcformatted);
usleep(rand()%600000);
if (a) {
scr_setfontcolor(0x00FF00);
scr_printf("\t\tThe card was successfully authenticated with developer magicgate\n");
} else {
scr_setfontcolor(0x0000CC);
scr_printf("\t\tCannot auth card with dev keys.\n\t\t\tCard is bootleg or maybe arcade/prototype card\n");
}

}

scr_printf("\tmc%d: ", MCPORT );
if (mctype != sceMcTypePS2 ) scr_setfontcolor(0x0000CC);
scr_printf("CardType:%d ", mctype );
scr_setfontcolor(0xFFFFFF);
scr_printf("FreeSpace:%d ", mcfreeSpace );
if (mcformatted != MC_FORMATTED ) scr_setfontcolor(0x0000CC);
scr_printf("Formatted:%d\n", mcformatted);
scr_setfontcolor(0xFFFFFF);
return 0;
nocard:
scr_printf("\tCannot auth card with dev keys\n\tCard is bootleg...\n\tOr maybe arcade/prototype card\n");
scr_setfontcolor(0xFFFFFF);
return -1;
}


Expand Down Expand Up @@ -309,4 +282,24 @@ void hexdump (const char* name, unsigned char* buf, int size) {
scr_printf("\n");

}
//LIBCGLUE_SUPPORT_NAMCO_SYSTEM_2x6();
//LIBCGLUE_SUPPORT_NAMCO_SYSTEM_2x6();


smod_mod_info_t* curr = NULL;
smod_mod_info_t* GetIRXInfoByName(const char* name) {
smod_mod_info_t info;
curr = NULL;
char sName[21];
int rv;
while ((rv = smod_get_next_mod(curr, &info)) != 0) {
curr = &info;
if (curr == NULL) continue;
smem_read(info.name, sName, 20);
printf("%s: v%x\n", sName, info.version);
sName[20] = 0;
if (!strcmp(name, sName)) {
return curr;
}
}
return NULL;
}

0 comments on commit 06297f5

Please sign in to comment.