Mercurial > vba-clojure
view src/clojure/clojure.cpp @ 74:aaddd7b72a0e
added optional argument to rewind
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 08 Mar 2012 04:40:18 -0600 |
parents | 4699c7bab77d |
children | d7c38ce83421 |
line wrap: on
line source
1 #include "com_aurellem_gb_Gb.h"2 #include "../sdl/Drive.h"3 #include "../gb/GB.h"5 #include <string.h>7 #define UNUSED(x) (void)(x)10 /*11 * Class: com_aurellem_gb_Gb12 * Method: sayHello13 * Signature: ()V14 */15 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_sayHello16 (JNIEnv *env, jclass clazz){17 UNUSED(env);UNUSED(clazz);18 printf("Hello from GB\n");19 }21 /*22 * Class: com_aurellem_gb_Gb23 * Method: startEmulator24 * Signature: (Ljava/lang/String;)V25 */26 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_startEmulator27 (JNIEnv *env, jclass clazz, jstring str){28 UNUSED(env);UNUSED(clazz);UNUSED(str);30 const char *_romName = env->GetStringUTFChars(str, 0);31 size_t len = strlen(_romName);33 char romName[len + 1];35 strcpy(romName, _romName);37 char* arguments[] = {"vba-rlm", romName};38 runVBA(2, arguments);39 }44 /*45 * Class: com_aurellem_gb_Gb46 * Method: step47 * Signature: ()V48 */49 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_step__50 (JNIEnv *env, jclass clazz){51 step();52 }54 /*55 * Class: com_aurellem_gb_Gb56 * Method: step57 * Signature: (I)V58 */59 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_step__I60 (JNIEnv *env, jclass clazz, jint keymask){61 step(keymask);62 }68 /*69 * Class: com_aurellem_gb_Gb70 * Method: shutdown71 * Signature: ()V72 */73 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_shutdown74 (JNIEnv *env, jclass clazz){75 shutdown();77 }79 /*80 * Class: com_aurellem_gb_Gb81 * Method: saveState82 * Signature: (Ljava/nio/ByteBuffer;)V83 */84 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_saveState85 (JNIEnv *env, jclass clazz, jobject buffer, jint size){86 char* buffer_address =87 ((char*) env->GetDirectBufferAddress(buffer));88 gbWriteMemSaveState(buffer_address, size);89 }91 /*92 * Class: com_aurellem_gb_Gb93 * Method: loadState94 * Signature: (Ljava/nio/ByteBuffer;)V95 */96 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_loadState97 (JNIEnv *env, jclass clazz, jobject buffer, jint size){98 char* buffer_address =99 ((char*) env->GetDirectBufferAddress(buffer));100 gbReadMemSaveState(buffer_address, size);101 }104 /*105 * Class: com_aurellem_gb_Gb106 * Method: getROMSize107 * Signature: ()I108 */109 JNIEXPORT jint JNICALL Java_com_aurellem_gb_Gb_getROMSize110 (JNIEnv *env, jclass clazz){111 return getRomSize();112 }114 /*115 * Class: com_aurellem_gb_Gb116 * Method: getRAMSize117 * Signature: ()I118 */119 JNIEXPORT jint JNICALL Java_com_aurellem_gb_Gb_getRAMSize120 (JNIEnv *env, jclass clazz){121 return getRamSize();122 }124 /*125 * Class: com_aurellem_gb_Gb126 * Method: getRAM127 * Signature: ([I)V128 */129 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_getRAM130 (JNIEnv *env, jclass clazz, jintArray arr){131 jint *ram_store = env->GetIntArrayElements(arr, 0);132 storeRam(ram_store);133 env->ReleaseIntArrayElements(arr, ram_store, 0);134 }137 /*138 * Class: com_aurellem_gb_Gb139 * Method: getROM140 * Signature: ([I)V141 */142 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_getROM143 (JNIEnv *env, jclass clazz, jintArray arr){144 jint *ram_store = env->GetIntArrayElements(arr, 0);145 storeRom(ram_store);146 env->ReleaseIntArrayElements(arr, ram_store, 0);147 }150 /*151 * Class: com_aurellem_gb_Gb152 * Method: getWRAM153 * Signature: ([I)V154 */155 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_getWRAM156 (JNIEnv *env, jclass clazz, jintArray arr){157 jint *ram_store = env->GetIntArrayElements(arr, 0);158 storeWRam(ram_store);159 env->ReleaseIntArrayElements(arr, ram_store, 0);160 }163 /*164 * Class: com_aurellem_gb_Gb165 * Method: getVRAM166 * Signature: ([I)V167 */168 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_getVRAM169 (JNIEnv *env, jclass clazz, jintArray arr){170 jint *ram_store = env->GetIntArrayElements(arr, 0);171 storeVRam(ram_store);172 env->ReleaseIntArrayElements(arr, ram_store, 0);173 }176 /*177 * Class: com_aurellem_gb_Gb178 * Method: getRegisters179 * Signature: ([I)V180 */181 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_getRegisters182 (JNIEnv *env, jclass clazz, jintArray arr){183 jint *registers_store = env->GetIntArrayElements(arr, 0);184 storeRegisters(registers_store);185 env->ReleaseIntArrayElements(arr, registers_store, 0);186 }