Set of virtual suite functions.
[SquirrelJME.git] / nanocoat / frontend / emulator / nativeVirtualSuite.c
blob6e95365c906843fc7ef1b2e3adb6b89010538dfe
1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
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 // -------------------------------------------------------------------------*/
10 #include <jni.h>
12 #include "frontend/emulator/jniHelper.h"
13 #include "sjme/rom.h"
14 #include "sjme/alloc.h"
15 #include "sjme/debug.h"
17 static sjme_errorCode sjme_jni_virtualSuite_list()
19 sjme_todo("Implement this?");
20 return 0;
23 static sjme_errorCode sjme_jni_virtualSuite_loadLibrary()
25 sjme_todo("Implement this?");
26 return 0;
29 jlong SJME_JNI_METHOD(SJME_CLASS_VIRTUAL_SUITE, _1_1init)
30 (JNIEnv* env, jclass classy, jlong poolPtr, jobject this)
32 sjme_alloc_pool* pool;
33 sjme_rom_suiteFunctions* result;
34 sjme_errorCode error;
36 if (poolPtr == 0 || this == NULL)
38 sjme_jni_throwVMException(env, SJME_ERROR_NULL_ARGUMENTS);
39 return 0;
42 /* Get the pool pointer. */
43 pool = SJME_JLONG_TO_POINTER(sjme_alloc_pool*, poolPtr);
45 /* Allocate the suite data. */
46 result = NULL;
47 error = SJME_ERROR_UNKNOWN;
48 if (SJME_IS_ERROR(error = sjme_alloc(pool, sizeof(*result),
49 (void**)&result)) || result == NULL)
51 sjme_jni_throwVMException(env, error);
52 return 0;
55 /* Set function handlers. */
56 result->list = sjme_jni_virtualSuite_list;
57 result->loadLibrary = sjme_jni_virtualSuite_loadLibrary;
59 /* Setup wrapper to reference. */
60 result->frontEnd.data = env;
61 result->frontEnd.wrapper = SJME_FRONT_END_WRAP(
62 (*env)->NewGlobalRef(env, this));
64 /* Use the given result. */
65 return SJME_POINTER_TO_JLONG(result);