Skip to content

Restore console title and startup beep lost in United cores - #466

Merged
MadMaxMangos merged 1 commit into
masterfrom
fix/restore-console-observability
Jul 31, 2026
Merged

Restore console title and startup beep lost in United cores#466
MadMaxMangos merged 1 commit into
masterfrom
fix/restore-console-observability

Conversation

@MadMaxMangos

@MadMaxMangos MadMaxMangos commented Jul 31, 2026

Copy link
Copy Markdown
Member

Restores two admin-visible console behaviours that #463 ("United cores", 1039 files, merged with no reviews) removed without mentioning either, plus the config key it renamed on only one side.

Windows console title

The live N Players - N Connections window title added deliberately in #337 was relocated intact by #448 into Master.cpp, then deleted outright by #463 with no replacement.

Restored into Master::PublishConsoleStatus(), which already runs on a one-second cadence, rather than reintroducing a separate tick counter. It sits above that function's if (!ui.Active()) return; early-out on purpose: the window/taskbar title is owned by the OS, not by the console frame, so it must stay current even when the full-screen UI is switched off — and it stays readable while the server is minimised, which the in-frame status bar does not.

Startup completion beep

#463 gated the existing beep behind !ConsoleUI::Instance().Active(). The full-screen UI is on by default, so the beep never fired interactively.

Removing that gate alone is not sufficient, and this was verified rather than assumed. ConsoleLogWriter::Emit() (src/shared/Log/ConsoleLogWriter.cpp:158-174) checks ConsoleUI::Active() first and routes a raw record to ConsoleUI::PushRaw() as text, so a BEL sent through sLog.ConsoleEmitRaw() lands in the scrollback buffer and is displayed rather than sounded. The bell therefore has to bypass the log pipeline entirely: MessageBeep(MB_OK) on Windows, direct fputs("\a") + fflush on POSIX.

Config keys

  • Console.Style. ACE removed. New network engine. OpenSSL 3.x mandatory. New mangosd UI. #448 shipped this correctly on both sides — a documented tri-state (auto / fancy / plain) with a reader. United cores #463 unilaterally replaced the reader with a bool Console.FullScreen and left the conf untouched. Result: Console.Style was read by nothing, Console.FullScreen appeared in no config file, and there was no shipped way to turn the full-screen UI off — which matters, because that UI is what suppressed the beep and hosted the deleted title. Restored Console.Style as the reader rather than deleting the documented key. Its doc block now states honestly that "fancy" currently behaves as "auto", since forcing the UI on for an undetectable terminal is still not implemented.
  • BeepAtStart. The code reads Console.BeepAtStart; the shipped conf still said plain BeepAtStart, so the admin's setting was dead. Conf now matches the code.

Verification

  • Builds clean, 0 errors, no new warnings (RelWithDebInfo, MSVC). MessageBeep links without adding a library — user32.lib comes from CMake's MSVC default standard libraries.
  • Ran live against a real 1.12.1 client dataset and MariaDB. mangosd boots fully; title observed live as Mangos Zero (0 Players - 0 Connections). Beep confirmed audible on the rebuilt binary.
  • Coding standard checked: no added line exceeds 80 columns, no tabs, git diff --check clean.

Notes for review

  • UpdateConsoleTitle uses a function-local static std::string. PublishConsoleStatus has exactly one caller, in WorldLoop, so this is world-thread-only and not a data race.
  • GetOpenConnectionCount() is a relaxed atomic load; the listener starts before the world loop and stops only after it exits, so it is never read against a torn-down network layer.
  • Behaviour change worth flagging: anyone who had hand-written Console.FullScreen=0 loses that override. It appears in no shipped config file, so this should affect nobody.
  • Master.cpp gains #include "SystemConfig.h" for MANGOS_PACKAGENAME; mangosd.cpp already included it.

A wider audit of #448/#463 turned up further config drift not addressed here — including two with security and audit impact (the Ra.*/RA.* mismatch leaves Ra.Stricted silently ignored, and GmLogFile/GMLogFile means the GM command audit log is never written). Those are deliberately left out to keep this PR single-purpose and will follow separately.


This change is Reviewable

PR #463 (a683a24, 1039 files, no reviews) removed two admin-visible
console behaviours without mentioning either, and left a config key
renamed on the code side only. This restores all three.

Console title: the live "N Players - N Connections" window title added
in #337 was relocated intact by #448, then deleted outright by #463.
Restored into Master::PublishConsoleStatus(), which already runs on a
one-second cadence, placed above that function's early-out because the
window title is owned by the OS rather than by the console frame and
must stay current even when the full-screen UI is off.

Startup beep: #463 gated the existing beep behind !ConsoleUI::Active(),
and the full-screen UI is on by default, so it never fired
interactively. Removing the gate alone is not sufficient:
ConsoleLogWriter::Emit() routes a raw record to ConsoleUI::PushRaw() as
text when the UI is active, so a BEL sent through sLog is displayed
rather than sounded. The bell now bypasses the log pipeline entirely.

Config keys: #448 shipped Console.Style correctly on both sides; #463
replaced the reader with a bool Console.FullScreen and left the conf
untouched, so Console.Style became dead, Console.FullScreen existed in
no config file, and there was no shipped way to disable the UI.
Console.Style is restored as the reader and its doc block now states
honestly that "fancy" behaves as "auto". Separately, the conf still
said BeepAtStart while the code read Console.BeepAtStart; the conf now
matches.

Verified: builds clean with 0 errors; mangosd boots against a real
1.12.1 dataset and the title was observed live as
"Mangos Zero (0 Players - 0 Connections)"; the beep was confirmed
audible on the rebuilt binary.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 4 complexity · 0 duplication

Metric Results
Complexity 4
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@MadMaxMangos
MadMaxMangos merged commit 1faa3bf into master Jul 31, 2026
7 of 8 checks passed
@MadMaxMangos
MadMaxMangos deleted the fix/restore-console-observability branch July 31, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant