From 0fcc0994b4c3b650e3212d16895a27a2cf04ccb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 11:51:22 +0200 Subject: [PATCH 01/15] Recategorize some logging, in preparation for what's to come. --- Common/Log.h | 4 +++- Common/LogManager.cpp | 8 ++++---- Core/HLE/sceKernelModule.cpp | 2 +- Core/Screenshot.cpp | 20 +++++++------------- Core/TextureReplacer.cpp | 6 +----- Core/WaveFile.cpp | 6 ++---- GPU/Common/FramebufferManagerCommon.cpp | 3 ++- ext/native/file/chunk_file.cpp | 4 ++-- ext/native/thin3d/thin3d_gl.cpp | 16 ++++++++-------- 9 files changed, 30 insertions(+), 39 deletions(-) diff --git a/Common/Log.h b/Common/Log.h index 1b1ab1ed07..481795bde2 100644 --- a/Common/Log.h +++ b/Common/Log.h @@ -38,7 +38,7 @@ namespace LogTypes { enum LOG_TYPE { - SYSTEM = 0, + SYSTEM = 0, // Catch-all for uncategorized things BOOT, COMMON, CPU, @@ -52,6 +52,8 @@ enum LOG_TYPE { SASMIX, SAVESTATE, FRAMEBUF, + AUDIO, + IO, SCEAUDIO, SCECTRL, diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index c13a3d712f..f16971c70c 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -93,7 +93,9 @@ static const LogNameTableEntry logTable[] = { {LogTypes::MEMMAP, "MEMMAP"}, {LogTypes::SASMIX, "SASMIX"}, {LogTypes::SAVESTATE, "SAVESTATE"}, - {LogTypes::FRAMEBUF, "FRAMEBUF"}, + {LogTypes::FRAMEBUF, "FRAMEBUF"}, + {LogTypes::AUDIO, "AUDIO"}, + {LogTypes::IO, "IO"}, {LogTypes::SCEAUDIO, "SCEAUDIO"}, {LogTypes::SCECTRL, "SCECTRL"}, @@ -113,9 +115,7 @@ static const LogNameTableEntry logTable[] = { LogManager::LogManager() { for (size_t i = 0; i < ARRAY_SIZE(logTable); i++) { - if (i != logTable[i].logType) { - FLOG("Bad logtable at %i", (int)i); - } + _assert_msg_(i == logTable[i].logType, "Bad logtable at %i", (int)i); truncate_cpy(log_[logTable[i].logType].m_shortName, logTable[i].name); log_[logTable[i].logType].enabled = true; #if defined(_DEBUG) diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index c049729246..987b626d6b 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -1799,7 +1799,7 @@ void __KernelGPUReplay() { // Special ABI: s0 and s1 are the "args". Not null terminated. const char *filenamep = Memory::GetCharPointer(currentMIPS->r[MIPS_REG_S1]); if (!filenamep) { - ERROR_LOG(SYSTEM, "Failed to load dump filename"); + ERROR_LOG(G3D, "Failed to load dump filename"); Core_Stop(); return; } diff --git a/Core/Screenshot.cpp b/Core/Screenshot.cpp index fb1ef83944..74c10ca2fe 100644 --- a/Core/Screenshot.cpp +++ b/Core/Screenshot.cpp @@ -71,13 +71,12 @@ private: static bool WriteScreenshotToJPEG(const char *filename, int width, int height, int num_channels, const uint8_t *image_data, const jpge::params &comp_params) { JPEGFileStream dst_stream(filename); if (!dst_stream.Valid()) { - ERROR_LOG(SYSTEM, "Unable to open screenshot file for writing."); + ERROR_LOG(IO, "Unable to open screenshot file for writing."); return false; } jpge::jpeg_encoder dst_image; if (!dst_image.init(&dst_stream, width, height, num_channels, comp_params)) { - ERROR_LOG(SYSTEM, "Screenshot JPEG encode init failed."); return false; } @@ -85,12 +84,10 @@ static bool WriteScreenshotToJPEG(const char *filename, int width, int height, i for (int i = 0; i < height; i++) { const uint8_t *buf = image_data + i * width * num_channels; if (!dst_image.process_scanline(buf)) { - ERROR_LOG(SYSTEM, "Screenshot JPEG encode scanline failed."); return false; } } if (!dst_image.process_scanline(NULL)) { - ERROR_LOG(SYSTEM, "Screenshot JPEG encode scanline flush failed."); return false; } } @@ -106,18 +103,15 @@ static bool WriteScreenshotToJPEG(const char *filename, int width, int height, i static bool WriteScreenshotToPNG(png_imagep image, const char *filename, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) { FILE *fp = File::OpenCFile(filename, "wb"); if (!fp) { - ERROR_LOG(SYSTEM, "Unable to open screenshot file for writing."); + ERROR_LOG(IO, "Unable to open screenshot file for writing."); return false; } if (png_image_write_to_stdio(image, fp, convert_to_8bit, buffer, row_stride, colormap)) { - if (fclose(fp) != 0) { - ERROR_LOG(SYSTEM, "Screenshot file write failed."); - return false; - } + fclose(fp); return true; } else { - ERROR_LOG(SYSTEM, "Screenshot PNG encode failed."); + ERROR_LOG(IO, "Screenshot PNG encode failed."); fclose(fp); remove(filename); return false; @@ -347,7 +341,7 @@ bool TakeGameScreenshot(const char *filename, ScreenshotFormat fmt, ScreenshotTy delete [] flipbuffer; if (!success) { - ERROR_LOG(SYSTEM, "Failed to write screenshot."); + ERROR_LOG(IO, "Failed to write screenshot."); } return success; } @@ -368,7 +362,7 @@ bool Save888RGBScreenshot(const char *filename, ScreenshotFormat fmt, const u8 * png_image_free(&png); if (png.warning_or_error >= 2) { - ERROR_LOG(SYSTEM, "Saving screenshot to PNG produced errors."); + ERROR_LOG(IO, "Saving screenshot to PNG produced errors."); success = false; } return success; @@ -397,7 +391,7 @@ bool Save8888RGBAScreenshot(const char *filename, const u8 *buffer, int w, int h png_image_free(&png); if (png.warning_or_error >= 2) { - ERROR_LOG(SYSTEM, "Saving screenshot to PNG produced errors."); + ERROR_LOG(IO, "Saving screenshot to PNG produced errors."); success = false; } return success; diff --git a/Core/TextureReplacer.cpp b/Core/TextureReplacer.cpp index f403deba44..ad1de50dd4 100644 --- a/Core/TextureReplacer.cpp +++ b/Core/TextureReplacer.cpp @@ -380,15 +380,11 @@ void TextureReplacer::PopulateReplacement(ReplacedTexture *result, u64 cachekey, static bool WriteTextureToPNG(png_imagep image, const std::string &filename, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) { FILE *fp = File::OpenCFile(filename, "wb"); if (!fp) { - ERROR_LOG(SYSTEM, "Unable to open texture file for writing."); + ERROR_LOG(IO, "Unable to open texture file for writing."); return false; } if (png_image_write_to_stdio(image, fp, convert_to_8bit, buffer, row_stride, colormap)) { - if (fclose(fp) != 0) { - ERROR_LOG(SYSTEM, "Texture file write failed."); - return false; - } return true; } else { ERROR_LOG(SYSTEM, "Texture PNG encode failed."); diff --git a/Core/WaveFile.cpp b/Core/WaveFile.cpp index 038c66e80f..b1c56b002c 100644 --- a/Core/WaveFile.cpp +++ b/Core/WaveFile.cpp @@ -11,9 +11,7 @@ constexpr size_t WaveFileWriter::BUFFER_SIZE; -WaveFileWriter::WaveFileWriter() -{ -} +WaveFileWriter::WaveFileWriter() {} WaveFileWriter::~WaveFileWriter() { @@ -30,7 +28,7 @@ bool WaveFileWriter::Start(const std::string& filename, unsigned int HLESampleRa file.Open(filename, "wb"); if (!file) { - ERROR_LOG(SYSTEM, "The file %s could not be opened for writing. Please check if it's already opened by another program.", filename.c_str()); + ERROR_LOG(IO, "The file %s could not be opened for writing. Please check if it's already opened by another program.", filename.c_str()); return false; } diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 8e291942db..864cf678e6 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -887,7 +887,8 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { if (vfb) { // Okay, we found one above. - INFO_LOG_REPORT_ONCE(displayoffset, HLE, "Rendering from framebuf with offset %08x -> %08x+%dx%d", addr, vfb->fb_address, offsetX, offsetY); + // Log should be "Displaying from framebuf" but not worth changing the report. + INFO_LOG_REPORT_ONCE(displayoffset, FRAMEBUF, "Rendering from framebuf with offset %08x -> %08x+%dx%d", addr, vfb->fb_address, offsetX, offsetY); } } diff --git a/ext/native/file/chunk_file.cpp b/ext/native/file/chunk_file.cpp index 4cd4e5157c..0804040038 100644 --- a/ext/native/file/chunk_file.cpp +++ b/ext/native/file/chunk_file.cpp @@ -49,7 +49,7 @@ bool RIFFReader::Descend(uint32_t intoId) { int startLocation = pos_; if (pos_ + length > fileSize_) { - ERROR_LOG(SYSTEM, "Block extends outside of RIFF file - failing descend"); + ERROR_LOG(IO, "Block extends outside of RIFF file - failing descend"); pos_ = stack[depth_].parentStartLocation; return false; } @@ -64,7 +64,7 @@ bool RIFFReader::Descend(uint32_t intoId) { if (length > 0) { pos_ += length; // try next block } else { - ERROR_LOG(SYSTEM, "Bad data in RIFF file : block length %d. Not descending.", length); + ERROR_LOG(IO, "Bad data in RIFF file : block length %d. Not descending.", length); pos_ = stack[depth_].parentStartLocation; return false; } diff --git a/ext/native/thin3d/thin3d_gl.cpp b/ext/native/thin3d/thin3d_gl.cpp index 61ce579814..b77a8fd4fd 100644 --- a/ext/native/thin3d/thin3d_gl.cpp +++ b/ext/native/thin3d/thin3d_gl.cpp @@ -791,30 +791,30 @@ static void LogReadPixelsError(GLenum error) { case GL_NO_ERROR: break; case GL_INVALID_ENUM: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_INVALID_ENUM"); + ERROR_LOG(G3D, "glReadPixels: GL_INVALID_ENUM"); break; case GL_INVALID_VALUE: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_INVALID_VALUE"); + ERROR_LOG(G3D, "glReadPixels: GL_INVALID_VALUE"); break; case GL_INVALID_OPERATION: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_INVALID_OPERATION"); + ERROR_LOG(G3D, "glReadPixels: GL_INVALID_OPERATION"); break; case GL_INVALID_FRAMEBUFFER_OPERATION: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_INVALID_FRAMEBUFFER_OPERATION"); + ERROR_LOG(G3D, "glReadPixels: GL_INVALID_FRAMEBUFFER_OPERATION"); break; case GL_OUT_OF_MEMORY: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_OUT_OF_MEMORY"); + ERROR_LOG(G3D, "glReadPixels: GL_OUT_OF_MEMORY"); break; #ifndef USING_GLES2 case GL_STACK_UNDERFLOW: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_STACK_UNDERFLOW"); + ERROR_LOG(G3D, "glReadPixels: GL_STACK_UNDERFLOW"); break; case GL_STACK_OVERFLOW: - ERROR_LOG(FRAMEBUF, "glReadPixels: GL_STACK_OVERFLOW"); + ERROR_LOG(G3D, "glReadPixels: GL_STACK_OVERFLOW"); break; #endif default: - ERROR_LOG(FRAMEBUF, "glReadPixels: %08x", error); + ERROR_LOG(G3D, "glReadPixels: %08x", error); break; } } From 5117ded378b1ba0362eb1bfb6816447b723a1cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 12:03:39 +0200 Subject: [PATCH 02/15] Remove ELOG/ILOG/WLOG from the Android C++ code (mostly) --- Core/Debugger/WebSocket/WebSocketUtils.h | 2 + Core/Font/PGF.h | 1 - GPU/Common/TransformCommon.h | 2 +- GPU/Common/VertexDecoderCommon.h | 1 + android/jni/AndroidAudio.cpp | 21 ++-- android/jni/AndroidEGLContext.cpp | 13 ++- android/jni/AndroidJavaGLContext.cpp | 4 +- android/jni/AndroidVulkanContext.cpp | 37 +++--- android/jni/Arm64EmitterTest.cpp | 1 - android/jni/app-android.cpp | 143 +++++++++++------------ ext/native/thin3d/GLRenderManager.cpp | 18 +++ ext/native/thin3d/GLRenderManager.h | 55 +++------ 12 files changed, 151 insertions(+), 147 deletions(-) diff --git a/Core/Debugger/WebSocket/WebSocketUtils.h b/Core/Debugger/WebSocket/WebSocketUtils.h index ac75838583..93110db6a0 100644 --- a/Core/Debugger/WebSocket/WebSocketUtils.h +++ b/Core/Debugger/WebSocket/WebSocketUtils.h @@ -19,9 +19,11 @@ #include #include + #include "json/json_reader.h" #include "json/json_writer.h" #include "net/websocket_server.h" + #include "Common/Log.h" #include "ppsspp_config.h" diff --git a/Core/Font/PGF.h b/Core/Font/PGF.h index 7b721726d4..a4e3f420d8 100644 --- a/Core/Font/PGF.h +++ b/Core/Font/PGF.h @@ -22,7 +22,6 @@ #include #include -#include "Common/Log.h" #include "Common/CommonTypes.h" class PointerWrap; diff --git a/GPU/Common/TransformCommon.h b/GPU/Common/TransformCommon.h index 0c528133c5..d3b78dd663 100644 --- a/GPU/Common/TransformCommon.h +++ b/GPU/Common/TransformCommon.h @@ -18,8 +18,8 @@ #pragma once #include + #include "base/basictypes.h" -#include "Common/Log.h" #include "Common/CommonTypes.h" #include "Core/Reporting.h" #include "GPU/ge_constants.h" diff --git a/GPU/Common/VertexDecoderCommon.h b/GPU/Common/VertexDecoderCommon.h index 209186fd96..333f2b1c36 100644 --- a/GPU/Common/VertexDecoderCommon.h +++ b/GPU/Common/VertexDecoderCommon.h @@ -18,6 +18,7 @@ #pragma once #include + #include "ppsspp_config.h" #include "base/basictypes.h" #include "Common/Hashmaps.h" diff --git a/android/jni/AndroidAudio.cpp b/android/jni/AndroidAudio.cpp index 98cf3a87be..56145b516e 100644 --- a/android/jni/AndroidAudio.cpp +++ b/android/jni/AndroidAudio.cpp @@ -1,4 +1,5 @@ -#include "base/logging.h" +#include "Common/Log.h" + #include "android/jni/AndroidAudio.h" #include "android/jni/OpenSLContext.h" @@ -31,13 +32,13 @@ AndroidAudioState *AndroidAudio_Init(AndroidAudioCallback callback, int optimalF bool AndroidAudio_Resume(AndroidAudioState *state) { if (!state) { - ELOG("Audio was shutdown, cannot resume!"); + ERROR_LOG(AUDIO, "Audio was shutdown, cannot resume!"); return false; } if (!state->ctx) { - ILOG("Calling OpenSLWrap_Init_T..."); + INFO_LOG(AUDIO, "Calling OpenSLWrap_Init_T..."); state->ctx = new OpenSLContext(state->callback, state->frames_per_buffer, state->sample_rate); - ILOG("Returned from OpenSLWrap_Init_T"); + INFO_LOG(AUDIO, "Returned from OpenSLWrap_Init_T"); bool init_retval = state->ctx->Init(); if (!init_retval) { delete state->ctx; @@ -50,14 +51,14 @@ bool AndroidAudio_Resume(AndroidAudioState *state) { bool AndroidAudio_Pause(AndroidAudioState *state) { if (!state) { - ELOG("Audio was shutdown, cannot pause!"); + ERROR_LOG(AUDIO, "Audio was shutdown, cannot pause!"); return false; } if (state->ctx) { - ILOG("Calling OpenSLWrap_Shutdown_T..."); + INFO_LOG(AUDIO, "Calling OpenSLWrap_Shutdown_T..."); delete state->ctx; state->ctx = nullptr; - ILOG("Returned from OpenSLWrap_Shutdown_T ..."); + INFO_LOG(AUDIO, "Returned from OpenSLWrap_Shutdown_T ..."); return true; } return false; @@ -65,14 +66,14 @@ bool AndroidAudio_Pause(AndroidAudioState *state) { bool AndroidAudio_Shutdown(AndroidAudioState *state) { if (!state) { - ELOG("Audio already shutdown!"); + ERROR_LOG(AUDIO, "Audio already shutdown!"); return false; } if (state->ctx) { - ELOG("Should not shut down when playing! Something is wrong!"); + ERROR_LOG(AUDIO, "Should not shut down when playing! Something is wrong!"); return false; } delete state; - ILOG("OpenSLWrap completely unloaded."); + INFO_LOG(AUDIO, "OpenSLWrap completely unloaded."); return true; } diff --git a/android/jni/AndroidEGLContext.cpp b/android/jni/AndroidEGLContext.cpp index de58b828c1..97b4ecd55a 100644 --- a/android/jni/AndroidEGLContext.cpp +++ b/android/jni/AndroidEGLContext.cpp @@ -1,25 +1,26 @@ #include -#include "base/logging.h" + #include "base/NativeApp.h" #include "gfx_es2/gpu_features.h" #include "thin3d/thin3d_create.h" +#include "Common/Log.h" #include "AndroidEGLContext.h" #include "GL/GLInterface/EGLAndroid.h" #include "Core/ConfigValues.h" #include "Core/System.h" bool AndroidEGLGraphicsContext::InitFromRenderThread(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) { - ILOG("AndroidEGLGraphicsContext::Init()"); + INFO_LOG(G3D, "AndroidEGLGraphicsContext::Init()"); wnd_ = wnd; gl = HostGL_CreateGLInterface(); if (!gl) { - ELOG("ERROR: Failed to create GL interface"); + ERROR_LOG(G3D, "ERROR: Failed to create GL interface"); return false; } int backbufferWidth = desiredBackbufferSizeX; int backbufferHeight = desiredBackbufferSizeY; - ILOG("EGL interface created. Desired backbuffer size: %dx%d", backbufferWidth, backbufferHeight); + INFO_LOG(G3D, "EGL interface created. Desired backbuffer size: %dx%d", backbufferWidth, backbufferHeight); // Apparently we still have to set this through Java through setFixedSize on the bufferHolder for it to take effect... gl->SetBackBufferDimensions(backbufferWidth, backbufferHeight); @@ -39,7 +40,7 @@ bool AndroidEGLGraphicsContext::InitFromRenderThread(ANativeWindow *wnd, int des } if (!gl->Create(wnd, false, use565)) { - ELOG("EGL creation failed! (use565=%d)", (int)use565); + ERROR_LOG(G3D, "EGL creation failed! (use565=%d)", (int)use565); // TODO: What do we do now? delete gl; return false; @@ -58,7 +59,7 @@ bool AndroidEGLGraphicsContext::InitFromRenderThread(ANativeWindow *wnd, int des } void AndroidEGLGraphicsContext::ShutdownFromRenderThread() { - ILOG("AndroidEGLGraphicsContext::Shutdown"); + INFO_LOG(G3D, "AndroidEGLGraphicsContext::Shutdown"); renderManager_->WaitUntilQueueIdle(); renderManager_ = nullptr; // owned by draw_. delete draw_; diff --git a/android/jni/AndroidJavaGLContext.cpp b/android/jni/AndroidJavaGLContext.cpp index d1b8e17a6a..36a2259f43 100644 --- a/android/jni/AndroidJavaGLContext.cpp +++ b/android/jni/AndroidJavaGLContext.cpp @@ -13,7 +13,7 @@ AndroidJavaEGLGraphicsContext::AndroidJavaEGLGraphicsContext() { } bool AndroidJavaEGLGraphicsContext::InitFromRenderThread(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) { - ILOG("AndroidJavaEGLGraphicsContext::InitFromRenderThread"); + INFO_LOG(G3D, "AndroidJavaEGLGraphicsContext::InitFromRenderThread"); CheckGLExtensions(); // OpenGL handles rotated rendering in the driver. g_display_rotation = DisplayRotation::ROTATE_0; @@ -26,7 +26,7 @@ bool AndroidJavaEGLGraphicsContext::InitFromRenderThread(ANativeWindow *wnd, int } void AndroidJavaEGLGraphicsContext::ShutdownFromRenderThread() { - ILOG("AndroidJavaEGLGraphicsContext::Shutdown"); + INFO_LOG(G3D, "AndroidJavaEGLGraphicsContext::Shutdown"); renderManager_->WaitUntilQueueIdle(); renderManager_ = nullptr; // owned by draw_. delete draw_; diff --git a/android/jni/AndroidVulkanContext.cpp b/android/jni/AndroidVulkanContext.cpp index 76fc4d3e3c..b61ad99b84 100644 --- a/android/jni/AndroidVulkanContext.cpp +++ b/android/jni/AndroidVulkanContext.cpp @@ -3,6 +3,7 @@ #include "AndroidVulkanContext.h" #include "base/NativeApp.h" #include "base/display.h" +#include "Common/Log.h" #include "Common/Vulkan/VulkanContext.h" #include "Common/Vulkan/VulkanDebug.h" #include "Common/Vulkan/VulkanLoader.h" @@ -28,18 +29,18 @@ static uint32_t FlagsFromConfig() { } bool AndroidVulkanContext::InitAPI() { - ILOG("AndroidVulkanContext::Init"); + INFO_LOG(G3D, "AndroidVulkanContext::Init"); init_glslang(); g_LogOptions.breakOnError = true; g_LogOptions.breakOnWarning = true; g_LogOptions.msgBoxOnError = false; - ILOG("Creating Vulkan context"); + INFO_LOG(G3D, "Creating Vulkan context"); Version gitVer(PPSSPP_GIT_VERSION); if (!VulkanLoad()) { - ELOG("Failed to load Vulkan driver library"); + ERROR_LOG(G3D, "Failed to load Vulkan driver library"); return false; } @@ -54,7 +55,7 @@ bool AndroidVulkanContext::InitAPI() { info.flags = FlagsFromConfig(); VkResult res = g_Vulkan->CreateInstance(info); if (res != VK_SUCCESS) { - ELOG("Failed to create vulkan context: %s", g_Vulkan->InitError().c_str()); + ERROR_LOG(G3D, "Failed to create vulkan context: %s", g_Vulkan->InitError().c_str()); VulkanSetAvailable(false); delete g_Vulkan; g_Vulkan = nullptr; @@ -63,7 +64,7 @@ bool AndroidVulkanContext::InitAPI() { int physicalDevice = g_Vulkan->GetBestPhysicalDevice(); if (physicalDevice < 0) { - ELOG("No usable Vulkan device found."); + ERROR_LOG(G3D, "No usable Vulkan device found."); g_Vulkan->DestroyInstance(); delete g_Vulkan; g_Vulkan = nullptr; @@ -72,9 +73,9 @@ bool AndroidVulkanContext::InitAPI() { g_Vulkan->ChooseDevice(physicalDevice); - ILOG("Creating Vulkan device"); + INFO_LOG(G3D, "Creating Vulkan device"); if (g_Vulkan->CreateDevice() != VK_SUCCESS) { - ILOG("Failed to create vulkan device: %s", g_Vulkan->InitError().c_str()); + INFO_LOG(G3D, "Failed to create vulkan device: %s", g_Vulkan->InitError().c_str()); System_SendMessage("toast", "No Vulkan driver found. Using OpenGL instead."); g_Vulkan->DestroyInstance(); delete g_Vulkan; @@ -82,20 +83,20 @@ bool AndroidVulkanContext::InitAPI() { return false; } - ILOG("Vulkan device created!"); + INFO_LOG(G3D, "Vulkan device created!"); return true; } bool AndroidVulkanContext::InitFromRenderThread(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) { - ILOG("AndroidVulkanContext::InitFromRenderThread: desiredwidth=%d desiredheight=%d", desiredBackbufferSizeX, desiredBackbufferSizeY); + INFO_LOG(G3D, "AndroidVulkanContext::InitFromRenderThread: desiredwidth=%d desiredheight=%d", desiredBackbufferSizeX, desiredBackbufferSizeY); if (!g_Vulkan) { - ELOG("AndroidVulkanContext::InitFromRenderThread: No Vulkan context"); + ERROR_LOG(G3D, "AndroidVulkanContext::InitFromRenderThread: No Vulkan context"); return false; } VkResult res = g_Vulkan->InitSurface(WINDOWSYSTEM_ANDROID, (void *)wnd, nullptr); if (res != VK_SUCCESS) { - ELOG("g_Vulkan->InitSurface failed: '%s'", VulkanResultToString(res)); + ERROR_LOG(G3D, "g_Vulkan->InitSurface failed: '%s'", VulkanResultToString(res)); return false; } @@ -114,7 +115,7 @@ bool AndroidVulkanContext::InitFromRenderThread(ANativeWindow *wnd, int desiredB success = false; } - ILOG("AndroidVulkanContext::Init completed, %s", success ? "successfully" : "but failed"); + INFO_LOG(G3D, "AndroidVulkanContext::Init completed, %s", success ? "successfully" : "but failed"); if (!success) { g_Vulkan->DestroySwapchain(); g_Vulkan->DestroySurface(); @@ -125,7 +126,7 @@ bool AndroidVulkanContext::InitFromRenderThread(ANativeWindow *wnd, int desiredB } void AndroidVulkanContext::ShutdownFromRenderThread() { - ILOG("AndroidVulkanContext::Shutdown"); + INFO_LOG(G3D, "AndroidVulkanContext::Shutdown"); draw_->HandleEvent(Draw::Event::LOST_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); delete draw_; draw_ = nullptr; @@ -133,23 +134,23 @@ void AndroidVulkanContext::ShutdownFromRenderThread() { g_Vulkan->PerformPendingDeletes(); g_Vulkan->DestroySwapchain(); g_Vulkan->DestroySurface(); - ILOG("Done with ShutdownFromRenderThread"); + INFO_LOG(G3D, "Done with ShutdownFromRenderThread"); } void AndroidVulkanContext::Shutdown() { - ILOG("Calling NativeShutdownGraphics"); + INFO_LOG(G3D, "Calling NativeShutdownGraphics"); g_Vulkan->DestroyDevice(); g_Vulkan->DestroyInstance(); // We keep the g_Vulkan context around to avoid invalidating a ton of pointers around the app. finalize_glslang(); - ILOG("AndroidVulkanContext::Shutdown completed"); + INFO_LOG(G3D, "AndroidVulkanContext::Shutdown completed"); } void AndroidVulkanContext::SwapBuffers() { } void AndroidVulkanContext::Resize() { - ILOG("AndroidVulkanContext::Resize begin (oldsize: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); + INFO_LOG(G3D, "AndroidVulkanContext::Resize begin (oldsize: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); draw_->HandleEvent(Draw::Event::LOST_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); g_Vulkan->DestroySwapchain(); @@ -160,7 +161,7 @@ void AndroidVulkanContext::Resize() { g_Vulkan->ReinitSurface(); g_Vulkan->InitSwapchain(); draw_->HandleEvent(Draw::Event::GOT_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); - ILOG("AndroidVulkanContext::Resize end (final size: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); + INFO_LOG(G3D, "AndroidVulkanContext::Resize end (final size: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); } void AndroidVulkanContext::SwapInterval(int interval) { diff --git a/android/jni/Arm64EmitterTest.cpp b/android/jni/Arm64EmitterTest.cpp index b9240fc352..e14c98532d 100644 --- a/android/jni/Arm64EmitterTest.cpp +++ b/android/jni/Arm64EmitterTest.cpp @@ -1,5 +1,4 @@ #include "base/logging.h" -#include "Arm64EmitterTest.h" #include "Common/Arm64Emitter.h" #include "Common/BitSet.h" diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 0ac1036011..aad11b14f1 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -15,7 +15,6 @@ #ifndef _MSC_VER #include -#include #include #elif !defined(JNIEXPORT) // Just for better highlighting in MSVC if opening this file. @@ -52,7 +51,6 @@ struct JNIEnv {}; #include "base/stringutil.h" #include "base/display.h" #include "base/NativeApp.h" -#include "base/logging.h" #include "base/timeutil.h" #include "thread/threadutil.h" #include "file/zip_read.h" @@ -66,6 +64,7 @@ struct JNIEnv {}; #include "gfx/gl_common.h" #include "gfx_es2/gpu_features.h" +#include "Common/Log.h" #include "Common/GraphicsContext.h" #include "AndroidGraphicsContext.h" #include "AndroidVulkanContext.h" @@ -191,7 +190,7 @@ jclass findClass(const char* name) { } JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *pjvm, void *reserved) { - ILOG("JNI_OnLoad"); + INFO_LOG(SYSTEM, "JNI_OnLoad"); gJvm = pjvm; // cache the JavaVM pointer auto env = getEnv(); //replace with one of your classes in the line below @@ -211,20 +210,20 @@ static void EmuThreadFunc() { gJvm->AttachCurrentThread(&env, nullptr); setCurrentThreadName("Emu"); - ILOG("Entering emu thread"); + INFO_LOG(SYSTEM, "Entering emu thread"); // Wait for render loop to get started. if (!graphicsContext || !graphicsContext->Initialized()) { - ILOG("Runloop: Waiting for displayInit..."); + INFO_LOG(SYSTEM, "Runloop: Waiting for displayInit..."); while (!graphicsContext || !graphicsContext->Initialized()) { sleep_ms(20); } } else { - ILOG("Runloop: Graphics context available! %p", graphicsContext); + INFO_LOG(SYSTEM, "Runloop: Graphics context available! %p", graphicsContext); } NativeInitGraphics(graphicsContext); - ILOG("Graphics initialized. Entering loop."); + INFO_LOG(SYSTEM, "Graphics initialized. Entering loop."); // There's no real requirement that NativeInit happen on this thread. // We just call the update/render loop here. @@ -232,7 +231,7 @@ static void EmuThreadFunc() { while (emuThreadState != (int)EmuThreadState::QUIT_REQUESTED) { UpdateRunLoopAndroid(env); } - ILOG("QUIT_REQUESTED found, left loop. Setting state to STOPPED."); + INFO_LOG(SYSTEM, "QUIT_REQUESTED found, left loop. Setting state to STOPPED."); emuThreadState = (int)EmuThreadState::STOPPED; NativeShutdownGraphics(); @@ -241,11 +240,11 @@ static void EmuThreadFunc() { graphicsContext->StopThread(); gJvm->DetachCurrentThread(); - ILOG("Leaving emu thread"); + INFO_LOG(SYSTEM, "Leaving emu thread"); } static void EmuThreadStart() { - ILOG("EmuThreadStart"); + INFO_LOG(SYSTEM, "EmuThreadStart"); emuThreadState = (int)EmuThreadState::START_REQUESTED; emuThread = std::thread(&EmuThreadFunc); } @@ -254,14 +253,14 @@ static void EmuThreadStart() { // as long as emuThreadState isn't STOPPED and/or there are still things queued up. // Only after that, call EmuThreadJoin. static void EmuThreadStop(const char *caller) { - ILOG("EmuThreadStop - stopping (%s)...", caller); + INFO_LOG(SYSTEM, "EmuThreadStop - stopping (%s)...", caller); emuThreadState = (int)EmuThreadState::QUIT_REQUESTED; } static void EmuThreadJoin() { emuThread.join(); emuThread = std::thread(); - ILOG("EmuThreadJoin - joined"); + INFO_LOG(SYSTEM, "EmuThreadJoin - joined"); } static void ProcessFrameCommands(JNIEnv *env); @@ -496,7 +495,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_init // Makes sure we get early permission grants. ProcessFrameCommands(env); - ILOG("NativeApp.init() -- begin"); + INFO_LOG(SYSTEM, "NativeApp.init() -- begin"); PROFILE_INIT(); renderer_inited = false; @@ -516,7 +515,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_init systemName = GetJavaString(env, jmodel); langRegion = GetJavaString(env, jlangRegion); - ILOG("NativeApp.init(): device name: '%s'", systemName.c_str()); + INFO_LOG(SYSTEM, "NativeApp.init(): device name: '%s'", systemName.c_str()); std::string externalDir = GetJavaString(env, jexternalDir); std::string user_data_path = GetJavaString(env, jdataDir); @@ -527,8 +526,8 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_init std::string cacheDir = GetJavaString(env, jcacheDir); std::string buildBoard = GetJavaString(env, jboard); boardName = buildBoard; - ILOG("NativeApp.init(): External storage path: %s", externalDir.c_str()); - ILOG("NativeApp.init(): Launch shortcut parameter: %s", shortcut_param.c_str()); + INFO_LOG(SYSTEM, "NativeApp.init(): External storage path: %s", externalDir.c_str()); + INFO_LOG(SYSTEM, "NativeApp.init(): Launch shortcut parameter: %s", shortcut_param.c_str()); std::string app_name; std::string app_nice_name; @@ -567,7 +566,7 @@ retry: case (int)GPUBackend::OPENGL: useCPUThread = true; if (javaGL) { - ILOG("NativeApp.init() -- creating OpenGL context (JavaGL)"); + INFO_LOG(SYSTEM, "NativeApp.init() -- creating OpenGL context (JavaGL)"); graphicsContext = new AndroidJavaEGLGraphicsContext(); } else { graphicsContext = new AndroidEGLGraphicsContext(); @@ -575,12 +574,12 @@ retry: break; case (int)GPUBackend::VULKAN: { - ILOG("NativeApp.init() -- creating Vulkan context"); + INFO_LOG(SYSTEM, "NativeApp.init() -- creating Vulkan context"); useCPUThread = false; // The Vulkan render manager manages its own thread. // We create and destroy the Vulkan graphics context in the "EGL" thread. AndroidVulkanContext *ctx = new AndroidVulkanContext(); if (!ctx->InitAPI()) { - ILOG("Failed to initialize Vulkan, switching to OpenGL"); + INFO_LOG(SYSTEM, "Failed to initialize Vulkan, switching to OpenGL"); g_Config.iGPUBackend = (int)GPUBackend::OPENGL; SetGPUBackend(GPUBackend::OPENGL); goto retry; @@ -590,13 +589,13 @@ retry: break; } default: - ELOG("NativeApp.init(): iGPUBackend %d not supported. Switching to OpenGL.", (int)g_Config.iGPUBackend); + ERROR_LOG(SYSTEM, "NativeApp.init(): iGPUBackend %d not supported. Switching to OpenGL.", (int)g_Config.iGPUBackend); g_Config.iGPUBackend = (int)GPUBackend::OPENGL; goto retry; } if (useCPUThread) { - ILOG("NativeApp.init() - launching emu thread"); + INFO_LOG(SYSTEM, "NativeApp.init() - launching emu thread"); EmuThreadStart(); } } @@ -619,11 +618,11 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_audioInit(JNIEnv *, jclass) { sampleRate = 44100; } - ILOG("NativeApp.audioInit() -- Using OpenSL audio! frames/buffer: %i optimal sr: %i actual sr: %i", optimalFramesPerBuffer, optimalSampleRate, sampleRate); + INFO_LOG(AUDIO, "NativeApp.audioInit() -- Using OpenSL audio! frames/buffer: %i optimal sr: %i actual sr: %i", optimalFramesPerBuffer, optimalSampleRate, sampleRate); if (!g_audioState) { g_audioState = AndroidAudio_Init(&NativeMix, framesPerBuffer, sampleRate); } else { - ELOG("Audio state already initialized"); + ERROR_LOG(AUDIO, "Audio state already initialized"); } } @@ -632,17 +631,17 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_audioShutdown(JNIEnv *, jclass) AndroidAudio_Shutdown(g_audioState); g_audioState = nullptr; } else { - ELOG("Audio state already shutdown!"); + ERROR_LOG(AUDIO, "Audio state already shutdown!"); } } extern "C" void Java_org_ppsspp_ppsspp_NativeApp_resume(JNIEnv *, jclass) { - ILOG("NativeApp.resume() - resuming audio"); + INFO_LOG(SYSTEM, "NativeApp.resume() - resuming audio"); AndroidAudio_Resume(g_audioState); } extern "C" void Java_org_ppsspp_ppsspp_NativeApp_pause(JNIEnv *, jclass) { - ILOG("NativeApp.pause() - pausing audio"); + INFO_LOG(SYSTEM, "NativeApp.pause() - pausing audio"); AndroidAudio_Pause(g_audioState); } @@ -650,31 +649,31 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) { if (renderer_inited && useCPUThread && graphicsContext) { // Only used in Java EGL path. EmuThreadStop("shutdown"); - ILOG("BeginAndroidShutdown"); + INFO_LOG(SYSTEM, "BeginAndroidShutdown"); graphicsContext->BeginAndroidShutdown(); // Skipping GL calls, the old context is gone. while (graphicsContext->ThreadFrame()) { - ILOG("graphicsContext->ThreadFrame executed to clear buffers"); + INFO_LOG(SYSTEM, "graphicsContext->ThreadFrame executed to clear buffers"); } - ILOG("Joining emuthread"); + INFO_LOG(SYSTEM, "Joining emuthread"); EmuThreadJoin(); - ILOG("Joined emuthread"); + INFO_LOG(SYSTEM, "Joined emuthread"); graphicsContext->ThreadEnd(); graphicsContext->ShutdownFromRenderThread(); - ILOG("Graphics context now shut down from NativeApp_shutdown"); + INFO_LOG(SYSTEM, "Graphics context now shut down from NativeApp_shutdown"); } - ILOG("NativeApp.shutdown() -- begin"); + INFO_LOG(SYSTEM, "NativeApp.shutdown() -- begin"); if (renderer_inited) { - ILOG("Shutting down renderer"); + INFO_LOG(G3D, "Shutting down renderer"); // This will be from the wrong thread? :/ graphicsContext->Shutdown(); delete graphicsContext; graphicsContext = nullptr; renderer_inited = false; } else { - ILOG("Not shutting down renderer - not initialized"); + INFO_LOG(G3D, "Not shutting down renderer - not initialized"); } inputBoxCallbacks.clear(); @@ -682,7 +681,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) { VFSShutdown(); while (frameCommands.size()) frameCommands.pop(); - ILOG("NativeApp.shutdown() -- end"); + INFO_LOG(SYSTEM, "NativeApp.shutdown() -- end"); } // JavaEGL @@ -691,16 +690,16 @@ extern "C" bool Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env, std::string errorMessage; if (renderer_inited) { // Would be really nice if we could get something on the GL thread immediately when shutting down. - ILOG("NativeApp.displayInit() restoring"); + INFO_LOG(G3D, "NativeApp.displayInit() restoring"); if (useCPUThread) { EmuThreadStop("displayInit"); graphicsContext->BeginAndroidShutdown(); - ILOG("BeginAndroidShutdown. Looping until emu thread done..."); + INFO_LOG(G3D, "BeginAndroidShutdown. Looping until emu thread done..."); // Skipping GL calls here because the old context is lost. while (graphicsContext->ThreadFrame()) { continue; } - ILOG("Joining emu thread"); + INFO_LOG(G3D, "Joining emu thread"); EmuThreadJoin(); } else { NativeShutdownGraphics(); @@ -708,7 +707,7 @@ extern "C" bool Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env, graphicsContext->ThreadEnd(); graphicsContext->ShutdownFromRenderThread(); - ILOG("Shut down both threads. Now let's bring it up again!"); + INFO_LOG(G3D, "Shut down both threads. Now let's bring it up again!"); if (!graphicsContext->InitFromRenderThread(nullptr, 0, 0, 0, 0)) { SystemToast("Graphics initialization failed. Quitting."); @@ -726,9 +725,9 @@ extern "C" bool Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env, } graphicsContext->ThreadStart(); - ILOG("Restored."); + INFO_LOG(G3D, "Restored."); } else { - ILOG("NativeApp.displayInit() first time"); + INFO_LOG(G3D, "NativeApp.displayInit() first time"); if (!graphicsContext->InitFromRenderThread(nullptr, 0, 0, 0, 0)) { SystemToast("Graphics initialization failed. Quitting."); return false; @@ -758,15 +757,15 @@ static void recalculateDpi() { pixel_in_dps_x = (float)pixel_xres / dp_xres; pixel_in_dps_y = (float)pixel_yres / dp_yres; - ILOG("RecalcDPI: display_xres=%d display_yres=%d", display_xres, display_yres); - ILOG("RecalcDPI: g_dpi=%f g_dpi_scale_x=%f g_dpi_scale_y=%f", g_dpi, g_dpi_scale_x, g_dpi_scale_y); - ILOG("RecalcDPI: dp_xscale=%f dp_yscale=%f", dp_xscale, dp_yscale); - ILOG("RecalcDPI: dp_xres=%d dp_yres=%d", dp_xres, dp_yres); - ILOG("RecalcDPI: pixel_xres=%d pixel_yres=%d", pixel_xres, pixel_yres); + INFO_LOG(G3D, "RecalcDPI: display_xres=%d display_yres=%d", display_xres, display_yres); + INFO_LOG(G3D, "RecalcDPI: g_dpi=%f g_dpi_scale_x=%f g_dpi_scale_y=%f", g_dpi, g_dpi_scale_x, g_dpi_scale_y); + INFO_LOG(G3D, "RecalcDPI: dp_xscale=%f dp_yscale=%f", dp_xscale, dp_yscale); + INFO_LOG(G3D, "RecalcDPI: dp_xres=%d dp_yres=%d", dp_xres, dp_yres); + INFO_LOG(G3D, "RecalcDPI: pixel_xres=%d pixel_yres=%d", pixel_xres, pixel_yres); } extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv *, jclass, jint bufw, jint bufh, jint format) { - ILOG("NativeApp.backbufferResize(%d x %d)", bufw, bufh); + INFO_LOG(SYSTEM, "NativeApp.backbufferResize(%d x %d)", bufw, bufh); bool new_size = pixel_xres != bufw || pixel_yres != bufh; int old_w = pixel_xres; @@ -779,10 +778,10 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv recalculateDpi(); if (new_size) { - ILOG("Size change detected (previously %d,%d) - calling NativeResized()", old_w, old_h); + INFO_LOG(G3D, "Size change detected (previously %d,%d) - calling NativeResized()", old_w, old_h); NativeResized(); } else { - ILOG("NativeApp::backbufferResize: Size didn't change."); + INFO_LOG(G3D, "NativeApp::backbufferResize: Size didn't change."); } } @@ -801,20 +800,20 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_sendInputBox(JNIEnv *en static std::string lastSeqID = ""; if (lastSeqID == seqID) { // We send this on dismiss, so twice in many cases. - DLOG("Ignoring duplicate sendInputBox"); + DEBUG_LOG(SYSTEM, "Ignoring duplicate sendInputBox"); return; } lastSeqID = seqID; int seq = 0; if (!TryParse(seqID, &seq)) { - ELOG("Invalid inputbox seqID value: %s", seqID.c_str()); + ERROR_LOG(SYSTEM, "Invalid inputbox seqID value: %s", seqID.c_str()); return; } auto entry = inputBoxCallbacks.find(seq); if (entry == inputBoxCallbacks.end()) { - ELOG("Did not find inputbox callback for %s, shutdown?", seqID.c_str()); + ERROR_LOG(SYSTEM, "Did not find inputbox callback for %s, shutdown?", seqID.c_str()); return; } @@ -988,19 +987,19 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_sendMessage(JNIEnv *env if (msg == "moga") { mogaVersion = prm; } else if (msg == "permission_pending") { - ILOG("STORAGE PERMISSION: PENDING"); + INFO_LOG(SYSTEM, "STORAGE PERMISSION: PENDING"); // TODO: Add support for other permissions permissions[SYSTEM_PERMISSION_STORAGE] = PERMISSION_STATUS_PENDING; } else if (msg == "permission_denied") { - ILOG("STORAGE PERMISSION: DENIED"); + INFO_LOG(SYSTEM, "STORAGE PERMISSION: DENIED"); permissions[SYSTEM_PERMISSION_STORAGE] = PERMISSION_STATUS_DENIED; } else if (msg == "permission_granted") { - ILOG("STORAGE PERMISSION: GRANTED"); + INFO_LOG(SYSTEM, "STORAGE PERMISSION: GRANTED"); permissions[SYSTEM_PERMISSION_STORAGE] = PERMISSION_STATUS_GRANTED; } else if (msg == "sustained_perf_supported") { sustainedPerfSupported = true; } else if (msg == "safe_insets") { - ILOG("Got insets: %s", prm.c_str()); + INFO_LOG(SYSTEM, "Got insets: %s", prm.c_str()); // We don't bother with supporting exact rectangular regions. Safe insets are good enough. int left, right, top, bottom; if (4 == sscanf(prm.c_str(), "%d:%d:%d:%d", &left, &right, &top, &bottom)) { @@ -1017,7 +1016,7 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_sendMessage(JNIEnv *env extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeActivity_exitEGLRenderLoop(JNIEnv *env, jobject obj) { if (!renderLoopRunning) { - ELOG("Render loop already exited"); + ERROR_LOG(SYSTEM, "Render loop already exited"); return; } exitRenderLoop = true; @@ -1030,7 +1029,7 @@ void correctRatio(int &sz_x, int &sz_y, float scale) { float x = (float)sz_x; float y = (float)sz_y; float ratio = x / y; - ILOG("CorrectRatio: Considering size: %0.2f/%0.2f=%0.2f for scale %f", x, y, ratio, scale); + INFO_LOG(G3D, "CorrectRatio: Considering size: %0.2f/%0.2f=%0.2f for scale %f", x, y, ratio, scale); float targetRatio; // Try to get the longest dimension to match scale*PSP resolution. @@ -1045,7 +1044,7 @@ void correctRatio(int &sz_x, int &sz_y, float scale) { } float correction = targetRatio / ratio; - ILOG("Target ratio: %0.2f ratio: %0.2f correction: %0.2f", targetRatio, ratio, correction); + INFO_LOG(G3D, "Target ratio: %0.2f ratio: %0.2f correction: %0.2f", targetRatio, ratio, correction); if (ratio < targetRatio) { y *= correction; } else { @@ -1054,7 +1053,7 @@ void correctRatio(int &sz_x, int &sz_y, float scale) { sz_x = x; sz_y = y; - ILOG("Corrected ratio: %dx%d", sz_x, sz_y); + INFO_LOG(G3D, "Corrected ratio: %dx%d", sz_x, sz_y); } void getDesiredBackbufferSize(int &sz_x, int &sz_y) { @@ -1071,7 +1070,7 @@ void getDesiredBackbufferSize(int &sz_x, int &sz_y) { } extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_setDisplayParameters(JNIEnv *, jclass, jint xres, jint yres, jint dpi, jfloat refreshRate) { - ILOG("NativeApp.setDisplayParameters(%d x %d, dpi=%d, refresh=%0.2f)", xres, yres, dpi, refreshRate); + INFO_LOG(G3D, "NativeApp.setDisplayParameters(%d x %d, dpi=%d, refresh=%0.2f)", xres, yres, dpi, refreshRate); bool changed = false; changed = changed || display_xres != xres || display_yres != yres; changed = changed || display_dpi_x != dpi || display_dpi_y != dpi; @@ -1156,7 +1155,7 @@ static void ProcessFrameCommands(JNIEnv *env) { frameCmd = frameCommands.front(); frameCommands.pop(); - ILOG("frameCommand '%s' '%s'", frameCmd.command.c_str(), frameCmd.params.c_str()); + INFO_LOG(SYSTEM, "frameCommand '%s' '%s'", frameCmd.command.c_str(), frameCmd.params.c_str()); jstring cmd = env->NewStringUTF(frameCmd.command.c_str()); jstring param = env->NewStringUTF(frameCmd.params.c_str()); @@ -1168,7 +1167,7 @@ static void ProcessFrameCommands(JNIEnv *env) { extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(JNIEnv *env, jobject obj, jobject _surf) { if (!graphicsContext) { - ELOG("runEGLRenderLoop: Tried to enter without a created graphics context."); + ERROR_LOG(G3D, "runEGLRenderLoop: Tried to enter without a created graphics context."); return false; } @@ -1180,10 +1179,10 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J ANativeWindow *wnd = _surf ? ANativeWindow_fromSurface(env, _surf) : nullptr; - WLOG("runEGLRenderLoop. display_xres=%d display_yres=%d", display_xres, display_yres); + WARN_LOG(G3D, "runEGLRenderLoop. display_xres=%d display_yres=%d", display_xres, display_yres); if (wnd == nullptr) { - ELOG("Error: Surface is null."); + ERROR_LOG(G3D, "Error: Surface is null."); renderLoopRunning = false; return false; } @@ -1192,7 +1191,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J if (graphicsContext->InitFromRenderThread(wnd, desiredBackbufferSizeX, desiredBackbufferSizeY, backbuffer_format, androidVersion)) { return true; } else { - ELOG("Failed to initialize graphics context."); + ERROR_LOG(G3D, "Failed to initialize graphics context."); SystemToast("Failed to initialize graphics context."); return false; } @@ -1201,7 +1200,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J bool initSuccess = tryInit(); if (!initSuccess) { if (!exitRenderLoop && g_Config.iGPUBackend == (int)GPUBackend::VULKAN) { - ILOG("Trying again, this time with OpenGL."); + INFO_LOG(G3D, "Trying again, this time with OpenGL."); SetGPUBackend(GPUBackend::OPENGL); g_Config.iGPUBackend = (int)GetGPUBackend(); @@ -1220,7 +1219,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J if (!exitRenderLoop) { if (!useCPUThread) { if (!NativeInitGraphics(graphicsContext)) { - ELOG("Failed to initialize graphics."); + ERROR_LOG(G3D, "Failed to initialize graphics."); // Gonna be in a weird state here.. } } @@ -1237,7 +1236,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J } if (useCPUThread) { - ELOG("Running graphics loop"); + ERROR_LOG(SYSTEM, "Running graphics loop"); while (!exitRenderLoop) { // This is the "GPU thread". graphicsContext->ThreadFrame(); @@ -1256,7 +1255,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J } } - ILOG("Leaving EGL/Vulkan render loop."); + INFO_LOG(G3D, "Leaving EGL/Vulkan render loop."); if (useCPUThread) { EmuThreadStop("exitrenderloop"); @@ -1271,10 +1270,10 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runEGLRenderLoop(J graphicsContext->ThreadEnd(); // Shut the graphics context down to the same state it was in when we entered the render thread. - ILOG("Shutting down graphics context from render thread..."); + INFO_LOG(G3D, "Shutting down graphics context from render thread..."); graphicsContext->ShutdownFromRenderThread(); renderLoopRunning = false; - WLOG("Render loop function exited."); + WARN_LOG(G3D, "Render loop function exited."); return true; } diff --git a/ext/native/thin3d/GLRenderManager.cpp b/ext/native/thin3d/GLRenderManager.cpp index 220b54aec4..f21f67aac0 100644 --- a/ext/native/thin3d/GLRenderManager.cpp +++ b/ext/native/thin3d/GLRenderManager.cpp @@ -20,6 +20,24 @@ static bool OnRenderThread() { } #endif +void GLDeleter::Take(GLDeleter &other) { + _assert_msg_(IsEmpty(), "Deleter already has stuff"); + shaders = std::move(other.shaders); + programs = std::move(other.programs); + buffers = std::move(other.buffers); + textures = std::move(other.textures); + inputLayouts = std::move(other.inputLayouts); + framebuffers = std::move(other.framebuffers); + pushBuffers = std::move(other.pushBuffers); + other.shaders.clear(); + other.programs.clear(); + other.buffers.clear(); + other.textures.clear(); + other.inputLayouts.clear(); + other.framebuffers.clear(); + other.pushBuffers.clear(); +} + // Runs on the GPU thread. void GLDeleter::Perform(GLRenderManager *renderManager, bool skipGLCalls) { for (auto pushBuffer : pushBuffers) { diff --git a/ext/native/thin3d/GLRenderManager.h b/ext/native/thin3d/GLRenderManager.h index 13aa599741..3e5870507d 100644 --- a/ext/native/thin3d/GLRenderManager.h +++ b/ext/native/thin3d/GLRenderManager.h @@ -8,9 +8,7 @@ #include #include #include -#include -#include "base/logging.h" #include "gfx/gl_common.h" #include "math/dataconv.h" #include "Common/Log.h" @@ -30,6 +28,7 @@ public: glDeleteTextures(1, &texture); } } + GLuint texture = 0; // Could also trust OpenGL defaults I guess.. GLenum target = 0xFFFF; @@ -217,7 +216,7 @@ private: // Note: we must defrag because some buffers may be smaller than size_. Defragment(); Map(); - assert(writePtr_); + _dbg_assert_(writePtr_); } void BeginNoReset() { @@ -253,14 +252,14 @@ public: // Returns the offset that should be used when binding this buffer to get this data. size_t Push(const void *data, size_t size, GLRBuffer **vkbuf) { - assert(writePtr_); + _dbg_assert_(writePtr_); size_t off = Allocate(size, vkbuf); memcpy(writePtr_ + off, data, size); return off; } uint32_t PushAligned(const void *data, size_t size, int align, GLRBuffer **vkbuf) { - assert(writePtr_); + _dbg_assert_(writePtr_); offset_ = (offset_ + align - 1) & ~(align - 1); size_t off = Allocate(size, vkbuf); memcpy(writePtr_ + off, data, size); @@ -274,13 +273,13 @@ public: // "Zero-copy" variant - you can write the data directly as you compute it. // Recommended. void *Push(size_t size, uint32_t *bindOffset, GLRBuffer **vkbuf) { - assert(writePtr_); + _dbg_assert_(writePtr_); size_t off = Allocate(size, vkbuf); *bindOffset = (uint32_t)off; return writePtr_ + off; } void *PushAligned(size_t size, uint32_t *bindOffset, GLRBuffer **vkbuf, int align) { - assert(writePtr_); + _dbg_assert_(writePtr_); offset_ = (offset_ + align - 1) & ~(align - 1); size_t off = Allocate(size, vkbuf); *bindOffset = (uint32_t)off; @@ -324,23 +323,7 @@ public: return shaders.empty() && programs.empty() && buffers.empty() && textures.empty() && inputLayouts.empty() && framebuffers.empty() && pushBuffers.empty(); } - void Take(GLDeleter &other) { - _assert_msg_(IsEmpty(), "Deleter already has stuff"); - shaders = std::move(other.shaders); - programs = std::move(other.programs); - buffers = std::move(other.buffers); - textures = std::move(other.textures); - inputLayouts = std::move(other.inputLayouts); - framebuffers = std::move(other.framebuffers); - pushBuffers = std::move(other.pushBuffers); - other.shaders.clear(); - other.programs.clear(); - other.buffers.clear(); - other.textures.clear(); - other.inputLayouts.clear(); - other.framebuffers.clear(); - other.pushBuffers.clear(); - } + void Take(GLDeleter &other); std::vector shaders; std::vector programs; @@ -431,7 +414,7 @@ public: std::vector shaders, std::vector semantics, std::vector queries, std::vector initalizers, bool supportDualSource) { GLRInitStep step{ GLRInitStepType::CREATE_PROGRAM }; - assert(shaders.size() <= ARRAY_SIZE(step.create_program.shaders)); + _assert_(shaders.size() <= ARRAY_SIZE(step.create_program.shaders)); step.create_program.program = new GLRProgram(); step.create_program.program->semantics_ = semantics; step.create_program.program->queries_ = queries; @@ -443,10 +426,10 @@ public: } #ifdef _DEBUG for (auto &iter : queries) { - assert(iter.name); + _dbg_assert_(iter.name); } for (auto &sem : semantics) { - assert(sem.attrib); + _dbg_assert_(sem.attrib); } #endif step.create_program.num_shaders = (int)shaders.size(); @@ -616,7 +599,7 @@ public: void BindVertexBuffer(GLRInputLayout *inputLayout, GLRBuffer *buffer, size_t offset) { _dbg_assert_(curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER); - assert(inputLayout); + _dbg_assert_(inputLayout); GLRRenderData data{ GLRRenderCommand::BIND_VERTEX_BUFFER }; data.bindVertexBuffer.inputLayout = inputLayout; data.bindVertexBuffer.offset = offset; @@ -650,7 +633,7 @@ public: void SetUniformI(const GLint *loc, int count, const int *udata) { _dbg_assert_(curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER); #ifdef _DEBUG - assert(curProgram_); + _dbg_assert_(curProgram_); #endif GLRRenderData data{ GLRRenderCommand::UNIFORM4I }; data.uniform4.loc = loc; @@ -662,7 +645,7 @@ public: void SetUniformI1(const GLint *loc, int udata) { _dbg_assert_(curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER); #ifdef _DEBUG - assert(curProgram_); + _dbg_assert_(curProgram_); #endif GLRRenderData data{ GLRRenderCommand::UNIFORM4I }; data.uniform4.loc = loc; @@ -674,7 +657,7 @@ public: void SetUniformF(const GLint *loc, int count, const float *udata) { _dbg_assert_(curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER); #ifdef _DEBUG - assert(curProgram_); + _dbg_assert_(curProgram_); #endif GLRRenderData data{ GLRRenderCommand::UNIFORM4F }; data.uniform4.loc = loc; @@ -686,7 +669,7 @@ public: void SetUniformF1(const GLint *loc, const float udata) { _dbg_assert_(curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER); #ifdef _DEBUG - assert(curProgram_); + _dbg_assert_(curProgram_); #endif GLRRenderData data{ GLRRenderCommand::UNIFORM4F }; data.uniform4.loc = loc; @@ -698,7 +681,7 @@ public: void SetUniformF(const char *name, int count, const float *udata) { _dbg_assert_(curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER); #ifdef _DEBUG - assert(curProgram_); + _dbg_assert_(curProgram_); #endif GLRRenderData data{ GLRRenderCommand::UNIFORM4F }; data.uniform4.name = name; @@ -710,7 +693,7 @@ public: void SetUniformM4x4(const GLint *loc, const float *udata) { _dbg_assert_(curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER); #ifdef _DEBUG - assert(curProgram_); + _dbg_assert_(curProgram_); #endif GLRRenderData data{ GLRRenderCommand::UNIFORMMATRIX }; data.uniformMatrix4.loc = loc; @@ -721,7 +704,7 @@ public: void SetUniformM4x4(const char *name, const float *udata) { _dbg_assert_(curRenderStep_ && curRenderStep_->stepType == GLRStepType::RENDER); #ifdef _DEBUG - assert(curProgram_); + _dbg_assert_(curProgram_); #endif GLRRenderData data{ GLRRenderCommand::UNIFORMMATRIX }; data.uniformMatrix4.name = name; @@ -902,7 +885,7 @@ public: foundCount++; } } - assert(foundCount == 1); + _dbg_assert_(foundCount == 1); } void SetSwapFunction(std::function swapFunction) { From 8835728f87f9e57905a8bb5066bdb30f7124b53f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 12:12:57 +0200 Subject: [PATCH 03/15] Replace base/logging.h in VulkanContext and parts of native --- Common/Vulkan/VulkanContext.cpp | 124 ++++++++++++------------ Common/Vulkan/VulkanContext.h | 2 +- Common/Vulkan/VulkanImage.cpp | 10 +- Common/Vulkan/VulkanMemory.cpp | 39 ++++---- GPU/Vulkan/VulkanUtil.cpp | 1 + ext/native/thin3d/VulkanQueueRunner.cpp | 68 ++++++------- ext/native/ui/screen.h | 1 - ext/native/ui/view.h | 1 - ext/native/ui/viewgroup.cpp | 6 ++ ext/native/ui/viewgroup.h | 7 +- 10 files changed, 130 insertions(+), 129 deletions(-) diff --git a/Common/Vulkan/VulkanContext.cpp b/Common/Vulkan/VulkanContext.cpp index 7d483f11ad..2cb47926f0 100644 --- a/Common/Vulkan/VulkanContext.cpp +++ b/Common/Vulkan/VulkanContext.cpp @@ -1,12 +1,12 @@ #define __STDC_LIMIT_MACROS #include #include -#include #include #include #include "base/basictypes.h" #include "base/display.h" +#include "Common/Log.h" #include "Common/Vulkan/VulkanContext.h" #include "Common/Vulkan/VulkanDebug.h" #include "GPU/Common/ShaderCommon.h" @@ -139,9 +139,9 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { } instance_extensions_enabled_.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); extensionsLookup_.EXT_debug_utils = true; - ILOG("Vulkan debug_utils validation enabled."); + INFO_LOG(G3D, "Vulkan debug_utils validation enabled."); } else { - ELOG("Validation layer extension not available - not enabling Vulkan validation."); + ERROR_LOG(G3D, "Validation layer extension not available - not enabling Vulkan validation."); flags_ &= ~VULKAN_FLAG_VALIDATE; } } @@ -154,7 +154,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { // Validate that all the instance extensions we ask for are actually available. for (auto ext : instance_extensions_enabled_) { if (!IsInstanceExtensionAvailable(ext)) - WLOG("WARNING: Does not seem that instance extension '%s' is available. Trying to proceed anyway.", ext); + WARN_LOG(G3D, "WARNING: Does not seem that instance extension '%s' is available. Trying to proceed anyway.", ext); } VkApplicationInfo app_info{ VK_STRUCTURE_TYPE_APPLICATION_INFO }; @@ -180,7 +180,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { #endif if (res != VK_SUCCESS) { if (res == VK_ERROR_LAYER_NOT_PRESENT) { - WLOG("Validation on but instance layer not available - dropping layers"); + WARN_LOG(G3D, "Validation on but instance layer not available - dropping layers"); // Drop the validation layers and try again. instance_layer_names_.clear(); device_layer_names_.clear(); @@ -188,9 +188,9 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { inst_info.ppEnabledLayerNames = nullptr; res = vkCreateInstance(&inst_info, nullptr, &instance_); if (res != VK_SUCCESS) - ELOG("Failed to create instance even without validation: %d", res); + ERROR_LOG(G3D, "Failed to create instance even without validation: %d", res); } else { - ELOG("Failed to create instance : %d", res); + ERROR_LOG(G3D, "Failed to create instance : %d", res); } } if (res != VK_SUCCESS) { @@ -200,7 +200,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { VulkanLoadInstanceFunctions(instance_, extensionsLookup_); if (!CheckLayers(instance_layer_properties_, instance_layer_names_)) { - WLOG("CheckLayers for instance failed"); + WARN_LOG(G3D, "CheckLayers for instance failed"); // init_error_ = "Failed to validate instance layers"; // return; } @@ -212,14 +212,14 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { res = vkEnumeratePhysicalDevices(instance_, &gpu_count, nullptr); #endif if (gpu_count <= 0) { - ELOG("Vulkan driver found but no supported GPU is available"); + ERROR_LOG(G3D, "Vulkan driver found but no supported GPU is available"); init_error_ = "No Vulkan physical devices found"; vkDestroyInstance(instance_, nullptr); instance_ = nullptr; return VK_ERROR_INITIALIZATION_FAILED; } - assert(gpu_count > 0); + _dbg_assert_(gpu_count > 0); physical_devices_.resize(gpu_count); physicalDeviceProperties_.resize(gpu_count); res = vkEnumeratePhysicalDevices(instance_, &gpu_count, physical_devices_.data()); @@ -259,7 +259,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { } VulkanContext::~VulkanContext() { - assert(instance_ == VK_NULL_HANDLE); + _dbg_assert_(instance_ == VK_NULL_HANDLE); } void VulkanContext::DestroyInstance() { @@ -290,7 +290,7 @@ void VulkanContext::EndFrame() { } void VulkanContext::UpdateInflightFrames(int n) { - assert(n >= 1 && n <= MAX_INFLIGHT_FRAMES); + _dbg_assert_(n >= 1 && n <= MAX_INFLIGHT_FRAMES); inflightFrames_ = n; if (curFrame_ >= inflightFrames_) { curFrame_ = 0; @@ -508,19 +508,19 @@ int VulkanContext::GetBestPhysicalDevice() { void VulkanContext::ChooseDevice(int physical_device) { physical_device_ = physical_device; - ILOG("Chose physical device %d: %p", physical_device, physical_devices_[physical_device]); + INFO_LOG(G3D, "Chose physical device %d: %p", physical_device, physical_devices_[physical_device]); GetDeviceLayerProperties(); if (!CheckLayers(device_layer_properties_, device_layer_names_)) { - WLOG("CheckLayers for device %d failed", physical_device); + WARN_LOG(G3D, "CheckLayers for device %d failed", physical_device); } vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, nullptr); - assert(queue_count >= 1); + _dbg_assert_(queue_count >= 1); queueFamilyProperties_.resize(queue_count); vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, queueFamilyProperties_.data()); - assert(queue_count >= 1); + _dbg_assert_(queue_count >= 1); // Detect preferred formats, in this order. static const VkFormat depthStencilFormats[] = { @@ -539,17 +539,17 @@ void VulkanContext::ChooseDevice(int physical_device) { } if (deviceInfo_.preferredDepthStencilFormat == VK_FORMAT_UNDEFINED) { // WTF? This is bad. - ELOG("Could not find a usable depth stencil format."); + ERROR_LOG(G3D, "Could not find a usable depth stencil format."); } // This is as good a place as any to do this. vkGetPhysicalDeviceMemoryProperties(physical_devices_[physical_device_], &memory_properties); - ILOG("Memory Types (%d):", memory_properties.memoryTypeCount); + INFO_LOG(G3D, "Memory Types (%d):", memory_properties.memoryTypeCount); for (int i = 0; i < (int)memory_properties.memoryTypeCount; i++) { // Don't bother printing dummy memory types. if (!memory_properties.memoryTypes[i].propertyFlags) continue; - ILOG(" %d: Heap %d; Flags: %s%s%s%s ", i, memory_properties.memoryTypes[i].heapIndex, + INFO_LOG(G3D, " %d: Heap %d; Flags: %s%s%s%s ", i, memory_properties.memoryTypes[i].heapIndex, (memory_properties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) ? "DEVICE_LOCAL " : "", (memory_properties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) ? "HOST_VISIBLE " : "", (memory_properties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) ? "HOST_CACHED " : "", @@ -611,7 +611,7 @@ bool VulkanContext::EnableDeviceExtension(const char *extension) { VkResult VulkanContext::CreateDevice() { if (!init_error_.empty() || physical_device_ < 0) { - ELOG("Vulkan init failed: %s", init_error_.c_str()); + ERROR_LOG(G3D, "Vulkan init failed: %s", init_error_.c_str()); return VK_ERROR_INITIALIZATION_FAILED; } @@ -627,7 +627,7 @@ VkResult VulkanContext::CreateDevice() { break; } } - assert(found); + _dbg_assert_(found); extensionsLookup_.KHR_maintenance1 = EnableDeviceExtension(VK_KHR_MAINTENANCE1_EXTENSION_NAME); extensionsLookup_.KHR_maintenance2 = EnableDeviceExtension(VK_KHR_MAINTENANCE2_EXTENSION_NAME); @@ -661,11 +661,11 @@ VkResult VulkanContext::CreateDevice() { VkResult res = vkCreateDevice(physical_devices_[physical_device_], &device_info, nullptr, &device_); if (res != VK_SUCCESS) { init_error_ = "Unable to create Vulkan device"; - ELOG("Unable to create Vulkan device"); + ERROR_LOG(G3D, "Unable to create Vulkan device"); } else { VulkanLoadDeviceFunctions(device_, extensionsLookup_); } - ILOG("Device created.\n"); + INFO_LOG(G3D, "Device created.\n"); VulkanSetAvailable(true); return res; } @@ -685,10 +685,10 @@ VkResult VulkanContext::InitDebugUtilsCallback() { VkDebugUtilsMessengerEXT messenger; VkResult res = vkCreateDebugUtilsMessengerEXT(instance_, &callback1, nullptr, &messenger); if (res != VK_SUCCESS) { - ELOG("Failed to register debug callback with vkCreateDebugUtilsMessengerEXT"); + ERROR_LOG(G3D, "Failed to register debug callback with vkCreateDebugUtilsMessengerEXT"); // Do error handling for VK_ERROR_OUT_OF_MEMORY } else { - ILOG("Debug callback registered with vkCreateDebugUtilsMessengerEXT."); + INFO_LOG(G3D, "Debug callback registered with vkCreateDebugUtilsMessengerEXT."); utils_callbacks.push_back(messenger); } return res; @@ -711,12 +711,12 @@ VkResult VulkanContext::InitSurface(WindowSystem winsys, void *data1, void *data VkResult VulkanContext::ReinitSurface() { if (surface_ != VK_NULL_HANDLE) { - ILOG("Destroying Vulkan surface (%d, %d)", swapChainExtent_.width, swapChainExtent_.height); + INFO_LOG(G3D, "Destroying Vulkan surface (%d, %d)", swapChainExtent_.width, swapChainExtent_.height); vkDestroySurfaceKHR(instance_, surface_, nullptr); surface_ = VK_NULL_HANDLE; } - ILOG("Creating Vulkan surface for window (%p %p)", winsysData1_, winsysData2_); + INFO_LOG(G3D, "Creating Vulkan surface for window (%p %p)", winsysData1_, winsysData2_); VkResult retval = VK_SUCCESS; @@ -842,7 +842,7 @@ bool VulkanContext::ChooseQueue() { // Generate error if could not find both a graphics and a present queue if (graphicsQueueNodeIndex == UINT32_MAX || presentQueueNodeIndex == UINT32_MAX) { - ELOG("Could not find a graphics and a present queue"); + ERROR_LOG(G3D, "Could not find a graphics and a present queue"); return false; } @@ -858,7 +858,7 @@ bool VulkanContext::ChooseQueue() { std::vector surfFormats(formatCount); res = vkGetPhysicalDeviceSurfaceFormatsKHR(physical_devices_[physical_device_], surface_, &formatCount, surfFormats.data()); - assert(res == VK_SUCCESS); + _dbg_assert_(res == VK_SUCCESS); if (res != VK_SUCCESS) { return false; } @@ -866,7 +866,7 @@ bool VulkanContext::ChooseQueue() { // the surface has no preferred format. Otherwise, at least one // supported format will be returned. if (formatCount == 0 || (formatCount == 1 && surfFormats[0].format == VK_FORMAT_UNDEFINED)) { - ILOG("swapchain_format: Falling back to B8G8R8A8_UNORM"); + INFO_LOG(G3D, "swapchain_format: Falling back to B8G8R8A8_UNORM"); swapchainFormat_ = VK_FORMAT_B8G8R8A8_UNORM; } else { swapchainFormat_ = VK_FORMAT_UNDEFINED; @@ -884,7 +884,7 @@ bool VulkanContext::ChooseQueue() { // Okay, take the first one then. swapchainFormat_ = surfFormats[0].format; } - ILOG("swapchain_format: %d (/%d)", swapchainFormat_, formatCount); + INFO_LOG(G3D, "swapchain_format: %d (/%d)", swapchainFormat_, formatCount); } vkGetDeviceQueue(device_, graphics_queue_family_index_, 0, &gfx_queue_); @@ -915,20 +915,20 @@ static std::string surface_transforms_to_string(VkSurfaceTransformFlagsKHR trans bool VulkanContext::InitSwapchain() { VkResult res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_devices_[physical_device_], surface_, &surfCapabilities_); - assert(res == VK_SUCCESS); + _dbg_assert_(res == VK_SUCCESS); uint32_t presentModeCount; res = vkGetPhysicalDeviceSurfacePresentModesKHR(physical_devices_[physical_device_], surface_, &presentModeCount, nullptr); - assert(res == VK_SUCCESS); + _dbg_assert_(res == VK_SUCCESS); VkPresentModeKHR *presentModes = new VkPresentModeKHR[presentModeCount]; - assert(presentModes); + _dbg_assert_(presentModes); res = vkGetPhysicalDeviceSurfacePresentModesKHR(physical_devices_[physical_device_], surface_, &presentModeCount, presentModes); - assert(res == VK_SUCCESS); + _dbg_assert_(res == VK_SUCCESS); swapChainExtent_.width = clamp(surfCapabilities_.currentExtent.width, surfCapabilities_.minImageExtent.width, surfCapabilities_.maxImageExtent.width); swapChainExtent_.height = clamp(surfCapabilities_.currentExtent.height, surfCapabilities_.minImageExtent.height, surfCapabilities_.maxImageExtent.height); - ILOG("surfCapabilities_.current: %dx%d min: %dx%d max: %dx%d computed: %dx%d", + INFO_LOG(G3D, "surfCapabilities_.current: %dx%d min: %dx%d max: %dx%d computed: %dx%d", surfCapabilities_.currentExtent.width, surfCapabilities_.currentExtent.height, surfCapabilities_.minImageExtent.width, surfCapabilities_.minImageExtent.height, surfCapabilities_.maxImageExtent.width, surfCapabilities_.maxImageExtent.height, @@ -944,7 +944,7 @@ bool VulkanContext::InitSwapchain() { modes += ", "; } } - ILOG("Supported present modes: %s", modes.c_str()); + INFO_LOG(G3D, "Supported present modes: %s", modes.c_str()); for (size_t i = 0; i < presentModeCount; i++) { bool match = false; match = match || ((flags_ & VULKAN_FLAG_PRESENT_MAILBOX) && presentModes[i] == VK_PRESENT_MODE_MAILBOX_KHR); @@ -976,7 +976,7 @@ bool VulkanContext::InitSwapchain() { desiredNumberOfSwapChainImages = surfCapabilities_.maxImageCount; } - ILOG("Chosen present mode: %d (%s). numSwapChainImages: %d/%d", + INFO_LOG(G3D, "Chosen present mode: %d (%s). numSwapChainImages: %d/%d", swapchainPresentMode, PresentModeString(swapchainPresentMode), desiredNumberOfSwapChainImages, surfCapabilities_.maxImageCount); @@ -1011,7 +1011,7 @@ bool VulkanContext::InitSwapchain() { std::swap(swapChainExtent_.width, swapChainExtent_.height); break; default: - assert(false); + _dbg_assert_(false); } } else { // Let the OS rotate the image (potentially slow on many Android devices) @@ -1020,10 +1020,10 @@ bool VulkanContext::InitSwapchain() { std::string preTransformStr = surface_transforms_to_string(preTransform); - ILOG("Transform supported: %s current: %s chosen: %s", supportedTransforms.c_str(), currentTransform.c_str(), preTransformStr.c_str()); + INFO_LOG(G3D, "Transform supported: %s current: %s chosen: %s", supportedTransforms.c_str(), currentTransform.c_str(), preTransformStr.c_str()); if (physicalDeviceProperties_[physical_device_].properties.vendorID == VULKAN_VENDOR_IMGTEC) { - ILOG("Applying PowerVR hack (rounding off the width!)"); + INFO_LOG(G3D, "Applying PowerVR hack (rounding off the width!)"); // Swap chain width hack to avoid issue #11743 (PowerVR driver bug). // To keep the size consistent even with pretransform, do this after the swap. Should be fine. // This is fixed in newer PowerVR drivers but I don't know the cutoff. @@ -1068,10 +1068,10 @@ bool VulkanContext::InitSwapchain() { res = vkCreateSwapchainKHR(device_, &swap_chain_info, NULL, &swapchain_); if (res != VK_SUCCESS) { - ELOG("vkCreateSwapchainKHR failed!"); + ERROR_LOG(G3D, "vkCreateSwapchainKHR failed!"); return false; } - ILOG("Created swapchain: %dx%d", swap_chain_info.imageExtent.width, swap_chain_info.imageExtent.height); + INFO_LOG(G3D, "Created swapchain: %dx%d", swap_chain_info.imageExtent.width, swap_chain_info.imageExtent.height); return true; } @@ -1092,13 +1092,13 @@ void VulkanContext::PerformPendingDeletes() { void VulkanContext::DestroyDevice() { if (swapchain_) { - ELOG("DestroyDevice: Swapchain should have been destroyed."); + ERROR_LOG(G3D, "DestroyDevice: Swapchain should have been destroyed."); } if (surface_) { - ELOG("DestroyDevice: Surface should have been destroyed."); + ERROR_LOG(G3D, "DestroyDevice: Surface should have been destroyed."); } - ILOG("VulkanContext::DestroyDevice (performing deletes)"); + INFO_LOG(G3D, "VulkanContext::DestroyDevice (performing deletes)"); PerformPendingDeletes(); vkDestroyDevice(device_, nullptr); @@ -1274,22 +1274,22 @@ const char *VulkanResultToString(VkResult res) { } void VulkanDeleteList::Take(VulkanDeleteList &del) { - assert(cmdPools_.empty()); - assert(descPools_.empty()); - assert(modules_.empty()); - assert(buffers_.empty()); - assert(bufferViews_.empty()); - assert(images_.empty()); - assert(imageViews_.empty()); - assert(deviceMemory_.empty()); - assert(samplers_.empty()); - assert(pipelines_.empty()); - assert(pipelineCaches_.empty()); - assert(renderPasses_.empty()); - assert(framebuffers_.empty()); - assert(pipelineLayouts_.empty()); - assert(descSetLayouts_.empty()); - assert(callbacks_.empty()); + _dbg_assert_(cmdPools_.empty()); + _dbg_assert_(descPools_.empty()); + _dbg_assert_(modules_.empty()); + _dbg_assert_(buffers_.empty()); + _dbg_assert_(bufferViews_.empty()); + _dbg_assert_(images_.empty()); + _dbg_assert_(imageViews_.empty()); + _dbg_assert_(deviceMemory_.empty()); + _dbg_assert_(samplers_.empty()); + _dbg_assert_(pipelines_.empty()); + _dbg_assert_(pipelineCaches_.empty()); + _dbg_assert_(renderPasses_.empty()); + _dbg_assert_(framebuffers_.empty()); + _dbg_assert_(pipelineLayouts_.empty()); + _dbg_assert_(descSetLayouts_.empty()); + _dbg_assert_(callbacks_.empty()); cmdPools_ = std::move(del.cmdPools_); descPools_ = std::move(del.descPools_); modules_ = std::move(del.modules_); diff --git a/Common/Vulkan/VulkanContext.h b/Common/Vulkan/VulkanContext.h index 7c9174f38f..b1c998b8b5 100644 --- a/Common/Vulkan/VulkanContext.h +++ b/Common/Vulkan/VulkanContext.h @@ -1,11 +1,11 @@ #pragma once #include +#include #include #include #include -#include "base/logging.h" #include "Common/Vulkan/VulkanLoader.h" #include "Common/Vulkan/VulkanDebug.h" diff --git a/Common/Vulkan/VulkanImage.cpp b/Common/Vulkan/VulkanImage.cpp index 247df10ff9..82d07cd264 100644 --- a/Common/Vulkan/VulkanImage.cpp +++ b/Common/Vulkan/VulkanImage.cpp @@ -67,7 +67,7 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, VulkanDeviceAllocator *all VkResult res = vkCreateImage(vulkan_->GetDevice(), &image_create_info, NULL, &image_); if (res != VK_SUCCESS) { _assert_(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY || res == VK_ERROR_TOO_MANY_OBJECTS); - ELOG("vkCreateImage failed: %s", VulkanResultToString(res)); + ERROR_LOG(G3D, "vkCreateImage failed: %s", VulkanResultToString(res)); return false; } @@ -82,7 +82,7 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, VulkanDeviceAllocator *all allocator_ = allocator; offset_ = allocator_->Allocate(mem_reqs, &mem_, Tag()); if (offset_ == VulkanDeviceAllocator::ALLOCATE_FAILED) { - ELOG("Image memory allocation failed (mem_reqs.size=%d, typebits=%08x", (int)mem_reqs.size, (int)mem_reqs.memoryTypeBits); + ERROR_LOG(G3D, "Image memory allocation failed (mem_reqs.size=%d, typebits=%08x", (int)mem_reqs.size, (int)mem_reqs.memoryTypeBits); // Destructor will take care of the image. return false; } @@ -103,7 +103,7 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, VulkanDeviceAllocator *all res = vkAllocateMemory(vulkan_->GetDevice(), &mem_alloc, NULL, &mem_); if (res != VK_SUCCESS) { - ELOG("vkAllocateMemory failed: %s", VulkanResultToString(res)); + ERROR_LOG(G3D, "vkAllocateMemory failed: %s", VulkanResultToString(res)); _assert_msg_(res != VK_ERROR_TOO_MANY_OBJECTS, "Too many Vulkan memory objects!"); _assert_(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY || res == VK_ERROR_TOO_MANY_OBJECTS); return false; @@ -114,7 +114,7 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, VulkanDeviceAllocator *all res = vkBindImageMemory(vulkan_->GetDevice(), image_, mem_, offset_); if (res != VK_SUCCESS) { - ELOG("vkBindImageMemory failed: %s", VulkanResultToString(res)); + ERROR_LOG(G3D, "vkBindImageMemory failed: %s", VulkanResultToString(res)); // This leaks the image and memory. Should not really happen though... _assert_(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY || res == VK_ERROR_TOO_MANY_OBJECTS); return false; @@ -156,7 +156,7 @@ bool VulkanTexture::CreateDirect(VkCommandBuffer cmd, VulkanDeviceAllocator *all res = vkCreateImageView(vulkan_->GetDevice(), &view_info, NULL, &view_); if (res != VK_SUCCESS) { - ELOG("vkCreateImageView failed: %s", VulkanResultToString(res)); + ERROR_LOG(G3D, "vkCreateImageView failed: %s", VulkanResultToString(res)); // This leaks the image. _assert_(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY || res == VK_ERROR_TOO_MANY_OBJECTS); return false; diff --git a/Common/Vulkan/VulkanMemory.cpp b/Common/Vulkan/VulkanMemory.cpp index 9cead85745..062472c377 100644 --- a/Common/Vulkan/VulkanMemory.cpp +++ b/Common/Vulkan/VulkanMemory.cpp @@ -18,19 +18,20 @@ // Additionally, Common/Vulkan/* , including this file, are also licensed // under the public domain. -#include "Common/Log.h" -#include "Common/Vulkan/VulkanMemory.h" #include "base/timeutil.h" #include "math/math_util.h" +#include "Common/Log.h" +#include "Common/Vulkan/VulkanMemory.h" + VulkanPushBuffer::VulkanPushBuffer(VulkanContext *vulkan, size_t size, VkBufferUsageFlags usage, VkMemoryPropertyFlags memoryPropertyMask) : vulkan_(vulkan), memoryPropertyMask_(memoryPropertyMask), size_(size), usage_(usage) { bool res = AddBuffer(); - assert(res); + _assert_(res); } VulkanPushBuffer::~VulkanPushBuffer() { - assert(buffers_.empty()); + _assert_(buffers_.empty()); } bool VulkanPushBuffer::AddBuffer() { @@ -68,7 +69,7 @@ bool VulkanPushBuffer::AddBuffer() { } res = vkBindBufferMemory(device, info.buffer, info.deviceMemory, 0); if (VK_SUCCESS != res) { - ELOG("vkBindBufferMemory failed! result=%d", (int)res); + ERROR_LOG(G3D, "vkBindBufferMemory failed! result=%d", (int)res); vkFreeMemory(device, info.deviceMemory, nullptr); vkDestroyBuffer(device, info.buffer, nullptr); return false; @@ -100,7 +101,7 @@ void VulkanPushBuffer::NextBuffer(size_t minSize) { } bool res = AddBuffer(); - assert(res); + _assert_(res); if (!res) { // Let's try not to crash at least? buf_ = 0; @@ -124,7 +125,7 @@ void VulkanPushBuffer::Defragment(VulkanContext *vulkan) { size_ = newSize; bool res = AddBuffer(); - assert(res); + _assert_(res); } size_t VulkanPushBuffer::GetTotalSize() const { @@ -139,7 +140,7 @@ void VulkanPushBuffer::Map() { _dbg_assert_(!writePtr_); VkResult res = vkMapMemory(vulkan_->GetDevice(), buffers_[buf_].deviceMemory, 0, size_, 0, (void **)(&writePtr_)); _dbg_assert_(writePtr_); - assert(VK_SUCCESS == res); + _assert_(VK_SUCCESS == res); } void VulkanPushBuffer::Unmap() { @@ -161,12 +162,12 @@ void VulkanPushBuffer::Unmap() { VulkanDeviceAllocator::VulkanDeviceAllocator(VulkanContext *vulkan, size_t minSlabSize, size_t maxSlabSize) : vulkan_(vulkan), minSlabSize_(minSlabSize), maxSlabSize_(maxSlabSize) { - assert((minSlabSize_ & (SLAB_GRAIN_SIZE - 1)) == 0); + _assert_((minSlabSize_ & (SLAB_GRAIN_SIZE - 1)) == 0); } VulkanDeviceAllocator::~VulkanDeviceAllocator() { - assert(destroyed_); - assert(slabs_.empty()); + _assert_(destroyed_); + _assert_(slabs_.empty()); } void VulkanDeviceAllocator::Destroy() { @@ -183,7 +184,7 @@ void VulkanDeviceAllocator::Destroy() { } } - assert(slab.deviceMemory); + _assert_(slab.deviceMemory); vulkan_->Delete().QueueDeleteDeviceMemory(slab.deviceMemory); } slabs_.clear(); @@ -191,11 +192,11 @@ void VulkanDeviceAllocator::Destroy() { } size_t VulkanDeviceAllocator::Allocate(const VkMemoryRequirements &reqs, VkDeviceMemory *deviceMemory, const std::string &tag) { - assert(!destroyed_); + _assert_(!destroyed_); uint32_t memoryTypeIndex; bool pass = vulkan_->MemoryTypeFromProperties(reqs.memoryTypeBits, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &memoryTypeIndex); if (!pass) { - ELOG("Failed to pick an appropriate memory type (req: %08x)", reqs.memoryTypeBits); + ERROR_LOG(G3D, "Failed to pick an appropriate memory type (req: %08x)", reqs.memoryTypeBits); return ALLOCATE_FAILED; } @@ -244,7 +245,7 @@ size_t VulkanDeviceAllocator::Allocate(const VkMemoryRequirements &reqs, VkDevic } bool VulkanDeviceAllocator::AllocateFromSlab(Slab &slab, size_t &start, size_t blocks, const std::string &tag) { - assert(!destroyed_); + _assert_(!destroyed_); bool matched = true; if (start + blocks > slab.usage.size()) { @@ -320,7 +321,7 @@ void VulkanDeviceAllocator::DoTouch(VkDeviceMemory deviceMemory, size_t offset) } void VulkanDeviceAllocator::Free(VkDeviceMemory deviceMemory, size_t offset) { - assert(!destroyed_); + _assert_(!destroyed_); _assert_msg_(!slabs_.empty(), "No slabs - can't be anything to free! double-freed?"); @@ -401,7 +402,7 @@ void VulkanDeviceAllocator::ExecuteFree(FreeInfo *userdata) { } bool VulkanDeviceAllocator::AllocateSlab(VkDeviceSize minBytes, int memoryTypeIndex) { - assert(!destroyed_); + _assert_(!destroyed_); if (!slabs_.empty() && minSlabSize_ < maxSlabSize_) { // We're allocating an additional slab, so rachet up its size. // TODO: Maybe should not do this when we are allocating a new slab due to memoryTypeIndex not matching? @@ -420,7 +421,7 @@ bool VulkanDeviceAllocator::AllocateSlab(VkDeviceSize minBytes, int memoryTypeIn VkResult res = vkAllocateMemory(vulkan_->GetDevice(), &alloc, NULL, &deviceMemory); if (res != VK_SUCCESS) { // If it's something else, we used it wrong? - assert(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY || res == VK_ERROR_TOO_MANY_OBJECTS); + _assert_(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY || res == VK_ERROR_TOO_MANY_OBJECTS); // Okay, so we ran out of memory. return false; } @@ -464,7 +465,7 @@ void VulkanDeviceAllocator::ReportOldUsage() { } void VulkanDeviceAllocator::Decimate() { - assert(!destroyed_); + _assert_(!destroyed_); bool foundFree = false; if (TRACK_TOUCH) { diff --git a/GPU/Vulkan/VulkanUtil.cpp b/GPU/Vulkan/VulkanUtil.cpp index 0e653be2b1..7e0ad69ba7 100644 --- a/GPU/Vulkan/VulkanUtil.cpp +++ b/GPU/Vulkan/VulkanUtil.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "base/logging.h" // For OutputDebugStringUTF8. TODO: Move it. #include "base/basictypes.h" #include "base/stringutil.h" #include "Common/Log.h" diff --git a/ext/native/thin3d/VulkanQueueRunner.cpp b/ext/native/thin3d/VulkanQueueRunner.cpp index cffb65f8a5..6ce2eb4249 100644 --- a/ext/native/thin3d/VulkanQueueRunner.cpp +++ b/ext/native/thin3d/VulkanQueueRunner.cpp @@ -9,7 +9,7 @@ // Debug help: adb logcat -s DEBUG PPSSPPNativeActivity PPSSPP NativeGLView NativeRenderer NativeSurfaceView PowerSaveModeReceiver InputDeviceState void VulkanQueueRunner::CreateDeviceObjects() { - ILOG("VulkanQueueRunner::CreateDeviceObjects"); + INFO_LOG(G3D, "VulkanQueueRunner::CreateDeviceObjects"); InitBackbufferRenderPass(); framebufferRenderPass_ = GetRenderPass(VKRRenderPassAction::CLEAR, VKRRenderPassAction::CLEAR, VKRRenderPassAction::CLEAR, @@ -19,14 +19,14 @@ void VulkanQueueRunner::CreateDeviceObjects() { // Just to check whether it makes sense to split some of these. drawidx is way bigger than the others... // We should probably just move to variable-size data in a raw buffer anyway... VkRenderData rd; - ILOG("sizeof(pipeline): %d", (int)sizeof(rd.pipeline)); - ILOG("sizeof(draw): %d", (int)sizeof(rd.draw)); - ILOG("sizeof(drawidx): %d", (int)sizeof(rd.drawIndexed)); - ILOG("sizeof(clear): %d", (int)sizeof(rd.clear)); - ILOG("sizeof(viewport): %d", (int)sizeof(rd.viewport)); - ILOG("sizeof(scissor): %d", (int)sizeof(rd.scissor)); - ILOG("sizeof(blendColor): %d", (int)sizeof(rd.blendColor)); - ILOG("sizeof(push): %d", (int)sizeof(rd.push)); + INFO_LOG(G3D, "sizeof(pipeline): %d", (int)sizeof(rd.pipeline)); + INFO_LOG(G3D, "sizeof(draw): %d", (int)sizeof(rd.draw)); + INFO_LOG(G3D, "sizeof(drawidx): %d", (int)sizeof(rd.drawIndexed)); + INFO_LOG(G3D, "sizeof(clear): %d", (int)sizeof(rd.clear)); + INFO_LOG(G3D, "sizeof(viewport): %d", (int)sizeof(rd.viewport)); + INFO_LOG(G3D, "sizeof(scissor): %d", (int)sizeof(rd.scissor)); + INFO_LOG(G3D, "sizeof(blendColor): %d", (int)sizeof(rd.blendColor)); + INFO_LOG(G3D, "sizeof(push): %d", (int)sizeof(rd.push)); #endif } @@ -87,7 +87,7 @@ void VulkanQueueRunner::ResizeReadbackBuffer(VkDeviceSize requiredSize) { } void VulkanQueueRunner::DestroyDeviceObjects() { - ILOG("VulkanQueueRunner::DestroyDeviceObjects"); + INFO_LOG(G3D, "VulkanQueueRunner::DestroyDeviceObjects"); vulkan_->Delete().QueueDeleteDeviceMemory(readbackMemory_); vulkan_->Delete().QueueDeleteBuffer(readbackBuffer_); readbackBufferSize_ = 0; @@ -98,7 +98,7 @@ void VulkanQueueRunner::DestroyDeviceObjects() { }); renderPasses_.Clear(); - assert(backbufferRenderPass_ != VK_NULL_HANDLE); + _assert_(backbufferRenderPass_ != VK_NULL_HANDLE); vulkan_->Delete().QueueDeleteRenderPass(backbufferRenderPass_); backbufferRenderPass_ = VK_NULL_HANDLE; } @@ -559,7 +559,7 @@ void VulkanQueueRunner::ApplyMGSHack(std::vector &steps) { for (int j = 0; j < (int)renders.size(); j++) { steps[i + j + copies.size()] = renders[j]; } - assert(steps[i + copies.size()]->stepType == VKRStepType::RENDER); + _assert_(steps[i + copies.size()]->stepType == VKRStepType::RENDER); // Combine the renders. for (int j = 1; j < (int)renders.size(); j++) { for (int k = 0; k < (int)renders[j]->commands.size(); k++) { @@ -850,10 +850,10 @@ void VulkanQueueRunner::ApplyRenderPassMerge(std::vector &steps) { } void VulkanQueueRunner::LogSteps(const std::vector &steps) { - ILOG("======================================="); + INFO_LOG(G3D, "======================================="); for (size_t i = 0; i < steps.size(); i++) { const VKRStep &step = *steps[i]; - ILOG("%s", StepToString(step).c_str()); + INFO_LOG(G3D, "%s", StepToString(step).c_str()); switch (step.stepType) { case VKRStepType::RENDER: LogRenderPass(step); @@ -871,7 +871,7 @@ void VulkanQueueRunner::LogSteps(const std::vector &steps) { LogReadbackImage(step); break; case VKRStepType::RENDER_SKIP: - ILOG("(skipped render pass)"); + INFO_LOG(G3D, "(skipped render pass)"); break; } } @@ -892,62 +892,62 @@ const char *RenderPassActionName(VKRRenderPassAction a) { void VulkanQueueRunner::LogRenderPass(const VKRStep &pass) { const auto &r = pass.render; int fb = (int)(intptr_t)(r.framebuffer ? r.framebuffer->framebuf : 0); - ILOG("RenderPass Begin(%x, %s, %s, %s)", fb, RenderPassActionName(r.color), RenderPassActionName(r.depth), RenderPassActionName(r.stencil)); + INFO_LOG(G3D, "RenderPass Begin(%x, %s, %s, %s)", fb, RenderPassActionName(r.color), RenderPassActionName(r.depth), RenderPassActionName(r.stencil)); for (auto &cmd : pass.commands) { switch (cmd.cmd) { case VKRRenderCommand::REMOVED: - ILOG(" (Removed)"); + INFO_LOG(G3D, " (Removed)"); break; case VKRRenderCommand::BIND_PIPELINE: - ILOG(" BindPipeline(%x)", (int)(intptr_t)cmd.pipeline.pipeline); + INFO_LOG(G3D, " BindPipeline(%x)", (int)(intptr_t)cmd.pipeline.pipeline); break; case VKRRenderCommand::BLEND: - ILOG(" BlendColor(%08x)", cmd.blendColor.color); + INFO_LOG(G3D, " BlendColor(%08x)", cmd.blendColor.color); break; case VKRRenderCommand::CLEAR: - ILOG(" Clear"); + INFO_LOG(G3D, " Clear"); break; case VKRRenderCommand::DRAW: - ILOG(" Draw(%d)", cmd.draw.count); + INFO_LOG(G3D, " Draw(%d)", cmd.draw.count); break; case VKRRenderCommand::DRAW_INDEXED: - ILOG(" DrawIndexed(%d)", cmd.drawIndexed.count); + INFO_LOG(G3D, " DrawIndexed(%d)", cmd.drawIndexed.count); break; case VKRRenderCommand::SCISSOR: - ILOG(" Scissor(%d, %d, %d, %d)", (int)cmd.scissor.scissor.offset.x, (int)cmd.scissor.scissor.offset.y, (int)cmd.scissor.scissor.extent.width, (int)cmd.scissor.scissor.extent.height); + INFO_LOG(G3D, " Scissor(%d, %d, %d, %d)", (int)cmd.scissor.scissor.offset.x, (int)cmd.scissor.scissor.offset.y, (int)cmd.scissor.scissor.extent.width, (int)cmd.scissor.scissor.extent.height); break; case VKRRenderCommand::STENCIL: - ILOG(" Stencil(ref=%d, compare=%d, write=%d)", cmd.stencil.stencilRef, cmd.stencil.stencilCompareMask, cmd.stencil.stencilWriteMask); + INFO_LOG(G3D, " Stencil(ref=%d, compare=%d, write=%d)", cmd.stencil.stencilRef, cmd.stencil.stencilCompareMask, cmd.stencil.stencilWriteMask); break; case VKRRenderCommand::VIEWPORT: - ILOG(" Viewport(%f, %f, %f, %f, %f, %f)", cmd.viewport.vp.x, cmd.viewport.vp.y, cmd.viewport.vp.width, cmd.viewport.vp.height, cmd.viewport.vp.minDepth, cmd.viewport.vp.maxDepth); + INFO_LOG(G3D, " Viewport(%f, %f, %f, %f, %f, %f)", cmd.viewport.vp.x, cmd.viewport.vp.y, cmd.viewport.vp.width, cmd.viewport.vp.height, cmd.viewport.vp.minDepth, cmd.viewport.vp.maxDepth); break; case VKRRenderCommand::PUSH_CONSTANTS: - ILOG(" PushConstants(%d)", cmd.push.size); + INFO_LOG(G3D, " PushConstants(%d)", cmd.push.size); break; case VKRRenderCommand::NUM_RENDER_COMMANDS: break; } } - ILOG("RenderPass End(%x)", fb); + INFO_LOG(G3D, "RenderPass End(%x)", fb); } void VulkanQueueRunner::LogCopy(const VKRStep &step) { - ILOG("%s", StepToString(step).c_str()); + INFO_LOG(G3D, "%s", StepToString(step).c_str()); } void VulkanQueueRunner::LogBlit(const VKRStep &step) { - ILOG("%s", StepToString(step).c_str()); + INFO_LOG(G3D, "%s", StepToString(step).c_str()); } void VulkanQueueRunner::LogReadback(const VKRStep &step) { - ILOG("%s", StepToString(step).c_str()); + INFO_LOG(G3D, "%s", StepToString(step).c_str()); } void VulkanQueueRunner::LogReadbackImage(const VKRStep &step) { - ILOG("%s", StepToString(step).c_str()); + INFO_LOG(G3D, "%s", StepToString(step).c_str()); } void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer cmd) { @@ -1232,7 +1232,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c break; } default: - ELOG("Unimpl queue command"); + ERROR_LOG(G3D, "Unimpl queue command"); ; } } @@ -1707,7 +1707,7 @@ void VulkanQueueRunner::CopyReadbackBuffer(int width, int height, Draw::DataForm } if (res != VK_SUCCESS) { - ELOG("CopyReadbackBuffer: vkMapMemory failed! result=%d", (int)res); + ERROR_LOG(G3D, "CopyReadbackBuffer: vkMapMemory failed! result=%d", (int)res); return; } @@ -1729,7 +1729,7 @@ void VulkanQueueRunner::CopyReadbackBuffer(int width, int height, Draw::DataForm ConvertToD32F(pixels, (const uint8_t *)mappedData, pixelStride, width, width, height, srcFormat); } else { // TODO: Maybe a depth conversion or something? - ELOG("CopyReadbackBuffer: Unknown format"); + ERROR_LOG(G3D, "CopyReadbackBuffer: Unknown format"); _assert_msg_(false, "CopyReadbackBuffer: Unknown src format %d", (int)srcFormat); } vkUnmapMemory(vulkan_->GetDevice(), readbackMemory_); diff --git a/ext/native/ui/screen.h b/ext/native/ui/screen.h index 0b97108afd..d269995880 100644 --- a/ext/native/ui/screen.h +++ b/ext/native/ui/screen.h @@ -17,7 +17,6 @@ #include #include "base/basictypes.h" -#include "base/logging.h" #include "base/NativeApp.h" #include "input/input_state.h" diff --git a/ext/native/ui/view.h b/ext/native/ui/view.h index e8baa55702..0f0976b12f 100644 --- a/ext/native/ui/view.h +++ b/ext/native/ui/view.h @@ -15,7 +15,6 @@ #include #include -#include "base/logging.h" #include "base/basictypes.h" #include "gfx/texture_atlas.h" #include "math/lin/matrix4x4.h" diff --git a/ext/native/ui/viewgroup.cpp b/ext/native/ui/viewgroup.cpp index e9f2f88176..82a74faad8 100644 --- a/ext/native/ui/viewgroup.cpp +++ b/ext/native/ui/viewgroup.cpp @@ -1080,6 +1080,12 @@ void AnchorLayout::Layout() { } } +GridLayout::GridLayout(GridLayoutSettings settings, LayoutParams *layoutParams) + : ViewGroup(layoutParams), settings_(settings), numColumns_(1) { + if (settings.orientation != ORIENT_HORIZONTAL) + ELOG("GridLayout: Vertical layouts not yet supported"); +} + void GridLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) { MeasureSpecType measureType = settings_.fillCells ? EXACTLY : AT_MOST; diff --git a/ext/native/ui/viewgroup.h b/ext/native/ui/viewgroup.h index 286f922925..0eb3f39328 100644 --- a/ext/native/ui/viewgroup.h +++ b/ext/native/ui/viewgroup.h @@ -5,7 +5,6 @@ #include #include -#include "base/logging.h" #include "math/geom2d.h" #include "input/gesture_detector.h" #include "ui/view.h" @@ -209,11 +208,7 @@ struct GridLayoutSettings { class GridLayout : public ViewGroup { public: - GridLayout(GridLayoutSettings settings, LayoutParams *layoutParams = 0) - : ViewGroup(layoutParams), settings_(settings), numColumns_(1) { - if (settings.orientation != ORIENT_HORIZONTAL) - ELOG("GridLayout: Vertical layouts not yet supported"); - } + GridLayout(GridLayoutSettings settings, LayoutParams *layoutParams = 0); void Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) override; void Layout() override; From b43698a13d3345209f16f322630b0354af6fb793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 12:25:39 +0200 Subject: [PATCH 04/15] Remove most instances of base/logging.h from Common, Core, GPU, more --- Common/ArmEmitter.cpp | 12 ++-- Common/CPUDetect.cpp | 10 +-- Common/KeyMap.cpp | 10 +-- Common/MachineContext.h | 4 +- Common/MemArenaAndroid.cpp | 18 ++--- Common/MemoryUtil.cpp | 2 +- Common/MipsEmitter.cpp | 10 ++- Common/MsgHandler.cpp | 4 +- Common/Vulkan/VulkanDebug.cpp | 6 +- Common/Vulkan/VulkanLoader.cpp | 71 ++++++++++---------- Core/CoreTiming.cpp | 1 - Core/Dialog/SavedataParam.cpp | 4 +- Core/HLE/HLE.cpp | 2 +- Core/HLE/ReplaceTables.cpp | 1 - Core/HLE/sceDisplay.cpp | 4 -- Core/HLE/sceKernelThread.cpp | 2 - Core/HW/StereoResampler.cpp | 4 +- Core/MIPS/ARM64/Arm64Asm.cpp | 13 ++-- Core/MIPS/ARM64/Arm64Jit.cpp | 20 +++--- Core/MIPS/ARM64/Arm64RegCache.cpp | 20 +++--- Core/MIPS/ARM64/Arm64RegCacheFPU.cpp | 2 +- Core/MIPS/IR/IRAsm.cpp | 5 +- Core/MIPS/IR/IRFrontend.cpp | 3 +- Core/MIPS/IR/IRJit.cpp | 6 +- Core/MIPS/x86/CompVFPU.cpp | 2 +- GPU/Common/ShaderTranslation.cpp | 6 +- GPU/Common/VertexDecoderArm64.cpp | 8 +-- GPU/Common/VertexDecoderCommon.cpp | 2 +- GPU/D3D11/D3D11Util.cpp | 4 +- GPU/D3D11/DepalettizeShaderD3D11.cpp | 1 - GPU/D3D11/DrawEngineD3D11.cpp | 2 +- GPU/D3D11/GPU_D3D11.cpp | 2 +- GPU/D3D11/ShaderManagerD3D11.cpp | 2 +- GPU/D3D11/StencilBufferD3D11.cpp | 4 +- GPU/Directx9/DepalettizeShaderDX9.cpp | 1 - GPU/Directx9/DrawEngineDX9.cpp | 2 +- GPU/Directx9/GPU_DX9.cpp | 1 - GPU/Directx9/ShaderManagerDX9.cpp | 2 +- GPU/Directx9/StencilBufferDX9.cpp | 2 - GPU/GLES/DepalettizeShaderGLES.cpp | 1 - GPU/GLES/DrawEngineGLES.cpp | 1 - GPU/GLES/FragmentShaderGeneratorGLES.cpp | 2 +- GPU/GLES/GPU_GLES.cpp | 2 +- GPU/GLES/ShaderManagerGLES.cpp | 2 +- GPU/Vulkan/DrawEngineVulkan.cpp | 2 +- GPU/Vulkan/FragmentShaderGeneratorVulkan.cpp | 5 +- GPU/Vulkan/GPU_Vulkan.cpp | 2 +- GPU/Vulkan/ShaderManagerVulkan.cpp | 2 +- GPU/Vulkan/StencilBufferVulkan.cpp | 4 +- GPU/Vulkan/VulkanUtil.cpp | 1 + Qt/QtMain.h | 1 - UI/BackgroundAudio.cpp | 4 +- UI/EmuScreen.cpp | 2 +- UI/GameInfoCache.cpp | 2 +- UWP/StorageFileLoader.cpp | 3 +- Windows/GPU/D3D11Context.cpp | 4 +- Windows/GPU/D3D9Context.cpp | 2 +- headless/SDLHeadlessHost.cpp | 1 - headless/WindowsHeadlessHost.cpp | 1 - 59 files changed, 150 insertions(+), 169 deletions(-) diff --git a/Common/ArmEmitter.cpp b/Common/ArmEmitter.cpp index d289bdfb99..b3878fd443 100644 --- a/Common/ArmEmitter.cpp +++ b/Common/ArmEmitter.cpp @@ -17,9 +17,6 @@ #include "ppsspp_config.h" -#include "base/logging.h" - -#include #include #include #include @@ -31,9 +28,10 @@ #include #endif -#include "MemoryUtil.h" -#include "ArmEmitter.h" -#include "CPUDetect.h" +#include "Common/Log.h" +#include "Common/MemoryUtil.h" +#include "Common/ArmEmitter.h" +#include "Common/CPUDetect.h" #ifdef _WIN32 #include "CommonWindows.h" @@ -1780,7 +1778,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src) _assert_msg_(SrcSize == DestSize, "VMOV doesn't support moving different register sizes"); if (SrcSize != DestSize) { - ELOG("SrcSize: %i (%s) DestDize: %i (%s)", SrcSize, ARMRegAsString(Src), DestSize, ARMRegAsString(Dest)); + ERROR_LOG(JIT, "SrcSize: %i (%s) DestDize: %i (%s)", SrcSize, ARMRegAsString(Src), DestSize, ARMRegAsString(Dest)); } Dest = SubBase(Dest); diff --git a/Common/CPUDetect.cpp b/Common/CPUDetect.cpp index ac5cd2e640..ce3ad48a81 100644 --- a/Common/CPUDetect.cpp +++ b/Common/CPUDetect.cpp @@ -28,14 +28,14 @@ #include #include -#include "base/logging.h" + #include "base/basictypes.h" #include "file/file_util.h" -#include "Common.h" -#include "CPUDetect.h" -#include "FileUtil.h" -#include "StringUtils.h" +#include "Common/Common.h" +#include "Common/CPUDetect.h" +#include "Common/FileUtil.h" +#include "Common/StringUtils.h" #if defined(_WIN32) && !defined(__MINGW32__) #define WIN32_LEAN_AND_MEAN diff --git a/Common/KeyMap.cpp b/Common/KeyMap.cpp index 1652b51da8..19b93711df 100644 --- a/Common/KeyMap.cpp +++ b/Common/KeyMap.cpp @@ -24,14 +24,14 @@ #include "CommonWindows.h" #endif -#include "base/logging.h" #include "base/stringutil.h" #include "base/NativeApp.h" #include "file/ini_file.h" #include "input/input_state.h" #include "ppsspp_config.h" -#include "KeyMap.h" +#include "Common/Log.h" +#include "Common/KeyMap.h" #include "Core/HLE/sceUtility.h" #include "Core/Config.h" @@ -898,10 +898,10 @@ void RestoreDefault() { } else if (IsXperiaPlay(name)) { SetDefaultKeyMap(DEFAULT_MAPPING_XPERIA_PLAY, true); } else if (IsMOQII7S(name)) { - ILOG("MOQI pad map"); + INFO_LOG(SYSTEM, "MOQI pad map"); SetDefaultKeyMap(DEFAULT_MAPPING_MOQI_I7S, true); } else { - ILOG("Default pad map"); + INFO_LOG(SYSTEM, "Default pad map"); SetDefaultKeyMap(DEFAULT_MAPPING_PAD, true); } #else @@ -992,7 +992,7 @@ void NotifyPadConnected(const std::string &name) { } void AutoConfForPad(const std::string &name) { - ILOG("Autoconfiguring pad for '%s'", name.c_str()); + INFO_LOG(SYSTEM, "Autoconfiguring pad for '%s'", name.c_str()); if (name == "Xbox 360 Pad") { SetDefaultKeyMap(DEFAULT_MAPPING_X360, true); } else { diff --git a/Common/MachineContext.h b/Common/MachineContext.h index dabc854003..0cac3d97ce 100644 --- a/Common/MachineContext.h +++ b/Common/MachineContext.h @@ -14,7 +14,9 @@ #include typedef CONTEXT SContext; -#if PPSSPP_ARCH(AMD64) +#if defined(__LIBRETRO__) + +#elif PPSSPP_ARCH(AMD64) #define MACHINE_CONTEXT_SUPPORTED diff --git a/Common/MemArenaAndroid.cpp b/Common/MemArenaAndroid.cpp index 67e1861e5a..b43a0815b2 100644 --- a/Common/MemArenaAndroid.cpp +++ b/Common/MemArenaAndroid.cpp @@ -19,12 +19,6 @@ #ifdef __ANDROID__ -#include "base/logging.h" -#include "base/NativeApp.h" -#include "MemoryUtil.h" -#include "MemArena.h" -#include "StringUtils.h" - #include #include #include @@ -33,6 +27,12 @@ #include #include +#include "base/NativeApp.h" +#include "Common/Log.h" +#include "Common/MemoryUtil.h" +#include "Common/MemArena.h" +#include "Common/StringUtils.h" + // Hopefully this ABI will never change... #define ASHMEM_DEVICE "/dev/ashmem" @@ -141,14 +141,14 @@ u8* MemArena::Find4GBBase() { const uint64_t EIGHT_GIGS = 0x200000000ULL; void *base = mmap(0, EIGHT_GIGS, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); if (base) { - ILOG("base: %p", base); + INFO_LOG(SYSTEM, "base: %p", base); uint64_t aligned_base = ((uint64_t)base + 0xFFFFFFFF) & ~0xFFFFFFFFULL; - ILOG("aligned_base: %p", (void *)aligned_base); + INFO_LOG(SYSTEM, "aligned_base: %p", (void *)aligned_base); munmap(base, EIGHT_GIGS); return reinterpret_cast(aligned_base); } else { u8 *hardcoded_ptr = reinterpret_cast(0x2300000000ULL); - ILOG("Failed to anonymously map 8GB. Fall back to the hardcoded pointer %p.", hardcoded_ptr); + INFO_LOG(SYSTEM, "Failed to anonymously map 8GB. Fall back to the hardcoded pointer %p.", hardcoded_ptr); // Just grab some random 4GB... // This has been known to fail lately though, see issue #12249. return hardcoded_ptr; diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index 9a078ea728..c834444563 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -17,7 +17,7 @@ #include "ppsspp_config.h" -#include "base/logging.h" +#include #include "Common/Common.h" #include "Common/Log.h" diff --git a/Common/MipsEmitter.cpp b/Common/MipsEmitter.cpp index bd4e878959..5d6288be3e 100644 --- a/Common/MipsEmitter.cpp +++ b/Common/MipsEmitter.cpp @@ -15,18 +15,16 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "base/logging.h" - -#include #include #include #include #include #include -#include "MemoryUtil.h" -#include "MipsEmitter.h" -#include "CPUDetect.h" +#include "Common/Log.h" +#include "Common/MemoryUtil.h" +#include "Common/MipsEmitter.h" +#include "Common/CPUDetect.h" namespace MIPSGen { void MIPSEmitter::SetCodePtr(u8 *ptr) { diff --git a/Common/MsgHandler.cpp b/Common/MsgHandler.cpp index f2ec4dcadd..428790d0df 100644 --- a/Common/MsgHandler.cpp +++ b/Common/MsgHandler.cpp @@ -20,8 +20,8 @@ #include "ppsspp_config.h" #include "Common.h" +#include "Common/Log.h" #include "StringUtils.h" -#include "base/logging.h" #include "util/text/utf8.h" bool MsgHandler(const char *caption, const char *text, const char *file, int line, bool yes_no, int Style); @@ -69,7 +69,7 @@ bool MsgHandler(const char* caption, const char* text, const char *file, int lin return false; #else // Will use android-log if available, printf if not. - ELOG("(%s:%d) %s", file, line, text); + ERROR_LOG(SYSTEM, "(%s:%d) %s", file, line, text); return false; #endif } diff --git a/Common/Vulkan/VulkanDebug.cpp b/Common/Vulkan/VulkanDebug.cpp index c60898deef..687070640f 100644 --- a/Common/Vulkan/VulkanDebug.cpp +++ b/Common/Vulkan/VulkanDebug.cpp @@ -19,7 +19,7 @@ #include #include -#include "base/logging.h" +#include "Common/Log.h" #include "Common/Vulkan/VulkanContext.h" #include "Common/Vulkan/VulkanDebug.h" @@ -79,9 +79,9 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDebugUtilsCallback( #else // TODO: Improve. if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { - ELOG("VKDEBUG: %s", msg.c_str()); + ERROR_LOG(G3D, "VKDEBUG: %s", msg.c_str()); } else { - WLOG("VKDEBUG: %s", msg.c_str()); + WARN_LOG(G3D, "VKDEBUG: %s", msg.c_str()); } #endif diff --git a/Common/Vulkan/VulkanLoader.cpp b/Common/Vulkan/VulkanLoader.cpp index 59b3fb5bd3..4fff74c28d 100644 --- a/Common/Vulkan/VulkanLoader.cpp +++ b/Common/Vulkan/VulkanLoader.cpp @@ -18,8 +18,9 @@ #include "Common/Vulkan/VulkanLoader.h" #include #include +#include -#include "base/logging.h" +#include "Common/Log.h" #include "base/basictypes.h" #include "base/NativeApp.h" @@ -224,9 +225,9 @@ const char *VulkanResultToString(VkResult res); bool g_vulkanAvailabilityChecked = false; bool g_vulkanMayBeAvailable = false; -#define LOAD_INSTANCE_FUNC(instance, x) x = (PFN_ ## x)vkGetInstanceProcAddr(instance, #x); if (!x) {ILOG("Missing (instance): %s", #x);} -#define LOAD_DEVICE_FUNC(instance, x) x = (PFN_ ## x)vkGetDeviceProcAddr(instance, #x); if (!x) {ILOG("Missing (device): %s", #x);} -#define LOAD_GLOBAL_FUNC(x) x = (PFN_ ## x)dlsym(vulkanLibrary, #x); if (!x) {ILOG("Missing (global): %s", #x);} +#define LOAD_INSTANCE_FUNC(instance, x) x = (PFN_ ## x)vkGetInstanceProcAddr(instance, #x); if (!x) {INFO_LOG(G3D, "Missing (instance): %s", #x);} +#define LOAD_DEVICE_FUNC(instance, x) x = (PFN_ ## x)vkGetDeviceProcAddr(instance, #x); if (!x) {INFO_LOG(G3D, "Missing (device): %s", #x);} +#define LOAD_GLOBAL_FUNC(x) x = (PFN_ ## x)dlsym(vulkanLibrary, #x); if (!x) {INFO_LOG(G3D,"Missing (global): %s", #x);} #define LOAD_GLOBAL_FUNC_LOCAL(lib, x) (PFN_ ## x)dlsym(lib, #x); @@ -259,20 +260,20 @@ bool VulkanMayBeAvailable() { std::string name = System_GetProperty(SYSPROP_NAME); for (const char *blacklisted_name : device_name_blacklist) { if (!strcmp(name.c_str(), blacklisted_name)) { - ILOG("VulkanMayBeAvailable: Device blacklisted ('%s')", name.c_str()); + INFO_LOG(G3D, "VulkanMayBeAvailable: Device blacklisted ('%s')", name.c_str()); g_vulkanAvailabilityChecked = true; g_vulkanMayBeAvailable = false; return false; } } - ILOG("VulkanMayBeAvailable: Device allowed ('%s')", name.c_str()); + INFO_LOG(G3D, "VulkanMayBeAvailable: Device allowed ('%s')", name.c_str()); #ifndef _WIN32 void *lib = nullptr; for (int i = 0; i < ARRAY_SIZE(so_names); i++) { lib = dlopen(so_names[i], RTLD_NOW | RTLD_LOCAL); if (lib) { - ILOG("VulkanMayBeAvailable: Library loaded ('%s')", so_names[i]); + INFO_LOG(G3D, "VulkanMayBeAvailable: Library loaded ('%s')", so_names[i]); break; } } @@ -281,7 +282,7 @@ bool VulkanMayBeAvailable() { HINSTANCE lib = LoadLibrary(L"vulkan-1.dll"); #endif if (!lib) { - ILOG("Vulkan loader: Library not available"); + INFO_LOG(G3D, "Vulkan loader: Library not available"); g_vulkanAvailabilityChecked = true; g_vulkanMayBeAvailable = false; return false; @@ -321,32 +322,32 @@ bool VulkanMayBeAvailable() { #endif if (!localEnumerateInstanceExtensionProperties || !localCreateInstance || !localEnumerate || !localDestroyInstance || !localGetPhysicalDeviceProperties) { - WLOG("VulkanMayBeAvailable: Function pointer missing, bailing"); + WARN_LOG(G3D, "VulkanMayBeAvailable: Function pointer missing, bailing"); goto bail; } - ILOG("VulkanMayBeAvailable: Enumerating instance extensions"); + INFO_LOG(G3D, "VulkanMayBeAvailable: Enumerating instance extensions"); res = localEnumerateInstanceExtensionProperties(nullptr, &instanceExtCount, nullptr); // Maximum paranoia. if (res != VK_SUCCESS) { - ELOG("Enumerating VK extensions failed (%s)", VulkanResultToString(res)); + ERROR_LOG(G3D, "Enumerating VK extensions failed (%s)", VulkanResultToString(res)); goto bail; } if (instanceExtCount == 0) { - ELOG("No VK instance extensions - won't be able to present."); + ERROR_LOG(G3D, "No VK instance extensions - won't be able to present."); goto bail; } - ILOG("VulkanMayBeAvailable: Instance extension count: %d", instanceExtCount); + INFO_LOG(G3D, "VulkanMayBeAvailable: Instance extension count: %d", instanceExtCount); instanceExts.resize(instanceExtCount); res = localEnumerateInstanceExtensionProperties(nullptr, &instanceExtCount, instanceExts.data()); if (res != VK_SUCCESS) { - ELOG("Enumerating VK extensions failed (%s)", VulkanResultToString(res)); + ERROR_LOG(G3D, "Enumerating VK extensions failed (%s)", VulkanResultToString(res)); goto bail; } for (auto iter : instanceExts) { - ILOG("VulkanMaybeAvailable: Instance extension found: %s (%08x)", iter.extensionName, iter.specVersion); + INFO_LOG(G3D, "VulkanMaybeAvailable: Instance extension found: %s (%08x)", iter.extensionName, iter.specVersion); if (platformSurfaceExtension && !strcmp(iter.extensionName, platformSurfaceExtension)) { - ILOG("VulkanMayBeAvailable: Found platform surface extension '%s'", platformSurfaceExtension); + INFO_LOG(G3D, "VulkanMayBeAvailable: Found platform surface extension '%s'", platformSurfaceExtension); instanceExtensions[ci.enabledExtensionCount++] = platformSurfaceExtension; platformSurfaceExtensionFound = true; break; @@ -357,19 +358,19 @@ bool VulkanMayBeAvailable() { } if (platformSurfaceExtension) { if (!platformSurfaceExtensionFound || !surfaceExtensionFound) { - ELOG("Platform surface extension not found"); + ERROR_LOG(G3D, "Platform surface extension not found"); goto bail; } } else { if (!surfaceExtensionFound) { - ELOG("Surface extension not found"); + ERROR_LOG(G3D, "Surface extension not found"); goto bail; } } // This can't happen unless the driver is double-reporting a surface extension. if (ci.enabledExtensionCount > 2) { - ELOG("Unexpected number of enabled instance extensions"); + ERROR_LOG(G3D, "Unexpected number of enabled instance extensions"); goto bail; } @@ -382,27 +383,27 @@ bool VulkanMayBeAvailable() { info.pEngineName = "VulkanCheckerEngine"; ci.pApplicationInfo = &info; ci.flags = 0; - ILOG("VulkanMayBeAvailable: Calling vkCreateInstance"); + INFO_LOG(G3D, "VulkanMayBeAvailable: Calling vkCreateInstance"); res = localCreateInstance(&ci, nullptr, &instance); if (res != VK_SUCCESS) { instance = nullptr; - ELOG("VulkanMayBeAvailable: Failed to create vulkan instance (%s)", VulkanResultToString(res)); + ERROR_LOG(G3D, "VulkanMayBeAvailable: Failed to create vulkan instance (%s)", VulkanResultToString(res)); goto bail; } - ILOG("VulkanMayBeAvailable: Vulkan test instance created successfully."); + INFO_LOG(G3D, "VulkanMayBeAvailable: Vulkan test instance created successfully."); res = localEnumerate(instance, &physicalDeviceCount, nullptr); if (res != VK_SUCCESS) { - ELOG("VulkanMayBeAvailable: Failed to count physical devices (%s)", VulkanResultToString(res)); + ERROR_LOG(G3D, "VulkanMayBeAvailable: Failed to count physical devices (%s)", VulkanResultToString(res)); goto bail; } if (physicalDeviceCount == 0) { - ELOG("VulkanMayBeAvailable: No physical Vulkan devices (count = 0)."); + ERROR_LOG(G3D, "VulkanMayBeAvailable: No physical Vulkan devices (count = 0)."); goto bail; } devices.resize(physicalDeviceCount); res = localEnumerate(instance, &physicalDeviceCount, devices.data()); if (res != VK_SUCCESS) { - ELOG("VulkanMayBeAvailable: Failed to enumerate physical devices (%s)", VulkanResultToString(res)); + ERROR_LOG(G3D, "VulkanMayBeAvailable: Failed to enumerate physical devices (%s)", VulkanResultToString(res)); goto bail; } anyGood = false; @@ -416,24 +417,24 @@ bool VulkanMayBeAvailable() { anyGood = true; break; default: - ILOG("VulkanMayBeAvailable: Ineligible device found and ignored: '%s'", props.deviceName); + INFO_LOG(G3D, "VulkanMayBeAvailable: Ineligible device found and ignored: '%s'", props.deviceName); break; } // TODO: Should also check queuefamilyproperties for a GRAPHICS queue family? Oh well. } if (!anyGood) { - WLOG("VulkanMayBeAvailable: Found Vulkan API, but no good Vulkan device!"); + WARN_LOG(G3D, "VulkanMayBeAvailable: Found Vulkan API, but no good Vulkan device!"); g_vulkanMayBeAvailable = false; } else { - ILOG("VulkanMayBeAvailable: Found working Vulkan API!"); + INFO_LOG(G3D, "VulkanMayBeAvailable: Found working Vulkan API!"); g_vulkanMayBeAvailable = true; } bail: g_vulkanAvailabilityChecked = true; if (instance) { - ILOG("VulkanMayBeAvailable: Destroying instance"); + INFO_LOG(G3D, "VulkanMayBeAvailable: Destroying instance"); localDestroyInstance(instance, nullptr); } if (lib) { @@ -443,7 +444,7 @@ bail: FreeLibrary(lib); #endif } else { - ELOG("Vulkan with working device not detected."); + ERROR_LOG(G3D, "Vulkan with working device not detected."); } return g_vulkanMayBeAvailable; } @@ -454,7 +455,7 @@ bool VulkanLoad() { for (int i = 0; i < ARRAY_SIZE(so_names); i++) { vulkanLibrary = dlopen(so_names[i], RTLD_NOW | RTLD_LOCAL); if (vulkanLibrary) { - ILOG("VulkanLoad: Found library '%s'", so_names[i]); + INFO_LOG(G3D, "VulkanLoad: Found library '%s'", so_names[i]); break; } } @@ -475,10 +476,10 @@ bool VulkanLoad() { LOAD_GLOBAL_FUNC(vkEnumerateInstanceLayerProperties); if (vkCreateInstance && vkGetInstanceProcAddr && vkGetDeviceProcAddr && vkEnumerateInstanceExtensionProperties && vkEnumerateInstanceLayerProperties) { - WLOG("VulkanLoad: Base functions loaded."); + WARN_LOG(G3D, "VulkanLoad: Base functions loaded."); return true; } else { - ELOG("VulkanLoad: Failed to load Vulkan base functions."); + ERROR_LOG(G3D, "VulkanLoad: Failed to load Vulkan base functions."); #ifndef _WIN32 dlclose(vulkanLibrary); #else @@ -548,14 +549,14 @@ void VulkanLoadInstanceFunctions(VkInstance instance, const VulkanExtensions &en LOAD_INSTANCE_FUNC(instance, vkSetDebugUtilsObjectTagEXT); } - WLOG("Vulkan instance functions loaded."); + WARN_LOG(G3D, "Vulkan instance functions loaded."); } // On some implementations, loading functions (that have Device as their first parameter) via vkGetDeviceProcAddr may // increase performance - but then these function pointers will only work on that specific device. Thus, this loader is not very // good for multi-device - not likely we'll ever try that anyway though. void VulkanLoadDeviceFunctions(VkDevice device, const VulkanExtensions &enabledExtensions) { - WLOG("Vulkan device functions loaded."); + WARN_LOG(G3D, "Vulkan device functions loaded."); LOAD_DEVICE_FUNC(device, vkQueueSubmit); LOAD_DEVICE_FUNC(device, vkQueueWaitIdle); diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index b87ee057ed..62fb2afca3 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -20,7 +20,6 @@ #include #include -#include "base/logging.h" #include "profiler/profiler.h" #include "Common/MsgHandler.h" diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index 1e021d94fc..d14f3395e3 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -16,7 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "i18n/i18n.h" -#include "base/logging.h" +#include "Common/Log.h" #include "Common/Serialize/Serializer.h" #include "Common/Serialize/SerializeFuncs.h" #include "Common/StringUtils.h" @@ -213,7 +213,7 @@ void SavedataParam::Init() if (handle >= 0) { pspFileSystem.CloseFile(handle); } else { - ELOG("Failed to create .nomedia file"); + ERROR_LOG(IO, "Failed to create .nomedia file"); } #endif } diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index 06cdf4f390..d83c9e3fe5 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -20,10 +20,10 @@ #include #include -#include "base/logging.h" #include "base/timeutil.h" #include "profiler/profiler.h" +#include "Common/Log.h" #include "Common/Serialize/SerializeFuncs.h" #include "Core/Config.h" #include "Core/Core.h" diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index a1d9e25e5c..359b76e23c 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -20,7 +20,6 @@ #include #include "base/basictypes.h" -#include "base/logging.h" #include "Common/Log.h" #include "Core/Config.h" #include "Core/Debugger/Breakpoints.h" diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 5551513e7f..406c757635 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -26,10 +26,6 @@ #include #endif -// TODO: Move the relevant parts into common. Don't want the core -// to be dependent on "native", I think. Or maybe should get rid of common -// and move everything into native... -#include "base/logging.h" #include "base/timeutil.h" #include "i18n/i18n.h" #include "profiler/profiler.h" diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 5e4ebe84d1..c11bf8b2ad 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -21,8 +21,6 @@ #include #include -#include "base/logging.h" - #include "Common/CommonTypes.h" #include "Common/LogManager.h" #include "Common/Serialize/Serializer.h" diff --git a/Core/HW/StereoResampler.cpp b/Core/HW/StereoResampler.cpp index 29ecf60b76..5075465589 100644 --- a/Core/HW/StereoResampler.cpp +++ b/Core/HW/StereoResampler.cpp @@ -35,11 +35,11 @@ #include #include -#include "base/logging.h" #include "base/timeutil.h" #include "base/NativeApp.h" #include "Common/Serialize/Serializer.h" #include "Common/MathUtil.h" +#include "Common/Log.h" #include "Core/Config.h" #include "Core/ConfigValues.h" #include "Core/HW/StereoResampler.h" @@ -71,7 +71,7 @@ StereoResampler::StereoResampler() // If framerate is "close"... if (refresh != 60.0f && refresh > 50.0f && refresh < 70.0f) { int input_sample_rate = (int)(44100 * (refresh / 60.0f)); - ILOG("StereoResampler: Adjusting target sample rate to %dHz", input_sample_rate); + INFO_LOG(AUDIO, "StereoResampler: Adjusting target sample rate to %dHz", input_sample_rate); m_input_sample_rate = input_sample_rate; } diff --git a/Core/MIPS/ARM64/Arm64Asm.cpp b/Core/MIPS/ARM64/Arm64Asm.cpp index 81f67fa3a3..99f4dadf65 100644 --- a/Core/MIPS/ARM64/Arm64Asm.cpp +++ b/Core/MIPS/ARM64/Arm64Asm.cpp @@ -18,15 +18,14 @@ #include "ppsspp_config.h" #if PPSSPP_ARCH(ARM64) -#include "base/logging.h" - +#include "Common/Log.h" +#include "Common/MemoryUtil.h" +#include "Common/CPUDetect.h" +#include "Common/Arm64Emitter.h" #include "Core/MemMap.h" #include "Core/MIPS/MIPS.h" #include "Core/System.h" #include "Core/CoreTiming.h" -#include "Common/MemoryUtil.h" -#include "Common/CPUDetect.h" -#include "Common/Arm64Emitter.h" #include "Core/MIPS/ARM64/Arm64Jit.h" #include "Core/MIPS/JitCommon/JitCommon.h" @@ -77,9 +76,9 @@ extern volatile CoreState coreState; void ShowPC(u32 downcount, void *membase, void *jitbase) { static int count = 0; if (currentMIPS) { - ELOG("ShowPC : %08x Downcount : %08x %d %p %p", currentMIPS->pc, downcount, count, membase, jitbase); + ERROR_LOG(JIT, "ShowPC : %08x Downcount : %08x %d %p %p", currentMIPS->pc, downcount, count, membase, jitbase); } else { - ELOG("Universe corrupt?"); + ERROR_LOG(JIT, "Universe corrupt?"); } //if (count > 2000) // exit(0); diff --git a/Core/MIPS/ARM64/Arm64Jit.cpp b/Core/MIPS/ARM64/Arm64Jit.cpp index c1d2bac89f..e626599019 100644 --- a/Core/MIPS/ARM64/Arm64Jit.cpp +++ b/Core/MIPS/ARM64/Arm64Jit.cpp @@ -18,8 +18,8 @@ #include "ppsspp_config.h" #if PPSSPP_ARCH(ARM64) -#include "base/logging.h" #include "profiler/profiler.h" +#include "Common/Log.h" #include "Common/Serialize/Serializer.h" #include "Common/Serialize/SerializeFuncs.h" #include "Common/CPUDetect.h" @@ -49,17 +49,17 @@ using namespace Arm64JitConstants; static void DisassembleArm64Print(const u8 *data, int size) { std::vector lines = DisassembleArm64(data, size); for (auto s : lines) { - ILOG("%s", s.c_str()); + INFO_LOG(JIT, "%s", s.c_str()); } /* - ILOG("+++"); + INFO_LOG(JIT, "+++"); // A format friendly to Online Disassembler which gets endianness wrong for (size_t i = 0; i < lines.size(); i++) { uint32_t opcode = ((const uint32_t *)data)[i]; - ILOG("%d/%d: %08x", (int)(i+1), (int)lines.size(), swap32(opcode)); + INFO_LOG(JIT, "%d/%d: %08x", (int)(i+1), (int)lines.size(), swap32(opcode)); } - ILOG("==="); - ILOG("===");*/ + INFO_LOG(JIT, "==="); + INFO_LOG(JIT, "===");*/ } static u32 JitBreakpoint() { @@ -169,7 +169,7 @@ void Arm64Jit::FlushPrefixV() { } void Arm64Jit::ClearCache() { - ILOG("ARM64Jit: Clearing the cache!"); + INFO_LOG(JIT, "ARM64Jit: Clearing the cache!"); blocks.Clear(); ClearCodeSpace(jitStartOffset); FlushIcacheSection(region + jitStartOffset, region + region_size - jitStartOffset); @@ -361,16 +361,16 @@ const u8 *Arm64Jit::DoJit(u32 em_address, JitBlock *b) { char temp[256]; if (logBlocks > 0 && dontLogBlocks == 0) { - ILOG("=============== mips %d ===============", blocks.GetNumBlocks()); + INFO_LOG(JIT, "=============== mips %d ===============", blocks.GetNumBlocks()); for (u32 cpc = em_address; cpc != GetCompilerPC() + 4; cpc += 4) { MIPSDisAsm(Memory::Read_Opcode_JIT(cpc), cpc, temp, true); - ILOG("M: %08x %s", cpc, temp); + INFO_LOG(JIT, "M: %08x %s", cpc, temp); } } b->codeSize = GetCodePtr() - b->normalEntry; if (logBlocks > 0 && dontLogBlocks == 0) { - ILOG("=============== ARM (%d instructions -> %d bytes) ===============", js.numInstructions, b->codeSize); + INFO_LOG(JIT, "=============== ARM (%d instructions -> %d bytes) ===============", js.numInstructions, b->codeSize); DisassembleArm64Print(b->normalEntry, GetCodePtr() - b->normalEntry); } if (logBlocks > 0) diff --git a/Core/MIPS/ARM64/Arm64RegCache.cpp b/Core/MIPS/ARM64/Arm64RegCache.cpp index a853359ae4..b084adf109 100644 --- a/Core/MIPS/ARM64/Arm64RegCache.cpp +++ b/Core/MIPS/ARM64/Arm64RegCache.cpp @@ -18,7 +18,7 @@ #include "ppsspp_config.h" #if PPSSPP_ARCH(ARM64) -#include "base/logging.h" +#include "Common/Log.h" #include "Core/MemMap.h" #include "Core/MIPS/ARM64/Arm64RegCache.h" #include "Core/MIPS/ARM64/Arm64Jit.h" @@ -150,7 +150,7 @@ bool Arm64RegCache::IsMappedAsPointer(MIPSGPReg mipsReg) { return ar[mr[mipsReg].reg].pointerified; } else if (mr[mipsReg].loc == ML_ARMREG_IMM) { if (ar[mr[mipsReg].reg].pointerified) { - ELOG("Really shouldn't be pointerified here"); + ERROR_LOG(JIT, "Really shouldn't be pointerified here"); } } else if (mr[mipsReg].loc == ML_ARMREG_AS_PTR) { return true; @@ -164,7 +164,7 @@ void Arm64RegCache::MarkDirty(ARM64Reg reg) { void Arm64RegCache::SetRegImm(ARM64Reg reg, u64 imm) { if (reg == INVALID_REG) { - ELOG("SetRegImm to invalid register: at %08x", js_->compilerPC); + ERROR_LOG(JIT, "SetRegImm to invalid register: at %08x", js_->compilerPC); return; } // On ARM64, at least Cortex A57, good old MOVT/MOVW (MOVK in 64-bit) is really fast. @@ -174,7 +174,7 @@ void Arm64RegCache::SetRegImm(ARM64Reg reg, u64 imm) { void Arm64RegCache::MapRegTo(ARM64Reg reg, MIPSGPReg mipsReg, int mapFlags) { if (mr[mipsReg].isStatic) { - ELOG("Cannot MapRegTo static register %d", mipsReg); + ERROR_LOG(JIT, "Cannot MapRegTo static register %d", mipsReg); return; } ar[reg].isDirty = (mapFlags & MAP_DIRTY) ? true : false; @@ -450,7 +450,7 @@ Arm64Gen::ARM64Reg Arm64RegCache::MapRegAsPointer(MIPSGPReg reg) { ar[a].pointerified = true; } } else { - ELOG("MapRegAsPointer : MapReg failed to allocate a register?"); + ERROR_LOG(JIT, "MapRegAsPointer : MapReg failed to allocate a register?"); } return retval; } @@ -506,7 +506,7 @@ void Arm64RegCache::MapDirtyDirtyInIn(MIPSGPReg rd1, MIPSGPReg rd2, MIPSGPReg rs void Arm64RegCache::FlushArmReg(ARM64Reg r) { if (r == INVALID_REG) { - ELOG("FlushArmReg called on invalid register %d", r); + ERROR_LOG(JIT, "FlushArmReg called on invalid register %d", r); return; } if (ar[r].mipsReg == MIPS_REG_INVALID) { @@ -517,7 +517,7 @@ void Arm64RegCache::FlushArmReg(ARM64Reg r) { return; } if (mr[ar[r].mipsReg].isStatic) { - ELOG("Cannot FlushArmReg a statically mapped register"); + ERROR_LOG(JIT, "Cannot FlushArmReg a statically mapped register"); return; } auto &mreg = mr[ar[r].mipsReg]; @@ -629,7 +629,7 @@ ARM64Reg Arm64RegCache::ARM64RegForFlush(MIPSGPReg r) { void Arm64RegCache::FlushR(MIPSGPReg r) { if (mr[r].isStatic) { - ELOG("Cannot flush static reg %d", r); + ERROR_LOG(JIT, "Cannot flush static reg %d", r); return; } @@ -753,7 +753,7 @@ void Arm64RegCache::FlushAll() { } else if (mr[i].loc == ML_ARMREG_IMM) { // The register already contains the immediate. if (ar[armReg].pointerified) { - ELOG("ML_ARMREG_IMM but pointerified. Wrong."); + ERROR_LOG(JIT, "ML_ARMREG_IMM but pointerified. Wrong."); ar[armReg].pointerified = false; } mr[i].loc = ML_ARMREG; @@ -762,7 +762,7 @@ void Arm64RegCache::FlushAll() { mr[i].loc = ML_ARMREG; } if (i != MIPS_REG_ZERO && mr[i].reg == INVALID_REG) { - ELOG("ARM reg of static %i is invalid", i); + ERROR_LOG(JIT, "ARM reg of static %i is invalid", i); continue; } } else { diff --git a/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp b/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp index 7df249eaaa..3861fb44a1 100644 --- a/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp +++ b/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp @@ -20,8 +20,8 @@ #include -#include "base/logging.h" #include "Common/CPUDetect.h" +#include "Common/Log.h" #include "Core/Reporting.h" #include "Core/MIPS/MIPS.h" #include "Core/MIPS/ARM64/Arm64RegCacheFPU.h" diff --git a/Core/MIPS/IR/IRAsm.cpp b/Core/MIPS/IR/IRAsm.cpp index f5d9c7ad31..38d40469d8 100644 --- a/Core/MIPS/IR/IRAsm.cpp +++ b/Core/MIPS/IR/IRAsm.cpp @@ -15,13 +15,12 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "base/logging.h" - +#include "Common/Log.h" +#include "Common/MemoryUtil.h" #include "Core/MemMap.h" #include "Core/MIPS/MIPS.h" #include "Core/System.h" #include "Core/CoreTiming.h" -#include "Common/MemoryUtil.h" #include "Core/MIPS/IR/IRJit.h" #include "Core/MIPS/JitCommon/JitCommon.h" diff --git a/Core/MIPS/IR/IRFrontend.cpp b/Core/MIPS/IR/IRFrontend.cpp index 86f6b0e198..c3a2df444a 100644 --- a/Core/MIPS/IR/IRFrontend.cpp +++ b/Core/MIPS/IR/IRFrontend.cpp @@ -15,8 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "base/logging.h" - +#include "Common/Log.h" #include "Common/Serialize/Serializer.h" #include "Common/Serialize/SerializeFuncs.h" #include "Core/Debugger/Breakpoints.h" diff --git a/Core/MIPS/IR/IRJit.cpp b/Core/MIPS/IR/IRJit.cpp index 12af157044..ec279776cd 100644 --- a/Core/MIPS/IR/IRJit.cpp +++ b/Core/MIPS/IR/IRJit.cpp @@ -16,9 +16,11 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include -#include "base/logging.h" + #include "ext/xxhash.h" #include "profiler/profiler.h" + +#include "Common/Log.h" #include "Common/Serialize/Serializer.h" #include "Common/StringUtils.h" @@ -61,7 +63,7 @@ void IRJit::UpdateFCR31() { } void IRJit::ClearCache() { - ILOG("IRJit: Clearing the cache!"); + INFO_LOG(JIT, "IRJit: Clearing the cache!"); blocks_.Clear(); } diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index da083d97bb..de23b3b2d2 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -25,10 +25,10 @@ #include #include -#include "base/logging.h" #include "math/math_util.h" #include "Common/CPUDetect.h" +#include "Common/Log.h" #include "Core/Compatibility.h" #include "Core/Config.h" #include "Core/MemMap.h" diff --git a/GPU/Common/ShaderTranslation.cpp b/GPU/Common/ShaderTranslation.cpp index 3693e2393d..d535d063c1 100644 --- a/GPU/Common/ShaderTranslation.cpp +++ b/GPU/Common/ShaderTranslation.cpp @@ -34,10 +34,10 @@ #undef free #endif -#include "base/logging.h" #include "base/basictypes.h" #include "base/stringutil.h" -#include "ShaderTranslation.h" +#include "Common/Log.h" +#include "GPU/Common/ShaderTranslation.h" #include "ext/glslang/SPIRV/GlslangToSpv.h" #include "thin3d/thin3d.h" #include "gfx_es2/gpu_features.h" @@ -211,7 +211,7 @@ bool ConvertToVulkanGLSL(std::string *dest, TranslatedShaderMetadata *destMetada } // DUMPLOG(src.c_str()); - // ILOG("---->"); + // INFO_LOG(SYSTEM, "---->"); // DUMPLOG(LineNumberString(out.str()).c_str()); *dest = out.str(); diff --git a/GPU/Common/VertexDecoderArm64.cpp b/GPU/Common/VertexDecoderArm64.cpp index a4714ee070..7ba612affa 100644 --- a/GPU/Common/VertexDecoderArm64.cpp +++ b/GPU/Common/VertexDecoderArm64.cpp @@ -23,8 +23,8 @@ #define ARM64 #endif -#include "base/logging.h" #include "Common/CPUDetect.h" +#include "Common/Log.h" #include "Core/Config.h" #include "Core/Reporting.h" #include "Common/Arm64Emitter.h" @@ -287,12 +287,12 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int if (log) { char temp[1024] = { 0 }; dec.ToString(temp); - ILOG("=== %s (%d bytes) ===", temp, (int)(GetCodePtr() - start)); + INFO_LOG(JIT, "=== %s (%d bytes) ===", temp, (int)(GetCodePtr() - start)); std::vector lines = DisassembleArm64(start, (int)(GetCodePtr() - start)); for (auto line : lines) { - ILOG("%s", line.c_str()); + INFO_LOG(JIT, "%s", line.c_str()); } - ILOG("=========="); + INFO_LOG(JIT, "=========="); } *jittedSize = (int)(GetCodePtr() - start); diff --git a/GPU/Common/VertexDecoderCommon.cpp b/GPU/Common/VertexDecoderCommon.cpp index 0b8ee6736c..87b8114303 100644 --- a/GPU/Common/VertexDecoderCommon.cpp +++ b/GPU/Common/VertexDecoderCommon.cpp @@ -19,8 +19,8 @@ #include #include "base/basictypes.h" -#include "base/logging.h" +#include "Common/Log.h" #include "Common/CPUDetect.h" #include "Common/ColorConv.h" #include "Core/Config.h" diff --git a/GPU/D3D11/D3D11Util.cpp b/GPU/D3D11/D3D11Util.cpp index a3b2e963af..7a7b0aac25 100644 --- a/GPU/D3D11/D3D11Util.cpp +++ b/GPU/D3D11/D3D11Util.cpp @@ -13,10 +13,10 @@ #include "thin3d/d3d11_loader.h" #endif -#include "base/logging.h" #include "base/stringutil.h" #include "D3D11Util.h" +#include "Common/Log.h" static std::vector CompileShaderToBytecode(const char *code, size_t codeSize, const char *target, UINT flags) { ID3DBlob *compiledCode = nullptr; @@ -25,7 +25,7 @@ static std::vector CompileShaderToBytecode(const char *code, size_t cod std::string errors; if (errorMsgs) { errors = std::string((const char *)errorMsgs->GetBufferPointer(), errorMsgs->GetBufferSize()); - ELOG("%s: %s", SUCCEEDED(result) ? "warnings" : "errors", errors.c_str()); + ERROR_LOG(G3D, "%s: %s", SUCCEEDED(result) ? "warnings" : "errors", errors.c_str()); OutputDebugStringA(LineNumberString(code).c_str()); errorMsgs->Release(); } diff --git a/GPU/D3D11/DepalettizeShaderD3D11.cpp b/GPU/D3D11/DepalettizeShaderD3D11.cpp index 854c38b34b..c67ce845f0 100644 --- a/GPU/D3D11/DepalettizeShaderD3D11.cpp +++ b/GPU/D3D11/DepalettizeShaderD3D11.cpp @@ -19,7 +19,6 @@ #include #include "base/basictypes.h" -#include "base/logging.h" #include "Common/Log.h" #include "Common/ColorConv.h" #include "Common/StringUtils.h" diff --git a/GPU/D3D11/DrawEngineD3D11.cpp b/GPU/D3D11/DrawEngineD3D11.cpp index 2eb66a4472..a4780b0b80 100644 --- a/GPU/D3D11/DrawEngineD3D11.cpp +++ b/GPU/D3D11/DrawEngineD3D11.cpp @@ -17,9 +17,9 @@ #include -#include "base/logging.h" #include "base/timeutil.h" +#include "Common/Log.h" #include "Common/MemoryUtil.h" #include "Core/MemMap.h" #include "Core/System.h" diff --git a/GPU/D3D11/GPU_D3D11.cpp b/GPU/D3D11/GPU_D3D11.cpp index 31a2faa449..fcd1fa0d8d 100644 --- a/GPU/D3D11/GPU_D3D11.cpp +++ b/GPU/D3D11/GPU_D3D11.cpp @@ -36,10 +36,10 @@ #include +#include "Common/Log.h" #include "Common/Serialize/Serializer.h" #include "Common/GraphicsContext.h" #include "base/NativeApp.h" -#include "base/logging.h" #include "profiler/profiler.h" #include "i18n/i18n.h" #include "Core/Debugger/Breakpoints.h" diff --git a/GPU/D3D11/ShaderManagerD3D11.cpp b/GPU/D3D11/ShaderManagerD3D11.cpp index 5e4a39c062..7ca95da1fb 100644 --- a/GPU/D3D11/ShaderManagerD3D11.cpp +++ b/GPU/D3D11/ShaderManagerD3D11.cpp @@ -22,12 +22,12 @@ #include -#include "base/logging.h" #include "math/lin/matrix4x4.h" #include "math/math_util.h" #include "math/dataconv.h" #include "thin3d/thin3d.h" #include "util/text/utf8.h" +#include "Common/Log.h" #include "Common/Common.h" #include "Core/Config.h" #include "Core/Reporting.h" diff --git a/GPU/D3D11/StencilBufferD3D11.cpp b/GPU/D3D11/StencilBufferD3D11.cpp index 7c47806c74..d4b6dc164e 100644 --- a/GPU/D3D11/StencilBufferD3D11.cpp +++ b/GPU/D3D11/StencilBufferD3D11.cpp @@ -17,9 +17,9 @@ #include -#include "base/logging.h" - #include "ext/native/thin3d/thin3d.h" + +#include "Common/Log.h" #include "Core/Reporting.h" #include "GPU/Common/StencilCommon.h" #include "GPU/D3D11/FramebufferManagerD3D11.h" diff --git a/GPU/Directx9/DepalettizeShaderDX9.cpp b/GPU/Directx9/DepalettizeShaderDX9.cpp index 2365e41d58..ec91de50ba 100644 --- a/GPU/Directx9/DepalettizeShaderDX9.cpp +++ b/GPU/Directx9/DepalettizeShaderDX9.cpp @@ -18,7 +18,6 @@ #include #include -#include "base/logging.h" #include "thin3d/thin3d.h" #include "Common/Log.h" #include "Common/StringUtils.h" diff --git a/GPU/Directx9/DrawEngineDX9.cpp b/GPU/Directx9/DrawEngineDX9.cpp index 521393b548..a10a6fca2d 100644 --- a/GPU/Directx9/DrawEngineDX9.cpp +++ b/GPU/Directx9/DrawEngineDX9.cpp @@ -15,9 +15,9 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "base/logging.h" #include "base/timeutil.h" +#include "Common/Log.h" #include "Common/MemoryUtil.h" #include "Core/MemMap.h" #include "Core/System.h" diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index 73049a864b..1ba0958f66 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -20,7 +20,6 @@ #include "Common/Serialize/Serializer.h" #include "Common/GraphicsContext.h" #include "base/NativeApp.h" -#include "base/logging.h" #include "profiler/profiler.h" #include "i18n/i18n.h" #include "Core/Debugger/Breakpoints.h" diff --git a/GPU/Directx9/ShaderManagerDX9.cpp b/GPU/Directx9/ShaderManagerDX9.cpp index e3157371e8..64a1d28137 100644 --- a/GPU/Directx9/ShaderManagerDX9.cpp +++ b/GPU/Directx9/ShaderManagerDX9.cpp @@ -21,8 +21,8 @@ #include #include + #include "gfx/d3d9_shader.h" -#include "base/logging.h" #include "base/stringutil.h" #include "i18n/i18n.h" #include "math/lin/matrix4x4.h" diff --git a/GPU/Directx9/StencilBufferDX9.cpp b/GPU/Directx9/StencilBufferDX9.cpp index 5c0459c6e8..4310a1654e 100644 --- a/GPU/Directx9/StencilBufferDX9.cpp +++ b/GPU/Directx9/StencilBufferDX9.cpp @@ -17,8 +17,6 @@ #include -#include "base/logging.h" - #include "gfx/d3d9_state.h" #include "ext/native/thin3d/thin3d.h" #include "Core/Reporting.h" diff --git a/GPU/GLES/DepalettizeShaderGLES.cpp b/GPU/GLES/DepalettizeShaderGLES.cpp index 348411e082..59517c0f4d 100644 --- a/GPU/GLES/DepalettizeShaderGLES.cpp +++ b/GPU/GLES/DepalettizeShaderGLES.cpp @@ -17,7 +17,6 @@ #include -#include "base/logging.h" #include "Common/Log.h" #include "Common/StringUtils.h" #include "Core/Reporting.h" diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index 737548acd1..e245fe3112 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -15,7 +15,6 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "base/logging.h" #include "base/timeutil.h" #include "Common/MemoryUtil.h" diff --git a/GPU/GLES/FragmentShaderGeneratorGLES.cpp b/GPU/GLES/FragmentShaderGeneratorGLES.cpp index 97f319fd7e..945f3fb17b 100644 --- a/GPU/GLES/FragmentShaderGeneratorGLES.cpp +++ b/GPU/GLES/FragmentShaderGeneratorGLES.cpp @@ -18,8 +18,8 @@ #include #include +#include "Common/Log.h" #include "Common/StringUtils.h" -#include "base/logging.h" #include "gfx_es2/gpu_features.h" #include "Core/Reporting.h" #include "Core/Config.h" diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 1597ae0218..40fda18e5e 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -15,10 +15,10 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "base/logging.h" #include "profiler/profiler.h" #include "i18n/i18n.h" +#include "Common/Log.h" #include "Common/Serialize/Serializer.h" #include "Common/FileUtil.h" #include "Common/GraphicsContext.h" diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index eb992d642a..58001193b8 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -24,7 +24,6 @@ #include #include "math/dataconv.h" -#include "base/logging.h" #include "base/timeutil.h" #include "gfx/gl_debug_log.h" #include "gfx_es2/gpu_features.h" @@ -35,6 +34,7 @@ #include "thin3d/thin3d.h" #include "thin3d/GLRenderManager.h" +#include "Common/Log.h" #include "Common/FileUtil.h" #include "Core/Config.h" #include "Core/Host.h" diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index cad3b34225..963fa0f0a6 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -17,12 +17,12 @@ #include -#include "base/logging.h" #include "base/timeutil.h" #include "math/dataconv.h" #include "profiler/profiler.h" #include "thin3d/VulkanRenderManager.h" +#include "Common/Log.h" #include "Common/MemoryUtil.h" #include "Core/MemMap.h" #include "Core/System.h" diff --git a/GPU/Vulkan/FragmentShaderGeneratorVulkan.cpp b/GPU/Vulkan/FragmentShaderGeneratorVulkan.cpp index 87e07857c0..87920c52a7 100644 --- a/GPU/Vulkan/FragmentShaderGeneratorVulkan.cpp +++ b/GPU/Vulkan/FragmentShaderGeneratorVulkan.cpp @@ -18,9 +18,10 @@ #include #include -#include "Common/StringUtils.h" -#include "base/logging.h" #include "gfx_es2/gpu_features.h" + +#include "Common/Log.h" +#include "Common/StringUtils.h" #include "Core/Reporting.h" #include "Core/Config.h" #include "GPU/Common/GPUStateUtils.h" diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index eb31fbc95e..6442b3e8d7 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -18,10 +18,10 @@ #include -#include "base/logging.h" #include "base/timeutil.h" #include "profiler/profiler.h" +#include "Common/Log.h" #include "Common/Serialize/Serializer.h" #include "Common/FileUtil.h" #include "Common/GraphicsContext.h" diff --git a/GPU/Vulkan/ShaderManagerVulkan.cpp b/GPU/Vulkan/ShaderManagerVulkan.cpp index 4cd2c98363..c3d937049f 100644 --- a/GPU/Vulkan/ShaderManagerVulkan.cpp +++ b/GPU/Vulkan/ShaderManagerVulkan.cpp @@ -19,7 +19,6 @@ //#define SHADERLOG #endif -#include "base/logging.h" #include "base/stringutil.h" #include "math/lin/matrix4x4.h" #include "math/math_util.h" @@ -27,6 +26,7 @@ #include "profiler/profiler.h" #include "thin3d/thin3d.h" #include "util/text/utf8.h" + #include "Common/Vulkan/VulkanContext.h" #include "Common/Vulkan/VulkanMemory.h" #include "Common/Log.h" diff --git a/GPU/Vulkan/StencilBufferVulkan.cpp b/GPU/Vulkan/StencilBufferVulkan.cpp index c952a57b37..e655780476 100644 --- a/GPU/Vulkan/StencilBufferVulkan.cpp +++ b/GPU/Vulkan/StencilBufferVulkan.cpp @@ -15,10 +15,10 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "base/logging.h" - #include "ext/native/thin3d/thin3d.h" #include "ext/native/thin3d/VulkanRenderManager.h" + +#include "Common/Log.h" #include "Core/Reporting.h" #include "GPU/Common/StencilCommon.h" #include "GPU/Vulkan/FramebufferManagerVulkan.h" diff --git a/GPU/Vulkan/VulkanUtil.cpp b/GPU/Vulkan/VulkanUtil.cpp index 7e0ad69ba7..3d5d196e94 100644 --- a/GPU/Vulkan/VulkanUtil.cpp +++ b/GPU/Vulkan/VulkanUtil.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "base/logging.h" // For OutputDebugStringUTF8. TODO: Move it. + #include "base/basictypes.h" #include "base/stringutil.h" #include "Common/Log.h" diff --git a/Qt/QtMain.h b/Qt/QtMain.h index 19a820e7fb..9a69162919 100644 --- a/Qt/QtMain.h +++ b/Qt/QtMain.h @@ -23,7 +23,6 @@ QTM_USE_NAMESPACE #include #include "base/display.h" -#include "base/logging.h" #include "base/timeutil.h" #include "file/zip_read.h" #include "gfx/gl_common.h" diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index d8db2bea6f..1de2def802 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -1,12 +1,12 @@ #include #include -#include "base/logging.h" #include "base/timeutil.h" #include "file/chunk_file.h" #include "file/vfs.h" #include "ui/root.h" +#include "Common/Log.h" #include "Common/Serialize/SerializeFuncs.h" #include "Common/CommonTypes.h" #include "Common/FixedSizeQueue.h" @@ -178,7 +178,7 @@ public: if (wave_.codec == PSP_CODEC_AT3) { decoder_->SetExtraData(&wave_.at3_extradata[2], 14, wave_.raw_bytes_per_frame); } - ILOG("read ATRAC, frames: %d, rate %d", wave_.numFrames, wave_.sample_rate); + INFO_LOG(AUDIO, "read ATRAC, frames: %d, rate %d", wave_.numFrames, wave_.sample_rate); } ~AT3PlusReader() { diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 08476fbad0..59f5abed66 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -1231,7 +1231,7 @@ void EmuScreen::checkPowerDown() { if (PSP_IsInited()) { PSP_Shutdown(); } - ILOG("SELF-POWERDOWN!"); + INFO_LOG(SYSTEM, "SELF-POWERDOWN!"); screenManager()->switchScreen(new MainScreen()); bootPending_ = false; invalid_ = true; diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index e1c2db94f0..4b1746fb2b 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -634,7 +634,7 @@ handleELF: info_->pending = false; info_->working = false; - // ILOG("Completed writing info for %s", info_->GetTitle().c_str()); + // INFO_LOG(SYSTEM, "Completed writing info for %s", info_->GetTitle().c_str()); } float priority() override { diff --git a/UWP/StorageFileLoader.cpp b/UWP/StorageFileLoader.cpp index 7253288fd4..0c52448a58 100644 --- a/UWP/StorageFileLoader.cpp +++ b/UWP/StorageFileLoader.cpp @@ -1,6 +1,5 @@ #include "pch.h" #include "ppltasks.h" -#include "base/logging.h" #include "file/file_util.h" #include "thread/threadutil.h" #include "StorageFileLoader.h" @@ -96,7 +95,7 @@ void StorageFileLoader::threadfunc() { break; } default: - ELOG("Unknown operation"); + ERROR_LOG(SYSTEM, "Unknown operation"); operationRequested_ = false; break; } diff --git a/Windows/GPU/D3D11Context.cpp b/Windows/GPU/D3D11Context.cpp index 498467ea37..19fdd64dd1 100644 --- a/Windows/GPU/D3D11Context.cpp +++ b/Windows/GPU/D3D11Context.cpp @@ -5,8 +5,8 @@ #include #include -#include "base/logging.h" -#include "Base/display.h" +#include "Common/Log.h" +#include "base/display.h" #include "util/text/utf8.h" #include "i18n/i18n.h" diff --git a/Windows/GPU/D3D9Context.cpp b/Windows/GPU/D3D9Context.cpp index e87ed1ea60..c948654b98 100644 --- a/Windows/GPU/D3D9Context.cpp +++ b/Windows/GPU/D3D9Context.cpp @@ -5,11 +5,11 @@ #include "gfx/d3d9_state.h" -#include "base/logging.h" #include "base/display.h" #include "util/text/utf8.h" #include "i18n/i18n.h" +#include "Common/Log.h" #include "Core/Config.h" #include "Core/ConfigValues.h" #include "Core/Reporting.h" diff --git a/headless/SDLHeadlessHost.cpp b/headless/SDLHeadlessHost.cpp index b45b50724d..b81b47a51e 100644 --- a/headless/SDLHeadlessHost.cpp +++ b/headless/SDLHeadlessHost.cpp @@ -32,7 +32,6 @@ #include "GPU/Common/GPUDebugInterface.h" #include "GPU/GPUState.h" -#include "base/logging.h" #include "base/timeutil.h" #include "gfx/gl_common.h" #include "gfx_es2/gpu_features.h" diff --git a/headless/WindowsHeadlessHost.cpp b/headless/WindowsHeadlessHost.cpp index dba04b79ad..30a9f1b7b2 100644 --- a/headless/WindowsHeadlessHost.cpp +++ b/headless/WindowsHeadlessHost.cpp @@ -33,7 +33,6 @@ #include "Windows/GPU/D3D11Context.h" #include "Windows/GPU/WindowsVulkanContext.h" -#include "base/logging.h" #include "base/timeutil.h" #include "gfx/gl_common.h" #include "gfx_es2/gpu_features.h" From 6f1915110fb549162b354987bf78d25349785711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 15:22:44 +0200 Subject: [PATCH 05/15] Remove base/logging from UI and more --- Core/MIPS/ARM/ArmCompVFPUNEON.cpp | 6 ++---- Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp | 13 ++++++------- Core/MIPS/ARM/ArmJit.cpp | 3 ++- Core/MIPS/ARM/ArmRegCacheFPU.cpp | 12 ++++++------ Core/MIPS/ARM64/Arm64RegCacheFPU.cpp | 2 +- Core/MIPS/MIPS/MipsJit.cpp | 1 - Core/MIPS/MIPSTables.cpp | 1 - GPU/Common/VertexDecoderArm.cpp | 2 +- UI/ControlMappingScreen.cpp | 1 - UI/DisplayLayoutEditor.cpp | 1 + UI/EmuScreen.cpp | 6 +++--- UI/GameInfoCache.cpp | 2 +- UI/InstallZipScreen.cpp | 1 - UI/NativeApp.cpp | 4 +++- UI/TiltEventProcessor.cpp | 7 +++---- android/jni/OpenSLContext.cpp | 23 +++++++++++------------ 16 files changed, 40 insertions(+), 45 deletions(-) diff --git a/Core/MIPS/ARM/ArmCompVFPUNEON.cpp b/Core/MIPS/ARM/ArmCompVFPUNEON.cpp index 41961e944b..990e36e293 100644 --- a/Core/MIPS/ARM/ArmCompVFPUNEON.cpp +++ b/Core/MIPS/ARM/ArmCompVFPUNEON.cpp @@ -30,7 +30,6 @@ #include -#include "base/logging.h" #include "math/math_util.h" #include "Common/CPUDetect.h" @@ -55,8 +54,7 @@ // #define CONDITIONAL_DISABLE { fpr.ReleaseSpillLocksAndDiscardTemps(); Comp_Generic(op); return; } #define CONDITIONAL_DISABLE(flag) if (jo.Disabled(JitDisable::flag)) { Comp_Generic(op); return; } #define DISABLE { fpr.ReleaseSpillLocksAndDiscardTemps(); Comp_Generic(op); return; } -#define DISABLE_UNKNOWN_PREFIX { WLOG("DISABLE: Unknown Prefix in %s", __FUNCTION__); fpr.ReleaseSpillLocksAndDiscardTemps(); Comp_Generic(op); return; } - +#define DISABLE_UNKNOWN_PREFIX { WARN_LOG(JIT, "DISABLE: Unknown Prefix in %s", __FUNCTION__); fpr.ReleaseSpillLocksAndDiscardTemps(); Comp_Generic(op); return; } #define _RS MIPS_GET_RS(op) #define _RT MIPS_GET_RT(op) @@ -864,7 +862,7 @@ void ArmJit::CompNEON_Vmmul(MIPSOpcode op) { bool overlap = GetMatrixOverlap(_VD, _VS, msz) || GetMatrixOverlap(_VD, _VT, msz); if (overlap) { // Later. Fortunately, the VFPU also seems to prohibit overlap for matrix mul. - ILOG("Matrix overlap, ignoring."); + INFO_LOG(JIT, "Matrix overlap, ignoring."); DISABLE; } diff --git a/Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp b/Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp index 546c791a46..7fada69a92 100644 --- a/Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp +++ b/Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp @@ -30,7 +30,6 @@ #include -#include "base/logging.h" #include "math/math_util.h" #include "Common/CPUDetect.h" @@ -271,7 +270,7 @@ ArmJit::DestARMReg ArmJit::NEONMapPrefixD(int vreg, VectorSize sz, int mapFlags) dest.backingRd = dest.rd; } else { // Allocate a temporary register. - ELOG("PREFIXD: Write mask allocated! %i/%i", writeMask, full_mask); + ERROR_LOG(JIT, "PREFIXD: Write mask allocated! %i/%i", writeMask, full_mask); dest.rd = fpr.QAllocTemp(sz); dest.backingRd = fpr.QMapReg(vreg, sz, mapFlags & ~MAP_NOINIT); // Force initialization of the backing reg. } @@ -295,12 +294,12 @@ void ArmJit::NEONApplyPrefixD(DestARMReg dest) { if (sat1_mask && sat3_mask) { // Why would anyone do this? - ELOG("PREFIXD: Can't have both sat[0-1] and sat[-1-1] at the same time yet"); + ERROR_LOG(JIT, "PREFIXD: Can't have both sat[0-1] and sat[-1-1] at the same time yet"); } if (sat1_mask) { if (sat1_mask != full_mask) { - ELOG("PREFIXD: Can't have partial sat1 mask yet (%i vs %i)", sat1_mask, full_mask); + ERROR_LOG(JIT, "PREFIXD: Can't have partial sat1 mask yet (%i vs %i)", sat1_mask, full_mask); } if (IsD(dest.rd)) { VMOV_immf(D0, 0.0); @@ -317,7 +316,7 @@ void ArmJit::NEONApplyPrefixD(DestARMReg dest) { if (sat3_mask && sat1_mask != full_mask) { if (sat3_mask != full_mask) { - ELOG("PREFIXD: Can't have partial sat3 mask yet (%i vs %i)", sat3_mask, full_mask); + ERROR_LOG(JIT, "PREFIXD: Can't have partial sat3 mask yet (%i vs %i)", sat3_mask, full_mask); } if (IsD(dest.rd)) { VMOV_immf(D0, 0.0); @@ -341,11 +340,11 @@ void ArmJit::NEONApplyPrefixD(DestARMReg dest) { int writeMask = (~(js.prefixD >> 8)) & 0xF; if (writeMask == 3) { - ILOG("Doing writemask = 3"); + INFO_LOG(JIT, "Doing writemask = 3"); VMOV(D_0(dest.rd), D_0(dest.backingRd)); } else { // TODO - ELOG("PREFIXD: Arbitrary write masks not supported (%i / %i)", writeMask, full_mask); + ERROR_LOG(JIT, "PREFIXD: Arbitrary write masks not supported (%i / %i)", writeMask, full_mask); VMOV(dest.backingRd, dest.rd); } } diff --git a/Core/MIPS/ARM/ArmJit.cpp b/Core/MIPS/ARM/ArmJit.cpp index 1ff3c29ee8..829307b419 100644 --- a/Core/MIPS/ARM/ArmJit.cpp +++ b/Core/MIPS/ARM/ArmJit.cpp @@ -18,8 +18,9 @@ #include "ppsspp_config.h" #if PPSSPP_ARCH(ARM) -#include "base/logging.h" #include "profiler/profiler.h" + +#include "Common/Log.h" #include "Common/Serialize/Serializer.h" #include "Common/Serialize/SerializeFuncs.h" diff --git a/Core/MIPS/ARM/ArmRegCacheFPU.cpp b/Core/MIPS/ARM/ArmRegCacheFPU.cpp index a1378a67b3..21001b2b58 100644 --- a/Core/MIPS/ARM/ArmRegCacheFPU.cpp +++ b/Core/MIPS/ARM/ArmRegCacheFPU.cpp @@ -17,8 +17,8 @@ #include -#include "base/logging.h" #include "Common/CPUDetect.h" +#include "Common/Log.h" #include "Core/MIPS/MIPS.h" #include "Core/MIPS/ARM/ArmRegCacheFPU.h" #include "Core/MIPS/ARM/ArmJit.h" @@ -463,13 +463,13 @@ void ArmRegCacheFPU::FlushAll() { if (ar[a].isDirty) { if (m == -1) { - ILOG("ARM reg %i is dirty but has no mipsreg", a); + INFO_LOG(JIT, "ARM reg %i is dirty but has no mipsreg", a); continue; } int c = FlushGetSequential(a, GetNumARMFPURegs()); if (c == 1) { - // ILOG("Got single register: %i (%i)", a, m); + // INFO_LOG(JIT, "Got single register: %i (%i)", a, m); emit_->VSTR((ARMReg)(a + S0), CTXREG, GetMipsRegOffset(m)); } else if (c == 2) { // Probably not worth using VSTMIA for two. @@ -477,9 +477,9 @@ void ArmRegCacheFPU::FlushAll() { emit_->VSTR((ARMReg)(a + S0), CTXREG, offset); emit_->VSTR((ARMReg)(a + 1 + S0), CTXREG, offset + 4); } else { - // ILOG("Got sequence: %i at %i (%i)", c, a, m); + // INFO_LOG(JIT, "Got sequence: %i at %i (%i)", c, a, m); emit_->ADDI2R(SCRATCHREG1, CTXREG, GetMipsRegOffset(m), SCRATCHREG2); - // ILOG("VSTMIA R0, %i, %i", a, c); + // INFO_LOG(JIT, "VSTMIA R0, %i, %i", a, c); emit_->VSTMIA(SCRATCHREG1, false, (ARMReg)(S0 + a), c); } @@ -908,7 +908,7 @@ ARMReg ArmRegCacheFPU::QMapReg(int vreg, VectorSize sz, int flags) { // We didn't find the extra register, but we got a list of regs to flush. Flush 'em. // Here we can check for opportunities to do a "transpose-flush" of row vectors, etc. if (!quadsToFlush.empty()) { - ILOG("New mapping %s collided with %i quads, flushing them.", GetVectorNotation(vreg, sz), (int)quadsToFlush.size()); + INFO_LOG(JIT, "New mapping %s collided with %d quads, flushing them.", GetVectorNotation(vreg, sz), (int)quadsToFlush.size()); } for (size_t i = 0; i < quadsToFlush.size(); i++) { QFlush(quadsToFlush[i]); diff --git a/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp b/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp index 3861fb44a1..ebb0d09494 100644 --- a/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp +++ b/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp @@ -400,7 +400,7 @@ void Arm64RegCacheFPU::FlushAll() { if (ar[a].isDirty) { if (m == -1) { - ILOG("ARM reg %i is dirty but has no mipsreg", a); + INFO_LOG(JIT, "ARM reg %i is dirty but has no mipsreg", a); continue; } diff --git a/Core/MIPS/MIPS/MipsJit.cpp b/Core/MIPS/MIPS/MipsJit.cpp index 345ff74018..0874282d50 100644 --- a/Core/MIPS/MIPS/MipsJit.cpp +++ b/Core/MIPS/MIPS/MipsJit.cpp @@ -18,7 +18,6 @@ #include "ppsspp_config.h" #if PPSSPP_ARCH(MIPS) -#include "base/logging.h" #include "profiler/profiler.h" #include "Common/Serialize/Serializer.h" #include "Core/Reporting.h" diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp index d958c4cd2a..2270fc3630 100644 --- a/Core/MIPS/MIPSTables.cpp +++ b/Core/MIPS/MIPSTables.cpp @@ -28,7 +28,6 @@ #include "Core/CoreTiming.h" #include "Core/Reporting.h" #include "Core/Debugger/Breakpoints.h" -#include "base/logging.h" #include "JitCommon/JitCommon.h" diff --git a/GPU/Common/VertexDecoderArm.cpp b/GPU/Common/VertexDecoderArm.cpp index 5f9dd3371a..0feb2df100 100644 --- a/GPU/Common/VertexDecoderArm.cpp +++ b/GPU/Common/VertexDecoderArm.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "ppsspp_config.h" + #if PPSSPP_ARCH(ARM) // This allows highlighting to work. Yay. @@ -25,7 +26,6 @@ #include -#include "base/logging.h" #include "Common/CPUDetect.h" #include "Core/Config.h" #include "Core/Reporting.h" diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 2008c19f50..3d711eda2f 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -20,7 +20,6 @@ #include #include "base/colorutil.h" -#include "base/logging.h" #include "base/display.h" #include "gfx/texture_atlas.h" #include "i18n/i18n.h" diff --git a/UI/DisplayLayoutEditor.cpp b/UI/DisplayLayoutEditor.cpp index 77da5f407e..6c3e6e1f5a 100644 --- a/UI/DisplayLayoutEditor.cpp +++ b/UI/DisplayLayoutEditor.cpp @@ -16,6 +16,7 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include + #include "ui/ui_context.h" #include "UI/DisplayLayoutEditor.h" diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 59f5abed66..1d44551622 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -20,7 +20,6 @@ #include #include "base/display.h" -#include "base/logging.h" #include "base/timeutil.h" #include "profiler/profiler.h" @@ -38,6 +37,7 @@ #include "i18n/i18n.h" #include "Common/KeyMap.h" +#include "Common/Log.h" #ifndef MOBILE_DEVICE #include "Core/AVIDump.h" @@ -404,7 +404,7 @@ void EmuScreen::sendMessage(const char *message, const char *value) { std::string resetError; if (!PSP_InitStart(PSP_CoreParameter(), &resetError)) { - ELOG("Error resetting: %s", resetError.c_str()); + ERROR_LOG(LOADER, "Error resetting: %s", resetError.c_str()); stopRender_ = true; screenManager()->switchScreen(new MainScreen()); System_SendMessage("event", "failstartgame"); @@ -856,7 +856,7 @@ void EmuScreen::pspKey(int pspKeyCode, int flags) { onVKeyUp(pspKeyCode); } } else { - // ILOG("pspKey %i %i", pspKeyCode, flags); + // INFO_LOG(SYSTEM, "pspKey %i %i", pspKeyCode, flags); if (flags & KEY_DOWN) __CtrlButtonDown(pspKeyCode); if (flags & KEY_UP) diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 4b1746fb2b..1fa929f5a4 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -22,13 +22,13 @@ #include #include -#include "base/logging.h" #include "base/timeutil.h" #include "base/stringutil.h" #include "file/file_util.h" #include "file/zip_read.h" #include "thin3d/thin3d.h" #include "thread/prioritizedworkqueue.h" + #include "Common/FileUtil.h" #include "Common/StringUtils.h" #include "Core/FileSystems/ISOFileSystem.h" diff --git a/UI/InstallZipScreen.cpp b/UI/InstallZipScreen.cpp index 873ddaf0c5..3a586b776b 100644 --- a/UI/InstallZipScreen.cpp +++ b/UI/InstallZipScreen.cpp @@ -15,7 +15,6 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "base/logging.h" #include "i18n/i18n.h" #include "ui/ui.h" #include "ui/view.h" diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 3db216d802..919d7ce2f6 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -44,7 +44,9 @@ #endif #include "base/display.h" -#include "base/logging.h" + +#include "base/logging.h" // For "AndroidLogger". TODO: Remove. + #include "base/stringutil.h" #include "base/timeutil.h" #include "base/NativeApp.h" diff --git a/UI/TiltEventProcessor.cpp b/UI/TiltEventProcessor.cpp index 97b5bcd90a..2f66906239 100644 --- a/UI/TiltEventProcessor.cpp +++ b/UI/TiltEventProcessor.cpp @@ -1,11 +1,10 @@ #define _USE_MATH_DEFINES + #include -#include "UI/TiltEventProcessor.h" + #include "Core/Config.h" #include "Core/HLE/sceCtrl.h" -#include "math.h" -#include "base/logging.h" - +#include "UI/TiltEventProcessor.h" using namespace TiltEventProcessor; diff --git a/android/jni/OpenSLContext.cpp b/android/jni/OpenSLContext.cpp index 26965a72d5..77ccfde2eb 100644 --- a/android/jni/OpenSLContext.cpp +++ b/android/jni/OpenSLContext.cpp @@ -9,7 +9,6 @@ #include #include -#include "base/logging.h" #include "Common/Log.h" #include "OpenSLContext.h" @@ -24,7 +23,7 @@ void OpenSLContext::bqPlayerCallbackWrap(SLAndroidSimpleBufferQueueItf bq, void void OpenSLContext::BqPlayerCallback(SLAndroidSimpleBufferQueueItf bq) { if (bq != bqPlayerBufferQueue) { - ELOG("OpenSL: Wrong bq!"); + ERROR_LOG(AUDIO, "OpenSL: Wrong bq!"); return; } @@ -41,7 +40,7 @@ void OpenSLContext::BqPlayerCallback(SLAndroidSimpleBufferQueueItf bq) { // the most likely other result is SL_RESULT_BUFFER_INSUFFICIENT, // which for this code example would indicate a programming error if (result != SL_RESULT_SUCCESS) { - ELOG("OpenSL: Failed to enqueue! %i %i", renderedFrames, sizeInBytes); + ERROR_LOG(AUDIO, "OpenSL: Failed to enqueue! %i %i", renderedFrames, sizeInBytes); } curBuffer += 1; // Switch buffer @@ -58,7 +57,7 @@ bool OpenSLContext::Init() { // create engine result = slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL); if (result != SL_RESULT_SUCCESS) { - ELOG("OpenSL: Failed to create the engine: %d", (int)result); + ERROR_LOG(AUDIO, "OpenSL: Failed to create the engine: %d", (int)result); engineObject = nullptr; return false; } @@ -70,7 +69,7 @@ bool OpenSLContext::Init() { result = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0, 0, 0); if (result != SL_RESULT_SUCCESS) { - ELOG("OpenSL: Failed to create output mix: %d", (int)result); + ERROR_LOG(AUDIO, "OpenSL: Failed to create output mix: %d", (int)result); (*engineObject)->Destroy(engineObject); engineEngine = nullptr; engineObject = nullptr; @@ -104,7 +103,7 @@ bool OpenSLContext::Init() { const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE}; result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req); if (result != SL_RESULT_SUCCESS) { - ELOG("OpenSL: CreateAudioPlayer failed: %d", (int)result); + ERROR_LOG(AUDIO, "OpenSL: CreateAudioPlayer failed: %d", (int)result); (*outputMixObject)->Destroy(outputMixObject); outputMixObject = nullptr; @@ -149,15 +148,15 @@ bool OpenSLContext::Init() { // shut down the native audio system OpenSLContext::~OpenSLContext() { if (bqPlayerPlay) { - ILOG("OpenSL: Shutdown - stopping playback"); + INFO_LOG(AUDIO, "OpenSL: Shutdown - stopping playback"); SLresult result; result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_STOPPED); if (SL_RESULT_SUCCESS != result) { - ELOG("SetPlayState failed"); + ERROR_LOG(AUDIO, "SetPlayState failed"); } } - ILOG("OpenSL: Shutdown - deleting player object"); + INFO_LOG(AUDIO, "OpenSL: Shutdown - deleting player object"); if (bqPlayerObject) { (*bqPlayerObject)->Destroy(bqPlayerObject); @@ -167,14 +166,14 @@ OpenSLContext::~OpenSLContext() { bqPlayerVolume = nullptr; } - ILOG("OpenSL: Shutdown - deleting mix object"); + INFO_LOG(AUDIO, "OpenSL: Shutdown - deleting mix object"); if (outputMixObject) { (*outputMixObject)->Destroy(outputMixObject); outputMixObject = nullptr; } - ILOG("OpenSL: Shutdown - deleting engine object"); + INFO_LOG(AUDIO, "OpenSL: Shutdown - deleting engine object"); if (engineObject) { (*engineObject)->Destroy(engineObject); @@ -186,6 +185,6 @@ OpenSLContext::~OpenSLContext() { delete[] buffer[i]; buffer[i] = nullptr; } - ILOG("OpenSL: Shutdown - finished"); + INFO_LOG(AUDIO, "OpenSL: Shutdown - finished"); } From bf72f746ea714ba48c2e211184b732c80efa05cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 15:40:35 +0200 Subject: [PATCH 06/15] Remove base/logging.h from a whole bunch of files in native --- ext/native/data/compression.cpp | 8 +++---- ext/native/file/chunk_file.cpp | 1 - ext/native/file/fd_util.cpp | 12 +++++----- ext/native/file/file_util.cpp | 1 - ext/native/file/ini_file.cpp | 1 - ext/native/file/zip_read.cpp | 21 +++++++++-------- ext/native/gfx/gl_debug_log.cpp | 5 ++-- ext/native/gfx/texture_atlas.cpp | 2 +- ext/native/gfx_es2/draw_buffer.cpp | 10 ++++---- ext/native/gfx_es2/draw_text.cpp | 1 - ext/native/gfx_es2/draw_text_android.cpp | 20 ++++++++-------- ext/native/gfx_es2/draw_text_qt.cpp | 9 ++++---- ext/native/gfx_es2/draw_text_uwp.cpp | 5 +--- ext/native/gfx_es2/draw_text_win.cpp | 7 +++--- ext/native/gfx_es2/glsl_program.cpp | 29 ++++++++++++------------ ext/native/gfx_es2/gpu_features.cpp | 25 ++++++++++---------- ext/native/i18n/i18n.cpp | 9 ++++---- ext/native/image/png_load.cpp | 17 +++++++------- ext/native/image/zim_load.cpp | 19 ++++++++-------- ext/native/image/zim_save.cpp | 14 +++++++----- 20 files changed, 105 insertions(+), 111 deletions(-) diff --git a/ext/native/data/compression.cpp b/ext/native/data/compression.cpp index f2bc6494ee..751a9595cf 100644 --- a/ext/native/data/compression.cpp +++ b/ext/native/data/compression.cpp @@ -11,7 +11,7 @@ #include -#include "base/logging.h" +#include "Common/Log.h" /** Compress a STL string using zlib with given compression level and return * the binary data. */ @@ -20,7 +20,7 @@ bool compress_string(const std::string& str, std::string *dest, int compressionl memset(&zs, 0, sizeof(zs)); if (deflateInit(&zs, compressionlevel) != Z_OK) { - ELOG("deflateInit failed while compressing."); + ERROR_LOG(IO, "deflateInit failed while compressing."); return false; } @@ -67,7 +67,7 @@ bool decompress_string(const std::string& str, std::string *dest) { // modification by hrydgard: inflateInit2, 16+MAXWBITS makes it read gzip data too if (inflateInit2(&zs, 32+MAX_WBITS) != Z_OK) { - ELOG("inflateInit failed while decompressing."); + ERROR_LOG(IO, "inflateInit failed while decompressing."); return false; } @@ -96,7 +96,7 @@ bool decompress_string(const std::string& str, std::string *dest) { if (ret != Z_STREAM_END) { // an error occurred that was not EOF std::ostringstream oss; - ELOG("Exception during zlib decompression: (%i) %s", ret, zs.msg); + ERROR_LOG(IO, "Exception during zlib decompression: (%i) %s", ret, zs.msg); return false; } diff --git a/ext/native/file/chunk_file.cpp b/ext/native/file/chunk_file.cpp index 0804040038..20553a8657 100644 --- a/ext/native/file/chunk_file.cpp +++ b/ext/native/file/chunk_file.cpp @@ -1,4 +1,3 @@ -#include "base/logging.h" #include "file/chunk_file.h" #include "file/zip_read.h" #include "file/file_util.h" diff --git a/ext/native/file/fd_util.cpp b/ext/native/file/fd_util.cpp index 38a84f0f22..1b47c215fc 100644 --- a/ext/native/file/fd_util.cpp +++ b/ext/native/file/fd_util.cpp @@ -18,7 +18,7 @@ #endif #include -#include "base/logging.h" +#include "Common/Log.h" namespace fd_util { @@ -45,7 +45,7 @@ ssize_t ReadLine(int fd, char *vptr, size_t buf_size) { else { if (errno == EINTR) continue; - FLOG("Error in Readline()"); + _assert_msg_(false, "Error in Readline()"); } } @@ -64,7 +64,7 @@ ssize_t WriteLine(int fd, const char *vptr, size_t n) { if (errno == EINTR) nwritten = 0; else - FLOG("Error in Writeline()"); + _assert_msg_(false, "Error in Writeline()"); } nleft -= nwritten; buffer += nwritten; @@ -113,7 +113,7 @@ void SetNonBlocking(int sock, bool non_blocking) { int opts = fcntl(sock, F_GETFL); if (opts < 0) { perror("fcntl(F_GETFL)"); - ELOG("Error getting socket status while changing nonblocking status"); + ERROR_LOG(IO, "Error getting socket status while changing nonblocking status"); } if (non_blocking) { opts = (opts | O_NONBLOCK); @@ -123,12 +123,12 @@ void SetNonBlocking(int sock, bool non_blocking) { if (fcntl(sock, F_SETFL, opts) < 0) { perror("fcntl(F_SETFL)"); - ELOG("Error setting socket nonblocking status"); + ERROR_LOG(IO, "Error setting socket nonblocking status"); } #else u_long val = non_blocking ? 1 : 0; if (ioctlsocket(sock, FIONBIO, &val) != 0) { - ELOG("Error setting socket nonblocking status"); + ERROR_LOG(IO, "Error setting socket nonblocking status"); } #endif } diff --git a/ext/native/file/file_util.cpp b/ext/native/file/file_util.cpp index d95dcef311..7206c36e3c 100644 --- a/ext/native/file/file_util.cpp +++ b/ext/native/file/file_util.cpp @@ -18,7 +18,6 @@ #include #include -#include "base/logging.h" #include "base/basictypes.h" #include "base/stringutil.h" #include "file/file_util.h" diff --git a/ext/native/file/ini_file.cpp b/ext/native/file/ini_file.cpp index 1e4beadaeb..c4c1b7934e 100644 --- a/ext/native/file/ini_file.cpp +++ b/ext/native/file/ini_file.cpp @@ -16,7 +16,6 @@ #include #include -#include "base/logging.h" #include "base/stringutil.h" #include "file/ini_file.h" #include "file/vfs.h" diff --git a/ext/native/file/zip_read.cpp b/ext/native/file/zip_read.cpp index 8c12860246..b6e997877b 100644 --- a/ext/native/file/zip_read.cpp +++ b/ext/native/file/zip_read.cpp @@ -8,16 +8,17 @@ #endif #include "base/basictypes.h" -#include "base/logging.h" #include "file/zip_read.h" +#include "Common/Log.h" + #ifdef __ANDROID__ uint8_t *ReadFromZip(zip *archive, const char* filename, size_t *size) { // Figure out the file size first. struct zip_stat zstat; zip_file *file = zip_fopen(archive, filename, ZIP_FL_NOCASE|ZIP_FL_UNCHANGED); if (!file) { - ELOG("Error opening %s from ZIP", filename); + ERROR_LOG(IO, "Error opening %s from ZIP", filename); return 0; } zip_stat(archive, filename, ZIP_FL_NOCASE|ZIP_FL_UNCHANGED, &zstat); @@ -67,16 +68,16 @@ ZipAssetReader::ZipAssetReader(const char *zip_file, const char *in_zip_path) { zip_file_ = zip_open(zip_file, 0, NULL); strcpy(in_zip_path_, in_zip_path); if (!zip_file_) { - ELOG("Failed to open %s as a zip file", zip_file); + ERROR_LOG(IO, "Failed to open %s as a zip file", zip_file); } std::vector info; GetFileListing("assets", &info, 0); for (size_t i = 0; i < info.size(); i++) { if (info[i].isDirectory) { - DLOG("Directory: %s", info[i].name.c_str()); + DEBUG_LOG(IO, "Directory: %s", info[i].name.c_str()); } else { - DLOG("File: %s", info[i].name.c_str()); + DEBUG_LOG(IO, "File: %s", info[i].name.c_str()); } } } @@ -264,7 +265,7 @@ static int num_entries = 0; void VFSRegister(const char *prefix, AssetReader *reader) { entries[num_entries].prefix = prefix; entries[num_entries].reader = reader; - DLOG("Registered VFS for prefix %s: %s", prefix, reader->toString().c_str()); + DEBUG_LOG(IO, "Registered VFS for prefix %s: %s", prefix, reader->toString().c_str()); num_entries++; } @@ -289,7 +290,7 @@ static bool IsLocalPath(const char *path) { uint8_t *VFSReadFile(const char *filename, size_t *size) { if (IsLocalPath(filename)) { // Local path, not VFS. - // ILOG("Not a VFS path: %s . Reading local file.", filename); + // INFO_LOG(IO, "Not a VFS path: %s . Reading local file.", filename); return ReadLocalFile(filename, size); } @@ -310,7 +311,7 @@ uint8_t *VFSReadFile(const char *filename, size_t *size) { } } if (!fileSystemFound) { - ELOG("Missing filesystem for '%s'", filename); + ERROR_LOG(IO, "Missing filesystem for '%s'", filename); } // Otherwise, the file was just missing. No need to log. return 0; } @@ -337,7 +338,7 @@ bool VFSGetFileListing(const char *path, std::vector *listing, const c } if (!fileSystemFound) { - ELOG("Missing filesystem for %s", path); + ERROR_LOG(IO, "Missing filesystem for %s", path); } // Otherwise, the file was just missing. No need to log. return false; } @@ -363,7 +364,7 @@ bool VFSGetFileInfo(const char *path, FileInfo *info) { } } if (!fileSystemFound) { - ELOG("Missing filesystem for %s", path); + ERROR_LOG(IO, "Missing filesystem for %s", path); } // Otherwise, the file was just missing. No need to log. return false; } diff --git a/ext/native/gfx/gl_debug_log.cpp b/ext/native/gfx/gl_debug_log.cpp index e72e286e7f..078b4ed843 100644 --- a/ext/native/gfx/gl_debug_log.cpp +++ b/ext/native/gfx/gl_debug_log.cpp @@ -1,9 +1,10 @@ #include -#include "base/logging.h" #include "gfx/gl_common.h" #include "gfx/gl_debug_log.h" +#include "Common/Log.h" + // This we can expand as needed. std::string GLEnumToString(uint16_t value) { char str[64]; @@ -36,6 +37,6 @@ std::string GLEnumToString(uint16_t value) { void CheckGLError(const char *file, int line) { GLenum err = glGetError(); if (err != GL_NO_ERROR) { - ELOG("GL error %s on %s:%d", GLEnumToString(err).c_str(), file, line); + ERROR_LOG(G3D, "GL error %s on %s:%d", GLEnumToString(err).c_str(), file, line); } } diff --git a/ext/native/gfx/texture_atlas.cpp b/ext/native/gfx/texture_atlas.cpp index 1622b3a42b..a38a791fa3 100644 --- a/ext/native/gfx/texture_atlas.cpp +++ b/ext/native/gfx/texture_atlas.cpp @@ -1,6 +1,6 @@ #include #include -#include "base/logging.h" + #include "gfx/texture_atlas.h" class ByteReader { diff --git a/ext/native/gfx_es2/draw_buffer.cpp b/ext/native/gfx_es2/draw_buffer.cpp index 94e5f28ae8..da23c142cb 100644 --- a/ext/native/gfx_es2/draw_buffer.cpp +++ b/ext/native/gfx_es2/draw_buffer.cpp @@ -4,7 +4,6 @@ #include #include "base/display.h" -#include "base/logging.h" #include "base/stringutil.h" #include "math/math_util.h" #include "gfx/texture_atlas.h" @@ -14,6 +13,8 @@ #include "util/text/utf8.h" #include "util/text/wrap_text.h" +#include "Common/Log.h" + enum { // Enough? MAX_VERTS = 65536, @@ -85,7 +86,7 @@ void DrawBuffer::Flush(bool set_blend_state) { if (count_ == 0) return; if (!pipeline_) { - ELOG("DrawBuffer: No program set, skipping flush!"); + ERROR_LOG(G3D, "DrawBuffer: No program set, skipping flush!"); count_ = 0; return; } @@ -106,10 +107,7 @@ void DrawBuffer::Flush(bool set_blend_state) { } void DrawBuffer::V(float x, float y, float z, uint32_t color, float u, float v) { - if (count_ >= MAX_VERTS) { - FLOG("Overflowed the DrawBuffer"); - return; - } + _assert_msg_(count_ < MAX_VERTS, "Overflowed the DrawBuffer"); Vertex *vert = &verts_[count_++]; vert->x = x; diff --git a/ext/native/gfx_es2/draw_text.cpp b/ext/native/gfx_es2/draw_text.cpp index 4463bdbb55..a205fbca61 100644 --- a/ext/native/gfx_es2/draw_text.cpp +++ b/ext/native/gfx_es2/draw_text.cpp @@ -1,5 +1,4 @@ #include "base/display.h" -#include "base/logging.h" #include "base/stringutil.h" #include "thin3d/thin3d.h" #include "util/hash/hash.h" diff --git a/ext/native/gfx_es2/draw_text_android.cpp b/ext/native/gfx_es2/draw_text_android.cpp index 608d0cfa0d..91298f6de4 100644 --- a/ext/native/gfx_es2/draw_text_android.cpp +++ b/ext/native/gfx_es2/draw_text_android.cpp @@ -1,5 +1,4 @@ #include "base/display.h" -#include "base/logging.h" #include "base/stringutil.h" #include "thin3d/thin3d.h" #include "util/hash/hash.h" @@ -9,7 +8,8 @@ #include "gfx_es2/draw_text_android.h" #include "android/jni/app-android.h" -#include + +#include "Common/Log.h" #if PPSSPP_PLATFORM(ANDROID) && !defined(__LIBRETRO__) @@ -24,10 +24,10 @@ TextDrawerAndroid::TextDrawerAndroid(Draw::DrawContext *draw) : TextDrawer(draw) method_measureText = env->GetStaticMethodID(cls_textRenderer, "measureText", "(Ljava/lang/String;D)I"); method_renderText = env->GetStaticMethodID(cls_textRenderer, "renderText", "(Ljava/lang/String;D)[I"); } else { - ELOG("Failed to find class: '%s'", textRendererClassName); + ERROR_LOG(G3D, "Failed to find class: '%s'", textRendererClassName); } dpiScale_ = CalculateDPIScale(); - ILOG("Initializing TextDrawerAndroid with DPI scale %f", dpiScale_); + INFO_LOG(G3D, "Initializing TextDrawerAndroid with DPI scale %f", dpiScale_); } TextDrawerAndroid::~TextDrawerAndroid() { @@ -68,7 +68,7 @@ void TextDrawerAndroid::SetFont(uint32_t fontHandle) { if (iter != fontMap_.end()) { fontHash_ = fontHandle; } else { - ELOG("Invalid font handle %08x", fontHandle); + ERROR_LOG(G3D, "Invalid font handle %08x", fontHandle); } } @@ -88,7 +88,7 @@ void TextDrawerAndroid::MeasureString(const char *str, size_t len, float *w, flo if (iter != fontMap_.end()) { scaledSize = iter->second.size; } else { - ELOG("Missing font"); + ERROR_LOG(G3D, "Missing font"); } std::string text(NormalizeString(std::string(str, len))); auto env = getEnv(); @@ -112,7 +112,7 @@ void TextDrawerAndroid::MeasureStringRect(const char *str, size_t len, const Bou if (iter != fontMap_.end()) { scaledSize = iter->second.size; } else { - ELOG("Missing font"); + ERROR_LOG(G3D, "Missing font"); } std::string toMeasure = std::string(str, len); @@ -168,7 +168,7 @@ void TextDrawerAndroid::DrawStringBitmap(std::vector &bitmapData, TextS if (iter != fontMap_.end()) { size = iter->second.size; } else { - ELOG("Missing font"); + ERROR_LOG(G3D, "Missing font"); } auto env = getEnv(); @@ -213,7 +213,7 @@ void TextDrawerAndroid::DrawStringBitmap(std::vector &bitmapData, TextS } } } else { - ELOG("Bad TextDrawer format"); + ERROR_LOG(G3D, "Bad TextDrawer format"); assert(false); } env->ReleaseIntArrayElements(imageData, jimage, 0); @@ -285,7 +285,7 @@ void TextDrawerAndroid::OncePerFrame() { float newDpiScale = CalculateDPIScale(); if (newDpiScale != dpiScale_) { // TODO: Don't bother if it's a no-op (cache already empty) - ILOG("DPI Scale changed (%f to %f) - wiping font cache (%d items, %d fonts)", dpiScale_, newDpiScale, (int)cache_.size(), (int)fontMap_.size()); + INFO_LOG(G3D, "DPI Scale changed (%f to %f) - wiping font cache (%d items, %d fonts)", dpiScale_, newDpiScale, (int)cache_.size(), (int)fontMap_.size()); dpiScale_ = newDpiScale; ClearCache(); fontMap_.clear(); // size is precomputed using dpiScale_. diff --git a/ext/native/gfx_es2/draw_text_qt.cpp b/ext/native/gfx_es2/draw_text_qt.cpp index 6589bf0743..12929e25cf 100644 --- a/ext/native/gfx_es2/draw_text_qt.cpp +++ b/ext/native/gfx_es2/draw_text_qt.cpp @@ -1,6 +1,4 @@ -#include #include "base/display.h" -#include "base/logging.h" #include "base/stringutil.h" #include "thin3d/thin3d.h" #include "util/hash/hash.h" @@ -9,6 +7,8 @@ #include "gfx_es2/draw_text.h" #include "gfx_es2/draw_text_qt.h" +#include "Common/Log.h" + #if defined(USING_QT_UI) #include @@ -47,7 +47,7 @@ void TextDrawerQt::SetFont(uint32_t fontHandle) { if (iter != fontMap_.end()) { fontHash_ = fontHandle; } else { - ELOG("Invalid font handle %08x", fontHandle); + ERROR_LOG(G3D, "Invalid font handle %08x", fontHandle); } } @@ -134,8 +134,7 @@ void TextDrawerQt::DrawStringBitmap(std::vector &bitmapData, TextString } } } else { - ELOG("Bad TextDrawer format"); - assert(false); + _assert_msg_("Bad TextDrawer format"); } } diff --git a/ext/native/gfx_es2/draw_text_uwp.cpp b/ext/native/gfx_es2/draw_text_uwp.cpp index a78240b227..a8c67d211b 100644 --- a/ext/native/gfx_es2/draw_text_uwp.cpp +++ b/ext/native/gfx_es2/draw_text_uwp.cpp @@ -1,6 +1,4 @@ -#include #include "base/display.h" -#include "base/logging.h" #include "base/stringutil.h" #include "thin3d/thin3d.h" #include "util/hash/hash.h" @@ -425,8 +423,7 @@ void TextDrawerUWP::DrawStringBitmap(std::vector &bitmapData, TextStrin } } } else { - ELOG("Bad TextDrawer format"); - assert(false); + _assert_msg_(false, "Bad TextDrawer format"); } ctx_->mirror_bmp->Unmap(); diff --git a/ext/native/gfx_es2/draw_text_win.cpp b/ext/native/gfx_es2/draw_text_win.cpp index 2570236feb..1d08616131 100644 --- a/ext/native/gfx_es2/draw_text_win.cpp +++ b/ext/native/gfx_es2/draw_text_win.cpp @@ -1,6 +1,4 @@ -#include #include "base/display.h" -#include "base/logging.h" #include "base/stringutil.h" #include "thin3d/thin3d.h" #include "util/hash/hash.h" @@ -9,6 +7,8 @@ #include "gfx_es2/draw_text.h" #include "gfx_es2/draw_text_win.h" +#include "Common/Log.h" + #if defined(_WIN32) && !defined(USING_QT_UI) && !PPSSPP_PLATFORM(UWP) #define WIN32_LEAN_AND_MEAN @@ -286,8 +286,7 @@ void TextDrawerWin32::DrawStringBitmap(std::vector &bitmapData, TextStr } } } else { - ELOG("Bad TextDrawer format"); - assert(false); + _assert_msg_(false, "Bad TextDrawer format"); } } diff --git a/ext/native/gfx_es2/glsl_program.cpp b/ext/native/gfx_es2/glsl_program.cpp index 91ced3dad2..3400b381b3 100644 --- a/ext/native/gfx_es2/glsl_program.cpp +++ b/ext/native/gfx_es2/glsl_program.cpp @@ -4,11 +4,12 @@ #include #include -#include "base/logging.h" #include "file/vfs.h" #include "file/zip_read.h" #include "glsl_program.h" +#include "Common/Log.h" + static std::set active_programs; bool CompileShader(const char *source, GLuint shader, const char *filename, std::string *error_message) { @@ -22,9 +23,9 @@ bool CompileShader(const char *source, GLuint shader, const char *filename, std: GLsizei len; glGetShaderInfoLog(shader, MAX_INFO_LOG_SIZE, &len, infoLog); infoLog[len] = '\0'; - ELOG("Error in shader compilation of %s!\n", filename); - ELOG("Info log: %s\n", infoLog); - ELOG("Shader source:\n%s\n", (const char *)source); + ERROR_LOG(G3D, "Error in shader compilation of %s!\n", filename); + ERROR_LOG(G3D, "Info log: %s\n", infoLog); + ERROR_LOG(G3D, "Shader source:\n%s\n", (const char *)source); if (error_message) *error_message = infoLog; return false; @@ -45,7 +46,7 @@ GLSLProgram *glsl_create(const char *vshader, const char *fshader, std::string * if (glsl_recompile(program, error_message)) { active_programs.insert(program); } else { - ELOG("Failed compiling GLSL program: %s %s", vshader, fshader); + ERROR_LOG(G3D, "Failed compiling GLSL program: %s %s", vshader, fshader); delete program; return 0; } @@ -65,7 +66,7 @@ GLSLProgram *glsl_create_source(const char *vshader_src, const char *fshader_src if (glsl_recompile(program, error_message)) { active_programs.insert(program); } else { - ELOG("Failed compiling GLSL program from source strings"); + ERROR_LOG(G3D, "Failed compiling GLSL program from source strings"); delete program; return 0; } @@ -124,7 +125,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) { vsh_src.reset((char *)VFSReadFile(program->vshader_filename, &sz)); } if (!program->vshader_source && !vsh_src) { - ELOG("File missing: %s", program->vshader_filename); + ERROR_LOG(G3D, "File missing: %s", program->vshader_filename); if (error_message) { *error_message = std::string("File missing: ") + program->vshader_filename; } @@ -135,7 +136,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) { fsh_src.reset((char *)VFSReadFile(program->fshader_filename, &sz)); } if (!program->fshader_source && !fsh_src) { - ELOG("File missing: %s", program->fshader_filename); + ERROR_LOG(G3D, "File missing: %s", program->fshader_filename); if (error_message) { *error_message = std::string("File missing: ") + program->fshader_filename; } @@ -169,15 +170,15 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) { if (bufLength) { char* buf = new char[bufLength + 1]; // safety glGetProgramInfoLog(prog, bufLength, NULL, buf); - ILOG("vsh: %i fsh: %i", vsh, fsh); - ELOG("Could not link shader program (linkstatus=%i):\n %s \n", linkStatus, buf); + INFO_LOG(G3D, "vsh: %i fsh: %i", vsh, fsh); + ERROR_LOG(G3D, "Could not link shader program (linkstatus=%i):\n %s \n", linkStatus, buf); if (error_message) { *error_message = buf; } delete [] buf; } else { - ILOG("vsh: %i fsh: %i", vsh, fsh); - ELOG("Could not link shader program (linkstatus=%i). No OpenGL error log was available.", linkStatus); + INFO_LOG(G3D, "vsh: %i fsh: %i", vsh, fsh); + ERROR_LOG(G3D, "Could not link shader program (linkstatus=%i). No OpenGL error log was available.", linkStatus); if (error_message) { *error_message = "(no error message available)"; } @@ -212,7 +213,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) { program->u_sundir = glGetUniformLocation(program->program_, "u_sundir"); program->u_camerapos = glGetUniformLocation(program->program_, "u_camerapos"); - //ILOG("Shader compilation success: %s %s", + //INFO_LOG(G3D, "Shader compilation success: %s %s", // program->vshader_filename, // program->fshader_filename); return true; @@ -233,7 +234,7 @@ void glsl_destroy(GLSLProgram *program) { glDeleteProgram(program->program_); active_programs.erase(program); } else { - ELOG("Deleting null GLSL program!"); + ERROR_LOG(G3D, "Deleting null GLSL program!"); } delete program; } diff --git a/ext/native/gfx_es2/gpu_features.cpp b/ext/native/gfx_es2/gpu_features.cpp index e22b702e21..930a489aae 100644 --- a/ext/native/gfx_es2/gpu_features.cpp +++ b/ext/native/gfx_es2/gpu_features.cpp @@ -3,7 +3,6 @@ #include #include -#include "base/logging.h" #include "base/stringutil.h" #if PPSSPP_API(ANY_GL) @@ -16,6 +15,7 @@ #include "gfx_es2/gpu_features.h" +#include "Common/Log.h" #if defined(USING_GLES2) #if defined(__ANDROID__) @@ -96,7 +96,7 @@ int GLExtensions::GLSLVersion() { void ProcessGPUFeatures() { gl_extensions.bugs = 0; - DLOG("Checking for GL driver bugs... vendor=%i model='%s'", (int)gl_extensions.gpuVendor, gl_extensions.model); + DEBUG_LOG(G3D, "Checking for GL driver bugs... vendor=%i model='%s'", (int)gl_extensions.gpuVendor, gl_extensions.model); if (gl_extensions.gpuVendor == GPU_VENDOR_IMGTEC) { if (!strcmp(gl_extensions.model, "PowerVR SGX 545") || @@ -106,11 +106,11 @@ void ProcessGPUFeatures() { !strcmp(gl_extensions.model, "PowerVR SGX 540") || !strcmp(gl_extensions.model, "PowerVR SGX 530") || !strcmp(gl_extensions.model, "PowerVR SGX 520") ) { - WLOG("GL DRIVER BUG: PVR with bad and terrible precision"); + WARN_LOG(G3D, "GL DRIVER BUG: PVR with bad and terrible precision"); gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_TERRIBLE | BUG_PVR_SHADER_PRECISION_BAD; } else { // TODO: I'm not sure if the Rogue series is affected by this. - WLOG("GL DRIVER BUG: PVR with bad precision"); + WARN_LOG(G3D, "GL DRIVER BUG: PVR with bad precision"); gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_BAD; } } @@ -172,7 +172,7 @@ void CheckGLExtensions() { gl_extensions.gpuVendor = GPU_VENDOR_UNKNOWN; } - ILOG("GPU Vendor : %s ; renderer: %s version str: %s ; GLSL version str: %s", cvendor, renderer ? renderer : "N/A", versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A"); + INFO_LOG(G3D, "GPU Vendor : %s ; renderer: %s version str: %s ; GLSL version str: %s", cvendor, renderer ? renderer : "N/A", versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A"); if (renderer) { strncpy(gl_extensions.model, renderer, sizeof(gl_extensions.model)); @@ -245,7 +245,7 @@ void CheckGLExtensions() { gl_extensions.ver[1] = 0; } else if (parsed[0] && (gl_extensions.ver[0] != parsed[0] || gl_extensions.ver[1] != parsed[1])) { // Something going wrong. Possible bug in GL ES drivers. See #9688 - ILOG("GL ES version mismatch. Version string '%s' parsed as %d.%d but API return %d.%d. Fallback to GL ES 2.0.", + INFO_LOG(G3D, "GL ES version mismatch. Version string '%s' parsed as %d.%d but API return %d.%d. Fallback to GL ES 2.0.", versionStr ? versionStr : "N/A", parsed[0], parsed[1], gl_extensions.ver[0], gl_extensions.ver[1]); gl_extensions.ver[0] = 2; @@ -289,9 +289,9 @@ void CheckGLExtensions() { if (gl_extensions.GLES3) { if (gl_extensions.ver[1] >= 1) { - ILOG("OpenGL ES 3.1 support detected!\n"); + INFO_LOG(G3D, "OpenGL ES 3.1 support detected!\n"); } else { - ILOG("OpenGL ES 3.0 support detected!\n"); + INFO_LOG(G3D, "OpenGL ES 3.0 support detected!\n"); } } } @@ -376,7 +376,7 @@ void CheckGLExtensions() { #ifdef _DEBUG void *invalidAddress = (void *)eglGetProcAddress("InvalidGlCall1"); void *invalidAddress2 = (void *)eglGetProcAddress("AnotherInvalidGlCall2"); - DLOG("Addresses returned for invalid extensions: %p %p", invalidAddress, invalidAddress2); + DEBUG_LOG(G3D, "Addresses returned for invalid extensions: %p %p", invalidAddress, invalidAddress2); #endif // These are all the same. Let's alias. @@ -473,7 +473,7 @@ void CheckGLExtensions() { // Now, Adreno lies. So let's override it. if (gl_extensions.gpuVendor == GPU_VENDOR_QUALCOMM) { - WLOG("Detected Adreno - lowering int precision"); + WARN_LOG(G3D, "Detected Adreno - lowering int precision"); gl_extensions.range[1][5][0] = 15; gl_extensions.range[1][5][1] = 15; } @@ -549,15 +549,14 @@ void CheckGLExtensions() { int error = glGetError(); if (error) - ELOG("GL error in init: %i", error); + ERROR_LOG(G3D, "GL error in init: %i", error); #endif } void SetGLCoreContext(bool flag) { - if (extensionsDone) - FLOG("SetGLCoreContext() after CheckGLExtensions()"); + _assert_msg_(!extensionsDone, "SetGLCoreContext() after CheckGLExtensions()"); useCoreContext = flag; // For convenience, it'll get reset later. diff --git a/ext/native/i18n/i18n.cpp b/ext/native/i18n/i18n.cpp index 2b0aa77f8d..bbafbd9534 100644 --- a/ext/native/i18n/i18n.cpp +++ b/ext/native/i18n/i18n.cpp @@ -1,4 +1,3 @@ -#include "base/logging.h" #include "base/stringutil.h" #include "i18n/i18n.h" #include "file/ini_file.h" @@ -32,7 +31,7 @@ const char *I18NCategory::T(const char *key, const char *def) { auto iter = map_.find(modifiedKey); if (iter != map_.end()) { -// ILOG("translation key found in %s: %s", name_.c_str(), key); +// INFO_LOG(SYSTEM, "translation key found in %s: %s", name_.c_str(), key); return iter->second.text.c_str(); } else { std::lock_guard guard(missedKeyLock_); @@ -40,7 +39,7 @@ const char *I18NCategory::T(const char *key, const char *def) { missedKeyLog_[key] = def; else missedKeyLog_[key] = modifiedKey.c_str(); -// ILOG("Missed translation key in %s: %s", name_.c_str(), key); +// INFO_LOG(SYSTEM, "Missed translation key in %s: %s", name_.c_str(), key); return def ? def : key; } } @@ -50,7 +49,7 @@ void I18NCategory::SetMap(const std::map &m) { if (map_.find(iter->first) == map_.end()) { std::string text = ReplaceAll(iter->second, "\\n", "\n"); map_[iter->first] = I18NEntry(text); -// ILOG("Language entry: %s -> %s", iter->first.c_str(), text.c_str()); +// INFO_LOG(SYSTEM, "Language entry: %s -> %s", iter->first.c_str(), text.c_str()); } } } @@ -84,7 +83,7 @@ bool I18NRepo::LoadIni(const std::string &languageID, const std::string &overrid IniFile ini; std::string iniPath; -// ILOG("Loading lang ini %s", iniPath.c_str()); +// INFO_LOG(SYSTEM, "Loading lang ini %s", iniPath.c_str()); if (!overridePath.empty()) { iniPath = overridePath + languageID + ".ini"; } else { diff --git a/ext/native/image/png_load.cpp b/ext/native/image/png_load.cpp index c6be6b5c38..b8a273c17e 100644 --- a/ext/native/image/png_load.cpp +++ b/ext/native/image/png_load.cpp @@ -9,7 +9,8 @@ #endif #include "png_load.h" -#include "base/logging.h" + +#include "Common/Log.h" // *image_data_ptr should be deleted with free() // return value of 1 == success. @@ -17,7 +18,7 @@ int pngLoad(const char *file, int *pwidth, int *pheight, unsigned char **image_d #ifdef USING_QT_UI QImage image(file, "PNG"); if (image.isNull()) { - ELOG("pngLoad: Error loading image %s", file); + ERROR_LOG(IO, "pngLoad: Error loading image %s", file); return 0; } @@ -36,7 +37,7 @@ int pngLoad(const char *file, int *pwidth, int *pheight, unsigned char **image_d } #else if (flip) - ELOG("pngLoad: flip flag not supported, image will be loaded upside down"); + ERROR_LOG(IO, "pngLoad: flip flag not supported, image will be loaded upside down"); png_image png; memset(&png, 0, sizeof(png)); png.version = PNG_IMAGE_VERSION; @@ -45,7 +46,7 @@ int pngLoad(const char *file, int *pwidth, int *pheight, unsigned char **image_d if (PNG_IMAGE_FAILED(png)) { - ELOG("pngLoad: %s", png.message); + ERROR_LOG(IO, "pngLoad: %s", png.message); return 0; } *pwidth = png.width; @@ -65,7 +66,7 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth, in #ifdef USING_QT_UI QImage image; if (!image.loadFromData(input_ptr, input_len, "PNG")) { - ELOG("pngLoad: Error loading image"); + ERROR_LOG(IO, "pngLoad: Error loading image"); return 0; } if (flip) @@ -83,14 +84,14 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth, in } #else if (flip) - ELOG("pngLoad: flip flag not supported, image will be loaded upside down"); + ERROR_LOG(IO, "pngLoad: flip flag not supported, image will be loaded upside down"); png_image png{}; png.version = PNG_IMAGE_VERSION; png_image_begin_read_from_memory(&png, input_ptr, input_len); if (PNG_IMAGE_FAILED(png)) { - ELOG("pngLoad: %s", png.message); + ERROR_LOG(IO, "pngLoad: %s", png.message); return 0; } *pwidth = png.width; @@ -101,7 +102,7 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth, in size_t size = PNG_IMAGE_SIZE(png); if (!size) { - ELOG("pngLoad: empty image"); + ERROR_LOG(IO, "pngLoad: empty image"); return 0; } diff --git a/ext/native/image/zim_load.cpp b/ext/native/image/zim_load.cpp index 89901f5dc7..86d2627f0c 100644 --- a/ext/native/image/zim_load.cpp +++ b/ext/native/image/zim_load.cpp @@ -2,12 +2,13 @@ #include #include -#include "base/logging.h" #include "zlib.h" #include "image/zim_load.h" #include "math/math_util.h" #include "file/vfs.h" +#include "Common/Log.h" + int ezuncompress(unsigned char* pDest, long* pnDestLen, const unsigned char* pSrc, long nSrcLen) { z_stream stream; stream.next_in = (Bytef*)pSrc; @@ -49,7 +50,7 @@ int ezuncompress(unsigned char* pDest, long* pnDestLen, const unsigned char* pSr int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int *flags, uint8_t **image) { if (zim[0] != 'Z' || zim[1] != 'I' || zim[2] != 'M' || zim[3] != 'G') { - ELOG("Not a ZIM file"); + ERROR_LOG(IO, "Not a ZIM file"); return 0; } memcpy(width, zim + 4, 4); @@ -76,14 +77,14 @@ int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int image_data_size[i] = width[i] * height[i] * 2; break; default: - ELOG("Invalid ZIM format %i", *flags & ZIM_FORMAT_MASK); + ERROR_LOG(IO, "Invalid ZIM format %i", *flags & ZIM_FORMAT_MASK); return 0; } total_data_size += image_data_size[i]; } if (total_data_size == 0) { - ELOG("Invalid ZIM data size 0"); + ERROR_LOG(IO, "Invalid ZIM data size 0"); return 0; } @@ -96,19 +97,19 @@ int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int long outlen = (long)total_data_size; int retcode = ezuncompress(*image, &outlen, (unsigned char *)(zim + 16), (long)datasize - 16); if (Z_OK != retcode) { - ELOG("ZIM zlib format decompression failed: %d", retcode); + ERROR_LOG(IO, "ZIM zlib format decompression failed: %d", retcode); free(*image); *image = 0; return 0; } if (outlen != total_data_size) { // Shouldn't happen if return value was Z_OK. - ELOG("Wrong size data in ZIM: %i vs %i", (int)outlen, (int)total_data_size); + ERROR_LOG(IO, "Wrong size data in ZIM: %i vs %i", (int)outlen, (int)total_data_size); } } else { memcpy(*image, zim + 16, datasize - 16); if (datasize - 16 != (size_t)total_data_size) { - ELOG("Wrong size data in ZIM: %i vs %i", (int)(datasize-16), (int)total_data_size); + ERROR_LOG(IO, "Wrong size data in ZIM: %i vs %i", (int)(datasize-16), (int)total_data_size); } } return num_levels; @@ -118,13 +119,13 @@ int LoadZIM(const char *filename, int *width, int *height, int *format, uint8_t size_t size; uint8_t *buffer = VFSReadFile(filename, &size); if (!buffer) { - ELOG("Couldn't read data for '%s'", buffer); + ERROR_LOG(IO, "Couldn't read data for '%s'", buffer); return 0; } int retval = LoadZIMPtr(buffer, (int)size, width, height, format, image); if (!retval) { - ELOG("Not a valid ZIM file: %s (size: %d bytes)", filename, (int)size); + ERROR_LOG(IO, "Not a valid ZIM file: %s (size: %d bytes)", filename, (int)size); } delete [] buffer; return retval; diff --git a/ext/native/image/zim_save.cpp b/ext/native/image/zim_save.cpp index 93dd945b67..b62ba3adb8 100644 --- a/ext/native/image/zim_save.cpp +++ b/ext/native/image/zim_save.cpp @@ -1,10 +1,12 @@ -#include -#include -#include -#include "base/logging.h" +#include +#include +#include + #include "image/zim_save.h" #include "zlib.h" +#include "Common/Log.h" + static const char magic[5] = "ZIMG"; /*int num_levels = 1; @@ -141,7 +143,7 @@ void Convert(const uint8_t *image_data, int width, int height, int pitch, int fl break; default: - ELOG("Unhandled ZIM format %i", flags & ZIM_FORMAT_MASK); + ERROR_LOG(IO, "Unhandled ZIM format %d", flags & ZIM_FORMAT_MASK); *data = 0; *data_size = 0; return; @@ -197,7 +199,7 @@ void SaveZIM(FILE *f, int width, int height, int pitch, int flags, const uint8_t if (Z_OK == ezcompress(dest, &dest_len, data, data_size)) { fwrite(dest, 1, dest_len, f); } else { - ELOG("Zlib compression failed.\n"); + ERROR_LOG(IO, "Zlib compression failed.\n"); } delete [] dest; } else { From 5eb13378c6845b147b8c34b9e0e42262c488db43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 15:51:41 +0200 Subject: [PATCH 07/15] Remove base/logging from a lot more files in native --- Core/Util/GameManager.cpp | 2 +- ext/native/base/buffer.cpp | 19 +++++------ ext/native/base/buffer.h | 8 ++--- ext/native/base/stringutil.cpp | 2 +- ext/native/base/timeutil.cpp | 5 +-- ext/native/file/path.cpp | 2 +- ext/native/input/gesture_detector.cpp | 2 -- ext/native/json/json_reader.cpp | 6 ++-- ext/native/json/json_reader.h | 5 +-- ext/native/net/http_client.cpp | 39 +++++++++++------------ ext/native/net/http_headers.cpp | 13 ++++---- ext/native/net/http_server.cpp | 27 ++++++++-------- ext/native/net/resolve.cpp | 7 ++-- ext/native/net/sinks.cpp | 15 +++++---- ext/native/net/url.cpp | 5 +-- ext/native/profiler/profiler.cpp | 11 +++---- ext/native/thin3d/DataFormatGL.cpp | 1 - ext/native/thin3d/GLQueueRunner.cpp | 31 ++++++++++-------- ext/native/thin3d/GLRenderManager.cpp | 5 +-- ext/native/thin3d/VulkanRenderManager.cpp | 27 ++++++++-------- ext/native/thin3d/d3dx9_loader.cpp | 9 +++--- 21 files changed, 125 insertions(+), 116 deletions(-) diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index 031f51b119..19f8c67009 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -601,7 +601,7 @@ bool GameManager::InstallZippedISO(struct zip *z, int isoFileIndex, std::string std::string outputISOFilename = g_Config.currentDirectory + "/" + fn.substr(nameOffset); size_t bytesCopied = 0; if (ExtractFile(z, isoFileIndex, outputISOFilename, &bytesCopied, allBytes)) { - ILOG("Successfully extracted ISO file to '%s'", outputISOFilename.c_str()); + INFO_LOG(IO, "Successfully extracted ISO file to '%s'", outputISOFilename.c_str()); } zip_close(z); if (deleteAfter) { diff --git a/ext/native/base/buffer.cpp b/ext/native/base/buffer.cpp index 2c28a09f7b..e603ff059f 100644 --- a/ext/native/base/buffer.cpp +++ b/ext/native/base/buffer.cpp @@ -18,10 +18,11 @@ #define MSG_NOSIGNAL 0x00 #endif -#include "base/logging.h" #include "base/timeutil.h" #include "file/fd_util.h" +#include "Common/Log.h" + Buffer::Buffer() { } Buffer::~Buffer() { } @@ -63,7 +64,7 @@ void Buffer::AppendValue(int value) { void Buffer::Take(size_t length, std::string *dest) { if (length > data_.size()) { - ELOG("Truncating length in Buffer::Take()"); + ERROR_LOG(IO, "Truncating length in Buffer::Take()"); length = data_.size(); } dest->resize(length); @@ -90,7 +91,7 @@ int Buffer::TakeLineCRLF(std::string *dest) { void Buffer::Skip(size_t length) { if (length > data_.size()) { - ELOG("Truncating length in Buffer::Skip()"); + ERROR_LOG(IO, "Truncating length in Buffer::Skip()"); length = data_.size(); } data_.erase(data_.begin(), data_.begin() + length); @@ -122,10 +123,10 @@ void Buffer::Printf(const char *fmt, ...) { ssize_t retval = vsnprintf(buffer, sizeof(buffer), fmt, vl); if (retval >= (ssize_t)sizeof(buffer)) { // Output was truncated. TODO: Do something. - ELOG("Buffer::Printf truncated output"); + ERROR_LOG(IO, "Buffer::Printf truncated output"); } if (retval < 0) { - ELOG("Buffer::Printf failed"); + ERROR_LOG(IO, "Buffer::Printf failed"); } va_end(vl); char *ptr = Append(retval); @@ -164,14 +165,14 @@ bool Buffer::FlushSocket(uintptr_t sock, double timeout, bool *cancelled) { if (!ready && leftTimeout >= 0.0) { leftTimeout -= CANCEL_INTERVAL; if (leftTimeout < 0) { - ELOG("FlushSocket timed out"); + ERROR_LOG(IO, "FlushSocket timed out"); return false; } } } int sent = send(sock, &data_[pos], (int)(end - pos), MSG_NOSIGNAL); if (sent < 0) { - ELOG("FlushSocket failed"); + ERROR_LOG(IO, "FlushSocket failed"); return false; } pos += sent; @@ -200,7 +201,7 @@ bool Buffer::ReadAll(int fd, int hintSize) { if (retval == 0) { break; } else if (retval < 0) { - ELOG("Error reading from buffer: %i", retval); + ERROR_LOG(IO, "Error reading from buffer: %i", retval); return false; } char *p = Append((size_t)retval); @@ -232,7 +233,7 @@ bool Buffer::ReadAllWithProgress(int fd, int knownSize, float *progress, bool *c if (retval == 0) { return true; } else if (retval < 0) { - ELOG("Error reading from buffer: %i", retval); + ERROR_LOG(IO, "Error reading from buffer: %i", retval); return false; } char *p = Append((size_t)retval); diff --git a/ext/native/base/buffer.h b/ext/native/base/buffer.h index 87018a3999..96abfbbd3f 100644 --- a/ext/native/base/buffer.h +++ b/ext/native/base/buffer.h @@ -1,11 +1,11 @@ -#ifndef _IO_BUFFER_H -#define _IO_BUFFER_H +#pragma once #include #include #include "base/basictypes.h" -#include "base/logging.h" + +#include "Common/Common.h" // Acts as a queue. Intended to be as fast as possible for most uses. // Does not do synchronization, must use external mutexes. @@ -84,5 +84,3 @@ class Buffer { DISALLOW_COPY_AND_ASSIGN(Buffer); }; - -#endif // _IO_BUFFER_H diff --git a/ext/native/base/stringutil.cpp b/ext/native/base/stringutil.cpp index 5fa467c577..ce2e1094fb 100644 --- a/ext/native/base/stringutil.cpp +++ b/ext/native/base/stringutil.cpp @@ -37,7 +37,7 @@ void OutputDebugStringUTF8(const char *p) { #else void OutputDebugStringUTF8(const char *p) { - ILOG("%s", p); + INFO_LOG(SYSTEM, "%s", p); } #endif diff --git a/ext/native/base/timeutil.cpp b/ext/native/base/timeutil.cpp index 5c70e80053..c2446c3989 100644 --- a/ext/native/base/timeutil.cpp +++ b/ext/native/base/timeutil.cpp @@ -1,7 +1,6 @@ #include #include "base/basictypes.h" -#include "base/logging.h" #include "base/timeutil.h" #ifdef _WIN32 @@ -15,6 +14,8 @@ #include #endif // HAVE_LIBNX +#include "Common/Log.h" + static double curtime = 0; static float curtime_f = 0; @@ -107,7 +108,7 @@ bool LoggingDeadline::End() { if (time_now_d() > endTime_) { double late = (time_now_d() - endTime_); double totalTime = late + totalTime_; - ELOG("===== %0.2fms DEADLINE PASSED FOR %s at %0.2fms - %0.2fms late =====", totalTime_ * 1000.0, name_, 1000.0 * totalTime, 1000.0 * late); + ERROR_LOG(SYSTEM, "===== %0.2fms DEADLINE PASSED FOR %s at %0.2fms - %0.2fms late =====", totalTime_ * 1000.0, name_, 1000.0 * totalTime, 1000.0 * late); return false; } return true; diff --git a/ext/native/file/path.cpp b/ext/native/file/path.cpp index 6aa562dbbc..2bcb7e1cdb 100644 --- a/ext/native/file/path.cpp +++ b/ext/native/file/path.cpp @@ -57,7 +57,7 @@ bool LoadRemoteFileList(const std::string &url, bool *cancel, std::vectorvalue.toString(); - FLOG("String '%s' missing from node", child_name); + ERROR_LOG(IO, "String '%s' missing from node", child_name); return nullptr; } diff --git a/ext/native/json/json_reader.h b/ext/native/json/json_reader.h index a18915f488..472a19140d 100644 --- a/ext/native/json/json_reader.h +++ b/ext/native/json/json_reader.h @@ -2,9 +2,10 @@ #include #include "base/basictypes.h" -#include "base/logging.h" #include "ext/gason/gason.h" +#include "Common/Log.h" + namespace json { struct JsonGet { @@ -72,7 +73,7 @@ private: char *error_pos; int status = jsonParse(buffer_, &error_pos, &root_, alloc_); if (status != JSON_OK) { - ELOG("Error at (%i): %s\n%s\n\n", (int)(error_pos - buffer_), jsonStrError(status), error_pos); + ERROR_LOG(IO, "Error at (%i): %s\n%s\n\n", (int)(error_pos - buffer_), jsonStrError(status), error_pos); return false; } ok_ = true; diff --git a/ext/native/net/http_client.cpp b/ext/native/net/http_client.cpp index 29641aff77..7ff05ec99e 100644 --- a/ext/native/net/http_client.cpp +++ b/ext/native/net/http_client.cpp @@ -18,7 +18,6 @@ #include #include -#include "base/logging.h" #include "base/buffer.h" #include "base/stringutil.h" #include "data/compression.h" @@ -27,6 +26,8 @@ #include "net/url.h" #include "thread/threadutil.h" +#include "Common/Log.h" + namespace net { Connection::Connection() @@ -48,11 +49,11 @@ inline unsigned short myhtons(unsigned short x) { bool Connection::Resolve(const char *host, int port, DNSType type) { if ((intptr_t)sock_ != -1) { - ELOG("Resolve: Already have a socket"); + ERROR_LOG(IO, "Resolve: Already have a socket"); return false; } if (!host || port < 1 || port > 65535) { - ELOG("Resolve: Invalid host or port (%d)", port); + ERROR_LOG(IO, "Resolve: Invalid host or port (%d)", port); return false; } @@ -64,7 +65,7 @@ bool Connection::Resolve(const char *host, int port, DNSType type) { std::string err; if (!net::DNSResolve(host, port_str, &resolved_, err, type)) { - ELOG("Failed to resolve host %s: %s", host, err.c_str()); + ERROR_LOG(IO, "Failed to resolve host %s: %s", host, err.c_str()); // So that future calls fail. port_ = 0; return false; @@ -75,7 +76,7 @@ bool Connection::Resolve(const char *host, int port, DNSType type) { bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { if (port_ <= 0) { - ELOG("Bad port"); + ERROR_LOG(IO, "Bad port"); return false; } sock_ = -1; @@ -91,7 +92,7 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { int sock = socket(possible->ai_family, SOCK_STREAM, IPPROTO_TCP); if ((intptr_t)sock == -1) { - ELOG("Bad socket"); + ERROR_LOG(IO, "Bad socket"); continue; } fd_util::SetNonBlocking(sock, true); @@ -326,14 +327,14 @@ int Client::ReadResponseHeaders(Buffer *readbuf, std::vector &respo if (!ready && leftTimeout >= 0.0) { leftTimeout -= CANCEL_INTERVAL; if (leftTimeout < 0) { - ELOG("HTTP headers timed out"); + ERROR_LOG(IO, "HTTP headers timed out"); return -1; } } }; // Let's hope all the headers are available in a single packet... if (readbuf->Read(sock(), 4096) < 0) { - ELOG("Failed to read HTTP headers :("); + ERROR_LOG(IO, "Failed to read HTTP headers :("); return -1; } @@ -429,7 +430,7 @@ int Client::ReadResponseEntity(Buffer *readbuf, const std::vector & output->TakeAll(&compressed); bool result = decompress_string(compressed, &decompressed); if (!result) { - ELOG("Error decompressing using zlib"); + ERROR_LOG(IO, "Error decompressing using zlib"); if (progress) *progress = 0.0f; return -1; @@ -448,9 +449,7 @@ Download::Download(const std::string &url, const std::string &outfile) } Download::~Download() { - if (!joined_) { - FLOG("Download destructed without join"); - } + _assert_msg_(joined_, "Download destructed without join"); } void Download::Start() { @@ -459,7 +458,7 @@ void Download::Start() { void Download::Join() { if (joined_) { - ELOG("Already joined thread!"); + ERROR_LOG(IO, "Already joined thread!"); } thread_.join(); joined_ = true; @@ -479,7 +478,7 @@ int Download::PerformGET(const std::string &url) { http::Client client; if (!client.Resolve(fileUrl.Host().c_str(), fileUrl.Port())) { - ELOG("Failed resolving %s", url.c_str()); + ERROR_LOG(IO, "Failed resolving %s", url.c_str()); return -1; } @@ -488,7 +487,7 @@ int Download::PerformGET(const std::string &url) { } if (!client.Connect(2, 20.0, &cancelled_)) { - ELOG("Failed connecting to server or cancelled."); + ERROR_LOG(IO, "Failed connecting to server or cancelled."); return -1; } @@ -525,7 +524,7 @@ void Download::Do() { if (resultCode == 301 || resultCode == 302 || resultCode == 303 || resultCode == 307 || resultCode == 308) { std::string redirectURL = RedirectLocation(downloadURL); if (redirectURL.empty()) { - ELOG("Could not find Location header for redirect"); + ERROR_LOG(IO, "Could not find Location header for redirect"); resultCode_ = resultCode; } else if (redirectURL == downloadURL || redirectURL == url_) { // Simple loop detected, bail out. @@ -534,18 +533,18 @@ void Download::Do() { // Perform the next GET. if (resultCode_ == 0) - ILOG("Download of %s redirected to %s", downloadURL.c_str(), redirectURL.c_str()); + INFO_LOG(IO, "Download of %s redirected to %s", downloadURL.c_str(), redirectURL.c_str()); downloadURL = redirectURL; continue; } if (resultCode == 200) { - ILOG("Completed downloading %s to %s", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str()); + INFO_LOG(IO, "Completed downloading %s to %s", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str()); if (!outfile_.empty() && !buffer_.FlushToFile(outfile_.c_str())) { - ELOG("Failed writing download to %s", outfile_.c_str()); + ERROR_LOG(IO, "Failed writing download to %s", outfile_.c_str()); } } else { - ELOG("Error downloading %s to %s: %i", url_.c_str(), outfile_.c_str(), resultCode); + ERROR_LOG(IO, "Error downloading %s to %s: %i", url_.c_str(), outfile_.c_str(), resultCode); } resultCode_ = resultCode; } diff --git a/ext/native/net/http_headers.cpp b/ext/native/net/http_headers.cpp index fdfaa2c1ea..e568c7c5c8 100644 --- a/ext/native/net/http_headers.cpp +++ b/ext/native/net/http_headers.cpp @@ -4,11 +4,12 @@ #include #include -#include "base/logging.h" #include "base/stringutil.h" #include "file/fd_util.h" #include "net/sinks.h" +#include "Common/Log.h" + namespace http { RequestHeader::RequestHeader() @@ -32,7 +33,7 @@ bool RequestHeader::GetParamValue(const char *param_name, std::string *value) co for (size_t i = 0; i < v.size(); i++) { std::vector parts; SplitString(v[i], '=', parts); - ILOG("Param: %s Value: %s", parts[0].c_str(), parts[1].c_str()); + INFO_LOG(IO, "Param: %s Value: %s", parts[0].c_str(), parts[1].c_str()); if (parts[0] == param_name) { *value = parts[1]; return true; @@ -120,13 +121,13 @@ int RequestHeader::ParseHttpHeader(const char *buffer) { if (!strncasecmp(key, "User-Agent", key_len)) { user_agent = new char[value_len + 1]; memcpy(user_agent, buffer, value_len + 1); - ILOG("user-agent: %s", user_agent); + INFO_LOG(IO, "user-agent: %s", user_agent); } else if (!strncasecmp(key, "Referer", key_len)) { referer = new char[value_len + 1]; memcpy(referer, buffer, value_len + 1); } else if (!strncasecmp(key, "Content-Length", key_len)) { content_length = atoi(buffer); - ILOG("Content-Length: %i", (int)content_length); + INFO_LOG(IO, "Content-Length: %i", (int)content_length); } else { std::string key_str(key, key_len); std::transform(key_str.begin(), key_str.end(), key_str.begin(), tolower); @@ -149,12 +150,12 @@ void RequestHeader::ParseHeaders(net::InputSink *sink) { line_count++; if (type == SIMPLE) { // Done! - ILOG("Simple: Done parsing http request."); + INFO_LOG(IO, "Simple: Done parsing http request."); break; } } - ILOG("finished parsing request."); + INFO_LOG(IO, "finished parsing request."); ok = line_count > 1; } diff --git a/ext/native/net/http_server.cpp b/ext/native/net/http_server.cpp index c4120bae6a..1520b05873 100644 --- a/ext/native/net/http_server.cpp +++ b/ext/native/net/http_server.cpp @@ -34,13 +34,14 @@ #include #include -#include "base/logging.h" #include "base/buffer.h" #include "file/fd_util.h" #include "net/http_server.h" #include "net/sinks.h" #include "thread/executor.h" +#include "Common/Log.h" + namespace http { // Note: charset here helps prevent XSS. @@ -53,7 +54,7 @@ Request::Request(int fd) header_.ParseHeaders(in_); if (header_.ok) { - ILOG("The request carried with it %i bytes", (int)header_.content_length); + INFO_LOG(IO, "The request carried with it %i bytes", (int)header_.content_length); } else { Close(); } @@ -62,10 +63,10 @@ Request::Request(int fd) Request::~Request() { Close(); - CHECK(in_->Empty()); + _assert_(in_->Empty()); delete in_; if (!out_->Empty()) { - ELOG("Output not empty - connection abort?"); + ERROR_LOG(IO, "Output not empty - connection abort?"); } delete out_; } @@ -108,12 +109,12 @@ void Request::WriteHttpResponseHeader(const char *ver, int status, int64_t size, } void Request::WritePartial() const { - CHECK(fd_); + _assert_(fd_); out_->Flush(); } void Request::Write() { - CHECK(fd_); + _assert_(fd_); WritePartial(); Close(); } @@ -171,7 +172,7 @@ bool Server::Listen4(int port) { if (bind(listener_, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { closesocket(listener_); - ELOG("Failed to bind to port %i. Bailing.", port); + ERROR_LOG(IO, "Failed to bind to port %d. Bailing.", port); return false; } @@ -188,7 +189,7 @@ bool Server::Listen4(int port) { port = ntohs(server_addr.sin_port); } - ILOG("HTTP server started on port %i", port); + INFO_LOG(IO, "HTTP server started on port %d", port); port_ = port; return true; @@ -216,7 +217,7 @@ bool Server::Listen6(int port, bool ipv6_only) { if (bind(listener_, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { closesocket(listener_); - ELOG("Failed to bind to port %i. Bailing.", port); + ERROR_LOG(IO, "Failed to bind to port %d. Bailing.", port); return false; } @@ -233,7 +234,7 @@ bool Server::Listen6(int port, bool ipv6_only) { port = ntohs(server_addr.sin6_port); } - ILOG("HTTP server started on port %i", port); + INFO_LOG(IO, "HTTP server started on port %d", port); port_ = port; return true; @@ -268,7 +269,7 @@ bool Server::RunSlice(double timeout) { return true; } else { - ELOG("socket accept failed: %i", conn_fd); + ERROR_LOG(IO, "socket accept failed: %i", conn_fd); return false; } } @@ -293,7 +294,7 @@ void Server::Stop() { void Server::HandleConnection(int conn_fd) { Request request(conn_fd); if (!request.IsOK()) { - WLOG("Bad request, ignoring."); + WARN_LOG(IO, "Bad request, ignoring."); return; } HandleRequest(request); @@ -321,7 +322,7 @@ void Server::HandleRequestDefault(const Request &request) { } void Server::Handle404(const Request &request) { - ILOG("No handler for '%s', falling back to 404.", request.resource()); + INFO_LOG(IO, "No handler for '%s', falling back to 404.", request.resource()); const char *payload = "404 not found\r\n"; request.WriteHttpResponseHeader("1.0", 404, (int)strlen(payload)); request.Out()->Push(payload); diff --git a/ext/native/net/resolve.cpp b/ext/native/net/resolve.cpp index c4fc78fc62..e1479541a5 100644 --- a/ext/native/net/resolve.cpp +++ b/ext/native/net/resolve.cpp @@ -1,6 +1,5 @@ +#include "ppsspp_config.h" #include "net/resolve.h" -#include "base/logging.h" -#include "base/timeutil.h" #include #include @@ -25,6 +24,7 @@ #include #endif +#include "base/timeutil.h" namespace net { @@ -45,6 +45,7 @@ void Shutdown() } bool DNSResolve(const std::string &host, const std::string &service, addrinfo **res, std::string &error, DNSType type) { + #if PPSSPP_PLATFORM(SWITCH) // Force IPv4 lookups. if (type == DNSType::IPV6) { @@ -102,7 +103,7 @@ void DNSResolveFree(addrinfo *res) freeaddrinfo(res); } -bool GetIPList(std::vector& IP4s) { +bool GetIPList(std::vector &IP4s) { char ipstr[INET6_ADDRSTRLEN]; // We use IPv6 length since it's longer than IPv4 #if defined(getifaddrs) // On Android: Requires __ANDROID_API__ >= 24 struct ifaddrs* ifAddrStruct = NULL; diff --git a/ext/native/net/sinks.cpp b/ext/native/net/sinks.cpp index d9bf32d9d0..8c4434b31d 100644 --- a/ext/native/net/sinks.cpp +++ b/ext/native/net/sinks.cpp @@ -1,4 +1,6 @@ -#ifdef _WIN32 +#include "ppsspp_config.h" + +#if PPSSPP_PLATFORM(WINDOWS) #ifndef NOMINMAX #define NOMINMAX @@ -21,10 +23,11 @@ #include #include -#include "base/logging.h" #include "net/sinks.h" #include "file/fd_util.h" +#include "Common/Log.h" + #ifndef MSG_NOSIGNAL // Default value to 0x00 (do nothing) in systems where it's not supported #define MSG_NOSIGNAL 0 @@ -182,7 +185,7 @@ bool InputSink::Block() { void InputSink::AccountFill(int bytes) { if (bytes < 0) { - ELOG("Error reading from socket"); + ERROR_LOG(IO, "Error reading from socket"); return; } @@ -303,10 +306,10 @@ bool OutputSink::Printf(const char *fmt, ...) { // Okay, did we actually write? if (result >= (int)avail) { // This means the result string was too big for the buffer. - ELOG("Not enough space to format output."); + ERROR_LOG(IO, "Not enough space to format output."); return false; } else if (result < 0) { - ELOG("vsnprintf failed."); + ERROR_LOG(IO, "vsnprintf failed."); return false; } @@ -373,7 +376,7 @@ void OutputSink::AccountPush(size_t bytes) { void OutputSink::AccountDrain(int bytes) { if (bytes < 0) { - ELOG("Error writing to socket"); + ERROR_LOG(IO, "Error writing to socket"); return; } diff --git a/ext/native/net/url.cpp b/ext/native/net/url.cpp index 45175372e7..943ed4e3eb 100644 --- a/ext/native/net/url.cpp +++ b/ext/native/net/url.cpp @@ -1,7 +1,8 @@ -#include "base/logging.h" #include "base/stringutil.h" #include "net/url.h" +#include "Common/Log.h" + const char *UrlEncoder::unreservedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~"; const char *UrlEncoder::hexChars = "0123456789ABCDEF"; @@ -10,7 +11,7 @@ int MultipartFormDataEncoder::seq = 0; void Url::Split() { size_t colonSlashSlash = url_.find("://"); if (colonSlashSlash == std::string::npos) { - ELOG("Invalid URL: %s", url_.c_str()); + ERROR_LOG(IO, "Invalid URL: %s", url_.c_str()); return; } diff --git a/ext/native/profiler/profiler.cpp b/ext/native/profiler/profiler.cpp index bf037a9510..2c2457812f 100644 --- a/ext/native/profiler/profiler.cpp +++ b/ext/native/profiler/profiler.cpp @@ -8,12 +8,13 @@ #include -#include "base/logging.h" #include "base/timeutil.h" #include "gfx_es2/draw_buffer.h" #include "ppsspp_config.h" #include "profiler/profiler.h" +#include "Common/Log.h" + #define MAX_CATEGORIES 64 // Can be any number, represents max profiled names. #define MAX_DEPTH 16 // Can be any number, represents max nesting depth of profiled names. #if PPSSPP_PLATFORM(IOS) && defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0 @@ -147,7 +148,7 @@ int internal_profiler_enter(const char *category_name, int *out_thread_id) { } internal_profiler_resume(thread_id, category, now); } else { - DLOG("profiler: recursive enter (%i - %s)", category, category_name); + DEBUG_LOG(SYSTEM, "profiler: recursive enter (%i - %s)", category, category_name); } depth++; @@ -164,7 +165,7 @@ void internal_profiler_leave(int thread_id, int category) { int &depth = profiler.depth[thread_id]; if (category < 0 || category >= MAX_CATEGORIES) { - ELOG("Bad category index %d", category); + ERROR_LOG(SYSTEM, "Bad category index %d", category); depth--; return; } @@ -172,9 +173,7 @@ void internal_profiler_leave(int thread_id, int category) { double now = real_time_now(); depth--; - if (depth < 0) { - FLOG("Profiler enter/leave mismatch!"); - } + _assert_msg_(depth >= 0, "Profiler enter/leave mismatch!"); int parent = profiler.parentCategory[thread_id][depth]; // When there's recursion, we don't suspend or resume. diff --git a/ext/native/thin3d/DataFormatGL.cpp b/ext/native/thin3d/DataFormatGL.cpp index b3a8092abf..5037586691 100644 --- a/ext/native/thin3d/DataFormatGL.cpp +++ b/ext/native/thin3d/DataFormatGL.cpp @@ -1,5 +1,4 @@ #include "thin3d/DataFormatGL.h" -#include "base/logging.h" #include "Common/Log.h" namespace Draw { diff --git a/ext/native/thin3d/GLQueueRunner.cpp b/ext/native/thin3d/GLQueueRunner.cpp index a8ae366eda..72ca079602 100644 --- a/ext/native/thin3d/GLQueueRunner.cpp +++ b/ext/native/thin3d/GLQueueRunner.cpp @@ -1,10 +1,7 @@ #include -#include "Common/MemoryUtil.h" -#include "Core/Reporting.h" -#include "GLQueueRunner.h" -#include "GLRenderManager.h" -#include "DataFormatGL.h" -#include "base/logging.h" + +#include "base/logging.h" // For OutputDebugStringUTF8 + #include "base/stringutil.h" #include "gfx/gl_common.h" #include "gfx/gl_debug_log.h" @@ -13,6 +10,14 @@ #include "math/dataconv.h" #include "math/math_util.h" +#include "Common/Log.h" +#include "Common/MemoryUtil.h" + +#include "Core/Reporting.h" +#include "GLQueueRunner.h" +#include "GLRenderManager.h" +#include "DataFormatGL.h" + #define TEXCACHE_NAME_CACHE_SIZE 16 #ifdef IOS @@ -223,7 +228,7 @@ void GLQueueRunner::RunInitSteps(const std::vector &steps, bool ski if (!anyFailed) Reporting::ReportMessage("Error in shader program link: info: %s\nfs: %s\n%s\nvs: %s\n%s", infoLog.c_str(), fsDesc.c_str(), fsCode, vsDesc.c_str(), vsCode); - ELOG("Could not link program:\n %s", infoLog.c_str()); + ERROR_LOG(G3D, "Could not link program:\n %s", infoLog.c_str()); ERROR_LOG(G3D, "VS desc:\n%s", vsDesc.c_str()); ERROR_LOG(G3D, "FS desc:\n%s", fsDesc.c_str()); ERROR_LOG(G3D, "VS:\n%s\n", vsCode); @@ -277,8 +282,8 @@ void GLQueueRunner::RunInitSteps(const std::vector &steps, bool ski if (!success) { std::string infoLog = GetInfoLog(shader, glGetShaderiv, glGetShaderInfoLog); #ifdef __ANDROID__ - ELOG("Error in shader compilation! %s\n", infoLog.c_str()); - ELOG("Shader source:\n%s\n", (const char *)code); + ERROR_LOG(G3D, "Error in shader compilation! %s\n", infoLog.c_str()); + ERROR_LOG(G3D, "Shader source:\n%s\n", (const char *)code); #endif ERROR_LOG(G3D, "Error in shader compilation for: %s", step.create_shader.shader->desc.c_str()); ERROR_LOG(G3D, "Info log: %s", infoLog.c_str()); @@ -547,10 +552,10 @@ retry_depth: // ILOG("Framebuffer verified complete."); break; case GL_FRAMEBUFFER_UNSUPPORTED: - ELOG("GL_FRAMEBUFFER_UNSUPPORTED"); + ERROR_LOG(G3D, "GL_FRAMEBUFFER_UNSUPPORTED"); break; case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: - ELOG("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"); + ERROR_LOG(G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"); break; default: FLOG("Other framebuffer error: %i", status); @@ -1566,10 +1571,10 @@ void GLQueueRunner::fbo_ext_create(const GLRInitStep &step) { // ILOG("Framebuffer verified complete."); break; case GL_FRAMEBUFFER_UNSUPPORTED_EXT: - ELOG("GL_FRAMEBUFFER_UNSUPPORTED"); + ERROR_LOG(G3D, "GL_FRAMEBUFFER_UNSUPPORTED"); break; case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: - ELOG("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT "); + ERROR_LOG(G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT "); break; default: FLOG("Other framebuffer error: %i", status); diff --git a/ext/native/thin3d/GLRenderManager.cpp b/ext/native/thin3d/GLRenderManager.cpp index f21f67aac0..7345e84fa1 100644 --- a/ext/native/thin3d/GLRenderManager.cpp +++ b/ext/native/thin3d/GLRenderManager.cpp @@ -4,11 +4,12 @@ #include "gfx_es2/gpu_features.h" #include "thin3d/thin3d.h" #include "thread/threadutil.h" -#include "base/logging.h" + +#include "Common/Log.h" #include "Common/MemoryUtil.h" #if 0 // def _DEBUG -#define VLOG ILOG +#define VLOG(...) INFO_LOG(G3D, __VA_ARGS__) #else #define VLOG(...) #endif diff --git a/ext/native/thin3d/VulkanRenderManager.cpp b/ext/native/thin3d/VulkanRenderManager.cpp index 385d8a580e..4756b4bd09 100644 --- a/ext/native/thin3d/VulkanRenderManager.cpp +++ b/ext/native/thin3d/VulkanRenderManager.cpp @@ -4,14 +4,13 @@ #include #include "Common/Log.h" -#include "base/logging.h" #include "Common/Vulkan/VulkanContext.h" #include "thin3d/VulkanRenderManager.h" #include "thread/threadutil.h" #if 0 // def _DEBUG -#define VLOG ILOG +#define VLOG(...) INFO_LOG(G3D, __VA_ARGS__) #else #define VLOG(...) #endif @@ -162,7 +161,7 @@ void VulkanRenderManager::CreateBackbuffers() { VkImage *swapchainImages = new VkImage[swapchainImageCount_]; res = vkGetSwapchainImagesKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), &swapchainImageCount_, swapchainImages); if (res != VK_SUCCESS) { - ELOG("vkGetSwapchainImagesKHR failed"); + ERROR_LOG(G3D, "vkGetSwapchainImagesKHR failed"); delete[] swapchainImages; return; } @@ -210,7 +209,7 @@ void VulkanRenderManager::CreateBackbuffers() { } if (newInflightFrames_ != -1) { - ILOG("Updating inflight frames to %d", newInflightFrames_); + INFO_LOG(G3D, "Updating inflight frames to %d", newInflightFrames_); vulkan_->UpdateInflightFrames(newInflightFrames_); newInflightFrames_ = -1; } @@ -222,7 +221,7 @@ void VulkanRenderManager::CreateBackbuffers() { run_ = true; // Won't necessarily be 0. threadInitFrame_ = vulkan_->GetCurFrame(); - ILOG("Starting Vulkan submission thread (threadInitFrame_ = %d)", vulkan_->GetCurFrame()); + INFO_LOG(G3D, "Starting Vulkan submission thread (threadInitFrame_ = %d)", vulkan_->GetCurFrame()); thread_ = std::thread(&VulkanRenderManager::ThreadFunc, this); } } @@ -245,7 +244,7 @@ void VulkanRenderManager::StopThread() { frameData.profile.timestampDescriptions.clear(); } thread_.join(); - ILOG("Vulkan submission thread joined. Frame=%d", vulkan_->GetCurFrame()); + INFO_LOG(G3D, "Vulkan submission thread joined. Frame=%d", vulkan_->GetCurFrame()); // Eat whatever has been queued up for this frame if anything. Wipe(); @@ -275,7 +274,7 @@ void VulkanRenderManager::StopThread() { } } } else { - ILOG("Vulkan submission thread was already stopped."); + INFO_LOG(G3D, "Vulkan submission thread was already stopped."); } } @@ -300,7 +299,7 @@ void VulkanRenderManager::DestroyBackbuffers() { } VulkanRenderManager::~VulkanRenderManager() { - ILOG("VulkanRenderManager destructor"); + INFO_LOG(G3D, "VulkanRenderManager destructor"); StopThread(); vulkan_->WaitUntilQueueIdle(); @@ -352,7 +351,7 @@ void VulkanRenderManager::ThreadFunc() { } VLOG("PULL: Running frame %d", threadFrame); if (firstFrame) { - ILOG("Running first frame (%d)", threadFrame); + INFO_LOG(G3D, "Running first frame (%d)", threadFrame); firstFrame = false; } Run(threadFrame); @@ -428,7 +427,7 @@ void VulkanRenderManager::BeginFrame(bool enableProfiling) { // Must be after the fence - this performs deletes. VLOG("PUSH: BeginFrame %d", curFrame); if (!run_) { - WLOG("BeginFrame while !run_!"); + WARN_LOG(G3D, "BeginFrame while !run_!"); } vulkan_->BeginFrame(); @@ -614,7 +613,7 @@ bool VulkanRenderManager::CopyFramebufferToMemorySync(VKRFramebuffer *src, VkIma } else { // Backbuffer. if (!(vulkan_->GetSurfaceCapabilities().supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_SRC_BIT)) { - ELOG("Copying from backbuffer not supported, can't take screenshots"); + ERROR_LOG(G3D, "Copying from backbuffer not supported, can't take screenshots"); return false; } switch (vulkan_->GetSwapchainFormat()) { @@ -622,7 +621,7 @@ bool VulkanRenderManager::CopyFramebufferToMemorySync(VKRFramebuffer *src, VkIma case VK_FORMAT_R8G8B8A8_UNORM: srcFormat = Draw::DataFormat::R8G8B8A8_UNORM; break; // NOTE: If you add supported formats here, make sure to also support them in VulkanQueueRunner::CopyReadbackBuffer. default: - ELOG("Unsupported backbuffer format for screenshots"); + ERROR_LOG(G3D, "Unsupported backbuffer format for screenshots"); return false; } } @@ -1074,9 +1073,9 @@ void VulkanRenderManager::BeginSubmitFrame(int frame) { VkResult res = vkAcquireNextImageKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), UINT64_MAX, acquireSemaphore_, (VkFence)VK_NULL_HANDLE, &frameData.curSwapchainImage); if (res == VK_SUBOPTIMAL_KHR) { // Hopefully the resize will happen shortly. Ignore - one frame might look bad or something. - WLOG("VK_SUBOPTIMAL_KHR returned - ignoring"); + WARN_LOG(G3D, "VK_SUBOPTIMAL_KHR returned - ignoring"); } else if (res == VK_ERROR_OUT_OF_DATE_KHR) { - WLOG("VK_ERROR_OUT_OF_DATE_KHR returned - processing the frame, but not presenting"); + WARN_LOG(G3D, "VK_ERROR_OUT_OF_DATE_KHR returned - processing the frame, but not presenting"); frameData.skipSwap = true; } else { _assert_msg_(res == VK_SUCCESS, "vkAcquireNextImageKHR failed! result=%s", VulkanResultToString(res)); diff --git a/ext/native/thin3d/d3dx9_loader.cpp b/ext/native/thin3d/d3dx9_loader.cpp index f269ecbe04..e67f4b6ae8 100644 --- a/ext/native/thin3d/d3dx9_loader.cpp +++ b/ext/native/thin3d/d3dx9_loader.cpp @@ -6,9 +6,10 @@ #include #include -#include "base/logging.h" #include "thin3d/d3dx9_loader.h" +#include "Common/Log.h" + // TODO: See if we can use the bundled D3Dcompiler_47.dll to compiler for DX9 as well. typedef BOOL(__stdcall *TFunc_D3DXCheckVersion)(UINT D3DSDKVersion, UINT D3DXSDKVersion); @@ -114,7 +115,7 @@ HMODULE loadDllLastVersion(unsigned int* version, bool debugVersion) { } void handleNotFoundAddr(const char* sFuncName) { - ELOG("Failed to find D3DX function %s", sFuncName); + ERROR_LOG(G3D, "Failed to find D3DX function %s", sFuncName); failedFunctions++; } @@ -126,7 +127,7 @@ int LoadD3DX9Dynamic(bool debugVersion) { hm_d3dx = loadDllLastVersion(&d3dx_version, debugVersion); if (!hm_d3dx) { - ELOG("Failed to find D3DX dll."); + ERROR_LOG(G3D, "Failed to find D3DX dll."); return 0; } const int NERROR = -1; @@ -137,7 +138,7 @@ int LoadD3DX9Dynamic(bool debugVersion) { __HANDLE_DLL_ENTRY(D3DXCompileShader); if (failedFunctions > 0) { - ELOG("Failed to load %i D3DX functions. This will not go well.", failedFunctions); + ERROR_LOG(G3D, "Failed to load %i D3DX functions. This will not go well.", failedFunctions); } return failedFunctions > 0 ? 0 : d3dx_version; From c41f875df421bf2b508037ea1569f3500fd78f42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 16:13:24 +0200 Subject: [PATCH 08/15] Remove base/logging.h in a whole lot more places. --- Core/Config.cpp | 2 +- Core/Core.cpp | 2 +- Core/MIPS/ARM/ArmJit.cpp | 4 ++-- Core/MIPS/ARM64/Arm64RegCacheFPU.cpp | 4 ++-- GPU/Common/ShaderTranslation.cpp | 8 +++---- GPU/Directx9/ShaderManagerDX9.cpp | 2 ++ GPU/Directx9/StencilBufferDX9.cpp | 1 + GPU/GLES/GPU_GLES.cpp | 4 ++-- GPU/Vulkan/GPU_Vulkan.cpp | 4 ++-- SDL/SDLCocoaMetalLayer.mm | 1 - UI/BackgroundAudio.cpp | 12 +++++----- UI/ControlMappingScreen.cpp | 7 +++--- UI/GameSettingsScreen.cpp | 10 ++++---- UI/Store.cpp | 4 ++-- UI/TextureUtil.cpp | 20 ++++++++-------- UI/TouchControlLayoutScreen.cpp | 2 +- UWP/StorageFolderBrowser.cpp | 1 - Windows/EmuThread.cpp | 2 +- Windows/GPU/D3D9Context.cpp | 2 +- ext/native/profiler/profiler.cpp | 5 +--- ext/native/thin3d/GLRenderManager.cpp | 12 +++++----- ext/native/thin3d/thin3d.cpp | 3 +-- ext/native/thin3d/thin3d.h | 1 - ext/native/thin3d/thin3d_d3d11.cpp | 6 ++--- ext/native/thin3d/thin3d_d3d9.cpp | 28 +++++++++++----------- ext/native/thin3d/thin3d_gl.cpp | 21 ++++++++-------- ext/native/thin3d/thin3d_vulkan.cpp | 20 ++++++++-------- ext/native/thread/prioritizedworkqueue.cpp | 7 +++--- ext/native/thread/threadpool.cpp | 7 +++--- ext/native/thread/threadutil.cpp | 7 ++++-- ext/native/ui/root.cpp | 6 +++-- ext/native/ui/screen.cpp | 27 +++++++++++---------- ext/native/ui/ui_context.cpp | 1 - ext/native/ui/ui_screen.cpp | 9 ++++--- ext/native/ui/viewgroup.cpp | 9 +++---- headless/WindowsHeadlessHost.cpp | 2 ++ 36 files changed, 136 insertions(+), 127 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index f7fd8e9af9..8e53ab9200 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -527,7 +527,7 @@ static int DefaultInternalResolution() { #else int longestDisplaySide = std::max(System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)); int scale = longestDisplaySide >= 1000 ? 2 : 1; - ILOG("Longest display side: %d pixels. Choosing scale %d", longestDisplaySide, scale); + INFO_LOG(G3D, "Longest display side: %d pixels. Choosing scale %d", longestDisplaySide, scale); return scale; #endif } diff --git a/Core/Core.cpp b/Core/Core.cpp index 01b2970cda..acb1ad44c6 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -190,7 +190,7 @@ bool UpdateScreenScale(int width, int height) { dp_yres = new_dp_yres; pixel_xres = width; pixel_yres = height; - ILOG("pixel_res: %dx%d. Calling NativeResized()", pixel_xres, pixel_yres); + INFO_LOG(G3D, "pixel_res: %dx%d. Calling NativeResized()", pixel_xres, pixel_yres); NativeResized(); return true; } diff --git a/Core/MIPS/ARM/ArmJit.cpp b/Core/MIPS/ARM/ArmJit.cpp index 829307b419..5a8316f06b 100644 --- a/Core/MIPS/ARM/ArmJit.cpp +++ b/Core/MIPS/ARM/ArmJit.cpp @@ -62,13 +62,13 @@ void DisassembleArm(const u8 *data, int size) { int reg1 = (next & 0x0000F000) >> 12; if (reg0 == reg1) { sprintf(temp, "%08x MOV32 %s, %04x%04x", (u32)inst, ArmRegName(reg0), hi, low); - ILOG("A: %s", temp); + INFO_LOG(JIT, "A: %s", temp); i += 4; continue; } } ArmDis((u32)codePtr, inst, temp, sizeof(temp), true); - ILOG("A: %s", temp); + INFO_LOG(JIT, "A: %s", temp); } } diff --git a/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp b/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp index ebb0d09494..fffb38fcc7 100644 --- a/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp +++ b/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp @@ -400,7 +400,7 @@ void Arm64RegCacheFPU::FlushAll() { if (ar[a].isDirty) { if (m == -1) { - INFO_LOG(JIT, "ARM reg %i is dirty but has no mipsreg", a); + INFO_LOG(JIT, "ARM reg %d is dirty but has no mipsreg", a); continue; } @@ -423,7 +423,7 @@ void Arm64RegCacheFPU::FlushAll() { // Sanity check for (int i = 0; i < numARMFpuReg_; i++) { if (ar[i].mipsReg != -1) { - ERROR_LOG(JIT, "Flush fail: ar[%i].mipsReg=%i", i, ar[i].mipsReg); + ERROR_LOG(JIT, "Flush fail: ar[%d].mipsReg=%d", i, ar[i].mipsReg); } } pendingFlush = false; diff --git a/GPU/Common/ShaderTranslation.cpp b/GPU/Common/ShaderTranslation.cpp index d535d063c1..e0b58908fc 100644 --- a/GPU/Common/ShaderTranslation.cpp +++ b/GPU/Common/ShaderTranslation.cpp @@ -252,8 +252,8 @@ bool TranslateShader(std::string *dest, ShaderLanguage destLang, TranslatedShade shaderStrings[0] = src.c_str(); shader.setStrings(shaderStrings, 1); if (!shader.parse(&Resources, 100, EProfile::ECompatibilityProfile, false, false, messages)) { - ELOG("%s", shader.getInfoLog()); - ELOG("%s", shader.getInfoDebugLog()); + ERROR_LOG(G3D, "%s", shader.getInfoLog()); + ERROR_LOG(G3D, "%s", shader.getInfoDebugLog()); if (errorMessage) { *errorMessage = shader.getInfoLog(); (*errorMessage) += shader.getInfoDebugLog(); @@ -265,8 +265,8 @@ bool TranslateShader(std::string *dest, ShaderLanguage destLang, TranslatedShade program.addShader(&shader); if (!program.link(messages)) { - ELOG("%s", shader.getInfoLog()); - ELOG("%s", shader.getInfoDebugLog()); + ERROR_LOG(G3D, "%s", shader.getInfoLog()); + ERROR_LOG(G3D, "%s", shader.getInfoDebugLog()); if (errorMessage) { *errorMessage = shader.getInfoLog(); (*errorMessage) += shader.getInfoDebugLog(); diff --git a/GPU/Directx9/ShaderManagerDX9.cpp b/GPU/Directx9/ShaderManagerDX9.cpp index 64a1d28137..15cb7777e8 100644 --- a/GPU/Directx9/ShaderManagerDX9.cpp +++ b/GPU/Directx9/ShaderManagerDX9.cpp @@ -23,6 +23,7 @@ #include #include "gfx/d3d9_shader.h" +#include "base/logging.h" // For OutputDebugStringUTF8 #include "base/stringutil.h" #include "i18n/i18n.h" #include "math/lin/matrix4x4.h" @@ -32,6 +33,7 @@ #include "util/text/utf8.h" #include "Common/Common.h" +#include "Common/Log.h" #include "Core/Config.h" #include "Core/Host.h" #include "Core/Reporting.h" diff --git a/GPU/Directx9/StencilBufferDX9.cpp b/GPU/Directx9/StencilBufferDX9.cpp index 4310a1654e..722a43b31f 100644 --- a/GPU/Directx9/StencilBufferDX9.cpp +++ b/GPU/Directx9/StencilBufferDX9.cpp @@ -17,6 +17,7 @@ #include +#include "base/logging.h" // For OutputDebugStringUTF8 #include "gfx/d3d9_state.h" #include "ext/native/thin3d/thin3d.h" #include "Core/Reporting.h" diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 40fda18e5e..8c9df27705 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -310,7 +310,7 @@ void GPU_GLES::BuildReportingInfo() { } void GPU_GLES::DeviceLost() { - ILOG("GPU_GLES: DeviceLost"); + INFO_LOG(G3D, "GPU_GLES: DeviceLost"); // Simply drop all caches and textures. // FBOs appear to survive? Or no? @@ -328,7 +328,7 @@ void GPU_GLES::DeviceLost() { void GPU_GLES::DeviceRestore() { draw_ = (Draw::DrawContext *)PSP_CoreParameter().graphicsContext->GetDrawContext(); - ILOG("GPU_GLES: DeviceRestore"); + INFO_LOG(G3D, "GPU_GLES: DeviceRestore"); UpdateCmdInfo(); UpdateVsyncInterval(true); diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index 6442b3e8d7..c2ba043348 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -471,7 +471,7 @@ void GPU_Vulkan::ExecuteOp(u32 op, u32 diff) { } void GPU_Vulkan::InitDeviceObjects() { - ILOG("GPU_Vulkan::InitDeviceObjects"); + INFO_LOG(G3D, "GPU_Vulkan::InitDeviceObjects"); // Initialize framedata for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) { assert(!frameData_[i].push_); @@ -495,7 +495,7 @@ void GPU_Vulkan::InitDeviceObjects() { } void GPU_Vulkan::DestroyDeviceObjects() { - ILOG("GPU_Vulkan::DestroyDeviceObjects"); + INFO_LOG(G3D, "GPU_Vulkan::DestroyDeviceObjects"); for (int i = 0; i < VulkanContext::MAX_INFLIGHT_FRAMES; i++) { if (frameData_[i].push_) { frameData_[i].push_->Destroy(vulkan_); diff --git a/SDL/SDLCocoaMetalLayer.mm b/SDL/SDLCocoaMetalLayer.mm index d0df82716b..c45158ff5d 100644 --- a/SDL/SDLCocoaMetalLayer.mm +++ b/SDL/SDLCocoaMetalLayer.mm @@ -5,7 +5,6 @@ #endif #import -#include "base/logging.h" #include "SDLCocoaMetalLayer.h" void *makeWindowMetalCompatible(void *window) { diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index 1de2def802..a061af2056 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -84,9 +84,9 @@ void WavData::Read(RIFFReader &file_) { } } file_.Ascend(); - // ILOG("got fmt data: %i", samplesPerSec); + // INFO_LOG(AUDIO, "got fmt data: %i", samplesPerSec); } else { - ELOG("Error - no format chunk in wav"); + ERROR_LOG(AUDIO, "Error - no format chunk in wav"); file_.Ascend(); return; } @@ -142,20 +142,20 @@ void WavData::Read(RIFFReader &file_) { if (num_channels == 1 || num_channels == 2) { file_.ReadData(raw_data, numBytes); } else { - ELOG("Error - bad blockalign or channels"); + ERROR_LOG(AUDIO, "Error - bad blockalign or channels"); free(raw_data); raw_data = nullptr; return; } file_.Ascend(); } else { - ELOG("Error - no data chunk in wav"); + ERROR_LOG(AUDIO, "Error - no data chunk in wav"); file_.Ascend(); return; } file_.Ascend(); } else { - ELOG("Could not descend into RIFF file."); + ERROR_LOG(AUDIO, "Could not descend into RIFF file."); return; } sample_rate = samplesPerSec; @@ -269,7 +269,7 @@ BackgroundAudio::Sample *BackgroundAudio::LoadSample(const std::string &path) { delete [] data; if (wave.num_channels != 2 || wave.sample_rate != 44100 || wave.raw_bytes_per_frame != 4) { - ELOG("Wave format not supported for mixer playback. Must be 16-bit raw stereo. '%s'", path.c_str()); + ERROR_LOG(AUDIO, "Wave format not supported for mixer playback. Must be 16-bit raw stereo. '%s'", path.c_str()); return nullptr; } diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index 3d711eda2f..1cf93ebb44 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -34,6 +34,7 @@ #include "Core/Host.h" #include "Core/HLE/sceCtrl.h" #include "Core/System.h" +#include "Common/Log.h" #include "Common/KeyMap.h" #include "Core/Config.h" #include "UI/ControlMappingScreen.h" @@ -581,7 +582,7 @@ bool TouchTestScreen::touch(const TouchInput &touch) { bool found = false; for (int i = 0; i < MAX_TOUCH_POINTS; i++) { if (touches_[i].id == touch.id) { - WLOG("Double touch"); + WARN_LOG(SYSTEM, "Double touch"); touches_[i].x = touch.x; touches_[i].y = touch.y; found = true; @@ -608,7 +609,7 @@ bool TouchTestScreen::touch(const TouchInput &touch) { } } if (!found) { - WLOG("Move without touch down: %d", touch.id); + WARN_LOG(SYSTEM, "Move without touch down: %d", touch.id); } } if (touch.flags & TOUCH_UP) { @@ -621,7 +622,7 @@ bool TouchTestScreen::touch(const TouchInput &touch) { } } if (!found) { - WLOG("Touch release without touch down"); + WARN_LOG(SYSTEM, "Touch release without touch down"); } } return true; diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 4734b179a6..bcb0a293c5 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -998,19 +998,19 @@ UI::EventReturn GameSettingsScreen::OnHardwareTransform(UI::EventParams &e) { } UI::EventReturn GameSettingsScreen::OnScreenRotation(UI::EventParams &e) { - ILOG("New display rotation: %d", g_Config.iScreenRotation); - ILOG("Sending rotate"); + INFO_LOG(SYSTEM, "New display rotation: %d", g_Config.iScreenRotation); + INFO_LOG(SYSTEM, "Sending rotate"); System_SendMessage("rotate", ""); - ILOG("Got back from rotate"); + INFO_LOG(SYSTEM, "Got back from rotate"); return UI::EVENT_DONE; } void RecreateActivity() { const int SYSTEM_JELLYBEAN = 16; if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= SYSTEM_JELLYBEAN) { - ILOG("Sending recreate"); + INFO_LOG(SYSTEM, "Sending recreate"); System_SendMessage("recreate", ""); - ILOG("Got back from recreate"); + INFO_LOG(SYSTEM, "Got back from recreate"); } else { auto gr = GetI18NCategory("Graphics"); System_SendMessage("toast", gr->T("Must Restart", "You must restart PPSSPP for this change to take effect")); diff --git a/UI/Store.cpp b/UI/Store.cpp index f52a1ae916..fd27021106 100644 --- a/UI/Store.cpp +++ b/UI/Store.cpp @@ -370,7 +370,7 @@ void StoreScreen::update() { RecreateViews(); } else { // Failed to contact store. Don't do anything. - ELOG("Download failed : error code %d", listing_->ResultCode()); + ERROR_LOG(IO, "Download failed : error code %d", listing_->ResultCode()); connectionError_ = true; loading_ = false; RecreateViews(); @@ -398,7 +398,7 @@ void StoreScreen::ParseListing(std::string json) { using namespace json; JsonReader reader(json.c_str(), json.size()); if (!reader.ok() || !reader.root()) { - ELOG("Error parsing JSON from store"); + ERROR_LOG(IO, "Error parsing JSON from store"); connectionError_ = true; RecreateViews(); return; diff --git a/UI/TextureUtil.cpp b/UI/TextureUtil.cpp index 0d05bbc448..dc0cfa2355 100644 --- a/UI/TextureUtil.cpp +++ b/UI/TextureUtil.cpp @@ -43,7 +43,7 @@ static bool LoadTextureLevels(const uint8_t *data, size_t size, ImageFileType ty type = DetectImageFileType(data, size); } if (type == TYPE_UNKNOWN) { - ELOG("File (size: %d) has unknown format", (int)size); + ERROR_LOG(G3D, "File (size: %d) has unknown format", (int)size); return false; } @@ -63,11 +63,11 @@ static bool LoadTextureLevels(const uint8_t *data, size_t size, ImageFileType ty *num_levels = 1; *fmt = Draw::DataFormat::R8G8B8A8_UNORM; if (!image[0]) { - ELOG("WTF"); + ERROR_LOG(IO, "WTF"); return false; } } else { - ELOG("PNG load failed"); + ERROR_LOG(IO, "PNG load failed"); return false; } break; @@ -85,7 +85,7 @@ static bool LoadTextureLevels(const uint8_t *data, size_t size, ImageFileType ty break; default: - ELOG("Unsupported image format %d", (int)type); + ERROR_LOG(IO, "Unsupported image format %d", (int)type); return false; } @@ -111,7 +111,7 @@ bool ManagedTexture::LoadFromFileData(const uint8_t *data, size_t dataSize, Imag } if (num_levels < 0 || num_levels >= 16) { - ELOG("Invalid num_levels: %d. Falling back to one. Image: %dx%d", num_levels, width[0], height[0]); + ERROR_LOG(IO, "Invalid num_levels: %d. Falling back to one. Image: %dx%d", num_levels, width[0], height[0]); num_levels = 1; } @@ -149,7 +149,7 @@ bool ManagedTexture::LoadFromFile(const std::string &filename, ImageFileType typ uint8_t *buffer = VFSReadFile(filename.c_str(), &fileSize); if (!buffer) { filename_ = ""; - ELOG("Failed to read file '%s'", filename.c_str()); + ERROR_LOG(IO, "Failed to read file '%s'", filename.c_str()); return false; } bool retval = LoadFromFileData(buffer, fileSize, type, generateMips, filename.c_str()); @@ -157,7 +157,7 @@ bool ManagedTexture::LoadFromFile(const std::string &filename, ImageFileType typ filename_ = filename; } else { filename_ = ""; - ELOG("Failed to load texture '%s'", filename.c_str()); + ERROR_LOG(IO, "Failed to load texture '%s'", filename.c_str()); } delete[] buffer; return retval; @@ -176,14 +176,14 @@ std::unique_ptr CreateTextureFromFile(Draw::DrawContext *draw, c } void ManagedTexture::DeviceLost() { - ILOG("ManagedTexture::DeviceLost(%s)", filename_.c_str()); + INFO_LOG(G3D, "ManagedTexture::DeviceLost(%s)", filename_.c_str()); if (texture_) texture_->Release(); texture_ = nullptr; } void ManagedTexture::DeviceRestored(Draw::DrawContext *draw) { - ILOG("ManagedTexture::DeviceRestored(%s)", filename_.c_str()); + INFO_LOG(G3D, "ManagedTexture::DeviceRestored(%s)", filename_.c_str()); _assert_(!texture_); draw_ = draw; // Vulkan: Can't load textures before the first frame has started. @@ -194,7 +194,7 @@ void ManagedTexture::DeviceRestored(Draw::DrawContext *draw) { Draw::Texture *ManagedTexture::GetTexture() { if (loadPending_) { if (!LoadFromFile(filename_, ImageFileType::DETECT, generateMips_)) { - ELOG("ManagedTexture failed: '%s'", filename_.c_str()); + ERROR_LOG(IO, "ManagedTexture failed: '%s'", filename_.c_str()); } loadPending_ = false; } diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index e895ebd384..f8835f1e74 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -448,7 +448,7 @@ UI::EventReturn TouchControlLayoutScreen::OnVisibility(UI::EventParams &e) { } UI::EventReturn TouchControlLayoutScreen::OnReset(UI::EventParams &e) { - ILOG("Resetting touch control layout"); + INFO_LOG(G3D, "Resetting touch control layout"); g_Config.ResetControlLayout(); const Bounds &bounds = screenManager()->getUIContext()->GetBounds(); InitPadLayout(bounds.w, bounds.h); diff --git a/UWP/StorageFolderBrowser.cpp b/UWP/StorageFolderBrowser.cpp index e5c6149d4c..3744b3e6dd 100644 --- a/UWP/StorageFolderBrowser.cpp +++ b/UWP/StorageFolderBrowser.cpp @@ -1,7 +1,6 @@ #include "pch.h" #include "ppltasks.h" -#include "base/logging.h" #include "thread/threadutil.h" #include "StorageFolderBrowser.h" diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index 7239929dae..83ce9471f7 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -104,7 +104,7 @@ static void EmuThreadStop() { static void EmuThreadJoin() { emuThread.join(); emuThread = std::thread(); - ILOG("EmuThreadJoin - joined"); + INFO_LOG(SYSTEM, "EmuThreadJoin - joined"); } void MainThreadFunc() { diff --git a/Windows/GPU/D3D9Context.cpp b/Windows/GPU/D3D9Context.cpp index c948654b98..0014c31121 100644 --- a/Windows/GPU/D3D9Context.cpp +++ b/Windows/GPU/D3D9Context.cpp @@ -71,7 +71,7 @@ bool D3D9Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) { hD3D9_ = LoadLibrary(TEXT("d3d9.dll")); if (!hD3D9_) { - ELOG("Missing d3d9.dll"); + ERROR_LOG(G3D, "Missing d3d9.dll"); *error_message = "D3D9.dll missing - try reinstalling DirectX."; return false; } diff --git a/ext/native/profiler/profiler.cpp b/ext/native/profiler/profiler.cpp index 2c2457812f..60dffd5154 100644 --- a/ext/native/profiler/profiler.cpp +++ b/ext/native/profiler/profiler.cpp @@ -190,10 +190,7 @@ void internal_profiler_leave(int thread_id, int category) { void internal_profiler_end_frame() { int thread_id = internal_profiler_find_thread(); - if (profiler.depth[thread_id] != 0) { - // Threads may be off, but they'll fall into another frame. - FLOG("Can't be inside a profiler scope at end of frame!"); - } + _assert_msg_(profiler.depth[thread_id] == 0, "Can't be inside a profiler scope at end of frame!"); profiler.curFrameStart = real_time_now(); profiler.historyPos++; profiler.historyPos &= (HISTORY_SIZE - 1); diff --git a/ext/native/thin3d/GLRenderManager.cpp b/ext/native/thin3d/GLRenderManager.cpp index 7345e84fa1..19a3ac0053 100644 --- a/ext/native/thin3d/GLRenderManager.cpp +++ b/ext/native/thin3d/GLRenderManager.cpp @@ -114,7 +114,7 @@ void GLRenderManager::ThreadStart(Draw::DrawContext *draw) { renderThreadId = std::this_thread::get_id(); if (newInflightFrames_ != -1) { - ILOG("Updating inflight frames to %d", newInflightFrames_); + INFO_LOG(G3D, "Updating inflight frames to %d", newInflightFrames_); inflightFrames_ = newInflightFrames_; newInflightFrames_ = -1; } @@ -154,7 +154,7 @@ void GLRenderManager::ThreadStart(Draw::DrawContext *draw) { } void GLRenderManager::ThreadEnd() { - ILOG("ThreadEnd"); + INFO_LOG(G3D, "ThreadEnd"); // Wait for any shutdown to complete in StopThread(). std::unique_lock lock(mutex_); @@ -217,7 +217,7 @@ bool GLRenderManager::ThreadFrame() { } VLOG("PULL: Running frame %d", threadFrame_); if (firstFrame) { - ILOG("Running first frame (%d)", threadFrame_); + INFO_LOG(G3D, "Running first frame (%d)", threadFrame_); firstFrame = false; } Run(threadFrame_); @@ -246,7 +246,7 @@ void GLRenderManager::StopThread() { // Wait until we've definitely stopped the threadframe. std::unique_lock lock(mutex_); - ILOG("GL submission thread paused. Frame=%d", curFrame_); + INFO_LOG(G3D, "GL submission thread paused. Frame=%d", curFrame_); // Eat whatever has been queued up for this frame if anything. Wipe(); @@ -274,7 +274,7 @@ void GLRenderManager::StopThread() { } } } else { - ILOG("GL submission thread was already paused."); + INFO_LOG(G3D, "GL submission thread was already paused."); } } @@ -454,7 +454,7 @@ void GLRenderManager::BeginFrame() { // Must be after the fence - this performs deletes. VLOG("PUSH: BeginFrame %d", curFrame); if (!run_) { - WLOG("BeginFrame while !run_!"); + WARN_LOG(G3D, "BeginFrame while !run_!"); } // vulkan_->BeginFrame(); diff --git a/ext/native/thin3d/thin3d.cpp b/ext/native/thin3d/thin3d.cpp index 97b6fe9e0a..aabb1d818b 100644 --- a/ext/native/thin3d/thin3d.cpp +++ b/ext/native/thin3d/thin3d.cpp @@ -2,7 +2,6 @@ #include #include -#include "base/logging.h" #include "base/display.h" #include "thin3d/thin3d.h" #include "Common/Log.h" @@ -92,7 +91,7 @@ bool RefCountedObject::ReleaseAssertLast() { return true; } } else { - ELOG("Refcount (%d) invalid for object %p - corrupt?", refcount_, this); + ERROR_LOG(G3D, "Refcount (%d) invalid for object %p - corrupt?", refcount_, this); } return false; } diff --git a/ext/native/thin3d/thin3d.h b/ext/native/thin3d/thin3d.h index ced1d8df67..88001c4aa3 100644 --- a/ext/native/thin3d/thin3d.h +++ b/ext/native/thin3d/thin3d.h @@ -12,7 +12,6 @@ #include #include -#include "base/logging.h" #include "DataFormat.h" namespace Lin { diff --git a/ext/native/thin3d/thin3d_d3d11.cpp b/ext/native/thin3d/thin3d_d3d11.cpp index 8c53ffc7d8..9c371678e0 100644 --- a/ext/native/thin3d/thin3d_d3d11.cpp +++ b/ext/native/thin3d/thin3d_d3d11.cpp @@ -870,7 +870,7 @@ public: ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const std::string &tag) { if (language != ShaderLanguage::HLSL_D3D11) { - ELOG("Unsupported shader language"); + ERROR_LOG(G3D, "Unsupported shader language"); return nullptr; } @@ -915,7 +915,7 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang } if (errorMsgs) { errors = std::string((const char *)errorMsgs->GetBufferPointer(), errorMsgs->GetBufferSize()); - ELOG("Failed compiling:\n%s\n%s", data, errors.c_str()); + ERROR_LOG(G3D, "Failed compiling:\n%s\n%s", data, errors.c_str()); errorMsgs->Release(); } @@ -940,7 +940,7 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang result = device_->CreateGeometryShader(data, dataSize, nullptr, &module->gs); break; default: - ELOG("Unsupported shader stage"); + ERROR_LOG(G3D, "Unsupported shader stage"); result = S_FALSE; break; } diff --git a/ext/native/thin3d/thin3d_d3d9.cpp b/ext/native/thin3d/thin3d_d3d9.cpp index 0b6740963f..2b629149a8 100644 --- a/ext/native/thin3d/thin3d_d3d9.cpp +++ b/ext/native/thin3d/thin3d_d3d9.cpp @@ -33,11 +33,12 @@ #define D3DXERR_INVALIDDATA 0x88760b59 #endif -#include "base/logging.h" #include "math/lin/matrix4x4.h" #include "thin3d/thin3d.h" #include "gfx/d3d9_state.h" +#include "Common/Log.h" + namespace Draw { // Could be declared as u8 @@ -381,7 +382,7 @@ bool D3D9Texture::Create(const TextureDesc &desc) { break; } if (FAILED(hr)) { - ELOG("Texture creation failed"); + ERROR_LOG(G3D, "Texture creation failed"); return false; } @@ -476,7 +477,7 @@ void D3D9Texture::SetImageData(int x, int y, int z, int width, int height, int d } default: - ELOG("Non-LINEAR2D textures not yet supported"); + ERROR_LOG(G3D, "Non-LINEAR2D textures not yet supported"); break; } } @@ -636,7 +637,7 @@ private: D3D9Context::D3D9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx) : d3d_(d3d), d3dEx_(d3dEx), adapterId_(adapterId), device_(device), deviceEx_(deviceEx), caps_{} { if (FAILED(d3d->GetAdapterIdentifier(adapterId, 0, &identifier_))) { - ELOG("Failed to get adapter identifier: %d", adapterId); + ERROR_LOG(G3D, "Failed to get adapter identifier: %d", adapterId); } switch (identifier_.VendorId) { case 0x10DE: caps_.vendor = GPUVendor::VENDOR_NVIDIA; break; @@ -691,13 +692,13 @@ ShaderModule *D3D9Context::CreateShaderModule(ShaderStage stage, ShaderLanguage Pipeline *D3D9Context::CreateGraphicsPipeline(const PipelineDesc &desc) { if (!desc.shaders.size()) { - ELOG("Pipeline requires at least one shader"); + ERROR_LOG(G3D, "Pipeline requires at least one shader"); return NULL; } D3D9Pipeline *pipeline = new D3D9Pipeline(device_); for (auto iter : desc.shaders) { if (!iter) { - ELOG("NULL shader passed to CreateGraphicsPipeline"); + ERROR_LOG(G3D, "NULL shader passed to CreateGraphicsPipeline"); delete pipeline; return NULL; } @@ -856,7 +857,7 @@ D3D9InputLayout::D3D9InputLayout(LPDIRECT3DDEVICE9 device, const InputLayoutDesc HRESULT hr = device->CreateVertexDeclaration(elements, &decl_); if (FAILED(hr)) { - ELOG("Error creating vertex decl"); + ERROR_LOG(G3D, "Error creating vertex decl"); } delete[] elements; } @@ -900,8 +901,7 @@ inline void Transpose4x4(float out[16], const float in[16]) { } void D3D9Context::UpdateDynamicUniformBuffer(const void *ub, size_t size) { - if (size != curPipeline_->dynamicUniforms.uniformBufferSize) - Crash(); + _assert_(size == curPipeline_->dynamicUniforms.uniformBufferSize); for (auto &uniform : curPipeline_->dynamicUniforms.uniforms) { int count = 0; switch (uniform.type) { @@ -935,7 +935,7 @@ void D3D9Context::UpdateBuffer(Buffer *buffer, const uint8_t *data, size_t offse if (!size) return; if (offset + size > buf->maxSize_) { - ELOG("Can't SubData with bigger size than buffer was created with"); + ERROR_LOG(G3D, "Can't SubData with bigger size than buffer was created with"); return; } if (buf->vbuffer_) { @@ -1104,7 +1104,7 @@ Framebuffer *D3D9Context::CreateFramebuffer(const FramebufferDesc &desc) { HRESULT rtResult = device_->CreateTexture(fbo->width, fbo->height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &fbo->tex, NULL); if (FAILED(rtResult)) { - ELOG("Failed to create render target"); + ERROR_LOG(G3D, "Failed to create render target"); delete fbo; return NULL; } @@ -1120,7 +1120,7 @@ Framebuffer *D3D9Context::CreateFramebuffer(const FramebufferDesc &desc) { dsResult = device_->CreateDepthStencilSurface(fbo->width, fbo->height, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, FALSE, &fbo->depthstencil, NULL); } if (FAILED(dsResult)) { - ELOG("Failed to create depth buffer"); + ERROR_LOG(G3D, "Failed to create depth buffer"); fbo->surf->Release(); fbo->tex->Release(); if (fbo->depthstenciltex) { @@ -1264,13 +1264,13 @@ DrawContext *T3DCreateDX9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapt #if PPSSPP_API(D3DX9) int d3dx_ver = LoadD3DX9Dynamic(); if (!d3dx_ver) { - ELOG("Failed to load D3DX9!"); + ERROR_LOG(G3D, "Failed to load D3DX9!"); return NULL; } #elif PPSSPP_API(D3D9_D3DCOMPILER) bool result = LoadD3DCompilerDynamic(); if (!result) { - ELOG("Failed to load D3DCompiler!"); + ERROR_LOG(G3D, "Failed to load D3DCompiler!"); return NULL; } #endif diff --git a/ext/native/thin3d/thin3d_gl.cpp b/ext/native/thin3d/thin3d_gl.cpp index b77a8fd4fd..c42b186b54 100644 --- a/ext/native/thin3d/thin3d_gl.cpp +++ b/ext/native/thin3d/thin3d_gl.cpp @@ -4,7 +4,6 @@ #include #include -#include "base/logging.h" #include "math/dataconv.h" #include "math/math_util.h" #include "math/lin/matrix4x4.h" @@ -230,7 +229,7 @@ GLuint ShaderStageToOpenGL(ShaderStage stage) { class OpenGLShaderModule : public ShaderModule { public: OpenGLShaderModule(GLRenderManager *render, ShaderStage stage, const std::string &tag) : render_(render), stage_(stage), tag_(tag) { - DLOG("Shader module created (%p)", this); + DEBUG_LOG(G3D, "Shader module created (%p)", this); glstage_ = ShaderStageToOpenGL(stage); } @@ -644,7 +643,7 @@ GLuint TypeToTarget(TextureType type) { #endif case TextureType::ARRAY2D: return GL_TEXTURE_2D_ARRAY; default: - ELOG("Bad texture type %d", (int)type); + ERROR_LOG(G3D, "Bad texture type %d", (int)type); return GL_NONE; } } @@ -957,15 +956,15 @@ void OpenGLContext::UpdateBuffer(Buffer *buffer, const uint8_t *data, size_t off Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc) { if (!desc.shaders.size()) { - ELOG("Pipeline requires at least one shader"); + ERROR_LOG(G3D, "Pipeline requires at least one shader"); return nullptr; } if ((int)desc.prim >= (int)Primitive::PRIMITIVE_TYPE_COUNT) { - ELOG("Invalid primitive type"); + ERROR_LOG(G3D, "Invalid primitive type"); return nullptr; } if (!desc.depthStencil || !desc.blend || !desc.raster || !desc.inputLayout) { - ELOG("Incomplete prim desciption"); + ERROR_LOG(G3D, "Incomplete prim desciption"); return nullptr; } @@ -975,7 +974,7 @@ Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc) { iter->AddRef(); pipeline->shaders.push_back(static_cast(iter)); } else { - ELOG("ERROR: Tried to create graphics pipeline with a null shader module"); + ERROR_LOG(G3D, "ERROR: Tried to create graphics pipeline with a null shader module"); delete pipeline; return nullptr; } @@ -997,7 +996,7 @@ Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc) { pipeline->inputLayout->AddRef(); return pipeline; } else { - ELOG("Failed to create pipeline - shaders failed to link"); + ERROR_LOG(G3D, "Failed to create pipeline - shaders failed to link"); delete pipeline; return nullptr; } @@ -1059,11 +1058,11 @@ bool OpenGLPipeline::LinkShaders() { if (shader) { linkShaders.push_back(shader); } else { - ELOG("LinkShaders: Bad shader module"); + ERROR_LOG(G3D, "LinkShaders: Bad shader module"); return false; } } else { - ELOG("LinkShaders: Bad shader in module"); + ERROR_LOG(G3D, "LinkShaders: Bad shader in module"); return false; } } @@ -1213,7 +1212,7 @@ void OpenGLInputLayout::Compile(const InputLayoutDesc &desc) { break; case DataFormat::UNDEFINED: default: - ELOG("Thin3DGLVertexFormat: Invalid or unknown component type applied."); + ERROR_LOG(G3D, "Thin3DGLVertexFormat: Invalid or unknown component type applied."); break; } diff --git a/ext/native/thin3d/thin3d_vulkan.cpp b/ext/native/thin3d/thin3d_vulkan.cpp index 7c033aeed3..f6c4dc18b9 100644 --- a/ext/native/thin3d/thin3d_vulkan.cpp +++ b/ext/native/thin3d/thin3d_vulkan.cpp @@ -21,9 +21,6 @@ #include #include -#include "Core/Config.h" - -#include "base/logging.h" #include "base/display.h" #include "base/stringutil.h" #include "image/zim_load.h" @@ -32,10 +29,13 @@ #include "thin3d/thin3d.h" #include "thin3d/VulkanRenderManager.h" +#include "Common/Log.h" #include "Common/Vulkan/VulkanContext.h" #include "Common/Vulkan/VulkanImage.h" #include "Common/Vulkan/VulkanMemory.h" +#include "Core/Config.h" + // We use a simple descriptor set for all rendering: 1 sampler, 1 texture, 1 UBO binding point. // binding 0 - uniform data // binding 1 - sampler @@ -704,7 +704,7 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanPushBuffer *push, const Textur // Zero-sized textures not allowed. _assert_(desc.width * desc.height * desc.depth > 0); // remember to set depth to 1! if (desc.width * desc.height * desc.depth <= 0) { - ELOG("Bad texture dimensions %dx%dx%d", desc.width, desc.height, desc.depth); + ERROR_LOG(G3D, "Bad texture dimensions %dx%dx%d", desc.width, desc.height, desc.depth); return false; } _assert_(push); @@ -727,7 +727,7 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanPushBuffer *push, const Textur } if (!vkTex_->CreateDirect(cmd, alloc, width_, height_, mipLevels_, vulkanFormat, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, usageBits)) { - ELOG("Failed to create VulkanTexture: %dx%dx%d fmt %d, %d levels", width_, height_, depth_, (int)vulkanFormat, mipLevels_); + ERROR_LOG(G3D, "Failed to create VulkanTexture: %dx%dx%d fmt %d, %d levels", width_, height_, depth_, (int)vulkanFormat, mipLevels_); return false; } if (desc.initData.size()) { @@ -1038,7 +1038,7 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc) { for (auto &iter : desc.shaders) { VKShaderModule *vkshader = (VKShaderModule *)iter; if (!vkshader) { - ELOG("CreateGraphicsPipeline got passed a null shader"); + ERROR_LOG(G3D, "CreateGraphicsPipeline got passed a null shader"); return nullptr; } VkPipelineShaderStageCreateInfo &stage = stages[i++]; @@ -1100,7 +1100,7 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc) { VkPipeline pipelines[2]{}; VkResult result = vkCreateGraphicsPipelines(device_, pipelineCache_, 2, createInfo, nullptr, pipelines); if (result != VK_SUCCESS) { - ELOG("Failed to create graphics pipeline"); + ERROR_LOG(G3D, "Failed to create graphics pipeline"); delete pipeline; return nullptr; } @@ -1177,14 +1177,14 @@ Texture *VKContext::CreateTexture(const TextureDesc &desc) { VkCommandBuffer initCmd = renderManager_.GetInitCmd(); if (!push_ || !initCmd) { // Too early! Fail. - ELOG("Can't create textures before the first frame has started."); + ERROR_LOG(G3D, "Can't create textures before the first frame has started."); return nullptr; } VKTexture *tex = new VKTexture(vulkan_, initCmd, push_, desc); if (tex->Create(initCmd, push_, desc, allocator_)) { return tex; } else { - ELOG("Failed to create texture"); + ERROR_LOG(G3D, "Failed to create texture"); delete tex; return nullptr; } @@ -1271,7 +1271,7 @@ ShaderModule *VKContext::CreateShaderModule(ShaderStage stage, ShaderLanguage la if (shader->Compile(vulkan_, language, data, size)) { return shader; } else { - ELOG("Failed to compile shader: %s", (const char *)data); + ERROR_LOG(G3D, "Failed to compile shader: %s", (const char *)data); shader->Release(); return nullptr; } diff --git a/ext/native/thread/prioritizedworkqueue.cpp b/ext/native/thread/prioritizedworkqueue.cpp index 35a1e94a62..dcb233f38c 100644 --- a/ext/native/thread/prioritizedworkqueue.cpp +++ b/ext/native/thread/prioritizedworkqueue.cpp @@ -1,13 +1,14 @@ #include #include -#include "base/logging.h" #include "base/timeutil.h" #include "thread/prioritizedworkqueue.h" +#include "Common/Log.h" + PrioritizedWorkQueue::~PrioritizedWorkQueue() { if (!done_) { - ELOG("PrioritizedWorkQueue destroyed but not done!"); + ERROR_LOG(SYSTEM, "PrioritizedWorkQueue destroyed but not done!"); } } @@ -32,7 +33,7 @@ void PrioritizedWorkQueue::Flush() { } queue_.clear(); if (flush_count > 0) { - ILOG("PrioritizedWorkQueue: Flushed %d un-executed tasks", flush_count); + INFO_LOG(SYSTEM, "PrioritizedWorkQueue: Flushed %d un-executed tasks", flush_count); } } diff --git a/ext/native/thread/threadpool.cpp b/ext/native/thread/threadpool.cpp index a312748014..6f5a83d255 100644 --- a/ext/native/thread/threadpool.cpp +++ b/ext/native/thread/threadpool.cpp @@ -1,6 +1,7 @@ -#include "base/logging.h" #include "thread/threadpool.h" #include "thread/threadutil.h" + +#include "Common/Log.h" #include "Common/MakeUnique.h" ///////////////////////////// WorkerThread @@ -86,9 +87,9 @@ void LoopWorkerThread::WorkFunc() { ThreadPool::ThreadPool(int numThreads) { if (numThreads <= 0) { numThreads_ = 1; - ILOG("ThreadPool: Bad number of threads %i", numThreads); + INFO_LOG(JIT, "ThreadPool: Bad number of threads %d", numThreads); } else if (numThreads > 8) { - ILOG("ThreadPool: Capping number of threads to 8 (was %i)", numThreads); + INFO_LOG(JIT, "ThreadPool: Capping number of threads to 8 (was %d)", numThreads); numThreads_ = 8; } else { numThreads_ = numThreads; diff --git a/ext/native/thread/threadutil.cpp b/ext/native/thread/threadutil.cpp index 403f8cadd9..a47286b96f 100644 --- a/ext/native/thread/threadutil.cpp +++ b/ext/native/thread/threadutil.cpp @@ -8,10 +8,13 @@ #define TLS_SUPPORTED #endif +#include + #include "base/basictypes.h" -#include "base/logging.h" #include "thread/threadutil.h" +#include "Common/Log.h" + #if defined(__ANDROID__) || defined(__APPLE__) || (defined(__GLIBC__) && defined(_GNU_SOURCE)) #include #endif @@ -115,7 +118,7 @@ void setCurrentThreadName(const char* threadName) { void AssertCurrentThreadName(const char *threadName) { #ifdef TLS_SUPPORTED if (strcmp(curThreadName, threadName) != 0) { - ELOG("Thread name assert failed: Expected %s, was %s", threadName, curThreadName); + ERROR_LOG(SYSTEM, "Thread name assert failed: Expected %s, was %s", threadName, curThreadName); } #endif } diff --git a/ext/native/ui/root.cpp b/ext/native/ui/root.cpp index 460945204c..928d34dbfe 100644 --- a/ext/native/ui/root.cpp +++ b/ext/native/ui/root.cpp @@ -7,6 +7,8 @@ #include "ui/root.h" #include "ui/viewgroup.h" +#include "Common/Log.h" + namespace UI { static std::mutex focusLock; @@ -109,7 +111,7 @@ bool IsFocusMovementEnabled() { void LayoutViewHierarchy(const UIContext &dc, ViewGroup *root, bool ignoreInsets) { if (!root) { - ELOG("Tried to layout a view hierarchy from a zero pointer root"); + ERROR_LOG(SYSTEM, "Tried to layout a view hierarchy from a zero pointer root"); return; } @@ -358,7 +360,7 @@ void UpdateViewHierarchy(ViewGroup *root) { frameCount++; if (!root) { - ELOG("Tried to update a view hierarchy from a zero pointer root"); + ERROR_LOG(SYSTEM, "Tried to update a view hierarchy from a zero pointer root"); return; } diff --git a/ext/native/ui/screen.cpp b/ext/native/ui/screen.cpp index 3b99486d69..32a26196cc 100644 --- a/ext/native/ui/screen.cpp +++ b/ext/native/ui/screen.cpp @@ -1,5 +1,4 @@ #include "base/display.h" -#include "base/logging.h" #include "base/timeutil.h" #include "input/input_state.h" #include "ui/root.h" @@ -7,6 +6,8 @@ #include "ui/ui.h" #include "ui/view.h" +#include "Common/Log.h" + ScreenManager::ScreenManager() { uiContext_ = 0; dialogFinished_ = 0; @@ -18,7 +19,7 @@ ScreenManager::~ScreenManager() { void ScreenManager::switchScreen(Screen *screen) { if (!nextStack_.empty() && screen == nextStack_.front().screen) { - ELOG("Already switching to this screen"); + ERROR_LOG(SYSTEM, "Already switching to this screen"); return; } // Note that if a dialog is found, this will be a silent background switch that @@ -26,12 +27,12 @@ void ScreenManager::switchScreen(Screen *screen) { // until that switch. // TODO: is this still true? if (!nextStack_.empty()) { - ELOG("Already had a nextStack_! Asynchronous open while doing something? Deleting the new screen."); + ERROR_LOG(SYSTEM, "Already had a nextStack_! Asynchronous open while doing something? Deleting the new screen."); delete screen; return; } if (screen == nullptr) { - WLOG("Swiching to a zero screen, this can't be good"); + WARN_LOG(SYSTEM, "Switching to a zero screen, this can't be good"); } if (stack_.empty() || screen != stack_.back().screen) { screen->setScreenManager(this); @@ -53,7 +54,7 @@ void ScreenManager::update() { void ScreenManager::switchToNext() { std::lock_guard guard(inputLock_); if (nextStack_.empty()) { - ELOG("switchToNext: No nextStack_!"); + ERROR_LOG(SYSTEM, "switchToNext: No nextStack_!"); } Layer temp = {nullptr, 0}; @@ -128,7 +129,7 @@ void ScreenManager::deviceRestored() { } void ScreenManager::resized() { - ILOG("ScreenManager::resized(dp: %dx%d)", dp_xres, dp_yres); + INFO_LOG(SYSTEM, "ScreenManager::resized(dp: %dx%d)", dp_xres, dp_yres); std::lock_guard guard(inputLock_); // Have to notify the whole stack, otherwise there will be problems when going back // to non-top screens. @@ -143,7 +144,7 @@ void ScreenManager::render() { case LAYER_SIDEMENU: case LAYER_TRANSPARENT: if (stack_.size() == 1) { - ELOG("Can't have sidemenu over nothing"); + ERROR_LOG(SYSTEM, "Can't have sidemenu over nothing"); break; } else { auto iter = stack_.end(); @@ -170,7 +171,7 @@ void ScreenManager::render() { break; } } else { - ELOG("No current screen!"); + ERROR_LOG(SYSTEM, "No current screen!"); } processFinishDialog(); @@ -235,7 +236,7 @@ void ScreenManager::pop() { delete stack_.back().screen; stack_.pop_back(); } else { - ELOG("Can't pop when stack empty"); + ERROR_LOG(SYSTEM, "Can't pop when stack empty"); } } @@ -247,11 +248,11 @@ void ScreenManager::RecreateAllViews() { void ScreenManager::finishDialog(Screen *dialog, DialogResult result) { if (stack_.empty()) { - ELOG("Must be in a dialog to finishDialog"); + ERROR_LOG(SYSTEM, "Must be in a dialog to finishDialog"); return; } if (dialog != stack_.back().screen) { - ELOG("Wrong dialog being finished!"); + ERROR_LOG(SYSTEM, "Wrong dialog being finished!"); return; } dialog->onFinish(result); @@ -283,10 +284,10 @@ void ScreenManager::processFinishDialog() { } if (!caller) { - ELOG("ERROR: no top screen when finishing dialog"); + ERROR_LOG(SYSTEM, "ERROR: no top screen when finishing dialog"); } else if (caller != topScreen()) { // The caller may get confused if we call dialogFinished() now. - WLOG("Skipping non-top dialog when finishing dialog."); + WARN_LOG(SYSTEM, "Skipping non-top dialog when finishing dialog."); } else { caller->dialogFinished(dialogFinished_, dialogResult_); } diff --git a/ext/native/ui/ui_context.cpp b/ext/native/ui/ui_context.cpp index 22cc79c24b..c1dbfd4729 100644 --- a/ext/native/ui/ui_context.cpp +++ b/ext/native/ui/ui_context.cpp @@ -4,7 +4,6 @@ #include "base/display.h" #include "base/NativeApp.h" -#include "base/logging.h" #include "ui/ui.h" #include "ui/view.h" #include "ui/ui_context.h" diff --git a/ext/native/ui/ui_screen.cpp b/ext/native/ui/ui_screen.cpp index 180e271aae..ca36957b62 100644 --- a/ext/native/ui/ui_screen.cpp +++ b/ext/native/ui/ui_screen.cpp @@ -1,6 +1,7 @@ #include #include #include + #include "base/display.h" #include "base/stringutil.h" #include "input/input_state.h" @@ -13,6 +14,8 @@ #include "i18n/i18n.h" #include "gfx_es2/draw_buffer.h" +#include "Common/Log.h" + static const bool ClickDebug = false; UIScreen::UIScreen() @@ -137,11 +140,11 @@ TouchInput UIScreen::transformTouch(const TouchInput &touch) { bool UIScreen::touch(const TouchInput &touch) { if (root_) { if (ClickDebug && (touch.flags & TOUCH_DOWN)) { - ILOG("Touch down!"); + INFO_LOG(SYSTEM, "Touch down!"); std::vector views; root_->Query(touch.x, touch.y, views); for (auto view : views) { - ILOG("%s", view->Describe().c_str()); + INFO_LOG(SYSTEM, "%s", view->Describe().c_str()); } } @@ -166,7 +169,7 @@ bool UIDialogScreen::key(const KeyInput &key) { bool retval = UIScreen::key(key); if (!retval && (key.flags & KEY_DOWN) && UI::IsEscapeKey(key)) { if (finished_) { - ELOG("Screen already finished"); + ERROR_LOG(SYSTEM, "Screen already finished"); } else { finished_ = true; TriggerFinish(DR_BACK); diff --git a/ext/native/ui/viewgroup.cpp b/ext/native/ui/viewgroup.cpp index 82a74faad8..cf96bc8db3 100644 --- a/ext/native/ui/viewgroup.cpp +++ b/ext/native/ui/viewgroup.cpp @@ -2,7 +2,6 @@ #include #include -#include "base/logging.h" #include "base/stringutil.h" #include "base/timeutil.h" #include "input/keycodes.h" @@ -14,6 +13,8 @@ #include "ui/viewgroup.h" #include "gfx_es2/draw_buffer.h" +#include "Common/Log.h" + #include namespace UI { @@ -236,7 +237,7 @@ float GetDirectionScore(View *origin, View *destination, FocusDirection directio float horizOverlap = HorizontalOverlap(origin->GetBounds(), destination->GetBounds()); float vertOverlap = VerticalOverlap(origin->GetBounds(), destination->GetBounds()); if (horizOverlap == 1.0f && vertOverlap == 1.0f) { - ILOG("Contain overlap"); + INFO_LOG(SYSTEM, "Contain overlap"); return 0.0; } float originSize = 0.0f; @@ -273,7 +274,7 @@ float GetDirectionScore(View *origin, View *destination, FocusDirection directio break; case FOCUS_PREV: case FOCUS_NEXT: - ELOG("Invalid focus direction"); + ERROR_LOG(SYSTEM, "Invalid focus direction"); break; } @@ -1083,7 +1084,7 @@ void AnchorLayout::Layout() { GridLayout::GridLayout(GridLayoutSettings settings, LayoutParams *layoutParams) : ViewGroup(layoutParams), settings_(settings), numColumns_(1) { if (settings.orientation != ORIENT_HORIZONTAL) - ELOG("GridLayout: Vertical layouts not yet supported"); + ERROR_LOG(SYSTEM, "GridLayout: Vertical layouts not yet supported"); } void GridLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) { diff --git a/headless/WindowsHeadlessHost.cpp b/headless/WindowsHeadlessHost.cpp index 30a9f1b7b2..d52dfc4053 100644 --- a/headless/WindowsHeadlessHost.cpp +++ b/headless/WindowsHeadlessHost.cpp @@ -17,8 +17,10 @@ #include +#include "base/logging.h" // For OutputDebugStringUTF8 #include "headless/WindowsHeadlessHost.h" +#include "Common/Log.h" #include "Common/FileUtil.h" #include "Common/CommonWindows.h" From cca7511e6a98495bf8c83946f6030c9d2bbeeef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 16:17:08 +0200 Subject: [PATCH 09/15] More base/logging.h cleanup --- Common/GL/GLInterface/EGL.cpp | 3 +-- Common/GL/GLInterface/EGL.h | 12 +----------- ext/native/tools/atlastool.cpp | 20 ++++++++++---------- ext/native/tools/zimtool.cpp | 1 - 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/Common/GL/GLInterface/EGL.cpp b/Common/GL/GLInterface/EGL.cpp index fb215af598..5f3c782f2c 100644 --- a/Common/GL/GLInterface/EGL.cpp +++ b/Common/GL/GLInterface/EGL.cpp @@ -5,9 +5,8 @@ #include #include -#include "Common/GL/GLInterface/EGL.h" - #include "Common/Log.h" +#include "Common/GL/GLInterface/EGL.h" // Show the current FPS void cInterfaceEGL::Swap() { diff --git a/Common/GL/GLInterface/EGL.h b/Common/GL/GLInterface/EGL.h index 65169b91da..e9d789748c 100644 --- a/Common/GL/GLInterface/EGL.h +++ b/Common/GL/GLInterface/EGL.h @@ -7,22 +7,12 @@ #include #include +#include "Common/Log.h" #include "Common/GL/GLInterfaceBase.h" -#ifdef __ANDROID__ -// On Android, EGL creation is so early that our regular logging system is not -// up and running yet. Use Android logging. -#include "base/logging.h" -#define EGL_ILOG(...) ILOG(__VA_ARGS__) -#define EGL_ELOG(...) ELOG(__VA_ARGS__) - -#else - #define EGL_ILOG(...) INFO_LOG(G3D, __VA_ARGS__) #define EGL_ELOG(...) INFO_LOG(G3D, __VA_ARGS__) -#endif - class cInterfaceEGL : public cInterfaceBase { public: diff --git a/ext/native/tools/atlastool.cpp b/ext/native/tools/atlastool.cpp index 86581c7f34..05c111f59f 100644 --- a/ext/native/tools/atlastool.cpp +++ b/ext/native/tools/atlastool.cpp @@ -18,6 +18,7 @@ // line height // dist-per-pixel +#include #include #include #include @@ -28,7 +29,6 @@ #include #include -#include "base/logging.h" #include "gfx/texture_atlas.h" #include "image/png_load.h" @@ -109,8 +109,8 @@ struct Image { return (int)dat.size(); } void copyfrom(const Image &img, int ox, int oy, Effect effect) { - CHECK(img.dat[0].size() + ox <= dat[0].size()); - CHECK(img.dat.size() + oy <= dat.size()); + assert(img.dat[0].size() + ox <= dat[0].size()); + assert(img.dat.size() + oy <= dat.size()); for (int y = 0; y < (int)img.dat.size(); y++) { for (int x = 0; x < (int)img.dat[y].size(); x++) { switch (effect) { @@ -171,9 +171,9 @@ struct Image { png_structp png_ptr; png_infop info_ptr; png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - CHECK(png_ptr); + assert(png_ptr); info_ptr = png_create_info_struct(png_ptr); - CHECK(info_ptr); + assert(info_ptr); png_init_io(png_ptr, fil); //png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); png_set_IHDR(png_ptr, info_ptr, (uint32_t)dat[0].size(), (uint32_t)dat.size(), 8, PNG_COLOR_TYPE_RGBA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); @@ -248,7 +248,7 @@ struct Bucket { int idx = (int)items[i].first.dat[0].size(); int idy = (int)items[i].first.dat.size(); if (idx > 1 && idy > 1) { - CHECK(idx <= image_width); + assert(idx <= image_width); for (int ty = 0; ty < 2047; ty++) { if (ty + idy + 1 > (int)dest.dat.size()) { masq.resize(image_width, ty + idy + 16); @@ -355,7 +355,7 @@ inline vector merge(const vector &a, const vector &ranges, float *metrics_height, Bucket *bucket) { FT_Library freetype; - CHECK(FT_Init_FreeType(&freetype) == 0); + assert(FT_Init_FreeType(&freetype) == 0); vector fonts; fonts.resize(fontRefs.size()); @@ -374,7 +374,7 @@ void RasterizeFonts(const FontReferenceList &fontRefs, vector &ranges } printf("TTF info: %d glyphs, %08x flags, %d units, %d strikes\n", (int)font->num_glyphs, (int)font->face_flags, (int)font->units_per_EM, (int)font->num_fixed_sizes); - CHECK(FT_Set_Pixel_Sizes(font, 0, fontRefs[i].size_ * supersample) == 0); + assert(FT_Set_Pixel_Sizes(font, 0, fontRefs[i].size_ * supersample) == 0); ranges = merge(ranges, fontRefs[i].ranges_); for (size_t r = 0, rn = fontRefs[i].ranges_.size(); r < rn; ++r) { @@ -858,10 +858,10 @@ int main(int argc, char **argv) { // /usr/share/fonts/truetype/msttcorefonts/Arial_Black.ttf // /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf if (argc < 3) { - FLOG("Not enough arguments"); + printf("Not enough arguments"); return 1; } - CHECK(argc >= 3); + assert(argc >= 3); if (argc > 3) { if (!strcmp(argv[3], "8888")) { highcolor = true; diff --git a/ext/native/tools/zimtool.cpp b/ext/native/tools/zimtool.cpp index 3692881643..7fadb4218b 100644 --- a/ext/native/tools/zimtool.cpp +++ b/ext/native/tools/zimtool.cpp @@ -2,7 +2,6 @@ #include #include -#include "base/logging.h" #include "image/png_load.h" #include "image/zim_save.h" From b22083e7a6ae04a6612fb35ca582293d53e1ca9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 16:21:30 +0200 Subject: [PATCH 10/15] Even more base/logging.h removal and fixes --- Common/Log.h | 3 +++ Common/LogManager.cpp | 22 +++++++++++++++++++++- Core/Debugger/WebSocket/WebSocketUtils.h | 2 +- GPU/Directx9/ShaderManagerDX9.cpp | 1 - GPU/Directx9/StencilBufferDX9.cpp | 1 - GPU/Vulkan/VulkanUtil.cpp | 2 -- SDL/SDLMain.cpp | 2 +- ext/native/base/logging.h | 3 --- ext/native/base/stringutil.cpp | 21 --------------------- ext/native/json/json_reader.h | 2 +- ext/native/thin3d/GLQueueRunner.cpp | 20 +++++++++----------- headless/WindowsHeadlessHost.cpp | 3 +-- 12 files changed, 37 insertions(+), 45 deletions(-) diff --git a/Common/Log.h b/Common/Log.h index 481795bde2..8dc232319c 100644 --- a/Common/Log.h +++ b/Common/Log.h @@ -189,3 +189,6 @@ void AndroidAssertLog(const char *func, const char *file, int line, const char * } #endif // __ANDROID__ + +// Just INFO_LOGs on nonWindows. On Windows it outputs to the VS output console. +void OutputDebugStringUTF8(const char *p); diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index f16971c70c..3c4de05878 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -19,7 +19,6 @@ #include -#include "base/logging.h" #include "util/text/utf8.h" #include "LogManager.h" #include "ConsoleListener.h" @@ -325,3 +324,24 @@ void RingbufferLogListener::Log(const LogMessage &message) { curMessage_ -= MAX_LOGS; count_++; } + +#ifdef _WIN32 + +void OutputDebugStringUTF8(const char *p) { + wchar_t temp[4096]; + + int len = std::min(4095, (int)strlen(p)); + int size = (int)MultiByteToWideChar(CP_UTF8, 0, p, len, NULL, 0); + MultiByteToWideChar(CP_UTF8, 0, p, len, temp, size); + temp[size] = 0; + + OutputDebugString(temp); +} + +#else + +void OutputDebugStringUTF8(const char *p) { + INFO_LOG(SYSTEM, "%s", p); +} + +#endif diff --git a/Core/Debugger/WebSocket/WebSocketUtils.h b/Core/Debugger/WebSocket/WebSocketUtils.h index 93110db6a0..0da36402c9 100644 --- a/Core/Debugger/WebSocket/WebSocketUtils.h +++ b/Core/Debugger/WebSocket/WebSocketUtils.h @@ -56,7 +56,7 @@ struct DebuggerErrorEvent { LogTypes::LOG_LEVELS level; std::string ticketRaw; - operator std::string() { + operator std::string() const { JsonWriter j; j.begin(); j.writeString("event", "error"); diff --git a/GPU/Directx9/ShaderManagerDX9.cpp b/GPU/Directx9/ShaderManagerDX9.cpp index 15cb7777e8..fd64cb4570 100644 --- a/GPU/Directx9/ShaderManagerDX9.cpp +++ b/GPU/Directx9/ShaderManagerDX9.cpp @@ -23,7 +23,6 @@ #include #include "gfx/d3d9_shader.h" -#include "base/logging.h" // For OutputDebugStringUTF8 #include "base/stringutil.h" #include "i18n/i18n.h" #include "math/lin/matrix4x4.h" diff --git a/GPU/Directx9/StencilBufferDX9.cpp b/GPU/Directx9/StencilBufferDX9.cpp index 722a43b31f..4310a1654e 100644 --- a/GPU/Directx9/StencilBufferDX9.cpp +++ b/GPU/Directx9/StencilBufferDX9.cpp @@ -17,7 +17,6 @@ #include -#include "base/logging.h" // For OutputDebugStringUTF8 #include "gfx/d3d9_state.h" #include "ext/native/thin3d/thin3d.h" #include "Core/Reporting.h" diff --git a/GPU/Vulkan/VulkanUtil.cpp b/GPU/Vulkan/VulkanUtil.cpp index 3d5d196e94..0e653be2b1 100644 --- a/GPU/Vulkan/VulkanUtil.cpp +++ b/GPU/Vulkan/VulkanUtil.cpp @@ -15,8 +15,6 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "base/logging.h" // For OutputDebugStringUTF8. TODO: Move it. - #include "base/basictypes.h" #include "base/stringutil.h" #include "Common/Log.h" diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 9bacb7de9f..f385475e66 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -22,7 +22,7 @@ SDLJoystick *joystick = NULL; #include #include "base/display.h" -#include "base/logging.h" +#include "base/logging.h" // early logging. TODO: Remove. #include "base/timeutil.h" #include "ext/glslang/glslang/Public/ShaderLang.h" #include "image/png_load.h" diff --git a/ext/native/base/logging.h b/ext/native/base/logging.h index 3a22a428fc..c364b8f406 100644 --- a/ext/native/base/logging.h +++ b/ext/native/base/logging.h @@ -46,9 +46,6 @@ inline void Crash() { #endif -// Just ILOGs on nonWindows. On Windows it outputs to the VS output console. -void OutputDebugStringUTF8(const char *p); - #if defined(__ANDROID__) #include diff --git a/ext/native/base/stringutil.cpp b/ext/native/base/stringutil.cpp index ce2e1094fb..adcd94b20a 100644 --- a/ext/native/base/stringutil.cpp +++ b/ext/native/base/stringutil.cpp @@ -21,27 +21,6 @@ #include "base/buffer.h" #include "base/stringutil.h" -#ifdef _WIN32 - -void OutputDebugStringUTF8(const char *p) { - wchar_t temp[4096]; - - int len = std::min(4095, (int)strlen(p)); - int size = (int)MultiByteToWideChar(CP_UTF8, 0, p, len, NULL, 0); - MultiByteToWideChar(CP_UTF8, 0, p, len, temp, size); - temp[size] = 0; - - OutputDebugString(temp); -} - -#else - -void OutputDebugStringUTF8(const char *p) { - INFO_LOG(SYSTEM, "%s", p); -} - -#endif - std::string LineNumberString(const std::string &str) { std::stringstream input(str); std::stringstream output; diff --git a/ext/native/json/json_reader.h b/ext/native/json/json_reader.h index 472a19140d..612a7f9d2f 100644 --- a/ext/native/json/json_reader.h +++ b/ext/native/json/json_reader.h @@ -1,9 +1,9 @@ +#include #include #include #include "base/basictypes.h" #include "ext/gason/gason.h" - #include "Common/Log.h" namespace json { diff --git a/ext/native/thin3d/GLQueueRunner.cpp b/ext/native/thin3d/GLQueueRunner.cpp index 72ca079602..49698384bd 100644 --- a/ext/native/thin3d/GLQueueRunner.cpp +++ b/ext/native/thin3d/GLQueueRunner.cpp @@ -1,7 +1,5 @@ #include -#include "base/logging.h" // For OutputDebugStringUTF8 - #include "base/stringutil.h" #include "gfx/gl_common.h" #include "gfx/gl_debug_log.h" @@ -443,7 +441,7 @@ void GLQueueRunner::InitCreateFramebuffer(const GLRInitStep &step) { retry_depth: if (!fbo->z_stencil_) { - ILOG("Creating %i x %i FBO using no depth", fbo->width, fbo->height); + INFO_LOG(G3D, "Creating %d x %d FBO using no depth", fbo->width, fbo->height); fbo->z_stencil_buffer = 0; fbo->stencil_buffer = 0; @@ -456,7 +454,7 @@ retry_depth: glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); } else if (gl_extensions.IsGLES) { if (gl_extensions.OES_packed_depth_stencil && (gl_extensions.OES_depth_texture || gl_extensions.GLES3)) { - ILOG("Creating %i x %i FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height); + INFO_LOG(G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height); fbo->z_stencil_buffer = 0; fbo->stencil_buffer = 0; fbo->z_buffer = 0; @@ -477,7 +475,7 @@ retry_depth: glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, fbo->z_stencil_texture.texture, 0); } } else if (gl_extensions.OES_packed_depth_stencil) { - ILOG("Creating %i x %i FBO using DEPTH24_STENCIL8", fbo->width, fbo->height); + INFO_LOG(G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8", fbo->width, fbo->height); // Standard method fbo->stencil_buffer = 0; fbo->z_buffer = 0; @@ -492,7 +490,7 @@ retry_depth: glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fbo->z_stencil_buffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo->z_stencil_buffer); } else { - ILOG("Creating %i x %i FBO using separate stencil", fbo->width, fbo->height); + INFO_LOG(G3D, "Creating %d x %d FBO using separate stencil", fbo->width, fbo->height); // TEGRA fbo->z_stencil_buffer = 0; // 16/24-bit Z, separate 8-bit stencil @@ -513,7 +511,7 @@ retry_depth: glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo->stencil_buffer); } } else if (gl_extensions.VersionGEThan(3, 0)) { - ILOG("Creating %i x %i FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height); + INFO_LOG(G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height); fbo->z_stencil_buffer = 0; fbo->stencil_buffer = 0; fbo->z_buffer = 0; @@ -549,7 +547,7 @@ retry_depth: switch (status) { case GL_FRAMEBUFFER_COMPLETE: - // ILOG("Framebuffer verified complete."); + // INFO_LOG(G3D, "Framebuffer verified complete."); break; case GL_FRAMEBUFFER_UNSUPPORTED: ERROR_LOG(G3D, "GL_FRAMEBUFFER_UNSUPPORTED"); @@ -558,7 +556,7 @@ retry_depth: ERROR_LOG(G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"); break; default: - FLOG("Other framebuffer error: %i", status); + _assert_msg_(false, "Other framebuffer error: %d", status); break; } @@ -1568,7 +1566,7 @@ void GLQueueRunner::fbo_ext_create(const GLRInitStep &step) { GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); switch (status) { case GL_FRAMEBUFFER_COMPLETE_EXT: - // ILOG("Framebuffer verified complete."); + // INFO_LOG(G3D, "Framebuffer verified complete."); break; case GL_FRAMEBUFFER_UNSUPPORTED_EXT: ERROR_LOG(G3D, "GL_FRAMEBUFFER_UNSUPPORTED"); @@ -1577,7 +1575,7 @@ void GLQueueRunner::fbo_ext_create(const GLRInitStep &step) { ERROR_LOG(G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT "); break; default: - FLOG("Other framebuffer error: %i", status); + _assert_msg_(false, "Other framebuffer error: %d", status); break; } // Unbind state we don't need diff --git a/headless/WindowsHeadlessHost.cpp b/headless/WindowsHeadlessHost.cpp index d52dfc4053..18b90d72bf 100644 --- a/headless/WindowsHeadlessHost.cpp +++ b/headless/WindowsHeadlessHost.cpp @@ -15,9 +15,8 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include +#include -#include "base/logging.h" // For OutputDebugStringUTF8 #include "headless/WindowsHeadlessHost.h" #include "Common/Log.h" From 80e0f85332076c187b80d41fa8a640f5a9bc4309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 16:25:50 +0200 Subject: [PATCH 11/15] Getting really close to getting rid of base/logging.h now. Qt buildfix --- Common/FakeCPUDetect.cpp | 1 - Common/LogManager.cpp | 4 ++ Common/XboxCPUDetect.cpp | 68 ---------------------------- Core/MIPS/fake/FakeJit.cpp | 1 - GPU/Common/VertexDecoderFake.cpp | 1 - Qt/QtMain.cpp | 30 ++++++------ SDL/SDLGLGraphicsContext.cpp | 2 +- SDL/SDLMain.cpp | 31 ++++++------- UI/NativeApp.cpp | 38 ++++++++-------- UWP/PPSSPP_UWPMain.cpp | 4 +- UWP/StorageFileLoader.cpp | 8 ++-- android/jni/Arm64EmitterTest.cpp | 25 +++++----- android/jni/ArmEmitterTest.cpp | 23 +++++----- android/jni/TestRunner.cpp | 18 ++++---- ext/native/base/logging.cpp | 2 +- ext/native/file/zip_read.cpp | 6 +-- ext/native/gfx_es2/draw_text_qt.cpp | 2 +- ext/native/gfx_es2/draw_text_uwp.cpp | 8 ++-- ext/native/tools/audiotool.cpp | 17 ------- ios/ViewController.mm | 7 +-- unittest/UnitTest.cpp | 16 +++---- 21 files changed, 113 insertions(+), 199 deletions(-) delete mode 100644 Common/XboxCPUDetect.cpp delete mode 100644 ext/native/tools/audiotool.cpp diff --git a/Common/FakeCPUDetect.cpp b/Common/FakeCPUDetect.cpp index 41251b698a..d314afe773 100644 --- a/Common/FakeCPUDetect.cpp +++ b/Common/FakeCPUDetect.cpp @@ -17,7 +17,6 @@ #include -#include "base/logging.h" #include "base/basictypes.h" #include "Common.h" #include "CPUDetect.h" diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index 3c4de05878..c1eef5d2fb 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -18,6 +18,7 @@ #include "ppsspp_config.h" #include +#include #include "util/text/utf8.h" #include "LogManager.h" @@ -46,6 +47,9 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char LogManager *instance = LogManager::GetInstance(); if (instance) { instance->Log(level, type, file, line, fmt, args); + } else { + // Fall back to printf if we're before the log manager has been initialized. + vprintf(fmt, args); } va_end(args); } diff --git a/Common/XboxCPUDetect.cpp b/Common/XboxCPUDetect.cpp deleted file mode 100644 index b9b502a71a..0000000000 --- a/Common/XboxCPUDetect.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (C) 2003 Dolphin Project. - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, version 2.0. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - - -#include -#include "base/logging.h" -#include "base/basictypes.h" -#include "Common.h" -#include "CPUDetect.h" -#include "StringUtils.h" - -CPUInfo cpu_info; - -CPUInfo::CPUInfo() { - Detect(); -} - -// Detects the various cpu features -void CPUInfo::Detect() -{ - memset(this, 0, sizeof(*this)); - num_cores = 3; - strcpy(cpu_string, "Xenon"); - strcpy(brand_string, "Microsoft"); - - memset(cpu_string, 0, sizeof(cpu_string)); - - HTT = true; - logical_cpu_count = 2; -} - -// Turn the cpu info into a string we can show -std::string CPUInfo::Summarize() -{ - std::string sum; - if (num_cores == 1) - sum = StringFromFormat("%s, %i core", cpu_string, num_cores); - else - { - sum = StringFromFormat("%s, %i cores", cpu_string, num_cores); - if (HTT) sum += StringFromFormat(" (%i logical threads per physical core)", logical_cpu_count); - } - if (bSSE) sum += ", SSE"; - if (bSSE2) sum += ", SSE2"; - if (bSSE3) sum += ", SSE3"; - if (bSSSE3) sum += ", SSSE3"; - if (bSSE4_1) sum += ", SSE4.1"; - if (bSSE4_2) sum += ", SSE4.2"; - if (HTT) sum += ", HTT"; - if (bAVX) sum += ", AVX"; - if (bAES) sum += ", AES"; - if (bLongMode) sum += ", 64-bit support"; - return sum; -} \ No newline at end of file diff --git a/Core/MIPS/fake/FakeJit.cpp b/Core/MIPS/fake/FakeJit.cpp index 25e085c0ed..257005a429 100644 --- a/Core/MIPS/fake/FakeJit.cpp +++ b/Core/MIPS/fake/FakeJit.cpp @@ -15,7 +15,6 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -#include "base/logging.h" #include "Common/Serialize/Serializer.h" #include "Core/Reporting.h" #include "Core/Config.h" diff --git a/GPU/Common/VertexDecoderFake.cpp b/GPU/Common/VertexDecoderFake.cpp index 1619b2ba0f..af27e69561 100644 --- a/GPU/Common/VertexDecoderFake.cpp +++ b/GPU/Common/VertexDecoderFake.cpp @@ -18,7 +18,6 @@ //TODO: Doesn't build, FIXME! #if 0 -#include "base/logging.h" #include "Common/CPUDetect.h" #include "Core/Config.h" #include "Core/Reporting.h" diff --git a/Qt/QtMain.cpp b/Qt/QtMain.cpp index 7f9726b417..2ba3a2e630 100644 --- a/Qt/QtMain.cpp +++ b/Qt/QtMain.cpp @@ -71,23 +71,23 @@ static void InitSDLAudioDevice() { if (!g_Config.sAudioDevice.empty()) { audioDev = SDL_OpenAudioDevice(g_Config.sAudioDevice.c_str(), 0, &fmt, &g_retFmt, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE); if (audioDev <= 0) { - WLOG("Failed to open preferred audio device %s", g_Config.sAudioDevice.c_str()); + WARN_LOG(AUDIO, "Failed to open preferred audio device %s", g_Config.sAudioDevice.c_str()); } } if (audioDev <= 0) { audioDev = SDL_OpenAudioDevice(nullptr, 0, &fmt, &g_retFmt, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE); } if (audioDev <= 0) { - ELOG("Failed to open audio: %s", SDL_GetError()); + ERROR_LOG(AUDIO, "Failed to open audio: %s", SDL_GetError()); } else { if (g_retFmt.samples != fmt.samples) // Notify, but still use it - ELOG("Output audio samples: %d (requested: %d)", g_retFmt.samples, fmt.samples); + ERROR_LOG(AUDIO, "Output audio samples: %d (requested: %d)", g_retFmt.samples, fmt.samples); if (g_retFmt.format != fmt.format || g_retFmt.channels != fmt.channels) { - ELOG("Sound buffer format does not match requested format."); - ELOG("Output audio freq: %d (requested: %d)", g_retFmt.freq, fmt.freq); - ELOG("Output audio format: %d (requested: %d)", g_retFmt.format, fmt.format); - ELOG("Output audio channels: %d (requested: %d)", g_retFmt.channels, fmt.channels); - ELOG("Provided output format does not match requirement, turning audio off"); + ERROR_LOG(AUDIO, "Sound buffer format does not match requested format."); + ERROR_LOG(AUDIO, "Output audio freq: %d (requested: %d)", g_retFmt.freq, fmt.freq); + ERROR_LOG(AUDIO, "Output audio format: %d (requested: %d)", g_retFmt.format, fmt.format); + ERROR_LOG(AUDIO, "Output audio channels: %d (requested: %d)", g_retFmt.channels, fmt.channels); + ERROR_LOG(AUDIO, "Provided output format does not match requirement, turning audio off"); SDL_CloseAudioDevice(audioDev); } SDL_PauseAudioDevice(audioDev, 0); @@ -343,9 +343,9 @@ MainUI::MainUI(QWidget *parent) } MainUI::~MainUI() { - ILOG("MainUI::Destructor"); + INFO_LOG(SYSTEM, "MainUI::Destructor"); if (emuThreadState != (int)EmuThreadState::DISABLED) { - ILOG("EmuThreadStop"); + INFO_LOG(SYSTEM, "EmuThreadStop"); EmuThreadStop(); while (graphicsContext->ThreadFrame()) { // Need to keep eating frames to allow the EmuThread to exit correctly. @@ -525,7 +525,7 @@ bool MainUI::event(QEvent *e) { void MainUI::initializeGL() { if (g_Config.iGPUBackend != (int)GPUBackend::OPENGL) { - ILOG("Only GL supported under Qt - switching."); + INFO_LOG(SYSTEM, "Only GL supported under Qt - switching."); g_Config.iGPUBackend = (int)GPUBackend::OPENGL; } @@ -545,12 +545,12 @@ void MainUI::initializeGL() { #endif if (g_Config.iGPUBackend == (int)GPUBackend::OPENGL) { // OpenGL uses a background thread to do the main processing and only renders on the gl thread. - ILOG("Initializing GL graphics context"); + INFO_LOG(SYSTEM, "Initializing GL graphics context"); graphicsContext = new QtGLGraphicsContext(); - ILOG("Using thread, starting emu thread"); + INFO_LOG(SYSTEM, "Using thread, starting emu thread"); EmuThreadStart(); } else { - ILOG("Not using thread, backend=%d", (int)g_Config.iGPUBackend); + INFO_LOG(SYSTEM, "Not using thread, backend=%d", (int)g_Config.iGPUBackend); } graphicsContext->ThreadStart(); } @@ -714,7 +714,7 @@ int main(int argc, char *argv[]) g_Config.iGPUBackend = (int)GPUBackend::OPENGL; int ret = mainInternal(a); - ILOG("Left mainInternal here."); + INFO_LOG(SYSTEM, "Left mainInternal here."); #ifdef SDL if (audioDev > 0) { diff --git a/SDL/SDLGLGraphicsContext.cpp b/SDL/SDLGLGraphicsContext.cpp index 772f5c764f..e99c15ed75 100644 --- a/SDL/SDLGLGraphicsContext.cpp +++ b/SDL/SDLGLGraphicsContext.cpp @@ -425,7 +425,7 @@ int SDLGLGraphicsContext::Init(SDL_Window *&window, int x, int y, int mode, std: }); renderManager_->SetSwapIntervalFunction([&](int interval) { - ILOG("SDL SwapInterval: %d", interval); + INFO_LOG(G3D, "SDL SwapInterval: %d", interval); SDL_GL_SetSwapInterval(interval); }); window_ = window; diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index f385475e66..6c882b5681 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -22,7 +22,6 @@ SDLJoystick *joystick = NULL; #include #include "base/display.h" -#include "base/logging.h" // early logging. TODO: Remove. #include "base/timeutil.h" #include "ext/glslang/glslang/Public/ShaderLang.h" #include "image/png_load.h" @@ -110,24 +109,24 @@ static void InitSDLAudioDevice(const std::string &name = "") { if (!startDevice.empty()) { audioDev = SDL_OpenAudioDevice(startDevice.c_str(), 0, &fmt, &g_retFmt, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE); if (audioDev <= 0) { - WLOG("Failed to open audio device: %s", startDevice.c_str()); + WARN_LOG(AUDIO, "Failed to open audio device: %s", startDevice.c_str()); } } if (audioDev <= 0) { - ILOG("SDL: Trying a different audio device"); + INFO_LOG(AUDIO, "SDL: Trying a different audio device"); audioDev = SDL_OpenAudioDevice(nullptr, 0, &fmt, &g_retFmt, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE); } if (audioDev <= 0) { - ELOG("Failed to open audio device: %s", SDL_GetError()); + ERROR_LOG(AUDIO, "Failed to open audio device: %s", SDL_GetError()); } else { if (g_retFmt.samples != fmt.samples) // Notify, but still use it - ELOG("Output audio samples: %d (requested: %d)", g_retFmt.samples, fmt.samples); + ERROR_LOG(AUDIO, "Output audio samples: %d (requested: %d)", g_retFmt.samples, fmt.samples); if (g_retFmt.format != fmt.format || g_retFmt.channels != fmt.channels) { - ELOG("Sound buffer format does not match requested format."); - ELOG("Output audio freq: %d (requested: %d)", g_retFmt.freq, fmt.freq); - ELOG("Output audio format: %d (requested: %d)", g_retFmt.format, fmt.format); - ELOG("Output audio channels: %d (requested: %d)", g_retFmt.channels, fmt.channels); - ELOG("Provided output format does not match requirement, turning audio off"); + ERROR_LOG(AUDIO, "Sound buffer format does not match requested format."); + ERROR_LOG(AUDIO, "Output audio freq: %d (requested: %d)", g_retFmt.freq, fmt.freq); + ERROR_LOG(AUDIO, "Output audio format: %d (requested: %d)", g_retFmt.format, fmt.format); + ERROR_LOG(AUDIO, "Output audio channels: %d (requested: %d)", g_retFmt.channels, fmt.channels); + ERROR_LOG(AUDIO, "Provided output format does not match requirement, turning audio off"); SDL_CloseAudioDevice(audioDev); } SDL_PauseAudioDevice(audioDev, 0); @@ -206,7 +205,7 @@ void LaunchBrowser(const char *url) { webWifiCreate(&conf, NULL, url, uuid, 0); webWifiShow(&conf, NULL); #elif defined(MOBILE_DEVICE) - ILOG("Would have gone to %s but LaunchBrowser is not implemented on this platform", url); + INFO_LOG(SYSTEM, "Would have gone to %s but LaunchBrowser is not implemented on this platform", url); #elif defined(_WIN32) std::wstring wurl = ConvertUTF8ToWString(url); ShellExecute(NULL, L"open", wurl.c_str(), NULL, NULL, SW_SHOWNORMAL); @@ -217,7 +216,7 @@ void LaunchBrowser(const char *url) { std::string command = std::string("xdg-open ") + url; int err = system(command.c_str()); if (err) { - ILOG("Would have gone to %s but xdg-utils seems not to be installed", url) + INFO_LOG(SYSTEM, "Would have gone to %s but xdg-utils seems not to be installed", url); } #endif } @@ -229,7 +228,7 @@ void LaunchMarket(const char *url) { webWifiCreate(&conf, NULL, url, uuid, 0); webWifiShow(&conf, NULL); #elif defined(MOBILE_DEVICE) - ILOG("Would have gone to %s but LaunchMarket is not implemented on this platform", url); + INFO_LOG(SYSTEM, "Would have gone to %s but LaunchMarket is not implemented on this platform", url); #elif defined(_WIN32) std::wstring wurl = ConvertUTF8ToWString(url); ShellExecute(NULL, L"open", wurl.c_str(), NULL, NULL, SW_SHOWNORMAL); @@ -240,14 +239,14 @@ void LaunchMarket(const char *url) { std::string command = std::string("xdg-open ") + url; int err = system(command.c_str()); if (err) { - ILOG("Would have gone to %s but xdg-utils seems not to be installed", url) + INFO_LOG(SYSTEM, "Would have gone to %s but xdg-utils seems not to be installed", url); } #endif } void LaunchEmail(const char *email_address) { #if defined(MOBILE_DEVICE) - ILOG("Would have opened your email client for %s but LaunchEmail is not implemented on this platform", email_address); + INFO_LOG(SYSTEM, "Would have opened your email client for %s but LaunchEmail is not implemented on this platform", email_address); #elif defined(_WIN32) std::wstring mailto = std::wstring(L"mailto:") + ConvertUTF8ToWString(email_address); ShellExecute(NULL, L"open", mailto.c_str(), NULL, NULL, SW_SHOWNORMAL); @@ -258,7 +257,7 @@ void LaunchEmail(const char *email_address) { std::string command = std::string("xdg-email ") + email_address; int err = system(command.c_str()); if (err) { - ILOG("Would have gone to %s but xdg-utils seems not to be installed", email_address) + INFO_LOG(SYSTEM, "Would have gone to %s but xdg-utils seems not to be installed", email_address); } #endif } diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 919d7ce2f6..4c3559d030 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -237,7 +237,7 @@ void QtHost::ShutdownSound() { } std::string NativeQueryConfig(std::string query) { char temp[128]; if (query == "screenRotation") { - ILOG("g_Config.screenRotation = %d", g_Config.iScreenRotation); + INFO_LOG(G3D, "g_Config.screenRotation = %d", g_Config.iScreenRotation); snprintf(temp, sizeof(temp), "%d", g_Config.iScreenRotation); return std::string(temp); } else if (query == "immersiveMode") { @@ -357,7 +357,7 @@ static void PostLoadConfig() { void CreateDirectoriesAndroid() { // On Android, create a PSP directory tree in the external_dir, // to hopefully reduce confusion a bit. - ILOG("Creating %s", (g_Config.memStickDirectory + "PSP").c_str()); + INFO_LOG(IO, "Creating %s", (g_Config.memStickDirectory + "PSP").c_str()); File::CreateFullPath(g_Config.memStickDirectory + "PSP"); File::CreateFullPath(GetSysDirectory(DIRECTORY_SAVEDATA)); File::CreateFullPath(GetSysDirectory(DIRECTORY_SAVESTATE)); @@ -608,21 +608,21 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch // don't already have one. if (!gotBootFilename) { gotBootFilename = true; - ILOG("Boot filename found in args: '%s'", argv[i]); + INFO_LOG(SYSTEM, "Boot filename found in args: '%s'", argv[i]); bool okToLoad = true; bool okToCheck = true; if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS)) { PermissionStatus status = System_GetPermissionStatus(SYSTEM_PERMISSION_STORAGE); if (status == PERMISSION_STATUS_DENIED) { - ELOG("Storage permission denied. Launching without argument."); + ERROR_LOG(IO, "Storage permission denied. Launching without argument."); okToLoad = false; okToCheck = false; } else if (status != PERMISSION_STATUS_GRANTED) { - ELOG("Storage permission not granted. Launching without argument check."); + ERROR_LOG(IO, "Storage permission not granted. Launching without argument check."); okToCheck = false; } else { - ILOG("Storage permission granted."); + INFO_LOG(IO, "Storage permission granted."); } } if (okToLoad) { @@ -812,7 +812,7 @@ void RenderOverlays(UIContext *dc, void *userdata); bool CreateGlobalPipelines(); bool NativeInitGraphics(GraphicsContext *graphicsContext) { - ILOG("NativeInitGraphics"); + INFO_LOG(SYSTEM, "NativeInitGraphics"); // We set this now so any resize during init is processed later. resized = false; @@ -881,7 +881,7 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) { gpu->DeviceRestore(); } - ILOG("NativeInitGraphics completed"); + INFO_LOG(SYSTEM, "NativeInitGraphics completed"); return true; } @@ -931,7 +931,7 @@ void NativeShutdownGraphics() { if (gpu) gpu->DeviceLost(); - ILOG("NativeShutdownGraphics"); + INFO_LOG(SYSTEM, "NativeShutdownGraphics"); #if PPSSPP_PLATFORM(WINDOWS) delete winAudioBackend; @@ -973,7 +973,7 @@ void NativeShutdownGraphics() { texColorPipeline = nullptr; } - ILOG("NativeShutdownGraphics done"); + INFO_LOG(SYSTEM, "NativeShutdownGraphics done"); } void TakeScreenshot() { @@ -1090,7 +1090,7 @@ void NativeRender(GraphicsContext *graphicsContext) { } if (resized) { - ILOG("Resized flag set - recalculating bounds"); + INFO_LOG(G3D, "Resized flag set - recalculating bounds"); resized = false; if (uiContext) { @@ -1119,7 +1119,7 @@ void NativeRender(GraphicsContext *graphicsContext) { NativeMessageReceived("gpu_resized", ""); #endif } else { - // ILOG("Polling graphics context"); + // INFO_LOG(G3D, "Polling graphics context"); graphicsContext->Poll(); } @@ -1179,7 +1179,7 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) { // Ideally we should simply reinitialize graphics to the mode from the config, but there are potential issues // and I can't risk it before 1.9.0. int gpuBackend = g_Config.iGPUBackend; - ILOG("Reloading config after storage permission grant."); + INFO_LOG(IO, "Reloading config after storage permission grant."); g_Config.Reload(); PostLoadConfig(); g_Config.iGPUBackend = gpuBackend; @@ -1218,16 +1218,16 @@ void NativeUpdate() { bool NativeIsAtTopLevel() { // This might need some synchronization? if (!screenManager) { - ELOG("No screen manager active"); + ERROR_LOG(SYSTEM, "No screen manager active"); return false; } Screen *currentScreen = screenManager->topScreen(); if (currentScreen) { bool top = currentScreen->isTopLevel(); - ILOG("Screen toplevel: %i", (int)top); + INFO_LOG(SYSTEM, "Screen toplevel: %i", (int)top); return currentScreen->isTopLevel(); } else { - ELOG("No current screen"); + ERROR_LOG(SYSTEM, "No current screen"); return false; } } @@ -1246,7 +1246,7 @@ bool NativeTouch(const TouchInput &touch) { } bool NativeKey(const KeyInput &key) { - // ILOG("Key code: %i flags: %i", key.keyCode, key.flags); + // INFO_LOG(SYSTEM, "Key code: %i flags: %i", key.keyCode, key.flags); #if !defined(MOBILE_DEVICE) if (g_Config.bPauseExitsEmulator) { static std::vector pspKeys; @@ -1364,7 +1364,7 @@ void NativeInputBoxReceived(std::function cb, b void NativeResized() { // NativeResized can come from any thread so we just set a flag, then process it later. - ILOG("NativeResized - setting flag"); + INFO_LOG(G3D, "NativeResized - setting flag"); resized = true; } @@ -1398,7 +1398,7 @@ void NativeShutdown() { moncleanup(); #endif - ILOG("NativeShutdown called"); + INFO_LOG(SYSTEM, "NativeShutdown called"); ShutdownWebServer(); diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 24f3b964d1..07a136c69f 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -505,7 +505,7 @@ std::string GetCPUBrandString() { } catch (const std::exception & e) { const char* what = e.what(); - ILOG("%s", what); + INFO_LOG(SYSTEM, "%s", what); } if (cpu_id != nullptr) { @@ -527,7 +527,7 @@ std::string GetCPUBrandString() { } catch (const std::exception & e) { const char* what = e.what(); - ILOG("%s", what); + INFO_LOG(SYSTEM, "%s", what); } } diff --git a/UWP/StorageFileLoader.cpp b/UWP/StorageFileLoader.cpp index 0c52448a58..da0f6af19e 100644 --- a/UWP/StorageFileLoader.cpp +++ b/UWP/StorageFileLoader.cpp @@ -43,7 +43,7 @@ void StorageFileLoader::threadfunc() { operationFailed_ = true; // TODO: What do we do? const char *what = e.what(); - ILOG("%s", what); + INFO_LOG(SYSTEM, "%s", what); } catch (Platform::COMException ^e) { @@ -57,11 +57,11 @@ void StorageFileLoader::threadfunc() { } catch (const std::exception& e) { const char *what = e.what(); - ILOG("%s", what); + INFO_LOG(SYSTEM, "%s", what); } catch (Platform::COMException ^e) { std::string what = FromPlatformString(e->ToString()); - ILOG("%s", what.c_str()); + INFO_LOG(SYSTEM, "%s", what.c_str()); } initMutex.unlock(); @@ -85,7 +85,7 @@ void StorageFileLoader::threadfunc() { } catch (const std::exception& e) { operationFailed_ = true; const char *what = e.what(); - ILOG("%s", what); + INFO_LOG(SYSTEM, "%s", what); } operationRequested_ = false; std::unique_lock lock(mutexResponse_); diff --git a/android/jni/Arm64EmitterTest.cpp b/android/jni/Arm64EmitterTest.cpp index e14c98532d..3a04f6fb18 100644 --- a/android/jni/Arm64EmitterTest.cpp +++ b/android/jni/Arm64EmitterTest.cpp @@ -1,8 +1,7 @@ -#include "base/logging.h" - #include "Common/Arm64Emitter.h" #include "Common/BitSet.h" #include "Common/CPUDetect.h" +#include "Common/Log.h" static bool functionWasCalled; @@ -67,11 +66,11 @@ void Arm64EmitterTest() { return; for (int i = 0; i < 6; i++) { - ILOG("---------------------------"); + INFO_LOG(SYSTEM, "---------------------------"); } - ILOG("---------------------------"); - ILOG("Running ARM64 emitter test!"); - ILOG("---------------------------"); + INFO_LOG(SYSTEM, "---------------------------"); + INFO_LOG(SYSTEM, "Running ARM64 emitter test!"); + INFO_LOG(SYSTEM, "---------------------------"); TestCode gen; gen.ReserveCodeSpace(0x1000); @@ -79,15 +78,15 @@ void Arm64EmitterTest() { gen.Generate(); u32 retval = CallPtr(gen.testCodePtr); - ILOG("Returned %d", retval); - // ILOG("ARM emitter test 1 passed if %f == 3.0! retval = %08x", abc[32 + 31], retval); + INFO_LOG(SYSTEM, "Returned %d", retval); + // INFO_LOG(SYSTEM, "ARM emitter test 1 passed if %f == 3.0! retval = %08x", abc[32 + 31], retval); /* - ILOG("x: %08x %08x %08x %08x", x[0], x[1], x[2], x[3]); - ILOG("y: %08x %08x %08x %08x", y[0], y[1], y[2], y[3]); - ILOG("z: %08x %08x %08x %08x", z[0], z[1], z[2], z[3]); - ILOG("c: %f %f %f %f", c[0], c[1], c[2], c[3]);*/ + INFO_LOG(SYSTEM, "x: %08x %08x %08x %08x", x[0], x[1], x[2], x[3]); + INFO_LOG(SYSTEM, "y: %08x %08x %08x %08x", y[0], y[1], y[2], y[3]); + INFO_LOG(SYSTEM, "z: %08x %08x %08x %08x", z[0], z[1], z[2], z[3]); + INFO_LOG(SYSTEM, "c: %f %f %f %f", c[0], c[1], c[2], c[3]);*/ for (int i = 0; i < 6; i++) { - ILOG("--------------------------"); + INFO_LOG(SYSTEM, "--------------------------"); } // DisassembleArm(codeStart, gen.GetCodePtr()-codeStart); } diff --git a/android/jni/ArmEmitterTest.cpp b/android/jni/ArmEmitterTest.cpp index 8090c1e94c..5af9643f07 100644 --- a/android/jni/ArmEmitterTest.cpp +++ b/android/jni/ArmEmitterTest.cpp @@ -1,4 +1,3 @@ -#include "base/logging.h" #include "ArmEmitterTest.h" #include "Common/ArmEmitter.h" @@ -70,7 +69,7 @@ void TestCode::Generate() VST1(I_32, D6, R3, 2); PLD(R1, 32); u32 word = *(u32 *)(GetCodePtr() - 4); - ILOG("Instruction Word: %08x", word); + INFO_LOG(SYSTEM, "Instruction Word: %08x", word); // This works! @@ -122,11 +121,11 @@ void ArmEmitterTest() return; for (int i = 0; i < 6; i++) { - ILOG("--------------------------"); + INFO_LOG(SYSTEM, "--------------------------"); } - ILOG("--------------------------"); - ILOG("Running ARM emitter test!"); - ILOG("--------------------------"); + INFO_LOG(SYSTEM, "--------------------------"); + INFO_LOG(SYSTEM, "Running ARM emitter test!"); + INFO_LOG(SYSTEM, "--------------------------"); TestCode gen; gen.ReserveCodeSpace(0x1000); @@ -134,13 +133,13 @@ void ArmEmitterTest() gen.Generate(); u32 retval = CallPtr(gen.testCodePtr); - // ILOG("ARM emitter test 1 passed if %f == 3.0! retval = %08x", abc[32 + 31], retval); - ILOG("x: %08x %08x %08x %08x", x[0], x[1], x[2], x[3]); - ILOG("y: %08x %08x %08x %08x", y[0], y[1], y[2], y[3]); - ILOG("z: %08x %08x %08x %08x", z[0], z[1], z[2], z[3]); - ILOG("c: %f %f %f %f", c[0], c[1], c[2], c[3]); + // INFO_LOG(SYSTEM, "ARM emitter test 1 passed if %f == 3.0! retval = %08x", abc[32 + 31], retval); + INFO_LOG(SYSTEM, "x: %08x %08x %08x %08x", x[0], x[1], x[2], x[3]); + INFO_LOG(SYSTEM, "y: %08x %08x %08x %08x", y[0], y[1], y[2], y[3]); + INFO_LOG(SYSTEM, "z: %08x %08x %08x %08x", z[0], z[1], z[2], z[3]); + INFO_LOG(SYSTEM, "c: %f %f %f %f", c[0], c[1], c[2], c[3]); for (int i = 0; i < 6; i++) { - ILOG("--------------------------"); + INFO_LOG(SYSTEM, "--------------------------"); } // DisassembleArm(codeStart, gen.GetCodePtr()-codeStart); } diff --git a/android/jni/TestRunner.cpp b/android/jni/TestRunner.cpp index 2a24811289..f3db153a6e 100644 --- a/android/jni/TestRunner.cpp +++ b/android/jni/TestRunner.cpp @@ -28,9 +28,9 @@ #include "ppsspp_config.h" #include "base/basictypes.h" #include "base/display.h" -#include "base/logging.h" #include "Common/FileUtil.h" +#include "Common/Log.h" #include "Core/Core.h" #include "Core/System.h" #include "Core/Config.h" @@ -112,11 +112,11 @@ bool RunTests() { coreParam.fileToStart = baseDirectory + "pspautotests/tests/" + testName + ".prx"; std::string expectedFile = baseDirectory + "pspautotests/tests/" + testName + ".expected"; - ILOG("Preparing to execute '%s'", testName); + INFO_LOG(SYSTEM, "Preparing to execute '%s'", testName); std::string error_string; output = ""; if (!PSP_Init(coreParam, &error_string)) { - ELOG("Failed to init unittest %s : %s", testsToRun[i], error_string.c_str()); + ERROR_LOG(SYSTEM, "Failed to init unittest %s : %s", testsToRun[i], error_string.c_str()); PSP_CoreParameter().pixelWidth = pixel_xres; PSP_CoreParameter().pixelHeight = pixel_yres; return false; @@ -125,7 +125,7 @@ bool RunTests() { PSP_BeginHostFrame(); // Run the emu until the test exits - ILOG("Test: Entering runloop."); + INFO_LOG(SYSTEM, "Test: Entering runloop."); while (true) { int blockTicks = usToCycles(1000000 / 10); while (coreState == CORE_RUNNING) { @@ -136,7 +136,7 @@ bool RunTests() { // set back to running for the next frame coreState = CORE_RUNNING; } else if (coreState == CORE_POWERDOWN) { - ILOG("Finished running test %s", testName); + INFO_LOG(SYSTEM, "Finished running test %s", testName); break; } } @@ -144,7 +144,7 @@ bool RunTests() { std::ifstream expected(expectedFile.c_str(), std::ios_base::in); if (!expected) { - ELOG("Error opening expectedFile %s", expectedFile.c_str()); + ERROR_LOG(SYSTEM, "Error opening expectedFile %s", expectedFile.c_str()); break; } @@ -160,9 +160,9 @@ bool RunTests() { e = TrimNewlines(e); o = TrimNewlines(o); if (e != o) { - ELOG("DIFF on line %i!", line); - ELOG("O: %s", o.c_str()); - ELOG("E: %s", e.c_str()); + ERROR_LOG(SYSTEM, "DIFF on line %i!", line); + ERROR_LOG(SYSTEM, "O: %s", o.c_str()); + ERROR_LOG(SYSTEM, "E: %s", e.c_str()); } if (expected.eof()) { break; diff --git a/ext/native/base/logging.cpp b/ext/native/base/logging.cpp index b4f40fa8c7..812219d11f 100644 --- a/ext/native/base/logging.cpp +++ b/ext/native/base/logging.cpp @@ -1,4 +1,4 @@ -#include "base/logging.h" +#include const char *GetFn(const char *fn) { const char *p = strrchr(fn, '\\'); diff --git a/ext/native/file/zip_read.cpp b/ext/native/file/zip_read.cpp index b6e997877b..7efcab7255 100644 --- a/ext/native/file/zip_read.cpp +++ b/ext/native/file/zip_read.cpp @@ -301,7 +301,7 @@ uint8_t *VFSReadFile(const char *filename, size_t *size) { if (prefix_len >= fn_len) continue; if (0 == memcmp(filename, entries[i].prefix, prefix_len)) { fileSystemFound = true; - // ILOG("Prefix match: %s (%s) -> %s", entries[i].prefix, filename, filename + prefix_len); + // INFO_LOG(IO, "Prefix match: %s (%s) -> %s", entries[i].prefix, filename, filename + prefix_len); uint8_t *data = entries[i].reader->ReadAsset(filename + prefix_len, size); if (data) return data; @@ -319,7 +319,7 @@ uint8_t *VFSReadFile(const char *filename, size_t *size) { bool VFSGetFileListing(const char *path, std::vector *listing, const char *filter) { if (IsLocalPath(path)) { // Local path, not VFS. - // ILOG("Not a VFS path: %s . Reading local directory.", path); + // INFO_LOG(IO, "Not a VFS path: %s . Reading local directory.", path); getFilesInDir(path, listing, filter); return true; } @@ -346,7 +346,7 @@ bool VFSGetFileListing(const char *path, std::vector *listing, const c bool VFSGetFileInfo(const char *path, FileInfo *info) { if (IsLocalPath(path)) { // Local path, not VFS. - // ILOG("Not a VFS path: %s . Getting local file info.", path); + // INFO_LOG(IO, "Not a VFS path: %s . Getting local file info.", path); return getFileInfo(path, info); } diff --git a/ext/native/gfx_es2/draw_text_qt.cpp b/ext/native/gfx_es2/draw_text_qt.cpp index 12929e25cf..39b4ac95eb 100644 --- a/ext/native/gfx_es2/draw_text_qt.cpp +++ b/ext/native/gfx_es2/draw_text_qt.cpp @@ -134,7 +134,7 @@ void TextDrawerQt::DrawStringBitmap(std::vector &bitmapData, TextString } } } else { - _assert_msg_("Bad TextDrawer format"); + _assert_msg_(false, "Bad TextDrawer format"); } } diff --git a/ext/native/gfx_es2/draw_text_uwp.cpp b/ext/native/gfx_es2/draw_text_uwp.cpp index a8c67d211b..9c3d9c21be 100644 --- a/ext/native/gfx_es2/draw_text_uwp.cpp +++ b/ext/native/gfx_es2/draw_text_uwp.cpp @@ -91,15 +91,15 @@ TextDrawerUWP::TextDrawerUWP(Draw::DrawContext *draw) : TextDrawer(draw), ctx_(n // Create D2D Device and DeviceContext. // TODO: We have one sitting right in DX::DeviceResource, there might be a way to use that instead. hr = m_d2dFactory->CreateDevice(dxgiDevice, &m_d2dDevice); - if (FAILED(hr)) FLOG("D2D CreateDevice failed"); + if (FAILED(hr)) _assert_msg_(false, "D2D CreateDevice failed"); hr = m_d2dDevice->CreateDeviceContext(D2D1_DEVICE_CONTEXT_OPTIONS_NONE, &m_d2dContext); - if (FAILED(hr)) FLOG("D2D CreateDeviceContext failed"); + if (FAILED(hr)) _assert_msg_(false, "D2D CreateDeviceContext failed"); // Load the Roboto font hr = m_dwriteFactory->CreateFontFileReference(L"Content/Roboto-Condensed.ttf", nullptr, &m_fontFile); - if (FAILED(hr)) ELOG("CreateFontFileReference failed"); + if (FAILED(hr)) ERROR_LOG(SYSTEM, "CreateFontFileReference failed"); hr = m_dwriteFactory->CreateFontSetBuilder(&m_fontSetBuilder); - if (FAILED(hr)) ELOG("CreateFontSetBuilder failed"); + if (FAILED(hr)) ERROR_LOG(SYSTEM, "CreateFontSetBuilder failed"); hr = m_fontSetBuilder->AddFontFile(m_fontFile); hr = m_fontSetBuilder->CreateFontSet(&m_fontSet); hr = m_dwriteFactory->CreateFontCollectionFromFontSet(m_fontSet, &m_fontCollection); diff --git a/ext/native/tools/audiotool.cpp b/ext/native/tools/audiotool.cpp deleted file mode 100644 index 68cfee7ae3..0000000000 --- a/ext/native/tools/audiotool.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// TODO - -#include - -#include "audio/wav_load.h" -#include "base/logging.h" - - -struct AudioClip { - int length; - -}; - - -int main(int argc, char **argv) { - CHECK(argc == 3); -} diff --git a/ios/ViewController.mm b/ios/ViewController.mm index 4f6f9a4db3..4741c4373e 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -30,6 +30,7 @@ #include "Core/HLE/sceUsbCam.h" #include "Core/HLE/sceUsbGps.h" #include "Common/GraphicsContext.h" +#include "Common/Log.h" #include #include @@ -244,7 +245,7 @@ static LocationHelper *locationHelper; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ NativeInitGraphics(graphicsContext); - ILOG("Emulation thread starting\n"); + INFO_LOG(SYSTEM, "Emulation thread starting\n"); while (threadEnabled) { NativeUpdate(); NativeRender(graphicsContext); @@ -252,11 +253,11 @@ static LocationHelper *locationHelper; } - ILOG("Emulation thread shutting down\n"); + INFO_LOG(SYSTEM, "Emulation thread shutting down\n"); NativeShutdownGraphics(); // Also ask the main thread to stop, so it doesn't hang waiting for a new frame. - ILOG("Emulation thread stopping\n"); + INFO_LOG(SYSTEM, "Emulation thread stopping\n"); graphicsContext->StopThread(); threadStopped = true; diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index e2b94af96a..b8af6ae8bb 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -32,7 +32,6 @@ #include #include "base/NativeApp.h" -#include "base/logging.h" #include "input/input_state.h" #include "ext/disarm.h" #include "math/math_util.h" @@ -41,6 +40,7 @@ #include "Common/ArmEmitter.h" #include "Common/BitScan.h" #include "Common/CPUDetect.h" +#include "Common/Log.h" #include "Core/Config.h" #include "Core/FileSystems/ISOFileSystem.h" #include "Core/MemMap.h" @@ -326,7 +326,7 @@ bool TestMatrixTranspose() { } void TestGetMatrix(int matrix, MatrixSize sz) { - ILOG("Testing matrix %s", GetMatrixNotation(matrix, sz)); + INFO_LOG(SYSTEM, "Testing matrix %s", GetMatrixNotation(matrix, sz)); u8 fullMatrix[16]; u8 cols[4]; @@ -344,8 +344,8 @@ void TestGetMatrix(int matrix, MatrixSize sz) { // int rowName = GetRowName(matrix, sz, i, 0); int colName = cols[i]; int rowName = rows[i]; - ILOG("Column %i: %s", i, GetVectorNotation(colName, vsz)); - ILOG("Row %i: %s", i, GetVectorNotation(rowName, vsz)); + INFO_LOG(SYSTEM, "Column %i: %s", i, GetVectorNotation(colName, vsz)); + INFO_LOG(SYSTEM, "Row %i: %s", i, GetVectorNotation(rowName, vsz)); u8 colRegs[4]; u8 rowRegs[4]; @@ -366,12 +366,12 @@ void TestGetMatrix(int matrix, MatrixSize sz) { c << (int)fullMatrix[j * 4 + i] << " "; d << (int)rowRegs[j] << " "; } - ILOG("Col: %s vs %s", a.str().c_str(), b.str().c_str()); + INFO_LOG(SYSTEM, "Col: %s vs %s", a.str().c_str(), b.str().c_str()); if (a.str() != b.str()) - ILOG("WRONG!"); - ILOG("Row: %s vs %s", c.str().c_str(), d.str().c_str()); + INFO_LOG(SYSTEM, "WRONG!"); + INFO_LOG(SYSTEM, "Row: %s vs %s", c.str().c_str(), d.str().c_str()); if (c.str() != d.str()) - ILOG("WRONG!"); + INFO_LOG(SYSTEM, "WRONG!"); } } From 3c412ea21e93afa29ac5ee54021291970ca99673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 18:40:50 +0200 Subject: [PATCH 12/15] Fix build of ZimTool/AtlasTool. Had to break the ugly backwards dependency from LogManager to g_Config. --- Common/LogManager.cpp | 26 +++++++++++--------- Common/LogManager.h | 5 ++-- UI/NativeApp.cpp | 2 +- UWP/PPSSPP_UWPMain.cpp | 3 ++- Windows/main.cpp | 2 +- ext/native/base/logging.h | 11 --------- ext/native/tools/atlastool/atlastool.vcxproj | 5 ++-- ext/native/tools/zimtool/zimtool.vcxproj | 2 ++ headless/Headless.cpp | 2 +- libretro/libretro.cpp | 2 +- 10 files changed, 29 insertions(+), 31 deletions(-) diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index c1eef5d2fb..89dee6720e 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -21,16 +21,18 @@ #include #include "util/text/utf8.h" -#include "LogManager.h" -#include "ConsoleListener.h" -#include "Timer.h" -#include "FileUtil.h" -#include "StringUtils.h" -#include "Core/Config.h" + +#include "Common/LogManager.h" +#include "Common/ConsoleListener.h" +#include "Common/Timer.h" +#include "Common/FileUtil.h" +#include "Common/StringUtils.h" // Don't need to savestate this. const char *hleCurrentThreadName = nullptr; +bool *g_bLogEnabledSetting = nullptr; + static const char level_to_char[8] = "-NEWIDV"; #if PPSSPP_PLATFORM(UWP) && defined(_DEBUG) @@ -40,7 +42,7 @@ static const char level_to_char[8] = "-NEWIDV"; #endif void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char *file, int line, const char* fmt, ...) { - if (!g_Config.bEnableLogging) + if (g_bLogEnabledSetting && !(*g_bLogEnabledSetting)) return; va_list args; va_start(args, fmt); @@ -56,7 +58,7 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char bool GenericLogEnabled(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type) { if (LogManager::GetInstance()) - return g_Config.bEnableLogging && LogManager::GetInstance()->IsEnabled(level, type); + return (*g_bLogEnabledSetting) && LogManager::GetInstance()->IsEnabled(level, type); return false; } @@ -116,7 +118,9 @@ static const LogNameTableEntry logTable[] = { {LogTypes::SCEMISC, "SCEMISC"}, }; -LogManager::LogManager() { +LogManager::LogManager(bool *enabledSetting) { + g_bLogEnabledSetting = enabledSetting; + for (size_t i = 0; i < ARRAY_SIZE(logTable); i++) { _assert_msg_(i == logTable[i].logType, "Bad logtable at %i", (int)i); truncate_cpy(log_[logTable[i].logType].m_shortName, logTable[i].name); @@ -271,8 +275,8 @@ bool LogManager::IsEnabled(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type) return true; } -void LogManager::Init() { - logManager_ = new LogManager(); +void LogManager::Init(bool *enabledSetting) { + logManager_ = new LogManager(enabledSetting); } void LogManager::Shutdown() { diff --git a/Common/LogManager.h b/Common/LogManager.h index a9d5a568e9..6aaa69b462 100644 --- a/Common/LogManager.h +++ b/Common/LogManager.h @@ -105,7 +105,7 @@ class ConsoleListener; class LogManager { private: - LogManager(); + LogManager(bool *enabledSetting); ~LogManager(); // Prevent copies. @@ -122,6 +122,7 @@ private: std::mutex log_lock_; std::mutex listeners_lock_; std::vector listeners_; + public: void AddListener(LogListener *listener); void RemoveListener(LogListener *listener); @@ -175,7 +176,7 @@ public: logManager_ = logManager; } - static void Init(); + static void Init(bool *enabledSetting); static void Shutdown(); void ChangeFileLog(const char *filename); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 4c3559d030..00d37db957 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -531,7 +531,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch } if (!LogManager::GetInstance()) - LogManager::Init(); + LogManager::Init(&g_Config.bEnableLogging); #ifndef _WIN32 g_Config.AddSearchPath(user_data_path); diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 07a136c69f..5711ae0b29 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -10,6 +10,7 @@ #include "Common/LogManager.h" #include "Core/System.h" #include "Core/Loaders.h" +#include "Core/Config.h" #include "base/NativeApp.h" #include "base/timeutil.h" #include "input/input_state.h" @@ -100,7 +101,7 @@ PPSSPP_UWPMain::PPSSPP_UWPMain(App ^app, const std::shared_ptr (b)); -#define CHECK_GE(a, b) CHECK((a) >= (b)); -#define CHECK_LT(a, b) CHECK((a) < (b)); -#define CHECK_LE(a, b) CHECK((a) <= (b)); diff --git a/ext/native/tools/atlastool/atlastool.vcxproj b/ext/native/tools/atlastool/atlastool.vcxproj index 60613f1c54..805700c863 100644 --- a/ext/native/tools/atlastool/atlastool.vcxproj +++ b/ext/native/tools/atlastool/atlastool.vcxproj @@ -81,7 +81,7 @@ Console true ../prebuilt/win64 - freetype.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + winmm.lib;freetype.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) @@ -97,6 +97,7 @@ true ../../../../;../../ext;../../;../../../../ext;../prebuilt MultiThreaded + false Console @@ -104,7 +105,7 @@ true true ../prebuilt/win64 - freetype.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + winmm.lib;freetype.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) diff --git a/ext/native/tools/zimtool/zimtool.vcxproj b/ext/native/tools/zimtool/zimtool.vcxproj index 3c9e0d3c2d..1eecf94c3f 100644 --- a/ext/native/tools/zimtool/zimtool.vcxproj +++ b/ext/native/tools/zimtool/zimtool.vcxproj @@ -84,6 +84,7 @@ true true true + winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) @@ -101,6 +102,7 @@ Console true + winmm.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 77af343446..4e0cee7457 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -335,7 +335,7 @@ int main(int argc, const char* argv[]) GraphicsContext *graphicsContext = nullptr; bool glWorking = host->InitGraphics(&error_string, &graphicsContext); - LogManager::Init(); + LogManager::Init(&g_Config.bEnableLogging); LogManager *logman = LogManager::GetInstance(); PrintfLogger *printfLogger = new PrintfLogger(); diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index 497cbae28d..2b61b9f550 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -358,7 +358,7 @@ void retro_init(void) g_Config.iFirmwareVersion = PSP_DEFAULT_FIRMWARE; g_Config.iPSPModel = PSP_MODEL_SLIM; - LogManager::Init(); + LogManager::Init(&g_Config.bEnableLogging); host = new LibretroHost; From f0d2f24658dcf0011c3fa4338f0174d8eff37b59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 19:01:16 +0200 Subject: [PATCH 13/15] Finally delete base/logging.cpp/h. Carefully preserve behaviour on Android. There's more cleanup to do ... --- CMakeLists.txt | 2 - UI/NativeApp.cpp | 35 +++++---- UWP/NativeUWP/NativeUWP.vcxproj | 2 - Windows/main.cpp | 3 +- android/jni/app-android.cpp | 40 +++++++++++ android/jni/app-android.h | 7 ++ ext/native/base/logging.cpp | 9 --- ext/native/base/logging.h | 124 -------------------------------- ext/native/native.vcxproj | 4 +- libretro/Makefile.common | 1 - 10 files changed, 66 insertions(+), 161 deletions(-) delete mode 100644 ext/native/base/logging.cpp delete mode 100644 ext/native/base/logging.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 0137d06d5a..1b8a4e8706 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -822,7 +822,6 @@ elseif(WIN32) else() link_directories(dx9sdk/Lib/x86) endif() - set(nativeExtra ${nativeExtra} ext/native/base/logging.cpp) elseif(TARGET SDL2::SDL2) set(TargetBin PPSSPPSDL) # Require SDL @@ -934,7 +933,6 @@ add_library(native STATIC ext/native/base/display.cpp ext/native/base/display.h ext/native/base/linked_ptr.h - ext/native/base/logging.h ext/native/base/stringutil.cpp ext/native/base/stringutil.h ext/native/base/timeutil.cpp diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 00d37db957..db07804eb8 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -44,9 +44,6 @@ #endif #include "base/display.h" - -#include "base/logging.h" // For "AndroidLogger". TODO: Remove. - #include "base/stringutil.h" #include "base/timeutil.h" #include "base/NativeApp.h" @@ -70,12 +67,16 @@ #include "ui/view.h" #include "util/text/utf8.h" +#include "android/jni/app-android.h" + #include "Common/CPUDetect.h" #include "Common/FileUtil.h" +#include "Common/KeyMap.h" #include "Common/LogManager.h" #include "Common/MemArena.h" #include "Common/GraphicsContext.h" #include "Common/OSVersion.h" + #include "Core/Config.h" #include "Core/ConfigValues.h" #include "Core/Core.h" @@ -93,8 +94,8 @@ #include "Core/Util/GameManager.h" #include "Core/Util/AudioFormat.h" #include "Core/WebServer.h" -#include "GPU/GPUInterface.h" +#include "GPU/GPUInterface.h" #include "UI/BackgroundAudio.h" #include "UI/ControlMappingScreen.h" #include "UI/DiscordIntegration.h" @@ -108,10 +109,6 @@ #include "UI/TiltEventProcessor.h" #include "UI/TextureUtil.h" -#if !defined(MOBILE_DEVICE) -#include "Common/KeyMap.h" -#endif - #if !defined(MOBILE_DEVICE) && defined(USING_QT_UI) #include "Qt/QtHost.h" #endif @@ -183,7 +180,7 @@ WindowsAudioBackend *winAudioBackend; std::thread *graphicsLoadThread; -class AndroidLogger : public LogListener { +class PrintfLogger : public LogListener { public: void Log(const LogMessage &message) override { // Log with simplified headers as Android already provides timestamp etc. @@ -191,17 +188,17 @@ public: case LogTypes::LVERBOSE: case LogTypes::LDEBUG: case LogTypes::LINFO: - ILOG("[%s] %s", message.log, message.msg.c_str()); + printf("INFO [%s] %s", message.log, message.msg.c_str()); break; case LogTypes::LERROR: - ELOG("[%s] %s", message.log, message.msg.c_str()); + printf("ERR [%s] %s", message.log, message.msg.c_str()); break; case LogTypes::LWARNING: - WLOG("[%s] %s", message.log, message.msg.c_str()); + printf("WARN [%s] %s", message.log, message.msg.c_str()); break; case LogTypes::LNOTICE: default: - ILOG("[%s] !!! %s", message.log, message.msg.c_str()); + printf("NOTE [%s] !!! %s", message.log, message.msg.c_str()); break; } } @@ -214,7 +211,7 @@ int Win32Mix(short *buffer, int numSamples, int bits, int rate, int channels) { #endif // globals -static AndroidLogger *logger = nullptr; +static LogListener *logger = nullptr; std::string boot_filename = ""; void NativeHost::InitSound() { @@ -661,10 +658,13 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch PostLoadConfig(); -#if defined(__ANDROID__) || (defined(MOBILE_DEVICE) && !defined(_DEBUG)) +#if PPSSPP_PLATFORM(ANDROID) + logger = new AndroidLogger(); + logman->AddListener(logger); +#elif (defined(MOBILE_DEVICE) && !defined(_DEBUG)) // Enable basic logging for any kind of mobile device, since LogManager doesn't. // The MOBILE_DEVICE/_DEBUG condition matches LogManager.cpp. - logger = new AndroidLogger(); + logger = new PrintfLogger(); logman->AddListener(logger); #endif @@ -1408,9 +1408,6 @@ void NativeShutdown() { g_Discord.Shutdown(); - delete logger; - logger = nullptr; - // Previously we did exit() here on Android but that makes it hard to do things like restart on backend change. // I think we handle most globals correctly or correct-enough now. } diff --git a/UWP/NativeUWP/NativeUWP.vcxproj b/UWP/NativeUWP/NativeUWP.vcxproj index a25e4fbd1a..cce36088aa 100644 --- a/UWP/NativeUWP/NativeUWP.vcxproj +++ b/UWP/NativeUWP/NativeUWP.vcxproj @@ -385,7 +385,6 @@ - @@ -479,7 +478,6 @@ - diff --git a/Windows/main.cpp b/Windows/main.cpp index 6193e9e96f..693d57c8db 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -610,8 +610,9 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin // - It should be possible to log to a file without showing the console. LogManager::GetInstance()->GetConsoleListener()->Init(showLog, 150, 120, "PPSSPP Debug Console"); - if (debugLogLevel) + if (debugLogLevel) { LogManager::GetInstance()->SetAllLogLevels(LogTypes::LDEBUG); + } timeBeginPeriod(1); // TODO: Evaluate if this makes sense to keep. diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index aad11b14f1..a0c5c6a5af 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -16,6 +16,8 @@ #ifndef _MSC_VER #include #include +#include + #elif !defined(JNIEXPORT) // Just for better highlighting in MSVC if opening this file. // Not having types makes it get confused and say everything is wrong. @@ -173,6 +175,44 @@ static std::map permissions; AndroidGraphicsContext *graphicsContext; +#ifndef LOG_APP_NAME +#define LOG_APP_NAME "PPSSPP" +#endif + +#ifdef _DEBUG +#define DLOG(...) __android_log_print(ANDROID_LOG_INFO, LOG_APP_NAME, __VA_ARGS__); +#else +#define DLOG(...) +#endif + +#define ILOG(...) __android_log_print(ANDROID_LOG_INFO, LOG_APP_NAME, __VA_ARGS__); +#define WLOG(...) __android_log_print(ANDROID_LOG_WARN, LOG_APP_NAME, __VA_ARGS__); +#define ELOG(...) __android_log_print(ANDROID_LOG_ERROR, LOG_APP_NAME, __VA_ARGS__); +#define FLOG(...) __android_log_print(ANDROID_LOG_FATAL, LOG_APP_NAME, __VA_ARGS__); + +#define MessageBox(a, b, c, d) __android_log_print(ANDROID_LOG_INFO, APP_NAME, "%s %s", (b), (c)); + +void AndroidLogger::Log(const LogMessage &message) { + // Log with simplified headers as Android already provides timestamp etc. + switch (message.level) { + case LogTypes::LVERBOSE: + case LogTypes::LDEBUG: + case LogTypes::LINFO: + ILOG("[%s] %s", message.log, message.msg.c_str()); + break; + case LogTypes::LERROR: + ELOG("[%s] %s", message.log, message.msg.c_str()); + break; + case LogTypes::LWARNING: + WLOG("[%s] %s", message.log, message.msg.c_str()); + break; + case LogTypes::LNOTICE: + default: + ILOG("[%s] !!! %s", message.log, message.msg.c_str()); + break; + } +} + JNIEnv* getEnv() { JNIEnv *env; int status = gJvm->GetEnv((void**)&env, JNI_VERSION_1_6); diff --git a/android/jni/app-android.h b/android/jni/app-android.h index 49d0dab435..aa21dd9ade 100644 --- a/android/jni/app-android.h +++ b/android/jni/app-android.h @@ -2,6 +2,8 @@ #include "ppsspp_config.h" +#include "Common/LogManager.h" + #if PPSSPP_PLATFORM(ANDROID) #include @@ -10,3 +12,8 @@ jclass findClass(const char* name); JNIEnv* getEnv(); #endif + +class AndroidLogger : public LogListener { +public: + void Log(const LogMessage &message) override; +}; diff --git a/ext/native/base/logging.cpp b/ext/native/base/logging.cpp deleted file mode 100644 index 812219d11f..0000000000 --- a/ext/native/base/logging.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -const char *GetFn(const char *fn) { - const char *p = strrchr(fn, '\\'); - if (p) - return p + 1; - else - return fn; -} diff --git a/ext/native/base/logging.h b/ext/native/base/logging.h deleted file mode 100644 index 1ba560b602..0000000000 --- a/ext/native/base/logging.h +++ /dev/null @@ -1,124 +0,0 @@ -#pragma once - -#include - -#include "ppsspp_config.h" -#include "base/backtrace.h" - -// Simple wrapper around Android's logging interface that also allows other -// implementations, and also some misc utilities. - -#ifdef _MSC_VER -// Disable annoying warnings in VS -#pragma warning (disable:4996) //strcpy may be dangerous, etc. -#endif - -#undef Crash - -#include -// Logging -#ifdef _WIN32 - -#ifdef _M_X64 -inline void Crash() { int *x = (int *)1337; *x = 1; } -#elif defined(_M_IX86) -inline void Crash() { __asm { int 3 }; } -#elif defined(_M_ARM) -inline void Crash() { int *x = (int *)1337; *x = 1; } -#elif defined(_M_ARM64) -inline void Crash() { int* x = (int*)1337; *x = 1; } -#endif - -#else - -#if defined(_M_IX86) || defined(_M_X64) -inline void Crash() { - PrintBacktraceToStderr(); - asm("int $0x3"); -} -#else -inline void Crash() { - PrintBacktraceToStderr(); - char *p = (char *)1337; - *p = 1; -} -#endif - -#endif - -#if defined(__ANDROID__) - -#include - -// Must only be used for logging -#ifndef APP_NAME -#define APP_NAME "PPSSPP" -#endif - -#ifdef _DEBUG -#define DLOG(...) __android_log_print(ANDROID_LOG_INFO, APP_NAME, __VA_ARGS__); -#else -#define DLOG(...) -#endif - -#define ILOG(...) __android_log_print(ANDROID_LOG_INFO, APP_NAME, __VA_ARGS__); -#define WLOG(...) __android_log_print(ANDROID_LOG_WARN, APP_NAME, __VA_ARGS__); -#define ELOG(...) __android_log_print(ANDROID_LOG_ERROR, APP_NAME, __VA_ARGS__); -#define FLOG(...) __android_log_print(ANDROID_LOG_FATAL, APP_NAME, __VA_ARGS__); - -#define MessageBox(a, b, c, d) __android_log_print(ANDROID_LOG_INFO, APP_NAME, "%s %s", (b), (c)); - -#else - -#ifdef _WIN32 - -const char *GetFn(const char *fn); - -#define XLOG_IMPL(type, ...) do {\ - char temp[512]; \ - char *p = temp; \ - int len = snprintf(p, sizeof(temp), type ": %s:%i: ", GetFn(__FILE__), __LINE__); \ - if (len < sizeof(temp)) { \ - p += len; \ - p += snprintf(p, sizeof(temp) - len - 3, type ": " __VA_ARGS__); \ - if (p > temp + sizeof(temp) - 3) \ - p = temp + sizeof(temp) - 3; \ - p += sprintf(p, "\n"); \ - OutputDebugStringUTF8(temp); \ - } \ -} while (false) - -#define DUMPLOG(x) OutputDebugStringUTF8(x) - -#ifdef _DEBUG -#define DLOG(...) XLOG_IMPL("D", __VA_ARGS__) -#else -#define DLOG(...) -#endif - -#define ILOG(...) XLOG_IMPL("I", __VA_ARGS__) -#define WLOG(...) XLOG_IMPL("W", __VA_ARGS__) -#define ELOG(...) XLOG_IMPL("E", __VA_ARGS__) -#define FLOG(...) do {XLOG_IMPL("F", __VA_ARGS__); Crash();} while (false) - -#else - -#include - -inline const char *removePath(const char *str) { - const char *slash = strrchr(str, '/'); - return slash ? (slash + 1) : str; -} - -#ifdef _DEBUG -#define DLOG(...) {printf("D: %s:%i: ", removePath(__FILE__), __LINE__); printf("D: " __VA_ARGS__); printf("\n");} -#else -#define DLOG(...) -#endif -#define ILOG(...) {printf("I: %s:%i: ", removePath(__FILE__), __LINE__); printf(__VA_ARGS__); printf("\n");} -#define WLOG(...) {printf("W: %s:%i: ", removePath(__FILE__), __LINE__); printf(__VA_ARGS__); printf("\n");} -#define ELOG(...) {printf("E: %s:%i: ", removePath(__FILE__), __LINE__); printf(__VA_ARGS__); printf("\n");} -#define FLOG(...) {printf("F: %s:%i: ", removePath(__FILE__), __LINE__); printf(__VA_ARGS__); printf("\n"); Crash();} - -#endif -#endif diff --git a/ext/native/native.vcxproj b/ext/native/native.vcxproj index d13049e3e9..afb7f0ffed 100644 --- a/ext/native/native.vcxproj +++ b/ext/native/native.vcxproj @@ -387,7 +387,6 @@ - @@ -496,7 +495,6 @@ - true true @@ -1217,4 +1215,4 @@ - \ No newline at end of file + diff --git a/libretro/Makefile.common b/libretro/Makefile.common index 1a347a8acb..c4ac5d2f4e 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -215,7 +215,6 @@ SOURCES_CXX += \ $(EXTDIR)/native/base/buffer.cpp \ $(EXTDIR)/native/base/colorutil.cpp \ $(EXTDIR)/native/base/display.cpp \ - $(EXTDIR)/native/base/logging.cpp \ $(EXTDIR)/native/base/stringutil.cpp \ $(EXTDIR)/native/base/timeutil.cpp \ $(EXTDIR)/native/data/compression.cpp \ From 004119fd32f63f0edba9a9226517e694b9f36192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 19:47:04 +0200 Subject: [PATCH 14/15] UWP buildfix --- UWP/StorageFileLoader.cpp | 1 + ext/native/gfx_es2/draw_text_uwp.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/UWP/StorageFileLoader.cpp b/UWP/StorageFileLoader.cpp index da0f6af19e..dcdbdcff76 100644 --- a/UWP/StorageFileLoader.cpp +++ b/UWP/StorageFileLoader.cpp @@ -3,6 +3,7 @@ #include "file/file_util.h" #include "thread/threadutil.h" #include "StorageFileLoader.h" +#include "Common/Log.h" #include "UWPUtil.h" using namespace Concurrency; diff --git a/ext/native/gfx_es2/draw_text_uwp.cpp b/ext/native/gfx_es2/draw_text_uwp.cpp index 9c3d9c21be..0e741b0077 100644 --- a/ext/native/gfx_es2/draw_text_uwp.cpp +++ b/ext/native/gfx_es2/draw_text_uwp.cpp @@ -7,6 +7,7 @@ #include "gfx_es2/draw_text.h" #include "gfx_es2/draw_text_uwp.h" +#include "Common/Log.h" #if PPSSPP_PLATFORM(UWP) @@ -70,7 +71,7 @@ TextDrawerUWP::TextDrawerUWP(Draw::DrawContext *draw) : TextDrawer(draw), ctx_(n IDXGIDevice* dxgiDevice; hr = d3ddevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice); - if (FAILED(hr)) FLOG("ID3DDevice QueryInterface IDXGIDevice failed"); + if (FAILED(hr)) _assert_msg_(false, "ID3DDevice QueryInterface IDXGIDevice failed"); // Initialize the Direct2D Factory. D2D1_FACTORY_OPTIONS options = {}; From 99a5a9aac5c02646097dac909054c529543e65a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 15 Aug 2020 20:02:07 +0200 Subject: [PATCH 15/15] Address feedback --- Common/LogManager.cpp | 2 +- Core/TextureReplacer.cpp | 1 + UI/NativeApp.cpp | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index 89dee6720e..8adf305dd6 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -98,7 +98,7 @@ static const LogNameTableEntry logTable[] = { {LogTypes::MEMMAP, "MEMMAP"}, {LogTypes::SASMIX, "SASMIX"}, {LogTypes::SAVESTATE, "SAVESTATE"}, - {LogTypes::FRAMEBUF, "FRAMEBUF"}, + {LogTypes::FRAMEBUF, "FRAMEBUF"}, {LogTypes::AUDIO, "AUDIO"}, {LogTypes::IO, "IO"}, diff --git a/Core/TextureReplacer.cpp b/Core/TextureReplacer.cpp index ad1de50dd4..16f0374fc4 100644 --- a/Core/TextureReplacer.cpp +++ b/Core/TextureReplacer.cpp @@ -385,6 +385,7 @@ static bool WriteTextureToPNG(png_imagep image, const std::string &filename, int } if (png_image_write_to_stdio(image, fp, convert_to_8bit, buffer, row_stride, colormap)) { + fclose(fp); return true; } else { ERROR_LOG(SYSTEM, "Texture PNG encode failed."); diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index db07804eb8..445d007269 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -1408,6 +1408,11 @@ void NativeShutdown() { g_Discord.Shutdown(); + if (logger) { + delete logger; + logger = nullptr; + } + // Previously we did exit() here on Android but that makes it hard to do things like restart on backend change. // I think we handle most globals correctly or correct-enough now. }