From 4be57f489646025945547d3c30142d13472a5c6d Mon Sep 17 00:00:00 2001 From: why-keith <60516230+why-keith@users.noreply.github.com> Date: Wed, 12 Apr 2023 15:31:34 +0100 Subject: [PATCH] Migrate force_log_printf to new logging (#714) --- src/Cafe/Account/Account.cpp | 4 +- src/Cafe/CafeSystem.cpp | 10 +-- src/Cafe/GamePatch.cpp | 18 ++-- src/Cafe/GraphicPack/GraphicPack2.cpp | 14 ++-- .../GraphicPack/GraphicPack2PatchesApply.cpp | 8 +- .../GraphicPack/GraphicPack2PatchesParser.cpp | 2 +- .../Interpreter/PPCInterpreterFPU.cpp | 4 +- src/Cafe/HW/Espresso/PPCTimer.cpp | 12 +-- .../HW/Espresso/Recompiler/PPCRecompiler.cpp | 6 +- .../Recompiler/PPCRecompilerImlGen.cpp | 2 +- src/Cafe/HW/Latte/Core/LatteBufferCache.cpp | 6 +- .../HW/Latte/Core/LatteGSCopyShaderParser.cpp | 2 +- src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp | 2 +- src/Cafe/HW/Latte/Core/LatteShader.cpp | 2 +- src/Cafe/HW/Latte/Core/LatteShaderCache.cpp | 4 +- src/Cafe/HW/Latte/Core/LatteShaderGL.cpp | 14 ++-- src/Cafe/HW/Latte/Core/LatteTexture.cpp | 6 +- src/Cafe/HW/Latte/Core/LatteTextureLoader.cpp | 6 +- .../HW/Latte/Core/LatteTextureReadback.cpp | 4 +- .../Latte/Renderer/OpenGL/LatteTextureGL.cpp | 4 +- .../Latte/Renderer/OpenGL/OpenGLRenderer.cpp | 26 +++--- .../Renderer/OpenGL/OpenGLRendererCore.cpp | 4 +- .../OpenGL/OpenGLRendererStreamout.cpp | 4 +- .../Renderer/OpenGL/RendererShaderGL.cpp | 12 +-- .../HW/Latte/Renderer/Vulkan/CocoaSurface.mm | 2 +- .../Renderer/Vulkan/LatteTextureViewVk.cpp | 4 +- .../Renderer/Vulkan/RendererShaderVk.cpp | 4 +- .../Latte/Renderer/Vulkan/SwapchainInfoVk.cpp | 20 ++--- .../Renderer/Vulkan/TextureReadbackVk.cpp | 2 +- .../Renderer/Vulkan/VKRMemoryManager.cpp | 8 +- .../Latte/Renderer/Vulkan/VKRMemoryManager.h | 2 +- .../HW/Latte/Renderer/Vulkan/VsyncDriver.cpp | 4 +- .../HW/Latte/Renderer/Vulkan/VulkanAPI.cpp | 10 +-- .../Vulkan/VulkanPipelineCompiler.cpp | 8 +- .../HW/Latte/Renderer/Vulkan/VulkanQuery.cpp | 6 +- .../Latte/Renderer/Vulkan/VulkanRenderer.cpp | 82 +++++++++---------- .../Renderer/Vulkan/VulkanRendererCore.cpp | 4 +- .../Renderer/Vulkan/VulkanSurfaceCopy.cpp | 6 +- src/Cafe/IOSU/legacy/iosu_acp.cpp | 12 +-- src/Cafe/IOSU/legacy/iosu_boss.cpp | 6 +- src/Cafe/IOSU/legacy/iosu_crypto.cpp | 14 ++-- src/Cafe/IOSU/legacy/iosu_fpd.cpp | 4 +- src/Cafe/IOSU/legacy/iosu_nim.cpp | 6 +- src/Cafe/OS/RPL/elf.cpp | 4 +- src/Cafe/OS/RPL/rpl.cpp | 20 ++--- src/Cafe/OS/libs/coreinit/coreinit.cpp | 8 +- .../OS/libs/coreinit/coreinit_CodeGen.cpp | 4 +- src/Cafe/OS/libs/coreinit/coreinit_FS.cpp | 17 ++-- src/Cafe/OS/libs/coreinit/coreinit_GHS.cpp | 4 +- .../OS/libs/coreinit/coreinit_LockedCache.cpp | 4 +- src/Cafe/OS/libs/coreinit/coreinit_MCP.cpp | 4 +- src/Cafe/OS/libs/coreinit/coreinit_MEM.cpp | 4 +- .../libs/coreinit/coreinit_MEM_BlockHeap.cpp | 2 +- .../OS/libs/coreinit/coreinit_MEM_ExpHeap.cpp | 2 +- .../coreinit/coreinit_Synchronization.cpp | 2 +- src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp | 4 +- src/Cafe/OS/libs/gx2/GX2_Command.cpp | 4 +- src/Cafe/OS/libs/gx2/GX2_Event.cpp | 6 +- src/Cafe/OS/libs/gx2/GX2_Misc.cpp | 2 +- src/Cafe/OS/libs/h264_avc/H264Dec.cpp | 2 +- src/Cafe/OS/libs/mic/mic.cpp | 4 +- src/Cafe/OS/libs/nn_boss/nn_boss.cpp | 18 ++-- src/Cafe/OS/libs/nn_fp/nn_fp.cpp | 2 +- src/Cafe/OS/libs/nn_idbe/nn_idbe.cpp | 6 +- src/Cafe/OS/libs/nn_nfp/AmiiboCrypto.h | 4 +- src/Cafe/OS/libs/nn_nfp/nn_nfp.cpp | 10 +-- src/Cafe/OS/libs/nn_olv/nn_olv.cpp | 4 +- src/Cafe/OS/libs/nsyshid/nsyshid.cpp | 18 ++-- src/Cafe/OS/libs/nsysnet/nsysnet.cpp | 12 +-- src/Cafe/OS/libs/snd_core/ax_mix.cpp | 2 +- src/Cafe/OS/libs/snd_core/ax_out.cpp | 6 +- src/Cafe/OS/libs/snd_core/ax_voice.cpp | 16 ++-- src/Cafe/OS/libs/sysapp/sysapp.cpp | 2 +- src/Cemu/FileCache/FileCache.cpp | 8 +- .../Tools/DownloadManager/DownloadManager.cpp | 2 +- src/Cemu/napi/napi_ec.cpp | 4 +- src/Cemu/napi/napi_helper.cpp | 16 ++-- src/Cemu/napi/napi_version.cpp | 4 +- src/Cemu/nex/nex.cpp | 34 ++++---- src/Cemu/nex/nexFriends.cpp | 6 +- src/Cemu/nex/prudp.cpp | 2 +- src/audio/DirectSoundAPI.cpp | 2 +- src/audio/IAudioAPI.cpp | 11 +-- src/audio/IAudioInputAPI.cpp | 4 +- src/audio/XAudio2API.cpp | 6 +- src/config/ActiveSettings.cpp | 2 +- src/config/CemuConfig.cpp | 16 ++-- src/config/LaunchSettings.cpp | 2 +- src/config/PermanentStorage.cpp | 2 +- src/config/XMLConfig.h | 2 +- src/gui/CemuUpdateWindow.cpp | 22 ++--- src/gui/ChecksumTool.cpp | 4 +- src/gui/DownloadGraphicPacksWindow.cpp | 2 +- src/gui/GameUpdateWindow.cpp | 2 +- src/gui/GeneralSettings2.cpp | 8 +- src/gui/MainWindow.cpp | 6 +- src/gui/TitleManager.cpp | 2 +- src/gui/canvas/VulkanCanvas.cpp | 2 +- src/gui/components/wxTitleManagerList.cpp | 2 +- .../dialogs/SaveImport/SaveImportWindow.cpp | 6 +- src/gui/dialogs/SaveImport/SaveTransfer.cpp | 2 +- src/imgui/imgui_impl_vulkan.cpp | 2 +- src/input/api/DSU/DSUControllerProvider.cpp | 2 +- .../GameCube/GameCubeControllerProvider.cpp | 22 ++--- src/input/api/SDL/SDLControllerProvider.cpp | 2 +- src/main.cpp | 4 +- src/util/ChunkedHeap/ChunkedHeap.h | 6 +- src/util/VirtualHeap/VirtualHeap.cpp | 4 +- 108 files changed, 401 insertions(+), 399 deletions(-) diff --git a/src/Cafe/Account/Account.cpp b/src/Cafe/Account/Account.cpp index 26767049..213cdd95 100644 --- a/src/Cafe/Account/Account.cpp +++ b/src/Cafe/Account/Account.cpp @@ -166,7 +166,7 @@ std::error_code Account::Load() } catch(const std::exception& ex) { - forceLog_printf("handled error in Account::Load: %s", ex.what()); + cemuLog_log(LogType::Force, "handled error in Account::Load: {}", ex.what()); return AccountErrc::ParseError; } } @@ -347,7 +347,7 @@ void Account::UpdatePersisidDat() f.close(); } else - forceLog_printf("Unable to save persisid.dat"); + cemuLog_log(LogType::Force, "Unable to save persisid.dat"); } bool Account::HasFreeAccountSlots() diff --git a/src/Cafe/CafeSystem.cpp b/src/Cafe/CafeSystem.cpp index d302e137..707f8f8f 100644 --- a/src/Cafe/CafeSystem.cpp +++ b/src/Cafe/CafeSystem.cpp @@ -133,7 +133,7 @@ void LoadMainExecutable() // otherwise search for first file with .rpx extension in the code folder if (!ScanForRPX()) { - forceLog_printf("Unable to find RPX executable"); + cemuLog_log(LogType::Force, "Unable to find RPX executable"); cemuLog_waitForFlush(); cemu_assert(false); } @@ -143,7 +143,7 @@ void LoadMainExecutable() uint8* rpxData = fsc_extractFile(_pathToExecutable.c_str(), &rpxSize); if (rpxData == nullptr) { - forceLog_printf("Failed to load \"%s\"", _pathToExecutable.c_str()); + cemuLog_log(LogType::Force, "Failed to load \"{}\"", _pathToExecutable); cemuLog_waitForFlush(); cemu_assert(false); } @@ -383,7 +383,7 @@ void cemu_initForGame() RPLLoader_Link(); RPLLoader_NotifyControlPassedToApplication(); uint32 linkTime = GetTickCount() - linkTimeStart; - forceLog_printf("RPL link time: %dms", linkTime); + cemuLog_log(LogType::Force, "RPL link time: {}ms", linkTime); // for HBL ELF: Setup OS-specifics struct if (isLaunchTypeELF) { @@ -406,13 +406,13 @@ void cemu_initForGame() } debugger_handleEntryBreakpoint(_entryPoint); // load graphic packs - forceLog_printf("------- Activate graphic packs -------"); + cemuLog_log(LogType::Force, "------- Activate graphic packs -------"); GraphicPack2::ActivateForCurrentTitle(); // print audio log IAudioAPI::PrintLogging(); IAudioInputAPI::PrintLogging(); // everything initialized - forceLog_printf("------- Run title -------"); + cemuLog_log(LogType::Force, "------- Run title -------"); // wait till GPU thread is initialized while (g_isGPUInitFinished == false) std::this_thread::sleep_for(std::chrono::milliseconds(50)); // init initial thread diff --git a/src/Cafe/GamePatch.cpp b/src/Cafe/GamePatch.cpp index 4134287e..ca10c197 100644 --- a/src/Cafe/GamePatch.cpp +++ b/src/Cafe/GamePatch.cpp @@ -300,7 +300,7 @@ void GamePatch_scan() if( hleAddr ) { #ifdef CEMU_DEBUG_ASSERT - forceLog_printf("HLE: XCX GPU hang detection"); + cemuLog_log(LogType::Force, "HLE: XCX GPU hang detection"); #endif // remove the ADDI r25, r25, 1 instruction memory_writeU32(hleAddr, memory_readU32(hleAddr+4)); @@ -310,7 +310,7 @@ void GamePatch_scan() if( hleAddr ) { #ifdef CEMU_DEBUG_ASSERT - forceLog_printf("HLE: Prevent XCX rendertarget reduction"); + cemuLog_log(LogType::Force, "HLE: Prevent XCX rendertarget reduction"); #endif uint32 bl = memory_readU32(hleAddr+0x14); uint32 func_isReductionBuffer = hleAddr + 0x14 + (bl&0x3FFFFFC); @@ -326,7 +326,7 @@ void GamePatch_scan() if (hleAddr) { #ifdef CEMU_DEBUG_ASSERT - forceLog_printf("HLE: Patch BotW busy loop 1 at 0x%08x", hleAddr); + cemuLog_log(LogType::Force, "HLE: Patch BotW busy loop 1 at 0x{:08x}", hleAddr); #endif sint32 functionIndex = hleIndex_h000000001; uint32 opcode = (1 << 26) | (functionIndex); // opcode for HLE: 0x1000 + FunctionIndex @@ -337,7 +337,7 @@ void GamePatch_scan() if (hleAddr) { #ifdef CEMU_DEBUG_ASSERT - forceLog_printf("HLE: Patch BotW busy loop 2 at 0x%08x", hleAddr); + cemuLog_log(LogType::Force, "HLE: Patch BotW busy loop 2 at 0x{:08x}", hleAddr); #endif sint32 functionIndex = hleIndex_h000000002; uint32 opcode = (1 << 26) | (functionIndex); // opcode for HLE: 0x1000 + FunctionIndex @@ -372,7 +372,7 @@ void GamePatch_scan() if (hleAddr) { uint32 patchAddr = hleAddr + 0x10; - forceLog_printf("HLE: Patch MH3U race condition candidate at 0x%08x", patchAddr); + cemuLog_log(LogType::Force, "HLE: Patch MH3U race condition candidate at 0x{:08x}", patchAddr); uint32 funcAddr = PPCInterpreter_makeCallableExportDepr(hleExport_mh3u_raceConditionWorkaround); // set absolute jump uint32 opc = 0x48000000; @@ -411,7 +411,7 @@ void GamePatch_scan() if (hleAddr) { // replace CMPL with CMP - forceLog_printf("Patching Bayonetta 2 audio bug at: 0x%08x", hleAddr+0x34); + cemuLog_log(LogType::Force, "Patching Bayonetta 2 audio bug at: 0x{:08x}", hleAddr+0x34); uint32 opc = memory_readU32(hleAddr + 0x34); opc &= ~(0x3FF << 1); // turn CMPL to CMP memory_writeU32(hleAddr + 0x34, opc); @@ -444,7 +444,7 @@ void GamePatch_scan() hleAddr = hle_locate(sm3dw_dynFrameBufferResScale, nullptr, sizeof(sm3dw_dynFrameBufferResScale)); if (hleAddr) { - forceLog_printf("Patching SM3DW dynamic resolution scaling at: 0x%08x", hleAddr); + cemuLog_log(LogType::Force, "Patching SM3DW dynamic resolution scaling at: 0x{:08x}", hleAddr); memory_writeU32(hleAddr, 0x4E800020); // BLR } @@ -453,7 +453,7 @@ void GamePatch_scan() hleAddr = hle_locate(tww_waitFunc, nullptr, sizeof(tww_waitFunc)); if (hleAddr) { - forceLog_printf("Patching TWW race conditon at: 0x%08x", hleAddr); + cemuLog_log(LogType::Force, "Patching TWW race conditon at: 0x{:08x}", hleAddr); // NOP calls to Lock/Unlock mutex memory_writeU32(hleAddr + 0x34, 0x60000000); memory_writeU32(hleAddr + 0x48, 0x60000000); @@ -462,7 +462,7 @@ void GamePatch_scan() } uint32 hleInstallEnd = GetTickCount(); - forceLog_printf("HLE scan time: %dms", hleInstallEnd-hleInstallStart); + cemuLog_log(LogType::Force, "HLE scan time: {}ms", hleInstallEnd-hleInstallStart); } RunAtCemuBoot _loadGamePatchAPI([]() diff --git a/src/Cafe/GraphicPack/GraphicPack2.cpp b/src/Cafe/GraphicPack/GraphicPack2.cpp index a0045f13..cc02d6ca 100644 --- a/src/Cafe/GraphicPack/GraphicPack2.cpp +++ b/src/Cafe/GraphicPack/GraphicPack2.cpp @@ -173,7 +173,7 @@ void GraphicPack2::ActivateForCurrentTitle() { if (gp->GetPresets().empty()) { - forceLog_printf("Activate graphic pack: %s", gp->GetPath().c_str()); + cemuLog_log(LogType::Force, "Activate graphic pack: {}", gp->GetPath()); } else { @@ -720,7 +720,7 @@ void GraphicPack2::LoadShaders() } catch (const std::exception& ex) { - forceLog_printf("graphicPack: error while loading custom shader: %s", ex.what()); + cemuLog_log(LogType::Force, "graphicPack: error while loading custom shader: {}", ex.what()); } } } @@ -743,7 +743,7 @@ bool GraphicPack2::IsPresetVisible(const PresetPtr& preset) const } catch (const std::exception& ex) { - forceLog_printf("error when trying to check visiblity of preset: %s", ex.what()); + cemuLog_log(LogType::Force, "error when trying to check visiblity of preset: {}", ex.what()); return false; } } @@ -974,7 +974,7 @@ bool GraphicPack2::Activate() } catch(const std::exception& ex) { - forceLog_printf((char*)ex.what()); + cemuLog_log(LogType::Force, ex.what()); return false; } @@ -998,11 +998,11 @@ bool GraphicPack2::Activate() if (LatteTiming_getCustomVsyncFrequency(globalCustomVsyncFreq)) { if (customVsyncFreq != globalCustomVsyncFreq) - forceLog_printf("rules.txt error: Mismatching vsync frequency %d in graphic pack \'%s\'", customVsyncFreq, GetPath().c_str()); + cemuLog_log(LogType::Force, "rules.txt error: Mismatching vsync frequency {} in graphic pack \'{}\'", customVsyncFreq, GetPath()); } else { - forceLog_printf("Set vsync frequency to %d (graphic pack %s)", customVsyncFreq, GetPath().c_str()); + cemuLog_log(LogType::Force, "Set vsync frequency to {} (graphic pack {})", customVsyncFreq, GetPath()); LatteTiming_setCustomVsyncFrequency(customVsyncFreq); } } @@ -1255,4 +1255,4 @@ std::vector> GraphicPack2::GetActiveRAMMappings() return a.first < b.first; }); return v; -} \ No newline at end of file +} diff --git a/src/Cafe/GraphicPack/GraphicPack2PatchesApply.cpp b/src/Cafe/GraphicPack/GraphicPack2PatchesApply.cpp index 98a5b693..c1bee5eb 100644 --- a/src/Cafe/GraphicPack/GraphicPack2PatchesApply.cpp +++ b/src/Cafe/GraphicPack/GraphicPack2PatchesApply.cpp @@ -353,7 +353,7 @@ PATCH_RESOLVE_RESULT PatchEntryInstruction::resolveReloc(PatchContext_t& ctx, PP // absolute if (result >= 0x3FFFFFC) { - forceLog_printf("Target \'%s\' for branch at line %d out of range", reloc->m_expression.c_str(), m_lineNumber); + cemuLog_log(LogType::Force, "Target \'{}\' for branch at line {} out of range", reloc->m_expression, m_lineNumber); return PATCH_RESOLVE_RESULT::VALUE_ERROR; } opcode &= ~0x3FFFFFC; @@ -438,7 +438,7 @@ PATCH_RESOLVE_RESULT PatchEntryInstruction::resolve(PatchContext_t& ctx) { if (_relocateAddress(resolverState.currentGroup, &ctx, m_addr, m_relocatedAddr) == false) { - forceLog_printf("Patches: Address 0x%08x (line %d) is not within code cave or any module section", this->getAddr(), this->m_lineNumber); + cemuLog_log(LogType::Force, "Patches: Address 0x{:08x} (line {}) is not within code cave or any module section", this->getAddr(), this->m_lineNumber); cemu_assert_debug(false); return PATCH_RESOLVE_RESULT::INVALID_ADDRESS; } @@ -639,12 +639,12 @@ void GraphicPack2::ApplyPatchGroups(std::vector& groups, const RPLM if (patchGroup->codeCaveSize > 0) { auto codeCaveMem = RPLLoader_AllocateCodeCaveMem(256, patchGroup->codeCaveSize); - forceLog_printf("Applying patch group \'%s\' (Codecave: %08x-%08x)", patchGroup->name.c_str(), codeCaveMem.GetMPTR(), codeCaveMem.GetMPTR() + patchGroup->codeCaveSize); + cemuLog_log(LogType::Force, "Applying patch group \'{}\' (Codecave: {:08x}-{:08x})", patchGroup->name, codeCaveMem.GetMPTR(), codeCaveMem.GetMPTR() + patchGroup->codeCaveSize); patchGroup->codeCaveMem = codeCaveMem; } else { - forceLog_printf("Applying patch group \'%s\'", patchGroup->name.c_str()); + cemuLog_log(LogType::Force, "Applying patch group \'{}\'", patchGroup->name); patchGroup->codeCaveMem = nullptr; } } diff --git a/src/Cafe/GraphicPack/GraphicPack2PatchesParser.cpp b/src/Cafe/GraphicPack/GraphicPack2PatchesParser.cpp index 12f97ef7..ce04bf93 100644 --- a/src/Cafe/GraphicPack/GraphicPack2PatchesParser.cpp +++ b/src/Cafe/GraphicPack/GraphicPack2PatchesParser.cpp @@ -68,7 +68,7 @@ void GraphicPack2::AddPatchGroup(PatchGroup* group) if (group->list_patches.size() < (numEstimatedCodeCaveInstr / 8)) { // if less than 1/8th of the code cave is filled print a warning - forceLog_printf("Graphic pack patches: Code cave for group [%s] in gfx pack \"%s\" ranges from 0 to 0x%x but has only few instructions. Is this intentional?", group->name.c_str(), this->m_name.c_str(), codeCaveMaxAddr); + cemuLog_log(LogType::Force, "Graphic pack patches: Code cave for group [{}] in gfx pack \"{}\" ranges from 0 to 0x{:x} but has only few instructions. Is this intentional?", group->name, this->m_name, codeCaveMaxAddr); } group->codeCaveSize = codeCaveMaxAddr; list_patchGroups.emplace_back(group); diff --git a/src/Cafe/HW/Espresso/Interpreter/PPCInterpreterFPU.cpp b/src/Cafe/HW/Espresso/Interpreter/PPCInterpreterFPU.cpp index a33a1be6..aed571d7 100644 --- a/src/Cafe/HW/Espresso/Interpreter/PPCInterpreterFPU.cpp +++ b/src/Cafe/HW/Espresso/Interpreter/PPCInterpreterFPU.cpp @@ -515,7 +515,7 @@ void PPCInterpreter_MTFSF(PPCInterpreter_t* hCPU, uint32 Opcode) static bool logFPSCRWriteOnce = false; if( logFPSCRWriteOnce == false ) { - forceLog_printf("Unsupported write to FPSCR\n"); + cemuLog_log(LogType::Force, "Unsupported write to FPSCR"); logFPSCRWriteOnce = true; } PPCInterpreter_nextInstruction(hCPU); @@ -697,4 +697,4 @@ void PPCInterpreter_FCMPU(PPCInterpreter_t* hCPU, uint32 Opcode) fcmpu_espresso(hCPU, crfD, hCPU->fpr[frA].fp0, hCPU->fpr[frB].fp0); PPCInterpreter_nextInstruction(hCPU); -} \ No newline at end of file +} diff --git a/src/Cafe/HW/Espresso/PPCTimer.cpp b/src/Cafe/HW/Espresso/PPCTimer.cpp index fe105962..c27c94ee 100644 --- a/src/Cafe/HW/Espresso/PPCTimer.cpp +++ b/src/Cafe/HW/Espresso/PPCTimer.cpp @@ -60,12 +60,12 @@ uint64 PPCTimer_estimateRDTSCFrequency() uint64 tsc_freq = muldiv64(tsc_diff, hrtFreq, hrtDiff); // uint64 freqMultiplier = tsc_freq / hrtFreq; - //forceLog_printf("RDTSC measurement test:"); - //forceLog_printf("TSC-diff: 0x%016llx", tsc_diff); - //forceLog_printf("TSC-freq: 0x%016llx", tsc_freq); - //forceLog_printf("HPC-diff: 0x%016llx", qpc_diff); - //forceLog_printf("HPC-freq: 0x%016llx", (uint64)qpc_freq.QuadPart); - //forceLog_printf("Multiplier: 0x%016llx", freqMultiplier); + //cemuLog_log(LogType::Force, "RDTSC measurement test:"); + //cemuLog_log(LogType::Force, "TSC-diff: 0x{:016x}", tsc_diff); + //cemuLog_log(LogType::Force, "TSC-freq: 0x{:016x}", tsc_freq); + //cemuLog_log(LogType::Force, "HPC-diff: 0x{:016x}", qpc_diff); + //cemuLog_log(LogType::Force, "HPC-freq: 0x{:016x}", (uint64)qpc_freq.QuadPart); + //cemuLog_log(LogType::Force, "Multiplier: 0x{:016x}", freqMultiplier); return tsc_freq; } diff --git a/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.cpp b/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.cpp index 92b72b82..28c3e714 100644 --- a/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.cpp +++ b/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.cpp @@ -82,7 +82,7 @@ void PPCRecompiler_enter(PPCInterpreter_t* hCPU, PPCREC_JUMP_ENTRY funcPtr) { auto t = std::chrono::high_resolution_clock::now(); auto dur = std::chrono::duration_cast(t.time_since_epoch()).count(); - forceLog_printf("Recompiler exit: 0x%08x LR: 0x%08x Timestamp %lld.%04lld", hCPU->instructionPointer, hCPU->spr.LR, dur / 1000LL, (dur % 1000LL)); + cemuLog_log(LogType::Force, "Recompiler exit: 0x{:08x} LR: 0x{:08x} Timestamp {}.{:04}", hCPU->instructionPointer, hCPU->spr.LR, dur / 1000LL, (dur % 1000LL)); } #endif #else @@ -341,7 +341,7 @@ void PPCRecompiler_reserveLookupTableBlock(uint32 offset) void* p3 = MemMapper::AllocateMemory(&(ppcRecompilerInstanceData->ppcRecompilerDirectJumpTable[offset/4]), (PPC_REC_ALLOC_BLOCK_SIZE/4)*sizeof(void*), MemMapper::PAGE_PERMISSION::P_RW, true); if( !p1 || !p3 ) { - forceLog_printf("Failed to allocate memory for recompiler (0x%08x)", offset); + cemuLog_log(LogType::Force, "Failed to allocate memory for recompiler (0x{:08x})", offset); cemu_assert(false); return; } @@ -584,7 +584,7 @@ void PPCRecompiler_init() PPCRecompiler_initPlatform(); - forceLog_printf("Recompiler initialized"); + cemuLog_log(LogType::Force, "Recompiler initialized"); ppcRecompilerEnabled = true; diff --git a/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp b/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp index 485c85bf..b9685488 100644 --- a/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp +++ b/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp @@ -643,7 +643,7 @@ bool PPCRecompilerImlGen_B(ppcImlGenContext_t* ppcImlGenContext, uint32 opcode) { // generate NOP iml instead of BL macro (this assures that segment PPC range remains intact) PPCRecompilerImlGen_generateNewInstruction_noOp(ppcImlGenContext, NULL); - //forceLog_printf("Inline func 0x%08x at %08x", jumpAddressDest, ppcImlGenContext->ppcAddressOfCurrentInstruction); + //cemuLog_log(LogType::Force, "Inline func 0x{:08x} at {:08x}", jumpAddressDest, ppcImlGenContext->ppcAddressOfCurrentInstruction); uint32* prevInstructionPtr = ppcImlGenContext->currentInstruction; ppcImlGenContext->currentInstruction = (uint32*)memory_getPointerFromVirtualOffset(jumpAddressDest); PPCRecompiler_generateInlinedCode(ppcImlGenContext, jumpAddressDest, inlineFuncInstructionCount); diff --git a/src/Cafe/HW/Latte/Core/LatteBufferCache.cpp b/src/Cafe/HW/Latte/Core/LatteBufferCache.cpp index b0917895..7c484bcb 100644 --- a/src/Cafe/HW/Latte/Core/LatteBufferCache.cpp +++ b/src/Cafe/HW/Latte/Core/LatteBufferCache.cpp @@ -871,11 +871,11 @@ public: // retry allocation if (!newRange->allocateCacheMemory()) { - forceLog_printf("Out-of-memory in GPU buffer (trying to allocate: %dKB) Cleaning up cache...", (rangeEnd - rangeBegin + 1023) / 1024); + cemuLog_log(LogType::Force, "Out-of-memory in GPU buffer (trying to allocate: {}KB) Cleaning up cache...", (rangeEnd - rangeBegin + 1023) / 1024); CleanupCacheAggressive(rangeBegin, rangeEnd); if (!newRange->allocateCacheMemory()) { - forceLog_printf("Failed to free enough memory in GPU buffer"); + cemuLog_log(LogType::Force, "Failed to free enough memory in GPU buffer"); cemu_assert(false); } } @@ -907,7 +907,7 @@ public: // todo - add support for splitting BufferCacheNode memory allocations, then we dont need to do a separate allocation if (!newRange->allocateCacheMemory()) { - forceLog_printf("Out-of-memory in GPU buffer during split operation"); + cemuLog_log(LogType::Force, "Out-of-memory in GPU buffer during split operation"); cemu_assert(false); } newRange->syncFromNode(nodeObject); diff --git a/src/Cafe/HW/Latte/Core/LatteGSCopyShaderParser.cpp b/src/Cafe/HW/Latte/Core/LatteGSCopyShaderParser.cpp index 1c0752f1..16ce0737 100644 --- a/src/Cafe/HW/Latte/Core/LatteGSCopyShaderParser.cpp +++ b/src/Cafe/HW/Latte/Core/LatteGSCopyShaderParser.cpp @@ -222,7 +222,7 @@ LatteParsedGSCopyShader* LatteGSCopyShaderParser_parse(uint8* programData, uint3 } else { - forceLog_printf("Copyshader: Unknown 23_7 clause 0x%x found\n", cf_inst23_7); + cemuLog_log(LogType::Force, "Copyshader: Unknown 23_7 clause 0x{:x} found", cf_inst23_7); cemu_assert_debug(false); } if( isEndOfProgram ) diff --git a/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp b/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp index 9b996590..fc590d81 100644 --- a/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp +++ b/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp @@ -507,7 +507,7 @@ bool LatteMRT::UpdateCurrentFBO() else if (rtEffectiveSize->width != effectiveWidth && rtEffectiveSize->height != effectiveHeight) { #ifdef CEMU_DEBUG_ASSERT - forceLog_printf("Color buffer size mismatch (%dx%d). Effective size: %dx%d Real size: %dx%d Mismatching texture: %08x %dx%d fmt %04x", rtEffectiveSize->width, rtEffectiveSize->height, effectiveWidth, effectiveHeight, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, colorAttachmentView->baseTexture->physAddress, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, (uint32)colorAttachmentView->baseTexture->format); + cemuLog_log(LogType::Force, "Color buffer size mismatch ({}x{}). Effective size: {}x{} Real size: {}x{} Mismatching texture: {:08x} {}x{} fmt {:04x}", rtEffectiveSize->width, rtEffectiveSize->height, effectiveWidth, effectiveHeight, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, colorAttachmentView->baseTexture->physAddress, colorAttachmentView->baseTexture->width, colorAttachmentView->baseTexture->height, (uint32)colorAttachmentView->baseTexture->format); #endif } // currently the first color attachment defines the size of the current render target diff --git a/src/Cafe/HW/Latte/Core/LatteShader.cpp b/src/Cafe/HW/Latte/Core/LatteShader.cpp index 00a49f02..c1f50910 100644 --- a/src/Cafe/HW/Latte/Core/LatteShader.cpp +++ b/src/Cafe/HW/Latte/Core/LatteShader.cpp @@ -301,7 +301,7 @@ void LatteShader_CreateRendererShader(LatteDecompilerShader* shader, bool compil { if (shader->hasError ) { - forceLog_printf("Unable to compile shader %" PRIx64, shader->baseHash); + cemuLog_log(LogType::Force, "Unable to compile shader {:016x}", shader->baseHash); return; } diff --git a/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp b/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp index d33c3b50..f413c925 100644 --- a/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp +++ b/src/Cafe/HW/Latte/Core/LatteShaderCache.cpp @@ -319,7 +319,7 @@ void LatteShaderCache_load() if (LatteShaderCache_readSeparableShader(fileData.data(), fileData.size()) == false) { // something is wrong with the stored shader, remove entry from shader cache files - forceLog_printf("Shader cache entry %d invalid, deleting...", loadIndex); + cemuLog_log(LogType::Force, "Shader cache entry {} invalid, deleting...", loadIndex); fc_shaderCacheGeneric->DeleteFile({ name1, name2 }); } numLoadedShaders++; @@ -338,7 +338,7 @@ void LatteShaderCache_load() GetProcessMemoryInfo(GetCurrentProcess(), &pmc2, sizeof(PROCESS_MEMORY_COUNTERS)); LONGLONG totalMem2 = pmc2.PagefileUsage; LONGLONG memCommited = totalMem2 - totalMem1; - forceLog_printf("Shader cache loaded with %d shaders. Commited mem %dMB. Took %dms", numLoadedShaders, (sint32)(memCommited/1024/1024), timeLoad); + cemuLog_log(LogType::Force, "Shader cache loaded with {} shaders. Commited mem {}MB. Took {}ms", numLoadedShaders, (sint32)(memCommited/1024/1024), timeLoad); #endif LatteShaderCache_finish(); // if Vulkan then also load pipeline cache diff --git a/src/Cafe/HW/Latte/Core/LatteShaderGL.cpp b/src/Cafe/HW/Latte/Core/LatteShaderGL.cpp index 3d5e9c72..b8cb0ce1 100644 --- a/src/Cafe/HW/Latte/Core/LatteShaderGL.cpp +++ b/src/Cafe/HW/Latte/Core/LatteShaderGL.cpp @@ -19,7 +19,7 @@ bool gxShader_checkIfSuccessfullyLinked(GLuint glProgram) tempLength = sizeof(infoLog)-1; glGetProgramInfoLog(glProgram, std::min(tempLength, infoLogLength), (GLsizei*)&tempLength, (GLcharARB*)infoLog); infoLog[tempLength] = '\0'; - forceLog_printf("Link error in raw shader"); + cemuLog_log(LogType::Force, "Link error in raw shader"); cemuLog_log(LogType::Force, infoLog); return false; } @@ -83,8 +83,8 @@ GLuint gpu7ShaderGLDepr_compileShader(const std::string& source, uint32_t type) char log[2048]{}; GLsizei log_size; glGetShaderInfoLog(shader_object, std::min(log_length, (GLint)sizeof(log) - 1), &log_size, log); - forceLog_printf("Error/Warning in vertex shader:"); - forceLog_printf("%s", log); + cemuLog_log(LogType::Force, "Error/Warning in vertex shader:"); + cemuLog_log(LogType::Force, log); } return shader_object; @@ -112,8 +112,8 @@ GLuint gpu7ShaderGLDepr_compileVertexShader(const char* shaderSource, sint32 sha { char messageLog[2048]{}; glGetShaderInfoLog(shaderObject, std::min(shaderLogLengthInfo, sizeof(messageLog) - 1), (GLsizei*)&shaderLogLen, (GLcharARB*)messageLog); - forceLog_printf("Error/Warning in vertex shader:"); - forceLog_printf("%s", messageLog); + cemuLog_log(LogType::Force, "Error/Warning in vertex shader:"); + cemuLog_log(LogType::Force, messageLog); } return shaderObject; } @@ -132,8 +132,8 @@ GLuint gpu7ShaderGLDepr_compileFragmentShader(const char* shaderSource, sint32 s { memset(messageLog, 0, sizeof(messageLog)); glGetShaderInfoLog(shaderObject, std::min(shaderLogLengthInfo, sizeof(messageLog) - 1), (GLsizei*)&shaderLogLen, (GLcharARB*)messageLog); - forceLog_printf("Error/Warning in fragment shader:"); - forceLog_printf("%s", messageLog); + cemuLog_log(LogType::Force, "Error/Warning in fragment shader:"); + cemuLog_log(LogType::Force, messageLog); } return shaderObject; } diff --git a/src/Cafe/HW/Latte/Core/LatteTexture.cpp b/src/Cafe/HW/Latte/Core/LatteTexture.cpp index 17621c8f..4405f419 100644 --- a/src/Cafe/HW/Latte/Core/LatteTexture.cpp +++ b/src/Cafe/HW/Latte/Core/LatteTexture.cpp @@ -376,13 +376,13 @@ void LatteTexture_CopySlice(LatteTexture* srcTexture, sint32 srcSlice, sint32 sr sint32 effectiveHeight_dst = dstTexture->overwriteInfo.hasResolutionOverwrite ? dstTexture->overwriteInfo.height : dstTexture->height; if (cafeLog_isLoggingFlagEnabled(LOG_TYPE_TEXTURE_CACHE)) { - forceLog_printf("_copySlice(): Unable to sync textures with mismatching scale ratio (due to texture rule)"); + cemuLog_log(LogType::Force, "_copySlice(): Unable to sync textures with mismatching scale ratio (due to texture rule)"); float ratioWidth_src = (float)effectiveWidth_src / (float)srcTexture->width; float ratioHeight_src = (float)effectiveHeight_src / (float)srcTexture->height; float ratioWidth_dst = (float)effectiveWidth_dst / (float)dstTexture->width; float ratioHeight_dst = (float)effectiveHeight_dst / (float)dstTexture->height; - forceLog_printf("Source: %08x origResolution %4d/%4d effectiveResolution %4d/%4d fmt %04x mipIndex %d ratioW/H: %.4f/%.4f", srcTexture->physAddress, srcTexture->width, srcTexture->height, effectiveWidth_src, effectiveHeight_src, (uint32)srcTexture->format, srcMip, ratioWidth_src, ratioHeight_src); - forceLog_printf("Destination: %08x origResolution %4d/%4d effectiveResolution %4d/%4d fmt %04x mipIndex %d ratioW/H: %.4f/%.4f", dstTexture->physAddress, dstTexture->width, dstTexture->height, effectiveWidth_dst, effectiveHeight_dst, (uint32)dstTexture->format, dstMip, ratioWidth_dst, ratioHeight_dst); + cemuLog_log(LogType::Force, "Source: {:08x} origResolution {:4}/{:4} effectiveResolution {:4}/{:4} fmt {:04x} mipIndex {} ratioW/H: {:.4}/{:.4}", srcTexture->physAddress, srcTexture->width, srcTexture->height, effectiveWidth_src, effectiveHeight_src, (uint32)srcTexture->format, srcMip, ratioWidth_src, ratioHeight_src); + cemuLog_log(LogType::Force, "Destination: {:08x} origResolution {:4}/{:4} effectiveResolution {:4}/{:4} fmt {:04x} mipIndex {} ratioW/H: {:.4}/{:.4}", dstTexture->physAddress, dstTexture->width, dstTexture->height, effectiveWidth_dst, effectiveHeight_dst, (uint32)dstTexture->format, dstMip, ratioWidth_dst, ratioHeight_dst); } //forceLogDebug_printf("If these textures are not meant to share data you can ignore this"); return; diff --git a/src/Cafe/HW/Latte/Core/LatteTextureLoader.cpp b/src/Cafe/HW/Latte/Core/LatteTextureLoader.cpp index 7782e3d6..2e5ab2a3 100644 --- a/src/Cafe/HW/Latte/Core/LatteTextureLoader.cpp +++ b/src/Cafe/HW/Latte/Core/LatteTextureLoader.cpp @@ -661,7 +661,7 @@ void LatteTextureLoader_UpdateTextureSliceData(LatteTexture* tex, sint32 texture uint64 benchmarkResultMicroSeconds = (benchmark_end.QuadPart - benchmark_begin.QuadPart) * 1000000ULL / benchmark_freq.QuadPart; textureDecodeBenchmark_perFormatSum[(int)tex->format & 0x3F] += benchmarkResultMicroSeconds; textureDecodeBenchmark_totalSum += benchmarkResultMicroSeconds; - forceLog_printf("TexDecode %04dx%04dx%04d Fmt %04x Dim %d TileMode %02x Took %03d.%03dms Sum(format) %06dms Sum(total) %06dms", textureLoader.width, textureLoader.height, textureLoader.surfaceInfoDepth, (int)tex->format, (int)tex->dim, textureLoader.tileMode, (uint32)(benchmarkResultMicroSeconds / 1000ULL), (uint32)(benchmarkResultMicroSeconds % 1000ULL), (uint32)(textureDecodeBenchmark_perFormatSum[tex->gx2Format & 0x3F] / 1000ULL), (uint32)(textureDecodeBenchmark_totalSum / 1000ULL)); + cemuLog_log(LogType::Force, "TexDecode {:04}x{:04}x{:04} Fmt {:04x} Dim {} TileMode {:02x} Took {:03}.{:03}ms Sum(format) {:06}ms Sum(total) {:06}ms", textureLoader.width, textureLoader.height, textureLoader.surfaceInfoDepth, (int)tex->format, (int)tex->dim, textureLoader.tileMode, (uint32)(benchmarkResultMicroSeconds / 1000ULL), (uint32)(benchmarkResultMicroSeconds % 1000ULL), (uint32)(textureDecodeBenchmark_perFormatSum[tex->gx2Format & 0x3F] / 1000ULL), (uint32)(textureDecodeBenchmark_totalSum / 1000ULL)); #endif // convert texture to RGBA when dumping is enabled @@ -738,11 +738,11 @@ void LatteTextureLoader_writeReadbackTextureToMemory(LatteTextureDefinition* tex #ifdef CEMU_DEBUG_ASSERT if (textureData->depth != 1) - forceLog_printf("_writeReadbackTextureToMemory(): Texture has multiple slices (not supported)"); + cemuLog_log(LogType::Force, "_writeReadbackTextureToMemory(): Texture has multiple slices (not supported)"); #endif if (textureLoader.physAddress == MPTR_NULL) { - forceLog_printf("_writeReadbackTextureToMemory(): Texture has invalid address"); + cemuLog_log(LogType::Force, "_writeReadbackTextureToMemory(): Texture has invalid address"); return; } diff --git a/src/Cafe/HW/Latte/Core/LatteTextureReadback.cpp b/src/Cafe/HW/Latte/Core/LatteTextureReadback.cpp index 9018fba6..0483e8ee 100644 --- a/src/Cafe/HW/Latte/Core/LatteTextureReadback.cpp +++ b/src/Cafe/HW/Latte/Core/LatteTextureReadback.cpp @@ -76,7 +76,7 @@ void LatteTextureReadback_Initate(LatteTextureView* textureView) // currently we don't support readback for resized textures if (textureView->baseTexture->overwriteInfo.hasResolutionOverwrite) { - forceLog_printf("_initate(): Readback is not supported for textures with modified resolution"); + cemuLog_log(LogType::Force, "_initate(): Readback is not supported for textures with modified resolution"); return; } // check if texture isn't already queued for transfer @@ -128,7 +128,7 @@ void LatteTextureReadback_UpdateFinishedTransfers(bool forceFinish) HRTick currentTick = HighResolutionTimer().now().getTick(); double elapsedSecondsTransfer = HighResolutionTimer::getTimeDiff(readbackInfo->transferStartTime, currentTick); double elapsedSecondsWaiting = HighResolutionTimer::getTimeDiff(readbackInfo->waitStartTime, currentTick); - forceLog_printf("[Texture-Readback] %08x Res %4d/%4d TM %d FMT %04x ReadbackLatency: %6.3lfms WaitTime: %6.3lfms ForcedWait %s", readbackInfo->hostTextureCopy.physAddress, readbackInfo->hostTextureCopy.width, readbackInfo->hostTextureCopy.height, readbackInfo->hostTextureCopy.tileMode, (uint32)readbackInfo->hostTextureCopy.format, elapsedSecondsTransfer * 1000.0, elapsedSecondsWaiting * 1000.0, forceFinish?"yes":"no"); + cemuLog_log(LogType::Force, "[Texture-Readback] {:08x} Res {:4}/{:4} TM {} FMT {:04x} ReadbackLatency: {:6.3}ms WaitTime: {:6.3}ms ForcedWait {}", readbackInfo->hostTextureCopy.physAddress, readbackInfo->hostTextureCopy.width, readbackInfo->hostTextureCopy.height, readbackInfo->hostTextureCopy.tileMode, (uint32)readbackInfo->hostTextureCopy.format, elapsedSecondsTransfer * 1000.0, elapsedSecondsWaiting * 1000.0, forceFinish?"yes":"no"); #endif uint8* pixelData = readbackInfo->GetData(); LatteTextureLoader_writeReadbackTextureToMemory(&readbackInfo->hostTextureCopy, 0, 0, pixelData); diff --git a/src/Cafe/HW/Latte/Renderer/OpenGL/LatteTextureGL.cpp b/src/Cafe/HW/Latte/Renderer/OpenGL/LatteTextureGL.cpp index b0d0dbe9..c9541470 100644 --- a/src/Cafe/HW/Latte/Renderer/OpenGL/LatteTextureGL.cpp +++ b/src/Cafe/HW/Latte/Renderer/OpenGL/LatteTextureGL.cpp @@ -125,7 +125,7 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma return; } // unsupported depth format - forceLog_printf("OpenGL: Unsupported texture depth format 0x%04x", (uint32)format); + cemuLog_log(LogType::Force, "OpenGL: Unsupported texture depth format 0x{:04x}", (uint32)format); // use placeholder format formatInfoOut->setDepthFormat(GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, false); formatInfoOut->markAsAlternativeFormat(); @@ -499,7 +499,7 @@ void LatteTextureGL::GetOpenGLFormatInfo(bool isDepth, Latte::E_GX2SURFFMT forma } else { - forceLog_printf("OpenGL: Unsupported texture format 0x%04x", (uint32)format); + cemuLog_log(LogType::Force, "OpenGL: Unsupported texture format 0x{:04x}", (uint32)format); cemu_assert_unimplemented(); } formatInfoOut->glInternalFormat = glInternalFormat; diff --git a/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.cpp b/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.cpp index 7b5cfcc8..a830b59c 100644 --- a/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.cpp +++ b/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRenderer.cpp @@ -89,7 +89,7 @@ OpenGLRenderer::OpenGLRenderer() void* buffer = glMapNamedBufferRange(glRendererState.uploadBuffer, 0, TEXBUFFER_SIZE, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_FLUSH_EXPLICIT_BIT); if (buffer == nullptr) { - forceLog_printf("Failed to allocate GL texture upload buffer. Using traditional API instead"); + cemuLog_log(LogType::Force, "Failed to allocate GL texture upload buffer. Using traditional API instead"); cemu_assert_debug(false); } glRendererState.uploadBufferPtr = buffer; @@ -104,7 +104,7 @@ OpenGLRenderer::OpenGLRenderer() } catch (const std::exception& ex) { - forceLog_printf("Unable to create dxgi wrapper: %s (VRAM overlay stat won't be available)", ex.what()); + cemuLog_log(LogType::Force, "Unable to create dxgi wrapper: {} (VRAM overlay stat won't be available)", ex.what()); } #endif } @@ -254,7 +254,7 @@ void OpenGLRenderer::Initialize() { Renderer::Initialize(); auto lock = cafeLog_acquire(); - forceLog_printf("------- Init OpenGL graphics backend -------"); + cemuLog_log(LogType::Force, "------- Init OpenGL graphics backend -------"); GLCanvas_MakeCurrent(false); LoadOpenGLImports(); @@ -268,12 +268,12 @@ void OpenGLRenderer::Initialize() if (glMaxShaderCompilerThreadsARB) glMaxShaderCompilerThreadsARB(0xFFFFFFFF); - forceLog_printf("OpenGL extensions:"); - forceLog_printf("ARB_clip_control: %s", glClipControl ? "available" : "not supported"); - forceLog_printf("ARB_get_program_binary: %s", (glGetProgramBinary != NULL && glProgramBinary != NULL) ? "available" : "not supported"); - forceLog_printf("ARB_clear_texture: %s", (glClearTexImage != NULL) ? "available" : "not supported"); - forceLog_printf("ARB_copy_image: %s", (glCopyImageSubData != NULL) ? "available" : "not supported"); - forceLog_printf("NV_depth_buffer_float: %s", (glDepthRangedNV != NULL) ? "available" : "not supported"); + cemuLog_log(LogType::Force, "OpenGL extensions:"); + cemuLog_log(LogType::Force, "ARB_clip_control: {}", glClipControl ? "available" : "not supported"); + cemuLog_log(LogType::Force, "ARB_get_program_binary: {}", (glGetProgramBinary != NULL && glProgramBinary != NULL) ? "available" : "not supported"); + cemuLog_log(LogType::Force, "ARB_clear_texture: {}", (glClearTexImage != NULL) ? "available" : "not supported"); + cemuLog_log(LogType::Force, "ARB_copy_image: {}", (glCopyImageSubData != NULL) ? "available" : "not supported"); + cemuLog_log(LogType::Force, "NV_depth_buffer_float: {}", (glDepthRangedNV != NULL) ? "available" : "not supported"); // generate default frame buffer glGenFramebuffers(1, &m_defaultFramebufferId); @@ -376,9 +376,9 @@ void OpenGLRenderer::GetVendorInformation() char* glRendererString = (char*)glGetString(GL_RENDERER); char* glVersionString = (char*)glGetString(GL_VERSION); - forceLog_printf("GL_VENDOR: %s", glVendorString ? glVendorString : "unknown"); - forceLog_printf("GL_RENDERER: %s", glRendererString ? glRendererString : "unknown"); - forceLog_printf("GL_VERSION: %s", glVersionString ? glVersionString : "unknown"); + cemuLog_log(LogType::Force, "GL_VENDOR: {}", glVendorString ? glVendorString : "unknown"); + cemuLog_log(LogType::Force, "GL_RENDERER: {}", glRendererString ? glRendererString : "unknown"); + cemuLog_log(LogType::Force, "GL_VERSION: {}", glVersionString ? glVersionString : "unknown"); if(boost::icontains(glVersionString, "Mesa")) { @@ -424,7 +424,7 @@ void _glDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GL if (LatteGPUState.glVendor == GLVENDOR_NVIDIA && strstr(message, "does not have a defined base level")) return; - forceLog_printf("GLDEBUG: %s", message); + cemuLog_log(LogType::Force, "GLDEBUG: {}", message); cemu_assert_debug(false); } diff --git a/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererCore.cpp b/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererCore.cpp index 91a1f9a6..c4dbf7c8 100644 --- a/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererCore.cpp +++ b/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererCore.cpp @@ -494,7 +494,7 @@ void LatteDrawGL_prepareIndicesWithGPUCache(MPTR indexDataMPTR, _INDEX_TYPE inde break; if (indexDataCacheFirst == nullptr) { - forceLog_printf("Unable to allocate entry in index cache"); + cemuLog_log(LogType::Force, "Unable to allocate entry in index cache"); assert_dbg(); } } @@ -1601,4 +1601,4 @@ void OpenGLRenderer::renderstate_updateTextureSettingsGL(LatteDecompilerShader* } catchOpenGLError(); } -} \ No newline at end of file +} diff --git a/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererStreamout.cpp b/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererStreamout.cpp index ef23a770..785dab79 100644 --- a/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererStreamout.cpp +++ b/src/Cafe/HW/Latte/Renderer/OpenGL/OpenGLRendererStreamout.cpp @@ -41,7 +41,7 @@ void OpenGLRenderer::bufferCache_copyStreamoutToMainBuffer(uint32 srcOffset, uin if (glCopyNamedBufferSubData) glCopyNamedBufferSubData(glStreamoutCacheRingBuffer, glAttributeCacheAB, srcOffset, dstOffset, size); else - forceLog_printf("glCopyNamedBufferSubData() not supported"); + cemuLog_log(LogType::Force, "glCopyNamedBufferSubData() not supported"); } void OpenGLRenderer::streamout_rendererFinishDrawcall() @@ -55,4 +55,4 @@ void OpenGLRenderer::streamout_rendererFinishDrawcall() m_isXfbActive = false; } -} \ No newline at end of file +} diff --git a/src/Cafe/HW/Latte/Renderer/OpenGL/RendererShaderGL.cpp b/src/Cafe/HW/Latte/Renderer/OpenGL/RendererShaderGL.cpp index 73016aaf..4de30064 100644 --- a/src/Cafe/HW/Latte/Renderer/OpenGL/RendererShaderGL.cpp +++ b/src/Cafe/HW/Latte/Renderer/OpenGL/RendererShaderGL.cpp @@ -119,8 +119,8 @@ RendererShaderGL::RendererShaderGL(ShaderType type, uint64 baseHash, uint64 auxH char log[2048]{}; GLsizei log_size; glGetShaderInfoLog(m_shader_object, std::min(log_length, sizeof(log) - 1), &log_size, log); - forceLog_printf("Error/Warning in shader:"); - forceLog_printf("%s", log); + cemuLog_log(LogType::Force, "Error/Warning in shader:"); + cemuLog_log(LogType::Force, log); } // set debug name @@ -192,7 +192,7 @@ bool RendererShaderGL::WaitForCompiled() tempLength = sizeof(infoLog) - 1; glGetShaderInfoLog(m_shader_object, std::min(infoLogLength, tempLength), (GLsizei*)&tempLength, (GLcharARB*)infoLog); infoLog[tempLength] = '\0'; - forceLog_printf("Compile error in shader. Log:", infoLog); + cemuLog_log(LogType::Force, "Compile error in shader. Log:"); cemuLog_log(LogType::Force, infoLog); } if (m_shader_object != 0) @@ -212,7 +212,7 @@ bool RendererShaderGL::WaitForCompiled() tempLength = sizeof(infoLog) - 1; glGetProgramInfoLog(m_program, std::min(infoLogLength, tempLength), (GLsizei*)&tempLength, (GLcharARB*)infoLog); infoLog[tempLength] = '\0'; - forceLog_printf("Link error in shader. Log:", infoLog); + cemuLog_log(LogType::Force, "Link error in shader. Log:"); cemuLog_log(LogType::Force, infoLog); } m_isCompiled = true; @@ -273,7 +273,7 @@ void RendererShaderGL::ShaderCacheLoading_begin(uint64 cacheTitleId) UNREACHABLE; } - forceLog_printf("Using precompiled shaders: %s", usePrecompiled ? "true" : "false"); + cemuLog_log(LogType::Force, "Using precompiled shaders: {}", usePrecompiled ? "true" : "false"); if (usePrecompiled) { @@ -292,4 +292,4 @@ void RendererShaderGL::ShaderCacheLoading_end() s_isLoadingShaders = false; } -FileCache* RendererShaderGL::g_programBinaryCache{}; \ No newline at end of file +FileCache* RendererShaderGL::g_programBinaryCache{}; diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/CocoaSurface.mm b/src/Cafe/HW/Latte/Renderer/Vulkan/CocoaSurface.mm index 61184da7..731a6a26 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/CocoaSurface.mm +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/CocoaSurface.mm @@ -52,7 +52,7 @@ VkSurfaceKHR CreateCocoaSurface(VkInstance instance, void* handle) VkResult err; if ((err = vkCreateMetalSurfaceEXT(instance, &surface, nullptr, &result)) != VK_SUCCESS) { - forceLog_printf("Cannot create a Metal Vulkan surface: %d", (sint32)err); + cemuLog_log(LogType::Force, "Cannot create a Metal Vulkan surface: {}", (sint32)err); throw std::runtime_error(fmt::format("Cannot create a Metal Vulkan surface: {}", err)); } diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/LatteTextureViewVk.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/LatteTextureViewVk.cpp index 62382290..d87d9ea7 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/LatteTextureViewVk.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/LatteTextureViewVk.cpp @@ -210,7 +210,7 @@ VkSampler LatteTextureViewVk::GetDefaultTextureSampler(bool useLinearTexFilter) if (vkCreateSampler(m_device, &samplerInfo, nullptr, &sampler) != VK_SUCCESS) { - forceLog_printf("Failed to create default sampler"); + cemuLog_log(LogType::Force, "Failed to create default sampler"); throw std::runtime_error("failed to create texture sampler!"); } @@ -236,4 +236,4 @@ VkImageViewType LatteTextureViewVk::GetImageViewTypeFromGX2Dim(Latte::E_DIM dim) cemu_assert_unimplemented(); } return VK_IMAGE_VIEW_TYPE_2D; -} \ No newline at end of file +} diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/RendererShaderVk.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/RendererShaderVk.cpp index 352ca4e4..604fba0d 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/RendererShaderVk.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/RendererShaderVk.cpp @@ -239,7 +239,7 @@ void RendererShaderVk::CreateVkShaderModule(std::span spirvBuffer) VkResult result = vkCreateShaderModule(m_device, &createInfo, nullptr, &m_shader_module); if (result != VK_SUCCESS) { - forceLog_printf("Vulkan: Shader error"); + cemuLog_log(LogType::Force, "Vulkan: Shader error"); throw std::runtime_error(fmt::format("Failed to create shader module: {}", result)); } @@ -450,4 +450,4 @@ void RendererShaderVk::ShaderCacheLoading_end() { // keep g_spirvCache open since we will write to it while the game is running s_isLoadingShadersVk = false; -} \ No newline at end of file +} diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/SwapchainInfoVk.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/SwapchainInfoVk.cpp index dd55c048..2e86deef 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/SwapchainInfoVk.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/SwapchainInfoVk.cpp @@ -226,8 +226,8 @@ bool SwapchainInfoVk::AcquireImage(uint64 timeout) void SwapchainInfoVk::UnrecoverableError(const char* errMsg) { - forceLog_printf("Unrecoverable error in Vulkan swapchain"); - forceLog_printf("Msg: %s", errMsg); + cemuLog_log(LogType::Force, "Unrecoverable error in Vulkan swapchain"); + cemuLog_log(LogType::Force, "Msg: {}", errMsg); throw std::runtime_error(errMsg); } @@ -269,7 +269,7 @@ SwapchainInfoVk::SwapchainSupportDetails SwapchainInfoVk::QuerySwapchainSupport( if (result != VK_SUCCESS) { if (result != VK_ERROR_SURFACE_LOST_KHR) - forceLog_printf("vkGetPhysicalDeviceSurfaceCapabilitiesKHR failed. Error %d", (sint32)result); + cemuLog_log(LogType::Force, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR failed. Error {}", (sint32)result); throw std::runtime_error(fmt::format("Unable to retrieve physical device surface capabilities: {}", result)); } @@ -277,7 +277,7 @@ SwapchainInfoVk::SwapchainSupportDetails SwapchainInfoVk::QuerySwapchainSupport( result = vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &formatCount, nullptr); if (result != VK_SUCCESS) { - forceLog_printf("vkGetPhysicalDeviceSurfaceFormatsKHR failed. Error %d", (sint32)result); + cemuLog_log(LogType::Force, "vkGetPhysicalDeviceSurfaceFormatsKHR failed. Error {}", (sint32)result); throw std::runtime_error(fmt::format("Unable to retrieve the number of formats for a surface on a physical device: {}", result)); } @@ -287,7 +287,7 @@ SwapchainInfoVk::SwapchainSupportDetails SwapchainInfoVk::QuerySwapchainSupport( result = vkGetPhysicalDeviceSurfaceFormatsKHR(device, surface, &formatCount, details.formats.data()); if (result != VK_SUCCESS) { - forceLog_printf("vkGetPhysicalDeviceSurfaceFormatsKHR failed. Error %d", (sint32)result); + cemuLog_log(LogType::Force, "vkGetPhysicalDeviceSurfaceFormatsKHR failed. Error {}", (sint32)result); throw std::runtime_error(fmt::format("Unable to retrieve the formats for a surface on a physical device: {}", result)); } } @@ -296,7 +296,7 @@ SwapchainInfoVk::SwapchainSupportDetails SwapchainInfoVk::QuerySwapchainSupport( result = vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &presentModeCount, nullptr); if (result != VK_SUCCESS) { - forceLog_printf("vkGetPhysicalDeviceSurfacePresentModesKHR failed. Error %d", (sint32)result); + cemuLog_log(LogType::Force, "vkGetPhysicalDeviceSurfacePresentModesKHR failed. Error {}", (sint32)result); throw std::runtime_error(fmt::format("Unable to retrieve the count of present modes for a surface on a physical device: {}", result)); } @@ -306,7 +306,7 @@ SwapchainInfoVk::SwapchainSupportDetails SwapchainInfoVk::QuerySwapchainSupport( result = vkGetPhysicalDeviceSurfacePresentModesKHR(device, surface, &presentModeCount, details.presentModes.data()); if (result != VK_SUCCESS) { - forceLog_printf("vkGetPhysicalDeviceSurfacePresentModesKHR failed. Error %d", (sint32)result); + cemuLog_log(LogType::Force, "vkGetPhysicalDeviceSurfacePresentModesKHR failed. Error {}", (sint32)result); throw std::runtime_error(fmt::format("Unable to retrieve the present modes for a surface on a physical device: {}", result)); } } @@ -357,14 +357,14 @@ VkPresentModeKHR SwapchainInfoVk::ChoosePresentMode(const std::vectorformat); + cemuLog_log(LogType::Force, "Unsupported texture readback format {:04x}", (uint32)textureView->format); cemu_assert_debug(false); return 0; } diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VKRMemoryManager.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VKRMemoryManager.cpp index 45e4a933..c4f47a2b 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VKRMemoryManager.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VKRMemoryManager.cpp @@ -231,9 +231,9 @@ uint32 VkTextureChunkedHeap::allocateNewChunk(uint32 chunkIndex, uint32 minimumA allocationSize /= 2; if (allocationSize < minimumAllocationSize) break; - forceLog_printf("Failed to allocate texture memory chunk with size %dMB. Trying again with smaller allocation size\n", allocationSize / 1024 / 1024); + cemuLog_log(LogType::Force, "Failed to allocate texture memory chunk with size {}MB. Trying again with smaller allocation size", allocationSize / 1024 / 1024); } - forceLog_printf("Unable to allocate image memory chunk (%d heaps)", deviceLocalMemoryTypeIndices.size()); + cemuLog_log(LogType::Force, "Unable to allocate image memory chunk ({} heaps)", deviceLocalMemoryTypeIndices.size()); throw std::runtime_error("failed to allocate image memory!"); return 0; } @@ -299,7 +299,7 @@ size_t VKRMemoryManager::GetTotalMemoryForBufferType(VkBufferUsageFlags usage, V bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; if (vkCreateBuffer(logicalDevice, &bufferInfo, nullptr, &temporaryBuffer) != VK_SUCCESS) { - forceLog_printf("Vulkan: GetTotalMemoryForBufferType() failed to create temporary buffer"); + cemuLog_log(LogType::Force, "Vulkan: GetTotalMemoryForBufferType() failed to create temporary buffer"); return 0; } @@ -513,7 +513,7 @@ void VKRMemoryManager::imageMemoryFree(VkImageMemAllocation* imageMemAllocation) auto heapItr = map_textureHeap.find(imageMemAllocation->typeFilter); if (heapItr == map_textureHeap.end()) { - forceLog_printf("Internal texture heap error"); + cemuLog_log(LogType::Force, "Internal texture heap error"); return; } heapItr->second->freeMem(imageMemAllocation->mem); diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VKRMemoryManager.h b/src/Cafe/HW/Latte/Renderer/Vulkan/VKRMemoryManager.h index 3da6fe4c..bf2d919b 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VKRMemoryManager.h +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VKRMemoryManager.h @@ -33,7 +33,7 @@ public: if ((alignment & (alignment - 1)) != 0) { // not a power of two - forceLog_printf("VkTextureChunkedHeap: Invalid alignment %d", alignment); + cemuLog_log(LogType::Force, "VkTextureChunkedHeap: Invalid alignment {}", alignment); } return this->alloc(size, alignment); } diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VsyncDriver.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VsyncDriver.cpp index 910ceff2..6ccca80f 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VsyncDriver.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VsyncDriver.cpp @@ -129,7 +129,7 @@ private: NTSTATUS r = pfnD3DKMTWaitForVerticalBlankEvent(&arg); if (r != 0) { - //forceLog_printf("Wait for VerticalBlank failed\n"); + //cemuLog_log(LogType::Force, "Wait for VerticalBlank failed"); Sleep(1000 / 60); failCount++; if (failCount >= 10) @@ -214,4 +214,4 @@ void VsyncDriver_notifyWindowPosChanged() } -#endif \ No newline at end of file +#endif diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.cpp index fd5beb2f..d7d139be 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.cpp @@ -19,7 +19,7 @@ bool InitializeGlobalVulkan() if (hmodule == nullptr) { - forceLog_printf("Vulkan loader not available. Outdated graphics driver or Vulkan runtime not installed?"); + cemuLog_log(LogType::Force, "Vulkan loader not available. Outdated graphics driver or Vulkan runtime not installed?"); return false; } @@ -28,7 +28,7 @@ bool InitializeGlobalVulkan() if(!vkEnumerateInstanceVersion) { - forceLog_printf("vkEnumerateInstanceVersion not available. Outdated graphics driver or Vulkan runtime?"); + cemuLog_log(LogType::Force, "vkEnumerateInstanceVersion not available. Outdated graphics driver or Vulkan runtime?"); FreeLibrary(hmodule); return false; } @@ -84,7 +84,7 @@ bool InitializeGlobalVulkan() if (!vulkan_so) { - forceLog_printf("Vulkan loader not available."); + cemuLog_log(LogType::Force, "Vulkan loader not available."); return false; } @@ -93,7 +93,7 @@ bool InitializeGlobalVulkan() if(!vkEnumerateInstanceVersion) { - forceLog_printf("vkEnumerateInstanceVersion not available. Outdated graphics driver or Vulkan runtime?"); + cemuLog_log(LogType::Force, "vkEnumerateInstanceVersion not available. Outdated graphics driver or Vulkan runtime?"); return false; } @@ -125,4 +125,4 @@ bool InitializeDeviceVulkan(VkDevice device) return true; } -#endif \ No newline at end of file +#endif diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp index fde113bb..29163487 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp @@ -225,7 +225,7 @@ VkFormat PipelineCompiler::GetVertexFormat(uint8 format) case FMT_2_10_10_10: return VK_FORMAT_R32_UINT; // verified to match OpenGL default: - forceLog_printf("Unsupported vertex format: %02x", format); + cemuLog_log(LogType::Force, "Unsupported vertex format: {:02x}", format); assert_dbg(); return VK_FORMAT_UNDEFINED; } @@ -398,7 +398,7 @@ bool PipelineCompiler::InitShaderStages(VulkanRenderer* vkRenderer, RendererShad (vkGeometryShader && vkGeometryShader->GetShaderModule() == VK_NULL_HANDLE) || (vkPixelShader && vkPixelShader->GetShaderModule() == VK_NULL_HANDLE)) { - forceLog_printf("Vulkan-Info: Pipeline creation failed due to invalid shader(s)"); + cemuLog_log(LogType::Force, "Vulkan-Info: Pipeline creation failed due to invalid shader(s)"); return false; } @@ -921,7 +921,7 @@ bool PipelineCompiler::InitFromCurrentGPUState(PipelineInfo* pipelineInfo, const VkResult result = vkCreatePipelineLayout(vkRenderer->m_logicalDevice, &pipelineLayoutInfo, nullptr, &m_pipeline_layout); if (result != VK_SUCCESS) { - forceLog_printf("%s", fmt::format("Failed to create pipeline layout: {}", result).c_str()); + cemuLog_log(LogType::Force, "Failed to create pipeline layout: {}", result); s_nvidiaWorkaround.unlock(); return false; } @@ -1041,7 +1041,7 @@ bool PipelineCompiler::Compile(bool forceCompile, bool isRenderThread, bool show } else { - forceLog_printf("Failed to create graphics pipeline. Error %d", (sint32)result); + cemuLog_log(LogType::Force, "Failed to create graphics pipeline. Error {}", (sint32)result); cemu_assert_debug(false); return true; // true indicates that caller should no longer attempt to compile this pipeline again } diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanQuery.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanQuery.cpp index 18e5e407..f9788c9c 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanQuery.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanQuery.cpp @@ -112,7 +112,7 @@ uint32 LatteQueryObjectVk::acquireQueryIndex() { if (m_rendererVk->m_occlusionQueries.list_availableQueryIndices.empty()) { - forceLog_printf("Vulkan-Error: Exhausted query pool"); + cemuLog_log(LogType::Force, "Vulkan-Error: Exhausted query pool"); assert_dbg(); } uint32 queryIndex = m_rendererVk->m_occlusionQueries.list_availableQueryIndices.back(); @@ -152,7 +152,7 @@ LatteQueryObject* VulkanRenderer::occlusionQuery_create() auto r = vkCreateQueryPool(m_logicalDevice, &queryPoolCreateInfo, nullptr, &m_occlusionQueries.queryPool); if (r != VK_SUCCESS) { - forceLog_printf("Vulkan-Error: Failed to create query pool with error %d", (sint32)r); + cemuLog_log(LogType::Force, "Vulkan-Error: Failed to create query pool with error {}", (sint32)r); return nullptr; } } @@ -209,4 +209,4 @@ void VulkanRenderer::occlusionQuery_notifyBeginCommandBuffer() for (auto& it : m_occlusionQueries.list_currentlyActiveQueries) if (it->m_hasActiveQuery) it->beginFragment(); -} \ No newline at end of file +} diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp index a3a88017..9c074b8d 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRenderer.cpp @@ -210,11 +210,11 @@ void VulkanRenderer::DetermineVendor() if(driverId == VK_DRIVER_ID_MESA_RADV || driverId == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA) m_vendor = GfxVendor::Mesa; - forceLog_printf("Using GPU: %s", properties.properties.deviceName); + cemuLog_log(LogType::Force, "Using GPU: {}", properties.properties.deviceName); if (m_featureControl.deviceExtensions.driver_properties) { - forceLog_printf("Driver version: %s", driverProperties.driverInfo); + cemuLog_log(LogType::Force, "Driver version: {}", driverProperties.driverInfo); if(m_vendor == GfxVendor::Nvidia) { @@ -225,7 +225,7 @@ void VulkanRenderer::DetermineVendor() else { - forceLog_printf("Driver version (as stored in device info): %08X", properties.properties.driverVersion); + cemuLog_log(LogType::Force, "Driver version (as stored in device info): {:08}", properties.properties.driverVersion); if(m_vendor == GfxVendor::Nvidia) { @@ -291,11 +291,11 @@ void VulkanRenderer::GetDeviceFeatures() { if (m_featureControl.deviceExtensions.custom_border_color) { - forceLog_printf("VK_EXT_custom_border_color is present but only with limited support. Cannot emulate arbitrary border color"); + cemuLog_log(LogType::Force, "VK_EXT_custom_border_color is present but only with limited support. Cannot emulate arbitrary border color"); } else { - forceLog_printf("VK_EXT_custom_border_color not supported. Cannot emulate arbitrary border color"); + cemuLog_log(LogType::Force, "VK_EXT_custom_border_color not supported. Cannot emulate arbitrary border color"); } } @@ -309,11 +309,11 @@ VulkanRenderer::VulkanRenderer() { glslang::InitializeProcess(); - forceLog_printf("------- Init Vulkan graphics backend -------"); + cemuLog_log(LogType::Force, "------- Init Vulkan graphics backend -------"); const bool useValidationLayer = cafeLog_isLoggingFlagEnabled(LOG_TYPE_VULKAN_VALIDATION); if (useValidationLayer) - forceLog_printf("Validation layer is enabled"); + cemuLog_log(LogType::Force, "Validation layer is enabled"); VkResult err; @@ -397,19 +397,19 @@ VulkanRenderer::VulkanRenderer() if (m_physicalDevice == VK_NULL_HANDLE && fallbackDevice != VK_NULL_HANDLE) { - forceLog_printf("The selected GPU could not be found or is not suitable. Falling back to first available device instead"); + cemuLog_log(LogType::Force, "The selected GPU could not be found or is not suitable. Falling back to first available device instead"); m_physicalDevice = fallbackDevice; config.graphic_device_uuid = {}; // resetting device selection } else if (m_physicalDevice == VK_NULL_HANDLE) { - forceLog_printf("No physical GPU could be found with the required extensions and swap chain support."); + cemuLog_log(LogType::Force, "No physical GPU could be found with the required extensions and swap chain support."); throw std::runtime_error("No physical GPU could be found with the required extensions and swap chain support."); } CheckDeviceExtensionSupport(m_physicalDevice, m_featureControl); // todo - merge this with GetDeviceFeatures and separate from IsDeviceSuitable? if (m_featureControl.debugMarkersSupported) - forceLog_printf("Debug: Frame debugger attached, will use vkDebugMarkerSetObjectNameEXT"); + cemuLog_log(LogType::Force, "Debug: Frame debugger attached, will use vkDebugMarkerSetObjectNameEXT"); DetermineVendor(); GetDeviceFeatures(); @@ -430,7 +430,7 @@ VulkanRenderer::VulkanRenderer() } catch (const std::exception& ex) { - forceLog_printf("can't create dxgi wrapper: %s", ex.what()); + cemuLog_log(LogType::Force, "can't create dxgi wrapper: {}", ex.what()); } // create logical device @@ -452,7 +452,7 @@ VulkanRenderer::VulkanRenderer() if (m_vendor == GfxVendor::AMD) { deviceFeatures.robustBufferAccess = VK_TRUE; - forceLog_printf("Enable robust buffer access"); + cemuLog_log(LogType::Force, "Enable robust buffer access"); } if (m_featureControl.mode.useTFEmulationViaSSBO) { @@ -487,7 +487,7 @@ VulkanRenderer::VulkanRenderer() VkResult result = vkCreateDevice(m_physicalDevice, &createInfo, nullptr, &m_logicalDevice); if (result != VK_SUCCESS) { - forceLog_printf("Vulkan: Unable to create a logical device. Error %d", (sint32)result); + cemuLog_log(LogType::Force, "Vulkan: Unable to create a logical device. Error {}", (sint32)result); throw std::runtime_error(fmt::format("Unable to create a logical device: {}", result)); } @@ -514,7 +514,7 @@ VulkanRenderer::VulkanRenderer() } if (m_featureControl.instanceExtensions.debug_utils) - forceLog_printf("Using available debug function: vkCreateDebugUtilsMessengerEXT()"); + cemuLog_log(LogType::Force, "Using available debug function: vkCreateDebugUtilsMessengerEXT()"); // set initial viewport and scissor box size m_state.currentViewport.width = 4; @@ -578,11 +578,11 @@ VulkanRenderer::VulkanRenderer() if (m_featureControl.mode.useBufferSurfaceCopies) { - //forceLog_printf("Enable surface copies via buffer"); + //cemuLog_log(LogType::Force, "Enable surface copies via buffer"); } else { - //forceLog_printf("Disable surface copies via buffer (Requires 2GB. Has only %lluMB available)", availableSurfaceCopyBufferMem / 1024ull / 1024ull); + //cemuLog_log(LogType::Force, "Disable surface copies via buffer (Requires 2GB. Has only {}MB available)", availableSurfaceCopyBufferMem / 1024ull / 1024ull); } } @@ -1212,11 +1212,11 @@ std::vector VulkanRenderer::CheckInstanceExtensionSupport(FeatureCo } if (!requiredInstanceExtensions.empty()) { - forceLog_printf("The following required Vulkan instance extensions are not supported:"); + cemuLog_log(LogType::Force, "The following required Vulkan instance extensions are not supported:"); std::stringstream ss; for (const auto& extension : requiredInstanceExtensions) - forceLog_printf("%s", extension); + cemuLog_log(LogType::Force, "{}", extension); cemuLog_waitForFlush(); throw std::runtime_error(ss.str()); } @@ -1262,7 +1262,7 @@ VkSurfaceKHR VulkanRenderer::CreateWinSurface(VkInstance instance, HWND hwindow) VkResult err; if ((err = vkCreateWin32SurfaceKHR(instance, &sci, nullptr, &result)) != VK_SUCCESS) { - forceLog_printf("Cannot create a Win32 Vulkan surface: %d", (sint32)err); + cemuLog_log(LogType::Force, "Cannot create a Win32 Vulkan surface: {}", (sint32)err); throw std::runtime_error(fmt::format("Cannot create a Win32 Vulkan surface: {}", err)); } @@ -1283,7 +1283,7 @@ VkSurfaceKHR VulkanRenderer::CreateXlibSurface(VkInstance instance, Display* dpy VkResult err; if ((err = vkCreateXlibSurfaceKHR(instance, &sci, nullptr, &result)) != VK_SUCCESS) { - forceLog_printf("Cannot create a X11 Vulkan surface: %d", (sint32)err); + cemuLog_log(LogType::Force, "Cannot create a X11 Vulkan surface: {}", (sint32)err); throw std::runtime_error(fmt::format("Cannot create a X11 Vulkan surface: {}", err)); } @@ -1302,7 +1302,7 @@ VkSurfaceKHR VulkanRenderer::CreateXcbSurface(VkInstance instance, xcb_connectio VkResult err; if ((err = vkCreateXcbSurfaceKHR(instance, &sci, nullptr, &result)) != VK_SUCCESS) { - forceLog_printf("Cannot create a XCB Vulkan surface: %d", (sint32)err); + cemuLog_log(LogType::Force, "Cannot create a XCB Vulkan surface: {}", (sint32)err); throw std::runtime_error(fmt::format("Cannot create a XCB Vulkan surface: {}", err)); } @@ -1321,7 +1321,7 @@ VkSurfaceKHR VulkanRenderer::CreateWaylandSurface(VkInstance instance, wl_displa VkResult err; if ((err = vkCreateWaylandSurfaceKHR(instance, &sci, nullptr, &result)) != VK_SUCCESS) { - forceLog_printf("Cannot create a Wayland Vulkan surface: %d", (sint32)err); + cemuLog_log(LogType::Force, "Cannot create a Wayland Vulkan surface: {}", (sint32)err); throw std::runtime_error(fmt::format("Cannot create a Wayland Vulkan surface: {}", err)); } @@ -1382,7 +1382,7 @@ void VulkanRenderer::CreateCommandBuffers() const VkResult result = vkAllocateCommandBuffers(m_logicalDevice, &allocInfo, m_commandBuffers.data()); if (result != VK_SUCCESS) { - forceLog_printf("Failed to allocate command buffers: %d", result); + cemuLog_log(LogType::Force, "Failed to allocate command buffers: {}", result); throw std::runtime_error(fmt::format("Failed to allocate command buffers: {}", result)); } @@ -1561,8 +1561,8 @@ void VulkanRenderer::Shutdown() void VulkanRenderer::UnrecoverableError(const char* errMsg) const { - forceLog_printf("Unrecoverable error in Vulkan renderer"); - forceLog_printf("Msg: %s", errMsg); + cemuLog_log(LogType::Force, "Unrecoverable error in Vulkan renderer"); + cemuLog_log(LogType::Force, "Msg: {}", errMsg); throw std::runtime_error(errMsg); } @@ -1632,14 +1632,14 @@ void VulkanRenderer::QueryMemoryInfo() { VkPhysicalDeviceMemoryProperties memProperties; vkGetPhysicalDeviceMemoryProperties(m_physicalDevice, &memProperties); - forceLog_printf("Vulkan device memory info:"); + cemuLog_log(LogType::Force, "Vulkan device memory info:"); for (uint32 i = 0; i < memProperties.memoryHeapCount; i++) { - forceLog_printf("Heap %d - Size %dMB Flags 0x%08x", i, (sint32)(memProperties.memoryHeaps[i].size / 1024ll / 1024ll), (uint32)memProperties.memoryHeaps[i].flags); + cemuLog_log(LogType::Force, "Heap {} - Size {}MB Flags 0x{:08x}", i, (sint32)(memProperties.memoryHeaps[i].size / 1024ll / 1024ll), (uint32)memProperties.memoryHeaps[i].flags); } for (uint32 i = 0; i < memProperties.memoryTypeCount; i++) { - forceLog_printf("Memory %d - HeapIndex %d Flags 0x%08x", i, (sint32)memProperties.memoryTypes[i].heapIndex, (uint32)memProperties.memoryTypes[i].propertyFlags); + cemuLog_log(LogType::Force, "Memory {} - HeapIndex {} Flags 0x{:08x}", i, (sint32)memProperties.memoryTypes[i].heapIndex, (uint32)memProperties.memoryTypes[i].propertyFlags); } } @@ -1700,7 +1700,7 @@ void VulkanRenderer::QueryAvailableFormats() if (fmtProp.optimalTilingFeatures == 0) { - forceLog_printf("%s not supported", it.name); + cemuLog_log(LogType::Force, "{} not supported", it.name); } else if ((fmtProp.optimalTilingFeatures & requestedBits) != requestedBits) { @@ -1716,7 +1716,7 @@ void VulkanRenderer::QueryAvailableFormats() // missingStr.append(" TRANSFER_DST"); //if (!(fmtProp.optimalTilingFeatures & VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT)) // missingStr.append(" SAMPLED_IMAGE"); - //forceLog_printf("%s", missingStr.c_str()); + //cemuLog_log(LogType::Force, "{}", missingStr.c_str()); } } } @@ -1765,7 +1765,7 @@ ImTextureID VulkanRenderer::GenerateTexture(const std::vector& data, cons } catch (const std::exception& ex) { - forceLog_printf("can't generate imgui texture: %s", ex.what()); + cemuLog_log(LogType::Force, "can't generate imgui texture: {}", ex.what()); return nullptr; } } @@ -1888,7 +1888,7 @@ void VulkanRenderer::ProcessFinishedCommandBuffers() // not signaled break; } - forceLog_printf("vkGetFenceStatus returned unexpected error %d", (sint32)fenceStatus); + cemuLog_log(LogType::Force, "vkGetFenceStatus returned unexpected error {}", (sint32)fenceStatus); cemu_assert_debug(false); } if (finishedCmdBuffers) @@ -1904,11 +1904,11 @@ void VulkanRenderer::WaitForNextFinishedCommandBuffer() VkResult result = vkWaitForFences(m_logicalDevice, 1, &m_cmd_buffer_fences[m_commandBufferSyncIndex], true, UINT64_MAX); if (result == VK_TIMEOUT) { - forceLog_printf("vkWaitForFences: Returned VK_TIMEOUT on infinite fence"); + cemuLog_log(LogType::Force, "vkWaitForFences: Returned VK_TIMEOUT on infinite fence"); } else if (result != VK_SUCCESS) { - forceLog_printf("vkWaitForFences: Returned unhandled error %d", (sint32)result); + cemuLog_log(LogType::Force, "vkWaitForFences: Returned unhandled error {}", (sint32)result); } // process ProcessFinishedCommandBuffers(); @@ -2040,7 +2040,7 @@ void VulkanRenderer::PipelineCacheSaveThread(size_t cache_size) } catch (const std::exception& ex) { - forceLog_printf("can't create vulkan pipeline cache directory \"%s\": %s", dir.generic_string().c_str(), ex.what()); + cemuLog_log(LogType::Force, "can't create vulkan pipeline cache directory \"{}\": {}", _pathToUtf8(dir), ex.what()); return; } } @@ -2089,12 +2089,12 @@ void VulkanRenderer::PipelineCacheSaveThread(size_t cache_size) } else { - forceLog_printf("can't write pipeline cache to disk"); + cemuLog_log(LogType::Force, "can't write pipeline cache to disk"); } } else { - forceLog_printf("can't retrieve pipeline cache data: 0x%x", res); + cemuLog_log(LogType::Force, "can't retrieve pipeline cache data: 0x{:x}", res); } } else @@ -2205,7 +2205,7 @@ void VulkanRenderer::GetTextureFormatInfoVK(Latte::E_GX2SURFFMT format, bool isD formatInfoOut->decoder = TextureDecoder_D32_S8_UINT_X24::getInstance(); break; default: - forceLog_printf("Unsupported depth texture format %04x", (uint32)format); + cemuLog_log(LogType::Force, "Unsupported depth texture format {:04x}", (uint32)format); // default to placeholder format formatInfoOut->vkImageFormat = VK_FORMAT_D16_UNORM; formatInfoOut->vkImageAspect = VK_IMAGE_ASPECT_DEPTH_BIT; @@ -2458,7 +2458,7 @@ void VulkanRenderer::GetTextureFormatInfoVK(Latte::E_GX2SURFFMT format, bool isD formatInfoOut->vkImageFormat = VK_FORMAT_R8G8B8A8_UINT; // todo - should we use ABGR format? formatInfoOut->decoder = TextureDecoder_X24_G8_UINT::getInstance(); // todo - verify default: - forceLog_printf("Unsupported color texture format %04x\n", (uint32)format); + cemuLog_log(LogType::Force, "Unsupported color texture format {:04x}", (uint32)format); cemu_assert_debug(false); } } @@ -2581,7 +2581,7 @@ VkPipeline VulkanRenderer::backbufferBlit_createGraphicsPipeline(VkDescriptorSet result = vkCreateGraphicsPipelines(m_logicalDevice, m_pipeline_cache, 1, &pipelineInfo, nullptr, &pipeline); if (result != VK_SUCCESS) { - forceLog_printf("Failed to create graphics pipeline. Error %d", result); + cemuLog_log(LogType::Force, "Failed to create graphics pipeline. Error {}", result); throw std::runtime_error(fmt::format("Failed to create graphics pipeline: {}", result)); } @@ -3882,7 +3882,7 @@ VKRObjectRenderPass::VKRObjectRenderPass(AttachmentInfo_t& attachmentInfo, sint3 if (vkCreateRenderPass(VulkanRenderer::GetInstance()->GetLogicalDevice(), &renderPassInfo, nullptr, &m_renderPass) != VK_SUCCESS) { - forceLog_printf("Vulkan-Error: Failed to create render pass"); + cemuLog_log(LogType::Force, "Vulkan-Error: Failed to create render pass"); throw std::runtime_error("failed to create render pass!"); } diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRendererCore.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRendererCore.cpp index 5d826b61..c68c664f 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRendererCore.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanRendererCore.cpp @@ -677,7 +677,7 @@ VkDescriptorSetInfo* VulkanRenderer::draw_getOrCreateDescriptorSet(PipelineInfo* info.imageView = nullTexture1D.view; info.sampler = nullTexture1D.sampler; textureArray.emplace_back(info); - // forceLog_printf("Vulkan-Info: Shader 0x%016llx uses 1D texture but bound texture has mismatching type (dim: 0x%02x)", shader->baseHash, textureView->gx2Dim); + // cemuLog_log(LogType::Force, "Vulkan-Info: Shader 0x{:016x} uses 1D texture but bound texture has mismatching type (dim: 0x{:02x})", shader->baseHash, textureView->gx2Dim); continue; } else if (textureDim == Latte::E_DIM::DIM_2D && (textureView->dim != Latte::E_DIM::DIM_2D && textureView->dim != Latte::E_DIM::DIM_2D_MSAA)) @@ -688,7 +688,7 @@ VkDescriptorSetInfo* VulkanRenderer::draw_getOrCreateDescriptorSet(PipelineInfo* info.imageView = nullTexture2D.view; info.sampler = nullTexture2D.sampler; textureArray.emplace_back(info); - // forceLog_printf("Vulkan-Info: Shader 0x%016llx uses 2D texture but bound texture has mismatching type (dim: 0x%02x)", shader->baseHash, textureView->gx2Dim); + // cemuLog_log(LogType::Force, "Vulkan-Info: Shader 0x{:016x} uses 2D texture but bound texture has mismatching type (dim: 0x{:02x})", shader->baseHash, textureView->gx2Dim); continue; } diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanSurfaceCopy.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanSurfaceCopy.cpp index 1f123ce9..2e4aa938 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanSurfaceCopy.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanSurfaceCopy.cpp @@ -353,7 +353,7 @@ CopySurfacePipelineInfo* VulkanRenderer::copySurface_getOrCreateGraphicsPipeline VkResult result = vkCreatePipelineLayout(m_logicalDevice, &pipelineLayoutInfo, nullptr, &vkObjPipeline->pipeline_layout); if (result != VK_SUCCESS) { - forceLog_printf("%s", fmt::format("Failed to create pipeline layout: {}", result).c_str()); + cemuLog_log(LogType::Force, "Failed to create pipeline layout: {}", result); vkObjPipeline->pipeline = VK_NULL_HANDLE; return copyPipeline; } @@ -413,7 +413,7 @@ CopySurfacePipelineInfo* VulkanRenderer::copySurface_getOrCreateGraphicsPipeline result = vkCreateGraphicsPipelines(m_logicalDevice, m_pipeline_cache, 1, &pipelineInfo, nullptr, ©Pipeline->vkObjPipeline->pipeline); if (result != VK_SUCCESS) { - forceLog_printf("Failed to create graphics pipeline for surface copy. Error %d Info:", (sint32)result); + cemuLog_log(LogType::Force, "Failed to create graphics pipeline for surface copy. Error {} Info:", (sint32)result); cemu_assert_debug(false); copyPipeline->vkObjPipeline->pipeline = VK_NULL_HANDLE; } @@ -806,7 +806,7 @@ void VulkanRenderer::surfaceCopy_viaBuffer(LatteTextureVk* srcTextureVk, sint32 memoryManager->CreateBuffer(m_surfaceCopyBufferSize, VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, m_surfaceCopyBuffer, m_surfaceCopyBufferMemory); if (m_surfaceCopyBuffer == VK_NULL_HANDLE) { - forceLog_printf("Vulkan: Failed to allocate surface copy buffer with size %llu", allocSize); + cemuLog_log(LogType::Force, "Vulkan: Failed to allocate surface copy buffer with size {}", allocSize); return; } } diff --git a/src/Cafe/IOSU/legacy/iosu_acp.cpp b/src/Cafe/IOSU/legacy/iosu_acp.cpp index 8637d88d..696b56a7 100644 --- a/src/Cafe/IOSU/legacy/iosu_acp.cpp +++ b/src/Cafe/IOSU/legacy/iosu_acp.cpp @@ -339,7 +339,7 @@ namespace iosu } else { - forceLog_printf("ACPGetTitleSaveMetaXml(): Meta file \"%s\" does not exist", xmlPath); + cemuLog_log(LogType::Force, "ACPGetTitleSaveMetaXml(): Meta file \"{}\" does not exist", xmlPath); memset(acpMetaXml, 0, sizeof(acpMetaXml_t)); } return 0; @@ -373,7 +373,7 @@ namespace iosu free(metaBootMovieData); } else - forceLog_printf("ACPGetTitleMetaData(): Unable to load \"%s\"", filePath); + cemuLog_log(LogType::Force, "ACPGetTitleMetaData(): Unable to load \"{}\"", filePath); // bootLogoTex.tga sprintf(filePath, "%smeta/bootLogoTex.tga", titlePath); uint32 metaBootLogoSize = 0; @@ -384,7 +384,7 @@ namespace iosu free(metaBootLogoData); } else - forceLog_printf("ACPGetTitleMetaData(): Unable to load \"%s\"", filePath); + cemuLog_log(LogType::Force, "ACPGetTitleMetaData(): Unable to load \"{}\"", filePath); return 0; @@ -418,7 +418,7 @@ namespace iosu } else { - forceLog_printf("ACPGetTitleMetaXml(): Meta file \"%s\" does not exist", filePath); + cemuLog_log(LogType::Force, "ACPGetTitleMetaXml(): Meta file \"{}\" does not exist", filePath); } return 0; @@ -470,7 +470,7 @@ namespace iosu FSCVirtualFile* fscDirIterator = fsc_openDirIterator(searchPath, &fscStatus); if (fscDirIterator == nullptr) { - forceLog_printf("ACPGetTitleSaveDirEx(): Failed to iterate directories in \"%s\"", searchPath); + cemuLog_log(LogType::Force, "ACPGetTitleSaveDirEx(): Failed to iterate directories in \"{}\"", searchPath); *countOut = 0; } else @@ -611,4 +611,4 @@ namespace iosu } -} \ No newline at end of file +} diff --git a/src/Cafe/IOSU/legacy/iosu_boss.cpp b/src/Cafe/IOSU/legacy/iosu_boss.cpp index e28ef2c4..47d89907 100644 --- a/src/Cafe/IOSU/legacy/iosu_boss.cpp +++ b/src/Cafe/IOSU/legacy/iosu_boss.cpp @@ -322,7 +322,7 @@ namespace iosu forceLogDebug_printf("sslctx_function: adding ca cert: %d", (int)task_settings->settings[location]); if (!iosuCrypto_addCACertificate(sslctx, task_settings->settings[location])) { - forceLog_printf("Failed to load CA certificate file"); + cemuLog_log(LogType::Force, "Failed to load CA certificate file"); assert_dbg(); } } @@ -334,13 +334,13 @@ namespace iosu { if (!iosuCrypto_addCACertificate(sslctx, 105)) { - forceLog_printf("Failed to load certificate file"); + cemuLog_log(LogType::Force, "Failed to load certificate file"); assert_dbg(); } if (!iosuCrypto_addClientCertificate(sslctx, 3)) { - forceLog_printf("Failed to load client certificate file"); + cemuLog_log(LogType::Force, "Failed to load client certificate file"); assert_dbg(); } } diff --git a/src/Cafe/IOSU/legacy/iosu_crypto.cpp b/src/Cafe/IOSU/legacy/iosu_crypto.cpp index 42dcff9c..ba08990f 100644 --- a/src/Cafe/IOSU/legacy/iosu_crypto.cpp +++ b/src/Cafe/IOSU/legacy/iosu_crypto.cpp @@ -393,24 +393,24 @@ bool iosuCrypto_addClientCertificate(void* sslctx, sint32 certificateId) { if (SSL_CTX_use_certificate(ctx, iosuCryptoCertificates.certList[i].cert) != 1) { - forceLog_printf("Unable to setup certificate %d", certificateId); + cemuLog_log(LogType::Force, "Unable to setup certificate {}", certificateId); return false; } if (SSL_CTX_use_RSAPrivateKey(ctx, iosuCryptoCertificates.certList[i].pkey) != 1) { - forceLog_printf("Unable to setup certificate %d RSA private key", certificateId); + cemuLog_log(LogType::Force, "Unable to setup certificate {} RSA private key", certificateId); return false; } if (SSL_CTX_check_private_key(ctx) == false) { - forceLog_printf("Certificate private key could not be validated (verify required files for online mode or disable online mode)"); + cemuLog_log(LogType::Force, "Certificate private key could not be validated (verify required files for online mode or disable online mode)"); } return true; } } - forceLog_printf("Certificate not found (verify required files for online mode or disable online mode)"); + cemuLog_log(LogType::Force, "Certificate not found (verify required files for online mode or disable online mode)"); return false; } @@ -438,7 +438,7 @@ bool iosuCrypto_addCustomCACertificate(void* sslctx, uint8* certData, sint32 cer X509* cert = d2i_X509(NULL, (const unsigned char**)&tempPtr, certLength); if (cert == nullptr) { - forceLog_printf("Invalid custom server PKI certificate"); + cemuLog_log(LogType::Force, "Invalid custom server PKI certificate"); return false; } X509_STORE_add_cert(store, cert); @@ -571,7 +571,7 @@ void iosuCrypto_init() // verify if OTP is ok if (length != 1024) // todo - should also check some fixed values to verify integrity of otp dump { - forceLog_printf("IOSU_CRYPTO: otp.bin has wrong size (must be 1024 bytes)"); + cemuLog_log(LogType::Force, "IOSU_CRYPTO: otp.bin has wrong size (must be 1024 bytes)"); hasOtpMem = false; } else @@ -582,7 +582,7 @@ void iosuCrypto_init() } else { - forceLog_printf("IOSU_CRYPTO: No otp.bin found. Online mode cannot be used"); + cemuLog_log(LogType::Force, "IOSU_CRYPTO: No otp.bin found. Online mode cannot be used"); hasOtpMem = false; } diff --git a/src/Cafe/IOSU/legacy/iosu_fpd.cpp b/src/Cafe/IOSU/legacy/iosu_fpd.cpp index ec8733ab..fae4ccc5 100644 --- a/src/Cafe/IOSU/legacy/iosu_fpd.cpp +++ b/src/Cafe/IOSU/legacy/iosu_fpd.cpp @@ -170,7 +170,7 @@ namespace iosu inet_pton(AF_INET, nexTokenResult.nexToken.host, &hostIp); g_fpd.nexFriendSession = new NexFriends(hostIp, nexTokenResult.nexToken.port, "ridfebb9", myPid, nexTokenResult.nexToken.nexPassword, nexTokenResult.nexToken.token, accountId, (uint8*)&miiData, (wchar_t*)screenName, (uint8)countryCode, g_fpd.myPresence); g_fpd.nexFriendSession->setNotificationHandler(notificationHandler); - forceLog_printf("IOSU_FPD: Created friend server session"); + cemuLog_log(LogType::Force, "IOSU_FPD: Created friend server session"); } else { @@ -1047,4 +1047,4 @@ namespace iosu g_fpd.isThreadStarted = true; } } -} \ No newline at end of file +} diff --git a/src/Cafe/IOSU/legacy/iosu_nim.cpp b/src/Cafe/IOSU/legacy/iosu_nim.cpp index 8d916329..fa0d7eda 100644 --- a/src/Cafe/IOSU/legacy/iosu_nim.cpp +++ b/src/Cafe/IOSU/legacy/iosu_nim.cpp @@ -108,7 +108,7 @@ namespace iosu uint32be titleCountBE = titleCount; if (mcpGetTitleList(titleList, titleCount * sizeof(MCPTitleInfo), &titleCountBE) != 0) { - forceLog_printf("IOSU: nim failed to acquire title list"); + cemuLog_log(LogType::Force, "IOSU: nim failed to acquire title list"); free(titleList); return; } @@ -218,7 +218,7 @@ namespace iosu if (!result) { memset(idbeIconOutput, 0, sizeof(NAPI::IDBEIconDataV0)); - forceLog_printf("NIM: Unable to download IDBE icon"); + cemuLog_log(LogType::Force, "NIM: Unable to download IDBE icon"); return 0; } // add new cache entry @@ -249,7 +249,7 @@ namespace iosu { if (g_nim.backgroundThreadStarted == false) { - forceLog_printf("IOSU: Starting nim background thread"); + cemuLog_log(LogType::Force, "IOSU: Starting nim background thread"); std::thread t(nim_backgroundThread); t.detach(); g_nim.backgroundThreadStarted = true; diff --git a/src/Cafe/OS/RPL/elf.cpp b/src/Cafe/OS/RPL/elf.cpp index e4f4218d..c61afb21 100644 --- a/src/Cafe/OS/RPL/elf.cpp +++ b/src/Cafe/OS/RPL/elf.cpp @@ -71,7 +71,7 @@ uint32 ELF_LoadFromMemory(uint8* elfData, sint32 size, const char* name) if (shOffset > (uint32)size) { - forceLog_printf("ELF section %d out of bounds", i); + cemuLog_log(LogType::Force, "ELF section {} out of bounds", i); continue; } uint32 copySize = std::min(shSize, size - shOffset); @@ -126,4 +126,4 @@ uint32 ELF_LoadFromMemory(uint8* elfData, sint32 size, const char* name) // unsigned int addr_sgIsLoadingBuffer; // unsigned int addr_gDynloadInitialized; // unsigned int orig_LiWaitOneChunkInstr; -//} OsSpecifics; \ No newline at end of file +//} OsSpecifics; diff --git a/src/Cafe/OS/RPL/rpl.cpp b/src/Cafe/OS/RPL/rpl.cpp index ab127354..7e48637a 100644 --- a/src/Cafe/OS/RPL/rpl.cpp +++ b/src/Cafe/OS/RPL/rpl.cpp @@ -336,7 +336,7 @@ rplSectionEntryNew_t* RPLLoader_GetSection(RPLModule* rplLoaderContext, sint32 s sint32 sectionCount = rplLoaderContext->rplHeader.sectionTableEntryCount; if (sectionIndex < 0 || sectionIndex >= sectionCount) { - forceLog_printf("RPLLoader: Section index out of bounds"); + cemuLog_log(LogType::Force, "RPLLoader: Section index out of bounds"); rplLoaderContext->hasError = true; return nullptr; } @@ -363,7 +363,7 @@ RPLUncompressedSection* RPLLoader_LoadUncompressedSection(RPLModule* rplLoaderCo if (!RPLLoader_CheckBounds(rplLoaderContext, section->fileOffset, section->sectionSize)) { // BSS - forceLog_printf("RPLLoader: Raw data for section %d exceeds bounds of RPL file", sectionIndex); + cemuLog_log(LogType::Force, "RPLLoader: Raw data for section {} exceeds bounds of RPL file", sectionIndex); rplLoaderContext->hasError = true; delete uSection; return nullptr; @@ -375,7 +375,7 @@ RPLUncompressedSection* RPLLoader_LoadUncompressedSection(RPLModule* rplLoaderCo // decompress if (!RPLLoader_CheckBounds(rplLoaderContext, section->fileOffset, sizeof(uint32be)) ) { - forceLog_printf("RPLLoader: Uncompressed data of section %d is too large", sectionIndex); + cemuLog_log(LogType::Force, "RPLLoader: Uncompressed data of section {} is too large", sectionIndex); rplLoaderContext->hasError = true; delete uSection; return nullptr; @@ -383,7 +383,7 @@ RPLUncompressedSection* RPLLoader_LoadUncompressedSection(RPLModule* rplLoaderCo uint32 uncompressedSize = *(uint32be*)(rplLoaderContext->RPLRawData.data() + (uint32)section->fileOffset); if (uncompressedSize >= 1*1024*1024*1024) // sections bigger than 1GB not allowed { - forceLog_printf("RPLLoader: Uncompressed data of section %d is too large", sectionIndex); + cemuLog_log(LogType::Force, "RPLLoader: Uncompressed data of section {} is too large", sectionIndex); rplLoaderContext->hasError = true; delete uSection; return nullptr; @@ -405,7 +405,7 @@ RPLUncompressedSection* RPLLoader_LoadUncompressedSection(RPLModule* rplLoaderCo inflateEnd(&strm); if ((ret != Z_OK && ret != Z_STREAM_END) || strm.avail_in != 0 || strm.avail_out != 0) { - forceLog_printf("RPLLoader: Error while inflating data for section %d", sectionIndex); + cemuLog_log(LogType::Force, "RPLLoader: Error while inflating data for section {}", sectionIndex); rplLoaderContext->hasError = true; delete uSection; return nullptr; @@ -454,7 +454,7 @@ bool RPLLoader_LoadSingleSection(RPLModule* rplLoaderContext, sint32 sectionInde // update size in section (todo - use separate field) if (uncompressedSection->sectionData.size() < section->sectionSize) - forceLog_printf("RPLLoader: Section %d uncompresses to %d bytes but sectionSize is %d", sectionIndex, uncompressedSection->sectionData.size(), (uint32)section->sectionSize); + cemuLog_log(LogType::Force, "RPLLoader: Section {} uncompresses to {} bytes but sectionSize is {}", sectionIndex, uncompressedSection->sectionData.size(), (uint32)section->sectionSize); section->sectionSize = uncompressedSection->sectionData.size(); @@ -956,7 +956,7 @@ bool RPLLoader_FixImportSymbols(RPLModule* rplLoaderContext, sint32 symtabSectio char* symbolName = (char*)strtabData + nameOffset; if (nameOffset >= strtabSize) { - forceLog_printf("RPLLoader: Symbol %d in section %d has out-of-bounds name offset", i, symSectionIndex); + cemuLog_log(LogType::Force, "RPLLoader: Symbol {} in section {} has out-of-bounds name offset", i, symSectionIndex); continue; } @@ -1287,7 +1287,7 @@ bool RPLLoader_ApplyRelocs(RPLModule* rplLoaderContext, sint32 relaSectionIndex, uint32 crc = rplLoaderContext->GetSectionCRC(relaSectionIndex); if (calcCRC != crc) { - forceLog_printf("RPLLoader %s - Relocation section %d has CRC mismatch - Calc: %08x Actual: %08x", rplLoaderContext->moduleName2.c_str(), relaSectionIndex, calcCRC, crc); + cemuLog_log(LogType::Force, "RPLLoader {} - Relocation section {} has CRC mismatch - Calc: {:08x} Actual: {:08x}", rplLoaderContext->moduleName2.c_str(), relaSectionIndex, calcCRC, crc); } // process relocations sint32 relocCount = relocSize / sizeof(rplRelocNew_t); @@ -1664,7 +1664,7 @@ RPLModule* rpl_loadFromMem(uint8* rplData, sint32 size, char* name) // cancel if error if (rpl->hasError) { - forceLog_printf("RPLLoader: Unable to load RPL due to errors"); + cemuLog_log(LogType::Force, "RPLLoader: Unable to load RPL due to errors"); delete rpl; return nullptr; } @@ -2120,7 +2120,7 @@ void RPLLoader_LoadDependency(rplDependency_t* dependency) auto fileData = FileStream::LoadIntoMemory(filePath); if (fileData) { - forceLog_printf("Loading RPL: /cafeLibs/%s", dependency->filepath); + cemuLog_log(LogType::Force, "Loading RPL: /cafeLibs/{}", dependency->filepath); dependency->rplLoaderContext = rpl_loadFromMem(fileData->data(), fileData->size(), dependency->filepath); return; } diff --git a/src/Cafe/OS/libs/coreinit/coreinit.cpp b/src/Cafe/OS/libs/coreinit/coreinit.cpp index e882baf8..c25550cd 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit.cpp @@ -175,14 +175,14 @@ void coreinitExport_OSGetSharedData(PPCInterpreter_t* hCPU) } } // some games require a valid result or they will crash, return a pointer to our placeholder font - forceLog_printf("OSGetSharedData() called by game but no shareddata fonts loaded. Use placeholder font"); + cemuLog_log(LogType::Force, "OSGetSharedData() called by game but no shareddata fonts loaded. Use placeholder font"); if (placeholderFont == MPTR_NULL) { // load and then return placeholder font uint8* placeholderFontPtr = extractCafeDefaultFont(&placeholderFontSize); placeholderFont = coreinit_allocFromSysArea(placeholderFontSize, 256); if (placeholderFont == MPTR_NULL) - forceLog_printf("Failed to alloc placeholder font sys memory"); + cemuLog_log(LogType::Force, "Failed to alloc placeholder font sys memory"); memcpy(memory_getPointerFromVirtualOffset(placeholderFont), placeholderFontPtr, placeholderFontSize); free(placeholderFontPtr); } @@ -204,7 +204,7 @@ typedef struct void coreinitExport_OSDriver_Register(PPCInterpreter_t* hCPU) { #ifdef CEMU_DEBUG_ASSERT - forceLog_printf("OSDriver_Register(0x%08x,0x%08x,0x%08x,0x%08x,0x%08x,0x%08x)", hCPU->gpr[3], hCPU->gpr[4], hCPU->gpr[5], hCPU->gpr[6], hCPU->gpr[7], hCPU->gpr[8]); + cemuLog_log(LogType::Force, "OSDriver_Register(0x{:08x},0x{:08x},0x{:08x},0x{:08x},0x{:08x},0x{:08x})", hCPU->gpr[3], hCPU->gpr[4], hCPU->gpr[5], hCPU->gpr[6], hCPU->gpr[7], hCPU->gpr[8]); #endif OSDriverCallbacks_t* driverCallbacks = (OSDriverCallbacks_t*)memory_getPointerFromVirtualOffset(hCPU->gpr[5]); @@ -271,7 +271,7 @@ namespace coreinit void coreinit_exit(uint32 r) { - forceLog_printf("coreinit.exit(%d)", r); + cemuLog_log(LogType::Force, "coreinit.exit({})", r); cemu_assert_debug(false); // never return while (true) std::this_thread::sleep_for(std::chrono::milliseconds(100)); diff --git a/src/Cafe/OS/libs/coreinit/coreinit_CodeGen.cpp b/src/Cafe/OS/libs/coreinit/coreinit_CodeGen.cpp index 31b184d8..f0e0bd80 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_CodeGen.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_CodeGen.cpp @@ -129,7 +129,7 @@ namespace coreinit { if (!_avoidCodeGenJIT) { - forceLog_printf("Disable JIT on dynamic code area"); + cemuLog_log(LogType::Force, "Disable JIT on dynamic code area"); } _avoidCodeGenJIT = true; // this function getting called is usually a sign that // does this have a return value? @@ -145,4 +145,4 @@ namespace coreinit cafeExportRegister("coreinit", OSSwitchSecCodeGenMode, LogType::Placeholder); } -} \ No newline at end of file +} diff --git a/src/Cafe/OS/libs/coreinit/coreinit_FS.cpp b/src/Cafe/OS/libs/coreinit/coreinit_FS.cpp index 6c606d46..c53d93c7 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_FS.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_FS.cpp @@ -186,7 +186,7 @@ namespace coreinit void __FSErrorAndBlock(std::string_view msg) { - forceLog_printf("Critical error in FS: %s", msg.data()); + cemuLog_log(LogType::Force, "Critical error in FS: {}", msg); while (true) std::this_thread::sleep_for(std::chrono::milliseconds(1000)); } @@ -513,7 +513,7 @@ namespace coreinit fsCmdBlockBody->asyncResult.fsStatusNew = (uint32)result; while (OSSendMessage(ioMsgQueue, &fsCmdBlockBody->asyncResult.msgUnion.osMsg, 0) == 0) { - forceLog_printf("FS driver: Failed to add message to result queue. Retrying..."); + cemuLog_log(LogType::Force, "FS driver: Failed to add message to result queue. Retrying..."); if (ppcInterpreterCurrentInstance) PPCCore_switchToScheduler(); else @@ -626,15 +626,16 @@ namespace coreinit { if (fsCmdBlockBody->asyncResult.msgUnion.fsMsg.commandType != _swapEndianU32(8)) { - forceLog_printf("Corrupted FS command detected in stage %s", stage); - forceLog_printf("Printing CMD block: "); + cemuLog_log(LogType::Force, "Corrupted FS command detected in stage {}", stage); + cemuLog_log(LogType::Force, "Printing CMD block: "); for (uint32 i = 0; i < (sizeof(FSCmdBlockBody_t) + 31) / 32; i++) { uint8* p = ((uint8*)fsCmdBlockBody) + i * 32; - forceLog_printf("%04x: %02x %02x %02x %02x - %02x %02x %02x %02x - %02x %02x %02x %02x - %02x %02x %02x %02x | %02x %02x %02x %02x - %02x %02x %02x %02x - %02x %02x %02x %02x - %02x %02x %02x %02x", - i * 32, - p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], + cemuLog_log(LogType::Force, "{:04x}: {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} | {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x} - {:02x} {:02x} {:02x} {:02x}", + i * 32, + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17], p[18], p[19], p[20], p[21], p[22], p[23], p[24], p[25], p[26], p[27], p[28], p[29], p[30], p[31]); + } } } @@ -659,7 +660,7 @@ namespace coreinit else { // todo - error handling - forceLog_printf("FS handleAsyncResult(): unexpected error %08x", errHandling); + cemuLog_log(LogType::Force, "FS handleAsyncResult(): unexpected error {:08x}", errHandling); cemu_assert_debug(false); return 0; } diff --git a/src/Cafe/OS/libs/coreinit/coreinit_GHS.cpp b/src/Cafe/OS/libs/coreinit/coreinit_GHS.cpp index d7952053..5699e3e7 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_GHS.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_GHS.cpp @@ -86,7 +86,7 @@ namespace coreinit } if (mutexIndex == -1) { - forceLog_printf("__ghs_flock_create(): No flock available"); + cemuLog_log(LogType::Force, "__ghs_flock_create(): No flock available"); cemu_assert(false); // no available mutex } // mark mutex as reserved @@ -282,4 +282,4 @@ namespace coreinit cafeExportRegister("coreinit", __tls_get_addr, LogType::Placeholder); } -}; \ No newline at end of file +}; diff --git a/src/Cafe/OS/libs/coreinit/coreinit_LockedCache.cpp b/src/Cafe/OS/libs/coreinit/coreinit_LockedCache.cpp index 6f202a8e..a051fce1 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_LockedCache.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_LockedCache.cpp @@ -100,7 +100,7 @@ namespace coreinit { // out of bounds #ifdef CEMU_DEBUG_ASSERT - forceLog_printf("LCDealloc(): Out of bounds"); + cemuLog_log(LogType::Force, "LCDealloc(): Out of bounds"); #endif osLib_returnFromFunction(hCPU, 0); return; @@ -209,7 +209,7 @@ namespace coreinit { if (_lcDisableErrorCounter < 15) { - forceLog_printf("LC disabled but there is still memory allocated"); + cemuLog_log(LogType::Force, "LC disabled but there is still memory allocated"); _lcDisableErrorCounter++; } } diff --git a/src/Cafe/OS/libs/coreinit/coreinit_MCP.cpp b/src/Cafe/OS/libs/coreinit/coreinit_MCP.cpp index f4080a23..da7ec145 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_MCP.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_MCP.cpp @@ -154,7 +154,7 @@ void coreinitExport_MCP_GetTitleInfo(PPCInterpreter_t* hCPU) if (mcpRequest->titleListRequest.titleCount == 0) { - forceLog_printf("MCP_GetTitleInfo() failed to get title info"); + cemuLog_log(LogType::Force, "MCP_GetTitleInfo() failed to get title info"); } osLib_returnFromFunction(hCPU, mcpRequest->returnCode); @@ -558,4 +558,4 @@ void coreinitExport_UCReadSysConfig(PPCInterpreter_t* hCPU) } } osLib_returnFromFunction(hCPU, 0); // 0 -> success -} \ No newline at end of file +} diff --git a/src/Cafe/OS/libs/coreinit/coreinit_MEM.cpp b/src/Cafe/OS/libs/coreinit/coreinit_MEM.cpp index a9f9f3a8..be9196fb 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_MEM.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_MEM.cpp @@ -23,7 +23,7 @@ MPTR coreinit_allocFromSysArea(uint32 size, uint32 alignment) sysAreaAllocatorOffset += (size+3)&~3; if( sysAreaAllocatorOffset >= mmuRange_CEMU_AREA.getSize() ) { - forceLog_printf("Ran out of system memory"); + cemuLog_log(LogType::Force, "Ran out of system memory"); cemu_assert(false); // out of bounds } s_allocator_mutex.unlock(); @@ -645,4 +645,4 @@ namespace coreinit cafeExportRegister("coreinit", MEMGetPrevListObject, LogType::CoreinitMem); } -} \ No newline at end of file +} diff --git a/src/Cafe/OS/libs/coreinit/coreinit_MEM_BlockHeap.cpp b/src/Cafe/OS/libs/coreinit/coreinit_MEM_BlockHeap.cpp index f3d4250b..06d76e43 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_MEM_BlockHeap.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_MEM_BlockHeap.cpp @@ -236,7 +236,7 @@ namespace coreinit blockHeapHead->nextFreeBlock = _swapEndianU32(nextFreeBlockMPTR); if (_swapEndianU32(blockHeapHead->freeBlocksLeft) == 0) { - forceLog_printf("BlockHeap: No free blocks left\n"); + cemuLog_log(LogType::Force, "BlockHeap: No free blocks left"); assert_dbg(); } blockHeapHead->freeBlocksLeft = _swapEndianU32(_swapEndianU32(blockHeapHead->freeBlocksLeft) - 1); diff --git a/src/Cafe/OS/libs/coreinit/coreinit_MEM_ExpHeap.cpp b/src/Cafe/OS/libs/coreinit/coreinit_MEM_ExpHeap.cpp index a1d03c32..fc82f05c 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_MEM_ExpHeap.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_MEM_ExpHeap.cpp @@ -452,7 +452,7 @@ void* MEMAllocFromExpHeapEx(MEMHeapHandle heap, uint32 size, sint32 alignment) if (alignment == 0) { // this is a guaranteed crash on the actual console - forceLog_printf("MEMAllocFromExpHeapEx(): Alignment 0 not allowed"); + cemuLog_log(LogType::Force, "MEMAllocFromExpHeapEx(): Alignment 0 not allowed"); alignment = 4; return nullptr; } diff --git a/src/Cafe/OS/libs/coreinit/coreinit_Synchronization.cpp b/src/Cafe/OS/libs/coreinit/coreinit_Synchronization.cpp index bdcc531d..44f28cf4 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_Synchronization.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_Synchronization.cpp @@ -550,7 +550,7 @@ namespace coreinit if (fastMutex->owner != currentThread) { // seen in Paper Mario Color Splash - //forceLog_printf("OSFastMutex_Unlock() called on mutex which is not owned by current thread"); + //cemuLog_log(LogType::Force, "OSFastMutex_Unlock() called on mutex which is not owned by current thread"); _OSFastMutex_ReleaseContention(fastMutex); return; } diff --git a/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp b/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp index f11225cb..0f351c15 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_Thread.cpp @@ -238,7 +238,7 @@ namespace coreinit { // workaround for games that restart threads to quickly // seen in Fast Racing Neo at boot (0x020617BC OSCreateThread) - forceLog_printf("Game attempting to re-initialize existing thread"); + cemuLog_log(LogType::Force, "Game attempting to re-initialize existing thread"); while ((thread->state == OSThread_t::THREAD_STATE::STATE_READY || thread->state == OSThread_t::THREAD_STATE::STATE_RUNNING) && thread->suspendCounter == 0) { // wait for thread to finish @@ -248,7 +248,7 @@ namespace coreinit } if (__OSIsThreadActive(thread) && thread->state == OSThread_t::THREAD_STATE::STATE_MORIBUND) { - forceLog_printf("Calling OSCreateThread() on thread which is still active (Thread exited without detached flag). Forcing OSDetachThread()..."); + cemuLog_log(LogType::Force, "Calling OSCreateThread() on thread which is still active (Thread exited without detached flag). Forcing OSDetachThread()..."); __OSUnlockScheduler(); OSDetachThread(thread); __OSLockScheduler(); diff --git a/src/Cafe/OS/libs/gx2/GX2_Command.cpp b/src/Cafe/OS/libs/gx2/GX2_Command.cpp index 0f4f1343..ce3bd984 100644 --- a/src/Cafe/OS/libs/gx2/GX2_Command.cpp +++ b/src/Cafe/OS/libs/gx2/GX2_Command.cpp @@ -282,7 +282,7 @@ namespace GX2 } else { - forceLog_printf("GX2PatchDisplayList(): unsupported patchType %d", (uint32)patchType); + cemuLog_log(LogType::Force, "GX2PatchDisplayList(): unsupported patchType {}", (uint32)patchType); cemu_assert_debug(false); } } @@ -305,4 +305,4 @@ namespace GX2 cafeExportRegister("gx2", GX2PatchDisplayList, LogType::GX2); } -} \ No newline at end of file +} diff --git a/src/Cafe/OS/libs/gx2/GX2_Event.cpp b/src/Cafe/OS/libs/gx2/GX2_Event.cpp index ffba8ba5..0b8100f4 100644 --- a/src/Cafe/OS/libs/gx2/GX2_Event.cpp +++ b/src/Cafe/OS/libs/gx2/GX2_Event.cpp @@ -133,7 +133,7 @@ namespace GX2 { if ((size_t)eventType >= GX2CallbackEventTypeCount) { - forceLog_printf("GX2SetEventCallback(): Unknown eventType\n"); + cemuLog_log(LogType::Force, "GX2SetEventCallback(): Unknown eventType"); return; } s_eventCallback[(size_t)eventType].callbackFuncPtr = callbackFuncPtr; @@ -144,7 +144,7 @@ namespace GX2 { if ((size_t)eventType >= GX2CallbackEventTypeCount) { - forceLog_printf("GX2GetEventCallback(): Unknown eventType\n"); + cemuLog_log(LogType::Force, "GX2GetEventCallback(): Unknown eventType"); return; } if (callbackFuncPtrOut) @@ -308,4 +308,4 @@ namespace GX2 coreinit::OSInitEvent(s_updateRetirementEvent, coreinit::OSEvent::EVENT_STATE::STATE_NOT_SIGNALED, coreinit::OSEvent::EVENT_MODE::MODE_AUTO); coreinit::OSInitSemaphore(s_eventCbQueueSemaphore, 0); } -} \ No newline at end of file +} diff --git a/src/Cafe/OS/libs/gx2/GX2_Misc.cpp b/src/Cafe/OS/libs/gx2/GX2_Misc.cpp index 1f20cac5..3d898186 100644 --- a/src/Cafe/OS/libs/gx2/GX2_Misc.cpp +++ b/src/Cafe/OS/libs/gx2/GX2_Misc.cpp @@ -18,7 +18,7 @@ void gx2Export_GX2SetSwapInterval(PPCInterpreter_t* hCPU) gx2Log_printf("GX2SetSwapInterval(%d)\n", hCPU->gpr[3]); if( hCPU->gpr[3] >= 20 ) { - forceLog_printf("GX2SetSwapInterval() called with out of range value (%d)\n", hCPU->gpr[3]); + cemuLog_log(LogType::Force, "GX2SetSwapInterval() called with out of range value ({})", hCPU->gpr[3]); } else LatteGPUState.sharedArea->swapInterval = hCPU->gpr[3]; diff --git a/src/Cafe/OS/libs/h264_avc/H264Dec.cpp b/src/Cafe/OS/libs/h264_avc/H264Dec.cpp index e9b8ec8b..af69ff52 100644 --- a/src/Cafe/OS/libs/h264_avc/H264Dec.cpp +++ b/src/Cafe/OS/libs/h264_avc/H264Dec.cpp @@ -577,7 +577,7 @@ namespace H264 WORD32 status = ih264d_api_function(m_codecCtx, &s_dec_ip, &s_dec_op); if (status != 0) { - forceLog_printf("H264: Unable to determine buffer sizes for stream"); + cemuLog_log(LogType::Force, "H264: Unable to determine buffer sizes for stream"); return false; } numByteConsumed = s_dec_op.u4_num_bytes_consumed; diff --git a/src/Cafe/OS/libs/mic/mic.cpp b/src/Cafe/OS/libs/mic/mic.cpp index 44373e3f..f7b5ba5a 100644 --- a/src/Cafe/OS/libs/mic/mic.cpp +++ b/src/Cafe/OS/libs/mic/mic.cpp @@ -167,7 +167,7 @@ void micExport_MICInit(PPCInterpreter_t* hCPU) } catch (std::runtime_error& ex) { - forceLog_printf("can't initialize audio input: %s", ex.what()); + cemuLog_log(LogType::Force, "can't initialize audio input: {}", ex.what()); exit(0); } } @@ -467,4 +467,4 @@ namespace mic osLib_addFunction("mic", "MICSetState", micExport_MICSetState); osLib_addFunction("mic", "MICSetDataConsumed", micExport_MICSetDataConsumed); } -}; \ No newline at end of file +}; diff --git a/src/Cafe/OS/libs/nn_boss/nn_boss.cpp b/src/Cafe/OS/libs/nn_boss/nn_boss.cpp index 045fa82f..9af9a36f 100644 --- a/src/Cafe/OS/libs/nn_boss/nn_boss.cpp +++ b/src/Cafe/OS/libs/nn_boss/nn_boss.cpp @@ -1497,7 +1497,7 @@ void nnBossNsDataExport_DeleteRealFileWithHistory(PPCInterpreter_t* hCPU) if (nsData->storage.storageKind == nn::boss::kStorageKind_NBDL) { // todo - forceLog_printf("BOSS NBDL: Unsupported delete"); + cemuLog_log(LogType::Force, "BOSS NBDL: Unsupported delete"); } else { @@ -1505,7 +1505,7 @@ void nnBossNsDataExport_DeleteRealFileWithHistory(PPCInterpreter_t* hCPU) std::string filePath = nnBossNsDataExport_GetPath(nsData).c_str(); fsc_remove((char*)filePath.c_str(), &fscStatus); if (fscStatus != 0) - forceLog_printf("Unhandeled FSC status in BOSS DeleteRealFileWithHistory()"); + cemuLog_log(LogType::Force, "Unhandeled FSC status in BOSS DeleteRealFileWithHistory()"); } osLib_returnFromFunction(hCPU, 0); } @@ -1551,7 +1551,7 @@ void nnBossNsDataExport_getSize(PPCInterpreter_t* hCPU) bossStorageFadEntry_t fadEntry; if (nnBossStorageFad_getEntryByName(&nsData->storage, nsData->name, &fadEntry) == false) { - forceLog_printf("BOSS storage cant find file %s", nsData->name); + cemuLog_log(LogType::Force, "BOSS storage cant find file {}", nsData->name); osLib_returnFromFunction(hCPU, 0); return; } @@ -1566,7 +1566,7 @@ void nnBossNsDataExport_getSize(PPCInterpreter_t* hCPU) if (fscStorageFile == nullptr) { - forceLog_printf("BOSS storage cant open file alias %s", nsData->name); + cemuLog_log(LogType::Force, "BOSS storage cant open file alias {}", nsData->name); osLib_returnFromFunction(hCPU, 0); return; } @@ -1586,7 +1586,7 @@ uint32 nnBossNsData_read(nsData_t* nsData, uint64* sizeOutBE, void* buffer, sint bossStorageFadEntry_t fadEntry; if (nnBossStorageFad_getEntryByName(&nsData->storage, nsData->name, &fadEntry) == false) { - forceLog_printf("BOSS storage cant find file %s for reading", nsData->name); + cemuLog_log(LogType::Force, "BOSS storage cant find file {} for reading", nsData->name); return 0x80000000; // todo - proper error code } // open file @@ -1600,7 +1600,7 @@ uint32 nnBossNsData_read(nsData_t* nsData, uint64* sizeOutBE, void* buffer, sint if (!fscStorageFile) { - forceLog_printf("BOSS storage cant open file alias %s for reading", nsData->name); + cemuLog_log(LogType::Force, "BOSS storage cant open file alias {} for reading", nsData->name); return 0x80000000; // todo - proper error code } // get size @@ -1635,7 +1635,7 @@ uint32 nnBossNsData_seek(nsData_t* nsData, uint64 seek, uint32 mode) bossStorageFadEntry_t fadEntry; if (nnBossStorageFad_getEntryByName(&nsData->storage, nsData->name, &fadEntry) == false) { - forceLog_printf("BOSS storage cant find file %s for reading", nsData->name); + cemuLog_log(LogType::Force, "BOSS storage cant find file {} for reading", nsData->name); return 0x80000000; // todo - proper error code } // open file @@ -1649,7 +1649,7 @@ uint32 nnBossNsData_seek(nsData_t* nsData, uint64 seek, uint32 mode) if (fscStorageFile == nullptr) { - forceLog_printf("BOSS storage cant open file alias %s for reading", nsData->name); + cemuLog_log(LogType::Force, "BOSS storage cant open file alias {} for reading", nsData->name); return 0x80000000; // todo - proper error code } // get size @@ -1801,4 +1801,4 @@ void nnBoss_load() osLib_addFunction("nn_boss", "Read__Q3_2nn4boss6NsDataFPLPvUi", nnBossNsDataExport_readWithSizeOut); osLib_addFunction("nn_boss", "Seek__Q3_2nn4boss6NsDataFLQ3_2nn4boss12PositionBase", nnBossNsDataExport_seek); -} \ No newline at end of file +} diff --git a/src/Cafe/OS/libs/nn_fp/nn_fp.cpp b/src/Cafe/OS/libs/nn_fp/nn_fp.cpp index db2b7401..48eb673e 100644 --- a/src/Cafe/OS/libs/nn_fp/nn_fp.cpp +++ b/src/Cafe/OS/libs/nn_fp/nn_fp.cpp @@ -473,7 +473,7 @@ namespace nn } if (joinFlagMask == 0x65 || joinFlagMask == 0x66) { - forceLog_printf("Unsupported friend invite"); + cemuLog_log(LogType::Force, "Unsupported friend invite"); } osLib_returnFromFunction(hCPU, 0); diff --git a/src/Cafe/OS/libs/nn_idbe/nn_idbe.cpp b/src/Cafe/OS/libs/nn_idbe/nn_idbe.cpp index 72ea5231..daa2e9e9 100644 --- a/src/Cafe/OS/libs/nn_idbe/nn_idbe.cpp +++ b/src/Cafe/OS/libs/nn_idbe/nn_idbe.cpp @@ -89,12 +89,12 @@ namespace nn nnIdbeHeader_t* idbeHeader = (nnIdbeHeader_t*)iconInput; if (idbeHeader->formatVersion != 0) { - forceLog_printf("idbe header version unknown (%d)", (sint32)idbeHeader->formatVersion); + cemuLog_log(LogType::Force, "idbe header version unknown ({})", (sint32)idbeHeader->formatVersion); return false; } if (idbeHeader->keyIndex >= 4) { - forceLog_printf("idbe header key count invalid (%d)", (sint32)idbeHeader->keyIndex); + cemuLog_log(LogType::Force, "idbe header key count invalid ({})", (sint32)idbeHeader->keyIndex); return false; } // decrypt data @@ -175,4 +175,4 @@ namespace nn } } -} \ No newline at end of file +} diff --git a/src/Cafe/OS/libs/nn_nfp/AmiiboCrypto.h b/src/Cafe/OS/libs/nn_nfp/AmiiboCrypto.h index 9a326237..2d7bd7c5 100644 --- a/src/Cafe/OS/libs/nn_nfp/AmiiboCrypto.h +++ b/src/Cafe/OS/libs/nn_nfp/AmiiboCrypto.h @@ -214,9 +214,9 @@ void amiiboDecrypt() bool isValidTagHMAC = memcmp(nfp_data.amiiboNFCData.tagHMAC, nfp_data.amiiboInternal.tagHMAC, 32) == 0; bool isValidDataHMAC = memcmp(nfp_data.amiiboNFCData.dataHMAC, nfp_data.amiiboInternal.dataHMAC, 32) == 0; if (!isValidTagHMAC) - forceLog_printf("Decrypt amiibo has invalid tag HMAC"); + cemuLog_log(LogType::Force, "Decrypt amiibo has invalid tag HMAC"); if (!isValidDataHMAC) - forceLog_printf("Decrypt amiibo has invalid data HMAC"); + cemuLog_log(LogType::Force, "Decrypt amiibo has invalid data HMAC"); nfp_data.hasInvalidHMAC = !isValidTagHMAC || !isValidDataHMAC; } diff --git a/src/Cafe/OS/libs/nn_nfp/nn_nfp.cpp b/src/Cafe/OS/libs/nn_nfp/nn_nfp.cpp index faeed95c..d0179c91 100644 --- a/src/Cafe/OS/libs/nn_nfp/nn_nfp.cpp +++ b/src/Cafe/OS/libs/nn_nfp/nn_nfp.cpp @@ -667,7 +667,7 @@ void nnNfpExport_CreateApplicationArea(PPCInterpreter_t* hCPU) // this API forces a flush (unsure, but without this data written by Smash doesn't stick) if (!nnNfp_writeCurrentAmiibo()) { - forceLog_printf("Failed to write Amiibo file data when trying to remove appArea"); + cemuLog_log(LogType::Force, "Failed to write Amiibo file data when trying to remove appArea"); osLib_returnFromFunction(hCPU, BUILD_NN_RESULT(NN_RESULT_LEVEL_STATUS, NN_RESULT_MODULE_NN_NFP, 0)); return; } @@ -697,7 +697,7 @@ void nnNfpExport_DeleteApplicationArea(PPCInterpreter_t* hCPU) // this API forces a flush if (!nnNfp_writeCurrentAmiibo()) { - forceLog_printf("Failed to write Amiibo file data when trying to remove appArea"); + cemuLog_log(LogType::Force, "Failed to write Amiibo file data when trying to remove appArea"); osLib_returnFromFunction(hCPU, BUILD_NN_RESULT(NN_RESULT_LEVEL_STATUS, NN_RESULT_MODULE_NN_NFP, 0)); return; } @@ -712,14 +712,14 @@ void nnNfpExport_Flush(PPCInterpreter_t* hCPU) // write Amiibo data if (nfp_data.isReadOnly) { - forceLog_printf("Cannot write to Amiibo when it is mounted in read-only mode"); + cemuLog_log(LogType::Force, "Cannot write to Amiibo when it is mounted in read-only mode"); osLib_returnFromFunction(hCPU, BUILD_NN_RESULT(NN_RESULT_LEVEL_STATUS, NN_RESULT_MODULE_NN_NFP, 0)); return; } if (!nnNfp_writeCurrentAmiibo()) { - forceLog_printf("Failed to write Amiibo data"); + cemuLog_log(LogType::Force, "Failed to write Amiibo data"); osLib_returnFromFunction(hCPU, BUILD_NN_RESULT(NN_RESULT_LEVEL_STATUS, NN_RESULT_MODULE_NN_NFP, 0)); return; } @@ -837,7 +837,7 @@ bool nnNfp_touchNfcTagFromFile(const wchar_t* filePath, uint32* nfcError) if (serialCheckByte0 != bcc0 || serialCheckByte1 != bcc1) { - forceLog_printf("nn_nfp: Mismatch in serial checksum of scanned NFC tag"); + cemuLog_log(LogType::Force, "nn_nfp: Mismatch in serial checksum of scanned NFC tag"); } nfp_data.amiiboProcessedData.uidLength = 7; memcpy(nfp_data.amiiboProcessedData.uid, serialNumber, 7); diff --git a/src/Cafe/OS/libs/nn_olv/nn_olv.cpp b/src/Cafe/OS/libs/nn_olv/nn_olv.cpp index b2533588..038b555b 100644 --- a/src/Cafe/OS/libs/nn_olv/nn_olv.cpp +++ b/src/Cafe/OS/libs/nn_olv/nn_olv.cpp @@ -205,7 +205,7 @@ namespace nn uint32 UploadPostDataByPostApp(void *postParam) { - forceLog_printf("UploadPostDataByPostApp() called. Returning error"); + cemuLog_log(LogType::Force, "UploadPostDataByPostApp() called. Returning error"); return BUILD_NN_RESULT(NN_RESULT_LEVEL_STATUS, NN_RESULT_MODULE_NN_OLV, 0); // undefined error } @@ -226,4 +226,4 @@ namespace nn } } -} \ No newline at end of file +} diff --git a/src/Cafe/OS/libs/nsyshid/nsyshid.cpp b/src/Cafe/OS/libs/nsyshid/nsyshid.cpp index e6ae8815..870f3cf1 100644 --- a/src/Cafe/OS/libs/nsyshid/nsyshid.cpp +++ b/src/Cafe/OS/libs/nsyshid/nsyshid.cpp @@ -165,7 +165,7 @@ namespace nsyshid HIDDevice_t* hidDevice = getFreeDevice(); if (hidDevice == nullptr) { - forceLog_printf("HID: Maximum number of supported devices exceeded"); + cemuLog_log(LogType::Force, "HID: Maximum number of supported devices exceeded"); return; } @@ -194,12 +194,12 @@ namespace nsyshid } if (maxPacketInputLength <= 0 || maxPacketInputLength >= 0xF000) { - forceLog_printf("HID: Input packet length not available or out of range (length = %d)", maxPacketInputLength); + cemuLog_log(LogType::Force, "HID: Input packet length not available or out of range (length = {})", maxPacketInputLength); maxPacketInputLength = 0x20; } if (maxPacketOutputLength <= 0 || maxPacketOutputLength >= 0xF000) { - forceLog_printf("HID: Output packet length not available or out of range (length = %d)", maxPacketOutputLength); + cemuLog_log(LogType::Force, "HID: Output packet length not available or out of range (length = {})", maxPacketOutputLength); maxPacketOutputLength = 0x20; } // setup HIDDevice struct @@ -487,7 +487,7 @@ namespace nsyshid retryCount++; if (retryCount >= 40) { - forceLog_printf("HID async SetReport failed"); + cemuLog_log(LogType::Force, "HID async SetReport failed"); sint32 errorCode = -1; doHIDTransferCallback(callbackFuncMPTR, callbackParamMPTR, hidDeviceInfo->handle, errorCode, memory_getVirtualOffsetFromPointer(originalData), 0); free(reportData); @@ -545,7 +545,7 @@ namespace nsyshid HIDDeviceInfo_t* hidDeviceInfo = getHIDDeviceInfoByHandle(hidHandle, true); if (hidDeviceInfo == nullptr) { - forceLog_printf("nsyshid.HIDSetReport(): Unable to find device with hid handle %d", hidHandle); + cemuLog_log(LogType::Force, "nsyshid.HIDSetReport(): Unable to find device with hid handle {}", hidHandle); osLib_returnFromFunction(hCPU, -1); return; } @@ -641,7 +641,7 @@ namespace nsyshid } else { - forceLog_printf("Failed HID read"); + cemuLog_log(LogType::Force, "Failed HID read"); returnCode = -1; } free(tempBuffer); @@ -677,7 +677,7 @@ namespace nsyshid HIDDeviceInfo_t* hidDeviceInfo = getHIDDeviceInfoByHandle(hidHandle, true); if (hidDeviceInfo == nullptr) { - forceLog_printf("nsyshid.HIDRead(): Unable to find device with hid handle %d", hidHandle); + cemuLog_log(LogType::Force, "nsyshid.HIDRead(): Unable to find device with hid handle {}", hidHandle); osLib_returnFromFunction(hCPU, -1); return; } @@ -776,7 +776,7 @@ namespace nsyshid HIDDeviceInfo_t* hidDeviceInfo = getHIDDeviceInfoByHandle(hidHandle, true); if (hidDeviceInfo == nullptr) { - forceLog_printf("nsyshid.HIDWrite(): Unable to find device with hid handle %d", hidHandle); + cemuLog_log(LogType::Force, "nsyshid.HIDWrite(): Unable to find device with hid handle {}", hidHandle); osLib_returnFromFunction(hCPU, -1); return; } @@ -841,4 +841,4 @@ namespace nsyshid }; -#endif \ No newline at end of file +#endif diff --git a/src/Cafe/OS/libs/nsysnet/nsysnet.cpp b/src/Cafe/OS/libs/nsysnet/nsysnet.cpp index 7fecd848..400e8533 100644 --- a/src/Cafe/OS/libs/nsysnet/nsysnet.cpp +++ b/src/Cafe/OS/libs/nsysnet/nsysnet.cpp @@ -695,7 +695,7 @@ void nsysnetExport_inet_pton(PPCInterpreter_t* hCPU) if (af != 2) { - forceLog_printf("inet_pton() only supports AF_INET"); + cemuLog_log(LogType::Force, "inet_pton() only supports AF_INET"); osLib_returnFromFunction(hCPU, 0); return; } @@ -848,7 +848,7 @@ void nsysnetExport_accept(PPCInterpreter_t* hCPU) if (memory_readU32(lenMPTR) != 16) { - forceLog_printf("invalid sockaddr len in accept()"); + cemuLog_log(LogType::Force, "invalid sockaddr len in accept()"); cemu_assert_debug(false); osLib_returnFromFunction(hCPU, 0); return; @@ -873,7 +873,7 @@ void nsysnetExport_accept(PPCInterpreter_t* hCPU) else { // blocking accept is not supported yet - forceLog_printf("blocking accept() not supported"); + cemuLog_log(LogType::Force, "blocking accept() not supported"); cemu_assert_debug(false); } @@ -901,7 +901,7 @@ void nsysnetExport_connect(PPCInterpreter_t* hCPU) hostAddr.sa_family = _swapEndianU16(addr->sa_family); memcpy(hostAddr.sa_data, addr->sa_data, 14); sint32 hr = connect(vs->s, &hostAddr, sizeof(sockaddr)); - forceLog_printf("Attempt connect to %d.%d.%d.%d:%d", (sint32)(uint8)hostAddr.sa_data[2], (sint32)(uint8)hostAddr.sa_data[3], (sint32)(uint8)hostAddr.sa_data[4], (sint32)(uint8)hostAddr.sa_data[5], _swapEndianU16(*(uint16*)hostAddr.sa_data+0)); + cemuLog_log(LogType::Force, "Attempt connect to {}.{}.{}.{}:{}", (sint32)(uint8)hostAddr.sa_data[2], (sint32)(uint8)hostAddr.sa_data[3], (sint32)(uint8)hostAddr.sa_data[4], (sint32)(uint8)hostAddr.sa_data[5], _swapEndianU16(*(uint16*)hostAddr.sa_data+0)); r = _translateError(hr, GETLASTERR, _ERROR_MODE_CONNECT); @@ -1182,7 +1182,7 @@ void nsysnetExport_select(PPCInterpreter_t* hCPU) break; } } - //forceLog_printf("selectEndTime %d", timeGetTime()); + //cemuLog_log(LogType::Force, "selectEndTime {}", timeGetTime()); //extern int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, @@ -1353,7 +1353,7 @@ void nsysnetExport_gethostbyaddr(PPCInterpreter_t* hCPU) } else { - forceLog_printf("he->h_name not set or name too long"); + cemuLog_log(LogType::Force, "he->h_name not set or name too long"); strcpy(_staticHostentName.GetPtr(), ""); } // setup wuHostent address list diff --git a/src/Cafe/OS/libs/snd_core/ax_mix.cpp b/src/Cafe/OS/libs/snd_core/ax_mix.cpp index fecace8e..f8dee6f8 100644 --- a/src/Cafe/OS/libs/snd_core/ax_mix.cpp +++ b/src/Cafe/OS/libs/snd_core/ax_mix.cpp @@ -262,7 +262,7 @@ namespace snd_core if (numberOfDecodedAdpcmSamples >= 4096) { memset(output, 0, sizeof(float)*sampleCount); - forceLog_printf("Too many ADPCM samples to decode. ratio = %08x", ratio); + cemuLog_log(LogType::Force, "Too many ADPCM samples to decode. ratio = {:08x}", ratio); return; } AX_readADPCMSamples(internalShadowCopy, adpcmSampleBuffer, numberOfDecodedAdpcmSamples); diff --git a/src/Cafe/OS/libs/snd_core/ax_out.cpp b/src/Cafe/OS/libs/snd_core/ax_out.cpp index 85a94e52..68b05165 100644 --- a/src/Cafe/OS/libs/snd_core/ax_out.cpp +++ b/src/Cafe/OS/libs/snd_core/ax_out.cpp @@ -436,7 +436,7 @@ namespace snd_core } catch (std::runtime_error& ex) { - forceLog_printf("can't initialize tv audio: %s", ex.what()); + cemuLog_log(LogType::Force, "can't initialize tv audio: {}", ex.what()); exit(0); } } @@ -477,7 +477,7 @@ namespace snd_core } catch (std::runtime_error& ex) { - forceLog_printf("can't initialize pad audio: %s", ex.what()); + cemuLog_log(LogType::Force, "can't initialize pad audio: {}", ex.what()); exit(0); } } @@ -574,4 +574,4 @@ namespace snd_core } } -} \ No newline at end of file +} diff --git a/src/Cafe/OS/libs/snd_core/ax_voice.cpp b/src/Cafe/OS/libs/snd_core/ax_voice.cpp index 6a599c8b..b5795df9 100644 --- a/src/Cafe/OS/libs/snd_core/ax_voice.cpp +++ b/src/Cafe/OS/libs/snd_core/ax_voice.cpp @@ -233,13 +233,13 @@ namespace snd_core { if (voice == nullptr) { - forceLog_printf("AXVoiceBegin(): Invalid voice"); + cemuLog_log(LogType::Force, "AXVoiceBegin(): Invalid voice"); return -1; } uint32 index = (uint32)voice->index; if (index >= AX_MAX_VOICES) { - forceLog_printf("AXVoiceBegin(): Invalid voice index"); + cemuLog_log(LogType::Force, "AXVoiceBegin(): Invalid voice index"); return -1; } if (AXIst_IsFrameBeingProcessed()) @@ -273,13 +273,13 @@ namespace snd_core { if (voice == nullptr) { - forceLog_printf("AXVoiceBegin(): Invalid voice"); + cemuLog_log(LogType::Force, "AXVoiceBegin(): Invalid voice"); return -1; } uint32 index = (uint32)voice->index; if (index >= AX_MAX_VOICES) { - forceLog_printf("AXVoiceBegin(): Invalid voice index"); + cemuLog_log(LogType::Force, "AXVoiceBegin(): Invalid voice index"); return -1; } if (AXIst_IsFrameBeingProcessed()) @@ -428,7 +428,7 @@ namespace snd_core __AXVoiceListSpinlock.lock(); if (vpb->priority == (uint32be)AX_PRIORITY_FREE) { - forceLog_printf("AXFreeVoice() called on free voice\n"); + cemuLog_log(LogType::Force, "AXFreeVoice() called on free voice"); __AXVoiceListSpinlock.unlock(); return; } @@ -692,7 +692,7 @@ namespace snd_core } else { - forceLog_printf("AXSetVoiceSrcType(): Unsupported src type %d", srcType); + cemuLog_log(LogType::Force, "AXSetVoiceSrcType(): Unsupported src type {}", srcType); } AXSetSyncFlag(vpb, AX_SYNCFLAG_SRCFILTER); AXVoiceProtection_Acquire(vpb); @@ -843,7 +843,7 @@ namespace snd_core MPTR sampleBase = _swapEndianU32(pbOffset->samples); if (sampleBase == MPTR_NULL) { - forceLog_printf("AXSetVoiceOffsets(): Invalid sample address"); + cemuLog_log(LogType::Force, "AXSetVoiceOffsets(): Invalid sample address"); cemu_assert_debug(false); return; } @@ -1283,4 +1283,4 @@ namespace snd_core cafeExportRegister("sndcore2", AXGetVoiceOffsets, LogType::SoundAPI); cafeExportRegister("sndcore2", AXGetVoiceCurrentOffsetEx, LogType::SoundAPI); } -} \ No newline at end of file +} diff --git a/src/Cafe/OS/libs/sysapp/sysapp.cpp b/src/Cafe/OS/libs/sysapp/sysapp.cpp index b27a7cf3..47695966 100644 --- a/src/Cafe/OS/libs/sysapp/sysapp.cpp +++ b/src/Cafe/OS/libs/sysapp/sysapp.cpp @@ -453,7 +453,7 @@ void sysappExport__SYSLaunchMiiStudio(PPCInterpreter_t* hCPU) void sysappExport__SYSReturnToCallerWithStandardResult(PPCInterpreter_t* hCPU) { ppcDefineParamU32BEPtr(resultPtr, 0); - forceLog_printf("_SYSReturnToCallerWithStandardResult(0x%08x) result: 0x%08x", hCPU->gpr[3], (uint32)*resultPtr); + cemuLog_log(LogType::Force, "_SYSReturnToCallerWithStandardResult(0x{:08x}) result: 0x{:08x}", hCPU->gpr[3], (uint32)*resultPtr); while (true) std::this_thread::sleep_for(std::chrono::milliseconds(10)); } diff --git a/src/Cemu/FileCache/FileCache.cpp b/src/Cemu/FileCache/FileCache.cpp index dd7c6d4f..aa7770a3 100644 --- a/src/Cemu/FileCache/FileCache.cpp +++ b/src/Cemu/FileCache/FileCache.cpp @@ -263,7 +263,7 @@ void FileCache::fileCache_updateFiletable(sint32 extraEntriesToAllocate) // update file table info in struct if (this->fileTableEntries[0].name1 != FILECACHE_FILETABLE_NAME1 || this->fileTableEntries[0].name2 != FILECACHE_FILETABLE_NAME2) { - forceLog_printf("Corruption in cache file detected"); + cemuLog_log(LogType::Force, "Corruption in cache file detected"); assert_dbg(); } this->fileTableOffset = this->fileTableEntries[0].fileOffset; @@ -390,7 +390,7 @@ void FileCache::_addFileInternal(uint64 name1, uint64 name2, const uint8* fileDa { if (name1 == FILECACHE_FILETABLE_NAME1 && name2 == FILECACHE_FILETABLE_NAME2) { - forceLog_printf("Error in cache file"); + cemuLog_log(LogType::Force, "Error in cache file"); cemu_assert_debug(false); } // no free entry, recreate file table with larger size @@ -552,7 +552,7 @@ bool FileCache::GetFileByIndex(sint32 index, uint64* name1, uint64* name2, std:: FileTableEntry* entry = this->fileTableEntries + index; if (this->fileTableEntries == nullptr) { - forceLog_printf("GetFileByIndex() fileTable is NULL"); + cemuLog_log(LogType::Force, "GetFileByIndex() fileTable is NULL"); return false; } if (entry->name1 == FILECACHE_FILETABLE_FREE_NAME && entry->name2 == FILECACHE_FILETABLE_FREE_NAME) @@ -657,4 +657,4 @@ void fileCache_test() delete fcRead; cemu_assert_debug(false); exit(0); -} \ No newline at end of file +} diff --git a/src/Cemu/Tools/DownloadManager/DownloadManager.cpp b/src/Cemu/Tools/DownloadManager/DownloadManager.cpp index 5ede52d4..bb8eaa92 100644 --- a/src/Cemu/Tools/DownloadManager/DownloadManager.cpp +++ b/src/Cemu/Tools/DownloadManager/DownloadManager.cpp @@ -672,7 +672,7 @@ void DownloadManager::_handle_connect() { if (!_connect_refreshIASAccountIdAndDeviceToken()) { - forceLog_printf("Failed to request IAS token"); + cemuLog_log(LogType::Force, "Failed to request IAS token"); cemu_assert_debug(false); m_connectState.store(CONNECT_STATE::FAILED); setStatusMessage(std::string(_("Login failed. Outdated or incomplete online files?")), DLMGR_STATUS_CODE::FAILED); diff --git a/src/Cemu/napi/napi_ec.cpp b/src/Cemu/napi/napi_ec.cpp index c355da4f..d0c9e91d 100644 --- a/src/Cemu/napi/napi_ec.cpp +++ b/src/Cemu/napi/napi_ec.cpp @@ -253,7 +253,7 @@ namespace NAPI result.deviceToken = responseNode.child_value("DeviceToken"); if (boost::iequals(responseNode.child_value("DeviceTokenExpired"), "true")) - forceLog_printf("Unexpected server response: Device token expired"); + cemuLog_log(LogType::Force, "Unexpected server response: Device token expired"); /* example response: @@ -363,7 +363,7 @@ namespace NAPI else if (boost::iequals(serviceType, "NusURL")) result.serviceURLs.NusURL = url; else - forceLog_printf("GetAccountStatus: Unknown service URI type {}", serviceType); + cemuLog_log(LogType::Force, "GetAccountStatus: Unknown service URI type {}", serviceType); } // assign service URLs diff --git a/src/Cemu/napi/napi_helper.cpp b/src/Cemu/napi/napi_helper.cpp index 016fc597..71aa0421 100644 --- a/src/Cemu/napi/napi_helper.cpp +++ b/src/Cemu/napi/napi_helper.cpp @@ -21,16 +21,16 @@ CURLcode _sslctx_function_NUS(CURL* curl, void* sslctx, void* param) { if (iosuCrypto_addCACertificate(sslctx, 102) == false) { - forceLog_printf("Invalid CA certificate (102)"); + cemuLog_log(LogType::Force, "Invalid CA certificate (102)"); } if (iosuCrypto_addCACertificate(sslctx, 0x69) == false) { - forceLog_printf("Invalid CA certificate (105)"); + cemuLog_log(LogType::Force, "Invalid CA certificate (105)"); } if (iosuCrypto_addClientCertificate(sslctx, 3) == false) { - forceLog_printf("Certificate error"); + cemuLog_log(LogType::Force, "Certificate error"); } SSL_CTX_set_mode((SSL_CTX*)sslctx, SSL_MODE_AUTO_RETRY); SSL_CTX_set_verify_depth((SSL_CTX*)sslctx, 2); @@ -42,7 +42,7 @@ CURLcode _sslctx_function_IDBE(CURL* curl, void* sslctx, void* param) { if (iosuCrypto_addCACertificate(sslctx, 105) == false) { - forceLog_printf("Invalid CA certificate (105)"); + cemuLog_log(LogType::Force, "Invalid CA certificate (105)"); } SSL_CTX_set_mode((SSL_CTX*)sslctx, SSL_MODE_AUTO_RETRY); SSL_CTX_set_verify_depth((SSL_CTX*)sslctx, 2); @@ -54,12 +54,12 @@ CURLcode _sslctx_function_SOAP(CURL* curl, void* sslctx, void* param) { if (iosuCrypto_addCACertificate(sslctx, 102) == false) { - forceLog_printf("Invalid CA certificate (102)"); - forceLog_printf("Certificate error"); + cemuLog_log(LogType::Force, "Invalid CA certificate (102)"); + cemuLog_log(LogType::Force, "Certificate error"); } if (iosuCrypto_addClientCertificate(sslctx, 1) == false) { - forceLog_printf("Certificate error"); + cemuLog_log(LogType::Force, "Certificate error"); } SSL_CTX_set_mode((SSL_CTX*)sslctx, SSL_MODE_AUTO_RETRY); SSL_CTX_set_verify_depth((SSL_CTX*)sslctx, 2); @@ -374,7 +374,7 @@ namespace NAPI // parse XML response if (!doc.load_buffer(soapHelper.getReceivedData().data(), soapHelper.getReceivedData().size())) { - forceLog_printf("Failed to parse GetRegistrationInfo() response"); + cemuLog_log(LogType::Force, "Failed to parse GetRegistrationInfo() response"); result.apiError = NAPI_RESULT::XML_ERROR; return false; } diff --git a/src/Cemu/napi/napi_version.cpp b/src/Cemu/napi/napi_version.cpp index 1979b822..9fc71556 100644 --- a/src/Cemu/napi/napi_version.cpp +++ b/src/Cemu/napi/napi_version.cpp @@ -74,7 +74,7 @@ namespace NAPI pugi::xml_document doc; if (!doc.load_buffer(receivedData.data(), receivedData.size())) { - forceLog_printf("Failed to parse update list XML"); + cemuLog_log(LogType::Force, "Failed to parse update list XML"); return result; } // example: @@ -100,4 +100,4 @@ namespace NAPI result.isValid = true; return result; } -}; \ No newline at end of file +}; diff --git a/src/Cemu/nex/nex.cpp b/src/Cemu/nex/nex.cpp index 34c62ca0..317b3877 100644 --- a/src/Cemu/nex/nex.cpp +++ b/src/Cemu/nex/nex.cpp @@ -512,21 +512,21 @@ void nexServiceAuthentication_handleResponse_requestTicket(nexService* nex, nexS authenticationService_t* authService = (authenticationService_t*)response->custom; if (response->isSuccessful == false) { - forceLog_printf("NEX: RPC error while requesting auth ticket with error code 0x%08x", response->errorCode); + cemuLog_log(LogType::Force, "NEX: RPC error while requesting auth ticket with error code 0x{:08x}", response->errorCode); authService->hasError = true; return; } uint32 returnValue = response->data.readU32(); if (returnValue & 0x80000000) { - forceLog_printf("NEX: Failed to request auth ticket with error code 0x%08x", returnValue); + cemuLog_log(LogType::Force, "NEX: Failed to request auth ticket with error code 0x{:08x}", returnValue); authService->hasError = true; } authService->kerberosTicket2Size = response->data.readBuffer(authService->kerberosTicket2, sizeof(authService->kerberosTicket2)); if (response->data.hasReadOutOfBounds()) { authService->hasError = true; - forceLog_printf("NEX: Out of bounds error while reading auth ticket"); + cemuLog_log(LogType::Force, "NEX: Out of bounds error while reading auth ticket"); return; } authService->done = true; @@ -538,7 +538,7 @@ void nexServiceAuthentication_handleResponse_login(nexService* nex, nexServiceRe if (response->isSuccessful == false) { authService->hasError = true; - forceLog_printf("NEX: RPC error in login response 0x%08x", response->errorCode); + cemuLog_log(LogType::Force, "NEX: RPC error in login response 0x{:08x}", response->errorCode); return; } @@ -546,7 +546,7 @@ void nexServiceAuthentication_handleResponse_login(nexService* nex, nexServiceRe if (returnValue & 0x80000000) { authService->hasError = true; - forceLog_printf("NEX: Error 0x%08x in login response (returnCode 0x%08x)", response->errorCode, returnValue); + cemuLog_log(LogType::Force, "NEX: Error 0x{:08x} in login response (returnCode 0x{:08x})", response->errorCode, returnValue); return; } @@ -571,7 +571,7 @@ void nexServiceAuthentication_handleResponse_login(nexService* nex, nexServiceRe if (response->data.hasReadOutOfBounds()) { authService->hasError = true; - forceLog_printf("NEX: Read out of bounds"); + cemuLog_log(LogType::Force, "NEX: Read out of bounds"); return; } // request ticket data @@ -595,14 +595,14 @@ void nexServiceSecure_handleResponse_RegisterEx(nexService* nex, nexServiceRespo uint32 returnCode = response->data.readU32(); if (response->isSuccessful == false || response->data.hasReadOutOfBounds()) { - forceLog_printf("NEX: RPC error in secure register"); + cemuLog_log(LogType::Force, "NEX: RPC error in secure register"); info->isSuccessful = false; info->isComplete = true; return; } if (returnCode & 0x80000000) { - forceLog_printf("NEX: Secure register failed with error code 0x%08x", returnCode); + cemuLog_log(LogType::Force, "NEX: Secure register failed with error code 0x{:08x}", returnCode); info->isSuccessful = false; info->isComplete = true; return; @@ -627,7 +627,7 @@ nexService* nex_secureLogin(authServerInfo_t* authServerInfo, const char* access if (prudpSecureSock->getConnectionState() == prudpClient::STATE_DISCONNECTED) { // timeout or disconnected - forceLog_printf("NEX: Secure login connection time-out"); + cemuLog_log(LogType::Force, "NEX: Secure login connection time-out"); delete prudpSecureSock; return nullptr; } @@ -656,13 +656,13 @@ nexService* nex_secureLogin(authServerInfo_t* authServerInfo, const char* access break; if (nex->getState() == nexService::STATE_DISCONNECTED) { - forceLog_printf("NEX: Connection error while registering"); + cemuLog_log(LogType::Force, "NEX: Connection error while registering"); break; } } if (secureRegisterExData.isSuccessful == false) { - forceLog_printf("NEX: Failed to register to secure server"); + cemuLog_log(LogType::Force, "NEX: Failed to register to secure server"); nex->destroy(); return nullptr; } @@ -682,7 +682,7 @@ nexService* nex_establishSecureConnection(uint32 authServerIp, uint16 authServer { // error authConnection->destroy(); - forceLog_printf("NEX: Failed to connect to the NEX server"); + cemuLog_log(LogType::Force, "NEX: Failed to connect to the NEX server"); return nullptr; } // send auth login request @@ -704,7 +704,7 @@ nexService* nex_establishSecureConnection(uint32 authServerIp, uint16 authServer { // error authConnection->destroy(); - forceLog_printf("NEX: Error during authentication"); + cemuLog_log(LogType::Force, "NEX: Error during authentication"); return nullptr; } // close connection to auth server @@ -726,7 +726,7 @@ nexService* nex_establishSecureConnection(uint32 authServerIp, uint16 authServer if (nexAuthService.kerberosTicket2Size < 16) { nexAuthService.hasError = true; - forceLog_printf("NEX: Kerberos ticket too short"); + cemuLog_log(LogType::Force, "NEX: Kerberos ticket too short"); return nullptr; } // check hmac of ticket @@ -735,7 +735,7 @@ nexService* nex_establishSecureConnection(uint32 authServerIp, uint16 authServer if (memcmp(hmacTicket, nexAuthService.kerberosTicket2 + nexAuthService.kerberosTicket2Size - 16, 16) != 0) { nexAuthService.hasError = true; - forceLog_printf("NEX: Kerberos ticket hmac invalid"); + cemuLog_log(LogType::Force, "NEX: Kerberos ticket hmac invalid"); return nullptr; } // auth info @@ -752,7 +752,7 @@ nexService* nex_establishSecureConnection(uint32 authServerIp, uint16 authServer if (packetKerberosTicket.hasReadOutOfBounds()) { - forceLog_printf("NEX: Parse error"); + cemuLog_log(LogType::Force, "NEX: Parse error"); return nullptr; } @@ -762,4 +762,4 @@ nexService* nex_establishSecureConnection(uint32 authServerIp, uint16 authServer authServerInfo->userPid = pid; return nex_secureLogin(authServerInfo.get(), accessKey, nexToken); -} \ No newline at end of file +} diff --git a/src/Cemu/nex/nexFriends.cpp b/src/Cemu/nex/nexFriends.cpp index 6d902177..cd95eca8 100644 --- a/src/Cemu/nex/nexFriends.cpp +++ b/src/Cemu/nex/nexFriends.cpp @@ -335,7 +335,7 @@ void NexFriends::handleResponse_getAllInformation(nexServiceResponse_t* response uint8 isPreferenceInvalid = response->data.readU8(); // if not zero, preferences must be setup if (isPreferenceInvalid) { - forceLog_printf("NEX: First time login into friend account, setting up default preferences"); + cemuLog_log(LogType::Force, "NEX: First time login into friend account, setting up default preferences"); session->updatePreferences(nexPrincipalPreference(1, 1, 0)); } @@ -972,7 +972,7 @@ void NexFriends::update() } if (timeSinceLastLoginAttempt < delayTime) return; - forceLog_printf("NEX: Attempt async friend service login"); + cemuLog_log(LogType::Force, "NEX: Attempt async friend service login"); initiateLogin(); } } @@ -980,7 +980,7 @@ void NexFriends::update() { if (this->nexCon == nullptr || this->nexCon->getState() != nexService::STATE_CONNECTED) { - forceLog_printf("NEX: Lost friend server session"); + cemuLog_log(LogType::Force, "NEX: Lost friend server session"); if (this->nexCon) { this->nexCon->destroy(); diff --git a/src/Cemu/nex/prudp.cpp b/src/Cemu/nex/prudp.cpp index 12e4570e..e1b7ca5c 100644 --- a/src/Cemu/nex/prudp.cpp +++ b/src/Cemu/nex/prudp.cpp @@ -519,7 +519,7 @@ prudpClient::prudpClient(uint32 dstIp, uint16 dstPort, const char* key) : prudpC { if (tries == 4) { - forceLog_printf("PRUDP: Failed to bind UDP socket"); + cemuLog_log(LogType::Force, "PRUDP: Failed to bind UDP socket"); currentConnectionState = STATE_DISCONNECTED; srcPort = 0; return; diff --git a/src/audio/DirectSoundAPI.cpp b/src/audio/DirectSoundAPI.cpp index ff2dc6dc..a102b01c 100644 --- a/src/audio/DirectSoundAPI.cpp +++ b/src/audio/DirectSoundAPI.cpp @@ -116,7 +116,7 @@ void DirectSoundAPI::AudioThread() if (FAILED(hr)) { - forceLog_printf("DirectSound: Dropped audio block due to locking failure"); + cemuLog_log(LogType::Force, "DirectSound: Dropped audio block due to locking failure"); continue; } diff --git a/src/audio/IAudioAPI.cpp b/src/audio/IAudioAPI.cpp index f45b9484..d078900b 100644 --- a/src/audio/IAudioAPI.cpp +++ b/src/audio/IAudioAPI.cpp @@ -27,14 +27,15 @@ IAudioAPI::IAudioAPI(uint32 samplerate, uint32 channels, uint32 samples_per_bloc void IAudioAPI::PrintLogging() { - forceLog_printf("------- Init Audio backend -------"); - forceLog_printf("DirectSound: %s", s_availableApis[DirectSound] ? "available" : "not supported"); - forceLog_printf("XAudio 2.8: %s", s_availableApis[XAudio2] ? "available" : "not supported"); + cemuLog_log(LogType::Force, "------- Init Audio backend -------"); + cemuLog_log(LogType::Force, "DirectSound: {}", s_availableApis[DirectSound] ? "available" : "not supported"); + cemuLog_log(LogType::Force, "XAudio 2.8: {}", s_availableApis[XAudio2] ? "available" : "not supported"); if (!s_availableApis[XAudio2]) { - forceLog_printf("XAudio 2.7: %s", s_availableApis[XAudio27] ? "available" : "not supported") + cemuLog_log(LogType::Force, "XAudio 2.7: {}", s_availableApis[XAudio27] ? "available" : "not supported"); } - forceLog_printf("Cubeb: %s", s_availableApis[Cubeb] ? "available" : "not supported"); + + cemuLog_log(LogType::Force, "Cubeb: {}", s_availableApis[Cubeb] ? "available" : "not supported"); } void IAudioAPI::InitWFX(sint32 samplerate, sint32 channels, sint32 bits_per_sample) diff --git a/src/audio/IAudioInputAPI.cpp b/src/audio/IAudioInputAPI.cpp index c896b6fa..28032eb9 100644 --- a/src/audio/IAudioInputAPI.cpp +++ b/src/audio/IAudioInputAPI.cpp @@ -16,8 +16,8 @@ IAudioInputAPI::IAudioInputAPI(uint32 samplerate, uint32 channels, uint32 sample void IAudioInputAPI::PrintLogging() { - forceLog_printf("------- Init Audio input backend -------"); - forceLog_printf("Cubeb: %s", s_availableApis[Cubeb] ? "available" : "not supported"); + cemuLog_log(LogType::Force, "------- Init Audio input backend -------"); + cemuLog_log(LogType::Force, "Cubeb: {}", s_availableApis[Cubeb] ? "available" : "not supported"); } void IAudioInputAPI::InitializeStatic() diff --git a/src/audio/XAudio2API.cpp b/src/audio/XAudio2API.cpp index 9759210d..7bf0e8ed 100644 --- a/src/audio/XAudio2API.cpp +++ b/src/audio/XAudio2API.cpp @@ -49,8 +49,8 @@ XAudio2API::XAudio2API(std::wstring device_id, uint32 samplerate, uint32 channel m_wfx.Format.nChannels = channels; m_wfx.Format.nSamplesPerSec = samplerate; m_wfx.Format.wBitsPerSample = bits_per_sample; - m_wfx.Format.nBlockAlign = (m_wfx.Format.nChannels * m_wfx.Format.wBitsPerSample) / 8; // must equal (nChannels × wBitsPerSample) / 8 - m_wfx.Format.nAvgBytesPerSec = m_wfx.Format.nSamplesPerSec * m_wfx.Format.nBlockAlign; // must equal nSamplesPerSec × nBlockAlign. + m_wfx.Format.nBlockAlign = (m_wfx.Format.nChannels * m_wfx.Format.wBitsPerSample) / 8; // must equal (nChannels × wBitsPerSample) / 8 + m_wfx.Format.nAvgBytesPerSec = m_wfx.Format.nSamplesPerSec * m_wfx.Format.nBlockAlign; // must equal nSamplesPerSec × nBlockAlign. m_wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); m_wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; @@ -258,7 +258,7 @@ const std::vector& XAudio2API::RefreshDevices( } catch (const std::system_error& ex) { - forceLog_printf("XAudio2API::RefreshDevices: error while refreshing device list (%s - code: 0x%08x)", ex.what(), ex.code().value()); + cemuLog_log(LogType::Force, "XAudio2API::RefreshDevices: error while refreshing device list ({} - code: 0x{:08x})", ex.what(), ex.code().value()); } CoUninitialize(); diff --git a/src/config/ActiveSettings.cpp b/src/config/ActiveSettings.cpp index af5cdb2f..5f17efb1 100644 --- a/src/config/ActiveSettings.cpp +++ b/src/config/ActiveSettings.cpp @@ -33,7 +33,7 @@ ActiveSettings::LoadOnce(const fs::path& user_data_path, } if (!TestWriteAccess(path)) { - cemuLog_log(LogType::Force, "Failed to write to {}", path.generic_string()); + cemuLog_log(LogType::Force, "Failed to write to {}", _pathToUtf8(path)); failed_write_access.insert(path); } } diff --git a/src/config/CemuConfig.cpp b/src/config/CemuConfig.cpp index e51dfbed..a4016ae4 100644 --- a/src/config/CemuConfig.cpp +++ b/src/config/CemuConfig.cpp @@ -28,7 +28,7 @@ void CemuConfig::SetMLCPath(fs::path path, bool save) catch (const PSDisabledException&) {} catch (const std::exception& ex) { - forceLog_printf("can't store custom mlc path in permanent storage: %s", ex.what()); + cemuLog_log(LogType::Force, "can't store custom mlc path in permanent storage: {}", ex.what()); } } @@ -114,7 +114,7 @@ void CemuConfig::Load(XMLConfigParser& parser) } catch (const std::exception&) { - forceLog_printf("config load error: can't load recently launched game file: %s", path.c_str()); + cemuLog_log(LogType::Force, "config load error: can't load recently launched game file: {}", path); } } @@ -132,7 +132,7 @@ void CemuConfig::Load(XMLConfigParser& parser) } catch (const std::exception&) { - forceLog_printf("config load error: can't load recently launched nfc file: %s", path.c_str()); + cemuLog_log(LogType::Force, "config load error: can't load recently launched nfc file: {}", path); } } @@ -150,7 +150,7 @@ void CemuConfig::Load(XMLConfigParser& parser) } catch (const std::exception&) { - forceLog_printf("config load error: can't load game path: %s", path.c_str()); + cemuLog_log(LogType::Force, "config load error: can't load game path: {}", path); } } @@ -186,7 +186,7 @@ void CemuConfig::Load(XMLConfigParser& parser) } catch (const std::exception&) { - forceLog_printf("config load error: can't load game cache entry: %s", rpx); + cemuLog_log(LogType::Force, "config load error: can't load game cache entry: {}", rpx); } } _lock.unlock(); @@ -302,7 +302,7 @@ void CemuConfig::Load(XMLConfigParser& parser) } catch (const std::exception&) { - forceLog_printf("config load error: can't load tv device: %s", tv); + cemuLog_log(LogType::Force, "config load error: can't load tv device: {}", tv); } const auto pad = audio.get("PadDevice", ""); @@ -312,7 +312,7 @@ void CemuConfig::Load(XMLConfigParser& parser) } catch (const std::exception&) { - forceLog_printf("config load error: can't load pad device: %s", pad); + cemuLog_log(LogType::Force, "config load error: can't load pad device: {}", pad); } const auto input_device_name = audio.get("InputDevice", ""); @@ -322,7 +322,7 @@ void CemuConfig::Load(XMLConfigParser& parser) } catch (const std::exception&) { - forceLog_printf("config load error: can't load input device: %s", input_device_name); + cemuLog_log(LogType::Force, "config load error: can't load input device: {}", input_device_name); } // account diff --git a/src/config/LaunchSettings.cpp b/src/config/LaunchSettings.cpp index 11332695..958ba459 100644 --- a/src/config/LaunchSettings.cpp +++ b/src/config/LaunchSettings.cpp @@ -252,7 +252,7 @@ bool LaunchSettings::ExtractorTool(std::wstring_view wud_path, std::string_view } catch (const std::exception& ex) { - forceLog_printf("can't write file: %s", ex.what()); + cemuLog_log(LogType::Force, "can't write file: {}", ex.what()); puts(fmt::format("can't write file: %s\n", ex.what()).c_str()); } } diff --git a/src/config/PermanentStorage.cpp b/src/config/PermanentStorage.cpp index 597e210c..e095ff4b 100644 --- a/src/config/PermanentStorage.cpp +++ b/src/config/PermanentStorage.cpp @@ -25,7 +25,7 @@ PermanentStorage::~PermanentStorage() if (ec) { SystemException ex(ec); - forceLog_printf("can't remove permanent storage: %s", ex.what()); + cemuLog_log(LogType::Force, "can't remove permanent storage: {}", ex.what()); } } } diff --git a/src/config/XMLConfig.h b/src/config/XMLConfig.h index 3932e2f0..788dc9a7 100644 --- a/src/config/XMLConfig.h +++ b/src/config/XMLConfig.h @@ -390,7 +390,7 @@ public: fs::create_directories(fs::path(filename).parent_path(), err); if (err) { - forceLog_printf("can't create parent path for save file: %s", err.message().c_str()); + cemuLog_log(LogType::Force, "can't create parent path for save file: {}", err.message()); return false; } diff --git a/src/gui/CemuUpdateWindow.cpp b/src/gui/CemuUpdateWindow.cpp index 67454309..5a6f05f5 100644 --- a/src/gui/CemuUpdateWindow.cpp +++ b/src/gui/CemuUpdateWindow.cpp @@ -130,7 +130,7 @@ bool CemuUpdateWindow::QueryUpdateInfo(std::string& downloadUrlOut, std::string& curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_code); if (http_code != 0 && http_code != 200) { - forceLog_printf("Update check failed (http code: %d)", http_code); + cemuLog_log(LogType::Force, "Update check failed (http code: {})", http_code); cemu_assert_debug(false); return false; } @@ -154,7 +154,7 @@ bool CemuUpdateWindow::QueryUpdateInfo(std::string& downloadUrlOut, std::string& } else { - forceLog_printf("Update check failed with CURL error %d", (int)cr); + cemuLog_log(LogType::Force, "Update check failed with CURL error {}", (int)cr); cemu_assert_debug(false); } @@ -261,7 +261,7 @@ bool CemuUpdateWindow::DownloadCemuZip(const std::string& url, const fs::path& f } catch (const std::exception& ex) { - forceLog_printf("can't remove update.zip on error: %s", ex.what()); + cemuLog_log(LogType::Force, "can't remove update.zip on error: {}", ex.what()); } } return result; @@ -309,13 +309,13 @@ bool CemuUpdateWindow::ExtractUpdate(const fs::path& zipname, const fs::path& ta catch (const std::exception& ex) { SystemException sys(ex); - forceLog_printf("can't create folder \"%s\" for update: %s", sb.name, sys.what()); + cemuLog_log(LogType::Force, "can't create folder \"{}\" for update: {}", sb.name, sys.what()); } // the root should have only one Cemu_... directory, we track it here if ((std::count(sb.name, sb.name + len, '/') + std::count(sb.name, sb.name + len, '\\')) == 1) { if (!cemuFolderName.empty()) - forceLog_printf("update zip has multiple folders in root"); + cemuLog_log(LogType::Force, "update zip has multiple folders in root"); cemuFolderName.assign(sb.name, len - 1); } continue; @@ -325,7 +325,7 @@ bool CemuUpdateWindow::ExtractUpdate(const fs::path& zipname, const fs::path& ta auto* zf = zip_fopen_index(za, i, 0); if (!zf) { - forceLog_printf("can't open zip file \"%s\"", sb.name); + cemuLog_log(LogType::Force, "can't open zip file \"{}\"", sb.name); zip_close(za); return false; } @@ -334,7 +334,7 @@ bool CemuUpdateWindow::ExtractUpdate(const fs::path& zipname, const fs::path& ta const auto read = zip_fread(zf, buffer.data(), sb.size); if (read != (sint64)sb.size) { - forceLog_printf("could only read 0x%x of 0x%x bytes from zip file \"%s\"", read, sb.size, sb.name); + cemuLog_log(LogType::Force, "could only read 0x{:x} of 0x{:x} bytes from zip file \"{}\"", read, sb.size, sb.name); zip_close(za); return false; } @@ -342,7 +342,7 @@ bool CemuUpdateWindow::ExtractUpdate(const fs::path& zipname, const fs::path& ta auto* file = fopen(fname.string().c_str(), "wb"); if (file == nullptr) { - forceLog_printf("can't create update file \"%s\"", sb.name); + cemuLog_log(LogType::Force, "can't create update file \"{}\"", sb.name); zip_close(za); return false; } @@ -460,7 +460,7 @@ void CemuUpdateWindow::WorkerThread() catch (const std::exception& ex) { SystemException sys(ex); - forceLog_printf("can't remove extracted tmp files: %s", sys.what()); + cemuLog_log(LogType::Force, "can't remove extracted tmp files: {}", sys.what()); } } @@ -506,7 +506,7 @@ void CemuUpdateWindow::WorkerThread() catch (const std::exception& ex) { SystemException sys(ex); - forceLog_printf("applying update error: %s", sys.what()); + cemuLog_log(LogType::Force, "applying update error: {}", sys.what()); } if ((counter++ % 10) == 0) @@ -529,7 +529,7 @@ void CemuUpdateWindow::WorkerThread() catch (const std::exception& ex) { SystemException sys(ex); - forceLog_printf("update error: %s", sys.what()); + cemuLog_log(LogType::Force, "update error: {}", sys.what()); // clean leftovers if (exists(tmppath)) diff --git a/src/gui/ChecksumTool.cpp b/src/gui/ChecksumTool.cpp index 20e9f7ca..7dc61bb3 100644 --- a/src/gui/ChecksumTool.cpp +++ b/src/gui/ChecksumTool.cpp @@ -335,7 +335,7 @@ void ChecksumTool::LoadOnlineData() const } catch(const std::exception& ex) { - forceLog_printf("error on updating json checksum data: %s", ex.what()); + cemuLog_log(LogType::Force, "error on updating json checksum data: {}", ex.what()); } wxQueueEvent(m_verify_online, new wxCommandEvent(wxEVT_ENABLE)); @@ -778,4 +778,4 @@ void ChecksumTool::DoWork() wxQueueEvent(this, new wxSetGaugeValue(100, m_progress, m_status, wxStringFormat2(_("Generated checksum of {} game files"), file_count))); break; } -} \ No newline at end of file +} diff --git a/src/gui/DownloadGraphicPacksWindow.cpp b/src/gui/DownloadGraphicPacksWindow.cpp index 4128cc04..08cd80a1 100644 --- a/src/gui/DownloadGraphicPacksWindow.cpp +++ b/src/gui/DownloadGraphicPacksWindow.cpp @@ -136,7 +136,7 @@ void DownloadGraphicPacksWindow::UpdateThread() else { // cemu api request failed, use hardcoded github url - forceLog_printf("Graphic pack update request failed or returned invalid URL. Using default repository URL instead"); + cemuLog_log(LogType::Force, "Graphic pack update request failed or returned invalid URL. Using default repository URL instead"); githubAPIUrl = "https://api.github.com/repos/slashiee/cemu_graphic_packs/releases/latest"; } // github API request diff --git a/src/gui/GameUpdateWindow.cpp b/src/gui/GameUpdateWindow.cpp index c16cc89c..8db78baf 100644 --- a/src/gui/GameUpdateWindow.cpp +++ b/src/gui/GameUpdateWindow.cpp @@ -105,7 +105,7 @@ bool GameUpdateWindow::ParseUpdate(const fs::path& metaPath) } catch (const std::exception& ex) { - forceLog_printf("GameUpdateWindow::ParseUpdate exist-error: %s at %s", ex.what(), target_location.generic_u8string().c_str()); + cemuLog_log(LogType::Force, "GameUpdateWindow::ParseUpdate exist-error: {} at {}", ex.what(), _pathToUtf8(target_location)); } } diff --git a/src/gui/GeneralSettings2.cpp b/src/gui/GeneralSettings2.cpp index a897d46b..34627737 100644 --- a/src/gui/GeneralSettings2.cpp +++ b/src/gui/GeneralSettings2.cpp @@ -1276,7 +1276,7 @@ void GeneralSettings2::OnAccountDelete(wxCommandEvent& event) catch(const std::exception& ex) { SystemException sys(ex); - forceLog_printf((char*)sys.what()); + cemuLog_log(LogType::Force, sys.what()); } } @@ -1743,7 +1743,7 @@ void GeneralSettings2::UpdateAudioDevice() } catch (std::runtime_error& ex) { - forceLog_printf("can't initialize tv audio: %s", ex.what()); + cemuLog_log(LogType::Force, "can't initialize tv audio: {}", ex.what()); } } } @@ -1792,7 +1792,7 @@ void GeneralSettings2::UpdateAudioDevice() } catch (std::runtime_error& ex) { - forceLog_printf("can't initialize pad audio: %s", ex.what()); + cemuLog_log(LogType::Force, "can't initialize pad audio: {}", ex.what()); } } } @@ -1840,7 +1840,7 @@ void GeneralSettings2::UpdateAudioDevice() } catch (std::runtime_error& ex) { - forceLog_printf("can't initialize pad audio: %s", ex.what()); + cemuLog_log(LogType::Force, "can't initialize pad audio: {}", ex.what()); } } } diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 1a87af0a..d4db3232 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -1035,7 +1035,7 @@ void MainWindow::OnDebugSetting(wxCommandEvent& event) catch (const std::exception& ex) { SystemException sys(ex); - forceLog_printf("error when creating dump curl folder: %s", sys.what()); + cemuLog_log(LogType::Force, "error when creating dump curl folder: {}", sys.what()); ActiveSettings::EnableDumpLibcurlRequests(false); } } @@ -1092,7 +1092,7 @@ void MainWindow::OnDebugDumpUsedTextures(wxCommandEvent& event) catch (const std::exception& ex) { SystemException sys(ex); - forceLog_printf("can't create texture dump folder: %s", ex.what()); + cemuLog_log(LogType::Force, "can't create texture dump folder: {}", ex.what()); ActiveSettings::EnableDumpTextures(false); } } @@ -1113,7 +1113,7 @@ void MainWindow::OnDebugDumpUsedShaders(wxCommandEvent& event) catch (const std::exception & ex) { SystemException sys(ex); - forceLog_printf("can't create shaders dump folder: %s", ex.what()); + cemuLog_log(LogType::Force, "can't create shaders dump folder: {}", ex.what()); ActiveSettings::EnableDumpShaders(false); } } diff --git a/src/gui/TitleManager.cpp b/src/gui/TitleManager.cpp index 7cf46a42..e3675ff2 100644 --- a/src/gui/TitleManager.cpp +++ b/src/gui/TitleManager.cpp @@ -535,7 +535,7 @@ void TitleManager::OnSaveDelete(wxCommandEvent& event) } if (!meta_file_edited) - forceLog_printf("TitleManager::OnSaveDelete: couldn't delete save entry in saveinfo.xml: %s", saveinfo.generic_u8string().c_str()); + cemuLog_log(LogType::Force, "TitleManager::OnSaveDelete: couldn't delete save entry in saveinfo.xml: {}", _pathToUtf8(saveinfo)); // remove from title entry auto& persistent_ids = entry->persistent_ids; diff --git a/src/gui/canvas/VulkanCanvas.cpp b/src/gui/canvas/VulkanCanvas.cpp index de22e55c..00ebeb2d 100644 --- a/src/gui/canvas/VulkanCanvas.cpp +++ b/src/gui/canvas/VulkanCanvas.cpp @@ -37,7 +37,7 @@ VulkanCanvas::VulkanCanvas(wxWindow* parent, const wxSize& size, bool is_main_wi catch(const std::exception& ex) { const auto msg = fmt::format(fmt::runtime(_("Error when initializing Vulkan renderer:\n{}").ToStdString()), ex.what()); - forceLog_printf(const_cast(msg.c_str())); + cemuLog_log(LogType::Force, msg); wxMessageDialog dialog(this, msg, _("Error"), wxOK | wxCENTRE | wxICON_ERROR); dialog.ShowModal(); exit(0); diff --git a/src/gui/components/wxTitleManagerList.cpp b/src/gui/components/wxTitleManagerList.cpp index 129454a3..de563d6c 100644 --- a/src/gui/components/wxTitleManagerList.cpp +++ b/src/gui/components/wxTitleManagerList.cpp @@ -875,7 +875,7 @@ void wxTitleManagerList::OnContextMenuSelected(wxCommandEvent& event) } catch (const std::exception& ex) { - forceLog_printf("wxTitleManagerList::OnContextMenuSelected: can't launch title: %s", ex.what()); + cemuLog_log(LogType::Force, "wxTitleManagerList::OnContextMenuSelected: can't launch title: {}", ex.what()); } } break; diff --git a/src/gui/dialogs/SaveImport/SaveImportWindow.cpp b/src/gui/dialogs/SaveImport/SaveImportWindow.cpp index 9b7b20cc..2a570bb0 100644 --- a/src/gui/dialogs/SaveImport/SaveImportWindow.cpp +++ b/src/gui/dialogs/SaveImport/SaveImportWindow.cpp @@ -232,7 +232,7 @@ void SaveImportWindow::OnImport(wxCommandEvent& event) zip_stat_t sb{}; if (zip_stat_index(zip, i, 0, &sb) != 0) { - forceLog_printf("zip stat index failed on %d entry", i); + cemuLog_log(LogType::Force, "zip stat index failed on {} entry", i); continue; } @@ -251,7 +251,7 @@ void SaveImportWindow::OnImport(wxCommandEvent& event) { fs::create_directories(path, ec); if (ec) - forceLog_printf("can't create directory %s: %s", sb.name, ec.message().c_str()); + cemuLog_log(LogType::Force, "can't create directory {}: {}", sb.name, ec.message()); continue; } @@ -307,7 +307,7 @@ void SaveImportWindow::OnImport(wxCommandEvent& event) timestamp.text().set(fmt::format("{:016x}", coreinit::coreinit_getOSTime() / ESPRESSO_TIMER_CLOCK).c_str()); // TODO time not initialized yet? if(!doc.save_file(saveinfo.c_str())) - forceLog_printf("couldn't insert save entry in saveinfo.xml: %s", saveinfo.generic_u8string().c_str()); + cemuLog_log(LogType::Force, "couldn't insert save entry in saveinfo.xml: {}", _pathToUtf8(saveinfo)); } } } diff --git a/src/gui/dialogs/SaveImport/SaveTransfer.cpp b/src/gui/dialogs/SaveImport/SaveTransfer.cpp index ad11fba6..14e473a1 100644 --- a/src/gui/dialogs/SaveImport/SaveTransfer.cpp +++ b/src/gui/dialogs/SaveImport/SaveTransfer.cpp @@ -181,7 +181,7 @@ void SaveTransfer::OnTransfer(wxCommandEvent& event) } if (!meta_file_edited) - forceLog_printf("SaveTransfer::OnTransfer: couldn't update save entry in saveinfo.xml: %s", saveinfo.generic_u8string().c_str()); + cemuLog_log(LogType::Force, "SaveTransfer::OnTransfer: couldn't update save entry in saveinfo.xml: {}", _pathToUtf8(saveinfo)); std::error_code ec; fs::rename(source_path, target_path, ec); diff --git a/src/imgui/imgui_impl_vulkan.cpp b/src/imgui/imgui_impl_vulkan.cpp index 88679378..f0006b45 100644 --- a/src/imgui/imgui_impl_vulkan.cpp +++ b/src/imgui/imgui_impl_vulkan.cpp @@ -1460,7 +1460,7 @@ ImTextureID ImGui_ImplVulkan_GenerateTexture(VkCommandBuffer commandBuffer, cons } catch (const std::exception & ex) { - forceLog_printf("can't generate imgui texture: %s", ex.what()); + cemuLog_log(LogType::Force, "can't generate imgui texture: {}", ex.what()); return nullptr; } } diff --git a/src/input/api/DSU/DSUControllerProvider.cpp b/src/input/api/DSU/DSUControllerProvider.cpp index ab5f406c..0fa93e25 100644 --- a/src/input/api/DSU/DSUControllerProvider.cpp +++ b/src/input/api/DSU/DSUControllerProvider.cpp @@ -103,7 +103,7 @@ bool DSUControllerProvider::connect() } catch (const std::exception& ex) { - forceLog_printf("dsu client connect error: %s", ex.what()); + cemuLog_log(LogType::Force, "dsu client connect error: {}", ex.what()); return false; } } diff --git a/src/input/api/GameCube/GameCubeControllerProvider.cpp b/src/input/api/GameCube/GameCubeControllerProvider.cpp index 1fe339f4..f3a2f20d 100644 --- a/src/input/api/GameCube/GameCubeControllerProvider.cpp +++ b/src/input/api/GameCube/GameCubeControllerProvider.cpp @@ -86,7 +86,7 @@ uint32 GameCubeControllerProvider::get_adapter_count() const const auto count = m_libusb->p_libusb_get_device_list(nullptr, &devices); if (count < 0) { - forceLog_printf((char*)fmt::format("libusb error {} at libusb_get_device_list: {}", static_cast(count), m_libusb->p_libusb_error_name(static_cast(count))).c_str()); + cemuLog_log(LogType::Force, "libusb error {} at libusb_get_device_list: {}", static_cast(count), m_libusb->p_libusb_error_name(static_cast(count))); return adapter_count; } @@ -99,7 +99,7 @@ uint32 GameCubeControllerProvider::get_adapter_count() const int ret = m_libusb->p_libusb_get_device_descriptor(devices[i], &desc); if (ret != 0) { - forceLog_printf((char*)fmt::format("libusb error {} at libusb_get_device_descriptor: {}", ret, m_libusb->p_libusb_error_name(ret)).c_str()); + cemuLog_log(LogType::Force, "libusb error {} at libusb_get_device_descriptor: {}", ret, m_libusb->p_libusb_error_name(ret)); continue; } @@ -168,7 +168,7 @@ std::tuple GameCubeControllerProvider::fetc const auto count = m_libusb->p_libusb_get_device_list(nullptr, &devices); if (count < 0) { - forceLog_printf((char*)fmt::format("libusb error {} at libusb_get_device_list: {}", static_cast(count), m_libusb->p_libusb_error_name(static_cast(count))).c_str()); + cemuLog_log(LogType::Force, "libusb error {} at libusb_get_device_list: {}", static_cast(count), m_libusb->p_libusb_error_name(static_cast(count))); return result; } @@ -182,7 +182,7 @@ std::tuple GameCubeControllerProvider::fetc int ret = m_libusb->p_libusb_get_device_descriptor(devices[i], &desc); if (ret != 0) { - forceLog_printf((char*)fmt::format("libusb error {} at libusb_get_device_descriptor: {}", ret, m_libusb->p_libusb_error_name(ret)).c_str()); + cemuLog_log(LogType::Force, "libusb error {} at libusb_get_device_descriptor: {}", ret, m_libusb->p_libusb_error_name(ret)); continue; } @@ -196,7 +196,7 @@ std::tuple GameCubeControllerProvider::fetc ret = m_libusb->p_libusb_open(devices[i], &device_handle); if (ret != 0) { - forceLog_printf((char*)fmt::format("libusb error {} at libusb_open: {}", ret, m_libusb->p_libusb_error_name(ret)).c_str()); + cemuLog_log(LogType::Force, "libusb error {} at libusb_open: {}", ret, m_libusb->p_libusb_error_name(ret)); continue; } @@ -205,7 +205,7 @@ std::tuple GameCubeControllerProvider::fetc ret = m_libusb->p_libusb_detach_kernel_driver(device_handle, 0); if (ret != 0) { - forceLog_printf((char*)fmt::format("libusb error {} at libusb_detach_kernel_driver: {}", ret, m_libusb->p_libusb_error_name(ret)).c_str()); + cemuLog_log(LogType::Force, "libusb error {} at libusb_detach_kernel_driver: {}", ret, m_libusb->p_libusb_error_name(ret)); m_libusb->p_libusb_close(device_handle); continue; } @@ -214,7 +214,7 @@ std::tuple GameCubeControllerProvider::fetc ret = m_libusb->p_libusb_claim_interface(device_handle, 0); if (ret != 0) { - forceLog_printf((char*)fmt::format("libusb error {} at libusb_claim_interface: {}", ret, m_libusb->p_libusb_error_name(ret)).c_str()); + cemuLog_log(LogType::Force, "libusb error {} at libusb_claim_interface: {}", ret, m_libusb->p_libusb_error_name(ret)); m_libusb->p_libusb_close(device_handle); continue; } @@ -297,11 +297,11 @@ void GameCubeControllerProvider::reader_thread() } else if (result == LIBUSB_ERROR_NO_DEVICE || result == LIBUSB_ERROR_IO) { - forceLog_printf((char*)fmt::format("libusb error {} at libusb_interrupt_transfer: {}", result, m_libusb->p_libusb_error_name(result)).c_str()); + cemuLog_log(LogType::Force, "libusb error {} at libusb_interrupt_transfer: {}", result, m_libusb->p_libusb_error_name(result)); if (const auto handle = adapter.m_device_handle.exchange(nullptr)) m_libusb->p_libusb_close(handle); } - else { forceLog_printf((char*)fmt::format("libusb error {} at libusb_interrupt_transfer: {}", result, m_libusb->p_libusb_error_name(result)).c_str()); } + else { cemuLog_log(LogType::Force, "libusb error {} at libusb_interrupt_transfer: {}", result, m_libusb->p_libusb_error_name(result)); } } } } @@ -341,7 +341,7 @@ void GameCubeControllerProvider::writer_thread() int written; const int result = m_libusb->p_libusb_interrupt_transfer(adapter.m_device_handle, adapter.m_endpoint_writer, rumble.data(), static_cast(rumble.size()), &written, 25); - if (result != 0) { forceLog_printf((char*)fmt::format("libusb error {} at libusb_interrupt_transfer: {}", result, m_libusb->p_libusb_error_name(result)).c_str()); } + if (result != 0) { cemuLog_log(LogType::Force, "libusb error {} at libusb_interrupt_transfer: {}", result, m_libusb->p_libusb_error_name(result)); } cmd_sent = true; lock.lock(); @@ -385,4 +385,4 @@ int GameCubeControllerProvider::hotplug_event(libusb_context* ctx, libusb_device return 0; } -#endif \ No newline at end of file +#endif diff --git a/src/input/api/SDL/SDLControllerProvider.cpp b/src/input/api/SDL/SDLControllerProvider.cpp index c700eab7..fcec0f7e 100644 --- a/src/input/api/SDL/SDLControllerProvider.cpp +++ b/src/input/api/SDL/SDLControllerProvider.cpp @@ -36,7 +36,7 @@ SDLControllerProvider::SDLControllerProvider() if (SDL_GameControllerEventState(SDL_ENABLE) < 0) { - forceLog_printf("Couldn't enable SDL gamecontroller event polling: %s", SDL_GetError()); + cemuLog_log(LogType::Force, "Couldn't enable SDL gamecontroller event polling: {}", SDL_GetError()); } m_running = true; diff --git a/src/main.cpp b/src/main.cpp index eac11953..786cbe47 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -70,7 +70,7 @@ void logCPUAndMemoryInfo() statex.dwLength = sizeof(statex); GlobalMemoryStatusEx(&statex); uint32 memoryInMB = (uint32)(statex.ullTotalPhys / 1024LL / 1024LL); - forceLog_printf("RAM: %uMB", memoryInMB); + cemuLog_log(LogType::Force, "RAM: {}MB", memoryInMB); #elif BOOST_OS_LINUX struct sysinfo info {}; sysinfo(&info); @@ -101,7 +101,7 @@ void checkForWine() if (pwine_get_version) { g_running_in_wine = true; - forceLog_printf("Wine version: %s", pwine_get_version()); + cemuLog_log(LogType::Force, "Wine version: {}", pwine_get_version()); } #else g_running_in_wine = false; diff --git a/src/util/ChunkedHeap/ChunkedHeap.h b/src/util/ChunkedHeap/ChunkedHeap.h index d2a0a036..b2fb5222 100644 --- a/src/util/ChunkedHeap/ChunkedHeap.h +++ b/src/util/ChunkedHeap/ChunkedHeap.h @@ -189,11 +189,11 @@ private: auto it = list_chunks[addr.chunkIndex]->map_allocatedRange.find(addr.offset); if (it == list_chunks[addr.chunkIndex]->map_allocatedRange.end()) { - forceLog_printf("Internal heap error. %08x %08x", addr.chunkIndex, addr.offset); + cemuLog_log(LogType::Force, "Internal heap error. {:08x} {:08x}", addr.chunkIndex, addr.offset); forceLog_printf("Debug info:"); for (auto& rangeItr : list_chunks[addr.chunkIndex]->map_allocatedRange) { - forceLog_printf("%08x %08x", rangeItr.second->offset, rangeItr.second->size); + cemuLog_log(LogType::Force, "{:08x} {:08x}", rangeItr.second->offset, rangeItr.second->size); } return; } @@ -638,4 +638,4 @@ private: uint8* m_currentBlockPtr{}; uint32 m_currentBlockOffset{}; std::vector m_allocatedBlocks; -}; \ No newline at end of file +}; diff --git a/src/util/VirtualHeap/VirtualHeap.cpp b/src/util/VirtualHeap/VirtualHeap.cpp index c659c853..9f122cb1 100644 --- a/src/util/VirtualHeap/VirtualHeap.cpp +++ b/src/util/VirtualHeap/VirtualHeap.cpp @@ -26,7 +26,7 @@ VirtualBufferHeapEntry_t* virtualBufferHeap_createEntry(VirtualBufferHeap_t* buf VirtualBufferHeapEntry_t* newEntry = bufferHeap->firstUnusedEntry; if (newEntry == nullptr) { - forceLog_printf("virtualBufferHeap_createEntry: Pool empty"); + cemuLog_log(LogType::Force, "virtualBufferHeap_createEntry: Pool empty"); cemu_assert_suspicious(); } bufferHeap->firstUnusedEntry = newEntry->next; @@ -157,4 +157,4 @@ void virtualBufferHeap_freeAddr(VirtualBufferHeap_t* bufferHeap, void* addr) entry = entry->next; } cemu_assert_suspicious(); -} \ No newline at end of file +}