From 5693d626b590bf00f3569e88e90f7475fb43c310 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 25 Sep 2024 03:58:43 -0400 Subject: [PATCH] Update so that album art works. --- art | 2 +- source/funkin/api/discord/DiscordClient.hx | 8 +++++-- source/funkin/play/PlayState.hx | 25 +++++++++++++++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/art b/art index cc347f563..fbd3e3df7 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit cc347f5630dc8182e62990c66753940a275202f8 +Subproject commit fbd3e3df77734606d88516770b71b56e6fa04bce diff --git a/source/funkin/api/discord/DiscordClient.hx b/source/funkin/api/discord/DiscordClient.hx index 3b6e891d3..3be2d4c87 100644 --- a/source/funkin/api/discord/DiscordClient.hx +++ b/source/funkin/api/discord/DiscordClient.hx @@ -7,7 +7,7 @@ import sys.thread.Thread; class DiscordClient { - static final CLIENT_ID:String = "814588678700924999"; + static final CLIENT_ID:String = "816168432860790794"; public static var instance(get, never):DiscordClient; static var _instance:Null = null; @@ -96,13 +96,17 @@ class DiscordClient // The large image displaying what the user is doing. // This should probably be album art. // IMPORTANT NOTE: This can be an asset key uploaded to Discord's developer panel OR any URL you like. + presence.largeImageKey = cast(params.largeImageKey, Null) ?? "album-volume1"; + + trace('[DISCORD] largeImageKey: ${presence.largeImageKey}'); // TODO: Make this use the song's album art. // presence.largeImageKey = "icon"; - presence.largeImageKey = "https://f4.bcbits.com/img/a0746694746_16.jpg"; + // presence.largeImageKey = "https://f4.bcbits.com/img/a0746694746_16.jpg"; // The small inset image for what the user is doing. // This can be the opponent's health icon? + // NOTE: Like largeImageKey, this can be a URL, or an asset key. presence.smallImageKey = cast(params.smallImageKey, Null); // NOTE: In previous versions, this showed as "Elapsed", but now shows as playtime and doesn't look good diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index aeba619ff..e544df341 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -447,6 +447,7 @@ class PlayState extends MusicBeatSubState #if FEATURE_DISCORD_RPC // Discord RPC variables + var discordRPCAlbum:String = ''; var discordRPCIcon:String = ''; #end @@ -987,6 +988,7 @@ class PlayState extends MusicBeatSubState state: buildDiscordRPCState(), + largeImageKey: discordRPCAlbum, smallImageKey: discordRPCIcon }); #end @@ -1081,6 +1083,8 @@ class PlayState extends MusicBeatSubState { details: 'Game Over - ${buildDiscordRPCDetails()}', state: buildDiscordRPCState(), + + largeImageKey: discordRPCAlbum, smallImageKey: discordRPCIcon }); #end @@ -1300,7 +1304,9 @@ class PlayState extends MusicBeatSubState DiscordClient.instance.setPresence( { state: buildDiscordRPCState(), - details: 'Paused - ${buildDiscordRPCDetails()}', + details: buildDiscordRPCDetails(), + + largeImageKey: discordRPCAlbum, smallImageKey: discordRPCIcon }); } @@ -1309,7 +1315,9 @@ class PlayState extends MusicBeatSubState DiscordClient.instance.setPresence( { state: buildDiscordRPCState(), - details: 'Paused - ${buildDiscordRPCDetails()}', + details: buildDiscordRPCDetails(), + + largeImageKey: discordRPCAlbum, smallImageKey: discordRPCIcon }); } @@ -1345,6 +1353,8 @@ class PlayState extends MusicBeatSubState { state: buildDiscordRPCState(), details: buildDiscordRPCDetails(), + + largeImageKey: discordRPCAlbum, smallImageKey: discordRPCIcon }); } @@ -1354,6 +1364,8 @@ class PlayState extends MusicBeatSubState { state: buildDiscordRPCState(), details: buildDiscordRPCDetails(), + + largeImageKey: discordRPCAlbum, smallImageKey: discordRPCIcon }); // DiscordClient.changePresence(detailsText, '${currentChart.songName} ($discordRPCDifficulty)', discordRPCIcon, true, @@ -1381,6 +1393,8 @@ class PlayState extends MusicBeatSubState { state: buildDiscordRPCState(), details: buildDiscordRPCDetails(), + + largeImageKey: discordRPCAlbum, smallImageKey: discordRPCIcon }); } @@ -1681,7 +1695,8 @@ class PlayState extends MusicBeatSubState iconP2.cameras = [camHUD]; #if FEATURE_DISCORD_RPC - discordRPCIcon = currentCharacterData.opponent; + discordRPCAlbum = 'album-${currentChart.album}'; + discordRPCIcon = 'icon-${currentCharacterData.opponent}'; #end } @@ -1807,6 +1822,8 @@ class PlayState extends MusicBeatSubState { state: buildDiscordRPCState(), details: buildDiscordRPCDetails(), + + largeImageKey: discordRPCAlbum, smallImageKey: discordRPCIcon }); #end @@ -2040,6 +2057,8 @@ class PlayState extends MusicBeatSubState { state: buildDiscordRPCState(), details: buildDiscordRPCDetails(), + + largeImageKey: discordRPCAlbum, smallImageKey: discordRPCIcon }); // DiscordClient.changePresence(detailsText, '${currentChart.songName} ($discordRPCDifficulty)', discordRPCIcon, true, currentSongLengthMs);