diff 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
line wrap: on
line diff
--- a/src/main.c	Fri Dec 16 21:55:37 2022 -0500
+++ b/src/main.c	Sun Feb 11 19:43:31 2024 -0500
@@ -1,24 +1,21 @@
 /**
  * wgsdk - Winamp plugin for Discord's GameSDK
 **/
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <Winamp/wa_ipc.h>
-#include "discord_game_sdk.h"
 #include "timer.h"
 #include "config.h"
 #include "resource.h"
 #include "utils.h"
-#ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN
-#endif
-#include <windows.h>
-#include <windowsx.h>
+
+#include <Winamp/wa_ipc.h>
+#include "discord_game_sdk.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
 
 #define CLIENT_ID 969367220599803955
 #define DISCORD_REQUIRE(x) \
-	assert(x == DiscordResult_Ok)
+	assert((x) == DiscordResult_Ok)
 
 #define GPPHDR_VER 0x10
 
@@ -57,7 +54,7 @@
 
 struct IDiscordActivityEvents activities_events;
 
-struct application {
+struct {
     struct IDiscordCore* core;
     struct IDiscordUsers* users;
 	struct IDiscordActivityManager* activities;
@@ -65,7 +62,7 @@
 
 /* Now we get to our built-in stuff */
 
-struct timer timer_callbacks = { .interval = 16 };
+struct timer timer_callbacks = {0};
 
 struct config config = {
 	.display_title = 1,
@@ -116,6 +113,7 @@
 		case 1:
 		case 3:
 			report_current_song_status(is_playing);
+			break;
 		default:
 			break;
 	}
@@ -155,8 +153,8 @@
 
 	app.activities = app.core->get_activity_manager(app.core);
 
-	timer_init(&timer_callbacks, g_plugin.hwndParent, TimerProc);
-	timer_set(&timer_callbacks, g_plugin.hwndParent);
+	timer_init(&timer_callbacks, 16, TimerProc);
+	timer_set(&timer_callbacks);
 
 	cfg_load(&config);