Operating System Simulator Plugin  3.5.1
Unreal Engine plugin that simulates an Operating System Environment
Loading...
Searching...
No Matches
UOperatingSystem Class Reference

Represents an operating system in the simulation. More...

#include "OperatingSystem.h"

Inheritance diagram for UOperatingSystem:
[legend]
Collaboration diagram for UOperatingSystem:
[legend]

Public Member Functions

template<class T >
T * GetAs () const
 Get a pointer to the object casted as type T.
 
template<class T >
FORCEINLINE const T * GetAsConst () const
 Get a pointer to the object casted as type T.
 
OPERATINGSYSTEMSIMULATOR_API bool AddNotification (const FOperatingSystemNotification &NewNotification)
 Adds a notification to the operating system.
 
OPERATINGSYSTEMSIMULATOR_API bool AddNotification (const FGenericError &GenericError, const EOperatingSystemNotificationCategory &Category, const EOperatingSystemNotificationType Verbosity=EOperatingSystemNotificationType::Error)
 Adds a notification to the operating system. This method allows adding a notification to the operating system with the specified error, category, and verbosity.
 
void StartOperatingSystem (const TWeakObjectPtr< const UOperatingSystemSaveGame > LoadGameInstance, FGenericError &OutError)
 Start the operating system. This method starts the operating system. It performs the necessary initialization and loads the settings and programs.
 
void PostLoadOperatingSystem ()
 Calls the PostLoadOperatingSystemImpl method and handles any error that occurs.
 
void FinishInstallation ()
 Finish the installation of the operating system.
 
void InstallStartupPrograms ()
 Install the startup programs for the operating system.
 
void ShutdownOS ()
 Shuts down the operating system.
 
void RestartOS ()
 Restarts the operating system.
 
void DestroyOS ()
 Destroys the operating system instance.
 
int32 AddRunningProgram (UOperatingSystemBaseProgram *NewProgram, FGenericError &OutError)
 Adds a running program to the operating system.
 
void ProgramStarted (UOperatingSystemBaseProgram *StartedProgram, const bool bIsRestored)
 Notifies the operating system that a program has started.
 
bool IsProgramRunning (const TWeakObjectPtr< const UOperatingSystemBaseProgram > TestProgram) const
 Check if a program is running.
 
bool IsProgramRunning (const TSubclassOf< UOperatingSystemBaseProgram > TestProgramClass) const
 Checks if a program of the specified class is currently running.
 
UDraggableWindowCreateNewWindow (TWeakObjectPtr< UOperatingSystemBaseProgram > TargetProgram) const
 Creates a new window for the target program.
 
void BringWindowToFront (UDraggableWindow *TargetWindow)
 Bring the specified window to the front.
 
virtual UOperatingSystemDirectoryCreateDirectoryInPath (const FString &TargetPath, const FString &DirectoryName, TSoftClassPtr< UOperatingSystemDirectory > DirectoryClass, UOperatingSystemPartition *TargetPartition, const bool bIsFromSaveGame, FGenericError &OutError)
 Creates a directory in the given target path.
 
bool CreateProgramsFromRepository (const TSoftObjectPtr< UOperatingSystemProgramsCollection > &TargetRepository, const bool bIsInstalledWithOS)
 Create programs from a given repository.
 
void SetToInstallStartupPrograms (const bool bInstall)
 
bool ShouldInstallStartupPrograms () const
 
void SetDeviceName (const FText &NewName)
 
FText GetDeviceName () const
 
void SetAutoLogin (const bool bEnableAutoLogin)
 
bool CanAutoLogin () const
 
float GetInstallationTime () const
 
float GetLoadingTime () const
 
float GetInitialLoadingTime () const
 
const TArray< FOperatingSystemNotification > & GetNotifications () const
 
void ClearAllNotifications ()
 
OPERATINGSYSTEMSIMULATOR_API void ConsumeSpaceInMB (const float &NewSizeInMB, UOperatingSystemPartition *Partition, FGenericError &OutError)
 
OPERATINGSYSTEMSIMULATOR_API void ConsumeSpaceInGB (const float &NewSizeInGB, UOperatingSystemPartition *Partition, FGenericError &OutError)
 
OPERATINGSYSTEMSIMULATOR_API FText GetSizeAsText (const EOperatingSystemSizeMethod SizeMethod, const UOperatingSystemPartition *Partition, FGenericError &OutError) const
 
OPERATINGSYSTEMSIMULATOR_API float GetStoragePercentage (const UOperatingSystemPartition *Partition, FGenericError &OutError) const
 
OPERATINGSYSTEMSIMULATOR_API double GetHardDiskSize (FGenericError &OutError, const EOperatingSystemSizeMethod SizeMethod=EOperatingSystemSizeMethod::GB) const
 
void UninstallProgram (const FName &ProgramIdentifier, FGenericError &OutErrorIfAny)
 
void UninstallProgramByClass (const TSoftClassPtr< UOperatingSystemBaseProgram > ProgramClass, FGenericError &OutErrorIfAny)
 
UOperatingSystemBaseProgramInstallProgramFromPackage (const FName &ProgramIdentifier, FGenericError &OutErrorIfAny)
 
UOperatingSystemBaseProgramInstallProgramFromClass (FGenericError &OutErrorIfAny, const TSoftClassPtr< UOperatingSystemBaseProgram > ProgramClass, UOperatingSystemPartition *TargetPartition=nullptr)
 
void BeginInstallation (UOperatingSystemPartition *TargetPartition, FGenericError &OutError)
 
UOperatingSystemPartitionAllocatePartition (const double SizeInBytes, FGenericError &OutError)
 
void RemovePartition (UOperatingSystemPartition *PartitionToDelete, FGenericError &OutError)
 
void RefreshPartitions ()
 
void InstallationCompleted (const bool bSwitchToDesktop=true)
 
bool CreateNewUser (const FOperatingSystemUser &NewUser, const bool bSetAsActive=false)
 
bool LoginUser (const FText &Username, const FText &Password)
 
bool UpdateCurrentUserDetails (const FOperatingSystemUser &UpdatedDetails)
 
bool HasEnoughSpace (const double &TestSizeInBytes, const UOperatingSystemPartition *InPartition) const
 
TArray< UOperatingSystemPartition * > GetDiskPartitions () const
 
UOperatingSystemPartitionGetOperatingSystemPartition () const
 
void CloseProgram (UOperatingSystemBaseProgram *TargetProgram, FGenericError &OutError)
 
bool BringBackgroundProgramToFront (UOperatingSystemBaseProgram *TargetProgram)
 
bool IsProgramInBackground (UOperatingSystemBaseProgram *TestProgram) const
 
void MinimizeProgram (UOperatingSystemBaseProgram *TargetProgram)
 
void CloseAllRunningPrograms ()
 
void RestoreMinimizedProgram (const UOperatingSystemBaseProgram *TargetProgram)
 Restores a minimized program to the foreground on the operating system's taskbar.
 
UObject * GetDirectoryIconObject (const FGameplayTag &TestTag) const
 
bool IsUnix () const
 
float GetBsodOnScreenTime () const
 
float GetToastNotificationDisplayTime () const
 
TArray< UOperatingSystemBaseProgram * > GetInstalledPrograms () const
 
void GetInstalledProgramsMap (TMap< FName, UOperatingSystemBaseProgram * > &OutInstalledPrograms)
 
UOperatingSystemBaseProgramGetInstalledProgram (const TSoftClassPtr< UOperatingSystemBaseProgram > TestClass) const
 
bool IsProgramInstalled (const TSoftClassPtr< UOperatingSystemBaseProgram > TestClass) const
 
UOperatingSystemBaseProgramGetRunningProgram (const TSoftClassPtr< UOperatingSystemBaseProgram > TestClass) const
 
bool IsPreInstalledOperatingSystem () const
 
UOperatingSystemSettingsDataGetSettings () const
 
bool IsRunningOnPortableDevice () const
 
virtual UOperatingSystemPartitionFindPartitionFromLetter (const FName &TargetDiskLetter) const
 Find a partition in the operating system from a given disk letter.
 
virtual TOptional< FText > GetRootCommand () const
 Retrieves the root command associated with the operating system.
 
virtual TOptional< FOperatingSystemUserGetRootUser () const
 Returns the root user of the operating system. This method retrieves the root user of the operating system and returns it as an optional object. If the root user cannot be determined or is not available, an empty optional object is returned.
 
bool HasValidRootCommandAndUser () const
 Determines whether the root command and user are valid.
 
bool IsShuttingDown () const
 Check if the operating system is in the process of shutting down.
 
bool IsRestarting () const
 Checks if the operating system is currently restarting.
 
TArray< FOperatingSystemUserGetAllUsers () const
 Returns an array of all users registered in the operating system. This function retrieves information about all users registered in the operating system.
 

Static Public Member Functions

static FName GetOperatingSystemProgramRestoredEventName ()
 
static UE_NODISCARD UOperatingSystemCreateOperatingSystem (UOperatingSystemBaseDevice *OwningDevice, FGenericError &OutError)
 Creates a new instance of the operating system associated with the specified device.
 
static UE_NODISCARD FString GetOperatingSystemUniqueID (const UOperatingSystem *TestOperatingSystem)
 Gets the unique ID of the operating system. This method retrieves the unique ID of the operating system represented by the given TestOperatingSystem object.
 

Public Attributes

FOperatingSystemProgramDelegate OnProgramStarted
 Delegate representing the event when a program starts in the operating system.
 
FOperatingSystemProgramDelegate OnProgramClosed
 Delegate for handling the program closed event.
 
FOperatingSystemProgramDelegate OnProgramInstalled
 Delegate representing the event when a program is installed in the operating system.
 
FOperatingSystemProgramDelegate OnProgramUninstalled
 

Protected Member Functions

virtual OPERATINGSYSTEMSIMULATOR_API void OnShowNotification (const FOperatingSystemNotification &NewNotification)
 This method is called when a new notification should be shown on the operating system.
 
virtual OPERATINGSYSTEMSIMULATOR_API void OnAllOnNotificationsCleared ()
 Callback triggered when all notifications are cleared.
 
virtual OPERATINGSYSTEMSIMULATOR_API void OnValidate (FGenericError &OutError) const
 This method is called to validate the object's state. This method should be overridden by derived classes to provide specific validation logic for the object. The validation result should be stored in the OutError parameter. If there are any validation errors, they should be added to the OutError object using its MAKE_ERROR macro.
 
virtual OPERATINGSYSTEMSIMULATOR_API void FinalizePreInstallation (FGenericError &OutError)
 Finalizes the pre-installation process.
 
virtual OPERATINGSYSTEMSIMULATOR_API void PrepareOperatingSystemInstallImpl (FGenericError &OutError)
 Prepares the operating system for installation.
 
virtual OPERATINGSYSTEMSIMULATOR_API bool StartOperatingSystemImpl (FGenericError &OutError)
 Starts the implementation of the operating system.
 
virtual OPERATINGSYSTEMSIMULATOR_API void PostLoadOperatingSystemImpl (FGenericError &OutError)
 This method is responsible for performing additional actions after the operating system is loaded.
 
virtual OPERATINGSYSTEMSIMULATOR_API void FinishInstallationImpl ()
 Performs the finishing steps of the installation process.
 
virtual OPERATINGSYSTEMSIMULATOR_API void InstallStartupProgramsImpl ()
 Allows the derived classes to implement their own logic for installing startup programs. This method should be overridden in derived classes to define the actual logic for installing startup programs.
 
virtual OPERATINGSYSTEMSIMULATOR_API void OnPartitionLoaded (UOperatingSystemPartition &LoadedPartition, const FOperatingSystemPartitionSaveLoad &SaveLoadData)
 Callback method called when a partition is loaded.
 
virtual OPERATINGSYSTEMSIMULATOR_API TSoftClassPtr< UOperatingSystemBaseProgramFindProgramFromPackage (const FName &ProgramIdentifier)
 Finds the program corresponding to the given package identifier. This method searches for a program based on the provided package identifier.
 
bool K2_CanStartOperatingSystem (FGenericError &ReturnError)
 Determines if the operating system can start.
 

Protected Attributes

FTimerHandle TimerHandle_OperatingSystemInstallation
 
FTimerHandle TimerHandle_LoadingTime
 
FText Name
 
FText CompanyName
 
FOperatingSystemVersion Version
 
TSoftObjectPtr< UObject > Icon
 
TMap< FGameplayTag, TSoftObjectPtr< UObject > > DirectoryIcons
 
float InstallationSpace
 
FGameplayTagContainer SupportedDevices
 
TSoftObjectPtr< UOperatingSystemProgramsCollectionMustHavePrograms
 
TSoftObjectPtr< UOperatingSystemProgramsCollectionPostInstallStartupPrograms
 
TSoftObjectPtr< UOperatingSystemDirectoriesCollectionDefaultDirectories
 
TSoftClassPtr< UOperatingSystemSettingsDataSettingsDataClass
 
TSoftClassPtr< UOperatingSystemWidgetWidgetClass
 
TSoftClassPtr< UOperatingSystemBsodWidgetBsodWidgetClass
 
FOperatingSystemNotificationSettings NotificationSettings
 
FOperatingSystemRangeTime InstallationTime
 
FOperatingSystemRangeTime LoadingTime
 
FOperatingSystemRangeTime LoadingTimeInitial
 
FOperatingSystemRangeTime LogonToDesktopTime
 
FOperatingSystemRangeTime BsodOnScreenTime
 
FGameplayTag OperatingSystemTag
 
TWeakObjectPtr< UOperatingSystemBaseDeviceParentDevice
 
TObjectPtr< UOperatingSystemSettingsDataOperatingSystemSettingsData
 
TObjectPtr< UOperatingSystemWidgetOperatingSystemWidget
 
TMap< int32, TObjectPtr< UOperatingSystemBaseProgram > > RunningPrograms
 
TMap< int32, TObjectPtr< UOperatingSystemBaseProgram > > BackgroundRunningPrograms
 
TMap< FName, UOperatingSystemBaseProgram * > InstalledPrograms
 
FOperatingSystemUser CurrentUser
 
uint8 bIsStartingForTheFirstTime: 1
 
int32 TotalNotifications
 
int32 TotalErrorNotifications
 
int32 TotalWarningNotifications
 
TObjectPtr< UOperatingSystemBsodWidgetBSODWidget
 
TMap< int32, TWeakObjectPtr< UOperatingSystemTaskbarButton > > TaskbarButtons
 Transient variable representing the taskbar buttons. It is a TMap that associates integer keys with weak object pointers to UOperatingSystemTaskbarButton objects. Key will be the process ID. Value will be the program.
 
FOperatingSystemUniqueId TargetPartitionID
 Structure representing a unique identifier for a target partition in the operating system.
 
TWeakObjectPtr< UDraggableWindowLastBroughtToFrontWindow
 Transient variable representing the last draggable window brought to the front.
 
uint8 bAutoLogin: 1
 
uint8 bInstallStartupPrograms: 1
 Specifies whether to install startup programs on the operating system.
 
FText DeviceName
 

Detailed Description

Represents an operating system in the simulation.

UOperatingSystem is a subclass of UObject and it contains various properties and methods related to an operating system, such as its name, version, supported devices, installed programs, etc. DO NOT inherit from this class directly.

See:

UOperatingSystemUnix
See:

UOperatingSystemNonUnix

Member Function Documentation

◆ AddNotification() [1/2]

bool UOperatingSystem::AddNotification ( const FGenericError & GenericError,
const EOperatingSystemNotificationCategory & Category,
const EOperatingSystemNotificationType Verbosity = EOperatingSystemNotificationType::Error )

Adds a notification to the operating system. This method allows adding a notification to the operating system with the specified error, category, and verbosity.

Parameters
GenericErrorThe error information for the notification.
CategoryThe category of the notification.
VerbosityVerbosity level.
Here is the call graph for this function:

◆ AddNotification() [2/2]

bool UOperatingSystem::AddNotification ( const FOperatingSystemNotification & NewNotification)

Adds a notification to the operating system.

This method adds a notification to the operating system. It checks if notifications are enabled in the notification settings before adding the notification. If notifications are not enabled, this method returns false. If notifications are enabled, it creates a notification manager and logs the new notification.

If the new notification is an error, it increments the total error notifications count and plays an error notification sound if enabled. If the new notification is a warning, it increments the total warning notifications count and plays a warning notification sound if enabled. If the new notification is neither an error nor a warning, it plays the default notification sound if enabled.

Parameters
NewNotificationThe notification to be added to the operating system.
Returns
Returns true if the notification is successfully added, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ AddRunningProgram()

int32 UOperatingSystem::AddRunningProgram ( UOperatingSystemBaseProgram * NewProgram,
FGenericError & OutError )

Adds a running program to the operating system.

This method adds a running program to the operating system. The program must be installed and the operating system must be in a running state. If the program is a single instance program, it checks if it is already running.

Parameters
NewProgramThe program to add to the operating system.
OutErrorThe error message if the program cannot be added.
Returns
The process ID of the added program, or INVALID_PROCESS_ID if the program cannot be added.
Here is the call graph for this function:

◆ AllocatePartition()

UOperatingSystemPartition * UOperatingSystem::AllocatePartition ( const double SizeInBytes,
FGenericError & OutError )

AllocatePartition is a method used to allocate a new partition on a specific device.

Parameters
SizeInBytes- The size of the partition to allocate in bytes.
OutError- Reference to an FGenericError object that will hold any error that occurs during partition allocation.
Returns
A pointer to the allocated UOperatingSystemPartition object, or nullptr if an error occurred during allocation.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BeginInstallation()

void UOperatingSystem::BeginInstallation ( UOperatingSystemPartition * TargetPartition,
FGenericError & OutError )

Begin installation of this Operating System. This is a simple timer which will call UOperatingSystem::FinishInstallation after the time returned by UOperatingSystem::GetInstallationTime()

Parameters
TargetPartitionWhich partition to install to? Must not be null.
OutError[FGenericError&] Outputs error (if any). Use the IsValid in this struct to check if there was any error.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ BringBackgroundProgramToFront()

bool UOperatingSystem::BringBackgroundProgramToFront ( UOperatingSystemBaseProgram * TargetProgram)

Brings a background program to the foreground and activates it. The program must be currently running in the background, otherwise an error will be returned.

Parameters
TargetProgramThe program to bring to the front.
Returns
True if the program was successfully brought to the front, false otherwise. If false is returned, the specific error will be logged.
Here is the call graph for this function:

◆ BringWindowToFront()

void UOperatingSystem::BringWindowToFront ( UDraggableWindow * TargetWindow)

Bring the specified window to the front.

This method is used to bring a draggable window to the front of all other windows in the operating system.

Parameters
TargetWindowThe window to bring to the front. Must be a valid draggable window.
Note
If the TargetWindow is already in front or invalid, this method has no effect.
This method also updates the taskbar buttons to reflect the change in window focus.

◆ CanAutoLogin()

bool UOperatingSystem::CanAutoLogin ( ) const

Checks if auto-login is enabled.

This method returns a boolean value indicating whether the auto-login feature is enabled or not.

Returns
true if auto-login is enabled, false otherwise.
See also
SetAutoLoginEnabled()

◆ ClearAllNotifications()

void UOperatingSystem::ClearAllNotifications ( )

Clears all notifications on the operating system.

◆ CloseAllRunningPrograms()

void UOperatingSystem::CloseAllRunningPrograms ( )

Closes all running programs in the operating system.

This method iterates over all the running programs in the operating system and calls the CloseProgram method to close each program. If an error occurs while closing a program, an error is generated and stored in OutError.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CloseProgram()

void UOperatingSystem::CloseProgram ( UOperatingSystemBaseProgram * TargetProgram,
FGenericError & OutError )

Closes the given program.

Parameters
TargetProgramThe program to close.
OutErrorThe error encountered during the process.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConsumeSpaceInGB()

void UOperatingSystem::ConsumeSpaceInGB ( const float & NewSizeInGB,
UOperatingSystemPartition * Partition,
FGenericError & OutError )

Consume space on the operating system partition in gigabytes.

Parameters
NewSizeInGBThe amount of space to consume in gigabytes.
PartitionThe operating system partition on which to consume the space.
OutError(out) The error message if the operation fails.
Note
This method retrieves the hard disk associated with the operating system and calls the ConsumeSpaceInGB method on the hard disk to perform the actual space consumption. If the operation fails, a notification is added to the operating system.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ConsumeSpaceInMB()

void UOperatingSystem::ConsumeSpaceInMB ( const float & NewSizeInMB,
UOperatingSystemPartition * Partition,
FGenericError & OutError )

Consume the given amount of space in megabytes (MB) from a specific operating system partition.

This method consumes space from the specified partition of the operating system by delegating the task to the associated hard disk object. If the hard disk is not valid, an error is thrown and returned through the OutError parameter. If consuming space from the partition fails, an error notification is added.

Parameters
NewSizeInMBThe amount of space to consume in megabytes (MB).
PartitionThe operating system partition from which to consume the space.
OutErrorAn FGenericError object used to return any errors that occur during the operation.
See also
UOperatingSystemHDD
FGenericError
AddNotification
Here is the call graph for this function:

◆ CreateDirectoryInPath()

UOperatingSystemDirectory * UOperatingSystem::CreateDirectoryInPath ( const FString & TargetPath,
const FString & DirectoryName,
TSoftClassPtr< UOperatingSystemDirectory > DirectoryClass,
UOperatingSystemPartition * TargetPartition,
const bool bIsFromSaveGame,
FGenericError & OutError )
virtual

Creates a directory in the given target path.

Parameters
TargetPathThe target path where the directory will be created.
DirectoryNameThe name of the directory to be created.
DirectoryClassThe class of the directory to be created.
TargetPartitionThe target partition where the directory will be created.
bIsFromSaveGameSpecifies whether the directory is created from a save game.
OutErrorA reference to a FGenericError structure that will hold any error information.
Returns
A pointer to the created directory, or nullptr if the directory could not be created.

Reimplemented in UOperatingSystemNonUnix, and UOperatingSystemUnix.

◆ CreateNewUser()

bool UOperatingSystem::CreateNewUser ( const FOperatingSystemUser & NewUser,
const bool bSetAsActive = false )

Creates a new user in the operating system.

Parameters
NewUserThe information of the new user to be created.
bSetAsActiveDetermines if the new user should be set as the active user.
Returns
True if the new user was successfully created, false otherwise.
Here is the call graph for this function:

◆ CreateNewWindow()

UDraggableWindow * UOperatingSystem::CreateNewWindow ( TWeakObjectPtr< UOperatingSystemBaseProgram > TargetProgram) const

Creates a new window for the target program.

This method creates a new window for the target program specified.

Parameters
TargetProgramThe target program for which the new window is to be created.
Returns
The newly created window object.

◆ CreateOperatingSystem()

UOperatingSystem * UOperatingSystem::CreateOperatingSystem ( UOperatingSystemBaseDevice * OwningDevice,
FGenericError & OutError )
static

Creates a new instance of the operating system associated with the specified device.

This method creates a new instance of the operating system associated with the specified device. If the operating system class is null, an error will be returned indicating that the operating system is missing. Otherwise, a new instance of the operating system will be created and initialized.

Parameters
OwningDeviceThe device that the operating system belongs to.
OutErrorThe error object that will be populated if an error occurs during the creation process.
Returns
A pointer to the newly created operating system instance, or nullptr if an error occurred.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateProgramsFromRepository()

bool UOperatingSystem::CreateProgramsFromRepository ( const TSoftObjectPtr< UOperatingSystemProgramsCollection > & TargetRepository,
const bool bIsInstalledWithOS )

Create programs from a given repository.

Parameters
TargetRepositoryThe repository from which to create the programs. Must not be null.
bIsInstalledWithOSDetermines whether the programs are installed with the operating system.
Returns
True if the program creation is successful, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DestroyOS()

void UOperatingSystem::DestroyOS ( )

Destroys the operating system instance.

This method is responsible for completely destroying the operating system instance and freeing up any resources it may have used. It performs the following actions:

  • Resets the shared pointer to the notification manager.
  • Resets the weak pointer to the last brought to front window.
  • Removes the BSOD widget from its parent.
  • Clears the list of installed programs.
  • Clears the list of running programs.
  • Removes the operating system widget from its parent.
  • Resets the weak pointer to the parent device.

◆ FinalizePreInstallation()

virtual OPERATINGSYSTEMSIMULATOR_API void UOperatingSystem::FinalizePreInstallation ( FGenericError & OutError)
inlineprotectedvirtual

Finalizes the pre-installation process.

This method is used to perform any necessary finalization steps before installation. It is called during the pre-installation phase.

Parameters
OutErrorReference to a FGenericError object that will be used to store any error information that occurs during the finalization process.
Note
By default, this function does nothing.
See also
FGenericError

Reimplemented in UOperatingSystemNonUnix, and UOperatingSystemUnix.

◆ FindPartitionFromLetter()

virtual UOperatingSystemPartition * UOperatingSystem::FindPartitionFromLetter ( const FName & TargetDiskLetter) const
inlinevirtual

Find a partition in the operating system from a given disk letter.

This method searches for an operating system partition that corresponds to the provided disk letter.

Parameters
TargetDiskLetterThe disk letter to search for. It should be of type FName.
Returns
A pointer to the found operating system partition. If no partition is found, nullptr is returned.
Note
By default, this function always return nullptr.

Reimplemented in UOperatingSystemNonUnix.

◆ FindProgramFromPackage()

virtual OPERATINGSYSTEMSIMULATOR_API TSoftClassPtr< UOperatingSystemBaseProgram > UOperatingSystem::FindProgramFromPackage ( const FName & ProgramIdentifier)
inlineprotectedvirtual

Finds the program corresponding to the given package identifier. This method searches for a program based on the provided package identifier.

Parameters
ProgramIdentifierThe package identifier of the program to be found.
Returns
A pointer to the soft class representing the found program. Returns nullptr if no program is found.
Note
By default, this function returns nullptr.

Reimplemented in UOperatingSystemUnix.

Here is the caller graph for this function:

◆ FinishInstallation()

void UOperatingSystem::FinishInstallation ( )

Finish the installation of the operating system.

This method is responsible for completing the installation process of the operating system. It performs several tasks such as creating default directories, installing startup programs, finishing the installation implementation, and notifying the user about the completion. After installation, it checks if this is the first start of the operating system and starts it if required.

Note
This method assumes that ParentDevice has been assigned properly before calling this method.
See also
UOperatingSystem::Internal_CreateDefaultDirectories()
UOperatingSystem::InstallStartupPrograms()
UOperatingSystem::FinishInstallationImpl()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FinishInstallationImpl()

virtual OPERATINGSYSTEMSIMULATOR_API void UOperatingSystem::FinishInstallationImpl ( )
inlineprotectedvirtual

Performs the finishing steps of the installation process.

This method should be implemented by derived classes to perform any necessary operations to finalize the installation process. It is called after all the installation steps have been completed.

Note
By default, this function does nothing.
Here is the caller graph for this function:

◆ GetAllUsers()

TArray< FOperatingSystemUser > UOperatingSystem::GetAllUsers ( ) const

Returns an array of all users registered in the operating system. This function retrieves information about all users registered in the operating system.

Returns
An array of FOperatingSystemUser objects representing the registered users.
See also
FOperatingSystemUser, UOperatingSystemStatics::GetUserManager()
Here is the call graph for this function:

◆ GetAs()

template<class T >
T * UOperatingSystem::GetAs ( ) const
inline

Get a pointer to the object casted as type T.

Returns
A pointer to the object casted as type T.
Warning
method assumes that T is derived from UOperatingSystem. If not, a static_assert will be triggered.

◆ GetAsConst()

template<class T >
FORCEINLINE const T * UOperatingSystem::GetAsConst ( ) const
inline

Get a pointer to the object casted as type T.

Returns
A pointer to the object casted as type T.
Warning
method assumes that T is derived from UOperatingSystem. If not, a static_assert will be triggered. This returns a const object.
Here is the caller graph for this function:

◆ GetBsodOnScreenTime()

float UOperatingSystem::GetBsodOnScreenTime ( ) const
inline

Returns the duration, in seconds, that the blue screen of death has been visible on the screen.

Returns
The time, in seconds, that the blue screen of death has been on screen.

◆ GetDeviceName()

FText UOperatingSystem::GetDeviceName ( ) const

Returns the device name.

Returns
The device name as a FText object.

◆ GetDirectoryIconObject()

UObject * UOperatingSystem::GetDirectoryIconObject ( const FGameplayTag & TestTag) const

Retrieves the directory icon object associated with the specified tag.

Parameters
TestTagThe tag used to determine the directory icon object.
Returns
The directory icon object.
Note
The returned object is loaded synchronously.

◆ GetDiskPartitions()

TArray< UOperatingSystemPartition * > UOperatingSystem::GetDiskPartitions ( ) const

Retrieves the disk partitions associated with the operating system.

Returns
An array of UOperatingSystemPartition pointers representing the disk partitions.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHardDiskSize()

double UOperatingSystem::GetHardDiskSize ( FGenericError & OutError,
const EOperatingSystemSizeMethod SizeMethod = EOperatingSystemSizeMethod::GB ) const

Returns the Hard Disk total size in given method.

Parameters
OutError[FGenericError&] If any error this will be valid.
SizeMethod[const EOperatingSystemSizeMethod] How you want to represent the return size to be.
Returns
[double] Size in given method.

◆ GetInitialLoadingTime()

float UOperatingSystem::GetInitialLoadingTime ( ) const

Gets the initial loading time.

This method returns the initial loading time of the operating system. If the initial loading time has not been cached yet, it will retrieve the value from the LoadingTimeInitial object and cache it for future requests.

Returns
The initial loading time in seconds.
Here is the call graph for this function:

◆ GetInstallationTime()

float UOperatingSystem::GetInstallationTime ( ) const

Retrieves the installation time of the operating system.

Returns
The installation time of the operating system in seconds.
Note
This method returns the cached installation time if it has been previously set. If the cached installation time has not been set, it retrieves the installation time from the system and caches it for future use.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInstalledProgram()

UOperatingSystemBaseProgram * UOperatingSystem::GetInstalledProgram ( const TSoftClassPtr< UOperatingSystemBaseProgram > TestClass) const

Retrieves the installed program of the specified class.

This method searches for an installed program in the list of installed programs that matches the specified class. If a matching program is found, it is returned; otherwise nullptr is returned.

Parameters
TestClassThe pointer to the class of the program to retrieve.
Returns
The installed program of the specified class, or nullptr if not found.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetInstalledPrograms()

TArray< UOperatingSystemBaseProgram * > UOperatingSystem::GetInstalledPrograms ( ) const

[DEPRECATED] Get the list of installed programs.

Returns
An array of UOperatingSystemBaseProgram objects representing the installed programs.

◆ GetInstalledProgramsMap()

void UOperatingSystem::GetInstalledProgramsMap ( TMap< FName, UOperatingSystemBaseProgram * > & OutInstalledPrograms)

Gets the TMap of installed programs.

Parameters
OutInstalledProgramsTMap of all installed programs with key set to their identifier.

◆ GetLoadingTime()

float UOperatingSystem::GetLoadingTime ( ) const

Get the loading time.

This method returns the loading time. If the loading time has not been previously set, it will calculate the loading time and store it in a cached variable for future retrieval. The loading time is obtained from the LoadingTime object.

Returns
The loading time in seconds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetNotifications()

const TArray< FOperatingSystemNotification > & UOperatingSystem::GetNotifications ( ) const
inline

Retrieves the notifications.

Returns
The array of operating system notifications.

◆ GetOperatingSystemPartition()

UOperatingSystemPartition * UOperatingSystem::GetOperatingSystemPartition ( ) const

Retrieves the operating system partition.

Returns
A pointer to the operating system partition.
Remarks
The returned pointer may be null if the operating system partition is not found.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetOperatingSystemProgramRestoredEventName()

static FName UOperatingSystem::GetOperatingSystemProgramRestoredEventName ( )
inlinestatic

Helper function that returns the name of the event that is triggered when a program is restored in the Operating System.

Returns
The event name for program restored event.
Here is the caller graph for this function:

◆ GetOperatingSystemUniqueID()

FString UOperatingSystem::GetOperatingSystemUniqueID ( const UOperatingSystem * TestOperatingSystem)
static

Gets the unique ID of the operating system. This method retrieves the unique ID of the operating system represented by the given TestOperatingSystem object.

Parameters
TestOperatingSystemThe operating system object to get the unique ID from.
Returns
A string representing the unique ID of the operating system.
Here is the caller graph for this function:

◆ GetRootCommand()

virtual TOptional< FText > UOperatingSystem::GetRootCommand ( ) const
inlinevirtual

Retrieves the root command associated with the operating system.

Returns
The root command as an optional text. If no root command is set, an empty optional is returned.
Note
By default, this function returns unset optional parameter.
See also
UOperatingSystemUnix::GetRootCommand

Reimplemented in UOperatingSystemUnix.

◆ GetRootUser()

virtual TOptional< FOperatingSystemUser > UOperatingSystem::GetRootUser ( ) const
inlinevirtual

Returns the root user of the operating system. This method retrieves the root user of the operating system and returns it as an optional object. If the root user cannot be determined or is not available, an empty optional object is returned.

Returns
An optional object of type FOperatingSystemUser that represents the root user of the operating system. An empty optional object is returned if the root user cannot be determined.
Note
The root user is a special user account in Unix-like operating systems that has administrative privileges and unrestricted access to all files and commands on the system.
By default, this function returns unset optional paramter.
See also
UOperatingSystemUnix::GetRootUser.

Reimplemented in UOperatingSystemUnix.

Here is the caller graph for this function:

◆ GetRunningProgram()

UOperatingSystemBaseProgram * UOperatingSystem::GetRunningProgram ( const TSoftClassPtr< UOperatingSystemBaseProgram > TestClass) const

Retrieves the running program that matches the given class.

Parameters
TestClassA soft class pointer to the program class.
Returns
A pointer to the running program that matches the given class, or nullptr if not found or TestClass is null.
Here is the caller graph for this function:

◆ GetSettings()

UOperatingSystemSettingsData * UOperatingSystem::GetSettings ( ) const

Retrieves the settings data object for this Operating System.

Returns
Settings data if one was created.
Here is the caller graph for this function:

◆ GetSizeAsText()

FText UOperatingSystem::GetSizeAsText ( const EOperatingSystemSizeMethod SizeMethod,
const UOperatingSystemPartition * Partition,
FGenericError & OutError ) const

Returns the size of the given partition.

Parameters
SizeMethodYour preferred method. Bytes, Megabytes or Gigabytes.
PartitionTarget partition to check size.
OutErrorOutputs error (if any).
Returns
[FText] Return text in the format {Size} {SizeString}. For example: 256 GB.

◆ GetStoragePercentage()

float UOperatingSystem::GetStoragePercentage ( const UOperatingSystemPartition * Partition,
FGenericError & OutError ) const

Returns the percentage of storage available. For example: 75%, 40% etc.

Returns
[float] Percentage of storage remaining in 0 - 100 range.

◆ GetToastNotificationDisplayTime()

float UOperatingSystem::GetToastNotificationDisplayTime ( ) const
inline

Retrieves the display time for toast notifications.

Returns
The display time for toast notifications in seconds.

◆ HasEnoughSpace()

bool UOperatingSystem::HasEnoughSpace ( const double & TestSizeInBytes,
const UOperatingSystemPartition * InPartition ) const

Check if a given partition has enough space for a given size.

Parameters
TestSizeInBytesThe size to test in bytes.
InPartitionThe partition to check the space on.
Returns
True if the partition has enough space, false otherwise.
Here is the call graph for this function:

◆ HasValidRootCommandAndUser()

bool UOperatingSystem::HasValidRootCommandAndUser ( ) const
inline

Determines whether the root command and user are valid.

This method checks if the root command and user are both set, indicating that a valid root command and user have been provided.

Returns
True if both the root command and user are set, otherwise false.
Note
This function should be true in UOperatingSystemUnix.

◆ InstallationCompleted()

void UOperatingSystem::InstallationCompleted ( const bool bSwitchToDesktop = true)

Marks the completion of the installation process.

This method sets the 'bIsStartingForTheTime' flag to false in order to indicate that the operating system has finished its initial setup. It also triggers the 'OnFinishSettingUpOperatingSystemPostInstallation' event on the parent device.

Optionally, this method switches the current tab of the operating system widget to the desktop tab.

Parameters
bSwitchToDesktopWhether to switch the current tab to the desktop tab (default: true)

◆ InstallProgramFromClass()

UOperatingSystemBaseProgram * UOperatingSystem::InstallProgramFromClass ( FGenericError & OutErrorIfAny,
const TSoftClassPtr< UOperatingSystemBaseProgram > ProgramClass,
UOperatingSystemPartition * TargetPartition = nullptr )

Installs the given program class. If target partition is null, system partition is automatically used.

Parameters
OutErrorIfAnyOutputs any error. Use the IsValid from this struct to check if there are any errors.
ProgramClassTarget program class to install
TargetPartitionTarget partition to install. If null, then system partition is automatically used.
Returns
Valid program if installed. Null otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InstallProgramFromPackage()

UOperatingSystemBaseProgram * UOperatingSystem::InstallProgramFromPackage ( const FName & ProgramIdentifier,
FGenericError & OutErrorIfAny )

Installs a program from a package.

This method installs a program from a package specified by the ProgramIdentifier parameter. If the program is found in the package repository, it will be installed and a pointer to the installed program will be returned. If the program is not found, an error message will be assigned to the OutErrorIfAny parameter and a nullptr will be returned.

Parameters
ProgramIdentifierThe identifier of the program to install.
OutErrorIfAny[out] The error message if program installation fails.
Returns
A pointer to the installed program, or nullptr if program installation fails.
Here is the call graph for this function:

◆ InstallStartupPrograms()

void UOperatingSystem::InstallStartupPrograms ( )

Install the startup programs for the operating system.

This method checks if the startup programs should be installed and then calls the InstallStartupProgramsImpl() method to perform the actual installation.

See also
ShouldInstallStartupPrograms()
InstallStartupProgramsImpl()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InstallStartupProgramsImpl()

virtual OPERATINGSYSTEMSIMULATOR_API void UOperatingSystem::InstallStartupProgramsImpl ( )
inlineprotectedvirtual

Allows the derived classes to implement their own logic for installing startup programs. This method should be overridden in derived classes to define the actual logic for installing startup programs.

Note
By default, this function does nothing.
Here is the caller graph for this function:

◆ IsPreInstalledOperatingSystem()

bool UOperatingSystem::IsPreInstalledOperatingSystem ( ) const

Check if the operating system is pre-installed on the parent device.

Returns
True if the operating system is pre-installed, false otherwise.
Note
This method is a wrapper around the IsOperatingSystemPreInstalled method of the parent device.

◆ IsProgramInBackground()

bool UOperatingSystem::IsProgramInBackground ( UOperatingSystemBaseProgram * TestProgram) const

Determines if the specified program is currently running in the background or not.

Parameters
TestProgramA pointer to the UOperatingSystemBaseProgram object to be tested.
Returns
true if the program is running in the background, false otherwise.
Here is the call graph for this function:

◆ IsProgramInstalled()

bool UOperatingSystem::IsProgramInstalled ( const TSoftClassPtr< UOperatingSystemBaseProgram > TestClass) const

Checks if a program is installed. This method checks if a program, represented by the provided UOperatingSystemBaseProgram subclass, is installed on the system.

Parameters
TestClassThe TSoftClassPtr<UOperatingSystemBaseProgram> representing the program to be checked.
Returns
true if the program is installed, false otherwise.
Here is the call graph for this function:

◆ IsProgramRunning() [1/2]

bool UOperatingSystem::IsProgramRunning ( const TSubclassOf< UOperatingSystemBaseProgram > TestProgramClass) const

Checks if a program of the specified class is currently running.

Parameters
TestProgramClassThe class of the program to check.
Returns
True if a program of the specified class is running, false otherwise.

◆ IsProgramRunning() [2/2]

bool UOperatingSystem::IsProgramRunning ( const TWeakObjectPtr< const UOperatingSystemBaseProgram > TestProgram) const

Check if a program is running.

This method checks if a program is currently running based on the provided TestProgram.

Parameters
TestProgramA weak pointer to the UOperatingSystemBaseProgram object representing the program to be checked.
Returns
A boolean value indicating whether the program is running or not. Returns true if the TestProgram is valid and running, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsRestarting()

bool UOperatingSystem::IsRestarting ( ) const

Checks if the operating system is currently restarting.

Returns
True if the operating system is restarting, false otherwise.
Here is the caller graph for this function:

◆ IsRunningOnPortableDevice()

bool UOperatingSystem::IsRunningOnPortableDevice ( ) const

Checks to see if this Operating System is running on a portable device actor.

Returns
True if this Operating System is running on a portable device actor.

◆ IsShuttingDown()

bool UOperatingSystem::IsShuttingDown ( ) const

Check if the operating system is in the process of shutting down.

This method determines whether the operating system is currently in the process of shutting down. It does this by calling the IsShuttingDown() method of the ParentDevice object.

Returns
True if the operating system is in the process of shutting down, false otherwise.
Here is the caller graph for this function:

◆ IsUnix()

bool UOperatingSystem::IsUnix ( ) const
inline

Checks if the operating system is Unix.

Returns
True if the operating system is Unix, false otherwise.
Here is the caller graph for this function:

◆ K2_CanStartOperatingSystem()

bool UOperatingSystem::K2_CanStartOperatingSystem ( FGenericError & ReturnError)
protected

Determines if the operating system can start.

This method checks if the operating system can start successfully. It is a BlueprintImplementableEvent, which means that it can be implemented in Blueprint classes.

Parameters
ReturnError[out] A reference to a FGenericError structure that will hold the error message if the operating system cannot start.
Returns
True if the operating system can start, false otherwise.
Here is the caller graph for this function:

◆ LoginUser()

bool UOperatingSystem::LoginUser ( const FText & Username,
const FText & Password )

Logs the user in with the given username and password.

Parameters
UsernameThe username of the user.
PasswordThe password of the user.
Returns
True if the user was successfully logged in, false otherwise.
Here is the call graph for this function:

◆ MinimizeProgram()

void UOperatingSystem::MinimizeProgram ( UOperatingSystemBaseProgram * TargetProgram)

Minimizes the specified program.

Parameters
TargetProgramThe program to minimize.
Here is the call graph for this function:

◆ OnAllOnNotificationsCleared()

void UOperatingSystem::OnAllOnNotificationsCleared ( )
protectedvirtual

Callback triggered when all notifications are cleared.

This function is called when all notifications are cleared in the operating system. It resets the total number of notifications, error notifications, and warning notifications. Then it calls the AllNotificationsCleared() function of the OperatingSystemWidget.

◆ OnPartitionLoaded()

virtual OPERATINGSYSTEMSIMULATOR_API void UOperatingSystem::OnPartitionLoaded ( UOperatingSystemPartition & LoadedPartition,
const FOperatingSystemPartitionSaveLoad & SaveLoadData )
inlineprotectedvirtual

Callback method called when a partition is loaded.

Parameters
LoadedPartitionThe reference to the loaded partition.
SaveLoadDataThe save/load data for the partition.
Note
By default, this function does nothing.

Reimplemented in UOperatingSystemNonUnix.

◆ OnShowNotification()

void UOperatingSystem::OnShowNotification ( const FOperatingSystemNotification & NewNotification)
protectedvirtual

This method is called when a new notification should be shown on the operating system.

Parameters
NewNotificationThe new notification to be shown.
Note
This method is responsible for displaying the notification on the operating system.

◆ OnValidate()

virtual OPERATINGSYSTEMSIMULATOR_API void UOperatingSystem::OnValidate ( FGenericError & OutError) const
inlineprotectedvirtual

This method is called to validate the object's state. This method should be overridden by derived classes to provide specific validation logic for the object. The validation result should be stored in the OutError parameter. If there are any validation errors, they should be added to the OutError object using its MAKE_ERROR macro.

Note
By default, this function does nothing.
Parameters
OutErrorReference to an FGenericError object that will be populated with any validation errors.
See also
FGenericError

Reimplemented in UOperatingSystemUnix.

◆ PostLoadOperatingSystem()

void UOperatingSystem::PostLoadOperatingSystem ( )

Calls the PostLoadOperatingSystemImpl method and handles any error that occurs.

This method is responsible for initializing the operating system after it has been loaded. It calls the PostLoadOperatingSystemImpl method to perform the necessary initialization steps. If an error occurs during the initialization process, it sets the error in the BSODWidget and shows the Blue Screen of Death (BSOD) on the ParentDevice.

Remarks
This method should be called after the operating system has been loaded.
See also
PostLoadOperatingSystemImpl
Here is the call graph for this function:

◆ PostLoadOperatingSystemImpl()

virtual OPERATINGSYSTEMSIMULATOR_API void UOperatingSystem::PostLoadOperatingSystemImpl ( FGenericError & OutError)
inlineprotectedvirtual

This method is responsible for performing additional actions after the operating system is loaded.

Parameters
OutErrorA reference to the FGenericError object that can be used to report any errors that occur during the post-load process.
See also
FGenericError

Reimplemented in UOperatingSystemNonUnix, and UOperatingSystemUnix.

Here is the caller graph for this function:

◆ PrepareOperatingSystemInstallImpl()

virtual OPERATINGSYSTEMSIMULATOR_API void UOperatingSystem::PrepareOperatingSystemInstallImpl ( FGenericError & OutError)
inlineprotectedvirtual

Prepares the operating system for installation.

This method is virtual and can be overridden in derived classes to implement the specific logic for preparing the operating system for installation. The implementation should set the error message in the provided FGenericError object if any error occurs during the preparation process.

Parameters
OutErrorA reference to the FGenericError object to store any error message generated during the preparation process.
Note
By default, this function does nothing.
See also
FGenericError

Reimplemented in UOperatingSystemNonUnix, and UOperatingSystemUnix.

◆ ProgramStarted()

void UOperatingSystem::ProgramStarted ( UOperatingSystemBaseProgram * StartedProgram,
const bool bIsRestored )

Notifies the operating system that a program has started.

This method is used to inform the operating system that a program has started. It takes a pointer to the UOperatingSystemBaseProgram object representing the started program, and a boolean indicating whether the program is being restored from a minimized state.

If the started program has a valid taskbar button, this method adds it to the list of taskbar buttons. The taskbar button is identified by the process ID of the started program.

If the program is not being restored, the "OnProgramStarted" event is broadcasted, indicating that the program has started.

Parameters
StartedProgramPointer to the UOperatingSystemBaseProgram object representing the started program.
bIsRestoredBoolean indicating whether the program is being restored from a minimized state.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ RefreshPartitions()

void UOperatingSystem::RefreshPartitions ( )

Refreshes the partitions of the operating system.

This method updates the partitions of the operating system based on the current state of the underlying hardware device.

Here is the call graph for this function:

◆ RemovePartition()

void UOperatingSystem::RemovePartition ( UOperatingSystemPartition * PartitionToDelete,
FGenericError & OutError )

Removes a partition from the operating system.

Parameters
PartitionToDeleteThe partition to be removed.
OutErrorThe error message if any error occurs.

◆ RestartOS()

void UOperatingSystem::RestartOS ( )

Restarts the operating system.

This method is used to restart the operating system. It first closes all the running programs and then initiates the restart process.

See also
CloseAllRunningPrograms(), OperatingSystemWidget
Here is the call graph for this function:

◆ RestoreMinimizedProgram()

void UOperatingSystem::RestoreMinimizedProgram ( const UOperatingSystemBaseProgram * TargetProgram)

Restores a minimized program to the foreground on the operating system's taskbar.

This method attempts to restore the specified program identified by the given TargetProgram. If the program is currently minimized, it will be brought back to the foreground on the taskbar.

Parameters
TargetProgramThe target program to restore. It must be a valid pointer to an instance of the UOperatingSystemBaseProgram class.
Note
If the TargetProgram is not a valid pointer, this method will do nothing. The specified TargetProgram must be a previously registered taskbar button on the operating system.
See also
UOperatingSystemBaseProgram, ChangeTaskbarState()
Here is the call graph for this function:

◆ SetAutoLogin()

void UOperatingSystem::SetAutoLogin ( const bool bEnableAutoLogin)

Sets the auto login flag for the operating system.

This method allows the user to enable or disable auto login for the operating system.

Parameters
bEnableAutoLogin- The value indicating whether auto login should be enabled or disabled.
  • true: Auto login is enabled.
  • false: Auto login is disabled.

◆ SetDeviceName()

void UOperatingSystem::SetDeviceName ( const FText & NewName)

Sets the name of the device.

This method allows the user to set the name of the device.

Parameters
NewNameThe new name of the device.

◆ SetToInstallStartupPrograms()

void UOperatingSystem::SetToInstallStartupPrograms ( const bool bInstall)

Sets whether to install startup programs.

This method allows you to specify whether the operating system should install startup programs.

Parameters
bInstallA boolean value indicating whether startup programs should be installed. Set to true if startup programs should be installed, false otherwise.

◆ ShouldInstallStartupPrograms()

bool UOperatingSystem::ShouldInstallStartupPrograms ( ) const

Determines whether the startup programs should be installed.

Returns
  • true if the startup programs should be installed.
  • false otherwise.

    This method checks if the PostInstallStartupPrograms is null or empty. It also checks if the flag bInstallStartupPrograms is set to true. If both conditions are satisfied, the method returns true; otherwise, it returns false.

Here is the caller graph for this function:

◆ ShutdownOS()

void UOperatingSystem::ShutdownOS ( )

Shuts down the operating system.

This method initiates the shutdown process for the operating system. It closes all running programs and triggers the shutdown procedure handled by the operating system widget.

Here is the call graph for this function:

◆ StartOperatingSystem()

void UOperatingSystem::StartOperatingSystem ( const TWeakObjectPtr< const UOperatingSystemSaveGame > LoadGameInstance,
FGenericError & OutError )

Start the operating system. This method starts the operating system. It performs the necessary initialization and loads the settings and programs.

Parameters
LoadGameInstanceA weak pointer to an instance of UOperatingSystemSaveGame containing the saved game data to load. This parameter is optional and can be nullptr if no saved game is available.
OutErrorA reference to an FGenericError object that will store any error that occurs during the startup process. Any error message will be stored in the OutError object.
Here is the call graph for this function:

◆ StartOperatingSystemImpl()

virtual OPERATINGSYSTEMSIMULATOR_API bool UOperatingSystem::StartOperatingSystemImpl ( FGenericError & OutError)
inlineprotectedvirtual

Starts the implementation of the operating system.

This method starts the implementation of the operating system. It performs the necessary steps to initiate the operating system functionality.

Parameters
OutErrorReference to a FGenericError object that will store any errors that occur during the operation.
Note
By default, this function always return false. Child class must override this function and do the logic.
Returns
False by default.
See also
FGenericError

Reimplemented in UOperatingSystemNonUnix, and UOperatingSystemUnix.

Here is the caller graph for this function:

◆ UninstallProgram()

void UOperatingSystem::UninstallProgram ( const FName & ProgramIdentifier,
FGenericError & OutErrorIfAny )

Uninstalls the given program identifier from this Operating System.

Parameters
ProgramIdentifierIdentifier of the program to uninstall.
OutErrorIfAnyOutputs uninstall error (if any).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UninstallProgramByClass()

void UOperatingSystem::UninstallProgramByClass ( const TSoftClassPtr< UOperatingSystemBaseProgram > ProgramClass,
FGenericError & OutErrorIfAny )

Uninstalls the given program class from this Operating System.

Parameters
ProgramClassTarget program class to uninstall.
OutErrorIfAnyOutputs uninstall error (if any).
Here is the call graph for this function:

◆ UpdateCurrentUserDetails()

bool UOperatingSystem::UpdateCurrentUserDetails ( const FOperatingSystemUser & UpdatedDetails)

Updates the details for the current user. If you don't want specific settings to change simply leave them empty or null.

Parameters
UpdatedDetailsSettings to update. If a setting is left null or empty, that is not updated.
Returns
True if the details were updated. False otherwise.
Here is the call graph for this function:

Member Data Documentation

◆ BackgroundRunningPrograms

TMap<int32, TObjectPtr<UOperatingSystemBaseProgram> > UOperatingSystem::BackgroundRunningPrograms
protected

All running programs in background. The key is the Process ID and value is the program.

◆ bAutoLogin

uint8 UOperatingSystem::bAutoLogin
protected

Specifies whether the application should automatically login the user.

◆ bInstallStartupPrograms

uint8 UOperatingSystem::bInstallStartupPrograms
protected

Specifies whether to install startup programs on the operating system.

See also
SetToInstallStartupPrograms
ShouldInstallStartupPrograms

◆ bIsStartingForTheFirstTime

uint8 UOperatingSystem::bIsStartingForTheFirstTime
protected

True if the Operating System is starting for the first time after installation.

◆ BsodOnScreenTime

FOperatingSystemRangeTime UOperatingSystem::BsodOnScreenTime
protected

Time it takes for BSOD to stay on screen

◆ BSODWidget

TObjectPtr<UOperatingSystemBsodWidget> UOperatingSystem::BSODWidget
protected

Current BSOD widget.

◆ BsodWidgetClass

TSoftClassPtr<UOperatingSystemBsodWidget> UOperatingSystem::BsodWidgetClass
protected

Operating System Widget class.

◆ CompanyName

FText UOperatingSystem::CompanyName
protected

Company that made this operating system. Think of this as just Microsoft or Apple or Canonical etc.

◆ CurrentUser

FOperatingSystemUser UOperatingSystem::CurrentUser
protected

Active user.

◆ DefaultDirectories

TSoftObjectPtr<UOperatingSystemDirectoriesCollection> UOperatingSystem::DefaultDirectories
protected

Default directories to automatically create when installing this Operating System.

◆ DeviceName

FText UOperatingSystem::DeviceName
protected

Can be computer name also like JohnDoes-PC.

◆ DirectoryIcons

TMap<FGameplayTag, TSoftObjectPtr<UObject> > UOperatingSystem::DirectoryIcons
protected

Icons for each type of directory.

◆ Icon

TSoftObjectPtr<UObject> UOperatingSystem::Icon
protected

An icon (either texture or user interface material) for this Operating System.

◆ InstallationSpace

float UOperatingSystem::InstallationSpace
protected

Space required by this OS for installation. Remember, this is all simulated so don't worry about anything related to your PC.

◆ InstallationTime

FOperatingSystemRangeTime UOperatingSystem::InstallationTime
protected

Installation time for installing this Operating System.

◆ InstalledPrograms

TMap<FName, UOperatingSystemBaseProgram*> UOperatingSystem::InstalledPrograms
protected

All the programs that are currently installed.

◆ LastBroughtToFrontWindow

TWeakObjectPtr<UDraggableWindow> UOperatingSystem::LastBroughtToFrontWindow
protected

Transient variable representing the last draggable window brought to the front.

It is a weak pointer to an instance of UDraggableWindow class. This variable is transient, meaning that it is not serialized and doesn't persist across sessions.

See also
UDraggableWindow

◆ LoadingTime

FOperatingSystemRangeTime UOperatingSystem::LoadingTime
protected

Time it takes for the Operating System to show loading screen and then change to logon screen.

◆ LoadingTimeInitial

FOperatingSystemRangeTime UOperatingSystem::LoadingTimeInitial
protected

Time it takes for the Operating System to load for the first time after installation. Typically this will be set higher than Loading Time.

◆ LogonToDesktopTime

FOperatingSystemRangeTime UOperatingSystem::LogonToDesktopTime
protected

Time it takes to transition from Logon screen to Desktop.

◆ MustHavePrograms

TSoftObjectPtr<UOperatingSystemProgramsCollection> UOperatingSystem::MustHavePrograms
protected

These are programs that must be installed with Operating System. For example: File explorer, terminal, web browser etc.

◆ Name

FText UOperatingSystem::Name
protected

Name of this operating system. Think of this as just Windows or MacOS or Ubuntu etc.

◆ NotificationSettings

FOperatingSystemNotificationSettings UOperatingSystem::NotificationSettings
protected

Notification settings.

◆ OnProgramClosed

FOperatingSystemProgramDelegate UOperatingSystem::OnProgramClosed

Delegate for handling the program closed event.

This delegate can be assigned a blueprint callable function to handle the event when the program is closed.

Example usage:

UFUNCTION()
void HandleProgramClosed(UOperatingSystemBaseProgram* Program)
{
// Code to handle program closed event
}
void SomeFunction()
{
// Assigning the blueprint callable function to the delegate
OnProgramClosed.AddDynamic(this, &ThisClass::HandleProgramClosed);
}
Definition OperatingSystemBaseProgram.h:59
FOperatingSystemProgramDelegate OnProgramClosed
Delegate for handling the program closed event.
Definition OperatingSystem.h:334
See also
FOperatingSystemProgramDelegate
UOperatingSystemBaseProgram

◆ OnProgramInstalled

FOperatingSystemProgramDelegate UOperatingSystem::OnProgramInstalled

Delegate representing the event when a program is installed in the operating system.

This delegate is used to handle the event when a program is installed in the operating system. It can be assigned a function or method with the appropriate signature to handle the event.

Example usage:

UFUNCTION()
void HandleProgramInstalled(UOperatingSystemBaseProgram* Program)
{
// Code to handle program closed event
}
void SomeFunction()
{
// Assigning the blueprint callable function to the delegate
OnProgramInstalled.AddDynamic(this, &ThisClass::HandleProgramInstalled);
}
FOperatingSystemProgramDelegate OnProgramInstalled
Delegate representing the event when a program is installed in the operating system.
Definition OperatingSystem.h:361
See also
FOperatingSystemProgramDelegate
UOperatingSystemBaseProgram

◆ OnProgramStarted

FOperatingSystemProgramDelegate UOperatingSystem::OnProgramStarted

Delegate representing the event when a program starts in the operating system.

This delegate is used to handle the event when a program starts in the operating system. It can be bound to functions or methods that need to be executed when a program is started.

Usage example:

UFUNCTION()
void HandleProgramStarted(UOperatingSystemBaseProgram* Program)
{
// Code to handle program started event.
}
// Bind the delegate to the handler function.
OnProgramStarted.AddDynamic(this, &ThisClass::HandleProgramStarted);
FOperatingSystemProgramDelegate OnProgramStarted
Delegate representing the event when a program starts in the operating system.
Definition OperatingSystem.h:307
See also
FOperatingSystemProgramDelegate
UOperatingSystemBaseProgram

◆ OnProgramUninstalled

FOperatingSystemProgramDelegate UOperatingSystem::OnProgramUninstalled

◆ OperatingSystemSettingsData

TObjectPtr<UOperatingSystemSettingsData> UOperatingSystem::OperatingSystemSettingsData
protected

Settings data for this operating system.

◆ OperatingSystemTag

FGameplayTag UOperatingSystem::OperatingSystemTag
protected

Tag to identify this Operating System.

◆ OperatingSystemWidget

TObjectPtr<UOperatingSystemWidget> UOperatingSystem::OperatingSystemWidget
protected

Reference to the Operating System widget.

◆ ParentDevice

TWeakObjectPtr<UOperatingSystemBaseDevice> UOperatingSystem::ParentDevice
protected

The device this Operating System is running on.

◆ PostInstallStartupPrograms

TSoftObjectPtr<UOperatingSystemProgramsCollection> UOperatingSystem::PostInstallStartupPrograms
protected

List of programs that can be optionally installed after installing the Operating System.

◆ RunningPrograms

TMap<int32, TObjectPtr<UOperatingSystemBaseProgram> > UOperatingSystem::RunningPrograms
protected

All running programs in this Operating System. The key is the Process ID and value is the program.

◆ SettingsDataClass

TSoftClassPtr<UOperatingSystemSettingsData> UOperatingSystem::SettingsDataClass
protected

A data class that holds all settings (like theme, wallpapers etc) for this Operating System.

◆ SupportedDevices

FGameplayTagContainer UOperatingSystem::SupportedDevices
protected

List of devices this Operating System supports. If empty, it is assumed all devices are supported.

◆ TargetPartitionID

FOperatingSystemUniqueId UOperatingSystem::TargetPartitionID
protected

Structure representing a unique identifier for a target partition in the operating system.

This identifier is transient, meaning it is not meant to be stored or persisted. It is used for temporary identification purposes only.

◆ TaskbarButtons

TMap<int32, TWeakObjectPtr<UOperatingSystemTaskbarButton> > UOperatingSystem::TaskbarButtons
protected

Transient variable representing the taskbar buttons. It is a TMap that associates integer keys with weak object pointers to UOperatingSystemTaskbarButton objects. Key will be the process ID. Value will be the program.

◆ TimerHandle_LoadingTime

FTimerHandle UOperatingSystem::TimerHandle_LoadingTime
protected

Timer handle for loading time.

◆ TimerHandle_OperatingSystemInstallation

FTimerHandle UOperatingSystem::TimerHandle_OperatingSystemInstallation
protected

Timer handle for operating system installation.

◆ TotalErrorNotifications

int32 UOperatingSystem::TotalErrorNotifications
protected

Total error notifications received.

◆ TotalNotifications

int32 UOperatingSystem::TotalNotifications
protected

Total notifications received.

◆ TotalWarningNotifications

int32 UOperatingSystem::TotalWarningNotifications
protected

Total warning notifications received.

◆ Version

FOperatingSystemVersion UOperatingSystem::Version
protected

Current version of this Operating System.

◆ WidgetClass

TSoftClassPtr<UOperatingSystemWidget> UOperatingSystem::WidgetClass
protected

Operating System Widget class.


The documentation for this class was generated from the following files: