From 3d9720c058a62d093414d4c1697a172449192574 Mon Sep 17 00:00:00 2001 From: suloku Date: Thu, 6 Apr 2017 17:15:31 +0200 Subject: [PATCH] Display current path Pseudo-icon for folders Fix wrong text size in SD restore mode --- readme.txt | 2 +- source/freetype.c | 96 +++++++++++++++++++++++++++++------------------ source/main.c | 22 ++++++++--- source/mcard.c | 4 ++ 4 files changed, 82 insertions(+), 42 deletions(-) diff --git a/readme.txt b/readme.txt index ef2bd84..c1101c6 100644 --- a/readme.txt +++ b/readme.txt @@ -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. diff --git a/source/freetype.c b/source/freetype.c index f6caa49..2458594 100644 --- a/source/freetype.c +++ b/source/freetype.c @@ -83,6 +83,7 @@ extern u8 CommentBuffer[64] ATTRIBUTE_ALIGN (32); extern u8 currFolder[260]; extern int folderCount; +extern int displaypath; #define PAGESIZE 16 @@ -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 { @@ -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; iflash_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; iflash_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) @@ -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); } } @@ -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 @@ -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]); diff --git a/source/main.c b/source/main.c index d571662..cd00efd 100644 --- a/source/main.c +++ b/source/main.c @@ -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; @@ -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"); @@ -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 ***/ @@ -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 "); @@ -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"); @@ -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) @@ -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 @@ -633,6 +640,9 @@ void SD_RawBackupMode () { s32 writen = 0; char msg[64]; + + displaypath = 0; + clearRightPane(); DrawText(394,224,"___________________"); @@ -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"); diff --git a/source/mcard.c b/source/mcard.c index d140445..ef50ae4 100644 --- a/source/mcard.c +++ b/source/mcard.c @@ -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; @@ -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,"_____________________");