annotate src/main.c @ 1:7abb5d8b20ea v1.0

Initial commit: part 2 I added a config GUI, and actual stuff to the README. The GUI was 'made' in Visual Studio, but I trimmed down the resource file because it had weird VS2010 skid marks all over it.
author Paper <mrpapersonic@gmail.com>
date Sun, 07 Aug 2022 10:23:10 -0400
parents d91dfd53b8b4
children 712c7fd6702a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
1 #include <assert.h>
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
2 #include <stdio.h>
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
3 #include <stdint.h>
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 #include <stdlib.h>
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 #include <time.h>
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
6 #include <Winamp/wa_ipc.h>
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
7 #include "main.h"
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
8 #include "discord_game_sdk.h"
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
9 #include "timer.h"
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
10 #include "config.h"
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
11 #include "dirtools.h"
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
12 #include "resource.h"
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
13 #ifndef WIN32_LEAN_AND_MEAN
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
14 # define WIN32_LEAN_AND_MEAN
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15 #endif
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 #include <windows.h>
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
17 #include <windowsx.h>
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
18
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19 #define CLIENT_ID 969367220599803955
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 #define DISCORD_REQUIRE(x) \
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21 assert(x == DiscordResult_Ok)
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
22
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
23 #define GPPHDR_VER 0x10
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
24
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
25 winamp_general_purpose_plugin g_plugin = {
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
26 GPPHDR_VER, // version of the plugin, defined in "gen_myplugin.h"
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
27 "Discord GameSDK", // name/title of the plugin, defined in "gen_myplugin.h"
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
28 init, // function name which will be executed on init event
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
29 conf, // function name which will be executed on config event
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
30 quit, // function name which will be executed on quit event
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
31 0, // handle to Winamp main window, loaded by winamp when this dll is loaded
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
32 0 // hinstance to this dll, loaded by winamp when this dll is loaded
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
33 };
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
34
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
35 WNDPROC g_lpWndProcOld = 0;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
36
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
37 struct timer_t timer_callbacks = { .interval = 16 };
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
38 struct config_t config = {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
39 .display_title = 1,
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
40 .show_elapsed_time = 1
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
41 };
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
42
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
43 struct DiscordActivity activity = {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
44 .application_id = CLIENT_ID,
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
45 .name = "Winamp",
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
46 .instance = 0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
47 };
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
48
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
49 struct IDiscordActivityEvents activities_events;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
50
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
51 struct app_t app;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
52
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
53 void update_activity_callback(void* data, enum EDiscordResult result)
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
54 {
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
55 DISCORD_REQUIRE(result);
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
56 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
57
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
58 void report_current_song_status(int playbackState)
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
59 {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
60 assert(playbackState != 0);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
61 activity.timestamps.start = 0;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
62 strcpy(activity.state, playbackState == 1 ? "(Playing)" : "(Paused)");
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
63
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
64 if (playbackState == 1 && config.show_elapsed_time) {
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
65 FILETIME ft;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
66 GetSystemTimeAsFileTime(&ft);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
67 ULARGE_INTEGER ul;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
68 ul.LowPart = ft.dwLowDateTime;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
69 ul.HighPart = ft.dwHighDateTime;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
70 long long dtn = ((ul.QuadPart - 116444736000000000ULL)/10000000);
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
71
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
72 activity.timestamps.start = dtn - SendMessage(g_plugin.hwndParent, WM_WA_IPC, 0, IPC_GETOUTPUTTIME) / 1000;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
73 } else {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
74 activity.timestamps.start = 0;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
75 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
76
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
77 char* detailsMessage = calloc(256, sizeof(char));
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
78 if (config.display_title) {
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
79 wchar_t* title = (wchar_t*)SendMessageW(g_plugin.hwndParent, WM_WA_IPC, 0, IPC_GET_PLAYING_TITLE);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
80 assert(WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, title, -1, detailsMessage, 256, NULL, NULL));
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
81 } else {
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
82 strcpy(activity.details, "");
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
83 }
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
84 strcpy(activity.details, detailsMessage);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
85 free(detailsMessage);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
86
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
87 app.activities->update_activity(app.activities, &activity, &app, update_activity_callback);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
88 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
89
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
90 void report_idle_status(void)
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
91 {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
92 activity.timestamps.start = 0;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
93 strcpy(activity.state, "(Idle)");
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
94
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
95 app.activities->update_activity(app.activities, &activity, &app, update_activity_callback);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
96 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
97
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
98 void update_rich_presence_details(void)
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
99 {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
100 LONG isPlayingResult = SendMessageW(g_plugin.hwndParent, WM_WA_IPC, 0, IPC_ISPLAYING);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
101
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
102 switch (isPlayingResult) {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
103 case 1:
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
104 report_current_song_status(1);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
105 break;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
106 case 3:
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
107 report_current_song_status(3);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
108 break;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
109 case 0:
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
110 report_idle_status();
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
111 break;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
112 default: break;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
113 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
114 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
115
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
116 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
117 {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
118 if (message == WM_WA_IPC && lParam == IPC_CB_MISC && wParam == IPC_CB_MISC_STATUS)
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
119 {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
120 update_rich_presence_details();
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
121 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
122
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
123 return CallWindowProc(g_lpWndProcOld, hwnd, message, wParam, lParam);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
124 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
125
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
126 int init() {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
127 char* path = dirtools_concat_paths(getenv("APPDATA"), "Winamp\\Plugins\\wgsdk");
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
128 printf("%s", path);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
129 memset(&app, 0, sizeof(app));
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
130 if (IsWindowUnicode(g_plugin.hwndParent)) {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
131 g_lpWndProcOld = (WNDPROC)SetWindowLongW(g_plugin.hwndParent, -4, (LONG)WndProc);
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
132 } else {
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
133 g_lpWndProcOld = (WNDPROC)SetWindowLongA(g_plugin.hwndParent, -4, (LONG)WndProc);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
134 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
135
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
136 memset(&activity, 0, sizeof(activity));
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
137 memset(&activities_events, 0, sizeof(activities_events));
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
138
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
139 struct DiscordCreateParams params;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
140 DiscordCreateParamsSetDefault(&params);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
141 params.client_id = CLIENT_ID;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
142 params.flags = DiscordCreateFlags_Default;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
143 params.event_data = &app;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
144 params.activity_events = &activities_events;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
145
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
146 DISCORD_REQUIRE(DiscordCreate(DISCORD_VERSION, &params, &app.core));
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
147
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
148 app.activities = app.core->get_activity_manager(app.core);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
149
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
150 timer_init(&timer_callbacks, g_plugin.hwndParent, TimerProc);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
151 timer_set(&timer_callbacks, g_plugin.hwndParent);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
152
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
153 cfg_load(&config);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
154
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
155 strcpy(activity.assets.large_image, "winamp-logo");
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
156
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
157 update_rich_presence_details();
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
158
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
159 return 0;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
160 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
161
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
162 void quit() {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
163 assert(!cfg_save(config));
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
164 app.activities->clear_activity(app.activities, &app, update_activity_callback);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
165 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
166
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
167 void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
168 DISCORD_REQUIRE(app.core->run_callbacks(app.core));
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
169 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
170
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
171 void conf() {
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
172 DialogBoxW(g_plugin.hDllInstance, (LPWSTR)DIALOG_CONFIG, g_plugin.hwndParent, &cfg_win_proc);
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
173 }
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
174
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
175 __declspec(dllexport) winamp_general_purpose_plugin* winampGetGeneralPurposePlugin() {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
176 return &g_plugin;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
177 }