139 return id != ModalId::none;
186 return items.empty();
204 return items.begin();
222 return items.begin();
247 return items.front();
256 return items.front();
443 bool merge_discovered_host(ClientState &state, std::string displayName,
const std::string &address, uint16_t port);
451 void replace_saved_files(ClientState &state, std::vector<startup::SavedFileEntry> savedFiles);
459 std::string current_add_host_address(
const ClientState &state);
467 uint16_t current_add_host_port(
const ClientState &state);
475 std::string current_pairing_pin(
const ClientState &state);
484 void apply_connection_test_result(ClientState &state,
bool success, std::string message);
496 bool apply_pairing_result(ClientState &state,
const std::string &address, uint16_t port,
bool success, std::string message);
509 void apply_app_list_result(
511 const std::string &address,
513 std::vector<HostAppRecord> apps,
514 uint64_t appListContentHash,
527 void mark_cover_art_cached(ClientState &state,
const std::string &address, uint16_t port,
int appId);
535 void set_log_file_path(ClientState &state, std::string logFilePath);
544 void apply_log_viewer_contents(ClientState &state, std::vector<std::string> lines, std::string statusMessage);
554 bool host_requires_manual_pairing(
const ClientState &state,
const std::string &address, uint16_t port);
563 bool begin_selected_host_app_browse(ClientState &state,
bool showHiddenApps);
574 const HostRecord *selected_host(
const ClientState &state);
582 const HostAppRecord *selected_app(
const ClientState &state);
590 const HostRecord *apps_host(
const ClientState &state);
void replace_hosts(ClientState &state, std::vector< HostRecord > hosts, std::string statusMessage)
Replace the in-memory host list from a persisted snapshot.
Definition client_state.cpp:1434
const char * to_string(ScreenId screen)
Return a display label for a screen identifier.
Definition client_state.cpp:1416
ClientState create_initial_state()
Create the initial app state shown after startup.
Definition client_state.cpp:1377
ModalId
Active modal surfaced on top of the current page.
Definition client_state.h:48
@ log_viewer
Dedicated log viewer modal.
@ none
No modal is currently visible.
@ confirmation
Destructive-action confirmation dialog.
@ support
Support and help modal.
@ app_actions
App action menu for the selected app.
@ host_details
Host detail sheet for the selected host.
@ app_details
App detail sheet for the selected app.
@ host_actions
Host action menu for the selected host.
LogViewerPlacement
Layout options for the embedded log viewer.
Definition client_state.h:62
@ right
Dock the log viewer on the right side of the split layout.
@ left
Dock the log viewer on the left side of the split layout.
@ full
Use the full modal width for the log viewer.
SettingsFocusArea
Focus areas used by the two-pane settings screen.
Definition client_state.h:71
@ options
Focus is on the options list for the selected category.
@ categories
Focus is on the settings category list.
AddHostField
Active field for keypad-based host entry.
Definition client_state.h:98
@ address
The host IPv4 address field.
@ port
The optional host port override field.
ConfirmationAction
Destructive confirmation requests surfaced in a modal popup.
Definition client_state.h:89
@ factory_reset
Remove all persisted Moonlight state.
HostsFocusArea
Focus areas on the hosts page.
Definition client_state.h:40
@ toolbar
Focus is on the hosts toolbar buttons.
@ grid
Focus is on the saved-host tile grid.
SettingsCategory
Top-level categories shown on the left side of the settings screen.
Definition client_state.h:79
@ reset
Reset and cleanup actions.
@ input
Input and controller options.
@ logging
Logging and diagnostics options.
@ display
Display and video presentation options.
ScreenId
Top-level screens used by the Moonlight client shell.
Definition client_state.h:28
@ home
Placeholder home screen identifier retained for shared shell logic.
@ settings
Shell settings screen.
@ hosts
Saved-host browser and primary landing screen.
@ apps
Per-host application library screen.
@ add_host
Manual host entry workflow.
Declares host record models and utilities.
Declares logging configuration and output.
LogLevel
Severity levels used by the Moonlight client logger.
Definition logger.h:22
Declares the host pairing flow.
Declares saved file loading and cleanup helpers.
Controller-friendly draft state for manual host entry.
Definition client_state.h:115
bool lastConnectionSucceeded
True when the latest connection test succeeded.
Definition client_state.h:123
AddHostField activeField
Field currently targeted by directional input.
Definition client_state.h:118
std::string addressInput
Raw host address text entered by the user.
Definition client_state.h:116
std::string connectionMessage
Result message from the latest host connection test.
Definition client_state.h:122
std::string portInput
Raw port override text entered by the user.
Definition client_state.h:117
std::string validationMessage
Validation feedback for the current address or port text.
Definition client_state.h:121
AddHostKeypadState keypad
Nested keypad-modal selection state.
Definition client_state.h:119
ScreenId returnScreen
Screen to return to when add-host flow completes or cancels.
Definition client_state.h:120
Controller selection state for the add-host keypad modal.
Definition client_state.h:106
std::size_t selectedButtonIndex
Zero-based selection inside the keypad button grid.
Definition client_state.h:108
bool visible
True when the keypad modal is currently shown.
Definition client_state.h:107
std::string stagedInput
Draft text currently assembled inside the keypad modal.
Definition client_state.h:109
Navigation and modal effects emitted by one command update.
Definition client_state.h:351
bool modalOpened
True when a modal became active during the update.
Definition client_state.h:356
bool screenChanged
True when the active screen changed.
Definition client_state.h:352
bool modalClosed
True when the active modal was dismissed during the update.
Definition client_state.h:357
std::string activatedItemId
Stable identifier for the activated menu item, when any.
Definition client_state.h:358
bool overlayVisibilityChanged
True when overlay visibility toggled.
Definition client_state.h:354
bool overlayChanged
True when overlay content changed.
Definition client_state.h:353
bool exitRequested
True when the shell requested application exit.
Definition client_state.h:355
Persistence and cleanup side effects emitted by one command update.
Definition client_state.h:382
bool hostsChanged
True when the host list changed and should be persisted.
Definition client_state.h:383
uint16_t deletedHostPort
Port of the host removed from storage.
Definition client_state.h:391
bool hostDeleteCleanupRequested
True when host deletion follow-up cleanup should run.
Definition client_state.h:388
std::string deletedHostAddress
Address of the host removed from storage.
Definition client_state.h:390
bool deletedHostWasPaired
True when the deleted host previously had pairing credentials.
Definition client_state.h:389
bool settingsChanged
True when persisted TOML-backed settings changed.
Definition client_state.h:384
bool factoryResetRequested
True when a full saved-data reset should run.
Definition client_state.h:387
bool savedFileDeleteRequested
True when one managed file should be deleted.
Definition client_state.h:385
std::string savedFileDeletePath
Managed file path requested for deletion.
Definition client_state.h:386
std::vector< std::string > deletedHostCoverArtCacheKeys
Cover-art cache keys to remove for the deleted host.
Definition client_state.h:392
Network and browsing requests emitted by one command update.
Definition client_state.h:364
bool streamLaunchRequested
True when the selected host app should start or resume streaming.
Definition client_state.h:375
uint16_t pairingPort
Host port targeted by pairing.
Definition client_state.h:371
std::string connectionTestAddress
Host address that should be tested.
Definition client_state.h:366
bool logViewRequested
True when the log viewer should be refreshed from disk.
Definition client_state.h:376
uint16_t connectionTestPort
Host port that should be tested.
Definition client_state.h:367
std::string pairingPin
Generated client PIN that should be shown to the user.
Definition client_state.h:372
bool appsBrowseRequested
True when app browsing for the selected host should begin.
Definition client_state.h:373
std::string pairingAddress
Host address targeted by pairing.
Definition client_state.h:370
bool pairingCancelledRequested
True when an in-progress pairing request should be cancelled.
Definition client_state.h:369
bool connectionTestRequested
True when a manual host connection test should run.
Definition client_state.h:365
bool appsBrowseShowHidden
Hidden-app visibility requested for the app browse action.
Definition client_state.h:374
bool pairingRequested
True when manual pairing should begin.
Definition client_state.h:368
Result of updating the client shell with a UI command.
Definition client_state.h:398
AppRequestUpdate requests
Network and browsing requests emitted by the command.
Definition client_state.h:400
AppNavigationUpdate navigation
Navigation and modal changes emitted by the command.
Definition client_state.h:399
AppPersistenceUpdate persistence
Persistence and cleanup work emitted by the command.
Definition client_state.h:401
State owned by the per-host apps browser.
Definition client_state.h:301
std::size_t selectedAppIndex
Zero-based selection inside the visible app list.
Definition client_state.h:302
std::size_t scrollPage
Horizontal page offset for paged app browsing.
Definition client_state.h:303
bool showHiddenApps
True when hidden apps should remain visible in the apps screen.
Definition client_state.h:304
Serializable app state for the menu-driven client shell.
Definition client_state.h:335
ui::MenuModel detailMenu
Secondary detail or actions menu.
Definition client_state.h:340
HostsState hosts
Saved-host browsing state and retained host snapshot.
Definition client_state.h:337
AddHostDraft addHostDraft
Draft state for the add-host workflow.
Definition client_state.h:341
ConfirmationDialogState confirmation
Confirmation dialog content for destructive actions.
Definition client_state.h:345
ModalState modal
Context modal currently stacked over the shell.
Definition client_state.h:343
ShellState shell
Shell-wide status and overlay state.
Definition client_state.h:336
ui::MenuModel menu
Primary vertical menu model for the active screen.
Definition client_state.h:339
AppsState apps
Apps-screen selection and paging state.
Definition client_state.h:338
PairingDraft pairingDraft
Draft state for the active pairing workflow.
Definition client_state.h:342
SettingsState settings
Settings, log viewer, and saved-file workflow state.
Definition client_state.h:344
Content shown by the destructive-action confirmation dialog.
Definition client_state.h:146
ConfirmationAction action
Requested confirmation action.
Definition client_state.h:147
std::string targetPath
File or directory path targeted by the action, when applicable.
Definition client_state.h:148
std::vector< std::string > lines
Body lines describing the consequence of the action.
Definition client_state.h:150
std::string title
Modal title presented to the user.
Definition client_state.h:149
Manual host record shown in the shell.
Definition host_records.h:61
State owned by the saved-host browser and retained host snapshot.
Definition client_state.h:167
auto end() const
Return a const iterator one past the last saved host.
Definition client_state.h:230
bool activeLoaded
True when active contains a valid host snapshot.
Definition client_state.h:175
std::size_t selectedHostIndex
Zero-based selection inside the saved host list.
Definition client_state.h:172
std::string selectedAddress
Last selected host address used to restore hosts-page selection after reload.
Definition client_state.h:176
const HostRecord & back() const
Return the last saved host.
Definition client_state.h:273
uint16_t selectedPort
Last selected host port override used to restore hosts-page selection after reload.
Definition client_state.h:177
HostRecord & front()
Return the first saved host.
Definition client_state.h:246
HostRecord & operator[](std::size_t index)
Return the saved host at the requested index.
Definition client_state.h:283
std::vector< HostRecord > items
Saved hosts currently tracked by the shell.
Definition client_state.h:173
HostRecord & back()
Return the last saved host.
Definition client_state.h:264
HostsFocusArea focusArea
Focused region on the hosts page.
Definition client_state.h:170
bool loaded
True when the hosts page list is currently loaded in memory.
Definition client_state.h:169
std::vector< std::string > pairingResetEndpoints
Endpoints whose pairing material should be cleared during reset.
Definition client_state.h:178
HostRecord active
Host snapshot kept for host-specific non-host screens after unloading the hosts page.
Definition client_state.h:174
auto begin()
Return an iterator to the first saved host.
Definition client_state.h:203
const HostRecord & operator[](std::size_t index) const
Return the saved host at the requested index.
Definition client_state.h:293
auto end()
Return an iterator one past the last saved host.
Definition client_state.h:212
std::size_t size() const
Return the number of saved hosts currently tracked by the shell.
Definition client_state.h:194
std::size_t selectedToolbarButtonIndex
Zero-based selection inside the hosts toolbar.
Definition client_state.h:171
bool empty() const
Return whether the saved-host collection is empty.
Definition client_state.h:185
void clear()
Remove every saved host from the collection.
Definition client_state.h:237
bool dirty
True when the host list changed and should be saved.
Definition client_state.h:168
const HostRecord & front() const
Return the first saved host.
Definition client_state.h:255
auto begin() const
Return a const iterator to the first saved host.
Definition client_state.h:221
Context modal state shared by the hosts and apps pages.
Definition client_state.h:129
std::size_t selectedActionIndex
Zero-based index of the highlighted modal action.
Definition client_state.h:131
bool active() const
Return whether a modal is currently active.
Definition client_state.h:138
Controller-friendly state for a client-generated pairing PIN.
Definition pairing_flow.h:28
State owned by the settings, log viewer, and saved-file workflows.
Definition client_state.h:310
VIDEO_MODE preferredVideoMode
Preferred stream resolution requested from the host.
Definition client_state.h:320
LogViewerPlacement logViewerPlacement
Log viewer pane placement relative to the shell.
Definition client_state.h:316
bool showPerformanceStats
True when stream telemetry should be shown after streaming ends.
Definition client_state.h:325
std::vector< startup::SavedFileEntry > savedFiles
Saved-file catalog shown on the reset settings page.
Definition client_state.h:328
logging::LogLevel xemuConsoleLoggingLevel
Minimum runtime log level mirrored through DbgPrint() to xemu's serial console.
Definition client_state.h:318
logging::LogLevel loggingLevel
Minimum runtime log level written to the persisted log file.
Definition client_state.h:317
std::size_t logViewerScrollOffset
Zero-based vertical scroll offset inside the log viewer.
Definition client_state.h:315
bool dirty
True when persisted TOML-backed settings changed and should be saved.
Definition client_state.h:327
std::vector< VIDEO_MODE > availableVideoModes
Detected Xbox video modes exposed as stream-resolution choices.
Definition client_state.h:319
bool savedFilesDirty
True when the saved-file catalog should be refreshed.
Definition client_state.h:329
int streamFramerate
Preferred stream frame rate in frames per second.
Definition client_state.h:322
std::vector< std::string > logViewerLines
Loaded log file lines shown in the log viewer.
Definition client_state.h:314
std::string logFilePath
Path currently loaded into the log viewer.
Definition client_state.h:313
SettingsFocusArea focusArea
Focused pane within the settings screen.
Definition client_state.h:311
bool playAudioOnPc
True when the host PC should continue local audio playback during streaming.
Definition client_state.h:324
int streamBitrateKbps
Preferred stream bitrate in kilobits per second.
Definition client_state.h:323
bool playAudioOnXbox
True when the Xbox should decode and play streamed audio locally.
Definition client_state.h:326
bool preferredVideoModeSet
True when preferredVideoMode contains a user-selected or default mode.
Definition client_state.h:321
SettingsCategory selectedCategory
Settings category selected in the left pane.
Definition client_state.h:312
Shell-wide state that is not owned by a specific workflow screen.
Definition client_state.h:156
std::size_t overlayScrollOffset
Scroll offset used by long overlay content.
Definition client_state.h:160
std::string statusMessage
Primary user-visible status line.
Definition client_state.h:161
ScreenId activeScreen
Screen currently shown by the shell.
Definition client_state.h:157
bool shouldExit
True when the application should terminate.
Definition client_state.h:159
bool overlayVisible
True when the diagnostics overlay is visible.
Definition client_state.h:158