Start gg client in separate binary
This commit is contained in:
parent
ce3a319f4f
commit
d210fb772c
8
Makefile
8
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
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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 */
|
46
main.c
46
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()
|
||||
|
|
|
@ -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()
|
Loading…
Reference in New Issue