Add Discord Rich Presence support - #94
Open
willshiel wants to merge 2 commits into
Open
Conversation
Shows the player's town name and current location (e.g. "Inside Nook's Cranny") on Discord via the local IPC protocol, closing flyngmt#78. Opt-in via a discord_client_id in settings.ini (blank disables it, the default). All pipe I/O runs on a dedicated thread so a slow or absent Discord client can never stall the game loop.
- Map game font codes to ASCII via the CHAR_* table instead of a raw range check: heart/music/droplet symbols and accented letters in town names were being emitted as the wrong ASCII character (e.g. heart as '+'); accented a-variants now map to 'a', symbols are dropped, and underscore is kept - Probe discord-ipc-0 through -9 instead of only -0, so presence works when Discord Canary/PTB or another RPC app holds the first pipe - Throttle updates by wall clock (5s) instead of frame count, which scaled with the FPS cap (~0.3s at 960fps) and could hit Discord's rate limit; first update now fires immediately instead of after 300 frames - Shut the worker thread down on the missing-ROM early-exit path, which previously left it running through SDL_Quit - Clamp snprintf position accumulation so a truncated payload can't underflow the remaining-size argument (latent OOB) or masquerade as a dropped connection - Use wrap-safe tick comparisons, drop the has_state flag in favor of an empty-string convention, dedupe the default details literal, and wrap lines to the repo's 120-column limit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shows the player's town name and current location (e.g. "Inside Nook's Cranny") on Discord via the local IPC protocol, closing #78. Opt-in via a discord_client_id in settings.ini (blank disables it, the default). All pipe I/O runs on a dedicated thread so a slow or absent Discord client can never stall the game loop.