first commit

This commit is contained in:
2026-05-25 21:33:48 -03:00
commit ad9176d909
42 changed files with 5788 additions and 0 deletions

82
src/native/carbon.cpp Normal file
View File

@@ -0,0 +1,82 @@
#include "carbon.hpp"
// redefine it here with the impl
// theres probably a better way to do this
#define CARBON_EXCEPTION_FUNC(fname, classpath) jint fname(JNIEnv* env, const char* message) { return THROW_EXCEPTION(classpath, message); }
#define CARBON_MAP_TO_NN_EXIT(enumcase) case enumcase:\
jfieldID id = env->GetFieldID(clazz, #enumcase, "Lorg.neoflock.NeoNucleus.nn_Exit;");\
return env->GetStaticObjectField(clazz, id);
// codename for NN JNI is Carbon because i needed something better than NN JNI
bool Carbon::PointerBacked::SetPointer(JNIEnv * env, jobject obj, void* ptr) {
jfieldID id = env->GetFieldID(env->GetObjectClass(obj), "ptr", "J");
if (id == NULL) return false;
env->SetLongField(obj, id, (jlong) ptr);
return true;
}
void* Carbon::PointerBacked::GetPointer(JNIEnv * env, jobject obj) {
jfieldID id = env->GetFieldID(env->GetObjectClass(obj), "ptr", "J");
IF_NULL_RET(id);
jlong ptr = env->GetLongField(obj, id);
return (void*) ptr;
}
bool Carbon::PointerBacked::ResetPointer(JNIEnv * env, jobject obj) {
jfieldID id = env->GetFieldID(env->GetObjectClass(obj), "ptr", "J");
if (id == NULL) return false;
env->SetLongField(obj, id, (jlong) NULL);
return true;
}
nn_Exit Carbon::archRequestHandler(nn_ArchitectureRequest *req) {
GlobalArchState* gstate = (GlobalArchState*)req->globalState;
JNIEnv* env = gstate->target.env;
jmethodID mid = env->GetMethodID(
env->GetObjectClass(gstate->target.obj), "handleNative", "()V");
// TODO: null check mid
jbyte ret = env->CallByteMethod(gstate->target.obj, mid);
return (nn_Exit) ret; // todo: finish the args; probably an unnecessary cast
}
jobject Carbon::InstantiateOpaqueClass(JNIEnv* env, const char* classpath) {
jclass cls = env->FindClass(classpath);
IF_NULL_RET(cls);
jmethodID methodID = env->GetMethodID(cls, "<init>", "()V");
IF_NULL_RET(methodID);
jobject obj = env->NewObject(cls, methodID);
return obj;
}
// pbc = pointer backed class
jobject Carbon::InstantiateDefaultPBC(JNIEnv* env, const char* classpath, void* ptr) {
jobject clazz = InstantiateOpaqueClass(env, classpath);
IF_NULL_RET(clazz);
Carbon::PointerBacked::SetPointer(env, clazz, ptr); // FIXME: this can silently fail
return clazz;
}
nn_Exit Carbon::JNIComponentHandler(nn_ComponentRequest* request) {
Carbon::JavaObjectTarget* ot = (Carbon::JavaObjectTarget*) request->state; // todo: make this a proper struct with a target for the component handler specifically
if (ot == NULL) return NN_EBADSTATE; // welp
//ud->target.env->
jmethodID callMethod = ot->env->GetMethodID(ot->env->GetObjectClass(ot->obj), "handleRequest", "(Lorg/neoflock/NeoNucleus/nn_ComponentRequest;)Lorg/neoflock/NeoNucleus/nn_Exit;");
jobject retex = ot->env->CallObjectMethod(ot->obj, callMethod, NULL); // todo: args
return Carbon::Map::From_nn_Exit(ot->env, retex);
}
jobject Carbon::Map::To_nn_Exit(JNIEnv* env, nn_Exit a) {
jclass clazz = env->FindClass("org/neoflock/NeoNucleus/nn_Exit");
switch (a) {
CARBON_MAP_TO_NN_EXIT(NN_OK)
CARBON_MAP_TO_NN_EXIT(NN_ENOMEM)
CARBON_MAP_TO_NN_EXIT(NN_ELIMIT)
CARBON_MAP_TO_NN_EXIT(NN_EBELOWSTACK)
CARBON_MAP_TO_NN_EXIT(NN_ENOSTACK)
CARBON_MAP_TO_NN_EXIT(NN_EBADCALL)
CARBON_MAP_TO_NN_EXIT(NN_EBADSTATE)
}
return NULL;
}
nn_Exit From_nn_Exit(JNIEnv* env, jobject a) {
jclass clazz = env->FindClass("org/neoflock/NeoNucleus/nn_Exit");
jmethodID ordMID = env->GetMethodID(clazz, "ordinal", "()I");
jint value = env->CallIntMethod(a, ordMID);
return (nn_Exit) value; // this should be fine as long as the header and java side don't desync
}
namespace Carbon::Exceptions {
CARBON_EXCEPTION_FUNC(ThrowNullPtr, "java/lang/NullPointerException");
}

54
src/native/carbon.hpp Normal file
View File

@@ -0,0 +1,54 @@
#pragma once
#include "neonucleus.h"
#include "org_neoflock_NeoNucleus_NativeBindings.h"
#define IF_NULL_RET(param) if (param == NULL) return NULL;
#define THROW_EXCEPTION(classpath, msg) env->ThrowNew(env->FindClass(classpath), msg);
#define CARBON_EXCEPTION_FUNC(fname, classpath) jint fname(JNIEnv* env, const char* message);
#define NULLPTR_THROW(cname) Carbon::Exceptions::ThrowNullPtr(env, "Received null pointer for " #cname);
#define NULLPTR_CHECK(var, cname) if (var == NULL) {\
NULLPTR_THROW(cname);\
return NULL;\
}
#define NULLPTR_CHECKNR(var, cname) if (var == NULL) {\
NULLPTR_THROW(cname);\
return;\
}
// codename for NN JNI is Carbon because i needed something better than NN JNI
namespace Carbon {
namespace PointerBacked {
bool SetPointer(JNIEnv * env, jobject obj, void* ptr);
void* GetPointer(JNIEnv * env, jobject obj);
bool ResetPointer(JNIEnv * env, jobject obj);
}
namespace Map {
jobject To_nn_Exit(JNIEnv* env, nn_Exit a);
nn_Exit From_nn_Exit(JNIEnv* env, jobject a);
}
typedef struct JavaObjectTarget { // i might lowkey drop this struct
JNIEnv * env;
jobject obj;
} JavaObjectTarget;
typedef struct ComputerUserdata {
JavaObjectTarget target;
} ComputerUserdata;
typedef struct GlobalArchState {
JavaObjectTarget target;
} GlobalArchState;
nn_Exit archRequestHandler(nn_ArchitectureRequest *req);
jobject InstantiateOpaqueClass(JNIEnv* env, const char* classpath);
// pbc = pointer backed class
jobject InstantiateDefaultPBC(JNIEnv* env, const char* classpath, void* ptr);
// typedef nn_Exit (nn_ComponentHandler)(nn_ComponentRequest *request);
nn_Exit JNIComponentHandler(nn_ComponentRequest* request);
bool CallGC(JNIEnv* env);
}
namespace Carbon::Exceptions {
CARBON_EXCEPTION_FUNC(ThrowNullPtr, "java/lang/NullPointerException");
}
#undef CARBON_EXCEPTION_FUNC

170
src/native/main.cpp Normal file
View File

@@ -0,0 +1,170 @@
#include "org_neoflock_NeoNucleus_NativeBindings.h"
#include <iostream>
#include "neonucleus.h"
#include "ncomplib.h"
#include "carbon.hpp"
// TODO: null checks fucking everywhere (thanks java)
// NOTE: almost NOTHING of this has been tested yet
// WARN: **apparently** GetFieldID can error out on OOM, this will not be an issue for now (i think),
// but we need to account for it before or after MVP (modded minecraft is famously known for being memory hungry)
// NOTE: not sure if i should use nn_alloc over malloc where possible
/*nn_Architecture readArch(JNIEnv * env, jobject obj) {
jclass clazz = env->GetObjectClass(obj);
jfieldID nid = env->GetFieldID(clazz, "name", "Ljava.lang.String;");
jstring jstr = (jstring)env->GetObjectField(obj, nid);
const char * name = env->GetStringUTFChars(jstr, (jboolean) false);// this shit will so become invalid after the func
Carbon::GlobalArchState* statePtr = (Carbon::GlobalArchState*)Carbon::PointerBacked::GetPointer(env, obj);
if (statePtr == NULL) {
// we cant just store this on the stack since nn_Architecture wants a *pointer*,
// if i do a pointer to a variable on the stack its just gonna vanish as soon as the function ends
Carbon::GlobalArchState* state = (Carbon::GlobalArchState*)malloc(sizeof(Carbon::GlobalArchState));
*state = {
.target = {
.env = env,
.obj = env->NewGlobalRef(obj)
}
};
}
return (nn_Architecture) {
.name = name,
.state = (void*) statePtr,
.handler = Carbon::archRequestHandler
};
}*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1initContext
(JNIEnv * env, jclass ogClazz) {
//jclass clazz = env->FindClass("org/neoflock/NeoNucleus/nn_Context");
//jmethodID creator = env->GetStaticMethodID(clazz, "createFromPointer", "(J)Lorg/neoflock/NeoNucleus/Context;");
jobject obj = Carbon::InstantiateOpaqueClass(env, "org/neoflock/NeoNucleus/nn_Context");
nn_Context * ctx = (nn_Context*)malloc(sizeof(nn_Context));
nn_initContext(ctx);
//jobject result = env->CallStaticObjectMethod(clazz, creator, (jlong) ctx);
Carbon::PointerBacked::SetPointer(env, obj, ctx);
return obj;
}
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1initPalettes
(JNIEnv *, jclass) { // fucking cakewalk compared to the horrors that'll unfold within this cpp file
nn_initPalettes();
}
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1createUniverse
(JNIEnv * env, jclass, jobject ctx) {
nn_Context* nnCtx = (nn_Context*) Carbon::PointerBacked::GetPointer(env, ctx);
// TODO: check if this is error handled properly
NULLPTR_CHECK(nnCtx, nn_Context);
nn_Universe* universe = nn_createUniverse(nnCtx, NULL);
/*jclass clazz = env->FindClass("org/neoflock/NeoNucleus/nn_Universe");
jmethodID creator = env->GetStaticMethodID(clazz, "createFromPointer", "(J)Lorg/neoflock/NeoNucleus/Universe;");
return env->CallStaticObjectMethod(clazz, creator, (jlong) universe);*/
return Carbon::InstantiateDefaultPBC(env, "org/neoflock/NeoNucleus/nn_Universe", universe);
}
// public static native nn_Component nn_createComponent(nn_Universe universe, String address, String type);
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1createComponent
(JNIEnv * env, jclass, jobject universe, jstring address, jstring type) {
nn_Universe* nnUni = (nn_Universe*) Carbon::PointerBacked::GetPointer(env, universe);
NULLPTR_CHECK(nnUni, nn_Universe);
const char* addressChars = env->GetStringUTFChars(address, NULL);
const char* typeChars = env->GetStringUTFChars(type, NULL);
nn_Component* component = nn_createComponent(nnUni, addressChars, typeChars);
env->ReleaseStringUTFChars(address, addressChars);
env->ReleaseStringUTFChars(type, typeChars);
return Carbon::InstantiateDefaultPBC(env, "org/neoflock/NeoNucleus/nn_Component", component);
}
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1setComponentMethods
(JNIEnv * env, jclass, jobject component, jobjectArray methods) {
NULLPTR_CHECK(methods, methods);
nn_Component* nnComp = (nn_Component*) Carbon::PointerBacked::GetPointer(env, component);
NULLPTR_CHECK(nnComp, nn_Component);
jclass methodClass = env->FindClass("org/neoflock/NeoNucleus/nn_Method");
jfieldID nameField = env->GetFieldID(methodClass, "name", "Ljava.lang.String");
jfieldID docField = env->GetFieldID(methodClass, "doc", "Ljava.lang.String");
jfieldID flagsField = env->GetFieldID(methodClass, "flags", "B");
size_t len = (size_t) env->GetArrayLength(methods);
nn_Method nMethods[len]; // stack allocated, shouldnt be an issue unless you're a freak pushing thousands of methods
for (size_t i = 0; i < len; i++) {
jobject oArr = env->GetObjectArrayElement(methods, i);
jstring nameStr = (jstring) env->GetObjectField(oArr, nameField);
jstring docStr = (jstring) env->GetObjectField(oArr, docField);
jbyte flagsByte = env->GetByteField(oArr, flagsField);
nMethods[i] = {
.name = env->GetStringUTFChars(nameStr, NULL),
.doc = env->GetStringUTFChars(docStr, NULL),
.flags = (nn_MethodFlags) env->GetByteField(oArr, NULL)
};
}
// no shot this line below is actually gonna work
nn_Exit exitCode = nn_setComponentMethodsArray(nnComp, const_cast<const nn_Method*>(&nMethods[0]), len);
// lets cleanup!!!
for (size_t i = 0; i < len; i++) {
jobject oArr = env->GetObjectArrayElement(methods, i);
jstring nameStr = (jstring) env->GetObjectField(oArr, nameField); // TODO: check if this returns a different pointer on a second run
jstring docStr = (jstring) env->GetObjectField(oArr, docField); // if it does then we'll have to store the original field jstrings too to clean them up properly
nn_Method nm = nMethods[i];
env->ReleaseStringUTFChars(nameStr, nm.name);
env->ReleaseStringUTFChars(docStr, nm.doc);
}
return Carbon::Map::To_nn_Exit(env, exitCode);
}
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1setComponentHandler
(JNIEnv * env, jclass, jobject component, jobject handler) {
nn_Component* nnComp = (nn_Component*) Carbon::PointerBacked::GetPointer(env, component);
NULLPTR_CHECKNR(nnComp, nn_Component);
nn_setComponentHandler(nnComp, &Carbon::JNIComponentHandler);
}
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1mountComponent
(JNIEnv * env, jclass, jobject computer, jobject comp, jint slot, jboolean silent) {
nn_Computer* nnPC = (nn_Computer*) Carbon::PointerBacked::GetPointer(env, computer);
nn_Component* nnComp = (nn_Component*) Carbon::PointerBacked::GetPointer(env, comp);
NULLPTR_CHECK(nnPC, nn_Component);
NULLPTR_CHECK(nnComp, nn_Computer);
return Carbon::Map::To_nn_Exit(env, nn_mountComponent(nnPC, nnComp, slot, silent));
}
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_ncl_1createEEPROM
(JNIEnv * env, jclass, jobject universe, jstring address, jobject eeprom, jstring code, jboolean isReadonly) {
nn_Universe* nnUni = (nn_Universe*) Carbon::PointerBacked::GetPointer(env, universe);
nn_EEPROM* nnEEPROM = (nn_EEPROM*) Carbon::PointerBacked::GetPointer(env, eeprom);
NULLPTR_CHECK(nnUni, nn_Universe);
NULLPTR_CHECK(nnEEPROM, nn_EEPROM);
const char * addr = env->GetStringUTFChars(address, NULL);
const char * codeStr = env->GetStringUTFChars(code, NULL);
jsize codeLen = env->GetStringUTFLength(code); // TODO: check if this is the byte count or character count
nn_Component* comp = ncl_createEEPROM(nnUni, addr, nnEEPROM, codeStr, codeLen, isReadonly);
env->ReleaseStringUTFChars(address, addr);
env->ReleaseStringUTFChars(code, codeStr);
return Carbon::InstantiateDefaultPBC(env, "org/neoflock/NeoNucleus/nn_Component", comp);
}
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1createComputer
(JNIEnv * env, jclass, jobject universe, jstring address, jlong totalMemory, jlong maxComponents, jlong maxDevices) {
nn_Universe* nnUni = (nn_Universe*) Carbon::PointerBacked::GetPointer(env, universe);
NULLPTR_CHECK(nnUni, nn_Universe);
const char * addr = env->GetStringUTFChars(address, NULL);
// TODO: computer jni userdata lol
nn_Computer* computer = nn_createComputer(nnUni, NULL, addr, totalMemory, maxComponents, maxDevices);
env->ReleaseStringUTFChars(address, addr);
return Carbon::InstantiateDefaultPBC(env, "org/neoflock/NeoNucleus/nn_Computer", computer);
}

2437
src/native/neonucleus.h Normal file

File diff suppressed because it is too large Load Diff

2004
src/native/neonucleus.h.old Normal file

File diff suppressed because it is too large Load Diff

11
src/native/nn_Context.cpp Normal file
View File

@@ -0,0 +1,11 @@
#include "carbon.hpp"
#include "org_neoflock_NeoNucleus_Context.h"
#include <malloc.h>
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_Context_free
(JNIEnv * env, jobject obj) {
void* ptr = Carbon::PointerBacked::GetPointer(env, obj);
NULLPTR_CHECKNR(ptr, nn_Context);
free(ptr);
Carbon::PointerBacked::ResetPointer(env, obj); // lets not be having accidental double frees here
}

36
src/native/nn_EEPROM.cpp Normal file
View File

@@ -0,0 +1,36 @@
#include "org_neoflock_NeoNucleus_nn_EEPROM.h"
#include <cstdlib>
#include <cstring>
#include "carbon.hpp"
// FIXME: doesn't check for null
#define GET_LONG_FIELD(name) eepromNative->name = (uint64_t) env->GetLongField(eeprom, env->GetFieldID(clazz, #name, "J"));
#define GET_DOUBLE_FIELD(name) eepromNative->name = (double) env->GetDoubleField(eeprom, env->GetFieldID(clazz, #name, "D"));
JNIEXPORT jboolean JNICALL Java_org_neoflock_NeoNucleus_nn_1EEPROM_allocate
(JNIEnv * env, jobject eeprom) {
jclass clazz = env->GetObjectClass(eeprom);
//jfieldID fid = env->GetFieldID(clazz, "ptr", "J");
//jlong size = env->GetLongField(eeprom, fid);
nn_EEPROM * eepromNative = (nn_EEPROM*)malloc(sizeof(nn_EEPROM));
GET_LONG_FIELD(size);
GET_LONG_FIELD(dataSize);
GET_DOUBLE_FIELD(readEnergyCost);
GET_DOUBLE_FIELD(readDataEnergyCost);
GET_DOUBLE_FIELD(writeEnergyCost);
GET_DOUBLE_FIELD(writeDataEnergyCost);
GET_DOUBLE_FIELD(writeDelay);
GET_DOUBLE_FIELD(writeDelay);
//printf("double_size=%d, %d %d %lf %lf %lf\n", sizeof(double), eepromNative->size, eepromNative->dataSize, eepromNative->readEnergyCost, eepromNative->readDataEnergyCost, eepromNative->writeEnergyCost);
return Carbon::PointerBacked::SetPointer(env, eeprom, eepromNative);
}
JNIEXPORT jboolean JNICALL Java_org_neoflock_NeoNucleus_nn_1EEPROM_free
(JNIEnv * env, jobject eeprom) {
if (Carbon::PointerBacked::GetPointer(env, eeprom) == NULL) {
NULLPTR_THROW(nn_EEPROM);
return false;
}
// assuming free(NULL) does nothing, this should be fine
free(Carbon::PointerBacked::GetPointer(env, eeprom));
Carbon::PointerBacked::ResetPointer(env, eeprom);
return true;
}

View File

@@ -0,0 +1,21 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_neoflock_NeoNucleus_Context */
#ifndef _Included_org_neoflock_NeoNucleus_Context
#define _Included_org_neoflock_NeoNucleus_Context
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_neoflock_NeoNucleus_Context
* Method: free
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_Context_free
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,405 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_neoflock_NeoNucleus_NativeBindings */
#ifndef _Included_org_neoflock_NeoNucleus_NativeBindings
#define _Included_org_neoflock_NeoNucleus_NativeBindings
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_initContext
* Signature: ()Lorg/neoflock/NeoNucleus/nn_Context;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1initContext
(JNIEnv *, jclass);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_initPalettes
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1initPalettes
(JNIEnv *, jclass);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_createUniverse
* Signature: (Lorg/neoflock/NeoNucleus/nn_Context;)Lorg/neoflock/NeoNucleus/nn_Universe;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1createUniverse
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_createComponent
* Signature: (Lorg/neoflock/NeoNucleus/nn_Universe;Ljava/lang/String;Ljava/lang/String;)Lorg/neoflock/NeoNucleus/nn_Component;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1createComponent
(JNIEnv *, jclass, jobject, jstring, jstring);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_setComponentMethods
* Signature: (Lorg/neoflock/NeoNucleus/nn_Component;[Lorg/neoflock/NeoNucleus/nn_Method;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1setComponentMethods
(JNIEnv *, jclass, jobject, jobjectArray);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_setComponentHandler
* Signature: (Lorg/neoflock/NeoNucleus/nn_Component;Lorg/neoflock/NeoNucleus/ComponentHandler;)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1setComponentHandler
(JNIEnv *, jclass, jobject, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_mountComponent
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Lorg/neoflock/NeoNucleus/nn_Component;IZ)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1mountComponent
(JNIEnv *, jclass, jobject, jobject, jint, jboolean);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: ncl_createEEPROM
* Signature: (Lorg/neoflock/NeoNucleus/nn_Universe;Ljava/lang/String;Lorg/neoflock/NeoNucleus/nn_EEPROM;Ljava/lang/String;Z)Lorg/neoflock/NeoNucleus/nn_Component;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_ncl_1createEEPROM
(JNIEnv *, jclass, jobject, jstring, jobject, jstring, jboolean);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_createComputer
* Signature: (Lorg/neoflock/NeoNucleus/nn_Universe;Ljava/lang/String;JJJ)Lorg/neoflock/NeoNucleus/nn_Computer;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1createComputer
(JNIEnv *, jclass, jobject, jstring, jlong, jlong, jlong);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_setComputerEnvironment
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Lorg/neoflock/NeoNucleus/nn_Environment;)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1setComputerEnvironment
(JNIEnv *, jclass, jobject, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_setCallBudget
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;D)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1setCallBudget
(JNIEnv *, jclass, jobject, jdouble);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_setTotalEnergy
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;D)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1setTotalEnergy
(JNIEnv *, jclass, jobject, jdouble);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_setArchitecture
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Lorg/neoflock/NeoNucleus/nn_Architecture;)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1setArchitecture
(JNIEnv *, jclass, jobject, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_addSupportedArchitecture
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Lorg/neoflock/NeoNucleus/nn_Architecture;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1addSupportedArchitecture
(JNIEnv *, jclass, jobject, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_setTmpAddress
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Ljava/lang/String;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1setTmpAddress
(JNIEnv *, jclass, jobject, jstring);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_getComponentAddress
* Signature: (Lorg/neoflock/NeoNucleus/nn_Component;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1getComponentAddress
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_addCommonDeviceInfo
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Ljava/lang/String;Lorg/neoflock/NeoNucleus/nn_CommonDeviceInfo;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1addCommonDeviceInfo
(JNIEnv *, jclass, jobject, jstring, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_getComponentState
* Signature: (Lorg/neoflock/NeoNucleus/nn_Component;)Lorg/neoflock/NeoNucleus/ComponentState;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1getComponentState
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: ncl_lockScreen
* Signature: (Lorg/neoflock/NeoNucleus/ncl_ScreenState;)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_ncl_1lockScreen
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: ncl_getScreenViewport
* Signature: (Lorg/neoflock/NeoNucleus/ncl_ScreenState;)Lorg/neoflock/NeoNucleus/Resolution;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_ncl_1getScreenViewport
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: ncl_setScreenViewport
* Signature: (Lorg/neoflock/NeoNucleus/ncl_ScreenState;JJ)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_ncl_1setScreenViewport
(JNIEnv *, jclass, jobject, jlong, jlong);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: ncl_getScreenFlags
* Signature: (Lorg/neoflock/NeoNucleus/ncl_ScreenState;)Lorg/neoflock/NeoNucleus/ncl_ScreenFlags;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_ncl_1getScreenFlags
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: ncl_getScreenBrightness
* Signature: (Lorg/neoflock/NeoNucleus/ncl_ScreenState;)D
*/
JNIEXPORT jdouble JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_ncl_1getScreenBrightness
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: ncl_getScreenPixel
* Signature: (Lorg/neoflock/NeoNucleus/ncl_ScreenState;II)Lorg/neoflock/NeoNucleus/ncl_Pixel;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_ncl_1getScreenPixel
(JNIEnv *, jclass, jobject, jint, jint);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: ncl_unlockScreen
* Signature: (Lorg/neoflock/NeoNucleus/ncl_ScreenState;)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_ncl_1unlockScreen
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_pushTouch
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Ljava/lang/String;DDILjava/lang/String;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1pushTouch
(JNIEnv *, jclass, jobject, jstring, jdouble, jdouble, jint, jstring);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_pushDrop
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Ljava/lang/String;DDILjava/lang/String;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1pushDrop
(JNIEnv *, jclass, jobject, jstring, jdouble, jdouble, jint, jstring);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_pushDrag
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Ljava/lang/String;DDILjava/lang/String;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1pushDrag
(JNIEnv *, jclass, jobject, jstring, jdouble, jdouble, jint, jstring);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_pushScroll
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Ljava/lang/String;DDDLjava/lang/String;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1pushScroll
(JNIEnv *, jclass, jobject, jstring, jdouble, jdouble, jdouble, jstring);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_getUsedMemory
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;)J
*/
JNIEXPORT jlong JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1getUsedMemory
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_getTotalMemory
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;)J
*/
JNIEXPORT jlong JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1getTotalMemory
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_pushClipboard
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1pushClipboard
(JNIEnv *, jclass, jobject, jstring, jstring, jstring);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_pushKeyDown
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Ljava/lang/String;IILjava/lang/String;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1pushKeyDown
(JNIEnv *, jclass, jobject, jstring, jint, jint, jstring);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_pushKeyUp
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;Ljava/lang/String;IILjava/lang/String;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1pushKeyUp
(JNIEnv *, jclass, jobject, jstring, jint, jint, jstring);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_clearstack
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1clearstack
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_removeEnergy
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;D)Z
*/
JNIEXPORT jboolean JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1removeEnergy
(JNIEnv *, jclass, jobject, jdouble);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_tickSynchronized
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1tickSynchronized
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: ncl_getScreenEnergyUsage
* Signature: (Lorg/neoflock/NeoNucleus/ncl_ScreenState;)D
*/
JNIEXPORT jdouble JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_ncl_1getScreenEnergyUsage
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_resetIdleTime
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1resetIdleTime
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_tick
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;)Lorg/neoflock/NeoNucleus/nn_Exit;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1tick
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_getComputerState
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;)Lorg/neoflock/NeoNucleus/nn_ComputerState;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1getComputerState
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_getError
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1getError
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_getDesiredArchitecture
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;)Lorg/neoflock/NeoNucleus/nn_Architecture;
*/
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1getDesiredArchitecture
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_stopComputer
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1stopComputer
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: ncl_resetScreen
* Signature: (Lorg/neoflock/NeoNucleus/ncl_ScreenState;)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_ncl_1resetScreen
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_addIdleTime
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;D)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1addIdleTime
(JNIEnv *, jclass, jobject, jdouble);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_destroyComputer
* Signature: (Lorg/neoflock/NeoNucleus/nn_Computer;)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1destroyComputer
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_dropComponent
* Signature: (Lorg/neoflock/NeoNucleus/nn_Component;)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1dropComponent
(JNIEnv *, jclass, jobject);
/*
* Class: org_neoflock_NeoNucleus_NativeBindings
* Method: nn_destroyUniverse
* Signature: (Lorg/neoflock/NeoNucleus/nn_Universe;)V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1destroyUniverse
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,29 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_neoflock_NeoNucleus_nn_Architecture */
#ifndef _Included_org_neoflock_NeoNucleus_nn_Architecture
#define _Included_org_neoflock_NeoNucleus_nn_Architecture
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_neoflock_NeoNucleus_nn_Architecture
* Method: allocate
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_neoflock_NeoNucleus_nn_1Architecture_allocate
(JNIEnv *, jobject);
/*
* Class: org_neoflock_NeoNucleus_nn_Architecture
* Method: free
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_neoflock_NeoNucleus_nn_1Architecture_free
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,21 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_neoflock_NeoNucleus_nn_Context */
#ifndef _Included_org_neoflock_NeoNucleus_nn_Context
#define _Included_org_neoflock_NeoNucleus_nn_Context
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_neoflock_NeoNucleus_nn_Context
* Method: free
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_neoflock_NeoNucleus_nn_1Context_free
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,29 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class org_neoflock_NeoNucleus_nn_EEPROM */
#ifndef _Included_org_neoflock_NeoNucleus_nn_EEPROM
#define _Included_org_neoflock_NeoNucleus_nn_EEPROM
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: org_neoflock_NeoNucleus_nn_EEPROM
* Method: allocate
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_neoflock_NeoNucleus_nn_1EEPROM_allocate
(JNIEnv *, jobject);
/*
* Class: org_neoflock_NeoNucleus_nn_EEPROM
* Method: free
* Signature: ()Z
*/
JNIEXPORT jboolean JNICALL Java_org_neoflock_NeoNucleus_nn_1EEPROM_free
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif