isle-portable/ISLE/android/config.cpp
Cookie f06731784e
Android port (#656)
* initial files

* get building

* proper paths & default to virtual mouse

* Wrap gradle under cmake & build SDL3.aar

run cmake with  -DANDROID_NDK_PATH=/path/to/ndk to generate the .aar & run the gradle build

if using Android Studio you will have to run the aar script manually(or do the cmake cmd) then put the normal cmake args inside '-PcmakeArgs="-DCMAKE_BUILD_TYPE=Release ...."'  at `Settings > Build, Execution, Deployment > Gradle-Android Compiler > Command-line Options`
Check CMakeLists.txt Android build block for more info

* workflow and format

* dont cmake -> gradle -> cmake

* icons

* prevent first start crash due to missing isle.ini

dont force require gles3 (vulkan & software are options)

* cleanup

* cmake script & ci cleanup

use a cmake script to downoad SDL3 sources for aar building

* script cleanups & gradle stub for android studio

handle the env var setting for the sdl3 aar build script

* signing

needed repository secrets:
- keystore  :  key.jks in base64
- keystorePassword  :  Key store password
- keyAlias  :  Key alias, ex key0
- keyPassword  :  Key Password

* conditionally run action without keys

* compile SDL once & cross-platformize gradle tasks

* suggestions

* use find_package over manual configuration

* use MxString

---------

Co-authored-by: Anders Jenbo <anders@jenbo.dk>
Co-authored-by: Christian Semmler <mail@csemmler.com>
2025-08-15 15:12:35 +00:00

31 lines
828 B
C++

#include "config.h"
#include "mxstring.h"
#include <SDL3/SDL_filesystem.h>
#include <SDL3/SDL_log.h>
#include <SDL3/SDL_system.h>
#include <iniparser.h>
void Android_SetupDefaultConfigOverrides(dictionary* p_dictionary)
{
SDL_Log("Overriding default config for Android");
const char* data = SDL_GetAndroidExternalStoragePath();
MxString savedata = MxString(data) + "/saves/";
if (!SDL_GetPathInfo(savedata.GetData(), NULL)) {
SDL_CreateDirectory(savedata.GetData());
}
iniparser_set(p_dictionary, "isle:diskpath", data);
iniparser_set(p_dictionary, "isle:cdpath", data);
iniparser_set(p_dictionary, "isle:mediapath", data);
iniparser_set(p_dictionary, "isle:savepath", savedata.GetData());
// Default to Virtual Mouse
char buf[16];
iniparser_set(p_dictionary, "isle:Touch Scheme", SDL_itoa(0, buf, 10));
}