diff --git a/src/android/app/src/main/jni/input_manager.cpp b/src/android/app/src/main/jni/input_manager.cpp index 20ebca889..03075e35c 100644 --- a/src/android/app/src/main/jni/input_manager.cpp +++ b/src/android/app/src/main/jni/input_manager.cpp @@ -19,25 +19,6 @@ #include #include -#if !defined(LOG_TAG) -#define LOG_TAG "citra" -#endif - -#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) -#define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__) -#define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) -#define ALOGV(...) \ - __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__) -#ifndef NDEBUG -#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) -#else -#define ALOGD(...) -#endif -#define FAIL(...) \ - do { \ - __android_log_print(ANDROID_LOG_FATAL, LOG_TAG, __VA_ARGS__); \ - abort(); \ - } while (0) namespace InputManager { static std::shared_ptr button; @@ -333,7 +314,6 @@ NDKMotionFactory* NDKMotionHandler() { } void Init() { - ALOGI("initializing input manager"); button = std::make_shared(); analog = std::make_shared(); motion = std::make_shared(); @@ -343,7 +323,6 @@ void Init() { } void Shutdown() { - ALOGI("shutting down input manager"); Input::UnregisterFactory("gamepad"); Input::UnregisterFactory("gamepad"); Input::UnregisterFactory("motion_emu"); diff --git a/src/android/app/src/main/jni/vr/OpenXR.cpp b/src/android/app/src/main/jni/vr/OpenXR.cpp index 7f6b6015a..576abafe5 100644 --- a/src/android/app/src/main/jni/vr/OpenXR.cpp +++ b/src/android/app/src/main/jni/vr/OpenXR.cpp @@ -25,7 +25,7 @@ License : Licensed under GPLv3 or any later version. do { \ const int32_t ret = fn; \ if (ret < 0) { \ - ALOGE("ERROR (%s): %s() returned %d", __FUNCTION__, #fn, ret); \ + ALOGE("ERROR ({}): {}() returned {}", __FUNCTION__, #fn, ret); \ return (returnCode); \ } \ } while (0) @@ -38,7 +38,7 @@ void OXR_CheckErrors(XrResult result, const char* function, bool failOnError) { if (failOnError) { FAIL("OpenXR error: %s: %s\n", function, errorBuffer); } else { - ALOGV("OpenXR error: %s: %s\n", function, errorBuffer); + ALOGV("OpenXR error: {}: {}\n", function, errorBuffer); } } } @@ -79,7 +79,7 @@ namespace { OXR(xrEnumerateApiLayerProperties(numInputLayers, &numOutputLayers, layerProperties.data())); for (uint32_t i = 0; i < numOutputLayers; i++) { - ALOGI("Found layer %s", layerProperties[i].layerName); + ALOGI("Found layer {}", layerProperties[i].layerName); } } @@ -109,7 +109,7 @@ int XrCheckRequiredExtensions(const char* const* requiredExtensionNames, uint32_t numOutputExtensions = 0; OXR(xrEnumerateInstanceExtensionProperties(NULL, numInputExtensions, &numOutputExtensions, NULL)); - ALOGV("xrEnumerateInstanceExtensionProperties found %u extension(s).", numOutputExtensions); + ALOGV("xrEnumerateInstanceExtensionProperties found {} extension(s).", numOutputExtensions); numInputExtensions = numOutputExtensions; @@ -124,7 +124,7 @@ int XrCheckRequiredExtensions(const char* const* requiredExtensionNames, extensionProperties.data())); #ifndef NDEBUG for (uint32_t i = 0; i < numOutputExtensions; i++) { - ALOGV("Extension #%d = '%s'.", i, extensionProperties[i].extensionName); + ALOGV("Extension #{} = '{}'.", i, extensionProperties[i].extensionName); } #endif @@ -132,13 +132,13 @@ int XrCheckRequiredExtensions(const char* const* requiredExtensionNames, bool found = false; for (uint32_t j = 0; j < numOutputExtensions; j++) { if (!strcmp(requiredExtensionNames[i], extensionProperties[j].extensionName)) { - ALOGD("Found required extension %s", requiredExtensionNames[i]); + ALOGD("Found required extension {}", requiredExtensionNames[i]); found = true; break; } } if (!found) { - ALOGE("Failed to find required extension %s", requiredExtensionNames[i]); + ALOGE("Failed to find required extension {}", requiredExtensionNames[i]); return -2; } } @@ -185,7 +185,7 @@ XrInstance XrInstanceCreate() { XrInstance instanceLocal; OXR(initResult = xrCreateInstance(&ici, &instanceLocal)); if (initResult != XR_SUCCESS) { - ALOGE("ERROR(%s()): Failed to create XR instance_: %d.", __FUNCTION__, initResult); + ALOGE("ERROR({}()): Failed to create XR instance_: {}.", __FUNCTION__, initResult); return XR_NULL_HANDLE; } // Log runtime instance info @@ -194,7 +194,7 @@ XrInstance XrInstanceCreate() { instanceInfo.type = XR_TYPE_INSTANCE_PROPERTIES; instanceInfo.next = NULL; OXR(xrGetInstanceProperties(instanceLocal, &instanceInfo)); - ALOGV("Runtime %s: Version : %u.%u.%u", instanceInfo.runtimeName, + ALOGV("Runtime {}: Version : {}.{}.{}", instanceInfo.runtimeName, XR_VERSION_MAJOR(instanceInfo.runtimeVersion), XR_VERSION_MINOR(instanceInfo.runtimeVersion), XR_VERSION_PATCH(instanceInfo.runtimeVersion)); @@ -216,7 +216,7 @@ int32_t XrInitializeLoaderTrampoline(JavaVM* jvm, jobject activityObject) { loaderInitializeInfoAndroid.applicationContext = activityObject; xrInitializeLoaderKHR((XrLoaderInitInfoBaseHeaderKHR*)&loaderInitializeInfoAndroid); } else { - ALOGE("%s(): xrInitializeLoaderKHR is NULL", __FUNCTION__); + ALOGE("{}(): xrInitializeLoaderKHR is NULL", __FUNCTION__); return -1; } return 0; @@ -241,7 +241,7 @@ XrSession XrSessionCreate(const XrInstance& localInstance, const XrSystemId& sys XrResult initResult; OXR(initResult = xrCreateSession(localInstance, &sessionCreateInfo, &session)); if (initResult != XR_SUCCESS) { - ALOGE("Failed to create XR session: %d.", initResult); + ALOGE("Failed to create XR session: {}.", initResult); return XR_NULL_HANDLE; } return session; @@ -258,7 +258,7 @@ XrSystemId XrGetSystemId(const XrInstance& instanceLocal) { XrResult initResult; OXR(initResult = xrGetSystem(instanceLocal, &sgi, &systemId)); if (initResult != XR_SUCCESS) { - ALOGE("ERROR (%s()): Failed to get system.", __FUNCTION__); + ALOGE("ERROR ({}()): Failed to get system.", __FUNCTION__); return XR_NULL_SYSTEM_ID; } return systemId; @@ -269,14 +269,14 @@ size_t GetMaxLayerCount(const XrInstance& instanceLocal, const XrSystemId& syste systemProperties.type = XR_TYPE_SYSTEM_PROPERTIES; OXR(xrGetSystemProperties(instanceLocal, systemId, &systemProperties)); - ALOGV("System Properties: Name=%s VendorId=%x", systemProperties.systemName, + ALOGV("System Properties: Name={} VendorId={}", systemProperties.systemName, systemProperties.vendorId); - ALOGV("System Graphics Properties: MaxWidth=%d MaxHeight=%d MaxLayers=%d", + ALOGV("System Graphics Properties: MaxWidth={} MaxHeight={} MaxLayers={}", systemProperties.graphicsProperties.maxSwapchainImageWidth, systemProperties.graphicsProperties.maxSwapchainImageHeight, systemProperties.graphicsProperties.maxLayerCount); - ALOGV("System Tracking Properties: OrientationTracking=%s " - "PositionTracking=%s", + ALOGV("System Tracking Properties: OrientationTracking={} " + "PositionTracking={}", systemProperties.trackingProperties.orientationTracking ? "True" : "False", systemProperties.trackingProperties.positionTracking ? "True" : "False"); @@ -310,20 +310,20 @@ int32_t OpenXr::XrViewConfigInit() { OXR(xrEnumerateViewConfigurations(instance_, systemId_, viewportConfigTypeCount, &viewportConfigTypeCount, viewportConfigurationTypes.data())); - ALOGV("Available Viewport Configuration Types: %d", viewportConfigTypeCount); + ALOGV("Available Viewport Configuration Types: {}", viewportConfigTypeCount); bool foundSupportedViewport; for (uint32_t i = 0; i < viewportConfigTypeCount; i++) { const XrViewConfigurationType viewportConfigType = viewportConfigurationTypes[i]; - ALOGV("Viewport configuration type %d : %s", viewportConfigType, + ALOGV("Viewport configuration type {} : {}", viewportConfigType, viewportConfigType == VIEW_CONFIG_TYPE ? "Selected" : ""); XrViewConfigurationProperties viewportConfig; viewportConfig.type = XR_TYPE_VIEW_CONFIGURATION_PROPERTIES; OXR(xrGetViewConfigurationProperties(instance_, systemId_, viewportConfigType, &viewportConfig)); - ALOGV("FovMutable=%s ConfigurationType %d", viewportConfig.fovMutable ? "true" : "false", + ALOGV("FovMutable={} ConfigurationType {}", viewportConfig.fovMutable ? "true" : "false", viewportConfig.viewConfigurationType); uint32_t viewCount; @@ -347,12 +347,12 @@ int32_t OpenXr::XrViewConfigInit() { const XrViewConfigurationView* element = &elements[e]; (void)element; - ALOGV("Viewport [%d]: Recommended Width=%d Height=%d " - "SampleCount=%d", + ALOGV("Viewport [{}]: Recommended Width={} Height={} " + "SampleCount={}", e, element->recommendedImageRectWidth, element->recommendedImageRectHeight, element->recommendedSwapchainSampleCount); - ALOGV("Viewport [%d]: Max Width=%d Height=%d SampleCount=%d", e, + ALOGV("Viewport [{}]: Max Width={} Height={} SampleCount={}", e, element->maxImageRectWidth, element->maxImageRectHeight, element->maxSwapchainSampleCount); } @@ -366,7 +366,7 @@ int32_t OpenXr::XrViewConfigInit() { } } } else { - ALOGD("Empty viewport configuration type: %d", viewCount); + ALOGD("Empty viewport configuration type: {}", viewCount); } } if (!foundSupportedViewport) { @@ -490,7 +490,7 @@ int OpenXr::OpenXRInit(JavaVM* const jvm, const jobject activityObject) { const XrVersion eglVersion = XR_MAKE_VERSION(eglMajor, eglMinor, 0); if (eglVersion < graphicsRequirements.minApiVersionSupported || eglVersion > graphicsRequirements.maxApiVersionSupported) { - ALOGE("GLES version %d.%d not supported", eglMajor, eglMinor); + ALOGE("GLES version {}.{} not supported", eglMajor, eglMinor); return -5; } } diff --git a/src/android/app/src/main/jni/vr/XrController.cpp b/src/android/app/src/main/jni/vr/XrController.cpp index c04b69d82..50245f44f 100644 --- a/src/android/app/src/main/jni/vr/XrController.cpp +++ b/src/android/app/src/main/jni/vr/XrController.cpp @@ -28,7 +28,7 @@ namespace { XrAction CreateAction(XrActionSet actionSet, XrActionType type, const char* actionName, const char* localizedName, int countSubactionPaths = 0, XrPath* subactionPaths = nullptr) { - ALOG_INPUT_VERBOSE("CreateAction %s, %d" actionName, countSubactionPaths); + ALOG_INPUT_VERBOSE("CreateAction {}, {}" actionName, countSubactionPaths); XrActionCreateInfo aci = {}; aci.type = XR_TYPE_ACTION_CREATE_INFO; diff --git a/src/android/app/src/main/jni/vr/gl/Egl.cpp b/src/android/app/src/main/jni/vr/gl/Egl.cpp index 6bafecb2d..38756b798 100644 --- a/src/android/app/src/main/jni/vr/gl/Egl.cpp +++ b/src/android/app/src/main/jni/vr/gl/Egl.cpp @@ -56,7 +56,7 @@ EglContext::EglContext() { const int32_t ret = Init(); if (ret < 0) { - FAIL("EglContext::EglContext() failed: ret=%i", ret); + FAIL("EglContext::EglContext() failed: ret=%d", ret); } } @@ -68,7 +68,7 @@ EglContext::~EglContext() { int32_t EglContext::Init() { mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (mDisplay == EGL_NO_DISPLAY) { - ALOGE(" eglGetDisplay() failed: %s", EglErrorToStr(eglGetError())); + ALOGE(" eglGetDisplay() failed: {}", EglErrorToStr(eglGetError())); return -1; } { @@ -76,7 +76,7 @@ int32_t EglContext::Init() { EGLint majorVersion = 0; EGLint minorVersion = 0; if (eglInitialize(mDisplay, &majorVersion, &minorVersion) == EGL_FALSE) { - ALOGE(" eglInitialize() failed: %s", EglErrorToStr(eglGetError())); + ALOGE(" eglInitialize() failed: {}", EglErrorToStr(eglGetError())); return -2; } } @@ -98,7 +98,7 @@ int32_t EglContext::Init() { EGL_NONE}; if (eglChooseConfig(mDisplay, configAttribs, &mConfig, 1, &numConfigs) == EGL_FALSE) { - ALOGE(" eglChooseConfig() failed: %s", EglErrorToStr(eglGetError())); + ALOGE(" eglChooseConfig() failed: {}", EglErrorToStr(eglGetError())); return -3; } // print out chosen config attributes @@ -106,37 +106,37 @@ int32_t EglContext::Init() { { EGLint value = 0; eglGetConfigAttrib(mDisplay, mConfig, EGL_RED_SIZE, &value); - ALOGV(" EGL_RED_SIZE: %i", value); + ALOGV(" EGL_RED_SIZE: {}", value); } { EGLint value = 0; eglGetConfigAttrib(mDisplay, mConfig, EGL_GREEN_SIZE, &value); - ALOGV(" EGL_GREEN_SIZE: %i", value); + ALOGV(" EGL_GREEN_SIZE: {}", value); } { EGLint value = 0; eglGetConfigAttrib(mDisplay, mConfig, EGL_BLUE_SIZE, &value); - ALOGV(" EGL_BLUE_SIZE: %i", value); + ALOGV(" EGL_BLUE_SIZE: {}", value); } { EGLint value = 0; eglGetConfigAttrib(mDisplay, mConfig, EGL_ALPHA_SIZE, &value); - ALOGV(" EGL_ALPHA_SIZE: %i", value); + ALOGV(" EGL_ALPHA_SIZE: {}", value); } { EGLint value = 0; eglGetConfigAttrib(mDisplay, mConfig, EGL_DEPTH_SIZE, &value); - ALOGV(" EGL_DEPTH_SIZE: %i", value); + ALOGV(" EGL_DEPTH_SIZE: {}", value); } { EGLint value = 0; eglGetConfigAttrib(mDisplay, mConfig, EGL_STENCIL_SIZE, &value); - ALOGV(" EGL_STENCIL_SIZE: %i", value); + ALOGV(" EGL_STENCIL_SIZE: {}", value); } { EGLint value = 0; eglGetConfigAttrib(mDisplay, mConfig, EGL_SAMPLES, &value); - ALOGV(" EGL_SAMPLES: %i", value); + ALOGV(" EGL_SAMPLES: {}", value); } EGLint contextAttribs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE}; @@ -145,7 +145,7 @@ int32_t EglContext::Init() { "contextAttribs)"); mContext = eglCreateContext(mDisplay, mConfig, EGL_NO_CONTEXT, contextAttribs); if (mContext == EGL_NO_CONTEXT) { - ALOGE(" eglCreateContext() failed: %s", EglErrorToStr(eglGetError())); + ALOGE(" eglCreateContext() failed: {}", EglErrorToStr(eglGetError())); return -4; } const EGLint surfaceAttribs[] = {EGL_WIDTH, 16, EGL_HEIGHT, 16, EGL_NONE}; @@ -153,7 +153,7 @@ int32_t EglContext::Init() { "surfaceAttribs)"); mDummySurface = eglCreatePbufferSurface(mDisplay, mConfig, surfaceAttribs); if (mDummySurface == EGL_NO_SURFACE) { - ALOGE(" eglCreatePbufferSurface() failed: %s", EglErrorToStr(eglGetError())); + ALOGE(" eglCreatePbufferSurface() failed: {}", EglErrorToStr(eglGetError())); eglDestroyContext(mDisplay, mContext); mContext = EGL_NO_CONTEXT; return -5; @@ -161,7 +161,7 @@ int32_t EglContext::Init() { ALOGV(" eglMakeCurrent(mDisplay, mDummySurface, mDummySurface, " "mContext)"); if (eglMakeCurrent(mDisplay, mDummySurface, mDummySurface, mContext) == EGL_FALSE) { - ALOGE(" eglMakeCurrent() failed: %s", EglErrorToStr(eglGetError())); + ALOGE(" eglMakeCurrent() failed: {}", EglErrorToStr(eglGetError())); eglDestroySurface(mDisplay, mDummySurface); eglDestroyContext(mDisplay, mContext); mContext = EGL_NO_CONTEXT; diff --git a/src/android/app/src/main/jni/vr/layers/GameSurfaceLayer.cpp b/src/android/app/src/main/jni/vr/layers/GameSurfaceLayer.cpp index 61ae51102..3ad269dd2 100644 --- a/src/android/app/src/main/jni/vr/layers/GameSurfaceLayer.cpp +++ b/src/android/app/src/main/jni/vr/layers/GameSurfaceLayer.cpp @@ -456,7 +456,7 @@ void GameSurfaceLayer::CreateSwapchain() { xsci.mipCount = 0; ALOGI( - "GameSurfaceLayer: Creating swapchain of size %dx%d (%dx%d with resolution factor %dx)", + "GameSurfaceLayer: Creating swapchain of size {}x{} ({}x{} with resolution factor {}x)", xsci.width, xsci.height, SURFACE_WIDTH_UNSCALED, SURFACE_HEIGHT_UNSCALED, resolutionFactor_); diff --git a/src/android/app/src/main/jni/vr/utils/Common.h b/src/android/app/src/main/jni/vr/utils/Common.h index 4fbcfe8c5..5aa766637 100644 --- a/src/android/app/src/main/jni/vr/utils/Common.h +++ b/src/android/app/src/main/jni/vr/utils/Common.h @@ -21,7 +21,7 @@ License : Licensed under GPLv3 or any later version. #define BAIL_ON_COND(cond, errorStr, returnCode) \ do { \ if (cond) { \ - ALOGE("ERROR (%s): %s", __FUNCTION__, errorStr); \ + ALOGE("ERROR ({}): {}", __FUNCTION__, errorStr); \ return (returnCode); \ } \ } while (0) @@ -30,7 +30,7 @@ License : Licensed under GPLv3 or any later version. do { \ const int32_t ret = fn; \ if (ret < 0) { \ - ALOGE("ERROR (%s): %s() returned %d", __FUNCTION__, #fn, ret); \ + ALOGE("ERROR ({}): {}() returned {}", __FUNCTION__, #fn, ret); \ return (returnCode); \ } \ } while (0) diff --git a/src/android/app/src/main/jni/vr/utils/LogUtils.h b/src/android/app/src/main/jni/vr/utils/LogUtils.h index d2aaff275..ca26ee438 100644 --- a/src/android/app/src/main/jni/vr/utils/LogUtils.h +++ b/src/android/app/src/main/jni/vr/utils/LogUtils.h @@ -2,30 +2,30 @@ Filename : LogUtils.h -Content : Logging macros I define in every project +Content : Logging macros I define in every project, with Citra backend Authors : Amanda M. Watson License : Licensed under GPLv3 or any later version. Refer to the license.txt file included. *******************************************************************************/ - #pragma once +#include "common/logging/log.h" + #include + #include + #ifndef LOG_TAG #define LOG_TAG "Citra::Input" #endif -#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) -#define ALOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__) -#define ALOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) -#define ALOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__) -#ifndef NDEBUG -#define ALOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) -#else -#define ALOGD(...) -#endif + +#define ALOGE(...) LOG_ERROR(VR, __VA_ARGS__) +#define ALOGW(...) LOG_WARNING(VR, __VA_ARGS__) +#define ALOGI(...) LOG_INFO(VR, __VA_ARGS__) +#define ALOGV(...) LOG_TRACE(VR, __VA_ARGS__) +#define ALOGD(...) LOG_DEBUG(VR, __VA_ARGS__) #define FAIL(...) \ do { \ diff --git a/src/android/app/src/main/jni/vr/vr_main.cpp b/src/android/app/src/main/jni/vr/vr_main.cpp index 535e0ba58..f2ad9fbdf 100644 --- a/src/android/app/src/main/jni/vr/vr_main.cpp +++ b/src/android/app/src/main/jni/vr/vr_main.cpp @@ -64,7 +64,7 @@ void PrioritizeTid(const int tid) { OXR(pfnSetAndroidApplicationThreadKHR(gSession, XR_ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR, tid)); gPriorityTid = tid; - ALOGD("Setting prio tid from original code %d", vr::gPriorityTid); + ALOGD("Setting prio tid from original code {}", vr::gPriorityTid); } } // namespace vr @@ -89,7 +89,7 @@ void ForwardButtonStateIfNeeded(JNIEnv* jni, jobject activityObject, jmethodID forwardVRInputMethodID, const int androidButtonCode, const XrActionStateBoolean& actionState, const char* buttonName) { if (ShouldForwardButtonState(actionState)) { - ALOG_INPUT_VERBOSE("Forwarding %s button state: %d", buttonName, actionState.currentState); + ALOG_INPUT_VERBOSE("Forwarding {} button state: {}", buttonName, actionState.currentState); ForwardButtonStateChangeToCitra(jni, activityObject, forwardVRInputMethodID, androidButtonCode, actionState.currentState); } @@ -128,10 +128,10 @@ uint32_t GetDefaultGameResolutionFactorForHmd(const VRSettings::HMDType& hmdType case VRSettings::HMDType::QUEST3: return 3; case VRSettings::HMDType::UNKNOWN: - ALOGW("Warning: Unknown HMD type, using default scale factor of %d", + ALOGW("Warning: Unknown HMD type, using default scale factor of {}", kDefaultResolutionFactor); case VRSettings::HMDType::QUEST1: - ALOGW("Warning: Unsupported HMD type, using default scale factor of %d", + ALOGW("Warning: Unsupported HMD type, using default scale factor of {}", kDefaultResolutionFactor); case VRSettings::HMDType::QUEST2: case VRSettings::HMDType::QUESTPRO: @@ -157,7 +157,7 @@ class VRApp { if (mVm->AttachCurrentThread(&jni, nullptr) != JNI_OK) { // on most of the android systems, calling exit() isn't like the end // of the world. The reapers get to it within a few seconds - ALOGD("%s() ERROR: could not attach to JVM", __FUNCTION__); + ALOGD("{}() ERROR: could not attach to JVM", __FUNCTION__); exit(0); } jni->DeleteGlobalRef(mActivityObject); @@ -170,7 +170,7 @@ class VRApp { } mEnv = jni; - ALOGI("VR Extra Performance Mode: %s", + ALOGI("VR Extra Performance Mode: {}", VRSettings::values.extra_performance_mode_enabled ? "enabled" : "disabled"); // Gotta set this after the JNIEnv is attached, or else it'll be // overwritten @@ -210,7 +210,7 @@ class VRApp { ? resolutionFactorFromPreferences : defaultResolutionFactor; if (resolutionFactor != defaultResolutionFactor) { - ALOGI("Using resolution factor of %dx instead of HMD default %dx", resolutionFactor, + ALOGI("Using resolution factor of {}x instead of HMD default {}x", resolutionFactor, defaultResolutionFactor); } mGameSurfaceLayer = std::make_unique( @@ -292,7 +292,7 @@ class VRApp { // Log time to first frame if (mFrameIndex == 1) { std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now(); - ALOGI("Time to first frame: %lld ms", + ALOGI("Time to first frame: {} ms", std::chrono::duration_cast(now - gOnCreateStartTime) .count()); } @@ -530,12 +530,12 @@ class VRApp { shouldRenderCursor = mErrorMessageLayer->GetRayIntersectionWithPanel( start, end, cursorPos2d, pos3d); position = pos3d; - // ALOGI("Cursor 3D pos: %f %f %f", + // ALOGI("Cursor 3D pos: {} {} {}", // cursorPos3d.x, // cursorPos3d.y, // cursorPos3d.z); - // ALOGI("Cursor 2D coords: %f %f", cursorPos2d.x, + // ALOGI("Cursor 2D coords: {} {}", cursorPos2d.x, // cursorPos2d.y); if (triggerState.changedSinceLastSync) { mErrorMessageLayer->SendClickToWindow(cursorPos2d, @@ -545,7 +545,7 @@ class VRApp { } else { shouldRenderCursor = mGameSurfaceLayer->GetRayIntersectionWithPanel( start, end, cursorPos2d, cursorPose3d); - ALOG_INPUT_VERBOSE("Cursor 2D coords: %f %f", cursorPos2d.x, + ALOG_INPUT_VERBOSE("Cursor 2D coords: {} {}", cursorPos2d.x, cursorPos2d.y); if (triggerState.currentState == 0 && triggerState.changedSinceLastSync) { @@ -696,7 +696,7 @@ class VRApp { VRSettings::values.cpu_level)); OXR(pfnPerfSettingsSetPerformanceLevelEXT( gOpenXr->session_, XR_PERF_SETTINGS_DOMAIN_GPU_EXT, kGpuPerfLevel)); - ALOGI("%s(): Set clock levels to CPU:%d, GPU:%d", __FUNCTION__, + ALOGI("{}(): Set clock levels to CPU:{}, GPU:{}", __FUNCTION__, VRSettings::values.cpu_level, kGpuPerfLevel); PFN_xrSetAndroidApplicationThreadKHR pfnSetAndroidApplicationThreadKHR = NULL; @@ -705,7 +705,7 @@ class VRApp { (PFN_xrVoidFunction*)(&pfnSetAndroidApplicationThreadKHR))); if (vr::gPriorityTid > 0) { - ALOGD("Setting prio tid from main %d", vr::gPriorityTid); + ALOGD("Setting prio tid from main {}", vr::gPriorityTid); OXR(pfnSetAndroidApplicationThreadKHR(gOpenXr->session_, XR_ANDROID_THREAD_TYPE_RENDERER_MAIN_KHR, vr::gPriorityTid)); @@ -729,22 +729,22 @@ class VRApp { void HandleSessionStateChangedEvent(const XrEventDataSessionStateChanged& newState) { static XrSessionState lastState = XR_SESSION_STATE_UNKNOWN; if (newState.state != lastState) { - ALOGV("%s(): Received XR_SESSION_STATE_CHANGED state %s->%s " - "session=%p time=%ld", + ALOGV("{}(): Received XR_SESSION_STATE_CHANGED state {}->{} " + "session={} time={}", __func__, XrSessionStateToString(lastState), XrSessionStateToString(newState.state), newState.session, newState.time); } lastState = newState.state; switch (newState.state) { case XR_SESSION_STATE_FOCUSED: - ALOGV("%s(): Received XR_SESSION_STATE_FOCUSED event", __func__); + ALOGV("{}(): Received XR_SESSION_STATE_FOCUSED event", __func__); if (!mHasFocus) { mEnv->CallVoidMethod(mActivityObject, mResumeGameMethodID); } mHasFocus = true; break; case XR_SESSION_STATE_VISIBLE: - ALOGV("%s(): Received XR_SESSION_STATE_VISIBLE event", __func__); + ALOGV("{}(): Received XR_SESSION_STATE_VISIBLE event", __func__); if (mHasFocus) { mEnv->CallVoidMethod(mActivityObject, mPauseGameMethodID); } @@ -778,13 +778,13 @@ class VRApp { switch (baseEventHeader->type) { case XR_TYPE_EVENT_DATA_EVENTS_LOST: - ALOGV("%s(): Received " + ALOGV("{}(): Received " "XR_TYPE_EVENT_DATA_EVENTS_LOST " "event", __func__); break; case XR_TYPE_EVENT_DATA_INSTANCE_LOSS_PENDING: - ALOGV("%s(): Received " + ALOGV("{}(): Received " "XR_TYPE_EVENT_DATA_INSTANCE_LOSS_PENDING event", __func__); break; @@ -792,37 +792,37 @@ class VRApp { const XrEventDataSessionStateChanged* ssce = (XrEventDataSessionStateChanged*)(baseEventHeader); if (ssce != nullptr) { - ALOGV("%s(): Received " + ALOGV("{}(): Received " "XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED", __func__); HandleSessionStateChangedEvent(*ssce); } else { - ALOGE("%s(): Received " + ALOGE("{}(): Received " "XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED: nullptr", __func__); } } break; case XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED: - ALOGV("%s(): Received " + ALOGV("{}(): Received " "XR_TYPE_EVENT_DATA_INTERACTION_PROFILE_CHANGED event", __func__); break; case XR_TYPE_EVENT_DATA_PERF_SETTINGS_EXT: { [[maybe_unused]] const XrEventDataPerfSettingsEXT* pfs = (XrEventDataPerfSettingsEXT*)(baseEventHeader); - ALOGV("%s(): Received " - "XR_TYPE_EVENT_DATA_PERF_SETTINGS_EXT event: type %d " - "subdomain %d : level %d -> level %d", + ALOGV("{}(): Received " + "XR_TYPE_EVENT_DATA_PERF_SETTINGS_EXT event: type {} " + "subdomain {} : level {} -> level {}", __func__, pfs->type, pfs->subDomain, pfs->fromLevel, pfs->toLevel); } break; case XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING: - ALOGV("%s(): Received " + ALOGV("{}(): Received " "XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING " "event", __func__); break; default: - ALOGV("%s(): Unknown event", __func__); + ALOGV("{}(): Unknown event", __func__); break; } } @@ -895,14 +895,12 @@ extern "C" JNIEXPORT void JNICALL Java_org_citra_citra_1emu_vr_ErrorMessageLayer gShouldShowErrorMessage = should_show_error; } -extern "C" -JNIEXPORT jint JNICALL -Java_org_citra_citra_1emu_vr_VRUtils_getHMDType(JNIEnv *env, jclass clazz) { +extern "C" JNIEXPORT jint JNICALL Java_org_citra_citra_1emu_vr_VRUtils_getHMDType(JNIEnv* env, + jclass clazz) { return static_cast(VRSettings::HmdTypeFromStr(VRSettings::GetHMDTypeStr())); } -extern "C" -JNIEXPORT jint JNICALL -Java_org_citra_citra_1emu_vr_VRUtils_getDefaultResolutionFactor(JNIEnv *env, jclass clazz) { - const VRSettings::HMDType hmdType = VRSettings::HmdTypeFromStr(VRSettings::GetHMDTypeStr()); - return GetDefaultGameResolutionFactorForHmd(hmdType); -} \ No newline at end of file +extern "C" JNIEXPORT jint JNICALL +Java_org_citra_citra_1emu_vr_VRUtils_getDefaultResolutionFactor(JNIEnv* env, jclass clazz) { + const VRSettings::HMDType hmdType = VRSettings::HmdTypeFromStr(VRSettings::GetHMDTypeStr()); + return GetDefaultGameResolutionFactorForHmd(hmdType); +} diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp index 2a2b85e84..8a737b400 100644 --- a/src/common/logging/filter.cpp +++ b/src/common/logging/filter.cpp @@ -133,7 +133,8 @@ bool ParseFilterRule(Filter& instance, Iterator begin, Iterator end) { CLS(Movie) \ CLS(Loader) \ CLS(WebService) \ - CLS(RPC_Server) + CLS(RPC_Server) \ + CLS(VR) // GetClassName is a macro defined by Windows.h, grrr... const char* GetLogClassName(Class log_class) { diff --git a/src/common/logging/types.h b/src/common/logging/types.h index 8d27c18c2..24f1ce858 100644 --- a/src/common/logging/types.h +++ b/src/common/logging/types.h @@ -101,6 +101,7 @@ enum class Class : u8 { Movie, ///< Movie (Input Recording) Playback WebService, ///< Interface to Citra Web Services RPC_Server, ///< RPC server + VR, ///< VR emulation Count, ///< Total number of logging classes };