Skip to content

Commit 3eff2d4

Browse files
authored
GraphicPack: Allow overlay for code folder (#1574)
1 parent d427b59 commit 3eff2d4

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/Cafe/GraphicPack/GraphicPack2.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ void GraphicPack2::AddConstantsForCurrentPreset(ExpressionParser& ep)
821821
}
822822
}
823823

824-
void GraphicPack2::_iterateReplacedFiles(const fs::path& currentPath, bool isAOC)
824+
void GraphicPack2::_iterateReplacedFiles(const fs::path& currentPath, bool isAOC, const char* virtualMountBase)
825825
{
826826
uint64 currentTitleId = CafeSystem::GetForegroundTitleId();
827827
uint64 aocTitleId = (currentTitleId & 0xFFFFFFFFull) | 0x0005000c00000000ull;
@@ -836,7 +836,7 @@ void GraphicPack2::_iterateReplacedFiles(const fs::path& currentPath, bool isAOC
836836
}
837837
else
838838
{
839-
virtualMountPath = fs::path("vol/content/") / virtualMountPath;
839+
virtualMountPath = fs::path(virtualMountBase) / virtualMountPath;
840840
}
841841
fscDeviceRedirect_add(virtualMountPath.generic_string(), it.file_size(), it.path().generic_string(), m_fs_priority);
842842
}
@@ -861,7 +861,7 @@ void GraphicPack2::LoadReplacedFiles()
861861
{
862862
// setup redirections
863863
fscDeviceRedirect_map();
864-
_iterateReplacedFiles(contentPath, false);
864+
_iterateReplacedFiles(contentPath, false, "vol/content/");
865865
}
866866
// /aoc/
867867
fs::path aocPath(gfxPackPath);
@@ -874,7 +874,18 @@ void GraphicPack2::LoadReplacedFiles()
874874
aocTitleId |= 0x0005000c00000000ULL;
875875
// setup redirections
876876
fscDeviceRedirect_map();
877-
_iterateReplacedFiles(aocPath, true);
877+
_iterateReplacedFiles(aocPath, true, nullptr);
878+
}
879+
880+
// /code/
881+
fs::path codePath(gfxPackPath);
882+
codePath.append("code");
883+
884+
if (fs::exists(codePath, ec))
885+
{
886+
// setup redirections
887+
fscDeviceRedirect_map();
888+
_iterateReplacedFiles(codePath, false, CafeSystem::GetInternalVirtualCodeFolder().c_str());
878889
}
879890
}
880891

src/Cafe/GraphicPack/GraphicPack2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ class GraphicPack2
260260
CustomShader LoadShader(const fs::path& path, uint64 shader_base_hash, uint64 shader_aux_hash, GP_SHADER_TYPE shader_type) const;
261261
void ApplyShaderPresets(std::string& shader_source) const;
262262
void LoadReplacedFiles();
263-
void _iterateReplacedFiles(const fs::path& currentPath, bool isAOC);
263+
void _iterateReplacedFiles(const fs::path& currentPath, bool isAOC, const char* virtualMountBase);
264264

265265
// ram mappings
266266
std::vector<std::pair<MPTR, MPTR>> m_ramMappings;

0 commit comments

Comments
 (0)