Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
メンバ変数の初期化
Browse files Browse the repository at this point in the history
  • Loading branch information
noriokun4649 committed Oct 31, 2020
1 parent 97de64d commit 2163996
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions TvTestRPC/TvTestRPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class CMyPlugin : public TVTest::CTVTestPlugin
{
DiscordEventHandlers handlers;
DiscordEventHandlers handlers{};
static LRESULT CALLBACK EventCallback(UINT Event, LPARAM lParam1, LPARAM lParam2, void* pClientData);
static INT_PTR CALLBACK SettingsDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam, void* pClientData);
bool ShowDialog(HWND hwndOwner);
Expand Down Expand Up @@ -52,7 +52,6 @@ class CMyPlugin : public TVTest::CTVTestPlugin
}
};


bool CMyPlugin::InitSettings() {
::GetModuleFileName(g_hinstDLL, m_szIniFileName, MAX_PATH);
::PathRenameExtension(m_szIniFileName, TEXT(".ini"));
Expand All @@ -69,6 +68,8 @@ void CMyPlugin::InitDiscord()

void CMyPlugin::UpdateState()
{
DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence));
TVTest::ProgramInfo Info;
Info.Size = sizeof(Info);
wchar_t eventName[128];
Expand All @@ -82,13 +83,13 @@ void CMyPlugin::UpdateState()
Info.MaxEventExtText = sizeof(eventExtText) / sizeof(eventExtText[0]);
std::string channelName;
std::string eventNamed;
time_t start;
time_t end;

if (m_pApp->GetCurrentProgramInfo(&Info)) {
eventNamed = wide_to_utf8(Info.pszEventName);
end = SystemTime2Timet(Info.StartTime) + Info.Duration;
start = SystemTime2Timet(Info.StartTime);
time_t start = SystemTime2Timet(Info.StartTime);
time_t end = SystemTime2Timet(Info.StartTime) + Info.Duration;
discordPresence.startTimestamp = start;
discordPresence.endTimestamp = end;
}
if (!conf_mode) {
TVTest::ServiceInfo Service;
Expand All @@ -104,12 +105,8 @@ void CMyPlugin::UpdateState()
channelName = wide_to_utf8(ChannelInfo.szChannelName);
}
}
DiscordRichPresence discordPresence;
memset(&discordPresence, 0, sizeof(discordPresence));
discordPresence.details = channelName.c_str();
discordPresence.state = eventNamed.c_str();
discordPresence.startTimestamp = start;
discordPresence.endTimestamp = end;
discordPresence.largeImageKey = "tvtest";
discordPresence.partyId = "";
discordPresence.partySize = 0;
Expand All @@ -119,6 +116,7 @@ void CMyPlugin::UpdateState()
discordPresence.spectateSecret = "";
discordPresence.instance = 0;
Discord_UpdatePresence(&discordPresence);

}


Expand Down

0 comments on commit 2163996

Please sign in to comment.