Ant buildfile aan Mimis toegevoegd om uitvoerbare jar te maken. Begonnen aan implementatie van Wii Balance Board in WiiuseJ.
This commit is contained in:
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
#Wed Jul 20 23:54:48 CEST 2011
|
||||
#Wed Oct 19 11:47:57 CEST 2011
|
||||
eclipse.preferences.version=1
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1116435574/CPATH/delimiter=;
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1116435574/CPATH/operation=remove
|
||||
@@ -6,6 +6,12 @@ environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1116435574/C_INCLUDE_PATH/operation=remove
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1116435574/append=true
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.debug.1116435574/appendContributed=true
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/CPATH/delimiter=;
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/CPATH/operation=remove
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/C_INCLUDE_PATH/delimiter=;
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/C_INCLUDE_PATH/operation=remove
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/append=true
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339.10143143/appendContributed=true
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339/CPATH/delimiter=;
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339/CPATH/operation=remove
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.so.release.1074641339/C_INCLUDE_PATH/delimiter=;
|
||||
|
||||
@@ -1,140 +1,140 @@
|
||||
/*
|
||||
* wiiuse
|
||||
*
|
||||
* Written By:
|
||||
* Michael Laforest < para >
|
||||
* Email: < thepara (--AT--) g m a i l [--DOT--] com >
|
||||
* This file:
|
||||
* Bertho Stultiens < para >
|
||||
*
|
||||
* Copyright 2009
|
||||
*
|
||||
* This file is part of wiiuse.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* $Header$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Balance Board expansion device.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Winsock2.h>
|
||||
#endif
|
||||
|
||||
#include "definitions.h"
|
||||
#include "wiiuse_internal.h"
|
||||
#include "dynamics.h"
|
||||
#include "events.h"
|
||||
#include "balance_board.h"
|
||||
|
||||
/**
|
||||
* @brief Handle the handshake data from the guitar.
|
||||
*
|
||||
* @param cc A pointer to a classic_ctrl_t structure.
|
||||
* @param data The data read in from the device.
|
||||
* @param len The length of the data block, in bytes.
|
||||
*
|
||||
* @return Returns 1 if handshake was successful, 0 if not.
|
||||
*/
|
||||
int balance_board_handshake(struct wiimote_t* wm, struct balance_board_t* bb, byte* data, unsigned short len) {
|
||||
int i;
|
||||
|
||||
bb->tr = 0.0;
|
||||
bb->br = 0.0;
|
||||
bb->tl = 0.0;
|
||||
bb->br = 0.0;
|
||||
|
||||
if (len < 0xe0)
|
||||
return 0;
|
||||
|
||||
if (data[0xdc] != 0xa4) {
|
||||
/* decrypt data */
|
||||
for (i = 0; i < len; ++i)
|
||||
data[i] = (data[i] ^ 0x17) + 0x17;
|
||||
}
|
||||
|
||||
/* See: http://wiibrew.org/wiki/Wii_Balance_Board */
|
||||
/* Unknown data at 0xa40020..23 (mine says: 0x44 0x69 0x00 0x00) */
|
||||
bb->cal_0.tr = (data[0x04] << 8) + data[0x05];
|
||||
bb->cal_0.br = (data[0x06] << 8) + data[0x07];
|
||||
bb->cal_0.tl = (data[0x08] << 8) + data[0x09];
|
||||
bb->cal_0.bl = (data[0x0a] << 8) + data[0x0b];
|
||||
bb->cal_17.tr = (data[0x0c] << 8) + data[0x0d];
|
||||
bb->cal_17.br = (data[0x0e] << 8) + data[0x0f];
|
||||
bb->cal_17.tl = (data[0x10] << 8) + data[0x11];
|
||||
bb->cal_17.bl = (data[0x12] << 8) + data[0x13];
|
||||
bb->cal_34.tr = (data[0x14] << 8) + data[0x15];
|
||||
bb->cal_34.br = (data[0x16] << 8) + data[0x17];
|
||||
bb->cal_34.tl = (data[0x18] << 8) + data[0x19];
|
||||
bb->cal_34.bl = (data[0x1a] << 8) + data[0x1b];
|
||||
/* Unknown data at 0xa4003c..3f (mine says: 0x4c 0x81 0x59 0x95) */
|
||||
|
||||
WIIUSE_DEBUG("calibration 0: %04x %04x %04x %04x\n", bb->cal_0.tr, bb->cal_0.br, bb->cal_0.tl, bb->cal_0.br);
|
||||
WIIUSE_DEBUG("calibration 17: %04x %04x %04x %04x\n", bb->cal_17.tr, bb->cal_17.br, bb->cal_17.tl, bb->cal_17.br);
|
||||
WIIUSE_DEBUG("calibration 34: %04x %04x %04x %04x\n", bb->cal_34.tr, bb->cal_34.br, bb->cal_34.tl, bb->cal_34.br);
|
||||
|
||||
/* handshake done */
|
||||
wm->exp.type = EXP_BALANCE_BOARD;
|
||||
|
||||
#ifdef WIN32
|
||||
wm->timeout = WIIMOTE_DEFAULT_TIMEOUT;
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief The balance board disconnected.
|
||||
*
|
||||
* @param cc A pointer to a balance_board_t structure.
|
||||
*/
|
||||
void balance_board_disconnected(struct balance_board_t* bb) {
|
||||
memset(bb, 0, sizeof(*bb));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Handle balance board event.
|
||||
*
|
||||
* @param cc A pointer to a balance board_t structure.
|
||||
* @param msg The message specified in the event packet.
|
||||
*/
|
||||
#define set_bbval(x) do {\
|
||||
if(bb->raw.x < bb->cal_17.x) \
|
||||
bb->x = 17.0 * (float)(bb->raw.x - bb->cal_0.x) / (float)(bb->cal_17.x - bb->cal_0.x); \
|
||||
else \
|
||||
bb->x = 17.0 * (1.0 + (float)(bb->raw.x - bb->cal_17.x) / (float)(bb->cal_34.x - bb->cal_17.x)); \
|
||||
} while(0)
|
||||
void balance_board_event(struct balance_board_t* bb, byte* msg) {
|
||||
bb->raw.tr = (msg[0] << 8) + msg[1];
|
||||
bb->raw.br = (msg[2] << 8) + msg[3];
|
||||
bb->raw.tl = (msg[4] << 8) + msg[5];
|
||||
bb->raw.bl = (msg[6] << 8) + msg[7];
|
||||
set_bbval(tr);
|
||||
set_bbval(br);
|
||||
set_bbval(tl);
|
||||
set_bbval(bl);
|
||||
}
|
||||
|
||||
/*
|
||||
* wiiuse
|
||||
*
|
||||
* Written By:
|
||||
* Michael Laforest < para >
|
||||
* Email: < thepara (--AT--) g m a i l [--DOT--] com >
|
||||
* This file:
|
||||
* Bertho Stultiens < para >
|
||||
*
|
||||
* Copyright 2009
|
||||
*
|
||||
* This file is part of wiiuse.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* $Header$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief Balance Board expansion device.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Winsock2.h>
|
||||
#endif
|
||||
|
||||
#include "definitions.h"
|
||||
#include "wiiuse_internal.h"
|
||||
#include "dynamics.h"
|
||||
#include "events.h"
|
||||
#include "balance_board.h"
|
||||
|
||||
/**
|
||||
* @brief Handle the handshake data from the guitar.
|
||||
*
|
||||
* @param cc A pointer to a classic_ctrl_t structure.
|
||||
* @param data The data read in from the device.
|
||||
* @param len The length of the data block, in bytes.
|
||||
*
|
||||
* @return Returns 1 if handshake was successful, 0 if not.
|
||||
*/
|
||||
int balance_board_handshake(struct wiimote_t* wm, struct balance_board_t* bb, byte* data, unsigned short len) {
|
||||
int i;
|
||||
|
||||
bb->tr = 0.0;
|
||||
bb->br = 0.0;
|
||||
bb->tl = 0.0;
|
||||
bb->br = 0.0;
|
||||
|
||||
if (len < 0xe0)
|
||||
return 0;
|
||||
|
||||
if (data[0xdc] != 0xa4) {
|
||||
/* decrypt data */
|
||||
for (i = 0; i < len; ++i)
|
||||
data[i] = (data[i] ^ 0x17) + 0x17;
|
||||
}
|
||||
|
||||
/* See: http://wiibrew.org/wiki/Wii_Balance_Board */
|
||||
/* Unknown data at 0xa40020..23 (mine says: 0x44 0x69 0x00 0x00) */
|
||||
bb->cal_0.tr = (data[0x04] << 8) + data[0x05];
|
||||
bb->cal_0.br = (data[0x06] << 8) + data[0x07];
|
||||
bb->cal_0.tl = (data[0x08] << 8) + data[0x09];
|
||||
bb->cal_0.bl = (data[0x0a] << 8) + data[0x0b];
|
||||
bb->cal_17.tr = (data[0x0c] << 8) + data[0x0d];
|
||||
bb->cal_17.br = (data[0x0e] << 8) + data[0x0f];
|
||||
bb->cal_17.tl = (data[0x10] << 8) + data[0x11];
|
||||
bb->cal_17.bl = (data[0x12] << 8) + data[0x13];
|
||||
bb->cal_34.tr = (data[0x14] << 8) + data[0x15];
|
||||
bb->cal_34.br = (data[0x16] << 8) + data[0x17];
|
||||
bb->cal_34.tl = (data[0x18] << 8) + data[0x19];
|
||||
bb->cal_34.bl = (data[0x1a] << 8) + data[0x1b];
|
||||
/* Unknown data at 0xa4003c..3f (mine says: 0x4c 0x81 0x59 0x95) */
|
||||
|
||||
WIIUSE_DEBUG("calibration 0: %04x %04x %04x %04x\n", bb->cal_0.tr, bb->cal_0.br, bb->cal_0.tl, bb->cal_0.br);
|
||||
WIIUSE_DEBUG("calibration 17: %04x %04x %04x %04x\n", bb->cal_17.tr, bb->cal_17.br, bb->cal_17.tl, bb->cal_17.br);
|
||||
WIIUSE_DEBUG("calibration 34: %04x %04x %04x %04x\n", bb->cal_34.tr, bb->cal_34.br, bb->cal_34.tl, bb->cal_34.br);
|
||||
|
||||
/* handshake done */
|
||||
wm->exp.type = EXP_BALANCE_BOARD;
|
||||
|
||||
#ifdef WIN32
|
||||
wm->timeout = WIIMOTE_DEFAULT_TIMEOUT;
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief The balance board disconnected.
|
||||
*
|
||||
* @param cc A pointer to a balance_board_t structure.
|
||||
*/
|
||||
void balance_board_disconnected(struct balance_board_t* bb) {
|
||||
memset(bb, 0, sizeof(*bb));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Handle balance board event.
|
||||
*
|
||||
* @param cc A pointer to a balance board_t structure.
|
||||
* @param msg The message specified in the event packet.
|
||||
*/
|
||||
#define set_bbval(x) do {\
|
||||
if(bb->raw.x < bb->cal_17.x) \
|
||||
bb->x = 17.0 * (float)(bb->raw.x - bb->cal_0.x) / (float)(bb->cal_17.x - bb->cal_0.x); \
|
||||
else \
|
||||
bb->x = 17.0 * (1.0 + (float)(bb->raw.x - bb->cal_17.x) / (float)(bb->cal_34.x - bb->cal_17.x)); \
|
||||
} while(0)
|
||||
void balance_board_event(struct balance_board_t* bb, byte* msg) {
|
||||
bb->raw.tr = (msg[0] << 8) + msg[1];
|
||||
bb->raw.br = (msg[2] << 8) + msg[3];
|
||||
bb->raw.tl = (msg[4] << 8) + msg[5];
|
||||
bb->raw.bl = (msg[6] << 8) + msg[7];
|
||||
set_bbval(tr);
|
||||
set_bbval(br);
|
||||
set_bbval(tl);
|
||||
set_bbval(bl);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<listOptionValue builtIn="false" value=""${jdk}/include/win32""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/include}""/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.preprocessor.def.symbols.1057877516" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.820612620" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.so.debug.424942675" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.so.debug">
|
||||
@@ -103,7 +104,7 @@
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.so.release.582624041" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.so.release">
|
||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.so.release.852849225" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.so.release"/>
|
||||
<builder buildPath="${workspace_loc:/WiiuseJ/Release}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1667515887" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.so.release.1955417593" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.so.release">
|
||||
<tool command="as" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" id="cdt.managedbuild.tool.gnu.assembler.mingw.so.release.1955417593" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.so.release">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.204782274" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.2134712739" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
|
||||
@@ -124,6 +125,7 @@
|
||||
<listOptionValue builtIn="false" value=""${jdk}/include/win32""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/include}""/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.preprocessor.def.symbols.227749697" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" valueType="definedSymbols"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.839631863" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.so.release.901924366" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.so.release">
|
||||
@@ -143,6 +145,7 @@
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
<outputType id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.release.output.543131979" outputPrefix="" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.so.release.output"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "wiiusej_WiiUseApi.h"
|
||||
#include "wiiuse.h"
|
||||
#include <jni.h>
|
||||
/*
|
||||
* These are some identifiers for wiimotes
|
||||
*
|
||||
@@ -86,7 +85,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_init
|
||||
|
||||
/**
|
||||
* Close connection to the wiimote with the given id.
|
||||
*
|
||||
*
|
||||
* @param id the id of the wiimote to disconnect.Must be 1 or 2.
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_closeConnection
|
||||
@@ -96,10 +95,10 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_closeConnection
|
||||
|
||||
/**
|
||||
* Get unique id of a wiimote in the wiimotes array.
|
||||
* Please make sure you call an existing index with a
|
||||
* Please make sure you call an existing index with a
|
||||
* wiimote initialized at this index,
|
||||
* other wise you'll get a wrong value.
|
||||
* @param index index of the wiimote in the wiimotes array.
|
||||
* @param index index of the wiimote in the wiimotes array.
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_wiiusej_WiiUseApi_getUnId
|
||||
(JNIEnv *env, jobject obj, jint index) {
|
||||
@@ -303,7 +302,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setSensorBarBelowScreen
|
||||
}
|
||||
|
||||
/**
|
||||
* Set virtual screen resolution. It is used to automatically
|
||||
* Set virtual screen resolution. It is used to automatically
|
||||
* compute the position of a cursor on this virtual screen
|
||||
* using the sensor bar. These results come in the IREvent.
|
||||
* @param id the id of the wiimote concerned
|
||||
@@ -317,7 +316,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setVirtualScreenResolution
|
||||
|
||||
/**
|
||||
* Get status from the wiimotes and send it through call backs.
|
||||
*
|
||||
*
|
||||
* @param id the id of the wiimote. Must be 1 or 2.
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_getStatus
|
||||
@@ -327,7 +326,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_getStatus
|
||||
|
||||
/**
|
||||
* Set the normal and expansion handshake timeouts.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* the id of the wiimote concerned.
|
||||
* @param normalTimeout
|
||||
@@ -343,7 +342,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setTimeout
|
||||
|
||||
/**
|
||||
* Set the IR sensitivity.
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* the id of the wiimote concerned.
|
||||
* @param level
|
||||
@@ -378,7 +377,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_setNunchukAccelerationThreshold
|
||||
|
||||
/**
|
||||
* Force the bluetooth stack type.(useful only for windows)
|
||||
*
|
||||
*
|
||||
* @param bluetoothStackType
|
||||
* must be WiiUseApi.WIIUSE_STACK_UNKNOWN or WiiUseApi.WIIUSE_STACK_MS or
|
||||
* WiiUseApi.WIIUSE_STACK_BLUESOLEIL.
|
||||
@@ -418,7 +417,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
|
||||
switch (wiimotes[i]->event) {
|
||||
case WIIUSE_EVENT:
|
||||
/* a generic event occured */
|
||||
|
||||
|
||||
//printf("Generic event\n");
|
||||
mid = (*env)->GetMethodID(env, cls, "prepareWiiMoteEvent", "(ISSS)V");
|
||||
if (mid == 0) {
|
||||
@@ -483,7 +482,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
|
||||
wiimotes[i]->gforce.x, wiimotes[i]->gforce.y, wiimotes[i]->gforce.z,
|
||||
wiimotes[i]->accel.x, wiimotes[i]->accel.y, wiimotes[i]->accel.z);
|
||||
}
|
||||
|
||||
|
||||
/* Expansions support support*/
|
||||
if (WIIUSE_USING_EXP(wiimotes[i])) {
|
||||
/* Nunchuk support */
|
||||
@@ -511,8 +510,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
|
||||
nc->js.max.x,nc->js.max.y,
|
||||
nc->js.min.x,nc->js.min.y,
|
||||
nc->js.center.x,nc->js.center.y);
|
||||
}
|
||||
else if (wiimotes[i]->exp.type == EXP_GUITAR_HERO_3) {
|
||||
} else if (wiimotes[i]->exp.type == EXP_GUITAR_HERO_3) {
|
||||
/* put guitar hero values in wiimote generic event */
|
||||
mid = (*env)->GetMethodID(env, cls,
|
||||
"addGuitarHeroEventToPreparedWiimoteEvent", "(SSSFFFSSSSSS)V");
|
||||
@@ -531,7 +529,7 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
|
||||
gh->js.max.x,gh->js.max.y,
|
||||
gh->js.min.x,gh->js.min.y,
|
||||
gh->js.center.x,gh->js.center.y);
|
||||
}if (wiimotes[i]->exp.type == EXP_CLASSIC) {
|
||||
} else if (wiimotes[i]->exp.type == EXP_CLASSIC) {
|
||||
/* put classic controller values in wiimote generic event */
|
||||
mid = (*env)->GetMethodID(env, cls,
|
||||
"addClassicControllerEventToPreparedWiimoteEvent", "(SSSFFFFSSSSSSFFSSSSSS)V");
|
||||
@@ -555,12 +553,25 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
|
||||
cl->rjs.max.x,cl->rjs.max.y,
|
||||
cl->rjs.min.x,cl->rjs.min.y,
|
||||
cl->rjs.center.x,cl->rjs.center.y);
|
||||
} else if (wiimotes[i]->exp.type == EXP_BALANCE_BOARD) {
|
||||
/* put balance board values in wiimote generic event */
|
||||
mid = (*env)->GetMethodID(env, cls,
|
||||
"addBalanceBoardEventToPreparedWiimoteEvent", "(FFFF)V");
|
||||
if (mid == 0) {
|
||||
return;
|
||||
}
|
||||
struct balance_board_t* bb = (balance_board_t*)&wiimotes[i]->exp.bb;
|
||||
(*env)->CallVoidMethod(env, gath, mid,
|
||||
/* weight */
|
||||
bb->tr,
|
||||
bb->br,
|
||||
bb->bl,
|
||||
bb->tl);
|
||||
}
|
||||
}
|
||||
|
||||
/* add generic event to java object used to gather events in c environment */
|
||||
mid = (*env)->GetMethodID(env, cls, "addWiimoteEvent",
|
||||
"()V");
|
||||
mid = (*env)->GetMethodID(env, cls, "addWiimoteEvent", "()V");
|
||||
if (mid == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -639,6 +650,24 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_specialPoll
|
||||
(*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid);
|
||||
break;
|
||||
|
||||
case WIIUSE_BALANCE_BOARD_CTRL_INSERTED:
|
||||
/* the balance board was just connected */
|
||||
mid = (*env)->GetMethodID(env, cls, "addBalanceBoardInsertedEvent", "(I)V");
|
||||
if (mid == 0) {
|
||||
return;
|
||||
}
|
||||
(*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid);
|
||||
break;
|
||||
|
||||
case WIIUSE_BALANCE_BOARD_CTRL_REMOVED:
|
||||
/* the balance board disconnected */
|
||||
mid = (*env)->GetMethodID(env, cls, "addBalanceBoardRemovedEvent", "(I)V");
|
||||
if (mid == 0) {
|
||||
return;
|
||||
}
|
||||
(*env)->CallVoidMethod(env, gath, mid, wiimotes[i]->unid);
|
||||
break;
|
||||
|
||||
case WIIUSE_STATUS:
|
||||
/* a status event occured */
|
||||
mid = (*env)->GetMethodID(env, cls, "addStatusEvent", "(IZFSZIZZZZ)V");
|
||||
@@ -736,5 +765,4 @@ JNIEXPORT void JNICALL Java_wiiusej_WiiUseApi_streamSpeakerData(JNIEnv *env, job
|
||||
}*/
|
||||
wiiuse_speaker_data(wiiuse_get_by_id(wiimotes, nbMaxWiimotes, id), (byte*) jbData, len);
|
||||
(*env)->ReleaseByteArrayElements(env, jbArray, jbData, JNI_FALSE);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class wiiusej_WiiUseApi */
|
||||
|
||||
/* Header for class wiiusej_WiiUseApi */
|
||||
#ifndef _Included_wiiusej_WiiUseApi
|
||||
#define _Included_wiiusej_WiiUseApi
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user