Mercurial > vba-clojure
view src/clojure/clojure.cpp @ 57:b0473c3a0df0
going to work on getting CPU data
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 07 Mar 2012 14:20:57 -0600 |
parents | ba4fdfb722ed |
children | 3ce48d803e74 |
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 }