You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
1
|
2
|
3
|
4
|
5
|
6
|
|
7
|
8
|
9
|
10
|
11
|
12
|
13
|
|
14
|
15
(11) |
16
|
17
|
18
|
19
|
20
(21) |
|
21
|
22
|
23
|
24
(2) |
25
|
26
(3) |
27
(12) |
|
28
|
29
|
30
|
31
|
|
|
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv27059/src/native/linux Modified Files: extxcursor.cpp org_lwjgl_Display.cpp org_lwjgl_Sys.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_Pbuffer.cpp org_lwjgl_opengl_Window.cpp Log Message: Reduced Sys.debug from bool -> int Index: extxcursor.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/extxcursor.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/extxcursor.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- extxcursor.cpp 20 Dec 2003 14:01:30 -0000 1.6 +++ extxcursor.cpp 20 Dec 2003 22:03:25 -0000 1.7 @@ -40,7 +40,7 @@ load_success = false; xcursor_handle = dlopen(xcursor_lib_name, RTLD_GLOBAL | RTLD_LAZY); if (xcursor_handle == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not load %s: %s\n", xcursor_lib_name, dlerror()); + printfDebug("Could not load %s: %s\n", xcursor_lib_name, dlerror()); return load_success; } loadFunctionPointers(); Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- org_lwjgl_Display.cpp 20 Dec 2003 14:01:30 -0000 1.44 +++ org_lwjgl_Display.cpp 20 Dec 2003 22:03:25 -0000 1.45 @@ -61,14 +61,14 @@ int event_base, error_base; if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) { - printfDebug(org_lwjgl_Sys_DEBUG, "XF86VidMode extension not available\n"); + printfDebug("XF86VidMode extension not available\n"); return false; } if (!XF86VidModeQueryVersion(disp, major, minor)) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not determine XF86VidMode version\n"); + printfDebug("Could not determine XF86VidMode version\n"); return false; } - printfDebug(org_lwjgl_Sys_DEBUG, "XF86VidMode extension version %i.%i\n", *major, *minor); + printfDebug("XF86VidMode extension version %i.%i\n", *major, *minor); return true; } @@ -84,15 +84,15 @@ int num_modes, i; XF86VidModeModeInfo **avail_modes; if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not get display modes\n"); + printfDebug("Could not get display modes\n"); return false; } XF86VidModeLockModeSwitch(disp, screen, 0); for ( i = 0; i < num_modes; ++i ) { - printfDebug(org_lwjgl_Sys_DEBUG, "Mode %d: %dx%d\n", i, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay); + printfDebug("Mode %d: %dx%d\n", i, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay); if (avail_modes[i]->hdisplay == width && avail_modes[i]->vdisplay == height) { if (!XF86VidModeSwitchToMode(disp, screen, avail_modes[i])) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not switch mode\n"); + printfDebug("Could not switch mode\n"); break; } if (lock_mode) @@ -118,11 +118,11 @@ static int getGammaRampLength(Display *disp, int screen) { int minor_ver, major_ver, ramp_size; if (!getVidModeExtensionVersion(disp, screen, &major_ver, &minor_ver) || major_ver < 2) { - printfDebug(org_lwjgl_Sys_DEBUG, "XF86VidMode extension version >= 2 not found\n"); + printfDebug("XF86VidMode extension version >= 2 not found\n"); return 0; } if (XF86VidModeGetGammaRampSize(disp, screen, &ramp_size) == False) { - printfDebug(org_lwjgl_Sys_DEBUG, "XF86VidModeGetGammaRampSize call failed\n"); + printfDebug("XF86VidModeGetGammaRampSize call failed\n"); return 0; } return ramp_size; @@ -136,18 +136,18 @@ int screen; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not open X connection\n"); + printfDebug("Could not open X connection\n"); return; } screen = DefaultScreen(disp); if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not get display modes\n"); + printfDebug("Could not get display modes\n"); } saved_width = avail_modes[0]->hdisplay; saved_height = avail_modes[0]->vdisplay; int bpp = XDefaultDepth(disp, screen); - printfDebug(org_lwjgl_Sys_DEBUG, "Saved width, height %d, %d\n", saved_width, saved_height); + printfDebug("Saved width, height %d, %d\n", saved_width, saved_height); jclass jclass_DisplayMode = env->FindClass("org/lwjgl/DisplayMode"); jmethodID ctor = env->GetMethodID(jclass_DisplayMode, "<init>", "(IIII)V"); jobject newMode = env->NewObject(jclass_DisplayMode, ctor, saved_width, saved_height, bpp, 0); @@ -195,7 +195,7 @@ Display *disp = XOpenDisplay(NULL); if (disp == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not open X connection\n"); + printfDebug("Could not open X connection\n"); return; } screen = DefaultScreen(disp); @@ -216,7 +216,7 @@ XF86VidModeModeInfo **avail_modes; if (disp == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not open X connection\n"); + printfDebug("Could not open X connection\n"); return NULL; } @@ -224,7 +224,7 @@ int bpp = XDefaultDepth(disp, screen); if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not get display modes\n"); + printfDebug("Could not get display modes\n"); XCloseDisplay(disp); return NULL; } Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Sys.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- org_lwjgl_Sys.cpp 20 Dec 2003 14:01:30 -0000 1.21 +++ org_lwjgl_Sys.cpp 20 Dec 2003 22:03:25 -0000 1.22 @@ -63,15 +63,15 @@ static long queryTime(void) { struct timeval tv; if (gettimeofday(&tv, NULL) == -1) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not read current time\n"); + printfDebug("Could not read current time\n"); } long result = tv.tv_sec * 1000000l + tv.tv_usec; return result; } -JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebugLevel(JNIEnv *env, jclass clazz, jint debug_level) { - setDebugLevel(debug_level); +JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebug(JNIEnv *env, jclass clazz, jboolean enabled) { + setDebugEnabled(enabled == JNI_TRUE ? true : false); } /* @@ -117,7 +117,7 @@ // Reset scheduler to normal sched_pri.sched_priority = 0; if (sched_setscheduler(0, SCHED_OTHER, &sched_pri) != 0) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not set realtime priority\n"); + printfDebug("Could not set realtime priority\n"); return; } } @@ -127,12 +127,12 @@ min_pri = sched_get_priority_min(SCHED_FIFO); max_pri = sched_get_priority_max(SCHED_FIFO); if (min_pri == -1 || max_pri == -1) { - printfDebug(org_lwjgl_Sys_DEBUG, "Failed to set realtime priority\n"); + printfDebug("Failed to set realtime priority\n"); return; } sched_pri.sched_priority = (max_pri + min_pri)/2; if (sched_setscheduler(0, SCHED_FIFO, &sched_pri) != 0) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not set realtime priority\n"); + printfDebug("Could not set realtime priority\n"); return; } return; @@ -150,7 +150,7 @@ } if (setpriority(PRIO_PROCESS, 0, linux_priority) == -1) { - printfDebug(org_lwjgl_Sys_DEBUG, "Failed to set priority.\n"); + printfDebug("Failed to set priority.\n"); } } Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- org_lwjgl_input_Mouse.cpp 20 Dec 2003 14:01:30 -0000 1.43 +++ org_lwjgl_input_Mouse.cpp 20 Dec 2003 22:03:25 -0000 1.44 @@ -122,7 +122,7 @@ static bool blankCursor(void) { unsigned int best_width, best_height; if (XQueryBestCursor(getCurrentDisplay(), getCurrentWindow(), 1, 1, &best_width, &best_height) == 0) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not query best cursor size\n"); + printfDebug("Could not query best cursor size\n"); return false; } Pixmap mask = XCreatePixmap(getCurrentDisplay(), getCurrentWindow(), best_width, best_height, 1); @@ -199,10 +199,10 @@ event.xmotion.y > current_y - POINTER_WARP_BORDER && event.xmotion.y < current_y + POINTER_WARP_BORDER) break; - printfDebug(org_lwjgl_Sys_DEBUG, "Skipped event searching for warp event %d, %d\n", event.xmotion.x, event.xmotion.y); + printfDebug("Skipped event searching for warp event %d, %d\n", event.xmotion.x, event.xmotion.y); } if (i == WARP_RETRY) - printfDebug(org_lwjgl_Sys_DEBUG, "Never got warp event\n"); + printfDebug("Never got warp event\n"); } static void warpPointer(void) { Index: org_lwjgl_opengl_Pbuffer.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- org_lwjgl_opengl_Pbuffer.cpp 20 Dec 2003 14:01:30 -0000 1.6 +++ org_lwjgl_opengl_Pbuffer.cpp 20 Dec 2003 22:03:25 -0000 1.7 @@ -161,7 +161,7 @@ GLXPbuffer buffer = buffer_info->buffer; GLXContext context = buffer_info->context; if (glXMakeContextCurrent(getCurrentDisplay(), buffer, buffer, context) == False) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not make pbuffer current"); + printfDebug("Could not make pbuffer current"); } } Index: org_lwjgl_opengl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- org_lwjgl_opengl_Window.cpp 20 Dec 2003 14:01:30 -0000 1.13 +++ org_lwjgl_opengl_Window.cpp 20 Dec 2003 22:03:25 -0000 1.14 @@ -208,7 +208,7 @@ } win = XCreateWindow(disp, root_win, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); XFreeColormap(disp, cmap); - printfDebug(org_lwjgl_Sys_DEBUG, "Created window\n"); + printfDebug("Created window\n"); current_win = win; Java_org_lwjgl_opengl_Window_nSetTitle(env, NULL, title); XSizeHints * size_hints = XAllocSizeHints(); @@ -381,7 +381,7 @@ throwException(env, "Could not create visual info from FB config"); return false; } - if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) + if (ISDEBUGENABLED()) dumpVisualInfo(disp, vis_info); createWindow(env, disp, screen, vis_info, title, x, y, width, height, fscreen); glx_window = glXCreateWindow(disp, configs[0], getCurrentWindow(), NULL); @@ -397,7 +397,7 @@ throwException(env, "Could not find a matching pixel format"); return false; } - if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) + if (ISDEBUGENABLED()) dumpVisualInfo(disp, vis_info); context = glXCreateContext(disp, vis_info, NULL, True); if (context == NULL) { @@ -463,7 +463,7 @@ throwException(env, "Could not init gl function pointers"); return; } - if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) { + if (ISDEBUGENABLED()) { const GLubyte * extensions = glGetString(GL_EXTENSIONS); printf("Supported extensions: %s\n", extensions); } |
|
From: Elias N. <eli...@us...> - 2003-12-20 22:03:28
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv27059/src/native/common Modified Files: checkALerror.h checkGLerror.h common_tools.cpp common_tools.h extal.cpp extgl.cpp org_lwjgl_Sys.h Log Message: Reduced Sys.debug from bool -> int Index: checkALerror.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/checkALerror.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/checkALerror.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- checkALerror.h 20 Dec 2003 14:01:30 -0000 1.8 +++ checkALerror.h 20 Dec 2003 22:03:24 -0000 1.9 @@ -16,7 +16,7 @@ #define CHECK_AL_ERROR \ { \ - if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) { \ + if (ISDEBUGENABLED()) { \ int err = alGetError(); \ if (err != AL_NO_ERROR) { \ jclass cls = env->FindClass("org/lwjgl/openal/OpenALException"); \ @@ -28,7 +28,7 @@ /* only available if deviceaddress is specified in method */ #define CHECK_ALC_ERROR \ { \ - if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) { \ + if (ISDEBUGENABLED()) { \ int err = alcGetError((ALCdevice*) deviceaddress); \ if (err != AL_NO_ERROR) { \ jclass cls = env->FindClass("org/lwjgl/openal/OpenALException"); \ Index: checkGLerror.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/checkGLerror.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/checkGLerror.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- checkGLerror.h 20 Dec 2003 14:01:30 -0000 1.9 +++ checkGLerror.h 20 Dec 2003 22:03:24 -0000 1.10 @@ -16,7 +16,7 @@ #define CHECK_GL_ERROR \ { \ - if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) { \ + if (ISDEBUGENABLED()) { \ int err = glGetError(); \ if (err != GL_NO_ERROR) { \ jclass cls = env->FindClass("org/lwjgl/opengl/OpenGLException"); \ Index: common_tools.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/common_tools.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- common_tools.cpp 20 Dec 2003 14:01:30 -0000 1.6 +++ common_tools.cpp 20 Dec 2003 22:03:24 -0000 1.7 @@ -39,16 +39,16 @@ #include "common_tools.h" -int debug_level = org_lwjgl_Sys_NONE; +bool debug = false; -void setDebugLevel(int level) { - debug_level = level; +void setDebugEnabled(bool enable) { + debug = enable; } -void printfDebug(int level, const char *format, ...) { +void printfDebug(const char *format, ...) { va_list ap; va_start(ap, format); - if (debug_level >= level) + if (ISDEBUGENABLED()) vprintf(format, ap); va_end(ap); } @@ -65,7 +65,7 @@ void putEventElement(event_queue_t *queue, unsigned char byte) { int next_index = (queue->list_end + 1)%EVENT_BUFFER_SIZE; if (next_index == queue->list_start) { - printfDebug(org_lwjgl_Sys_DEBUG, "Event buffer overflow!\n"); + printfDebug("Event buffer overflow!\n"); return; } queue->input_event_buffer[queue->list_end] = byte; Index: common_tools.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/common_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- common_tools.h 20 Dec 2003 14:01:30 -0000 1.5 +++ common_tools.h 20 Dec 2003 22:03:24 -0000 1.6 @@ -43,11 +43,11 @@ #include <jni.h> #include "org_lwjgl_Sys.h" -extern int debug_level; +extern bool debug; // Must be x * max_event_size + 1 #define EVENT_BUFFER_SIZE (25 * 4 + 1) -#define ATDEBUGLEVEL(level) (debug_level >= level) +#define ISDEBUGENABLED() (debug) typedef struct { unsigned char input_event_buffer[EVENT_BUFFER_SIZE]; @@ -64,7 +64,7 @@ extern int getEventBufferSize(event_queue_t *event_queue); extern void throwException(JNIEnv *env, const char *msg); extern void throwOpenALException(JNIEnv * env, const char * err); -extern void setDebugLevel(int level); -extern void printfDebug(int level, const char *format, ...); +extern void setDebugEnabled(bool enable); +extern void printfDebug(const char *format, ...); #endif Index: extal.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extal.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extal.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- extal.cpp 20 Dec 2003 14:01:30 -0000 1.14 +++ extal.cpp 20 Dec 2003 22:03:24 -0000 1.15 @@ -182,7 +182,7 @@ static void* GetFunctionPointer(const char* function) { void *p = NativeGetFunctionPointer(function); if (p == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not locate symbol %s\n", function); + printfDebug("Could not locate symbol %s\n", function); } return p; } @@ -193,11 +193,11 @@ static bool LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) { jsize pathcount = env->GetArrayLength(oalPaths); - printfDebug(org_lwjgl_Sys_DEBUG, "Found %d OpenAL paths\n", (int)pathcount); + printfDebug("Found %d OpenAL paths\n", (int)pathcount); for(int i=0;i<pathcount;i++) { jstring path = (jstring) env->GetObjectArrayElement(oalPaths, i); const char *path_str = env->GetStringUTFChars(path, NULL); - printfDebug(org_lwjgl_Sys_DEBUG, "Testing '%s'\n", path_str); + printfDebug("Testing '%s'\n", path_str); #ifdef _WIN32 handleOAL = LoadLibrary(path_str); #endif @@ -208,7 +208,7 @@ handleOAL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR); #endif if (handleOAL != NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Found OpenAL at '%s'\n", path_str); + printfDebug("Found OpenAL at '%s'\n", path_str); return true; } env->ReleaseStringUTFChars(path, path_str); Index: extgl.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extgl.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- extgl.cpp 20 Dec 2003 14:01:30 -0000 1.7 +++ extgl.cpp 20 Dec 2003 22:03:24 -0000 1.8 @@ -1339,7 +1339,7 @@ err = FindFolder (kSystemDomain, kFrameworksFolderType, false, &fileRefParam.ioVRefNum, &fileRefParam.ioDirID); if (noErr != err) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not find frameworks folder\n"); + printfDebug("Could not find frameworks folder\n"); return NULL; } @@ -1350,7 +1350,7 @@ if (noErr != err) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could make FSref to frameworks folder\n"); + printfDebug("Could make FSref to frameworks folder\n"); return NULL; } @@ -1359,7 +1359,7 @@ bundleURLOpenGL = CFURLCreateFromFSRef (kCFAllocatorDefault, &fileRef); if (!bundleURLOpenGL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could create framework URL\n"); + printfDebug("Could create framework URL\n"); return NULL; } @@ -1367,14 +1367,14 @@ CFRelease (bundleURLOpenGL); if (bundle_ref == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not load framework\n"); + printfDebug("Could not load framework\n"); return NULL; } // if the code was successfully loaded, look for our function. if (!CFBundleLoadExecutable(bundle_ref)) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not load MachO executable\n"); + printfDebug("Could not load MachO executable\n"); CFRelease(bundle_ref); return NULL; } @@ -1403,7 +1403,7 @@ { t = GetProcAddress(lib_glu_handle, name); if (t == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not locate symbol %s\n", name); + printfDebug("Could not locate symbol %s\n", name); extgl_error = true; } } @@ -1420,7 +1420,7 @@ { t = dlsym(lib_glu_handle, name); if (t == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not locate symbol %s\n", name); + printfDebug("Could not locate symbol %s\n", name); extgl_error = true; } } @@ -1434,7 +1434,7 @@ if (func_pointer == NULL) { func_pointer = CFBundleGetFunctionPointerForName(agl_bundle_ref, str); if (func_pointer == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not locate symbol %s\n", name); + printfDebug("Could not locate symbol %s\n", name); extgl_error = true; } } @@ -1449,7 +1449,7 @@ GLubyte *where, *terminator; if (extensions == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "NULL extension string\n"); + printfDebug("NULL extension string\n"); extgl_error = true; return false; } @@ -3291,12 +3291,12 @@ { lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); if (lib_gl_handle == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Error loading libGL.so.1: %s\n", dlerror()); + printfDebug("Error loading libGL.so.1: %s\n", dlerror()); return false; } lib_glu_handle = dlopen("libGLU.so.1", RTLD_LAZY | RTLD_GLOBAL); if (lib_glu_handle == NULL) { - printfDebug(org_lwjgl_Sys_DEBUG, "Error loading libGLU.so.1: %s\n", dlerror()); + printfDebug("Error loading libGLU.so.1: %s\n", dlerror()); dlclose(lib_gl_handle); return false; } Index: org_lwjgl_Sys.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_Sys.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_Sys.h,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- org_lwjgl_Sys.h 20 Dec 2003 14:01:30 -0000 1.17 +++ org_lwjgl_Sys.h 20 Dec 2003 22:03:24 -0000 1.18 @@ -7,18 +7,6 @@ #ifdef __cplusplus extern "C" { #endif -#undef org_lwjgl_Sys_DEBUG -#define org_lwjgl_Sys_DEBUG 6L -#undef org_lwjgl_Sys_INFO -#define org_lwjgl_Sys_INFO 5L -#undef org_lwjgl_Sys_WARN -#define org_lwjgl_Sys_WARN 4L -#undef org_lwjgl_Sys_ERROR -#define org_lwjgl_Sys_ERROR 3L -#undef org_lwjgl_Sys_FATAL -#define org_lwjgl_Sys_FATAL 2L -#undef org_lwjgl_Sys_NONE -#define org_lwjgl_Sys_NONE 1L #undef org_lwjgl_Sys_LOW_PRIORITY #define org_lwjgl_Sys_LOW_PRIORITY -1L #undef org_lwjgl_Sys_NORMAL_PRIORITY @@ -28,14 +16,14 @@ #undef org_lwjgl_Sys_REALTIME_PRIORITY #define org_lwjgl_Sys_REALTIME_PRIORITY 2L /* Inaccessible static: LIBRARY_NAME */ -/* Inaccessible static: debug_level */ +/* Inaccessible static: debug */ /* * Class: org_lwjgl_Sys - * Method: setDebugLevel - * Signature: (I)V + * Method: setDebug + * Signature: (Z)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebugLevel - (JNIEnv *, jclass, jint); +JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebug + (JNIEnv *, jclass, jboolean); /* * Class: org_lwjgl_Sys |
|
From: Elias N. <eli...@us...> - 2003-12-20 22:03:28
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1:/tmp/cvs-serv27059/src/native/macosx Modified Files: hid.cpp org_lwjgl_Sys.cpp org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp Log Message: Reduced Sys.debug from bool -> int Index: hid.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/hid.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/hid.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- hid.cpp 20 Dec 2003 14:01:30 -0000 1.4 +++ hid.cpp 20 Dec 2003 22:03:25 -0000 1.5 @@ -123,7 +123,7 @@ static void addToDeviceQueue(hid_device_t *hid_dev, IOHIDElementCookie cookie, int index) { HRESULT result = (*hid_dev->device_queue)->addElement(hid_dev->device_queue, cookie, 0); if (result != S_OK) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not add cookie to queue\n"); + printfDebug("Could not add cookie to queue\n"); return; } CFDictionaryAddValue(hid_dev->cookie_map, cookie, (void *)index); @@ -191,7 +191,7 @@ CFDictionaryRef matching_dic = IOServiceMatching(kIOHIDDeviceKey); IOReturn err = IOServiceGetMatchingServices(kIOMasterPortDefault, matching_dic, &device_iterator); if (err != kIOReturnSuccess) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not find matching devices\n"); + printfDebug("Could not find matching devices\n"); return false; } while (!success && (hid_device = IOIteratorNext(device_iterator)) != NULL) { @@ -201,7 +201,7 @@ long usage_page; if (getDictLong(dev_props, CFSTR(kIOHIDPrimaryUsageKey), &usage) && getDictLong(dev_props, CFSTR(kIOHIDPrimaryUsagePageKey), &usage_page)) { - if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) { + if (ISDEBUGENABLED()) { printf("Considering device '"); printProperty(dev_props, CFSTR(kIOHIDProductKey)); printf("', usage page %ld usage %ld\n", usage_page, usage); Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Sys.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- org_lwjgl_Sys.cpp 20 Dec 2003 14:01:30 -0000 1.11 +++ org_lwjgl_Sys.cpp 20 Dec 2003 22:03:25 -0000 1.12 @@ -64,15 +64,15 @@ static long queryTime(void) { struct timeval tv; if (gettimeofday(&tv, NULL) == -1) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not read current time\n"); + printfDebug("Could not read current time\n"); } long result = tv.tv_sec * 1000000l + tv.tv_usec; return result; } -JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebugLevel(JNIEnv *env, jclass clazz, jint debug_level) { - setDebugLevel(debug_level); +JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebugEnabled(JNIEnv *env, jclass clazz, jboolean enabled) { + setDebugEnabled(enabled == JNI_TRUE ? true : false); } /* @@ -110,7 +110,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority (JNIEnv * env, jclass clazz, jint priority) { - printfDebug(org_lwjgl_Sys_DEBUG, "WARNING: setProcessPriority unsupported\n"); + printfDebug("WARNING: setProcessPriority unsupported\n"); } /* Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- org_lwjgl_input_Keyboard.cpp 20 Dec 2003 14:01:30 -0000 1.20 +++ org_lwjgl_input_Keyboard.cpp 20 Dec 2003 22:03:25 -0000 1.21 @@ -70,12 +70,12 @@ static bool handleKey(UInt32 key_code, unsigned char state) { if (key_code >= KEYBOARD_SIZE) { - printfDebug(org_lwjgl_Sys_DEBUG, "Key code >= %d %x\n", KEYBOARD_SIZE, (unsigned int)key_code); + printfDebug("Key code >= %d %x\n", KEYBOARD_SIZE, (unsigned int)key_code); return false; } unsigned char mapped_code = key_map[key_code]; if (mapped_code == 0) { - printfDebug(org_lwjgl_Sys_DEBUG, "unknown key code: %x\n", (unsigned int)key_code); + printfDebug("unknown key code: %x\n", (unsigned int)key_code); return false; } return handleMappedKey(mapped_code, state); @@ -129,7 +129,7 @@ KeyboardLayoutRef layout; OSStatus err = KLGetCurrentKeyboardLayout(&layout); if (err != noErr) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not get current keyboard layout\n"); + printfDebug("Could not get current keyboard layout\n"); return false; } @@ -143,7 +143,7 @@ success = success && GetEventParameter(event, kEventParamKeyboardType, typeUInt32, NULL, sizeof(keyboardType), NULL, &keyboardType) == noErr; success = success && GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifierKeyState), NULL, &modifierKeyState) == noErr; if (!success) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event parameters for character translation\n"); + printfDebug("Could not get event parameters for character translation\n"); return false; } err = KLGetKeyboardLayoutProperty(layout, kKLuchrData, (const void **)&uchrHandle); @@ -175,7 +175,7 @@ if (state) return writeAsciiChars(count, ascii_buffer); } else { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not translate key\n"); + printfDebug("Could not translate key\n"); return false; } } @@ -186,7 +186,7 @@ UInt32 key_code; OSStatus err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(key_code), NULL, &key_code); if (err != noErr) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event key code\n"); + printfDebug("Could not get event key code\n"); return; } if (handleKey(key_code, 1) && !handleTranslation(event, true)) { @@ -199,7 +199,7 @@ UInt32 key_code; OSStatus err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(key_code), NULL, &key_code); if (err != noErr) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event key code\n"); + printfDebug("Could not get event key code\n"); return; } if (handleKey(key_code, 0) && !handleTranslation(event, false)) { @@ -222,7 +222,7 @@ UInt32 modifier_bits; OSStatus err = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifier_bits), NULL, &modifier_bits); if (err != noErr) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event key code\n"); + printfDebug("Could not get event key code\n"); return; } handleModifier(modifier_bits, controlKey, 0x1d); Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- org_lwjgl_input_Mouse.cpp 20 Dec 2003 14:01:30 -0000 1.23 +++ org_lwjgl_input_Mouse.cpp 20 Dec 2003 22:03:25 -0000 1.24 @@ -70,7 +70,7 @@ static void handleButton(unsigned char button_index, jbyte state) { if (button_index >= NUM_BUTTONS) { - printfDebug(org_lwjgl_Sys_DEBUG, "Button index %d out of range [0..%d]\n", button_index, NUM_BUTTONS); + printfDebug("Button index %d out of range [0..%d]\n", button_index, NUM_BUTTONS); return; } button_states[button_index] = state; @@ -106,7 +106,7 @@ } } } - printfDebug(org_lwjgl_Sys_DEBUG, "Recieved an unknown HID device event\n"); + printfDebug("Recieved an unknown HID device event\n"); } } */ @@ -120,7 +120,7 @@ EventMouseButton button; OSStatus err = GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button); if (err != noErr) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not get button parameter from event\n"); + printfDebug("Could not get button parameter from event\n"); return; } handleButton(button - 1, state); @@ -130,7 +130,7 @@ HIPoint delta; OSStatus err = GetEventParameter(event, kEventParamMouseDelta, typeHIPoint, NULL, sizeof(delta), NULL, &delta); if (err != noErr) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not delta parameter from event\n"); + printfDebug("Could not delta parameter from event\n"); return; } last_dx += (int)delta.x; @@ -141,7 +141,7 @@ long delta; OSStatus err = GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta); if (err != noErr) { - printfDebug(org_lwjgl_Sys_DEBUG, "Could not delta parameter from event\n"); + printfDebug("Could not delta parameter from event\n"); return; } last_dz += (int)delta; |
|
From: Elias N. <eli...@us...> - 2003-12-20 22:03:27
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv27059/src/java/org/lwjgl/opengl Modified Files: GLCaps.java Log Message: Reduced Sys.debug from bool -> int Index: GLCaps.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLCaps.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLCaps.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- GLCaps.java 20 Dec 2003 14:01:30 -0000 1.14 +++ GLCaps.java 20 Dec 2003 22:03:24 -0000 1.15 @@ -162,11 +162,11 @@ } private static void setExtensionFields(HashSet exts, HashMap field_map) { - Sys.log(Sys.DEBUG, "Available extensions:"); + Sys.log("Available extensions:"); Iterator it = exts.iterator(); while (it.hasNext()) { String ext = (String)it.next(); - Sys.log(Sys.DEBUG, ext); + Sys.log(ext); Field f = (Field)field_map.get(ext); if (f != null) { |
|
From: Elias N. <eli...@us...> - 2003-12-20 22:03:27
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv27059/src/java/org/lwjgl Modified Files: Display.java Sys.java Log Message: Reduced Sys.debug from bool -> int Index: Display.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- Display.java 20 Dec 2003 14:01:30 -0000 1.36 +++ Display.java 20 Dec 2003 22:03:24 -0000 1.37 @@ -80,7 +80,7 @@ static { System.loadLibrary(Sys.getLibraryName()); init(); - Sys.log(Sys.DEBUG, "Adapter: "+getAdapter()+" Version: "+getVersion()); + Sys.log("Adapter: "+getAdapter()+" Version: "+getVersion()); } /** @@ -118,7 +118,7 @@ DisplayMode[] filteredModes = new DisplayMode[modes.size()]; modes.toArray(filteredModes); - Sys.log(Sys.DEBUG, "Removed " + (unfilteredModes.length - filteredModes.length) + " duplicate displaymodes"); + Sys.log("Removed " + (unfilteredModes.length - filteredModes.length) + " duplicate displaymodes"); return filteredModes; } @@ -235,7 +235,7 @@ gammaRamp.put(i, rampEntry); } setGammaRamp(gammaRamp); - Sys.log(Sys.DEBUG, "Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast); + Sys.log("Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast); } /** Index: Sys.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- Sys.java 20 Dec 2003 14:01:30 -0000 1.34 +++ Sys.java 20 Dec 2003 22:03:24 -0000 1.35 @@ -47,14 +47,6 @@ * @version $Revision$ */ public final class Sys { - /** Debug level constants */ - public static final int DEBUG = 6; - public static final int INFO = 5; - public static final int WARN = 4; - public static final int ERROR = 3; - public static final int FATAL = 2; - public static final int NONE = 1; - /** Low process priority. @see #setProcessPriority() */ public static final int LOW_PRIORITY = -1; @@ -90,25 +82,14 @@ /** * Debug level. */ - public static final int debug_level; + public static final boolean debug; static { - String debug_level_prop = System.getProperty("lwjgl.debuglevel", "NONE"); - int _debug = NONE; - if (debug_level_prop.equals("DEBUG")) { - _debug = DEBUG; - } else if (debug_level_prop.equals("INFO")) { - _debug = INFO; - } else if (debug_level_prop.equals("WARN")) { - _debug = WARN; - } else if (debug_level_prop.equals("ERROR")) { - _debug = ERROR; - } else if (debug_level_prop.equals("FATAL")) { - _debug = FATAL; - } else if (debug_level_prop.equals("NONE")) { - _debug = NONE; - } - debug_level = _debug; + String debug_level_prop = System.getProperty("org.lwjgl.Sys.debug", "false"); + if (debug_level_prop.equals("true")) + debug = true; + else + debug = false; initialize(); } @@ -126,19 +107,19 @@ } /** - * Prints the given message to System.err if atDebugLevel(debug_level) + * Prints the given message to System.err if isDebugEnabled() * is true. */ - public static void log(int debug_level, String msg) { - if (atDebugLevel(debug_level)) + public static void log(String msg) { + if (isDebugEnabled()) System.err.println(msg); } /** * @return true if the debug level is greater than or equal to level */ - public static boolean atDebugLevel(int level) { - return debug_level >= level; + public static boolean isDebugEnabled() { + return debug; } /** @@ -146,7 +127,7 @@ */ private static void initialize() { System.loadLibrary(LIBRARY_NAME); - setDebugLevel(debug_level); + setDebug(debug); setTime(0); Runtime.getRuntime().addShutdownHook(new Thread() { @@ -166,7 +147,7 @@ /** * Set the debug level of the native library */ - private static native void setDebugLevel(int level); + private static native void setDebug(boolean debug); /** * Obtains the number of ticks that the hires timer does in a second. |
|
From: Elias N. <eli...@us...> - 2003-12-20 22:03:27
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1:/tmp/cvs-serv27059/src/java/org/lwjgl/openal Modified Files: BaseAL.java Log Message: Reduced Sys.debug from bool -> int Index: BaseAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- BaseAL.java 20 Dec 2003 14:01:30 -0000 1.24 +++ BaseAL.java 20 Dec 2003 22:03:24 -0000 1.25 @@ -142,7 +142,7 @@ private static String getPathFromJWS(String libname) { try { - Sys.log(Sys.DEBUG, "JWS Classloader looking for: " + libname); + Sys.log("JWS Classloader looking for: " + libname); Object o = BaseAL.class.getClassLoader(); Class c = o.getClass(); @@ -152,7 +152,7 @@ return (String) findLibrary.invoke(o, arguments); } catch (Exception e) { - Sys.log(Sys.INFO, "Failure locating OpenAL using classloader:" + e); + Sys.log("Failure locating OpenAL using classloader:" + e); } return null; } |
|
From: Elias N. <eli...@us...> - 2003-12-20 14:01:34
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv21938/src/native/win32 Modified Files: org_lwjgl_Display.cpp org_lwjgl_Sys.cpp org_lwjgl_input_Controller.cpp org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_Window.cpp Log Message: Implemented proper debug levels Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- org_lwjgl_Display.cpp 15 Dec 2003 11:49:17 -0000 1.56 +++ org_lwjgl_Display.cpp 20 Dec 2003 14:01:31 -0000 1.57 @@ -62,7 +62,7 @@ { jobjectArray result = GetAvailableDisplayModesEx(env); if (result == NULL) { - printfDebug("Extended display mode selection failed, using fallback\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Extended display mode selection failed, using fallback\n"); result = GetAvailableDisplayModes(env); } return result; @@ -79,7 +79,7 @@ HMODULE lib_handle = LoadLibrary("user32.dll"); if (lib_handle == NULL) { - printfDebug("Could not load user32.dll\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not load user32.dll\n"); return NULL; } EnumDisplayDevicesA = (EnumDisplayDevicesAPROC)GetProcAddress(lib_handle, "EnumDisplayDevicesA"); @@ -103,7 +103,7 @@ //enumerate all displays, and all of their displaymodes while(EnumDisplayDevicesA(NULL, i++, &DisplayDevice, 0) != 0) { - printfDebug("Querying %s device\n", DisplayDevice.DeviceString); + printfDebug(org_lwjgl_Sys_DEBUG, "Querying %s device\n", DisplayDevice.DeviceString); j = 0; while(EnumDisplaySettingsExA((const char *) DisplayDevice.DeviceName, j++, &DevMode, 0) != 0) { if (DevMode.dmBitsPerPel > 8) { @@ -112,7 +112,7 @@ } } - printfDebug("Found %d displaymodes\n", AvailableModes); + printfDebug(org_lwjgl_Sys_DEBUG, "Found %d displaymodes\n", AvailableModes); // now that we have the count create the classes, and add 'em all - we'll remove dups in Java // Allocate an array of DisplayModes big enough @@ -160,7 +160,7 @@ } } - printfDebug("Found %d displaymodes\n", AvailableModes); + printfDebug(org_lwjgl_Sys_DEBUG, "Found %d displaymodes\n", AvailableModes); // now that we have the count create the classes, and add 'em all - we'll remove dups in Java // Allocate an array of DisplayModes big enough @@ -230,12 +230,12 @@ if (cdsret != DISP_CHANGE_SUCCESSFUL) { // Failed: so let's check to see if it's a wierd dual screen display - printfDebug("Failed to set display mode... assuming dual monitors\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to set display mode... assuming dual monitors\n"); devmode.dmPelsWidth = width * 2; cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN); if (cdsret != DISP_CHANGE_SUCCESSFUL) { - printfDebug("Failed to set display mode using dual monitors\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to set display mode using dual monitors\n"); throwException(env, "Failed to set display mode."); return; } @@ -278,7 +278,7 @@ HDC screenDC = GetDC(NULL); try { if (!SetDeviceGammaRamp(screenDC, originalGamma)) { - printfDebug("Could not reset device gamma\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not reset device gamma\n"); } } catch (...) { printf("Exception occurred in SetDeviceGammaRamp\n"); @@ -303,7 +303,7 @@ HDC screenDC = GetDC(NULL); try { if (!SetDeviceGammaRamp(screenDC, originalGamma)) { - printfDebug("Could not reset device gamma\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not reset device gamma\n"); } } catch (...) { printf("Exception occurred in SetDeviceGammaRamp\n"); @@ -311,7 +311,7 @@ ReleaseDC(NULL, screenDC); if (modeSet) { - printfDebug("Attempting to temporarily reset the display mode\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Attempting to temporarily reset the display mode\n"); modeSet = false; // Under Win32, all we have to do is: ChangeDisplaySettings(NULL, 0); @@ -326,7 +326,7 @@ HDC screenDC = GetDC(NULL); try { if (!SetDeviceGammaRamp(screenDC, currentGamma)) { - printfDebug("Could not restore device gamma\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not restore device gamma\n"); } } catch (...) { printf("Exception occurred in SetDeviceGammaRamp\n"); @@ -334,12 +334,12 @@ ReleaseDC(NULL, screenDC); if (!modeSet) { - printfDebug("Attempting to restore the display mode\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Attempting to restore the display mode\n"); modeSet = true; LONG cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN); if (cdsret != DISP_CHANGE_SUCCESSFUL) { - printfDebug("Failed to restore display mode\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to restore display mode\n"); } } } @@ -415,7 +415,7 @@ // Get the default gamma ramp try { if (GetDeviceGammaRamp(screenDC, originalGamma) == FALSE) { - printfDebug("Failed to get initial device gamma\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to get initial device gamma\n"); } } catch (...) { printf("Exception occurred in GetDeviceGammaRamp\n"); @@ -450,7 +450,7 @@ if(lRet != ERROR_SUCCESS) return NULL; - printfDebug("Adapter key: %s\n", szAdapterKey); + printfDebug(org_lwjgl_Sys_DEBUG, "Adapter key: %s\n", szAdapterKey); // szAdapterKey now contains something like \Registry\Machine\System\CurrentControlSet\Control\Video\{B70DBD2A-90C4-41CF-A58E-F3BA69F1A6BC}\0000 // We'll check for the first chunk: Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Sys.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- org_lwjgl_Sys.cpp 15 Dec 2003 11:49:17 -0000 1.18 +++ org_lwjgl_Sys.cpp 20 Dec 2003 14:01:31 -0000 1.19 @@ -120,7 +120,7 @@ } if (!SetPriorityClass(me, win32priority)) { - printfDebug("Failed to set priority class.\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to set priority class.\n"); } } @@ -137,7 +137,7 @@ const char * cTitleBarText = env->GetStringUTFChars(title, ©); MessageBox(hwnd, eMessageText, cTitleBarText, MB_OK | MB_TOPMOST); - printfDebug("*** Alert ***%s\n%s\n", cTitleBarText, eMessageText); + printfDebug(org_lwjgl_Sys_DEBUG, "*** Alert ***%s\n%s\n", cTitleBarText, eMessageText); env->ReleaseStringUTFChars(message, eMessageText); env->ReleaseStringUTFChars(title, cTitleBarText); @@ -191,7 +191,7 @@ &pi ) // Pointer to PROCESS_INFORMATION structure. ) { - printfDebug("Failed to open URL %s\n", urlString); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to open URL %s\n", urlString); } // Close process and thread handles. Index: org_lwjgl_input_Controller.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Controller.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Controller.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- org_lwjgl_input_Controller.cpp 15 Dec 2003 11:49:17 -0000 1.16 +++ org_lwjgl_input_Controller.cpp 20 Dec 2003 14:01:31 -0000 1.17 @@ -120,7 +120,7 @@ HRESULT hr; hr = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &cDI, NULL); if (FAILED(hr)) { - printfDebug("DirectInputCreate failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "DirectInputCreate failed\n"); ShutdownController(); return; } @@ -199,12 +199,12 @@ // poll the Controller to read the current state hRes = cDIDevice->Poll(); if (FAILED(hRes)) { - printfDebug("Poll fail\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Poll fail\n"); //check if we need to reaquire if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { cDIDevice->Acquire(); - printfDebug("DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); + printfDebug(org_lwjgl_Sys_DEBUG, "DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); } return; } @@ -231,7 +231,7 @@ HRESULT hr; hr = cDIDevice->EnumObjects(EnumControllerObjectsCallback, NULL, DIDFT_ALL); if FAILED(hr) { - printfDebug("EnumObjects failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "EnumObjects failed\n"); cCreate_success = false; return; } @@ -245,7 +245,7 @@ HRESULT hr; hr = cDI->EnumDevices(DIDEVTYPE_JOYSTICK, EnumControllerCallback, 0, DIEDFL_ATTACHEDONLY); if FAILED(hr) { - printfDebug("EnumDevices failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "EnumDevices failed\n"); cCreate_success = false; return; } @@ -267,7 +267,7 @@ * Callback from EnumObjects. Called for each "object" on the Controller. */ BOOL CALLBACK EnumControllerObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) { - printfDebug("found %s\n", lpddoi->tszName); + printfDebug(org_lwjgl_Sys_DEBUG, "found %s\n", lpddoi->tszName); if(lpddoi->guidType == GUID_Button) { cButtoncount++; } else if(lpddoi->guidType == GUID_XAxis) { @@ -287,7 +287,7 @@ } else if (lpddoi->guidType == GUID_RzAxis) { cHasrz = true; } else { - printfDebug("Unhandled object found: %s\n", lpddoi->tszName); + printfDebug(org_lwjgl_Sys_DEBUG, "Unhandled object found: %s\n", lpddoi->tszName); } return DIENUM_CONTINUE; } @@ -299,7 +299,7 @@ HRESULT hr; hr = cDI->CreateDevice(lpddi->guidInstance, (LPDIRECTINPUTDEVICE*) &cDIDevice, NULL); if FAILED(hr) { - printfDebug("CreateDevice failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "CreateDevice failed\n"); cCreate_success = false; return; } @@ -312,14 +312,14 @@ static void SetupController() { // set Controller data format if(cDIDevice->SetDataFormat(&c_dfDIJoystick2) != DI_OK) { - printfDebug("SetDataFormat failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "SetDataFormat failed\n"); cCreate_success = false; return; } // set the cooperative level if(cDIDevice->SetCooperativeLevel(hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { - printfDebug("SetCooperativeLevel failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "SetCooperativeLevel failed\n"); cCreate_success = false; return; } @@ -337,7 +337,7 @@ if(cHasx) { diprg.diph.dwObj = DIJOFS_X; if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { - printfDebug("SetProperty(DIJOFS_X) failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "SetProperty(DIJOFS_X) failed\n"); cCreate_success = false; return; } @@ -347,7 +347,7 @@ if(cHasrx) { diprg.diph.dwObj = DIJOFS_RX; if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { - printfDebug("SetProperty(DIJOFS_RX) failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "SetProperty(DIJOFS_RX) failed\n"); cCreate_success = false; return; } @@ -358,7 +358,7 @@ if(cHasy) { diprg.diph.dwObj = DIJOFS_Y; if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { - printfDebug("SetProperty(DIJOFS_Y) failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "SetProperty(DIJOFS_Y) failed\n"); cCreate_success = false; return; } @@ -368,7 +368,7 @@ if(cHasry) { diprg.diph.dwObj = DIJOFS_RY; if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { - printfDebug("SetProperty(DIJOFS_RY) failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "SetProperty(DIJOFS_RY) failed\n"); cCreate_success = false; return; } @@ -378,7 +378,7 @@ if(cHasz) { diprg.diph.dwObj = DIJOFS_Z; if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { - printfDebug("SetProperty(DIJOFS_Z) failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "SetProperty(DIJOFS_Z) failed\n"); cCreate_success = false; return; } @@ -389,7 +389,7 @@ if(cHasrz) { diprg.diph.dwObj = DIJOFS_RZ; if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { - printfDebug("SetProperty(DIJOFS_RZ) failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "SetProperty(DIJOFS_RZ) failed\n"); cCreate_success = false; return; } @@ -402,7 +402,7 @@ if(cHasslider) { diprg.diph.dwObj = DIJOFS_Z; if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { - printfDebug("SetProperty(DIJOFS_Z(SLIDER)) failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "SetProperty(DIJOFS_Z(SLIDER)) failed\n"); cCreate_success = false; return; } @@ -435,9 +435,9 @@ // if so, then attempt to reacquire. if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { cDIDevice->Acquire(); - printfDebug("DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); + printfDebug(org_lwjgl_Sys_DEBUG, "DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); } - printfDebug("Error getting controller state: %d\n", hRes); + printfDebug(org_lwjgl_Sys_DEBUG, "Error getting controller state: %d\n", hRes); return; } Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- org_lwjgl_input_Keyboard.cpp 15 Dec 2003 11:49:17 -0000 1.26 +++ org_lwjgl_input_Keyboard.cpp 20 Dec 2003 14:01:31 -0000 1.27 @@ -110,7 +110,7 @@ HRESULT ret = lpdiKeyboard->Acquire(); if(FAILED(ret)) { - printfDebug("Failed to acquire keyboard\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to acquire keyboard\n"); } } @@ -245,19 +245,19 @@ } } } else if (ret == DI_BUFFEROVERFLOW) { - printfDebug("Keyboard buffer overflowed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Keyboard buffer overflowed\n"); } else if (ret == DIERR_INPUTLOST) { - printfDebug("Input lost\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Input lost\n"); } else if (ret == DIERR_NOTACQUIRED) { - printfDebug("not acquired\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "not acquired\n"); } else if (ret == DIERR_INVALIDPARAM) { - printfDebug("invalid parameter\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "invalid parameter\n"); } else if (ret == DIERR_NOTBUFFERED) { - printfDebug("not buffered\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "not buffered\n"); } else if (ret == DIERR_NOTINITIALIZED) { - printfDebug("not inited\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "not inited\n"); } else { - printfDebug("unknown keyboard error\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "unknown keyboard error\n"); } return num_events; } Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- org_lwjgl_input_Mouse.cpp 15 Dec 2003 11:49:17 -0000 1.40 +++ org_lwjgl_input_Mouse.cpp 20 Dec 2003 14:01:31 -0000 1.41 @@ -135,7 +135,7 @@ /* Aquire the Mouse */ hr = mDIDevice->Acquire(); if(FAILED(hr)) { - printfDebug("Failed to acquire mouse\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to acquire mouse\n"); } } @@ -197,19 +197,19 @@ if (ret == DI_OK) { return bufferButtons(bufsize, rgdod); } else if (ret == DI_BUFFEROVERFLOW) { - printfDebug("Buffer overflowed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Buffer overflowed\n"); } else if (ret == DIERR_INPUTLOST) { - printfDebug("Input lost\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Input lost\n"); } else if (ret == DIERR_NOTACQUIRED) { - printfDebug("not acquired\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "not acquired\n"); } else if (ret == DIERR_INVALIDPARAM) { - printfDebug("invalid parameter\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "invalid parameter\n"); } else if (ret == DIERR_NOTBUFFERED) { - printfDebug("not buffered\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "not buffered\n"); } else if (ret == DIERR_NOTINITIALIZED) { - printfDebug("not inited\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "not inited\n"); } else { - printfDebug("unknown keyboard error\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "unknown keyboard error\n"); } return 0; } @@ -331,7 +331,7 @@ HRESULT hr; hr = mDIDevice->EnumObjects(EnumMouseObjectsCallback, NULL, DIDFT_ALL); if FAILED(hr) { - printfDebug("EnumObjects failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "EnumObjects failed\n"); mCreate_success = false; return; } @@ -339,7 +339,7 @@ //check for > 4 buttons - need to clamp since we're using dx 5 if(mButtoncount > 4) { mButtoncount = 4; - printfDebug("WARNING: Clamping to 4 mouse buttons\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "WARNING: Clamping to 4 mouse buttons\n"); } mCreate_success = true; @@ -349,7 +349,7 @@ * Callback from EnumObjects. Called for each "object" on the Mouse. */ BOOL CALLBACK EnumMouseObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) { - printfDebug("found %s\n", lpddoi->tszName); + printfDebug(org_lwjgl_Sys_DEBUG, "found %s\n", lpddoi->tszName); if(lpddoi->guidType == GUID_Button) { mButtoncount++; } else if(lpddoi->guidType == GUID_XAxis) { @@ -357,7 +357,7 @@ } else if(lpddoi->guidType == GUID_ZAxis) { mHaswheel = true; } else { - printfDebug("Unhandled object found: %s\n", lpddoi->tszName); + printfDebug(org_lwjgl_Sys_DEBUG, "Unhandled object found: %s\n", lpddoi->tszName); } return DIENUM_CONTINUE; } @@ -369,7 +369,7 @@ HRESULT hr; hr = lpdi->CreateDevice(GUID_SysMouse, &mDIDevice, NULL); if FAILED(hr) { - printfDebug("CreateDevice failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "CreateDevice failed\n"); mCreate_success = false; return; } @@ -382,7 +382,7 @@ void SetupMouse() { // set Mouse data format if(mDIDevice->SetDataFormat(&c_dfDIMouse) != DI_OK) { - printfDebug("SetDataFormat failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "SetDataFormat failed\n"); mCreate_success = false; return; } @@ -397,7 +397,7 @@ // set the cooperative level if(mDIDevice->SetCooperativeLevel(hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { - printfDebug("SetCooperativeLevel failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "SetCooperativeLevel failed\n"); mCreate_success = false; return; } @@ -457,7 +457,7 @@ if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { mDIDevice->Acquire(); } else { - printfDebug("Error getting mouse state: %d\n", hRes); + printfDebug(org_lwjgl_Sys_DEBUG, "Error getting mouse state: %d\n", hRes); } } Index: org_lwjgl_opengl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- org_lwjgl_opengl_Window.cpp 15 Dec 2003 11:49:17 -0000 1.13 +++ org_lwjgl_opengl_Window.cpp 20 Dec 2003 14:01:31 -0000 1.14 @@ -97,7 +97,7 @@ return -1; } - printfDebug("Pixel format is %d\n", iPixelFormat); + printfDebug(org_lwjgl_Sys_DEBUG, "Pixel format is %d\n", iPixelFormat); // make that the pixel format of the device context if (SetPixelFormat(hdc, iPixelFormat, &pfd) == FALSE) { @@ -159,19 +159,19 @@ // Create input HRESULT ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL); if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION ) { - printfDebug("Failed to create directinput"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to create directinput"); switch (ret) { case DIERR_INVALIDPARAM : - printfDebug(" - Invalid parameter\n"); + printfDebug(org_lwjgl_Sys_DEBUG, " - Invalid parameter\n"); break; case DIERR_OLDDIRECTINPUTVERSION : - printfDebug(" - Old Version\n"); + printfDebug(org_lwjgl_Sys_DEBUG, " - Old Version\n"); break; case DIERR_OUTOFMEMORY : - printfDebug(" - Out Of Memory\n"); + printfDebug(org_lwjgl_Sys_DEBUG, " - Out Of Memory\n"); break; default: - printfDebug(" - Unknown failure\n"); + printfDebug(org_lwjgl_Sys_DEBUG, " - Unknown failure\n"); } return false; } else { @@ -186,23 +186,23 @@ { // Release DirectInput if (lpdi != NULL) { - printfDebug("Destroying directinput\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Destroying directinput\n"); lpdi->Release(); lpdi = NULL; } // Release device context if (hdc != NULL && hwnd != NULL) { - printfDebug("Releasing DC\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Releasing DC\n"); ReleaseDC(hwnd, hdc); } // Close the window if (hwnd != NULL) { - printfDebug("Destroy window\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Destroy window\n"); // Vape the window DestroyWindow(hwnd); - printfDebug("Destroyed window\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Destroyed window\n"); hwnd = NULL; } } @@ -312,10 +312,10 @@ windowClass.lpszClassName = WINDOWCLASSNAME; if (RegisterClass(&windowClass) == 0) { - printfDebug("Failed to register window class\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to register window class\n"); return false; } - printfDebug("Window registered\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Window registered\n"); oneShotInitialised = true; } @@ -397,11 +397,11 @@ NULL); if (hwnd == NULL) { - printfDebug("Failed to create window\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to create window\n"); return false; } - printfDebug("Created window\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Created window\n"); ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); @@ -558,7 +558,7 @@ // Delete the rendering context if (hglrc != NULL) { - printfDebug("Deleting GL context\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Deleting GL context\n"); wglDeleteContext(hglrc); hglrc = NULL; } |
|
From: Elias N. <eli...@us...> - 2003-12-20 14:01:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1:/tmp/cvs-serv21938/src/native/macosx Modified Files: hid.cpp org_lwjgl_Sys.cpp org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp Log Message: Implemented proper debug levels Index: hid.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/hid.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/hid.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- hid.cpp 15 Dec 2003 11:49:17 -0000 1.3 +++ hid.cpp 20 Dec 2003 14:01:30 -0000 1.4 @@ -123,7 +123,7 @@ static void addToDeviceQueue(hid_device_t *hid_dev, IOHIDElementCookie cookie, int index) { HRESULT result = (*hid_dev->device_queue)->addElement(hid_dev->device_queue, cookie, 0); if (result != S_OK) { - printfDebug("Could not add cookie to queue\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not add cookie to queue\n"); return; } CFDictionaryAddValue(hid_dev->cookie_map, cookie, (void *)index); @@ -191,7 +191,7 @@ CFDictionaryRef matching_dic = IOServiceMatching(kIOHIDDeviceKey); IOReturn err = IOServiceGetMatchingServices(kIOMasterPortDefault, matching_dic, &device_iterator); if (err != kIOReturnSuccess) { - printfDebug("Could not find matching devices\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not find matching devices\n"); return false; } while (!success && (hid_device = IOIteratorNext(device_iterator)) != NULL) { @@ -201,7 +201,7 @@ long usage_page; if (getDictLong(dev_props, CFSTR(kIOHIDPrimaryUsageKey), &usage) && getDictLong(dev_props, CFSTR(kIOHIDPrimaryUsagePageKey), &usage_page)) { - if (ATDEBUGLEVEL()) { + if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) { printf("Considering device '"); printProperty(dev_props, CFSTR(kIOHIDProductKey)); printf("', usage page %ld usage %ld\n", usage_page, usage); Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Sys.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- org_lwjgl_Sys.cpp 15 Dec 2003 11:49:17 -0000 1.10 +++ org_lwjgl_Sys.cpp 20 Dec 2003 14:01:30 -0000 1.11 @@ -64,7 +64,7 @@ static long queryTime(void) { struct timeval tv; if (gettimeofday(&tv, NULL) == -1) { - printfDebug("Could not read current time\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not read current time\n"); } long result = tv.tv_sec * 1000000l + tv.tv_usec; @@ -110,7 +110,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority (JNIEnv * env, jclass clazz, jint priority) { - printfDebug("WARNING: setProcessPriority unsupported\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "WARNING: setProcessPriority unsupported\n"); } /* Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- org_lwjgl_input_Keyboard.cpp 15 Dec 2003 11:49:17 -0000 1.19 +++ org_lwjgl_input_Keyboard.cpp 20 Dec 2003 14:01:30 -0000 1.20 @@ -70,12 +70,12 @@ static bool handleKey(UInt32 key_code, unsigned char state) { if (key_code >= KEYBOARD_SIZE) { - printfDebug("Key code >= %d %x\n", KEYBOARD_SIZE, (unsigned int)key_code); + printfDebug(org_lwjgl_Sys_DEBUG, "Key code >= %d %x\n", KEYBOARD_SIZE, (unsigned int)key_code); return false; } unsigned char mapped_code = key_map[key_code]; if (mapped_code == 0) { - printfDebug("unknown key code: %x\n", (unsigned int)key_code); + printfDebug(org_lwjgl_Sys_DEBUG, "unknown key code: %x\n", (unsigned int)key_code); return false; } return handleMappedKey(mapped_code, state); @@ -129,7 +129,7 @@ KeyboardLayoutRef layout; OSStatus err = KLGetCurrentKeyboardLayout(&layout); if (err != noErr) { - printfDebug("Could not get current keyboard layout\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get current keyboard layout\n"); return false; } @@ -143,7 +143,7 @@ success = success && GetEventParameter(event, kEventParamKeyboardType, typeUInt32, NULL, sizeof(keyboardType), NULL, &keyboardType) == noErr; success = success && GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifierKeyState), NULL, &modifierKeyState) == noErr; if (!success) { - printfDebug("Could not get event parameters for character translation\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event parameters for character translation\n"); return false; } err = KLGetKeyboardLayoutProperty(layout, kKLuchrData, (const void **)&uchrHandle); @@ -175,7 +175,7 @@ if (state) return writeAsciiChars(count, ascii_buffer); } else { - printfDebug("Could not translate key\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not translate key\n"); return false; } } @@ -186,7 +186,7 @@ UInt32 key_code; OSStatus err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(key_code), NULL, &key_code); if (err != noErr) { - printfDebug("Could not get event key code\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event key code\n"); return; } if (handleKey(key_code, 1) && !handleTranslation(event, true)) { @@ -199,7 +199,7 @@ UInt32 key_code; OSStatus err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(key_code), NULL, &key_code); if (err != noErr) { - printfDebug("Could not get event key code\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event key code\n"); return; } if (handleKey(key_code, 0) && !handleTranslation(event, false)) { @@ -222,7 +222,7 @@ UInt32 modifier_bits; OSStatus err = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifier_bits), NULL, &modifier_bits); if (err != noErr) { - printfDebug("Could not get event key code\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get event key code\n"); return; } handleModifier(modifier_bits, controlKey, 0x1d); Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- org_lwjgl_input_Mouse.cpp 15 Dec 2003 11:49:17 -0000 1.22 +++ org_lwjgl_input_Mouse.cpp 20 Dec 2003 14:01:30 -0000 1.23 @@ -70,7 +70,7 @@ static void handleButton(unsigned char button_index, jbyte state) { if (button_index >= NUM_BUTTONS) { - printfDebug("Button index %d out of range [0..%d]\n", button_index, NUM_BUTTONS); + printfDebug(org_lwjgl_Sys_DEBUG, "Button index %d out of range [0..%d]\n", button_index, NUM_BUTTONS); return; } button_states[button_index] = state; @@ -106,7 +106,7 @@ } } } - printfDebug("Recieved an unknown HID device event\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Recieved an unknown HID device event\n"); } } */ @@ -120,7 +120,7 @@ EventMouseButton button; OSStatus err = GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button); if (err != noErr) { - printfDebug("Could not get button parameter from event\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get button parameter from event\n"); return; } handleButton(button - 1, state); @@ -130,7 +130,7 @@ HIPoint delta; OSStatus err = GetEventParameter(event, kEventParamMouseDelta, typeHIPoint, NULL, sizeof(delta), NULL, &delta); if (err != noErr) { - printfDebug("Could not delta parameter from event\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not delta parameter from event\n"); return; } last_dx += (int)delta.x; @@ -141,7 +141,7 @@ long delta; OSStatus err = GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta); if (err != noErr) { - printfDebug("Could not delta parameter from event\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not delta parameter from event\n"); return; } last_dz += (int)delta; |
|
From: Elias N. <eli...@us...> - 2003-12-20 14:01:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv21938/src/native/common Modified Files: checkALerror.h checkGLerror.h common_tools.cpp common_tools.h extal.cpp extgl.cpp org_lwjgl_Sys.h Log Message: Implemented proper debug levels Index: checkALerror.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/checkALerror.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/checkALerror.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- checkALerror.h 15 Dec 2003 11:49:16 -0000 1.7 +++ checkALerror.h 20 Dec 2003 14:01:30 -0000 1.8 @@ -16,7 +16,7 @@ #define CHECK_AL_ERROR \ { \ - if (ATDEBUGLEVEL()) { \ + if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) { \ int err = alGetError(); \ if (err != AL_NO_ERROR) { \ jclass cls = env->FindClass("org/lwjgl/openal/OpenALException"); \ @@ -28,7 +28,7 @@ /* only available if deviceaddress is specified in method */ #define CHECK_ALC_ERROR \ { \ - if (ATDEBUGLEVEL()) { \ + if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) { \ int err = alcGetError((ALCdevice*) deviceaddress); \ if (err != AL_NO_ERROR) { \ jclass cls = env->FindClass("org/lwjgl/openal/OpenALException"); \ Index: checkGLerror.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/checkGLerror.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/checkGLerror.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- checkGLerror.h 15 Dec 2003 11:49:16 -0000 1.8 +++ checkGLerror.h 20 Dec 2003 14:01:30 -0000 1.9 @@ -16,7 +16,7 @@ #define CHECK_GL_ERROR \ { \ - if (ATDEBUGLEVEL()) { \ + if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) { \ int err = glGetError(); \ if (err != GL_NO_ERROR) { \ jclass cls = env->FindClass("org/lwjgl/opengl/OpenGLException"); \ Index: common_tools.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/common_tools.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- common_tools.cpp 15 Dec 2003 11:49:16 -0000 1.5 +++ common_tools.cpp 20 Dec 2003 14:01:30 -0000 1.6 @@ -39,18 +39,18 @@ #include "common_tools.h" -int debug_level = org_lwjgl_Sys_DEBUG_DISABLED; +int debug_level = org_lwjgl_Sys_NONE; void setDebugLevel(int level) { debug_level = level; } -int printfDebug(const char *format, ...) { +void printfDebug(int level, const char *format, ...) { va_list ap; va_start(ap, format); - int result = vprintf(format, ap); + if (debug_level >= level) + vprintf(format, ap); va_end(ap); - return result; } static void incListStart(event_queue_t *queue) { @@ -65,7 +65,7 @@ void putEventElement(event_queue_t *queue, unsigned char byte) { int next_index = (queue->list_end + 1)%EVENT_BUFFER_SIZE; if (next_index == queue->list_start) { - printfDebug("Event buffer overflow!\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Event buffer overflow!\n"); return; } queue->input_event_buffer[queue->list_end] = byte; Index: common_tools.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/common_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- common_tools.h 15 Dec 2003 11:49:16 -0000 1.4 +++ common_tools.h 20 Dec 2003 14:01:30 -0000 1.5 @@ -47,7 +47,7 @@ // Must be x * max_event_size + 1 #define EVENT_BUFFER_SIZE (25 * 4 + 1) -#define ATDEBUGLEVEL() (debug_level >= org_lwjgl_Sys_DEBUG_ENABLED) +#define ATDEBUGLEVEL(level) (debug_level >= level) typedef struct { unsigned char input_event_buffer[EVENT_BUFFER_SIZE]; @@ -65,6 +65,6 @@ extern void throwException(JNIEnv *env, const char *msg); extern void throwOpenALException(JNIEnv * env, const char * err); extern void setDebugLevel(int level); -extern int printfDebug(const char *format, ...); +extern void printfDebug(int level, const char *format, ...); #endif Index: extal.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extal.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extal.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- extal.cpp 15 Dec 2003 11:49:16 -0000 1.13 +++ extal.cpp 20 Dec 2003 14:01:30 -0000 1.14 @@ -182,7 +182,7 @@ static void* GetFunctionPointer(const char* function) { void *p = NativeGetFunctionPointer(function); if (p == NULL) { - printfDebug("Could not locate symbol %s\n", function); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not locate symbol %s\n", function); } return p; } @@ -193,11 +193,11 @@ static bool LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) { jsize pathcount = env->GetArrayLength(oalPaths); - printfDebug("Found %d OpenAL paths\n", (int)pathcount); + printfDebug(org_lwjgl_Sys_DEBUG, "Found %d OpenAL paths\n", (int)pathcount); for(int i=0;i<pathcount;i++) { jstring path = (jstring) env->GetObjectArrayElement(oalPaths, i); const char *path_str = env->GetStringUTFChars(path, NULL); - printfDebug("Testing '%s'\n", path_str); + printfDebug(org_lwjgl_Sys_DEBUG, "Testing '%s'\n", path_str); #ifdef _WIN32 handleOAL = LoadLibrary(path_str); #endif @@ -208,7 +208,7 @@ handleOAL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR); #endif if (handleOAL != NULL) { - printfDebug("Found OpenAL at '%s'\n", path_str); + printfDebug(org_lwjgl_Sys_DEBUG, "Found OpenAL at '%s'\n", path_str); return true; } env->ReleaseStringUTFChars(path, path_str); Index: extgl.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extgl.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- extgl.cpp 15 Dec 2003 11:49:16 -0000 1.6 +++ extgl.cpp 20 Dec 2003 14:01:30 -0000 1.7 @@ -1339,7 +1339,7 @@ err = FindFolder (kSystemDomain, kFrameworksFolderType, false, &fileRefParam.ioVRefNum, &fileRefParam.ioDirID); if (noErr != err) { - printfDebug("Could not find frameworks folder\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not find frameworks folder\n"); return NULL; } @@ -1350,7 +1350,7 @@ if (noErr != err) { - printfDebug("Could make FSref to frameworks folder\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could make FSref to frameworks folder\n"); return NULL; } @@ -1359,7 +1359,7 @@ bundleURLOpenGL = CFURLCreateFromFSRef (kCFAllocatorDefault, &fileRef); if (!bundleURLOpenGL) { - printfDebug("Could create framework URL\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could create framework URL\n"); return NULL; } @@ -1367,14 +1367,14 @@ CFRelease (bundleURLOpenGL); if (bundle_ref == NULL) { - printfDebug("Could not load framework\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not load framework\n"); return NULL; } // if the code was successfully loaded, look for our function. if (!CFBundleLoadExecutable(bundle_ref)) { - printfDebug("Could not load MachO executable\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not load MachO executable\n"); CFRelease(bundle_ref); return NULL; } @@ -1403,7 +1403,7 @@ { t = GetProcAddress(lib_glu_handle, name); if (t == NULL) { - printfDebug("Could not locate symbol %s\n", name); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not locate symbol %s\n", name); extgl_error = true; } } @@ -1420,7 +1420,7 @@ { t = dlsym(lib_glu_handle, name); if (t == NULL) { - printfDebug("Could not locate symbol %s\n", name); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not locate symbol %s\n", name); extgl_error = true; } } @@ -1434,7 +1434,7 @@ if (func_pointer == NULL) { func_pointer = CFBundleGetFunctionPointerForName(agl_bundle_ref, str); if (func_pointer == NULL) { - printfDebug("Could not locate symbol %s\n", name); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not locate symbol %s\n", name); extgl_error = true; } } @@ -1449,7 +1449,7 @@ GLubyte *where, *terminator; if (extensions == NULL) { - printfDebug("NULL extension string\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "NULL extension string\n"); extgl_error = true; return false; } @@ -3291,12 +3291,12 @@ { lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); if (lib_gl_handle == NULL) { - printfDebug("Error loading libGL.so.1: %s\n", dlerror()); + printfDebug(org_lwjgl_Sys_DEBUG, "Error loading libGL.so.1: %s\n", dlerror()); return false; } lib_glu_handle = dlopen("libGLU.so.1", RTLD_LAZY | RTLD_GLOBAL); if (lib_glu_handle == NULL) { - printfDebug("Error loading libGLU.so.1: %s\n", dlerror()); + printfDebug(org_lwjgl_Sys_DEBUG, "Error loading libGLU.so.1: %s\n", dlerror()); dlclose(lib_gl_handle); return false; } Index: org_lwjgl_Sys.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_Sys.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_Sys.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- org_lwjgl_Sys.h 15 Dec 2003 11:49:16 -0000 1.16 +++ org_lwjgl_Sys.h 20 Dec 2003 14:01:30 -0000 1.17 @@ -7,11 +7,18 @@ #ifdef __cplusplus extern "C" { #endif -/* Inaccessible static: _00024assertionsDisabled */ -#undef org_lwjgl_Sys_DEBUG_DISABLED -#define org_lwjgl_Sys_DEBUG_DISABLED 1L -#undef org_lwjgl_Sys_DEBUG_ENABLED -#define org_lwjgl_Sys_DEBUG_ENABLED 2L +#undef org_lwjgl_Sys_DEBUG +#define org_lwjgl_Sys_DEBUG 6L +#undef org_lwjgl_Sys_INFO +#define org_lwjgl_Sys_INFO 5L +#undef org_lwjgl_Sys_WARN +#define org_lwjgl_Sys_WARN 4L +#undef org_lwjgl_Sys_ERROR +#define org_lwjgl_Sys_ERROR 3L +#undef org_lwjgl_Sys_FATAL +#define org_lwjgl_Sys_FATAL 2L +#undef org_lwjgl_Sys_NONE +#define org_lwjgl_Sys_NONE 1L #undef org_lwjgl_Sys_LOW_PRIORITY #define org_lwjgl_Sys_LOW_PRIORITY -1L #undef org_lwjgl_Sys_NORMAL_PRIORITY @@ -21,8 +28,7 @@ #undef org_lwjgl_Sys_REALTIME_PRIORITY #define org_lwjgl_Sys_REALTIME_PRIORITY 2L /* Inaccessible static: LIBRARY_NAME */ -/* Inaccessible static: DEBUG */ -/* Inaccessible static: class_00024org_00024lwjgl_00024Sys */ +/* Inaccessible static: debug_level */ /* * Class: org_lwjgl_Sys * Method: setDebugLevel |
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv21938/src/native/linux Modified Files: extxcursor.cpp org_lwjgl_Display.cpp org_lwjgl_Sys.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_Pbuffer.cpp org_lwjgl_opengl_Window.cpp Log Message: Implemented proper debug levels Index: extxcursor.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/extxcursor.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/extxcursor.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- extxcursor.cpp 15 Dec 2003 11:49:17 -0000 1.5 +++ extxcursor.cpp 20 Dec 2003 14:01:30 -0000 1.6 @@ -40,7 +40,7 @@ load_success = false; xcursor_handle = dlopen(xcursor_lib_name, RTLD_GLOBAL | RTLD_LAZY); if (xcursor_handle == NULL) { - printfDebug("Could not load %s: %s\n", xcursor_lib_name, dlerror()); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not load %s: %s\n", xcursor_lib_name, dlerror()); return load_success; } loadFunctionPointers(); Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- org_lwjgl_Display.cpp 15 Dec 2003 11:49:17 -0000 1.43 +++ org_lwjgl_Display.cpp 20 Dec 2003 14:01:30 -0000 1.44 @@ -61,14 +61,14 @@ int event_base, error_base; if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) { - printfDebug("XF86VidMode extension not available\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "XF86VidMode extension not available\n"); return false; } if (!XF86VidModeQueryVersion(disp, major, minor)) { - printfDebug("Could not determine XF86VidMode version\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not determine XF86VidMode version\n"); return false; } - printfDebug("XF86VidMode extension version %i.%i\n", *major, *minor); + printfDebug(org_lwjgl_Sys_DEBUG, "XF86VidMode extension version %i.%i\n", *major, *minor); return true; } @@ -84,15 +84,15 @@ int num_modes, i; XF86VidModeModeInfo **avail_modes; if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { - printfDebug("Could not get display modes\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get display modes\n"); return false; } XF86VidModeLockModeSwitch(disp, screen, 0); for ( i = 0; i < num_modes; ++i ) { - printfDebug("Mode %d: %dx%d\n", i, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay); + printfDebug(org_lwjgl_Sys_DEBUG, "Mode %d: %dx%d\n", i, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay); if (avail_modes[i]->hdisplay == width && avail_modes[i]->vdisplay == height) { if (!XF86VidModeSwitchToMode(disp, screen, avail_modes[i])) { - printfDebug("Could not switch mode\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not switch mode\n"); break; } if (lock_mode) @@ -118,11 +118,11 @@ static int getGammaRampLength(Display *disp, int screen) { int minor_ver, major_ver, ramp_size; if (!getVidModeExtensionVersion(disp, screen, &major_ver, &minor_ver) || major_ver < 2) { - printfDebug("XF86VidMode extension version >= 2 not found\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "XF86VidMode extension version >= 2 not found\n"); return 0; } if (XF86VidModeGetGammaRampSize(disp, screen, &ramp_size) == False) { - printfDebug("XF86VidModeGetGammaRampSize call failed\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "XF86VidModeGetGammaRampSize call failed\n"); return 0; } return ramp_size; @@ -136,18 +136,18 @@ int screen; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { - printfDebug("Could not open X connection\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not open X connection\n"); return; } screen = DefaultScreen(disp); if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { - printfDebug("Could not get display modes\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get display modes\n"); } saved_width = avail_modes[0]->hdisplay; saved_height = avail_modes[0]->vdisplay; int bpp = XDefaultDepth(disp, screen); - printfDebug("Saved width, height %d, %d\n", saved_width, saved_height); + printfDebug(org_lwjgl_Sys_DEBUG, "Saved width, height %d, %d\n", saved_width, saved_height); jclass jclass_DisplayMode = env->FindClass("org/lwjgl/DisplayMode"); jmethodID ctor = env->GetMethodID(jclass_DisplayMode, "<init>", "(IIII)V"); jobject newMode = env->NewObject(jclass_DisplayMode, ctor, saved_width, saved_height, bpp, 0); @@ -195,7 +195,7 @@ Display *disp = XOpenDisplay(NULL); if (disp == NULL) { - printfDebug("Could not open X connection\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not open X connection\n"); return; } screen = DefaultScreen(disp); @@ -216,7 +216,7 @@ XF86VidModeModeInfo **avail_modes; if (disp == NULL) { - printfDebug("Could not open X connection\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not open X connection\n"); return NULL; } @@ -224,7 +224,7 @@ int bpp = XDefaultDepth(disp, screen); if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { - printfDebug("Could not get display modes\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not get display modes\n"); XCloseDisplay(disp); return NULL; } Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Sys.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- org_lwjgl_Sys.cpp 15 Dec 2003 11:49:17 -0000 1.20 +++ org_lwjgl_Sys.cpp 20 Dec 2003 14:01:30 -0000 1.21 @@ -63,7 +63,7 @@ static long queryTime(void) { struct timeval tv; if (gettimeofday(&tv, NULL) == -1) { - printfDebug("Could not read current time\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not read current time\n"); } long result = tv.tv_sec * 1000000l + tv.tv_usec; @@ -117,7 +117,7 @@ // Reset scheduler to normal sched_pri.sched_priority = 0; if (sched_setscheduler(0, SCHED_OTHER, &sched_pri) != 0) { - printfDebug("Could not set realtime priority\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not set realtime priority\n"); return; } } @@ -127,12 +127,12 @@ min_pri = sched_get_priority_min(SCHED_FIFO); max_pri = sched_get_priority_max(SCHED_FIFO); if (min_pri == -1 || max_pri == -1) { - printfDebug("Failed to set realtime priority\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to set realtime priority\n"); return; } sched_pri.sched_priority = (max_pri + min_pri)/2; if (sched_setscheduler(0, SCHED_FIFO, &sched_pri) != 0) { - printfDebug("Could not set realtime priority\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not set realtime priority\n"); return; } return; @@ -150,7 +150,7 @@ } if (setpriority(PRIO_PROCESS, 0, linux_priority) == -1) { - printfDebug("Failed to set priority.\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Failed to set priority.\n"); } } Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- org_lwjgl_input_Mouse.cpp 15 Dec 2003 11:49:17 -0000 1.42 +++ org_lwjgl_input_Mouse.cpp 20 Dec 2003 14:01:30 -0000 1.43 @@ -122,7 +122,7 @@ static bool blankCursor(void) { unsigned int best_width, best_height; if (XQueryBestCursor(getCurrentDisplay(), getCurrentWindow(), 1, 1, &best_width, &best_height) == 0) { - printfDebug("Could not query best cursor size\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not query best cursor size\n"); return false; } Pixmap mask = XCreatePixmap(getCurrentDisplay(), getCurrentWindow(), best_width, best_height, 1); @@ -199,10 +199,10 @@ event.xmotion.y > current_y - POINTER_WARP_BORDER && event.xmotion.y < current_y + POINTER_WARP_BORDER) break; - printfDebug("Skipped event searching for warp event %d, %d\n", event.xmotion.x, event.xmotion.y); + printfDebug(org_lwjgl_Sys_DEBUG, "Skipped event searching for warp event %d, %d\n", event.xmotion.x, event.xmotion.y); } if (i == WARP_RETRY) - printfDebug("Never got warp event\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Never got warp event\n"); } static void warpPointer(void) { Index: org_lwjgl_opengl_Pbuffer.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- org_lwjgl_opengl_Pbuffer.cpp 15 Dec 2003 11:49:17 -0000 1.5 +++ org_lwjgl_opengl_Pbuffer.cpp 20 Dec 2003 14:01:30 -0000 1.6 @@ -161,7 +161,7 @@ GLXPbuffer buffer = buffer_info->buffer; GLXContext context = buffer_info->context; if (glXMakeContextCurrent(getCurrentDisplay(), buffer, buffer, context) == False) { - printfDebug("Could not make pbuffer current"); + printfDebug(org_lwjgl_Sys_DEBUG, "Could not make pbuffer current"); } } Index: org_lwjgl_opengl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- org_lwjgl_opengl_Window.cpp 15 Dec 2003 11:49:17 -0000 1.12 +++ org_lwjgl_opengl_Window.cpp 20 Dec 2003 14:01:30 -0000 1.13 @@ -208,7 +208,7 @@ } win = XCreateWindow(disp, root_win, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); XFreeColormap(disp, cmap); - printfDebug("Created window\n"); + printfDebug(org_lwjgl_Sys_DEBUG, "Created window\n"); current_win = win; Java_org_lwjgl_opengl_Window_nSetTitle(env, NULL, title); XSizeHints * size_hints = XAllocSizeHints(); @@ -381,7 +381,7 @@ throwException(env, "Could not create visual info from FB config"); return false; } - if (ATDEBUGLEVEL()) + if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) dumpVisualInfo(disp, vis_info); createWindow(env, disp, screen, vis_info, title, x, y, width, height, fscreen); glx_window = glXCreateWindow(disp, configs[0], getCurrentWindow(), NULL); @@ -397,7 +397,7 @@ throwException(env, "Could not find a matching pixel format"); return false; } - if (ATDEBUGLEVEL()) + if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) dumpVisualInfo(disp, vis_info); context = glXCreateContext(disp, vis_info, NULL, True); if (context == NULL) { @@ -463,7 +463,7 @@ throwException(env, "Could not init gl function pointers"); return; } - if (ATDEBUGLEVEL()) { + if (ATDEBUGLEVEL(org_lwjgl_Sys_DEBUG)) { const GLubyte * extensions = glGetString(GL_EXTENSIONS); printf("Supported extensions: %s\n", extensions); } |
|
From: Elias N. <eli...@us...> - 2003-12-20 14:01:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1:/tmp/cvs-serv21938/src/java/org/lwjgl/openal Modified Files: BaseAL.java Log Message: Implemented proper debug levels Index: BaseAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- BaseAL.java 15 Dec 2003 11:49:16 -0000 1.23 +++ BaseAL.java 20 Dec 2003 14:01:30 -0000 1.24 @@ -142,9 +142,7 @@ private static String getPathFromJWS(String libname) { try { - if(Sys.atDebugLevel()) { - System.out.println("JWS Classloader looking for: " + libname); - } + Sys.log(Sys.DEBUG, "JWS Classloader looking for: " + libname); Object o = BaseAL.class.getClassLoader(); Class c = o.getClass(); @@ -154,10 +152,7 @@ return (String) findLibrary.invoke(o, arguments); } catch (Exception e) { - if(Sys.atDebugLevel()) { - System.out.println("Failure locating OpenAL using classloader:"); - e.printStackTrace(); - } + Sys.log(Sys.INFO, "Failure locating OpenAL using classloader:" + e); } return null; } |
|
From: Elias N. <eli...@us...> - 2003-12-20 14:01:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv21938/src/java/org/lwjgl Modified Files: Display.java Sys.java Log Message: Implemented proper debug levels Index: Display.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- Display.java 15 Dec 2003 11:49:16 -0000 1.35 +++ Display.java 20 Dec 2003 14:01:30 -0000 1.36 @@ -80,9 +80,7 @@ static { System.loadLibrary(Sys.getLibraryName()); init(); - if (Sys.atDebugLevel()) { - System.out.println("Adapter: "+getAdapter()+" Version: "+getVersion()); - } + Sys.log(Sys.DEBUG, "Adapter: "+getAdapter()+" Version: "+getVersion()); } /** @@ -120,9 +118,7 @@ DisplayMode[] filteredModes = new DisplayMode[modes.size()]; modes.toArray(filteredModes); - if (Sys.atDebugLevel()) { - System.out.println("Removed " + (unfilteredModes.length - filteredModes.length) + " duplicate displaymodes"); - } + Sys.log(Sys.DEBUG, "Removed " + (unfilteredModes.length - filteredModes.length) + " duplicate displaymodes"); return filteredModes; } @@ -239,9 +235,7 @@ gammaRamp.put(i, rampEntry); } setGammaRamp(gammaRamp); - if (Sys.atDebugLevel()) { - System.out.println("Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast); - } + Sys.log(Sys.DEBUG, "Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast); } /** Index: Sys.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- Sys.java 15 Dec 2003 11:49:16 -0000 1.33 +++ Sys.java 20 Dec 2003 14:01:30 -0000 1.34 @@ -48,8 +48,12 @@ */ public final class Sys { /** Debug level constants */ - public static final int DEBUG_DISABLED = 1; - public static final int DEBUG_ENABLED = 2; + public static final int DEBUG = 6; + public static final int INFO = 5; + public static final int WARN = 4; + public static final int ERROR = 3; + public static final int FATAL = 2; + public static final int NONE = 1; /** Low process priority. @see #setProcessPriority() */ public static final int LOW_PRIORITY = -1; @@ -84,22 +88,28 @@ private static String LIBRARY_NAME = "lwjgl"; /** - * Debug level. This will tell you if you are using the debug version of - * the library, and whether assertions are enabled or not. + * Debug level. */ - public static final int DEBUG; + public static final int debug_level; static { - int _debug = DEBUG_DISABLED; - try { - assert false; - } catch (AssertionError e) { - // Assertions are enabled, so we'll enabled debugging - _debug = DEBUG_ENABLED; - } finally { - DEBUG = _debug; - initialize(); + String debug_level_prop = System.getProperty("lwjgl.debuglevel", "NONE"); + int _debug = NONE; + if (debug_level_prop.equals("DEBUG")) { + _debug = DEBUG; + } else if (debug_level_prop.equals("INFO")) { + _debug = INFO; + } else if (debug_level_prop.equals("WARN")) { + _debug = WARN; + } else if (debug_level_prop.equals("ERROR")) { + _debug = ERROR; + } else if (debug_level_prop.equals("FATAL")) { + _debug = FATAL; + } else if (debug_level_prop.equals("NONE")) { + _debug = NONE; } + debug_level = _debug; + initialize(); } /** @@ -114,9 +124,21 @@ */ private Sys() { } - - public static boolean atDebugLevel() { - return DEBUG >= DEBUG_ENABLED; + + /** + * Prints the given message to System.err if atDebugLevel(debug_level) + * is true. + */ + public static void log(int debug_level, String msg) { + if (atDebugLevel(debug_level)) + System.err.println(msg); + } + + /** + * @return true if the debug level is greater than or equal to level + */ + public static boolean atDebugLevel(int level) { + return debug_level >= level; } /** @@ -124,7 +146,7 @@ */ private static void initialize() { System.loadLibrary(LIBRARY_NAME); - setDebugLevel(DEBUG); + setDebugLevel(debug_level); setTime(0); Runtime.getRuntime().addShutdownHook(new Thread() { |
|
From: Elias N. <eli...@us...> - 2003-12-20 14:01:33
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv21938/src/java/org/lwjgl/opengl Modified Files: GLCaps.java Log Message: Implemented proper debug levels Index: GLCaps.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLCaps.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLCaps.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- GLCaps.java 15 Dec 2003 11:49:16 -0000 1.13 +++ GLCaps.java 20 Dec 2003 14:01:30 -0000 1.14 @@ -162,15 +162,11 @@ } private static void setExtensionFields(HashSet exts, HashMap field_map) { - if(org.lwjgl.Sys.atDebugLevel()) { - System.out.println("Available extensions:"); - } + Sys.log(Sys.DEBUG, "Available extensions:"); Iterator it = exts.iterator(); while (it.hasNext()) { String ext = (String)it.next(); - if(org.lwjgl.Sys.atDebugLevel()) { - System.out.println(ext); - } + Sys.log(Sys.DEBUG, ext); Field f = (Field)field_map.get(ext); if (f != null) { |
|
From: Elias N. <eli...@us...> - 2003-12-15 12:18:18
|
Update of /cvsroot/java-game-lib/LWJGL/src/native In directory sc8-pr-cvs1:/tmp/cvs-serv13234/src/native Removed Files: build_debug.sh Log Message: Removed debug build scripts --- build_debug.sh DELETED --- CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/build_debug.sh |
|
From: Elias N. <eli...@us...> - 2003-12-15 12:18:18
|
Update of /cvsroot/java-game-lib/LWJGL In directory sc8-pr-cvs1:/tmp/cvs-serv13234 Modified Files: build.xml Log Message: Removed debug build scripts Index: build.xml CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/build.xml =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/build.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- build.xml 25 Nov 2003 22:34:07 -0000 1.13 +++ build.xml 15 Dec 2003 12:18:15 -0000 1.14 @@ -49,7 +49,6 @@ <patternset id="lwjgl-win32.fileset"> <patternset refid="lwjgl-common.fileset"/> <include name="lwjgl.dll"/> - <include name="lwjgl_d.dll"/> <include name="lwjglaudio.dll"/> </patternset> @@ -57,7 +56,6 @@ <patternset id="lwjgl-linux.fileset"> <patternset refid="lwjgl-common.fileset"/> <include name="liblwjgl.so"/> - <include name="liblwjgl_d.so"/> <include name="libopenal.so"/> </patternset> @@ -65,7 +63,6 @@ <patternset id="lwjgl-macosx.fileset"> <patternset refid="lwjgl-common.fileset"/> <include name="liblwjgl.jnilib"/> - <include name="liblwjgl_d.jnilib"/> <include name="openal.dylib"/> </patternset> @@ -187,13 +184,6 @@ </fileset> </apply> <move file="${lwjgl.src.native}/.libs/liblwjgl.0.0.0" tofile="${lwjgl.lib}/liblwjgl.so"/> - - <apply executable="sh" dir="${lwjgl.src.native}"> - <fileset dir="${lwjgl.src.native}"> - <include name="build_debug.sh"/> - </fileset> - </apply> - <move file="${lwjgl.src.native}/.libs/liblwjgl.0.0.0" tofile="${lwjgl.lib}/liblwjgl_d.so"/> </target> <!-- Compiles LWJGL on Mac OS X platforms --> @@ -206,12 +196,6 @@ </apply> <move file="${lwjgl.src.native}/.libs/liblwjgl.0.0.0" tofile="${lwjgl.lib}/liblwjgl.jnilib"/> - <apply executable="sh" dir="${lwjgl.src.native}"> - <fileset dir="${lwjgl.src.native}"> - <include name="build_debug.sh"/> - </fileset> - </apply> - <move file="${lwjgl.src.native}/.libs/liblwjgl.0.0.0" tofile="${lwjgl.lib}/liblwjgl_d.jnilib"/> </target> <!-- Packages the files --> @@ -377,4 +361,4 @@ <target name="internal_clean"> <delete dir="${lwjgl.temp}" taskname="cleanup"/> </target> -</project> \ No newline at end of file +</project> |
|
From: Elias N. <eli...@us...> - 2003-12-15 11:49:21
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/win32 In directory sc8-pr-cvs1:/tmp/cvs-serv8597/src/native/win32 Modified Files: org_lwjgl_Display.cpp org_lwjgl_Sys.cpp org_lwjgl_input_Controller.cpp org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_Window.cpp Log Message: Replaced debug libraries with runtime debug condition Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Display.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -u -d -r1.55 -r1.56 --- org_lwjgl_Display.cpp 10 Nov 2003 01:41:57 -0000 1.55 +++ org_lwjgl_Display.cpp 15 Dec 2003 11:49:17 -0000 1.56 @@ -45,8 +45,8 @@ #define WINDOWCLASSNAME "LWJGLWINDOW" -jobjectArray GetAvailableDisplayModesEx(JNIEnv * env); -jobjectArray GetAvailableDisplayModes(JNIEnv * env); +static jobjectArray GetAvailableDisplayModesEx(JNIEnv * env); +static jobjectArray GetAvailableDisplayModes(JNIEnv * env); bool modeSet = false; // Whether we've done a display mode change WORD* originalGamma = new WORD[256 * 3]; // Original gamma settings WORD* currentGamma = new WORD[256 * 3]; // Current gamma settings @@ -62,9 +62,7 @@ { jobjectArray result = GetAvailableDisplayModesEx(env); if (result == NULL) { -#ifdef _DEBUG - printf("Extended display mode selection failed, using fallback\n"); -#endif + printfDebug("Extended display mode selection failed, using fallback\n"); result = GetAvailableDisplayModes(env); } return result; @@ -73,7 +71,7 @@ /** * Choose displaymodes using extended codepath (multiple displaydevices) */ -jobjectArray GetAvailableDisplayModesEx(JNIEnv * env) { +static jobjectArray GetAvailableDisplayModesEx(JNIEnv * env) { typedef BOOL (WINAPI * EnumDisplayDevicesAPROC)(IN LPCSTR lpDevice, IN DWORD iDevNum, OUT PDISPLAY_DEVICEA lpDisplayDevice, IN DWORD dwFlags); typedef BOOL (WINAPI * EnumDisplaySettingsExAPROC)(IN LPCSTR lpszDeviceName, IN DWORD iModeNum, OUT LPDEVMODEA lpDevMode, IN DWORD dwFlags); EnumDisplayDevicesAPROC EnumDisplayDevicesA; @@ -81,9 +79,7 @@ HMODULE lib_handle = LoadLibrary("user32.dll"); if (lib_handle == NULL) { -#ifdef _DEBUG - printf("Could not load user32.dll\n"); -#endif + printfDebug("Could not load user32.dll\n"); return NULL; } EnumDisplayDevicesA = (EnumDisplayDevicesAPROC)GetProcAddress(lib_handle, "EnumDisplayDevicesA"); @@ -105,25 +101,18 @@ DevMode.dmSize = sizeof(DEVMODE); DisplayDevice.cb = sizeof(DISPLAY_DEVICE); - //enumerate all displays, and all of their displaymodes + //enumerate all displays, and all of their displaymodes while(EnumDisplayDevicesA(NULL, i++, &DisplayDevice, 0) != 0) { -#ifdef _DEBUG - printf("Querying %s device\n", DisplayDevice.DeviceString); -#endif + printfDebug("Querying %s device\n", DisplayDevice.DeviceString); j = 0; while(EnumDisplaySettingsExA((const char *) DisplayDevice.DeviceName, j++, &DevMode, 0) != 0) { -//#ifdef _DEBUG -// printf("Checking setting #%d\n", j); -//#endif if (DevMode.dmBitsPerPel > 8) { AvailableModes++; } } } -#ifdef _DEBUG - printf("Found %d displaymodes\n", AvailableModes); -#endif + printfDebug("Found %d displaymodes\n", AvailableModes); // now that we have the count create the classes, and add 'em all - we'll remove dups in Java // Allocate an array of DisplayModes big enough @@ -154,7 +143,7 @@ /** * Choose displaymodes using standard codepath (single displaydevice) */ -jobjectArray GetAvailableDisplayModes(JNIEnv * env) { +static jobjectArray GetAvailableDisplayModes(JNIEnv * env) { int i = 0, j = 0, n = 0; int AvailableModes = 0; @@ -171,9 +160,7 @@ } } -#ifdef _DEBUG - printf("Found %d displaymodes\n", AvailableModes); -#endif + printfDebug("Found %d displaymodes\n", AvailableModes); // now that we have the count create the classes, and add 'em all - we'll remove dups in Java // Allocate an array of DisplayModes big enough @@ -243,16 +230,12 @@ if (cdsret != DISP_CHANGE_SUCCESSFUL) { // Failed: so let's check to see if it's a wierd dual screen display -#ifdef _DEBUG - printf("Failed to set display mode... assuming dual monitors\n"); -#endif + printfDebug("Failed to set display mode... assuming dual monitors\n"); devmode.dmPelsWidth = width * 2; cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN); if (cdsret != DISP_CHANGE_SUCCESSFUL) { -#ifdef _DEBUG - printf("Failed to set display mode using dual monitors\n"); -#endif + printfDebug("Failed to set display mode using dual monitors\n"); throwException(env, "Failed to set display mode."); return; } @@ -295,9 +278,7 @@ HDC screenDC = GetDC(NULL); try { if (!SetDeviceGammaRamp(screenDC, originalGamma)) { - #ifdef _DEBUG - printf("Could not reset device gamma\n"); - #endif + printfDebug("Could not reset device gamma\n"); } } catch (...) { printf("Exception occurred in SetDeviceGammaRamp\n"); @@ -317,14 +298,12 @@ /* * Temporarily reset display settings. This is called when the window is minimized. */ -void tempResetDisplayMode() { +static void tempResetDisplayMode() { // Return device gamma to normal HDC screenDC = GetDC(NULL); try { if (!SetDeviceGammaRamp(screenDC, originalGamma)) { - #ifdef _DEBUG - printf("Could not reset device gamma\n"); - #endif + printfDebug("Could not reset device gamma\n"); } } catch (...) { printf("Exception occurred in SetDeviceGammaRamp\n"); @@ -332,9 +311,7 @@ ReleaseDC(NULL, screenDC); if (modeSet) { -#ifdef _DEBUG - printf("Attempting to temporarily reset the display mode\n"); -#endif + printfDebug("Attempting to temporarily reset the display mode\n"); modeSet = false; // Under Win32, all we have to do is: ChangeDisplaySettings(NULL, 0); @@ -344,14 +321,12 @@ /* * Put display settings back to what they were when the window is maximized. */ -void tempRestoreDisplayMode() { +static void tempRestoreDisplayMode() { // Restore gamma HDC screenDC = GetDC(NULL); try { if (!SetDeviceGammaRamp(screenDC, currentGamma)) { - #ifdef _DEBUG - printf("Could not restore device gamma\n"); - #endif + printfDebug("Could not restore device gamma\n"); } } catch (...) { printf("Exception occurred in SetDeviceGammaRamp\n"); @@ -359,18 +334,13 @@ ReleaseDC(NULL, screenDC); if (!modeSet) { - -#ifdef _DEBUG - printf("Attempting to restore the display mode\n"); -#endif + printfDebug("Attempting to restore the display mode\n"); modeSet = true; LONG cdsret = ChangeDisplaySettings(&devmode, CDS_FULLSCREEN); -#ifdef _DEBUG if (cdsret != DISP_CHANGE_SUCCESSFUL) { - printf("Failed to restore display mode\n"); + printfDebug("Failed to restore display mode\n"); } -#endif } } @@ -445,9 +415,7 @@ // Get the default gamma ramp try { if (GetDeviceGammaRamp(screenDC, originalGamma) == FALSE) { - #ifdef _DEBUG - printf("Failed to get initial device gamma\n"); - #endif + printfDebug("Failed to get initial device gamma\n"); } } catch (...) { printf("Exception occurred in GetDeviceGammaRamp\n"); @@ -457,34 +425,32 @@ } -char * getDriver() { - #define MY_BUFSIZE 256 +static char * getDriver() { + #define MY_BUFSIZE 256 - HKEY hKey; - static TCHAR szAdapterKey[MY_BUFSIZE], szDriverValue[MY_BUFSIZE]; - DWORD dwBufLen = MY_BUFSIZE; - LONG lRet; + HKEY hKey; + static TCHAR szAdapterKey[MY_BUFSIZE], szDriverValue[MY_BUFSIZE]; + DWORD dwBufLen = MY_BUFSIZE; + LONG lRet; - if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, - TEXT("HARDWARE\\DeviceMap\\Video"), - 0, - KEY_QUERY_VALUE, - &hKey) != ERROR_SUCCESS) return NULL; + if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, + TEXT("HARDWARE\\DeviceMap\\Video"), + 0, + KEY_QUERY_VALUE, + &hKey) != ERROR_SUCCESS) return NULL; - lRet = RegQueryValueEx(hKey, - TEXT("\\Device\\Video0"), - NULL, - NULL, - (LPBYTE)szAdapterKey, - &dwBufLen); + lRet = RegQueryValueEx(hKey, + TEXT("\\Device\\Video0"), + NULL, + NULL, + (LPBYTE)szAdapterKey, + &dwBufLen); - RegCloseKey(hKey); + RegCloseKey(hKey); - if(lRet != ERROR_SUCCESS) return NULL; + if(lRet != ERROR_SUCCESS) return NULL; -#ifdef _DEBUG - printf("Adapter key: %s\n", szAdapterKey); -#endif + printfDebug("Adapter key: %s\n", szAdapterKey); // szAdapterKey now contains something like \Registry\Machine\System\CurrentControlSet\Control\Video\{B70DBD2A-90C4-41CF-A58E-F3BA69F1A6BC}\0000 // We'll check for the first chunk: @@ -493,9 +459,6 @@ TCHAR szDriverKey[MY_BUFSIZE]; strcpy(szDriverKey, &szAdapterKey[18]); -//#ifdef _DEBUG -// printf("Driver key: %s\n", szDriverKey); -//#endif if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT(szDriverKey), @@ -557,27 +520,17 @@ } strcat(driverDLL, driver); strcat(driverDLL, ".dll"); -//#ifdef _DEBUG -// printf("Driver dll = %s\n", driverDLL); -//#endif DWORD var = 0; DWORD dwInfoSize = GetFileVersionInfoSize(driverDLL, &var); LPVOID lpInfoBuff = new unsigned char[dwInfoSize]; BOOL bRetval = GetFileVersionInfo(driverDLL, NULL, dwInfoSize, lpInfoBuff); if (bRetval == 0) { -//#ifdef _DEBUG -// printf("GetFileVersionInfo failed\n"); -//#endif } else { VS_FIXEDFILEINFO * fxdFileInfo; UINT uiLen = 0; bRetval = VerQueryValue(lpInfoBuff, TEXT("\\"), (void **) &fxdFileInfo, &uiLen); - if (bRetval == 0) { -//#ifdef _DEBUG -// printf("VerQueryValue failed\n"); -//#endif - } else { + if (bRetval != 0) { TCHAR version[256]; TCHAR ms[10], ls[10]; sprintf(ms, "%d.%d\0", fxdFileInfo->dwProductVersionMS >> 16, fxdFileInfo->dwProductVersionMS & 0xFFFF); @@ -593,12 +546,4 @@ return ret; } - - - - - - - - Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_Sys.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- org_lwjgl_Sys.cpp 28 Oct 2003 19:25:50 -0000 1.17 +++ org_lwjgl_Sys.cpp 15 Dec 2003 11:49:17 -0000 1.18 @@ -41,6 +41,7 @@ #include <windows.h> #include "org_lwjgl_Sys.h" +#include "common_tools.h" // Handle to the application's window extern HWND hwnd; @@ -60,6 +61,10 @@ return hires_timer_freq; } +JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebugLevel(JNIEnv *env, jclass clazz, jint debug_level) { + setDebugLevel(debug_level); +} + /* * Class: org_lwjgl_Sys * Method: getTime @@ -115,9 +120,7 @@ } if (!SetPriorityClass(me, win32priority)) { -#ifdef _DEBUG - printf("Failed to set priority class.\n"); -#endif + printfDebug("Failed to set priority class.\n"); } } @@ -134,9 +137,7 @@ const char * cTitleBarText = env->GetStringUTFChars(title, ©); MessageBox(hwnd, eMessageText, cTitleBarText, MB_OK | MB_TOPMOST); -#ifdef _DEBUG - printf("*** Alert ***%s\n%s\n", cTitleBarText, eMessageText); -#endif + printfDebug("*** Alert ***%s\n%s\n", cTitleBarText, eMessageText); env->ReleaseStringUTFChars(message, eMessageText); env->ReleaseStringUTFChars(title, cTitleBarText); @@ -170,33 +171,31 @@ strncat(command, urlString, 200); // Prevent buffer overflow env->ReleaseStringUTFChars(url, urlString); - STARTUPINFO si; - PROCESS_INFORMATION pi; + STARTUPINFO si; + PROCESS_INFORMATION pi; - ZeroMemory( &si, sizeof(si) ); - si.cb = sizeof(si); - ZeroMemory( &pi, sizeof(pi) ); + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + ZeroMemory( &pi, sizeof(pi) ); - // Start the child process. - if( !CreateProcess( NULL, // No module name (use command line). - command, // Command line. - NULL, // Process handle not inheritable. - NULL, // Thread handle not inheritable. - FALSE, // Set handle inheritance to FALSE. - 0, // No creation flags. - NULL, // Use parent's environment block. - NULL, // Use parent's starting directory. - &si, // Pointer to STARTUPINFO structure. - &pi ) // Pointer to PROCESS_INFORMATION structure. - ) - { -#ifdef _DEBUG - printf("Failed to open URL %s\n", urlString); -#endif - } + // Start the child process. + if( !CreateProcess( NULL, // No module name (use command line). + command, // Command line. + NULL, // Process handle not inheritable. + NULL, // Thread handle not inheritable. + FALSE, // Set handle inheritance to FALSE. + 0, // No creation flags. + NULL, // Use parent's environment block. + NULL, // Use parent's starting directory. + &si, // Pointer to STARTUPINFO structure. + &pi ) // Pointer to PROCESS_INFORMATION structure. + ) + { + printfDebug("Failed to open URL %s\n", urlString); + } - // Close process and thread handles. - CloseHandle( pi.hProcess ); - CloseHandle( pi.hThread ); + // Close process and thread handles. + CloseHandle( pi.hProcess ); + CloseHandle( pi.hThread ); } Index: org_lwjgl_input_Controller.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Controller.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Controller.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- org_lwjgl_input_Controller.cpp 11 Oct 2003 16:29:40 -0000 1.15 +++ org_lwjgl_input_Controller.cpp 15 Dec 2003 11:49:17 -0000 1.16 @@ -7,15 +7,15 @@ * met: * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Light Weight Java Game Library' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -42,33 +42,33 @@ #define WIN32_LEAN_AND_MEAN #include "org_lwjgl_input_Controller.h" #include <windows.h> -#undef DIRECTINPUT_VERSION +#undef DIRECTINPUT_VERSION #define DIRECTINPUT_VERSION 0x0500 #include <dinput.h> #include "Window.h" #include "common_tools.h" -#define CONTROLLER_AXISMAX 1000 // Maxmimum range to which we'll gauge the swing -#define CONTROLLER_AXISMIN -1000 // Minimum range to which we'll gauge the swing +#define CONTROLLER_AXISMAX 1000 // Maxmimum range to which we'll gauge the swing +#define CONTROLLER_AXISMIN -1000 // Minimum range to which we'll gauge the swing extern HINSTANCE dll_handle; extern HWND hwnd; -static IDirectInput* cDI; // DI instance -static IDirectInputDevice2* cDIDevice; // DI Device instance -static DIJOYSTATE2 cJS; // State of Controller +static IDirectInput* cDI; // DI instance +static IDirectInputDevice2* cDIDevice; // DI Device instance +static DIJOYSTATE2 cJS; // State of Controller -static int cButtoncount = 0; // Temporary buttoncount -static bool cHasx; // Temporary xaxis check -static bool cHasrx; // Temporary rotational xaxis check -static bool cHasy; // Temporary yaxis check -static bool cHasry; // Temporary rotational yaxis check -static bool cHasz; // Temporary zaxis check -static bool cHasrz; // Temporary rotational zaxis check -static bool cHaspov; // Temporary pov check -static bool cHasslider; // Temporary slider check +static int cButtoncount = 0; // Temporary buttoncount +static bool cHasx; // Temporary xaxis check +static bool cHasrx; // Temporary rotational xaxis check +static bool cHasy; // Temporary yaxis check +static bool cHasry; // Temporary rotational yaxis check +static bool cHasz; // Temporary zaxis check +static bool cHasrz; // Temporary rotational zaxis check +static bool cHaspov; // Temporary pov check +static bool cHasslider; // Temporary slider check -static bool cCreate_success; // bool used to determine successfull creation +static bool cCreate_success; // bool used to determine successfull creation static bool cFirstTimeInitialization = true; // boolean to determine first time initialization // Cached fields of Controller.java @@ -108,470 +108,431 @@ * Initializes any field ids */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_initIDs(JNIEnv * env, jclass clazz) { - /* Cache fields in Controller */ - CacheControllerFields(env, clazz); + /* Cache fields in Controller */ + CacheControllerFields(env, clazz); } /** * Called when the Controller instance is to be created */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jclass clazz) { - // Create the DirectInput object. - HRESULT hr; - hr = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &cDI, NULL); - if (FAILED(hr)) { - #if _DEBUG - printf("DirectInputCreate failed\n"); - #endif - ShutdownController(); - return; - } - - /* Find all Controllers */ - EnumerateControllers(); - if (!cCreate_success) { - throwException(env, "Failed to enumerate."); - ShutdownController(); - return; - } + // Create the DirectInput object. + HRESULT hr; + hr = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &cDI, NULL); + if (FAILED(hr)) { + printfDebug("DirectInputCreate failed\n"); + ShutdownController(); + return; + } - /* check that we got at least 1 controller */ - if (cDIDevice == NULL) { - throwException(env, "No devices found."); - ShutdownController(); - return; - } + /* Find all Controllers */ + EnumerateControllers(); + if (!cCreate_success) { + throwException(env, "Failed to enumerate."); + ShutdownController(); + return; + } - //check for first time initialization - need to detect capabilities - if (cFirstTimeInitialization) { - cFirstTimeInitialization = false; + /* check that we got at least 1 controller */ + if (cDIDevice == NULL) { + throwException(env, "No devices found."); + ShutdownController(); + return; + } + //check for first time initialization - need to detect capabilities + if (cFirstTimeInitialization) { + cFirstTimeInitialization = false; - /* Enumerate capabilities of Controller */ - EnumerateControllerCapabilities(); - if (!cCreate_success) { - throwException(env, "Falied to enumerate capabilities."); - ShutdownController(); - return; - } + /* Enumerate capabilities of Controller */ + EnumerateControllerCapabilities(); + if (!cCreate_success) { + throwException(env, "Falied to enumerate capabilities."); + ShutdownController(); + return; + } - /* Do setup of Controller */ - SetupController(); + /* Do setup of Controller */ + SetupController(); - /* Initialize any fields on the Controller */ - InitializeControllerFields(env, clazz); + /* Initialize any fields on the Controller */ + InitializeControllerFields(env, clazz); - /* Set capabilities */ - SetControllerCapabilities(env, clazz); - } else { - if(cCreate_success) { - /* Do setup of Controller */ - SetupController(); - - /* Initialize any fields on the Controller */ - InitializeControllerFields(env, clazz); - } - } + /* Set capabilities */ + SetControllerCapabilities(env, clazz); + } else { + if(cCreate_success) { + /* Do setup of Controller */ + SetupController(); + + /* Initialize any fields on the Controller */ + InitializeControllerFields(env, clazz); + } + } - /* Aquire the Controller */ - hr = cDIDevice->Acquire(); - if(FAILED(hr)) { - throwException(env, "Acquire failed"); - ShutdownController(); - return; - } + /* Aquire the Controller */ + hr = cDIDevice->Acquire(); + if(FAILED(hr)) { + throwException(env, "Acquire failed"); + ShutdownController(); + return; + } } /* - * Class: org_lwjgl_input_Controller - * Method: nDestroy + * Class: org_lwjgl_input_Controller + * Method: nDestroy * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nDestroy(JNIEnv *env, jclass clazz) { - ShutdownController(); + ShutdownController(); } /* - * Class: org_lwjgl_input_Controller - * Method: nPoll + * Class: org_lwjgl_input_Controller + * Method: nPoll * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nPoll(JNIEnv * env, jclass clazz) { - HRESULT hRes; + HRESULT hRes; - // poll the Controller to read the current state - hRes = cDIDevice->Poll(); - if (FAILED(hRes)) { -#if _DEBUG - printf("Poll fail\n"); -#endif + // poll the Controller to read the current state + hRes = cDIDevice->Poll(); + if (FAILED(hRes)) { + printfDebug("Poll fail\n"); - //check if we need to reaquire - if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { - cDIDevice->Acquire(); -#if _DEBUG - printf("DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); -#endif - } - return; - } + //check if we need to reaquire + if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { + cDIDevice->Acquire(); + printfDebug("DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); + } + return; + } - UpdateControllerFields(env, clazz); + UpdateControllerFields(env, clazz); } /** * Shutdown DI */ static void ShutdownController() { - // release device - if (cDIDevice != NULL) { - cDIDevice->Unacquire(); - cDIDevice->Release(); - cDIDevice = NULL; - } + // release device + if (cDIDevice != NULL) { + cDIDevice->Unacquire(); + cDIDevice->Release(); + cDIDevice = NULL; + } } /** * Enumerates the capabilities of the Controller attached to the system */ static void EnumerateControllerCapabilities() { - HRESULT hr; - hr = cDIDevice->EnumObjects(EnumControllerObjectsCallback, NULL, DIDFT_ALL); - if FAILED(hr) { -#if _DEBUG - printf("EnumObjects failed\n"); -#endif - cCreate_success = false; - return; - } - cCreate_success = true; + HRESULT hr; + hr = cDIDevice->EnumObjects(EnumControllerObjectsCallback, NULL, DIDFT_ALL); + if FAILED(hr) { + printfDebug("EnumObjects failed\n"); + cCreate_success = false; + return; + } + cCreate_success = true; } /** * Enumerates the Controllers attached to the system */ static void EnumerateControllers() { - HRESULT hr; - hr = cDI->EnumDevices(DIDEVTYPE_JOYSTICK, EnumControllerCallback, 0, DIEDFL_ATTACHEDONLY); - if FAILED(hr) { -#if _DEBUG - printf("EnumDevices failed\n"); -#endif - cCreate_success = false; - return; - } - cCreate_success = true; + HRESULT hr; + hr = cDI->EnumDevices(DIDEVTYPE_JOYSTICK, EnumControllerCallback, 0, DIEDFL_ATTACHEDONLY); + if FAILED(hr) { + printfDebug("EnumDevices failed\n"); + cCreate_success = false; + return; + } + cCreate_success = true; } /** * Callback from EnumDevices. Called for each Controller attached to the system */ BOOL CALLBACK EnumControllerCallback(LPCDIDEVICEINSTANCE pdinst, LPVOID pvRef) { - /* Add the Controller */ - CreateController(pdinst); + /* Add the Controller */ + CreateController(pdinst); - /* just stop after 1st Controller */ - return DIENUM_STOP; + /* just stop after 1st Controller */ + return DIENUM_STOP; } /** * Callback from EnumObjects. Called for each "object" on the Controller. */ BOOL CALLBACK EnumControllerObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) { -#if _DEBUG - printf("found %s\n", lpddoi->tszName); -#endif - if(lpddoi->guidType == GUID_Button) { - cButtoncount++; - } else if(lpddoi->guidType == GUID_XAxis) { - cHasx = true; - } else if(lpddoi->guidType == GUID_YAxis) { - cHasy = true; - } else if(lpddoi->guidType == GUID_ZAxis){ - cHasz = true; - } else if (lpddoi->guidType == GUID_POV){ - cHaspov = true; - } else if (lpddoi->guidType == GUID_Slider){ - cHasslider = true; - } else if (lpddoi->guidType == GUID_RxAxis) { - cHasrx = true; - } else if (lpddoi->guidType == GUID_RyAxis) { - cHasry = true; - } else if (lpddoi->guidType == GUID_RzAxis) { - cHasrz = true; -#if _DEBUG - } else { - printf("Unhandled object found: %s\n", lpddoi->tszName); -#endif - } - return DIENUM_CONTINUE; + printfDebug("found %s\n", lpddoi->tszName); + if(lpddoi->guidType == GUID_Button) { + cButtoncount++; + } else if(lpddoi->guidType == GUID_XAxis) { + cHasx = true; + } else if(lpddoi->guidType == GUID_YAxis) { + cHasy = true; + } else if(lpddoi->guidType == GUID_ZAxis){ + cHasz = true; + } else if (lpddoi->guidType == GUID_POV){ + cHaspov = true; + } else if (lpddoi->guidType == GUID_Slider){ + cHasslider = true; + } else if (lpddoi->guidType == GUID_RxAxis) { + cHasrx = true; + } else if (lpddoi->guidType == GUID_RyAxis) { + cHasry = true; + } else if (lpddoi->guidType == GUID_RzAxis) { + cHasrz = true; + } else { + printfDebug("Unhandled object found: %s\n", lpddoi->tszName); + } + return DIENUM_CONTINUE; } /** * Creates the specified device as a Controller */ static void CreateController(LPCDIDEVICEINSTANCE lpddi) { - HRESULT hr; - hr = cDI->CreateDevice(lpddi->guidInstance, (LPDIRECTINPUTDEVICE*) &cDIDevice, NULL); - if FAILED(hr) { -#if _DEBUG - printf("CreateDevice failed\n"); -#endif - cCreate_success = false; - return; - } - cCreate_success = true; + HRESULT hr; + hr = cDI->CreateDevice(lpddi->guidInstance, (LPDIRECTINPUTDEVICE*) &cDIDevice, NULL); + if FAILED(hr) { + printfDebug("CreateDevice failed\n"); + cCreate_success = false; + return; + } + cCreate_success = true; } /** * Sets up the Controller properties */ static void SetupController() { - // set Controller data format - if(cDIDevice->SetDataFormat(&c_dfDIJoystick2) != DI_OK) { -#if _DEBUG - printf("SetDataFormat failed\n"); -#endif - cCreate_success = false; - return; - } + // set Controller data format + if(cDIDevice->SetDataFormat(&c_dfDIJoystick2) != DI_OK) { + printfDebug("SetDataFormat failed\n"); + cCreate_success = false; + return; + } - // set the cooperative level - if(cDIDevice->SetCooperativeLevel(hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { -#if _DEBUG - printf("SetCooperativeLevel failed\n"); -#endif - cCreate_success = false; - return; - } - - // set range to (-1000 ... +1000) - // This lets us test against 0 to see which way the stick is pointed. - DIPROPRANGE diprg; - diprg.diph.dwSize = sizeof(diprg); - diprg.diph.dwHeaderSize = sizeof(diprg.diph); - diprg.diph.dwHow = DIPH_BYOFFSET; - diprg.lMin = CONTROLLER_AXISMIN; - diprg.lMax = CONTROLLER_AXISMAX; + // set the cooperative level + if(cDIDevice->SetCooperativeLevel(hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { + printfDebug("SetCooperativeLevel failed\n"); + cCreate_success = false; + return; + } + + // set range to (-1000 ... +1000) + // This lets us test against 0 to see which way the stick is pointed. + DIPROPRANGE diprg; + diprg.diph.dwSize = sizeof(diprg); + diprg.diph.dwHeaderSize = sizeof(diprg.diph); + diprg.diph.dwHow = DIPH_BYOFFSET; + diprg.lMin = CONTROLLER_AXISMIN; + diprg.lMax = CONTROLLER_AXISMAX; - // set X-axis - if(cHasx) { - diprg.diph.dwObj = DIJOFS_X; - if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { -#if _DEBUG - printf("SetProperty(DIJOFS_X) failed\n"); -#endif - cCreate_success = false; - return; - } - } + // set X-axis + if(cHasx) { + diprg.diph.dwObj = DIJOFS_X; + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + printfDebug("SetProperty(DIJOFS_X) failed\n"); + cCreate_success = false; + return; + } + } - // set RX-axis - if(cHasrx) { - diprg.diph.dwObj = DIJOFS_RX; - if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { -#if _DEBUG - printf("SetProperty(DIJOFS_RX) failed\n"); -#endif - cCreate_success = false; - return; - } - } + // set RX-axis + if(cHasrx) { + diprg.diph.dwObj = DIJOFS_RX; + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + printfDebug("SetProperty(DIJOFS_RX) failed\n"); + cCreate_success = false; + return; + } + } - // set Y-axis - if(cHasy) { - diprg.diph.dwObj = DIJOFS_Y; - if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { -#if _DEBUG - printf("SetProperty(DIJOFS_Y) failed\n"); -#endif - cCreate_success = false; - return; - } - } + // set Y-axis + if(cHasy) { + diprg.diph.dwObj = DIJOFS_Y; + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + printfDebug("SetProperty(DIJOFS_Y) failed\n"); + cCreate_success = false; + return; + } + } - // set RY-axis - if(cHasry) { - diprg.diph.dwObj = DIJOFS_RY; - if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { -#if _DEBUG - printf("SetProperty(DIJOFS_RY) failed\n"); -#endif - cCreate_success = false; - return; - } - } + // set RY-axis + if(cHasry) { + diprg.diph.dwObj = DIJOFS_RY; + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + printfDebug("SetProperty(DIJOFS_RY) failed\n"); + cCreate_success = false; + return; + } + } - // set Z-axis - if(cHasz) { - diprg.diph.dwObj = DIJOFS_Z; - if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { -#if _DEBUG - printf("SetProperty(DIJOFS_Z) failed\n"); -#endif - cCreate_success = false; - return; - } - } + // set Z-axis + if(cHasz) { + diprg.diph.dwObj = DIJOFS_Z; + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + printfDebug("SetProperty(DIJOFS_Z) failed\n"); + cCreate_success = false; + return; + } + } - // set RZ-axis - if(cHasrz) { - diprg.diph.dwObj = DIJOFS_RZ; - if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { -#if _DEBUG - printf("SetProperty(DIJOFS_RZ) failed\n"); -#endif - cCreate_success = false; - return; - } - } + // set RZ-axis + if(cHasrz) { + diprg.diph.dwObj = DIJOFS_RZ; + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + printfDebug("SetProperty(DIJOFS_RZ) failed\n"); + cCreate_success = false; + return; + } + } - // - // Lastly slider - // using z axis since we're running dx 5 - // - if(cHasslider) { - diprg.diph.dwObj = DIJOFS_Z; - if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { -#if _DEBUG - printf("SetProperty(DIJOFS_Z(SLIDER)) failed\n"); -#endif - cCreate_success = false; - return; - } - } - cCreate_success = true; + // + // Lastly slider + // using z axis since we're running dx 5 + // + if(cHasslider) { + diprg.diph.dwObj = DIJOFS_Z; + if(cDIDevice->SetProperty(DIPROP_RANGE, &diprg.diph) != DI_OK) { + printfDebug("SetProperty(DIJOFS_Z(SLIDER)) failed\n"); + cCreate_success = false; + return; + } + } + cCreate_success = true; } /** * Sets the fields on the Controller */ static void InitializeControllerFields(JNIEnv *env, jclass clsController) { - //create buttons array - jbooleanArray cButtonsArray = env->NewBooleanArray(cButtoncount); - - //set buttons array - env->SetStaticObjectField(clsController, fidCButtons, cButtonsArray); + //create buttons array + jbooleanArray cButtonsArray = env->NewBooleanArray(cButtoncount); + + //set buttons array + env->SetStaticObjectField(clsController, fidCButtons, cButtonsArray); } /** * Updates the fields on the Controller */ static void UpdateControllerFields(JNIEnv *env, jclass clsController) { - HRESULT hRes; + HRESULT hRes; - // get data from the Controller - hRes = cDIDevice->GetDeviceState(sizeof(DIJOYSTATE2), &cJS); + // get data from the Controller + hRes = cDIDevice->GetDeviceState(sizeof(DIJOYSTATE2), &cJS); - if (hRes != DI_OK) { - // did the read fail because we lost input for some reason? - // if so, then attempt to reacquire. - if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { - cDIDevice->Acquire(); -#if _DEBUG - printf("DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); -#endif - } -#if _DEBUG - printf("Error getting controller state: %d\n", hRes); -#endif - return; - } + if (hRes != DI_OK) { + // did the read fail because we lost input for some reason? + // if so, then attempt to reacquire. + if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { + cDIDevice->Acquire(); + printfDebug("DIERR_INPUTLOST, reaquiring input : cCreate_success=%d\n", cCreate_success); + } + printfDebug("Error getting controller state: %d\n", hRes); + return; + } - //axis's - if(cHasx) { - env->SetStaticIntField(clsController, fidCX, cJS.lX); - } + //axis's + if(cHasx) { + env->SetStaticIntField(clsController, fidCX, cJS.lX); + } - if(cHasy) { - env->SetStaticIntField(clsController, fidCY, cJS.lY); - } + if(cHasy) { + env->SetStaticIntField(clsController, fidCY, cJS.lY); + } - if(cHasz) { - env->SetStaticIntField(clsController, fidCZ, cJS.lZ); - } + if(cHasz) { + env->SetStaticIntField(clsController, fidCZ, cJS.lZ); + } - //rotational axis - if(cHasrx) { - env->SetStaticIntField(clsController, fidCRX, cJS.lRx); - } + //rotational axis + if(cHasrx) { + env->SetStaticIntField(clsController, fidCRX, cJS.lRx); + } - if(cHasry) { - env->SetStaticIntField(clsController, fidCRY, cJS.lRy); - } + if(cHasry) { + env->SetStaticIntField(clsController, fidCRY, cJS.lRy); + } - if(cHasrz) { - env->SetStaticIntField(clsController, fidCRZ, cJS.lRz); - } + if(cHasrz) { + env->SetStaticIntField(clsController, fidCRZ, cJS.lRz); + } - //buttons - for (int i = 0; i < cButtoncount; i++) { - if (cJS.rgbButtons[i] != 0) { - cJS.rgbButtons[i] = 1; - } else { - cJS.rgbButtons[i] = 0; - } - } - jbyteArray buttonsArray = (jbyteArray) env->GetStaticObjectField(clsController, fidCButtons); - env->SetByteArrayRegion(buttonsArray, 0, cButtoncount, (jbyte *)cJS.rgbButtons); + //buttons + for (int i = 0; i < cButtoncount; i++) { + if (cJS.rgbButtons[i] != 0) { + cJS.rgbButtons[i] = 1; + } else { + cJS.rgbButtons[i] = 0; + } + } + jbyteArray buttonsArray = (jbyteArray) env->GetStaticObjectField(clsController, fidCButtons); + env->SetByteArrayRegion(buttonsArray, 0, cButtoncount, (jbyte *)cJS.rgbButtons); - //pov - if(cHaspov) { - env->SetStaticIntField(clsController, fidCPOV, cJS.rgdwPOV[0]); - } + //pov + if(cHaspov) { + env->SetStaticIntField(clsController, fidCPOV, cJS.rgdwPOV[0]); + } - //slider - if(cHasslider) { - env->SetStaticIntField(clsController, fidCSlider, cJS.lZ); - } + //slider + if(cHasslider) { + env->SetStaticIntField(clsController, fidCSlider, cJS.lZ); + } } /** * Sets the capabilities of the Controller */ static void SetControllerCapabilities(JNIEnv *env, jclass clsController) { - //set buttoncount - env->SetStaticIntField(clsController, fidCButtonCount, cButtoncount); + //set buttoncount + env->SetStaticIntField(clsController, fidCButtonCount, cButtoncount); - //set axis - env->SetStaticBooleanField(clsController, fidCHasXAxis, cHasx); - env->SetStaticBooleanField(clsController, fidCHasYAxis, cHasy); - env->SetStaticBooleanField(clsController, fidCHasZAxis, cHasz); + //set axis + env->SetStaticBooleanField(clsController, fidCHasXAxis, cHasx); + env->SetStaticBooleanField(clsController, fidCHasYAxis, cHasy); + env->SetStaticBooleanField(clsController, fidCHasZAxis, cHasz); - //set rotational axis - env->SetStaticBooleanField(clsController, fidCHasRXAxis, cHasrx); - env->SetStaticBooleanField(clsController, fidCHasRYAxis, cHasry); - env->SetStaticBooleanField(clsController, fidCHasRZAxis, cHasrz); + //set rotational axis + env->SetStaticBooleanField(clsController, fidCHasRXAxis, cHasrx); + env->SetStaticBooleanField(clsController, fidCHasRYAxis, cHasry); + env->SetStaticBooleanField(clsController, fidCHasRZAxis, cHasrz); - //set pov - env->SetStaticBooleanField(clsController, fidCHasPOV, cHaspov); + //set pov + env->SetStaticBooleanField(clsController, fidCHasPOV, cHaspov); - //set slider - env->SetStaticBooleanField(clsController, fidCHasSlider, cHasslider); + //set slider + env->SetStaticBooleanField(clsController, fidCHasSlider, cHasslider); } /** * Caches the field ids for quicker access */ static void CacheControllerFields(JNIEnv *env, jclass clsController) { - fidCButtonCount = env->GetStaticFieldID(clsController, "buttonCount", "I"); - fidCHasXAxis = env->GetStaticFieldID(clsController, "hasXAxis", "Z"); - fidCHasRXAxis = env->GetStaticFieldID(clsController, "hasRXAxis", "Z"); - fidCHasYAxis = env->GetStaticFieldID(clsController, "hasYAxis", "Z"); - fidCHasRYAxis = env->GetStaticFieldID(clsController, "hasRYAxis", "Z"); - fidCHasZAxis = env->GetStaticFieldID(clsController, "hasZAxis", "Z"); - fidCHasRZAxis = env->GetStaticFieldID(clsController, "hasRZAxis", "Z"); - fidCHasPOV = env->GetStaticFieldID(clsController, "hasPOV", "Z"); - fidCHasSlider = env->GetStaticFieldID(clsController, "hasSlider", "Z"); - fidCButtons = env->GetStaticFieldID(clsController, "buttons", "[Z"); - fidCX = env->GetStaticFieldID(clsController, "x", "I"); - fidCRX = env->GetStaticFieldID(clsController, "rx", "I"); - fidCY = env->GetStaticFieldID(clsController, "y", "I"); - fidCRY = env->GetStaticFieldID(clsController, "ry", "I"); - fidCZ = env->GetStaticFieldID(clsController, "z", "I"); - fidCRZ = env->GetStaticFieldID(clsController, "rz", "I"); - fidCPOV = env->GetStaticFieldID(clsController, "pov", "I"); - fidCSlider = env->GetStaticFieldID(clsController, "slider", "I"); + fidCButtonCount = env->GetStaticFieldID(clsController, "buttonCount", "I"); + fidCHasXAxis = env->GetStaticFieldID(clsController, "hasXAxis", "Z"); + fidCHasRXAxis = env->GetStaticFieldID(clsController, "hasRXAxis", "Z"); + fidCHasYAxis = env->GetStaticFieldID(clsController, "hasYAxis", "Z"); + fidCHasRYAxis = env->GetStaticFieldID(clsController, "hasRYAxis", "Z"); + fidCHasZAxis = env->GetStaticFieldID(clsController, "hasZAxis", "Z"); + fidCHasRZAxis = env->GetStaticFieldID(clsController, "hasRZAxis", "Z"); + fidCHasPOV = env->GetStaticFieldID(clsController, "hasPOV", "Z"); + fidCHasSlider = env->GetStaticFieldID(clsController, "hasSlider", "Z"); + fidCButtons = env->GetStaticFieldID(clsController, "buttons", "[Z"); + fidCX = env->GetStaticFieldID(clsController, "x", "I"); + fidCRX = env->GetStaticFieldID(clsController, "rx", "I"); + fidCY = env->GetStaticFieldID(clsController, "y", "I"); + fidCRY = env->GetStaticFieldID(clsController, "ry", "I"); + fidCZ = env->GetStaticFieldID(clsController, "z", "I"); + fidCRZ = env->GetStaticFieldID(clsController, "rz", "I"); + fidCPOV = env->GetStaticFieldID(clsController, "pov", "I"); + fidCSlider = env->GetStaticFieldID(clsController, "slider", "I"); } Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- org_lwjgl_input_Keyboard.cpp 11 Oct 2003 16:29:40 -0000 1.25 +++ org_lwjgl_input_Keyboard.cpp 15 Dec 2003 11:49:17 -0000 1.26 @@ -110,9 +110,7 @@ HRESULT ret = lpdiKeyboard->Acquire(); if(FAILED(ret)) { -#if _DEBUG - printf("Failed to acquire keyboard\n"); -#endif + printfDebug("Failed to acquire keyboard\n"); } } @@ -200,11 +198,6 @@ if (ret == DI_OK) { unsigned char * buf = readBuffer; -//#ifdef _DEBUG -// if (bufsize > 0) { -// printf("Got %d keyboard events.\n", bufsize); -// } -//#endif for (unsigned int i = 0; i < bufsize; i ++) { num_events++; *buf++ = (unsigned char) rgdod[i].dwOfs; @@ -252,33 +245,19 @@ } } } else if (ret == DI_BUFFEROVERFLOW) { -#ifdef _DEBUG - printf("Keyboard buffer overflowed\n"); -#endif + printfDebug("Keyboard buffer overflowed\n"); } else if (ret == DIERR_INPUTLOST) { -#ifdef _DEBUG - printf("Input lost\n"); -#endif + printfDebug("Input lost\n"); } else if (ret == DIERR_NOTACQUIRED) { -#ifdef _DEBUG - printf("not acquired\n"); -#endif + printfDebug("not acquired\n"); } else if (ret == DIERR_INVALIDPARAM) { -#ifdef _DEBUG - printf("invalid parameter\n"); -#endif + printfDebug("invalid parameter\n"); } else if (ret == DIERR_NOTBUFFERED) { -#ifdef _DEBUG - printf("not buffered\n"); -#endif + printfDebug("not buffered\n"); } else if (ret == DIERR_NOTINITIALIZED) { -#ifdef _DEBUG - printf("not inited\n"); -#endif + printfDebug("not inited\n"); } else { -#ifdef _DEBUG - printf("unknown keyboard error\n"); -#endif + printfDebug("unknown keyboard error\n"); } return num_events; } Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- org_lwjgl_input_Mouse.cpp 23 Nov 2003 12:52:08 -0000 1.39 +++ org_lwjgl_input_Mouse.cpp 15 Dec 2003 11:49:17 -0000 1.40 @@ -7,15 +7,15 @@ * met: * * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * * * Neither the name of 'Light Weight Java Game Library' nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR @@ -41,7 +41,7 @@ #define WIN32_LEAN_AND_MEAN #include "org_lwjgl_input_Mouse.h" #include <windows.h> -#undef DIRECTINPUT_VERSION +#undef DIRECTINPUT_VERSION #define DIRECTINPUT_VERSION 0x0300 #include "Window.h" #include "common_tools.h" @@ -49,11 +49,11 @@ static BYTE readBuffer[EVENT_BUFFER_SIZE]; -static LPDIRECTINPUTDEVICE mDIDevice; // DI Device instance -static int mButtoncount = 0; // Temporary buttoncount -static bool mHaswheel; // Temporary wheel check +static LPDIRECTINPUTDEVICE mDIDevice; // DI Device instance +static int mButtoncount = 0; // Temporary buttoncount +static bool mHaswheel; // Temporary wheel check -static bool mCreate_success; // bool used to determine successfull creation +static bool mCreate_success; // bool used to determine successfull creation static bool mFirstTimeInitialization = true; // boolean to determine first time initialization // Cached fields of Mouse.java @@ -90,8 +90,8 @@ * Initializes any field ids */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_initIDs(JNIEnv * env, jclass clazz) { - /* Cache fields in Mouse */ - CacheMouseFields(env, clazz); + /* Cache fields in Mouse */ + CacheMouseFields(env, clazz); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_input_Mouse_nHasWheel(JNIEnv *, jclass) { @@ -129,15 +129,13 @@ } else { if(mCreate_success) { /* Do setup of Mouse */ - SetupMouse(); + SetupMouse(); } } /* Aquire the Mouse */ hr = mDIDevice->Acquire(); if(FAILED(hr)) { -#if _DEBUG - printf("Failed to acquire mouse\n"); -#endif + printfDebug("Failed to acquire mouse\n"); } } @@ -178,7 +176,7 @@ } JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nRead - (JNIEnv * env, jclass clazz) + (JNIEnv * env, jclass clazz) { static DIDEVICEOBJECTDATA rgdod[EVENT_BUFFER_SIZE]; @@ -199,55 +197,41 @@ if (ret == DI_OK) { return bufferButtons(bufsize, rgdod); } else if (ret == DI_BUFFEROVERFLOW) { -#ifdef _DEBUG - printf("Buffer overflowed\n"); -#endif + printfDebug("Buffer overflowed\n"); } else if (ret == DIERR_INPUTLOST) { -#ifdef _DEBUG - printf("Input lost\n"); -#endif + printfDebug("Input lost\n"); } else if (ret == DIERR_NOTACQUIRED) { -#ifdef _DEBUG - printf("not acquired\n"); -#endif + printfDebug("not acquired\n"); } else if (ret == DIERR_INVALIDPARAM) { -#ifdef _DEBUG - printf("invalid parameter\n"); -#endif + printfDebug("invalid parameter\n"); } else if (ret == DIERR_NOTBUFFERED) { -#ifdef _DEBUG - printf("not buffered\n"); -#endif + printfDebug("not buffered\n"); } else if (ret == DIERR_NOTINITIALIZED) { -#ifdef _DEBUG - printf("not inited\n"); -#endif + printfDebug("not inited\n"); } else { -#ifdef _DEBUG - printf("unknown keyboard error\n"); -#endif + printfDebug("unknown keyboard error\n"); } return 0; } /* - * Class: org_lwjgl_input_Mouse - * Method: nIsNativeCursorSupported + * Class: org_lwjgl_input_Mouse + * Method: nIsNativeCursorSupported * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetNativeCursorCaps - (JNIEnv *env, jclass clazz) + (JNIEnv *env, jclass clazz) { return org_lwjgl_input_Mouse_CURSOR_ONE_BIT_TRANSPARENCY; } /* - * Class: org_lwjgl_input_Mouse - * Method: nSetNativeCursor + * Class: org_lwjgl_input_Mouse + * Method: nSetNativeCursor * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nSetNativeCursor - (JNIEnv *env, jclass clazz, jlong cursor_handle) + (JNIEnv *env, jclass clazz, jlong cursor_handle) { if (mDIDevice == NULL) throwException(env, "null device!"); @@ -288,30 +272,30 @@ } /* - * Class: org_lwjgl_input_Mouse - * Method: nGetMaxCursorSize + * Class: org_lwjgl_input_Mouse + * Method: nGetMaxCursorSize * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMaxCursorSize - (JNIEnv *env, jclass clazz) + (JNIEnv *env, jclass clazz) { return GetSystemMetrics(SM_CXCURSOR); } /* - * Class: org_lwjgl_input_Mouse - * Method: nGetMaxCursorSize + * Class: org_lwjgl_input_Mouse + * Method: nGetMaxCursorSize * Signature: ()I */ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nGetMinCursorSize - (JNIEnv *env, jclass clazz) + (JNIEnv *env, jclass clazz) { return GetSystemMetrics(SM_CXCURSOR); } /* - * Class: org_lwjgl_input_Mouse - * Method: nDestroy + * Class: org_lwjgl_input_Mouse + * Method: nDestroy * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nDestroy(JNIEnv *env, jclass clazz) { @@ -320,25 +304,25 @@ } /* - * Class: org_lwjgl_input_Controller - * Method: nPoll + * Class: org_lwjgl_input_Controller + * Method: nPoll * Signature: ()V */ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nPoll(JNIEnv * env, jclass clazz) { - mDIDevice->Acquire(); - UpdateMouseFields(env, clazz); + mDIDevice->Acquire(); + UpdateMouseFields(env, clazz); } /** * Shutdown DI */ void ShutdownMouse() { - // release device - if (mDIDevice != NULL) { - mDIDevice->Unacquire(); - mDIDevice->Release(); - mDIDevice = NULL; - } + // release device + if (mDIDevice != NULL) { + mDIDevice->Unacquire(); + mDIDevice->Release(); + mDIDevice = NULL; + } } /** * Enumerates the capabilities of the Mouse attached to the system @@ -347,21 +331,17 @@ HRESULT hr; hr = mDIDevice->EnumObjects(EnumMouseObjectsCallback, NULL, DIDFT_ALL); if FAILED(hr) { -#if _DEBUG - printf("EnumObjects failed\n"); -#endif + printfDebug("EnumObjects failed\n"); mCreate_success = false; return; } - + //check for > 4 buttons - need to clamp since we're using dx 5 if(mButtoncount > 4) { mButtoncount = 4; -#ifdef _DEBUG - printf("WARNING: Clamping to 4 mouse buttons\n"); -#endif + printfDebug("WARNING: Clamping to 4 mouse buttons\n"); } - + mCreate_success = true; } @@ -369,51 +349,43 @@ * Callback from EnumObjects. Called for each "object" on the Mouse. */ BOOL CALLBACK EnumMouseObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID pvRef) { -#if _DEBUG - printf("found %s\n", lpddoi->tszName); -#endif - if(lpddoi->guidType == GUID_Button) { - mButtoncount++; - } else if(lpddoi->guidType == GUID_XAxis) { - } else if(lpddoi->guidType == GUID_YAxis) { - } else if(lpddoi->guidType == GUID_ZAxis) { - mHaswheel = true; -#if _DEBUG - } else { - printf("Unhandled object found: %s\n", lpddoi->tszName); -#endif - } - return DIENUM_CONTINUE; + printfDebug("found %s\n", lpddoi->tszName); + if(lpddoi->guidType == GUID_Button) { + mButtoncount++; + } else if(lpddoi->guidType == GUID_XAxis) { + } else if(lpddoi->guidType == GUID_YAxis) { + } else if(lpddoi->guidType == GUID_ZAxis) { + mHaswheel = true; + } else { + printfDebug("Unhandled object found: %s\n", lpddoi->tszName); + } + return DIENUM_CONTINUE; } /** * Creates the specified device as a Mouse */ void CreateMouse() { - HRESULT hr; - hr = lpdi->CreateDevice(GUID_SysMouse, &mDIDevice, NULL); - if FAILED(hr) { -#if _DEBUG - printf("CreateDevice failed\n"); -#endif - mCreate_success = false; - return; - } - mCreate_success = true; + HRESULT hr; + hr = lpdi->CreateDevice(GUID_SysMouse, &mDIDevice, NULL); + if FAILED(hr) { + printfDebug("CreateDevice failed\n"); + mCreate_success = false; + return; + } + mCreate_success = true; } /** * Sets up the Mouse properties */ void SetupMouse() { - // set Mouse data format - if(mDIDevice->SetDataFormat(&c_dfDIMouse) != DI_OK) { -#if _DEBUG - printf("SetDataFormat failed\n"); -#endif - mCreate_success = false; - return; - } + // set Mouse data format + if(mDIDevice->SetDataFormat(&c_dfDIMouse) != DI_OK) { + printfDebug("SetDataFormat failed\n"); + mCreate_success = false; + return; + } DIPROPDWORD dipropdw; dipropdw.diph.dwSize = sizeof(DIPROPDWORD); @@ -424,14 +396,12 @@ mDIDevice->SetProperty(DIPROP_BUFFERSIZE, &dipropdw.diph); // set the cooperative level - if(mDIDevice->SetCooperativeLevel(hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { -#if _DEBUG - printf("SetCooperativeLevel failed\n"); -#endif - mCreate_success = false; - return; - } - mCreate_success = true; + if(mDIDevice->SetCooperativeLevel(hwnd, DISCL_EXCLUSIVE | DISCL_FOREGROUND) != DI_OK) { + printfDebug("SetCooperativeLevel failed\n"); + mCreate_success = false; + return; + } + mCreate_success = true; } static int cap(int val, int min, int max) { @@ -471,8 +441,8 @@ * Updates the fields on the Mouse */ static void UpdateMouseFields(JNIEnv *env, jclass clsMouse) { - HRESULT hRes; - DIMOUSESTATE diMouseState; // State of Mouse + HRESULT hRes; + DIMOUSESTATE diMouseState; // State of Mouse int dx, dy; // get data from the Mouse @@ -486,13 +456,8 @@ // if so, then attempt to reacquire. if(hRes == DIERR_INPUTLOST || hRes == DIERR_NOTACQUIRED) { mDIDevice->Acquire(); -#if _DEBUG - //printf("DIERR_INPUTLOST, reaquiring input : mCreate_success=%d\n", mCreate_success); -#endif } else { -#if _DEBUG - printf("Error getting mouse state: %d\n", hRes); -#endif + printfDebug("Error getting mouse state: %d\n", hRes); } } @@ -523,8 +488,8 @@ * Caches the field ids for quicker access */ void CacheMouseFields(JNIEnv* env, jclass clsMouse) { - fidMButtons = env->GetStaticFieldID(clsMouse, "buttons", "[B"); - fidMDX = env->GetStaticFieldID(clsMouse, "dx", "I"); - fidMDY = env->GetStaticFieldID(clsMouse, "dy", "I"); - fidMDWheel = env->GetStaticFieldID(clsMouse, "dwheel", "I"); + fidMButtons = env->GetStaticFieldID(clsMouse, "buttons", "[B"); + fidMDX = env->GetStaticFieldID(clsMouse, "dx", "I"); + fidMDY = env->GetStaticFieldID(clsMouse, "dy", "I"); + fidMDWheel = env->GetStaticFieldID(clsMouse, "dwheel", "I"); } Index: org_lwjgl_opengl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/win32/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- org_lwjgl_opengl_Window.cpp 17 Nov 2003 07:45:14 -0000 1.12 +++ org_lwjgl_opengl_Window.cpp 15 Dec 2003 11:49:17 -0000 1.13 @@ -97,9 +97,7 @@ return -1; } -#ifdef _DEBUG - printf("Pixel format is %d\n", iPixelFormat); -#endif + printfDebug("Pixel format is %d\n", iPixelFormat); // make that the pixel format of the device context if (SetPixelFormat(hdc, iPixelFormat, &pfd) == FALSE) { @@ -161,22 +159,20 @@ // Create input HRESULT ret = DirectInputCreate(dll_handle, DIRECTINPUT_VERSION, &lpdi, NULL); if (ret != DI_OK && ret != DIERR_BETADIRECTINPUTVERSION ) { -#ifdef _DEBUG - printf("Failed to create directinput"); + printfDebug("Failed to create directinput"); switch (ret) { case DIERR_INVALIDPARAM : - printf(" - Invalid parameter\n"); + printfDebug(" - Invalid parameter\n"); break; case DIERR_OLDDIRECTINPUTVERSION : - printf(" - Old Version\n"); + printfDebug(" - Old Version\n"); break; case DIERR_OUTOFMEMORY : - printf(" - Out Of Memory\n"); + printfDebug(" - Out Of Memory\n"); break; default: - printf(" - Unknown failure\n"); + printfDebug(" - Unknown failure\n"); } -#endif return false; } else { return true; @@ -190,31 +186,23 @@ { // Release DirectInput if (lpdi != NULL) { -#ifdef _DEBUG - printf("Destroying directinput\n"); -#endif + printfDebug("Destroying directinput\n"); lpdi->Release(); lpdi = NULL; } // Release device context if (hdc != NULL && hwnd != NULL) { -#ifdef _DEBUG - printf("Releasing DC\n"); -#endif + printfDebug("Releasing DC\n"); ReleaseDC(hwnd, hdc); } // Close the window if (hwnd != NULL) { -#ifdef _DEBUG - printf("Destroy window\n"); -#endif + printfDebug("Destroy window\n"); // Vape the window DestroyWindow(hwnd); -#ifdef _DEBUG - printf("Destroyed window\n"); -#endif + printfDebug("Destroyed window\n"); hwnd = NULL; } } @@ -324,14 +312,10 @@ windowClass.lpszClassName = WINDOWCLASSNAME; if (RegisterClass(&windowClass) == 0) { -#ifdef _DEBUG - printf("Failed to register window class\n"); -#endif + printfDebug("Failed to register window class\n"); return false; } -#ifdef _DEBUG - printf("Window registered\n"); -#endif + printfDebug("Window registered\n"); oneShotInitialised = true; } @@ -413,15 +397,11 @@ NULL); if (hwnd == NULL) { -#ifdef _DEBUG - printf("Failed to create window\n"); -#endif + printfDebug("Failed to create window\n"); return false; } -#ifdef _DEBUG - printf("Created window\n"); -#endif + printfDebug("Created window\n"); ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); @@ -578,9 +558,7 @@ // Delete the rendering context if (hglrc != NULL) { -#ifdef _DEBUG - printf("Delete GL context\n"); -#endif + printfDebug("Deleting GL context\n"); wglDeleteContext(hglrc); hglrc = NULL; } |
|
From: Elias N. <eli...@us...> - 2003-12-15 11:49:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/macosx In directory sc8-pr-cvs1:/tmp/cvs-serv8597/src/native/macosx Modified Files: hid.cpp org_lwjgl_Sys.cpp org_lwjgl_input_Keyboard.cpp org_lwjgl_input_Mouse.cpp Log Message: Replaced debug libraries with runtime debug condition Index: hid.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/hid.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/hid.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- hid.cpp 23 Oct 2003 18:21:56 -0000 1.2 +++ hid.cpp 15 Dec 2003 11:49:17 -0000 1.3 @@ -123,9 +123,7 @@ static void addToDeviceQueue(hid_device_t *hid_dev, IOHIDElementCookie cookie, int index) { HRESULT result = (*hid_dev->device_queue)->addElement(hid_dev->device_queue, cookie, 0); if (result != S_OK) { -#ifdef _DEBUG - printf("Could not add cookie to queue\n"); -#endif + printfDebug("Could not add cookie to queue\n"); return; } CFDictionaryAddValue(hid_dev->cookie_map, cookie, (void *)index); @@ -193,9 +191,7 @@ CFDictionaryRef matching_dic = IOServiceMatching(kIOHIDDeviceKey); IOReturn err = IOServiceGetMatchingServices(kIOMasterPortDefault, matching_dic, &device_iterator); if (err != kIOReturnSuccess) { -#ifdef _DEBUG - printf("Could not find matching devices\n"); -#endif + printfDebug("Could not find matching devices\n"); return false; } while (!success && (hid_device = IOIteratorNext(device_iterator)) != NULL) { @@ -205,11 +201,11 @@ long usage_page; if (getDictLong(dev_props, CFSTR(kIOHIDPrimaryUsageKey), &usage) && getDictLong(dev_props, CFSTR(kIOHIDPrimaryUsagePageKey), &usage_page)) { -#ifdef _DEBUG - printf("Considering device '"); - printProperty(dev_props, CFSTR(kIOHIDProductKey)); - printf("', usage page %ld usage %ld\n", usage_page, usage); -#endif + if (ATDEBUGLEVEL()) { + printf("Considering device '"); + printProperty(dev_props, CFSTR(kIOHIDProductKey)); + printf("', usage page %ld usage %ld\n", usage_page, usage); + } if (usage_page == device_usage_page && usage == device_usage) { success = initDevice(hid_dev, hid_device, dev_props, num_cookies, hid_cookies, buffer_size); } Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_Sys.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- org_lwjgl_Sys.cpp 6 Nov 2003 14:30:25 -0000 1.9 +++ org_lwjgl_Sys.cpp 15 Dec 2003 11:49:17 -0000 1.10 @@ -44,6 +44,7 @@ #include <sys/resource.h> #include <Carbon/Carbon.h> #include "org_lwjgl_Sys.h" +#include "common_tools.h" long int hires_timer_freq; // Hires timer frequency long int hires_timer_start; // Hires timer start @@ -63,15 +64,17 @@ static long queryTime(void) { struct timeval tv; if (gettimeofday(&tv, NULL) == -1) { -#ifdef _DEBUG - printf("Could not read current time\n"); -#endif + printfDebug("Could not read current time\n"); } long result = tv.tv_sec * 1000000l + tv.tv_usec; return result; } +JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebugLevel(JNIEnv *env, jclass clazz, jint debug_level) { + setDebugLevel(debug_level); +} + /* * Class: org_lwjgl_Sys * Method: getTime @@ -107,9 +110,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority (JNIEnv * env, jclass clazz, jint priority) { -#ifdef _DEBUG - printf("Unsupported\n"); -#endif + printfDebug("WARNING: setProcessPriority unsupported\n"); } /* Index: org_lwjgl_input_Keyboard.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Keyboard.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- org_lwjgl_input_Keyboard.cpp 6 Nov 2003 14:30:25 -0000 1.18 +++ org_lwjgl_input_Keyboard.cpp 15 Dec 2003 11:49:17 -0000 1.19 @@ -70,16 +70,12 @@ static bool handleKey(UInt32 key_code, unsigned char state) { if (key_code >= KEYBOARD_SIZE) { -#ifdef _DEBUG - printf("Key code >= %d %x\n", KEYBOARD_SIZE, (unsigned int)key_code); -#endif + printfDebug("Key code >= %d %x\n", KEYBOARD_SIZE, (unsigned int)key_code); return false; } unsigned char mapped_code = key_map[key_code]; if (mapped_code == 0) { -#ifdef _DEBUG - printf("unknown key code: %x\n", (unsigned int)key_code); -#endif + printfDebug("unknown key code: %x\n", (unsigned int)key_code); return false; } return handleMappedKey(mapped_code, state); @@ -133,9 +129,7 @@ KeyboardLayoutRef layout; OSStatus err = KLGetCurrentKeyboardLayout(&layout); if (err != noErr) { -#ifdef _DEBUG - printf("Could not get current keyboard layout\n"); -#endif + printfDebug("Could not get current keyboard layout\n"); return false; } @@ -149,9 +143,7 @@ success = success && GetEventParameter(event, kEventParamKeyboardType, typeUInt32, NULL, sizeof(keyboardType), NULL, &keyboardType) == noErr; success = success && GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifierKeyState), NULL, &modifierKeyState) == noErr; if (!success) { -#ifdef _DEBUG - printf("Could not get event parameters for character translation\n"); -#endif + printfDebug("Could not get event parameters for character translation\n"); return false; } err = KLGetKeyboardLayoutProperty(layout, kKLuchrData, (const void **)&uchrHandle); @@ -183,9 +175,7 @@ if (state) return writeAsciiChars(count, ascii_buffer); } else { -#ifdef _DEBUG - printf("Could not translate key\n"); -#endif + printfDebug("Could not translate key\n"); return false; } } @@ -196,9 +186,7 @@ UInt32 key_code; OSStatus err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(key_code), NULL, &key_code); if (err != noErr) { -#ifdef _DEBUG - printf("Could not get event key code\n"); -#endif + printfDebug("Could not get event key code\n"); return; } if (handleKey(key_code, 1) && !handleTranslation(event, true)) { @@ -211,9 +199,7 @@ UInt32 key_code; OSStatus err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(key_code), NULL, &key_code); if (err != noErr) { -#ifdef _DEBUG - printf("Could not get event key code\n"); -#endif + printfDebug("Could not get event key code\n"); return; } if (handleKey(key_code, 0) && !handleTranslation(event, false)) { @@ -236,9 +222,7 @@ UInt32 modifier_bits; OSStatus err = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, sizeof(modifier_bits), NULL, &modifier_bits); if (err != noErr) { -#ifdef _DEBUG - printf("Could not get event key code\n"); -#endif + printfDebug("Could not get event key code\n"); return; } handleModifier(modifier_bits, controlKey, 0x1d); Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/macosx/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- org_lwjgl_input_Mouse.cpp 26 Oct 2003 08:44:19 -0000 1.21 +++ org_lwjgl_input_Mouse.cpp 15 Dec 2003 11:49:17 -0000 1.22 @@ -70,9 +70,7 @@ static void handleButton(unsigned char button_index, jbyte state) { if (button_index >= NUM_BUTTONS) { -#ifdef _DEBUG - printf("Button index %d out of range [0..%d]\n", button_index, NUM_BUTTONS); -#endif + printfDebug("Button index %d out of range [0..%d]\n", button_index, NUM_BUTTONS); return; } button_states[button_index] = state; @@ -108,9 +106,7 @@ } } } -#ifdef _DEBUG - printf("Recieved an unknown HID device event\n"); -#endif + printfDebug("Recieved an unknown HID device event\n"); } } */ @@ -124,9 +120,7 @@ EventMouseButton button; OSStatus err = GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(button), NULL, &button); if (err != noErr) { -#ifdef _DEBUG - printf("Could not get button parameter from event\n"); -#endif + printfDebug("Could not get button parameter from event\n"); return; } handleButton(button - 1, state); @@ -136,9 +130,7 @@ HIPoint delta; OSStatus err = GetEventParameter(event, kEventParamMouseDelta, typeHIPoint, NULL, sizeof(delta), NULL, &delta); if (err != noErr) { -#ifdef _DEBUG - printf("Could not delta parameter from event\n"); -#endif + printfDebug("Could not delta parameter from event\n"); return; } last_dx += (int)delta.x; @@ -149,9 +141,7 @@ long delta; OSStatus err = GetEventParameter(event, kEventParamMouseWheelDelta, typeLongInteger, NULL, sizeof(delta), NULL, &delta); if (err != noErr) { -#ifdef _DEBUG - printf("Could not delta parameter from event\n"); -#endif + printfDebug("Could not delta parameter from event\n"); return; } last_dz += (int)delta; |
Update of /cvsroot/java-game-lib/LWJGL/src/native/linux In directory sc8-pr-cvs1:/tmp/cvs-serv8597/src/native/linux Modified Files: extxcursor.cpp org_lwjgl_Display.cpp org_lwjgl_Sys.cpp org_lwjgl_input_Mouse.cpp org_lwjgl_opengl_Pbuffer.cpp org_lwjgl_opengl_Window.cpp Log Message: Replaced debug libraries with runtime debug condition Index: extxcursor.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/extxcursor.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/extxcursor.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- extxcursor.cpp 20 May 2003 14:28:30 -0000 1.4 +++ extxcursor.cpp 15 Dec 2003 11:49:17 -0000 1.5 @@ -1,6 +1,7 @@ #include <stdio.h> #include <dlfcn.h> #include "extxcursor.h" +#include "common_tools.h" static void * xcursor_handle = NULL; static const char *xcursor_lib_name = "libXcursor.so.1"; @@ -39,9 +40,7 @@ load_success = false; xcursor_handle = dlopen(xcursor_lib_name, RTLD_GLOBAL | RTLD_LAZY); if (xcursor_handle == NULL) { -#ifdef _DEBUG - printf("Could not load %s: %s\n", xcursor_lib_name, dlerror()); -#endif + printfDebug("Could not load %s: %s\n", xcursor_lib_name, dlerror()); return load_success; } loadFunctionPointers(); Index: org_lwjgl_Display.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Display.cpp,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- org_lwjgl_Display.cpp 24 Oct 2003 05:51:50 -0000 1.42 +++ org_lwjgl_Display.cpp 15 Dec 2003 11:49:17 -0000 1.43 @@ -61,20 +61,14 @@ int event_base, error_base; if (!XF86VidModeQueryExtension(disp, &event_base, &error_base)) { -#ifdef _DEBUG - printf("XF86VidMode extension not available\n"); -#endif + printfDebug("XF86VidMode extension not available\n"); return false; } if (!XF86VidModeQueryVersion(disp, major, minor)) { -#ifdef _DEBUG - printf("Could not determine XF86VidMode version\n"); -#endif + printfDebug("Could not determine XF86VidMode version\n"); return false; } -#ifdef _DEBUG - printf("XF86VidMode extension version %i.%i\n", *major, *minor); -#endif + printfDebug("XF86VidMode extension version %i.%i\n", *major, *minor); return true; } @@ -90,24 +84,17 @@ int num_modes, i; XF86VidModeModeInfo **avail_modes; if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { -#ifdef _DEBUG - printf("Could not get display modes\n"); -#endif + printfDebug("Could not get display modes\n"); return false; } XF86VidModeLockModeSwitch(disp, screen, 0); for ( i = 0; i < num_modes; ++i ) { -#ifdef _DEBUG - printf("Mode %d: %dx%d\n", i, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay); -#endif + printfDebug("Mode %d: %dx%d\n", i, avail_modes[i]->hdisplay, avail_modes[i]->vdisplay); if (avail_modes[i]->hdisplay == width && avail_modes[i]->vdisplay == height) { if (!XF86VidModeSwitchToMode(disp, screen, avail_modes[i])) { -#ifdef _DEBUG - printf("Could not switch mode\n"); -#endif + printfDebug("Could not switch mode\n"); break; } -// XF86VidModeSetViewPort(disp, screen, 0, 0); if (lock_mode) XF86VidModeLockModeSwitch(disp, screen, 1); XFree(avail_modes); @@ -131,15 +118,11 @@ static int getGammaRampLength(Display *disp, int screen) { int minor_ver, major_ver, ramp_size; if (!getVidModeExtensionVersion(disp, screen, &major_ver, &minor_ver) || major_ver < 2) { -#ifdef _DEBUG - printf("XF86VidMode extension version >= 2 not found\n"); -#endif + printfDebug("XF86VidMode extension version >= 2 not found\n"); return 0; } if (XF86VidModeGetGammaRampSize(disp, screen, &ramp_size) == False) { -#ifdef _DEBUG - printf("XF86VidModeGetGammaRampSize call failed\n"); -#endif + printfDebug("XF86VidModeGetGammaRampSize call failed\n"); return 0; } return ramp_size; @@ -153,24 +136,18 @@ int screen; Display *disp = XOpenDisplay(NULL); if (disp == NULL) { -#ifdef _DEBUG - printf("Could not open X connection\n"); -#endif + printfDebug("Could not open X connection\n"); return; } screen = DefaultScreen(disp); if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { -#ifdef _DEBUG - printf("Could not get display modes\n"); -#endif + printfDebug("Could not get display modes\n"); } saved_width = avail_modes[0]->hdisplay; saved_height = avail_modes[0]->vdisplay; int bpp = XDefaultDepth(disp, screen); -#ifdef _DEBUG - printf("Saved width, height %d, %d\n", saved_width, saved_height); -#endif + printfDebug("Saved width, height %d, %d\n", saved_width, saved_height); jclass jclass_DisplayMode = env->FindClass("org/lwjgl/DisplayMode"); jmethodID ctor = env->GetMethodID(jclass_DisplayMode, "<init>", "(IIII)V"); jobject newMode = env->NewObject(jclass_DisplayMode, ctor, saved_width, saved_height, bpp, 0); @@ -218,9 +195,7 @@ Display *disp = XOpenDisplay(NULL); if (disp == NULL) { -#ifdef _DEBUG - printf("Could not open X connection\n"); -#endif + printfDebug("Could not open X connection\n"); return; } screen = DefaultScreen(disp); @@ -232,11 +207,6 @@ XCloseDisplay(disp); } -/* - * Class: org_lwjgl_Display - * Method: nGetAvailableDisplayModes - * Signature: ()[Lorg/lwjgl/DisplayMode; - */ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_nGetAvailableDisplayModes (JNIEnv * env, jclass clazz) { @@ -246,9 +216,7 @@ XF86VidModeModeInfo **avail_modes; if (disp == NULL) { -#ifdef _DEBUG - printf("Could not open X connection\n"); -#endif + printfDebug("Could not open X connection\n"); return NULL; } @@ -256,9 +224,7 @@ int bpp = XDefaultDepth(disp, screen); if (!getDisplayModes(disp, screen, &num_modes, &avail_modes)) { -#ifdef _DEBUG - printf("Could not get display modes\n"); -#endif + printfDebug("Could not get display modes\n"); XCloseDisplay(disp); return NULL; } Index: org_lwjgl_Sys.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Sys.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_Sys.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- org_lwjgl_Sys.cpp 22 Nov 2003 19:20:05 -0000 1.19 +++ org_lwjgl_Sys.cpp 15 Dec 2003 11:49:17 -0000 1.20 @@ -43,6 +43,7 @@ #include <sys/time.h> #include <sys/resource.h> #include "org_lwjgl_Sys.h" +#include "common_tools.h" static long int hires_timer_freq; // Hires timer frequency static long int hires_timer_start; // Hires timer start @@ -62,15 +63,17 @@ static long queryTime(void) { struct timeval tv; if (gettimeofday(&tv, NULL) == -1) { -#ifdef _DEBUG - printf("Could not read current time\n"); -#endif + printfDebug("Could not read current time\n"); } long result = tv.tv_sec * 1000000l + tv.tv_usec; return result; } +JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebugLevel(JNIEnv *env, jclass clazz, jint debug_level) { + setDebugLevel(debug_level); +} + /* * Class: org_lwjgl_Sys * Method: getTime @@ -114,9 +117,7 @@ // Reset scheduler to normal sched_pri.sched_priority = 0; if (sched_setscheduler(0, SCHED_OTHER, &sched_pri) != 0) { -#ifdef _DEBUG - printf("Could not set realtime priority\n"); -#endif + printfDebug("Could not set realtime priority\n"); return; } } @@ -126,16 +127,12 @@ min_pri = sched_get_priority_min(SCHED_FIFO); max_pri = sched_get_priority_max(SCHED_FIFO); if (min_pri == -1 || max_pri == -1) { -#ifdef _DEBUG - printf("Failed to set realtime priority\n"); -#endif + printfDebug("Failed to set realtime priority\n"); return; } sched_pri.sched_priority = (max_pri + min_pri)/2; if (sched_setscheduler(0, SCHED_FIFO, &sched_pri) != 0) { -#ifdef _DEBUG - printf("Could not set realtime priority\n"); -#endif + printfDebug("Could not set realtime priority\n"); return; } return; @@ -153,9 +150,7 @@ } if (setpriority(PRIO_PROCESS, 0, linux_priority) == -1) { -#ifdef _DEBUG - printf("Failed to set priority.\n"); -#endif + printfDebug("Failed to set priority.\n"); } } Index: org_lwjgl_input_Mouse.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_input_Mouse.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- org_lwjgl_input_Mouse.cpp 20 Oct 2003 12:49:50 -0000 1.41 +++ org_lwjgl_input_Mouse.cpp 15 Dec 2003 11:49:17 -0000 1.42 @@ -122,9 +122,7 @@ static bool blankCursor(void) { unsigned int best_width, best_height; if (XQueryBestCursor(getCurrentDisplay(), getCurrentWindow(), 1, 1, &best_width, &best_height) == 0) { -#ifdef _DEBUG - printf("Could not query best cursor size\n"); -#endif + printfDebug("Could not query best cursor size\n"); return false; } Pixmap mask = XCreatePixmap(getCurrentDisplay(), getCurrentWindow(), best_width, best_height, 1); @@ -201,14 +199,10 @@ event.xmotion.y > current_y - POINTER_WARP_BORDER && event.xmotion.y < current_y + POINTER_WARP_BORDER) break; -#ifdef _DEBUG - printf("Skipped event searching for warp event %d, %d\n", event.xmotion.x, event.xmotion.y); -#endif + printfDebug("Skipped event searching for warp event %d, %d\n", event.xmotion.x, event.xmotion.y); } -#ifdef _DEBUG if (i == WARP_RETRY) - printf("Never got warp event\n"); -#endif + printfDebug("Never got warp event\n"); } static void warpPointer(void) { Index: org_lwjgl_opengl_Pbuffer.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Pbuffer.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- org_lwjgl_opengl_Pbuffer.cpp 22 Oct 2003 11:45:51 -0000 1.4 +++ org_lwjgl_opengl_Pbuffer.cpp 15 Dec 2003 11:49:17 -0000 1.5 @@ -161,9 +161,7 @@ GLXPbuffer buffer = buffer_info->buffer; GLXContext context = buffer_info->context; if (glXMakeContextCurrent(getCurrentDisplay(), buffer, buffer, context) == False) { -#ifdef _DEBUG - printf("Could not make pbuffer current"); -#endif + printfDebug("Could not make pbuffer current"); } } Index: org_lwjgl_opengl_Window.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Window.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/linux/org_lwjgl_opengl_Window.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- org_lwjgl_opengl_Window.cpp 2 Nov 2003 14:41:20 -0000 1.11 +++ org_lwjgl_opengl_Window.cpp 15 Dec 2003 11:49:17 -0000 1.12 @@ -208,9 +208,7 @@ } win = XCreateWindow(disp, root_win, x, y, width, height, 0, vis_info->depth, InputOutput, vis_info->visual, attribmask, &attribs); XFreeColormap(disp, cmap); -#ifdef _DEBUG - printf("Created window\n"); -#endif + printfDebug("Created window\n"); current_win = win; Java_org_lwjgl_opengl_Window_nSetTitle(env, NULL, title); XSizeHints * size_hints = XAllocSizeHints(); @@ -383,9 +381,8 @@ throwException(env, "Could not create visual info from FB config"); return false; } -#ifdef _DEBUG - dumpVisualInfo(disp, vis_info); -#endif + if (ATDEBUGLEVEL()) + dumpVisualInfo(disp, vis_info); createWindow(env, disp, screen, vis_info, title, x, y, width, height, fscreen); glx_window = glXCreateWindow(disp, configs[0], getCurrentWindow(), NULL); makeCurrent(); @@ -400,9 +397,8 @@ throwException(env, "Could not find a matching pixel format"); return false; } -#ifdef _DEBUG - dumpVisualInfo(disp, vis_info); -#endif + if (ATDEBUGLEVEL()) + dumpVisualInfo(disp, vis_info); context = glXCreateContext(disp, vis_info, NULL, True); if (context == NULL) { XFree(vis_info); @@ -467,10 +463,10 @@ throwException(env, "Could not init gl function pointers"); return; } -#ifdef _DEBUG - const GLubyte * extensions = glGetString(GL_EXTENSIONS); - printf("Supported extensions: %s\n", extensions); -#endif + if (ATDEBUGLEVEL()) { + const GLubyte * extensions = glGetString(GL_EXTENSIONS); + printf("Supported extensions: %s\n", extensions); + } } /* |
|
From: Elias N. <eli...@us...> - 2003-12-15 11:49:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv8597/src/native/common Modified Files: checkALerror.h checkGLerror.h common_tools.cpp common_tools.h extal.cpp extgl.cpp org_lwjgl_Sys.h Log Message: Replaced debug libraries with runtime debug condition Index: checkALerror.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/checkALerror.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/checkALerror.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- checkALerror.h 14 Dec 2002 12:49:16 -0000 1.6 +++ checkALerror.h 15 Dec 2003 11:49:16 -0000 1.7 @@ -10,36 +10,32 @@ #ifndef _CHECKALERROR_H_INCLUDED_ #define _CHECKALERROR_H_INCLUDED_ -#ifdef _DEBUG - #include <jni.h> #include "extal.h" +#include "common_tools.h" #define CHECK_AL_ERROR \ { \ - int err = alGetError(); \ - if (err != AL_NO_ERROR) { \ - jclass cls = env->FindClass("org/lwjgl/openal/OpenALException"); \ - env->ThrowNew(cls, (const char*) alGetString(err)); \ - env->DeleteLocalRef(cls); \ + if (ATDEBUGLEVEL()) { \ + int err = alGetError(); \ + if (err != AL_NO_ERROR) { \ + jclass cls = env->FindClass("org/lwjgl/openal/OpenALException"); \ + env->ThrowNew(cls, (const char*) alGetString(err)); \ + env->DeleteLocalRef(cls); \ + } \ } \ } /* only available if deviceaddress is specified in method */ #define CHECK_ALC_ERROR \ { \ - int err = alcGetError((ALCdevice*) deviceaddress); \ - if (err != AL_NO_ERROR) { \ - jclass cls = env->FindClass("org/lwjgl/openal/OpenALException"); \ - env->ThrowNew(cls, (const char*) alcGetString((ALCdevice*) deviceaddress, err)); \ - env->DeleteLocalRef(cls); \ + if (ATDEBUGLEVEL()) { \ + int err = alcGetError((ALCdevice*) deviceaddress); \ + if (err != AL_NO_ERROR) { \ + jclass cls = env->FindClass("org/lwjgl/openal/OpenALException"); \ + env->ThrowNew(cls, (const char*) alcGetString((ALCdevice*) deviceaddress, err)); \ + env->DeleteLocalRef(cls); \ + } \ } \ } - -#else - -#define CHECK_AL_ERROR -#define CHECK_ALC_ERROR - -#endif /* _DEBUG */ #endif /* _CHECKALERROR_H_INCLUDED_ */ Index: checkGLerror.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/checkGLerror.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/checkGLerror.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- checkGLerror.h 13 Mar 2003 19:31:10 -0000 1.7 +++ checkGLerror.h 15 Dec 2003 11:49:16 -0000 1.8 @@ -10,18 +10,19 @@ #ifndef _CHECKGLERROR_H_INCLUDED_ #define _CHECKGLERROR_H_INCLUDED_ -#ifdef _DEBUG - #include <jni.h> #include "extgl.h" +#include "common_tools.h" #define CHECK_GL_ERROR \ { \ - int err = glGetError(); \ - if (err != GL_NO_ERROR) { \ - jclass cls = env->FindClass("org/lwjgl/opengl/OpenGLException"); \ - env->ThrowNew(cls, (const char *)gluErrorString(err)); \ - env->DeleteLocalRef(cls); \ + if (ATDEBUGLEVEL()) { \ + int err = glGetError(); \ + if (err != GL_NO_ERROR) { \ + jclass cls = env->FindClass("org/lwjgl/opengl/OpenGLException"); \ + env->ThrowNew(cls, (const char *)gluErrorString(err)); \ + env->DeleteLocalRef(cls); \ + } \ } \ } @@ -33,12 +34,5 @@ env->DeleteLocalRef(cls); \ } \ } \ - -#else - -#define CHECK_GL_ERROR -#define CHECK_EXISTS(f) - -#endif /* _DEBUG */ #endif /* _CHECKGLERROR_H_INCLUDED_ */ Index: common_tools.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/common_tools.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- common_tools.cpp 29 Oct 2003 16:21:42 -0000 1.4 +++ common_tools.cpp 15 Dec 2003 11:49:16 -0000 1.5 @@ -39,6 +39,20 @@ #include "common_tools.h" +int debug_level = org_lwjgl_Sys_DEBUG_DISABLED; + +void setDebugLevel(int level) { + debug_level = level; +} + +int printfDebug(const char *format, ...) { + va_list ap; + va_start(ap, format); + int result = vprintf(format, ap); + va_end(ap); + return result; +} + static void incListStart(event_queue_t *queue) { queue->list_start = (queue->list_start + 1)%EVENT_BUFFER_SIZE; } @@ -51,9 +65,7 @@ void putEventElement(event_queue_t *queue, unsigned char byte) { int next_index = (queue->list_end + 1)%EVENT_BUFFER_SIZE; if (next_index == queue->list_start) { -#ifdef _DEBUG - printf("Event buffer overflow!\n"); -#endif + printfDebug("Event buffer overflow!\n"); return; } queue->input_event_buffer[queue->list_end] = byte; Index: common_tools.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/common_tools.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/common_tools.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- common_tools.h 29 Oct 2003 16:21:42 -0000 1.3 +++ common_tools.h 15 Dec 2003 11:49:16 -0000 1.4 @@ -41,9 +41,13 @@ #define _COMMON_TOOLS_H #include <jni.h> +#include "org_lwjgl_Sys.h" + +extern int debug_level; // Must be x * max_event_size + 1 #define EVENT_BUFFER_SIZE (25 * 4 + 1) +#define ATDEBUGLEVEL() (debug_level >= org_lwjgl_Sys_DEBUG_ENABLED) typedef struct { unsigned char input_event_buffer[EVENT_BUFFER_SIZE]; @@ -60,5 +64,7 @@ extern int getEventBufferSize(event_queue_t *event_queue); extern void throwException(JNIEnv *env, const char *msg); extern void throwOpenALException(JNIEnv * env, const char * err); +extern void setDebugLevel(int level); +extern int printfDebug(const char *format, ...); #endif Index: extal.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extal.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extal.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- extal.cpp 23 Oct 2003 18:21:56 -0000 1.12 +++ extal.cpp 15 Dec 2003 11:49:16 -0000 1.13 @@ -182,9 +182,7 @@ static void* GetFunctionPointer(const char* function) { void *p = NativeGetFunctionPointer(function); if (p == NULL) { -#ifdef _DEBUG - printf("Could not locate symbol %s\n", function); -#endif + printfDebug("Could not locate symbol %s\n", function); } return p; } @@ -195,15 +193,11 @@ static bool LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) { jsize pathcount = env->GetArrayLength(oalPaths); -#ifdef _DEBUG - printf("Found %d OpenAL paths\n", (int)pathcount); -#endif + printfDebug("Found %d OpenAL paths\n", (int)pathcount); for(int i=0;i<pathcount;i++) { jstring path = (jstring) env->GetObjectArrayElement(oalPaths, i); const char *path_str = env->GetStringUTFChars(path, NULL); -#ifdef _DEBUG - printf("Testing '%s'\n", path_str); -#endif + printfDebug("Testing '%s'\n", path_str); #ifdef _WIN32 handleOAL = LoadLibrary(path_str); #endif @@ -214,9 +208,7 @@ handleOAL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR); #endif if (handleOAL != NULL) { -#ifdef _DEBUG - printf("Found OpenAL at '%s'\n", path_str); -#endif + printfDebug("Found OpenAL at '%s'\n", path_str); return true; } env->ReleaseStringUTFChars(path, path_str); Index: extgl.cpp CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extgl.cpp =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- extgl.cpp 29 Sep 2003 11:58:35 -0000 1.5 +++ extgl.cpp 15 Dec 2003 11:49:16 -0000 1.6 @@ -33,9 +33,10 @@ */ -#include "extgl.h" #include <stdio.h> #include <string.h> +#include "extgl.h" +#include "common_tools.h" /* turn off the warning for the borland compiler*/ #ifdef __BORLANDC__ @@ -1338,9 +1339,7 @@ err = FindFolder (kSystemDomain, kFrameworksFolderType, false, &fileRefParam.ioVRefNum, &fileRefParam.ioDirID); if (noErr != err) { -#ifdef _DEBUG - printf("Could not find frameworks folder\n"); -#endif + printfDebug("Could not find frameworks folder\n"); return NULL; } @@ -1351,9 +1350,7 @@ if (noErr != err) { -#ifdef _DEBUG - printf("Could make FSref to frameworks folder\n"); -#endif + printfDebug("Could make FSref to frameworks folder\n"); return NULL; } @@ -1362,9 +1359,7 @@ bundleURLOpenGL = CFURLCreateFromFSRef (kCFAllocatorDefault, &fileRef); if (!bundleURLOpenGL) { -#ifdef _DEBUG - printf("Could create framework URL\n"); -#endif + printfDebug("Could create framework URL\n"); return NULL; } @@ -1372,18 +1367,14 @@ CFRelease (bundleURLOpenGL); if (bundle_ref == NULL) { -#ifdef _DEBUG - printf("Could not load framework\n"); -#endif + printfDebug("Could not load framework\n"); return NULL; } // if the code was successfully loaded, look for our function. if (!CFBundleLoadExecutable(bundle_ref)) { -#ifdef _DEBUG - printf("Could not load MachO executable\n"); -#endif + printfDebug("Could not load MachO executable\n"); CFRelease(bundle_ref); return NULL; } @@ -1412,9 +1403,7 @@ { t = GetProcAddress(lib_glu_handle, name); if (t == NULL) { -#ifdef _DEBUG - printf("Could not locate symbol %s\n", name); -#endif + printfDebug("Could not locate symbol %s\n", name); extgl_error = true; } } @@ -1431,9 +1420,7 @@ { t = dlsym(lib_glu_handle, name); if (t == NULL) { -#ifdef _DEBUG - printf("Could not locate symbol %s\n", name); -#endif + printfDebug("Could not locate symbol %s\n", name); extgl_error = true; } } @@ -1447,9 +1434,7 @@ if (func_pointer == NULL) { func_pointer = CFBundleGetFunctionPointerForName(agl_bundle_ref, str); if (func_pointer == NULL) { -#ifdef _DEBUG - printf("Could not locate symbol %s\n", name); -#endif + printfDebug("Could not locate symbol %s\n", name); extgl_error = true; } } @@ -1464,9 +1449,7 @@ GLubyte *where, *terminator; if (extensions == NULL) { -#ifdef _DEBUG - printf("NULL extension string\n"); -#endif + printfDebug("NULL extension string\n"); extgl_error = true; return false; } @@ -3308,16 +3291,12 @@ { lib_gl_handle = dlopen("libGL.so.1", RTLD_LAZY | RTLD_GLOBAL); if (lib_gl_handle == NULL) { -#ifdef _DEBUG - printf("Error loading libGL.so.1: %s\n", dlerror()); -#endif + printfDebug("Error loading libGL.so.1: %s\n", dlerror()); return false; } lib_glu_handle = dlopen("libGLU.so.1", RTLD_LAZY | RTLD_GLOBAL); if (lib_glu_handle == NULL) { -#ifdef _DEBUG - printf("Error loading libGLU.so.1: %s\n", dlerror()); -#endif + printfDebug("Error loading libGLU.so.1: %s\n", dlerror()); dlclose(lib_gl_handle); return false; } Index: org_lwjgl_Sys.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/org_lwjgl_Sys.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/org_lwjgl_Sys.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- org_lwjgl_Sys.h 25 Nov 2003 22:28:27 -0000 1.15 +++ org_lwjgl_Sys.h 15 Dec 2003 11:49:16 -0000 1.16 @@ -8,6 +8,10 @@ extern "C" { #endif /* Inaccessible static: _00024assertionsDisabled */ +#undef org_lwjgl_Sys_DEBUG_DISABLED +#define org_lwjgl_Sys_DEBUG_DISABLED 1L +#undef org_lwjgl_Sys_DEBUG_ENABLED +#define org_lwjgl_Sys_DEBUG_ENABLED 2L #undef org_lwjgl_Sys_LOW_PRIORITY #define org_lwjgl_Sys_LOW_PRIORITY -1L #undef org_lwjgl_Sys_NORMAL_PRIORITY @@ -18,8 +22,15 @@ #define org_lwjgl_Sys_REALTIME_PRIORITY 2L /* Inaccessible static: LIBRARY_NAME */ /* Inaccessible static: DEBUG */ -/* Inaccessible static: _debug */ /* Inaccessible static: class_00024org_00024lwjgl_00024Sys */ +/* + * Class: org_lwjgl_Sys + * Method: setDebugLevel + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setDebugLevel + (JNIEnv *, jclass, jint); + /* * Class: org_lwjgl_Sys * Method: getTimerResolution |
|
From: Elias N. <eli...@us...> - 2003-12-15 11:49:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/native In directory sc8-pr-cvs1:/tmp/cvs-serv8597/src/native Modified Files: configure.in Log Message: Replaced debug libraries with runtime debug condition Index: configure.in CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/configure.in =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/configure.in,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -r1.48 -r1.49 --- configure.in 22 Oct 2003 10:57:18 -0000 1.48 +++ configure.in 15 Dec 2003 11:49:16 -0000 1.49 @@ -16,32 +16,22 @@ AC_PROG_MAKE_SET AC_PROG_CXX -AC_ARG_ENABLE(debug, -AC_HELP_STRING([--disable-debug], [Disable debug build]), -[build_debug=$enableval], [build_debug=no]) - -if test $build_debug = yes; then - DEBUG_FLAGS=-D_DEBUG -else - DEBUG_FLAGS= -fi - AC_CANONICAL_HOST case "$host_os" in darwin*) _BUILD_FLAGS="-D_AGL -fpascal-strings" LDFLAGS="-Xlinker -framework -Xlinker JavaVM -Xlinker -framework -Xlinker ApplicationServices -Xlinker -framework -Xlinker CoreServices -Xlinker -framework -Xlinker Carbon" NATIVE_BUILD_DIR=macosx - CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" - CFLAGS="$CFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" + CXXFLAGS="$CXXFLAGS -Wall $_BUILD_FLAGS" + CFLAGS="$CFLAGS -Wall $_BUILD_FLAGS" ;; bsdi* | linux* | solaris*) AC_PATH_XTRA AC_LIBTOOL_DLOPEN _BUILD_FLAGS="-pthread -D_X11 $X_CFLAGS" AC_CHECK_HEADERS([AL/altypes.h AL/alctypes.h],, AC_MSG_ERROR([OpenAL headers required])) NATIVE_BUILD_DIR=linux - CXXFLAGS="$CXXFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" - CFLAGS="$CFLAGS $DEBUG_FLAGS -Wall $_BUILD_FLAGS" + CXXFLAGS="$CXXFLAGS -Wall $_BUILD_FLAGS" + CFLAGS="$CFLAGS -Wall $_BUILD_FLAGS" LIBS="$LIBS $X_LIBS" AC_CHECK_LIB(X11, XOpenDisplay,, AC_MSG_ERROR(X11 is required)) AC_CHECK_LIB(Xext, main,, AC_MSG_ERROR(Xext is required)) |
|
From: Elias N. <eli...@us...> - 2003-12-15 11:49:20
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal In directory sc8-pr-cvs1:/tmp/cvs-serv8597/src/java/org/lwjgl/openal Modified Files: BaseAL.java Log Message: Replaced debug libraries with runtime debug condition Index: BaseAL.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/openal/BaseAL.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- BaseAL.java 22 Oct 2003 10:57:18 -0000 1.22 +++ BaseAL.java 15 Dec 2003 11:49:16 -0000 1.23 @@ -142,7 +142,7 @@ private static String getPathFromJWS(String libname) { try { - if(Sys.DEBUG) { + if(Sys.atDebugLevel()) { System.out.println("JWS Classloader looking for: " + libname); } @@ -154,7 +154,7 @@ return (String) findLibrary.invoke(o, arguments); } catch (Exception e) { - if(Sys.DEBUG) { + if(Sys.atDebugLevel()) { System.out.println("Failure locating OpenAL using classloader:"); e.printStackTrace(); } |
|
From: Elias N. <eli...@us...> - 2003-12-15 11:49:19
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl In directory sc8-pr-cvs1:/tmp/cvs-serv8597/src/java/org/lwjgl/opengl Modified Files: GLCaps.java Log Message: Replaced debug libraries with runtime debug condition Index: GLCaps.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLCaps.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/opengl/GLCaps.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- GLCaps.java 28 Oct 2003 19:12:54 -0000 1.12 +++ GLCaps.java 15 Dec 2003 11:49:16 -0000 1.13 @@ -162,13 +162,13 @@ } private static void setExtensionFields(HashSet exts, HashMap field_map) { - if(org.lwjgl.Sys.DEBUG) { + if(org.lwjgl.Sys.atDebugLevel()) { System.out.println("Available extensions:"); } Iterator it = exts.iterator(); while (it.hasNext()) { String ext = (String)it.next(); - if(org.lwjgl.Sys.DEBUG) { + if(org.lwjgl.Sys.atDebugLevel()) { System.out.println(ext); } |
|
From: Elias N. <eli...@us...> - 2003-12-15 11:49:19
|
Update of /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl In directory sc8-pr-cvs1:/tmp/cvs-serv8597/src/java/org/lwjgl Modified Files: Display.java Sys.java Log Message: Replaced debug libraries with runtime debug condition Index: Display.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Display.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- Display.java 22 Oct 2003 18:34:41 -0000 1.34 +++ Display.java 15 Dec 2003 11:49:16 -0000 1.35 @@ -80,7 +80,7 @@ static { System.loadLibrary(Sys.getLibraryName()); init(); - if (Sys.DEBUG) { + if (Sys.atDebugLevel()) { System.out.println("Adapter: "+getAdapter()+" Version: "+getVersion()); } } @@ -120,7 +120,7 @@ DisplayMode[] filteredModes = new DisplayMode[modes.size()]; modes.toArray(filteredModes); - if (Sys.DEBUG) { + if (Sys.atDebugLevel()) { System.out.println("Removed " + (unfilteredModes.length - filteredModes.length) + " duplicate displaymodes"); } @@ -239,7 +239,7 @@ gammaRamp.put(i, rampEntry); } setGammaRamp(gammaRamp); - if (Sys.DEBUG) { + if (Sys.atDebugLevel()) { System.out.println("Gamma set, gamma = " + gamma + ", brightness = " + brightness + ", contrast = " + contrast); } } Index: Sys.java CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/java/org/lwjgl/Sys.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- Sys.java 28 Oct 2003 21:44:46 -0000 1.32 +++ Sys.java 15 Dec 2003 11:49:16 -0000 1.33 @@ -47,6 +47,9 @@ * @version $Revision$ */ public final class Sys { + /** Debug level constants */ + public static final int DEBUG_DISABLED = 1; + public static final int DEBUG_ENABLED = 2; /** Low process priority. @see #setProcessPriority() */ public static final int LOW_PRIORITY = -1; @@ -78,38 +81,26 @@ public static final int REALTIME_PRIORITY = 2; /** The native library name */ - private static String LIBRARY_NAME; + private static String LIBRARY_NAME = "lwjgl"; /** - * Debug flag. This will tell you if you are using the debug version of + * Debug level. This will tell you if you are using the debug version of * the library, and whether assertions are enabled or not. */ - public static final boolean DEBUG; + public static final int DEBUG; - /** - * The ByteBuffer equivalent of the native NULL constant - */ -// public static final ByteBuffer NULL; - - - private static boolean _debug; static { + int _debug = DEBUG_DISABLED; try { assert false; - LIBRARY_NAME = "lwjgl"; - _debug = false; } catch (AssertionError e) { - // Assertions are enabled, so we'll use the debug version of the - // library - LIBRARY_NAME = "lwjgl_d"; - _debug = true; + // Assertions are enabled, so we'll enabled debugging + _debug = DEBUG_ENABLED; } finally { DEBUG = _debug; initialize(); } } - - /** * @return the name of the native library to load @@ -124,11 +115,16 @@ private Sys() { } + public static boolean atDebugLevel() { + return DEBUG >= DEBUG_ENABLED; + } + /** * Initialization. */ private static void initialize() { System.loadLibrary(LIBRARY_NAME); + setDebugLevel(DEBUG); setTime(0); Runtime.getRuntime().addShutdownHook(new Thread() { @@ -144,6 +140,11 @@ }); } + + /** + * Set the debug level of the native library + */ + private static native void setDebugLevel(int level); /** * Obtains the number of ticks that the hires timer does in a second. |
|
From: Elias N. <eli...@us...> - 2003-12-15 09:38:23
|
Update of /cvsroot/java-game-lib/LWJGL/src/native/common In directory sc8-pr-cvs1:/tmp/cvs-serv17784/common Modified Files: extgl.h Log Message: Compile fixes for SUSE 9 Index: extgl.h CVS Browser: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/java-game-lib/LWJGL/src/native/common/extgl.h =================================================================== RCS file: /cvsroot/java-game-lib/LWJGL/src/native/common/extgl.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- extgl.h 29 Sep 2003 09:26:20 -0000 1.16 +++ extgl.h 15 Dec 2003 09:38:14 -0000 1.17 @@ -40,7 +40,7 @@ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, + * 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. * The name of the author may be used to endorse or promote products @@ -221,7 +221,222 @@ #ifdef _X11 #include <X11/Xutil.h> -#include <GL/glxtokens.h> + +/* + * Names for attributes to glXGetConfig. + */ +#define GLX_USE_GL 1 /* support GLX rendering */ +#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */ +#define GLX_LEVEL 3 /* level in plane stacking */ +#define GLX_RGBA 4 /* true if RGBA mode */ +#define GLX_DOUBLEBUFFER 5 /* double buffering supported */ +#define GLX_STEREO 6 /* stereo buffering supported */ +#define GLX_AUX_BUFFERS 7 /* number of aux buffers */ +#define GLX_RED_SIZE 8 /* number of red component bits */ +#define GLX_GREEN_SIZE 9 /* number of green component bits */ +#define GLX_BLUE_SIZE 10 /* number of blue component bits */ +#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */ +#define GLX_DEPTH_SIZE 12 /* number of depth bits */ +#define GLX_STENCIL_SIZE 13 /* number of stencil bits */ +#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */ +#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */ +#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */ +#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */ + +#define GLX_SAMPLE_BUFFERS_ARB 100000 /* number of multisample buffers */ +#define GLX_SAMPLES_ARB 100001 /* number of multisample samples */ + +/* + * FBConfig-specific attributes + */ +#define GLX_X_VISUAL_TYPE 0x22 +#define GLX_CONFIG_CAVEAT 0x20 /* Like visual_info VISUAL_CAVEAT */ +#define GLX_TRANSPARENT_TYPE 0x23 +#define GLX_TRANSPARENT_INDEX_VALUE 0x24 +#define GLX_TRANSPARENT_RED_VALUE 0x25 +#define GLX_TRANSPARENT_GREEN_VALUE 0x26 +#define GLX_TRANSPARENT_BLUE_VALUE 0x27 +#define GLX_TRANSPARENT_ALPHA_VALUE 0x28 +#define GLX_DRAWABLE_TYPE 0x8010 +#define GLX_RENDER_TYPE 0x8011 +#define GLX_X_RENDERABLE 0x8012 +#define GLX_FBCONFIG_ID 0x8013 +#define GLX_MAX_PBUFFER_WIDTH 0x8016 +#define GLX_MAX_PBUFFER_HEIGHT 0x8017 +#define GLX_MAX_PBUFFER_PIXELS 0x8018 +#define GLX_VISUAL_ID 0x800B + +#define GLX_DRAWABLE_TYPE_SGIX GLX_DRAWABLE_TYPE +#define GLX_RENDER_TYPE_SGIX GLX_RENDER_TYPE +#define GLX_X_RENDERABLE_SGIX GLX_X_RENDERABLE +#define GLX_FBCONFIG_ID_SGIX GLX_FBCONFIG_ID +#define GLX_MAX_PBUFFER_WIDTH_SGIX GLX_MAX_PBUFFER_WIDTH +#define GLX_MAX_PBUFFER_HEIGHT_SGIX GLX_MAX_PBUFFER_HEIGHT +#define GLX_MAX_PBUFFER_PIXELS_SGIX GLX_MAX_PBUFFER_PIXELS +#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019 +#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A + +/* + * Error return values from glXGetConfig. Success is indicated by + * a value of 0. + */ +#define GLX_BAD_SCREEN 1 /* screen # is bad */ +#define GLX_BAD_ATTRIBUTE 2 /* attribute to get is bad */ +#define GLX_NO_EXTENSION 3 /* no glx extension on server */ +#define GLX_BAD_VISUAL 4 /* visual # not known by GLX */ +#define GLX_BAD_CONTEXT 5 +#define GLX_BAD_VALUE 6 +#define GLX_BAD_ENUM 7 + + +/* FBConfig attribute values */ + +/* + * Generic "don't care" value for glX ChooseFBConfig attributes (except + * GLX_LEVEL). + */ +#define GLX_DONT_CARE 0xFFFFFFFF + +/* GLX_RENDER_TYPE bits */ +#define GLX_RGBA_BIT 0x00000001 +#define GLX_COLOR_INDEX_BIT 0x00000002 +#define GLX_RGBA_BIT_SGIX GLX_RGBA_BIT +#define GLX_COLOR_INDEX_BIT_SGIX GLX_COLOR_INDEX_BIT + +/* GLX_DRAWABLE_TYPE bits */ +#define GLX_WINDOW_BIT 0x00000001 +#define GLX_PIXMAP_BIT 0x00000002 +#define GLX_PBUFFER_BIT 0x00000004 +#define GLX_WINDOW_BIT_SGIX GLX_WINDOW_BIT +#define GLX_PIXMAP_BIT_SGIX GLX_PIXMAP_BIT +#define GLX_PBUFFER_BIT_SGIX GLX_PBUFFER_BIT + +/* GLX_CONFIG_CAVEAT attribute values */ +#define GLX_NONE 0x8000 +#define GLX_SLOW_CONFIG 0x8001 +#define GLX_NON_CONFORMANT_CONFIG 0x800D + +/* GLX_X_VISUAL_TYPE attribute values */ +#define GLX_TRUE_COLOR 0x8002 +#define GLX_DIRECT_COLOR 0x8003 +#define GLX_PSEUDO_COLOR 0x8004 +#define GLX_STATIC_COLOR 0x8005 +#define GLX_GRAY_SCALE 0x8006 +#define GLX_STATIC_GRAY 0x8007 + +/* GLX_TRANSPARENT_TYPE attribute values */ +/* #define GLX_NONE 0x8000 */ +#define GLX_TRANSPARENT_RGB 0x8008 +#define GLX_TRANSPARENT_INDEX 0x8009 + +/* glXCreateGLXPbuffer attributes */ +#define GLX_PRESERVED_CONTENTS 0x801B +#define GLX_LARGEST_PBUFFER 0x801C +#define GLX_PBUFFER_HEIGHT 0x8040 /* New for GLX 1.3 */ +#define GLX_PBUFFER_WIDTH 0x8041 /* New for GLX 1.3 */ +#define GLX_PRESERVED_CONTENTS_SGIX GLX_PRESERVED_CONTENTS +#define GLX_LARGEST_PBUFFER_SGIX GLX_LARGEST_PBUFFER + +/* glXQueryGLXPBuffer attributes */ +#define GLX_WIDTH 0x801D +#define GLX_HEIGHT 0x801E +#define GLX_EVENT_MASK 0x801F +#define GLX_WIDTH_SGIX GLX_WIDTH +#define GLX_HEIGHT_SGIX GLX_HEIGHT +#define GLX_EVENT_MASK_SGIX GLX_EVENT_MASK + +/* glXCreateNewContext render_type attribute values */ +#define GLX_RGBA_TYPE 0x8014 +#define GLX_COLOR_INDEX_TYPE 0x8015 +#define GLX_RGBA_TYPE_SGIX GLX_RGBA_TYPE +#define GLX_COLOR_INDEX_TYPE_SGIX GLX_COLOR_INDEX_TYPE + +/* glXQueryContext attributes */ +/* #define GLX_FBCONFIG_ID 0x8013 */ +/* #define GLX_RENDER_TYPE 0x8011 */ +#define GLX_SCREEN 0x800C + +/* glXSelectEvent event mask bits */ +#define GLX_PBUFFER_CLOBBER_MASK 0x08000000 +#define GLX_PBUFFER_CLOBBER_MASK_SGIX GLX_PBUFFER_CLOBBER_MASK + +/* GLXPbufferClobberEvent event_type values */ +#define GLX_DAMAGED 0x8020 +#define GLX_SAVED 0x8021 +#define GLX_DAMAGED_SGIX GLX_DAMAGED +#define GLX_SAVED_SGIX GLX_SAVED + +/* GLXPbufferClobberEvent draw_type values */ +#define GLX_WINDOW 0x8022 +#define GLX_PBUFFER 0x8023 +#define GLX_WINDOW_SGIX GLX_WINDOW +#define GLX_PBUFFER_SGIX GLX_PBUFFER + +/* GLXPbufferClobberEvent buffer_mask bits */ +#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 +#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 +#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 +#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 +#define GLX_AUX_BUFFERS_BIT 0x00000010 +#define GLX_DEPTH_BUFFER_BIT 0x00000020 +#define GLX_STENCIL_BUFFER_BIT 0x00000040 +#define GLX_ACCUM_BUFFER_BIT 0x00000080 +#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX GLX_FRONT_LEFT_BUFFER_BIT +#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX GLX_FRONT_RIGHT_BUFFER_BIT +#define GLX_BACK_LEFT_BUFFER_BIT_SGIX GLX_BACK_LEFT_BUFFER_BIT +#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX GLX_BACK_RIGHT_BUFFER_BIT +#define GLX_AUX_BUFFERS_BIT_SGIX GLX_AUX_BUFFERS_BIT +#define GLX_DEPTH_BUFFER_BIT_SGIX GLX_DEPTH_BUFFER_BIT +#define GLX_STENCIL_BUFFER_BIT_SGIX GLX_STENCIL_BUFFER_BIT +#define GLX_ACCUM_BUFFER_BIT_SGIX GLX_ACCUM_BUFFER_BIT + +/* + * Extension return values from glXGetConfig. These are also + * accepted as parameter values for glXChooseVisual. + */ + +#define GLX_X_VISUAL_TYPE_EXT 0x22 /* visual_info extension type */ +#define GLX_TRANSPARENT_TYPE_EXT 0x23 /* visual_info extension */ +#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24 /* visual_info extension */ +#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25 /* visual_info extension */ +#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26 /* visual_info extension */ +#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27 /* visual_info extension */ +#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28 /* visual_info extension */ + +/* Property values for visual_type */ +#define GLX_TRUE_COLOR_EXT 0x8002 +#define GLX_DIRECT_COLOR_EXT 0x8003 +#define GLX_PSEUDO_COLOR_EXT 0x8004 +#define GLX_STATIC_COLOR_EXT 0x8005 +#define GLX_GRAY_SCALE_EXT 0x8006 +#define GLX_STATIC_GRAY_EXT 0x8007 + +/* Property values for transparent pixel */ +#define GLX_NONE_EXT 0x8000 +#define GLX_TRANSPARENT_RGB_EXT 0x8008 +#define GLX_TRANSPARENT_INDEX_EXT 0x8009 + +/* Property values for visual_rating */ +#define GLX_VISUAL_CAVEAT_EXT 0x20 /* visual_rating extension type */ +#define GLX_SLOW_VISUAL_EXT 0x8001 +#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D + +/* + * Names for attributes to glXGetClientString. + */ +#define GLX_VENDOR 0x1 +#define GLX_VERSION 0x2 +#define GLX_EXTENSIONS 0x3 + +/* + * Names for attributes to glXQueryContextInfoEXT. + */ +#define GLX_SHARE_CONTEXT_EXT 0x800A /* id of share context */ +#define GLX_VISUAL_ID_EXT 0x800B /* id of context's visual */ +#define GLX_SCREEN_EXT 0x800C /* screen number */ + +/* NV_float_buffer */ +#define GLX_FLOAT_COMPONENTS_NV 0x20B0 typedef XID GLXContextID; typedef XID GLXPixmap; |