Mercurial > vba-clojure
changeset 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 |
files | java/src/com/aurellem/gb/Gb.java src/clojure/clojure.cpp src/gb/GB.cpp src/gb/GB.h |
diffstat | 4 files changed, 48 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/java/src/com/aurellem/gb/Gb.java Wed Mar 07 15:17:19 2012 -0600 1.2 +++ b/java/src/com/aurellem/gb/Gb.java Wed Mar 07 17:40:00 2012 -0600 1.3 @@ -51,4 +51,15 @@ 1.4 loadState(saveState, SAVE_SIZE); 1.5 } 1.6 1.7 + public static native int getROMSize(); 1.8 + public static native int getRAMSize(); 1.9 + 1.10 + 1.11 + public static final int WRAM_SIZE = 0x8000; 1.12 + 1.13 + public static final int VRAM_SIZE = 0x4000; 1.14 + 1.15 + 1.16 + 1.17 + 1.18 }
2.1 --- a/src/clojure/clojure.cpp Wed Mar 07 15:17:19 2012 -0600 2.2 +++ b/src/clojure/clojure.cpp Wed Mar 07 17:40:00 2012 -0600 2.3 @@ -101,8 +101,29 @@ 2.4 } 2.5 2.6 2.7 +/* 2.8 + * Class: com_aurellem_gb_Gb 2.9 + * Method: getROMSize 2.10 + * Signature: ()I 2.11 + */ 2.12 +JNIEXPORT jint JNICALL Java_com_aurellem_gb_Gb_getROMSize 2.13 +(JNIEnv *env, jclass clazz){ 2.14 + return getRomSize(); 2.15 +} 2.16 2.17 +/* 2.18 + * Class: com_aurellem_gb_Gb 2.19 + * Method: getRAMSize 2.20 + * Signature: ()I 2.21 + */ 2.22 +JNIEXPORT jint JNICALL Java_com_aurellem_gb_Gb_getRAMSize 2.23 +(JNIEnv *env, jclass clazz){ 2.24 + return getRamSize(); 2.25 +} 2.26 2.27 2.28 2.29 2.30 + 2.31 + 2.32 +
3.1 --- a/src/gb/GB.cpp Wed Mar 07 15:17:19 2012 -0600 3.2 +++ b/src/gb/GB.cpp Wed Mar 07 17:40:00 2012 -0600 3.3 @@ -2494,6 +2494,7 @@ 3.4 3.5 utilGzWrite(gzFile, &gbMemory[0x8000], 0x8000); 3.6 3.7 + 3.8 if (gbRamSize && gbRam) 3.9 { 3.10 utilGzWrite(gzFile, gbRam, gbRamSize); 3.11 @@ -3859,6 +3860,18 @@ 3.12 } 3.13 } 3.14 3.15 + 3.16 + 3.17 +//RLM: 3.18 +int getRamSize(){ 3.19 + return gbRamSize; 3.20 +} 3.21 + 3.22 +int getRomSize(){ 3.23 + return gbRomSize; 3.24 +} 3.25 + 3.26 + 3.27 struct EmulatedSystem GBSystem = 3.28 { 3.29 // emuMain
4.1 --- a/src/gb/GB.h Wed Mar 07 15:17:19 2012 -0600 4.2 +++ b/src/gb/GB.h Wed Mar 07 17:40:00 2012 -0600 4.3 @@ -44,6 +44,9 @@ 4.4 extern bool gbWriteBMPFile(const char *); 4.5 extern bool gbReadGSASnapshot(const char *); 4.6 4.7 +extern int getRamSize(); 4.8 +extern int getRomSize(); 4.9 + 4.10 extern struct EmulatedSystem GBSystem; 4.11 extern struct EmulatedSystemCounters &GBSystemCounters; 4.12