Improved some things
This commit is contained in:
parent
3d24d7fa2c
commit
801aa13623
|
@ -17,7 +17,7 @@
|
|||
#define TICKS_PER_SECOND 10000000
|
||||
|
||||
//Discord Project64 App ID
|
||||
#define PJ64_DISCORD_APPID "359086208862650378"
|
||||
#define PJ64_DISCORD_APPID "594955067208105985"
|
||||
|
||||
void CDiscord::Init()
|
||||
{
|
||||
|
@ -33,290 +33,52 @@ void CDiscord::Shutdown()
|
|||
|
||||
void CDiscord::Update(bool bHaveGame)
|
||||
{
|
||||
DiscordRichPresence discordPresence = {};
|
||||
//Variables we use later
|
||||
//szState uses the Rdb_GoodName to display a proper game name over DiscordRPC
|
||||
//keyState uses the Header of the rom to easily add game pictures through the discord developer panel using the ID above
|
||||
char szState[256];
|
||||
char keyState[256];
|
||||
sprintf(szState, "Playing %s", g_Settings->LoadStringVal(Rdb_GoodName).c_str()); //rdb_GoodName in a variable for use later
|
||||
sprintf(keyState, "%s", g_Settings->LoadStringVal(Game_GameName).c_str()); //Rom Header in a variable for use later
|
||||
|
||||
|
||||
if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "MarioParty3") != NULL)
|
||||
//Load Game Into DiscordRPC
|
||||
DiscordRichPresence discordPresence = {}; //activates DiscordRPC
|
||||
if (bHaveGame && g_Settings->LoadStringVal(Game_File).length() != 0)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Mario Party 3");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "mp3";
|
||||
discordPresence.largeImageText = "Mario Party 3";
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
|
||||
//DiscordRPC Game Name - Playing <game>
|
||||
discordPresence.state = szState; //sets the state of the DiscordRPC to the Rdb_GoodName file
|
||||
|
||||
//Play Time over DiscordRPC
|
||||
discordPresence.startTimestamp = Timestamp(); //sets the time on the DiscordRPC
|
||||
|
||||
//Large Image Text over DiscordRPC
|
||||
discordPresence.largeImageText = szState; //sets the RDB_GoodName Variable as the large image text
|
||||
|
||||
//Large Image File Name over DiscordRPC
|
||||
discordPresence.largeImageText = keyState; //sets the Rom Header Variable as the large image key (the file you upload to discord)
|
||||
|
||||
//Small Image over DiscordRPC
|
||||
discordPresence.smallImageKey = "icon"; //Project 64 Logo in bottom right corner
|
||||
discordPresence.smallImageText = "Project64"; //Name of the Project64 Logo
|
||||
discordPresence.instance = 1; //Instance of Active DiscordRPC
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "MarioParty2") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Mario Party 2");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "mp2";
|
||||
discordPresence.largeImageText = "Mario Party 2";
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "MarioParty") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Mario Party 1");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "mp1";
|
||||
discordPresence.largeImageText = "Mario Party 1";
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "SUPER MARIO 64") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Super Mario 64");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "sm64";
|
||||
discordPresence.largeImageText = "Super Mario 64",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "MARIOKART64") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Mario Kart 64");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "mk64";
|
||||
discordPresence.largeImageText = "Mario Kart 64",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "SMASH BROTHERS") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Super Smash Bros.");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "ssb";
|
||||
discordPresence.largeImageText = "Super Smash Bros.",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "THE LEGEND OF ZELDA") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing The Legend Of Zelda: Ocarina Of Time");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "loz-ocarina";
|
||||
discordPresence.largeImageText = "The Legend Of Zelda: Ocarina Of Time",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "ZELDA MAJORA'S MASK") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing The Legend Of Zelda: Majora's Mask");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "loz-majora";
|
||||
discordPresence.largeImageText = "The Legend Of Zelda: Majora's Mask",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "Banjo-Kazooie") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Banjo Kazooie");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "banjo-kazooie";
|
||||
discordPresence.largeImageText = "Banjo Kazooie",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "BANJO TOOIE") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Banjo Tootie");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "banjo-tootie";
|
||||
discordPresence.largeImageText = "Banjo Tootie",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "WAVE RACE 64") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Wave Race 64");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "waverace";
|
||||
discordPresence.largeImageText = "Waverace 64",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "F-ZERO X") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing F-Zero X");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "fzero";
|
||||
discordPresence.largeImageText = "F-Zero X",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "DONKEY KONG 64") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Donkey Kong 64");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "dk64";
|
||||
discordPresence.largeImageText = "Donkey Kong 64",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "PAPER MARIO") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Paper Mario");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "papermario";
|
||||
discordPresence.largeImageText = "Paper Mario",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "BOMBERMAN64U") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Bomberman 64");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "bomberman";
|
||||
discordPresence.largeImageText = "Bomberman 64",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "POKEMON STADIUM") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Pokemon Stadium");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "pokemon-stadium";
|
||||
discordPresence.largeImageText = "Pokemon Stadium",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "POKEMON STADIUM 2") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Pokemon Stadium 2");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "pokemon-stadium-2";
|
||||
discordPresence.largeImageText = "Pokemon Stadium 2",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "GOLDENEYE") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Goldeneye 007");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "goldeneye";
|
||||
discordPresence.largeImageText = "Goldeneye 007",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "Perfect Dark") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Perfect Dark");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "perfect-dark";
|
||||
discordPresence.largeImageText = "Perfect Dark",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "STARFOX64") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Starfox 64");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "starfox";
|
||||
discordPresence.largeImageText = "Starfox 64",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else if (strstr(g_Settings->LoadStringVal(Game_GameName).c_str(), "Pilot Wings64") != NULL)
|
||||
{
|
||||
char szState[256];
|
||||
sprintf(szState, "Playing Pilot Wings 64");
|
||||
discordPresence.state = szState;
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "pilotwings";
|
||||
discordPresence.largeImageText = "Pilotwings 64",
|
||||
discordPresence.smallImageKey = "icon";
|
||||
discordPresence.smallImageText = "Project64";
|
||||
discordPresence.instance = 1;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
discordPresence.startTimestamp = Timestamp();
|
||||
discordPresence.largeImageKey = "icon";
|
||||
discordPresence.instance = 1;
|
||||
|
||||
//Show when you are not playing a game over DiscordRPC.
|
||||
// This is not perfect due to Project64's method of loading
|
||||
// ROM's into the filesystem before emulation starts.
|
||||
sprintf(szState, "Not in-game"); //shows "Not in-game" on the active DiscordRPC text
|
||||
discordPresence.largeImageKey = "icon"; //Shows the Project64 logo on the large image box
|
||||
discordPresence.largeImageText = "Project64"; //Name of the Project64 Logo
|
||||
discordPresence.smallImageKey = NULL; //Safety Measure to force unload the smallImageKey
|
||||
discordPresence.smallImageText = NULL; //Safety Measure to force unload the smallImageText
|
||||
discordPresence.endTimestamp = NULL; //Safety Measure to force unload the TimeStamp
|
||||
|
||||
}
|
||||
Discord_UpdatePresence(&discordPresence);
|
||||
|
||||
Discord_UpdatePresence(&discordPresence); //end DiscordRPC
|
||||
}
|
||||
|
||||
int64_t CDiscord::Timestamp()
|
||||
|
|
Loading…
Reference in New Issue