changeset 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 88218735d220
children ba4fdfb722ed
files java/src/com/aurellem/gb/Gb.java org/todo.org src/VisualBoyAdvance.cfg src/clojure/clojure.cpp src/sdl/Drive.h src/sdl/SDL.cpp
diffstat 6 files changed, 37 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/java/src/com/aurellem/gb/Gb.java	Wed Mar 07 12:50:44 2012 -0600
     1.2 +++ b/java/src/com/aurellem/gb/Gb.java	Wed Mar 07 13:24:32 2012 -0600
     1.3 @@ -28,6 +28,8 @@
     1.4  
     1.5      public static native void step();
     1.6  
     1.7 +    public static native void step(int keymask);
     1.8 +
     1.9      public static native void shutdown();
    1.10  
    1.11  }
     2.1 --- a/org/todo.org	Wed Mar 07 12:50:44 2012 -0600
     2.2 +++ b/org/todo.org	Wed Mar 07 13:24:32 2012 -0600
     2.3 @@ -6,13 +6,13 @@
     2.4   - [ ] remove lua
     2.5  
     2.6  ** additional functionality
     2.7 - - [ ] step the simulator
     2.8 + - [X] step the simulator
     2.9   - [ ] get CPU data
    2.10   - [ ] get RAM / ROM data
    2.11   - [ ] save / load state (use savestates)
    2.12   - [ ] write current frame
    2.13   - [ ] write sound
    2.14 - - [ ] send button presses to the GB
    2.15 + - [X] send button presses to the GB
    2.16  
    2.17  * high level
    2.18   - [ ] write vbm files
     3.1 --- a/src/VisualBoyAdvance.cfg	Wed Mar 07 12:50:44 2012 -0600
     3.2 +++ b/src/VisualBoyAdvance.cfg	Wed Mar 07 13:24:32 2012 -0600
     3.3 @@ -89,7 +89,7 @@
     3.4  filter=0
     3.5  
     3.6  # Disable status messages. 0=false, any other value means true
     3.7 -disableStatus=1
     3.8 +disableStatus=0
     3.9  
    3.10  # Enable Gameboy border. 0=false, any other value means true
    3.11  borderOn=0
     4.1 --- a/src/clojure/clojure.cpp	Wed Mar 07 12:50:44 2012 -0600
     4.2 +++ b/src/clojure/clojure.cpp	Wed Mar 07 13:24:32 2012 -0600
     4.3 @@ -37,18 +37,35 @@
     4.4    runVBA(2, arguments);
     4.5  }
     4.6  
     4.7 +
     4.8 +
     4.9 +
    4.10  /*
    4.11   * Class:     com_aurellem_gb_Gb
    4.12   * Method:    step
    4.13   * Signature: ()V
    4.14   */
    4.15 -JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_step
    4.16 +JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_step__
    4.17  (JNIEnv *env, jclass clazz){
    4.18    step();
    4.19  }
    4.20  
    4.21  /*
    4.22   * Class:     com_aurellem_gb_Gb
    4.23 + * Method:    step
    4.24 + * Signature: (I)V
    4.25 + */
    4.26 +JNIEXPORT void JNICALL Java_com_aurellem_gb_Gb_step__I
    4.27 +(JNIEnv *env, jclass clazz, jint keymask){
    4.28 +  step(keymask);
    4.29 +}
    4.30 +
    4.31 +
    4.32 +
    4.33 +
    4.34 +
    4.35 +/*
    4.36 + * Class:     com_aurellem_gb_Gb
    4.37   * Method:    shutdown
    4.38   * Signature: ()V
    4.39   */
    4.40 @@ -58,3 +75,6 @@
    4.41  }
    4.42  
    4.43  
    4.44 +
    4.45 +
    4.46 +
     5.1 --- a/src/sdl/Drive.h	Wed Mar 07 12:50:44 2012 -0600
     5.2 +++ b/src/sdl/Drive.h	Wed Mar 07 13:24:32 2012 -0600
     5.3 @@ -2,4 +2,6 @@
     5.4  
     5.5  void step();
     5.6  
     5.7 +void step(int keymask);
     5.8 +
     5.9  void shutdown();
     6.1 --- a/src/sdl/SDL.cpp	Wed Mar 07 12:50:44 2012 -0600
     6.2 +++ b/src/sdl/SDL.cpp	Wed Mar 07 13:24:32 2012 -0600
     6.3 @@ -2090,13 +2090,17 @@
     6.4      SDL_Delay(500);
     6.5    }
     6.6    sdlPollEvents();
     6.7 -  if(mouseCounter) {
     6.8 -    mouseCounter--;
     6.9 -    if(mouseCounter == 0)
    6.10 -      SDL_ShowCursor(SDL_DISABLE);
    6.11 -  }
    6.12 +  SDL_ShowCursor(SDL_DISABLE);
    6.13  }
    6.14  
    6.15 +void step(int keymask){
    6.16 +  currentButtons[0] = keymask;
    6.17 +  step();
    6.18 +  currentButtons[0] = keymask;
    6.19 +}
    6.20 +
    6.21 +
    6.22 +
    6.23  int main(int argc, char **argv)
    6.24  {
    6.25    fprintf(stderr, "VisualBoyAdvance version %s [SDL]\n", PACKAGE_VERSION);