add Voice control interface #32

Merged
merged 5 commits into from Jul 8, 2016
Jump to file or symbol
Failed to load files and symbols.
+27 −0
Diff settings

Always

Just for now

Next

API interface for simulating pressing button

  • Loading branch information...
Jeff Zhang Jeff Zhang
Jeff Zhang authored and Jeff Zhang committed Jun 30, 2016
commit f9c564cf68ebfee675da00743a1a52c17d701096
@@ -329,12 +329,19 @@ GameBoyAdvanceEmulator.prototype.initializeCore = function () {
return allowInit | 0;
}
GameBoyAdvanceEmulator.prototype.keyDown = function (keyPressed) {
+ console.log("keydown emulator");
+ console.log(keyPressed);
+
keyPressed = keyPressed | 0;
if ((this.emulatorStatus | 0) < 0x10 && (keyPressed | 0) >= 0 && (keyPressed | 0) <= 9) {
this.IOCore.joypad.keyPress(keyPressed | 0);
}
}
GameBoyAdvanceEmulator.prototype.keyUp = function (keyReleased) {
+ console.log("keyup emulator");
+ console.log(keyReleased);
+
+
keyReleased = keyReleased | 0;
if ((this.emulatorStatus | 0) < 0x10 && (keyReleased | 0) >= 0 && (keyReleased | 0) <= 9) {
this.IOCore.joypad.keyRelease(keyReleased | 0);
View
@@ -112,9 +112,11 @@ self.onmessage = function (event) {
break;
case 11:
Iodine.keyDown(data.payload | 0);
+ console.log("keydown");
break;
case 12:
Iodine.keyUp(data.payload | 0);
+ console.log("keyUp");
break;
case 13:
Iodine.incrementSpeed(+data.payload);
View
@@ -63,6 +63,7 @@
<script src="user_scripts/XAudioJS/swfobject.js"></script>
<script src="user_scripts/XAudioJS/resampler.js"></script>
<script src="user_scripts/XAudioJS/XAudioServer.js"></script>
+ <script src="user_scripts/Interface.js"></script>
<link rel="stylesheet" href="user_css/main.css">
</head>
<body>
View
@@ -0,0 +1,16 @@
+var mapButtontoIndex = {"A":0, "B":1, "Select":2, "Start":3, "Right":4, "Left": 5, "Up":6 ,"Down":7, "R":8, "L":9}
+
+function pressButton(button, time) {
+
+ if(button in mapButtontoIndex ){
+
+ index = mapButtontoIndex[button]
+ IodineGUI.Iodine.keyDown(index);
+
+ setTimeout(function() {
+ IodineGUI.Iodine.keyUp(index);
+ }, time);
+ }
+
+ return;
+}
@@ -9,6 +9,7 @@
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
function keyDown(e) {
+
var keyCode = e.keyCode | 0;
for (var keyMapIndex = 0; (keyMapIndex | 0) < 10; keyMapIndex = ((keyMapIndex | 0) + 1) | 0) {
if ((IodineGUI.defaults.keyZonesGBA[keyMapIndex | 0] | 0) == (keyCode | 0)) {