mirror of
https://github.com/ultrasn0w/foo_drpc.git
synced 2025-12-12 13:19:53 +01:00
Compare commits
10 Commits
0.2.0.0
...
0.3.0.0-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bb4f8080c | ||
|
|
579e7cbb7c | ||
|
|
fa59966d6c | ||
|
|
da6b7ec8ed | ||
|
|
deb8bbc760 | ||
|
|
211fc232a9 | ||
|
|
5685d728a6 | ||
|
|
295b6fa7fa | ||
|
|
169eaa1aec | ||
|
|
e7025e2967 |
12
README.md
12
README.md
@@ -1,10 +1,16 @@
|
|||||||
# foo_drpc
|
# foo_drpc
|
||||||
Foobar2000 music status for Discord Rich Presence!
|
Foobar2000 music status for Discord Rich Presence!
|
||||||
|
|
||||||
|
# Notice
|
||||||
|
I'm currently no longer actively developing this, but will still merge PRs and reference releases at the [release page](https://github.com/ultrasn0w/foo_drpc/releases).
|
||||||
|
|
||||||
# How to use
|
# How to use
|
||||||
1. Grab release, place component .dll in \foobar2000\components\ or drop foo_drpc directory in \%userdir%\AppData\Roaming\foobar2000\user-components\.
|
1. Grab [release](https://github.com/ultrasn0w/foo_drpc/releases), drop included **foo_drpc** directory in \%userdir%\AppData\Roaming\foobar2000\user-components\ (if you have not moved your AppData somewhere else) or place included .dll Files in \foobar2000\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.
|
2. Add foobar2000 to discords detected games (Settings -> Games -> Add it).
|
||||||
3. Add foobar2000 to discords detected games (Settings -> Games -> Add it).
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
# How to compile
|
# How to compile
|
||||||
0. Compiled with VS 2017.
|
0. Compiled with VS 2017.
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
DECLARE_COMPONENT_VERSION(
|
DECLARE_COMPONENT_VERSION(
|
||||||
"foo_drpc",
|
"foo_drpc",
|
||||||
"0.1",
|
"0.3",
|
||||||
"<EFBFBD> 2017 - ultrasn0w");
|
"Foobar2000 music status for Discord Rich Presence! (c) 2018 - ultrasn0w");
|
||||||
|
|
||||||
static initquit_factory_t<foo_drpc> foo_interface;
|
static initquit_factory_t<foo_drpc> foo_interface;
|
||||||
static std::chrono::time_point<std::chrono::high_resolution_clock> lastT;
|
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_edited |
|
||||||
play_callback::flag_on_playback_dynamic_info_track,
|
play_callback::flag_on_playback_dynamic_info_track,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
discordInit();
|
discordInit();
|
||||||
initDiscordPresence();
|
initDiscordPresence();
|
||||||
}
|
}
|
||||||
|
|
||||||
void foo_drpc::on_quit()
|
void foo_drpc::on_quit()
|
||||||
{
|
{
|
||||||
|
Discord_ClearPresence();
|
||||||
Discord_Shutdown();
|
Discord_Shutdown();
|
||||||
static_api_ptr_t<play_callback_manager>()->unregister_callback(this);
|
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;
|
if (!connected) return;
|
||||||
|
|
||||||
@@ -61,9 +61,12 @@ void foo_drpc::on_playback_starting(play_control::t_track_command command, bool
|
|||||||
{
|
{
|
||||||
switch (command)
|
switch (command)
|
||||||
{
|
{
|
||||||
case play_control::track_command_play:
|
case playback_control::track_command_play:
|
||||||
case play_control::track_command_resume:
|
case playback_control::track_command_next:
|
||||||
case play_control::track_command_settrack:
|
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.state = "Listening";
|
||||||
discordPresence.smallImageKey = "play";
|
discordPresence.smallImageKey = "play";
|
||||||
break;
|
break;
|
||||||
@@ -79,20 +82,20 @@ void foo_drpc::on_playback_starting(play_control::t_track_command command, bool
|
|||||||
// updateDiscordPresence();
|
// 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;
|
if (!connected) return;
|
||||||
|
|
||||||
switch (reason)
|
switch (reason)
|
||||||
{
|
{
|
||||||
case play_control::stop_reason_user:
|
case playback_control::stop_reason_user:
|
||||||
case play_control::stop_reason_eof:
|
case playback_control::stop_reason_eof:
|
||||||
case play_control::stop_reason_shutting_down:
|
case playback_control::stop_reason_shutting_down:
|
||||||
discordPresence.state = "Stopped";
|
discordPresence.state = "Stopped";
|
||||||
discordPresence.smallImageKey = "stop";
|
discordPresence.smallImageKey = "stop";
|
||||||
|
updateDiscordPresence();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateDiscordPresence();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void foo_drpc::on_playback_pause(bool pause)
|
void foo_drpc::on_playback_pause(bool pause)
|
||||||
@@ -151,7 +154,7 @@ void foo_drpc::initDiscordPresence()
|
|||||||
{
|
{
|
||||||
memset(&discordPresence, 0, sizeof(discordPresence));
|
memset(&discordPresence, 0, sizeof(discordPresence));
|
||||||
discordPresence.state = "Initialized";
|
discordPresence.state = "Initialized";
|
||||||
discordPresence.details = "topkek";
|
discordPresence.details = "Waiting ...";
|
||||||
discordPresence.largeImageKey = "logo";
|
discordPresence.largeImageKey = "logo";
|
||||||
discordPresence.smallImageKey = "stop";
|
discordPresence.smallImageKey = "stop";
|
||||||
// discordPresence.partyId = "party1234";
|
// discordPresence.partyId = "party1234";
|
||||||
@@ -172,14 +175,18 @@ void foo_drpc::updateDiscordPresence()
|
|||||||
req = std::chrono::high_resolution_clock::now();
|
req = std::chrono::high_resolution_clock::now();
|
||||||
std::chrono::duration<double> elapsed = req - lastT;
|
std::chrono::duration<double> elapsed = req - lastT;
|
||||||
// spam protection
|
// spam protection
|
||||||
if (elapsed.count() > 1.0) {
|
if (elapsed.count() > 0.42) {
|
||||||
Discord_UpdatePresence(&discordPresence);
|
Discord_UpdatePresence(&discordPresence);
|
||||||
lastT = std::chrono::high_resolution_clock::now();
|
lastT = std::chrono::high_resolution_clock::now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||||
|
Discord_UpdateConnection();
|
||||||
|
#endif
|
||||||
|
Discord_RunCallbacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void connectedF()
|
void connectedF(const DiscordUser* request)
|
||||||
{
|
{
|
||||||
connected = true;
|
connected = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -29,7 +29,7 @@
|
|||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<PlatformToolset>v141_xp</PlatformToolset>
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<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