mirror of
https://github.com/aydencharles/onionHEN.git
synced 2026-10-22 20:02:59 -05:00
Finish ToolboxUiState migration by removing compatibility references and updating all call sites to g_ui. Expand host tests for route matrix and session flag/cheat-map helpers.
92 lines
2.7 KiB
C++
92 lines
2.7 KiB
C++
/* Copyright (C) 2025 OrionHEN / LightningMods
|
|
*
|
|
* Toolbox / settings UI runtime state. All ShellUI session state lives on g_ui.
|
|
*/
|
|
#pragma once
|
|
|
|
#include "shellui_types.hpp"
|
|
#include "toolbox_route.hpp"
|
|
|
|
#include <atomic>
|
|
#include <cstring>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
/** Settings page / resource-stream context for ShellUI hooks. */
|
|
struct ToolboxUiState {
|
|
// Manifest resource flags (GetManifestResourceStream_Hook)
|
|
bool is_plugin = false;
|
|
bool is_su_menu = false;
|
|
bool is_debug_settings = false;
|
|
bool is_cheats = false;
|
|
bool is_auto_plugin = false;
|
|
bool is_remote_play = false;
|
|
bool is_plapps = false;
|
|
|
|
// Shortcut activation from boot/capture hooks
|
|
bool cheats_shortcut_activated = false;
|
|
bool cheats_shortcut_activated_not_open = false;
|
|
|
|
// Running big-app / cheats UI
|
|
std::string running_tid;
|
|
bool is_game_open = true;
|
|
bool is_current_game_open = true;
|
|
std::string current_menu_tid;
|
|
std::string current_cheat_tid;
|
|
int cheat_enabled_map[toolbox::kCheatMapSize]{};
|
|
|
|
// Dynamic lists filled by generate_*_xml
|
|
std::vector<Plugins> plugins_list;
|
|
std::vector<Plugins> auto_list;
|
|
std::vector<Payloads_Apps> payloads_apps_list;
|
|
std::vector<GameEntry> games_list;
|
|
|
|
std::string remote_play_info;
|
|
|
|
// Overlay
|
|
bool all_cpu_usage = false;
|
|
|
|
std::atomic_bool cheat_action_in_progress{false};
|
|
std::atomic_bool download_kstuff_thread_in_progress{false};
|
|
|
|
/** Copy route flags into this session (after toolbox::resolve_resource). */
|
|
void apply_route_flags(const toolbox::RouteFlags &f) {
|
|
is_plugin = f.is_plugin;
|
|
is_su_menu = f.is_su_menu;
|
|
is_debug_settings = f.is_debug_settings;
|
|
is_cheats = f.is_cheats;
|
|
is_auto_plugin = f.is_auto_plugin;
|
|
is_remote_play = f.is_remote_play;
|
|
is_plapps = f.is_plapps;
|
|
}
|
|
|
|
void clear_cheat_shortcuts() {
|
|
cheats_shortcut_activated = false;
|
|
cheats_shortcut_activated_not_open = false;
|
|
}
|
|
|
|
bool any_cheat_shortcut() const {
|
|
return cheats_shortcut_activated || cheats_shortcut_activated_not_open;
|
|
}
|
|
|
|
/** Reset cheat toggles when switching title; returns true if map cleared. */
|
|
bool reset_cheats_if_tid_changed(std::string_view new_tid) {
|
|
return toolbox::reset_cheat_map_if_tid_changed(
|
|
current_cheat_tid, cheat_enabled_map, toolbox::kCheatMapSize, new_tid);
|
|
}
|
|
|
|
void set_cheat_enabled(int cheat_id, bool enabled) {
|
|
toolbox::set_cheat_enabled(cheat_enabled_map, toolbox::kCheatMapSize,
|
|
cheat_id, enabled);
|
|
}
|
|
|
|
bool get_cheat_enabled(int cheat_id) const {
|
|
return toolbox::get_cheat_enabled(cheat_enabled_map, toolbox::kCheatMapSize,
|
|
cheat_id);
|
|
}
|
|
};
|
|
|
|
/** Single process-wide UI state for shellui.elf. */
|
|
extern ToolboxUiState g_ui;
|