@@ -59,53 +59,81 @@ static DiscordActivity CreatePresence(
59
59
}
60
60
}
61
61
62
- // サービスデータがあるならサービス名を付与する
63
- if (Service.has_value ())
64
- {
65
- // const wchar_t* → wchar_t*
66
- // const auto rawServiceName = const_cast<LPWSTR>(Service.value().szServiceName);
67
- wchar_t serviceName[ServiceNameLength] = {};
62
+ // サービス名を assets.large_text に設定
63
+ if (Config.ShowChannelLogo ) {
64
+ if (Service.has_value ())
65
+ {
66
+ // const wchar_t* → wchar_t*
67
+ // const auto rawServiceName = const_cast<LPWSTR>(Service.value().szServiceName);
68
+ wchar_t serviceName[ServiceNameLength] = {};
69
+
70
+ if (const auto rawServiceName = Service.value ().szServiceName ; !IsBlank (rawServiceName, ServiceNameLength))
71
+ {
72
+ wcsncpy_s (serviceName, rawServiceName, ServiceNameLength);
73
+
74
+ // 半角変換
75
+ if (Config.ConvertToHalfWidth )
76
+ {
77
+ Full2Half (serviceName);
78
+ }
79
+
80
+ wcstombs_s (nullptr , Activity.assets .large_text , serviceName, ServiceNameLength - 1 );
81
+ }
82
+ }
68
83
69
- if (const auto rawServiceName = Service. value (). szServiceName ; ! IsBlank (rawServiceName, ServiceNameLength) )
84
+ if (Channel. has_value () && strlen (Activity. assets . large_text ) == 0 )
70
85
{
71
- wcsncpy_s (serviceName, rawServiceName, ServiceNameLength);
86
+ wchar_t channelName[ChannelNameLength] = {};
87
+ const auto rawChannelName = Channel.value ().szChannelName ;
88
+ wcsncpy_s (channelName, !IsBlank (rawChannelName, ChannelNameLength) ? rawChannelName : L" 取得中…" , ChannelNameLength);
72
89
73
90
// 半角変換
74
91
if (Config.ConvertToHalfWidth )
75
92
{
76
- Full2Half (serviceName );
93
+ Full2Half (channelName );
77
94
}
78
95
79
- wcstombs_s (nullptr , Activity.details , serviceName, ServiceNameLength - 1 );
96
+ wcstombs_s (nullptr , Activity.assets . large_text , channelName, ChannelNameLength - 1 );
80
97
}
81
98
}
82
- if (Channel.has_value () && strlen (Activity.details ) == 0 )
83
- {
84
- wchar_t channelName[ChannelNameLength] = {};
85
- const auto rawChannelName = Channel.value ().szChannelName ;
86
- wcsncpy_s (channelName, !IsBlank (rawChannelName, ChannelNameLength) ? rawChannelName : L" 取得中…" , ChannelNameLength);
87
99
88
- // 半角変換
89
- if (Config.ConvertToHalfWidth )
100
+ // 番組名を details に設定
101
+ if (Program.has_value ())
102
+ {
103
+ if (const auto rawEventName = Program.value ().pszEventName ; !IsBlank (rawEventName, MaxStateLength))
90
104
{
91
- Full2Half (channelName);
92
- }
105
+ // 半角変換
106
+ if (Config.ConvertToHalfWidth )
107
+ {
108
+ Full2Half (rawEventName);
109
+ }
93
110
94
- wcstombs_s (nullptr , Activity.details , channelName, ChannelNameLength - 1 );
111
+ wcstombs_s (nullptr , Activity.details , rawEventName, MaxStateLength - 1 );
112
+ }
95
113
}
96
114
97
- // 番組データがあるなら番組名を付与する
115
+ // 番組説明を state に設定
98
116
if (Program.has_value ())
99
117
{
100
- if (const auto rawEventName = Program.value ().pszEventName ; ! IsBlank (rawEventName, MaxStateLength ))
118
+ if (const auto rawEventText = Program.value ().pszEventText ; rawEventText != nullptr && ! IsBlank (rawEventText, MaxImageTextLength ))
101
119
{
102
120
// 半角変換
103
121
if (Config.ConvertToHalfWidth )
104
122
{
105
- Full2Half (rawEventName );
123
+ Full2Half (rawEventText );
106
124
}
107
125
108
- wcstombs_s (nullptr , Activity.state , rawEventName, MaxStateLength - 1 );
126
+ wcstombs_s (nullptr , Activity.state , rawEventText, MaxImageTextLength - 1 );
127
+ }
128
+ else if (const auto rawEventExtText = Program.value ().pszEventExtText ; rawEventExtText != nullptr && !IsBlank (rawEventExtText, MaxImageTextLength))
129
+ {
130
+ // 半角変換
131
+ if (Config.ConvertToHalfWidth )
132
+ {
133
+ Full2Half (rawEventExtText);
134
+ }
135
+
136
+ wcstombs_s (nullptr , Activity.state , rawEventExtText, MaxImageTextLength - 1 );
109
137
}
110
138
}
111
139
@@ -126,31 +154,6 @@ static DiscordActivity CreatePresence(
126
154
127
155
const auto logoKey = Config.Logos .count (serviceId) > 0 ? Config.Logos [serviceId].c_str () : GetServiceLogoKey (TuningSpace, serviceId, serviceName);
128
156
strcpy_s (Activity.assets .large_image , logoKey);
129
-
130
- // 番組データがあるなら番組説明を付与する
131
- if (Program.has_value ())
132
- {
133
- if (const auto rawEventText = Program.value ().pszEventText ; rawEventText != nullptr && !IsBlank (rawEventText, MaxImageTextLength))
134
- {
135
- // 半角変換
136
- if (Config.ConvertToHalfWidth )
137
- {
138
- Full2Half (rawEventText);
139
- }
140
-
141
- wcstombs_s (nullptr , Activity.assets .large_text , rawEventText, MaxImageTextLength - 1 );
142
- }
143
- else if (const auto rawEventExtText = Program.value ().pszEventExtText ; rawEventExtText != nullptr && !IsBlank (rawEventExtText, MaxImageTextLength))
144
- {
145
- // 半角変換
146
- if (Config.ConvertToHalfWidth )
147
- {
148
- Full2Half (rawEventExtText);
149
- }
150
-
151
- wcstombs_s (nullptr , Activity.assets .large_text , rawEventExtText, MaxImageTextLength - 1 );
152
- }
153
- }
154
157
}
155
158
156
159
// バージョン情報を付与する
0 commit comments