Android fixes

This commit is contained in:
luboslenco
2025-12-01 12:42:35 +01:00
parent 651e7176d9
commit 1232ff5aab
3 changed files with 80 additions and 51 deletions
+14 -1
View File
@@ -4,6 +4,7 @@
#include <iron_system.h>
#include <jni.h>
#include <string.h>
#include <stdio.h>
ANativeActivity *iron_android_get_activity(void);
jclass iron_android_find_class(JNIEnv *env, const char *name);
@@ -30,7 +31,19 @@ void iron_net_request(const char *url_base, const char *url_path, const char *da
jsize num_bytes = (*env)->GetArrayLength(env, bytes_array);
jbyte *elements = (*env)->GetByteArrayElements(env, bytes_array, NULL);
if (elements != NULL) {
callback((char *)elements, callbackdata);
if (dst_path != NULL) {
FILE *file = fopen(dst_path, "wb");
if (file != NULL) {
fwrite((char *)elements, 1, num_bytes, file);
fclose(file);
}
callback(NULL, callbackdata);
}
else {
callback((char *)elements, callbackdata);
}
// (*env)->ReleaseByteArrayElements(env, bytes_array, elements, JNI_ABORT);
}
+6 -1
View File
@@ -1,5 +1,6 @@
#include "android_system.h"
#include "android_file_dialog.h"
#include <assert.h>
#include <iron_file.h>
#include <iron_gpu.h>
@@ -47,7 +48,7 @@ static const char *videoFormats[] = {"ts", NULL};
static __kernel_time_t start_sec = 0;
static void (*resizeCallback)(int x, int y, void *data) = NULL;
static void *resizeCallbackData = NULL;
static char ios_title[1024];
char android_title[1024];
#ifdef WITH_GAMEPAD
static float last_x = 0.0f;
static float last_y = 0.0f;
@@ -1265,3 +1266,7 @@ void iron_gamepad_rumble(int gamepad, float left, float right) {}
bool _save_and_quit_callback_internal() {
return false;
}
volatile int iron_exec_async_done = 1;
void iron_exec_async(const char *path, char *argv[]) {}