From 3f9f83941dd0db051bf19bfceca989b9cff67e31 Mon Sep 17 00:00:00 2001 From: DeaTh-G Date: Sat, 28 Feb 2026 15:30:43 +0100 Subject: [PATCH] implement cross platform debug flag --- UnleashedRecomp/CMakeLists.txt | 2 ++ UnleashedRecomp/gpu/video.cpp | 10 +++++----- UnleashedRecomp/kernel/xam.cpp | 2 +- UnleashedRecomp/os/logger.h | 8 ++++---- UnleashedRecomp/res/win32/res.rc.template | 2 +- UnleashedRecomp/user/config.cpp | 2 +- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/UnleashedRecomp/CMakeLists.txt b/UnleashedRecomp/CMakeLists.txt index 01e040ab8..95ec2d0ba 100644 --- a/UnleashedRecomp/CMakeLists.txt +++ b/UnleashedRecomp/CMakeLists.txt @@ -351,6 +351,8 @@ if (UNLEASHED_RECOMP_FLATPAK) "GAME_INSTALL_DIRECTORY=\"/var/data\"" ) endif() + +target_compile_definitions(UnleashedRecomp PRIVATE $<$:UNLEASHED_RECOMP_DEBUG=1>) find_package(CURL REQUIRED) diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index a9edd0b39..26f51100c 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -3145,7 +3145,7 @@ static GuestTexture* CreateTexture(uint32_t width, uint32_t height, uint32_t dep g_textureDescriptorSet->setTexture(texture->descriptorIndex, texture->texture, RenderTextureLayout::SHADER_READ, texture->textureView.get()); -#ifdef _DEBUG +#ifdef UNLEASHED_RECOMP_DEBUG texture->texture->setName(fmt::format("Texture {:X}", g_memory.MapVirtual(texture))); #endif @@ -3162,7 +3162,7 @@ static GuestBuffer* CreateVertexBuffer(uint32_t length) auto buffer = g_userHeap.AllocPhysical(ResourceType::VertexBuffer); buffer->buffer = g_device->createBuffer(RenderBufferDesc::VertexBuffer(length, GetBufferHeapType(), RenderBufferFlag::INDEX)); buffer->dataSize = length; -#ifdef _DEBUG +#ifdef UNLEASHED_RECOMP_DEBUG buffer->buffer->setName(fmt::format("Vertex Buffer {:X}", g_memory.MapVirtual(buffer))); #endif return buffer; @@ -3175,7 +3175,7 @@ static GuestBuffer* CreateIndexBuffer(uint32_t length, uint32_t, uint32_t format buffer->dataSize = length; buffer->format = ConvertFormat(format); buffer->guestFormat = format; -#ifdef _DEBUG +#ifdef UNLEASHED_RECOMP_DEBUG buffer->buffer->setName(fmt::format("Index Buffer {:X}", g_memory.MapVirtual(buffer))); #endif return buffer; @@ -3213,7 +3213,7 @@ static GuestSurface* CreateSurface(uint32_t width, uint32_t height, uint32_t for surface->descriptorIndex = g_textureDescriptorAllocator.allocate(); g_textureDescriptorSet->setTexture(surface->descriptorIndex, surface->textureHolder.get(), RenderTextureLayout::SHADER_READ, surface->textureView.get()); -#ifdef _DEBUG +#ifdef UNLEASHED_RECOMP_DEBUG surface->texture->setName(fmt::format("{} {:X}", desc.flags & RenderTextureFlag::RENDER_TARGET ? "Render Target" : "Depth Stencil", g_memory.MapVirtual(surface))); #endif @@ -5857,7 +5857,7 @@ static void MakePictureData(GuestPictureData* pictureData, uint8_t* data, uint32 if (LoadTexture(texture, data, dataSize, {})) { -#ifdef _DEBUG +#ifdef UNLEASHED_RECOMP_DEBUG texture.texture->setName(reinterpret_cast(g_memory.Translate(pictureData->name + 2))); #endif XXH64_hash_t hash = XXH3_64bits(data, dataSize); diff --git a/UnleashedRecomp/kernel/xam.cpp b/UnleashedRecomp/kernel/xam.cpp index 357b7911f..66597dcb1 100644 --- a/UnleashedRecomp/kernel/xam.cpp +++ b/UnleashedRecomp/kernel/xam.cpp @@ -203,7 +203,7 @@ uint32_t XamShowMessageBoxUI(uint32_t dwUserIndex, be* wszTitle, beReadValue(toml); -#if _DEBUG +#if UNLEASHED_RECOMP_DEBUG LOGFN_UTILITY("{} (0x{:X})", def->GetDefinition().c_str(), (intptr_t)def->GetValue()); #endif }