Skip to content

Commit

Permalink
Merge pull request libretro#7434 from fr500/lanrooms
Browse files Browse the repository at this point in the history
make discord app id configurable
  • Loading branch information
inactive123 authored Oct 13, 2018
2 parents 6662456 + 32c346a commit f0494a5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -811,4 +811,6 @@ static char buildbot_server_url[] = "";

static char buildbot_assets_server_url[] = "http://buildbot.libretro.com/assets/";

static char default_discord_app_id[] = "475456035851599874";

#endif
5 changes: 4 additions & 1 deletion configuration.c
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ static struct config_array_setting *populate_settings_array(settings_t *settings
SETTING_ARRAY("midi_input", settings->arrays.midi_input, true, midi_input, true);
SETTING_ARRAY("midi_output", settings->arrays.midi_output, true, midi_output, true);
SETTING_ARRAY("youtube_stream_key", settings->arrays.youtube_stream_key, true, NULL, true);
SETTING_ARRAY("twitch_stream_key", settings->arrays.twitch_stream_key, true, NULL, true);
SETTING_ARRAY("discord_app_id", settings->arrays.discord_app_id, true, default_discord_app_id, true);
*size = count;

return tmp;
Expand Down Expand Up @@ -1814,6 +1814,9 @@ void config_set_defaults(void)
*settings->paths.path_menu_xmb_font = '\0';
#endif

strlcpy(settings->arrays.discord_app_id,
default_discord_app_id, sizeof(settings->arrays.discord_app_id));

#ifdef HAVE_MATERIALUI
if (g_defaults.menu.materialui.menu_color_theme_enable)
settings->uints.menu_materialui_color_theme = g_defaults.menu.materialui.menu_color_theme;
Expand Down
2 changes: 2 additions & 0 deletions configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,8 @@ typedef struct settings

char youtube_stream_key[PATH_MAX_LENGTH];
char twitch_stream_key[PATH_MAX_LENGTH];

char discord_app_id[PATH_MAX_LENGTH];
} arrays;

struct
Expand Down
5 changes: 3 additions & 2 deletions discord/discord.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "discord.h"

#include "../retroarch.h"
#include "../configuration.h"
#include "../core.h"
#include "../core_info.h"
#include "../paths.h"
Expand All @@ -35,7 +36,6 @@
#include "../cheevos/cheevos.h"
#endif

static const char* APPLICATION_ID = "475456035851599874";
static int FrustrationLevel = 0;

static int64_t start_time = 0;
Expand Down Expand Up @@ -211,6 +211,7 @@ void discord_update(enum discord_presence presence)

void discord_init(void)
{
settings_t *settings = config_get_ptr();
DiscordEventHandlers handlers;

RARCH_LOG("[Discord] initializing ..\n");
Expand All @@ -224,7 +225,7 @@ void discord_init(void)
handlers.spectateGame = handle_discord_spectate;
handlers.joinRequest = handle_discord_join_request;

Discord_Initialize(APPLICATION_ID, &handlers, 1, NULL);
Discord_Initialize(settings->arrays.discord_app_id, &handlers, 1, NULL);

discord_ready = true;
}
Expand Down

0 comments on commit f0494a5

Please sign in to comment.