Skip to content

GraphicPack: Allow overlay for code folder #1574

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions src/Cafe/GraphicPack/GraphicPack2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ void GraphicPack2::AddConstantsForCurrentPreset(ExpressionParser& ep)
}
}

void GraphicPack2::_iterateReplacedFiles(const fs::path& currentPath, bool isAOC)
void GraphicPack2::_iterateReplacedFiles(const fs::path& currentPath, bool isAOC, const char* virtualMountBase)
{
uint64 currentTitleId = CafeSystem::GetForegroundTitleId();
uint64 aocTitleId = (currentTitleId & 0xFFFFFFFFull) | 0x0005000c00000000ull;
Expand All @@ -836,7 +836,7 @@ void GraphicPack2::_iterateReplacedFiles(const fs::path& currentPath, bool isAOC
}
else
{
virtualMountPath = fs::path("vol/content/") / virtualMountPath;
virtualMountPath = fs::path(virtualMountBase) / virtualMountPath;
}
fscDeviceRedirect_add(virtualMountPath.generic_string(), it.file_size(), it.path().generic_string(), m_fs_priority);
}
Expand All @@ -861,7 +861,7 @@ void GraphicPack2::LoadReplacedFiles()
{
// setup redirections
fscDeviceRedirect_map();
_iterateReplacedFiles(contentPath, false);
_iterateReplacedFiles(contentPath, false, "vol/content/");
}
// /aoc/
fs::path aocPath(gfxPackPath);
Expand All @@ -874,7 +874,18 @@ void GraphicPack2::LoadReplacedFiles()
aocTitleId |= 0x0005000c00000000ULL;
// setup redirections
fscDeviceRedirect_map();
_iterateReplacedFiles(aocPath, true);
_iterateReplacedFiles(aocPath, true, nullptr);
}

// /code/
fs::path codePath(gfxPackPath);
codePath.append("code");

if (fs::exists(codePath, ec))
{
// setup redirections
fscDeviceRedirect_map();
_iterateReplacedFiles(codePath, false, CafeSystem::GetInternalVirtualCodeFolder().c_str());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Cafe/GraphicPack/GraphicPack2.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class GraphicPack2
CustomShader LoadShader(const fs::path& path, uint64 shader_base_hash, uint64 shader_aux_hash, GP_SHADER_TYPE shader_type) const;
void ApplyShaderPresets(std::string& shader_source) const;
void LoadReplacedFiles();
void _iterateReplacedFiles(const fs::path& currentPath, bool isAOC);
void _iterateReplacedFiles(const fs::path& currentPath, bool isAOC, const char* virtualMountBase);

// ram mappings
std::vector<std::pair<MPTR, MPTR>> m_ramMappings;
Expand Down
Loading