annotate java/src/com/aurellem/gb/Gb.java @ 59:3ce48d803e74

added functions to get rom/ram sizes
author Robert McIntyre <rlm@mit.edu>
date Wed, 07 Mar 2012 17:40:00 -0600
parents 431ee7ee12de
children ef59aee6d715
rev   line source
rlm@43 1 package com.aurellem.gb;
rlm@43 2
rlm@43 3 import java.nio.ByteBuffer;
rlm@56 4 import java.nio.ByteOrder;
rlm@43 5
rlm@43 6 public class Gb {
rlm@43 7
rlm@43 8
rlm@43 9 public Gb(){}
rlm@43 10
rlm@43 11
rlm@43 12 /**
rlm@43 13 * Hello World! This is just to test the native interface.
rlm@43 14 */
rlm@48 15 public static native void sayHello();
rlm@43 16
rlm@43 17 /**
rlm@43 18 * Run the emulator on a given rom
rlm@43 19 * @param rom - the name of the rom.
rlm@43 20 */
rlm@48 21 public static native void startEmulator(String rom);
rlm@48 22
rlm@48 23
rlm@48 24 public static void loadVBA(){
rlm@48 25 System.loadLibrary("vba");
rlm@48 26 }
rlm@43 27
rlm@53 28 public static native void step();
rlm@53 29
rlm@55 30 public static native void step(int keymask);
rlm@55 31
rlm@53 32 public static native void shutdown();
rlm@50 33
rlm@56 34 public static native void saveState(ByteBuffer buffer, int size);
rlm@56 35
rlm@56 36 public static native void loadState(ByteBuffer buffer, int size);
rlm@56 37
rlm@58 38 public static final int SAVE_SIZE = 90000;
rlm@56 39
rlm@56 40 public static ByteBuffer saveState(){
rlm@56 41 ByteBuffer buf =
rlm@56 42 ByteBuffer.allocateDirect(SAVE_SIZE)
rlm@56 43 .order(ByteOrder.nativeOrder());
rlm@56 44 buf.clear();
rlm@56 45 saveState(buf, SAVE_SIZE);
rlm@56 46 buf.flip();
rlm@56 47 return buf;
rlm@56 48 }
rlm@56 49
rlm@56 50 public static void loadState(ByteBuffer saveState){
rlm@56 51 loadState(saveState, SAVE_SIZE);
rlm@56 52 }
rlm@56 53
rlm@59 54 public static native int getROMSize();
rlm@59 55 public static native int getRAMSize();
rlm@59 56
rlm@59 57
rlm@59 58 public static final int WRAM_SIZE = 0x8000;
rlm@59 59
rlm@59 60 public static final int VRAM_SIZE = 0x4000;
rlm@59 61
rlm@59 62
rlm@59 63
rlm@59 64
rlm@43 65 }