Remove newlines from log messages

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

View File

@@ -766,25 +766,25 @@ static void SDLCALL SDL_DumpPropertiesCallback(void *userdata, SDL_PropertiesID
{
switch (SDL_GetPropertyType(props, name)) {
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;
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;
case SDL_PROPERTY_TYPE_NUMBER:
{
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;
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;
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;
default:
SDL_Log("%s UNKNOWN TYPE\n", name);
SDL_Log("%s UNKNOWN TYPE", name);
break;
}
}

View File

@@ -240,7 +240,7 @@ void SDL_SetObjectsInvalid(void)
type = "unknown object";
break;
}
SDL_Log("Leaked %s (%p)\n", type, object);
SDL_Log("Leaked %s (%p)", type, object);
}
SDL_assert(SDL_HashTableEmpty(SDL_objects));

View File

@@ -28,7 +28,7 @@
#define DEBUG_AUDIO_CONVERT 0
#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
#define LOG_DEBUG_AUDIO_CONVERT(from, to)
#endif

View File

@@ -315,10 +315,10 @@ static bool BuildAAudioStream(SDL_AudioDevice *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
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);
} 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",

View File

@@ -31,7 +31,7 @@
#if DEBUG_COREAUDIO
#define CHECK_RESULT(msg) \
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); \
}
#else
@@ -224,7 +224,7 @@ static void RefreshPhysicalDevices(void)
name[len] = '\0';
#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
SDLCoreAudioHandle *newhandle = (SDLCoreAudioHandle *) SDL_calloc(1, sizeof (*newhandle));
if (newhandle) {
@@ -834,7 +834,7 @@ static bool PrepareAudioQueue(SDL_AudioDevice *device)
}
#if DEBUG_COREAUDIO
SDL_Log("COREAUDIO: numAudioBuffers == %d\n", numAudioBuffers);
SDL_Log("COREAUDIO: numAudioBuffers == %d", numAudioBuffers);
#endif
for (int i = 0; i < numAudioBuffers; i++) {

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, " %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. :-)
}

View File

@@ -847,7 +847,7 @@ void SDL_StopEventLoop(void)
SDL_EventQ.active = false;
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);
}

View File

@@ -220,7 +220,7 @@ void SDL_ResetKeyboard(void)
int scancode;
#ifdef DEBUG_KEYBOARD
SDL_Log("Resetting keyboard\n");
SDL_Log("Resetting keyboard");
#endif
for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_SCANCODE_COUNT; ++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;
#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
// Figure out what type of event this is

View File

@@ -605,7 +605,7 @@ static bool SDL_UpdateMouseFocus(SDL_Window *window, float x, float y, Uint32 bu
if (!inWindow) {
if (window == mouse->focus) {
#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
if (send_mouse_motion) {
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) {
#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
SDL_SetMouseFocus(window);
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
#ifdef DEBUG_MOUSE
SDL_Log("Mouse event didn't change state - dropped!\n");
SDL_Log("Mouse event didn't change state - dropped!");
#endif
return;
}

View File

@@ -92,7 +92,7 @@ char *SDL_SYS_GetPrefPath(const char *org, const char *app)
static bool shown = false;
if (!shown) {
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.");
}
}

View File

@@ -1028,7 +1028,7 @@ extern "C"
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 )
{

View File

@@ -329,7 +329,7 @@ void Android_AddJoystick(int device_id, const char *name, const char *desc, int
}
#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
if (nhats > 0) {

View File

@@ -566,7 +566,7 @@ static bool HIDAPI_DriverPS3_UpdateDevice(SDL_HIDAPI_Device *device)
break;
default:
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS3 packet: 0x%.2x\n", data[0]);
SDL_Log("Unknown PS3 packet: 0x%.2x", data[0]);
#endif
break;
}
@@ -1004,7 +1004,7 @@ static bool HIDAPI_DriverPS3ThirdParty_UpdateDevice(SDL_HIDAPI_Device *device)
HIDAPI_DriverPS3ThirdParty_HandleStatePacket18(joystick, ctx, data, size);
} else {
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS3 packet, size %d\n", size);
SDL_Log("Unknown PS3 packet, size %d", size);
#endif
}
}
@@ -1357,7 +1357,7 @@ static bool HIDAPI_DriverPS3SonySixaxis_UpdateDevice(SDL_HIDAPI_Device *device)
break;
default:
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS3 packet: 0x%.2x\n", data[0]);
SDL_Log("Unknown PS3 packet: 0x%.2x", data[0]);
#endif
break;
}

View File

@@ -323,7 +323,7 @@ static bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
if (size > 0) {
HIDAPI_DumpPacket("PS4 first packet: size = %d", data, size);
} else {
SDL_Log("PS4 first packet: size = %d\n", size);
SDL_Log("PS4 first packet: size = %d", size);
}
#endif
if (size > 0 &&
@@ -468,7 +468,7 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi
if (!ctx->official_controller) {
#ifdef DEBUG_PS4_CALIBRATION
SDL_Log("Not an official controller, ignoring calibration\n");
SDL_Log("Not an official controller, ignoring calibration");
#endif
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));
if (size < 35) {
#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
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));
if (size < 35) {
#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
return false;
}
@@ -590,19 +590,19 @@ static bool HIDAPI_DriverPS4_LoadOfficialCalibrationData(SDL_HIDAPI_Device *devi
ctx->hardware_calibration = true;
for (i = 0; i < 6; ++i) {
#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
// Some controllers have a bad calibration
if (SDL_abs(ctx->calibration[i].bias) > 1024 || SDL_fabsf(1.0f - ctx->calibration[i].scale) > 0.5f) {
#ifdef DEBUG_PS4_CALIBRATION
SDL_Log("invalid calibration, ignoring\n");
SDL_Log("invalid calibration, ignoring");
#endif
ctx->hardware_calibration = false;
}
}
} else {
#ifdef DEBUG_PS4_CALIBRATION
SDL_Log("Calibration data not available\n");
SDL_Log("Calibration data not available");
#endif
}
return ctx->hardware_calibration;
@@ -1291,7 +1291,7 @@ static bool HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device)
break;
default:
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS4 packet: 0x%.2x\n", data[0]);
SDL_Log("Unknown PS4 packet: 0x%.2x", data[0]);
#endif
break;
}

View File

@@ -402,7 +402,7 @@ static bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device)
if (size > 0) {
HIDAPI_DumpPacket("PS5 first packet: size = %d", data, size);
} else {
SDL_Log("PS5 first packet: size = %d\n", size);
SDL_Log("PS5 first packet: size = %d", size);
}
#endif
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));
if (size < 35) {
#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
return;
}
@@ -631,12 +631,12 @@ static void HIDAPI_DriverPS5_LoadCalibrationData(SDL_HIDAPI_Device *device)
for (i = 0; i < 6; ++i) {
float divisor = (i < 3 ? 64.0f : 1.0f);
#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
// 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)) {
#ifdef DEBUG_PS5_CALIBRATION
SDL_Log("invalid calibration, ignoring\n");
SDL_Log("invalid calibration, ignoring");
#endif
ctx->hardware_calibration = false;
}
@@ -1531,7 +1531,7 @@ static bool HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device)
break;
default:
#ifdef DEBUG_JOYSTICK
SDL_Log("Unknown PS5 packet: 0x%.2x\n", data[0]);
SDL_Log("Unknown PS5 packet: 0x%.2x", data[0]);
#endif
break;
}

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_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[1] = -1 * LOAD16(data[20], data[21]) * accelScale;
imu_data[0] = LOAD16(data[22], data[23]) * accelScale;

View File

@@ -521,11 +521,11 @@ static bool WriteProprietary(SDL_DriverSwitch_Context *ctx, ESwitchProprietaryCo
}
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;
}
}
// 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;
}
@@ -579,7 +579,7 @@ static void EncodeRumble(SwitchRumbleData_t *pRumble, Uint16 usHighFreq, Uint8 u
pRumble->rgucData[3] = usLowFreqAmp & 0xFF;
#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,
ucHighFreqAmp, ((usLowFreqAmp >> 8) & 0x80), usLowFreqAmp & 0xFF);
#endif
@@ -1647,7 +1647,7 @@ static bool HIDAPI_DriverSwitch_SendPendingRumble(SDL_DriverSwitch_Context *ctx)
Uint16 high_frequency_rumble = (Uint16)ctx->m_unRumblePending;
#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
ctx->m_bRumblePending = false;
ctx->m_unRumblePending = 0;
@@ -1659,7 +1659,7 @@ static bool HIDAPI_DriverSwitch_SendPendingRumble(SDL_DriverSwitch_Context *ctx)
ctx->m_bRumbleZeroPending = false;
#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
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
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
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 &&
now >= (ctx->m_ulRumbleSent + RUMBLE_REFRESH_FREQUENCY_MS)) {
#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
WriteRumble(ctx);
}

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
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
* 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 ((extension & WII_EXTENSION_MOTIONPLUS_MASK) == WII_EXTENSION_MOTIONPLUS_ID) {
// 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) {
// Reinitialize to get new sensor availability
@@ -1420,7 +1420,7 @@ static void HandleResponse(SDL_DriverWii_Context *ctx, SDL_Joystick *joystick)
} else {
// 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) {
// 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
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);
}

View File

@@ -306,7 +306,7 @@ static bool HIDAPI_DriverXbox360W_UpdateDevice(SDL_HIDAPI_Device *device)
if (size == 2 && data[0] == 0x08) {
bool connected = (data[1] & 0x80) ? true : false;
#ifdef DEBUG_JOYSTICK
SDL_Log("Connected = %s\n", connected ? "TRUE" : "FALSE");
SDL_Log("Connected = %s", connected ? "TRUE" : "FALSE");
#endif
if (connected != ctx->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) {
// Serial number is data[7-13]
#ifdef DEBUG_JOYSTICK
SDL_Log("Battery status (initial): %d\n", data[17]);
SDL_Log("Battery status (initial): %d", data[17]);
#endif
if (joystick) {
UpdatePowerLevel(joystick, data[17]);
}
} else if (size == 29 && data[0] == 0x00 && data[1] == 0x00 && data[2] == 0x00 && data[3] == 0x13) {
#ifdef DEBUG_JOYSTICK
SDL_Log("Battery status: %d\n", data[4]);
SDL_Log("Battery status: %d", data[4]);
#endif
if (joystick) {
UpdatePowerLevel(joystick, data[4]);

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)
{
#ifdef DEBUG_JOYSTICK
SDL_Log("Setting init state %d\n", state);
SDL_Log("Setting init state %d", state);
#endif
ctx->init_state = state;
}
@@ -391,7 +391,7 @@ static bool HIDAPI_DriverXboxOne_InitDevice(SDL_HIDAPI_Device *device)
}
#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
device->type = SDL_GAMEPAD_TYPE_XBOXONE;
@@ -620,7 +620,7 @@ static void HIDAPI_DriverXboxOne_HandleUnmappedStatePacket(SDL_Joystick *joystic
return;
}
#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] & button2_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 };
#ifdef DEBUG_JOYSTICK
SDL_Log("Enabling paddles on XBox Elite 2\n");
SDL_Log("Enabling paddles on XBox Elite 2");
#endif
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);
}
#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] & button2_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
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] & button2_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);
} else {
#ifdef DEBUG_XBOX_PROTOCOL
SDL_Log("Unknown Bluetooth state packet format\n");
SDL_Log("Unknown Bluetooth state packet format");
#endif
return;
}
@@ -1104,7 +1104,7 @@ static void HIDAPI_DriverXboxOne_HandleSerialIDPacket(SDL_DriverXboxOne_Context
serial[i * 2] = '\0';
#ifdef DEBUG_JOYSTICK
SDL_Log("Setting serial number to %s\n", serial);
SDL_Log("Setting serial number to %s", serial);
#endif
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)) {
// We haven't heard anything, let's move on
#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
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:
if (SDL_GetTicks() >= (ctx->send_time + CONTROLLER_PREPARE_INPUT_TIMEOUT_MS)) {
#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
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
*/
#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
SetInitState(ctx, XBOX_ONE_INIT_STATE_ANNOUNCED);
break;
@@ -1407,7 +1407,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
break;
case GIP_CMD_IDENTIFY:
#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
#ifdef DEBUG_XBOX_PROTOCOL
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;
default:
#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
break;
}
@@ -1452,7 +1452,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
// Ignore the first input, it may be spurious
#ifdef DEBUG_JOYSTICK
SDL_Log("Controller ignoring spurious input\n");
SDL_Log("Controller ignoring spurious input");
#endif
break;
}
@@ -1469,7 +1469,7 @@ static bool HIDAPI_GIP_DispatchPacket(SDL_Joystick *joystick, SDL_DriverXboxOne_
break;
default:
#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
break;
}
@@ -1596,7 +1596,7 @@ static bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
HIDAPI_DriverXboxOneBluetooth_HandleStatePacket(joystick, ctx, data, size);
} else {
#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
}
break;
@@ -1614,7 +1614,7 @@ static bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device)
break;
default:
#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
break;
}

View File

@@ -955,7 +955,7 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf
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->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_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->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();
#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
return result;
}
@@ -1280,7 +1280,7 @@ bool HIDAPI_IsDevicePresent(Uint16 vendor_id, Uint16 product_id, Uint16 version,
SDL_UnlockJoysticks();
#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
return result;
}

View File

@@ -327,7 +327,7 @@ static bool IsJoystick(const char *path, int *fd, char **name_return, Uint16 *ve
FixupDeviceInfoForMapping(*fd, &inpid);
#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
if (SDL_ShouldIgnoreJoystick(inpid.vendor, inpid.product, inpid.version, name)) {
@@ -470,12 +470,12 @@ static void MaybeAddDevice(const char *path)
}
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Checking %s\n", path);
SDL_Log("Checking %s", path);
#endif
if (IsJoystick(path, &fd, &name, &vendor, &product, &guid)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("found joystick: %s\n", path);
SDL_Log("found joystick: %s", path);
#endif
item = (SDL_joylist_item *)SDL_calloc(1, sizeof(SDL_joylist_item));
if (!item) {
@@ -516,7 +516,7 @@ static void MaybeAddDevice(const char *path)
if (IsSensor(path, &fd)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("found sensor: %s\n", path);
SDL_Log("found sensor: %s", path);
#endif
item_sensor = (SDL_sensorlist_item *)SDL_calloc(1, sizeof(SDL_sensorlist_item));
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) {
if (test_bit(i, keybit)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", i);
SDL_Log("Joystick has button: 0x%x", i);
#endif
joystick->hwdata->key_map[i] = joystick->nbuttons;
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) {
if (test_bit(i, keybit)) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", i);
SDL_Log("Joystick has button: 0x%x", i);
#endif
joystick->hwdata->key_map[i] = joystick->nbuttons;
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;
struct hat_axis_correct *correct = &joystick->hwdata->hat_correct[hat_index];
#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) {
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.fuzz, absinfo_x.flat, absinfo_x.resolution);
}
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.fuzz, absinfo_y.flat, absinfo_y.resolution);
}
@@ -1285,8 +1285,8 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
continue;
}
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has absolute axis: 0x%.2x\n", i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
SDL_Log("Joystick has absolute axis: 0x%.2x", i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }",
absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution);
#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) {
Uint16 code = joystick->hwdata->key_pam[i];
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has button: 0x%x\n", code);
SDL_Log("Joystick has button: 0x%x", code);
#endif
joystick->hwdata->key_map[code] = joystick->nbuttons;
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;
if (!joystick->hwdata->has_hat[hat_index]) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has digital hat: #%d\n", hat_index);
SDL_Log("Joystick has digital hat: #%d", hat_index);
#endif
joystick->hwdata->hats_indices[hat_index] = joystick->nhats++;
joystick->hwdata->has_hat[hat_index] = true;
@@ -1377,7 +1377,7 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor)
}
} else {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has absolute axis: 0x%.2x\n", code);
SDL_Log("Joystick has absolute axis: 0x%.2x", code);
#endif
joystick->hwdata->abs_map[code] = joystick->naxes;
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;
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has accelerometer axis: 0x%.2x\n", ABS_X + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
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 }",
absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution);
#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;
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick has gyro axis: 0x%.2x\n", ABS_RX + i);
SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n",
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 }",
absinfo.value, absinfo.minimum, absinfo.maximum,
absinfo.fuzz, absinfo.flat, absinfo.resolution);
#endif // DEBUG_INPUT_EVENTS
@@ -1522,7 +1522,7 @@ static SDL_sensorlist_item *GetSensor(SDL_joylist_item *item)
}
close(fd_item);
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Joystick UNIQ: %s\n", uniq_item);
SDL_Log("Joystick UNIQ: %s", uniq_item);
#endif // DEBUG_INPUT_EVENTS
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);
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Sensor UNIQ: %s\n", uniq_sensor);
SDL_Log("Sensor UNIQ: %s", uniq_sensor);
#endif // DEBUG_INPUT_EVENTS
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);
#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);
#endif
SDL_SendJoystickAxis(timestamp, joystick,
@@ -1831,7 +1831,7 @@ static void PollAllValues(Uint64 timestamp, SDL_Joystick *joystick)
if (joystick->hwdata->has_key[i]) {
bool down = test_bit(i, keyinfo);
#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);
#endif
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) {
data[i] = absinfo.value * (SDL_PI_F / 180.f) / joystick->hwdata->gyro_scale[i];
#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
}
}
@@ -1870,7 +1870,7 @@ static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick)
if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_X + i), &absinfo) >= 0) {
data[i] = absinfo.value * SDL_STANDARD_GRAVITY / joystick->hwdata->accelerometer_scale[i];
#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
}
}
@@ -1913,7 +1913,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (event->type) {
case EV_KEY:
#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
SDL_SendJoystickButton(SDL_EVDEV_GetEventTimestamp(event), joystick,
joystick->hwdata->key_map[code],
@@ -1932,7 +1932,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
hat_index = (code - ABS_HAT0X) / 2;
if (joystick->hwdata->has_hat[hat_index]) {
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Axis 0x%.2x = %d\n", code, event->value);
SDL_Log("Axis 0x%.2x = %d", code, event->value);
#endif
HandleHat(SDL_EVDEV_GetEventTimestamp(event), joystick, hat_index, code % 2, event->value);
break;
@@ -1940,7 +1940,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
SDL_FALLTHROUGH;
default:
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Axis 0x%.2x = %d\n", code, event->value);
SDL_Log("Axis 0x%.2x = %d", code, event->value);
#endif
event->value = AxisCorrect(joystick, code, event->value);
SDL_SendJoystickAxis(SDL_EVDEV_GetEventTimestamp(event), joystick,
@@ -1964,7 +1964,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (code) {
case SYN_DROPPED:
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Event SYN_DROPPED detected\n");
SDL_Log("Event SYN_DROPPED detected");
#endif
joystick->hwdata->recovering_from_dropped = true;
break;
@@ -2047,7 +2047,7 @@ static void HandleInputEvents(SDL_Joystick *joystick)
switch (code) {
case SYN_DROPPED:
#ifdef DEBUG_INPUT_EVENTS
SDL_Log("Event SYN_DROPPED detected\n");
SDL_Log("Event SYN_DROPPED detected");
#endif
joystick->hwdata->recovering_from_dropped_sensor = true;
break;

View File

@@ -935,7 +935,7 @@ static void RAWINPUT_AddDevice(HANDLE hDevice)
device->joystick_id = SDL_GetNextObjectID();
#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
// 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);
#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
RAWINPUT_ReleaseDevice(device);
return;
@@ -1779,7 +1779,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
triggers for a frame. */
if (ctx->wgi_uncorrelate_count >= 5) {
#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
RAWINPUT_MarkWindowsGamingInputSlotFree(ctx->wgi_slot);
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
ctx->wgi_correlated = true;
#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
correlated = true;
RAWINPUT_MarkWindowsGamingInputSlotUsed(ctx->wgi_slot, ctx);
@@ -1875,7 +1875,7 @@ static void RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
triggers for a frame. */
if (ctx->xinput_uncorrelate_count >= 5) {
#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
RAWINPUT_MarkXInputSlotFree(ctx->xinput_slot);
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
ctx->xinput_correlated = true;
#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
correlated = true;
RAWINPUT_MarkXInputSlotUsed(ctx->xinput_slot);

View File

@@ -997,7 +997,7 @@ static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer *renderer)
*/
SDL_GetWindowSizeInPixels(renderer->window, &w, &h);
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)) {
int tmp = w;
w = h;
@@ -1078,7 +1078,7 @@ static bool D3D11_HandleDeviceLost(SDL_Renderer *renderer)
SUCCEEDED(D3D11_CreateWindowSizeDependentResources(renderer))) {
recovered = true;
} 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);
}
@@ -1990,7 +1990,7 @@ static bool D3D11_UpdateViewport(SDL_Renderer *renderer)
* SDL_CreateRenderer is calling it, and will call it again later
* with a non-empty viewport.
*/
// SDL_Log("%s, no viewport was set!\n", __FUNCTION__);
// SDL_Log("%s, no viewport was set!", __FUNCTION__);
return false;
}
@@ -2057,7 +2057,7 @@ static bool D3D11_UpdateViewport(SDL_Renderer *renderer)
d3dviewport.Height = orientationAlignedViewport.h;
d3dviewport.MinDepth = 0.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);
data->viewportDirty = false;

View File

@@ -1453,7 +1453,7 @@ static bool D3D12_HandleDeviceLost(SDL_Renderer *renderer)
SUCCEEDED(D3D12_CreateWindowSizeDependentResources(renderer))) {
recovered = true;
} 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);
}
@@ -2430,7 +2430,7 @@ static bool D3D12_UpdateViewport(SDL_Renderer *renderer)
* SDL_CreateRenderer is calling it, and will call it again later
* with a non-empty viewport.
*/
// SDL_Log("%s, no viewport was set!\n", __FUNCTION__);
// SDL_Log("%s, no viewport was set!", __FUNCTION__);
return false;
}
@@ -2497,7 +2497,7 @@ static bool D3D12_UpdateViewport(SDL_Renderer *renderer)
d3dviewport.Height = orientationAlignedViewport.h;
d3dviewport.MinDepth = 0.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);
data->viewportDirty = false;

View File

@@ -350,7 +350,10 @@ static bool CompileShader(GL_ShaderContext *ctx, GLhandleARB shader, const char
info = SDL_small_alloc(char, length + 1, &isstack);
if (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);
}
return false;

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_free(last_message);
}
SDL_Log("%s\n", message);
SDL_Log("%s", message);
SDL_free(message);
}
#endif

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);
}
} else {
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Unsupported YUV colorspace\n");
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "Unsupported YUV colorspace");
}
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);
}
}

View File

@@ -87,7 +87,7 @@ void *pool_malloc(VITA_GXM_RenderData *data, unsigned int size)
data->pool_index += size;
return addr;
}
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW\n");
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW");
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;
return addr;
}
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW\n");
SDL_LogError(SDL_LOG_CATEGORY_RENDER, "POOL OVERFLOW");
return NULL;
}
@@ -173,7 +173,7 @@ static void make_fragment_programs(VITA_GXM_RenderData *data, fragment_programs
&out->color);
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;
}
@@ -187,7 +187,7 @@ static void make_fragment_programs(VITA_GXM_RenderData *data, fragment_programs
&out->texture);
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;
}
}
@@ -387,7 +387,7 @@ int gxm_init(SDL_Renderer *renderer)
err = sceGxmInitialize(&initializeParams);
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;
}
@@ -433,7 +433,7 @@ int gxm_init(SDL_Renderer *renderer)
err = sceGxmCreateContext(&data->contextParams, &data->gxm_context);
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;
}
@@ -450,7 +450,7 @@ int gxm_init(SDL_Renderer *renderer)
// create the render target
err = sceGxmCreateRenderTarget(&renderTargetParams, &data->renderTarget);
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;
}
@@ -486,14 +486,14 @@ int gxm_init(SDL_Renderer *renderer)
data->displayBufferData[i]);
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;
}
// create a sync object that we will associate with this buffer
err = sceGxmSyncObjectCreate(&data->displayBufferSync[i]);
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;
}
}
@@ -576,81 +576,81 @@ int gxm_init(SDL_Renderer *renderer)
err = sceGxmShaderPatcherCreate(&patcherParams, &data->shaderPatcher);
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;
}
// check the shaders
err = sceGxmProgramCheck(clearVertexProgramGxp);
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;
}
err = sceGxmProgramCheck(clearFragmentProgramGxp);
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;
}
err = sceGxmProgramCheck(colorVertexProgramGxp);
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;
}
err = sceGxmProgramCheck(colorFragmentProgramGxp);
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;
}
err = sceGxmProgramCheck(textureVertexProgramGxp);
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;
}
err = sceGxmProgramCheck(textureFragmentProgramGxp);
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;
}
// register programs with the patcher
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, clearVertexProgramGxp, &data->clearVertexProgramId);
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;
}
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, clearFragmentProgramGxp, &data->clearFragmentProgramId);
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;
}
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, colorVertexProgramGxp, &data->colorVertexProgramId);
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;
}
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, colorFragmentProgramGxp, &data->colorFragmentProgramId);
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;
}
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, textureVertexProgramGxp, &data->textureVertexProgramId);
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;
}
err = sceGxmShaderPatcherRegisterProgram(data->shaderPatcher, textureFragmentProgramGxp, &data->textureFragmentProgramId);
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;
}
@@ -679,7 +679,7 @@ int gxm_init(SDL_Renderer *renderer)
1,
&data->clearVertexProgram);
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;
}
@@ -692,7 +692,7 @@ int gxm_init(SDL_Renderer *renderer)
clearVertexProgramGxp,
&data->clearFragmentProgram);
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;
}
@@ -760,7 +760,7 @@ int gxm_init(SDL_Renderer *renderer)
1,
&data->colorVertexProgram);
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;
}
}
@@ -805,7 +805,7 @@ int gxm_init(SDL_Renderer *renderer)
1,
&data->textureVertexProgram);
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;
}
}
@@ -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
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(
SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE,
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);
if (ret < 0) {
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;
}
@@ -1065,7 +1065,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
if (err < 0) {
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;
}
@@ -1088,7 +1088,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
if (err < 0) {
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;
}
@@ -1113,7 +1113,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig
if (err < 0) {
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;
}
}

View File

@@ -41,14 +41,14 @@
#define SET_ERROR_CODE(message, rc) \
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_SetError("%s: %s", message, SDL_Vulkan_GetResultString(rc)) \
#define SET_ERROR_MESSAGE(message) \
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_SetError("%s", message) \
@@ -2512,7 +2512,7 @@ static bool VULKAN_HandleDeviceLost(SDL_Renderer *renderer)
VULKAN_CreateWindowSizeDependentResources(renderer) == VK_SUCCESS) {
recovered = true;
} 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);
}
@@ -3296,7 +3296,7 @@ static bool VULKAN_UpdateViewport(SDL_Renderer *renderer)
* SDL_CreateRenderer is calling it, and will call it again later
* with a non-empty viewport.
*/
// SDL_Log("%s, no viewport was set!\n", __FUNCTION__);
// SDL_Log("%s, no viewport was set!", __FUNCTION__);
return false;
}

View File

@@ -132,7 +132,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnStateChanged(ISensorEvents
SDL_LockSensors();
for (i = 0; i < SDL_num_sensors; ++i) {
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();
@@ -156,7 +156,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnDataUpdated(ISensorEvents *
Uint64 sensor_timestamp;
#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
if (SUCCEEDED(ISensorDataReport_GetTimestamp(pNewData, &sensor_systemtime)) &&
SystemTimeToFileTime(&sensor_systemtime, &sensor_filetime)) {
@@ -219,7 +219,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnEvent(ISensorEvents *This,
SDL_LockSensors();
for (i = 0; i < SDL_num_sensors; ++i) {
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();
@@ -235,7 +235,7 @@ static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_OnLeave(ISensorEvents *This,
for (i = 0; i < SDL_num_sensors; ++i) {
if (WIN_IsEqualIID(ID, &SDL_sensors[i].sensor_id)) {
#ifdef DEBUG_SENSORS
SDL_Log("Sensor %s disconnected\n", SDL_sensors[i].name);
SDL_Log("Sensor %s disconnected", SDL_sensors[i].name);
#endif
DisconnectSensor(SDL_sensors[i].sensor);
}

View File

@@ -1092,12 +1092,12 @@ static void SDLTest_PrintRenderer(SDL_Renderer *renderer)
name = SDL_GetRendererName(renderer);
SDL_Log(" Renderer %s:\n", name);
SDL_Log(" Renderer %s:", name);
if (SDL_strcmp(name, "gpu") == 0) {
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);
if (texture_formats) {
@@ -1108,12 +1108,12 @@ static void SDLTest_PrintRenderer(SDL_Renderer *renderer)
}
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);
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 */
icon = SDL_LoadBMP(file);
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;
}
@@ -1142,40 +1142,40 @@ static SDL_HitTestResult SDLCALL SDLTest_ExampleHitTestCallback(SDL_Window *win,
const int RESIZE_BORDER = 8;
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);
if (area->x < 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;
} 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;
} else {
SDL_Log("SDL_HITTEST_RESIZE_LEFT\n");
SDL_Log("SDL_HITTEST_RESIZE_LEFT");
return SDL_HITTEST_RESIZE_LEFT;
}
} else if (area->x >= (w - 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;
} 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;
} else {
SDL_Log("SDL_HITTEST_RESIZE_RIGHT\n");
SDL_Log("SDL_HITTEST_RESIZE_RIGHT");
return SDL_HITTEST_RESIZE_RIGHT;
}
} 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;
} else if (area->y < RESIZE_BORDER) {
SDL_Log("SDL_HITTEST_RESIZE_TOP\n");
SDL_Log("SDL_HITTEST_RESIZE_TOP");
return SDL_HITTEST_RESIZE_TOP;
} else if (area->y < DRAGGABLE_TITLE) {
SDL_Log("SDL_HITTEST_DRAGGABLE\n");
SDL_Log("SDL_HITTEST_DRAGGABLE");
return SDL_HITTEST_DRAGGABLE;
}
return SDL_HITTEST_NORMAL;
@@ -1190,7 +1190,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
if (state->verbose & VERBOSE_VIDEO) {
n = SDL_GetNumVideoDrivers();
if (n == 0) {
SDL_Log("No built-in video drivers\n");
SDL_Log("No built-in video drivers");
} else {
(void)SDL_snprintf(text, sizeof(text), "Built-in video drivers:");
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_Log("%s\n", text);
SDL_Log("%s", text);
}
}
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());
return false;
}
if (state->verbose & VERBOSE_VIDEO) {
SDL_Log("Video driver: %s\n",
SDL_Log("Video driver: %s",
SDL_GetCurrentVideoDriver());
}
@@ -1257,10 +1257,10 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
int outputIndex = 0;
#endif
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) {
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_GetDisplayBounds(displayID, &bounds);
@@ -1268,46 +1268,46 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
SDL_zero(usablebounds);
SDL_GetDisplayUsableBounds(displayID, &usablebounds);
SDL_Log("Bounds: %dx%d at %d,%d\n", 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("Bounds: %dx%d at %d,%d", bounds.w, bounds.h, bounds.x, bounds.y);
SDL_Log("Usable bounds: %dx%d at %d,%d", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y);
mode = SDL_GetDesktopDisplayMode(displayID);
SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask, &Gmask,
&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,
SDL_GetPixelFormatName(mode->format));
if (Rmask || Gmask || Bmask) {
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32 "\n", Rmask);
SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32 "\n", Gmask);
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32 "\n", Bmask);
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32, Rmask);
SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32, Gmask);
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32, Bmask);
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 */
modes = SDL_GetFullscreenDisplayModes(displayID, &m);
if (m == 0) {
SDL_Log("No available fullscreen video modes\n");
SDL_Log("No available fullscreen video modes");
} else {
SDL_Log(" Fullscreen video modes:\n");
SDL_Log(" Fullscreen video modes:");
for (j = 0; j < m; ++j) {
mode = modes[j];
SDL_GetMasksForPixelFormat(mode->format, &bpp, &Rmask,
&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,
SDL_GetPixelFormatName(mode->format));
if (Rmask || Gmask || Bmask) {
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32 "\n",
SDL_Log(" Red Mask = 0x%.8" SDL_PRIx32,
Rmask);
SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32 "\n",
SDL_Log(" Green Mask = 0x%.8" SDL_PRIx32,
Gmask);
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32 "\n",
SDL_Log(" Blue Mask = 0x%.8" SDL_PRIx32,
Bmask);
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) {
n = SDL_GetNumRenderDrivers();
if (n == 0) {
SDL_Log("No built-in render drivers\n");
SDL_Log("No built-in render drivers");
} else {
SDL_Log("Built-in render drivers:\n");
SDL_Log("Built-in render drivers:");
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,
sizeof(*state->targets));
if (!state->windows || !state->renderers) {
SDL_Log("Out of memory!\n");
SDL_Log("Out of memory!");
return false;
}
for (i = 0; i < state->num_windows; ++i) {
@@ -1412,7 +1412,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
state->windows[i] = SDL_CreateWindowWithProperties(props);
SDL_DestroyProperties(props);
if (!state->windows[i]) {
SDL_Log("Couldn't create window: %s\n",
SDL_Log("Couldn't create window: %s",
SDL_GetError());
return false;
}
@@ -1427,7 +1427,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
}
SDL_GetWindowSize(state->windows[i], &w, &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_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)))) {
state->renderers[i] = SDL_CreateRenderer(state->windows[i], state->renderdriver);
if (!state->renderers[i]) {
SDL_Log("Couldn't create renderer: %s\n",
SDL_Log("Couldn't create renderer: %s",
SDL_GetError());
return false;
}
@@ -1471,14 +1471,14 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
SDL_SetRenderVSync(state->renderers[i], state->render_vsync);
}
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;
}
if (state->scale != 0.0f) {
SDL_SetRenderScale(state->renderers[i], state->scale, state->scale);
}
if (state->verbose & VERBOSE_RENDER) {
SDL_Log("Current renderer:\n");
SDL_Log("Current renderer:");
SDLTest_PrintRenderer(state->renderers[i]);
}
}
@@ -1494,7 +1494,7 @@ bool SDLTest_CommonInit(SDLTest_CommonState *state)
if (state->verbose & VERBOSE_AUDIO) {
n = SDL_GetNumAudioDrivers();
if (n == 0) {
SDL_Log("No built-in audio drivers\n");
SDL_Log("No built-in audio drivers");
} else {
(void)SDL_snprintf(text, sizeof(text), "Built-in audio drivers:");
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_Log("%s\n", text);
SDL_Log("%s", text);
}
}
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());
return false;
}
if (state->verbose & VERBOSE_AUDIO) {
SDL_Log("Audio driver: %s\n",
SDL_Log("Audio driver: %s",
SDL_GetCurrentAudioDriver());
}
const SDL_AudioSpec spec = { state->audio_format, state->audio_channels, state->audio_freq };
state->audio_id = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &spec);
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;
}
}
@@ -1676,7 +1676,7 @@ void SDLTest_PrintEvent(const SDL_Event *event)
SDL_Rect 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);
break;
}
@@ -2058,7 +2058,7 @@ static void SDLCALL SDLTest_ScreenShotClipboardCleanup(void *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) {
SDL_free(data->image);
@@ -2071,14 +2071,14 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c
SDLTest_ClipboardData *data = (SDLTest_ClipboardData *)context;
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" */
*size = 15;
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) {
SDL_IOStream *file;
@@ -2089,7 +2089,7 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c
void *image = SDL_malloc(length);
if (image) {
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);
image = NULL;
}
@@ -2101,7 +2101,7 @@ static const void * SDLCALL SDLTest_ScreenShotClipboardProvider(void *context, c
data->size = length;
}
} 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);
if (!surface) {
SDL_Log("Couldn't read screen: %s\n", SDL_GetError());
SDL_Log("Couldn't read screen: %s", SDL_GetError());
return;
}
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);
return;
}
@@ -2137,11 +2137,11 @@ static void SDLTest_CopyScreenShot(SDL_Renderer *renderer)
clipboard_data = (SDLTest_ClipboardData *)SDL_calloc(1, sizeof(*clipboard_data));
if (!clipboard_data) {
SDL_Log("Couldn't allocate clipboard data\n");
SDL_Log("Couldn't allocate clipboard data");
return;
}
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)
@@ -2336,7 +2336,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
} else {
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_WINDOWPOS_CENTERED_DISPLAY(dest),
SDL_WINDOWPOS_CENTERED_DISPLAY(dest));
@@ -2365,7 +2365,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
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);
}
}
@@ -2399,7 +2399,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
if (withAlt) {
/* Alt-C copy awesome text to the primary selection! */
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) {
if (withShift) {
@@ -2415,7 +2415,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
} else {
/* Ctrl-C copy awesome text! */
SDL_SetClipboardText("SDL rocks!\nYou know it!");
SDL_Log("Copied text to clipboard\n");
SDL_Log("Copied text to clipboard");
}
break;
}
@@ -2425,9 +2425,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
/* Alt-V paste awesome text from the primary selection! */
char *text = SDL_GetPrimarySelectionText();
if (*text) {
SDL_Log("Primary selection: %s\n", text);
SDL_Log("Primary selection: %s", text);
} else {
SDL_Log("Primary selection is empty\n");
SDL_Log("Primary selection is empty");
}
SDL_free(text);
@@ -2439,9 +2439,9 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
/* Ctrl-V paste awesome text! */
char *text = SDL_GetClipboardText();
if (*text) {
SDL_Log("Clipboard: %s\n", text);
SDL_Log("Clipboard: %s", text);
} else {
SDL_Log("Clipboard is empty\n");
SDL_Log("Clipboard is empty");
}
SDL_free(text);
}
@@ -2498,7 +2498,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const
if (window) {
const bool shouldCapture = !(SDL_GetWindowFlags(window) & SDL_WINDOW_MOUSE_CAPTURE);
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;

View File

@@ -719,7 +719,7 @@ static void dumpconfig(SDL_VideoDevice *_this, EGLConfig config)
for (attr = 0; attr < sizeof(all_attributes) / sizeof(Attribute); attr++) {
EGLint 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);
}
}

View File

@@ -540,7 +540,7 @@ void Cocoa_HandleKeyEvent(SDL_VideoDevice *_this, NSEvent *event)
#ifdef DEBUG_SCANCODES
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
if (SDL_TextInputActive(SDL_GetKeyboardFocus())) {

View File

@@ -59,9 +59,9 @@ static void *KMSDRM_GetSym(const char *fnname, int *pHasModule, bool required)
#if DEBUG_DYNAMIC_KMSDRM
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
SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!\n", fnname);
SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!", fnname);
#endif
if (!fn && required) {

View File

@@ -661,7 +661,7 @@ static bool OPENVR_SetupFrame(SDL_VideoDevice *_this, SDL_Window *window)
{
int error = ov_glGetError();
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
@@ -698,7 +698,7 @@ static bool OPENVR_ReleaseFrame(SDL_VideoDevice *_this)
{
int error = ov_glGetError();
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
@@ -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);
if (SDL_strcmp(ccc, "GL_KHR_debug") == 0) {
#ifdef DEBUG_OPENVR
SDL_Log("Found renderdoc debug extension.\n");
SDL_Log("Found renderdoc debug extension.");
#endif
videodata->renderdoc_debugmarker_frame_end = true;
}
@@ -968,7 +968,7 @@ static bool SDL_EGL_InitInternal(SDL_VideoData * vd)
vd->eglDpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
#ifdef DEBUG_OPENVR
SDL_Log("EGL Display: %p\n", vd->eglDpy);
SDL_Log("EGL Display: %p", vd->eglDpy);
#endif
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);
if (SDL_strcmp(ccc, "GL_KHR_debug") == 0) {
#ifdef DEBUG_OPENVR
SDL_Log("Found renderdoc debug extension.\n");
SDL_Log("Found renderdoc debug extension.");
#endif
videodata->renderdoc_debugmarker_frame_end = true;
}

View File

@@ -66,9 +66,9 @@ static void *WAYLAND_GetSym(const char *fnname, int *pHasModule, bool required)
#if DEBUG_DYNAMIC_WAYLAND
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 {
SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!\n", fnname);
SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!", fnname);
}
#endif

View File

@@ -1195,7 +1195,7 @@ static void libdecor_error(struct libdecor *context,
enum libdecor_error error,
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 = {

View File

@@ -157,17 +157,17 @@ static Uint64 WIN_GetEventTimestamp(void)
timestamp += timestamp_offset;
if (!timestamp_offset) {
// Initializing timestamp offset
//SDL_Log("Initializing timestamp offset\n");
//SDL_Log("Initializing timestamp offset");
timestamp_offset = (now - timestamp);
timestamp = now;
} else if ((Sint64)(now - timestamp - TIMESTAMP_WRAP_OFFSET) >= 0) {
// 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 += TIMESTAMP_WRAP_OFFSET;
} else if (timestamp > now) {
// 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 = now;
}
@@ -2239,7 +2239,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
int w, h;
#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);
#endif
@@ -2270,7 +2270,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
}
#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,
suggestedRect->left, suggestedRect->top, w, h);
#endif

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) {
char str[5];
*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
@@ -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_keys = IGameInputReading_GetKeyState(reading, max_keys, keys);
#ifdef DEBUG_KEYS
SDL_Log("Timestamp: %llu\n", timestamp);
SDL_Log("Timestamp: %llu", timestamp);
DumpKeys("Last keys:", last, num_last);
DumpKeys("New keys:", keys, num_keys);
#endif

View File

@@ -561,7 +561,7 @@ static void WIN_AddDisplay(SDL_VideoDevice *_this, HMONITOR hMonitor, const MONI
float content_scale = WIN_GetContentScale(_this, hMonitor);
#ifdef DEBUG_MODES
SDL_Log("Display: %s\n", WIN_StringToUTF8W(info->szDevice));
SDL_Log("Display: %s", WIN_StringToUTF8W(info->szDevice));
#endif
dxgi_output = WIN_GetDXGIOutput(_this, info->szDevice);

View File

@@ -482,11 +482,11 @@ static bool WIN_VideoInit(SDL_VideoDevice *_this)
if (SUCCEEDED(hr)) {
data->oleinitialized = true;
} 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))
} 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);

View File

@@ -430,7 +430,7 @@ void X11_ReconcileKeyboardState(SDL_VideoDevice *_this)
static void X11_DispatchFocusIn(SDL_VideoDevice *_this, SDL_WindowData *data)
{
#ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: Dispatching FocusIn\n", data->xwindow);
SDL_Log("window 0x%lx: Dispatching FocusIn", data->xwindow);
#endif
SDL_SetKeyboardFocus(data->window);
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)
{
#ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: Dispatching FocusOut\n", data->xwindow);
SDL_Log("window 0x%lx: Dispatching FocusOut", data->xwindow);
#endif
/* 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
@@ -606,7 +606,7 @@ static void X11_UpdateUserTime(SDL_WindowData *data, const unsigned long latest)
XA_CARDINAL, 32, PropModeReplace,
(const unsigned char *)&latest, 1);
#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
data->user_time = latest;
}
@@ -636,7 +636,7 @@ static void X11_HandleClipboardEvent(SDL_VideoDevice *_this, const XEvent *xeven
#ifdef DEBUG_XEVENTS
char *atom_name;
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);
if (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 *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);
#endif
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;
#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);
#endif
@@ -892,14 +892,14 @@ void X11_HandleKeyEvent(SDL_VideoDevice *_this, SDL_WindowData *windowdata, SDL_
Uint64 timestamp = X11_GetEventTimestamp(xevent->xkey.time);
#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
#ifdef DEBUG_SCANCODES
if (scancode == SDL_SCANCODE_UNKNOWN && keycode) {
int min_keycode, max_keycode;
X11_XDisplayKeycodes(display, &min_keycode, &max_keycode);
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,
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
if (X11_XFilterEvent(xevent, None)) {
#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);
#endif
handled_by_ime = true;
@@ -967,7 +967,7 @@ void X11_HandleButtonPress(SDL_VideoDevice *_this, SDL_WindowData *windowdata, S
Uint64 timestamp = X11_GetEventTimestamp(time);
#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
SDL_Mouse *mouse = SDL_GetMouse();
@@ -1015,7 +1015,7 @@ void X11_HandleButtonRelease(SDL_VideoDevice *_this, SDL_WindowData *windowdata,
Uint64 timestamp = X11_GetEventTimestamp(time);
#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
if (!X11_IsWheelEvent(display, button, &xticks, &yticks)) {
if (button > 7) {
@@ -1048,7 +1048,7 @@ void X11_GetBorderValues(SDL_WindowData *data)
X11_XFree(property);
#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
}
} else {
@@ -1072,7 +1072,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
if (xevent->type != KeyPress && xevent->type != KeyRelease) {
if (X11_XFilterEvent(xevent, None)) {
#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);
#endif
return;
@@ -1100,7 +1100,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
#endif
#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);
#endif
@@ -1110,7 +1110,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
XFixesSelectionNotifyEvent *ev = (XFixesSelectionNotifyEvent *)xevent;
#ifdef DEBUG_XEVENTS
SDL_Log("window CLIPBOARD: XFixesSelectionNotify (selection = %s)\n",
SDL_Log("window CLIPBOARD: XFixesSelectionNotify (selection = %s)",
X11_XGetAtomName(display, ev->selection));
#endif
@@ -1154,7 +1154,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
// The window for KeymapNotify, etc events is 0
if (xevent->type == KeymapNotify) {
#ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: KeymapNotify!\n", xevent->xany.window);
SDL_Log("window 0x%lx: KeymapNotify!", xevent->xany.window);
#endif
if (SDL_GetKeyboardFocus() != NULL) {
#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;
#ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: MappingNotify!\n", xevent->xany.window);
SDL_Log("window 0x%lx: MappingNotify!", xevent->xany.window);
#endif
if ((request == MappingKeyboard) || (request == MappingModifier)) {
X11_XRefreshKeyboardMapping(&xevent->xmapping);
@@ -1221,15 +1221,15 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
{
SDL_Mouse *mouse = SDL_GetMouse();
#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.y,
xevent->xcrossing.mode);
if (xevent->xcrossing.mode == NotifyGrab) {
SDL_Log("Mode: NotifyGrab\n");
SDL_Log("Mode: NotifyGrab");
}
if (xevent->xcrossing.mode == NotifyUngrab) {
SDL_Log("Mode: NotifyUngrab\n");
SDL_Log("Mode: NotifyUngrab");
}
#endif
SDL_SetMouseFocus(data->window);
@@ -1260,15 +1260,15 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
case LeaveNotify:
{
#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.y,
xevent->xcrossing.mode);
if (xevent->xcrossing.mode == NotifyGrab) {
SDL_Log("Mode: NotifyGrab\n");
SDL_Log("Mode: NotifyGrab");
}
if (xevent->xcrossing.mode == NotifyUngrab) {
SDL_Log("Mode: NotifyUngrab\n");
SDL_Log("Mode: NotifyUngrab");
}
#endif
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) {
// Someone is handling a global hotkey, ignore it
#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
break;
}
if (xevent->xfocus.detail == NotifyInferior || xevent->xfocus.detail == NotifyPointer) {
#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
break;
}
#ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: FocusIn!\n", xevent->xany.window);
SDL_Log("window 0x%lx: FocusIn!", xevent->xany.window);
#endif
if (!videodata->last_mode_change_deadline) /* no recent mode changes */ {
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) {
// Someone is handling a global hotkey, ignore it
#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
break;
}
@@ -1335,12 +1335,12 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
care about the position of the pointer when the keyboard
focus changed. */
#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
break;
}
#ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: FocusOut!\n", xevent->xany.window);
SDL_Log("window 0x%lx: FocusOut!", xevent->xany.window);
#endif
if (!videodata->last_mode_change_deadline) /* no recent mode changes */ {
data->pending_focus = PENDING_FOCUS_NONE;
@@ -1366,7 +1366,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
XEvent ev;
#ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: UnmapNotify!\n", xevent->xany.window);
SDL_Log("window 0x%lx: UnmapNotify!", xevent->xany.window);
#endif
if (X11_XCheckIfEvent(display, &ev, &isReparentNotify, (XPointer)&xevent->xunmap)) {
@@ -1387,7 +1387,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
case MapNotify:
{
#ifdef DEBUG_XEVENTS
SDL_Log("window 0x%lx: MapNotify!\n", xevent->xany.window);
SDL_Log("window 0x%lx: MapNotify!", xevent->xany.window);
#endif
X11_DispatchMapNotify(data);
@@ -1403,7 +1403,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
case ConfigureNotify:
{
#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.width, xevent->xconfigure.height);
#endif
@@ -1470,9 +1470,9 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
data->xdnd_source = xevent->xclient.data.l[0];
xdnd_version = (xevent->xclient.data.l[1] >> 24);
#ifdef DEBUG_XEVENTS
SDL_Log("XID of source window : 0x%lx\n", data->xdnd_source);
SDL_Log("Protocol version to use : %d\n", xdnd_version);
SDL_Log("More then 3 data types : %d\n", (int)use_list);
SDL_Log("XID of source window : 0x%lx", data->xdnd_source);
SDL_Log("Protocol version to use : %d", xdnd_version);
SDL_Log("More then 3 data types : %d", (int)use_list);
#endif
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) {
#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
SDL_SendDropComplete(data->window);
} 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) {
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
{
// Drag and Drop position
@@ -1555,7 +1555,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
Window root = DefaultRootWindow(display);
#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
xevent->xclient.window = root;
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)) {
#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
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_CLOSE_REQUESTED, 0, 0);
break;
@@ -1589,7 +1589,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
case Expose:
{
#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
SDL_SendWindowEvent(data->window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
} break;
@@ -1622,7 +1622,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
SDL_Mouse *mouse = SDL_GetMouse();
if (!mouse->relative_mode) {
#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
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);
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);
}
@@ -1674,7 +1674,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
for (i = 0; i < items_read; i++) {
SDL_Log(" %d", values[i]);
}
SDL_Log(" }\n");
SDL_Log(" }");
} else if (real_type == XA_CARDINAL) {
if (real_format == 32) {
Uint32 *values = (Uint32 *)propdata;
@@ -1683,7 +1683,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
for (i = 0; i < items_read; i++) {
SDL_Log(" %d", values[i]);
}
SDL_Log(" }\n");
SDL_Log(" }");
} else if (real_format == 16) {
Uint16 *values = (Uint16 *)propdata;
@@ -1691,7 +1691,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
for (i = 0; i < items_read; i++) {
SDL_Log(" %d", values[i]);
}
SDL_Log(" }\n");
SDL_Log(" }");
} else if (real_format == 8) {
Uint8 *values = (Uint8 *)propdata;
@@ -1699,11 +1699,11 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
for (i = 0; i < items_read; i++) {
SDL_Log(" %d", values[i]);
}
SDL_Log(" }\n");
SDL_Log(" }");
}
} else if (real_type == XA_STRING ||
real_type == videodata->atoms.UTF8_STRING) {
SDL_Log("{ \"%s\" }\n", propdata);
SDL_Log("{ \"%s\" }", propdata);
} else if (real_type == XA_ATOM) {
Atom *atoms = (Atom *)propdata;
@@ -1715,10 +1715,10 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
X11_XFree(atomname);
}
}
SDL_Log(" }\n");
SDL_Log(" }");
} else {
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) {
X11_XFree(atomname);
}
@@ -1918,7 +1918,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
{
Atom target = xevent->xselection.target;
#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);
#endif
if (target == data->xdnd_req) {
@@ -1969,7 +1969,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
default:
{
#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
} break;
}

View File

@@ -239,7 +239,7 @@ bool X11_InitKeyboard(SDL_VideoDevice *_this)
const SDL_Scancode *table = SDL_GetScancodeTable(scancode_set[best_index], &table_size);
#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
// This should never happen, but just in case...
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)) {
// Not a character key and the scancode is safe to remap
#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
data->key_layout[i] = scancode;
}
}
} else {
#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
// 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));
}
if (scancode == SDL_SCANCODE_UNKNOWN) {
SDL_Log("scancode not found\n");
SDL_Log("scancode not found");
} else {
SDL_Log("scancode = %d (%s)\n", scancode, SDL_GetScancodeName(scancode));
SDL_Log("scancode = %d (%s)", scancode, SDL_GetScancodeName(scancode));
}
#endif
data->key_layout[i] = scancode;
@@ -592,12 +592,12 @@ static void preedit_draw_callback(XIC xic, XPointer client_data, XIMPreeditDrawC
#ifdef DEBUG_XIM
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) {
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
X11_SendEditingEvent(data);

View File

@@ -584,7 +584,7 @@ bool X11_Xinput2SelectMouseAndKeyboard(SDL_VideoDevice *_this, SDL_Window *windo
XISetMask(mask, XI_PropertyEvent); // E.g., when swapping tablet pens
if (X11_XISelectEvents(data->display, windowdata->xwindow, &eventmask, 1) != Success) {
SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, "Could not enable XInput2 event handling\n");
SDL_LogWarn(SDL_LOG_CATEGORY_INPUT, "Could not enable XInput2 event handling");
windowdata->xinput2_keyboard_enabled = false;
windowdata->xinput2_mouse_enabled = false;
}