Skip to content

Commit

Permalink
wutdevoptab: Fake st_ino value
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Apr 8, 2023
1 parent d6760fb commit 3e04b31
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions libraries/wutdevoptab/devoptab_fsa_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,16 @@ time_t __wut_fsa_translate_time(FSTime timeValue) {
return (timeValue /1000000) + EPOCH_DIFF_SECS(WIIU_FSTIME_EPOCH_YEAR);
}

void __wut_fsa_translate_stat(FSAClientHandle handle, FSStat* fsStat, struct stat* posStat) {
static int __wut_fsa_info_fake_value_t = 0;
void __wut_fsa_translate_stat(FSAClientHandle clientHandle, FSStat* fsStat, struct stat* posStat) {
memset(posStat, 0, sizeof(struct stat));
posStat->st_ino = fsStat->entryId;
posStat->st_dev = (dev_t) handle;
posStat->st_dev = (dev_t) clientHandle;
// To have std::filesystem::copy support, we have to have unique st_ino values for two different files
// It's not really possible to get a unique value per file on Wii U, so instead we give everything a unique value.
// This means identifying the same file by st_ino would not work properly, but Cafe OS only allows us to open each file
// only once anyway.
// TODO: replace with hash of canonicalized path
posStat->st_ino = __wut_fsa_info_fake_value_t++;
posStat->st_mode = __wut_fsa_translate_stat_mode(fsStat);
posStat->st_nlink = 1;
posStat->st_uid = fsStat->owner;
Expand Down

0 comments on commit 3e04b31

Please sign in to comment.