ReloadPakReaders

ReloadPakReaders

#Overview

name: ReloadPakReaders

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ReloadPakReaders is to refresh and recreate the readers for PAK (Package) files in the Unreal Engine system. PAK files are used for packaging and managing game content, and this function allows for reloading these readers during runtime.

This setting variable is primarily used within the PakFile subsystem of Unreal Engine. It is part of the core runtime functionality, specifically within the file I/O and content management systems.

The value of this variable is not explicitly set in the provided code snippets. Instead, it appears to be a function that can be called to perform the reload operation.

ReloadPakReaders interacts with the FPakPlatformFile class and its associated methods. It works in conjunction with the GetMountedPaks and RecreatePakReaders functions to refresh the PAK file readers.

Developers should be aware that calling ReloadPakReaders may have performance implications, as it iterates through all mounted PAK files and recreates their readers. This operation could potentially cause a temporary pause or stutter in the game if called during gameplay.

Best practices when using this variable (function) include:

  1. Use it judiciously, typically in response to specific events or user actions that require reloading PAK files.
  2. Consider the timing of when to call this function, avoiding calls during critical gameplay moments.
  3. Implement error handling to manage cases where PAK file readers cannot be recreated successfully.
  4. Use this functionality primarily for development and debugging purposes, rather than in production builds.
  5. Ensure that all necessary PAK files are properly mounted before calling this function.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/PakFile/Private/IPlatformFilePak.cpp:7978

Scope (from outer to inner):

file
class        class FPakExec : private FSelfRegisteringExec
function     virtual bool Exec_Dev

Source code excerpt:

			return true;
		}
		else if (FParse::Command(&Cmd, TEXT("ReloadPakReaders")))
		{
			PlatformFile.HandleReloadPakReadersCommand(Cmd, Ar);
			return true;
		}
		return false;
	}

#Loc: <Workspace>/Engine/Source/Runtime/PakFile/Private/IPlatformFilePak.cpp:8742

Scope (from outer to inner):

file
function     bool FPakPlatformFile::ReloadPakReaders

Source code excerpt:

}

bool FPakPlatformFile::ReloadPakReaders()
{
	TArray<FPakListEntry> Paks;
	GetMountedPaks(Paks);
	for (FPakListEntry& Pak : Paks)
	{
		if (!Pak.PakFile->RecreatePakReaders(LowerLevel))

#Loc: <Workspace>/Engine/Source/Runtime/PakFile/Public/IPlatformFilePak.h:2200

Scope (from outer to inner):

file
class        class FPakPlatformFile : public IPlatformFile

Source code excerpt:

	 * Re-creates all the pak readers
	 */
	PAKFILE_API bool ReloadPakReaders();

	/**
	 * Make unique in memory pak files from a list of named files
	 */
	PAKFILE_API virtual void MakeUniquePakFilesForTheseFiles(const TArray<TArray<FString>>& InFiles);