mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-08 07:51:19 +12:00
Initial support for title switching + better Wii U menu compatibility (#907)
This commit is contained in:
parent
bfbeeae6f6
commit
2200cc0ddf
95 changed files with 2549 additions and 746 deletions
|
@ -6,7 +6,7 @@ struct FSCMountPathNode
|
|||
std::string path;
|
||||
std::vector<FSCMountPathNode*> subnodes;
|
||||
FSCMountPathNode* parent;
|
||||
// device target and path (if subnodes is empty)
|
||||
// associated device target and path
|
||||
fscDeviceC* device{ nullptr };
|
||||
void* ctx{ nullptr };
|
||||
std::string deviceTargetPath; // the destination base path for the device, utf8
|
||||
|
@ -17,6 +17,25 @@ struct FSCMountPathNode
|
|||
{
|
||||
}
|
||||
|
||||
void AssignDevice(fscDeviceC* device, void* ctx, std::string_view deviceBasePath)
|
||||
{
|
||||
this->device = device;
|
||||
this->ctx = ctx;
|
||||
this->deviceTargetPath = deviceBasePath;
|
||||
}
|
||||
|
||||
void UnassignDevice()
|
||||
{
|
||||
this->device = nullptr;
|
||||
this->ctx = nullptr;
|
||||
this->deviceTargetPath.clear();
|
||||
}
|
||||
|
||||
bool IsRootNode() const
|
||||
{
|
||||
return !parent;
|
||||
}
|
||||
|
||||
~FSCMountPathNode()
|
||||
{
|
||||
for (auto& itr : subnodes)
|
||||
|
@ -141,9 +160,7 @@ sint32 fsc_mount(std::string_view mountPath, std::string_view targetPath, fscDev
|
|||
fscLeave();
|
||||
return FSC_STATUS_INVALID_PATH;
|
||||
}
|
||||
node->device = fscDevice;
|
||||
node->ctx = ctx;
|
||||
node->deviceTargetPath = std::move(targetPathWithSlash);
|
||||
node->AssignDevice(fscDevice, ctx, targetPathWithSlash);
|
||||
fscLeave();
|
||||
return FSC_STATUS_OK;
|
||||
}
|
||||
|
@ -160,14 +177,13 @@ bool fsc_unmount(std::string_view mountPath, sint32 priority)
|
|||
}
|
||||
cemu_assert(mountPathNode->priority == priority);
|
||||
cemu_assert(mountPathNode->device);
|
||||
// delete node
|
||||
while (mountPathNode && mountPathNode->parent)
|
||||
// unassign device
|
||||
mountPathNode->UnassignDevice();
|
||||
// prune empty branch
|
||||
while (mountPathNode && !mountPathNode->IsRootNode() && mountPathNode->subnodes.empty() && !mountPathNode->device)
|
||||
{
|
||||
FSCMountPathNode* parent = mountPathNode->parent;
|
||||
cemu_assert(!(!mountPathNode->subnodes.empty() && mountPathNode->device));
|
||||
if (!mountPathNode->subnodes.empty())
|
||||
break;
|
||||
parent->subnodes.erase(std::find(parent->subnodes.begin(), parent->subnodes.end(), mountPathNode));
|
||||
std::erase(parent->subnodes, mountPathNode);
|
||||
delete mountPathNode;
|
||||
mountPathNode = parent;
|
||||
}
|
||||
|
|
|
@ -205,7 +205,6 @@ bool FSCDeviceWUD_Mount(std::string_view mountPath, std::string_view destination
|
|||
bool FSCDeviceWUA_Mount(std::string_view mountPath, std::string_view destinationBaseDir, class ZArchiveReader* archive, sint32 priority);
|
||||
|
||||
// hostFS device
|
||||
void fscDeviceHostFS_mapBaseDirectories_deprecated();
|
||||
bool FSCDeviceHostFS_Mount(std::string_view mountPath, std::string_view hostTargetPath, sint32 priority);
|
||||
|
||||
// redirect device
|
||||
|
|
|
@ -289,13 +289,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
void fscDeviceHostFS_mapBaseDirectories_deprecated()
|
||||
{
|
||||
const auto mlc = ActiveSettings::GetMlcPath();
|
||||
fsc_mount("/cemuBossStorage/", _pathToUtf8(mlc / "usr/boss/"), &fscDeviceHostFSC::instance(), NULL, FSC_PRIORITY_BASE);
|
||||
fsc_mount("/vol/storage_mlc01/", _pathToUtf8(mlc / ""), &fscDeviceHostFSC::instance(), NULL, FSC_PRIORITY_BASE);
|
||||
}
|
||||
|
||||
bool FSCDeviceHostFS_Mount(std::string_view mountPath, std::string_view hostTargetPath, sint32 priority)
|
||||
{
|
||||
return fsc_mount(mountPath, hostTargetPath, &fscDeviceHostFSC::instance(), nullptr, priority) == FSC_STATUS_OK;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue