Added build environment for Windows VS 9.
Removed some compiler warnings about duplicated #defines (isnan and RAD_TO_DEGREE etc). Fixed some C++ errors (missing casts for void *), before realising that wiiuse must be compiled in C mode anyway. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12439 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
52cc6a5271
commit
012f57cdc7
@ -78,8 +78,8 @@ extern FILE* logtarget[];
|
||||
#endif
|
||||
|
||||
/* Convert between radians and degrees */
|
||||
#define RAD_TO_DEGREE(r) ((r * 180.0f) / WIIMOTE_PI)
|
||||
#define DEGREE_TO_RAD(d) (d * (WIIMOTE_PI / 180.0f))
|
||||
#define WIIUSE_RAD_TO_DEGREE(r) ((r * 180.0f) / WIIMOTE_PI)
|
||||
#define WIIUSE_DEGREE_TO_RAD(d) (d * (WIIMOTE_PI / 180.0f))
|
||||
|
||||
#define absf(x) ((x >= 0) ? (x) : (x * -1.0f))
|
||||
#define diff_f(x, y) ((x >= y) ? (absf(x - y)) : (absf(y - x)))
|
||||
|
@ -42,7 +42,9 @@
|
||||
#ifdef _MSC_VER
|
||||
#include <float.h>
|
||||
/* windows with visual c */
|
||||
#define isnan(x) (_isnan(x))
|
||||
# ifndef isnan
|
||||
#define isnan(x) (_isnan(x))
|
||||
# endif
|
||||
#define isinf(x) (!_finite(x))
|
||||
/* disable warnings I don't care about */
|
||||
/*#pragma warning(disable:4273) */ /* inconsistent dll linkage */
|
||||
|
@ -96,7 +96,7 @@ void calculate_orientation(struct accel_t* ac, struct vec3b_t* accel, struct ori
|
||||
/* if it is over 1g then it is probably accelerating and not reliable */
|
||||
if (abs(accel->x - ac->cal_zero.x) <= ac->cal_g.x) {
|
||||
/* roll */
|
||||
x = RAD_TO_DEGREE(atan2f(x, z));
|
||||
x = WIIUSE_RAD_TO_DEGREE(atan2f(x, z));
|
||||
|
||||
orient->roll = x;
|
||||
orient->a_roll = x;
|
||||
@ -104,7 +104,7 @@ void calculate_orientation(struct accel_t* ac, struct vec3b_t* accel, struct ori
|
||||
|
||||
if (abs(accel->y - ac->cal_zero.y) <= ac->cal_g.y) {
|
||||
/* pitch */
|
||||
y = RAD_TO_DEGREE(atan2f(y, z));
|
||||
y = WIIUSE_RAD_TO_DEGREE(atan2f(y, z));
|
||||
|
||||
orient->pitch = y;
|
||||
orient->a_pitch = y;
|
||||
@ -181,7 +181,7 @@ void calc_joystick_state(struct joystick_t* js, float x, float y) {
|
||||
rx = applyCalibration(x, js->min.x, js->max.x, js->center.x);
|
||||
ry = applyCalibration(y, js->min.y, js->max.y, js->center.y);
|
||||
/* calculate the joystick angle and magnitude */
|
||||
ang = RAD_TO_DEGREE(atan2f(ry, rx));
|
||||
ang = WIIUSE_RAD_TO_DEGREE(atan2f(ry, rx));
|
||||
js->ang = ang + 180.0f;
|
||||
js->mag = sqrtf((rx * rx) + (ry * ry));
|
||||
}
|
||||
|
@ -661,7 +661,7 @@ void handshake_expansion(struct wiimote_t* wm, byte* data, uint16_t len) {
|
||||
if (WIIMOTE_IS_SET(wm, WIIMOTE_STATE_EXP)) {
|
||||
disable_expansion(wm);
|
||||
}
|
||||
handshake_buf = malloc(EXP_HANDSHAKE_LEN * sizeof(byte));
|
||||
handshake_buf = (byte*)malloc(EXP_HANDSHAKE_LEN * sizeof(byte));
|
||||
/* tell the wiimote to send expansion data */
|
||||
WIIMOTE_ENABLE_STATE(wm, WIIMOTE_STATE_EXP);
|
||||
wiiuse_read_data_cb(wm, handshake_expansion, handshake_buf, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN);
|
||||
|
@ -80,7 +80,7 @@ int guitar_hero_3_handshake(struct wiimote_t* wm, struct guitar_hero_3_t* gh3, b
|
||||
*/
|
||||
if (data[16] == 0xFF) {
|
||||
/* get the calibration data */
|
||||
byte* handshake_buf = malloc(EXP_HANDSHAKE_LEN * sizeof(byte));
|
||||
byte* handshake_buf = (byte*)malloc(EXP_HANDSHAKE_LEN * sizeof(byte));
|
||||
|
||||
WIIUSE_DEBUG("Guitar Hero 3 handshake appears invalid, trying again.");
|
||||
wiiuse_read_data_cb(wm, handshake_expansion, handshake_buf, WM_EXP_MEM_CALIBR, EXP_HANDSHAKE_LEN);
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define _WINSOCKAPI_
|
||||
#include <windows.h>
|
||||
#include <hidsdi.h>
|
||||
#include <setupapi.h>
|
||||
@ -80,7 +81,7 @@ int wiiuse_find(struct wiimote_t** wm, int max_wiimotes, int timeout) {
|
||||
|
||||
/* get the size of the data block required */
|
||||
i = SetupDiGetDeviceInterfaceDetail(device_info, &device_data, NULL, 0, &len, NULL);
|
||||
detail_data = malloc(len);
|
||||
detail_data = (PSP_DEVICE_INTERFACE_DETAIL_DATA)malloc(len);
|
||||
detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
|
||||
|
||||
/* query the data for this device */
|
||||
|
@ -598,8 +598,8 @@ static void fix_rotated_ir_dots(struct ir_dot_t* dot, float ang) {
|
||||
return;
|
||||
}
|
||||
|
||||
s = sinf(DEGREE_TO_RAD(ang));
|
||||
c = cosf(DEGREE_TO_RAD(ang));
|
||||
s = sinf(WIIUSE_DEGREE_TO_RAD(ang));
|
||||
c = cosf(WIIUSE_DEGREE_TO_RAD(ang));
|
||||
|
||||
/*
|
||||
* [ cos(theta) -sin(theta) ][ ir->rx ]
|
||||
@ -709,7 +709,7 @@ static float ir_distance(struct ir_dot_t* dot) {
|
||||
xd = dot[i2].x - dot[i1].x;
|
||||
yd = dot[i2].y - dot[i1].y;
|
||||
|
||||
return sqrtf(xd * xd + yd * yd);
|
||||
return sqrtf((float)(xd * xd + yd * yd));
|
||||
}
|
||||
|
||||
|
||||
@ -789,5 +789,5 @@ float calc_yaw(struct ir_t* ir) {
|
||||
x = (float)(ir->ax - 512);
|
||||
x = x * (ir->z / 1024.0f);
|
||||
|
||||
return RAD_TO_DEGREE(atanf(x / ir->z));
|
||||
return WIIUSE_RAD_TO_DEGREE(atanf(x / ir->z));
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ int wiiuse_os_find(struct wiimote_t** wm, int max_wiimotes, int timeout) {
|
||||
|
||||
/* get the size of the data block required */
|
||||
i = SetupDiGetDeviceInterfaceDetail(device_info, &device_data, NULL, 0, &len, NULL);
|
||||
detail_data = (SP_DEVICE_INTERFACE_DETAIL_DATA_A*)malloc(len);
|
||||
detail_data = (SP_DEVICE_INTERFACE_DETAIL_DATA*)malloc(len);
|
||||
detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
|
||||
|
||||
/* query the data for this device */
|
||||
@ -115,7 +115,7 @@ int wiiuse_os_find(struct wiimote_t** wm, int max_wiimotes, int timeout) {
|
||||
/* this is a wiimote */
|
||||
wm[found]->dev_handle = dev;
|
||||
|
||||
wm[found]->hid_overlap.hEvent = CreateEvent(NULL, 1, 1, "");
|
||||
wm[found]->hid_overlap.hEvent = CreateEvent(NULL, 1, 1, L"");
|
||||
wm[found]->hid_overlap.Offset = 0;
|
||||
wm[found]->hid_overlap.OffsetHigh = 0;
|
||||
|
||||
|
276
lib/wiiuse/wiiuse/wiiuse.vcproj
Executable file
276
lib/wiiuse/wiiuse/wiiuse.vcproj
Executable file
@ -0,0 +1,276 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9.00"
|
||||
Name="wiiuse"
|
||||
ProjectGUID="{FE4FCEBF-B53D-4B8A-81B0-F9AB059C8C83}"
|
||||
RootNamespace="wiiuse"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="196613"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\include";C:\WinDDK\inc\api"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;WIIUSE_STATIC"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
AdditionalDependencies="setupapi.lib hid.lib"
|
||||
OutputFile="$(ProjectName).lib"
|
||||
AdditionalLibraryDirectories="C:\WinDDK\lib\win7\i386"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\classic.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\classic.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\definitions.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\definitions_os.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\dynamics.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\dynamics.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\events.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\events.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\guitar_hero_3.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\guitar_hero_3.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\io.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\io.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\io_nix.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ir.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\ir.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\motion_plus.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\motion_plus.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\nunchuk.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\nunchuk.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\os.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\os_nix.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\os_win.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\util.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\wiiboard.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\wiiboard.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\wiiuse.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\wiiuse.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\wiiuse_internal.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\wiiuse_msvcstdint.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
Loading…
Reference in New Issue
Block a user