mirror of
https://github.com/ultrasn0w/foo_drpc.git
synced 2025-12-12 13:19:53 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
deb8bbc760 | ||
|
|
211fc232a9 | ||
|
|
5685d728a6 | ||
|
|
295b6fa7fa | ||
|
|
169eaa1aec | ||
|
|
e7025e2967 |
@@ -2,9 +2,12 @@
|
||||
Foobar2000 music status for Discord Rich Presence!
|
||||
|
||||
# How to use
|
||||
1. Grab release, place component .dll in \foobar2000\components\ or drop foo_drpc directory in \%userdir%\AppData\Roaming\foobar2000\user-components\.
|
||||
2. Grab release from https://github.com/discordapp/discord-rpc and place the discord-rpc.dll from the \bin\ directory in your foobar200 root directory (alongside foobar2000.exe). Make sure to grab the 32bit .dll because foobar2000 is a 32bit program.
|
||||
3. Add foobar2000 to discords detected games (Settings -> Games -> Add it).
|
||||
1. Grab release, drop included **foo_drpc** directory in \%userdir%\AppData\Roaming\foobar2000\user-components\ or place included .dll Files in \foobar2000\components\.
|
||||
2. Add foobar2000 to discords detected games (Settings -> Games -> Add it).
|
||||
|
||||

|
||||

|
||||

|
||||
|
||||
# How to compile
|
||||
0. Compiled with VS 2017.
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
DECLARE_COMPONENT_VERSION(
|
||||
"foo_drpc",
|
||||
"0.1",
|
||||
"<EFBFBD> 2017 - ultrasn0w");
|
||||
"0.3",
|
||||
"Foobar2000 music status for Discord Rich Presence! (c) 2018 - ultrasn0w");
|
||||
|
||||
static initquit_factory_t<foo_drpc> foo_interface;
|
||||
static std::chrono::time_point<std::chrono::high_resolution_clock> lastT;
|
||||
@@ -37,18 +37,18 @@ void foo_drpc::on_init()
|
||||
play_callback::flag_on_playback_edited |
|
||||
play_callback::flag_on_playback_dynamic_info_track,
|
||||
false);
|
||||
|
||||
discordInit();
|
||||
initDiscordPresence();
|
||||
}
|
||||
|
||||
void foo_drpc::on_quit()
|
||||
{
|
||||
Discord_ClearPresence();
|
||||
Discord_Shutdown();
|
||||
static_api_ptr_t<play_callback_manager>()->unregister_callback(this);
|
||||
}
|
||||
|
||||
void foo_drpc::on_playback_starting(play_control::t_track_command command, bool pause)
|
||||
void foo_drpc::on_playback_starting(playback_control::t_track_command command, bool pause)
|
||||
{
|
||||
if (!connected) return;
|
||||
|
||||
@@ -61,9 +61,12 @@ void foo_drpc::on_playback_starting(play_control::t_track_command command, bool
|
||||
{
|
||||
switch (command)
|
||||
{
|
||||
case play_control::track_command_play:
|
||||
case play_control::track_command_resume:
|
||||
case play_control::track_command_settrack:
|
||||
case playback_control::track_command_play:
|
||||
case playback_control::track_command_next:
|
||||
case playback_control::track_command_prev:
|
||||
case playback_control::track_command_resume:
|
||||
case playback_control::track_command_rand:
|
||||
case playback_control::track_command_settrack:
|
||||
discordPresence.state = "Listening";
|
||||
discordPresence.smallImageKey = "play";
|
||||
break;
|
||||
@@ -79,15 +82,15 @@ void foo_drpc::on_playback_starting(play_control::t_track_command command, bool
|
||||
// updateDiscordPresence();
|
||||
}
|
||||
|
||||
void foo_drpc::on_playback_stop(play_control::t_stop_reason reason)
|
||||
void foo_drpc::on_playback_stop(playback_control::t_stop_reason reason)
|
||||
{
|
||||
if (!connected) return;
|
||||
|
||||
switch (reason)
|
||||
{
|
||||
case play_control::stop_reason_user:
|
||||
case play_control::stop_reason_eof:
|
||||
case play_control::stop_reason_shutting_down:
|
||||
case playback_control::stop_reason_user:
|
||||
case playback_control::stop_reason_eof:
|
||||
case playback_control::stop_reason_shutting_down:
|
||||
discordPresence.state = "Stopped";
|
||||
discordPresence.smallImageKey = "stop";
|
||||
break;
|
||||
@@ -151,7 +154,7 @@ void foo_drpc::initDiscordPresence()
|
||||
{
|
||||
memset(&discordPresence, 0, sizeof(discordPresence));
|
||||
discordPresence.state = "Initialized";
|
||||
discordPresence.details = "topkek";
|
||||
discordPresence.details = "Waiting ...";
|
||||
discordPresence.largeImageKey = "logo";
|
||||
discordPresence.smallImageKey = "stop";
|
||||
// discordPresence.partyId = "party1234";
|
||||
@@ -172,11 +175,15 @@ void foo_drpc::updateDiscordPresence()
|
||||
req = std::chrono::high_resolution_clock::now();
|
||||
std::chrono::duration<double> elapsed = req - lastT;
|
||||
// spam protection
|
||||
if (elapsed.count() > 1.0) {
|
||||
if (elapsed.count() > 0.42) {
|
||||
Discord_UpdatePresence(&discordPresence);
|
||||
lastT = std::chrono::high_resolution_clock::now();
|
||||
}
|
||||
}
|
||||
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||
Discord_UpdateConnection();
|
||||
#endif
|
||||
Discord_RunCallbacks();
|
||||
}
|
||||
|
||||
void connectedF()
|
||||
|
||||
Binary file not shown.
@@ -29,7 +29,7 @@
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v141_xp</PlatformToolset>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
||||
BIN
foo_drpc1.PNG
Normal file
BIN
foo_drpc1.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
BIN
foo_drpc2.PNG
Normal file
BIN
foo_drpc2.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
BIN
foo_drpc3.PNG
Normal file
BIN
foo_drpc3.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
Reference in New Issue
Block a user