Mercurial > sdl-ios-xcode
view docs/index.html @ 1748:5e86e34453d4
------- Comment #1 From Max Horn 2006-04-17 03:08 [reply] -------
Created an attachment (id=106) [edit]
Patch for src/joystick/win32/SDL_mmjoystick.c
I am not even a Windows user, so take the following with a grain of salt:
SDL_mmjoystick.c has a function GetJoystickName which obtains the joystick
name by looking at the registry. The way it does that seems very fishy to me.
Namely, it uses the parameter "index" to construct a registry value name (BTW,
those variables used in the code are really badly named). The value of "index"
in turn equals the current value of "numdevs", as called from
SDL_SYS_JoystickInit.
I read through the MSDN docs at
<http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarinput/html/msdn_extdirect.asp>,
and I believe the simple fix is to replace line 183 of said file
SYS_JoystickName[numdevs] = GetJoystickName(numdevs, joycaps.szRegKey);
by the following:
SYS_JoystickName[numdevs] = GetJoystickName(SYS_JoystickID[i],
joycaps.szRegKey);
However, that is only *hiding* the real issue. Problem is, the list of
joysticks as returned by windows may contains "gaps", and the code deals
incorrectly with that. Namely those gaps occur if joysticks are
removed/(re)added, as the reporter observed.
The attached patch fixes this and another (off-by-one) issue in the code. But
since I have no Windows machine, I can't even test-compile it, so use with
caution.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 29 Apr 2006 20:22:31 +0000 |
parents | 74212992fb08 |
children | 14717b52abc0 |
line wrap: on
line source
<!DOCTYPE HTML PUBLIC "-//Norman Walsh//DTD DocBook HTML 1.0//EN"> <HTML ><HEAD ><TITLE >Introduction</TITLE > </HEAD ><BODY BGCOLOR="#FFF8DC" TEXT="#000000" LINK="#0000ee" VLINK="#551a8b" ALINK="#ff0000" ><DIV CLASS="NAVHEADER" > <HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="PREFACE" ><H1 ><A NAME="AEN8" >Introduction</A ></H1 ><P >This library is designed to make it easy to write games that run on Linux, Win32 and BeOS using the various native high-performance media interfaces, (for video, audio, etc) and presenting a single source-code level API to your application. This is a fairly low level API, but using this, completely portable applications can be written with a great deal of flexibility.</P ><P >The library is loaded as a dynamically linked library on its native platform, and is currently compiled natively for Linux, compiled for Win32 using a Linux hosted GCC <A HREF="http://www.libsdl.org/Xmingw32/" TARGET="_top" >cross-compilation</A > environment, and compiled using the EGCS C++ compiler under BeOS.</P ><P >An introduction to SDL can be found online at: <A HREF="http://www.libsdl.org/intro/toc.html" TARGET="_top" >http://www.libsdl.org/intro/</A > </P ><P >There are code examples on each of the main library pages, and there are fully fleshed example C++ classes and programs in the examples archive, available on the <A HREF="http://www.libsdl.org/download.html" TARGET="_top" >SDL download page</A >.</P ><P >For an introduction to basic multi-media programming concepts, you might try some of the following links: <P ></P ><UL ><LI ><P ><A HREF="http://www.ziron.com/links/" TARGET="_top" >Game Programming Links</A ></P ></LI ><LI ><P ><A HREF="http://developer.dungeon-crawl.com/" TARGET="_top" >Game Developer Search Engine</A ></P ></LI ></UL ></P ><P >Enjoy!</P ><P > Sam Lantinga <TT CLASS="EMAIL" ><<A HREF="mailto:slouken@libsdl.org" ><A HREF="mailto:slouken@libsdl.org" TARGET="_top" >slouken@libsdl.org</A ></A >></TT ></P > <P> <br><br><HR> <H1>Table of Contents</H1> <UL> <LI><A HREF="html/index.html">Full Table of Contents</A></LI> <LI><A HREF="html/guide.html">The SDL Guide</A></LI> <LI><A HREF="html/reference.html">The SDL Reference</A></LI> <UL> <LI><A HREF="html/general.html">Initialization</A></LI> <LI><A HREF="html/video.html">Video</A></LI> <LI><A HREF="html/wm.html">Window Manager</A></LI> <LI><A HREF="html/event.html">Event Handling</A></LI> <LI><A HREF="html/joystick.html">Joystick</A></LI> <LI><A HREF="html/audio.html">Audio</A></LI> <LI><A HREF="html/cdrom.html">CDROM</A></LI> <LI><A HREF="html/thread.html">Threads</A></LI> <LI><A HREF="html/time.html">Timers</A></LI> </UL> </UL> </DIV ></BODY ></HTML >