This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository minilauncher-for-slippi.

View the commit online.

commit d210fb772c9b8b5a7f0a2804d632d574003f2d69
Author: Nekobit <m...@ow.nekobit.net>
AuthorDate: Mon Sep 18 01:14:16 2023 -0400

    Start gg client in separate binary
---
 Makefile           |  8 ++++++--
 config.c           | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 config.h           | 19 +++++++++++++++++++
 main.c             | 46 ++--------------------------------------------
 main_ministartgg.c | 30 ++++++++++++++++++++++++++++++
 5 files changed, 105 insertions(+), 46 deletions(-)

diff --git a/Makefile b/Makefile
index 5934c44..ce9a1a3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,8 @@
 CC=cc
 CFLAGS=--std=c99 -g `pkg-config --cflags efl ecore elementary libusb-1.0` `sdl2-config --cflags` 
 LDFLAGS=`pkg-config --libs efl ecore elementary libusb-1.0` `sdl2-config --libs` -lcjson
-OBJS=main.o replay.o home.o input.o http.o gg.o
+OBJS=main.o replay.o home.o input.o http.o gg.o config.o
+OBJS_GG=main_ministartgg.o http.o gg.o config.o
 CHEAD=static/tourney_query.json
 CHEAD_C=static/tourney_query.json.h
 
@@ -16,5 +17,8 @@ $(CHEAD_C): $(CHEAD)
 minilauncher4slippi: $(OBJS)
 	$(CC) -o minilauncher4slippi $(OBJS) $(LDFLAGS)
 
+ministartgg: $(OBJS_GG)
+	$(CC) -o ministartgg $(OBJS_GG) $(LDFLAGS)
+	
 clean:
-	rm -f minilauncher4slippi filec *.o static/*.h
+	rm -f minilauncher4slippi ministartgg filec *.o static/*.h
diff --git a/config.c b/config.c
new file mode 100644
index 0000000..6301fba
--- /dev/null
+++ b/config.c
@@ -0,0 +1,48 @@
+#include <stdio.h>
+#include <Ecore.h>
+#include <Elementary.h>
+#include "config.h"
+
+char* game_path = "SSBM.iso";
+char* dolphin_emu_file = "slippi-netplay-dolphin";
+char* dolphin_replay_file = "slippi-playback-dolphin";
+char* start_gg_api = ":^)";
+
+int
+parse_config(char* file)
+{
+	FILE* CFG = fopen(file, "r");
+	if (!CFG)
+	{	
+		perror("fopen");
+		return 1;
+	}
+	
+	int buf_len = 255;
+	char buf[buf_len];
+	char* rdpnt;
+	for (int i = 0; fgets(buf, buf_len, CFG); ++i) {
+		if ((rdpnt = strchr(buf, '\n')))
+			*rdpnt = '\0';
+		switch (i)
+		{
+		case 0: game_path = strdup(buf); break;
+		case 1: dolphin_emu_file = strdup(buf); break;
+		case 2: dolphin_replay_file = strdup(buf); break;
+		case 3: start_gg_api = strdup(buf); break;
+		}
+    	++opt_mallocd;
+    }
+abort:	
+	fclose(CFG);
+	return 0;
+}
+
+void
+cleanup_config(void)
+{
+	if (opt_mallocd >= 0) free(game_path);
+	if (opt_mallocd >= 1) free(dolphin_emu_file);
+	if (opt_mallocd >= 2) free(dolphin_replay_file);
+	if (opt_mallocd >= 3) free(start_gg_api);
+}
diff --git a/config.h b/config.h
new file mode 100644
index 0000000..997ad43
--- /dev/null
+++ b/config.h
@@ -0,0 +1,19 @@
+#ifndef CONFIG_H
+#define CONFIG_H
+
+static int opt_mallocd = -1;
+extern char* game_path;
+extern char* dolphin_emu_file;
+extern char* dolphin_replay_file;
+extern char* start_gg_api;
+#ifndef DATA_DIR
+#define DATA_DIR "data/"
+#endif
+
+int
+parse_config(char* file);
+
+void
+cleanup_config(void);
+
+#endif /* CONFIG_H */
diff --git a/main.c b/main.c
index 0e1d019..1faa090 100644
--- a/main.c
+++ b/main.c
@@ -8,15 +8,8 @@
 #ifndef NO_SDL_INPUT
 #	include "input.h"
 #endif
+#include "config.h"
 
-int opt_mallocd = -1;
-char* game_path = "SSBM.iso";
-char* dolphin_emu_file = "slippi-netplay-dolphin";
-char* dolphin_replay_file = "slippi-playback-dolphin";
-char* start_gg_api = ":^)";
-#ifndef DATA_DIR
-#define DATA_DIR "data/"
-#endif
 
 Ecore_Exe* dolphin_netplay_exe;
 Evas_Object* mainer;
@@ -55,36 +48,6 @@ next_tab()
 	update_tab(_tabs[_tabs_i]);
 }
 
-int
-parse_config(char* file)
-{
-	FILE* CFG = fopen(file, "r");
-	if (!CFG)
-	{	
-		perror("fopen");
-		return 1;
-	}
-	
-	int buf_len = 255;
-	char buf[buf_len];
-	char* rdpnt;
-	for (int i = 0; fgets(buf, buf_len, CFG); ++i) {
-		if ((rdpnt = strchr(buf, '\n')))
-			*rdpnt = '\0';
-		switch (i)
-		{
-		case 0: game_path = strdup(buf); break;
-		case 1: dolphin_emu_file = strdup(buf); break;
-		case 2: dolphin_replay_file = strdup(buf); break;
-		case 3: start_gg_api = strdup(buf); break;
-		}
-    	++opt_mallocd;
-    }
-abort:	
-	fclose(CFG);
-	return 0;
-}
-
 void
 update_tab(Evas_Object* newtab)
 {
@@ -199,8 +162,6 @@ elm_main(int argc, char **argv)
 	
 	elm_win_resize_object_add(win, main);
 	evas_object_show(main);
-	elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
-	elm_win_focus_highlight_animate_set(win, EINA_TRUE);
 	// Check for a 'b' character, aka big picture mode, big mode, whatever..
 	int bigmode = 0;
 	if (argc > 1 && argv[1] && tolower(argv[1][0]) == 'b')
@@ -323,10 +284,7 @@ elm_main(int argc, char **argv)
 	
 	elm_run();
 	
-	if (opt_mallocd >= 0) free(game_path);
-	if (opt_mallocd >= 1) free(dolphin_emu_file);
-	if (opt_mallocd >= 2) free(dolphin_replay_file);
-	if (opt_mallocd >= 3) free(start_gg_api);
+	cleanup_config();
 	return 0;
 }
 ELM_MAIN()
diff --git a/main_ministartgg.c b/main_ministartgg.c
new file mode 100644
index 0000000..c3cd961
--- /dev/null
+++ b/main_ministartgg.c
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#define EFL_BETA_API_SUPPORT
+#include <Ecore.h>
+#include <Elementary.h>
+#include <libusb.h>
+#include "gg.h"
+#include "http.h"
+#include "config.h"
+
+EAPI_MAIN int
+elm_main(int argc, char **argv)
+{
+	parse_config("minilauncher4slippi.cfg");
+	
+	Evas_Object* win = elm_win_util_standard_add("ministartgg", "Ministartgg");
+	elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
+	elm_win_autodel_set(win, EINA_TRUE);
+
+	Evas_Object* main = gg_create_view(win);
+	evas_object_show(main);
+	elm_win_resize_object_add(win, main);
+
+	evas_object_resize(win, 520 * elm_config_scale_get(),
+    	                    300 * elm_config_scale_get());
+	evas_object_show(win);
+	elm_run();
+
+	cleanup_config();
+}
+ELM_MAIN()

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to