Commander-Genius icon indicating copy to clipboard operation
Commander-Genius copied to clipboard

Add Support for Android/media additionally to Android/data

Open DrPepperBianco opened this issue 4 months ago • 1 comments

Hi,

if I want to add bought Keen versions, like Keen5 or Keen6 I have to put files into the Android/data folder. Problem is, that since Android changed some security rules for this folder, this only works via adb (over USB or over WLAN).

Instead you could add the Android/media folder. Then you could move the files there with any Android file manager (like the stock file manager files).

In the file "FindFile.cpp" I found the following lines (at about line 500):

    AddToFileList(&basesearchpaths, "/switch/CommanderGenius");
    AddToFileList(&basesearchpaths, "romfs:/");
#else // all other systems (Linux, *BSD, OS/2, ...)
#ifdef ANDROID
    //AddToFileList(&basesearchpaths, "${HOME}/SaveData");
    AddToFileList(&basesearchpaths, SDL_AndroidGetExternalStoragePath());
    AddToFileList(&basesearchpaths, SDL_AndroidGetInternalStoragePath());
    AddToFileList(&basesearchpaths, "/storage/emulated/0/Android/data/net.sourceforge.clonekeenplus/files/SaveData");
#else
    #ifdef ALTERNATE_HOME
      AddToFileList(&basesearchpaths, ALTERNATE_HO

The line
AddToFileList(&basesearchpaths, SDL_AndroidGetExternalStoragePath());
adds the "Android/data" path to the search path list.

In the SDL there seems to be no method to get the "Android/media" path. But in the end, you only have to replace "Android/data" with "Android/media" I guess.

I have to admit, I am no expert in either C++ or Android programming. I didn’t even find out, how to compile this code for android. So I am not sure, if it works this way. Anyway, it would make it easier to add games to on Android.

DrPepperBianco avatar Aug 01 '25 22:08 DrPepperBianco

Hi @DrPepperBianco, thanks for looking into this. I also did not find another method. Regarding Port to Android, we have been using this repo: https://github.com/pelya/commandergenius/tree/sdl2_android

where Commander Genius is linked as submodule. If you want to look into this, feel free to do so. This was meant to be linked against SDL 1.2 which now is old news. I guess there are better ways now with SDL3 which we also need to support at some point of time. Oh well...

gerstrong avatar Aug 04 '25 13:08 gerstrong