Skip to content

NGMP implementation - #260

Draft
fbraz3 wants to merge 46 commits into
mainfrom
feat/generals-online-ngmp
Draft

NGMP implementation#260
fbraz3 wants to merge 46 commits into
mainfrom
feat/generals-online-ngmp

Conversation

@fbraz3

@fbraz3 fbraz3 commented Aug 18, 2026

Copy link
Copy Markdown
Owner

No description provided.

fbraz3 added 30 commits August 3, 2026 19:37
// GeneralsX @feature GeneralsOnline NGMP UI Binding

- Added RefreshNGMPGameListBoxes to LobbyUtils for populating the UI
- Added chat session initialization upon EVENT_AUTH_SUCCESS
- Hooked WOLLobbyMenuUpdate to poll NGMP events instead of GameSpy
- Replaced TheGameSpyInfo->sendChat with NGMP sendChatMessage
- Modified OnlineServices_Manager update() to return events (pollEvents)
- Ensured shell event pump mechanism is using pollEvents
Added async polling for Global Stats and Persona Stats via NGMP endpoints
instead of relying on GameSpy functions, allowing the UI to populate
the Persona panel and Welcome screen statistics.
Fixed the Communicator window auto-closing by using the NGMP login state
instead of the GameSpy network state.
When the client connected to the WebSocket for NGMP Custom Match lobbies,
it never sent a NETWORK_ROOM_CHANGE_ROOM message to join a specific room.
As a result, the server treated the client as being in room -1, causing
the Lobbies HTTP request to return 0 lobbies, and the client never
received player list updates (msg_id 4) or chat messages.

Added changeNetworkRoom(int16_t roomID) to NGMP_OnlineServicesManager
and called it with room 0 (Global Lobby) in WOLLobbyMenuInit before
requesting the lobby list asynchronously. Also documented this requirement
in ngmp.instructions.md.
…ering

WOLLobbyMenuUpdate was calling TheShell->pop() before calling
markAsStagingRoomHost() in the EVENT_LOBBY_CREATED handler. Because
buttonPushed=true at that point, Shell::pop() triggers
WOLLobbyMenuShutdown with popImmediate=TRUE, which synchronously
executes shutdownComplete -> TheShell->push -> WOLGameSetupMenuInit.
Inside WOLGameSetupMenuInit, getCurrentStagingRoom() returned nullptr
(m_isHosting was still FALSE), causing a SIGSEGV on game->getSlot(0).

Fix: call markAsStagingRoomHost()/markAsStagingRoomJoiner() BEFORE
TheShell->pop() so the staging room state is initialized before any
synchronous init chain can fire.

Also add a defensive null-check in WOLGameSetupMenuInit for
getCurrentStagingRoom() that pops back to the lobby if nil, preventing
any future crash from an unexpected state loss.

Add diagnostic stderr logs in PopupHostGame and WOLLobbyMenu to trace
createLobbyAsync invocation and staging room transitions.
GameEngine.cpp was calling pollEvents() every frame, which consumed and
discarded all pending UI events (like EVENT_LOBBY_CREATED) if they arrived
between menu updates. This caused a race condition where the 'Create Game'
flow would successfully create a lobby on the server, but the UI menu
would never transition to the staging room setup screen.

Fix: Split pollEvents() into update() and pollEvents().
- update(): Processes internal logic (WebSocket messages) and moves UI events to a new m_uiEventQueue.
- pollEvents(): Now exclusively polls m_uiEventQueue for the UI menus.
- GameEngine::update() now correctly calls NGMP_OnlineServicesManager::update() instead of pollEvents().

Also added fallback for PascalCase vs camelCase in lobby parsing (Name/name)
and added a diagnostic log to capture the Lobbies API JSON response.
GameSpy slots require an explicitly set identity (TheGameSpyInfo->setLocalName) which was previously missing in the NGMP login flow, causing the host slot to be blank.

Also fixed the Back button in WOLGameSetupMenu doing nothing because it incorrectly relied on checking if the GameSpy P2P peer socket was connected before popping the screen. Now it unconditionally pops and calls NGMP changeNetworkRoom(0) to leave the lobby.
libcurl does not support concurrent access to the same CURL handle. When the main thread called curl_ws_send or curl_easy_cleanup while the receive thread was running curl_ws_recv, the allocator corrupted and crashed the game with SIGABRT (malloc bug pointer being freed was not allocated). Now both receive and send are synchronized over m_sendMutex.
…obby

1. Populate TheGameSpyInfo localName and profileID upon NGMP login in OnlineServices_Manager and MainMenuUpdate so the host player name displays properly in room slots.
2. Hide ping indicator for the local player slot in WOLGameSetupMenu, following references/GameClient pattern.
3. Push WOLCustomLobby.wnd upon game completion in WOLGameSetupMenuInit for NGMP builds.
- Populate custom lobby player listbox from NGMP lobby players with rank icons
- Fix chat message JSON payload schema and listbox routing
- Restore classic Welcome to Generals Online voice line on login
- Gate voice line playback to once per session with transition safety guards
- Backport welcome menu improvements to Generals base game
- Update August 2026 worklog
…ndency

- Move RefreshNGMPGameListBoxes from shared Core LobbyUtils to WOLLobbyMenu to decouple base game from Zero Hour NGMP headers
- Bundle json.hpp and update NGMP_json.h with fallback header resolution for offline/sandboxed Flatpak environments
- Safeguard FetchContent in cmake/ngmp.cmake when FETCHCONTENT_FULLY_DISCONNECTED is enabled
- Update August 2026 worklog
…rver config

- Defer browser login and CheckLogin polling to explicit user action when entering Multiplayer -> Online
- Add .ngmp-config.cmake generation in flatpak-builder script and cmake/ngmp.cmake
- Propagate NGMP server secrets to GitHub Actions build workflows
- Update August 2026 worklog
…icate config

- Remove duplicate NGMP compile definitions in cmake/config-build.cmake
- Generate non-hidden cmake/ngmp_env.cmake for flatpak-builder sandbox inclusion
- Prioritize CLI and cached host definitions in cmake/ngmp.cmake
- Update August 2026 worklog
fbraz3 added 16 commits August 14, 2026 22:46
- Support PascalCase JSON keys from server in requestLobbyListAsync
- Accumulate fragmented WebSocket frames matching GameClient reference
- Unblock periodic custom lobby refresh and bind item data to lobby ID
- Update development diary for 2026-08-15
- implement requestLobbyDetailsAsync to query lobby state and populate staging room slots
- handle websocket msg_id 6 and 11 for real-time room updates and server chat
- wire updateLobby* methods to POST /Lobby/{id} for map, cash, rules, and slot options
- fix WOLMapSelectMenuInit to read active map from staging room and populate listboxes
- fix WOLGameSetupMenuInit map preview lookup via TheMapCache->findMap
- Add NGMPGame and NGMPGameSlot wrappers matching reference repo
- Add interface segregation bridge with GetInterface template
- Add sub-interface classes for auth, lobby, rooms, stats, and social
- Add WebSocket wrapper helper methods
- Align WOLMapSelectMenu with TheNGMPGame and LobbyInterface
- Add slash commands for rename in WOLLobbyMenu
- Update monthly worklog
- Add create/join lobby callbacks and lifecycle registration in WOLLobbyMenu
- Implement rich player tooltips with persistent stats in custom lobby
- Add lobby game mode filter enum, parser, and dynamic combobox filtering
- Migrate WOLGameSetupMenu handlers to NGMP LobbyInterface with AI slot support
- Centralize TheNGMPGame declarations and clean up redundant header externs
- Update monthly worklog
- Implemented chat rate limit (3s cooldown) to prevent spam
- Expanded player tooltips with detailed stats (streaks, disconnects) and admin ID
- Added `/forcerelay` and `/allowrelay` slash commands
- Restored right-click context menus on player list for NGMP
- Fixed combobox room joining by migrating to NGMP RoomsInterface
- Addressed C++17 system_clock compatibility and vector iterator compilation issues
- Undefine min/max macros after GameSpy headers in PersistentStorageThread.h
- Clean up min/max macro handling in OnlineServices_Manager.h
- Order standard headers before GameSpy headers in OnlineServices_StatsInterface.h
- Fix std::max type mismatch in WOLWelcomeMenu.cpp
- Add lobby name persistence and async creation in PopupHostGame
- Re-route delete account to logout in PopupPlayerInfo
- Add lobby lookup and passworded entry in PopupJoinGame
- Implement match outcome reporting and web URL opening in ScoreScreen
- Add slash commands (/help, /commands, /friendsonly, /public, /maxcameraheight) in WOLGameSetupMenu
- Update buddy overlay notification timeout and in-game chat validation
- Add SetFileName and safe division in DownloadMenu
- Guard NGMP user preferences with HAVE_NGMP_PREFS via __has_include
- Update worklog diary for 2026-08
…ket chat

- Unlink modal windows anywhere in modal stack in GameWindowManager
- Add dismissible GSMessageBoxCancel for lobby creation dialog
- Synchronize staging room with selected map and metadata on map change
- Enable starting cash and superweapons restriction controls for host
- Direct WebSocket chat and command payloads using sendRawWebSocketPayload
- Update August 2026 worklog diary in English
… readiness

- Sanitize map paths to avoid server directory duplication
- Implement robust multi-tier map metadata resolution in TheMapCache
- Populate lobby member roster and identify local slot index dynamically
- Distinguish host force-start from guest readiness WebSocket dispatch
- Return guest to lobby upon host exit via EVENT_LOBBY_LEFT
- Update worklog diary for 2026-08-18
…ation

- Populate m_CurrentLobby.members in requestLobbyDetailsAsync to fix getLocalSlotNum
- Reactively update TheNGMPGame slots on EVENT_PLAYERS_UPDATED in WOLGameSetupMenuUpdate
- Ensure TheMapCache updates before listbox capacity allocation in WOLMapSelectMenu
- Update worklog diary for 2026-08-18
- Remove Zero Hour-specific NGMPGame.h include from unified Core InGameChat
- Use base GameInfo null-check and isMultiPlayer() method
- Initialize mapList before setting radio button selection in WOLMapSelectMenuInit
- Add null pointer guard at entry of GadgetListBoxSetListLength
- Update worklog diary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant