proper paths & default to virtual mouse

This commit is contained in:
Kylie C 2025-08-04 00:53:44 -04:00
parent 64b44bf245
commit 40e3193213
2 changed files with 26 additions and 2 deletions

View File

@ -1,5 +1,7 @@
#include "config.h"
#include <SDL3/SDL_system.h>
#include <SDL3/SDL_filesystem.h>
#include <SDL3/SDL_log.h>
#include <iniparser.h>
@ -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));
}

View File

@ -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