Skip to content

Adding discord rich presence support for Windows64 (Early)#968

Draft
acth2 wants to merge 2 commits intosmartcmd:mainfrom
acth2:feature/discord-rich-presence
Draft

Adding discord rich presence support for Windows64 (Early)#968
acth2 wants to merge 2 commits intosmartcmd:mainfrom
acth2:feature/discord-rich-presence

Conversation

@acth2
Copy link
Contributor

@acth2 acth2 commented Mar 8, 2026

Description

Reintroducing the Discord rich presence system, this idea come from #954

Changes

Previous Behavior

There were the functions for rich presence but no code inside of them: the code is still in an very early state but it works!
image

Root Cause

I needed to recode the discord rich presence but the system that tracks the players action and that permit me to modify what the rich presence says was already coded!

New Behavior

in Minecraft:Init i call ProfileManager.RichPresenceInit(...) and in Minecraft::tick i call player->updateRichPresence(); to constantly update the rich presence
NEW: I now use the Minecraft.Client/Windows64Media/loc/stringsRichPresence.xml file that contains the rich presence text (thanks to eff3ry for pointing that)

Fix Implementation

Previously it looked like this:
void C_4JProfile::RichPresenceInit(int iPresenceCount, int iContextCount) {}
void C_4JProfile::SetRichPresenceContextValue(int iPad, int iContextID, int iVal) {}
i just called discord-rpc.h and followed instructions to make a rich presence from there:
image

It works but its ugly for now!

AI Use Disclosure

nop

Related Issues

@acth2 acth2 marked this pull request as draft March 8, 2026 19:21
@eff3ry
Copy link

eff3ry commented Mar 9, 2026

would it be better to hook directly into the localised strings?
Minecraft.Client/Windows64Media/loc/stringsRichPresence.xml

@eff3ry
Copy link

eff3ry commented Mar 9, 2026

Obviously this wont be a drop in replacement but just an example, app is referenced in many files the same way, not sure which file app is defined though 🤷‍♂️

static std::string s_detailsUtf8;
static std::string s_stateUtf8;

s_detailsUtf8 = app.GetString(IDS_DISCORD_DETAILS_PLAYING_LCE);
discordPresence.details = s_detailsUtf8.c_str();

switch (iVal) {
  case CONTEXT_GAME_STATE_NETHER:
    s_stateUtf8 = app.GetString(IDS_DISCORD_STATE_NETHER);
    break;
  ...
  default:
    s_stateUtf8 = app.GetString(IDS_DISCORD_STATE_SURVIVING);
    break;
}
discordPresence.state = s_stateUtf8.c_str();
Discord_UpdatePresence(&discordPresence);

@acth2
Copy link
Contributor Author

acth2 commented Mar 9, 2026

would it be better to hook directly into the localised strings? Minecraft.Client/Windows64Media/loc/stringsRichPresence.xml

thx i'll do it now

@acth2 acth2 force-pushed the feature/discord-rich-presence branch 7 times, most recently from e42a1f8 to 2d246ed Compare March 9, 2026 16:35
@acth2
Copy link
Contributor Author

acth2 commented Mar 9, 2026

Obviously this wont be a drop in replacement but just an example, app is referenced in many files the same way, not sure which file app is defined though 🤷‍♂️

static std::string s_detailsUtf8;
static std::string s_stateUtf8;

s_detailsUtf8 = app.GetString(IDS_DISCORD_DETAILS_PLAYING_LCE);
discordPresence.details = s_detailsUtf8.c_str();

switch (iVal) {
  case CONTEXT_GAME_STATE_NETHER:
    s_stateUtf8 = app.GetString(IDS_DISCORD_STATE_NETHER);
    break;
  ...
  default:
    s_stateUtf8 = app.GetString(IDS_DISCORD_STATE_SURVIVING);
    break;
}
discordPresence.state = s_stateUtf8.c_str();
Discord_UpdatePresence(&discordPresence);

It's done thx for the example btw!

@nitrate92
Copy link

would it be better to hook directly into the localised strings? Minecraft.Client/Windows64Media/loc/stringsRichPresence.xml

I am a little late to the party but this is more like what I proposed initially since I noticed the strings in the code while digging around.

@SimplyCEO
Copy link

Could this code be placed under a definition, please?
I do not have Discord, so, how I see, this is extra unused binary.

@acth2
Copy link
Contributor Author

acth2 commented Mar 18, 2026

Could this code be placed under a definition, please? I do not have Discord, so, how I see, this is extra unused binary.

yep i w as thinking about doing that

@acth2 acth2 force-pushed the feature/discord-rich-presence branch 3 times, most recently from 34b76e6 to fadef78 Compare March 18, 2026 21:36
Cleaning PR

Finishing rich presence core and Cleaning

Removed Minecraft.Client/Minecraft.Client.vcxproj
@acth2 acth2 force-pushed the feature/discord-rich-presence branch from ca3a74f to ef3c3e9 Compare March 18, 2026 22:02
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.

4 participants