From be6ddfa6d0ccb72e53352496aeb7c0c0c825a287 Mon Sep 17 00:00:00 2001 From: radius Date: Sun, 28 Aug 2016 23:21:29 -0500 Subject: [PATCH] add default menu content --- configuration.c | 4 ++++ defaults.h | 1 + frontend/drivers/platform_emscripten.c | 20 ++++---------------- pkg/emscripten/webplayer.js | 4 +++- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/configuration.c b/configuration.c index a79bd178e6..a2a110822f 100644 --- a/configuration.c +++ b/configuration.c @@ -930,6 +930,10 @@ static void config_set_defaults(void) strlcpy(settings->directory.menu_config, g_defaults.dir.menu_config, sizeof(settings->directory.menu_config)); + if (!string_is_empty(g_defaults.dir.menu_content)) + strlcpy(settings->directory.menu_content, + g_defaults.dir.menu_content, + sizeof(settings->directory.menu_content)); #endif if (!string_is_empty(g_defaults.dir.autoconfig)) strlcpy(settings->directory.autoconfig, diff --git a/defaults.h b/defaults.h index 1db1e01e98..fb42f84502 100644 --- a/defaults.h +++ b/defaults.h @@ -52,6 +52,7 @@ struct defaults struct { + char menu_content[PATH_MAX_LENGTH]; char core_assets[PATH_MAX_LENGTH]; char menu_config[PATH_MAX_LENGTH]; char autoconfig[PATH_MAX_LENGTH]; diff --git a/frontend/drivers/platform_emscripten.c b/frontend/drivers/platform_emscripten.c index dca5de9b47..e1f1dcd92b 100644 --- a/frontend/drivers/platform_emscripten.c +++ b/frontend/drivers/platform_emscripten.c @@ -95,22 +95,6 @@ static void frontend_emscripten_get_env(int *argc, char *argv[], fill_pathname_join(g_defaults.dir.autoconfig, base_path, "autoconfig", sizeof(g_defaults.dir.autoconfig)); - if (path_is_directory("/usr/local/share/retroarch/assets")) - fill_pathname_join(g_defaults.dir.assets, "/usr/local/share/retroarch", - "assets", sizeof(g_defaults.dir.assets)); - else if (path_is_directory("/usr/share/retroarch/assets")) - fill_pathname_join(g_defaults.dir.assets, "/usr/share/retroarch", - "assets", sizeof(g_defaults.dir.assets)); - else if (path_is_directory("/usr/local/share/games/retroarch/assets")) - fill_pathname_join(g_defaults.dir.assets, "/usr/local/share/games/retroarch", - "assets", sizeof(g_defaults.dir.assets)); - else if (path_is_directory("/usr/share/games/retroarch/assets")) - fill_pathname_join(g_defaults.dir.assets, "/usr/share/games/retroarch", - "assets", sizeof(g_defaults.dir.assets)); - else - fill_pathname_join(g_defaults.dir.assets, base_path, - "assets", sizeof(g_defaults.dir.assets)); - fill_pathname_join(g_defaults.dir.menu_config, base_path, "config", sizeof(g_defaults.dir.menu_config)); fill_pathname_join(g_defaults.dir.remap, g_defaults.dir.menu_config, @@ -135,6 +119,10 @@ static void frontend_emscripten_get_env(int *argc, char *argv[], "screenshots", sizeof(g_defaults.dir.screenshot)); fill_pathname_join(g_defaults.dir.thumbnails, base_path, "thumbnails", sizeof(g_defaults.dir.thumbnails)); + fill_pathname_join(g_defaults.dir.thumbnails, "/", + "content", sizeof(g_defaults.dir.thumbnails)); + fill_pathname_join(g_defaults.dir.assets, "/", + "assets", sizeof(g_defaults.dir.assets)); snprintf(g_defaults.settings.menu, sizeof(g_defaults.settings.menu), "rgui"); } diff --git a/pkg/emscripten/webplayer.js b/pkg/emscripten/webplayer.js index cac36cbb6c..6889cbc92c 100644 --- a/pkg/emscripten/webplayer.js +++ b/pkg/emscripten/webplayer.js @@ -120,6 +120,8 @@ function setupFolderStructure() FS.createPath('/', '/home/web_user', true, true); FS.createPath('/', '/home/web_user/.config', true, true); FS.createPath('/', '/home/web_user/.config/retroarch', true, true); + FS.createPath('/', '/assets', true, true); + FS.createPath('/', '/content', true, true); } function stat(path) @@ -171,7 +173,7 @@ function uploadData(data,name) FS.createDataFile('/', name, dataView, true, false); var data = FS.readFile(name,{ encoding: 'binary' }); - FS.writeFile('/home/web_user/content/' + name, data ,{ encoding: 'binary' }); + FS.writeFile('/content/' + name, data ,{ encoding: 'binary' }); FS.unlink(name); }