1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
12 #include "frontend/emulator/jniHelper.h"
13 #include "sjme/boot.h"
15 #define SJME_CLASS_NVM_STATE cc_squirreljme_vm_nanocoat_NvmState
17 jlong
SJME_JNI_METHOD(SJME_CLASS_NVM_STATE
, _1_1nvmBoot
)
18 (JNIEnv
* env
, jclass classy
, jlong poolPtr
, jobject wrapper
)
20 sjme_nvm_state
* state
;
23 /* Initialize new state. */
25 if (SJME_ERROR_CODE_NONE
!= (error
= sjme_nvm_boot(
26 SJME_JLONG_TO_POINTER(sjme_alloc_pool
*, poolPtr
),
27 NULL
, &state
, 0, NULL
)) || state
== NULL
)
29 sjme_jni_throwVMException(env
, error
);
33 /* Set self reference object, we need a global reference for it. */
34 state
->frontEndWrapper
= SJME_FRONT_END_WRAP(
35 (*env
)->NewGlobalRef(env
, wrapper
));
37 /* Use pointer to the state. */
38 return SJME_POINTER_TO_JLONG(state
);