diff --git a/config.cpp b/config.cpp index 1985eb9..cc9650b 100644 --- a/config.cpp +++ b/config.cpp @@ -48,17 +48,16 @@ bool setPresenceVariables(std::string configPath) } } return changed; - } // print values for the current settings from the config file -void printVariables(struct config_t c) +void printVariables(struct config_t* c) { - printf("\nCurrent Presence (%s) :", c.clientId.c_str()); - printf("\nState: %s", c.state.c_str()); - printf("\nDetails: %s", c.details.c_str()); - printf("\nLarge Image: '%s' with toolip, '%s'", c.largeImg.key.c_str(), c.largeImg.text.c_str()); - printf("\nSmall Image: '%s' with toolip, '%s'", c.smallImg.key.c_str(), c.smallImg.text.c_str()); - printf("\nStart Time: %lld", c.startTime); - printf("\nEnd Time: %lld\n", c.endTime); + printf("\nCurrent Presence (%s) :", c->clientId.c_str()); + printf("\nState: %s", c->state.c_str()); + printf("\nDetails: %s", c->details.c_str()); + printf("\nLarge Image: '%s' with toolip, '%s'", c->largeImg.key.c_str(), c->largeImg.text.c_str()); + printf("\nSmall Image: '%s' with toolip, '%s'", c->smallImg.key.c_str(), c->smallImg.text.c_str()); + printf("\nStart Time: %lld", c->startTime); + printf("\nEnd Time: %lld\n", c->endTime); } diff --git a/config.hpp b/config.hpp index 9685982..9d209d7 100644 --- a/config.hpp +++ b/config.hpp @@ -2,7 +2,7 @@ bool setPresenceVariables(std::string configPath); -void printVariables(struct config_t c); +void printVariables(struct config_t* c); struct pimage_t { std::string key; @@ -14,32 +14,18 @@ struct config_t { // id for the discord developer app std::string clientId; + // text to show for now playing std::string details; std::string state; + // images to show for now playing pimage_t smallImg; pimage_t largeImg; + // timestamps for game; note: these usually have to be within about 24 hours :( long long startTime; long long endTime; - - /* - // Compare this struct to previous struct - bool operator==(const config_t& c, const config_t& p) - { - if (p->clientId != c->clientId) return false; - else if (p->details != c->details) return false; - else if (p->state != c->state) return false; - else if (p->smallImage.key != c->smallImage.key) return false; - else if (p->smallImage.text != c->smallImage.text) return false; - else if (p->largeImage.key != c->largeImage.key) return false; - else if (p->largeImage.text != c->largeImage.text) return false; - else if (p->startTimestamp != c->startTimestamp) return false; - else if (p->endTimestamp != c->endTimestamp) return false; - return true; - } - */ }; extern struct config_t config; diff --git a/discord.cpp b/discord.cpp index b3592ba..de5e30c 100644 --- a/discord.cpp +++ b/discord.cpp @@ -68,16 +68,16 @@ void updatePresence(config_t* c) if (c->startTime >= 0) discordPresence.startTimestamp = (int64_t)c->startTime; if (c->endTime >= 0) discordPresence.endTimestamp = (int64_t)c->endTime; - // Make sure not to set the optional variables if they are not defined in the config + // make sure not to set the optional variables if they are not defined in the config if (c->smallImg.key.length() >= 1) discordPresence.smallImageKey = c->smallImg.key.c_str(); if (c->smallImg.text.length() >= 1) discordPresence.smallImageText = c->smallImg.text.c_str(); if (c->largeImg.text.length() >= 1) discordPresence.largeImageText = c->largeImg.text.c_str(); - //Actaully update the presence + // actaully update the presence Discord_UpdatePresence(&discordPresence); } -//Initialize Discord Rich Presence +// initialize discord rich presence void InitDiscord(std::string clientId) { DiscordEventHandlers handlers; diff --git a/main b/main new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/main @@ -0,0 +1 @@ + diff --git a/main.cpp b/main.cpp index 73023c0..96e5240 100644 --- a/main.cpp +++ b/main.cpp @@ -19,8 +19,6 @@ int main(void) signal(SIGBREAK, Shutdown); #endif - config_t prevConfig = config; - // start discord-rpc setPresenceVariables(CONFIG_PATH); InitDiscord(config.clientId); @@ -31,12 +29,10 @@ int main(void) if (setPresenceVariables(CONFIG_PATH) || force_update) { // print and set variables for the presence - printVariables(config); + printVariables(&config); updatePresence(&config); } if (force_update) force_update = false; -// prevConfig = config; -// setPresenceVariables(CONFIG_PATH); std::this_thread::sleep_for(std::chrono::milliseconds(5000)); } while(true);