From e1ff27c298de87b2332425e1daba851e733149a3 Mon Sep 17 00:00:00 2001 From: Duy Tran Khanh Date: Sat, 2 Jul 2022 11:42:22 +0700 Subject: [PATCH] Fixes button scaling; Logging header cleanup --- Natives/customcontrols/ControlButton.m | 2 +- Natives/input_bridge_v3.m | 14 +++++--------- Natives/log.h | 17 ----------------- Natives/log.m | 8 +++++++- 4 files changed, 13 insertions(+), 28 deletions(-) diff --git a/Natives/customcontrols/ControlButton.m b/Natives/customcontrols/ControlButton.m index 7034f262..d6047cdc 100644 --- a/Natives/customcontrols/ControlButton.m +++ b/Natives/customcontrols/ControlButton.m @@ -85,7 +85,7 @@ self.properties[@"width"] = @([self.properties[@"width"] floatValue] * savedScale / currentScale); self.properties[@"height"] = @([self.properties[@"height"] floatValue] * savedScale / currentScale); } - current_control_object[@"scaledAt"] = getPreference(@"button_scale"); + //current_control_object[@"scaledAt"] = getPreference(@"button_scale"); } - (NSString *)processFunctions:(NSString *)string { diff --git a/Natives/input_bridge_v3.m b/Natives/input_bridge_v3.m index 372cdea5..fd4323b8 100644 --- a/Natives/input_bridge_v3.m +++ b/Natives/input_bridge_v3.m @@ -246,14 +246,12 @@ JNIEXPORT void JNICALL Java_net_kdt_pojavlaunch_uikit_UIKit_updateMCGuiScale(JNI } JNIEXPORT jstring JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeClipboard(JNIEnv* env, jclass clazz, jint action, jstring copySrc) { - DEBUG_LOGD("Debug: Clipboard access is going on\n"); + debugLog("Debug: Clipboard access is going on\n"); return UIKit_accessClipboard(env, action, copySrc); } JNIEXPORT jboolean JNICALL Java_org_lwjgl_glfw_CallbackBridge_nativeSetInputReady(JNIEnv* env, jclass clazz, jboolean inputReady) { -#ifdef DEBUG - LOGD("Debug: Changing input state, isReady=%d, isUseStackQueueCall=%d\n", inputReady, isUseStackQueueCall); -#endif + debugLog("Debug: Changing input state, isReady=%d, isUseStackQueueCall=%d\n", inputReady, isUseStackQueueCall); isInputReady = inputReady; return isUseStackQueueCall; @@ -377,11 +375,9 @@ void CallbackBridge_nativeSendKey(int key, int scancode, int action, int mods) { } void CallbackBridge_nativeSendKeycode(int keycode, char keychar, int scancode, int action, int mods) { - if (isInputReady) { - CallbackBridge_nativeSendKey(keycode, scancode, action, mods); - if (!CallbackBridge_nativeSendCharMods(keychar, mods)) { - CallbackBridge_nativeSendChar(keychar); - } + CallbackBridge_nativeSendKey(keycode, scancode, action, mods); + if (!CallbackBridge_nativeSendCharMods(keychar, mods)) { + CallbackBridge_nativeSendChar(keychar); } } diff --git a/Natives/log.h b/Natives/log.h index 762c7eba..1180ea89 100644 --- a/Natives/log.h +++ b/Natives/log.h @@ -4,23 +4,6 @@ extern "C" { #endif -#define LOGE(...) printf(__VA_ARGS__) -#define LOGW(...) printf(__VA_ARGS__) -#define LOGI(...) printf(__VA_ARGS__) -#define LOGD(...) printf(__VA_ARGS__) - -#ifdef DEBUG -# define DEBUG_LOGE(...) LOGE(__VA_ARGS__) -# define DEBUG_LOGW(...) LOGW(__VA_ARGS__) -# define DEBUG_LOGI(...) LOGI(__VA_ARGS__) -# define DEBUG_LOGD(...) LOGD(__VA_ARGS__) -#else -# define DEBUG_LOGE(...) -# define DEBUG_LOGW(...) -# define DEBUG_LOGI(...) -# define DEBUG_LOGD(...) -#endif - void regLog(const char *message, ...) __attribute__((format(printf, 1, 2))); void debugLog(const char *message, ...) __attribute__((format(printf, 1, 2))); diff --git a/Natives/log.m b/Natives/log.m index 19f7b3a3..2f33e4c6 100644 --- a/Natives/log.m +++ b/Natives/log.m @@ -11,7 +11,13 @@ void regLog(const char *message,...) { void debugLog(const char *message,...) { - if([getPreference(@"debug_logging") boolValue] == true) { + if([getPreference(@"debug_logging") boolValue]) { + va_list args; + va_start(args, message); + NSLog(@"%@",[[NSString alloc] initWithFormat:[NSString stringWithUTF8String:message] arguments:args]); + va_end(args); + } else { + NSLog(@"WARNING!!! DEBUG LOG DISABLED"); va_list args; va_start(args, message); NSLog(@"%@",[[NSString alloc] initWithFormat:[NSString stringWithUTF8String:message] arguments:args]);