diff --git a/desmume/src/GPU_osd.cpp b/desmume/src/GPU_osd.cpp index cd876a425..452c52f92 100644 --- a/desmume/src/GPU_osd.cpp +++ b/desmume/src/GPU_osd.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include "debug.h" #include "aggdraw.h" @@ -35,6 +34,10 @@ #include "mic.h" #include "saves.h" +#ifdef _MSC_VER +#include +#endif + bool HudEditorMode = false; OSDCLASS *osd = NULL; HudStruct Hud; @@ -511,9 +514,28 @@ static void DrawEditableElementIndicators() void DrawHUD() { - GTimeVal time; - g_get_current_time(&time); - hudTimer = ((s64)time.tv_sec * 1000) + ((s64)time.tv_usec/1000); + #ifdef _MSC_VER + //code taken from glib's g_get_current_time + FILETIME ft; + u64 time64; + GetSystemTimeAsFileTime (&ft); + memmove (&time64, &ft, sizeof (FILETIME)); + + /* Convert from 100s of nanoseconds since 1601-01-01 + * to Unix epoch. Yes, this is Y2038 unsafe. + */ + time64 -= 116444736000000000LL; + time64 /= 10; + + time_t tv_sec = time64 / 1000000; + time_t tv_usec = time64 % 1000000; + hudTimer = ((s64)tv_sec * 1000) + ((s64)tv_usec/1000); + #else + time_t t; + gettimeofday (&t, NULL); + result->tv_sec = r.tv_sec; + result->tv_usec = r.tv_usec; + #endif if (HudEditorMode) { diff --git a/desmume/src/common.cpp b/desmume/src/common.cpp index 66a948bf3..11a879bd8 100644 --- a/desmume/src/common.cpp +++ b/desmume/src/common.cpp @@ -390,260 +390,6 @@ std::string getDeveloperNameByID(u16 id) return "Unknown"; } -// =============================================================================== -// PNG/BMP -// =============================================================================== -static int WritePNGChunk(FILE *fp, uint32 size, const char *type, const uint8 *data) -{ - uint32 crc; - - uint8 tempo[4]; - - tempo[0]=size>>24; - tempo[1]=size>>16; - tempo[2]=size>>8; - tempo[3]=size; - - if(fwrite(tempo,4,1,fp)!=1) - return 0; - if(fwrite(type,4,1,fp)!=1) - return 0; - - if(size) - if(fwrite(data,1,size,fp)!=size) - return 0; - - crc = crc32(0,(uint8 *)type,4); - if(size) - crc = crc32(crc,data,size); - - tempo[0]=crc>>24; - tempo[1]=crc>>16; - tempo[2]=crc>>8; - tempo[3]=crc; - - if(fwrite(tempo,4,1,fp)!=1) - return 0; - return 1; -} - -int NDS_WritePNG_16bpp(int width, int height, const u16 *data, const char *fname) -{ - int x, y; - const u16 * bmp = data; - FILE *pp=NULL; - uint8 *compmem = NULL; - uLongf compmemsize = (uLongf)( (height * (width + 1) * 3 * 1.001 + 1) + 12 ); - - if(!(compmem=(uint8 *)malloc(compmemsize))) - return 0; - - if(!(pp=fopen(fname, "wb"))) - { - goto PNGerr; - } - { - const uint8 header[8]={137,80,78,71,13,10,26,10}; - if(fwrite(header,8,1,pp)!=1) - goto PNGerr; - } - - { - uint8 chunko[13]; - - chunko[0] = width >> 24; // Width - chunko[1] = width >> 16; - chunko[2] = width >> 8; - chunko[3] = width; - - chunko[4] = height >> 24; // Height - chunko[5] = height >> 16; - chunko[6] = height >> 8; - chunko[7] = height; - - chunko[8]=8; // 8 bits per sample(24 bits per pixel) - chunko[9]=2; // Color type; RGB triplet - chunko[10]=0; // compression: deflate - chunko[11]=0; // Basic adapative filter set(though none are used). - chunko[12]=0; // No interlace. - - if(!WritePNGChunk(pp,13,"IHDR",chunko)) - goto PNGerr; - } - - { - uint8 *tmp_buffer; - uint8 *tmp_inc; - tmp_inc = tmp_buffer = (uint8 *)malloc((width * 3 + 1) * height); - - for(y=0;y>10; - pixel-=r<<10; - g = pixel>>5; - pixel-=g<<5; - b = pixel; - r*=255/31; - g*=255/31; - b*=255/31; - tmp_inc[0] = b; - tmp_inc[1] = g; - tmp_inc[2] = r; - tmp_inc += 3; - } - } - - if(compress(compmem, &compmemsize, tmp_buffer, height * (width * 3 + 1))!=Z_OK) - { - if(tmp_buffer) free(tmp_buffer); - goto PNGerr; - } - if(tmp_buffer) free(tmp_buffer); - if(!WritePNGChunk(pp,compmemsize,"IDAT",compmem)) - goto PNGerr; - } - if(!WritePNGChunk(pp,0,"IEND",0)) - goto PNGerr; - - free(compmem); - fclose(pp); - - return 1; - -PNGerr: - if(compmem) - free(compmem); - if(pp) - fclose(pp); - return(0); -} - -typedef struct -{ - u32 size; - s32 width; - s32 height; - u16 planes; - u16 bpp; - u32 cmptype; - u32 imgsize; - s32 hppm; - s32 vppm; - u32 numcol; - u32 numimpcol; -} bmpimgheader_struct; - -#include "PACKED.h" -typedef struct -{ - u16 id __PACKED; - u32 size __PACKED; - u16 reserved1 __PACKED; - u16 reserved2 __PACKED; - u32 imgoffset __PACKED; -} bmpfileheader_struct; -#include "PACKED_END.h" - -int NDS_WriteBMP_16bpp(int width, int height, const u16 *data, const char *filename) -{ - bmpfileheader_struct fileheader; - bmpimgheader_struct imageheader; - FILE *file; - int i,j; - const u16 * bmp = data; - size_t elems_written = 0; - - memset(&fileheader, 0, sizeof(fileheader)); - fileheader.size = sizeof(fileheader); - fileheader.id = 'B' | ('M' << 8); - fileheader.imgoffset = sizeof(fileheader)+sizeof(imageheader); - - memset(&imageheader, 0, sizeof(imageheader)); - imageheader.size = sizeof(imageheader); - imageheader.width = width; - imageheader.height = height; - imageheader.planes = 1; - imageheader.bpp = 24; - imageheader.cmptype = 0; // None - imageheader.imgsize = imageheader.width * imageheader.height * 3; - - if ((file = fopen(filename,"wb")) == NULL) - return 0; - - elems_written += fwrite(&fileheader, 1, sizeof(fileheader), file); - elems_written += fwrite(&imageheader, 1, sizeof(imageheader), file); - - for(j=0;j>10; - pixel-=r<<10; - g = pixel>>5; - pixel-=g<<5; - b = (u8)pixel; - r*=255/31; - g*=255/31; - b*=255/31; - elems_written += fwrite(&r, 1, sizeof(u8), file); - elems_written += fwrite(&g, 1, sizeof(u8), file); - elems_written += fwrite(&b, 1, sizeof(u8), file); - } - } - fclose(file); - - return 1; -} - -int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename) -{ - bmpfileheader_struct fileheader; - bmpimgheader_struct imageheader; - FILE *file; - size_t elems_written = 0; - memset(&fileheader, 0, sizeof(fileheader)); - fileheader.size = sizeof(fileheader); - fileheader.id = 'B' | ('M' << 8); - fileheader.imgoffset = sizeof(fileheader)+sizeof(imageheader); - - memset(&imageheader, 0, sizeof(imageheader)); - imageheader.size = sizeof(imageheader); - imageheader.width = width; - imageheader.height = height; - imageheader.planes = 1; - imageheader.bpp = 32; - imageheader.cmptype = 0; // None - imageheader.imgsize = imageheader.width * imageheader.height * 4; - - if ((file = fopen(filename,"wb")) == NULL) - return 0; - - elems_written += fwrite(&fileheader, 1, sizeof(fileheader), file); - elems_written += fwrite(&imageheader, 1, sizeof(imageheader), file); - - for(int i=0;i. +*/ + +#include +#include +#include "types.h" +#include "ImageOut.h" +#include "formats/rpng.h" +#include "formats/rbmp.h" +#include "gfx3d.h" + +static u8* Convert15To24(const u16* src, int width, int height) +{ + u8 *tmp_buffer; + u8 *tmp_inc; + tmp_inc = tmp_buffer = (u8 *)malloc(width * height * 3); + + for(int y=0;y>16)&0xFF; + *tmp_inc++ = (expanded>>8)&0xFF; + *tmp_inc++ = expanded&0xFF; + } + } + return tmp_buffer; +} + +int NDS_WritePNG_15bpp(int width, int height, const u16 *data, const char *filename) +{ + u8* tmp = Convert15To24(data,width,height); + bool ok = rpng_save_image_bgr24(filename,tmp,width,height,width*3); + free(tmp); + return ok?1:0; +} + +int NDS_WriteBMP_15bpp(int width, int height, const u16 *data, const char *filename) +{ + u8* tmp = Convert15To24(data,width,height); + bool ok = rbmp_save_image(filename,tmp,width,height,width*3,RBMP_SOURCE_TYPE_BGR24); + free(tmp); + return ok?1:0; +} + +int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename) +{ + bool ok = rbmp_save_image(filename,buf,width,height,width*4,RBMP_SOURCE_TYPE_ARGB8888); + return ok?1:0; +} \ No newline at end of file diff --git a/desmume/src/frontend/modules/ImageOut.h b/desmume/src/frontend/modules/ImageOut.h new file mode 100644 index 000000000..9777dcbfa --- /dev/null +++ b/desmume/src/frontend/modules/ImageOut.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2015 DeSmuME team + + This file is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + This file is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the this software. If not, see . +*/ + +#ifndef _DESMUME_IMAGEOUT_H_ +#define _DESMUME_IMAGEOUT_H_ + +#include "types.h" + +int NDS_WritePNG_15bpp(int width, int height, const u16 *data, const char *fname); +int NDS_WriteBMP_15bpp(int width, int height, const u16 *data, const char *filename); +int NDS_WriteBMP_32bppBuffer(int width, int height, const void* buf, const char *filename); + +#endif \ No newline at end of file diff --git a/desmume/src/gdbstub/gdbstub.cpp b/desmume/src/gdbstub/gdbstub.cpp index 775055373..3c0260011 100644 --- a/desmume/src/gdbstub/gdbstub.cpp +++ b/desmume/src/gdbstub/gdbstub.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "../gdbstub.h" #include "../types.h" #include "../NDSSystem.h" @@ -47,12 +48,7 @@ #endif #endif // HOST_WINDOWS -#ifndef HOST_WINDOWS -// to access the CPUs in any way, a thread has to get a lock on this first -pthread_mutex_t cpu_mutex; -#else -HANDLE cpu_mutex; -#endif +slock *cpu_mutex; #ifdef __GNUC__ #define UNUSED_PARM( parm) parm __attribute__((unused)) @@ -158,47 +154,22 @@ enum target_signal void gdbstub_mutex_init() { - #ifndef HOST_WINDOWS - pthread_mutex_init(&cpu_mutex, NULL); - #else -#ifdef USE_MUTEX_ON_WINDOWS - cpu_mutex = CreateMutex(NULL, FALSE, NULL); -#endif - #endif + cpu_mutex = slock_new(); } void gdbstub_mutex_destroy() { - #ifndef HOST_WINDOWS - pthread_mutex_destroy(&cpu_mutex); - #else -#ifdef USE_MUTEX_ON_WINDOWS - CloseHandle(cpu_mutex); -#endif - #endif + slock_free(cpu_mutex); } void gdbstub_mutex_lock() { -#ifndef HOST_WINDOWS - pthread_mutex_lock(&cpu_mutex); -#else -#ifdef USE_MUTEX_ON_WINDOWS - // Maybe we should check the return value, but then again what could we do about it anyway. - WaitForSingleObject(cpu_mutex, INFINITE); -#endif -#endif + slock_lock(cpu_mutex); } void gdbstub_mutex_unlock() { -#ifndef HOST_WINDOWS - pthread_mutex_unlock(&cpu_mutex); -#else -#ifdef USE_MUTEX_ON_WINDOWS - ReleaseMutex(cpu_mutex); -#endif -#endif + slock_unlock(cpu_mutex); } static void diff --git a/desmume/src/gdbstub/gdbstub_internal.h b/desmume/src/gdbstub/gdbstub_internal.h index eec711c68..07dda9eac 100644 --- a/desmume/src/gdbstub/gdbstub_internal.h +++ b/desmume/src/gdbstub/gdbstub_internal.h @@ -26,16 +26,7 @@ #define _GDBSTUB_INTERNAL_H_ 1 #if defined(_MSC_VER) - #if _MSC_VER < 1900 - typedef __int32 int32_t; - typedef unsigned __int32 uint32_t; - typedef __int16 int16_t; - typedef unsigned __int16 uint16_t; - typedef __int8 int8_t; - typedef unsigned __int8 uint8_t; - #else - #include - #endif + #include #include #define SOCKET_TYPE SOCKET diff --git a/desmume/src/libretro-common/compat/compat.c b/desmume/src/libretro-common/compat/compat.c new file mode 100644 index 000000000..f2a3c2241 --- /dev/null +++ b/desmume/src/libretro-common/compat/compat.c @@ -0,0 +1,375 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (compat.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include + +#ifndef HAVE_GETOPT_LONG +#include +#include +#include +#include + +#include +#endif + +#include +#include +#include +#include + +#include + +#ifndef HAVE_GETOPT_LONG +char *optarg; +int optind, opterr, optopt; + +static bool is_short_option(const char *str) +{ + return str[0] == '-' && str[1] != '-'; +} + +static bool is_long_option(const char *str) +{ + return str[0] == '-' && str[1] == '-'; +} + +static int find_short_index(char * const *argv) +{ + int idx; + for (idx = 0; argv[idx]; idx++) + { + if (is_short_option(argv[idx])) + return idx; + } + + return -1; +} + +static int find_long_index(char * const *argv) +{ + int idx; + for (idx = 0; argv[idx]; idx++) + { + if (is_long_option(argv[idx])) + return idx; + } + + return -1; +} + +static int parse_short(const char *optstring, char * const *argv) +{ + bool extra_opt, takes_arg, embedded_arg; + const char *opt = NULL; + char arg = argv[0][1]; + + if (arg == ':') + return '?'; + + opt = strchr(optstring, arg); + if (!opt) + return '?'; + + extra_opt = argv[0][2]; + takes_arg = opt[1] == ':'; + + /* If we take an argument, and we see additional characters, + * this is in fact the argument (i.e. -cfoo is same as -c foo). */ + embedded_arg = extra_opt && takes_arg; + + if (takes_arg) + { + if (embedded_arg) + { + optarg = argv[0] + 2; + optind++; + } + else + { + optarg = argv[1]; + optind += 2; + } + + return optarg ? opt[0] : '?'; + } + else if (embedded_arg) + { + /* If we see additional characters, + * and they don't take arguments, this + * means we have multiple flags in one. */ + memmove(&argv[0][1], &argv[0][2], strlen(&argv[0][2]) + 1); + return opt[0]; + } + else + { + optind++; + return opt[0]; + } +} + +static int parse_long(const struct option *longopts, char * const *argv) +{ + size_t indice; + const struct option *opt = NULL; + for (indice = 0; longopts[indice].name; indice++) + { + if (!strcmp(longopts[indice].name, &argv[0][2])) + { + opt = &longopts[indice]; + break; + } + } + + if (!opt) + return '?'; + + /* getopt_long has an "optional" arg, but we don't bother with that. */ + if (opt->has_arg && !argv[1]) + return '?'; + + if (opt->has_arg) + { + optarg = argv[1]; + optind += 2; + } + else + optind++; + + if (opt->flag) + { + *opt->flag = opt->val; + return 0; + } + + return opt->val; +} + +static void shuffle_block(char **begin, char **last, char **end) +{ + ptrdiff_t len = last - begin; + const char **tmp = (const char**)calloc(len, sizeof(const char*)); + + rarch_assert(tmp); + + memcpy(tmp, begin, len * sizeof(const char*)); + memmove(begin, last, (end - last) * sizeof(const char*)); + memcpy(end - len, tmp, len * sizeof(const char*)); + + free(tmp); +} + +int getopt_long(int argc, char *argv[], + const char *optstring, const struct option *longopts, int *longindex) +{ + int short_index, long_index; + + (void)longindex; + + if (optind == 0) + optind = 1; + + if (argc == 1) + return -1; + + short_index = find_short_index(&argv[optind]); + long_index = find_long_index(&argv[optind]); + + /* We're done here. */ + if (short_index == -1 && long_index == -1) + return -1; + + /* Reorder argv so that non-options come last. + * Non-POSIXy, but that's what getopt does by default. */ + if ((short_index > 0) && ((short_index < long_index) || (long_index == -1))) + { + shuffle_block(&argv[optind], &argv[optind + short_index], &argv[argc]); + short_index = 0; + } + else if ((long_index > 0) && ((long_index < short_index) + || (short_index == -1))) + { + shuffle_block(&argv[optind], &argv[optind + long_index], &argv[argc]); + long_index = 0; + } + + rarch_assert(short_index == 0 || long_index == 0); + + if (short_index == 0) + return parse_short(optstring, &argv[optind]); + else if (long_index == 0) + return parse_long(longopts, &argv[optind]); + else + return '?'; +} + +#endif + +#ifndef HAVE_STRCASESTR +/* Pretty much strncasecmp. */ +static int casencmp(const char *a, const char *b, size_t n) +{ + size_t i; + + for (i = 0; i < n; i++) + { + int a_lower = tolower(a[i]); + int b_lower = tolower(b[i]); + if (a_lower != b_lower) + return a_lower - b_lower; + } + + return 0; +} + +char *strcasestr_rarch__(const char *haystack, const char *needle) +{ + size_t i, hay_len, needle_len, search_off; + + hay_len = strlen(haystack); + needle_len = strlen(needle); + if (needle_len > hay_len) + return NULL; + + search_off = hay_len - needle_len; + for (i = 0; i <= search_off; i++) + if (!casencmp(haystack + i, needle, needle_len)) + return (char*)haystack + i; + + return NULL; +} +#endif + +#ifndef HAVE_STRL + +/* Implementation of strlcpy()/strlcat() based on OpenBSD. */ + +size_t strlcpy(char *dest, const char *source, size_t size) +{ + size_t src_size = 0; + size_t n = size; + + if (n) + while (--n && (*dest++ = *source++)) src_size++; + + if (!n) + { + if (size) *dest = '\0'; + while (*source++) src_size++; + } + + return src_size; +} + +size_t strlcat(char *dest, const char *source, size_t size) +{ + size_t len = strlen(dest); + + dest += len; + + if (len > size) + size = 0; + else + size -= len; + + return len + strlcpy(dest, source, size); +} + +#endif + +#ifdef _WIN32 + +#undef strcasecmp +#undef strdup +#undef isblank +#undef strtok_r +#include +#include +#include +#include + +#include + +int rarch_strcasecmp__(const char *a, const char *b) +{ + while (*a && *b) + { + int a_ = tolower(*a); + int b_ = tolower(*b); + + if (a_ != b_) + return a_ - b_; + + a++; + b++; + } + + return tolower(*a) - tolower(*b); +} + +char *rarch_strdup__(const char *orig) +{ + size_t len = strlen(orig) + 1; + char *ret = (char*)malloc(len); + if (!ret) + return NULL; + + strlcpy(ret, orig, len); + return ret; +} + +int rarch_isblank__(int c) +{ + return (c == ' ') || (c == '\t'); +} + +char *rarch_strtok_r__(char *str, const char *delim, char **saveptr) +{ + char *first = NULL; + if (!saveptr || !delim) + return NULL; + + if (str) + *saveptr = str; + + do + { + char *ptr = NULL; + first = *saveptr; + while (*first && strchr(delim, *first)) + *first++ = '\0'; + + if (*first == '\0') + return NULL; + + ptr = first + 1; + + while (*ptr && !strchr(delim, *ptr)) + ptr++; + + *saveptr = ptr + (*ptr ? 1 : 0); + *ptr = '\0'; + } while (strlen(first) == 0); + + return first; +} + +#endif diff --git a/desmume/src/libretro-common/compat/compat_fnmatch.c b/desmume/src/libretro-common/compat/compat_fnmatch.c new file mode 100644 index 000000000..5d409a3da --- /dev/null +++ b/desmume/src/libretro-common/compat/compat_fnmatch.c @@ -0,0 +1,157 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (compat_fnmatch.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#if __TEST_FNMATCH__ +#include +#endif + +#include + +/* Implemnentation of fnmatch(3) so it can be + * distributed to non *nix platforms. + * + * No flags are implemented ATM. + * We don't use them. Add flags as needed. */ + +int rl_fnmatch(const char *pattern, const char *string, int flags) +{ + const char *c; + int charmatch = 0; + int rv; + for (c = pattern; *c != '\0'; c++) + { + /* String ended before pattern */ + if ((*c != '*') && (*string == '\0')) + return FNM_NOMATCH; + + switch (*c) + { + /* Match any number of unknown chars */ + case '*': + /* Find next node in the pattern + * ignoring multiple asterixes + */ + do { + c++; + if (*c == '\0') + return 0; + } while (*c == '*'); + + /* Match the remaining pattern + * ignoring more and more characters. */ + do { + /* We reached the end of the string without a + * match. There is a way to optimize this by + * calculating the minimum chars needed to + * match the remaining pattern but I don't + * think it is worth the work ATM. + */ + if (*string == '\0') + return FNM_NOMATCH; + + rv = rl_fnmatch(c, string, flags); + string++; + } while (rv != 0); + + return 0; + /* Match char from list */ + case '[': + charmatch = 0; + for (c++; *c != ']'; c++) + { + /* Bad format */ + if (*c == '\0') + return FNM_NOMATCH; + + /* Match already found */ + if (charmatch) + continue; + + if (*c == *string) + charmatch = 1; + } + + /* No match in list */ + if (!charmatch) + return FNM_NOMATCH; + + string++; + break; + /* Has any character */ + case '?': + string++; + break; + /* Match following character verbatim */ + case '\\': + c++; + /* Dangling escape at end of pattern. + * FIXME: Was c == '\0' (makes no sense). + * Not sure if c == NULL or *c == '\0' + * is intended. Assuming *c due to c++ right before. */ + if (*c == '\0') + return FNM_NOMATCH; + default: + if (*c != *string) + return FNM_NOMATCH; + string++; + } + } + + /* End of string and end of pattend */ + if (*string == '\0') + return 0; + return FNM_NOMATCH; +} + +#if __TEST_FNMATCH__ +int main(void) +{ + assert(rl_fnmatch("TEST", "TEST", 0) == 0); + assert(rl_fnmatch("TE?T", "TEST", 0) == 0); + assert(rl_fnmatch("TE[Ssa]T", "TEST", 0) == 0); + assert(rl_fnmatch("TE[Ssda]T", "TEsT", 0) == 0); + assert(rl_fnmatch("TE[Ssda]T", "TEdT", 0) == 0); + assert(rl_fnmatch("TE[Ssda]T", "TEaT", 0) == 0); + assert(rl_fnmatch("TEST*", "TEST", 0) == 0); + assert(rl_fnmatch("TEST**", "TEST", 0) == 0); + assert(rl_fnmatch("TE*ST*", "TEST", 0) == 0); + assert(rl_fnmatch("TE**ST*", "TEST", 0) == 0); + assert(rl_fnmatch("TE**ST*", "TExST", 0) == 0); + assert(rl_fnmatch("TE**ST", "TEST", 0) == 0); + assert(rl_fnmatch("TE**ST", "TExST", 0) == 0); + assert(rl_fnmatch("TE\\**ST", "TE*xST", 0) == 0); + assert(rl_fnmatch("*.*", "test.jpg", 0) == 0); + assert(rl_fnmatch("*.jpg", "test.jpg", 0) == 0); + assert(rl_fnmatch("*.[Jj][Pp][Gg]", "test.jPg", 0) == 0); + assert(rl_fnmatch("*.[Jj]*[Gg]", "test.jPg", 0) == 0); + assert(rl_fnmatch("TEST?", "TEST", 0) == FNM_NOMATCH); + assert(rl_fnmatch("TES[asd", "TEST", 0) == FNM_NOMATCH); + assert(rl_fnmatch("TEST\\", "TEST", 0) == FNM_NOMATCH); + assert(rl_fnmatch("TEST*S", "TEST", 0) == FNM_NOMATCH); + assert(rl_fnmatch("TE**ST", "TExT", 0) == FNM_NOMATCH); + assert(rl_fnmatch("TE\\*T", "TExT", 0) == FNM_NOMATCH); + assert(rl_fnmatch("TES?", "TES", 0) == FNM_NOMATCH); + assert(rl_fnmatch("TE", "TEST", 0) == FNM_NOMATCH); + assert(rl_fnmatch("TEST!", "TEST", 0) == FNM_NOMATCH); + assert(rl_fnmatch("DSAD", "TEST", 0) == FNM_NOMATCH); +} +#endif diff --git a/desmume/src/libretro-common/crt/include/string.h b/desmume/src/libretro-common/crt/include/string.h new file mode 100644 index 000000000..25fbfc492 --- /dev/null +++ b/desmume/src/libretro-common/crt/include/string.h @@ -0,0 +1,10 @@ +#ifndef __LIBRETRO_SDK_CRT_STRING_H_ +#define __LIBRETRO_SDK_CRT_STRING_H_ + +#include + +void *memcpy(void *dst, const void *src, size_t len); + +void *memset(void *b, int c, size_t len); + +#endif diff --git a/desmume/src/libretro-common/crt/string.c b/desmume/src/libretro-common/crt/string.c new file mode 100644 index 000000000..4114de11d --- /dev/null +++ b/desmume/src/libretro-common/crt/string.c @@ -0,0 +1,34 @@ +#ifdef _MSC_VER +#include +#endif +#include +#include + +void *memset(void *dst, int val, size_t count) +{ + void *start = dst; + +#if defined(_M_IA64) || defined (_M_AMD64) || defined(_M_ALPHA) || defined (_M_PPC) + extern void RtlFillMemory(void *, size_t count, char); + + RtlFillMemory(dst, count, (char)val); +#else + while (count--) + { + *(char*)dst = (char)val; + dst = (char*)dst + 1; + } +#endif + + return start; +} + +void *memcpy(void *dst, const void *src, size_t len) +{ + size_t i; + + for (i = 0; i < len; i++) + ((unsigned char *)dst)[i] = ((unsigned char *)src)[i]; + + return dst; +} diff --git a/desmume/src/libretro-common/dynamic/dylib.c b/desmume/src/libretro-common/dynamic/dylib.c new file mode 100644 index 000000000..5bb6ec9c4 --- /dev/null +++ b/desmume/src/libretro-common/dynamic/dylib.c @@ -0,0 +1,149 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (dylib.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include + +#ifdef NEED_DYNAMIC + +#ifdef _WIN32 +#include +#include +#else +#include +#endif + +#ifdef _WIN32 +static char last_dyn_error[512]; + +static void set_dl_error(void) +{ + DWORD err = GetLastError(); + + if (FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + err, + MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT), + last_dyn_error, + sizeof(last_dyn_error) - 1, + NULL) == 0) + snprintf(last_dyn_error, sizeof(last_dyn_error) - 1, + "unknown error %lu", err); +} +#endif + +/** + * dylib_load: + * @path : Path to libretro core library. + * + * Platform independent dylib loading. + * + * Returns: library handle on success, otherwise NULL. + **/ +dylib_t dylib_load(const char *path) +{ +#ifdef _WIN32 + int prevmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); + dylib_t lib = LoadLibrary(path); + + SetErrorMode(prevmode); + + if (!lib) + { + set_dl_error(); + return NULL; + } + last_dyn_error[0] = 0; +#else + dylib_t lib = dlopen(path, RTLD_LAZY); +#endif + return lib; +} + +char *dylib_error(void) +{ +#ifdef _WIN32 + if (last_dyn_error[0]) + return last_dyn_error; + return NULL; +#else + return (char*)dlerror(); +#endif +} + +function_t dylib_proc(dylib_t lib, const char *proc) +{ + function_t sym; + void *ptr_sym = NULL; + +#ifdef _WIN32 + sym = (function_t)GetProcAddress(lib ? + (HMODULE)lib : GetModuleHandle(NULL), proc); + if (!sym) + { + set_dl_error(); + return NULL; + } + last_dyn_error[0] = 0; +#else + if (lib) + ptr_sym = dlsym(lib, proc); + else + { + void *handle = dlopen(NULL, RTLD_LAZY); + if (handle) + { + ptr_sym = dlsym(handle, proc); + dlclose(handle); + } + } + + /* Dirty hack to workaround the non-legality of + * (void*) -> fn-pointer casts. */ + memcpy(&sym, &ptr_sym, sizeof(void*)); +#endif + + return sym; +} + +/** + * dylib_close: + * @lib : Library handle. + * + * Frees library handle. + **/ +void dylib_close(dylib_t lib) +{ +#ifdef _WIN32 + if (!FreeLibrary((HMODULE)lib)) + set_dl_error(); + last_dyn_error[0] = 0; +#else +#ifndef NO_DLCLOSE + dlclose(lib); +#endif +#endif +} + +#endif diff --git a/desmume/src/libretro-common/file/config_file.c b/desmume/src/libretro-common/file/config_file.c new file mode 100644 index 000000000..e0903f7c7 --- /dev/null +++ b/desmume/src/libretro-common/file/config_file.c @@ -0,0 +1,884 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (config_file.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include + +#if !defined(_WIN32) && !defined(__CELLOS_LV2__) && !defined(_XBOX) +#include /* PATH_MAX */ +#elif defined(_WIN32) && !defined(_XBOX) +#define WIN32_LEAN_AND_MEAN +#include +#elif defined(_XBOX) +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_INCLUDE_DEPTH 16 + +static config_file_t *config_file_new_internal(const char *path, unsigned depth); +void config_file_free(config_file_t *conf); + +static char *getaline(FILE *file) +{ + char* newline = (char*)malloc(9); + char* newline_tmp = NULL; + size_t cur_size = 8; + size_t idx = 0; + int in = getc(file); + + if (!newline) + return NULL; + + while (in != EOF && in != '\n') + { + if (idx == cur_size) + { + cur_size *= 2; + newline_tmp = (char*)realloc(newline, cur_size + 1); + + if (!newline_tmp) + { + free(newline); + return NULL; + } + + newline = newline_tmp; + } + + newline[idx++] = in; + in = getc(file); + } + newline[idx] = '\0'; + return newline; +} + +static char *extract_value(char *line, bool is_value) +{ + char *save = NULL; + char *tok = NULL; + + if (is_value) + { + while (isspace((int)*line)) + line++; + + /* If we don't have an equal sign here, + * we've got an invalid string. */ + if (*line != '=') + return NULL; + + line++; + } + + while (isspace((int)*line)) + line++; + + /* We have a full string. Read until next ". */ + if (*line == '"') + { + line++; + tok = strtok_r(line, "\"", &save); + if (!tok) + return NULL; + return strdup(tok); + } + else if (*line == '\0') /* Nothing */ + return NULL; + + /* We don't have that. Read until next space. */ + tok = strtok_r(line, " \n\t\f\r\v", &save); + if (tok) + return strdup(tok); + return NULL; +} + +static void set_list_readonly(struct config_entry_list *list) +{ + while (list) + { + list->readonly = true; + list = list->next; + } +} + +/* Move semantics? */ +static void add_child_list(config_file_t *parent, config_file_t *child) +{ + if (parent->entries) + { + struct config_entry_list *head = parent->entries; + while (head->next) + head = head->next; + + set_list_readonly(child->entries); + head->next = child->entries; + } + else + { + set_list_readonly(child->entries); + parent->entries = child->entries; + } + + child->entries = NULL; + + /* Rebase tail. */ + if (parent->entries) + { + struct config_entry_list *head = + (struct config_entry_list*)parent->entries; + + while (head->next) + head = head->next; + parent->tail = head; + } + else + parent->tail = NULL; +} + +static void add_include_list(config_file_t *conf, const char *path) +{ + struct config_include_list *head = conf->includes; + struct config_include_list *node = (struct config_include_list*)calloc(1, sizeof(*node)); + + if (!node) + return; + + node->path = strdup(path); + + if (head) + { + while (head->next) + head = head->next; + + head->next = node; + } + else + conf->includes = node; +} + +static void add_sub_conf(config_file_t *conf, char *line) +{ + char real_path[PATH_MAX_LENGTH] = {0}; + config_file_t *sub_conf = NULL; + char *path = extract_value(line, false); + + if (!path) + return; + + add_include_list(conf, path); + +#ifdef _WIN32 + fill_pathname_resolve_relative(real_path, conf->path, + path, sizeof(real_path)); +#else +#ifndef __CELLOS_LV2__ + if (*path == '~') + { + const char *home = getenv("HOME"); + strlcpy(real_path, home ? home : "", sizeof(real_path)); + strlcat(real_path, path + 1, sizeof(real_path)); + } + else +#endif + fill_pathname_resolve_relative(real_path, conf->path, + path, sizeof(real_path)); +#endif + + sub_conf = (config_file_t*) + config_file_new_internal(real_path, conf->include_depth + 1); + if (!sub_conf) + { + free(path); + return; + } + + /* Pilfer internal list. */ + add_child_list(conf, sub_conf); + config_file_free(sub_conf); + free(path); +} + +static char *strip_comment(char *str) +{ + /* Remove everything after comment. + * Keep #s inside string literals. */ + char *strend = str + strlen(str); + bool cut_comment = true; + + while (*str) + { + char *comment = NULL; + char *literal = strchr(str, '\"'); + if (!literal) + literal = strend; + comment = (char*)strchr(str, '#'); + if (!comment) + comment = strend; + + if (cut_comment && literal < comment) + { + cut_comment = false; + str = literal + 1; + } + else if (!cut_comment && literal) + { + cut_comment = true; + str = literal + 1; + } + else if (comment) + { + *comment = '\0'; + str = comment; + } + else + str = strend; + } + + return str; +} + +static bool parse_line(config_file_t *conf, + struct config_entry_list *list, char *line) +{ + char *comment = NULL; + char *key = (char*)malloc(9); + char *key_tmp = NULL; + size_t cur_size = 8; + size_t idx = 0; + + if (!key) + return false; + + if (!line || !*line) + { + free(key); + return false; + } + + comment = strip_comment(line); + + /* Starting line with # and include includes config files. */ + if ((comment == line) && (conf->include_depth < MAX_INCLUDE_DEPTH)) + { + comment++; + if (strstr(comment, "include ") == comment) + { + add_sub_conf(conf, comment + strlen("include ")); + free(key); + return false; + } + } + else if (conf->include_depth >= MAX_INCLUDE_DEPTH) + { + fprintf(stderr, "!!! #include depth exceeded for config. Might be a cycle.\n"); + } + + /* Skips to first character. */ + while (isspace((int)*line)) + line++; + + while (isgraph((int)*line)) + { + if (idx == cur_size) + { + cur_size *= 2; + key_tmp = (char*)realloc(key, cur_size + 1); + + if (!key_tmp) + { + free(key); + return false; + } + + key = key_tmp; + } + + key[idx++] = *line++; + } + key[idx] = '\0'; + list->key = key; + list->key_hash = djb2_calculate(key); + + list->value = extract_value(line, true); + if (!list->value) + { + list->key = NULL; + free(key); + return false; + } + + return true; +} + +bool config_append_file(config_file_t *conf, const char *path) +{ + config_file_t *new_conf = config_file_new(path); + if (!new_conf) + return false; + + if (new_conf->tail) + { + new_conf->tail->next = conf->entries; + conf->entries = new_conf->entries; /* Pilfer. */ + new_conf->entries = NULL; + } + + config_file_free(new_conf); + return true; +} + +static config_file_t *config_file_new_internal( + const char *path, unsigned depth) +{ + FILE *file = NULL; + struct config_file *conf = (struct config_file*)calloc(1, sizeof(*conf)); + if (!conf) + return NULL; + + if (!path || !*path) + return conf; + + if (path_is_directory(path)) + goto error; + + conf->path = strdup(path); + if (!conf->path) + goto error; + + conf->include_depth = depth; + file = fopen(path, "r"); + + if (!file) + { + free(conf->path); + goto error; + } + + while (!feof(file)) + { + struct config_entry_list *list = (struct config_entry_list*) + calloc(1, sizeof(*list)); + char *line = NULL; + + if (!list) + { + config_file_free(conf); + fclose(file); + return NULL; + } + + line = getaline(file); + + if (line) + { + if (parse_line(conf, list, line)) + { + if (conf->entries) + conf->tail->next = list; + else + conf->entries = list; + + conf->tail = list; + } + + free(line); + } + else + { + free(list); + continue; + } + + if (list != conf->tail) + free(list); + } + + fclose(file); + + return conf; + +error: + free(conf); + + return NULL; +} + +config_file_t *config_file_new_from_string(const char *from_string) +{ + size_t i; + struct string_list *lines = NULL; + struct config_file *conf = (struct config_file*)calloc(1, sizeof(*conf)); + if (!conf) + return NULL; + + if (!from_string) + return conf; + + conf->path = NULL; + conf->include_depth = 0; + + lines = string_split(from_string, "\n"); + if (!lines) + return conf; + + for (i = 0; i < lines->size; i++) + { + struct config_entry_list *list = (struct config_entry_list*) + calloc(1, sizeof(*list)); + char* line = lines->elems[i].data; + + if (!list) + { + string_list_free(lines); + config_file_free(conf); + return NULL; + } + + if (line) + { + if (parse_line(conf, list, line)) + { + if (conf->entries) + conf->tail->next = list; + else + conf->entries = list; + + conf->tail = list; + } + } + + if (list != conf->tail) + free(list); + } + + string_list_free(lines); + + return conf; +} + +config_file_t *config_file_new(const char *path) +{ + return config_file_new_internal(path, 0); +} + +void config_file_free(config_file_t *conf) +{ + struct config_include_list *inc_tmp = NULL; + struct config_entry_list *tmp = NULL; + if (!conf) + return; + + tmp = conf->entries; + while (tmp) + { + struct config_entry_list *hold = NULL; + free(tmp->key); + free(tmp->value); + hold = tmp; + tmp = tmp->next; + free(hold); + } + + inc_tmp = (struct config_include_list*)conf->includes; + while (inc_tmp) + { + struct config_include_list *hold = NULL; + free(inc_tmp->path); + hold = (struct config_include_list*)inc_tmp; + inc_tmp = inc_tmp->next; + free(hold); + } + + free(conf->path); + free(conf); +} + +static struct config_entry_list *config_get_entry(const config_file_t *conf, + const char *key, struct config_entry_list **prev) +{ + struct config_entry_list *entry; + struct config_entry_list *previous = NULL; + + uint32_t hash = djb2_calculate(key); + + if (prev) + previous = *prev; + + for (entry = conf->entries; entry; entry = entry->next) + { + if (hash == entry->key_hash && !strcmp(key, entry->key)) + return entry; + + previous = entry; + } + + if (prev) + *prev = previous; + + return NULL; +} + +bool config_get_double(config_file_t *conf, const char *key, double *in) +{ + const struct config_entry_list *entry = config_get_entry(conf, key, NULL); + + if (entry) + *in = strtod(entry->value, NULL); + + return entry != NULL; +} + +bool config_get_float(config_file_t *conf, const char *key, float *in) +{ + const struct config_entry_list *entry = config_get_entry(conf, key, NULL); + + if (entry) + { + /* strtof() is C99/POSIX. Just use the more portable kind. */ + *in = (float)strtod(entry->value, NULL); + } + + return entry != NULL; +} + +bool config_get_int(config_file_t *conf, const char *key, int *in) +{ + const struct config_entry_list *entry = config_get_entry(conf, key, NULL); + errno = 0; + + if (entry) + { + int val = strtol(entry->value, NULL, 0); + + if (errno == 0) + *in = val; + } + + return entry != NULL && errno == 0; +} + +bool config_get_uint64(config_file_t *conf, const char *key, uint64_t *in) +{ + const struct config_entry_list *entry = config_get_entry(conf, key, NULL); + errno = 0; + + if (entry) + { + uint64_t val = strtoull(entry->value, NULL, 0); + + if (errno == 0) + *in = val; + } + + return entry != NULL && errno == 0; +} + +bool config_get_uint(config_file_t *conf, const char *key, unsigned *in) +{ + const struct config_entry_list *entry = config_get_entry(conf, key, NULL); + errno = 0; + + if (entry) + { + unsigned val = strtoul(entry->value, NULL, 0); + + if (errno == 0) + *in = val; + } + + return entry != NULL && errno == 0; +} + +bool config_get_hex(config_file_t *conf, const char *key, unsigned *in) +{ + const struct config_entry_list *entry = config_get_entry(conf, key, NULL); + errno = 0; + + if (entry) + { + unsigned val = strtoul(entry->value, NULL, 16); + + if (errno == 0) + *in = val; + } + + return entry != NULL && errno == 0; +} + +bool config_get_char(config_file_t *conf, const char *key, char *in) +{ + const struct config_entry_list *entry = config_get_entry(conf, key, NULL); + + if (entry) + { + if (entry->value[0] && entry->value[1]) + return false; + + *in = *entry->value; + } + + return entry != NULL; +} + +bool config_get_string(config_file_t *conf, const char *key, char **str) +{ + const struct config_entry_list *entry = config_get_entry(conf, key, NULL); + + if (entry) + *str = strdup(entry->value); + + return entry != NULL; +} + +bool config_get_array(config_file_t *conf, const char *key, + char *buf, size_t size) +{ + const struct config_entry_list *entry = config_get_entry(conf, key, NULL); + + if (entry) + return strlcpy(buf, entry->value, size) < size; + + return entry != NULL; +} + +bool config_get_path(config_file_t *conf, const char *key, + char *buf, size_t size) +{ +#if defined(RARCH_CONSOLE) + return config_get_array(conf, key, buf, size); +#else + const struct config_entry_list *entry = config_get_entry(conf, key, NULL); + + if (entry) + fill_pathname_expand_special(buf, entry->value, size); + + return entry != NULL; +#endif +} + +bool config_get_bool(config_file_t *conf, const char *key, bool *in) +{ + const struct config_entry_list *entry = config_get_entry(conf, key, NULL); + + if (entry) + { + if (strcasecmp(entry->value, "true") == 0) + *in = true; + else if (strcasecmp(entry->value, "1") == 0) + *in = true; + else if (strcasecmp(entry->value, "false") == 0) + *in = false; + else if (strcasecmp(entry->value, "0") == 0) + *in = false; + else + return false; + } + + return entry != NULL; +} + +void config_set_string(config_file_t *conf, const char *key, const char *val) +{ + struct config_entry_list *last = conf->entries; + struct config_entry_list *entry = config_get_entry(conf, key, &last); + + if (entry && !entry->readonly) + { + free(entry->value); + entry->value = strdup(val); + return; + } + + entry = (struct config_entry_list*)calloc(1, sizeof(*entry)); + + if (!entry) + return; + + entry->key = strdup(key); + entry->value = strdup(val); + + if (last) + last->next = entry; + else + conf->entries = entry; +} + +void config_set_path(config_file_t *conf, const char *entry, const char *val) +{ +#if defined(RARCH_CONSOLE) + config_set_string(conf, entry, val); +#else + char buf[PATH_MAX_LENGTH] = {0}; + fill_pathname_abbreviate_special(buf, val, sizeof(buf)); + config_set_string(conf, entry, buf); +#endif +} + +void config_set_double(config_file_t *conf, const char *key, double val) +{ + char buf[128] = {0}; +#ifdef __cplusplus + snprintf(buf, sizeof(buf), "%f", (float)val); +#else + snprintf(buf, sizeof(buf), "%lf", val); +#endif + config_set_string(conf, key, buf); +} + +void config_set_float(config_file_t *conf, const char *key, float val) +{ + char buf[128] = {0}; + snprintf(buf, sizeof(buf), "%f", val); + config_set_string(conf, key, buf); +} + +void config_set_int(config_file_t *conf, const char *key, int val) +{ + char buf[128] = {0}; + snprintf(buf, sizeof(buf), "%d", val); + config_set_string(conf, key, buf); +} + +void config_set_hex(config_file_t *conf, const char *key, unsigned val) +{ + char buf[128] = {0}; + snprintf(buf, sizeof(buf), "%x", val); + config_set_string(conf, key, buf); +} + +void config_set_uint64(config_file_t *conf, const char *key, uint64_t val) +{ + char buf[128] = {0}; +#ifdef _WIN32 + snprintf(buf, sizeof(buf), "%I64u", val); +#else + snprintf(buf, sizeof(buf), "%llu", (long long unsigned)val); +#endif + config_set_string(conf, key, buf); +} + +void config_set_char(config_file_t *conf, const char *key, char val) +{ + char buf[2] = {0}; + snprintf(buf, sizeof(buf), "%c", val); + config_set_string(conf, key, buf); +} + +void config_set_bool(config_file_t *conf, const char *key, bool val) +{ + config_set_string(conf, key, val ? "true" : "false"); +} + +bool config_file_write(config_file_t *conf, const char *path) +{ + FILE *file; + + if (path) + { + file = fopen(path, "w"); + if (!file) + return false; + } + else + file = stdout; + + config_file_dump(conf, file); + + if (path) + fclose(file); + + return true; +} + +void config_file_dump(config_file_t *conf, FILE *file) +{ + struct config_entry_list *list = NULL; + struct config_include_list *includes = conf->includes; + while (includes) + { + fprintf(file, "#include \"%s\"\n", includes->path); + includes = includes->next; + } + + list = (struct config_entry_list*)conf->entries; + while (list) + { + if (!list->readonly) + fprintf(file, "%s = \"%s\"\n", list->key, list->value); + list = list->next; + } +} + +bool config_entry_exists(config_file_t *conf, const char *entry) +{ + struct config_entry_list *list = conf->entries; + + while (list) + { + if (!strcmp(entry, list->key)) + return true; + list = list->next; + } + + return false; +} + +bool config_get_entry_list_head(config_file_t *conf, + struct config_file_entry *entry) +{ + const struct config_entry_list *head = conf->entries; + + if (!head) + return false; + + entry->key = head->key; + entry->value = head->value; + entry->next = head->next; + return true; +} + +bool config_get_entry_list_next(struct config_file_entry *entry) +{ + const struct config_entry_list *next = entry->next; + + if (!next) + return false; + + entry->key = next->key; + entry->value = next->value; + entry->next = next->next; + return true; +} + diff --git a/desmume/src/libretro-common/file/config_file_userdata.c b/desmume/src/libretro-common/file/config_file_userdata.c new file mode 100644 index 000000000..1b5b403b7 --- /dev/null +++ b/desmume/src/libretro-common/file/config_file_userdata.c @@ -0,0 +1,128 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (config_file_userdata.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include + +#define get_array_setup() \ + char key[2][256]; \ + bool got; \ + struct config_file_userdata *usr = (struct config_file_userdata*)userdata; \ + char *str = NULL; \ + fill_pathname_join_delim(key[0], usr->prefix[0], key_str, '_', sizeof(key[0])); \ + fill_pathname_join_delim(key[1], usr->prefix[1], key_str, '_', sizeof(key[1])); \ + got = config_get_string(usr->conf, key[0], &str); \ + got = got || config_get_string(usr->conf, key[1], &str); + +#define get_array_body(T) \ + if (got) \ + { \ + unsigned i; \ + struct string_list *list = string_split(str, " "); \ + *values = (T*)calloc(list->size, sizeof(T)); \ + for (i = 0; i < list->size; i++) \ + (*values)[i] = (T)strtod(list->elems[i].data, NULL); \ + *out_num_values = list->size; \ + string_list_free(list); \ + return true; \ + } \ + else \ + { \ + *values = (T*)calloc(num_default_values, sizeof(T)); \ + memcpy(*values, default_values, sizeof(T) * num_default_values); \ + *out_num_values = num_default_values; \ + return false; \ + } + +int config_userdata_get_float(void *userdata, const char *key_str, + float *value, float default_value) +{ + bool got; + char key[2][256]; + struct config_file_userdata *usr = (struct config_file_userdata*)userdata; + + fill_pathname_join_delim(key[0], usr->prefix[0], key_str, '_', sizeof(key[0])); + fill_pathname_join_delim(key[1], usr->prefix[1], key_str, '_', sizeof(key[1])); + + got = config_get_float (usr->conf, key[0], value); + got = got || config_get_float(usr->conf, key[1], value); + + if (!got) + *value = default_value; + return got; +} + +int config_userdata_get_int(void *userdata, const char *key_str, + int *value, int default_value) +{ + bool got; + char key[2][256]; + struct config_file_userdata *usr = (struct config_file_userdata*)userdata; + + fill_pathname_join_delim(key[0], usr->prefix[0], key_str, '_', sizeof(key[0])); + fill_pathname_join_delim(key[1], usr->prefix[1], key_str, '_', sizeof(key[1])); + + got = config_get_int (usr->conf, key[0], value); + got = got || config_get_int(usr->conf, key[1], value); + + if (!got) + *value = default_value; + return got; +} + +int config_userdata_get_float_array(void *userdata, const char *key_str, + float **values, unsigned *out_num_values, + const float *default_values, unsigned num_default_values) +{ + get_array_setup() + get_array_body(float) +} + +int config_userdata_get_int_array(void *userdata, const char *key_str, + int **values, unsigned *out_num_values, + const int *default_values, unsigned num_default_values) +{ + get_array_setup() + get_array_body(int) +} + +int config_userdata_get_string(void *userdata, const char *key_str, + char **output, const char *default_output) +{ + get_array_setup() + + if (got) + { + *output = str; + return true; + } + + *output = strdup(default_output); + return false; +} + +void config_userdata_free(void *ptr) +{ + if (ptr) + free(ptr); +} diff --git a/desmume/src/libretro-common/file/dir_list.c b/desmume/src/libretro-common/file/dir_list.c new file mode 100644 index 000000000..60c12fe37 --- /dev/null +++ b/desmume/src/libretro-common/file/dir_list.c @@ -0,0 +1,213 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (dir_list.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include + +#include +#include +#include + +#include +#include + +#include + +static int qstrcmp_plain(const void *a_, const void *b_) +{ + const struct string_list_elem *a = (const struct string_list_elem*)a_; + const struct string_list_elem *b = (const struct string_list_elem*)b_; + + return strcasecmp(a->data, b->data); +} + +static int qstrcmp_dir(const void *a_, const void *b_) +{ + const struct string_list_elem *a = (const struct string_list_elem*)a_; + const struct string_list_elem *b = (const struct string_list_elem*)b_; + int a_type = a->attr.i; + int b_type = b->attr.i; + + + /* Sort directories before files. */ + if (a_type != b_type) + return b_type - a_type; + return strcasecmp(a->data, b->data); +} + +/** + * dir_list_sort: + * @list : pointer to the directory listing. + * @dir_first : move the directories in the listing to the top? + * + * Sorts a directory listing. + * + **/ +void dir_list_sort(struct string_list *list, bool dir_first) +{ + if (list) + qsort(list->elems, list->size, sizeof(struct string_list_elem), + dir_first ? qstrcmp_dir : qstrcmp_plain); +} + +/** + * dir_list_free: + * @list : pointer to the directory listing + * + * Frees a directory listing. + * + **/ +void dir_list_free(struct string_list *list) +{ + string_list_free(list); +} + +/** + * parse_dir_entry: + * @name : name of the directory listing entry. + * @file_path : file path of the directory listing entry. + * @is_dir : is the directory listing a directory? + * @include_dirs : include directories as part of the finished directory listing? + * @include_compressed : Include compressed files, even if not part of ext_list. + * @list : pointer to directory listing. + * @ext_list : pointer to allowed file extensions listing. + * @file_ext : file extension of the directory listing entry. + * + * Parses a directory listing. + * + * Returns: zero on success, -1 on error, 1 if we should + * continue to the next entry in the directory listing. + **/ +static int parse_dir_entry(const char *name, char *file_path, + bool is_dir, bool include_dirs, bool include_compressed, + struct string_list *list, struct string_list *ext_list, + const char *file_ext) +{ + union string_list_elem_attr attr; + bool is_compressed_file = false; + bool supported_by_core = false; + + attr.i = RARCH_FILETYPE_UNSET; + + if (!is_dir) + { + is_compressed_file = path_is_compressed_file(file_path); + if (string_list_find_elem_prefix(ext_list, ".", file_ext)) + supported_by_core = true; + } + + if (!include_dirs && is_dir) + return 1; + + if (!strcmp(name, ".") || !strcmp(name, "..")) + return 1; + + if (!is_dir && ext_list && + ((!is_compressed_file && !supported_by_core) || + (!supported_by_core && !include_compressed))) + return 1; + + if (is_dir) + attr.i = RARCH_DIRECTORY; + if (is_compressed_file) + attr.i = RARCH_COMPRESSED_ARCHIVE; + /* The order of these ifs is important. + * If the file format is explicitly supported by the libretro-core, we + * need to immediately load it and not designate it as a compressed file. + * + * Example: .zip could be supported as a image by the core and as a + * compressed_file. In that case, we have to interpret it as a image. + * + * */ + if (supported_by_core) + attr.i = RARCH_PLAIN_FILE; + + if (!string_list_append(list, file_path, attr)) + return -1; + + return 0; +} + +/** + * dir_list_new: + * @dir : directory path. + * @ext : allowed extensions of file directory entries to include. + * @include_dirs : include directories as part of the finished directory listing? + * @include_compressed : Only include files which match ext. Do not try to match compressed files, etc. + * + * Create a directory listing. + * + * Returns: pointer to a directory listing of type 'struct string_list *' on success, + * NULL in case of error. Has to be freed manually. + **/ +struct string_list *dir_list_new(const char *dir, + const char *ext, bool include_dirs, bool include_compressed) +{ + struct RDIR *entry = NULL; + struct string_list *ext_list = NULL; + struct string_list *list = NULL; + + if (!(list = string_list_new())) + return NULL; + + if (ext) + ext_list = string_split(ext, "|"); + + entry = retro_opendir(dir); + + if (!entry) + goto error; + + if (retro_dirent_error(entry)) + goto error; + + while (retro_readdir(entry)) + { + char file_path[PATH_MAX_LENGTH]; + int ret = 0; + const char *name = retro_dirent_get_name(entry); + bool is_dir = retro_dirent_is_dir(entry, file_path); + const char *file_ext = path_get_extension(name); + + fill_pathname_join(file_path, dir, name, sizeof(file_path)); + + ret = parse_dir_entry(name, file_path, is_dir, + include_dirs, include_compressed, list, ext_list, file_ext); + + if (ret == -1) + goto error; + + if (ret == 1) + continue; + } + + retro_closedir(entry); + + string_list_free(ext_list); + return list; + +error: + retro_closedir(entry); + + string_list_free(list); + string_list_free(ext_list); + return NULL; +} diff --git a/desmume/src/libretro-common/file/dir_list_obj.m b/desmume/src/libretro-common/file/dir_list_obj.m new file mode 100644 index 000000000..1eddbb52e --- /dev/null +++ b/desmume/src/libretro-common/file/dir_list_obj.m @@ -0,0 +1,230 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (dir_list.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +static int qstrcmp_plain(const void *a_, const void *b_) +{ + const struct string_list_elem *a = (const struct string_list_elem*)a_; + const struct string_list_elem *b = (const struct string_list_elem*)b_; + + return strcasecmp(a->data, b->data); +} + +static int qstrcmp_dir(const void *a_, const void *b_) +{ + const struct string_list_elem *a = (const struct string_list_elem*)a_; + const struct string_list_elem *b = (const struct string_list_elem*)b_; + int a_type = a->attr.i; + int b_type = b->attr.i; + + + /* Sort directories before files. */ + if (a_type != b_type) + return b_type - a_type; + return strcasecmp(a->data, b->data); +} + +/** + * dir_list_sort: + * @list : pointer to the directory listing. + * @dir_first : move the directories in the listing to the top? + * + * Sorts a directory listing. + * + **/ +void dir_list_sort(struct string_list *list, bool dir_first) +{ + if (list) + qsort(list->elems, list->size, sizeof(struct string_list_elem), + dir_first ? qstrcmp_dir : qstrcmp_plain); +} + +/** + * dir_list_free: + * @list : pointer to the directory listing + * + * Frees a directory listing. + * + **/ +void dir_list_free(struct string_list *list) +{ + string_list_free(list); +} + +/** + * + * dirent_is_directory: + * @path : path to the directory entry. + * @entry : pointer to the directory entry. + * + * Is the directory listing entry a directory? + * + * Returns: true if directory listing entry is + * a directory, false if not. + */ + +static bool dirent_is_directory(const char *path) +{ + BOOL is_directory; + BOOL file_exists_at_path = [[NSFileManager defaultManager] fileExistsAtPath:@(path) isDirectory:&is_directory]; + + (void)file_exists_at_path; + + return is_directory; +} + +/** + * parse_dir_entry: + * @name : name of the directory listing entry. + * @file_path : file path of the directory listing entry. + * @is_dir : is the directory listing a directory? + * @include_dirs : include directories as part of the finished directory listing? + * @include_compressed : include compressed files, even when not part of ext_list. + * @list : pointer to directory listing. + * @ext_list : pointer to allowed file extensions listing. + * @file_ext : file extension of the directory listing entry. + * + * Parses a directory listing. + * + * Returns: zero on success, -1 on error, 1 if we should + * continue to the next entry in the directory listing. + **/ +static int parse_dir_entry(const char *name, char *file_path, + bool is_dir, bool include_dirs, bool include_compressed, + struct string_list *list, struct string_list *ext_list, + const char *file_ext) +{ + union string_list_elem_attr attr; + bool is_compressed_file = false; + bool supported_by_core = false; + + attr.i = RARCH_FILETYPE_UNSET; + + if (!is_dir) + { + is_compressed_file = path_is_compressed_file(file_path); + if (string_list_find_elem_prefix(ext_list, ".", file_ext)) + supported_by_core = true; + } + + if (!include_dirs && is_dir) + return 1; + + if (!strcmp(name, ".") || !strcmp(name, "..")) + return 1; + + if (!is_dir && ext_list && + ((!is_compressed_file && !supported_by_core) || + (!supported_by_core && !include_compressed))) + return 1; + + if (is_dir) + attr.i = RARCH_DIRECTORY; + if (is_compressed_file) + attr.i = RARCH_COMPRESSED_ARCHIVE; + /* The order of these ifs is important. + * If the file format is explicitly supported by the libretro-core, we + * need to immediately load it and not designate it as a compressed file. + * + * Example: .zip could be supported as a image by the core and as a + * compressed_file. In that case, we have to interpret it as a image. + * + * */ + if (supported_by_core) + attr.i = RARCH_PLAIN_FILE; + + if (!string_list_append(list, file_path, attr)) + return -1; + + return 0; +} + +/** + * dir_list_new: + * @dir : directory path. + * @ext : allowed extensions of file directory entries to include. + * @include_dirs : include directories as part of the finished directory listing? + * @include_compressed : Include compressed files, even if not part of ext. + * + * Create a directory listing. + * + * Returns: pointer to a directory listing of type 'struct string_list *' on success, + * NULL in case of error. Has to be freed manually. + **/ +struct string_list *dir_list_new(const char *dir, + const char *ext, bool include_dirs, bool include_compressed) +{ + NSArray *entries = NULL; + char path_buf[PATH_MAX_LENGTH] = {0}; + struct string_list *ext_list = NULL; + struct string_list *list = NULL; + + (void)path_buf; + + if (!(list = string_list_new())) + return NULL; + + if (ext) + ext_list = string_split(ext, "|"); + + entries = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:@(dir) error:nil]; + + for (NSString *name in entries) + { + int ret = 0; + char file_path[PATH_MAX_LENGTH] = {0}; + const char *file_ext = path_get_extension([name UTF8String]); + bool is_dir = false; + + fill_pathname_join(file_path, dir, [name UTF8String], sizeof(file_path)); + + is_dir = dirent_is_directory(file_path); + + ret = parse_dir_entry([name UTF8String], file_path, is_dir, + include_dirs, include_compressed, list, ext_list, file_ext); + + if (ret == -1) + goto error; + + if (ret == 1) + continue; + } + + string_list_free(ext_list); + return list; + +error: + string_list_free(list); + string_list_free(ext_list); + return NULL; +} diff --git a/desmume/src/libretro-common/file/file_extract.c b/desmume/src/libretro-common/file/file_extract.c new file mode 100644 index 000000000..802c0c8e7 --- /dev/null +++ b/desmume/src/libretro-common/file/file_extract.c @@ -0,0 +1,899 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (file_extract.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +/* File backends. Can be fleshed out later, but keep it simple for now. + * The file is mapped to memory directly (via mmap() or just + * plain retro_read_file()). + */ + +struct zlib_file_backend +{ + void *(*open)(const char *path); + const uint8_t *(*data)(void *handle); + size_t (*size)(void *handle); + void (*free)(void *handle); /* Closes, unmaps and frees. */ +}; + +#ifndef CENTRAL_FILE_HEADER_SIGNATURE +#define CENTRAL_FILE_HEADER_SIGNATURE 0x02014b50 +#endif + +#ifndef END_OF_CENTRAL_DIR_SIGNATURE +#define END_OF_CENTRAL_DIR_SIGNATURE 0x06054b50 +#endif + +#ifdef HAVE_MMAP +#include +#include +#include + +#include +#include + +typedef struct +{ + int fd; + void *data; + size_t size; +} zlib_file_data_t; + +static void zlib_file_free(void *handle) +{ + zlib_file_data_t *data = (zlib_file_data_t*)handle; + + if (!data) + return; + + if (data->data) + munmap(data->data, data->size); + if (data->fd >= 0) + close(data->fd); + free(data); +} + +static const uint8_t *zlib_file_data(void *handle) +{ + zlib_file_data_t *data = (zlib_file_data_t*)handle; + if (!data) + return NULL; + return (const uint8_t*)data->data; +} + +static size_t zlib_file_size(void *handle) +{ + zlib_file_data_t *data = (zlib_file_data_t*)handle; + if (!data) + return 0; + return data->size; +} + +static void *zlib_file_open(const char *path) +{ + struct stat fds; + zlib_file_data_t *data = (zlib_file_data_t*)calloc(1, sizeof(*data)); + + if (!data) + return NULL; + + data->fd = open(path, O_RDONLY); + + if (data->fd < 0) + { + /* Failed to open archive. */ + goto error; + } + + if (fstat(data->fd, &fds) < 0) + goto error; + + data->size = fds.st_size; + if (!data->size) + return data; + + data->data = mmap(NULL, data->size, PROT_READ, MAP_SHARED, data->fd, 0); + if (data->data == MAP_FAILED) + { + data->data = NULL; + + /* Failed to mmap() file */ + goto error; + } + + return data; + +error: + zlib_file_free(data); + return NULL; +} +#else +typedef struct +{ + void *data; + size_t size; +} zlib_file_data_t; + +static void zlib_file_free(void *handle) +{ + zlib_file_data_t *data = (zlib_file_data_t*)handle; + if (!data) + return; + free(data->data); + free(data); +} + +static const uint8_t *zlib_file_data(void *handle) +{ + zlib_file_data_t *data = (zlib_file_data_t*)handle; + if (!data) + return NULL; + return (const uint8_t*)data->data; +} + +static size_t zlib_file_size(void *handle) +{ + zlib_file_data_t *data = (zlib_file_data_t*)handle; + if (!data) + return 0; + return data->size; +} + +static void *zlib_file_open(const char *path) +{ + ssize_t ret = -1; + bool read_from_file = false; + zlib_file_data_t *data = (zlib_file_data_t*)calloc(1, sizeof(*data)); + + if (!data) + return NULL; + + read_from_file = retro_read_file(path, &data->data, &ret); + + if (!read_from_file || ret < 0) + { + /* Failed to open archive. */ + goto error; + } + + data->size = ret; + return data; + +error: + zlib_file_free(data); + return NULL; +} +#endif + +static const struct zlib_file_backend zlib_backend = { + zlib_file_open, + zlib_file_data, + zlib_file_size, + zlib_file_free, +}; + +static const struct zlib_file_backend *zlib_get_default_file_backend(void) +{ + return &zlib_backend; +} + + +#undef GOTO_END_ERROR +#define GOTO_END_ERROR() do { \ + ret = false; \ + goto end; \ +} while(0) + +static uint32_t read_le(const uint8_t *data, unsigned size) +{ + unsigned i; + uint32_t val = 0; + + size *= 8; + for (i = 0; i < size; i += 8) + val |= *data++ << i; + + return val; +} + +void *zlib_stream_new(void) +{ + return (z_stream*)calloc(1, sizeof(z_stream)); +} + +bool zlib_inflate_init2(void *data) +{ + z_stream *stream = (z_stream*)data; + + if (!stream) + return false; + if (inflateInit2(stream, -MAX_WBITS) != Z_OK) + return false; + return true; +} + +void zlib_deflate_init(void *data, int level) +{ + z_stream *stream = (z_stream*)data; + + if (stream) + deflateInit(stream, level); +} + +bool zlib_inflate_init(void *data) +{ + z_stream *stream = (z_stream*)data; + + if (!stream) + return false; + if (inflateInit(stream) != Z_OK) + return false; + return true; +} + +void zlib_stream_free(void *data) +{ + z_stream *ret = (z_stream*)data; + if (ret) + inflateEnd(ret); +} + +void zlib_stream_deflate_free(void *data) +{ + z_stream *ret = (z_stream*)data; + if (ret) + deflateEnd(ret); +} + +bool zlib_inflate_data_to_file_init( + zlib_file_handle_t *handle, + const uint8_t *cdata, uint32_t csize, uint32_t size) +{ + z_stream *stream = NULL; + + if (!handle) + return false; + + if (!(handle->stream = (z_stream*)zlib_stream_new())) + goto error; + + if (!(zlib_inflate_init2(handle->stream))) + goto error; + + handle->data = (uint8_t*)malloc(size); + + if (!handle->data) + goto error; + + stream = (z_stream*)handle->stream; + + if (!stream) + goto error; + + zlib_set_stream(stream, + csize, + size, + (const uint8_t*)cdata, + handle->data + ); + + return true; + +error: + if (handle->stream) + zlib_stream_free(handle->stream); + if (handle->data) + free(handle->data); + + return false; +} + +int zlib_deflate_data_to_file(void *data) +{ + int zstatus; + z_stream *stream = (z_stream*)data; + + if (!stream) + return -1; + + zstatus = deflate(stream, Z_FINISH); + + if (zstatus == Z_STREAM_END) + return 1; + + return 0; +} + +int zlib_inflate_data_to_file_iterate(void *data) +{ + int zstatus; + z_stream *stream = (z_stream*)data; + + if (!stream) + return -1; + + zstatus = inflate(stream, Z_NO_FLUSH); + + if (zstatus == Z_STREAM_END) + return 1; + + if (zstatus != Z_OK && zstatus != Z_BUF_ERROR) + return -1; + + return 0; +} + +uint32_t zlib_crc32_calculate(const uint8_t *data, size_t length) +{ + return crc32(0, data, length); +} + +uint32_t zlib_crc32_adjust(uint32_t crc, uint8_t data) +{ + /* zlib and nall have different assumptions on "sign" for this + * function. */ + return ~crc32(~crc, &data, 1); +} + +/** + * zlib_inflate_data_to_file: + * @path : filename path of archive. + * @valid_exts : Valid extensions of archive to be parsed. + * If NULL, allow all. + * @cdata : input data. + * @csize : size of input data. + * @size : output file size + * @checksum : CRC32 checksum from input data. + * + * Decompress data to file. + * + * Returns: true (1) on success, otherwise false (0). + **/ +int zlib_inflate_data_to_file(zlib_file_handle_t *handle, + int ret, const char *path, const char *valid_exts, + const uint8_t *cdata, uint32_t csize, uint32_t size, uint32_t checksum) +{ + if (handle) + { + zlib_stream_free(handle->stream); + free(handle->stream); + } + + if (!handle || ret == -1) + { + ret = 0; + goto end; + } + + handle->real_checksum = zlib_crc32_calculate(handle->data, size); + +#if 0 + if (handle->real_checksum != checksum) + { + /* File CRC difers from ZIP CRC. */ + printf("File CRC differs from ZIP CRC. File: 0x%x, ZIP: 0x%x.\n", + (unsigned)handle->real_checksum, (unsigned)checksum); + } +#endif + + if (!retro_write_file(path, handle->data, size)) + GOTO_END_ERROR(); + +end: + if (handle->data) + free(handle->data); + return ret; +} + +static int zlib_parse_file_iterate_step_internal( + zlib_transfer_t *state, char *filename, + const uint8_t **cdata, + unsigned *cmode, uint32_t *size, uint32_t *csize, + uint32_t *checksum, unsigned *payback) +{ + uint32_t offset; + uint32_t namelength, extralength, commentlength, + offsetNL, offsetEL; + uint32_t signature = read_le(state->directory + 0, 4); + + if (signature != CENTRAL_FILE_HEADER_SIGNATURE) + return 0; + + *cmode = read_le(state->directory + 10, 2); + *checksum = read_le(state->directory + 16, 4); + *csize = read_le(state->directory + 20, 4); + *size = read_le(state->directory + 24, 4); + + namelength = read_le(state->directory + 28, 2); + extralength = read_le(state->directory + 30, 2); + commentlength = read_le(state->directory + 32, 2); + + if (namelength >= PATH_MAX_LENGTH) + return -1; + + memcpy(filename, state->directory + 46, namelength); + + offset = read_le(state->directory + 42, 4); + offsetNL = read_le(state->data + offset + 26, 2); + offsetEL = read_le(state->data + offset + 28, 2); + + *cdata = state->data + offset + 30 + offsetNL + offsetEL; + + *payback = 46 + namelength + extralength + commentlength; + + return 1; +} + +static int zlib_parse_file_iterate_step(zlib_transfer_t *state, + const char *valid_exts, void *userdata, zlib_file_cb file_cb) +{ + const uint8_t *cdata = NULL; + uint32_t checksum = 0; + uint32_t size = 0; + uint32_t csize = 0; + unsigned cmode = 0; + unsigned payload = 0; + char filename[PATH_MAX_LENGTH] = {0}; + int ret = zlib_parse_file_iterate_step_internal(state, filename, &cdata, &cmode, &size, &csize, + &checksum, &payload); + + if (ret != 1) + return ret; + +#if 0 + RARCH_LOG("OFFSET: %u, CSIZE: %u, SIZE: %u.\n", offset + 30 + + offsetNL + offsetEL, csize, size); +#endif + + if (!file_cb(filename, valid_exts, cdata, cmode, + csize, size, checksum, userdata)) + return 0; + + state->directory += payload; + + return 1; +} + +static int zlib_parse_file_init(zlib_transfer_t *state, + const char *file) +{ + state->backend = zlib_get_default_file_backend(); + + if (!state->backend) + return -1; + + state->handle = state->backend->open(file); + if (!state->handle) + return -1; + + state->zip_size = state->backend->size(state->handle); + if (state->zip_size < 22) + return -1; + + state->data = state->backend->data(state->handle); + state->footer = state->data + state->zip_size - 22; + + for (;; state->footer--) + { + if (state->footer <= state->data + 22) + return -1; + if (read_le(state->footer, 4) == END_OF_CENTRAL_DIR_SIGNATURE) + { + unsigned comment_len = read_le(state->footer + 20, 2); + if (state->footer + 22 + comment_len == state->data + state->zip_size) + break; + } + } + + state->directory = state->data + read_le(state->footer + 16, 4); + + return 0; +} + +int zlib_parse_file_iterate(void *data, bool *returnerr, const char *file, + const char *valid_exts, zlib_file_cb file_cb, void *userdata) +{ + zlib_transfer_t *state = (zlib_transfer_t*)data; + + if (!state) + return -1; + + switch (state->type) + { + case ZLIB_TRANSFER_NONE: + break; + case ZLIB_TRANSFER_INIT: + if (zlib_parse_file_init(state, file) == 0) + state->type = ZLIB_TRANSFER_ITERATE; + else + state->type = ZLIB_TRANSFER_DEINIT_ERROR; + break; + case ZLIB_TRANSFER_ITERATE: + { + int ret2 = zlib_parse_file_iterate_step(state, + valid_exts, userdata, file_cb); + if (ret2 != 1) + state->type = ZLIB_TRANSFER_DEINIT; + if (ret2 == -1) + state->type = ZLIB_TRANSFER_DEINIT_ERROR; + } + break; + case ZLIB_TRANSFER_DEINIT_ERROR: + *returnerr = false; + case ZLIB_TRANSFER_DEINIT: + if (state->handle) + { + state->backend->free(state->handle); + state->handle = NULL; + } + break; + } + + if (state->type == ZLIB_TRANSFER_DEINIT || + state->type == ZLIB_TRANSFER_DEINIT_ERROR) + return -1; + + return 0; +} + +void zlib_parse_file_iterate_stop(void *data) +{ + zlib_transfer_t *state = (zlib_transfer_t*)data; + if (!state || !state->handle) + return; + + state->type = ZLIB_TRANSFER_DEINIT; + zlib_parse_file_iterate(data, NULL, NULL, NULL, NULL, NULL); +} + +/** + * zlib_parse_file: + * @file : filename path of archive + * @valid_exts : Valid extensions of archive to be parsed. + * If NULL, allow all. + * @file_cb : file_cb function pointer + * @userdata : userdata to pass to file_cb function pointer. + * + * Low-level file parsing. Enumerates over all files and calls + * file_cb with userdata. + * + * Returns: true (1) on success, otherwise false (0). + **/ +bool zlib_parse_file(const char *file, const char *valid_exts, + zlib_file_cb file_cb, void *userdata) +{ + zlib_transfer_t state = {0}; + bool returnerr = true; + + state.type = ZLIB_TRANSFER_INIT; + + for (;;) + { + int ret = zlib_parse_file_iterate(&state, &returnerr, file, + valid_exts, file_cb, userdata); + + if (ret != 0) + break; + } + + return returnerr; +} + +struct zip_extract_userdata +{ + char *zip_path; + const char *extraction_directory; + size_t zip_path_size; + struct string_list *ext; + bool found_content; +}; + +enum zlib_compression_mode +{ + ZLIB_MODE_UNCOMPRESSED = 0, + ZLIB_MODE_DEFLATE = 8 +}; + +static int zip_extract_cb(const char *name, const char *valid_exts, + const uint8_t *cdata, + unsigned cmode, uint32_t csize, uint32_t size, + uint32_t checksum, void *userdata) +{ + struct zip_extract_userdata *data = (struct zip_extract_userdata*)userdata; + + /* Extract first content that matches our list. */ + const char *ext = path_get_extension(name); + + if (ext && string_list_find_elem(data->ext, ext)) + { + char new_path[PATH_MAX_LENGTH] = {0}; + + if (data->extraction_directory) + fill_pathname_join(new_path, data->extraction_directory, + path_basename(name), sizeof(new_path)); + else + fill_pathname_resolve_relative(new_path, data->zip_path, + path_basename(name), sizeof(new_path)); + + switch (cmode) + { + case ZLIB_MODE_UNCOMPRESSED: + data->found_content = retro_write_file(new_path, cdata, size); + return false; + case ZLIB_MODE_DEFLATE: + { + int ret = 0; + zlib_file_handle_t handle = {0}; + if (!zlib_inflate_data_to_file_init(&handle, cdata, csize, size)) + return 0; + + do{ + ret = zlib_inflate_data_to_file_iterate(handle.stream); + }while(ret == 0); + + if (zlib_inflate_data_to_file(&handle, ret, new_path, valid_exts, + cdata, csize, size, checksum)) + { + strlcpy(data->zip_path, new_path, data->zip_path_size); + data->found_content = true; + return 0; + } + return 0; + } + + default: + return 0; + } + } + + return 1; +} + +/** + * zlib_extract_first_content_file: + * @zip_path : filename path to ZIP archive. + * @zip_path_size : size of ZIP archive. + * @valid_exts : valid extensions for a content file. + * @extraction_directory : the directory to extract temporary + * unzipped content to. + * + * Extract first content file from archive. + * + * Returns : true (1) on success, otherwise false (0). + **/ +bool zlib_extract_first_content_file(char *zip_path, size_t zip_path_size, + const char *valid_exts, const char *extraction_directory) +{ + struct string_list *list; + bool ret = true; + struct zip_extract_userdata userdata = {0}; + + if (!valid_exts) + { + /* Libretro implementation does not have any valid extensions. + * Cannot unzip without knowing this. */ + return false; + } + + list = string_split(valid_exts, "|"); + if (!list) + GOTO_END_ERROR(); + + userdata.zip_path = zip_path; + userdata.zip_path_size = zip_path_size; + userdata.extraction_directory = extraction_directory; + userdata.ext = list; + + if (!zlib_parse_file(zip_path, valid_exts, zip_extract_cb, &userdata)) + { + /* Parsing ZIP failed. */ + GOTO_END_ERROR(); + } + + if (!userdata.found_content) + { + /* Didn't find any content that matched valid extensions + * for libretro implementation. */ + GOTO_END_ERROR(); + } + +end: + if (list) + string_list_free(list); + return ret; +} + +static int zlib_get_file_list_cb(const char *path, const char *valid_exts, + const uint8_t *cdata, + unsigned cmode, uint32_t csize, uint32_t size, uint32_t checksum, + void *userdata) +{ + union string_list_elem_attr attr; + struct string_list *ext_list = NULL; + const char *file_ext = NULL; + struct string_list *list = (struct string_list*)userdata; + + (void)cdata; + (void)cmode; + (void)csize; + (void)size; + (void)checksum; + (void)valid_exts; + (void)file_ext; + (void)ext_list; + + memset(&attr, 0, sizeof(attr)); + + if (valid_exts) + ext_list = string_split(valid_exts, "|"); + + if (ext_list) + { + char last_char = ' '; + + /* Checks if this entry is a directory or a file. */ + last_char = path[strlen(path)-1]; + + if (last_char == '/' || last_char == '\\' ) /* Skip if directory. */ + goto error; + + file_ext = path_get_extension(path); + + if (!file_ext || + !string_list_find_elem_prefix(ext_list, ".", file_ext)) + goto error; + + attr.i = RARCH_COMPRESSED_FILE_IN_ARCHIVE; + string_list_free(ext_list); + } + + return string_list_append(list, path, attr); +error: + string_list_free(ext_list); + return 0; +} + +/** + * zlib_get_file_list: + * @path : filename path of archive + * + * Returns: string listing of files from archive on success, otherwise NULL. + **/ +struct string_list *zlib_get_file_list(const char *path, const char *valid_exts) +{ + struct string_list *list = string_list_new(); + + if (!list) + return NULL; + + if (!zlib_parse_file(path, valid_exts, + zlib_get_file_list_cb, list)) + { + /* Parsing ZIP failed. */ + string_list_free(list); + return NULL; + } + + return list; +} + +bool zlib_perform_mode(const char *path, const char *valid_exts, + const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size, + uint32_t crc32, void *userdata) +{ + switch (cmode) + { + case 0: /* Uncompressed */ + if (!retro_write_file(path, cdata, size)) + return false; + break; + + case 8: /* Deflate */ + { + int ret = 0; + zlib_file_handle_t handle = {0}; + if (!zlib_inflate_data_to_file_init(&handle, cdata, csize, size)) + return false; + + do{ + ret = zlib_inflate_data_to_file_iterate(handle.stream); + }while(ret == 0); + + if (!zlib_inflate_data_to_file(&handle, ret, path, valid_exts, + cdata, csize, size, crc32)) + return false; + } + break; + default: + return false; + } + + return true; +} + +void zlib_set_stream(void *data, + uint32_t avail_in, + uint32_t avail_out, + const uint8_t *next_in, + uint8_t *next_out + ) +{ + z_stream *stream = (z_stream*)data; + + if (!stream) + return; + + stream->avail_in = avail_in; + stream->avail_out = avail_out; + + stream->next_in = (uint8_t*)next_in; + stream->next_out = next_out; +} + +uint32_t zlib_stream_get_avail_in(void *data) +{ + z_stream *stream = (z_stream*)data; + + if (!stream) + return 0; + + return stream->avail_in; +} + +uint32_t zlib_stream_get_avail_out(void *data) +{ + z_stream *stream = (z_stream*)data; + + if (!stream) + return 0; + + return stream->avail_out; +} + +uint64_t zlib_stream_get_total_out(void *data) +{ + z_stream *stream = (z_stream*)data; + + if (!stream) + return 0; + + return stream->total_out; +} + +void zlib_stream_decrement_total_out(void *data, unsigned subtraction) +{ + z_stream *stream = (z_stream*)data; + + if (stream) + stream->total_out -= subtraction; +} diff --git a/desmume/src/libretro-common/file/file_list.c b/desmume/src/libretro-common/file/file_list.c new file mode 100644 index 000000000..49853aee8 --- /dev/null +++ b/desmume/src/libretro-common/file/file_list.c @@ -0,0 +1,411 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (file_list.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include + +#include +#include + +void file_list_push(file_list_t *list, + const char *path, const char *label, + unsigned type, size_t directory_ptr, + size_t entry_idx) +{ + if (list->size >= list->capacity) + { + list->capacity += 1; + list->capacity *= 2; + + list->list = (struct item_file*)realloc(list->list, + list->capacity * sizeof(struct item_file)); + + if (!list->list) + return; + } + + list->list[list->size].label = NULL; + list->list[list->size].path = NULL; + list->list[list->size].alt = NULL; + list->list[list->size].userdata = NULL; + list->list[list->size].actiondata = NULL; + list->list[list->size].type = type; + list->list[list->size].directory_ptr = directory_ptr; + list->list[list->size].entry_idx = entry_idx; + + if (label) + list->list[list->size].label = strdup(label); + if (path) + list->list[list->size].path = strdup(path); + + list->size++; +} + +size_t file_list_get_size(const file_list_t *list) +{ + if (!list) + return 0; + return list->size; +} + +size_t file_list_get_entry_index(const file_list_t *list) +{ + size_t size = 0; + if (!list) + return 0; + size = file_list_get_size(list); + return list->list[size].entry_idx; +} + +size_t file_list_get_directory_ptr(const file_list_t *list) +{ + size_t size = file_list_get_size(list); + return list->list[size].directory_ptr; +} + + +void file_list_pop(file_list_t *list, size_t *directory_ptr) +{ + if (!list) + return; + + if (list->size != 0) + { + --list->size; + if (list->list[list->size].path) + free(list->list[list->size].path); + list->list[list->size].path = NULL; + + if (list->list[list->size].label) + free(list->list[list->size].label); + list->list[list->size].label = NULL; + } + + if (directory_ptr) + *directory_ptr = list->list[list->size].directory_ptr; +} + +void file_list_free(file_list_t *list) +{ + size_t i; + + if (!list) + return; + + for (i = 0; i < list->size; i++) + { + file_list_free_userdata(list, i); + file_list_free_actiondata(list, i); + + if (list->list[i].path) + free(list->list[i].path); + list->list[i].path = NULL; + + if (list->list[i].label) + free(list->list[i].label); + list->list[i].label = NULL; + + if (list->list[i].alt) + free(list->list[i].alt); + list->list[i].alt = NULL; + } + if (list->list) + free(list->list); + list->list = NULL; + if (list) + free(list); +} + +void file_list_clear(file_list_t *list) +{ + size_t i; + + if (!list) + return; + + for (i = 0; i < list->size; i++) + { + if (list->list[i].path) + free(list->list[i].path); + list->list[i].path = NULL; + + if (list->list[i].label) + free(list->list[i].label); + list->list[i].label = NULL; + + if (list->list[i].alt) + free(list->list[i].alt); + list->list[i].alt = NULL; + } + + list->size = 0; +} + +void file_list_copy(const file_list_t *src, file_list_t *dst) +{ + struct item_file *item; + + if (!src || !dst) + return; + + if (dst->list) + { + for (item = dst->list; item < &dst->list[dst->size]; ++item) + { + if (item->path) + free(item->path); + + if (item->label) + free(item->label); + + if (item->alt) + free(item->alt); + } + + free(dst->list); + } + + dst->size = 0; + dst->capacity = 0; + dst->list = (struct item_file*)malloc(src->size * sizeof(struct item_file)); + + if (!dst->list) + return; + + dst->size = dst->capacity = src->size; + + memcpy(dst->list, src->list, dst->size * sizeof(struct item_file)); + + for (item = dst->list; item < &dst->list[dst->size]; ++item) + { + if (item->path) + item->path = strdup(item->path); + + if (item->label) + item->label = strdup(item->label); + + if (item->alt) + item->alt = strdup(item->alt); + } +} + +void file_list_set_label_at_offset(file_list_t *list, size_t idx, + const char *label) +{ + if (!list) + return; + + if (list->list[idx].label) + free(list->list[idx].label); + list->list[idx].alt = NULL; + + if (label) + list->list[idx].label = strdup(label); +} + +void file_list_get_label_at_offset(const file_list_t *list, size_t idx, + const char **label) +{ + if (!label || !list) + return; + + *label = list->list[idx].path; + if (list->list[idx].label) + *label = list->list[idx].label; +} + +void file_list_set_alt_at_offset(file_list_t *list, size_t idx, + const char *alt) +{ + if (!list) + return; + + if (list->list[idx].alt) + free(list->list[idx].alt); + list->list[idx].alt = NULL; + + if (alt) + list->list[idx].alt = strdup(alt); +} + +void file_list_get_alt_at_offset(const file_list_t *list, size_t idx, + const char **alt) +{ + if (!list) + return; + + if (alt) + *alt = list->list[idx].alt ? + list->list[idx].alt : list->list[idx].path; +} + +static int file_list_alt_cmp(const void *a_, const void *b_) +{ + const struct item_file *a = (const struct item_file*)a_; + const struct item_file *b = (const struct item_file*)b_; + const char *cmp_a = a->alt ? a->alt : a->path; + const char *cmp_b = b->alt ? b->alt : b->path; + return strcasecmp(cmp_a, cmp_b); +} + +static int file_list_type_cmp(const void *a_, const void *b_) +{ + const struct item_file *a = (const struct item_file*)a_; + const struct item_file *b = (const struct item_file*)b_; + if (a->type < b->type) + return -1; + if (a->type == b->type) + return 0; + + return 1; +} + +void file_list_sort_on_alt(file_list_t *list) +{ + qsort(list->list, list->size, sizeof(list->list[0]), file_list_alt_cmp); +} + +void file_list_sort_on_type(file_list_t *list) +{ + qsort(list->list, list->size, sizeof(list->list[0]), file_list_type_cmp); +} + +void *file_list_get_userdata_at_offset(const file_list_t *list, size_t idx) +{ + if (!list) + return NULL; + return list->list[idx].userdata; +} + +void file_list_set_userdata(const file_list_t *list, size_t idx, void *ptr) +{ + if (!list || !ptr) + return; + list->list[idx].userdata = ptr; +} + +void file_list_set_actiondata(const file_list_t *list, size_t idx, void *ptr) +{ + if (!list || !ptr) + return; + list->list[idx].actiondata = ptr; +} + +void *file_list_get_actiondata_at_offset(const file_list_t *list, size_t idx) +{ + if (!list) + return NULL; + return list->list[idx].actiondata; +} + +void file_list_free_actiondata(const file_list_t *list, size_t idx) +{ + if (!list) + return; + if (list->list[idx].actiondata) + free(list->list[idx].actiondata); + list->list[idx].actiondata = NULL; +} + +void file_list_free_userdata(const file_list_t *list, size_t idx) +{ + if (!list) + return; + if (list->list[idx].userdata) + free(list->list[idx].userdata); + list->list[idx].userdata = NULL; +} + +void *file_list_get_last_actiondata(const file_list_t *list) +{ + if (!list) + return NULL; + return list->list[list->size - 1].actiondata; +} + +void file_list_get_at_offset(const file_list_t *list, size_t idx, + const char **path, const char **label, unsigned *file_type, + size_t *entry_idx) +{ + if (!list) + return; + + if (path) + *path = list->list[idx].path; + if (label) + *label = list->list[idx].label; + if (file_type) + *file_type = list->list[idx].type; + if (entry_idx) + *entry_idx = list->list[idx].entry_idx; +} + +void file_list_get_last(const file_list_t *list, + const char **path, const char **label, + unsigned *file_type, size_t *entry_idx) +{ + if (!list) + return; + + if (list->size) + file_list_get_at_offset(list, list->size - 1, path, label, file_type, entry_idx); +} + +bool file_list_search(const file_list_t *list, const char *needle, size_t *idx) +{ + size_t i; + const char *alt; + bool ret = false; + + if (!list) + return false; + + for (i = 0; i < list->size; i++) + { + const char *str; + file_list_get_alt_at_offset(list, i, &alt); + if (!alt) + { + file_list_get_label_at_offset(list, i, &alt); + if (!alt) + continue; + } + + str = (const char *)strcasestr(alt, needle); + if (str == alt) + { + /* Found match with first chars, best possible match. */ + *idx = i; + ret = true; + break; + } + else if (str && !ret) + { + /* Found mid-string match, but try to find a match with + * first characters before we settle. */ + *idx = i; + ret = true; + } + } + + return ret; +} diff --git a/desmume/src/libretro-common/file/file_path.c b/desmume/src/libretro-common/file/file_path.c new file mode 100644 index 000000000..312944ac6 --- /dev/null +++ b/desmume/src/libretro-common/file/file_path.c @@ -0,0 +1,642 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (file_path.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#include +#include +#include +#include +#include + +#ifdef __HAIKU__ +#include +#endif + +#include + +#include + +#include +#include +#include +#include +#include + + +/** + * path_mkdir: + * @dir : directory + * + * Create directory on filesystem. + * + * Returns: true (1) if directory could be created, otherwise false (0). + **/ +bool path_mkdir(const char *dir) +{ + const char *target = NULL; + /* Use heap. Real chance of stack overflow if we recurse too hard. */ + char *basedir = strdup(dir); + bool ret = false; + + if (!basedir) + return false; + + path_parent_dir(basedir); + if (!*basedir || !strcmp(basedir, dir)) + goto end; + + if (path_is_directory(basedir)) + { + target = dir; + ret = mkdir_norecurse(dir); + } + else + { + target = basedir; + ret = path_mkdir(basedir); + + if (ret) + { + target = dir; + ret = mkdir_norecurse(dir); + } + } + +end: + if (target && !ret) + printf("Failed to create directory: \"%s\".\n", target); + free(basedir); + return ret; +} + +/** + * path_get_extension: + * @path : path + * + * Gets extension of file. Only '.'s + * after the last slash are considered. + * + * Returns: extension part from the path. + */ +const char *path_get_extension(const char *path) +{ + const char *ext = strrchr(path_basename(path), '.'); + if (!ext) + return ""; + return ext + 1; +} + +/** + * path_remove_extension: + * @path : path + * + * Removes the extension from the path and returns the result. + * Removes all text after and including the last '.'. + * Only '.'s after the last slash are considered. + * + * Returns: path with the extension part removed. + */ +char *path_remove_extension(char *path) +{ + char *last = (char*)strrchr(path_basename(path), '.'); + if (!last) + return NULL; + if (*last) + *last = '\0'; + return last; +} + +/** + * path_contains_compressed_file: + * @path : path + * + * Checks if path contains a compressed file. + * + * Currently we only check for hash symbol (#) inside the pathname. + * If path is ever expanded to a general URI, we should check for that here. + * + * Example: Somewhere in the path there might be a compressed file + * E.g.: /path/to/file.7z#mygame.img + * + * Returns: true (1) if path contains compressed file, otherwise false (0). + **/ +bool path_contains_compressed_file(const char *path) +{ + return (strchr(path,'#') != NULL); +} + +/** + * path_is_compressed_file: + * @path : path + * + * Checks if path is a compressed file. + * + * Returns: true (1) if path is a compressed file, otherwise false (0). + **/ +bool path_is_compressed_file(const char* path) +{ +#ifdef HAVE_COMPRESSION + const char* file_ext = path_get_extension(path); + +#ifdef HAVE_ZLIB + if (!strcmp(file_ext, "zip")) + return true; +#endif + +#ifdef HAVE_7ZIP + if (!strcmp(file_ext, "7z")) + return true; +#endif + +#endif + return false; +} + +/** + * path_file_exists: + * @path : path + * + * Checks if a file already exists at the specified path (@path). + * + * Returns: true (1) if file already exists, otherwise false (0). + */ +bool path_file_exists(const char *path) +{ + FILE *dummy = fopen(path, "rb"); + + if (!dummy) + return false; + + fclose(dummy); + return true; +} + +/** + * fill_pathname: + * @out_path : output path + * @in_path : input path + * @replace : what to replace + * @size : buffer size of output path + * + * FIXME: Verify + * + * Replaces filename extension with 'replace' and outputs result to out_path. + * The extension here is considered to be the string from the last '.' + * to the end. + * + * Only '.'s after the last slash are considered as extensions. + * If no '.' is present, in_path and replace will simply be concatenated. + * 'size' is buffer size of 'out_path'. + * E.g.: in_path = "/foo/bar/baz/boo.c", replace = ".asm" => + * out_path = "/foo/bar/baz/boo.asm" + * E.g.: in_path = "/foo/bar/baz/boo.c", replace = "" => + * out_path = "/foo/bar/baz/boo" + */ +void fill_pathname(char *out_path, const char *in_path, + const char *replace, size_t size) +{ + char tmp_path[PATH_MAX_LENGTH] = {0}; + char *tok = NULL; + + rarch_assert(strlcpy(tmp_path, in_path, + sizeof(tmp_path)) < sizeof(tmp_path)); + if ((tok = (char*)strrchr(path_basename(tmp_path), '.'))) + *tok = '\0'; + + rarch_assert(strlcpy(out_path, tmp_path, size) < size); + rarch_assert(strlcat(out_path, replace, size) < size); +} + +/** + * fill_pathname_noext: + * @out_path : output path + * @in_path : input path + * @replace : what to replace + * @size : buffer size of output path + * + * Appends a filename extension 'replace' to 'in_path', and outputs + * result in 'out_path'. + * + * Assumes in_path has no extension. If an extension is still + * present in 'in_path', it will be ignored. + * + */ +void fill_pathname_noext(char *out_path, const char *in_path, + const char *replace, size_t size) +{ + rarch_assert(strlcpy(out_path, in_path, size) < size); + rarch_assert(strlcat(out_path, replace, size) < size); +} + +static char *find_last_slash(const char *str) +{ + const char *slash = strrchr(str, '/'); +#ifdef _WIN32 + const char *backslash = strrchr(str, '\\'); + + if (backslash && ((slash && backslash > slash) || !slash)) + slash = backslash; +#endif + + return (char*)slash; +} + +/** + * fill_pathname_slash: + * @path : path + * @size : size of path + * + * Assumes path is a directory. Appends a slash + * if not already there. + **/ +void fill_pathname_slash(char *path, size_t size) +{ + size_t path_len = strlen(path); + const char *last_slash = find_last_slash(path); + + /* Try to preserve slash type. */ + if (last_slash && (last_slash != (path + path_len - 1))) + { + char join_str[2]; + strlcpy(join_str, last_slash, sizeof(join_str)); + rarch_assert(strlcat(path, join_str, size) < size); + } + else if (!last_slash) + rarch_assert(strlcat(path, path_default_slash(), size) < size); +} + +/** + * fill_pathname_dir: + * @in_dir : input directory path + * @in_basename : input basename to be appended to @in_dir + * @replace : replacement to be appended to @in_basename + * @size : size of buffer + * + * Appends basename of 'in_basename', to 'in_dir', along with 'replace'. + * Basename of in_basename is the string after the last '/' or '\\', + * i.e the filename without directories. + * + * If in_basename has no '/' or '\\', the whole 'in_basename' will be used. + * 'size' is buffer size of 'in_dir'. + * + * E.g..: in_dir = "/tmp/some_dir", in_basename = "/some_content/foo.c", + * replace = ".asm" => in_dir = "/tmp/some_dir/foo.c.asm" + **/ +void fill_pathname_dir(char *in_dir, const char *in_basename, + const char *replace, size_t size) +{ + const char *base = NULL; + + fill_pathname_slash(in_dir, size); + base = path_basename(in_basename); + rarch_assert(strlcat(in_dir, base, size) < size); + rarch_assert(strlcat(in_dir, replace, size) < size); +} + +/** + * fill_pathname_base: + * @out : output path + * @in_path : input path + * @size : size of output path + * + * Copies basename of @in_path into @out_path. + **/ +void fill_pathname_base(char *out, const char *in_path, size_t size) +{ + const char *ptr_bak = NULL; + const char *ptr = find_last_slash(in_path); + + (void)ptr_bak; + + if (ptr) + ptr++; + else + ptr = in_path; + +#ifdef HAVE_COMPRESSION + /* In case of compression, we also have to consider paths like + * /path/to/archive.7z#mygame.img + * and + * /path/to/archive.7z#folder/mygame.img + * basename would be mygame.img in both cases + */ + ptr_bak = ptr; + ptr = strchr(ptr_bak,'#'); + if (ptr) + ptr++; + else + ptr = ptr_bak; +#endif + + rarch_assert(strlcpy(out, ptr, size) < size); +} + +/** + * fill_pathname_basedir: + * @out_dir : output directory + * @in_path : input path + * @size : size of output directory + * + * Copies base directory of @in_path into @out_path. + * If in_path is a path without any slashes (relative current directory), + * @out_path will get path "./". + **/ +void fill_pathname_basedir(char *out_dir, + const char *in_path, size_t size) +{ + rarch_assert(strlcpy(out_dir, in_path, size) < size); + path_basedir(out_dir); +} + +/** + * fill_pathname_parent_dir: + * @out_dir : output directory + * @in_dir : input directory + * @size : size of output directory + * + * Copies parent directory of @in_dir into @out_dir. + * Assumes @in_dir is a directory. Keeps trailing '/'. + **/ +void fill_pathname_parent_dir(char *out_dir, + const char *in_dir, size_t size) +{ + rarch_assert(strlcpy(out_dir, in_dir, size) < size); + path_parent_dir(out_dir); +} + +/** + * fill_dated_filename: + * @out_filename : output filename + * @ext : extension of output filename + * @size : buffer size of output filename + * + * Creates a 'dated' filename prefixed by 'RetroArch', and + * concatenates extension (@ext) to it. + * + * E.g.: + * out_filename = "RetroArch-{month}{day}-{Hours}{Minutes}.{@ext}" + **/ +void fill_dated_filename(char *out_filename, + const char *ext, size_t size) +{ + time_t cur_time; + time(&cur_time); + + strftime(out_filename, size, + "RetroArch-%m%d-%H%M%S.", localtime(&cur_time)); + strlcat(out_filename, ext, size); +} + +/** + * path_basedir: + * @path : path + * + * Extracts base directory by mutating path. + * Keeps trailing '/'. + **/ +void path_basedir(char *path) +{ + char *last = NULL; + if (strlen(path) < 2) + return; + +#ifdef HAVE_COMPRESSION + /* We want to find the directory with the zipfile in basedir. */ + last = strchr(path,'#'); + if (last) + *last = '\0'; +#endif + + last = find_last_slash(path); + + if (last) + last[1] = '\0'; + else + snprintf(path, 3, ".%s", path_default_slash()); +} + +/** + * path_parent_dir: + * @path : path + * + * Extracts parent directory by mutating path. + * Assumes that path is a directory. Keeps trailing '/'. + **/ +void path_parent_dir(char *path) +{ + size_t len = strlen(path); + if (len && path_char_is_slash(path[len - 1])) + path[len - 1] = '\0'; + path_basedir(path); +} + +/** + * path_basename: + * @path : path + * + * Get basename from @path. + * + * Returns: basename from path. + **/ +const char *path_basename(const char *path) +{ + const char *last_hash = NULL; + const char *last = find_last_slash(path); + + (void)last_hash; + +#ifdef HAVE_COMPRESSION + /* We cut either at the last hash or the last slash; whichever comes last */ + last_hash = strchr(path,'#'); + + if (last_hash > last) + return last_hash + 1; +#endif + + if (last) + return last + 1; + return path; +} + +/** + * path_is_absolute: + * @path : path + * + * Checks if @path is an absolute path or a relative path. + * + * Returns: true (1) if path is absolute, false (1) if path is relative. + **/ +bool path_is_absolute(const char *path) +{ + if (path[0] == '/') + return true; +#ifdef _WIN32 + /* Many roads lead to Rome ... */ + if ((strstr(path, "\\\\") == path) + || strstr(path, ":/") || strstr(path, ":\\") || strstr(path, ":\\\\")) + return true; +#endif + return false; +} + +/** + * path_resolve_realpath: + * @buf : buffer for path + * @size : size of buffer + * + * Turns relative paths into absolute path. + * If relative, rebases on current working dir. + **/ +void path_resolve_realpath(char *buf, size_t size) +{ +#ifndef RARCH_CONSOLE + char tmp[PATH_MAX_LENGTH]; + + strlcpy(tmp, buf, sizeof(tmp)); + +#ifdef _WIN32 + if (!_fullpath(buf, tmp, size)) + strlcpy(buf, tmp, size); +#else + rarch_assert(size >= PATH_MAX_LENGTH); + + /* NOTE: realpath() expects at least PATH_MAX_LENGTH bytes in buf. + * Technically, PATH_MAX_LENGTH needn't be defined, but we rely on it anyways. + * POSIX 2008 can automatically allocate for you, + * but don't rely on that. */ + if (!realpath(tmp, buf)) + strlcpy(buf, tmp, size); +#endif +#endif +} + +/** + * fill_pathname_resolve_relative: + * @out_path : output path + * @in_refpath : input reference path + * @in_path : input path + * @size : size of @out_path + * + * Joins basedir of @in_refpath together with @in_path. + * If @in_path is an absolute path, out_path = in_path. + * E.g.: in_refpath = "/foo/bar/baz.a", in_path = "foobar.cg", + * out_path = "/foo/bar/foobar.cg". + **/ +void fill_pathname_resolve_relative(char *out_path, + const char *in_refpath, const char *in_path, size_t size) +{ + if (path_is_absolute(in_path)) + { + rarch_assert(strlcpy(out_path, in_path, size) < size); + return; + } + + rarch_assert(strlcpy(out_path, in_refpath, size) < size); + path_basedir(out_path); + rarch_assert(strlcat(out_path, in_path, size) < size); +} + +/** + * fill_pathname_join: + * @out_path : output path + * @dir : directory + * @path : path + * @size : size of output path + * + * Joins a directory (@dir) and path (@path) together. + * Makes sure not to get two consecutive slashes + * between directory and path. + **/ +void fill_pathname_join(char *out_path, + const char *dir, const char *path, size_t size) +{ + rarch_assert(strlcpy(out_path, dir, size) < size); + + if (*out_path) + fill_pathname_slash(out_path, size); + + rarch_assert(strlcat(out_path, path, size) < size); +} + +/** + * fill_pathname_join_delim: + * @out_path : output path + * @dir : directory + * @path : path + * @delim : delimiter + * @size : size of output path + * + * Joins a directory (@dir) and path (@path) together + * using the given delimiter (@delim). + **/ +void fill_pathname_join_delim(char *out_path, const char *dir, + const char *path, const char delim, size_t size) +{ + size_t copied = strlcpy(out_path, dir, size); + rarch_assert(copied < size+1); + + out_path[copied] = delim; + out_path[copied+1] = '\0'; + + rarch_assert(strlcat(out_path, path, size) < size); +} + +/** + * fill_short_pathname_representation: + * @out_rep : output representation + * @in_path : input path + * @size : size of output representation + * + * Generates a short representation of path. It should only + * be used for displaying the result; the output representation is not + * binding in any meaningful way (for a normal path, this is the same as basename) + * In case of more complex URLs, this should cut everything except for + * the main image file. + * + * E.g.: "/path/to/game.img" -> game.img + * "/path/to/myarchive.7z#folder/to/game.img" -> game.img + */ +void fill_short_pathname_representation(char* out_rep, + const char *in_path, size_t size) +{ + char path_short[PATH_MAX_LENGTH] = {0}; + char *last_hash = NULL; + + fill_pathname(path_short, path_basename(in_path), "", + sizeof(path_short)); + + last_hash = (char*)strchr(path_short,'#'); + if(last_hash != NULL) + { + /* We handle paths like: + * /path/to/file.7z#mygame.img + * short_name: mygame.img: + * + * We check whether something is actually + * after the hash to avoid going over the buffer. + */ + rarch_assert(strlen(last_hash) > 1); + strlcpy(out_rep, last_hash + 1, size); + } + else + strlcpy(out_rep, path_short, size); +} diff --git a/desmume/src/libretro-common/file/memory_stream.c b/desmume/src/libretro-common/file/memory_stream.c new file mode 100644 index 000000000..35a817723 --- /dev/null +++ b/desmume/src/libretro-common/file/memory_stream.c @@ -0,0 +1,142 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (memory_stream.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include + +#include + +static uint8_t* g_buffer = NULL; +static size_t g_size = 0; +static size_t last_file_size = 0; + +struct memstream +{ + uint8_t *m_buf; + size_t m_size; + size_t m_ptr; +}; + +void memstream_set_buffer(uint8_t *buffer, size_t size) +{ + g_buffer = buffer; + g_size = size; +} + +size_t memstream_get_last_size(void) +{ + return last_file_size; +} + +static void memstream_init(memstream_t *stream, uint8_t *buffer, size_t max_size) +{ + stream->m_buf = buffer; + stream->m_size = max_size; + stream->m_ptr = 0; +} + +memstream_t *memstream_open(void) +{ + memstream_t *stream; + if (!g_buffer || !g_size) + return NULL; + + stream = (memstream_t*)calloc(1, sizeof(*stream)); + memstream_init(stream, g_buffer, g_size); + + g_buffer = NULL; + g_size = 0; + return stream; +} + +void memstream_close(memstream_t *stream) +{ + last_file_size = stream->m_ptr; + free(stream); +} + +size_t memstream_read(memstream_t *stream, void *data, size_t bytes) +{ + size_t avail = stream->m_size - stream->m_ptr; + if (bytes > avail) + bytes = avail; + + memcpy(data, stream->m_buf + stream->m_ptr, bytes); + stream->m_ptr += bytes; + return bytes; +} + +size_t memstream_write(memstream_t *stream, const void *data, size_t bytes) +{ + size_t avail = stream->m_size - stream->m_ptr; + if (bytes > avail) + bytes = avail; + + memcpy(stream->m_buf + stream->m_ptr, data, bytes); + stream->m_ptr += bytes; + return bytes; +} + +int memstream_seek(memstream_t *stream, int offset, int whence) +{ + size_t ptr; + + switch (whence) + { + case SEEK_SET: + ptr = offset; + break; + case SEEK_CUR: + ptr = stream->m_ptr + offset; + break; + case SEEK_END: + ptr = stream->m_size + offset; + break; + default: + return -1; + } + + if (ptr <= stream->m_size) + { + stream->m_ptr = ptr; + return 0; + } + return -1; +} + +size_t memstream_pos(memstream_t *stream) +{ + return stream->m_ptr; +} + +char *memstream_gets(memstream_t *stream, char *buffer, size_t len) +{ + return NULL; +} + +int memstream_getc(memstream_t *stream) +{ + if (stream->m_ptr >= stream->m_size) + return EOF; + return stream->m_buf[stream->m_ptr++]; +} diff --git a/desmume/src/libretro-common/file/nbio/Makefile b/desmume/src/libretro-common/file/nbio/Makefile new file mode 100644 index 000000000..39f1c5109 --- /dev/null +++ b/desmume/src/libretro-common/file/nbio/Makefile @@ -0,0 +1,20 @@ +TARGET := nbio_test + +SOURCES := $(wildcard *.c) +OBJS := $(SOURCES:.c=.o) + +CFLAGS += -Wall -pedantic -std=gnu99 -O0 -g -I../../include + +all: $(TARGET) + +%.o: %.c + $(CC) -c -o $@ $< $(CFLAGS) + +$(TARGET): $(OBJS) + $(CC) -o $@ $^ $(LDFLAGS) + +clean: + rm -f $(TARGET) $(OBJS) + +.PHONY: clean + diff --git a/desmume/src/libretro-common/file/nbio/nbio_stdio.c b/desmume/src/libretro-common/file/nbio/nbio_stdio.c new file mode 100644 index 000000000..6e2a2f6f3 --- /dev/null +++ b/desmume/src/libretro-common/file/nbio/nbio_stdio.c @@ -0,0 +1,206 @@ +#include +#include + +#include + +struct nbio_t +{ + FILE* f; + void* data; + size_t progress; + size_t len; + /* + * possible values: + * NBIO_READ, NBIO_WRITE - obvious + * -1 - currently doing nothing + * -2 - the pointer was reallocated since the last operation + */ + signed char op; + signed char mode; +}; + +static const char * modes[]={ "rb", "wb", "r+b", "rb", "wb", "r+b" }; + +struct nbio_t* nbio_open(const char * filename, unsigned mode) +{ + struct nbio_t* handle = NULL; + FILE* f = fopen(filename, modes[mode]); + if (!f) + return NULL; + + handle = (struct nbio_t*)malloc(sizeof(struct nbio_t)); + + if (!handle) + goto error; + + handle->f = f; + handle->len = 0; + + switch (mode) + { + case NBIO_WRITE: + case BIO_WRITE: + break; + default: + fseek(handle->f, 0, SEEK_END); + handle->len = ftell(handle->f); + break; + } + + handle->mode = mode; + handle->data = malloc(handle->len); + + if (handle->len && !handle->data) + goto error; + + handle->progress = handle->len; + handle->op = -2; + + return handle; + +error: + if (handle) + { + if (handle->data) + free(handle->data); + handle->data = NULL; + free(handle); + } + handle = NULL; + fclose(f); + return NULL; +} + +void nbio_begin_read(struct nbio_t* handle) +{ + if (!handle) + return; + + if (handle->op >= 0) + { + puts("ERROR - attempted file read operation while busy"); + abort(); + } + + fseek(handle->f, 0, SEEK_SET); + + handle->op = NBIO_READ; + handle->progress = 0; +} + +void nbio_begin_write(struct nbio_t* handle) +{ + if (!handle) + return; + + if (handle->op >= 0) + { + puts("ERROR - attempted file write operation while busy"); + abort(); + } + + fseek(handle->f, 0, SEEK_SET); + handle->op = NBIO_WRITE; + handle->progress = 0; +} + +bool nbio_iterate(struct nbio_t* handle) +{ + size_t amount = 65536; + + if (!handle) + return false; + + if (amount > handle->len - handle->progress) + amount = handle->len - handle->progress; + + switch (handle->op) + { + case NBIO_READ: + if (handle->mode == BIO_READ) + { + amount = handle->len; + fread((char*)handle->data, 1, amount, handle->f); + } + else + fread((char*)handle->data + handle->progress, 1, amount, handle->f); + break; + case NBIO_WRITE: + if (handle->mode == BIO_WRITE) + { + size_t written = 0; + amount = handle->len; + written = fwrite((char*)handle->data, 1, amount, handle->f); + if (written != amount) + return false; + } + else + fwrite((char*)handle->data + handle->progress, 1, amount, handle->f); + break; + } + + handle->progress += amount; + + if (handle->progress == handle->len) + handle->op = -1; + return (handle->op < 0); +} + +void nbio_resize(struct nbio_t* handle, size_t len) +{ + if (!handle) + return; + + if (handle->op >= 0) + { + puts("ERROR - attempted file resize operation while busy"); + abort(); + } + if (len < handle->len) + { + puts("ERROR - attempted file shrink operation, not implemented"); + abort(); + } + + handle->len = len; + handle->data = realloc(handle->data, handle->len); + handle->op = -1; + handle->progress = handle->len; +} + +void* nbio_get_ptr(struct nbio_t* handle, size_t* len) +{ + if (!handle) + return NULL; + if (len) + *len = handle->len; + if (handle->op == -1) + return handle->data; + return NULL; +} + +void nbio_cancel(struct nbio_t* handle) +{ + if (!handle) + return; + + handle->op = -1; + handle->progress = handle->len; +} + +void nbio_free(struct nbio_t* handle) +{ + if (!handle) + return; + if (handle->op >= 0) + { + puts("ERROR - attempted free() while busy"); + abort(); + } + fclose(handle->f); + free(handle->data); + + handle->f = NULL; + handle->data = NULL; + free(handle); +} diff --git a/desmume/src/libretro-common/file/nbio/nbio_test.c b/desmume/src/libretro-common/file/nbio/nbio_test.c new file mode 100644 index 000000000..3fadf8f88 --- /dev/null +++ b/desmume/src/libretro-common/file/nbio/nbio_test.c @@ -0,0 +1,63 @@ +#include +#include + +#include + +static void nbio_write_test(void) +{ + size_t size; + bool looped = false; + void* ptr = NULL; + struct nbio_t* write = nbio_open("test.bin", NBIO_WRITE); + + nbio_resize(write, 1024*1024); + + ptr = nbio_get_ptr(write, &size); + if (size != 1024*1024) + puts("ERROR: wrong size (1)"); + + memset(ptr, 0x42, 1024*1024); + nbio_begin_write(write); + + while (!nbio_iterate(write)) looped=true; + + if (!looped) + puts("Write finished immediately?"); + + nbio_free(write); +} + +static void nbio_read_test(void) +{ + size_t size; + bool looped = false; + struct nbio_t* read = nbio_open("test.bin", NBIO_READ); + void* ptr = nbio_get_ptr(read, &size); + + if (size != 1024*1024) + puts("ERROR: wrong size (2)"); + if (ptr) + puts("Read pointer is available before iterating?"); + + nbio_begin_read(read); + + while (!nbio_iterate(read)) looped=true; + + if (!looped) + puts("Read finished immediately?"); + + ptr = nbio_get_ptr(read, &size); + + if (size != 1024*1024) + puts("ERROR: wrong size (3)"); + if (*(char*)ptr != 0x42 || memcmp(ptr, (char*)ptr+1, 1024*1024-1)) + puts("ERROR: wrong data"); + + nbio_free(read); +} + +int main(void) +{ + nbio_write_test(); + nbio_read_test(); +} diff --git a/desmume/src/libretro-common/file/retro_dirent.c b/desmume/src/libretro-common/file/retro_dirent.c new file mode 100644 index 000000000..456ebe5f9 --- /dev/null +++ b/desmume/src/libretro-common/file/retro_dirent.c @@ -0,0 +1,201 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_dirent.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include + +#if defined(_WIN32) +# include +# ifdef _MSC_VER +# define setmode _setmode +# endif +# ifdef _XBOX +# include +# define INVALID_FILE_ATTRIBUTES -1 +# else +# include +# include +# include +# include +# endif +#elif defined(VITA) +# include +# include +#else +# if defined(PSP) +# include +# endif +# include +# include +# include +# include +#endif + +#ifdef __CELLOS_LV2__ +#include +#endif + +#include +#include +#include + +struct RDIR +{ +#if defined(_WIN32) + WIN32_FIND_DATA entry; + HANDLE directory; +#elif defined(VITA) || defined(PSP) + SceUID directory; + SceIoDirent entry; +#elif defined(__CELLOS_LV2__) + CellFsErrno error; + int directory; + CellFsDirent entry; +#else + DIR *directory; + const struct dirent *entry; +#endif +}; + +struct RDIR *retro_opendir(const char *name) +{ + char path_buf[1024]; + struct RDIR *rdir = (struct RDIR*)calloc(1, sizeof(*rdir)); + + if (!rdir) + return NULL; + + (void)path_buf; + +#if defined(_WIN32) + snprintf(path_buf, sizeof(path_buf), "%s\\*", name); + rdir->directory = FindFirstFile(path_buf, &rdir->entry); +#elif defined(VITA) || defined(PSP) + rdir->directory = sceIoDopen(name); +#elif defined(__CELLOS_LV2__) + rdir->error = cellFsOpendir(name, &rdir->directory); +#else + rdir->directory = opendir(name); + rdir->entry = NULL; +#endif + + return rdir; +} + +bool retro_dirent_error(struct RDIR *rdir) +{ +#if defined(_WIN32) + return (rdir->directory == INVALID_HANDLE_VALUE); +#elif defined(VITA) || defined(PSP) + return (rdir->directory < 0); +#elif defined(__CELLOS_LV2__) + return (rdir->error != CELL_FS_SUCCEEDED); +#else + return !(rdir->directory); +#endif +} + +int retro_readdir(struct RDIR *rdir) +{ +#if defined(_WIN32) + return (FindNextFile(rdir->directory, &rdir->entry) != 0); +#elif defined(VITA) || defined(PSP) + return (sceIoDread(rdir->directory, &rdir->entry) > 0); +#elif defined(__CELLOS_LV2__) + uint64_t nread; + rdir->error = cellFsReaddir(rdir->directory, &rdir->entry, &nread); + return (nread != 0); +#else + return ((rdir->entry = readdir(rdir->directory)) != NULL); +#endif +} + +const char *retro_dirent_get_name(struct RDIR *rdir) +{ +#if defined(_WIN32) + return rdir->entry.cFileName; +#elif defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__) + return rdir->entry.d_name; +#else + return rdir->entry->d_name; +#endif +} + +/** + * + * retro_dirent_is_dir: + * @rdir : pointer to the directory entry. + * @path : path to the directory entry. + * + * Is the directory listing entry a directory? + * + * Returns: true if directory listing entry is + * a directory, false if not. + */ +bool retro_dirent_is_dir(struct RDIR *rdir, const char *path) +{ +#if defined(_WIN32) + const WIN32_FIND_DATA *entry = (const WIN32_FIND_DATA*)&rdir->entry; + return entry->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY; +#elif defined(PSP) || defined(VITA) + const SceIoDirent *entry = (const SceIoDirent*)&rdir->entry; +#if defined(PSP) + return (entry->d_stat.st_attr & FIO_SO_IFDIR) == FIO_SO_IFDIR; +#elif defined(VITA) + return PSP2_S_ISDIR(entry->d_stat.st_mode); +#endif +#elif defined(__CELLOS_LV2__) + CellFsDirent *entry = (CellFsDirent*)&rdir->entry; + return (entry->d_type == CELL_FS_TYPE_DIRECTORY); +#elif defined(DT_DIR) + const struct dirent *entry = (const struct dirent*)rdir->entry; + if (entry->d_type == DT_DIR) + return true; + /* This can happen on certain file systems. */ + if (entry->d_type == DT_UNKNOWN || entry->d_type == DT_LNK) + return path_is_directory(path); + return false; +#else + /* dirent struct doesn't have d_type, do it the slow way ... */ + return path_is_directory(path); +#endif +} + +void retro_closedir(struct RDIR *rdir) +{ + if (!rdir) + return; + +#if defined(_WIN32) + if (rdir->directory != INVALID_HANDLE_VALUE) + FindClose(rdir->directory); +#elif defined(VITA) || defined(PSP) + sceIoDclose(rdir->directory); +#elif defined(__CELLOS_LV2__) + rdir->error = cellFsClosedir(rdir->directory); +#else + if (rdir->directory) + closedir(rdir->directory); +#endif + + free(rdir); +} diff --git a/desmume/src/libretro-common/file/retro_file.c b/desmume/src/libretro-common/file/retro_file.c new file mode 100644 index 000000000..470e0f76a --- /dev/null +++ b/desmume/src/libretro-common/file/retro_file.c @@ -0,0 +1,389 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_file.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include + +#if defined(_WIN32) +# include +# ifdef _MSC_VER +# define setmode _setmode +# endif +# ifdef _XBOX +# include +# define INVALID_FILE_ATTRIBUTES -1 +# else +# include +# include +# include +# include +# endif +#elif defined(VITA) +# include +# include + +#define PSP_O_RDONLY PSP2_O_RDONLY +#define PSP_O_RDWR PSP2_O_RDWR +#define PSP_O_CREAT PSP2_O_CREAT +#define PSP_O_WRONLY PSP2_O_WRONLY +#define PSP_O_TRUNC PSP2_O_TRUNC +#else +# if defined(PSP) +# include +# endif +# include +# include +# include +# include +#endif + +#ifdef __CELLOS_LV2__ +#include +#else +#include +#endif + +#ifdef RARCH_INTERNAL +#include +#endif + +#include + +#if 1 +#define HAVE_BUFFERED_IO 1 +#endif + +struct RFILE +{ +#if defined(PSP) || defined(VITA) + SceUID fd; +#elif defined(__CELLOS_LV2__) + int fd; +#elif defined(HAVE_BUFFERED_IO) + FILE *fd; +#else + int fd; +#endif +}; + +int retro_get_fd(RFILE *stream) +{ + if (!stream) + return -1; +#if defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__) + return stream->fd; +#elif defined(HAVE_BUFFERED_IO) + return fileno(stream->fd); +#else + return stream->fd; +#endif +} + +RFILE *retro_fopen(const char *path, unsigned mode, ssize_t len) +{ + int flags = 0; + int mode_int = 0; + const char *mode_str = NULL; + RFILE *stream = (RFILE*)calloc(1, sizeof(*stream)); + + if (!stream) + return NULL; + + (void)mode_str; + (void)mode_int; + (void)flags; + + switch (mode) + { + case RFILE_MODE_READ: +#if defined(VITA) || defined(PSP) + mode_int = 0777; + flags = PSP_O_RDONLY; +#elif defined(__CELLOS_LV2__) + mode_int = 0777; + flags = CELL_FS_O_RDONLY; +#elif defined(HAVE_BUFFERED_IO) + mode_str = "rb"; +#else + flags = O_RDONLY; +#endif + break; + case RFILE_MODE_WRITE: +#if defined(VITA) || defined(PSP) + mode_int = 0777; + flags = PSP_O_CREAT | PSP_O_WRONLY | PSP_O_TRUNC; +#elif defined(__CELLOS_LV2__) + mode_int = 0777; + flags = CELL_FS_O_CREAT | CELL_FS_O_WRONLY | CELL_FS_O_TRUNC; +#elif defined(HAVE_BUFFERED_IO) + mode_str = "wb"; +#else + flags = O_WRONLY | O_CREAT | O_TRUNC | S_IRUSR | S_IWUSR; +#endif + break; + case RFILE_MODE_READ_WRITE: +#if defined(VITA) || defined(PSP) + mode_int = 0777; + flags = PSP_O_RDWR; +#elif defined(__CELLOS_LV2__) + mode_int = 0777; + flags = CELL_FS_O_RDWR; +#elif defined(HAVE_BUFFERED_IO) + mode_str = "w+"; +#else + flags = O_RDWR; +#ifdef _WIN32 + flags |= O_BINARY; +#endif +#endif + break; + } + +#if defined(VITA) || defined(PSP) + stream->fd = sceIoOpen(path, flags, mode_int); +#elif defined(__CELLOS_LV2__) + cellFsOpen(path, flags, &stream->fd, NULL, 0); +#elif defined(HAVE_BUFFERED_IO) + stream->fd = fopen(path, mode_str); +#else + stream->fd = open(path, flags); +#endif + +#if defined(HAVE_BUFFERED_IO) + if (!stream->fd) + goto error; +#else + if (stream->fd == -1) + goto error; +#endif + + return stream; + +error: + retro_fclose(stream); + return NULL; +} + +ssize_t retro_fseek(RFILE *stream, ssize_t offset, int whence) +{ + int ret = 0; + if (!stream) + return -1; + + (void)ret; + +#if defined(VITA) || defined(PSP) + ret = sceIoLseek(stream->fd, (SceOff)offset, whence); + if (ret == -1) + return -1; + return 0; +#elif defined(__CELLOS_LV2__) + uint64_t pos = 0; + if (cellFsLseek(stream->fd, offset, whence, &pos) != CELL_FS_SUCCEEDED) + return -1; + return 0; +#elif defined(HAVE_BUFFERED_IO) + return fseek(stream->fd, (long)offset, whence); +#else + ret = lseek(stream->fd, offset, whence); + if (ret == -1) + return -1; + return 0; +#endif +} + +ssize_t retro_ftell(RFILE *stream) +{ + if (!stream) + return -1; +#if defined(VITA) || defined(PSP) + return sceIoLseek(stream->fd, 0, SEEK_CUR); +#elif defined(__CELLOS_LV2__) + uint64_t pos = 0; + if (cellFsLseek(stream->fd, 0, CELL_FS_SEEK_CUR, &pos) != CELL_FS_SUCCEEDED) + return -1; + return 0; +#elif defined(HAVE_BUFFERED_IO) + return ftell(stream->fd); +#else + return lseek(stream->fd, 0, SEEK_CUR); +#endif +} + +void retro_frewind(RFILE *stream) +{ + retro_fseek(stream, 0L, SEEK_SET); +} + +ssize_t retro_fread(RFILE *stream, void *s, size_t len) +{ + if (!stream) + return -1; +#if defined(VITA) || defined(PSP) + return sceIoRead(stream->fd, s, len); +#elif defined(__CELLOS_LV2__) + uint64_t bytes_written; + if (cellFsRead(stream->fd, s, len, &bytes_written) != CELL_FS_SUCCEEDED) + return -1; + return bytes_written; +#elif defined(HAVE_BUFFERED_IO) + return fread(s, 1, len, stream->fd); +#else + return read(stream->fd, s, len); +#endif +} + +ssize_t retro_fwrite(RFILE *stream, const void *s, size_t len) +{ + if (!stream) + return -1; +#if defined(VITA) || defined(PSP) + return sceIoWrite(stream->fd, s, len); +#elif defined(__CELLOS_LV2__) + uint64_t bytes_written; + if (cellFsWrite(stream->fd, s, len, &bytes_written) != CELL_FS_SUCCEEDED) + return -1; + return bytes_written; +#elif defined(HAVE_BUFFERED_IO) + return fwrite(s, 1, len, stream->fd); +#else + return write(stream->fd, s, len); +#endif +} + +int retro_fclose(RFILE *stream) +{ + if (!stream) + return -1; + +#if defined(VITA) || defined(PSP) + if (stream->fd > 0) + sceIoClose(stream->fd); +#elif defined(__CELLOS_LV2__) + if (stream->fd > 0) + cellFsClose(stream->fd); +#elif defined(HAVE_BUFFERED_IO) + if (stream->fd) + fclose(stream->fd); +#else + if (stream->fd > 0) + close(stream->fd); +#endif + free(stream); + + return 0; +} + +/** + * retro_read_file: + * @path : path to file. + * @buf : buffer to allocate and read the contents of the + * file into. Needs to be freed manually. + * + * Read the contents of a file into @buf. + * + * Returns: number of items read, -1 on error. + */ +int retro_read_file(const char *path, void **buf, ssize_t *len) +{ + ssize_t ret = 0; + ssize_t content_buf_size = 0; + void *content_buf = NULL; + RFILE *file = retro_fopen(path, RFILE_MODE_READ, -1); + + if (!file) + goto error; + + if (retro_fseek(file, 0, SEEK_END) != 0) + goto error; + + content_buf_size = retro_ftell(file); + if (content_buf_size < 0) + goto error; + + retro_frewind(file); + + content_buf = malloc(content_buf_size + 1); + + if (!content_buf) + goto error; + + if ((ret = retro_fread(file, content_buf, content_buf_size)) < content_buf_size) + { +#ifdef RARCH_INTERNAL + RARCH_WARN("Didn't read whole file: %s.\n", path); +#else + printf("Didn't read whole file: %s.\n", path); +#endif + } + + if (!content_buf) + goto error; + + *buf = content_buf; + + /* Allow for easy reading of strings to be safe. + * Will only work with sane character formatting (Unix). */ + ((char*)content_buf)[content_buf_size] = '\0'; + + if (retro_fclose(file) != 0) + printf("Failed to close file stream.\n"); + + if (len) + *len = ret; + + return 1; + +error: + retro_fclose(file); + if (content_buf) + free(content_buf); + if (len) + *len = -1; + *buf = NULL; + return 0; +} + +/** + * retro_write_file: + * @path : path to file. + * @data : contents to write to the file. + * @size : size of the contents. + * + * Writes data to a file. + * + * Returns: true (1) on success, false (0) otherwise. + */ +bool retro_write_file(const char *path, const void *data, ssize_t size) +{ + ssize_t ret = 0; + RFILE *file = retro_fopen(path, RFILE_MODE_WRITE, -1); + if (!file) + return false; + + ret = retro_fwrite(file, data, size); + retro_fclose(file); + + return (ret == size); +} diff --git a/desmume/src/libretro-common/file/retro_stat.c b/desmume/src/libretro-common/file/retro_stat.c new file mode 100644 index 000000000..2698c9a04 --- /dev/null +++ b/desmume/src/libretro-common/file/retro_stat.c @@ -0,0 +1,181 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_stat.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include + +#if defined(_WIN32) +#ifdef _MSC_VER +#define setmode _setmode +#endif +#ifdef _XBOX +#include +#define INVALID_FILE_ATTRIBUTES -1 +#else +#include +#include +#include +#include +#endif +#elif defined(VITA) +#define SCE_ERROR_ERRNO_EEXIST 0x80010011 +#include +#include +#include +#else +#include +#include +#include +#endif + +#if defined(PSP) +#include +#endif + +#ifdef __HAIKU__ +#include +#endif + +#if defined(__CELLOS_LV2__) +#include +#endif + +#if defined(VITA) +#define FIO_SO_ISDIR PSP2_S_ISDIR +#endif + +#if (defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)) || defined(__QNX__) || defined(PSP) +#include /* stat() is defined here */ +#endif + +#include +#include + +enum stat_mode +{ + IS_DIRECTORY = 0, + IS_CHARACTER_SPECIAL, + IS_VALID +}; + +static bool path_stat(const char *path, enum stat_mode mode) +{ +#if defined(VITA) || defined(PSP) + SceIoStat buf; + if (sceIoGetstat(path, &buf) < 0) + return false; +#elif defined(__CELLOS_LV2__) + CellFsStat buf; + if (cellFsStat(path, &buf) < 0) + return false; +#elif defined(_WIN32) + DWORD ret = GetFileAttributes(path); + if (ret == INVALID_FILE_ATTRIBUTES) + return false; +#else + struct stat buf; + if (stat(path, &buf) < 0) + return false; +#endif + + switch (mode) + { + case IS_DIRECTORY: +#if defined(VITA) || defined(PSP) + return FIO_SO_ISDIR(buf.st_mode); +#elif defined(__CELLOS_LV2__) + return ((buf.st_mode & S_IFMT) == S_IFDIR); +#elif defined(_WIN32) + return (ret & FILE_ATTRIBUTE_DIRECTORY); +#else + return S_ISDIR(buf.st_mode); +#endif + case IS_CHARACTER_SPECIAL: +#if defined(VITA) || defined(PSP) || defined(__CELLOS_LV2__) || defined(_WIN32) + return false; +#else + return S_ISCHR(buf.st_mode); +#endif + case IS_VALID: + return true; + } + + return false; +} + +/** + * path_is_directory: + * @path : path + * + * Checks if path is a directory. + * + * Returns: true (1) if path is a directory, otherwise false (0). + */ +bool path_is_directory(const char *path) +{ + return path_stat(path, IS_DIRECTORY); +} + +bool path_is_character_special(const char *path) +{ + return path_stat(path, IS_CHARACTER_SPECIAL); +} + +bool stat_is_valid(const char *path) +{ + return path_stat(path, IS_VALID); +} + +/** + * path_mkdir_norecurse: + * @dir : directory + * + * Create directory on filesystem. + * + * Returns: true (1) if directory could be created, otherwise false (0). + **/ +bool mkdir_norecurse(const char *dir) +{ + int ret; +#if defined(_WIN32) + ret = _mkdir(dir); +#elif defined(IOS) + ret = mkdir(dir, 0755); +#elif defined(VITA) || defined(PSP) + ret = sceIoMkdir(dir, 0777); +#else + ret = mkdir(dir, 0750); +#endif + /* Don't treat this as an error. */ +#if defined(VITA) + if ((ret == SCE_ERROR_ERRNO_EEXIST) && path_is_directory(dir)) + ret = 0; +#else + if (ret < 0 && errno == EEXIST && path_is_directory(dir)) + ret = 0; +#endif + if (ret < 0) + printf("mkdir(%s) error: %s.\n", dir, strerror(errno)); + return ret == 0; +} diff --git a/desmume/src/libretro-common/formats/bmp/rbmp_encode.c b/desmume/src/libretro-common/formats/bmp/rbmp_encode.c new file mode 100644 index 000000000..7d6d39dd4 --- /dev/null +++ b/desmume/src/libretro-common/formats/bmp/rbmp_encode.c @@ -0,0 +1,220 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rbmp_encode.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include + +#include +#include + +static bool write_header_bmp(RFILE *file, unsigned width, unsigned height, bool is32bpp) +{ + unsigned line_size = (width * (is32bpp?4:3) + 3) & ~3; + unsigned size = line_size * height + 54; + unsigned size_array = line_size * height; + uint8_t header[54]; + + /* Generic BMP stuff. */ + + /* signature */ + header[0] = 'B'; + header[1] = 'M'; + /* file size */ + header[2] = (uint8_t)(size >> 0); + header[3] = (uint8_t)(size >> 8); + header[4] = (uint8_t)(size >> 16); + header[5] = (uint8_t)(size >> 24); + /* reserved */ + header[6] = 0; + header[7] = 0; + header[8] = 0; + header[9] = 0; + /* offset */ + header[10] = 54; + header[11] = 0; + header[12] = 0; + header[13] = 0; + /* DIB size */ + header[14] = 40; + header[15] = 0; + header[16] = 0; + header[17] = 0; + /* Width */ + header[18] = (uint8_t)(width >> 0); + header[19] = (uint8_t)(width >> 8); + header[20] = (uint8_t)(width >> 16); + header[21] = (uint8_t)(width >> 24); + /* Height */ + header[22] = (uint8_t)(height >> 0); + header[23] = (uint8_t)(height >> 8); + header[24] = (uint8_t)(height >> 16); + header[25] = (uint8_t)(height >> 24); + /* Color planes */ + header[26] = 1; + header[27] = 0; + /* Bits per pixel */ + header[28] = is32bpp?32:24; + header[29] = 0; + /* Compression method */ + header[30] = 0; + header[31] = 0; + header[32] = 0; + header[33] = 0; + /* Image data size */ + header[34] = (uint8_t)(size_array >> 0); + header[35] = (uint8_t)(size_array >> 8); + header[36] = (uint8_t)(size_array >> 16); + header[37] = (uint8_t)(size_array >> 24); + /* Horizontal resolution */ + header[38] = 19; + header[39] = 11; + header[40] = 0; + header[41] = 0; + /* Vertical resolution */ + header[42] = 19; + header[43] = 11; + header[44] = 0; + header[45] = 0; + /* Palette size */ + header[46] = 0; + header[47] = 0; + header[48] = 0; + header[49] = 0; + /* Important color count */ + header[50] = 0; + header[51] = 0; + header[52] = 0; + header[53] = 0; + + return retro_fwrite(file, header, sizeof(header)) == sizeof(header); +} + +static void dump_line_565_to_24(uint8_t *line, const uint16_t *src, unsigned width) +{ + unsigned i; + + for (i = 0; i < width; i++) + { + uint16_t pixel = *src++; + uint8_t b = (pixel >> 0) & 0x1f; + uint8_t g = (pixel >> 5) & 0x3f; + uint8_t r = (pixel >> 11) & 0x1f; + *line++ = (b << 3) | (b >> 2); + *line++ = (g << 2) | (g >> 4); + *line++ = (r << 3) | (r >> 2); + } +} + +static void dump_line_32_to_24(uint8_t *line, const uint32_t *src, unsigned width) +{ + unsigned i; + + for (i = 0; i < width; i++) + { + uint32_t pixel = *src++; + *line++ = (pixel >> 0) & 0xff; + *line++ = (pixel >> 8) & 0xff; + *line++ = (pixel >> 16) & 0xff; + } +} + +static void dump_content(RFILE *file, const void *frame, + int width, int height, int pitch, rbmp_source_type type) +{ + uint8_t *line; + size_t line_size; + int i, j; + int bytes_per_pixel = (type==RBMP_SOURCE_TYPE_ARGB8888?4:3); + union + { + const uint8_t *u8; + const uint16_t *u16; + const uint32_t *u32; + } u; + + u.u8 = (const uint8_t*)frame + (height-1) * pitch; + line_size = (width * bytes_per_pixel + 3) & ~3; + + if (type == RBMP_SOURCE_TYPE_BGR24) + { + /* BGR24 byte order input matches output. Can directly copy, but... need to make sure we pad it. */ + uint32_t zeros = 0; + int pad = line_size-pitch; + for (j = height-1; j >= 0; j--, u.u8 -= pitch) + { + retro_fwrite(file, u.u8, pitch); + if(pad != 0) retro_fwrite(file, &zeros, pad); + } + return; + } + else if(type == RBMP_SOURCE_TYPE_ARGB8888) + { + /* ARGB8888 byte order input matches output. Can directly copy. */ + for (j = height-1; j >= 0; j--, u.u8 -= pitch) + { + retro_fwrite(file, u.u8, line_size); + } + return; + } + + /* allocate line buffer, and initialize the final four bytes to zero, for deterministic padding */ + line = (uint8_t*)malloc(line_size); + if (!line) return; + *(uint32_t*)(line + line_size - 4) = 0; + + if (type == RBMP_SOURCE_TYPE_XRGB888) + { + for (j = height-1; j >= 0; j--, u.u8 -= pitch) + { + dump_line_32_to_24(line, u.u32, width); + retro_fwrite(file, line, line_size); + } + } + else /* type == RBMP_SOURCE_TYPE_RGB565 */ + { + for (j = height-1; j >= 0; j--, u.u8 -= pitch) + { + dump_line_565_to_24(line, u.u16, width); + retro_fwrite(file, line, line_size); + } + } + +} + +bool rbmp_save_image(const char *filename, const void *frame, + unsigned width, unsigned height, + unsigned pitch, rbmp_source_type type) +{ + bool ret; + RFILE *file = retro_fopen(filename, RFILE_MODE_WRITE, -1); + if (!file) + return false; + + ret = write_header_bmp(file, width, height, type==RBMP_SOURCE_TYPE_ARGB8888); + + if (ret) + dump_content(file, frame, width, height, pitch, type); + + retro_fclose(file); + + return ret; +} diff --git a/desmume/src/libretro-common/formats/png/Makefile b/desmume/src/libretro-common/formats/png/Makefile new file mode 100644 index 000000000..b5d93e0e2 --- /dev/null +++ b/desmume/src/libretro-common/formats/png/Makefile @@ -0,0 +1,37 @@ +TARGET := rpng +HAVE_IMLIB2=1 + +LDFLAGS += -lz + +ifeq ($(HAVE_IMLIB2),1) +CFLAGS += -DHAVE_IMLIB2 +LDFLAGS += -lImlib2 +endif + +SOURCES_C := rpng.c \ + rpng_encode.c \ + rpng_test.c \ + ../../compat/compat.c \ + ../../file/nbio/nbio_stdio.c \ + ../../file/file_extract.c \ + ../../file/file_path.c \ + ../../file/retro_file.c \ + ../../string/string_list.c + +OBJS := $(SOURCES_C:.c=.o) + +CFLAGS += -Wall -pedantic -std=gnu99 -O0 -g -DHAVE_ZLIB -DHAVE_ZLIB_DEFLATE -DRPNG_TEST -I../../include + +all: $(TARGET) + +%.o: %.c + $(CC) -c -o $@ $< $(CFLAGS) + +$(TARGET): $(OBJS) + $(CC) -o $@ $^ $(LDFLAGS) + +clean: + rm -f $(TARGET) $(OBJS) + +.PHONY: clean + diff --git a/desmume/src/libretro-common/formats/png/rpng.c b/desmume/src/libretro-common/formats/png/rpng.c new file mode 100644 index 000000000..09287d54f --- /dev/null +++ b/desmume/src/libretro-common/formats/png/rpng.c @@ -0,0 +1,1115 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rpng.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include + +#ifdef GEKKO +#include +#endif + +#include +#include +#include +#include + +#include "rpng_internal.h" + +enum png_ihdr_color_type +{ + PNG_IHDR_COLOR_GRAY = 0, + PNG_IHDR_COLOR_RGB = 2, + PNG_IHDR_COLOR_PLT = 3, + PNG_IHDR_COLOR_GRAY_ALPHA = 4, + PNG_IHDR_COLOR_RGBA = 6 +}; + +enum png_line_filter +{ + PNG_FILTER_NONE = 0, + PNG_FILTER_SUB, + PNG_FILTER_UP, + PNG_FILTER_AVERAGE, + PNG_FILTER_PAETH +}; + +enum png_chunk_type +{ + PNG_CHUNK_NOOP = 0, + PNG_CHUNK_ERROR, + PNG_CHUNK_IHDR, + PNG_CHUNK_IDAT, + PNG_CHUNK_PLTE, + PNG_CHUNK_IEND +}; + +struct adam7_pass +{ + unsigned x; + unsigned y; + unsigned stride_x; + unsigned stride_y; +}; + +struct idat_buffer +{ + uint8_t *data; + size_t size; +}; + +struct png_chunk +{ + uint32_t size; + char type[4]; + uint8_t *data; +}; + +struct rpng_process_t +{ + bool initialized; + bool inflate_initialized; + bool adam7_pass_initialized; + bool pass_initialized; + uint32_t *data; + uint32_t *palette; + struct png_ihdr ihdr; + uint8_t *prev_scanline; + uint8_t *decoded_scanline; + uint8_t *inflate_buf; + size_t restore_buf_size; + size_t adam7_restore_buf_size; + size_t data_restore_buf_size; + size_t inflate_buf_size; + unsigned bpp; + unsigned pitch; + unsigned h; + struct + { + unsigned width; + unsigned height; + size_t size; + unsigned pos; + } pass; + void *stream; + zlib_file_handle_t handle; +}; + +struct rpng +{ + struct rpng_process_t process; + bool has_ihdr; + bool has_idat; + bool has_iend; + bool has_plte; + struct idat_buffer idat_buf; + struct png_ihdr ihdr; + uint8_t *buff_data; + uint32_t palette[256]; +}; + +enum png_process_code +{ + PNG_PROCESS_ERROR = -2, + PNG_PROCESS_ERROR_END = -1, + PNG_PROCESS_NEXT = 0, + PNG_PROCESS_END = 1 +}; + +static INLINE uint32_t dword_be(const uint8_t *buf) +{ + return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | (buf[3] << 0); +} + +static enum png_chunk_type png_chunk_type(const struct png_chunk *chunk) +{ + unsigned i; + struct + { + const char *id; + enum png_chunk_type type; + } static const chunk_map[] = { + { "IHDR", PNG_CHUNK_IHDR }, + { "IDAT", PNG_CHUNK_IDAT }, + { "IEND", PNG_CHUNK_IEND }, + { "PLTE", PNG_CHUNK_PLTE }, + }; + + for (i = 0; i < ARRAY_SIZE(chunk_map); i++) + { + if (memcmp(chunk->type, chunk_map[i].id, 4) == 0) + return chunk_map[i].type; + } + + return PNG_CHUNK_NOOP; +} + +static bool png_process_ihdr(struct png_ihdr *ihdr) +{ + unsigned i; + bool ret = true; + + switch (ihdr->color_type) + { + case PNG_IHDR_COLOR_RGB: + case PNG_IHDR_COLOR_GRAY_ALPHA: + case PNG_IHDR_COLOR_RGBA: + if (ihdr->depth != 8 && ihdr->depth != 16) + GOTO_END_ERROR(); + break; + case PNG_IHDR_COLOR_GRAY: + { + static const unsigned valid_bpp[] = { 1, 2, 4, 8, 16 }; + bool correct_bpp = false; + + for (i = 0; i < ARRAY_SIZE(valid_bpp); i++) + { + if (valid_bpp[i] == ihdr->depth) + { + correct_bpp = true; + break; + } + } + + if (!correct_bpp) + GOTO_END_ERROR(); + } + break; + case PNG_IHDR_COLOR_PLT: + { + static const unsigned valid_bpp[] = { 1, 2, 4, 8 }; + bool correct_bpp = false; + + for (i = 0; i < ARRAY_SIZE(valid_bpp); i++) + { + if (valid_bpp[i] == ihdr->depth) + { + correct_bpp = true; + break; + } + } + + if (!correct_bpp) + GOTO_END_ERROR(); + } + break; + default: + GOTO_END_ERROR(); + } + +#ifdef RPNG_TEST + fprintf(stderr, "IHDR: (%u x %u), bpc = %u, palette = %s, color = %s, alpha = %s, adam7 = %s.\n", + ihdr->width, ihdr->height, + ihdr->depth, ihdr->color_type == PNG_IHDR_COLOR_PLT ? "yes" : "no", + ihdr->color_type & PNG_IHDR_COLOR_RGB ? "yes" : "no", + ihdr->color_type & PNG_IHDR_COLOR_GRAY_ALPHA ? "yes" : "no", + ihdr->interlace == 1 ? "yes" : "no"); +#endif + + if (ihdr->compression != 0) + GOTO_END_ERROR(); + +end: + return ret; +} + +static void png_reverse_filter_copy_line_rgb(uint32_t *data, + const uint8_t *decoded, unsigned width, unsigned bpp) +{ + unsigned i; + + bpp /= 8; + + for (i = 0; i < width; i++) + { + uint32_t r, g, b; + + r = *decoded; + decoded += bpp; + g = *decoded; + decoded += bpp; + b = *decoded; + decoded += bpp; + data[i] = (0xffu << 24) | (r << 16) | (g << 8) | (b << 0); + } +} + +static void png_reverse_filter_copy_line_rgba(uint32_t *data, + const uint8_t *decoded, unsigned width, unsigned bpp) +{ + unsigned i; + + bpp /= 8; + + for (i = 0; i < width; i++) + { + uint32_t r, g, b, a; + r = *decoded; + decoded += bpp; + g = *decoded; + decoded += bpp; + b = *decoded; + decoded += bpp; + a = *decoded; + decoded += bpp; + data[i] = (a << 24) | (r << 16) | (g << 8) | (b << 0); + } +} + +static void png_reverse_filter_copy_line_bw(uint32_t *data, + const uint8_t *decoded, unsigned width, unsigned depth) +{ + unsigned i, bit; + static const unsigned mul_table[] = { 0, 0xff, 0x55, 0, 0x11, 0, 0, 0, 0x01 }; + unsigned mul, mask; + + if (depth == 16) + { + for (i = 0; i < width; i++) + { + uint32_t val = decoded[i << 1]; + data[i] = (val * 0x010101) | (0xffu << 24); + } + return; + } + + mul = mul_table[depth]; + mask = (1 << depth) - 1; + bit = 0; + + for (i = 0; i < width; i++, bit += depth) + { + unsigned byte = bit >> 3; + unsigned val = decoded[byte] >> (8 - depth - (bit & 7)); + + val &= mask; + val *= mul; + data[i] = (val * 0x010101) | (0xffu << 24); + } +} + +static void png_reverse_filter_copy_line_gray_alpha(uint32_t *data, + const uint8_t *decoded, unsigned width, + unsigned bpp) +{ + unsigned i; + + bpp /= 8; + + for (i = 0; i < width; i++) + { + uint32_t gray, alpha; + + gray = *decoded; + decoded += bpp; + alpha = *decoded; + decoded += bpp; + + data[i] = (gray * 0x010101) | (alpha << 24); + } +} + +static void png_reverse_filter_copy_line_plt(uint32_t *data, + const uint8_t *decoded, unsigned width, + unsigned depth, const uint32_t *palette) +{ + unsigned i, bit; + unsigned mask = (1 << depth) - 1; + + bit = 0; + + for (i = 0; i < width; i++, bit += depth) + { + unsigned byte = bit >> 3; + unsigned val = decoded[byte] >> (8 - depth - (bit & 7)); + + val &= mask; + data[i] = palette[val]; + } +} + +static void png_pass_geom(const struct png_ihdr *ihdr, + unsigned width, unsigned height, + unsigned *bpp_out, unsigned *pitch_out, size_t *pass_size) +{ + unsigned bpp; + unsigned pitch; + + switch (ihdr->color_type) + { + case PNG_IHDR_COLOR_GRAY: + bpp = (ihdr->depth + 7) / 8; + pitch = (ihdr->width * ihdr->depth + 7) / 8; + break; + case PNG_IHDR_COLOR_RGB: + bpp = (ihdr->depth * 3 + 7) / 8; + pitch = (ihdr->width * ihdr->depth * 3 + 7) / 8; + break; + case PNG_IHDR_COLOR_PLT: + bpp = (ihdr->depth + 7) / 8; + pitch = (ihdr->width * ihdr->depth + 7) / 8; + break; + case PNG_IHDR_COLOR_GRAY_ALPHA: + bpp = (ihdr->depth * 2 + 7) / 8; + pitch = (ihdr->width * ihdr->depth * 2 + 7) / 8; + break; + case PNG_IHDR_COLOR_RGBA: + bpp = (ihdr->depth * 4 + 7) / 8; + pitch = (ihdr->width * ihdr->depth * 4 + 7) / 8; + break; + default: + bpp = 0; + pitch = 0; + break; + } + + if (pass_size) + *pass_size = (pitch + 1) * ihdr->height; + if (bpp_out) + *bpp_out = bpp; + if (pitch_out) + *pitch_out = pitch; +} + +static void png_reverse_filter_adam7_deinterlace_pass(uint32_t *data, + const struct png_ihdr *ihdr, + const uint32_t *input, unsigned pass_width, unsigned pass_height, + const struct adam7_pass *pass) +{ + unsigned x, y; + + data += pass->y * ihdr->width + pass->x; + + for (y = 0; y < pass_height; + y++, data += ihdr->width * pass->stride_y, input += pass_width) + { + uint32_t *out = data; + + for (x = 0; x < pass_width; x++, out += pass->stride_x) + *out = input[x]; + } +} + +static void png_reverse_filter_deinit(struct rpng_process_t *pngp) +{ + if (pngp->decoded_scanline) + free(pngp->decoded_scanline); + pngp->decoded_scanline = NULL; + if (pngp->prev_scanline) + free(pngp->prev_scanline); + pngp->prev_scanline = NULL; + + pngp->pass_initialized = false; + pngp->h = 0; +} + +static const struct adam7_pass passes[] = { + { 0, 0, 8, 8 }, + { 4, 0, 8, 8 }, + { 0, 4, 4, 8 }, + { 2, 0, 4, 4 }, + { 0, 2, 2, 4 }, + { 1, 0, 2, 2 }, + { 0, 1, 1, 2 }, +}; + +static int png_reverse_filter_init(const struct png_ihdr *ihdr, + struct rpng_process_t *pngp) +{ + size_t pass_size; + + if (!pngp->adam7_pass_initialized && ihdr->interlace) + { + if (ihdr->width <= passes[pngp->pass.pos].x || + ihdr->height <= passes[pngp->pass.pos].y) /* Empty pass */ + return 1; + + pngp->pass.width = (ihdr->width - + passes[pngp->pass.pos].x + passes[pngp->pass.pos].stride_x - 1) / passes[pngp->pass.pos].stride_x; + pngp->pass.height = (ihdr->height - passes[pngp->pass.pos].y + + passes[pngp->pass.pos].stride_y - 1) / passes[pngp->pass.pos].stride_y; + + pngp->data = (uint32_t*)malloc( + pngp->pass.width * pngp->pass.height * sizeof(uint32_t)); + + if (!pngp->data) + return -1; + + pngp->ihdr = *ihdr; + pngp->ihdr.width = pngp->pass.width; + pngp->ihdr.height = pngp->pass.height; + + png_pass_geom(&pngp->ihdr, pngp->pass.width, + pngp->pass.height, NULL, NULL, &pngp->pass.size); + + if (pngp->pass.size > zlib_stream_get_total_out(pngp->stream)) + { + free(pngp->data); + return -1; + } + + pngp->adam7_pass_initialized = true; + + return 0; + } + + if (pngp->pass_initialized) + return 0; + + png_pass_geom(ihdr, ihdr->width, ihdr->height, &pngp->bpp, &pngp->pitch, &pass_size); + + if (zlib_stream_get_total_out(pngp->stream) < pass_size) + return -1; + + pngp->restore_buf_size = 0; + pngp->data_restore_buf_size = 0; + pngp->prev_scanline = (uint8_t*)calloc(1, pngp->pitch); + pngp->decoded_scanline = (uint8_t*)calloc(1, pngp->pitch); + + if (!pngp->prev_scanline || !pngp->decoded_scanline) + goto error; + + pngp->h = 0; + pngp->pass_initialized = true; + + return 0; + +error: + png_reverse_filter_deinit(pngp); + return -1; +} + +static int png_reverse_filter_copy_line(uint32_t *data, const struct png_ihdr *ihdr, + struct rpng_process_t *pngp, unsigned filter) +{ + unsigned i; + + switch (filter) + { + case PNG_FILTER_NONE: + memcpy(pngp->decoded_scanline, pngp->inflate_buf, pngp->pitch); + break; + case PNG_FILTER_SUB: + for (i = 0; i < pngp->bpp; i++) + pngp->decoded_scanline[i] = pngp->inflate_buf[i]; + for (i = pngp->bpp; i < pngp->pitch; i++) + pngp->decoded_scanline[i] = pngp->decoded_scanline[i - pngp->bpp] + pngp->inflate_buf[i]; + break; + case PNG_FILTER_UP: + for (i = 0; i < pngp->pitch; i++) + pngp->decoded_scanline[i] = pngp->prev_scanline[i] + pngp->inflate_buf[i]; + break; + case PNG_FILTER_AVERAGE: + for (i = 0; i < pngp->bpp; i++) + { + uint8_t avg = pngp->prev_scanline[i] >> 1; + pngp->decoded_scanline[i] = avg + pngp->inflate_buf[i]; + } + for (i = pngp->bpp; i < pngp->pitch; i++) + { + uint8_t avg = (pngp->decoded_scanline[i - pngp->bpp] + pngp->prev_scanline[i]) >> 1; + pngp->decoded_scanline[i] = avg + pngp->inflate_buf[i]; + } + break; + case PNG_FILTER_PAETH: + for (i = 0; i < pngp->bpp; i++) + pngp->decoded_scanline[i] = paeth(0, pngp->prev_scanline[i], 0) + pngp->inflate_buf[i]; + for (i = pngp->bpp; i < pngp->pitch; i++) + pngp->decoded_scanline[i] = paeth(pngp->decoded_scanline[i - pngp->bpp], + pngp->prev_scanline[i], pngp->prev_scanline[i - pngp->bpp]) + pngp->inflate_buf[i]; + break; + + default: + return PNG_PROCESS_ERROR_END; + } + + switch (ihdr->color_type) + { + case PNG_IHDR_COLOR_GRAY: + png_reverse_filter_copy_line_bw(data, pngp->decoded_scanline, ihdr->width, ihdr->depth); + break; + case PNG_IHDR_COLOR_RGB: + png_reverse_filter_copy_line_rgb(data, pngp->decoded_scanline, ihdr->width, ihdr->depth); + break; + case PNG_IHDR_COLOR_PLT: + png_reverse_filter_copy_line_plt(data, pngp->decoded_scanline, ihdr->width, + ihdr->depth, pngp->palette); + break; + case PNG_IHDR_COLOR_GRAY_ALPHA: + png_reverse_filter_copy_line_gray_alpha(data, pngp->decoded_scanline, ihdr->width, + ihdr->depth); + break; + case PNG_IHDR_COLOR_RGBA: + png_reverse_filter_copy_line_rgba(data, pngp->decoded_scanline, ihdr->width, ihdr->depth); + break; + } + + memcpy(pngp->prev_scanline, pngp->decoded_scanline, pngp->pitch); + + return PNG_PROCESS_NEXT; +} + +static int png_reverse_filter_regular_iterate(uint32_t **data, const struct png_ihdr *ihdr, + struct rpng_process_t *pngp) +{ + int ret = PNG_PROCESS_END; + + if (pngp->h < ihdr->height) + { + unsigned filter = *pngp->inflate_buf++; + pngp->restore_buf_size += 1; + ret = png_reverse_filter_copy_line(*data, + ihdr, pngp, filter); + } + + if (ret == PNG_PROCESS_END || ret == PNG_PROCESS_ERROR_END) + goto end; + + pngp->h++; + pngp->inflate_buf += pngp->pitch; + pngp->restore_buf_size += pngp->pitch; + + *data += ihdr->width; + pngp->data_restore_buf_size += ihdr->width; + + return PNG_PROCESS_NEXT; + +end: + png_reverse_filter_deinit(pngp); + + pngp->inflate_buf -= pngp->restore_buf_size; + *data -= pngp->data_restore_buf_size; + pngp->data_restore_buf_size = 0; + return ret; +} + +static int png_reverse_filter_adam7_iterate(uint32_t **data_, + const struct png_ihdr *ihdr, + struct rpng_process_t *pngp) +{ + int ret = 0; + bool to_next = pngp->pass.pos < ARRAY_SIZE(passes); + uint32_t *data = *data_; + + if (!to_next) + return PNG_PROCESS_END; + + ret = png_reverse_filter_init(ihdr, pngp); + + if (ret == 1) + return PNG_PROCESS_NEXT; + if (ret == -1) + return PNG_PROCESS_ERROR_END; + + if (png_reverse_filter_init(&pngp->ihdr, pngp) == -1) + return PNG_PROCESS_ERROR; + + do{ + ret = png_reverse_filter_regular_iterate(&pngp->data, + &pngp->ihdr, pngp); + }while(ret == PNG_PROCESS_NEXT); + + if (ret == PNG_PROCESS_ERROR || ret == PNG_PROCESS_ERROR_END) + return PNG_PROCESS_ERROR; + + pngp->inflate_buf += pngp->pass.size; + pngp->adam7_restore_buf_size += pngp->pass.size; + + zlib_stream_decrement_total_out(pngp->stream, pngp->pass.size); + + png_reverse_filter_adam7_deinterlace_pass(data, + ihdr, pngp->data, pngp->pass.width, pngp->pass.height, &passes[pngp->pass.pos]); + + free(pngp->data); + + pngp->pass.width = 0; + pngp->pass.height = 0; + pngp->pass.size = 0; + pngp->adam7_pass_initialized = false; + + return PNG_PROCESS_NEXT; +} + +static int png_reverse_filter_adam7(uint32_t **data_, + const struct png_ihdr *ihdr, + struct rpng_process_t *pngp) +{ + int ret = png_reverse_filter_adam7_iterate(data_, + ihdr, pngp); + + switch (ret) + { + case PNG_PROCESS_ERROR_END: + case PNG_PROCESS_END: + break; + case PNG_PROCESS_NEXT: + pngp->pass.pos++; + return 0; + case PNG_PROCESS_ERROR: + if (pngp->data) + free(pngp->data); + pngp->inflate_buf -= pngp->adam7_restore_buf_size; + pngp->adam7_restore_buf_size = 0; + return -1; + } + + pngp->inflate_buf -= pngp->adam7_restore_buf_size; + pngp->adam7_restore_buf_size = 0; + return ret; +} + +static int png_reverse_filter_iterate(rpng_t *rpng, uint32_t **data) +{ + if (!rpng) + return false; + + if (rpng->ihdr.interlace) + return png_reverse_filter_adam7(data, &rpng->ihdr, &rpng->process); + + return png_reverse_filter_regular_iterate(data, &rpng->ihdr, &rpng->process); +} + +static int rpng_load_image_argb_process_inflate_init(rpng_t *rpng, + uint32_t **data, unsigned *width, unsigned *height) +{ + int zstatus; + bool to_continue = (zlib_stream_get_avail_in(rpng->process.stream) > 0 + && zlib_stream_get_avail_out(rpng->process.stream) > 0); + + if (!to_continue) + goto end; + + zstatus = zlib_inflate_data_to_file_iterate(rpng->process.stream); + + switch (zstatus) + { + case 1: + goto end; + case -1: + goto error; + default: + break; + } + + return 0; + +end: + zlib_stream_free(rpng->process.stream); + + *width = rpng->ihdr.width; + *height = rpng->ihdr.height; +#ifdef GEKKO + /* we often use these in textures, make sure they're 32-byte aligned */ + *data = (uint32_t*)memalign(32, rpng->ihdr.width * + rpng->ihdr.height * sizeof(uint32_t)); +#else + *data = (uint32_t*)malloc(rpng->ihdr.width * + rpng->ihdr.height * sizeof(uint32_t)); +#endif + if (!*data) + goto false_end; + + rpng->process.adam7_restore_buf_size = 0; + rpng->process.restore_buf_size = 0; + rpng->process.palette = rpng->palette; + + if (rpng->ihdr.interlace != 1) + if (png_reverse_filter_init(&rpng->ihdr, &rpng->process) == -1) + goto false_end; + + rpng->process.inflate_initialized = true; + return 1; + +error: + zlib_stream_free(rpng->process.stream); + +false_end: + rpng->process.inflate_initialized = false; + return -1; +} + +static bool png_read_plte(uint8_t *buf, + uint32_t *buffer, unsigned entries) +{ + unsigned i; + + for (i = 0; i < entries; i++) + { + uint32_t r = buf[3 * i + 0]; + uint32_t g = buf[3 * i + 1]; + uint32_t b = buf[3 * i + 2]; + buffer[i] = (r << 16) | (g << 8) | (b << 0) | (0xffu << 24); + } + + return true; +} + +bool png_realloc_idat(const struct png_chunk *chunk, struct idat_buffer *buf) +{ + uint8_t *new_buffer = (uint8_t*)realloc(buf->data, buf->size + chunk->size); + + if (!new_buffer) + return false; + + buf->data = new_buffer; + return true; +} + +static bool rpng_load_image_argb_process_init(rpng_t *rpng, + uint32_t **data, unsigned *width, unsigned *height) +{ + rpng->process.inflate_buf_size = 0; + rpng->process.inflate_buf = NULL; + + png_pass_geom(&rpng->ihdr, rpng->ihdr.width, + rpng->ihdr.height, NULL, NULL, &rpng->process.inflate_buf_size); + if (rpng->ihdr.interlace == 1) /* To be sure. */ + rpng->process.inflate_buf_size *= 2; + + rpng->process.stream = zlib_stream_new(); + + if (!rpng->process.stream) + return false; + + if (!zlib_inflate_init(rpng->process.stream)) + return false; + + rpng->process.inflate_buf = (uint8_t*)malloc(rpng->process.inflate_buf_size); + if (!rpng->process.inflate_buf) + return false; + + zlib_set_stream( + rpng->process.stream, + rpng->idat_buf.size, + rpng->process.inflate_buf_size, + rpng->idat_buf.data, + rpng->process.inflate_buf); + + rpng->process.initialized = true; + + return true; +} + +static bool read_chunk_header(uint8_t *buf, struct png_chunk *chunk) +{ + unsigned i; + uint8_t dword[4] = {0}; + + for (i = 0; i < 4; i++) + dword[i] = buf[i]; + + buf += 4; + + chunk->size = dword_be(dword); + + for (i = 0; i < 4; i++) + chunk->type[i] = buf[i]; + + buf += 4; + + return true; +} + +static bool png_parse_ihdr(uint8_t *buf, + struct png_ihdr *ihdr) +{ + buf += 4 + 4; + + ihdr->width = dword_be(buf + 0); + ihdr->height = dword_be(buf + 4); + ihdr->depth = buf[8]; + ihdr->color_type = buf[9]; + ihdr->compression = buf[10]; + ihdr->filter = buf[11]; + ihdr->interlace = buf[12]; + + if (ihdr->width == 0 || ihdr->height == 0) + return false; + + return true; +} + +bool rpng_nbio_load_image_argb_iterate(rpng_t *rpng) +{ + unsigned i; + unsigned ret; + uint8_t *buf = (uint8_t*)rpng->buff_data; + + struct png_chunk chunk = {0}; + + if (!read_chunk_header(buf, &chunk)) + return false; + +#if 0 + for (i = 0; i < 4; i++) + { + fprintf(stderr, "chunktype: %c\n", chunk.type[i]); + } +#endif + + switch (png_chunk_type(&chunk)) + { + case PNG_CHUNK_NOOP: + default: + break; + + case PNG_CHUNK_ERROR: + goto error; + + case PNG_CHUNK_IHDR: + if (rpng->has_ihdr || rpng->has_idat || rpng->has_iend) + goto error; + + if (chunk.size != 13) + goto error; + + if (!png_parse_ihdr(buf, &rpng->ihdr)) + goto error; + + if (!png_process_ihdr(&rpng->ihdr)) + goto error; + + rpng->has_ihdr = true; + break; + + case PNG_CHUNK_PLTE: + { + unsigned entries = chunk.size / 3; + + if (!rpng->has_ihdr || rpng->has_plte || rpng->has_iend || rpng->has_idat) + goto error; + + if (chunk.size % 3) + goto error; + + if (entries > 256) + goto error; + + buf += 8; + + if (!png_read_plte(buf, rpng->palette, entries)) + goto error; + + rpng->has_plte = true; + } + break; + + case PNG_CHUNK_IDAT: + if (!(rpng->has_ihdr) || rpng->has_iend || (rpng->ihdr.color_type == PNG_IHDR_COLOR_PLT && !(rpng->has_plte))) + goto error; + + if (!png_realloc_idat(&chunk, &rpng->idat_buf)) + goto error; + + buf += 8; + + for (i = 0; i < chunk.size; i++) + rpng->idat_buf.data[i + rpng->idat_buf.size] = buf[i]; + + rpng->idat_buf.size += chunk.size; + + rpng->has_idat = true; + break; + + case PNG_CHUNK_IEND: + if (!(rpng->has_ihdr) || !(rpng->has_idat)) + goto error; + + rpng->has_iend = true; + goto error; + } + + ret = 4 + 4 + chunk.size + 4; + rpng->buff_data += ret; + + return true; + +error: + return false; +} + +int rpng_nbio_load_image_argb_process(rpng_t *rpng, + uint32_t **data, unsigned *width, unsigned *height) +{ + if (!rpng->process.initialized) + { + if (!rpng_load_image_argb_process_init(rpng, data, width, + height)) + return PNG_PROCESS_ERROR; + return 0; + } + + if (!rpng->process.inflate_initialized) + { + int ret = rpng_load_image_argb_process_inflate_init(rpng, data, + width, height); + if (ret == -1) + return PNG_PROCESS_ERROR; + return 0; + } + + return png_reverse_filter_iterate(rpng, data); +} + +void rpng_nbio_load_image_free(rpng_t *rpng) +{ + if (!rpng) + return; + + if (rpng->idat_buf.data) + free(rpng->idat_buf.data); + if (rpng->process.inflate_buf) + free(rpng->process.inflate_buf); + if (rpng->process.stream) + { + zlib_stream_free(rpng->process.stream); + free(rpng->process.stream); + } + + free(rpng); +} + +bool rpng_nbio_load_image_argb_start(rpng_t *rpng) +{ + unsigned i; + char header[8] = {0}; + + if (!rpng) + return false; + + for (i = 0; i < 8; i++) + header[i] = rpng->buff_data[i]; + + if (memcmp(header, png_magic, sizeof(png_magic)) != 0) + return false; + + rpng->buff_data += 8; + + return true; +} + +bool rpng_is_valid(rpng_t *rpng) +{ + if (!rpng) + return false; + + if (rpng->has_ihdr) + return true; + if (rpng->has_idat) + return true; + if (rpng->has_iend) + return true; + return false; +} + +bool rpng_set_buf_ptr(rpng_t *rpng, uint8_t *data) +{ + if (!rpng) + return false; + + rpng->buff_data = data; + + return true; +} + +rpng_t *rpng_alloc(void) +{ + rpng_t *rpng = (rpng_t*)calloc(1, sizeof(rpng_t)); + if (!rpng) + return NULL; + return rpng; +} + +bool rpng_load_image_argb(const char *path, uint32_t **data, + unsigned *width, unsigned *height) +{ + int retval; + size_t file_len; + bool ret = true; + rpng_t *rpng = NULL; + void *ptr = NULL; + struct nbio_t* handle = (struct nbio_t*)nbio_open(path, NBIO_READ); + + if (!handle) + goto end; + + ptr = nbio_get_ptr(handle, &file_len); + + nbio_begin_read(handle); + + while (!nbio_iterate(handle)); + + ptr = nbio_get_ptr(handle, &file_len); + + if (!ptr) + { + ret = false; + goto end; + } + + rpng = rpng_alloc(); + + if (!rpng) + { + ret = false; + goto end; + } + + if (!rpng_set_buf_ptr(rpng, (uint8_t*)ptr)) + { + ret = false; + goto end; + } + + if (!rpng_nbio_load_image_argb_start(rpng)) + { + ret = false; + goto end; + } + + while (rpng_nbio_load_image_argb_iterate(rpng)); + + if (!rpng_is_valid(rpng)) + { + ret = false; + goto end; + } + + do + { + retval = rpng_nbio_load_image_argb_process(rpng, data, width, height); + }while(retval == PNG_PROCESS_NEXT); + + if (retval == PNG_PROCESS_ERROR || retval == PNG_PROCESS_ERROR_END) + ret = false; + +end: + if (handle) + nbio_free(handle); + if (rpng) + rpng_nbio_load_image_free(rpng); + rpng = NULL; + if (!ret) + free(*data); + return ret; +} diff --git a/desmume/src/libretro-common/formats/png/rpng_encode.c b/desmume/src/libretro-common/formats/png/rpng_encode.c new file mode 100644 index 000000000..b276ff47c --- /dev/null +++ b/desmume/src/libretro-common/formats/png/rpng_encode.c @@ -0,0 +1,383 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rpng.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include + +#include + +#include "rpng_internal.h" + +#undef GOTO_END_ERROR +#define GOTO_END_ERROR() do { \ + fprintf(stderr, "[RPNG]: Error in line %d.\n", __LINE__); \ + ret = false; \ + goto end; \ +} while(0) + +#ifdef HAVE_ZLIB_DEFLATE + +static void dword_write_be(uint8_t *buf, uint32_t val) +{ + *buf++ = (uint8_t)(val >> 24); + *buf++ = (uint8_t)(val >> 16); + *buf++ = (uint8_t)(val >> 8); + *buf++ = (uint8_t)(val >> 0); +} + +static bool png_write_crc(RFILE *file, const uint8_t *data, size_t size) +{ + uint8_t crc_raw[4] = {0}; + uint32_t crc = zlib_crc32_calculate(data, size); + + dword_write_be(crc_raw, crc); + return retro_fwrite(file, crc_raw, sizeof(crc_raw)) == sizeof(crc_raw); +} + +static bool png_write_ihdr(RFILE *file, const struct png_ihdr *ihdr) +{ + uint8_t ihdr_raw[21]; + + ihdr_raw[0] = '0'; /* Size */ + ihdr_raw[1] = '0'; + ihdr_raw[2] = '0'; + ihdr_raw[3] = '0'; + ihdr_raw[4] = 'I'; + ihdr_raw[5] = 'H'; + ihdr_raw[6] = 'D'; + ihdr_raw[7] = 'R'; + ihdr_raw[8] = 0; /* Width */ + ihdr_raw[9] = 0; + ihdr_raw[10] = 0; + ihdr_raw[11] = 0; + ihdr_raw[12] = 0; /* Height */ + ihdr_raw[13] = 0; + ihdr_raw[14] = 0; + ihdr_raw[15] = 0; + ihdr_raw[16] = ihdr->depth; /* Depth */ + ihdr_raw[17] = ihdr->color_type; + ihdr_raw[18] = ihdr->compression; + ihdr_raw[19] = ihdr->filter; + ihdr_raw[20] = ihdr->interlace; + + dword_write_be(ihdr_raw + 0, sizeof(ihdr_raw) - 8); + dword_write_be(ihdr_raw + 8, ihdr->width); + dword_write_be(ihdr_raw + 12, ihdr->height); + if (retro_fwrite(file, ihdr_raw, sizeof(ihdr_raw)) != sizeof(ihdr_raw)) + return false; + + if (!png_write_crc(file, ihdr_raw + sizeof(uint32_t), + sizeof(ihdr_raw) - sizeof(uint32_t))) + return false; + + return true; +} + +static bool png_write_idat(RFILE *file, const uint8_t *data, size_t size) +{ + if (retro_fwrite(file, data, size) != (ssize_t)size) + return false; + + if (!png_write_crc(file, data + sizeof(uint32_t), size - sizeof(uint32_t))) + return false; + + return true; +} + +static bool png_write_iend(RFILE *file) +{ + const uint8_t data[] = { + 0, 0, 0, 0, + 'I', 'E', 'N', 'D', + }; + + if (retro_fwrite(file, data, sizeof(data)) != sizeof(data)) + return false; + + if (!png_write_crc(file, data + sizeof(uint32_t), + sizeof(data) - sizeof(uint32_t))) + return false; + + return true; +} + +static void copy_argb_line(uint8_t *dst, const uint32_t *src, unsigned width) +{ + unsigned i; + for (i = 0; i < width; i++) + { + uint32_t col = src[i]; + *dst++ = (uint8_t)(col >> 16); + *dst++ = (uint8_t)(col >> 8); + *dst++ = (uint8_t)(col >> 0); + *dst++ = (uint8_t)(col >> 24); + } +} + +static void copy_bgr24_line(uint8_t *dst, const uint8_t *src, unsigned width) +{ + unsigned i; + for (i = 0; i < width; i++, dst += 3, src += 3) + { + dst[2] = src[0]; + dst[1] = src[1]; + dst[0] = src[2]; + } +} + +static unsigned count_sad(const uint8_t *data, size_t size) +{ + size_t i; + unsigned cnt = 0; + for (i = 0; i < size; i++) + cnt += abs((int8_t)data[i]); + return cnt; +} + +static unsigned filter_up(uint8_t *target, const uint8_t *line, + const uint8_t *prev, unsigned width, unsigned bpp) +{ + unsigned i; + width *= bpp; + for (i = 0; i < width; i++) + target[i] = line[i] - prev[i]; + + return count_sad(target, width); +} + +static unsigned filter_sub(uint8_t *target, const uint8_t *line, + unsigned width, unsigned bpp) +{ + unsigned i; + width *= bpp; + for (i = 0; i < bpp; i++) + target[i] = line[i]; + for (i = bpp; i < width; i++) + target[i] = line[i] - line[i - bpp]; + + return count_sad(target, width); +} + +static unsigned filter_avg(uint8_t *target, const uint8_t *line, + const uint8_t *prev, unsigned width, unsigned bpp) +{ + unsigned i; + width *= bpp; + for (i = 0; i < bpp; i++) + target[i] = line[i] - (prev[i] >> 1); + for (i = bpp; i < width; i++) + target[i] = line[i] - ((line[i - bpp] + prev[i]) >> 1); + + return count_sad(target, width); +} + +static unsigned filter_paeth(uint8_t *target, + const uint8_t *line, const uint8_t *prev, + unsigned width, unsigned bpp) +{ + unsigned i; + width *= bpp; + for (i = 0; i < bpp; i++) + target[i] = line[i] - paeth(0, prev[i], 0); + for (i = bpp; i < width; i++) + target[i] = line[i] - paeth(line[i - bpp], prev[i], prev[i - bpp]); + + return count_sad(target, width); +} + +static bool rpng_save_image(const char *path, + const uint8_t *data, + unsigned width, unsigned height, unsigned pitch, unsigned bpp) +{ + unsigned h; + bool ret = true; + struct png_ihdr ihdr = {0}; + + size_t encode_buf_size = 0; + uint8_t *encode_buf = NULL; + uint8_t *deflate_buf = NULL; + uint8_t *rgba_line = NULL; + uint8_t *up_filtered = NULL; + uint8_t *sub_filtered = NULL; + uint8_t *avg_filtered = NULL; + uint8_t *paeth_filtered = NULL; + uint8_t *prev_encoded = NULL; + uint8_t *encode_target = NULL; + void *stream = NULL; + + RFILE *file = retro_fopen(path, RFILE_MODE_WRITE, -1); + if (!file) + GOTO_END_ERROR(); + + if (retro_fwrite(file, png_magic, sizeof(png_magic)) != sizeof(png_magic)) + GOTO_END_ERROR(); + + ihdr.width = width; + ihdr.height = height; + ihdr.depth = 8; + ihdr.color_type = bpp == sizeof(uint32_t) ? 6 : 2; /* RGBA or RGB */ + if (!png_write_ihdr(file, &ihdr)) + GOTO_END_ERROR(); + + encode_buf_size = (width * bpp + 1) * height; + encode_buf = (uint8_t*)malloc(encode_buf_size); + if (!encode_buf) + GOTO_END_ERROR(); + + prev_encoded = (uint8_t*)calloc(1, width * bpp); + if (!prev_encoded) + GOTO_END_ERROR(); + + rgba_line = (uint8_t*)malloc(width * bpp); + up_filtered = (uint8_t*)malloc(width * bpp); + sub_filtered = (uint8_t*)malloc(width * bpp); + avg_filtered = (uint8_t*)malloc(width * bpp); + paeth_filtered = (uint8_t*)malloc(width * bpp); + if (!rgba_line || !up_filtered || !sub_filtered || !avg_filtered || !paeth_filtered) + GOTO_END_ERROR(); + + encode_target = encode_buf; + for (h = 0; h < height; + h++, encode_target += width * bpp, data += pitch) + { + if (bpp == sizeof(uint32_t)) + copy_argb_line(rgba_line, (const uint32_t*)data, width); + else + copy_bgr24_line(rgba_line, data, width); + + /* Try every filtering method, and choose the method + * which has most entries as zero. + * + * This is probably not very optimal, but it's very + * simple to implement. + */ + { + unsigned none_score = count_sad(rgba_line, width * bpp); + unsigned up_score = filter_up(up_filtered, rgba_line, prev_encoded, width, bpp); + unsigned sub_score = filter_sub(sub_filtered, rgba_line, width, bpp); + unsigned avg_score = filter_avg(avg_filtered, rgba_line, prev_encoded, width, bpp); + unsigned paeth_score = filter_paeth(paeth_filtered, rgba_line, prev_encoded, width, bpp); + + uint8_t filter = 0; + unsigned min_sad = none_score; + const uint8_t *chosen_filtered = rgba_line; + + if (sub_score < min_sad) + { + filter = 1; + chosen_filtered = sub_filtered; + min_sad = sub_score; + } + + if (up_score < min_sad) + { + filter = 2; + chosen_filtered = up_filtered; + min_sad = up_score; + } + + if (avg_score < min_sad) + { + filter = 3; + chosen_filtered = avg_filtered; + min_sad = avg_score; + } + + if (paeth_score < min_sad) + { + filter = 4; + chosen_filtered = paeth_filtered; + min_sad = paeth_score; + } + + *encode_target++ = filter; + memcpy(encode_target, chosen_filtered, width * bpp); + + memcpy(prev_encoded, rgba_line, width * bpp); + } + } + + deflate_buf = (uint8_t*)malloc(encode_buf_size * 2); /* Just to be sure. */ + if (!deflate_buf) + GOTO_END_ERROR(); + + stream = zlib_stream_new(); + + if (!stream) + GOTO_END_ERROR(); + + zlib_set_stream( + stream, + encode_buf_size, + encode_buf_size * 2, + encode_buf, + deflate_buf + 8); + + zlib_deflate_init(stream, 9); + + if (zlib_deflate_data_to_file(stream) != 1) + { + zlib_stream_deflate_free(stream); + GOTO_END_ERROR(); + } + + zlib_stream_deflate_free(stream); + + memcpy(deflate_buf + 4, "IDAT", 4); + dword_write_be(deflate_buf + 0, zlib_stream_get_total_out(stream)); + if (!png_write_idat(file, deflate_buf, zlib_stream_get_total_out(stream) + 8)) + GOTO_END_ERROR(); + + if (!png_write_iend(file)) + GOTO_END_ERROR(); + +end: + retro_fclose(file); + free(encode_buf); + free(deflate_buf); + free(rgba_line); + free(prev_encoded); + free(up_filtered); + free(sub_filtered); + free(avg_filtered); + free(paeth_filtered); + + zlib_stream_free(stream); + return ret; +} + +bool rpng_save_image_argb(const char *path, const uint32_t *data, + unsigned width, unsigned height, unsigned pitch) +{ + return rpng_save_image(path, (const uint8_t*)data, + width, height, pitch, sizeof(uint32_t)); +} + +bool rpng_save_image_bgr24(const char *path, const uint8_t *data, + unsigned width, unsigned height, unsigned pitch) +{ + return rpng_save_image(path, (const uint8_t*)data, + width, height, pitch, 3); +} + +#endif diff --git a/desmume/src/libretro-common/formats/png/rpng_internal.h b/desmume/src/libretro-common/formats/png/rpng_internal.h new file mode 100644 index 000000000..3dc092b83 --- /dev/null +++ b/desmume/src/libretro-common/formats/png/rpng_internal.h @@ -0,0 +1,71 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rpng.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _RPNG_COMMON_H +#define _RPNG_COMMON_H + +#include +#include +#include + +#undef GOTO_END_ERROR +#define GOTO_END_ERROR() do { \ + fprintf(stderr, "[RPNG]: Error in line %d.\n", __LINE__); \ + ret = false; \ + goto end; \ +} while(0) + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +#endif + +static const uint8_t png_magic[8] = { + 0x89, 'P', 'N', 'G', 0x0d, 0x0a, 0x1a, 0x0a, +}; + +struct png_ihdr +{ + uint32_t width; + uint32_t height; + uint8_t depth; + uint8_t color_type; + uint8_t compression; + uint8_t filter; + uint8_t interlace; +}; + +/* Paeth prediction filter. */ +static INLINE int paeth(int a, int b, int c) +{ + int p = a + b - c; + int pa = abs(p - a); + int pb = abs(p - b); + int pc = abs(p - c); + + if (pa <= pb && pa <= pc) + return a; + else if (pb <= pc) + return b; + return c; +} + +#endif diff --git a/desmume/src/libretro-common/formats/png/rpng_test.c b/desmume/src/libretro-common/formats/png/rpng_test.c new file mode 100644 index 000000000..fadddbc08 --- /dev/null +++ b/desmume/src/libretro-common/formats/png/rpng_test.c @@ -0,0 +1,133 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rpng_test.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#ifdef HAVE_IMLIB2 +#include +#endif + +#include +#include + +static int test_rpng(const char *in_path) +{ +#ifdef HAVE_IMLIB2 + Imlib_Image img; + const uint32_t *imlib_data = NULL; +#endif + const uint32_t test_data[] = { + 0xff000000 | 0x50, 0xff000000 | 0x80, + 0xff000000 | 0x40, 0xff000000 | 0x88, + 0xff000000 | 0x50, 0xff000000 | 0x80, + 0xff000000 | 0x40, 0xff000000 | 0x88, + 0xff000000 | 0xc3, 0xff000000 | 0xd3, + 0xff000000 | 0xc3, 0xff000000 | 0xd3, + 0xff000000 | 0xc3, 0xff000000 | 0xd3, + 0xff000000 | 0xc3, 0xff000000 | 0xd3, + }; + uint32_t *data = NULL; + unsigned width = 0; + unsigned height = 0; + + if (!rpng_save_image_argb("/tmp/test.png", test_data, 4, 4, 16)) + return 1; + + if (!rpng_load_image_argb(in_path, &data, &width, &height)) + return 2; + + fprintf(stderr, "Path: %s.\n", in_path); + fprintf(stderr, "Got image: %u x %u.\n", width, height); + +#if 0 + fprintf(stderr, "\nRPNG:\n"); + for (unsigned h = 0; h < height; h++) + { + unsigned w; + for (w = 0; w < width; w++) + fprintf(stderr, "[%08x] ", data[h * width + w]); + fprintf(stderr, "\n"); + } +#endif + +#ifdef HAVE_IMLIB2 + /* Validate with imlib2 as well. */ + img = imlib_load_image(in_path); + if (!img) + return 4; + + imlib_context_set_image(img); + + width = imlib_image_get_width(); + height = imlib_image_get_width(); + imlib_data = imlib_image_get_data_for_reading_only(); + +#if 0 + fprintf(stderr, "\nImlib:\n"); + for (unsigned h = 0; h < height; h++) + { + for (unsigned w = 0; w < width; w++) + fprintf(stderr, "[%08x] ", imlib_data[h * width + w]); + fprintf(stderr, "\n"); + } +#endif + + if (memcmp(imlib_data, data, width * height * sizeof(uint32_t)) != 0) + { + fprintf(stderr, "Imlib and RPNG differs!\n"); + return 5; + } + else + fprintf(stderr, "Imlib and RPNG are equivalent!\n"); + + imlib_free_image(); +#endif + free(data); + + return 0; +} + +int main(int argc, char *argv[]) +{ + const char *in_path = "/tmp/test.png"; + + if (argc > 2) + { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 1; + } + + if (argc == 2) + in_path = argv[1]; + + fprintf(stderr, "Doing tests...\n"); + + if (test_rpng(in_path) != 0) + { + fprintf(stderr, "Test failed.\n"); + return -1; + } + + return 0; +} diff --git a/desmume/src/libretro-common/formats/tga/rtga.c b/desmume/src/libretro-common/formats/tga/rtga.c new file mode 100644 index 000000000..fc0348e78 --- /dev/null +++ b/desmume/src/libretro-common/formats/tga/rtga.c @@ -0,0 +1,96 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#include +#include +#include +#include +#include +#include + +bool rtga_image_load_shift(uint8_t *buf, + void *data, + unsigned a_shift, unsigned r_shift, + unsigned g_shift, unsigned b_shift) +{ + unsigned i, bits, size, bits_mul; + uint8_t info[6] = {0}; + unsigned width = 0; + unsigned height = 0; + const uint8_t *tmp = NULL; + struct texture_image *out_img = (struct texture_image*)data; + + if (buf[2] != 2) + { + fprintf(stderr, "TGA image is not uncompressed RGB.\n"); + goto error; + } + + memcpy(info, buf + 12, 6); + + width = info[0] + ((unsigned)info[1] * 256); + height = info[2] + ((unsigned)info[3] * 256); + bits = info[4]; + + fprintf(stderr, "Loaded TGA: (%ux%u @ %u bpp)\n", width, height, bits); + + size = width * height * sizeof(uint32_t); + out_img->pixels = (uint32_t*)malloc(size); + out_img->width = width; + out_img->height = height; + + if (!out_img->pixels) + { + fprintf(stderr, "Failed to allocate TGA pixels.\n"); + goto error; + } + + tmp = buf + 18; + bits_mul = 3; + + if (bits != 32 && bits != 24) + { + fprintf(stderr, "Bit depth of TGA image is wrong. Only 32-bit and 24-bit supported.\n"); + goto error; + } + + if (bits == 32) + bits_mul = 4; + + for (i = 0; i < width * height; i++) + { + uint32_t b = tmp[i * bits_mul + 0]; + uint32_t g = tmp[i * bits_mul + 1]; + uint32_t r = tmp[i * bits_mul + 2]; + uint32_t a = tmp[i * bits_mul + 3]; + + if (bits == 24) + a = 0xff; + + out_img->pixels[i] = (a << a_shift) | + (r << r_shift) | (g << g_shift) | (b << b_shift); + } + + return true; + +error: + if (out_img->pixels) + free(out_img->pixels); + + out_img->pixels = NULL; + out_img->width = out_img->height = 0; + return false; +} diff --git a/desmume/src/libretro-common/formats/xml/Makefile b/desmume/src/libretro-common/formats/xml/Makefile new file mode 100644 index 000000000..3c2a6e1fc --- /dev/null +++ b/desmume/src/libretro-common/formats/xml/Makefile @@ -0,0 +1,20 @@ +TARGET := rxml + +SOURCES := $(wildcard *.c) +OBJS := $(SOURCES:.c=.o) + +CFLAGS += -DRXML_TEST -Wall -pedantic -std=gnu99 -O0 -g -I../../include + +all: $(TARGET) + +%.o: %.c + $(CC) -c -o $@ $< $(CFLAGS) + +$(TARGET): $(OBJS) + $(CC) -o $@ $^ $(LDFLAGS) + +clean: + rm -f $(TARGET) $(OBJS) + +.PHONY: clean + diff --git a/desmume/src/libretro-common/formats/xml/rxml.c b/desmume/src/libretro-common/formats/xml/rxml.c new file mode 100644 index 000000000..410fbf623 --- /dev/null +++ b/desmume/src/libretro-common/formats/xml/rxml.c @@ -0,0 +1,490 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rxml.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct rxml_document +{ + struct rxml_node *root_node; +}; + +struct rxml_node *rxml_root_node(rxml_document_t *doc) +{ + if (doc) + return doc->root_node; + return NULL; +} + +static void rxml_free_node(struct rxml_node *node) +{ + struct rxml_node *head = NULL; + struct rxml_attrib_node *attrib_node_head = NULL; + + if (!node) + return; + + for (head = node->children; head; ) + { + struct rxml_node *next_node = (struct rxml_node*)head->next; + rxml_free_node(head); + head = next_node; + } + + for (attrib_node_head = node->attrib; attrib_node_head; ) + { + struct rxml_attrib_node *next_attrib = NULL; + + if (!attrib_node_head) + continue; + + next_attrib = (struct rxml_attrib_node*)attrib_node_head->next; + + if (!next_attrib) + continue; + + if (attrib_node_head->attrib) + free(attrib_node_head->attrib); + if (attrib_node_head->value) + free(attrib_node_head->value); + if (attrib_node_head) + free(attrib_node_head); + + attrib_node_head = next_attrib; + } + + if (node->name) + free(node->name); + if (node->data) + free(node->data); + if (node) + free(node); +} + +static bool validate_header(const char **ptr) +{ + if (memcmp(*ptr, "\n"); + if (!eol) + return false; + + /* Always use UTF-8. Don't really care to check. */ + *ptr = eol + 3; + return true; + } + return true; +} + +static bool range_is_space(const char *begin, const char *end) +{ + for (; begin < end; begin++) + if (!isspace(*begin)) + return false; + + return true; +} + +static void skip_spaces(const char **ptr_) +{ + const char *ptr = *ptr_; + while (isspace(*ptr)) + ptr++; + + *ptr_ = ptr; +} + +static char *strdup_range(const char *begin, const char *end) +{ + ptrdiff_t len = end - begin; + char *ret = (char*)malloc(len + 1); + + if (!ret) + return NULL; + + memcpy(ret, begin, len); + ret[len] = '\0'; + return ret; +} + +static char *strdup_range_escape(const char *begin, const char *end) +{ + /* Escaping is ignored. Assume we don't deal with that. */ + return strdup_range(begin, end); +} + +static struct rxml_attrib_node *rxml_parse_attrs(const char *str) +{ + char *copy = strdup(str); + if (!copy) + return NULL; + + char *last_char = copy + strlen(copy) - 1; + if (*last_char == '/') + *last_char = '\0'; + + struct rxml_attrib_node *list = NULL; + struct rxml_attrib_node *tail = NULL; + + char *attrib = NULL; + char *value = NULL; + char *save; + const char *elem = strtok_r(copy, " \n\t\f\v\r", &save); + while (elem) + { + const char *eq = strstr(elem, "=\""); + if (!eq) + goto end; + + const char *end = strrchr(eq + 2, '\"'); + if (!end || end != (elem + strlen(elem) - 1)) + goto end; + + attrib = strdup_range_escape(elem, eq); + value = strdup_range_escape(eq + 2, end); + if (!attrib || !value) + goto end; + + struct rxml_attrib_node *new_node = + (struct rxml_attrib_node*)calloc(1, sizeof(*new_node)); + if (!new_node) + goto end; + + new_node->attrib = attrib; + new_node->value = value; + attrib = NULL; + value = NULL; + + if (tail) + { + tail->next = new_node; + tail = new_node; + } + else + list = tail = new_node; + + elem = strtok_r(NULL, " \n\t\f\v\r", &save); + } + +end: + if (copy) + free(copy); + if (attrib) + free(attrib); + if (value) + free(value); + return list; +} + +static char *find_first_space(const char *str) +{ + while (*str && !isspace(*str)) + str++; + + return isspace(*str) ? (char*)str : NULL; +} + +static bool rxml_parse_tag(struct rxml_node *node, const char *str) +{ + const char *str_ptr = str; + skip_spaces(&str_ptr); + + const char *name_end = find_first_space(str_ptr); + if (name_end) + { + node->name = strdup_range(str_ptr, name_end); + if (!node->name || !*node->name) + return false; + + node->attrib = rxml_parse_attrs(name_end); + return true; + } + else + { + node->name = strdup(str_ptr); + return node->name && *node->name; + } +} + +static struct rxml_node *rxml_parse_node(const char **ptr_) +{ + const char *ptr = NULL; + const char *closing = NULL; + char *str = NULL; + bool is_closing = false; + + struct rxml_node *node = (struct rxml_node*)calloc(1, sizeof(*node)); + if (!node) + return NULL; + + skip_spaces(ptr_); + + ptr = *ptr_; + if (*ptr != '<') + goto error; + + closing = strchr(ptr, '>'); + if (!closing) + goto error; + + str = strdup_range(ptr + 1, closing); + if (!str) + goto error; + + if (!rxml_parse_tag(node, str)) + goto error; + + /* Are spaces between / and > allowed? */ + is_closing = strstr(ptr, "/>") + 1 == closing; + + /* Look for more data. Either child nodes or data. */ + if (!is_closing) + { + size_t closing_tag_size = strlen(node->name) + 4; + char *closing_tag = (char*)malloc(closing_tag_size); + + const char *cdata_start = NULL; + const char *child_start = NULL; + const char *closing_start = NULL; + + if (!closing_tag) + goto error; + + snprintf(closing_tag, closing_tag_size, "", node->name); + + cdata_start = strstr(closing + 1, ""); + if (!cdata_end) + { + free(closing_tag); + goto error; + } + + node->data = strdup_range(cdata_start + + strlen("data = strdup_range(closing + 1, closing_start); + else + { + /* Parse all child nodes. */ + struct rxml_node *list = NULL; + struct rxml_node *tail = NULL; + const char *first_start = NULL; + const char *first_closing = NULL; + + ptr = child_start; + first_start = strchr(ptr, '<'); + first_closing = strstr(ptr, "next = new_node; + tail = new_node; + } + else + list = tail = new_node; + + first_start = strchr(ptr, '<'); + first_closing = strstr(ptr, "children = list; + + closing_start = strstr(ptr, closing_tag); + if (!closing_start) + { + free(closing_tag); + goto error; + } + } + + *ptr_ = closing_start + strlen(closing_tag); + free(closing_tag); + } + else + *ptr_ = closing + 1; + + if (str) + free(str); + return node; + +error: + if (str) + free(str); + rxml_free_node(node); + return NULL; +} + +static char *purge_xml_comments(const char *str) +{ + size_t len = strlen(str); + char *new_str = (char*)malloc(len + 1); + if (!new_str) + return NULL; + + new_str[len] = '\0'; + + char *copy_dest = new_str; + const char *copy_src = str; + for (;;) + { + ptrdiff_t copy_len; + const char *comment_start = strstr(copy_src, ""); + + if (!comment_start || !comment_end) + break; + + copy_len = comment_start - copy_src; + memcpy(copy_dest, copy_src, copy_len); + + copy_dest += copy_len; + copy_src = comment_end + strlen("-->"); + } + + /* Avoid strcpy() as OpenBSD is anal and hates you + * for using it even when it's perfectly safe. */ + len = strlen(copy_src); + memcpy(copy_dest, copy_src, len); + copy_dest[len] = '\0'; + + return new_str; +} + +rxml_document_t *rxml_load_document(const char *path) +{ +#ifndef RXML_TEST + RARCH_WARN("Using RXML as drop in for libxml2. Behavior might be very buggy.\n"); +#endif + + char *memory_buffer = NULL; + char *new_memory_buffer = NULL; + const char *mem_ptr = NULL; + long len = 0; + + FILE *file = fopen(path, "r"); + if (!file) + return NULL; + + rxml_document_t *doc = (rxml_document_t*)calloc(1, sizeof(*doc)); + if (!doc) + goto error; + + fseek(file, 0, SEEK_END); + len = ftell(file); + rewind(file); + + memory_buffer = (char*)malloc(len + 1); + if (!memory_buffer) + goto error; + + memory_buffer[len] = '\0'; + if (fread(memory_buffer, 1, len, file) != (size_t)len) + goto error; + + fclose(file); + file = NULL; + + mem_ptr = memory_buffer; + + if (!validate_header(&mem_ptr)) + goto error; + + new_memory_buffer = purge_xml_comments(mem_ptr); + if (!new_memory_buffer) + goto error; + + free(memory_buffer); + mem_ptr = memory_buffer = new_memory_buffer; + + doc->root_node = rxml_parse_node(&mem_ptr); + if (!doc->root_node) + goto error; + + free(memory_buffer); + return doc; + +error: + free(memory_buffer); + if (file) + fclose(file); + rxml_free_document(doc); + return NULL; +} + +void rxml_free_document(rxml_document_t *doc) +{ + if (!doc) + return; + + if (doc->root_node) + rxml_free_node(doc->root_node); + + free(doc); +} + +char *rxml_node_attrib(struct rxml_node *node, const char *attrib) +{ + struct rxml_attrib_node *attribs = NULL; + for (attribs = node->attrib; attribs; attribs = attribs->next) + { + if (!strcmp(attrib, attribs->attrib)) + return attribs->value; + } + + return NULL; +} + diff --git a/desmume/src/libretro-common/formats/xml/rxml_test.c b/desmume/src/libretro-common/formats/xml/rxml_test.c new file mode 100644 index 000000000..1156f64f8 --- /dev/null +++ b/desmume/src/libretro-common/formats/xml/rxml_test.c @@ -0,0 +1,67 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rxml_test.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include + +static void print_siblings(struct rxml_node *node, unsigned level) +{ + fprintf(stderr, "\n%*sName: %s\n", level * 4, "", node->name); + if (node->data) + fprintf(stderr, "%*sData: %s\n", level * 4, "", node->data); + + for (const struct rxml_attrib_node *attrib = + node->attrib; attrib; attrib = attrib->next) + fprintf(stderr, "%*s Attrib: %s = %s\n", level * 4, "", + attrib->attrib, attrib->value); + + if (node->children) + print_siblings(node->children, level + 1); + + if (node->next) + print_siblings(node->next, level); +} + +static void rxml_log_document(const char *path) +{ + rxml_document_t *doc = rxml_load_document(path); + if (!doc) + { + fprintf(stderr, "rxml: Failed to load document: %s\n", path); + return; + } + + print_siblings(rxml_root_node(doc), 0); + rxml_free_document(doc); +} + +int main(int argc, char *argv[]) +{ + if (argc != 2) + { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 1; + } + + rxml_log_document(argv[1]); +} + diff --git a/desmume/src/libretro-common/gfx/math/matrix_3x3.c b/desmume/src/libretro-common/gfx/math/matrix_3x3.c new file mode 100644 index 000000000..fa2d8c846 --- /dev/null +++ b/desmume/src/libretro-common/gfx/math/matrix_3x3.c @@ -0,0 +1,251 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (matrix_3x3.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include + +#define floats_are_equal(x, y) (fabs(x - y) <= 0.00001f * ((x) > (y) ? (y) : (x))) +#define float_is_zero(x) (floats_are_equal((x) + 1, 1)) + +void matrix_3x3_identity(math_matrix_3x3 *mat) +{ + unsigned i; + + memset(mat, 0, sizeof(*mat)); + for (i = 0; i < 3; i++) + MAT_ELEM_3X3(*mat, i, i) = 1.0f; +} + +void matrix_3x3_inits(math_matrix_3x3 *mat, + const float n11, const float n12, const float n13, + const float n21, const float n22, const float n23, + const float n31, const float n32, const float n33) +{ + MAT_ELEM_3X3(*mat, 0, 0) = n11; + MAT_ELEM_3X3(*mat, 0, 1) = n12; + MAT_ELEM_3X3(*mat, 0, 2) = n13; + MAT_ELEM_3X3(*mat, 1, 0) = n21; + MAT_ELEM_3X3(*mat, 1, 1) = n22; + MAT_ELEM_3X3(*mat, 1, 2) = n23; + MAT_ELEM_3X3(*mat, 2, 0) = n31; + MAT_ELEM_3X3(*mat, 2, 1) = n32; + MAT_ELEM_3X3(*mat, 2, 2) = n33; +} + +void matrix_3x3_transpose(math_matrix_3x3 *out, const math_matrix_3x3 *in) +{ + unsigned i, j; + math_matrix_3x3 mat; + + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + MAT_ELEM_3X3(mat, j, i) = MAT_ELEM_3X3(*in, i, j); + + *out = mat; +} + +void matrix_3x3_multiply(math_matrix_3x3 *out, + const math_matrix_3x3 *a, const math_matrix_3x3 *b) +{ + unsigned r, c, k; + math_matrix_3x3 mat; + + for (r = 0; r < 3; r++) + { + for (c = 0; c < 3; c++) + { + float dot = 0.0f; + for (k = 0; k < 3; k++) + dot += MAT_ELEM_3X3(*a, r, k) * MAT_ELEM_3X3(*b, k, c); + MAT_ELEM_3X3(mat, r, c) = dot; + } + } + + *out = mat; +} + +void matrix_3x3_divide_scalar(math_matrix_3x3 *mat, const float s) +{ + unsigned i, j; + for (i = 0; i < 3; i++) + for (j = 0; j < 3; j++) + MAT_ELEM_3X3(*mat, i, j) /= s; +} + +float matrix_3x3_determinant(const math_matrix_3x3 *mat) +{ + float det = MAT_ELEM_3X3(*mat, 0, 0) * (MAT_ELEM_3X3(*mat, 1, 1) * MAT_ELEM_3X3(*mat, 2, 2) - MAT_ELEM_3X3(*mat, 1, 2) * MAT_ELEM_3X3(*mat, 2, 1)); + det -= MAT_ELEM_3X3(*mat, 0, 1) * (MAT_ELEM_3X3(*mat, 1, 0) * MAT_ELEM_3X3(*mat, 2, 2) - MAT_ELEM_3X3(*mat, 1, 2) * MAT_ELEM_3X3(*mat, 2, 0)); + det += MAT_ELEM_3X3(*mat, 0, 2) * (MAT_ELEM_3X3(*mat, 1, 0) * MAT_ELEM_3X3(*mat, 2, 1) - MAT_ELEM_3X3(*mat, 1, 1) * MAT_ELEM_3X3(*mat, 2, 0)); + + return det; +} + +void matrix_3x3_adjoint(math_matrix_3x3 *mat) +{ + math_matrix_3x3 out; + + MAT_ELEM_3X3(out, 0, 0) = (MAT_ELEM_3X3(*mat, 1, 1) * MAT_ELEM_3X3(*mat, 2, 2) - MAT_ELEM_3X3(*mat, 1, 2) * MAT_ELEM_3X3(*mat, 2, 1)); + MAT_ELEM_3X3(out, 0, 1) = -(MAT_ELEM_3X3(*mat, 0, 1) * MAT_ELEM_3X3(*mat, 2, 2) - MAT_ELEM_3X3(*mat, 0, 2) * MAT_ELEM_3X3(*mat, 2, 1)); + MAT_ELEM_3X3(out, 0, 2) = (MAT_ELEM_3X3(*mat, 0, 1) * MAT_ELEM_3X3(*mat, 1, 1) - MAT_ELEM_3X3(*mat, 0, 2) * MAT_ELEM_3X3(*mat, 1, 1)); + MAT_ELEM_3X3(out, 1, 0) = -(MAT_ELEM_3X3(*mat, 1, 0) * MAT_ELEM_3X3(*mat, 2, 2) - MAT_ELEM_3X3(*mat, 1, 2) * MAT_ELEM_3X3(*mat, 2, 0)); + MAT_ELEM_3X3(out, 1, 1) = (MAT_ELEM_3X3(*mat, 0, 0) * MAT_ELEM_3X3(*mat, 2, 2) - MAT_ELEM_3X3(*mat, 0, 2) * MAT_ELEM_3X3(*mat, 2, 0)); + MAT_ELEM_3X3(out, 1, 2) = -(MAT_ELEM_3X3(*mat, 0, 0) * MAT_ELEM_3X3(*mat, 1, 2) - MAT_ELEM_3X3(*mat, 0, 2) * MAT_ELEM_3X3(*mat, 1, 0)); + MAT_ELEM_3X3(out, 2, 0) = (MAT_ELEM_3X3(*mat, 1, 0) * MAT_ELEM_3X3(*mat, 2, 1) - MAT_ELEM_3X3(*mat, 1, 1) * MAT_ELEM_3X3(*mat, 2, 0)); + MAT_ELEM_3X3(out, 2, 1) = -(MAT_ELEM_3X3(*mat, 0, 0) * MAT_ELEM_3X3(*mat, 2, 1) - MAT_ELEM_3X3(*mat, 0, 1) * MAT_ELEM_3X3(*mat, 2, 0)); + MAT_ELEM_3X3(out, 2, 2) = (MAT_ELEM_3X3(*mat, 0, 0) * MAT_ELEM_3X3(*mat, 1, 1) - MAT_ELEM_3X3(*mat, 0, 1) * MAT_ELEM_3X3(*mat, 1, 0)); + + *mat = out; +} + +bool matrix_3x3_invert(math_matrix_3x3 *mat) +{ + float det = matrix_3x3_determinant(mat); + + if (float_is_zero(det)) + return false; + + matrix_3x3_adjoint(mat); + matrix_3x3_divide_scalar(mat, det); + + return true; +} + +/************************************************************************** + * + * the following code is Copyright 2009 VMware, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +bool matrix_3x3_square_to_quad(const float dx0, const float dy0, + const float dx1, const float dy1, + const float dx3, const float dy3, + const float dx2, const float dy2, + math_matrix_3x3 *mat) +{ + float ax = dx0 - dx1 + dx2 - dx3; + float ay = dy0 - dy1 + dy2 - dy3; + + if (float_is_zero(ax) && float_is_zero(ay)) + { + /* affine case */ + matrix_3x3_inits(mat, + dx1 - dx0, dy1 - dy0, 0, + dx2 - dx1, dy2 - dy1, 0, + dx0, dy0, 1); + } + else + { + float a, b, c, d, e, f, g, h; + float ax1 = dx1 - dx2; + float ax2 = dx3 - dx2; + float ay1 = dy1 - dy2; + float ay2 = dy3 - dy2; + + /* determinants */ + float gtop = ax * ay2 - ax2 * ay; + float htop = ax1 * ay - ax * ay1; + float bottom = ax1 * ay2 - ax2 * ay1; + + if (!bottom) + return false; + + g = gtop / bottom; + h = htop / bottom; + + a = dx1 - dx0 + g * dx1; + b = dx3 - dx0 + h * dx3; + c = dx0; + d = dy1 - dy0 + g * dy1; + e = dy3 - dy0 + h * dy3; + f = dy0; + + matrix_3x3_inits(mat, + a, d, g, + b, e, h, + c, f, 1.f); + } + + return true; +} + +bool matrix_3x3_quad_to_square(const float sx0, const float sy0, + const float sx1, const float sy1, + const float sx2, const float sy2, + const float sx3, const float sy3, + math_matrix_3x3 *mat) +{ + if (!matrix_3x3_square_to_quad(sx0, sy0, sx1, sy1, + sx2, sy2, sx3, sy3, + mat)) + return false; + + return matrix_3x3_invert(mat); +} + +bool matrix_3x3_quad_to_quad(const float dx0, const float dy0, + const float dx1, const float dy1, + const float dx2, const float dy2, + const float dx3, const float dy3, + const float sx0, const float sy0, + const float sx1, const float sy1, + const float sx2, const float sy2, + const float sx3, const float sy3, + math_matrix_3x3 *mat) +{ + math_matrix_3x3 quad_to_square, square_to_quad; + + if (!matrix_3x3_square_to_quad(dx0, dy0, dx1, dy1, + dx2, dy2, dx3, dy3, + &square_to_quad)) + return false; + + if (!matrix_3x3_quad_to_square(sx0, sy0, sx1, sy1, + sx2, sy2, sx3, sy3, + &quad_to_square)) + return false; + + matrix_3x3_multiply(mat, &quad_to_square, &square_to_quad); + + return true; +} diff --git a/desmume/src/libretro-common/gfx/math/matrix_4x4.c b/desmume/src/libretro-common/gfx/math/matrix_4x4.c new file mode 100644 index 000000000..6960cc0a0 --- /dev/null +++ b/desmume/src/libretro-common/gfx/math/matrix_4x4.c @@ -0,0 +1,192 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (matrix.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include + +#include + +/* + * Sets mat to an identity matrix + */ +void matrix_4x4_identity(math_matrix_4x4 *mat) +{ + unsigned i; + + memset(mat, 0, sizeof(*mat)); + for (i = 0; i < 4; i++) + MAT_ELEM_4X4(*mat, i, i) = 1.0f; +} + +/* + * Sets out to the transposed matrix of in + */ +void matrix_4x4_transpose(math_matrix_4x4 *out, const math_matrix_4x4 *in) +{ + unsigned i, j; + math_matrix_4x4 mat; + + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + MAT_ELEM_4X4(mat, j, i) = MAT_ELEM_4X4(*in, i, j); + + *out = mat; +} + +/* + * Builds an X-axis rotation matrix + */ +void matrix_4x4_rotate_x(math_matrix_4x4 *mat, float rad) +{ + float cosine = cosf(rad); + float sine = sinf(rad); + + matrix_4x4_identity(mat); + + MAT_ELEM_4X4(*mat, 1, 1) = cosine; + MAT_ELEM_4X4(*mat, 2, 2) = cosine; + MAT_ELEM_4X4(*mat, 1, 2) = -sine; + MAT_ELEM_4X4(*mat, 2, 1) = sine; +} + +/* + * Builds a rotation matrix using the + * rotation around the Y-axis. + */ +void matrix_4x4_rotate_y(math_matrix_4x4 *mat, float rad) +{ + float cosine = cosf(rad); + float sine = sinf(rad); + + matrix_4x4_identity(mat); + + MAT_ELEM_4X4(*mat, 0, 0) = cosine; + MAT_ELEM_4X4(*mat, 2, 2) = cosine; + MAT_ELEM_4X4(*mat, 0, 2) = -sine; + MAT_ELEM_4X4(*mat, 2, 0) = sine; +} + +/* + * Builds a rotation matrix using the + * rotation around the Z-axis. + */ +void matrix_4x4_rotate_z(math_matrix_4x4 *mat, float rad) +{ + float cosine = cosf(rad); + float sine = sinf(rad); + + matrix_4x4_identity(mat); + + MAT_ELEM_4X4(*mat, 0, 0) = cosine; + MAT_ELEM_4X4(*mat, 1, 1) = cosine; + MAT_ELEM_4X4(*mat, 0, 1) = -sine; + MAT_ELEM_4X4(*mat, 1, 0) = sine; +} + +/* + * Creates an orthographic projection matrix. + */ +void matrix_4x4_ortho(math_matrix_4x4 *mat, + float left, float right, + float bottom, float top, + float znear, float zfar) +{ + float tx, ty, tz; + + matrix_4x4_identity(mat); + + tx = -(right + left) / (right - left); + ty = -(top + bottom) / (top - bottom); + tz = -(zfar + znear) / (zfar - znear); + + MAT_ELEM_4X4(*mat, 0, 0) = 2.0f / (right - left); + MAT_ELEM_4X4(*mat, 1, 1) = 2.0f / (top - bottom); + MAT_ELEM_4X4(*mat, 2, 2) = -2.0f / (zfar - znear); + MAT_ELEM_4X4(*mat, 0, 3) = tx; + MAT_ELEM_4X4(*mat, 1, 3) = ty; + MAT_ELEM_4X4(*mat, 2, 3) = tz; +} + +void matrix_4x4_scale(math_matrix_4x4 *out, float x, float y, + float z) +{ + memset(out, 0, sizeof(*out)); + MAT_ELEM_4X4(*out, 0, 0) = x; + MAT_ELEM_4X4(*out, 1, 1) = y; + MAT_ELEM_4X4(*out, 2, 2) = z; + MAT_ELEM_4X4(*out, 3, 3) = 1.0f; +} + +/* + * Builds a translation matrix. All other elements in + * the matrix will be set to zero except for the + * diagonal which is set to 1.0 + */ +void matrix_4x4_translate(math_matrix_4x4 *out, float x, + float y, float z) +{ + matrix_4x4_identity(out); + MAT_ELEM_4X4(*out, 0, 3) = x; + MAT_ELEM_4X4(*out, 1, 3) = y; + MAT_ELEM_4X4(*out, 2, 3) = z; +} + +/* + * Creates a perspective projection matrix. + */ +void matrix_4x4_projection(math_matrix_4x4 *out, float znear, + float zfar) +{ + float delta_z = zfar - znear; + + memset(out, 0, sizeof(*out)); + MAT_ELEM_4X4(*out, 0, 0) = znear; + MAT_ELEM_4X4(*out, 1, 1) = zfar; + MAT_ELEM_4X4(*out, 2, 2) = (zfar + znear) / delta_z; + MAT_ELEM_4X4(*out, 2, 3) = -2.0f * zfar * znear / delta_z; + MAT_ELEM_4X4(*out, 3, 2) = -1.0f; +} + +/* + * Multiplies a with b, stores the result in out + */ +void matrix_4x4_multiply( + math_matrix_4x4 *out, + const math_matrix_4x4 *a, + const math_matrix_4x4 *b) +{ + unsigned r, c, k; + math_matrix_4x4 mat; + + for (r = 0; r < 4; r++) + { + for (c = 0; c < 4; c++) + { + float dot = 0.0f; + for (k = 0; k < 4; k++) + dot += MAT_ELEM_4X4(*a, r, k) * MAT_ELEM_4X4(*b, k, c); + MAT_ELEM_4X4(mat, r, c) = dot; + } + } + + *out = mat; +} diff --git a/desmume/src/libretro-common/gfx/scaler/pixconv.c b/desmume/src/libretro-common/gfx/scaler/pixconv.c new file mode 100644 index 000000000..59d35a2cb --- /dev/null +++ b/desmume/src/libretro-common/gfx/scaler/pixconv.c @@ -0,0 +1,821 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (pixconv.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include + +#include + +#include + +#ifdef SCALER_NO_SIMD +#undef __SSE2__ +#endif + +#if defined(__SSE2__) +#include +#endif + +void conv_rgb565_0rgb1555(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint16_t *input = (const uint16_t*)input_; + uint16_t *output = (uint16_t*)output_; + +#if defined(__SSE2_) + int max_width = width - 7; + + const __m128i hi_mask = _mm_set1_epi16(0x7fe0); + const __m128i lo_mask = _mm_set1_epi16(0x1f); +#endif + + for (h = 0; h < height; + h++, output += out_stride >> 1, input += in_stride >> 1) + { + w = 0; +#if defined(__SSE2_) + for (; w < max_width; w += 8) + { + const __m128i in = _mm_loadu_si128((const __m128i*)(input + w)); + __m128i hi = _mm_and_si128(_mm_slli_epi16(in, 1), hi_mask); + __m128i lo = _mm_and_si128(in, lo_mask); + _mm_storeu_si128((__m128i*)(output + w), _mm_or_si128(hi, lo)); + } +#endif + + for (; w < width; w++) + { + uint16_t col = input[w]; + uint16_t hi = (col >> 1) & 0x7fe0; + uint16_t lo = col & 0x1f; + output[w] = hi | lo; + } + } +} + +void conv_0rgb1555_rgb565(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint16_t *input = (const uint16_t*)input_; + uint16_t *output = (uint16_t*)output_; + +#if defined(__SSE2__) + int max_width = width - 7; + + const __m128i hi_mask = _mm_set1_epi16( + (int16_t)((0x1f << 11) | (0x1f << 6))); + const __m128i lo_mask = _mm_set1_epi16(0x1f); + const __m128i glow_mask = _mm_set1_epi16(1 << 5); +#endif + + for (h = 0; h < height; + h++, output += out_stride >> 1, input += in_stride >> 1) + { + w = 0; +#if defined(__SSE2__) + for (; w < max_width; w += 8) + { + const __m128i in = _mm_loadu_si128((const __m128i*)(input + w)); + __m128i rg = _mm_and_si128(_mm_slli_epi16(in, 1), hi_mask); + __m128i b = _mm_and_si128(in, lo_mask); + __m128i glow = _mm_and_si128(_mm_srli_epi16(in, 4), glow_mask); + _mm_storeu_si128((__m128i*)(output + w), + _mm_or_si128(rg, _mm_or_si128(b, glow))); + } +#endif + + for (; w < width; w++) + { + uint16_t col = input[w]; + uint16_t rg = (col << 1) & ((0x1f << 11) | (0x1f << 6)); + uint16_t b = col & 0x1f; + uint16_t glow = (col >> 4) & (1 << 5); + output[w] = rg | b | glow; + } + } +} + +void conv_0rgb1555_argb8888(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint16_t *input = (const uint16_t*)input_; + uint32_t *output = (uint32_t*)output_; + +#ifdef __SSE2__ + const __m128i pix_mask_r = _mm_set1_epi16(0x1f << 10); + const __m128i pix_mask_gb = _mm_set1_epi16(0x1f << 5); + const __m128i mul15_mid = _mm_set1_epi16(0x4200); + const __m128i mul15_hi = _mm_set1_epi16(0x0210); + const __m128i a = _mm_set1_epi16(0x00ff); + + int max_width = width - 7; +#endif + + for (h = 0; h < height; + h++, output += out_stride >> 2, input += in_stride >> 1) + { + w = 0; +#ifdef __SSE2__ + for (; w < max_width; w += 8) + { + __m128i res_lo_bg, res_hi_bg; + __m128i res_lo_ra, res_hi_ra; + __m128i res_lo, res_hi; + const __m128i in = _mm_loadu_si128((const __m128i*)(input + w)); + __m128i r = _mm_and_si128(in, pix_mask_r); + __m128i g = _mm_and_si128(in, pix_mask_gb); + __m128i b = _mm_and_si128(_mm_slli_epi16(in, 5), pix_mask_gb); + + r = _mm_mulhi_epi16(r, mul15_hi); + g = _mm_mulhi_epi16(g, mul15_mid); + b = _mm_mulhi_epi16(b, mul15_mid); + + res_lo_bg = _mm_unpacklo_epi8(b, g); + res_hi_bg = _mm_unpackhi_epi8(b, g); + res_lo_ra = _mm_unpacklo_epi8(r, a); + res_hi_ra = _mm_unpackhi_epi8(r, a); + + res_lo = _mm_or_si128(res_lo_bg, + _mm_slli_si128(res_lo_ra, 2)); + res_hi = _mm_or_si128(res_hi_bg, + _mm_slli_si128(res_hi_ra, 2)); + + _mm_storeu_si128((__m128i*)(output + w + 0), res_lo); + _mm_storeu_si128((__m128i*)(output + w + 4), res_hi); + } +#endif + + for (; w < width; w++) + { + uint32_t col = input[w]; + uint32_t r = (col >> 10) & 0x1f; + uint32_t g = (col >> 5) & 0x1f; + uint32_t b = (col >> 0) & 0x1f; + r = (r << 3) | (r >> 2); + g = (g << 3) | (g >> 2); + b = (b << 3) | (b >> 2); + + output[w] = (0xffu << 24) | (r << 16) | (g << 8) | (b << 0); + } + } +} + +void conv_rgb565_argb8888(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint16_t *input = (const uint16_t*)input_; + uint32_t *output = (uint32_t*)output_; + +#if defined(__SSE2__) + const __m128i pix_mask_r = _mm_set1_epi16(0x1f << 10); + const __m128i pix_mask_g = _mm_set1_epi16(0x3f << 5); + const __m128i pix_mask_b = _mm_set1_epi16(0x1f << 5); + const __m128i mul16_r = _mm_set1_epi16(0x0210); + const __m128i mul16_g = _mm_set1_epi16(0x2080); + const __m128i mul16_b = _mm_set1_epi16(0x4200); + const __m128i a = _mm_set1_epi16(0x00ff); + + int max_width = width - 7; +#endif + + for (h = 0; h < height; + h++, output += out_stride >> 2, input += in_stride >> 1) + { + w = 0; +#if defined(__SSE2__) + for (; w < max_width; w += 8) + { + __m128i res_lo, res_hi; + __m128i res_lo_bg, res_hi_bg, res_lo_ra, res_hi_ra; + const __m128i in = _mm_loadu_si128((const __m128i*)(input + w)); + __m128i r = _mm_and_si128(_mm_srli_epi16(in, 1), pix_mask_r); + __m128i g = _mm_and_si128(in, pix_mask_g); + __m128i b = _mm_and_si128(_mm_slli_epi16(in, 5), pix_mask_b); + + r = _mm_mulhi_epi16(r, mul16_r); + g = _mm_mulhi_epi16(g, mul16_g); + b = _mm_mulhi_epi16(b, mul16_b); + + res_lo_bg = _mm_unpacklo_epi8(b, g); + res_hi_bg = _mm_unpackhi_epi8(b, g); + res_lo_ra = _mm_unpacklo_epi8(r, a); + res_hi_ra = _mm_unpackhi_epi8(r, a); + + res_lo = _mm_or_si128(res_lo_bg, + _mm_slli_si128(res_lo_ra, 2)); + res_hi = _mm_or_si128(res_hi_bg, + _mm_slli_si128(res_hi_ra, 2)); + + _mm_storeu_si128((__m128i*)(output + w + 0), res_lo); + _mm_storeu_si128((__m128i*)(output + w + 4), res_hi); + } +#endif + + for (; w < width; w++) + { + uint32_t col = input[w]; + uint32_t r = (col >> 11) & 0x1f; + uint32_t g = (col >> 5) & 0x3f; + uint32_t b = (col >> 0) & 0x1f; + r = (r << 3) | (r >> 2); + g = (g << 2) | (g >> 4); + b = (b << 3) | (b >> 2); + + output[w] = (0xffu << 24) | (r << 16) | (g << 8) | (b << 0); + } + } +} + +void conv_argb8888_rgba4444(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint32_t *input = (const uint32_t*)input_; + uint16_t *output = (uint16_t*)output_; + + for (h = 0; h < height; + h++, output += out_stride >> 2, input += in_stride >> 1) + { + for (w = 0; w < width; w++) + { + uint32_t col = input[w]; + uint32_t r = (col >> 16) & 0xf; + uint32_t g = (col >> 8) & 0xf; + uint32_t b = (col) & 0xf; + uint32_t a = (col >> 24) & 0xf; + r = (r >> 4) | r; + g = (g >> 4) | g; + b = (b >> 4) | b; + a = (a >> 4) | a; + + output[w] = (r << 12) | (g << 8) | (b << 4) | a; + } + } +} + +void conv_rgba4444_argb8888(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint16_t *input = (const uint16_t*)input_; + uint32_t *output = (uint32_t*)output_; + + for (h = 0; h < height; + h++, output += out_stride >> 2, input += in_stride >> 1) + { + for (w = 0; w < width; w++) + { + uint32_t col = input[w]; + uint32_t r = (col >> 12) & 0xf; + uint32_t g = (col >> 8) & 0xf; + uint32_t b = (col >> 4) & 0xf; + uint32_t a = (col >> 0) & 0xf; + r = (r << 4) | r; + g = (g << 4) | g; + b = (b << 4) | b; + a = (a << 4) | a; + + output[w] = (a << 24) | (r << 16) | (g << 8) | (b << 0); + } + } +} + +void conv_rgba4444_rgb565(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint16_t *input = (const uint16_t*)input_; + uint16_t *output = (uint16_t*)output_; + + for (h = 0; h < height; + h++, output += out_stride >> 1, input += in_stride >> 1) + { + for (w = 0; w < width; w++) + { + uint32_t col = input[w]; + uint32_t r = (col >> 12) & 0xf; + uint32_t g = (col >> 8) & 0xf; + uint32_t b = (col >> 4) & 0xf; + + output[w] = (r << 12) | (g << 7) | (b << 1); + } + } +} + +#if defined(__SSE2__) +/* :( TODO: Make this saner. */ +static INLINE void store_bgr24_sse2(void *output, __m128i a, + __m128i b, __m128i c, __m128i d) +{ + const __m128i mask_0 = _mm_set_epi32(0, 0, 0, 0x00ffffff); + const __m128i mask_1 = _mm_set_epi32(0, 0, 0x00ffffff, 0); + const __m128i mask_2 = _mm_set_epi32(0, 0x00ffffff, 0, 0); + const __m128i mask_3 = _mm_set_epi32(0x00ffffff, 0, 0, 0); + + __m128i a0 = _mm_and_si128(a, mask_0); + __m128i a1 = _mm_srli_si128(_mm_and_si128(a, mask_1), 1); + __m128i a2 = _mm_srli_si128(_mm_and_si128(a, mask_2), 2); + __m128i a3 = _mm_srli_si128(_mm_and_si128(a, mask_3), 3); + __m128i a4 = _mm_slli_si128(_mm_and_si128(b, mask_0), 12); + __m128i a5 = _mm_slli_si128(_mm_and_si128(b, mask_1), 11); + + __m128i b0 = _mm_srli_si128(_mm_and_si128(b, mask_1), 5); + __m128i b1 = _mm_srli_si128(_mm_and_si128(b, mask_2), 6); + __m128i b2 = _mm_srli_si128(_mm_and_si128(b, mask_3), 7); + __m128i b3 = _mm_slli_si128(_mm_and_si128(c, mask_0), 8); + __m128i b4 = _mm_slli_si128(_mm_and_si128(c, mask_1), 7); + __m128i b5 = _mm_slli_si128(_mm_and_si128(c, mask_2), 6); + + __m128i c0 = _mm_srli_si128(_mm_and_si128(c, mask_2), 10); + __m128i c1 = _mm_srli_si128(_mm_and_si128(c, mask_3), 11); + __m128i c2 = _mm_slli_si128(_mm_and_si128(d, mask_0), 4); + __m128i c3 = _mm_slli_si128(_mm_and_si128(d, mask_1), 3); + __m128i c4 = _mm_slli_si128(_mm_and_si128(d, mask_2), 2); + __m128i c5 = _mm_slli_si128(_mm_and_si128(d, mask_3), 1); + + __m128i *out = (__m128i*)output; + + _mm_storeu_si128(out + 0, + _mm_or_si128(a0, _mm_or_si128(a1, _mm_or_si128(a2, + _mm_or_si128(a3, _mm_or_si128(a4, a5)))))); + + _mm_storeu_si128(out + 1, + _mm_or_si128(b0, _mm_or_si128(b1, _mm_or_si128(b2, + _mm_or_si128(b3, _mm_or_si128(b4, b5)))))); + + _mm_storeu_si128(out + 2, + _mm_or_si128(c0, _mm_or_si128(c1, _mm_or_si128(c2, + _mm_or_si128(c3, _mm_or_si128(c4, c5)))))); +} +#endif + +void conv_0rgb1555_bgr24(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint16_t *input = (const uint16_t*)input_; + uint8_t *output = (uint8_t*)output_; + +#if defined(__SSE2__) + const __m128i pix_mask_r = _mm_set1_epi16(0x1f << 10); + const __m128i pix_mask_gb = _mm_set1_epi16(0x1f << 5); + const __m128i mul15_mid = _mm_set1_epi16(0x4200); + const __m128i mul15_hi = _mm_set1_epi16(0x0210); + const __m128i a = _mm_set1_epi16(0x00ff); + + int max_width = width - 15; +#endif + + for (h = 0; h < height; + h++, output += out_stride, input += in_stride >> 1) + { + uint8_t *out = output; + + w = 0; +#if defined(__SSE2__) + for (; w < max_width; w += 16, out += 48) + { + __m128i res_lo_bg0, res_lo_bg1, res_hi_bg0, res_hi_bg1, + res_lo_ra0, res_lo_ra1, res_hi_ra0, res_hi_ra1, + res_lo0, res_lo1, res_hi0, res_hi1; + const __m128i in0 = _mm_loadu_si128((const __m128i*)(input + w + 0)); + const __m128i in1 = _mm_loadu_si128((const __m128i*)(input + w + 8)); + __m128i r0 = _mm_and_si128(in0, pix_mask_r); + __m128i r1 = _mm_and_si128(in1, pix_mask_r); + __m128i g0 = _mm_and_si128(in0, pix_mask_gb); + __m128i g1 = _mm_and_si128(in1, pix_mask_gb); + __m128i b0 = _mm_and_si128(_mm_slli_epi16(in0, 5), pix_mask_gb); + __m128i b1 = _mm_and_si128(_mm_slli_epi16(in1, 5), pix_mask_gb); + + r0 = _mm_mulhi_epi16(r0, mul15_hi); + r1 = _mm_mulhi_epi16(r1, mul15_hi); + g0 = _mm_mulhi_epi16(g0, mul15_mid); + g1 = _mm_mulhi_epi16(g1, mul15_mid); + b0 = _mm_mulhi_epi16(b0, mul15_mid); + b1 = _mm_mulhi_epi16(b1, mul15_mid); + + res_lo_bg0 = _mm_unpacklo_epi8(b0, g0); + res_lo_bg1 = _mm_unpacklo_epi8(b1, g1); + res_hi_bg0 = _mm_unpackhi_epi8(b0, g0); + res_hi_bg1 = _mm_unpackhi_epi8(b1, g1); + res_lo_ra0 = _mm_unpacklo_epi8(r0, a); + res_lo_ra1 = _mm_unpacklo_epi8(r1, a); + res_hi_ra0 = _mm_unpackhi_epi8(r0, a); + res_hi_ra1 = _mm_unpackhi_epi8(r1, a); + + res_lo0 = _mm_or_si128(res_lo_bg0, + _mm_slli_si128(res_lo_ra0, 2)); + res_lo1 = _mm_or_si128(res_lo_bg1, + _mm_slli_si128(res_lo_ra1, 2)); + res_hi0 = _mm_or_si128(res_hi_bg0, + _mm_slli_si128(res_hi_ra0, 2)); + res_hi1 = _mm_or_si128(res_hi_bg1, + _mm_slli_si128(res_hi_ra1, 2)); + + /* Non-POT pixel sizes ftl :( */ + store_bgr24_sse2(out, res_lo0, res_hi0, res_lo1, res_hi1); + } +#endif + + for (; w < width; w++) + { + uint32_t col = input[w]; + uint32_t b = (col >> 0) & 0x1f; + uint32_t g = (col >> 5) & 0x1f; + uint32_t r = (col >> 10) & 0x1f; + b = (b << 3) | (b >> 2); + g = (g << 3) | (g >> 2); + r = (r << 3) | (r >> 2); + + *out++ = b; + *out++ = g; + *out++ = r; + } + } +} + +void conv_rgb565_bgr24(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint16_t *input = (const uint16_t*)input_; + uint8_t *output = (uint8_t*)output_; + +#if defined(__SSE2__) + const __m128i pix_mask_r = _mm_set1_epi16(0x1f << 10); + const __m128i pix_mask_g = _mm_set1_epi16(0x3f << 5); + const __m128i pix_mask_b = _mm_set1_epi16(0x1f << 5); + const __m128i mul16_r = _mm_set1_epi16(0x0210); + const __m128i mul16_g = _mm_set1_epi16(0x2080); + const __m128i mul16_b = _mm_set1_epi16(0x4200); + const __m128i a = _mm_set1_epi16(0x00ff); + + int max_width = width - 15; +#endif + + for (h = 0; h < height; h++, output += out_stride, input += in_stride >> 1) + { + uint8_t *out = output; + + w = 0; +#if defined(__SSE2__) + for (; w < max_width; w += 16, out += 48) + { + __m128i res_lo_bg0, res_hi_bg0, res_lo_ra0, res_hi_ra0; + __m128i res_lo_bg1, res_hi_bg1, res_lo_ra1, res_hi_ra1; + __m128i res_lo0, res_hi0, res_lo1, res_hi1; + const __m128i in0 = _mm_loadu_si128((const __m128i*)(input + w)); + const __m128i in1 = _mm_loadu_si128((const __m128i*)(input + w + 8)); + __m128i r0 = _mm_and_si128(_mm_srli_epi16(in0, 1), pix_mask_r); + __m128i g0 = _mm_and_si128(in0, pix_mask_g); + __m128i b0 = _mm_and_si128(_mm_slli_epi16(in0, 5), pix_mask_b); + __m128i r1 = _mm_and_si128(_mm_srli_epi16(in1, 1), pix_mask_r); + __m128i g1 = _mm_and_si128(in1, pix_mask_g); + __m128i b1 = _mm_and_si128(_mm_slli_epi16(in1, 5), pix_mask_b); + + r0 = _mm_mulhi_epi16(r0, mul16_r); + g0 = _mm_mulhi_epi16(g0, mul16_g); + b0 = _mm_mulhi_epi16(b0, mul16_b); + r1 = _mm_mulhi_epi16(r1, mul16_r); + g1 = _mm_mulhi_epi16(g1, mul16_g); + b1 = _mm_mulhi_epi16(b1, mul16_b); + + res_lo_bg0 = _mm_unpacklo_epi8(b0, g0); + res_hi_bg0 = _mm_unpackhi_epi8(b0, g0); + res_lo_ra0 = _mm_unpacklo_epi8(r0, a); + res_hi_ra0 = _mm_unpackhi_epi8(r0, a); + res_lo_bg1 = _mm_unpacklo_epi8(b1, g1); + res_hi_bg1 = _mm_unpackhi_epi8(b1, g1); + res_lo_ra1 = _mm_unpacklo_epi8(r1, a); + res_hi_ra1 = _mm_unpackhi_epi8(r1, a); + + res_lo0 = _mm_or_si128(res_lo_bg0, + _mm_slli_si128(res_lo_ra0, 2)); + res_hi0 = _mm_or_si128(res_hi_bg0, + _mm_slli_si128(res_hi_ra0, 2)); + res_lo1 = _mm_or_si128(res_lo_bg1, + _mm_slli_si128(res_lo_ra1, 2)); + res_hi1 = _mm_or_si128(res_hi_bg1, + _mm_slli_si128(res_hi_ra1, 2)); + + store_bgr24_sse2(out, res_lo0, res_hi0, res_lo1, res_hi1); + } +#endif + + for (; w < width; w++) + { + uint32_t col = input[w]; + uint32_t r = (col >> 11) & 0x1f; + uint32_t g = (col >> 5) & 0x3f; + uint32_t b = (col >> 0) & 0x1f; + r = (r << 3) | (r >> 2); + g = (g << 2) | (g >> 4); + b = (b << 3) | (b >> 2); + + *out++ = b; + *out++ = g; + *out++ = r; + } + } +} + +void conv_bgr24_argb8888(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint8_t *input = (const uint8_t*)input_; + uint32_t *output = (uint32_t*)output_; + + for (h = 0; h < height; + h++, output += out_stride >> 2, input += in_stride) + { + const uint8_t *inp = input; + for (w = 0; w < width; w++) + { + uint32_t b = *inp++; + uint32_t g = *inp++; + uint32_t r = *inp++; + output[w] = (0xffu << 24) | (r << 16) | (g << 8) | (b << 0); + } + } +} + +void conv_argb8888_0rgb1555(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint32_t *input = (const uint32_t*)input_; + uint16_t *output = (uint16_t*)output_; + + for (h = 0; h < height; + h++, output += out_stride >> 1, input += in_stride >> 2) + { + for (w = 0; w < width; w++) + { + uint32_t col = input[w]; + uint16_t r = (col >> 19) & 0x1f; + uint16_t g = (col >> 11) & 0x1f; + uint16_t b = (col >> 3) & 0x1f; + output[w] = (r << 10) | (g << 5) | (b << 0); + } + } +} + +void conv_argb8888_bgr24(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint32_t *input = (const uint32_t*)input_; + uint8_t *output = (uint8_t*)output_; + +#if defined(__SSE2__) + int max_width = width - 15; +#endif + + for (h = 0; h < height; + h++, output += out_stride, input += in_stride >> 2) + { + uint8_t *out = output; + + w = 0; +#if defined(__SSE2__) + for (; w < max_width; w += 16, out += 48) + { + store_bgr24_sse2(out, + _mm_loadu_si128((const __m128i*)(input + w + 0)), + _mm_loadu_si128((const __m128i*)(input + w + 4)), + _mm_loadu_si128((const __m128i*)(input + w + 8)), + _mm_loadu_si128((const __m128i*)(input + w + 12))); + } +#endif + + for (; w < width; w++) + { + uint32_t col = input[w]; + *out++ = (uint8_t)(col >> 0); + *out++ = (uint8_t)(col >> 8); + *out++ = (uint8_t)(col >> 16); + } + } +} + +void conv_argb8888_abgr8888(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint32_t *input = (const uint32_t*)input_; + uint32_t *output = (uint32_t*)output_; + + for (h = 0; h < height; + h++, output += out_stride >> 2, input += in_stride >> 2) + { + for (w = 0; w < width; w++) + { + uint32_t col = input[w]; + output[w] = ((col << 16) & 0xff0000) | + ((col >> 16) & 0xff) | (col & 0xff00ff00); + } + } +} + +#define YUV_SHIFT 6 +#define YUV_OFFSET (1 << (YUV_SHIFT - 1)) +#define YUV_MAT_Y (1 << 6) +#define YUV_MAT_U_G (-22) +#define YUV_MAT_U_B (113) +#define YUV_MAT_V_R (90) +#define YUV_MAT_V_G (-46) + +void conv_yuyv_argb8888(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h, w; + const uint8_t *input = (const uint8_t*)input_; + uint32_t *output = (uint32_t*)output_; + +#if defined(__SSE2__) + const __m128i mask_y = _mm_set1_epi16(0xffu); + const __m128i mask_u = _mm_set1_epi32(0xffu << 8); + const __m128i mask_v = _mm_set1_epi32(0xffu << 24); + const __m128i chroma_offset = _mm_set1_epi16(128); + const __m128i round_offset = _mm_set1_epi16(YUV_OFFSET); + + const __m128i yuv_mul = _mm_set1_epi16(YUV_MAT_Y); + const __m128i u_g_mul = _mm_set1_epi16(YUV_MAT_U_G); + const __m128i u_b_mul = _mm_set1_epi16(YUV_MAT_U_B); + const __m128i v_r_mul = _mm_set1_epi16(YUV_MAT_V_R); + const __m128i v_g_mul = _mm_set1_epi16(YUV_MAT_V_G); + const __m128i a = _mm_cmpeq_epi16( + _mm_setzero_si128(), _mm_setzero_si128()); +#endif + + for (h = 0; h < height; h++, output += out_stride >> 2, input += in_stride) + { + const uint8_t *src = input; + uint32_t *dst = output; + + w = 0; + +#if defined(__SSE2__) + /* Each loop processes 16 pixels. */ + for (; w + 16 <= width; w += 16, src += 32, dst += 16) + { + __m128i u, v, u0_g, u1_g, u0_b, u1_b, v0_r, v1_r, v0_g, v1_g, + r0, g0, b0, r1, g1, b1; + __m128i res_lo_bg, res_hi_bg, res_lo_ra, res_hi_ra; + __m128i res0, res1, res2, res3; + __m128i yuv0 = _mm_loadu_si128((const __m128i*)(src + 0)); /* [Y0, U0, Y1, V0, Y2, U1, Y3, V1, ...] */ + __m128i yuv1 = _mm_loadu_si128((const __m128i*)(src + 16)); /* [Y0, U0, Y1, V0, Y2, U1, Y3, V1, ...] */ + + __m128i _y0 = _mm_and_si128(yuv0, mask_y); /* [Y0, Y1, Y2, ...] (16-bit) */ + __m128i u0 = _mm_and_si128(yuv0, mask_u); /* [0, U0, 0, 0, 0, U1, 0, 0, ...] */ + __m128i v0 = _mm_and_si128(yuv0, mask_v); /* [0, 0, 0, V1, 0, , 0, V1, ...] */ + __m128i _y1 = _mm_and_si128(yuv1, mask_y); /* [Y0, Y1, Y2, ...] (16-bit) */ + __m128i u1 = _mm_and_si128(yuv1, mask_u); /* [0, U0, 0, 0, 0, U1, 0, 0, ...] */ + __m128i v1 = _mm_and_si128(yuv1, mask_v); /* [0, 0, 0, V1, 0, , 0, V1, ...] */ + + /* Juggle around to get U and V in the same 16-bit format as Y. */ + u0 = _mm_srli_si128(u0, 1); + v0 = _mm_srli_si128(v0, 3); + u1 = _mm_srli_si128(u1, 1); + v1 = _mm_srli_si128(v1, 3); + u = _mm_packs_epi32(u0, u1); + v = _mm_packs_epi32(v0, v1); + + /* Apply YUV offsets (U, V) -= (-128, -128). */ + u = _mm_sub_epi16(u, chroma_offset); + v = _mm_sub_epi16(v, chroma_offset); + + /* Upscale chroma horizontally (nearest). */ + u0 = _mm_unpacklo_epi16(u, u); + u1 = _mm_unpackhi_epi16(u, u); + v0 = _mm_unpacklo_epi16(v, v); + v1 = _mm_unpackhi_epi16(v, v); + + /* Apply transformations. */ + _y0 = _mm_mullo_epi16(_y0, yuv_mul); + _y1 = _mm_mullo_epi16(_y1, yuv_mul); + u0_g = _mm_mullo_epi16(u0, u_g_mul); + u1_g = _mm_mullo_epi16(u1, u_g_mul); + u0_b = _mm_mullo_epi16(u0, u_b_mul); + u1_b = _mm_mullo_epi16(u1, u_b_mul); + v0_r = _mm_mullo_epi16(v0, v_r_mul); + v1_r = _mm_mullo_epi16(v1, v_r_mul); + v0_g = _mm_mullo_epi16(v0, v_g_mul); + v1_g = _mm_mullo_epi16(v1, v_g_mul); + + /* Add contibutions from the transformed components. */ + r0 = _mm_srai_epi16(_mm_adds_epi16(_mm_adds_epi16(_y0, v0_r), + round_offset), YUV_SHIFT); + g0 = _mm_srai_epi16(_mm_adds_epi16( + _mm_adds_epi16(_mm_adds_epi16(_y0, v0_g), u0_g), round_offset), YUV_SHIFT); + b0 = _mm_srai_epi16(_mm_adds_epi16( + _mm_adds_epi16(_y0, u0_b), round_offset), YUV_SHIFT); + + r1 = _mm_srai_epi16(_mm_adds_epi16( + _mm_adds_epi16(_y1, v1_r), round_offset), YUV_SHIFT); + g1 = _mm_srai_epi16(_mm_adds_epi16( + _mm_adds_epi16(_mm_adds_epi16(_y1, v1_g), u1_g), round_offset), YUV_SHIFT); + b1 = _mm_srai_epi16(_mm_adds_epi16( + _mm_adds_epi16(_y1, u1_b), round_offset), YUV_SHIFT); + + /* Saturate into 8-bit. */ + r0 = _mm_packus_epi16(r0, r1); + g0 = _mm_packus_epi16(g0, g1); + b0 = _mm_packus_epi16(b0, b1); + + /* Interleave into ARGB. */ + res_lo_bg = _mm_unpacklo_epi8(b0, g0); + res_hi_bg = _mm_unpackhi_epi8(b0, g0); + res_lo_ra = _mm_unpacklo_epi8(r0, a); + res_hi_ra = _mm_unpackhi_epi8(r0, a); + res0 = _mm_unpacklo_epi16(res_lo_bg, res_lo_ra); + res1 = _mm_unpackhi_epi16(res_lo_bg, res_lo_ra); + res2 = _mm_unpacklo_epi16(res_hi_bg, res_hi_ra); + res3 = _mm_unpackhi_epi16(res_hi_bg, res_hi_ra); + + _mm_storeu_si128((__m128i*)(dst + 0), res0); + _mm_storeu_si128((__m128i*)(dst + 4), res1); + _mm_storeu_si128((__m128i*)(dst + 8), res2); + _mm_storeu_si128((__m128i*)(dst + 12), res3); + } +#endif + + /* Finish off the rest (if any) in C. */ + for (; w < width; w += 2, src += 4, dst += 2) + { + int _y0 = src[0]; + int u = src[1] - 128; + int _y1 = src[2]; + int v = src[3] - 128; + + uint8_t r0 = clamp_8bit((YUV_MAT_Y * _y0 + YUV_MAT_V_R * v + YUV_OFFSET) >> YUV_SHIFT); + uint8_t g0 = clamp_8bit((YUV_MAT_Y * _y0 + YUV_MAT_U_G * u + YUV_MAT_V_G * v + YUV_OFFSET) >> YUV_SHIFT); + uint8_t b0 = clamp_8bit((YUV_MAT_Y * _y0 + YUV_MAT_U_B * u + YUV_OFFSET) >> YUV_SHIFT); + + uint8_t r1 = clamp_8bit((YUV_MAT_Y * _y1 + YUV_MAT_V_R * v + YUV_OFFSET) >> YUV_SHIFT); + uint8_t g1 = clamp_8bit((YUV_MAT_Y * _y1 + YUV_MAT_U_G * u + YUV_MAT_V_G * v + YUV_OFFSET) >> YUV_SHIFT); + uint8_t b1 = clamp_8bit((YUV_MAT_Y * _y1 + YUV_MAT_U_B * u + YUV_OFFSET) >> YUV_SHIFT); + + dst[0] = 0xff000000u | (r0 << 16) | (g0 << 8) | (b0 << 0); + dst[1] = 0xff000000u | (r1 << 16) | (g1 << 8) | (b1 << 0); + } + } +} + +void conv_copy(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride) +{ + int h; + int copy_len = abs(out_stride); + const uint8_t *input = (const uint8_t*)input_; + uint8_t *output = (uint8_t*)output_; + + if (abs(in_stride) < copy_len) + copy_len = abs(in_stride); + + for (h = 0; h < height; + h++, output += out_stride, input += in_stride) + memcpy(output, input, copy_len); +} + diff --git a/desmume/src/libretro-common/gfx/scaler/scaler.c b/desmume/src/libretro-common/gfx/scaler/scaler.c new file mode 100644 index 000000000..5e41ac7dd --- /dev/null +++ b/desmume/src/libretro-common/gfx/scaler/scaler.c @@ -0,0 +1,379 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (scaler.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +/** + * scaler_alloc: + * @elem_size : size of the elements to be used. + * @siz : size of the image that the scaler needs to handle. + * + * Allocate and returns a scaler object. + * + * Returns: pointer to a scaler object of type 'void *' on success, + * NULL in case of error. Has to be freed manually. + **/ +void *scaler_alloc(size_t elem_size, size_t size) +{ + void *ptr = calloc(elem_size, size); + if (!ptr) + return NULL; + return ptr; +} + +/** + * scaler_free: + * @ptr : pointer to scaler object. + * + * Frees a scaler object. + **/ +void scaler_free(void *ptr) +{ + if (ptr) + free(ptr); +} + +static bool allocate_frames(struct scaler_ctx *ctx) +{ + ctx->scaled.stride = ((ctx->out_width + 7) & ~7) * sizeof(uint64_t); + ctx->scaled.width = ctx->out_width; + ctx->scaled.height = ctx->in_height; + ctx->scaled.frame = (uint64_t*) + scaler_alloc(sizeof(uint64_t), + (ctx->scaled.stride * ctx->scaled.height) >> 3); + if (!ctx->scaled.frame) + return false; + + if (ctx->in_fmt != SCALER_FMT_ARGB8888) + { + ctx->input.stride = ((ctx->in_width + 7) & ~7) * sizeof(uint32_t); + ctx->input.frame = (uint32_t*) + scaler_alloc(sizeof(uint32_t), + (ctx->input.stride * ctx->in_height) >> 2); + if (!ctx->input.frame) + return false; + } + + if (ctx->out_fmt != SCALER_FMT_ARGB8888) + { + ctx->output.stride = ((ctx->out_width + 7) & ~7) * sizeof(uint32_t); + ctx->output.frame = (uint32_t*) + scaler_alloc(sizeof(uint32_t), + (ctx->output.stride * ctx->out_height) >> 2); + if (!ctx->output.frame) + return false; + } + + return true; +} + +/** + * set_direct_pix_conv: + * @ctx : pointer to scaler context object. + * + * Bind a pixel converter callback function to the 'direct_pixconv' function pointer + * of the scaler context object. + * + * Returns: true if a pixel converter function callback could be bound, false if not. + * If false, the function callback 'direct_pixconv' is still unbound. + **/ +static bool set_direct_pix_conv(struct scaler_ctx *ctx) +{ + if (ctx->in_fmt == ctx->out_fmt) + { + ctx->direct_pixconv = conv_copy; + return true; + } + + switch (ctx->in_fmt) + { + case SCALER_FMT_0RGB1555: + switch (ctx->out_fmt) + { + case SCALER_FMT_ARGB8888: + ctx->direct_pixconv = conv_0rgb1555_argb8888; + break; + case SCALER_FMT_RGB565: + ctx->direct_pixconv = conv_0rgb1555_rgb565; + break; + case SCALER_FMT_BGR24: + ctx->direct_pixconv = conv_0rgb1555_bgr24; + break; + default: + break; + } + break; + case SCALER_FMT_RGB565: + switch (ctx->out_fmt) + { + case SCALER_FMT_ARGB8888: + ctx->direct_pixconv = conv_rgb565_argb8888; + break; + case SCALER_FMT_BGR24: + ctx->direct_pixconv = conv_rgb565_bgr24; + break; + case SCALER_FMT_0RGB1555: + ctx->direct_pixconv = conv_rgb565_0rgb1555; + break; + default: + break; + } + break; + case SCALER_FMT_BGR24: + switch (ctx->out_fmt) + { + case SCALER_FMT_ARGB8888: + ctx->direct_pixconv = conv_bgr24_argb8888; + break; + default: + break; + } + break; + case SCALER_FMT_ARGB8888: + switch (ctx->out_fmt) + { + case SCALER_FMT_0RGB1555: + ctx->direct_pixconv = conv_argb8888_0rgb1555; + break; + case SCALER_FMT_BGR24: + ctx->direct_pixconv = conv_argb8888_bgr24; + break; + case SCALER_FMT_ABGR8888: + ctx->direct_pixconv = conv_argb8888_abgr8888; + break; + case SCALER_FMT_RGBA4444: + ctx->direct_pixconv = conv_argb8888_rgba4444; + break; + default: + break; + } + break; + case SCALER_FMT_YUYV: + switch (ctx->out_fmt) + { + case SCALER_FMT_ARGB8888: + ctx->direct_pixconv = conv_yuyv_argb8888; + break; + default: + break; + } + break; + case SCALER_FMT_RGBA4444: + switch (ctx->out_fmt) + { + case SCALER_FMT_ARGB8888: + ctx->direct_pixconv = conv_rgba4444_argb8888; + break; + case SCALER_FMT_RGB565: + ctx->direct_pixconv = conv_rgba4444_rgb565; + break; + default: + break; + } + break; + case SCALER_FMT_ABGR8888: + /* FIXME/TODO */ + break; + } + + if (!ctx->direct_pixconv) + return false; + + return true; +} + +static bool set_pix_conv(struct scaler_ctx *ctx) +{ + switch (ctx->in_fmt) + { + case SCALER_FMT_ARGB8888: + /* No need to convert :D */ + break; + + case SCALER_FMT_0RGB1555: + ctx->in_pixconv = conv_0rgb1555_argb8888; + break; + + case SCALER_FMT_RGB565: + ctx->in_pixconv = conv_rgb565_argb8888; + break; + + case SCALER_FMT_BGR24: + ctx->in_pixconv = conv_bgr24_argb8888; + break; + + case SCALER_FMT_RGBA4444: + ctx->in_pixconv = conv_rgba4444_argb8888; + break; + + default: + return false; + } + + switch (ctx->out_fmt) + { + case SCALER_FMT_ARGB8888: + /* No need to convert :D */ + break; + + case SCALER_FMT_RGBA4444: + ctx->out_pixconv = conv_argb8888_rgba4444; + break; + + case SCALER_FMT_0RGB1555: + ctx->out_pixconv = conv_argb8888_0rgb1555; + break; + + case SCALER_FMT_BGR24: + ctx->out_pixconv = conv_argb8888_bgr24; + break; + + default: + return false; + } + + return true; +} + +bool scaler_ctx_gen_filter(struct scaler_ctx *ctx) +{ + scaler_ctx_gen_reset(ctx); + + if (ctx->in_width == ctx->out_width && ctx->in_height == ctx->out_height) + ctx->unscaled = true; /* Only pixel format conversion ... */ + else + { + ctx->scaler_horiz = scaler_argb8888_horiz; + ctx->scaler_vert = scaler_argb8888_vert; + ctx->unscaled = false; + } + + ctx->scaler_special = NULL; + + if (!allocate_frames(ctx)) + return false; + + if (ctx->unscaled) + { + if (!set_direct_pix_conv(ctx)) + return false; + } + else + { + if (!set_pix_conv(ctx)) + return false; + } + + if (!ctx->unscaled && !scaler_gen_filter(ctx)) + return false; + + return true; +} + +void scaler_ctx_gen_reset(struct scaler_ctx *ctx) +{ + scaler_free(ctx->horiz.filter); + scaler_free(ctx->horiz.filter_pos); + scaler_free(ctx->vert.filter); + scaler_free(ctx->vert.filter_pos); + scaler_free(ctx->scaled.frame); + scaler_free(ctx->input.frame); + scaler_free(ctx->output.frame); + + memset(&ctx->horiz, 0, sizeof(ctx->horiz)); + memset(&ctx->vert, 0, sizeof(ctx->vert)); + memset(&ctx->scaled, 0, sizeof(ctx->scaled)); + memset(&ctx->input, 0, sizeof(ctx->input)); + memset(&ctx->output, 0, sizeof(ctx->output)); +} + +/** + * scaler_ctx_scale: + * @ctx : pointer to scaler context object. + * @output : pointer to output image. + * @input : pointer to input image. + * + * Scales an input image to an output image. + **/ +void scaler_ctx_scale(struct scaler_ctx *ctx, + void *output, const void *input) +{ + const void *input_frame = input; + void *output_frame = output; + int input_stride = ctx->in_stride; + int output_stride = ctx->out_stride; + + if (ctx->unscaled) + { + /* Just perform straight pixel conversion. */ + ctx->direct_pixconv(output, input, + ctx->out_width, ctx->out_height, + ctx->out_stride, ctx->in_stride); + return; + } + + if (ctx->in_fmt != SCALER_FMT_ARGB8888) + { + ctx->in_pixconv(ctx->input.frame, input, + ctx->in_width, ctx->in_height, + ctx->input.stride, ctx->in_stride); + + input_frame = ctx->input.frame; + input_stride = ctx->input.stride; + } + + if (ctx->out_fmt != SCALER_FMT_ARGB8888) + { + output_frame = ctx->output.frame; + output_stride = ctx->output.stride; + } + + if (ctx->scaler_special) + { + /* Take some special, and (hopefully) more optimized path. */ + ctx->scaler_special(ctx, output_frame, input_frame, + ctx->out_width, ctx->out_height, + ctx->in_width, ctx->in_height, + output_stride, input_stride); + } + else + { + /* Take generic filter path. */ + if (ctx->scaler_horiz) + ctx->scaler_horiz(ctx, input_frame, input_stride); + if (ctx->scaler_vert) + ctx->scaler_vert (ctx, output, output_stride); + } + + if (ctx->out_fmt != SCALER_FMT_ARGB8888) + ctx->out_pixconv(output, ctx->output.frame, + ctx->out_width, ctx->out_height, + ctx->out_stride, ctx->output.stride); +} diff --git a/desmume/src/libretro-common/gfx/scaler/scaler_filter.c b/desmume/src/libretro-common/gfx/scaler/scaler_filter.c new file mode 100644 index 000000000..756161df3 --- /dev/null +++ b/desmume/src/libretro-common/gfx/scaler/scaler_filter.c @@ -0,0 +1,282 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (scaler_filter.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include + +#include +#include +#include +#include +#include + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +static bool allocate_filters(struct scaler_ctx *ctx) +{ + ctx->horiz.filter = (int16_t*)scaler_alloc(sizeof(int16_t), ctx->horiz.filter_stride * ctx->out_width); + ctx->horiz.filter_pos = (int*)scaler_alloc(sizeof(int), ctx->out_width); + + ctx->vert.filter = (int16_t*)scaler_alloc(sizeof(int16_t), ctx->vert.filter_stride * ctx->out_height); + ctx->vert.filter_pos = (int*)scaler_alloc(sizeof(int), ctx->out_height); + + return ctx->horiz.filter && ctx->vert.filter; +} + +static void gen_filter_point_sub(struct scaler_filter *filter, + int len, int pos, int step) +{ + int i; + for (i = 0; i < len; i++, pos += step) + { + filter->filter_pos[i] = pos >> 16; + filter->filter[i] = FILTER_UNITY; + } +} + +static bool gen_filter_point(struct scaler_ctx *ctx) +{ + int x_pos, x_step, y_pos, y_step; + + ctx->horiz.filter_len = 1; + ctx->horiz.filter_stride = 1; + ctx->vert.filter_len = 1; + ctx->vert.filter_stride = 1; + + if (!allocate_filters(ctx)) + return false; + + x_pos = (1 << 15) * ctx->in_width / ctx->out_width - (1 << 15); + x_step = (1 << 16) * ctx->in_width / ctx->out_width; + y_pos = (1 << 15) * ctx->in_height / ctx->out_height - (1 << 15); + y_step = (1 << 16) * ctx->in_height / ctx->out_height; + + gen_filter_point_sub(&ctx->horiz, ctx->out_width, x_pos, x_step); + gen_filter_point_sub(&ctx->vert, ctx->out_height, y_pos, y_step); + + ctx->scaler_special = scaler_argb8888_point_special; + + return true; +} + +static void gen_filter_bilinear_sub(struct scaler_filter *filter, + int len, int pos, int step) +{ + int i; + for (i = 0; i < len; i++, pos += step) + { + filter->filter_pos[i] = pos >> 16; + filter->filter[i * 2 + 1] = (pos & 0xffff) >> 2; + filter->filter[i * 2 + 0] = FILTER_UNITY - filter->filter[i * 2 + 1]; + } +} + +static bool gen_filter_bilinear(struct scaler_ctx *ctx) +{ + int x_pos, x_step, y_pos, y_step; + + ctx->horiz.filter_len = 2; + ctx->horiz.filter_stride = 2; + ctx->vert.filter_len = 2; + ctx->vert.filter_stride = 2; + + if (!allocate_filters(ctx)) + return false; + + x_pos = (1 << 15) * ctx->in_width / ctx->out_width - (1 << 15); + x_step = (1 << 16) * ctx->in_width / ctx->out_width; + y_pos = (1 << 15) * ctx->in_height / ctx->out_height - (1 << 15); + y_step = (1 << 16) * ctx->in_height / ctx->out_height; + + gen_filter_bilinear_sub(&ctx->horiz, ctx->out_width, x_pos, x_step); + gen_filter_bilinear_sub(&ctx->vert, ctx->out_height, y_pos, y_step); + + return true; +} + +static void gen_filter_sinc_sub(struct scaler_filter *filter, + int len, int pos, int step, double phase_mul) +{ + int i, j; + const int sinc_size = filter->filter_len; + + for (i = 0; i < len; i++, pos += step) + { + filter->filter_pos[i] = pos >> 16; + + for (j = 0; j < sinc_size; j++) + { + double sinc_phase = M_PI * ((double)((sinc_size << 15) + (pos & 0xffff)) / 0x10000 - j); + double lanczos_phase = sinc_phase / ((sinc_size >> 1)); + int16_t sinc_val = FILTER_UNITY * sinc(sinc_phase * phase_mul) * sinc(lanczos_phase) * phase_mul; + + filter->filter[i * sinc_size + j] = sinc_val; + } + } +} + +static bool gen_filter_sinc(struct scaler_ctx *ctx) +{ + int x_pos, x_step, y_pos, y_step; + double phase_mul_horiz, phase_mul_vert; + /* Need to expand the filter when downsampling + * to get a proper low-pass effect. */ + const int sinc_size = 8 * ((ctx->in_width > ctx->out_width) + ? next_pow2(ctx->in_width / ctx->out_width) : 1); + + ctx->horiz.filter_len = sinc_size; + ctx->horiz.filter_stride = sinc_size; + ctx->vert.filter_len = sinc_size; + ctx->vert.filter_stride = sinc_size; + + if (!allocate_filters(ctx)) + return false; + + x_pos = (1 << 15) * ctx->in_width / ctx->out_width - (1 << 15) - (sinc_size << 15); + x_step = (1 << 16) * ctx->in_width / ctx->out_width; + y_pos = (1 << 15) * ctx->in_height / ctx->out_height - (1 << 15) - (sinc_size << 15); + y_step = (1 << 16) * ctx->in_height / ctx->out_height; + + phase_mul_horiz = ctx->in_width > ctx->out_width ? (double)ctx->out_width / ctx->in_width : 1.0; + phase_mul_vert = ctx->in_height > ctx->out_height ? (double)ctx->out_height / ctx->in_height : 1.0; + + gen_filter_sinc_sub(&ctx->horiz, ctx->out_width, x_pos, x_step, phase_mul_horiz); + gen_filter_sinc_sub(&ctx->vert, ctx->out_height, y_pos, y_step, phase_mul_vert); + + return true; +} + +static bool validate_filter(struct scaler_ctx *ctx) +{ + int i; + int max_h_pos; + int max_w_pos = ctx->in_width - ctx->horiz.filter_len; + + for (i = 0; i < ctx->out_width; i++) + { + if (ctx->horiz.filter_pos[i] > max_w_pos || ctx->horiz.filter_pos[i] < 0) + { + fprintf(stderr, "Out X = %d => In X = %d\n", i, ctx->horiz.filter_pos[i]); + return false; + } + } + + max_h_pos = ctx->in_height - ctx->vert.filter_len; + + for (i = 0; i < ctx->out_height; i++) + { + if (ctx->vert.filter_pos[i] > max_h_pos || ctx->vert.filter_pos[i] < 0) + { + fprintf(stderr, "Out Y = %d => In Y = %d\n", i, ctx->vert.filter_pos[i]); + return false; + } + } + + return true; +} + +static void fixup_filter_sub(struct scaler_filter *filter, int out_len, int in_len) +{ + int i; + int max_pos = in_len - filter->filter_len; + + for (i = 0; i < out_len; i++) + { + int postsample = filter->filter_pos[i] - max_pos; + int presample = -filter->filter_pos[i]; + + if (postsample > 0) + { + int16_t *base_filter = NULL; + filter->filter_pos[i] -= postsample; + + base_filter = filter->filter + i * filter->filter_stride; + + if (postsample > (int)filter->filter_len) + memset(base_filter, 0, filter->filter_len * sizeof(int16_t)); + else + { + memmove(base_filter + postsample, base_filter, + (filter->filter_len - postsample) * sizeof(int16_t)); + memset(base_filter, 0, postsample * sizeof(int16_t)); + } + } + + if (presample > 0) + { + int16_t *base_filter = NULL; + filter->filter_pos[i] += presample; + base_filter = filter->filter + i * filter->filter_stride; + + if (presample > (int)filter->filter_len) + memset(base_filter, 0, filter->filter_len * sizeof(int16_t)); + else + { + memmove(base_filter, base_filter + presample, + (filter->filter_len - presample) * sizeof(int16_t)); + memset(base_filter + (filter->filter_len - presample), 0, presample * sizeof(int16_t)); + } + } + } +} + +/* Makes sure that we never sample outside our rectangle. */ +static void fixup_filter(struct scaler_ctx *ctx) +{ + fixup_filter_sub(&ctx->horiz, ctx->out_width, ctx->in_width); + fixup_filter_sub(&ctx->vert, ctx->out_height, ctx->in_height); +} + + +bool scaler_gen_filter(struct scaler_ctx *ctx) +{ + bool ret = true; + + switch (ctx->scaler_type) + { + case SCALER_TYPE_POINT: + ret = gen_filter_point(ctx); + break; + + case SCALER_TYPE_BILINEAR: + ret = gen_filter_bilinear(ctx); + break; + + case SCALER_TYPE_SINC: + ret = gen_filter_sinc(ctx); + break; + + default: + return false; + } + + if (!ret) + return false; + + fixup_filter(ctx); + + return validate_filter(ctx); +} + diff --git a/desmume/src/libretro-common/gfx/scaler/scaler_int.c b/desmume/src/libretro-common/gfx/scaler/scaler_int.c new file mode 100644 index 000000000..5e72f81ec --- /dev/null +++ b/desmume/src/libretro-common/gfx/scaler/scaler_int.c @@ -0,0 +1,285 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (scaler_int.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include + +#include + +#ifdef SCALER_NO_SIMD +#undef __SSE2__ +#endif + +#if defined(__SSE2__) +#include +#ifdef _WIN32 +#include +#endif +#endif + +/* ARGB8888 scaler is split in two: + * + * First, horizontal scaler is applied. + * Here, all 8-bit channels are expanded to 16-bit. Values are then shifted 7 to left to occupy 15 bits. + * The sign bit is kept empty as we have to do signed multiplication for the filter. + * A mulhi [(a * b) >> 16] is applied which loses some precision, but is very efficient for SIMD. + * It is accurate enough for 8-bit purposes. + * + * The fixed point 1.0 for filter is (1 << 14). After horizontal scale, the output is kept + * with 16-bit channels, and will now have 13 bits of precision as [(a * (1 << 14)) >> 16] is effectively a right shift by 2. + * + * Vertical scaler takes the 13 bit channels, and performs the same mulhi steps. + * Another 2 bits of precision is lost, which ends up as 11 bits. + * Scaling is now complete. Channels are shifted right by 3, and saturated into 8-bit values. + * + * The C version of scalers perform the exact same operations as the SIMD code for testing purposes. + */ + +#if defined(__SSE2__) +void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int stride) +{ + int h, w, y; + const uint64_t *input = ctx->scaled.frame; + uint32_t *output = (uint32_t*)output_; + + const int16_t *filter_vert = ctx->vert.filter; + + for (h = 0; h < ctx->out_height; h++, filter_vert += ctx->vert.filter_stride, output += stride >> 2) + { + const uint64_t *input_base = input + ctx->vert.filter_pos[h] * (ctx->scaled.stride >> 3); + + for (w = 0; w < ctx->out_width; w++) + { + __m128i final; + __m128i res = _mm_setzero_si128(); + + const uint64_t *input_base_y = input_base + w; + + for (y = 0; (y + 1) < ctx->vert.filter_len; y += 2, input_base_y += (ctx->scaled.stride >> 2)) + { + __m128i coeff = _mm_set_epi64x(filter_vert[y + 1] * 0x0001000100010001ll, filter_vert[y + 0] * 0x0001000100010001ll); + __m128i col = _mm_set_epi64x(input_base_y[ctx->scaled.stride >> 3], input_base_y[0]); + + res = _mm_adds_epi16(_mm_mulhi_epi16(col, coeff), res); + } + + for (; y < ctx->vert.filter_len; y++, input_base_y += (ctx->scaled.stride >> 3)) + { + __m128i coeff = _mm_set_epi64x(0, filter_vert[y] * 0x0001000100010001ll); + __m128i col = _mm_set_epi64x(0, input_base_y[0]); + + res = _mm_adds_epi16(_mm_mulhi_epi16(col, coeff), res); + } + + res = _mm_adds_epi16(_mm_srli_si128(res, 8), res); + res = _mm_srai_epi16(res, (7 - 2 - 2)); + + final = _mm_packus_epi16(res, res); + + output[w] = _mm_cvtsi128_si32(final); + } + } +} +#else +void scaler_argb8888_vert(const struct scaler_ctx *ctx, void *output_, int stride) +{ + int h, w, y; + const uint64_t *input = ctx->scaled.frame; + uint32_t *output = (uint32_t*)output_; + + const int16_t *filter_vert = ctx->vert.filter; + + for (h = 0; h < ctx->out_height; h++, filter_vert += ctx->vert.filter_stride, output += stride >> 2) + { + const uint64_t *input_base = input + ctx->vert.filter_pos[h] * (ctx->scaled.stride >> 3); + + for (w = 0; w < ctx->out_width; w++) + { + int16_t res_a = 0; + int16_t res_r = 0; + int16_t res_g = 0; + int16_t res_b = 0; + + const uint64_t *input_base_y = input_base + w; + for (y = 0; y < ctx->vert.filter_len; y++, input_base_y += (ctx->scaled.stride >> 3)) + { + uint64_t col = *input_base_y; + + int16_t a = (col >> 48) & 0xffff; + int16_t r = (col >> 32) & 0xffff; + int16_t g = (col >> 16) & 0xffff; + int16_t b = (col >> 0) & 0xffff; + + int16_t coeff = filter_vert[y]; + + res_a += (a * coeff) >> 16; + res_r += (r * coeff) >> 16; + res_g += (g * coeff) >> 16; + res_b += (b * coeff) >> 16; + } + + res_a >>= (7 - 2 - 2); + res_r >>= (7 - 2 - 2); + res_g >>= (7 - 2 - 2); + res_b >>= (7 - 2 - 2); + + output[w] = (clamp_8bit(res_a) << 24) | (clamp_8bit(res_r) << 16) | (clamp_8bit(res_g) << 8) | (clamp_8bit(res_b) << 0); + } + } +} +#endif + +#if defined(__SSE2__) +void scaler_argb8888_horiz(const struct scaler_ctx *ctx, const void *input_, int stride) +{ + int h, w, x; + const uint32_t *input = (const uint32_t*)input_; + uint64_t *output = ctx->scaled.frame; + + for (h = 0; h < ctx->scaled.height; h++, input += stride >> 2, output += ctx->scaled.stride >> 3) + { + const int16_t *filter_horiz = ctx->horiz.filter; + + for (w = 0; w < ctx->scaled.width; w++, filter_horiz += ctx->horiz.filter_stride) + { + __m128i res = _mm_setzero_si128(); + + const uint32_t *input_base_x = input + ctx->horiz.filter_pos[w]; + + for (x = 0; (x + 1) < ctx->horiz.filter_len; x += 2) + { + __m128i coeff = _mm_set_epi64x(filter_horiz[x + 1] * 0x0001000100010001ll, filter_horiz[x + 0] * 0x0001000100010001ll); + + __m128i col = _mm_unpacklo_epi8(_mm_set_epi64x(0, + ((uint64_t)input_base_x[x + 1] << 32) | input_base_x[x + 0]), _mm_setzero_si128()); + + col = _mm_slli_epi16(col, 7); + res = _mm_adds_epi16(_mm_mulhi_epi16(col, coeff), res); + } + + for (; x < ctx->horiz.filter_len; x++) + { + __m128i coeff = _mm_set_epi64x(0, filter_horiz[x] * 0x0001000100010001ll); + __m128i col = _mm_unpacklo_epi8(_mm_set_epi32(0, 0, 0, input_base_x[x]), _mm_setzero_si128()); + + col = _mm_slli_epi16(col, 7); + res = _mm_adds_epi16(_mm_mulhi_epi16(col, coeff), res); + } + + res = _mm_adds_epi16(_mm_srli_si128(res, 8), res); + +#ifdef __x86_64__ + output[w] = _mm_cvtsi128_si64(res); +#else /* 32-bit doesn't have si64. Do it in two steps. */ + union + { + uint32_t *u32; + uint64_t *u64; + } u; + u.u64 = output + w; + u.u32[0] = _mm_cvtsi128_si32(res); + u.u32[1] = _mm_cvtsi128_si32(_mm_srli_si128(res, 4)); +#endif + } + } +} +#else +static INLINE uint64_t build_argb64(uint16_t a, uint16_t r, uint16_t g, uint16_t b) +{ + return ((uint64_t)a << 48) | ((uint64_t)r << 32) | ((uint64_t)g << 16) | ((uint64_t)b << 0); +} + +void scaler_argb8888_horiz(const struct scaler_ctx *ctx, const void *input_, int stride) +{ + int h, w, x; + const uint32_t *input = (uint32_t*)input_; + uint64_t *output = ctx->scaled.frame; + + for (h = 0; h < ctx->scaled.height; h++, input += stride >> 2, output += ctx->scaled.stride >> 3) + { + const int16_t *filter_horiz = ctx->horiz.filter; + + for (w = 0; w < ctx->scaled.width; w++, filter_horiz += ctx->horiz.filter_stride) + { + const uint32_t *input_base_x = input + ctx->horiz.filter_pos[w]; + + int16_t res_a = 0; + int16_t res_r = 0; + int16_t res_g = 0; + int16_t res_b = 0; + + for (x = 0; x < ctx->horiz.filter_len; x++) + { + uint32_t col = input_base_x[x]; + + int16_t a = (col >> (24 - 7)) & (0xff << 7); + int16_t r = (col >> (16 - 7)) & (0xff << 7); + int16_t g = (col >> ( 8 - 7)) & (0xff << 7); + int16_t b = (col << ( 0 + 7)) & (0xff << 7); + + int16_t coeff = filter_horiz[x]; + + res_a += (a * coeff) >> 16; + res_r += (r * coeff) >> 16; + res_g += (g * coeff) >> 16; + res_b += (b * coeff) >> 16; + } + + output[w] = build_argb64(res_a, res_r, res_g, res_b); + } + } +} +#endif + +void scaler_argb8888_point_special(const struct scaler_ctx *ctx, + void *output_, const void *input_, + int out_width, int out_height, + int in_width, int in_height, + int out_stride, int in_stride) +{ + int h, w; + const uint32_t *input = NULL; + uint32_t *output = NULL; + int x_pos = (1 << 15) * in_width / out_width - (1 << 15); + int x_step = (1 << 16) * in_width / out_width; + int y_pos = (1 << 15) * in_height / out_height - (1 << 15); + int y_step = (1 << 16) * in_height / out_height; + + (void)ctx; + + if (x_pos < 0) + x_pos = 0; + if (y_pos < 0) + y_pos = 0; + + input = (const uint32_t*)input_; + output = (uint32_t*)output_; + + for (h = 0; h < out_height; h++, y_pos += y_step, output += out_stride >> 2) + { + int x = x_pos; + const uint32_t *inp = input + (y_pos >> 16) * (in_stride >> 2); + + for (w = 0; w < out_width; w++, x += x_step) + output[w] = inp[x >> 16]; + } +} + diff --git a/desmume/src/libretro-common/glsym/README.md b/desmume/src/libretro-common/glsym/README.md new file mode 100644 index 000000000..9e4f0e840 --- /dev/null +++ b/desmume/src/libretro-common/glsym/README.md @@ -0,0 +1,12 @@ +# Autogenerate GL extension loaders + +## OpenGL desktop + +Use Khronos' recent [header](www.opengl.org/registry/api/glext.h). + + ./glgen.py /usr/include/GL/glext.h glsym_gl.h glsym_gl.c + +## OpenGL ES + + ./glgen.py /usr/include/GLES2/gl2ext.h glsym_es2.h glsym_es2.c + diff --git a/desmume/src/libretro-common/glsym/glgen.py b/desmume/src/libretro-common/glsym/glgen.py new file mode 100644 index 000000000..20ec669f6 --- /dev/null +++ b/desmume/src/libretro-common/glsym/glgen.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python3 + +""" + License statement applies to this file (glgen.py) only. +""" + +""" + Permission is hereby granted, free of charge, + to any person obtaining a copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +""" + +import sys +import os +import re + +banned_ext = [ 'AMD', 'APPLE', 'EXT', 'NV', 'NVX', 'ATI', '3DLABS', 'SUN', 'SGI', 'SGIX', 'SGIS', 'INTEL', '3DFX', 'IBM', 'MESA', 'GREMEDY', 'OML', 'PGI', 'I3D', 'INGL', 'MTX', 'QCOM', 'IMG', 'ANGLE', 'SUNX', 'INGR' ] + +def noext(sym): + for ext in banned_ext: + if sym.endswith(ext): + return False + return True + +def find_gl_symbols(lines): + typedefs = [] + syms = [] + for line in lines: + m = re.search(r'^typedef.+PFN(\S+)PROC.+$', line) + g = re.search(r'^.+(gl\S+)\W*\(.+\).*$', line) + if m and noext(m.group(1)): + typedefs.append(m.group(0).replace('PFN', 'RGLSYM').replace('GLDEBUGPROC', 'RGLGENGLDEBUGPROC')) + if g and noext(g.group(1)): + syms.append(g.group(1)) + return (typedefs, syms) + +def generate_defines(gl_syms): + res = [] + for line in gl_syms: + res.append('#define {} __rglgen_{}'.format(line, line)) + return res + +def generate_declarations(gl_syms): + return ['RGLSYM' + x.upper() + 'PROC ' + '__rglgen_' + x + ';' for x in gl_syms] + +def generate_macros(gl_syms): + return [' SYM(' + x.replace('gl', '') + '),' for x in gl_syms] + +def dump(f, lines): + f.write('\n'.join(lines)) + f.write('\n\n') + +if __name__ == '__main__': + + if len(sys.argv) > 4: + for banned in sys.argv[4:]: + banned_ext.append(banned) + + with open(sys.argv[1], 'r') as f: + lines = f.readlines() + typedefs, syms = find_gl_symbols(lines) + + overrides = generate_defines(syms) + declarations = generate_declarations(syms) + externs = ['extern ' + x for x in declarations] + + macros = generate_macros(syms) + + with open(sys.argv[2], 'w') as f: + f.write('#ifndef RGLGEN_DECL_H__\n') + f.write('#define RGLGEN_DECL_H__\n') + + f.write('#ifdef __cplusplus\n') + f.write('extern "C" {\n') + f.write('#endif\n') + + f.write('#ifdef GL_APIENTRY\n') + f.write('typedef void (GL_APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);\n') + f.write('typedef void (GL_APIENTRY *RGLGENGLDEBUGPROCKHR)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);\n') + f.write('#else\n') + f.write('#ifndef APIENTRY\n') + f.write('#define APIENTRY\n') + f.write('#endif\n') + f.write('#ifndef APIENTRYP\n') + f.write('#define APIENTRYP APIENTRY *\n') + f.write('#endif\n') + f.write('typedef void (APIENTRY *RGLGENGLDEBUGPROCARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);\n') + f.write('typedef void (APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*);\n') + f.write('#endif\n') + + f.write('#ifndef GL_OES_EGL_image\n') + f.write('typedef void *GLeglImageOES;\n') + f.write('#endif\n') + + f.write('#if !defined(GL_OES_fixed_point) && !defined(HAVE_OPENGLES2)\n') + f.write('typedef GLint GLfixed;\n') + f.write('#endif\n') + + f.write('#if defined(OSX) && !defined(MAC_OS_X_VERSION_10_7)\n') + f.write('typedef long long int GLint64;\n') + f.write('typedef unsigned long long int GLuint64;\n') + f.write('typedef unsigned long long int GLuint64EXT;\n') + f.write('typedef struct __GLsync *GLsync;\n') + f.write('#endif\n') + + dump(f, typedefs) + dump(f, overrides) + dump(f, externs) + + f.write('struct rglgen_sym_map { const char *sym; void *ptr; };\n') + f.write('extern const struct rglgen_sym_map rglgen_symbol_map[];\n') + + f.write('#ifdef __cplusplus\n') + f.write('}\n') + f.write('#endif\n') + + f.write('#endif\n') + + with open(sys.argv[3], 'w') as f: + f.write('#include "glsym.h"\n') + f.write('#include \n') + f.write('#define SYM(x) { "gl" #x, &(gl##x) }\n') + f.write('const struct rglgen_sym_map rglgen_symbol_map[] = {\n') + dump(f, macros) + f.write(' { NULL, NULL },\n') + f.write('};\n') + dump(f, declarations) + diff --git a/desmume/src/libretro-common/glsym/glsym_es2.c b/desmume/src/libretro-common/glsym/glsym_es2.c new file mode 100644 index 000000000..d8004e850 --- /dev/null +++ b/desmume/src/libretro-common/glsym/glsym_es2.c @@ -0,0 +1,87 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this libretro SDK code part (glsym). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include + +#define SYM(x) { "gl" #x, &(gl##x) } +const struct rglgen_sym_map rglgen_symbol_map[] = { + SYM(DebugMessageControlKHR), + SYM(DebugMessageInsertKHR), + SYM(DebugMessageCallbackKHR), + SYM(GetDebugMessageLogKHR), + SYM(PushDebugGroupKHR), + SYM(PopDebugGroupKHR), + SYM(ObjectLabelKHR), + SYM(GetObjectLabelKHR), + SYM(ObjectPtrLabelKHR), + SYM(GetObjectPtrLabelKHR), + SYM(GetPointervKHR), + SYM(EGLImageTargetTexture2DOES), + SYM(EGLImageTargetRenderbufferStorageOES), + SYM(GetProgramBinaryOES), + SYM(ProgramBinaryOES), + SYM(MapBufferOES), + SYM(UnmapBufferOES), + SYM(GetBufferPointervOES), + SYM(TexImage3DOES), + SYM(TexSubImage3DOES), + SYM(CopyTexSubImage3DOES), + SYM(CompressedTexImage3DOES), + SYM(CompressedTexSubImage3DOES), + SYM(FramebufferTexture3DOES), + SYM(BindVertexArrayOES), + SYM(DeleteVertexArraysOES), + SYM(GenVertexArraysOES), + SYM(IsVertexArrayOES), + + { NULL, NULL }, +}; +RGLSYMGLDEBUGMESSAGECONTROLKHRPROC __rglgen_glDebugMessageControlKHR; +RGLSYMGLDEBUGMESSAGEINSERTKHRPROC __rglgen_glDebugMessageInsertKHR; +RGLSYMGLDEBUGMESSAGECALLBACKKHRPROC __rglgen_glDebugMessageCallbackKHR; +RGLSYMGLGETDEBUGMESSAGELOGKHRPROC __rglgen_glGetDebugMessageLogKHR; +RGLSYMGLPUSHDEBUGGROUPKHRPROC __rglgen_glPushDebugGroupKHR; +RGLSYMGLPOPDEBUGGROUPKHRPROC __rglgen_glPopDebugGroupKHR; +RGLSYMGLOBJECTLABELKHRPROC __rglgen_glObjectLabelKHR; +RGLSYMGLGETOBJECTLABELKHRPROC __rglgen_glGetObjectLabelKHR; +RGLSYMGLOBJECTPTRLABELKHRPROC __rglgen_glObjectPtrLabelKHR; +RGLSYMGLGETOBJECTPTRLABELKHRPROC __rglgen_glGetObjectPtrLabelKHR; +RGLSYMGLGETPOINTERVKHRPROC __rglgen_glGetPointervKHR; +RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC __rglgen_glEGLImageTargetTexture2DOES; +RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC __rglgen_glEGLImageTargetRenderbufferStorageOES; +RGLSYMGLGETPROGRAMBINARYOESPROC __rglgen_glGetProgramBinaryOES; +RGLSYMGLPROGRAMBINARYOESPROC __rglgen_glProgramBinaryOES; +RGLSYMGLMAPBUFFEROESPROC __rglgen_glMapBufferOES; +RGLSYMGLUNMAPBUFFEROESPROC __rglgen_glUnmapBufferOES; +RGLSYMGLGETBUFFERPOINTERVOESPROC __rglgen_glGetBufferPointervOES; +RGLSYMGLTEXIMAGE3DOESPROC __rglgen_glTexImage3DOES; +RGLSYMGLTEXSUBIMAGE3DOESPROC __rglgen_glTexSubImage3DOES; +RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC __rglgen_glCopyTexSubImage3DOES; +RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC __rglgen_glCompressedTexImage3DOES; +RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC __rglgen_glCompressedTexSubImage3DOES; +RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC __rglgen_glFramebufferTexture3DOES; +RGLSYMGLBINDVERTEXARRAYOESPROC __rglgen_glBindVertexArrayOES; +RGLSYMGLDELETEVERTEXARRAYSOESPROC __rglgen_glDeleteVertexArraysOES; +RGLSYMGLGENVERTEXARRAYSOESPROC __rglgen_glGenVertexArraysOES; +RGLSYMGLISVERTEXARRAYOESPROC __rglgen_glIsVertexArrayOES; + diff --git a/desmume/src/libretro-common/glsym/glsym_gl.c b/desmume/src/libretro-common/glsym/glsym_gl.c new file mode 100644 index 000000000..f72e97648 --- /dev/null +++ b/desmume/src/libretro-common/glsym/glsym_gl.c @@ -0,0 +1,2083 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this libretro SDK code part (glsym). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include + +#include + +#define SYM(x) { "gl" #x, &(gl##x) } + +const struct rglgen_sym_map rglgen_symbol_map[] = { + SYM(DrawRangeElements), + SYM(TexImage3D), + SYM(TexSubImage3D), + SYM(CopyTexSubImage3D), + SYM(ActiveTexture), + SYM(SampleCoverage), + SYM(CompressedTexImage3D), + SYM(CompressedTexImage2D), + SYM(CompressedTexImage1D), + SYM(CompressedTexSubImage3D), + SYM(CompressedTexSubImage2D), + SYM(CompressedTexSubImage1D), + SYM(GetCompressedTexImage), + SYM(ClientActiveTexture), + SYM(MultiTexCoord1d), + SYM(MultiTexCoord1dv), + SYM(MultiTexCoord1f), + SYM(MultiTexCoord1fv), + SYM(MultiTexCoord1i), + SYM(MultiTexCoord1iv), + SYM(MultiTexCoord1s), + SYM(MultiTexCoord1sv), + SYM(MultiTexCoord2d), + SYM(MultiTexCoord2dv), + SYM(MultiTexCoord2f), + SYM(MultiTexCoord2fv), + SYM(MultiTexCoord2i), + SYM(MultiTexCoord2iv), + SYM(MultiTexCoord2s), + SYM(MultiTexCoord2sv), + SYM(MultiTexCoord3d), + SYM(MultiTexCoord3dv), + SYM(MultiTexCoord3f), + SYM(MultiTexCoord3fv), + SYM(MultiTexCoord3i), + SYM(MultiTexCoord3iv), + SYM(MultiTexCoord3s), + SYM(MultiTexCoord3sv), + SYM(MultiTexCoord4d), + SYM(MultiTexCoord4dv), + SYM(MultiTexCoord4f), + SYM(MultiTexCoord4fv), + SYM(MultiTexCoord4i), + SYM(MultiTexCoord4iv), + SYM(MultiTexCoord4s), + SYM(MultiTexCoord4sv), + SYM(LoadTransposeMatrixf), + SYM(LoadTransposeMatrixd), + SYM(MultTransposeMatrixf), + SYM(MultTransposeMatrixd), + SYM(BlendFuncSeparate), + SYM(MultiDrawArrays), + SYM(MultiDrawElements), + SYM(PointParameterf), + SYM(PointParameterfv), + SYM(PointParameteri), + SYM(PointParameteriv), + SYM(FogCoordf), + SYM(FogCoordfv), + SYM(FogCoordd), + SYM(FogCoorddv), + SYM(FogCoordPointer), + SYM(SecondaryColor3b), + SYM(SecondaryColor3bv), + SYM(SecondaryColor3d), + SYM(SecondaryColor3dv), + SYM(SecondaryColor3f), + SYM(SecondaryColor3fv), + SYM(SecondaryColor3i), + SYM(SecondaryColor3iv), + SYM(SecondaryColor3s), + SYM(SecondaryColor3sv), + SYM(SecondaryColor3ub), + SYM(SecondaryColor3ubv), + SYM(SecondaryColor3ui), + SYM(SecondaryColor3uiv), + SYM(SecondaryColor3us), + SYM(SecondaryColor3usv), + SYM(SecondaryColorPointer), + SYM(WindowPos2d), + SYM(WindowPos2dv), + SYM(WindowPos2f), + SYM(WindowPos2fv), + SYM(WindowPos2i), + SYM(WindowPos2iv), + SYM(WindowPos2s), + SYM(WindowPos2sv), + SYM(WindowPos3d), + SYM(WindowPos3dv), + SYM(WindowPos3f), + SYM(WindowPos3fv), + SYM(WindowPos3i), + SYM(WindowPos3iv), + SYM(WindowPos3s), + SYM(WindowPos3sv), + SYM(BlendColor), + SYM(BlendEquation), + SYM(GenQueries), + SYM(DeleteQueries), + SYM(IsQuery), + SYM(BeginQuery), + SYM(EndQuery), + SYM(GetQueryiv), + SYM(GetQueryObjectiv), + SYM(GetQueryObjectuiv), + SYM(BindBuffer), + SYM(DeleteBuffers), + SYM(GenBuffers), + SYM(IsBuffer), + SYM(BufferData), + SYM(BufferSubData), + SYM(GetBufferSubData), + SYM(MapBuffer), + SYM(UnmapBuffer), + SYM(GetBufferParameteriv), + SYM(GetBufferPointerv), + SYM(BlendEquationSeparate), + SYM(DrawBuffers), + SYM(StencilOpSeparate), + SYM(StencilFuncSeparate), + SYM(StencilMaskSeparate), + SYM(AttachShader), + SYM(BindAttribLocation), + SYM(CompileShader), + SYM(CreateProgram), + SYM(CreateShader), + SYM(DeleteProgram), + SYM(DeleteShader), + SYM(DetachShader), + SYM(DisableVertexAttribArray), + SYM(EnableVertexAttribArray), + SYM(GetActiveAttrib), + SYM(GetActiveUniform), + SYM(GetAttachedShaders), + SYM(GetAttribLocation), + SYM(GetProgramiv), + SYM(GetProgramInfoLog), + SYM(GetShaderiv), + SYM(GetShaderInfoLog), + SYM(GetShaderSource), + SYM(GetUniformLocation), + SYM(GetUniformfv), + SYM(GetUniformiv), + SYM(GetVertexAttribdv), + SYM(GetVertexAttribfv), + SYM(GetVertexAttribiv), + SYM(GetVertexAttribPointerv), + SYM(IsProgram), + SYM(IsShader), + SYM(LinkProgram), + SYM(ShaderSource), + SYM(UseProgram), + SYM(Uniform1f), + SYM(Uniform2f), + SYM(Uniform3f), + SYM(Uniform4f), + SYM(Uniform1i), + SYM(Uniform2i), + SYM(Uniform3i), + SYM(Uniform4i), + SYM(Uniform1fv), + SYM(Uniform2fv), + SYM(Uniform3fv), + SYM(Uniform4fv), + SYM(Uniform1iv), + SYM(Uniform2iv), + SYM(Uniform3iv), + SYM(Uniform4iv), + SYM(UniformMatrix2fv), + SYM(UniformMatrix3fv), + SYM(UniformMatrix4fv), + SYM(ValidateProgram), + SYM(VertexAttrib1d), + SYM(VertexAttrib1dv), + SYM(VertexAttrib1f), + SYM(VertexAttrib1fv), + SYM(VertexAttrib1s), + SYM(VertexAttrib1sv), + SYM(VertexAttrib2d), + SYM(VertexAttrib2dv), + SYM(VertexAttrib2f), + SYM(VertexAttrib2fv), + SYM(VertexAttrib2s), + SYM(VertexAttrib2sv), + SYM(VertexAttrib3d), + SYM(VertexAttrib3dv), + SYM(VertexAttrib3f), + SYM(VertexAttrib3fv), + SYM(VertexAttrib3s), + SYM(VertexAttrib3sv), + SYM(VertexAttrib4Nbv), + SYM(VertexAttrib4Niv), + SYM(VertexAttrib4Nsv), + SYM(VertexAttrib4Nub), + SYM(VertexAttrib4Nubv), + SYM(VertexAttrib4Nuiv), + SYM(VertexAttrib4Nusv), + SYM(VertexAttrib4bv), + SYM(VertexAttrib4d), + SYM(VertexAttrib4dv), + SYM(VertexAttrib4f), + SYM(VertexAttrib4fv), + SYM(VertexAttrib4iv), + SYM(VertexAttrib4s), + SYM(VertexAttrib4sv), + SYM(VertexAttrib4ubv), + SYM(VertexAttrib4uiv), + SYM(VertexAttrib4usv), + SYM(VertexAttribPointer), + SYM(UniformMatrix2x3fv), + SYM(UniformMatrix3x2fv), + SYM(UniformMatrix2x4fv), + SYM(UniformMatrix4x2fv), + SYM(UniformMatrix3x4fv), + SYM(UniformMatrix4x3fv), + SYM(ColorMaski), + SYM(GetBooleani_v), + SYM(GetIntegeri_v), + SYM(Enablei), + SYM(Disablei), + SYM(IsEnabledi), + SYM(BeginTransformFeedback), + SYM(EndTransformFeedback), + SYM(BindBufferRange), + SYM(BindBufferBase), + SYM(TransformFeedbackVaryings), + SYM(GetTransformFeedbackVarying), + SYM(ClampColor), + SYM(BeginConditionalRender), + SYM(EndConditionalRender), + SYM(VertexAttribIPointer), + SYM(GetVertexAttribIiv), + SYM(GetVertexAttribIuiv), + SYM(VertexAttribI1i), + SYM(VertexAttribI2i), + SYM(VertexAttribI3i), + SYM(VertexAttribI4i), + SYM(VertexAttribI1ui), + SYM(VertexAttribI2ui), + SYM(VertexAttribI3ui), + SYM(VertexAttribI4ui), + SYM(VertexAttribI1iv), + SYM(VertexAttribI2iv), + SYM(VertexAttribI3iv), + SYM(VertexAttribI4iv), + SYM(VertexAttribI1uiv), + SYM(VertexAttribI2uiv), + SYM(VertexAttribI3uiv), + SYM(VertexAttribI4uiv), + SYM(VertexAttribI4bv), + SYM(VertexAttribI4sv), + SYM(VertexAttribI4ubv), + SYM(VertexAttribI4usv), + SYM(GetUniformuiv), + SYM(BindFragDataLocation), + SYM(GetFragDataLocation), + SYM(Uniform1ui), + SYM(Uniform2ui), + SYM(Uniform3ui), + SYM(Uniform4ui), + SYM(Uniform1uiv), + SYM(Uniform2uiv), + SYM(Uniform3uiv), + SYM(Uniform4uiv), + SYM(TexParameterIiv), + SYM(TexParameterIuiv), + SYM(GetTexParameterIiv), + SYM(GetTexParameterIuiv), + SYM(ClearBufferiv), + SYM(ClearBufferuiv), + SYM(ClearBufferfv), + SYM(ClearBufferfi), + SYM(GetStringi), + SYM(IsRenderbuffer), + SYM(BindRenderbuffer), + SYM(DeleteRenderbuffers), + SYM(GenRenderbuffers), + SYM(RenderbufferStorage), + SYM(GetRenderbufferParameteriv), + SYM(IsFramebuffer), + SYM(BindFramebuffer), + SYM(DeleteFramebuffers), + SYM(GenFramebuffers), + SYM(CheckFramebufferStatus), + SYM(FramebufferTexture1D), + SYM(FramebufferTexture2D), + SYM(FramebufferTexture3D), + SYM(FramebufferRenderbuffer), + SYM(GetFramebufferAttachmentParameteriv), + SYM(GenerateMipmap), + SYM(BlitFramebuffer), + SYM(RenderbufferStorageMultisample), + SYM(FramebufferTextureLayer), + SYM(MapBufferRange), + SYM(FlushMappedBufferRange), + SYM(BindVertexArray), + SYM(DeleteVertexArrays), + SYM(GenVertexArrays), + SYM(IsVertexArray), + SYM(DrawArraysInstanced), + SYM(DrawElementsInstanced), + SYM(TexBuffer), + SYM(PrimitiveRestartIndex), + SYM(CopyBufferSubData), + SYM(GetUniformIndices), + SYM(GetActiveUniformsiv), + SYM(GetActiveUniformName), + SYM(GetUniformBlockIndex), + SYM(GetActiveUniformBlockiv), + SYM(GetActiveUniformBlockName), + SYM(UniformBlockBinding), + SYM(DrawElementsBaseVertex), + SYM(DrawRangeElementsBaseVertex), + SYM(DrawElementsInstancedBaseVertex), + SYM(MultiDrawElementsBaseVertex), + SYM(ProvokingVertex), + SYM(FenceSync), + SYM(IsSync), + SYM(DeleteSync), + SYM(ClientWaitSync), + SYM(WaitSync), + SYM(GetInteger64v), + SYM(GetSynciv), + SYM(GetInteger64i_v), + SYM(GetBufferParameteri64v), + SYM(FramebufferTexture), + SYM(TexImage2DMultisample), + SYM(TexImage3DMultisample), + SYM(GetMultisamplefv), + SYM(SampleMaski), + SYM(BindFragDataLocationIndexed), + SYM(GetFragDataIndex), + SYM(GenSamplers), + SYM(DeleteSamplers), + SYM(IsSampler), + SYM(BindSampler), + SYM(SamplerParameteri), + SYM(SamplerParameteriv), + SYM(SamplerParameterf), + SYM(SamplerParameterfv), + SYM(SamplerParameterIiv), + SYM(SamplerParameterIuiv), + SYM(GetSamplerParameteriv), + SYM(GetSamplerParameterIiv), + SYM(GetSamplerParameterfv), + SYM(GetSamplerParameterIuiv), + SYM(QueryCounter), + SYM(GetQueryObjecti64v), + SYM(GetQueryObjectui64v), + SYM(VertexAttribDivisor), + SYM(VertexAttribP1ui), + SYM(VertexAttribP1uiv), + SYM(VertexAttribP2ui), + SYM(VertexAttribP2uiv), + SYM(VertexAttribP3ui), + SYM(VertexAttribP3uiv), + SYM(VertexAttribP4ui), + SYM(VertexAttribP4uiv), + SYM(VertexP2ui), + SYM(VertexP2uiv), + SYM(VertexP3ui), + SYM(VertexP3uiv), + SYM(VertexP4ui), + SYM(VertexP4uiv), + SYM(TexCoordP1ui), + SYM(TexCoordP1uiv), + SYM(TexCoordP2ui), + SYM(TexCoordP2uiv), + SYM(TexCoordP3ui), + SYM(TexCoordP3uiv), + SYM(TexCoordP4ui), + SYM(TexCoordP4uiv), + SYM(MultiTexCoordP1ui), + SYM(MultiTexCoordP1uiv), + SYM(MultiTexCoordP2ui), + SYM(MultiTexCoordP2uiv), + SYM(MultiTexCoordP3ui), + SYM(MultiTexCoordP3uiv), + SYM(MultiTexCoordP4ui), + SYM(MultiTexCoordP4uiv), + SYM(NormalP3ui), + SYM(NormalP3uiv), + SYM(ColorP3ui), + SYM(ColorP3uiv), + SYM(ColorP4ui), + SYM(ColorP4uiv), + SYM(SecondaryColorP3ui), + SYM(SecondaryColorP3uiv), + SYM(MinSampleShading), + SYM(BlendEquationi), + SYM(BlendEquationSeparatei), + SYM(BlendFunci), + SYM(BlendFuncSeparatei), + SYM(DrawArraysIndirect), + SYM(DrawElementsIndirect), + SYM(Uniform1d), + SYM(Uniform2d), + SYM(Uniform3d), + SYM(Uniform4d), + SYM(Uniform1dv), + SYM(Uniform2dv), + SYM(Uniform3dv), + SYM(Uniform4dv), + SYM(UniformMatrix2dv), + SYM(UniformMatrix3dv), + SYM(UniformMatrix4dv), + SYM(UniformMatrix2x3dv), + SYM(UniformMatrix2x4dv), + SYM(UniformMatrix3x2dv), + SYM(UniformMatrix3x4dv), + SYM(UniformMatrix4x2dv), + SYM(UniformMatrix4x3dv), + SYM(GetUniformdv), + SYM(GetSubroutineUniformLocation), + SYM(GetSubroutineIndex), + SYM(GetActiveSubroutineUniformiv), + SYM(GetActiveSubroutineUniformName), + SYM(GetActiveSubroutineName), + SYM(UniformSubroutinesuiv), + SYM(GetUniformSubroutineuiv), + SYM(GetProgramStageiv), + SYM(PatchParameteri), + SYM(PatchParameterfv), + SYM(BindTransformFeedback), + SYM(DeleteTransformFeedbacks), + SYM(GenTransformFeedbacks), + SYM(IsTransformFeedback), + SYM(PauseTransformFeedback), + SYM(ResumeTransformFeedback), + SYM(DrawTransformFeedback), + SYM(DrawTransformFeedbackStream), + SYM(BeginQueryIndexed), + SYM(EndQueryIndexed), + SYM(GetQueryIndexediv), + SYM(ReleaseShaderCompiler), + SYM(ShaderBinary), + SYM(GetShaderPrecisionFormat), + SYM(DepthRangef), + SYM(ClearDepthf), + SYM(GetProgramBinary), + SYM(ProgramBinary), + SYM(ProgramParameteri), + SYM(UseProgramStages), + SYM(ActiveShaderProgram), + SYM(CreateShaderProgramv), + SYM(BindProgramPipeline), + SYM(DeleteProgramPipelines), + SYM(GenProgramPipelines), + SYM(IsProgramPipeline), + SYM(GetProgramPipelineiv), + SYM(ProgramUniform1i), + SYM(ProgramUniform1iv), + SYM(ProgramUniform1f), + SYM(ProgramUniform1fv), + SYM(ProgramUniform1d), + SYM(ProgramUniform1dv), + SYM(ProgramUniform1ui), + SYM(ProgramUniform1uiv), + SYM(ProgramUniform2i), + SYM(ProgramUniform2iv), + SYM(ProgramUniform2f), + SYM(ProgramUniform2fv), + SYM(ProgramUniform2d), + SYM(ProgramUniform2dv), + SYM(ProgramUniform2ui), + SYM(ProgramUniform2uiv), + SYM(ProgramUniform3i), + SYM(ProgramUniform3iv), + SYM(ProgramUniform3f), + SYM(ProgramUniform3fv), + SYM(ProgramUniform3d), + SYM(ProgramUniform3dv), + SYM(ProgramUniform3ui), + SYM(ProgramUniform3uiv), + SYM(ProgramUniform4i), + SYM(ProgramUniform4iv), + SYM(ProgramUniform4f), + SYM(ProgramUniform4fv), + SYM(ProgramUniform4d), + SYM(ProgramUniform4dv), + SYM(ProgramUniform4ui), + SYM(ProgramUniform4uiv), + SYM(ProgramUniformMatrix2fv), + SYM(ProgramUniformMatrix3fv), + SYM(ProgramUniformMatrix4fv), + SYM(ProgramUniformMatrix2dv), + SYM(ProgramUniformMatrix3dv), + SYM(ProgramUniformMatrix4dv), + SYM(ProgramUniformMatrix2x3fv), + SYM(ProgramUniformMatrix3x2fv), + SYM(ProgramUniformMatrix2x4fv), + SYM(ProgramUniformMatrix4x2fv), + SYM(ProgramUniformMatrix3x4fv), + SYM(ProgramUniformMatrix4x3fv), + SYM(ProgramUniformMatrix2x3dv), + SYM(ProgramUniformMatrix3x2dv), + SYM(ProgramUniformMatrix2x4dv), + SYM(ProgramUniformMatrix4x2dv), + SYM(ProgramUniformMatrix3x4dv), + SYM(ProgramUniformMatrix4x3dv), + SYM(ValidateProgramPipeline), + SYM(GetProgramPipelineInfoLog), + SYM(VertexAttribL1d), + SYM(VertexAttribL2d), + SYM(VertexAttribL3d), + SYM(VertexAttribL4d), + SYM(VertexAttribL1dv), + SYM(VertexAttribL2dv), + SYM(VertexAttribL3dv), + SYM(VertexAttribL4dv), + SYM(VertexAttribLPointer), + SYM(GetVertexAttribLdv), + SYM(ViewportArrayv), + SYM(ViewportIndexedf), + SYM(ViewportIndexedfv), + SYM(ScissorArrayv), + SYM(ScissorIndexed), + SYM(ScissorIndexedv), + SYM(DepthRangeArrayv), + SYM(DepthRangeIndexed), + SYM(GetFloati_v), + SYM(GetDoublei_v), + SYM(DrawArraysInstancedBaseInstance), + SYM(DrawElementsInstancedBaseInstance), + SYM(DrawElementsInstancedBaseVertexBaseInstance), + SYM(GetInternalformativ), + SYM(GetActiveAtomicCounterBufferiv), + SYM(BindImageTexture), + SYM(MemoryBarrier), + SYM(TexStorage1D), + SYM(TexStorage2D), + SYM(TexStorage3D), + SYM(DrawTransformFeedbackInstanced), + SYM(DrawTransformFeedbackStreamInstanced), + SYM(ClearBufferData), + SYM(ClearBufferSubData), + SYM(DispatchCompute), + SYM(DispatchComputeIndirect), + SYM(CopyImageSubData), + SYM(FramebufferParameteri), + SYM(GetFramebufferParameteriv), + SYM(GetInternalformati64v), + SYM(InvalidateTexSubImage), + SYM(InvalidateTexImage), + SYM(InvalidateBufferSubData), + SYM(InvalidateBufferData), + SYM(InvalidateFramebuffer), + SYM(InvalidateSubFramebuffer), + SYM(MultiDrawArraysIndirect), + SYM(MultiDrawElementsIndirect), + SYM(GetProgramInterfaceiv), + SYM(GetProgramResourceIndex), + SYM(GetProgramResourceName), + SYM(GetProgramResourceiv), + SYM(GetProgramResourceLocation), + SYM(GetProgramResourceLocationIndex), + SYM(ShaderStorageBlockBinding), + SYM(TexBufferRange), + SYM(TexStorage2DMultisample), + SYM(TexStorage3DMultisample), + SYM(TextureView), + SYM(BindVertexBuffer), + SYM(VertexAttribFormat), + SYM(VertexAttribIFormat), + SYM(VertexAttribLFormat), + SYM(VertexAttribBinding), + SYM(VertexBindingDivisor), + SYM(DebugMessageControl), + SYM(DebugMessageInsert), + SYM(DebugMessageCallback), + SYM(GetDebugMessageLog), + SYM(PushDebugGroup), + SYM(PopDebugGroup), + SYM(ObjectLabel), + SYM(GetObjectLabel), + SYM(ObjectPtrLabel), + SYM(GetObjectPtrLabel), + SYM(BufferStorage), + SYM(ClearTexImage), + SYM(ClearTexSubImage), + SYM(BindBuffersBase), + SYM(BindBuffersRange), + SYM(BindTextures), + SYM(BindSamplers), + SYM(BindImageTextures), + SYM(BindVertexBuffers), + SYM(GetTextureHandleARB), + SYM(GetTextureSamplerHandleARB), + SYM(MakeTextureHandleResidentARB), + SYM(MakeTextureHandleNonResidentARB), + SYM(GetImageHandleARB), + SYM(MakeImageHandleResidentARB), + SYM(MakeImageHandleNonResidentARB), + SYM(UniformHandleui64ARB), + SYM(UniformHandleui64vARB), + SYM(ProgramUniformHandleui64ARB), + SYM(ProgramUniformHandleui64vARB), + SYM(IsTextureHandleResidentARB), + SYM(IsImageHandleResidentARB), + SYM(VertexAttribL1ui64ARB), + SYM(VertexAttribL1ui64vARB), + SYM(GetVertexAttribLui64vARB), + SYM(CreateSyncFromCLeventARB), + SYM(ClampColorARB), + SYM(DispatchComputeGroupSizeARB), + SYM(DebugMessageControlARB), + SYM(DebugMessageInsertARB), + SYM(DebugMessageCallbackARB), + SYM(GetDebugMessageLogARB), + SYM(DrawBuffersARB), + SYM(BlendEquationiARB), + SYM(BlendEquationSeparateiARB), + SYM(BlendFunciARB), + SYM(BlendFuncSeparateiARB), + SYM(DrawArraysInstancedARB), + SYM(DrawElementsInstancedARB), + SYM(ProgramStringARB), + SYM(BindProgramARB), + SYM(DeleteProgramsARB), + SYM(GenProgramsARB), + SYM(ProgramEnvParameter4dARB), + SYM(ProgramEnvParameter4dvARB), + SYM(ProgramEnvParameter4fARB), + SYM(ProgramEnvParameter4fvARB), + SYM(ProgramLocalParameter4dARB), + SYM(ProgramLocalParameter4dvARB), + SYM(ProgramLocalParameter4fARB), + SYM(ProgramLocalParameter4fvARB), + SYM(GetProgramEnvParameterdvARB), + SYM(GetProgramEnvParameterfvARB), + SYM(GetProgramLocalParameterdvARB), + SYM(GetProgramLocalParameterfvARB), + SYM(GetProgramivARB), + SYM(GetProgramStringARB), + SYM(IsProgramARB), + SYM(ProgramParameteriARB), + SYM(FramebufferTextureARB), + SYM(FramebufferTextureLayerARB), + SYM(FramebufferTextureFaceARB), + SYM(ColorTable), + SYM(ColorTableParameterfv), + SYM(ColorTableParameteriv), + SYM(CopyColorTable), + SYM(GetColorTable), + SYM(GetColorTableParameterfv), + SYM(GetColorTableParameteriv), + SYM(ColorSubTable), + SYM(CopyColorSubTable), + SYM(ConvolutionFilter1D), + SYM(ConvolutionFilter2D), + SYM(ConvolutionParameterf), + SYM(ConvolutionParameterfv), + SYM(ConvolutionParameteri), + SYM(ConvolutionParameteriv), + SYM(CopyConvolutionFilter1D), + SYM(CopyConvolutionFilter2D), + SYM(GetConvolutionFilter), + SYM(GetConvolutionParameterfv), + SYM(GetConvolutionParameteriv), + SYM(GetSeparableFilter), + SYM(SeparableFilter2D), + SYM(GetHistogram), + SYM(GetHistogramParameterfv), + SYM(GetHistogramParameteriv), + SYM(GetMinmax), + SYM(GetMinmaxParameterfv), + SYM(GetMinmaxParameteriv), + SYM(Histogram), + SYM(Minmax), + SYM(ResetHistogram), + SYM(ResetMinmax), + SYM(MultiDrawArraysIndirectCountARB), + SYM(MultiDrawElementsIndirectCountARB), + SYM(VertexAttribDivisorARB), + SYM(CurrentPaletteMatrixARB), + SYM(MatrixIndexubvARB), + SYM(MatrixIndexusvARB), + SYM(MatrixIndexuivARB), + SYM(MatrixIndexPointerARB), + SYM(SampleCoverageARB), + SYM(ActiveTextureARB), + SYM(ClientActiveTextureARB), + SYM(MultiTexCoord1dARB), + SYM(MultiTexCoord1dvARB), + SYM(MultiTexCoord1fARB), + SYM(MultiTexCoord1fvARB), + SYM(MultiTexCoord1iARB), + SYM(MultiTexCoord1ivARB), + SYM(MultiTexCoord1sARB), + SYM(MultiTexCoord1svARB), + SYM(MultiTexCoord2dARB), + SYM(MultiTexCoord2dvARB), + SYM(MultiTexCoord2fARB), + SYM(MultiTexCoord2fvARB), + SYM(MultiTexCoord2iARB), + SYM(MultiTexCoord2ivARB), + SYM(MultiTexCoord2sARB), + SYM(MultiTexCoord2svARB), + SYM(MultiTexCoord3dARB), + SYM(MultiTexCoord3dvARB), + SYM(MultiTexCoord3fARB), + SYM(MultiTexCoord3fvARB), + SYM(MultiTexCoord3iARB), + SYM(MultiTexCoord3ivARB), + SYM(MultiTexCoord3sARB), + SYM(MultiTexCoord3svARB), + SYM(MultiTexCoord4dARB), + SYM(MultiTexCoord4dvARB), + SYM(MultiTexCoord4fARB), + SYM(MultiTexCoord4fvARB), + SYM(MultiTexCoord4iARB), + SYM(MultiTexCoord4ivARB), + SYM(MultiTexCoord4sARB), + SYM(MultiTexCoord4svARB), + SYM(GenQueriesARB), + SYM(DeleteQueriesARB), + SYM(IsQueryARB), + SYM(BeginQueryARB), + SYM(EndQueryARB), + SYM(GetQueryivARB), + SYM(GetQueryObjectivARB), + SYM(GetQueryObjectuivARB), + SYM(PointParameterfARB), + SYM(PointParameterfvARB), + SYM(GetGraphicsResetStatusARB), + SYM(GetnTexImageARB), + SYM(ReadnPixelsARB), + SYM(GetnCompressedTexImageARB), + SYM(GetnUniformfvARB), + SYM(GetnUniformivARB), + SYM(GetnUniformuivARB), + SYM(GetnUniformdvARB), + SYM(GetnMapdvARB), + SYM(GetnMapfvARB), + SYM(GetnMapivARB), + SYM(GetnPixelMapfvARB), + SYM(GetnPixelMapuivARB), + SYM(GetnPixelMapusvARB), + SYM(GetnPolygonStippleARB), + SYM(GetnColorTableARB), + SYM(GetnConvolutionFilterARB), + SYM(GetnSeparableFilterARB), + SYM(GetnHistogramARB), + SYM(GetnMinmaxARB), + SYM(MinSampleShadingARB), + SYM(DeleteObjectARB), + SYM(GetHandleARB), + SYM(DetachObjectARB), + SYM(CreateShaderObjectARB), + SYM(ShaderSourceARB), + SYM(CompileShaderARB), + SYM(CreateProgramObjectARB), + SYM(AttachObjectARB), + SYM(LinkProgramARB), + SYM(UseProgramObjectARB), + SYM(ValidateProgramARB), + SYM(Uniform1fARB), + SYM(Uniform2fARB), + SYM(Uniform3fARB), + SYM(Uniform4fARB), + SYM(Uniform1iARB), + SYM(Uniform2iARB), + SYM(Uniform3iARB), + SYM(Uniform4iARB), + SYM(Uniform1fvARB), + SYM(Uniform2fvARB), + SYM(Uniform3fvARB), + SYM(Uniform4fvARB), + SYM(Uniform1ivARB), + SYM(Uniform2ivARB), + SYM(Uniform3ivARB), + SYM(Uniform4ivARB), + SYM(UniformMatrix2fvARB), + SYM(UniformMatrix3fvARB), + SYM(UniformMatrix4fvARB), + SYM(GetObjectParameterfvARB), + SYM(GetObjectParameterivARB), + SYM(GetInfoLogARB), + SYM(GetAttachedObjectsARB), + SYM(GetUniformLocationARB), + SYM(GetActiveUniformARB), + SYM(GetUniformfvARB), + SYM(GetUniformivARB), + SYM(GetShaderSourceARB), + SYM(NamedStringARB), + SYM(DeleteNamedStringARB), + SYM(CompileShaderIncludeARB), + SYM(IsNamedStringARB), + SYM(GetNamedStringARB), + SYM(GetNamedStringivARB), + SYM(TexPageCommitmentARB), + SYM(TexBufferARB), + SYM(CompressedTexImage3DARB), + SYM(CompressedTexImage2DARB), + SYM(CompressedTexImage1DARB), + SYM(CompressedTexSubImage3DARB), + SYM(CompressedTexSubImage2DARB), + SYM(CompressedTexSubImage1DARB), + SYM(GetCompressedTexImageARB), + SYM(LoadTransposeMatrixfARB), + SYM(LoadTransposeMatrixdARB), + SYM(MultTransposeMatrixfARB), + SYM(MultTransposeMatrixdARB), + SYM(WeightbvARB), + SYM(WeightsvARB), + SYM(WeightivARB), + SYM(WeightfvARB), + SYM(WeightdvARB), + SYM(WeightubvARB), + SYM(WeightusvARB), + SYM(WeightuivARB), + SYM(WeightPointerARB), + SYM(VertexBlendARB), + SYM(BindBufferARB), + SYM(DeleteBuffersARB), + SYM(GenBuffersARB), + SYM(IsBufferARB), + SYM(BufferDataARB), + SYM(BufferSubDataARB), + SYM(GetBufferSubDataARB), + SYM(MapBufferARB), + SYM(UnmapBufferARB), + SYM(GetBufferParameterivARB), + SYM(GetBufferPointervARB), + SYM(VertexAttrib1dARB), + SYM(VertexAttrib1dvARB), + SYM(VertexAttrib1fARB), + SYM(VertexAttrib1fvARB), + SYM(VertexAttrib1sARB), + SYM(VertexAttrib1svARB), + SYM(VertexAttrib2dARB), + SYM(VertexAttrib2dvARB), + SYM(VertexAttrib2fARB), + SYM(VertexAttrib2fvARB), + SYM(VertexAttrib2sARB), + SYM(VertexAttrib2svARB), + SYM(VertexAttrib3dARB), + SYM(VertexAttrib3dvARB), + SYM(VertexAttrib3fARB), + SYM(VertexAttrib3fvARB), + SYM(VertexAttrib3sARB), + SYM(VertexAttrib3svARB), + SYM(VertexAttrib4NbvARB), + SYM(VertexAttrib4NivARB), + SYM(VertexAttrib4NsvARB), + SYM(VertexAttrib4NubARB), + SYM(VertexAttrib4NubvARB), + SYM(VertexAttrib4NuivARB), + SYM(VertexAttrib4NusvARB), + SYM(VertexAttrib4bvARB), + SYM(VertexAttrib4dARB), + SYM(VertexAttrib4dvARB), + SYM(VertexAttrib4fARB), + SYM(VertexAttrib4fvARB), + SYM(VertexAttrib4ivARB), + SYM(VertexAttrib4sARB), + SYM(VertexAttrib4svARB), + SYM(VertexAttrib4ubvARB), + SYM(VertexAttrib4uivARB), + SYM(VertexAttrib4usvARB), + SYM(VertexAttribPointerARB), + SYM(EnableVertexAttribArrayARB), + SYM(DisableVertexAttribArrayARB), + SYM(GetVertexAttribdvARB), + SYM(GetVertexAttribfvARB), + SYM(GetVertexAttribivARB), + SYM(GetVertexAttribPointervARB), + SYM(BindAttribLocationARB), + SYM(GetActiveAttribARB), + SYM(GetAttribLocationARB), + SYM(WindowPos2dARB), + SYM(WindowPos2dvARB), + SYM(WindowPos2fARB), + SYM(WindowPos2fvARB), + SYM(WindowPos2iARB), + SYM(WindowPos2ivARB), + SYM(WindowPos2sARB), + SYM(WindowPos2svARB), + SYM(WindowPos3dARB), + SYM(WindowPos3dvARB), + SYM(WindowPos3fARB), + SYM(WindowPos3fvARB), + SYM(WindowPos3iARB), + SYM(WindowPos3ivARB), + SYM(WindowPos3sARB), + SYM(WindowPos3svARB), + SYM(MultiTexCoord1bOES), + SYM(MultiTexCoord1bvOES), + SYM(MultiTexCoord2bOES), + SYM(MultiTexCoord2bvOES), + SYM(MultiTexCoord3bOES), + SYM(MultiTexCoord3bvOES), + SYM(MultiTexCoord4bOES), + SYM(MultiTexCoord4bvOES), + SYM(TexCoord1bOES), + SYM(TexCoord1bvOES), + SYM(TexCoord2bOES), + SYM(TexCoord2bvOES), + SYM(TexCoord3bOES), + SYM(TexCoord3bvOES), + SYM(TexCoord4bOES), + SYM(TexCoord4bvOES), + SYM(Vertex2bOES), + SYM(Vertex2bvOES), + SYM(Vertex3bOES), + SYM(Vertex3bvOES), + SYM(Vertex4bOES), + SYM(Vertex4bvOES), + SYM(AlphaFuncxOES), + SYM(ClearColorxOES), + SYM(ClearDepthxOES), + SYM(ClipPlanexOES), + SYM(Color4xOES), + SYM(DepthRangexOES), + SYM(FogxOES), + SYM(FogxvOES), + SYM(FrustumxOES), + SYM(GetClipPlanexOES), + SYM(GetFixedvOES), + SYM(GetTexEnvxvOES), + SYM(GetTexParameterxvOES), + SYM(LightModelxOES), + SYM(LightModelxvOES), + SYM(LightxOES), + SYM(LightxvOES), + SYM(LineWidthxOES), + SYM(LoadMatrixxOES), + SYM(MaterialxOES), + SYM(MaterialxvOES), + SYM(MultMatrixxOES), + SYM(MultiTexCoord4xOES), + SYM(Normal3xOES), + SYM(OrthoxOES), + SYM(PointParameterxvOES), + SYM(PointSizexOES), + SYM(PolygonOffsetxOES), + SYM(RotatexOES), + SYM(SampleCoverageOES), + SYM(ScalexOES), + SYM(TexEnvxOES), + SYM(TexEnvxvOES), + SYM(TexParameterxOES), + SYM(TexParameterxvOES), + SYM(TranslatexOES), + SYM(AccumxOES), + SYM(BitmapxOES), + SYM(BlendColorxOES), + SYM(ClearAccumxOES), + SYM(Color3xOES), + SYM(Color3xvOES), + SYM(Color4xvOES), + SYM(ConvolutionParameterxOES), + SYM(ConvolutionParameterxvOES), + SYM(EvalCoord1xOES), + SYM(EvalCoord1xvOES), + SYM(EvalCoord2xOES), + SYM(EvalCoord2xvOES), + SYM(FeedbackBufferxOES), + SYM(GetConvolutionParameterxvOES), + SYM(GetHistogramParameterxvOES), + SYM(GetLightxOES), + SYM(GetMapxvOES), + SYM(GetMaterialxOES), + SYM(GetPixelMapxv), + SYM(GetTexGenxvOES), + SYM(GetTexLevelParameterxvOES), + SYM(IndexxOES), + SYM(IndexxvOES), + SYM(LoadTransposeMatrixxOES), + SYM(Map1xOES), + SYM(Map2xOES), + SYM(MapGrid1xOES), + SYM(MapGrid2xOES), + SYM(MultTransposeMatrixxOES), + SYM(MultiTexCoord1xOES), + SYM(MultiTexCoord1xvOES), + SYM(MultiTexCoord2xOES), + SYM(MultiTexCoord2xvOES), + SYM(MultiTexCoord3xOES), + SYM(MultiTexCoord3xvOES), + SYM(MultiTexCoord4xvOES), + SYM(Normal3xvOES), + SYM(PassThroughxOES), + SYM(PixelMapx), + SYM(PixelStorex), + SYM(PixelTransferxOES), + SYM(PixelZoomxOES), + SYM(PrioritizeTexturesxOES), + SYM(RasterPos2xOES), + SYM(RasterPos2xvOES), + SYM(RasterPos3xOES), + SYM(RasterPos3xvOES), + SYM(RasterPos4xOES), + SYM(RasterPos4xvOES), + SYM(RectxOES), + SYM(RectxvOES), + SYM(TexCoord1xOES), + SYM(TexCoord1xvOES), + SYM(TexCoord2xOES), + SYM(TexCoord2xvOES), + SYM(TexCoord3xOES), + SYM(TexCoord3xvOES), + SYM(TexCoord4xOES), + SYM(TexCoord4xvOES), + SYM(TexGenxOES), + SYM(TexGenxvOES), + SYM(Vertex2xOES), + SYM(Vertex2xvOES), + SYM(Vertex3xOES), + SYM(Vertex3xvOES), + SYM(Vertex4xOES), + SYM(Vertex4xvOES), + SYM(QueryMatrixxOES), + SYM(ClearDepthfOES), + SYM(ClipPlanefOES), + SYM(DepthRangefOES), + SYM(FrustumfOES), + SYM(GetClipPlanefOES), + SYM(OrthofOES), + SYM(ImageTransformParameteriHP), + SYM(ImageTransformParameterfHP), + SYM(ImageTransformParameterivHP), + SYM(ImageTransformParameterfvHP), + SYM(GetImageTransformParameterivHP), + SYM(GetImageTransformParameterfvHP), + + { NULL, NULL }, +}; +RGLSYMGLDRAWRANGEELEMENTSPROC __rglgen_glDrawRangeElements; +RGLSYMGLTEXIMAGE3DPROC __rglgen_glTexImage3D; +RGLSYMGLTEXSUBIMAGE3DPROC __rglgen_glTexSubImage3D; +RGLSYMGLCOPYTEXSUBIMAGE3DPROC __rglgen_glCopyTexSubImage3D; +RGLSYMGLACTIVETEXTUREPROC __rglgen_glActiveTexture; +RGLSYMGLSAMPLECOVERAGEPROC __rglgen_glSampleCoverage; +RGLSYMGLCOMPRESSEDTEXIMAGE3DPROC __rglgen_glCompressedTexImage3D; +RGLSYMGLCOMPRESSEDTEXIMAGE2DPROC __rglgen_glCompressedTexImage2D; +RGLSYMGLCOMPRESSEDTEXIMAGE1DPROC __rglgen_glCompressedTexImage1D; +RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DPROC __rglgen_glCompressedTexSubImage3D; +RGLSYMGLCOMPRESSEDTEXSUBIMAGE2DPROC __rglgen_glCompressedTexSubImage2D; +RGLSYMGLCOMPRESSEDTEXSUBIMAGE1DPROC __rglgen_glCompressedTexSubImage1D; +RGLSYMGLGETCOMPRESSEDTEXIMAGEPROC __rglgen_glGetCompressedTexImage; +RGLSYMGLCLIENTACTIVETEXTUREPROC __rglgen_glClientActiveTexture; +RGLSYMGLMULTITEXCOORD1DPROC __rglgen_glMultiTexCoord1d; +RGLSYMGLMULTITEXCOORD1DVPROC __rglgen_glMultiTexCoord1dv; +RGLSYMGLMULTITEXCOORD1FPROC __rglgen_glMultiTexCoord1f; +RGLSYMGLMULTITEXCOORD1FVPROC __rglgen_glMultiTexCoord1fv; +RGLSYMGLMULTITEXCOORD1IPROC __rglgen_glMultiTexCoord1i; +RGLSYMGLMULTITEXCOORD1IVPROC __rglgen_glMultiTexCoord1iv; +RGLSYMGLMULTITEXCOORD1SPROC __rglgen_glMultiTexCoord1s; +RGLSYMGLMULTITEXCOORD1SVPROC __rglgen_glMultiTexCoord1sv; +RGLSYMGLMULTITEXCOORD2DPROC __rglgen_glMultiTexCoord2d; +RGLSYMGLMULTITEXCOORD2DVPROC __rglgen_glMultiTexCoord2dv; +RGLSYMGLMULTITEXCOORD2FPROC __rglgen_glMultiTexCoord2f; +RGLSYMGLMULTITEXCOORD2FVPROC __rglgen_glMultiTexCoord2fv; +RGLSYMGLMULTITEXCOORD2IPROC __rglgen_glMultiTexCoord2i; +RGLSYMGLMULTITEXCOORD2IVPROC __rglgen_glMultiTexCoord2iv; +RGLSYMGLMULTITEXCOORD2SPROC __rglgen_glMultiTexCoord2s; +RGLSYMGLMULTITEXCOORD2SVPROC __rglgen_glMultiTexCoord2sv; +RGLSYMGLMULTITEXCOORD3DPROC __rglgen_glMultiTexCoord3d; +RGLSYMGLMULTITEXCOORD3DVPROC __rglgen_glMultiTexCoord3dv; +RGLSYMGLMULTITEXCOORD3FPROC __rglgen_glMultiTexCoord3f; +RGLSYMGLMULTITEXCOORD3FVPROC __rglgen_glMultiTexCoord3fv; +RGLSYMGLMULTITEXCOORD3IPROC __rglgen_glMultiTexCoord3i; +RGLSYMGLMULTITEXCOORD3IVPROC __rglgen_glMultiTexCoord3iv; +RGLSYMGLMULTITEXCOORD3SPROC __rglgen_glMultiTexCoord3s; +RGLSYMGLMULTITEXCOORD3SVPROC __rglgen_glMultiTexCoord3sv; +RGLSYMGLMULTITEXCOORD4DPROC __rglgen_glMultiTexCoord4d; +RGLSYMGLMULTITEXCOORD4DVPROC __rglgen_glMultiTexCoord4dv; +RGLSYMGLMULTITEXCOORD4FPROC __rglgen_glMultiTexCoord4f; +RGLSYMGLMULTITEXCOORD4FVPROC __rglgen_glMultiTexCoord4fv; +RGLSYMGLMULTITEXCOORD4IPROC __rglgen_glMultiTexCoord4i; +RGLSYMGLMULTITEXCOORD4IVPROC __rglgen_glMultiTexCoord4iv; +RGLSYMGLMULTITEXCOORD4SPROC __rglgen_glMultiTexCoord4s; +RGLSYMGLMULTITEXCOORD4SVPROC __rglgen_glMultiTexCoord4sv; +RGLSYMGLLOADTRANSPOSEMATRIXFPROC __rglgen_glLoadTransposeMatrixf; +RGLSYMGLLOADTRANSPOSEMATRIXDPROC __rglgen_glLoadTransposeMatrixd; +RGLSYMGLMULTTRANSPOSEMATRIXFPROC __rglgen_glMultTransposeMatrixf; +RGLSYMGLMULTTRANSPOSEMATRIXDPROC __rglgen_glMultTransposeMatrixd; +RGLSYMGLBLENDFUNCSEPARATEPROC __rglgen_glBlendFuncSeparate; +RGLSYMGLMULTIDRAWARRAYSPROC __rglgen_glMultiDrawArrays; +RGLSYMGLMULTIDRAWELEMENTSPROC __rglgen_glMultiDrawElements; +RGLSYMGLPOINTPARAMETERFPROC __rglgen_glPointParameterf; +RGLSYMGLPOINTPARAMETERFVPROC __rglgen_glPointParameterfv; +RGLSYMGLPOINTPARAMETERIPROC __rglgen_glPointParameteri; +RGLSYMGLPOINTPARAMETERIVPROC __rglgen_glPointParameteriv; +RGLSYMGLFOGCOORDFPROC __rglgen_glFogCoordf; +RGLSYMGLFOGCOORDFVPROC __rglgen_glFogCoordfv; +RGLSYMGLFOGCOORDDPROC __rglgen_glFogCoordd; +RGLSYMGLFOGCOORDDVPROC __rglgen_glFogCoorddv; +RGLSYMGLFOGCOORDPOINTERPROC __rglgen_glFogCoordPointer; +RGLSYMGLSECONDARYCOLOR3BPROC __rglgen_glSecondaryColor3b; +RGLSYMGLSECONDARYCOLOR3BVPROC __rglgen_glSecondaryColor3bv; +RGLSYMGLSECONDARYCOLOR3DPROC __rglgen_glSecondaryColor3d; +RGLSYMGLSECONDARYCOLOR3DVPROC __rglgen_glSecondaryColor3dv; +RGLSYMGLSECONDARYCOLOR3FPROC __rglgen_glSecondaryColor3f; +RGLSYMGLSECONDARYCOLOR3FVPROC __rglgen_glSecondaryColor3fv; +RGLSYMGLSECONDARYCOLOR3IPROC __rglgen_glSecondaryColor3i; +RGLSYMGLSECONDARYCOLOR3IVPROC __rglgen_glSecondaryColor3iv; +RGLSYMGLSECONDARYCOLOR3SPROC __rglgen_glSecondaryColor3s; +RGLSYMGLSECONDARYCOLOR3SVPROC __rglgen_glSecondaryColor3sv; +RGLSYMGLSECONDARYCOLOR3UBPROC __rglgen_glSecondaryColor3ub; +RGLSYMGLSECONDARYCOLOR3UBVPROC __rglgen_glSecondaryColor3ubv; +RGLSYMGLSECONDARYCOLOR3UIPROC __rglgen_glSecondaryColor3ui; +RGLSYMGLSECONDARYCOLOR3UIVPROC __rglgen_glSecondaryColor3uiv; +RGLSYMGLSECONDARYCOLOR3USPROC __rglgen_glSecondaryColor3us; +RGLSYMGLSECONDARYCOLOR3USVPROC __rglgen_glSecondaryColor3usv; +RGLSYMGLSECONDARYCOLORPOINTERPROC __rglgen_glSecondaryColorPointer; +RGLSYMGLWINDOWPOS2DPROC __rglgen_glWindowPos2d; +RGLSYMGLWINDOWPOS2DVPROC __rglgen_glWindowPos2dv; +RGLSYMGLWINDOWPOS2FPROC __rglgen_glWindowPos2f; +RGLSYMGLWINDOWPOS2FVPROC __rglgen_glWindowPos2fv; +RGLSYMGLWINDOWPOS2IPROC __rglgen_glWindowPos2i; +RGLSYMGLWINDOWPOS2IVPROC __rglgen_glWindowPos2iv; +RGLSYMGLWINDOWPOS2SPROC __rglgen_glWindowPos2s; +RGLSYMGLWINDOWPOS2SVPROC __rglgen_glWindowPos2sv; +RGLSYMGLWINDOWPOS3DPROC __rglgen_glWindowPos3d; +RGLSYMGLWINDOWPOS3DVPROC __rglgen_glWindowPos3dv; +RGLSYMGLWINDOWPOS3FPROC __rglgen_glWindowPos3f; +RGLSYMGLWINDOWPOS3FVPROC __rglgen_glWindowPos3fv; +RGLSYMGLWINDOWPOS3IPROC __rglgen_glWindowPos3i; +RGLSYMGLWINDOWPOS3IVPROC __rglgen_glWindowPos3iv; +RGLSYMGLWINDOWPOS3SPROC __rglgen_glWindowPos3s; +RGLSYMGLWINDOWPOS3SVPROC __rglgen_glWindowPos3sv; +RGLSYMGLBLENDCOLORPROC __rglgen_glBlendColor; +RGLSYMGLBLENDEQUATIONPROC __rglgen_glBlendEquation; +RGLSYMGLGENQUERIESPROC __rglgen_glGenQueries; +RGLSYMGLDELETEQUERIESPROC __rglgen_glDeleteQueries; +RGLSYMGLISQUERYPROC __rglgen_glIsQuery; +RGLSYMGLBEGINQUERYPROC __rglgen_glBeginQuery; +RGLSYMGLENDQUERYPROC __rglgen_glEndQuery; +RGLSYMGLGETQUERYIVPROC __rglgen_glGetQueryiv; +RGLSYMGLGETQUERYOBJECTIVPROC __rglgen_glGetQueryObjectiv; +RGLSYMGLGETQUERYOBJECTUIVPROC __rglgen_glGetQueryObjectuiv; +RGLSYMGLBINDBUFFERPROC __rglgen_glBindBuffer; +RGLSYMGLDELETEBUFFERSPROC __rglgen_glDeleteBuffers; +RGLSYMGLGENBUFFERSPROC __rglgen_glGenBuffers; +RGLSYMGLISBUFFERPROC __rglgen_glIsBuffer; +RGLSYMGLBUFFERDATAPROC __rglgen_glBufferData; +RGLSYMGLBUFFERSUBDATAPROC __rglgen_glBufferSubData; +RGLSYMGLGETBUFFERSUBDATAPROC __rglgen_glGetBufferSubData; +RGLSYMGLMAPBUFFERPROC __rglgen_glMapBuffer; +RGLSYMGLUNMAPBUFFERPROC __rglgen_glUnmapBuffer; +RGLSYMGLGETBUFFERPARAMETERIVPROC __rglgen_glGetBufferParameteriv; +RGLSYMGLGETBUFFERPOINTERVPROC __rglgen_glGetBufferPointerv; +RGLSYMGLBLENDEQUATIONSEPARATEPROC __rglgen_glBlendEquationSeparate; +RGLSYMGLDRAWBUFFERSPROC __rglgen_glDrawBuffers; +RGLSYMGLSTENCILOPSEPARATEPROC __rglgen_glStencilOpSeparate; +RGLSYMGLSTENCILFUNCSEPARATEPROC __rglgen_glStencilFuncSeparate; +RGLSYMGLSTENCILMASKSEPARATEPROC __rglgen_glStencilMaskSeparate; +RGLSYMGLATTACHSHADERPROC __rglgen_glAttachShader; +RGLSYMGLBINDATTRIBLOCATIONPROC __rglgen_glBindAttribLocation; +RGLSYMGLCOMPILESHADERPROC __rglgen_glCompileShader; +RGLSYMGLCREATEPROGRAMPROC __rglgen_glCreateProgram; +RGLSYMGLCREATESHADERPROC __rglgen_glCreateShader; +RGLSYMGLDELETEPROGRAMPROC __rglgen_glDeleteProgram; +RGLSYMGLDELETESHADERPROC __rglgen_glDeleteShader; +RGLSYMGLDETACHSHADERPROC __rglgen_glDetachShader; +RGLSYMGLDISABLEVERTEXATTRIBARRAYPROC __rglgen_glDisableVertexAttribArray; +RGLSYMGLENABLEVERTEXATTRIBARRAYPROC __rglgen_glEnableVertexAttribArray; +RGLSYMGLGETACTIVEATTRIBPROC __rglgen_glGetActiveAttrib; +RGLSYMGLGETACTIVEUNIFORMPROC __rglgen_glGetActiveUniform; +RGLSYMGLGETATTACHEDSHADERSPROC __rglgen_glGetAttachedShaders; +RGLSYMGLGETATTRIBLOCATIONPROC __rglgen_glGetAttribLocation; +RGLSYMGLGETPROGRAMIVPROC __rglgen_glGetProgramiv; +RGLSYMGLGETPROGRAMINFOLOGPROC __rglgen_glGetProgramInfoLog; +RGLSYMGLGETSHADERIVPROC __rglgen_glGetShaderiv; +RGLSYMGLGETSHADERINFOLOGPROC __rglgen_glGetShaderInfoLog; +RGLSYMGLGETSHADERSOURCEPROC __rglgen_glGetShaderSource; +RGLSYMGLGETUNIFORMLOCATIONPROC __rglgen_glGetUniformLocation; +RGLSYMGLGETUNIFORMFVPROC __rglgen_glGetUniformfv; +RGLSYMGLGETUNIFORMIVPROC __rglgen_glGetUniformiv; +RGLSYMGLGETVERTEXATTRIBDVPROC __rglgen_glGetVertexAttribdv; +RGLSYMGLGETVERTEXATTRIBFVPROC __rglgen_glGetVertexAttribfv; +RGLSYMGLGETVERTEXATTRIBIVPROC __rglgen_glGetVertexAttribiv; +RGLSYMGLGETVERTEXATTRIBPOINTERVPROC __rglgen_glGetVertexAttribPointerv; +RGLSYMGLISPROGRAMPROC __rglgen_glIsProgram; +RGLSYMGLISSHADERPROC __rglgen_glIsShader; +RGLSYMGLLINKPROGRAMPROC __rglgen_glLinkProgram; +RGLSYMGLSHADERSOURCEPROC __rglgen_glShaderSource; +RGLSYMGLUSEPROGRAMPROC __rglgen_glUseProgram; +RGLSYMGLUNIFORM1FPROC __rglgen_glUniform1f; +RGLSYMGLUNIFORM2FPROC __rglgen_glUniform2f; +RGLSYMGLUNIFORM3FPROC __rglgen_glUniform3f; +RGLSYMGLUNIFORM4FPROC __rglgen_glUniform4f; +RGLSYMGLUNIFORM1IPROC __rglgen_glUniform1i; +RGLSYMGLUNIFORM2IPROC __rglgen_glUniform2i; +RGLSYMGLUNIFORM3IPROC __rglgen_glUniform3i; +RGLSYMGLUNIFORM4IPROC __rglgen_glUniform4i; +RGLSYMGLUNIFORM1FVPROC __rglgen_glUniform1fv; +RGLSYMGLUNIFORM2FVPROC __rglgen_glUniform2fv; +RGLSYMGLUNIFORM3FVPROC __rglgen_glUniform3fv; +RGLSYMGLUNIFORM4FVPROC __rglgen_glUniform4fv; +RGLSYMGLUNIFORM1IVPROC __rglgen_glUniform1iv; +RGLSYMGLUNIFORM2IVPROC __rglgen_glUniform2iv; +RGLSYMGLUNIFORM3IVPROC __rglgen_glUniform3iv; +RGLSYMGLUNIFORM4IVPROC __rglgen_glUniform4iv; +RGLSYMGLUNIFORMMATRIX2FVPROC __rglgen_glUniformMatrix2fv; +RGLSYMGLUNIFORMMATRIX3FVPROC __rglgen_glUniformMatrix3fv; +RGLSYMGLUNIFORMMATRIX4FVPROC __rglgen_glUniformMatrix4fv; +RGLSYMGLVALIDATEPROGRAMPROC __rglgen_glValidateProgram; +RGLSYMGLVERTEXATTRIB1DPROC __rglgen_glVertexAttrib1d; +RGLSYMGLVERTEXATTRIB1DVPROC __rglgen_glVertexAttrib1dv; +RGLSYMGLVERTEXATTRIB1FPROC __rglgen_glVertexAttrib1f; +RGLSYMGLVERTEXATTRIB1FVPROC __rglgen_glVertexAttrib1fv; +RGLSYMGLVERTEXATTRIB1SPROC __rglgen_glVertexAttrib1s; +RGLSYMGLVERTEXATTRIB1SVPROC __rglgen_glVertexAttrib1sv; +RGLSYMGLVERTEXATTRIB2DPROC __rglgen_glVertexAttrib2d; +RGLSYMGLVERTEXATTRIB2DVPROC __rglgen_glVertexAttrib2dv; +RGLSYMGLVERTEXATTRIB2FPROC __rglgen_glVertexAttrib2f; +RGLSYMGLVERTEXATTRIB2FVPROC __rglgen_glVertexAttrib2fv; +RGLSYMGLVERTEXATTRIB2SPROC __rglgen_glVertexAttrib2s; +RGLSYMGLVERTEXATTRIB2SVPROC __rglgen_glVertexAttrib2sv; +RGLSYMGLVERTEXATTRIB3DPROC __rglgen_glVertexAttrib3d; +RGLSYMGLVERTEXATTRIB3DVPROC __rglgen_glVertexAttrib3dv; +RGLSYMGLVERTEXATTRIB3FPROC __rglgen_glVertexAttrib3f; +RGLSYMGLVERTEXATTRIB3FVPROC __rglgen_glVertexAttrib3fv; +RGLSYMGLVERTEXATTRIB3SPROC __rglgen_glVertexAttrib3s; +RGLSYMGLVERTEXATTRIB3SVPROC __rglgen_glVertexAttrib3sv; +RGLSYMGLVERTEXATTRIB4NBVPROC __rglgen_glVertexAttrib4Nbv; +RGLSYMGLVERTEXATTRIB4NIVPROC __rglgen_glVertexAttrib4Niv; +RGLSYMGLVERTEXATTRIB4NSVPROC __rglgen_glVertexAttrib4Nsv; +RGLSYMGLVERTEXATTRIB4NUBPROC __rglgen_glVertexAttrib4Nub; +RGLSYMGLVERTEXATTRIB4NUBVPROC __rglgen_glVertexAttrib4Nubv; +RGLSYMGLVERTEXATTRIB4NUIVPROC __rglgen_glVertexAttrib4Nuiv; +RGLSYMGLVERTEXATTRIB4NUSVPROC __rglgen_glVertexAttrib4Nusv; +RGLSYMGLVERTEXATTRIB4BVPROC __rglgen_glVertexAttrib4bv; +RGLSYMGLVERTEXATTRIB4DPROC __rglgen_glVertexAttrib4d; +RGLSYMGLVERTEXATTRIB4DVPROC __rglgen_glVertexAttrib4dv; +RGLSYMGLVERTEXATTRIB4FPROC __rglgen_glVertexAttrib4f; +RGLSYMGLVERTEXATTRIB4FVPROC __rglgen_glVertexAttrib4fv; +RGLSYMGLVERTEXATTRIB4IVPROC __rglgen_glVertexAttrib4iv; +RGLSYMGLVERTEXATTRIB4SPROC __rglgen_glVertexAttrib4s; +RGLSYMGLVERTEXATTRIB4SVPROC __rglgen_glVertexAttrib4sv; +RGLSYMGLVERTEXATTRIB4UBVPROC __rglgen_glVertexAttrib4ubv; +RGLSYMGLVERTEXATTRIB4UIVPROC __rglgen_glVertexAttrib4uiv; +RGLSYMGLVERTEXATTRIB4USVPROC __rglgen_glVertexAttrib4usv; +RGLSYMGLVERTEXATTRIBPOINTERPROC __rglgen_glVertexAttribPointer; +RGLSYMGLUNIFORMMATRIX2X3FVPROC __rglgen_glUniformMatrix2x3fv; +RGLSYMGLUNIFORMMATRIX3X2FVPROC __rglgen_glUniformMatrix3x2fv; +RGLSYMGLUNIFORMMATRIX2X4FVPROC __rglgen_glUniformMatrix2x4fv; +RGLSYMGLUNIFORMMATRIX4X2FVPROC __rglgen_glUniformMatrix4x2fv; +RGLSYMGLUNIFORMMATRIX3X4FVPROC __rglgen_glUniformMatrix3x4fv; +RGLSYMGLUNIFORMMATRIX4X3FVPROC __rglgen_glUniformMatrix4x3fv; +RGLSYMGLCOLORMASKIPROC __rglgen_glColorMaski; +RGLSYMGLGETBOOLEANI_VPROC __rglgen_glGetBooleani_v; +RGLSYMGLGETINTEGERI_VPROC __rglgen_glGetIntegeri_v; +RGLSYMGLENABLEIPROC __rglgen_glEnablei; +RGLSYMGLDISABLEIPROC __rglgen_glDisablei; +RGLSYMGLISENABLEDIPROC __rglgen_glIsEnabledi; +RGLSYMGLBEGINTRANSFORMFEEDBACKPROC __rglgen_glBeginTransformFeedback; +RGLSYMGLENDTRANSFORMFEEDBACKPROC __rglgen_glEndTransformFeedback; +RGLSYMGLBINDBUFFERRANGEPROC __rglgen_glBindBufferRange; +RGLSYMGLBINDBUFFERBASEPROC __rglgen_glBindBufferBase; +RGLSYMGLTRANSFORMFEEDBACKVARYINGSPROC __rglgen_glTransformFeedbackVaryings; +RGLSYMGLGETTRANSFORMFEEDBACKVARYINGPROC __rglgen_glGetTransformFeedbackVarying; +RGLSYMGLCLAMPCOLORPROC __rglgen_glClampColor; +RGLSYMGLBEGINCONDITIONALRENDERPROC __rglgen_glBeginConditionalRender; +RGLSYMGLENDCONDITIONALRENDERPROC __rglgen_glEndConditionalRender; +RGLSYMGLVERTEXATTRIBIPOINTERPROC __rglgen_glVertexAttribIPointer; +RGLSYMGLGETVERTEXATTRIBIIVPROC __rglgen_glGetVertexAttribIiv; +RGLSYMGLGETVERTEXATTRIBIUIVPROC __rglgen_glGetVertexAttribIuiv; +RGLSYMGLVERTEXATTRIBI1IPROC __rglgen_glVertexAttribI1i; +RGLSYMGLVERTEXATTRIBI2IPROC __rglgen_glVertexAttribI2i; +RGLSYMGLVERTEXATTRIBI3IPROC __rglgen_glVertexAttribI3i; +RGLSYMGLVERTEXATTRIBI4IPROC __rglgen_glVertexAttribI4i; +RGLSYMGLVERTEXATTRIBI1UIPROC __rglgen_glVertexAttribI1ui; +RGLSYMGLVERTEXATTRIBI2UIPROC __rglgen_glVertexAttribI2ui; +RGLSYMGLVERTEXATTRIBI3UIPROC __rglgen_glVertexAttribI3ui; +RGLSYMGLVERTEXATTRIBI4UIPROC __rglgen_glVertexAttribI4ui; +RGLSYMGLVERTEXATTRIBI1IVPROC __rglgen_glVertexAttribI1iv; +RGLSYMGLVERTEXATTRIBI2IVPROC __rglgen_glVertexAttribI2iv; +RGLSYMGLVERTEXATTRIBI3IVPROC __rglgen_glVertexAttribI3iv; +RGLSYMGLVERTEXATTRIBI4IVPROC __rglgen_glVertexAttribI4iv; +RGLSYMGLVERTEXATTRIBI1UIVPROC __rglgen_glVertexAttribI1uiv; +RGLSYMGLVERTEXATTRIBI2UIVPROC __rglgen_glVertexAttribI2uiv; +RGLSYMGLVERTEXATTRIBI3UIVPROC __rglgen_glVertexAttribI3uiv; +RGLSYMGLVERTEXATTRIBI4UIVPROC __rglgen_glVertexAttribI4uiv; +RGLSYMGLVERTEXATTRIBI4BVPROC __rglgen_glVertexAttribI4bv; +RGLSYMGLVERTEXATTRIBI4SVPROC __rglgen_glVertexAttribI4sv; +RGLSYMGLVERTEXATTRIBI4UBVPROC __rglgen_glVertexAttribI4ubv; +RGLSYMGLVERTEXATTRIBI4USVPROC __rglgen_glVertexAttribI4usv; +RGLSYMGLGETUNIFORMUIVPROC __rglgen_glGetUniformuiv; +RGLSYMGLBINDFRAGDATALOCATIONPROC __rglgen_glBindFragDataLocation; +RGLSYMGLGETFRAGDATALOCATIONPROC __rglgen_glGetFragDataLocation; +RGLSYMGLUNIFORM1UIPROC __rglgen_glUniform1ui; +RGLSYMGLUNIFORM2UIPROC __rglgen_glUniform2ui; +RGLSYMGLUNIFORM3UIPROC __rglgen_glUniform3ui; +RGLSYMGLUNIFORM4UIPROC __rglgen_glUniform4ui; +RGLSYMGLUNIFORM1UIVPROC __rglgen_glUniform1uiv; +RGLSYMGLUNIFORM2UIVPROC __rglgen_glUniform2uiv; +RGLSYMGLUNIFORM3UIVPROC __rglgen_glUniform3uiv; +RGLSYMGLUNIFORM4UIVPROC __rglgen_glUniform4uiv; +RGLSYMGLTEXPARAMETERIIVPROC __rglgen_glTexParameterIiv; +RGLSYMGLTEXPARAMETERIUIVPROC __rglgen_glTexParameterIuiv; +RGLSYMGLGETTEXPARAMETERIIVPROC __rglgen_glGetTexParameterIiv; +RGLSYMGLGETTEXPARAMETERIUIVPROC __rglgen_glGetTexParameterIuiv; +RGLSYMGLCLEARBUFFERIVPROC __rglgen_glClearBufferiv; +RGLSYMGLCLEARBUFFERUIVPROC __rglgen_glClearBufferuiv; +RGLSYMGLCLEARBUFFERFVPROC __rglgen_glClearBufferfv; +RGLSYMGLCLEARBUFFERFIPROC __rglgen_glClearBufferfi; +RGLSYMGLGETSTRINGIPROC __rglgen_glGetStringi; +RGLSYMGLISRENDERBUFFERPROC __rglgen_glIsRenderbuffer; +RGLSYMGLBINDRENDERBUFFERPROC __rglgen_glBindRenderbuffer; +RGLSYMGLDELETERENDERBUFFERSPROC __rglgen_glDeleteRenderbuffers; +RGLSYMGLGENRENDERBUFFERSPROC __rglgen_glGenRenderbuffers; +RGLSYMGLRENDERBUFFERSTORAGEPROC __rglgen_glRenderbufferStorage; +RGLSYMGLGETRENDERBUFFERPARAMETERIVPROC __rglgen_glGetRenderbufferParameteriv; +RGLSYMGLISFRAMEBUFFERPROC __rglgen_glIsFramebuffer; +RGLSYMGLBINDFRAMEBUFFERPROC __rglgen_glBindFramebuffer; +RGLSYMGLDELETEFRAMEBUFFERSPROC __rglgen_glDeleteFramebuffers; +RGLSYMGLGENFRAMEBUFFERSPROC __rglgen_glGenFramebuffers; +RGLSYMGLCHECKFRAMEBUFFERSTATUSPROC __rglgen_glCheckFramebufferStatus; +RGLSYMGLFRAMEBUFFERTEXTURE1DPROC __rglgen_glFramebufferTexture1D; +RGLSYMGLFRAMEBUFFERTEXTURE2DPROC __rglgen_glFramebufferTexture2D; +RGLSYMGLFRAMEBUFFERTEXTURE3DPROC __rglgen_glFramebufferTexture3D; +RGLSYMGLFRAMEBUFFERRENDERBUFFERPROC __rglgen_glFramebufferRenderbuffer; +RGLSYMGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC __rglgen_glGetFramebufferAttachmentParameteriv; +RGLSYMGLGENERATEMIPMAPPROC __rglgen_glGenerateMipmap; +RGLSYMGLBLITFRAMEBUFFERPROC __rglgen_glBlitFramebuffer; +RGLSYMGLRENDERBUFFERSTORAGEMULTISAMPLEPROC __rglgen_glRenderbufferStorageMultisample; +RGLSYMGLFRAMEBUFFERTEXTURELAYERPROC __rglgen_glFramebufferTextureLayer; +RGLSYMGLMAPBUFFERRANGEPROC __rglgen_glMapBufferRange; +RGLSYMGLFLUSHMAPPEDBUFFERRANGEPROC __rglgen_glFlushMappedBufferRange; +RGLSYMGLBINDVERTEXARRAYPROC __rglgen_glBindVertexArray; +RGLSYMGLDELETEVERTEXARRAYSPROC __rglgen_glDeleteVertexArrays; +RGLSYMGLGENVERTEXARRAYSPROC __rglgen_glGenVertexArrays; +RGLSYMGLISVERTEXARRAYPROC __rglgen_glIsVertexArray; +RGLSYMGLDRAWARRAYSINSTANCEDPROC __rglgen_glDrawArraysInstanced; +RGLSYMGLDRAWELEMENTSINSTANCEDPROC __rglgen_glDrawElementsInstanced; +RGLSYMGLTEXBUFFERPROC __rglgen_glTexBuffer; +RGLSYMGLPRIMITIVERESTARTINDEXPROC __rglgen_glPrimitiveRestartIndex; +RGLSYMGLCOPYBUFFERSUBDATAPROC __rglgen_glCopyBufferSubData; +RGLSYMGLGETUNIFORMINDICESPROC __rglgen_glGetUniformIndices; +RGLSYMGLGETACTIVEUNIFORMSIVPROC __rglgen_glGetActiveUniformsiv; +RGLSYMGLGETACTIVEUNIFORMNAMEPROC __rglgen_glGetActiveUniformName; +RGLSYMGLGETUNIFORMBLOCKINDEXPROC __rglgen_glGetUniformBlockIndex; +RGLSYMGLGETACTIVEUNIFORMBLOCKIVPROC __rglgen_glGetActiveUniformBlockiv; +RGLSYMGLGETACTIVEUNIFORMBLOCKNAMEPROC __rglgen_glGetActiveUniformBlockName; +RGLSYMGLUNIFORMBLOCKBINDINGPROC __rglgen_glUniformBlockBinding; +RGLSYMGLDRAWELEMENTSBASEVERTEXPROC __rglgen_glDrawElementsBaseVertex; +RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXPROC __rglgen_glDrawRangeElementsBaseVertex; +RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC __rglgen_glDrawElementsInstancedBaseVertex; +RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXPROC __rglgen_glMultiDrawElementsBaseVertex; +RGLSYMGLPROVOKINGVERTEXPROC __rglgen_glProvokingVertex; +RGLSYMGLFENCESYNCPROC __rglgen_glFenceSync; +RGLSYMGLISSYNCPROC __rglgen_glIsSync; +RGLSYMGLDELETESYNCPROC __rglgen_glDeleteSync; +RGLSYMGLCLIENTWAITSYNCPROC __rglgen_glClientWaitSync; +RGLSYMGLWAITSYNCPROC __rglgen_glWaitSync; +RGLSYMGLGETINTEGER64VPROC __rglgen_glGetInteger64v; +RGLSYMGLGETSYNCIVPROC __rglgen_glGetSynciv; +RGLSYMGLGETINTEGER64I_VPROC __rglgen_glGetInteger64i_v; +RGLSYMGLGETBUFFERPARAMETERI64VPROC __rglgen_glGetBufferParameteri64v; +RGLSYMGLFRAMEBUFFERTEXTUREPROC __rglgen_glFramebufferTexture; +RGLSYMGLTEXIMAGE2DMULTISAMPLEPROC __rglgen_glTexImage2DMultisample; +RGLSYMGLTEXIMAGE3DMULTISAMPLEPROC __rglgen_glTexImage3DMultisample; +RGLSYMGLGETMULTISAMPLEFVPROC __rglgen_glGetMultisamplefv; +RGLSYMGLSAMPLEMASKIPROC __rglgen_glSampleMaski; +RGLSYMGLBINDFRAGDATALOCATIONINDEXEDPROC __rglgen_glBindFragDataLocationIndexed; +RGLSYMGLGETFRAGDATAINDEXPROC __rglgen_glGetFragDataIndex; +RGLSYMGLGENSAMPLERSPROC __rglgen_glGenSamplers; +RGLSYMGLDELETESAMPLERSPROC __rglgen_glDeleteSamplers; +RGLSYMGLISSAMPLERPROC __rglgen_glIsSampler; +RGLSYMGLBINDSAMPLERPROC __rglgen_glBindSampler; +RGLSYMGLSAMPLERPARAMETERIPROC __rglgen_glSamplerParameteri; +RGLSYMGLSAMPLERPARAMETERIVPROC __rglgen_glSamplerParameteriv; +RGLSYMGLSAMPLERPARAMETERFPROC __rglgen_glSamplerParameterf; +RGLSYMGLSAMPLERPARAMETERFVPROC __rglgen_glSamplerParameterfv; +RGLSYMGLSAMPLERPARAMETERIIVPROC __rglgen_glSamplerParameterIiv; +RGLSYMGLSAMPLERPARAMETERIUIVPROC __rglgen_glSamplerParameterIuiv; +RGLSYMGLGETSAMPLERPARAMETERIVPROC __rglgen_glGetSamplerParameteriv; +RGLSYMGLGETSAMPLERPARAMETERIIVPROC __rglgen_glGetSamplerParameterIiv; +RGLSYMGLGETSAMPLERPARAMETERFVPROC __rglgen_glGetSamplerParameterfv; +RGLSYMGLGETSAMPLERPARAMETERIUIVPROC __rglgen_glGetSamplerParameterIuiv; +RGLSYMGLQUERYCOUNTERPROC __rglgen_glQueryCounter; +RGLSYMGLGETQUERYOBJECTI64VPROC __rglgen_glGetQueryObjecti64v; +RGLSYMGLGETQUERYOBJECTUI64VPROC __rglgen_glGetQueryObjectui64v; +RGLSYMGLVERTEXATTRIBDIVISORPROC __rglgen_glVertexAttribDivisor; +RGLSYMGLVERTEXATTRIBP1UIPROC __rglgen_glVertexAttribP1ui; +RGLSYMGLVERTEXATTRIBP1UIVPROC __rglgen_glVertexAttribP1uiv; +RGLSYMGLVERTEXATTRIBP2UIPROC __rglgen_glVertexAttribP2ui; +RGLSYMGLVERTEXATTRIBP2UIVPROC __rglgen_glVertexAttribP2uiv; +RGLSYMGLVERTEXATTRIBP3UIPROC __rglgen_glVertexAttribP3ui; +RGLSYMGLVERTEXATTRIBP3UIVPROC __rglgen_glVertexAttribP3uiv; +RGLSYMGLVERTEXATTRIBP4UIPROC __rglgen_glVertexAttribP4ui; +RGLSYMGLVERTEXATTRIBP4UIVPROC __rglgen_glVertexAttribP4uiv; +RGLSYMGLVERTEXP2UIPROC __rglgen_glVertexP2ui; +RGLSYMGLVERTEXP2UIVPROC __rglgen_glVertexP2uiv; +RGLSYMGLVERTEXP3UIPROC __rglgen_glVertexP3ui; +RGLSYMGLVERTEXP3UIVPROC __rglgen_glVertexP3uiv; +RGLSYMGLVERTEXP4UIPROC __rglgen_glVertexP4ui; +RGLSYMGLVERTEXP4UIVPROC __rglgen_glVertexP4uiv; +RGLSYMGLTEXCOORDP1UIPROC __rglgen_glTexCoordP1ui; +RGLSYMGLTEXCOORDP1UIVPROC __rglgen_glTexCoordP1uiv; +RGLSYMGLTEXCOORDP2UIPROC __rglgen_glTexCoordP2ui; +RGLSYMGLTEXCOORDP2UIVPROC __rglgen_glTexCoordP2uiv; +RGLSYMGLTEXCOORDP3UIPROC __rglgen_glTexCoordP3ui; +RGLSYMGLTEXCOORDP3UIVPROC __rglgen_glTexCoordP3uiv; +RGLSYMGLTEXCOORDP4UIPROC __rglgen_glTexCoordP4ui; +RGLSYMGLTEXCOORDP4UIVPROC __rglgen_glTexCoordP4uiv; +RGLSYMGLMULTITEXCOORDP1UIPROC __rglgen_glMultiTexCoordP1ui; +RGLSYMGLMULTITEXCOORDP1UIVPROC __rglgen_glMultiTexCoordP1uiv; +RGLSYMGLMULTITEXCOORDP2UIPROC __rglgen_glMultiTexCoordP2ui; +RGLSYMGLMULTITEXCOORDP2UIVPROC __rglgen_glMultiTexCoordP2uiv; +RGLSYMGLMULTITEXCOORDP3UIPROC __rglgen_glMultiTexCoordP3ui; +RGLSYMGLMULTITEXCOORDP3UIVPROC __rglgen_glMultiTexCoordP3uiv; +RGLSYMGLMULTITEXCOORDP4UIPROC __rglgen_glMultiTexCoordP4ui; +RGLSYMGLMULTITEXCOORDP4UIVPROC __rglgen_glMultiTexCoordP4uiv; +RGLSYMGLNORMALP3UIPROC __rglgen_glNormalP3ui; +RGLSYMGLNORMALP3UIVPROC __rglgen_glNormalP3uiv; +RGLSYMGLCOLORP3UIPROC __rglgen_glColorP3ui; +RGLSYMGLCOLORP3UIVPROC __rglgen_glColorP3uiv; +RGLSYMGLCOLORP4UIPROC __rglgen_glColorP4ui; +RGLSYMGLCOLORP4UIVPROC __rglgen_glColorP4uiv; +RGLSYMGLSECONDARYCOLORP3UIPROC __rglgen_glSecondaryColorP3ui; +RGLSYMGLSECONDARYCOLORP3UIVPROC __rglgen_glSecondaryColorP3uiv; +RGLSYMGLMINSAMPLESHADINGPROC __rglgen_glMinSampleShading; +RGLSYMGLBLENDEQUATIONIPROC __rglgen_glBlendEquationi; +RGLSYMGLBLENDEQUATIONSEPARATEIPROC __rglgen_glBlendEquationSeparatei; +RGLSYMGLBLENDFUNCIPROC __rglgen_glBlendFunci; +RGLSYMGLBLENDFUNCSEPARATEIPROC __rglgen_glBlendFuncSeparatei; +RGLSYMGLDRAWARRAYSINDIRECTPROC __rglgen_glDrawArraysIndirect; +RGLSYMGLDRAWELEMENTSINDIRECTPROC __rglgen_glDrawElementsIndirect; +RGLSYMGLUNIFORM1DPROC __rglgen_glUniform1d; +RGLSYMGLUNIFORM2DPROC __rglgen_glUniform2d; +RGLSYMGLUNIFORM3DPROC __rglgen_glUniform3d; +RGLSYMGLUNIFORM4DPROC __rglgen_glUniform4d; +RGLSYMGLUNIFORM1DVPROC __rglgen_glUniform1dv; +RGLSYMGLUNIFORM2DVPROC __rglgen_glUniform2dv; +RGLSYMGLUNIFORM3DVPROC __rglgen_glUniform3dv; +RGLSYMGLUNIFORM4DVPROC __rglgen_glUniform4dv; +RGLSYMGLUNIFORMMATRIX2DVPROC __rglgen_glUniformMatrix2dv; +RGLSYMGLUNIFORMMATRIX3DVPROC __rglgen_glUniformMatrix3dv; +RGLSYMGLUNIFORMMATRIX4DVPROC __rglgen_glUniformMatrix4dv; +RGLSYMGLUNIFORMMATRIX2X3DVPROC __rglgen_glUniformMatrix2x3dv; +RGLSYMGLUNIFORMMATRIX2X4DVPROC __rglgen_glUniformMatrix2x4dv; +RGLSYMGLUNIFORMMATRIX3X2DVPROC __rglgen_glUniformMatrix3x2dv; +RGLSYMGLUNIFORMMATRIX3X4DVPROC __rglgen_glUniformMatrix3x4dv; +RGLSYMGLUNIFORMMATRIX4X2DVPROC __rglgen_glUniformMatrix4x2dv; +RGLSYMGLUNIFORMMATRIX4X3DVPROC __rglgen_glUniformMatrix4x3dv; +RGLSYMGLGETUNIFORMDVPROC __rglgen_glGetUniformdv; +RGLSYMGLGETSUBROUTINEUNIFORMLOCATIONPROC __rglgen_glGetSubroutineUniformLocation; +RGLSYMGLGETSUBROUTINEINDEXPROC __rglgen_glGetSubroutineIndex; +RGLSYMGLGETACTIVESUBROUTINEUNIFORMIVPROC __rglgen_glGetActiveSubroutineUniformiv; +RGLSYMGLGETACTIVESUBROUTINEUNIFORMNAMEPROC __rglgen_glGetActiveSubroutineUniformName; +RGLSYMGLGETACTIVESUBROUTINENAMEPROC __rglgen_glGetActiveSubroutineName; +RGLSYMGLUNIFORMSUBROUTINESUIVPROC __rglgen_glUniformSubroutinesuiv; +RGLSYMGLGETUNIFORMSUBROUTINEUIVPROC __rglgen_glGetUniformSubroutineuiv; +RGLSYMGLGETPROGRAMSTAGEIVPROC __rglgen_glGetProgramStageiv; +RGLSYMGLPATCHPARAMETERIPROC __rglgen_glPatchParameteri; +RGLSYMGLPATCHPARAMETERFVPROC __rglgen_glPatchParameterfv; +RGLSYMGLBINDTRANSFORMFEEDBACKPROC __rglgen_glBindTransformFeedback; +RGLSYMGLDELETETRANSFORMFEEDBACKSPROC __rglgen_glDeleteTransformFeedbacks; +RGLSYMGLGENTRANSFORMFEEDBACKSPROC __rglgen_glGenTransformFeedbacks; +RGLSYMGLISTRANSFORMFEEDBACKPROC __rglgen_glIsTransformFeedback; +RGLSYMGLPAUSETRANSFORMFEEDBACKPROC __rglgen_glPauseTransformFeedback; +RGLSYMGLRESUMETRANSFORMFEEDBACKPROC __rglgen_glResumeTransformFeedback; +RGLSYMGLDRAWTRANSFORMFEEDBACKPROC __rglgen_glDrawTransformFeedback; +RGLSYMGLDRAWTRANSFORMFEEDBACKSTREAMPROC __rglgen_glDrawTransformFeedbackStream; +RGLSYMGLBEGINQUERYINDEXEDPROC __rglgen_glBeginQueryIndexed; +RGLSYMGLENDQUERYINDEXEDPROC __rglgen_glEndQueryIndexed; +RGLSYMGLGETQUERYINDEXEDIVPROC __rglgen_glGetQueryIndexediv; +RGLSYMGLRELEASESHADERCOMPILERPROC __rglgen_glReleaseShaderCompiler; +RGLSYMGLSHADERBINARYPROC __rglgen_glShaderBinary; +RGLSYMGLGETSHADERPRECISIONFORMATPROC __rglgen_glGetShaderPrecisionFormat; +RGLSYMGLDEPTHRANGEFPROC __rglgen_glDepthRangef; +RGLSYMGLCLEARDEPTHFPROC __rglgen_glClearDepthf; +RGLSYMGLGETPROGRAMBINARYPROC __rglgen_glGetProgramBinary; +RGLSYMGLPROGRAMBINARYPROC __rglgen_glProgramBinary; +RGLSYMGLPROGRAMPARAMETERIPROC __rglgen_glProgramParameteri; +RGLSYMGLUSEPROGRAMSTAGESPROC __rglgen_glUseProgramStages; +RGLSYMGLACTIVESHADERPROGRAMPROC __rglgen_glActiveShaderProgram; +RGLSYMGLCREATESHADERPROGRAMVPROC __rglgen_glCreateShaderProgramv; +RGLSYMGLBINDPROGRAMPIPELINEPROC __rglgen_glBindProgramPipeline; +RGLSYMGLDELETEPROGRAMPIPELINESPROC __rglgen_glDeleteProgramPipelines; +RGLSYMGLGENPROGRAMPIPELINESPROC __rglgen_glGenProgramPipelines; +RGLSYMGLISPROGRAMPIPELINEPROC __rglgen_glIsProgramPipeline; +RGLSYMGLGETPROGRAMPIPELINEIVPROC __rglgen_glGetProgramPipelineiv; +RGLSYMGLPROGRAMUNIFORM1IPROC __rglgen_glProgramUniform1i; +RGLSYMGLPROGRAMUNIFORM1IVPROC __rglgen_glProgramUniform1iv; +RGLSYMGLPROGRAMUNIFORM1FPROC __rglgen_glProgramUniform1f; +RGLSYMGLPROGRAMUNIFORM1FVPROC __rglgen_glProgramUniform1fv; +RGLSYMGLPROGRAMUNIFORM1DPROC __rglgen_glProgramUniform1d; +RGLSYMGLPROGRAMUNIFORM1DVPROC __rglgen_glProgramUniform1dv; +RGLSYMGLPROGRAMUNIFORM1UIPROC __rglgen_glProgramUniform1ui; +RGLSYMGLPROGRAMUNIFORM1UIVPROC __rglgen_glProgramUniform1uiv; +RGLSYMGLPROGRAMUNIFORM2IPROC __rglgen_glProgramUniform2i; +RGLSYMGLPROGRAMUNIFORM2IVPROC __rglgen_glProgramUniform2iv; +RGLSYMGLPROGRAMUNIFORM2FPROC __rglgen_glProgramUniform2f; +RGLSYMGLPROGRAMUNIFORM2FVPROC __rglgen_glProgramUniform2fv; +RGLSYMGLPROGRAMUNIFORM2DPROC __rglgen_glProgramUniform2d; +RGLSYMGLPROGRAMUNIFORM2DVPROC __rglgen_glProgramUniform2dv; +RGLSYMGLPROGRAMUNIFORM2UIPROC __rglgen_glProgramUniform2ui; +RGLSYMGLPROGRAMUNIFORM2UIVPROC __rglgen_glProgramUniform2uiv; +RGLSYMGLPROGRAMUNIFORM3IPROC __rglgen_glProgramUniform3i; +RGLSYMGLPROGRAMUNIFORM3IVPROC __rglgen_glProgramUniform3iv; +RGLSYMGLPROGRAMUNIFORM3FPROC __rglgen_glProgramUniform3f; +RGLSYMGLPROGRAMUNIFORM3FVPROC __rglgen_glProgramUniform3fv; +RGLSYMGLPROGRAMUNIFORM3DPROC __rglgen_glProgramUniform3d; +RGLSYMGLPROGRAMUNIFORM3DVPROC __rglgen_glProgramUniform3dv; +RGLSYMGLPROGRAMUNIFORM3UIPROC __rglgen_glProgramUniform3ui; +RGLSYMGLPROGRAMUNIFORM3UIVPROC __rglgen_glProgramUniform3uiv; +RGLSYMGLPROGRAMUNIFORM4IPROC __rglgen_glProgramUniform4i; +RGLSYMGLPROGRAMUNIFORM4IVPROC __rglgen_glProgramUniform4iv; +RGLSYMGLPROGRAMUNIFORM4FPROC __rglgen_glProgramUniform4f; +RGLSYMGLPROGRAMUNIFORM4FVPROC __rglgen_glProgramUniform4fv; +RGLSYMGLPROGRAMUNIFORM4DPROC __rglgen_glProgramUniform4d; +RGLSYMGLPROGRAMUNIFORM4DVPROC __rglgen_glProgramUniform4dv; +RGLSYMGLPROGRAMUNIFORM4UIPROC __rglgen_glProgramUniform4ui; +RGLSYMGLPROGRAMUNIFORM4UIVPROC __rglgen_glProgramUniform4uiv; +RGLSYMGLPROGRAMUNIFORMMATRIX2FVPROC __rglgen_glProgramUniformMatrix2fv; +RGLSYMGLPROGRAMUNIFORMMATRIX3FVPROC __rglgen_glProgramUniformMatrix3fv; +RGLSYMGLPROGRAMUNIFORMMATRIX4FVPROC __rglgen_glProgramUniformMatrix4fv; +RGLSYMGLPROGRAMUNIFORMMATRIX2DVPROC __rglgen_glProgramUniformMatrix2dv; +RGLSYMGLPROGRAMUNIFORMMATRIX3DVPROC __rglgen_glProgramUniformMatrix3dv; +RGLSYMGLPROGRAMUNIFORMMATRIX4DVPROC __rglgen_glProgramUniformMatrix4dv; +RGLSYMGLPROGRAMUNIFORMMATRIX2X3FVPROC __rglgen_glProgramUniformMatrix2x3fv; +RGLSYMGLPROGRAMUNIFORMMATRIX3X2FVPROC __rglgen_glProgramUniformMatrix3x2fv; +RGLSYMGLPROGRAMUNIFORMMATRIX2X4FVPROC __rglgen_glProgramUniformMatrix2x4fv; +RGLSYMGLPROGRAMUNIFORMMATRIX4X2FVPROC __rglgen_glProgramUniformMatrix4x2fv; +RGLSYMGLPROGRAMUNIFORMMATRIX3X4FVPROC __rglgen_glProgramUniformMatrix3x4fv; +RGLSYMGLPROGRAMUNIFORMMATRIX4X3FVPROC __rglgen_glProgramUniformMatrix4x3fv; +RGLSYMGLPROGRAMUNIFORMMATRIX2X3DVPROC __rglgen_glProgramUniformMatrix2x3dv; +RGLSYMGLPROGRAMUNIFORMMATRIX3X2DVPROC __rglgen_glProgramUniformMatrix3x2dv; +RGLSYMGLPROGRAMUNIFORMMATRIX2X4DVPROC __rglgen_glProgramUniformMatrix2x4dv; +RGLSYMGLPROGRAMUNIFORMMATRIX4X2DVPROC __rglgen_glProgramUniformMatrix4x2dv; +RGLSYMGLPROGRAMUNIFORMMATRIX3X4DVPROC __rglgen_glProgramUniformMatrix3x4dv; +RGLSYMGLPROGRAMUNIFORMMATRIX4X3DVPROC __rglgen_glProgramUniformMatrix4x3dv; +RGLSYMGLVALIDATEPROGRAMPIPELINEPROC __rglgen_glValidateProgramPipeline; +RGLSYMGLGETPROGRAMPIPELINEINFOLOGPROC __rglgen_glGetProgramPipelineInfoLog; +RGLSYMGLVERTEXATTRIBL1DPROC __rglgen_glVertexAttribL1d; +RGLSYMGLVERTEXATTRIBL2DPROC __rglgen_glVertexAttribL2d; +RGLSYMGLVERTEXATTRIBL3DPROC __rglgen_glVertexAttribL3d; +RGLSYMGLVERTEXATTRIBL4DPROC __rglgen_glVertexAttribL4d; +RGLSYMGLVERTEXATTRIBL1DVPROC __rglgen_glVertexAttribL1dv; +RGLSYMGLVERTEXATTRIBL2DVPROC __rglgen_glVertexAttribL2dv; +RGLSYMGLVERTEXATTRIBL3DVPROC __rglgen_glVertexAttribL3dv; +RGLSYMGLVERTEXATTRIBL4DVPROC __rglgen_glVertexAttribL4dv; +RGLSYMGLVERTEXATTRIBLPOINTERPROC __rglgen_glVertexAttribLPointer; +RGLSYMGLGETVERTEXATTRIBLDVPROC __rglgen_glGetVertexAttribLdv; +RGLSYMGLVIEWPORTARRAYVPROC __rglgen_glViewportArrayv; +RGLSYMGLVIEWPORTINDEXEDFPROC __rglgen_glViewportIndexedf; +RGLSYMGLVIEWPORTINDEXEDFVPROC __rglgen_glViewportIndexedfv; +RGLSYMGLSCISSORARRAYVPROC __rglgen_glScissorArrayv; +RGLSYMGLSCISSORINDEXEDPROC __rglgen_glScissorIndexed; +RGLSYMGLSCISSORINDEXEDVPROC __rglgen_glScissorIndexedv; +RGLSYMGLDEPTHRANGEARRAYVPROC __rglgen_glDepthRangeArrayv; +RGLSYMGLDEPTHRANGEINDEXEDPROC __rglgen_glDepthRangeIndexed; +RGLSYMGLGETFLOATI_VPROC __rglgen_glGetFloati_v; +RGLSYMGLGETDOUBLEI_VPROC __rglgen_glGetDoublei_v; +RGLSYMGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC __rglgen_glDrawArraysInstancedBaseInstance; +RGLSYMGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC __rglgen_glDrawElementsInstancedBaseInstance; +RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC __rglgen_glDrawElementsInstancedBaseVertexBaseInstance; +RGLSYMGLGETINTERNALFORMATIVPROC __rglgen_glGetInternalformativ; +RGLSYMGLGETACTIVEATOMICCOUNTERBUFFERIVPROC __rglgen_glGetActiveAtomicCounterBufferiv; +RGLSYMGLBINDIMAGETEXTUREPROC __rglgen_glBindImageTexture; +RGLSYMGLMEMORYBARRIERPROC __rglgen_glMemoryBarrier; +RGLSYMGLTEXSTORAGE1DPROC __rglgen_glTexStorage1D; +RGLSYMGLTEXSTORAGE2DPROC __rglgen_glTexStorage2D; +RGLSYMGLTEXSTORAGE3DPROC __rglgen_glTexStorage3D; +RGLSYMGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC __rglgen_glDrawTransformFeedbackInstanced; +RGLSYMGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC __rglgen_glDrawTransformFeedbackStreamInstanced; +RGLSYMGLCLEARBUFFERDATAPROC __rglgen_glClearBufferData; +RGLSYMGLCLEARBUFFERSUBDATAPROC __rglgen_glClearBufferSubData; +RGLSYMGLDISPATCHCOMPUTEPROC __rglgen_glDispatchCompute; +RGLSYMGLDISPATCHCOMPUTEINDIRECTPROC __rglgen_glDispatchComputeIndirect; +RGLSYMGLCOPYIMAGESUBDATAPROC __rglgen_glCopyImageSubData; +RGLSYMGLFRAMEBUFFERPARAMETERIPROC __rglgen_glFramebufferParameteri; +RGLSYMGLGETFRAMEBUFFERPARAMETERIVPROC __rglgen_glGetFramebufferParameteriv; +RGLSYMGLGETINTERNALFORMATI64VPROC __rglgen_glGetInternalformati64v; +RGLSYMGLINVALIDATETEXSUBIMAGEPROC __rglgen_glInvalidateTexSubImage; +RGLSYMGLINVALIDATETEXIMAGEPROC __rglgen_glInvalidateTexImage; +RGLSYMGLINVALIDATEBUFFERSUBDATAPROC __rglgen_glInvalidateBufferSubData; +RGLSYMGLINVALIDATEBUFFERDATAPROC __rglgen_glInvalidateBufferData; +RGLSYMGLINVALIDATEFRAMEBUFFERPROC __rglgen_glInvalidateFramebuffer; +RGLSYMGLINVALIDATESUBFRAMEBUFFERPROC __rglgen_glInvalidateSubFramebuffer; +RGLSYMGLMULTIDRAWARRAYSINDIRECTPROC __rglgen_glMultiDrawArraysIndirect; +RGLSYMGLMULTIDRAWELEMENTSINDIRECTPROC __rglgen_glMultiDrawElementsIndirect; +RGLSYMGLGETPROGRAMINTERFACEIVPROC __rglgen_glGetProgramInterfaceiv; +RGLSYMGLGETPROGRAMRESOURCEINDEXPROC __rglgen_glGetProgramResourceIndex; +RGLSYMGLGETPROGRAMRESOURCENAMEPROC __rglgen_glGetProgramResourceName; +RGLSYMGLGETPROGRAMRESOURCEIVPROC __rglgen_glGetProgramResourceiv; +RGLSYMGLGETPROGRAMRESOURCELOCATIONPROC __rglgen_glGetProgramResourceLocation; +RGLSYMGLGETPROGRAMRESOURCELOCATIONINDEXPROC __rglgen_glGetProgramResourceLocationIndex; +RGLSYMGLSHADERSTORAGEBLOCKBINDINGPROC __rglgen_glShaderStorageBlockBinding; +RGLSYMGLTEXBUFFERRANGEPROC __rglgen_glTexBufferRange; +RGLSYMGLTEXSTORAGE2DMULTISAMPLEPROC __rglgen_glTexStorage2DMultisample; +RGLSYMGLTEXSTORAGE3DMULTISAMPLEPROC __rglgen_glTexStorage3DMultisample; +RGLSYMGLTEXTUREVIEWPROC __rglgen_glTextureView; +RGLSYMGLBINDVERTEXBUFFERPROC __rglgen_glBindVertexBuffer; +RGLSYMGLVERTEXATTRIBFORMATPROC __rglgen_glVertexAttribFormat; +RGLSYMGLVERTEXATTRIBIFORMATPROC __rglgen_glVertexAttribIFormat; +RGLSYMGLVERTEXATTRIBLFORMATPROC __rglgen_glVertexAttribLFormat; +RGLSYMGLVERTEXATTRIBBINDINGPROC __rglgen_glVertexAttribBinding; +RGLSYMGLVERTEXBINDINGDIVISORPROC __rglgen_glVertexBindingDivisor; +RGLSYMGLDEBUGMESSAGECONTROLPROC __rglgen_glDebugMessageControl; +RGLSYMGLDEBUGMESSAGEINSERTPROC __rglgen_glDebugMessageInsert; +RGLSYMGLDEBUGMESSAGECALLBACKPROC __rglgen_glDebugMessageCallback; +RGLSYMGLGETDEBUGMESSAGELOGPROC __rglgen_glGetDebugMessageLog; +RGLSYMGLPUSHDEBUGGROUPPROC __rglgen_glPushDebugGroup; +RGLSYMGLPOPDEBUGGROUPPROC __rglgen_glPopDebugGroup; +RGLSYMGLOBJECTLABELPROC __rglgen_glObjectLabel; +RGLSYMGLGETOBJECTLABELPROC __rglgen_glGetObjectLabel; +RGLSYMGLOBJECTPTRLABELPROC __rglgen_glObjectPtrLabel; +RGLSYMGLGETOBJECTPTRLABELPROC __rglgen_glGetObjectPtrLabel; +RGLSYMGLBUFFERSTORAGEPROC __rglgen_glBufferStorage; +RGLSYMGLCLEARTEXIMAGEPROC __rglgen_glClearTexImage; +RGLSYMGLCLEARTEXSUBIMAGEPROC __rglgen_glClearTexSubImage; +RGLSYMGLBINDBUFFERSBASEPROC __rglgen_glBindBuffersBase; +RGLSYMGLBINDBUFFERSRANGEPROC __rglgen_glBindBuffersRange; +RGLSYMGLBINDTEXTURESPROC __rglgen_glBindTextures; +RGLSYMGLBINDSAMPLERSPROC __rglgen_glBindSamplers; +RGLSYMGLBINDIMAGETEXTURESPROC __rglgen_glBindImageTextures; +RGLSYMGLBINDVERTEXBUFFERSPROC __rglgen_glBindVertexBuffers; +RGLSYMGLGETTEXTUREHANDLEARBPROC __rglgen_glGetTextureHandleARB; +RGLSYMGLGETTEXTURESAMPLERHANDLEARBPROC __rglgen_glGetTextureSamplerHandleARB; +RGLSYMGLMAKETEXTUREHANDLERESIDENTARBPROC __rglgen_glMakeTextureHandleResidentARB; +RGLSYMGLMAKETEXTUREHANDLENONRESIDENTARBPROC __rglgen_glMakeTextureHandleNonResidentARB; +RGLSYMGLGETIMAGEHANDLEARBPROC __rglgen_glGetImageHandleARB; +RGLSYMGLMAKEIMAGEHANDLERESIDENTARBPROC __rglgen_glMakeImageHandleResidentARB; +RGLSYMGLMAKEIMAGEHANDLENONRESIDENTARBPROC __rglgen_glMakeImageHandleNonResidentARB; +RGLSYMGLUNIFORMHANDLEUI64ARBPROC __rglgen_glUniformHandleui64ARB; +RGLSYMGLUNIFORMHANDLEUI64VARBPROC __rglgen_glUniformHandleui64vARB; +RGLSYMGLPROGRAMUNIFORMHANDLEUI64ARBPROC __rglgen_glProgramUniformHandleui64ARB; +RGLSYMGLPROGRAMUNIFORMHANDLEUI64VARBPROC __rglgen_glProgramUniformHandleui64vARB; +RGLSYMGLISTEXTUREHANDLERESIDENTARBPROC __rglgen_glIsTextureHandleResidentARB; +RGLSYMGLISIMAGEHANDLERESIDENTARBPROC __rglgen_glIsImageHandleResidentARB; +RGLSYMGLVERTEXATTRIBL1UI64ARBPROC __rglgen_glVertexAttribL1ui64ARB; +RGLSYMGLVERTEXATTRIBL1UI64VARBPROC __rglgen_glVertexAttribL1ui64vARB; +RGLSYMGLGETVERTEXATTRIBLUI64VARBPROC __rglgen_glGetVertexAttribLui64vARB; +RGLSYMGLCREATESYNCFROMCLEVENTARBPROC __rglgen_glCreateSyncFromCLeventARB; +RGLSYMGLCLAMPCOLORARBPROC __rglgen_glClampColorARB; +RGLSYMGLDISPATCHCOMPUTEGROUPSIZEARBPROC __rglgen_glDispatchComputeGroupSizeARB; +RGLSYMGLDEBUGMESSAGECONTROLARBPROC __rglgen_glDebugMessageControlARB; +RGLSYMGLDEBUGMESSAGEINSERTARBPROC __rglgen_glDebugMessageInsertARB; +RGLSYMGLDEBUGMESSAGECALLBACKARBPROC __rglgen_glDebugMessageCallbackARB; +RGLSYMGLGETDEBUGMESSAGELOGARBPROC __rglgen_glGetDebugMessageLogARB; +RGLSYMGLDRAWBUFFERSARBPROC __rglgen_glDrawBuffersARB; +RGLSYMGLBLENDEQUATIONIARBPROC __rglgen_glBlendEquationiARB; +RGLSYMGLBLENDEQUATIONSEPARATEIARBPROC __rglgen_glBlendEquationSeparateiARB; +RGLSYMGLBLENDFUNCIARBPROC __rglgen_glBlendFunciARB; +RGLSYMGLBLENDFUNCSEPARATEIARBPROC __rglgen_glBlendFuncSeparateiARB; +RGLSYMGLDRAWARRAYSINSTANCEDARBPROC __rglgen_glDrawArraysInstancedARB; +RGLSYMGLDRAWELEMENTSINSTANCEDARBPROC __rglgen_glDrawElementsInstancedARB; +RGLSYMGLPROGRAMSTRINGARBPROC __rglgen_glProgramStringARB; +RGLSYMGLBINDPROGRAMARBPROC __rglgen_glBindProgramARB; +RGLSYMGLDELETEPROGRAMSARBPROC __rglgen_glDeleteProgramsARB; +RGLSYMGLGENPROGRAMSARBPROC __rglgen_glGenProgramsARB; +RGLSYMGLPROGRAMENVPARAMETER4DARBPROC __rglgen_glProgramEnvParameter4dARB; +RGLSYMGLPROGRAMENVPARAMETER4DVARBPROC __rglgen_glProgramEnvParameter4dvARB; +RGLSYMGLPROGRAMENVPARAMETER4FARBPROC __rglgen_glProgramEnvParameter4fARB; +RGLSYMGLPROGRAMENVPARAMETER4FVARBPROC __rglgen_glProgramEnvParameter4fvARB; +RGLSYMGLPROGRAMLOCALPARAMETER4DARBPROC __rglgen_glProgramLocalParameter4dARB; +RGLSYMGLPROGRAMLOCALPARAMETER4DVARBPROC __rglgen_glProgramLocalParameter4dvARB; +RGLSYMGLPROGRAMLOCALPARAMETER4FARBPROC __rglgen_glProgramLocalParameter4fARB; +RGLSYMGLPROGRAMLOCALPARAMETER4FVARBPROC __rglgen_glProgramLocalParameter4fvARB; +RGLSYMGLGETPROGRAMENVPARAMETERDVARBPROC __rglgen_glGetProgramEnvParameterdvARB; +RGLSYMGLGETPROGRAMENVPARAMETERFVARBPROC __rglgen_glGetProgramEnvParameterfvARB; +RGLSYMGLGETPROGRAMLOCALPARAMETERDVARBPROC __rglgen_glGetProgramLocalParameterdvARB; +RGLSYMGLGETPROGRAMLOCALPARAMETERFVARBPROC __rglgen_glGetProgramLocalParameterfvARB; +RGLSYMGLGETPROGRAMIVARBPROC __rglgen_glGetProgramivARB; +RGLSYMGLGETPROGRAMSTRINGARBPROC __rglgen_glGetProgramStringARB; +RGLSYMGLISPROGRAMARBPROC __rglgen_glIsProgramARB; +RGLSYMGLPROGRAMPARAMETERIARBPROC __rglgen_glProgramParameteriARB; +RGLSYMGLFRAMEBUFFERTEXTUREARBPROC __rglgen_glFramebufferTextureARB; +RGLSYMGLFRAMEBUFFERTEXTURELAYERARBPROC __rglgen_glFramebufferTextureLayerARB; +RGLSYMGLFRAMEBUFFERTEXTUREFACEARBPROC __rglgen_glFramebufferTextureFaceARB; +RGLSYMGLCOLORTABLEPROC __rglgen_glColorTable; +RGLSYMGLCOLORTABLEPARAMETERFVPROC __rglgen_glColorTableParameterfv; +RGLSYMGLCOLORTABLEPARAMETERIVPROC __rglgen_glColorTableParameteriv; +RGLSYMGLCOPYCOLORTABLEPROC __rglgen_glCopyColorTable; +RGLSYMGLGETCOLORTABLEPROC __rglgen_glGetColorTable; +RGLSYMGLGETCOLORTABLEPARAMETERFVPROC __rglgen_glGetColorTableParameterfv; +RGLSYMGLGETCOLORTABLEPARAMETERIVPROC __rglgen_glGetColorTableParameteriv; +RGLSYMGLCOLORSUBTABLEPROC __rglgen_glColorSubTable; +RGLSYMGLCOPYCOLORSUBTABLEPROC __rglgen_glCopyColorSubTable; +RGLSYMGLCONVOLUTIONFILTER1DPROC __rglgen_glConvolutionFilter1D; +RGLSYMGLCONVOLUTIONFILTER2DPROC __rglgen_glConvolutionFilter2D; +RGLSYMGLCONVOLUTIONPARAMETERFPROC __rglgen_glConvolutionParameterf; +RGLSYMGLCONVOLUTIONPARAMETERFVPROC __rglgen_glConvolutionParameterfv; +RGLSYMGLCONVOLUTIONPARAMETERIPROC __rglgen_glConvolutionParameteri; +RGLSYMGLCONVOLUTIONPARAMETERIVPROC __rglgen_glConvolutionParameteriv; +RGLSYMGLCOPYCONVOLUTIONFILTER1DPROC __rglgen_glCopyConvolutionFilter1D; +RGLSYMGLCOPYCONVOLUTIONFILTER2DPROC __rglgen_glCopyConvolutionFilter2D; +RGLSYMGLGETCONVOLUTIONFILTERPROC __rglgen_glGetConvolutionFilter; +RGLSYMGLGETCONVOLUTIONPARAMETERFVPROC __rglgen_glGetConvolutionParameterfv; +RGLSYMGLGETCONVOLUTIONPARAMETERIVPROC __rglgen_glGetConvolutionParameteriv; +RGLSYMGLGETSEPARABLEFILTERPROC __rglgen_glGetSeparableFilter; +RGLSYMGLSEPARABLEFILTER2DPROC __rglgen_glSeparableFilter2D; +RGLSYMGLGETHISTOGRAMPROC __rglgen_glGetHistogram; +RGLSYMGLGETHISTOGRAMPARAMETERFVPROC __rglgen_glGetHistogramParameterfv; +RGLSYMGLGETHISTOGRAMPARAMETERIVPROC __rglgen_glGetHistogramParameteriv; +RGLSYMGLGETMINMAXPROC __rglgen_glGetMinmax; +RGLSYMGLGETMINMAXPARAMETERFVPROC __rglgen_glGetMinmaxParameterfv; +RGLSYMGLGETMINMAXPARAMETERIVPROC __rglgen_glGetMinmaxParameteriv; +RGLSYMGLHISTOGRAMPROC __rglgen_glHistogram; +RGLSYMGLMINMAXPROC __rglgen_glMinmax; +RGLSYMGLRESETHISTOGRAMPROC __rglgen_glResetHistogram; +RGLSYMGLRESETMINMAXPROC __rglgen_glResetMinmax; +RGLSYMGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC __rglgen_glMultiDrawArraysIndirectCountARB; +RGLSYMGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC __rglgen_glMultiDrawElementsIndirectCountARB; +RGLSYMGLVERTEXATTRIBDIVISORARBPROC __rglgen_glVertexAttribDivisorARB; +RGLSYMGLCURRENTPALETTEMATRIXARBPROC __rglgen_glCurrentPaletteMatrixARB; +RGLSYMGLMATRIXINDEXUBVARBPROC __rglgen_glMatrixIndexubvARB; +RGLSYMGLMATRIXINDEXUSVARBPROC __rglgen_glMatrixIndexusvARB; +RGLSYMGLMATRIXINDEXUIVARBPROC __rglgen_glMatrixIndexuivARB; +RGLSYMGLMATRIXINDEXPOINTERARBPROC __rglgen_glMatrixIndexPointerARB; +RGLSYMGLSAMPLECOVERAGEARBPROC __rglgen_glSampleCoverageARB; +RGLSYMGLACTIVETEXTUREARBPROC __rglgen_glActiveTextureARB; +RGLSYMGLCLIENTACTIVETEXTUREARBPROC __rglgen_glClientActiveTextureARB; +RGLSYMGLMULTITEXCOORD1DARBPROC __rglgen_glMultiTexCoord1dARB; +RGLSYMGLMULTITEXCOORD1DVARBPROC __rglgen_glMultiTexCoord1dvARB; +RGLSYMGLMULTITEXCOORD1FARBPROC __rglgen_glMultiTexCoord1fARB; +RGLSYMGLMULTITEXCOORD1FVARBPROC __rglgen_glMultiTexCoord1fvARB; +RGLSYMGLMULTITEXCOORD1IARBPROC __rglgen_glMultiTexCoord1iARB; +RGLSYMGLMULTITEXCOORD1IVARBPROC __rglgen_glMultiTexCoord1ivARB; +RGLSYMGLMULTITEXCOORD1SARBPROC __rglgen_glMultiTexCoord1sARB; +RGLSYMGLMULTITEXCOORD1SVARBPROC __rglgen_glMultiTexCoord1svARB; +RGLSYMGLMULTITEXCOORD2DARBPROC __rglgen_glMultiTexCoord2dARB; +RGLSYMGLMULTITEXCOORD2DVARBPROC __rglgen_glMultiTexCoord2dvARB; +RGLSYMGLMULTITEXCOORD2FARBPROC __rglgen_glMultiTexCoord2fARB; +RGLSYMGLMULTITEXCOORD2FVARBPROC __rglgen_glMultiTexCoord2fvARB; +RGLSYMGLMULTITEXCOORD2IARBPROC __rglgen_glMultiTexCoord2iARB; +RGLSYMGLMULTITEXCOORD2IVARBPROC __rglgen_glMultiTexCoord2ivARB; +RGLSYMGLMULTITEXCOORD2SARBPROC __rglgen_glMultiTexCoord2sARB; +RGLSYMGLMULTITEXCOORD2SVARBPROC __rglgen_glMultiTexCoord2svARB; +RGLSYMGLMULTITEXCOORD3DARBPROC __rglgen_glMultiTexCoord3dARB; +RGLSYMGLMULTITEXCOORD3DVARBPROC __rglgen_glMultiTexCoord3dvARB; +RGLSYMGLMULTITEXCOORD3FARBPROC __rglgen_glMultiTexCoord3fARB; +RGLSYMGLMULTITEXCOORD3FVARBPROC __rglgen_glMultiTexCoord3fvARB; +RGLSYMGLMULTITEXCOORD3IARBPROC __rglgen_glMultiTexCoord3iARB; +RGLSYMGLMULTITEXCOORD3IVARBPROC __rglgen_glMultiTexCoord3ivARB; +RGLSYMGLMULTITEXCOORD3SARBPROC __rglgen_glMultiTexCoord3sARB; +RGLSYMGLMULTITEXCOORD3SVARBPROC __rglgen_glMultiTexCoord3svARB; +RGLSYMGLMULTITEXCOORD4DARBPROC __rglgen_glMultiTexCoord4dARB; +RGLSYMGLMULTITEXCOORD4DVARBPROC __rglgen_glMultiTexCoord4dvARB; +RGLSYMGLMULTITEXCOORD4FARBPROC __rglgen_glMultiTexCoord4fARB; +RGLSYMGLMULTITEXCOORD4FVARBPROC __rglgen_glMultiTexCoord4fvARB; +RGLSYMGLMULTITEXCOORD4IARBPROC __rglgen_glMultiTexCoord4iARB; +RGLSYMGLMULTITEXCOORD4IVARBPROC __rglgen_glMultiTexCoord4ivARB; +RGLSYMGLMULTITEXCOORD4SARBPROC __rglgen_glMultiTexCoord4sARB; +RGLSYMGLMULTITEXCOORD4SVARBPROC __rglgen_glMultiTexCoord4svARB; +RGLSYMGLGENQUERIESARBPROC __rglgen_glGenQueriesARB; +RGLSYMGLDELETEQUERIESARBPROC __rglgen_glDeleteQueriesARB; +RGLSYMGLISQUERYARBPROC __rglgen_glIsQueryARB; +RGLSYMGLBEGINQUERYARBPROC __rglgen_glBeginQueryARB; +RGLSYMGLENDQUERYARBPROC __rglgen_glEndQueryARB; +RGLSYMGLGETQUERYIVARBPROC __rglgen_glGetQueryivARB; +RGLSYMGLGETQUERYOBJECTIVARBPROC __rglgen_glGetQueryObjectivARB; +RGLSYMGLGETQUERYOBJECTUIVARBPROC __rglgen_glGetQueryObjectuivARB; +RGLSYMGLPOINTPARAMETERFARBPROC __rglgen_glPointParameterfARB; +RGLSYMGLPOINTPARAMETERFVARBPROC __rglgen_glPointParameterfvARB; +RGLSYMGLGETGRAPHICSRESETSTATUSARBPROC __rglgen_glGetGraphicsResetStatusARB; +RGLSYMGLGETNTEXIMAGEARBPROC __rglgen_glGetnTexImageARB; +RGLSYMGLREADNPIXELSARBPROC __rglgen_glReadnPixelsARB; +RGLSYMGLGETNCOMPRESSEDTEXIMAGEARBPROC __rglgen_glGetnCompressedTexImageARB; +RGLSYMGLGETNUNIFORMFVARBPROC __rglgen_glGetnUniformfvARB; +RGLSYMGLGETNUNIFORMIVARBPROC __rglgen_glGetnUniformivARB; +RGLSYMGLGETNUNIFORMUIVARBPROC __rglgen_glGetnUniformuivARB; +RGLSYMGLGETNUNIFORMDVARBPROC __rglgen_glGetnUniformdvARB; +RGLSYMGLGETNMAPDVARBPROC __rglgen_glGetnMapdvARB; +RGLSYMGLGETNMAPFVARBPROC __rglgen_glGetnMapfvARB; +RGLSYMGLGETNMAPIVARBPROC __rglgen_glGetnMapivARB; +RGLSYMGLGETNPIXELMAPFVARBPROC __rglgen_glGetnPixelMapfvARB; +RGLSYMGLGETNPIXELMAPUIVARBPROC __rglgen_glGetnPixelMapuivARB; +RGLSYMGLGETNPIXELMAPUSVARBPROC __rglgen_glGetnPixelMapusvARB; +RGLSYMGLGETNPOLYGONSTIPPLEARBPROC __rglgen_glGetnPolygonStippleARB; +RGLSYMGLGETNCOLORTABLEARBPROC __rglgen_glGetnColorTableARB; +RGLSYMGLGETNCONVOLUTIONFILTERARBPROC __rglgen_glGetnConvolutionFilterARB; +RGLSYMGLGETNSEPARABLEFILTERARBPROC __rglgen_glGetnSeparableFilterARB; +RGLSYMGLGETNHISTOGRAMARBPROC __rglgen_glGetnHistogramARB; +RGLSYMGLGETNMINMAXARBPROC __rglgen_glGetnMinmaxARB; +RGLSYMGLMINSAMPLESHADINGARBPROC __rglgen_glMinSampleShadingARB; +RGLSYMGLDELETEOBJECTARBPROC __rglgen_glDeleteObjectARB; +RGLSYMGLGETHANDLEARBPROC __rglgen_glGetHandleARB; +RGLSYMGLDETACHOBJECTARBPROC __rglgen_glDetachObjectARB; +RGLSYMGLCREATESHADEROBJECTARBPROC __rglgen_glCreateShaderObjectARB; +RGLSYMGLSHADERSOURCEARBPROC __rglgen_glShaderSourceARB; +RGLSYMGLCOMPILESHADERARBPROC __rglgen_glCompileShaderARB; +RGLSYMGLCREATEPROGRAMOBJECTARBPROC __rglgen_glCreateProgramObjectARB; +RGLSYMGLATTACHOBJECTARBPROC __rglgen_glAttachObjectARB; +RGLSYMGLLINKPROGRAMARBPROC __rglgen_glLinkProgramARB; +RGLSYMGLUSEPROGRAMOBJECTARBPROC __rglgen_glUseProgramObjectARB; +RGLSYMGLVALIDATEPROGRAMARBPROC __rglgen_glValidateProgramARB; +RGLSYMGLUNIFORM1FARBPROC __rglgen_glUniform1fARB; +RGLSYMGLUNIFORM2FARBPROC __rglgen_glUniform2fARB; +RGLSYMGLUNIFORM3FARBPROC __rglgen_glUniform3fARB; +RGLSYMGLUNIFORM4FARBPROC __rglgen_glUniform4fARB; +RGLSYMGLUNIFORM1IARBPROC __rglgen_glUniform1iARB; +RGLSYMGLUNIFORM2IARBPROC __rglgen_glUniform2iARB; +RGLSYMGLUNIFORM3IARBPROC __rglgen_glUniform3iARB; +RGLSYMGLUNIFORM4IARBPROC __rglgen_glUniform4iARB; +RGLSYMGLUNIFORM1FVARBPROC __rglgen_glUniform1fvARB; +RGLSYMGLUNIFORM2FVARBPROC __rglgen_glUniform2fvARB; +RGLSYMGLUNIFORM3FVARBPROC __rglgen_glUniform3fvARB; +RGLSYMGLUNIFORM4FVARBPROC __rglgen_glUniform4fvARB; +RGLSYMGLUNIFORM1IVARBPROC __rglgen_glUniform1ivARB; +RGLSYMGLUNIFORM2IVARBPROC __rglgen_glUniform2ivARB; +RGLSYMGLUNIFORM3IVARBPROC __rglgen_glUniform3ivARB; +RGLSYMGLUNIFORM4IVARBPROC __rglgen_glUniform4ivARB; +RGLSYMGLUNIFORMMATRIX2FVARBPROC __rglgen_glUniformMatrix2fvARB; +RGLSYMGLUNIFORMMATRIX3FVARBPROC __rglgen_glUniformMatrix3fvARB; +RGLSYMGLUNIFORMMATRIX4FVARBPROC __rglgen_glUniformMatrix4fvARB; +RGLSYMGLGETOBJECTPARAMETERFVARBPROC __rglgen_glGetObjectParameterfvARB; +RGLSYMGLGETOBJECTPARAMETERIVARBPROC __rglgen_glGetObjectParameterivARB; +RGLSYMGLGETINFOLOGARBPROC __rglgen_glGetInfoLogARB; +RGLSYMGLGETATTACHEDOBJECTSARBPROC __rglgen_glGetAttachedObjectsARB; +RGLSYMGLGETUNIFORMLOCATIONARBPROC __rglgen_glGetUniformLocationARB; +RGLSYMGLGETACTIVEUNIFORMARBPROC __rglgen_glGetActiveUniformARB; +RGLSYMGLGETUNIFORMFVARBPROC __rglgen_glGetUniformfvARB; +RGLSYMGLGETUNIFORMIVARBPROC __rglgen_glGetUniformivARB; +RGLSYMGLGETSHADERSOURCEARBPROC __rglgen_glGetShaderSourceARB; +RGLSYMGLNAMEDSTRINGARBPROC __rglgen_glNamedStringARB; +RGLSYMGLDELETENAMEDSTRINGARBPROC __rglgen_glDeleteNamedStringARB; +RGLSYMGLCOMPILESHADERINCLUDEARBPROC __rglgen_glCompileShaderIncludeARB; +RGLSYMGLISNAMEDSTRINGARBPROC __rglgen_glIsNamedStringARB; +RGLSYMGLGETNAMEDSTRINGARBPROC __rglgen_glGetNamedStringARB; +RGLSYMGLGETNAMEDSTRINGIVARBPROC __rglgen_glGetNamedStringivARB; +RGLSYMGLTEXPAGECOMMITMENTARBPROC __rglgen_glTexPageCommitmentARB; +RGLSYMGLTEXBUFFERARBPROC __rglgen_glTexBufferARB; +RGLSYMGLCOMPRESSEDTEXIMAGE3DARBPROC __rglgen_glCompressedTexImage3DARB; +RGLSYMGLCOMPRESSEDTEXIMAGE2DARBPROC __rglgen_glCompressedTexImage2DARB; +RGLSYMGLCOMPRESSEDTEXIMAGE1DARBPROC __rglgen_glCompressedTexImage1DARB; +RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __rglgen_glCompressedTexSubImage3DARB; +RGLSYMGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __rglgen_glCompressedTexSubImage2DARB; +RGLSYMGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __rglgen_glCompressedTexSubImage1DARB; +RGLSYMGLGETCOMPRESSEDTEXIMAGEARBPROC __rglgen_glGetCompressedTexImageARB; +RGLSYMGLLOADTRANSPOSEMATRIXFARBPROC __rglgen_glLoadTransposeMatrixfARB; +RGLSYMGLLOADTRANSPOSEMATRIXDARBPROC __rglgen_glLoadTransposeMatrixdARB; +RGLSYMGLMULTTRANSPOSEMATRIXFARBPROC __rglgen_glMultTransposeMatrixfARB; +RGLSYMGLMULTTRANSPOSEMATRIXDARBPROC __rglgen_glMultTransposeMatrixdARB; +RGLSYMGLWEIGHTBVARBPROC __rglgen_glWeightbvARB; +RGLSYMGLWEIGHTSVARBPROC __rglgen_glWeightsvARB; +RGLSYMGLWEIGHTIVARBPROC __rglgen_glWeightivARB; +RGLSYMGLWEIGHTFVARBPROC __rglgen_glWeightfvARB; +RGLSYMGLWEIGHTDVARBPROC __rglgen_glWeightdvARB; +RGLSYMGLWEIGHTUBVARBPROC __rglgen_glWeightubvARB; +RGLSYMGLWEIGHTUSVARBPROC __rglgen_glWeightusvARB; +RGLSYMGLWEIGHTUIVARBPROC __rglgen_glWeightuivARB; +RGLSYMGLWEIGHTPOINTERARBPROC __rglgen_glWeightPointerARB; +RGLSYMGLVERTEXBLENDARBPROC __rglgen_glVertexBlendARB; +RGLSYMGLBINDBUFFERARBPROC __rglgen_glBindBufferARB; +RGLSYMGLDELETEBUFFERSARBPROC __rglgen_glDeleteBuffersARB; +RGLSYMGLGENBUFFERSARBPROC __rglgen_glGenBuffersARB; +RGLSYMGLISBUFFERARBPROC __rglgen_glIsBufferARB; +RGLSYMGLBUFFERDATAARBPROC __rglgen_glBufferDataARB; +RGLSYMGLBUFFERSUBDATAARBPROC __rglgen_glBufferSubDataARB; +RGLSYMGLGETBUFFERSUBDATAARBPROC __rglgen_glGetBufferSubDataARB; +RGLSYMGLMAPBUFFERARBPROC __rglgen_glMapBufferARB; +RGLSYMGLUNMAPBUFFERARBPROC __rglgen_glUnmapBufferARB; +RGLSYMGLGETBUFFERPARAMETERIVARBPROC __rglgen_glGetBufferParameterivARB; +RGLSYMGLGETBUFFERPOINTERVARBPROC __rglgen_glGetBufferPointervARB; +RGLSYMGLVERTEXATTRIB1DARBPROC __rglgen_glVertexAttrib1dARB; +RGLSYMGLVERTEXATTRIB1DVARBPROC __rglgen_glVertexAttrib1dvARB; +RGLSYMGLVERTEXATTRIB1FARBPROC __rglgen_glVertexAttrib1fARB; +RGLSYMGLVERTEXATTRIB1FVARBPROC __rglgen_glVertexAttrib1fvARB; +RGLSYMGLVERTEXATTRIB1SARBPROC __rglgen_glVertexAttrib1sARB; +RGLSYMGLVERTEXATTRIB1SVARBPROC __rglgen_glVertexAttrib1svARB; +RGLSYMGLVERTEXATTRIB2DARBPROC __rglgen_glVertexAttrib2dARB; +RGLSYMGLVERTEXATTRIB2DVARBPROC __rglgen_glVertexAttrib2dvARB; +RGLSYMGLVERTEXATTRIB2FARBPROC __rglgen_glVertexAttrib2fARB; +RGLSYMGLVERTEXATTRIB2FVARBPROC __rglgen_glVertexAttrib2fvARB; +RGLSYMGLVERTEXATTRIB2SARBPROC __rglgen_glVertexAttrib2sARB; +RGLSYMGLVERTEXATTRIB2SVARBPROC __rglgen_glVertexAttrib2svARB; +RGLSYMGLVERTEXATTRIB3DARBPROC __rglgen_glVertexAttrib3dARB; +RGLSYMGLVERTEXATTRIB3DVARBPROC __rglgen_glVertexAttrib3dvARB; +RGLSYMGLVERTEXATTRIB3FARBPROC __rglgen_glVertexAttrib3fARB; +RGLSYMGLVERTEXATTRIB3FVARBPROC __rglgen_glVertexAttrib3fvARB; +RGLSYMGLVERTEXATTRIB3SARBPROC __rglgen_glVertexAttrib3sARB; +RGLSYMGLVERTEXATTRIB3SVARBPROC __rglgen_glVertexAttrib3svARB; +RGLSYMGLVERTEXATTRIB4NBVARBPROC __rglgen_glVertexAttrib4NbvARB; +RGLSYMGLVERTEXATTRIB4NIVARBPROC __rglgen_glVertexAttrib4NivARB; +RGLSYMGLVERTEXATTRIB4NSVARBPROC __rglgen_glVertexAttrib4NsvARB; +RGLSYMGLVERTEXATTRIB4NUBARBPROC __rglgen_glVertexAttrib4NubARB; +RGLSYMGLVERTEXATTRIB4NUBVARBPROC __rglgen_glVertexAttrib4NubvARB; +RGLSYMGLVERTEXATTRIB4NUIVARBPROC __rglgen_glVertexAttrib4NuivARB; +RGLSYMGLVERTEXATTRIB4NUSVARBPROC __rglgen_glVertexAttrib4NusvARB; +RGLSYMGLVERTEXATTRIB4BVARBPROC __rglgen_glVertexAttrib4bvARB; +RGLSYMGLVERTEXATTRIB4DARBPROC __rglgen_glVertexAttrib4dARB; +RGLSYMGLVERTEXATTRIB4DVARBPROC __rglgen_glVertexAttrib4dvARB; +RGLSYMGLVERTEXATTRIB4FARBPROC __rglgen_glVertexAttrib4fARB; +RGLSYMGLVERTEXATTRIB4FVARBPROC __rglgen_glVertexAttrib4fvARB; +RGLSYMGLVERTEXATTRIB4IVARBPROC __rglgen_glVertexAttrib4ivARB; +RGLSYMGLVERTEXATTRIB4SARBPROC __rglgen_glVertexAttrib4sARB; +RGLSYMGLVERTEXATTRIB4SVARBPROC __rglgen_glVertexAttrib4svARB; +RGLSYMGLVERTEXATTRIB4UBVARBPROC __rglgen_glVertexAttrib4ubvARB; +RGLSYMGLVERTEXATTRIB4UIVARBPROC __rglgen_glVertexAttrib4uivARB; +RGLSYMGLVERTEXATTRIB4USVARBPROC __rglgen_glVertexAttrib4usvARB; +RGLSYMGLVERTEXATTRIBPOINTERARBPROC __rglgen_glVertexAttribPointerARB; +RGLSYMGLENABLEVERTEXATTRIBARRAYARBPROC __rglgen_glEnableVertexAttribArrayARB; +RGLSYMGLDISABLEVERTEXATTRIBARRAYARBPROC __rglgen_glDisableVertexAttribArrayARB; +RGLSYMGLGETVERTEXATTRIBDVARBPROC __rglgen_glGetVertexAttribdvARB; +RGLSYMGLGETVERTEXATTRIBFVARBPROC __rglgen_glGetVertexAttribfvARB; +RGLSYMGLGETVERTEXATTRIBIVARBPROC __rglgen_glGetVertexAttribivARB; +RGLSYMGLGETVERTEXATTRIBPOINTERVARBPROC __rglgen_glGetVertexAttribPointervARB; +RGLSYMGLBINDATTRIBLOCATIONARBPROC __rglgen_glBindAttribLocationARB; +RGLSYMGLGETACTIVEATTRIBARBPROC __rglgen_glGetActiveAttribARB; +RGLSYMGLGETATTRIBLOCATIONARBPROC __rglgen_glGetAttribLocationARB; +RGLSYMGLWINDOWPOS2DARBPROC __rglgen_glWindowPos2dARB; +RGLSYMGLWINDOWPOS2DVARBPROC __rglgen_glWindowPos2dvARB; +RGLSYMGLWINDOWPOS2FARBPROC __rglgen_glWindowPos2fARB; +RGLSYMGLWINDOWPOS2FVARBPROC __rglgen_glWindowPos2fvARB; +RGLSYMGLWINDOWPOS2IARBPROC __rglgen_glWindowPos2iARB; +RGLSYMGLWINDOWPOS2IVARBPROC __rglgen_glWindowPos2ivARB; +RGLSYMGLWINDOWPOS2SARBPROC __rglgen_glWindowPos2sARB; +RGLSYMGLWINDOWPOS2SVARBPROC __rglgen_glWindowPos2svARB; +RGLSYMGLWINDOWPOS3DARBPROC __rglgen_glWindowPos3dARB; +RGLSYMGLWINDOWPOS3DVARBPROC __rglgen_glWindowPos3dvARB; +RGLSYMGLWINDOWPOS3FARBPROC __rglgen_glWindowPos3fARB; +RGLSYMGLWINDOWPOS3FVARBPROC __rglgen_glWindowPos3fvARB; +RGLSYMGLWINDOWPOS3IARBPROC __rglgen_glWindowPos3iARB; +RGLSYMGLWINDOWPOS3IVARBPROC __rglgen_glWindowPos3ivARB; +RGLSYMGLWINDOWPOS3SARBPROC __rglgen_glWindowPos3sARB; +RGLSYMGLWINDOWPOS3SVARBPROC __rglgen_glWindowPos3svARB; +RGLSYMGLMULTITEXCOORD1BOESPROC __rglgen_glMultiTexCoord1bOES; +RGLSYMGLMULTITEXCOORD1BVOESPROC __rglgen_glMultiTexCoord1bvOES; +RGLSYMGLMULTITEXCOORD2BOESPROC __rglgen_glMultiTexCoord2bOES; +RGLSYMGLMULTITEXCOORD2BVOESPROC __rglgen_glMultiTexCoord2bvOES; +RGLSYMGLMULTITEXCOORD3BOESPROC __rglgen_glMultiTexCoord3bOES; +RGLSYMGLMULTITEXCOORD3BVOESPROC __rglgen_glMultiTexCoord3bvOES; +RGLSYMGLMULTITEXCOORD4BOESPROC __rglgen_glMultiTexCoord4bOES; +RGLSYMGLMULTITEXCOORD4BVOESPROC __rglgen_glMultiTexCoord4bvOES; +RGLSYMGLTEXCOORD1BOESPROC __rglgen_glTexCoord1bOES; +RGLSYMGLTEXCOORD1BVOESPROC __rglgen_glTexCoord1bvOES; +RGLSYMGLTEXCOORD2BOESPROC __rglgen_glTexCoord2bOES; +RGLSYMGLTEXCOORD2BVOESPROC __rglgen_glTexCoord2bvOES; +RGLSYMGLTEXCOORD3BOESPROC __rglgen_glTexCoord3bOES; +RGLSYMGLTEXCOORD3BVOESPROC __rglgen_glTexCoord3bvOES; +RGLSYMGLTEXCOORD4BOESPROC __rglgen_glTexCoord4bOES; +RGLSYMGLTEXCOORD4BVOESPROC __rglgen_glTexCoord4bvOES; +RGLSYMGLVERTEX2BOESPROC __rglgen_glVertex2bOES; +RGLSYMGLVERTEX2BVOESPROC __rglgen_glVertex2bvOES; +RGLSYMGLVERTEX3BOESPROC __rglgen_glVertex3bOES; +RGLSYMGLVERTEX3BVOESPROC __rglgen_glVertex3bvOES; +RGLSYMGLVERTEX4BOESPROC __rglgen_glVertex4bOES; +RGLSYMGLVERTEX4BVOESPROC __rglgen_glVertex4bvOES; +RGLSYMGLALPHAFUNCXOESPROC __rglgen_glAlphaFuncxOES; +RGLSYMGLCLEARCOLORXOESPROC __rglgen_glClearColorxOES; +RGLSYMGLCLEARDEPTHXOESPROC __rglgen_glClearDepthxOES; +RGLSYMGLCLIPPLANEXOESPROC __rglgen_glClipPlanexOES; +RGLSYMGLCOLOR4XOESPROC __rglgen_glColor4xOES; +RGLSYMGLDEPTHRANGEXOESPROC __rglgen_glDepthRangexOES; +RGLSYMGLFOGXOESPROC __rglgen_glFogxOES; +RGLSYMGLFOGXVOESPROC __rglgen_glFogxvOES; +RGLSYMGLFRUSTUMXOESPROC __rglgen_glFrustumxOES; +RGLSYMGLGETCLIPPLANEXOESPROC __rglgen_glGetClipPlanexOES; +RGLSYMGLGETFIXEDVOESPROC __rglgen_glGetFixedvOES; +RGLSYMGLGETTEXENVXVOESPROC __rglgen_glGetTexEnvxvOES; +RGLSYMGLGETTEXPARAMETERXVOESPROC __rglgen_glGetTexParameterxvOES; +RGLSYMGLLIGHTMODELXOESPROC __rglgen_glLightModelxOES; +RGLSYMGLLIGHTMODELXVOESPROC __rglgen_glLightModelxvOES; +RGLSYMGLLIGHTXOESPROC __rglgen_glLightxOES; +RGLSYMGLLIGHTXVOESPROC __rglgen_glLightxvOES; +RGLSYMGLLINEWIDTHXOESPROC __rglgen_glLineWidthxOES; +RGLSYMGLLOADMATRIXXOESPROC __rglgen_glLoadMatrixxOES; +RGLSYMGLMATERIALXOESPROC __rglgen_glMaterialxOES; +RGLSYMGLMATERIALXVOESPROC __rglgen_glMaterialxvOES; +RGLSYMGLMULTMATRIXXOESPROC __rglgen_glMultMatrixxOES; +RGLSYMGLMULTITEXCOORD4XOESPROC __rglgen_glMultiTexCoord4xOES; +RGLSYMGLNORMAL3XOESPROC __rglgen_glNormal3xOES; +RGLSYMGLORTHOXOESPROC __rglgen_glOrthoxOES; +RGLSYMGLPOINTPARAMETERXVOESPROC __rglgen_glPointParameterxvOES; +RGLSYMGLPOINTSIZEXOESPROC __rglgen_glPointSizexOES; +RGLSYMGLPOLYGONOFFSETXOESPROC __rglgen_glPolygonOffsetxOES; +RGLSYMGLROTATEXOESPROC __rglgen_glRotatexOES; +RGLSYMGLSAMPLECOVERAGEOESPROC __rglgen_glSampleCoverageOES; +RGLSYMGLSCALEXOESPROC __rglgen_glScalexOES; +RGLSYMGLTEXENVXOESPROC __rglgen_glTexEnvxOES; +RGLSYMGLTEXENVXVOESPROC __rglgen_glTexEnvxvOES; +RGLSYMGLTEXPARAMETERXOESPROC __rglgen_glTexParameterxOES; +RGLSYMGLTEXPARAMETERXVOESPROC __rglgen_glTexParameterxvOES; +RGLSYMGLTRANSLATEXOESPROC __rglgen_glTranslatexOES; +RGLSYMGLACCUMXOESPROC __rglgen_glAccumxOES; +RGLSYMGLBITMAPXOESPROC __rglgen_glBitmapxOES; +RGLSYMGLBLENDCOLORXOESPROC __rglgen_glBlendColorxOES; +RGLSYMGLCLEARACCUMXOESPROC __rglgen_glClearAccumxOES; +RGLSYMGLCOLOR3XOESPROC __rglgen_glColor3xOES; +RGLSYMGLCOLOR3XVOESPROC __rglgen_glColor3xvOES; +RGLSYMGLCOLOR4XVOESPROC __rglgen_glColor4xvOES; +RGLSYMGLCONVOLUTIONPARAMETERXOESPROC __rglgen_glConvolutionParameterxOES; +RGLSYMGLCONVOLUTIONPARAMETERXVOESPROC __rglgen_glConvolutionParameterxvOES; +RGLSYMGLEVALCOORD1XOESPROC __rglgen_glEvalCoord1xOES; +RGLSYMGLEVALCOORD1XVOESPROC __rglgen_glEvalCoord1xvOES; +RGLSYMGLEVALCOORD2XOESPROC __rglgen_glEvalCoord2xOES; +RGLSYMGLEVALCOORD2XVOESPROC __rglgen_glEvalCoord2xvOES; +RGLSYMGLFEEDBACKBUFFERXOESPROC __rglgen_glFeedbackBufferxOES; +RGLSYMGLGETCONVOLUTIONPARAMETERXVOESPROC __rglgen_glGetConvolutionParameterxvOES; +RGLSYMGLGETHISTOGRAMPARAMETERXVOESPROC __rglgen_glGetHistogramParameterxvOES; +RGLSYMGLGETLIGHTXOESPROC __rglgen_glGetLightxOES; +RGLSYMGLGETMAPXVOESPROC __rglgen_glGetMapxvOES; +RGLSYMGLGETMATERIALXOESPROC __rglgen_glGetMaterialxOES; +RGLSYMGLGETPIXELMAPXVPROC __rglgen_glGetPixelMapxv; +RGLSYMGLGETTEXGENXVOESPROC __rglgen_glGetTexGenxvOES; +RGLSYMGLGETTEXLEVELPARAMETERXVOESPROC __rglgen_glGetTexLevelParameterxvOES; +RGLSYMGLINDEXXOESPROC __rglgen_glIndexxOES; +RGLSYMGLINDEXXVOESPROC __rglgen_glIndexxvOES; +RGLSYMGLLOADTRANSPOSEMATRIXXOESPROC __rglgen_glLoadTransposeMatrixxOES; +RGLSYMGLMAP1XOESPROC __rglgen_glMap1xOES; +RGLSYMGLMAP2XOESPROC __rglgen_glMap2xOES; +RGLSYMGLMAPGRID1XOESPROC __rglgen_glMapGrid1xOES; +RGLSYMGLMAPGRID2XOESPROC __rglgen_glMapGrid2xOES; +RGLSYMGLMULTTRANSPOSEMATRIXXOESPROC __rglgen_glMultTransposeMatrixxOES; +RGLSYMGLMULTITEXCOORD1XOESPROC __rglgen_glMultiTexCoord1xOES; +RGLSYMGLMULTITEXCOORD1XVOESPROC __rglgen_glMultiTexCoord1xvOES; +RGLSYMGLMULTITEXCOORD2XOESPROC __rglgen_glMultiTexCoord2xOES; +RGLSYMGLMULTITEXCOORD2XVOESPROC __rglgen_glMultiTexCoord2xvOES; +RGLSYMGLMULTITEXCOORD3XOESPROC __rglgen_glMultiTexCoord3xOES; +RGLSYMGLMULTITEXCOORD3XVOESPROC __rglgen_glMultiTexCoord3xvOES; +RGLSYMGLMULTITEXCOORD4XVOESPROC __rglgen_glMultiTexCoord4xvOES; +RGLSYMGLNORMAL3XVOESPROC __rglgen_glNormal3xvOES; +RGLSYMGLPASSTHROUGHXOESPROC __rglgen_glPassThroughxOES; +RGLSYMGLPIXELMAPXPROC __rglgen_glPixelMapx; +RGLSYMGLPIXELSTOREXPROC __rglgen_glPixelStorex; +RGLSYMGLPIXELTRANSFERXOESPROC __rglgen_glPixelTransferxOES; +RGLSYMGLPIXELZOOMXOESPROC __rglgen_glPixelZoomxOES; +RGLSYMGLPRIORITIZETEXTURESXOESPROC __rglgen_glPrioritizeTexturesxOES; +RGLSYMGLRASTERPOS2XOESPROC __rglgen_glRasterPos2xOES; +RGLSYMGLRASTERPOS2XVOESPROC __rglgen_glRasterPos2xvOES; +RGLSYMGLRASTERPOS3XOESPROC __rglgen_glRasterPos3xOES; +RGLSYMGLRASTERPOS3XVOESPROC __rglgen_glRasterPos3xvOES; +RGLSYMGLRASTERPOS4XOESPROC __rglgen_glRasterPos4xOES; +RGLSYMGLRASTERPOS4XVOESPROC __rglgen_glRasterPos4xvOES; +RGLSYMGLRECTXOESPROC __rglgen_glRectxOES; +RGLSYMGLRECTXVOESPROC __rglgen_glRectxvOES; +RGLSYMGLTEXCOORD1XOESPROC __rglgen_glTexCoord1xOES; +RGLSYMGLTEXCOORD1XVOESPROC __rglgen_glTexCoord1xvOES; +RGLSYMGLTEXCOORD2XOESPROC __rglgen_glTexCoord2xOES; +RGLSYMGLTEXCOORD2XVOESPROC __rglgen_glTexCoord2xvOES; +RGLSYMGLTEXCOORD3XOESPROC __rglgen_glTexCoord3xOES; +RGLSYMGLTEXCOORD3XVOESPROC __rglgen_glTexCoord3xvOES; +RGLSYMGLTEXCOORD4XOESPROC __rglgen_glTexCoord4xOES; +RGLSYMGLTEXCOORD4XVOESPROC __rglgen_glTexCoord4xvOES; +RGLSYMGLTEXGENXOESPROC __rglgen_glTexGenxOES; +RGLSYMGLTEXGENXVOESPROC __rglgen_glTexGenxvOES; +RGLSYMGLVERTEX2XOESPROC __rglgen_glVertex2xOES; +RGLSYMGLVERTEX2XVOESPROC __rglgen_glVertex2xvOES; +RGLSYMGLVERTEX3XOESPROC __rglgen_glVertex3xOES; +RGLSYMGLVERTEX3XVOESPROC __rglgen_glVertex3xvOES; +RGLSYMGLVERTEX4XOESPROC __rglgen_glVertex4xOES; +RGLSYMGLVERTEX4XVOESPROC __rglgen_glVertex4xvOES; +RGLSYMGLQUERYMATRIXXOESPROC __rglgen_glQueryMatrixxOES; +RGLSYMGLCLEARDEPTHFOESPROC __rglgen_glClearDepthfOES; +RGLSYMGLCLIPPLANEFOESPROC __rglgen_glClipPlanefOES; +RGLSYMGLDEPTHRANGEFOESPROC __rglgen_glDepthRangefOES; +RGLSYMGLFRUSTUMFOESPROC __rglgen_glFrustumfOES; +RGLSYMGLGETCLIPPLANEFOESPROC __rglgen_glGetClipPlanefOES; +RGLSYMGLORTHOFOESPROC __rglgen_glOrthofOES; +RGLSYMGLIMAGETRANSFORMPARAMETERIHPPROC __rglgen_glImageTransformParameteriHP; +RGLSYMGLIMAGETRANSFORMPARAMETERFHPPROC __rglgen_glImageTransformParameterfHP; +RGLSYMGLIMAGETRANSFORMPARAMETERIVHPPROC __rglgen_glImageTransformParameterivHP; +RGLSYMGLIMAGETRANSFORMPARAMETERFVHPPROC __rglgen_glImageTransformParameterfvHP; +RGLSYMGLGETIMAGETRANSFORMPARAMETERIVHPPROC __rglgen_glGetImageTransformParameterivHP; +RGLSYMGLGETIMAGETRANSFORMPARAMETERFVHPPROC __rglgen_glGetImageTransformParameterfvHP; + diff --git a/desmume/src/libretro-common/glsym/rglgen.c b/desmume/src/libretro-common/glsym/rglgen.c new file mode 100644 index 000000000..29403c9d0 --- /dev/null +++ b/desmume/src/libretro-common/glsym/rglgen.c @@ -0,0 +1,43 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this libretro SDK code part (glsym). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include + +#include +#include + +void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, + const struct rglgen_sym_map *map) +{ + for (; map->sym; map++) + { + rglgen_func_t func = proc(map->sym); + memcpy(map->ptr, &func, sizeof(func)); + } +} + +void rglgen_resolve_symbols(rglgen_proc_address_t proc) +{ + rglgen_resolve_symbols_custom(proc, rglgen_symbol_map); +} + diff --git a/desmume/src/libretro-common/hash/rhash.c b/desmume/src/libretro-common/hash/rhash.c new file mode 100644 index 000000000..8effcb226 --- /dev/null +++ b/desmume/src/libretro-common/hash/rhash.c @@ -0,0 +1,550 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rhash.c). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#ifdef _WIN32 +#include +#else +#include +#endif +#include +#include +#include +#include + +#define LSL32(x, n) ((uint32_t)(x) << (n)) +#define LSR32(x, n) ((uint32_t)(x) >> (n)) +#define ROR32(x, n) (LSR32(x, n) | LSL32(x, 32 - (n))) + +/* First 32 bits of the fractional parts of the square roots of the first 8 primes 2..19 */ +static const uint32_t T_H[8] = { + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19, +}; + +/* First 32 bits of the fractional parts of the cube roots of the first 64 primes 2..311 */ +static const uint32_t T_K[64] = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2, +}; + +/* SHA256 implementation from bSNES. Written by valditx. */ + +struct sha256_ctx +{ + union + { + uint8_t u8[64]; + uint32_t u32[16]; + } in; + unsigned inlen; + + uint32_t w[64]; + uint32_t h[8]; + uint64_t len; +}; + +static void sha256_init(struct sha256_ctx *p) +{ + memset(p, 0, sizeof(struct sha256_ctx)); + memcpy(p->h, T_H, sizeof(T_H)); +} + +static void sha256_block(struct sha256_ctx *p) +{ + unsigned i; + uint32_t s0, s1; + uint32_t a, b, c, d, e, f, g, h; + uint32_t t1, t2, maj, ch; + + for (i = 0; i < 16; i++) + p->w[i] = load32be(p->in.u32 + i); + + for (i = 16; i < 64; i++) + { + s0 = ROR32(p->w[i - 15], 7) ^ ROR32(p->w[i - 15], 18) ^ LSR32(p->w[i - 15], 3); + s1 = ROR32(p->w[i - 2], 17) ^ ROR32(p->w[i - 2], 19) ^ LSR32(p->w[i - 2], 10); + p->w[i] = p->w[i - 16] + s0 + p->w[i - 7] + s1; + } + + a = p->h[0]; b = p->h[1]; c = p->h[2]; d = p->h[3]; + e = p->h[4]; f = p->h[5]; g = p->h[6]; h = p->h[7]; + + for (i = 0; i < 64; i++) + { + s0 = ROR32(a, 2) ^ ROR32(a, 13) ^ ROR32(a, 22); + maj = (a & b) ^ (a & c) ^ (b & c); + t2 = s0 + maj; + s1 = ROR32(e, 6) ^ ROR32(e, 11) ^ ROR32(e, 25); + ch = (e & f) ^ (~e & g); + t1 = h + s1 + ch + T_K[i] + p->w[i]; + + h = g; g = f; f = e; e = d + t1; + d = c; c = b; b = a; a = t1 + t2; + } + + p->h[0] += a; p->h[1] += b; p->h[2] += c; p->h[3] += d; + p->h[4] += e; p->h[5] += f; p->h[6] += g; p->h[7] += h; + + /* Next block */ + p->inlen = 0; +} + +static void sha256_chunk(struct sha256_ctx *p, + const uint8_t *s, unsigned len) +{ + unsigned l; + + p->len += len; + + while (len) + { + l = 64 - p->inlen; + l = (len < l) ? len : l; + + memcpy(p->in.u8 + p->inlen, s, l); + + s += l; + p->inlen += l; + len -= l; + + if (p->inlen == 64) + sha256_block(p); + } +} + +static void sha256_final(struct sha256_ctx *p) +{ + uint64_t len; + p->in.u8[p->inlen++] = 0x80; + + if (p->inlen > 56) + { + memset(p->in.u8 + p->inlen, 0, 64 - p->inlen); + sha256_block(p); + } + + memset(p->in.u8 + p->inlen, 0, 56 - p->inlen); + + len = p->len << 3; + store32be(p->in.u32 + 14, (uint32_t)(len >> 32)); + store32be(p->in.u32 + 15, (uint32_t)len); + sha256_block(p); +} + +static void sha256_subhash(struct sha256_ctx *p, uint32_t *t) +{ + unsigned i; + for (i = 0; i < 8; i++) + store32be(t++, p->h[i]); +} + +/** + * sha256_hash: + * @s : Output. + * @in : Input. + * @size : Size of @s. + * + * Hashes SHA256 and outputs a human readable string. + **/ +void sha256_hash(char *s, const uint8_t *in, size_t size) +{ + unsigned i; + struct sha256_ctx sha; + + union + { + uint32_t u32[8]; + uint8_t u8[32]; + } shahash; + + sha256_init(&sha); + sha256_chunk(&sha, in, size); + sha256_final(&sha); + sha256_subhash(&sha, shahash.u32); + + for (i = 0; i < 32; i++) + snprintf(s + 2 * i, 3, "%02x", (unsigned)shahash.u8[i]); +} + +#ifndef HAVE_ZLIB +/* Zlib CRC32. */ +static const uint32_t crc32_table[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +uint32_t crc32_adjust(uint32_t checksum, uint8_t input) +{ + return ((checksum >> 8) & 0x00ffffff) ^ crc32_table[(checksum ^ input) & 0xff]; +} + +uint32_t crc32_calculate(const uint8_t *data, size_t length) +{ + size_t i; + uint32_t checksum = ~0; + for (i = 0; i < length; i++) + checksum = crc32_adjust(checksum, data[i]); + return ~checksum; +} +#endif + +/* SHA-1 implementation. */ + +/* + * sha1.c + * + * Copyright (C) 1998, 2009 + * Paul E. Jones + * All Rights Reserved + * + ***************************************************************************** + * $Id: sha1.c 12 2009-06-22 19:34:25Z paulej $ + ***************************************************************************** + * + * Description: + * This file implements the Secure Hashing Standard as defined + * in FIPS PUB 180-1 published April 17, 1995. + * + * The Secure Hashing Standard, which uses the Secure Hashing + * Algorithm (SHA), produces a 160-bit message digest for a + * given data stream. In theory, it is highly improbable that + * two messages will produce the same message digest. Therefore, + * this algorithm can serve as a means of providing a "fingerprint" + * for a message. + * + * Portability Issues: + * SHA-1 is defined in terms of 32-bit "words". This code was + * written with the expectation that the processor has at least + * a 32-bit machine word size. If the machine word size is larger, + * the code should still function properly. One caveat to that + * is that the input functions taking characters and character + * arrays assume that only 8 bits of information are stored in each + * character. + * + * Caveats: + * SHA-1 is designed to work with messages less than 2^64 bits + * long. Although SHA-1 allows a message digest to be generated for + * messages of any number of bits less than 2^64, this + * implementation only works with messages with a length that is a + * multiple of the size of an 8-bit character. + * + */ + +/* Define the circular shift macro */ +#define SHA1CircularShift(bits,word) ((((word) << (bits)) & 0xFFFFFFFF) | ((word) >> (32-(bits)))) + +static void SHA1Reset(SHA1Context *context) +{ + if (!context) + return; + + context->Length_Low = 0; + context->Length_High = 0; + context->Message_Block_Index = 0; + + context->Message_Digest[0] = 0x67452301; + context->Message_Digest[1] = 0xEFCDAB89; + context->Message_Digest[2] = 0x98BADCFE; + context->Message_Digest[3] = 0x10325476; + context->Message_Digest[4] = 0xC3D2E1F0; + + context->Computed = 0; + context->Corrupted = 0; +} + +static void SHA1ProcessMessageBlock(SHA1Context *context) +{ + const unsigned K[] = /* Constants defined in SHA-1 */ + { + 0x5A827999, + 0x6ED9EBA1, + 0x8F1BBCDC, + 0xCA62C1D6 + }; + int t; /* Loop counter */ + unsigned temp; /* Temporary word value */ + unsigned W[80]; /* Word sequence */ + unsigned A, B, C, D, E; /* Word buffers */ + + /* Initialize the first 16 words in the array W */ + for(t = 0; t < 16; t++) + { + W[t] = ((unsigned) context->Message_Block[t * 4]) << 24; + W[t] |= ((unsigned) context->Message_Block[t * 4 + 1]) << 16; + W[t] |= ((unsigned) context->Message_Block[t * 4 + 2]) << 8; + W[t] |= ((unsigned) context->Message_Block[t * 4 + 3]); + } + + for(t = 16; t < 80; t++) + W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); + + A = context->Message_Digest[0]; + B = context->Message_Digest[1]; + C = context->Message_Digest[2]; + D = context->Message_Digest[3]; + E = context->Message_Digest[4]; + + for(t = 0; t < 20; t++) + { + temp = SHA1CircularShift(5,A) + + ((B & C) | ((~B) & D)) + E + W[t] + K[0]; + temp &= 0xFFFFFFFF; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + for(t = 20; t < 40; t++) + { + temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1]; + temp &= 0xFFFFFFFF; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + for(t = 40; t < 60; t++) + { + temp = SHA1CircularShift(5,A) + + ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2]; + temp &= 0xFFFFFFFF; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + for(t = 60; t < 80; t++) + { + temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3]; + temp &= 0xFFFFFFFF; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + context->Message_Digest[0] = + (context->Message_Digest[0] + A) & 0xFFFFFFFF; + context->Message_Digest[1] = + (context->Message_Digest[1] + B) & 0xFFFFFFFF; + context->Message_Digest[2] = + (context->Message_Digest[2] + C) & 0xFFFFFFFF; + context->Message_Digest[3] = + (context->Message_Digest[3] + D) & 0xFFFFFFFF; + context->Message_Digest[4] = + (context->Message_Digest[4] + E) & 0xFFFFFFFF; + + context->Message_Block_Index = 0; +} + +static void SHA1PadMessage(SHA1Context *context) +{ + if (!context) + return; + + /* + * Check to see if the current message block is too small to hold + * the initial padding bits and length. If so, we will pad the + * block, process it, and then continue padding into a second + * block. + */ + context->Message_Block[context->Message_Block_Index++] = 0x80; + + if (context->Message_Block_Index > 55) + { + while(context->Message_Block_Index < 64) + context->Message_Block[context->Message_Block_Index++] = 0; + + SHA1ProcessMessageBlock(context); + } + + while(context->Message_Block_Index < 56) + context->Message_Block[context->Message_Block_Index++] = 0; + + /* Store the message length as the last 8 octets */ + context->Message_Block[56] = (context->Length_High >> 24) & 0xFF; + context->Message_Block[57] = (context->Length_High >> 16) & 0xFF; + context->Message_Block[58] = (context->Length_High >> 8) & 0xFF; + context->Message_Block[59] = (context->Length_High) & 0xFF; + context->Message_Block[60] = (context->Length_Low >> 24) & 0xFF; + context->Message_Block[61] = (context->Length_Low >> 16) & 0xFF; + context->Message_Block[62] = (context->Length_Low >> 8) & 0xFF; + context->Message_Block[63] = (context->Length_Low) & 0xFF; + + SHA1ProcessMessageBlock(context); +} + +static int SHA1Result(SHA1Context *context) +{ + if (context->Corrupted) + return 0; + + if (!context->Computed) + { + SHA1PadMessage(context); + context->Computed = 1; + } + + return 1; +} + +static void SHA1Input(SHA1Context *context, + const unsigned char *message_array, + unsigned length) +{ + if (!length) + return; + + if (context->Computed || context->Corrupted) + { + context->Corrupted = 1; + return; + } + + while(length-- && !context->Corrupted) + { + context->Message_Block[context->Message_Block_Index++] = + (*message_array & 0xFF); + + context->Length_Low += 8; + /* Force it to 32 bits */ + context->Length_Low &= 0xFFFFFFFF; + if (context->Length_Low == 0) + { + context->Length_High++; + /* Force it to 32 bits */ + context->Length_High &= 0xFFFFFFFF; + if (context->Length_High == 0) + context->Corrupted = 1; /* Message is too long */ + } + + if (context->Message_Block_Index == 64) + SHA1ProcessMessageBlock(context); + + message_array++; + } +} + +int sha1_calculate(const char *path, char *result) +{ + unsigned char buff[4096] = {0}; + SHA1Context sha; + int rv = 1; + RFILE *fd = retro_fopen(path, RFILE_MODE_READ, -1); + + if (!fd) + goto error; + + SHA1Reset(&sha); + + do + { + rv = retro_fread(fd, buff, 4096); + if (rv < 0) + goto error; + + SHA1Input(&sha, buff, rv); + }while(rv); + + if (!SHA1Result(&sha)) + goto error; + + sprintf(result, "%08X%08X%08X%08X%08X", + sha.Message_Digest[0], + sha.Message_Digest[1], + sha.Message_Digest[2], + sha.Message_Digest[3], sha.Message_Digest[4]); + + retro_fclose(fd); + return 0; + +error: + if (fd) + retro_fclose(fd); + return -1; +} + +uint32_t djb2_calculate(const char *str) +{ + const unsigned char *aux = (const unsigned char*)str; + uint32_t hash = 5381; + + while ( *aux ) + hash = ( hash << 5 ) + hash + *aux++; + + return hash; +} diff --git a/desmume/src/libretro-common/include/boolean.h b/desmume/src/libretro-common/include/boolean.h new file mode 100644 index 000000000..6ce2b83c6 --- /dev/null +++ b/desmume/src/libretro-common/include/boolean.h @@ -0,0 +1,39 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (boolean.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_BOOLEAN_H +#define __LIBRETRO_SDK_BOOLEAN_H + +#ifndef __cplusplus + +#if defined(_MSC_VER) && !defined(SN_TARGET_PS3) +/* Hack applied for MSVC when compiling in C89 mode as it isn't C99 compliant. */ +#define bool unsigned char +#define true 1 +#define false 0 +#else +#include +#endif + +#endif + +#endif diff --git a/desmume/src/libretro-common/include/clamping.h b/desmume/src/libretro-common/include/clamping.h new file mode 100644 index 000000000..8c12fc70f --- /dev/null +++ b/desmume/src/libretro-common/include/clamping.h @@ -0,0 +1,65 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (boolean.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _LIBRETRO_SDK_CLAMPING_H +#define _LIBRETRO_SDK_CLAMPING_H + +#include +#include + +/** + * clamp_float: + * @val : initial value + * @lower : lower limit that value should be clamped against + * @upper : upper limit that value should be clamped against + * + * Clamps a floating point value. + * + * Returns: a clamped value of initial float value @val. + */ +static INLINE float clamp_float(float val, float lower, float upper) +{ + if (val < lower) + return lower; + if (val > upper) + return upper; + return val; +} + +/** + * clamp_8bit: + * @val : initial value + * + * Clamps an unsigned 8-bit value. + * + * Returns: a clamped value of initial unsigned 8-bit value @val. + */ +static INLINE uint8_t clamp_8bit(int val) +{ + if (val > 255) + return 255; + if (val < 0) + return 0; + return (uint8_t)val; +} + +#endif diff --git a/desmume/src/libretro-common/include/compat/apple_compat.h b/desmume/src/libretro-common/include/compat/apple_compat.h new file mode 100644 index 000000000..7ca1e1592 --- /dev/null +++ b/desmume/src/libretro-common/include/compat/apple_compat.h @@ -0,0 +1,48 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (apple_compat.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifdef __APPLE__ +#include +#endif + +#ifdef __OBJC__ + +#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_4) +typedef int NSInteger; +typedef unsigned NSUInteger; +#endif + +#endif + +#ifdef IOS +#ifndef __IPHONE_5_0 +#warning "This project uses features only available in iOS SDK 5.0 and later." +#endif + +#ifdef __OBJC__ +#import +#import +#import + +#include +#endif +#endif diff --git a/desmume/src/libretro-common/include/compat/fnmatch.h b/desmume/src/libretro-common/include/compat/fnmatch.h new file mode 100644 index 000000000..99a6ae9b4 --- /dev/null +++ b/desmume/src/libretro-common/include/compat/fnmatch.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (compat_fnmatch.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_COMPAT_FNMATCH_H__ +#define __LIBRETRO_SDK_COMPAT_FNMATCH_H__ + +#define FNM_NOMATCH 1 + +int rl_fnmatch(const char *pattern, const char *string, int flags); + +#endif diff --git a/desmume/src/libretro-common/include/compat/getopt.h b/desmume/src/libretro-common/include/compat/getopt.h new file mode 100644 index 000000000..ae164e788 --- /dev/null +++ b/desmume/src/libretro-common/include/compat/getopt.h @@ -0,0 +1,66 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (compat_getopt.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_COMPAT_GETOPT_H +#define __LIBRETRO_SDK_COMPAT_GETOPT_H + +#if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H) +#include "../../../config.h" +#endif + +/* Custom implementation of the GNU getopt_long for portability. + * Not designed to be fully compatible, but compatible with + * the features RetroArch uses. */ + +#ifdef HAVE_GETOPT_LONG +#include +#else +/* Avoid possible naming collisions during link since we + * prefer to use the actual name. */ +#define getopt_long(argc, argv, optstring, longopts, longindex) __getopt_long_rarch(argc, argv, optstring, longopts, longindex) + +#ifdef __cplusplus +extern "C" { +#endif + +struct option +{ + const char *name; + int has_arg; + int *flag; + int val; +}; + +/* argv[] is declared with char * const argv[] in GNU, + * but this makes no sense, as non-POSIX getopt_long + * mutates argv (non-opts are moved to the end). */ +int getopt_long(int argc, char *argv[], + const char *optstring, const struct option *longopts, int *longindex); +extern char *optarg; +extern int optind, opterr, optopt; +#ifdef __cplusplus +} +#endif +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/compat/msvc.h b/desmume/src/libretro-common/include/compat/msvc.h new file mode 100644 index 000000000..91d9ad6ce --- /dev/null +++ b/desmume/src/libretro-common/include/compat/msvc.h @@ -0,0 +1,80 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (msvc_compat.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_COMPAT_MSVC_H +#define __LIBRETRO_SDK_COMPAT_MSVC_H + +#ifdef _MSC_VER + +/* Pre-MSVC 2015 compilers don't implement snprintf in a cross-platform manner. */ +#if _MSC_VER < 1900 +#ifndef snprintf +#define snprintf _snprintf +#endif +#endif + +#undef UNICODE /* Do not bother with UNICODE at this time. */ +#include +#include +#include + +/* Python headers defines ssize_t and sets HAVE_SSIZE_T. + * Cannot duplicate these efforts. + */ +#ifndef HAVE_SSIZE_T +#if defined(_WIN64) +typedef __int64 ssize_t; +#elif defined(_WIN32) +typedef int ssize_t; +#endif +#endif + +#define mkdir(dirname, unused) _mkdir(dirname) +#define strtoull _strtoui64 +#undef strcasecmp +#define strcasecmp(x,y) _stricmp(x,y) +#undef strncasecmp +#define strncasecmp(x, y, l) _strnicmp(x, y, l) + +/* Disable some of the annoying warnings. */ +#pragma warning(disable : 4800) +#pragma warning(disable : 4805) +#pragma warning(disable : 4244) +#pragma warning(disable : 4305) +#pragma warning(disable : 4146) +#pragma warning(disable : 4267) +#pragma warning(disable : 4723) +#pragma warning(disable : 4996) + +#define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f)) + +#ifndef PATH_MAX +#define PATH_MAX _MAX_PATH +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX _UI32_MAX +#endif + +#endif +#endif + diff --git a/desmume/src/libretro-common/include/compat/msvc/stdint.h b/desmume/src/libretro-common/include/compat/msvc/stdint.h new file mode 100644 index 000000000..403e1f73d --- /dev/null +++ b/desmume/src/libretro-common/include/compat/msvc/stdint.h @@ -0,0 +1,254 @@ +/* ISO C9x compliant stdint.h for Microsoft Visual Studio + * Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 + * + * Copyright (c) 2006-2008 Alexander Chemeris + * + * 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 name of the author may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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 __RARCH_STDINT_H +#define __RARCH_STDINT_H + +#if _MSC_VER && (_MSC_VER < 1600) +/* Pre-MSVC 2010 needs an implementation of stdint.h. */ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include + +/* For Visual Studio 6 in C++ mode and for many Visual Studio versions when + * compiling for ARM we should wrap include with 'extern "C++" {}' + * or compiler give many errors like this: + * + * error C2733: second C linkage of overloaded function 'wmemchr' not allowed + */ +#ifdef __cplusplus +extern "C" { +#endif +# include +#ifdef __cplusplus +} +#endif + +/* Define _W64 macros to mark types changing their size, like intptr_t. */ +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + +/* 7.18.1 Integer types. */ + +/* 7.18.1.1 Exact-width integer types. */ + +/* Visual Studio 6 and Embedded Visual C++ 4 doesn't + * realize that, e.g. char has the same size as __int8 + * so we give up on __intX for them. + */ +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + + +/* 7.18.1.2 Minimum-width integer types. */ +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +/* 7.18.1.3 Fastest minimum-width integer types. */ +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +/* 7.18.1.4 Integer types capable of holding object pointers. */ +#ifdef _WIN64 /* [ */ + typedef signed __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else /* _WIN64 ][ */ + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif /* _WIN64 ] */ + +/* 7.18.1.5 Greatest-width integer types. */ +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + +/* 7.18.2 Limits of specified-width integer types. */ + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) +/* [ See footnote 220 at page 257 and footnote 221 at page 259. */ + +/* 7.18.2.1 Limits of exact-width integer types. */ +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +/* 7.18.2.2 Limits of minimum-width integer types. */ +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +/* 7.18.2.3 Limits of fastest minimum-width integer types. */ +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +/* 7.18.2.4 Limits of integer types capable of holding object pointers. */ +#ifdef _WIN64 /* [ */ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else /* _WIN64 ][ */ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif /* _WIN64 ] */ + +/* 7.18.2.5 Limits of greatest-width integer types */ +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +/* 7.18.3 Limits of other integer types */ + +#ifdef _WIN64 /* [ */ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else /* _WIN64 ][ */ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif /* _WIN64 ] */ + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX /* [ */ +# ifdef _WIN64 /* [ */ +# define SIZE_MAX _UI64_MAX +# else /* _WIN64 ][ */ +# define SIZE_MAX _UI32_MAX +# endif /* _WIN64 ] */ +#endif /* SIZE_MAX ] */ + +/* WCHAR_MIN and WCHAR_MAX are also defined in */ +#ifndef WCHAR_MIN /* [ */ +# define WCHAR_MIN 0 +#endif /* WCHAR_MIN ] */ +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif /* WCHAR_MAX ] */ + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif /* __STDC_LIMIT_MACROS ] */ + +/* 7.18.4 Limits of other integer types */ + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) +/* [ See footnote 224 at page 260 */ + +/* 7.18.4.1 Macros for minimum-width integer constants */ + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +/* 7.18.4.2 Macros for greatest-width integer constants */ +#define INTMAX_C INT64_C +#define UINTMAX_C UINT64_C + +#endif +/* __STDC_CONSTANT_MACROS ] */ + +#else +/* Sanity for everything else. */ +#include +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/compat/posix_string.h b/desmume/src/libretro-common/include/compat/posix_string.h new file mode 100644 index 000000000..35c8efce6 --- /dev/null +++ b/desmume/src/libretro-common/include/compat/posix_string.h @@ -0,0 +1,53 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (posix_string.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_COMPAT_POSIX_STRING_H +#define __LIBRETRO_SDK_COMPAT_POSIX_STRING_H + +#ifdef _MSC_VER + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#undef strcasecmp +#undef strdup +#undef isblank +#undef strtok_r +#define strcasecmp(a, b) rarch_strcasecmp__(a, b) +#define strdup(orig) rarch_strdup__(orig) +#define isblank(c) rarch_isblank__(c) +#define strtok_r(str, delim, saveptr) rarch_strtok_r__(str, delim, saveptr) +int strcasecmp(const char *a, const char *b); +char *strdup(const char *orig); +int isblank(int c); +char *strtok_r(char *str, const char *delim, char **saveptr); + +#ifdef __cplusplus +} +#endif + +#endif +#endif + diff --git a/desmume/src/libretro-common/include/compat/strcasestr.h b/desmume/src/libretro-common/include/compat/strcasestr.h new file mode 100644 index 000000000..bd36835ee --- /dev/null +++ b/desmume/src/libretro-common/include/compat/strcasestr.h @@ -0,0 +1,49 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (strcasestr.h). * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_COMPAT_STRCASESTR_H +#define __LIBRETRO_SDK_COMPAT_STRCASESTR_H + +#include + +#if defined(RARCH_INTERNAL) && defined(HAVE_CONFIG_H) +#include "../../../config.h" +#endif + +#ifndef HAVE_STRCASESTR + +#ifdef __cplusplus +extern "C" { +#endif + +/* Avoid possible naming collisions during link + * since we prefer to use the actual name. */ +#define strcasestr(haystack, needle) strcasestr_rarch__(haystack, needle) + +char *strcasestr(const char *haystack, const char *needle); + +#ifdef __cplusplus +} +#endif +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/compat/strl.h b/desmume/src/libretro-common/include/compat/strl.h new file mode 100644 index 000000000..14a0c0320 --- /dev/null +++ b/desmume/src/libretro-common/include/compat/strl.h @@ -0,0 +1,54 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (strl.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_COMPAT_STRL_H +#define __LIBRETRO_SDK_COMPAT_STRL_H + +#include +#include + +#ifdef HAVE_CONFIG_H +#include "../../../config.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HAVE_STRL +/* Avoid possible naming collisions during link since + * we prefer to use the actual name. */ +#define strlcpy(dst, src, size) strlcpy_rarch__(dst, src, size) + +#define strlcat(dst, src, size) strlcat_rarch__(dst, src, size) + +size_t strlcpy(char *dest, const char *source, size_t size); +size_t strlcat(char *dest, const char *source, size_t size); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/compat/zlib.h b/desmume/src/libretro-common/include/compat/zlib.h new file mode 100644 index 000000000..bf3d53db4 --- /dev/null +++ b/desmume/src/libretro-common/include/compat/zlib.h @@ -0,0 +1,1774 @@ +#ifndef _COMPAT_ZLIB_H +#define _COMPAT_ZLIB_H + +#ifdef WANT_ZLIB + +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.8, April 28th, 2013 + + Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 + (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.8" +#define ZLIB_VERNUM 0x1280 +#define ZLIB_VER_MAJOR 1 +#define ZLIB_VER_MINOR 2 +#define ZLIB_VER_REVISION 8 +#define ZLIB_VER_SUBREVISION 0 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed data. + This version of the library supports only one compression method (deflation) + but other algorithms will be added later and will have the same stream + interface. + + Compression can be done in a single step if the buffers are large enough, + or can be done by repeated calls of the compression function. In the latter + case, the application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by default by the in-memory functions is + the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped + around a deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + This library can optionally read and write gzip streams in memory as well. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never crash + even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + z_const Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total number of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total number of bytes output so far */ + + z_const char *msg; /* last error message, NULL if no error */ + void *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: binary or text */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + gzip header information passed to and from zlib routines. See RFC 1952 + for more details on the meanings of these fields. +*/ +typedef struct gz_header_s { + int text; /* true if compressed data believed to be text */ + uLong time; /* modification time */ + int xflags; /* extra flags (not used when writing a gzip file) */ + int os; /* operating system */ + Bytef *extra; /* pointer to extra field or Z_NULL if none */ + uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ + uInt extra_max; /* space at extra (only when reading header) */ + Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ + uInt name_max; /* space at name (only when reading header) */ + Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ + uInt comm_max; /* space at comment (only when reading header) */ + int hcrc; /* true if there was or will be a header crc */ + int done; /* true when done reading gzip header (not used + when writing a gzip file) */ +} gz_header; + +typedef gz_header FAR *gz_headerp; + +/* + The application must update next_in and avail_in when avail_in has dropped + to zero. It must update next_out and avail_out when avail_out has dropped + to zero. The application must initialize zalloc, zfree and opaque before + calling the init function. All other fields are set by the compression + library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this if + the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers + returned by zalloc for objects of exactly 65536 bytes *must* have their + offset normalized to zero. The default allocation function provided by this + library ensures this (see zutil.c). To reduce memory requirements and avoid + any allocation of 64K objects, at the expense of compression ratio, compile + the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or progress + reports. After compression, total_in holds the total size of the + uncompressed data and may be saved for use in the decompressor (particularly + if the decompressor wants to decompress everything in a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +#define Z_TREES 6 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_FIXED 4 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_TEXT 1 +#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is not + compatible with the zlib.h header file used by the application. This check + is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. If + zalloc and zfree are set to Z_NULL, deflateInit updates them to use default + allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at all + (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION + requests a default compromise between speed and compression (currently + equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if level is not a valid compression level, or + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). msg is set to null + if there is no error message. deflateInit does not perform any compression: + this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). Some + output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating avail_in or avail_out accordingly; avail_out should + never be zero before the call. The application can consume the compressed + output when it wants, for example when the output buffer is full (avail_out + == 0), or after each call of deflate(). If deflate returns Z_OK and with + zero avail_out, it must be called again after making room in the output + buffer because there might be more output pending. + + Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to + decide how much data to accumulate before producing output, in order to + maximize compression. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In + particular avail_in is zero after the call if enough output space has been + provided before the call.) Flushing may degrade compression for some + compression algorithms and so it should be used only when necessary. This + completes the current deflate block and follows it with an empty stored block + that is three bits plus filler bits to the next byte, followed by four bytes + (00 00 ff ff). + + If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the + output buffer, but the output is not aligned to a byte boundary. All of the + input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. + This completes the current deflate block and follows it with an empty fixed + codes block that is 10 bits long. This assures that enough bytes are output + in order for the decompressor to finish the block before the empty fixed code + block. + + If flush is set to Z_BLOCK, a deflate block is completed and emitted, as + for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to + seven bits of the current block are held to be written as the next byte after + the next deflate block is completed. In this case, the decompressor may not + be provided enough bits at this point in order to complete decompression of + the data provided so far to the compressor. It may need to wait for the next + block to be emitted. This is for advanced applications that need to control + the emission of deflate blocks. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there was + enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the stream + are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least the + value returned by deflateBound (see below). Then deflate is guaranteed to + return Z_STREAM_END. If not enough output space is provided, deflate will + not return Z_STREAM_END, and it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update strm->data_type if it can make a good guess about + the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered + binary. This field is only for information purposes and does not affect the + compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, msg + may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the + exact value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit() does not process any header information -- that is deferred + until inflate() is called. +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing will + resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there is + no more input data or no more space in the output buffer (see below about + the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming more + output, and updating the next_* and avail_* values accordingly. The + application can consume the uncompressed output when it wants, for example + when the output buffer is full (avail_out == 0), or after each call of + inflate(). If inflate returns Z_OK and with zero avail_out, it must be + called again after making room in the output buffer because there might be + more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, + Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() + stop if and when it gets to the next deflate block boundary. When decoding + the zlib or gzip format, this will cause inflate() to return immediately + after the header and before the first block. When doing a raw inflate, + inflate() will go ahead and process the first block, and will return when it + gets to the end of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 if + inflate() is currently decoding the last block in the deflate stream, plus + 128 if inflate() returned immediately after decoding an end-of-block code or + decoding the complete header up to just before the first byte of the deflate + stream. The end-of-block will not be indicated until all of the uncompressed + data from that block has been written to strm->next_out. The number of + unused bits may in general be greater than seven, except when bit 7 of + data_type is set, in which case the number of unused bits will be less than + eight. data_type is set as noted here every time inflate() returns for all + flush options, and so can be used to determine the amount of currently + consumed input in bits. + + The Z_TREES option behaves as Z_BLOCK does, but it also returns when the + end of each deflate block header is reached, before any actual data in that + block is decoded. This allows the caller to determine the length of the + deflate block header for later use in random access within a deflate block. + 256 is added to the value of strm->data_type when inflate() returns + immediately after reaching the end of the deflate block header. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step (a + single call of inflate), the parameter flush should be set to Z_FINISH. In + this case all pending input is processed and all pending output is flushed; + avail_out must be large enough to hold all of the uncompressed data for the + operation to complete. (The size of the uncompressed data may have been + saved by the compressor for this purpose.) The use of Z_FINISH is not + required to perform an inflation in one step. However it may be used to + inform inflate that a faster approach can be used for the single inflate() + call. Z_FINISH also informs inflate to not maintain a sliding window if the + stream completes, which reduces inflate's memory footprint. If the stream + does not complete, either because not all of the stream is provided or not + enough output space is provided, then a sliding window will be allocated and + inflate() can be called again to continue the operation as if Z_NO_FLUSH had + been used. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the effects of the flush parameter in this implementation are + on the return value of inflate() as noted below, when inflate() returns early + when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of + memory for a sliding window when Z_FINISH is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm->adler to the Adler-32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the Adler-32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() can decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically, if requested when + initializing with inflateInit2(). Any information contained in the gzip + header is not retained, so applications that need that information should + instead use raw inflate, see inflateInit2() below, or inflateBack() and + perform their own processing of the gzip header and trailer. When processing + gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output + producted so far. The CRC-32 is checked against the gzip trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may + then call inflateSync() to look for a good compression block if a partial + recovery of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any pending + output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by the + caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), no + header crc, and the operating system will be set to 255 (unknown). If a + gzip stream is being written, strm->adler is a crc32 instead of an adler32. + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but is + slow and reduces compression ratio; memLevel=9 uses maximum memory for + optimal speed. The default value is 8. See zconf.h for total memory usage + as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as + fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The + strategy parameter only affects the compression ratio but not the + correctness of the compressed output even if it is not set appropriately. + Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler + decoder for special applications. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid + method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is + incompatible with the version assumed by the caller (ZLIB_VERSION). msg is + set to null if there is no error message. deflateInit2 does not perform any + compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. When using the zlib format, this + function must be called immediately after deflateInit, deflateInit2 or + deflateReset, and before any call of deflate. When doing raw deflate, this + function must be called either before any call of deflate, or immediately + after the completion of a deflate block, i.e. after all input has been + consumed and all output has been delivered when using any of the flush + options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The + compressor and decompressor must use exactly the same dictionary (see + inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size + provided in deflateInit or deflateInit2. Thus the strings most likely to be + useful should be put at the end of the dictionary, not at the front. In + addition, the current implementation of deflate will use at most the window + size minus 262 bytes of the provided dictionary. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if not at a block boundary for raw deflate). deflateSetDictionary does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and can + consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. The + stream will keep the same compression level and any other attributes that + may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different strategy. + If the compression level is changed, the input available so far is + compressed with the old level (and may be flushed); the new level will take + effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to be + compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if + strm->avail_out was zero. +*/ + +ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, + int good_length, + int max_lazy, + int nice_length, + int max_chain)); +/* + Fine tune deflate's internal compression parameters. This should only be + used by someone who understands the algorithm used by zlib's deflate for + searching for the best matching string, and even then only by the most + fanatic optimizer trying to squeeze out the last compressed bit for their + specific input data. Read the deflate.c source code for the meaning of the + max_lazy, good_length, nice_length, and max_chain parameters. + + deflateTune() can be called after deflateInit() or deflateInit2(), and + returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. + */ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() or + deflateInit2(), and after deflateSetHeader(), if used. This would be used + to allocate an output buffer for deflation in a single pass, and so would be + called before deflate(). If that first deflate() call is provided the + sourceLen input bytes, an output buffer allocated to the size returned by + deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed + to return Z_STREAM_END. Note that it is possible for the compressed size to + be larger than the value returned by deflateBound() if flush options other + than Z_FINISH or Z_NO_FLUSH are used. +*/ + +ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, + unsigned *pending, + int *bits)); +/* + deflatePending() returns the number of bytes and bits of output that have + been generated, but not yet provided in the available output. The bytes not + provided would be due to the available output space having being consumed. + The number of bits of output not provided are between 0 and 7, where they + await more bits to join them in order to fill out a full byte. If pending + or bits are Z_NULL, then those values are not set. + + deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. + */ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the bits + leftover from a previous deflate stream when appending to it. As such, this + function can only be used for raw deflate, and must be used before the first + deflate() call after a deflateInit2() or deflateReset(). bits must be less + than or equal to 16, and that many of the least significant bits of value + will be inserted in the output. + + deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough + room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, + gz_headerp head)); +/* + deflateSetHeader() provides gzip header information for when a gzip + stream is requested by deflateInit2(). deflateSetHeader() may be called + after deflateInit2() or deflateReset() and before the first call of + deflate(). The text, time, os, extra field, name, and comment information + in the provided gz_header structure are written to the gzip header (xflag is + ignored -- the extra flags are set according to the compression level). The + caller must assure that, if not Z_NULL, name and comment are terminated with + a zero byte, and that if extra is not Z_NULL, that extra_len bytes are + available there. If hcrc is true, a gzip header crc is included. Note that + the current versions of the command-line version of gzip (up through version + 1.3.x) do not support header crc's, and will report that it is a "multi-part + gzip file" and give up. + + If deflateSetHeader is not used, the default gzip header has text false, + the time set to zero, and os set to 255, with no extra, name, or comment + fields. The gzip header is returned to the default state by deflateReset(). + + deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be zero to request that inflate use the window size in + the zlib header of the compressed stream. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a + crc32 instead of an adler32. + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller, or Z_STREAM_ERROR if the parameters are + invalid, such as a null pointer to the structure. msg is set to null if + there is no error message. inflateInit2 does not perform any decompression + apart from possibly reading the zlib header if present: actual decompression + will be done by inflate(). (So next_in and avail_in may be modified, but + next_out and avail_out are unused and unchanged.) The current implementation + of inflateInit2() does not process any header information -- that is + deferred until inflate() is called. +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate, + if that call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by that call of inflate. + The compressor and decompressor must use exactly the same dictionary (see + deflateSetDictionary). For raw inflate, this function can be called at any + time to set the dictionary. If the provided dictionary is smaller than the + window and there is already data in the window, then the provided dictionary + will amend what's there. The application must insure that the dictionary + that was used for compression is provided. + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, + Bytef *dictionary, + uInt *dictLength)); +/* + Returns the sliding dictionary being maintained by inflate. dictLength is + set to the number of bytes in the dictionary, and that many bytes are copied + to dictionary. dictionary must have enough space, where 32768 bytes is + always enough. If inflateGetDictionary() is called with dictionary equal to + Z_NULL, then only the dictionary length is returned, and nothing is copied. + Similary, if dictLength is Z_NULL, then it is not set. + + inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the + stream state is inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a possible full flush point (see above + for the description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync searches for a 00 00 FF FF pattern in the compressed data. + All full flush points have this pattern, but not all occurrences of this + pattern are full flush points. + + inflateSync returns Z_OK if a possible full flush point has been found, + Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point + has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. + In the success case, the application may save the current current value of + total_in which indicates where valid compressed data was found. In the + error case, the application may repeatedly call inflateSync, providing more + input each time, until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being Z_NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. The + stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL). +*/ + +ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, + int windowBits)); +/* + This function is the same as inflateReset, but it also permits changing + the wrap and window size requests. The windowBits parameter is interpreted + the same as it is for inflateInit2. + + inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being Z_NULL), or if + the windowBits parameter is invalid. +*/ + +ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + This function inserts bits in the inflate input stream. The intent is + that this function is used to start inflating at a bit position in the + middle of a byte. The provided bits will be used before any bytes are used + from next_in. This function should only be used with raw inflate, and + should be used before the first inflate() call after inflateInit2() or + inflateReset(). bits must be less than or equal to 16, and that many of the + least significant bits of value will be inserted in the input. + + If bits is negative, then the input stream bit buffer is emptied. Then + inflatePrime() can be called again to put bits in the buffer. This is used + to clear out bits leftover after feeding inflate a block description prior + to feeding inflate codes. + + inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); +/* + This function returns two values, one in the lower 16 bits of the return + value, and the other in the remaining upper bits, obtained by shifting the + return value down 16 bits. If the upper value is -1 and the lower value is + zero, then inflate() is currently decoding information outside of a block. + If the upper value is -1 and the lower value is non-zero, then inflate is in + the middle of a stored block, with the lower value equaling the number of + bytes from the input remaining to copy. If the upper value is not -1, then + it is the number of bits back from the current bit position in the input of + the code (literal or length/distance pair) currently being processed. In + that case the lower value is the number of bytes already emitted for that + code. + + A code is being processed if inflate is waiting for more input to complete + decoding of the code, or if it has completed decoding but is waiting for + more output space to write the literal or match data. + + inflateMark() is used to mark locations in the input data for random + access, which may be at bit positions, and to note those cases where the + output of a code may span boundaries of random access blocks. The current + location in the input stream can be determined from avail_in and data_type + as noted in the description for the Z_BLOCK flush parameter for inflate. + + inflateMark returns the value noted above or -1 << 16 if the provided + source stream state was inconsistent. +*/ + +ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, + gz_headerp head)); +/* + inflateGetHeader() requests that gzip header information be stored in the + provided gz_header structure. inflateGetHeader() may be called after + inflateInit2() or inflateReset(), and before the first call of inflate(). + As inflate() processes the gzip stream, head->done is zero until the header + is completed, at which time head->done is set to one. If a zlib stream is + being decoded, then head->done is set to -1 to indicate that there will be + no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be + used to force inflate() to return immediately after header processing is + complete and before any actual data is decompressed. + + The text, time, xflags, and os fields are filled in with the gzip header + contents. hcrc is set to true if there is a header CRC. (The header CRC + was valid if done is set to one.) If extra is not Z_NULL, then extra_max + contains the maximum number of bytes to write to extra. Once done is true, + extra_len contains the actual extra field length, and extra contains the + extra field, or that field truncated if extra_max is less than extra_len. + If name is not Z_NULL, then up to name_max characters are written there, + terminated with a zero unless the length is greater than name_max. If + comment is not Z_NULL, then up to comm_max characters are written there, + terminated with a zero unless the length is greater than comm_max. When any + of extra, name, or comment are not Z_NULL and the respective field is not + present in the header, then that field is set to Z_NULL to signal its + absence. This allows the use of deflateSetHeader() with the returned + structure to duplicate the header. However if those fields are set to + allocated memory, then the application will need to save those pointers + elsewhere so that they can be eventually freed. + + If inflateGetHeader is not used, then the header information is simply + discarded. The header is always checked for validity, including the header + CRC if present. inflateReset() will reset the process to discard the header + information. The application would need to call inflateGetHeader() again to + retrieve the header from the next gzip stream. + + inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the parameters are invalid, Z_MEM_ERROR if the internal state could not be + allocated, or Z_VERSION_ERROR if the version of the library does not match + the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, + z_const unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is potentially more efficient than + inflate() for file i/o applications, in that it avoids copying between the + output and the sliding window by simply making the window itself the output + buffer. inflate() can be faster on modern CPUs when used with large + buffers. inflateBack() trusts the application to not change the output + buffer passed by the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free the + allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects only + the raw deflate stream to decompress. This is different from the normal + behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format error + in the deflate stream (in which case strm->msg is set to indicate the nature + of the error), or Z_STREAM_ERROR if the stream was not properly initialized. + In the case of Z_BUF_ERROR, an input or output error can be distinguished + using strm->next_in which will be Z_NULL only if in() returned an error. If + strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning + non-zero. (in() will always be called before out(), so strm->next_in is + assured to be defined if out() returns non-zero.) Note that inflateBack() + cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + +#ifndef Z_SOLO + + /* utility functions */ + +/* + The following utility functions are implemented on top of the basic + stream-oriented functions. To simplify the interface, some default options + are assumed (compression level and memory usage, standard memory allocation + functions). The source code of these utility functions can be modified if + you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before a + compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total size + of the destination buffer, which must be large enough to hold the entire + uncompressed data. (The size of the uncompressed data must have been saved + previously by the compressor and transmitted to the decompressor by some + mechanism outside the scope of this compression library.) Upon exit, destLen + is the actual size of the uncompressed buffer. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In + the case where there is not enough room, uncompress() will fill the output + buffer with the uncompressed data up to that point. +*/ + + /* gzip file access functions */ + +/* + This library supports reading and writing files in gzip (.gz) format with + an interface similar to that of stdio, using the functions that start with + "gz". The gzip format is different from the zlib format. gzip is a gzip + wrapper, documented in RFC 1952, wrapped around a deflate stream. +*/ + +typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ + +/* +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); + + Opens a gzip (.gz) file for reading or writing. The mode parameter is as + in fopen ("rb" or "wb") but can also include a compression level ("wb9") or + a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only + compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' + for fixed code compression as in "wb9F". (See the description of + deflateInit2 for more information about the strategy parameter.) 'T' will + request transparent writing or appending with no compression and not using + the gzip format. + + "a" can be used instead of "w" to request that the gzip stream that will + be written be appended to the file. "+" will result in an error, since + reading and writing to the same gzip file is not supported. The addition of + "x" when writing will create the file exclusively, which fails if the file + already exists. On systems that support it, the addition of "e" when + reading or writing will set the flag to close the file on an execve() call. + + These functions, as well as gzip, will read and decode a sequence of gzip + streams in a file. The append function of gzopen() can be used to create + such a file. (Also see gzflush() for another way to do this.) When + appending, gzopen does not test whether the file begins with a gzip stream, + nor does it look for the end of the gzip streams to begin appending. gzopen + will simply append a gzip stream to the existing file. + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. When + reading, this will be detected automatically by looking for the magic two- + byte gzip header. + + gzopen returns NULL if the file could not be opened, if there was + insufficient memory to allocate the gzFile state, or if an invalid mode was + specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). + errno can be checked to determine if the reason gzopen failed was that the + file could not be opened. +*/ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen associates a gzFile with the file descriptor fd. File descriptors + are obtained from calls like open, dup, creat, pipe or fileno (if the file + has been previously opened with fopen). The mode parameter is as in gzopen. + + The next call of gzclose on the returned gzFile will also close the file + descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor + fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, + mode);. The duplicated descriptor should be saved to avoid a leak, since + gzdopen does not close fd if it fails. If you are using fileno() to get the + file descriptor from a FILE *, then you will have to use dup() to avoid + double-close()ing the file descriptor. Both gzclose() and fclose() will + close the associated file descriptor, so they need to have different file + descriptors. + + gzdopen returns NULL if there was insufficient memory to allocate the + gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not + provided, or '+' was provided), or if fd is -1. The file descriptor is not + used until the next gz* read, write, seek, or close operation, so gzdopen + will not detect if fd is invalid (unless fd is -1). +*/ + +ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); +/* + Set the internal buffer size used by this library's functions. The + default buffer size is 8192 bytes. This function must be called after + gzopen() or gzdopen(), and before any other calls that read or write the + file. The buffer memory allocation is always deferred to the first read or + write. Two buffers are allocated, either both of the specified size when + writing, or one of the specified size and the other twice that size when + reading. A larger buffer size of, for example, 64K or 128K bytes will + noticeably increase the speed of decompression (reading). + + The new buffer size also affects the maximum length for gzprintf(). + + gzbuffer() returns 0 on success, or -1 on failure, such as being called + too late. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. If + the input file is not in gzip format, gzread copies the given number of + bytes into the buffer directly from the file. + + After reaching the end of a gzip stream in the input, gzread will continue + to read, looking for another gzip stream. Any number of gzip streams may be + concatenated in the input file, and will all be decompressed by gzread(). + If something other than a gzip stream is encountered after a gzip stream, + that remaining trailing garbage is ignored (and no error is returned). + + gzread can be used to read a gzip file that is being concurrently written. + Upon reaching the end of the input, gzread will return with the available + data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then + gzclearerr can be used to clear the end of file indicator in order to permit + gzread to be tried again. Z_OK indicates that a gzip stream was completed + on the last gzread. Z_BUF_ERROR indicates that the input file ended in the + middle of a gzip stream. Note that gzread does not return -1 in the event + of an incomplete gzip stream. This error is deferred until gzclose(), which + will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip + stream. Alternatively, gzerror can be used before gzclose to detect this + case. + + gzread returns the number of uncompressed bytes actually read, less than + len for end of file, or -1 for error. +*/ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes written or 0 in case of + error. +*/ + +ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the arguments to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written, or 0 in case of error. The number of + uncompressed bytes written is limited to 8191, or one less than the buffer + size given to gzbuffer(). The caller should assure that this limit is not + exceeded. If it is exceeded, then gzprintf() will return an error (0) with + nothing written. In this case, there may also be a buffer overflow with + unpredictable consequences, which is possible only if zlib was compiled with + the insecure functions sprintf() or vsprintf() because the secure snprintf() + or vsnprintf() functions were not available. This can be determined using + zlibCompileFlags(). +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or a + newline character is read and transferred to buf, or an end-of-file + condition is encountered. If any characters are read or if len == 1, the + string is terminated with a null character. If no characters are read due + to an end-of-file or len < 1, then the buffer is left untouched. + + gzgets returns buf which is a null-terminated string, or it returns NULL + for end-of-file or in case of error. If there was an error, the contents at + buf are indeterminate. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. gzputc + returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte or -1 + in case of end of file or error. This is implemented as a macro for speed. + As such, it does not do all of the checking the other functions do. I.e. + it does not check to see if file is NULL, nor whether the structure file + points to has been clobbered or not. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read as the first character + on the next read. At least one character of push-back is allowed. + gzungetc() returns the character pushed, or -1 on failure. gzungetc() will + fail if c is -1, and may fail if a character has been pushed but not read + yet. If gzungetc is used immediately after gzopen or gzdopen, at least the + output buffer size of pushed characters is allowed. (See gzbuffer above.) + The pushed character will be discarded if the stream is repositioned with + gzseek() or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter flush + is as in the deflate() function. The return value is the zlib error number + (see function gzerror below). gzflush is only permitted when writing. + + If the flush parameter is Z_FINISH, the remaining data is written and the + gzip stream is completed in the output. If gzwrite() is called again, a new + gzip stream will be started in the output. gzread() is able to read such + concatented gzip streams. + + gzflush should be called only when strictly necessary because it will + degrade compression if called too often. +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); + + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); + + Returns the starting position for the next gzread or gzwrite on the given + compressed file. This position represents a number of bytes in the + uncompressed data stream, and is zero when starting, even if appending or + reading a gzip stream from the middle of a file using gzdopen(). + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +/* +ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); + + Returns the current offset in the file being read or written. This offset + includes the count of bytes that precede the gzip stream, for example when + appending or when using gzdopen() for reading. When reading, the offset + does not include as yet unused buffered input. This information can be used + for a progress indicator. On error, gzoffset() returns -1. +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns true (1) if the end-of-file indicator has been set while reading, + false (0) otherwise. Note that the end-of-file indicator is set only if the + read tried to go past the end of the input, but came up short. Therefore, + just like feof(), gzeof() may return false even if there is no more data to + read, in the event that the last read request was for the exact number of + bytes remaining in the input file. This will happen if the input file size + is an exact multiple of the buffer size. + + If gzeof() returns true, then the read functions will return no more data, + unless the end-of-file indicator is reset by gzclearerr() and the input file + has grown since the previous end of file was detected. +*/ + +ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); +/* + Returns true (1) if file is being copied directly while reading, or false + (0) if file is a gzip stream being decompressed. + + If the input file is empty, gzdirect() will return true, since the input + does not contain a gzip stream. + + If gzdirect() is used immediately after gzopen() or gzdopen() it will + cause buffers to be allocated to allow reading the file to determine if it + is a gzip file. Therefore if gzbuffer() is used, it should be called before + gzdirect(). + + When writing, gzdirect() returns true (1) if transparent writing was + requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: + gzdirect() is not needed when writing. Transparent writing must be + explicitly requested, so the application already knows the answer. When + linking statically, using gzdirect() will include all of the zlib code for + gzip file reading and decompression, which may not be desired.) +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file and + deallocates the (de)compression state. Note that once file is closed, you + cannot call gzerror with file, since its structures have been deallocated. + gzclose must not be called more than once on the same file, just as free + must not be called more than once on the same allocation. + + gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a + file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the + last read ended in the middle of a gzip stream, or Z_OK on success. +*/ + +ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); +ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); +/* + Same as gzclose(), but gzclose_r() is only for use when reading, and + gzclose_w() is only for use when writing or appending. The advantage to + using these instead of gzclose() is that they avoid linking in zlib + compression or decompression code that is not used when only reading or only + writing respectively. If gzclose() is used, then both compression and + decompression code will be included the application when linking to a static + zlib library. +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the given + compressed file. errnum is set to zlib error number. If an error occurred + in the file system and not in the compression library, errnum is set to + Z_ERRNO and the application may consult errno to get the exact error code. + + The application must not modify the returned string. Future calls to + this function may invalidate the previously returned string. If file is + closed, then the string previously returned by gzerror will no longer be + available. + + gzerror() should be used to distinguish errors from end-of-file for those + functions above that do not distinguish those cases in their return values. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + +#endif /* !Z_SOLO */ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the compression + library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is Z_NULL, this function returns the + required initial value for the checksum. + + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. + + Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, + z_off_t len2)); + + Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 + and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for + each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of + seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note + that the z_off_t type (like off_t) is a signed integer. If len2 is + negative, the result has no meaning or utility. +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running CRC-32 with the bytes buf[0..len-1] and return the + updated CRC-32. If buf is Z_NULL, this function returns the required + initial value for the crc. Pre- and post-conditioning (one's complement) is + performed within this function so it shouldn't be done by the application. + + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + +/* +ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); + + Combine two CRC-32 check values into one. For two sequences of bytes, + seq1 and seq2 with lengths len1 and len2, CRC-32 check values were + calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 + check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and + len2. +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ + (int)sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, (int)sizeof(z_stream)) + +#ifndef Z_SOLO + +/* gzgetc() macro and its supporting function and exposed data structure. Note + * that the real internal state is much larger than the exposed structure. + * This abbreviated structure exposes just enough for the gzgetc() macro. The + * user should not mess with these exposed elements, since their names or + * behavior could change in the future, perhaps even capriciously. They can + * only be used by the gzgetc() macro. You have been warned. + */ +ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ +#ifdef Z_PREFIX_SET +# undef z_gzgetc +# define z_gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) +#else +# define gzgetc(g) \ + ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) +#endif + +/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or + * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if + * both are true, the application gets the *64 functions, and the regular + * functions are changed to 64 bits) -- in case these are set on systems + * without large file support, _LFS64_LARGEFILE must also be true + */ +#ifdef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); + ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); +#endif + +#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) +# ifdef Z_PREFIX_SET +# define z_gzopen z_gzopen64 +# define z_gzseek z_gzseek64 +# define z_gztell z_gztell64 +# define z_gzoffset z_gzoffset64 +# define z_adler32_combine z_adler32_combine64 +# define z_crc32_combine z_crc32_combine64 +# else +# define gzopen gzopen64 +# define gzseek gzseek64 +# define gztell gztell64 +# define gzoffset gzoffset64 +# define adler32_combine adler32_combine64 +# define crc32_combine crc32_combine64 +# endif +# ifndef Z_LARGE64 + ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +# endif +#else + ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); + ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); + ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); + ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); +#endif + +#else /* Z_SOLO */ + + ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); + +#endif /* !Z_SOLO */ + +/* hack for buggy compilers */ +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; +#endif + +/* undocumented functions */ +ZEXTERN const char * ZEXPORT zError OF((int)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); +ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); +ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); +ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); +ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); +#if defined(_WIN32) && !defined(Z_SOLO) +ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, + const char *mode)); +#endif +#if defined(STDC) || defined(Z_HAVE_STDARG_H) +# ifndef Z_SOLO +ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, + const char *format, + va_list va)); +# endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ + +#else +#include +#endif + +#endif diff --git a/desmume/src/libretro-common/include/compat/zutil.h b/desmume/src/libretro-common/include/compat/zutil.h new file mode 100644 index 000000000..01ad4740a --- /dev/null +++ b/desmume/src/libretro-common/include/compat/zutil.h @@ -0,0 +1,265 @@ +#ifndef _COMPAT_ZUTIL_H +#define _COMPAT_ZUTIL_H + +#ifdef WANT_ZLIB + +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-2013 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id$ */ + +#ifndef ZUTIL_H +#define ZUTIL_H + +#ifdef HAVE_HIDDEN +# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) +#else +# define ZLIB_INTERNAL +#endif + +#include + +#if defined(STDC) && !defined(Z_SOLO) +# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) +# include +# endif +# include +# include +#endif + +#ifdef Z_SOLO + typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +typedef unsigned char uch; +typedef uch FAR uchf; +typedef unsigned short ush; +typedef ush FAR ushf; +typedef unsigned long ulg; + +extern char z_errmsg[10][21]; /* indexed by 2-zlib_error */ +/* (array size given to avoid silly warnings with Visual C++) */ +/* (array entry size given to avoid silly string cast warnings) */ + +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + +#define ERR_RETURN(strm,err) \ + return (strm->msg = ERR_MSG(err), (err)) +/* To be used only when the state is known to be valid */ + + /* common constants */ + +#ifndef DEF_WBITS +# define DEF_WBITS MAX_WBITS +#endif +/* default windowBits for decompression. MAX_WBITS is for compression only */ + +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +/* default memLevel */ + +#define STORED_BLOCK 0 +#define STATIC_TREES 1 +#define DYN_TREES 2 +/* The three kinds of block type */ + +#define MIN_MATCH 3 +#define MAX_MATCH 258 +/* The minimum and maximum match lengths */ + +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ + + /* target dependencies */ + +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) +# define OS_CODE 0x00 +# ifndef Z_SOLO +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include +# endif +# else /* MSC or DJGPP */ +# include +# endif +# endif +#endif + +#ifdef AMIGA +# define OS_CODE 0x01 +#endif + +#if defined(VAXC) || defined(VMS) +# define OS_CODE 0x02 +# define F_OPEN(name, mode) \ + fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 0x05 +#endif + +#ifdef OS2 +# define OS_CODE 0x06 +# if defined(M_I86) && !defined(Z_SOLO) +# include +# endif +#endif + +#if defined(MACOS) || defined(TARGET_OS_MAC) +# define OS_CODE 0x07 +# ifndef Z_SOLO +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif +# endif +# endif +#endif + +#ifdef TOPS20 +# define OS_CODE 0x0a +#endif + +#ifdef WIN32 +# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ +# define OS_CODE 0x0b +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0f +#endif + +#if defined(_BEOS_) || defined(RISCOS) +# define fdopen(fd,mode) NULL /* No fdopen() */ +#endif + +#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX +# if defined(_WIN32_WCE) +# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif +# else +# define fdopen(fd,type) _fdopen(fd,type) +# endif +#endif + +#if defined(__BORLANDC__) && !defined(MSDOS) + #pragma warn -8004 + #pragma warn -8008 + #pragma warn -8066 +#endif + +/* provide prototypes for these when building zlib without LFS */ +#if !defined(_WIN32) && \ + (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) + ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); + ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); +#endif + + /* common defaults */ + +#ifndef OS_CODE +# define OS_CODE 0x03 /* assume Unix */ +#endif + +#ifndef F_OPEN +# define F_OPEN(name, mode) fopen((name), (mode)) +#endif + + /* functions */ + +#if defined(pyr) || defined(Z_SOLO) +# define NO_MEMCPY +#endif +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) + /* Use our own functions for small and medium model with MSC <= 5.0. + * You may have to use the same strategy for Borland C (untested). + * The __SC__ check is for Symantec. + */ +# define NO_MEMCPY +#endif +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) +# define HAVE_MEMCPY +#endif +#ifdef HAVE_MEMCPY +# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ +# define zmemcpy _fmemcpy +# define zmemcmp _fmemcmp +# define zmemzero(dest, len) _fmemset(dest, 0, len) +# else +# define zmemcpy memcpy +# define zmemcmp memcmp +# define zmemzero(dest, len) memset(dest, 0, len) +# endif +#else + void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); + int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); + void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); +#endif + +/* Diagnostic functions */ +#ifdef DEBUG +# include + extern int ZLIB_INTERNAL z_verbose; + extern void ZLIB_INTERNAL z_error OF((char *m)); +# define Assert(cond,msg) {if(!(cond)) z_error(msg);} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + +#ifndef Z_SOLO + voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, + unsigned size)); + void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); +#endif + +#define ZALLOC(strm, items, size) \ + (*((strm)->zalloc))((strm)->opaque, (items), (size)) +#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} + +/* Reverse the bytes in a 32-bit value */ +#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ + (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) + +#endif /* ZUTIL_H */ + +#else +#include +#endif + +#endif diff --git a/desmume/src/libretro-common/include/dynamic/dylib.h b/desmume/src/libretro-common/include/dynamic/dylib.h new file mode 100644 index 000000000..49438b2e4 --- /dev/null +++ b/desmume/src/libretro-common/include/dynamic/dylib.h @@ -0,0 +1,74 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (dylib.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __DYLIB_H +#define __DYLIB_H + +#include + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB) +#define NEED_DYNAMIC +#else +#undef NEED_DYNAMIC +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *dylib_t; +typedef void (*function_t)(void); + +#ifdef NEED_DYNAMIC +/** + * dylib_load: + * @path : Path to libretro core library. + * + * Platform independent dylib loading. + * + * Returns: library handle on success, otherwise NULL. + **/ +dylib_t dylib_load(const char *path); + +/** + * dylib_close: + * @lib : Library handle. + * + * Frees library handle. + **/ +void dylib_close(dylib_t lib); + +char *dylib_error(void); + +function_t dylib_proc(dylib_t lib, const char *proc); +#endif + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/desmume/src/libretro-common/include/file/config_file.h b/desmume/src/libretro-common/include/file/config_file.h new file mode 100644 index 000000000..8a3ad49b6 --- /dev/null +++ b/desmume/src/libretro-common/include/file/config_file.h @@ -0,0 +1,170 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (config_file.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +#ifndef __LIBRETRO_SDK_CONFIG_FILE_H +#define __LIBRETRO_SDK_CONFIG_FILE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include + +struct config_entry_list +{ + /* If we got this from an #include, + * do not allow overwrite. */ + bool readonly; + char *key; + char *value; + uint32_t key_hash; + + struct config_entry_list *next; +}; + +struct config_include_list +{ + char *path; + struct config_include_list *next; +}; + +struct config_file +{ + char *path; + struct config_entry_list *entries; + struct config_entry_list *tail; + unsigned include_depth; + + struct config_include_list *includes; +}; + +typedef struct config_file config_file_t; + +/* Config file format + * - # are treated as comments. Rest of the line is ignored. + * - Format is: key = value. There can be as many spaces as you like in-between. + * - Value can be wrapped inside "" for multiword strings. (foo = "hai u") + * - #include includes a config file in-place. + * + * Path is relative to where config file was loaded unless an absolute path is chosen. + * Key/value pairs from an #include are read-only, and cannot be modified. + */ + +/* Loads a config file. Returns NULL if file doesn't exist. + * NULL path will create an empty config file. */ +config_file_t *config_file_new(const char *path); + +/* Load a config file from a string. */ +config_file_t *config_file_new_from_string(const char *from_string); + +/* Frees config file. */ +void config_file_free(config_file_t *conf); + +/* Loads a new config, and appends its data to conf. + * The key-value pairs of the new config file takes priority over the old. */ +bool config_append_file(config_file_t *conf, const char *path); + +/* All extract functions return true when value is valid and exists. + * Returns false otherwise. */ + +bool config_entry_exists(config_file_t *conf, const char *entry); + +struct config_entry_list; +struct config_file_entry +{ + const char *key; + const char *value; + /* Used intentionally. Opaque here. */ + const struct config_entry_list *next; +}; + +bool config_get_entry_list_head(config_file_t *conf, struct config_file_entry *entry); +bool config_get_entry_list_next(struct config_file_entry *entry); + +/* Extracts a double from config file. */ +bool config_get_double(config_file_t *conf, const char *entry, double *in); + +/* Extracts a float from config file. */ +bool config_get_float(config_file_t *conf, const char *entry, float *in); + +/* Extracts an int from config file. */ +bool config_get_int(config_file_t *conf, const char *entry, int *in); + +/* Extracts an uint from config file. */ +bool config_get_uint(config_file_t *conf, const char *entry, unsigned *in); + +/* Extracts an uint64 from config file. */ +bool config_get_uint64(config_file_t *conf, const char *entry, uint64_t *in); + +/* Extracts an unsigned int from config file treating input as hex. */ +bool config_get_hex(config_file_t *conf, const char *entry, unsigned *in); + +/* Extracts a single char. If value consists of several chars, + * this is an error. */ +bool config_get_char(config_file_t *conf, const char *entry, char *in); + +/* Extracts an allocated string in *in. This must be free()-d if + * this function succeeds. */ +bool config_get_string(config_file_t *conf, const char *entry, char **in); + +/* Extracts a string to a preallocated buffer. Avoid memory allocation. */ +bool config_get_array(config_file_t *conf, const char *entry, char *in, size_t size); + +/* Extracts a string to a preallocated buffer. Avoid memory allocation. + * Recognized magic like ~/. Similar to config_get_array() otherwise. */ +bool config_get_path(config_file_t *conf, const char *entry, char *in, size_t size); + +/* Extracts a boolean from config. + * Valid boolean true are "true" and "1". Valid false are "false" and "0". + * Other values will be treated as an error. */ +bool config_get_bool(config_file_t *conf, const char *entry, bool *in); + +/* Setters. Similar to the getters. + * Will not write to entry if the entry was obtained from an #include. */ +void config_set_double(config_file_t *conf, const char *entry, double value); +void config_set_float(config_file_t *conf, const char *entry, float value); +void config_set_int(config_file_t *conf, const char *entry, int val); +void config_set_hex(config_file_t *conf, const char *entry, unsigned val); +void config_set_uint64(config_file_t *conf, const char *entry, uint64_t val); +void config_set_char(config_file_t *conf, const char *entry, char val); +void config_set_string(config_file_t *conf, const char *entry, const char *val); +void config_set_path(config_file_t *conf, const char *entry, const char *val); +void config_set_bool(config_file_t *conf, const char *entry, bool val); + +/* Write the current config to a file. */ +bool config_file_write(config_file_t *conf, const char *path); + +/* Dump the current config to an already opened file. + * Does not close the file. */ +void config_file_dump(config_file_t *conf, FILE *file); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/file/config_file_userdata.h b/desmume/src/libretro-common/include/file/config_file_userdata.h new file mode 100644 index 000000000..1add87ef4 --- /dev/null +++ b/desmume/src/libretro-common/include/file/config_file_userdata.h @@ -0,0 +1,55 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (config_file_userdata.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _LIBRETRO_SDK_CONFIG_FILE_USERDATA_H +#define _LIBRETRO_SDK_CONFIG_FILE_USERDATA_H + +#include + +#include "config_file.h" + +struct config_file_userdata +{ + config_file_t *conf; + const char *prefix[2]; +}; + +int config_userdata_get_float(void *userdata, const char *key_str, + float *value, float default_value); + +int config_userdata_get_int(void *userdata, const char *key_str, + int *value, int default_value); + +int config_userdata_get_float_array(void *userdata, const char *key_str, + float **values, unsigned *out_num_values, + const float *default_values, unsigned num_default_values); + +int config_userdata_get_int_array(void *userdata, const char *key_str, + int **values, unsigned *out_num_values, + const int *default_values, unsigned num_default_values); + +int config_userdata_get_string(void *userdata, const char *key_str, + char **output, const char *default_output); + +void config_userdata_free(void *ptr); + +#endif diff --git a/desmume/src/libretro-common/include/file/dir_list.h b/desmume/src/libretro-common/include/file/dir_list.h new file mode 100644 index 000000000..6fc3e0f6b --- /dev/null +++ b/desmume/src/libretro-common/include/file/dir_list.h @@ -0,0 +1,70 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (dir_list.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_DIR_LIST_H +#define __LIBRETRO_SDK_DIR_LIST_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * dir_list_new: + * @dir : directory path. + * @ext : allowed extensions of file directory entries to include. + * @include_dirs : include directories as part of the finished directory listing? + * @include_compressed : include compressed files, even when not part of ext. + * + * Create a directory listing. + * + * Returns: pointer to a directory listing of type 'struct string_list *' on success, + * NULL in case of error. Has to be freed manually. + **/ +struct string_list *dir_list_new(const char *dir, const char *ext, + bool include_dirs, bool include_compressed); + +/** + * dir_list_sort: + * @list : pointer to the directory listing. + * @dir_first : move the directories in the listing to the top? + * + * Sorts a directory listing. + * + **/ +void dir_list_sort(struct string_list *list, bool dir_first); + +/** + * dir_list_free: + * @list : pointer to the directory listing + * + * Frees a directory listing. + * + **/ +void dir_list_free(struct string_list *list); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/desmume/src/libretro-common/include/file/file_extract.h b/desmume/src/libretro-common/include/file/file_extract.h new file mode 100644 index 000000000..6afac0ef7 --- /dev/null +++ b/desmume/src/libretro-common/include/file/file_extract.h @@ -0,0 +1,174 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (file_extract.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef FILE_EXTRACT_H__ +#define FILE_EXTRACT_H__ + +#include +#include + +#include + +typedef struct zlib_handle +{ + void *stream; + uint8_t *data; + uint32_t real_checksum; +} zlib_file_handle_t; + +enum zlib_transfer_type +{ + ZLIB_TRANSFER_NONE = 0, + ZLIB_TRANSFER_INIT, + ZLIB_TRANSFER_ITERATE, + ZLIB_TRANSFER_DEINIT, + ZLIB_TRANSFER_DEINIT_ERROR +}; + +typedef struct zlib_transfer +{ + void *handle; + const uint8_t *footer; + const uint8_t *directory; + const uint8_t *data; + int32_t zip_size; + enum zlib_transfer_type type; + const struct zlib_file_backend *backend; +} zlib_transfer_t; + +/* Returns true when parsing should continue. False to stop. */ +typedef int (*zlib_file_cb)(const char *name, const char *valid_exts, + const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size, + uint32_t crc32, void *userdata); + +uint32_t zlib_crc32_calculate(const uint8_t *data, size_t length); + +uint32_t zlib_crc32_adjust(uint32_t crc, uint8_t data); + +/** + * zlib_parse_file: + * @file : filename path of archive + * @valid_exts : Valid extensions of archive to be parsed. + * If NULL, allow all. + * @file_cb : file_cb function pointer + * @userdata : userdata to pass to file_cb function pointer. + * + * Low-level file parsing. Enumerates over all files and calls + * file_cb with userdata. + * + * Returns: true (1) on success, otherwise false (0). + **/ +bool zlib_parse_file(const char *file, const char *valid_exts, + zlib_file_cb file_cb, void *userdata); + +int zlib_parse_file_iterate(void *data, bool *returnerr, + const char *file, + const char *valid_exts, zlib_file_cb file_cb, void *userdata); + +void zlib_parse_file_iterate_stop(void *data); + +/** + * zlib_extract_first_content_file: + * @zip_path : filename path to ZIP archive. + * @zip_path_size : size of ZIP archive. + * @valid_exts : valid extensions for a content file. + * @extraction_directory : the directory to extract temporary + * unzipped content to. + * + * Extract first content file from archive. + * + * Returns : true (1) on success, otherwise false (0). + **/ +bool zlib_extract_first_content_file(char *zip_path, size_t zip_path_size, + const char *valid_exts, const char *extraction_dir); + +/** + * zlib_get_file_list: + * @path : filename path of archive + * @valid_exts : Valid extensions of archive to be parsed. + * If NULL, allow all. + * + * Returns: string listing of files from archive on success, otherwise NULL. + **/ +struct string_list *zlib_get_file_list(const char *path, const char *valid_exts); + +bool zlib_inflate_data_to_file_init( + zlib_file_handle_t *handle, + const uint8_t *cdata, uint32_t csize, uint32_t size); + +int zlib_inflate_data_to_file_iterate(void *data); + +/** + * zlib_inflate_data_to_file: + * @path : filename path of archive. + * @cdata : input data. + * @csize : size of input data. + * @size : output file size + * @checksum : CRC32 checksum from input data. + * + * Decompress data to file. + * + * Returns: true (1) on success, otherwise false (0). + **/ +int zlib_inflate_data_to_file(zlib_file_handle_t *handle, + int ret, const char *path, const char *valid_exts, + const uint8_t *cdata, uint32_t csize, uint32_t size, uint32_t checksum); + +bool zlib_perform_mode(const char *name, const char *valid_exts, + const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size, + uint32_t crc32, void *userdata); + +struct string_list *compressed_file_list_new(const char *filename, + const char* ext); + +void *zlib_stream_new(void); + +void zlib_stream_free(void *data); + +void zlib_deflate_init(void *data, int level); + +int zlib_deflate_data_to_file(void *data); + +void zlib_stream_deflate_free(void *data); + +bool zlib_inflate_init(void *data); + +bool zlib_inflate_init2(void *data); + +void zlib_set_stream(void *data, + uint32_t avail_in, + uint32_t avail_out, + const uint8_t *next_in, + uint8_t *next_out + ); + +uint32_t zlib_stream_get_avail_in(void *data); + +uint32_t zlib_stream_get_avail_out(void *data); + +uint64_t zlib_stream_get_total_out(void *data); + +void zlib_stream_decrement_total_out(void *data, + unsigned subtraction); + +#endif + diff --git a/desmume/src/libretro-common/include/file/file_list.h b/desmume/src/libretro-common/include/file/file_list.h new file mode 100644 index 000000000..dd8046fd5 --- /dev/null +++ b/desmume/src/libretro-common/include/file/file_list.h @@ -0,0 +1,118 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (file_list.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_FILE_LIST_H__ +#define __LIBRETRO_SDK_FILE_LIST_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct item_file +{ + char *path; + char *label; + char *alt; + unsigned type; + size_t directory_ptr; + size_t entry_idx; + void *userdata; + void *actiondata; +}; + +typedef struct file_list +{ + struct item_file *list; + + size_t capacity; + size_t size; +} file_list_t; + + +void *file_list_get_userdata_at_offset(const file_list_t *list, + size_t index); + +void *file_list_get_actiondata_at_offset(const file_list_t *list, + size_t index); + +void file_list_free(file_list_t *list); + +void file_list_push(file_list_t *userdata, const char *path, + const char *label, unsigned type, size_t current_directory_ptr, + size_t entry_index); + +void file_list_pop(file_list_t *list, size_t *directory_ptr); + +void file_list_clear(file_list_t *list); + +void file_list_copy(const file_list_t *src, file_list_t *dst); + +void file_list_get_last(const file_list_t *list, + const char **path, const char **label, + unsigned *type, size_t *entry_idx); + +void *file_list_get_last_actiondata(const file_list_t *list); + +size_t file_list_get_size(const file_list_t *list); + +size_t file_list_get_entry_index(const file_list_t *list); + +size_t file_list_get_directory_ptr(const file_list_t *list); + +void file_list_get_at_offset(const file_list_t *list, size_t index, + const char **path, const char **label, + unsigned *type, size_t *entry_idx); + +void file_list_free_userdata(const file_list_t *list, size_t index); + +void file_list_free_actiondata(const file_list_t *list, size_t idx); + +void file_list_set_label_at_offset(file_list_t *list, size_t index, + const char *label); + +void file_list_get_label_at_offset(const file_list_t *list, size_t index, + const char **label); + +void file_list_set_alt_at_offset(file_list_t *list, size_t index, + const char *alt); + +void file_list_set_userdata(const file_list_t *list, size_t idx, void *ptr); + +void file_list_set_actiondata(const file_list_t *list, size_t idx, void *ptr); + +void file_list_get_alt_at_offset(const file_list_t *list, size_t index, + const char **alt); + +void file_list_sort_on_alt(file_list_t *list); + +void file_list_sort_on_type(file_list_t *list); + +bool file_list_search(const file_list_t *list, const char *needle, + size_t *index); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/desmume/src/libretro-common/include/file/file_path.h b/desmume/src/libretro-common/include/file/file_path.h new file mode 100644 index 000000000..62a4d3ab2 --- /dev/null +++ b/desmume/src/libretro-common/include/file/file_path.h @@ -0,0 +1,396 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (file_path.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_FILE_PATH_H +#define __LIBRETRO_SDK_FILE_PATH_H + +#include +#include +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Order in this enum is equivalent to negative sort order in filelist + * (i.e. DIRECTORY is on top of PLAIN_FILE) */ +enum +{ + RARCH_FILETYPE_UNSET, + RARCH_PLAIN_FILE, + RARCH_COMPRESSED_FILE_IN_ARCHIVE, + RARCH_COMPRESSED_ARCHIVE, + RARCH_DIRECTORY, + RARCH_FILE_UNSUPPORTED +}; + + +/** + * path_is_compressed_file: + * @path : path + * + * Checks if path is a compressed file. + * + * Returns: true (1) if path is a compressed file, otherwise false (0). + **/ +bool path_is_compressed_file(const char *path); + +/** + * path_contains_compressed_file: + * @path : path + * + * Checks if path contains a compressed file. + * + * Currently we only check for hash symbol (#) inside the pathname. + * If path is ever expanded to a general URI, we should check for that here. + * + * Example: Somewhere in the path there might be a compressed file + * E.g.: /path/to/file.7z#mygame.img + * + * Returns: true (1) if path contains compressed file, otherwise false (0). + **/ +bool path_contains_compressed_file(const char *path); + +/** + * path_file_exists: + * @path : path + * + * Checks if a file already exists at the specified path (@path). + * + * Returns: true (1) if file already exists, otherwise false (0). + */ +bool path_file_exists(const char *path); + +/** + * path_get_extension: + * @path : path + * + * Gets extension of file. Only '.'s + * after the last slash are considered. + * + * Returns: extension part from the path. + */ +const char *path_get_extension(const char *path); + +/** + * path_remove_extension: + * @path : path + * + * Removes the extension from the path and returns the result. + * Removes all text after and including the last '.'. + * Only '.'s after the last slash are considered. + * + * Returns: path with the extension part removed. + */ +char *path_remove_extension(char *path); + +/** + * path_basename: + * @path : path + * + * Get basename from @path. + * + * Returns: basename from path. + **/ +const char *path_basename(const char *path); + +/** + * path_basedir: + * @path : path + * + * Extracts base directory by mutating path. + * Keeps trailing '/'. + **/ +void path_basedir(char *path); + +/** + * path_parent_dir: + * @path : path + * + * Extracts parent directory by mutating path. + * Assumes that path is a directory. Keeps trailing '/'. + **/ +void path_parent_dir(char *path); + +/** + * path_resolve_realpath: + * @buf : buffer for path + * @size : size of buffer + * + * Turns relative paths into absolute path. + * If relative, rebases on current working dir. + **/ +void path_resolve_realpath(char *buf, size_t size); + +/** + * path_is_absolute: + * @path : path + * + * Checks if @path is an absolute path or a relative path. + * + * Returns: true (1) if path is absolute, false (1) if path is relative. + **/ +bool path_is_absolute(const char *path); + +/** + * fill_pathname: + * @out_path : output path + * @in_path : input path + * @replace : what to replace + * @size : buffer size of output path + * + * FIXME: Verify + * + * Replaces filename extension with 'replace' and outputs result to out_path. + * The extension here is considered to be the string from the last '.' + * to the end. + * + * Only '.'s after the last slash are considered as extensions. + * If no '.' is present, in_path and replace will simply be concatenated. + * 'size' is buffer size of 'out_path'. + * E.g.: in_path = "/foo/bar/baz/boo.c", replace = ".asm" => + * out_path = "/foo/bar/baz/boo.asm" + * E.g.: in_path = "/foo/bar/baz/boo.c", replace = "" => + * out_path = "/foo/bar/baz/boo" + */ +void fill_pathname(char *out_path, const char *in_path, + const char *replace, size_t size); + +/** + * fill_dated_filename: + * @out_filename : output filename + * @ext : extension of output filename + * @size : buffer size of output filename + * + * Creates a 'dated' filename prefixed by 'RetroArch', and + * concatenates extension (@ext) to it. + * + * E.g.: + * out_filename = "RetroArch-{month}{day}-{Hours}{Minutes}.{@ext}" + **/ +void fill_dated_filename(char *out_filename, + const char *ext, size_t size); + +/** + * fill_pathname_noext: + * @out_path : output path + * @in_path : input path + * @replace : what to replace + * @size : buffer size of output path + * + * Appends a filename extension 'replace' to 'in_path', and outputs + * result in 'out_path'. + * + * Assumes in_path has no extension. If an extension is still + * present in 'in_path', it will be ignored. + * + */ +void fill_pathname_noext(char *out_path, const char *in_path, + const char *replace, size_t size); + +/** + * fill_pathname_dir: + * @in_dir : input directory path + * @in_basename : input basename to be appended to @in_dir + * @replace : replacement to be appended to @in_basename + * @size : size of buffer + * + * Appends basename of 'in_basename', to 'in_dir', along with 'replace'. + * Basename of in_basename is the string after the last '/' or '\\', + * i.e the filename without directories. + * + * If in_basename has no '/' or '\\', the whole 'in_basename' will be used. + * 'size' is buffer size of 'in_dir'. + * + * E.g..: in_dir = "/tmp/some_dir", in_basename = "/some_content/foo.c", + * replace = ".asm" => in_dir = "/tmp/some_dir/foo.c.asm" + **/ +void fill_pathname_dir(char *in_dir, const char *in_basename, + const char *replace, size_t size); + +/** + * fill_pathname_base: + * @out : output path + * @in_path : input path + * @size : size of output path + * + * Copies basename of @in_path into @out_path. + **/ +void fill_pathname_base(char *out_path, const char *in_path, size_t size); + +/** + * fill_pathname_basedir: + * @out_dir : output directory + * @in_path : input path + * @size : size of output directory + * + * Copies base directory of @in_path into @out_path. + * If in_path is a path without any slashes (relative current directory), + * @out_path will get path "./". + **/ +void fill_pathname_basedir(char *out_path, const char *in_path, size_t size); + +/** + * fill_pathname_parent_dir: + * @out_dir : output directory + * @in_dir : input directory + * @size : size of output directory + * + * Copies parent directory of @in_dir into @out_dir. + * Assumes @in_dir is a directory. Keeps trailing '/'. + **/ +void fill_pathname_parent_dir(char *out_dir, + const char *in_dir, size_t size); + +/** + * fill_pathname_resolve_relative: + * @out_path : output path + * @in_refpath : input reference path + * @in_path : input path + * @size : size of @out_path + * + * Joins basedir of @in_refpath together with @in_path. + * If @in_path is an absolute path, out_path = in_path. + * E.g.: in_refpath = "/foo/bar/baz.a", in_path = "foobar.cg", + * out_path = "/foo/bar/foobar.cg". + **/ +void fill_pathname_resolve_relative(char *out_path, const char *in_refpath, + const char *in_path, size_t size); + +/** + * fill_pathname_join: + * @out_path : output path + * @dir : directory + * @path : path + * @size : size of output path + * + * Joins a directory (@dir) and path (@path) together. + * Makes sure not to get two consecutive slashes + * between directory and path. + **/ +void fill_pathname_join(char *out_path, const char *dir, + const char *path, size_t size); + +/** + * fill_pathname_join_delim: + * @out_path : output path + * @dir : directory + * @path : path + * @delim : delimiter + * @size : size of output path + * + * Joins a directory (@dir) and path (@path) together + * using the given delimiter (@delim). + **/ +void fill_pathname_join_delim(char *out_path, const char *dir, + const char *path, const char delim, size_t size); + +/** + * fill_short_pathname_representation: + * @out_rep : output representation + * @in_path : input path + * @size : size of output representation + * + * Generates a short representation of path. It should only + * be used for displaying the result; the output representation is not + * binding in any meaningful way (for a normal path, this is the same as basename) + * In case of more complex URLs, this should cut everything except for + * the main image file. + * + * E.g.: "/path/to/game.img" -> game.img + * "/path/to/myarchive.7z#folder/to/game.img" -> game.img + */ +void fill_short_pathname_representation(char* out_rep, + const char *in_path, size_t size); + +void fill_pathname_expand_special(char *out_path, + const char *in_path, size_t size); + +void fill_pathname_abbreviate_special(char *out_path, + const char *in_path, size_t size); + +/** + * path_char_is_slash: + * @c : character + * + * Checks if character (@c) is a slash. + * + * Returns: true (1) if character is a slash, otherwise false (0). + */ +static INLINE bool path_char_is_slash(char c) +{ +#ifdef _WIN32 + return (c == '/') || (c == '\\'); +#else + return (c == '/'); +#endif +} + +/** + * path_default_slash: + * + * Gets the default slash separator. + * + * Returns: default slash separator. + */ +static INLINE const char *path_default_slash(void) +{ +#ifdef _WIN32 + return "\\"; +#else + return "/"; +#endif +} + +/** + * fill_pathname_slash: + * @path : path + * @size : size of path + * + * Assumes path is a directory. Appends a slash + * if not already there. + **/ +void fill_pathname_slash(char *path, size_t size); + +#ifndef RARCH_CONSOLE +void fill_pathname_application_path(char *buf, size_t size); +#endif + +/** + * path_mkdir: + * @dir : directory + * + * Create directory on filesystem. + * + * Returns: true (1) if directory could be created, otherwise false (0). + **/ +bool path_mkdir(const char *dir); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/desmume/src/libretro-common/include/file/memory_stream.h b/desmume/src/libretro-common/include/file/memory_stream.h new file mode 100644 index 000000000..94bbfc39e --- /dev/null +++ b/desmume/src/libretro-common/include/file/memory_stream.h @@ -0,0 +1,51 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (memory_stream.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _LIBRETRO_SDK_FILE_MEMORY_STREAM_H +#define _LIBRETRO_SDK_FILE_MEMORY_STREAM_H + +#include +#include + +typedef struct memstream memstream_t; + +memstream_t *memstream_open(void); + +void memstream_close(memstream_t * stream); + +size_t memstream_read(memstream_t * stream, void *data, size_t bytes); + +size_t memstream_write(memstream_t * stream, const void *data, size_t bytes); + +int memstream_getc(memstream_t * stream); + +char *memstream_gets(memstream_t * stream, char *buffer, size_t len); + +size_t memstream_pos(memstream_t * stream); + +int memstream_seek(memstream_t * stream, int offset, int whence); + +void memstream_set_buffer(uint8_t *buffer, size_t size); + +size_t memstream_get_last_size(void); + +#endif diff --git a/desmume/src/libretro-common/include/file/nbio.h b/desmume/src/libretro-common/include/file/nbio.h new file mode 100644 index 000000000..e24d65686 --- /dev/null +++ b/desmume/src/libretro-common/include/file/nbio.h @@ -0,0 +1,96 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (dir_list.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_NBIO_H +#define __LIBRETRO_SDK_NBIO_H + +#include +#include + +#ifndef NBIO_READ +#define NBIO_READ 0 +#endif + +#ifndef NBIO_WRITE +#define NBIO_WRITE 1 +#endif + +#ifndef NBIO_UPDATE +#define NBIO_UPDATE 2 +#endif + +#ifndef BIO_READ +#define BIO_READ 3 +#endif + +#ifndef BIO_WRITE +#define BIO_WRITE 4 +#endif + +struct nbio_t; + +/* + * Creates an nbio structure for performing the given operation on the given file. + */ +struct nbio_t* nbio_open(const char * filename, unsigned mode); + +/* + * Starts reading the given file. When done, it will be available in nbio_get_ptr. + * Can not be done if the structure was created with nbio_write. + */ +void nbio_begin_read(struct nbio_t* handle); + +/* + * Starts writing to the given file. Before this, you should've copied the data to nbio_get_ptr. + * Can not be done if the structure was created with nbio_read. + */ +void nbio_begin_write(struct nbio_t* handle); + +/* + * Performs part of the requested operation, or checks how it's going. + * When it returns true, it's done. + */ +bool nbio_iterate(struct nbio_t* handle); + +/* + * Resizes the file up to the given size; cannot shrink. + * Can not be done if the structure was created with nbio_read. + */ +void nbio_resize(struct nbio_t* handle, size_t len); + +/* + * Returns a pointer to the file data. Writable only if structure was not created with nbio_read. + * If any operation is in progress, the pointer will be NULL, but len will still be correct. + */ +void* nbio_get_ptr(struct nbio_t* handle, size_t* len); + +/* + * Stops any pending operation, allowing the object to be freed. + */ +void nbio_cancel(struct nbio_t* handle); + +/* + * Deletes the nbio structure and its associated pointer. + */ +void nbio_free(struct nbio_t* handle); + +#endif diff --git a/desmume/src/libretro-common/include/filters.h b/desmume/src/libretro-common/include/filters.h new file mode 100644 index 000000000..499e14dcc --- /dev/null +++ b/desmume/src/libretro-common/include/filters.h @@ -0,0 +1,73 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (filters.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _LIBRETRO_SDK_FILTERS_H +#define _LIBRETRO_SDK_FILTERS_H + +#include +#include + +static INLINE double sinc(double val) +{ + if (fabs(val) < 0.00001) + return 1.0; + return sin(val) / val; +} + +/* Modified Bessel function of first order. + * Check Wiki for mathematical definition ... */ +static INLINE double besseli0(double x) +{ + unsigned i; + double sum = 0.0; + double factorial = 1.0; + double factorial_mult = 0.0; + double x_pow = 1.0; + double two_div_pow = 1.0; + double x_sqr = x * x; + + /* Approximate. This is an infinite sum. + * Luckily, it converges rather fast. */ + for (i = 0; i < 18; i++) + { + sum += x_pow * two_div_pow / (factorial * factorial); + + factorial_mult += 1.0; + x_pow *= x_sqr; + two_div_pow *= 0.25; + factorial *= factorial_mult; + } + + return sum; +} + +static INLINE double kaiser_window_function(double index, double beta) +{ + return besseli0(beta * sqrtf(1 - index * index)); +} + +static INLINE double lanzcos_window_function(double index) +{ + return sinc(M_PI * index); +} + +#endif diff --git a/desmume/src/libretro-common/include/formats/image.h b/desmume/src/libretro-common/include/formats/image.h new file mode 100644 index 000000000..c27381a71 --- /dev/null +++ b/desmume/src/libretro-common/include/formats/image.h @@ -0,0 +1,62 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef __RARCH_IMAGE_CONTEXT_H +#define __RARCH_IMAGE_CONTEXT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum image_process_code +{ + IMAGE_PROCESS_ERROR = -2, + IMAGE_PROCESS_ERROR_END = -1, + IMAGE_PROCESS_NEXT = 0, + IMAGE_PROCESS_END = 1 +}; + +struct texture_image +{ + unsigned width; + unsigned height; +#ifdef _XBOX1 + unsigned x; + unsigned y; + void *texture_buf; + void *vertex_buf; +#endif + uint32_t *pixels; +}; + +bool texture_image_set_color_shifts(unsigned *r_shift, unsigned *g_shift, + unsigned *b_shift, unsigned *a_shift); + +bool texture_image_color_convert(unsigned r_shift, + unsigned g_shift, unsigned b_shift, unsigned a_shift, + struct texture_image *out_img); + +bool texture_image_load(struct texture_image *img, const char *path); +void texture_image_free(struct texture_image *img); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/desmume/src/libretro-common/include/formats/rbmp.h b/desmume/src/libretro-common/include/formats/rbmp.h new file mode 100644 index 000000000..8a1de4cb9 --- /dev/null +++ b/desmume/src/libretro-common/include/formats/rbmp.h @@ -0,0 +1,48 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rbmp.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_FORMAT_RBMP_H__ +#define __LIBRETRO_SDK_FORMAT_RBMP_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum +{ + RBMP_SOURCE_TYPE_BGR24, + RBMP_SOURCE_TYPE_XRGB888, + RBMP_SOURCE_TYPE_RGB565, + RBMP_SOURCE_TYPE_ARGB8888, +} rbmp_source_type; + +bool rbmp_save_image(const char *filename, const void *frame, + unsigned width, unsigned height, + unsigned pitch, rbmp_source_type type); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/desmume/src/libretro-common/include/formats/rpng.h b/desmume/src/libretro-common/include/formats/rpng.h new file mode 100644 index 000000000..b61315bed --- /dev/null +++ b/desmume/src/libretro-common/include/formats/rpng.h @@ -0,0 +1,70 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rpng.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_FORMAT_RPNG_H__ +#define __LIBRETRO_SDK_FORMAT_RPNG_H__ + +#include +#include + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct rpng rpng_t; + +bool rpng_load_image_argb(const char *path, uint32_t **data, + unsigned *width, unsigned *height); + +rpng_t *rpng_nbio_load_image_argb_init(const char *path); + +bool rpng_is_valid(rpng_t *rpng); + +bool rpng_set_buf_ptr(rpng_t *rpng, uint8_t *data); + +rpng_t *rpng_alloc(void); + +void rpng_nbio_load_image_free(rpng_t *rpng); + +bool rpng_nbio_load_image_argb_iterate(rpng_t *rpng); + +int rpng_nbio_load_image_argb_process(rpng_t *rpng, + uint32_t **data, unsigned *width, unsigned *height); + +bool rpng_nbio_load_image_argb_start(rpng_t *rpng); + +#ifdef HAVE_ZLIB_DEFLATE +bool rpng_save_image_argb(const char *path, const uint32_t *data, + unsigned width, unsigned height, unsigned pitch); +bool rpng_save_image_bgr24(const char *path, const uint8_t *data, + unsigned width, unsigned height, unsigned pitch); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/formats/rxml.h b/desmume/src/libretro-common/include/formats/rxml.h new file mode 100644 index 000000000..ecebefee9 --- /dev/null +++ b/desmume/src/libretro-common/include/formats/rxml.h @@ -0,0 +1,97 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rxml.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +#ifndef __LIBRETRO_SDK_FORMAT_RXML_H__ +#define __LIBRETRO_SDK_FORMAT_RXML_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Total NIH. Very trivial "XML" implementation for use in RetroArch. + * Error checking is minimal. Invalid documents may lead to very + * buggy behavior, but memory corruption should never happen. + * + * Only parts of standard that RetroArch cares about is supported. + * Nothing more, nothing less. "Clever" XML documents will + * probably break the implementation. + * + * Do *NOT* try to use this for anything else. You have been warned. + */ + +typedef struct rxml_document rxml_document_t; + +struct rxml_attrib_node +{ + char *attrib; + char *value; + struct rxml_attrib_node *next; +}; + +struct rxml_node +{ + char *name; + char *data; + struct rxml_attrib_node *attrib; + + struct rxml_node *children; + struct rxml_node *next; + + /* Dummy. Used by libxml2 compat. + * Is always set to 0, so XML_ELEMENT_NODE check goes through. */ + int type; +}; + +rxml_document_t *rxml_load_document(const char *path); +void rxml_free_document(rxml_document_t *doc); + +struct rxml_node *rxml_root_node(rxml_document_t *doc); + +/* Drop const-correctness here to avoid warnings + * when used as libxml2 compat. + * xmlGetProp() returns xmlChar*, which is supposed + * to be passed to xmlFree(). */ +char *rxml_node_attrib(struct rxml_node *node, const char *attrib); + +#ifdef RXML_LIBXML2_COMPAT +/* Compat for part of libxml2 that RetroArch uses. */ +#define LIBXML_TEST_VERSION ((void)0) +typedef char xmlChar; /* It's really unsigned char, but it doesn't matter. */ +typedef struct rxml_node *xmlNodePtr; +typedef void *xmlParserCtxtPtr; +typedef rxml_document_t *xmlDocPtr; +#define XML_ELEMENT_NODE (0) +#define xmlNewParserCtxt() ((void*)-1) +#define xmlCtxtReadFile(ctx, path, a, b) rxml_load_document(path) +#define xmlGetProp(node, prop) rxml_node_attrib(node, prop) +#define xmlFree(p) ((void)0) +#define xmlNodeGetContent(node) (node->data) +#define xmlDocGetRootElement(doc) rxml_root_node(doc) +#define xmlFreeDoc(doc) rxml_free_document(doc) +#define xmlFreeParserCtxt(ctx) ((void)0) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/formats/tga.h b/desmume/src/libretro-common/include/formats/tga.h new file mode 100644 index 000000000..fa3a9c816 --- /dev/null +++ b/desmume/src/libretro-common/include/formats/tga.h @@ -0,0 +1,49 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (rpng.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_FORMAT_RTGA_H__ +#define __LIBRETRO_SDK_FORMAT_RTGA_H__ + +#include +#include + +#include + +#ifdef HAVE_CONFIG_H +#include "../../config.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +bool rtga_image_load_shift(uint8_t *buf, + void *data, + unsigned a_shift, unsigned r_shift, + unsigned g_shift, unsigned b_shift); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/gfx/math/matrix_3x3.h b/desmume/src/libretro-common/include/gfx/math/matrix_3x3.h new file mode 100644 index 000000000..eda24e992 --- /dev/null +++ b/desmume/src/libretro-common/include/gfx/math/matrix_3x3.h @@ -0,0 +1,69 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (matrix_3x3.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_GFX_MATH_MATRIX_3X3_H__ +#define __LIBRETRO_SDK_GFX_MATH_MATRIX_3X3_H__ + +#include + +typedef struct math_matrix_3x3 +{ + float data[9]; +} math_matrix_3x3; + +#define MAT_ELEM_3X3(mat, r, c) ((mat).data[3 * (r) + (c)]) + +void matrix_3x3_inits(math_matrix_3x3 *mat, + const float n11, const float n12, const float n13, + const float n21, const float n22, const float n23, + const float n31, const float n32, const float n33); +void matrix_3x3_identity(math_matrix_3x3 *mat); +void matrix_3x3_transpose(math_matrix_3x3 *out, const math_matrix_3x3 *in); + +void matrix_3x3_multiply(math_matrix_3x3 *out, + const math_matrix_3x3 *a, const math_matrix_3x3 *b); +void matrix_3x3_divide_scalar(math_matrix_3x3 *mat, float s); +float matrix_3x3_determinant(const math_matrix_3x3 *mat); +void matrix_3x3_adjoint(math_matrix_3x3 *mat); +bool matrix_3x3_invert(math_matrix_3x3 *mat); + +bool matrix_3x3_square_to_quad(const float dx0, const float dy0, + const float dx1, const float dy1, + const float dx3, const float dy3, + const float dx2, const float dy2, + math_matrix_3x3 *mat); +bool matrix_3x3_quad_to_square(const float sx0, const float sy0, + const float sx1, const float sy1, + const float sx2, const float sy2, + const float sx3, const float sy3, + math_matrix_3x3 *mat); +bool matrix_3x3_quad_to_quad(const float dx0, const float dy0, + const float dx1, const float dy1, + const float dx2, const float dy2, + const float dx3, const float dy3, + const float sx0, const float sy0, + const float sx1, const float sy1, + const float sx2, const float sy2, + const float sx3, const float sy3, + math_matrix_3x3 *mat); + +#endif diff --git a/desmume/src/libretro-common/include/gfx/math/matrix_4x4.h b/desmume/src/libretro-common/include/gfx/math/matrix_4x4.h new file mode 100644 index 000000000..2017df45a --- /dev/null +++ b/desmume/src/libretro-common/include/gfx/math/matrix_4x4.h @@ -0,0 +1,57 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (matrix.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_GFX_MATH_MATRIX_4X4_H__ +#define __LIBRETRO_SDK_GFX_MATH_MATRIX_4X4_H__ + +/* Column-major matrix (OpenGL-style). + * Reimplements functionality from FF OpenGL pipeline to be able + * to work on GLES 2.0 and modern GL variants. + */ + +typedef struct math_matrix_4x4 +{ + float data[16]; +} math_matrix_4x4; + +#define MAT_ELEM_4X4(mat, r, c) ((mat).data[4 * (c) + (r)]) + +void matrix_4x4_identity(math_matrix_4x4 *mat); +void matrix_4x4_transpose(math_matrix_4x4 *out, const math_matrix_4x4 *in); + +void matrix_4x4_rotate_x(math_matrix_4x4 *mat, float rad); +void matrix_4x4_rotate_y(math_matrix_4x4 *mat, float rad); +void matrix_4x4_rotate_z(math_matrix_4x4 *mat, float rad); + +void matrix_4x4_ortho(math_matrix_4x4 *mat, + float left, float right, + float bottom, float top, + float znear, float zfar); + +void matrix_4x4_multiply(math_matrix_4x4 *out, const math_matrix_4x4 *a, const math_matrix_4x4 *b); + +void matrix_4x4_scale(math_matrix_4x4 *out, float x, float y, float z); +void matrix_4x4_translate(math_matrix_4x4 *out, float x, float y, float z); +void matrix_4x4_projection(math_matrix_4x4 *out, float znear, float zfar); + +#endif + diff --git a/desmume/src/libretro-common/include/gfx/scaler/filter.h b/desmume/src/libretro-common/include/gfx/scaler/filter.h new file mode 100644 index 000000000..0dbdd6f06 --- /dev/null +++ b/desmume/src/libretro-common/include/gfx/scaler/filter.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (filter.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_SCALER_FILTER_H__ +#define __LIBRETRO_SDK_SCALER_FILTER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +bool scaler_gen_filter(struct scaler_ctx *ctx); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/gfx/scaler/pixconv.h b/desmume/src/libretro-common/include/gfx/scaler/pixconv.h new file mode 100644 index 000000000..c3524986f --- /dev/null +++ b/desmume/src/libretro-common/include/gfx/scaler/pixconv.h @@ -0,0 +1,93 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (pixconv.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_SCALER_PIXCONV_H__ +#define __LIBRETRO_SDK_SCALER_PIXCONV_H__ + +#include + +void conv_0rgb1555_argb8888(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_0rgb1555_rgb565(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_rgb565_0rgb1555(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_rgb565_argb8888(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_rgba4444_argb8888(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_rgba4444_rgb565(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_bgr24_argb8888(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_argb8888_0rgb1555(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_argb8888_rgba4444(void *output_, const void *input_, + int width, int height, + int out_stride, int in_stride); + +void conv_argb8888_rgb565(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_argb8888_bgr24(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_argb8888_abgr8888(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_0rgb1555_bgr24(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_rgb565_bgr24(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_yuyv_argb8888(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +void conv_copy(void *output, const void *input, + int width, int height, + int out_stride, int in_stride); + +#endif + diff --git a/desmume/src/libretro-common/include/gfx/scaler/scaler.h b/desmume/src/libretro-common/include/gfx/scaler/scaler.h new file mode 100644 index 000000000..73fc675c8 --- /dev/null +++ b/desmume/src/libretro-common/include/gfx/scaler/scaler.h @@ -0,0 +1,153 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (scaler.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_SCALER_H__ +#define __LIBRETRO_SDK_SCALER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include +#include + +#define FILTER_UNITY (1 << 14) + +enum scaler_pix_fmt +{ + SCALER_FMT_ARGB8888 = 0, + SCALER_FMT_ABGR8888, + SCALER_FMT_0RGB1555, + SCALER_FMT_RGB565, + SCALER_FMT_BGR24, + SCALER_FMT_YUYV, + SCALER_FMT_RGBA4444 +}; + +enum scaler_type +{ + SCALER_TYPE_UNKNOWN = 0, + SCALER_TYPE_POINT, + SCALER_TYPE_BILINEAR, + SCALER_TYPE_SINC +}; + +struct scaler_filter +{ + int16_t *filter; + int filter_len; + int filter_stride; + int *filter_pos; +}; + +struct scaler_ctx +{ + int in_width; + int in_height; + int in_stride; + + int out_width; + int out_height; + int out_stride; + + enum scaler_pix_fmt in_fmt; + enum scaler_pix_fmt out_fmt; + enum scaler_type scaler_type; + + void (*scaler_horiz)(const struct scaler_ctx*, + const void*, int); + void (*scaler_vert)(const struct scaler_ctx*, + void*, int); + void (*scaler_special)(const struct scaler_ctx*, + void*, const void*, int, int, int, int, int, int); + + void (*in_pixconv)(void*, const void*, int, int, int, int); + void (*out_pixconv)(void*, const void*, int, int, int, int); + void (*direct_pixconv)(void*, const void*, int, int, int, int); + + bool unscaled; + struct scaler_filter horiz, vert; + + struct + { + uint32_t *frame; + int stride; + } input; + + struct + { + uint64_t *frame; + int width; + int height; + int stride; + } scaled; + + struct + { + uint32_t *frame; + int stride; + } output; +}; + +bool scaler_ctx_gen_filter(struct scaler_ctx *ctx); + +void scaler_ctx_gen_reset(struct scaler_ctx *ctx); + +/** + * scaler_ctx_scale: + * @ctx : pointer to scaler context object. + * @output : pointer to output image. + * @input : pointer to input image. + * + * Scales an input image to an output image. + **/ +void scaler_ctx_scale(struct scaler_ctx *ctx, + void *output, const void *input); + +/** + * scaler_alloc: + * @elem_size : size of the elements to be used. + * @siz : size of the image that the scaler needs to handle. + * + * Allocate and returns a scaler object. + * + * Returns: pointer to a scaler object of type 'void *' on success, + * NULL in case of error. Has to be freed manually. + **/ +void *scaler_alloc(size_t elem_size, size_t size); + +/** + * scaler_free: + * @ptr : pointer to scaler object. + * + * Frees a scaler object. + **/ +void scaler_free(void *ptr); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/gfx/scaler/scaler_int.h b/desmume/src/libretro-common/include/gfx/scaler/scaler_int.h new file mode 100644 index 000000000..55095ae01 --- /dev/null +++ b/desmume/src/libretro-common/include/gfx/scaler/scaler_int.h @@ -0,0 +1,41 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (scaler_int.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_SCALER_INT_H__ +#define __LIBRETRO_SDK_SCALER_INT_H__ + +#include + +void scaler_argb8888_vert(const struct scaler_ctx *ctx, + void *output, int stride); + +void scaler_argb8888_horiz(const struct scaler_ctx *ctx, + const void *input, int stride); + +void scaler_argb8888_point_special(const struct scaler_ctx *ctx, + void *output, const void *input, + int out_width, int out_height, + int in_width, int in_height, + int out_stride, int in_stride); + +#endif + diff --git a/desmume/src/libretro-common/include/glsym/glsym.h b/desmume/src/libretro-common/include/glsym/glsym.h new file mode 100644 index 000000000..28aaf724c --- /dev/null +++ b/desmume/src/libretro-common/include/glsym/glsym.h @@ -0,0 +1,37 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this libretro SDK code part (glsym). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_GLSYM_H__ +#define __LIBRETRO_SDK_GLSYM_H__ + +#include "rglgen.h" + +#ifndef HAVE_PSGL +#ifdef HAVE_OPENGLES2 +#include "glsym_es2.h" +#else +#include "glsym_gl.h" +#endif +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/glsym/glsym_es2.h b/desmume/src/libretro-common/include/glsym/glsym_es2.h new file mode 100644 index 000000000..b68f8a98f --- /dev/null +++ b/desmume/src/libretro-common/include/glsym/glsym_es2.h @@ -0,0 +1,145 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this libretro SDK code part (glsym). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef RGLGEN_DECL_H__ +#define RGLGEN_DECL_H__ +#ifdef __cplusplus +extern "C" { +#endif +#ifdef GL_APIENTRY +typedef void (GL_APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*); +typedef void (GL_APIENTRY *RGLGENGLDEBUGPROCKHR)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*); +#else +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +typedef void (APIENTRY *RGLGENGLDEBUGPROCARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*); +typedef void (APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*); +#endif +#ifndef GL_OES_EGL_image +typedef void *GLeglImageOES; +#endif +#if !defined(GL_OES_fixed_point) && !defined(HAVE_OPENGLES2) +typedef GLint GLfixed; +#endif +#if defined(OSX) && !defined(MAC_OS_X_VERSION_10_7) +typedef long long int GLint64; +typedef unsigned long long int GLuint64; +typedef unsigned long long int GLuint64EXT; +typedef struct __GLsync *GLsync; +#endif +typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (GL_APIENTRYP RGLSYMGLDEBUGMESSAGECALLBACKKHRPROC) (RGLGENGLDEBUGPROCKHR callback, const void *userParam); +typedef GLuint (GL_APIENTRYP RGLSYMGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (GL_APIENTRYP RGLSYMGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (GL_APIENTRYP RGLSYMGLPOPDEBUGGROUPKHRPROC) (void); +typedef void (GL_APIENTRYP RGLSYMGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP RGLSYMGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP RGLSYMGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP RGLSYMGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP RGLSYMGLGETPOINTERVKHRPROC) (GLenum pname, void **params); +typedef void (GL_APIENTRYP RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP RGLSYMGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +typedef void (GL_APIENTRYP RGLSYMGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length); +typedef void *(GL_APIENTRYP RGLSYMGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP RGLSYMGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP RGLSYMGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params); +typedef void (GL_APIENTRYP RGLSYMGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP RGLSYMGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (GL_APIENTRYP RGLSYMGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GL_APIENTRYP RGLSYMGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); +typedef void (GL_APIENTRYP RGLSYMGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (GL_APIENTRYP RGLSYMGLISVERTEXARRAYOESPROC) (GLuint array); + +#define glDebugMessageControlKHR __rglgen_glDebugMessageControlKHR +#define glDebugMessageInsertKHR __rglgen_glDebugMessageInsertKHR +#define glDebugMessageCallbackKHR __rglgen_glDebugMessageCallbackKHR +#define glGetDebugMessageLogKHR __rglgen_glGetDebugMessageLogKHR +#define glPushDebugGroupKHR __rglgen_glPushDebugGroupKHR +#define glPopDebugGroupKHR __rglgen_glPopDebugGroupKHR +#define glObjectLabelKHR __rglgen_glObjectLabelKHR +#define glGetObjectLabelKHR __rglgen_glGetObjectLabelKHR +#define glObjectPtrLabelKHR __rglgen_glObjectPtrLabelKHR +#define glGetObjectPtrLabelKHR __rglgen_glGetObjectPtrLabelKHR +#define glGetPointervKHR __rglgen_glGetPointervKHR +#define glEGLImageTargetTexture2DOES __rglgen_glEGLImageTargetTexture2DOES +#define glEGLImageTargetRenderbufferStorageOES __rglgen_glEGLImageTargetRenderbufferStorageOES +#define glGetProgramBinaryOES __rglgen_glGetProgramBinaryOES +#define glProgramBinaryOES __rglgen_glProgramBinaryOES +#define glMapBufferOES __rglgen_glMapBufferOES +#define glUnmapBufferOES __rglgen_glUnmapBufferOES +#define glGetBufferPointervOES __rglgen_glGetBufferPointervOES +#define glTexImage3DOES __rglgen_glTexImage3DOES +#define glTexSubImage3DOES __rglgen_glTexSubImage3DOES +#define glCopyTexSubImage3DOES __rglgen_glCopyTexSubImage3DOES +#define glCompressedTexImage3DOES __rglgen_glCompressedTexImage3DOES +#define glCompressedTexSubImage3DOES __rglgen_glCompressedTexSubImage3DOES +#define glFramebufferTexture3DOES __rglgen_glFramebufferTexture3DOES +#define glBindVertexArrayOES __rglgen_glBindVertexArrayOES +#define glDeleteVertexArraysOES __rglgen_glDeleteVertexArraysOES +#define glGenVertexArraysOES __rglgen_glGenVertexArraysOES +#define glIsVertexArrayOES __rglgen_glIsVertexArrayOES + +extern RGLSYMGLDEBUGMESSAGECONTROLKHRPROC __rglgen_glDebugMessageControlKHR; +extern RGLSYMGLDEBUGMESSAGEINSERTKHRPROC __rglgen_glDebugMessageInsertKHR; +extern RGLSYMGLDEBUGMESSAGECALLBACKKHRPROC __rglgen_glDebugMessageCallbackKHR; +extern RGLSYMGLGETDEBUGMESSAGELOGKHRPROC __rglgen_glGetDebugMessageLogKHR; +extern RGLSYMGLPUSHDEBUGGROUPKHRPROC __rglgen_glPushDebugGroupKHR; +extern RGLSYMGLPOPDEBUGGROUPKHRPROC __rglgen_glPopDebugGroupKHR; +extern RGLSYMGLOBJECTLABELKHRPROC __rglgen_glObjectLabelKHR; +extern RGLSYMGLGETOBJECTLABELKHRPROC __rglgen_glGetObjectLabelKHR; +extern RGLSYMGLOBJECTPTRLABELKHRPROC __rglgen_glObjectPtrLabelKHR; +extern RGLSYMGLGETOBJECTPTRLABELKHRPROC __rglgen_glGetObjectPtrLabelKHR; +extern RGLSYMGLGETPOINTERVKHRPROC __rglgen_glGetPointervKHR; +extern RGLSYMGLEGLIMAGETARGETTEXTURE2DOESPROC __rglgen_glEGLImageTargetTexture2DOES; +extern RGLSYMGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC __rglgen_glEGLImageTargetRenderbufferStorageOES; +extern RGLSYMGLGETPROGRAMBINARYOESPROC __rglgen_glGetProgramBinaryOES; +extern RGLSYMGLPROGRAMBINARYOESPROC __rglgen_glProgramBinaryOES; +extern RGLSYMGLMAPBUFFEROESPROC __rglgen_glMapBufferOES; +extern RGLSYMGLUNMAPBUFFEROESPROC __rglgen_glUnmapBufferOES; +extern RGLSYMGLGETBUFFERPOINTERVOESPROC __rglgen_glGetBufferPointervOES; +extern RGLSYMGLTEXIMAGE3DOESPROC __rglgen_glTexImage3DOES; +extern RGLSYMGLTEXSUBIMAGE3DOESPROC __rglgen_glTexSubImage3DOES; +extern RGLSYMGLCOPYTEXSUBIMAGE3DOESPROC __rglgen_glCopyTexSubImage3DOES; +extern RGLSYMGLCOMPRESSEDTEXIMAGE3DOESPROC __rglgen_glCompressedTexImage3DOES; +extern RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DOESPROC __rglgen_glCompressedTexSubImage3DOES; +extern RGLSYMGLFRAMEBUFFERTEXTURE3DOESPROC __rglgen_glFramebufferTexture3DOES; +extern RGLSYMGLBINDVERTEXARRAYOESPROC __rglgen_glBindVertexArrayOES; +extern RGLSYMGLDELETEVERTEXARRAYSOESPROC __rglgen_glDeleteVertexArraysOES; +extern RGLSYMGLGENVERTEXARRAYSOESPROC __rglgen_glGenVertexArraysOES; +extern RGLSYMGLISVERTEXARRAYOESPROC __rglgen_glIsVertexArrayOES; + +struct rglgen_sym_map { const char *sym; void *ptr; }; +extern const struct rglgen_sym_map rglgen_symbol_map[]; +#ifdef __cplusplus +} +#endif +#endif diff --git a/desmume/src/libretro-common/include/glsym/glsym_gl.h b/desmume/src/libretro-common/include/glsym/glsym_gl.h new file mode 100644 index 000000000..89c27eba2 --- /dev/null +++ b/desmume/src/libretro-common/include/glsym/glsym_gl.h @@ -0,0 +1,3140 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this libretro SDK code part (glsym). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef RGLGEN_DECL_H__ +#define RGLGEN_DECL_H__ +#ifdef __cplusplus +extern "C" { +#endif +#ifdef GL_APIENTRY +typedef void (GL_APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*); +typedef void (GL_APIENTRY *RGLGENGLDEBUGPROCKHR)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*); +#else +#ifndef APIENTRY +#define APIENTRY +#endif +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif +typedef void (APIENTRY *RGLGENGLDEBUGPROCARB)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*); +typedef void (APIENTRY *RGLGENGLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar*, GLvoid*); +#endif +#ifndef GL_OES_EGL_image +typedef void *GLeglImageOES; +#endif +#if !defined(GL_OES_fixed_point) && !defined(HAVE_OPENGLES2) +typedef GLint GLfixed; +#endif +#if defined(__MACH__) && !defined(OS_TARGET_IPHONE) && !defined(MAC_OS_X_VERSION_10_7) +typedef long long int GLint64; +typedef unsigned long long int GLuint64; +typedef unsigned long long int GLuint64EXT; +typedef struct __GLsync *GLsync; +#endif +typedef void (APIENTRYP RGLSYMGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); +typedef void (APIENTRYP RGLSYMGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP RGLSYMGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (APIENTRYP RGLSYMGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP RGLSYMGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP RGLSYMGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img); +typedef void (APIENTRYP RGLSYMGLCLIENTACTIVETEXTUREPROC) (GLenum texture); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1IPROC) (GLenum target, GLint s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP RGLSYMGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP RGLSYMGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m); +typedef void (APIENTRYP RGLSYMGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m); +typedef void (APIENTRYP RGLSYMGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (APIENTRYP RGLSYMGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); +typedef void (APIENTRYP RGLSYMGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); +typedef void (APIENTRYP RGLSYMGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP RGLSYMGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); +typedef void (APIENTRYP RGLSYMGLPOINTPARAMETERIPROC) (GLenum pname, GLint param); +typedef void (APIENTRYP RGLSYMGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); +typedef void (APIENTRYP RGLSYMGLFOGCOORDFPROC) (GLfloat coord); +typedef void (APIENTRYP RGLSYMGLFOGCOORDFVPROC) (const GLfloat *coord); +typedef void (APIENTRYP RGLSYMGLFOGCOORDDPROC) (GLdouble coord); +typedef void (APIENTRYP RGLSYMGLFOGCOORDDVPROC) (const GLdouble *coord); +typedef void (APIENTRYP RGLSYMGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3BVPROC) (const GLbyte *v); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3IVPROC) (const GLint *v); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3SVPROC) (const GLshort *v); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3UIVPROC) (const GLuint *v); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLOR3USVPROC) (const GLushort *v); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2DVPROC) (const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2FVPROC) (const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2IPROC) (GLint x, GLint y); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2IVPROC) (const GLint *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2SPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2SVPROC) (const GLshort *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3DVPROC) (const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3FVPROC) (const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3IVPROC) (const GLint *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3SVPROC) (const GLshort *v); +typedef void (APIENTRYP RGLSYMGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (APIENTRYP RGLSYMGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (APIENTRYP RGLSYMGLGENQUERIESPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP RGLSYMGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP RGLSYMGLISQUERYPROC) (GLuint id); +typedef void (APIENTRYP RGLSYMGLBEGINQUERYPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP RGLSYMGLENDQUERYPROC) (GLenum target); +typedef void (APIENTRYP RGLSYMGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP RGLSYMGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP RGLSYMGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP RGLSYMGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP RGLSYMGLISBUFFERPROC) (GLuint buffer); +typedef void (APIENTRYP RGLSYMGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +typedef void (APIENTRYP RGLSYMGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +typedef void (APIENTRYP RGLSYMGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data); +typedef void *(APIENTRYP RGLSYMGLMAPBUFFERPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP RGLSYMGLUNMAPBUFFERPROC) (GLenum target); +typedef void (APIENTRYP RGLSYMGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params); +typedef void (APIENTRYP RGLSYMGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP RGLSYMGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP RGLSYMGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (APIENTRYP RGLSYMGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (APIENTRYP RGLSYMGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (APIENTRYP RGLSYMGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP RGLSYMGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (APIENTRYP RGLSYMGLCOMPILESHADERPROC) (GLuint shader); +typedef GLuint (APIENTRYP RGLSYMGLCREATEPROGRAMPROC) (void); +typedef GLuint (APIENTRYP RGLSYMGLCREATESHADERPROC) (GLenum type); +typedef void (APIENTRYP RGLSYMGLDELETEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP RGLSYMGLDELETESHADERPROC) (GLuint shader); +typedef void (APIENTRYP RGLSYMGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (APIENTRYP RGLSYMGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP RGLSYMGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (APIENTRYP RGLSYMGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP RGLSYMGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP RGLSYMGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +typedef GLint (APIENTRYP RGLSYMGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP RGLSYMGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP RGLSYMGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef GLint (APIENTRYP RGLSYMGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP RGLSYMGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer); +typedef GLboolean (APIENTRYP RGLSYMGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (APIENTRYP RGLSYMGLISSHADERPROC) (GLuint shader); +typedef void (APIENTRYP RGLSYMGLLINKPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP RGLSYMGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +typedef void (APIENTRYP RGLSYMGLUSEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP RGLSYMGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP RGLSYMGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP RGLSYMGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP RGLSYMGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP RGLSYMGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (APIENTRYP RGLSYMGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP RGLSYMGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP RGLSYMGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP RGLSYMGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (APIENTRYP RGLSYMGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data); +typedef void (APIENTRYP RGLSYMGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); +typedef void (APIENTRYP RGLSYMGLENABLEIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP RGLSYMGLDISABLEIPROC) (GLenum target, GLuint index); +typedef GLboolean (APIENTRYP RGLSYMGLISENABLEDIPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP RGLSYMGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode); +typedef void (APIENTRYP RGLSYMGLENDTRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP RGLSYMGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP RGLSYMGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); +typedef void (APIENTRYP RGLSYMGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); +typedef void (APIENTRYP RGLSYMGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); +typedef void (APIENTRYP RGLSYMGLCLAMPCOLORPROC) (GLenum target, GLenum clamp); +typedef void (APIENTRYP RGLSYMGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode); +typedef void (APIENTRYP RGLSYMGLENDCONDITIONALRENDERPROC) (void); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP RGLSYMGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params); +typedef void (APIENTRYP RGLSYMGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (APIENTRYP RGLSYMGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP RGLSYMGLUNIFORM1UIPROC) (GLint location, GLuint v0); +typedef void (APIENTRYP RGLSYMGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP RGLSYMGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP RGLSYMGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP RGLSYMGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP RGLSYMGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (APIENTRYP RGLSYMGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (APIENTRYP RGLSYMGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value); +typedef void (APIENTRYP RGLSYMGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef const GLubyte *(APIENTRYP RGLSYMGLGETSTRINGIPROC) (GLenum name, GLuint index); +typedef GLboolean (APIENTRYP RGLSYMGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef void (APIENTRYP RGLSYMGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (APIENTRYP RGLSYMGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (APIENTRYP RGLSYMGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (APIENTRYP RGLSYMGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP RGLSYMGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLboolean (APIENTRYP RGLSYMGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef void (APIENTRYP RGLSYMGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (APIENTRYP RGLSYMGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (APIENTRYP RGLSYMGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef GLenum (APIENTRYP RGLSYMGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (APIENTRYP RGLSYMGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP RGLSYMGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (APIENTRYP RGLSYMGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (APIENTRYP RGLSYMGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (APIENTRYP RGLSYMGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (APIENTRYP RGLSYMGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void (APIENTRYP RGLSYMGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP RGLSYMGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void *(APIENTRYP RGLSYMGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (APIENTRYP RGLSYMGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP RGLSYMGLBINDVERTEXARRAYPROC) (GLuint array); +typedef void (APIENTRYP RGLSYMGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); +typedef void (APIENTRYP RGLSYMGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (APIENTRYP RGLSYMGLISVERTEXARRAYPROC) (GLuint array); +typedef void (APIENTRYP RGLSYMGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +typedef void (APIENTRYP RGLSYMGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); +typedef void (APIENTRYP RGLSYMGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP RGLSYMGLPRIMITIVERESTARTINDEXPROC) (GLuint index); +typedef void (APIENTRYP RGLSYMGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (APIENTRYP RGLSYMGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); +typedef void (APIENTRYP RGLSYMGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); +typedef GLuint (APIENTRYP RGLSYMGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); +typedef void (APIENTRYP RGLSYMGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); +typedef void (APIENTRYP RGLSYMGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +typedef void (APIENTRYP RGLSYMGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (APIENTRYP RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (APIENTRYP RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +typedef void (APIENTRYP RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); +typedef void (APIENTRYP RGLSYMGLPROVOKINGVERTEXPROC) (GLenum mode); +typedef GLsync (APIENTRYP RGLSYMGLFENCESYNCPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (APIENTRYP RGLSYMGLISSYNCPROC) (GLsync sync); +typedef void (APIENTRYP RGLSYMGLDELETESYNCPROC) (GLsync sync); +typedef GLenum (APIENTRYP RGLSYMGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP RGLSYMGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (APIENTRYP RGLSYMGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); +typedef void (APIENTRYP RGLSYMGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +typedef void (APIENTRYP RGLSYMGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); +typedef void (APIENTRYP RGLSYMGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params); +typedef void (APIENTRYP RGLSYMGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP RGLSYMGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP RGLSYMGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP RGLSYMGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); +typedef void (APIENTRYP RGLSYMGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask); +typedef void (APIENTRYP RGLSYMGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +typedef GLint (APIENTRYP RGLSYMGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); +typedef void (APIENTRYP RGLSYMGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); +typedef void (APIENTRYP RGLSYMGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); +typedef GLboolean (APIENTRYP RGLSYMGLISSAMPLERPROC) (GLuint sampler); +typedef void (APIENTRYP RGLSYMGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); +typedef void (APIENTRYP RGLSYMGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); +typedef void (APIENTRYP RGLSYMGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP RGLSYMGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); +typedef void (APIENTRYP RGLSYMGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); +typedef void (APIENTRYP RGLSYMGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (APIENTRYP RGLSYMGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (APIENTRYP RGLSYMGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); +typedef void (APIENTRYP RGLSYMGLQUERYCOUNTERPROC) (GLuint id, GLenum target); +typedef void (APIENTRYP RGLSYMGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (APIENTRYP RGLSYMGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLVERTEXP2UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP RGLSYMGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLVERTEXP3UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP RGLSYMGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLVERTEXP4UIPROC) (GLenum type, GLuint value); +typedef void (APIENTRYP RGLSYMGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords); +typedef void (APIENTRYP RGLSYMGLNORMALP3UIPROC) (GLenum type, GLuint coords); +typedef void (APIENTRYP RGLSYMGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords); +typedef void (APIENTRYP RGLSYMGLCOLORP3UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP RGLSYMGLCOLORP3UIVPROC) (GLenum type, const GLuint *color); +typedef void (APIENTRYP RGLSYMGLCOLORP4UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP RGLSYMGLCOLORP4UIVPROC) (GLenum type, const GLuint *color); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color); +typedef void (APIENTRYP RGLSYMGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color); +typedef void (APIENTRYP RGLSYMGLMINSAMPLESHADINGPROC) (GLfloat value); +typedef void (APIENTRYP RGLSYMGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP RGLSYMGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP RGLSYMGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP RGLSYMGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (APIENTRYP RGLSYMGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect); +typedef void (APIENTRYP RGLSYMGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect); +typedef void (APIENTRYP RGLSYMGLUNIFORM1DPROC) (GLint location, GLdouble x); +typedef void (APIENTRYP RGLSYMGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y); +typedef void (APIENTRYP RGLSYMGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP RGLSYMGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP RGLSYMGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params); +typedef GLint (APIENTRYP RGLSYMGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef GLuint (APIENTRYP RGLSYMGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name); +typedef void (APIENTRYP RGLSYMGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values); +typedef void (APIENTRYP RGLSYMGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP RGLSYMGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP RGLSYMGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices); +typedef void (APIENTRYP RGLSYMGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values); +typedef void (APIENTRYP RGLSYMGLPATCHPARAMETERIPROC) (GLenum pname, GLint value); +typedef void (APIENTRYP RGLSYMGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values); +typedef void (APIENTRYP RGLSYMGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP RGLSYMGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids); +typedef void (APIENTRYP RGLSYMGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids); +typedef GLboolean (APIENTRYP RGLSYMGLISTRANSFORMFEEDBACKPROC) (GLuint id); +typedef void (APIENTRYP RGLSYMGLPAUSETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP RGLSYMGLRESUMETRANSFORMFEEDBACKPROC) (void); +typedef void (APIENTRYP RGLSYMGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id); +typedef void (APIENTRYP RGLSYMGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream); +typedef void (APIENTRYP RGLSYMGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id); +typedef void (APIENTRYP RGLSYMGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index); +typedef void (APIENTRYP RGLSYMGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLRELEASESHADERCOMPILERPROC) (void); +typedef void (APIENTRYP RGLSYMGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (APIENTRYP RGLSYMGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +typedef void (APIENTRYP RGLSYMGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); +typedef void (APIENTRYP RGLSYMGLCLEARDEPTHFPROC) (GLfloat d); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +typedef void (APIENTRYP RGLSYMGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); +typedef void (APIENTRYP RGLSYMGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); +typedef void (APIENTRYP RGLSYMGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (APIENTRYP RGLSYMGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program); +typedef GLuint (APIENTRYP RGLSYMGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings); +typedef void (APIENTRYP RGLSYMGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP RGLSYMGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines); +typedef void (APIENTRYP RGLSYMGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (APIENTRYP RGLSYMGLISPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value); +typedef void (APIENTRYP RGLSYMGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP RGLSYMGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (APIENTRYP RGLSYMGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (APIENTRYP RGLSYMGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (APIENTRYP RGLSYMGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP RGLSYMGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f); +typedef void (APIENTRYP RGLSYMGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (APIENTRYP RGLSYMGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); +typedef void (APIENTRYP RGLSYMGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP RGLSYMGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +typedef void (APIENTRYP RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +typedef void (APIENTRYP RGLSYMGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); +typedef void (APIENTRYP RGLSYMGLMEMORYBARRIERPROC) (GLbitfield barriers); +typedef void (APIENTRYP RGLSYMGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (APIENTRYP RGLSYMGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (APIENTRYP RGLSYMGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP RGLSYMGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount); +typedef void (APIENTRYP RGLSYMGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount); +typedef void (APIENTRYP RGLSYMGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP RGLSYMGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP RGLSYMGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); +typedef void (APIENTRYP RGLSYMGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect); +typedef void (APIENTRYP RGLSYMGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +typedef void (APIENTRYP RGLSYMGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP RGLSYMGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params); +typedef void (APIENTRYP RGLSYMGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth); +typedef void (APIENTRYP RGLSYMGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level); +typedef void (APIENTRYP RGLSYMGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length); +typedef void (APIENTRYP RGLSYMGLINVALIDATEBUFFERDATAPROC) (GLuint buffer); +typedef void (APIENTRYP RGLSYMGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +typedef void (APIENTRYP RGLSYMGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP RGLSYMGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP RGLSYMGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params); +typedef GLuint (APIENTRYP RGLSYMGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); +typedef GLint (APIENTRYP RGLSYMGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef GLint (APIENTRYP RGLSYMGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef void (APIENTRYP RGLSYMGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); +typedef void (APIENTRYP RGLSYMGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (APIENTRYP RGLSYMGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (APIENTRYP RGLSYMGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (APIENTRYP RGLSYMGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +typedef void (APIENTRYP RGLSYMGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex); +typedef void (APIENTRYP RGLSYMGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor); +typedef void (APIENTRYP RGLSYMGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP RGLSYMGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP RGLSYMGLDEBUGMESSAGECALLBACKPROC) (RGLGENGLDEBUGPROC callback, const void *userParam); +typedef GLuint (APIENTRYP RGLSYMGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (APIENTRYP RGLSYMGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (APIENTRYP RGLSYMGLPOPDEBUGGROUPPROC) (void); +typedef void (APIENTRYP RGLSYMGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (APIENTRYP RGLSYMGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (APIENTRYP RGLSYMGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (APIENTRYP RGLSYMGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (APIENTRYP RGLSYMGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +typedef void (APIENTRYP RGLSYMGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP RGLSYMGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP RGLSYMGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers); +typedef void (APIENTRYP RGLSYMGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes); +typedef void (APIENTRYP RGLSYMGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); +typedef void (APIENTRYP RGLSYMGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint *samplers); +typedef void (APIENTRYP RGLSYMGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); +typedef void (APIENTRYP RGLSYMGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides); +typedef GLuint64 (APIENTRYP RGLSYMGLGETTEXTUREHANDLEARBPROC) (GLuint texture); +typedef GLuint64 (APIENTRYP RGLSYMGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler); +typedef void (APIENTRYP RGLSYMGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP RGLSYMGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef GLuint64 (APIENTRYP RGLSYMGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (APIENTRYP RGLSYMGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access); +typedef void (APIENTRYP RGLSYMGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP RGLSYMGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value); +typedef void (APIENTRYP RGLSYMGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (APIENTRYP RGLSYMGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (APIENTRYP RGLSYMGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef GLboolean (APIENTRYP RGLSYMGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params); +#ifdef __APPLE__ + struct _cl_context; + struct _cl_event; +#endif +typedef GLsync (APIENTRYP RGLSYMGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context *context, struct _cl_event *event, GLbitfield flags); +typedef void (APIENTRYP RGLSYMGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp); +typedef void (APIENTRYP RGLSYMGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z); +typedef void (APIENTRYP RGLSYMGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (APIENTRYP RGLSYMGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (APIENTRYP RGLSYMGLDEBUGMESSAGECALLBACKARBPROC) (RGLGENGLDEBUGPROCARB callback, const void *userParam); +typedef GLuint (APIENTRYP RGLSYMGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (APIENTRYP RGLSYMGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs); +typedef void (APIENTRYP RGLSYMGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode); +typedef void (APIENTRYP RGLSYMGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (APIENTRYP RGLSYMGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (APIENTRYP RGLSYMGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (APIENTRYP RGLSYMGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP RGLSYMGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +typedef void (APIENTRYP RGLSYMGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void *string); +typedef void (APIENTRYP RGLSYMGLBINDPROGRAMARBPROC) (GLenum target, GLuint program); +typedef void (APIENTRYP RGLSYMGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs); +typedef void (APIENTRYP RGLSYMGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs); +typedef void (APIENTRYP RGLSYMGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP RGLSYMGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP RGLSYMGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP RGLSYMGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP RGLSYMGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP RGLSYMGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params); +typedef void (APIENTRYP RGLSYMGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP RGLSYMGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void *string); +typedef GLboolean (APIENTRYP RGLSYMGLISPROGRAMARBPROC) (GLuint program); +typedef void (APIENTRYP RGLSYMGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value); +typedef void (APIENTRYP RGLSYMGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (APIENTRYP RGLSYMGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (APIENTRYP RGLSYMGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face); +typedef void (APIENTRYP RGLSYMGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table); +typedef void (APIENTRYP RGLSYMGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP RGLSYMGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP RGLSYMGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP RGLSYMGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, void *table); +typedef void (APIENTRYP RGLSYMGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data); +typedef void (APIENTRYP RGLSYMGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP RGLSYMGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image); +typedef void (APIENTRYP RGLSYMGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image); +typedef void (APIENTRYP RGLSYMGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params); +typedef void (APIENTRYP RGLSYMGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP RGLSYMGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params); +typedef void (APIENTRYP RGLSYMGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP RGLSYMGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); +typedef void (APIENTRYP RGLSYMGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (APIENTRYP RGLSYMGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, void *image); +typedef void (APIENTRYP RGLSYMGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span); +typedef void (APIENTRYP RGLSYMGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column); +typedef void (APIENTRYP RGLSYMGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (APIENTRYP RGLSYMGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values); +typedef void (APIENTRYP RGLSYMGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP RGLSYMGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink); +typedef void (APIENTRYP RGLSYMGLRESETHISTOGRAMPROC) (GLenum target); +typedef void (APIENTRYP RGLSYMGLRESETMINMAXPROC) (GLenum target); +typedef void (APIENTRYP RGLSYMGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (APIENTRYP RGLSYMGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor); +typedef void (APIENTRYP RGLSYMGLCURRENTPALETTEMATRIXARBPROC) (GLint index); +typedef void (APIENTRYP RGLSYMGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices); +typedef void (APIENTRYP RGLSYMGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices); +typedef void (APIENTRYP RGLSYMGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices); +typedef void (APIENTRYP RGLSYMGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP RGLSYMGLSAMPLECOVERAGEARBPROC) (GLfloat value, GLboolean invert); +typedef void (APIENTRYP RGLSYMGLACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP RGLSYMGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids); +typedef void (APIENTRYP RGLSYMGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (APIENTRYP RGLSYMGLISQUERYARBPROC) (GLuint id); +typedef void (APIENTRYP RGLSYMGLBEGINQUERYARBPROC) (GLenum target, GLuint id); +typedef void (APIENTRYP RGLSYMGLENDQUERYARBPROC) (GLenum target); +typedef void (APIENTRYP RGLSYMGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (APIENTRYP RGLSYMGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param); +typedef void (APIENTRYP RGLSYMGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params); +typedef GLenum (APIENTRYP RGLSYMGLGETGRAPHICSRESETSTATUSARBPROC) (void); +typedef void (APIENTRYP RGLSYMGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img); +typedef void (APIENTRYP RGLSYMGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (APIENTRYP RGLSYMGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void *img); +typedef void (APIENTRYP RGLSYMGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +typedef void (APIENTRYP RGLSYMGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params); +typedef void (APIENTRYP RGLSYMGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v); +typedef void (APIENTRYP RGLSYMGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v); +typedef void (APIENTRYP RGLSYMGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v); +typedef void (APIENTRYP RGLSYMGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values); +typedef void (APIENTRYP RGLSYMGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values); +typedef void (APIENTRYP RGLSYMGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values); +typedef void (APIENTRYP RGLSYMGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern); +typedef void (APIENTRYP RGLSYMGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table); +typedef void (APIENTRYP RGLSYMGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image); +typedef void (APIENTRYP RGLSYMGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span); +typedef void (APIENTRYP RGLSYMGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP RGLSYMGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values); +typedef void (APIENTRYP RGLSYMGLMINSAMPLESHADINGARBPROC) (GLfloat value); +typedef void (APIENTRYP RGLSYMGLDELETEOBJECTARBPROC) (GLhandleARB obj); +typedef GLhandleARB (APIENTRYP RGLSYMGLGETHANDLEARBPROC) (GLenum pname); +typedef void (APIENTRYP RGLSYMGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj); +typedef GLhandleARB (APIENTRYP RGLSYMGLCREATESHADEROBJECTARBPROC) (GLenum shaderType); +typedef void (APIENTRYP RGLSYMGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length); +typedef void (APIENTRYP RGLSYMGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj); +typedef GLhandleARB (APIENTRYP RGLSYMGLCREATEPROGRAMOBJECTARBPROC) (void); +typedef void (APIENTRYP RGLSYMGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj); +typedef void (APIENTRYP RGLSYMGLLINKPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP RGLSYMGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP RGLSYMGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj); +typedef void (APIENTRYP RGLSYMGLUNIFORM1FARBPROC) (GLint location, GLfloat v0); +typedef void (APIENTRYP RGLSYMGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (APIENTRYP RGLSYMGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (APIENTRYP RGLSYMGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (APIENTRYP RGLSYMGLUNIFORM1IARBPROC) (GLint location, GLint v0); +typedef void (APIENTRYP RGLSYMGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1); +typedef void (APIENTRYP RGLSYMGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (APIENTRYP RGLSYMGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (APIENTRYP RGLSYMGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (APIENTRYP RGLSYMGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog); +typedef void (APIENTRYP RGLSYMGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj); +typedef GLint (APIENTRYP RGLSYMGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +typedef void (APIENTRYP RGLSYMGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef void (APIENTRYP RGLSYMGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source); +typedef void (APIENTRYP RGLSYMGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string); +typedef void (APIENTRYP RGLSYMGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP RGLSYMGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length); +typedef GLboolean (APIENTRYP RGLSYMGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name); +typedef void (APIENTRYP RGLSYMGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string); +typedef void (APIENTRYP RGLSYMGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident); +typedef void (APIENTRYP RGLSYMGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); +typedef void (APIENTRYP RGLSYMGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img); +typedef void (APIENTRYP RGLSYMGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP RGLSYMGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRYP RGLSYMGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); +typedef void (APIENTRYP RGLSYMGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); +typedef void (APIENTRYP RGLSYMGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights); +typedef void (APIENTRYP RGLSYMGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights); +typedef void (APIENTRYP RGLSYMGLWEIGHTIVARBPROC) (GLint size, const GLint *weights); +typedef void (APIENTRYP RGLSYMGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights); +typedef void (APIENTRYP RGLSYMGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights); +typedef void (APIENTRYP RGLSYMGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights); +typedef void (APIENTRYP RGLSYMGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights); +typedef void (APIENTRYP RGLSYMGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights); +typedef void (APIENTRYP RGLSYMGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); +typedef void (APIENTRYP RGLSYMGLVERTEXBLENDARBPROC) (GLint count); +typedef void (APIENTRYP RGLSYMGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer); +typedef void (APIENTRYP RGLSYMGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers); +typedef void (APIENTRYP RGLSYMGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers); +typedef GLboolean (APIENTRYP RGLSYMGLISBUFFERARBPROC) (GLuint buffer); +typedef void (APIENTRYP RGLSYMGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage); +typedef void (APIENTRYP RGLSYMGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data); +typedef void (APIENTRYP RGLSYMGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data); +typedef void *(APIENTRYP RGLSYMGLMAPBUFFERARBPROC) (GLenum target, GLenum access); +typedef GLboolean (APIENTRYP RGLSYMGLUNMAPBUFFERARBPROC) (GLenum target); +typedef void (APIENTRYP RGLSYMGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, void **params); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v); +typedef void (APIENTRYP RGLSYMGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +typedef void (APIENTRYP RGLSYMGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP RGLSYMGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, void **pointer); +typedef void (APIENTRYP RGLSYMGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name); +typedef void (APIENTRYP RGLSYMGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name); +typedef GLint (APIENTRYP RGLSYMGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2IARBPROC) (GLint x, GLint y); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2IVARBPROC) (const GLint *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS2SVARBPROC) (const GLshort *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3DVARBPROC) (const GLdouble *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3FVARBPROC) (const GLfloat *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3IVARBPROC) (const GLint *v); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z); +typedef void (APIENTRYP RGLSYMGLWINDOWPOS3SVARBPROC) (const GLshort *v); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1BOESPROC) (GLenum texture, GLbyte s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2BOESPROC) (GLenum texture, GLbyte s, GLbyte t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4BVOESPROC) (GLenum texture, const GLbyte *coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1BOESPROC) (GLbyte s); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2BOESPROC) (GLbyte s, GLbyte t); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3BOESPROC) (GLbyte s, GLbyte t, GLbyte r); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4BOESPROC) (GLbyte s, GLbyte t, GLbyte r, GLbyte q); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP RGLSYMGLVERTEX2BOESPROC) (GLbyte x); +typedef void (APIENTRYP RGLSYMGLVERTEX2BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP RGLSYMGLVERTEX3BOESPROC) (GLbyte x, GLbyte y); +typedef void (APIENTRYP RGLSYMGLVERTEX3BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP RGLSYMGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z); +typedef void (APIENTRYP RGLSYMGLVERTEX4BVOESPROC) (const GLbyte *coords); +typedef void (APIENTRYP RGLSYMGLALPHAFUNCXOESPROC) (GLenum func, GLfixed ref); +typedef void (APIENTRYP RGLSYMGLCLEARCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP RGLSYMGLCLEARDEPTHXOESPROC) (GLfixed depth); +typedef void (APIENTRYP RGLSYMGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation); +typedef void (APIENTRYP RGLSYMGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP RGLSYMGLDEPTHRANGEXOESPROC) (GLfixed n, GLfixed f); +typedef void (APIENTRYP RGLSYMGLFOGXOESPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP RGLSYMGLFOGXVOESPROC) (GLenum pname, const GLfixed *param); +typedef void (APIENTRYP RGLSYMGLFRUSTUMXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); +typedef void (APIENTRYP RGLSYMGLGETCLIPPLANEXOESPROC) (GLenum plane, GLfixed *equation); +typedef void (APIENTRYP RGLSYMGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params); +typedef void (APIENTRYP RGLSYMGLGETTEXENVXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP RGLSYMGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP RGLSYMGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP RGLSYMGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *param); +typedef void (APIENTRYP RGLSYMGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param); +typedef void (APIENTRYP RGLSYMGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP RGLSYMGLLINEWIDTHXOESPROC) (GLfixed width); +typedef void (APIENTRYP RGLSYMGLLOADMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP RGLSYMGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); +typedef void (APIENTRYP RGLSYMGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *param); +typedef void (APIENTRYP RGLSYMGLMULTMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +typedef void (APIENTRYP RGLSYMGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz); +typedef void (APIENTRYP RGLSYMGLORTHOXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); +typedef void (APIENTRYP RGLSYMGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params); +typedef void (APIENTRYP RGLSYMGLPOINTSIZEXOESPROC) (GLfixed size); +typedef void (APIENTRYP RGLSYMGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units); +typedef void (APIENTRYP RGLSYMGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP RGLSYMGLSAMPLECOVERAGEOESPROC) (GLfixed value, GLboolean invert); +typedef void (APIENTRYP RGLSYMGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP RGLSYMGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (APIENTRYP RGLSYMGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP RGLSYMGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (APIENTRYP RGLSYMGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP RGLSYMGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP RGLSYMGLACCUMXOESPROC) (GLenum op, GLfixed value); +typedef void (APIENTRYP RGLSYMGLBITMAPXOESPROC) (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap); +typedef void (APIENTRYP RGLSYMGLBLENDCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP RGLSYMGLCLEARACCUMXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +typedef void (APIENTRYP RGLSYMGLCOLOR3XOESPROC) (GLfixed red, GLfixed green, GLfixed blue); +typedef void (APIENTRYP RGLSYMGLCOLOR3XVOESPROC) (const GLfixed *components); +typedef void (APIENTRYP RGLSYMGLCOLOR4XVOESPROC) (const GLfixed *components); +typedef void (APIENTRYP RGLSYMGLCONVOLUTIONPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param); +typedef void (APIENTRYP RGLSYMGLCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP RGLSYMGLEVALCOORD1XOESPROC) (GLfixed u); +typedef void (APIENTRYP RGLSYMGLEVALCOORD1XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLEVALCOORD2XOESPROC) (GLfixed u, GLfixed v); +typedef void (APIENTRYP RGLSYMGLEVALCOORD2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLFEEDBACKBUFFERXOESPROC) (GLsizei n, GLenum type, const GLfixed *buffer); +typedef void (APIENTRYP RGLSYMGLGETCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP RGLSYMGLGETHISTOGRAMPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params); +typedef void (APIENTRYP RGLSYMGLGETLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed *params); +typedef void (APIENTRYP RGLSYMGLGETMAPXVOESPROC) (GLenum target, GLenum query, GLfixed *v); +typedef void (APIENTRYP RGLSYMGLGETMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param); +typedef void (APIENTRYP RGLSYMGLGETPIXELMAPXVPROC) (GLenum map, GLint size, GLfixed *values); +typedef void (APIENTRYP RGLSYMGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params); +typedef void (APIENTRYP RGLSYMGLGETTEXLEVELPARAMETERXVOESPROC) (GLenum target, GLint level, GLenum pname, GLfixed *params); +typedef void (APIENTRYP RGLSYMGLINDEXXOESPROC) (GLfixed component); +typedef void (APIENTRYP RGLSYMGLINDEXXVOESPROC) (const GLfixed *component); +typedef void (APIENTRYP RGLSYMGLLOADTRANSPOSEMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP RGLSYMGLMAP1XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points); +typedef void (APIENTRYP RGLSYMGLMAP2XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points); +typedef void (APIENTRYP RGLSYMGLMAPGRID1XOESPROC) (GLint n, GLfixed u1, GLfixed u2); +typedef void (APIENTRYP RGLSYMGLMAPGRID2XOESPROC) (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2); +typedef void (APIENTRYP RGLSYMGLMULTTRANSPOSEMATRIXXOESPROC) (const GLfixed *m); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1XOESPROC) (GLenum texture, GLfixed s); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD1XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2XOESPROC) (GLenum texture, GLfixed s, GLfixed t); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD2XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD3XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLMULTITEXCOORD4XVOESPROC) (GLenum texture, const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLNORMAL3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLPASSTHROUGHXOESPROC) (GLfixed token); +typedef void (APIENTRYP RGLSYMGLPIXELMAPXPROC) (GLenum map, GLint size, const GLfixed *values); +typedef void (APIENTRYP RGLSYMGLPIXELSTOREXPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP RGLSYMGLPIXELTRANSFERXOESPROC) (GLenum pname, GLfixed param); +typedef void (APIENTRYP RGLSYMGLPIXELZOOMXOESPROC) (GLfixed xfactor, GLfixed yfactor); +typedef void (APIENTRYP RGLSYMGLPRIORITIZETEXTURESXOESPROC) (GLsizei n, const GLuint *textures, const GLfixed *priorities); +typedef void (APIENTRYP RGLSYMGLRASTERPOS2XOESPROC) (GLfixed x, GLfixed y); +typedef void (APIENTRYP RGLSYMGLRASTERPOS2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLRASTERPOS3XOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP RGLSYMGLRASTERPOS3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLRASTERPOS4XOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed w); +typedef void (APIENTRYP RGLSYMGLRASTERPOS4XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLRECTXOESPROC) (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2); +typedef void (APIENTRYP RGLSYMGLRECTXVOESPROC) (const GLfixed *v1, const GLfixed *v2); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1XOESPROC) (GLfixed s); +typedef void (APIENTRYP RGLSYMGLTEXCOORD1XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2XOESPROC) (GLfixed s, GLfixed t); +typedef void (APIENTRYP RGLSYMGLTEXCOORD2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3XOESPROC) (GLfixed s, GLfixed t, GLfixed r); +typedef void (APIENTRYP RGLSYMGLTEXCOORD3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4XOESPROC) (GLfixed s, GLfixed t, GLfixed r, GLfixed q); +typedef void (APIENTRYP RGLSYMGLTEXCOORD4XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param); +typedef void (APIENTRYP RGLSYMGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params); +typedef void (APIENTRYP RGLSYMGLVERTEX2XOESPROC) (GLfixed x); +typedef void (APIENTRYP RGLSYMGLVERTEX2XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLVERTEX3XOESPROC) (GLfixed x, GLfixed y); +typedef void (APIENTRYP RGLSYMGLVERTEX3XVOESPROC) (const GLfixed *coords); +typedef void (APIENTRYP RGLSYMGLVERTEX4XOESPROC) (GLfixed x, GLfixed y, GLfixed z); +typedef void (APIENTRYP RGLSYMGLVERTEX4XVOESPROC) (const GLfixed *coords); +typedef GLbitfield (APIENTRYP RGLSYMGLQUERYMATRIXXOESPROC) (GLfixed *mantissa, GLint *exponent); +typedef void (APIENTRYP RGLSYMGLCLEARDEPTHFOESPROC) (GLclampf depth); +typedef void (APIENTRYP RGLSYMGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation); +typedef void (APIENTRYP RGLSYMGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f); +typedef void (APIENTRYP RGLSYMGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +typedef void (APIENTRYP RGLSYMGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat *equation); +typedef void (APIENTRYP RGLSYMGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +typedef void (APIENTRYP RGLSYMGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param); +typedef void (APIENTRYP RGLSYMGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (APIENTRYP RGLSYMGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (APIENTRYP RGLSYMGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (APIENTRYP RGLSYMGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (APIENTRYP RGLSYMGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params); + +#define glDrawRangeElements __rglgen_glDrawRangeElements +#define glTexImage3D __rglgen_glTexImage3D +#define glTexSubImage3D __rglgen_glTexSubImage3D +#define glCopyTexSubImage3D __rglgen_glCopyTexSubImage3D +#define glActiveTexture __rglgen_glActiveTexture +#define glSampleCoverage __rglgen_glSampleCoverage +#define glCompressedTexImage3D __rglgen_glCompressedTexImage3D +#define glCompressedTexImage2D __rglgen_glCompressedTexImage2D +#define glCompressedTexImage1D __rglgen_glCompressedTexImage1D +#define glCompressedTexSubImage3D __rglgen_glCompressedTexSubImage3D +#define glCompressedTexSubImage2D __rglgen_glCompressedTexSubImage2D +#define glCompressedTexSubImage1D __rglgen_glCompressedTexSubImage1D +#define glGetCompressedTexImage __rglgen_glGetCompressedTexImage +#define glClientActiveTexture __rglgen_glClientActiveTexture +#define glMultiTexCoord1d __rglgen_glMultiTexCoord1d +#define glMultiTexCoord1dv __rglgen_glMultiTexCoord1dv +#define glMultiTexCoord1f __rglgen_glMultiTexCoord1f +#define glMultiTexCoord1fv __rglgen_glMultiTexCoord1fv +#define glMultiTexCoord1i __rglgen_glMultiTexCoord1i +#define glMultiTexCoord1iv __rglgen_glMultiTexCoord1iv +#define glMultiTexCoord1s __rglgen_glMultiTexCoord1s +#define glMultiTexCoord1sv __rglgen_glMultiTexCoord1sv +#define glMultiTexCoord2d __rglgen_glMultiTexCoord2d +#define glMultiTexCoord2dv __rglgen_glMultiTexCoord2dv +#define glMultiTexCoord2f __rglgen_glMultiTexCoord2f +#define glMultiTexCoord2fv __rglgen_glMultiTexCoord2fv +#define glMultiTexCoord2i __rglgen_glMultiTexCoord2i +#define glMultiTexCoord2iv __rglgen_glMultiTexCoord2iv +#define glMultiTexCoord2s __rglgen_glMultiTexCoord2s +#define glMultiTexCoord2sv __rglgen_glMultiTexCoord2sv +#define glMultiTexCoord3d __rglgen_glMultiTexCoord3d +#define glMultiTexCoord3dv __rglgen_glMultiTexCoord3dv +#define glMultiTexCoord3f __rglgen_glMultiTexCoord3f +#define glMultiTexCoord3fv __rglgen_glMultiTexCoord3fv +#define glMultiTexCoord3i __rglgen_glMultiTexCoord3i +#define glMultiTexCoord3iv __rglgen_glMultiTexCoord3iv +#define glMultiTexCoord3s __rglgen_glMultiTexCoord3s +#define glMultiTexCoord3sv __rglgen_glMultiTexCoord3sv +#define glMultiTexCoord4d __rglgen_glMultiTexCoord4d +#define glMultiTexCoord4dv __rglgen_glMultiTexCoord4dv +#define glMultiTexCoord4f __rglgen_glMultiTexCoord4f +#define glMultiTexCoord4fv __rglgen_glMultiTexCoord4fv +#define glMultiTexCoord4i __rglgen_glMultiTexCoord4i +#define glMultiTexCoord4iv __rglgen_glMultiTexCoord4iv +#define glMultiTexCoord4s __rglgen_glMultiTexCoord4s +#define glMultiTexCoord4sv __rglgen_glMultiTexCoord4sv +#define glLoadTransposeMatrixf __rglgen_glLoadTransposeMatrixf +#define glLoadTransposeMatrixd __rglgen_glLoadTransposeMatrixd +#define glMultTransposeMatrixf __rglgen_glMultTransposeMatrixf +#define glMultTransposeMatrixd __rglgen_glMultTransposeMatrixd +#define glBlendFuncSeparate __rglgen_glBlendFuncSeparate +#define glMultiDrawArrays __rglgen_glMultiDrawArrays +#define glMultiDrawElements __rglgen_glMultiDrawElements +#define glPointParameterf __rglgen_glPointParameterf +#define glPointParameterfv __rglgen_glPointParameterfv +#define glPointParameteri __rglgen_glPointParameteri +#define glPointParameteriv __rglgen_glPointParameteriv +#define glFogCoordf __rglgen_glFogCoordf +#define glFogCoordfv __rglgen_glFogCoordfv +#define glFogCoordd __rglgen_glFogCoordd +#define glFogCoorddv __rglgen_glFogCoorddv +#define glFogCoordPointer __rglgen_glFogCoordPointer +#define glSecondaryColor3b __rglgen_glSecondaryColor3b +#define glSecondaryColor3bv __rglgen_glSecondaryColor3bv +#define glSecondaryColor3d __rglgen_glSecondaryColor3d +#define glSecondaryColor3dv __rglgen_glSecondaryColor3dv +#define glSecondaryColor3f __rglgen_glSecondaryColor3f +#define glSecondaryColor3fv __rglgen_glSecondaryColor3fv +#define glSecondaryColor3i __rglgen_glSecondaryColor3i +#define glSecondaryColor3iv __rglgen_glSecondaryColor3iv +#define glSecondaryColor3s __rglgen_glSecondaryColor3s +#define glSecondaryColor3sv __rglgen_glSecondaryColor3sv +#define glSecondaryColor3ub __rglgen_glSecondaryColor3ub +#define glSecondaryColor3ubv __rglgen_glSecondaryColor3ubv +#define glSecondaryColor3ui __rglgen_glSecondaryColor3ui +#define glSecondaryColor3uiv __rglgen_glSecondaryColor3uiv +#define glSecondaryColor3us __rglgen_glSecondaryColor3us +#define glSecondaryColor3usv __rglgen_glSecondaryColor3usv +#define glSecondaryColorPointer __rglgen_glSecondaryColorPointer +#define glWindowPos2d __rglgen_glWindowPos2d +#define glWindowPos2dv __rglgen_glWindowPos2dv +#define glWindowPos2f __rglgen_glWindowPos2f +#define glWindowPos2fv __rglgen_glWindowPos2fv +#define glWindowPos2i __rglgen_glWindowPos2i +#define glWindowPos2iv __rglgen_glWindowPos2iv +#define glWindowPos2s __rglgen_glWindowPos2s +#define glWindowPos2sv __rglgen_glWindowPos2sv +#define glWindowPos3d __rglgen_glWindowPos3d +#define glWindowPos3dv __rglgen_glWindowPos3dv +#define glWindowPos3f __rglgen_glWindowPos3f +#define glWindowPos3fv __rglgen_glWindowPos3fv +#define glWindowPos3i __rglgen_glWindowPos3i +#define glWindowPos3iv __rglgen_glWindowPos3iv +#define glWindowPos3s __rglgen_glWindowPos3s +#define glWindowPos3sv __rglgen_glWindowPos3sv +#define glBlendColor __rglgen_glBlendColor +#define glBlendEquation __rglgen_glBlendEquation +#define glGenQueries __rglgen_glGenQueries +#define glDeleteQueries __rglgen_glDeleteQueries +#define glIsQuery __rglgen_glIsQuery +#define glBeginQuery __rglgen_glBeginQuery +#define glEndQuery __rglgen_glEndQuery +#define glGetQueryiv __rglgen_glGetQueryiv +#define glGetQueryObjectiv __rglgen_glGetQueryObjectiv +#define glGetQueryObjectuiv __rglgen_glGetQueryObjectuiv +#define glBindBuffer __rglgen_glBindBuffer +#define glDeleteBuffers __rglgen_glDeleteBuffers +#define glGenBuffers __rglgen_glGenBuffers +#define glIsBuffer __rglgen_glIsBuffer +#define glBufferData __rglgen_glBufferData +#define glBufferSubData __rglgen_glBufferSubData +#define glGetBufferSubData __rglgen_glGetBufferSubData +#define glMapBuffer __rglgen_glMapBuffer +#define glUnmapBuffer __rglgen_glUnmapBuffer +#define glGetBufferParameteriv __rglgen_glGetBufferParameteriv +#define glGetBufferPointerv __rglgen_glGetBufferPointerv +#define glBlendEquationSeparate __rglgen_glBlendEquationSeparate +#define glDrawBuffers __rglgen_glDrawBuffers +#define glStencilOpSeparate __rglgen_glStencilOpSeparate +#define glStencilFuncSeparate __rglgen_glStencilFuncSeparate +#define glStencilMaskSeparate __rglgen_glStencilMaskSeparate +#define glAttachShader __rglgen_glAttachShader +#define glBindAttribLocation __rglgen_glBindAttribLocation +#define glCompileShader __rglgen_glCompileShader +#define glCreateProgram __rglgen_glCreateProgram +#define glCreateShader __rglgen_glCreateShader +#define glDeleteProgram __rglgen_glDeleteProgram +#define glDeleteShader __rglgen_glDeleteShader +#define glDetachShader __rglgen_glDetachShader +#define glDisableVertexAttribArray __rglgen_glDisableVertexAttribArray +#define glEnableVertexAttribArray __rglgen_glEnableVertexAttribArray +#define glGetActiveAttrib __rglgen_glGetActiveAttrib +#define glGetActiveUniform __rglgen_glGetActiveUniform +#define glGetAttachedShaders __rglgen_glGetAttachedShaders +#define glGetAttribLocation __rglgen_glGetAttribLocation +#define glGetProgramiv __rglgen_glGetProgramiv +#define glGetProgramInfoLog __rglgen_glGetProgramInfoLog +#define glGetShaderiv __rglgen_glGetShaderiv +#define glGetShaderInfoLog __rglgen_glGetShaderInfoLog +#define glGetShaderSource __rglgen_glGetShaderSource +#define glGetUniformLocation __rglgen_glGetUniformLocation +#define glGetUniformfv __rglgen_glGetUniformfv +#define glGetUniformiv __rglgen_glGetUniformiv +#define glGetVertexAttribdv __rglgen_glGetVertexAttribdv +#define glGetVertexAttribfv __rglgen_glGetVertexAttribfv +#define glGetVertexAttribiv __rglgen_glGetVertexAttribiv +#define glGetVertexAttribPointerv __rglgen_glGetVertexAttribPointerv +#define glIsProgram __rglgen_glIsProgram +#define glIsShader __rglgen_glIsShader +#define glLinkProgram __rglgen_glLinkProgram +#define glShaderSource __rglgen_glShaderSource +#define glUseProgram __rglgen_glUseProgram +#define glUniform1f __rglgen_glUniform1f +#define glUniform2f __rglgen_glUniform2f +#define glUniform3f __rglgen_glUniform3f +#define glUniform4f __rglgen_glUniform4f +#define glUniform1i __rglgen_glUniform1i +#define glUniform2i __rglgen_glUniform2i +#define glUniform3i __rglgen_glUniform3i +#define glUniform4i __rglgen_glUniform4i +#define glUniform1fv __rglgen_glUniform1fv +#define glUniform2fv __rglgen_glUniform2fv +#define glUniform3fv __rglgen_glUniform3fv +#define glUniform4fv __rglgen_glUniform4fv +#define glUniform1iv __rglgen_glUniform1iv +#define glUniform2iv __rglgen_glUniform2iv +#define glUniform3iv __rglgen_glUniform3iv +#define glUniform4iv __rglgen_glUniform4iv +#define glUniformMatrix2fv __rglgen_glUniformMatrix2fv +#define glUniformMatrix3fv __rglgen_glUniformMatrix3fv +#define glUniformMatrix4fv __rglgen_glUniformMatrix4fv +#define glValidateProgram __rglgen_glValidateProgram +#define glVertexAttrib1d __rglgen_glVertexAttrib1d +#define glVertexAttrib1dv __rglgen_glVertexAttrib1dv +#define glVertexAttrib1f __rglgen_glVertexAttrib1f +#define glVertexAttrib1fv __rglgen_glVertexAttrib1fv +#define glVertexAttrib1s __rglgen_glVertexAttrib1s +#define glVertexAttrib1sv __rglgen_glVertexAttrib1sv +#define glVertexAttrib2d __rglgen_glVertexAttrib2d +#define glVertexAttrib2dv __rglgen_glVertexAttrib2dv +#define glVertexAttrib2f __rglgen_glVertexAttrib2f +#define glVertexAttrib2fv __rglgen_glVertexAttrib2fv +#define glVertexAttrib2s __rglgen_glVertexAttrib2s +#define glVertexAttrib2sv __rglgen_glVertexAttrib2sv +#define glVertexAttrib3d __rglgen_glVertexAttrib3d +#define glVertexAttrib3dv __rglgen_glVertexAttrib3dv +#define glVertexAttrib3f __rglgen_glVertexAttrib3f +#define glVertexAttrib3fv __rglgen_glVertexAttrib3fv +#define glVertexAttrib3s __rglgen_glVertexAttrib3s +#define glVertexAttrib3sv __rglgen_glVertexAttrib3sv +#define glVertexAttrib4Nbv __rglgen_glVertexAttrib4Nbv +#define glVertexAttrib4Niv __rglgen_glVertexAttrib4Niv +#define glVertexAttrib4Nsv __rglgen_glVertexAttrib4Nsv +#define glVertexAttrib4Nub __rglgen_glVertexAttrib4Nub +#define glVertexAttrib4Nubv __rglgen_glVertexAttrib4Nubv +#define glVertexAttrib4Nuiv __rglgen_glVertexAttrib4Nuiv +#define glVertexAttrib4Nusv __rglgen_glVertexAttrib4Nusv +#define glVertexAttrib4bv __rglgen_glVertexAttrib4bv +#define glVertexAttrib4d __rglgen_glVertexAttrib4d +#define glVertexAttrib4dv __rglgen_glVertexAttrib4dv +#define glVertexAttrib4f __rglgen_glVertexAttrib4f +#define glVertexAttrib4fv __rglgen_glVertexAttrib4fv +#define glVertexAttrib4iv __rglgen_glVertexAttrib4iv +#define glVertexAttrib4s __rglgen_glVertexAttrib4s +#define glVertexAttrib4sv __rglgen_glVertexAttrib4sv +#define glVertexAttrib4ubv __rglgen_glVertexAttrib4ubv +#define glVertexAttrib4uiv __rglgen_glVertexAttrib4uiv +#define glVertexAttrib4usv __rglgen_glVertexAttrib4usv +#define glVertexAttribPointer __rglgen_glVertexAttribPointer +#define glUniformMatrix2x3fv __rglgen_glUniformMatrix2x3fv +#define glUniformMatrix3x2fv __rglgen_glUniformMatrix3x2fv +#define glUniformMatrix2x4fv __rglgen_glUniformMatrix2x4fv +#define glUniformMatrix4x2fv __rglgen_glUniformMatrix4x2fv +#define glUniformMatrix3x4fv __rglgen_glUniformMatrix3x4fv +#define glUniformMatrix4x3fv __rglgen_glUniformMatrix4x3fv +#define glColorMaski __rglgen_glColorMaski +#define glGetBooleani_v __rglgen_glGetBooleani_v +#define glGetIntegeri_v __rglgen_glGetIntegeri_v +#define glEnablei __rglgen_glEnablei +#define glDisablei __rglgen_glDisablei +#define glIsEnabledi __rglgen_glIsEnabledi +#define glBeginTransformFeedback __rglgen_glBeginTransformFeedback +#define glEndTransformFeedback __rglgen_glEndTransformFeedback +#define glBindBufferRange __rglgen_glBindBufferRange +#define glBindBufferBase __rglgen_glBindBufferBase +#define glTransformFeedbackVaryings __rglgen_glTransformFeedbackVaryings +#define glGetTransformFeedbackVarying __rglgen_glGetTransformFeedbackVarying +#define glClampColor __rglgen_glClampColor +#define glBeginConditionalRender __rglgen_glBeginConditionalRender +#define glEndConditionalRender __rglgen_glEndConditionalRender +#define glVertexAttribIPointer __rglgen_glVertexAttribIPointer +#define glGetVertexAttribIiv __rglgen_glGetVertexAttribIiv +#define glGetVertexAttribIuiv __rglgen_glGetVertexAttribIuiv +#define glVertexAttribI1i __rglgen_glVertexAttribI1i +#define glVertexAttribI2i __rglgen_glVertexAttribI2i +#define glVertexAttribI3i __rglgen_glVertexAttribI3i +#define glVertexAttribI4i __rglgen_glVertexAttribI4i +#define glVertexAttribI1ui __rglgen_glVertexAttribI1ui +#define glVertexAttribI2ui __rglgen_glVertexAttribI2ui +#define glVertexAttribI3ui __rglgen_glVertexAttribI3ui +#define glVertexAttribI4ui __rglgen_glVertexAttribI4ui +#define glVertexAttribI1iv __rglgen_glVertexAttribI1iv +#define glVertexAttribI2iv __rglgen_glVertexAttribI2iv +#define glVertexAttribI3iv __rglgen_glVertexAttribI3iv +#define glVertexAttribI4iv __rglgen_glVertexAttribI4iv +#define glVertexAttribI1uiv __rglgen_glVertexAttribI1uiv +#define glVertexAttribI2uiv __rglgen_glVertexAttribI2uiv +#define glVertexAttribI3uiv __rglgen_glVertexAttribI3uiv +#define glVertexAttribI4uiv __rglgen_glVertexAttribI4uiv +#define glVertexAttribI4bv __rglgen_glVertexAttribI4bv +#define glVertexAttribI4sv __rglgen_glVertexAttribI4sv +#define glVertexAttribI4ubv __rglgen_glVertexAttribI4ubv +#define glVertexAttribI4usv __rglgen_glVertexAttribI4usv +#define glGetUniformuiv __rglgen_glGetUniformuiv +#define glBindFragDataLocation __rglgen_glBindFragDataLocation +#define glGetFragDataLocation __rglgen_glGetFragDataLocation +#define glUniform1ui __rglgen_glUniform1ui +#define glUniform2ui __rglgen_glUniform2ui +#define glUniform3ui __rglgen_glUniform3ui +#define glUniform4ui __rglgen_glUniform4ui +#define glUniform1uiv __rglgen_glUniform1uiv +#define glUniform2uiv __rglgen_glUniform2uiv +#define glUniform3uiv __rglgen_glUniform3uiv +#define glUniform4uiv __rglgen_glUniform4uiv +#define glTexParameterIiv __rglgen_glTexParameterIiv +#define glTexParameterIuiv __rglgen_glTexParameterIuiv +#define glGetTexParameterIiv __rglgen_glGetTexParameterIiv +#define glGetTexParameterIuiv __rglgen_glGetTexParameterIuiv +#define glClearBufferiv __rglgen_glClearBufferiv +#define glClearBufferuiv __rglgen_glClearBufferuiv +#define glClearBufferfv __rglgen_glClearBufferfv +#define glClearBufferfi __rglgen_glClearBufferfi +#define glGetStringi __rglgen_glGetStringi +#define glIsRenderbuffer __rglgen_glIsRenderbuffer +#define glBindRenderbuffer __rglgen_glBindRenderbuffer +#define glDeleteRenderbuffers __rglgen_glDeleteRenderbuffers +#define glGenRenderbuffers __rglgen_glGenRenderbuffers +#define glRenderbufferStorage __rglgen_glRenderbufferStorage +#define glGetRenderbufferParameteriv __rglgen_glGetRenderbufferParameteriv +#define glIsFramebuffer __rglgen_glIsFramebuffer +#define glBindFramebuffer __rglgen_glBindFramebuffer +#define glDeleteFramebuffers __rglgen_glDeleteFramebuffers +#define glGenFramebuffers __rglgen_glGenFramebuffers +#define glCheckFramebufferStatus __rglgen_glCheckFramebufferStatus +#define glFramebufferTexture1D __rglgen_glFramebufferTexture1D +#define glFramebufferTexture2D __rglgen_glFramebufferTexture2D +#define glFramebufferTexture3D __rglgen_glFramebufferTexture3D +#define glFramebufferRenderbuffer __rglgen_glFramebufferRenderbuffer +#define glGetFramebufferAttachmentParameteriv __rglgen_glGetFramebufferAttachmentParameteriv +#define glGenerateMipmap __rglgen_glGenerateMipmap +#define glBlitFramebuffer __rglgen_glBlitFramebuffer +#define glRenderbufferStorageMultisample __rglgen_glRenderbufferStorageMultisample +#define glFramebufferTextureLayer __rglgen_glFramebufferTextureLayer +#define glMapBufferRange __rglgen_glMapBufferRange +#define glFlushMappedBufferRange __rglgen_glFlushMappedBufferRange +#define glBindVertexArray __rglgen_glBindVertexArray +#define glDeleteVertexArrays __rglgen_glDeleteVertexArrays +#define glGenVertexArrays __rglgen_glGenVertexArrays +#define glIsVertexArray __rglgen_glIsVertexArray +#define glDrawArraysInstanced __rglgen_glDrawArraysInstanced +#define glDrawElementsInstanced __rglgen_glDrawElementsInstanced +#define glTexBuffer __rglgen_glTexBuffer +#define glPrimitiveRestartIndex __rglgen_glPrimitiveRestartIndex +#define glCopyBufferSubData __rglgen_glCopyBufferSubData +#define glGetUniformIndices __rglgen_glGetUniformIndices +#define glGetActiveUniformsiv __rglgen_glGetActiveUniformsiv +#define glGetActiveUniformName __rglgen_glGetActiveUniformName +#define glGetUniformBlockIndex __rglgen_glGetUniformBlockIndex +#define glGetActiveUniformBlockiv __rglgen_glGetActiveUniformBlockiv +#define glGetActiveUniformBlockName __rglgen_glGetActiveUniformBlockName +#define glUniformBlockBinding __rglgen_glUniformBlockBinding +#define glDrawElementsBaseVertex __rglgen_glDrawElementsBaseVertex +#define glDrawRangeElementsBaseVertex __rglgen_glDrawRangeElementsBaseVertex +#define glDrawElementsInstancedBaseVertex __rglgen_glDrawElementsInstancedBaseVertex +#define glMultiDrawElementsBaseVertex __rglgen_glMultiDrawElementsBaseVertex +#define glProvokingVertex __rglgen_glProvokingVertex +#define glFenceSync __rglgen_glFenceSync +#define glIsSync __rglgen_glIsSync +#define glDeleteSync __rglgen_glDeleteSync +#define glClientWaitSync __rglgen_glClientWaitSync +#define glWaitSync __rglgen_glWaitSync +#define glGetInteger64v __rglgen_glGetInteger64v +#define glGetSynciv __rglgen_glGetSynciv +#define glGetInteger64i_v __rglgen_glGetInteger64i_v +#define glGetBufferParameteri64v __rglgen_glGetBufferParameteri64v +#define glFramebufferTexture __rglgen_glFramebufferTexture +#define glTexImage2DMultisample __rglgen_glTexImage2DMultisample +#define glTexImage3DMultisample __rglgen_glTexImage3DMultisample +#define glGetMultisamplefv __rglgen_glGetMultisamplefv +#define glSampleMaski __rglgen_glSampleMaski +#define glBindFragDataLocationIndexed __rglgen_glBindFragDataLocationIndexed +#define glGetFragDataIndex __rglgen_glGetFragDataIndex +#define glGenSamplers __rglgen_glGenSamplers +#define glDeleteSamplers __rglgen_glDeleteSamplers +#define glIsSampler __rglgen_glIsSampler +#define glBindSampler __rglgen_glBindSampler +#define glSamplerParameteri __rglgen_glSamplerParameteri +#define glSamplerParameteriv __rglgen_glSamplerParameteriv +#define glSamplerParameterf __rglgen_glSamplerParameterf +#define glSamplerParameterfv __rglgen_glSamplerParameterfv +#define glSamplerParameterIiv __rglgen_glSamplerParameterIiv +#define glSamplerParameterIuiv __rglgen_glSamplerParameterIuiv +#define glGetSamplerParameteriv __rglgen_glGetSamplerParameteriv +#define glGetSamplerParameterIiv __rglgen_glGetSamplerParameterIiv +#define glGetSamplerParameterfv __rglgen_glGetSamplerParameterfv +#define glGetSamplerParameterIuiv __rglgen_glGetSamplerParameterIuiv +#define glQueryCounter __rglgen_glQueryCounter +#define glGetQueryObjecti64v __rglgen_glGetQueryObjecti64v +#define glGetQueryObjectui64v __rglgen_glGetQueryObjectui64v +#define glVertexAttribDivisor __rglgen_glVertexAttribDivisor +#define glVertexAttribP1ui __rglgen_glVertexAttribP1ui +#define glVertexAttribP1uiv __rglgen_glVertexAttribP1uiv +#define glVertexAttribP2ui __rglgen_glVertexAttribP2ui +#define glVertexAttribP2uiv __rglgen_glVertexAttribP2uiv +#define glVertexAttribP3ui __rglgen_glVertexAttribP3ui +#define glVertexAttribP3uiv __rglgen_glVertexAttribP3uiv +#define glVertexAttribP4ui __rglgen_glVertexAttribP4ui +#define glVertexAttribP4uiv __rglgen_glVertexAttribP4uiv +#define glVertexP2ui __rglgen_glVertexP2ui +#define glVertexP2uiv __rglgen_glVertexP2uiv +#define glVertexP3ui __rglgen_glVertexP3ui +#define glVertexP3uiv __rglgen_glVertexP3uiv +#define glVertexP4ui __rglgen_glVertexP4ui +#define glVertexP4uiv __rglgen_glVertexP4uiv +#define glTexCoordP1ui __rglgen_glTexCoordP1ui +#define glTexCoordP1uiv __rglgen_glTexCoordP1uiv +#define glTexCoordP2ui __rglgen_glTexCoordP2ui +#define glTexCoordP2uiv __rglgen_glTexCoordP2uiv +#define glTexCoordP3ui __rglgen_glTexCoordP3ui +#define glTexCoordP3uiv __rglgen_glTexCoordP3uiv +#define glTexCoordP4ui __rglgen_glTexCoordP4ui +#define glTexCoordP4uiv __rglgen_glTexCoordP4uiv +#define glMultiTexCoordP1ui __rglgen_glMultiTexCoordP1ui +#define glMultiTexCoordP1uiv __rglgen_glMultiTexCoordP1uiv +#define glMultiTexCoordP2ui __rglgen_glMultiTexCoordP2ui +#define glMultiTexCoordP2uiv __rglgen_glMultiTexCoordP2uiv +#define glMultiTexCoordP3ui __rglgen_glMultiTexCoordP3ui +#define glMultiTexCoordP3uiv __rglgen_glMultiTexCoordP3uiv +#define glMultiTexCoordP4ui __rglgen_glMultiTexCoordP4ui +#define glMultiTexCoordP4uiv __rglgen_glMultiTexCoordP4uiv +#define glNormalP3ui __rglgen_glNormalP3ui +#define glNormalP3uiv __rglgen_glNormalP3uiv +#define glColorP3ui __rglgen_glColorP3ui +#define glColorP3uiv __rglgen_glColorP3uiv +#define glColorP4ui __rglgen_glColorP4ui +#define glColorP4uiv __rglgen_glColorP4uiv +#define glSecondaryColorP3ui __rglgen_glSecondaryColorP3ui +#define glSecondaryColorP3uiv __rglgen_glSecondaryColorP3uiv +#define glMinSampleShading __rglgen_glMinSampleShading +#define glBlendEquationi __rglgen_glBlendEquationi +#define glBlendEquationSeparatei __rglgen_glBlendEquationSeparatei +#define glBlendFunci __rglgen_glBlendFunci +#define glBlendFuncSeparatei __rglgen_glBlendFuncSeparatei +#define glDrawArraysIndirect __rglgen_glDrawArraysIndirect +#define glDrawElementsIndirect __rglgen_glDrawElementsIndirect +#define glUniform1d __rglgen_glUniform1d +#define glUniform2d __rglgen_glUniform2d +#define glUniform3d __rglgen_glUniform3d +#define glUniform4d __rglgen_glUniform4d +#define glUniform1dv __rglgen_glUniform1dv +#define glUniform2dv __rglgen_glUniform2dv +#define glUniform3dv __rglgen_glUniform3dv +#define glUniform4dv __rglgen_glUniform4dv +#define glUniformMatrix2dv __rglgen_glUniformMatrix2dv +#define glUniformMatrix3dv __rglgen_glUniformMatrix3dv +#define glUniformMatrix4dv __rglgen_glUniformMatrix4dv +#define glUniformMatrix2x3dv __rglgen_glUniformMatrix2x3dv +#define glUniformMatrix2x4dv __rglgen_glUniformMatrix2x4dv +#define glUniformMatrix3x2dv __rglgen_glUniformMatrix3x2dv +#define glUniformMatrix3x4dv __rglgen_glUniformMatrix3x4dv +#define glUniformMatrix4x2dv __rglgen_glUniformMatrix4x2dv +#define glUniformMatrix4x3dv __rglgen_glUniformMatrix4x3dv +#define glGetUniformdv __rglgen_glGetUniformdv +#define glGetSubroutineUniformLocation __rglgen_glGetSubroutineUniformLocation +#define glGetSubroutineIndex __rglgen_glGetSubroutineIndex +#define glGetActiveSubroutineUniformiv __rglgen_glGetActiveSubroutineUniformiv +#define glGetActiveSubroutineUniformName __rglgen_glGetActiveSubroutineUniformName +#define glGetActiveSubroutineName __rglgen_glGetActiveSubroutineName +#define glUniformSubroutinesuiv __rglgen_glUniformSubroutinesuiv +#define glGetUniformSubroutineuiv __rglgen_glGetUniformSubroutineuiv +#define glGetProgramStageiv __rglgen_glGetProgramStageiv +#define glPatchParameteri __rglgen_glPatchParameteri +#define glPatchParameterfv __rglgen_glPatchParameterfv +#define glBindTransformFeedback __rglgen_glBindTransformFeedback +#define glDeleteTransformFeedbacks __rglgen_glDeleteTransformFeedbacks +#define glGenTransformFeedbacks __rglgen_glGenTransformFeedbacks +#define glIsTransformFeedback __rglgen_glIsTransformFeedback +#define glPauseTransformFeedback __rglgen_glPauseTransformFeedback +#define glResumeTransformFeedback __rglgen_glResumeTransformFeedback +#define glDrawTransformFeedback __rglgen_glDrawTransformFeedback +#define glDrawTransformFeedbackStream __rglgen_glDrawTransformFeedbackStream +#define glBeginQueryIndexed __rglgen_glBeginQueryIndexed +#define glEndQueryIndexed __rglgen_glEndQueryIndexed +#define glGetQueryIndexediv __rglgen_glGetQueryIndexediv +#define glReleaseShaderCompiler __rglgen_glReleaseShaderCompiler +#define glShaderBinary __rglgen_glShaderBinary +#define glGetShaderPrecisionFormat __rglgen_glGetShaderPrecisionFormat +#define glDepthRangef __rglgen_glDepthRangef +#define glClearDepthf __rglgen_glClearDepthf +#define glGetProgramBinary __rglgen_glGetProgramBinary +#define glProgramBinary __rglgen_glProgramBinary +#define glProgramParameteri __rglgen_glProgramParameteri +#define glUseProgramStages __rglgen_glUseProgramStages +#define glActiveShaderProgram __rglgen_glActiveShaderProgram +#define glCreateShaderProgramv __rglgen_glCreateShaderProgramv +#define glBindProgramPipeline __rglgen_glBindProgramPipeline +#define glDeleteProgramPipelines __rglgen_glDeleteProgramPipelines +#define glGenProgramPipelines __rglgen_glGenProgramPipelines +#define glIsProgramPipeline __rglgen_glIsProgramPipeline +#define glGetProgramPipelineiv __rglgen_glGetProgramPipelineiv +#define glProgramUniform1i __rglgen_glProgramUniform1i +#define glProgramUniform1iv __rglgen_glProgramUniform1iv +#define glProgramUniform1f __rglgen_glProgramUniform1f +#define glProgramUniform1fv __rglgen_glProgramUniform1fv +#define glProgramUniform1d __rglgen_glProgramUniform1d +#define glProgramUniform1dv __rglgen_glProgramUniform1dv +#define glProgramUniform1ui __rglgen_glProgramUniform1ui +#define glProgramUniform1uiv __rglgen_glProgramUniform1uiv +#define glProgramUniform2i __rglgen_glProgramUniform2i +#define glProgramUniform2iv __rglgen_glProgramUniform2iv +#define glProgramUniform2f __rglgen_glProgramUniform2f +#define glProgramUniform2fv __rglgen_glProgramUniform2fv +#define glProgramUniform2d __rglgen_glProgramUniform2d +#define glProgramUniform2dv __rglgen_glProgramUniform2dv +#define glProgramUniform2ui __rglgen_glProgramUniform2ui +#define glProgramUniform2uiv __rglgen_glProgramUniform2uiv +#define glProgramUniform3i __rglgen_glProgramUniform3i +#define glProgramUniform3iv __rglgen_glProgramUniform3iv +#define glProgramUniform3f __rglgen_glProgramUniform3f +#define glProgramUniform3fv __rglgen_glProgramUniform3fv +#define glProgramUniform3d __rglgen_glProgramUniform3d +#define glProgramUniform3dv __rglgen_glProgramUniform3dv +#define glProgramUniform3ui __rglgen_glProgramUniform3ui +#define glProgramUniform3uiv __rglgen_glProgramUniform3uiv +#define glProgramUniform4i __rglgen_glProgramUniform4i +#define glProgramUniform4iv __rglgen_glProgramUniform4iv +#define glProgramUniform4f __rglgen_glProgramUniform4f +#define glProgramUniform4fv __rglgen_glProgramUniform4fv +#define glProgramUniform4d __rglgen_glProgramUniform4d +#define glProgramUniform4dv __rglgen_glProgramUniform4dv +#define glProgramUniform4ui __rglgen_glProgramUniform4ui +#define glProgramUniform4uiv __rglgen_glProgramUniform4uiv +#define glProgramUniformMatrix2fv __rglgen_glProgramUniformMatrix2fv +#define glProgramUniformMatrix3fv __rglgen_glProgramUniformMatrix3fv +#define glProgramUniformMatrix4fv __rglgen_glProgramUniformMatrix4fv +#define glProgramUniformMatrix2dv __rglgen_glProgramUniformMatrix2dv +#define glProgramUniformMatrix3dv __rglgen_glProgramUniformMatrix3dv +#define glProgramUniformMatrix4dv __rglgen_glProgramUniformMatrix4dv +#define glProgramUniformMatrix2x3fv __rglgen_glProgramUniformMatrix2x3fv +#define glProgramUniformMatrix3x2fv __rglgen_glProgramUniformMatrix3x2fv +#define glProgramUniformMatrix2x4fv __rglgen_glProgramUniformMatrix2x4fv +#define glProgramUniformMatrix4x2fv __rglgen_glProgramUniformMatrix4x2fv +#define glProgramUniformMatrix3x4fv __rglgen_glProgramUniformMatrix3x4fv +#define glProgramUniformMatrix4x3fv __rglgen_glProgramUniformMatrix4x3fv +#define glProgramUniformMatrix2x3dv __rglgen_glProgramUniformMatrix2x3dv +#define glProgramUniformMatrix3x2dv __rglgen_glProgramUniformMatrix3x2dv +#define glProgramUniformMatrix2x4dv __rglgen_glProgramUniformMatrix2x4dv +#define glProgramUniformMatrix4x2dv __rglgen_glProgramUniformMatrix4x2dv +#define glProgramUniformMatrix3x4dv __rglgen_glProgramUniformMatrix3x4dv +#define glProgramUniformMatrix4x3dv __rglgen_glProgramUniformMatrix4x3dv +#define glValidateProgramPipeline __rglgen_glValidateProgramPipeline +#define glGetProgramPipelineInfoLog __rglgen_glGetProgramPipelineInfoLog +#define glVertexAttribL1d __rglgen_glVertexAttribL1d +#define glVertexAttribL2d __rglgen_glVertexAttribL2d +#define glVertexAttribL3d __rglgen_glVertexAttribL3d +#define glVertexAttribL4d __rglgen_glVertexAttribL4d +#define glVertexAttribL1dv __rglgen_glVertexAttribL1dv +#define glVertexAttribL2dv __rglgen_glVertexAttribL2dv +#define glVertexAttribL3dv __rglgen_glVertexAttribL3dv +#define glVertexAttribL4dv __rglgen_glVertexAttribL4dv +#define glVertexAttribLPointer __rglgen_glVertexAttribLPointer +#define glGetVertexAttribLdv __rglgen_glGetVertexAttribLdv +#define glViewportArrayv __rglgen_glViewportArrayv +#define glViewportIndexedf __rglgen_glViewportIndexedf +#define glViewportIndexedfv __rglgen_glViewportIndexedfv +#define glScissorArrayv __rglgen_glScissorArrayv +#define glScissorIndexed __rglgen_glScissorIndexed +#define glScissorIndexedv __rglgen_glScissorIndexedv +#define glDepthRangeArrayv __rglgen_glDepthRangeArrayv +#define glDepthRangeIndexed __rglgen_glDepthRangeIndexed +#define glGetFloati_v __rglgen_glGetFloati_v +#define glGetDoublei_v __rglgen_glGetDoublei_v +#define glDrawArraysInstancedBaseInstance __rglgen_glDrawArraysInstancedBaseInstance +#define glDrawElementsInstancedBaseInstance __rglgen_glDrawElementsInstancedBaseInstance +#define glDrawElementsInstancedBaseVertexBaseInstance __rglgen_glDrawElementsInstancedBaseVertexBaseInstance +#define glGetInternalformativ __rglgen_glGetInternalformativ +#define glGetActiveAtomicCounterBufferiv __rglgen_glGetActiveAtomicCounterBufferiv +#define glBindImageTexture __rglgen_glBindImageTexture +#define glMemoryBarrier __rglgen_glMemoryBarrier +#define glTexStorage1D __rglgen_glTexStorage1D +#define glTexStorage2D __rglgen_glTexStorage2D +#define glTexStorage3D __rglgen_glTexStorage3D +#define glDrawTransformFeedbackInstanced __rglgen_glDrawTransformFeedbackInstanced +#define glDrawTransformFeedbackStreamInstanced __rglgen_glDrawTransformFeedbackStreamInstanced +#define glClearBufferData __rglgen_glClearBufferData +#define glClearBufferSubData __rglgen_glClearBufferSubData +#define glDispatchCompute __rglgen_glDispatchCompute +#define glDispatchComputeIndirect __rglgen_glDispatchComputeIndirect +#define glCopyImageSubData __rglgen_glCopyImageSubData +#define glFramebufferParameteri __rglgen_glFramebufferParameteri +#define glGetFramebufferParameteriv __rglgen_glGetFramebufferParameteriv +#define glGetInternalformati64v __rglgen_glGetInternalformati64v +#define glInvalidateTexSubImage __rglgen_glInvalidateTexSubImage +#define glInvalidateTexImage __rglgen_glInvalidateTexImage +#define glInvalidateBufferSubData __rglgen_glInvalidateBufferSubData +#define glInvalidateBufferData __rglgen_glInvalidateBufferData +#define glInvalidateFramebuffer __rglgen_glInvalidateFramebuffer +#define glInvalidateSubFramebuffer __rglgen_glInvalidateSubFramebuffer +#define glMultiDrawArraysIndirect __rglgen_glMultiDrawArraysIndirect +#define glMultiDrawElementsIndirect __rglgen_glMultiDrawElementsIndirect +#define glGetProgramInterfaceiv __rglgen_glGetProgramInterfaceiv +#define glGetProgramResourceIndex __rglgen_glGetProgramResourceIndex +#define glGetProgramResourceName __rglgen_glGetProgramResourceName +#define glGetProgramResourceiv __rglgen_glGetProgramResourceiv +#define glGetProgramResourceLocation __rglgen_glGetProgramResourceLocation +#define glGetProgramResourceLocationIndex __rglgen_glGetProgramResourceLocationIndex +#define glShaderStorageBlockBinding __rglgen_glShaderStorageBlockBinding +#define glTexBufferRange __rglgen_glTexBufferRange +#define glTexStorage2DMultisample __rglgen_glTexStorage2DMultisample +#define glTexStorage3DMultisample __rglgen_glTexStorage3DMultisample +#define glTextureView __rglgen_glTextureView +#define glBindVertexBuffer __rglgen_glBindVertexBuffer +#define glVertexAttribFormat __rglgen_glVertexAttribFormat +#define glVertexAttribIFormat __rglgen_glVertexAttribIFormat +#define glVertexAttribLFormat __rglgen_glVertexAttribLFormat +#define glVertexAttribBinding __rglgen_glVertexAttribBinding +#define glVertexBindingDivisor __rglgen_glVertexBindingDivisor +#define glDebugMessageControl __rglgen_glDebugMessageControl +#define glDebugMessageInsert __rglgen_glDebugMessageInsert +#define glDebugMessageCallback __rglgen_glDebugMessageCallback +#define glGetDebugMessageLog __rglgen_glGetDebugMessageLog +#define glPushDebugGroup __rglgen_glPushDebugGroup +#define glPopDebugGroup __rglgen_glPopDebugGroup +#define glObjectLabel __rglgen_glObjectLabel +#define glGetObjectLabel __rglgen_glGetObjectLabel +#define glObjectPtrLabel __rglgen_glObjectPtrLabel +#define glGetObjectPtrLabel __rglgen_glGetObjectPtrLabel +#define glBufferStorage __rglgen_glBufferStorage +#define glClearTexImage __rglgen_glClearTexImage +#define glClearTexSubImage __rglgen_glClearTexSubImage +#define glBindBuffersBase __rglgen_glBindBuffersBase +#define glBindBuffersRange __rglgen_glBindBuffersRange +#define glBindTextures __rglgen_glBindTextures +#define glBindSamplers __rglgen_glBindSamplers +#define glBindImageTextures __rglgen_glBindImageTextures +#define glBindVertexBuffers __rglgen_glBindVertexBuffers +#define glGetTextureHandleARB __rglgen_glGetTextureHandleARB +#define glGetTextureSamplerHandleARB __rglgen_glGetTextureSamplerHandleARB +#define glMakeTextureHandleResidentARB __rglgen_glMakeTextureHandleResidentARB +#define glMakeTextureHandleNonResidentARB __rglgen_glMakeTextureHandleNonResidentARB +#define glGetImageHandleARB __rglgen_glGetImageHandleARB +#define glMakeImageHandleResidentARB __rglgen_glMakeImageHandleResidentARB +#define glMakeImageHandleNonResidentARB __rglgen_glMakeImageHandleNonResidentARB +#define glUniformHandleui64ARB __rglgen_glUniformHandleui64ARB +#define glUniformHandleui64vARB __rglgen_glUniformHandleui64vARB +#define glProgramUniformHandleui64ARB __rglgen_glProgramUniformHandleui64ARB +#define glProgramUniformHandleui64vARB __rglgen_glProgramUniformHandleui64vARB +#define glIsTextureHandleResidentARB __rglgen_glIsTextureHandleResidentARB +#define glIsImageHandleResidentARB __rglgen_glIsImageHandleResidentARB +#define glVertexAttribL1ui64ARB __rglgen_glVertexAttribL1ui64ARB +#define glVertexAttribL1ui64vARB __rglgen_glVertexAttribL1ui64vARB +#define glGetVertexAttribLui64vARB __rglgen_glGetVertexAttribLui64vARB +#define glCreateSyncFromCLeventARB __rglgen_glCreateSyncFromCLeventARB +#define glClampColorARB __rglgen_glClampColorARB +#define glDispatchComputeGroupSizeARB __rglgen_glDispatchComputeGroupSizeARB +#define glDebugMessageControlARB __rglgen_glDebugMessageControlARB +#define glDebugMessageInsertARB __rglgen_glDebugMessageInsertARB +#define glDebugMessageCallbackARB __rglgen_glDebugMessageCallbackARB +#define glGetDebugMessageLogARB __rglgen_glGetDebugMessageLogARB +#define glDrawBuffersARB __rglgen_glDrawBuffersARB +#define glBlendEquationiARB __rglgen_glBlendEquationiARB +#define glBlendEquationSeparateiARB __rglgen_glBlendEquationSeparateiARB +#define glBlendFunciARB __rglgen_glBlendFunciARB +#define glBlendFuncSeparateiARB __rglgen_glBlendFuncSeparateiARB +#define glDrawArraysInstancedARB __rglgen_glDrawArraysInstancedARB +#define glDrawElementsInstancedARB __rglgen_glDrawElementsInstancedARB +#define glProgramStringARB __rglgen_glProgramStringARB +#define glBindProgramARB __rglgen_glBindProgramARB +#define glDeleteProgramsARB __rglgen_glDeleteProgramsARB +#define glGenProgramsARB __rglgen_glGenProgramsARB +#define glProgramEnvParameter4dARB __rglgen_glProgramEnvParameter4dARB +#define glProgramEnvParameter4dvARB __rglgen_glProgramEnvParameter4dvARB +#define glProgramEnvParameter4fARB __rglgen_glProgramEnvParameter4fARB +#define glProgramEnvParameter4fvARB __rglgen_glProgramEnvParameter4fvARB +#define glProgramLocalParameter4dARB __rglgen_glProgramLocalParameter4dARB +#define glProgramLocalParameter4dvARB __rglgen_glProgramLocalParameter4dvARB +#define glProgramLocalParameter4fARB __rglgen_glProgramLocalParameter4fARB +#define glProgramLocalParameter4fvARB __rglgen_glProgramLocalParameter4fvARB +#define glGetProgramEnvParameterdvARB __rglgen_glGetProgramEnvParameterdvARB +#define glGetProgramEnvParameterfvARB __rglgen_glGetProgramEnvParameterfvARB +#define glGetProgramLocalParameterdvARB __rglgen_glGetProgramLocalParameterdvARB +#define glGetProgramLocalParameterfvARB __rglgen_glGetProgramLocalParameterfvARB +#define glGetProgramivARB __rglgen_glGetProgramivARB +#define glGetProgramStringARB __rglgen_glGetProgramStringARB +#define glIsProgramARB __rglgen_glIsProgramARB +#define glProgramParameteriARB __rglgen_glProgramParameteriARB +#define glFramebufferTextureARB __rglgen_glFramebufferTextureARB +#define glFramebufferTextureLayerARB __rglgen_glFramebufferTextureLayerARB +#define glFramebufferTextureFaceARB __rglgen_glFramebufferTextureFaceARB +#define glColorTable __rglgen_glColorTable +#define glColorTableParameterfv __rglgen_glColorTableParameterfv +#define glColorTableParameteriv __rglgen_glColorTableParameteriv +#define glCopyColorTable __rglgen_glCopyColorTable +#define glGetColorTable __rglgen_glGetColorTable +#define glGetColorTableParameterfv __rglgen_glGetColorTableParameterfv +#define glGetColorTableParameteriv __rglgen_glGetColorTableParameteriv +#define glColorSubTable __rglgen_glColorSubTable +#define glCopyColorSubTable __rglgen_glCopyColorSubTable +#define glConvolutionFilter1D __rglgen_glConvolutionFilter1D +#define glConvolutionFilter2D __rglgen_glConvolutionFilter2D +#define glConvolutionParameterf __rglgen_glConvolutionParameterf +#define glConvolutionParameterfv __rglgen_glConvolutionParameterfv +#define glConvolutionParameteri __rglgen_glConvolutionParameteri +#define glConvolutionParameteriv __rglgen_glConvolutionParameteriv +#define glCopyConvolutionFilter1D __rglgen_glCopyConvolutionFilter1D +#define glCopyConvolutionFilter2D __rglgen_glCopyConvolutionFilter2D +#define glGetConvolutionFilter __rglgen_glGetConvolutionFilter +#define glGetConvolutionParameterfv __rglgen_glGetConvolutionParameterfv +#define glGetConvolutionParameteriv __rglgen_glGetConvolutionParameteriv +#define glGetSeparableFilter __rglgen_glGetSeparableFilter +#define glSeparableFilter2D __rglgen_glSeparableFilter2D +#define glGetHistogram __rglgen_glGetHistogram +#define glGetHistogramParameterfv __rglgen_glGetHistogramParameterfv +#define glGetHistogramParameteriv __rglgen_glGetHistogramParameteriv +#define glGetMinmax __rglgen_glGetMinmax +#define glGetMinmaxParameterfv __rglgen_glGetMinmaxParameterfv +#define glGetMinmaxParameteriv __rglgen_glGetMinmaxParameteriv +#define glHistogram __rglgen_glHistogram +#define glMinmax __rglgen_glMinmax +#define glResetHistogram __rglgen_glResetHistogram +#define glResetMinmax __rglgen_glResetMinmax +#define glMultiDrawArraysIndirectCountARB __rglgen_glMultiDrawArraysIndirectCountARB +#define glMultiDrawElementsIndirectCountARB __rglgen_glMultiDrawElementsIndirectCountARB +#define glVertexAttribDivisorARB __rglgen_glVertexAttribDivisorARB +#define glCurrentPaletteMatrixARB __rglgen_glCurrentPaletteMatrixARB +#define glMatrixIndexubvARB __rglgen_glMatrixIndexubvARB +#define glMatrixIndexusvARB __rglgen_glMatrixIndexusvARB +#define glMatrixIndexuivARB __rglgen_glMatrixIndexuivARB +#define glMatrixIndexPointerARB __rglgen_glMatrixIndexPointerARB +#define glSampleCoverageARB __rglgen_glSampleCoverageARB +#define glActiveTextureARB __rglgen_glActiveTextureARB +#define glClientActiveTextureARB __rglgen_glClientActiveTextureARB +#define glMultiTexCoord1dARB __rglgen_glMultiTexCoord1dARB +#define glMultiTexCoord1dvARB __rglgen_glMultiTexCoord1dvARB +#define glMultiTexCoord1fARB __rglgen_glMultiTexCoord1fARB +#define glMultiTexCoord1fvARB __rglgen_glMultiTexCoord1fvARB +#define glMultiTexCoord1iARB __rglgen_glMultiTexCoord1iARB +#define glMultiTexCoord1ivARB __rglgen_glMultiTexCoord1ivARB +#define glMultiTexCoord1sARB __rglgen_glMultiTexCoord1sARB +#define glMultiTexCoord1svARB __rglgen_glMultiTexCoord1svARB +#define glMultiTexCoord2dARB __rglgen_glMultiTexCoord2dARB +#define glMultiTexCoord2dvARB __rglgen_glMultiTexCoord2dvARB +#define glMultiTexCoord2fARB __rglgen_glMultiTexCoord2fARB +#define glMultiTexCoord2fvARB __rglgen_glMultiTexCoord2fvARB +#define glMultiTexCoord2iARB __rglgen_glMultiTexCoord2iARB +#define glMultiTexCoord2ivARB __rglgen_glMultiTexCoord2ivARB +#define glMultiTexCoord2sARB __rglgen_glMultiTexCoord2sARB +#define glMultiTexCoord2svARB __rglgen_glMultiTexCoord2svARB +#define glMultiTexCoord3dARB __rglgen_glMultiTexCoord3dARB +#define glMultiTexCoord3dvARB __rglgen_glMultiTexCoord3dvARB +#define glMultiTexCoord3fARB __rglgen_glMultiTexCoord3fARB +#define glMultiTexCoord3fvARB __rglgen_glMultiTexCoord3fvARB +#define glMultiTexCoord3iARB __rglgen_glMultiTexCoord3iARB +#define glMultiTexCoord3ivARB __rglgen_glMultiTexCoord3ivARB +#define glMultiTexCoord3sARB __rglgen_glMultiTexCoord3sARB +#define glMultiTexCoord3svARB __rglgen_glMultiTexCoord3svARB +#define glMultiTexCoord4dARB __rglgen_glMultiTexCoord4dARB +#define glMultiTexCoord4dvARB __rglgen_glMultiTexCoord4dvARB +#define glMultiTexCoord4fARB __rglgen_glMultiTexCoord4fARB +#define glMultiTexCoord4fvARB __rglgen_glMultiTexCoord4fvARB +#define glMultiTexCoord4iARB __rglgen_glMultiTexCoord4iARB +#define glMultiTexCoord4ivARB __rglgen_glMultiTexCoord4ivARB +#define glMultiTexCoord4sARB __rglgen_glMultiTexCoord4sARB +#define glMultiTexCoord4svARB __rglgen_glMultiTexCoord4svARB +#define glGenQueriesARB __rglgen_glGenQueriesARB +#define glDeleteQueriesARB __rglgen_glDeleteQueriesARB +#define glIsQueryARB __rglgen_glIsQueryARB +#define glBeginQueryARB __rglgen_glBeginQueryARB +#define glEndQueryARB __rglgen_glEndQueryARB +#define glGetQueryivARB __rglgen_glGetQueryivARB +#define glGetQueryObjectivARB __rglgen_glGetQueryObjectivARB +#define glGetQueryObjectuivARB __rglgen_glGetQueryObjectuivARB +#define glPointParameterfARB __rglgen_glPointParameterfARB +#define glPointParameterfvARB __rglgen_glPointParameterfvARB +#define glGetGraphicsResetStatusARB __rglgen_glGetGraphicsResetStatusARB +#define glGetnTexImageARB __rglgen_glGetnTexImageARB +#define glReadnPixelsARB __rglgen_glReadnPixelsARB +#define glGetnCompressedTexImageARB __rglgen_glGetnCompressedTexImageARB +#define glGetnUniformfvARB __rglgen_glGetnUniformfvARB +#define glGetnUniformivARB __rglgen_glGetnUniformivARB +#define glGetnUniformuivARB __rglgen_glGetnUniformuivARB +#define glGetnUniformdvARB __rglgen_glGetnUniformdvARB +#define glGetnMapdvARB __rglgen_glGetnMapdvARB +#define glGetnMapfvARB __rglgen_glGetnMapfvARB +#define glGetnMapivARB __rglgen_glGetnMapivARB +#define glGetnPixelMapfvARB __rglgen_glGetnPixelMapfvARB +#define glGetnPixelMapuivARB __rglgen_glGetnPixelMapuivARB +#define glGetnPixelMapusvARB __rglgen_glGetnPixelMapusvARB +#define glGetnPolygonStippleARB __rglgen_glGetnPolygonStippleARB +#define glGetnColorTableARB __rglgen_glGetnColorTableARB +#define glGetnConvolutionFilterARB __rglgen_glGetnConvolutionFilterARB +#define glGetnSeparableFilterARB __rglgen_glGetnSeparableFilterARB +#define glGetnHistogramARB __rglgen_glGetnHistogramARB +#define glGetnMinmaxARB __rglgen_glGetnMinmaxARB +#define glMinSampleShadingARB __rglgen_glMinSampleShadingARB +#define glDeleteObjectARB __rglgen_glDeleteObjectARB +#define glGetHandleARB __rglgen_glGetHandleARB +#define glDetachObjectARB __rglgen_glDetachObjectARB +#define glCreateShaderObjectARB __rglgen_glCreateShaderObjectARB +#define glShaderSourceARB __rglgen_glShaderSourceARB +#define glCompileShaderARB __rglgen_glCompileShaderARB +#define glCreateProgramObjectARB __rglgen_glCreateProgramObjectARB +#define glAttachObjectARB __rglgen_glAttachObjectARB +#define glLinkProgramARB __rglgen_glLinkProgramARB +#define glUseProgramObjectARB __rglgen_glUseProgramObjectARB +#define glValidateProgramARB __rglgen_glValidateProgramARB +#define glUniform1fARB __rglgen_glUniform1fARB +#define glUniform2fARB __rglgen_glUniform2fARB +#define glUniform3fARB __rglgen_glUniform3fARB +#define glUniform4fARB __rglgen_glUniform4fARB +#define glUniform1iARB __rglgen_glUniform1iARB +#define glUniform2iARB __rglgen_glUniform2iARB +#define glUniform3iARB __rglgen_glUniform3iARB +#define glUniform4iARB __rglgen_glUniform4iARB +#define glUniform1fvARB __rglgen_glUniform1fvARB +#define glUniform2fvARB __rglgen_glUniform2fvARB +#define glUniform3fvARB __rglgen_glUniform3fvARB +#define glUniform4fvARB __rglgen_glUniform4fvARB +#define glUniform1ivARB __rglgen_glUniform1ivARB +#define glUniform2ivARB __rglgen_glUniform2ivARB +#define glUniform3ivARB __rglgen_glUniform3ivARB +#define glUniform4ivARB __rglgen_glUniform4ivARB +#define glUniformMatrix2fvARB __rglgen_glUniformMatrix2fvARB +#define glUniformMatrix3fvARB __rglgen_glUniformMatrix3fvARB +#define glUniformMatrix4fvARB __rglgen_glUniformMatrix4fvARB +#define glGetObjectParameterfvARB __rglgen_glGetObjectParameterfvARB +#define glGetObjectParameterivARB __rglgen_glGetObjectParameterivARB +#define glGetInfoLogARB __rglgen_glGetInfoLogARB +#define glGetAttachedObjectsARB __rglgen_glGetAttachedObjectsARB +#define glGetUniformLocationARB __rglgen_glGetUniformLocationARB +#define glGetActiveUniformARB __rglgen_glGetActiveUniformARB +#define glGetUniformfvARB __rglgen_glGetUniformfvARB +#define glGetUniformivARB __rglgen_glGetUniformivARB +#define glGetShaderSourceARB __rglgen_glGetShaderSourceARB +#define glNamedStringARB __rglgen_glNamedStringARB +#define glDeleteNamedStringARB __rglgen_glDeleteNamedStringARB +#define glCompileShaderIncludeARB __rglgen_glCompileShaderIncludeARB +#define glIsNamedStringARB __rglgen_glIsNamedStringARB +#define glGetNamedStringARB __rglgen_glGetNamedStringARB +#define glGetNamedStringivARB __rglgen_glGetNamedStringivARB +#define glTexPageCommitmentARB __rglgen_glTexPageCommitmentARB +#define glTexBufferARB __rglgen_glTexBufferARB +#define glCompressedTexImage3DARB __rglgen_glCompressedTexImage3DARB +#define glCompressedTexImage2DARB __rglgen_glCompressedTexImage2DARB +#define glCompressedTexImage1DARB __rglgen_glCompressedTexImage1DARB +#define glCompressedTexSubImage3DARB __rglgen_glCompressedTexSubImage3DARB +#define glCompressedTexSubImage2DARB __rglgen_glCompressedTexSubImage2DARB +#define glCompressedTexSubImage1DARB __rglgen_glCompressedTexSubImage1DARB +#define glGetCompressedTexImageARB __rglgen_glGetCompressedTexImageARB +#define glLoadTransposeMatrixfARB __rglgen_glLoadTransposeMatrixfARB +#define glLoadTransposeMatrixdARB __rglgen_glLoadTransposeMatrixdARB +#define glMultTransposeMatrixfARB __rglgen_glMultTransposeMatrixfARB +#define glMultTransposeMatrixdARB __rglgen_glMultTransposeMatrixdARB +#define glWeightbvARB __rglgen_glWeightbvARB +#define glWeightsvARB __rglgen_glWeightsvARB +#define glWeightivARB __rglgen_glWeightivARB +#define glWeightfvARB __rglgen_glWeightfvARB +#define glWeightdvARB __rglgen_glWeightdvARB +#define glWeightubvARB __rglgen_glWeightubvARB +#define glWeightusvARB __rglgen_glWeightusvARB +#define glWeightuivARB __rglgen_glWeightuivARB +#define glWeightPointerARB __rglgen_glWeightPointerARB +#define glVertexBlendARB __rglgen_glVertexBlendARB +#define glBindBufferARB __rglgen_glBindBufferARB +#define glDeleteBuffersARB __rglgen_glDeleteBuffersARB +#define glGenBuffersARB __rglgen_glGenBuffersARB +#define glIsBufferARB __rglgen_glIsBufferARB +#define glBufferDataARB __rglgen_glBufferDataARB +#define glBufferSubDataARB __rglgen_glBufferSubDataARB +#define glGetBufferSubDataARB __rglgen_glGetBufferSubDataARB +#define glMapBufferARB __rglgen_glMapBufferARB +#define glUnmapBufferARB __rglgen_glUnmapBufferARB +#define glGetBufferParameterivARB __rglgen_glGetBufferParameterivARB +#define glGetBufferPointervARB __rglgen_glGetBufferPointervARB +#define glVertexAttrib1dARB __rglgen_glVertexAttrib1dARB +#define glVertexAttrib1dvARB __rglgen_glVertexAttrib1dvARB +#define glVertexAttrib1fARB __rglgen_glVertexAttrib1fARB +#define glVertexAttrib1fvARB __rglgen_glVertexAttrib1fvARB +#define glVertexAttrib1sARB __rglgen_glVertexAttrib1sARB +#define glVertexAttrib1svARB __rglgen_glVertexAttrib1svARB +#define glVertexAttrib2dARB __rglgen_glVertexAttrib2dARB +#define glVertexAttrib2dvARB __rglgen_glVertexAttrib2dvARB +#define glVertexAttrib2fARB __rglgen_glVertexAttrib2fARB +#define glVertexAttrib2fvARB __rglgen_glVertexAttrib2fvARB +#define glVertexAttrib2sARB __rglgen_glVertexAttrib2sARB +#define glVertexAttrib2svARB __rglgen_glVertexAttrib2svARB +#define glVertexAttrib3dARB __rglgen_glVertexAttrib3dARB +#define glVertexAttrib3dvARB __rglgen_glVertexAttrib3dvARB +#define glVertexAttrib3fARB __rglgen_glVertexAttrib3fARB +#define glVertexAttrib3fvARB __rglgen_glVertexAttrib3fvARB +#define glVertexAttrib3sARB __rglgen_glVertexAttrib3sARB +#define glVertexAttrib3svARB __rglgen_glVertexAttrib3svARB +#define glVertexAttrib4NbvARB __rglgen_glVertexAttrib4NbvARB +#define glVertexAttrib4NivARB __rglgen_glVertexAttrib4NivARB +#define glVertexAttrib4NsvARB __rglgen_glVertexAttrib4NsvARB +#define glVertexAttrib4NubARB __rglgen_glVertexAttrib4NubARB +#define glVertexAttrib4NubvARB __rglgen_glVertexAttrib4NubvARB +#define glVertexAttrib4NuivARB __rglgen_glVertexAttrib4NuivARB +#define glVertexAttrib4NusvARB __rglgen_glVertexAttrib4NusvARB +#define glVertexAttrib4bvARB __rglgen_glVertexAttrib4bvARB +#define glVertexAttrib4dARB __rglgen_glVertexAttrib4dARB +#define glVertexAttrib4dvARB __rglgen_glVertexAttrib4dvARB +#define glVertexAttrib4fARB __rglgen_glVertexAttrib4fARB +#define glVertexAttrib4fvARB __rglgen_glVertexAttrib4fvARB +#define glVertexAttrib4ivARB __rglgen_glVertexAttrib4ivARB +#define glVertexAttrib4sARB __rglgen_glVertexAttrib4sARB +#define glVertexAttrib4svARB __rglgen_glVertexAttrib4svARB +#define glVertexAttrib4ubvARB __rglgen_glVertexAttrib4ubvARB +#define glVertexAttrib4uivARB __rglgen_glVertexAttrib4uivARB +#define glVertexAttrib4usvARB __rglgen_glVertexAttrib4usvARB +#define glVertexAttribPointerARB __rglgen_glVertexAttribPointerARB +#define glEnableVertexAttribArrayARB __rglgen_glEnableVertexAttribArrayARB +#define glDisableVertexAttribArrayARB __rglgen_glDisableVertexAttribArrayARB +#define glGetVertexAttribdvARB __rglgen_glGetVertexAttribdvARB +#define glGetVertexAttribfvARB __rglgen_glGetVertexAttribfvARB +#define glGetVertexAttribivARB __rglgen_glGetVertexAttribivARB +#define glGetVertexAttribPointervARB __rglgen_glGetVertexAttribPointervARB +#define glBindAttribLocationARB __rglgen_glBindAttribLocationARB +#define glGetActiveAttribARB __rglgen_glGetActiveAttribARB +#define glGetAttribLocationARB __rglgen_glGetAttribLocationARB +#define glWindowPos2dARB __rglgen_glWindowPos2dARB +#define glWindowPos2dvARB __rglgen_glWindowPos2dvARB +#define glWindowPos2fARB __rglgen_glWindowPos2fARB +#define glWindowPos2fvARB __rglgen_glWindowPos2fvARB +#define glWindowPos2iARB __rglgen_glWindowPos2iARB +#define glWindowPos2ivARB __rglgen_glWindowPos2ivARB +#define glWindowPos2sARB __rglgen_glWindowPos2sARB +#define glWindowPos2svARB __rglgen_glWindowPos2svARB +#define glWindowPos3dARB __rglgen_glWindowPos3dARB +#define glWindowPos3dvARB __rglgen_glWindowPos3dvARB +#define glWindowPos3fARB __rglgen_glWindowPos3fARB +#define glWindowPos3fvARB __rglgen_glWindowPos3fvARB +#define glWindowPos3iARB __rglgen_glWindowPos3iARB +#define glWindowPos3ivARB __rglgen_glWindowPos3ivARB +#define glWindowPos3sARB __rglgen_glWindowPos3sARB +#define glWindowPos3svARB __rglgen_glWindowPos3svARB +#define glMultiTexCoord1bOES __rglgen_glMultiTexCoord1bOES +#define glMultiTexCoord1bvOES __rglgen_glMultiTexCoord1bvOES +#define glMultiTexCoord2bOES __rglgen_glMultiTexCoord2bOES +#define glMultiTexCoord2bvOES __rglgen_glMultiTexCoord2bvOES +#define glMultiTexCoord3bOES __rglgen_glMultiTexCoord3bOES +#define glMultiTexCoord3bvOES __rglgen_glMultiTexCoord3bvOES +#define glMultiTexCoord4bOES __rglgen_glMultiTexCoord4bOES +#define glMultiTexCoord4bvOES __rglgen_glMultiTexCoord4bvOES +#define glTexCoord1bOES __rglgen_glTexCoord1bOES +#define glTexCoord1bvOES __rglgen_glTexCoord1bvOES +#define glTexCoord2bOES __rglgen_glTexCoord2bOES +#define glTexCoord2bvOES __rglgen_glTexCoord2bvOES +#define glTexCoord3bOES __rglgen_glTexCoord3bOES +#define glTexCoord3bvOES __rglgen_glTexCoord3bvOES +#define glTexCoord4bOES __rglgen_glTexCoord4bOES +#define glTexCoord4bvOES __rglgen_glTexCoord4bvOES +#define glVertex2bOES __rglgen_glVertex2bOES +#define glVertex2bvOES __rglgen_glVertex2bvOES +#define glVertex3bOES __rglgen_glVertex3bOES +#define glVertex3bvOES __rglgen_glVertex3bvOES +#define glVertex4bOES __rglgen_glVertex4bOES +#define glVertex4bvOES __rglgen_glVertex4bvOES +#define glAlphaFuncxOES __rglgen_glAlphaFuncxOES +#define glClearColorxOES __rglgen_glClearColorxOES +#define glClearDepthxOES __rglgen_glClearDepthxOES +#define glClipPlanexOES __rglgen_glClipPlanexOES +#define glColor4xOES __rglgen_glColor4xOES +#define glDepthRangexOES __rglgen_glDepthRangexOES +#define glFogxOES __rglgen_glFogxOES +#define glFogxvOES __rglgen_glFogxvOES +#define glFrustumxOES __rglgen_glFrustumxOES +#define glGetClipPlanexOES __rglgen_glGetClipPlanexOES +#define glGetFixedvOES __rglgen_glGetFixedvOES +#define glGetTexEnvxvOES __rglgen_glGetTexEnvxvOES +#define glGetTexParameterxvOES __rglgen_glGetTexParameterxvOES +#define glLightModelxOES __rglgen_glLightModelxOES +#define glLightModelxvOES __rglgen_glLightModelxvOES +#define glLightxOES __rglgen_glLightxOES +#define glLightxvOES __rglgen_glLightxvOES +#define glLineWidthxOES __rglgen_glLineWidthxOES +#define glLoadMatrixxOES __rglgen_glLoadMatrixxOES +#define glMaterialxOES __rglgen_glMaterialxOES +#define glMaterialxvOES __rglgen_glMaterialxvOES +#define glMultMatrixxOES __rglgen_glMultMatrixxOES +#define glMultiTexCoord4xOES __rglgen_glMultiTexCoord4xOES +#define glNormal3xOES __rglgen_glNormal3xOES +#define glOrthoxOES __rglgen_glOrthoxOES +#define glPointParameterxvOES __rglgen_glPointParameterxvOES +#define glPointSizexOES __rglgen_glPointSizexOES +#define glPolygonOffsetxOES __rglgen_glPolygonOffsetxOES +#define glRotatexOES __rglgen_glRotatexOES +#define glSampleCoverageOES __rglgen_glSampleCoverageOES +#define glScalexOES __rglgen_glScalexOES +#define glTexEnvxOES __rglgen_glTexEnvxOES +#define glTexEnvxvOES __rglgen_glTexEnvxvOES +#define glTexParameterxOES __rglgen_glTexParameterxOES +#define glTexParameterxvOES __rglgen_glTexParameterxvOES +#define glTranslatexOES __rglgen_glTranslatexOES +#define glAccumxOES __rglgen_glAccumxOES +#define glBitmapxOES __rglgen_glBitmapxOES +#define glBlendColorxOES __rglgen_glBlendColorxOES +#define glClearAccumxOES __rglgen_glClearAccumxOES +#define glColor3xOES __rglgen_glColor3xOES +#define glColor3xvOES __rglgen_glColor3xvOES +#define glColor4xvOES __rglgen_glColor4xvOES +#define glConvolutionParameterxOES __rglgen_glConvolutionParameterxOES +#define glConvolutionParameterxvOES __rglgen_glConvolutionParameterxvOES +#define glEvalCoord1xOES __rglgen_glEvalCoord1xOES +#define glEvalCoord1xvOES __rglgen_glEvalCoord1xvOES +#define glEvalCoord2xOES __rglgen_glEvalCoord2xOES +#define glEvalCoord2xvOES __rglgen_glEvalCoord2xvOES +#define glFeedbackBufferxOES __rglgen_glFeedbackBufferxOES +#define glGetConvolutionParameterxvOES __rglgen_glGetConvolutionParameterxvOES +#define glGetHistogramParameterxvOES __rglgen_glGetHistogramParameterxvOES +#define glGetLightxOES __rglgen_glGetLightxOES +#define glGetMapxvOES __rglgen_glGetMapxvOES +#define glGetMaterialxOES __rglgen_glGetMaterialxOES +#define glGetPixelMapxv __rglgen_glGetPixelMapxv +#define glGetTexGenxvOES __rglgen_glGetTexGenxvOES +#define glGetTexLevelParameterxvOES __rglgen_glGetTexLevelParameterxvOES +#define glIndexxOES __rglgen_glIndexxOES +#define glIndexxvOES __rglgen_glIndexxvOES +#define glLoadTransposeMatrixxOES __rglgen_glLoadTransposeMatrixxOES +#define glMap1xOES __rglgen_glMap1xOES +#define glMap2xOES __rglgen_glMap2xOES +#define glMapGrid1xOES __rglgen_glMapGrid1xOES +#define glMapGrid2xOES __rglgen_glMapGrid2xOES +#define glMultTransposeMatrixxOES __rglgen_glMultTransposeMatrixxOES +#define glMultiTexCoord1xOES __rglgen_glMultiTexCoord1xOES +#define glMultiTexCoord1xvOES __rglgen_glMultiTexCoord1xvOES +#define glMultiTexCoord2xOES __rglgen_glMultiTexCoord2xOES +#define glMultiTexCoord2xvOES __rglgen_glMultiTexCoord2xvOES +#define glMultiTexCoord3xOES __rglgen_glMultiTexCoord3xOES +#define glMultiTexCoord3xvOES __rglgen_glMultiTexCoord3xvOES +#define glMultiTexCoord4xvOES __rglgen_glMultiTexCoord4xvOES +#define glNormal3xvOES __rglgen_glNormal3xvOES +#define glPassThroughxOES __rglgen_glPassThroughxOES +#define glPixelMapx __rglgen_glPixelMapx +#define glPixelStorex __rglgen_glPixelStorex +#define glPixelTransferxOES __rglgen_glPixelTransferxOES +#define glPixelZoomxOES __rglgen_glPixelZoomxOES +#define glPrioritizeTexturesxOES __rglgen_glPrioritizeTexturesxOES +#define glRasterPos2xOES __rglgen_glRasterPos2xOES +#define glRasterPos2xvOES __rglgen_glRasterPos2xvOES +#define glRasterPos3xOES __rglgen_glRasterPos3xOES +#define glRasterPos3xvOES __rglgen_glRasterPos3xvOES +#define glRasterPos4xOES __rglgen_glRasterPos4xOES +#define glRasterPos4xvOES __rglgen_glRasterPos4xvOES +#define glRectxOES __rglgen_glRectxOES +#define glRectxvOES __rglgen_glRectxvOES +#define glTexCoord1xOES __rglgen_glTexCoord1xOES +#define glTexCoord1xvOES __rglgen_glTexCoord1xvOES +#define glTexCoord2xOES __rglgen_glTexCoord2xOES +#define glTexCoord2xvOES __rglgen_glTexCoord2xvOES +#define glTexCoord3xOES __rglgen_glTexCoord3xOES +#define glTexCoord3xvOES __rglgen_glTexCoord3xvOES +#define glTexCoord4xOES __rglgen_glTexCoord4xOES +#define glTexCoord4xvOES __rglgen_glTexCoord4xvOES +#define glTexGenxOES __rglgen_glTexGenxOES +#define glTexGenxvOES __rglgen_glTexGenxvOES +#define glVertex2xOES __rglgen_glVertex2xOES +#define glVertex2xvOES __rglgen_glVertex2xvOES +#define glVertex3xOES __rglgen_glVertex3xOES +#define glVertex3xvOES __rglgen_glVertex3xvOES +#define glVertex4xOES __rglgen_glVertex4xOES +#define glVertex4xvOES __rglgen_glVertex4xvOES +#define glQueryMatrixxOES __rglgen_glQueryMatrixxOES +#define glClearDepthfOES __rglgen_glClearDepthfOES +#define glClipPlanefOES __rglgen_glClipPlanefOES +#define glDepthRangefOES __rglgen_glDepthRangefOES +#define glFrustumfOES __rglgen_glFrustumfOES +#define glGetClipPlanefOES __rglgen_glGetClipPlanefOES +#define glOrthofOES __rglgen_glOrthofOES +#define glImageTransformParameteriHP __rglgen_glImageTransformParameteriHP +#define glImageTransformParameterfHP __rglgen_glImageTransformParameterfHP +#define glImageTransformParameterivHP __rglgen_glImageTransformParameterivHP +#define glImageTransformParameterfvHP __rglgen_glImageTransformParameterfvHP +#define glGetImageTransformParameterivHP __rglgen_glGetImageTransformParameterivHP +#define glGetImageTransformParameterfvHP __rglgen_glGetImageTransformParameterfvHP + +extern RGLSYMGLDRAWRANGEELEMENTSPROC __rglgen_glDrawRangeElements; +extern RGLSYMGLTEXIMAGE3DPROC __rglgen_glTexImage3D; +extern RGLSYMGLTEXSUBIMAGE3DPROC __rglgen_glTexSubImage3D; +extern RGLSYMGLCOPYTEXSUBIMAGE3DPROC __rglgen_glCopyTexSubImage3D; +extern RGLSYMGLACTIVETEXTUREPROC __rglgen_glActiveTexture; +extern RGLSYMGLSAMPLECOVERAGEPROC __rglgen_glSampleCoverage; +extern RGLSYMGLCOMPRESSEDTEXIMAGE3DPROC __rglgen_glCompressedTexImage3D; +extern RGLSYMGLCOMPRESSEDTEXIMAGE2DPROC __rglgen_glCompressedTexImage2D; +extern RGLSYMGLCOMPRESSEDTEXIMAGE1DPROC __rglgen_glCompressedTexImage1D; +extern RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DPROC __rglgen_glCompressedTexSubImage3D; +extern RGLSYMGLCOMPRESSEDTEXSUBIMAGE2DPROC __rglgen_glCompressedTexSubImage2D; +extern RGLSYMGLCOMPRESSEDTEXSUBIMAGE1DPROC __rglgen_glCompressedTexSubImage1D; +extern RGLSYMGLGETCOMPRESSEDTEXIMAGEPROC __rglgen_glGetCompressedTexImage; +extern RGLSYMGLCLIENTACTIVETEXTUREPROC __rglgen_glClientActiveTexture; +extern RGLSYMGLMULTITEXCOORD1DPROC __rglgen_glMultiTexCoord1d; +extern RGLSYMGLMULTITEXCOORD1DVPROC __rglgen_glMultiTexCoord1dv; +extern RGLSYMGLMULTITEXCOORD1FPROC __rglgen_glMultiTexCoord1f; +extern RGLSYMGLMULTITEXCOORD1FVPROC __rglgen_glMultiTexCoord1fv; +extern RGLSYMGLMULTITEXCOORD1IPROC __rglgen_glMultiTexCoord1i; +extern RGLSYMGLMULTITEXCOORD1IVPROC __rglgen_glMultiTexCoord1iv; +extern RGLSYMGLMULTITEXCOORD1SPROC __rglgen_glMultiTexCoord1s; +extern RGLSYMGLMULTITEXCOORD1SVPROC __rglgen_glMultiTexCoord1sv; +extern RGLSYMGLMULTITEXCOORD2DPROC __rglgen_glMultiTexCoord2d; +extern RGLSYMGLMULTITEXCOORD2DVPROC __rglgen_glMultiTexCoord2dv; +extern RGLSYMGLMULTITEXCOORD2FPROC __rglgen_glMultiTexCoord2f; +extern RGLSYMGLMULTITEXCOORD2FVPROC __rglgen_glMultiTexCoord2fv; +extern RGLSYMGLMULTITEXCOORD2IPROC __rglgen_glMultiTexCoord2i; +extern RGLSYMGLMULTITEXCOORD2IVPROC __rglgen_glMultiTexCoord2iv; +extern RGLSYMGLMULTITEXCOORD2SPROC __rglgen_glMultiTexCoord2s; +extern RGLSYMGLMULTITEXCOORD2SVPROC __rglgen_glMultiTexCoord2sv; +extern RGLSYMGLMULTITEXCOORD3DPROC __rglgen_glMultiTexCoord3d; +extern RGLSYMGLMULTITEXCOORD3DVPROC __rglgen_glMultiTexCoord3dv; +extern RGLSYMGLMULTITEXCOORD3FPROC __rglgen_glMultiTexCoord3f; +extern RGLSYMGLMULTITEXCOORD3FVPROC __rglgen_glMultiTexCoord3fv; +extern RGLSYMGLMULTITEXCOORD3IPROC __rglgen_glMultiTexCoord3i; +extern RGLSYMGLMULTITEXCOORD3IVPROC __rglgen_glMultiTexCoord3iv; +extern RGLSYMGLMULTITEXCOORD3SPROC __rglgen_glMultiTexCoord3s; +extern RGLSYMGLMULTITEXCOORD3SVPROC __rglgen_glMultiTexCoord3sv; +extern RGLSYMGLMULTITEXCOORD4DPROC __rglgen_glMultiTexCoord4d; +extern RGLSYMGLMULTITEXCOORD4DVPROC __rglgen_glMultiTexCoord4dv; +extern RGLSYMGLMULTITEXCOORD4FPROC __rglgen_glMultiTexCoord4f; +extern RGLSYMGLMULTITEXCOORD4FVPROC __rglgen_glMultiTexCoord4fv; +extern RGLSYMGLMULTITEXCOORD4IPROC __rglgen_glMultiTexCoord4i; +extern RGLSYMGLMULTITEXCOORD4IVPROC __rglgen_glMultiTexCoord4iv; +extern RGLSYMGLMULTITEXCOORD4SPROC __rglgen_glMultiTexCoord4s; +extern RGLSYMGLMULTITEXCOORD4SVPROC __rglgen_glMultiTexCoord4sv; +extern RGLSYMGLLOADTRANSPOSEMATRIXFPROC __rglgen_glLoadTransposeMatrixf; +extern RGLSYMGLLOADTRANSPOSEMATRIXDPROC __rglgen_glLoadTransposeMatrixd; +extern RGLSYMGLMULTTRANSPOSEMATRIXFPROC __rglgen_glMultTransposeMatrixf; +extern RGLSYMGLMULTTRANSPOSEMATRIXDPROC __rglgen_glMultTransposeMatrixd; +extern RGLSYMGLBLENDFUNCSEPARATEPROC __rglgen_glBlendFuncSeparate; +extern RGLSYMGLMULTIDRAWARRAYSPROC __rglgen_glMultiDrawArrays; +extern RGLSYMGLMULTIDRAWELEMENTSPROC __rglgen_glMultiDrawElements; +extern RGLSYMGLPOINTPARAMETERFPROC __rglgen_glPointParameterf; +extern RGLSYMGLPOINTPARAMETERFVPROC __rglgen_glPointParameterfv; +extern RGLSYMGLPOINTPARAMETERIPROC __rglgen_glPointParameteri; +extern RGLSYMGLPOINTPARAMETERIVPROC __rglgen_glPointParameteriv; +extern RGLSYMGLFOGCOORDFPROC __rglgen_glFogCoordf; +extern RGLSYMGLFOGCOORDFVPROC __rglgen_glFogCoordfv; +extern RGLSYMGLFOGCOORDDPROC __rglgen_glFogCoordd; +extern RGLSYMGLFOGCOORDDVPROC __rglgen_glFogCoorddv; +extern RGLSYMGLFOGCOORDPOINTERPROC __rglgen_glFogCoordPointer; +extern RGLSYMGLSECONDARYCOLOR3BPROC __rglgen_glSecondaryColor3b; +extern RGLSYMGLSECONDARYCOLOR3BVPROC __rglgen_glSecondaryColor3bv; +extern RGLSYMGLSECONDARYCOLOR3DPROC __rglgen_glSecondaryColor3d; +extern RGLSYMGLSECONDARYCOLOR3DVPROC __rglgen_glSecondaryColor3dv; +extern RGLSYMGLSECONDARYCOLOR3FPROC __rglgen_glSecondaryColor3f; +extern RGLSYMGLSECONDARYCOLOR3FVPROC __rglgen_glSecondaryColor3fv; +extern RGLSYMGLSECONDARYCOLOR3IPROC __rglgen_glSecondaryColor3i; +extern RGLSYMGLSECONDARYCOLOR3IVPROC __rglgen_glSecondaryColor3iv; +extern RGLSYMGLSECONDARYCOLOR3SPROC __rglgen_glSecondaryColor3s; +extern RGLSYMGLSECONDARYCOLOR3SVPROC __rglgen_glSecondaryColor3sv; +extern RGLSYMGLSECONDARYCOLOR3UBPROC __rglgen_glSecondaryColor3ub; +extern RGLSYMGLSECONDARYCOLOR3UBVPROC __rglgen_glSecondaryColor3ubv; +extern RGLSYMGLSECONDARYCOLOR3UIPROC __rglgen_glSecondaryColor3ui; +extern RGLSYMGLSECONDARYCOLOR3UIVPROC __rglgen_glSecondaryColor3uiv; +extern RGLSYMGLSECONDARYCOLOR3USPROC __rglgen_glSecondaryColor3us; +extern RGLSYMGLSECONDARYCOLOR3USVPROC __rglgen_glSecondaryColor3usv; +extern RGLSYMGLSECONDARYCOLORPOINTERPROC __rglgen_glSecondaryColorPointer; +extern RGLSYMGLWINDOWPOS2DPROC __rglgen_glWindowPos2d; +extern RGLSYMGLWINDOWPOS2DVPROC __rglgen_glWindowPos2dv; +extern RGLSYMGLWINDOWPOS2FPROC __rglgen_glWindowPos2f; +extern RGLSYMGLWINDOWPOS2FVPROC __rglgen_glWindowPos2fv; +extern RGLSYMGLWINDOWPOS2IPROC __rglgen_glWindowPos2i; +extern RGLSYMGLWINDOWPOS2IVPROC __rglgen_glWindowPos2iv; +extern RGLSYMGLWINDOWPOS2SPROC __rglgen_glWindowPos2s; +extern RGLSYMGLWINDOWPOS2SVPROC __rglgen_glWindowPos2sv; +extern RGLSYMGLWINDOWPOS3DPROC __rglgen_glWindowPos3d; +extern RGLSYMGLWINDOWPOS3DVPROC __rglgen_glWindowPos3dv; +extern RGLSYMGLWINDOWPOS3FPROC __rglgen_glWindowPos3f; +extern RGLSYMGLWINDOWPOS3FVPROC __rglgen_glWindowPos3fv; +extern RGLSYMGLWINDOWPOS3IPROC __rglgen_glWindowPos3i; +extern RGLSYMGLWINDOWPOS3IVPROC __rglgen_glWindowPos3iv; +extern RGLSYMGLWINDOWPOS3SPROC __rglgen_glWindowPos3s; +extern RGLSYMGLWINDOWPOS3SVPROC __rglgen_glWindowPos3sv; +extern RGLSYMGLBLENDCOLORPROC __rglgen_glBlendColor; +extern RGLSYMGLBLENDEQUATIONPROC __rglgen_glBlendEquation; +extern RGLSYMGLGENQUERIESPROC __rglgen_glGenQueries; +extern RGLSYMGLDELETEQUERIESPROC __rglgen_glDeleteQueries; +extern RGLSYMGLISQUERYPROC __rglgen_glIsQuery; +extern RGLSYMGLBEGINQUERYPROC __rglgen_glBeginQuery; +extern RGLSYMGLENDQUERYPROC __rglgen_glEndQuery; +extern RGLSYMGLGETQUERYIVPROC __rglgen_glGetQueryiv; +extern RGLSYMGLGETQUERYOBJECTIVPROC __rglgen_glGetQueryObjectiv; +extern RGLSYMGLGETQUERYOBJECTUIVPROC __rglgen_glGetQueryObjectuiv; +extern RGLSYMGLBINDBUFFERPROC __rglgen_glBindBuffer; +extern RGLSYMGLDELETEBUFFERSPROC __rglgen_glDeleteBuffers; +extern RGLSYMGLGENBUFFERSPROC __rglgen_glGenBuffers; +extern RGLSYMGLISBUFFERPROC __rglgen_glIsBuffer; +extern RGLSYMGLBUFFERDATAPROC __rglgen_glBufferData; +extern RGLSYMGLBUFFERSUBDATAPROC __rglgen_glBufferSubData; +extern RGLSYMGLGETBUFFERSUBDATAPROC __rglgen_glGetBufferSubData; +extern RGLSYMGLMAPBUFFERPROC __rglgen_glMapBuffer; +extern RGLSYMGLUNMAPBUFFERPROC __rglgen_glUnmapBuffer; +extern RGLSYMGLGETBUFFERPARAMETERIVPROC __rglgen_glGetBufferParameteriv; +extern RGLSYMGLGETBUFFERPOINTERVPROC __rglgen_glGetBufferPointerv; +extern RGLSYMGLBLENDEQUATIONSEPARATEPROC __rglgen_glBlendEquationSeparate; +extern RGLSYMGLDRAWBUFFERSPROC __rglgen_glDrawBuffers; +extern RGLSYMGLSTENCILOPSEPARATEPROC __rglgen_glStencilOpSeparate; +extern RGLSYMGLSTENCILFUNCSEPARATEPROC __rglgen_glStencilFuncSeparate; +extern RGLSYMGLSTENCILMASKSEPARATEPROC __rglgen_glStencilMaskSeparate; +extern RGLSYMGLATTACHSHADERPROC __rglgen_glAttachShader; +extern RGLSYMGLBINDATTRIBLOCATIONPROC __rglgen_glBindAttribLocation; +extern RGLSYMGLCOMPILESHADERPROC __rglgen_glCompileShader; +extern RGLSYMGLCREATEPROGRAMPROC __rglgen_glCreateProgram; +extern RGLSYMGLCREATESHADERPROC __rglgen_glCreateShader; +extern RGLSYMGLDELETEPROGRAMPROC __rglgen_glDeleteProgram; +extern RGLSYMGLDELETESHADERPROC __rglgen_glDeleteShader; +extern RGLSYMGLDETACHSHADERPROC __rglgen_glDetachShader; +extern RGLSYMGLDISABLEVERTEXATTRIBARRAYPROC __rglgen_glDisableVertexAttribArray; +extern RGLSYMGLENABLEVERTEXATTRIBARRAYPROC __rglgen_glEnableVertexAttribArray; +extern RGLSYMGLGETACTIVEATTRIBPROC __rglgen_glGetActiveAttrib; +extern RGLSYMGLGETACTIVEUNIFORMPROC __rglgen_glGetActiveUniform; +extern RGLSYMGLGETATTACHEDSHADERSPROC __rglgen_glGetAttachedShaders; +extern RGLSYMGLGETATTRIBLOCATIONPROC __rglgen_glGetAttribLocation; +extern RGLSYMGLGETPROGRAMIVPROC __rglgen_glGetProgramiv; +extern RGLSYMGLGETPROGRAMINFOLOGPROC __rglgen_glGetProgramInfoLog; +extern RGLSYMGLGETSHADERIVPROC __rglgen_glGetShaderiv; +extern RGLSYMGLGETSHADERINFOLOGPROC __rglgen_glGetShaderInfoLog; +extern RGLSYMGLGETSHADERSOURCEPROC __rglgen_glGetShaderSource; +extern RGLSYMGLGETUNIFORMLOCATIONPROC __rglgen_glGetUniformLocation; +extern RGLSYMGLGETUNIFORMFVPROC __rglgen_glGetUniformfv; +extern RGLSYMGLGETUNIFORMIVPROC __rglgen_glGetUniformiv; +extern RGLSYMGLGETVERTEXATTRIBDVPROC __rglgen_glGetVertexAttribdv; +extern RGLSYMGLGETVERTEXATTRIBFVPROC __rglgen_glGetVertexAttribfv; +extern RGLSYMGLGETVERTEXATTRIBIVPROC __rglgen_glGetVertexAttribiv; +extern RGLSYMGLGETVERTEXATTRIBPOINTERVPROC __rglgen_glGetVertexAttribPointerv; +extern RGLSYMGLISPROGRAMPROC __rglgen_glIsProgram; +extern RGLSYMGLISSHADERPROC __rglgen_glIsShader; +extern RGLSYMGLLINKPROGRAMPROC __rglgen_glLinkProgram; +extern RGLSYMGLSHADERSOURCEPROC __rglgen_glShaderSource; +extern RGLSYMGLUSEPROGRAMPROC __rglgen_glUseProgram; +extern RGLSYMGLUNIFORM1FPROC __rglgen_glUniform1f; +extern RGLSYMGLUNIFORM2FPROC __rglgen_glUniform2f; +extern RGLSYMGLUNIFORM3FPROC __rglgen_glUniform3f; +extern RGLSYMGLUNIFORM4FPROC __rglgen_glUniform4f; +extern RGLSYMGLUNIFORM1IPROC __rglgen_glUniform1i; +extern RGLSYMGLUNIFORM2IPROC __rglgen_glUniform2i; +extern RGLSYMGLUNIFORM3IPROC __rglgen_glUniform3i; +extern RGLSYMGLUNIFORM4IPROC __rglgen_glUniform4i; +extern RGLSYMGLUNIFORM1FVPROC __rglgen_glUniform1fv; +extern RGLSYMGLUNIFORM2FVPROC __rglgen_glUniform2fv; +extern RGLSYMGLUNIFORM3FVPROC __rglgen_glUniform3fv; +extern RGLSYMGLUNIFORM4FVPROC __rglgen_glUniform4fv; +extern RGLSYMGLUNIFORM1IVPROC __rglgen_glUniform1iv; +extern RGLSYMGLUNIFORM2IVPROC __rglgen_glUniform2iv; +extern RGLSYMGLUNIFORM3IVPROC __rglgen_glUniform3iv; +extern RGLSYMGLUNIFORM4IVPROC __rglgen_glUniform4iv; +extern RGLSYMGLUNIFORMMATRIX2FVPROC __rglgen_glUniformMatrix2fv; +extern RGLSYMGLUNIFORMMATRIX3FVPROC __rglgen_glUniformMatrix3fv; +extern RGLSYMGLUNIFORMMATRIX4FVPROC __rglgen_glUniformMatrix4fv; +extern RGLSYMGLVALIDATEPROGRAMPROC __rglgen_glValidateProgram; +extern RGLSYMGLVERTEXATTRIB1DPROC __rglgen_glVertexAttrib1d; +extern RGLSYMGLVERTEXATTRIB1DVPROC __rglgen_glVertexAttrib1dv; +extern RGLSYMGLVERTEXATTRIB1FPROC __rglgen_glVertexAttrib1f; +extern RGLSYMGLVERTEXATTRIB1FVPROC __rglgen_glVertexAttrib1fv; +extern RGLSYMGLVERTEXATTRIB1SPROC __rglgen_glVertexAttrib1s; +extern RGLSYMGLVERTEXATTRIB1SVPROC __rglgen_glVertexAttrib1sv; +extern RGLSYMGLVERTEXATTRIB2DPROC __rglgen_glVertexAttrib2d; +extern RGLSYMGLVERTEXATTRIB2DVPROC __rglgen_glVertexAttrib2dv; +extern RGLSYMGLVERTEXATTRIB2FPROC __rglgen_glVertexAttrib2f; +extern RGLSYMGLVERTEXATTRIB2FVPROC __rglgen_glVertexAttrib2fv; +extern RGLSYMGLVERTEXATTRIB2SPROC __rglgen_glVertexAttrib2s; +extern RGLSYMGLVERTEXATTRIB2SVPROC __rglgen_glVertexAttrib2sv; +extern RGLSYMGLVERTEXATTRIB3DPROC __rglgen_glVertexAttrib3d; +extern RGLSYMGLVERTEXATTRIB3DVPROC __rglgen_glVertexAttrib3dv; +extern RGLSYMGLVERTEXATTRIB3FPROC __rglgen_glVertexAttrib3f; +extern RGLSYMGLVERTEXATTRIB3FVPROC __rglgen_glVertexAttrib3fv; +extern RGLSYMGLVERTEXATTRIB3SPROC __rglgen_glVertexAttrib3s; +extern RGLSYMGLVERTEXATTRIB3SVPROC __rglgen_glVertexAttrib3sv; +extern RGLSYMGLVERTEXATTRIB4NBVPROC __rglgen_glVertexAttrib4Nbv; +extern RGLSYMGLVERTEXATTRIB4NIVPROC __rglgen_glVertexAttrib4Niv; +extern RGLSYMGLVERTEXATTRIB4NSVPROC __rglgen_glVertexAttrib4Nsv; +extern RGLSYMGLVERTEXATTRIB4NUBPROC __rglgen_glVertexAttrib4Nub; +extern RGLSYMGLVERTEXATTRIB4NUBVPROC __rglgen_glVertexAttrib4Nubv; +extern RGLSYMGLVERTEXATTRIB4NUIVPROC __rglgen_glVertexAttrib4Nuiv; +extern RGLSYMGLVERTEXATTRIB4NUSVPROC __rglgen_glVertexAttrib4Nusv; +extern RGLSYMGLVERTEXATTRIB4BVPROC __rglgen_glVertexAttrib4bv; +extern RGLSYMGLVERTEXATTRIB4DPROC __rglgen_glVertexAttrib4d; +extern RGLSYMGLVERTEXATTRIB4DVPROC __rglgen_glVertexAttrib4dv; +extern RGLSYMGLVERTEXATTRIB4FPROC __rglgen_glVertexAttrib4f; +extern RGLSYMGLVERTEXATTRIB4FVPROC __rglgen_glVertexAttrib4fv; +extern RGLSYMGLVERTEXATTRIB4IVPROC __rglgen_glVertexAttrib4iv; +extern RGLSYMGLVERTEXATTRIB4SPROC __rglgen_glVertexAttrib4s; +extern RGLSYMGLVERTEXATTRIB4SVPROC __rglgen_glVertexAttrib4sv; +extern RGLSYMGLVERTEXATTRIB4UBVPROC __rglgen_glVertexAttrib4ubv; +extern RGLSYMGLVERTEXATTRIB4UIVPROC __rglgen_glVertexAttrib4uiv; +extern RGLSYMGLVERTEXATTRIB4USVPROC __rglgen_glVertexAttrib4usv; +extern RGLSYMGLVERTEXATTRIBPOINTERPROC __rglgen_glVertexAttribPointer; +extern RGLSYMGLUNIFORMMATRIX2X3FVPROC __rglgen_glUniformMatrix2x3fv; +extern RGLSYMGLUNIFORMMATRIX3X2FVPROC __rglgen_glUniformMatrix3x2fv; +extern RGLSYMGLUNIFORMMATRIX2X4FVPROC __rglgen_glUniformMatrix2x4fv; +extern RGLSYMGLUNIFORMMATRIX4X2FVPROC __rglgen_glUniformMatrix4x2fv; +extern RGLSYMGLUNIFORMMATRIX3X4FVPROC __rglgen_glUniformMatrix3x4fv; +extern RGLSYMGLUNIFORMMATRIX4X3FVPROC __rglgen_glUniformMatrix4x3fv; +extern RGLSYMGLCOLORMASKIPROC __rglgen_glColorMaski; +extern RGLSYMGLGETBOOLEANI_VPROC __rglgen_glGetBooleani_v; +extern RGLSYMGLGETINTEGERI_VPROC __rglgen_glGetIntegeri_v; +extern RGLSYMGLENABLEIPROC __rglgen_glEnablei; +extern RGLSYMGLDISABLEIPROC __rglgen_glDisablei; +extern RGLSYMGLISENABLEDIPROC __rglgen_glIsEnabledi; +extern RGLSYMGLBEGINTRANSFORMFEEDBACKPROC __rglgen_glBeginTransformFeedback; +extern RGLSYMGLENDTRANSFORMFEEDBACKPROC __rglgen_glEndTransformFeedback; +extern RGLSYMGLBINDBUFFERRANGEPROC __rglgen_glBindBufferRange; +extern RGLSYMGLBINDBUFFERBASEPROC __rglgen_glBindBufferBase; +extern RGLSYMGLTRANSFORMFEEDBACKVARYINGSPROC __rglgen_glTransformFeedbackVaryings; +extern RGLSYMGLGETTRANSFORMFEEDBACKVARYINGPROC __rglgen_glGetTransformFeedbackVarying; +extern RGLSYMGLCLAMPCOLORPROC __rglgen_glClampColor; +extern RGLSYMGLBEGINCONDITIONALRENDERPROC __rglgen_glBeginConditionalRender; +extern RGLSYMGLENDCONDITIONALRENDERPROC __rglgen_glEndConditionalRender; +extern RGLSYMGLVERTEXATTRIBIPOINTERPROC __rglgen_glVertexAttribIPointer; +extern RGLSYMGLGETVERTEXATTRIBIIVPROC __rglgen_glGetVertexAttribIiv; +extern RGLSYMGLGETVERTEXATTRIBIUIVPROC __rglgen_glGetVertexAttribIuiv; +extern RGLSYMGLVERTEXATTRIBI1IPROC __rglgen_glVertexAttribI1i; +extern RGLSYMGLVERTEXATTRIBI2IPROC __rglgen_glVertexAttribI2i; +extern RGLSYMGLVERTEXATTRIBI3IPROC __rglgen_glVertexAttribI3i; +extern RGLSYMGLVERTEXATTRIBI4IPROC __rglgen_glVertexAttribI4i; +extern RGLSYMGLVERTEXATTRIBI1UIPROC __rglgen_glVertexAttribI1ui; +extern RGLSYMGLVERTEXATTRIBI2UIPROC __rglgen_glVertexAttribI2ui; +extern RGLSYMGLVERTEXATTRIBI3UIPROC __rglgen_glVertexAttribI3ui; +extern RGLSYMGLVERTEXATTRIBI4UIPROC __rglgen_glVertexAttribI4ui; +extern RGLSYMGLVERTEXATTRIBI1IVPROC __rglgen_glVertexAttribI1iv; +extern RGLSYMGLVERTEXATTRIBI2IVPROC __rglgen_glVertexAttribI2iv; +extern RGLSYMGLVERTEXATTRIBI3IVPROC __rglgen_glVertexAttribI3iv; +extern RGLSYMGLVERTEXATTRIBI4IVPROC __rglgen_glVertexAttribI4iv; +extern RGLSYMGLVERTEXATTRIBI1UIVPROC __rglgen_glVertexAttribI1uiv; +extern RGLSYMGLVERTEXATTRIBI2UIVPROC __rglgen_glVertexAttribI2uiv; +extern RGLSYMGLVERTEXATTRIBI3UIVPROC __rglgen_glVertexAttribI3uiv; +extern RGLSYMGLVERTEXATTRIBI4UIVPROC __rglgen_glVertexAttribI4uiv; +extern RGLSYMGLVERTEXATTRIBI4BVPROC __rglgen_glVertexAttribI4bv; +extern RGLSYMGLVERTEXATTRIBI4SVPROC __rglgen_glVertexAttribI4sv; +extern RGLSYMGLVERTEXATTRIBI4UBVPROC __rglgen_glVertexAttribI4ubv; +extern RGLSYMGLVERTEXATTRIBI4USVPROC __rglgen_glVertexAttribI4usv; +extern RGLSYMGLGETUNIFORMUIVPROC __rglgen_glGetUniformuiv; +extern RGLSYMGLBINDFRAGDATALOCATIONPROC __rglgen_glBindFragDataLocation; +extern RGLSYMGLGETFRAGDATALOCATIONPROC __rglgen_glGetFragDataLocation; +extern RGLSYMGLUNIFORM1UIPROC __rglgen_glUniform1ui; +extern RGLSYMGLUNIFORM2UIPROC __rglgen_glUniform2ui; +extern RGLSYMGLUNIFORM3UIPROC __rglgen_glUniform3ui; +extern RGLSYMGLUNIFORM4UIPROC __rglgen_glUniform4ui; +extern RGLSYMGLUNIFORM1UIVPROC __rglgen_glUniform1uiv; +extern RGLSYMGLUNIFORM2UIVPROC __rglgen_glUniform2uiv; +extern RGLSYMGLUNIFORM3UIVPROC __rglgen_glUniform3uiv; +extern RGLSYMGLUNIFORM4UIVPROC __rglgen_glUniform4uiv; +extern RGLSYMGLTEXPARAMETERIIVPROC __rglgen_glTexParameterIiv; +extern RGLSYMGLTEXPARAMETERIUIVPROC __rglgen_glTexParameterIuiv; +extern RGLSYMGLGETTEXPARAMETERIIVPROC __rglgen_glGetTexParameterIiv; +extern RGLSYMGLGETTEXPARAMETERIUIVPROC __rglgen_glGetTexParameterIuiv; +extern RGLSYMGLCLEARBUFFERIVPROC __rglgen_glClearBufferiv; +extern RGLSYMGLCLEARBUFFERUIVPROC __rglgen_glClearBufferuiv; +extern RGLSYMGLCLEARBUFFERFVPROC __rglgen_glClearBufferfv; +extern RGLSYMGLCLEARBUFFERFIPROC __rglgen_glClearBufferfi; +extern RGLSYMGLGETSTRINGIPROC __rglgen_glGetStringi; +extern RGLSYMGLISRENDERBUFFERPROC __rglgen_glIsRenderbuffer; +extern RGLSYMGLBINDRENDERBUFFERPROC __rglgen_glBindRenderbuffer; +extern RGLSYMGLDELETERENDERBUFFERSPROC __rglgen_glDeleteRenderbuffers; +extern RGLSYMGLGENRENDERBUFFERSPROC __rglgen_glGenRenderbuffers; +extern RGLSYMGLRENDERBUFFERSTORAGEPROC __rglgen_glRenderbufferStorage; +extern RGLSYMGLGETRENDERBUFFERPARAMETERIVPROC __rglgen_glGetRenderbufferParameteriv; +extern RGLSYMGLISFRAMEBUFFERPROC __rglgen_glIsFramebuffer; +extern RGLSYMGLBINDFRAMEBUFFERPROC __rglgen_glBindFramebuffer; +extern RGLSYMGLDELETEFRAMEBUFFERSPROC __rglgen_glDeleteFramebuffers; +extern RGLSYMGLGENFRAMEBUFFERSPROC __rglgen_glGenFramebuffers; +extern RGLSYMGLCHECKFRAMEBUFFERSTATUSPROC __rglgen_glCheckFramebufferStatus; +extern RGLSYMGLFRAMEBUFFERTEXTURE1DPROC __rglgen_glFramebufferTexture1D; +extern RGLSYMGLFRAMEBUFFERTEXTURE2DPROC __rglgen_glFramebufferTexture2D; +extern RGLSYMGLFRAMEBUFFERTEXTURE3DPROC __rglgen_glFramebufferTexture3D; +extern RGLSYMGLFRAMEBUFFERRENDERBUFFERPROC __rglgen_glFramebufferRenderbuffer; +extern RGLSYMGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC __rglgen_glGetFramebufferAttachmentParameteriv; +extern RGLSYMGLGENERATEMIPMAPPROC __rglgen_glGenerateMipmap; +extern RGLSYMGLBLITFRAMEBUFFERPROC __rglgen_glBlitFramebuffer; +extern RGLSYMGLRENDERBUFFERSTORAGEMULTISAMPLEPROC __rglgen_glRenderbufferStorageMultisample; +extern RGLSYMGLFRAMEBUFFERTEXTURELAYERPROC __rglgen_glFramebufferTextureLayer; +extern RGLSYMGLMAPBUFFERRANGEPROC __rglgen_glMapBufferRange; +extern RGLSYMGLFLUSHMAPPEDBUFFERRANGEPROC __rglgen_glFlushMappedBufferRange; +extern RGLSYMGLBINDVERTEXARRAYPROC __rglgen_glBindVertexArray; +extern RGLSYMGLDELETEVERTEXARRAYSPROC __rglgen_glDeleteVertexArrays; +extern RGLSYMGLGENVERTEXARRAYSPROC __rglgen_glGenVertexArrays; +extern RGLSYMGLISVERTEXARRAYPROC __rglgen_glIsVertexArray; +extern RGLSYMGLDRAWARRAYSINSTANCEDPROC __rglgen_glDrawArraysInstanced; +extern RGLSYMGLDRAWELEMENTSINSTANCEDPROC __rglgen_glDrawElementsInstanced; +extern RGLSYMGLTEXBUFFERPROC __rglgen_glTexBuffer; +extern RGLSYMGLPRIMITIVERESTARTINDEXPROC __rglgen_glPrimitiveRestartIndex; +extern RGLSYMGLCOPYBUFFERSUBDATAPROC __rglgen_glCopyBufferSubData; +extern RGLSYMGLGETUNIFORMINDICESPROC __rglgen_glGetUniformIndices; +extern RGLSYMGLGETACTIVEUNIFORMSIVPROC __rglgen_glGetActiveUniformsiv; +extern RGLSYMGLGETACTIVEUNIFORMNAMEPROC __rglgen_glGetActiveUniformName; +extern RGLSYMGLGETUNIFORMBLOCKINDEXPROC __rglgen_glGetUniformBlockIndex; +extern RGLSYMGLGETACTIVEUNIFORMBLOCKIVPROC __rglgen_glGetActiveUniformBlockiv; +extern RGLSYMGLGETACTIVEUNIFORMBLOCKNAMEPROC __rglgen_glGetActiveUniformBlockName; +extern RGLSYMGLUNIFORMBLOCKBINDINGPROC __rglgen_glUniformBlockBinding; +extern RGLSYMGLDRAWELEMENTSBASEVERTEXPROC __rglgen_glDrawElementsBaseVertex; +extern RGLSYMGLDRAWRANGEELEMENTSBASEVERTEXPROC __rglgen_glDrawRangeElementsBaseVertex; +extern RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC __rglgen_glDrawElementsInstancedBaseVertex; +extern RGLSYMGLMULTIDRAWELEMENTSBASEVERTEXPROC __rglgen_glMultiDrawElementsBaseVertex; +extern RGLSYMGLPROVOKINGVERTEXPROC __rglgen_glProvokingVertex; +extern RGLSYMGLFENCESYNCPROC __rglgen_glFenceSync; +extern RGLSYMGLISSYNCPROC __rglgen_glIsSync; +extern RGLSYMGLDELETESYNCPROC __rglgen_glDeleteSync; +extern RGLSYMGLCLIENTWAITSYNCPROC __rglgen_glClientWaitSync; +extern RGLSYMGLWAITSYNCPROC __rglgen_glWaitSync; +extern RGLSYMGLGETINTEGER64VPROC __rglgen_glGetInteger64v; +extern RGLSYMGLGETSYNCIVPROC __rglgen_glGetSynciv; +extern RGLSYMGLGETINTEGER64I_VPROC __rglgen_glGetInteger64i_v; +extern RGLSYMGLGETBUFFERPARAMETERI64VPROC __rglgen_glGetBufferParameteri64v; +extern RGLSYMGLFRAMEBUFFERTEXTUREPROC __rglgen_glFramebufferTexture; +extern RGLSYMGLTEXIMAGE2DMULTISAMPLEPROC __rglgen_glTexImage2DMultisample; +extern RGLSYMGLTEXIMAGE3DMULTISAMPLEPROC __rglgen_glTexImage3DMultisample; +extern RGLSYMGLGETMULTISAMPLEFVPROC __rglgen_glGetMultisamplefv; +extern RGLSYMGLSAMPLEMASKIPROC __rglgen_glSampleMaski; +extern RGLSYMGLBINDFRAGDATALOCATIONINDEXEDPROC __rglgen_glBindFragDataLocationIndexed; +extern RGLSYMGLGETFRAGDATAINDEXPROC __rglgen_glGetFragDataIndex; +extern RGLSYMGLGENSAMPLERSPROC __rglgen_glGenSamplers; +extern RGLSYMGLDELETESAMPLERSPROC __rglgen_glDeleteSamplers; +extern RGLSYMGLISSAMPLERPROC __rglgen_glIsSampler; +extern RGLSYMGLBINDSAMPLERPROC __rglgen_glBindSampler; +extern RGLSYMGLSAMPLERPARAMETERIPROC __rglgen_glSamplerParameteri; +extern RGLSYMGLSAMPLERPARAMETERIVPROC __rglgen_glSamplerParameteriv; +extern RGLSYMGLSAMPLERPARAMETERFPROC __rglgen_glSamplerParameterf; +extern RGLSYMGLSAMPLERPARAMETERFVPROC __rglgen_glSamplerParameterfv; +extern RGLSYMGLSAMPLERPARAMETERIIVPROC __rglgen_glSamplerParameterIiv; +extern RGLSYMGLSAMPLERPARAMETERIUIVPROC __rglgen_glSamplerParameterIuiv; +extern RGLSYMGLGETSAMPLERPARAMETERIVPROC __rglgen_glGetSamplerParameteriv; +extern RGLSYMGLGETSAMPLERPARAMETERIIVPROC __rglgen_glGetSamplerParameterIiv; +extern RGLSYMGLGETSAMPLERPARAMETERFVPROC __rglgen_glGetSamplerParameterfv; +extern RGLSYMGLGETSAMPLERPARAMETERIUIVPROC __rglgen_glGetSamplerParameterIuiv; +extern RGLSYMGLQUERYCOUNTERPROC __rglgen_glQueryCounter; +extern RGLSYMGLGETQUERYOBJECTI64VPROC __rglgen_glGetQueryObjecti64v; +extern RGLSYMGLGETQUERYOBJECTUI64VPROC __rglgen_glGetQueryObjectui64v; +extern RGLSYMGLVERTEXATTRIBDIVISORPROC __rglgen_glVertexAttribDivisor; +extern RGLSYMGLVERTEXATTRIBP1UIPROC __rglgen_glVertexAttribP1ui; +extern RGLSYMGLVERTEXATTRIBP1UIVPROC __rglgen_glVertexAttribP1uiv; +extern RGLSYMGLVERTEXATTRIBP2UIPROC __rglgen_glVertexAttribP2ui; +extern RGLSYMGLVERTEXATTRIBP2UIVPROC __rglgen_glVertexAttribP2uiv; +extern RGLSYMGLVERTEXATTRIBP3UIPROC __rglgen_glVertexAttribP3ui; +extern RGLSYMGLVERTEXATTRIBP3UIVPROC __rglgen_glVertexAttribP3uiv; +extern RGLSYMGLVERTEXATTRIBP4UIPROC __rglgen_glVertexAttribP4ui; +extern RGLSYMGLVERTEXATTRIBP4UIVPROC __rglgen_glVertexAttribP4uiv; +extern RGLSYMGLVERTEXP2UIPROC __rglgen_glVertexP2ui; +extern RGLSYMGLVERTEXP2UIVPROC __rglgen_glVertexP2uiv; +extern RGLSYMGLVERTEXP3UIPROC __rglgen_glVertexP3ui; +extern RGLSYMGLVERTEXP3UIVPROC __rglgen_glVertexP3uiv; +extern RGLSYMGLVERTEXP4UIPROC __rglgen_glVertexP4ui; +extern RGLSYMGLVERTEXP4UIVPROC __rglgen_glVertexP4uiv; +extern RGLSYMGLTEXCOORDP1UIPROC __rglgen_glTexCoordP1ui; +extern RGLSYMGLTEXCOORDP1UIVPROC __rglgen_glTexCoordP1uiv; +extern RGLSYMGLTEXCOORDP2UIPROC __rglgen_glTexCoordP2ui; +extern RGLSYMGLTEXCOORDP2UIVPROC __rglgen_glTexCoordP2uiv; +extern RGLSYMGLTEXCOORDP3UIPROC __rglgen_glTexCoordP3ui; +extern RGLSYMGLTEXCOORDP3UIVPROC __rglgen_glTexCoordP3uiv; +extern RGLSYMGLTEXCOORDP4UIPROC __rglgen_glTexCoordP4ui; +extern RGLSYMGLTEXCOORDP4UIVPROC __rglgen_glTexCoordP4uiv; +extern RGLSYMGLMULTITEXCOORDP1UIPROC __rglgen_glMultiTexCoordP1ui; +extern RGLSYMGLMULTITEXCOORDP1UIVPROC __rglgen_glMultiTexCoordP1uiv; +extern RGLSYMGLMULTITEXCOORDP2UIPROC __rglgen_glMultiTexCoordP2ui; +extern RGLSYMGLMULTITEXCOORDP2UIVPROC __rglgen_glMultiTexCoordP2uiv; +extern RGLSYMGLMULTITEXCOORDP3UIPROC __rglgen_glMultiTexCoordP3ui; +extern RGLSYMGLMULTITEXCOORDP3UIVPROC __rglgen_glMultiTexCoordP3uiv; +extern RGLSYMGLMULTITEXCOORDP4UIPROC __rglgen_glMultiTexCoordP4ui; +extern RGLSYMGLMULTITEXCOORDP4UIVPROC __rglgen_glMultiTexCoordP4uiv; +extern RGLSYMGLNORMALP3UIPROC __rglgen_glNormalP3ui; +extern RGLSYMGLNORMALP3UIVPROC __rglgen_glNormalP3uiv; +extern RGLSYMGLCOLORP3UIPROC __rglgen_glColorP3ui; +extern RGLSYMGLCOLORP3UIVPROC __rglgen_glColorP3uiv; +extern RGLSYMGLCOLORP4UIPROC __rglgen_glColorP4ui; +extern RGLSYMGLCOLORP4UIVPROC __rglgen_glColorP4uiv; +extern RGLSYMGLSECONDARYCOLORP3UIPROC __rglgen_glSecondaryColorP3ui; +extern RGLSYMGLSECONDARYCOLORP3UIVPROC __rglgen_glSecondaryColorP3uiv; +extern RGLSYMGLMINSAMPLESHADINGPROC __rglgen_glMinSampleShading; +extern RGLSYMGLBLENDEQUATIONIPROC __rglgen_glBlendEquationi; +extern RGLSYMGLBLENDEQUATIONSEPARATEIPROC __rglgen_glBlendEquationSeparatei; +extern RGLSYMGLBLENDFUNCIPROC __rglgen_glBlendFunci; +extern RGLSYMGLBLENDFUNCSEPARATEIPROC __rglgen_glBlendFuncSeparatei; +extern RGLSYMGLDRAWARRAYSINDIRECTPROC __rglgen_glDrawArraysIndirect; +extern RGLSYMGLDRAWELEMENTSINDIRECTPROC __rglgen_glDrawElementsIndirect; +extern RGLSYMGLUNIFORM1DPROC __rglgen_glUniform1d; +extern RGLSYMGLUNIFORM2DPROC __rglgen_glUniform2d; +extern RGLSYMGLUNIFORM3DPROC __rglgen_glUniform3d; +extern RGLSYMGLUNIFORM4DPROC __rglgen_glUniform4d; +extern RGLSYMGLUNIFORM1DVPROC __rglgen_glUniform1dv; +extern RGLSYMGLUNIFORM2DVPROC __rglgen_glUniform2dv; +extern RGLSYMGLUNIFORM3DVPROC __rglgen_glUniform3dv; +extern RGLSYMGLUNIFORM4DVPROC __rglgen_glUniform4dv; +extern RGLSYMGLUNIFORMMATRIX2DVPROC __rglgen_glUniformMatrix2dv; +extern RGLSYMGLUNIFORMMATRIX3DVPROC __rglgen_glUniformMatrix3dv; +extern RGLSYMGLUNIFORMMATRIX4DVPROC __rglgen_glUniformMatrix4dv; +extern RGLSYMGLUNIFORMMATRIX2X3DVPROC __rglgen_glUniformMatrix2x3dv; +extern RGLSYMGLUNIFORMMATRIX2X4DVPROC __rglgen_glUniformMatrix2x4dv; +extern RGLSYMGLUNIFORMMATRIX3X2DVPROC __rglgen_glUniformMatrix3x2dv; +extern RGLSYMGLUNIFORMMATRIX3X4DVPROC __rglgen_glUniformMatrix3x4dv; +extern RGLSYMGLUNIFORMMATRIX4X2DVPROC __rglgen_glUniformMatrix4x2dv; +extern RGLSYMGLUNIFORMMATRIX4X3DVPROC __rglgen_glUniformMatrix4x3dv; +extern RGLSYMGLGETUNIFORMDVPROC __rglgen_glGetUniformdv; +extern RGLSYMGLGETSUBROUTINEUNIFORMLOCATIONPROC __rglgen_glGetSubroutineUniformLocation; +extern RGLSYMGLGETSUBROUTINEINDEXPROC __rglgen_glGetSubroutineIndex; +extern RGLSYMGLGETACTIVESUBROUTINEUNIFORMIVPROC __rglgen_glGetActiveSubroutineUniformiv; +extern RGLSYMGLGETACTIVESUBROUTINEUNIFORMNAMEPROC __rglgen_glGetActiveSubroutineUniformName; +extern RGLSYMGLGETACTIVESUBROUTINENAMEPROC __rglgen_glGetActiveSubroutineName; +extern RGLSYMGLUNIFORMSUBROUTINESUIVPROC __rglgen_glUniformSubroutinesuiv; +extern RGLSYMGLGETUNIFORMSUBROUTINEUIVPROC __rglgen_glGetUniformSubroutineuiv; +extern RGLSYMGLGETPROGRAMSTAGEIVPROC __rglgen_glGetProgramStageiv; +extern RGLSYMGLPATCHPARAMETERIPROC __rglgen_glPatchParameteri; +extern RGLSYMGLPATCHPARAMETERFVPROC __rglgen_glPatchParameterfv; +extern RGLSYMGLBINDTRANSFORMFEEDBACKPROC __rglgen_glBindTransformFeedback; +extern RGLSYMGLDELETETRANSFORMFEEDBACKSPROC __rglgen_glDeleteTransformFeedbacks; +extern RGLSYMGLGENTRANSFORMFEEDBACKSPROC __rglgen_glGenTransformFeedbacks; +extern RGLSYMGLISTRANSFORMFEEDBACKPROC __rglgen_glIsTransformFeedback; +extern RGLSYMGLPAUSETRANSFORMFEEDBACKPROC __rglgen_glPauseTransformFeedback; +extern RGLSYMGLRESUMETRANSFORMFEEDBACKPROC __rglgen_glResumeTransformFeedback; +extern RGLSYMGLDRAWTRANSFORMFEEDBACKPROC __rglgen_glDrawTransformFeedback; +extern RGLSYMGLDRAWTRANSFORMFEEDBACKSTREAMPROC __rglgen_glDrawTransformFeedbackStream; +extern RGLSYMGLBEGINQUERYINDEXEDPROC __rglgen_glBeginQueryIndexed; +extern RGLSYMGLENDQUERYINDEXEDPROC __rglgen_glEndQueryIndexed; +extern RGLSYMGLGETQUERYINDEXEDIVPROC __rglgen_glGetQueryIndexediv; +extern RGLSYMGLRELEASESHADERCOMPILERPROC __rglgen_glReleaseShaderCompiler; +extern RGLSYMGLSHADERBINARYPROC __rglgen_glShaderBinary; +extern RGLSYMGLGETSHADERPRECISIONFORMATPROC __rglgen_glGetShaderPrecisionFormat; +extern RGLSYMGLDEPTHRANGEFPROC __rglgen_glDepthRangef; +extern RGLSYMGLCLEARDEPTHFPROC __rglgen_glClearDepthf; +extern RGLSYMGLGETPROGRAMBINARYPROC __rglgen_glGetProgramBinary; +extern RGLSYMGLPROGRAMBINARYPROC __rglgen_glProgramBinary; +extern RGLSYMGLPROGRAMPARAMETERIPROC __rglgen_glProgramParameteri; +extern RGLSYMGLUSEPROGRAMSTAGESPROC __rglgen_glUseProgramStages; +extern RGLSYMGLACTIVESHADERPROGRAMPROC __rglgen_glActiveShaderProgram; +extern RGLSYMGLCREATESHADERPROGRAMVPROC __rglgen_glCreateShaderProgramv; +extern RGLSYMGLBINDPROGRAMPIPELINEPROC __rglgen_glBindProgramPipeline; +extern RGLSYMGLDELETEPROGRAMPIPELINESPROC __rglgen_glDeleteProgramPipelines; +extern RGLSYMGLGENPROGRAMPIPELINESPROC __rglgen_glGenProgramPipelines; +extern RGLSYMGLISPROGRAMPIPELINEPROC __rglgen_glIsProgramPipeline; +extern RGLSYMGLGETPROGRAMPIPELINEIVPROC __rglgen_glGetProgramPipelineiv; +extern RGLSYMGLPROGRAMUNIFORM1IPROC __rglgen_glProgramUniform1i; +extern RGLSYMGLPROGRAMUNIFORM1IVPROC __rglgen_glProgramUniform1iv; +extern RGLSYMGLPROGRAMUNIFORM1FPROC __rglgen_glProgramUniform1f; +extern RGLSYMGLPROGRAMUNIFORM1FVPROC __rglgen_glProgramUniform1fv; +extern RGLSYMGLPROGRAMUNIFORM1DPROC __rglgen_glProgramUniform1d; +extern RGLSYMGLPROGRAMUNIFORM1DVPROC __rglgen_glProgramUniform1dv; +extern RGLSYMGLPROGRAMUNIFORM1UIPROC __rglgen_glProgramUniform1ui; +extern RGLSYMGLPROGRAMUNIFORM1UIVPROC __rglgen_glProgramUniform1uiv; +extern RGLSYMGLPROGRAMUNIFORM2IPROC __rglgen_glProgramUniform2i; +extern RGLSYMGLPROGRAMUNIFORM2IVPROC __rglgen_glProgramUniform2iv; +extern RGLSYMGLPROGRAMUNIFORM2FPROC __rglgen_glProgramUniform2f; +extern RGLSYMGLPROGRAMUNIFORM2FVPROC __rglgen_glProgramUniform2fv; +extern RGLSYMGLPROGRAMUNIFORM2DPROC __rglgen_glProgramUniform2d; +extern RGLSYMGLPROGRAMUNIFORM2DVPROC __rglgen_glProgramUniform2dv; +extern RGLSYMGLPROGRAMUNIFORM2UIPROC __rglgen_glProgramUniform2ui; +extern RGLSYMGLPROGRAMUNIFORM2UIVPROC __rglgen_glProgramUniform2uiv; +extern RGLSYMGLPROGRAMUNIFORM3IPROC __rglgen_glProgramUniform3i; +extern RGLSYMGLPROGRAMUNIFORM3IVPROC __rglgen_glProgramUniform3iv; +extern RGLSYMGLPROGRAMUNIFORM3FPROC __rglgen_glProgramUniform3f; +extern RGLSYMGLPROGRAMUNIFORM3FVPROC __rglgen_glProgramUniform3fv; +extern RGLSYMGLPROGRAMUNIFORM3DPROC __rglgen_glProgramUniform3d; +extern RGLSYMGLPROGRAMUNIFORM3DVPROC __rglgen_glProgramUniform3dv; +extern RGLSYMGLPROGRAMUNIFORM3UIPROC __rglgen_glProgramUniform3ui; +extern RGLSYMGLPROGRAMUNIFORM3UIVPROC __rglgen_glProgramUniform3uiv; +extern RGLSYMGLPROGRAMUNIFORM4IPROC __rglgen_glProgramUniform4i; +extern RGLSYMGLPROGRAMUNIFORM4IVPROC __rglgen_glProgramUniform4iv; +extern RGLSYMGLPROGRAMUNIFORM4FPROC __rglgen_glProgramUniform4f; +extern RGLSYMGLPROGRAMUNIFORM4FVPROC __rglgen_glProgramUniform4fv; +extern RGLSYMGLPROGRAMUNIFORM4DPROC __rglgen_glProgramUniform4d; +extern RGLSYMGLPROGRAMUNIFORM4DVPROC __rglgen_glProgramUniform4dv; +extern RGLSYMGLPROGRAMUNIFORM4UIPROC __rglgen_glProgramUniform4ui; +extern RGLSYMGLPROGRAMUNIFORM4UIVPROC __rglgen_glProgramUniform4uiv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX2FVPROC __rglgen_glProgramUniformMatrix2fv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX3FVPROC __rglgen_glProgramUniformMatrix3fv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX4FVPROC __rglgen_glProgramUniformMatrix4fv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX2DVPROC __rglgen_glProgramUniformMatrix2dv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX3DVPROC __rglgen_glProgramUniformMatrix3dv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX4DVPROC __rglgen_glProgramUniformMatrix4dv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX2X3FVPROC __rglgen_glProgramUniformMatrix2x3fv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX3X2FVPROC __rglgen_glProgramUniformMatrix3x2fv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX2X4FVPROC __rglgen_glProgramUniformMatrix2x4fv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX4X2FVPROC __rglgen_glProgramUniformMatrix4x2fv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX3X4FVPROC __rglgen_glProgramUniformMatrix3x4fv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX4X3FVPROC __rglgen_glProgramUniformMatrix4x3fv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX2X3DVPROC __rglgen_glProgramUniformMatrix2x3dv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX3X2DVPROC __rglgen_glProgramUniformMatrix3x2dv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX2X4DVPROC __rglgen_glProgramUniformMatrix2x4dv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX4X2DVPROC __rglgen_glProgramUniformMatrix4x2dv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX3X4DVPROC __rglgen_glProgramUniformMatrix3x4dv; +extern RGLSYMGLPROGRAMUNIFORMMATRIX4X3DVPROC __rglgen_glProgramUniformMatrix4x3dv; +extern RGLSYMGLVALIDATEPROGRAMPIPELINEPROC __rglgen_glValidateProgramPipeline; +extern RGLSYMGLGETPROGRAMPIPELINEINFOLOGPROC __rglgen_glGetProgramPipelineInfoLog; +extern RGLSYMGLVERTEXATTRIBL1DPROC __rglgen_glVertexAttribL1d; +extern RGLSYMGLVERTEXATTRIBL2DPROC __rglgen_glVertexAttribL2d; +extern RGLSYMGLVERTEXATTRIBL3DPROC __rglgen_glVertexAttribL3d; +extern RGLSYMGLVERTEXATTRIBL4DPROC __rglgen_glVertexAttribL4d; +extern RGLSYMGLVERTEXATTRIBL1DVPROC __rglgen_glVertexAttribL1dv; +extern RGLSYMGLVERTEXATTRIBL2DVPROC __rglgen_glVertexAttribL2dv; +extern RGLSYMGLVERTEXATTRIBL3DVPROC __rglgen_glVertexAttribL3dv; +extern RGLSYMGLVERTEXATTRIBL4DVPROC __rglgen_glVertexAttribL4dv; +extern RGLSYMGLVERTEXATTRIBLPOINTERPROC __rglgen_glVertexAttribLPointer; +extern RGLSYMGLGETVERTEXATTRIBLDVPROC __rglgen_glGetVertexAttribLdv; +extern RGLSYMGLVIEWPORTARRAYVPROC __rglgen_glViewportArrayv; +extern RGLSYMGLVIEWPORTINDEXEDFPROC __rglgen_glViewportIndexedf; +extern RGLSYMGLVIEWPORTINDEXEDFVPROC __rglgen_glViewportIndexedfv; +extern RGLSYMGLSCISSORARRAYVPROC __rglgen_glScissorArrayv; +extern RGLSYMGLSCISSORINDEXEDPROC __rglgen_glScissorIndexed; +extern RGLSYMGLSCISSORINDEXEDVPROC __rglgen_glScissorIndexedv; +extern RGLSYMGLDEPTHRANGEARRAYVPROC __rglgen_glDepthRangeArrayv; +extern RGLSYMGLDEPTHRANGEINDEXEDPROC __rglgen_glDepthRangeIndexed; +extern RGLSYMGLGETFLOATI_VPROC __rglgen_glGetFloati_v; +extern RGLSYMGLGETDOUBLEI_VPROC __rglgen_glGetDoublei_v; +extern RGLSYMGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC __rglgen_glDrawArraysInstancedBaseInstance; +extern RGLSYMGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC __rglgen_glDrawElementsInstancedBaseInstance; +extern RGLSYMGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC __rglgen_glDrawElementsInstancedBaseVertexBaseInstance; +extern RGLSYMGLGETINTERNALFORMATIVPROC __rglgen_glGetInternalformativ; +extern RGLSYMGLGETACTIVEATOMICCOUNTERBUFFERIVPROC __rglgen_glGetActiveAtomicCounterBufferiv; +extern RGLSYMGLBINDIMAGETEXTUREPROC __rglgen_glBindImageTexture; +extern RGLSYMGLMEMORYBARRIERPROC __rglgen_glMemoryBarrier; +extern RGLSYMGLTEXSTORAGE1DPROC __rglgen_glTexStorage1D; +extern RGLSYMGLTEXSTORAGE2DPROC __rglgen_glTexStorage2D; +extern RGLSYMGLTEXSTORAGE3DPROC __rglgen_glTexStorage3D; +extern RGLSYMGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC __rglgen_glDrawTransformFeedbackInstanced; +extern RGLSYMGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC __rglgen_glDrawTransformFeedbackStreamInstanced; +extern RGLSYMGLCLEARBUFFERDATAPROC __rglgen_glClearBufferData; +extern RGLSYMGLCLEARBUFFERSUBDATAPROC __rglgen_glClearBufferSubData; +extern RGLSYMGLDISPATCHCOMPUTEPROC __rglgen_glDispatchCompute; +extern RGLSYMGLDISPATCHCOMPUTEINDIRECTPROC __rglgen_glDispatchComputeIndirect; +extern RGLSYMGLCOPYIMAGESUBDATAPROC __rglgen_glCopyImageSubData; +extern RGLSYMGLFRAMEBUFFERPARAMETERIPROC __rglgen_glFramebufferParameteri; +extern RGLSYMGLGETFRAMEBUFFERPARAMETERIVPROC __rglgen_glGetFramebufferParameteriv; +extern RGLSYMGLGETINTERNALFORMATI64VPROC __rglgen_glGetInternalformati64v; +extern RGLSYMGLINVALIDATETEXSUBIMAGEPROC __rglgen_glInvalidateTexSubImage; +extern RGLSYMGLINVALIDATETEXIMAGEPROC __rglgen_glInvalidateTexImage; +extern RGLSYMGLINVALIDATEBUFFERSUBDATAPROC __rglgen_glInvalidateBufferSubData; +extern RGLSYMGLINVALIDATEBUFFERDATAPROC __rglgen_glInvalidateBufferData; +extern RGLSYMGLINVALIDATEFRAMEBUFFERPROC __rglgen_glInvalidateFramebuffer; +extern RGLSYMGLINVALIDATESUBFRAMEBUFFERPROC __rglgen_glInvalidateSubFramebuffer; +extern RGLSYMGLMULTIDRAWARRAYSINDIRECTPROC __rglgen_glMultiDrawArraysIndirect; +extern RGLSYMGLMULTIDRAWELEMENTSINDIRECTPROC __rglgen_glMultiDrawElementsIndirect; +extern RGLSYMGLGETPROGRAMINTERFACEIVPROC __rglgen_glGetProgramInterfaceiv; +extern RGLSYMGLGETPROGRAMRESOURCEINDEXPROC __rglgen_glGetProgramResourceIndex; +extern RGLSYMGLGETPROGRAMRESOURCENAMEPROC __rglgen_glGetProgramResourceName; +extern RGLSYMGLGETPROGRAMRESOURCEIVPROC __rglgen_glGetProgramResourceiv; +extern RGLSYMGLGETPROGRAMRESOURCELOCATIONPROC __rglgen_glGetProgramResourceLocation; +extern RGLSYMGLGETPROGRAMRESOURCELOCATIONINDEXPROC __rglgen_glGetProgramResourceLocationIndex; +extern RGLSYMGLSHADERSTORAGEBLOCKBINDINGPROC __rglgen_glShaderStorageBlockBinding; +extern RGLSYMGLTEXBUFFERRANGEPROC __rglgen_glTexBufferRange; +extern RGLSYMGLTEXSTORAGE2DMULTISAMPLEPROC __rglgen_glTexStorage2DMultisample; +extern RGLSYMGLTEXSTORAGE3DMULTISAMPLEPROC __rglgen_glTexStorage3DMultisample; +extern RGLSYMGLTEXTUREVIEWPROC __rglgen_glTextureView; +extern RGLSYMGLBINDVERTEXBUFFERPROC __rglgen_glBindVertexBuffer; +extern RGLSYMGLVERTEXATTRIBFORMATPROC __rglgen_glVertexAttribFormat; +extern RGLSYMGLVERTEXATTRIBIFORMATPROC __rglgen_glVertexAttribIFormat; +extern RGLSYMGLVERTEXATTRIBLFORMATPROC __rglgen_glVertexAttribLFormat; +extern RGLSYMGLVERTEXATTRIBBINDINGPROC __rglgen_glVertexAttribBinding; +extern RGLSYMGLVERTEXBINDINGDIVISORPROC __rglgen_glVertexBindingDivisor; +extern RGLSYMGLDEBUGMESSAGECONTROLPROC __rglgen_glDebugMessageControl; +extern RGLSYMGLDEBUGMESSAGEINSERTPROC __rglgen_glDebugMessageInsert; +extern RGLSYMGLDEBUGMESSAGECALLBACKPROC __rglgen_glDebugMessageCallback; +extern RGLSYMGLGETDEBUGMESSAGELOGPROC __rglgen_glGetDebugMessageLog; +extern RGLSYMGLPUSHDEBUGGROUPPROC __rglgen_glPushDebugGroup; +extern RGLSYMGLPOPDEBUGGROUPPROC __rglgen_glPopDebugGroup; +extern RGLSYMGLOBJECTLABELPROC __rglgen_glObjectLabel; +extern RGLSYMGLGETOBJECTLABELPROC __rglgen_glGetObjectLabel; +extern RGLSYMGLOBJECTPTRLABELPROC __rglgen_glObjectPtrLabel; +extern RGLSYMGLGETOBJECTPTRLABELPROC __rglgen_glGetObjectPtrLabel; +extern RGLSYMGLBUFFERSTORAGEPROC __rglgen_glBufferStorage; +extern RGLSYMGLCLEARTEXIMAGEPROC __rglgen_glClearTexImage; +extern RGLSYMGLCLEARTEXSUBIMAGEPROC __rglgen_glClearTexSubImage; +extern RGLSYMGLBINDBUFFERSBASEPROC __rglgen_glBindBuffersBase; +extern RGLSYMGLBINDBUFFERSRANGEPROC __rglgen_glBindBuffersRange; +extern RGLSYMGLBINDTEXTURESPROC __rglgen_glBindTextures; +extern RGLSYMGLBINDSAMPLERSPROC __rglgen_glBindSamplers; +extern RGLSYMGLBINDIMAGETEXTURESPROC __rglgen_glBindImageTextures; +extern RGLSYMGLBINDVERTEXBUFFERSPROC __rglgen_glBindVertexBuffers; +extern RGLSYMGLGETTEXTUREHANDLEARBPROC __rglgen_glGetTextureHandleARB; +extern RGLSYMGLGETTEXTURESAMPLERHANDLEARBPROC __rglgen_glGetTextureSamplerHandleARB; +extern RGLSYMGLMAKETEXTUREHANDLERESIDENTARBPROC __rglgen_glMakeTextureHandleResidentARB; +extern RGLSYMGLMAKETEXTUREHANDLENONRESIDENTARBPROC __rglgen_glMakeTextureHandleNonResidentARB; +extern RGLSYMGLGETIMAGEHANDLEARBPROC __rglgen_glGetImageHandleARB; +extern RGLSYMGLMAKEIMAGEHANDLERESIDENTARBPROC __rglgen_glMakeImageHandleResidentARB; +extern RGLSYMGLMAKEIMAGEHANDLENONRESIDENTARBPROC __rglgen_glMakeImageHandleNonResidentARB; +extern RGLSYMGLUNIFORMHANDLEUI64ARBPROC __rglgen_glUniformHandleui64ARB; +extern RGLSYMGLUNIFORMHANDLEUI64VARBPROC __rglgen_glUniformHandleui64vARB; +extern RGLSYMGLPROGRAMUNIFORMHANDLEUI64ARBPROC __rglgen_glProgramUniformHandleui64ARB; +extern RGLSYMGLPROGRAMUNIFORMHANDLEUI64VARBPROC __rglgen_glProgramUniformHandleui64vARB; +extern RGLSYMGLISTEXTUREHANDLERESIDENTARBPROC __rglgen_glIsTextureHandleResidentARB; +extern RGLSYMGLISIMAGEHANDLERESIDENTARBPROC __rglgen_glIsImageHandleResidentARB; +extern RGLSYMGLVERTEXATTRIBL1UI64ARBPROC __rglgen_glVertexAttribL1ui64ARB; +extern RGLSYMGLVERTEXATTRIBL1UI64VARBPROC __rglgen_glVertexAttribL1ui64vARB; +extern RGLSYMGLGETVERTEXATTRIBLUI64VARBPROC __rglgen_glGetVertexAttribLui64vARB; +extern RGLSYMGLCREATESYNCFROMCLEVENTARBPROC __rglgen_glCreateSyncFromCLeventARB; +extern RGLSYMGLCLAMPCOLORARBPROC __rglgen_glClampColorARB; +extern RGLSYMGLDISPATCHCOMPUTEGROUPSIZEARBPROC __rglgen_glDispatchComputeGroupSizeARB; +extern RGLSYMGLDEBUGMESSAGECONTROLARBPROC __rglgen_glDebugMessageControlARB; +extern RGLSYMGLDEBUGMESSAGEINSERTARBPROC __rglgen_glDebugMessageInsertARB; +extern RGLSYMGLDEBUGMESSAGECALLBACKARBPROC __rglgen_glDebugMessageCallbackARB; +extern RGLSYMGLGETDEBUGMESSAGELOGARBPROC __rglgen_glGetDebugMessageLogARB; +extern RGLSYMGLDRAWBUFFERSARBPROC __rglgen_glDrawBuffersARB; +extern RGLSYMGLBLENDEQUATIONIARBPROC __rglgen_glBlendEquationiARB; +extern RGLSYMGLBLENDEQUATIONSEPARATEIARBPROC __rglgen_glBlendEquationSeparateiARB; +extern RGLSYMGLBLENDFUNCIARBPROC __rglgen_glBlendFunciARB; +extern RGLSYMGLBLENDFUNCSEPARATEIARBPROC __rglgen_glBlendFuncSeparateiARB; +extern RGLSYMGLDRAWARRAYSINSTANCEDARBPROC __rglgen_glDrawArraysInstancedARB; +extern RGLSYMGLDRAWELEMENTSINSTANCEDARBPROC __rglgen_glDrawElementsInstancedARB; +extern RGLSYMGLPROGRAMSTRINGARBPROC __rglgen_glProgramStringARB; +extern RGLSYMGLBINDPROGRAMARBPROC __rglgen_glBindProgramARB; +extern RGLSYMGLDELETEPROGRAMSARBPROC __rglgen_glDeleteProgramsARB; +extern RGLSYMGLGENPROGRAMSARBPROC __rglgen_glGenProgramsARB; +extern RGLSYMGLPROGRAMENVPARAMETER4DARBPROC __rglgen_glProgramEnvParameter4dARB; +extern RGLSYMGLPROGRAMENVPARAMETER4DVARBPROC __rglgen_glProgramEnvParameter4dvARB; +extern RGLSYMGLPROGRAMENVPARAMETER4FARBPROC __rglgen_glProgramEnvParameter4fARB; +extern RGLSYMGLPROGRAMENVPARAMETER4FVARBPROC __rglgen_glProgramEnvParameter4fvARB; +extern RGLSYMGLPROGRAMLOCALPARAMETER4DARBPROC __rglgen_glProgramLocalParameter4dARB; +extern RGLSYMGLPROGRAMLOCALPARAMETER4DVARBPROC __rglgen_glProgramLocalParameter4dvARB; +extern RGLSYMGLPROGRAMLOCALPARAMETER4FARBPROC __rglgen_glProgramLocalParameter4fARB; +extern RGLSYMGLPROGRAMLOCALPARAMETER4FVARBPROC __rglgen_glProgramLocalParameter4fvARB; +extern RGLSYMGLGETPROGRAMENVPARAMETERDVARBPROC __rglgen_glGetProgramEnvParameterdvARB; +extern RGLSYMGLGETPROGRAMENVPARAMETERFVARBPROC __rglgen_glGetProgramEnvParameterfvARB; +extern RGLSYMGLGETPROGRAMLOCALPARAMETERDVARBPROC __rglgen_glGetProgramLocalParameterdvARB; +extern RGLSYMGLGETPROGRAMLOCALPARAMETERFVARBPROC __rglgen_glGetProgramLocalParameterfvARB; +extern RGLSYMGLGETPROGRAMIVARBPROC __rglgen_glGetProgramivARB; +extern RGLSYMGLGETPROGRAMSTRINGARBPROC __rglgen_glGetProgramStringARB; +extern RGLSYMGLISPROGRAMARBPROC __rglgen_glIsProgramARB; +extern RGLSYMGLPROGRAMPARAMETERIARBPROC __rglgen_glProgramParameteriARB; +extern RGLSYMGLFRAMEBUFFERTEXTUREARBPROC __rglgen_glFramebufferTextureARB; +extern RGLSYMGLFRAMEBUFFERTEXTURELAYERARBPROC __rglgen_glFramebufferTextureLayerARB; +extern RGLSYMGLFRAMEBUFFERTEXTUREFACEARBPROC __rglgen_glFramebufferTextureFaceARB; +extern RGLSYMGLCOLORTABLEPROC __rglgen_glColorTable; +extern RGLSYMGLCOLORTABLEPARAMETERFVPROC __rglgen_glColorTableParameterfv; +extern RGLSYMGLCOLORTABLEPARAMETERIVPROC __rglgen_glColorTableParameteriv; +extern RGLSYMGLCOPYCOLORTABLEPROC __rglgen_glCopyColorTable; +extern RGLSYMGLGETCOLORTABLEPROC __rglgen_glGetColorTable; +extern RGLSYMGLGETCOLORTABLEPARAMETERFVPROC __rglgen_glGetColorTableParameterfv; +extern RGLSYMGLGETCOLORTABLEPARAMETERIVPROC __rglgen_glGetColorTableParameteriv; +extern RGLSYMGLCOLORSUBTABLEPROC __rglgen_glColorSubTable; +extern RGLSYMGLCOPYCOLORSUBTABLEPROC __rglgen_glCopyColorSubTable; +extern RGLSYMGLCONVOLUTIONFILTER1DPROC __rglgen_glConvolutionFilter1D; +extern RGLSYMGLCONVOLUTIONFILTER2DPROC __rglgen_glConvolutionFilter2D; +extern RGLSYMGLCONVOLUTIONPARAMETERFPROC __rglgen_glConvolutionParameterf; +extern RGLSYMGLCONVOLUTIONPARAMETERFVPROC __rglgen_glConvolutionParameterfv; +extern RGLSYMGLCONVOLUTIONPARAMETERIPROC __rglgen_glConvolutionParameteri; +extern RGLSYMGLCONVOLUTIONPARAMETERIVPROC __rglgen_glConvolutionParameteriv; +extern RGLSYMGLCOPYCONVOLUTIONFILTER1DPROC __rglgen_glCopyConvolutionFilter1D; +extern RGLSYMGLCOPYCONVOLUTIONFILTER2DPROC __rglgen_glCopyConvolutionFilter2D; +extern RGLSYMGLGETCONVOLUTIONFILTERPROC __rglgen_glGetConvolutionFilter; +extern RGLSYMGLGETCONVOLUTIONPARAMETERFVPROC __rglgen_glGetConvolutionParameterfv; +extern RGLSYMGLGETCONVOLUTIONPARAMETERIVPROC __rglgen_glGetConvolutionParameteriv; +extern RGLSYMGLGETSEPARABLEFILTERPROC __rglgen_glGetSeparableFilter; +extern RGLSYMGLSEPARABLEFILTER2DPROC __rglgen_glSeparableFilter2D; +extern RGLSYMGLGETHISTOGRAMPROC __rglgen_glGetHistogram; +extern RGLSYMGLGETHISTOGRAMPARAMETERFVPROC __rglgen_glGetHistogramParameterfv; +extern RGLSYMGLGETHISTOGRAMPARAMETERIVPROC __rglgen_glGetHistogramParameteriv; +extern RGLSYMGLGETMINMAXPROC __rglgen_glGetMinmax; +extern RGLSYMGLGETMINMAXPARAMETERFVPROC __rglgen_glGetMinmaxParameterfv; +extern RGLSYMGLGETMINMAXPARAMETERIVPROC __rglgen_glGetMinmaxParameteriv; +extern RGLSYMGLHISTOGRAMPROC __rglgen_glHistogram; +extern RGLSYMGLMINMAXPROC __rglgen_glMinmax; +extern RGLSYMGLRESETHISTOGRAMPROC __rglgen_glResetHistogram; +extern RGLSYMGLRESETMINMAXPROC __rglgen_glResetMinmax; +extern RGLSYMGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC __rglgen_glMultiDrawArraysIndirectCountARB; +extern RGLSYMGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC __rglgen_glMultiDrawElementsIndirectCountARB; +extern RGLSYMGLVERTEXATTRIBDIVISORARBPROC __rglgen_glVertexAttribDivisorARB; +extern RGLSYMGLCURRENTPALETTEMATRIXARBPROC __rglgen_glCurrentPaletteMatrixARB; +extern RGLSYMGLMATRIXINDEXUBVARBPROC __rglgen_glMatrixIndexubvARB; +extern RGLSYMGLMATRIXINDEXUSVARBPROC __rglgen_glMatrixIndexusvARB; +extern RGLSYMGLMATRIXINDEXUIVARBPROC __rglgen_glMatrixIndexuivARB; +extern RGLSYMGLMATRIXINDEXPOINTERARBPROC __rglgen_glMatrixIndexPointerARB; +extern RGLSYMGLSAMPLECOVERAGEARBPROC __rglgen_glSampleCoverageARB; +extern RGLSYMGLACTIVETEXTUREARBPROC __rglgen_glActiveTextureARB; +extern RGLSYMGLCLIENTACTIVETEXTUREARBPROC __rglgen_glClientActiveTextureARB; +extern RGLSYMGLMULTITEXCOORD1DARBPROC __rglgen_glMultiTexCoord1dARB; +extern RGLSYMGLMULTITEXCOORD1DVARBPROC __rglgen_glMultiTexCoord1dvARB; +extern RGLSYMGLMULTITEXCOORD1FARBPROC __rglgen_glMultiTexCoord1fARB; +extern RGLSYMGLMULTITEXCOORD1FVARBPROC __rglgen_glMultiTexCoord1fvARB; +extern RGLSYMGLMULTITEXCOORD1IARBPROC __rglgen_glMultiTexCoord1iARB; +extern RGLSYMGLMULTITEXCOORD1IVARBPROC __rglgen_glMultiTexCoord1ivARB; +extern RGLSYMGLMULTITEXCOORD1SARBPROC __rglgen_glMultiTexCoord1sARB; +extern RGLSYMGLMULTITEXCOORD1SVARBPROC __rglgen_glMultiTexCoord1svARB; +extern RGLSYMGLMULTITEXCOORD2DARBPROC __rglgen_glMultiTexCoord2dARB; +extern RGLSYMGLMULTITEXCOORD2DVARBPROC __rglgen_glMultiTexCoord2dvARB; +extern RGLSYMGLMULTITEXCOORD2FARBPROC __rglgen_glMultiTexCoord2fARB; +extern RGLSYMGLMULTITEXCOORD2FVARBPROC __rglgen_glMultiTexCoord2fvARB; +extern RGLSYMGLMULTITEXCOORD2IARBPROC __rglgen_glMultiTexCoord2iARB; +extern RGLSYMGLMULTITEXCOORD2IVARBPROC __rglgen_glMultiTexCoord2ivARB; +extern RGLSYMGLMULTITEXCOORD2SARBPROC __rglgen_glMultiTexCoord2sARB; +extern RGLSYMGLMULTITEXCOORD2SVARBPROC __rglgen_glMultiTexCoord2svARB; +extern RGLSYMGLMULTITEXCOORD3DARBPROC __rglgen_glMultiTexCoord3dARB; +extern RGLSYMGLMULTITEXCOORD3DVARBPROC __rglgen_glMultiTexCoord3dvARB; +extern RGLSYMGLMULTITEXCOORD3FARBPROC __rglgen_glMultiTexCoord3fARB; +extern RGLSYMGLMULTITEXCOORD3FVARBPROC __rglgen_glMultiTexCoord3fvARB; +extern RGLSYMGLMULTITEXCOORD3IARBPROC __rglgen_glMultiTexCoord3iARB; +extern RGLSYMGLMULTITEXCOORD3IVARBPROC __rglgen_glMultiTexCoord3ivARB; +extern RGLSYMGLMULTITEXCOORD3SARBPROC __rglgen_glMultiTexCoord3sARB; +extern RGLSYMGLMULTITEXCOORD3SVARBPROC __rglgen_glMultiTexCoord3svARB; +extern RGLSYMGLMULTITEXCOORD4DARBPROC __rglgen_glMultiTexCoord4dARB; +extern RGLSYMGLMULTITEXCOORD4DVARBPROC __rglgen_glMultiTexCoord4dvARB; +extern RGLSYMGLMULTITEXCOORD4FARBPROC __rglgen_glMultiTexCoord4fARB; +extern RGLSYMGLMULTITEXCOORD4FVARBPROC __rglgen_glMultiTexCoord4fvARB; +extern RGLSYMGLMULTITEXCOORD4IARBPROC __rglgen_glMultiTexCoord4iARB; +extern RGLSYMGLMULTITEXCOORD4IVARBPROC __rglgen_glMultiTexCoord4ivARB; +extern RGLSYMGLMULTITEXCOORD4SARBPROC __rglgen_glMultiTexCoord4sARB; +extern RGLSYMGLMULTITEXCOORD4SVARBPROC __rglgen_glMultiTexCoord4svARB; +extern RGLSYMGLGENQUERIESARBPROC __rglgen_glGenQueriesARB; +extern RGLSYMGLDELETEQUERIESARBPROC __rglgen_glDeleteQueriesARB; +extern RGLSYMGLISQUERYARBPROC __rglgen_glIsQueryARB; +extern RGLSYMGLBEGINQUERYARBPROC __rglgen_glBeginQueryARB; +extern RGLSYMGLENDQUERYARBPROC __rglgen_glEndQueryARB; +extern RGLSYMGLGETQUERYIVARBPROC __rglgen_glGetQueryivARB; +extern RGLSYMGLGETQUERYOBJECTIVARBPROC __rglgen_glGetQueryObjectivARB; +extern RGLSYMGLGETQUERYOBJECTUIVARBPROC __rglgen_glGetQueryObjectuivARB; +extern RGLSYMGLPOINTPARAMETERFARBPROC __rglgen_glPointParameterfARB; +extern RGLSYMGLPOINTPARAMETERFVARBPROC __rglgen_glPointParameterfvARB; +extern RGLSYMGLGETGRAPHICSRESETSTATUSARBPROC __rglgen_glGetGraphicsResetStatusARB; +extern RGLSYMGLGETNTEXIMAGEARBPROC __rglgen_glGetnTexImageARB; +extern RGLSYMGLREADNPIXELSARBPROC __rglgen_glReadnPixelsARB; +extern RGLSYMGLGETNCOMPRESSEDTEXIMAGEARBPROC __rglgen_glGetnCompressedTexImageARB; +extern RGLSYMGLGETNUNIFORMFVARBPROC __rglgen_glGetnUniformfvARB; +extern RGLSYMGLGETNUNIFORMIVARBPROC __rglgen_glGetnUniformivARB; +extern RGLSYMGLGETNUNIFORMUIVARBPROC __rglgen_glGetnUniformuivARB; +extern RGLSYMGLGETNUNIFORMDVARBPROC __rglgen_glGetnUniformdvARB; +extern RGLSYMGLGETNMAPDVARBPROC __rglgen_glGetnMapdvARB; +extern RGLSYMGLGETNMAPFVARBPROC __rglgen_glGetnMapfvARB; +extern RGLSYMGLGETNMAPIVARBPROC __rglgen_glGetnMapivARB; +extern RGLSYMGLGETNPIXELMAPFVARBPROC __rglgen_glGetnPixelMapfvARB; +extern RGLSYMGLGETNPIXELMAPUIVARBPROC __rglgen_glGetnPixelMapuivARB; +extern RGLSYMGLGETNPIXELMAPUSVARBPROC __rglgen_glGetnPixelMapusvARB; +extern RGLSYMGLGETNPOLYGONSTIPPLEARBPROC __rglgen_glGetnPolygonStippleARB; +extern RGLSYMGLGETNCOLORTABLEARBPROC __rglgen_glGetnColorTableARB; +extern RGLSYMGLGETNCONVOLUTIONFILTERARBPROC __rglgen_glGetnConvolutionFilterARB; +extern RGLSYMGLGETNSEPARABLEFILTERARBPROC __rglgen_glGetnSeparableFilterARB; +extern RGLSYMGLGETNHISTOGRAMARBPROC __rglgen_glGetnHistogramARB; +extern RGLSYMGLGETNMINMAXARBPROC __rglgen_glGetnMinmaxARB; +extern RGLSYMGLMINSAMPLESHADINGARBPROC __rglgen_glMinSampleShadingARB; +extern RGLSYMGLDELETEOBJECTARBPROC __rglgen_glDeleteObjectARB; +extern RGLSYMGLGETHANDLEARBPROC __rglgen_glGetHandleARB; +extern RGLSYMGLDETACHOBJECTARBPROC __rglgen_glDetachObjectARB; +extern RGLSYMGLCREATESHADEROBJECTARBPROC __rglgen_glCreateShaderObjectARB; +extern RGLSYMGLSHADERSOURCEARBPROC __rglgen_glShaderSourceARB; +extern RGLSYMGLCOMPILESHADERARBPROC __rglgen_glCompileShaderARB; +extern RGLSYMGLCREATEPROGRAMOBJECTARBPROC __rglgen_glCreateProgramObjectARB; +extern RGLSYMGLATTACHOBJECTARBPROC __rglgen_glAttachObjectARB; +extern RGLSYMGLLINKPROGRAMARBPROC __rglgen_glLinkProgramARB; +extern RGLSYMGLUSEPROGRAMOBJECTARBPROC __rglgen_glUseProgramObjectARB; +extern RGLSYMGLVALIDATEPROGRAMARBPROC __rglgen_glValidateProgramARB; +extern RGLSYMGLUNIFORM1FARBPROC __rglgen_glUniform1fARB; +extern RGLSYMGLUNIFORM2FARBPROC __rglgen_glUniform2fARB; +extern RGLSYMGLUNIFORM3FARBPROC __rglgen_glUniform3fARB; +extern RGLSYMGLUNIFORM4FARBPROC __rglgen_glUniform4fARB; +extern RGLSYMGLUNIFORM1IARBPROC __rglgen_glUniform1iARB; +extern RGLSYMGLUNIFORM2IARBPROC __rglgen_glUniform2iARB; +extern RGLSYMGLUNIFORM3IARBPROC __rglgen_glUniform3iARB; +extern RGLSYMGLUNIFORM4IARBPROC __rglgen_glUniform4iARB; +extern RGLSYMGLUNIFORM1FVARBPROC __rglgen_glUniform1fvARB; +extern RGLSYMGLUNIFORM2FVARBPROC __rglgen_glUniform2fvARB; +extern RGLSYMGLUNIFORM3FVARBPROC __rglgen_glUniform3fvARB; +extern RGLSYMGLUNIFORM4FVARBPROC __rglgen_glUniform4fvARB; +extern RGLSYMGLUNIFORM1IVARBPROC __rglgen_glUniform1ivARB; +extern RGLSYMGLUNIFORM2IVARBPROC __rglgen_glUniform2ivARB; +extern RGLSYMGLUNIFORM3IVARBPROC __rglgen_glUniform3ivARB; +extern RGLSYMGLUNIFORM4IVARBPROC __rglgen_glUniform4ivARB; +extern RGLSYMGLUNIFORMMATRIX2FVARBPROC __rglgen_glUniformMatrix2fvARB; +extern RGLSYMGLUNIFORMMATRIX3FVARBPROC __rglgen_glUniformMatrix3fvARB; +extern RGLSYMGLUNIFORMMATRIX4FVARBPROC __rglgen_glUniformMatrix4fvARB; +extern RGLSYMGLGETOBJECTPARAMETERFVARBPROC __rglgen_glGetObjectParameterfvARB; +extern RGLSYMGLGETOBJECTPARAMETERIVARBPROC __rglgen_glGetObjectParameterivARB; +extern RGLSYMGLGETINFOLOGARBPROC __rglgen_glGetInfoLogARB; +extern RGLSYMGLGETATTACHEDOBJECTSARBPROC __rglgen_glGetAttachedObjectsARB; +extern RGLSYMGLGETUNIFORMLOCATIONARBPROC __rglgen_glGetUniformLocationARB; +extern RGLSYMGLGETACTIVEUNIFORMARBPROC __rglgen_glGetActiveUniformARB; +extern RGLSYMGLGETUNIFORMFVARBPROC __rglgen_glGetUniformfvARB; +extern RGLSYMGLGETUNIFORMIVARBPROC __rglgen_glGetUniformivARB; +extern RGLSYMGLGETSHADERSOURCEARBPROC __rglgen_glGetShaderSourceARB; +extern RGLSYMGLNAMEDSTRINGARBPROC __rglgen_glNamedStringARB; +extern RGLSYMGLDELETENAMEDSTRINGARBPROC __rglgen_glDeleteNamedStringARB; +extern RGLSYMGLCOMPILESHADERINCLUDEARBPROC __rglgen_glCompileShaderIncludeARB; +extern RGLSYMGLISNAMEDSTRINGARBPROC __rglgen_glIsNamedStringARB; +extern RGLSYMGLGETNAMEDSTRINGARBPROC __rglgen_glGetNamedStringARB; +extern RGLSYMGLGETNAMEDSTRINGIVARBPROC __rglgen_glGetNamedStringivARB; +extern RGLSYMGLTEXPAGECOMMITMENTARBPROC __rglgen_glTexPageCommitmentARB; +extern RGLSYMGLTEXBUFFERARBPROC __rglgen_glTexBufferARB; +extern RGLSYMGLCOMPRESSEDTEXIMAGE3DARBPROC __rglgen_glCompressedTexImage3DARB; +extern RGLSYMGLCOMPRESSEDTEXIMAGE2DARBPROC __rglgen_glCompressedTexImage2DARB; +extern RGLSYMGLCOMPRESSEDTEXIMAGE1DARBPROC __rglgen_glCompressedTexImage1DARB; +extern RGLSYMGLCOMPRESSEDTEXSUBIMAGE3DARBPROC __rglgen_glCompressedTexSubImage3DARB; +extern RGLSYMGLCOMPRESSEDTEXSUBIMAGE2DARBPROC __rglgen_glCompressedTexSubImage2DARB; +extern RGLSYMGLCOMPRESSEDTEXSUBIMAGE1DARBPROC __rglgen_glCompressedTexSubImage1DARB; +extern RGLSYMGLGETCOMPRESSEDTEXIMAGEARBPROC __rglgen_glGetCompressedTexImageARB; +extern RGLSYMGLLOADTRANSPOSEMATRIXFARBPROC __rglgen_glLoadTransposeMatrixfARB; +extern RGLSYMGLLOADTRANSPOSEMATRIXDARBPROC __rglgen_glLoadTransposeMatrixdARB; +extern RGLSYMGLMULTTRANSPOSEMATRIXFARBPROC __rglgen_glMultTransposeMatrixfARB; +extern RGLSYMGLMULTTRANSPOSEMATRIXDARBPROC __rglgen_glMultTransposeMatrixdARB; +extern RGLSYMGLWEIGHTBVARBPROC __rglgen_glWeightbvARB; +extern RGLSYMGLWEIGHTSVARBPROC __rglgen_glWeightsvARB; +extern RGLSYMGLWEIGHTIVARBPROC __rglgen_glWeightivARB; +extern RGLSYMGLWEIGHTFVARBPROC __rglgen_glWeightfvARB; +extern RGLSYMGLWEIGHTDVARBPROC __rglgen_glWeightdvARB; +extern RGLSYMGLWEIGHTUBVARBPROC __rglgen_glWeightubvARB; +extern RGLSYMGLWEIGHTUSVARBPROC __rglgen_glWeightusvARB; +extern RGLSYMGLWEIGHTUIVARBPROC __rglgen_glWeightuivARB; +extern RGLSYMGLWEIGHTPOINTERARBPROC __rglgen_glWeightPointerARB; +extern RGLSYMGLVERTEXBLENDARBPROC __rglgen_glVertexBlendARB; +extern RGLSYMGLBINDBUFFERARBPROC __rglgen_glBindBufferARB; +extern RGLSYMGLDELETEBUFFERSARBPROC __rglgen_glDeleteBuffersARB; +extern RGLSYMGLGENBUFFERSARBPROC __rglgen_glGenBuffersARB; +extern RGLSYMGLISBUFFERARBPROC __rglgen_glIsBufferARB; +extern RGLSYMGLBUFFERDATAARBPROC __rglgen_glBufferDataARB; +extern RGLSYMGLBUFFERSUBDATAARBPROC __rglgen_glBufferSubDataARB; +extern RGLSYMGLGETBUFFERSUBDATAARBPROC __rglgen_glGetBufferSubDataARB; +extern RGLSYMGLMAPBUFFERARBPROC __rglgen_glMapBufferARB; +extern RGLSYMGLUNMAPBUFFERARBPROC __rglgen_glUnmapBufferARB; +extern RGLSYMGLGETBUFFERPARAMETERIVARBPROC __rglgen_glGetBufferParameterivARB; +extern RGLSYMGLGETBUFFERPOINTERVARBPROC __rglgen_glGetBufferPointervARB; +extern RGLSYMGLVERTEXATTRIB1DARBPROC __rglgen_glVertexAttrib1dARB; +extern RGLSYMGLVERTEXATTRIB1DVARBPROC __rglgen_glVertexAttrib1dvARB; +extern RGLSYMGLVERTEXATTRIB1FARBPROC __rglgen_glVertexAttrib1fARB; +extern RGLSYMGLVERTEXATTRIB1FVARBPROC __rglgen_glVertexAttrib1fvARB; +extern RGLSYMGLVERTEXATTRIB1SARBPROC __rglgen_glVertexAttrib1sARB; +extern RGLSYMGLVERTEXATTRIB1SVARBPROC __rglgen_glVertexAttrib1svARB; +extern RGLSYMGLVERTEXATTRIB2DARBPROC __rglgen_glVertexAttrib2dARB; +extern RGLSYMGLVERTEXATTRIB2DVARBPROC __rglgen_glVertexAttrib2dvARB; +extern RGLSYMGLVERTEXATTRIB2FARBPROC __rglgen_glVertexAttrib2fARB; +extern RGLSYMGLVERTEXATTRIB2FVARBPROC __rglgen_glVertexAttrib2fvARB; +extern RGLSYMGLVERTEXATTRIB2SARBPROC __rglgen_glVertexAttrib2sARB; +extern RGLSYMGLVERTEXATTRIB2SVARBPROC __rglgen_glVertexAttrib2svARB; +extern RGLSYMGLVERTEXATTRIB3DARBPROC __rglgen_glVertexAttrib3dARB; +extern RGLSYMGLVERTEXATTRIB3DVARBPROC __rglgen_glVertexAttrib3dvARB; +extern RGLSYMGLVERTEXATTRIB3FARBPROC __rglgen_glVertexAttrib3fARB; +extern RGLSYMGLVERTEXATTRIB3FVARBPROC __rglgen_glVertexAttrib3fvARB; +extern RGLSYMGLVERTEXATTRIB3SARBPROC __rglgen_glVertexAttrib3sARB; +extern RGLSYMGLVERTEXATTRIB3SVARBPROC __rglgen_glVertexAttrib3svARB; +extern RGLSYMGLVERTEXATTRIB4NBVARBPROC __rglgen_glVertexAttrib4NbvARB; +extern RGLSYMGLVERTEXATTRIB4NIVARBPROC __rglgen_glVertexAttrib4NivARB; +extern RGLSYMGLVERTEXATTRIB4NSVARBPROC __rglgen_glVertexAttrib4NsvARB; +extern RGLSYMGLVERTEXATTRIB4NUBARBPROC __rglgen_glVertexAttrib4NubARB; +extern RGLSYMGLVERTEXATTRIB4NUBVARBPROC __rglgen_glVertexAttrib4NubvARB; +extern RGLSYMGLVERTEXATTRIB4NUIVARBPROC __rglgen_glVertexAttrib4NuivARB; +extern RGLSYMGLVERTEXATTRIB4NUSVARBPROC __rglgen_glVertexAttrib4NusvARB; +extern RGLSYMGLVERTEXATTRIB4BVARBPROC __rglgen_glVertexAttrib4bvARB; +extern RGLSYMGLVERTEXATTRIB4DARBPROC __rglgen_glVertexAttrib4dARB; +extern RGLSYMGLVERTEXATTRIB4DVARBPROC __rglgen_glVertexAttrib4dvARB; +extern RGLSYMGLVERTEXATTRIB4FARBPROC __rglgen_glVertexAttrib4fARB; +extern RGLSYMGLVERTEXATTRIB4FVARBPROC __rglgen_glVertexAttrib4fvARB; +extern RGLSYMGLVERTEXATTRIB4IVARBPROC __rglgen_glVertexAttrib4ivARB; +extern RGLSYMGLVERTEXATTRIB4SARBPROC __rglgen_glVertexAttrib4sARB; +extern RGLSYMGLVERTEXATTRIB4SVARBPROC __rglgen_glVertexAttrib4svARB; +extern RGLSYMGLVERTEXATTRIB4UBVARBPROC __rglgen_glVertexAttrib4ubvARB; +extern RGLSYMGLVERTEXATTRIB4UIVARBPROC __rglgen_glVertexAttrib4uivARB; +extern RGLSYMGLVERTEXATTRIB4USVARBPROC __rglgen_glVertexAttrib4usvARB; +extern RGLSYMGLVERTEXATTRIBPOINTERARBPROC __rglgen_glVertexAttribPointerARB; +extern RGLSYMGLENABLEVERTEXATTRIBARRAYARBPROC __rglgen_glEnableVertexAttribArrayARB; +extern RGLSYMGLDISABLEVERTEXATTRIBARRAYARBPROC __rglgen_glDisableVertexAttribArrayARB; +extern RGLSYMGLGETVERTEXATTRIBDVARBPROC __rglgen_glGetVertexAttribdvARB; +extern RGLSYMGLGETVERTEXATTRIBFVARBPROC __rglgen_glGetVertexAttribfvARB; +extern RGLSYMGLGETVERTEXATTRIBIVARBPROC __rglgen_glGetVertexAttribivARB; +extern RGLSYMGLGETVERTEXATTRIBPOINTERVARBPROC __rglgen_glGetVertexAttribPointervARB; +extern RGLSYMGLBINDATTRIBLOCATIONARBPROC __rglgen_glBindAttribLocationARB; +extern RGLSYMGLGETACTIVEATTRIBARBPROC __rglgen_glGetActiveAttribARB; +extern RGLSYMGLGETATTRIBLOCATIONARBPROC __rglgen_glGetAttribLocationARB; +extern RGLSYMGLWINDOWPOS2DARBPROC __rglgen_glWindowPos2dARB; +extern RGLSYMGLWINDOWPOS2DVARBPROC __rglgen_glWindowPos2dvARB; +extern RGLSYMGLWINDOWPOS2FARBPROC __rglgen_glWindowPos2fARB; +extern RGLSYMGLWINDOWPOS2FVARBPROC __rglgen_glWindowPos2fvARB; +extern RGLSYMGLWINDOWPOS2IARBPROC __rglgen_glWindowPos2iARB; +extern RGLSYMGLWINDOWPOS2IVARBPROC __rglgen_glWindowPos2ivARB; +extern RGLSYMGLWINDOWPOS2SARBPROC __rglgen_glWindowPos2sARB; +extern RGLSYMGLWINDOWPOS2SVARBPROC __rglgen_glWindowPos2svARB; +extern RGLSYMGLWINDOWPOS3DARBPROC __rglgen_glWindowPos3dARB; +extern RGLSYMGLWINDOWPOS3DVARBPROC __rglgen_glWindowPos3dvARB; +extern RGLSYMGLWINDOWPOS3FARBPROC __rglgen_glWindowPos3fARB; +extern RGLSYMGLWINDOWPOS3FVARBPROC __rglgen_glWindowPos3fvARB; +extern RGLSYMGLWINDOWPOS3IARBPROC __rglgen_glWindowPos3iARB; +extern RGLSYMGLWINDOWPOS3IVARBPROC __rglgen_glWindowPos3ivARB; +extern RGLSYMGLWINDOWPOS3SARBPROC __rglgen_glWindowPos3sARB; +extern RGLSYMGLWINDOWPOS3SVARBPROC __rglgen_glWindowPos3svARB; +extern RGLSYMGLMULTITEXCOORD1BOESPROC __rglgen_glMultiTexCoord1bOES; +extern RGLSYMGLMULTITEXCOORD1BVOESPROC __rglgen_glMultiTexCoord1bvOES; +extern RGLSYMGLMULTITEXCOORD2BOESPROC __rglgen_glMultiTexCoord2bOES; +extern RGLSYMGLMULTITEXCOORD2BVOESPROC __rglgen_glMultiTexCoord2bvOES; +extern RGLSYMGLMULTITEXCOORD3BOESPROC __rglgen_glMultiTexCoord3bOES; +extern RGLSYMGLMULTITEXCOORD3BVOESPROC __rglgen_glMultiTexCoord3bvOES; +extern RGLSYMGLMULTITEXCOORD4BOESPROC __rglgen_glMultiTexCoord4bOES; +extern RGLSYMGLMULTITEXCOORD4BVOESPROC __rglgen_glMultiTexCoord4bvOES; +extern RGLSYMGLTEXCOORD1BOESPROC __rglgen_glTexCoord1bOES; +extern RGLSYMGLTEXCOORD1BVOESPROC __rglgen_glTexCoord1bvOES; +extern RGLSYMGLTEXCOORD2BOESPROC __rglgen_glTexCoord2bOES; +extern RGLSYMGLTEXCOORD2BVOESPROC __rglgen_glTexCoord2bvOES; +extern RGLSYMGLTEXCOORD3BOESPROC __rglgen_glTexCoord3bOES; +extern RGLSYMGLTEXCOORD3BVOESPROC __rglgen_glTexCoord3bvOES; +extern RGLSYMGLTEXCOORD4BOESPROC __rglgen_glTexCoord4bOES; +extern RGLSYMGLTEXCOORD4BVOESPROC __rglgen_glTexCoord4bvOES; +extern RGLSYMGLVERTEX2BOESPROC __rglgen_glVertex2bOES; +extern RGLSYMGLVERTEX2BVOESPROC __rglgen_glVertex2bvOES; +extern RGLSYMGLVERTEX3BOESPROC __rglgen_glVertex3bOES; +extern RGLSYMGLVERTEX3BVOESPROC __rglgen_glVertex3bvOES; +extern RGLSYMGLVERTEX4BOESPROC __rglgen_glVertex4bOES; +extern RGLSYMGLVERTEX4BVOESPROC __rglgen_glVertex4bvOES; +extern RGLSYMGLALPHAFUNCXOESPROC __rglgen_glAlphaFuncxOES; +extern RGLSYMGLCLEARCOLORXOESPROC __rglgen_glClearColorxOES; +extern RGLSYMGLCLEARDEPTHXOESPROC __rglgen_glClearDepthxOES; +extern RGLSYMGLCLIPPLANEXOESPROC __rglgen_glClipPlanexOES; +extern RGLSYMGLCOLOR4XOESPROC __rglgen_glColor4xOES; +extern RGLSYMGLDEPTHRANGEXOESPROC __rglgen_glDepthRangexOES; +extern RGLSYMGLFOGXOESPROC __rglgen_glFogxOES; +extern RGLSYMGLFOGXVOESPROC __rglgen_glFogxvOES; +extern RGLSYMGLFRUSTUMXOESPROC __rglgen_glFrustumxOES; +extern RGLSYMGLGETCLIPPLANEXOESPROC __rglgen_glGetClipPlanexOES; +extern RGLSYMGLGETFIXEDVOESPROC __rglgen_glGetFixedvOES; +extern RGLSYMGLGETTEXENVXVOESPROC __rglgen_glGetTexEnvxvOES; +extern RGLSYMGLGETTEXPARAMETERXVOESPROC __rglgen_glGetTexParameterxvOES; +extern RGLSYMGLLIGHTMODELXOESPROC __rglgen_glLightModelxOES; +extern RGLSYMGLLIGHTMODELXVOESPROC __rglgen_glLightModelxvOES; +extern RGLSYMGLLIGHTXOESPROC __rglgen_glLightxOES; +extern RGLSYMGLLIGHTXVOESPROC __rglgen_glLightxvOES; +extern RGLSYMGLLINEWIDTHXOESPROC __rglgen_glLineWidthxOES; +extern RGLSYMGLLOADMATRIXXOESPROC __rglgen_glLoadMatrixxOES; +extern RGLSYMGLMATERIALXOESPROC __rglgen_glMaterialxOES; +extern RGLSYMGLMATERIALXVOESPROC __rglgen_glMaterialxvOES; +extern RGLSYMGLMULTMATRIXXOESPROC __rglgen_glMultMatrixxOES; +extern RGLSYMGLMULTITEXCOORD4XOESPROC __rglgen_glMultiTexCoord4xOES; +extern RGLSYMGLNORMAL3XOESPROC __rglgen_glNormal3xOES; +extern RGLSYMGLORTHOXOESPROC __rglgen_glOrthoxOES; +extern RGLSYMGLPOINTPARAMETERXVOESPROC __rglgen_glPointParameterxvOES; +extern RGLSYMGLPOINTSIZEXOESPROC __rglgen_glPointSizexOES; +extern RGLSYMGLPOLYGONOFFSETXOESPROC __rglgen_glPolygonOffsetxOES; +extern RGLSYMGLROTATEXOESPROC __rglgen_glRotatexOES; +extern RGLSYMGLSAMPLECOVERAGEOESPROC __rglgen_glSampleCoverageOES; +extern RGLSYMGLSCALEXOESPROC __rglgen_glScalexOES; +extern RGLSYMGLTEXENVXOESPROC __rglgen_glTexEnvxOES; +extern RGLSYMGLTEXENVXVOESPROC __rglgen_glTexEnvxvOES; +extern RGLSYMGLTEXPARAMETERXOESPROC __rglgen_glTexParameterxOES; +extern RGLSYMGLTEXPARAMETERXVOESPROC __rglgen_glTexParameterxvOES; +extern RGLSYMGLTRANSLATEXOESPROC __rglgen_glTranslatexOES; +extern RGLSYMGLACCUMXOESPROC __rglgen_glAccumxOES; +extern RGLSYMGLBITMAPXOESPROC __rglgen_glBitmapxOES; +extern RGLSYMGLBLENDCOLORXOESPROC __rglgen_glBlendColorxOES; +extern RGLSYMGLCLEARACCUMXOESPROC __rglgen_glClearAccumxOES; +extern RGLSYMGLCOLOR3XOESPROC __rglgen_glColor3xOES; +extern RGLSYMGLCOLOR3XVOESPROC __rglgen_glColor3xvOES; +extern RGLSYMGLCOLOR4XVOESPROC __rglgen_glColor4xvOES; +extern RGLSYMGLCONVOLUTIONPARAMETERXOESPROC __rglgen_glConvolutionParameterxOES; +extern RGLSYMGLCONVOLUTIONPARAMETERXVOESPROC __rglgen_glConvolutionParameterxvOES; +extern RGLSYMGLEVALCOORD1XOESPROC __rglgen_glEvalCoord1xOES; +extern RGLSYMGLEVALCOORD1XVOESPROC __rglgen_glEvalCoord1xvOES; +extern RGLSYMGLEVALCOORD2XOESPROC __rglgen_glEvalCoord2xOES; +extern RGLSYMGLEVALCOORD2XVOESPROC __rglgen_glEvalCoord2xvOES; +extern RGLSYMGLFEEDBACKBUFFERXOESPROC __rglgen_glFeedbackBufferxOES; +extern RGLSYMGLGETCONVOLUTIONPARAMETERXVOESPROC __rglgen_glGetConvolutionParameterxvOES; +extern RGLSYMGLGETHISTOGRAMPARAMETERXVOESPROC __rglgen_glGetHistogramParameterxvOES; +extern RGLSYMGLGETLIGHTXOESPROC __rglgen_glGetLightxOES; +extern RGLSYMGLGETMAPXVOESPROC __rglgen_glGetMapxvOES; +extern RGLSYMGLGETMATERIALXOESPROC __rglgen_glGetMaterialxOES; +extern RGLSYMGLGETPIXELMAPXVPROC __rglgen_glGetPixelMapxv; +extern RGLSYMGLGETTEXGENXVOESPROC __rglgen_glGetTexGenxvOES; +extern RGLSYMGLGETTEXLEVELPARAMETERXVOESPROC __rglgen_glGetTexLevelParameterxvOES; +extern RGLSYMGLINDEXXOESPROC __rglgen_glIndexxOES; +extern RGLSYMGLINDEXXVOESPROC __rglgen_glIndexxvOES; +extern RGLSYMGLLOADTRANSPOSEMATRIXXOESPROC __rglgen_glLoadTransposeMatrixxOES; +extern RGLSYMGLMAP1XOESPROC __rglgen_glMap1xOES; +extern RGLSYMGLMAP2XOESPROC __rglgen_glMap2xOES; +extern RGLSYMGLMAPGRID1XOESPROC __rglgen_glMapGrid1xOES; +extern RGLSYMGLMAPGRID2XOESPROC __rglgen_glMapGrid2xOES; +extern RGLSYMGLMULTTRANSPOSEMATRIXXOESPROC __rglgen_glMultTransposeMatrixxOES; +extern RGLSYMGLMULTITEXCOORD1XOESPROC __rglgen_glMultiTexCoord1xOES; +extern RGLSYMGLMULTITEXCOORD1XVOESPROC __rglgen_glMultiTexCoord1xvOES; +extern RGLSYMGLMULTITEXCOORD2XOESPROC __rglgen_glMultiTexCoord2xOES; +extern RGLSYMGLMULTITEXCOORD2XVOESPROC __rglgen_glMultiTexCoord2xvOES; +extern RGLSYMGLMULTITEXCOORD3XOESPROC __rglgen_glMultiTexCoord3xOES; +extern RGLSYMGLMULTITEXCOORD3XVOESPROC __rglgen_glMultiTexCoord3xvOES; +extern RGLSYMGLMULTITEXCOORD4XVOESPROC __rglgen_glMultiTexCoord4xvOES; +extern RGLSYMGLNORMAL3XVOESPROC __rglgen_glNormal3xvOES; +extern RGLSYMGLPASSTHROUGHXOESPROC __rglgen_glPassThroughxOES; +extern RGLSYMGLPIXELMAPXPROC __rglgen_glPixelMapx; +extern RGLSYMGLPIXELSTOREXPROC __rglgen_glPixelStorex; +extern RGLSYMGLPIXELTRANSFERXOESPROC __rglgen_glPixelTransferxOES; +extern RGLSYMGLPIXELZOOMXOESPROC __rglgen_glPixelZoomxOES; +extern RGLSYMGLPRIORITIZETEXTURESXOESPROC __rglgen_glPrioritizeTexturesxOES; +extern RGLSYMGLRASTERPOS2XOESPROC __rglgen_glRasterPos2xOES; +extern RGLSYMGLRASTERPOS2XVOESPROC __rglgen_glRasterPos2xvOES; +extern RGLSYMGLRASTERPOS3XOESPROC __rglgen_glRasterPos3xOES; +extern RGLSYMGLRASTERPOS3XVOESPROC __rglgen_glRasterPos3xvOES; +extern RGLSYMGLRASTERPOS4XOESPROC __rglgen_glRasterPos4xOES; +extern RGLSYMGLRASTERPOS4XVOESPROC __rglgen_glRasterPos4xvOES; +extern RGLSYMGLRECTXOESPROC __rglgen_glRectxOES; +extern RGLSYMGLRECTXVOESPROC __rglgen_glRectxvOES; +extern RGLSYMGLTEXCOORD1XOESPROC __rglgen_glTexCoord1xOES; +extern RGLSYMGLTEXCOORD1XVOESPROC __rglgen_glTexCoord1xvOES; +extern RGLSYMGLTEXCOORD2XOESPROC __rglgen_glTexCoord2xOES; +extern RGLSYMGLTEXCOORD2XVOESPROC __rglgen_glTexCoord2xvOES; +extern RGLSYMGLTEXCOORD3XOESPROC __rglgen_glTexCoord3xOES; +extern RGLSYMGLTEXCOORD3XVOESPROC __rglgen_glTexCoord3xvOES; +extern RGLSYMGLTEXCOORD4XOESPROC __rglgen_glTexCoord4xOES; +extern RGLSYMGLTEXCOORD4XVOESPROC __rglgen_glTexCoord4xvOES; +extern RGLSYMGLTEXGENXOESPROC __rglgen_glTexGenxOES; +extern RGLSYMGLTEXGENXVOESPROC __rglgen_glTexGenxvOES; +extern RGLSYMGLVERTEX2XOESPROC __rglgen_glVertex2xOES; +extern RGLSYMGLVERTEX2XVOESPROC __rglgen_glVertex2xvOES; +extern RGLSYMGLVERTEX3XOESPROC __rglgen_glVertex3xOES; +extern RGLSYMGLVERTEX3XVOESPROC __rglgen_glVertex3xvOES; +extern RGLSYMGLVERTEX4XOESPROC __rglgen_glVertex4xOES; +extern RGLSYMGLVERTEX4XVOESPROC __rglgen_glVertex4xvOES; +extern RGLSYMGLQUERYMATRIXXOESPROC __rglgen_glQueryMatrixxOES; +extern RGLSYMGLCLEARDEPTHFOESPROC __rglgen_glClearDepthfOES; +extern RGLSYMGLCLIPPLANEFOESPROC __rglgen_glClipPlanefOES; +extern RGLSYMGLDEPTHRANGEFOESPROC __rglgen_glDepthRangefOES; +extern RGLSYMGLFRUSTUMFOESPROC __rglgen_glFrustumfOES; +extern RGLSYMGLGETCLIPPLANEFOESPROC __rglgen_glGetClipPlanefOES; +extern RGLSYMGLORTHOFOESPROC __rglgen_glOrthofOES; +extern RGLSYMGLIMAGETRANSFORMPARAMETERIHPPROC __rglgen_glImageTransformParameteriHP; +extern RGLSYMGLIMAGETRANSFORMPARAMETERFHPPROC __rglgen_glImageTransformParameterfHP; +extern RGLSYMGLIMAGETRANSFORMPARAMETERIVHPPROC __rglgen_glImageTransformParameterivHP; +extern RGLSYMGLIMAGETRANSFORMPARAMETERFVHPPROC __rglgen_glImageTransformParameterfvHP; +extern RGLSYMGLGETIMAGETRANSFORMPARAMETERIVHPPROC __rglgen_glGetImageTransformParameterivHP; +extern RGLSYMGLGETIMAGETRANSFORMPARAMETERFVHPPROC __rglgen_glGetImageTransformParameterfvHP; + +struct rglgen_sym_map { const char *sym; void *ptr; }; +extern const struct rglgen_sym_map rglgen_symbol_map[]; +#ifdef __cplusplus +} +#endif +#endif diff --git a/desmume/src/libretro-common/include/glsym/rglgen.h b/desmume/src/libretro-common/include/glsym/rglgen.h new file mode 100644 index 000000000..a528d3063 --- /dev/null +++ b/desmume/src/libretro-common/include/glsym/rglgen.h @@ -0,0 +1,49 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this libretro SDK code part (glsym). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef RGLGEN_H__ +#define RGLGEN_H__ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "rglgen_headers.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct rglgen_sym_map; + +typedef void (*rglgen_func_t)(void); +typedef rglgen_func_t (*rglgen_proc_address_t)(const char*); +void rglgen_resolve_symbols(rglgen_proc_address_t proc); +void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, + const struct rglgen_sym_map *map); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/glsym/rglgen_headers.h b/desmume/src/libretro-common/include/glsym/rglgen_headers.h new file mode 100644 index 000000000..46195ad65 --- /dev/null +++ b/desmume/src/libretro-common/include/glsym/rglgen_headers.h @@ -0,0 +1,80 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this libretro SDK code part (glsym). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef RGLGEN_HEADERS_H__ +#define RGLGEN_HEADERS_H__ + +#ifdef HAVE_EGL +#include +#include +#endif + +#if defined(IOS) + +#if defined(HAVE_OPENGLES3) +#include +#include +#else +#include +#include +#endif + +#elif defined(__APPLE__) +#include +#include +#elif defined(HAVE_PSGL) +#include +#include +#elif defined(HAVE_OPENGL_MODERN) +#include +#include +#elif defined(HAVE_OPENGLES3) +#include +#include /* There are no GLES3 extensions yet. */ +#elif defined(HAVE_OPENGLES2) +#include +#include +#elif defined(HAVE_OPENGLES1) +#include +#include +#else +#if defined(_WIN32) && !defined(_XBOX) +#define WIN32_LEAN_AND_MEAN +#include +#endif +#include +#include +#endif + +#ifndef GL_MAP_WRITE_BIT +#define GL_MAP_WRITE_BIT 0x0002 +#endif + +#ifndef GL_MAP_INVALIDATE_BUFFER_BIT +#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 +#endif + +#ifndef GL_RED_INTEGER +#define GL_RED_INTEGER 0x8D94 +#endif + +#endif diff --git a/desmume/src/libretro-common/include/libco.h b/desmume/src/libretro-common/include/libco.h new file mode 100644 index 000000000..23079de6c --- /dev/null +++ b/desmume/src/libretro-common/include/libco.h @@ -0,0 +1,81 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (libco.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef LIBCO_H +#define LIBCO_H + +#ifdef LIBCO_C + #ifdef LIBCO_MP + #define thread_local __thread + #else + #define thread_local + #endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* cothread_t; + +/** + * co_active: + * + * Gets the currently active context. + * + * Returns: active context. + **/ +cothread_t co_active(void); + +/** + * co_create: + * @int : stack size + * @funcptr : thread entry function callback + * + * Create a co_thread. + * + * Returns: cothread if successful, otherwise NULL. + */ +cothread_t co_create(unsigned int, void (*)(void)); + +/** + * co_delete: + * @cothread : cothread object + * + * Frees a co_thread. + */ +void co_delete(cothread_t cothread); + +/** + * co_switch: + * @cothread : cothread object to switch to + * + * Do a context switch to @cothread. + */ +void co_switch(cothread_t cothread); + +#ifdef __cplusplus +} +#endif + +/* ifndef LIBCO_H */ +#endif diff --git a/desmume/src/libretro-common/include/memalign.h b/desmume/src/libretro-common/include/memalign.h new file mode 100644 index 000000000..674f7d24f --- /dev/null +++ b/desmume/src/libretro-common/include/memalign.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (memalign.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _LIBRETRO_MEMALIGN_H +#define _LIBRETRO_MEMALIGN_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void *memalign_alloc(size_t boundary, size_t size); + +void memalign_free(void *ptr); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/desmume/src/libretro-common/include/memmap.h b/desmume/src/libretro-common/include/memmap.h new file mode 100644 index 000000000..94412a616 --- /dev/null +++ b/desmume/src/libretro-common/include/memmap.h @@ -0,0 +1,49 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (memmap.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef _LIBRETRO_MEMMAP_H +#define _LIBRETRO_MEMMAP_H + +#if defined(__CELLOS_LV2__) || defined(PSP) || defined(GEKKO) || defined(VITA) || defined(_XBOX) || defined(_3DS) +/* No mman available */ +#elif defined(_WIN32) && !defined(_XBOX) +#include +#include +#include +#else +#define HAVE_MMAN +#include +#endif + +#if !defined(HAVE_MMAN) || defined(_WIN32) +void* mmap(void *addr, size_t len, int mmap_prot, int mmap_flags, int fildes, size_t off); + +int munmap(void *addr, size_t len); + +int mprotect(void *addr, size_t len, int prot); +#endif + +int memsync(void *start, void *end); + +int memprotect(void *addr, size_t len); + +#endif diff --git a/desmume/src/libretro-common/include/net/net_compat.h b/desmume/src/libretro-common/include/net/net_compat.h new file mode 100644 index 000000000..dde91f3a5 --- /dev/null +++ b/desmume/src/libretro-common/include/net/net_compat.h @@ -0,0 +1,206 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef NETPLAY_COMPAT_H__ +#define NETPLAY_COMPAT_H__ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#if defined(_WIN32) && !defined(_XBOX) +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 +#endif + +#define WIN32_LEAN_AND_MEAN + +#include +#include +#include + +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + + +#elif defined(_XBOX) + +#define NOD3D +#include +#include + +#elif defined(GEKKO) + +#include + +#elif defined(VITA) + +#include +#include + +#define sockaddr_in SceNetSockaddrIn +#define sockaddr SceNetSockaddr +#define sendto sceNetSendto +#define MSG_DONTWAIT PSP2_NET_MSG_DONTWAIT + +#else +#include +#include +#include +#include + +#ifndef __PSL1GHT__ +#include +#endif + +#include +#include +#include + +#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) +#include +#include +#include +#include + +#ifndef EWOULDBLOCK +#define EWOULDBLOCK SYS_NET_EWOULDBLOCK +#endif + +#else +#include +#endif + +#endif + +#include + +#ifdef GEKKO +#define sendto(s, msg, len, flags, addr, tolen) net_sendto(s, msg, len, 0, addr, 8) +#define socket(domain, type, protocol) net_socket(domain, type, protocol) + +static INLINE int inet_pton(int af, const char *src, void *dst) +{ + if (af != AF_INET) + return -1; + + return inet_aton (src, dst); +} +#endif + +static INLINE bool isagain(int bytes) +{ +#if defined(_WIN32) + if (bytes != SOCKET_ERROR) + return false; + if (WSAGetLastError() != WSAEWOULDBLOCK) + return false; + return true; +#else + return (bytes < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)); +#endif +} + +#ifdef _XBOX +#define socklen_t int + +#ifndef h_addr +#define h_addr h_addr_list[0] /* for backward compatibility */ +#endif + +#ifndef SO_KEEPALIVE +#define SO_KEEPALIVE 0 /* verify if correct */ +#endif +#endif + +#ifndef MSG_NOSIGNAL +#define MSG_NOSIGNAL 0 +#endif + +#ifndef _WIN32 +#include +#include +#endif + +/* Compatibility layer for legacy or incomplete BSD socket implementations. + * Only for IPv4. Mostly useful for the consoles which do not support + * anything reasonably modern on the socket API side of things. */ + +#ifdef HAVE_SOCKET_LEGACY + +#define sockaddr_storage sockaddr_in +#define addrinfo addrinfo_rarch__ + +struct addrinfo +{ + int ai_flags; + int ai_family; + int ai_socktype; + int ai_protocol; + size_t ai_addrlen; + struct sockaddr *ai_addr; + char *ai_canonname; + struct addrinfo *ai_next; +}; + +#ifndef AI_PASSIVE +#define AI_PASSIVE 1 +#endif + +/* gai_strerror() not used, so we skip that. */ + +#endif + +int getaddrinfo_rarch(const char *node, const char *service, + const struct addrinfo *hints, + struct addrinfo **res); + +void freeaddrinfo_rarch(struct addrinfo *res); + +bool socket_nonblock(int fd); + +int socket_close(int fd); + +int socket_select(int nfds, fd_set *readfs, fd_set *writefds, + fd_set *errorfds, struct timeval *timeout); + +int socket_send_all_blocking(int fd, const void *data_, size_t size); + +int socket_receive_all_blocking(int fd, void *data_, size_t size); + +/** + * network_init: + * + * Platform specific socket library initialization. + * + * Returns: true (1) if successful, otherwise false (0). + **/ +bool network_init(void); + +/** + * network_deinit: + * + * Deinitialize platform specific socket libraries. + **/ +void network_deinit(void); + +#endif + diff --git a/desmume/src/libretro-common/include/net/net_http.h b/desmume/src/libretro-common/include/net/net_http.h new file mode 100644 index 000000000..b6b6b3a1e --- /dev/null +++ b/desmume/src/libretro-common/include/net/net_http.h @@ -0,0 +1,65 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2015 - Daniel De Matteis + * Copyright (C) 2014-2015 - Alfred Agrell + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef _NET_HTTP_H +#define _NET_HTTP_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct http_t; +struct http_connection_t; + +struct http_connection_t *net_http_connection_new(const char *url); + +bool net_http_connection_iterate(struct http_connection_t *conn); + +bool net_http_connection_done(struct http_connection_t *conn); + +void net_http_connection_free(struct http_connection_t *conn); + +struct http_t *net_http_new(struct http_connection_t *conn); + +/* You can use this to call net_http_update + * only when something will happen; select() it for reading. */ +int net_http_fd(struct http_t *state); + +/* Returns true if it's done, or if something broke. + * 'total' will be 0 if it's not known. */ +bool net_http_update(struct http_t *state, size_t* progress, size_t* total); + +/* 200, 404, or whatever. */ +int net_http_status(struct http_t *state); + +/* Returns the downloaded data. The returned buffer is owned by the + * HTTP handler; it's freed by net_http_delete. + * + * If the status is not 20x and accept_error is false, it returns NULL. */ +uint8_t* net_http_data(struct http_t *state, size_t* len, bool accept_error); + +/* Cleans up all memory. */ +void net_http_delete(struct http_t *state); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/desmume/src/libretro-common/include/queues/fifo_buffer.h b/desmume/src/libretro-common/include/queues/fifo_buffer.h new file mode 100644 index 000000000..3e57372ea --- /dev/null +++ b/desmume/src/libretro-common/include/queues/fifo_buffer.h @@ -0,0 +1,62 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (boolean.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_FIFO_BUFFER_H +#define __LIBRETRO_SDK_FIFO_BUFFER_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct fifo_buffer +{ + uint8_t *buffer; + size_t bufsize; + size_t first; + size_t end; +}; + +typedef struct fifo_buffer fifo_buffer_t; + +fifo_buffer_t *fifo_new(size_t size); + +void fifo_clear(fifo_buffer_t *buffer); + +void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size); + +void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t size); + +void fifo_free(fifo_buffer_t *buffer); + +size_t fifo_read_avail(fifo_buffer_t *buffer); + +size_t fifo_write_avail(fifo_buffer_t *buffer); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/queues/message_queue.h b/desmume/src/libretro-common/include/queues/message_queue.h new file mode 100644 index 000000000..560bb488e --- /dev/null +++ b/desmume/src/libretro-common/include/queues/message_queue.h @@ -0,0 +1,90 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (boolean.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_MSG_QUEUE_H +#define __LIBRETRO_SDK_MSG_QUEUE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct msg_queue msg_queue_t; + +/** + * msg_queue_new: + * @size : maximum size of message + * + * Creates a message queue with maximum size different messages. + * + * Returns: NULL if allocation error, pointer to a message queue + * if successful. Has to be freed manually. + **/ +msg_queue_t *msg_queue_new(size_t size); + +/** + * msg_queue_push: + * @queue : pointer to queue object + * @msg : message to add to the queue + * @prio : priority level of the message + * @duration : how many times the message can be pulled + * before it vanishes (E.g. show a message for + * 3 seconds @ 60fps = 180 duration). + * + * Push a new message onto the queue. + **/ +void msg_queue_push(msg_queue_t *queue, const char *msg, + unsigned prio, unsigned duration); + +/** + * msg_queue_pull: + * @queue : pointer to queue object + * + * Pulls highest priority message in queue. + * + * Returns: NULL if no message in queue, otherwise a string + * containing the message. + **/ +const char *msg_queue_pull(msg_queue_t *queue); + +/** + * msg_queue_clear: + * @queue : pointer to queue object + * + * Clears out everything in the queue. + **/ +void msg_queue_clear(msg_queue_t *queue); + +/** + * msg_queue_free: + * @queue : pointer to queue object + * + * Frees message queue.. + **/ +void msg_queue_free(msg_queue_t *queue); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/desmume/src/libretro-common/include/retro_assert.h b/desmume/src/libretro-common/include/retro_assert.h new file mode 100644 index 000000000..56996acd3 --- /dev/null +++ b/desmume/src/libretro-common/include/retro_assert.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_assert.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __RETRO_ASSERT_H +#define __RETRO_ASSERT_H + +#ifdef RARCH_INTERNAL +#include +#else +#include +#endif + +#ifdef RARCH_INTERNAL +#define rarch_assert(cond) do { \ + if (!(cond)) { RARCH_ERR("Assertion failed at %s:%d.\n", __FILE__, __LINE__); abort(); } \ +} while(0) +#else +#define rarch_assert(cond) assert(cond) +#endif + +#endif diff --git a/desmume/src/libretro-common/include/retro_dirent.h b/desmume/src/libretro-common/include/retro_dirent.h new file mode 100644 index 000000000..6ef801ed8 --- /dev/null +++ b/desmume/src/libretro-common/include/retro_dirent.h @@ -0,0 +1,61 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_dirent.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __RETRO_DIRENT_H +#define __RETRO_DIRENT_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct RDIR; + +struct RDIR *retro_opendir(const char *name); + +int retro_readdir(struct RDIR *rdir); + +bool retro_dirent_error(struct RDIR *rdir); + +const char *retro_dirent_get_name(struct RDIR *rdir); + +/** + * + * retro_dirent_is_dir: + * @rdir : pointer to the directory entry. + * @path : path to the directory entry. + * + * Is the directory listing entry a directory? + * + * Returns: true if directory listing entry is + * a directory, false if not. + */ +bool retro_dirent_is_dir(struct RDIR *rdir, const char *path); + +void retro_closedir(struct RDIR *rdir); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/desmume/src/libretro-common/include/retro_endianness.h b/desmume/src/libretro-common/include/retro_endianness.h new file mode 100644 index 000000000..74f29821c --- /dev/null +++ b/desmume/src/libretro-common/include/retro_endianness.h @@ -0,0 +1,205 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_endianness.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_ENDIANNESS_H +#define __LIBRETRO_SDK_ENDIANNESS_H + +#include +#include +#include + +#if defined(_MSC_VER) +#define SWAP16 _byteswap_ushort +#define SWAP32 _byteswap_ulong +#else +#define SWAP16(x) ((uint16_t)( \ + (((uint16_t)(x) & 0x00ff) << 8) | \ + (((uint16_t)(x) & 0xff00) >> 8) \ + )) +#define SWAP32(x) ((uint32_t)( \ + (((uint32_t)(x) & 0x000000ff) << 24) | \ + (((uint32_t)(x) & 0x0000ff00) << 8) | \ + (((uint32_t)(x) & 0x00ff0000) >> 8) | \ + (((uint32_t)(x) & 0xff000000) >> 24) \ + )) +#endif + +#define SWAP64(val) \ + ((((uint64_t)(val) & 0x00000000000000ffULL) << 56) \ + | (((uint64_t)(val) & 0x000000000000ff00ULL) << 40) \ + | (((uint64_t)(val) & 0x0000000000ff0000ULL) << 24) \ + | (((uint64_t)(val) & 0x00000000ff000000ULL) << 8) \ + | (((uint64_t)(val) & 0x000000ff00000000ULL) >> 8) \ + | (((uint64_t)(val) & 0x0000ff0000000000ULL) >> 24) \ + | (((uint64_t)(val) & 0x00ff000000000000ULL) >> 40) \ + | (((uint64_t)(val) & 0xff00000000000000ULL) >> 56)) + +/** + * is_little_endian: + * + * Checks if the system is little endian or big-endian. + * + * Returns: greater than 0 if little-endian, + * otherwise big-endian. + **/ +static INLINE uint8_t is_little_endian(void) +{ +#if defined(__x86_64) || defined(__i386) || defined(_M_IX86) || defined(_M_X64) + return 1; +#elif defined(MSB_FIRST) + return 0; +#else + union + { + uint16_t x; + uint8_t y[2]; + } u; + + u.x = 1; + return u.y[0]; +#endif +} + +/** + * swap_if_big64: + * @val : unsigned 64-bit value + * + * Byteswap unsigned 64-bit value if system is big-endian. + * + * Returns: Byteswapped value in case system is big-endian, + * otherwise returns same value. + **/ +static INLINE uint64_t swap_if_big64(uint64_t val) +{ + if (is_little_endian()) + return val; + return SWAP64(val); +} + +/** + * swap_if_big32: + * @val : unsigned 32-bit value + * + * Byteswap unsigned 32-bit value if system is big-endian. + * + * Returns: Byteswapped value in case system is big-endian, + * otherwise returns same value. + **/ +static INLINE uint32_t swap_if_big32(uint32_t val) +{ + if (is_little_endian()) + return val; + return SWAP32(val); +} + +/** + * swap_if_little64: + * @val : unsigned 64-bit value + * + * Byteswap unsigned 64-bit value if system is little-endian. + * + * Returns: Byteswapped value in case system is little-endian, + * otherwise returns same value. + **/ +static INLINE uint64_t swap_if_little64(uint64_t val) +{ + if (is_little_endian()) + return SWAP64(val); + return val; +} + +/** + * swap_if_little32: + * @val : unsigned 32-bit value + * + * Byteswap unsigned 32-bit value if system is little-endian. + * + * Returns: Byteswapped value in case system is little-endian, + * otherwise returns same value. + **/ +static INLINE uint32_t swap_if_little32(uint32_t val) +{ + if (is_little_endian()) + return SWAP32(val); + return val; +} + +/** + * swap_if_big16: + * @val : unsigned 16-bit value + * + * Byteswap unsigned 16-bit value if system is big-endian. + * + * Returns: Byteswapped value in case system is big-endian, + * otherwise returns same value. + **/ +static INLINE uint16_t swap_if_big16(uint16_t val) +{ + if (is_little_endian()) + return val; + return SWAP16(val); +} + + +/** + * swap_if_little16: + * @val : unsigned 16-bit value + * + * Byteswap unsigned 16-bit value if system is little-endian. + * + * Returns: Byteswapped value in case system is little-endian, + * otherwise returns same value. + **/ +static INLINE uint16_t swap_if_little16(uint16_t val) +{ + if (is_little_endian()) + return SWAP16(val); + return val; +} + +/** + * store32be: + * @addr : pointer to unsigned 32-bit buffer + * @data : unsigned 32-bit value to write + * + * Write data to address. Endian-safe. Byteswaps the data + * first if necessary before storing it. + **/ +static INLINE void store32be(uint32_t *addr, uint32_t data) +{ + *addr = swap_if_little32(data); +} + +/** + * load32be: + * @addr : pointer to unsigned 32-bit buffer + * + * Load value from address. Endian-safe. + * + * Returns: value from address, byte-swapped if necessary. + **/ +static INLINE uint32_t load32be(const uint32_t *addr) +{ + return swap_if_little32(*addr); +} + +#endif diff --git a/desmume/src/libretro-common/include/retro_environment.h b/desmume/src/libretro-common/include/retro_environment.h new file mode 100644 index 000000000..b4c89d0a7 --- /dev/null +++ b/desmume/src/libretro-common/include/retro_environment.h @@ -0,0 +1,68 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_environment.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_ENVIRONMENT_H +#define __LIBRETRO_SDK_ENVIRONMENT_H + +#if defined (__cplusplus) +#if 0 +printf("This is C++, version %d.\n", __cplusplus); +#endif +/* The expected values would be + * 199711L, for ISO/IEC 14882:1998 or 14882:2003 + */ + +#elif defined(__STDC__) +/* This is standard C. */ + +#if (__STDC__ == 1) +/* The implementation is ISO-conforming. */ +#define __STDC_ISO__ +#else +/* The implementation is not ISO-conforming. */ +#endif + +#if defined(__STDC_VERSION__) +#if (__STDC_VERSION__ >= 201112L) +/* This is C11. */ +#define __STDC_C11__ +#elif (__STDC_VERSION__ >= 199901L) +/* This is C99. */ +#define __STDC_C99__ +#elif (__STDC_VERSION__ >= 199409L) +/* This is C89 with amendment 1. */ +#define __STDC_C89__ +#define __STDC_C89_AMENDMENT_1__ +#else +/* This is C89 without amendment 1. */ +#define __STDC_C89__ +#endif +#else /* !defined(__STDC_VERSION__) */ +/* This is C89. __STDC_VERSION__ is not defined. */ +#define __STDC_C89__ +#endif + +#else /* !defined(__STDC__) */ +/* This is not standard C. __STDC__ is not defined. */ +#endif + +#endif diff --git a/desmume/src/libretro-common/include/retro_file.h b/desmume/src/libretro-common/include/retro_file.h new file mode 100644 index 000000000..e331305d1 --- /dev/null +++ b/desmume/src/libretro-common/include/retro_file.h @@ -0,0 +1,74 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_file.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __RETRO_FILE_H +#define __RETRO_FILE_H + +#include +#include + +#include + +#ifdef _MSC_VER +#include +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct RFILE RFILE; + +enum +{ + RFILE_MODE_READ = 0, + RFILE_MODE_WRITE, + RFILE_MODE_READ_WRITE +}; + +RFILE *retro_fopen(const char *path, unsigned mode, ssize_t len); + +ssize_t retro_fseek(RFILE *stream, ssize_t offset, int whence); + +ssize_t retro_fread(RFILE *stream, void *s, size_t len); + +ssize_t retro_fwrite(RFILE *stream, const void *s, size_t len); + +ssize_t retro_ftell(RFILE *stream); + +void retro_frewind(RFILE *stream); + +int retro_fclose(RFILE *stream); + +int retro_read_file(const char *path, void **buf, ssize_t *len); + +bool retro_write_file(const char *path, const void *data, ssize_t size); + +int retro_get_fd(RFILE *stream); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/desmume/src/libretro-common/include/retro_inline.h b/desmume/src/libretro-common/include/retro_inline.h new file mode 100644 index 000000000..8535d8480 --- /dev/null +++ b/desmume/src/libretro-common/include/retro_inline.h @@ -0,0 +1,39 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_inline.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_INLINE_H +#define __LIBRETRO_SDK_INLINE_H + +#ifndef INLINE + +#if !defined(__cplusplus) && defined(_WIN32) +#define INLINE _inline +#elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L +#define INLINE inline +#elif defined(__GNUC__) +#define INLINE __inline__ +#else +#define INLINE +#endif + +#endif +#endif diff --git a/desmume/src/libretro-common/include/retro_log.h b/desmume/src/libretro-common/include/retro_log.h new file mode 100644 index 000000000..26454df5d --- /dev/null +++ b/desmume/src/libretro-common/include/retro_log.h @@ -0,0 +1,278 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2010-2014 - Hans-Kristian Arntzen + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch is free software: you can redistribute it and/or modify it under the terms + * of the GNU General Public License as published by the Free Software Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with RetroArch. + * If not, see . + */ + +#ifndef __RARCH_LOGGER_H +#define __RARCH_LOGGER_H + +#ifdef _XBOX1 +#include +#endif +#include +#include + +#ifdef __MACH__ +#include +#if TARGET_IPHONE_SIMULATOR +#include +#else +#include +#endif +#endif + +#ifdef ANDROID +#include +#endif + +#include +#include +#include +#include + +#if defined(HAVE_FILE_LOGGER) && defined(RARCH_INTERNAL) && !defined(IS_JOYCONFIG) + +#ifdef __cplusplus +extern "C" +#endif + +FILE *rarch_main_log_file(void); + +#define LOG_FILE (rarch_main_log_file()) + +#else +#define LOG_FILE (stderr) +#endif + +#if defined(IS_SALAMANDER) +#define PROGRAM_NAME "RetroArch Salamander" +#elif defined(RARCH_INTERNAL) +#define PROGRAM_NAME "RetroArch" +#elif defined(MARCH_INTERNAL) +#define PROGRAM_NAME "MicroArch" +#else +#define PROGRAM_NAME "N/A" +#endif + +#if defined(RARCH_INTERNAL) && !defined(ANDROID) + +#ifdef __cplusplus +extern "C" { +#endif +bool rarch_main_verbosity(void); + +#ifdef __cplusplus +} +#endif + +#define RARCH_LOG_VERBOSE (rarch_main_verbosity()) +#else +#define RARCH_LOG_VERBOSE (true) +#endif + +#if TARGET_OS_IPHONE && defined(RARCH_INTERNAL) && !TARGET_IPHONE_SIMULATOR +static aslclient asl_client; +static int asl_inited = 0; +#endif + +#if defined(HAVE_LOGGER) && defined(RARCH_INTERNAL) + +#define BUFSIZE (64 * 1024) +#define TCPDUMP_STACKSIZE (16 * 1024) +#define TCPDUMP_PRIO (2048) + +void logger_init (void); +void logger_shutdown (void); +void logger_send (const char *__format,...); +void logger_send_v(const char *__format, va_list args); + +#ifdef IS_SALAMANDER + +#define RARCH_LOG(...) do { \ + logger_send("RetroArch Salamander: " __VA_ARGS__); \ +} while(0) + +#define RARCH_LOG_V(tag, fmt, vp) do { \ + logger_send("RetroArch Salamander: " tag); \ + logger_send_v(fmt, vp); \ +} while (0) + +#define RARCH_LOG_OUTPUT(...) do { \ + logger_send("RetroArch Salamander [OUTPUT] :: " __VA_ARGS__); \ +} while(0) + +#define RARCH_LOG_OUTPUT_V(tag, fmt, vp) do { \ + logger_send("RetroArch Salamander [OUTPUT] :: " tag); \ + logger_send_v(fmt, vp); \ +} while (0) + +#define RARCH_ERR(...) do { \ + logger_send("RetroArch Salamander [ERROR] :: " __VA_ARGS__); \ +} while(0) + +#define RARCH_ERR_V(tag, fmt, vp) do { \ + logger_send("RetroArch Salamander [ERROR] :: " tag); \ + logger_send_v(fmt, vp); \ +} while (0) + +#define RARCH_WARN(...) do { \ + logger_send("RetroArch Salamander [WARN] :: " __VA_ARGS__); \ +} while(0) + +#define RARCH_WARN_V(tag, fmt, vp) do { \ + logger_send("RetroArch Salamander [WARN] :: " tag); \ + logger_send_v(fmt, vp); \ +} while (0) + +#else + +#define RARCH_LOG(...) do { \ + logger_send("RetroArch: " __VA_ARGS__); \ +} while(0) + +#define RARCH_LOG_V(tag, fmt, vp) do { \ + logger_send("RetroArch: " tag); \ + logger_send_v(fmt, vp); \ +} while (0) + +#define RARCH_ERR(...) do { \ + logger_send("RetroArch [ERROR] :: " __VA_ARGS__); \ +} while(0) + +#define RARCH_ERR_V(tag, fmt, vp) do { \ + logger_send("RetroArch [ERROR] :: " tag); \ + logger_send_v(fmt, vp); \ +} while (0) + +#define RARCH_WARN(...) do { \ + logger_send("RetroArch [WARN] :: " __VA_ARGS__); \ +} while(0) + +#define RARCH_WARN_V(tag, fmt, vp) do { \ + logger_send("RetroArch [WARN] :: " tag); \ + logger_send_v(fmt, vp); \ +} while (0) + +#define RARCH_LOG_OUTPUT(...) do { \ + logger_send("RetroArch [OUTPUT] :: " __VA_ARGS__); \ +} while(0) + +#define RARCH_LOG_OUTPUT_V(tag, fmt, vp) do { \ + logger_send("RetroArch [OUTPUT] :: " tag); \ + logger_send_v(fmt, vp); \ +} while (0) + +#endif + +#else +static INLINE void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) +{ + if (!RARCH_LOG_VERBOSE) + return; +#if TARGET_OS_IPHONE && defined(RARCH_INTERNAL) +#if TARGET_IPHONE_SIMULATOR + vprintf(fmt, ap); +#else + if (!asl_inited) + { + asl_client = asl_open("RetroArch", "com.apple.console", ASL_OPT_STDERR | ASL_OPT_NO_DELAY); + asl_inited = 1; + } + aslmsg msg = asl_new(ASL_TYPE_MSG); + asl_set(msg, ASL_KEY_READ_UID, "-1"); + if (tag) + asl_log(asl_client, msg, ASL_LEVEL_NOTICE, "%s", tag); + asl_vlog(asl_client, msg, ASL_LEVEL_NOTICE, fmt, ap); + asl_free(msg); +#endif +#elif defined(_XBOX1) + /* FIXME: Using arbitrary string as fmt argument is unsafe. */ + char msg_new[1024], buffer[1024]; + snprintf(msg_new, sizeof(msg_new), "%s: %s %s", + PROGRAM_NAME, + tag ? tag : "", + fmt); + wvsprintf(buffer, msg_new, ap); + OutputDebugStringA(buffer); +#elif defined(ANDROID) && defined(HAVE_LOGGER) && defined(RARCH_INTERNAL) + int prio = ANDROID_LOG_INFO; + if (tag) + { + if (!strcmp("[WARN]", tag)) + prio = ANDROID_LOG_WARN; + else if (!strcmp("[ERROR]", tag)) + prio = ANDROID_LOG_ERROR; + } + __android_log_vprint(prio, PROGRAM_NAME, fmt, ap); +#else + fprintf(LOG_FILE, "%s %s :: ", PROGRAM_NAME, tag ? tag : "[INFO]"); + vfprintf(LOG_FILE, fmt, ap); +#endif +} + +static INLINE void RARCH_LOG(const char *fmt, ...) +{ + va_list ap; + + if (!RARCH_LOG_VERBOSE) + return; + + va_start(ap, fmt); + RARCH_LOG_V("[INFO]", fmt, ap); + va_end(ap); +} + +static INLINE void RARCH_LOG_OUTPUT_V(const char *tag, + const char *msg, va_list ap) +{ + RARCH_LOG_V(tag, msg, ap); +} + +static INLINE void RARCH_LOG_OUTPUT(const char *msg, ...) +{ + va_list ap; + va_start(ap, msg); + RARCH_LOG_OUTPUT_V("[INFO]", msg, ap); + va_end(ap); +} + +static INLINE void RARCH_WARN_V(const char *tag, const char *fmt, va_list ap) +{ + RARCH_LOG_V(tag, fmt, ap); +} + +static INLINE void RARCH_WARN(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + RARCH_WARN_V("[WARN]", fmt, ap); + va_end(ap); +} + +static INLINE void RARCH_ERR_V(const char *tag, const char *fmt, va_list ap) +{ + RARCH_LOG_V(tag, fmt, ap); +} + +static INLINE void RARCH_ERR(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + RARCH_ERR_V("[ERROR]", fmt, ap); + va_end(ap); +} +#endif + +#endif + diff --git a/desmume/src/libretro-common/include/retro_miscellaneous.h b/desmume/src/libretro-common/include/retro_miscellaneous.h new file mode 100644 index 000000000..0209c9bcd --- /dev/null +++ b/desmume/src/libretro-common/include/retro_miscellaneous.h @@ -0,0 +1,171 @@ +/* Copyright (C) 2010-2015 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_miscellaneous.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __RARCH_MISCELLANEOUS_H +#define __RARCH_MISCELLANEOUS_H + +#include + +#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) +#include +#elif defined(XENON) +#include