fromdos the source

This commit is contained in:
Ryan Pavlik
2010-11-12 10:24:00 -06:00
parent 2432d5c867
commit 304bf4fc64
8 changed files with 122 additions and 122 deletions

View File

@@ -32,14 +32,14 @@
*/
#ifdef WIN32
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <hidsdi.h>
#include <setupapi.h>
#include "definitions.h"
#include "wiiuse_internal.h"
#include "io.h"
@@ -178,8 +178,8 @@ int wiiuse_io_read(struct wiimote_t* wm) {
if (!ReadFile(wm->dev_handle, wm->event_buf, sizeof(wm->event_buf), &b, &wm->hid_overlap)) {
/* partial read */
b = GetLastError();
b = GetLastError();
if ((b == ERROR_HANDLE_EOF) || (b == ERROR_DEVICE_NOT_CONNECTED)) {
/* remote disconnect */
wiiuse_disconnected(wm);
@@ -188,11 +188,11 @@ int wiiuse_io_read(struct wiimote_t* wm) {
r = WaitForSingleObject(wm->hid_overlap.hEvent, wm->timeout);
if (r == WAIT_TIMEOUT) {
/* timeout - cancel and continue */
if (*wm->event_buf)
WIIUSE_WARNING("Packet ignored. This may indicate a problem (timeout is %i ms).", wm->timeout);
/* timeout - cancel and continue */
if (*wm->event_buf)
WIIUSE_WARNING("Packet ignored. This may indicate a problem (timeout is %i ms).", wm->timeout);
CancelIo(wm->dev_handle);
ResetEvent(wm->hid_overlap.hEvent);
return 0;
@@ -205,25 +205,25 @@ int wiiuse_io_read(struct wiimote_t* wm) {
return 0;
}
ResetEvent(wm->hid_overlap.hEvent);
ResetEvent(wm->hid_overlap.hEvent);
return 1;
}
int wiiuse_io_write(struct wiimote_t* wm, byte* buf, int len) {
DWORD bytes;
int i;
int i;
if (!wm || !WIIMOTE_IS_CONNECTED(wm))
return 0;
return 0;
switch (wm->stack) {
case WIIUSE_STACK_UNKNOWN:
{
/* try to auto-detect the stack type */
if (i = WriteFile(wm->dev_handle, buf, 22, &bytes, &wm->hid_overlap)) {
/* bluesoleil will always return 1 here, even if it's not connected */
wm->stack = WIIUSE_STACK_BLUESOLEIL;
wm->stack = WIIUSE_STACK_BLUESOLEIL;
return i;
}