discord / discord-rpc

https://discordapp.com/developers
MIT License
1.05k stars 324 forks source link

Games Tab? #219

Closed andres-asm closed 6 years ago

andres-asm commented 6 years ago

Hey

I worked on the RetroArch discord-rpc implementation, it's working fine as in I can see the user status and what they are playing.

But I can't see their past activity on the games tab. Is there any trick to that?

msciotti commented 6 years ago

Hi there. I'm not sure specifically, but it may be that we only show past activity for games that are verified in our games DB. I'll have to check on this for you, but I'll find out.

andres-asm commented 6 years ago

Ah ok thanks a lot let me know please!

msciotti commented 6 years ago

Found my answer. So, yes, right now the past history on the activity tab only displays verified games. For example, if you boot up Fortnite, you'll have their Rich Presence show, but when you see past activity, it shows a different icon. That means that currently active == shows RP, while past activity == looking at our games database.

Right now, games get added to our database as people report them as their presence. So as more folks report RetroArch, we'll eventually get the quorum needed for our database to verify the game (which includes icon, exe path, name, etc.)

andres-asm commented 6 years ago

Ok thanks a lot so with the feature going into mainline it should sort itself.

andres-asm commented 6 years ago

Sorry to bump this, but RetroArch is still not showing up (although we have rich presence disabled by default I guess)

Also it doesn't seem RetroArch can be launched via discord "ask to join" It joins just fine when RA is working already, anyway we can improve that? Is there any way to pass cli arguments?

https://www.youtube.com/watch?v=E0bUwKn-D2w&feature=youtu.be&a=

msciotti commented 6 years ago

Sorry for the confusion. For the not launching, could you open a new issue, just to keep things clean?

As far as the games tab past activity, that answer is what I mentioned above. As users use the application, our games database gets reported to about the game name, id, exe path, icon, etc. Once a certain threshold is met (I'm not certain off the top of my head), we consider the game verified, and it'll appear in the "recently played" section.

andres-asm commented 6 years ago

Ok, guess not too many users of ours are using discord, it's puzzling since citra shows up on the games tab. I'll open another issue about launching.

andres-asm commented 5 years ago

@msciotti I guess it can never get into the launcher or activity. We build RetroArch with mingw (most of the time) And the registry hive was being created like this:

image

These function calls: https://github.com/discordapp/discord-rpc/blob/master/src/discord_register_win.cpp#L84

Should be %S if building with MINGW, not sure if I can fix that, I just replaced them locally and it fixed it for me

diff --git a/deps/discord-rpc/src/discord_register_win.cpp b/deps/discord-rpc/src/discord_register_win.cpp
index e441318dd5..60b1db3e08 100644
--- a/deps/discord-rpc/src/discord_register_win.cpp
+++ b/deps/discord-rpc/src/discord_register_win.cpp
@@ -77,22 +77,22 @@ static void Discord_RegisterW(const wchar_t* applicationId, const wchar_t* comma
     wchar_t openCommand[1024];

     if (command && command[0]) {
-        StringCbPrintfW(openCommand, sizeof(openCommand), L"%s", command);
+        StringCbPrintfW(openCommand, sizeof(openCommand), L"%S", command);
     }
     else {
         // StringCbCopyW(openCommand, sizeof(openCommand), exeFilePath);
-        StringCbPrintfW(openCommand, sizeof(openCommand), L"%s", exeFilePath);
+        StringCbPrintfW(openCommand, sizeof(openCommand), L"%S", exeFilePath);
     }

     wchar_t protocolName[64];
-    StringCbPrintfW(protocolName, sizeof(protocolName), L"discord-%s", applicationId);
+    StringCbPrintfW(protocolName, sizeof(protocolName), L"discord-%S", applicationId);
     wchar_t protocolDescription[128];
     StringCbPrintfW(
-      protocolDescription, sizeof(protocolDescription), L"URL:Run game %s protocol", applicationId);
+      protocolDescription, sizeof(protocolDescription), L"URL:Run game %S protocol", applicationId);
     wchar_t urlProtocol = 0;

     wchar_t keyName[256];
-    StringCbPrintfW(keyName, sizeof(keyName), L"Software\\Classes\\%s", protocolName);
+    StringCbPrintfW(keyName, sizeof(keyName), L"Software\\Classes\\%S", protocolName);
     HKEY key;
     auto status =
       RegCreateKeyExW(HKEY_CURRENT_USER, keyName, 0, nullptr, 0, KEY_WRITE, nullptr, &key, nullptr);
andres-asm commented 5 years ago

https://stackoverflow.com/questions/17700797/printf-wprintf-s-s-ls-char-and-wchar-errors-not-announced-by-a-compil

andres-asm commented 5 years ago

I don't know if this is a proper fix, it's more like a works-for-me thing

msciotti commented 5 years ago

The fix seems legit for mingw specifically. Looks like there's some...disagreement between compilers? Not sure how to properly support that, maybe some #ifdef magic?

andres-asm commented 5 years ago

You could use #ifdef _MSC_VER for the MSVC codepath

andres-asm commented 5 years ago

Actually I updated my discord subtree and it seems to just work now... Gonna clear my ccache cache and make clean just in case