File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,6 +78,11 @@ SatisfactorySave::PakFile::PakFile(const std::filesystem::path& pakPath) : NumEn
7878 throw std::runtime_error (" FullDirectoryIndex missing in pak file!" );
7979 }
8080
81+ if (!MountPoint.starts_with (" ../../../" )) {
82+ throw std::runtime_error (" Invalid mount point" );
83+ }
84+ const auto abs_mount_point = MountPoint.substr (9 );
85+
8186 // Parse full directory index. Structure is TMap<FString, TMap<FString, int32>>.
8287 ar.seek (FullDirectoryIndexOffset);
8388 const int32_t FullDirectoryIndexNum = ar.read <int32_t >();
@@ -89,7 +94,7 @@ SatisfactorySave::PakFile::PakFile(const std::filesystem::path& pakPath) : NumEn
8994 std::string fileName;
9095 ar << fileName;
9196 const int32_t fileEntryIdx = ar.read <int32_t >();
92- const std::string fullFileName = directoryName + fileName;
97+ const std::string fullFileName = abs_mount_point + directoryName + fileName;
9398 if (directoryEntries_.contains (fullFileName)) {
9499 throw std::runtime_error (" Directory filename entry is not unique!" );
95100 }
Original file line number Diff line number Diff line change @@ -96,14 +96,14 @@ void SatisfactorySave::PakManager::cacheLatestPakNames(const std::optional<std::
9696 path = " Game/" + filename.substr (20 );
9797 }
9898 } else {
99- if (filename .starts_with (" Content /" )) {
100- path = filename. substr ( 8 );
99+ if (!path .starts_with (" FactoryGame/Mods /" )) {
100+ throw std::runtime_error ( " Mod asset outside \" FactoryGame/Mods/ \" ! " );
101101 }
102- bool startsWithSlash = ! path.empty () && path[ 0 ] == ' / ' ;
103- if (startsWithSlash) {
104- path = modPrefix.value () + path ;
105- } else {
106- path = modPrefix.value () + " /" + path;
102+ path = path.substr ( 17 ) ;
103+
104+ const auto content_name = modPrefix.value () + " /Content/ " ;
105+ if (path. starts_with (content_name)) {
106+ path = modPrefix.value () + " /" + path. substr (content_name. size ()) ;
107107 }
108108 }
109109
You can’t perform that action at this time.
0 commit comments