Skip to content

Commit

Permalink
Fix accessing the /vol/save directories
Browse files Browse the repository at this point in the history
  • Loading branch information
Maschell committed Apr 28, 2024
1 parent 3e1d862 commit ec1101e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
12 changes: 12 additions & 0 deletions source/IOAbstraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,18 @@ int IOAbstraction::stat (const char *path, struct stat *sbuf)
auto r = ::stat (convertedPath.c_str (), sbuf);
if (r < 0)
{
if (errno == EPERM)
{
auto *dir = ::opendir (convertedPath.c_str ());
if (dir)
{
*sbuf = {};
// TODO: init other values?
sbuf->st_mode = _IFDIR;
::closedir (dir);
return 0;
}
}
if (sVirtualDirs.contains (convertedPath))
{
*sbuf = {};
Expand Down
20 changes: 19 additions & 1 deletion source/wiiu/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <mocha/mocha.h>
#include <nn/ac.h>
#include <nn/act.h>
#include <thread>

#include <coreinit/thread.h>
Expand Down Expand Up @@ -159,6 +160,8 @@ void start_server ()
virtualDirsInRoot.emplace_back ("storage_usb");
IOAbstraction::addVirtualPath ("storage_usb:/", {});
}

sMochaPathsWereMounted = true;
}
virtualDirsInRoot.emplace_back ("fs");
IOAbstraction::addVirtualPath (":/", virtualDirsInRoot);
Expand All @@ -167,7 +170,22 @@ void start_server ()
"fs:/vol", std::vector<std::string>{"external01", "content", "save"});

IOAbstraction::addVirtualPath ("fs:/vol/content", {});
sMochaPathsWereMounted = true;

std::vector<std::string> virtualDirsInSave;
virtualDirsInSave.emplace_back ("common");
nn::act::Initialize ();
for (int32_t i = 0; i < 13; i++)
{
if (!nn::act::IsSlotOccupied (i))
{
continue;
}
char buffer[9];
snprintf (buffer, sizeof (buffer), "%08X", nn::act::GetPersistentIdEx (i));
virtualDirsInSave.emplace_back (buffer);
}
nn::act::Finalize ();
IOAbstraction::addVirtualPath ("fs:/vol/save", virtualDirsInSave);
}
else
{
Expand Down

0 comments on commit ec1101e

Please sign in to comment.