-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
63e7bea
commit c1fb2ab
Showing
8 changed files
with
141 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
diff --git a/Makefile.emscripten b/Makefile.emscripten | ||
index 88637560b3..91303bbe2b 100644 | ||
--- a/Makefile.emscripten | ||
+++ b/Makefile.emscripten | ||
@@ -76,10 +76,11 @@ PRECISE_F32 = 1 | ||
OBJDIR := obj-emscripten | ||
|
||
#if you compile with SDL2 flag add this Emscripten flag "-s USE_SDL=2" to LDFLAGS: | ||
+EXPORTED_FUNCTIONS = "['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot', '_cmd_toggle_menu', '_cmd_toggle_grab_mouse', '_cmd_toggle_game_focus', '_cmd_reset', '_cmd_toggle_pause', '_cmd_pause', '_cmd_unpause', '_cmd_cheat_set_code', '_cmd_cheat_get_code', '_cmd_cheat_toggle_index', '_cmd_cheat_get_code_state', '_cmd_cheat_realloc', '_cmd_cheat_get_size', '_cmd_cheat_apply_cheats']" | ||
|
||
LIBS := -s USE_ZLIB=1 | ||
LDFLAGS := -L. --no-heap-copy -s $(LIBS) -s TOTAL_MEMORY=$(MEMORY) -s NO_EXIT_RUNTIME=0 -s FULL_ES2=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['callMain']" \ | ||
- -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS="['_main', '_malloc', '_cmd_savefiles', '_cmd_save_state', '_cmd_load_state', '_cmd_take_screenshot']" \ | ||
+ -s ALLOW_MEMORY_GROWTH=1 -s EXPORTED_FUNCTIONS=$(EXPORTED_FUNCTIONS) \ | ||
--js-library emscripten/library_errno_codes.js \ | ||
--js-library emscripten/library_rwebcam.js | ||
|
||
diff --git a/frontend/drivers/platform_emscripten.c b/frontend/drivers/platform_emscripten.c | ||
index c842a49854..05c7e812f5 100644 | ||
--- a/frontend/drivers/platform_emscripten.c | ||
+++ b/frontend/drivers/platform_emscripten.c | ||
@@ -46,6 +46,7 @@ | ||
#include "../../retroarch.h" | ||
#include "../../verbosity.h" | ||
#include "../../tasks/tasks_internal.h" | ||
+#include "../../cheat_manager.h" | ||
|
||
void dummyErrnoCodes(void); | ||
void emscripten_mainloop(void); | ||
@@ -70,6 +71,78 @@ void cmd_take_screenshot(void) | ||
command_event(CMD_EVENT_TAKE_SCREENSHOT, NULL); | ||
} | ||
|
||
+void cmd_toggle_menu(void) | ||
+{ | ||
+ command_event(CMD_EVENT_MENU_TOGGLE, NULL); | ||
+} | ||
+ | ||
+void cmd_toggle_grab_mouse(void) | ||
+{ | ||
+ command_event(CMD_EVENT_GRAB_MOUSE_TOGGLE, NULL); | ||
+} | ||
+ | ||
+void cmd_toggle_game_focus(void) | ||
+{ | ||
+ command_event(CMD_EVENT_GAME_FOCUS_TOGGLE, NULL); | ||
+} | ||
+ | ||
+void cmd_reset(void) | ||
+{ | ||
+ command_event(CMD_EVENT_RESET, NULL); | ||
+} | ||
+ | ||
+void cmd_toggle_pause(void) | ||
+{ | ||
+ command_event(CMD_EVENT_PAUSE_TOGGLE, NULL); | ||
+} | ||
+ | ||
+void cmd_pause(void) | ||
+{ | ||
+ command_event(CMD_EVENT_PAUSE, NULL); | ||
+} | ||
+ | ||
+void cmd_unpause(void) | ||
+{ | ||
+ command_event(CMD_EVENT_UNPAUSE, NULL); | ||
+} | ||
+ | ||
+// cheats | ||
+ | ||
+void cmd_cheat_set_code(unsigned index, const char *str) | ||
+{ | ||
+ cheat_manager_set_code(index, str); | ||
+} | ||
+ | ||
+const char *cmd_cheat_get_code(unsigned index) | ||
+{ | ||
+ return cheat_manager_get_code(index); | ||
+} | ||
+ | ||
+void cmd_cheat_toggle_index(bool apply_cheats_after_toggle, unsigned index) | ||
+{ | ||
+ cheat_manager_toggle_index(apply_cheats_after_toggle, index); | ||
+} | ||
+ | ||
+bool cmd_cheat_get_code_state(unsigned index) | ||
+{ | ||
+ return cheat_manager_get_code_state(index); | ||
+} | ||
+ | ||
+bool cmd_cheat_realloc(unsigned new_size) | ||
+{ | ||
+ return cheat_manager_realloc(new_size, CHEAT_HANDLER_TYPE_EMU); | ||
+} | ||
+ | ||
+unsigned cmd_cheat_get_size(void) | ||
+{ | ||
+ return cheat_manager_get_size(); | ||
+} | ||
+ | ||
+void cmd_cheat_apply_cheats(void) | ||
+{ | ||
+ cheat_manager_apply_cheats(); | ||
+} | ||
+ | ||
static void frontend_emscripten_get_env(int *argc, char *argv[], | ||
void *args, void *params_data) | ||
{ | ||
diff --git a/tasks/task_save.c b/tasks/task_save.c | ||
index 08bcf1f67f..b2edfab4aa 100644 | ||
--- a/tasks/task_save.c | ||
+++ b/tasks/task_save.c | ||
@@ -62,8 +62,8 @@ | ||
#include "../cheat_manager.h" | ||
#endif | ||
|
||
-#if defined(HAVE_LIBNX) || defined(_3DS) | ||
-#define SAVE_STATE_CHUNK 4096 * 10 | ||
+#if defined(HAVE_LIBNX) || defined(_3DS) || defined(EMSCRIPTEN) | ||
+#define SAVE_STATE_CHUNK 4096 * 1000 | ||
#else | ||
#define SAVE_STATE_CHUNK 4096 | ||
#endif |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
wd=$(pwd) | ||
retroarch_dir=$wd/modules/retroarch | ||
|
||
cd "$retroarch_dir" | ||
git checkout -f | ||
git apply "$wd/patches/retroarch.patch" |
This file was deleted.
Oops, something went wrong.