Merge pull request #7435 from fr500/lanrooms

start registering the application so it can be started from discord
This commit is contained in:
Twinaphex 2018-10-14 04:25:18 +02:00 committed by GitHub
commit 2e67f4f02c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -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);

View File

@ -16,6 +16,7 @@
#include <file/file_path.h>
#include "discord.h"
#include "discord_register.h"
#include "../retroarch.h"
#include "../configuration.h"
@ -225,7 +226,11 @@ void discord_init(void)
handlers.spectateGame = handle_discord_spectate;
handlers.joinRequest = handle_discord_join_request;
Discord_Initialize(settings->arrays.discord_app_id, &handlers, 1, NULL);
/* To-Do: Add the arguments RetroArch was started with to the register URI*/
const char command[256] = "retroarch";
Discord_Initialize(settings->arrays.discord_app_id, &handlers, 0, NULL);
Discord_Register(settings->arrays.discord_app_id, NULL);
discord_ready = true;
}