Compare commits

...
Sign in to create a new pull request.

241 commits

Author SHA1 Message Date
Sam Lantinga
558a231a13 I'm not sure if this helps anything, but it was clearly wrong.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402561
2007-07-20 08:17:45 +00:00
Sam Lantinga
3dc65ba614 Merged window position fix from windib code
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402560
2007-07-20 03:30:41 +00:00
Sam Lantinga
0a9a1e25b8 > Hi Ryan,
> I checked the list you linked to, but did not see any reference to whether
> the Win32 window centering bug was fixed... Has that been addressed at all?

> I refer to the bug where, unless one has globally set the
> SDL_WINDOW_CENTERED variable in the OS, only the 1st window that is created

> will be centered. Subsequent calls to SetVideoMode will create a window tha
t
> shares the same upper-left corner location.

I'm working on that now, thanks for reporting it.  What I'm doing is if the
width and height are the same, I'm leaving the window position alone, but if
they're different they will respect the positioning environment variables.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402559
2007-07-20 03:25:40 +00:00
Sam Lantinga
482db6b458 Fixed warnings in NO_STDIO mode
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402558
2007-07-20 02:58:28 +00:00
Sam Lantinga
0b1d486568 Added patch note for bug #461
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402557
2007-07-19 08:12:45 +00:00
Sam Lantinga
99c118136b Fixed bug #461
Fixed a couple of bugs in the OpenGL window reset.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402556
2007-07-19 08:08:16 +00:00
Sam Lantinga
d2459bb368 Updating copyright date for Version.rc
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402555
2007-07-18 04:07:46 +00:00
Sam Lantinga
385916fd13 Better windres detection
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402553
2007-07-18 04:04:24 +00:00
Sam Lantinga
62756e27c7 Always advertise hardware palette, since Windows will remap colors for us.
We do grab the system colors if the application requested fullscreen or a
real hardware palette.

This allows gamma fading, etc. to work, and is what previous versions did.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402550
2007-07-16 05:08:20 +00:00
Sam Lantinga
0d40fac125 Added support for building version.rc in Windows build.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402548
2007-07-16 03:27:26 +00:00
Sam Lantinga
c44a317291 Fixed bug #428
This fix is overkill, but approved by Doug Lea, and he'll be releasing a
new version of his malloc.c sometime next month.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402546
2007-07-16 00:07:02 +00:00
Sam Lantinga
be91b51038 Fixed bug #457
Don't crash if passed a NULL overlay.  The app crashes anyway, since
it's not checking the return value of the create call, but at least it's
not crashing in SDL anymore. :)

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402543
2007-07-15 21:50:07 +00:00
Sam Lantinga
5adb9f2f7e Fixed building on Windows CE
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402542
2007-07-15 19:43:54 +00:00
Sam Lantinga
adddf96af5 Added a patch note for the Mac OS X cursor bug
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402541
2007-07-15 19:00:22 +00:00
Ryan C. Gordon
d069678465 Merged r3295:3296 from trunk/SDL: testjoystick reusing "joystick" variable.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402540
2007-07-15 17:26:50 +00:00
Sam Lantinga
2fe61699aa Final fix for bug #373
------- Comment #13 From Christian Walther 2007-07-15 10:04:56 [reply] -------
Created an attachment (id=229) [details]
patch to reinstate the SDL cursor after an NSApplicationActivatedEvent

Oops, you're right. My testcursor.c has diverged so far from the original that
I missed that. In fact, now that I think about it, that issue isn't even
addressed by the cursor rectangle patch - it is only concerned with windowed
mode (and fixes the problem there as a side effect). The problem in fullscreen
is still the same as before. How about the attachment for a fix? (I can confirm
that [NSCursor set] doesn't seem to have any effect when called from
QZ_DoActivate().)

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402538
2007-07-15 17:22:39 +00:00
Ryan C. Gordon
53dae52ecb Dump more information about each joystick in testjoytick.c
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402536
2007-07-15 16:33:45 +00:00
Sam Lantinga
33dff0e240 Patch from Christian Walther
Yes, the idea to use a cursor rectangle instead of [NSCursor set] has occurred
to me too, and it does seem to be the most elegant way. Here's my attempt at an
implementation

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402535
2007-07-15 15:58:00 +00:00
Ryan C. Gordon
3b3b5c0429 An attempt at fixing Bugzilla #454.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402534
2007-07-15 14:14:45 +00:00
Sam Lantinga
0468ab7f14 I think this fixes bug #454
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402533
2007-07-15 14:05:31 +00:00
Sam Lantinga
1012f68044 Use SDL C functions (fixes security warnings on OpenBSD)
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402531
2007-07-14 21:09:54 +00:00
Sam Lantinga
585eb48cad More improvements for bug #373
Show the SDL cursor in the window and the arrow cursor outside the window.

This is also supposed to show the SDL cursor when activated, but that code
isn't working yet...

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402530
2007-07-14 08:27:06 +00:00
Sam Lantinga
73b9604f5d Fixed bug #373
Patch contributed from Transgaming's Cider project
- create a window and view in fullscreen mode so the cursor can be set

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402529
2007-07-14 08:00:50 +00:00
Ryan C. Gordon
f162e3a203 Mac OS X/x86 won't build the MMX/YUV inline assembly without optimizations
enabled (not enough registers), so for now, we only build it if we see
 the __OPTIMIZE__ #define, which GCC provides when you build at -O1 or higher.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402527
2007-07-14 07:26:34 +00:00
Ryan C. Gordon
cdd5782864 Reverted r3255:3256. Don't actually need it unless the build is broken. :)
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402526
2007-07-14 07:06:46 +00:00
Ryan C. Gordon
e95642a890 Removed some unused static variables.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402523
2007-07-14 07:01:38 +00:00
Ryan C. Gordon
9445a05944 Mac OS X thinks we want a function call to SDL_memcpy() and not memcpy() here,
thanks to macro replacement issues.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402521
2007-07-14 06:45:01 +00:00
Patrice Mandin
739cd03b1d Call GEM_CheckMouseMode everytime something may change mouse form, and do it properly
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402513
2007-07-13 18:44:43 +00:00
Patrice Mandin
5aafadda16 Simplify setting window title
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402511
2007-07-13 16:09:16 +00:00
Sam Lantinga
03537c7353 Update default cross-compile install prefix for the latest mingw toolchain
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402510
2007-07-13 03:57:40 +00:00
Patrice Mandin
0419508892 Formatting with tabs
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402508
2007-07-12 19:00:08 +00:00
Sam Lantinga
60af778a01 A better fix for building DGA code on Solaris 8, inspired by the NetBSD pkgsrc patch.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402506
2007-07-12 08:05:19 +00:00
Sam Lantinga
b38871d185 Ryan's fix is still good for the built-in version of iconv_open()
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402505
2007-07-12 08:04:10 +00:00
Sam Lantinga
98c3187047 Fixed iconv handling on Solaris 11
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402502
2007-07-12 07:47:29 +00:00
Sam Lantinga
49f5340ada Fixed bug #455
If passed "" for the character set, let iconv_open() interpret it as
locale.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402501
2007-07-12 07:29:19 +00:00
Sam Lantinga
dfcf33773e Added note about SDL_config.h
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402494
2007-07-12 05:30:17 +00:00
Sam Lantinga
2bad9cfdd2 Fixed joystick name detection
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402493
2007-07-12 05:19:55 +00:00
Sam Lantinga
c746a535e3 Warn Visual C++ users if they have a stale configure generated SDL_config.h
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402491
2007-07-12 02:51:58 +00:00
Sam Lantinga
34fbbeed53 Added key composition support, courtesy of Kuon
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402484
2007-07-11 07:53:12 +00:00
Ryan C. Gordon
f7f530f9e0 Added more release notes.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402483
2007-07-11 07:47:47 +00:00
Ryan C. Gordon
5f3ed9032b Merged r3207:3208 from trunk/SDL: *INDENT-OFF* for inline asm.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402481
2007-07-11 07:25:57 +00:00
Ryan C. Gordon
fcba672095 Cleaned up tabs.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402480
2007-07-11 07:21:39 +00:00
Ryan C. Gordon
0e32fcbe1d GCC inline asm for MMX YUV processing no longer has textrels and now works when
gcc wants to hog %%ebx for the PIC register.

   Fixes Bugzilla #418.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402479
2007-07-11 06:26:22 +00:00
Sam Lantinga
ef9a779720 Fixed VC++ warnings
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402478
2007-07-11 05:55:10 +00:00
Sam Lantinga
ec47c8fd5f Removed unreferenced variable
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402477
2007-07-11 05:46:04 +00:00
Sam Lantinga
7cfdd8efb6 I think this fixes bug #261
Make sure that you don't use a wgl function after the context is deleted.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402476
2007-07-11 05:43:39 +00:00
Sam Lantinga
3530814620 Updated SVN checkout instructions
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402473
2007-07-10 20:15:31 +00:00
Ryan C. Gordon
3183821d09 Set the error after freeing stuff, just in case one of those functions resets
the error string.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402471
2007-07-10 19:03:44 +00:00
Ryan C. Gordon
a37ebaa8e6 Reverted most of r3200:3201: a malloc() failure would leave a zero-byte
file if opening for write.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402470
2007-07-10 18:56:08 +00:00
Sam Lantinga
bfef646388 Simplified Win32 file opening code
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402468
2007-07-10 16:01:46 +00:00
Sam Lantinga
5d9a9d6e7f Sort of fixed NAS detection on NetBSD - requires that /usr/pkg be in your include/linker/library path
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402466
2007-07-10 15:39:14 +00:00
Ryan C. Gordon
c64b5ebfd9 Whoops, reverted changes that shouldn't have been committed with #3197.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402465
2007-07-10 15:04:49 +00:00
Ryan C. Gordon
9a699f8d15 Don't leak the readahead buffer if win32 rwops file open fails.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402464
2007-07-10 15:03:19 +00:00
Sam Lantinga
9c48629d64 Backported the NAS detection from SDL 1.3, replacing the broken NetBSD patch
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402462
2007-07-10 14:16:44 +00:00
Ryan C. Gordon
8b10fbc3a1 Added a '*/' for whiney compilers that don't like comments-in-comments.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402461
2007-07-10 13:52:07 +00:00
Sam Lantinga
e9910211c8 Added patch note for file I/O speedup
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402460
2007-07-10 05:37:53 +00:00
Sam Lantinga
86d88abf59 Fixed bug #453
That's silly, we included <asm/page.h> even though we know we have getpagesize()

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402459
2007-07-10 05:35:33 +00:00
Sam Lantinga
65c53ab18b I'm reverting this patch...
I'm suspicious, since the X11 driver doesn't appear to need it. :)

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402455
2007-07-10 04:49:00 +00:00
Sam Lantinga
7ec71685d6 Merged some patches from NetBSD pkgsrc:
Added two patches for Solaris 8. The X11 implementation does not
define the xEvent structure unless NEED_EVENTS is defined.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402454
2007-07-10 04:47:08 +00:00
Sam Lantinga
4011f1ea6f Added patch-aj from NetBSD pkgsrc:
chunk 1:
avoid hardcoding nas paths; pkgsrc installs it somewhere else.
This part could probably be done better.

chunk 2:
-L/usr/lib is unnecessary

chunk 3:
Better DragonFly support.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402452
2007-07-10 04:41:50 +00:00
Sam Lantinga
d14434c607 Fixed signed/unsigned mismatch ... hmm, limited to 2 GB reads? Fix in SDL 1.3
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402451
2007-07-10 04:31:31 +00:00
Sam Lantinga
4b89904edb Added read-ahead support for Win32 file IO
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402450
2007-07-10 04:01:46 +00:00
Ryan C. Gordon
31d16a0542 Removed note about initializing mixing buffers.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402449
2007-07-09 00:26:21 +00:00
Ryan C. Gordon
40849ebe5f Reverted patch in revision #3139, since it changes behaviour, which isn't good
at this stage of 1.2.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402448
2007-07-09 00:25:31 +00:00
Sam Lantinga
619068cfc9 Applied patch from OpenBSD ports package
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402447
2007-07-08 22:58:33 +00:00
Sam Lantinga
ee60355872 Merged FreeBSD joystick patch
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402446
2007-07-08 22:14:37 +00:00
Sam Lantinga
bd653f8150 Fixed bug #437
Some X servers advertise the DGA extension don't support DGA1 anymore.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402445
2007-07-08 20:38:36 +00:00
Sam Lantinga
d3ad0e277e Fixed bug #451
SDL_memset4 copies a 32-bit value, not an 8-bit value.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402443
2007-07-08 14:24:27 +00:00
Sam Lantinga
89fa633402 Fixed configure warning about datarootdir
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402441
2007-07-08 05:58:16 +00:00
Sam Lantinga
c0116871a6 Fixed typo... did somebody not compile this before submitting a patch?
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402440
2007-07-08 04:07:36 +00:00
Ryan C. Gordon
6a51107ae1 This looks like it might hit Bugzilla #441, too, so we'll play it safe.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402439
2007-07-08 01:55:46 +00:00
Ryan C. Gordon
f6d3643ebb Clear the NOFRAME and RESIZABLE flags in the X11 target before setting their
new values, so multiple calls to SetVideoMode() that toggle these will end
 up with the right data.

   Fixes Bugzilla #441.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402438
2007-07-08 01:50:26 +00:00
Ryan C. Gordon
2a5d0ac5c9 Fixed compiler warning (gcc w/ -Wall) for using getpid() and kill() without
their proper headers included.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402436
2007-07-08 01:36:16 +00:00
Ryan C. Gordon
f5f620d183 Fixed compiler warning (gcc w/ -Wall) for unused variable, and checked for
error return code too.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402435
2007-07-08 01:35:50 +00:00
Sam Lantinga
69a0d935d9 Use GL direct updates when possible
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402434
2007-07-07 19:22:27 +00:00
Sam Lantinga
1ed61fec32 Fixed bug #360
Fixed fullscreen video modes and improved the mouse grab code.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402433
2007-07-07 19:20:28 +00:00
Sam Lantinga
e2d89e3012 Reverted mousewheel support in 1.2, since it breaks binary compatibility.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402430
2007-07-06 13:39:03 +00:00
Sam Lantinga
cf458d63c9 Ugh... actually changing what buttons are returned to the application. Maybe we should wait until SDL 1.3 for horizontal scrolling support?
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402429
2007-07-06 13:32:20 +00:00
Sam Lantinga
79ce9cd629 Fixed bug #382
Added horizontal scrolling support: SDL_BUTTON_WHEELLEFT (6) and SDL_BUTTON_WHEELRIGHT (7)

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402427
2007-07-06 09:15:43 +00:00
Sam Lantinga
4722d6e917 Fixed bug #322
Need to resync the keyboard state every time we set a video mode, since
the code in SDL_video.c is clearing the keyboard state.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402426
2007-07-06 07:45:33 +00:00
Sam Lantinga
432dd128e4 Fixed Windows build
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402425
2007-07-05 07:11:05 +00:00
Sam Lantinga
12157bf17d Fixed bug #436
The install-lib target should depend on the libraries that are built.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402423
2007-07-05 06:34:51 +00:00
Ryan C. Gordon
c27d0b332d Added Markus Mertama to the CREDITS file for the S60 port.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402419
2007-07-05 04:53:36 +00:00
Ryan C. Gordon
7834147dc6 Minor updates to the Symbian/S60 port, plus project files that weren't
previously imported.

   Fixes Bugzilla #433.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402418
2007-07-05 04:51:09 +00:00
Ryan C. Gordon
2e69a8f550 Added notes about audio callback behaviour.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402416
2007-07-05 02:53:40 +00:00
Ryan C. Gordon
268bdb1cc1 Fixed our own test app. :)
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402413
2007-07-05 02:44:54 +00:00
Ryan C. Gordon
2a9137296f Don't initialize the audio buffer passed to the application's audio callback,
since they are expected to entirely fill it with data or silence.

For legacy apps that might expect the buffer to already have silence and thus
 may not fill the buffer in the callback, there's an environment variable to
 expose the old behaviour.

  Fixes Bugzilla #416.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402411
2007-07-05 02:24:36 +00:00
Sam Lantinga
2ada4fdd9b Oops, didn't mean to commit this...
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402410
2007-07-04 15:22:47 +00:00
Sam Lantinga
f4a253ef63 Fixed bug #450
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402409
2007-07-04 15:22:07 +00:00
Sam Lantinga
6450125a74 Fixed bug #447
Xlib uses the native locale, not latin1

... the question is... what does the server use? :)

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402407
2007-07-04 07:54:06 +00:00
Sam Lantinga
13be73d999 Fixed bug #349
Solaris doesn't support the LATIN1 character set alias.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402405
2007-07-04 04:27:47 +00:00
Ryan C. Gordon
84063eb26e Fixed yasm/nasm warning.
Fixes Bugzilla #446.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402402
2007-07-03 09:53:26 +00:00
Sam Lantinga
75823323ed Fixed bug #398
You can use SetColors() before the video mode has been set.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402401
2007-07-03 09:39:09 +00:00
Sam Lantinga
17349bcd15 Added some missing patch notes - Ryan, feel free to add them for your commits
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402400
2007-07-03 09:22:57 +00:00
Sam Lantinga
6a44c15be5 Added patch note for fixing bug 335
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402399
2007-07-03 09:16:14 +00:00
Sam Lantinga
30606315b4 Fixed bug #335
Use SetSystemPaletteUse() to get better access to the system palette.

We can still do better palette matching in the case where we aren't
using fullscreen mode or a hardware palette, but that can wait for
another day. :)

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402398
2007-07-03 09:05:51 +00:00
Sam Lantinga
2ec93d3f0f Fixed assembly relocation problems, so we can check for NASM on Mac OS X.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402396
2007-07-02 02:45:52 +00:00
Sam Lantinga
a304f049b3 OpenGL is in the X11 directory on some systems.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402394
2007-06-30 08:09:53 +00:00
Sam Lantinga
b8cfbcff8f Fixed 64-bit compile issues
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402393
2007-06-30 03:47:50 +00:00
Ryan C. Gordon
f6513ee758 Corrected mismerge of XIM patch, thanks Alissa!
Fixes Bugzilla #429.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402391
2007-06-28 19:29:26 +00:00
Sam Lantinga
9a001803a5 iconv() doesn't write to the data, just make compilers happy
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402389
2007-06-28 08:33:59 +00:00
Sam Lantinga
2fd06952d1 Whoops, need to actually copy inbuf
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402387
2007-06-28 06:53:09 +00:00
Sam Lantinga
cc3fe2e639 Okay, apparently the newer standard specifies char** for the inbuf
parameter to iconv()
(See http://lists.debian.org/debian-glibc/2004/05/msg00006.html)

I'm casting in the general case, but I added a non-const codepath in
case it matters on some platform.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402386
2007-06-28 06:47:35 +00:00
Sam Lantinga
aa3a251d43 Better fix for bug 419
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402385
2007-06-28 05:35:50 +00:00
Ryan C. Gordon
8915c4f95b Removed textrels from hermes code.
Partially fixes Bugzilla #418.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402383
2007-06-27 10:12:49 +00:00
Ryan C. Gordon
d95716b5de Updated "What's New" docs.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402382
2007-06-26 20:04:15 +00:00
Ryan C. Gordon
6848868c27 windib target can now control screensaver with SDL_VIDEO_ALLOW_SCREENSAVER.
Fixes Bugzilla #415.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402381
2007-06-26 20:02:40 +00:00
Ryan C. Gordon
9797c48fd7 Added some new XIM symbols to the dynamic X11 function list.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402380
2007-06-26 00:57:09 +00:00
Ryan C. Gordon
9289f20b49 Whoops, patched to compile.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402379
2007-06-25 20:08:55 +00:00
Ryan C. Gordon
daddb89773 Significantly improved XIM support.
Fixes Bugzilla #429.


Selected notes from the patch's README:

= FIXES =

This patch fixes the above issues as follows.

== X11 events ==

Moved XFilterEvent just after XNextEvent so that all events are passed
to it.  Also, XFilterEvent will receive masks indicated by IM through
XNFilterEvents IC value as well as masks surpplied by SDL.

X11_KeyRepeat is called between XNextEvent and XFilterEvent, after
testing an event is a KeyRelease.  I'm not 100% comfortable to do so,
but I couldn't find a better timing to call it, and use of the
function is inevitable.

== Xutf8LookupString ==

Used a longer buffer to receive UTF-8 string.  If it is insufficient,
a dynamic storage of the requested size will be allocated.  The
initial size of the buffer is set to 32, because the Japanese text
converted from the most widely used benchmark key sequence for
Japanese IM, "WATASHINONAMAEHANAKANODESU." has ten Japanese characters
in it, that occupies 30 bytes when encoded in UTF-8.

== SDL_keysym.unicode ==

On Windows version of SDL implementation, SDL_keysym.unicode stores
UTF-16 encoded unicode characters, one UTF-16 encoding unit per an SDL
event.  A Unicode supplementary characters are sent to an application
as two events.  (One with a high surrogate and another with a low
surrogate.)  The behavior seems reasonable since it is upward
compatible with existing handling of BMP characters.

I wrote a UTF-8 to UTF-16 conversion function for the purpose.  It is
designed with the execution speed in mind, having a minimum set of
features that my patch requires.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402378
2007-06-25 19:58:32 +00:00
Sam Lantinga
0f38978e54 Oops, 512x512 in 16 bit mode
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402377
2007-06-25 14:58:22 +00:00
Sam Lantinga
9d68aabeb7 Added initial support for Nintendo DS, based on the work by Troy Davis (GPF)
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402376
2007-06-25 00:50:20 +00:00
Ryan C. Gordon
10ab421d01 Added S60 port.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402375
2007-06-24 18:26:35 +00:00
Ryan C. Gordon
6fb707a2a2 Whoops, fixed previous VC6 support patch.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402373
2007-06-21 18:48:13 +00:00
Ryan C. Gordon
be8f728aaa Fixes for Visual C++ 6.0 with and without the Processor Pack.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402371
2007-06-21 18:20:59 +00:00
Ryan C. Gordon
24ea7c9a31 Fixed assembler command line for older yasm releases and documented nasm
switches.

   Fixes Bugzilla #440.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402366
2007-06-16 05:51:51 +00:00
Ryan C. Gordon
1358a199de Fixed win32 event name list (WM_MOUSELAST was listed twice, one should be
WM_MOUSEWHEEL).

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402364
2007-06-16 05:24:55 +00:00
Ryan C. Gordon
f9e2e9d635 Added support for WM_XBUTTON to the windib driver, to support more mouse
buttons.

   Fixes Bugzilla #311.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402363
2007-06-16 05:10:47 +00:00
Ryan C. Gordon
bacb61113e Removed some more EPOC stuff I missed.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402361
2007-06-15 15:52:04 +00:00
Ryan C. Gordon
52001505d8 Removed EPOC port...it's being replaced by an updated Symbian port with the
original author's blessing.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402360
2007-06-15 15:42:15 +00:00
Ryan C. Gordon
92435d924a Make sure to check for glu.h before enabling glX support. We don't
directly need GLU, but SDL_opengl.h tries to include it, and it shows that
 the workstation is misconfigured or incompletely configured if just this
 one header is missing.

   Fixes Bugzilla #336.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402358
2007-06-15 12:26:29 +00:00
Sam Lantinga
65296278a3 Added patch note for subversion revision 3076
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402357
2007-06-15 11:43:14 +00:00
Ryan C. Gordon
1e4e388318 Make sure __inline__ isn't defined before #defining it, since some compilers
(like Sun Studio) have this as a predefined macro.

   Fixes Bugzilla #434.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402354
2007-06-15 07:19:05 +00:00
Ryan C. Gordon
4c8d994db9 Clean up have-initialized resources in some failing edge cases.
Maybe fixes Bugzilla #426.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402353
2007-06-15 06:57:31 +00:00
Sam Lantinga
43816f4915 Added docs for revision 3073 - Ryan, feel free to do this yourself, if you want.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402352
2007-06-15 06:49:14 +00:00
Ryan C. Gordon
51bddc2dc9 Support for Gamma Ramps on Mac OS Classic in both the macrom and macdsp video
targets, thanks to Gregory Smith!

   Fixes Bugzilla #431.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402351
2007-06-15 06:29:52 +00:00
Sam Lantinga
2a55f0a351 Don't install the extra SDL config headers or SDL_copying.h
Fixes Bugzilla #361.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402349
2007-06-15 05:41:22 +00:00
Sam Lantinga
22b2aca10e Updated docs with bug fixes in subversion.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402348
2007-06-15 05:21:33 +00:00
Ryan C. Gordon
2af6c8e18c Prevent arts audio target from crashing/hanging SDL if the audio hardware
isn't available.

   Fixes Bugzilla #372.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402346
2007-06-14 14:09:25 +00:00
Ryan C. Gordon
3c92462fd1 Actually, this is a better fix...clear the error state once if everything we
need loaded; it's more efficient, and works even if the last unnecessary
 xrandr symbol failed to load. Otherwise, leave the original loadso error, so
 the end user can find out what symbol failed.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402342
2007-06-13 08:00:10 +00:00
Ryan C. Gordon
7bcb619015 Date: Mon, 4 Jun 2007 06:17:59 +0000 (UTC)
From: George Gensure <werkt0@gmail.com>
Subject: [SDL] error removal patch for SDL_x11dyn.c

I found that calling SDL_GetError when an error hasn't necessarily occurred is
still reporting problems from loadso regarding dynamic functions in X11.  I've
added the following to my local copy to avoid revealing the 'many library
lookup' approach adopted by x11dyn.c:

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402341
2007-06-13 07:54:10 +00:00
Ryan C. Gordon
935338957d Print keysym with key events.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402339
2007-06-13 04:13:21 +00:00
Patrice Mandin
32a4452933 Avoid switch to supervisor mode in SDL_GetTicks, by updating system counter from vbl interrupt
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402337
2007-06-09 19:52:05 +00:00
Patrice Mandin
ebf84b70dd Set supervisor as volatile as it is modified from an interrupt
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402335
2007-06-08 21:44:40 +00:00
Ryan C. Gordon
2d2ab89a1d C fallback for SDL_revcpy() was off by one. Thanks to Emmanuel Jeandel for
the catch.

  Fixes Bugzilla #424.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402333
2007-06-04 11:43:47 +00:00
Ryan C. Gordon
6b5b916b0d Better handling of multiple queued Cocoa mouse events. Thanks to Christian
Walther for the patch.

   Fixes Bugzilla #353.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402332
2007-06-04 11:22:23 +00:00
Ryan C. Gordon
88ccf13d13 Patch to allow DirectFB target to report a correct screen size.
Fixes Bugzilla #399.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402330
2007-06-04 11:15:58 +00:00
Ryan C. Gordon
f1107d9179 Check if yasm supports a nasm-specific syntax we use (it doesn't in 0.5.0,
which is still common in Linux distros, and does in 0.6.0). Disable it if we
 don't, attempting to fallback to using nasm. Thanks to Mike Frysinger for the
 patch.

   Fixes Bugzilla #393.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402328
2007-06-04 11:06:48 +00:00
Ryan C. Gordon
a0395a876c Minor macrom comment cleanup.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402327
2007-06-03 19:21:07 +00:00
Ryan C. Gordon
10b93c9102 Minor tab fix in mac drawsprocket code.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402326
2007-06-03 19:19:16 +00:00
Ryan C. Gordon
24f42ead23 Patched to compile on Mac OS X (not that you should necessarily be using this
on Mac OS X, but still) ...

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402324
2007-06-03 06:52:58 +00:00
Ryan C. Gordon
e883b665af Use system memset/memcpy on Mac OS X, since Apple hand-tunes these for each
processor they ship (and thus, it's likely to beat our code on PowerPC and
 Intel and whatever variants or new archs show up later).

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402323
2007-06-03 06:52:06 +00:00
Ryan C. Gordon
27d3e5f271 Mac OS X joystick calibration code should start with device-specified bounds.
Fixes Bugzilla #344.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402320
2007-05-29 12:01:07 +00:00
Patrice Mandin
576d64cb8d Allow creation of window bigger than visible size
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402318
2007-05-27 08:53:48 +00:00
Patrice Mandin
d3b8d75c1b Oops
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402317
2007-05-26 20:12:58 +00:00
Patrice Mandin
536d584388 Simply resize existing window
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402315
2007-05-26 20:09:56 +00:00
Patrice Mandin
3e7810109a GEM has a window manager, of course
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402313
2007-05-26 19:44:37 +00:00
Ryan C. Gordon
4fbac0bf45 Check correct glX extension name for swap_control, but it doesn't look like
we ever actually look up the symbol...that's probably a bug.  :/

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402312
2007-05-22 22:15:54 +00:00
Ryan C. Gordon
a144a3d025 Committed PulseAudio driver. Thanks, Stephan!
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402310
2007-05-13 23:12:46 +00:00
Ryan C. Gordon
d070d0ddfd Removing .gdbinit from test directory.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402307
2007-04-17 09:09:48 +00:00
Ryan C. Gordon
b17574196b Let Windows OpenGL users use SDL_GL_SWAP_CONTROL even if WGL_ARB_pixel_format
isn't available...this looks like it got tucked into here with the other
 attributes, which are wrapped in a pixel_format availability check.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402306
2007-04-17 08:28:19 +00:00
Ryan C. Gordon
0ea790c9ae Let app set SDL_VIDEO_ALLOW_SCREENSAVER environment variable to override SDL's
attempt to disable screen savers. Works for Quartz (Mac OS X) and X11.

Need a formal API for this in 1.3, still.

  Fixes Bugzilla #415.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402305
2007-04-06 20:30:41 +00:00
Ryan C. Gordon
b120a012d2 There are several subsystems that need IOKit linked in on Mac OS X, so handle
cases where one or more of them are disabled.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402302
2007-04-04 10:34:42 +00:00
Ryan C. Gordon
2dc670fd22 Crap, put this patch in the wrong place.
THIS fixes Bugzilla #403.   :/

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402301
2007-04-04 10:30:07 +00:00
Ryan C. Gordon
a198a2d80f Don't compile the joystick code if --disable-joystick is specified at
./configure time, and define SDL_JOYSTICK_DUMMY if the subsystem is wanted
 but there aren't any drivers available for the platform.

 Fixes Bugzilla #403.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402300
2007-04-04 10:28:14 +00:00
Ryan C. Gordon
3ce0d260d0 Const correctness patch for SDL_MapRGB and SDL_MapRGBA.
Fixes Bugzilla #421.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402298
2007-04-04 09:40:40 +00:00
Ryan C. Gordon
3a156ea6be BlitRGBtoRGBPixelAlphaMMX() is putting the wrong value into a register.
Thanks to Alex Volkov for following up on this.

   Fixes Bugzilla #390.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402296
2007-04-04 09:32:29 +00:00
Ryan C. Gordon
31327331d9 Fixed buggy SDL_VIDEO_X11_MOUSEACCEL behaviour...correctly free buffer, and
only call XChangePointerControl() if we have valid arguments.

  Fixes Bugzilla #417.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402295
2007-04-04 09:15:39 +00:00
Ryan C. Gordon
749c11c06b Date: Sat, 31 Mar 2007 16:39:52 +0200
From: Bert Wesarg
To: sdl@lists.libsdl.org
Subject: [SDL] [PATCH] sdl-config.in needs ${libdir}

Hello,

after the patch for Bug #321, sdl-config.in needs the libdir variable. and
 there is a hardcoded 'lib' in SDL.spec.in too.

Bert Wesarg

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402293
2007-04-01 03:27:45 +00:00
Ryan C. Gordon
c6a106ad29 Adjusted to handle different constness in older versions of iconv.
Fixes Bugzilla #419.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402292
2007-03-30 20:09:55 +00:00
Ryan C. Gordon
98838b4428 Patched to compile on Visual Studio.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402290
2007-03-30 06:26:28 +00:00
Ryan C. Gordon
357970bfe2 Fixed Mac OS X config header when compiling with -Wundef.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402288
2007-03-28 00:36:35 +00:00
Ryan C. Gordon
db2fe20ace From: Laurence Passmore
Date: Mon, 26 Mar 2007 23:22:45 +0100
To: "A list for developers using the SDL library. \(includes SDL-announce\)" <sdl@lists.libsdl.org>
Subject: [SDL] SDL_config_macosx.h: MAC_OS_X_VERSION_MIN_REQUIRED

Hi,

I just compiled my SDL application on Mac OS X with -Wundef and it
threw a number of errors. Of note was:

     SDL_config_macosx.h: 34
     warning: "MAC_OS_X_VERSION_MIN_REQUIRED" is not defined

Line 34 is:

     #if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined (__POWERPC__)) )

Now according to this mailing on the Apple developer lists:

     http://lists.apple.com/archives/Xcode-users/2005/May/msg00602.html

that particular #define was removed from the gcc compiler defaults
and AvailabilityMacros.h (/usr/include/AvailabilityMacros.h) should
be pulled in directly instead.

Would someone closer to the Mac OS X version of SDL be willing to
make that change please? Thanks.

Laurence Passmore
Homeworld SDL @ www.homeworldsdl.org

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402286
2007-03-27 00:37:51 +00:00
Ryan C. Gordon
87f0994d7a Mac OS X joystick support: don't ignore kHIDUsage_GD_MultiAxisController
devices, since they are probably joysticks, or joystick-like things.

See 3Dconnexion's SpaceNavigator for an example of such a device:
   http://www.3dconnexion.com/products/3a1d.php

Thanks to Laurence Passmore for the fix.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402284
2007-03-18 22:37:10 +00:00
Ryan C. Gordon
9e136b5ec7 Linux fbcon: don't include asm/page.h if we know getpagesize() exists, since
we don't need it, and doing so will hit #error lines on some CPU archs.

Thanks to Mike Frysinger for the heads up.

  Fixes Bugzilla #414.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402282
2007-03-14 01:09:24 +00:00
Ryan C. Gordon
214b58fbad Removed some debug printf() calls I accidentally added to Subversion.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402281
2007-02-23 00:37:07 +00:00
Ryan C. Gordon
27002e9323 Merged r2987:2988 from trunk/SDL: buggy Sidewinder ID added to linux joysticks.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402280
2007-02-20 22:57:28 +00:00
Ryan C. Gordon
b3c3a9ad47 Need to set DLSCL_ADMINISTRATIVE coop level in directfb driver, or YUV overlay
creation will fail in newer DirectFB versions.

   Fixes Bugzilla #394.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402277
2007-02-20 21:05:12 +00:00
Ryan C. Gordon
372defa7ba SDL_SetWindowCaption() on Windows: try to use the unicode
SetWindowText() if it exists in user32.dll, and fallback to converting
to the current codepage (instead of latin1) if not.

  Fixes Bugzilla #365.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402276
2007-02-16 04:56:17 +00:00
Ryan C. Gordon
d969c7e221 Minor const correctness patch to SDL_iconv.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402275
2007-02-16 03:50:42 +00:00
Ryan C. Gordon
8b407756dc Patched fbcon to compile on newer Linux kernels that don't #define PAGE_SIZE,
since a memory page's size may vary on various architectures and kernel
 configurations.

Will use getpagesize() if it exists, the PAGE_SIZE #define from older kernels
 if that doesn't, and #error out if that's not there either...but it's
 probably 4096 in that case. We may revisit this.

   Fixes Bugzilla #392.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402273
2007-02-15 23:50:45 +00:00
Ryan C. Gordon
cb20c837f4 Force chars to unsigned chars in SDL_string.c, so platforms that expect
these to not be negative, when not EOF, work.

   Fixes Bugzilla #338.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402271
2007-02-15 11:06:22 +00:00
Ryan C. Gordon
0855a63e16 Removed the contents of the BUGS file, as most (all?) of the issues were
either long-since fixed or something that will never get fixed.

The file now points people to Bugzilla and the mailing list.

   Fixes Bugzilla #352.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402269
2007-02-14 10:40:24 +00:00
Ryan C. Gordon
b360c13391 Quartz code should use F13, F14, and F15 keys instead of PrintScreen,
ScrollLock, and Pause, since that's what's on the standard Apple keyboards
 (minus the laptops, which have neither set). Ideally we'll find a better way
 to distinguish this...the keys being replaced would be correct on a USB
 keyboard for Windows. Sigh.

   Fixes Bugzilla #301.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402267
2007-02-14 10:23:23 +00:00
Ryan C. Gordon
64941faf12 Corrected wrong SDK path in build-scripts/fatbuild.sh.
Fixes Bugzilla #377.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402265
2007-02-13 09:58:04 +00:00
Ryan C. Gordon
ebb3fc7478 Free all the created cursors in test/testcursor.c.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402263
2007-02-13 09:20:37 +00:00
Ryan C. Gordon
9a1cd1510c Digital Mars has stdint.h, so use the header on Windows with that compiler.
Fixes Bugzilla #376.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402261
2007-02-12 11:45:18 +00:00
Ryan C. Gordon
275142c73d Handle source data alignment correctly in Blit32to32SurfaceAlphaAltivec().
Fixes Bugzilla #279.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402259
2007-02-12 10:52:10 +00:00
Ryan C. Gordon
8bc3ad08b2 Patched to compile on BeOS and old, old GCC releases.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402257
2007-02-05 06:44:51 +00:00
Ryan C. Gordon
a258df05a0 Actually, this is dumb, just simplify this for now.
(But what if this finds the wrong symbol? We really should make this a
   ./configure test and only do one dlsym or the other depending on the
   platform...)

Reference Bugzilla #354.

--ryan.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402255
2007-02-03 08:17:12 +00:00
Ryan C. Gordon
320270a127 Moved otherwise-unused underscore-prepending code in dlopen backend into an
#ifdef.

Fixes Bugzilla #354.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402254
2007-02-03 08:11:45 +00:00
Sam Lantinga
ac32d0c5f9 Updated svn repository
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402252
2007-01-23 04:47:11 +00:00
Patrice Mandin
776d4072e8 Add error message if not using SDL_LoadObject
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402251
2007-01-14 14:24:36 +00:00
Patrice Mandin
574cd41a99 Disable TurboVeille screensaver if present
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402250
2007-01-11 20:33:13 +00:00
Patrice Mandin
4f0435f4d2 Alpha sort the test list, add missing ones, remove removed ones
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402248
2007-01-04 19:52:12 +00:00
Ryan C. Gordon
55d74eb418 Fix of HBITMAP leak in GAPI driver by Dmitry Yakimov.
Fixes Bugzilla #371.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402247
2006-12-11 19:51:19 +00:00
Ryan C. Gordon
cafb1ab206 Merge r2921:2922 from SDL trunk to 1.2 branch: mingw alloca.h workaround.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402244
2006-12-01 20:26:06 +00:00
Ryan C. Gordon
880be03a0d Wrapped some macro params in parentheses for alloca wrappers.
Thansk, Suzuki Masahiro.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402240
2006-11-29 10:30:05 +00:00
Ryan C. Gordon
7a80023487 From: Gabriel Gambetta
To: SDL Mailing List <sdl@libsdl.org>
Date: Fri, 17 Nov 2006 00:39:29 -0200
Subject: [SDL] Alpha blending bug - fixed?

It turns out mm5 never got the correct value. This failed :

	[...]
	"movd %1, %%mm5\n\t"
	: : "m" (amask), "m" (sf->Ashift) );


mm5 got 0xFF000018 instead of 0x00000018. However I did this :

	Uint32 ashift = sf->Ashift;
	[...]
	"movd %1, %%mm5\n\t"
	: : "m" (amask), "m" (ashift) );

and everything worked fine.

The only thing I could find out was that ashift is 32-bit aligned but
sf->Ashift isn't:

printf("ashift     %8X [%d]\n", &ashift, (int)(&ashift) % 4);
printf("sf->Ashift %8X [%d]\n", &sf->Ashift, (int)(&sf->Ashift) % 4);

ashift     at BFF0E0C4 [0]
sf->Ashift at 08AFB9CD [1]

Could this be the problem? If it is, the fix is extremely trivial.
Should I submit a patch?

	--Gabriel

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402236
2006-11-21 23:17:00 +00:00
Ryan C. Gordon
8ab5a93d38 Added sdl.pc to svn:ignore.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402235
2006-11-21 20:49:35 +00:00
Patrice Mandin
ae2275c2b4 Check video driver mouse cursor pointers before using them
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402234
2006-11-19 14:07:32 +00:00
Ryan C. Gordon
8061a35dcf X11 backend: tell app that mouse focus has been obtained when grabbing the
input. This allows us to enable DGA mode, even when the system cursor was
 outside of the window when the grab was initiated.

Fixes Bugzilla #299, which has a more detailed explanation of the issue.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402231
2006-11-13 03:58:22 +00:00
Ryan C. Gordon
6bde134187 Block fruity channel values in dspaudio, or the fragment size won't be a
power of 2.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402229
2006-11-12 21:23:57 +00:00
Ryan C. Gordon
72c5d1e8ab BeOS loadso code now reports failure correctly from SDL_LoadObject(), and uses
the system to provide text for SDL_SetError().

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402226
2006-11-07 15:17:31 +00:00
Ryan C. Gordon
c3143b8b9c Man, who let this moron near printf()?! :)
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402224
2006-11-07 15:00:43 +00:00
Ryan C. Gordon
92643bac52 Added a test program for loadso subsystem.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402222
2006-11-07 14:31:25 +00:00
Ryan C. Gordon
23fc5d0035 Chopped out some code to match changes in revision #2793 to fix build...but
I think this just breaks fullscreen YUV rendering.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402221
2006-11-07 14:06:25 +00:00
Ryan C. Gordon
eb72e866d7 Merged r2896:2897 from trunk (use dummy joystick if subsystem enabled and
no platform-specific driver exists).

Fixes Bugzilla #356 (and maybe Bugzilla #350).

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402220
2006-11-03 21:52:54 +00:00
Ryan C. Gordon
74852e1d64 A few more AmigaOS things.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402214
2006-10-29 04:08:50 +00:00
Ryan C. Gordon
79b94d85d1 Removed broken AmigaOS support.
Fixes Bugzilla #337.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402213
2006-10-29 03:58:27 +00:00
Ryan C. Gordon
ca282f044b Added some newer binaries to svn:ignore.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402212
2006-10-29 03:44:25 +00:00
Ryan C. Gordon
876d68b4c9 joyGetPosEx() was using the wrong variable for specifying a device; this is
corrected now. (thanks, Ondrej!)

Fixes Bugzilla #267.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402210
2006-10-29 03:37:24 +00:00
Ryan C. Gordon
239244f867 Closing minor memory leak in XME code.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402209
2006-10-29 02:46:42 +00:00
Ryan C. Gordon
fce9244441 Fix for buffer overflow in audio code, when feeding a device that needs
resampling.

Fixes Bugzilla #298.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402200
2006-10-27 20:18:24 +00:00
Patrice Mandin
0a1cd99daf Also save/restore fpu register in vbl interrupt
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402198
2006-10-21 18:53:33 +00:00
Sam Lantinga
b894bd1a3c backport from 1.3
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402125
2006-10-01 02:30:03 +00:00
Ryan C. Gordon
4ab10dce94 1.2 backport: Replaced strncmp for SDL_AUDIODRIVER test with strcasecmp.
Fixes Bugzilla #334.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402123
2006-10-01 02:07:09 +00:00
Sam Lantinga
64fd559c0d Fixed bug #292
I might be on crack here.

It looks like SDL_ConvertMono() in src/audio/SDL_audiocvt.c adds the left and
right channels of a stereo stream together, and clamps the new mono channel if
it would overflow.

Shouldn't it be dividing by 2 to average the two sample points instead of
clamping? Otherwise the mono sample point's volume doubles in the conversion.
This would also make the conversion faster, as it replaces two branches per
sample frame with a bitwise shift.

--ryan.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402118
2006-09-24 15:45:37 +00:00
Sam Lantinga
654f1950a3 Fixed formatting
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402117
2006-09-24 15:36:37 +00:00
Sam Lantinga
29285b1030 Fixed bug #286
Date: Thu, 9 Feb 2006 17:06:51 +0300
From: "Oleg K  [BeSman]"
Subject: BeOS SDL patches

Hello all. My name is Oleg K. [BeSman], Im a BeOS user from Russia.This mail
contain a BeOs-specific patches to SDL (implementation of InputGrabbing and
mouse_relative mode). See the source in attached file for details.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402116
2006-09-24 15:31:42 +00:00
Sam Lantinga
fd8b91f982 Fixed bug #281
------- Comment #2 From Christian Walther 2006-07-23 07:37 [reply] -------

Wow, that was an interesting bug to chase. It was a timing issue: it seems that
for some reason, a certain time must pass between ShowMenuBar() being called in
QZ_UnsetVideoMode() and the application quitting. Before rev. 1885, this delay
was provided by the slow hand-coded fade. With the asynchronous Core Graphics
fading introduced in rev. 1885, that delay was no longer present (most of the
time) and the bug became apparent. Adding an SDL_Delay(100) somewhere between
ShowMenuBar() and the end of QZ_VideoQuit() lowered the frequency of the bug
appearing from "almost every time" to "very rarely" here.

However, there is another solution: doing the ShowMenuBar() before releasing
the captured display instead of afterwards. Apparently, no delay is necessary
in that case, and it looks nicer to me anyway because it is the reverse order
of the way things are set up in the beginning: capture display - set video mode
- hide menu bar - ... - show menu bar - reset video mode - release captured
display. So, this is what the attached patch does.

In addition, I've taken the liberty of
- removing some unused code that I forgot to remove in rev. 1885,
- fixing two warnings about undeclared functions in SDL_QuartzVideo.m by
including OpenGL.h (whose name is a bit misleading - it only declares CGL
stuff, so there's no interference with SDL_opengl.h).

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402115
2006-09-24 01:27:40 +00:00
Sam Lantinga
e37cb653ba Fixed bug #316
Looks like this is a long standing typo... is this code even used anymore?

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402113
2006-09-24 00:55:00 +00:00
Sam Lantinga
045a682ec0 Fixed bug #321
Hi,
if "configure" is given an explicit --libdir, the sdl-config still contains
the default "${exec_prefix}/lib" for runtime linker path.

That should be changed to $libdir, as this is where the library goes to...

Regards,
  Juergen

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402111
2006-09-24 00:43:36 +00:00
Sam Lantinga
2f28b8c5d0 Fixed bug #270
SDL_SetCursor returns void, not void*

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402109
2006-09-24 00:36:24 +00:00
Sam Lantinga
dd8038b0e4 Bumped the version in subversion to 1.2.12
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402108
2006-09-24 00:10:59 +00:00
Sam Lantinga
8460b069f6 Fixed bug #278
Added the GFX_Display to the wminfo structure, contributed by Eric

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402107
2006-09-24 00:08:28 +00:00
Sam Lantinga
6a16eb68dc Fixed bug #276
PlanarPixmapInfoYUV420 is a big endian structure.
Fix contributed by Jean-Charles BERTIN

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402106
2006-09-24 00:04:06 +00:00
Sam Lantinga
0b9d71091e --HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402104
2006-09-23 23:15:34 +00:00
Sam Lantinga
66bd610f04 Fixed bug #304
WinCE - refactoring of hardware buttons handling
Contributed by Dmitry Yakimov

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402103
2006-09-23 23:12:44 +00:00
Sam Lantinga
a71237840f Fixed bug #294
Can't build SDL 1.2.11(and svn) for Pocket PC 2003 with Visual Studio 2005
Fix contributed by Dmitry Yakimov

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402102
2006-09-23 23:07:52 +00:00
Patrice Mandin
9cc61d56c8 Forgot cpu boundaries
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402090
2006-09-16 12:00:03 +00:00
Patrice Mandin
f31a930c98 Save/restore fpu registers if needed
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402089
2006-09-16 11:50:34 +00:00
Patrice Mandin
336e30592d Add function to check FPU presence
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402088
2006-09-16 10:38:09 +00:00
Patrice Mandin
75df00ebdf Only saved non preserved registers
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402087
2006-09-16 09:15:11 +00:00
Patrice Mandin
c588ef3271 Only convert endianness if both src and dest are 16bits
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402086
2006-09-16 09:14:25 +00:00
Patrice Mandin
bd51c73283 Update to reflect driver changes
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402085
2006-09-15 21:26:36 +00:00
Patrice Mandin
ca12676b88 Use new keyboard mapping routines
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402084
2006-09-13 21:19:13 +00:00
Patrice Mandin
fc46c0ae5d Factorize keyboard mapping between drivers
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402083
2006-09-13 21:18:35 +00:00
Patrice Mandin
e5b239feec Allow grabing mouse by locking its position
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402078
2006-09-12 19:34:18 +00:00
Patrice Mandin
faf3d7ce00 Reenable xbios usage to get relative mouse motion
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402077
2006-09-12 19:33:33 +00:00
Patrice Mandin
8eba29d834 Allow mouse to be locked when grabbed with GEM driver
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402076
2006-09-12 19:28:54 +00:00
Patrice Mandin
7cfc406eb8 Disable MiNT thread usage and use hw access for updating DMA audio pointers
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402074
2006-09-12 19:20:50 +00:00
Patrice Mandin
d49f3ac1d0 Forgot to reshow mouse cursor when exiting grab/hide mode
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402071
2006-09-08 19:17:03 +00:00
Patrice Mandin
8d211fac77 /me dumb, sizeof(keymap) != number of elements
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402070
2006-09-07 20:52:31 +00:00
Patrice Mandin
473f24de3d Use correct function to free allocated mem
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402067
2006-09-05 19:31:48 +00:00
Ryan C. Gordon
b601827c97 Removed some new 1.3 symbols from code backported to 1.2.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402066
2006-09-03 21:34:11 +00:00
Ryan C. Gordon
212dbcb764 Backport from 1.3: most of the audio drivers can now handle data
conversion at a higher level when they can't open the hardware in the
 exact format requested.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402063
2006-09-01 22:50:24 +00:00
Patrice Mandin
d5e84bbf7c Add teamtap support (4 joypads adapter on 1 port)
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402010
2006-08-02 21:26:31 +00:00
Ryan C. Gordon
ce0491587b Patched to compile. Fixes Bugzilla #285.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%401980
2006-07-24 23:29:01 +00:00
Sam Lantinga
96afe9541c Updated the snapshot build target to reflect the new source location
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%401939
2006-07-10 21:23:11 +00:00
Sam Lantinga
c156efb73d SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%401937
2006-07-10 21:03:59 +00:00
237 changed files with 16871 additions and 9260 deletions

202
BUGS
View file

@ -1,204 +1,18 @@
All:
Audio rate conversion is only implemented by multiplying or dividing
by a power of two. This is a side-effect of the requirement that the
raw audio buffer size be a power of two, and can hopefully be fixed.
This means 8 KHz audio converted to 22 KHz ends up being 16 KHz. :-/
Bugs are now managed in the SDL bug tracker, here:
When the implementation is writing directly to video memory the mouse
cursor doesn't work properly. Applications which do this should use
their own mouse cursor and call SDL_ShowCursor(0) to hide the system
cursor.
http://bugzilla.libsdl.org/
Linux:
Wide UNICODE character input (Kanji, etc.) is not yet supported.
It requires handling of keyboard mapping events and using the XIM
input translation extension. I will implement it as requested.
Latin-1 keyboard input works fine.
(UPDATE 04/06/2004: this bug is now fixed)
You may report bugs there, and search to see if a given issue has already
been reported, discussed, and maybe even fixed.
The keyboard modifiers are not set to the correct state on startup.
The AAlib, GGI, and SVGAlib video drivers are not heavily tested.
Win32:
The MCI driver can't tell if the CD-ROM drive is paused or stopped.
You may also find help at the SDL mailing list. Subscription information:
The SDL_INIT_EVENTTHREAD flag is not supported on Win32
(Idea: create a separate DirectInput polling thread)
The main purpose of this flag is for smooth cursor motion in
fullscreen environments.
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Wide UNICODE character input (Kanji, etc.) is not yet supported.
This requires the ToUnicode() API which is only implemented on
Windows NT/2000, not on Windows 95/98.
Latin-1 keyboard input works fine.
Bug reports are welcome here, but we really appreciate if you use Bugzilla, as
bugs discussed on the mailing list may be forgotten or missed.
Joysticks are only supported under the Win32 MultiMedia API,
DirectInput support is not yet implemented.
BeOS:
BePPC is not supported, apparently not even by Be Inc.
SDL_WM_GrabInput() is not implemented.
Does anyone know how to do this? SDL_WM_GrabInput() is designed
to prevent the user from switching input and mouse focus away from
the SDL application.
Continuous relative mouse motion is not implemented.
Wide UNICODE character input (Kanji, etc.) has not been tested.
Latin-1 keyboard input works fine.
MacOS:
Palette handling isn't implemented in windowed mode yet.
Audio hasn't been extensively tested, in particular the locking
isn't implemented and mixer routines may not call malloc() or free()
because they are called at interrupt time.
SDL_WM_GrabInput() is not implemented.
Does anyone know how to do this? SDL_WM_GrabInput() is designed
to prevent the user from switching input and mouse focus away from
the SDL application.
Continuous relative mouse motion is not implemented.
SDL_AddTimer() and SDL_RemoveTimer() haven't been implemented yet.
Not all of the keys are properly recognized on the keyboard.
Mac OS X:
Depth switching for windowed mode isn't implemented yet.
Palette handling isn't implemented in windowed mode yet.
Command-line arguments dialog is not implemented yet.
Fullscreen drawing has some artifacts.
Fullscreen OpenGL for the software renderer is broken.
Some OpenGL parameters are not accounted for, for example color bits customization.
Continuous mouse motion perhaps is not as smooth as it should be.
SDL_WM_GrabInput() is implemented, but it "freezes" the hardware
cursor in the center of the window/screen. Also, mouse moved events
are not generated, and the keyboard cannot be grabbed.
Mac OS X seems to have a broken pthread_cancel() implementation.
Actually, it just only has one cancellation point defined.
http://lists.apple.com/archives/darwin-development/2004/Jun/24/killingapthread.001.txt
FreeBSD:
pthread_cancel() isn't supported by FreeBSD 3.X, so threads don't
work on versions of FreeBSD earlier than 4.0.
The CD-ROM handling doesn't work completely.
Wide UNICODE character input (Kanji, etc.) is not yet supported.
It requires handling of keyboard mapping events and using the XIM
input translation extension. I will implement it as requested.
Latin-1 keyboard input works fine.
(UPDATE 04/06/2004: this bug is now fixed but needs testing)
The keyboard modifiers are not set to the correct state on startup.
Solaris:
The joystick functions are not implemented yet.
Wide UNICODE character input (Kanji, etc.) is not yet supported.
It requires handling of keyboard mapping events and using the XIM
input translation extension. I will implement it as requested.
Latin-1 keyboard input works fine.
(UPDATE 04/06/2004: this bug is now fixed but needs testing)
The keyboard modifiers are not set to the correct state on startup.
IRIX:
The CD-ROM handling doesn't work completely.
The joystick functions are not implemented yet.
Wide UNICODE character input (Kanji, etc.) is not yet supported.
It requires handling of keyboard mapping events and using the XIM
input translation extension. I will implement it as requested.
Latin-1 keyboard input works fine.
(UPDATE 04/06/2004: this bug is now fixed but needs testing)
The keyboard modifiers are not set to the correct state on startup.
EPOC:
Only Crystal version of Epoc/SymbianOS is currently supported.
SDL is implemented in static library only. SDL uses static/global
variables and that is not allowed in EPOC dll libraries.
Sound is not yet supported.
Joystick, OpenGL and cdrom is not supported (think about cdrom in a cell phone:-).
No console output screen. Printing to stdout do not have any effect.
QNX:
Fullscreen switch doesn't work (disabled for now).
OpenBSD: -= NOT YET SUPPORTED =-
This is reported to work, but I haven't verified this.
Wide UNICODE character input (Kanji, etc.) is not yet supported.
It requires handling of keyboard mapping events and using the XIM
input translation extension. I will implement it as requested.
Latin-1 keyboard input works fine.
(UPDATE 04/06/2004: this bug is now fixed but needs testing)
The keyboard modifiers are not set to the correct state on startup.
OSF/Tru64: -= NOT YET SUPPORTED =-
The audio functions are not implemented yet.
Joysticks and CD-ROM functions are not implemented yet.
Wide UNICODE character input (Kanji, etc.) is not yet supported.
It requires handling of keyboard mapping events and using the XIM
input translation extension. I will implement it as requested.
Latin-1 keyboard input works fine.
(UPDATE 04/06/2004: this bug is now fixed but needs testing)
The keyboard modifiers are not set to the correct state on startup.
AIX: -= NOT YET SUPPORTED =-
This port has only been tested with AIX 4.3.3
The OpenGL support doesn't work yet.
The joystick subsystem isn't implemented yet.
Endian detection doesn't work yet - needs a unique CPP symbol.
Wide UNICODE character input (Kanji, etc.) is not yet supported.
It requires handling of keyboard mapping events and using the XIM
input translation extension. I will implement it as requested.
Latin-1 keyboard input works fine.
(UPDATE 04/06/2004: this bug is now fixed but needs testing)
The keyboard modifiers are not set to the correct state on startup.
The AIX port was done by Carsten.Griwodz@KOM.tu-darmstadt.de
More information on this port is available at:
http://www.kom.e-technik.tu-darmstadt.de/~griff/SDL/
AmigaOS: -= NOT YET SUPPORTED =-
The OpenGL support isn't implemented yet.
SDL_WM_GrabInput() is not implemented.
Does anyone know how to do this? SDL_WM_GrabInput() is designed
to prevent the user from switching input and mouse focus away from
the SDL application.
Continuous relative mouse motion is not implemented.
The AmigaOS port was done by Gabriele.Greco@galactica.it

View file

@ -40,6 +40,8 @@ Thanks to everyone who made this possible, including:
* Hannu Viitala for the EPOC port
* Marcus Mertama for the S60 port.
* Peter Valchev for nagging me about the OpenBSD port until I got it right. :)
* Kent B Mein, for a place to do the IRIX port

Binary file not shown.

63
Makefile.ds Normal file
View file

@ -0,0 +1,63 @@
#LibSDL 1.2.12
#DS porting by Troy Davis(GPF)
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
endif
ifeq ($(strip $(DEVKITARM)),)
DEVKITARM := $(DEVKITPRO)/devkitARM
endif
SRCS = $(shell echo ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/events/*.c ./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c ./src/joystick/*.c ./src/joystick/nds/*.c ./src/cdrom/dummy/*.c ./src/thread/generic/*.c ./src/timer/nds/*.c ./src/loadso/dummy/*.c ./src/audio/dummy/*.c ./src/audio/nds/*.c ./src/video/dummy/*.c ./src/video/nds/*.c)
OBJS = $(SRCS:.c=.o)
SUBDIRS=
CC=arm-eabi-gcc
CXX=arm-eabi-g++
LDSHARED=$(CXX)
AR=arm-eabi-ar rc
RANLIB=arm-eabi-ranlib
CFLAGS = -mthumb -mthumb-interwork \
-march=armv5te -mtune=arm946e-s \
-O2 -Wall -Wwrite-strings -Wpointer-arith \
-DARM9 -D__NDS__ -I$(DEVKITPRO)/libnds/include -Iinclude
CXXFLAGS += $(CFLAGS)
all: $(DEVKITPRO)/libnds/lib/libSDL.a
$(DEVKITPRO)/libnds/lib/libSDL.a: $(OBJS)
$(AR) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
clean:
find . -name "*.o" |xargs rm -f
find . -name "*.d" |xargs rm -f
-rm -f *.elf
-rm -f *.nds
-rm -f *.gba
-rm -f *.arm9
-rm -f *.map
-rm -f *.img
-rm -Rf *.d
subdirs: $(patsubst %, _dir_%, $(SUBDIRS))
$(patsubst %, _dir_%, $(SUBDIRS)):
$(MAKE) -C $(patsubst _dir_%, %, $@)
clean_subdirs: $(patsubst %, _clean_dir_%, $(SUBDIRS))
$(patsubst %, _clean_dir_%, $(SUBDIRS)):
$(MAKE) -C $(patsubst _clean_dir_%, %, $@) clean
#include $(DEVKITARM)/ds_rules

View file

@ -6,11 +6,12 @@ objects = build
depend = build-deps
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = $(DESTDIR)@bindir@
libdir = $(DESTDIR)@libdir@
includedir = $(DESTDIR)@includedir@
datadir = $(DESTDIR)@datadir@
mandir = $(DESTDIR)@mandir@
bindir = @bindir@
libdir = @libdir@
includedir = @includedir@
datarootdir = @datarootdir@
datadir = @datadir@
mandir = @mandir@
auxdir = @ac_aux_dir@
distpath = $(srcdir)/..
distdir = SDL-@SDL_VERSION@
@ -29,6 +30,7 @@ INSTALL = @INSTALL@
NASM = @NASM@ @NASMFLAGS@
AR = @AR@
RANLIB = @RANLIB@
WINDRES = @WINDRES@
TARGET = libSDL.la
SOURCES = @SOURCES@
@ -38,13 +40,15 @@ SDLMAIN_TARGET = libSDLmain.a
SDLMAIN_SOURCES = @SDLMAIN_SOURCES@
SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@
DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html EpocBuildFiles.zip include INSTALL Makefile.dc Makefile.minimal Makefile.in MPWmake.sea.bin README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom-OS2.zip Watcom-Win32.zip WhatsNew Xcode.tar.gz
DIST = acinclude.m4 autogen.sh Borland.html Borland.zip BUGS build-scripts configure configure.in COPYING CREDITS CWprojects.sea.bin docs docs.html include INSTALL Makefile.dc Makefile.minimal Makefile.in MPWmake.sea.bin README* sdl-config.in sdl.m4 sdl.pc.in SDL.qpg.in SDL.spec SDL.spec.in src test TODO VisualCE.zip VisualC.html VisualC.zip Watcom-OS2.zip Watcom-Win32.zip WhatsNew Xcode.tar.gz
HDRS = SDL.h SDL_active.h SDL_audio.h SDL_byteorder.h SDL_cdrom.h SDL_cpuinfo.h SDL_endian.h SDL_error.h SDL_events.h SDL_getenv.h SDL_joystick.h SDL_keyboard.h SDL_keysym.h SDL_loadso.h SDL_main.h SDL_mouse.h SDL_mutex.h SDL_name.h SDL_opengl.h SDL_platform.h SDL_quit.h SDL_rwops.h SDL_stdinc.h SDL_syswm.h SDL_thread.h SDL_timer.h SDL_types.h SDL_version.h SDL_video.h begin_code.h close_code.h
LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_RELEASE = @LT_RELEASE@
LT_REVISION = @LT_REVISION@
LT_LDFLAGS = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
@ -80,51 +84,49 @@ $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS)
install: all install-bin install-hdrs install-lib install-data install-man
install-bin:
$(SHELL) $(auxdir)/mkinstalldirs $(bindir)
$(INSTALL) -m 755 sdl-config $(bindir)/sdl-config
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(bindir)
$(INSTALL) -m 755 sdl-config $(DESTDIR)$(bindir)/sdl-config
install-hdrs:
$(SHELL) $(auxdir)/mkinstalldirs $(includedir)/SDL
for src in $(srcdir)/include/*.h; do \
file=`echo $$src | sed -e 's|^.*/||'`; \
$(INSTALL) -m 644 $$src $(includedir)/SDL/$$file; \
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(includedir)/SDL
for file in $(HDRS); do \
$(INSTALL) -m 644 $(srcdir)/include/$$file $(DESTDIR)$(includedir)/SDL/$$file; \
done
$(INSTALL) -m 644 include/SDL_config.h $(includedir)/SDL/SDL_config.h
install-lib:
$(SHELL) $(auxdir)/mkinstalldirs $(libdir)
$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(libdir)/$(TARGET)
$(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(libdir)/$(SDLMAIN_TARGET)
$(RANLIB) $(libdir)/$(SDLMAIN_TARGET)
$(INSTALL) -m 644 include/SDL_config.h $(DESTDIR)$(includedir)/SDL/SDL_config.h
install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)
$(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET)
$(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
$(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
install-data:
$(SHELL) $(auxdir)/mkinstalldirs $(datadir)/aclocal
$(INSTALL) -m 644 $(srcdir)/sdl.m4 $(datadir)/aclocal/sdl.m4
$(SHELL) $(auxdir)/mkinstalldirs $(libdir)/pkgconfig
$(INSTALL) -m 644 sdl.pc $(libdir)/pkgconfig
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal
$(INSTALL) -m 644 $(srcdir)/sdl.m4 $(DESTDIR)$(datadir)/aclocal/sdl.m4
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir)/pkgconfig
$(INSTALL) -m 644 sdl.pc $(DESTDIR)$(libdir)/pkgconfig
install-man:
$(SHELL) $(auxdir)/mkinstalldirs $(mandir)/man3
$(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(mandir)/man3
for src in $(srcdir)/docs/man3/*.3; do \
file=`echo $$src | sed -e 's|^.*/||'`; \
$(INSTALL) -m 644 $$src $(mandir)/man3/$$file; \
$(INSTALL) -m 644 $$src $(DESTDIR)$(mandir)/man3/$$file; \
done
uninstall: uninstall-bin uninstall-hdrs uninstall-lib uninstall-data uninstall-man
uninstall-bin:
rm -f $(bindir)/sdl-config
rm -f $(DESTDIR)$(bindir)/sdl-config
uninstall-hdrs:
for src in $(srcdir)/include/*.h; do \
file=`echo $$src | sed -e 's|^.*/||'`; \
rm -f $(includedir)/SDL/$$file; \
for file in $(HDRS); do \
rm -f $(DESTDIR)$(includedir)/SDL/$$file; \
done
rm -f $(includedir)/SDL/SDL_config.h
-rmdir $(includedir)/SDL
rm -f $(DESTDIR)$(includedir)/SDL/SDL_config.h
-rmdir $(DESTDIR)$(includedir)/SDL
uninstall-lib:
$(LIBTOOL) --mode=uninstall rm -f $(libdir)/$(TARGET)
rm -f $(libdir)/$(SDLMAIN_TARGET)
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(TARGET)
rm -f $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET)
uninstall-data:
rm -f $(datadir)/aclocal/sdl.m4
rm -f $(DESTDIR)$(datadir)/aclocal/sdl.m4
uninstall-man:
for src in $(srcdir)/docs/man3/*.3; do \
file=`echo $$src | sed -e 's|^.*/||'`; \
rm -f $(mandir)/man3/$$file; \
rm -f $(DESTDIR)$(mandir)/man3/$$file; \
done
clean:
@ -169,10 +171,9 @@ rpm: $(distfile)
# Create a SVN snapshot that people can run update on
snapshot:
svn co svn://libsdl.org/trunk/SDL
(cd SDL && ./autogen.sh && rm -rf autom4te.cache)
cp SDL/include/SDL_config.h.default SDL/include/SDL_config.h
mv SDL SDL-1.2
svn co http://svn.libsdl.org/branches/SDL-1.2
(cd SDL-1.2 && ./autogen.sh && rm -rf autom4te.cache)
cp SDL-1.2/include/SDL_config.h.default SDL-1.2/include/SDL_config.h
tar zcf $(HOME)/SDL-1.2.tar.gz SDL-1.2
rm -f $(HOME)/SDL-1.2.zip
zip -r $(HOME)/SDL-1.2.zip SDL-1.2

9
README
View file

@ -12,10 +12,11 @@ This is the Simple DirectMedia Layer, a general API that provides low
level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL,
and 2D framebuffer across multiple platforms.
The current version supports Linux, Windows, Windows CE, BeOS, MacOS,
Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX, and QNX.
The code contains support for AmigaOS, Dreamcast, Atari, AIX, OSF/Tru64,
RISC OS, SymbianOS, and OS/2, but these are not officially supported.
The current version supports Linux, Windows CE/95/98/ME/XP/Vista, BeOS,
MacOS Classic, Mac OS X, FreeBSD, NetBSD, OpenBSD, BSD/OS, Solaris, IRIX,
and QNX. The code contains support for Dreamcast, Atari, AIX, OSF/Tru64,
RISC OS, SymbianOS, Nintendo DS, and OS/2, but these are not officially
supported.
SDL is written in C, but works with C++ natively, and has bindings to
several other languages, including Ada, C#, Eiffel, Erlang, Euphoria,

View file

@ -1,50 +1,12 @@
This is the porting of 1.2.0 version of SDL (the latest stable one)
to AmigaOS/68k.
The AmigaOS code has been removed from SDL, since it had been broken for a
long time and had a few bits of fairly invasive code #ifdef'd into the
SDL core.
All the bugs known of the past version have been corrected. And I've
added all the new SDL features.
However, there is an OS4 version of SDL here:
http://www.rcdrummond.net/amiga/index.html
This version of SDL needs Cybergraphx V3 (r69+) or CyberGraphX V4
and AHI v3+. Probably it works also with P96 or CGXAga, but it's
untested.
And a MorphOS version here:
http://www.lehtoranta.net/powersdl/
This version is available as linked library for SAS/C and GCC, only 68k this
time, a powerup (ppcemu compatible) and a morphos version will be ready quite
soon (i hope).
--ryan.
Implemented:
- 8/16/24/32bit video modes, both fullscreen and windowed.
- Hardware surfaces.
- CGX blitting acceleration.
- CGX colorkey blitting acceleration.
- AHI audio (8/16 bit, with any audio format), always uses unit 0 for now.
- Thread support (maybe not 100% compatible with other implementations)
- Semaphores
- Window resizing and backdrop windows (NEW)
- Joystick/Joypad support.
To do:
- CDRom audio playing support
- OpenGL (A guy was working on it but I've lost his tracks :( )
The SAS/C library is distributed with debug info attached, to strip debug info
simply add STRIPDEBUG argument to the linker.
NOTE: SDL includes debug output using kprintf, to disable it add to your
project a function like this:
void kprintf(char *a,...)
{
}
Otherwise you can redirect the debug to a console window with sushi, sashimi or
similar tools (the default output is the internal serial port).
For info, support, bugfix and other feel free to mail me:
Gabriele Greco (gabriele.greco@aruba.it)
You can find also a small SDL Amiga page at:
http://ggreco.interfree.it/sdl.html

View file

@ -1,75 +0,0 @@
==============================================================================
Using the Simple DirectMedia Layer with EPOC/SymbianOS 6.0
==============================================================================
==============================================================================
I. Building the Simple DirectMedia Layer libraries:
You can get Symbian SDK from:
http://www.symbian.com.
First create "Epoc" directory under SDL main directory and unpack
EpocBuildFiles.zip in it.
To build the librarys goto "epoc" directory and type:
bldmake bldfiles
abld makefile vc6 (for creating Microsoft Visual C++ makefiles)
abld build wins udeb (building for wins emulator)
abld build armi urel (building for real device)
==============================================================================
II. Building the Simple DirectMedia Layer programs:
Building SDL test programs is easy once you have built the libraries:
abld test build wins udeb
abld test build armi urel
Supported real screen resolutions
320 x 200 x 8 bit
320 x 200 x 12 bit
640 x 200 x 8 bit
640 x 200 x 12 bit
Supported "emulated" screen resolutions
640 x 400 x 8 bit
640 x 400 x 12 bit
640 x 480 x 8 bit
640 x 480 x 12 bit
"Emulated" resolutions are implemented by by shrinking the screen vertically
i.e. only every second scanline is drawn. This is mainly ment to be used for
testing quick ports of programs. Using faked resolutions is a waste of memory
and cpu power!
==============================================================================
III. Running test programs
Copy executable to the device and run it from the File manager. The Esc
key quits demo programs. In Crystal, Exe programs do not appear in task list
nor in Extras :-(. Test programs are tested in Nokia 9210 Communicator.
Special keys used in SDL:
The Caps lock key enables or disables the virtual cursor.
Function keys are mapped as follows:
F1=chr+q, F2=chr+w,..., F8=chr+i,
F9=chr+a,..., F12=chr+d.
==============================================================================
IV. Enjoy! :)
If you have a project you'd like me to know about, or want to ask questions,
go ahead and join the SDL developer's mailing list by sending e-mail to:
sdl-request@libsdl.org
and put "subscribe" into the subject of the message. Or alternatively you
can use the web interface:
http://www.libsdl.org/mailman/listinfo/sdl
You can find more info about Epoc version of SDL from Hannu Viitala's
homepage
http://www.mbnet.fi/~haviital
==============================================================================

View file

@ -68,14 +68,14 @@ OpenGL (using Mesa offscreen rendering driver)
- Dependent driver combinations:
Video Kbd Mouse Timer Joysticks
xbios ikbd ikbd vbl(2) ikbd
xbios gemdos xbios vbl(2) xbios(3)
xbios bios xbios vbl(2) xbios(3)
gem gem gem(1) vbl(2) xbios(3)
xbios gemdos xbios vbl(2) xbios
xbios bios xbios vbl(2) xbios
gem gem gem(1) vbl(2) xbios
Audio O/S Misc
dma8 All Uses MFP Timer A interrupt
xbios TOS Uses MFP Timer A interrupt
xbios MiNT Uses MiNT thread
xbios MiNT Uses MFP Timer A interrupt
xbios Magic Disabled
stfa All Uses MFP interrupt
mcsn TOS Uses MFP Timer A interrupt
@ -87,16 +87,13 @@ Joypad driver always uses hardware access.
OpenGL driver always uses OSMesa.
(1) GEM does not report relative mouse motion, so xbios mouse driver is used
to report this type event. Under MiNT, using XBIOS mouse driver is not possible.
to report this type event.
A preliminary driver for /dev/mouse device driver is present, but is disabled
till it can be used with other applications simultaneously.
(2) If you build SDL with threads using the GNU pth library, timers are
supported via the pth library.
(3) Redirecting XBIOS vectors does not work under MiNT, so it is disabled in
this case.
==============================================================================
V. Environment variables:
@ -127,12 +124,12 @@ SDL_JOYSTICK_ATARI:
'ikbd-joy1-[on|off]' for IKBD joystick on port 1 (hardware access)
'xbios-joy1-[on|off]' for IKBD joystick on port 1 (xbios access)
'porta-pad-[on|off]' for joypad on port A
'porta-pad-[on|off]' for joypad and/or teamtap on port A
'porta-joy0-[on|off]' for joystick 0 on port A
'porta-joy1-[on|off]' for joystick 1 on port A
'porta-lp-[on|off]' for lightpen on port A
'porta-anpad-[on|off]' for analog paddle on port A
'portb-pad-[on|off]' for joypad on port B
'portb-pad-[on|off]' for joypad and/or teamtap on port B
'portb-joy0-[on|off]' for joystick 0 on port B
'portb-joy1-[on|off]' for joystick 1 on port B
'portb-anpad-[on|off]' for analog paddle on port B
@ -213,7 +210,7 @@ Mouse and joystick xbios driver:
Available on all machines (I think).
Joypad driver:
Available if _MCH cookie is STE or Falcon.
Available if _MCH cookie is STE or Falcon. Supports teamtap.
PTH timer driver:
Available with multitasking OS.

22
README.NDS Normal file
View file

@ -0,0 +1,22 @@
The SDL port to the Nintendo DS
This port uses the devKitPro toolchain, available from:
http://www.devkitpro.org
Precompiled tools for cross-compiling on Linux are available from:
http://www.libsdl.org/extras/nds/devkitPro-20070503-linux.tar.gz
todo:
add ds console specific features/optimizations
mouse/keyboard support
dual screen support
build with:
cp include/SDL_config_nds.h include/SDL_config.h
make -f Makefile.ds
included is an arm9/arm7 template to allow for sound streaming support.
Enjoy, fix the source and share :)
Troy Davis(GPF)
http://gpf.dcemu.co.uk/

View file

@ -7,7 +7,7 @@ at the Subversion website ( http://subversion.tigris.org/ ) for more
information on using svn, where you can also download software for
MacOS, Windows, and Unix systems.
svn checkout svn://libsdl.org/trunk/SDL
svn checkout http://svn.libsdl.org/branches/SDL-1.2
If you are building SDL with an IDE, you will need to copy the file
include/SDL_config.h.default to include/SDL_config.h before building.

23
README.Symbian Normal file
View file

@ -0,0 +1,23 @@
==============================================================================
Using the Simple DirectMedia Layer with S60 3.x / Symbian 9.x
==============================================================================
These instuctions are for people developing for S60 3.x. S60 3.x
uses Symbian OS so you need S60 SDK.
extract "symbian.zip" into this folder.
go to symbian folder
bldmake bldfiles
abld build
That produces WINSCW and ARMV5 versions of sdl.dll runtime library
and sdl.lib for development.
The sdlexe.dll/sdlexe.lib and sdlmain.lib are for easy SDL S60
integration, please see http://www.mbnet.fi/~mertama/sdl.html
for further info.

View file

@ -54,7 +54,7 @@ make install prefix=$RPM_BUILD_ROOT%{prefix} \
includedir=$RPM_BUILD_ROOT%{_includedir} \
datadir=$RPM_BUILD_ROOT%{_datadir} \
mandir=$RPM_BUILD_ROOT%{_mandir}
ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT%{prefix}/lib/libSDL-1.1.so.0
ln -s libSDL-1.2.so.0 $RPM_BUILD_ROOT%{_libdir}/libSDL-1.1.so.0
%else
%makeinstall
%endif

View file

@ -45,6 +45,10 @@
This is done by right clicking on each project in turn (Projects are listed in
the Workspace panel in the FileView tab), and selecting "Build".
</P>
<P>
If you get an error about SDL_config.h being missing, you should
copy include/SDL_config.h.default to include/SDL_config.h and try again.
</P>
<P>
You may get a few warnings, but you should not get any errors. You do have to
have at least the DirectX 5 SDK installed, however. The latest

Binary file not shown.

View file

@ -3,6 +3,10 @@ This is a list of API changes in SDL's version history.
Version 1.0:
1.2.12:
Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling
of the screensaver on Mac OS X and X11.
1.2.10:
If SDL_OpenAudio() is passed zero for the desired format
fields, the following environment variables will be used

View file

@ -48,7 +48,7 @@ CPPFLAGS_X86="-DMAC_OS_X_VERSION_MIN_REQUIRED=1040 \
# Intel linker flags
LFLAGS_X86="-arch i386 -mmacosx-version-min=10.4 \
-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.0 \
-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1 \
-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk"
#

View file

@ -41,7 +41,11 @@ search_deps()
for src in $SOURCES
do echo "Generating dependencies for $src"
ext=`echo $src | sed 's|.*\.\(.*\)|\1|'`
obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.lo|g"`
if test x"$ext" = x"rc"; then
obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.o|g"`
else
obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.lo|g"`
fi
echo "\$(objects)/$obj: $src \\" >>${output}.new
search_deps $src | sort | uniq >>${output}.new
case $ext in
@ -73,6 +77,12 @@ __EOF__
\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
__EOF__
;;
rc) cat >>${output}.new <<__EOF__
\$(WINDRES) $src \$@
__EOF__
;;
*) echo "Unknown file extension: $ext";;

View file

@ -16,9 +16,9 @@ dnl Set various version strings - taken gratefully from the GTk sources
#
SDL_MAJOR_VERSION=1
SDL_MINOR_VERSION=2
SDL_MICRO_VERSION=11
SDL_INTERFACE_AGE=0
SDL_BINARY_AGE=11
SDL_MICRO_VERSION=12
SDL_INTERFACE_AGE=1
SDL_BINARY_AGE=12
SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
AC_SUBST(SDL_MAJOR_VERSION)
@ -74,8 +74,8 @@ BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
BUILD_LDFLAGS="$LDFLAGS"
EXTRA_LDFLAGS="$BASE_LDFLAGS"
# I can't remember why I added this. I'm sure it'll come to me...
#for path in /usr/local; do
## These are common directories to find software packages
#for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
# if test -d $path/include; then
# EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
# fi
@ -96,6 +96,12 @@ AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_MAKE_SET
if test -z "$host_alias"; then
hostaliaswindres=
else
hostaliaswindres="$host_alias-windres"
fi
AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
dnl Check for compiler characteristics
AC_C_CONST
@ -124,7 +130,14 @@ if test x$enable_libc = xyes; then
fi
dnl Checks for library functions.
AC_FUNC_ALLOCA
case "$host" in
*-*-cygwin* | *-*-mingw32*)
;;
*)
AC_FUNC_ALLOCA
;;
esac
AC_FUNC_MEMCMP
if test x$ac_cv_func_memcmp_working = xyes; then
AC_DEFINE(HAVE_MEMCMP)
@ -189,7 +202,6 @@ SOURCES="$SOURCES $srcdir/src/cdrom/*.c"
SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
SOURCES="$SOURCES $srcdir/src/events/*.c"
SOURCES="$SOURCES $srcdir/src/file/*.c"
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
SOURCES="$SOURCES $srcdir/src/thread/*.c"
SOURCES="$SOURCES $srcdir/src/timer/*.c"
@ -220,6 +232,8 @@ AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes
, enable_joystick=yes)
if test x$enable_joystick != xyes; then
AC_DEFINE(SDL_JOYSTICK_DISABLED)
else
SOURCES="$SOURCES $srcdir/src/joystick/*.c"
fi
AC_ARG_ENABLE(cdrom,
AC_HELP_STRING([--enable-cdrom], [Enable the cdrom subsystem [[default=yes]]]),
@ -451,6 +465,63 @@ AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[defa
fi
}
dnl Find PulseAudio
CheckPulseAudio()
{
AC_ARG_ENABLE(pulseaudio,
AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
, enable_pulse=yes)
if test x$enable_audio = xyes -a x$enable_pulse = xyes; then
audio_pulse=no
PULSE_REQUIRED_VERSION=0.9
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
AC_MSG_CHECKING(for PulseAudio $PULSE_REQUIRED_VERSION support)
if test x$PKG_CONFIG != xno; then
if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSE_REQUIRED_VERSION libpulse-simple; then
PULSE_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
PULSE_LIBS=`$PKG_CONFIG --libs libpulse-simple`
audio_pulse=yes
fi
fi
AC_MSG_RESULT($audio_pulse)
if test x$audio_pulse = xyes; then
AC_ARG_ENABLE(pulseaudio-shared,
AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
, enable_pulse_shared=yes)
if test "x`echo $PULSE_LIBS | grep -- -L`" = "x"; then
if test "x`ls /lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
PULSE_LIBS="-L/lib $PULSE_LIBS"
elif test "x`ls /usr/lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
PULSE_LIBS="-L/usr/lib $PULSE_LIBS"
elif test "x`ls /usr/local/lib/libpulse-simple.so.* 2> /dev/null`" != "x"; then
PULSE_LIBS="-L/usr/local/lib $PULSE_LIBS"
fi
fi
pulse_lib_spec=`echo $PULSE_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libpulse-simple.so.*/'`
pulse_lib=`ls -- $pulse_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
echo "-- $pulse_lib_spec -> $pulse_lib"
AC_DEFINE(SDL_AUDIO_DRIVER_PULSE)
SOURCES="$SOURCES $srcdir/src/audio/pulse/*.c"
EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSE_CFLAGS"
if test x$have_loadso != xyes && \
test x$enable_pulse_shared = xyes; then
AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
fi
if test x$have_loadso = xyes && \
test x$enable_pulse_shared = xyes && test x$pulse_lib != x; then
AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSE_DYNAMIC, "$pulse_lib")
else
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSE_LIBS"
fi
have_audio=yes
fi
fi
}
CheckARTSC()
{
AC_ARG_ENABLE(arts,
@ -511,21 +582,25 @@ CheckNAS()
AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
, enable_nas=yes)
if test x$enable_audio = xyes -a x$enable_nas = xyes; then
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -lXt -lm"
AC_CHECK_HEADER(audio/audiolib.h, have_audio_hdr=yes)
AC_CHECK_LIB(audio, AuOpenServer, have_audio_lib=yes)
AC_CHECK_HEADER(nas/audiolib.h, have_nas_hdr=yes)
AC_CHECK_LIB(nas, AuOpenServer, have_nas_lib=yes)
LDFLAGS="$save_LDFLAGS"
AC_MSG_CHECKING(for NAS audio support)
have_nas=no
if test -r /usr/X11R6/include/audio/audiolib.h; then
if test x$have_audio_hdr = xyes -a x$have_audio_lib = xyes; then
have_nas=yes
NAS_CFLAGS="-I/usr/X11R6/include/"
NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
dnl On IRIX, the NAS includes are in a different directory,
dnl and libnas must be explicitly linked in
elif test -r /usr/freeware/include/nas/audiolib.h; then
NAS_LIBS="-laudio -lXt"
elif test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
have_nas=yes
NAS_LIBS="-lnas -lXt"
fi
fi
AC_MSG_RESULT($have_nas)
if test x$have_nas = xyes; then
AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
@ -597,38 +672,56 @@ CheckNASM()
AC_HELP_STRING([--enable-nasm], [use nasm assembly blitters on x86 [[default=yes]]]),
, enable_nasm=yes)
if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_nasm = xyes; then
CompileNASM()
{
# Usage: CompileNASM <filename>
AC_MSG_CHECKING(to see if $NASM supports $1)
if $NASM $NASMFLAGS $1 -o $1.o >&AS_MESSAGE_LOG_FD 2>&1; then
CompileNASM_ret="yes"
else
CompileNASM_ret="no"
fi
rm -f $1 $1.o
AC_MSG_RESULT($CompileNASM_ret)
test "$CompileNASM_ret" = "yes"
}
if test x"$NASMFLAGS" = x; then
case $ARCH in
win32)
NASMFLAGS="-f win32"
;;
openbsd)
NASMFLAGS="-f aoutb"
;;
macosx)
NASMFLAGS="-f macho"
;;
*)
NASMFLAGS="-f elf"
;;
esac
fi
AC_PATH_PROG(NASM, yasm)
echo "%ifidn __OUTPUT_FORMAT__,elf" > unquoted-sections
echo "section .note.GNU-stack noalloc noexec nowrite progbits" >> unquoted-sections
echo "%endif" >> unquoted-sections
CompileNASM unquoted-sections || NASM=""
if test "x$NASM" = x -o "x$NASM" = x'"$NASM"'; then
$as_unset ac_cv_path_NASM
AC_PATH_PROG(NASM, nasm)
fi
if test "x$NASM" != x -a "x$NASM" != x'"$NASM"'; then
AC_DEFINE(SDL_HERMES_BLITTERS)
SOURCES="$SOURCES $srcdir/src/hermes/*.asm"
if test x"$NASMFLAGS" = x; then
case $ARCH in
win32)
NASMFLAGS="-f win32"
;;
openbsd)
NASMFLAGS="-f aoutb"
;;
macosx)
NASMFLAGS="-f macho"
;;
*)
NASMFLAGS="-f elf"
;;
esac
fi
NASMFLAGS="$NASMFLAGS -i $srcdir/src/hermes/"
NASMFLAGS="$NASMFLAGS -I $srcdir/src/hermes/"
dnl See if hidden visibility is supported
echo "GLOBAL _bar:function hidden" > nasm_vis.asm
echo "_bar:" >>nasm_vis.asm
if $NASM $NASMFLAGS nasm_vis.asm -o nasm_vis.o >&AS_MESSAGE_LOG_FD 2>&1; then
NASMFLAGS="$NASMFLAGS -DHIDDEN_VISIBILITY"
fi
rm -f nasm_vis.asm nasm_vis.o
echo "GLOBAL _bar:function hidden" > symbol-visibility
echo "_bar:" >> symbol-visibility
CompileNASM symbol-visibility && NASMFLAGS="$NASMFLAGS -DHIDDEN_VISIBILITY"
AC_SUBST(NASM)
AC_SUBST(NASMFLAGS)
@ -844,7 +937,7 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma
x11ext_lib='libXext.so'
;;
*)
x11_lib_spec=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1/'`]
x11_lib_path=[`echo $X_LIBS | sed 's/.*-L\([^ ]*\).*/\1/'`]
for path in $x11_lib_path /usr/lib /usr/X11/lib /usr/X11R6/lib; do
if test "x$x11_lib" = "x"; then
x11_lib=[`ls -- $path/libX11.so.[0-9] 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
@ -1118,6 +1211,7 @@ AC_HELP_STRING([--enable-video-fbcon], [use framebuffer console video driver [[d
])
AC_MSG_RESULT($video_fbcon)
if test x$video_fbcon = xyes; then
AC_CHECK_FUNCS(getpagesize)
AC_DEFINE(SDL_VIDEO_DRIVER_FBCON)
SOURCES="$SOURCES $srcdir/src/video/fbcon/*.c"
have_video=yes
@ -1466,6 +1560,7 @@ CheckOpenGLX11()
AC_TRY_COMPILE([
#include <GL/gl.h>
#include <GL/glx.h>
#include <GL/glu.h>
],[
],[
video_opengl=yes
@ -1676,7 +1771,7 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]])
;;
*-*-netbsd*)
pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
pthread_lib="-L/usr/lib -lpthread"
pthread_lib="-lpthread"
;;
*-*-openbsd*)
pthread_cflags="-D_REENTRANT"
@ -2019,8 +2114,13 @@ CheckUSBHID()
#if defined(HAVE_USB_H)
#include <usb.h>
#endif
#ifdef __DragonFly__
#include <bus/usb/usb.h>
#include <bus/usb/usbhid.h>
#else
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
#endif
#if defined(HAVE_USBHID_H)
#include <usbhid.h>
#elif defined(HAVE_LIBUSB_H)
@ -2141,6 +2241,7 @@ case "$host" in
CheckALSA
CheckARTSC
CheckESD
CheckPulseAudio
CheckNAS
CheckX11
CheckNANOX
@ -2278,7 +2379,7 @@ case "$host" in
ARCH=win32
if test "$build" != "$host"; then # cross-compiling
# Default cross-compile location
ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
ac_default_prefix=/usr/local/cross-tools/i386-mingw32
else
# Look for the location of the tools and install there
if test "$BUILD_PREFIX" != ""; then
@ -2341,6 +2442,7 @@ case "$host" in
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldxguid"
fi
# The Win32 platform requires special setup
SOURCES="$SOURCES $srcdir/src/main/win32/*.rc"
SDLMAIN_SOURCES="$srcdir/src/main/win32/*.c"
SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows"
@ -2417,10 +2519,7 @@ case "$host" in
CheckDiskAudio
CheckDummyAudio
CheckDLOPEN
# Temporarily disabled:
# ld: mmxp2_32.o has external relocation entries in non-writable section (__TEXT,__text) for symbols: _mmxreturn
#CheckNASM
CheckNASM
# Set up files for the shared object loading library
# (this needs to be done before the dynamic X11 check)
@ -2453,8 +2552,8 @@ case "$host" in
if test x$enable_joystick = xyes; then
AC_DEFINE(SDL_JOYSTICK_IOKIT)
SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
have_joystick=yes
need_iokit_framework=yes
fi
# Set up files for the cdrom library
if test x$enable_cdrom = xyes; then
@ -2474,6 +2573,7 @@ case "$host" in
SDL_LIBS="-lSDLmain $SDL_LIBS"
if test x$enable_video_cocoa = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
need_iokit_framework=yes
fi
if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
# The Cocoa backend still needs Carbon, and the YUV code QuickTime
@ -2484,6 +2584,10 @@ case "$host" in
if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
fi
# Some subsystems reference IOKit...
if test x$need_iokit_framework = xyes; then
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
fi
;;
*-*-mint*)
ARCH=mint
@ -2564,11 +2668,13 @@ case "$host" in
esac
# Verify that we have all the platform specific files we need
if test x$have_joystick != xyes; then
if test x$enable_joystick = xyes; then
AC_DEFINE(SDL_JOYSTICK_DISABLED)
fi
if test x$enable_joystick = xyes; then
if test x$have_joystick != xyes; then
# Wants joystick subsystem, but doesn't have a platform-specific backend...
AC_DEFINE(SDL_JOYSTICK_DUMMY)
SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
fi
fi
if test x$have_cdrom != xyes; then
if test x$enable_cdrom = xyes; then
@ -2603,6 +2709,7 @@ OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.lo,g'`
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.lo,g'`
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.S,$(objects)/\1.lo,g'`
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.cc,$(objects)/\1.o,g'`
SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.m,$(objects)/\1.o,g'`
@ -2612,10 +2719,10 @@ SDLMAIN_OBJECTS=`echo $SDLMAIN_OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects
if test "x$enable_rpath" = "xyes"; then
if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = irix -o $ARCH = linux -o $ARCH = netbsd; then
SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib"
SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
fi
if test $ARCH = solaris; then
SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
SDL_RLD_FLAGS="-R\${libdir}"
fi
else
SDL_RLD_FLAGS=""
@ -2630,7 +2737,7 @@ case "$ARCH" in
SDL_LIBS="$SDL_LIBS -Wl,-framework,Carbon"
fi
# Evil hack to allow static linking on Mac OS X
SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a $EXTRA_LDFLAGS"
SDL_STATIC_LIBS="\${libdir}/libSDLmain.a \${libdir}/libSDL.a $EXTRA_LDFLAGS"
;;
*)
SDL_STATIC_LIBS="$SDL_LIBS"
@ -2672,6 +2779,7 @@ AC_SUBST(BUILD_CFLAGS)
AC_SUBST(EXTRA_CFLAGS)
AC_SUBST(BUILD_LDFLAGS)
AC_SUBST(EXTRA_LDFLAGS)
AC_SUBST(WINDRES)
AC_OUTPUT([
Makefile sdl-config SDL.spec SDL.qpg sdl.pc

145
docs.html
View file

@ -14,6 +14,151 @@ The latest stable release may be found on the
<H2> <A HREF="docs/index.html">API Documentation</A> </H2>
<H2> SDL 1.2.12 Release Notes </H2>
<P>
SDL 1.2.12 is a minor bug fix release.
</P>
<H3> General Notes </H3>
<BLOCKQUOTE>
<P>
Added support for the PulseAudio sound server: http://www.pulseaudio.org/
</P>
<P>
Added SDL_VIDEO_ALLOW_SCREENSAVER to override SDL's disabling of the screensaver on Mac OS X, Windows, and X11.
</P>
<P>
Fixed buffer overrun crash when resampling audio rates.
</P>
<P>
Fixed audio bug where converting to mono was doubling the volume.
</P>
<P>
Fixed off-by-one error in the C implementation of SDL_revcpy()
</P>
<P>
Fixed compiling with Sun Studio.
</P>
<P>
Support for AmigaOS has been removed from the main SDL code.
</P>
<P>
Support for Nokia 9210 "EPOC" driver has been removed from the main SDL code.
</P>
<P>
Unofficial support for the S60/SymbianOS platform has been added.
</P>
<P>
Unofficial support for the Nintendo DS platform has been added.
</P>
<P>
Reenabled MMX assembly for YUV overlay processing (GNU C Compiler only).
</P>
</BLOCKQUOTE>
<H3> Unix Notes </H3>
<BLOCKQUOTE>
<P>
Fixed detection of X11 DGA mouse support.
</P>
<P>
Improved XIM support for asian character sets.
</P>
<P>
The GFX_Display has been added to the X11 window information in SDL_syswm.h.
</P>
<P>
Fixed PAGE_SIZE compile error in the fbcon video driver on newer Linux kernels.
</P>
<P>
Fixed hang or crash at startup if aRts can't access the hardware.
</P>
<P>
Fixed relative mouse mode when the cursor starts outside the X11 window.
</P>
<P>
Fixed accidental free of stack memory in X11 mouse acceleration code.
</P>
<P>
Closed minor memory leak in XME code.
</P>
<P>
Fixed TEXTRELs in the library to resolve some PIC issues.
</P>
</BLOCKQUOTE>
<H3> Windows Notes </H3>
<BLOCKQUOTE>
<P>
The GDI video driver makes better use of the palette in 8-bit modes.
</P>
<P>
The windib driver now supports more mouse buttons with WM_XBUTTON events.
</P>
<P>
On Windows, SDL_SetVideoMode() will re-create the window instead of failing if the multisample settings are changed.
</P>
<P>
Added support for UTF-8 window titles on Windows.
</P>
<P>
Fixed joystick detection on Windows.
</P>
<P>
Improved performance with Win32 file I/O.
</P>
<P>
Fixed HBITMAP leak in GAPI driver.
</P>
</BLOCKQUOTE>
<H3> Mac OS X Notes </H3>
<BLOCKQUOTE>
<P>
Added support for multi-axis controllers like 3Dconnxion's SpaceNavigator on Mac OS X.
</P>
<P>
Fixed YUV overlay crash inside Quicktime on Intel Mac OS X.
</P>
<P>
Fixed blitting alignment in Altivec alpha blit functions.
</P>
<P>
Keys F13, F14, and F15 are now usable on Apple keyboards under Mac OS X.
</P>
<P>
Fixed joystick calibration code on Mac OS X.
</P>
<P>
Fixed mouse jitter when multiple motion events are queued up in Mac OS X.
</P>
<P>
Fixed changing the cursor in fullscreen mode on Mac OS X.
</P>
</BLOCKQUOTE>
<H3> Mac OS Classic Notes </H3>
<BLOCKQUOTE>
<P>
Added support for gamma ramps to both toolbox and DrawSprocket video drivers.
</P>
</BLOCKQUOTE>
<H3> BeOS Notes </H3>
<BLOCKQUOTE>
<P>
Implemented mouse grabbing and mouse relative mode on BeOS.
</P>
</BLOCKQUOTE>
<IMG SRC="docs/images/rainbow.gif" ALT="[separator]" WIDTH="100%">
<H2> SDL 1.2.11 Release Notes </H2>
<P>
SDL 1.2.11 is a minor bug fix release.

View file

@ -436,21 +436,6 @@ ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="LITERAL"
>epoc</TT
></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
>(Epoc)</P
></TD
></TR
><TR
><TD
ALIGN="LEFT"
VALIGN="TOP"
><TT
CLASS="LITERAL"
>dummy</TT
></TD
><TD

View file

@ -102,7 +102,7 @@ CLASS="FUNCSYNOPSISINFO"
><CODE
><CODE
CLASS="FUNCDEF"
>void *<B
>void <B
CLASS="FSFUNC"
>SDL_SetCursor</B
></CODE
@ -219,4 +219,4 @@ VALIGN="top"
></DIV
></BODY
></HTML
>
>

View file

@ -5,7 +5,7 @@ SDL_SetCursor\- Set the currently active mouse cursor\&.
.PP
\fB#include "SDL\&.h"
.sp
\fBvoid *\fBSDL_SetCursor\fP\fR(\fBSDL_Cursor *cursor\fR);
\fBvoid \fBSDL_SetCursor\fP\fR(\fBSDL_Cursor *cursor\fR);
.SH "DESCRIPTION"
.PP
Sets the currently active cursor to the specified one\&. If the cursor is currently visible, the change will be immediately represented on the display\&.

View file

@ -26,14 +26,14 @@
#include "SDL_platform.h"
/* Add any platform that doesn't build using the configure system */
#if defined(__AMIGA__)
#include "SDL_config_amiga.h"
#elif defined(__DREAMCAST__)
#if defined(__DREAMCAST__)
#include "SDL_config_dreamcast.h"
#elif defined(__MACOS__)
#include "SDL_config_macos.h"
#elif defined(__MACOSX__)
#include "SDL_config_macosx.h"
#elif defined(__SYMBIAN32__)
#include "SDL_config_symbian.h" /* must be before win32! */
#elif defined(__WIN32__)
#include "SDL_config_win32.h"
#elif defined(__OS2__)

View file

@ -28,6 +28,11 @@
/* General platform specific identifiers */
#include "SDL_platform.h"
/* Make sure that this isn't included by Visual C++ */
#ifdef _MSC_VER
#error You should copy include/SDL_config.h.default to include/SDL_config.h
#endif
/* C language features */
#undef const
#undef inline
@ -130,6 +135,7 @@
#undef HAVE_NANOSLEEP
#undef HAVE_CLOCK_GETTIME
#undef HAVE_DLVSYM
#undef HAVE_GETPAGESIZE
#else
/* We may need some replacement for stdarg.h here */
@ -149,7 +155,6 @@
#undef SDL_VIDEO_DISABLED
/* Enable various audio drivers */
#undef SDL_AUDIO_DRIVER_AHI
#undef SDL_AUDIO_DRIVER_ALSA
#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
#undef SDL_AUDIO_DRIVER_ARTS
@ -163,6 +168,8 @@
#undef SDL_AUDIO_DRIVER_DUMMY
#undef SDL_AUDIO_DRIVER_DMEDIA
#undef SDL_AUDIO_DRIVER_DSOUND
#undef SDL_AUDIO_DRIVER_PULSE
#undef SDL_AUDIO_DRIVER_PULSE_DYNAMIC
#undef SDL_AUDIO_DRIVER_ESD
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
#undef SDL_AUDIO_DRIVER_MINT
@ -195,7 +202,6 @@
/* Enable various input drivers */
#undef SDL_INPUT_TSLIB
#undef SDL_JOYSTICK_AMIGA
#undef SDL_JOYSTICK_BEOS
#undef SDL_JOYSTICK_DC
#undef SDL_JOYSTICK_DUMMY
@ -221,10 +227,8 @@
#undef SDL_LOADSO_WIN32
/* Enable various threading systems */
#undef SDL_THREAD_AMIGA
#undef SDL_THREAD_BEOS
#undef SDL_THREAD_DC
#undef SDL_THREAD_EPOC
#undef SDL_THREAD_OS2
#undef SDL_THREAD_PTH
#undef SDL_THREAD_PTHREAD
@ -234,11 +238,9 @@
#undef SDL_THREAD_WIN32
/* Enable various timer systems */
#undef SDL_TIMER_AMIGA
#undef SDL_TIMER_BEOS
#undef SDL_TIMER_DC
#undef SDL_TIMER_DUMMY
#undef SDL_TIMER_EPOC
#undef SDL_TIMER_MACOS
#undef SDL_TIMER_MINT
#undef SDL_TIMER_OS2
@ -250,14 +252,12 @@
/* Enable various video drivers */
#undef SDL_VIDEO_DRIVER_AALIB
#undef SDL_VIDEO_DRIVER_BWINDOW
#undef SDL_VIDEO_DRIVER_CYBERGRAPHICS
#undef SDL_VIDEO_DRIVER_DC
#undef SDL_VIDEO_DRIVER_DDRAW
#undef SDL_VIDEO_DRIVER_DGA
#undef SDL_VIDEO_DRIVER_DIRECTFB
#undef SDL_VIDEO_DRIVER_DRAWSPROCKET
#undef SDL_VIDEO_DRIVER_DUMMY
#undef SDL_VIDEO_DRIVER_EPOC
#undef SDL_VIDEO_DRIVER_FBCON
#undef SDL_VIDEO_DRIVER_GAPI
#undef SDL_VIDEO_DRIVER_GEM

View file

@ -1,80 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifndef _SDL_config_amiga_h
#define _SDL_config_amiga_h
#include "SDL_platform.h"
/* This is a set of defines to configure the SDL features */
#define SDL_HAS_64BIT_TYPE 1
/* Useful headers */
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STRING_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_SIGNAL_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_PUTENV 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_AHI 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various cdrom drivers */
#define SDL_CDROM_DUMMY 1
/* Enable various input drivers */
#define SDL_JOYSTICK_AMIGA 1
/* Enable various shared object loading systems */
#define SDL_LOADSO_DUMMY 1
/* Enable various threading systems */
#define SDL_THREAD_AMIGA 1
/* Enable various timer systems */
#define SDL_TIMER_AMIGA 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_CYBERGRAPHICS 1
#define SDL_VIDEO_DRIVER_DUMMY 1
/* Enable OpenGL support */
#define SDL_VIDEO_OPENGL 1
#endif /* _SDL_config_amiga_h */

View file

@ -25,6 +25,9 @@
#include "SDL_platform.h"
/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
#include <AvailabilityMacros.h>
/* This is a set of defines to configure the SDL features */
#define SDL_HAS_64BIT_TYPE 1
@ -114,7 +117,7 @@
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1
#if TARGET_API_MAC_CARBON
#if ((defined TARGET_API_MAC_CARBON) && (TARGET_API_MAC_CARBON))
#define SDL_VIDEO_DRIVER_TOOLBOX 1
#else
#define SDL_VIDEO_DRIVER_QUARTZ 1

115
include/SDL_config_nds.h Normal file
View file

@ -0,0 +1,115 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#ifndef _SDL_config_nds_h
#define _SDL_config_nds_h
#include "SDL_platform.h"
/* This is a set of defines to configure the SDL features */
/* General platform specific identifiers */
#include "SDL_platform.h"
/* C datatypes */
#define SDL_HAS_64BIT_TYPE 1
/* Endianness */
#define SDL_BYTEORDER 1234
/* Useful headers */
#define HAVE_ALLOCA_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STDLIB_H 1
#define HAVE_STDARG_H 1
#define HAVE_MALLOC_H 1
#define HAVE_STRING_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1
#define HAVE_ICONV_H 1
#define HAVE_SIGNAL_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRDUP 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
#define HAVE_SETJMP 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_NDS 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
#define SDL_CDROM_DISABLED 1
/* Enable various input drivers */
#define SDL_JOYSTICK_NDS 1
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
/* Enable the stub thread support (src/thread/generic/\*.c) */
#define SDL_THREADS_DISABLED 1
/* Enable various timer systems */
#define SDL_TIMER_NDS 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_NDS 1
#define SDL_VIDEO_DRIVER_DUMMY 1
#endif /* _SDL_config_nds_h */

View file

@ -0,0 +1,146 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
/*
Symbian version Markus Mertama
*/
#ifndef _SDL_CONFIG_SYMBIAN_H
#define _SDL_CONFIG_SYMBIAN_H
#include "SDL_platform.h"
/* This is the minimal configuration that can be used to build SDL */
#include <stdarg.h>
#include <stddef.h>
#ifdef __GCCE__
#define SYMBIAN32_GCCE
#endif
#ifndef _SIZE_T_DEFINED
typedef unsigned int size_t;
#endif
#ifndef _INTPTR_T_DECLARED
typedef unsigned int uintptr_t;
#endif
#ifndef _INT8_T_DECLARED
typedef signed char int8_t;
#endif
#ifndef _UINT8_T_DECLARED
typedef unsigned char uint8_t;
#endif
#ifndef _INT16_T_DECLARED
typedef signed short int16_t;
#endif
#ifndef _UINT16_T_DECLARED
typedef unsigned short uint16_t;
#endif
#ifndef _INT32_T_DECLARED
typedef signed int int32_t;
#endif
#ifndef _UINT32_T_DECLARED
typedef unsigned int uint32_t;
#endif
#ifndef _INT64_T_DECLARED
typedef signed long long int64_t;
#endif
#ifndef _UINT64_T_DECLARED
typedef unsigned long long uint64_t;
#endif
#define SDL_AUDIO_DRIVER_EPOCAUDIO 1
/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
#define SDL_CDROM_DISABLED 1
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
#define SDL_JOYSTICK_DISABLED 1
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
#define SDL_THREAD_SYMBIAN 1
#define SDL_VIDEO_DRIVER_EPOC 1
#define SDL_VIDEO_OPENGL 0
#define SDL_HAS_64BIT_TYPE 1
#define HAVE_LIBC 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STRING_H 1
#define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
//#define HAVE_ALLOCA 1
#define HAVE_QSORT 1
#define HAVE_ABS 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE__STRUPR 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_ITOA 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
//#define HAVE__STRICMP 1
#define HAVE__STRNICMP 1
#define HAVE_SSCANF 1
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#endif /* _SDL_CONFIG_SYMBIAN_H */

View file

@ -27,7 +27,7 @@
/* This is a set of defines to configure the SDL features */
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__DMC__)
#define HAVE_STDINT_H 1
#elif defined(_MSC_VER)
typedef signed __int8 int8_t;
@ -46,6 +46,13 @@ typedef unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR)))
#define DWORD_PTR DWORD
#endif
#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR)))
#define LONG_PTR LONG
#endif
#else /* !__GNUC__ && !_MSC_VER */
typedef signed char int8_t;
typedef unsigned char uint8_t;

View file

@ -56,7 +56,7 @@ extern "C" {
header should only be included in files that actually use them.
*/
#if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
static __inline__ Uint16 SDL_Swap16(Uint16 x)
{
__asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x));
@ -88,7 +88,8 @@ static __inline__ Uint16 SDL_Swap16(Uint16 x) {
}
#endif
#if defined(__GNUC__) && defined(__i386__)
#if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
static __inline__ Uint32 SDL_Swap32(Uint32 x)
{
__asm__("bswap %0" : "=r" (x) : "0" (x));
@ -123,7 +124,8 @@ static __inline__ Uint32 SDL_Swap32(Uint32 x) {
#endif
#ifdef SDL_HAS_64BIT_TYPE
#if defined(__GNUC__) && defined(__i386__)
#if defined(__GNUC__) && defined(__i386__) && \
!(__GNUC__ == 2 && __GNUC_MINOR__ <= 95 /* broken gcc version */)
static __inline__ Uint64 SDL_Swap64(Uint64 x)
{
union {

View file

@ -29,10 +29,6 @@
#undef __AIX__
#define __AIX__ 1
#endif
#if defined(AMIGA) || defined(__AMIGA) || defined(__amigados__)
#undef __AMIGA__
#define __AMIGA__ 1
#endif
#if defined(__BEOS__)
#undef __BEOS__
#define __BEOS__ 1

View file

@ -62,10 +62,15 @@ typedef struct SDL_RWops {
Uint32 type;
union {
#ifdef __WIN32__
#if defined(__WIN32__) && !defined(__SYMBIAN32__)
struct {
int append;
void* h;
int append;
void *h;
struct {
void *data;
int size;
int left;
} buffer;
} win32io;
#endif
#ifdef HAVE_STDIO_H

View file

@ -91,7 +91,9 @@ typedef uint32_t Uint32;
#ifdef SDL_HAS_64BIT_TYPE
typedef int64_t Sint64;
#ifndef SYMBIAN32_GCCE
typedef uint64_t Uint64;
#endif
#else
/* This is really just a hack to prevent the compiler from complaining */
typedef struct {
@ -127,7 +129,9 @@ typedef enum {
DUMMY_ENUM_VALUE
} SDL_DUMMY_ENUM;
#ifndef __NDS__
SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
#endif
#include "begin_code.h"
@ -181,10 +185,10 @@ extern DECLSPEC void SDLCALL SDL_free(void *mem);
# endif
#endif
#ifdef HAVE_ALLOCA
#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count)
#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count))
#define SDL_stack_free(data)
#else
#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*count)
#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*(count))
#define SDL_stack_free(data) SDL_free(data)
#endif
@ -263,7 +267,10 @@ do { \
} while(0)
#endif
#if defined(__GNUC__) && defined(i386)
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
#if defined(__MACH__) && defined(__APPLE__)
#define SDL_memcpy(dst, src, len) memcpy(dst, src, len)
#elif defined(__GNUC__) && defined(i386)
#define SDL_memcpy(dst, src, len) \
do { \
int u0, u1, u2; \
@ -292,7 +299,10 @@ extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len
#endif
#endif
#if defined(__GNUC__) && defined(i386)
/* We can count on memcpy existing on Mac OS X and being well-tuned. */
#if defined(__MACH__) && defined(__APPLE__)
#define SDL_memcpy4(dst, src, len) memcpy(dst, src, (len)*4)
#elif defined(__GNUC__) && defined(i386)
#define SDL_memcpy4(dst, src, len) \
do { \
int ecx, edi, esi; \
@ -561,19 +571,17 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char
#define SDL_iconv_t iconv_t
#define SDL_iconv_open iconv_open
#define SDL_iconv_close iconv_close
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
#else
typedef struct _SDL_iconv_t *SDL_iconv_t;
extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode);
extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
#endif
extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
/* This function converts a string between encodings in one pass, returning a
string that must be freed with SDL_free() or NULL on error.
*/
extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft);
#define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1)
extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft);
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)

View file

@ -86,7 +86,8 @@ typedef struct SDL_SysWMinfo {
Display *display; /* The X11 display */
Window window; /* The X11 display window */
/* These locking functions should be called around
any X11 functions using the display variable.
any X11 functions using the display variable,
but not the gfxdisplay variable.
They lock the event thread, so should not be
called around event functions or from event filters.
*/
@ -96,6 +97,9 @@ typedef struct SDL_SysWMinfo {
/* Introduced in SDL 1.0.2 */
Window fswindow; /* The X11 fullscreen window */
Window wmwindow; /* The X11 managed input window */
/* Introduced in SDL 1.2.12 */
Display *gfxdisplay; /* The X11 display to which rendering is done */
} x11;
} info;
} SDL_SysWMinfo;

View file

@ -45,7 +45,7 @@ struct SDL_Thread;
typedef struct SDL_Thread SDL_Thread;
/* Create a thread */
#if (defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)
#if ((defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)) && !defined(__SYMBIAN32__)
/*
We compile SDL into a DLL on OS/2. This means, that it's the DLL which
creates a new thread for the calling process with the SDL_CreateThread()

View file

@ -37,7 +37,7 @@ extern "C" {
*/
#define SDL_MAJOR_VERSION 1
#define SDL_MINOR_VERSION 2
#define SDL_PATCHLEVEL 11
#define SDL_PATCHLEVEL 12
typedef struct SDL_version {
Uint8 major;

View file

@ -447,13 +447,15 @@ extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags,
* Maps an RGB triple to an opaque pixel value for a given pixel format
*/
extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b);
(const SDL_PixelFormat * const format,
const Uint8 r, const Uint8 g, const Uint8 b);
/*
* Maps an RGBA quadruple to a pixel value for a given pixel format
*/
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat *format,
Uint8 r, Uint8 g, Uint8 b, Uint8 a);
extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA
(const SDL_PixelFormat * const format,
const Uint8 r, const Uint8 g, const Uint8 b, const Uint8 a);
/*
* Maps a pixel value into the RGB components for a given pixel format

View file

@ -83,11 +83,15 @@
#endif
#endif /* SDLCALL */
/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
#ifdef __SYMBIAN32__
#ifndef EKA2
#undef DECLSPEC
#define DECLSPEC
#endif /* __SYMBIAN32__ */
#elif !defined(__WINS__)
#undef DECLSPEC
#define DECLSPEC __declspec(dllexport)
#endif //EKA2
#endif //__SYMBIAN32__
/* Force structure packing at 4 byte alignment.
This is necessary if the header is included in code which has structure
@ -116,14 +120,16 @@
#if defined(_MSC_VER) || defined(__BORLANDC__) || \
defined(__DMC__) || defined(__SC__) || \
defined(__WATCOMC__) || defined(__LCC__) || \
defined(__DECC)
defined(__DECC) || defined(__EABI__)
#ifndef __inline__
#define __inline__ __inline
#endif
#define SDL_INLINE_OKAY
#else
#if !defined(__MRC__) && !defined(_SGI_SOURCE)
#ifndef __inline__
#define __inline__ inline
#endif
#define SDL_INLINE_OKAY
#endif /* Not a funky compiler */
#endif /* Visual C++ */

View file

@ -3,6 +3,7 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
exec_prefix_set=no
libdir=@libdir@
@ENABLE_STATIC_FALSE@usage="\
@ENABLE_STATIC_FALSE@Usage: sdl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"

View file

@ -54,7 +54,9 @@ static SDL_version version =
/* The initialized subsystems */
static Uint32 SDL_initialized = 0;
#if !SDL_TIMERS_DISABLED
static Uint32 ticks_started = 0;
#endif
#ifdef CHECK_LEAKS
int surfaces_allocated = 0;
@ -323,7 +325,7 @@ unsigned _System LibMain(unsigned hmod, unsigned termination)
}
#endif /* __WATCOMC__ */
#elif defined(__WIN32__)
#elif defined(__WIN32__) && !defined(__SYMBIAN32__)
#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL))
/* Need to include DllMain() on Watcom C for some reason.. */

View file

@ -46,6 +46,9 @@ static AudioBootStrap *bootstrap[] = {
#if SDL_AUDIO_DRIVER_ALSA
&ALSA_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_PULSE
&PULSE_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_QNXNTO
&QNXNTOAUDIO_bootstrap,
#endif
@ -82,9 +85,6 @@ static AudioBootStrap *bootstrap[] = {
#if SDL_AUDIO_DRIVER_SNDMGR
&SNDMGR_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_AHI
&AHI_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_MINT
&MINTAUDIO_GSXB_bootstrap,
&MINTAUDIO_MCSN_bootstrap,
@ -101,11 +101,17 @@ static AudioBootStrap *bootstrap[] = {
#if SDL_AUDIO_DRIVER_DC
&DCAUD_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_NDS
&NDSAUD_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_MMEAUDIO
&MMEAUDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_DART
&DART_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_EPOCAUDIO
&EPOCAudio_bootstrap,
#endif
NULL
};
@ -115,10 +121,6 @@ SDL_AudioDevice *current_audio = NULL;
int SDL_AudioInit(const char *driver_name);
void SDL_AudioQuit(void);
#if SDL_AUDIO_DRIVER_AHI
static int audio_configured = 0;
#endif
/* The general mixing thread function */
int SDLCALL SDL_RunAudio(void *audiop)
{
@ -128,21 +130,6 @@ int SDLCALL SDL_RunAudio(void *audiop)
void *udata;
void (SDLCALL *fill)(void *userdata,Uint8 *stream, int len);
int silence;
#if SDL_AUDIO_DRIVER_AHI
int started = 0;
/* AmigaOS NEEDS that the audio driver is opened in the thread that uses it! */
D(bug("Task audio started audio struct:<%lx>...\n",audiop));
D(bug("Before Openaudio..."));
if(audio->OpenAudio(audio, &audio->spec)==-1)
{
D(bug("Open audio failed...\n"));
return(-1);
}
D(bug("OpenAudio...OK\n"));
#endif
/* Perform any thread setup */
if ( audio->ThreadInit ) {
@ -154,14 +141,6 @@ int SDLCALL SDL_RunAudio(void *audiop)
fill = audio->spec.callback;
udata = audio->spec.userdata;
#if SDL_AUDIO_DRIVER_AHI
audio_configured = 1;
D(bug("Audio configured... Checking for conversion\n"));
SDL_mutexP(audio->mixer_lock);
D(bug("Semaphore obtained...\n"));
#endif
if ( audio->convert.needed ) {
if ( audio->convert.src_format == AUDIO_U8 ) {
silence = 0x80;
@ -174,11 +153,6 @@ int SDLCALL SDL_RunAudio(void *audiop)
stream_len = audio->spec.size;
}
#if SDL_AUDIO_DRIVER_AHI
SDL_mutexV(audio->mixer_lock);
D(bug("Entering audio loop...\n"));
#endif
#ifdef __OS2__
/* Increase the priority of this thread to make sure that
the audio will be continuous all the time! */
@ -216,6 +190,7 @@ int SDLCALL SDL_RunAudio(void *audiop)
stream = audio->fake_stream;
}
}
SDL_memset(stream, silence, stream_len);
if ( ! audio->paused ) {
@ -253,14 +228,6 @@ int SDLCALL SDL_RunAudio(void *audiop)
audio->WaitDone(audio);
}
#if SDL_AUDIO_DRIVER_AHI
D(bug("WaitAudio...Done\n"));
audio->CloseAudio(audio);
D(bug("CloseAudio..Done, subtask exiting...\n"));
audio_configured = 0;
#endif
#ifdef __OS2__
#ifdef DEBUG_BUILD
printf("[SDL_RunAudio] : Task exiting. (TID%d)\n", SDL_ThreadID());
@ -350,7 +317,7 @@ int SDL_AudioInit(const char *driver_name)
This probably isn't the place to do this, but... Shh! :)
*/
for ( i=0; bootstrap[i]; ++i ) {
if ( SDL_strcmp(bootstrap[i]->name, "esd") == 0 ) {
if ( SDL_strcasecmp(bootstrap[i]->name, "esd") == 0 ) {
#ifdef HAVE_PUTENV
const char *esd_no_spawn;
@ -381,8 +348,7 @@ int SDL_AudioInit(const char *driver_name)
}
#endif
for ( i=0; bootstrap[i]; ++i ) {
if (SDL_strncmp(bootstrap[i]->name, driver_name,
SDL_strlen(bootstrap[i]->name)) == 0) {
if (SDL_strcasecmp(bootstrap[i]->name, driver_name) == 0) {
if ( bootstrap[i]->available() ) {
audio=bootstrap[i]->create(idx);
break;
@ -471,7 +437,7 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
if ( desired->channels == 0 ) {
env = SDL_getenv("SDL_AUDIO_CHANNELS");
if ( env ) {
desired->channels = SDL_atoi(env);
desired->channels = (Uint8)SDL_atoi(env);
}
}
if ( desired->channels == 0 ) {
@ -491,7 +457,7 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
if ( desired->samples == 0 ) {
env = SDL_getenv("SDL_AUDIO_SAMPLES");
if ( env ) {
desired->samples = SDL_atoi(env);
desired->samples = (Uint16)SDL_atoi(env);
}
}
if ( desired->samples == 0 ) {
@ -508,10 +474,7 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
return(-1);
}
#if defined(__MACOS__) || (defined(__RISCOS__) && SDL_THREADS_DISABLED)
/* FIXME: Need to implement PPC interrupt asm for SDL_LockAudio() */
#else
#if defined(__MINT__) && SDL_THREADS_DISABLED
#if SDL_THREADS_DISABLED
/* Uses interrupt driven audio, without thread */
#else
/* Create a semaphore for locking the sound buffers */
@ -521,8 +484,7 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
SDL_CloseAudio();
return(-1);
}
#endif /* __MINT__ */
#endif /* __MACOS__ */
#endif /* SDL_THREADS_DISABLED */
/* Calculate the silence and size of the audio specification */
SDL_CalculateAudioSpec(desired);
@ -533,33 +495,12 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
audio->enabled = 1;
audio->paused = 1;
#if !SDL_AUDIO_DRIVER_AHI
/* AmigaOS opens audio inside the main loop */
audio->opened = audio->OpenAudio(audio, &audio->spec)+1;
if ( ! audio->opened ) {
SDL_CloseAudio();
return(-1);
}
#else
D(bug("Locking semaphore..."));
SDL_mutexP(audio->mixer_lock);
audio->thread = SDL_CreateThread(SDL_RunAudio, audio);
D(bug("Created thread...\n"));
if ( audio->thread == NULL ) {
SDL_mutexV(audio->mixer_lock);
SDL_CloseAudio();
SDL_SetError("Couldn't create audio thread");
return(-1);
}
while(!audio_configured)
SDL_Delay(100);
#endif
/* If the audio driver changes the buffer size, accept it */
if ( audio->spec.samples != desired->samples ) {
@ -591,7 +532,8 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
return(-1);
}
if ( audio->convert.needed ) {
audio->convert.len = desired->size;
audio->convert.len = (int) ( ((double) desired->size) /
audio->convert.len_ratio );
audio->convert.buf =(Uint8 *)SDL_AllocAudioMem(
audio->convert.len*audio->convert.len_mult);
if ( audio->convert.buf == NULL ) {
@ -602,12 +544,11 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
}
}
#if !SDL_AUDIO_DRIVER_AHI
/* Start the audio thread if necessary */
switch (audio->opened) {
case 1:
/* Start the audio thread */
#if (defined(__WIN32__) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC)
#if (defined(__WIN32__) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC) && !defined(__SYMBIAN32__)
#undef SDL_CreateThread
audio->thread = SDL_CreateThread(SDL_RunAudio, audio, NULL, NULL);
#else
@ -624,11 +565,6 @@ int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained)
/* The audio is now playing */
break;
}
#else
SDL_mutexV(audio->mixer_lock);
D(bug("SDL_OpenAudio USCITA...\n"));
#endif
return(0);
}
@ -702,12 +638,10 @@ void SDL_AudioQuit(void)
SDL_FreeAudioMem(audio->convert.buf);
}
#if !SDL_AUDIO_DRIVER_AHI
if ( audio->opened ) {
audio->CloseAudio(audio);
audio->opened = 0;
}
#endif
/* Free the driver data */
audio->free(audio);
current_audio = NULL;

View file

@ -44,11 +44,7 @@ void SDLCALL SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
dst = cvt->buf;
for ( i=cvt->len_cvt/2; i; --i ) {
sample = src[0] + src[1];
if ( sample > 255 ) {
*dst = 255;
} else {
*dst = (Uint8)sample;
}
*dst = (Uint8)(sample / 2);
src += 2;
dst += 1;
}
@ -62,14 +58,7 @@ void SDLCALL SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
dst = (Sint8 *)cvt->buf;
for ( i=cvt->len_cvt/2; i; --i ) {
sample = src[0] + src[1];
if ( sample > 127 ) {
*dst = 127;
} else
if ( sample < -128 ) {
*dst = -128;
} else {
*dst = (Sint8)sample;
}
*dst = (Sint8)(sample / 2);
src += 2;
dst += 1;
}
@ -85,14 +74,10 @@ void SDLCALL SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
for ( i=cvt->len_cvt/4; i; --i ) {
sample = (Uint16)((src[0]<<8)|src[1])+
(Uint16)((src[2]<<8)|src[3]);
if ( sample > 65535 ) {
dst[0] = 0xFF;
dst[1] = 0xFF;
} else {
dst[1] = (sample&0xFF);
sample >>= 8;
dst[0] = (sample&0xFF);
}
sample /= 2;
dst[1] = (sample&0xFF);
sample >>= 8;
dst[0] = (sample&0xFF);
src += 4;
dst += 2;
}
@ -100,14 +85,10 @@ void SDLCALL SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
for ( i=cvt->len_cvt/4; i; --i ) {
sample = (Uint16)((src[1]<<8)|src[0])+
(Uint16)((src[3]<<8)|src[2]);
if ( sample > 65535 ) {
dst[0] = 0xFF;
dst[1] = 0xFF;
} else {
dst[0] = (sample&0xFF);
sample >>= 8;
dst[1] = (sample&0xFF);
}
sample /= 2;
dst[0] = (sample&0xFF);
sample >>= 8;
dst[1] = (sample&0xFF);
src += 4;
dst += 2;
}
@ -124,18 +105,10 @@ void SDLCALL SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
for ( i=cvt->len_cvt/4; i; --i ) {
sample = (Sint16)((src[0]<<8)|src[1])+
(Sint16)((src[2]<<8)|src[3]);
if ( sample > 32767 ) {
dst[0] = 0x7F;
dst[1] = 0xFF;
} else
if ( sample < -32768 ) {
dst[0] = 0x80;
dst[1] = 0x00;
} else {
dst[1] = (sample&0xFF);
sample >>= 8;
dst[0] = (sample&0xFF);
}
sample /= 2;
dst[1] = (sample&0xFF);
sample >>= 8;
dst[0] = (sample&0xFF);
src += 4;
dst += 2;
}
@ -143,18 +116,10 @@ void SDLCALL SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format)
for ( i=cvt->len_cvt/4; i; --i ) {
sample = (Sint16)((src[1]<<8)|src[0])+
(Sint16)((src[3]<<8)|src[2]);
if ( sample > 32767 ) {
dst[1] = 0x7F;
dst[0] = 0xFF;
} else
if ( sample < -32768 ) {
dst[1] = 0x80;
dst[0] = 0x00;
} else {
dst[0] = (sample&0xFF);
sample >>= 8;
dst[1] = (sample&0xFF);
}
sample /= 2;
dst[0] = (sample&0xFF);
sample >>= 8;
dst[1] = (sample&0xFF);
src += 4;
dst += 2;
}
@ -1374,7 +1339,7 @@ int SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
/* First filter: Endian conversion from src to dst */
if ( (src_format & 0x1000) != (dst_format & 0x1000)
&& ((src_format & 0xff) != 8) ) {
&& ((src_format & 0xff) == 16) && ((dst_format & 0xff) == 16)) {
cvt->filters[cvt->filter_index++] = SDL_ConvertEndian;
}

View file

@ -103,6 +103,9 @@ typedef struct AudioBootStrap {
#if SDL_AUDIO_DRIVER_BSD
extern AudioBootStrap BSD_AUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_PULSE
extern AudioBootStrap PULSE_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_OSS
extern AudioBootStrap DSP_bootstrap;
extern AudioBootStrap DMA_bootstrap;
@ -146,9 +149,6 @@ extern AudioBootStrap COREAUDIO_bootstrap;
#if SDL_AUDIO_DRIVER_SNDMGR
extern AudioBootStrap SNDMGR_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_AHI
extern AudioBootStrap AHI_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_MINT
extern AudioBootStrap MINTAUDIO_GSXB_bootstrap;
extern AudioBootStrap MINTAUDIO_MCSN_bootstrap;
@ -165,12 +165,18 @@ extern AudioBootStrap DUMMYAUD_bootstrap;
#if SDL_AUDIO_DRIVER_DC
extern AudioBootStrap DCAUD_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_NDS
extern AudioBootStrap NDSAUD_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_MMEAUDIO
extern AudioBootStrap MMEAUDIO_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_DART
extern AudioBootStrap DART_bootstrap;
#endif
#if SDL_AUDIO_DRIVER_EPOCAUDIO
extern AudioBootStrap EPOCAudio_bootstrap;
#endif
/* This is the current audio device */
extern SDL_AudioDevice *current_audio;

View file

@ -1,337 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
/* Allow access to a raw mixing buffer (for AmigaOS) */
#include "SDL_audio.h"
#include "../SDL_audio_c.h"
#include "SDL_ahiaudio.h"
/* Audio driver functions */
static int AHI_OpenAudio(_THIS, SDL_AudioSpec *spec);
static void AHI_WaitAudio(_THIS);
static void AHI_PlayAudio(_THIS);
static Uint8 *AHI_GetAudioBuf(_THIS);
static void AHI_CloseAudio(_THIS);
#ifndef __SASC
#define mymalloc(x) AllocVec(x,MEMF_PUBLIC)
#define myfree FreeVec
#else
#define mymalloc malloc
#define myfree free
#endif
/* Audio driver bootstrap functions */
static int Audio_Available(void)
{
int ok=0;
struct MsgPort *p;
struct AHIRequest *req;
if(p=CreateMsgPort())
{
if(req=(struct AHIRequest *)CreateIORequest(p,sizeof(struct AHIRequest)))
{
req->ahir_Version=4;
if(!OpenDevice(AHINAME,0,(struct IORequest *)req,NULL))
{
D(bug("AHI available.\n"));
ok=1;
CloseDevice((struct IORequest *)req);
}
DeleteIORequest((struct IORequest *)req);
}
DeleteMsgPort(p);
}
D(if(!ok) bug("AHI not available\n"));
return ok;
}
static void Audio_DeleteDevice(SDL_AudioDevice *device)
{
SDL_free(device->hidden);
SDL_free(device);
}
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
{
SDL_AudioDevice *this;
#ifndef NO_AMIGADEBUG
D(bug("AHI created...\n"));
#endif
/* Initialize all variables that we clean on shutdown */
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
if ( this ) {
SDL_memset(this, 0, (sizeof *this));
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
}
if ( (this == NULL) || (this->hidden == NULL) ) {
SDL_OutOfMemory();
if ( this ) {
SDL_free(this);
}
return(0);
}
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
/* Set the function pointers */
this->OpenAudio = AHI_OpenAudio;
this->WaitAudio = AHI_WaitAudio;
this->PlayAudio = AHI_PlayAudio;
this->GetAudioBuf = AHI_GetAudioBuf;
this->CloseAudio = AHI_CloseAudio;
this->free = Audio_DeleteDevice;
return this;
}
AudioBootStrap AHI_bootstrap = {
"AHI", Audio_Available, Audio_CreateDevice
};
void static AHI_WaitAudio(_THIS)
{
if(!CheckIO((struct IORequest *)audio_req[current_buffer]))
{
WaitIO((struct IORequest *)audio_req[current_buffer]);
// AbortIO((struct IORequest *)audio_req[current_buffer]);
}
}
static void AHI_PlayAudio(_THIS)
{
if(playing>1)
WaitIO((struct IORequest *)audio_req[current_buffer]);
/* Write the audio data out */
audio_req[current_buffer] -> ahir_Std. io_Message.mn_Node.ln_Pri = 60;
audio_req[current_buffer] -> ahir_Std. io_Data = mixbuf[current_buffer];
audio_req[current_buffer] -> ahir_Std. io_Length = this->hidden->size;
audio_req[current_buffer] -> ahir_Std. io_Offset = 0;
audio_req[current_buffer] -> ahir_Std . io_Command = CMD_WRITE;
audio_req[current_buffer] -> ahir_Frequency = this->hidden->freq;
audio_req[current_buffer] -> ahir_Volume = 0x10000;
audio_req[current_buffer] -> ahir_Type = this->hidden->type;
audio_req[current_buffer] -> ahir_Position = 0x8000;
audio_req[current_buffer] -> ahir_Link = (playing>0 ? audio_req[current_buffer^1] : NULL);
SendIO((struct IORequest *)audio_req[current_buffer]);
current_buffer^=1;
playing++;
}
static Uint8 *AHI_GetAudioBuf(_THIS)
{
return(mixbuf[current_buffer]);
}
static void AHI_CloseAudio(_THIS)
{
D(bug("Closing audio...\n"));
playing=0;
if(audio_req[0])
{
if(audio_req[1])
{
D(bug("Break req[1]...\n"));
AbortIO((struct IORequest *)audio_req[1]);
WaitIO((struct IORequest *)audio_req[1]);
}
D(bug("Break req[0]...\n"));
AbortIO((struct IORequest *)audio_req[0]);
WaitIO((struct IORequest *)audio_req[0]);
if(audio_req[1])
{
D(bug("Break AGAIN req[1]...\n"));
AbortIO((struct IORequest *)audio_req[1]);
WaitIO((struct IORequest *)audio_req[1]);
}
// Double abort to be sure to break the dbuffering process.
SDL_Delay(200);
D(bug("Reqs breaked, closing device...\n"));
CloseDevice((struct IORequest *)audio_req[0]);
D(bug("Device closed, freeing memory...\n"));
myfree(audio_req[1]);
D(bug("Memory freed, deleting IOReq...\n"));
DeleteIORequest((struct IORequest *)audio_req[0]);
audio_req[0]=audio_req[1]=NULL;
}
D(bug("Freeing mixbuf[0]...\n"));
if ( mixbuf[0] != NULL ) {
myfree(mixbuf[0]);
// SDL_FreeAudioMem(mixbuf[0]);
mixbuf[0] = NULL;
}
D(bug("Freeing mixbuf[1]...\n"));
if ( mixbuf[1] != NULL ) {
myfree(mixbuf[1]);
// SDL_FreeAudioMem(mixbuf[1]);
mixbuf[1] = NULL;
}
D(bug("Freeing audio_port...\n"));
if ( audio_port != NULL ) {
DeleteMsgPort(audio_port);
audio_port = NULL;
}
D(bug("...done!\n"));
}
static int AHI_OpenAudio(_THIS, SDL_AudioSpec *spec)
{
// int width;
D(bug("AHI opening...\n"));
/* Determine the audio parameters from the AudioSpec */
switch ( spec->format & 0xFF ) {
case 8: { /* Signed 8 bit audio data */
D(bug("Samples a 8 bit...\n"));
spec->format = AUDIO_S8;
this->hidden->bytespersample=1;
if(spec->channels<2)
this->hidden->type = AHIST_M8S;
else
this->hidden->type = AHIST_S8S;
}
break;
case 16: { /* Signed 16 bit audio data */
D(bug("Samples a 16 bit...\n"));
spec->format = AUDIO_S16MSB;
this->hidden->bytespersample=2;
if(spec->channels<2)
this->hidden->type = AHIST_M16S;
else
this->hidden->type = AHIST_S16S;
}
break;
default: {
SDL_SetError("Unsupported audio format");
return(-1);
}
}
if(spec->channels!=1 && spec->channels!=2)
{
D(bug("Wrong channel number!\n"));
SDL_SetError("Channel number non supported");
return -1;
}
D(bug("Before CalculateAudioSpec\n"));
/* Update the fragment size as size in bytes */
SDL_CalculateAudioSpec(spec);
D(bug("Before CreateMsgPort\n"));
if(!(audio_port=CreateMsgPort()))
{
SDL_SetError("Unable to create a MsgPort");
return -1;
}
D(bug("Before CreateIORequest\n"));
if(!(audio_req[0]=(struct AHIRequest *)CreateIORequest(audio_port,sizeof(struct AHIRequest))))
{
SDL_SetError("Unable to create an AHIRequest");
DeleteMsgPort(audio_port);
return -1;
}
audio_req[0]->ahir_Version = 4;
if(OpenDevice(AHINAME,0,(struct IORequest *)audio_req[0],NULL))
{
SDL_SetError("Unable to open AHI device!\n");
DeleteIORequest((struct IORequest *)audio_req[0]);
DeleteMsgPort(audio_port);
return -1;
}
D(bug("AFTER opendevice\n"));
/* Set output frequency and size */
this->hidden->freq = spec->freq;
this->hidden->size = spec->size;
D(bug("Before buffer allocation\n"));
/* Allocate mixing buffer */
mixbuf[0] = (Uint8 *)mymalloc(spec->size);
mixbuf[1] = (Uint8 *)mymalloc(spec->size);
D(bug("Before audio_req allocation\n"));
if(!(audio_req[1]=mymalloc(sizeof(struct AHIRequest))))
{
SDL_OutOfMemory();
return(-1);
}
D(bug("Before audio_req memcpy\n"));
SDL_memcpy(audio_req[1],audio_req[0],sizeof(struct AHIRequest));
if ( mixbuf[0] == NULL || mixbuf[1] == NULL ) {
SDL_OutOfMemory();
return(-1);
}
D(bug("Before mixbuf memset\n"));
SDL_memset(mixbuf[0], spec->silence, spec->size);
SDL_memset(mixbuf[1], spec->silence, spec->size);
current_buffer=0;
playing=0;
D(bug("AHI opened: freq:%ld mixbuf:%lx/%lx buflen:%ld bits:%ld channels:%ld\n",spec->freq,mixbuf[0],mixbuf[1],spec->size,this->hidden->bytespersample*8,spec->channels));
/* We're ready to rock and roll. :-) */
return(0);
}

View file

@ -23,6 +23,11 @@
/* Allow access to a raw mixing buffer */
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <unistd.h>
#include "SDL_timer.h"
#include "SDL_audio.h"
#include "../SDL_audiomem.h"
@ -60,6 +65,8 @@ static int (*SDL_NAME(arts_stream_set))(arts_stream_t s, arts_parameter_t param,
static int (*SDL_NAME(arts_stream_get))(arts_stream_t s, arts_parameter_t param);
static int (*SDL_NAME(arts_write))(arts_stream_t s, const void *buffer, int count);
static void (*SDL_NAME(arts_close_stream))(arts_stream_t s);
static int (*SDL_NAME(arts_suspended))(void);
static const char *(*SDL_NAME(arts_error_text))(int errorcode);
static struct {
const char *name;
@ -72,6 +79,8 @@ static struct {
{ "arts_stream_get", (void **)&SDL_NAME(arts_stream_get) },
{ "arts_write", (void **)&SDL_NAME(arts_write) },
{ "arts_close_stream", (void **)&SDL_NAME(arts_close_stream) },
{ "arts_suspended", (void **)&SDL_NAME(arts_suspended) },
{ "arts_error_text", (void **)&SDL_NAME(arts_error_text) },
};
static void UnloadARTSLibrary()
@ -127,14 +136,14 @@ static int Audio_Available(void)
return available;
}
if ( SDL_NAME(arts_init)() == 0 ) {
#define ARTS_CRASH_HACK /* Play a stream so aRts doesn't crash */
#ifdef ARTS_CRASH_HACK
arts_stream_t stream2;
stream2=SDL_NAME(arts_play_stream)(44100, 16, 2, "SDL");
SDL_NAME(arts_write)(stream2, "", 0);
SDL_NAME(arts_close_stream)(stream2);
#endif
available = 1;
if ( SDL_NAME(arts_suspended)() ) {
/* Play a stream so aRts doesn't crash */
arts_stream_t stream2;
stream2=SDL_NAME(arts_play_stream)(44100, 16, 2, "SDL");
SDL_NAME(arts_write)(stream2, "", 0);
SDL_NAME(arts_close_stream)(stream2);
available = 1;
}
SDL_NAME(arts_free)();
}
UnloadARTSLibrary();
@ -255,6 +264,7 @@ static int ARTS_OpenAudio(_THIS, SDL_AudioSpec *spec)
{
int bits, frag_spec;
Uint16 test_format, format;
int error_code;
/* Reset the timer synchronization flag */
frame_ticks = 0.0;
@ -292,8 +302,13 @@ static int ARTS_OpenAudio(_THIS, SDL_AudioSpec *spec)
}
spec->format = test_format;
if ( SDL_NAME(arts_init)() != 0 ) {
SDL_SetError("Unable to initialize ARTS");
error_code = SDL_NAME(arts_init)();
if ( error_code != 0 ) {
SDL_SetError("Unable to initialize ARTS: %s", SDL_NAME(arts_error_text)(error_code));
return(-1);
}
if ( ! SDL_NAME(arts_suspended)() ) {
SDL_SetError("ARTS can not open audio device");
return(-1);
}
stream = SDL_NAME(arts_play_stream)(spec->freq, bits, spec->channels, "SDL");

View file

@ -152,38 +152,55 @@ void BE_CloseAudio(_THIS)
int BE_OpenAudio(_THIS, SDL_AudioSpec *spec)
{
media_raw_audio_format format;
int valid_datatype = 0;
media_raw_audio_format format;
Uint16 test_format = SDL_FirstAudioFormat(spec->format);
/* Initialize the Be Application, if it's not already started */
if ( SDL_InitBeApp() < 0 ) {
return(-1);
}
/* Parse the audio format and fill the Be raw audio format */
memset(&format, '\0', sizeof (media_raw_audio_format));
format.byte_order = B_MEDIA_LITTLE_ENDIAN;
format.frame_rate = (float) spec->freq;
format.channel_count = spec->channels; /* !!! FIXME: support > 2? */
while ((!valid_datatype) && (test_format)) {
valid_datatype = 1;
spec->format = test_format;
switch (test_format) {
case AUDIO_S8:
format.format = media_raw_audio_format::B_AUDIO_CHAR;
break;
case AUDIO_U8:
format.format = media_raw_audio_format::B_AUDIO_UCHAR;
break;
case AUDIO_S16LSB:
format.format = media_raw_audio_format::B_AUDIO_SHORT;
break;
case AUDIO_S16MSB:
format.format = media_raw_audio_format::B_AUDIO_SHORT;
format.byte_order = B_MEDIA_BIG_ENDIAN;
break;
default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
}
}
if (!valid_datatype) { /* shouldn't happen, but just in case... */
SDL_SetError("Unsupported audio format");
return (-1);
}
/* Initialize the Be Application, if it's not already started */
if (SDL_InitBeApp() < 0) {
return (-1);
}
format.buffer_size = spec->samples;
/* Parse the audio format and fill the Be raw audio format */
format.frame_rate = (float)spec->freq;
format.channel_count = spec->channels;
switch (spec->format&~0x1000) {
case AUDIO_S8:
/* Signed 8-bit audio unsupported, convert to U8 */
spec->format = AUDIO_U8;
case AUDIO_U8:
format.format = media_raw_audio_format::B_AUDIO_UCHAR;
format.byte_order = 0;
break;
case AUDIO_U16:
/* Unsigned 16-bit audio unsupported, convert to S16 */
spec->format ^= 0x8000;
case AUDIO_S16:
format.format = media_raw_audio_format::B_AUDIO_SHORT;
if ( spec->format & 0x1000 ) {
format.byte_order = 1; /* Big endian */
} else {
format.byte_order = 2; /* Little endian */
}
break;
}
format.buffer_size = spec->samples;
/* Calculate the final parameters for this audio specification */
SDL_CalculateAudioSpec(spec);

View file

@ -75,6 +75,8 @@ LONG APIENTRY DARTEventFunc(ULONG ulStatus,
int DART_OpenAudio(_THIS, SDL_AudioSpec *spec)
{
Uint16 test_format = SDL_FirstAudioFormat(spec->format);
int valid_datatype = 0;
MCI_AMP_OPEN_PARMS AmpOpenParms;
MCI_GENERIC_PARMS GenericParms;
int iDeviceOrd = 0; // Default device to be used
@ -106,26 +108,39 @@ int DART_OpenAudio(_THIS, SDL_AudioSpec *spec)
iDeviceOrd = AmpOpenParms.usDeviceID;
// Determine the audio parameters from the AudioSpec
switch ( spec->format & 0xFF )
{
case 8:
/* Unsigned 8 bit audio data */
spec->format = AUDIO_U8;
if (spec->channels > 2)
spec->channels = 2; // !!! FIXME: more than stereo support in OS/2?
while ((!valid_datatype) && (test_format)) {
spec->format = test_format;
valid_datatype = 1;
switch (test_format) {
case AUDIO_U8:
// Unsigned 8 bit audio data
iSilence = 0x80;
iBits = 8;
break;
case 16:
/* Signed 16 bit audio data */
spec->format = AUDIO_S16;
case AUDIO_S16LSB:
// Signed 16 bit audio data
iSilence = 0x00;
iBits = 16;
break;
default:
// Close DART, and exit with error code!
mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
SDL_SetError("Unsupported audio format");
return(-1);
default:
valid_datatype = 0;
test_format = SDL_NextAudioFormat();
break;
}
}
if (!valid_datatype) { // shouldn't happen, but just in case...
// Close DART, and exit with error code!
mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
SDL_SetError("Unsupported audio format");
return (-1);
}
iFreq = spec->freq;
iChannels = spec->channels;
/* Update the fragment size as size in bytes */

View file

@ -201,13 +201,30 @@ static void DCAUD_CloseAudio(_THIS)
static int DCAUD_OpenAudio(_THIS, SDL_AudioSpec *spec)
{
switch(spec->format&0xff) {
case 8: spec->format = AUDIO_S8; break;
case 16: spec->format = AUDIO_S16LSB; break;
default:
SDL_SetError("Unsupported audio format");
return(-1);
}
Uint16 test_format = SDL_FirstAudioFormat(spec->format);
int valid_datatype = 0;
while ((!valid_datatype) && (test_format)) {
spec->format = test_format;
switch (test_format) {
/* only formats Dreamcast accepts... */
case AUDIO_S8:
case AUDIO_S16LSB:
valid_datatype = 1;
break;
default:
test_format = SDL_NextAudioFormat();
break;
}
}
if (!valid_datatype) { /* shouldn't happen, but just in case... */
SDL_SetError("Unsupported audio format");
return (-1);
}
if (spec->channels > 2)
spec->channels = 2; /* no more than stereo on the Dreamcast. */
/* Update the fragment size as size in bytes */
SDL_CalculateAudioSpec(spec);

View file

@ -139,78 +139,104 @@ static void AL_CloseAudio(_THIS)
}
}
static int AL_OpenAudio(_THIS, SDL_AudioSpec *spec)
static int AL_OpenAudio(_THIS, SDL_AudioSpec * spec)
{
ALconfig audio_config;
Uint16 test_format = SDL_FirstAudioFormat(spec->format);
long width = 0;
long fmt = 0;
int valid = 0;
#ifdef OLD_IRIX_AUDIO
long audio_param[2];
{
long audio_param[2];
audio_param[0] = AL_OUTPUT_RATE;
audio_param[1] = spec->freq;
valid = (ALsetparams(AL_DEFAULT_DEVICE, audio_param, 2) < 0);
}
#else
ALpv audio_param;
{
ALpv audio_param;
audio_param.param = AL_RATE;
audio_param.value.i = spec->freq;
valid = (alSetParams(AL_DEFAULT_OUTPUT, &audio_param, 1) < 0);
}
#endif
int width;
/* Determine the audio parameters from the AudioSpec */
switch ( spec->format & 0xFF ) {
while ((!valid) && (test_format)) {
valid = 1;
spec->format = test_format;
case 8: { /* Signed 8 bit audio data */
spec->format = AUDIO_S8;
width = AL_SAMPLE_8;
switch (test_format) {
case AUDIO_S8:
width = AL_SAMPLE_8;
fmt = AL_SAMPFMT_TWOSCOMP;
break;
case AUDIO_S16SYS:
width = AL_SAMPLE_16;
fmt = AL_SAMPFMT_TWOSCOMP;
break;
default:
valid = 0;
test_format = SDL_NextAudioFormat();
break;
}
break;
case 16: { /* Signed 16 bit audio data */
spec->format = AUDIO_S16MSB;
width = AL_SAMPLE_16;
}
break;
if (valid) {
ALconfig audio_config = alNewConfig();
valid = 0;
if (audio_config) {
if (alSetChannels(audio_config, spec->channels) < 0) {
if (spec->channels > 2) { /* can't handle > stereo? */
spec->channels = 2; /* try again below. */
}
}
default: {
SDL_SetError("Unsupported audio format");
return(-1);
if ((alSetSampFmt(audio_config, fmt) >= 0) &&
((!width) || (alSetWidth(audio_config, width) >= 0)) &&
(alSetQueueSize(audio_config, spec->samples * 2) >= 0) &&
(alSetChannels(audio_config, spec->channels) >= 0)) {
audio_port = alOpenPort("SDL audio", "w", audio_config);
if (audio_port == NULL) {
/* docs say AL_BAD_CHANNELS happens here, too. */
int err = oserror();
if (err == AL_BAD_CHANNELS) {
spec->channels = 2;
alSetChannels(audio_config, spec->channels);
audio_port = alOpenPort("SDL audio", "w",
audio_config);
}
}
if (audio_port != NULL) {
valid = 1;
}
}
alFreeConfig(audio_config);
}
}
}
if (!valid) {
SDL_SetError("Unsupported audio format");
return (-1);
}
/* Update the fragment size as size in bytes */
SDL_CalculateAudioSpec(spec);
/* Set output frequency */
#ifdef OLD_IRIX_AUDIO
audio_param[0] = AL_OUTPUT_RATE;
audio_param[1] = spec->freq;
if( ALsetparams(AL_DEFAULT_DEVICE, audio_param, 2) < 0 ) {
#else
audio_param.param = AL_RATE;
audio_param.value.i = spec->freq;
if( alSetParams(AL_DEFAULT_OUTPUT, &audio_param, 1) < 0 ) {
#endif
SDL_SetError("alSetParams failed");
return(-1);
}
/* Open the audio port with the requested frequency */
audio_port = NULL;
audio_config = alNewConfig();
if ( audio_config &&
(alSetSampFmt(audio_config, AL_SAMPFMT_TWOSCOMP) >= 0) &&
(alSetWidth(audio_config, width) >= 0) &&
(alSetQueueSize(audio_config, spec->samples*2) >= 0) &&
(alSetChannels(audio_config, spec->channels) >= 0) ) {
audio_port = alOpenPort("SDL audio", "w", audio_config);
}
alFreeConfig(audio_config);
if( audio_port == NULL ) {
SDL_SetError("Unable to open audio port");
return(-1);
}
/* Allocate mixing buffer */
mixbuf = (Uint8 *)SDL_AllocAudioMem(spec->size);
if ( mixbuf == NULL ) {
mixbuf = (Uint8 *) SDL_AllocAudioMem(spec->size);
if (mixbuf == NULL) {
SDL_OutOfMemory();
return(-1);
return (-1);
}
SDL_memset(mixbuf, spec->silence, spec->size);
/* We're ready to rock and roll. :-) */
return(0);
return (0);
}

View file

@ -168,6 +168,15 @@ static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec)
int frag_spec;
Uint16 test_format;
/* Make sure fragment size stays a power of 2, or OSS fails. */
/* I don't know which of these are actually legal values, though... */
if (spec->channels > 8)
spec->channels = 8;
else if (spec->channels > 4)
spec->channels = 4;
else if (spec->channels > 2)
spec->channels = 2;
/* Open the audio device */
audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
if ( audio_fd < 0 ) {

View file

@ -32,6 +32,7 @@
#include <mint/osbind.h>
#include <mint/falcon.h>
#include <mint/mintbind.h>
#include <mint/cookie.h>
#include "SDL_audio.h"
#include "SDL_mintaudio.h"
@ -46,6 +47,7 @@ volatile unsigned short SDL_MintAudio_numbuf; /* Buffer to play */
volatile unsigned short SDL_MintAudio_mutex;
volatile unsigned long SDL_MintAudio_clocktics;
cookie_stfa_t *SDL_MintAudio_stfa;
unsigned short SDL_MintAudio_hasfpu;
/* MiNT thread variables */
SDL_bool SDL_MintAudio_mint_present;
@ -139,6 +141,26 @@ int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq)
return MINTAUDIO_freqcount-1;
}
/* Check if FPU is present */
void SDL_MintAudio_CheckFpu(void)
{
unsigned long cookie_fpu;
SDL_MintAudio_hasfpu = 0;
if (Getcookie(C__FPU, &cookie_fpu) != C_FOUND) {
return;
}
switch ((cookie_fpu>>16)&0xfffe) {
case 2:
case 4:
case 6:
case 8:
case 16:
SDL_MintAudio_hasfpu = 1;
break;
}
}
/* The thread function, used under MiNT with xbios */
int SDL_MintAudio_Thread(long param)
{

View file

@ -123,6 +123,7 @@ extern volatile unsigned short SDL_MintAudio_numbuf; /* Buffer to play */
extern volatile unsigned short SDL_MintAudio_mutex;
extern cookie_stfa_t *SDL_MintAudio_stfa;
extern volatile unsigned long SDL_MintAudio_clocktics;
extern unsigned short SDL_MintAudio_hasfpu; /* To preserve fpu registers if needed */
/* MiNT thread variables */
extern SDL_bool SDL_MintAudio_mint_present;
@ -135,6 +136,7 @@ void SDL_MintAudio_Callback(void);
void SDL_MintAudio_AddFrequency(_THIS, Uint32 frequency, Uint32 clock,
Uint32 prediv, int gpio_bits);
int SDL_MintAudio_SearchFrequency(_THIS, int desired_freq);
void SDL_MintAudio_CheckFpu(void);
/* MiNT thread functions */
int SDL_MintAudio_Thread(long param);

View file

@ -217,6 +217,9 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq));
if (spec->channels > 2)
spec->channels = 2;
/* Check formats available */
spec->format = AUDIO_S8;
@ -349,6 +352,8 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
SDL_MintAudio_CheckFpu();
/* Setup audio hardware */
Mint_InitAudio(this, spec);

View file

@ -201,6 +201,8 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
{
long snd_format;
int i, resolution, format_signed, format_bigendian;
Uint16 test_format = SDL_FirstAudioFormat(spec->format);
int valid_datatype = 0;
resolution = spec->format & 0x00ff;
format_signed = ((spec->format & 0x8000)!=0);
@ -212,28 +214,46 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq));
/* Check formats available */
snd_format = Sndstatus(SND_QUERYFORMATS);
switch (resolution) {
case 8:
if ((snd_format & SND_FORMAT8)==0) {
SDL_SetError("Mint_CheckAudio: 8 bits samples not supported");
return -1;
}
snd_format = Sndstatus(SND_QUERY8BIT);
break;
case 16:
if ((snd_format & SND_FORMAT16)==0) {
SDL_SetError("Mint_CheckAudio: 16 bits samples not supported");
return -1;
}
snd_format = Sndstatus(SND_QUERY16BIT);
break;
default:
SDL_SetError("Mint_CheckAudio: Unsupported sample resolution");
return -1;
break;
}
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
}
while ((!valid_datatype) && (test_format)) {
/* Check formats available */
snd_format = Sndstatus(SND_QUERYFORMATS);
spec->format = test_format;
resolution = spec->format & 0xff;
format_signed = (spec->format & (1<<15));
format_bigendian = (spec->format & (1<<12));
switch (test_format) {
case AUDIO_U8:
case AUDIO_S8:
if (snd_format & SND_FORMAT8) {
valid_datatype = 1;
snd_format = Sndstatus(SND_QUERY8BIT);
}
break;
case AUDIO_U16LSB:
case AUDIO_S16LSB:
case AUDIO_U16MSB:
case AUDIO_S16MSB:
if (snd_format & SND_FORMAT16) {
valid_datatype = 1;
snd_format = Sndstatus(SND_QUERY16BIT);
}
break;
default:
test_format = SDL_NextAudioFormat();
break;
}
}
if (!valid_datatype) {
SDL_SetError("Unsupported audio format");
return (-1);
}
/* Check signed/unsigned format */
if (format_signed) {
@ -386,6 +406,8 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
SDL_MintAudio_CheckFpu();
/* Setup audio hardware */
Mint_InitAudio(this, spec);

View file

@ -40,6 +40,7 @@
.globl _SDL_MintAudio_numbuf
.globl _SDL_MintAudio_audiosize
.globl _SDL_MintAudio_clocktics
.globl _SDL_MintAudio_hasfpu
.globl _SDL_MintAudio_stfa
@ -77,7 +78,7 @@ _SDL_MintAudio_XbiosInterrupt:
/* Check if we are not already running */
tstw _SDL_MintAudio_mutex
bnes SDL_MintAudio_XbiosEnd
bne SDL_MintAudio_XbiosEnd
notw _SDL_MintAudio_mutex
/* Swap buffers */
@ -85,9 +86,29 @@ _SDL_MintAudio_XbiosInterrupt:
moveml d0-d7/a0-a6,sp@-
/* Save FPU if needed */
tstw _SDL_MintAudio_hasfpu
beqs SDL_MintAudio_Xbios_nofpu1
.chip 68060
fsave sp@-
fmoveml fpcr/fpsr/fpiar,sp@-
fmovemx fp0-fp7,sp@-
.chip 68000
SDL_MintAudio_Xbios_nofpu1:
/* Callback */
jsr _SDL_MintAudio_Callback
/* Restore FPU if needed */
tstw _SDL_MintAudio_hasfpu
beqs SDL_MintAudio_Xbios_nofpu2
.chip 68060
fmovemx sp@+,fp0-fp7
fmoveml sp@+,fpcr/fpsr/fpiar
frestore sp@+
.chip 68000
SDL_MintAudio_Xbios_nofpu2:
/* Reserve space for registers */
subl #savamt,savptr
@ -131,17 +152,37 @@ _SDL_MintAudio_Dma8Interrupt:
/* Check if we are not already running */
tstw _SDL_MintAudio_mutex
bnes SDL_MintAudio_Dma8End
bne SDL_MintAudio_Dma8End
notw _SDL_MintAudio_mutex
/* Swap buffers */
eorw #1,_SDL_MintAudio_numbuf
moveml d0-d7/a0-a6,sp@-
moveml d0-d1/a0-a1,sp@-
/* Save FPU if needed */
tstw _SDL_MintAudio_hasfpu
beqs SDL_MintAudio_Dma8_nofpu1
.chip 68060
fsave sp@-
fmoveml fpcr/fpsr/fpiar,sp@-
fmovemx fp0-fp7,sp@-
.chip 68000
SDL_MintAudio_Dma8_nofpu1:
/* Callback */
jsr _SDL_MintAudio_Callback
/* Restore FPU if needed */
tstw _SDL_MintAudio_hasfpu
beqs SDL_MintAudio_Dma8_nofpu2
.chip 68060
fmovemx sp@+,fp0-fp7
fmoveml sp@+,fpcr/fpsr/fpiar
frestore sp@+
.chip 68000
SDL_MintAudio_Dma8_nofpu2:
/* Set new buffer */
moveq #0,d0
@ -169,7 +210,7 @@ _SDL_MintAudio_Dma8Interrupt:
rorl #8,d1
moveb d1,a0@(0x0f)
moveml sp@+,d0-d7/a0-a6
moveml sp@+,d0-d1/a0-a1
clrw _SDL_MintAudio_mutex
SDL_MintAudio_Dma8End:
@ -195,9 +236,29 @@ _SDL_MintAudio_StfaInterrupt:
moveml d0-d7/a0-a6,sp@-
/* Save FPU if needed */
tstw _SDL_MintAudio_hasfpu
beqs SDL_MintAudio_Stfa_nofpu1
.chip 68060
fsave sp@-
fmoveml fpcr/fpsr/fpiar,sp@-
fmovemx fp0-fp7,sp@-
.chip 68000
SDL_MintAudio_Stfa_nofpu1:
/* Callback */
jsr _SDL_MintAudio_Callback
/* Restore FPU if needed */
tstw _SDL_MintAudio_hasfpu
beqs SDL_MintAudio_Stfa_nofpu2
.chip 68060
fmovemx sp@+,fp0-fp7
fmoveml sp@+,fpcr/fpsr/fpiar
frestore sp@+
.chip 68000
SDL_MintAudio_Stfa_nofpu2:
/* Set new buffer */
moveq #0,d0

View file

@ -224,6 +224,10 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq));
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
}
/* Check formats available */
MINTAUDIO_freqcount=0;
switch(cookie_mcsn->play) {
@ -391,6 +395,8 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
SDL_MintAudio_CheckFpu();
/* Setup audio hardware */
Mint_InitAudio(this, spec);

View file

@ -205,6 +205,10 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq));
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
}
/* Check formats available */
MINTAUDIO_freqcount=0;
for (i=0;i<16;i++) {
@ -310,6 +314,8 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
SDL_MintAudio_CheckFpu();
/* Setup audio hardware */
Mint_InitAudio(this, spec);

View file

@ -82,7 +82,8 @@ static int Audio_Available(void)
unsigned long dummy;
const char *envr = SDL_getenv("SDL_AUDIODRIVER");
SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);
/*SDL_MintAudio_mint_present = (Getcookie(C_MiNT, &dummy) == C_FOUND);*/
SDL_MintAudio_mint_present = SDL_FALSE;
/* We can't use XBIOS in interrupt with Magic, don't know about thread */
if (Getcookie(C_MagX, &dummy) == C_FOUND) {
@ -341,6 +342,10 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq));
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
}
spec->format |= 0x8000; /* Audio is always signed */
if ((spec->format & 0x00ff)==16) {
spec->format |= 0x1000; /* Audio is always big endian */
@ -433,7 +438,8 @@ static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec)
} else {
/* Install interrupt */
Jdisint(MFP_DMASOUND);
Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt);
/*Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_XbiosInterrupt);*/
Xbtimer(XB_TIMERA, 8, 1, SDL_MintAudio_Dma8Interrupt);
Jenabint(MFP_DMASOUND);
if (Setinterrupt(SI_TIMERA, SI_PLAY)<0) {
@ -480,6 +486,8 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec)
DEBUG_PRINT((DEBUG_NAME "buffer 0 at 0x%08x\n", SDL_MintAudio_audiobuf[0]));
DEBUG_PRINT((DEBUG_NAME "buffer 1 at 0x%08x\n", SDL_MintAudio_audiobuf[1]));
SDL_MintAudio_CheckFpu();
/* Setup audio hardware */
Mint_InitAudio(this, spec);

View file

@ -0,0 +1,335 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
/* Allow access to a raw mixing buffer */
#include <nds.h>
#include "SDL.h"
#include "SDL_endian.h"
#include "SDL_timer.h"
#include "SDL_audio.h"
#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
#include "SDL_ndsaudio.h"
#include "soundcommon.h"
/* Audio driver functions */
static int NDS_OpenAudio(_THIS, SDL_AudioSpec *spec);
static void NDS_WaitAudio(_THIS);
static void NDS_PlayAudio(_THIS);
static Uint8 *NDS_GetAudioBuf(_THIS);
static void NDS_CloseAudio(_THIS);
/* Audio driver bootstrap functions */
u32 framecounter = 0,soundoffset = 0;
static SDL_AudioDevice *sdl_nds_audiodevice;
//void SoundMixCallback(void *stream,u32 size)
//{
// //printf("SoundMixCallback\n");
//
// Uint8 *buffer;
//
// buffer = sdl_nds_audiodevice->hidden->mixbuf;
// memset(buffer, sdl_nds_audiodevice->spec.silence, size);
//
// if (!sdl_nds_audiodevice->paused){
//
//
// //if (sdl_nds_audiodevice->convert.needed) {
// // int silence;
//
// // if (sdl_nds_audiodevice->convert.src_format == AUDIO_U8 ) {
// // silence = 0x80;
// // } else {
// // silence = 0;
// // }
// // memset(sdl_nds_audiodevice->convert.buf, silence, sdl_nds_audiodevice->convert.len);
// // sdl_nds_audiodevice->spec.callback(sdl_nds_audiodevice->spec.userdata,
// // (Uint8 *)sdl_nds_audiodevice->convert.buf,sdl_nds_audiodevice->convert.len);
// // SDL_ConvertAudio(&sdl_nds_audiodevice->convert);
// // memcpy(buffer, sdl_nds_audiodevice->convert.buf, sdl_nds_audiodevice->convert.len_cvt);
// //} else
// {
// sdl_nds_audiodevice->spec.callback(sdl_nds_audiodevice->spec.userdata, buffer, size);
// //memcpy((Sint16 *)stream,buffer, size);
// }
//
// }
//
// if(soundsystem->format == 8)
// {
// int i;
// s32 *buffer32 = (s32 *)buffer;
// s32 *stream32 = (s32 *)stream;
// for(i=0;i<size/4;i++){ *stream32++ = buffer32[i] ^ 0x80808080;}
// //for(i = 0; i < size; i++)
// // ((s8*)stream)[i]=(buffer[i]^0x80);
// }
// else
// {
// int i;
// for(i = 0; i < size; i++){
// //((short*)stream)[i] =(short)buffer[i] << 8; // sound 8bit ---> buffer 16bit
// //if (buffer[i] &0x80)
// //((Sint16*)stream)[i] = 0xff00 | buffer[i];
// ((Sint16*)stream)[i] = (buffer[i] - 128) << 8;
//
// //else
// // ((Sint16*)stream)[i] = buffer[i];
// }
// //register signed char *pSrc =buffer;
// //register short *pDest =stream;
// //int x;
// // for (x=size; x>0; x--)
// // {
// // register short temp = (((short)*pSrc)-128)<<8;
// // pSrc++;
// // *pDest++ = temp;
// // }
//
// //memcpy((Sint16 *)stream,buffer, size);
// }
//}
void SoundMixCallback(void *stream,u32 len)
{
SDL_AudioDevice *audio = (SDL_AudioDevice *)sdl_nds_audiodevice;
/* Silence the buffer, since it's ours */
SDL_memset(stream, audio->spec.silence, len);
/* Only do soemthing if audio is enabled */
if ( ! audio->enabled )
return;
if ( ! audio->paused ) {
if ( audio->convert.needed ) {
//fprintf(stderr,"converting audio\n");
SDL_mutexP(audio->mixer_lock);
(*audio->spec.callback)(audio->spec.userdata,
(Uint8 *)audio->convert.buf,audio->convert.len);
SDL_mutexV(audio->mixer_lock);
SDL_ConvertAudio(&audio->convert);
SDL_memcpy(stream,audio->convert.buf,audio->convert.len_cvt);
} else {
SDL_mutexP(audio->mixer_lock);
(*audio->spec.callback)(audio->spec.userdata,
(Uint8 *)stream, len);
SDL_mutexV(audio->mixer_lock);
}
}
return;
}
void MixSound(void)
{
int remain;
if(soundsystem->format == 8)
{
if((soundsystem->soundcursor + soundsystem->numsamples) > soundsystem->buffersize)
{
SoundMixCallback(&soundsystem->mixbuffer[soundsystem->soundcursor],soundsystem->buffersize - soundsystem->soundcursor);
remain = soundsystem->numsamples - (soundsystem->buffersize - soundsystem->soundcursor);
SoundMixCallback(soundsystem->mixbuffer,remain);
}
else
{
SoundMixCallback(&soundsystem->mixbuffer[soundsystem->soundcursor],soundsystem->numsamples);
}
}
else
{
if((soundsystem->soundcursor + soundsystem->numsamples) > (soundsystem->buffersize >> 1))
{
SoundMixCallback(&soundsystem->mixbuffer[soundsystem->soundcursor << 1],(soundsystem->buffersize >> 1) - soundsystem->soundcursor);
remain = soundsystem->numsamples - ((soundsystem->buffersize >> 1) - soundsystem->soundcursor);
SoundMixCallback(soundsystem->mixbuffer,remain);
}
else
{
SoundMixCallback(&soundsystem->mixbuffer[soundsystem->soundcursor << 1],soundsystem->numsamples);
}
}
}
void InterruptHandler(void)
{
framecounter++;
}
void FiFoHandler(void)
{
u32 command;
while ( !(REG_IPC_FIFO_CR & (IPC_FIFO_RECV_EMPTY)) )
{
command = REG_IPC_FIFO_RX;
switch(command)
{
case FIFO_NONE:
break;
case UPDATEON_ARM9:
REG_IME = 0;
MixSound();
REG_IME = 1;
SendCommandToArm7(MIXCOMPLETE_ONARM9);
break;
}
}
}
static int Audio_Available(void)
{
return(1);
}
static void Audio_DeleteDevice(SDL_AudioDevice *device)
{
}
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
{
SDL_AudioDevice *this;
/* Initialize all variables that we clean on shutdown */
this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
if ( this ) {
SDL_memset(this, 0, (sizeof *this));
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
}
if ( (this == NULL) || (this->hidden == NULL) ) {
SDL_OutOfMemory();
if ( this ) {
SDL_free(this);
}
return(0);
}
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
/* Set the function pointers */
this->OpenAudio = NDS_OpenAudio;
this->WaitAudio = NDS_WaitAudio;
this->PlayAudio = NDS_PlayAudio;
this->GetAudioBuf = NDS_GetAudioBuf;
this->CloseAudio = NDS_CloseAudio;
this->free = Audio_DeleteDevice;
//fprintf(stderr,"Audio_CreateDevice\n");
return this;
}
AudioBootStrap NDSAUD_bootstrap = {
"nds", "NDS audio",
Audio_Available, Audio_CreateDevice
};
void static NDS_WaitAudio(_THIS)
{
//printf("NDS_WaitAudio\n");
}
static void NDS_PlayAudio(_THIS)
{
//printf("playing audio\n");
if (this->paused)
return;
}
static Uint8 *NDS_GetAudioBuf(_THIS)
{
return NULL;//(this->hidden->mixbuf);
}
static void NDS_CloseAudio(_THIS)
{
/* if ( this->hidden->mixbuf != NULL ) {
SDL_FreeAudioMem(this->hidden->mixbuf);
this->hidden->mixbuf = NULL;
}*/
}
static int NDS_OpenAudio(_THIS, SDL_AudioSpec *spec)
{
//printf("NDS_OpenAudio\n");
int format = 0;
//switch(spec->format&0xff) {
//case 8: spec->format = AUDIO_S8;format=8; break;
//case 16: spec->format = AUDIO_S16LSB;format=16; break;
//default:
// SDL_SetError("Unsupported audio format");
// return(-1);
//}
switch (spec->format&~0x1000) {
case AUDIO_S8:
/* Signed 8-bit audio supported */
format=8;
break;
case AUDIO_U8:
spec->format ^= 0x80;format=8;
break;
case AUDIO_U16:
/* Unsigned 16-bit audio unsupported, convert to S16 */
spec->format ^=0x8000;format=16;
case AUDIO_S16:
/* Signed 16-bit audio supported */
format=16;
break;
}
/* Update the fragment size as size in bytes */
SDL_CalculateAudioSpec(spec);
/* Allocate mixing buffer */
//this->hidden->mixlen = spec->size;
//this->hidden->mixbuf = (Uint8 *) SDL_AllocAudioMem(this->hidden->mixlen);
//if ( this->hidden->mixbuf == NULL ) {
// SDL_SetError("Out of Memory");
// return(-1);
//}
SDL_NDSAudio_mutex = 0;
sdl_nds_audiodevice=this;
irqInit();
irqSet(IRQ_VBLANK,&InterruptHandler);
irqSet(IRQ_FIFO_NOT_EMPTY,&FiFoHandler);
irqEnable(IRQ_FIFO_NOT_EMPTY);
REG_IPC_FIFO_CR = IPC_FIFO_ENABLE | IPC_FIFO_SEND_CLEAR | IPC_FIFO_RECV_IRQ;
SoundSystemInit(spec->freq,spec->size,0,format);
SoundStartMixer();
return(1);
}

View file

@ -21,12 +21,20 @@
*/
#include "SDL_config.h"
#include "SDL_cgxvideo.h"
#ifndef _SDL_lowaudio_h
#define _SDL_lowaudio_h
/* Functions to be exported */
extern void amiga_FreeWMCursor(_THIS, WMcursor *cursor);
extern WMcursor *amiga_CreateWMCursor(_THIS,
Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
extern int amiga_ShowWMCursor(_THIS, WMcursor *cursor);
extern void amiga_WarpWMCursor(_THIS, Uint16 x, Uint16 y);
extern void amiga_CheckMouseMode(_THIS);
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData {
/* The file descriptor for the audio device */
//Uint8 *mixbuf;
//Uint32 mixlen;
};
unsigned short SDL_NDSAudio_mutex=0;
#endif /* _SDL_lowaudio_h */

View file

@ -20,42 +20,42 @@
slouken@libsdl.org
*/
#include "SDL_config.h"
#include "SDL_stdinc.h"
#include <exec/exec.h>
#include <dos/dos.h>
#include <dos/dostags.h>
#if defined (__SASC) || defined(STORMC4_WOS)
#include <proto/dos.h>
#include <proto/exec.h>
#else
#include <inline/dos.h>
#include <inline/exec.h>
#endif
#include "soundcommon.h"
#include "mydebug.h"
void SoundSystemInit(u32 rate,u32 buffersize,u8 channel,u8 format)
{
soundsystem->rate = rate;
if(format == 8)
soundsystem->buffersize = buffersize;
else if(format == 16)
soundsystem->buffersize = buffersize * sizeof(short);
extern struct ExecBase *SysBase;
extern struct DosLibrary *DOSBase;
soundsystem->mixbuffer = (s8*)SDL_malloc(soundsystem->buffersize);
//soundsystem->soundbuffer = soundsystem->mixbuffer;
soundsystem->format = format;
soundsystem->channel = channel;
soundsystem->prevtimer = 0;
soundsystem->soundcursor = 0;
soundsystem->numsamples = 0;
soundsystem->period = 0x1000000 / rate;
soundsystem->cmd = INIT;
}
#ifdef STORMC4_WOS
#include <proto/powerpc.h>
/* use powerpc.library functions instead og exec */
#define SYS_ThreadHandle struct TaskPPC *
#define Signal SignalPPC
#define Wait WaitPPC
#define Task TaskPPC
#define FindTask FindTaskPPC
#define SetSignal SetSignalPPC
#define InitSemaphore InitSemaphorePPC
#define ObtainSemaphore ObtainSemaphorePPC
#define AttemptSemaphore AttemptSemaphorePPC
#define ReleaseSemaphore ReleaseSemaphorePPC
#define SignalSemaphore SignalSemaphorePPC
#else
#define SYS_ThreadHandle struct Task *
#endif /*STORMC4_WOS*/
void SoundStartMixer(void)
{
soundsystem->cmd |= MIX;
}
void SendCommandToArm7(u32 command)
{
while (REG_IPC_FIFO_CR & IPC_FIFO_SEND_FULL);
if (REG_IPC_FIFO_CR & IPC_FIFO_ERROR)
{
REG_IPC_FIFO_CR |= IPC_FIFO_SEND_CLEAR;
}
REG_IPC_FIFO_TX = command;
}

View file

@ -0,0 +1,80 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifndef __SOUNDCOMMON_H
#define __SOUNDCOMMON_H
#include <nds.h>
#define CLOCK (1 << 25)
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
NONE = 0,
INIT = 1,
MIX = 2,
MIXING = 4,
STOP = 8
}CommandType;
typedef enum
{
FIFO_NONE = 0,
UPDATEON_ARM9 = 1,
MIXCOMPLETE_ONARM9 = 2,
}FifoType;
typedef struct
{
s8 *mixbuffer;//,*soundbuffer;
u32 rate;
u32 buffersize;
u32 cmd;
u8 channel,format;
u32 soundcursor,numsamples;
s32 prevtimer;
s16 period;
}S_SoundSystem;
#define soundsystem ((S_SoundSystem*)((u32)(IPC)+sizeof(TransferRegion)))
#ifdef ARM9
extern void SoundSystemInit(u32 rate,u32 buffersize,u8 channel,u8 format);
extern void SoundStartMixer(void);
extern void SendCommandToArm7(u32 command);
#else
extern void SoundVBlankIrq(void);
extern void SoundSwapAndMix(void);
extern void SoundSetTimer(int period);
extern void SoundFifoHandler(void);
extern void SendCommandToArm9(u32 command);
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,377 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2007 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Stéphan Kochen
stephan@kochen.nl
Based on parts of the ALSA and ESounD output drivers.
*/
#include "SDL_config.h"
/* Allow access to an PulseAudio network stream mixing buffer */
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <pulse/simple.h>
#include "SDL_timer.h"
#include "SDL_audio.h"
#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
#include "../SDL_audiodev_c.h"
#include "SDL_pulseaudio.h"
#ifdef SDL_AUDIO_DRIVER_PULSE_DYNAMIC
#include "SDL_name.h"
#include "SDL_loadso.h"
#else
#define SDL_NAME(X) X
#endif
/* The tag name used by the driver */
#define PULSE_DRIVER_NAME "pulse"
/* Audio driver functions */
static int PULSE_OpenAudio(_THIS, SDL_AudioSpec *spec);
static void PULSE_WaitAudio(_THIS);
static void PULSE_PlayAudio(_THIS);
static Uint8 *PULSE_GetAudioBuf(_THIS);
static void PULSE_CloseAudio(_THIS);
#ifdef SDL_AUDIO_DRIVER_PULSE_DYNAMIC
static const char *pulse_library = SDL_AUDIO_DRIVER_PULSE_DYNAMIC;
static void *pulse_handle = NULL;
static int pulse_loaded = 0;
static pa_simple* (*SDL_NAME(pa_simple_new))(
const char *server,
const char *name,
pa_stream_direction_t dir,
const char *dev,
const char *stream_name,
const pa_sample_spec *ss,
const pa_channel_map *map,
const pa_buffer_attr *attr,
int *error
);
static void (*SDL_NAME(pa_simple_free))(pa_simple *s);
static int (*SDL_NAME(pa_simple_drain))(pa_simple *s, int *error);
static int (*SDL_NAME(pa_simple_write))(
pa_simple *s,
const void *data,
size_t length,
int *error
);
static pa_channel_map* (*SDL_NAME(pa_channel_map_init_auto))(
pa_channel_map *m,
unsigned channels,
pa_channel_map_def_t def
);
static struct {
const char *name;
void **func;
} pulse_functions[] = {
{ "pa_simple_new",
(void **)&SDL_NAME(pa_simple_new) },
{ "pa_simple_free",
(void **)&SDL_NAME(pa_simple_free) },
{ "pa_simple_drain",
(void **)&SDL_NAME(pa_simple_drain) },
{ "pa_simple_write",
(void **)&SDL_NAME(pa_simple_write) },
{ "pa_channel_map_init_auto",
(void **)&SDL_NAME(pa_channel_map_init_auto) },
};
static void UnloadPulseLibrary()
{
if ( pulse_loaded ) {
SDL_UnloadObject(pulse_handle);
pulse_handle = NULL;
pulse_loaded = 0;
}
}
static int LoadPulseLibrary(void)
{
int i, retval = -1;
pulse_handle = SDL_LoadObject(pulse_library);
if ( pulse_handle ) {
pulse_loaded = 1;
retval = 0;
for ( i=0; i<SDL_arraysize(pulse_functions); ++i ) {
*pulse_functions[i].func = SDL_LoadFunction(pulse_handle, pulse_functions[i].name);
if ( !*pulse_functions[i].func ) {
retval = -1;
UnloadPulseLibrary();
break;
}
}
}
return retval;
}
#else
static void UnloadPulseLibrary()
{
return;
}
static int LoadPulseLibrary(void)
{
return 0;
}
#endif /* SDL_AUDIO_DRIVER_PULSE_DYNAMIC */
/* Audio driver bootstrap functions */
static int Audio_Available(void)
{
pa_sample_spec paspec;
pa_simple *connection;
int available;
available = 0;
if ( LoadPulseLibrary() < 0 ) {
return available;
}
/* Connect with a dummy format. */
paspec.format = PA_SAMPLE_U8;
paspec.rate = 11025;
paspec.channels = 1;
connection = SDL_NAME(pa_simple_new)(
SDL_getenv("PASERVER"), /* server */
"Test stream", /* application name */
PA_STREAM_PLAYBACK, /* playback mode */
SDL_getenv("PADEVICE"), /* device on the server */
"Simple DirectMedia Layer", /* stream description */
&paspec, /* sample format spec */
NULL, /* channel map */
NULL, /* buffering attributes */
NULL /* error code */
);
if ( connection != NULL ) {
available = 1;
SDL_NAME(pa_simple_free)(connection);
}
UnloadPulseLibrary();
return(available);
}
static void Audio_DeleteDevice(SDL_AudioDevice *device)
{
SDL_free(device->hidden);
SDL_free(device);
UnloadPulseLibrary();
}
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
{
SDL_AudioDevice *this;
/* Initialize all variables that we clean on shutdown */
LoadPulseLibrary();
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
if ( this ) {
SDL_memset(this, 0, (sizeof *this));
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
}
if ( (this == NULL) || (this->hidden == NULL) ) {
SDL_OutOfMemory();
if ( this ) {
SDL_free(this);
}
return(0);
}
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
/* Set the function pointers */
this->OpenAudio = PULSE_OpenAudio;
this->WaitAudio = PULSE_WaitAudio;
this->PlayAudio = PULSE_PlayAudio;
this->GetAudioBuf = PULSE_GetAudioBuf;
this->CloseAudio = PULSE_CloseAudio;
this->free = Audio_DeleteDevice;
return this;
}
AudioBootStrap PULSE_bootstrap = {
PULSE_DRIVER_NAME, "PulseAudio",
Audio_Available, Audio_CreateDevice
};
/* This function waits until it is possible to write a full sound buffer */
static void PULSE_WaitAudio(_THIS)
{
/* Check to see if the thread-parent process is still alive */
{ static int cnt = 0;
/* Note that this only works with thread implementations
that use a different process id for each thread.
*/
if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */
if ( kill(parent, 0) < 0 ) {
this->enabled = 0;
}
}
}
}
static void PULSE_PlayAudio(_THIS)
{
/* Write the audio data */
if ( SDL_NAME(pa_simple_write)(stream, mixbuf, mixlen, NULL) != 0 )
{
this->enabled = 0;
}
}
static Uint8 *PULSE_GetAudioBuf(_THIS)
{
return(mixbuf);
}
static void PULSE_CloseAudio(_THIS)
{
if ( mixbuf != NULL ) {
SDL_FreeAudioMem(mixbuf);
mixbuf = NULL;
}
if ( stream != NULL ) {
SDL_NAME(pa_simple_drain)(stream, NULL);
SDL_NAME(pa_simple_free)(stream);
stream = NULL;
}
}
/* Try to get the name of the program */
static char *get_progname(void)
{
char *progname = NULL;
#ifdef __LINUX__
FILE *fp;
static char temp[BUFSIZ];
SDL_snprintf(temp, SDL_arraysize(temp), "/proc/%d/cmdline", getpid());
fp = fopen(temp, "r");
if ( fp != NULL ) {
if ( fgets(temp, sizeof(temp)-1, fp) ) {
progname = SDL_strrchr(temp, '/');
if ( progname == NULL ) {
progname = temp;
} else {
progname = progname+1;
}
}
fclose(fp);
}
#endif
return(progname);
}
static int PULSE_OpenAudio(_THIS, SDL_AudioSpec *spec)
{
Uint16 test_format;
pa_sample_spec paspec;
pa_buffer_attr paattr;
pa_channel_map pacmap;
paspec.format = PA_SAMPLE_INVALID;
for ( test_format = SDL_FirstAudioFormat(spec->format); test_format; ) {
switch ( test_format ) {
case AUDIO_U8:
paspec.format = PA_SAMPLE_U8;
break;
case AUDIO_S16LSB:
paspec.format = PA_SAMPLE_S16LE;
break;
case AUDIO_S16MSB:
paspec.format = PA_SAMPLE_S16BE;
break;
}
if ( paspec.format != PA_SAMPLE_INVALID )
break;
}
if (paspec.format == PA_SAMPLE_INVALID ) {
SDL_SetError("Couldn't find any suitable audio formats");
return(-1);
}
spec->format = test_format;
paspec.channels = spec->channels;
paspec.rate = spec->freq;
/* Calculate the final parameters for this audio specification */
SDL_CalculateAudioSpec(spec);
/* Allocate mixing buffer */
mixlen = spec->size;
mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
if ( mixbuf == NULL ) {
return(-1);
}
SDL_memset(mixbuf, spec->silence, spec->size);
/* Reduced prebuffering compared to the defaults. */
paattr.tlength = mixlen;
paattr.minreq = mixlen;
paattr.fragsize = mixlen;
paattr.prebuf = mixlen;
paattr.maxlength = mixlen * 4;
/* The SDL ALSA output hints us that we use Windows' channel mapping */
/* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */
SDL_NAME(pa_channel_map_init_auto)(
&pacmap, spec->channels, PA_CHANNEL_MAP_WAVEEX);
/* Connect to the PulseAudio server */
stream = SDL_NAME(pa_simple_new)(
SDL_getenv("PASERVER"), /* server */
get_progname(), /* application name */
PA_STREAM_PLAYBACK, /* playback mode */
SDL_getenv("PADEVICE"), /* device on the server */
"Simple DirectMedia Layer", /* stream description */
&paspec, /* sample format spec */
&pacmap, /* channel map */
&paattr, /* buffering attributes */
NULL /* error code */
);
if ( stream == NULL ) {
PULSE_CloseAudio(this);
SDL_SetError("Could not connect to PulseAudio");
return(-1);
}
/* Get the parent process id (we're the parent of the audio thread) */
parent = getpid();
return(0);
}

View file

@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
Copyright (C) 1997-2007 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -16,45 +16,38 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
Stéphan Kochen
stephan@kochen.nl
Based on parts of the ALSA and ESounD output drivers.
*/
#include "SDL_config.h"
#ifndef _SDL_ahiaudio_h
#define _SDL_ahiaudio_h
#include <exec/exec.h>
#include <dos/dos.h>
#ifdef __SASC
#include <proto/exec.h>
#else
#include <inline/exec.h>
#endif
#include <devices/ahi.h>
#include "mydebug.h"
#ifndef _SDL_pulseaudio_h
#define _SDL_pulseaudio_h
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the audio functions */
/* Hidden "this" pointer for the video functions */
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData {
/* The handle for the audio device */
struct AHIRequest *audio_req[2];
struct MsgPort *audio_port;
Sint32 freq,type,bytespersample,size;
Uint8 *mixbuf[2]; /* The app mixing buffer */
int current_buffer;
Uint32 playing;
/* The audio stream handle */
pa_simple * stream;
/* The parent process id, to detect when application quits */
pid_t parent;
/* Raw mixing buffer */
Uint8 *mixbuf;
int mixlen;
};
/* Old variable names */
#define audio_port (this->hidden->audio_port)
#define audio_req (this->hidden->audio_req)
#define stream (this->hidden->stream)
#define parent (this->hidden->parent)
#define mixbuf (this->hidden->mixbuf)
#define current_buffer (this->hidden->current_buffer)
#define playing (this->hidden->playing)
#define mixlen (this->hidden->mixlen)
#endif /* _SDL_pulseaudio_h */
#endif /* _SDL_ahiaudio_h */

View file

@ -0,0 +1,614 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@devolution.com
*/
/*
SDL_epocaudio.cpp
Epoc based SDL audio driver implementation
Markus Mertama
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_epocaudio.c,v 0.0.0.0 2001/06/19 17:19:56 hercules Exp $";
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include "epoc_sdl.h"
#include <e32hal.h>
extern "C" {
#include "SDL_audio.h"
#include "SDL_error.h"
#include "SDL_audiomem.h"
#include "SDL_audio_c.h"
#include "SDL_timer.h"
#include "SDL_audiodev_c.h"
}
#include "SDL_epocaudio.h"
#include "streamplayer.h"
//#define DEBUG_AUDIO
/* Audio driver functions */
static int EPOC_OpenAudio(SDL_AudioDevice *thisdevice, SDL_AudioSpec *spec);
static void EPOC_WaitAudio(SDL_AudioDevice *thisdevice);
static void EPOC_PlayAudio(SDL_AudioDevice *thisdevice);
static Uint8 *EPOC_GetAudioBuf(SDL_AudioDevice *thisdevice);
static void EPOC_CloseAudio(SDL_AudioDevice *thisdevice);
static void EPOC_ThreadInit(SDL_AudioDevice *thisdevice);
static int Audio_Available(void);
static SDL_AudioDevice *Audio_CreateDevice(int devindex);
static void Audio_DeleteDevice(SDL_AudioDevice *device);
//void sos_adump(SDL_AudioDevice* thisdevice, void* data, int len);
#ifdef __WINS__
#define DODUMP
#endif
#ifdef DODUMP
NONSHARABLE_CLASS(TDump)
{
public:
TInt Open();
void Close();
void Dump(const TDesC8& aDes);
private:
RFile iFile;
RFs iFs;
};
TInt TDump::Open()
{
TInt err = iFs.Connect();
if(err == KErrNone)
{
#ifdef __WINS__
_LIT(target, "C:\\sdlau.raw");
#else
_LIT(target, "E:\\sdlau.raw");
#endif
err = iFile.Replace(iFs, target, EFileWrite);
}
return err;
}
void TDump::Close()
{
iFile.Close();
iFs.Close();
}
void TDump::Dump(const TDesC8& aDes)
{
iFile.Write(aDes);
}
#endif
NONSHARABLE_CLASS(CSimpleWait) : public CTimer
{
public:
void Wait(TTimeIntervalMicroSeconds32 aWait);
static CSimpleWait* NewL();
private:
CSimpleWait();
void RunL();
};
CSimpleWait* CSimpleWait::NewL()
{
CSimpleWait* wait = new (ELeave) CSimpleWait();
CleanupStack::PushL(wait);
wait->ConstructL();
CleanupStack::Pop();
return wait;
}
void CSimpleWait::Wait(TTimeIntervalMicroSeconds32 aWait)
{
After(aWait);
CActiveScheduler::Start();
}
CSimpleWait::CSimpleWait() : CTimer(CActive::EPriorityStandard)
{
CActiveScheduler::Add(this);
}
void CSimpleWait::RunL()
{
CActiveScheduler::Stop();
}
const TInt KAudioBuffers(2);
NONSHARABLE_CLASS(CEpocAudio) : public CBase, public MStreamObs, public MStreamProvider
{
public:
static void* NewL(TInt BufferSize, TInt aFill);
inline static CEpocAudio& Current(SDL_AudioDevice* thisdevice);
static void Free(SDL_AudioDevice* thisdevice);
void Wait();
void Play();
// void SetBuffer(const TDesC8& aBuffer);
void ThreadInitL(TAny* aDevice);
void Open(TInt iRate, TInt iChannels, TUint32 aType, TInt aBytes);
~CEpocAudio();
TUint8* Buffer();
TBool SetPause(TBool aPause);
#ifdef DODUMP
void Dump(const TDesC8& aBuf) {iDump.Dump(aBuf);}
#endif
private:
CEpocAudio(TInt aBufferSize);
void Complete(TInt aState, TInt aError);
TPtrC8 Data();
void ConstructL(TInt aFill);
private:
TInt iBufferSize;
CStreamPlayer* iPlayer;
TInt iBufferRate;
TInt iRate;
TInt iChannels;
TUint32 iType;
TInt iPosition;
TThreadId iTid;
TUint8* iAudioPtr;
TUint8* iBuffer;
// TTimeIntervalMicroSeconds iStart;
TTime iStart;
TInt iTune;
CSimpleWait* iWait;
#ifdef DODUMP
TDump iDump;
#endif
};
inline CEpocAudio& CEpocAudio::Current(SDL_AudioDevice* thisdevice)
{
return *static_cast<CEpocAudio*>((void*)thisdevice->hidden);
}
/*
TBool EndSc(TAny*)
{
CActiveScheduler::Stop();
}
LOCAL_C void CleanScL()
{
CIdle* d = CIdle::NewLC(CActive:::EPriorityIdle);
d->Start(TCallBack(EndSc));
CActiveScheduler::Start();
}
*/
void CEpocAudio::Free(SDL_AudioDevice* thisdevice)
{
CEpocAudio* ea = static_cast<CEpocAudio*>((void*)thisdevice->hidden);
if(ea)
{
ASSERT(ea->iTid == RThread().Id());
delete ea;
thisdevice->hidden = NULL;
CActiveScheduler* as = CActiveScheduler::Current();
ASSERT(as->StackDepth() == 0);
delete as;
CActiveScheduler::Install(NULL);
}
ASSERT(thisdevice->hidden == NULL);
}
CEpocAudio::CEpocAudio(TInt aBufferSize) : iBufferSize(aBufferSize), iPosition(-1)
{
}
void* CEpocAudio::NewL(TInt aBufferSize, TInt aFill)
{
CEpocAudio* eAudioLib = new (ELeave) CEpocAudio(aBufferSize);
CleanupStack::PushL(eAudioLib);
eAudioLib->ConstructL(aFill);
CleanupStack::Pop();
return eAudioLib;
}
void CEpocAudio::ConstructL(TInt aFill)
{
iBuffer = (TUint8*) User::AllocL(KAudioBuffers * iBufferSize);
memset(iBuffer, aFill, KAudioBuffers * iBufferSize);
iAudioPtr = iBuffer;
}
TBool CEpocAudio::SetPause(TBool aPause)
{
if(aPause && iPosition >= 0)
{
iPosition = -1;
if(iPlayer != NULL)
iPlayer->Stop();
}
if(!aPause && iPosition < 0)
{
iPosition = 0;
if(iPlayer != NULL)
iPlayer->Start();
}
return iPosition < 0;
}
void CEpocAudio::ThreadInitL(TAny* aDevice)
{
iTid = RThread().Id();
CActiveScheduler* as = new (ELeave) CActiveScheduler();
CActiveScheduler::Install(as);
EpocSdlEnv::AppendCleanupItem(TSdlCleanupItem((TSdlCleanupOperation)EPOC_CloseAudio, aDevice));
iWait = CSimpleWait::NewL();
iPlayer = new (ELeave) CStreamPlayer(*this, *this);
iPlayer->ConstructL();
iPlayer->OpenStream(iRate, iChannels, iType);
#ifdef DODUMP
User::LeaveIfError(iDump.Open());
#endif
}
TUint8* CEpocAudio::Buffer()
{
iStart.UniversalTime();
// iStart = iPlayer->Position();
return iAudioPtr;
}
CEpocAudio::~CEpocAudio()
{
if(iWait != NULL)
iWait->Cancel();
delete iWait;
if(iPlayer != NULL)
iPlayer->Close();
delete iPlayer;
delete iBuffer;
}
void CEpocAudio::Complete(TInt aState, TInt aError)
{
if(aState == MStreamObs::EClose)
{
}
if(iPlayer->Closed())
return;
switch(aError)
{
case KErrUnderflow:
case KErrInUse:
iPlayer->Start();
break;
case KErrAbort:
iPlayer->Open();
}
}
void sos_adump(SDL_AudioDevice* thisdevice, void* data, int len)
{
#ifdef DODUMP
const TPtrC8 buf((TUint8*)data, len);
CEpocAudio::Current(thisdevice).Dump(buf);
#endif
}
const TInt KClip(256);
TPtrC8 CEpocAudio::Data()
{
if(iPosition < 0)
return KNullDesC8();
TPtrC8 data(iAudioPtr + iPosition, KClip);
#ifdef DODUMP
iDump.Dump(data);
#endif
iPosition += KClip;
if(iPosition >= iBufferSize)
{
/* if(iAudioPtr == iBuffer)
iAudioPtr = iBuffer + iBufferSize;
else
iAudioPtr = iBuffer;
*/
iAudioPtr += iBufferSize;
if((iAudioPtr - iBuffer) >= KAudioBuffers * iBufferSize)
iAudioPtr = iBuffer;
iPosition = -1;
if(iWait->IsActive())
{
iWait->Cancel();
CActiveScheduler::Stop();
}
}
return data;
}
void CEpocAudio::Play()
{
iPosition = 0;
}
void CEpocAudio::Wait()
{
if(iPosition >= 0 /*&& iPlayer->Playing()*/)
{
const TInt64 bufMs = TInt64(iBufferSize - KClip) * TInt64(1000000);
const TInt64 specTime = bufMs / TInt64(iRate * iChannels * 2);
iWait->After(specTime);
CActiveScheduler::Start();
TTime end;
end.UniversalTime();
const TTimeIntervalMicroSeconds delta = end.MicroSecondsFrom(iStart);
// const TTimeIntervalMicroSeconds end = iPlayer->Position();
const TInt diff = specTime - delta.Int64();
if(diff > 0 && diff < 200000)
{
User::After(diff);
}
}
else
{
User::After(10000);
// iWait->Wait(10000); //just give some time...
}
}
void CEpocAudio::Open(TInt aRate, TInt aChannels, TUint32 aType, TInt aBytes)
{
iRate = aRate;
iChannels = aChannels;
iType = aType;
iBufferRate = iRate * iChannels * aBytes; //1/x
}
/* Audio driver bootstrap functions */
AudioBootStrap EPOCAudio_bootstrap = {
"epoc\0\0\0",
"EPOC streaming audio\0\0\0",
Audio_Available,
Audio_CreateDevice
};
static SDL_AudioDevice *Audio_CreateDevice(int /*devindex*/)
{
SDL_AudioDevice *thisdevice;
/* Initialize all variables that we clean on shutdown */
thisdevice = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice));
if ( thisdevice ) {
memset(thisdevice, 0, (sizeof *thisdevice));
thisdevice->hidden = NULL; /*(struct SDL_PrivateAudioData *)
malloc((sizeof thisdevice->hidden)); */
}
if ( (thisdevice == NULL) /*|| (thisdevice->hidden == NULL) */) {
SDL_OutOfMemory();
if ( thisdevice ) {
free(thisdevice);
}
return(0);
}
// memset(thisdevice->hidden, 0, (sizeof *thisdevice->hidden));
/* Set the function pointers */
thisdevice->OpenAudio = EPOC_OpenAudio;
thisdevice->WaitAudio = EPOC_WaitAudio;
thisdevice->PlayAudio = EPOC_PlayAudio;
thisdevice->GetAudioBuf = EPOC_GetAudioBuf;
thisdevice->CloseAudio = EPOC_CloseAudio;
thisdevice->ThreadInit = EPOC_ThreadInit;
thisdevice->free = Audio_DeleteDevice;
return thisdevice;
}
static void Audio_DeleteDevice(SDL_AudioDevice *device)
{
//free(device->hidden);
free(device);
}
static int Audio_Available(void)
{
return(1); // Audio stream modules should be always there!
}
static int EPOC_OpenAudio(SDL_AudioDevice *thisdevice, SDL_AudioSpec *spec)
{
SDL_TRACE("SDL:EPOC_OpenAudio");
TUint32 type = KMMFFourCCCodePCM16;
TInt bytes = 2;
switch(spec->format)
{
case AUDIO_U16LSB:
type = KMMFFourCCCodePCMU16;
break;
case AUDIO_S16LSB:
type = KMMFFourCCCodePCM16;
break;
case AUDIO_U16MSB:
type = KMMFFourCCCodePCMU16B;
break;
case AUDIO_S16MSB:
type = KMMFFourCCCodePCM16B;
break;
//8 bit not supported!
case AUDIO_U8:
case AUDIO_S8:
default:
spec->format = AUDIO_S16LSB;
};
if(spec->channels > 2)
spec->channels = 2;
spec->freq = CStreamPlayer::ClosestSupportedRate(spec->freq);
/* Allocate mixing buffer */
const TInt buflen = spec->size;// * bytes * spec->channels;
// audiobuf = NULL;
TRAPD(err, thisdevice->hidden = static_cast<SDL_PrivateAudioData*>(CEpocAudio::NewL(buflen, spec->silence)));
if(err != KErrNone)
return -1;
CEpocAudio::Current(thisdevice).Open(spec->freq, spec->channels, type, bytes);
CEpocAudio::Current(thisdevice).SetPause(ETrue);
// isSDLAudioPaused = 1;
thisdevice->enabled = 0; /* enable only after audio engine has been initialized!*/
/* We're ready to rock and roll. :-) */
return(0);
}
static void EPOC_CloseAudio(SDL_AudioDevice* thisdevice)
{
#ifdef DEBUG_AUDIO
SDL_TRACE("Close audio\n");
#endif
CEpocAudio::Free(thisdevice);
}
static void EPOC_ThreadInit(SDL_AudioDevice *thisdevice)
{
SDL_TRACE("SDL:EPOC_ThreadInit");
CEpocAudio::Current(thisdevice).ThreadInitL(thisdevice);
RThread().SetPriority(EPriorityMore);
thisdevice->enabled = 1;
}
/* This function waits until it is possible to write a full sound buffer */
static void EPOC_WaitAudio(SDL_AudioDevice* thisdevice)
{
#ifdef DEBUG_AUDIO
SDL_TRACE1("wait %d audio\n", CEpocAudio::AudioLib().StreamPlayer(KSfxChannel).SyncTime());
TInt tics = User::TickCount();
#endif
CEpocAudio::Current(thisdevice).Wait();
#ifdef DEBUG_AUDIO
TInt ntics = User::TickCount() - tics;
SDL_TRACE1("audio waited %d\n", ntics);
SDL_TRACE1("audio at %d\n", tics);
#endif
}
static void EPOC_PlayAudio(SDL_AudioDevice* thisdevice)
{
if(CEpocAudio::Current(thisdevice).SetPause(SDL_GetAudioStatus() == SDL_AUDIO_PAUSED))
SDL_Delay(500); //hold on the busy loop
else
CEpocAudio::Current(thisdevice).Play();
#ifdef DEBUG_AUDIO
SDL_TRACE("buffer has audio data\n");
#endif
#ifdef DEBUG_AUDIO
SDL_TRACE1("Wrote %d bytes of audio data\n", buflen);
#endif
}
static Uint8 *EPOC_GetAudioBuf(SDL_AudioDevice* thisdevice)
{
return CEpocAudio::Current(thisdevice).Buffer();
}

View file

@ -0,0 +1,37 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@devolution.com
*/
#ifdef SAVE_RCSID
static char rcsid =
"@(#) $Id: SDL_epocaudio.h,v 1.1.2.2 2001/02/10 07:20:03 hercules Exp $";
#endif
#ifndef _SDL_EPOCAUDIO_H
#define _SDL_EPOCAUDIO_H
extern "C" {
#include "SDL_sysaudio.h"
}
#endif /* _SDL_EPOCAUDIO_H */

View file

@ -0,0 +1,279 @@
#include "streamplayer.h"
#include<mda/common/audio.h>
const TInt KMaxVolume(256);
LOCAL_C TInt GetSampleRate(TInt aRate)
{
switch(aRate)
{
case 8000: return TMdaAudioDataSettings::ESampleRate8000Hz;
case 11025: return TMdaAudioDataSettings::ESampleRate11025Hz;
case 12000: return TMdaAudioDataSettings::ESampleRate12000Hz;
case 16000: return TMdaAudioDataSettings::ESampleRate16000Hz;
case 22050: return TMdaAudioDataSettings::ESampleRate22050Hz;
case 24000: return TMdaAudioDataSettings::ESampleRate24000Hz;
case 32000: return TMdaAudioDataSettings::ESampleRate32000Hz;
case 44100: return TMdaAudioDataSettings::ESampleRate44100Hz;
case 48000: return TMdaAudioDataSettings::ESampleRate48000Hz;
case 96000: return TMdaAudioDataSettings::ESampleRate96000Hz;
case 64000: return TMdaAudioDataSettings::ESampleRate64000Hz;
}
return KErrNotFound;
}
LOCAL_C TInt GetChannels(TInt aChannels)
{
switch(aChannels)
{
case 1: return TMdaAudioDataSettings::EChannelsMono;
case 2: return TMdaAudioDataSettings::EChannelsStereo;
}
return KErrNotFound;
}
TInt CStreamPlayer::ClosestSupportedRate(TInt aRate)
{
if(aRate > 96000)
return 96000;
TInt rate = aRate;
while(GetSampleRate(rate) == KErrNotFound)
{
++rate;
}
return rate;
}
CStreamPlayer::CStreamPlayer(MStreamProvider& aProvider, MStreamObs& aObs) :
iProvider(aProvider), iObs(aObs), iVolume(KMaxVolume)
{
}
CStreamPlayer::~CStreamPlayer()
{
iState |= EDied;
if(iState & EInited)
Close();
User::After(100000); //wait buffer to be flushed
ASSERT(iPtr.Length() == 0);
delete iStream;
}
void CStreamPlayer::ConstructL()
{
iStream = CMdaAudioOutputStream::NewL(*this, EMdaPriorityMax);
iSilence.SetMax();
iSilence.FillZ();
}
TInt CStreamPlayer::OpenStream(TInt aRate, TInt aChannels, TUint32 aType)
{
Close();
iType = aType;
iRate = GetSampleRate(aRate);
if(iRate == KErrNotFound)
return KErrNotSupported;
iChannels = GetChannels(aChannels);
if(iChannels == KErrNotFound)
return KErrNotSupported;
Open();
return KErrNone;
}
TInt CStreamPlayer::MaxVolume() const
{
return KMaxVolume;
}
void CStreamPlayer::SetVolume(TInt aNew)
{
const TInt maxi = MaxVolume();
if(aNew > maxi)
return;
if(aNew < 0)
return;
iVolume = aNew;
iState |= EVolumeChange;
}
TInt CStreamPlayer::Volume() const
{
return iVolume;
}
void CStreamPlayer::Open()
{
TMdaAudioDataSettings audioSettings;
audioSettings.Query();
audioSettings.iCaps = TMdaAudioDataSettings::ERealTime |
TMdaAudioDataSettings::ESampleRateFixed;
audioSettings.iSampleRate = iRate;
audioSettings.iChannels = iChannels;
audioSettings.iFlags = TMdaAudioDataSettings::ENoNetworkRouting;
audioSettings.iVolume = 0;
iState &= ~EStopped;
iStream->Open(&audioSettings);
}
void CStreamPlayer::Stop()
{
if(iState & (EStarted | EInited))
{
Close();
iState |= EStopped;
}
}
void CStreamPlayer::Start()
{
if(iPtr.Length() == 0)
{
iState |= EStarted;
if(iState & EInited)
{
Request();
}
else if(iState & EStopped)
{
Open();
}
}
}
void CStreamPlayer::Close()
{
iState &= ~EInited;
iStream->Stop();
iState &= ~EStarted;
}
void CStreamPlayer::Request()
{
if(iState & EInited)
{
iPtr.Set(KNullDesC8);
if(iState & EVolumeChange)
{
const TReal newVol = iVolume;
const TReal newMax = MaxVolume();
const TInt maxVol = iStream->MaxVolume();
const TReal max = static_cast<TReal>(maxVol);
const TReal newvolume = (newVol * max) / newMax;
const TInt vol = static_cast<TReal>(newvolume);
iStream->SetVolume(vol);
iState &= ~EVolumeChange;
}
if(iState & EStarted)
{
iPtr.Set(iProvider.Data());
}
if(iPtr.Length() == 0)
{
iPtr.Set(iSilence);
}
TRAPD(err, iStream->WriteL(iPtr));
if(err != KErrNone)
{
iObs.Complete(MStreamObs::EWrite, err);
}
/* else
{
iProvider.Written(iPtr.Length());
}*/
}
}
void CStreamPlayer::SetCapsL()
{
iStream->SetDataTypeL(iType);
iStream->SetAudioPropertiesL(iRate, iChannels);
}
void CStreamPlayer::MaoscOpenComplete(TInt aError)
{
if(aError == KErrNone)
{
TRAPD(err, SetCapsL());
if(err == KErrNone)
{
iStream->SetPriority(EPriorityNormal, EMdaPriorityPreferenceTime);
iState |= EInited;
SetVolume(Volume());
if(iState & EStarted)
{
Request();
}
}
aError = err;
}
if(!(iState & EDied))
iObs.Complete(MStreamObs::EInit, aError);
}
void CStreamPlayer::MaoscBufferCopied(TInt aError, const TDesC8& /*aBuffer*/)
{
iPtr.Set(KNullDesC8);
if(aError == KErrNone)
{
if(iState & EInited)
Request();
else
iStream->Stop();
}
else if(!(iState & EDied))
iObs.Complete(MStreamObs::EPlay, aError);
}
void CStreamPlayer::MaoscPlayComplete(TInt aError)
{
iPtr.Set(KNullDesC8);
iState &= ~EStarted;
if(!(iState & EDied))
iObs.Complete(MStreamObs::EClose, aError);
}
TBool CStreamPlayer::Playing() const
{
return (iState & EInited) && (iState & EStarted);
}
TBool CStreamPlayer::Closed() const
{
return !(iState & EInited) && !(iState & EDied);
}
/*
void CStreamPlayer::Request()
{
SetActive();
TRequestStatus* s = &iStatus;
User::RequestComplete(s, KErrNone);
}
// iTimer.After(0);
*/

View file

@ -0,0 +1,89 @@
#ifndef STREAMPLAYER_H
#define STREAMPLAYER_H
#include<MdaAudioOutputStream.h>
const TInt KSilenceBuffer = 256;
class MStreamObs
{
public:
enum
{
EInit,
EPlay,
EWrite,
EClose,
};
virtual void Complete(TInt aState, TInt aError) = 0;
};
class MStreamProvider
{
public:
virtual TPtrC8 Data() = 0;
};
NONSHARABLE_CLASS(CStreamPlayer) : public CBase, public MMdaAudioOutputStreamCallback
{
public:
CStreamPlayer(MStreamProvider& aProvider, MStreamObs& aObs);
~CStreamPlayer();
void ConstructL();
static TInt ClosestSupportedRate(TInt aRate);
TInt OpenStream(TInt aRate, TInt aChannels, TUint32 aType = KMMFFourCCCodePCM16);
void SetVolume(TInt aNew);
TInt Volume() const;
TInt MaxVolume() const;
void Stop();
void Start();
void Open();
void Close();
TBool Playing() const;
TBool Closed() const;
private:
void MaoscOpenComplete(TInt aError) ;
void MaoscBufferCopied(TInt aError, const TDesC8& aBuffer);
void MaoscPlayComplete(TInt aError);
private:
void Request();
void SetCapsL();
private:
MStreamProvider& iProvider;
MStreamObs& iObs;
TInt iVolume;
CMdaAudioOutputStream* iStream;
TInt iRate;
TInt iChannels;
TUint32 iType;
enum
{
ENone = 0,
EInited = 0x1,
EStarted = 0x2,
EStopped = 0x4,
EVolumeChange = 0x8,
EDied = 0x10
};
TInt iState;
TBuf8<KSilenceBuffer> iSilence;
TPtrC8 iPtr;
};
#endif

View file

@ -136,7 +136,7 @@ static SDL_AudioDevice *Audio_CreateDevice(int devindex)
}
AudioBootStrap UMS_bootstrap = {
UMS_DRIVER_NAME, "AUX UMS audio",
UMS_DRIVER_NAME, "AIX UMS audio",
Audio_Available, Audio_CreateDevice
};

View file

@ -218,7 +218,7 @@ static void CheckMounts(const char *mtab)
if ( SDL_strcmp(mnt_type, MNTTYPE_SUPER) == 0 ) {
tmp = SDL_strstr(mntent->mnt_opts, "fs=");
if ( tmp ) {
SDL_free(mnt_type);
SDL_stack_free(mnt_type);
mnt_type = SDL_strdup(tmp + SDL_strlen("fs="));
if ( mnt_type ) {
tmp = SDL_strchr(mnt_type, ',');
@ -229,7 +229,7 @@ static void CheckMounts(const char *mtab)
}
tmp = SDL_strstr(mntent->mnt_opts, "dev=");
if ( tmp ) {
SDL_free(mnt_dev);
SDL_stack_free(mnt_dev);
mnt_dev = SDL_strdup(tmp + SDL_strlen("dev="));
if ( mnt_dev ) {
tmp = SDL_strchr(mnt_dev, ',');

View file

@ -169,7 +169,7 @@ static int SDL_StartEventThread(Uint32 flags)
/* The event thread will handle timers too */
SDL_SetTimerThreaded(2);
#if (defined(__WIN32__) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC)
#if (defined(__WIN32__) && !defined(_WIN32_WCE)) && !defined(HAVE_LIBC) && !defined(__SYMBIAN32__)
#undef SDL_CreateThread
SDL_EventThread = SDL_CreateThread(SDL_GobbleEvents, NULL, NULL, NULL);
#else

View file

@ -29,7 +29,7 @@
#include "SDL_rwops.h"
#if defined(__WIN32__)
#if defined(__WIN32__) && !defined(__SYMBIAN32__)
/* Functions to read/write Win32 API file pointers */
/* Will not use it on WinCE because stdio is buffered, it means
@ -43,6 +43,8 @@
#define INVALID_SET_FILE_POINTER 0xFFFFFFFF
#endif
#define READAHEAD_BUFFER_SIZE 1024
static int SDLCALL win32_file_open(SDL_RWops *context, const char *filename, const char *mode)
{
#ifndef _WIN32_WCE
@ -54,9 +56,12 @@ static int SDLCALL win32_file_open(SDL_RWops *context, const char *filename, con
int a_mode;
if (!context)
return -1;
return -1; /* failed (invalid call) */
context->hidden.win32io.h = INVALID_HANDLE_VALUE; /* mark this as unusable */
context->hidden.win32io.buffer.data = NULL;
context->hidden.win32io.buffer.size = 0;
context->hidden.win32io.buffer.left = 0;
/* "r" = reading, file must exist */
/* "w" = writing, truncate existing, file may not exist */
@ -72,7 +77,13 @@ static int SDLCALL win32_file_open(SDL_RWops *context, const char *filename, con
w_right = ( a_mode || SDL_strchr(mode,'+') || truncate ) ? GENERIC_WRITE : 0;
if (!r_right && !w_right) /* inconsistent mode */
return -1; /* failed (invalid call)*/
return -1; /* failed (invalid call) */
context->hidden.win32io.buffer.data = (char *)SDL_malloc(READAHEAD_BUFFER_SIZE);
if (!context->hidden.win32io.buffer.data) {
SDL_OutOfMemory();
return -1;
}
#ifdef _WIN32_WCE
{
@ -80,8 +91,10 @@ static int SDLCALL win32_file_open(SDL_RWops *context, const char *filename, con
wchar_t *filenameW = SDL_stack_alloc(wchar_t, size);
if ( MultiByteToWideChar(CP_UTF8, 0, filename, -1, filenameW, size) == 0 ) {
SDL_SetError("Unable to convert filename to Unicode");
SDL_stack_free(filenameW);
SDL_free(context->hidden.win32io.buffer.data);
context->hidden.win32io.buffer.data = NULL;
SDL_SetError("Unable to convert filename to Unicode");
return -1;
}
h = CreateFile(filenameW, (w_right|r_right), (w_right)? 0 : FILE_SHARE_READ,
@ -100,12 +113,14 @@ static int SDLCALL win32_file_open(SDL_RWops *context, const char *filename, con
#endif /* _WIN32_WCE */
if (h==INVALID_HANDLE_VALUE) {
SDL_free(context->hidden.win32io.buffer.data);
context->hidden.win32io.buffer.data = NULL;
SDL_SetError("Couldn't open %s",filename);
return -2; /* failed (CreateFile) */
}
context->hidden.win32io.h = h;
context->hidden.win32io.append = a_mode;
return 0; /* ok */
}
static int SDLCALL win32_file_seek(SDL_RWops *context, int offset, int whence)
@ -117,7 +132,13 @@ static int SDLCALL win32_file_seek(SDL_RWops *context, int offset, int whence)
SDL_SetError("win32_file_seek: invalid context/file not opened");
return -1;
}
/* FIXME: We may be able to satisfy the seek within buffered data */
if (whence == RW_SEEK_CUR && context->hidden.win32io.buffer.left) {
offset -= context->hidden.win32io.buffer.left;
}
context->hidden.win32io.buffer.left = 0;
switch (whence) {
case RW_SEEK_SET:
win32whence = FILE_BEGIN; break;
@ -129,7 +150,7 @@ static int SDLCALL win32_file_seek(SDL_RWops *context, int offset, int whence)
SDL_SetError("win32_file_seek: Unknown value for 'whence'");
return -1;
}
file_pos = SetFilePointer(context->hidden.win32io.h,offset,NULL,win32whence);
if ( file_pos != INVALID_SET_FILE_POINTER )
@ -140,21 +161,50 @@ static int SDLCALL win32_file_seek(SDL_RWops *context, int offset, int whence)
}
static int SDLCALL win32_file_read(SDL_RWops *context, void *ptr, int size, int maxnum)
{
int total_need;
int total_read = 0;
int read_ahead;
DWORD byte_read;
int total_bytes;
DWORD byte_read,nread;
total_need = size*maxnum;
total_bytes = size*maxnum;
if (!context || context->hidden.win32io.h == INVALID_HANDLE_VALUE || total_bytes<=0 || !size)
if (!context || context->hidden.win32io.h == INVALID_HANDLE_VALUE || total_need<=0 || !size)
return 0;
if (!ReadFile(context->hidden.win32io.h,ptr,total_bytes,&byte_read,NULL)) {
SDL_Error(SDL_EFREAD);
return 0;
}
nread = byte_read/size;
return nread;
if (context->hidden.win32io.buffer.left > 0) {
void *data = (char *)context->hidden.win32io.buffer.data +
context->hidden.win32io.buffer.size -
context->hidden.win32io.buffer.left;
read_ahead = SDL_min(total_need, context->hidden.win32io.buffer.left);
SDL_memcpy(ptr, data, read_ahead);
context->hidden.win32io.buffer.left -= read_ahead;
if (read_ahead == total_need) {
return maxnum;
}
ptr = (char *)ptr + read_ahead;
total_need -= read_ahead;
total_read += read_ahead;
}
if (total_need < READAHEAD_BUFFER_SIZE) {
if (!ReadFile(context->hidden.win32io.h,context->hidden.win32io.buffer.data,READAHEAD_BUFFER_SIZE,&byte_read,NULL)) {
SDL_Error(SDL_EFREAD);
return 0;
}
read_ahead = SDL_min(total_need, (int)byte_read);
SDL_memcpy(ptr, context->hidden.win32io.buffer.data, read_ahead);
context->hidden.win32io.buffer.size = byte_read;
context->hidden.win32io.buffer.left = byte_read-read_ahead;
total_read += read_ahead;
} else {
if (!ReadFile(context->hidden.win32io.h,ptr,total_need,&byte_read,NULL)) {
SDL_Error(SDL_EFREAD);
return 0;
}
total_read += byte_read;
}
return (total_read/size);
}
static int SDLCALL win32_file_write(SDL_RWops *context, const void *ptr, int size, int num)
{
@ -167,6 +217,11 @@ static int SDLCALL win32_file_write(SDL_RWops *context, const void *ptr, int siz
if (!context || context->hidden.win32io.h==INVALID_HANDLE_VALUE || total_bytes<=0 || !size)
return 0;
if (context->hidden.win32io.buffer.left) {
SetFilePointer(context->hidden.win32io.h,-context->hidden.win32io.buffer.left,NULL,FILE_CURRENT);
context->hidden.win32io.buffer.left = 0;
}
/* if in append mode, we must go to the EOF before write */
if (context->hidden.win32io.append) {
if ( SetFilePointer(context->hidden.win32io.h,0L,NULL,FILE_END) == INVALID_SET_FILE_POINTER ) {
@ -191,6 +246,10 @@ static int SDLCALL win32_file_close(SDL_RWops *context)
CloseHandle(context->hidden.win32io.h);
context->hidden.win32io.h = INVALID_HANDLE_VALUE; /* to be sure */
}
if (context->hidden.win32io.buffer.data) {
SDL_free(context->hidden.win32io.buffer.data);
context->hidden.win32io.buffer.data = NULL;
}
SDL_FreeRW(context);
}
return(0);
@ -372,12 +431,11 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
return NULL;
}
#if defined(__WIN32__)
#if defined(__WIN32__) && !defined(__SYMBIAN32__)
rwops = SDL_AllocRW();
if (!rwops)
return NULL; /* SDL_SetError already setup by SDL_AllocRW() */
rwops->hidden.win32io.h = INVALID_HANDLE_VALUE;
if (win32_file_open(rwops,file,mode)) {
if (win32_file_open(rwops,file,mode) < 0) {
SDL_FreeRW(rwops);
return NULL;
}

View file

@ -12,7 +12,6 @@ BITS 32
%include "common.inc"
SDL_FUNC _ConvertMMX
SDL_FUNC _mmxreturn
SECTION .text
@ -51,9 +50,8 @@ _ConvertMMX:
y_loop:
mov ecx,[ebp+4]
jmp [ebp+32]
call [ebp+32]
_mmxreturn:
add esi,[ebp+12]
add edi,[ebp+28]

View file

@ -28,8 +28,6 @@ SDL_FUNC _ConvertMMXpII32_16BGR565
SDL_FUNC _ConvertMMXpII32_16RGB555
SDL_FUNC _ConvertMMXpII32_16BGR555
EXTERN _mmxreturn
;; Macros for conversion routines
%macro _push_immq_mask 1
@ -121,7 +119,7 @@ _ConvertMMXpII32_24RGB888:
dec ecx
jnz .L3
.L4:
jmp _mmxreturn
return
@ -190,7 +188,7 @@ _ConvertMMXpII32_16RGB565:
jnz .L3
.L4:
jmp _mmxreturn
retn
_ConvertMMXpII32_16BGR565:
@ -260,7 +258,7 @@ _ConvertMMXpII32_16BGR565:
jnz .L3
.L4:
jmp _mmxreturn
retn
_ConvertMMXpII32_16BGR555:
@ -285,7 +283,7 @@ _convert_bgr555_cheat:
mov edx,ecx ; Save ecx
and ecx,BYTE 0fffffff8h ; clear lower three bits
and ecx,DWORD 0fffffff8h ; clear lower three bits
jnz .L_OK
jmp near .L2
@ -400,7 +398,7 @@ _convert_bgr555_cheat:
jnz .L3
.L4:
jmp _mmxreturn
retn
%ifidn __OUTPUT_FORMAT__,elf
section .note.GNU-stack noalloc noexec nowrite progbits

View file

@ -14,9 +14,6 @@ BITS 32
%include "common.inc"
SDL_FUNC _ConvertX86
SDL_FUNC _x86return
SDL_FUNC _Hermes_X86_CPU
SECTION .text
@ -55,9 +52,8 @@ _ConvertX86:
y_loop:
mov ecx,[ebp+4]
jmp [ebp+32]
call [ebp+32]
_x86return:
add esi,[ebp+12]
add edi,[ebp+28]
@ -74,49 +70,6 @@ endconvert:
;; Hermes_X86_CPU returns the CPUID flags in eax
_Hermes_X86_CPU:
pushfd
pop eax
mov ecx,eax
xor eax,040000h
push eax
popfd
pushfd
pop eax
xor eax,ecx
jz .L1 ; Processor is 386
push ecx
popfd
mov eax,ecx
xor eax,200000h
push eax
popfd
pushfd
pop eax
xor eax,ecx
je .L1
push ebx
mov eax,1
cpuid
mov eax,edx
pop ebx
.L1:
ret
%ifidn __OUTPUT_FORMAT__,elf
section .note.GNU-stack noalloc noexec nowrite progbits
%endif

View file

@ -20,7 +20,6 @@ SDL_FUNC _ConvertX86p16_16BGR555
SDL_FUNC _ConvertX86p16_8RGB332
EXTERN _ConvertX86
EXTERN _x86return
SECTION .text
@ -49,7 +48,7 @@ _ConvertX86p16_16BGR565:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 ; head
mov eax,edi
@ -127,7 +126,7 @@ _ConvertX86p16_16BGR565:
add edi,BYTE 2
.L7
jmp _x86return
retn
@ -156,7 +155,7 @@ _ConvertX86p16_16RGB555:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 ; head
mov eax,edi
@ -235,7 +234,7 @@ _ConvertX86p16_16RGB555:
jmp SHORT .L6
.L7 pop ebp
jmp _x86return
retn
@ -269,7 +268,7 @@ _ConvertX86p16_16BGR555:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 ; head
mov eax,edi
@ -353,7 +352,7 @@ _ConvertX86p16_16BGR555:
add edi,BYTE 2
.L7
jmp _x86return
retn
@ -386,7 +385,7 @@ _ConvertX86p16_8RGB332:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 mov eax,edi
and eax,BYTE 11b
@ -484,7 +483,7 @@ _ConvertX86p16_8RGB332:
jnz .L6
.L7 pop ebp
jmp _x86return
retn
%ifidn __OUTPUT_FORMAT__,elf
section .note.GNU-stack noalloc noexec nowrite progbits

View file

@ -24,8 +24,6 @@ SDL_FUNC _ConvertX86p32_16RGB555
SDL_FUNC _ConvertX86p32_16BGR555
SDL_FUNC _ConvertX86p32_8RGB332
EXTERN _x86return
SECTION .text
;; _Convert_*
@ -53,7 +51,7 @@ _ConvertX86p32_32BGR888:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 ; save ebp
push ebp
@ -113,7 +111,7 @@ _ConvertX86p32_32BGR888:
jnz .L5
.L6 pop ebp
jmp _x86return
retn
@ -133,7 +131,7 @@ _ConvertX86p32_32RGBA888:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 ; save ebp
push ebp
@ -184,7 +182,7 @@ _ConvertX86p32_32RGBA888:
jnz .L5
.L6 pop ebp
jmp _x86return
retn
@ -204,7 +202,7 @@ _ConvertX86p32_32BGRA888:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 ; save ebp
push ebp
@ -257,7 +255,7 @@ _ConvertX86p32_32BGRA888:
jnz .L5
.L6 pop ebp
jmp _x86return
retn
@ -282,7 +280,7 @@ _ConvertX86p32_24RGB888:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 ; head
mov edx,edi
@ -354,7 +352,7 @@ _ConvertX86p32_24RGB888:
jnz .L6
.L7 pop ebp
jmp _x86return
retn
@ -380,7 +378,7 @@ _ConvertX86p32_24BGR888:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 ; head
mov edx,edi
@ -455,7 +453,7 @@ _ConvertX86p32_24BGR888:
.L7
pop ebp
jmp _x86return
retn
@ -484,7 +482,7 @@ _ConvertX86p32_16RGB565:
jnz .L1
.L2: ; End of short loop
jmp _x86return
retn
.L3 ; head
@ -570,7 +568,7 @@ _ConvertX86p32_16RGB565:
add edi,BYTE 2
.L7:
jmp _x86return
retn
@ -599,7 +597,7 @@ _ConvertX86p32_16BGR565:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 ; head
mov ebx,edi
@ -684,7 +682,7 @@ _ConvertX86p32_16BGR565:
add edi,BYTE 2
.L7
jmp _x86return
retn
@ -713,7 +711,7 @@ _ConvertX86p32_16RGB555:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 ; head
mov ebx,edi
@ -795,7 +793,7 @@ _ConvertX86p32_16RGB555:
add edi,BYTE 2
.L7
jmp _x86return
retn
@ -825,7 +823,7 @@ _ConvertX86p32_16BGR555:
dec ecx
jnz .L1
.L2
jmp _x86return
retn
.L3 ; head
mov ebx,edi
@ -910,7 +908,7 @@ _ConvertX86p32_16BGR555:
add edi,BYTE 2
.L7
jmp _x86return
retn
@ -1040,7 +1038,7 @@ _ConvertX86p32_8RGB332:
jnz .L3
.L4:
jmp _x86return
retn
%ifidn __OUTPUT_FORMAT__,elf
section .note.GNU-stack noalloc noexec nowrite progbits

View file

@ -1,233 +0,0 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
#ifdef SDL_JOYSTICK_AMIGA
/* This is the system specific header for the SDL joystick API */
#include <libraries/lowlevel.h>
#if defined(__SASC) || defined(STORMC4_WOS)
#include <proto/exec.h>
#include <proto/lowlevel.h>
#include <proto/graphics.h>
#else
#include <inline/exec.h>
#include <inline/lowlevel.h>
#include <inline/graphics.h>
#endif
#include "mydebug.h"
extern struct ExecBase *SysBase;
extern struct GfxBase *GfxBase;
#include "SDL_joystick.h"
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
/* Function to scan the system for joysticks.
* This function should set SDL_numjoysticks to the number of available
* joysticks. Joystick 0 should be the system default joystick.
* It should return 0, or -1 on an unrecoverable fatal error.
*/
/* Amiga specific datas */
struct Library *LowLevelBase=NULL;
ULONG joybut[]=
{
JPF_BUTTON_RED,
JPF_BUTTON_BLUE,
JPF_BUTTON_PLAY,
JPF_BUTTON_YELLOW,
JPF_BUTTON_GREEN,
JPF_BUTTON_FORWARD,
JPF_BUTTON_REVERSE,
};
struct joystick_hwdata
{
ULONG joystate;
};
int SDL_SYS_JoystickInit(void)
{
if(!LowLevelBase)
{
if(LowLevelBase=OpenLibrary("lowlevel.library",37))
return 2;
}
else
return 2;
D(bug("%ld joysticks available.\n",SDL_numjoysticks));
return 0;
}
/* Function to get the device-dependent name of a joystick */
const char *SDL_SYS_JoystickName(int index)
{
if(index<2&&LowLevelBase)
{
switch(index)
{
case 0:
return "Port 1 Amiga Joystick/Joypad";
case 1:
return "Port 2 Amiga Joystick/Joypad";
}
}
SDL_SetError("No joystick available with that index");
return(NULL);
}
/* Function to open a joystick for use.
The joystick to open is specified by the index field of the joystick.
This should fill the nbuttons and naxes fields of the joystick structure.
It returns 0, or -1 if there is an error.
*/
int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
{
ULONG temp,i;
D(bug("Opening joystick %ld\n",joystick->index));
if(!(joystick->hwdata=SDL_malloc(sizeof(struct joystick_hwdata))))
return -1;
/* This loop is to check if the controller is a joypad */
for(i=0;i<20;i++)
{
temp=ReadJoyPort(joystick->index^1); // fix to invert amiga joyports
WaitTOF();
}
if((temp&JP_TYPE_MASK)==JP_TYPE_GAMECTLR)
joystick->nbuttons=7;
else
joystick->nbuttons=3;
joystick->nhats=0;
joystick->nballs=0;
joystick->naxes=2;
joystick->hwdata->joystate=0L;
return 0;
}
/* Function to update the state of a joystick - called as a device poll.
* This function shouldn't update the joystick structure directly,
* but instead should call SDL_PrivateJoystick*() to deliver events
* and update joystick device state.
*/
void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
{
ULONG data;
int i;
if(joystick->index<2)
{
data=ReadJoyPort(joystick->index);
if(data&JP_DIRECTION_MASK)
{
if(data&JPF_JOY_DOWN)
{
if(!(joystick->hwdata->joystate&JPF_JOY_DOWN))
SDL_PrivateJoystickAxis(joystick,0,127);
}
else if(data&JPF_JOY_UP)
{
if(!(joystick->hwdata->joystate&JPF_JOY_UP))
SDL_PrivateJoystickAxis(joystick,0,-127);
}
else if(joystick->hwdata->joystate&(JPF_JOY_UP|JPF_JOY_DOWN))
SDL_PrivateJoystickAxis(joystick,0,0);
if(data&JPF_JOY_LEFT)
{
if(!(joystick->hwdata->joystate&JPF_JOY_LEFT))
SDL_PrivateJoystickAxis(joystick,1,-127);
}
else if(data&JPF_JOY_RIGHT)
{
if(!(joystick->hwdata->joystate&JPF_JOY_RIGHT))
SDL_PrivateJoystickAxis(joystick,1,127);
}
else if(joystick->hwdata->joystate&(JPF_JOY_LEFT|JPF_JOY_RIGHT))
SDL_PrivateJoystickAxis(joystick,1,0);
}
else if(joystick->hwdata->joystate&(JPF_JOY_LEFT|JPF_JOY_RIGHT))
{
SDL_PrivateJoystickAxis(joystick,1,0);
}
else if(joystick->hwdata->joystate&(JPF_JOY_UP|JPF_JOY_DOWN))
{
SDL_PrivateJoystickAxis(joystick,0,0);
}
for(i=0;i<joystick->nbuttons;i++)
{
if( (data&joybut[i]) )
{
if(i==1)
data&=(~(joybut[2]));
if(!(joystick->hwdata->joystate&joybut[i]))
SDL_PrivateJoystickButton(joystick,i,SDL_PRESSED);
}
else if(joystick->hwdata->joystate&joybut[i])
SDL_PrivateJoystickButton(joystick,i,SDL_RELEASED);
}
joystick->hwdata->joystate=data;
}
return;
}
/* Function to close a joystick after use */
void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
{
if(joystick->hwdata)
SDL_free(joystick->hwdata);
return;
}
/* Function to perform any system-specific joystick related cleanup */
void SDL_SYS_JoystickQuit(void)
{
if(LowLevelBase)
{
CloseLibrary(LowLevelBase);
LowLevelBase=NULL;
SDL_numjoysticks=0;
}
return;
}
#endif /* SDL_JOYSTICK_AMIGA */

View file

@ -123,6 +123,12 @@ struct joystick_hwdata {
struct report_desc *repdesc;
struct report inreport;
int axis_map[JOYAXE_count]; /* map present JOYAXE_* to 0,1,..*/
int x;
int y;
int xmin;
int ymin;
int xmax;
int ymax;
};
static char *joynames[MAX_JOYS];
@ -257,6 +263,12 @@ SDL_SYS_JoystickOpen(SDL_Joystick *joy)
joy->hwdata = hw;
hw->fd = fd;
hw->path = strdup(path);
hw->x = 0;
hw->y = 0;
hw->xmin = 0xffff;
hw->ymin = 0xffff;
hw->xmax = 0;
hw->ymax = 0;
if (! SDL_strncmp(path, "/dev/joy", 8)) {
hw->type = BSDJOY_JOY;
joy->naxes = 2;
@ -380,43 +392,42 @@ SDL_SYS_JoystickUpdate(SDL_Joystick *joy)
#if defined(__FREEBSD__) || SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
struct joystick gameport;
static int x, y, xmin = 0xffff, ymin = 0xffff, xmax = 0, ymax = 0;
if (joy->hwdata->type == BSDJOY_JOY) {
if (read(joy->hwdata->fd, &gameport, sizeof gameport) != sizeof gameport)
return;
if (abs(x - gameport.x) > 8) {
x = gameport.x;
if (x < xmin) {
xmin = x;
if (abs(joy->hwdata->x - gameport.x) > 8) {
joy->hwdata->x = gameport.x;
if (joy->hwdata->x < joy->hwdata->xmin) {
joy->hwdata->xmin = joy->hwdata->x;
}
if (x > xmax) {
xmax = x;
if (joy->hwdata->x > joy->hwdata->xmax) {
joy->hwdata->xmax = joy->hwdata->x;
}
if (xmin == xmax) {
xmin--;
xmax++;
if (joy->hwdata->xmin == joy->hwdata->xmax) {
joy->hwdata->xmin--;
joy->hwdata->xmax++;
}
v = (Sint32)x;
v -= (xmax + xmin + 1)/2;
v *= 32768/((xmax - xmin + 1)/2);
v = (Sint32)joy->hwdata->x;
v -= (joy->hwdata->xmax + joy->hwdata->xmin + 1)/2;
v *= 32768/((joy->hwdata->xmax - joy->hwdata->xmin + 1)/2);
SDL_PrivateJoystickAxis(joy, 0, v);
}
if (abs(y - gameport.y) > 8) {
y = gameport.y;
if (y < ymin) {
ymin = y;
if (abs(joy->hwdata->y - gameport.y) > 8) {
joy->hwdata->y = gameport.y;
if (joy->hwdata->y < joy->hwdata->ymin) {
joy->hwdata->ymin = joy->hwdata->y;
}
if (y > ymax) {
ymax = y;
if (joy->hwdata->y > joy->hwdata->ymax) {
joy->hwdata->ymax = joy->hwdata->y;
}
if (ymin == ymax) {
ymin--;
ymax++;
if (joy->hwdata->ymin == joy->hwdata->ymax) {
joy->hwdata->ymin--;
joy->hwdata->ymax++;
}
v = (Sint32)y;
v -= (ymax + ymin + 1)/2;
v *= 32768/((ymax - ymin + 1)/2);
v = (Sint32)joy->hwdata->y;
v -= (joy->hwdata->ymax + joy->hwdata->ymin + 1)/2;
v *= 32768/((joy->hwdata->ymax - joy->hwdata->ymin + 1)/2);
SDL_PrivateJoystickAxis(joy, 1, v);
}
if (gameport.b1 != joy->buttons[0]) {

View file

@ -241,12 +241,10 @@ static void HIDGetElementInfo (CFTypeRef refElement, recElement *pElement)
pElement->cookie = (IOHIDElementCookie) number;
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementMinKey));
if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
pElement->min = number;
pElement->maxReport = pElement->min;
pElement->minReport = pElement->min = number;
refType = CFDictionaryGetValue (refElement, CFSTR(kIOHIDElementMaxKey));
if (refType && CFNumberGetValue (refType, kCFNumberLongType, &number))
pElement->max = number;
pElement->minReport = pElement->max;
pElement->maxReport = pElement->max = number;
/*
TODO: maybe should handle the following stuff somehow?
@ -652,7 +650,8 @@ int SDL_SYS_JoystickInit(void)
/* Filter device list to non-keyboard/mouse stuff */
if ( (device->usagePage != kHIDPage_GenericDesktop) ||
((device->usage != kHIDUsage_GD_Joystick &&
device->usage != kHIDUsage_GD_GamePad)) ) {
device->usage != kHIDUsage_GD_GamePad &&
device->usage != kHIDUsage_GD_MultiAxisController)) ) {
/* release memory for the device */
HIDDisposeDevice (&device);

View file

@ -50,6 +50,7 @@ static struct {
{ "SideWinder Precision Pro", 4, 1, 0 },
{ "SideWinder 3D Pro", 4, 1, 0 },
{ "Microsoft SideWinder 3D Pro", 4, 1, 0 },
{ "Microsoft SideWinder Precision Pro", 4, 1, 0 },
{ "Microsoft SideWinder Dual Strike USB version 1.0", 2, 1, 0 },
{ "WingMan Interceptor", 3, 3, 0 },
{ "WingMan Extreme Digital 3D", 4, 1, 0 },

View file

@ -44,19 +44,28 @@
/* We can have:
1 joystick on IKBD port 1, read via hardware I/O
or same joystick on IKBD port 1, read via xbios
2 joypads on ports A,B
or 4 joysticks on joypads ports A,B
or same joystick on IKBD port 1, read via xbios
1 joypad on port A (up to 4 with teamtap)
or 2 joysticks on joypad port A
or 1 analog paddle on joypad port A
or 1 lightpen on joypad port A
or 2 analog paddles on joypads ports A,B
1 joypad on port B (up to 4 with teamtap)
or 2 joysticks on joypad port B
or 1 analog paddle on joypad port B
2 joysticks on parallel port
*/
enum {
IKBD_JOY1=0,
XBIOS_JOY1,
PORTA_PAD,
PORTB_PAD,
PORTA_PAD0,
PORTA_PAD1,
PORTA_PAD2,
PORTA_PAD3,
PORTB_PAD0,
PORTB_PAD1,
PORTB_PAD2,
PORTB_PAD3,
PORTA_JOY0,
PORTA_JOY1,
PORTB_JOY0,
@ -116,8 +125,14 @@ typedef struct {
static atarijoy_t atarijoysticks[MAX_JOYSTICKS]={
{SDL_FALSE,"IKBD joystick port 1",0},
{SDL_FALSE,"Xbios joystick port 1",0},
{SDL_FALSE,"Joypad port A",0},
{SDL_FALSE,"Joypad port B",0},
{SDL_FALSE,"Joypad 0 port A",0},
{SDL_FALSE,"Joypad 1 port A",0},
{SDL_FALSE,"Joypad 2 port A",0},
{SDL_FALSE,"Joypad 3 port A",0},
{SDL_FALSE,"Joypad 0 port B",0},
{SDL_FALSE,"Joypad 1 port B",0},
{SDL_FALSE,"Joypad 2 port B",0},
{SDL_FALSE,"Joypad 3 port B",0},
{SDL_FALSE,"Joystick 0 port A",0},
{SDL_FALSE,"Joystick 1 port A",0},
{SDL_FALSE,"Joystick 0 port B",0},
@ -146,7 +161,7 @@ static Uint16 jp_paddles[4];
static Uint16 jp_lightpens[2];
static Uint16 jp_directions;
static Uint16 jp_fires;
static Uint32 jp_joypads[2];
static Uint32 jp_joypads[8];
/*--- Functions prototypes ---*/
@ -181,8 +196,14 @@ int SDL_SYS_JoystickInit(void)
atarijoysticks[IKBD_JOY1].enabled=(SDL_AtariIkbd_enabled!=0);
}
if ((cookie_mch == MCH_STE<<16) || (cookie_mch == MCH_F30<<16)) {
atarijoysticks[PORTA_PAD].enabled=SDL_TRUE;
atarijoysticks[PORTB_PAD].enabled=SDL_TRUE;
atarijoysticks[PORTA_PAD0].enabled =
atarijoysticks[PORTA_PAD1].enabled =
atarijoysticks[PORTA_PAD2].enabled =
atarijoysticks[PORTA_PAD3].enabled =
atarijoysticks[PORTB_PAD0].enabled =
atarijoysticks[PORTB_PAD1].enabled =
atarijoysticks[PORTB_PAD2].enabled =
atarijoysticks[PORTB_PAD3].enabled = SDL_TRUE;
}
if (!atarijoysticks[IKBD_JOY1].enabled) {
atarijoysticks[XBIOS_JOY1].enabled=(SDL_AtariXbios_enabled!=0);
@ -200,8 +221,8 @@ int SDL_SYS_JoystickInit(void)
}
/* Joypads ports only on STE and Falcon */
if ((cookie_mch == MCH_STE<<16) || (cookie_mch == MCH_F30<<16)) {
TEST_JOY_ENABLED(envr, "porta-pad", PORTA_PAD);
if (!atarijoysticks[PORTA_PAD].enabled) {
TEST_JOY_ENABLED(envr, "porta-pad", PORTA_PAD0);
if (!atarijoysticks[PORTA_PAD0].enabled) {
TEST_JOY_ENABLED(envr, "porta-joy0", PORTA_JOY0);
TEST_JOY_ENABLED(envr, "porta-joy1", PORTA_JOY1);
if (!(atarijoysticks[PORTA_JOY0].enabled) && !(atarijoysticks[PORTA_JOY1].enabled)) {
@ -212,8 +233,8 @@ int SDL_SYS_JoystickInit(void)
}
}
TEST_JOY_ENABLED(envr, "portb-pad", PORTB_PAD);
if (!atarijoysticks[PORTB_PAD].enabled) {
TEST_JOY_ENABLED(envr, "portb-pad", PORTB_PAD0);
if (!atarijoysticks[PORTB_PAD0].enabled) {
TEST_JOY_ENABLED(envr, "portb-joy0", PORTB_JOY0);
TEST_JOY_ENABLED(envr, "portb-joy1", PORTB_JOY1);
if (!(atarijoysticks[PORTB_JOY0].enabled) && !(atarijoysticks[PORTB_JOY1].enabled)) {
@ -239,7 +260,7 @@ int SDL_SYS_JoystickInit(void)
/* Need to update joypad ports ? */
joypad_ports_enabled=SDL_FALSE;
for (i=PORTA_PAD;i<=PORTB_ANPAD;i++) {
for (i=PORTA_PAD0;i<=PORTB_ANPAD;i++) {
if (atarijoysticks[i].enabled) {
joypad_ports_enabled=SDL_TRUE;
break;
@ -303,8 +324,14 @@ int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
joystick->nballs=0;
switch(numjoystick) {
case PORTA_PAD:
case PORTB_PAD:
case PORTA_PAD0:
case PORTA_PAD1:
case PORTA_PAD2:
case PORTA_PAD3:
case PORTB_PAD0:
case PORTB_PAD1:
case PORTB_PAD2:
case PORTB_PAD3:
joystick->nhats=1;
joystick->nbuttons=JP_NUM_BUTTONS;
break;
@ -379,13 +406,36 @@ void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
atarijoysticks[numjoystick].prevstate = curstate;
}
break;
case PORTA_PAD:
case PORTB_PAD:
case PORTA_PAD0:
case PORTA_PAD1:
case PORTA_PAD2:
case PORTA_PAD3:
case PORTB_PAD0:
case PORTB_PAD1:
case PORTB_PAD2:
case PORTB_PAD3:
{
int numjoypad,i;
numjoypad=0;
if (numjoystick==PORTB_PAD) numjoypad=1;
numjoypad = 0;
switch(numjoystick) {
case PORTA_PAD0:
numjoypad = 0; break;
case PORTA_PAD1:
numjoypad = 1; break;
case PORTA_PAD2:
numjoypad = 2; break;
case PORTA_PAD3:
numjoypad = 3; break;
case PORTB_PAD0:
numjoypad = 4; break;
case PORTB_PAD1:
numjoypad = 5; break;
case PORTB_PAD2:
numjoypad = 6; break;
case PORTB_PAD3:
numjoypad = 7; break;
}
curstate=jp_joypads[numjoypad];
if (curstate!=prevstate) {
@ -561,9 +611,21 @@ struct JOYPAD_IO_S {
};
#define JOYPAD_IO ((*(volatile struct JOYPAD_IO_S *)JOYPAD_IO_BASE))
static const Uint16 joypad_masks[8*4]={
0xfffe, 0xfffd, 0xfffb, 0xfff7,
0xfff0, 0xfff1, 0xfff2, 0xfff3,
0xfff4, 0xfff5, 0xfff6, 0xfff8,
0xfff9, 0xfffa, 0xfffc, 0xffff,
0xffef, 0xffdf, 0xffbf, 0xff7f,
0xff0f, 0xff1f, 0xff2f, 0xff3f,
0xff4f, 0xff5f, 0xff6f, 0xff8f,
0xff9f, 0xffaf, 0xffcf, 0xffff
};
static void UpdateJoypads(void)
{
Uint16 tmp;
Uint16 tmp, i, j;
Uint32 cur_fire, cur_dir;
/*--- This function is called in supervisor mode ---*/
@ -587,47 +649,35 @@ static void UpdateJoypads(void)
tmp = (JOYPAD_IO.paddles[3] & 255);
jp_paddles[3] = (tmp<<8) | tmp;
/* Update joypad 0 */
JOYPAD_IO.directions=0xfffe;
jp_joypads[0]=((~(JOYPAD_IO.fires)) & 3)<<(16);
JOYPAD_IO.directions=0xfffe;
jp_joypads[0] |= ((~(JOYPAD_IO.directions))>>8) & 15;
/* Update joypads on teamtap port A */
for (i=0; i<4; i++) {
jp_joypads[i] = 0;
for (j=0; j<4; j++) {
JOYPAD_IO.directions = joypad_masks[(i*4)+j];
JOYPAD_IO.directions=0xfffd;
jp_joypads[0] |= ((~(JOYPAD_IO.fires)) & 3)<<(16+2);
JOYPAD_IO.directions=0xfffd;
jp_joypads[0] |= (((~(JOYPAD_IO.directions))>>8) & 15)<<4;
cur_fire = (~(JOYPAD_IO.fires) & 3)<<16;
cur_dir = (~(JOYPAD_IO.directions)>>8) & 15;
JOYPAD_IO.directions=0xfffb;
jp_joypads[0] |= ((~(JOYPAD_IO.fires)) & 3)<<(16+4);
JOYPAD_IO.directions=0xfffb;
jp_joypads[0] |= (((~(JOYPAD_IO.directions))>>8) & 15)<<8;
jp_joypads[i] |= cur_fire<<(j*2);
jp_joypads[i] |= cur_dir<<(j*4);
}
}
JOYPAD_IO.directions=0xfff7;
jp_joypads[0] |= ((~(JOYPAD_IO.fires)) & 3)<<(16+6);
JOYPAD_IO.directions=0xfff7;
jp_joypads[0] |= (((~(JOYPAD_IO.directions))>>8) & 15)<<12;
/* Update joypads on teamtap port B */
for (i=4; i<8; i++) {
jp_joypads[i] = 0;
for (j=0; j<4; j++) {
JOYPAD_IO.directions = joypad_masks[(i*4)+j];
/* Update joypad 1 */
JOYPAD_IO.directions=0xffef;
jp_joypads[1]=((~(JOYPAD_IO.fires)) & (3<<2))<<(16-2);
JOYPAD_IO.directions=0xffef;
jp_joypads[1] |= ((~(JOYPAD_IO.directions))>>12) & 15;
cur_fire = (~(JOYPAD_IO.fires) & 0xc)<<14;
cur_dir = (~(JOYPAD_IO.directions)>>12) & 15;
JOYPAD_IO.directions=0xffdf;
jp_joypads[1] |= ((~(JOYPAD_IO.fires)) & (3<<2))<<(16);
JOYPAD_IO.directions=0xffdf;
jp_joypads[1] |= (((~(JOYPAD_IO.directions))>>12) & 15)<<4;
jp_joypads[i] |= cur_fire<<(j*2);
jp_joypads[i] |= cur_dir<<(j*4);
}
}
JOYPAD_IO.directions=0xffbf;
jp_joypads[1] |= ((~(JOYPAD_IO.fires)) & (3<<2))<<(16+2);
JOYPAD_IO.directions=0xffbf;
jp_joypads[1] |= (((~(JOYPAD_IO.directions))>>12) & 15)<<8;
JOYPAD_IO.directions=0xff7f;
jp_joypads[1] |= ((~(JOYPAD_IO.fires)) & (3<<2))<<(16+4);
JOYPAD_IO.directions=0xff7f;
jp_joypads[1] |= (((~(JOYPAD_IO.directions))>>12) & 15)<<12;
JOYPAD_IO.directions=0xffff;
}
#endif /* SDL_JOYSTICK_MINT */

View file

@ -0,0 +1,150 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997-2006 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Sam Lantinga
slouken@libsdl.org
*/
#include "SDL_config.h"
/* This is the system specific header for the SDL joystick API */
#include <nds.h>
//#include <nds/registers_alt.h>
#include "SDL_error.h"
#include "SDL_events.h"
#include "SDL_joystick.h"
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
#include "../../video/nds/SDL_ndsevents_c.h"
/* Function to scan the system for joysticks.
* This function should set SDL_numjoysticks to the number of available
* joysticks. Joystick 0 should be the system default joystick.
* It should return 0, or -1 on an unrecoverable fatal error.
*/
int SDL_SYS_JoystickInit(void)
{
SDL_numjoysticks = 1;
//keysInit();
return(1);
}
/* Function to get the device-dependent name of a joystick */
const char *SDL_SYS_JoystickName(int index)
{
if(!index)
return "NDS builtin joypad";
SDL_SetError("No joystick available with that index");
return (NULL);
}
/* Function to open a joystick for use.
The joystick to open is specified by the index field of the joystick.
This should fill the nbuttons and naxes fields of the joystick structure.
It returns 0, or -1 if there is an error.
*/
int SDL_SYS_JoystickOpen(SDL_Joystick *joystick)
{
joystick->nbuttons=8;
joystick->nhats=0;
joystick->nballs=0;
joystick->naxes=2;
return 0;
}
/* Function to update the state of a joystick - called as a device poll.
* This function shouldn't update the joystick structure directly,
* but instead should call SDL_PrivateJoystick*() to deliver events
* and update joystick device state.
*/
int prevbutton=0;
int prevkey=0;
int dc=0;int ldc=0;
u32 keysd,keysu=0;
void SDL_SYS_JoystickUpdate(SDL_Joystick *joystick)
{
//dc=keysd;
//if (dc)
//{
//fprintf(stderr,"heartbeat= %d\n",REG_VCOUNT);
//swiWaitForVBlank();
//scanKeys();
//keysd = keysDown();
//keysu = keysUp();
//ldc=keysd;
//}
/*if (prevkey && prevbutton)
{
scanKeys();
}
*/
//scanKeys();
keysd = keysDown();
keysu = keysUp();
short ax=0,v=0,h=0;
if((keysd&KEY_UP)) {ax=1;v=-10;SDL_PrivateJoystickAxis(joystick,ax,v);prevkey=KEY_UP;}//fprintf(stderr,"KEY_UP\n");}
if((keysd&KEY_DOWN)) {ax=1;v=10;SDL_PrivateJoystickAxis(joystick,ax,v);prevkey=KEY_DOWN;}//fprintf(stderr,"KEY_DOWN\n");}
if((keysd&KEY_LEFT)) {ax=0;h=-10;SDL_PrivateJoystickAxis(joystick,ax,h);prevkey=KEY_LEFT;}//fprintf(stderr,"KEY_LEFT\n");}
if((keysd&KEY_RIGHT)) {ax=0;h=10;SDL_PrivateJoystickAxis(joystick,ax,h);prevkey=KEY_RIGHT;}//fprintf(stderr,"KEY_RIGHT\n");}
if((keysu&KEY_UP)) {ax=1;v=0;SDL_PrivateJoystickAxis(joystick,ax,v);prevkey=0;}//fprintf(stderr,"KEY_UP\n");}
if((keysu&KEY_DOWN)) {ax=1;v=0;SDL_PrivateJoystickAxis(joystick,ax,v);prevkey=0;}//fprintf(stderr,"KEY_DOWN\n");}
if((keysu&KEY_LEFT)) {ax=0;h=0;SDL_PrivateJoystickAxis(joystick,ax,h);prevkey=0;}//fprintf(stderr,"KEY_LEFT\n");}
if((keysu&KEY_RIGHT)) {ax=0;h=0;SDL_PrivateJoystickAxis(joystick,ax,h);prevkey=0;}//fprintf(stderr,"KEY_RIGHT\n");}
if((keysd&KEY_A)) {SDL_PrivateJoystickButton(joystick,0,SDL_PRESSED);prevbutton=KEY_A;}
if((keysd&KEY_B)) {SDL_PrivateJoystickButton(joystick,1,SDL_PRESSED);prevbutton=KEY_B;}
if((keysd&KEY_X)) {SDL_PrivateJoystickButton(joystick,2,SDL_PRESSED);prevbutton=KEY_X;}
if((keysd&KEY_Y)) {SDL_PrivateJoystickButton(joystick,3,SDL_PRESSED);prevbutton=KEY_Y;}
if((keysd&KEY_SELECT)) {SDL_PrivateJoystickButton(joystick,6,SDL_PRESSED);prevbutton=KEY_SELECT;}
if((keysd&KEY_START)) {SDL_PrivateJoystickButton(joystick,7,SDL_PRESSED);prevbutton=KEY_START;}
if((keysd&KEY_L)) {SDL_PrivateJoystickButton(joystick,4,SDL_PRESSED);prevbutton=KEY_L;}
if((keysd&KEY_R)) {SDL_PrivateJoystickButton(joystick,5,SDL_PRESSED);prevbutton=KEY_R;}
if((keysu&KEY_A)) {SDL_PrivateJoystickButton(joystick,0,SDL_RELEASED);prevbutton=0;}
if((keysu&KEY_B)) {SDL_PrivateJoystickButton(joystick,1,SDL_RELEASED);prevbutton=0;}
if((keysu&KEY_X)) {SDL_PrivateJoystickButton(joystick,2,SDL_RELEASED);prevbutton=0;}
if((keysu&KEY_Y)) {SDL_PrivateJoystickButton(joystick,3,SDL_RELEASED);prevbutton=0;}
if((keysu&KEY_SELECT)) {SDL_PrivateJoystickButton(joystick,6,SDL_RELEASED);prevbutton=0;}
if((keysu&KEY_START)) {SDL_PrivateJoystickButton(joystick,7,SDL_RELEASED);prevbutton=0;}
if((keysu&KEY_L)) {SDL_PrivateJoystickButton(joystick,4,SDL_RELEASED);prevbutton=0;}
if((keysu&KEY_R)) {SDL_PrivateJoystickButton(joystick,5,SDL_RELEASED);prevbutton=0;}
}
/* Function to close a joystick after use */
void SDL_SYS_JoystickClose(SDL_Joystick *joystick)
{
}
/* Function to perform any system-specific joystick related cleanup */
void SDL_SYS_JoystickQuit(void)
{
}

View file

@ -76,67 +76,58 @@ static char *GetJoystickName(int index, const char *szRegKey)
index (1-16) listed in the registry
*/
char *name = NULL;
HKEY hTopKey;
HKEY hKey;
DWORD regsize;
LONG regresult;
unsigned char regkey[256];
unsigned char regvalue[256];
unsigned char regname[256];
char regkey[256];
char regvalue[256];
char regname[256];
SDL_snprintf((char *) regkey, SDL_arraysize(regkey), "%s\\%s\\%s",
REGSTR_PATH_JOYCONFIG,
szRegKey,
REGSTR_KEY_JOYCURR);
regresult = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
(LPTSTR) &regkey, 0, KEY_READ, &hKey);
if (regresult == ERROR_SUCCESS)
{
/*
find the registry key name for the
joystick's properties
*/
regsize = sizeof(regname);
SDL_snprintf((char *) regvalue, SDL_arraysize(regvalue),
"Joystick%d%s", index+1,
REGSTR_VAL_JOYOEMNAME);
regresult = RegQueryValueExA(hKey,
(char *) regvalue, 0, 0, (LPBYTE) &regname,
(LPDWORD) &regsize);
RegCloseKey(hKey);
if (regresult == ERROR_SUCCESS)
{
/* open that registry key */
SDL_snprintf((char *) regkey, SDL_arraysize(regkey), "%s\\%s",
REGSTR_PATH_JOYOEM, regname);
regresult = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
(char *) regkey, 0, KEY_READ, &hKey);
if (regresult == ERROR_SUCCESS)
{
/* find the size for the OEM name text */
regsize = sizeof(regvalue);
regresult =
RegQueryValueExA(hKey,
REGSTR_VAL_JOYOEMNAME,
0, 0, NULL,
(LPDWORD) &regsize);
if (regresult == ERROR_SUCCESS)
{
/*
allocate enough memory
for the OEM name text ...
*/
name = (char *) SDL_malloc(regsize);
/* ... and read it from the registry */
regresult =
RegQueryValueExA(hKey,
REGSTR_VAL_JOYOEMNAME, 0, 0,
(LPBYTE) name,
(LPDWORD) &regsize);
RegCloseKey(hKey);
}
}
SDL_snprintf(regkey, SDL_arraysize(regkey), "%s\\%s\\%s",
REGSTR_PATH_JOYCONFIG, szRegKey, REGSTR_KEY_JOYCURR);
hTopKey = HKEY_LOCAL_MACHINE;
regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
if (regresult != ERROR_SUCCESS) {
hTopKey = HKEY_CURRENT_USER;
regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
}
if (regresult != ERROR_SUCCESS) {
return NULL;
}
/* find the registry key name for the joystick's properties */
regsize = sizeof(regname);
SDL_snprintf(regvalue, SDL_arraysize(regvalue), "Joystick%d%s", index+1, REGSTR_VAL_JOYOEMNAME);
regresult = RegQueryValueExA(hKey, regvalue, 0, 0, (LPBYTE)regname, &regsize);
RegCloseKey(hKey);
if (regresult != ERROR_SUCCESS) {
return NULL;
}
/* open that registry key */
SDL_snprintf(regkey, SDL_arraysize(regkey), "%s\\%s", REGSTR_PATH_JOYOEM, regname);
regresult = RegOpenKeyExA(hTopKey, regkey, 0, KEY_READ, &hKey);
if (regresult != ERROR_SUCCESS) {
return NULL;
}
/* find the size for the OEM name text */
regsize = sizeof(regvalue);
regresult = RegQueryValueExA(hKey, REGSTR_VAL_JOYOEMNAME, 0, 0, NULL, &regsize);
if (regresult == ERROR_SUCCESS) {
/* allocate enough memory for the OEM name text ... */
name = (char *) SDL_malloc(regsize);
if ( name ) {
/* ... and read it from the registry */
regresult = RegQueryValueExA(hKey,
REGSTR_VAL_JOYOEMNAME, 0, 0,
(LPBYTE) name, &regsize);
}
}
RegCloseKey(hKey);
return(name);
}
@ -167,7 +158,7 @@ int SDL_SYS_JoystickInit(void)
joyinfo.dwSize = sizeof(joyinfo);
joyinfo.dwFlags = JOY_RETURNALL;
result = joyGetPosEx(SYS_JoystickID[i], &joyinfo);
result = joyGetPosEx(i, &joyinfo);
if ( result == JOYERR_NOERROR ) {
result = joyGetDevCaps(i, &joycaps, sizeof(joycaps));
if ( result == JOYERR_NOERROR ) {

View file

@ -31,46 +31,42 @@
#include "SDL_loadso.h"
void *SDL_LoadObject(const char *sofile)
void *
SDL_LoadObject(const char *sofile)
{
void *handle = NULL;
const char *loaderror = "Unknown error";
image_id library_id = load_add_on(sofile);
if ( library_id == B_ERROR ) {
loaderror = "BeOS error";
} else {
handle = (void *)(library_id);
}
if ( handle == NULL ) {
SDL_SetError("Failed loading %s: %s", sofile, loaderror);
}
return(handle);
void *handle = NULL;
image_id library_id = load_add_on(sofile);
if (library_id < 0) {
SDL_SetError(strerror((int) library_id));
} else {
handle = (void *) (library_id);
}
return (handle);
}
void *SDL_LoadFunction(void *handle, const char *name)
void *
SDL_LoadFunction(void *handle, const char *name)
{
void *symbol = NULL;
const char *loaderror = "Unknown error";
image_id library_id = (image_id)handle;
if ( get_image_symbol(library_id,
name, B_SYMBOL_TYPE_TEXT, &symbol) != B_NO_ERROR ) {
loaderror = "Symbol not found";
}
if ( symbol == NULL ) {
SDL_SetError("Failed loading %s: %s", name, loaderror);
}
return(symbol);
void *sym = NULL;
image_id library_id = (image_id) handle;
status_t rc = get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym);
if (rc != B_NO_ERROR) {
SDL_SetError(strerror(rc));
}
return (sym);
}
void SDL_UnloadObject(void *handle)
void
SDL_UnloadObject(void *handle)
{
image_id library_id;
if ( handle != NULL ) {
library_id = (image_id)handle;
unload_add_on(library_id);
}
image_id library_id;
if (handle != NULL) {
library_id = (image_id) handle;
unload_add_on(library_id);
}
}
#endif /* SDL_LOADSO_BEOS */
/* vi: set ts=4 sw=4 expandtab: */

View file

@ -45,11 +45,12 @@ void *SDL_LoadFunction(void *handle, const char *name)
{
void *symbol = dlsym(handle, name);
if ( symbol == NULL ) {
/* append an underscore for platforms that need that. */
size_t len = 1+SDL_strlen(name)+1;
char *_name = SDL_stack_alloc(char, len);
_name[0] = '_';
SDL_strlcpy(&_name[1], name, len);
symbol = dlsym(handle, name);
symbol = dlsym(handle, _name);
SDL_stack_free(_name);
if ( symbol == NULL ) {
SDL_SetError("Failed loading %s: %s", name, (const char *)dlerror());

View file

@ -1,6 +1,6 @@
/*
SDL - Simple DirectMedia Layer
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga
Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Sam Lantinga
slouken@libsdl.org
slouken@devolution.com
*/
/*
@ -39,17 +39,6 @@
#include "SDL_error.h"
#ifndef EXPORT_C
# ifdef __VC32__
# define IMPORT_C __declspec(dllexport)
# define EXPORT_C __declspec(dllexport)
# endif
# ifdef __GCC32__
# define IMPORT_C
# define EXPORT_C __declspec(dllexport)
# endif
#endif
#if defined(__WINS__)
#include <estw32.h>
IMPORT_C void RegisterWsExe(const TDesC &aName);
@ -63,16 +52,33 @@ extern "C" void exit (int ret);
/* Epoc main function */
GLDEF_C TInt E32Main()
#ifdef __WINS__
void GetCmdLine(int& aArgc, char**& aArgv)
{
RChunk chunk;
if(chunk.OpenGlobal(RThread().Name(), ETrue) != KErrNone)
return;
TUint* ptr = (TUint*) chunk.Base();
if(ptr != NULL)
{
aArgc = (int) *(ptr); // count
aArgv = (char**) *(ptr + 1);
}
chunk.Close();
}
#endif
TInt E32Main()
{
/* Get the clean-up stack */
CTrapCleanup* cleanup = CTrapCleanup::New();
#if defined(__WINS__)
/* arrange for access to Win32 stdin/stdout/stderr */
RWin32Stream::StartServer();
#endif
/* Arrange for multi-threaded operation */
SpawnPosixServerThread();
@ -80,50 +86,67 @@ GLDEF_C TInt E32Main()
int argc=0;
char** argv=0;
char** envp=0;
#ifndef __WINS__
__crt0(argc,argv,envp);
#if defined(__WINS__)
/* Cause the graphical Window Server to come into existence */
RSemaphore sem;
sem.CreateGlobal(_L("WsExeSem"),0);
RegisterWsExe(sem.FullName());
#endif
#else
GetCmdLine(argc, argv);
#endif
/* Start the application! */
/* Create stdlib */
_REENT;
/* Set process and thread priority */
RThread currentThread;
/* Set process and thread priority and name */
currentThread.Rename(_L("SdlProgram"));
RThread currentThread;
RProcess thisProcess;
TParse exeName;
exeName.Set(thisProcess.FileName(), NULL, NULL);
currentThread.Rename(exeName.Name());
currentThread.SetProcessPriority(EPriorityLow);
currentThread.SetPriority(EPriorityMuchLess);
/* Call stdlib main */
/* Call stdlib main */
int ret = main(argc, argv, envp); /* !! process exits here if there is "exit()" in main! */
/* Call exit */
exit(ret); /* !! process exits here! */
//exit(ret); /* !! process exits here! */
//Markus: I do not understand above
//I commented it at let this function
//to return ret value - was it purpose
//that cleanup below is not called at all - why?
/* Free resources and return */
_cleanup(); //this is normally called at exit, I call it here, Markus
CloseSTDLIB();
delete cleanup;
return(KErrNone);
delete cleanup;
#ifdef __WINS__
// User::Panic(_L("exit"), ret);
// RThread().Kill(ret); //Markus get rid of this thread
// RThread().RaiseException(EExcKill);
#endif
return ret;//Markus, or exit(ret); ??
//return(KErrNone);
}
#ifdef __WINS__
EXPORT_C TInt WinsMain()
{
return E32Main();
// return WinsMain(0, 0, 0);
}
#endif
/* Epoc dll entry point */
#if defined(__WINS__)
GLDEF_C TInt E32Dll(TDllReason)
{
return(KErrNone);
}
EXPORT_C TInt WinsMain(TAny *)
{
E32Main();
return KErrNone;
}
#endif

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,809 @@
// INCLUDES
#include <aknapp.h>
#include <aknappui.h>
#include <eikdoc.h>
#include <sdlepocapi.h>
#include <bautils.h>
#include <eikstart.h>
#include <badesca.h>
#include <bautils.h>
#include <apgcli.h>
#include <sdlmain.h>
#include <eikedwin.h>
#include <eiklabel.h>
#include <sdlexe.rsg>
#include <aknglobalmsgquery.h>
#include <apgwgnam.h>
// FORWARD DECLARATIONS
class CApaDocument;
//const TUid KSDLUID = { 0xF01F605E };
LOCAL_C void MakeCCmdLineL(const TDesC8& aParam, CDesC8Array& aArray)
{
const TChar dq('\"');
TLex8 lex(aParam);
TBool in = EFalse;
lex.SkipSpaceAndMark();
while(!lex.Eos())
{
TPtrC8 ptr;
if(in)
{
const TPtrC8 rem = lex.RemainderFromMark();
const TInt pos = rem.Locate(dq);
if(pos > 0)
{
lex.Inc(pos);
ptr.Set(lex.MarkedToken());
lex.SkipAndMark(1);
}
else
{
ptr.Set(rem);
}
in = EFalse;
}
else
{
ptr.Set(lex.NextToken());
const TInt pos = ptr.Locate(dq);
if(pos == 0)
{
lex.UnGetToMark();
lex.SkipAndMark(1);
in = ETrue;
continue; // back to in brace
}
else
lex.SkipSpaceAndMark();
}
aArray.AppendL(ptr);
}
}
NONSHARABLE_CLASS(TVirtualCursor) : public MOverlay
{
public:
TVirtualCursor();
void Set(const TRect& aRect, CFbsBitmap* aBmp, CFbsBitmap* aAlpha);
void Move(TInt aX, TInt aY);
void MakeEvent(TWsEvent& aEvent, const TPoint& aBasePos) const;
void Toggle();
TBool IsOn() const;
private:
void Draw(CBitmapContext& aGc, const TRect& aTargetRect, const TSize& aSize);
private:
TRect iRect;
TPoint iInc;
TPoint iPos;
TBool iIsOn;
CFbsBitmap* iCBmp;
CFbsBitmap* iAlpha;
};
TVirtualCursor::TVirtualCursor() : iInc(0, 0), iIsOn(EFalse), iCBmp(NULL)
{
}
const TInt KMaxMove = 10;
void TVirtualCursor::Move(TInt aX, TInt aY)
{
if(aX > 0 && iInc.iX > 0)
++iInc.iX;
else if(aX < 0 && iInc.iX < 0)
--iInc.iX;
else
iInc.iX = aX;
if(aY > 0 && iInc.iY > 0)
++iInc.iY;
else if(aY < 0 && iInc.iY < 0)
--iInc.iY;
else
iInc.iY = aY;
iInc.iX = Min(KMaxMove, iInc.iX);
iInc.iX = Max(-KMaxMove, iInc.iX);
iInc.iY = Min(KMaxMove, iInc.iY);
iInc.iY =Max(-KMaxMove, iInc.iY);
const TPoint pos = iPos + iInc;
if(iRect.Contains(pos))
{
iPos = pos;
}
else
{
iInc = TPoint(0, 0);
}
}
void TVirtualCursor::Toggle()
{
iIsOn = !iIsOn;
}
TBool TVirtualCursor::IsOn() const
{
return iIsOn;
}
void TVirtualCursor::Set(const TRect& aRect, CFbsBitmap* aBmp, CFbsBitmap* aAlpha)
{
iRect = aRect;
iCBmp = aBmp;
iAlpha = aAlpha;
}
void TVirtualCursor::MakeEvent(TWsEvent& aEvent, const TPoint& aBasePos) const
{
aEvent.SetType(EEventPointer),
aEvent.SetTimeNow();
TPointerEvent& pointer = *aEvent.Pointer();
pointer.iType = TPointerEvent::EButton1Down;
pointer.iPosition = iPos;
pointer.iParentPosition = aBasePos;
}
void TVirtualCursor::Draw(CBitmapContext& aGc, const TRect& /*aTargetRect*/, const TSize& /*aSize*/)
{
if(iIsOn && iCBmp != NULL)
{
const TRect rect(TPoint(0, 0), iCBmp->SizeInPixels());
aGc.AlphaBlendBitmaps(iPos, iCBmp, rect, iAlpha, TPoint(0, 0));
}
}
NONSHARABLE_CLASS(TSdlClass)
{
public:
TSdlClass();
void SetMain(const TMainFunc& aFunc, TInt aFlags, MSDLMainObs* aObs, TInt aExeFlags);
TInt SdlFlags() const;
const TMainFunc& Main() const;
void SendEvent(TInt aEvent, TInt aParam, CSDL* aSDL);
TInt AppFlags() const;
void AppFlags(TInt aFlags);
private:
TMainFunc iFunc;
TInt iSdlFlags;
TInt iExeFlags;
MSDLMainObs* iObs;
};
void TSdlClass::AppFlags(TInt aFlags)
{
iExeFlags |= aFlags;
}
void TSdlClass::SendEvent(TInt aEvent, TInt aParam, CSDL* aSDL)
{
if(iObs != NULL)
iObs->SDLMainEvent(aEvent, aParam, aSDL);
}
TInt TSdlClass::AppFlags() const
{
return iExeFlags;
}
void TSdlClass::SetMain(const TMainFunc& aFunc, TInt aFlags, MSDLMainObs* aObs, TInt aExeFlags)
{
iFunc = aFunc;
iSdlFlags = aFlags;
iExeFlags = aExeFlags;
iObs = aObs;
}
const TMainFunc& TSdlClass::Main() const
{
return iFunc;
}
TInt TSdlClass::SdlFlags() const
{
return iSdlFlags;
}
TSdlClass::TSdlClass()
{
Mem::FillZ(this, sizeof(this));
}
TSdlClass gSDLClass;
////////////////////////////////////////////////////////////////
NONSHARABLE_CLASS(CSDLApplication) : public CAknApplication
{
public:
CSDLApplication();
private:
CApaDocument* CreateDocumentL();
TFileName ResourceFileName() const;
TUid AppDllUid() const;
void FindMeL();
TUid iUid;
};
NONSHARABLE_CLASS(CSDLDocument) : public CEikDocument
{
public:
CSDLDocument(CEikApplication& aApp);
private:
CEikAppUi* CreateAppUiL();
};
////////////////////////////////////////////////////////////////////
NONSHARABLE_CLASS(MExitWait)
{
public:
virtual void DoExit(TInt aErr) = 0;
};
/////////////////////////////////////////////////////////////////////////
NONSHARABLE_CLASS(CExitWait) : public CActive
{
public:
CExitWait(MExitWait& aWait);
~CExitWait();
private:
void RunL();
void DoCancel();
private:
MExitWait& iWait;
TRequestStatus* iStatusPtr;
};
////////////////////////////////////////////////////////////////////////
NONSHARABLE_CLASS(CSDLWin) : public CCoeControl
{
public:
void ConstructL(const TRect& aRect);
RWindow& GetWindow() const;
void SetNoDraw();
private:
void Draw(const TRect& aRect) const;
private:
TBool iNoDraw;
};
////////////////////////////////////////////////////////////////////////////
NONSHARABLE_CLASS(CSDLAppUi) : public CAknAppUi, public MExitWait, MSDLObserver
{
public:
~CSDLAppUi();
private: // New functions
void ConstructL();
void HandleCommandL(TInt aCommand);
void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
void HandleResourceChangeL(TInt aType);
void DoExit(TInt aErr);
TInt SdlEvent(TInt aEvent, TInt aParam);
TInt SdlThreadEvent(TInt aEvent, TInt aParam);
void StartL();
static TBool StartL(TAny* aThis);
TBool ParamEditorL(TDes& aCheat);
TBool ProcessCommandParametersL(CApaCommandLine &aCommandLine);
void PrepareToExit();
void HandleConsoleWindowL();
void HandleConsoleWindow();
void HandleForegroundEventL(TBool aForeground);
static TBool IdleRequestL(TAny* aThis);
TBool HandleKeyL(const TWsEvent& aEvent);
private:
CExitWait* iWait;
CSDLWin* iSDLWin;
CSDL* iSdl;
CIdle* iStarter;
TBool iExitRequest;
CDesC8Array* iParams;
TInt iResOffset;
CIdle* iIdle;
TInt iStdOut;
TVirtualCursor iCursor;
CFbsBitmap* iCBmp;
CFbsBitmap* iAlpha;
// TTime iLastPress;
// CSDL::TOrientationMode iOrientation;
};
////////////////////////////////////////////////////////////////////////////////////////7
CApaDocument* CSDLApplication::CreateDocumentL()
{
return new (ELeave) CSDLDocument(*this);
}
TUid CSDLApplication::AppDllUid() const
{
return iUid;
}
CSDLApplication::CSDLApplication()
{
TRAPD(err, FindMeL());
ASSERT(err == KErrNone);
}
void CSDLApplication::FindMeL()
{
RApaLsSession apa;
User::LeaveIfError(apa.Connect());
CleanupClosePushL(apa);
User::LeaveIfError(apa.GetAllApps());
TFileName name = RProcess().FileName();
TApaAppInfo info;
while(apa.GetNextApp(info) == KErrNone)
{
if(info.iFullName.CompareF(name) == 0)
{
iUid = info.iUid;
break;
}
}
CleanupStack::PopAndDestroy();
}
TFileName CSDLApplication::ResourceFileName() const
{
return KNullDesC();
}
///////////////////////////////////////////////////////////////////////////////////////////
CExitWait::CExitWait(MExitWait& aWait) : CActive(CActive::EPriorityStandard), iWait(aWait)
{
CActiveScheduler::Add(this);
SetActive();
iStatusPtr = &iStatus;
}
CExitWait::~CExitWait()
{
Cancel();
}
void CExitWait::RunL()
{
if(iStatusPtr != NULL )
iWait.DoExit(iStatus.Int());
}
void CExitWait::DoCancel()
{
if(iStatusPtr != NULL )
User::RequestComplete(iStatusPtr , KErrCancel);
}
//////////////////////////////////////////////////////////////////////////////////////////////
CSDLDocument::CSDLDocument(CEikApplication& aApp) : CEikDocument(aApp)
{}
CEikAppUi* CSDLDocument::CreateAppUiL()
{
return new (ELeave) CSDLAppUi;
}
///////////////////////////////////////////////////////////////////////////
void CSDLWin:: ConstructL(const TRect& aRect)
{
CreateWindowL();
SetRect(aRect);
ActivateL();
}
RWindow& CSDLWin::GetWindow() const
{
return Window();
}
void CSDLWin::Draw(const TRect& /*aRect*/) const
{
if(!iNoDraw)
{
CWindowGc& gc = SystemGc();
gc.SetPenStyle(CGraphicsContext::ESolidPen);
gc.SetPenColor(KRgbGray);
gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
gc.SetBrushColor(0xaaaaaa);
gc.DrawRect(Rect());
}
}
void CSDLWin::SetNoDraw()
{
iNoDraw = ETrue;
}
/////////////////////////////////////////////////////////////////////////
CSDLAppUi::~CSDLAppUi()
{
if(iIdle)
iIdle->Cancel();
delete iIdle;
if(iStarter != NULL)
iStarter->Cancel();
delete iStarter;
delete iWait;
delete iSdl;
delete iSDLWin;
delete iParams;
delete iCBmp;
delete iAlpha;
}
void CSDLAppUi::ConstructL()
{
BaseConstructL(ENoAppResourceFile | ENoScreenFurniture);
RLibrary lib;
User::LeaveIfError(lib.Load(_L("sdlexe.dll")));
TFileName name = lib.FileName();
lib.Close();
name.Replace(3, name.Length() - 3, _L("resource\\apps\\sdlexe.rsc"));
BaflUtils::NearestLanguageFile(iEikonEnv->FsSession(), name);
iResOffset = iCoeEnv->AddResourceFileL(name);
name.Replace(name.Length() - 3, 3, _L("mbm"));
TEntry e;
const TInt err = iEikonEnv->FsSession().Entry(name, e);
iCBmp = iEikonEnv->CreateBitmapL(name, 0);
iAlpha = iEikonEnv->CreateBitmapL(name, 1);
iIdle = CIdle::NewL(CActive::EPriorityIdle);
iSDLWin = new (ELeave) CSDLWin;
iSDLWin->ConstructL(ApplicationRect());
iSdl = CSDL::NewL(gSDLClass.SdlFlags());
gSDLClass.SendEvent(MSDLMainObs::ESDLCreated, 0, iSdl);
iSdl->SetObserver(this);
iSdl->DisableKeyBlocking(*this);
iSdl->SetContainerWindowL(
iSDLWin->GetWindow(),
iEikonEnv->WsSession(),
*iEikonEnv->ScreenDevice());
iSdl->AppendOverlay(iCursor, 0);
iCursor.Set(TRect(TPoint(0, 0), iSDLWin->Size()), iCBmp, iAlpha);
iStarter = CIdle::NewL(CActive::EPriorityLow);
iStarter->Start(TCallBack(StartL, this));
}
TBool CSDLAppUi::StartL(TAny* aThis)
{
static_cast<CSDLAppUi*>(aThis)->StartL();
return EFalse;
}
void CSDLAppUi::PrepareToExit()
{
CAknAppUiBase::PrepareToExit(); //aknappu::PrepareToExit crashes
iCoeEnv->DeleteResourceFile(iResOffset);
}
TBool CSDLAppUi::ProcessCommandParametersL(CApaCommandLine &aCommandLine)
{
const TPtrC8 cmdLine = aCommandLine.TailEnd();
iParams = new (ELeave) CDesC8ArrayFlat(8);
MakeCCmdLineL(cmdLine, *iParams);
return EFalse;
}
TBool CSDLAppUi::ParamEditorL(TDes& aCheat)
{
CAknTextQueryDialog* query = CAknTextQueryDialog::NewL(aCheat);
CleanupStack::PushL(query);
query->SetPromptL(_L("Enter parameters"));
CleanupStack::Pop();
return query->ExecuteLD(R_PARAMEDITOR);
}
void CSDLAppUi::StartL()
{
if(gSDLClass.AppFlags() & SDLEnv::EParamQuery)
{
TBuf8<256> cmd;
RFile file;
TInt err = file.Open(iEikonEnv->FsSession(), _L("sdl_param.txt"),EFileRead);
if(err == KErrNone)
{
file.Read(cmd);
file.Close();
MakeCCmdLineL(cmd, *iParams);
}
if(err != KErrNone || gSDLClass.AppFlags() & (SDLEnv::EParamQueryDialog ^ SDLEnv::EParamQuery))
{
TBuf<256> buffer;
if(ParamEditorL(buffer))
{
cmd.Copy(buffer);
MakeCCmdLineL(cmd, *iParams);
}
}
}
iWait = new (ELeave) CExitWait(*this);
iSdl->CallMainL(gSDLClass.Main(), &iWait->iStatus, iParams, CSDL::ENoParamFlags, 0xA000);
}
void CSDLAppUi::HandleCommandL(TInt aCommand)
{
switch(aCommand)
{
case EAknSoftkeyBack:
case EAknSoftkeyExit:
case EAknCmdExit:
case EEikCmdExit:
gSDLClass.AppFlags(SDLEnv::EAllowConsoleView);
if(iWait == NULL || !iWait->IsActive() || iSdl == NULL)
{
Exit();
}
else if(!iExitRequest)
{
iExitRequest = ETrue; //trick how SDL can be closed!
iSdl->Suspend();
}
break;
}
}
TBool CSDLAppUi::HandleKeyL(const TWsEvent& aEvent)
{
const TInt type = aEvent.Type();
if(!(type == EEventKey || type == EEventKeyUp || type == EEventKeyDown))
{
return ETrue;
}
const TKeyEvent& key = *aEvent.Key();
if((key.iScanCode == EStdKeyYes) && (gSDLClass.AppFlags() & SDLEnv::EVirtualMouse))
{
if(type == EEventKeyUp)
{
iCursor.Toggle();
iSdl->RedrawRequest();
}
return EFalse;
}
if(iCursor.IsOn())
{
switch(key.iScanCode)
{
case EStdKeyUpArrow:
iCursor.Move(0, -1);
break;
case EStdKeyDownArrow:
iCursor.Move(0, 1);
break;
case EStdKeyLeftArrow:
iCursor.Move(-1, 0);
break;
case EStdKeyRightArrow:
iCursor.Move(1, 0);
break;
case EStdKeyDevice3:
if(type == EEventKeyUp)
{
TWsEvent event;
iCursor.MakeEvent(event, iSDLWin->Position());
iSdl->AppendWsEvent(event);
}
return EFalse;
default:
return ETrue;
}
iSdl->RedrawRequest();
return EFalse;
}
return ETrue;
}
void CSDLAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination)
{
if(iSdl && iWait && HandleKeyL(aEvent))
iSdl->AppendWsEvent(aEvent);
CAknAppUi::HandleWsEventL(aEvent, aDestination);
}
void CSDLAppUi::HandleResourceChangeL(TInt aType)
{
CAknAppUi::HandleResourceChangeL(aType);
if(aType == KEikDynamicLayoutVariantSwitch)
{
iSDLWin->SetRect(ApplicationRect());
iSdl->SetContainerWindowL(
iSDLWin->GetWindow(),
iEikonEnv->WsSession(),
*iEikonEnv->ScreenDevice());
}
}
void CSDLAppUi::DoExit(TInt/*Err*/)
{
iExitRequest = ETrue;
Exit();
}
TInt CSDLAppUi::SdlThreadEvent(TInt aEvent, TInt /*aParam*/)
{
switch(aEvent)
{
case MSDLObserver::EEventResume:
break;
case MSDLObserver::EEventSuspend:
if(iExitRequest)
return MSDLObserver::ESuspendNoSuspend;
break;
case MSDLObserver::EEventWindowReserved:
break;
case MSDLObserver::EEventWindowNotAvailable:
break;
case MSDLObserver::EEventScreenSizeChanged:
break;
}
return MSDLObserver::EParameterNone;
}
TInt CSDLAppUi::SdlEvent(TInt aEvent, TInt /*aParam*/)
{
switch(aEvent)
{
case MSDLObserver::EEventResume:
break;
case MSDLObserver::EEventSuspend:
if(iExitRequest)
return MSDLObserver::ESuspendNoSuspend;
break;
case MSDLObserver::EEventWindowReserved:
break;
case MSDLObserver::EEventWindowNotAvailable:
{
TRAP_IGNORE(HandleConsoleWindowL());
}
break;
case MSDLObserver::EEventScreenSizeChanged:
break;
case MSDLObserver::EEventKeyMapInit:
break;
case MSDLObserver::EEventMainExit:
if(iStdOut != 0)
{
gSDLClass.AppFlags(SDLEnv::EAllowConsoleView);
iEikonEnv->WsSession().SetWindowGroupOrdinalPosition(iStdOut, 0);
}
break;
}
return MSDLObserver::EParameterNone;
}
void CSDLAppUi::HandleForegroundEventL(TBool aForeground)
{
CAknAppUi::HandleForegroundEventL(aForeground);
if(!aForeground)
HandleConsoleWindow();
}
void CSDLAppUi::HandleConsoleWindow()
{
if(!iIdle->IsActive())
iIdle->Start(TCallBack(IdleRequestL, this));
}
TBool CSDLAppUi::IdleRequestL(TAny* aThis)
{
static_cast<CSDLAppUi*>(aThis)->HandleConsoleWindowL();
return EFalse;
}
void CSDLAppUi::HandleConsoleWindowL()
{
if(gSDLClass.AppFlags() & SDLEnv::EAllowConsoleView)
{
return;
}
RWsSession& ses = iEikonEnv->WsSession();
const TInt focus = ses.GetFocusWindowGroup();
CApaWindowGroupName* name = CApaWindowGroupName::NewLC(ses, focus);
const TPtrC caption = name->Caption();
if(0 == caption.CompareF(_L("STDOUT")))
{
iStdOut = focus;
ses.SetWindowGroupOrdinalPosition(iEikonEnv->RootWin().Identifier(), 0);
}
CleanupStack::PopAndDestroy(); //name
}
////////////////////////////////////////////////////////////////////////
CApaApplication* NewApplication()
{
return new CSDLApplication();
}
EXPORT_C TInt SDLEnv::SetMain(const TMainFunc& aFunc, TInt aSdlFlags, MSDLMainObs* aObs, TInt aSdlExeFlags)
{
gSDLClass.SetMain(aFunc, aSdlFlags, aObs, aSdlExeFlags);
return EikStart::RunApplication(NewApplication);
}
//////////////////////////////////////////////////////////////////////
TInt SDLUiPrint(const TDesC8& /*aInfo*/)
{
return KErrNotFound;
}

View file

@ -0,0 +1,12 @@
#include<eikstart.h>
#include<sdlmain.h>
#include<sdlepocapi.h>
GLREF_C TInt E32Main()
{
return SDLEnv::SetMain(SDL_main, CSDL::EEnableFocusStop | CSDL::EAllowImageResize,
NULL, SDLEnv::EParamQuery | SDLEnv::EVirtualMouse);
}

View file

@ -0,0 +1,62 @@
/*
vectorbuffer.cpp
yet another circle buffer
Markus Mertama
*/
#include"vectorbuffer.h"
void VectorPanic(TInt aErr, TInt aLine)
{
TBuf<64> b;
b.Format(_L("vector buffer at % d "), aLine);
User::Panic(b, aErr);
}
void TNodeBuffer::TNode::Terminator(TNodeBuffer::TNode* aNode)
{
Mem::Copy(iSucc, &aNode, sizeof(TNode*));
}
TInt TNodeBuffer::TNode::Size() const
{
return reinterpret_cast<const TUint8*>(iSucc) - Ptr();
}
const TUint8* TNodeBuffer::TNode::Ptr() const
{
return reinterpret_cast<const TUint8*>(this) + sizeof(TNode);
}
TNodeBuffer::TNode* TNodeBuffer::TNode::Empty(TUint8* aBuffer)
{
TNode* node = reinterpret_cast<TNode*>(aBuffer);
node->iSucc = node + 1;
return node;
}
TNodeBuffer::TNode* TNodeBuffer::TNode::New(TNode* aPred, const TDesC8& aData)
{
TNode* node = aPred->Size() == 0 ? aPred : aPred->iSucc;
TUint8* start = reinterpret_cast<TUint8*>(node) + sizeof(TNode);
node->iSucc = reinterpret_cast<TNode*>(start + aData.Size());
node->iSucc->iSucc = NULL; //terminator
__ASSERT_DEBUG(node->Size() == aData.Size(), VECPANIC(KErrCorrupt));
Mem::Copy(start, aData.Ptr(), aData.Size());
return node;
}

View file

@ -0,0 +1,240 @@
/*
vectorbuffer.cpp
yet another circle buffer
Markus Mertama
*/
#ifndef __VECTORBUFFER_H__
#define __VECTORBUFFER_H__
#include<e32std.h>
#define VLOG(x)
#define VECPANIC(x) VectorPanic(x, __LINE__)
void VectorPanic(TInt, TInt);
//int DEBUG_INT;
NONSHARABLE_CLASS(TNodeBuffer)
{
public:
protected:
NONSHARABLE_CLASS(TNode)
{
public:
static TNode* Empty(TUint8* iBuffer);
static TNode* New(TNode* aPrev, const TDesC8& aData);
const TUint8* Ptr() const;
TInt Size() const;
inline TNode* Succ();
static void SetSucc(TNode*& aNode);
void Terminator(TNode* aNode);
private:
TNode* iSucc;
};
};
inline TNodeBuffer::TNode* TNodeBuffer::TNode::Succ()
{
return iSucc;
}
template <TInt C>
NONSHARABLE_CLASS(TVectorBuffer) : public TNodeBuffer
{
public:
TVectorBuffer();
TInt Append(const TDesC8& aData);
// TInt AppendOverwrite(const TDesC8& aData);
TPtrC8 Shift();
TPtrC8 operator[](TInt aIndex) const;
TInt Size() const;
private:
TInt GetRoom(TInt aSize) const;
TInt Unreserved() const;
private:
TNode* iTop;
TNode* iBottom;
TInt iSize;
TUint8 iBuffer[C];
};
template <TInt C>
TVectorBuffer<C>::TVectorBuffer() : iSize(0)
{
Mem::FillZ(iBuffer, C);
iTop = TNode::Empty(iBuffer); //these points to buffer
iBottom = TNode::Empty(iBuffer);
}
template<TInt C >
TInt TVectorBuffer<C>::Unreserved() const
{
__ASSERT_DEBUG(iBottom < iBottom->Succ(), VECPANIC(KErrCorrupt));
const TInt bytesbetween =
reinterpret_cast<const TUint8*>(iBottom->Succ()) -
reinterpret_cast<const TUint8*>(iTop);
const TInt topsize = sizeof(TNode);
if(bytesbetween > 0) //bytesbetween is room between bottom and top
{ //therefore free room is subracted from free space
const TInt room = C - bytesbetween - topsize;
return room;
}
if(bytesbetween == 0)
{
if(Size() > 0)
return 0;
else
return C - topsize;
}
const TInt room = -bytesbetween - topsize; //free is space between pointers
return room;
}
template <TInt C>
TInt TVectorBuffer<C>::GetRoom(TInt aSize) const
{
const TInt bytesnew = sizeof(TNode) + aSize;
const TInt room = Unreserved() - bytesnew;
return room;
}
template <TInt C>
TInt TVectorBuffer<C>::Append(const TDesC8& aData) //ei ole ok!
{
const TInt len = aData.Length();
if(GetRoom(len) < 0)
{
return KErrOverflow;
}
if(iBottom->Succ()->Ptr() - iBuffer > (C - (len + TInt(sizeof(TNode)))))
{
VLOG("rc");
// RDebug::Print(_L("vector: append"));
TNode* p = TNode::Empty(iBuffer);
iBottom->Terminator(p);
iBottom = p;
return Append(aData);
// Append();
// iBottom = TNode::New(p, aData); //just append something into end
}
//DEBUG_INT++;
iBottom = TNode::New(iBottom, aData);
iSize += len;
return KErrNone;
}
/*
template <TInt C>
TInt TVectorBuffer<C>::AppendOverwrite(const TDesC8& aData) //ei ole ok!
{
while(Append(aData) == KErrOverflow)
{
if(iTop->Succ() == NULL)
{
return KErrUnderflow;
}
//Shift(); //data is lost
}
return KErrNone;
}
*/
template <TInt C>
TPtrC8 TVectorBuffer<C>::Shift()
{
__ASSERT_ALWAYS(iTop->Succ() != NULL, VECPANIC(KErrUnderflow)); //can never pass-by bottom
TNode* node = iTop;
iTop = iTop->Succ();
if(iTop > node)
{
// DEBUG_INT--;
iSize -= node->Size();
return TPtrC8(node->Ptr(), node->Size());
}
else
{
// RDebug::Print(_L("vector: shift"));
return Shift(); //this happens when buffer is terminated, and data lies in next
}
}
template <TInt C>
TInt TVectorBuffer<C>::Size() const
{
return iSize;
}
template <TInt C>
TPtrC8 TVectorBuffer<C>::operator[](TInt aIndex) const
{
TInt index = 0;
TNode* t = iTop->Size() > 0 ? iTop : iTop->Succ(); //eliminate terminator
while(index < aIndex)
{
TNode* nt = t->Succ();
if(nt < t)
{
nt = nt->Succ();
}
t = nt;
if(t->Size() > 0)
index++;
__ASSERT_ALWAYS(t->Succ() != NULL, VECPANIC(KErrUnderflow)); //can never pass-by bottom
}
return t->Ptr();
}
template <class T, TInt C>
NONSHARABLE_CLASS(TVector) : public TVectorBuffer<C * sizeof(T)>
{
public:
TVector();
TInt Append(const T& aData);
const T& Shift();
TInt Size() const;
const T& operator[](TInt aIndex) const;
};
template <class T, TInt C>
TVector<T, C>::TVector() : TVectorBuffer<C * sizeof(T)>()
{
}
template <class T, TInt C>
TInt TVector<T, C>::Append(const T& aData)
{
const TPckgC<T> data(aData);
return TVectorBuffer<C * sizeof(T)>::Append(data);
}
template <class T, TInt C>
const T& TVector<T, C>::Shift()
{
const TPtrC8 ptr = TVectorBuffer<C * sizeof(T)>::Shift();
return *(reinterpret_cast<const T*>(ptr.Ptr()));
}
template <class T, TInt C>
TInt TVector<T, C>::Size() const
{
return TVectorBuffer<C * sizeof(T)>::Size() / sizeof(T);
}
template <class T, TInt C>
const T& TVector<T, C>::operator[](TInt aIndex) const
{
const TPtrC8 ptr = TVectorBuffer<C * sizeof(T)>::operator[](aIndex);
return *(reinterpret_cast<const T*>(ptr.Ptr()));
}
#endif

View file

@ -234,12 +234,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
char **argv;
int argc;
char *cmdline;
DWORD pathlen;
#ifdef _WIN32_WCE
wchar_t path[MAX_PATH];
#else
char path[MAX_PATH];
#endif
#ifdef _WIN32_WCE
wchar_t *bufp;
int nLen;
@ -248,6 +242,12 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
size_t nLen;
#endif
#ifndef NO_STDIO_REDIRECT
DWORD pathlen;
#ifdef _WIN32_WCE
wchar_t path[MAX_PATH];
#else
char path[MAX_PATH];
#endif
FILE *newfp;
#endif

39
src/main/win32/version.rc Normal file
View file

@ -0,0 +1,39 @@
#define APSTUDIO_READONLY_SYMBOLS
#include "afxres.h"
#undef APSTUDIO_READONLY_SYMBOLS
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,12,0
PRODUCTVERSION 1,2,12,0
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "SDL\0"
VALUE "FileVersion", "1, 2, 12, 0\0"
VALUE "InternalName", "SDL\0"
VALUE "LegalCopyright", "Copyright © 2007 Sam Lantinga\0"
VALUE "OriginalFilename", "SDL.dll\0"
VALUE "ProductName", "Simple DirectMedia Layer\0"
VALUE "ProductVersion", "1, 2, 12, 0\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

View file

@ -25,7 +25,7 @@
#ifndef HAVE_GETENV
#if defined(__WIN32__) && !defined(_WIN32_WCE)
#if defined(__WIN32__) && !defined(_WIN32_WCE) && !defined(__SYMBIAN32__)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>

View file

@ -28,13 +28,27 @@
#ifdef HAVE_ICONV
/* Depending on which standard the iconv() was implemented with,
iconv() may or may not use const char ** for the inbuf param.
If we get this wrong, it's just a warning, so no big deal.
*/
#if defined(_XGP6) || \
defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2))
#define ICONV_INBUF_NONCONST
#endif
#include <errno.h>
size_t SDL_iconv(SDL_iconv_t cd,
char **inbuf, size_t *inbytesleft,
const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
size_t retCode = iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft);
size_t retCode;
#ifdef ICONV_INBUF_NONCONST
retCode = iconv(cd, (char **)inbuf, inbytesleft, outbuf, outbytesleft);
#else
retCode = iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft);
#endif
if ( retCode == (size_t)-1 ) {
switch(errno) {
case E2BIG:
@ -95,7 +109,7 @@ static struct {
} encodings[] = {
{ "ASCII", ENCODING_ASCII },
{ "US-ASCII", ENCODING_ASCII },
{ "LATIN1", ENCODING_LATIN1 },
{ "8859-1", ENCODING_LATIN1 },
{ "ISO-8859-1", ENCODING_LATIN1 },
{ "UTF8", ENCODING_UTF8 },
{ "UTF-8", ENCODING_UTF8 },
@ -117,12 +131,54 @@ static struct {
{ "UCS-4", ENCODING_UCS4 },
};
static const char *getlocale(char *buffer, size_t bufsize)
{
const char *lang;
char *ptr;
lang = SDL_getenv("LC_ALL");
if ( !lang ) {
lang = SDL_getenv("LC_CTYPE");
}
if ( !lang ) {
lang = SDL_getenv("LC_MESSAGES");
}
if ( !lang ) {
lang = SDL_getenv("LANG");
}
if ( !lang || !*lang || SDL_strcmp(lang, "C") == 0 ) {
lang = "ASCII";
}
/* We need to trim down strings like "en_US.UTF-8@blah" to "UTF-8" */
ptr = SDL_strchr(lang, '.');
if (ptr != NULL) {
lang = ptr + 1;
}
SDL_strlcpy(buffer, lang, bufsize);
ptr = SDL_strchr(buffer, '@');
if (ptr != NULL) {
*ptr = '\0'; /* chop end of string. */
}
return buffer;
}
SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode)
{
int src_fmt = ENCODING_UNKNOWN;
int dst_fmt = ENCODING_UNKNOWN;
int i;
char fromcode_buffer[64];
char tocode_buffer[64];
if ( !fromcode || !*fromcode ) {
fromcode = getlocale(fromcode_buffer, sizeof(fromcode_buffer));
}
if ( !tocode || !*tocode ) {
tocode = getlocale(tocode_buffer, sizeof(tocode_buffer));
}
for ( i = 0; i < SDL_arraysize(encodings); ++i ) {
if ( SDL_strcasecmp(fromcode, encodings[i].name) == 0 ) {
src_fmt = encodings[i].format;
@ -149,11 +205,12 @@ SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode)
}
size_t SDL_iconv(SDL_iconv_t cd,
char **inbuf, size_t *inbytesleft,
const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
/* For simplicity, we'll convert everything to and from UCS-4 */
char *src, *dst;
const char *src;
char *dst;
size_t srclen, dstlen;
Uint32 ch = 0;
size_t total;
@ -755,7 +812,7 @@ int SDL_iconv_close(SDL_iconv_t cd)
#endif /* !HAVE_ICONV */
char *SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft)
char *SDL_iconv_string(const char *tocode, const char *fromcode, const char *inbuf, size_t inbytesleft)
{
SDL_iconv_t cd;
char *string;
@ -765,6 +822,16 @@ char *SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, si
size_t retCode = 0;
cd = SDL_iconv_open(tocode, fromcode);
if ( cd == (SDL_iconv_t)-1 ) {
/* See if we can recover here (fixes iconv on Solaris 11) */
if ( !tocode || !*tocode ) {
tocode = "UTF-8";
}
if ( !fromcode || !*fromcode ) {
tocode = "UTF-8";
}
cd = SDL_iconv_open(tocode, fromcode);
}
if ( cd == (SDL_iconv_t)-1 ) {
return NULL;
}

View file

@ -3408,7 +3408,7 @@ static void* sys_alloc(mstate m, size_t nb) {
if (ss == 0) { /* First time through or recovery */
char* base = (char*)CALL_MORECORE(0);
if (base != CMFAIL) {
asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE);
asize = granularity_align(nb + TOP_FOOT_SIZE + MALLOC_ALIGNMENT + SIZE_T_ONE);
/* Adjust to end on a page boundary */
if (!is_page_aligned(base))
asize += (page_align((size_t)base) - (size_t)base);
@ -3422,7 +3422,7 @@ static void* sys_alloc(mstate m, size_t nb) {
}
else {
/* Subtract out existing available top space from MORECORE request. */
asize = granularity_align(nb - m->topsize + TOP_FOOT_SIZE + SIZE_T_ONE);
asize = granularity_align(nb - m->topsize + TOP_FOOT_SIZE + MALLOC_ALIGNMENT + SIZE_T_ONE);
/* Use mem here only if it did continuously extend old space */
if (asize < HALF_MAX_SIZE_T &&
(br = (char*)(CALL_MORECORE(asize))) == ss->base+ss->size) {
@ -3435,7 +3435,7 @@ static void* sys_alloc(mstate m, size_t nb) {
if (br != CMFAIL) { /* Try to use/extend the space we did get */
if (asize < HALF_MAX_SIZE_T &&
asize < nb + TOP_FOOT_SIZE + SIZE_T_ONE) {
size_t esize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE - asize);
size_t esize = granularity_align(nb + TOP_FOOT_SIZE + MALLOC_ALIGNMENT + SIZE_T_ONE - asize);
if (esize < HALF_MAX_SIZE_T) {
char* end = (char*)CALL_MORECORE(esize);
if (end != CMFAIL)
@ -3459,7 +3459,7 @@ static void* sys_alloc(mstate m, size_t nb) {
}
if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */
size_t req = nb + TOP_FOOT_SIZE + SIZE_T_ONE;
size_t req = nb + TOP_FOOT_SIZE + MALLOC_ALIGNMENT + SIZE_T_ONE;
size_t rsize = granularity_align(req);
if (rsize > nb) { /* Fail if wraps around zero */
char* mp = (char*)(CALL_MMAP(rsize));
@ -3472,7 +3472,7 @@ static void* sys_alloc(mstate m, size_t nb) {
}
if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */
size_t asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE);
size_t asize = granularity_align(nb + TOP_FOOT_SIZE + MALLOC_ALIGNMENT + SIZE_T_ONE);
if (asize < HALF_MAX_SIZE_T) {
char* br = CMFAIL;
char* end = CMFAIL;

View file

@ -45,7 +45,7 @@ static size_t SDL_ScanLong(const char *text, int radix, long *valuep)
}
for ( ; ; ) {
int v;
if ( SDL_isdigit(*text) ) {
if ( SDL_isdigit((unsigned char) *text) ) {
v = *text - '0';
} else if ( radix == 16 && SDL_isupperhex(*text) ) {
v = 10 + (*text - 'A');
@ -80,7 +80,7 @@ static size_t SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *v
}
for ( ; ; ) {
int v;
if ( SDL_isdigit(*text) ) {
if ( SDL_isdigit((unsigned char) *text) ) {
v = *text - '0';
} else if ( radix == 16 && SDL_isupperhex(*text) ) {
v = 10 + (*text - 'A');
@ -111,7 +111,7 @@ static size_t SDL_ScanUintPtrT(const char *text, int radix, uintptr_t *valuep)
}
for ( ; ; ) {
int v;
if ( SDL_isdigit(*text) ) {
if ( SDL_isdigit((unsigned char) *text) ) {
v = *text - '0';
} else if ( radix == 16 && SDL_isupperhex(*text) ) {
v = 10 + (*text - 'A');
@ -148,7 +148,7 @@ static size_t SDL_ScanLongLong(const char *text, int radix, Sint64 *valuep)
}
for ( ; ; ) {
int v;
if ( SDL_isdigit(*text) ) {
if ( SDL_isdigit((unsigned char) *text) ) {
v = *text - '0';
} else if ( radix == 16 && SDL_isupperhex(*text) ) {
v = 10 + (*text - 'A');
@ -183,7 +183,7 @@ static size_t SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 *valu
}
for ( ; ; ) {
int v;
if ( SDL_isdigit(*text) ) {
if ( SDL_isdigit((unsigned char) *text) ) {
v = *text - '0';
} else if ( radix == 16 && SDL_isupperhex(*text) ) {
v = 10 + (*text - 'A');
@ -221,7 +221,7 @@ static size_t SDL_ScanFloat(const char *text, double *valuep)
if ( *text == '.' ) {
int mult = 10;
++text;
while ( SDL_isdigit(*text) ) {
while ( SDL_isdigit((unsigned char) *text) ) {
lvalue = *text - '0';
value += (double)lvalue / mult;
mult *= 10;
@ -289,8 +289,8 @@ void *SDL_revcpy(void *dst, const void *src, size_t len)
{
char *srcp = (char *)src;
char *dstp = (char *)dst;
srcp += len;
dstp += len;
srcp += len-1;
dstp += len-1;
while ( len-- ) {
*dstp-- = *srcp--;
}
@ -383,7 +383,7 @@ char *SDL_strupr(char *string)
{
char *bufp = string;
while ( *bufp ) {
*bufp = SDL_toupper(*bufp);
*bufp = SDL_toupper((unsigned char) *bufp);
++bufp;
}
return string;
@ -395,7 +395,7 @@ char *SDL_strlwr(char *string)
{
char *bufp = string;
while ( *bufp ) {
*bufp = SDL_tolower(*bufp);
*bufp = SDL_tolower((unsigned char) *bufp);
++bufp;
}
return string;
@ -699,8 +699,8 @@ int SDL_strcasecmp(const char *str1, const char *str2)
char a = 0;
char b = 0;
while ( *str1 && *str2 ) {
a = SDL_tolower(*str1);
b = SDL_tolower(*str2);
a = SDL_tolower((unsigned char) *str1);
b = SDL_tolower((unsigned char) *str2);
if ( a != b )
break;
++str1;
@ -716,8 +716,8 @@ int SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen)
char a = 0;
char b = 0;
while ( *str1 && *str2 && maxlen ) {
a = SDL_tolower(*str1);
b = SDL_tolower(*str2);
a = SDL_tolower((unsigned char) *str1);
b = SDL_tolower((unsigned char) *str2);
if ( a != b )
break;
++str1;
@ -737,7 +737,7 @@ int SDL_sscanf(const char *text, const char *fmt, ...)
va_start(ap, fmt);
while ( *fmt ) {
if ( *fmt == ' ' ) {
while ( SDL_isspace(*text) ) {
while ( SDL_isspace((unsigned char) *text) ) {
++text;
}
++fmt;
@ -788,7 +788,7 @@ int SDL_sscanf(const char *text, const char *fmt, ...)
continue;
}
while ( SDL_isspace(*text) ) {
while ( SDL_isspace((unsigned char) *text) ) {
++text;
}
@ -821,7 +821,7 @@ int SDL_sscanf(const char *text, const char *fmt, ...)
++index;
}
if ( text[index] == '0' ) {
if ( SDL_tolower(text[index+1]) == 'x' ) {
if ( SDL_tolower((unsigned char) text[index+1]) == 'x' ) {
radix = 16;
} else {
radix = 8;
@ -950,7 +950,7 @@ int SDL_sscanf(const char *text, const char *fmt, ...)
break;
case 's':
if ( suppress ) {
while ( !SDL_isspace(*text) ) {
while ( !SDL_isspace((unsigned char) *text) ) {
++text;
if ( count ) {
if ( --count == 0 ) {
@ -960,7 +960,7 @@ int SDL_sscanf(const char *text, const char *fmt, ...)
}
} else {
char *valuep = va_arg(ap, char*);
while ( !SDL_isspace(*text) ) {
while ( !SDL_isspace((unsigned char) *text) ) {
*valuep++ = *text++;
if ( count ) {
if ( --count == 0 ) {

View file

@ -27,14 +27,10 @@
/* Need the definitions of SYS_ThreadHandle */
#if SDL_THREADS_DISABLED
#include "generic/SDL_systhread_c.h"
#elif SDL_THREAD_AMIGA
#include "amigaos/SDL_systhread_c.h"
#elif SDL_THREAD_BEOS
#include "beos/SDL_systhread_c.h"
#elif SDL_THREAD_DC
#include "dc/SDL_systhread_c.h"
#elif SDL_THREAD_EPOC
#include "epoc/SDL_systhread_c.h"
#elif SDL_THREAD_OS2
#include "os2/SDL_systhread_c.h"
#elif SDL_THREAD_PTH
@ -45,6 +41,8 @@
#include "irix/SDL_systhread_c.h"
#elif SDL_THREAD_WIN32
#include "win32/SDL_systhread_c.h"
#elif SDL_THREAD_SYMBIAN
#include "symbian/SDL_systhread_c.h"
#else
#error Need thread implementation for this platform
#include "generic/SDL_systhread_c.h"

Some files were not shown because too many files have changed in this diff Show more