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_Gb
12 * Method: sayHello
13 * Signature: ()V
14 */
15 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_sayHello
16 (JNIEnv *env, jclass clazz){
17 UNUSED(env);UNUSED(clazz);
18 printf("Hello from GB\n");
19 }
21 /*
22 * Class: com_aurellem_gb_Gb
23 * Method: startEmulator
24 * Signature: (Ljava/lang/String;)V
25 */
26 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_startEmulator
27 (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_Gb
46 * Method: step
47 * Signature: ()V
48 */
49 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_step__
50 (JNIEnv *env, jclass clazz){
51 step();
52 }
54 /*
55 * Class: com_aurellem_gb_Gb
56 * Method: step
57 * Signature: (I)V
58 */
59 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_step__I
60 (JNIEnv *env, jclass clazz, jint keymask){
61 step(keymask);
62 }
68 /*
69 * Class: com_aurellem_gb_Gb
70 * Method: shutdown
71 * Signature: ()V
72 */
73 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_shutdown
74 (JNIEnv *env, jclass clazz){
75 shutdown();
77 }
79 /*
80 * Class: com_aurellem_gb_Gb
81 * Method: saveState
82 * Signature: (Ljava/nio/ByteBuffer;)V
83 */
84 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_saveState
85 (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_Gb
93 * Method: loadState
94 * Signature: (Ljava/nio/ByteBuffer;)V
95 */
96 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_loadState
97 (JNIEnv *env, jclass clazz, jobject buffer, jint size){
98 char* buffer_address =
99 ((char*) env->GetDirectBufferAddress(buffer));
100 gbReadMemSaveState(buffer_address, size);
101 }