diff --git a/ISLE/android/config.cpp b/ISLE/android/config.cpp index 701ab55c..a03dbfc3 100644 --- a/ISLE/android/config.cpp +++ b/ISLE/android/config.cpp @@ -1,5 +1,7 @@ #include "config.h" +#include +#include #include #include @@ -7,6 +9,21 @@ void Android_SetupDefaultConfigOverrides(dictionary* p_dictionary) { SDL_Log("Overriding default config for Android"); - iniparser_set(p_dictionary, "isle:diskpath", "/data/data/org.legoisland.Isle.dev/files/DATA/disk/LEGO"); - iniparser_set(p_dictionary, "isle:cdpath", "/data/data/org.legoisland.Isle.dev/files/"); + const char* data = SDL_GetAndroidExternalStoragePath(); + char* savedata = new char[strlen(data) + strlen("/saves/") + 1 ]; + strcpy(savedata, data); + strcat(savedata, "/saves/"); + + if (!SDL_GetPathInfo(savedata, NULL)) { + SDL_CreateDirectory(savedata); + } + + iniparser_set(p_dictionary, "isle:diskpath", data); + iniparser_set(p_dictionary, "isle:cdpath", data); + + iniparser_set(p_dictionary, "isle:savepath", savedata); + + // Default to Virtal Mouse + char buf[16]; + iniparser_set(p_dictionary, "isle:Touch Scheme", SDL_itoa(0, buf, 10)); } diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 8e1e3103..1d1c106d 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -1031,6 +1031,13 @@ bool IsleApp::LoadConfig() { #ifdef IOS const char* prefPath = SDL_GetUserFolder(SDL_FOLDER_DOCUMENTS); +#elif defined(ANDROID) + // SDL_GetAndroidExternalStoragePath() returns without a trailing / resulting in "filesisle.ini" :( + const char* androidPath = SDL_GetAndroidExternalStoragePath(); + char* prefPath = new char[strlen(androidPath) + 2 ]; + strcpy(prefPath, androidPath); + strcat(prefPath, "/"); + SDL_Log("%s", prefPath); #else char* prefPath = SDL_GetPrefPath("isledecomp", "isle"); #endif