Android: Store saved files under game-id/ subdirectory

This is to prevent overwriting saved files of other games, since System3
uses common save file names regardless of the game.
This commit is contained in:
kichikuou
2020-02-10 13:09:07 +09:00
parent 8615df6e12
commit 2d0619a19a
4 changed files with 26 additions and 2 deletions
+14 -1
View File
@@ -37,6 +37,7 @@ int main(int argc, char *argv[])
const char* font_file = DEFAULT_FONT_PATH "MTLc3m.ttf";
const char* game_id = NULL;
char save_dir[256] = "";
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-gamedir") == 0)
@@ -44,7 +45,7 @@ int main(int argc, char *argv[])
else if (strcmp(argv[i], "-antialias") == 0)
ags_setAntialiasedStringMode(1);
else if (strcmp(argv[i], "-savedir") == 0)
FILEIO::SetSaveDir(argv[++i]);
strcpy(save_dir, argv[++i]);
else if (strcmp(argv[i], "-fontfile") == 0)
font_file = argv[++i];
else if (strcmp(argv[i], "-game") == 0)
@@ -54,6 +55,18 @@ int main(int argc, char *argv[])
// system3 初期化
NACT* nact = new NACT(game_id, font_file);
if (save_dir[0]) {
#ifdef __ANDROID__
const char* gid = nact->get_game_id();
if (gid) {
strcat(save_dir, gid);
mkdir(save_dir, 0777);
strcat(save_dir, "/");
}
#endif
FILEIO::SetSaveDir(save_dir);
}
const _TCHAR* title = nact->get_title();
if (title) {
#if defined(_SYSTEM1)