view src/clojure/clojure.cpp @ 55:719d910c90f8

can now send button presses to the simulated gameboy
author Robert McIntyre <rlm@mit.edu>
date Wed, 07 Mar 2012 13:24:32 -0600
parents 9d0ec2614443
children ba4fdfb722ed
line wrap: on
line source
1 #include "com_aurellem_gb_Gb.h"
2 #include "../sdl/Drive.h"
4 #include <string.h>
6 #define UNUSED(x) (void)(x)
9 /*
10 * Class: com_aurellem_gb_Gb
11 * Method: sayHello
12 * Signature: ()V
13 */
14 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_sayHello
15 (JNIEnv *env, jclass clazz){
16 UNUSED(env);UNUSED(clazz);
17 printf("Hello from GB\n");
18 }
20 /*
21 * Class: com_aurellem_gb_Gb
22 * Method: startEmulator
23 * Signature: (Ljava/lang/String;)V
24 */
25 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_startEmulator
26 (JNIEnv *env, jclass clazz, jstring str){
27 UNUSED(env);UNUSED(clazz);UNUSED(str);
29 const char *_romName = env->GetStringUTFChars(str, 0);
30 size_t len = strlen(_romName);
32 char romName[len + 1];
34 strcpy(romName, _romName);
36 char* arguments[] = {"vba-rlm", romName};
37 runVBA(2, arguments);
38 }
43 /*
44 * Class: com_aurellem_gb_Gb
45 * Method: step
46 * Signature: ()V
47 */
48 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_step__
49 (JNIEnv *env, jclass clazz){
50 step();
51 }
53 /*
54 * Class: com_aurellem_gb_Gb
55 * Method: step
56 * Signature: (I)V
57 */
58 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_step__I
59 (JNIEnv *env, jclass clazz, jint keymask){
60 step(keymask);
61 }
67 /*
68 * Class: com_aurellem_gb_Gb
69 * Method: shutdown
70 * Signature: ()V
71 */
72 JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_shutdown
73 (JNIEnv *env, jclass clazz){
74 shutdown();
75 }