From 3c83fb86269578682ffe87cc3b469dc3a57388e3 Mon Sep 17 00:00:00 2001 From: BobbyJones Date: Thu, 31 Dec 2015 01:28:00 -0500 Subject: [PATCH 1/9] Added a flag that changes android storage from internal to external. --- src/modules/filesystem/Filesystem.h | 2 +- src/modules/filesystem/physfs/Filesystem.cpp | 15 ++++++++++----- src/modules/filesystem/physfs/Filesystem.h | 2 +- src/modules/filesystem/wrap_Filesystem.cpp | 4 +++- src/scripts/boot.lua | 3 ++- 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/modules/filesystem/Filesystem.h b/src/modules/filesystem/Filesystem.h index f21141579..837496f32 100644 --- a/src/modules/filesystem/Filesystem.h +++ b/src/modules/filesystem/Filesystem.h @@ -84,7 +84,7 @@ public: * @param ident The name of the game. Will be used to * to create the folder in the LOVE data folder. **/ - virtual bool setIdentity(const char *ident, bool appendToPath = false) = 0; + virtual bool setIdentity(const char *ident, bool appendToPath = false, bool internalStorage = false) = 0; virtual const char *getIdentity() const = 0; /** diff --git a/src/modules/filesystem/physfs/Filesystem.cpp b/src/modules/filesystem/physfs/Filesystem.cpp index ff9ee7b59..c9b68ed64 100644 --- a/src/modules/filesystem/physfs/Filesystem.cpp +++ b/src/modules/filesystem/physfs/Filesystem.cpp @@ -144,7 +144,7 @@ bool Filesystem::isFused() const return fused; } -bool Filesystem::setIdentity(const char *ident, bool appendToPath) +bool Filesystem::setIdentity(const char *ident, bool appendToPath, bool internalStorage) { if (!PHYSFS_isInit()) return false; @@ -169,11 +169,16 @@ bool Filesystem::setIdentity(const char *ident, bool appendToPath) #ifdef LOVE_ANDROID if (save_identity == "") save_identity = "unnamed"; - - std::string internal_storage_path = SDL_AndroidGetInternalStoragePath(); - std::string save_directory = internal_storage_path + "/save"; - save_path_full = std::string(SDL_AndroidGetInternalStoragePath()) + std::string("/save/") + save_identity; + std::string storage_path; + if (internalStorage) + storage_path = SDL_AndroidGetInternalStoragePath(); + else + storage_path = SDL_AndroidGetExternalStoragePath(); + + std::string save_directory = storage_path + "/save"; + + save_path_full = storage_path + std::string("/save/") + save_identity; if (!love::android::directoryExists(save_path_full.c_str()) && !love::android::mkdir(save_path_full.c_str())) diff --git a/src/modules/filesystem/physfs/Filesystem.h b/src/modules/filesystem/physfs/Filesystem.h index fc6941e48..a5b369f28 100644 --- a/src/modules/filesystem/physfs/Filesystem.h +++ b/src/modules/filesystem/physfs/Filesystem.h @@ -52,7 +52,7 @@ public: bool setupWriteDirectory(); - bool setIdentity(const char *ident, bool appendToPath = false); + bool setIdentity(const char *ident, bool appendToPath = false, bool internalStorage = false); const char *getIdentity() const; bool setSource(const char *source); diff --git a/src/modules/filesystem/wrap_Filesystem.cpp b/src/modules/filesystem/wrap_Filesystem.cpp index 9c7e26d5f..175c0fc3b 100644 --- a/src/modules/filesystem/wrap_Filesystem.cpp +++ b/src/modules/filesystem/wrap_Filesystem.cpp @@ -73,8 +73,10 @@ int w_setIdentity(lua_State *L) { const char *arg = luaL_checkstring(L, 1); bool append = luax_optboolean(L, 2, false); + bool internalStorage = luax_optboolean(L, 3, false); - if (!instance()->setIdentity(arg, append)) + + if (!instance()->setIdentity(arg, append, internalStorage)) return luaL_error(L, "Could not set write directory."); return 0; diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index 5430018d9..f9a4cc5a1 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -374,6 +374,7 @@ function love.init() console = false, -- Only relevant for windows. identity = false, appendidentity = false, + internalStorage = false, -- Only relevant for Android. accelerometerjoystick = true, -- Only relevant for Android / iOS. gammacorrect = false, } @@ -493,7 +494,7 @@ function love.init() end if love.filesystem then - love.filesystem.setIdentity(c.identity or love.filesystem.getIdentity(), c.appendidentity) + love.filesystem.setIdentity(c.identity or love.filesystem.getIdentity(), c.appendidentity, c.internalStorage) if love.filesystem.isFile("main.lua") then require("main") end From c283e361262030bbd366b9fb15a0c3c8c7d5c8e6 Mon Sep 17 00:00:00 2001 From: BobbyJones Date: Thu, 31 Dec 2015 02:16:36 -0500 Subject: [PATCH 2/9] made a new boot.lua.h --- src/scripts/boot.lua.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index 87a5075ec..621bdf420 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -684,6 +684,10 @@ const unsigned char boot_lua[] = 0x2c, 0x0a, 0x09, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, + 0x09, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, + 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x20, 0x2d, 0x2d, 0x20, 0x4f, 0x6e, 0x6c, 0x79, 0x20, 0x72, + 0x65, 0x6c, 0x65, 0x76, 0x61, 0x6e, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, + 0x64, 0x2e, 0x0a, 0x09, 0x09, 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x6a, 0x6f, 0x79, 0x73, 0x74, 0x69, 0x63, 0x6b, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x20, 0x2d, 0x2d, 0x20, 0x4f, 0x6e, 0x6c, 0x79, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x76, 0x61, 0x6e, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x41, @@ -913,7 +917,8 @@ const unsigned char boot_lua[] = 0x74, 0x69, 0x74, 0x79, 0x20, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x67, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x28, 0x29, 0x2c, 0x20, 0x63, 0x2e, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x29, 0x0a, + 0x79, 0x2c, 0x20, 0x63, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x29, 0x0a, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x69, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x28, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x6c, 0x75, 0x61, 0x22, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, From 3aa51763e296d1df4c1c993a724e2cb5723d7636 Mon Sep 17 00:00:00 2001 From: BobbyJones Date: Sat, 2 Jan 2016 18:52:25 -0500 Subject: [PATCH 3/9] made a method for setting external save location on android --- src/modules/filesystem/Filesystem.cpp | 11 +++++++++++ src/modules/filesystem/Filesystem.h | 20 +++++++++++++++++++- src/modules/filesystem/physfs/Filesystem.cpp | 8 ++++---- src/modules/filesystem/physfs/Filesystem.h | 2 +- src/modules/filesystem/wrap_Filesystem.cpp | 19 ++++++++++++++++--- src/scripts/boot.lua | 5 +++-- src/scripts/boot.lua.h | 15 +++++++++------ 7 files changed, 63 insertions(+), 17 deletions(-) diff --git a/src/modules/filesystem/Filesystem.cpp b/src/modules/filesystem/Filesystem.cpp index b3a8b43c7..f62748638 100644 --- a/src/modules/filesystem/Filesystem.cpp +++ b/src/modules/filesystem/Filesystem.cpp @@ -50,6 +50,17 @@ Filesystem::~Filesystem() { } +void Filesystem::setAndroidSaveExternal(bool useExternal) +{ + this->useExternal = useExternal; +} + +bool Filesystem::isAndroidSaveExternal() const +{ + return useExternal; +} + + bool Filesystem::isRealDirectory(const std::string &path) const { #ifdef LOVE_WINDOWS diff --git a/src/modules/filesystem/Filesystem.h b/src/modules/filesystem/Filesystem.h index 837496f32..64bde25c9 100644 --- a/src/modules/filesystem/Filesystem.h +++ b/src/modules/filesystem/Filesystem.h @@ -79,12 +79,26 @@ public: **/ virtual bool setupWriteDirectory() = 0; + /** + * This sets the save location on Android. + * False for internal, true for external + * @param external Bool for whether + * Android should use external file storage. + **/ + virtual void setAndroidSaveExternal(bool useExternal = false); + + /** + * Gets whether the Android save is external. + * Returns a bool. + **/ + virtual bool isAndroidSaveExternal() const; + /** * Sets the name of the save folder. * @param ident The name of the game. Will be used to * to create the folder in the LOVE data folder. **/ - virtual bool setIdentity(const char *ident, bool appendToPath = false, bool internalStorage = false) = 0; + virtual bool setIdentity(const char *ident, bool appendToPath = false) = 0; virtual const char *getIdentity() const = 0; /** @@ -263,6 +277,10 @@ public: **/ virtual std::string getExecutablePath() const; +private: + + //should we save external or internal for Android + bool useExternal; }; // Filesystem } // filesystem diff --git a/src/modules/filesystem/physfs/Filesystem.cpp b/src/modules/filesystem/physfs/Filesystem.cpp index c9b68ed64..b1edf777a 100644 --- a/src/modules/filesystem/physfs/Filesystem.cpp +++ b/src/modules/filesystem/physfs/Filesystem.cpp @@ -144,7 +144,7 @@ bool Filesystem::isFused() const return fused; } -bool Filesystem::setIdentity(const char *ident, bool appendToPath, bool internalStorage) +bool Filesystem::setIdentity(const char *ident, bool appendToPath) { if (!PHYSFS_isInit()) return false; @@ -171,10 +171,10 @@ bool Filesystem::setIdentity(const char *ident, bool appendToPath, bool internal save_identity = "unnamed"; std::string storage_path; - if (internalStorage) - storage_path = SDL_AndroidGetInternalStoragePath(); - else + if (isAndroidSaveExternal()) storage_path = SDL_AndroidGetExternalStoragePath(); + else + storage_path = SDL_AndroidGetInternalStoragePath(); std::string save_directory = storage_path + "/save"; diff --git a/src/modules/filesystem/physfs/Filesystem.h b/src/modules/filesystem/physfs/Filesystem.h index a5b369f28..fc6941e48 100644 --- a/src/modules/filesystem/physfs/Filesystem.h +++ b/src/modules/filesystem/physfs/Filesystem.h @@ -52,7 +52,7 @@ public: bool setupWriteDirectory(); - bool setIdentity(const char *ident, bool appendToPath = false, bool internalStorage = false); + bool setIdentity(const char *ident, bool appendToPath = false); const char *getIdentity() const; bool setSource(const char *source); diff --git a/src/modules/filesystem/wrap_Filesystem.cpp b/src/modules/filesystem/wrap_Filesystem.cpp index 175c0fc3b..63537f593 100644 --- a/src/modules/filesystem/wrap_Filesystem.cpp +++ b/src/modules/filesystem/wrap_Filesystem.cpp @@ -69,14 +69,25 @@ int w_isFused(lua_State *L) return 1; } +int w_setAndroidSaveExternal(lua_State *L) +{ + bool useExternal = luax_optboolean(L, 1, false); + instance()->setAndroidSaveExternal(useExternal); + return 0; +} + +int w_isAndroidSaveExternal(lua_State *L) +{ + luax_pushboolean(L, instance()->isAndroidSaveExternal()); + return 1; +} + int w_setIdentity(lua_State *L) { const char *arg = luaL_checkstring(L, 1); bool append = luax_optboolean(L, 2, false); - bool internalStorage = luax_optboolean(L, 3, false); - - if (!instance()->setIdentity(arg, append, internalStorage)) + if (!instance()->setIdentity(arg, append)) return luaL_error(L, "Could not set write directory."); return 0; @@ -710,6 +721,8 @@ static const luaL_Reg functions[] = { "init", w_init }, { "setFused", w_setFused }, { "isFused", w_isFused }, + { "setAndroidSaveExternal", w_setAndroidSaveExternal }, + { "getAndroidSaveExternal", w_isAndroidSaveExternal }, { "setIdentity", w_setIdentity }, { "getIdentity", w_getIdentity }, { "setSource", w_setSource }, diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index f9a4cc5a1..6598e8530 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -374,7 +374,7 @@ function love.init() console = false, -- Only relevant for windows. identity = false, appendidentity = false, - internalStorage = false, -- Only relevant for Android. + useexternalstorage = false, -- Only relevant for Android. accelerometerjoystick = true, -- Only relevant for Android / iOS. gammacorrect = false, } @@ -494,7 +494,8 @@ function love.init() end if love.filesystem then - love.filesystem.setIdentity(c.identity or love.filesystem.getIdentity(), c.appendidentity, c.internalStorage) + love.filesystem.setAndroidSaveExternal(c.useexternalstoragee) + love.filesystem.setIdentity(c.identity or love.filesystem.getIdentity(), c.appendidentity) if love.filesystem.isFile("main.lua") then require("main") end diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index 621bdf420..e2020df06 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -684,10 +684,10 @@ const unsigned char boot_lua[] = 0x2c, 0x0a, 0x09, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, - 0x09, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, - 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x20, 0x2d, 0x2d, 0x20, 0x4f, 0x6e, 0x6c, 0x79, 0x20, 0x72, - 0x65, 0x6c, 0x65, 0x76, 0x61, 0x6e, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, - 0x64, 0x2e, 0x0a, + 0x09, 0x09, 0x75, 0x73, 0x65, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x20, 0x2d, 0x2d, 0x20, 0x4f, 0x6e, 0x6c, + 0x79, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x76, 0x61, 0x6e, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x41, 0x6e, 0x64, + 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x0a, 0x09, 0x09, 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x6a, 0x6f, 0x79, 0x73, 0x74, 0x69, 0x63, 0x6b, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x20, 0x2d, 0x2d, 0x20, 0x4f, 0x6e, 0x6c, 0x79, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x76, 0x61, 0x6e, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x41, @@ -913,12 +913,15 @@ const unsigned char boot_lua[] = 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, + 0x73, 0x65, 0x74, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x53, 0x61, 0x76, 0x65, 0x45, 0x78, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x28, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, + 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x65, 0x29, 0x0a, + 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x73, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x28, 0x63, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x67, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x28, 0x29, 0x2c, 0x20, 0x63, 0x2e, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x2c, 0x20, 0x63, 0x2e, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x53, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x29, 0x0a, + 0x79, 0x29, 0x0a, 0x09, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x69, 0x73, 0x46, 0x69, 0x6c, 0x65, 0x28, 0x22, 0x6d, 0x61, 0x69, 0x6e, 0x2e, 0x6c, 0x75, 0x61, 0x22, 0x29, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, From e3da734ace2873c9ccf9b01f466d07437d26b2bc Mon Sep 17 00:00:00 2001 From: BobbyJones Date: Sat, 2 Jan 2016 18:56:23 -0500 Subject: [PATCH 4/9] clean up --- src/modules/filesystem/Filesystem.cpp | 1 - src/scripts/boot.lua | 2 +- src/scripts/boot.lua.h | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modules/filesystem/Filesystem.cpp b/src/modules/filesystem/Filesystem.cpp index f62748638..c0357968b 100644 --- a/src/modules/filesystem/Filesystem.cpp +++ b/src/modules/filesystem/Filesystem.cpp @@ -60,7 +60,6 @@ bool Filesystem::isAndroidSaveExternal() const return useExternal; } - bool Filesystem::isRealDirectory(const std::string &path) const { #ifdef LOVE_WINDOWS diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index 6598e8530..2a9c40955 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -494,7 +494,7 @@ function love.init() end if love.filesystem then - love.filesystem.setAndroidSaveExternal(c.useexternalstoragee) + love.filesystem.setAndroidSaveExternal(c.useexternalstorage) love.filesystem.setIdentity(c.identity or love.filesystem.getIdentity(), c.appendidentity) if love.filesystem.isFile("main.lua") then require("main") diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index e2020df06..c00dc1e67 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -915,7 +915,7 @@ const unsigned char boot_lua[] = 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x73, 0x65, 0x74, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x53, 0x61, 0x76, 0x65, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x28, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x65, 0x29, 0x0a, + 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x29, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x73, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x28, 0x63, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, From eb5669db2233ca7c5e9e3d5b498b3051ce52f50d Mon Sep 17 00:00:00 2001 From: David Serrano Date: Sat, 2 Jan 2016 23:57:44 +0000 Subject: [PATCH 5/9] Created new branch new-conf-flag-for-android-2 --HG-- branch : new-conf-flag-for-android-2 From 9dc50fe42323ea71d4cbeabdd78d41ef7e73fe55 Mon Sep 17 00:00:00 2001 From: BobbyJones Date: Sat, 2 Jan 2016 19:16:20 -0500 Subject: [PATCH 6/9] switched c.useexternalstorage to c.externalstorage --HG-- branch : new-conf-flag-for-android-2 --- src/scripts/boot.lua | 4 ++-- src/scripts/boot.lua.h | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index 2a9c40955..3a7e2f0f1 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -374,7 +374,7 @@ function love.init() console = false, -- Only relevant for windows. identity = false, appendidentity = false, - useexternalstorage = false, -- Only relevant for Android. + externalstorage = false, -- Only relevant for Android. accelerometerjoystick = true, -- Only relevant for Android / iOS. gammacorrect = false, } @@ -494,7 +494,7 @@ function love.init() end if love.filesystem then - love.filesystem.setAndroidSaveExternal(c.useexternalstorage) + love.filesystem.setAndroidSaveExternal(c.externalstorage) love.filesystem.setIdentity(c.identity or love.filesystem.getIdentity(), c.appendidentity) if love.filesystem.isFile("main.lua") then require("main") diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index c00dc1e67..b51d38ec5 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -684,10 +684,10 @@ const unsigned char boot_lua[] = 0x2c, 0x0a, 0x09, 0x09, 0x61, 0x70, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x0a, - 0x09, 0x09, 0x75, 0x73, 0x65, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x61, - 0x67, 0x65, 0x20, 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x20, 0x2d, 0x2d, 0x20, 0x4f, 0x6e, 0x6c, - 0x79, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x76, 0x61, 0x6e, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x41, 0x6e, 0x64, - 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x0a, + 0x09, 0x09, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x20, + 0x3d, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x2c, 0x20, 0x2d, 0x2d, 0x20, 0x4f, 0x6e, 0x6c, 0x79, 0x20, 0x72, + 0x65, 0x6c, 0x65, 0x76, 0x61, 0x6e, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, + 0x64, 0x2e, 0x0a, 0x09, 0x09, 0x61, 0x63, 0x63, 0x65, 0x6c, 0x65, 0x72, 0x6f, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x6a, 0x6f, 0x79, 0x73, 0x74, 0x69, 0x63, 0x6b, 0x20, 0x3d, 0x20, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x20, 0x2d, 0x2d, 0x20, 0x4f, 0x6e, 0x6c, 0x79, 0x20, 0x72, 0x65, 0x6c, 0x65, 0x76, 0x61, 0x6e, 0x74, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x41, @@ -914,8 +914,8 @@ const unsigned char boot_lua[] = 0x6d, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x73, 0x65, 0x74, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x53, 0x61, 0x76, 0x65, 0x45, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x28, 0x63, 0x2e, 0x75, 0x73, 0x65, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, - 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x29, 0x0a, + 0x72, 0x6e, 0x61, 0x6c, 0x28, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x73, 0x74, 0x6f, + 0x72, 0x61, 0x67, 0x65, 0x29, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x73, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x28, 0x63, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, From 57467448ad61d54af617f4829dc8f7bfd4c7838f Mon Sep 17 00:00:00 2001 From: BobbyJones Date: Sat, 9 Jan 2016 10:35:20 -0500 Subject: [PATCH 7/9] Made the android set save functions private. --HG-- branch : new-conf-flag-for-android-2 --- src/modules/filesystem/wrap_Filesystem.cpp | 4 ++-- src/scripts/boot.lua | 2 +- src/scripts/boot.lua.h | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modules/filesystem/wrap_Filesystem.cpp b/src/modules/filesystem/wrap_Filesystem.cpp index 63537f593..ab5a65236 100644 --- a/src/modules/filesystem/wrap_Filesystem.cpp +++ b/src/modules/filesystem/wrap_Filesystem.cpp @@ -721,8 +721,8 @@ static const luaL_Reg functions[] = { "init", w_init }, { "setFused", w_setFused }, { "isFused", w_isFused }, - { "setAndroidSaveExternal", w_setAndroidSaveExternal }, - { "getAndroidSaveExternal", w_isAndroidSaveExternal }, + { "_setAndroidSaveExternal", w_setAndroidSaveExternal }, + { "_getAndroidSaveExternal", w_isAndroidSaveExternal }, { "setIdentity", w_setIdentity }, { "getIdentity", w_getIdentity }, { "setSource", w_setSource }, diff --git a/src/scripts/boot.lua b/src/scripts/boot.lua index 3a7e2f0f1..ef723b543 100644 --- a/src/scripts/boot.lua +++ b/src/scripts/boot.lua @@ -494,7 +494,7 @@ function love.init() end if love.filesystem then - love.filesystem.setAndroidSaveExternal(c.externalstorage) + love.filesystem._setAndroidSaveExternal(c.externalstorage) love.filesystem.setIdentity(c.identity or love.filesystem.getIdentity(), c.appendidentity) if love.filesystem.isFile("main.lua") then require("main") diff --git a/src/scripts/boot.lua.h b/src/scripts/boot.lua.h index b51d38ec5..cdc8b4d53 100644 --- a/src/scripts/boot.lua.h +++ b/src/scripts/boot.lua.h @@ -913,9 +913,9 @@ const unsigned char boot_lua[] = 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, - 0x73, 0x65, 0x74, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x53, 0x61, 0x76, 0x65, 0x45, 0x78, 0x74, 0x65, - 0x72, 0x6e, 0x61, 0x6c, 0x28, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x73, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x29, 0x0a, + 0x5f, 0x73, 0x65, 0x74, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x53, 0x61, 0x76, 0x65, 0x45, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x28, 0x63, 0x2e, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x73, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x29, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6d, 0x2e, 0x73, 0x65, 0x74, 0x49, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x28, 0x63, 0x2e, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x20, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x73, From e855f2ae01232ab18a6e00f3370577596d290d8f Mon Sep 17 00:00:00 2001 From: BobbyJones Date: Sat, 9 Jan 2016 19:45:47 -0500 Subject: [PATCH 8/9] removed the isAndroidSaveExternal from the wrap --HG-- branch : new-conf-flag-for-android-2 --- src/modules/filesystem/wrap_Filesystem.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/filesystem/wrap_Filesystem.cpp b/src/modules/filesystem/wrap_Filesystem.cpp index ab5a65236..dd7e96afe 100644 --- a/src/modules/filesystem/wrap_Filesystem.cpp +++ b/src/modules/filesystem/wrap_Filesystem.cpp @@ -722,7 +722,6 @@ static const luaL_Reg functions[] = { "setFused", w_setFused }, { "isFused", w_isFused }, { "_setAndroidSaveExternal", w_setAndroidSaveExternal }, - { "_getAndroidSaveExternal", w_isAndroidSaveExternal }, { "setIdentity", w_setIdentity }, { "getIdentity", w_getIdentity }, { "setSource", w_setSource }, From 2c550fbf6db0cb1e105a031b0994bd4fada5c1f1 Mon Sep 17 00:00:00 2001 From: BobbyJones Date: Sat, 9 Jan 2016 19:47:45 -0500 Subject: [PATCH 9/9] now I removed it from the wrap :) --HG-- branch : new-conf-flag-for-android-2 --- src/modules/filesystem/wrap_Filesystem.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/modules/filesystem/wrap_Filesystem.cpp b/src/modules/filesystem/wrap_Filesystem.cpp index dd7e96afe..5c93fed4d 100644 --- a/src/modules/filesystem/wrap_Filesystem.cpp +++ b/src/modules/filesystem/wrap_Filesystem.cpp @@ -76,12 +76,6 @@ int w_setAndroidSaveExternal(lua_State *L) return 0; } -int w_isAndroidSaveExternal(lua_State *L) -{ - luax_pushboolean(L, instance()->isAndroidSaveExternal()); - return 1; -} - int w_setIdentity(lua_State *L) { const char *arg = luaL_checkstring(L, 1);