Implemented proper debug levels
This commit is contained in:
parent
aae1deef70
commit
fb8fd0a2d7
|
@ -80,9 +80,7 @@ public final class Display {
|
|||
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 @@ public final class Display {
|
|||
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 @@ public final class Display {
|
|||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,8 +48,12 @@ import org.lwjgl.input.Mouse;
|
|||
*/
|
||||
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 @@ public final class Sys {
|
|||
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 @@ public final class Sys {
|
|||
*/
|
||||
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 @@ public final class Sys {
|
|||
*/
|
||||
private static void initialize() {
|
||||
System.loadLibrary(LIBRARY_NAME);
|
||||
setDebugLevel(DEBUG);
|
||||
setDebugLevel(debug_level);
|
||||
setTime(0);
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
|
|
|
@ -142,9 +142,7 @@ public abstract class BaseAL {
|
|||
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 @@ public abstract class BaseAL {
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -162,15 +162,11 @@ public abstract class GLCaps {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -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"); \
|
||||
|
|
|
@ -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"); \
|
||||
|
|
|
@ -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 initEventQueue(event_queue_t *event_queue) {
|
|||
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;
|
||||
|
|
|
@ -47,7 +47,7 @@ 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)
|
||||
#define ATDEBUGLEVEL(level) (debug_level >= level)
|
||||
|
||||
typedef struct {
|
||||
unsigned char input_event_buffer[EVENT_BUFFER_SIZE];
|
||||
|
@ -65,6 +65,6 @@ 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, ...);
|
||||
extern void printfDebug(int level, const char *format, ...);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -182,7 +182,7 @@ static void *NativeGetFunctionPointer(const char *function) {
|
|||
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 void* GetFunctionPointer(const char* function) {
|
|||
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 @@ static bool LoadOpenAL(JNIEnv *env, jobjectArray oalPaths) {
|
|||
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);
|
||||
|
|
|
@ -1339,7 +1339,7 @@ static CFBundleRef loadBundle(const Str255 frameworkName)
|
|||
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 @@ static CFBundleRef loadBundle(const Str255 frameworkName)
|
|||
|
||||
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 @@ static CFBundleRef loadBundle(const Str255 frameworkName)
|
|||
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 @@ static CFBundleRef loadBundle(const Str255 frameworkName)
|
|||
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 @@ static void *extgl_GetProcAddress(char *name)
|
|||
{
|
||||
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 @@ static void *extgl_GetProcAddress(char *name)
|
|||
{
|
||||
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 @@ static void *extgl_GetProcAddress(char *name)
|
|||
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 @@ static bool QueryExtension(JNIEnv *env, jobject ext_set, const GLubyte*extension
|
|||
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 @@ bool extgl_Open()
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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 @@ extern "C" {
|
|||
#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
|
||||
|
|
|
@ -40,7 +40,7 @@ bool loadXcursor(void) {
|
|||
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();
|
||||
|
|
|
@ -61,14 +61,14 @@ static bool getVidModeExtensionVersion(Display *disp, int screen, int *major, in
|
|||
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 @@ static bool setMode(Display *disp, int screen, int width, int height, bool lock_
|
|||
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 void freeSavedGammaRamps() {
|
|||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_init
|
|||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_resetDisplayMode(JNIEnv * env, jcl
|
|||
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 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_nGetAvailableDisplayModes
|
|||
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 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_nGetAvailableDisplayModes
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution
|
|||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority
|
|||
// 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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority
|
|||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority
|
|||
}
|
||||
|
||||
if (setpriority(PRIO_PROCESS, 0, linux_priority) == -1) {
|
||||
printfDebug("Failed to set priority.\n");
|
||||
printfDebug(org_lwjgl_Sys_DEBUG, "Failed to set priority.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_initIDs
|
|||
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 @@ static void doWarpPointer(void ) {
|
|||
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) {
|
||||
|
|
|
@ -161,7 +161,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Pbuffer_nMakeCurrent
|
|||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ static void createWindow(JNIEnv* env, Display *disp, int screen, XVisualInfo *vi
|
|||
}
|
||||
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 @@ static bool initWindowGLX13(JNIEnv *env, Display *disp, int screen, jstring titl
|
|||
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 @@ static bool initWindowGLX(JNIEnv *env, Display *disp, int screen, jstring title,
|
|||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nCreate
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ static void searchDictionaryElement(CFDictionaryRef dict, CFStringRef key, hid_d
|
|||
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 @@ bool findDevice(hid_device_t *hid_dev, long device_usage_page, long device_usage
|
|||
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 @@ bool findDevice(hid_device_t *hid_dev, long device_usage_page, long device_usage
|
|||
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);
|
||||
|
|
|
@ -64,7 +64,7 @@ JNIEXPORT jlong JNICALL Java_org_lwjgl_Sys_getTimerResolution
|
|||
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_setTime
|
|||
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");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -70,12 +70,12 @@ static bool handleMappedKey(unsigned char mapped_code, unsigned char state) {
|
|||
|
||||
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 @@ static bool handleTranslation(EventRef event, bool state) {
|
|||
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 @@ static bool handleTranslation(EventRef event, bool state) {
|
|||
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 @@ static bool handleTranslation(EventRef event, bool state) {
|
|||
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 @@ static void doKeyDown(EventRef event) {
|
|||
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 @@ static void doKeyUp(EventRef event) {
|
|||
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 @@ static void doKeyModifier(EventRef event) {
|
|||
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);
|
||||
|
|
|
@ -70,7 +70,7 @@ static bool created;
|
|||
|
||||
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 @@ cont:
|
|||
}
|
||||
}
|
||||
}
|
||||
printfDebug("Recieved an unknown HID device event\n");
|
||||
printfDebug(org_lwjgl_Sys_DEBUG, "Recieved an unknown HID device event\n");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
@ -120,7 +120,7 @@ static void handleButtonEvent(EventRef event, unsigned char state) {
|
|||
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 @@ static void handleMovedEvent(EventRef event) {
|
|||
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 @@ static void handleWheelEvent(EventRef event) {
|
|||
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;
|
||||
|
|
|
@ -62,7 +62,7 @@ JNIEXPORT jobjectArray JNICALL Java_org_lwjgl_Display_nGetAvailableDisplayModes
|
|||
{
|
||||
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 @@ static jobjectArray GetAvailableDisplayModesEx(JNIEnv * env) {
|
|||
|
||||
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 @@ static jobjectArray GetAvailableDisplayModesEx(JNIEnv * env) {
|
|||
|
||||
//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 @@ static jobjectArray GetAvailableDisplayModesEx(JNIEnv * env) {
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ static jobjectArray GetAvailableDisplayModes(JNIEnv * env) {
|
|||
}
|
||||
}
|
||||
|
||||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_setDisplayMode
|
|||
|
||||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_resetDisplayMode
|
|||
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 @@ static void tempResetDisplayMode() {
|
|||
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 @@ static void tempResetDisplayMode() {
|
|||
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 @@ static void tempRestoreDisplayMode() {
|
|||
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 @@ static void tempRestoreDisplayMode() {
|
|||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Display_init
|
|||
// 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 @@ static char * getDriver() {
|
|||
|
||||
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:
|
||||
|
|
|
@ -120,7 +120,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_setProcessPriority
|
|||
}
|
||||
|
||||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_alert
|
|||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_Sys_nOpenURL
|
|||
&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.
|
||||
|
|
|
@ -120,7 +120,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nCreate(JNIEnv *env, jcla
|
|||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Controller_nPoll(JNIEnv * env, jclas
|
|||
// 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 @@ static void EnumerateControllerCapabilities() {
|
|||
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 @@ static void EnumerateControllers() {
|
|||
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 @@ BOOL CALLBACK EnumControllerCallback(LPCDIDEVICEINSTANCE pdinst, LPVOID pvRef) {
|
|||
* 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 @@ BOOL CALLBACK EnumControllerObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LP
|
|||
} 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 @@ static void CreateController(LPCDIDEVICEINSTANCE lpddi) {
|
|||
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 CreateController(LPCDIDEVICEINSTANCE lpddi) {
|
|||
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 @@ static void SetupController() {
|
|||
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 @@ static void SetupController() {
|
|||
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 @@ static void SetupController() {
|
|||
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 @@ static void SetupController() {
|
|||
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 @@ static void SetupController() {
|
|||
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 @@ static void SetupController() {
|
|||
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 @@ static void SetupController() {
|
|||
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 @@ static void UpdateControllerFields(JNIEnv *env, jclass clsController) {
|
|||
// 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Keyboard_nCreate
|
|||
|
||||
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 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Keyboard_nRead
|
|||
}
|
||||
}
|
||||
} 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;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_input_Mouse_nCreate(JNIEnv *env, jclass cl
|
|||
/* 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 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_input_Mouse_nRead
|
|||
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 @@ void EnumerateMouseCapabilities() {
|
|||
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 @@ void EnumerateMouseCapabilities() {
|
|||
//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 @@ void EnumerateMouseCapabilities() {
|
|||
* 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 @@ BOOL CALLBACK EnumMouseObjectsCallback(LPCDIDEVICEOBJECTINSTANCE lpddoi, LPVOID
|
|||
} 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 @@ void CreateMouse() {
|
|||
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 CreateMouse() {
|
|||
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 @@ void SetupMouse() {
|
|||
|
||||
// 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 @@ static void UpdateMouseFields(JNIEnv *env, jclass clsMouse) {
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ static int findPixelFormat(JNIEnv *env, unsigned int flags, int bpp, int alpha,
|
|||
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 @@ static bool createDirectInput()
|
|||
// 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 @@ static void closeWindow()
|
|||
{
|
||||
// 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 @@ static bool registerWindow()
|
|||
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 @@ static bool createWindow(const char * title, int x, int y, int width, int height
|
|||
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 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Window_nDestroy
|
|||
|
||||
// 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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue