Remove newlines from log messages
Build (All) / Create test plan (push) Waiting to run
Build (All) / level1 (push) Blocked by required conditions
Build (All) / level2 (push) Blocked by required conditions

This commit is contained in:
nightmareci
2025-01-22 12:59:57 -08:00
committed by Sam Lantinga
parent 17625e20df
commit 718034f5fa
123 changed files with 1143 additions and 1118 deletions
+6 -6
View File
@@ -198,7 +198,7 @@ LoadSprite(const char *file)
return -1; return -1;
} }
if (!SDL_SetTextureBlendMode(sprites[i], blendMode)) { if (!SDL_SetTextureBlendMode(sprites[i], blendMode)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s", SDL_GetError());
SDL_DestroyTexture(sprites[i]); SDL_DestroyTexture(sprites[i]);
return -1; return -1;
} }
@@ -405,7 +405,7 @@ main(int argc, char *argv[])
sprites = sprites =
(SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites)); (SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites));
if (!sprites) { if (!sprites) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!");
quit(2); quit(2);
} }
for (i = 0; i < state->num_windows; ++i) { for (i = 0; i < state->num_windows; ++i) {
@@ -420,13 +420,13 @@ main(int argc, char *argv[])
soundname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); soundname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav");
if (!soundname) { if (!soundname) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s", SDL_GetError());
quit(1); quit(1);
} }
/* Load the wave file into memory */ /* Load the wave file into memory */
if (!SDL_LoadWAV(soundname, &wave.spec, &wave.sound, &wave.soundlen)) { if (!SDL_LoadWAV(soundname, &wave.spec, &wave.sound, &wave.soundlen)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", soundname, SDL_GetError()); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", soundname, SDL_GetError());
quit(1); quit(1);
} }
@@ -436,11 +436,11 @@ main(int argc, char *argv[])
SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); SDL_Log("%i: %s", i, SDL_GetAudioDriver(i));
} }
SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); SDL_Log("Using audio driver: %s", SDL_GetCurrentAudioDriver());
stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &wave.spec, NULL, NULL); stream = SDL_OpenAudioDeviceStream(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &wave.spec, NULL, NULL);
if (!stream) { if (!stream) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create audio stream: %s\n", SDL_GetError()); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create audio stream: %s", SDL_GetError());
return -1; return -1;
} }
SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream)); SDL_ResumeAudioDevice(SDL_GetAudioStreamDevice(stream));
+1 -1
View File
@@ -6,7 +6,7 @@ int main(int argc, char *argv[])
{ {
SDL_SetMainReady(); SDL_SetMainReady();
if (!SDL_Init(0)) { if (!SDL_Init(0)) {
SDL_Log("Could not initialize SDL: %s\n", SDL_GetError()); SDL_Log("Could not initialize SDL: %s", SDL_GetError());
return 1; return 1;
} }
SDL_Delay(100); SDL_Delay(100);
+2 -2
View File
@@ -6,12 +6,12 @@ int main(int argc, char *argv[])
SDL_Window *window = NULL; SDL_Window *window = NULL;
SDL_Surface *screenSurface = NULL; SDL_Surface *screenSurface = NULL;
if (!SDL_Init(SDL_INIT_VIDEO)) { if (!SDL_Init(SDL_INIT_VIDEO)) {
SDL_Log("Could not initialize SDL: %s\n", SDL_GetError()); SDL_Log("Could not initialize SDL: %s", SDL_GetError());
return 1; return 1;
} }
window = SDL_CreateWindow("Hello SDL", 640, 480, 0); window = SDL_CreateWindow("Hello SDL", 640, 480, 0);
if (!window) { if (!window) {
SDL_Log("could not create window: %s\n", SDL_GetError()); SDL_Log("could not create window: %s", SDL_GetError());
return 1; return 1;
} }
screenSurface = SDL_GetWindowSurface(window); screenSurface = SDL_GetWindowSurface(window);
+1 -1
View File
@@ -18,7 +18,7 @@ int MYLIBRARY_EXPORT mylibrary_work(void);
int mylibrary_init(void) { int mylibrary_init(void) {
SDL_SetMainReady(); SDL_SetMainReady();
if (!SDL_Init(0)) { if (!SDL_Init(0)) {
SDL_Log("Could not initialize SDL: %s\n", SDL_GetError()); SDL_Log("Could not initialize SDL: %s", SDL_GetError());
return 1; return 1;
} }
return 0; return 0;
+6 -6
View File
@@ -193,7 +193,7 @@ Rather than iterating over audio devices using a device index, there are new fun
if (devices) { if (devices) {
for (i = 0; i < num_devices; ++i) { for (i = 0; i < num_devices; ++i) {
SDL_AudioDeviceID instance_id = devices[i]; SDL_AudioDeviceID instance_id = devices[i];
SDL_Log("AudioDevice %" SDL_PRIu32 ": %s\n", instance_id, SDL_GetAudioDeviceName(instance_id)); SDL_Log("AudioDevice %" SDL_PRIu32 ": %s", instance_id, SDL_GetAudioDeviceName(instance_id));
} }
SDL_free(devices); SDL_free(devices);
} }
@@ -749,7 +749,7 @@ Rather than iterating over haptic devices using device index, there is a new fun
if (haptics) { if (haptics) {
for (i = 0; i < num_haptics; ++i) { for (i = 0; i < num_haptics; ++i) {
SDL_HapticID instance_id = haptics[i]; SDL_HapticID instance_id = haptics[i];
SDL_Log("Haptic %" SDL_PRIu32 ": %s\n", instance_id, SDL_GetHapticNameForID(instance_id)); SDL_Log("Haptic %" SDL_PRIu32 ": %s", instance_id, SDL_GetHapticNameForID(instance_id));
} }
SDL_free(haptics); SDL_free(haptics);
} }
@@ -917,7 +917,7 @@ Rather than iterating over joysticks using device index, there is a new function
const char *name = SDL_GetJoystickNameForID(instance_id); const char *name = SDL_GetJoystickNameForID(instance_id);
const char *path = SDL_GetJoystickPathForID(instance_id); const char *path = SDL_GetJoystickPathForID(instance_id);
SDL_Log("Joystick %" SDL_PRIu32 ": %s%s%s VID 0x%.4x, PID 0x%.4x\n", SDL_Log("Joystick %" SDL_PRIu32 ": %s%s%s VID 0x%.4x, PID 0x%.4x",
instance_id, name ? name : "Unknown", path ? ", " : "", path ? path : "", SDL_GetJoystickVendorForID(instance_id), SDL_GetJoystickProductForID(instance_id)); instance_id, name ? name : "Unknown", path ? ", " : "", path ? path : "", SDL_GetJoystickVendorForID(instance_id), SDL_GetJoystickProductForID(instance_id));
} }
SDL_free(joysticks); SDL_free(joysticks);
@@ -1696,7 +1696,7 @@ Rather than iterating over sensors using device index, there is a new function S
SDL_SensorID *sensors = SDL_GetSensors(&num_sensors); SDL_SensorID *sensors = SDL_GetSensors(&num_sensors);
if (sensors) { if (sensors) {
for (i = 0; i < num_sensors; ++i) { for (i = 0; i < num_sensors; ++i) {
SDL_Log("Sensor %" SDL_PRIu32 ": %s, type %d, platform type %d\n", SDL_Log("Sensor %" SDL_PRIu32 ": %s, type %d, platform type %d",
sensors[i], sensors[i],
SDL_GetSensorNameForID(sensors[i]), SDL_GetSensorNameForID(sensors[i]),
SDL_GetSensorTypeForID(sensors[i]), SDL_GetSensorTypeForID(sensors[i]),
@@ -2121,7 +2121,7 @@ Rather than iterating over displays using display index, there is a new function
SDL_DisplayID instance_id = displays[i]; SDL_DisplayID instance_id = displays[i];
const char *name = SDL_GetDisplayName(instance_id); const char *name = SDL_GetDisplayName(instance_id);
SDL_Log("Display %" SDL_PRIu32 ": %s\n", instance_id, name ? name : "Unknown"); SDL_Log("Display %" SDL_PRIu32 ": %s", instance_id, name ? name : "Unknown");
} }
SDL_free(displays); SDL_free(displays);
} }
@@ -2167,7 +2167,7 @@ Rather than iterating over display modes using an index, there is a new function
if (modes) { if (modes) {
for (i = 0; i < num_modes; ++i) { for (i = 0; i < num_modes; ++i) {
SDL_DisplayMode *mode = modes[i]; SDL_DisplayMode *mode = modes[i];
SDL_Log("Display %" SDL_PRIu32 " mode %d: %dx%d@%gx %gHz\n", SDL_Log("Display %" SDL_PRIu32 " mode %d: %dx%d@%gx %gHz",
display, i, mode->w, mode->h, mode->pixel_density, mode->refresh_rate); display, i, mode->w, mode->h, mode->pixel_density, mode->refresh_rate);
} }
SDL_free(modes); SDL_free(modes);
+1 -1
View File
@@ -21,7 +21,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
{ {
/* Create the window */ /* Create the window */
if (!SDL_CreateWindowAndRenderer("Hello World", 800, 600, SDL_WINDOW_FULLSCREEN, &window, &renderer)) { if (!SDL_CreateWindowAndRenderer("Hello World", 800, 600, SDL_WINDOW_FULLSCREEN, &window, &renderer)) {
SDL_Log("Couldn't create window and renderer: %s\n", SDL_GetError()); SDL_Log("Couldn't create window and renderer: %s", SDL_GetError());
return SDL_APP_FAILURE; return SDL_APP_FAILURE;
} }
return SDL_APP_CONTINUE; return SDL_APP_CONTINUE;
+6 -6
View File
@@ -766,25 +766,25 @@ static void SDLCALL SDL_DumpPropertiesCallback(void *userdata, SDL_PropertiesID
{ {
switch (SDL_GetPropertyType(props, name)) { switch (SDL_GetPropertyType(props, name)) {
case SDL_PROPERTY_TYPE_POINTER: case SDL_PROPERTY_TYPE_POINTER:
SDL_Log("%s: %p\n", name, SDL_GetPointerProperty(props, name, NULL)); SDL_Log("%s: %p", name, SDL_GetPointerProperty(props, name, NULL));
break; break;
case SDL_PROPERTY_TYPE_STRING: case SDL_PROPERTY_TYPE_STRING:
SDL_Log("%s: \"%s\"\n", name, SDL_GetStringProperty(props, name, "")); SDL_Log("%s: \"%s\"", name, SDL_GetStringProperty(props, name, ""));
break; break;
case SDL_PROPERTY_TYPE_NUMBER: case SDL_PROPERTY_TYPE_NUMBER:
{ {
Sint64 value = SDL_GetNumberProperty(props, name, 0); Sint64 value = SDL_GetNumberProperty(props, name, 0);
SDL_Log("%s: %" SDL_PRIs64 " (%" SDL_PRIx64 ")\n", name, value, value); SDL_Log("%s: %" SDL_PRIs64 " (%" SDL_PRIx64 ")", name, value, value);
} }
break; break;
case SDL_PROPERTY_TYPE_FLOAT: case SDL_PROPERTY_TYPE_FLOAT:
SDL_Log("%s: %g\n", name, SDL_GetFloatProperty(props, name, 0.0f)); SDL_Log("%s: %g", name, SDL_GetFloatProperty(props, name, 0.0f));
break; break;
case SDL_PROPERTY_TYPE_BOOLEAN: case SDL_PROPERTY_TYPE_BOOLEAN:
SDL_Log("%s: %s\n", name, SDL_GetBooleanProperty(props, name, false) ? "true" : "false"); SDL_Log("%s: %s", name, SDL_GetBooleanProperty(props, name, false) ? "true" : "false");
break; break;
default: default:
SDL_Log("%s UNKNOWN TYPE\n", name); SDL_Log("%s UNKNOWN TYPE", name);
break; break;
} }
} }
+1 -1
View File
@@ -240,7 +240,7 @@ void SDL_SetObjectsInvalid(void)
type = "unknown object"; type = "unknown object";
break; break;
} }
SDL_Log("Leaked %s (%p)\n", type, object); SDL_Log("Leaked %s (%p)", type, object);
} }
SDL_assert(SDL_HashTableEmpty(SDL_objects)); SDL_assert(SDL_HashTableEmpty(SDL_objects));
+1 -1
View File
@@ -28,7 +28,7 @@
#define DEBUG_AUDIO_CONVERT 0 #define DEBUG_AUDIO_CONVERT 0
#if DEBUG_AUDIO_CONVERT #if DEBUG_AUDIO_CONVERT
#define LOG_DEBUG_AUDIO_CONVERT(from, to) SDL_Log("SDL_AUDIO_CONVERT: Converting %s to %s.\n", from, to); #define LOG_DEBUG_AUDIO_CONVERT(from, to) SDL_Log("SDL_AUDIO_CONVERT: Converting %s to %s.", from, to);
#else #else
#define LOG_DEBUG_AUDIO_CONVERT(from, to) #define LOG_DEBUG_AUDIO_CONVERT(from, to)
#endif #endif
+2 -2
View File
@@ -315,10 +315,10 @@ static bool BuildAAudioStream(SDL_AudioDevice *device)
ctx.AAudioStreamBuilder_setDataCallback(builder, AAUDIO_dataCallback, device); ctx.AAudioStreamBuilder_setDataCallback(builder, AAUDIO_dataCallback, device);
// Some devices have flat sounding audio when low latency mode is enabled, but this is a better experience for most people // Some devices have flat sounding audio when low latency mode is enabled, but this is a better experience for most people
if (SDL_GetHintBoolean(SDL_HINT_ANDROID_LOW_LATENCY_AUDIO, true)) { if (SDL_GetHintBoolean(SDL_HINT_ANDROID_LOW_LATENCY_AUDIO, true)) {
SDL_Log("Low latency audio enabled\n"); SDL_Log("Low latency audio enabled");
ctx.AAudioStreamBuilder_setPerformanceMode(builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY); ctx.AAudioStreamBuilder_setPerformanceMode(builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY);
} else { } else {
SDL_Log("Low latency audio disabled\n"); SDL_Log("Low latency audio disabled");
} }
LOGI("AAudio Try to open %u hz %s %u channels samples %u", LOGI("AAudio Try to open %u hz %s %u channels samples %u",
+3 -3
View File
@@ -31,7 +31,7 @@
#if DEBUG_COREAUDIO #if DEBUG_COREAUDIO
#define CHECK_RESULT(msg) \ #define CHECK_RESULT(msg) \
if (result != noErr) { \ if (result != noErr) { \
SDL_Log("COREAUDIO: Got error %d from '%s'!\n", (int)result, msg); \ SDL_Log("COREAUDIO: Got error %d from '%s'!", (int)result, msg); \
return SDL_SetError("CoreAudio error (%s): %d", msg, (int)result); \ return SDL_SetError("CoreAudio error (%s): %d", msg, (int)result); \
} }
#else #else
@@ -224,7 +224,7 @@ static void RefreshPhysicalDevices(void)
name[len] = '\0'; name[len] = '\0';
#if DEBUG_COREAUDIO #if DEBUG_COREAUDIO
SDL_Log("COREAUDIO: Found %s device #%d: '%s' (devid %d)\n", ((recording) ? "recording" : "playback"), (int)i, name, (int)dev); SDL_Log("COREAUDIO: Found %s device #%d: '%s' (devid %d)", ((recording) ? "recording" : "playback"), (int)i, name, (int)dev);
#endif #endif
SDLCoreAudioHandle *newhandle = (SDLCoreAudioHandle *) SDL_calloc(1, sizeof (*newhandle)); SDLCoreAudioHandle *newhandle = (SDLCoreAudioHandle *) SDL_calloc(1, sizeof (*newhandle));
if (newhandle) { if (newhandle) {
@@ -834,7 +834,7 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device)
} }
#if DEBUG_COREAUDIO #if DEBUG_COREAUDIO
SDL_Log("COREAUDIO: numAudioBuffers == %d\n", numAudioBuffers); SDL_Log("COREAUDIO: numAudioBuffers == %d", numAudioBuffers);
#endif #endif
for (int i = 0; i < numAudioBuffers; i++) { for (int i = 0; i < numAudioBuffers; i++) {
+1 -1
View File
@@ -136,7 +136,7 @@ static bool DISKAUDIO_OpenDevice(SDL_AudioDevice *device)
} }
SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, "You are using the SDL disk i/o audio driver!"); SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, "You are using the SDL disk i/o audio driver!");
SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, " %s file [%s].\n", recording ? "Reading from" : "Writing to", fname); SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, " %s file [%s].", recording ? "Reading from" : "Writing to", fname);
return true; // We're ready to rock and roll. :-) return true; // We're ready to rock and roll. :-)
} }
+1 -1
View File
@@ -847,7 +847,7 @@ void SDL_StopEventLoop(void)
SDL_EventQ.active = false; SDL_EventQ.active = false;
if (report && SDL_atoi(report)) { if (report && SDL_atoi(report)) {
SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d\n", SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d",
SDL_EventQ.max_events_seen); SDL_EventQ.max_events_seen);
} }
+2 -2
View File
@@ -220,7 +220,7 @@ void SDL_ResetKeyboard(void)
int scancode; int scancode;
#ifdef DEBUG_KEYBOARD #ifdef DEBUG_KEYBOARD
SDL_Log("Resetting keyboard\n"); SDL_Log("Resetting keyboard");
#endif #endif
for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_SCANCODE_COUNT; ++scancode) { for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_SCANCODE_COUNT; ++scancode) {
if (keyboard->keystate[scancode]) { if (keyboard->keystate[scancode]) {
@@ -517,7 +517,7 @@ static bool SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keyb
const Uint8 source = flags & KEYBOARD_SOURCE_MASK; const Uint8 source = flags & KEYBOARD_SOURCE_MASK;
#ifdef DEBUG_KEYBOARD #ifdef DEBUG_KEYBOARD
SDL_Log("The '%s' key has been %s\n", SDL_GetScancodeName(scancode), down ? "pressed" : "released"); SDL_Log("The '%s' key has been %s", SDL_GetScancodeName(scancode), down ? "pressed" : "released");
#endif #endif
// Figure out what type of event this is // Figure out what type of event this is
+3 -3
View File
@@ -605,7 +605,7 @@ static bool SDL_UpdateMouseFocus(SDL_Window *window, float x, float y, Uint32 bu
if (!inWindow) { if (!inWindow) {
if (window == mouse->focus) { if (window == mouse->focus) {
#ifdef DEBUG_MOUSE #ifdef DEBUG_MOUSE
SDL_Log("Mouse left window, synthesizing move & focus lost event\n"); SDL_Log("Mouse left window, synthesizing move & focus lost event");
#endif #endif
if (send_mouse_motion) { if (send_mouse_motion) {
SDL_PrivateSendMouseMotion(0, window, SDL_GLOBAL_MOUSE_ID, false, x, y); SDL_PrivateSendMouseMotion(0, window, SDL_GLOBAL_MOUSE_ID, false, x, y);
@@ -617,7 +617,7 @@ static bool SDL_UpdateMouseFocus(SDL_Window *window, float x, float y, Uint32 bu
if (window != mouse->focus) { if (window != mouse->focus) {
#ifdef DEBUG_MOUSE #ifdef DEBUG_MOUSE
SDL_Log("Mouse entered window, synthesizing focus gain & move event\n"); SDL_Log("Mouse entered window, synthesizing focus gain & move event");
#endif #endif
SDL_SetMouseFocus(window); SDL_SetMouseFocus(window);
if (send_mouse_motion) { if (send_mouse_motion) {
@@ -740,7 +740,7 @@ static void SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL
if (mouse->has_position && xrel == 0.0f && yrel == 0.0f) { // Drop events that don't change state if (mouse->has_position && xrel == 0.0f && yrel == 0.0f) { // Drop events that don't change state
#ifdef DEBUG_MOUSE #ifdef DEBUG_MOUSE
SDL_Log("Mouse event didn't change state - dropped!\n"); SDL_Log("Mouse event didn't change state - dropped!");
#endif #endif
return; return;
} }
+1 -1
View File
@@ -92,7 +92,7 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
static bool shown = false; static bool shown = false;
if (!shown) { if (!shown) {
shown = true; shown = true;
SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions.\n"); SDL_LogCritical(SDL_LOG_CATEGORY_SYSTEM, "tvOS does not have persistent local storage! Use iCloud storage if you want your data to persist between sessions.");
} }
} }
+1 -1
View File
@@ -1028,7 +1028,7 @@ extern "C"
static void SDLCALL RequestBluetoothPermissionCallback( void *userdata, const char *permission, bool granted ) static void SDLCALL RequestBluetoothPermissionCallback( void *userdata, const char *permission, bool granted )
{ {
SDL_Log( "Bluetooth permission %s\n", granted ? "granted" : "denied" ); SDL_Log( "Bluetooth permission %s", granted ? "granted" : "denied" );
if ( granted && g_HIDDeviceManagerCallbackHandler ) if ( granted && g_HIDDeviceManagerCallbackHandler )
{ {
+1 -1
View File
@@ -329,7 +329,7 @@ void Android_AddJoystick(int device_id, const char *name, const char *desc, int
} }
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats\n", name, desc, vendor_id, product_id, naxes, nhats); SDL_Log("Joystick: %s, descriptor %s, vendor = 0x%.4x, product = 0x%.4x, %d axes, %d hats", name, desc, vendor_id, product_id, naxes, nhats);
#endif #endif
if (nhats > 0) { if (nhats > 0) {
+3 -3
View File
@@ -566,7 +566,7 @@ static bool HIDAPI_DriverPS3_UpdateDevice(SDL_HIDAPI_Device *device)
break; break;
default: default:
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS3 packet: 0x%.2x\n", data[0]); SDL_Log("Unknown PS3 packet: 0x%.2x", data[0]);
#endif #endif
break; break;
} }
@@ -1004,7 +1004,7 @@ static bool HIDAPI_DriverPS3ThirdParty_UpdateDevice(SDL_HIDAPI_Device *device)
HIDAPI_DriverPS3ThirdParty_HandleStatePacket18(joystick, ctx, data, size); HIDAPI_DriverPS3ThirdParty_HandleStatePacket18(joystick, ctx, data, size);
} else { } else {
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS3 packet, size %d\n", size); SDL_Log("Unknown PS3 packet, size %d", size);
#endif #endif
} }
} }
@@ -1357,7 +1357,7 @@ static bool HIDAPI_DriverPS3SonySixaxis_UpdateDevice(SDL_HIDAPI_Device *device)
break; break;
default: default:
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS3 packet: 0x%.2x\n", data[0]); SDL_Log("Unknown PS3 packet: 0x%.2x", data[0]);
#endif #endif
break; break;
} }
+8 -8
View File
@@ -323,7 +323,7 @@ static bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
if (size > 0) { if (size > 0) {
HIDAPI_DumpPacket("PS4 first packet: size = %d", data, size); HIDAPI_DumpPacket("PS4 first packet: size = %d", data, size);
} else { } else {
SDL_Log("PS4 first packet: size = %d\n", size); SDL_Log("PS4 first packet: size = %d", size);
} }
#endif #endif
if (size > 0 && if (size > 0 &&
@@ -468,7 +468,7 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi
if (!ctx->official_controller) { if (!ctx->official_controller) {
#ifdef DEBUG_PS4_CALIBRATION #ifdef DEBUG_PS4_CALIBRATION
SDL_Log("Not an official controller, ignoring calibration\n"); SDL_Log("Not an official controller, ignoring calibration");
#endif #endif
return false; return false;
} }
@@ -478,7 +478,7 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdGyroCalibration_USB, data, sizeof(data)); size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdGyroCalibration_USB, data, sizeof(data));
if (size < 35) { if (size < 35) {
#ifdef DEBUG_PS4_CALIBRATION #ifdef DEBUG_PS4_CALIBRATION
SDL_Log("Short read of calibration data: %d, ignoring calibration\n", size); SDL_Log("Short read of calibration data: %d, ignoring calibration", size);
#endif #endif
return false; return false;
} }
@@ -487,7 +487,7 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdGyroCalibration_BT, data, sizeof(data)); size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdGyroCalibration_BT, data, sizeof(data));
if (size < 35) { if (size < 35) {
#ifdef DEBUG_PS4_CALIBRATION #ifdef DEBUG_PS4_CALIBRATION
SDL_Log("Short read of calibration data: %d, ignoring calibration\n", size); SDL_Log("Short read of calibration data: %d, ignoring calibration", size);
#endif #endif
return false; return false;
} }
@@ -590,19 +590,19 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi
ctx->hardware_calibration = true; ctx->hardware_calibration = true;
for (i = 0; i < 6; ++i) { for (i = 0; i < 6; ++i) {
#ifdef DEBUG_PS4_CALIBRATION #ifdef DEBUG_PS4_CALIBRATION
SDL_Log("calibration[%d] bias = %d, sensitivity = %f\n", i, ctx->calibration[i].bias, ctx->calibration[i].scale); SDL_Log("calibration[%d] bias = %d, sensitivity = %f", i, ctx->calibration[i].bias, ctx->calibration[i].scale);
#endif #endif
// Some controllers have a bad calibration // Some controllers have a bad calibration
if (SDL_abs(ctx->calibration[i].bias) > 1024 || SDL_fabsf(1.0f - ctx->calibration[i].scale) > 0.5f) { if (SDL_abs(ctx->calibration[i].bias) > 1024 || SDL_fabsf(1.0f - ctx->calibration[i].scale) > 0.5f) {
#ifdef DEBUG_PS4_CALIBRATION #ifdef DEBUG_PS4_CALIBRATION
SDL_Log("invalid calibration, ignoring\n"); SDL_Log("invalid calibration, ignoring");
#endif #endif
ctx->hardware_calibration = false; ctx->hardware_calibration = false;
} }
} }
} else { } else {
#ifdef DEBUG_PS4_CALIBRATION #ifdef DEBUG_PS4_CALIBRATION
SDL_Log("Calibration data not available\n"); SDL_Log("Calibration data not available");
#endif #endif
} }
return ctx->hardware_calibration; return ctx->hardware_calibration;
@@ -1291,7 +1291,7 @@ static bool HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device)
break; break;
default: default:
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS4 packet: 0x%.2x\n", data[0]); SDL_Log("Unknown PS4 packet: 0x%.2x", data[0]);
#endif #endif
break; break;
} }
+5 -5
View File
@@ -402,7 +402,7 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
if (size > 0) { if (size > 0) {
HIDAPI_DumpPacket("PS5 first packet: size = %d", data, size); HIDAPI_DumpPacket("PS5 first packet: size = %d", data, size);
} else { } else {
SDL_Log("PS5 first packet: size = %d\n", size); SDL_Log("PS5 first packet: size = %d", size);
} }
#endif #endif
if (size == 64) { if (size == 64) {
@@ -561,7 +561,7 @@ static void HIDAPI_DriverPS5_LoadCalibrationData(SDL_HIDAPI_Device *device)
size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCalibration, data, sizeof(data)); size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCalibration, data, sizeof(data));
if (size < 35) { if (size < 35) {
#ifdef DEBUG_PS5_CALIBRATION #ifdef DEBUG_PS5_CALIBRATION
SDL_Log("Short read of calibration data: %d, ignoring calibration\n", size); SDL_Log("Short read of calibration data: %d, ignoring calibration", size);
#endif #endif
return; return;
} }
@@ -631,12 +631,12 @@ static void HIDAPI_DriverPS5_LoadCalibrationData(SDL_HIDAPI_Device *device)
for (i = 0; i < 6; ++i) { for (i = 0; i < 6; ++i) {
float divisor = (i < 3 ? 64.0f : 1.0f); float divisor = (i < 3 ? 64.0f : 1.0f);
#ifdef DEBUG_PS5_CALIBRATION #ifdef DEBUG_PS5_CALIBRATION
SDL_Log("calibration[%d] bias = %d, sensitivity = %f\n", i, ctx->calibration[i].bias, ctx->calibration[i].sensitivity); SDL_Log("calibration[%d] bias = %d, sensitivity = %f", i, ctx->calibration[i].bias, ctx->calibration[i].sensitivity);
#endif #endif
// Some controllers have a bad calibration // Some controllers have a bad calibration
if ((SDL_abs(ctx->calibration[i].bias) > 1024) || (SDL_fabsf(1.0f - ctx->calibration[i].sensitivity / divisor) > 0.5f)) { if ((SDL_abs(ctx->calibration[i].bias) > 1024) || (SDL_fabsf(1.0f - ctx->calibration[i].sensitivity / divisor) > 0.5f)) {
#ifdef DEBUG_PS5_CALIBRATION #ifdef DEBUG_PS5_CALIBRATION
SDL_Log("invalid calibration, ignoring\n"); SDL_Log("invalid calibration, ignoring");
#endif #endif
ctx->hardware_calibration = false; ctx->hardware_calibration = false;
} }
@@ -1531,7 +1531,7 @@ static bool HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device)
break; break;
default: default:
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS5 packet: 0x%.2x\n", data[0]); SDL_Log("Unknown PS5 packet: 0x%.2x", data[0]);
#endif #endif
break; break;
} }
+1 -1
View File
@@ -324,7 +324,7 @@ static void HIDAPI_DriverSteamHori_HandleStatePacket(SDL_Joystick *joystick, SDL
SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO, sensor_timestamp, imu_data, 3); SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO, sensor_timestamp, imu_data, 3);
// SDL_Log("%u %f, %f, %f \n", data[0], imu_data[0], imu_data[1], imu_data[2] ); // SDL_Log("%u %f, %f, %f ", data[0], imu_data[0], imu_data[1], imu_data[2] );
imu_data[2] = LOAD16(data[18], data[19]) * accelScale; imu_data[2] = LOAD16(data[18], data[19]) * accelScale;
imu_data[1] = -1 * LOAD16(data[20], data[21]) * accelScale; imu_data[1] = -1 * LOAD16(data[20], data[21]) * accelScale;
imu_data[0] = LOAD16(data[22], data[23]) * accelScale; imu_data[0] = LOAD16(data[22], data[23]) * accelScale;
+7 -7
View File
@@ -521,11 +521,11 @@ static bool WriteProprietary(SDL_DriverSwitch_Context *ctx, ESwitchProprietaryCo
} }
if (!waitForReply || ReadProprietaryReply(ctx, ucCommand)) { if (!waitForReply || ReadProprietaryReply(ctx, ucCommand)) {
// SDL_Log("Succeeded%s after %d tries\n", ctx->m_bSyncWrite ? " (sync)" : "", nTries); // SDL_Log("Succeeded%s after %d tries", ctx->m_bSyncWrite ? " (sync)" : "", nTries);
return true; return true;
} }
} }
// SDL_Log("Failed%s after %d tries\n", ctx->m_bSyncWrite ? " (sync)" : "", nTries); // SDL_Log("Failed%s after %d tries", ctx->m_bSyncWrite ? " (sync)" : "", nTries);
return false; return false;
} }
@@ -579,7 +579,7 @@ static void EncodeRumble(SwitchRumbleData_t *pRumble, Uint16 usHighFreq, Uint8 u
pRumble->rgucData[3] = usLowFreqAmp & 0xFF; pRumble->rgucData[3] = usLowFreqAmp & 0xFF;
#ifdef DEBUG_RUMBLE #ifdef DEBUG_RUMBLE
SDL_Log("Freq: %.2X %.2X %.2X, Amp: %.2X %.2X %.2X\n", SDL_Log("Freq: %.2X %.2X %.2X, Amp: %.2X %.2X %.2X",
usHighFreq & 0xFF, ((usHighFreq >> 8) & 0x01), ucLowFreq, usHighFreq & 0xFF, ((usHighFreq >> 8) & 0x01), ucLowFreq,
ucHighFreqAmp, ((usLowFreqAmp >> 8) & 0x80), usLowFreqAmp & 0xFF); ucHighFreqAmp, ((usLowFreqAmp >> 8) & 0x80), usLowFreqAmp & 0xFF);
#endif #endif
@@ -1647,7 +1647,7 @@ static bool HIDAPI_DriverSwitch_SendPendingRumble(SDL_DriverSwitch_Context *ctx)
Uint16 high_frequency_rumble = (Uint16)ctx->m_unRumblePending; Uint16 high_frequency_rumble = (Uint16)ctx->m_unRumblePending;
#ifdef DEBUG_RUMBLE #ifdef DEBUG_RUMBLE
SDL_Log("Sent pending rumble %d/%d, %d ms after previous rumble\n", low_frequency_rumble, high_frequency_rumble, SDL_GetTicks() - ctx->m_ulRumbleSent); SDL_Log("Sent pending rumble %d/%d, %d ms after previous rumble", low_frequency_rumble, high_frequency_rumble, SDL_GetTicks() - ctx->m_ulRumbleSent);
#endif #endif
ctx->m_bRumblePending = false; ctx->m_bRumblePending = false;
ctx->m_unRumblePending = 0; ctx->m_unRumblePending = 0;
@@ -1659,7 +1659,7 @@ static bool HIDAPI_DriverSwitch_SendPendingRumble(SDL_DriverSwitch_Context *ctx)
ctx->m_bRumbleZeroPending = false; ctx->m_bRumbleZeroPending = false;
#ifdef DEBUG_RUMBLE #ifdef DEBUG_RUMBLE
SDL_Log("Sent pending zero rumble, %d ms after previous rumble\n", SDL_GetTicks() - ctx->m_ulRumbleSent); SDL_Log("Sent pending zero rumble, %d ms after previous rumble", SDL_GetTicks() - ctx->m_ulRumbleSent);
#endif #endif
return HIDAPI_DriverSwitch_ActuallyRumbleJoystick(ctx, 0, 0); return HIDAPI_DriverSwitch_ActuallyRumbleJoystick(ctx, 0, 0);
} }
@@ -1709,7 +1709,7 @@ static bool HIDAPI_DriverSwitch_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Jo
} }
#ifdef DEBUG_RUMBLE #ifdef DEBUG_RUMBLE
SDL_Log("Sent rumble %d/%d\n", low_frequency_rumble, high_frequency_rumble); SDL_Log("Sent rumble %d/%d", low_frequency_rumble, high_frequency_rumble);
#endif #endif
return HIDAPI_DriverSwitch_ActuallyRumbleJoystick(ctx, low_frequency_rumble, high_frequency_rumble); return HIDAPI_DriverSwitch_ActuallyRumbleJoystick(ctx, low_frequency_rumble, high_frequency_rumble);
@@ -2719,7 +2719,7 @@ static bool HIDAPI_DriverSwitch_UpdateDevice(SDL_HIDAPI_Device *device)
} else if (ctx->m_bRumbleActive && } else if (ctx->m_bRumbleActive &&
now >= (ctx->m_ulRumbleSent + RUMBLE_REFRESH_FREQUENCY_MS)) { now >= (ctx->m_ulRumbleSent + RUMBLE_REFRESH_FREQUENCY_MS)) {
#ifdef DEBUG_RUMBLE #ifdef DEBUG_RUMBLE
SDL_Log("Sent continuing rumble, %d ms after previous rumble\n", now - ctx->m_ulRumbleSent); SDL_Log("Sent continuing rumble, %d ms after previous rumble", now - ctx->m_ulRumbleSent);
#endif #endif
WriteRumble(ctx); WriteRumble(ctx);
} }
+4 -4
View File
@@ -1364,7 +1364,7 @@ static void HandleStatus(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick)
// The report data format has been reset, need to update it // The report data format has been reset, need to update it
ResetButtonPacketType(ctx); ResetButtonPacketType(ctx);
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Status update, extension %s\n", hasExtension ? "CONNECTED" : "DISCONNECTED"); SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Status update, extension %s", hasExtension ? "CONNECTED" : "DISCONNECTED");
/* When Motion Plus is active, we get extension connect/disconnect status /* When Motion Plus is active, we get extension connect/disconnect status
* through the Motion Plus packets. Otherwise we can use the status here. * through the Motion Plus packets. Otherwise we can use the status here.
@@ -1404,7 +1404,7 @@ static void HandleResponse(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick)
if (ParseExtensionIdentifyResponse(ctx, &extension)) { if (ParseExtensionIdentifyResponse(ctx, &extension)) {
if ((extension & WII_EXTENSION_MOTIONPLUS_MASK) == WII_EXTENSION_MOTIONPLUS_ID) { if ((extension & WII_EXTENSION_MOTIONPLUS_MASK) == WII_EXTENSION_MOTIONPLUS_ID) {
// Motion Plus is currently active // Motion Plus is currently active
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus CONNECTED (stage %d)\n", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2); SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus CONNECTED (stage %d)", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2);
if (!ctx->m_bMotionPlusPresent) { if (!ctx->m_bMotionPlusPresent) {
// Reinitialize to get new sensor availability // Reinitialize to get new sensor availability
@@ -1420,7 +1420,7 @@ static void HandleResponse(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick)
} else { } else {
// Motion Plus is not present // Motion Plus is not present
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus DISCONNECTED (stage %d)\n", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2); SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Motion Plus DISCONNECTED (stage %d)", ctx->m_eCommState == k_eWiiCommunicationState_CheckMotionPlusStage1 ? 1 : 2);
if (ctx->m_bMotionPlusPresent) { if (ctx->m_bMotionPlusPresent) {
// Reinitialize to get new sensor availability // Reinitialize to get new sensor availability
@@ -1443,7 +1443,7 @@ static void HandleButtonPacket(SDL_DriverWii_Context *ctx, SDL_Joystick *joystic
// FIXME: This should see if the data format is compatible rather than equal // FIXME: This should see if the data format is compatible rather than equal
if (eExpectedReport != ctx->m_rgucReadBuffer[0]) { if (eExpectedReport != ctx->m_rgucReadBuffer[0]) {
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Resetting report mode to %d\n", eExpectedReport); SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "HIDAPI Wii: Resetting report mode to %d", eExpectedReport);
RequestButtonPacketType(ctx, eExpectedReport); RequestButtonPacketType(ctx, eExpectedReport);
} }
+3 -3
View File
@@ -306,7 +306,7 @@ static bool HIDAPI_DriverXbox360W_UpdateDevice(SDL_HIDAPI_Device *device)
if (size == 2 && data[0] == 0x08) { if (size == 2 && data[0] == 0x08) {
bool connected = (data[1] & 0x80) ? true : false; bool connected = (data[1] & 0x80) ? true : false;
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Connected = %s\n", connected ? "TRUE" : "FALSE"); SDL_Log("Connected = %s", connected ? "TRUE" : "FALSE");
#endif #endif
if (connected != ctx->connected) { if (connected != ctx->connected) {
ctx->connected = connected; ctx->connected = connected;
@@ -323,14 +323,14 @@ static bool HIDAPI_DriverXbox360W_UpdateDevice(SDL_HIDAPI_Device *device)
} else if (size == 29 && data[0] == 0x00 && data[1] == 0x0f && data[2] == 0x00 && data[3] == 0xf0) { } else if (size == 29 && data[0] == 0x00 && data[1] == 0x0f && data[2] == 0x00 && data[3] == 0xf0) {
// Serial number is data[7-13] // Serial number is data[7-13]
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Battery status (initial): %d\n", data[17]); SDL_Log("Battery status (initial): %d", data[17]);
#endif #endif
if (joystick) { if (joystick) {
UpdatePowerLevel(joystick, data[17]); UpdatePowerLevel(joystick, data[17]);
} }
} else if (size == 29 && data[0] == 0x00 && data[1] == 0x00 && data[2] == 0x00 && data[3] == 0x13) { } else if (size == 29 && data[0] == 0x00 && data[1] == 0x00 && data[2] == 0x00 && data[3] == 0x13) {
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Battery status: %d\n", data[4]); SDL_Log("Battery status: %d", data[4]);
#endif #endif
if (joystick) { if (joystick) {
UpdatePowerLevel(joystick, data[4]); UpdatePowerLevel(joystick, data[4]);
+17 -17
View File
@@ -213,7 +213,7 @@ static void SDLCALL SDL_HomeLEDHintChanged(void *userdata, const char *name, con
static void SetInitState(SDL_DriverXboxOne_Context *ctx, SDL_XboxOneInitState state) static void SetInitState(SDL_DriverXboxOne_Context *ctx, SDL_XboxOneInitState state)
{ {
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Setting init state %d\n", state); SDL_Log("Setting init state %d", state);
#endif #endif
ctx->init_state = state; ctx->init_state = state;
} }
@@ -391,7 +391,7 @@ static bool HIDAPI_DriverXboxOne_InitDevice(SDL_HIDAPI_Device *device)
} }
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Controller version: %d (0x%.4x)\n", device->version, device->version); SDL_Log("Controller version: %d (0x%.4x)", device->version, device->version);
#endif #endif
device->type = SDL_GAMEPAD_TYPE_XBOXONE; device->type = SDL_GAMEPAD_TYPE_XBOXONE;
@@ -620,7 +620,7 @@ static void HIDAPI_DriverXboxOne_HandleUnmappedStatePacket(SDL_Joystick *joystic
return; return;
} }
#ifdef DEBUG_XBOX_PROTOCOL #ifdef DEBUG_XBOX_PROTOCOL
SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s\n", SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s",
(data[paddle_index] & button1_bit) ? 1 : 0, (data[paddle_index] & button1_bit) ? 1 : 0,
(data[paddle_index] & button2_bit) ? 1 : 0, (data[paddle_index] & button2_bit) ? 1 : 0,
(data[paddle_index] & button3_bit) ? 1 : 0, (data[paddle_index] & button3_bit) ? 1 : 0,
@@ -654,7 +654,7 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
Uint8 packet[] = { 0x4d, 0x00, 0x00, 0x02, 0x07, 0x00 }; Uint8 packet[] = { 0x4d, 0x00, 0x00, 0x02, 0x07, 0x00 };
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Enabling paddles on XBox Elite 2\n"); SDL_Log("Enabling paddles on XBox Elite 2");
#endif #endif
SDL_HIDAPI_SendRumble(ctx->device, packet, sizeof(packet)); SDL_HIDAPI_SendRumble(ctx->device, packet, sizeof(packet));
} }
@@ -787,7 +787,7 @@ static void HIDAPI_DriverXboxOne_HandleStatePacket(SDL_Joystick *joystick, SDL_D
paddles_mapped = (data[20] != 0); paddles_mapped = (data[20] != 0);
} }
#ifdef DEBUG_XBOX_PROTOCOL #ifdef DEBUG_XBOX_PROTOCOL
SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s\n", SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s",
(data[paddle_index] & button1_bit) ? 1 : 0, (data[paddle_index] & button1_bit) ? 1 : 0,
(data[paddle_index] & button2_bit) ? 1 : 0, (data[paddle_index] & button2_bit) ? 1 : 0,
(data[paddle_index] & button3_bit) ? 1 : 0, (data[paddle_index] & button3_bit) ? 1 : 0,
@@ -954,7 +954,7 @@ static void HIDAPI_DriverXboxOneBluetooth_HandleButtons(Uint64 timestamp, SDL_Jo
} }
#ifdef DEBUG_XBOX_PROTOCOL #ifdef DEBUG_XBOX_PROTOCOL
SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s\n", SDL_Log(">>> Paddles: %d,%d,%d,%d mapped = %s",
(data[paddle_index] & button1_bit) ? 1 : 0, (data[paddle_index] & button1_bit) ? 1 : 0,
(data[paddle_index] & button2_bit) ? 1 : 0, (data[paddle_index] & button2_bit) ? 1 : 0,
(data[paddle_index] & button3_bit) ? 1 : 0, (data[paddle_index] & button3_bit) ? 1 : 0,
@@ -990,7 +990,7 @@ static void HIDAPI_DriverXboxOneBluetooth_HandleStatePacket(SDL_Joystick *joysti
HIDAPI_DriverXboxOneBluetooth_HandleButtons(timestamp, joystick, ctx, data, size); HIDAPI_DriverXboxOneBluetooth_HandleButtons(timestamp, joystick, ctx, data, size);
} else { } else {
#ifdef DEBUG_XBOX_PROTOCOL #ifdef DEBUG_XBOX_PROTOCOL
SDL_Log("Unknown Bluetooth state packet format\n"); SDL_Log("Unknown Bluetooth state packet format");
#endif #endif
return; return;
} }
@@ -1104,7 +1104,7 @@ static void HIDAPI_DriverXboxOne_HandleSerialIDPacket(SDL_DriverXboxOne_Context
serial[i * 2] = '\0'; serial[i * 2] = '\0';
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Setting serial number to %s\n", serial); SDL_Log("Setting serial number to %s", serial);
#endif #endif
HIDAPI_SetDeviceSerial(ctx->device, serial); HIDAPI_SetDeviceSerial(ctx->device, serial);
} }
@@ -1129,7 +1129,7 @@ static bool HIDAPI_DriverXboxOne_UpdateInitState(SDL_DriverXboxOne_Context *ctx)
if (SDL_GetTicks() >= (ctx->send_time + CONTROLLER_IDENTIFY_TIMEOUT_MS)) { if (SDL_GetTicks() >= (ctx->send_time + CONTROLLER_IDENTIFY_TIMEOUT_MS)) {
// We haven't heard anything, let's move on // We haven't heard anything, let's move on
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Identification request timed out after %llu ms\n", (SDL_GetTicks() - ctx->send_time)); SDL_Log("Identification request timed out after %llu ms", (SDL_GetTicks() - ctx->send_time));
#endif #endif
SetInitState(ctx, XBOX_ONE_INIT_STATE_STARTUP); SetInitState(ctx, XBOX_ONE_INIT_STATE_STARTUP);
} }
@@ -1146,7 +1146,7 @@ static bool HIDAPI_DriverXboxOne_UpdateInitState(SDL_DriverXboxOne_Context *ctx)
case XBOX_ONE_INIT_STATE_PREPARE_INPUT: case XBOX_ONE_INIT_STATE_PREPARE_INPUT:
if (SDL_GetTicks() >= (ctx->send_time + CONTROLLER_PREPARE_INPUT_TIMEOUT_MS)) { if (SDL_GetTicks() >= (ctx->send_time + CONTROLLER_PREPARE_INPUT_TIMEOUT_MS)) {
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Prepare input complete after %llu ms\n", (SDL_GetTicks() - ctx->send_time)); SDL_Log("Prepare input complete after %llu ms", (SDL_GetTicks() - ctx->send_time));
#endif #endif
SetInitState(ctx, XBOX_ONE_INIT_STATE_COMPLETE); SetInitState(ctx, XBOX_ONE_INIT_STATE_COMPLETE);
} }
@@ -1397,7 +1397,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
then 8 bytes of unknown data then 8 bytes of unknown data
*/ */
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Controller announce after %llu ms\n", (SDL_GetTicks() - ctx->start_time)); SDL_Log("Controller announce after %llu ms", (SDL_GetTicks() - ctx->start_time));
#endif #endif
SetInitState(ctx, XBOX_ONE_INIT_STATE_ANNOUNCED); SetInitState(ctx, XBOX_ONE_INIT_STATE_ANNOUNCED);
break; break;
@@ -1407,7 +1407,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
break; break;
case GIP_CMD_IDENTIFY: case GIP_CMD_IDENTIFY:
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Identification request completed after %llu ms\n", (SDL_GetTicks() - ctx->send_time)); SDL_Log("Identification request completed after %llu ms", (SDL_GetTicks() - ctx->send_time));
#endif #endif
#ifdef DEBUG_XBOX_PROTOCOL #ifdef DEBUG_XBOX_PROTOCOL
HIDAPI_DumpPacket("Xbox One identification data: size = %d", data, size); HIDAPI_DumpPacket("Xbox One identification data: size = %d", data, size);
@@ -1440,7 +1440,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
break; break;
default: default:
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Unknown Xbox One packet: 0x%.2x\n", hdr->command); SDL_Log("Unknown Xbox One packet: 0x%.2x", hdr->command);
#endif #endif
break; break;
} }
@@ -1452,7 +1452,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
// Ignore the first input, it may be spurious // Ignore the first input, it may be spurious
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Controller ignoring spurious input\n"); SDL_Log("Controller ignoring spurious input");
#endif #endif
break; break;
} }
@@ -1469,7 +1469,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
break; break;
default: default:
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Unknown Xbox One packet: 0x%.2x\n", hdr->command); SDL_Log("Unknown Xbox One packet: 0x%.2x", hdr->command);
#endif #endif
break; break;
} }
@@ -1596,7 +1596,7 @@ static bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
HIDAPI_DriverXboxOneBluetooth_HandleStatePacket(joystick, ctx, data, size); HIDAPI_DriverXboxOneBluetooth_HandleStatePacket(joystick, ctx, data, size);
} else { } else {
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Unknown Xbox One Bluetooth packet size: %d\n", size); SDL_Log("Unknown Xbox One Bluetooth packet size: %d", size);
#endif #endif
} }
break; break;
@@ -1614,7 +1614,7 @@ static bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
break; break;
default: default:
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Unknown Xbox One packet: 0x%.2x\n", data[0]); SDL_Log("Unknown Xbox One packet: 0x%.2x", data[0]);
#endif #endif
break; break;
} }
+4 -4
View File
@@ -955,7 +955,7 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf
return NULL; return NULL;
} }
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version, SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version,
device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage,
device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED");
@@ -969,7 +969,7 @@ static void HIDAPI_DelDevice(SDL_HIDAPI_Device *device)
SDL_AssertJoysticksLocked(); SDL_AssertJoysticksLocked();
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Removing HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version, SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Removing HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, bluetooth %d, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)", device->name, device->vendor_id, device->product_id, device->is_bluetooth, device->version,
device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage,
device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED");
@@ -1229,7 +1229,7 @@ bool HIDAPI_IsDeviceTypePresent(SDL_GamepadType type)
SDL_UnlockJoysticks(); SDL_UnlockJoysticks();
#ifdef DEBUG_HIDAPI #ifdef DEBUG_HIDAPI
SDL_Log("HIDAPI_IsDeviceTypePresent() returning %s for %d\n", result ? "true" : "false", type); SDL_Log("HIDAPI_IsDeviceTypePresent() returning %s for %d", result ? "true" : "false", type);
#endif #endif
return result; return result;
} }
@@ -1280,7 +1280,7 @@ bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version,
SDL_UnlockJoysticks(); SDL_UnlockJoysticks();
#ifdef DEBUG_HIDAPI #ifdef DEBUG_HIDAPI
SDL_Log("HIDAPI_IsDevicePresent() returning %s for 0x%.4x / 0x%.4x\n", result ? "true" : "false", vendor_id, product_id); SDL_Log("HIDAPI_IsDevicePresent() returning %s for 0x%.4x / 0x%.4x", result ? "true" : "false", vendor_id, product_id);
#endif #endif
return result; return result;
} }
+29 -29
View File
@@ -327,7 +327,7 @@ static bool IsJoystick(const char *path, int *fd, char **name_return, Uint16 *ve
FixupDeviceInfoForMapping(*fd, &inpid); FixupDeviceInfoForMapping(*fd, &inpid);
#ifdef DEBUG_JOYSTICK #ifdef DEBUG_JOYSTICK
SDL_Log("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", name, inpid.bustype, inpid.vendor, inpid.product, inpid.version); SDL_Log("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d", name, inpid.bustype, inpid.vendor, inpid.product, inpid.version);
#endif #endif
if (SDL_ShouldIgnoreJoystick(inpid.vendor, inpid.product, inpid.version, name)) { if (SDL_ShouldIgnoreJoystick(inpid.vendor, inpid.product, inpid.version, name)) {
@@ -470,12 +470,12 @@ static void MaybeAddDevice(const char *path)
} }
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Checking %s\n", path); SDL_Log("Checking %s", path);
#endif #endif
if (IsJoystick(path, &fd, &name, &vendor, &product, &guid)) { if (IsJoystick(path, &fd, &name, &vendor, &product, &guid)) {
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("found joystick: %s\n", path); SDL_Log("found joystick: %s", path);
#endif #endif
item = (SDL_joylist_item *)SDL_calloc(1, sizeof(SDL_joylist_item)); item = (SDL_joylist_item *)SDL_calloc(1, sizeof(SDL_joylist_item));
if (!item) { if (!item) {
@@ -516,7 +516,7 @@ static void MaybeAddDevice(const char *path)
if (IsSensor(path, &fd)) { if (IsSensor(path, &fd)) {
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("found sensor: %s\n", path); SDL_Log("found sensor: %s", path);
#endif #endif
item_sensor = (SDL_sensorlist_item *)SDL_calloc(1, sizeof(SDL_sensorlist_item)); item_sensor = (SDL_sensorlist_item *)SDL_calloc(1, sizeof(SDL_sensorlist_item));
if (!item_sensor) { if (!item_sensor) {
@@ -1217,7 +1217,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
for (i = BTN_JOYSTICK; i < KEY_MAX; ++i) { for (i = BTN_JOYSTICK; i < KEY_MAX; ++i) {
if (test_bit(i, keybit)) { if (test_bit(i, keybit)) {
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", i); SDL_Log("Joystick has button: 0x%x", i);
#endif #endif
joystick->hwdata->key_map[i] = joystick->nbuttons; joystick->hwdata->key_map[i] = joystick->nbuttons;
joystick->hwdata->has_key[i] = true; joystick->hwdata->has_key[i] = true;
@@ -1227,7 +1227,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
for (i = 0; i < BTN_JOYSTICK; ++i) { for (i = 0; i < BTN_JOYSTICK; ++i) {
if (test_bit(i, keybit)) { if (test_bit(i, keybit)) {
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", i); SDL_Log("Joystick has button: 0x%x", i);
#endif #endif
joystick->hwdata->key_map[i] = joystick->nbuttons; joystick->hwdata->key_map[i] = joystick->nbuttons;
joystick->hwdata->has_key[i] = true; joystick->hwdata->has_key[i] = true;
@@ -1250,14 +1250,14 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
const int hat_index = (i - ABS_HAT0X) / 2; const int hat_index = (i - ABS_HAT0X) / 2;
struct hat_axis_correct *correct = &joystick->hwdata->hat_correct[hat_index]; struct hat_axis_correct *correct = &joystick->hwdata->hat_correct[hat_index];
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has digital hat: #%d\n", hat_index); SDL_Log("Joystick has digital hat: #%d", hat_index);
if (hat_x >= 0) { if (hat_x >= 0) {
SDL_Log("X Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", SDL_Log("X Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo_x.value, absinfo_x.minimum, absinfo_x.maximum, absinfo_x.value, absinfo_x.minimum, absinfo_x.maximum,
absinfo_x.fuzz, absinfo_x.flat, absinfo_x.resolution); absinfo_x.fuzz, absinfo_x.flat, absinfo_x.resolution);
} }
if (hat_y >= 0) { if (hat_y >= 0) {
SDL_Log("Y Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", SDL_Log("Y Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo_y.value, absinfo_y.minimum, absinfo_y.maximum, absinfo_y.value, absinfo_y.minimum, absinfo_y.maximum,
absinfo_y.fuzz, absinfo_y.flat, absinfo_y.resolution); absinfo_y.fuzz, absinfo_y.flat, absinfo_y.resolution);
} }
@@ -1285,8 +1285,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
continue; continue;
} }
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has absolute axis: 0x%.2x\n", i); SDL_Log("Joystick has absolute axis: 0x%.2x", i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo.value, absinfo.minimum, absinfo.maximum, absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution); absinfo.fuzz, absinfo.flat, absinfo.resolution);
#endif // DEBUG_INPUT_EVENTS #endif // DEBUG_INPUT_EVENTS
@@ -1340,7 +1340,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
for (i = 0; i < key_pam_size; ++i) { for (i = 0; i < key_pam_size; ++i) {
Uint16 code = joystick->hwdata->key_pam[i]; Uint16 code = joystick->hwdata->key_pam[i];
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", code); SDL_Log("Joystick has button: 0x%x", code);
#endif #endif
joystick->hwdata->key_map[code] = joystick->nbuttons; joystick->hwdata->key_map[code] = joystick->nbuttons;
joystick->hwdata->has_key[code] = true; joystick->hwdata->has_key[code] = true;
@@ -1366,7 +1366,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
int hat_index = (code - ABS_HAT0X) / 2; int hat_index = (code - ABS_HAT0X) / 2;
if (!joystick->hwdata->has_hat[hat_index]) { if (!joystick->hwdata->has_hat[hat_index]) {
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has digital hat: #%d\n", hat_index); SDL_Log("Joystick has digital hat: #%d", hat_index);
#endif #endif
joystick->hwdata->hats_indices[hat_index] = joystick->nhats++; joystick->hwdata->hats_indices[hat_index] = joystick->nhats++;
joystick->hwdata->has_hat[hat_index] = true; joystick->hwdata->has_hat[hat_index] = true;
@@ -1377,7 +1377,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
} }
} else { } else {
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has absolute axis: 0x%.2x\n", code); SDL_Log("Joystick has absolute axis: 0x%.2x", code);
#endif #endif
joystick->hwdata->abs_map[code] = joystick->naxes; joystick->hwdata->abs_map[code] = joystick->naxes;
joystick->hwdata->has_abs[code] = true; joystick->hwdata->has_abs[code] = true;
@@ -1398,8 +1398,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
} }
joystick->hwdata->accelerometer_scale[i] = absinfo.resolution; joystick->hwdata->accelerometer_scale[i] = absinfo.resolution;
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has accelerometer axis: 0x%.2x\n", ABS_X + i); SDL_Log("Joystick has accelerometer axis: 0x%.2x", ABS_X + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo.value, absinfo.minimum, absinfo.maximum, absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution); absinfo.fuzz, absinfo.flat, absinfo.resolution);
#endif // DEBUG_INPUT_EVENTS #endif // DEBUG_INPUT_EVENTS
@@ -1416,8 +1416,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
} }
joystick->hwdata->gyro_scale[i] = absinfo.resolution; joystick->hwdata->gyro_scale[i] = absinfo.resolution;
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has gyro axis: 0x%.2x\n", ABS_RX + i); SDL_Log("Joystick has gyro axis: 0x%.2x", ABS_RX + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo.value, absinfo.minimum, absinfo.maximum, absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution); absinfo.fuzz, absinfo.flat, absinfo.resolution);
#endif // DEBUG_INPUT_EVENTS #endif // DEBUG_INPUT_EVENTS
@@ -1522,7 +1522,7 @@ static SDL_sensorlist_item *GetSensor(SDL_joylist_item *item)
} }
close(fd_item); close(fd_item);
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick UNIQ: %s\n", uniq_item); SDL_Log("Joystick UNIQ: %s", uniq_item);
#endif // DEBUG_INPUT_EVENTS #endif // DEBUG_INPUT_EVENTS
for (item_sensor = SDL_sensorlist; item_sensor; item_sensor = item_sensor->next) { for (item_sensor = SDL_sensorlist; item_sensor; item_sensor = item_sensor->next) {
@@ -1544,7 +1544,7 @@ static SDL_sensorlist_item *GetSensor(SDL_joylist_item *item)
} }
close(fd_sensor); close(fd_sensor);
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Sensor UNIQ: %s\n", uniq_sensor); SDL_Log("Sensor UNIQ: %s", uniq_sensor);
#endif // DEBUG_INPUT_EVENTS #endif // DEBUG_INPUT_EVENTS
if (SDL_strcmp(uniq_item, uniq_sensor) == 0) { if (SDL_strcmp(uniq_item, uniq_sensor) == 0) {
@@ -1800,7 +1800,7 @@ static void PollAllValues(Uint64 timestamp, SDL_Joystick *joystick)
absinfo.value = AxisCorrect(joystick, i, absinfo.value); absinfo.value = AxisCorrect(joystick, i, absinfo.value);
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Axis %d (%d) val= %d\n", SDL_Log("Joystick : Re-read Axis %d (%d) val= %d",
joystick->hwdata->abs_map[i], i, absinfo.value); joystick->hwdata->abs_map[i], i, absinfo.value);
#endif #endif
SDL_SendJoystickAxis(timestamp, joystick, SDL_SendJoystickAxis(timestamp, joystick,
@@ -1831,7 +1831,7 @@ static void PollAllValues(Uint64 timestamp, SDL_Joystick *joystick)
if (joystick->hwdata->has_key[i]) { if (joystick->hwdata->has_key[i]) {
bool down = test_bit(i, keyinfo); bool down = test_bit(i, keyinfo);
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Button %d (%d) val= %d\n", SDL_Log("Joystick : Re-read Button %d (%d) val= %d",
joystick->hwdata->key_map[i], i, down); joystick->hwdata->key_map[i], i, down);
#endif #endif
SDL_SendJoystickButton(timestamp, joystick, SDL_SendJoystickButton(timestamp, joystick,
@@ -1858,7 +1858,7 @@ static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick)
if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_RX + i), &absinfo) >= 0) { if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_RX + i), &absinfo) >= 0) {
data[i] = absinfo.value * (SDL_PI_F / 180.f) / joystick->hwdata->gyro_scale[i]; data[i] = absinfo.value * (SDL_PI_F / 180.f) / joystick->hwdata->gyro_scale[i];
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Gyro (axis %d) val= %f\n", i, data[i]); SDL_Log("Joystick : Re-read Gyro (axis %d) val= %f", i, data[i]);
#endif #endif
} }
} }
@@ -1870,7 +1870,7 @@ static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick)
if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_X + i), &absinfo) >= 0) { if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_X + i), &absinfo) >= 0) {
data[i] = absinfo.value * SDL_STANDARD_GRAVITY / joystick->hwdata->accelerometer_scale[i]; data[i] = absinfo.value * SDL_STANDARD_GRAVITY / joystick->hwdata->accelerometer_scale[i];
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick : Re-read Accelerometer (axis %d) val= %f\n", i, data[i]); SDL_Log("Joystick : Re-read Accelerometer (axis %d) val= %f", i, data[i]);
#endif #endif
} }
} }
@@ -1913,7 +1913,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (event->type) { switch (event->type) {
case EV_KEY: case EV_KEY:
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Key 0x%.2x %s\n", code, event->value ? "PRESSED" : "RELEASED"); SDL_Log("Key 0x%.2x %s", code, event->value ? "PRESSED" : "RELEASED");
#endif #endif
SDL_SendJoystickButton(SDL_EVDEV_GetEventTimestamp(event), joystick, SDL_SendJoystickButton(SDL_EVDEV_GetEventTimestamp(event), joystick,
joystick->hwdata->key_map[code], joystick->hwdata->key_map[code],
@@ -1932,7 +1932,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
hat_index = (code - ABS_HAT0X) / 2; hat_index = (code - ABS_HAT0X) / 2;
if (joystick->hwdata->has_hat[hat_index]) { if (joystick->hwdata->has_hat[hat_index]) {
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Axis 0x%.2x = %d\n", code, event->value); SDL_Log("Axis 0x%.2x = %d", code, event->value);
#endif #endif
HandleHat(SDL_EVDEV_GetEventTimestamp(event), joystick, hat_index, code % 2, event->value); HandleHat(SDL_EVDEV_GetEventTimestamp(event), joystick, hat_index, code % 2, event->value);
break; break;
@@ -1940,7 +1940,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
SDL_FALLTHROUGH; SDL_FALLTHROUGH;
default: default:
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Axis 0x%.2x = %d\n", code, event->value); SDL_Log("Axis 0x%.2x = %d", code, event->value);
#endif #endif
event->value = AxisCorrect(joystick, code, event->value); event->value = AxisCorrect(joystick, code, event->value);
SDL_SendJoystickAxis(SDL_EVDEV_GetEventTimestamp(event), joystick, SDL_SendJoystickAxis(SDL_EVDEV_GetEventTimestamp(event), joystick,
@@ -1964,7 +1964,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (code) { switch (code) {
case SYN_DROPPED: case SYN_DROPPED:
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Event SYN_DROPPED detected\n"); SDL_Log("Event SYN_DROPPED detected");
#endif #endif
joystick->hwdata->recovering_from_dropped = true; joystick->hwdata->recovering_from_dropped = true;
break; break;
@@ -2047,7 +2047,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (code) { switch (code) {
case SYN_DROPPED: case SYN_DROPPED:
#ifdef DEBUG_INPUT_EVENTS #ifdef DEBUG_INPUT_EVENTS
SDL_Log("Event SYN_DROPPED detected\n"); SDL_Log("Event SYN_DROPPED detected");
#endif #endif
joystick->hwdata->recovering_from_dropped_sensor = true; joystick->hwdata->recovering_from_dropped_sensor = true;
break; break;
+6 -6
View File
@@ -935,7 +935,7 @@ static void RAWINPUT_AddDevice(HANDLE hDevice)
device->joystick_id = SDL_GetNextObjectID(); device->joystick_id = SDL_GetNextObjectID();
#ifdef DEBUG_RAWINPUT #ifdef DEBUG_RAWINPUT
SDL_Log("Adding RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle 0x%.8x\n", device->name, device->vendor_id, device->product_id, device->version, device->hDevice); SDL_Log("Adding RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle 0x%.8x", device->name, device->vendor_id, device->product_id, device->version, device->hDevice);
#endif #endif
// Add it to the list // Add it to the list
@@ -985,7 +985,7 @@ static void RAWINPUT_DelDevice(SDL_RAWINPUT_Device *device, bool send_event)
SDL_PrivateJoystickRemoved(device->joystick_id); SDL_PrivateJoystickRemoved(device->joystick_id);
#ifdef DEBUG_RAWINPUT #ifdef DEBUG_RAWINPUT
SDL_Log("Removing RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle %p\n", device->name, device->vendor_id, device->product_id, device->version, device->hDevice); SDL_Log("Removing RAWINPUT device '%s' VID 0x%.4x, PID 0x%.4x, version %d, handle %p", device->name, device->vendor_id, device->product_id, device->version, device->hDevice);
#endif #endif
RAWINPUT_ReleaseDevice(device); RAWINPUT_ReleaseDevice(device);
return; return;
@@ -1779,7 +1779,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
triggers for a frame. */ triggers for a frame. */
if (ctx->wgi_uncorrelate_count >= 5) { if (ctx->wgi_uncorrelate_count >= 5) {
#ifdef DEBUG_RAWINPUT #ifdef DEBUG_RAWINPUT
SDL_Log("UN-Correlated joystick %d to WindowsGamingInput device #%d\n", joystick->instance_id, ctx->wgi_slot); SDL_Log("UN-Correlated joystick %d to WindowsGamingInput device #%d", joystick->instance_id, ctx->wgi_slot);
#endif #endif
RAWINPUT_MarkWindowsGamingInputSlotFree(ctx->wgi_slot); RAWINPUT_MarkWindowsGamingInputSlotFree(ctx->wgi_slot);
ctx->wgi_correlated = false; ctx->wgi_correlated = false;
@@ -1811,7 +1811,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
// correlation stayed steady and uncontested across multiple frames, guaranteed match // correlation stayed steady and uncontested across multiple frames, guaranteed match
ctx->wgi_correlated = true; ctx->wgi_correlated = true;
#ifdef DEBUG_RAWINPUT #ifdef DEBUG_RAWINPUT
SDL_Log("Correlated joystick %d to WindowsGamingInput device #%d\n", joystick->instance_id, slot_idx); SDL_Log("Correlated joystick %d to WindowsGamingInput device #%d", joystick->instance_id, slot_idx);
#endif #endif
correlated = true; correlated = true;
RAWINPUT_MarkWindowsGamingInputSlotUsed(ctx->wgi_slot, ctx); RAWINPUT_MarkWindowsGamingInputSlotUsed(ctx->wgi_slot, ctx);
@@ -1875,7 +1875,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
triggers for a frame. */ triggers for a frame. */
if (ctx->xinput_uncorrelate_count >= 5) { if (ctx->xinput_uncorrelate_count >= 5) {
#ifdef DEBUG_RAWINPUT #ifdef DEBUG_RAWINPUT
SDL_Log("UN-Correlated joystick %d to XInput device #%d\n", joystick->instance_id, ctx->xinput_slot); SDL_Log("UN-Correlated joystick %d to XInput device #%d", joystick->instance_id, ctx->xinput_slot);
#endif #endif
RAWINPUT_MarkXInputSlotFree(ctx->xinput_slot); RAWINPUT_MarkXInputSlotFree(ctx->xinput_slot);
ctx->xinput_correlated = false; ctx->xinput_correlated = false;
@@ -1907,7 +1907,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
// correlation stayed steady and uncontested across multiple frames, guaranteed match // correlation stayed steady and uncontested across multiple frames, guaranteed match
ctx->xinput_correlated = true; ctx->xinput_correlated = true;
#ifdef DEBUG_RAWINPUT #ifdef DEBUG_RAWINPUT
SDL_Log("Correlated joystick %d to XInput device #%d\n", joystick->instance_id, slot_idx); SDL_Log("Correlated joystick %d to XInput device #%d", joystick->instance_id, slot_idx);
#endif #endif
correlated = true; correlated = true;
RAWINPUT_MarkXInputSlotUsed(ctx->xinput_slot); RAWINPUT_MarkXInputSlotUsed(ctx->xinput_slot);
+4 -4
View File
@@ -997,7 +997,7 @@ static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer *renderer)
*/ */
SDL_GetWindowSizeInPixels(renderer->window, &w, &h); SDL_GetWindowSizeInPixels(renderer->window, &w, &h);
data->rotation = D3D11_GetCurrentRotation(); data->rotation = D3D11_GetCurrentRotation();
// SDL_Log("%s: windowSize={%d,%d}, orientation=%d\n", __FUNCTION__, w, h, (int)data->rotation); // SDL_Log("%s: windowSize={%d,%d}, orientation=%d", __FUNCTION__, w, h, (int)data->rotation);
if (D3D11_IsDisplayRotated90Degrees(data->rotation)) { if (D3D11_IsDisplayRotated90Degrees(data->rotation)) {
int tmp = w; int tmp = w;
w = h; w = h;
@@ -1078,7 +1078,7 @@ static bool D3D11_HandleDeviceLost(SDL_Renderer *renderer)
SUCCEEDED(D3D11_CreateWindowSizeDependentResources(renderer))) { SUCCEEDED(D3D11_CreateWindowSizeDependentResources(renderer))) {
recovered = true; recovered = true;
} else { } else {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s\n", SDL_GetError()); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s", SDL_GetError());
D3D11_ReleaseAll(renderer); D3D11_ReleaseAll(renderer);
} }
@@ -1990,7 +1990,7 @@ static bool D3D11_UpdateViewport(SDL_Renderer *renderer)
* SDL_CreateRenderer is calling it, and will call it again later * SDL_CreateRenderer is calling it, and will call it again later
* with a non-empty viewport. * with a non-empty viewport.
*/ */
// SDL_Log("%s, no viewport was set!\n", __FUNCTION__); // SDL_Log("%s, no viewport was set!", __FUNCTION__);
return false; return false;
} }
@@ -2057,7 +2057,7 @@ static bool D3D11_UpdateViewport(SDL_Renderer *renderer)
d3dviewport.Height = orientationAlignedViewport.h; d3dviewport.Height = orientationAlignedViewport.h;
d3dviewport.MinDepth = 0.0f; d3dviewport.MinDepth = 0.0f;
d3dviewport.MaxDepth = 1.0f; d3dviewport.MaxDepth = 1.0f;
// SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}\n", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height); // SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height);
ID3D11DeviceContext_RSSetViewports(data->d3dContext, 1, &d3dviewport); ID3D11DeviceContext_RSSetViewports(data->d3dContext, 1, &d3dviewport);
data->viewportDirty = false; data->viewportDirty = false;
+3 -3
View File
@@ -1453,7 +1453,7 @@ static bool D3D12_HandleDeviceLost(SDL_Renderer *renderer)
SUCCEEDED(D3D12_CreateWindowSizeDependentResources(renderer))) { SUCCEEDED(D3D12_CreateWindowSizeDependentResources(renderer))) {
recovered = true; recovered = true;
} else { } else {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s\n", SDL_GetError()); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s", SDL_GetError());
D3D12_ReleaseAll(renderer); D3D12_ReleaseAll(renderer);
} }
@@ -2430,7 +2430,7 @@ static bool D3D12_UpdateViewport(SDL_Renderer *renderer)
* SDL_CreateRenderer is calling it, and will call it again later * SDL_CreateRenderer is calling it, and will call it again later
* with a non-empty viewport. * with a non-empty viewport.
*/ */
// SDL_Log("%s, no viewport was set!\n", __FUNCTION__); // SDL_Log("%s, no viewport was set!", __FUNCTION__);
return false; return false;
} }
@@ -2497,7 +2497,7 @@ static bool D3D12_UpdateViewport(SDL_Renderer *renderer)
d3dviewport.Height = orientationAlignedViewport.h; d3dviewport.Height = orientationAlignedViewport.h;
d3dviewport.MinDepth = 0.0f; d3dviewport.MinDepth = 0.0f;
d3dviewport.MaxDepth = 1.0f; d3dviewport.MaxDepth = 1.0f;
// SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}\n", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height); // SDL_Log("%s: D3D viewport = {%f,%f,%f,%f}", __FUNCTION__, d3dviewport.TopLeftX, d3dviewport.TopLeftY, d3dviewport.Width, d3dviewport.Height);
ID3D12GraphicsCommandList_RSSetViewports(data->commandList, 1, &d3dviewport); ID3D12GraphicsCommandList_RSSetViewports(data->commandList, 1, &d3dviewport);
data->viewportDirty = false; data->viewportDirty = false;
+4 -1
View File
@@ -350,7 +350,10 @@ static bool CompileShader(GL_ShaderContext *ctx, GLhandleARB shader, const char
info = SDL_small_alloc(char, length + 1, &isstack); info = SDL_small_alloc(char, length + 1, &isstack);
if (info) { if (info) {
ctx->glGetInfoLogARB(shader, length, NULL, info); ctx->glGetInfoLogARB(shader, length, NULL, info);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Failed to compile shader:\n%s%s\n%s", defines, source, info); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Failed to compile shader:");
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", defines);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", source);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", info);
SDL_small_free(info, isstack); SDL_small_free(info, isstack);
} }
return false; return false;
+1 -1
View File
@@ -539,7 +539,7 @@ static GLuint GLES2_CacheShader(GLES2_RenderData *data, GLES2_ShaderType type, G
SDL_asprintf(&message, "%s%s", last_message, shader_src_list[i]); SDL_asprintf(&message, "%s%s", last_message, shader_src_list[i]);
SDL_free(last_message); SDL_free(last_message);
} }
SDL_Log("%s\n", message); SDL_Log("%s", message);
SDL_free(message); SDL_free(message);
} }
#endif #endif
+2 -2
View File
@@ -324,11 +324,11 @@ static void VITA_GXM_SetYUVProfile(SDL_Renderer *renderer, SDL_Texture *texture)
ret = sceGxmSetYuvProfile(data->gxm_context, 0, SCE_GXM_YUV_PROFILE_BT709_FULL_RANGE); ret = sceGxmSetYuvProfile(data->gxm_context, 0, SCE_GXM_YUV_PROFILE_BT709_FULL_RANGE);
} }
} else { } else {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Unsupported YUV colorspace\n"); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Unsupported YUV colorspace");
} }
if (ret < 0) { if (ret < 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Setting YUV profile failed: %x\n", ret); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Setting YUV profile failed: %x", ret);
} }
} }
+31 -31
View File
@@ -87,7 +87,7 @@ void *pool_malloc(VITA_GXM_RenderData *data, unsigned int size)
data->pool_index += size; data->pool_index += size;
return addr; return addr;
} }
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW\n"); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW");
return NULL; return NULL;
} }
@@ -99,7 +99,7 @@ void *pool_memalign(VITA_GXM_RenderData *data, unsigned int size, unsigned int a
data->pool_index = new_index + size; data->pool_index = new_index + size;
return addr; return addr;
} }
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW\n"); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW");
return NULL; return NULL;
} }
@@ -173,7 +173,7 @@ static void make_fragment_programs(VITA_GXM_RenderData *data, fragment_programs
&out->color); &out->color);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d", err);
return; return;
} }
@@ -187,7 +187,7 @@ static void make_fragment_programs(VITA_GXM_RenderData *data, fragment_programs
&out->texture); &out->texture);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Patcher create fragment failed: %d", err);
return; return;
} }
} }
@@ -387,7 +387,7 @@ int gxm_init(SDL_Renderer *renderer)
err = sceGxmInitialize(&initializeParams); err = sceGxmInitialize(&initializeParams);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "gxm init failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "gxm init failed: %d", err);
return err; return err;
} }
@@ -433,7 +433,7 @@ int gxm_init(SDL_Renderer *renderer)
err = sceGxmCreateContext(&data->contextParams, &data->gxm_context); err = sceGxmCreateContext(&data->contextParams, &data->gxm_context);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create context failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create context failed: %d", err);
return err; return err;
} }
@@ -450,7 +450,7 @@ int gxm_init(SDL_Renderer *renderer)
// create the render target // create the render target
err = sceGxmCreateRenderTarget(&renderTargetParams, &data->renderTarget); err = sceGxmCreateRenderTarget(&renderTargetParams, &data->renderTarget);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "render target creation failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "render target creation failed: %d", err);
return err; return err;
} }
@@ -486,14 +486,14 @@ int gxm_init(SDL_Renderer *renderer)
data->displayBufferData[i]); data->displayBufferData[i]);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %d", err);
return err; return err;
} }
// create a sync object that we will associate with this buffer // create a sync object that we will associate with this buffer
err = sceGxmSyncObjectCreate(&data->displayBufferSync[i]); err = sceGxmSyncObjectCreate(&data->displayBufferSync[i]);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "sync object creation failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "sync object creation failed: %d", err);
return err; return err;
} }
} }
@@ -576,81 +576,81 @@ int gxm_init(SDL_Renderer *renderer)
err = sceGxmShaderPatcherCreate(&patcherParams, &data->shaderPatcher); err = sceGxmShaderPatcherCreate(&patcherParams, &data->shaderPatcher);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "shader patcher creation failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "shader patcher creation failed: %d", err);
return err; return err;
} }
// check the shaders // check the shaders
err = sceGxmProgramCheck(clearVertexProgramGxp); err = sceGxmProgramCheck(clearVertexProgramGxp);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear vertex) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear vertex) failed: %d", err);
return err; return err;
} }
err = sceGxmProgramCheck(clearFragmentProgramGxp); err = sceGxmProgramCheck(clearFragmentProgramGxp);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear fragment) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (clear fragment) failed: %d", err);
return err; return err;
} }
err = sceGxmProgramCheck(colorVertexProgramGxp); err = sceGxmProgramCheck(colorVertexProgramGxp);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color vertex) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color vertex) failed: %d", err);
return err; return err;
} }
err = sceGxmProgramCheck(colorFragmentProgramGxp); err = sceGxmProgramCheck(colorFragmentProgramGxp);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color fragment) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (color fragment) failed: %d", err);
return err; return err;
} }
err = sceGxmProgramCheck(textureVertexProgramGxp); err = sceGxmProgramCheck(textureVertexProgramGxp);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture vertex) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture vertex) failed: %d", err);
return err; return err;
} }
err = sceGxmProgramCheck(textureFragmentProgramGxp); err = sceGxmProgramCheck(textureFragmentProgramGxp);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture fragment) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "check program (texture fragment) failed: %d", err);
return err; return err;
} }
// register programs with the patcher // register programs with the patcher
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, clearVertexProgramGxp, &data->clearVertexProgramId); err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, clearVertexProgramGxp, &data->clearVertexProgramId);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear vertex) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear vertex) failed: %d", err);
return err; return err;
} }
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, clearFragmentProgramGxp, &data->clearFragmentProgramId); err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, clearFragmentProgramGxp, &data->clearFragmentProgramId);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear fragment) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (clear fragment) failed: %d", err);
return err; return err;
} }
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, colorVertexProgramGxp, &data->colorVertexProgramId); err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, colorVertexProgramGxp, &data->colorVertexProgramId);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color vertex) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color vertex) failed: %d", err);
return err; return err;
} }
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, colorFragmentProgramGxp, &data->colorFragmentProgramId); err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, colorFragmentProgramGxp, &data->colorFragmentProgramId);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color fragment) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (color fragment) failed: %d", err);
return err; return err;
} }
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, textureVertexProgramGxp, &data->textureVertexProgramId); err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, textureVertexProgramGxp, &data->textureVertexProgramId);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture vertex) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture vertex) failed: %d", err);
return err; return err;
} }
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, textureFragmentProgramGxp, &data->textureFragmentProgramId); err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, textureFragmentProgramGxp, &data->textureFragmentProgramId);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture fragment) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "register program (texture fragment) failed: %d", err);
return err; return err;
} }
@@ -679,7 +679,7 @@ int gxm_init(SDL_Renderer *renderer)
1, 1,
&data->clearVertexProgram); &data->clearVertexProgram);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear vertex) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear vertex) failed: %d", err);
return err; return err;
} }
@@ -692,7 +692,7 @@ int gxm_init(SDL_Renderer *renderer)
clearVertexProgramGxp, clearVertexProgramGxp,
&data->clearFragmentProgram); &data->clearFragmentProgram);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear fragment) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (clear fragment) failed: %d", err);
return err; return err;
} }
@@ -760,7 +760,7 @@ int gxm_init(SDL_Renderer *renderer)
1, 1,
&data->colorVertexProgram); &data->colorVertexProgram);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (color vertex) failed: %d\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (color vertex) failed: %d", err);
return err; return err;
} }
} }
@@ -805,7 +805,7 @@ int gxm_init(SDL_Renderer *renderer)
1, 1,
&data->textureVertexProgram); &data->textureVertexProgram);
if (err != 0) { if (err != 0) {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (texture vertex) failed: %x\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create program (texture vertex) failed: %x", err);
return err; return err;
} }
} }
@@ -1016,7 +1016,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
// Try SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE in case we're out of VRAM // Try SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE in case we're out of VRAM
if (!texture_data) { if (!texture_data) {
SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed\n"); SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed");
texture_data = vita_mem_alloc( texture_data = vita_mem_alloc(
SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE,
tex_size, tex_size,
@@ -1040,7 +1040,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
ret = sceGxmTextureInitLinear(&texture->gxm_tex, texture_data, format, texture_w, h, 0); ret = sceGxmTextureInitLinear(&texture->gxm_tex, texture_data, format, texture_w, h, 0);
if (ret < 0) { if (ret < 0) {
free_gxm_texture(data, texture); free_gxm_texture(data, texture);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "texture init failed: %x\n", ret); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "texture init failed: %x", ret);
return NULL; return NULL;
} }
@@ -1065,7 +1065,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
if (err < 0) { if (err < 0) {
free_gxm_texture(data, texture); free_gxm_texture(data, texture);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %x\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "color surface init failed: %x", err);
return NULL; return NULL;
} }
@@ -1088,7 +1088,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
if (err < 0) { if (err < 0) {
free_gxm_texture(data, texture); free_gxm_texture(data, texture);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "depth stencil init failed: %x\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "depth stencil init failed: %x", err);
return NULL; return NULL;
} }
@@ -1113,7 +1113,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
if (err < 0) { if (err < 0) {
free_gxm_texture(data, texture); free_gxm_texture(data, texture);
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create render target failed: %x\n", err); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "create render target failed: %x", err);
return NULL; return NULL;
} }
} }
+4 -4
View File
@@ -41,14 +41,14 @@
#define SET_ERROR_CODE(message, rc) \ #define SET_ERROR_CODE(message, rc) \
if (SDL_GetHintBoolean(SDL_HINT_RENDER_VULKAN_DEBUG, false)) { \ if (SDL_GetHintBoolean(SDL_HINT_RENDER_VULKAN_DEBUG, false)) { \
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s: %s\n", message, SDL_Vulkan_GetResultString(rc)); \ SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s: %s", message, SDL_Vulkan_GetResultString(rc)); \
SDL_TriggerBreakpoint(); \ SDL_TriggerBreakpoint(); \
} \ } \
SDL_SetError("%s: %s", message, SDL_Vulkan_GetResultString(rc)) \ SDL_SetError("%s: %s", message, SDL_Vulkan_GetResultString(rc)) \
#define SET_ERROR_MESSAGE(message) \ #define SET_ERROR_MESSAGE(message) \
if (SDL_GetHintBoolean(SDL_HINT_RENDER_VULKAN_DEBUG, false)) { \ if (SDL_GetHintBoolean(SDL_HINT_RENDER_VULKAN_DEBUG, false)) { \
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s\n", message); \ SDL_LogError(SDL_LOG_CATEGORY_RENDER, "%s", message); \
SDL_TriggerBreakpoint(); \ SDL_TriggerBreakpoint(); \
} \ } \
SDL_SetError("%s", message) \ SDL_SetError("%s", message) \
@@ -2512,7 +2512,7 @@ static bool VULKAN_HandleDeviceLost(SDL_Renderer *renderer)
VULKAN_CreateWindowSizeDependentResources(renderer) == VK_SUCCESS) { VULKAN_CreateWindowSizeDependentResources(renderer) == VK_SUCCESS) {
recovered = true; recovered = true;
} else { } else {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s\n", SDL_GetError()); SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Renderer couldn't recover from device lost: %s", SDL_GetError());
VULKAN_DestroyAll(renderer); VULKAN_DestroyAll(renderer);
} }
@@ -3296,7 +3296,7 @@ static bool VULKAN_UpdateViewport(SDL_Renderer *renderer)
* SDL_CreateRenderer is calling it, and will call it again later * SDL_CreateRenderer is calling it, and will call it again later
* with a non-empty viewport. * with a non-empty viewport.
*/ */
// SDL_Log("%s, no viewport was set!\n", __FUNCTION__); // SDL_Log("%s, no viewport was set!", __FUNCTION__);
return false; return false;
} }
+4 -4
View File
@@ -132,7 +132,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnStateChanged(ISensorEvents
SDL_LockSensors(); SDL_LockSensors();
for (i = 0; i < SDL_num_sensors; ++i) { for (i = 0; i < SDL_num_sensors; ++i) {
if (pSensor == SDL_sensors[i].sensor) { if (pSensor == SDL_sensors[i].sensor) {
SDL_Log("Sensor %s state changed to %d\n", SDL_sensors[i].name, state); SDL_Log("Sensor %s state changed to %d", SDL_sensors[i].name, state);
} }
} }
SDL_UnlockSensors(); SDL_UnlockSensors();
@@ -156,7 +156,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnDataUpdated(ISensorEvents *
Uint64 sensor_timestamp; Uint64 sensor_timestamp;
#ifdef DEBUG_SENSORS #ifdef DEBUG_SENSORS
SDL_Log("Sensor %s data updated\n", SDL_sensors[i].name); SDL_Log("Sensor %s data updated", SDL_sensors[i].name);
#endif #endif
if (SUCCEEDED(ISensorDataReport_GetTimestamp(pNewData, &sensor_systemtime)) && if (SUCCEEDED(ISensorDataReport_GetTimestamp(pNewData, &sensor_systemtime)) &&
SystemTimeToFileTime(&sensor_systemtime, &sensor_filetime)) { SystemTimeToFileTime(&sensor_systemtime, &sensor_filetime)) {
@@ -219,7 +219,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnEvent(ISensorEvents *This,
SDL_LockSensors(); SDL_LockSensors();
for (i = 0; i < SDL_num_sensors; ++i) { for (i = 0; i < SDL_num_sensors; ++i) {
if (pSensor == SDL_sensors[i].sensor) { if (pSensor == SDL_sensors[i].sensor) {
SDL_Log("Sensor %s event occurred\n", SDL_sensors[i].name); SDL_Log("Sensor %s event occurred", SDL_sensors[i].name);
} }
} }
SDL_UnlockSensors(); SDL_UnlockSensors();
@@ -235,7 +235,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnLeave(ISensorEvents *This,
for (i = 0; i < SDL_num_sensors; ++i) { for (i = 0; i < SDL_num_sensors; ++i) {
if (WIN_IsEqualIID(ID, &SDL_sensors[i].sensor_id)) { if (WIN_IsEqualIID(ID, &SDL_sensors[i].sensor_id)) {
#ifdef DEBUG_SENSORS #ifdef DEBUG_SENSORS
SDL_Log("Sensor %s disconnected\n", SDL_sensors[i].name); SDL_Log("Sensor %s disconnected", SDL_sensors[i].name);
#endif #endif
DisconnectSensor(SDL_sensors[i].sensor); DisconnectSensor(SDL_sensors[i].sensor);
} }
+69 -69
View File
@@ -1092,12 +1092,12 @@ static void SDLTest_PrintRenderer(SDL_Renderer *renderer)
name = SDL_GetRendererName(renderer); name = SDL_GetRendererName(renderer);
SDL_Log(" Renderer %s:\n", name); SDL_Log(" Renderer %s:", name);
if (SDL_strcmp(name, "gpu") == 0) { if (SDL_strcmp(name, "gpu") == 0) {
SDL_GPUDevice *device = SDL_GetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_GPU_DEVICE_POINTER, NULL); SDL_GPUDevice *device = SDL_GetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_GPU_DEVICE_POINTER, NULL);
SDL_Log(" Driver: %s\n", SDL_GetGPUDeviceDriver(device)); SDL_Log(" Driver: %s", SDL_GetGPUDeviceDriver(device));
} }
SDL_Log(" VSync: %d\n", (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_VSYNC_NUMBER, 0)); SDL_Log(" VSync: %d", (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_VSYNC_NUMBER, 0));
texture_formats = (const SDL_PixelFormat *)SDL_GetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER, NULL); texture_formats = (const SDL_PixelFormat *)SDL_GetPointerProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER, NULL);
if (texture_formats) { if (texture_formats) {
@@ -1108,12 +1108,12 @@ static void SDLTest_PrintRenderer(SDL_Renderer *renderer)
} }
SDLTest_PrintPixelFormat(text, sizeof(text), texture_formats[i]); SDLTest_PrintPixelFormat(text, sizeof(text), texture_formats[i]);
} }
SDL_Log("%s\n", text); SDL_Log("%s", text);
} }
max_texture_size = (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER, 0); max_texture_size = (int)SDL_GetNumberProperty(SDL_GetRendererProperties(renderer), SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER, 0);
if (max_texture_size) { if (max_texture_size) {
SDL_Log(" Max Texture Size: %dx%d\n", max_texture_size, max_texture_size); SDL_Log(" Max Texture Size: %dx%d", max_texture_size, max_texture_size);
} }
} }
@@ -1124,7 +1124,7 @@ static SDL_Surface *SDLTest_LoadIcon(const char *file)
/* Load the icon surface */ /* Load the icon surface */
icon = SDL_LoadBMP(file); icon = SDL_LoadBMP(file);
if (!icon) { if (!icon) {
SDL_Log("Couldn't load %s: %s\n", file, SDL_GetError()); SDL_Log("Couldn't load %s: %s", file, SDL_GetError());
return NULL; return NULL;
} }
@@ -1142,40 +1142,40 @@ static SDL_HitTestResult SDLCALL SDLTest_ExampleHitTestCallback(SDL_Window *win,
const int RESIZE_BORDER = 8; const int RESIZE_BORDER = 8;
const int DRAGGABLE_TITLE = 32; const int DRAGGABLE_TITLE = 32;
/*SDL_Log("Hit test point %d,%d\n", area->x, area->y);*/ /*SDL_Log("Hit test point %d,%d", area->x, area->y);*/
SDL_GetWindowSize(win, &w, &h); SDL_GetWindowSize(win, &w, &h);
if (area->x < RESIZE_BORDER) { if (area->x < RESIZE_BORDER) {
if (area->y < RESIZE_BORDER) { if (area->y < RESIZE_BORDER) {
SDL_Log("SDL_HITTEST_RESIZE_TOPLEFT\n"); SDL_Log("SDL_HITTEST_RESIZE_TOPLEFT");
return SDL_HITTEST_RESIZE_TOPLEFT; return SDL_HITTEST_RESIZE_TOPLEFT;
} else if (area->y >= (h - RESIZE_BORDER)) { } else if (area->y >= (h - RESIZE_BORDER)) {
SDL_Log("SDL_HITTEST_RESIZE_BOTTOMLEFT\n"); SDL_Log("SDL_HITTEST_RESIZE_BOTTOMLEFT");
return SDL_HITTEST_RESIZE_BOTTOMLEFT; return SDL_HITTEST_RESIZE_BOTTOMLEFT;
} else { } else {
SDL_Log("SDL_HITTEST_RESIZE_LEFT\n"); SDL_Log("SDL_HITTEST_RESIZE_LEFT");
return SDL_HITTEST_RESIZE_LEFT; return SDL_HITTEST_RESIZE_LEFT;
} }
} else if (area->x >= (w - RESIZE_BORDER)) { } else if (area->x >= (w - RESIZE_BORDER)) {
if (area->y < RESIZE_BORDER) { if (area->y < RESIZE_BORDER) {
SDL_Log("SDL_HITTEST_RESIZE_TOPRIGHT\n"); SDL_Log("SDL_HITTEST_RESIZE_TOPRIGHT");
return SDL_HITTEST_RESIZE_TOPRIGHT; return SDL_HITTEST_RESIZE_TOPRIGHT;
} else if (area->y >= (h - RESIZE_BORDER)) { } else if (area->y >= (h - RESIZE_BORDER)) {
SDL_Log("SDL_HITTEST_RESIZE_BOTTOMRIGHT\n"); SDL_Log("SDL_HITTEST_RESIZE_BOTTOMRIGHT");
return SDL_HITTEST_RESIZE_BOTTOMRIGHT; return SDL_HITTEST_RESIZE_BOTTOMRIGHT;
} else { } else {
SDL_Log("SDL_HITTEST_RESIZE_RIGHT\n"); SDL_Log("SDL_HITTEST_RESIZE_RIGHT");
return SDL_HITTEST_RESIZE_RIGHT; return SDL_HITTEST_RESIZE_RIGHT;
} }
} else if (area->y >= (h - RESIZE_BORDER)) { } else if (area->y >= (h - RESIZE_BORDER)) {
SDL_Log("SDL_HITTEST_RESIZE_BOTTOM\n"); SDL_Log("SDL_HITTEST_RESIZE_BOTTOM");
return SDL_HITTEST_RESIZE_BOTTOM; return SDL_HITTEST_RESIZE_BOTTOM;
} else if (area->y < RESIZE_BORDER) { } else if (area->y < RESIZE_BORDER) {
SDL_Log("SDL_HITTEST_RESIZE_TOP\n"); SDL_Log("SDL_HITTEST_RESIZE_TOP");
return SDL_HITTEST_RESIZE_TOP; return SDL_HITTEST_RESIZE_TOP;
} else if (area->y < DRAGGABLE_TITLE) { } else if (area->y < DRAGGABLE_TITLE) {
SDL_Log("SDL_HITTEST_DRAGGABLE\n"); SDL_Log("SDL_HITTEST_DRAGGABLE");
return SDL_HITTEST_DRAGGABLE; return SDL_HITTEST_DRAGGABLE;
} }
return SDL_HITTEST_NORMAL; return SDL_HITTEST_NORMAL;
@@ -1190,7 +1190,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
if (state->verbose & VERBOSE_VIDEO) { if (state->verbose & VERBOSE_VIDEO) {
n = SDL_GetNumVideoDrivers(); n = SDL_GetNumVideoDrivers();
if (n == 0) { if (n == 0) {
SDL_Log("No built-in video drivers\n"); SDL_Log("No built-in video drivers");
} else { } else {
(void)SDL_snprintf(text, sizeof(text), "Built-in video drivers:"); (void)SDL_snprintf(text, sizeof(text), "Built-in video drivers:");
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
@@ -1199,16 +1199,16 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
} }
SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetVideoDriver(i)); SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetVideoDriver(i));
} }
SDL_Log("%s\n", text); SDL_Log("%s", text);
} }
} }
if (!SDL_InitSubSystem(SDL_INIT_VIDEO)) { if (!SDL_InitSubSystem(SDL_INIT_VIDEO)) {
SDL_Log("Couldn't initialize video driver: %s\n", SDL_Log("Couldn't initialize video driver: %s",
SDL_GetError()); SDL_GetError());
return false; return false;
} }
if (state->verbose & VERBOSE_VIDEO) { if (state->verbose & VERBOSE_VIDEO) {
SDL_Log("Video driver: %s\n", SDL_Log("Video driver: %s",
SDL_GetCurrentVideoDriver()); SDL_GetCurrentVideoDriver());
} }
@@ -1257,10 +1257,10 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
int outputIndex = 0; int outputIndex = 0;
#endif #endif
displays = SDL_GetDisplays(&n); displays = SDL_GetDisplays(&n);
SDL_Log("Number of displays: %d\n", n); SDL_Log("Number of displays: %d", n);
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
SDL_DisplayID displayID = displays[i]; SDL_DisplayID displayID = displays[i];
SDL_Log("Display %" SDL_PRIu32 ": %s\n", displayID, SDL_GetDisplayName(displayID)); SDL_Log("Display %" SDL_PRIu32 ": %s", displayID, SDL_GetDisplayName(displayID));
SDL_zero(bounds); SDL_zero(bounds);
SDL_GetDisplayBounds(displayID, &bounds); SDL_GetDisplayBounds(displayID, &bounds);
@@ -1268,46 +1268,46 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
SDL_zero(usablebounds); SDL_zero(usablebounds);
SDL_GetDisplayUsableBounds(displayID, &usablebounds); SDL_GetDisplayUsableBounds(displayID, &usablebounds);
SDL_Log("Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y); SDL_Log("Bounds: %dx%d at %d,%d", bounds.w, bounds.h, bounds.x, bounds.y);
SDL_Log("Usable bounds: %dx%d at %d,%d\n", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y); SDL_Log("Usable bounds: %dx%d at %d,%d", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y);
mode = SDL_GetDesktopDisplayMode(displayID); mode = SDL_GetDesktopDisplayMode(displayID);
SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask, &Gmask, SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask, &Gmask,
&Bmask, &Amask); &Bmask, &Amask);
SDL_Log(" Desktop mode: %dx%d@%gx %gHz, %d bits-per-pixel (%s)\n", SDL_Log(" Desktop mode: %dx%d@%gx %gHz, %d bits-per-pixel (%s)",
mode->w, mode->h, mode->pixel_density, mode->refresh_rate, bpp, mode->w, mode->h, mode->pixel_density, mode->refresh_rate, bpp,
SDL_GetPixelFormatName(mode->format)); SDL_GetPixelFormatName(mode->format));
if (Rmask || Gmask || Bmask) { if (Rmask || Gmask || Bmask) {
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32 "\n", Rmask); SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32, Rmask);
SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32 "\n", Gmask); SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32, Gmask);
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32 "\n", Bmask); SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32, Bmask);
if (Amask) { if (Amask) {
SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32 "\n", Amask); SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32, Amask);
} }
} }
/* Print available fullscreen video modes */ /* Print available fullscreen video modes */
modes = SDL_GetFullscreenDisplayModes(displayID, &m); modes = SDL_GetFullscreenDisplayModes(displayID, &m);
if (m == 0) { if (m == 0) {
SDL_Log("No available fullscreen video modes\n"); SDL_Log("No available fullscreen video modes");
} else { } else {
SDL_Log(" Fullscreen video modes:\n"); SDL_Log(" Fullscreen video modes:");
for (j = 0; j < m; ++j) { for (j = 0; j < m; ++j) {
mode = modes[j]; mode = modes[j];
SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask, SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask,
&Gmask, &Bmask, &Amask); &Gmask, &Bmask, &Amask);
SDL_Log(" Mode %d: %dx%d@%gx %gHz, %d bits-per-pixel (%s)\n", SDL_Log(" Mode %d: %dx%d@%gx %gHz, %d bits-per-pixel (%s)",
j, mode->w, mode->h, mode->pixel_density, mode->refresh_rate, bpp, j, mode->w, mode->h, mode->pixel_density, mode->refresh_rate, bpp,
SDL_GetPixelFormatName(mode->format)); SDL_GetPixelFormatName(mode->format));
if (Rmask || Gmask || Bmask) { if (Rmask || Gmask || Bmask) {
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32 "\n", SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32,
Rmask); Rmask);
SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32 "\n", SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32,
Gmask); Gmask);
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32 "\n", SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32,
Bmask); Bmask);
if (Amask) { if (Amask) {
SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32 "\n", Amask); SDL_Log(" Alpha Mask = 0x%.8" SDL_PRIx32, Amask);
} }
} }
} }
@@ -1330,11 +1330,11 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
if (state->verbose & VERBOSE_RENDER) { if (state->verbose & VERBOSE_RENDER) {
n = SDL_GetNumRenderDrivers(); n = SDL_GetNumRenderDrivers();
if (n == 0) { if (n == 0) {
SDL_Log("No built-in render drivers\n"); SDL_Log("No built-in render drivers");
} else { } else {
SDL_Log("Built-in render drivers:\n"); SDL_Log("Built-in render drivers:");
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
SDL_Log(" %s\n", SDL_GetRenderDriver(i)); SDL_Log(" %s", SDL_GetRenderDriver(i));
} }
} }
} }
@@ -1374,7 +1374,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
(SDL_Texture **)SDL_calloc(state->num_windows, (SDL_Texture **)SDL_calloc(state->num_windows,
sizeof(*state->targets)); sizeof(*state->targets));
if (!state->windows || !state->renderers) { if (!state->windows || !state->renderers) {
SDL_Log("Out of memory!\n"); SDL_Log("Out of memory!");
return false; return false;
} }
for (i = 0; i < state->num_windows; ++i) { for (i = 0; i < state->num_windows; ++i) {
@@ -1412,7 +1412,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
state->windows[i] = SDL_CreateWindowWithProperties(props); state->windows[i] = SDL_CreateWindowWithProperties(props);
SDL_DestroyProperties(props); SDL_DestroyProperties(props);
if (!state->windows[i]) { if (!state->windows[i]) {
SDL_Log("Couldn't create window: %s\n", SDL_Log("Couldn't create window: %s",
SDL_GetError()); SDL_GetError());
return false; return false;
} }
@@ -1427,7 +1427,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
} }
SDL_GetWindowSize(state->windows[i], &w, &h); SDL_GetWindowSize(state->windows[i], &w, &h);
if (!(state->window_flags & SDL_WINDOW_RESIZABLE) && (w != r.w || h != r.h)) { if (!(state->window_flags & SDL_WINDOW_RESIZABLE) && (w != r.w || h != r.h)) {
SDL_Log("Window requested size %dx%d, got %dx%d\n", r.w, r.h, w, h); SDL_Log("Window requested size %dx%d, got %dx%d", r.w, r.h, w, h);
state->window_w = w; state->window_w = w;
state->window_h = h; state->window_h = h;
} }
@@ -1459,7 +1459,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
if (!state->skip_renderer && (state->renderdriver || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN | SDL_WINDOW_METAL)))) { if (!state->skip_renderer && (state->renderdriver || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN | SDL_WINDOW_METAL)))) {
state->renderers[i] = SDL_CreateRenderer(state->windows[i], state->renderdriver); state->renderers[i] = SDL_CreateRenderer(state->windows[i], state->renderdriver);
if (!state->renderers[i]) { if (!state->renderers[i]) {
SDL_Log("Couldn't create renderer: %s\n", SDL_Log("Couldn't create renderer: %s",
SDL_GetError()); SDL_GetError());
return false; return false;
} }
@@ -1471,14 +1471,14 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
SDL_SetRenderVSync(state->renderers[i], state->render_vsync); SDL_SetRenderVSync(state->renderers[i], state->render_vsync);
} }
if (!SDL_SetRenderLogicalPresentation(state->renderers[i], state->logical_w, state->logical_h, state->logical_presentation)) { if (!SDL_SetRenderLogicalPresentation(state->renderers[i], state->logical_w, state->logical_h, state->logical_presentation)) {
SDL_Log("Couldn't set logical presentation: %s\n", SDL_GetError()); SDL_Log("Couldn't set logical presentation: %s", SDL_GetError());
return false; return false;
} }
if (state->scale != 0.0f) { if (state->scale != 0.0f) {
SDL_SetRenderScale(state->renderers[i], state->scale, state->scale); SDL_SetRenderScale(state->renderers[i], state->scale, state->scale);
} }
if (state->verbose & VERBOSE_RENDER) { if (state->verbose & VERBOSE_RENDER) {
SDL_Log("Current renderer:\n"); SDL_Log("Current renderer:");
SDLTest_PrintRenderer(state->renderers[i]); SDLTest_PrintRenderer(state->renderers[i]);
} }
} }
@@ -1494,7 +1494,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
if (state->verbose & VERBOSE_AUDIO) { if (state->verbose & VERBOSE_AUDIO) {
n = SDL_GetNumAudioDrivers(); n = SDL_GetNumAudioDrivers();
if (n == 0) { if (n == 0) {
SDL_Log("No built-in audio drivers\n"); SDL_Log("No built-in audio drivers");
} else { } else {
(void)SDL_snprintf(text, sizeof(text), "Built-in audio drivers:"); (void)SDL_snprintf(text, sizeof(text), "Built-in audio drivers:");
for (i = 0; i < n; ++i) { for (i = 0; i < n; ++i) {
@@ -1503,23 +1503,23 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
} }
SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetAudioDriver(i)); SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetAudioDriver(i));
} }
SDL_Log("%s\n", text); SDL_Log("%s", text);
} }
} }
if (!SDL_InitSubSystem(SDL_INIT_AUDIO)) { if (!SDL_InitSubSystem(SDL_INIT_AUDIO)) {
SDL_Log("Couldn't initialize audio driver: %s\n", SDL_Log("Couldn't initialize audio driver: %s",
SDL_GetError()); SDL_GetError());
return false; return false;
} }
if (state->verbose & VERBOSE_AUDIO) { if (state->verbose & VERBOSE_AUDIO) {
SDL_Log("Audio driver: %s\n", SDL_Log("Audio driver: %s",
SDL_GetCurrentAudioDriver()); SDL_GetCurrentAudioDriver());
} }
const SDL_AudioSpec spec = { state->audio_format, state->audio_channels, state->audio_freq }; const SDL_AudioSpec spec = { state->audio_format, state->audio_channels, state->audio_freq };
state->audio_id = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec); state->audio_id = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec);
if (!state->audio_id) { if (!state->audio_id) {
SDL_Log("Couldn't open audio: %s\n", SDL_GetError()); SDL_Log("Couldn't open audio: %s", SDL_GetError());
return false; return false;
} }
} }
@@ -1676,7 +1676,7 @@ void SDLTest_PrintEvent(const SDL_Event *event)
SDL_Rect rect; SDL_Rect rect;
SDL_GetWindowSafeArea(SDL_GetWindowFromEvent(event), &rect); SDL_GetWindowSafeArea(SDL_GetWindowFromEvent(event), &rect);
SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " changed safe area to: %d,%d %dx%d\n", SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " changed safe area to: %d,%d %dx%d",
event->window.windowID, rect.x, rect.y, rect.w, rect.h); event->window.windowID, rect.x, rect.y, rect.w, rect.h);
break; break;
} }
@@ -2058,7 +2058,7 @@ static void SDLCALL SDLTest_ScreenShotClipboardCleanup(void *context)
{ {
SDLTest_ClipboardData *data = (SDLTest_ClipboardData *)context; SDLTest_ClipboardData *data = (SDLTest_ClipboardData *)context;
SDL_Log("Cleaning up screenshot image data\n"); SDL_Log("Cleaning up screenshot image data");
if (data->image) { if (data->image) {
SDL_free(data->image); SDL_free(data->image);
@@ -2071,14 +2071,14 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c
SDLTest_ClipboardData *data = (SDLTest_ClipboardData *)context; SDLTest_ClipboardData *data = (SDLTest_ClipboardData *)context;
if (SDL_strncmp(mime_type, "text", 4) == 0) { if (SDL_strncmp(mime_type, "text", 4) == 0) {
SDL_Log("Providing screenshot title to clipboard!\n"); SDL_Log("Providing screenshot title to clipboard!");
/* Return "Test screenshot" */ /* Return "Test screenshot" */
*size = 15; *size = 15;
return "Test screenshot (but this isn't part of it)"; return "Test screenshot (but this isn't part of it)";
} }
SDL_Log("Providing screenshot image to clipboard!\n"); SDL_Log("Providing screenshot image to clipboard!");
if (!data->image) { if (!data->image) {
SDL_IOStream *file; SDL_IOStream *file;
@@ -2089,7 +2089,7 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c
void *image = SDL_malloc(length); void *image = SDL_malloc(length);
if (image) { if (image) {
if (SDL_ReadIO(file, image, length) != length) { if (SDL_ReadIO(file, image, length) != length) {
SDL_Log("Couldn't read %s: %s\n", SCREENSHOT_FILE, SDL_GetError()); SDL_Log("Couldn't read %s: %s", SCREENSHOT_FILE, SDL_GetError());
SDL_free(image); SDL_free(image);
image = NULL; image = NULL;
} }
@@ -2101,7 +2101,7 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c
data->size = length; data->size = length;
} }
} else { } else {
SDL_Log("Couldn't load %s: %s\n", SCREENSHOT_FILE, SDL_GetError()); SDL_Log("Couldn't load %s: %s", SCREENSHOT_FILE, SDL_GetError());
} }
} }
@@ -2124,12 +2124,12 @@ static void SDLTest_CopyScreenShot(SDL_Renderer *renderer)
surface = SDL_RenderReadPixels(renderer, NULL); surface = SDL_RenderReadPixels(renderer, NULL);
if (!surface) { if (!surface) {
SDL_Log("Couldn't read screen: %s\n", SDL_GetError()); SDL_Log("Couldn't read screen: %s", SDL_GetError());
return; return;
} }
if (!SDL_SaveBMP(surface, SCREENSHOT_FILE)) { if (!SDL_SaveBMP(surface, SCREENSHOT_FILE)) {
SDL_Log("Couldn't save %s: %s\n", SCREENSHOT_FILE, SDL_GetError()); SDL_Log("Couldn't save %s: %s", SCREENSHOT_FILE, SDL_GetError());
SDL_DestroySurface(surface); SDL_DestroySurface(surface);
return; return;
} }
@@ -2137,11 +2137,11 @@ static void SDLTest_CopyScreenShot(SDL_Renderer *renderer)
clipboard_data = (SDLTest_ClipboardData *)SDL_calloc(1, sizeof(*clipboard_data)); clipboard_data = (SDLTest_ClipboardData *)SDL_calloc(1, sizeof(*clipboard_data));
if (!clipboard_data) { if (!clipboard_data) {
SDL_Log("Couldn't allocate clipboard data\n"); SDL_Log("Couldn't allocate clipboard data");
return; return;
} }
SDL_SetClipboardData(SDLTest_ScreenShotClipboardProvider, SDLTest_ScreenShotClipboardCleanup, clipboard_data, image_formats, SDL_arraysize(image_formats)); SDL_SetClipboardData(SDLTest_ScreenShotClipboardProvider, SDLTest_ScreenShotClipboardCleanup, clipboard_data, image_formats, SDL_arraysize(image_formats));
SDL_Log("Saved screenshot to %s and clipboard\n", SCREENSHOT_FILE); SDL_Log("Saved screenshot to %s and clipboard", SCREENSHOT_FILE);
} }
static void SDLTest_PasteScreenShot(void) static void SDLTest_PasteScreenShot(void)
@@ -2336,7 +2336,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
} else { } else {
dest = displays[(current_index + num_displays + 1) % num_displays]; dest = displays[(current_index + num_displays + 1) % num_displays];
} }
SDL_Log("Centering on display (%" SDL_PRIu32 ")\n", dest); SDL_Log("Centering on display (%" SDL_PRIu32 ")", dest);
SDL_SetWindowPosition(window, SDL_SetWindowPosition(window,
SDL_WINDOWPOS_CENTERED_DISPLAY(dest), SDL_WINDOWPOS_CENTERED_DISPLAY(dest),
SDL_WINDOWPOS_CENTERED_DISPLAY(dest)); SDL_WINDOWPOS_CENTERED_DISPLAY(dest));
@@ -2365,7 +2365,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
x += delta; x += delta;
} }
SDL_Log("Setting position to (%d, %d)\n", x, y); SDL_Log("Setting position to (%d, %d)", x, y);
SDL_SetWindowPosition(window, x, y); SDL_SetWindowPosition(window, x, y);
} }
} }
@@ -2399,7 +2399,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
if (withAlt) { if (withAlt) {
/* Alt-C copy awesome text to the primary selection! */ /* Alt-C copy awesome text to the primary selection! */
SDL_SetPrimarySelectionText("SDL rocks!\nYou know it!"); SDL_SetPrimarySelectionText("SDL rocks!\nYou know it!");
SDL_Log("Copied text to primary selection\n"); SDL_Log("Copied text to primary selection");
} else if (withControl) { } else if (withControl) {
if (withShift) { if (withShift) {
@@ -2415,7 +2415,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
} else { } else {
/* Ctrl-C copy awesome text! */ /* Ctrl-C copy awesome text! */
SDL_SetClipboardText("SDL rocks!\nYou know it!"); SDL_SetClipboardText("SDL rocks!\nYou know it!");
SDL_Log("Copied text to clipboard\n"); SDL_Log("Copied text to clipboard");
} }
break; break;
} }
@@ -2425,9 +2425,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
/* Alt-V paste awesome text from the primary selection! */ /* Alt-V paste awesome text from the primary selection! */
char *text = SDL_GetPrimarySelectionText(); char *text = SDL_GetPrimarySelectionText();
if (*text) { if (*text) {
SDL_Log("Primary selection: %s\n", text); SDL_Log("Primary selection: %s", text);
} else { } else {
SDL_Log("Primary selection is empty\n"); SDL_Log("Primary selection is empty");
} }
SDL_free(text); SDL_free(text);
@@ -2439,9 +2439,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
/* Ctrl-V paste awesome text! */ /* Ctrl-V paste awesome text! */
char *text = SDL_GetClipboardText(); char *text = SDL_GetClipboardText();
if (*text) { if (*text) {
SDL_Log("Clipboard: %s\n", text); SDL_Log("Clipboard: %s", text);
} else { } else {
SDL_Log("Clipboard is empty\n"); SDL_Log("Clipboard is empty");
} }
SDL_free(text); SDL_free(text);
} }
@@ -2498,7 +2498,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
if (window) { if (window) {
const bool shouldCapture = !(SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_CAPTURE); const bool shouldCapture = !(SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_CAPTURE);
const bool rc = SDL_CaptureMouse(shouldCapture); const bool rc = SDL_CaptureMouse(shouldCapture);
SDL_Log("%sapturing mouse %s!\n", shouldCapture ? "C" : "Unc", rc ? "succeeded" : "failed"); SDL_Log("%sapturing mouse %s!", shouldCapture ? "C" : "Unc", rc ? "succeeded" : "failed");
} }
} }
break; break;
+1 -1
View File
@@ -719,7 +719,7 @@ static void dumpconfig(SDL_VideoDevice *_this, EGLConfig config)
for (attr = 0; attr < sizeof(all_attributes) / sizeof(Attribute); attr++) { for (attr = 0; attr < sizeof(all_attributes) / sizeof(Attribute); attr++) {
EGLint value; EGLint value;
_this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, config, all_attributes[attr].attribute, &value); _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, config, all_attributes[attr].attribute, &value);
SDL_Log("\t%-32s: %10d (0x%08x)\n", all_attributes[attr].name, value, value); SDL_Log("\t%-32s: %10d (0x%08x)", all_attributes[attr].name, value, value);
} }
} }
+1 -1
View File
@@ -540,7 +540,7 @@ void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event)
#ifdef DEBUG_SCANCODES #ifdef DEBUG_SCANCODES
if (code == SDL_SCANCODE_UNKNOWN) { if (code == SDL_SCANCODE_UNKNOWN) {
SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list <https://discourse.libsdl.org/> or to Christian Walther <cwalther@gmx.ch>. Mac virtual key code is %d.\n", scancode); SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list <https://discourse.libsdl.org/> or to Christian Walther <cwalther@gmx.ch>. Mac virtual key code is %d.", scancode);
} }
#endif #endif
if (SDL_TextInputActive(SDL_GetKeyboardFocus())) { if (SDL_TextInputActive(SDL_GetKeyboardFocus())) {
+2 -2
View File
@@ -59,9 +59,9 @@ static void *KMSDRM_GetSym(const char *fnname, int *pHasModule, bool required)
#if DEBUG_DYNAMIC_KMSDRM #if DEBUG_DYNAMIC_KMSDRM
if (fn) if (fn)
SDL_Log("KMSDRM: Found '%s' in %s (%p)\n", fnname, kmsdrmlibs[i].libname, fn); SDL_Log("KMSDRM: Found '%s' in %s (%p)", fnname, kmsdrmlibs[i].libname, fn);
else else
SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!\n", fnname); SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!", fnname);
#endif #endif
if (!fn && required) { if (!fn && required) {
+5 -5
View File
@@ -661,7 +661,7 @@ static bool OPENVR_SetupFrame(SDL_VideoDevice *_this, SDL_Window *window)
{ {
int error = ov_glGetError(); int error = ov_glGetError();
if (error) if (error)
SDL_Log("Found GL Error before beginning frame: %d / (Framebuffer:%d)\n", error, ov_glCheckNamedFramebufferStatus(videodata->fbo, GL_FRAMEBUFFER)); SDL_Log("Found GL Error before beginning frame: %d / (Framebuffer:%d)", error, ov_glCheckNamedFramebufferStatus(videodata->fbo, GL_FRAMEBUFFER));
} }
#endif #endif
@@ -698,7 +698,7 @@ static bool OPENVR_ReleaseFrame(SDL_VideoDevice *_this)
{ {
int error = ov_glGetError(); int error = ov_glGetError();
if (error) { if (error) {
SDL_Log("Found GL Error before release frame: %d / (Framebuffer:%d)\n", error, ov_glCheckNamedFramebufferStatus(videodata->fbo, GL_FRAMEBUFFER)); SDL_Log("Found GL Error before release frame: %d / (Framebuffer:%d)", error, ov_glCheckNamedFramebufferStatus(videodata->fbo, GL_FRAMEBUFFER));
} }
} }
#endif #endif
@@ -895,7 +895,7 @@ static SDL_GLContext OPENVR_GL_CreateContext(SDL_VideoDevice *_this, SDL_Window
const char *ccc = (const char *)ov_glGetStringi(GL_EXTENSIONS, i); const char *ccc = (const char *)ov_glGetStringi(GL_EXTENSIONS, i);
if (SDL_strcmp(ccc, "GL_KHR_debug") == 0) { if (SDL_strcmp(ccc, "GL_KHR_debug") == 0) {
#ifdef DEBUG_OPENVR #ifdef DEBUG_OPENVR
SDL_Log("Found renderdoc debug extension.\n"); SDL_Log("Found renderdoc debug extension.");
#endif #endif
videodata->renderdoc_debugmarker_frame_end = true; videodata->renderdoc_debugmarker_frame_end = true;
} }
@@ -968,7 +968,7 @@ static bool SDL_EGL_InitInternal(SDL_VideoData * vd)
vd->eglDpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); vd->eglDpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
#ifdef DEBUG_OPENVR #ifdef DEBUG_OPENVR
SDL_Log("EGL Display: %p\n", vd->eglDpy); SDL_Log("EGL Display: %p", vd->eglDpy);
#endif #endif
if (vd->eglDpy == 0) { if (vd->eglDpy == 0) {
@@ -1040,7 +1040,7 @@ static SDL_GLContext OVR_EGL_CreateContext(SDL_VideoDevice *_this, SDL_Window *
const char * ccc = (const char*)ov_glGetStringi(GL_EXTENSIONS, i); const char * ccc = (const char*)ov_glGetStringi(GL_EXTENSIONS, i);
if (SDL_strcmp(ccc, "GL_KHR_debug") == 0) { if (SDL_strcmp(ccc, "GL_KHR_debug") == 0) {
#ifdef DEBUG_OPENVR #ifdef DEBUG_OPENVR
SDL_Log("Found renderdoc debug extension.\n"); SDL_Log("Found renderdoc debug extension.");
#endif #endif
videodata->renderdoc_debugmarker_frame_end = true; videodata->renderdoc_debugmarker_frame_end = true;
} }
+2 -2
View File
@@ -66,9 +66,9 @@ static void *WAYLAND_GetSym(const char *fnname, int *pHasModule, bool required)
#if DEBUG_DYNAMIC_WAYLAND #if DEBUG_DYNAMIC_WAYLAND
if (fn) { if (fn) {
SDL_Log("WAYLAND: Found '%s' in %s (%p)\n", fnname, dynlib->libname, fn); SDL_Log("WAYLAND: Found '%s' in %s (%p)", fnname, dynlib->libname, fn);
} else { } else {
SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!\n", fnname); SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!", fnname);
} }
#endif #endif
+1 -1
View File
@@ -1195,7 +1195,7 @@ static void libdecor_error(struct libdecor *context,
enum libdecor_error error, enum libdecor_error error,
const char *message) const char *message)
{ {
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "libdecor error (%d): %s\n", error, message); SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "libdecor error (%d): %s", error, message);
} }
static struct libdecor_interface libdecor_interface = { static struct libdecor_interface libdecor_interface = {
+5 -5
View File
@@ -157,17 +157,17 @@ static Uint64 WIN_GetEventTimestamp(void)
timestamp += timestamp_offset; timestamp += timestamp_offset;
if (!timestamp_offset) { if (!timestamp_offset) {
// Initializing timestamp offset // Initializing timestamp offset
//SDL_Log("Initializing timestamp offset\n"); //SDL_Log("Initializing timestamp offset");
timestamp_offset = (now - timestamp); timestamp_offset = (now - timestamp);
timestamp = now; timestamp = now;
} else if ((Sint64)(now - timestamp - TIMESTAMP_WRAP_OFFSET) >= 0) { } else if ((Sint64)(now - timestamp - TIMESTAMP_WRAP_OFFSET) >= 0) {
// The windows message tick wrapped // The windows message tick wrapped
//SDL_Log("Adjusting timestamp offset for wrapping tick\n"); //SDL_Log("Adjusting timestamp offset for wrapping tick");
timestamp_offset += TIMESTAMP_WRAP_OFFSET; timestamp_offset += TIMESTAMP_WRAP_OFFSET;
timestamp += TIMESTAMP_WRAP_OFFSET; timestamp += TIMESTAMP_WRAP_OFFSET;
} else if (timestamp > now) { } else if (timestamp > now) {
// We got a newer timestamp, but it can't be newer than now, so adjust our offset // We got a newer timestamp, but it can't be newer than now, so adjust our offset
//SDL_Log("Adjusting timestamp offset, %.2f ms newer\n", (double)(timestamp - now) / SDL_NS_PER_MS); //SDL_Log("Adjusting timestamp offset, %.2f ms newer", (double)(timestamp - now) / SDL_NS_PER_MS);
timestamp_offset -= (timestamp - now); timestamp_offset -= (timestamp - now);
timestamp = now; timestamp = now;
} }
@@ -2239,7 +2239,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
int w, h; int w, h;
#ifdef HIGHDPI_DEBUG #ifdef HIGHDPI_DEBUG
SDL_Log("WM_DPICHANGED: to %d\tsuggested rect: (%d, %d), (%dx%d)\n", newDPI, SDL_Log("WM_DPICHANGED: to %d\tsuggested rect: (%d, %d), (%dx%d)", newDPI,
suggestedRect->left, suggestedRect->top, suggestedRect->right - suggestedRect->left, suggestedRect->bottom - suggestedRect->top); suggestedRect->left, suggestedRect->top, suggestedRect->right - suggestedRect->left, suggestedRect->bottom - suggestedRect->top);
#endif #endif
@@ -2270,7 +2270,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
} }
#ifdef HIGHDPI_DEBUG #ifdef HIGHDPI_DEBUG
SDL_Log("WM_DPICHANGED: current SDL window size: (%dx%d)\tcalling SetWindowPos: (%d, %d), (%dx%d)\n", SDL_Log("WM_DPICHANGED: current SDL window size: (%dx%d)\tcalling SetWindowPos: (%d, %d), (%dx%d)",
data->window->w, data->window->h, data->window->w, data->window->h,
suggestedRect->left, suggestedRect->top, w, h); suggestedRect->left, suggestedRect->top, w, h);
#endif #endif
+2 -2
View File
@@ -391,7 +391,7 @@ static void DumpKeys(const char *prefix, GameInputKeyState *keys, uint32_t count
for (uint32_t i = 0; i < count; ++i) { for (uint32_t i = 0; i < count; ++i) {
char str[5]; char str[5];
*SDL_UCS4ToUTF8(keys[i].codePoint, str) = '\0'; *SDL_UCS4ToUTF8(keys[i].codePoint, str) = '\0';
SDL_Log(" Key 0x%.2x (%s)\n", keys[i].scanCode, str); SDL_Log(" Key 0x%.2x (%s)", keys[i].scanCode, str);
} }
} }
#endif // DEBUG_KEYS #endif // DEBUG_KEYS
@@ -413,7 +413,7 @@ static void GAMEINPUT_HandleKeyboardDelta(WIN_GameInputData *data, SDL_Window *w
uint32_t num_last = IGameInputReading_GetKeyState(last_reading, max_keys, last); uint32_t num_last = IGameInputReading_GetKeyState(last_reading, max_keys, last);
uint32_t num_keys = IGameInputReading_GetKeyState(reading, max_keys, keys); uint32_t num_keys = IGameInputReading_GetKeyState(reading, max_keys, keys);
#ifdef DEBUG_KEYS #ifdef DEBUG_KEYS
SDL_Log("Timestamp: %llu\n", timestamp); SDL_Log("Timestamp: %llu", timestamp);
DumpKeys("Last keys:", last, num_last); DumpKeys("Last keys:", last, num_last);
DumpKeys("New keys:", keys, num_keys); DumpKeys("New keys:", keys, num_keys);
#endif #endif
+1 -1
View File
@@ -561,7 +561,7 @@ static void WIN_AddDisplay(SDL_VideoDevice *_this, HMONITOR hMonitor, const MONI
float content_scale = WIN_GetContentScale(_this, hMonitor); float content_scale = WIN_GetContentScale(_this, hMonitor);
#ifdef DEBUG_MODES #ifdef DEBUG_MODES
SDL_Log("Display: %s\n", WIN_StringToUTF8W(info->szDevice)); SDL_Log("Display: %s", WIN_StringToUTF8W(info->szDevice));
#endif #endif
dxgi_output = WIN_GetDXGIOutput(_this, info->szDevice); dxgi_output = WIN_GetDXGIOutput(_this, info->szDevice);
+2 -2
View File
@@ -482,11 +482,11 @@ static bool WIN_VideoInit(SDL_VideoDevice *_this)
if (SUCCEEDED(hr)) { if (SUCCEEDED(hr)) {
data->oleinitialized = true; data->oleinitialized = true;
} else { } else {
SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "OleInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality\n", (unsigned int)hr); SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "OleInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality", (unsigned int)hr);
} }
#endif // !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) #endif // !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES))
} else { } else {
SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "CoInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality\n", (unsigned int)hr); SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "CoInitialize() failed: 0x%.8x, using fallback drag-n-drop functionality", (unsigned int)hr);
} }
WIN_InitDPIAwareness(_this); WIN_InitDPIAwareness(_this);
+51 -51
View File
@@ -430,7 +430,7 @@ void X11_ReconcileKeyboardState(SDL_VideoDevice *_this)
static void X11_DispatchFocusIn(SDL_VideoDevice *_this, SDL_WindowData *data) static void X11_DispatchFocusIn(SDL_VideoDevice *_this, SDL_WindowData *data)
{ {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: Dispatching FocusIn\n", data->xwindow); SDL_Log("window 0x%lx: Dispatching FocusIn", data->xwindow);
#endif #endif
SDL_SetKeyboardFocus(data->window); SDL_SetKeyboardFocus(data->window);
X11_ReconcileKeyboardState(_this); X11_ReconcileKeyboardState(_this);
@@ -447,7 +447,7 @@ static void X11_DispatchFocusIn(SDL_VideoDevice *_this, SDL_WindowData *data)
static void X11_DispatchFocusOut(SDL_VideoDevice *_this, SDL_WindowData *data) static void X11_DispatchFocusOut(SDL_VideoDevice *_this, SDL_WindowData *data)
{ {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: Dispatching FocusOut\n", data->xwindow); SDL_Log("window 0x%lx: Dispatching FocusOut", data->xwindow);
#endif #endif
/* If another window has already processed a focus in, then don't try to /* If another window has already processed a focus in, then don't try to
* remove focus here. Doing so will incorrectly remove focus from that * remove focus here. Doing so will incorrectly remove focus from that
@@ -606,7 +606,7 @@ static void X11_UpdateUserTime(SDL_WindowData *data, const unsigned long latest)
XA_CARDINAL, 32, PropModeReplace, XA_CARDINAL, 32, PropModeReplace,
(const unsigned char *)&latest, 1); (const unsigned char *)&latest, 1);
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: updating _NET_WM_USER_TIME to %lu\n", data->xwindow, latest); SDL_Log("window 0x%lx: updating _NET_WM_USER_TIME to %lu", data->xwindow, latest);
#endif #endif
data->user_time = latest; data->user_time = latest;
} }
@@ -636,7 +636,7 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
char *atom_name; char *atom_name;
atom_name = X11_XGetAtomName(display, req->target); atom_name = X11_XGetAtomName(display, req->target);
SDL_Log("window CLIPBOARD: SelectionRequest (requestor = 0x%lx, target = 0x%lx, mime_type = %s)\n", SDL_Log("window CLIPBOARD: SelectionRequest (requestor = 0x%lx, target = 0x%lx, mime_type = %s)",
req->requestor, req->target, atom_name); req->requestor, req->target, atom_name);
if (atom_name) { if (atom_name) {
X11_XFree(atom_name); X11_XFree(atom_name);
@@ -709,7 +709,7 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven
const char *propName = xsel->property ? X11_XGetAtomName(display, xsel->property) : "None"; const char *propName = xsel->property ? X11_XGetAtomName(display, xsel->property) : "None";
const char *targetName = xsel->target ? X11_XGetAtomName(display, xsel->target) : "None"; const char *targetName = xsel->target ? X11_XGetAtomName(display, xsel->target) : "None";
SDL_Log("window CLIPBOARD: SelectionNotify (requestor = 0x%lx, target = %s, property = %s)\n", SDL_Log("window CLIPBOARD: SelectionNotify (requestor = 0x%lx, target = %s, property = %s)",
xsel->requestor, targetName, propName); xsel->requestor, targetName, propName);
#endif #endif
if (xsel->target == videodata->atoms.TARGETS && xsel->property == videodata->atoms.SDL_FORMATS) { if (xsel->target == videodata->atoms.TARGETS && xsel->property == videodata->atoms.SDL_FORMATS) {
@@ -761,7 +761,7 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven
SDLX11_ClipboardData *clipboard = NULL; SDLX11_ClipboardData *clipboard = NULL;
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window CLIPBOARD: SelectionClear (requestor = 0x%lx, target = 0x%lx)\n", SDL_Log("window CLIPBOARD: SelectionClear (requestor = 0x%lx, target = 0x%lx)",
xevent->xselection.requestor, xevent->xselection.target); xevent->xselection.requestor, xevent->xselection.target);
#endif #endif
@@ -892,14 +892,14 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_
Uint64 timestamp = X11_GetEventTimestamp(xevent->xkey.time); Uint64 timestamp = X11_GetEventTimestamp(xevent->xkey.time);
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx %s (X11 keycode = 0x%X)\n", xevent->xany.window, (xevent->type == KeyPress ? "KeyPress" : "KeyRelease"), xevent->xkey.keycode); SDL_Log("window 0x%lx %s (X11 keycode = 0x%X)", xevent->xany.window, (xevent->type == KeyPress ? "KeyPress" : "KeyRelease"), xevent->xkey.keycode);
#endif #endif
#ifdef DEBUG_SCANCODES #ifdef DEBUG_SCANCODES
if (scancode == SDL_SCANCODE_UNKNOWN && keycode) { if (scancode == SDL_SCANCODE_UNKNOWN && keycode) {
int min_keycode, max_keycode; int min_keycode, max_keycode;
X11_XDisplayKeycodes(display, &min_keycode, &max_keycode); X11_XDisplayKeycodes(display, &min_keycode, &max_keycode);
keysym = X11_KeyCodeToSym(_this, keycode, xevent->xkey.state >> 13); keysym = X11_KeyCodeToSym(_this, keycode, xevent->xkey.state >> 13);
SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n", SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list <https://discourse.libsdl.org/> X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).",
keycode, keycode - min_keycode, keysym, keycode, keycode - min_keycode, keysym,
X11_XKeysymToString(keysym)); X11_XKeysymToString(keysym));
} }
@@ -912,7 +912,7 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_
// filter events catches XIM events and sends them to the correct handler // filter events catches XIM events and sends them to the correct handler
if (X11_XFilterEvent(xevent, None)) { if (X11_XFilterEvent(xevent, None)) {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("Filtered event type = %d display = %p window = 0x%lx\n", SDL_Log("Filtered event type = %d display = %p window = 0x%lx",
xevent->type, xevent->xany.display, xevent->xany.window); xevent->type, xevent->xany.display, xevent->xany.window);
#endif #endif
handled_by_ime = true; handled_by_ime = true;
@@ -967,7 +967,7 @@ void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, S
Uint64 timestamp = X11_GetEventTimestamp(time); Uint64 timestamp = X11_GetEventTimestamp(time);
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: ButtonPress (X11 button = %d)\n", windowdata->xwindow, button); SDL_Log("window 0x%lx: ButtonPress (X11 button = %d)", windowdata->xwindow, button);
#endif #endif
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
@@ -1015,7 +1015,7 @@ void X11_HandleButtonRelease(SDL_VideoDevice *_this, SDL_WindowData *windowdata,
Uint64 timestamp = X11_GetEventTimestamp(time); Uint64 timestamp = X11_GetEventTimestamp(time);
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: ButtonRelease (X11 button = %d)\n", windowdata->xwindow, button); SDL_Log("window 0x%lx: ButtonRelease (X11 button = %d)", windowdata->xwindow, button);
#endif #endif
if (!X11_IsWheelEvent(display, button, &xticks, &yticks)) { if (!X11_IsWheelEvent(display, button, &xticks, &yticks)) {
if (button > 7) { if (button > 7) {
@@ -1048,7 +1048,7 @@ void X11_GetBorderValues(SDL_WindowData *data)
X11_XFree(property); X11_XFree(property);
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("New _NET_FRAME_EXTENTS: left=%d right=%d, top=%d, bottom=%d\n", data->border_left, data->border_right, data->border_top, data->border_bottom); SDL_Log("New _NET_FRAME_EXTENTS: left=%d right=%d, top=%d, bottom=%d", data->border_left, data->border_right, data->border_top, data->border_bottom);
#endif #endif
} }
} else { } else {
@@ -1072,7 +1072,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
if (xevent->type != KeyPress && xevent->type != KeyRelease) { if (xevent->type != KeyPress && xevent->type != KeyRelease) {
if (X11_XFilterEvent(xevent, None)) { if (X11_XFilterEvent(xevent, None)) {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("Filtered event type = %d display = %p window = 0x%lx\n", SDL_Log("Filtered event type = %d display = %p window = 0x%lx",
xevent->type, xevent->xany.display, xevent->xany.window); xevent->type, xevent->xany.display, xevent->xany.window);
#endif #endif
return; return;
@@ -1100,7 +1100,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
#endif #endif
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("X11 event type = %d display = %p window = 0x%lx\n", SDL_Log("X11 event type = %d display = %p window = 0x%lx",
xevent->type, xevent->xany.display, xevent->xany.window); xevent->type, xevent->xany.display, xevent->xany.window);
#endif #endif
@@ -1110,7 +1110,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
XFixesSelectionNotifyEvent *ev = (XFixesSelectionNotifyEvent *)xevent; XFixesSelectionNotifyEvent *ev = (XFixesSelectionNotifyEvent *)xevent;
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window CLIPBOARD: XFixesSelectionNotify (selection = %s)\n", SDL_Log("window CLIPBOARD: XFixesSelectionNotify (selection = %s)",
X11_XGetAtomName(display, ev->selection)); X11_XGetAtomName(display, ev->selection));
#endif #endif
@@ -1154,7 +1154,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
// The window for KeymapNotify, etc events is 0 // The window for KeymapNotify, etc events is 0
if (xevent->type == KeymapNotify) { if (xevent->type == KeymapNotify) {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: KeymapNotify!\n", xevent->xany.window); SDL_Log("window 0x%lx: KeymapNotify!", xevent->xany.window);
#endif #endif
if (SDL_GetKeyboardFocus() != NULL) { if (SDL_GetKeyboardFocus() != NULL) {
#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBLOOKUPKEYSYM #ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBLOOKUPKEYSYM
@@ -1176,7 +1176,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
const int request = xevent->xmapping.request; const int request = xevent->xmapping.request;
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: MappingNotify!\n", xevent->xany.window); SDL_Log("window 0x%lx: MappingNotify!", xevent->xany.window);
#endif #endif
if ((request == MappingKeyboard) || (request == MappingModifier)) { if ((request == MappingKeyboard) || (request == MappingModifier)) {
X11_XRefreshKeyboardMapping(&xevent->xmapping); X11_XRefreshKeyboardMapping(&xevent->xmapping);
@@ -1221,15 +1221,15 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
{ {
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: EnterNotify! (%d,%d,%d)\n", xevent->xany.window, SDL_Log("window 0x%lx: EnterNotify! (%d,%d,%d)", xevent->xany.window,
xevent->xcrossing.x, xevent->xcrossing.x,
xevent->xcrossing.y, xevent->xcrossing.y,
xevent->xcrossing.mode); xevent->xcrossing.mode);
if (xevent->xcrossing.mode == NotifyGrab) { if (xevent->xcrossing.mode == NotifyGrab) {
SDL_Log("Mode: NotifyGrab\n"); SDL_Log("Mode: NotifyGrab");
} }
if (xevent->xcrossing.mode == NotifyUngrab) { if (xevent->xcrossing.mode == NotifyUngrab) {
SDL_Log("Mode: NotifyUngrab\n"); SDL_Log("Mode: NotifyUngrab");
} }
#endif #endif
SDL_SetMouseFocus(data->window); SDL_SetMouseFocus(data->window);
@@ -1260,15 +1260,15 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
case LeaveNotify: case LeaveNotify:
{ {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: LeaveNotify! (%d,%d,%d)\n", xevent->xany.window, SDL_Log("window 0x%lx: LeaveNotify! (%d,%d,%d)", xevent->xany.window,
xevent->xcrossing.x, xevent->xcrossing.x,
xevent->xcrossing.y, xevent->xcrossing.y,
xevent->xcrossing.mode); xevent->xcrossing.mode);
if (xevent->xcrossing.mode == NotifyGrab) { if (xevent->xcrossing.mode == NotifyGrab) {
SDL_Log("Mode: NotifyGrab\n"); SDL_Log("Mode: NotifyGrab");
} }
if (xevent->xcrossing.mode == NotifyUngrab) { if (xevent->xcrossing.mode == NotifyUngrab) {
SDL_Log("Mode: NotifyUngrab\n"); SDL_Log("Mode: NotifyUngrab");
} }
#endif #endif
if (!SDL_GetMouse()->relative_mode) { if (!SDL_GetMouse()->relative_mode) {
@@ -1295,19 +1295,19 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
if (xevent->xfocus.mode == NotifyGrab || xevent->xfocus.mode == NotifyUngrab) { if (xevent->xfocus.mode == NotifyGrab || xevent->xfocus.mode == NotifyUngrab) {
// Someone is handling a global hotkey, ignore it // Someone is handling a global hotkey, ignore it
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: FocusIn (NotifyGrab/NotifyUngrab, ignoring)\n", xevent->xany.window); SDL_Log("window 0x%lx: FocusIn (NotifyGrab/NotifyUngrab, ignoring)", xevent->xany.window);
#endif #endif
break; break;
} }
if (xevent->xfocus.detail == NotifyInferior || xevent->xfocus.detail == NotifyPointer) { if (xevent->xfocus.detail == NotifyInferior || xevent->xfocus.detail == NotifyPointer) {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: FocusIn (NotifyInferior/NotifyPointer, ignoring)\n", xevent->xany.window); SDL_Log("window 0x%lx: FocusIn (NotifyInferior/NotifyPointer, ignoring)", xevent->xany.window);
#endif #endif
break; break;
} }
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: FocusIn!\n", xevent->xany.window); SDL_Log("window 0x%lx: FocusIn!", xevent->xany.window);
#endif #endif
if (!videodata->last_mode_change_deadline) /* no recent mode changes */ { if (!videodata->last_mode_change_deadline) /* no recent mode changes */ {
data->pending_focus = PENDING_FOCUS_NONE; data->pending_focus = PENDING_FOCUS_NONE;
@@ -1326,7 +1326,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
if (xevent->xfocus.mode == NotifyGrab || xevent->xfocus.mode == NotifyUngrab) { if (xevent->xfocus.mode == NotifyGrab || xevent->xfocus.mode == NotifyUngrab) {
// Someone is handling a global hotkey, ignore it // Someone is handling a global hotkey, ignore it
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: FocusOut (NotifyGrab/NotifyUngrab, ignoring)\n", xevent->xany.window); SDL_Log("window 0x%lx: FocusOut (NotifyGrab/NotifyUngrab, ignoring)", xevent->xany.window);
#endif #endif
break; break;
} }
@@ -1335,12 +1335,12 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
care about the position of the pointer when the keyboard care about the position of the pointer when the keyboard
focus changed. */ focus changed. */
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: FocusOut (NotifyInferior/NotifyPointer, ignoring)\n", xevent->xany.window); SDL_Log("window 0x%lx: FocusOut (NotifyInferior/NotifyPointer, ignoring)", xevent->xany.window);
#endif #endif
break; break;
} }
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: FocusOut!\n", xevent->xany.window); SDL_Log("window 0x%lx: FocusOut!", xevent->xany.window);
#endif #endif
if (!videodata->last_mode_change_deadline) /* no recent mode changes */ { if (!videodata->last_mode_change_deadline) /* no recent mode changes */ {
data->pending_focus = PENDING_FOCUS_NONE; data->pending_focus = PENDING_FOCUS_NONE;
@@ -1366,7 +1366,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
XEvent ev; XEvent ev;
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: UnmapNotify!\n", xevent->xany.window); SDL_Log("window 0x%lx: UnmapNotify!", xevent->xany.window);
#endif #endif
if (X11_XCheckIfEvent(display, &ev, &isReparentNotify, (XPointer)&xevent->xunmap)) { if (X11_XCheckIfEvent(display, &ev, &isReparentNotify, (XPointer)&xevent->xunmap)) {
@@ -1387,7 +1387,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
case MapNotify: case MapNotify:
{ {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: MapNotify!\n", xevent->xany.window); SDL_Log("window 0x%lx: MapNotify!", xevent->xany.window);
#endif #endif
X11_DispatchMapNotify(data); X11_DispatchMapNotify(data);
@@ -1403,7 +1403,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
case ConfigureNotify: case ConfigureNotify:
{ {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: ConfigureNotify! (position: %d,%d, size: %dx%d)\n", xevent->xany.window, SDL_Log("window 0x%lx: ConfigureNotify! (position: %d,%d, size: %dx%d)", xevent->xany.window,
xevent->xconfigure.x, xevent->xconfigure.y, xevent->xconfigure.x, xevent->xconfigure.y,
xevent->xconfigure.width, xevent->xconfigure.height); xevent->xconfigure.width, xevent->xconfigure.height);
#endif #endif
@@ -1470,9 +1470,9 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
data->xdnd_source = xevent->xclient.data.l[0]; data->xdnd_source = xevent->xclient.data.l[0];
xdnd_version = (xevent->xclient.data.l[1] >> 24); xdnd_version = (xevent->xclient.data.l[1] >> 24);
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("XID of source window : 0x%lx\n", data->xdnd_source); SDL_Log("XID of source window : 0x%lx", data->xdnd_source);
SDL_Log("Protocol version to use : %d\n", xdnd_version); SDL_Log("Protocol version to use : %d", xdnd_version);
SDL_Log("More then 3 data types : %d\n", (int)use_list); SDL_Log("More then 3 data types : %d", (int)use_list);
#endif #endif
if (use_list) { if (use_list) {
@@ -1488,7 +1488,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
} }
} else if (xevent->xclient.message_type == videodata->atoms.XdndLeave) { } else if (xevent->xclient.message_type == videodata->atoms.XdndLeave) {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("XID of source window : 0x%lx\n", xevent->xclient.data.l[0]); SDL_Log("XID of source window : 0x%lx", xevent->xclient.data.l[0]);
#endif #endif
SDL_SendDropComplete(data->window); SDL_SendDropComplete(data->window);
} else if (xevent->xclient.message_type == videodata->atoms.XdndPosition) { } else if (xevent->xclient.message_type == videodata->atoms.XdndPosition) {
@@ -1498,7 +1498,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
if (xdnd_version >= 2) { if (xdnd_version >= 2) {
act = xevent->xclient.data.l[4]; act = xevent->xclient.data.l[4];
} }
SDL_Log("Action requested by user is : %s\n", X11_XGetAtomName(display, act)); SDL_Log("Action requested by user is : %s", X11_XGetAtomName(display, act));
#endif #endif
{ {
// Drag and Drop position // Drag and Drop position
@@ -1555,7 +1555,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
Window root = DefaultRootWindow(display); Window root = DefaultRootWindow(display);
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: _NET_WM_PING\n", xevent->xany.window); SDL_Log("window 0x%lx: _NET_WM_PING", xevent->xany.window);
#endif #endif
xevent->xclient.window = root; xevent->xclient.window = root;
X11_XSendEvent(display, root, False, SubstructureRedirectMask | SubstructureNotifyMask, xevent); X11_XSendEvent(display, root, False, SubstructureRedirectMask | SubstructureNotifyMask, xevent);
@@ -1567,7 +1567,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
(xevent->xclient.data.l[0] == videodata->atoms.WM_DELETE_WINDOW)) { (xevent->xclient.data.l[0] == videodata->atoms.WM_DELETE_WINDOW)) {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: WM_DELETE_WINDOW\n", xevent->xany.window); SDL_Log("window 0x%lx: WM_DELETE_WINDOW", xevent->xany.window);
#endif #endif
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0); SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
break; break;
@@ -1589,7 +1589,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
case Expose: case Expose:
{ {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: Expose (count = %d)\n", xevent->xany.window, xevent->xexpose.count); SDL_Log("window 0x%lx: Expose (count = %d)", xevent->xany.window, xevent->xexpose.count);
#endif #endif
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_EXPOSED, 0, 0); SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
} break; } break;
@@ -1622,7 +1622,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
SDL_Mouse *mouse = SDL_GetMouse(); SDL_Mouse *mouse = SDL_GetMouse();
if (!mouse->relative_mode) { if (!mouse->relative_mode) {
#ifdef DEBUG_MOTION #ifdef DEBUG_MOTION
SDL_Log("window 0x%lx: X11 motion: %d,%d\n", xevent->xany.window, xevent->xmotion.x, xevent->xmotion.y); SDL_Log("window 0x%lx: X11 motion: %d,%d", xevent->xany.window, xevent->xmotion.x, xevent->xmotion.y);
#endif #endif
X11_ProcessHitTest(_this, data, (float)xevent->xmotion.x, (float)xevent->xmotion.y, false); X11_ProcessHitTest(_this, data, (float)xevent->xmotion.x, (float)xevent->xmotion.y, false);
@@ -1661,7 +1661,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
char *name = X11_XGetAtomName(display, xevent->xproperty.atom); char *name = X11_XGetAtomName(display, xevent->xproperty.atom);
if (name) { if (name) {
SDL_Log("window 0x%lx: PropertyNotify: %s %s time=%lu\n", xevent->xany.window, name, (xevent->xproperty.state == PropertyDelete) ? "deleted" : "changed", xevent->xproperty.time); SDL_Log("window 0x%lx: PropertyNotify: %s %s time=%lu", xevent->xany.window, name, (xevent->xproperty.state == PropertyDelete) ? "deleted" : "changed", xevent->xproperty.time);
X11_XFree(name); X11_XFree(name);
} }
@@ -1674,7 +1674,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
for (i = 0; i < items_read; i++) { for (i = 0; i < items_read; i++) {
SDL_Log(" %d", values[i]); SDL_Log(" %d", values[i]);
} }
SDL_Log(" }\n"); SDL_Log(" }");
} else if (real_type == XA_CARDINAL) { } else if (real_type == XA_CARDINAL) {
if (real_format == 32) { if (real_format == 32) {
Uint32 *values = (Uint32 *)propdata; Uint32 *values = (Uint32 *)propdata;
@@ -1683,7 +1683,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
for (i = 0; i < items_read; i++) { for (i = 0; i < items_read; i++) {
SDL_Log(" %d", values[i]); SDL_Log(" %d", values[i]);
} }
SDL_Log(" }\n"); SDL_Log(" }");
} else if (real_format == 16) { } else if (real_format == 16) {
Uint16 *values = (Uint16 *)propdata; Uint16 *values = (Uint16 *)propdata;
@@ -1691,7 +1691,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
for (i = 0; i < items_read; i++) { for (i = 0; i < items_read; i++) {
SDL_Log(" %d", values[i]); SDL_Log(" %d", values[i]);
} }
SDL_Log(" }\n"); SDL_Log(" }");
} else if (real_format == 8) { } else if (real_format == 8) {
Uint8 *values = (Uint8 *)propdata; Uint8 *values = (Uint8 *)propdata;
@@ -1699,11 +1699,11 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
for (i = 0; i < items_read; i++) { for (i = 0; i < items_read; i++) {
SDL_Log(" %d", values[i]); SDL_Log(" %d", values[i]);
} }
SDL_Log(" }\n"); SDL_Log(" }");
} }
} else if (real_type == XA_STRING || } else if (real_type == XA_STRING ||
real_type == videodata->atoms.UTF8_STRING) { real_type == videodata->atoms.UTF8_STRING) {
SDL_Log("{ \"%s\" }\n", propdata); SDL_Log("{ \"%s\" }", propdata);
} else if (real_type == XA_ATOM) { } else if (real_type == XA_ATOM) {
Atom *atoms = (Atom *)propdata; Atom *atoms = (Atom *)propdata;
@@ -1715,10 +1715,10 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
X11_XFree(atomname); X11_XFree(atomname);
} }
} }
SDL_Log(" }\n"); SDL_Log(" }");
} else { } else {
char *atomname = X11_XGetAtomName(display, real_type); char *atomname = X11_XGetAtomName(display, real_type);
SDL_Log("Unknown type: 0x%lx (%s)\n", real_type, atomname ? atomname : "UNKNOWN"); SDL_Log("Unknown type: 0x%lx (%s)", real_type, atomname ? atomname : "UNKNOWN");
if (atomname) { if (atomname) {
X11_XFree(atomname); X11_XFree(atomname);
} }
@@ -1918,7 +1918,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
{ {
Atom target = xevent->xselection.target; Atom target = xevent->xselection.target;
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: SelectionNotify (requestor = 0x%lx, target = 0x%lx)\n", xevent->xany.window, SDL_Log("window 0x%lx: SelectionNotify (requestor = 0x%lx, target = 0x%lx)", xevent->xany.window,
xevent->xselection.requestor, xevent->xselection.target); xevent->xselection.requestor, xevent->xselection.target);
#endif #endif
if (target == data->xdnd_req) { if (target == data->xdnd_req) {
@@ -1969,7 +1969,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
default: default:
{ {
#ifdef DEBUG_XEVENTS #ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: Unhandled event %d\n", xevent->xany.window, xevent->type); SDL_Log("window 0x%lx: Unhandled event %d", xevent->xany.window, xevent->type);
#endif #endif
} break; } break;
} }
+8 -8
View File
@@ -239,7 +239,7 @@ bool X11_InitKeyboard(SDL_VideoDevice *_this)
const SDL_Scancode *table = SDL_GetScancodeTable(scancode_set[best_index], &table_size); const SDL_Scancode *table = SDL_GetScancodeTable(scancode_set[best_index], &table_size);
#ifdef DEBUG_KEYBOARD #ifdef DEBUG_KEYBOARD
SDL_Log("Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d\n", best_index, min_keycode, max_keycode, table_size); SDL_Log("Using scancode set %d, min_keycode = %d, max_keycode = %d, table_size = %d", best_index, min_keycode, max_keycode, table_size);
#endif #endif
// This should never happen, but just in case... // This should never happen, but just in case...
if (table_size > (SDL_arraysize(data->key_layout) - min_keycode)) { if (table_size > (SDL_arraysize(data->key_layout) - min_keycode)) {
@@ -267,14 +267,14 @@ bool X11_InitKeyboard(SDL_VideoDevice *_this)
if ((SDL_GetKeymapKeycode(NULL, scancode, SDL_KMOD_NONE) & (SDLK_SCANCODE_MASK | SDLK_EXTENDED_MASK)) && X11_ScancodeIsRemappable(scancode)) { if ((SDL_GetKeymapKeycode(NULL, scancode, SDL_KMOD_NONE) & (SDLK_SCANCODE_MASK | SDLK_EXTENDED_MASK)) && X11_ScancodeIsRemappable(scancode)) {
// Not a character key and the scancode is safe to remap // Not a character key and the scancode is safe to remap
#ifdef DEBUG_KEYBOARD #ifdef DEBUG_KEYBOARD
SDL_Log("Changing scancode, was %d (%s), now %d (%s)\n", data->key_layout[i], SDL_GetScancodeName(data->key_layout[i]), scancode, SDL_GetScancodeName(scancode)); SDL_Log("Changing scancode, was %d (%s), now %d (%s)", data->key_layout[i], SDL_GetScancodeName(data->key_layout[i]), scancode, SDL_GetScancodeName(scancode));
#endif #endif
data->key_layout[i] = scancode; data->key_layout[i] = scancode;
} }
} }
} else { } else {
#ifdef DEBUG_SCANCODES #ifdef DEBUG_SCANCODES
SDL_Log("Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/):\n"); SDL_Log("Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/):");
#endif #endif
// Determine key_layout - only works on US QWERTY layout // Determine key_layout - only works on US QWERTY layout
@@ -288,9 +288,9 @@ bool X11_InitKeyboard(SDL_VideoDevice *_this)
(unsigned int)sym, sym == NoSymbol ? "NoSymbol" : X11_XKeysymToString(sym)); (unsigned int)sym, sym == NoSymbol ? "NoSymbol" : X11_XKeysymToString(sym));
} }
if (scancode == SDL_SCANCODE_UNKNOWN) { if (scancode == SDL_SCANCODE_UNKNOWN) {
SDL_Log("scancode not found\n"); SDL_Log("scancode not found");
} else { } else {
SDL_Log("scancode = %d (%s)\n", scancode, SDL_GetScancodeName(scancode)); SDL_Log("scancode = %d (%s)", scancode, SDL_GetScancodeName(scancode));
} }
#endif #endif
data->key_layout[i] = scancode; data->key_layout[i] = scancode;
@@ -592,12 +592,12 @@ static void preedit_draw_callback(XIC xic, XPointer client_data, XIMPreeditDrawC
#ifdef DEBUG_XIM #ifdef DEBUG_XIM
if (call_data->chg_length > 0) { if (call_data->chg_length > 0) {
SDL_Log("Draw callback deleted %d characters at %d\n", call_data->chg_length, call_data->chg_first); SDL_Log("Draw callback deleted %d characters at %d", call_data->chg_length, call_data->chg_first);
} }
if (text) { if (text) {
SDL_Log("Draw callback inserted %s at %d, caret: %d\n", text->string.multi_byte, call_data->chg_first, call_data->caret); SDL_Log("Draw callback inserted %s at %d, caret: %d", text->string.multi_byte, call_data->chg_first, call_data->caret);
} }
SDL_Log("Pre-edit text: %s\n", data->preedit_text); SDL_Log("Pre-edit text: %s", data->preedit_text);
#endif #endif
X11_SendEditingEvent(data); X11_SendEditingEvent(data);

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