Skip to content

Commit

Permalink
Display current path
Browse files Browse the repository at this point in the history
Pseudo-icon for folders
Fix wrong text size in SD restore mode
  • Loading branch information
suloku committed Apr 6, 2017
1 parent ff7b0db commit 3d9720c
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 42 deletions.
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ I (suloku) have updated the code to newest libraries to port it to the Wii syste
`������� ���������������� ��������������� �������������������� �������������'

[What's New 1.4f - april 05, 2017 - By suloku]
* dragonbane0 made a mod of version 1.4c with folder selection and alphabetical sorting. Zephiles pointed this out and the changes have been merged. Thanks you both!
* dragonbane0 made a mod of version 1.4c with folder selection and alphabetical sorting. Zephiles pointed this out and the changes have been merged with some little extra tweaks. Thanks you both!

[What's New 1.4e - february 27, 2016 - By suloku]
* Fixed bug in card.c that prevented correct backup/write of saves with same filename but different case. Bug affected Timesplitters 2, probably Timesplitters 3 too. Thanks to DakuTree for reporting and Antidote for fixing.
Expand Down
96 changes: 60 additions & 36 deletions source/freetype.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ extern u8 CommentBuffer[64] ATTRIBUTE_ALIGN (32);

extern u8 currFolder[260];
extern int folderCount;
extern int displaypath;

#define PAGESIZE 16

Expand Down Expand Up @@ -750,7 +751,16 @@ void showCardInfo(int sel){

if(isdir_sd(folder) == 1)
{
y += 100;
sprintf(txt, "#%d Folder: %s", sel, (char*)filelist[sel]);
DrawText(x, y-4, txt);
y += 70;

//Simple folder "icon"
DrawBoxFilled(468+2, 174+20, (468+40), (174+37)+20, getcolour(0,0,0));
DrawBoxFilled(468+2+2, 174+2+20, (468+40)-2, (174+37)-2+20, getcolour(255,255,0));
DrawBoxFilled(468+2, 174+20, (468+40), (174+10)+20, getcolour(0,0,0));
DrawBoxFilled(468+2+2, 174+2+20, (468+40-22)-2, (174+10-1)-2+20, getcolour(255,255,0));
DrawBoxFilled((468+40-22)+2, 174+20, (468+40), (174+10-1)-2+20, getcolour(84,174,211));
}
else
{
Expand Down Expand Up @@ -788,41 +798,41 @@ void showCardInfo(int sel){
DrawText(x, y, txt);
y+=40;
//END card image info END
}

//START real card info START
//START real card info START

//In this call we mount the card, so we can later read the SRAM unscrambled flash ID
u64 cardserialno = Card_SerialNo(MEM_CARD);
//In this call we mount the card, so we can later read the SRAM unscrambled flash ID
u64 cardserialno = Card_SerialNo(MEM_CARD);

sramex = __SYS_LockSramEx();
__SYS_UnlockSramEx(0);
sramex = __SYS_LockSramEx();
__SYS_UnlockSramEx(0);

if (!MEM_CARD)
{
sprintf(txt, "Slot A card flash ID:");
}else
{
sprintf(txt, "Slot B card flash ID:");
}
DrawText(x,y,txt);
y+=20;
if (!MEM_CARD)
{
sprintf(txt, "Slot A card flash ID:");
}else
{
sprintf(txt, "Slot B card flash ID:");
}
DrawText(x,y,txt);
y+=20;

sprintf(txt, "%02X", sramex->flash_id[MEM_CARD][0]);
for (i=1; i<sizeof(sramex->flash_id[MEM_CARD]); i++){
sprintf(temp, "%02X", sramex->flash_id[MEM_CARD][i]);
strcat(txt, temp);
}
DrawText(x,y,txt);
y+=20;
sprintf(txt, "%02X", sramex->flash_id[MEM_CARD][0]);
for (i=1; i<sizeof(sramex->flash_id[MEM_CARD]); i++){
sprintf(temp, "%02X", sramex->flash_id[MEM_CARD][i]);
strcat(txt, temp);
}
DrawText(x,y,txt);
y+=20;

sprintf(txt, "Serial N.: %016llX", cardserialno);
DrawText(x,y,txt);
y+=20;
sprintf(txt, "Serial N.: %016llX", cardserialno);
DrawText(x,y,txt);
y+=20;

sprintf(txt, "Size: %d blocks", (memsize*16)-5);
DrawText(x,y,txt);
//END real card info END
sprintf(txt, "Size: %d blocks", (memsize*16)-5);
DrawText(x,y,txt);
//END real card info END
}
}

void showSaveInfo(int sel)
Expand Down Expand Up @@ -881,18 +891,24 @@ void showSaveInfo(int sel)
DrawBoxFilledGradient(412, 174, (410+158), (174+37), BLUECOL, PURPLECOL, LOCATION);
}else
{
//Box for icon
DrawHLine (468, 468+42, 172, getcolour (255,255,255));
DrawBox (468, 173, 468+42, 173+39, getcolour (255,255,255));
DrawHLine (468, 468+42, 174+39, getcolour (255,255,255));


if (isFolder == 1)
{
DrawBoxFilled(468+2, 174, (468+40), (174+37), getcolour(255,255,0));
//Simple folder "icon"
DrawBoxFilled(468+2, 174, (468+40), (174+37), getcolour(0,0,0));
DrawBoxFilled(468+2+2, 174+2, (468+40)-2, (174+37)-2, getcolour(255,255,0));
DrawBoxFilled(468+2, 174, (468+40), (174+10), getcolour(0,0,0));
DrawBoxFilled(468+2+2, 174+2, (468+40-22)-2, (174+10-1)-2, getcolour(255,255,0));
DrawBoxFilled((468+40-22)+2, 174, (468+40), (174+10-1)-2, getcolour(84,174,211));
//DrawBoxFilledGradient(468+2, 174, (468+40), (174+37), getcolour(255,255,0), getcolour(255,255,0), LOCATION);
}
else
{
//Box for icon
DrawHLine (468, 468+42, 172, getcolour (255,255,255));
DrawBox (468, 173, 468+42, 173+39, getcolour (255,255,255));
DrawHLine (468, 468+42, 174+39, getcolour (255,255,255));
//Gradient
DrawBoxFilledGradient(468+2, 174, (468+40), (174+37), BLUECOL, PURPLECOL, LOCATION);
}
}
Expand Down Expand Up @@ -1056,6 +1072,14 @@ static void ShowFiles (int offset, int selection, int upordown, int saveinfo) {
//clear entire left side since we want to update all
clearLeftPane();
ShowScreen();
if (displaypath)
{
//Draw current folder
DrawBoxFilled(30, 55, 30+330, 50+16, getcolour(255, 255, 255));
setfontsize (10);
sprintf (folder, "fat:/%s/", currFolder);
DrawText(40, 66, folder);
}
setfontsize (14);
setfontcolour (0xff, 0xff, 0xff);
//Do a little math (480 - (16*20+40))/2
Expand All @@ -1066,7 +1090,7 @@ static void ShowFiles (int offset, int selection, int upordown, int saveinfo) {
for (i = offset; i < (offset + PAGESIZE) && (i < maxfile); ++i){
//changed this to limit characters shown in filename since display gets weird
//if we let the entire filename appear

sprintf (folder, "fat:/%s/%s", currFolder, (char*)filelist[i]);


Expand Down
22 changes: 17 additions & 5 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ extern u8 filelist[1024][1024];
extern bool offsetchanged;
extern u8 currFolder[260];
extern int folderCount;
extern int displaypath;

s32 MEM_CARD = CARD_SLOTB;
extern syssramex *sramex;
Expand Down Expand Up @@ -307,6 +308,8 @@ void SD_BackupMode ()
int selected = 0;
int bytestodo;
char buffer[256], text[64];

displaypath = 0;

clearRightPane();
DrawText(386,130,"B a c k u p M o d e");
Expand All @@ -318,9 +321,9 @@ void SD_BackupMode ()
setfontsize (14);
writeStatusBar("Pick a file using UP or DOWN ", "Press A to backup savegame") ;
#ifdef HW_RVL
DrawText(40, 60, "Press R/1 to backup ALL savegames");
DrawText(40, 50, "Press R/1 to backup ALL savegames");
#else
DrawText(40, 60, "Press R to backup ALL savegames");
DrawText(40, 50, "Press R to backup ALL savegames");
#endif

/*** If it's a blank card, get out of here ***/
Expand Down Expand Up @@ -419,6 +422,8 @@ void SD_BackupModeAllFiles ()
int bytestodo;

char buffer[128];

displaypath = 0;

clearRightPane();
DrawText(386,130," B a c k u p A l l ");
Expand Down Expand Up @@ -471,6 +476,8 @@ void SD_RestoreMode ()
int selected;
char buffer[256], text[64];
int inProgress = 1;

displaypath = 1;

clearRightPane();
DrawText(380,130,"R e s t o r e M o d e");
Expand All @@ -483,10 +490,11 @@ void SD_RestoreMode ()

files = SDGetFileList (1);

setfontsize (14);
#ifdef HW_RVL
DrawText(40, 60, "Press R/1 to restore ALL savegames");
DrawText(40, 50, "Press R/1 to restore ALL savegames");
#else
DrawText(40, 60, "Press R to restore ALL savegames");
DrawText(40, 50, "Press R to restore ALL savegames");
#endif

if (!files)
Expand All @@ -497,7 +505,6 @@ void SD_RestoreMode ()
{
while(inProgress == 1)
{
setfontsize (14);
writeStatusBar("Pick a file using UP or DOWN", "Press A to restore to Memory Card ") ;

//It will wait here until user selected a file
Expand Down Expand Up @@ -633,6 +640,9 @@ void SD_RawBackupMode ()
{
s32 writen = 0;
char msg[64];

displaypath = 0;

clearRightPane();

DrawText(394,224,"___________________");
Expand Down Expand Up @@ -668,6 +678,8 @@ void SD_RawRestoreMode ()
int i;
int inProgress = 1;

displaypath = 1;

clearRightPane();
DrawText(380,130,"R A W R e s t o r e");
DrawText(450,150,"M o d e");
Expand Down
4 changes: 4 additions & 0 deletions source/mcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ int lasticon;
u8 filelist[1024][1024];
u8 currFolder[260];
int folderCount;
int displaypath;
int maxfile;
extern int cancel;
extern bool offsetchanged;
Expand Down Expand Up @@ -810,6 +811,9 @@ void MC_DeleteMode(int slot)
int memitems, err;
int selected = 0;
int erase;

displaypath = 0;

clearRightPane();
DrawText(386,130,"D e l e t e M o d e");
DrawText(386,134,"_____________________");
Expand Down

0 comments on commit 3d9720c

Please sign in to comment.