view java/src/com/aurellem/gb/Gb.java @ 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 431ee7ee12de
line wrap: on
line source
1 package com.aurellem.gb;
3 import java.nio.ByteBuffer;
4 import java.nio.ByteOrder;
6 public class Gb {
9 public Gb(){}
12 /**
13 * Hello World! This is just to test the native interface.
14 */
15 public static native void sayHello();
17 /**
18 * Run the emulator on a given rom
19 * @param rom - the name of the rom.
20 */
21 public static native void startEmulator(String rom);
24 public static void loadVBA(){
25 System.loadLibrary("vba");
26 }
28 public static native void step();
30 public static native void step(int keymask);
32 public static native void shutdown();
34 public static native void saveState(ByteBuffer buffer, int size);
36 public static native void loadState(ByteBuffer buffer, int size);
38 public static final int SAVE_SIZE = 9000;
40 public static ByteBuffer saveState(){
41 ByteBuffer buf =
42 ByteBuffer.allocateDirect(SAVE_SIZE)
43 .order(ByteOrder.nativeOrder());
44 buf.clear();
45 saveState(buf, SAVE_SIZE);
46 buf.flip();
47 return buf;
48 }
50 public static void loadState(ByteBuffer saveState){
51 loadState(saveState, SAVE_SIZE);
52 }
54 }