Skip to content

Commit

Permalink
incomplete extended MMCE interface
Browse files Browse the repository at this point in the history
  • Loading branch information
israpps committed Jan 7, 2025
1 parent 23c2a2c commit 30e6777
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/filer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3583,14 +3583,18 @@ int setFileList(const char *path, const char *ext, FILEINFO *files, int cnfmode)
files[nfiles++].stats.AttrFile = sceMcFileAttrFile;
strcpy(files[nfiles].name, LNG(PS2Disc));
files[nfiles++].stats.AttrFile = sceMcFileAttrFile;
#ifdef ETH
#ifdef ETH
strcpy(files[nfiles].name, LNG(PS2Net));
files[nfiles++].stats.AttrFile = sceMcFileAttrFile;
#endif
#endif
strcpy(files[nfiles].name, LNG(PS2PowerOff));
files[nfiles++].stats.AttrFile = sceMcFileAttrFile;
strcpy(files[nfiles].name, LNG(HddManager));
files[nfiles++].stats.AttrFile = sceMcFileAttrFile;
#ifdef MMCE
strcpy(files[nfiles].name, "MMCEManager");
files[nfiles++].stats.AttrFile = sceMcFileAttrFile;
#endif
strcpy(files[nfiles].name, LNG(TextEditor));
files[nfiles++].stats.AttrFile = sceMcFileAttrFile;
strcpy(files[nfiles].name, LNG(JpgViewer));
Expand All @@ -3605,7 +3609,6 @@ int setFileList(const char *path, const char *ext, FILEINFO *files, int cnfmode)
files[nfiles++].stats.AttrFile = sceMcFileAttrFile;
strcpy(files[nfiles].name, LNG(Load_CNF));
files[nfiles++].stats.AttrFile = sceMcFileAttrFile;
//Next 2 lines add an optional font test routine
strcpy(files[nfiles].name, LNG(ShowFont));
files[nfiles++].stats.AttrFile = sceMcFileAttrFile;
strcpy(files[nfiles].name, LNG(Debug_Info));
Expand Down
99 changes: 99 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,96 @@ static void Show_About_uLE(void)
//----- End of event loop -----
}

#ifdef MMCE
struct cardinfo_t {
char* product;
int revision;
int protocol;
bool validcard;
};
static void Show_MMCEManager(void)
{
int event = 1, post_event = 0, hpos = 16, curcard = 0, res, i;
char TextRow[256];
const char* sd2psx = "SD2PSX";
const char* mcpro = "MemCardPro2";
const char* unk = LNG(Unknown);
struct cardinfo_t CardInfo[2] = {
{
&unk,
0, 0, false,
},
{
&unk,
0, 0, false,
}
};
char* mmce = "mmce0:";
for (i = 0; i < 2; i++)
{
mmce[4] = '0'+i;
res = fileXioDevctl(mmce, 0x1 /*MMCE_CMD_PING*/, NULL, 0, NULL, 0);
if (res != -1) {
if (((res & 0xFF00) >> 8) == 1) {
CardInfo[i].product = sd2psx;
} else if (((res & 0xFF00) >> 8) == 2) {
CardInfo[i].product = mcpro;
} else {
CardInfo[i].product = unk;
}
CardInfo[i].revision = (res & 0xFF);
CardInfo[i].protocol = ((res & 0xFF0000) >> 16);
CardInfo[i].validcard = TRUE;
} else CardInfo[i].validcard = FALSE;
}

//----- Start of event loop -----
while (1) {
//Pad response section
waitAnyPadReady();
if (readpad() && new_pad) {
if (new_pad & PAD_CIRCLE) {
event |= 2;
if (setting->GUI_skin[0]) {
GUI_active = 1;
loadSkin(BACKGROUND_PIC, 0, 0);
}
break;
} else if (new_pad && PAD_CROSS) {
curcard =^ 1;
} else if (new_pad && PAD_START) {
//SET GAMEID
}

}

//Display section
if (event || post_event) { //NB: We need to update two frame buffers per event
clrScr(setting->color[COLOR_BACKGR]);

for (i = 0; i < 2; i++)
{
PrintPos(03, hpos, "Device Info:", COLOR_TEXT);
if (CardInfo[i].validcard) {
sprintf(TextRow, " Port0: %s", CardInfo[i].product);
PrintPos(-1, hpos, TextRow, curcard==i? COLOR_SELECT : COLOR_TEXT);
sprintf(TextRow, "Revision: %d, Protocol: %d", CardInfo[i].revision, CardInfo[i].protocol);
PrintPos(-1, hpos, TextRow, COLOR_TEXT);
PrintPos(-1, hpos, " ", COLOR_TEXT);
PrintPos(-1, hpos, " ", COLOR_TEXT);
PrintPos(-1, hpos, " ", COLOR_TEXT);
}
}

setScrTmp("MMCE Manager", "R1/R2:card | L1/L2:channel | START:SetGameID | X:card slot");
}
drawScr();
post_event = event;
event = 0;
} //ends while
//----- End of event loop -----
}
#endif
static void Show_build_info(void)
{
char TextRow[256];
Expand Down Expand Up @@ -2370,6 +2460,15 @@ static void Execute(char *pathin)
}
Show_build_info();
return;
#ifdef MMCE
} else if (!stricmp(path, "MISC/MMCEManager")) {
if (setting->GUI_skin[0]) {
GUI_active = 0;
loadSkin(BACKGROUND_PIC, 0, 0);
}
Show_MMCEManager();
return;
#endif
} else if (!strncmp(path, "cdfs", 4)) {
LCDVD_FLUSHCACHE();
LCDVD_DISKREADY(0);
Expand Down

0 comments on commit 30e6777

Please sign in to comment.