annotate src/main.c @ 10:42ac054c0231

*: huge refactoring dirtools now uses wchar (wayyy overdue) the timer doesn't have a stupid design anymore we don't use windows.h at all now ...
author Paper <paper@paper.us.eu.org>
date Sun, 11 Feb 2024 19:43:31 -0500
parents be4835547dd0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
1 /**
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
2 * wgsdk - Winamp plugin for Discord's GameSDK
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
3 **/
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
4 #include "timer.h"
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
5 #include "config.h"
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
6 #include "resource.h"
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
7 #include "utils.h"
10
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
8
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
9 #include <Winamp/wa_ipc.h>
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
10 #include "discord_game_sdk.h"
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
11
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
12 #include <assert.h>
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
13 #include <stdio.h>
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
14 #include <stdlib.h>
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
15
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
16 #define CLIENT_ID 969367220599803955
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
17 #define DISCORD_REQUIRE(x) \
10
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
18 assert((x) == DiscordResult_Ok)
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
19
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
20 #define GPPHDR_VER 0x10
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
21
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
22 int init();
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
23 void conf();
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
24 void quit();
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
25
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
26 /* Winamp-specific stuff */
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
27 struct winamp_gpp {
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
28 int version; // version of the plugin structure
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
29 char *description; // name/title of the plugin
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
30 int(*init)(); // function which will be executed on init event
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
31 void(*conf)(); // function which will be executed on config event
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
32 void(*quit)(); // function which will be executed on quit event
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
33 HWND hwndParent; // hwnd of the Winamp client main window (stored by Winamp when dll is loaded)
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
34 HINSTANCE hDllInstance; // hinstance of this plugin DLL. (stored by Winamp when dll is loaded)
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
35 };
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
36
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
37 struct winamp_gpp g_plugin = {
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
38 GPPHDR_VER, // version of the plugin, defined in "gen_myplugin.h"
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
39 "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
40 init, // function name which will be executed on init event
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
41 conf, // function name which will be executed on config event
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
42 quit, // function name which will be executed on quit event
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
43 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
44 0 // hinstance to this dll, loaded by winamp when this dll is loaded
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
45 };
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
46
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
47 /* Discord stuff */
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
48
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
49 struct DiscordActivity activity = {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
50 .application_id = CLIENT_ID,
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
51 .name = "Winamp",
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
52 .instance = 0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
53 };
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
54
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
55 struct IDiscordActivityEvents activities_events;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
56
10
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
57 struct {
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
58 struct IDiscordCore* core;
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
59 struct IDiscordUsers* users;
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
60 struct IDiscordActivityManager* activities;
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
61 } app;
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
62
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
63 /* Now we get to our built-in stuff */
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
64
10
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
65 struct timer timer_callbacks = {0};
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
66
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
67 struct config config = {
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
68 .display_title = 1,
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
69 .show_elapsed_time = 1
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
70 };
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
71
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
72 /* CallWindowProc is the *only* function that ever needs this. */
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
73 WNDPROC _old_wnd_proc = 0;
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
74
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
75 /* ------------------------------------ */
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
76
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
77 void DISCORD_CALLBACK update_activity_callback(void* data, enum EDiscordResult result) {
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
78 DISCORD_REQUIRE(result);
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
79 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
80
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
81 void report_current_song_status(int playback_state) {
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
82 assert(playback_state != 0);
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
83 strcpy(activity.state, playback_state == 1 ? "(Playing)" : "(Paused)");
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
84
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
85 activity.timestamps.start = (playback_state == 1 && config.show_elapsed_time)
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
86 ? get_system_time_in_milliseconds() - SendMessage(g_plugin.hwndParent, WM_WA_IPC, 0, IPC_GETOUTPUTTIME) / 1000
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
87 : 0;
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
88
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
89 if (config.display_title) {
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
90 wchar_t* title = (wchar_t*)SendMessageW(g_plugin.hwndParent, WM_WA_IPC, 0, IPC_GET_PLAYING_TITLE);
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
91 assert(WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, title, -1, activity.details, 256, NULL, NULL));
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
92 }
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
93
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
94 app.activities->update_activity(app.activities, &activity, &app, update_activity_callback);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
95 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
96
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
97 void report_idle_status(void)
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
98 {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
99 activity.timestamps.start = 0;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
100 strcpy(activity.state, "(Idle)");
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
101
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
102 app.activities->update_activity(app.activities, &activity, &app, update_activity_callback);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
103 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
104
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
105 void update_rich_presence_details(void)
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
106 {
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
107 LONG is_playing = SendMessageW(g_plugin.hwndParent, WM_WA_IPC, 0, IPC_ISPLAYING);
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
108
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
109 switch (is_playing) {
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
110 case 0:
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
111 report_idle_status();
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
112 break;
4
59bf702b2b21 *: stylistic changes
Paper <mrpapersonic@gmail.com>
parents: 2
diff changeset
113 case 1:
59bf702b2b21 *: stylistic changes
Paper <mrpapersonic@gmail.com>
parents: 2
diff changeset
114 case 3:
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
115 report_current_song_status(is_playing);
10
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
116 break;
4
59bf702b2b21 *: stylistic changes
Paper <mrpapersonic@gmail.com>
parents: 2
diff changeset
117 default:
59bf702b2b21 *: stylistic changes
Paper <mrpapersonic@gmail.com>
parents: 2
diff changeset
118 break;
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
119 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
120 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
121
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
122 void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) {
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
123 DISCORD_REQUIRE(app.core->run_callbacks(app.core));
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
124 }
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
125
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
126 LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
127 if (message == WM_WA_IPC && lParam == IPC_CB_MISC && wParam == IPC_CB_MISC_STATUS)
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
128 update_rich_presence_details();
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
129
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
130 return CallWindowProc(_old_wnd_proc, hwnd, message, wParam, lParam);
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
131 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
132
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
133 #define set_wnd_long(x) \
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
134 (WNDPROC)SetWindowLong##x(g_plugin.hwndParent, GWLP_WNDPROC, (LONG)WndProc)
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
135 int init() {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
136 memset(&app, 0, sizeof(app));
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
137 memset(&activity, 0, sizeof(activity));
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
138 memset(&activities_events, 0, sizeof(activities_events));
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
139
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
140 if (IsWindowUnicode(g_plugin.hwndParent))
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
141 _old_wnd_proc = set_wnd_long(W);
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
142 else
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
143 _old_wnd_proc = set_wnd_long(A);
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
144
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
145 struct DiscordCreateParams params;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
146 DiscordCreateParamsSetDefault(&params);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
147 params.client_id = CLIENT_ID;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
148 params.flags = DiscordCreateFlags_Default;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
149 params.event_data = &app;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
150 params.activity_events = &activities_events;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
151
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
152 DISCORD_REQUIRE(DiscordCreate(DISCORD_VERSION, &params, &app.core));
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
153
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
154 app.activities = app.core->get_activity_manager(app.core);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
155
10
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
156 timer_init(&timer_callbacks, 16, TimerProc);
42ac054c0231 *: huge refactoring
Paper <paper@paper.us.eu.org>
parents: 7
diff changeset
157 timer_set(&timer_callbacks);
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
158
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
159 cfg_load(&config);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
160
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
161 strcpy(activity.assets.large_image, "winamp-logo");
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
162
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
163 update_rich_presence_details();
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
164
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
165 return 0;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
166 }
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
167 #undef set_wnd_long
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
168
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
169 void quit() {
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
170 assert(!cfg_save(config));
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
171 app.activities->clear_activity(app.activities, &app, update_activity_callback);
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
172 }
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
173
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
174 void conf() {
4
59bf702b2b21 *: stylistic changes
Paper <mrpapersonic@gmail.com>
parents: 2
diff changeset
175 DialogBoxW(g_plugin.hDllInstance, (LPWSTR)DIALOG_CONFIG, g_plugin.hwndParent, (DLGPROC)cfg_win_proc);
1
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
176 }
7abb5d8b20ea Initial commit: part 2
Paper <mrpapersonic@gmail.com>
parents: 0
diff changeset
177
7
be4835547dd0 clean up code, convert git files to hg, etc.
Paper
parents: 4
diff changeset
178 __declspec(dllexport) struct winamp_gpp* winampGetGeneralPurposePlugin() {
0
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
179 return &g_plugin;
d91dfd53b8b4 Initial commit
Paper <mrpapersonic@gmail.com>
parents:
diff changeset
180 }