You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(35) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(37) |
Feb
(10) |
Mar
|
Apr
(2) |
May
(17) |
Jun
(1) |
Jul
(14) |
Aug
(14) |
Sep
(4) |
Oct
|
Nov
(14) |
Dec
(4) |
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(92) |
Dec
(12) |
2006 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(5) |
May
(3) |
Jun
(15) |
Jul
(3) |
Aug
(1) |
Sep
(29) |
Oct
(1) |
Nov
(6) |
Dec
(5) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(3) |
May
(14) |
Jun
(2) |
Jul
(16) |
Aug
(73) |
Sep
(12) |
Oct
(9) |
Nov
(27) |
Dec
(3) |
2008 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(8) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
|
Feb
(10) |
Mar
|
Apr
(4) |
May
(4) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
|
Jun
(3) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(15) |
Nov
(1) |
Dec
(5) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(6) |
Apr
|
May
(22) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2012 |
Jan
|
Feb
(10) |
Mar
(1) |
Apr
(6) |
May
(27) |
Jun
(48) |
Jul
(30) |
Aug
(4) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(11) |
2013 |
Jan
(4) |
Feb
(7) |
Mar
(6) |
Apr
(18) |
May
(28) |
Jun
(20) |
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(7) |
2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(9) |
May
(11) |
Jun
(10) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(17) |
Nov
(10) |
Dec
(16) |
2015 |
Jan
(5) |
Feb
(1) |
Mar
(5) |
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
(2) |
Dec
(1) |
2016 |
Jan
(14) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2017 |
Jan
(11) |
Feb
|
Mar
(21) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
|
Dec
(1) |
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
(10) |
Feb
(9) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(18) |
Jul
(4) |
Aug
(2) |
Sep
(20) |
Oct
(2) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2022 |
Jan
(1) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2023 |
Jan
(10) |
Feb
(7) |
Mar
(29) |
Apr
(31) |
May
(29) |
Jun
(34) |
Jul
(3) |
Aug
(24) |
Sep
(22) |
Oct
(10) |
Nov
(38) |
Dec
(27) |
2024 |
Jan
(15) |
Feb
(8) |
Mar
(4) |
Apr
(20) |
May
(33) |
Jun
(18) |
Jul
(15) |
Aug
(23) |
Sep
(26) |
Oct
(32) |
Nov
(6) |
Dec
(4) |
2025 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
(4) |
May
(46) |
Jun
(15) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ba...@us...> - 2006-09-17 23:53:10
|
Revision: 361 http://svn.sourceforge.net/cadcdev/?rev=361&view=rev Author: bardtx Date: 2006-09-17 16:53:05 -0700 (Sun, 17 Sep 2006) Log Message: ----------- Patch #1553421 from SourceForge: Patch to ensure that the 'arm' subdirectory is built before snd_stream_drv.o. In the current situation the build will fail if stream.drv does not exist. And if it does exist then that one will be compiled into KOS instead of the one created during the current build process. Modified Paths: -------------- kos/kernel/arch/dreamcast/sound/Makefile Modified: kos/kernel/arch/dreamcast/sound/Makefile =================================================================== --- kos/kernel/arch/dreamcast/sound/Makefile 2006-09-17 23:51:26 UTC (rev 360) +++ kos/kernel/arch/dreamcast/sound/Makefile 2006-09-17 23:53:05 UTC (rev 361) @@ -14,6 +14,6 @@ include $(KOS_BASE)/Makefile.prefab -snd_stream_drv.o: arm/stream.drv - $(KOS_BASE)/utils/bin2o/bin2o $< snd_stream_drv snd_stream_drv.o +snd_stream_drv.o: subdirs arm/stream.drv + $(KOS_BASE)/utils/bin2o/bin2o arm/stream.drv snd_stream_drv snd_stream_drv.o This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-09-17 23:51:31
|
Revision: 360 http://svn.sourceforge.net/cadcdev/?rev=360&view=rev Author: bardtx Date: 2006-09-17 16:51:26 -0700 (Sun, 17 Sep 2006) Log Message: ----------- Patch #1553384 from SourceForge: In GNU as the -marm7 option is deprecated (and for some reason even causes a segfault in binutils 2.17). -mcpu=arm7 should be used instead (this works in binutils 2.12 and up, which should cover anybody using KOS 1.3.x). Modified Paths: -------------- kos/environ_dreamcast.sh Modified: kos/environ_dreamcast.sh =================================================================== --- kos/environ_dreamcast.sh 2006-09-17 23:48:43 UTC (rev 359) +++ kos/environ_dreamcast.sh 2006-09-17 23:51:26 UTC (rev 360) @@ -13,5 +13,5 @@ export DC_ARM_OBJCOPY="${DC_ARM_BASE}/bin/${DC_ARM_PREFIX}-objcopy" export DC_ARM_LD="${DC_ARM_BASE}/bin/${DC_ARM_PREFIX}-ld" export DC_ARM_CFLAGS="-mcpu=arm7 -Wall -O2" - export DC_ARM_AFLAGS="-marm7" + export DC_ARM_AFLAGS="-mcpu=arm7" fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-09-17 23:48:47
|
Revision: 359 http://svn.sourceforge.net/cadcdev/?rev=359&view=rev Author: bardtx Date: 2006-09-17 16:48:43 -0700 (Sun, 17 Sep 2006) Log Message: ----------- kos: Patch #1552720 from SourceForge: As discussed in the latter part of http://sourceforge.net/mailarchive/message.php?msg_id=30315678. There's one more thing I wanted to bring up. In FreeSCI I use more than two streaming sound channels, but the aica driver only updates the current playing position of the first two. This is easy to fix by changing the "for (i=0; i<2; i++)" line into "for (i=0; i<64; i++)" in arm/main.c. This exposes another problem, however. It seems that a delay is necessary between selecting the sound channel, and reading back its position. This is arm/aica.c, function aica_get_pos. Without the delay, the positions will "trail behind" by two channels (e.g. channel 2 position is actually that of channel 0, etc). When you're only updating two channels you won't notice this as the two channel delay matches the numbers of channels, so even though you're reading old data, it'll be for the right channel. I hope I'm making sense here. ;) A simple for (i=0; i<20; i++); loop seems to fix it, but there might be a better way to do the delay. Modified Paths: -------------- kos/kernel/arch/dreamcast/sound/arm/aica.c kos/kernel/arch/dreamcast/sound/arm/main.c kos/kernel/arch/dreamcast/sound/arm/stream.drv Modified: kos/kernel/arch/dreamcast/sound/arm/aica.c =================================================================== --- kos/kernel/arch/dreamcast/sound/arm/aica.c 2006-09-17 23:44:08 UTC (rev 358) +++ kos/kernel/arch/dreamcast/sound/arm/aica.c 2006-09-17 23:48:43 UTC (rev 359) @@ -207,8 +207,13 @@ /* Get channel position */ int aica_get_pos(int ch) { + int i; + /* Observe channel ch */ SNDREG8(0x280d) = ch; + + /* Wait a while */ + for (i = 0; i < 20; i++); /* Update position counters */ chans[ch].pos = SNDREG32(0x2814) & 0xffff; Modified: kos/kernel/arch/dreamcast/sound/arm/main.c =================================================================== --- kos/kernel/arch/dreamcast/sound/arm/main.c 2006-09-17 23:44:08 UTC (rev 358) +++ kos/kernel/arch/dreamcast/sound/arm/main.c 2006-09-17 23:48:43 UTC (rev 359) @@ -178,7 +178,7 @@ /* Wait for a command */ for( ; ; ) { /* Update channel position counters */ - for (i=0; i<2; i++) + for (i=0; i<64; i++) aica_get_pos(i); /* Check for a command */ Modified: kos/kernel/arch/dreamcast/sound/arm/stream.drv =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-09-17 23:44:15
|
Revision: 358 http://svn.sourceforge.net/cadcdev/?rev=358&view=rev Author: bardtx Date: 2006-09-17 16:44:08 -0700 (Sun, 17 Sep 2006) Log Message: ----------- kos: Patch #1552702 from SourceForge: A patch that includes realpath() to gain support for "." and ".." in pathnames. Also includes some small changes to map standard functions to KOS functions. Modified Paths: -------------- kos/include/kos/limits.h kos/kernel/libc/koslib/Makefile Added Paths: ----------- kos/include/limits.h kos/kernel/libc/koslib/chdir.c kos/kernel/libc/koslib/creat.c kos/kernel/libc/koslib/getcwd.c kos/kernel/libc/koslib/mkdir.c kos/kernel/libc/koslib/realpath.c kos/kernel/libc/koslib/rename.c kos/kernel/libc/koslib/rmdir.c kos/kernel/libc/koslib/sleep.c Modified: kos/include/kos/limits.h =================================================================== --- kos/include/kos/limits.h 2006-09-17 23:33:39 UTC (rev 357) +++ kos/include/kos/limits.h 2006-09-17 23:44:08 UTC (rev 358) @@ -11,5 +11,6 @@ #define __KOS_LIMITS_H #define MAX_FN_LEN 256 /* Max filename length */ +#define PATH_MAX 4095 /* Max path length */ #endif /* __KOS_LIMITS_H */ Added: kos/include/limits.h =================================================================== --- kos/include/limits.h (rev 0) +++ kos/include/limits.h 2006-09-17 23:44:08 UTC (rev 358) @@ -0,0 +1,13 @@ +/* KallistiOS ##version## + + limits.h + Copyright (C)2006 Dan Potter + +*/ + +#ifndef __LIMITS_H +#define __LIMITS_H + +#include <kos/limits.h> + +#endif /* __LIMITS_H */ Modified: kos/kernel/libc/koslib/Makefile =================================================================== --- kos/kernel/libc/koslib/Makefile 2006-09-17 23:33:39 UTC (rev 357) +++ kos/kernel/libc/koslib/Makefile 2006-09-17 23:44:08 UTC (rev 358) @@ -10,6 +10,7 @@ OBJS = abort.o byteorder.o memset2.o memset4.o memcpy2.o memcpy4.o \ assert.o dbglog.o malloc.o crtbegin.o crtend.o atexit.o \ opendir.o readdir.o closedir.o rewinddir.o scandir.o seekdir.o \ - telldir.o usleep.o inet_addr.o + telldir.o usleep.o inet_addr.o realpath.o getcwd.o chdir.o mkdir.o \ + creat.o sleep.o rmdir.o rename.o include $(KOS_BASE)/Makefile.prefab Added: kos/kernel/libc/koslib/chdir.c =================================================================== --- kos/kernel/libc/koslib/chdir.c (rev 0) +++ kos/kernel/libc/koslib/chdir.c 2006-09-17 23:44:08 UTC (rev 358) @@ -0,0 +1,12 @@ +/* KallistiOS ##version## + + chdir.c + Copyright (C)2005 Walter van Niftrik +*/ + +#include <kos/fs.h> + +int chdir(const char *path) +{ + return fs_chdir(path); +} Added: kos/kernel/libc/koslib/creat.c =================================================================== --- kos/kernel/libc/koslib/creat.c (rev 0) +++ kos/kernel/libc/koslib/creat.c 2006-09-17 23:44:08 UTC (rev 358) @@ -0,0 +1,12 @@ +/* KallistiOS ##version## + + creat.c + Copyright (C)2005 Walter van Niftrik +*/ + +#include <fcntl.h> + +int creat(const char *pathname, mode_t mode) +{ + return open(pathname, O_CREAT|O_WRONLY|O_TRUNC, mode); +} Added: kos/kernel/libc/koslib/getcwd.c =================================================================== --- kos/kernel/libc/koslib/getcwd.c (rev 0) +++ kos/kernel/libc/koslib/getcwd.c 2006-09-17 23:44:08 UTC (rev 358) @@ -0,0 +1,23 @@ +/* KallistiOS ##version## + + getcwd.c + Copyright (C)2005 Walter van Niftrik +*/ + +#include <string.h> +#include <errno.h> + +#include <kos/fs.h> + +char *getcwd(char *buf, size_t size) +{ + const char *wd = fs_getwd(); + + if (strlen(wd) + 1 > size) { + errno = ERANGE; + return NULL; + } + + strcpy(buf, wd); + return buf; +} Added: kos/kernel/libc/koslib/mkdir.c =================================================================== --- kos/kernel/libc/koslib/mkdir.c (rev 0) +++ kos/kernel/libc/koslib/mkdir.c 2006-09-17 23:44:08 UTC (rev 358) @@ -0,0 +1,12 @@ +/* KallistiOS ##version## + + mkdir.c + Copyright (C)2005 Walter van Niftrik +*/ + +#include <kos/fs.h> + +int mkdir(const char *pathname, mode_t mode) +{ + return fs_mkdir(pathname); +} Added: kos/kernel/libc/koslib/realpath.c =================================================================== --- kos/kernel/libc/koslib/realpath.c (rev 0) +++ kos/kernel/libc/koslib/realpath.c 2006-09-17 23:44:08 UTC (rev 358) @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2003 Constantin S. Svintsoff <ko...@ic...> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The names of the authors may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/cdefs.h> + +#include <sys/param.h> +#include <sys/stat.h> + +#include <errno.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <limits.h> + +/* + * char *realpath(const char *path, char resolved[PATH_MAX]); + * + * Find the real name of path, by removing all ".", ".." and symlink + * components. Returns (resolved) on success, or (NULL) on failure, + * in which case the path which caused trouble is left in (resolved). + */ +char * +realpath(const char *path, char resolved[PATH_MAX]) +{ + char *p, *q, *s; + size_t left_len, resolved_len; + int serrno; + char left[PATH_MAX], next_token[PATH_MAX]; + + serrno = errno; + if (path[0] == '/') { + resolved[0] = '/'; + resolved[1] = '\0'; + if (path[1] == '\0') + return (resolved); + resolved_len = 1; + left_len = strlcpy(left, path + 1, sizeof(left)); + } else { + if (getcwd(resolved, PATH_MAX) == NULL) { + strlcpy(resolved, ".", PATH_MAX); + return (NULL); + } + resolved_len = strlen(resolved); + left_len = strlcpy(left, path, sizeof(left)); + } + if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) { + errno = ENAMETOOLONG; + return (NULL); + } + + /* + * Iterate over path components in `left'. + */ + while (left_len != 0) { + /* + * Extract the next path component and adjust `left' + * and its length. + */ + p = strchr(left, '/'); + s = p ? p : left + left_len; + if (s - left >= sizeof(next_token)) { + errno = ENAMETOOLONG; + return (NULL); + } + memcpy(next_token, left, s - left); + next_token[s - left] = '\0'; + left_len -= s - left; + if (p != NULL) + memmove(left, s + 1, left_len + 1); + if (resolved[resolved_len - 1] != '/') { + if (resolved_len + 1 >= PATH_MAX) { + errno = ENAMETOOLONG; + return (NULL); + } + resolved[resolved_len++] = '/'; + resolved[resolved_len] = '\0'; + } + if (next_token[0] == '\0') + continue; + else if (strcmp(next_token, ".") == 0) + continue; + else if (strcmp(next_token, "..") == 0) { + /* + * Strip the last path component except when we have + * single "/" + */ + if (resolved_len > 1) { + resolved[resolved_len - 1] = '\0'; + q = strrchr(resolved, '/') + 1; + *q = '\0'; + resolved_len = q - resolved; + } + continue; + } + + /* + * Append the next path component and lstat() it. If + * lstat() fails we still can return successfully if + * there are no more path components left. + */ + resolved_len = strlcat(resolved, next_token, PATH_MAX); + if (resolved_len >= PATH_MAX) { + errno = ENAMETOOLONG; + return (NULL); + } + } + + /* + * Remove trailing slash except when the resolved pathname + * is a single "/". + */ + if (resolved_len > 1 && resolved[resolved_len - 1] == '/') + resolved[resolved_len - 1] = '\0'; + return (resolved); +} Added: kos/kernel/libc/koslib/rename.c =================================================================== --- kos/kernel/libc/koslib/rename.c (rev 0) +++ kos/kernel/libc/koslib/rename.c 2006-09-17 23:44:08 UTC (rev 358) @@ -0,0 +1,12 @@ +/* KallistiOS ##version## + + rename.c + Copyright (C)2005 Walter van Niftrik +*/ + +#include <kos/fs.h> + +int rename(const char *oldpath, const char *newpath) +{ + return fs_rename(oldpath, newpath); +} Added: kos/kernel/libc/koslib/rmdir.c =================================================================== --- kos/kernel/libc/koslib/rmdir.c (rev 0) +++ kos/kernel/libc/koslib/rmdir.c 2006-09-17 23:44:08 UTC (rev 358) @@ -0,0 +1,12 @@ +/* KallistiOS ##version## + + rmdir.c + Copyright (C)2005 Walter van Niftrik +*/ + +#include <kos/fs.h> + +int rmdir(const char *pathname) +{ + return fs_rmdir(pathname); +} Added: kos/kernel/libc/koslib/sleep.c =================================================================== --- kos/kernel/libc/koslib/sleep.c (rev 0) +++ kos/kernel/libc/koslib/sleep.c 2006-09-17 23:44:08 UTC (rev 358) @@ -0,0 +1,14 @@ +/* KallistiOS ##version## + + sleep.c + Copyright (C)2005 Walter van Niftrik +*/ + +#include <kos/thread.h> + +unsigned int sleep(unsigned int seconds) +{ + thd_sleep(seconds * 1000); + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-09-17 23:33:45
|
Revision: 357 http://svn.sourceforge.net/cadcdev/?rev=357&view=rev Author: bardtx Date: 2006-09-17 16:33:39 -0700 (Sun, 17 Sep 2006) Log Message: ----------- kos: Patch #1182280 from SourceForge: This patch adds a new method "mp3_volume" as well as exposes "sndmp3_volume" Modified Paths: -------------- kos-ports/include/mp3/sndmp3.h kos-ports/include/mp3/sndserver.h kos-ports/libmp3/libmp3/main.c Modified: kos-ports/include/mp3/sndmp3.h =================================================================== --- kos-ports/include/mp3/sndmp3.h 2006-09-17 23:29:30 UTC (rev 356) +++ kos-ports/include/mp3/sndmp3.h 2006-09-17 23:33:39 UTC (rev 357) @@ -22,6 +22,9 @@ /* Shut everything down */ void sndmp3_shutdown(); +/* Controls volume of MP3 stream */ +void sndmp3_volume(int vol); + __END_DECLS #endif /* __SNDMP3_H */ Modified: kos-ports/include/mp3/sndserver.h =================================================================== --- kos-ports/include/mp3/sndserver.h 2006-09-17 23:29:30 UTC (rev 356) +++ kos-ports/include/mp3/sndserver.h 2006-09-17 23:33:39 UTC (rev 357) @@ -28,6 +28,9 @@ /* Shuts down the MP3 server thread */ int mp3_quit(); +/* Controls volume level of stream */ +void mp3_volume(int vol); + __END_DECLS #endif /* __SNDSERVER_H */ Modified: kos-ports/libmp3/libmp3/main.c =================================================================== --- kos-ports/libmp3/libmp3/main.c 2006-09-17 23:29:30 UTC (rev 356) +++ kos-ports/libmp3/libmp3/main.c 2006-09-17 23:33:39 UTC (rev 357) @@ -20,6 +20,8 @@ } int mp3_init() { + if (snd_stream_init() < 0) + return -1; if (thd_create(sndserver_thread, NULL) != NULL) { sndmp3_wait_start(); return 0; @@ -41,4 +43,6 @@ return 0; } - +void mp3_volume(int vol) { + sndmp3_volume(vol); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-09-17 23:29:33
|
Revision: 356 http://svn.sourceforge.net/cadcdev/?rev=356&view=rev Author: bardtx Date: 2006-09-17 16:29:30 -0700 (Sun, 17 Sep 2006) Log Message: ----------- kos: Patch #701892 from SourceForge: This patch correctly sets the attr member of the dirent_t structure from dcload_readdir. Modified Paths: -------------- kos/kernel/arch/dreamcast/fs/fs_dcload.c Modified: kos/kernel/arch/dreamcast/fs/fs_dcload.c =================================================================== --- kos/kernel/arch/dreamcast/fs/fs_dcload.c 2006-09-16 16:18:26 UTC (rev 355) +++ kos/kernel/arch/dreamcast/fs/fs_dcload.c 2006-09-17 23:29:30 UTC (rev 356) @@ -275,9 +275,10 @@ strcat(fn, dcld->d_name); if (!dclsc(DCLOAD_STAT, fn, &filestat)) { - if (filestat.st_mode & S_IFDIR) + if (filestat.st_mode & S_IFDIR) { rv->size = -1; - else + rv->attr = O_DIR; + } else rv->size = filestat.st_size; rv->time = filestat.st_mtime; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2006-09-16 16:18:36
|
Revision: 355 http://svn.sourceforge.net/cadcdev/?rev=355&view=rev Author: ljsebald Date: 2006-09-16 09:18:26 -0700 (Sat, 16 Sep 2006) Log Message: ----------- This is the last of the big networking changes for now. This update adds a completely new UDP system, and a working sockets system to go along with it. Modified Paths: -------------- kos/include/kos/net.h kos/kernel/fs/Makefile kos/kernel/net/net_core.c kos/kernel/net/net_udp.c kos/kernel/net/net_udp.h Added Paths: ----------- kos/include/kos/fs_socket.h kos/include/sys/socket.h kos/kernel/fs/fs_socket.c Added: kos/include/kos/fs_socket.h =================================================================== --- kos/include/kos/fs_socket.h (rev 0) +++ kos/include/kos/fs_socket.h 2006-09-16 16:18:26 UTC (rev 355) @@ -0,0 +1,38 @@ +/* KallistiOS ##version## + + kos/fs_socket.h + Copyright (C) 2006 Lawrence Sebald + +*/ + +#ifndef __KOS_FS_SOCKET_H +#define __KOS_FS_SOCKET_H + +#include <sys/cdefs.h> +__BEGIN_DECLS + +#include <arch/types.h> +#include <kos/limits.h> +#include <kos/fs.h> +#include <sys/queue.h> + +typedef struct net_socket { + /* List handle */ + LIST_ENTRY(net_socket) sock_list; + + /* Protocol of this socket. This corresponds to the IP protocol number */ + int protocol; + + /* Protocol specific data */ + void *data; +} net_socket_t; + +int fs_socket_init(); +int fs_socket_shutdown(); + +int fs_socket_setflags(int sock, int flags); + +__END_DECLS + +#endif /* __KOS_FS_SOCKET_H */ + Modified: kos/include/kos/net.h =================================================================== --- kos/include/kos/net.h 2006-09-14 03:04:48 UTC (rev 354) +++ kos/include/kos/net.h 2006-09-16 16:18:26 UTC (rev 355) @@ -210,23 +210,6 @@ /* Shutdown */ void net_udp_shutdown(); -/* Send a raw UDP packet, without a socket */ -int net_udp_send_raw(netif_t *net, uint16 src_port, uint16 dst_port, - const uint8 dst_ip[4], const uint8 *data, int size); - -/* Open a socket between the local system, and a remote host */ -int net_udp_sock_open(uint16 loc_port, uint32 loc_addr, uint16 rem_port, - uint32 rem_addr); - -/* Close a previously opened socket */ -int net_udp_sock_close(int sock); - -/* Send a packet on a socket */ -int net_udp_send(int sock, const uint8 *data, int size); - -/* Recieve a packet on a socket */ -int net_udp_recv(int sock, uint8 *buf, int size); - /***** net_core.c *********************************************************/ /* Interface list; note: do not manipulate directly */ Added: kos/include/sys/socket.h =================================================================== --- kos/include/sys/socket.h (rev 0) +++ kos/include/sys/socket.h 2006-09-16 16:18:26 UTC (rev 355) @@ -0,0 +1,56 @@ +/* KallistiOS ##version## + + sys/socket.h + Copyright (C)2006 Lawrence Sebald + +*/ + +#ifndef __SYS_SOCKET_H +#define __SYS_SOCKET_H + +#include <sys/cdefs.h> +#include <arch/types.h> + +__BEGIN_DECLS + +typedef uint32 socklen_t; + +#ifndef __SA_FAMILY_T_DEFINED +#define __SA_FAMILY_T_DEFINED +typedef uint32 sa_family_t; +#endif + +struct sockaddr { + sa_family_t sa_family; + char sa_data[]; +}; + +/* Socket types, currently only SOCK_DGRAM is available */ +#define SOCK_DGRAM 1 + +/* Socket address families. Currently only AF_INET is available */ +#define AF_INET 1 + +#define PF_INET AF_INET + +/* Socket shutdown macros. */ +#define SHUT_RD 0x00000001 +#define SHUT_WR 0x00000002 +#define SHUT_RDWR (SHUT_RD | SHUT_WR) + +int accept(int socket, struct sockaddr *address, socklen_t *address_len); +int bind(int socket, const struct sockaddr *address, socklen_t address_len); +int connect(int socket, const struct sockaddr *address, socklen_t address_len); +int listen(int socket, int backlog); +ssize_t recv(int socket, void *buffer, size_t length, int flags); +ssize_t recvfrom(int socket, void *buffer, size_t length, int flags, + struct sockaddr *address, socklen_t *address_len); +ssize_t send(int socket, const void *message, size_t length, int flags); +ssize_t sendto(int socket, const void *message, size_t length, int flags, + const struct sockaddr *dest_addr, socklen_t dest_len); +int shutdown(int socket, int how); +int socket(int domain, int type, int protocol); + +__END_DECLS + +#endif /* __SYS_SOCKET_H */ Modified: kos/kernel/fs/Makefile =================================================================== --- kos/kernel/fs/Makefile 2006-09-14 03:04:48 UTC (rev 354) +++ kos/kernel/fs/Makefile 2006-09-16 16:18:26 UTC (rev 355) @@ -6,7 +6,7 @@ # $Id: Makefile,v 1.3 2002/08/13 04:54:22 bardtx Exp $ OBJS = fs.o fs_romdisk.o fs_ramdisk.o fs_pty.o -OBJS += fs_utils.o elf.o +OBJS += fs_utils.o elf.o fs_socket.o SUBDIRS = include $(KOS_BASE)/Makefile.prefab Added: kos/kernel/fs/fs_socket.c =================================================================== --- kos/kernel/fs/fs_socket.c (rev 0) +++ kos/kernel/fs/fs_socket.c 2006-09-16 16:18:26 UTC (rev 355) @@ -0,0 +1,298 @@ +/* KallistiOS ##version## + + fs_socket.c + Copyright (C) 2006 Lawrence Sebald + +*/ + +#include <kos/mutex.h> +#include <arch/spinlock.h> +#include <kos/dbgio.h> +#include <kos/fs.h> +#include <kos/fs_socket.h> +#include <kos/net.h> + +#include <errno.h> +#include <string.h> +#include <malloc.h> +#include <sys/queue.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +#include "../net/net_ipv4.h" +#include "../net/net_udp.h" + +/* Define the socket list type */ +LIST_HEAD(socket_list, net_socket); + +static struct socket_list sockets; +static mutex_t *list_mutex; + +static void fs_socket_close(void *hnd) { + net_socket_t *sock = (net_socket_t *) hnd; + + mutex_lock(list_mutex); + LIST_REMOVE(sock, sock_list); + mutex_unlock(list_mutex); + + net_udp_close(hnd); + + free(sock); +} + +static off_t fs_socket_tell(void *hnd) { + errno = ESPIPE; + return (off_t) -1; +} + +/* VFS handler */ +static vfs_handler_t vh = { + /* Name handler */ + { + { 0 }, /* Name */ + 0, /* tbfi */ + 0x00010000, /* Version 1.0 */ + 0, /* Flags */ + NMMGR_TYPE_VFS, + NMMGR_LIST_INIT, + }, + + 0, NULL, /* No cache, privdata */ + + NULL, /* open */ + fs_socket_close, /* close */ + NULL, /* read */ + NULL, /* write */ + NULL, /* seek */ + fs_socket_tell, /* tell */ + NULL, /* total */ + NULL, /* readdir */ + NULL, /* ioctl */ + NULL, /* rename */ + NULL, /* unlink */ + NULL, /* mmap */ + NULL, /* complete */ + NULL, /* stat */ + NULL, /* mkdir */ + NULL /* rmdir */ +}; + +/* Have we been initialized? */ +static int initted = 0; + +int fs_socket_init() { + if(initted == 1) + return 0; + + LIST_INIT(&sockets); + + if(nmmgr_handler_add(&vh.nmmgr) < 0) + return -1; + + list_mutex = mutex_create(); + initted = 1; + + return 0; +} + +int fs_socket_shutdown() { + net_socket_t *c, *n; + + if(initted == 0) + return 0; + + mutex_lock(list_mutex); + c = LIST_FIRST(&sockets); + while(c != NULL) { + n = LIST_NEXT(c, sock_list); + + vh.close(c); + + free(c); + c = n; + } + + if(nmmgr_handler_remove(&vh.nmmgr) < 0) + return -1; + + mutex_destroy(list_mutex); + + initted = 0; + + return 0; +} + +int fs_socket_setflags(int sock, int flags) { + net_socket_t *hnd; + + hnd = (net_socket_t *) fs_get_handle(sock); + if(hnd == NULL) { + errno = EBADF; + return -1; + } + + return net_udp_setflags(hnd, flags); +} + +int socket(int domain, int type, int protocol) { + net_socket_t *sock; + file_t hnd; + + /* First, check the arguments for validity */ + if(domain != AF_INET) { + errno = EAFNOSUPPORT; + return -1; + } + + if(type != SOCK_DGRAM) { + errno = EPROTONOSUPPORT; + return -1; + } + + if(protocol != 0 && protocol != IPPROTO_UDP) { + errno = EPROTONOSUPPORT; + return -1; + } + + /* Allocate the socket structure, if we have the space */ + sock = (net_socket_t *) malloc(sizeof(net_socket_t)); + if(!sock) { + errno = ENOMEM; + return -1; + } + + /* Attempt to get a handle for this socket */ + hnd = fs_open_handle(&vh, sock); + if(hnd < 0) { + free(sock); + return -1; + } + + /* We only support UDP right now, so this is ok... */ + sock->protocol = IPPROTO_UDP; + + /* Initialize protocol-specific data */ + if(net_udp_socket(sock, domain, type, protocol) == -1) { + fs_close(hnd); + return -1; + } + + /* Add this socket into the list of sockets, and return */ + mutex_lock(list_mutex); + LIST_INSERT_HEAD(&sockets, sock, sock_list); + mutex_unlock(list_mutex); + + return hnd; +} + +int accept(int sock, struct sockaddr *address, socklen_t *address_len) { + net_socket_t *hnd; + + hnd = (net_socket_t *) fs_get_handle(sock); + if(hnd == NULL) { + errno = EBADF; + return -1; + } + + return net_udp_accept(hnd, address, address_len); +} + +int bind(int sock, const struct sockaddr *address, socklen_t address_len) { + net_socket_t *hnd; + + hnd = (net_socket_t *) fs_get_handle(sock); + if(hnd == NULL) { + errno = EBADF; + return -1; + } + + return net_udp_bind(hnd, address, address_len); +} + +int connect(int sock, const struct sockaddr *address, socklen_t address_len) { + net_socket_t *hnd; + + hnd = (net_socket_t *) fs_get_handle(sock); + if(hnd == NULL) { + errno = EBADF; + return -1; + } + + return net_udp_connect(hnd, address, address_len); +} + +int listen(int sock, int backlog) { + net_socket_t *hnd; + + hnd = (net_socket_t *) fs_get_handle(sock); + if(hnd == NULL) { + errno = EBADF; + return -1; + } + + return net_udp_listen(hnd, backlog); +} + +ssize_t recv(int sock, void *buffer, size_t length, int flags) { + net_socket_t *hnd; + + hnd = (net_socket_t *) fs_get_handle(sock); + if(hnd == NULL) { + errno = EBADF; + return -1; + } + + return net_udp_recv(hnd, buffer, length, flags); +} + +ssize_t recvfrom(int sock, void *buffer, size_t length, int flags, + struct sockaddr *address, socklen_t *address_len) { + net_socket_t *hnd; + + hnd = (net_socket_t *) fs_get_handle(sock); + if(hnd == NULL) { + errno = EBADF; + return -1; + } + + return net_udp_recvfrom(hnd, buffer, length, flags, address, + address_len); +} + +ssize_t send(int sock, const void *message, size_t length, int flags) { + net_socket_t *hnd; + + hnd = (net_socket_t *) fs_get_handle(sock); + if(hnd == NULL) { + errno = EBADF; + return -1; + } + + return net_udp_send(hnd, message, length, flags); +} + +ssize_t sendto(int sock, const void *message, size_t length, int flags, + const struct sockaddr *dest_addr, socklen_t dest_len) { + net_socket_t *hnd; + + hnd = (net_socket_t *) fs_get_handle(sock); + if(hnd == NULL) { + errno = EBADF; + return -1; + } + + return net_udp_sendto(hnd, message, length, flags, dest_addr, dest_len); +} + +int shutdown(int sock, int how) { + net_socket_t *hnd; + + hnd = (net_socket_t *) fs_get_handle(sock); + if(hnd == NULL) { + errno = EBADF; + return -1; + } + + return net_udp_shutdownsock(hnd, how); +} Modified: kos/kernel/net/net_core.c =================================================================== --- kos/kernel/net/net_core.c 2006-09-14 03:04:48 UTC (rev 354) +++ kos/kernel/net/net_core.c 2006-09-16 16:18:26 UTC (rev 355) @@ -10,6 +10,7 @@ #include <malloc.h> #include <stdio.h> #include <kos/net.h> +#include <kos/fs_socket.h> CVSID("$Id: net_core.c,v 1.5 2002/10/26 07:59:50 bardtx Exp $"); @@ -100,7 +101,7 @@ net_default_dev = n; - return olddev; + return olddev; } /* Device detect / init */ @@ -144,6 +145,11 @@ /* Initialize the ARP cache */ net_arp_init(); + /* Initialize the UDP system */ + net_udp_init(); + + fs_socket_init(); + return 0; } @@ -165,4 +171,9 @@ /* Shut down the ARP cache */ net_arp_shutdown(); + + /* Shut down the UDP system */ + net_udp_shutdown(); + + fs_socket_shutdown(); } Modified: kos/kernel/net/net_udp.c =================================================================== --- kos/kernel/net/net_udp.c 2006-09-14 03:04:48 UTC (rev 354) +++ kos/kernel/net/net_udp.c 2006-09-16 16:18:26 UTC (rev 355) @@ -1,295 +1,689 @@ /* KallistiOS ##version## kernel/net/net_udp.c - Copyright (C) 2005 Lawrence Sebald + Copyright (C) 2005, 2006 Lawrence Sebald */ #include <stdio.h> #include <string.h> #include <malloc.h> +#include <arpa/inet.h> #include <kos/net.h> #include <kos/mutex.h> +#include <kos/cond.h> #include <sys/queue.h> +#include <kos/dbgio.h> +#include <kos/fs_socket.h> +#include <sys/socket.h> +#include <errno.h> #include "net_ipv4.h" #include "net_udp.h" -typedef struct udp_pkt { - TAILQ_ENTRY(udp_pkt) pkt_queue; - udp_hdr_t hdr; - uint8 *data; - uint16 datasize; -} udp_pkt_t; +struct udp_pkt { + TAILQ_ENTRY(udp_pkt) pkt_queue; + struct sockaddr_in from; + uint8 *data; + uint16 datasize; +}; TAILQ_HEAD(udp_pkt_queue, udp_pkt); -typedef struct udp_sock { - LIST_ENTRY(udp_sock) sock_list; - int sock_num; - uint16 loc_port; - uint16 rem_port; - uint32 loc_addr; - uint32 rem_addr; - struct udp_pkt_queue packets; -} udp_sock_t; +struct udp_sock { + LIST_ENTRY(udp_sock) sock_list; + struct sockaddr_in local_addr; + struct sockaddr_in remote_addr; + int flags; + + struct udp_pkt_queue packets; +}; + LIST_HEAD(udp_sock_list, udp_sock); -static struct udp_sock_list net_udp_socks = LIST_HEAD_INITIALIZER(0); -static int cur_udp_sock = 0; -static uint8 udp_buf[1514]; +static struct udp_sock_list net_udp_sockets = LIST_HEAD_INITIALIZER(0); +static mutex_t *udp_mutex; +static condvar_t *udp_packets_ready; -int net_udp_sock_open(uint16 loc_port, uint32 loc_addr, uint16 rem_port, uint32 rem_addr) { - udp_sock_t *ns; +int net_udp_accept(net_socket_t *hnd, struct sockaddr *addr, + socklen_t *addr_len) { + errno = EOPNOTSUPP; + return -1; +} - LIST_FOREACH(ns, &net_udp_socks, sock_list) { - if(ns->loc_port == loc_port && ns->loc_addr == loc_addr && - ns->rem_port == rem_port && ns->rem_addr == rem_addr) { - dbglog(DBG_KDEBUG, "net_udp: Attempt to create already existing socket\n"); - return 0; - } - } +int net_udp_bind(net_socket_t *hnd, const struct sockaddr *addr, + socklen_t addr_len) { + struct udp_sock *udpsock, *iter; + struct sockaddr_in *realaddr; - ns = (udp_sock_t *)malloc(sizeof(udp_sock_t)); + /* Verify the parameters sent in first */ + if(addr == NULL) { + errno = EFAULT; + return -1; + } - ns->sock_num = ++cur_udp_sock; - ns->loc_port = loc_port; - ns->loc_addr = loc_addr; - ns->rem_port = rem_port; - ns->rem_addr = rem_addr; + if(addr->sa_family != AF_INET) { + errno = EAFNOSUPPORT; + return -1; + } - TAILQ_INIT(&ns->packets); - LIST_INSERT_HEAD(&net_udp_socks, ns, sock_list); + /* Get the sockaddr_in structure, rather than the sockaddr one */ + realaddr = (struct sockaddr_in *) addr; - return cur_udp_sock; + mutex_lock(udp_mutex); + + udpsock = (struct udp_sock *)hnd->data; + if(udpsock == NULL) { + mutex_unlock(udp_mutex); + errno = EBADF; + return -1; + } + + /* See if we requested a specific port or not */ + if(realaddr->sin_port != 0) { + /* Make sure we don't already have a socket bound to the + port specified */ + + LIST_FOREACH(iter, &net_udp_sockets, sock_list) { + if(iter->local_addr.sin_port == realaddr->sin_port) { + mutex_unlock(udp_mutex); + errno = EADDRINUSE; + return -1; + } + } + + udpsock->local_addr = *realaddr; + } + else { + uint16 port = 1024, tmp = 0; + + /* Grab the first unused port >= 1024. This is, unfortunately, O(n^2) */ + while(tmp != port) { + tmp = port; + + LIST_FOREACH(iter, &net_udp_sockets, sock_list) { + if(iter->local_addr.sin_port == port) { + ++port; + break; + } + } + } + + udpsock->local_addr = *realaddr; + udpsock->local_addr.sin_port = htons(port); + } + + mutex_unlock(udp_mutex); + + return 0; } -int net_udp_sock_close(int socknum) { - udp_sock_t *ns; - udp_pkt_t *pkt; +int net_udp_connect(net_socket_t *hnd, const struct sockaddr *addr, + socklen_t addr_len) { + struct udp_sock *udpsock; + struct sockaddr_in *realaddr; - LIST_FOREACH(ns, &net_udp_socks, sock_list) { - if(ns->sock_num == socknum) { - LIST_REMOVE(ns, sock_list); - TAILQ_FOREACH(pkt, &ns->packets, pkt_queue) { - TAILQ_REMOVE(&ns->packets, pkt, pkt_queue); - free(pkt->data); - free(pkt); - } - free(ns); + if(addr == NULL) { + errno = EFAULT; + return -1; + } - return 0; - } - } + if(addr->sa_family != AF_INET) { + errno = EAFNOSUPPORT; + return -1; + } - dbglog(DBG_KDEBUG, "net_udp: Attempt to close unopened socket"); - return -1; + mutex_lock(udp_mutex); + + udpsock = (struct udp_sock *)hnd->data; + if(udpsock == NULL) { + mutex_unlock(udp_mutex); + errno = EBADF; + return -1; + } + + if(udpsock->remote_addr.sin_addr.s_addr != INADDR_ANY) { + mutex_unlock(udp_mutex); + errno = EISCONN; + return -1; + } + + realaddr = (struct sockaddr_in *) addr; + if(realaddr->sin_port == 0 || realaddr->sin_addr.s_addr == INADDR_ANY) { + mutex_unlock(udp_mutex); + errno = EADDRNOTAVAIL; + return -1; + } + + udpsock->remote_addr.sin_addr.s_addr = realaddr->sin_addr.s_addr; + udpsock->remote_addr.sin_port = realaddr->sin_port; + + mutex_unlock(udp_mutex); + + return 0; } -int net_udp_recv(int sock, uint8 *buf, int size) { - udp_sock_t *ns; - udp_pkt_t *pkt; +int net_udp_listen(net_socket_t *hnd, int backlog) { + errno = EOPNOTSUPP; + return -1; +} - LIST_FOREACH(ns, &net_udp_socks, sock_list) { - if(ns->sock_num == sock) { - pkt = TAILQ_FIRST(&ns->packets); - if(pkt) { - if(size >= pkt->datasize) { - memcpy(buf, pkt->data, pkt->datasize); - TAILQ_REMOVE(&ns->packets, pkt, pkt_queue); - size = pkt->datasize; - free(pkt->data); - free(pkt); - return size; - } - else { - uint8 tbuf[pkt->datasize - size]; - memcpy(buf, pkt->data, size); - memcpy(tbuf, pkt->data + size, pkt->datasize - size); - free(pkt->data); - pkt->data = (uint8 *)malloc(pkt->datasize - size); - memcpy(pkt->data, tbuf, pkt->datasize - size); - pkt->datasize -= size; - return size; - } - } - else { - return 0; - } - } - } +ssize_t net_udp_recv(net_socket_t *hnd, void *buffer, size_t length, int flags) { + struct udp_sock *udpsock; + struct udp_pkt *pkt; - dbglog(DBG_KDEBUG, "net_udp: attempt to recv on unopened socket\n"); + mutex_lock(udp_mutex); - return -1; + udpsock = (struct udp_sock *)hnd->data; + if(udpsock == NULL) { + mutex_unlock(udp_mutex); + errno = EBADF; + return -1; + } + + if(udpsock->remote_addr.sin_addr.s_addr == INADDR_ANY || + udpsock->remote_addr.sin_port == 0) { + mutex_unlock(udp_mutex); + errno = ENOTCONN; + return -1; + } + + if(udpsock->flags & SHUT_RD) { + mutex_unlock(udp_mutex); + return 0; + } + + if(buffer == NULL) { + mutex_unlock(udp_mutex); + errno = EFAULT; + return -1; + } + + if(TAILQ_EMPTY(&udpsock->packets) && (udpsock->flags & O_NONBLOCK)) { + mutex_unlock(udp_mutex); + errno = EWOULDBLOCK; + return -1; + } + + if(TAILQ_EMPTY(&udpsock->packets)) { + cond_wait(udp_packets_ready, udp_mutex); + } + + pkt = TAILQ_FIRST(&udpsock->packets); + + if(pkt->datasize > length) { + memcpy(buffer, pkt->data, length); + } + else { + memcpy(buffer, pkt->data, pkt->datasize); + length = pkt->datasize; + } + + TAILQ_REMOVE(&udpsock->packets, pkt, pkt_queue); + free(pkt->data); + free(pkt); + + mutex_unlock(udp_mutex); + + return length; } -int net_udp_send(int sock, const uint8 *data, int size) { - udp_sock_t *ns; - - LIST_FOREACH(ns, &net_udp_socks, sock_list) { - if(ns->sock_num == sock) { - ip_pseudo_hdr_t *ps = (ip_pseudo_hdr_t *)udp_buf; - ip_hdr_t ip; - int internsize; +ssize_t net_udp_recvfrom(net_socket_t *hnd, void *buffer, size_t length, + int flags, struct sockaddr *addr, + socklen_t *addr_len) { + struct udp_sock *udpsock; + struct udp_pkt *pkt; - /* Fill in the UDP Header */ - ps->src_addr = ns->loc_addr; - ps->dst_addr = ns->rem_addr; - ps->zero = 0; - ps->proto = 17; - ps->length = net_ntohs(size + sizeof(udp_hdr_t)); - ps->src_port = ns->loc_port; - ps->dst_port = ns->rem_port; - ps->hdrlength = ps->length; - ps->checksum = 0; - memcpy(ps->data, data, size); + mutex_lock(udp_mutex); - if(size % 2) { - internsize = size + 1; - ps->data[internsize] = 0; - } - else - internsize = size; + udpsock = (struct udp_sock *)hnd->data; + if(udpsock == NULL) { + mutex_unlock(udp_mutex); + errno = EBADF; + return -1; + } - /* Compute the UDP Checksum */ - ps->checksum = net_ipv4_checksum((uint16 *)udp_buf, (internsize + sizeof(udp_hdr_t) + 12) / 2); + if(udpsock->flags & SHUT_RD) { + mutex_unlock(udp_mutex); + return 0; + } - /* Fill in the IP Header */ - ip.version_ihl = 0x45; /* 20 byte header, ipv4 */ - ip.tos = 0; - ip.length = net_ntohs(sizeof(udp_hdr_t) + size + 20); - ip.packet_id = 0; - ip.flags_frag_offs = net_ntohs(0x4000); - ip.ttl = 64; - ip.protocol = 17; /* UDP */ - ip.checksum = 0; - ip.src = ps->src_addr; - ip.dest = ps->dst_addr; + if(buffer == NULL || addr_len == NULL) { + mutex_unlock(udp_mutex); + errno = EFAULT; + return -1; + } - /* Compute the IP Checksum */ - ip.checksum = net_ipv4_checksum((uint16*)&ip, sizeof(ip_hdr_t) / 2); + if(TAILQ_EMPTY(&udpsock->packets) && (udpsock->flags & O_NONBLOCK)) { + mutex_unlock(udp_mutex); + errno = EWOULDBLOCK; + return -1; + } - net_ipv4_send_packet(net_default_dev, &ip, (uint8 *)(udp_buf + 12), sizeof(udp_hdr_t) + size); + while(TAILQ_EMPTY(&udpsock->packets)) { + cond_wait(udp_packets_ready, udp_mutex); + } - return size; - } - } + pkt = TAILQ_FIRST(&udpsock->packets); - dbglog(DBG_KDEBUG, "net_udp: attempt to send on unopened socket\n"); - - return -1; + if(pkt->datasize > length) { + memcpy(buffer, pkt->data, length); + } + else { + memcpy(buffer, pkt->data, pkt->datasize); + length = pkt->datasize; + } + + if(addr != NULL) { + struct sockaddr_in realaddr; + + realaddr.sin_family = AF_INET; + realaddr.sin_addr.s_addr = pkt->from.sin_addr.s_addr; + realaddr.sin_port = pkt->from.sin_port; + memset(realaddr.sin_zero, 0, 8); + + if(*addr_len < sizeof(struct sockaddr_in)) { + memcpy(addr, &realaddr, *addr_len); + } + else { + memcpy(addr, &realaddr, sizeof(struct sockaddr_in)); + *addr_len = sizeof(struct sockaddr_in); + } + } + + TAILQ_REMOVE(&udpsock->packets, pkt, pkt_queue); + free(pkt->data); + free(pkt); + + mutex_unlock(udp_mutex); + + return length; } -int net_udp_input(netif_t *src, eth_hdr_t *eh, ip_hdr_t *ip, const uint8 *data, int size) { - ip_pseudo_hdr_t *ps = (ip_pseudo_hdr_t*)udp_buf; - uint16 i; - udp_sock_t *sock; - udp_pkt_t *pkt; +ssize_t net_udp_send(net_socket_t *hnd, const void *message, size_t length, + int flags) { + struct udp_sock *udpsock; - ps->src_addr = ip->src; - ps->dst_addr = ip->dest; - ps->zero = 0; - ps->proto = ip->protocol; - memcpy(&ps->src_port, data, size); - ps->length = net_ntohs(size); + mutex_lock(udp_mutex); - if(size % 2) { - ps->data[size - sizeof(udp_hdr_t)] = 0; - ++size; - } + udpsock = (struct udp_sock *)hnd->data; + if(udpsock == NULL) { + mutex_unlock(udp_mutex); + errno = EBADF; + return -1; + } - i = ps->checksum; - ps->checksum = 0; - ps->checksum = net_ipv4_checksum((uint16 *)udp_buf, (size + 12) / 2); + if(udpsock->flags & SHUT_WR) { + mutex_unlock(udp_mutex); + errno = EPIPE; + return -1; + } -#ifdef DEBUG_UDP - printf("UDP Header Dump:\n"); - printf(" Pseudo-Header:\n"); - printf("src_addr = 0x%08x\n", ps->src_addr); - printf("dst_addr = 0x%08x\n", ps->dst_addr); - printf("zero = 0x%02x\n", ps->zero); - printf("proto = 0x%02x\n", ps->proto); - printf("length = 0x%04x\n", ps->length); - printf("src_port = 0x%04x\n", ps->src_port); - printf("dst_port = 0x%04x\n", ps->dst_port); - printf("hdrlength = 0x%04x\n", ps->hdrlength); - printf("checksum = 0x%04x\n", ps->checksum); -#endif + if(udpsock->remote_addr.sin_addr.s_addr == INADDR_ANY || + udpsock->remote_addr.sin_port == 0) { + mutex_unlock(udp_mutex); + errno = ENOTCONN; + return -1; + } - if(i != ps->checksum) { - dbglog(DBG_KDEBUG, "net_udp: discarding UDP packet with invalid checksum\n"); - dbglog(DBG_KDEBUG, "net_udp: was %x, expected %x\n", i, ps->checksum); - return -1; - } + if(message == NULL) { + mutex_unlock(udp_mutex); + errno = EFAULT; + return -1; + } - LIST_FOREACH(sock, &net_udp_socks, sock_list) { - if(sock->loc_port == ps->dst_port && sock->loc_addr == ps->dst_addr && - ((sock->rem_port == ps->src_port && sock->rem_addr == ps->src_addr) || - (sock->rem_port == 0 && sock->rem_addr == 0))) { - sock->rem_port = ps->src_port; - sock->rem_addr = ps->src_addr; - pkt = (udp_pkt_t *) malloc(sizeof(udp_pkt_t)); - pkt->datasize = size - sizeof(udp_hdr_t); - pkt->data = (uint8 *) malloc(pkt->datasize); - memcpy(&pkt->hdr, &ps->src_port, sizeof(udp_hdr_t)); - memcpy(pkt->data, ps->data, pkt->datasize); - TAILQ_INSERT_TAIL(&sock->packets, pkt, pkt_queue); - return 0; - } - } + if(udpsock->local_addr.sin_port == 0) { + uint16 port = 1024, tmp = 0; + struct udp_sock *iter; - dbglog(DBG_KDEBUG, "net_udp: discarding UDP packet for unopened socket\n"); + /* Grab the first unused port >= 1024. This is, unfortunately, O(n^2) */ + while(tmp != port) { + tmp = port; - return 0; + LIST_FOREACH(iter, &net_udp_sockets, sock_list) { + if(iter->local_addr.sin_port == port) { + ++port; + break; + } + } + } + + udpsock->local_addr.sin_port = htons(port); + } + + mutex_unlock(udp_mutex); + + return net_udp_send_raw(NULL, udpsock->local_addr.sin_addr.s_addr, + udpsock->local_addr.sin_port, + udpsock->remote_addr.sin_addr.s_addr, + udpsock->remote_addr.sin_port, (uint8 *) message, + length); } -int net_udp_send_raw(netif_t *net, uint16 src_port, uint16 dst_port, const uint8 ipa[4], - const uint8 *data, int size) { - ip_pseudo_hdr_t *ps = (ip_pseudo_hdr_t *)udp_buf; - ip_hdr_t ip; - int internsize; +ssize_t net_udp_sendto(net_socket_t *hnd, const void *message, size_t length, + int flags, const struct sockaddr *addr, + socklen_t addr_len) { + struct udp_sock *udpsock; + struct sockaddr_in *realaddr; - /* Fill in the UDP Header */ - if(net == NULL) /* Sending from the loopback device? */ - ps->src_addr = 0x0100007f; /* 127.0.0.1 */ - else - ps->src_addr = net_ntohl(net_ipv4_address(net->ip_addr)); - ps->dst_addr = net_ntohl(net_ipv4_address(ipa)); - ps->zero = 0; - ps->proto = 17; - ps->length = net_ntohs(size + sizeof(udp_hdr_t)); - ps->src_port = net_ntohs(src_port); - ps->dst_port = net_ntohs(dst_port); - ps->hdrlength = ps->length; - ps->checksum = 0; - memcpy(ps->data, data, size); + mutex_lock(udp_mutex); - if(size % 2) { - internsize = size + 1; - ps->data[internsize] = 0; - } - else - internsize = size; - + udpsock = (struct udp_sock *)hnd->data; + if(udpsock == NULL) { + mutex_unlock(udp_mutex); + errno = EBADF; + return -1; + } - /* Compute the UDP Checksum */ - ps->checksum = net_ipv4_checksum((uint16 *)udp_buf, (internsize + sizeof(udp_hdr_t) + 12) / 2); + if(udpsock->flags & SHUT_WR) { + mutex_unlock(udp_mutex); + errno = EPIPE; + return -1; + } - /* Fill in the IP Header */ - ip.version_ihl = 0x45; /* 20 byte header, ipv4 */ - ip.tos = 0; - ip.length = net_ntohs(sizeof(udp_hdr_t) + size + 20); - ip.packet_id = 0; - ip.flags_frag_offs = net_ntohs(0x4000); - ip.ttl = 64; - ip.protocol = 17; /* UDP */ - ip.checksum = 0; - ip.src = ps->src_addr; - ip.dest = ps->dst_addr; + if(message == NULL || addr == NULL) { + mutex_unlock(udp_mutex); + errno = EFAULT; + return -1; + } - /* Compute the IP Checksum */ - ip.checksum = net_ipv4_checksum((uint16*)&ip, sizeof(ip_hdr_t) / 2); + realaddr = (struct sockaddr_in *) addr; - return net_ipv4_send_packet(net, &ip, (uint8 *)(udp_buf + 12), sizeof(udp_hdr_t) + size); + if(udpsock->local_addr.sin_port == 0) { + uint16 port = 1024, tmp = 0; + struct udp_sock *iter; + + /* Grab the first unused port >= 1024. This is, unfortunately, O(n^2) */ + while(tmp != port) { + tmp = port; + + LIST_FOREACH(iter, &net_udp_sockets, sock_list) { + if(iter->local_addr.sin_port == port) { + ++port; + break; + } + } + } + + udpsock->local_addr.sin_port = htons(port); + } + + mutex_unlock(udp_mutex); + + return net_udp_send_raw(NULL, udpsock->local_addr.sin_addr.s_addr, + udpsock->local_addr.sin_port, + realaddr->sin_addr.s_addr, realaddr->sin_port, + (uint8 *) message, length); } + +int net_udp_shutdownsock(net_socket_t *hnd, int how) { + struct udp_sock *udpsock; + + mutex_lock(udp_mutex); + + udpsock = (struct udp_sock *)hnd->data; + if(udpsock == NULL) { + mutex_unlock(udp_mutex); + errno = EBADF; + return -1; + } + + if(how & 0xFFFFFFFC) { + mutex_unlock(udp_mutex); + errno = EINVAL; + } + + udpsock->flags |= how; + + mutex_unlock(udp_mutex); + + return 0; +} + +int net_udp_socket(net_socket_t *hnd, int domain, int type, int protocol) { + struct udp_sock *udpsock; + + udpsock = (struct udp_sock *) malloc(sizeof(struct udp_sock)); + if(udpsock == NULL) { + errno = ENOMEM; + return -1; + } + + udpsock->remote_addr.sin_family = AF_INET; + udpsock->remote_addr.sin_addr.s_addr = INADDR_ANY; + udpsock->remote_addr.sin_port = 0; + + udpsock->local_addr.sin_family = AF_INET; + udpsock->local_addr.sin_addr.s_addr = INADDR_ANY; + udpsock->local_addr.sin_port = 0; + + udpsock->flags = 0; + + TAILQ_INIT(&udpsock->packets); + + mutex_lock(udp_mutex); + LIST_INSERT_HEAD(&net_udp_sockets, udpsock, sock_list); + mutex_unlock(udp_mutex); + + hnd->data = udpsock; + + return 0; +} + +void net_udp_close(net_socket_t *hnd) { + struct udp_sock *udpsock; + struct udp_pkt *pkt; + + mutex_lock(udp_mutex); + + udpsock = (struct udp_sock *)hnd->data; + if(udpsock == NULL) { + mutex_unlock(udp_mutex); + errno = EBADF; + } + + TAILQ_FOREACH(pkt, &udpsock->packets, pkt_queue) { + free(pkt->data); + TAILQ_REMOVE(&udpsock->packets, pkt, pkt_queue); + free(pkt); + } + + LIST_REMOVE(udpsock, sock_list); + + free(udpsock); + mutex_unlock(udp_mutex); +} + +int net_udp_setflags(net_socket_t *hnd, int flags) { + struct udp_sock *udpsock; + + mutex_lock(udp_mutex); + + udpsock = (struct udp_sock *) hnd->data; + if(udpsock == NULL) { + mutex_unlock(udp_mutex); + errno = EBADF; + return -1; + } + + if(flags & (~O_NONBLOCK)) { + mutex_unlock(udp_mutex); + errno = EINVAL; + return -1; + } + + udpsock->flags |= flags; + mutex_unlock(udp_mutex); + + return 0; +} + +int net_udp_input(netif_t *src, eth_hdr_t *eh, ip_hdr_t *ip, const uint8 *data, + int size) { + uint8 buf[size + 13]; + ip_pseudo_hdr_t *ps = (ip_pseudo_hdr_t *)buf; + uint16 checksum; + struct udp_sock *sock; + struct udp_pkt *pkt; + + ps->src_addr = ip->src; + ps->dst_addr = ip->dest; + ps->zero = 0; + ps->proto = ip->protocol; + memcpy(&ps->src_port, data, size); + ps->length = htons(size); + + /* check this.... */ + if(size & 0x01) { + ps->data[size - sizeof(udp_hdr_t)] = 0; + checksum = ps->checksum; + ps->checksum = 0; + ps->checksum = net_ipv4_checksum((uint16 *) buf, (size + 13) >> 1); + } + else { + checksum = ps->checksum; + ps->checksum = 0; + ps->checksum = net_ipv4_checksum((uint16 *) buf, (size + 12) >> 1); + } + + if(checksum != ps->checksum) { + dbglog(DBG_KDEBUG, "net_udp: discarding UDP packet with invalid " + "checksum\n" + " calculated 0x%04X, sent 0x%04X\n", + ps->checksum, checksum); + return -1; + } + + if(mutex_trylock(udp_mutex)) { + dbglog(DBG_KDEBUG, "net_udp: discarding packet due to locked mutex\n"); + return -1; + } + + LIST_FOREACH(sock, &net_udp_sockets, sock_list) { + /* See if we have a socket matching the description provided */ + if(sock->local_addr.sin_port == ps->dst_port && + ((sock->remote_addr.sin_port == ps->src_port && + sock->remote_addr.sin_addr.s_addr == ps->src_addr) || + (sock->remote_addr.sin_port == 0 && + sock->remote_addr.sin_addr.s_addr == INADDR_ANY))) { + pkt = (struct udp_pkt *) malloc(sizeof(struct udp_pkt)); + + pkt->datasize = size - sizeof(udp_hdr_t); + pkt->data = (uint8 *) malloc(pkt->datasize); + + pkt->from.sin_family = AF_INET; + pkt->from.sin_addr.s_addr = ip->src; + pkt->from.sin_port = ps->src_port; + + memcpy(pkt->data, ps->data, pkt->datasize); + + TAILQ_INSERT_TAIL(&sock->packets, pkt, pkt_queue); + + cond_broadcast(udp_packets_ready); + + mutex_unlock(udp_mutex); + + return 0; + } + } + + dbglog(DBG_KDEBUG, "net_udp: Discarding packet for non-opened socket\n"); + mutex_unlock(udp_mutex); + + return 0; +} + +int net_udp_send_raw(netif_t *net, uint32 src_ip, uint16 src_port, + uint32 dst_ip, uint16 dst_port, const uint8 *data, + int size) { + uint8 buf[size + 13 + sizeof(udp_hdr_t)]; + ip_pseudo_hdr_t *ps = (ip_pseudo_hdr_t *) buf; + ip_hdr_t ip; + + if(net == NULL && net_default_dev == NULL) { + errno = ENETDOWN; + return -1; + } + + if(src_ip == INADDR_ANY) { + if(net == NULL && net_default_dev != NULL) { + ps->src_addr = htonl(net_ipv4_address(net_default_dev->ip_addr)); + } + else if(net != NULL) { + ps->src_addr = htonl(net_ipv4_address(net->ip_addr)); + } + } + else { + ps->src_addr = src_ip; + } + + buf[size + 12 + sizeof(udp_hdr_t)] = 0; + memcpy(ps->data, data, size); + size += sizeof(udp_hdr_t); + + ps->dst_addr = dst_ip; + ps->zero = 0; + ps->proto = 17; + ps->length = htons(size); + ps->src_port = src_port; + ps->dst_port = dst_port; + ps->hdrlength = ps->length; + ps->checksum = 0; + + /* Compute the UDP checksum */ + if(size & 0x01) { + ps->checksum = net_ipv4_checksum((uint16 *) buf, + (size + 13) >> 1); + } + else { + ps->checksum = net_ipv4_checksum((uint16 *) buf, + (size + 12) >> 1); + } + + /* Fill in the IPv4 Header */ + ip.version_ihl = 0x45; + ip.tos = 0; + ip.length = htons(size + 20); + ip.packet_id = 0; + ip.flags_frag_offs = htons(0x4000); + ip.ttl = 64; + ip.protocol = 17; + ip.checksum = 0; + ip.src = ps->src_addr; + ip.dest = ps->dst_addr; + + /* Compute the IPv4 checksum */ + ip.checksum = net_ipv4_checksum((uint16 *) &ip, sizeof(ip_hdr_t) >> 1); + + /* send it away.... */ + if(net_ipv4_send_packet(net, &ip, buf + 12, size)) { + /* If net_ipv4_send_packet() returns anything but 0, its an error, + errno should be set already from it. */ + return -1; + } + else { + return size - sizeof(udp_hdr_t); + } +} + +int net_udp_init() { + udp_mutex = mutex_create(); + + if(udp_mutex == NULL) { + return -1; + } + + udp_packets_ready = cond_create(); + + if(udp_packets_ready == NULL) { + mutex_destroy(udp_mutex); + return -1; + } + + return 0; +} + +void net_udp_shutdown() { + mutex_destroy(udp_mutex); + cond_destroy(udp_packets_ready); +} Modified: kos/kernel/net/net_udp.h =================================================================== --- kos/kernel/net/net_udp.h 2006-09-14 03:04:48 UTC (rev 354) +++ kos/kernel/net/net_udp.h 2006-09-16 16:18:26 UTC (rev 355) @@ -1,22 +1,52 @@ /* KallistiOS ##version## kernel/net/net_udp.h - Copyright (C) 2005 Lawrence Sebald + Copyright (C) 2005, 2006 Lawrence Sebald */ #ifndef __LOCAL_NET_UDP_H #define __LOCAL_NET_UDP_H +#include <sys/socket.h> +#include <kos/fs_socket.h> + #define packed __attribute__((packed)) typedef struct { - uint16 src_port packed; - uint16 dst_port packed; - uint16 length packed; - uint16 checksum packed; + uint16 src_port packed; + uint16 dst_port packed; + uint16 length packed; + uint16 checksum packed; } udp_hdr_t; #undef packed -int net_udp_input(netif_t *src, eth_hdr_t *eh, ip_hdr_t *ih, const uint8 *data, int size); +int net_udp_input(netif_t *src, eth_hdr_t *eh, ip_hdr_t *ih, const uint8 *data, + int size); +int net_udp_send_raw(netif_t *net, uint32 src_ip, uint16 src_port, + uint32 dst_ip, uint16 dst_port, const uint8 *data, + int size); +/* Sockets */ +int net_udp_accept(net_socket_t *hnd, struct sockaddr *addr, + socklen_t *addr_len); +int net_udp_bind(net_socket_t *hnd, const struct sockaddr *addr, + socklen_t addr_len); +int net_udp_connect(net_socket_t *hnd, const struct sockaddr *addr, + socklen_t addr_len); +int net_udp_listen(net_socket_t *hnd, int backlog); +ssize_t net_udp_recv(net_socket_t *hnd, void *buffer, size_t length, int flags); +ssize_t net_udp_recvfrom(net_socket_t *hnd, void *buffer, size_t length, + int flags, struct sockaddr *addr, socklen_t *addr_len); +ssize_t net_udp_send(net_socket_t *hnd, const void *message, size_t length, + int flags); +ssize_t net_udp_sendto(net_socket_t *hnd, const void *message, size_t length, + int flags, const struct sockaddr *addr, + socklen_t addr_len); +int net_udp_shutdownsock(net_socket_t *hnd, int how); +int net_udp_socket(net_socket_t *hnd, int domain, int type, int protocol); + +void net_udp_close(net_socket_t *hnd); + +int net_udp_setflags(net_socket_t *hnd, int flags); + #endif /* __LOCAL_NET_UDP_H */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2006-09-14 03:04:57
|
Revision: 354 http://svn.sourceforge.net/cadcdev/?rev=354&view=rev Author: ljsebald Date: 2006-09-13 20:04:48 -0700 (Wed, 13 Sep 2006) Log Message: ----------- Another networking change coming up. This is a bit of cleaning in the net_ipv4.c file. Modified Paths: -------------- kos/include/kos/net.h kos/kernel/net/net_ipv4.c Modified: kos/include/kos/net.h =================================================================== --- kos/include/kos/net.h 2006-09-14 02:39:59 UTC (rev 353) +++ kos/include/kos/net.h 2006-09-14 03:04:48 UTC (rev 354) @@ -198,6 +198,10 @@ within the ip. */ uint32 net_ipv4_address(const uint8 addr[4]); +/* Parse an IP address that is packet into a uint32 into an array of the + individual bytes */ +void net_ipv4_parse_address(uint32 addr, uint8 out[4]); + /***** net_udp.c **********************************************************/ /* Init */ Modified: kos/kernel/net/net_ipv4.c =================================================================== --- kos/kernel/net/net_ipv4.c 2006-09-14 02:39:59 UTC (rev 353) +++ kos/kernel/net/net_ipv4.c 2006-09-14 03:04:48 UTC (rev 354) @@ -2,7 +2,7 @@ kernel/net/net_ipv4.c - Copyright (C) 2005 Lawrence Sebald + Copyright (C) 2005, 2006 Lawrence Sebald Portions adapted from KOS' old net_icmp.c file: Copyright (c) 2002 Dan Potter @@ -11,6 +11,8 @@ #include <stdio.h> #include <string.h> +#include <errno.h> +#include <arpa/inet.h> #include <kos/net.h> #include "net_ipv4.h" #include "net_icmp.h" @@ -22,7 +24,7 @@ uint32 net_ntohl(uint32 n) { return ((n & 0xFF) << 24) | ((n & 0xFF00) << 8) | - ((n >> 8) & 0xFF00) | ((n >> 24) & 0xFF); + ((n >> 8) & 0xFF00) | ((n >> 24) & 0xFF); } /* Perform an IP-style checksum on a block of data */ @@ -43,7 +45,8 @@ } /* Determine if a given IP is in the current network */ -static int is_in_network(const uint8 src[4], const uint8 dest[4], const uint8 netmask[4]) { +static int is_in_network(const uint8 src[4], const uint8 dest[4], + const uint8 netmask[4]) { int i; for(i = 0; i < 4; i++) { @@ -55,19 +58,21 @@ } /* Send a packet on the specified network adaptor */ -int net_ipv4_send_packet(netif_t *net, ip_hdr_t *hdr, const uint8 *data, int size) { +int net_ipv4_send_packet(netif_t *net, ip_hdr_t *hdr, const uint8 *data, + int size) { uint8 dest_ip[4]; uint8 dest_mac[6]; uint8 pkt[size + sizeof(ip_hdr_t) + sizeof(eth_hdr_t)]; eth_hdr_t *ehdr; - dest_ip[0] = (uint8)(hdr->dest & 0xFF); - dest_ip[1] = (uint8)(hdr->dest >> 8); - dest_ip[2] = (uint8)(hdr->dest >> 16); - dest_ip[3] = (uint8)(hdr->dest >> 24); + if(net == NULL) { + net = net_default_dev; + } - /* Is this the loopback address? */ - if(dest_ip[0] == 127 && dest_ip[1] == 0 && dest_ip[2] == 0 && dest_ip[3] == 1) { + net_ipv4_parse_address(ntohl(hdr->dest), dest_ip); + + /* Is this the loopback address (127.0.0.1)? */ + if(ntohl(hdr->dest) == 0x7F000001) { /* Fill in the ethernet header */ ehdr = (eth_hdr_t *)pkt; memset(ehdr->dest, 0, 6); @@ -80,24 +85,29 @@ ehdr->type[1] = 0x00; /* Put the IP header / data into our ethernet packet */ - memcpy(pkt + sizeof(eth_hdr_t), hdr, 4 * (hdr->version_ihl & 0x0f)); - memcpy(pkt + sizeof(eth_hdr_t) + 4 * (hdr->version_ihl & 0x0f), data, size); + memcpy(pkt + sizeof(eth_hdr_t), hdr, + 4 * (hdr->version_ihl & 0x0f)); + memcpy(pkt + sizeof(eth_hdr_t) + 4 * (hdr->version_ihl & 0x0f), + data, size); /* Send it away */ - net_input(NULL, pkt, sizeof(eth_hdr_t) + sizeof(ip_hdr_t) + size); + net_input(NULL, pkt, sizeof(eth_hdr_t) + sizeof(ip_hdr_t) + + size); return 0; } - /* Is it in our network? */ - if(!is_in_network(net->ip_addr, dest_ip, net->netmask)) + /* Is it in our network? */ + if(!is_in_network(net->ip_addr, dest_ip, net->netmask)) { memcpy(dest_ip, net->gateway, 4); + } /* Get our destination's MAC address */ - if(net_arp_lookup(net, dest_ip, dest_mac) == -1) + if(net_arp_lookup(net, dest_ip, dest_mac) == -1) { + errno = ENETUNREACH; return -1; + } - /* Fill in the ethernet header */ ehdr = (eth_hdr_t *)pkt; memcpy(ehdr->dest, dest_mac, 6); @@ -107,10 +117,12 @@ /* Put the IP header / data into our ethernet packet */ memcpy(pkt + sizeof(eth_hdr_t), hdr, 4 * (hdr->version_ihl & 0x0f)); - memcpy(pkt + sizeof(eth_hdr_t) + 4 * (hdr->version_ihl & 0x0f), data, size); + memcpy(pkt + sizeof(eth_hdr_t) + 4 * (hdr->version_ihl & 0x0f), data, + size); /* Send it away */ - net->if_tx(net, pkt, sizeof(ip_hdr_t) + size + sizeof(eth_hdr_t), NETIF_BLOCK); + net->if_tx(net, pkt, sizeof(ip_hdr_t) + size + sizeof(eth_hdr_t), + NETIF_BLOCK); return 0; } @@ -120,45 +132,58 @@ ip_hdr_t *ip; int i; uint8 *data; + uint16 *ethproto; /* Get pointers */ - eth = (eth_hdr_t*)(pkt); - ip = (ip_hdr_t*)(pkt + sizeof(eth_hdr_t)); - data = (uint8 *)(pkt + sizeof(eth_hdr_t) + 4*(ip->version_ihl & 0x0f)); + eth = (eth_hdr_t*) (pkt); + ip = (ip_hdr_t*) (pkt + sizeof(eth_hdr_t)); + data = (uint8 *) (pkt + sizeof(eth_hdr_t) + 4 * + (ip->version_ihl & 0x0f)); + ethproto = (uint16 *) (pkt + 12); - /* Non-IP */ - if (eth->type[0] != 0x08) + /* Make sure this packet is actually marked as an IP packet */ + if(ntohs(*ethproto) != 0x0800) { + dbglog(DBG_KDEBUG, "net_ipv4: Discarding non IP packet\n"); return 0; + } - if (eth->type[1] != 0x00) - return 0; - /* Check ip header checksum */ i = ip->checksum; ip->checksum = 0; - ip->checksum = net_ipv4_checksum((uint16*)ip, 2 * (ip->version_ihl & 0x0f)); - if (i != ip->checksum) { - dbglog(DBG_KDEBUG, "net_ipv4: ip with invalid checksum\n"); + ip->checksum = net_ipv4_checksum((uint16*)ip, 2 * + (ip->version_ihl & 0x0f)); + + if(i != ip->checksum) { + dbglog(DBG_KDEBUG, "net_ipv4: Discarding recieved IP packet " + "with invalid checksum\n"); return 0; } - switch(ip->protocol) { + switch(ip->protocol) { case 1: - net_icmp_input(src, eth, ip, data, net_ntohs(ip->length) - + net_icmp_input(src, eth, ip, data, ntohs(ip->length) - (ip->version_ihl & 0x0f) * 4); break; case 17: - net_udp_input(src, eth, ip, data, net_ntohs(ip->length) - + net_udp_input(src, eth, ip, data, ntohs(ip->length) - (ip->version_ihl & 0x0f) * 4); break; default: - dbglog(DBG_KDEBUG, "net_ipv4: unknown ip protocol: %d\n", ip->protocol); + dbglog(DBG_KDEBUG, "net_ipv4: Discarding recieved IP " + "packet with unkown protocol: %d\n", + ip->protocol); } return 0; } uint32 net_ipv4_address(const uint8 addr[4]) { - uint32 ad = (addr[0] << 24) | (addr[1] << 16) | (addr[2] << 8) | (addr[3]); - return ad; + return (addr[0] << 24) | (addr[1] << 16) | (addr[2] << 8) | (addr[3]); } + +void net_ipv4_parse_address(uint32 addr, uint8 out[4]) { + out[0] = (uint8) ((addr >> 24) & 0xFF); + out[1] = (uint8) ((addr >> 16) & 0xFF); + out[2] = (uint8) ((addr >> 8) & 0xFF); + out[3] = (uint8) (addr & 0xFF); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2006-09-14 02:40:05
|
Revision: 353 http://svn.sourceforge.net/cadcdev/?rev=353&view=rev Author: ljsebald Date: 2006-09-13 19:39:59 -0700 (Wed, 13 Sep 2006) Log Message: ----------- Adding in some more networking changes. This set is some code formatting corrections, along with getting rid of net_ntohs and net_ntohl usage in many places. Modified Paths: -------------- kos/kernel/net/net_icmp.c kos/kernel/net/net_input.c Modified: kos/kernel/net/net_icmp.c =================================================================== --- kos/kernel/net/net_icmp.c 2006-09-14 02:04:08 UTC (rev 352) +++ kos/kernel/net/net_icmp.c 2006-09-14 02:39:59 UTC (rev 353) @@ -3,7 +3,7 @@ kernel/net/net_icmp.c Copyright (C) 2002 Dan Potter - Copyright (C) 2005 Lawrence Sebald + Copyright (C) 2005, 2006 Lawrence Sebald */ @@ -14,6 +14,7 @@ #include <kos/net.h> #include <kos/thread.h> #include <arch/timer.h> +#include <arpa/inet.h> #include "net_icmp.h" #include "net_ipv4.h" @@ -53,25 +54,15 @@ static uint16 icmp_echo_seq = 1; static void icmp_default_echo_cb(const uint8 *ip, uint16 seq, uint64 delta_us, -uint8 ttl, const uint8* data, int data_sz) { + uint8 ttl, const uint8* data, int data_sz) { printf("%d bytes from %d.%d.%d.%d: icmp_seq=%d ttl=%d time=%.2f ms\n", - data_sz, ip[0], ip[1], ip[2], ip[3], seq, ttl, delta_us / 1000.0f); + data_sz, ip[0], ip[1], ip[2], ip[3], seq, ttl, + delta_us / 1000.0f); } /* The default echo (ping) callback */ net_echo_cb net_icmp_echo_cb = icmp_default_echo_cb; -#if 0 -static uint16 ntohs(uint16 n) { - return ((n & 0xff) << 8) | ((n >> 8) & 0xff); -} - -static uint32 ntohl(uint32 n) { - return ((n & 0xFF) << 24) | ((n & 0xFF00) << 8) | - ((n >> 8) & 0xFF00) | ((n >> 24) & 0xFF); -} -#endif - /* Handle Echo Reply (ICMP type 0) packets */ static void net_icmp_input_0(netif_t *src, eth_hdr_t *eth, ip_hdr_t *ip, icmp_hdr_t *icmp, const uint8 *d, int s) { @@ -84,8 +75,8 @@ LIST_FOREACH(ping, &pings, pkt_list) { seq = (d[7] | (d[6] << 8)); if(ping->icmp_seq == seq) { - net_icmp_echo_cb((uint8 *)&ip->src, seq, tmr - ping->usec, ip->ttl, - d, s); + net_icmp_echo_cb((uint8 *)&ip->src, seq, + tmr - ping->usec, ip->ttl, d, s); LIST_REMOVE(ping, pkt_list); free(ping->data); @@ -117,23 +108,24 @@ /* Recompute the IP header checksum */ ip->checksum = 0; - ip->checksum = net_ipv4_checksum((uint16*)ip, - 2 * (ip->version_ihl & 0x0f)); + ip->checksum = net_ipv4_checksum((uint16*)ip, + 2 * (ip->version_ihl & 0x0f)); /* Recompute the ICMP header checksum */ icmp->checksum = 0; - icmp->checksum = net_ipv4_checksum((uint16*)icmp, net_ntohs(ip->length) / 2 - - 2 * (ip->version_ihl & 0x0f)); + icmp->checksum = net_ipv4_checksum((uint16*)icmp, ntohs(ip->length) / + 2 - 2 * (ip->version_ihl & 0x0f)); /* Send it */ memcpy(pktbuf, eth, 14); memcpy(pktbuf + 14, ip, 20); - memcpy(pktbuf + 14 + 20, d, net_ntohs(ip->length) - 4 * + memcpy(pktbuf + 14 + 20, d, ntohs(ip->length) - 4 * (ip->version_ihl & 0x0F)); - src->if_tx(src, pktbuf, 14 + net_ntohs(ip->length), NETIF_BLOCK); + src->if_tx(src, pktbuf, 14 + ntohs(ip->length), NETIF_BLOCK); } -int net_icmp_input(netif_t *src, eth_hdr_t *eth, ip_hdr_t *ip, const uint8 *d, int s) { +int net_icmp_input(netif_t *src, eth_hdr_t *eth, ip_hdr_t *ip, const uint8 *d, + int s) { icmp_hdr_t *icmp; int i; @@ -144,33 +136,40 @@ memset(pktbuf, 0, 1514); i = icmp->checksum; icmp->checksum = 0; - memcpy(pktbuf, icmp, net_ntohs(ip->length) - 4*(ip->version_ihl & 0x0f)); + memcpy(pktbuf, icmp, ntohs(ip->length) - 4 * (ip->version_ihl & 0x0f)); icmp->checksum = net_ipv4_checksum((uint16*)pktbuf, - (net_ntohs(ip->length) + 1) / 2 - 2*(ip->version_ihl & 0x0f)); + (ntohs(ip->length) + 1) / 2 - + 2 * (ip->version_ihl & 0x0f)); if (i != icmp->checksum) { dbglog(DBG_KDEBUG, "net_icmp: icmp with invalid checksum\n"); return -1; } - switch(icmp->type) { + switch(icmp->type) { case 0: /* Echo reply */ net_icmp_input_0(src, eth, ip, icmp, d, s); break; + case 3: /* Destination unreachable */ + dbglog(DBG_KDEBUG, "net_icmp: Destination unreachable," + " code %d\n", icmp->code); + break; case 8: /* Echo */ net_icmp_input_8(src, eth, ip, icmp, d, s); break; default: - dbglog(DBG_KDEBUG, "net_icmp: unknown icmp type: %d\n", icmp->type); + dbglog(DBG_KDEBUG, "net_icmp: unknown icmp type: %d\n", + icmp->type); } return 0; } /* Send an ICMP Echo (PING) packet to the specified device */ -int net_icmp_send_echo(netif_t *net, const uint8 ipaddr[4], const uint8 *data, int size) { +int net_icmp_send_echo(netif_t *net, const uint8 ipaddr[4], const uint8 *data, + int size) { icmp_hdr_t *icmp; ip_hdr_t ip; struct __ping_pkt *newping; @@ -192,17 +191,18 @@ /* Fill in the IP Header */ ip.version_ihl = 0x45; /* 20 byte header, ipv4 */ ip.tos = 0; - ip.length = net_ntohs(sizeof(icmp_hdr_t) + size + 20); + ip.length = htons(sizeof(icmp_hdr_t) + size + 20); ip.packet_id = 0; ip.flags_frag_offs = 0x0040; ip.ttl = 64; ip.protocol = 1; /* ICMP */ ip.checksum = 0; - ip.src = net_ntohl(net_ipv4_address(net->ip_addr)); - ip.dest = net_ntohl(net_ipv4_address(ipaddr)); + ip.src = htonl(net_ipv4_address(net->ip_addr)); + ip.dest = htonl(net_ipv4_address(ipaddr)); /* Compute the ICMP Checksum */ - icmp->checksum = net_ipv4_checksum((uint16*)databuf, (sizeof(icmp_hdr_t) + size) / 2); + icmp->checksum = net_ipv4_checksum((uint16*)databuf, + (sizeof(icmp_hdr_t) + size) / 2); /* Compute the IP Checksum */ ip.checksum = net_ipv4_checksum((uint16*)&ip, sizeof(ip_hdr_t) / 2); @@ -219,7 +219,8 @@ while(r == -1) { newping->usec = timer_us_gettime64(); - r = net_ipv4_send_packet(net, &ip, databuf, sizeof(icmp_hdr_t) + size); + r = net_ipv4_send_packet(net, &ip, databuf, + sizeof(icmp_hdr_t) + size); thd_sleep(10); } Modified: kos/kernel/net/net_input.c =================================================================== --- kos/kernel/net/net_input.c 2006-09-14 02:04:08 UTC (rev 352) +++ kos/kernel/net/net_input.c 2006-09-14 02:39:59 UTC (rev 353) @@ -7,6 +7,7 @@ #include <stdio.h> #include <kos/net.h> +#include <arpa/inet.h> #include "net_ipv4.h" CVSID("$Id: net_input.c,v 1.2 2002/03/24 00:27:05 bardtx Exp $"); @@ -20,13 +21,14 @@ static int net_default_input(netif_t *nif, const uint8 *data, int len) { uint16 *proto = (uint16 *)(data + 12); - switch(net_ntohs(*proto)) { + switch(ntohs(*proto)) { case 0x0800: return net_ipv4_input(nif, data, len); case 0x0806: return net_arp_input(nif, data, len); default: - dbglog(DBG_KDEBUG, "net_input: unhandled ethernet protocol: %x\n", net_ntohs(*proto)); + dbglog(DBG_KDEBUG, "net_input: unhandled ethernet " + "protocol: %x\n", ntohs(*proto)); return 0; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2006-09-14 02:04:18
|
Revision: 352 http://svn.sourceforge.net/cadcdev/?rev=352&view=rev Author: ljsebald Date: 2006-09-13 19:04:08 -0700 (Wed, 13 Sep 2006) Log Message: ----------- Adding in the first of the big network changes that I have been working on. Modified Paths: -------------- kos/kernel/libc/koslib/Makefile Added Paths: ----------- kos/include/arpa/ kos/include/arpa/inet.h kos/include/netinet/ kos/include/netinet/in.h kos/kernel/libc/koslib/inet_addr.c Added: kos/include/arpa/inet.h =================================================================== --- kos/include/arpa/inet.h (rev 0) +++ kos/include/arpa/inet.h 2006-09-14 02:04:08 UTC (rev 352) @@ -0,0 +1,26 @@ +/* KallistiOS ##version## + + arpa/inet.h + Copyright (C)2006 Lawrence Sebald + +*/ + +#ifndef __ARPA_INET_H +#define __ARPA_INET_H + +#include <sys/cdefs.h> +#include <netinet/in.h> + +__BEGIN_DECLS + +uint32 htonl(uint32 value); +uint32 ntohl(uint32 value); + +uint16 htons(uint16 value); +uint16 ntohs(uint16 value); + +in_addr_t inet_addr(const char *cp); + +__END_DECLS + +#endif /* __ARPA_INET_H */ Added: kos/include/netinet/in.h =================================================================== --- kos/include/netinet/in.h (rev 0) +++ kos/include/netinet/in.h 2006-09-14 02:04:08 UTC (rev 352) @@ -0,0 +1,44 @@ +/* KallistiOS ##version## + + netinet/in.h + Copyright (C)2006 Lawrence Sebald + +*/ + +#ifndef __NETINET_IN_H +#define __NETINET_IN_H + +#include <sys/cdefs.h> +#include <arch/types.h> + +__BEGIN_DECLS + +typedef uint16 in_port_t; +typedef uint32 in_addr_t; + +#ifndef __SA_FAMILY_T_DEFINED +#define __SA_FAMILY_T_DEFINED +typedef uint32 sa_family_t; +#endif + +struct in_addr { + in_addr_t s_addr; +}; + +struct sockaddr_in { + sa_family_t sin_family; + in_port_t sin_port; + struct in_addr sin_addr; + unsigned char sin_zero[8]; +}; + +#define INADDR_ANY 0x00000000 +#define INADDR_BROADCAST 0xFFFFFFFF + +/* IP Protocols */ +#define IPPROTO_IP 0 +#define IPPROTO_UDP 17 + +__END_DECLS + +#endif /* __NETINET_IN_H */ Modified: kos/kernel/libc/koslib/Makefile =================================================================== --- kos/kernel/libc/koslib/Makefile 2006-09-14 01:38:50 UTC (rev 351) +++ kos/kernel/libc/koslib/Makefile 2006-09-14 02:04:08 UTC (rev 352) @@ -10,6 +10,6 @@ OBJS = abort.o byteorder.o memset2.o memset4.o memcpy2.o memcpy4.o \ assert.o dbglog.o malloc.o crtbegin.o crtend.o atexit.o \ opendir.o readdir.o closedir.o rewinddir.o scandir.o seekdir.o \ - telldir.o usleep.o + telldir.o usleep.o inet_addr.o include $(KOS_BASE)/Makefile.prefab Added: kos/kernel/libc/koslib/inet_addr.c =================================================================== --- kos/kernel/libc/koslib/inet_addr.c (rev 0) +++ kos/kernel/libc/koslib/inet_addr.c 2006-09-14 02:04:08 UTC (rev 352) @@ -0,0 +1,49 @@ +/* KallistiOS ##version## + + inet_addr.c + Copyright (C)2006 Lawrence Sebald + +*/ + +#include <arpa/inet.h> +#include <stdlib.h> + +in_addr_t inet_addr(const char *cp) { + in_addr_t result = 0; + long tmp; + char *ptr; + + tmp = strtoul(cp, &ptr, 10); + if(tmp > 0xFF || cp == ptr) { + return (in_addr_t) -1; + } + else { + result = tmp << 24; + } + + tmp = strtoul(ptr + 1, &ptr, 10); + if(tmp > 0xFF || cp == ptr) { + return (in_addr_t) -1; + } + else { + result |= tmp << 16; + } + + tmp = strtoul(ptr + 1, &ptr, 10); + if(tmp > 0xFF || cp == ptr) { + return (in_addr_t) -1; + } + else { + result |= tmp << 8; + } + + tmp = strtoul(ptr + 1, &ptr, 10); + if(tmp > 0xFF || cp == ptr) { + return (in_addr_t) -1; + } + else { + result |= tmp; + } + + return (in_addr_t) htonl(result); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2006-09-14 01:38:53
|
Revision: 351 http://svn.sourceforge.net/cadcdev/?rev=351&view=rev Author: ljsebald Date: 2006-09-13 18:38:50 -0700 (Wed, 13 Sep 2006) Log Message: ----------- Adding in a minor fix to the ARP handling code so that if an incomplete entry is encountered in the lookup code, it returns failure, rather than silently returning an invalid mac address. Modified Paths: -------------- kos/kernel/net/net_arp.c Modified: kos/kernel/net/net_arp.c =================================================================== --- kos/kernel/net/net_arp.c 2006-09-14 01:22:40 UTC (rev 350) +++ kos/kernel/net/net_arp.c 2006-09-14 01:38:50 UTC (rev 351) @@ -98,6 +98,12 @@ /* Look for the entry */ LIST_FOREACH(cur, &net_arp_cache, ac_list) { if (!memcmp(ip_in, cur->ip, 4)) { + if(cur->mac[0] == 0 && cur->mac[1] == 0 && + cur->mac[2] == 0 && cur->mac[3] == 0 && + cur->mac[4] == 0 && cur->mac[5] == 0) { + return -1; + } + memcpy(mac_out, cur->mac, 6); if (cur->timestamp != 0) cur->timestamp = jiffies; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ljs...@us...> - 2006-09-14 01:22:50
|
Revision: 350 http://svn.sourceforge.net/cadcdev/?rev=350&view=rev Author: ljsebald Date: 2006-09-13 18:22:40 -0700 (Wed, 13 Sep 2006) Log Message: ----------- Adding in a minor change to kos-cc to make my copy of autoconf happy. Modified Paths: -------------- kos/utils/gnu_wrappers/kos-cc Modified: kos/utils/gnu_wrappers/kos-cc =================================================================== --- kos/utils/gnu_wrappers/kos-cc 2006-08-12 18:38:18 UTC (rev 349) +++ kos/utils/gnu_wrappers/kos-cc 2006-09-14 01:22:40 UTC (rev 350) @@ -15,7 +15,7 @@ # Partial compile USEMODE=2 ;; - conftest.c | conftest.cc) + conftest.c | conftest.cc | conftest.cpp) # Used in autoconf... we really probably need # a better way to do this. (scan for any .c?) USEMODE=1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <at...@us...> - 2006-08-12 18:38:21
|
Revision: 349 Author: atani Date: 2006-08-12 11:38:18 -0700 (Sat, 12 Aug 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=349&view=rev Log Message: ----------- adding missing predeclaration of Hid namespace Modified Paths: -------------- tiki/include/Tiki/tiki.h Modified: tiki/include/Tiki/tiki.h =================================================================== --- tiki/include/Tiki/tiki.h 2006-07-08 01:57:14 UTC (rev 348) +++ tiki/include/Tiki/tiki.h 2006-08-12 18:38:18 UTC (rev 349) @@ -18,6 +18,7 @@ namespace Plxcompat { } namespace Frame { } } + namespace Hid { } namespace Audio { namespace OggVorbis { } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <c99...@us...> - 2006-07-08 01:57:20
|
Revision: 348 Author: c99koder Date: 2006-07-07 18:57:14 -0700 (Fri, 07 Jul 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=348&view=rev Log Message: ----------- Tiki: NDS build fixes Modified Paths: -------------- tiki/examples/TikiTest/Makefile tiki/nds/Makefile.rules tiki/nds/src/Makefile Added Paths: ----------- tiki/nds/src/audio/ tiki/nds/src/audio/sound.cpp tiki/nds/src/audio/stream.cpp Modified: tiki/examples/TikiTest/Makefile =================================================================== --- tiki/examples/TikiTest/Makefile 2006-07-06 19:18:05 UTC (rev 347) +++ tiki/examples/TikiTest/Makefile 2006-07-08 01:57:14 UTC (rev 348) @@ -4,7 +4,7 @@ OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) all: $(OBJS) - $(CXX) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikitest + $(CXX) $(LDFLAGS) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikitest clean: -rm -f $(OBJS) tikitest Modified: tiki/nds/Makefile.rules =================================================================== --- tiki/nds/Makefile.rules 2006-07-06 19:18:05 UTC (rev 347) +++ tiki/nds/Makefile.rules 2006-07-08 01:57:14 UTC (rev 348) @@ -31,4 +31,4 @@ LDFLAGS=-specs=ds_arm9.specs -mthumb -mthumb-interwork -mno-fpu -L$(DEVKITPRO)/lib -lgcc -include $(DEVKITPRO)/ds_rules +include $(DEVKITARM)/ds_rules Modified: tiki/nds/src/Makefile =================================================================== --- tiki/nds/src/Makefile 2006-07-06 19:18:05 UTC (rev 347) +++ tiki/nds/src/Makefile 2006-07-08 01:57:14 UTC (rev 348) @@ -1,5 +1,6 @@ OBJS = $(patsubst %.cpp,%.o,$(wildcard *.cpp)) +OBJS += $(patsubst %.cpp,%.o,$(wildcard audio/*.cpp)) all: $(OBJS) $(AR) ru ../libtiki.a $(OBJS) Added: tiki/nds/src/audio/sound.cpp =================================================================== --- tiki/nds/src/audio/sound.cpp (rev 0) +++ tiki/nds/src/audio/sound.cpp 2006-07-08 01:57:14 UTC (rev 348) @@ -0,0 +1,76 @@ +/* + Tiki + + sound.cpp + + Copyright (C)2002,2003,2004 Dan Potter + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#include "pch.h" +#include "Tiki/sound.h" +#include "Tiki/file.h" + +#include <string.h> + +using namespace Tiki::Audio; + +TIKI_OBJECT_NAME(Sound) +TIKI_OBJECT_BEGIN(Object, Sound) +TIKI_OBJECT_END(Sound) + +////////////////////////////////////////////////////////////////////////////////////////// + +float Sound::m_default_vol = 0.9f; + +bool Sound::initGlobal() { + return true; +} + +void Sound::shutdownGlobal() { + stopAll(); +} + +void Sound::stop(int ch) { +} + +void Sound::stopAll() { +} + +////////////////////////////////////////////////////////////////////////////////////////// + +Sound::Sound(const string & fn) { + if (!loadFromFile(fn)) + assert( false ); +} + +Sound::Sound() { +} + +Sound::~Sound() { +} + +bool Sound::loadFromFile(const string & fn) { + return false; +} + +// Set the default volume value +void Sound::setDefaultVolume(float vol) { + m_default_vol = vol; +} + +int Sound::play() { + return -1; +} + +int Sound::play(float vol) { + return -1; +} + +int Sound::play(float vol, float pan) { + return -1; +} + +void Sound::play(int ch, float vol, float pan) { +} + Property changes on: tiki/nds/src/audio/sound.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/audio/stream.cpp =================================================================== --- tiki/nds/src/audio/stream.cpp (rev 0) +++ tiki/nds/src/audio/stream.cpp 2006-07-08 01:57:14 UTC (rev 348) @@ -0,0 +1,162 @@ +/* + Tiki + + stream.cpp + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#include "pch.h" +#include "Tiki/stream.h" + +#include <string.h> + +using namespace Tiki::Audio; +using namespace Tiki::Thread; + +TIKI_OBJECT_NAME(Stream) +TIKI_OBJECT_BEGIN(Object, Stream) + TIKI_OBJECT_RECEIVER("start", Stream::objectStart) + TIKI_OBJECT_RECEIVER("stop", Stream::objectStop) +TIKI_OBJECT_END(Stream) + + +bool Stream::initGlobal() { + return true; +} + +void Stream::shutdownGlobal() { +} + +Stream::Stream() { + // Default our members. + m_bufSize = 0x4000; + m_chnCount = 2; + m_freq = 44100; + m_queueing = false; + m_state = StateStopped; + m_volume = 0.8f; + m_mutex = new Mutex(); +} + +Stream::~Stream() { + destroy(); +} + +bool Stream::create() { + AutoLock lock(m_mutex); + return true; +} + +void Stream::destroy() { + AutoLock lock(m_mutex); +} + +// virtual void filter(int freq, int chncount, void * buffer, int smpcnt) { } + +void Stream::filterAdd(Filter * f) { + AutoLock lock(m_mutex); + + m_filters.insertTail(f); +} + +void Stream::filterRemove(Filter * f) { + AutoLock lock(m_mutex); + + m_filters.del(f); +} + +void Stream::setQueueing(bool isQueued) { + AutoLock lock(m_mutex); + + m_queueing = isQueued; +} + +void Stream::setFrequency(int freq) { + AutoLock lock(m_mutex); + + m_freq = freq; +} + +void Stream::setChannelCount(int chncount) { + AutoLock lock(m_mutex); + + m_chnCount = chncount; +} + +void Stream::start() { + AutoLock lock(m_mutex); + m_state = StatePlaying; +} + +void Stream::stop() { + AutoLock lock(m_mutex); + m_state = StateStopped; +} + +void Stream::pause() { + AutoLock lock(m_mutex); + m_state = StatePaused; +} + +void Stream::resume() { + AutoLock lock(m_mutex); + m_state = StatePlaying; +} + +void Stream::setVolume(float vol) { + AutoLock lock(m_mutex); + + m_volume = vol; +} + +bool Stream::isPlaying() { + AutoLock lock(m_mutex); + + return m_state == StatePlaying; +} + +int Stream::objectStart(Object * /*from*/, Object * /*arg*/) { + start(); return 0; +} + +int Stream::objectStop(Object * /*from*/, Object * /*arg*/) { + stop(); return 0; +} + + +void Stream::processFilters(void * buffer, int smpcnt) { +} + +// "len" is a *sample* count. +void Stream::sepData(void * buffer, int len, bool stereo, int16 * outl, int16 * outr) { + int16 * sep_buffer[2] = { outl, outr }; + int16 * bufsrc, * bufdst; + int cnt; + + if (stereo) { + bufsrc = (int16*)buffer; + bufdst = sep_buffer[0]; + cnt = len; + do { + *bufdst = *bufsrc; + bufdst++; bufsrc+=2; cnt--; + } while (cnt > 0); + + bufsrc = (int16*)buffer; bufsrc++; + bufdst = sep_buffer[1]; + cnt = len; + do { + *bufdst = *bufsrc; + bufdst++; bufsrc+=2; cnt--; + } while (cnt > 0); + } else { + memcpy(sep_buffer[0], buffer, len * 2); + memcpy(sep_buffer[1], buffer, len * 2); + } +} + +Stream::GetDataResult Stream::getData(uint16 * buffer, int * numSamples) { + return GDError; +} + Property changes on: tiki/nds/src/audio/stream.cpp ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <at...@us...> - 2006-07-06 19:18:35
|
Revision: 347 Author: atani Date: 2006-07-06 12:18:05 -0700 (Thu, 06 Jul 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=347&view=rev Log Message: ----------- initial NDS port, nonfunctional so far but it compiles cleanly with DevKitARM(DevKitPro) r19a and libnds 20060621 Modified Paths: -------------- tiki/examples/TikiTest/Makefile tiki/include/Tiki/color.h tiki/include/Tiki/plxcompat.h tiki/include/Tiki/sound.h tiki/include/Tiki/stream.h tiki/include/Tiki/texture.h tiki/src/gl/drawables/console.cpp tiki/src/gl/genmenu.cpp tiki/src/gl/gl.cpp tiki/src/gl/plxcompat.cpp tiki/src/gl/texture.cpp Added Paths: ----------- tiki/nds/ tiki/nds/Makefile tiki/nds/Makefile.rules tiki/nds/include/ tiki/nds/include/Tiki/ tiki/nds/include/Tiki/glhdrs.h tiki/nds/include/Tiki/platthread.h tiki/nds/include/Tiki/tikitypes.h tiki/nds/include/ogg/ tiki/nds/include/ogg/config_types.h tiki/nds/include/pch.h tiki/nds/lib/ tiki/nds/src/ tiki/nds/src/Makefile tiki/nds/src/init_shutdown.cpp tiki/nds/src/platgl.cpp tiki/nds/src/plathid.cpp tiki/nds/src/platthread.cpp tiki/nds/src/tikitime.cpp Modified: tiki/examples/TikiTest/Makefile =================================================================== --- tiki/examples/TikiTest/Makefile 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/examples/TikiTest/Makefile 2006-07-06 19:18:05 UTC (rev 347) @@ -1,11 +1,13 @@ -CFLAGS=-I../../$(TIKI_PLAT)/include -I../../include +TIKI_DIR=../../ +CFLAGS=-I$(TIKI_DIR)$(TIKI_PLAT)/include -I$(TIKI_DIR)include OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) all: $(OBJS) - $(CXX) -L../../$(TIKI_PLAT) -L../../$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikitest + $(CXX) -L$(TIKI_DIR)$(TIKI_PLAT) -L$(TIKI_DIR)$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikitest clean: -rm -f $(OBJS) tikitest -include ../../$(TIKI_PLAT)/Makefile.rules +DEPSDIR=$(CURDIR) +include $(TIKI_DIR)$(TIKI_PLAT)/Makefile.rules Modified: tiki/include/Tiki/color.h =================================================================== --- tiki/include/Tiki/color.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/color.h 2006-07-06 19:18:05 UTC (rev 347) @@ -80,7 +80,11 @@ } void select() const { +#if TIKI_PLAT != TIKI_NDS glColor4f(r, g, b, a); +#else + glColor3f(r, g, b); +#endif } static uint32 pack(float a, float r, float g, float b) { Modified: tiki/include/Tiki/plxcompat.h =================================================================== --- tiki/include/Tiki/plxcompat.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/plxcompat.h 2006-07-06 19:18:05 UTC (rev 347) @@ -249,7 +249,11 @@ uint8 g = (uint8)((argb >> 8) & 0xff); uint8 b = (uint8)((argb >> 0) & 0xff); uint8 a = (uint8)((argb >> 24) & 0xff); +#if TIKI_PLAT != TIKI_NDS glColor4ub(r, g, b, a); +#else + glColor3f(r, g, b); +#endif } // This function will handle the meat of the Parallax emulation. Note @@ -346,7 +350,11 @@ */ static inline void plx_vert_fnp(int flags, float x, float y, float z, float a, float r, float g, float b) { PRIMPRE(); +#if TIKI_PLAT != TIKI_NDS glColor4f(r, g, b, a); +#else + glColor3f(r, g, b); +#endif glVertex3f(x, y, z / zscale); PRIMPOST(flags); } @@ -390,7 +398,11 @@ float a, float r, float g, float b, float u, float v) { PRIMPRE(); +#if TIKI_PLAT != TIKI_NDS glColor4f(r, g, b, a); +#else + glColor3f(r, g, b); +#endif glTexCoord2f(u, v); glVertex3f(x, y, z / zscale); PRIMPOST(flags); Modified: tiki/include/Tiki/sound.h =================================================================== --- tiki/include/Tiki/sound.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/sound.h 2006-07-06 19:18:05 UTC (rev 347) @@ -66,11 +66,14 @@ private: bool m_stereo; -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS ALuint m_buffer; -#else +#endif +#if TIKI_PLAT == TIKI_DC sfxhnd_t handle; #endif +#if TIKI_PLAT == TIKI_NDS +#endif static float m_default_vol; }; Modified: tiki/include/Tiki/stream.h =================================================================== --- tiki/include/Tiki/stream.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/stream.h 2006-07-06 19:18:05 UTC (rev 347) @@ -124,7 +124,7 @@ }; State m_state; -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS ALuint m_buffers[2]; ALuint m_source; ALenum m_format; @@ -135,7 +135,7 @@ static void * alThreadProc(void * us); void threadProc(); void check(); -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS bool fillBuffer(ALuint buffer); #endif Modified: tiki/include/Tiki/texture.h =================================================================== --- tiki/include/Tiki/texture.h 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/include/Tiki/texture.h 2006-07-06 19:18:05 UTC (rev 347) @@ -89,7 +89,11 @@ int m_w, m_h; // Texture width/height Fmt m_fmt; // Format spec uint8 * m_txrdata; // Pointer to GL-formatted data +#if TIKI_PLAT != TIKI_NDS GLuint m_gltxr; // GL texture handle +#else + int m_gltxr; // GL texture handle +#endif }; }; Added: tiki/nds/Makefile =================================================================== --- tiki/nds/Makefile (rev 0) +++ tiki/nds/Makefile 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,58 @@ + +# BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/*.cpp)) +BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/oggvorbis/*.cpp)) +BASE_BASE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/base/*.cpp)) +BASE_GL_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/anims/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/drawables/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/triggers/*.cpp)) +BASE_HID_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/hid/*.cpp)) +BASE_IMAGE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/image/*.cpp)) +BASE_MATH_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/math/*.cpp)) +BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp)) + +JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c)) +PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c)) +ZLIB_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/zlib/*.c)) +OGG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libogg/src/*.c)) +VORBIS_OBJ=../3rdparty/libvorbis/lib/analysis.o \ + ../3rdparty/libvorbis/lib/bitrate.o \ + ../3rdparty/libvorbis/lib/block.o \ + ../3rdparty/libvorbis/lib/codebook.o \ + ../3rdparty/libvorbis/lib/envelope.o \ + ../3rdparty/libvorbis/lib/floor0.o \ + ../3rdparty/libvorbis/lib/floor1.o \ + ../3rdparty/libvorbis/lib/info.o \ + ../3rdparty/libvorbis/lib/lookup.o \ + ../3rdparty/libvorbis/lib/lpc.o \ + ../3rdparty/libvorbis/lib/lsp.o \ + ../3rdparty/libvorbis/lib/mapping0.o \ + ../3rdparty/libvorbis/lib/mdct.o \ + ../3rdparty/libvorbis/lib/psy.o \ + ../3rdparty/libvorbis/lib/registry.o \ + ../3rdparty/libvorbis/lib/res0.o \ + ../3rdparty/libvorbis/lib/sharedbook.o \ + ../3rdparty/libvorbis/lib/smallft.o \ + ../3rdparty/libvorbis/lib/synthesis.o \ + ../3rdparty/libvorbis/lib/vorbisfile.o \ + ../3rdparty/libvorbis/lib/window.o + +BASE_OBJS = $(BASE_AUDIO_OBJ) $(BASE_BASE_OBJ) $(BASE_GL_OBJ) \ + $(BASE_HID_OBJ) $(BASE_IMAGE_OBJ) $(BASE_MATH_OBJ) \ + $(BASE_THREAD_OBJ) + +THIRD_PARTY_OBJS = $(JPEG_OBJ) $(OGG_OBJ) $(VORBIS_OBJ) $(PNG_OBJ) $(ZLIB_OBJ) + +TIKI_DIR=$(CURDIR)/.. + +SUBDIRS=src + +all: subdirs $(BASE_OBJS) $(THIRD_PARTY_OBJS) + $(AR) ru libtiki.a $(BASE_OBJS) $(THIRD_PARTY_OBJS) + +clean: clean_subdirs + -rm -f $(BASE_OBJS) libtiki.a + +DEPSDIR=$(CURDIR) +TIKI_DIR=$(CURDIR)/.. +include Makefile.rules Property changes on: tiki/nds/Makefile ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/Makefile.rules =================================================================== --- tiki/nds/Makefile.rules (rev 0) +++ tiki/nds/Makefile.rules 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,34 @@ +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 + +ifeq ($(strip $(DEVKITPRO)),) +$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitARM) +endif + +TIKI_BASE_LIBS=-ltiki -L$(DEVKITPRO)/libnds/lib -lnds9 + + +CXXFLAGS=-I$(DEVKITPRO)/libnds/include +CXXFLAGS+=-I$(TIKI_DIR)/include +CXXFLAGS+=-I$(TIKI_DIR)/nds/include -g +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/zlib +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libjpeg +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libpng +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libogg/include +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libvorbis/include +CXXFLAGS+=-I$(TIKI_DIR)/3rdparty/libvorbis/lib +CXXFLAGS+=-DARM9 +CXXFLAGS+=-mcpu=arm9tdmi -mtune=arm9tdmi -ffast-math -mthumb -mthumb-interwork +CFLAGS=$(CXXFLAGS) +CXXFLAGS+=-fno-rtti + +LDFLAGS=-specs=ds_arm9.specs -mthumb -mthumb-interwork -mno-fpu -L$(DEVKITPRO)/lib -lgcc + +include $(DEVKITPRO)/ds_rules Property changes on: tiki/nds/Makefile.rules ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/Tiki/glhdrs.h =================================================================== --- tiki/nds/include/Tiki/glhdrs.h (rev 0) +++ tiki/nds/include/Tiki/glhdrs.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,16 @@ +/* + Tiki + + glhdrs.h + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_GLHDRS_H +#define __TIKI_GLHDRS_H + +// This file should include the platform's OpenGL and GLU headers. + +#include <nds.h> + +#endif // __TIKI_GLHDRS_H Property changes on: tiki/nds/include/Tiki/glhdrs.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/Tiki/platthread.h =================================================================== --- tiki/nds/include/Tiki/platthread.h (rev 0) +++ tiki/nds/include/Tiki/platthread.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,24 @@ +/* + Tiki + + platthread.h + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_PLATTHREAD_H +#define __TIKI_PLATTHREAD_H + + +namespace Tiki { +namespace Thread { + +typedef void* thread_t; +typedef long mutex_t; +typedef long cond_t; + +} +} + +#endif // __TIKI_PLATTHREAD_H + Property changes on: tiki/nds/include/Tiki/platthread.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/Tiki/tikitypes.h =================================================================== --- tiki/nds/include/Tiki/tikitypes.h (rev 0) +++ tiki/nds/include/Tiki/tikitypes.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,34 @@ +/* + Tiki + + types.h + + Copyright (C)2000,2001 Dan Potter + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_TYPES_H +#define __TIKI_TYPES_H + +#include <stddef.h> +#include <sys/cdefs.h> +#include <nds/jtypes.h> + +// This gets included in the main tiki.h, so it should suffice. +#define TIKI_OSX 0 +#define TIKI_WIN32 1 +#define TIKI_SDL 2 +#define TIKI_DC 3 +#define TIKI_GP2X 4 +#define TIKI_NDS 5 +#define TIKI_PLAT TIKI_NDS + +namespace Tiki { + +// Pointer arithmetic types +typedef uint32 ptr_t; + +}; + +#endif // __TIKI_TYPES_H + Property changes on: tiki/nds/include/Tiki/tikitypes.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/include/ogg/config_types.h =================================================================== --- tiki/nds/include/ogg/config_types.h (rev 0) +++ tiki/nds/include/ogg/config_types.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,7 @@ + +#include <nds/jtypes.h> + +typedef int64 ogg_int64_t; +typedef int32 ogg_int32_t; +typedef uint32 ogg_uint32_t; +typedef int16 ogg_int16_t; Added: tiki/nds/include/pch.h =================================================================== --- tiki/nds/include/pch.h (rev 0) +++ tiki/nds/include/pch.h 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,25 @@ +/* + Tiki + + pch.h + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +// This is mainly just a placeholder on non-Win32 platforms. If we don't +// include a file at the top of every source file, Visual C++ is too stupid +// to do it on its own. It's a convenient excuse to predefine some other +// stuff too though. + +// This header does most of the useful work for bringing in stuff. +#include "Tiki/tiki.h" + +// Don't bother with namespace poo inside the framework itself. +using namespace Tiki; + +// Packed structs need some compiler-specific foo. +#define PACKED_STRUCT_BEGIN +#define PACKED_STRUCT_END +#define PACKED_STRUCT_MEMBER __attribute__((packed)) + + Property changes on: tiki/nds/include/pch.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/Makefile =================================================================== --- tiki/nds/src/Makefile (rev 0) +++ tiki/nds/src/Makefile 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,12 @@ + +OBJS = $(patsubst %.cpp,%.o,$(wildcard *.cpp)) + +all: $(OBJS) + $(AR) ru ../libtiki.a $(OBJS) + +clean: + -rm -f $(OBJS) + +DEPSDIR=$(CURDIR) +TIKI_DIR=$(CURDIR)/../../ +include ../Makefile.rules Property changes on: tiki/nds/src/Makefile ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/init_shutdown.cpp =================================================================== --- tiki/nds/src/init_shutdown.cpp (rev 0) +++ tiki/nds/src/init_shutdown.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,35 @@ +/* + Tiki + + init_shutdown.cpp + + Copyright (C)2005 Atani Software +*/ + +#include "pch.h" + +#include "Tiki/sound.h" +#include "Tiki/stream.h" +#include "Tiki/plxcompat.h" +#include "Tiki/hid.h" + +namespace Tiki { + +bool init(int argc, char **argv) { + return Hid::init(); +} + +void shutdown() { + Hid::shutdown(); +} + +void setName(const char *windowName, const char *iconName) +{ +} + +namespace GL { +void showCursor(bool visible) { +} +} + +} Property changes on: tiki/nds/src/init_shutdown.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/platgl.cpp =================================================================== --- tiki/nds/src/platgl.cpp (rev 0) +++ tiki/nds/src/platgl.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,55 @@ +/* + * platgl.cpp + * Tiki + * + * Created by Dan Potter on 3/20/05. + * Copyright 2005 Cryptic Allusion, LLC. All rights reserved. + * + */ + +#include "Tiki/gl.h" +#include "Tiki/tikitime.h" +#include "Tiki/debug.h" + +#include <unistd.h> +#include <sys/time.h> + +namespace Tiki { +namespace GL { +namespace Frame { + +float getFrameRate() { + return 0.0f; +} + +void setFrameRateLimit(int rate) { +} + +} + +extern "C" { + +void tiki_wait_if_needed() { +} + +void tiki_scene_begin_hook() { +} + +void tiki_scene_finish_hook() { +} + +void tiki_scene_begin_opaque_hook() { +} + +void tiki_scene_finish_opaque_hook() { +} + +void tiki_scene_begin_trans_hook() { +} + +void tiki_scene_finish_trans_hook() { +} + +} +} +} Property changes on: tiki/nds/src/platgl.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/plathid.cpp =================================================================== --- tiki/nds/src/plathid.cpp (rev 0) +++ tiki/nds/src/plathid.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,22 @@ +#include "pch.h" +#include "Tiki/glhdrs.h" +#include "Tiki/hid.h" + +namespace Tiki { +namespace Hid { +bool platInit() { + return true; +} + +void platShutdown() { +} + +} + +} + +extern "C" void TikiRecvQuit() { + Tiki::Hid::Event evt(Tiki::Hid::Event::EvtQuit); + sendEvent(evt); +} + Property changes on: tiki/nds/src/plathid.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/platthread.cpp =================================================================== --- tiki/nds/src/platthread.cpp (rev 0) +++ tiki/nds/src/platthread.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,92 @@ +/* + Tiki + + platthread.cpp + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#include "pch.h" +#include "Tiki/thread.h" + +#include <sys/time.h> +#include <time.h> + +using Tiki::Thread::thread_t; +using Tiki::Thread::mutex_t; +using Tiki::Thread::cond_t; + +bool Thread::create(thread_t * out, void * (*func)(void *), void * param) { + return false; +} + +bool Thread::join(thread_t thd, void ** out) { + return false; +} + +void Thread::exit(void * ptr) { +} + +bool Thread::equal(thread_t t1, thread_t t2) { + return false; +} + +thread_t Thread::self() { + return NULL; +} + + +bool Thread::mutex_create(mutex_t * out) { + return false; +} + +bool Thread::mutex_destroy(mutex_t * m) { + return false; +} + +bool Thread::mutex_trylock(mutex_t * m) { + return false; +} + +bool Thread::mutex_lock(mutex_t * m) { + return false; +} + +bool Thread::mutex_unlock(mutex_t * m) { + return false; +} + + +bool Thread::cond_broadcast(cond_t *cond) { + return false; +} + +bool Thread::cond_destroy(cond_t *cond) { + return false; +} + +bool Thread::cond_create(cond_t *cond) { + return false; +} + +bool Thread::cond_signal(cond_t *cond) { + return false; +} + +bool Thread::cond_wait(cond_t *cond, mutex_t *mutex, uint64 maxWaitMicros) { + return false; +} + +bool Thread::cond_wait(cond_t * cond, mutex_t *mutex) { + return false; +} + + + + + + + + + + Property changes on: tiki/nds/src/platthread.cpp ___________________________________________________________________ Name: svn:executable + * Added: tiki/nds/src/tikitime.cpp =================================================================== --- tiki/nds/src/tikitime.cpp (rev 0) +++ tiki/nds/src/tikitime.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -0,0 +1,41 @@ +/* + Tiki + + tikitime.cpp + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#include "pch.h" +#include "Tiki/tikitime.h" + +#include <sys/time.h> +#include <unistd.h> + +namespace Tiki { +namespace Time { +uint64 gettime() { + timeval tv; + gettimeofday(&tv, NULL); + + uint64 rv = tv.tv_sec; rv *= 1000000; + rv += tv.tv_usec; + + return rv; +} + +void sleep(uint64 us) { +// TODO: add this +} + +} +} + + + + + + + + + Property changes on: tiki/nds/src/tikitime.cpp ___________________________________________________________________ Name: svn:executable + * Modified: tiki/src/gl/drawables/console.cpp =================================================================== --- tiki/src/gl/drawables/console.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/drawables/console.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -36,7 +36,7 @@ m_texture->select(); -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); #endif @@ -262,8 +262,10 @@ int x=0,y=0; float x_step=(m_w / m_cols); float y_step=(m_h / m_rows); - + +#if TIKI_PLAT != TIKI_NDS glDisable(GL_DEPTH_TEST); +#endif for(y=0; y<m_rows; y++) { for(x=0; x<m_cols; x++) { Modified: tiki/src/gl/genmenu.cpp =================================================================== --- tiki/src/gl/genmenu.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/genmenu.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -134,10 +134,24 @@ Frame::begin(); - if (m_exiting) + if (m_exiting) { +#if TIKI_PLAT != TIKI_NDS glClearColor(m_bg[0]*m_exitCount, m_bg[1]*m_exitCount, m_bg[2]*m_exitCount, 1.0f); - else +#else + glClearColor((uint8)((m_bg[0]*m_exitCount)*255), + (uint8)((m_bg[1]*m_exitCount)*255), + (uint8)((m_bg[2]*m_exitCount)*255)); +#endif + } + else { +#if TIKI_PLAT != TIKI_NDS glClearColor(m_bg[0], m_bg[1], m_bg[2], 1.0f); +#else + glClearColor((uint8)(m_bg[0]*255), + (uint8)(m_bg[1]*255), + (uint8)(m_bg[2]*255)); +#endif + } visualOpaqueList(); Modified: tiki/src/gl/gl.cpp =================================================================== --- tiki/src/gl/gl.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/gl.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -22,6 +22,7 @@ // This sets up an OpenGL environment approximately the same // as a PVR. +#if TIKI_PLAT != TIKI_NDS glFrontFace(GL_CCW); glEnable(GL_DEPTH_TEST); #if TIKI_PLAT != TIKI_DC //KGL doesn't have these constants @@ -37,11 +38,14 @@ glShadeModel(GL_SMOOTH); glDisable(GL_CULL_FACE); +#endif set2d(); // glViewport((GLsizei)m_x1, (GLsizei)m_y1, (GLsizei)m_x2, (GLsizei)m_y2); + +#if TIKI_PLAT != TIKI_NDS glViewport(0, 0, 640, 480); - + glClearDepth(0.0f); #if TIKI_PLAT != TIKI_DC glClear(GL_COLOR_BUFFER_BIT+GL_DEPTH_BUFFER_BIT+GL_STENCIL_BUFFER_BIT); @@ -49,6 +53,13 @@ glClear(GL_COLOR_BUFFER_BIT+GL_DEPTH_BUFFER_BIT); #endif +#else // TIKI_NDS + glViewPort(0, 0, 255, 191); + + glClearDepth(0x7FFFF); + glClearColor(0,0,0); +#endif + glLoadIdentity(); transDisable(); @@ -75,7 +86,9 @@ void Frame::transEnable() { // This will leave the depth testing enabled (to not overdraw // opaque objects) but not update the depth buffer. +#if TIKI_PLAT != TIKI_NDS glDepthMask(GL_FALSE); +#endif #if TIKI_PLAT == TIKI_DC glKosFinishList(); @@ -83,7 +96,9 @@ // Turn on blending with a sensible alpha function default. glEnable(GL_BLEND); +#if TIKI_PLAT != TIKI_NDS glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +#endif } void Frame::transDisable() { Modified: tiki/src/gl/plxcompat.cpp =================================================================== --- tiki/src/gl/plxcompat.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/plxcompat.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -36,12 +36,16 @@ } void Plxcompat::plx_cxt_blending(int src, int dst) { +#if TIKI_PLAT != TIKI_NDS glBlendFunc(src, dst); +#endif } void Plxcompat::plx_cxt_culling(int type) { +#if TIKI_PLAT != TIKI_NDS glCullFace(type); glFrontFace(GL_CCW); +#endif } ///////////////////////////////////////////////////////////////////// Modified: tiki/src/gl/texture.cpp =================================================================== --- tiki/src/gl/texture.cpp 2006-07-05 22:01:53 UTC (rev 346) +++ tiki/src/gl/texture.cpp 2006-07-06 19:18:05 UTC (rev 347) @@ -55,8 +55,10 @@ //glDeleteTexture frees the PVR memory for us, how nice of it! #endif m_txrdata = NULL; +#if TIKI_PLAT != TIKI_NDS if (!initial && m_gltxr) glDeleteTextures(1, &m_gltxr); +#endif m_gltxr = 0; } @@ -186,11 +188,13 @@ m_h = img->h; m_fmt = (Fmt)(img->fmt); switch(img->fmt) { + case Image::RGB565: + case Image::RGB888: +#if TIKI_PLAT != TIKI_NDS // NDS doesnt support Alpha? case Image::RGBA8888: - case Image::RGB565: case Image::ARGB4444: case Image::ARGB1555: - case Image::RGB888: +#endif break; default: /* shrug */ @@ -203,7 +207,7 @@ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_gltxr); -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS /* We'll write the converted data into this buffer */ if (!m_txrdata) m_txrdata = new uint8[img->w * img->h * 4]; @@ -214,7 +218,7 @@ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_w, m_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_txrdata); GLenum err = glGetError(); -#else +#elif TIKI_PLAT == TIKI_DC m_txrdata = (uint8 *)pvr_mem_malloc(img->w * img->h * 2); pvr_txr_load_ex(m_ptr, m_txrdata, img->w, img->h, PVR_TXRLOAD_16BPP); @@ -224,6 +228,8 @@ glKosTex2D(GL_RGB565_TWID, m_w, m_h, m_txrdata); } glTexEnvi(GL_TEXTURE_2D,GL_TEXTURE_ENV_MODE,GL_MODULATEALPHA); +#elif TIKI_PLAT == TIKI_NDS + glTexImage2D(0, 0, GL_RGB, m_w, m_h, 0, TEXGEN_TEXCOORD, m_ptr); #endif return true; @@ -234,11 +240,13 @@ glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_gltxr); -#if TIKI_PLAT != TIKI_DC //KGL doesn't support these +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS + //KGL/NDS do support these glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -#else +#elif TIKI_PLAT == TIKI_DC glTexEnvi(GL_TEXTURE_2D,GL_TEXTURE_ENV_MODE,GL_MODULATEALPHA); +#elif TIKI_PLAT == TIKI_NDS #endif m_w = w; @@ -281,7 +289,7 @@ void Texture::setFilter(FilterType filter) { -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS select(); GLuint glfilt = GL_LINEAR; switch (filter) { @@ -298,6 +306,7 @@ } void Texture::setUVClamp(UVMode umode, UVMode vmode) { +#if TIKI_PLAT != TIKI_NDS GLenum gumode, gvmode; gumode = umode == UVClamp ? GL_CLAMP : GL_REPEAT; @@ -314,6 +323,7 @@ if (gvmode == GL_CLAMP) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); #endif +#endif } void * Texture::canvasLock() { @@ -324,18 +334,24 @@ convertToGl(); glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, m_gltxr); -#if TIKI_PLAT != TIKI_DC +#if TIKI_PLAT != TIKI_DC && TIKI_PLAT != TIKI_NDS glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_w, m_h, 0, GL_RGBA, GL_UNSIGNED_BYTE, m_txrdata); #else switch (m_fmt) { +#if TIKI_PLAT != TIKI_NDS case ARGB1555: glTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB1555, m_w, m_h, 0, GL_ARGB1555, GL_UNSIGNED_BYTE, m_ptr); break; case ARGB4444: glTexImage2D(GL_TEXTURE_2D, 0, GL_ARGB4444, m_w, m_h, 0, GL_ARGB4444, GL_UNSIGNED_BYTE, m_ptr); break; +#endif case RGB565: +#if TIKI_PLAT != TIKI_NDS glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB565, m_w, m_h, 0, GL_RGB565, GL_UNSIGNED_BYTE, m_ptr); +#else + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, m_w, m_h, 0, TEXGEN_TEXCOORD, m_ptr); +#endif break; default: Debug::printf("Texture::canvasUnlock: Unsupported texture format\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <at...@us...> - 2006-07-05 22:02:11
|
Revision: 346 Author: atani Date: 2006-07-05 15:01:53 -0700 (Wed, 05 Jul 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=346&view=rev Log Message: ----------- [DC] compilation fixes found while compiling goatmenu. [DC] removed call to tikitest_all from dc/Makefile. [GEN] fixes for various compilation warnings. [GEN] fixed missing include for Tiki/hid.h in cursor.h Modified Paths: -------------- tiki/dc/Makefile tiki/dc/src/platgl.cpp tiki/include/Tiki/drawables/cursor.h tiki/include/Tiki/genmenu.h tiki/src/gl/drawables/console.cpp tiki/src/gl/drawables/pointerArrow.cpp tiki/src/gl/font.cpp tiki/src/gl/plxcompat.cpp tiki/src/gl/texture.cpp Modified: tiki/dc/Makefile =================================================================== --- tiki/dc/Makefile 2006-06-15 16:50:57 UTC (rev 345) +++ tiki/dc/Makefile 2006-07-05 22:01:53 UTC (rev 346) @@ -19,7 +19,6 @@ all: subdirs $(BASE_OBJS) $(KOS_AR) ru libtiki.a $(BASE_OBJS) - $(MAKE) tikitest_all clean: clean_subdirs -rm -f $(BASE_OBJS) libtiki.a Modified: tiki/dc/src/platgl.cpp =================================================================== --- tiki/dc/src/platgl.cpp 2006-06-15 16:50:57 UTC (rev 345) +++ tiki/dc/src/platgl.cpp 2006-07-05 22:01:53 UTC (rev 346) @@ -15,11 +15,6 @@ using namespace Tiki; -static struct timeval lastFrame = { 0,0 }; -static int targetFrameRate = 60; -static uint64 firstFrame = 0; -static uint64 frameCnt = 0, totalFrameCnt = 0; - float Tiki::GL::Frame::getFrameRate() { pvr_stats_t stats; pvr_get_stats(&stats); @@ -27,70 +22,33 @@ } void Tiki::GL::Frame::setFrameRateLimit(int rate) { - targetFrameRate = rate; } extern "C" { void tiki_wait_if_needed() { -#if 0 - // Every so often we should reset the frame counters, to avoid - // having a super long term averaging effect. - if (frameCnt >= 500) { - firstFrame = 0; - frameCnt = 0; - } - - // Update frame counters. - if (!firstFrame) - firstFrame = Tiki::Time::gettime(); - frameCnt++; - totalFrameCnt++; - - if (lastFrame.tv_sec == 0) { - gettimeofday(&lastFrame, NULL); - return; - } - - struct timeval now; - gettimeofday(&now, NULL); - long long nowu = ((long long)now.tv_sec) * 1000 * 1000 + now.tv_usec; - long long lastu = ((long long)lastFrame.tv_sec) * 1000 * 1000 + lastFrame.tv_usec; - long long diffu = nowu - lastu; - if (diffu < (1000*1000 / targetFrameRate)) { - Time::sleep((1000*1000 / targetFrameRate) - diffu); - } - gettimeofday(&lastFrame, NULL); -#endif pvr_wait_ready(); } void tiki_scene_begin_hook() { - //tiki_wait_if_needed(); - //pvr_scene_begin(); glKosBeginFrame(); } void tiki_scene_finish_hook() { - //pvr_scene_finish(); glKosFinishFrame(); } void tiki_scene_begin_opaque_hook() { - //pvr_list_begin(PVR_LIST_OP_POLY); } void tiki_scene_finish_opaque_hook() { glKosFinishList(); - //pvr_list_finish(); } void tiki_scene_begin_trans_hook() { - //pvr_list_begin(PVR_LIST_TR_POLY); } void tiki_scene_finish_trans_hook() { glKosFinishList(); - //pvr_list_finish(); } } Modified: tiki/include/Tiki/drawables/cursor.h =================================================================== --- tiki/include/Tiki/drawables/cursor.h 2006-06-15 16:50:57 UTC (rev 345) +++ tiki/include/Tiki/drawables/cursor.h 2006-07-05 22:01:53 UTC (rev 346) @@ -10,6 +10,7 @@ #define __TIKI_DRW_CURSOR_H #include "Tiki/drawable.h" +#include "Tiki/hid.h" namespace Tiki { namespace GL { Modified: tiki/include/Tiki/genmenu.h =================================================================== --- tiki/include/Tiki/genmenu.h 2006-06-15 16:50:57 UTC (rev 345) +++ tiki/include/Tiki/genmenu.h 2006-07-05 22:01:53 UTC (rev 346) @@ -13,7 +13,7 @@ #include "Tiki/refcnt.h" #include "Tiki/drawables/layer.h" #include "Tiki/hid.h" -#include "Tiki/eventCollector.h" +#include "Tiki/eventcollector.h" #include "Tiki/oggvorbis.h" /* Modified: tiki/src/gl/drawables/console.cpp =================================================================== --- tiki/src/gl/drawables/console.cpp 2006-06-15 16:50:57 UTC (rev 345) +++ tiki/src/gl/drawables/console.cpp 2006-07-05 22:01:53 UTC (rev 346) @@ -124,7 +124,7 @@ vsprintf(buf,fmt,args); va_end(args); - for(int i=0; i<strlen(buf); i++) { + for(size_t i=0; i<strlen(buf); i++) { if(m_cursor_x >= m_cols && m_autoWrap) { m_cursor_y++; m_cursor_x = 0; @@ -494,4 +494,4 @@ // printf("Bogus ANSI: %s\n", ansistr); // } ansiptr = 0; -} \ No newline at end of file +} Modified: tiki/src/gl/drawables/pointerArrow.cpp =================================================================== --- tiki/src/gl/drawables/pointerArrow.cpp 2006-06-15 16:50:57 UTC (rev 345) +++ tiki/src/gl/drawables/pointerArrow.cpp 2006-07-05 22:01:53 UTC (rev 346) @@ -65,4 +65,4 @@ vert.y = tv.y+21; plx_prim(&vert, sizeof(vert)); } -} \ No newline at end of file +} Modified: tiki/src/gl/font.cpp =================================================================== --- tiki/src/gl/font.cpp 2006-06-15 16:50:57 UTC (rev 345) +++ tiki/src/gl/font.cpp 2006-07-05 22:01:53 UTC (rev 346) @@ -254,10 +254,10 @@ void * txrptr = m_fnt.txr->canvasLock(); auto_ptr<uint8> bmtmpfree; - uint8 * bmtmp; - uint32 bmsize; + uint8 * bmtmp = NULL; + int bmsize; auto_ptr<uint16> txrtmpfree; - uint16 * txrtmp; + uint16 * txrtmp = NULL; int stride; /* What format are we using? */ Modified: tiki/src/gl/plxcompat.cpp =================================================================== --- tiki/src/gl/plxcompat.cpp 2006-06-15 16:50:57 UTC (rev 345) +++ tiki/src/gl/plxcompat.cpp 2006-07-05 22:01:53 UTC (rev 346) @@ -22,7 +22,9 @@ using namespace Tiki::GL::Plxcompat; using namespace Tiki::Math; +#ifndef assert_msg #define assert_msg(x, y) assert(x) +#endif //////////////////////////////////////////////////////////////////// @@ -481,9 +483,10 @@ ////////////////////////////////////////////////////////////////////////////////// + +/* static float zscale = 1000.0f; - -/* static int stripping = 0; +static int stripping = 0; void Plxcompat::plx_prim(plx_vertex_t * vert, int size) { if (!stripping) glBegin(GL_TRIANGLE_STRIP); Modified: tiki/src/gl/texture.cpp =================================================================== --- tiki/src/gl/texture.cpp 2006-06-15 16:50:57 UTC (rev 345) +++ tiki/src/gl/texture.cpp 2006-07-05 22:01:53 UTC (rev 346) @@ -254,8 +254,11 @@ m_ptr = new uint8[m_w * m_h * 3]; break; case RGBA8888: + case ARGB8888: m_ptr = new uint8[m_w * m_h * 4]; break; + default: + return false; } // We'll write the converted data into this buffer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <at...@us...> - 2006-06-15 16:56:56
|
Revision: 345 Author: atani Date: 2006-06-15 09:50:57 -0700 (Thu, 15 Jun 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=345&view=rev Log Message: ----------- initial port to GP2x, makes use of Vincent OGL-ES library. What should work: basic OpenGL, threading Still to be done: input sound Next step will be todo some testing on the real device once I find someone with one who is willing to test things Added Paths: ----------- tiki/gp2x/ tiki/gp2x/Makefile tiki/gp2x/Makefile.rules tiki/gp2x/include/ tiki/gp2x/include/GLES/ tiki/gp2x/include/GLES/egl.h tiki/gp2x/include/GLES/egltypes.h tiki/gp2x/include/GLES/gl.h tiki/gp2x/include/GLES/glext.h tiki/gp2x/include/Tiki/ tiki/gp2x/include/Tiki/glhdrs.h tiki/gp2x/include/Tiki/platthread.h tiki/gp2x/include/Tiki/tikitypes.h tiki/gp2x/include/machine/ tiki/gp2x/include/machine/endian.h tiki/gp2x/include/minimal.h tiki/gp2x/include/minimal_940t.h tiki/gp2x/include/pch.h tiki/gp2x/include/sys/ tiki/gp2x/include/sys/queue.h tiki/gp2x/lib/ tiki/gp2x/lib/gles-license.txt tiki/gp2x/lib/libcodegen.a tiki/gp2x/lib/libgles_cm.a tiki/gp2x/src/ tiki/gp2x/src/Makefile tiki/gp2x/src/init_shutdown.cpp tiki/gp2x/src/platgl.cpp tiki/gp2x/src/plathid.cpp tiki/gp2x/src/platthread.cpp tiki/gp2x/src/rlyeh-minimal.cpp tiki/gp2x/src/tikitime.cpp Added: tiki/gp2x/Makefile =================================================================== --- tiki/gp2x/Makefile (rev 0) +++ tiki/gp2x/Makefile 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,57 @@ + +BASE_AUDIO_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/*.cpp)) +BASE_AUDIO_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/audio/oggvorbis/*.cpp)) +BASE_BASE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/base/*.cpp)) +BASE_GL_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/anims/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/drawables/*.cpp)) +BASE_GL_OBJ+=$(patsubst %.cpp,%.o,$(wildcard ../src/gl/triggers/*.cpp)) +BASE_HID_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/hid/*.cpp)) +BASE_IMAGE_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/image/*.cpp)) +BASE_MATH_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/math/*.cpp)) +BASE_THREAD_OBJ=$(patsubst %.cpp,%.o,$(wildcard ../src/thread/*.cpp)) + +JPEG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libjpeg/*.c)) +PNG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libpng/*.c)) +ZLIB_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/zlib/*.c)) +OGG_OBJ=$(patsubst %.c,%.o,$(wildcard ../3rdparty/libogg/src/*.c)) +VORBIS_OBJ=../3rdparty/libvorbis/lib/analysis.o \ + ../3rdparty/libvorbis/lib/bitrate.o \ + ../3rdparty/libvorbis/lib/block.o \ + ../3rdparty/libvorbis/lib/codebook.o \ + ../3rdparty/libvorbis/lib/envelope.o \ + ../3rdparty/libvorbis/lib/floor0.o \ + ../3rdparty/libvorbis/lib/floor1.o \ + ../3rdparty/libvorbis/lib/info.o \ + ../3rdparty/libvorbis/lib/lookup.o \ + ../3rdparty/libvorbis/lib/lpc.o \ + ../3rdparty/libvorbis/lib/lsp.o \ + ../3rdparty/libvorbis/lib/mapping0.o \ + ../3rdparty/libvorbis/lib/mdct.o \ + ../3rdparty/libvorbis/lib/psy.o \ + ../3rdparty/libvorbis/lib/registry.o \ + ../3rdparty/libvorbis/lib/res0.o \ + ../3rdparty/libvorbis/lib/sharedbook.o \ + ../3rdparty/libvorbis/lib/smallft.o \ + ../3rdparty/libvorbis/lib/synthesis.o \ + ../3rdparty/libvorbis/lib/vorbisfile.o \ + ../3rdparty/libvorbis/lib/window.o + +BASE_OBJS = $(BASE_AUDIO_OBJ) $(BASE_BASE_OBJ) $(BASE_GL_OBJ) \ + $(BASE_HID_OBJ) $(BASE_IMAGE_OBJ) $(BASE_MATH_OBJ) \ + $(BASE_THREAD_OBJ) + +THIRD_PARTY_OBJS = $(JPEG_OBJ) $(OGG_OBJ) $(VORBIS_OBJ) $(PNG_OBJ) $(ZLIB_OBJ) + +CFLAGS=-I../include -I$(CURDIR)/include -g +CFLAGS+=-I../3rdparty/libogg/include -I../3rdparty/libvorbis/include -I../3rdparty/libvorbis/lib + +SUBDIRS=src + +all: subdirs $(BASE_OBJS) $(THIRD_PARTY_OBJS) + $(AR) ru libtiki.a $(BASE_OBJS) $(THIRD_PARTY_OBJS) + +clean: clean_subdirs + -rm -f $(BASE_OBJS) libtiki.a + +include Makefile.rules Property changes on: tiki/gp2x/Makefile ___________________________________________________________________ Name: svn:executable + * Added: tiki/gp2x/Makefile.rules =================================================================== --- tiki/gp2x/Makefile.rules (rev 0) +++ tiki/gp2x/Makefile.rules 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,23 @@ +%.o: %.c + @echo "Compiling $< to $@" + @gcc $(CFLAGS) -c $< -o $@ + +%.o: %.cc + @echo "Compiling $< to $@" + @g++ $(CFLAGS) $(CXXFLAGS) -c $< -o $@ + +%.o: %.cpp + @echo "Compiling $< to $@" + @g++ $(CFLAGS) $(CXXFLAGS) -c $< -o $@ + +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 + +TIKI_BASE_LIBS=-ltiki -lcodegen -lgles_cm Property changes on: tiki/gp2x/Makefile.rules ___________________________________________________________________ Name: svn:executable + * Added: tiki/gp2x/include/GLES/egl.h =================================================================== --- tiki/gp2x/include/GLES/egl.h (rev 0) +++ tiki/gp2x/include/GLES/egl.h 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,265 @@ +#ifndef __egl_h_ +#define __egl_h_ + +/* +** Copyright 2002-2003 Promoters of the Khronos Group (3Dlabs, ARM Ltd., +** ATI Technologies, Inc., Discreet, Ericsson Mobile, Imagination +** Technologies Group plc, Motorola, Inc., Nokia, Silicon Graphics, Inc., +** SK Telecom, and Sun Microsystems). +** +** This document is protected by copyright, and contains information +** proprietary to The Khronos Group. Any copying, adaptation, distribution, +** public performance, or public display of this document without the +** express written consent of the copyright holders is strictly prohibited. +** The receipt or possession of this document does not convey any rights to +** reproduce, disclose, or distribute its contents, or to manufacture, use, +** or sell anything that it may describe, in whole or in part. +*/ + +#include <GLES/gl.h> +#include <GLES/egltypes.h> + + +/* +** Versioning and extensions +*/ +#define EGL_VERSION_1_0 1 +#define EGL_VERSION_1_1 1 + +/* +** Boolean +*/ +#define EGL_FALSE 0 +#define EGL_TRUE 1 + +/* +** Errors +*/ +#define EGL_SUCCESS 0x3000 +#define EGL_NOT_INITIALIZED 0x3001 +#define EGL_BAD_ACCESS 0x3002 +#define EGL_BAD_ALLOC 0x3003 +#define EGL_BAD_ATTRIBUTE 0x3004 +#define EGL_BAD_CONFIG 0x3005 +#define EGL_BAD_CONTEXT 0x3006 +#define EGL_BAD_CURRENT_SURFACE 0x3007 +#define EGL_BAD_DISPLAY 0x3008 +#define EGL_BAD_MATCH 0x3009 +#define EGL_BAD_NATIVE_PIXMAP 0x300A +#define EGL_BAD_NATIVE_WINDOW 0x300B +#define EGL_BAD_PARAMETER 0x300C +#define EGL_BAD_SURFACE 0x300D +#define EGL_CONTEXT_LOST 0x300E +/* 0x300F - 0x301F reserved for additional errors. */ + +/* +** Config attributes +*/ +#define EGL_BUFFER_SIZE 0x3020 +#define EGL_ALPHA_SIZE 0x3021 +#define EGL_BLUE_SIZE 0x3022 +#define EGL_GREEN_SIZE 0x3023 +#define EGL_RED_SIZE 0x3024 +#define EGL_DEPTH_SIZE 0x3025 +#define EGL_STENCIL_SIZE 0x3026 +#define EGL_CONFIG_CAVEAT 0x3027 +#define EGL_CONFIG_ID 0x3028 +#define EGL_LEVEL 0x3029 +#define EGL_MAX_PBUFFER_HEIGHT 0x302A +#define EGL_MAX_PBUFFER_PIXELS 0x302B +#define EGL_MAX_PBUFFER_WIDTH 0x302C +#define EGL_NATIVE_RENDERABLE 0x302D +#define EGL_NATIVE_VISUAL_ID 0x302E +#define EGL_NATIVE_VISUAL_TYPE 0x302F +/*#define EGL_PRESERVED_RESOURCES 0x3030*/ +#define EGL_SAMPLES 0x3031 +#define EGL_SAMPLE_BUFFERS 0x3032 +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_TRANSPARENT_TYPE 0x3034 +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 +#define EGL_TRANSPARENT_RED_VALUE 0x3037 +#define EGL_NONE 0x3038 /* Also a config value */ +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C + +/* +** Config values +*/ +#define EGL_DONT_CARE ((EGLint) -1) + +#define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ +#define EGL_NON_CONFORMANT_CONFIG 0x3051 /* " */ +#define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ +#define EGL_NO_TEXTURE 0x305C /* EGL_TEXTURE_FORMAT/TARGET value */ +#define EGL_TEXTURE_RGB 0x305D /* EGL_TEXTURE_FORMAT value */ +#define EGL_TEXTURE_RGBA 0x305E /* " */ +#define EGL_TEXTURE_2D 0x305F /* EGL_TEXTURE_TARGET value */ + +/* +** Config attribute mask bits +*/ +#define EGL_PBUFFER_BIT 0x01 /* EGL_SURFACE_TYPE mask bit */ +#define EGL_PIXMAP_BIT 0x02 /* " */ +#define EGL_WINDOW_BIT 0x04 /* " */ + +/* +** String names +*/ +#define EGL_VENDOR 0x3053 /* eglQueryString target */ +#define EGL_VERSION 0x3054 /* " */ +#define EGL_EXTENSIONS 0x3055 /* " */ + +/* +** Surface attributes +*/ +#define EGL_HEIGHT 0x3056 +#define EGL_WIDTH 0x3057 +#define EGL_LARGEST_PBUFFER 0x3058 +#define EGL_TEXTURE_FORMAT 0x3080 /* For pbuffers bound as textures */ +#define EGL_TEXTURE_TARGET 0x3081 /* " */ +#define EGL_MIPMAP_TEXTURE 0x3082 /* " */ +#define EGL_MIPMAP_LEVEL 0x3083 /* " */ + +/* +** BindTexImage / ReleaseTexImage buffer target +*/ +#define EGL_BACK_BUFFER 0x3084 + +/* +** Current surfaces +*/ +#define EGL_DRAW 0x3059 +#define EGL_READ 0x305A + +/* +** Engines +*/ +#define EGL_CORE_NATIVE_ENGINE 0x305B + +/* 0x305C-0x3FFFF reserved for future use */ + +/* +** Functions +*/ +#ifdef __cplusplus +extern "C" { +#endif + +GLAPI EGLint APIENTRY eglGetError (void); + +GLAPI EGLDisplay APIENTRY eglGetDisplay (NativeDisplayType display); +GLAPI EGLBoolean APIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); +GLAPI EGLBoolean APIENTRY eglTerminate (EGLDisplay dpy); +GLAPI const char * APIENTRY eglQueryString (EGLDisplay dpy, EGLint name); +GLAPI void (APIENTRY * eglGetProcAddress (const char *procname))(); + +GLAPI EGLBoolean APIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); +GLAPI EGLBoolean APIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); +GLAPI EGLBoolean APIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); + +GLAPI EGLSurface APIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list); +GLAPI EGLSurface APIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list); +GLAPI EGLSurface APIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +GLAPI EGLBoolean APIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); +GLAPI EGLBoolean APIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); + +/* EGL 1.1 render-to-texture APIs */ +GLAPI EGLBoolean APIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); +GLAPI EGLBoolean APIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); +GLAPI EGLBoolean APIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); + +/* EGL 1.1 swap control API */ +GLAPI EGLBoolean APIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval); + +GLAPI EGLContext APIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list); +GLAPI EGLBoolean APIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); +GLAPI EGLBoolean APIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); +GLAPI EGLContext APIENTRY eglGetCurrentContext (void); +GLAPI EGLSurface APIENTRY eglGetCurrentSurface (EGLint readdraw); +GLAPI EGLDisplay APIENTRY eglGetCurrentDisplay (void); +GLAPI EGLBoolean APIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); + +GLAPI EGLBoolean APIENTRY eglWaitGL (void); +GLAPI EGLBoolean APIENTRY eglWaitNative (EGLint engine); +GLAPI EGLBoolean APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface draw); +GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target); + +#ifdef __cplusplus +} +#endif + +#endif /* ___egl_h_ */ + + + +/* usage + + // ---------------------------------------------------------------------- + // Initialization + // ---------------------------------------------------------------------- + + HDC hdc = GetDC(0); // the screen or window device context, for example + + EGLDisplay display = eglGetDisplay(hdc); + + EGLint major, minor; + + if (!eglInitialize(display, &major, &minor)) { + // could not initialize display + } + + EGLConfig configs[10]; + EGLint matchingConfigs; + EGLint attribList[] = { 0 }; // extend this + + if (!eglChooseConfig(display, attribList, &configs, 10, &matchingConfigs)) { + // could not choose config + } + + if (matchingConfigs < 1) { + // did not find a suitable configuration + } + + EGLConfig config = configs[0]; // pick any + + EGLSurface surface = eglCreatePbufferSurface(display, config, attribList); + + // test for error + + EGLContext context = eglCreateContext(display, config, 0, attribList); + + // test for error + + // ---------------------------------------------------------------------- + // Rendering Loop + // ---------------------------------------------------------------------- + + eglMakeCurrent(display, surface, surface, context); + + // actual GL rendering goes here + + eglWait(); + eglSwapBuffers(display, surface); + + // ---------------------------------------------------------------------- + // Cleanup + // ---------------------------------------------------------------------- + + + if (!eglDestoyContext(display, context)) { + // error deallocating context + } + + if (!eglDestroySurface(display, surface)) { + // error deallocating surface + } + + if (!eglTerminate(display)) { + // error while cleaning up display + } + + +*/ Added: tiki/gp2x/include/GLES/egltypes.h =================================================================== --- tiki/gp2x/include/GLES/egltypes.h (rev 0) +++ tiki/gp2x/include/GLES/egltypes.h 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,100 @@ +#ifndef __egl_types_h_ +#define __egl_types_h_ + +/* +** egltypes.h is platform dependent. It defines: +** +** - EGL types and resources +** - Native types +** - EGL and native handle values +** +** EGL types and resources are to be typedef'ed with appropriate platform +** dependent resource handle types. EGLint must be an integer of at least +** 32-bit. +** +** NativeDisplayType, NativeWindowType and NativePixmapType are to be +** replaced with corresponding types of the native window system in egl.h. +** +** EGL and native handle values must match their types. +*/ + +#if (defined(WIN32) || defined(_WIN32_WCE)) + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif + +// Windows Header Files: +#include <windows.h> + +typedef HDC NativeDisplayType; +typedef HWND NativeWindowType; +typedef HBITMAP NativePixmapType; + +#define EGL_DEFAULT_DISPLAY GetDC(0) + +#elif defined(__SYMBIAN32__) + +#include <e32def.h> + +class RWindow; +class CWindowGc; +class CFbsBitmap; + +typedef CWindowGc * NativeDisplayType; +typedef RWindow * NativeWindowType; +typedef CFbsBitmap * NativePixmapType; + +#define EGL_DEFAULT_DISPLAY ((NativeDisplayType) 0) + +#elif defined(__gnu_linux__) + +typedef void * NativeDisplayType; +typedef void * NativeWindowType; +typedef void * NativePixmapType; + +#define EGL_DEFAULT_DISPLAY ((NativeDisplayType) 0) + +#else + +# error "Unsupported Operating System" + +#endif + +#ifdef __cplusplus + +namespace EGL { + class Context; + class Config; + class Surface; +} + +typedef const EGL::Config * EGLConfig; +typedef EGL::Surface * EGLSurface; +typedef EGL::Context * EGLContext; + +#else + +typedef void * EGLConfig; +typedef void * EGLSurface; +typedef void * EGLContext; + +#endif + + +/* +** Types and resources +*/ +typedef int EGLBoolean; +typedef int EGLint; +typedef void * EGLDisplay; + +/* +** EGL and native handle values +*/ +#define EGL_NO_CONTEXT ((EGLContext)0) +#define EGL_NO_DISPLAY ((EGLDisplay)0) +#define EGL_NO_SURFACE ((EGLSurface)0) + + +#endif //ndef __egl_types_h_ Added: tiki/gp2x/include/GLES/gl.h =================================================================== --- tiki/gp2x/include/GLES/gl.h (rev 0) +++ tiki/gp2x/include/GLES/gl.h 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,861 @@ +#ifndef __gl_h_ +#define __gl_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** License Applicability. Except to the extent portions of this file are +** made subject to an alternative license as permitted in the SGI Free +** Software License B, Version 1.0 (the "License"), the contents of this +** file are subject only to the provisions of the License. You may not use +** this file except in compliance with the License. You may obtain a copy +** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 +** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: +** +** http://oss.sgi.com/projects/FreeB +** +** Note that, as provided in the License, the Software is distributed on an +** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS +** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND +** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A +** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. +** +** Original Code. The Original Code is: OpenGL Sample Implementation, +** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, +** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. +** Copyright in any portions created by third parties is as indicated +** elsewhere herein. All Rights Reserved. +** +** Additional Notice Provisions: The application programming interfaces +** established by SGI in conjunction with the Original Code are The +** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released +** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version +** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X +** Window System(R) (Version 1.3), released October 19, 1998. This software +** was created using the OpenGL(R) version 1.2.1 Sample Implementation +** published by SGI, but has not been independently verified as being +** compliant with the OpenGL(R) version 1.2.1 Specification. +*/ + +#if defined(__SYMBIAN32__) + +# include <e32def.h> + +#elif (defined(WIN32) || defined(_WIN32_WCE)) /*&& !defined(APIENTRY) && !defined(__CYGWIN__)*/ + +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +# endif + +# include <windows.h> + +#elif defined(__gnu_linux__) + +# define GLAPI + +# ifdef APIENTRY +# undef APIENTRY +# endif + +#else + +# error "Unsupported Operating System" + +#endif + + +#ifndef APIENTRY +#define APIENTRY +#endif + +#ifndef GLAPI + #ifdef OGLES_EXPORTS + #define GLAPI __declspec(dllexport) + #else + #define GLAPI __declspec(dllimport) + #endif +#endif + +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef signed char GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef unsigned char GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef float GLfloat; +typedef float GLclampf; +typedef void GLvoid; +typedef int GLintptr; +typedef int GLsizeiptr; +typedef int GLfixed; +typedef int GLclampx; +/* Internal convenience typedefs */ +typedef void (*_GLfuncptr)(); + +/*************************************************************/ + +/* OpenGL ES core versions */ +#define GL_OES_VERSION_1_0 1 +#define GL_OES_VERSION_1_1 1 + +/* Extensions */ +#define GL_OES_compressed_paletted_texture 1 +/*#define GL_OES_draw_texture 1*/ +#define GL_OES_matrix_get 1 +/*#define GL_OES_matrix_palette 1*/ +#define GL_OES_point_size_array 1 +#define GL_OES_point_sprite 1 +#define GL_OES_read_format 1 + +/* ClearBufferMask */ +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 + +/* Boolean */ +#define GL_FALSE 0 +#define GL_TRUE 1 + +/* BeginMode */ +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 + +/* AlphaFunction */ +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 + +/* BlendingFactorDest */ +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + +/* ClipPlaneName */ +#define GL_CLIP_PLANE0 0x3000 +#define GL_CLIP_PLANE1 0x3001 +#define GL_CLIP_PLANE2 0x3002 +#define GL_CLIP_PLANE3 0x3003 +#define GL_CLIP_PLANE4 0x3004 +#define GL_CLIP_PLANE5 0x3005 + +/* ColorMaterialFace */ +/* GL_FRONT_AND_BACK */ + +/* ColorMaterialParameter */ +/* GL_AMBIENT_AND_DIFFUSE */ + +/* ColorPointerType */ +/* GL_UNSIGNED_BYTE */ +/* GL_FLOAT */ +/* GL_FIXED */ + +/* CullFaceMode */ +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* EnableCap */ +#define GL_FOG 0x0B60 +#define GL_LIGHTING 0x0B50 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_ALPHA_TEST 0x0BC0 +#define GL_BLEND 0x0BE2 +#define GL_COLOR_LOGIC_OP 0x0BF2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +/* GL_LIGHT0 */ +/* GL_LIGHT1 */ +/* GL_LIGHT2 */ +/* GL_LIGHT3 */ +/* GL_LIGHT4 */ +/* GL_LIGHT5 */ +/* GL_LIGHT6 */ +/* GL_LIGHT7 */ +#define GL_POINT_SMOOTH 0x0B10 +#define GL_LINE_SMOOTH 0x0B20 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_MATERIAL 0x0B57 +#define GL_NORMALIZE 0x0BA1 +#define GL_RESCALE_NORMAL 0x803A +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_VERTEX_ARRAY 0x8074 +#define GL_NORMAL_ARRAY 0x8075 +#define GL_COLOR_ARRAY 0x8076 +#define GL_TEXTURE_COORD_ARRAY 0x8078 +#define GL_MULTISAMPLE 0x809D +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_ALPHA_TO_ONE 0x809F +#define GL_SAMPLE_COVERAGE 0x80A0 + +/* ErrorCode */ +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_STACK_OVERFLOW 0x0503 +#define GL_STACK_UNDERFLOW 0x0504 +#define GL_OUT_OF_MEMORY 0x0505 + +/* FogMode */ +/* GL_LINEAR */ +#define GL_EXP 0x0800 +#define GL_EXP2 0x0801 + +/* FogParameter */ +#define GL_FOG_DENSITY 0x0B62 +#define GL_FOG_START 0x0B63 +#define GL_FOG_END 0x0B64 +#define GL_FOG_MODE 0x0B65 +#define GL_FOG_COLOR 0x0B66 + +/* FrontFaceDirection */ +#define GL_CW 0x0900 +#define GL_CCW 0x0901 + +/* GetPName */ +#define GL_CURRENT_COLOR 0x0B00 +#define GL_CURRENT_NORMAL 0x0B02 +#define GL_CURRENT_TEXTURE_COORDS 0x0B03 +#define GL_POINT_SIZE 0x0B11 +#define GL_POINT_SIZE_MIN 0x8126 +#define GL_POINT_SIZE_MAX 0x8127 +#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 +#define GL_POINT_DISTANCE_ATTENUATION 0x8129 +#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 +#define GL_LINE_WIDTH 0x0B21 +#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_SHADE_MODEL 0x0B54 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_MATRIX_MODE 0x0BA0 +#define GL_VIEWPORT 0x0BA2 +#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 +#define GL_PROJECTION_STACK_DEPTH 0x0BA4 +#define GL_TEXTURE_STACK_DEPTH 0x0BA5 +#define GL_MODELVIEW_MATRIX 0x0BA6 +#define GL_PROJECTION_MATRIX 0x0BA7 +#define GL_TEXTURE_MATRIX 0x0BA8 +#define GL_ALPHA_TEST_FUNC 0x0BC1 +#define GL_ALPHA_TEST_REF 0x0BC2 +#define GL_BLEND_DST 0x0BE0 +#define GL_BLEND_SRC 0x0BE1 +#define GL_LOGIC_OP_MODE 0x0BF0 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_LIGHTS 0x0D31 +#define GL_MAX_CLIP_PLANES 0x0D32 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 +#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 +#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MAX_ELEMENTS_VERTICES 0x80E8 +#define GL_MAX_ELEMENTS_INDICES 0x80E9 +#define GL_MAX_TEXTURE_UNITS 0x84E2 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_VERTEX_ARRAY_SIZE 0x807A +#define GL_VERTEX_ARRAY_TYPE 0x807B +#define GL_VERTEX_ARRAY_STRIDE 0x807C +#define GL_NORMAL_ARRAY_TYPE 0x807E +#define GL_NORMAL_ARRAY_STRIDE 0x807F +#define GL_COLOR_ARRAY_SIZE 0x8081 +#define GL_COLOR_ARRAY_TYPE 0x8082 +#define GL_COLOR_ARRAY_STRIDE 0x8083 +#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 +#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 +#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A +#define GL_VERTEX_ARRAY_POINTER 0x808E +#define GL_NORMAL_ARRAY_POINTER 0x808F +#define GL_COLOR_ARRAY_POINTER 0x8090 +#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB + +/* GetTextureParameter */ +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ + +#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 + +/* OES_matrix_get */ +#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS 0x898D +#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS 0x898E +#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS 0x898F + +/* HintMode */ +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 + +/* HintTarget */ +#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 +#define GL_POINT_SMOOTH_HINT 0x0C51 +#define GL_LINE_SMOOTH_HINT 0x0C52 +#define GL_POLYGON_SMOOTH_HINT 0x0C53 +#define GL_FOG_HINT 0x0C54 +#define GL_GENERATE_MIPMAP_HINT 0x8192 + +/* LightModelParameter */ +#define GL_LIGHT_MODEL_AMBIENT 0x0B53 +#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 + +/* LightParameter */ +#define GL_AMBIENT 0x1200 +#define GL_DIFFUSE 0x1201 +#define GL_SPECULAR 0x1202 +#define GL_POSITION 0x1203 +#define GL_SPOT_DIRECTION 0x1204 +#define GL_SPOT_EXPONENT 0x1205 +#define GL_SPOT_CUTOFF 0x1206 +#define GL_CONSTANT_ATTENUATION 0x1207 +#define GL_LINEAR_ATTENUATION 0x1208 +#define GL_QUADRATIC_ATTENUATION 0x1209 + +/* DataType */ +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C + +/* LogicOp */ +#define GL_CLEAR 0x1500 +#define GL_AND 0x1501 +#define GL_AND_REVERSE 0x1502 +#define GL_COPY 0x1503 +#define GL_AND_INVERTED 0x1504 +#define GL_NOOP 0x1505 +#define GL_XOR 0x1506 +#define GL_OR 0x1507 +#define GL_NOR 0x1508 +#define GL_EQUIV 0x1509 +#define GL_INVERT 0x150A +#define GL_OR_REVERSE 0x150B +#define GL_COPY_INVERTED 0x150C +#define GL_OR_INVERTED 0x150D +#define GL_NAND 0x150E +#define GL_SET 0x150F + +/* MaterialFace */ +/* GL_FRONT_AND_BACK */ + +/* MaterialParameter */ +#define GL_EMISSION 0x1600 +#define GL_SHININESS 0x1601 +#define GL_AMBIENT_AND_DIFFUSE 0x1602 +/* GL_AMBIENT */ +/* GL_DIFFUSE */ +/* GL_SPECULAR */ + +/* MatrixMode */ +#define GL_MODELVIEW 0x1700 +#define GL_PROJECTION 0x1701 +#define GL_TEXTURE 0x1702 + +/* NormalPointerType */ +/* GL_BYTE */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ + +/* PixelFormat */ +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A + +/* PixelStoreParameter */ +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 + +/* PixelType */ +/* GL_UNSIGNED_BYTE */ +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 + +/* ShadingModel */ +#define GL_FLAT 0x1D00 +#define GL_SMOOTH 0x1D01 + +/* StencilFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* StencilOp */ +/* GL_ZERO */ +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +/* GL_INVERT */ + +/* StringName */ +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 + +/* TexCoordPointerType */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ +/* GL_BYTE */ + +/* TextureEnvMode */ +#define GL_MODULATE 0x2100 +#define GL_DECAL 0x2101 +/* GL_BLEND */ +#define GL_ADD 0x0104 +/* GL_REPLACE */ + +/* TextureEnvParameter */ +#define GL_TEXTURE_ENV_MODE 0x2200 +#define GL_TEXTURE_ENV_COLOR 0x2201 + +/* TextureEnvTarget */ +#define GL_TEXTURE_ENV 0x2300 + +/* TextureMagFilter */ +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 + +/* TextureMinFilter */ +/* GL_NEAREST */ +/* GL_LINEAR */ +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* TextureParameterName */ +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_GENERATE_MIPMAP 0x8191 + +/* TextureTarget */ +/* GL_TEXTURE_2D */ + +/* TextureUnit */ +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 + +/* TextureWrapMode */ +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F + +/* PixelInternalFormat */ +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 + +/* VertexPointerType */ +/* GL_SHORT */ +/* GL_FLOAT */ +/* GL_FIXED */ +/* GL_BYTE */ + +/* LightName */ +#define GL_LIGHT0 0x4000 +#define GL_LIGHT1 0x4001 +#define GL_LIGHT2 0x4002 +#define GL_LIGHT3 0x4003 +#define GL_LIGHT4 0x4004 +#define GL_LIGHT5 0x4005 +#define GL_LIGHT6 0x4006 +#define GL_LIGHT7 0x4007 + +/* Buffer Objects */ +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 + +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 +#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 +#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 +#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A + +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 + +#define GL_WRITE_ONLY 0x88B9 + +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_BUFFER_ACCESS 0x88BB + + +/* Texture combine + dot3 */ +#define GL_SUBTRACT 0x84E7 +#define GL_COMBINE 0x8570 +#define GL_COMBINE_RGB 0x8571 +#define GL_COMBINE_ALPHA 0x8572 +#define GL_RGB_SCALE 0x8573 +#define GL_ADD_SIGNED 0x8574 +#define GL_INTERPOLATE 0x8575 +#define GL_CONSTANT 0x8576 +#define GL_PRIMARY_COLOR 0x8577 +#define GL_PREVIOUS 0x8578 +#define GL_OPERAND0_RGB 0x8590 +#define GL_OPERAND1_RGB 0x8591 +#define GL_OPERAND2_RGB 0x8592 +#define GL_OPERAND0_ALPHA 0x8598 +#define GL_OPERAND1_ALPHA 0x8599 +#define GL_OPERAND2_ALPHA 0x859A + +#define GL_ALPHA_SCALE 0x0D1C + +#define GL_SRC0_RGB 0x8580 +#define GL_SRC1_RGB 0x8581 +#define GL_SRC2_RGB 0x8582 +#define GL_SRC0_ALPHA 0x8588 +#define GL_SRC1_ALPHA 0x8589 +#define GL_SRC2_ALPHA 0x858A + +#define GL_DOT3_RGB 0x86AE +#define GL_DOT3_RGBA 0x86AF + +/*****************************************************************************************/ +/* OES extension functions */ +/*****************************************************************************************/ +/* OES_point_sprite */ +#define GL_POINT_SPRITE_OES 0x8861 +#define GL_COORD_REPLACE_OES 0x8862 + +/* OES_point_size_array */ +#define GL_POINT_SIZE_ARRAY_OES 0x8B9C +#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A +#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B +#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C +#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F + +/* OES_matrix_palette */ +#define GL_MAX_VERTEX_UNITS_OES 0x86A4 +#define GL_MAX_PALETTE_MATRICES_OES 0x8842 +#define GL_MATRIX_PALETTE_OES 0x8840 +#define GL_MATRIX_INDEX_ARRAY_OES 0x8844 +#define GL_WEIGHT_ARRAY_OES 0x86AD + +#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846 +#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847 +#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848 +#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849 +#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E + +#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB +#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9 +#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA +#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC +#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E + +/* OES_draw_texture */ +#define GL_TEXTURE_CROP_RECT_OES 0x8B9D + +/*************************************************************/ + +GLAPI void APIENTRY glActiveTexture (GLenum texture); +GLAPI void APIENTRY glAlphaFunc (GLenum func, GLclampf ref); +GLAPI void APIENTRY glAlphaFuncx (GLenum func, GLclampx ref); +GLAPI void APIENTRY glBindBuffer(GLenum target, GLuint buffer); +GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture); +GLAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GLAPI void APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +GLAPI void APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +GLAPI void APIENTRY glClear (GLbitfield mask); +GLAPI void APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GLAPI void APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +GLAPI void APIENTRY glClearDepthf (GLclampf depth); +GLAPI void APIENTRY glClearDepthx (GLclampx depth); +GLAPI void APIENTRY glClearStencil (GLint s); +GLAPI void APIENTRY glClientActiveTexture (GLenum texture); +GLAPI void APIENTRY glClipPlanex(GLenum plane, const GLfixed *equation); +GLAPI void APIENTRY glClipPlanef(GLenum plane, const GLfloat *equation); +GLAPI void APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GLAPI void APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +GLAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GLAPI void APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +GLAPI void APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GLAPI void APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glCullFace (GLenum mode); +GLAPI void APIENTRY glDeleteBuffers(GLsizei n, const GLuint *buffers); +GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GLAPI void APIENTRY glDepthFunc (GLenum func); +GLAPI void APIENTRY glDepthMask (GLboolean flag); +GLAPI void APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); +GLAPI void APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar); +GLAPI void APIENTRY glDisable (GLenum cap); +GLAPI void APIENTRY glDisableClientState (GLenum array); +GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +GLAPI void APIENTRY glEnable (GLenum cap); +GLAPI void APIENTRY glEnableClientState (GLenum array); +GLAPI void APIENTRY glFinish (void); +GLAPI void APIENTRY glFlush (void); +GLAPI void APIENTRY glFogf (GLenum pname, GLfloat param); +GLAPI void APIENTRY glFogfv (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glFogx (GLenum pname, GLfixed param); +GLAPI void APIENTRY glFogxv (GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glFrontFace (GLenum mode); +GLAPI void APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GLAPI void APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GLAPI void APIENTRY glGetBooleanv(GLenum pname, GLboolean *params); +GLAPI void APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetClipPlanef(GLenum pname, GLfloat eqn[4]); +GLAPI void APIENTRY glGetClipPlanex(GLenum pname, GLfixed eqn[4]); +GLAPI void APIENTRY glGenBuffers(GLsizei n, GLuint *buffers); +GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures); +GLAPI GLenum APIENTRY glGetError (void); +GLAPI void APIENTRY glGetFixedv(GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetFloatv(GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *params); +GLAPI void APIENTRY glGetLightfv(GLenum light, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetLightxv(GLenum light, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetPointerv(GLenum pname, void **params); +GLAPI const GLubyte * APIENTRY glGetString (GLenum name); +GLAPI void APIENTRY glGetTexEnviv(GLenum env, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint *params); +GLAPI void APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params); +GLAPI void APIENTRY glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params); +GLAPI void APIENTRY glHint (GLenum target, GLenum mode); +GLAPI GLboolean APIENTRY glIsBuffer(GLuint buffer); +GLAPI GLboolean APIENTRY glIsEnabled(GLenum cap); +GLAPI GLboolean APIENTRY glIsTexture(GLuint texture); +GLAPI void APIENTRY glLightModelf (GLenum pname, GLfloat param); +GLAPI void APIENTRY glLightModelfv (GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glLightModelx (GLenum pname, GLfixed param); +GLAPI void APIENTRY glLightModelxv (GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param); +GLAPI void APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param); +GLAPI void APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glLineWidth (GLfloat width); +GLAPI void APIENTRY glLineWidthx (GLfixed width); +GLAPI void APIENTRY glLoadIdentity (void); +GLAPI void APIENTRY glLoadMatrixf (const GLfloat *m); +GLAPI void APIENTRY glLoadMatrixx (const GLfixed *m); +GLAPI void APIENTRY glLogicOp (GLenum opcode); +GLAPI void APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param); +GLAPI void APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param); +GLAPI void APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glMatrixMode (GLenum mode); +GLAPI void APIENTRY glMultMatrixf (const GLfloat *m); +GLAPI void APIENTRY glMultMatrixx (const GLfixed *m); +GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +GLAPI void APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +GLAPI void APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); +GLAPI void APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz); +GLAPI void APIENTRY glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +GLAPI void APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param); +GLAPI void APIENTRY glPointParameterf(GLenum pname, GLfloat param); +GLAPI void APIENTRY glPointParameterfv(GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glPointParameterx(GLenum pname, GLfixed param); +GLAPI void APIENTRY glPointParameterxv(GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glPointSize (GLfloat size); +GLAPI void APIENTRY glPointSizex (GLfixed size); +GLAPI void APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GLAPI void APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units); +GLAPI void APIENTRY glPopMatrix (void); +GLAPI void APIENTRY glPushMatrix (void); +GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +GLAPI void APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GLAPI void APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert); +GLAPI void APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GLAPI void APIENTRY glShadeModel (GLenum mode); +GLAPI void APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GLAPI void APIENTRY glStencilMask (GLuint mask); +GLAPI void APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GLAPI void APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); +GLAPI void APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param); +GLAPI void APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params); +GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GLAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GLAPI void APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param); +GLAPI void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +GLAPI void APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z); +GLAPI void APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z); +GLAPI void APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); + +/*****************************************************************************************/ +/* OES extension functions */ +/*****************************************************************************************/ + +#ifdef GL_OES_matrix_palette + +GLAPI void APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex); +GLAPI void APIENTRY glLoadPaletteFromModelViewMatrixOES (void); +GLAPI void APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLAPI void APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); + +#endif /* OES_matrix_palette */ + +#ifdef GL_OES_point_size_array + +GLAPI void APIENTRY glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer); + +#endif /* OES_point_size_array */ + +#ifdef GL_OES_draw_texture + +GLAPI void APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); +GLAPI void APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height); +GLAPI void APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); +GLAPI void APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); + +GLAPI void APIENTRY glDrawTexsvOES (GLshort *coords); +GLAPI void APIENTRY glDrawTexivOES (GLint *coords); +GLAPI void APIENTRY glDrawTexfvOES (GLfloat *coords); +GLAPI void APIENTRY glDrawTexxvOES (GLfixed *coords); + +#endif /* GL_OES_draw_texture */ + +#ifdef __cplusplus +} +#endif + +#endif /* __gl_h_ */ Added: tiki/gp2x/include/GLES/glext.h =================================================================== --- tiki/gp2x/include/GLES/glext.h (rev 0) +++ tiki/gp2x/include/GLES/glext.h 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,80 @@ +#ifndef __glext_h_ +#define __glext_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright 1992-2003, Silicon Graphics, Inc. +** All Rights Reserved. +** +** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.; +** the contents of this file may not be disclosed to third parties, copied or +** duplicated in any form, in whole or in part, without the prior written +** permission of Silicon Graphics, Inc. +** +** RESTRICTED RIGHTS LEGEND: +** Use, duplication or disclosure by the Government is subject to restrictions +** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data +** and Computer Software clause at DFARS 252.227-7013, and/or in similar or +** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished - +** rights reserved under the Copyright Laws of the United States. +** +** -------------------------------------------------------------------------- +** +** Copyright (c) 2004, Hans-Martin Will. All rights reserved. +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +** OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +** THE POSSIBILITY OF SUCH DAMAGE. +** +*/ + +#ifndef WIN32 +#define APIENTRY +#endif + +#ifndef APIENTRY +#define APIENTRY +#endif + +#ifdef EGL_ON_SYMBIAN +# undef GLAPI +# define GLAPI EXPORT_C +#else +# ifndef GLAPI +# define GLAPI +# endif +#endif + + +#define GL_OES_query_matrix 1 + +/* OES_query_matrix */ +GLAPI GLbitfield APIENTRY glQueryMatrixxOES(GLfixed *mantissa, GLint *exponent); + + +#ifdef __cplusplus +} +#endif + +#endif /* __glext_h_ */ Added: tiki/gp2x/include/Tiki/glhdrs.h =================================================================== --- tiki/gp2x/include/Tiki/glhdrs.h (rev 0) +++ tiki/gp2x/include/Tiki/glhdrs.h 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,17 @@ +/* + Tiki + + glhdrs.h + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_GLHDRS_H +#define __TIKI_GLHDRS_H + +// This file should include the platform's OpenGL and GLU headers. + +#include <GLES/egl.h> +#include "minimal.h" + +#endif // __TIKI_GLHDRS_H Property changes on: tiki/gp2x/include/Tiki/glhdrs.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/gp2x/include/Tiki/platthread.h =================================================================== --- tiki/gp2x/include/Tiki/platthread.h (rev 0) +++ tiki/gp2x/include/Tiki/platthread.h 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,25 @@ +/* + Tiki + + platthread.h + + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_PLATTHREAD_H +#define __TIKI_PLATTHREAD_H + +#include <pthread.h> + +namespace Tiki { +namespace Thread { + +typedef ::pthread_t thread_t; +typedef ::pthread_mutex_t mutex_t; +typedef ::pthread_cond_t cond_t; + +} +} + +#endif // __TIKI_PLATTHREAD_H + Property changes on: tiki/gp2x/include/Tiki/platthread.h ___________________________________________________________________ Name: svn:executable + * Added: tiki/gp2x/include/Tiki/tikitypes.h =================================================================== --- tiki/gp2x/include/Tiki/tikitypes.h (rev 0) +++ tiki/gp2x/include/Tiki/tikitypes.h 2006-06-15 16:50:57 UTC (rev 345) @@ -0,0 +1,51 @@ +/* + Tiki + + types.h + + Copyright (C)2000,2001 Dan Potter + Copyright (C)2005 Cryptic Allusion, LLC +*/ + +#ifndef __TIKI_TYPES_H +#define __TIKI_TYPES_H + +#include <stddef.h> + +// This gets included in the main tiki.h, so it should suffice. +#define TIKI_OSX 0 +#define TIKI_WIN32 1 +#define TIKI_SDL 2 +#define TIKI_DC 3 +#define TIKI_GP2X 4 +#define TIKI_PLAT TIKI_GP2X + +namespace Tiki { + +// Generic types +typedef unsigned long long uint64; +typedef unsigned long uint32; +typedef unsigned short uint16; +typedef unsigned char uint8; +typedef long long int64; +typedef long int32; +typedef short int16; +typedef char int8; + +// Volatile types +typedef volatile uint64 vuint64; +typedef volatile uint32 vuint32; +type... [truncated message content] |
From: <at...@us...> - 2006-06-15 16:46:21
|
Revision: 344 Author: atani Date: 2006-06-15 09:44:27 -0700 (Thu, 15 Jun 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=344&view=rev Log Message: ----------- updated SDL endian.h to point to system endian.h updated examples to allow including libs from $TIKI_PLAT/lib Modified Paths: -------------- tiki/examples/TikiTest/Makefile tiki/examples/console/TikiSnake/Makefile tiki/sdl/include/machine/endian.h Modified: tiki/examples/TikiTest/Makefile =================================================================== --- tiki/examples/TikiTest/Makefile 2006-06-11 23:35:13 UTC (rev 343) +++ tiki/examples/TikiTest/Makefile 2006-06-15 16:44:27 UTC (rev 344) @@ -3,7 +3,7 @@ OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) all: $(OBJS) - $(CXX) -L../../$(TIKI_PLAT) $(OBJS) $(TIKI_BASE_LIBS) -o tikitest + $(CXX) -L../../$(TIKI_PLAT) -L../../$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikitest clean: -rm -f $(OBJS) tikitest Modified: tiki/examples/console/TikiSnake/Makefile =================================================================== --- tiki/examples/console/TikiSnake/Makefile 2006-06-11 23:35:13 UTC (rev 343) +++ tiki/examples/console/TikiSnake/Makefile 2006-06-15 16:44:27 UTC (rev 344) @@ -3,7 +3,7 @@ OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) all: $(OBJS) - $(CXX) -L../../../$(TIKI_PLAT) $(OBJS) $(TIKI_BASE_LIBS) -o tikisnake + $(CXX) -L../../../$(TIKI_PLAT) -L../../../$(TIKI_PLAT)/lib $(OBJS) $(TIKI_BASE_LIBS) -o tikisnake clean: -rm -f $(OBJS) tikisnake Modified: tiki/sdl/include/machine/endian.h =================================================================== --- tiki/sdl/include/machine/endian.h 2006-06-11 23:35:13 UTC (rev 343) +++ tiki/sdl/include/machine/endian.h 2006-06-15 16:44:27 UTC (rev 344) @@ -1,9 +1,4 @@ -#undef LITTLE_ENDIAN -#undef BIG_ENDIAN -#undef BYTE_ORDER - -#define LITTLE_ENDIAN 1234 -#define BIG_ENDIAN 4321 -#define BYTE_ORDER LITTLE_ENDIAN - +#define __USE_BSD 1 +#include <endian.h> +#undef __USE_BSD This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-06-11 23:35:18
|
Revision: 343 Author: bardtx Date: 2006-06-11 16:35:13 -0700 (Sun, 11 Jun 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=343&view=rev Log Message: ----------- tiki: process genmenu input events in main thread, to make standard Tsunami-style input/drawable interactions simpler Modified Paths: -------------- tiki/include/Tiki/genmenu.h tiki/src/gl/genmenu.cpp Modified: tiki/include/Tiki/genmenu.h =================================================================== --- tiki/include/Tiki/genmenu.h 2006-06-11 23:33:14 UTC (rev 342) +++ tiki/include/Tiki/genmenu.h 2006-06-11 23:35:13 UTC (rev 343) @@ -13,6 +13,7 @@ #include "Tiki/refcnt.h" #include "Tiki/drawables/layer.h" #include "Tiki/hid.h" +#include "Tiki/eventCollector.h" #include "Tiki/oggvorbis.h" /* @@ -64,7 +65,6 @@ protected: // HID input callback. - static void hidCallback(const Hid::Event & evt, void * data); virtual void processHidEvent(const Hid::Event & evt); // Called once per frame to update the screen. Generally no need @@ -136,6 +136,10 @@ // The time of the last frame rendered uint64 m_lastTime; + + // Event collector object, so we can process incoming events + // in the drawing thread. + RefPtr<Hid::EventCollector> m_ec; }; } Modified: tiki/src/gl/genmenu.cpp =================================================================== --- tiki/src/gl/genmenu.cpp 2006-06-11 23:33:14 UTC (rev 342) +++ tiki/src/gl/genmenu.cpp 2006-06-11 23:35:13 UTC (rev 343) @@ -56,17 +56,15 @@ m_postDelay = 0; - m_startTime=m_lastTime=Time::gettime(); + m_startTime = m_lastTime = Time::gettime(); + + m_ec = new Hid::EventCollector(false); } GenericMenu::~GenericMenu() { } void GenericMenu::doMenu() { - // Register us for HID input callbacks. - int hidCookie = Hid::callbackReg(hidCallback, this); - assert( hidCookie >= 0 ); - // Start background music if necessary if (m_usebgm) { m_bgm = new VorbisStream(); @@ -77,6 +75,9 @@ // Reset our timeout resetTimeout(); + // And start collecting events. + m_ec->start(); + // Enter the main loop m_exiting = false; while (!m_exiting) { @@ -84,6 +85,9 @@ visualPerFrame(); } + // Stop collecting events now. + m_ec->stop(); + // Ok, we're exiting -- do the same as before, but we'll exit out // entirely when the scene is finished (and music faded). while (!m_scene->isFinished() && m_exitCount > 0.0f) { @@ -116,8 +120,6 @@ // Stop any sound effects Sound::stopAll(); } - - Hid::callbackUnreg(hidCookie); } void GenericMenu::setPostDelay(int d) { @@ -167,6 +169,12 @@ resetTimeout(); inputEvent(Event(Event::EvtTimeout)); } + + // Check for regular HID events. + Hid::Event evt; + while (m_ec->getEvent(evt)) { + processHidEvent(evt); + } } // The default inputEvent just gives you simple debugging output so @@ -211,11 +219,6 @@ m_bg[2] = b; } -void GenericMenu::hidCallback(const Hid::Event & evt, void * data) { - assert( data ); - ((GenericMenu *)data)->processHidEvent(evt); -} - void GenericMenu::processHidEvent(const Hid::Event & evt) { // Just pass the event down as-is first. // And why exactly C++ can't deal with making a default copy constructor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-06-11 23:33:17
|
Revision: 342 Author: bardtx Date: 2006-06-11 16:33:14 -0700 (Sun, 11 Jun 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=342&view=rev Log Message: ----------- tiki: Update Xcode project to 2.2 format, with dwarf debugging symbols; switch development build to only build for PPC and deployment build to build for PPC/i386 (Intel Mac users may need to adjust for your own usage...) Modified Paths: -------------- tiki/osx/Tiki.xcodeproj/project.pbxproj Modified: tiki/osx/Tiki.xcodeproj/project.pbxproj =================================================================== --- tiki/osx/Tiki.xcodeproj/project.pbxproj 2006-06-11 23:31:48 UTC (rev 341) +++ tiki/osx/Tiki.xcodeproj/project.pbxproj 2006-06-11 23:33:14 UTC (rev 342) @@ -155,30 +155,6 @@ C4F51613079A34260001D0D0 /* gl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C4F51612079A34260001D0D0 /* gl.cpp */; }; /* End PBXBuildFile section */ -/* Begin PBXBuildStyle section */ - 014CEA440018CDF011CA2923 /* Development */ = { - isa = PBXBuildStyle; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - ZERO_LINK = NO; - }; - name = Development; - }; - 014CEA450018CDF011CA2923 /* Deployment */ = { - isa = PBXBuildStyle; - buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - ZERO_LINK = NO; - }; - name = Deployment; - }; -/* End PBXBuildStyle section */ - /* Begin PBXCopyFilesBuildPhase section */ C42D917D0873B35500421E45 /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; @@ -1022,36 +998,6 @@ ); buildRules = ( ); - buildSettings = { - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Tiki_Prefix.pch; - HEADER_SEARCH_PATHS = ( - ../include, - include, - /sw/include, - ../3rdparty/boost, - ); - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "@executable_path/../Frameworks"; - LIBRARY_SEARCH_PATHS = shlibs; - LIBRARY_STYLE = DYNAMIC; - MACOSX_DEPLOYMENT_TARGET = 10.2; - OTHER_CFLAGS = "-Wno-long-double"; - OTHER_LDFLAGS = ( - "-seg1addr", - 0xb0000000, - "-lz", - ); - PREBINDING = NO; - PRODUCT_NAME = Tiki; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = framework; - }; dependencies = ( ); name = Tiki; @@ -1066,12 +1012,6 @@ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = C4B181AB0856AE7000B46BDA /* Build configuration list for PBXProject "Tiki" */; - buildSettings = { - }; - buildStyles = ( - 014CEA440018CDF011CA2923 /* Development */, - 014CEA450018CDF011CA2923 /* Deployment */, - ); hasScannedForEncodings = 1; mainGroup = 0867D691FE84028FC02AAC07 /* Tiki */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; @@ -1379,12 +1319,12 @@ C4B181AC0856AE7000B46BDA /* Development */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ( - ppc, - i386, - ); + ARCHS = ppc; + DEBUG_INFORMATION_FORMAT = dwarf; LIBRARY_SEARCH_PATHS = /System/Library/Frameworks/; MACOSX_DEPLOYMENT_TARGET = 10.4; + MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; + MACOSX_DEPLOYMENT_TARGET_ppc = 10.3; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Development; @@ -1396,8 +1336,11 @@ ppc, i386, ); + DEBUG_INFORMATION_FORMAT = dwarf; LIBRARY_SEARCH_PATHS = /System/Library/Frameworks/; MACOSX_DEPLOYMENT_TARGET = 10.4; + MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; + MACOSX_DEPLOYMENT_TARGET_ppc = 10.3; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Deployment; @@ -1409,8 +1352,11 @@ ppc, i386, ); + DEBUG_INFORMATION_FORMAT = dwarf; LIBRARY_SEARCH_PATHS = /System/Library/Frameworks/; MACOSX_DEPLOYMENT_TARGET = 10.4; + MACOSX_DEPLOYMENT_TARGET_i386 = 10.4; + MACOSX_DEPLOYMENT_TARGET_ppc = 10.3; SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; }; name = Default; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-06-11 23:31:53
|
Revision: 341 Author: bardtx Date: 2006-06-11 16:31:48 -0700 (Sun, 11 Jun 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=341&view=rev Log Message: ----------- tiki: add a bit more thread safety to EventCollector; this piece still isn't 100% correct because it could destruct after a HID callback is in progress but before the callback method is actually called. Modified Paths: -------------- tiki/src/hid/eventcollector.cpp Modified: tiki/src/hid/eventcollector.cpp =================================================================== --- tiki/src/hid/eventcollector.cpp 2006-06-11 23:30:40 UTC (rev 340) +++ tiki/src/hid/eventcollector.cpp 2006-06-11 23:31:48 UTC (rev 341) @@ -24,11 +24,15 @@ } void EventCollector::start() { + Thread::AutoLock lock(m_mutex); + assert( m_cookie < 0 ); m_cookie = callbackReg(hidCallbackStatic, this); } void EventCollector::stop() { + Thread::AutoLock lock(m_mutex); + assert( m_cookie >= 0 ); callbackUnreg(m_cookie); m_cookie = -1; @@ -57,7 +61,8 @@ void EventCollector::hidCallback(const Event & evt) { Thread::AutoLock lock(m_mutex); - m_events.push(evt); + if (m_cookie >= 0) + m_events.push(evt); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-06-11 23:30:45
|
Revision: 340 Author: bardtx Date: 2006-06-11 16:30:40 -0700 (Sun, 11 Jun 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=340&view=rev Log Message: ----------- tiki: import combinatorial Color operators from Tsunami Modified Paths: -------------- tiki/include/Tiki/color.h Modified: tiki/include/Tiki/color.h =================================================================== --- tiki/include/Tiki/color.h 2006-06-08 20:44:50 UTC (rev 339) +++ tiki/include/Tiki/color.h 2006-06-11 23:30:40 UTC (rev 340) @@ -55,6 +55,21 @@ return *this; } + // These must be used in some cases because C++ is too dumb to + // handle the precedence sensibly... + Color mult(const Color & o) const { + return Color(a*o.a, r*o.r, g*o.g, b*o.b); + } + Color mult(float f) const { + return Color(a*f, r*f, g*f, b*f); + } + Color add(const Color & o) const { + return Color(a+o.a, r+o.r, g+o.g, b+o.b); + } + Color sub(const Color & o) const { + return Color(a-o.a, r-o.r, g-o.g, b-o.b); + } + operator uint32() const { float ta, tr, tg, tb; ta = (a < 0.0f) ? 0.0f : (a > 1.0f) ? 1.0f : a; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <at...@us...> - 2006-06-08 20:45:01
|
Revision: 339 Author: atani Date: 2006-06-08 13:44:50 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=339&view=rev Log Message: ----------- Updated SDL init_shutdown.cpp for OpenAL 20050504 Updated example Makefiles to link to Makefile.rules properly Updated TikiTest/src/TikiTest.cpp to include tiki.h vs Tiki.h Updated TikiTest and TikiSnake to deal with a failed Tiki::init() Modified Paths: -------------- tiki/examples/TikiTest/Makefile tiki/examples/TikiTest/src/TikiTest.cpp tiki/examples/TikiTest/src/test.cpp tiki/examples/console/TikiSnake/Makefile tiki/examples/console/TikiSnake/src/snake.cpp tiki/sdl/Makefile.rules tiki/sdl/src/init_shutdown.cpp Modified: tiki/examples/TikiTest/Makefile =================================================================== --- tiki/examples/TikiTest/Makefile 2006-06-06 03:57:43 UTC (rev 338) +++ tiki/examples/TikiTest/Makefile 2006-06-08 20:44:50 UTC (rev 339) @@ -1,11 +1,11 @@ -CFLAGS=-I../$(TIKI_PLAT)/include -I../include +CFLAGS=-I../../$(TIKI_PLAT)/include -I../../include OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) all: $(OBJS) - $(CXX) -L../$(TIKI_PLAT) $(OBJS) $(TIKI_BASE_LIBS) -o tikitest + $(CXX) -L../../$(TIKI_PLAT) $(OBJS) $(TIKI_BASE_LIBS) -o tikitest clean: -rm -f $(OBJS) tikitest -include ../$(TIKI_PLAT)/Makefile.rules +include ../../$(TIKI_PLAT)/Makefile.rules Modified: tiki/examples/TikiTest/src/TikiTest.cpp =================================================================== --- tiki/examples/TikiTest/src/TikiTest.cpp 2006-06-06 03:57:43 UTC (rev 338) +++ tiki/examples/TikiTest/src/TikiTest.cpp 2006-06-08 20:44:50 UTC (rev 339) @@ -6,11 +6,11 @@ * */ -#include <Tiki/Tiki.h> +#include <Tiki/tiki.h> #include <pch.h> -#if TIKI_PLAT == TIKI_WIN32 -#include <windows.h> +#if TIKI_PLAT == TIKI_WIN32 +#include <windows.h> static char szAppName[] = "TikiTest"; int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) Modified: tiki/examples/TikiTest/src/test.cpp =================================================================== --- tiki/examples/TikiTest/src/test.cpp 2006-06-06 03:57:43 UTC (rev 338) +++ tiki/examples/TikiTest/src/test.cpp 2006-06-08 20:44:50 UTC (rev 339) @@ -232,7 +232,10 @@ extern "C" int tiki_main(int argc, char **argv) { // Init Tiki - Tiki::init(argc, argv); + if(!Tiki::init(argc, argv)) + { + exit(-1); + } Tiki::setName("TikiTest", NULL); Tiki::GL::showCursor(false); Hid::callbackReg(tkCallback, NULL); Modified: tiki/examples/console/TikiSnake/Makefile =================================================================== --- tiki/examples/console/TikiSnake/Makefile 2006-06-06 03:57:43 UTC (rev 338) +++ tiki/examples/console/TikiSnake/Makefile 2006-06-08 20:44:50 UTC (rev 339) @@ -1,11 +1,11 @@ -CFLAGS=-I../../$(TIKI_PLAT)/include -I../../include +CFLAGS=-I../../../$(TIKI_PLAT)/include -I../../../include OBJS = $(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) all: $(OBJS) - $(CXX) -L../$(TIKI_PLAT) $(OBJS) $(TIKI_BASE_LIBS) -o tikisnake + $(CXX) -L../../../$(TIKI_PLAT) $(OBJS) $(TIKI_BASE_LIBS) -o tikisnake clean: -rm -f $(OBJS) tikisnake -include ../../$(TIKI_PLAT)/Makefile.rules +include ../../../$(TIKI_PLAT)/Makefile.rules Modified: tiki/examples/console/TikiSnake/src/snake.cpp =================================================================== --- tiki/examples/console/TikiSnake/src/snake.cpp 2006-06-06 03:57:43 UTC (rev 338) +++ tiki/examples/console/TikiSnake/src/snake.cpp 2006-06-08 20:44:50 UTC (rev 339) @@ -62,7 +62,10 @@ srand(time(NULL)); // Init Tiki - Tiki::init(argc, argv); + if(!Tiki::init(argc, argv)) + { + exit(-1); + } Tiki::setName("SnakeyGame", NULL); Hid::callbackReg(tkCallback, NULL); Modified: tiki/sdl/Makefile.rules =================================================================== --- tiki/sdl/Makefile.rules 2006-06-06 03:57:43 UTC (rev 338) +++ tiki/sdl/Makefile.rules 2006-06-08 20:44:50 UTC (rev 339) @@ -20,4 +20,4 @@ $(patsubst %, _clean_dir_%, $(SUBDIRS)): @$(MAKE) -C $(patsubst _clean_dir_%, %, $@) clean -TIKI_BASE_LIBS=-ltiki -lopenal -lalut -lGL -lGLU -lpthread -lSDL +TIKI_BASE_LIBS=-ltiki $(shell openal-config --libs) -lGL -lGLU -lpthread -lSDL Modified: tiki/sdl/src/init_shutdown.cpp =================================================================== --- tiki/sdl/src/init_shutdown.cpp 2006-06-06 03:57:43 UTC (rev 338) +++ tiki/sdl/src/init_shutdown.cpp 2006-06-08 20:44:50 UTC (rev 339) @@ -9,6 +9,7 @@ #include "pch.h" #include <AL/al.h> +#include <AL/alc.h> #include <AL/alut.h> #include "Tiki/sound.h" @@ -28,7 +29,7 @@ return false; } - dev = alcOpenDevice("sdl"); + dev = alcOpenDevice((ALubyte *)"sdl"); if(dev == NULL) { fprintf(stderr, "Unable to initialize OpenAL: %s\n", alGetError()); @@ -43,7 +44,7 @@ else { alcMakeContextCurrent(context); - alutInitWithoutContext(&argc, argv); + alutInit(&argc, argv); Audio::Sound::initGlobal(); Audio::Stream::initGlobal(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-06-06 03:57:46
|
Revision: 338 Author: bardtx Date: 2006-06-05 20:57:43 -0700 (Mon, 05 Jun 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=338&view=rev Log Message: ----------- kos: Fix kos-ranlib to not include a bunch of meaningless parameters Modified Paths: -------------- kos/utils/gnu_wrappers/kos-ranlib Modified: kos/utils/gnu_wrappers/kos-ranlib =================================================================== --- kos/utils/gnu_wrappers/kos-ranlib 2006-06-06 03:57:17 UTC (rev 337) +++ kos/utils/gnu_wrappers/kos-ranlib 2006-06-06 03:57:43 UTC (rev 338) @@ -1,3 +1,3 @@ #!/bin/sh -exec ${KOS_RANLIB} ${KOS_LDFLAGS} "$@" ${KOS_LIB_PATHS} ${KOS_LIBS} +exec ${KOS_RANLIB} "$@" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ba...@us...> - 2006-06-06 03:57:20
|
Revision: 337 Author: bardtx Date: 2006-06-05 20:57:17 -0700 (Mon, 05 Jun 2006) ViewCVS: http://svn.sourceforge.net/cadcdev/?rev=337&view=rev Log Message: ----------- kos: Make kos-cc wrapper work with C++ autoconf tests Modified Paths: -------------- kos/utils/gnu_wrappers/kos-cc Modified: kos/utils/gnu_wrappers/kos-cc =================================================================== --- kos/utils/gnu_wrappers/kos-cc 2006-06-06 03:55:57 UTC (rev 336) +++ kos/utils/gnu_wrappers/kos-cc 2006-06-06 03:57:17 UTC (rev 337) @@ -15,7 +15,7 @@ # Partial compile USEMODE=2 ;; - conftest.c) + conftest.c | conftest.cc) # Used in autoconf... we really probably need # a better way to do this. (scan for any .c?) USEMODE=1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |