From 4941593fb9a04a732488e5da7cf9e5f46cff4e56 Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:48:39 -0500 Subject: [PATCH 01/14] Fixed terminal output stopping after a restart A restart from the guide or Ctrl+R swaps in a new copy of the app but keeps the old log pipe, and nothing was reading it anymore, so the terminal went quiet. Now the new copy puts the real terminal back first and keeps writing to the same theseus.log, with a Restarted line in between. Windows is unchanged. --- theseus/desktop/host_posix_app.cpp | 50 +++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 5 deletions(-) diff --git a/theseus/desktop/host_posix_app.cpp b/theseus/desktop/host_posix_app.cpp index 2460f74..87c63af 100644 --- a/theseus/desktop/host_posix_app.cpp +++ b/theseus/desktop/host_posix_app.cpp @@ -69,7 +69,33 @@ static void StopTee() { s_teeRunning = false; } +// An exec restart keeps our fds but not the tee thread, so the new process +// would write into a pipe nobody reads. This names the real terminal and the +// old pipe's read end so it can put stdout/stderr back first. +#define TEE_ENV "THESEUS_TEE_FDS" + +static bool FdOpen(int fd) { return fd > STDERR_FILENO && fcntl(fd, F_GETFD) != -1; } + +static bool UndoInheritedTee() { + const char* env = getenv(TEE_ENV); + if (!env) return false; + int term = -1, oldRead = -1; + struct stat st; + bool ok = sscanf(env, "%d,%d", &term, &oldRead) == 2 && FdOpen(term) && FdOpen(oldRead) && + fstat(oldRead, &st) == 0 && S_ISFIFO(st.st_mode); + if (ok) { + dup2(term, STDOUT_FILENO); + dup2(term, STDERR_FILENO); + close(term); + close(oldRead); + } + unsetenv(TEE_ENV); + return ok; +} + void Host_ConsoleOrLog(const char* logPath) { + bool restarted = UndoInheritedTee(); + // First launch: the user data folder doesn't exist yet. std::string dir = logPath; dir = dir.substr(0, dir.rfind('/')); @@ -77,12 +103,17 @@ void Host_ConsoleOrLog(const char* logPath) { if (i == dir.size() || dir[i] == '/') mkdir(dir.substr(0, i).c_str(), 0755); - std::string prev = logPath; - size_t dot = prev.rfind(".log"); - prev = (dot == std::string::npos) ? prev + ".prev" : prev.substr(0, dot) + ".prev.log"; - rename(logPath, prev.c_str()); + // A restart carries on in the same log unless it's grown big. + struct stat st; + bool append = restarted && stat(logPath, &st) == 0 && st.st_size < 4 * 1024 * 1024; + if (!append) { + std::string prev = logPath; + size_t dot = prev.rfind(".log"); + prev = (dot == std::string::npos) ? prev + ".prev" : prev.substr(0, dot) + ".prev.log"; + rename(logPath, prev.c_str()); + } - s_logFd = open(logPath, O_WRONLY | O_CREAT | O_TRUNC, 0644); + s_logFd = open(logPath, O_WRONLY | O_CREAT | O_CLOEXEC | (append ? O_APPEND : O_TRUNC), 0644); if (s_logFd < 0) return; snprintf(s_logPath, sizeof(s_logPath), "%s", logPath); int p[2]; @@ -94,6 +125,15 @@ void Host_ConsoleOrLog(const char* logPath) { dup2(p[1], STDOUT_FILENO); dup2(p[1], STDERR_FILENO); close(p[1]); + // The read end stays open across exec so the new process's first writes + // land in the pipe instead of raising SIGPIPE. + char fds[32]; + snprintf(fds, sizeof(fds), "%d,%d", s_termFd, p[0]); + setenv(TEE_ENV, fds, 1); + if (append) { + static const char kMark[] = "[Host] Restarted\n"; + (void)!write(s_logFd, kMark, sizeof(kMark) - 1); + } setvbuf(stdout, NULL, _IOLBF, 0); setvbuf(stderr, NULL, _IONBF, 0); From 00b59ff1d082a0bd66340e8cb74cf6e62f72eb43 Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:48:48 -0500 Subject: [PATCH 02/14] Settings window shows every setting again It was hand-built, so newer settings like Console Mode, Start at Login and the whole Games and Controller pages never showed up. Now each tab draws whatever the settings table has that it doesn't already draw itself, so it can't fall behind again. Also fixed the qcow2 path never saving, the clipped Display Mode label and user folder, and the shortcuts list pointing at things that are gone. --- theseus/desktop/menu_bar.cpp | 213 +++++++++++++++++++++++++++-------- 1 file changed, 166 insertions(+), 47 deletions(-) diff --git a/theseus/desktop/menu_bar.cpp b/theseus/desktop/menu_bar.cpp index 9c5d3f7..bc304e9 100644 --- a/theseus/desktop/menu_bar.cpp +++ b/theseus/desktop/menu_bar.cpp @@ -23,6 +23,7 @@ static const char* ShippedVersionPath() { #include "jellyfin_client.h" #include "xcloud_client.h" #include "launchers/xemu.h" +#include "launchers/pcsx2.h" #include "media_player.h" #include "milkdrop_window.h" #include "xbox_buttons.h" @@ -35,6 +36,7 @@ extern float g_masterVolume; #include #include #include +#include extern "C" void MediaDB_ScanAndCache(); extern "C" void MediaDB_RefreshMovies(); @@ -117,9 +119,20 @@ static void SettingChanged(const SettingDef* d) SaveDesktopSettings(); } -static bool SettingCheckbox(const char* key, const char* label = NULL) +// Rows a tab drew by hand this frame. Whatever's left on its page is drawn +// straight from the table, so new settings show up here on their own. +static std::vector s_drawn; + +static const SettingDef* FindRow(const char* key) { const SettingDef* d = DesktopSettings_Find(key); + if (d) s_drawn[d - DesktopSettings_Table().defs] = 1; + return d; +} + +static bool SettingCheckbox(const char* key, const char* label = NULL) +{ + const SettingDef* d = FindRow(key); if (!d || d->kind != SK_BOOL) return false; if (!ImGui::Checkbox(label ? label : d->label, (bool*)d->ptr)) return false; SettingChanged(d); @@ -128,7 +141,7 @@ static bool SettingCheckbox(const char* key, const char* label = NULL) static bool SettingCombo(const char* key, const char* id) { - const SettingDef* d = DesktopSettings_Find(key); + const SettingDef* d = FindRow(key); if (!d || d->kind != SK_ENUM) return false; int idx = Setting_EnumIndex(*d); if (idx < 0) idx = 0; @@ -141,12 +154,101 @@ static bool SettingCombo(const char* key, const char* id) // Saves once when the drag ends, not every frame. static void SettingSlider(const char* key) { - const SettingDef* d = DesktopSettings_Find(key); + const SettingDef* d = FindRow(key); if (!d || d->kind != SK_FLOAT) return; ImGui::SliderFloat(d->label, (float*)d->ptr, d->minV, d->maxV, "%.2f"); if (ImGui::IsItemDeactivatedAfterEdit()) SettingChanged(d); } +static const struct { const char* key; bool (*find)(char*, size_t); } kFinders[] = { + { "XemuPath", Xemu_Find }, + { "Pcsx2Path", Pcsx2_Find }, +}; + +// One row of any kind, laid out like the hand-built ones. +static void SettingRow(const SettingDef& d, float labelW) +{ + const float kWidgetW = 160.0f; + ImGui::PushID(d.key); + switch (d.kind) { + case SK_BOOL: + SettingCheckbox(d.key); + break; + case SK_ENUM: + ImGui::AlignTextToFramePadding(); ImGui::Text("%s:", d.label); + ImGui::SameLine(labelW); ImGui::SetNextItemWidth(kWidgetW); + SettingCombo(d.key, "##v"); + break; + case SK_INT: + ImGui::AlignTextToFramePadding(); ImGui::Text("%s:", d.label); + ImGui::SameLine(labelW); ImGui::SetNextItemWidth(kWidgetW); + ImGui::InputInt("##v", (int*)d.ptr, d.step > 0 ? (int)d.step : 1); + if (ImGui::IsItemDeactivatedAfterEdit()) SettingChanged(&d); + break; + case SK_FLOAT: + SettingSlider(d.key); + break; + case SK_PATH: + case SK_STRING: { + bool (*find)(char*, size_t) = NULL; + for (size_t i = 0; i < sizeof(kFinders) / sizeof(kFinders[0]); i++) + if (!strcmp(kFinders[i].key, d.key)) find = kFinders[i].find; + ImGui::Text("%s:", d.label); + ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - (find ? 50.0f : 0.0f)); + ImGui::InputText("##v", (char*)d.ptr, (size_t)d.size, + (d.flags & SF_SECRET) ? ImGuiInputTextFlags_Password : 0); + if (ImGui::IsItemDeactivatedAfterEdit()) SettingChanged(&d); + if (find) { + ImGui::SameLine(); + char found[512]; + if (ImGui::Button("Find") && find(found, sizeof(found)) && Setting_SetText(d, found)) + SettingChanged(&d); + } + break; + } + } + if (d.flags & SF_RESTART) { + ImGui::SameLine(); + ImGui::TextDisabled("(next launch)"); + } + ImGui::PopID(); +} + +static bool RowLeft(const SettingDef& d, const char* page) +{ + return !(d.flags & SF_HIDDEN) && !strcmp(d.page, page) && + !s_drawn[&d - DesktopSettings_Table().defs]; +} + +// Draws the rows of a settings page that the tab didn't draw itself. +static void SettingRowsLeft(const char* page, bool separate = false) +{ + const SettingsTable& t = DesktopSettings_Table(); + float labelW = 110.0f; + bool any = false; + for (int i = 0; i < t.count; i++) { + if (!RowLeft(t.defs[i], page)) continue; + any = true; + if (t.defs[i].kind == SK_ENUM || t.defs[i].kind == SK_INT) { + char lbl[160]; + snprintf(lbl, sizeof(lbl), "%s:", t.defs[i].label); + float w = ImGui::CalcTextSize(lbl).x + ImGui::GetStyle().ItemSpacing.x * 2; + if (w > labelW) labelW = w; + } + } + if (!any) return; + if (separate) { + ImGui::Spacing(); + ImGui::Separator(); + ImGui::Spacing(); + } + for (int i = 0; i < t.count; i++) { + if (!RowLeft(t.defs[i], page)) continue; + if (t.defs[i].kind == SK_PATH || t.defs[i].kind == SK_STRING) ImGui::Spacing(); + SettingRow(t.defs[i], labelW); + } +} + // ============================================================================ // Menu Bar // ============================================================================ @@ -569,6 +671,7 @@ void RenderSettingsWindow() { ImGui::End(); return; } + s_drawn.assign(DesktopSettings_Table().count, 0); if (ImGui::BeginTabBar("SettingsTabs")) { @@ -576,46 +679,33 @@ void RenderSettingsWindow() { if (ImGui::BeginTabItem("General")) { ImGui::Spacing(); - // Startup mode - ImGui::Text("Startup Mode:"); + ImGui::AlignTextToFramePadding(); + ImGui::Text("When UIX Desktop Starts:"); ImGui::SameLine(); + ImGui::SetNextItemWidth(160.0f); SettingCombo("StartupMode", "##startupmode"); ImGui::Spacing(); ImGui::Separator(); ImGui::Spacing(); - // Paths - ImGui::Text("xemu Path:"); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - 120); - ImGui::InputText("##xemupath", s_xemuPath, sizeof(s_xemuPath)); + SettingCheckbox("MenuBarAutoHide", "Auto-hide menu bar"); ImGui::SameLine(); - if (ImGui::Button("Save##xemu")) - SaveDesktopSettings(); - ImGui::SameLine(); - if (ImGui::Button("Find##xemu")) { - char found[512]; - if (Xemu_Find(found, sizeof(found))) { - snprintf(s_xemuPath, sizeof(s_xemuPath), "%s", found); - SaveDesktopSettings(); - } - } - - ImGui::Spacing(); - ImGui::Text("qcow2 HDD Image:"); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); - ImGui::InputText("##qcowpath", g_qcowPath, sizeof(g_qcowPath)); + ImGui::TextDisabled("(Development Mode only)"); ImGui::Spacing(); + ImGui::Text("User Directory:"); { - SettingCheckbox("MenuBarAutoHide", "Auto-hide menu bar"); - ImGui::SameLine(); - ImGui::TextDisabled("(reveals when the pointer reaches the top edge)"); + // Home as ~ so the path fits; wrapped in case it still doesn't. + const char* dir = Plat_UserDataDir(); + const char* home = getenv("HOME"); + if (!home || !*home) home = getenv("USERPROFILE"); + size_t n = home ? strlen(home) : 0; + bool tilde = n > 1 && strncmp(dir, home, n) == 0; + ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled)); + ImGui::TextWrapped("%s%s", tilde ? "~" : "", tilde ? dir + n : dir); + ImGui::PopStyleColor(); } - - ImGui::Spacing(); - ImGui::Text("User Directory:"); - ImGui::TextDisabled("%s", Plat_UserDataDir()); if (ImGui::Button("Open User Directory")) Plat_OpenInFileManager(Plat_UserDataDir()); ImGui::SameLine(); @@ -637,6 +727,8 @@ void RenderSettingsWindow() { if (ImGui::IsItemHovered()) ImGui::SetTooltip("Plays the original Xbox boot animation once on app startup\nbefore the dashboard initializes. Press Esc/Enter/Space to skip."); + SettingRowsLeft("General", true); + ImGui::Spacing(); if (ImGui::Button("Save All Settings")) SaveDesktopSettings(); @@ -649,13 +741,16 @@ void RenderSettingsWindow() { ImGui::Spacing(); SettingCheckbox("CRT_Enabled"); - if (g_crt.enabled) { + static const char* kCrtKeys[] = { + "CRT_Scanlines", "CRT_Curvature", "CRT_Phosphor", "CRT_Vignette", + "CRT_Bloom", "CRT_Flicker", "CRT_ColorBleed", "CRT_Brightness", + }; + const int kCrtCount = (int)(sizeof(kCrtKeys) / sizeof(kCrtKeys[0])); + if (!g_crt.enabled) { + for (int i = 0; i < kCrtCount; i++) FindRow(kCrtKeys[i]); + } else { ImGui::Spacing(); - static const char* kCrtKeys[] = { - "CRT_Scanlines", "CRT_Curvature", "CRT_Phosphor", "CRT_Vignette", - "CRT_Bloom", "CRT_Flicker", "CRT_ColorBleed", "CRT_Brightness", - }; - for (int i = 0; i < (int)(sizeof(kCrtKeys) / sizeof(kCrtKeys[0])); i++) + for (int i = 0; i < kCrtCount; i++) SettingSlider(kCrtKeys[i]); ImGui::Spacing(); @@ -683,7 +778,7 @@ void RenderSettingsWindow() { ImGui::Spacing(); // Dropdowns: fixed label column + widget column so they line up. - const float kLabelX = 90.0f; + const float kLabelX = 110.0f; const float kWidgetW = 160.0f; ImGui::AlignTextToFramePadding(); ImGui::Text("MSAA:"); @@ -700,7 +795,9 @@ void RenderSettingsWindow() { SettingCheckbox("EmulateXboxRes"); ImGui::SameLine(); - ImGui::TextDisabled("(720x480 design space, keeps XIP scenes framed as authored)"); + ImGui::TextDisabled("(?)"); + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("Lays scenes out in the Xbox's 720x480 space,\nso they stay framed the way they were made."); ImGui::Spacing(); ImGui::AlignTextToFramePadding(); ImGui::Text("Resolution:"); @@ -724,6 +821,8 @@ void RenderSettingsWindow() { ImGui::SameLine(kLabelX); ImGui::SetNextItemWidth(kWidgetW); SettingCombo("DisplayMode", "##dispmode"); + SettingRowsLeft("Display"); + ImGui::Spacing(); if (ImGui::Button("Restore Defaults")) { RestoreDisplayDefaults(); @@ -758,6 +857,7 @@ void RenderSettingsWindow() { MediaPlayer_SetMasterVolume(v); } if (ImGui::IsItemDeactivatedAfterEdit()) SaveDesktopSettings(); + FindRow("MasterVolume"); ImGui::SameLine(); ImGui::TextDisabled("(?)"); @@ -794,6 +894,7 @@ void RenderSettingsWindow() { if (ImGui::Button("Configure projectM...")) { g_projectMConfigOpen = true; } + SettingRowsLeft("Audio", true); ImGui::EndTabItem(); } @@ -802,6 +903,11 @@ void RenderSettingsWindow() { if (ImGui::BeginTabItem("Media")) { ImGui::Spacing(); + static const char* kLibraryKeys[] = { "MusicRoot", "MoviesRoot", "TvRoot", "TMDBKey" }; + for (size_t i = 0; i < sizeof(kLibraryKeys) / sizeof(kLibraryKeys[0]); i++) + FindRow(kLibraryKeys[i]); + SettingRowsLeft("Media"); + if (ImGui::CollapsingHeader("Local Library", ImGuiTreeNodeFlags_DefaultOpen)) { ImGui::Spacing(); ImGui::TextWrapped("Configure where the dashboard scans for media. Empty values fall back to the bundled defaults shown in placeholder text."); @@ -889,7 +995,7 @@ void RenderSettingsWindow() { if (g_tmdbKey[0]) ImGui::TextDisabled("(configured)"); else - ImGui::TextDisabled("(empty - plots/posters disabled)"); + ImGui::TextDisabled("(not set, so no plots or posters)"); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x); ImGui::InputTextWithHint("##tmdbkey", "Get a free v3 key at themoviedb.org", g_tmdbKey, sizeof(g_tmdbKey), ImGuiInputTextFlags_Password); @@ -1179,6 +1285,18 @@ void RenderSettingsWindow() { ImGui::EndTabItem(); } + if (ImGui::BeginTabItem("Games")) { + ImGui::Spacing(); + SettingRowsLeft("Games"); + ImGui::EndTabItem(); + } + + if (ImGui::BeginTabItem("Controller")) { + ImGui::Spacing(); + SettingRowsLeft("Controller"); + ImGui::EndTabItem(); + } + ImGui::EndTabBar(); } @@ -1275,26 +1393,27 @@ void RenderShortcutsWindow() { ImGui::SetNextWindowSize(ImVec2(360, 360), ImGuiCond_FirstUseEver); if (ImGui::Begin("Keyboard Shortcuts", &s_shortcutsOpen)) { + ImGui::Text("F7 Guide (or Guide button, LT+B)"); + ImGui::Separator(); ImGui::Text("F3 Title Maker"); ImGui::Text("F4 Settings"); ImGui::Text("F5 HDD Browser"); ImGui::Text("F6 Playlist Maker"); - ImGui::Text("F10 Hide Menu Bar"); ImGui::Text("F11 Toggle Fullscreen"); ImGui::Text("F12 Toggle Borderless Window"); + ImGui::Separator(); + ImGui::Text("Ctrl+M Toggle Mute"); + ImGui::Text("Ctrl+R Restart Dashboard"); + ImGui::Text("Ctrl+Q Quit"); if (g_startupMode == 2 || g_extractedMode) { ImGui::Separator(); ImGui::TextColored(ImVec4(0.5f, 0.5f, 0.5f, 0.7f), "Development Mode:"); ImGui::Text("F1 Inspector"); ImGui::Text("F2 XAP Editor"); + ImGui::Text("F10 Hide Menu Bar"); + ImGui::Text("Escape Deselect (Inspector)"); } ImGui::Separator(); - ImGui::Text("Ctrl+O Open Media..."); - ImGui::Text("LT+B Overlay / Menu Bar (gamepad)"); ImGui::Text("Ctrl+M Toggle Mute"); - ImGui::Text("Ctrl+R Restart Dashboard"); - ImGui::Text("Ctrl+Q Quit"); - ImGui::Text("Escape Deselect (Inspector)"); - ImGui::Separator(); ImGui::Text("Gamepad / Arrow Keys navigate the dashboard."); } ImGui::End(); From 47a88537605bcdc55b39237ef6b774120f1aa803 Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:48:48 -0500 Subject: [PATCH 03/14] Lined up the Title Maker labels Labels sat above their text boxes, and the Optional Tabs checkboxes wrapped oddly. The Playlist Maker also sent you to a Settings page that's now called Media. --- theseus/desktop/playlist_maker.cpp | 2 +- theseus/desktop/title_maker.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/theseus/desktop/playlist_maker.cpp b/theseus/desktop/playlist_maker.cpp index 98bbe8f..5e8945b 100644 --- a/theseus/desktop/playlist_maker.cpp +++ b/theseus/desktop/playlist_maker.cpp @@ -145,7 +145,7 @@ static void DrawItemsPane() { ImGui::Separator(); if (movieCount == 0 && showCount == 0) { - ImGui::TextWrapped("No media loaded. Set Movies / TV roots in Settings > Media Library, then hit Refresh Library above."); + ImGui::TextWrapped("No movies or TV shows yet. Set the Movies and TV Shows folders in Settings > Media, then press Refresh Library above."); return; } diff --git a/theseus/desktop/title_maker.cpp b/theseus/desktop/title_maker.cpp index 3de0480..51db16f 100644 --- a/theseus/desktop/title_maker.cpp +++ b/theseus/desktop/title_maker.cpp @@ -852,6 +852,7 @@ void RenderTitleMaker() { if (ImGui::CollapsingHeader("Optional Tabs")) { if (ImGui::Checkbox("Steam", &g_showSteamTab)) SaveDesktopSettings(); + ImGui::SameLine(); if (ImGui::Checkbox("RetroArch", &g_showRetroArchTab)) SaveDesktopSettings(); ImGui::SameLine(); if (ImGui::Checkbox("ES-DE", &g_showEsdeTab)) SaveDesktopSettings(); @@ -861,6 +862,7 @@ void RenderTitleMaker() { // xemu path setting { + ImGui::AlignTextToFramePadding(); ImGui::Text("xemu:"); ImGui::SameLine(); // Reserve room for [Save][Find] + their gaps + a 12px right margin so @@ -892,6 +894,7 @@ void RenderTitleMaker() { // PCSX2 path setting. Empty is fine: PS2 discs find PCSX2 at launch. { + ImGui::AlignTextToFramePadding(); ImGui::Text("PCSX2:"); ImGui::SameLine(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - 150); @@ -917,11 +920,13 @@ void RenderTitleMaker() { // Search and category filter { + ImGui::AlignTextToFramePadding(); ImGui::Text("Search:"); ImGui::SameLine(); ImGui::SetNextItemWidth(180); ImGui::InputText("##search", s_searchFilter, sizeof(s_searchFilter)); ImGui::SameLine(); + ImGui::AlignTextToFramePadding(); ImGui::Text("Category:"); ImGui::SameLine(); ImGui::SetNextItemWidth(130); @@ -1025,11 +1030,13 @@ void RenderTitleMaker() { ImGui::Spacing(); // Edit fields + ImGui::AlignTextToFramePadding(); ImGui::Text("Name:"); ImGui::SameLine(80); ImGui::SetNextItemWidth(-1); ImGui::InputText("##editname", s_editName, sizeof(s_editName)); + ImGui::AlignTextToFramePadding(); ImGui::Text("Launch:"); ImGui::SameLine(80); ImGui::SetNextItemWidth(-60); @@ -1039,6 +1046,7 @@ void RenderTitleMaker() { s_appBrowser.Open(); } + ImGui::AlignTextToFramePadding(); ImGui::Text("Category:"); ImGui::SameLine(80); ImGui::SetNextItemWidth(150); @@ -1050,6 +1058,7 @@ void RenderTitleMaker() { ImGui::EndCombo(); } + ImGui::AlignTextToFramePadding(); ImGui::Text("Title ID:"); ImGui::SameLine(80); ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "%s", s_editTitleID); @@ -1145,6 +1154,7 @@ void RenderTitleMaker() { // Bottom bar: new title + ISO import + Steam import ImGui::Separator(); + ImGui::AlignTextToFramePadding(); ImGui::Text("New:"); ImGui::SameLine(); ImGui::SetNextItemWidth(180); @@ -1433,6 +1443,7 @@ void RenderTitleMaker() { // Install path { + ImGui::AlignTextToFramePadding(); ImGui::Text("Install:"); ImGui::SameLine(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - 220); @@ -1523,11 +1534,13 @@ void RenderTitleMaker() { ImGui::Text("Add Game by App ID"); + ImGui::AlignTextToFramePadding(); ImGui::Text("Title:"); ImGui::SameLine(80); ImGui::SetNextItemWidth(300); ImGui::InputText("##sttitle", s_stTitle, sizeof(s_stTitle)); + ImGui::AlignTextToFramePadding(); ImGui::Text("AppID:"); ImGui::SameLine(80); ImGui::SetNextItemWidth(160); @@ -1782,6 +1795,7 @@ void RenderTitleMaker() { // Install path setting { + ImGui::AlignTextToFramePadding(); ImGui::Text("Install:"); ImGui::SameLine(); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - 220); @@ -1882,11 +1896,13 @@ void RenderTitleMaker() { ImGui::Text("Add Game"); + ImGui::AlignTextToFramePadding(); ImGui::Text("Title:"); ImGui::SameLine(80); ImGui::SetNextItemWidth(300); ImGui::InputText("##ratitle", s_raTitle, sizeof(s_raTitle)); + ImGui::AlignTextToFramePadding(); ImGui::Text("Core:"); ImGui::SameLine(80); ImGui::SetNextItemWidth(300); @@ -1909,6 +1925,7 @@ void RenderTitleMaker() { "No cores under %s/cores/. Install one via RetroArch's Online Updater.", s_retroarchPath); + ImGui::AlignTextToFramePadding(); ImGui::Text("Content:"); ImGui::SameLine(80); ImGui::SetNextItemWidth(300); From 0fdc590f9f36f4376277f9ae87b1885a7debfd9e Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:48:48 -0500 Subject: [PATCH 04/14] Tidied theseus.log It now opens with the version and OS, shows paths with your home folder as ~, and puts the renderer on one line. Dropped the old preview banner, the doubled ready line, the shader chatter, the Plex client id, and expected misses like background.xbx, missing launcher folders and an empty save folder. Alerts no longer leave a stray bell character in the file. --- theseus/desktop/dashapp.cpp | 1 - theseus/desktop/debug.cpp | 6 +-- theseus/desktop/desktop_nodes.cpp | 2 +- theseus/desktop/files.cpp | 4 +- theseus/desktop/host_posix_app.cpp | 1 + theseus/desktop/host_win_app.cpp | 1 + theseus/desktop/jellyfin_client.cpp | 5 +-- theseus/desktop/plex_client.cpp | 3 +- theseus/desktop/sdl_main.cpp | 69 +++++++++++++++-------------- theseus/render/asset_loader.cpp | 5 +++ 10 files changed, 53 insertions(+), 44 deletions(-) diff --git a/theseus/desktop/dashapp.cpp b/theseus/desktop/dashapp.cpp index 7e46b49..acba7f0 100755 --- a/theseus/desktop/dashapp.cpp +++ b/theseus/desktop/dashapp.cpp @@ -762,7 +762,6 @@ bool InitApp() CallFunction(g_pObject, "initialize"); PreloadSkinTextures(); - fprintf(stdout, "[InitApp] Done!\n"); fflush(stdout); return true; } diff --git a/theseus/desktop/debug.cpp b/theseus/desktop/debug.cpp index cfab81d..787b1b7 100755 --- a/theseus/desktop/debug.cpp +++ b/theseus/desktop/debug.cpp @@ -6,8 +6,8 @@ #include "dashapp.h" #include "node.h" -// Prints like printf to stderr. A leading \001 (the Xbox's severity mark) -// is dropped; messages past 511 characters are cut. +// Prints like printf to stderr. A leading \001 or \007 (the Xbox's severity +// marks) is dropped; messages past 511 characters are cut. extern "C" void Trace(const char* szMsg, ...) { char text[512]; @@ -16,7 +16,7 @@ extern "C" void Trace(const char* szMsg, ...) vsnprintf(text, sizeof(text), szMsg, args); va_end(args); - fputs(text[0] == '\001' ? text + 1 : text, stderr); + fputs(text[0] == '\001' || text[0] == '\007' ? text + 1 : text, stderr); } void TheseusGetErrorString(HRESULT hr, char* szErrorBuf, int cchErrorBuf) diff --git a/theseus/desktop/desktop_nodes.cpp b/theseus/desktop/desktop_nodes.cpp index d45d8fc..639242b 100644 --- a/theseus/desktop/desktop_nodes.cpp +++ b/theseus/desktop/desktop_nodes.cpp @@ -1809,7 +1809,7 @@ static void EnumerateTitles() }; HostDir* dir = Host_OpenDir(udataPath); - if (!dir) { fprintf(stderr, "[SavedGameGrid] Cannot open %s\n", udataPath); return; } + if (!dir) return; // no saves yet char entry[260]; while (Host_ReadDir(dir, entry, sizeof(entry), NULL)) ProcessTitleEntry(entry); Host_CloseDir(dir); diff --git a/theseus/desktop/files.cpp b/theseus/desktop/files.cpp index 5dca009..89d9e82 100755 --- a/theseus/desktop/files.cpp +++ b/theseus/desktop/files.cpp @@ -195,7 +195,9 @@ void CFolder::Refresh(const char* szPath) HANDLE hFind = TheseusFindFirstFile(szPatternA, &fd); if (hFind == INVALID_HANDLE_VALUE) { - TRACE("\001Cannot read directory: \"%s\" (%d)\n", szPath, GetLastError()); + // A folder that isn't there is normal: most drives and launcher folders are optional. + if (TheseusGetFileAttributes(szPath) != (DWORD)-1) + TRACE("\001Cannot read directory: \"%s\" (%d)\n", szPath, GetLastError()); return; } diff --git a/theseus/desktop/host_posix_app.cpp b/theseus/desktop/host_posix_app.cpp index 87c63af..b8bc4b0 100644 --- a/theseus/desktop/host_posix_app.cpp +++ b/theseus/desktop/host_posix_app.cpp @@ -427,6 +427,7 @@ void Host_InstallCrashHandler(const char* userDataDir, const char* shippedDir) { CrashVersion(shippedDir, version, sizeof(version)); CrashOsName(os, sizeof(os)); snprintf(s_crashHeader, sizeof(s_crashHeader), "Version: %s\nOS: %s\n", version, os); + fprintf(stdout, "[Host] UIX Desktop %s on %s\n", version, os); time_t now = time(NULL); struct tm lt; diff --git a/theseus/desktop/host_win_app.cpp b/theseus/desktop/host_win_app.cpp index a12b9c5..0c88704 100644 --- a/theseus/desktop/host_win_app.cpp +++ b/theseus/desktop/host_win_app.cpp @@ -389,6 +389,7 @@ void Host_InstallCrashHandler(const char* userDataDir, const char* shippedDir) { CrashVersion(shippedDir, version, sizeof(version)); CrashOsName(os, sizeof(os)); snprintf(s_crashHeader, sizeof(s_crashHeader), "Version: %s\nOS: %s\n", version, os); + fprintf(stdout, "[Host] UIX Desktop %s on %s\n", version, os); SetUnhandledExceptionFilter(CrashFilter); signal(SIGABRT, CrashAbort); diff --git a/theseus/desktop/jellyfin_client.cpp b/theseus/desktop/jellyfin_client.cpp index 5dd08f4..bcc692d 100644 --- a/theseus/desktop/jellyfin_client.cpp +++ b/theseus/desktop/jellyfin_client.cpp @@ -167,9 +167,8 @@ void Jellyfin_Init() GenerateUUID(g_jellyfinClientId); SaveDesktopSettings(); } - fprintf(stderr, "[Jellyfin] init (token=%s, url=%s)\n", - g_jellyfinToken[0] ? "yes" : "no", - g_jellyfinUrl[0] ? g_jellyfinUrl : "(unset)"); + fprintf(stderr, "[Jellyfin] %s%s%s\n", g_jellyfinToken[0] ? "Signed in" : "Not signed in", + g_jellyfinUrl[0] ? " to " : "", g_jellyfinUrl); } static SerialWorker s_reports; diff --git a/theseus/desktop/plex_client.cpp b/theseus/desktop/plex_client.cpp index 8dbb7ba..91565c8 100644 --- a/theseus/desktop/plex_client.cpp +++ b/theseus/desktop/plex_client.cpp @@ -117,8 +117,7 @@ void Plex_Init() GenerateUUID(g_plexClientId); SaveDesktopSettings(); } - fprintf(stderr, "[Plex] init (token=%s, clientId=%s)\n", - g_plexToken[0] ? "yes" : "no", g_plexClientId); + fprintf(stderr, "[Plex] %s\n", g_plexToken[0] ? "Signed in" : "Not signed in"); } static SerialWorker s_reports; diff --git a/theseus/desktop/sdl_main.cpp b/theseus/desktop/sdl_main.cpp index 7084e87..0ddfb89 100644 --- a/theseus/desktop/sdl_main.cpp +++ b/theseus/desktop/sdl_main.cpp @@ -37,6 +37,7 @@ #include #include #include +#include // Loads Data/shaders//.bin. Picks subdir from the active renderer. bgfx::ShaderHandle theseus_bgfx_load_shader(const char* name) @@ -223,6 +224,17 @@ bool g_desktopRestartRequested = false; bool g_desktopRestartMuted = false; static char* s_execPath = NULL; +// The home folder shown as ~, so a pasted log doesn't carry a user name. +static std::string TildePath(const char* path) +{ + const char* home = getenv("HOME"); + if (!home || !*home) home = getenv("USERPROFILE"); + size_t n = home ? strlen(home) : 0; + if (n > 1 && strncmp(path, home, n) == 0 && (path[n] == '/' || path[n] == '\\' || !path[n])) + return std::string("~") + (path + n); + return path; +} + // Saved argv/argc for execv restart int g_argc = 0; char** g_argv = NULL; @@ -973,20 +985,6 @@ int main(int argc, char* argv[]) { // Before anything reads a config. AppPaths_Init(); - // Which roots we actually resolved, and whether the shipped-only shader - // tree survived the install. A missing one is a black screen with no - // other symptom, so say so here rather than 200 lines later. - { - fprintf(stdout, "[Paths] shipped = %s\n", Plat_ShippedDir()); - fprintf(stdout, "[Paths] userdata = %s\n", Plat_UserDataDir()); - fprintf(stdout, "[Paths] games.ini= %s\n", AppPath("Configs/games.ini")); - const char* shaderDir = AppPath("Data/shaders"); - struct stat sst; - if (stat(shaderDir, &sst) != 0) - fprintf(stderr, "[Paths] MISSING shader tree at %s (install is incomplete)\n", shaderDir); - } - - // This fixes compilation so it works for both GCC and clang #if defined(__SANITIZE_ADDRESS__) #define ASAN_ACTIVE 1 @@ -1004,6 +1002,19 @@ int main(int argc, char* argv[]) { #undef ASAN_ACTIVE // Clean up + // Which roots we actually resolved, and whether the shipped-only shader + // tree survived the install. A missing one is a black screen with no + // other symptom, so say so here rather than 200 lines later. + { + fprintf(stdout, "[Paths] App: %s\n", TildePath(Plat_ShippedDir()).c_str()); + fprintf(stdout, "[Paths] User: %s\n", TildePath(Plat_UserDataDir()).c_str()); + const char* shaderDir = AppPath("Data/shaders"); + struct stat sst; + if (stat(shaderDir, &sst) != 0) + fprintf(stderr, "[Paths] MISSING shader tree at %s (install is incomplete)\n", + TildePath(shaderDir).c_str()); + } + // Buttons by where they sit, not what's printed on them: the bottom one // is A on every pad, and the guide draws each pad's own labels. SDL_SetHint(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0"); @@ -1100,17 +1111,16 @@ int main(int argc, char* argv[]) { default: bgfxInit.type = bgfx::RendererType::Count; break; } if (!bgfx::init(bgfxInit)) { - fprintf(stderr, "bgfx::init failed\n"); + fprintf(stderr, "[Render] bgfx::init failed\n"); } else { const bgfx::Caps* caps = bgfx::getCaps(); - fprintf(stdout, "bgfx initialized: %s\n", - bgfx::getRendererName(caps->rendererType)); // Size the views and the projection off the real drawable // before the first frame. This can read low if the window // isn't realised yet, which the per frame check above heals. BgfxApplyReset(); - fprintf(stdout, "bgfx backbuffer: %dx%d px (scale %.2f)\n", + fprintf(stdout, "[Render] %s, %dx%d px (scale %.2f)\n", + bgfx::getRendererName(caps->rendererType), initW, initH, Plat_GetDisplayScale()); // Link the shader programs we use across the run. @@ -1119,10 +1129,8 @@ int main(int argc, char* argv[]) { bgfx::ShaderHandle fsh = theseus_bgfx_load_shader("fs_simple"); if (bgfx::isValid(vsh) && bgfx::isValid(fsh)) { bgfx::ProgramHandle prog = bgfx::createProgram(vsh, fsh, true); - if (bgfx::isValid(prog)) - fprintf(stdout, "bgfx: vs_simple/fs_simple program linked\n"); - else - fprintf(stderr, "bgfx: simple program link failed\n"); + if (!bgfx::isValid(prog)) + fprintf(stderr, "[Render] simple program link failed\n"); } } { @@ -1130,12 +1138,10 @@ int main(int argc, char* argv[]) { bgfx::ShaderHandle fsh = theseus_bgfx_load_shader("fs_ff"); if (bgfx::isValid(vsh) && bgfx::isValid(fsh)) { bgfx::ProgramHandle prog = bgfx::createProgram(vsh, fsh, true); - if (bgfx::isValid(prog)) { + if (bgfx::isValid(prog)) g_bgfxProgFF = prog; - fprintf(stdout, "bgfx: vs_ff/fs_ff program linked (FF emulator)\n"); - } else { - fprintf(stderr, "bgfx: ff program link failed\n"); - } + else + fprintf(stderr, "[Render] ff program link failed\n"); } } { @@ -1146,9 +1152,8 @@ int main(int argc, char* argv[]) { if (bgfx::isValid(prog)) { g_bgfxProgBlit = prog; g_bgfxSamplerBlit = bgfx::createUniform("s_blit", bgfx::UniformType::Sampler); - fprintf(stdout, "bgfx: vs_blit/fs_blit program linked\n"); } else { - fprintf(stderr, "bgfx: blit program link failed\n"); + fprintf(stderr, "[Render] blit program link failed\n"); } } } @@ -1207,8 +1212,6 @@ int main(int argc, char* argv[]) { } } - fprintf(stdout, "UIX Desktop Preview Tool\n"); - fprintf(stdout, "F1: Toggle Debug Tools | F2: XAP Editor | F10: Toggle Menu Bar\n"); fflush(stdout); fflush(stderr); // Initialize Dear ImGui @@ -1391,7 +1394,7 @@ int main(int argc, char* argv[]) { // lazily off the generation counter, so arriving late costs nothing. if (g_showEsdeTab && s_esdePath[0]) EsdeVGames_Sync(s_esdePath); - fprintf(stdout, "InitApp() succeeded - entering main loop\n"); + fprintf(stdout, "[Desktop] Ready\n"); // Register pluggable launcher modules (shell, url, future: // xemu, retroarch, steam, ...). Done before the dispatcher @@ -1697,7 +1700,7 @@ int main(int argc, char* argv[]) { bool muted = g_desktopRestartMuted; g_desktopRestartRequested = false; g_desktopRestartMuted = false; - fprintf(stderr, "[Desktop] Restarting preview...%s\n", muted ? " (muted)" : ""); + fprintf(stderr, "[Desktop] Restarting%s\n", muted ? " (muted)" : ""); // Build argv with --preview appended (if not already present) bool hasPreview = false; diff --git a/theseus/render/asset_loader.cpp b/theseus/render/asset_loader.cpp index 4eaf423..a8b4dd1 100644 --- a/theseus/render/asset_loader.cpp +++ b/theseus/render/asset_loader.cpp @@ -811,6 +811,11 @@ LPDIRECT3DTEXTURE8 LoadTexture(const TCHAR* szURL, UINT width, UINT height) // unresolved background.bmp came out as a giant smear of the menu-hilight // pill). Better to fail loudly so missing assets are obvious during skin // authoring. +#ifndef _XBOX + // Only a skin brings background.xbx, so Stock missing it is normal. + if (_tcsicmp(szURL, _T("background.xbx")) == 0) + return NULL; +#endif ALERT(_T("Unable to load texture file (%s)"), szURL); return NULL; } From cba0a6579474a075151df8e61b226e07a9127ddd Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:49:29 -0500 Subject: [PATCH 05/14] Grouped the guide's settings pages and said what each does The pages listed settings in file order, so Games mixed emulator paths, Title Maker tabs and launcher toggles, and most rows had a generic "Left and right change it" help line. Each page now reads in captioned blocks, every visible setting has its own help, and a few labels say what they mean (xemu Hard Disk, Anti-Aliasing, Frame Rate Limit, Return After a Game, Ask Each Time). --- theseus/desktop/desktop_settings.cpp | 14 ++-- theseus/desktop/guide.cpp | 121 ++++++++++++++++++++++----- 2 files changed, 107 insertions(+), 28 deletions(-) diff --git a/theseus/desktop/desktop_settings.cpp b/theseus/desktop/desktop_settings.cpp index ee058ec..b16507a 100644 --- a/theseus/desktop/desktop_settings.cpp +++ b/theseus/desktop/desktop_settings.cpp @@ -78,7 +78,7 @@ static void ApplyVolume() } static const int kStartupVals[] = { 0, 1, 2 }; -static const char* kStartupLbl[] = { "Ask on launch", "Dashboard", "Development" }; +static const char* kStartupLbl[] = { "Ask Each Time", "Dashboard", "Development" }; static const char* kStartupTok[] = { "", "dashboard", "development" }; // Turning it on buzzes once, so you know it works. @@ -131,13 +131,13 @@ static const char* kModeLbl[] = { "Windowed", "Borderless", "Fullscreen" }; static const SettingDef kDefs[] = { S_PATH("XemuPath", "Desktop", "Games", "xemu Path", s_xemuPath, 0), S_PATH("Pcsx2Path", "Desktop", "Games", "PCSX2 Path", s_pcsx2Path, 0), - S_PATH("QcowPath", "Desktop", "General", "qcow2 HDD Image", g_qcowPath, 0), + S_PATH("QcowPath", "Desktop", "General", "xemu Hard Disk", g_qcowPath, 0), S_PATH("SteamPath", "Desktop", "Games", "Steam Folder", s_steamPath, 0), S_PATH("RetroArchPath", "Desktop", "Games", "RetroArch Folder", s_retroarchPath, 0), S_PATH("EsdePath", "Desktop", "Games", "ES-DE Folder", s_esdePath, 0), - S_BOOL("ShowEsdeTab", "Desktop", "Games", "ES-DE Import Tab", g_showEsdeTab, "1", 0), + S_BOOL("ShowEsdeTab", "Desktop", "Games", "ES-DE Tab", g_showEsdeTab, "1", 0), S_BOOL("RetroArchFullscreen", "Desktop", "Games", "RetroArch Fullscreen", g_retroarchFullscreen, "1", 0), - S_BOOL("ReturnAfterGame", "Desktop", "Games", "Back to UIX When a Game Closes", g_returnAfterGame, "1", 0), + S_BOOL("ReturnAfterGame", "Desktop", "Games", "Return After a Game", g_returnAfterGame, "1", 0), { "AudioBufferFrames", "Desktop", "Audio", "Audio Buffer", SK_INT, &g_audioBufferFrames, 0, "1024", SF_RESTART | SF_HIDDEN, NOENUM, 0, 0, 256, NULL, NULL }, S_BOOL("ShowRetroArchTab", "Desktop", "Games", "RetroArch Tab", g_showRetroArchTab, "1", 0), @@ -150,16 +150,16 @@ static const SettingDef kDefs[] = { NOENUM, 0, 0, 0, NULL, ApplyStartAtLogin }, S_BOOL("UseOnScreenKeyboard", "Desktop", "General", "On-Screen Keyboard Only", g_bUseOnScreenKeyboard, "0", 0), S_BOOL("ShowBootAnimation", "Desktop", "General", "Boot Animation", g_bShowBootAnimation, "1", 0), - { "MSAA", "Desktop", "Display", "MSAA", SK_ENUM, &g_msaaSamples, 0, "4", SF_STRICT, + { "MSAA", "Desktop", "Display", "Anti-Aliasing", SK_ENUM, &g_msaaSamples, 0, "4", SF_STRICT, ENUM(kMsaaVals, kMsaaLbl, NULL), 0, 0, 0, NULL, ApplyMsaa }, { "Vsync", "Desktop", "Display", "VSync", SK_ENUM, &g_vsyncMode, 0, "0", 0, ENUM(kVsyncVals, kVsyncLbl, NULL), 0, 2, 0, NULL, ApplyVsync }, - S_BOOL("MenuBarAutoHide", "Desktop", "General", "Auto-hide Menu Bar", g_menuBarAutoHide, "1", 0), + S_BOOL("MenuBarAutoHide", "Desktop", "General", "Auto-Hide Menu Bar", g_menuBarAutoHide, "1", 0), S_BOOL("PadMode", "Desktop", "General", "Controller Tools", g_padModeEnabled, "1", SF_HIDDEN), S_BOOL("WelcomeDone", "Desktop", "General", "Welcome Shown", g_welcomeDone, "0", SF_HIDDEN), { "EmulateXboxRes", "Desktop", "Display", "Emulate Xbox Resolution", SK_BOOL, &g_bEmulateXboxRes, 0, "1", 0, NOENUM, 0, 0, 0, NULL, ApplyProjection }, - { "FpsCap", "Desktop", "Display", "FPS Cap", SK_ENUM, &g_fpsCap, 0, "0", 0, + { "FpsCap", "Desktop", "Display", "Frame Rate Limit", SK_ENUM, &g_fpsCap, 0, "0", 0, ENUM(kFpsVals, kFpsLbl, NULL), 0, 100000, 0, NULL, NULL }, S_BOOL("Hwdec", "Desktop", "Display", "Hardware Video Decode", g_hwdec, "0", 0), { "MasterVolume", "Desktop", "Audio", "Master Volume", SK_FLOAT, &g_masterVolume, 0, "1.000", diff --git a/theseus/desktop/guide.cpp b/theseus/desktop/guide.cpp index c8c363a..8755200 100644 --- a/theseus/desktop/guide.cpp +++ b/theseus/desktop/guide.cpp @@ -250,24 +250,55 @@ static void SetUpFolders() SaveDesktopSettings(); } -// A few rows need more than their label says. +// What each row does, past what its label says. static const char* SettingHelp(const SettingDef& d) { static const struct { const char* key; const char* help; } kHelp[] = { - { "StartupMode", "What happens when UIX Desktop starts." }, + { "StartupMode", "What happens when UIX Desktop starts. Ask Each Time shows the Welcome screen." }, { "StartAtLogin", "Starts UIX Desktop in Console Mode when you sign in. Only for you, nothing system wide." }, { "ConsoleMode", "Fullscreen with no frame, straight into the dashboard. For a TV or a games machine." }, - { "UseOnScreenKeyboard", "Text fields ignore the physical keyboard and use the pad keyboard." }, - { "ShowBootAnimation", "Play the Xbox boot animation once at startup." }, - { "MenuBarAutoHide", "In Development Mode the tool bar shows when the pointer reaches the top." }, - { "EmulateXboxRes", "Keep scenes framed the way they were authored." }, - { "Hwdec", "Faster on AMD and NVIDIA. Applies to the next video." }, + { "UseOnScreenKeyboard", "The dashboard's text fields ignore your keyboard and use the pad keyboard." }, + { "ShowBootAnimation", "Plays the Xbox boot animation when UIX Desktop starts." }, + { "MenuBarAutoHide", "In Development Mode the menu bar shows when the pointer reaches the top." }, + { "QcowPath", "Your xemu hard disk (.qcow2). The dashboard shows the saves on it." }, + { "DisplayMode", "Windowed, borderless or fullscreen. F11 switches to fullscreen and back." }, + { "Resolution", "The window's size. Native leaves it the size it is." }, + { "Renderer", "The graphics API. Auto picks the best one here. Takes effect next start." }, + { "MSAA", "Smooths jagged edges. Higher looks cleaner and costs more." }, + { "Vsync", "Keeps frames in step with the screen so the picture doesn't tear." }, + { "FpsCap", "The most frames a second. A lower cap saves power and heat." }, + { "EmulateXboxRes", "Frames scenes like the Xbox's 720x480. Off shows more at the sides." }, + { "Hwdec", "Lets the graphics card decode video. Applies to the next video." }, { "MasterVolume", "Dashboard sounds, music and videos." }, - { "UseMilkdropViz", "Use projectM for the music visualizer." }, - { "ShowAlbumCover", "Show album art in the orb when a soundtrack has it." }, + { "UseMilkdropViz", "Uses projectM, the Milkdrop visualizer, for music." }, + { "ShowAlbumCover", "Shows album art in the orb when a soundtrack has it." }, { "CRT_Enabled", "Old TV look over the whole dashboard." }, + { "CRT_Scanlines", "Dark lines between rows, like an old TV. Needs CRT Effect on." }, + { "CRT_Curvature", "How much the picture bulges. Needs CRT Effect on." }, + { "CRT_Phosphor", "The fine color grid of a tube screen. Needs CRT Effect on." }, + { "CRT_Vignette", "Darker corners. Needs CRT Effect on." }, + { "CRT_Bloom", "Glow around bright things. Needs CRT Effect on." }, + { "CRT_Flicker", "A slight flicker in brightness. Needs CRT Effect on." }, + { "CRT_ColorBleed", "Colors smearing sideways. Needs CRT Effect on." }, + { "CRT_Brightness", "Brightness under the effect. Needs CRT Effect on." }, { "GuideTheme", "The guide's colors." }, + { "MusicRoot", "Where your music is. It's read again when you change it." }, + { "MoviesRoot", "Where your movies are. It's read again when you change it." }, + { "TvRoot", "Where your shows are: a folder per show, with Season folders inside." }, + { "TMDBKey", "Optional. Gets posters and details from themoviedb.org. It stays hidden." }, + { "XemuPath", "The xemu app, for Xbox games. Find xemu fills it in." }, + { "Pcsx2Path", "The PCSX2 app, for PS2 games. Find PCSX2 fills it in." }, + { "RomsDir", "Where your ROMs and disc images are, for launchers that ask." }, + { "SteamPath", "Where Steam is. Empty looks in the usual places." }, + { "RetroArchPath", "Where RetroArch is, with its cores and playlists." }, + { "EsdePath", "Your ES-DE folder. Its games show up in the launcher." }, + { "RetroArchFullscreen", "Starts RetroArch games fullscreen." }, + { "ReturnAfterGame", "Brings UIX Desktop back to the front when a game closes." }, + { "ShowSteamTab", "Shows the Steam tab in the Title Maker (F3)." }, + { "ShowRetroArchTab", "Shows the RetroArch tab in the Title Maker (F3)." }, + { "ShowEsdeTab", "Shows the ES-DE tab in the Title Maker (F3)." }, { "FetchGameArt", "Box art for games without an icon. Icons you picked are never replaced." }, + { "SteamGridDBKey", "Optional. Lets Download Game Art look on SteamGridDB too. It stays hidden." }, { "HideDuplicateGames", "A game in Steam and ES-DE shows once: Steam first, then yours, then ES-DE." }, { "Rumble", "A short buzz when the guide can't do what you asked." }, { "ButtonStyle", "The buttons the guide shows. Match the Pad follows the pad you used last." }, @@ -285,6 +316,47 @@ static const char* SettingHelp(const SettingDef& d) static const char* kPages[] = { "General", "Display", "Audio", "Media", "Games", "Controller" }; static const int kPageCount = (int)(sizeof(kPages) / sizeof(kPages[0])); +// Each page's rows in blocks: "#" starts a caption, the rest are keys. A +// setting left out here still shows, at the end of its own page. +static const char* const kGeneralRows[] = { + "#Startup", "StartupMode", "ConsoleMode", "StartAtLogin", "ShowBootAnimation", + "#Keyboard and menu bar", "UseOnScreenKeyboard", "MenuBarAutoHide", + "#Xbox hard disk", "QcowPath", NULL, +}; +static const char* const kDisplayRows[] = { + "#Window", "DisplayMode", "Resolution", + "#Rendering", "Renderer", "MSAA", "Vsync", "FpsCap", "EmulateXboxRes", + "#Guide", "GuideTheme", + "#CRT effect", "CRT_Enabled", "CRT_Scanlines", "CRT_Curvature", "CRT_Phosphor", "CRT_Vignette", "CRT_Bloom", + "CRT_Flicker", "CRT_ColorBleed", "CRT_Brightness", NULL, +}; +static const char* const kAudioRows[] = { + "MasterVolume", "#Music", "UseMilkdropViz", "ShowAlbumCover", NULL, +}; +static const char* const kMediaRows[] = { + "#Folders", "MusicRoot", "MoviesRoot", "TvRoot", + "#Video", "Hwdec", + "#Online", "TMDBKey", NULL, +}; +static const char* const kGamesRows[] = { + "#Emulators", "XemuPath", "Pcsx2Path", "RomsDir", + "#Launchers", "SteamPath", "RetroArchPath", "EsdePath", "RetroArchFullscreen", "ReturnAfterGame", + "#Library", "HideDuplicateGames", "FetchGameArt", "SteamGridDBKey", + "#Title Maker tabs", "ShowSteamTab", "ShowRetroArchTab", "ShowEsdeTab", NULL, +}; +static const char* const kControllerRows[] = { "Rumble", "ButtonStyle", "SwapConfirm", NULL }; +static const char* const* const kPageRows[] = { + kGeneralRows, kDisplayRows, kAudioRows, kMediaRows, kGamesRows, kControllerRows, +}; + +static bool PageLists(const char* key) +{ + for (int p = 0; p < kPageCount; p++) + for (const char* const* k = kPageRows[p]; *k; k++) + if (strcmp(*k, key) == 0) return true; + return false; +} + enum Section { SEC_SETTINGS, SEC_ACCOUNTS, SEC_LIBRARY, SEC_LOGS, SEC_SHORTCUTS, SEC_ABOUT, SEC_TOOLS, SEC_EXIT, SEC_COUNT }; static const char* kSections[SEC_COUNT] = { @@ -676,24 +748,31 @@ static const struct { }; static const int kEmuCount = (int)(sizeof(kEmus) / sizeof(kEmus[0])); +static void AddSetting(int i) +{ + const SettingDef& d = DesktopSettings_Table().defs[i]; + if (d.flags & SF_HIDDEN) return; + char val[512]; + Setting_Display(d, val, sizeof(val)); + bool typed = d.kind == SK_PATH || d.kind == SK_STRING; + Add(d.label, val, SettingHelp(d), typed ? GA_TEXT : GA_SETTING, i); + for (int e = 0; e < kEmuCount; e++) + if (strcmp(d.key, kEmus[e].key) == 0) + Add(kEmus[e].findLabel, g.found[e].c_str(), kEmus[e].findHelp, GA_FINDEMU, e); +} + static void Build() { g.rows.clear(); switch (g.view) { case GV_PAGE: { const SettingsTable& t = DesktopSettings_Table(); - char val[512]; - for (int i = 0; i < t.count; i++) { - const SettingDef& d = t.defs[i]; - if (d.flags & SF_HIDDEN) continue; - if (strcmp(d.page, kPages[g.page]) != 0) continue; - Setting_Display(d, val, sizeof(val)); - bool typed = d.kind == SK_PATH || d.kind == SK_STRING; - Add(d.label, val, SettingHelp(d), typed ? GA_TEXT : GA_SETTING, i); - for (int e = 0; e < kEmuCount; e++) - if (strcmp(d.key, kEmus[e].key) == 0) - Add(kEmus[e].findLabel, g.found[e].c_str(), kEmus[e].findHelp, GA_FINDEMU, e); + for (const char* const* k = kPageRows[g.page]; *k; k++) { + if (**k == '#') { Caption(*k + 1); continue; } + if (const SettingDef* d = DesktopSettings_Find(*k)) AddSetting((int)(d - t.defs)); } + for (int i = 0; i < t.count; i++) + if (strcmp(t.defs[i].page, kPages[g.page]) == 0 && !PageLists(t.defs[i].key)) AddSetting(i); break; } case GV_ABOUT: @@ -739,7 +818,7 @@ static void Build() if (const SettingDef* mode = DesktopSettings_Find("StartupMode")) { char val[64]; Setting_Display(*mode, val, sizeof(val)); - Add(mode->label, val, "Ask on launch brings this screen back each time.", GA_SETTING, + Add(mode->label, val, "Ask Each Time brings this screen back at every start.", GA_SETTING, (int)(mode - DesktopSettings_Table().defs)); } break; From cf718aba136ca38f22ccee7689f4df6cb188711c Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:49:44 -0500 Subject: [PATCH 06/14] Guide prompts now say what A does Most rows said Select whatever they did, and a sign in that was waiting for its code still said Select when A cancels it. The prompt now names the action (Search, Copy, Import, Sign In, Cancel, Restart...), every row that opens a list gets the chevron, and Runs With shows its arrows like Category. MORE no longer sits under the Settings tabs, and the Welcome screen got its title back. --- theseus/desktop/guide.cpp | 90 ++++++++++++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 21 deletions(-) diff --git a/theseus/desktop/guide.cpp b/theseus/desktop/guide.cpp index 8755200..883b393 100644 --- a/theseus/desktop/guide.cpp +++ b/theseus/desktop/guide.cpp @@ -1198,11 +1198,25 @@ static const char* ViewTitle() const Playlist* pl = Playlist_Get(g.playlist); return pl ? pl->name.c_str() : "Playlist"; } - case GV_WELCOME: return g_welcomeDone ? "Start" : "Welcome"; + case GV_WELCOME: return g_welcomeDone ? "Welcome Back" : "Welcome"; default: return kSections[g.section]; } } +// Rows that open another list, so they get a chevron and an Open prompt. +static bool Opens(const Row& r) +{ + switch (r.act) { + case GA_VIEW: case GA_GAMECOLL: case GA_COLLECTION: case GA_BACKUPS: case GA_PICKBACKUP: + case GA_GAMELIST: case GA_PLAYLIST: case GA_LETTER: case GA_GAME: case GA_APPS: case GA_CHOOSEFILE: + return true; + case GA_BROWSE: + return r.arg >= 0 && r.arg < (int)g.entries.size() && g.entries[r.arg].dir; + default: + return false; + } +} + // Opening and closing static void ShowSection(int section) @@ -2368,7 +2382,8 @@ static float RowHeight(const Row& r, float width) return ROW_H + ROW_GAP; } -static void DrawRows(float left, float right, float top) +// moreY is where "more above" goes: on the heading's line, or under the tabs. +static void DrawRows(float left, float right, float top, float moreY) { float width = right - left; float room = BODY_B - top + ROW_GAP; @@ -2439,7 +2454,7 @@ static void DrawRows(float left, float right, float top) y += h[i]; continue; } - if (r.act == GA_SETTING || r.act == GA_CATEGORY) { + if (r.act == GA_SETTING || r.act == GA_CATEGORY || r.act == GA_RUNNER) { const SettingDef* d = r.act == GA_SETTING ? &DesktopSettings_Table().defs[r.arg] : NULL; const char* badge = d && (d->flags & SF_RESTART) ? "RESTART" : NULL; float labelRoom = width * 0.55f - (badge ? 50.0f : 0.0f); @@ -2450,8 +2465,7 @@ static void DrawRows(float left, float right, float top) ui_style_row(left, y, width, ROW_H, on); float ty = y + (ROW_H - 11.0f) * 0.5f; float valueW = r.value.empty() ? 0.0f : ui_overlay_text_width(UI_FONT_BOLD, 11.0f, r.value.c_str()); - float chevron = r.act == GA_VIEW || r.act == GA_GAMECOLL || r.act == GA_COLLECTION || - r.act == GA_BACKUPS || r.act == GA_PICKBACKUP ? 14.0f : 0.0f; + float chevron = Opens(r) ? 14.0f : 0.0f; if (valueW > width * 0.45f) valueW = width * 0.45f; std::string label = Fit(UI_FONT_BOLD, 11.0f, r.label, width - 24 - valueW - chevron - 8); ui_overlay_text(UI_FONT_BOLD, 11.0f, left + 12, ty, UI_ALIGN_LEFT, 0xFFFFFFFF, label.c_str()); @@ -2469,7 +2483,7 @@ static void DrawRows(float left, float right, float top) } // More above or below. if (g.scroll > 0) - ui_overlay_text(UI_FONT_BOLD, 9.0f, right - 6, top - 12, UI_ALIGN_RIGHT, ui_style_color(UI_COLOR_LABEL), "MORE"); + ui_overlay_text(UI_FONT_BOLD, 9.0f, right - 6, moreY, UI_ALIGN_RIGHT, ui_style_color(UI_COLOR_LABEL), "MORE"); if (i < n) ui_overlay_text(UI_FONT_BOLD, 9.0f, right - 6, y - ROW_GAP + 1, UI_ALIGN_RIGHT, ui_style_color(UI_COLOR_LABEL), "MORE"); @@ -2488,15 +2502,15 @@ static void DrawPanel(float left, float right) float starts[8], ends[8]; ui_style_tabs(left, right, top, 20, kPages, kPageCount, g.page, "Q", "E", starts, ends); for (int i = 0; i < kPageCount; i++) AddTarget(starts[i], top, ends[i], top + 20, T_TAB, i); - top += 30; - } else { - std::string heading = g.view == GV_WELCOME ? "Ways in" : ViewTitle(); - for (size_t i = 0; i < heading.size(); i++) heading[i] = (char)toupper((unsigned char)heading[i]); - heading = Fit(UI_FONT_BOLD, 9.0f, heading, right - left); - ui_style_text(UI_TEXT_HEADING, left + 1, top + 2, UI_ALIGN_LEFT, heading.c_str()); - top += 20; + DrawRows(left, right, top + 34, top + 23); + return; } - DrawRows(left, right, top); + std::string heading = g.view == GV_WELCOME ? "Ways in" : ViewTitle(); + for (size_t i = 0; i < heading.size(); i++) heading[i] = (char)toupper((unsigned char)heading[i]); + // Room left for MORE on the same line. + heading = Fit(UI_FONT_BOLD, 9.0f, heading, right - left - 44); + ui_style_text(UI_TEXT_HEADING, left + 1, top + 2, UI_ALIGN_LEFT, heading.c_str()); + DrawRows(left, right, top + 20, top + 2); } // The field over the keys. Secrets show as dots; a long line slides so @@ -2569,6 +2583,45 @@ static void DrawEditor() : (std::string(Shoulders()) + " move the cursor.").c_str()); } +// What A does on a row, for its prompt. +static const char* PromptWord(const Row& r) +{ + switch (r.act) { + case GA_NONE: return NULL; + case GA_SETTING: case GA_CATEGORY: case GA_RUNNER: + case GA_FAVORITE: case GA_HIDE: case GA_INCOLL: + return "Change"; + case GA_TEXT: case GA_NAME: case GA_JELLYFINURL: case GA_GAMEOPT: + return "Edit"; + case GA_SEARCH: return "Search"; + case GA_NEWCOLL: return "New"; + case GA_LAUNCH: return "Launch"; + case GA_RESTORE: return "Restore"; + case GA_COPYVERSION: case GA_COPYLOG: + return "Copy"; + case GA_BACKUP: return "Back Up"; + case GA_ADDGAME: case GA_APP: case GA_APPGAMES: + return "Add"; + case GA_STEAM: case GA_RETROARCH: case GA_STORE: + return "Import"; + case GA_ESDE: return "Refresh"; + case GA_FINDEMU: return "Find"; + case GA_PLEX: return Plex_PinAuthInFlight() ? "Cancel" : "Sign In"; + case GA_JELLYFIN: return Jellyfin_QuickConnectInFlight() ? "Cancel" : "Sign In"; + case GA_XBOX: return Xcloud_LoginInFlight() ? "Cancel" : "Sign In"; + case GA_PLEXOUT: case GA_JELLYFINOUT: case GA_XBOXOUT: + return "Sign Out"; + case GA_POWER: return r.arg == HOST_POWER_SLEEP ? "Sleep" : r.arg == HOST_POWER_RESTART ? "Restart" : "Shut Down"; + case GA_RESUME: return g.welcome ? "Start" : "Close"; + case GA_POWERNOW: return r.arg == HOST_POWER_RESTART ? "Restart" : "Shut Down"; + case GA_CANCEL: return "Cancel"; + case GA_QUIT: return "Exit"; + case GA_BROWSEUP: return "Up"; + case GA_BROWSE: return Opens(r) ? "Open" : "Choose"; + default: return Opens(r) ? "Open" : "Select"; + } +} + static void Prompt(ui_style_prompt* p, int* n, int button, const char* key, const char* word, unsigned bits) { p[*n].button = button; @@ -2591,13 +2644,7 @@ static void DrawPrompts() Prompt(p, &n, UI_BUTTON_START, "ENTER", "Done", GUIDE_START); Prompt(p, &n, UI_BUTTON_B, "ESC", "Cancel", GUIDE_B); } else if (g.inPanel && g.cursor >= 0 && g.cursor < (int)g.rows.size()) { - int act = g.rows[g.cursor].act; - const char* word = act == GA_NONE ? NULL - : act == GA_SETTING || act == GA_CATEGORY ? "Change" - : act == GA_VIEW || act == GA_GAMECOLL || act == GA_COLLECTION || - act == GA_BACKUPS || act == GA_PICKBACKUP ? "Open" - : act == GA_RESTORE ? "Restore" - : act == GA_TEXT || act == GA_NAME || act == GA_JELLYFINURL ? "Edit" : "Select"; + const char* word = PromptWord(g.rows[g.cursor]); if (word) Prompt(p, &n, UI_BUTTON_A, "ENTER", word, GUIDE_A); } else if (!g.inPanel) { Prompt(p, &n, UI_BUTTON_A, "ENTER", "Open", GUIDE_A); @@ -2635,6 +2682,7 @@ void Guide_Render(int width, int height) DrawHeader(g.edit.title.c_str()); DrawEditor(); } else if (g.welcome) { + DrawHeader(ViewTitle()); DrawPanel(CONTENT_L + 40, CONTENT_R - 40); } else { DrawHeader("Guide"); From 0f5d2e065ba68f0c53d94c82265d5f9b086a40d9 Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:49:49 -0500 Subject: [PATCH 07/14] Tidied wording and empty spots across the guide Backups showed raw folder names like 2026-11-20 08.32.44, the keyboard field just said Empty, a folder with nothing in it showed a blank list, and the Mac shortcuts said Ctrl. Backups now read as dates with a line on what restoring does, the keyboard shows a hint, empty folders say so, and the Mac shows Cmd. Also filled in the missing sign out and tool help, and game lists now say where a game came from. --- theseus/desktop/guide.cpp | 117 ++++++++++++++++++++++++++------------ 1 file changed, 82 insertions(+), 35 deletions(-) diff --git a/theseus/desktop/guide.cpp b/theseus/desktop/guide.cpp index 883b393..2e47dbd 100644 --- a/theseus/desktop/guide.cpp +++ b/theseus/desktop/guide.cpp @@ -441,6 +441,7 @@ struct Editor { bool on, secret, shift, symbols; int what, arg, key; std::string title, text; + std::string hint; // shown dim while it's empty size_t caret, limit; // bytes Uint32 since; }; @@ -584,6 +585,16 @@ static std::string GameSource(const VirtualGame& vg) return "Programs"; } +// A game list row's help: where it files and where it came from. +static std::string GameFrom(const VirtualGame& vg) +{ + std::string where = vg.group[0] ? vg.group : vg.category; + std::string src = vg.transient ? "ES-DE" : GameSource(vg); + if (src == "Programs") return where; + if (src == "Other Launchers") src = "another launcher"; + return where + ", from " + src; +} + // All Games' orders. Y steps through them. enum { SORT_NAME, SORT_TIME, SORT_LAST, SORT_COUNT }; static const char* const kSorts[SORT_COUNT] = { "A to Z", "Time Played", "Last Played" }; @@ -705,6 +716,24 @@ static std::string PlayedOn(long long t) return buf; } +// A backup's folder name, "2026-11-20 08.32.44 before restore", read as +// "Nov 20, 2026, 08:32 (before restore)". Anything else shows as it is. +static std::string BackupLabel(const std::string& name) +{ + struct tm t = {}; + int used = 0; + if (sscanf(name.c_str(), "%d-%d-%d %d.%d.%d%n", &t.tm_year, &t.tm_mon, &t.tm_mday, &t.tm_hour, &t.tm_min, + &t.tm_sec, &used) != 6) + return name; + t.tm_year -= 1900; + t.tm_mon -= 1; + char buf[64]; + strftime(buf, sizeof(buf), "%b %d, %Y, %H:%M", &t); + std::string rest = name.substr(used); + size_t a = rest.find_first_not_of(' '); + return a == std::string::npos ? std::string(buf) : std::string(buf) + " (" + rest.substr(a) + ")"; +} + // The picked game, or NULL once the DB has moved rows around under us. static VirtualGame* PickedGame() { @@ -784,7 +813,8 @@ static void Build() long long total = 0; for (int i = 0; i < g_vgames.count; i++) if (g_vgames.games[i].valid) total += g_vgames.games[i].playTime; - Add("Time Played", PlayTime(total).c_str(), NULL); + Caption("Your games"); + Add("Total Time Played", PlayTime(total).c_str(), NULL); } Caption("Made by"); Add("Created by", "Milenko", NULL); @@ -797,14 +827,16 @@ static void Build() Para("And everyone who contributed, tested and sent in a bug."); break; case GV_WELCOME: { - const char* intro = g_welcomeDone - ? (Pads_Style() == UI_PAD_PLAYSTATION ? "Cross or Circle starts the dashboard." : "A or B starts the dashboard.") - : "Nothing here is required. It's all in the guide later too."; + const char* intro = !g_welcomeDone ? "Nothing here is required. It's all in the guide later too." + : g.device == 0 ? "Enter or Esc starts the dashboard." + : Pads_Style() == UI_PAD_PLAYSTATION ? "Cross or Circle starts the dashboard." + : "A or B starts the dashboard."; Add("Start the Dashboard", "", intro, GA_RESUME); Add("Development Mode", "", "Edit the scenes live. Restarts UIX Desktop.", GA_DEVMODE); if (!g_welcomeDone || g.foldersDone) Add("Set Up My Folders", g.foldersDone ? "Done" : "", "Makes Music, Movies, TV Shows and ROMs folders. Fill them when you like.", GA_FOLDERS); + Add("Open My Folders", "", "Shows them in your file manager.", GA_OPENFOLDERS); // First run: fill the launcher from what's already on this machine. if (!g_welcomeDone) { char roots[4][512]; @@ -814,7 +846,6 @@ static void Build() for (int e = 0; e < kEmuCount; e++) Add(kEmus[e].findLabel, g.found[e].c_str(), kEmus[e].findHelp, GA_FINDEMU, e); } - Add("Open My Folders", "", "Shows them in your file manager.", GA_OPENFOLDERS); if (const SettingDef* mode = DesktopSettings_Find("StartupMode")) { char val[64]; Setting_Display(*mode, val, sizeof(val)); @@ -893,14 +924,14 @@ static void Build() Add("New Collection", g.result[GA_NEWCOLL].c_str(), "Name it and this game goes in.", GA_NEWCOLL); for (size_t i = 0; i < g.collNames.size(); i++) Add(g.collNames[i].c_str(), VGames_InCollection(*vg, g.collNames[i].c_str()) ? "Yes" : "No", - "A puts it in or takes it out.", GA_INCOLL, (int)i); + "Puts this game in the collection or takes it out.", GA_INCOLL, (int)i); break; } case GV_ADDGAME: { std::string file = g.pickedPath.empty() ? "Choose" : NameOnly(g.pickedPath); Add("File", file.c_str(), g.pickedPath.empty() ? "A program, a shortcut or a ROM." : g.pickedPath.c_str(), GA_CHOOSEFILE); - Add("Name", g.pickedName.c_str(), + Add("Name", g.pickedPath.empty() ? "From the file" : g.pickedName.c_str(), g.pickedPath.empty() ? "Taken from the file name." : "Taken from the file name. Select it to rename it.", g.pickedPath.empty() ? GA_NONE : GA_NAME); Add("Category", kCategories[g.category], "Left and right change it.", GA_CATEGORY); @@ -916,7 +947,8 @@ static void Build() if (g.browseStale) { ListDir(g.browseDir, g.entries); g.browseStale = false; } Add("Up a Folder", "", g.browseDir.c_str(), GA_BROWSEUP); for (size_t i = 0; i < g.entries.size(); i++) - Add(g.entries[i].name.c_str(), g.entries[i].dir ? "Folder" : "", g.browseDir.c_str(), GA_BROWSE, (int)i); + Add(g.entries[i].name.c_str(), "", g.browseDir.c_str(), GA_BROWSE, (int)i); + if (g.entries.empty()) Para("Nothing in this folder. Hidden files aren't listed."); break; case GV_GAMES: { std::vector list; @@ -927,7 +959,7 @@ static void Build() std::string value = sort == SORT_TIME ? PlayTime(vg.playTime) : sort == SORT_LAST || g.gameList == GL_RECENT ? PlayedOn(vg.lastPlayed) : std::string(vg.category); - Add(vg.name, value.c_str(), vg.group[0] ? vg.group : vg.category, GA_GAME, list[i]); + Add(vg.name, value.c_str(), GameFrom(vg).c_str(), GA_GAME, list[i]); } if (g.rows.empty()) Para(g.gameList == GL_HIDDEN ? "Nothing hidden." : g.gameList == GL_SEARCH ? "No matches. Try fewer letters." : "Nothing here yet."); @@ -956,7 +988,7 @@ static void Build() VirtualGame* vg = PickedGame(); if (!vg) { Para("This game moved. Go back and pick it again."); break; } Add("Launch", "", vg->launch, GA_LAUNCH); - Caption("Played"); + Caption("Details"); Add("Last Played", PlayedOn(vg->lastPlayed).c_str(), NULL); Add("Time Played", PlayTime(vg->playTime).c_str(), NULL); { @@ -1022,11 +1054,11 @@ static void Build() Caption("Plex"); if (Plex_HasToken()) { Add("Account", "Signed in", NULL); - Add("Sign Out", "", NULL, GA_PLEXOUT); + Add("Sign Out", "", "Forgets this Plex sign-in on this computer.", GA_PLEXOUT); } else if (Plex_PinAuthInFlight()) { std::string code = Plex_GetPinCode(); Add("Code", code.empty() ? "Asking..." : code.c_str(), - "On any device go to plex.tv/link and enter the code. A cancels.", GA_PLEX); + "On any device go to plex.tv/link and enter the code.", GA_PLEX); } else { Add("Sign In", "", "Gives you a code to enter at plex.tv/link.", GA_PLEX); } @@ -1034,9 +1066,9 @@ static void Build() Caption("Jellyfin"); if (Jellyfin_HasToken()) { std::string who = Jellyfin_GetUserName(); - Add("Signed in as", who.empty() ? "Yes" : who.c_str(), NULL); + Add("Account", who.empty() ? "Signed in" : who.c_str(), NULL); Add("Server", Jellyfin_GetServerUrl().c_str(), NULL); - Add("Sign Out", "", NULL, GA_JELLYFINOUT); + Add("Sign Out", "", "Forgets this Jellyfin sign-in on this computer.", GA_JELLYFINOUT); } else { std::string url = Jellyfin_GetServerUrl(); Add("Server", url.empty() ? "Not set" : url.c_str(), @@ -1054,13 +1086,14 @@ static void Build() if (Xcloud_HasToken()) { std::string gt = Xcloud_GetGamertag(); Add(gt.empty() ? "Account" : "Gamertag", gt.empty() ? "Signed in" : gt.c_str(), NULL); - Add("Sign Out", "", NULL, GA_XBOXOUT); + Add("Sign Out", "", "Forgets this Xbox sign-in on this computer.", GA_XBOXOUT); } else if (Xcloud_LoginInFlight()) { std::string code = Xcloud_GetUserCode(); - help = "Go to " + Xcloud_GetVerificationUri() + " and enter the code. A cancels."; + help = "Go to " + Xcloud_GetVerificationUri() + " and enter the code."; Add("Code", code.empty() ? "Asking..." : code.c_str(), help.c_str(), GA_XBOX); } else { - Add("Sign In", "", "For cloud gaming and your consoles.", GA_XBOX); + Add("Sign In", "", "Gives you a code to enter on Microsoft's site. For cloud gaming and your consoles.", + GA_XBOX); } break; } @@ -1086,12 +1119,14 @@ static void Build() break; case GV_BACKUPS: for (size_t i = 0; i < g.backups.size(); i++) - Add(g.backups[i].c_str(), "", "Pick it to see what restoring does.", GA_PICKBACKUP, (int)i); + Add(BackupLabel(g.backups[i]).c_str(), "", "Pick it to see what restoring does.", GA_PICKBACKUP, (int)i); if (g.rows.empty()) Para("No backups yet. Back Up My Settings makes one."); break; case GV_RESTORE: + Para("Puts back the games, settings, icons and playlists from this backup. What you have now is " + "saved as a backup first, so you can always go back."); Add("Restore This Backup", g.result[GA_RESTORE].c_str(), - "What you have now is backed up first, then UIX Desktop restarts with this one.", GA_RESTORE); + "UIX Desktop restarts with this backup in place.", GA_RESTORE); Add("Open Backups Folder", "", "Each backup is a plain folder you can look through.", GA_OPENBACKUPS); break; case GV_SHORTCUTS: @@ -1106,21 +1141,25 @@ static void Build() Add("F11", "Fullscreen", NULL); Add("F12", "Borderless Window", NULL); Caption("App"); - Add("Ctrl+M", "Mute", NULL); - Add("Ctrl+R", "Restart Dashboard", NULL); - Add("Ctrl+Q", "Quit", NULL); + { + // Ctrl works everywhere, but a Mac reads Cmd. + const bool mac = strcmp(Host_Name(), "macOS") == 0; + Add(mac ? "Cmd+M" : "Ctrl+M", "Mute", NULL); + Add(mac ? "Cmd+R" : "Ctrl+R", "Restart Dashboard", NULL); + Add(mac ? "Cmd+Q" : "Ctrl+Q", "Quit", NULL); + } if (g_startupMode == 2 || g_extractedMode) { Caption("Development mode"); Add("F1", "Inspector", NULL); Add("F2", "XAP Editor", NULL); - Add("F10", "Hide Menu Bar", NULL); + Add("F10", "Show or Hide Menu Bar", NULL); } break; case GV_TOOLS: Caption("Tool windows"); Add("Title Maker", "F3", "Names, icons and categories for the launcher.", GA_WINDOW, WIN_TITLEMAKER); Add("Settings Window", "F4", "Every setting, in a desktop window.", GA_WINDOW, WIN_SETTINGS); - Add("HDD Browser", "F5", "Look through the dashboard's drives.", GA_WINDOW, WIN_HDD); + Add("HDD Browser", "F5", "Look through the dashboard's drives and xemu hard disks.", GA_WINDOW, WIN_HDD); Add("Playlist Maker", "F6", "Make and edit playlists.", GA_WINDOW, WIN_PLAYLISTS); if (g_padModeEnabled) Add("Use the Tools with the Pad", "", "The tool windows' own controller menu.", GA_PADTOOLS); @@ -1131,8 +1170,8 @@ static void Build() } if (g_startupMode == 2 || g_extractedMode) { Caption("Development mode"); - Add("Inspector", "F1", "Development mode.", GA_WINDOW, WIN_INSPECTOR); - Add("XAP Editor", "F2", "Development mode.", GA_WINDOW, WIN_XAPEDITOR); + Add("Inspector", "F1", "Click a part of the scene to see its nodes and values.", GA_WINDOW, WIN_INSPECTOR); + Add("XAP Editor", "F2", "Edit the dashboard's scene files and see changes live.", GA_WINDOW, WIN_XAPEDITOR); } break; case GV_EXIT: @@ -1175,7 +1214,11 @@ static const char* ViewTitle() case GV_APPS: return "Linux Apps"; case GV_COLLECTIONS: return "Collections"; case GV_BACKUPS: return "Restore a Backup"; - case GV_RESTORE: return g.backup.c_str(); + case GV_RESTORE: { + static std::string s_title; + s_title = BackupLabel(g.backup); + return s_title.c_str(); + } case GV_POWER: return g.power == HOST_POWER_RESTART ? "Restart" : "Shut Down"; case GV_GAMECOLL: return "Collections"; case GV_GAMES: { @@ -1328,10 +1371,12 @@ static size_t NextChar(const std::string& t, size_t i) bool Guide_Typing() { return g.open && g.edit.on; } -static void EditOpen(int what, int arg, const char* title, const std::string& text, size_t limit, bool secret) +static void EditOpen(int what, int arg, const char* title, const std::string& text, size_t limit, bool secret, + const char* hint = NULL) { Editor& e = g.edit; e.on = true; + e.hint = hint ? hint : ""; e.what = what; e.arg = arg; e.title = title; @@ -1595,7 +1640,8 @@ static void Select() break; case GA_TEXT: { const SettingDef& d = DesktopSettings_Table().defs[r.arg]; - EditOpen(ED_SETTING, r.arg, d.label, (const char*)d.ptr, (size_t)d.size - 1, (d.flags & SF_SECRET) != 0); + EditOpen(ED_SETTING, r.arg, d.label, (const char*)d.ptr, (size_t)d.size - 1, (d.flags & SF_SECRET) != 0, + r.help.c_str()); break; } case GA_FINDEMU: { @@ -1614,20 +1660,20 @@ static void Select() VirtualGame* vg = PickedGame(); if (!vg) break; const char* text = r.arg == 0 ? vg->args : r.arg == 1 ? vg->workdir : vg->env; - EditOpen(ED_GAMEOPT, r.arg, r.label.c_str(), text, sizeof(vg->args) - 1, false); + EditOpen(ED_GAMEOPT, r.arg, r.label.c_str(), text, sizeof(vg->args) - 1, false, r.help.c_str()); break; } case GA_NAME: EditOpen(ED_NAME, 0, "Name", g.pickedName, 100, false); break; case GA_JELLYFINURL: - EditOpen(ED_JELLYFIN, 0, "Jellyfin Server", Jellyfin_GetServerUrl(), 500, false); + EditOpen(ED_JELLYFIN, 0, "Jellyfin Server", Jellyfin_GetServerUrl(), 500, false, "Like 192.168.1.20:8096"); break; case GA_SEARCH: - EditOpen(ED_SEARCH, 0, "Search by Name", g.search, 60, false); + EditOpen(ED_SEARCH, 0, "Search by Name", g.search, 60, false, "Part of a name, like halo"); break; case GA_NEWCOLL: - EditOpen(ED_COLLECTION, 0, "New Collection", "", VGAMES_COLLECTION_NAME_MAX, false); + EditOpen(ED_COLLECTION, 0, "New Collection", "", VGAMES_COLLECTION_NAME_MAX, false, "Its name, like Weekend"); break; case GA_PADTOOLS: Close(); @@ -1678,7 +1724,7 @@ static void Select() } case GA_ESDE: if (!s_esdePath[0]) { - g.result[GA_ESDE] = "Set its folder first"; + g.result[GA_ESDE] = "Set its folder in Settings"; Refuse(); } else { EsdeVGames_Sync(s_esdePath); @@ -2544,7 +2590,8 @@ static void DrawEditor() const float ty = FIELD_Y + (FIELD_H - size) * 0.5f; if (shown.empty()) ui_overlay_text(UI_FONT_REGULAR, 11.0f, left + pad + 4, FIELD_Y + (FIELD_H - 11.0f) * 0.5f, UI_ALIGN_LEFT, - ui_style_color(UI_COLOR_TEXT_DIM), "Empty"); + ui_style_color(UI_COLOR_TEXT_DIM), + e.hint.empty() ? "Empty" : Fit(UI_FONT_REGULAR, 11.0f, e.hint, room - 8).c_str()); else ui_overlay_text(UI_FONT_BOLD, size, left + pad, ty, UI_ALIGN_LEFT, 0xFFFFFFFF, Fit(UI_FONT_BOLD, size, lead + shown.substr(from), room).c_str()); From 4b9dcec40b365dc02717cf33b859feb9e45cf6ae Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:57:30 -0500 Subject: [PATCH 08/14] Tidied up the local movie and TV library The library only scanned when you set a folder, so new files never showed up and a hand-set folder listed nothing. It now rescans in the background once per run. Movies and shows are sorted, scene names like The.Matrix.1999.1080p read as The Matrix (1999), episodes named Show.S01E01.720p show as Episode 1 instead of the file name, and the meta panel puts one fact per line. --- theseus/desktop/media_db.cpp | 270 +++++++++++++++++++++++++---------- 1 file changed, 194 insertions(+), 76 deletions(-) diff --git a/theseus/desktop/media_db.cpp b/theseus/desktop/media_db.cpp index fada735..64b83db 100644 --- a/theseus/desktop/media_db.cpp +++ b/theseus/desktop/media_db.cpp @@ -131,13 +131,144 @@ static int ParseYearFromTitle(const std::string& s) return y; } +// Season and episode out of a bare filename. Takes S01E02, s1e2 and 1x02 +// anywhere in the name, as long as it starts on a word break. +static bool ParseSeasonEpisode(const char* name, int& season, int& episode, const char** end = NULL) +{ + for (const char* p = name; *p; p++) + { + if (p != name && isalnum((unsigned char)p[-1])) continue; + const char* q = p; + bool sForm = (*q == 'S' || *q == 's'); + if (sForm) q++; + const char* d = q; + int s = 0; + while (isdigit((unsigned char)*q)) s = s * 10 + (*q++ - '0'); + int sDigits = (int)(q - d); + if (sDigits < 1 || sDigits > 2) continue; + if (sForm ? (*q != 'E' && *q != 'e') : (*q != 'x' && *q != 'X')) continue; + q++; + d = q; + int e = 0; + while (isdigit((unsigned char)*q)) e = e * 10 + (*q++ - '0'); + int eDigits = (int)(q - d); + if (eDigits < 1 || eDigits > 3 || (!sForm && eDigits < 2)) continue; + season = s; episode = e; + if (end) *end = q; + return true; + } + return false; +} + +// Scene names ("Some.Movie.2021.1080p.BluRay") read better as words. +static void DotsToSpaces(std::string& s) +{ + if (s.find(' ') != std::string::npos) return; + for (size_t i = 0; i < s.size(); i++) + if (s[i] == '.' || s[i] == '_') s[i] = ' '; +} + +static void TrimEnds(std::string& s) +{ + const char* junk = " -_.(["; + size_t a = s.find_first_not_of(junk); + size_t b = s.find_last_not_of(junk); + s = (a == std::string::npos) ? std::string() : s.substr(a, b - a + 1); +} + +// Cuts at the first word that's a release tag, like 720p, WEB-DL or x264. +static void CutReleaseTags(std::string& s) +{ + static const char* kTags[] = { "480p", "576p", "720p", "1080p", "2160p", "4k", "uhd", + "web", "web-dl", "webdl", "webrip", "bluray", "blu-ray", "bdrip", "brrip", "hdtv", + "dvdrip", "hdrip", "x264", "x265", "h264", "h265", "hevc", "10bit", "remux", + "proper", "repack", "amzn", "nf", "dsnp", "hulu", NULL }; + size_t i = 0; + while (i < s.size()) + { + size_t j = s.find(' ', i); + if (j == std::string::npos) j = s.size(); + std::string w = s.substr(i, j - i); + for (size_t k = 0; k < w.size(); k++) w[k] = (char)tolower((unsigned char)w[k]); + while (!w.empty() && (w[0] == '[' || w[0] == '(')) w.erase(0, 1); + while (!w.empty() && (w.back() == ']' || w.back() == ')')) w.pop_back(); + for (int t = 0; kTags[t]; t++) + if (w == kTags[t]) { s.erase(i); TrimEnds(s); return; } + i = j + 1; + } +} + +// "The.Matrix.1999.1080p.BluRay" -> "The Matrix (1999)". Names that already +// read "Title (1999)" are left alone. +static std::string CleanMovieName(const std::string& raw) +{ + std::string s = raw; + DotsToSpaces(s); + // The last standalone year that isn't the first word, so "2012 (2009)" works. + size_t yearAt = std::string::npos; + for (size_t i = 1; i + 4 <= s.size(); i++) + { + if (s[i - 1] != ' ' && s[i - 1] != '(' && s[i - 1] != '[') continue; + if (i + 4 < s.size() && s[i + 4] != ' ' && s[i + 4] != ')' && s[i + 4] != ']') continue; + bool digits = true; + for (int k = 0; k < 4; k++) if (!isdigit((unsigned char)s[i + k])) digits = false; + if (!digits) continue; + int y = atoi(s.substr(i, 4).c_str()); + if (y >= 1900 && y <= 2099) yearAt = i; + } + if (yearAt == std::string::npos) + { + CutReleaseTags(s); + return s.empty() ? raw : s; + } + std::string title = s.substr(0, yearAt); + TrimEnds(title); + if (title.empty()) return raw; + return title + " (" + s.substr(yearAt, 4) + ")"; +} + +// Leading "The", "A" and "An" don't count when sorting, same as most players. +static const char* SortKey(const std::string& t) +{ + const char* p = t.c_str(); + if (strncasecmp(p, "the ", 4) == 0) return p + 4; + if (strncasecmp(p, "an ", 3) == 0) return p + 3; + if (strncasecmp(p, "a ", 2) == 0) return p + 2; + return p; +} + +// "Show.S01E01.Pilot.720p.mkv" -> "Pilot", or "Episode 1" when there's no +// name after the number. Anything unnumbered just loses its extension. +static std::string SceneEpisodeTitle(const std::string& filename, int& seasonOut, int& episodeOut) +{ + std::string base = filename; + size_t dot = base.find_last_of('.'); + if (dot != std::string::npos) base.erase(dot); + int season = 0, episode = 0; + const char* end = NULL; + if (!ParseSeasonEpisode(base.c_str(), season, episode, &end)) + { + DotsToSpaces(base); + return base; + } + seasonOut = season; episodeOut = episode; + std::string rest = end; + DotsToSpaces(rest); + CutReleaseTags(rest); + TrimEnds(rest); + if (!rest.empty()) return rest; + char buf[32]; + snprintf(buf, sizeof(buf), "Episode %d", episode); + return buf; +} + static std::string ParseEpisodeTitle(const std::string& filename, int& seasonOut, int& episodeOut) { // "Show - S01E02 - Title WEBDL-1080p.mkv" -> "Title", season=1, episode=2. seasonOut = 0; episodeOut = 0; size_t s = filename.find(" - S"); - if (s == std::string::npos) return filename; - if (s + 8 >= filename.size()) return filename; + if (s == std::string::npos || s + 8 >= filename.size()) + return SceneEpisodeTitle(filename, seasonOut, episodeOut); // Parse SxxExx size_t p = s + 4; @@ -147,7 +278,8 @@ static std::string ParseEpisodeTitle(const std::string& filename, int& seasonOut season = season * 10 + (filename[p] - '0'); p++; } - if (p >= filename.size() || (filename[p] != 'E' && filename[p] != 'e')) return filename; + if (p >= filename.size() || (filename[p] != 'E' && filename[p] != 'e')) + return SceneEpisodeTitle(filename, seasonOut, episodeOut); p++; int episode = 0; while (p < filename.size() && filename[p] >= '0' && filename[p] <= '9') @@ -158,7 +290,7 @@ static std::string ParseEpisodeTitle(const std::string& filename, int& seasonOut // Find " - " after SxxExx size_t sep = filename.find(" - ", p); - if (sep == std::string::npos) return filename; + if (sep == std::string::npos) return SceneEpisodeTitle(filename, seasonOut, episodeOut); size_t titleStart = sep + 3; // Strip trailing quality tag and extension. Split at first " WEBDL"/"Bluray"/"BDRip"/"HDTV"/etc., or before final '.'. @@ -184,34 +316,6 @@ static std::string ParseEpisodeTitle(const std::string& filename, int& seasonOut return rest; } -// Season and episode out of a bare filename, for ordering only. Takes S01E02, -// s1e2 and 1x02 anywhere in the name, as long as it starts on a word break. -static bool ParseSeasonEpisode(const char* name, int& season, int& episode) -{ - for (const char* p = name; *p; p++) - { - if (p != name && isalnum((unsigned char)p[-1])) continue; - const char* q = p; - bool sForm = (*q == 'S' || *q == 's'); - if (sForm) q++; - const char* d = q; - int s = 0; - while (isdigit((unsigned char)*q)) s = s * 10 + (*q++ - '0'); - int sDigits = (int)(q - d); - if (sDigits < 1 || sDigits > 2) continue; - if (sForm ? (*q != 'E' && *q != 'e') : (*q != 'x' && *q != 'X')) continue; - q++; - d = q; - int e = 0; - while (isdigit((unsigned char)*q)) e = e * 10 + (*q++ - '0'); - int eDigits = (int)(q - d); - if (eDigits < 1 || eDigits > 3 || (!sForm && eDigits < 2)) continue; - season = s; episode = e; - return true; - } - return false; -} - // Filename compare where digit runs count as numbers, so "Ep 2" lands before "Ep 10". static int NaturalCompare(const char* a, const char* b) { @@ -308,7 +412,7 @@ static std::string FindFirstVideoFile(const std::string& dir) static void AddMovie(std::vector& out, const std::string& title, const std::string& path) { MovieRec m; - m.title = title; + m.title = CleanMovieName(title); m.path = path; m.year = ParseYearFromTitle(m.title); out.push_back(m); @@ -363,6 +467,9 @@ static void ScanMoviesInto(std::vector& out) } } Host_CloseDir(d); + std::stable_sort(out.begin(), out.end(), [](const MovieRec& a, const MovieRec& b) { + return NaturalCompare(SortKey(a.title), SortKey(b.title)) < 0; + }); printf("[MediaDB] Movie scan done: %d total\n", (int)out.size()); } @@ -397,18 +504,13 @@ static void ScanShowSeasons(ShowRec& show) } Host_CloseDir(sd); - // Sort episodes by episode number. - for (size_t i = 1; i < s.episodes.size(); i++) - for (size_t j = i; j > 0 && s.episodes[j].episode < s.episodes[j - 1].episode; j--) - { - EpisodeRec t = s.episodes[j]; - s.episodes[j] = s.episodes[j - 1]; - s.episodes[j - 1] = t; - } - + SortEpisodes(s.episodes); show.seasons.push_back(s); } Host_CloseDir(d); + std::sort(show.seasons.begin(), show.seasons.end(), [](const SeasonRec& a, const SeasonRec& b) { + return NaturalCompare(a.name.c_str(), b.name.c_str()) < 0; + }); // Episodes sitting straight in the show folder, no Season dirs. Common // enough that dropping the show entirely just looks like nothing loaded. @@ -484,6 +586,9 @@ static void ScanShowsInto(std::vector& out) } } Host_CloseDir(d); + std::stable_sort(out.begin(), out.end(), [](const ShowRec& a, const ShowRec& b) { + return NaturalCompare(SortKey(a.title), SortKey(b.title)) < 0; + }); printf("[MediaDB] Show scan done: %d total\n", (int)out.size()); } @@ -674,6 +779,28 @@ static bool LoadCache() // Node binding --------------------------------------------------------------- +// One fact per line so the meta panel never wraps mid phrase. +static std::string MovieMeta(const MovieRec& m) +{ + char buf[64]; + if (m.year > 0) snprintf(buf, sizeof(buf), "Movie\n%d", m.year); + else snprintf(buf, sizeof(buf), "Movie"); + return buf; +} + +static std::string ShowMeta(const ShowRec& sh) +{ + int totalEps = 0; + for (size_t s = 0; s < sh.seasons.size(); s++) + totalEps += (int)sh.seasons[s].episodes.size(); + int nSeasons = (int)sh.seasons.size(); + char buf[96]; + snprintf(buf, sizeof(buf), "TV Show\n%d %s\n%d %s", + nSeasons, nSeasons == 1 ? "Season" : "Seasons", + totalEps, totalEps == 1 ? "Episode" : "Episodes"); + return buf; +} + extern "C" void MediaDB_ScanAndCache(); class CMediaCollection : public CNode @@ -682,11 +809,14 @@ class CMediaCollection : public CNode CMediaCollection() : m_curShowIdx(-1), m_curSeasonIdx(-1), m_curSelKind(0), m_curSelIdx(-1) { - // Try cache only. Scanning the filesystem can take seconds for - // large libraries on network mounts; require an explicit - // RefreshLibrary() call from XAP (or out-of-band first run) so - // startup never stalls. + // The cache shows right away, then one background rescan per run + // picks up files added since. Known TMDB matches carry forward. LoadCache(); + static bool s_rescanned = false; + if (!s_rescanned && (g_moviesRoot[0] || g_tvRoot[0])) { + s_rescanned = true; + MediaDB_ScanAndCache(); + } } DECLARE_NODE(CMediaCollection, CNode) @@ -718,12 +848,7 @@ class CMediaCollection : public CNode { std::lock_guard lock(g_dbMutex); if (i < 0 || i >= (int)g_movies.size()) return new CStrObject; - char buf[64]; - if (g_movies[i].year > 0) - sprintf(buf, "%d Movie", g_movies[i].year); - else - sprintf(buf, "Movie"); - return new CStrObject(_T(buf)); + return new CStrObject(_T(MovieMeta(g_movies[i]).c_str())); } CStrObject* GetMoviePath(int i) { @@ -746,15 +871,7 @@ class CMediaCollection : public CNode { std::lock_guard lock(g_dbMutex); if (i < 0 || i >= (int)g_shows.size()) return new CStrObject; - int totalEps = 0; - for (size_t s = 0; s < g_shows[i].seasons.size(); s++) - totalEps += (int)g_shows[i].seasons[s].episodes.size(); - char buf[96]; - int nSeasons = (int)g_shows[i].seasons.size(); - sprintf(buf, "TV %d %s %d %s", - nSeasons, nSeasons == 1 ? "Season" : "Seasons", - totalEps, totalEps == 1 ? "Episode" : "Episodes"); - return new CStrObject(_T(buf)); + return new CStrObject(_T(ShowMeta(g_shows[i]).c_str())); } void SetCurrentShow(int i) @@ -803,6 +920,19 @@ class CMediaCollection : public CNode return new CStrObject(_T(eps[epIdx].path.c_str())); } + // What an empty Movies (0) or TV Shows (1) list says. "" once it has rows. + CStrObject* GetStatus(int kind) + { + { + std::lock_guard lock(g_dbMutex); + if (!(kind == 1 ? g_shows.empty() : g_movies.empty())) return new CStrObject; + } + const char* root = kind == 1 ? kTvRoot : kMoviesRoot; + if (!root[0]) return new CStrObject(_T(kind == 1 ? "Pick a TV Shows folder in Settings" : "Pick a Movies folder in Settings")); + if (g_scanRunning.load()) return new CStrObject(_T("Looking for videos...")); + return new CStrObject(_T(kind == 1 ? "No shows found" : "No movies found")); + } + void RefreshLibrary() { MediaDB_ScanAndCache(); @@ -913,23 +1043,10 @@ class CMediaCollection : public CNode std::lock_guard lock(g_dbMutex); if (m_curSelKind == 0) { if (m_curSelIdx < 0 || m_curSelIdx >= (int)g_movies.size()) return new CStrObject; - char buf[64]; - if (g_movies[m_curSelIdx].year > 0) - sprintf(buf, "%d Movie", g_movies[m_curSelIdx].year); - else - sprintf(buf, "Movie"); - return new CStrObject(_T(buf)); + return new CStrObject(_T(MovieMeta(g_movies[m_curSelIdx]).c_str())); } if (m_curSelIdx < 0 || m_curSelIdx >= (int)g_shows.size()) return new CStrObject; - int totalEps = 0; - for (size_t s = 0; s < g_shows[m_curSelIdx].seasons.size(); s++) - totalEps += (int)g_shows[m_curSelIdx].seasons[s].episodes.size(); - char buf[96]; - int nSeasons = (int)g_shows[m_curSelIdx].seasons.size(); - sprintf(buf, "TV %d %s %d %s", - nSeasons, nSeasons == 1 ? "Season" : "Seasons", - totalEps, totalEps == 1 ? "Episode" : "Episodes"); - return new CStrObject(_T(buf)); + return new CStrObject(_T(ShowMeta(g_shows[m_curSelIdx]).c_str())); } CStrObject* GetSelectedPlot() { @@ -1426,6 +1543,7 @@ START_NODE_FUN(CMediaCollection, CNode) NODE_FUN_SV(GetSelectedPlot) NODE_FUN_VV(PlaySelected) NODE_FUN_IV(ConsumePlaybackExited) + NODE_FUN_SI(GetStatus) END_NODE_FUN() From a4ccfe71a74b24eee486318f5779368d3fe2781f Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:57:37 -0500 Subject: [PATCH 09/14] Videos go back to the dashboard when they finish The player keeps the file open at the end, so it never saw the end of the file and sat on the last frame until you pressed B. It now watches for that, which also lets playlists move on to the next item. --- theseus/desktop/media_player.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/theseus/desktop/media_player.cpp b/theseus/desktop/media_player.cpp index 882ff58..3c24549 100644 --- a/theseus/desktop/media_player.cpp +++ b/theseus/desktop/media_player.cpp @@ -144,6 +144,7 @@ bool MediaPlayer_Init() { mpv_observe_property(s_mpv, 0, "audio-params/channel-count", MPV_FORMAT_INT64); mpv_observe_property(s_mpv, 0, "audio-codec-name", MPV_FORMAT_STRING); mpv_observe_property(s_mpv, 0, "sid", MPV_FORMAT_INT64); + mpv_observe_property(s_mpv, 0, "eof-reached", MPV_FORMAT_FLAG); s_state = MP_IDLE; fprintf(stderr, "[MediaPlayer] Initialized (libmpv software render + bgfx upload)\n"); @@ -407,6 +408,11 @@ void MediaPlayer_Update() { } else if (strcmp(prop->name, "sid") == 0 && prop->format == MPV_FORMAT_INT64) s_subTrack = (int)*(int64_t*)prop->data; + // keep-open parks on the last frame instead of ending the + // file, so this is the only sign a video finished. + else if (strcmp(prop->name, "eof-reached") == 0 && prop->format == MPV_FORMAT_FLAG + && *(int*)prop->data && s_state == MP_PLAYING) + s_state = MP_STOPPED; break; } case MPV_EVENT_END_FILE: { From c0269491470c99f283bdee6f0a44037827f7dbf4 Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:57:37 -0500 Subject: [PATCH 10/14] Fixed Media getting stuck after Plex or Jellyfin Backing out of Plex or Jellyfin skipped the Media list, and after that the Media button did nothing. B now lands on the Media list and the scenes reopen. Also gave empty lists a line saying why, kept the header from running into the count, only show the scroll arrows when there's more, and trimmed the movie menu to Play and Info since the other three did nothing. --- Data/Xips/default.xip | Bin 1696269 -> 1700991 bytes theseus/desktop/desktop_nodes.cpp | 4 +- xips-source/default-desktop/Jellyfin.xap | 12 +- xips-source/default-desktop/MediaPlayer.xap | 134 +++++++++++++++++--- xips-source/default-desktop/Plex.xap | 12 +- xips-source/default-desktop/default.xap | 36 ++++++ xips-source/jellyfin/jellyfin.xap | 12 +- xips-source/mediaplayer/mediaplayer.xap | 134 +++++++++++++++++--- xips-source/plex/plex.xap | 12 +- 9 files changed, 300 insertions(+), 56 deletions(-) diff --git a/Data/Xips/default.xip b/Data/Xips/default.xip index ef5d185a7154ce3e7bb1274ca12c85a375106463..aa18e3725a8fb43013ad52eae0611c6ec593c98d 100644 GIT binary patch delta 4374 zcmcgvZERE58FuK2gY7_^aGj73l2fY?n*=9;foMb6Op*p?aU9|d)~=!4*vIx&oO{i^ z*90#^*~Hqcn&^hmIBTVqNzcUH@g@Q2V7dCX)mH<~};Te%JKhMN{r`>}6zn z{Kb;o{56-^^vmVk)D&A=W-_fsCIH}{nB8VF9VyAr6Xh${kK0WTK}n_Q$Y6ec zFHkvcTK<0i!o?4&03Z*z_~8cA8Js_$R0^iqpXKL|%?YN{yYlndTY`xe%m-Q>rWd}M zU%&dgV}*cMFWPHOPuJ%+wEgAeaLLSY2^(u*Jdz$RK~H!i$3zv&eiD|%0a4Stm87h9 zV&l`+hC^(QS9;Bt^w4VQ)1&86z?lu@(|#9Eyo@lxSGetqfb^ z*z~P`3bk8dl}se`6pl*(sEH}9)qur{4Er@4kyKbvl}W113Y*fe?n7$HZcCAP8R@$4 zwvJA##lR2hqMp<;EAZ8YozC>e9`x!X1ARp2A{bj-ZtIlQB1N!k%qMq?I*BT3>Yzj> z@z=1+xX7oI32q0x7q`3JR*OX?dQz1ElD_gJdb~V?)b57ssTe>T=}Q*{8?ER=f|bkR z>VPHsp8#r@&K@0!Ng7VX#S~W^p1C2MfRNoWsN~i)oFY1`ov>Q1k)#~bC9n?{X@nft zU2-efi?reiQBLL5k#ScS?kJSD13U4i7Pd8ii;P>~trPyU!}NR~nxRK7RH8O7_|kA6 zI7y4Cl042`&Baa1VWRSBD5+|S>ao(Vj-t&?>^8YOsdD==vw_|Hq8{^1h{s*+t@Jyi z$iY-x;iE2G?2+`Y{pkHtdhS=Kbc0J`dbGRo7VOF#qsncenZA5mIAtqvBwfBOxag;E zR#wnU{m4!K_(O9kP5fH;m~N9$8U4p?p_4XB$V}h;pRkU8Z;jbb1J6~}(Q_B=R{G&Z zyJgP_s|5^ffhhMYD#4-(ai@W~;wgw{DNdNeDrwg61Y6b>2ya!1$KeU|_aC*_H?TO% z1kC_MbkJC5Q3LLOkD#VCE*IV8Lz_qOo=lSEf(y3ryZe(6@hquAnP9|{%;zy8g4H{* z)8E_U^Wrw_@pznA1@}lY2*Z!C>;z%vzJzM1JcztI3W6l(6#lLiJG;Fjy?ueHE)@)`NAxA^`DJtMLjipw zy?zGBz70SQ2TA(+vbnD3VX|Z|W5=`4Ihhz+WMeUPPiS=(6H-^Pb34zzh=yt7O}iyM zd;q;uT3O62d+00Ig?hSs29>8b9YWJ(J{}BSV8$_3R8tu$1!qSjS<+(ph%~qp2qc;C z;9<_c2K`Dv(F)N#bZ)+?y3w-}?8$kqSlGRgUUaF_Q6IDz8}6gMN3;6mDuSD_V{zJI z*jJd@j4G*j6xGpNLue#@<1pG<-VNCmU>U`XibXk$eS=R1Kv1kH6GV?maQkW7gmnH&5@C4uZ73&xa5 zMoAo>1!>4LNG6{hkYv));W;L0(il)h;pe_n^y8n{AGNYAU07F>B>k^(^hViNKvFN0 za}p@VD0~@Fl?0Jl{nW5VL`{Kb6-bra1_FW=5ipy_sAAC|iIb2{!e5lYxS0|#Mc>kp zi+abAgMQ+xveBt`fF{2?fGlU)%ggAzhSouC$s`Bg++Z>C8T5P5F)L3DM&~Ee6*@Xo zHVq0eZ$80|IT=&H4vDy;GXfLAnwlm?!Q#NBp;(4HGo6B@gUWG*DUmC0%+3a7$q~h< z(yV=uUwC#X01wf!TE7pSyos|WUoCmQ8of0@q&!`+>H3YI!(mXsQBS|P83GgJI zRODtId=A`gu`n&!TiVo%8oP(!DX)MJ3h!|ibbMDRsTUSlcF4n8GrlVjaXH(Z?pBQ>DgHO+Tq|xSSIqkKgbs zYeYOTB1L1m5&K?1=zvi{dkBOuXtJI4AGLIL3U!riPv4wE zSFBVSt+JOF#sdAuWz>+q`#hRHzyfY4PL6XP=_m1c3doVM1TWQ?M-K!Vkx8B|Q_WDj z8C5b&NE?XExB`VWY-Q0a$03ce7!?7BktcJDO4OtbZNLC*%W@M$L?kYfC}bo^4nFTw zMid;DR7kye%EKGo=(A%+d%^@@he^0IyTGIluJS&sMBy4uT|=YwtDt4rqmzDq9(|5B zy^E@7?L0cX(FoT2Z>N8_hN{mlAS?a-+t3GnVIJ)$IYE!kqZ@UAUL;ZuymbL>H^9$b zM{n0>!Hc%DOrT$1Ku+peKdC2{ns&ABOB>J&~>?uo5xi1b(4pG2u6i9M@X@}RKeJgzHn0b`M%GtId&M$aew6guGr;r$+`C}7@iLrWz@~uEC=F@4ikTld%h1Azd5 A?f?J) delta 1304 zcmb7?e{54#6vuD3^IBH6_N~3o*%h|uvLT7a5_OtLhScp1tNk(BuFl~P#&|9@t}|U5 zHQ=UBHz&-fOpXCH{3G}e_y>?1OiV@~{4qoJk8{dD9RcZBVPS~|6Ef>5Gkc)@$NTb0 z&iCH?J?Gr}Zho$3>}-#%!`HT9qJ%MpzCh+v+hc>%QMNMTW56E$$h4xrsxq@vnH9-m zH_eQ#0!9gLk67Ny*mjelUoO9Uy+>w^qlSOa4Vi5Z8alVBa*$=dFbYo2I4FUUa5Cd$ z`&7g5BIE4jQA0b9arRrIp>JN|?9v_jf=gke?;GpgUn_St*nL=bu}-(K;fK>hVbe(1 zRG@??6=4%R;l=mP@iijc3`vvts|601;_P`Y;lvO~xaAp0VCYY$Bwl?MG7@g8=2o1Y z;Sb{>4XW|Uc4(?e1oWNpE?-LTZSG4aQtAV0o!ab;YFk2KpBBMI-OO=T1CBH8;I?Qj zKCkLgaj_lhtBY9!q1c_aa_ovhog?s%FB(%LPluk1)NRDmH_WcJYLi+l$?_h2cYP(t z{jE?{y31OIP3>@>Otstm-skTJ-ov1zdUs zI&lM3mWkaR@S`LKUxGmk+73cgboRjg<(N#-)m-QY9k2Go8r+rw`*Ji~h%gP+VmJ*) zEO>Dk6ny6csFAfcUnJC`-R@t1tzSpa5Y$?lwV*~PLiRWnBeIuUKcRsZ5VuMpy z$6;VA+H+vR^c9HWkt{WL>pHmc?JUhLEzltz%)$%!`(-Uay$&{f{g&ikwjG=U zKdzex+vn>gJ9f{LA-@1JYFFV*!Bvlk=3x@+ufgMmbPoI}2YZ$mzP(1pzR%F+&2z9# zytx2N-(d2nOd%NNZ zwO3E1#j(qLcL^TP$}Y@*rbyV(0YNdA<)_yDuNs1Cod0inr1Z67zgvm_yT-_l8ilxr Os3PtaJ8E2OfBqZcrIUUD diff --git a/theseus/desktop/desktop_nodes.cpp b/theseus/desktop/desktop_nodes.cpp index d45d8fc..9c53055 100644 --- a/theseus/desktop/desktop_nodes.cpp +++ b/theseus/desktop/desktop_nodes.cpp @@ -4131,7 +4131,7 @@ class CPlexLibrary : public CNode std::string StatusFor(int view) { - if (!Plex_HasToken()) return "Sign in to Plex in Settings"; + if (!Plex_HasToken()) return "Sign in from Settings"; if (!Plex_SyncReady()) return "Loading..."; if (view == 0) { if (Plex_GetActiveServerUri().empty()) return Unreachable(); @@ -4883,7 +4883,7 @@ class CJellyfinLibrary : public CNode std::string StatusFor(int view) { - if (!Jellyfin_HasToken()) return "Sign in to Jellyfin in Settings"; + if (!Jellyfin_HasToken()) return "Sign in from Settings"; if (!Jellyfin_SyncReady()) return "Loading..."; if (view == 0) { if (Jellyfin_SyncFailed()) return Unreachable(); diff --git a/xips-source/default-desktop/Jellyfin.xap b/xips-source/default-desktop/Jellyfin.xap index 047519d..b1f8482 100644 --- a/xips-source/default-desktop/Jellyfin.xap +++ b/xips-source/default-desktop/Jellyfin.xap @@ -165,8 +165,8 @@ function UpdateJellyfinList() c.MenuButtons.children[0].children[0].children[0].appearance.material.name = "GameHilite"; c.MenuButtons.children[0].children[0].children[0].appearance.texture.url = "outline.tga"; c.MenuButtons.children[0].children[1].children[0].appearance.name = "NavType"; - c.MenuButtons.children[0].children[1].children[0].geometry.scrollRate = 0; - c.MenuButtons.children[0].children[1].children[0].geometry.scrollDelay = 0; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollRate = 0.1; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollDelay = 1; } else { @@ -174,6 +174,10 @@ function UpdateJellyfinList() } } + // More arrows only while there's more to scroll to. + c.MU_morearrow_up.visible = (nJfScroll > 0); + c.MU_morearrow_down.visible = ((nJfScroll + nJfVisible) < nJfCount); + c.MediaHeaderText.text = GetHeaderText(); c.MusicCountText.text = GetCountText(); if (status != "") @@ -307,7 +311,7 @@ function PlayCurrentEpisode() } -// B: pop to parent view (restoring its cursor) or out to main menu. +// B: pop to parent view (restoring its cursor) or back to the Media list. function GoBackOne() { if (nJfView == 3) @@ -343,7 +347,7 @@ function GoBackOne() } else { - theMainMenu.GoBackTo(); + BackToMedia(); } } diff --git a/xips-source/default-desktop/MediaPlayer.xap b/xips-source/default-desktop/MediaPlayer.xap index d3c6e6e..2b4610c 100644 --- a/xips-source/default-desktop/MediaPlayer.xap +++ b/xips-source/default-desktop/MediaPlayer.xap @@ -37,6 +37,8 @@ var gSelectedIndex; // absolute index into MediaCollection movies or show // list switches to playlist items. Picking an item plays from that index. var bInPlaylistItemView; var nPlaylistCursorBackup; // restore the cursor when backing out of items +var nMediaLastCount; // count last drawn; the behavior redraws when a scan changes it +var sMediaStatus; // what an empty list says, drawn on its first row function initialize() @@ -56,6 +58,8 @@ function initialize() bInPlaylistItemView = 0; nPlaylistCursorBackup = 0; + nMediaLastCount = -1; + sMediaStatus = ""; gSelectedTitle = ""; gSelectedPlot = ""; @@ -105,6 +109,28 @@ function GetActiveTitle(absIdx) } +function GetMediaStatus() +{ + if (bInCategoryView | (nMediaItemCount > 0)) + return ""; + if (nCurCategory == 0) + return theMediaCollection.GetStatus(0); + if (nCurCategory == 1) + return theMediaCollection.GetStatus(1); + if (bInPlaylistItemView) + return "This playlist is empty"; + return "No playlists yet"; +} + + +function CountText(n, one, many) +{ + if (n == 1) + return "1 " + one; + return n + " " + many; +} + + function StartMediaLevel() { UpdateMediaList(); @@ -114,6 +140,10 @@ function StartMediaLevel() function UpdateMediaList() { var c = theMediaMenu.children[0].children[0]; + // A rescan can shrink the list under the cursor. + if (nCurMediaItem >= nMediaItemCount) + nCurMediaItem = Math.max(0, nMediaItemCount - 1); + sMediaStatus = GetMediaStatus(); // Keep cursor inside the visible window: if it falls below scroll, raise // scroll; if it exceeds the bottom, drop scroll. @@ -147,40 +177,54 @@ function UpdateMediaList() c.MenuButtons.children[i].children[1].children[0].geometry.scrollDelay = 0; } } + else if ((i == 0) & (sMediaStatus != "")) + { + // Nothing to list: the first row says why. + c.MenuButtons.children[0].visible = true; + c.MenuButtons.children[0].children[1].children[0].geometry.text = sMediaStatus; + c.MenuButtons.children[0].children[0].children[0].appearance.material.name = "GameHilite"; + c.MenuButtons.children[0].children[0].children[0].appearance.texture.url = "outline.tga"; + c.MenuButtons.children[0].children[1].children[0].appearance.name = "NavType"; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollRate = 0.1; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollDelay = 1; + } else { c.MenuButtons.children[i].visible = false; } } + // More arrows only while there's more to scroll to. + c.MU_morearrow_up.visible = (nMediaListScroll > 0); + c.MU_morearrow_down.visible = ((nMediaListScroll + nMediaListVisible) < nMediaItemCount); + + // Just the category in the header; "MEDIA / ..." ran into the count. if (bInCategoryView) { c.MediaHeaderText.text = "MEDIA"; - c.MusicCountText.text = nMediaItemCount + " CATEGORIES"; + c.MusicCountText.text = CountText(nMediaItemCount, "CATEGORY", "CATEGORIES"); } else if (nCurCategory == 0) { - c.MediaHeaderText.text = "MEDIA / MOVIES"; - c.MusicCountText.text = nMediaItemCount + " MOVIES"; + c.MediaHeaderText.text = "MOVIES"; + c.MusicCountText.text = CountText(nMediaItemCount, "MOVIE", "MOVIES"); } else if (nCurCategory == 1) { - c.MediaHeaderText.text = "MEDIA / TV SHOWS"; - c.MusicCountText.text = nMediaItemCount + " SHOWS"; + c.MediaHeaderText.text = "TV SHOWS"; + c.MusicCountText.text = CountText(nMediaItemCount, "SHOW", "SHOWS"); } else { + c.MediaHeaderText.text = "PLAYLISTS"; if (bInPlaylistItemView) - { - c.MediaHeaderText.text = "MEDIA / PLAYLISTS"; - c.MusicCountText.text = nMediaItemCount + " ITEMS"; - } + c.MusicCountText.text = CountText(nMediaItemCount, "ITEM", "ITEMS"); else - { - c.MediaHeaderText.text = "MEDIA / PLAYLISTS"; - c.MusicCountText.text = nMediaItemCount + " PLAYLISTS"; - } + c.MusicCountText.text = CountText(nMediaItemCount, "PLAYLIST", "PLAYLISTS"); } + if (sMediaStatus != "") + c.MusicCountText.text = ""; + nMediaLastCount = nMediaItemCount; } @@ -275,6 +319,10 @@ DEF theMediaMenu Level BindActiveList(); UpdateMediaList(); } + else if (nMediaItemCount <= 0) + { + return; + } else if ((nCurCategory == 2) & (bInPlaylistItemView == 0)) { // Playlist names -> playlist items. @@ -362,6 +410,18 @@ DEF theMediaMenu Level CurrentViewpoint = theMediaViewpoint; EnableInput(true); } + + // A library scan can finish while the list is up. Redraw when it does. + behavior + { + sleep .5; + if (nMediaLastCount >= 0) + { + BindActiveList(); + if ((nMediaItemCount != nMediaLastCount) | (GetMediaStatus() != sMediaStatus)) + UpdateMediaList(); + } + } } @@ -475,11 +535,16 @@ function UpdateMediaTrackList() function ShowMediaActionPanel(bShow) { var c = theMediaActionMenu.children[0].children[0]; + // Only PLAY and INFO do something, so the other three stay hidden. c.GM_L2_menubutton_01.visible = bShow; c.GM_L2_menubutton_02.visible = bShow; - c.GM_L2_menubutton_03.visible = bShow; - c.GM_L2_menubutton_04.visible = bShow; - c.GM_L2_menubutton_05.visible = bShow; + c.GM_L2_menubutton_03.visible = false; + c.GM_L2_menubutton_04.visible = false; + c.GM_L2_menubutton_05.visible = false; + // The short two button frame, same as the music Audio CD menu. + c._button_surround.visible = (bShow == false); + c.New_Line11.visible = (bShow == false); + c._button_surround_0.visible = true; c.soundtrack_text05.visible = bShow; c.soundtrack_text06.visible = bShow; c.New_panel_meta.visible = bShow; @@ -537,10 +602,17 @@ function ShowMediaActionMenu() c.TitleText.text = gSelectedTitle.toUpperCase(); c.TitleText1.text = gSelectedTitle.toUpperCase(); + // A show's first button opens its seasons rather than playing. if (gSelectedKind == 1) + { c.TrackCountText.text = "EPISODES"; + c.GM_L2_menubutton_01.children[1].children[0].geometry.text = "EPISODES"; + } else - c.TrackCountText.text = "1 SCENE"; + { + c.TrackCountText.text = "MOVIE"; + c.GM_L2_menubutton_01.children[1].children[0].geometry.text = "PLAY"; + } c.MenuMetaText.text = gSelectedMeta + "\n\n" + gSelectedPlot; UpdateMediaActionHighlight(); @@ -610,10 +682,31 @@ function StartMediaEpisodes() } +// INFO: the whole plot in a message, which scrolls when it's long. +function ShowMediaInfo() +{ + var info = gSelectedTitle + "\n" + gSelectedMeta; + if (gSelectedPlot != "") + info = info + "\n\n" + gSelectedPlot; + else if (gSelectedKind == 0) + { + // No plot to show, so at least which file it is. The full path won't fit. + var path = theMediaCollection.GetMoviePath(gSelectedIndex); + var cut = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")) + 1; + info = info + "\n\n" + path.substr(cut, path.length() - cut); + } + TellUser(info, ""); + var mc = theMessageInline.children[0]; + mc.MessageText.height = 6.0; + mc.MessageText.scrollRate = 0.15; + mc.MessageText.scrollDelay = 2; +} + + function StartMediaActionLevel() { nCurActionItem = 0; - nActionItemCount = 5; + nActionItemCount = 2; nPlayVisible = 9; // All title/plot/meta wiring happens in ShowMediaActionMenu now, @@ -737,7 +830,10 @@ DEF theMediaActionMenu Level else theMediaCollection.PlaySelected(); } - // INFO / FAVORITE / RENAME / DELETE not yet wired. + else + { + ShowMediaInfo(); + } } else if (nMediaActionState == 1) { diff --git a/xips-source/default-desktop/Plex.xap b/xips-source/default-desktop/Plex.xap index a77b99e..5303186 100644 --- a/xips-source/default-desktop/Plex.xap +++ b/xips-source/default-desktop/Plex.xap @@ -165,8 +165,8 @@ function UpdatePlexList() c.MenuButtons.children[0].children[0].children[0].appearance.material.name = "GameHilite"; c.MenuButtons.children[0].children[0].children[0].appearance.texture.url = "outline.tga"; c.MenuButtons.children[0].children[1].children[0].appearance.name = "NavType"; - c.MenuButtons.children[0].children[1].children[0].geometry.scrollRate = 0; - c.MenuButtons.children[0].children[1].children[0].geometry.scrollDelay = 0; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollRate = 0.1; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollDelay = 1; } else { @@ -174,6 +174,10 @@ function UpdatePlexList() } } + // More arrows only while there's more to scroll to. + c.MU_morearrow_up.visible = (nPlexScroll > 0); + c.MU_morearrow_down.visible = ((nPlexScroll + nPlexVisible) < nPlexCount); + c.MediaHeaderText.text = GetHeaderText(); c.MusicCountText.text = GetCountText(); if (status != "") @@ -307,7 +311,7 @@ function PlayCurrentEpisode() } -// B: pop to parent view (restoring its cursor) or out to main menu. +// B: pop to parent view (restoring its cursor) or back to the Media list. function GoBackOne() { if (nPlexView == 3) @@ -343,7 +347,7 @@ function GoBackOne() } else { - theMainMenu.GoBackTo(); + BackToMedia(); } } diff --git a/xips-source/default-desktop/default.xap b/xips-source/default-desktop/default.xap index 94aac5d..af4891d 100644 --- a/xips-source/default-desktop/default.xap +++ b/xips-source/default-desktop/default.xap @@ -624,6 +624,12 @@ function GoToMusic() //////////////////////////////////////////////////////////////////////////// +// Plex and Jellyfin hide the Media scene while they're up. Showing a loaded +// Inline again doesn't rerun onLoad, so these flags say to GoTo directly. +var g_bMediaSceneLoaded; +var g_bPlexSceneLoaded; +var g_bJellyfinSceneLoaded; + DEF theMediaInline Inline { visible false @@ -631,6 +637,7 @@ DEF theMediaInline Inline function onLoad() { + g_bMediaSceneLoaded = true; theMediaInline.children[0].theMediaMenu.GoTo(); } } @@ -639,6 +646,11 @@ function GoToMedia() { if (theMediaInline.visible) theMediaInline.children[0].theMediaMenu.GoTo(); + else if (g_bMediaSceneLoaded) + { + theMediaInline.visible = true; + theMediaInline.children[0].theMediaMenu.GoTo(); + } else { BlockMemoryUnitInsert(); @@ -655,6 +667,7 @@ DEF thePlexInline Inline function onLoad() { + g_bPlexSceneLoaded = true; thePlexInline.children[0].thePlexMenu.GoTo(); } } @@ -665,6 +678,11 @@ function GoToPlex() theMediaInline.visible = false; if (thePlexInline.visible) thePlexInline.children[0].thePlexMenu.GoTo(); + else if (g_bPlexSceneLoaded) + { + thePlexInline.visible = true; + thePlexInline.children[0].thePlexMenu.GoTo(); + } else { BlockMemoryUnitInsert(); @@ -681,6 +699,7 @@ DEF theJellyfinInline Inline function onLoad() { + g_bJellyfinSceneLoaded = true; theJellyfinInline.children[0].theJellyfinMenu.GoTo(); } } @@ -690,6 +709,11 @@ function GoToJellyfin() theMediaInline.visible = false; if (theJellyfinInline.visible) theJellyfinInline.children[0].theJellyfinMenu.GoTo(); + else if (g_bJellyfinSceneLoaded) + { + theJellyfinInline.visible = true; + theJellyfinInline.children[0].theJellyfinMenu.GoTo(); + } else { BlockMemoryUnitInsert(); @@ -697,6 +721,15 @@ function GoToJellyfin() } } +// B at the top of Plex or Jellyfin lands back on the Media list. +function BackToMedia() +{ + thePlexInline.visible = false; + theJellyfinInline.visible = false; + theMediaInline.visible = true; + theMediaInline.children[0].theMediaMenu.GoBackTo(); +} + //////////////////////////////////////////////////////////////////////////// DEF theMemoryInline Inline @@ -2277,6 +2310,9 @@ function initialize() bBackToDVDPlayer = false; bGoToCDPlayer = false; bBackToLauncher = false; + g_bMediaSceneLoaded = false; + g_bPlexSceneLoaded = false; + g_bJellyfinSceneLoaded = false; bShowErrorPanel = false; bShowLegalInfo = false; bShowInvalidDisc = false; diff --git a/xips-source/jellyfin/jellyfin.xap b/xips-source/jellyfin/jellyfin.xap index 047519d..b1f8482 100644 --- a/xips-source/jellyfin/jellyfin.xap +++ b/xips-source/jellyfin/jellyfin.xap @@ -165,8 +165,8 @@ function UpdateJellyfinList() c.MenuButtons.children[0].children[0].children[0].appearance.material.name = "GameHilite"; c.MenuButtons.children[0].children[0].children[0].appearance.texture.url = "outline.tga"; c.MenuButtons.children[0].children[1].children[0].appearance.name = "NavType"; - c.MenuButtons.children[0].children[1].children[0].geometry.scrollRate = 0; - c.MenuButtons.children[0].children[1].children[0].geometry.scrollDelay = 0; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollRate = 0.1; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollDelay = 1; } else { @@ -174,6 +174,10 @@ function UpdateJellyfinList() } } + // More arrows only while there's more to scroll to. + c.MU_morearrow_up.visible = (nJfScroll > 0); + c.MU_morearrow_down.visible = ((nJfScroll + nJfVisible) < nJfCount); + c.MediaHeaderText.text = GetHeaderText(); c.MusicCountText.text = GetCountText(); if (status != "") @@ -307,7 +311,7 @@ function PlayCurrentEpisode() } -// B: pop to parent view (restoring its cursor) or out to main menu. +// B: pop to parent view (restoring its cursor) or back to the Media list. function GoBackOne() { if (nJfView == 3) @@ -343,7 +347,7 @@ function GoBackOne() } else { - theMainMenu.GoBackTo(); + BackToMedia(); } } diff --git a/xips-source/mediaplayer/mediaplayer.xap b/xips-source/mediaplayer/mediaplayer.xap index d3c6e6e..2b4610c 100644 --- a/xips-source/mediaplayer/mediaplayer.xap +++ b/xips-source/mediaplayer/mediaplayer.xap @@ -37,6 +37,8 @@ var gSelectedIndex; // absolute index into MediaCollection movies or show // list switches to playlist items. Picking an item plays from that index. var bInPlaylistItemView; var nPlaylistCursorBackup; // restore the cursor when backing out of items +var nMediaLastCount; // count last drawn; the behavior redraws when a scan changes it +var sMediaStatus; // what an empty list says, drawn on its first row function initialize() @@ -56,6 +58,8 @@ function initialize() bInPlaylistItemView = 0; nPlaylistCursorBackup = 0; + nMediaLastCount = -1; + sMediaStatus = ""; gSelectedTitle = ""; gSelectedPlot = ""; @@ -105,6 +109,28 @@ function GetActiveTitle(absIdx) } +function GetMediaStatus() +{ + if (bInCategoryView | (nMediaItemCount > 0)) + return ""; + if (nCurCategory == 0) + return theMediaCollection.GetStatus(0); + if (nCurCategory == 1) + return theMediaCollection.GetStatus(1); + if (bInPlaylistItemView) + return "This playlist is empty"; + return "No playlists yet"; +} + + +function CountText(n, one, many) +{ + if (n == 1) + return "1 " + one; + return n + " " + many; +} + + function StartMediaLevel() { UpdateMediaList(); @@ -114,6 +140,10 @@ function StartMediaLevel() function UpdateMediaList() { var c = theMediaMenu.children[0].children[0]; + // A rescan can shrink the list under the cursor. + if (nCurMediaItem >= nMediaItemCount) + nCurMediaItem = Math.max(0, nMediaItemCount - 1); + sMediaStatus = GetMediaStatus(); // Keep cursor inside the visible window: if it falls below scroll, raise // scroll; if it exceeds the bottom, drop scroll. @@ -147,40 +177,54 @@ function UpdateMediaList() c.MenuButtons.children[i].children[1].children[0].geometry.scrollDelay = 0; } } + else if ((i == 0) & (sMediaStatus != "")) + { + // Nothing to list: the first row says why. + c.MenuButtons.children[0].visible = true; + c.MenuButtons.children[0].children[1].children[0].geometry.text = sMediaStatus; + c.MenuButtons.children[0].children[0].children[0].appearance.material.name = "GameHilite"; + c.MenuButtons.children[0].children[0].children[0].appearance.texture.url = "outline.tga"; + c.MenuButtons.children[0].children[1].children[0].appearance.name = "NavType"; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollRate = 0.1; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollDelay = 1; + } else { c.MenuButtons.children[i].visible = false; } } + // More arrows only while there's more to scroll to. + c.MU_morearrow_up.visible = (nMediaListScroll > 0); + c.MU_morearrow_down.visible = ((nMediaListScroll + nMediaListVisible) < nMediaItemCount); + + // Just the category in the header; "MEDIA / ..." ran into the count. if (bInCategoryView) { c.MediaHeaderText.text = "MEDIA"; - c.MusicCountText.text = nMediaItemCount + " CATEGORIES"; + c.MusicCountText.text = CountText(nMediaItemCount, "CATEGORY", "CATEGORIES"); } else if (nCurCategory == 0) { - c.MediaHeaderText.text = "MEDIA / MOVIES"; - c.MusicCountText.text = nMediaItemCount + " MOVIES"; + c.MediaHeaderText.text = "MOVIES"; + c.MusicCountText.text = CountText(nMediaItemCount, "MOVIE", "MOVIES"); } else if (nCurCategory == 1) { - c.MediaHeaderText.text = "MEDIA / TV SHOWS"; - c.MusicCountText.text = nMediaItemCount + " SHOWS"; + c.MediaHeaderText.text = "TV SHOWS"; + c.MusicCountText.text = CountText(nMediaItemCount, "SHOW", "SHOWS"); } else { + c.MediaHeaderText.text = "PLAYLISTS"; if (bInPlaylistItemView) - { - c.MediaHeaderText.text = "MEDIA / PLAYLISTS"; - c.MusicCountText.text = nMediaItemCount + " ITEMS"; - } + c.MusicCountText.text = CountText(nMediaItemCount, "ITEM", "ITEMS"); else - { - c.MediaHeaderText.text = "MEDIA / PLAYLISTS"; - c.MusicCountText.text = nMediaItemCount + " PLAYLISTS"; - } + c.MusicCountText.text = CountText(nMediaItemCount, "PLAYLIST", "PLAYLISTS"); } + if (sMediaStatus != "") + c.MusicCountText.text = ""; + nMediaLastCount = nMediaItemCount; } @@ -275,6 +319,10 @@ DEF theMediaMenu Level BindActiveList(); UpdateMediaList(); } + else if (nMediaItemCount <= 0) + { + return; + } else if ((nCurCategory == 2) & (bInPlaylistItemView == 0)) { // Playlist names -> playlist items. @@ -362,6 +410,18 @@ DEF theMediaMenu Level CurrentViewpoint = theMediaViewpoint; EnableInput(true); } + + // A library scan can finish while the list is up. Redraw when it does. + behavior + { + sleep .5; + if (nMediaLastCount >= 0) + { + BindActiveList(); + if ((nMediaItemCount != nMediaLastCount) | (GetMediaStatus() != sMediaStatus)) + UpdateMediaList(); + } + } } @@ -475,11 +535,16 @@ function UpdateMediaTrackList() function ShowMediaActionPanel(bShow) { var c = theMediaActionMenu.children[0].children[0]; + // Only PLAY and INFO do something, so the other three stay hidden. c.GM_L2_menubutton_01.visible = bShow; c.GM_L2_menubutton_02.visible = bShow; - c.GM_L2_menubutton_03.visible = bShow; - c.GM_L2_menubutton_04.visible = bShow; - c.GM_L2_menubutton_05.visible = bShow; + c.GM_L2_menubutton_03.visible = false; + c.GM_L2_menubutton_04.visible = false; + c.GM_L2_menubutton_05.visible = false; + // The short two button frame, same as the music Audio CD menu. + c._button_surround.visible = (bShow == false); + c.New_Line11.visible = (bShow == false); + c._button_surround_0.visible = true; c.soundtrack_text05.visible = bShow; c.soundtrack_text06.visible = bShow; c.New_panel_meta.visible = bShow; @@ -537,10 +602,17 @@ function ShowMediaActionMenu() c.TitleText.text = gSelectedTitle.toUpperCase(); c.TitleText1.text = gSelectedTitle.toUpperCase(); + // A show's first button opens its seasons rather than playing. if (gSelectedKind == 1) + { c.TrackCountText.text = "EPISODES"; + c.GM_L2_menubutton_01.children[1].children[0].geometry.text = "EPISODES"; + } else - c.TrackCountText.text = "1 SCENE"; + { + c.TrackCountText.text = "MOVIE"; + c.GM_L2_menubutton_01.children[1].children[0].geometry.text = "PLAY"; + } c.MenuMetaText.text = gSelectedMeta + "\n\n" + gSelectedPlot; UpdateMediaActionHighlight(); @@ -610,10 +682,31 @@ function StartMediaEpisodes() } +// INFO: the whole plot in a message, which scrolls when it's long. +function ShowMediaInfo() +{ + var info = gSelectedTitle + "\n" + gSelectedMeta; + if (gSelectedPlot != "") + info = info + "\n\n" + gSelectedPlot; + else if (gSelectedKind == 0) + { + // No plot to show, so at least which file it is. The full path won't fit. + var path = theMediaCollection.GetMoviePath(gSelectedIndex); + var cut = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\")) + 1; + info = info + "\n\n" + path.substr(cut, path.length() - cut); + } + TellUser(info, ""); + var mc = theMessageInline.children[0]; + mc.MessageText.height = 6.0; + mc.MessageText.scrollRate = 0.15; + mc.MessageText.scrollDelay = 2; +} + + function StartMediaActionLevel() { nCurActionItem = 0; - nActionItemCount = 5; + nActionItemCount = 2; nPlayVisible = 9; // All title/plot/meta wiring happens in ShowMediaActionMenu now, @@ -737,7 +830,10 @@ DEF theMediaActionMenu Level else theMediaCollection.PlaySelected(); } - // INFO / FAVORITE / RENAME / DELETE not yet wired. + else + { + ShowMediaInfo(); + } } else if (nMediaActionState == 1) { diff --git a/xips-source/plex/plex.xap b/xips-source/plex/plex.xap index a77b99e..5303186 100644 --- a/xips-source/plex/plex.xap +++ b/xips-source/plex/plex.xap @@ -165,8 +165,8 @@ function UpdatePlexList() c.MenuButtons.children[0].children[0].children[0].appearance.material.name = "GameHilite"; c.MenuButtons.children[0].children[0].children[0].appearance.texture.url = "outline.tga"; c.MenuButtons.children[0].children[1].children[0].appearance.name = "NavType"; - c.MenuButtons.children[0].children[1].children[0].geometry.scrollRate = 0; - c.MenuButtons.children[0].children[1].children[0].geometry.scrollDelay = 0; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollRate = 0.1; + c.MenuButtons.children[0].children[1].children[0].geometry.scrollDelay = 1; } else { @@ -174,6 +174,10 @@ function UpdatePlexList() } } + // More arrows only while there's more to scroll to. + c.MU_morearrow_up.visible = (nPlexScroll > 0); + c.MU_morearrow_down.visible = ((nPlexScroll + nPlexVisible) < nPlexCount); + c.MediaHeaderText.text = GetHeaderText(); c.MusicCountText.text = GetCountText(); if (status != "") @@ -307,7 +311,7 @@ function PlayCurrentEpisode() } -// B: pop to parent view (restoring its cursor) or out to main menu. +// B: pop to parent view (restoring its cursor) or back to the Media list. function GoBackOne() { if (nPlexView == 3) @@ -343,7 +347,7 @@ function GoBackOne() } else { - theMainMenu.GoBackTo(); + BackToMedia(); } } From 2df1a78fcddc2ce14d62fe639924d5940927a5b2 Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 08:57:37 -0500 Subject: [PATCH 11/14] Music finds albums inside artist folders A Music folder laid out as Artist/Album came up empty. Albums one level down are soundtracks now. Also fixed song tags and lengths: only the first song per scan got read, and the misses were cached for good. --- theseus/desktop/audio_sdl.cpp | 43 +++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/theseus/desktop/audio_sdl.cpp b/theseus/desktop/audio_sdl.cpp index 4ab62dc..c60cfd7 100644 --- a/theseus/desktop/audio_sdl.cpp +++ b/theseus/desktop/audio_sdl.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include "host.h" @@ -819,7 +820,13 @@ static bool ProbeSong(mpv_handle* h, const std::string& path, Song& out) mpv_event* ev = mpv_wait_event(h, 5.0); if (!ev) break; if (ev->event_id == MPV_EVENT_FILE_LOADED) break; - if (ev->event_id == MPV_EVENT_END_FILE) return false; + // "replace" ends the previous probe's file first. That one's a stop, + // not this file failing. + if (ev->event_id == MPV_EVENT_END_FILE) { + mpv_event_end_file* ef = (mpv_event_end_file*)ev->data; + if (ef && ef->reason == MPV_END_FILE_REASON_STOP) continue; + return false; + } if (ev->event_id == MPV_EVENT_SHUTDOWN) return false; if (ev->event_id == MPV_EVENT_NONE) return false; } @@ -867,7 +874,7 @@ struct DBEntry { typedef std::map DBMap; static const uint32_t kMusicDBMagic = 0x42444D54; // 'TMDB' -static const uint32_t kMusicDBVersion = 2; +static const uint32_t kMusicDBVersion = 3; // 3: drops entries a broken probe left without tags static void DB_WriteU32(FILE* fp, uint32_t v) { fwrite(&v, 4, 1, fp); } static void DB_WriteI32(FILE* fp, int32_t v) { fwrite(&v, 4, 1, fp); } @@ -1075,17 +1082,23 @@ int DashMusic_Scan(const char* musicRoot) if (probeMpv && ProbeSong(probeMpv, fullPath, song)) probedCount++; } - DBEntry e; - SongToDB(song, e); - newDb[fullPath] = e; + // A failed probe isn't cached, so it gets another try next scan. + if (song.probed) { + DBEntry e; + SongToDB(song, e); + newDb[fullPath] = e; + } return song; }; int nextID = 1; - auto ProcessSoundtrackDir = [&](const char* dirName) { + // A folder of songs is a soundtrack. A folder of folders (Artist/Album) + // makes each album one, one level down. + std::function ProcessSoundtrackDir = + [&](const std::string& parent, const char* dirName, bool topLevel) { if (dirName[0] == '.') return; - std::string stPath = std::string(musicRoot) + "/" + dirName; + std::string stPath = parent + "/" + dirName; struct stat st; if (stat(stPath.c_str(), &st) != 0 || !S_ISDIR(st.st_mode)) return; @@ -1110,12 +1123,22 @@ int DashMusic_Scan(const char* musicRoot) soundtrack.songs.push_back(BuildSong(full, StripExtension(songName))); }; + std::vector subDirs; HostDir* stDir = Host_OpenDir(stPath.c_str()); if (stDir) { char songName[260]; - while (Host_ReadDir(stDir, songName, sizeof(songName), NULL)) ProcessSongFile(songName); + bool subIsDir = false; + while (Host_ReadDirType(stDir, songName, sizeof(songName), &subIsDir)) { + if (subIsDir) { if (songName[0] != '.') subDirs.push_back(songName); } + else ProcessSongFile(songName); + } Host_CloseDir(stDir); } + if (soundtrack.songs.empty() && topLevel) { + for (size_t i = 0; i < subDirs.size(); i++) + ProcessSoundtrackDir(stPath, subDirs[i].c_str(), false); + return; + } if (!soundtrack.songs.empty()) { if (soundtrack.albumPath.empty() && !fallbackArt.empty()) @@ -1178,7 +1201,7 @@ int DashMusic_Scan(const char* musicRoot) bool isDir; while (Host_ReadDirType(rootDir, entryName, sizeof(entryName), &isDir)) { if (entryName[0] == '.') continue; - if (isDir) ProcessSoundtrackDir(entryName); + if (isDir) ProcessSoundtrackDir(musicRoot, entryName, true); else if (IsM3UFile(entryName)) ProcessM3UFile(entryName); else ProcessLooseFile(entryName); } @@ -1209,7 +1232,7 @@ int DashMusic_Scan(const char* musicRoot) DB_Save(DB_GetPath().c_str(), newDb); std::sort(s_soundtracks.begin(), s_soundtracks.end(), - [](const Soundtrack& a, const Soundtrack& b) { return a.name < b.name; }); + [](const Soundtrack& a, const Soundtrack& b) { return strcasecmp(a.name.c_str(), b.name.c_str()) < 0; }); if (s_soundtracks.size() > 0) fprintf(stderr, "[Audio] %zu soundtracks loaded (%d cached, %d probed)\n", From ffab7720cbbd06e21651655d117c7ae02a182d32 Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 09:03:16 -0500 Subject: [PATCH 12/14] Slowed the dashboard down when nobody can see it Minimized, hidden or fully covered, it still drew every refresh, about 10% CPU on the Mac. Now it draws around 20 times a second until it's visible again; the clock is real time, so animations keep their speed. Covered only works on macOS so far. --- theseus/desktop/host.h | 2 ++ theseus/desktop/host_posix_app.cpp | 17 +++++++++++++++++ theseus/desktop/host_win_app.cpp | 2 ++ theseus/desktop/sdl_main.cpp | 11 +++++++++++ 4 files changed, 32 insertions(+) diff --git a/theseus/desktop/host.h b/theseus/desktop/host.h index ce6885c..d1b7516 100644 --- a/theseus/desktop/host.h +++ b/theseus/desktop/host.h @@ -75,6 +75,8 @@ void Host_InstallCrashHandler(const char* userDataDir, const char* shippedDir); // What bgfx needs to draw into the SDL window. ndt is the display // connection (X11/Wayland), NULL elsewhere. bool Host_NativeWindow(SDL_Window* window, void** nwh, void** ndt, bool* wayland); +// True when other windows cover all of it. Only macOS can tell; elsewhere false. +bool Host_WindowOccluded(SDL_Window* window); // A URL goes to the OS handler, anything else runs as a shell command from // workdir (may be NULL). err gets a line on failure. When proc isn't NULL it // gets the child to watch, or NULL when there's nothing to watch (a URL on diff --git a/theseus/desktop/host_posix_app.cpp b/theseus/desktop/host_posix_app.cpp index 2460f74..a2424a0 100644 --- a/theseus/desktop/host_posix_app.cpp +++ b/theseus/desktop/host_posix_app.cpp @@ -27,6 +27,8 @@ #include #ifdef __APPLE__ #include +#include +#include #include #include #else @@ -449,6 +451,21 @@ bool Host_NativeWindow(SDL_Window* window, void** nwh, void** ndt, bool* wayland return true; } +bool Host_WindowOccluded(SDL_Window* window) { +#ifdef __APPLE__ + SDL_SysWMinfo wmi; + SDL_VERSION(&wmi.version); + if (!window || !SDL_GetWindowWMInfo(window, &wmi) || !wmi.info.cocoa.window) return false; + // [NSWindow occlusionState], where bit 1 is NSWindowOcclusionStateVisible. + unsigned long state = ((unsigned long (*)(id, SEL))objc_msgSend)( + (id)wmi.info.cocoa.window, sel_registerName("occlusionState")); + return (state & (1ul << 1)) == 0; +#else + (void)window; + return false; +#endif +} + // Put back the LD_LIBRARY_PATH AppRun stashed, so a spawned /bin/sh doesn't // load the AppImage's bundled readline. No-op outside an AppImage. static void RestoreHostLibraryPath() { diff --git a/theseus/desktop/host_win_app.cpp b/theseus/desktop/host_win_app.cpp index a12b9c5..8bd9ec4 100644 --- a/theseus/desktop/host_win_app.cpp +++ b/theseus/desktop/host_win_app.cpp @@ -411,6 +411,8 @@ bool Host_NativeWindow(SDL_Window* window, void** nwh, void** ndt, bool* wayland return true; } +bool Host_WindowOccluded(SDL_Window*) { return false; } + // URLs go through ShellExecute. Raw commands run through cmd /C; no /S, so // cmd preserves outer quotes for the 2-quote/exists case and strips // first/last otherwise. diff --git a/theseus/desktop/sdl_main.cpp b/theseus/desktop/sdl_main.cpp index 7084e87..9f762a7 100644 --- a/theseus/desktop/sdl_main.cpp +++ b/theseus/desktop/sdl_main.cpp @@ -696,6 +696,14 @@ int g_vsyncMode = 0; int g_rendererPref = 0; bool g_vsyncChangeRequested = false; +// Minimized, hidden or covered. Video, xCloud and MilkDrop keep full speed. +static bool WindowOutOfSight() +{ + if (!g_pSDLWindow || g_mediaFullscreen || g_xcloudFullscreen || MilkdropWindow_IsOpen()) return false; + if (SDL_GetWindowFlags(g_pSDLWindow) & (SDL_WINDOW_MINIMIZED | SDL_WINDOW_HIDDEN)) return true; + return Host_WindowOccluded(g_pSDLWindow); +} + // Manual FPS cap (0 = unlimited). Applied via SDL_Delay before SwapWindow. int g_fpsCap = 0; @@ -1828,6 +1836,9 @@ int main(int argc, char* argv[]) { // A game we started is up and we're behind it: stay out of its way. if (!g_windowFocused && Launch_GameRunning()) SDL_Delay(100); + // Nobody can see the window: the scene keeps its clock, it just draws + // a few times a second instead of every refresh. + else if (WindowOutOfSight()) SDL_Delay(50); // FPS cap: sleep until budget elapsed. 0 = unlimited. if (g_fpsCap > 0) { From 6bde262b06a46f44519f7b4c9d9c1744b994b704 Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 09:03:16 -0500 Subject: [PATCH 13/14] Start the audio CD player only when a disc plays Every launch made an idle mpv player with its scripts just in case. Now it's made on the first track, which drops about eight idle threads. Needs a test with a real audio CD. --- theseus/desktop/cdaudio.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/theseus/desktop/cdaudio.cpp b/theseus/desktop/cdaudio.cpp index fe2b31d..37784ec 100644 --- a/theseus/desktop/cdaudio.cpp +++ b/theseus/desktop/cdaudio.cpp @@ -148,26 +148,31 @@ static int s_pendingChapter = -1; static double s_timePos = 0.0; static double s_chapterStart = 0.0; -static void CdBack_Init() +// Most sessions never play a disc, so the handle waits for the first one. +static void CdBack_Init() {} + +static bool CdBack_Open() { + if (s_mpv) return true; s_mpv = mpv_create(); - if (!s_mpv) { fprintf(stderr, "[CdAudio] mpv_create failed\n"); return; } + if (!s_mpv) { fprintf(stderr, "[CdAudio] mpv_create failed\n"); return false; } mpv_set_option_string(s_mpv, "video", "no"); mpv_set_option_string(s_mpv, "audio-display", "no"); mpv_set_option_string(s_mpv, "keep-open", "yes"); mpv_set_option_string(s_mpv, "terminal", "no"); if (mpv_initialize(s_mpv) < 0) { fprintf(stderr, "[CdAudio] mpv_initialize failed\n"); - mpv_destroy(s_mpv); s_mpv = nullptr; return; + mpv_destroy(s_mpv); s_mpv = nullptr; return false; } mpv_observe_property(s_mpv, 0, "time-pos", MPV_FORMAT_DOUBLE); + return true; } static void CdBack_Shutdown() { if (s_mpv) { mpv_destroy(s_mpv); s_mpv = nullptr; } } bool CdAudio_Play(int track) { - if (!s_mpv || track < 1) return false; + if (track < 1 || !CdBack_Open()) return false; s_pendingChapter = track - 1; s_playing = true; s_paused = false; s_timePos = 0.0; s_chapterStart = 0.0; for (int i = 0; i < track - 1 && i < s_trackCount; ++i) s_chapterStart += s_trackDurations[i]; From 9f7278f50801e42626f31e7b3945ade7b7b21beb Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 20 Nov 2026 09:08:01 -0500 Subject: [PATCH 14/14] Settings window uses the guide's names and lines up Anti-Aliasing and Frame Rate Limit match the guide now, and the label column is wide enough that every dropdown sits in one line. --- theseus/desktop/menu_bar.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/theseus/desktop/menu_bar.cpp b/theseus/desktop/menu_bar.cpp index bc304e9..b5dff51 100644 --- a/theseus/desktop/menu_bar.cpp +++ b/theseus/desktop/menu_bar.cpp @@ -224,7 +224,7 @@ static bool RowLeft(const SettingDef& d, const char* page) static void SettingRowsLeft(const char* page, bool separate = false) { const SettingsTable& t = DesktopSettings_Table(); - float labelW = 110.0f; + float labelW = 140.0f; bool any = false; for (int i = 0; i < t.count; i++) { if (!RowLeft(t.defs[i], page)) continue; @@ -778,10 +778,10 @@ void RenderSettingsWindow() { ImGui::Spacing(); // Dropdowns: fixed label column + widget column so they line up. - const float kLabelX = 110.0f; + const float kLabelX = 140.0f; const float kWidgetW = 160.0f; - ImGui::AlignTextToFramePadding(); ImGui::Text("MSAA:"); + ImGui::AlignTextToFramePadding(); ImGui::Text("Anti-Aliasing:"); ImGui::SameLine(kLabelX); ImGui::SetNextItemWidth(kWidgetW); SettingCombo("MSAA", "##msaa"); @@ -789,7 +789,7 @@ void RenderSettingsWindow() { ImGui::SameLine(kLabelX); ImGui::SetNextItemWidth(kWidgetW); SettingCombo("Vsync", "##vsync"); - ImGui::AlignTextToFramePadding(); ImGui::Text("FPS Cap:"); + ImGui::AlignTextToFramePadding(); ImGui::Text("Frame Rate Limit:"); ImGui::SameLine(kLabelX); ImGui::SetNextItemWidth(kWidgetW); SettingCombo("FpsCap", "##fpscap");