Skip to content

Commit

Permalink
Android
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Feb 22, 2025
1 parent 997cb3e commit 73c082b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,18 @@ public static void launchGame(Context context, Game game, boolean debugMode) {
args.add(enc.getRegionCode());
}

String configPath = context.getExternalFilesDir(null).getAbsolutePath();
args.add("--config-path");
args.add(context.getExternalFilesDir(null).getAbsolutePath());
args.add(configPath);

String logFile;
if (game.isStandalone()) {
logFile = configPath + "/easyrpg-player.log";
} else {
logFile = SettingsManager.getEasyRPGFolderURI(context) + "/easyrpg-player.log";
}
args.add("--log-file");
args.add(logFile);

/* FIXME: Currently disabled because the built-in scene cannot handle URI-encoded paths
// Sound Font Folder path (used by the settings scene)
Expand All @@ -105,6 +115,7 @@ public static void launchGame(Context context, Game game, boolean debugMode) {
}

intent.putExtra(EasyRpgPlayerActivity.TAG_SAVE_PATH, savePath);
intent.putExtra(EasyRpgPlayerActivity.TAG_LOG_FILE, logFile);
intent.putExtra(EasyRpgPlayerActivity.TAG_COMMAND_LINE, args.toArray(new String[0]));
intent.putExtra(EasyRpgPlayerActivity.TAG_STANDALONE, game.isStandalone());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
*/
public class EasyRpgPlayerActivity extends SDLActivity implements NavigationView.OnNavigationItemSelectedListener {
public static final String TAG_PROJECT_PATH = "project_path";
public static final String TAG_LOG_FILE = "log_file";
public static final String TAG_SAVE_PATH = "save_path";
public static final String TAG_COMMAND_LINE = "command_line";
public static final String TAG_STANDALONE = "standalone_mode";
Expand Down Expand Up @@ -239,13 +240,13 @@ private void reportBug() {
// set dialog message
alertDialogBuilder.setMessage(bug_msg).setCancelable(false)
.setPositiveButton(R.string.ok, (dialog, id) -> {
// Attach to the email : the easyrpg log file and savefiles
// Attach to the email: the easyrpg log file and savefiles
ArrayList<Uri> files = new ArrayList<>();

String savepath = getIntent().getStringExtra(TAG_SAVE_PATH);

if (getIntent().getBooleanExtra(TAG_STANDALONE, false)) {
File logFile = new File(savepath, "easyrpg_log.txt");
File logFile = new File(getIntent().getStringExtra(TAG_LOG_FILE));
if (logFile.exists()) {
Uri logUri = FileProvider.getUriForFile(this, getPackageName() + ".fileprovider", logFile);
if (logUri != null) {
Expand All @@ -263,11 +264,13 @@ private void reportBug() {
}
}
} else {
Uri saveFolder = Uri.parse(savepath);
Uri log = Helper.findFileUri(getContext(), saveFolder, "easyrpg_log.txt");
if (log != null) {
files.add(log);
Uri logFile = Uri.parse(getIntent().getStringExtra(TAG_LOG_FILE));
if (logFile != null) {
files.add(logFile);
}

Uri saveFolder = Uri.parse(savepath);

// The save files
files.addAll(Helper.findFileUriWithRegex(getContext(), saveFolder, ".*lsd"));
}
Expand Down

0 comments on commit 73c082b

Please sign in to comment.