C++ Reference
Guide for extending the plugin in C++. Full class listings with members live in the API Reference tab.
Module dependency graph
Section titled “Module dependency graph”flowchart TB
subgraph row1[" "]
direction LR
Game["Your game module"] --> OSS["OperatingSystemSimulator"] --> GM["GlobalMessenger"] --> VW["ViewportWorlds"]
end
subgraph row2[" "]
direction LR
GC["GlobalCore"] --- DW["DraggableWindowUMG"]
end
OSS --> GC
OSS --> DW
VW --> OSS
Plugin modules
Section titled “Plugin modules”| Module | Responsibility |
|---|---|
| OperatingSystemSimulator | Core OS, programs, filesystem, hardware |
| GlobalCore | Shared foundations (required — build project after enabling plugin) |
| GlobalMessenger | UGlobalMessageSubsystem |
| ViewportWorlds | Secondary worlds in OS viewports |
| DraggableWindowUMG | Program window dragging/resizing |
Build.cs dependencies
Section titled “Build.cs dependencies”Minimal game module extending OS features:
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine" });
PrivateDependencyModuleNames.AddRange(new string[]{ "OperatingSystemSimulator", "GlobalMessenger", "GameplayTags", "UMG", "Slate", "SlateCore", "DraggableWindowUMG"});Add ViewportWorlds only when using Viewport World.
Common includes
Section titled “Common includes”| Header | Types |
|---|---|
Core/OperatingSystem.h | UOperatingSystem |
Devices/OperatingSystemBaseDevice.h | UOperatingSystemBaseDevice |
Programs/OperatingSystemBaseProgram.h | UOperatingSystemBaseProgram |
Programs/Terminal/OperatingSystemTerminalCommand.h | UOperatingSystemTerminalCommand |
Files/OperatingSystemFile.h | UOperatingSystemFile |
Global/OperatingSystemStatics.h | UOperatingSystemStatics |
Devices/OperatingSystemDeviceMessenger.h | Device messenger |
GlobalMessageSubsystem.h | Global messenger (GlobalMessenger module) |
Extension points
Section titled “Extension points”| Type | Subclass | Override / implement |
|---|---|---|
| Program | UOperatingSystemBaseProgram | OnValidate, OnProgramStarted, OnProgramClosed |
| Terminal command | UOperatingSystemTerminalCommand | OnProcessCommand, OnProcessCommandAsRoot, OnContinueExecution |
| File | UOperatingSystemFile | OnOpen, validation |
| Program widget | UOperatingSystemProgramWidget | NativeConstruct, UI logic |
| OS widget | UOperatingSystemWidget | Notification / login implementable events |
| Setting module | UOperatingSystemSettingModule | Custom settings panels |
Do not subclass UOperatingSystem directly — use UOperatingSystemUnix or UOperatingSystemNonUnix.
Error handling
Section titled “Error handling”Plugin code uses FGenericError and the MAKE_ERROR macro:
OutError = MAKE_ERROR("ERROR_CODE", TEXT("Human-readable message."));Use in OnValidate, terminal ProcessCommand, and filesystem helpers.
Subsystems
Section titled “Subsystems”| Subsystem | Access |
|---|---|
| UOperatingSystemGameSubsystem | UGameInstance scope |
| UOperatingSystemWorldSubsystem | Per-world device registry, user manager |
| UGlobalMessageSubsystem | UGlobalMessageSubsystem::Get(*World) |
Device state machine
Section titled “Device state machine”EOperatingSystemDeviceState on UOperatingSystemBaseDevice:
stateDiagram-v2 [*] --> None None --> Starting Starting --> BIOS BIOS --> Running Running --> Restarting Running --> ShuttingDown Running --> BSOD Restarting --> Starting ShuttingDown --> None BSOD --> ShuttingDown
Hook device events on AOperatingSystemDeviceActor in your game code when you need cinematic boot sequences or input lock during BIOS.
Tutorials with C++ samples
Section titled “Tutorials with C++ samples”| Topic | Tutorial |
|---|---|
| All extension types (add / extend) | C++ Extension Examples |
| All patterns (cookbook) | Examples & Patterns |
| Native program | C++ program from scratch |
| Terminal command | Custom terminal command |
| Global Messenger | Using Global Messenger |
| Device Messenger | Using Device Messenger |
| Program validation | New Program |
Source location
Section titled “Source location”Plugin source (private repo): OperatingSystemSimulator/Source/. Regenerate API docs with the monorepo build-api-docs.mjs script when headers change.