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 4051f78cd11302e178a1968beeb9458d875e96f9
Author: Nekobit <m...@ow.nekobit.net>
AuthorDate: Wed Sep 13 16:51:29 2023 -0400
Use ecore_exe_run
---
.#main.c | 1 +
main.c | 42 +++++++++++++++++-------------------------
replay.c | 39 +++++++++++++++++++--------------------
3 files changed, 37 insertions(+), 45 deletions(-)
diff --git a/.#main.c b/.#main.c
new file mode 120000
index 0000000..e5f2555
--- /dev/null
+++ b/.#main.c
@@ -0,0 +1 @@
+nekobit@here.2542
\ No newline at end of file
diff --git a/main.c b/main.c
index 9a4080f..c45f3e2 100644
--- a/main.c
+++ b/main.c
@@ -15,6 +15,7 @@ char* game_path = "SSBM.iso";
char* dolphin_emu_file = "slippi-netplay-dolphin";
char* dolphin_replay_file = "slippi-playback-dolphin";
+Ecore_Exe* dolphin_netplay_exe;
Evas_Object* mainer;
Evas_Object* win;
Evas_Object* _tab_curr;
@@ -106,28 +107,12 @@ void _prev_tab_cb(void *_data, Evas_Object *obj EINA_UNUSED, void *event_info EI
void _next_tab_cb(void *_data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{ next_tab(); }
-void
-_launch_slippi_job_end_cb(void *data, Ecore_Thread *thread)
+Eina_Bool
+_launch_restore_btn(void* data)
{
- //Re-enable button so we can start again
if (data)
elm_object_disabled_set(data, EINA_FALSE);
-}
-
-// Need to fork in a thread or EFL spergs out
-void
-_launch_slippi_job_cb(void *data, Ecore_Thread *thread)
-{
- char const* argv[64] = {dolphin_emu_file, "-e", game_path, "-b", NULL};
- if (fork() == 0)
- {
- execvp(argv[0], argv);
- exit(0);
- }
- else {
- // Delay thread to prevent from launching again (button is disabled)
- usleep(2000000);
- }
+ return ECORE_CALLBACK_CANCEL;
}
void
@@ -135,18 +120,25 @@ _launch_slippi_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EIN
{
if (data)
elm_object_disabled_set(data, EINA_TRUE);
- ecore_thread_run(_launch_slippi_job_cb,
- _launch_slippi_job_end_cb,
- _launch_slippi_job_end_cb, data);
+
+ ecore_timer_add(3, _launch_restore_btn, data);
+
+ Eina_Strbuf* exe = eina_strbuf_new();
+ eina_strbuf_append_printf(exe, "%s -e %s -b", dolphin_emu_file, game_path);
+ dolphin_netplay_exe = ecore_exe_run(eina_strbuf_release(exe), data);
+ //ecore_exe_callback_pre_free_set(exe, _launch_restore_btn);
+ //ecore_thread_run(_launch_slippi_job_cb,
+ // _launch_slippi_job_end_cb,
+ // _launch_slippi_job_end_cb, data);
}
static void
_replays_tab_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
elm_object_item_disabled_set(*(Elm_Object_Item**)data, EINA_TRUE);
- ecore_thread_run(_launch_slippi_job_cb,
- _launch_slippi_job_end_cb,
- _launch_slippi_job_end_cb, data);
+ //ecore_thread_run(_launch_slippi_job_cb,
+ // _launch_slippi_job_end_cb,
+ // _launch_slippi_job_end_cb, data);
}
diff --git a/replay.c b/replay.c
index 3a94539..14bab95 100644
--- a/replay.c
+++ b/replay.c
@@ -8,6 +8,8 @@
Evas_Object* tab_replays = NULL;
char* replays_dir = "replays/";
+Ecore_Exe* dolphin_replay_exe;
+extern char* dolphin_replay_file, *game_path;
struct replay
{
@@ -20,6 +22,14 @@ struct replay
}* replays = NULL;
size_t replays_len = 0;
+void
+_launch_slippi_cb(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED);
+
+Eina_Bool
+_launch_restore_btn(void* data);
+
unsigned
dec_uint_be(unsigned char* arr, size_t len)
{
@@ -202,27 +212,18 @@ replays_strings(void* data, Evas_Object* obj, const char* part)
return NULL;
}
-// Need to fork in a thread or EFL spergs out
-void
-_launch_replay_job_cb(void *data, Ecore_Thread *thread)
-{
- extern char* dolphin_replay_file;
- extern char* game_path;
- char const* argv[] = {dolphin_replay_file, "-e", game_path, "-i", "play.json", "-b", NULL};
- if (fork() == 0)
- {
- execvp(argv[0], argv);
- exit(0);
- }
-}
static void
_launch_replay_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
- elm_object_disabled_set(data, EINA_TRUE);
- ecore_thread_run(_launch_replay_job_cb,
- NULL,
- NULL, data);
+ //if (data)
+ // elm_object_disabled_set(data, EINA_TRUE);
+
+ //ecore_timer_add(3, _launch_restore_btn, data);
+
+ Eina_Strbuf* exe = eina_strbuf_new();
+ eina_strbuf_append_printf(exe, "%s -e %s -i play.json -b", dolphin_replay_file, game_path);
+ dolphin_replay_exe = ecore_exe_run(eina_strbuf_release(exe), data);
}
static void
@@ -237,9 +238,7 @@ _item_select_cb(void *data, Evas_Object *obj, void *event_info)
fwrite(jason, 1, strlen(jason), outfile);
fclose(outfile);
- ecore_thread_run(_launch_replay_job_cb,
- NULL,
- NULL, data);
+ _launch_replay_cb(obj, obj, NULL);
free(jason);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.