pvbemu/src/desktop/native/native.c

37 lines
991 B
C

#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <jni.h>
#include "vue_NativeVUE.h"
// Retrieve a copy of the ROM data
JNIEXPORT jbyteArray JNICALL Java_vue_NativeVUE_getROM
(JNIEnv *env, jobject vue) {
}
// Determine whether the context is native-backed
JNIEXPORT jboolean JNICALL Java_vue_NativeVUE_isNative
(JNIEnv *env, jobject vue) {
return JNI_TRUE;
}
// Provide new ROM data
JNIEXPORT jboolean JNICALL Java_vue_NativeVUE_setROM
(JNIEnv *env, jobject vue, jbyteArray data, jint offset, jint length) {
jsize data_length = (*env)->GetArrayLength(env, data);
// Error checking
if (data == NULL || offset < 0 || length < 1024 ||
offset + length > data_length || (length & length - 1) != 0)
return JNI_FALSE;
// Accept the new ROM data
return JNI_TRUE;
}
// Invoke native code to ensure the module is loaded
JNIEXPORT jboolean JNICALL Java_vue_NativeVUE_testNative
(JNIEnv *env, jclass vue) {
return JNI_TRUE;
}