Skip to content

Commit bb13043

Browse files
authored
Merge pull request #100 from pcm720/hddosd
Set HDD-OSD-specific flags when pasting second-level subdirectories to hdd0:__common
2 parents 53dcc8f + b90c382 commit bb13043

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/filer.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ typedef struct
2222
#define MC_ATTR_norm_file 0x8497 //file (PS2/PS1) on PS2 MC
2323
#define MC_ATTR_PS1_file 0x9417 //PS1 save file on PS1 MC
2424

25+
#define HDD_ATTR_save_folder 0xC4A7 //PS2 save file folder on HDD __common partition
26+
#define HDD_ATTR_save_prot_folder 0xC4AF //PS2 protected save file folder on HDD __common partition
27+
2528
#define IOCTL_RENAME 0xFEEDC0DE //Ioctl request code for Rename function
2629

2730
enum {
@@ -2585,6 +2588,21 @@ int copy(char *outPath, const char *inPath, FILEINFO file, int recurses)
25852588
} else if (ret < 0) {
25862589
return -1; //return error for failure to create destination folder
25872590
}
2591+
2592+
//Set save folder attributes for __common partition when copying to hdd0 to make it show up in the HDD-OSD Browser
2593+
if (!strncmp(outParty, "hdd0:__common", 13) && !(file.stats.AttrFile & sceMcFileAttrPDAExec)) {
2594+
//Calculate the out level
2595+
ret = 0;
2596+
for (i = 0; i <= strlen(out); i++) {
2597+
if (out[i] == '/')
2598+
ret++;
2599+
}
2600+
if (ret == 3) { //Only set attributes for the second-level folder (out is pfs0:/?/?/)
2601+
iox_stat.attr = (file.stats.AttrFile & sceMcFileAttrDupProhibit) ? HDD_ATTR_save_prot_folder : HDD_ATTR_save_folder;
2602+
fileXioChStat(out, &iox_stat, FIO_CST_ATTR);
2603+
iox_stat.attr = 0; //Reset attributes
2604+
}
2605+
}
25882606
}
25892607
//Here a destination folder, or a PSU file exists, ready to receive files
25902608
if (PasteMode == PM_MC_BACKUP) { //MC Backup mode folder paste preparation

0 commit comments

Comments
 (0)