OK, apparently it doesn’t load paks automatically, I managed to load my pak at runtime, and list it’s content with this: (Very Ugly code, don’t use it as is, it logs everything and shows screen messages, works in 4.12.5)
// Load Pak
void AFireStarterGameMode::LoadPakFile(FString Path)
{
if (FCoreDelegates::OnMountPak.IsBound()) {
FCoreDelegates::OnMountPak.Execute(Path, 3, nullptr); //Number should be 0-4; specifies search order
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Pak should be loaded"));
}
else
{
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Is not Bound"));
}
IPlatformFile& InnerPlatformFile = FPlatformFileManager::Get().GetPlatformFile();
FPakPlatformFile* PakPlatformFile = new FPakPlatformFile();
PakPlatformFile->Initialize(&InnerPlatformFile, TEXT(""));
//PakPlatformFile->Mount(*PakToLoad, 0, *(Path)); // Not Original
TArray<FPakPlatformFile::FPakListEntry> MountedPaks;
PakPlatformFile->GetMountedPaks(MountedPaks);
UE_LOG(LogTemp, Warning, TEXT("Befroe Scan Loop"));
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Before Scan Loop"));
//ignore first pak, because it is default game pak and we don't need iterate over it
for (int32 i = 0; i < MountedPaks.Num(); i++)
{
UE_LOG(LogTemp, Warning, TEXT("OnePack"));
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("OnePack"));
const FPakPlatformFile::FPakListEntry& mountedPak = MountedPaks[i];
const TMap<FString, FPakDirectory>& pakDirectoryMap = mountedPak.PakFile->GetIndex();
for (TMap<FString, FPakDirectory>::TConstIterator It(pakDirectoryMap); It; ++It)
{
FString Key = It.Key();
const FPakDirectory& Val = It.Value();
for (FPakDirectory::TConstIterator It2(Val); It2; ++It2)
{
FString Key2 = It2.Key();
FPakEntry* pakEntry = It2.Value();
//if (Key2.Contains(TEXT(".umap")))
//{
UE_LOG(LogTemp, Warning, TEXT("OneFile"));
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("OneFile"));
//this is where you will get map name of course if your map have *.umap extension:)
Key2 = Key2;
UE_LOG(LogTemp, Warning, TEXT("File: %s"),*Key2);
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red,TEXT("File: " + Key2));
//}
}
}
}
}