From e01ca5b0571531c956f3e5cbb952fa97473d15fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 14 Jul 2024 14:42:59 +0200 Subject: [PATCH] Logging API change (refactor) (#19324) * Rename LogType to Log * Explicitly use the Log:: enum when logging. Allows for autocomplete when editing. * Mac/ARM64 buildfix * Do the same with the hle result log macros * Rename the log names to mixed case while at it. * iOS buildfix * Qt buildfix attempt, ARM32 buildfix --- Common/Arm64Emitter.cpp | 2 +- Common/ArmEmitter.cpp | 12 +- Common/Buffer.cpp | 8 +- Common/CodeBlock.h | 2 +- Common/Data/Collections/FixedSizeQueue.h | 2 +- Common/Data/Collections/Hashmaps.h | 2 +- Common/Data/Encoding/Compression.cpp | 6 +- Common/Data/Format/JSONReader.cpp | 8 +- Common/Data/Format/PNGLoad.cpp | 6 +- Common/Data/Format/RIFF.cpp | 4 +- Common/Data/Format/ZIMLoad.cpp | 18 +- Common/Data/Format/ZIMSave.cpp | 6 +- Common/Data/Text/I18n.cpp | 4 +- Common/ExceptionHandlerSetup.cpp | 14 +- Common/File/AndroidContentURI.cpp | 4 +- Common/File/AndroidStorage.cpp | 6 +- Common/File/DiskFree.cpp | 2 +- Common/File/FileDescriptor.cpp | 6 +- Common/File/FileUtil.cpp | 112 +-- Common/File/Path.cpp | 2 +- Common/File/PathBrowser.cpp | 8 +- Common/File/VFS/VFS.cpp | 18 +- Common/File/VFS/ZipFileReader.cpp | 14 +- Common/GPU/D3D11/thin3d_d3d11.cpp | 8 +- Common/GPU/D3D9/thin3d_d3d9.cpp | 26 +- Common/GPU/OpenGL/GLDebugLog.cpp | 2 +- Common/GPU/OpenGL/GLFeatures.cpp | 24 +- Common/GPU/OpenGL/GLMemory.cpp | 2 +- Common/GPU/OpenGL/GLQueueRunner.cpp | 46 +- Common/GPU/OpenGL/GLRenderManager.cpp | 14 +- Common/GPU/OpenGL/GLSLProgram.cpp | 24 +- Common/GPU/OpenGL/thin3d_gl.cpp | 34 +- Common/GPU/ShaderTranslation.cpp | 2 +- Common/GPU/Vulkan/VulkanBarrier.cpp | 2 +- Common/GPU/Vulkan/VulkanContext.cpp | 78 +- Common/GPU/Vulkan/VulkanDebug.cpp | 6 +- Common/GPU/Vulkan/VulkanDescSet.cpp | 4 +- Common/GPU/Vulkan/VulkanFrameData.cpp | 8 +- Common/GPU/Vulkan/VulkanFramebuffer.cpp | 2 +- Common/GPU/Vulkan/VulkanImage.cpp | 6 +- Common/GPU/Vulkan/VulkanLoader.cpp | 80 +- Common/GPU/Vulkan/VulkanMemory.cpp | 4 +- Common/GPU/Vulkan/VulkanProfiler.cpp | 6 +- Common/GPU/Vulkan/VulkanQueueRunner.cpp | 74 +- Common/GPU/Vulkan/VulkanRenderManager.cpp | 62 +- Common/GPU/Vulkan/thin3d_vulkan.cpp | 26 +- Common/GPU/thin3d.cpp | 4 +- Common/Log.cpp | 4 +- Common/Log.h | 71 +- Common/LogManager.cpp | 22 +- Common/LogManager.h | 20 +- Common/LogReporting.cpp | 4 +- Common/MemArenaAndroid.cpp | 14 +- Common/MemArenaDarwin.cpp | 6 +- Common/MemArenaPosix.cpp | 22 +- Common/MemoryUtil.cpp | 20 +- Common/Net/HTTPClient.cpp | 50 +- Common/Net/HTTPHeaders.cpp | 10 +- Common/Net/HTTPNaettRequest.cpp | 18 +- Common/Net/HTTPRequest.cpp | 2 +- Common/Net/HTTPServer.cpp | 20 +- Common/Net/NetBuffer.cpp | 6 +- Common/Net/Resolve.cpp | 12 +- Common/Net/Sinks.cpp | 8 +- Common/Net/URL.cpp | 2 +- Common/Profiler/Profiler.cpp | 4 +- Common/Render/DrawBuffer.cpp | 2 +- Common/Render/ManagedTexture.cpp | 20 +- Common/Render/Text/draw_text.cpp | 2 +- Common/Render/Text/draw_text_android.cpp | 10 +- Common/Render/Text/draw_text_cocoa.mm | 8 +- Common/Render/Text/draw_text_qt.cpp | 2 +- Common/Render/Text/draw_text_sdl.cpp | 4 +- Common/Render/Text/draw_text_uwp.cpp | 6 +- Common/RiscVEmitter.cpp | 18 +- Common/Serialize/SerializeList.h | 2 +- Common/Serialize/Serializer.cpp | 64 +- Common/Serialize/Serializer.h | 4 +- Common/System/Request.cpp | 12 +- Common/Thread/ThreadManager.cpp | 4 +- Common/Thread/ThreadUtil.cpp | 2 +- Common/UI/Context.cpp | 4 +- Common/UI/IconCache.cpp | 6 +- Common/UI/Root.cpp | 4 +- Common/UI/Screen.cpp | 24 +- Common/UI/UIScreen.cpp | 10 +- Common/UI/ViewGroup.cpp | 10 +- Common/x64Analyzer.cpp | 2 +- Common/x64Emitter.cpp | 2 +- Core/AVIDump.cpp | 12 +- Core/Compatibility.cpp | 2 +- Core/Compatibility.h | 2 +- Core/Config.cpp | 70 +- Core/ConfigValues.h | 2 +- Core/ControlMapper.cpp | 16 +- Core/Core.cpp | 16 +- Core/CoreTiming.cpp | 10 +- Core/Debugger/Breakpoints.cpp | 8 +- Core/Debugger/SymbolMap.cpp | 4 +- Core/Debugger/WebSocket.cpp | 4 +- Core/Debugger/WebSocket/GameSubscriber.cpp | 2 +- Core/Dialog/PSPDialog.cpp | 2 +- Core/Dialog/PSPGamedataInstallDialog.cpp | 12 +- Core/Dialog/PSPMsgDialog.cpp | 4 +- Core/Dialog/PSPNpSigninDialog.cpp | 2 +- Core/Dialog/PSPOskDialog.cpp | 14 +- Core/Dialog/PSPSaveDialog.cpp | 88 +-- Core/Dialog/PSPScreenshotDialog.cpp | 6 +- Core/Dialog/SavedataParam.cpp | 70 +- Core/ELF/ElfReader.cpp | 114 +-- Core/ELF/PBPReader.cpp | 14 +- Core/ELF/ParamSFO.cpp | 12 +- Core/ELF/PrxDecrypter.cpp | 10 +- Core/FileLoaders/DiskCachingFileLoader.cpp | 28 +- Core/FileLoaders/HTTPFileLoader.cpp | 28 +- Core/FileLoaders/LocalFileLoader.cpp | 8 +- Core/FileSystems/BlockDevices.cpp | 48 +- Core/FileSystems/DirectoryFileSystem.cpp | 48 +- Core/FileSystems/ISOFileSystem.cpp | 54 +- Core/FileSystems/MetaFileSystem.cpp | 26 +- Core/FileSystems/VirtualDiscFileSystem.cpp | 56 +- Core/Font/PGF.cpp | 8 +- Core/HLE/AtracCtx.cpp | 84 +-- Core/HLE/AtracCtx2.cpp | 2 +- Core/HLE/HLE.cpp | 48 +- Core/HLE/HLE.h | 15 +- Core/HLE/HLEHelperThread.cpp | 2 +- Core/HLE/KUBridge.cpp | 4 +- Core/HLE/Plugins.cpp | 20 +- Core/HLE/ReplaceTables.cpp | 16 +- Core/HLE/ThreadQueueList.h | 2 +- Core/HLE/__sceAudio.cpp | 24 +- Core/HLE/__sceAudio.h | 2 +- Core/HLE/proAdhoc.cpp | 76 +- Core/HLE/proAdhocServer.cpp | 76 +- Core/HLE/sceAdler.cpp | 4 +- Core/HLE/sceAtrac.cpp | 172 ++--- Core/HLE/sceAudio.cpp | 170 ++--- Core/HLE/sceAudioRouting.cpp | 8 +- Core/HLE/sceAudiocodec.cpp | 24 +- Core/HLE/sceCcc.cpp | 98 +-- Core/HLE/sceChnnlsv.cpp | 24 +- Core/HLE/sceCtrl.cpp | 30 +- Core/HLE/sceDeflt.cpp | 10 +- Core/HLE/sceDisplay.cpp | 92 +-- Core/HLE/sceDmac.cpp | 20 +- Core/HLE/sceFont.cpp | 210 +++--- Core/HLE/sceGameUpdate.cpp | 8 +- Core/HLE/sceGe.cpp | 86 +-- Core/HLE/sceHeap.cpp | 42 +- Core/HLE/sceHprm.cpp | 16 +- Core/HLE/sceHttp.cpp | 90 +-- Core/HLE/sceImpose.cpp | 16 +- Core/HLE/sceIo.cpp | 348 ++++----- Core/HLE/sceJpeg.cpp | 110 +-- Core/HLE/sceKernel.cpp | 56 +- Core/HLE/sceKernel.h | 6 +- Core/HLE/sceKernelAlarm.cpp | 20 +- Core/HLE/sceKernelEventFlag.cpp | 82 +- Core/HLE/sceKernelHeap.cpp | 40 +- Core/HLE/sceKernelInterrupt.cpp | 110 +-- Core/HLE/sceKernelMbx.cpp | 56 +- Core/HLE/sceKernelMemory.cpp | 258 +++---- Core/HLE/sceKernelModule.cpp | 288 +++---- Core/HLE/sceKernelMsgPipe.cpp | 98 +-- Core/HLE/sceKernelMutex.cpp | 90 +-- Core/HLE/sceKernelSemaphore.cpp | 62 +- Core/HLE/sceKernelThread.cpp | 400 +++++----- Core/HLE/sceKernelTime.cpp | 20 +- Core/HLE/sceKernelVTimer.cpp | 66 +- Core/HLE/sceMd5.cpp | 28 +- Core/HLE/sceMp3.cpp | 204 ++--- Core/HLE/sceMp4.cpp | 112 +-- Core/HLE/sceMpeg.cpp | 350 ++++----- Core/HLE/sceMt19937.cpp | 8 +- Core/HLE/sceNet.cpp | 228 +++--- Core/HLE/sceNetAdhoc.cpp | 838 ++++++++++----------- Core/HLE/sceNp.cpp | 128 ++-- Core/HLE/sceNp2.cpp | 136 ++-- Core/HLE/sceOpenPSID.cpp | 8 +- Core/HLE/sceP3da.cpp | 6 +- Core/HLE/scePauth.cpp | 4 +- Core/HLE/scePower.cpp | 90 +-- Core/HLE/scePsmf.cpp | 386 +++++----- Core/HLE/scePspNpDrm_user.cpp | 12 +- Core/HLE/sceRtc.cpp | 122 +-- Core/HLE/sceSas.cpp | 162 ++-- Core/HLE/sceSfmt19937.cpp | 24 +- Core/HLE/sceSha256.cpp | 4 +- Core/HLE/sceSircs.cpp | 2 +- Core/HLE/sceSsl.cpp | 8 +- Core/HLE/sceUmd.cpp | 76 +- Core/HLE/sceUsb.cpp | 22 +- Core/HLE/sceUsbAcc.cpp | 4 +- Core/HLE/sceUsbCam.cpp | 36 +- Core/HLE/sceUsbMic.cpp | 26 +- Core/HLE/sceUtility.cpp | 218 +++--- Core/HLE/sceVaudio.cpp | 14 +- Core/HW/AsyncIOManager.cpp | 6 +- Core/HW/Atrac3Standalone.cpp | 8 +- Core/HW/Camera.cpp | 56 +- Core/HW/MediaEngine.cpp | 36 +- Core/HW/MpegDemux.cpp | 4 +- Core/HW/SasAudio.cpp | 20 +- Core/HW/SimpleAudioDec.cpp | 20 +- Core/HW/StereoResampler.cpp | 2 +- Core/Instance.cpp | 8 +- Core/KeyMap.cpp | 4 +- Core/Loaders.cpp | 14 +- Core/MIPS/ARM/ArmAsm.cpp | 8 +- Core/MIPS/ARM/ArmCompBranch.cpp | 16 +- Core/MIPS/ARM/ArmCompVFPU.cpp | 12 +- Core/MIPS/ARM/ArmCompVFPUNEON.cpp | 20 +- Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp | 20 +- Core/MIPS/ARM/ArmJit.cpp | 30 +- Core/MIPS/ARM/ArmRegCache.cpp | 26 +- Core/MIPS/ARM/ArmRegCacheFPU.cpp | 92 +-- Core/MIPS/ARM64/Arm64Asm.cpp | 6 +- Core/MIPS/ARM64/Arm64CompBranch.cpp | 16 +- Core/MIPS/ARM64/Arm64CompVFPU.cpp | 12 +- Core/MIPS/ARM64/Arm64IRAsm.cpp | 6 +- Core/MIPS/ARM64/Arm64IRJit.cpp | 6 +- Core/MIPS/ARM64/Arm64IRRegCache.cpp | 8 +- Core/MIPS/ARM64/Arm64Jit.cpp | 36 +- Core/MIPS/ARM64/Arm64RegCache.cpp | 54 +- Core/MIPS/ARM64/Arm64RegCacheFPU.cpp | 46 +- Core/MIPS/IR/IRCompBranch.cpp | 14 +- Core/MIPS/IR/IRCompVFPU.cpp | 2 +- Core/MIPS/IR/IRFrontend.cpp | 30 +- Core/MIPS/IR/IRJit.cpp | 12 +- Core/MIPS/IR/IRNativeCommon.cpp | 6 +- Core/MIPS/IR/IRPassSimplify.cpp | 2 +- Core/MIPS/IR/IRRegCache.cpp | 12 +- Core/MIPS/JitCommon/JitBlockCache.cpp | 20 +- Core/MIPS/JitCommon/JitCommon.cpp | 4 +- Core/MIPS/JitCommon/JitState.h | 12 +- Core/MIPS/MIPS.cpp | 8 +- Core/MIPS/MIPS/MipsJit.cpp | 4 +- Core/MIPS/MIPSAnalyst.cpp | 14 +- Core/MIPS/MIPSInt.cpp | 26 +- Core/MIPS/MIPSIntVFPU.cpp | 18 +- Core/MIPS/MIPSTables.cpp | 10 +- Core/MIPS/MIPSVFPUUtils.cpp | 18 +- Core/MIPS/RiscV/RiscVAsm.cpp | 6 +- Core/MIPS/RiscV/RiscVJit.cpp | 6 +- Core/MIPS/RiscV/RiscVRegCache.cpp | 8 +- Core/MIPS/fake/FakeJit.cpp | 6 +- Core/MIPS/x86/Asm.cpp | 2 +- Core/MIPS/x86/CompBranch.cpp | 22 +- Core/MIPS/x86/CompLoadStore.cpp | 2 +- Core/MIPS/x86/CompVFPU.cpp | 8 +- Core/MIPS/x86/Jit.cpp | 24 +- Core/MIPS/x86/RegCache.cpp | 2 +- Core/MIPS/x86/X64IRAsm.cpp | 6 +- Core/MIPS/x86/X64IRJit.cpp | 6 +- Core/MIPS/x86/X64IRRegCache.cpp | 8 +- Core/MemFault.cpp | 8 +- Core/MemMap.cpp | 20 +- Core/PSPLoaders.cpp | 14 +- Core/Replay.cpp | 30 +- Core/Reporting.cpp | 10 +- Core/RetroAchievements.cpp | 80 +- Core/RetroAchievements.h | 2 +- Core/SaveState.cpp | 32 +- Core/Screenshot.cpp | 20 +- Core/System.cpp | 18 +- Core/Util/BlockAllocator.cpp | 40 +- Core/Util/GameDB.cpp | 2 +- Core/Util/GameManager.cpp | 54 +- Core/Util/MemStick.cpp | 30 +- Core/Util/PPGeDraw.cpp | 12 +- Core/Util/PortManager.cpp | 54 +- Core/WaveFile.cpp | 4 +- Core/WebServer.cpp | 4 +- GPU/Common/DepalettizeShaderCommon.cpp | 2 +- GPU/Common/DepthBufferCommon.cpp | 2 +- GPU/Common/DrawEngineCommon.cpp | 8 +- GPU/Common/FramebufferManagerCommon.cpp | 132 ++-- GPU/Common/GPUStateUtils.cpp | 20 +- GPU/Common/PostShader.cpp | 2 +- GPU/Common/PresentationCommon.cpp | 6 +- GPU/Common/ReplacedTexture.cpp | 68 +- GPU/Common/ReplacedTexture.h | 2 +- GPU/Common/SoftwareTransformCommon.cpp | 6 +- GPU/Common/SplineCommon.cpp | 10 +- GPU/Common/TextureCacheCommon.cpp | 61 +- GPU/Common/TextureReplacer.cpp | 70 +- GPU/Common/TextureScalerCommon.cpp | 10 +- GPU/Common/VertexDecoderArm.cpp | 4 +- GPU/Common/VertexDecoderArm64.cpp | 8 +- GPU/Common/VertexDecoderCommon.cpp | 26 +- GPU/Common/VertexDecoderCommon.h | 2 +- GPU/Common/VertexDecoderRiscV.cpp | 8 +- GPU/D3D11/D3D11Util.cpp | 4 +- GPU/D3D11/DrawEngineD3D11.cpp | 4 +- GPU/D3D11/GPU_D3D11.cpp | 4 +- GPU/D3D11/TextureCacheD3D11.cpp | 2 +- GPU/Debugger/Debugger.cpp | 8 +- GPU/Debugger/Playback.cpp | 18 +- GPU/Debugger/Record.cpp | 12 +- GPU/Debugger/Stepping.cpp | 2 +- GPU/Directx9/DrawEngineDX9.cpp | 4 +- GPU/Directx9/GPU_DX9.cpp | 6 +- GPU/Directx9/ShaderManagerDX9.cpp | 24 +- GPU/Directx9/TextureCacheDX9.cpp | 8 +- GPU/GLES/DrawEngineGLES.cpp | 2 +- GPU/GLES/GPU_GLES.cpp | 14 +- GPU/GLES/ShaderManagerGLES.cpp | 26 +- GPU/GLES/StencilBufferGLES.cpp | 2 +- GPU/GLES/TextureCacheGLES.cpp | 4 +- GPU/GPU.cpp | 2 +- GPU/GPUCommon.cpp | 82 +- GPU/GPUCommonHW.cpp | 22 +- GPU/Software/DrawPixelX86.cpp | 2 +- GPU/Software/Sampler.cpp | 4 +- GPU/Software/SamplerX86.cpp | 8 +- GPU/Software/SoftGpu.cpp | 28 +- GPU/Software/TransformUnit.cpp | 6 +- GPU/Vulkan/GPU_Vulkan.cpp | 28 +- GPU/Vulkan/PipelineManagerVulkan.cpp | 40 +- GPU/Vulkan/ShaderManagerVulkan.cpp | 38 +- GPU/Vulkan/TextureCacheVulkan.cpp | 12 +- GPU/Vulkan/VulkanUtil.cpp | 8 +- Qt/QtMain.cpp | 32 +- Qt/QtMain.h | 2 +- SDL/SDLGLGraphicsContext.cpp | 2 +- SDL/SDLMain.cpp | 28 +- UI/BackgroundAudio.cpp | 20 +- UI/CwCheatScreen.cpp | 8 +- UI/DarwinFileSystemServices.mm | 10 +- UI/DebugOverlay.cpp | 4 +- UI/DevScreens.cpp | 28 +- UI/DiscordIntegration.cpp | 6 +- UI/DriverManagerScreen.cpp | 8 +- UI/EmuScreen.cpp | 16 +- UI/GameInfoCache.cpp | 28 +- UI/GameScreen.cpp | 2 +- UI/GameSettingsScreen.cpp | 10 +- UI/JitCompareScreen.cpp | 2 +- UI/MemStickScreen.cpp | 22 +- UI/NativeApp.cpp | 76 +- UI/RemoteISOScreen.cpp | 4 +- UI/Store.cpp | 6 +- UI/Theme.cpp | 4 +- UI/TouchControlLayoutScreen.cpp | 2 +- UWP/PPSSPP_UWPMain.cpp | 6 +- UWP/UWPHelpers/InputHelpers.cpp | 12 +- UWP/UWPHelpers/LaunchItem.cpp | 10 +- UWP/UWPHelpers/StorageAsync.h | 2 +- UWP/XAudioSoundStream.cpp | 2 +- Windows/CaptureDevice.cpp | 14 +- Windows/CaptureDevice.h | 2 +- Windows/EmuThread.cpp | 8 +- Windows/GEDebugger/SimpleGLWindow.cpp | 2 +- Windows/GEDebugger/VertexPreview.cpp | 6 +- Windows/GPU/D3D9Context.cpp | 2 +- Windows/GPU/WindowsGLContext.cpp | 20 +- Windows/MainWindow.cpp | 2 +- Windows/PPSSPP.vcxproj | 2 + Windows/PPSSPP.vcxproj.filters | 6 + Windows/RawInput.cpp | 2 +- Windows/TouchInputHandler.cpp | 2 +- Windows/WASAPIStream.cpp | 32 +- Windows/WindowsHost.cpp | 2 +- Windows/XinputDevice.cpp | 2 +- Windows/main.cpp | 6 +- android/jni/AndroidAudio.cpp | 34 +- android/jni/AndroidJavaGLContext.cpp | 6 +- android/jni/AndroidVulkanContext.cpp | 28 +- android/jni/Arm64EmitterTest.cpp | 22 +- android/jni/ArmEmitterTest.cpp | 22 +- android/jni/OpenSLContext.cpp | 20 +- android/jni/TestRunner.cpp | 16 +- android/jni/app-android.cpp | 176 ++--- ext/at3_standalone/compat.cpp | 8 +- ext/libkirk/amctrl.c | 8 +- ext/vma/vk_mem_alloc.h | 100 +-- headless/Headless.cpp | 4 +- ios/AppDelegate.mm | 14 +- ios/Controls.mm | 8 +- ios/ViewController.mm | 58 +- ios/ViewControllerMetal.mm | 100 +-- ios/iOSCoreAudio.mm | 6 +- ios/main.mm | 14 +- libretro/LibretroD3D11Context.cpp | 6 +- libretro/LibretroGLCoreContext.cpp | 2 +- libretro/LibretroGraphicsContext.cpp | 4 +- libretro/LibretroVulkanContext.cpp | 8 +- libretro/libretro.cpp | 12 +- libretro/libretro.h | 16 +- libretro/libretro_vulkan.cpp | 2 +- unittest/JitHarness.cpp | 2 +- unittest/UnitTest.cpp | 14 +- 393 files changed, 6198 insertions(+), 6193 deletions(-) diff --git a/Common/Arm64Emitter.cpp b/Common/Arm64Emitter.cpp index f9ab5ec195..462ddc7346 100644 --- a/Common/Arm64Emitter.cpp +++ b/Common/Arm64Emitter.cpp @@ -1041,7 +1041,7 @@ void ARM64XEmitter::QuickCallFunction(ARM64Reg scratchreg, const void *func) { s64 distance = (s64)func - (s64)m_code; distance >>= 2; // Can only branch to opcode-aligned (4) addresses if (!IsInRangeImm26(distance)) { - // WARN_LOG(DYNA_REC, "Distance too far in function call (%p to %p)! Using scratch.", m_code, func); + // WARN_LOG(Log::JIT, "Distance too far in function call (%p to %p)! Using scratch.", m_code, func); MOVI2R(scratchreg, (uintptr_t)func); BLR(scratchreg); } else { diff --git a/Common/ArmEmitter.cpp b/Common/ArmEmitter.cpp index d119f2443a..ff3e9af2e3 100644 --- a/Common/ArmEmitter.cpp +++ b/Common/ArmEmitter.cpp @@ -96,7 +96,7 @@ Operand2 AssumeMakeOperand2(u32 imm) { _dbg_assert_msg_(result, "Could not make assumed Operand2."); if (!result) { // Make double sure that we get it logged. - ERROR_LOG(JIT, "Could not make assumed Operand2."); + ERROR_LOG(Log::JIT, "Could not make assumed Operand2."); } return op2; } @@ -1506,7 +1506,7 @@ void ARMXEmitter::VLDR(ARMReg Dest, ARMReg Base, s16 offset) _assert_msg_((imm & 0xC03) == 0, "VLDR: Offset needs to be word aligned and small enough"); if (imm & 0xC03) - ERROR_LOG(JIT, "VLDR: Bad offset %08x", imm); + ERROR_LOG(Log::JIT, "VLDR: Bad offset %08x", imm); bool single_reg = Dest < D0; @@ -1534,7 +1534,7 @@ void ARMXEmitter::VSTR(ARMReg Src, ARMReg Base, s16 offset) _assert_msg_((imm & 0xC03) == 0, "VSTR: Offset needs to be word aligned and small enough"); if (imm & 0xC03) - ERROR_LOG(JIT, "VSTR: Bad offset %08x", imm); + ERROR_LOG(Log::JIT, "VSTR: Bad offset %08x", imm); bool single_reg = Src < D0; @@ -1697,7 +1697,7 @@ void ARMXEmitter::VMOV_neon(u32 Size, ARMReg Vd, ARMReg Rt, int lane) void ARMXEmitter::VMOV(ARMReg Vd, ARMReg Rt, ARMReg Rt2) { - _assert_msg_(cpu_info.bVFP | cpu_info.bNEON, "VMOV_neon requires VFP or NEON"); + _assert_msg_(cpu_info.bVFP || cpu_info.bNEON, "VMOV_neon requires VFP or NEON"); if (Vd < S0 && Rt < S0 && Rt2 >= D0) { @@ -1732,7 +1732,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src, bool high) void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src) { if (Dest == Src) { - WARN_LOG(JIT, "VMOV %s, %s - same register", ARMRegAsString(Src), ARMRegAsString(Dest)); + WARN_LOG(Log::JIT, "VMOV %s, %s - same register", ARMRegAsString(Src), ARMRegAsString(Dest)); } if (Dest > R15) { @@ -1787,7 +1787,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src) _assert_msg_(SrcSize == DestSize, "VMOV doesn't support moving different register sizes"); if (SrcSize != DestSize) { - ERROR_LOG(JIT, "SrcSize: %i (%s) DestDize: %i (%s)", SrcSize, ARMRegAsString(Src), DestSize, ARMRegAsString(Dest)); + ERROR_LOG(Log::JIT, "SrcSize: %i (%s) DestDize: %i (%s)", SrcSize, ARMRegAsString(Src), DestSize, ARMRegAsString(Dest)); } Dest = SubBase(Dest); diff --git a/Common/Buffer.cpp b/Common/Buffer.cpp index 683c520500..7bdf16629e 100644 --- a/Common/Buffer.cpp +++ b/Common/Buffer.cpp @@ -48,7 +48,7 @@ void Buffer::AppendValue(int value) { void Buffer::Take(size_t length, std::string *dest) { if (length > data_.size()) { - ERROR_LOG(IO, "Truncating length in Buffer::Take()"); + ERROR_LOG(Log::IO, "Truncating length in Buffer::Take()"); length = data_.size(); } dest->resize(length); @@ -77,7 +77,7 @@ int Buffer::TakeLineCRLF(std::string *dest) { void Buffer::Skip(size_t length) { if (length > data_.size()) { - ERROR_LOG(IO, "Truncating length in Buffer::Skip()"); + ERROR_LOG(Log::IO, "Truncating length in Buffer::Skip()"); length = data_.size(); } data_.erase(data_.begin(), data_.begin() + length); @@ -109,10 +109,10 @@ void Buffer::Printf(const char *fmt, ...) { size_t retval = vsnprintf(buffer, sizeof(buffer), fmt, vl); if ((int)retval >= (int)sizeof(buffer)) { // Output was truncated. TODO: Do something. - ERROR_LOG(IO, "Buffer::Printf truncated output"); + ERROR_LOG(Log::IO, "Buffer::Printf truncated output"); } if ((int)retval < 0) { - ERROR_LOG(IO, "Buffer::Printf failed"); + ERROR_LOG(Log::IO, "Buffer::Printf failed"); } va_end(vl); char *ptr = Append(retval); diff --git a/Common/CodeBlock.h b/Common/CodeBlock.h index 766d0a1cca..bb017c31f1 100644 --- a/Common/CodeBlock.h +++ b/Common/CodeBlock.h @@ -139,7 +139,7 @@ public: const uint8_t *end = GetCodePtr(); size_t sz = end - writeStart_; if (sz > writeEstimated_) - WARN_LOG(JIT, "EndWrite(): Estimated %d bytes, wrote %d", (int)writeEstimated_, (int)sz); + WARN_LOG(Log::JIT, "EndWrite(): Estimated %d bytes, wrote %d", (int)writeEstimated_, (int)sz); // If we protected and wrote less, we may need to unprotect. // Especially if we're linking blocks or similar. if (sz < writeEstimated_) diff --git a/Common/Data/Collections/FixedSizeQueue.h b/Common/Data/Collections/FixedSizeQueue.h index 7d0b0998e7..68c96e829c 100644 --- a/Common/Data/Collections/FixedSizeQueue.h +++ b/Common/Data/Collections/FixedSizeQueue.h @@ -150,7 +150,7 @@ public: Do(p, size); if (size != N) { - ERROR_LOG(COMMON, "Savestate failure: Incompatible queue size."); + ERROR_LOG(Log::Common, "Savestate failure: Incompatible queue size."); return; } // TODO: This is quite wasteful, could just store the actual data. Would be slightly more complex though. diff --git a/Common/Data/Collections/Hashmaps.h b/Common/Data/Collections/Hashmaps.h index a9e5dece99..862c0e49af 100644 --- a/Common/Data/Collections/Hashmaps.h +++ b/Common/Data/Collections/Hashmaps.h @@ -347,7 +347,7 @@ private: Insert(old[i].hash, old[i].value); } } - INFO_LOG(G3D, "Grew hashmap capacity from %d to %d", oldCapacity, capacity_); + INFO_LOG(Log::G3D, "Grew hashmap capacity from %d to %d", oldCapacity, capacity_); _assert_msg_(oldCount == count_, "PrehashMap: count should not change in Grow()"); } struct Pair { diff --git a/Common/Data/Encoding/Compression.cpp b/Common/Data/Encoding/Compression.cpp index 3e2e499a18..01bc6a1815 100644 --- a/Common/Data/Encoding/Compression.cpp +++ b/Common/Data/Encoding/Compression.cpp @@ -20,7 +20,7 @@ bool compress_string(const std::string& str, std::string *dest, int compressionl memset(&zs, 0, sizeof(zs)); if (deflateInit(&zs, compressionlevel) != Z_OK) { - ERROR_LOG(IO, "deflateInit failed while compressing."); + ERROR_LOG(Log::IO, "deflateInit failed while compressing."); return false; } @@ -67,7 +67,7 @@ bool decompress_string(const std::string& str, std::string *dest) { // modification by hrydgard: inflateInit2, 16+MAXWBITS makes it read gzip data too if (inflateInit2(&zs, 32+MAX_WBITS) != Z_OK) { - ERROR_LOG(IO, "inflateInit failed while decompressing."); + ERROR_LOG(Log::IO, "inflateInit failed while decompressing."); return false; } @@ -95,7 +95,7 @@ bool decompress_string(const std::string& str, std::string *dest) { inflateEnd(&zs); if (ret != Z_STREAM_END) { // an error occurred that was not EOF - ERROR_LOG(IO, "Exception during zlib decompression: (%i) %s", ret, zs.msg); + ERROR_LOG(Log::IO, "Exception during zlib decompression: (%i) %s", ret, zs.msg); return false; } diff --git a/Common/Data/Format/JSONReader.cpp b/Common/Data/Format/JSONReader.cpp index 49ea00b559..7fbe1ab2d2 100644 --- a/Common/Data/Format/JSONReader.cpp +++ b/Common/Data/Format/JSONReader.cpp @@ -17,7 +17,7 @@ JsonReader::JsonReader(const std::string &filename) { if (buffer_) { parse(); } else { - ERROR_LOG(IO, "Failed to read json file '%s'", filename.c_str()); + ERROR_LOG(Log::IO, "Failed to read json file '%s'", filename.c_str()); } } } @@ -26,7 +26,7 @@ bool JsonReader::parse() { char *error_pos; int status = jsonParse(buffer_, &error_pos, &root_, alloc_); if (status != JSON_OK) { - ERROR_LOG(IO, "Error at (%i): %s\n%s\n\n", (int)(error_pos - buffer_), jsonStrError(status), error_pos); + ERROR_LOG(Log::IO, "Error at (%i): %s\n%s\n\n", (int)(error_pos - buffer_), jsonStrError(status), error_pos); return false; } ok_ = true; @@ -46,7 +46,7 @@ int JsonGet::numChildren() const { const JsonNode *JsonGet::get(const char *child_name) const { if (!child_name) { - ERROR_LOG(IO, "JSON: Cannot get from null child name"); + ERROR_LOG(Log::IO, "JSON: Cannot get from null child name"); return nullptr; } if (value_.getTag() != JSON_OBJECT) { @@ -71,7 +71,7 @@ const char *JsonGet::getStringOrNull(const char *child_name) const { const JsonNode *val = get(child_name, JSON_STRING); if (val) return val->value.toString(); - ERROR_LOG(IO, "String '%s' missing from node", child_name); + ERROR_LOG(Log::IO, "String '%s' missing from node", child_name); return nullptr; } diff --git a/Common/Data/Format/PNGLoad.cpp b/Common/Data/Format/PNGLoad.cpp index b2ed18f99b..9dbaed8bbd 100644 --- a/Common/Data/Format/PNGLoad.cpp +++ b/Common/Data/Format/PNGLoad.cpp @@ -17,7 +17,7 @@ int pngLoad(const char *file, int *pwidth, int *pheight, unsigned char **image_d if (PNG_IMAGE_FAILED(png)) { - WARN_LOG(IO, "pngLoad: %s (%s)", png.message, file); + WARN_LOG(Log::IO, "pngLoad: %s (%s)", png.message, file); *image_data_ptr = nullptr; return 0; } @@ -38,7 +38,7 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth, in png_image_begin_read_from_memory(&png, input_ptr, input_len); if (PNG_IMAGE_FAILED(png)) { - WARN_LOG(IO, "pngLoad: %s", png.message); + WARN_LOG(Log::IO, "pngLoad: %s", png.message); *image_data_ptr = nullptr; return 0; } @@ -50,7 +50,7 @@ int pngLoadPtr(const unsigned char *input_ptr, size_t input_len, int *pwidth, in size_t size = PNG_IMAGE_SIZE(png); if (!size) { - ERROR_LOG(IO, "pngLoad: empty image"); + ERROR_LOG(Log::IO, "pngLoad: empty image"); *image_data_ptr = nullptr; return 0; } diff --git a/Common/Data/Format/RIFF.cpp b/Common/Data/Format/RIFF.cpp index 2b6056a125..0f7a6f5446 100644 --- a/Common/Data/Format/RIFF.cpp +++ b/Common/Data/Format/RIFF.cpp @@ -46,7 +46,7 @@ bool RIFFReader::Descend(uint32_t intoId) { int startLocation = pos_; if (pos_ + length > fileSize_) { - ERROR_LOG(IO, "Block extends outside of RIFF file - failing descend"); + ERROR_LOG(Log::IO, "Block extends outside of RIFF file - failing descend"); pos_ = stack[depth_].parentStartLocation; return false; } @@ -61,7 +61,7 @@ bool RIFFReader::Descend(uint32_t intoId) { if (length > 0) { pos_ += length; // try next block } else { - ERROR_LOG(IO, "Bad data in RIFF file : block length %d. Not descending.", length); + ERROR_LOG(Log::IO, "Bad data in RIFF file : block length %d. Not descending.", length); pos_ = stack[depth_].parentStartLocation; return false; } diff --git a/Common/Data/Format/ZIMLoad.cpp b/Common/Data/Format/ZIMLoad.cpp index 1379521c7c..d61559e9eb 100644 --- a/Common/Data/Format/ZIMLoad.cpp +++ b/Common/Data/Format/ZIMLoad.cpp @@ -51,7 +51,7 @@ int ezuncompress(unsigned char* pDest, long* pnDestLen, const unsigned char* pSr int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int *flags, uint8_t **image) { if (zim[0] != 'Z' || zim[1] != 'I' || zim[2] != 'M' || zim[3] != 'G') { - ERROR_LOG(IO, "Not a ZIM file"); + ERROR_LOG(Log::IO, "Not a ZIM file"); return 0; } memcpy(width, zim + 4, 4); @@ -78,14 +78,14 @@ int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int image_data_size[i] = width[i] * height[i] * 2; break; default: - ERROR_LOG(IO, "Invalid ZIM format %i", *flags & ZIM_FORMAT_MASK); + ERROR_LOG(Log::IO, "Invalid ZIM format %i", *flags & ZIM_FORMAT_MASK); return 0; } total_data_size += image_data_size[i]; } if (total_data_size == 0) { - ERROR_LOG(IO, "Invalid ZIM data size 0"); + ERROR_LOG(Log::IO, "Invalid ZIM data size 0"); return 0; } @@ -98,19 +98,19 @@ int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int long outlen = (long)total_data_size; int retcode = ezuncompress(*image, &outlen, (unsigned char *)(zim + 16), (long)datasize - 16); if (Z_OK != retcode) { - ERROR_LOG(IO, "ZIM zlib format decompression failed: %d", retcode); + ERROR_LOG(Log::IO, "ZIM zlib format decompression failed: %d", retcode); free(*image); *image = 0; return 0; } if (outlen != total_data_size) { // Shouldn't happen if return value was Z_OK. - ERROR_LOG(IO, "Wrong size data in ZIM: %i vs %i", (int)outlen, (int)total_data_size); + ERROR_LOG(Log::IO, "Wrong size data in ZIM: %i vs %i", (int)outlen, (int)total_data_size); } } else if (*flags & ZIM_ZSTD_COMPRESSED) { size_t outlen = ZSTD_decompress(*image, total_data_size, zim + 16, datasize - 16); if (outlen != (size_t)total_data_size) { - ERROR_LOG(IO, "ZIM zstd format decompression failed: %lld", (long long)outlen); + ERROR_LOG(Log::IO, "ZIM zstd format decompression failed: %lld", (long long)outlen); free(*image); *image = 0; return 0; @@ -118,7 +118,7 @@ int LoadZIMPtr(const uint8_t *zim, size_t datasize, int *width, int *height, int } else { memcpy(*image, zim + 16, datasize - 16); if (datasize - 16 != (size_t)total_data_size) { - ERROR_LOG(IO, "Wrong size data in ZIM: %i vs %i", (int)(datasize-16), (int)total_data_size); + ERROR_LOG(Log::IO, "Wrong size data in ZIM: %i vs %i", (int)(datasize-16), (int)total_data_size); } } return num_levels; @@ -128,13 +128,13 @@ int LoadZIM(const char *filename, int *width, int *height, int *format, uint8_t size_t size; uint8_t *buffer = g_VFS.ReadFile(filename, &size); if (!buffer) { - ERROR_LOG(IO, "Couldn't read data for '%s'", filename); + ERROR_LOG(Log::IO, "Couldn't read data for '%s'", filename); return 0; } int retval = LoadZIMPtr(buffer, size, width, height, format, image); if (!retval) { - ERROR_LOG(IO, "Not a valid ZIM file: %s (size: %lld bytes)", filename, (long long)size); + ERROR_LOG(Log::IO, "Not a valid ZIM file: %s (size: %lld bytes)", filename, (long long)size); } delete [] buffer; return retval; diff --git a/Common/Data/Format/ZIMSave.cpp b/Common/Data/Format/ZIMSave.cpp index b18fcf682a..0abe0a40da 100644 --- a/Common/Data/Format/ZIMSave.cpp +++ b/Common/Data/Format/ZIMSave.cpp @@ -143,7 +143,7 @@ void Convert(const uint8_t *image_data, int width, int height, int pitch, int fl break; default: - ERROR_LOG(IO, "Unhandled ZIM format %d", flags & ZIM_FORMAT_MASK); + ERROR_LOG(Log::IO, "Unhandled ZIM format %d", flags & ZIM_FORMAT_MASK); *data = 0; *data_size = 0; return; @@ -199,7 +199,7 @@ void SaveZIM(FILE *f, int width, int height, int pitch, int flags, const uint8_t if (Z_OK == ezcompress(dest, &dest_len, data, data_size, compressLevel == 0 ? Z_DEFAULT_COMPRESSION : compressLevel)) { fwrite(dest, 1, dest_len, f); } else { - ERROR_LOG(IO, "Zlib compression failed.\n"); + ERROR_LOG(Log::IO, "Zlib compression failed.\n"); } delete [] dest; } else if (flags & ZIM_ZSTD_COMPRESSED) { @@ -209,7 +209,7 @@ void SaveZIM(FILE *f, int width, int height, int pitch, int flags, const uint8_t if (!ZSTD_isError(dest_len)) { fwrite(dest, 1, dest_len, f); } else { - ERROR_LOG(IO, "Zlib compression failed.\n"); + ERROR_LOG(Log::IO, "Zlib compression failed.\n"); } delete [] dest; } else { diff --git a/Common/Data/Text/I18n.cpp b/Common/Data/Text/I18n.cpp index a2e6e1fe02..bcd2237c48 100644 --- a/Common/Data/Text/I18n.cpp +++ b/Common/Data/Text/I18n.cpp @@ -142,7 +142,7 @@ bool I18NRepo::LoadIni(const std::string &languageID, const Path &overridePath) IniFile ini; Path iniPath; -// INFO_LOG(SYSTEM, "Loading lang ini %s", iniPath.c_str()); +// INFO_LOG(Log::System, "Loading lang ini %s", iniPath.c_str()); if (!overridePath.empty()) { iniPath = overridePath / (languageID + ".ini"); } else { @@ -174,7 +174,7 @@ void I18NRepo::LogMissingKeys() const { for (size_t i = 0; i < (size_t)I18NCat::CATEGORY_COUNT; i++) { auto &cat = cats_[i]; for (auto &key : cat->Missed()) { - INFO_LOG(SYSTEM, "Missing translation [%s]: %s (%s)", g_categoryNames[i], key.first.c_str(), key.second.c_str()); + INFO_LOG(Log::System, "Missing translation [%s]: %s (%s)", g_categoryNames[i], key.first.c_str(), key.second.c_str()); } } } diff --git a/Common/ExceptionHandlerSetup.cpp b/Common/ExceptionHandlerSetup.cpp index 70b5285bf0..75b88bc2b7 100644 --- a/Common/ExceptionHandlerSetup.cpp +++ b/Common/ExceptionHandlerSetup.cpp @@ -81,7 +81,7 @@ void InstallExceptionHandler(BadAccessHandler badAccessHandler) { return; } - INFO_LOG(SYSTEM, "Installing exception handler"); + INFO_LOG(Log::System, "Installing exception handler"); g_badAccessHandler = badAccessHandler; g_vectoredExceptionHandle = AddVectoredExceptionHandler(TRUE, GlobalExceptionHandler); } @@ -89,7 +89,7 @@ void InstallExceptionHandler(BadAccessHandler badAccessHandler) { void UninstallExceptionHandler() { if (g_vectoredExceptionHandle) { RemoveVectoredExceptionHandler(g_vectoredExceptionHandle); - INFO_LOG(SYSTEM, "Removed exception handler"); + INFO_LOG(Log::System, "Removed exception handler"); g_vectoredExceptionHandle = nullptr; } g_badAccessHandler = nullptr; @@ -186,7 +186,7 @@ void InstallExceptionHandler(BadAccessHandler badAccessHandler) { } g_badAccessHandler = badAccessHandler; - INFO_LOG(SYSTEM, "Installing exception handler"); + INFO_LOG(Log::System, "Installing exception handler"); mach_port_t port; CheckKR("mach_port_allocate", mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &port)); @@ -290,7 +290,7 @@ void InstallExceptionHandler(BadAccessHandler badAccessHandler) { // Add some extra room. altStackSize += 65536; - INFO_LOG(SYSTEM, "Installed exception handler. stack size: %d", (int)altStackSize); + INFO_LOG(Log::System, "Installed exception handler. stack size: %d", (int)altStackSize); g_badAccessHandler = badAccessHandler; stack_t signal_stack{}; @@ -323,7 +323,7 @@ void UninstallExceptionHandler() { stack_t signal_stack{}; signal_stack.ss_flags = SS_DISABLE; if (0 != sigaltstack(&signal_stack, nullptr)) { - ERROR_LOG(SYSTEM, "Could not remove signal altstack"); + ERROR_LOG(Log::System, "Could not remove signal altstack"); } if (altStack) { free(altStack); @@ -333,7 +333,7 @@ void UninstallExceptionHandler() { #ifdef __APPLE__ sigaction(SIGBUS, &old_sa_bus, nullptr); #endif - INFO_LOG(SYSTEM, "Uninstalled exception handler"); + INFO_LOG(Log::System, "Uninstalled exception handler"); g_badAccessHandler = nullptr; } @@ -342,7 +342,7 @@ void UninstallExceptionHandler() { #else // !MACHINE_CONTEXT_SUPPORTED void InstallExceptionHandler(BadAccessHandler badAccessHandler) { - ERROR_LOG(SYSTEM, "Exception handler not implemented on this platform, can't install"); + ERROR_LOG(Log::System, "Exception handler not implemented on this platform, can't install"); } void UninstallExceptionHandler() { } diff --git a/Common/File/AndroidContentURI.cpp b/Common/File/AndroidContentURI.cpp index e467367d07..1bcd7f48b3 100644 --- a/Common/File/AndroidContentURI.cpp +++ b/Common/File/AndroidContentURI.cpp @@ -48,7 +48,7 @@ bool AndroidContentURI::Parse(std::string_view path) { AndroidContentURI AndroidContentURI::WithRootFilePath(const std::string &filePath) { if (root.empty()) { - ERROR_LOG(SYSTEM, "WithRootFilePath cannot be used with single file URIs."); + ERROR_LOG(Log::System, "WithRootFilePath cannot be used with single file URIs."); return *this; } @@ -116,7 +116,7 @@ bool AndroidContentURI::ComputePathTo(const AndroidContentURI &other, std::strin size_t offset = FilePath().size() + 1; const auto &otherFilePath = other.FilePath(); if (offset >= otherFilePath.size()) { - ERROR_LOG(SYSTEM, "Bad call to PathTo. '%s' -> '%s'", FilePath().c_str(), other.FilePath().c_str()); + ERROR_LOG(Log::System, "Bad call to PathTo. '%s' -> '%s'", FilePath().c_str(), other.FilePath().c_str()); return false; } diff --git a/Common/File/AndroidStorage.cpp b/Common/File/AndroidStorage.cpp index fe106f772d..10727fd4a5 100644 --- a/Common/File/AndroidStorage.cpp +++ b/Common/File/AndroidStorage.cpp @@ -154,7 +154,7 @@ static bool ParseFileInfo(const std::string &line, File::FileInfo *fileInfo) { std::vector parts; SplitString(line, '|', parts); if (parts.size() != 4) { - ERROR_LOG(FILESYS, "Bad format: %s", line.c_str()); + ERROR_LOG(Log::FileSystem, "Bad format: %s", line.c_str()); return false; } fileInfo->name = std::string(parts[2]); @@ -247,7 +247,7 @@ std::vector Android_ListContentUri(const std::string &path, bool double elapsed = time_now_d() - start; double threshold = 0.1; if (elapsed >= threshold) { - INFO_LOG(FILESYS, "Listing directory on content URI '%s' took %0.3f s (%d files, log threshold = %0.3f)", path.c_str(), elapsed, (int)items.size(), threshold); + INFO_LOG(Log::FileSystem, "Listing directory on content URI '%s' took %0.3f s (%d files, log threshold = %0.3f)", path.c_str(), elapsed, (int)items.size(), threshold); } return items; } @@ -284,7 +284,7 @@ int64_t Android_ComputeRecursiveDirectorySize(const std::string &uri) { int64_t size = env->CallLongMethod(g_nativeActivity, computeRecursiveDirectorySize, param); double elapsed = time_now_d() - start; - INFO_LOG(IO, "ComputeRecursiveDirectorySize(%s) in %0.3f s", uri.c_str(), elapsed); + INFO_LOG(Log::IO, "ComputeRecursiveDirectorySize(%s) in %0.3f s", uri.c_str(), elapsed); return size; } diff --git a/Common/File/DiskFree.cpp b/Common/File/DiskFree.cpp index 35a0947dfa..9257ac880f 100644 --- a/Common/File/DiskFree.cpp +++ b/Common/File/DiskFree.cpp @@ -43,7 +43,7 @@ bool free_disk_space(const Path &path, int64_t &space) { #else if (path.Type() == PathType::CONTENT_URI) { space = Android_GetFreeSpaceByContentUri(path.ToString()); - INFO_LOG(COMMON, "Free space at '%s': %" PRIu64, path.c_str(), space); + INFO_LOG(Log::Common, "Free space at '%s': %" PRIu64, path.c_str(), space); return space >= 0; } diff --git a/Common/File/FileDescriptor.cpp b/Common/File/FileDescriptor.cpp index a68dc77f40..233f89b6d1 100644 --- a/Common/File/FileDescriptor.cpp +++ b/Common/File/FileDescriptor.cpp @@ -114,7 +114,7 @@ void SetNonBlocking(int sock, bool non_blocking) { int opts = fcntl(sock, F_GETFL); if (opts < 0) { perror("fcntl(F_GETFL)"); - ERROR_LOG(IO, "Error getting socket status while changing nonblocking status"); + ERROR_LOG(Log::IO, "Error getting socket status while changing nonblocking status"); } if (non_blocking) { opts = (opts | O_NONBLOCK); @@ -124,12 +124,12 @@ void SetNonBlocking(int sock, bool non_blocking) { if (fcntl(sock, F_SETFL, opts) < 0) { perror("fcntl(F_SETFL)"); - ERROR_LOG(IO, "Error setting socket nonblocking status"); + ERROR_LOG(Log::IO, "Error setting socket nonblocking status"); } #else u_long val = non_blocking ? 1 : 0; if (ioctlsocket(sock, FIONBIO, &val) != 0) { - ERROR_LOG(IO, "Error setting socket nonblocking status"); + ERROR_LOG(Log::IO, "Error setting socket nonblocking status"); } #endif } diff --git a/Common/File/FileUtil.cpp b/Common/File/FileUtil.cpp index df550d0a45..fe6a94dde0 100644 --- a/Common/File/FileUtil.cpp +++ b/Common/File/FileUtil.cpp @@ -110,7 +110,7 @@ FILE *OpenCFile(const Path &path, const char *mode) { case PathType::CONTENT_URI: // We're gonna need some error codes.. if (!strcmp(mode, "r") || !strcmp(mode, "rb") || !strcmp(mode, "rt")) { - INFO_LOG(COMMON, "Opening content file for read: '%s'", path.c_str()); + INFO_LOG(Log::Common, "Opening content file for read: '%s'", path.c_str()); // Read, let's support this - easy one. int descriptor = Android_OpenContentUriFd(path.ToString(), Android_OpenContentUriMode::READ); if (descriptor < 0) { @@ -121,20 +121,20 @@ FILE *OpenCFile(const Path &path, const char *mode) { // Need to be able to create the file here if it doesn't exist. // Not exactly sure which abstractions are best, let's start simple. if (!File::Exists(path)) { - INFO_LOG(COMMON, "OpenCFile(%s): Opening content file for write. Doesn't exist, creating empty and reopening.", path.c_str()); + INFO_LOG(Log::Common, "OpenCFile(%s): Opening content file for write. Doesn't exist, creating empty and reopening.", path.c_str()); std::string name = path.GetFilename(); if (path.CanNavigateUp()) { Path parent = path.NavigateUp(); if (Android_CreateFile(parent.ToString(), name) != StorageError::SUCCESS) { - WARN_LOG(COMMON, "Failed to create file '%s' in '%s'", name.c_str(), parent.c_str()); + WARN_LOG(Log::Common, "Failed to create file '%s' in '%s'", name.c_str(), parent.c_str()); return nullptr; } } else { - INFO_LOG_REPORT_ONCE(openCFileFailedNavigateUp, COMMON, "Failed to navigate up to create file: %s", path.c_str()); + INFO_LOG_REPORT_ONCE(openCFileFailedNavigateUp, Log::Common, "Failed to navigate up to create file: %s", path.c_str()); return nullptr; } } else { - INFO_LOG(COMMON, "OpenCFile(%s): Opening existing content file for write (truncating). Requested mode: '%s'", path.c_str(), mode); + INFO_LOG(Log::Common, "OpenCFile(%s): Opening existing content file for write (truncating). Requested mode: '%s'", path.c_str(), mode); } // TODO: Support append modes and stuff... For now let's go with the most common one. @@ -146,7 +146,7 @@ FILE *OpenCFile(const Path &path, const char *mode) { } int descriptor = Android_OpenContentUriFd(path.ToString(), openMode); if (descriptor < 0) { - INFO_LOG(COMMON, "Opening '%s' for write failed", path.ToString().c_str()); + INFO_LOG(Log::Common, "Opening '%s' for write failed", path.ToString().c_str()); return nullptr; } FILE *f = fdopen(descriptor, fmode); @@ -156,12 +156,12 @@ FILE *OpenCFile(const Path &path, const char *mode) { } return f; } else { - ERROR_LOG(COMMON, "OpenCFile(%s): Mode not yet supported: %s", path.c_str(), mode); + ERROR_LOG(Log::Common, "OpenCFile(%s): Mode not yet supported: %s", path.c_str(), mode); return nullptr; } break; default: - ERROR_LOG(COMMON, "OpenCFile(%s): PathType not yet supported", path.c_str()); + ERROR_LOG(Log::Common, "OpenCFile(%s): PathType not yet supported", path.c_str()); return nullptr; } @@ -206,27 +206,27 @@ int OpenFD(const Path &path, OpenFlag flags) { case PathType::CONTENT_URI: break; default: - ERROR_LOG(COMMON, "OpenFD: Only supports Content URI paths. Not '%s' (%s)!", path.c_str(), OpenFlagToString(flags).c_str()); + ERROR_LOG(Log::Common, "OpenFD: Only supports Content URI paths. Not '%s' (%s)!", path.c_str(), OpenFlagToString(flags).c_str()); // Not yet supported - use other paths. return -1; } if (flags & OPEN_CREATE) { if (!File::Exists(path)) { - INFO_LOG(COMMON, "OpenFD(%s): Creating file.", path.c_str()); + INFO_LOG(Log::Common, "OpenFD(%s): Creating file.", path.c_str()); std::string name = path.GetFilename(); if (path.CanNavigateUp()) { Path parent = path.NavigateUp(); if (Android_CreateFile(parent.ToString(), name) != StorageError::SUCCESS) { - WARN_LOG(COMMON, "OpenFD: Failed to create file '%s' in '%s'", name.c_str(), parent.c_str()); + WARN_LOG(Log::Common, "OpenFD: Failed to create file '%s' in '%s'", name.c_str(), parent.c_str()); return -1; } } else { - INFO_LOG(COMMON, "Failed to navigate up to create file: %s", path.c_str()); + INFO_LOG(Log::Common, "Failed to navigate up to create file: %s", path.c_str()); return -1; } } else { - INFO_LOG(COMMON, "OpenCFile(%s): Opening existing content file ('%s')", path.c_str(), OpenFlagToString(flags).c_str()); + INFO_LOG(Log::Common, "OpenCFile(%s): Opening existing content file ('%s')", path.c_str(), OpenFlagToString(flags).c_str()); } } @@ -242,14 +242,14 @@ int OpenFD(const Path &path, OpenFlag flags) { // TODO: Maybe better checking of additional flags here. } else { // TODO: Add support for more modes if possible. - ERROR_LOG_REPORT_ONCE(openFlagNotSupported, COMMON, "OpenFlag %s not yet supported", OpenFlagToString(flags).c_str()); + ERROR_LOG_REPORT_ONCE(openFlagNotSupported, Log::Common, "OpenFlag %s not yet supported", OpenFlagToString(flags).c_str()); return -1; } - INFO_LOG(COMMON, "Android_OpenContentUriFd: %s (%s)", path.c_str(), OpenFlagToString(flags).c_str()); + INFO_LOG(Log::Common, "Android_OpenContentUriFd: %s (%s)", path.c_str(), OpenFlagToString(flags).c_str()); int descriptor = Android_OpenContentUriFd(path.ToString(), mode); if (descriptor < 0) { - ERROR_LOG(COMMON, "Android_OpenContentUriFd failed: '%s'", path.c_str()); + ERROR_LOG(Log::Common, "Android_OpenContentUriFd failed: '%s'", path.c_str()); } if (flags & OPEN_APPEND) { @@ -439,7 +439,7 @@ bool IsDirectory(const Path &filename) { #endif auto err = GetLastError(); if (err != ERROR_FILE_NOT_FOUND) { - WARN_LOG(COMMON, "GetFileAttributes failed on %s: %08x %s", filename.ToVisualString().c_str(), (uint32_t)err, GetStringErrorMsg(err).c_str()); + WARN_LOG(Log::Common, "GetFileAttributes failed on %s: %08x %s", filename.ToVisualString().c_str(), (uint32_t)err, GetStringErrorMsg(err).c_str()); } return false; } @@ -450,7 +450,7 @@ bool IsDirectory(const Path &filename) { struct stat file_info; int result = stat(copy.c_str(), &file_info); if (result < 0) { - WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", copy.c_str(), GetLastErrorMsg().c_str()); + WARN_LOG(Log::Common, "IsDirectory: stat failed on %s: %s", copy.c_str(), GetLastErrorMsg().c_str()); return false; } return S_ISDIR(file_info.st_mode); @@ -469,36 +469,36 @@ bool Delete(const Path &filename) { return false; } - INFO_LOG(COMMON, "Delete: file %s", filename.c_str()); + INFO_LOG(Log::Common, "Delete: file %s", filename.c_str()); // Return true because we care about the file no // being there, not the actual delete. if (!Exists(filename)) { - WARN_LOG(COMMON, "Delete: '%s' already does not exist", filename.c_str()); + WARN_LOG(Log::Common, "Delete: '%s' already does not exist", filename.c_str()); return true; } // We can't delete a directory if (IsDirectory(filename)) { - WARN_LOG(COMMON, "Delete failed: '%s' is a directory", filename.c_str()); + WARN_LOG(Log::Common, "Delete failed: '%s' is a directory", filename.c_str()); return false; } #ifdef _WIN32 #if PPSSPP_PLATFORM(UWP) if (!DeleteFileFromAppW(filename.ToWString().c_str())) { - WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", filename.c_str(), GetLastErrorMsg().c_str()); + WARN_LOG(Log::Common, "Delete: DeleteFile failed on %s: %s", filename.c_str(), GetLastErrorMsg().c_str()); return false; } #else if (!DeleteFile(filename.ToWString().c_str())) { - WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", filename.c_str(), GetLastErrorMsg().c_str()); + WARN_LOG(Log::Common, "Delete: DeleteFile failed on %s: %s", filename.c_str(), GetLastErrorMsg().c_str()); return false; } #endif #else if (unlink(filename.c_str()) == -1) { - WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", + WARN_LOG(Log::Common, "Delete: unlink failed on %s: %s", filename.c_str(), GetLastErrorMsg().c_str()); return false; } @@ -525,11 +525,11 @@ bool CreateDir(const Path &path) { AndroidContentURI uri(path.ToString()); std::string newDirName = uri.GetLastPart(); if (uri.NavigateUp()) { - INFO_LOG(COMMON, "Calling Android_CreateDirectory(%s, %s)", uri.ToString().c_str(), newDirName.c_str()); + INFO_LOG(Log::Common, "Calling Android_CreateDirectory(%s, %s)", uri.ToString().c_str(), newDirName.c_str()); return Android_CreateDirectory(uri.ToString(), newDirName) == StorageError::SUCCESS; } else { // Bad path - can't create this directory. - WARN_LOG(COMMON, "CreateDir failed: '%s'", path.c_str()); + WARN_LOG(Log::Common, "CreateDir failed: '%s'", path.c_str()); return false; } break; @@ -538,7 +538,7 @@ bool CreateDir(const Path &path) { return false; } - DEBUG_LOG(COMMON, "CreateDir('%s')", path.c_str()); + DEBUG_LOG(Log::Common, "CreateDir('%s')", path.c_str()); #ifdef _WIN32 #if PPSSPP_PLATFORM(UWP) if (CreateDirectoryFromAppW(path.ToWString().c_str(), NULL)) @@ -550,10 +550,10 @@ bool CreateDir(const Path &path) { DWORD error = GetLastError(); if (error == ERROR_ALREADY_EXISTS) { - WARN_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: already exists", path.c_str()); + WARN_LOG(Log::Common, "CreateDir: CreateDirectory failed on %s: already exists", path.c_str()); return true; } - ERROR_LOG(COMMON, "CreateDir: CreateDirectory failed on %s: %08x %s", path.c_str(), (uint32_t)error, GetStringErrorMsg(error).c_str()); + ERROR_LOG(Log::Common, "CreateDir: CreateDirectory failed on %s: %08x %s", path.c_str(), (uint32_t)error, GetStringErrorMsg(error).c_str()); return false; #else if (mkdir(path.ToString().c_str(), 0755) == 0) { @@ -562,11 +562,11 @@ bool CreateDir(const Path &path) { int err = errno; if (err == EEXIST) { - WARN_LOG(COMMON, "CreateDir: mkdir failed on %s: already exists", path.c_str()); + WARN_LOG(Log::Common, "CreateDir: mkdir failed on %s: already exists", path.c_str()); return true; } - ERROR_LOG(COMMON, "CreateDir: mkdir failed on %s: %s", path.c_str(), strerror(err)); + ERROR_LOG(Log::Common, "CreateDir: mkdir failed on %s: %s", path.c_str(), strerror(err)); return false; #endif } @@ -574,7 +574,7 @@ bool CreateDir(const Path &path) { // Creates the full path of fullPath returns true on success bool CreateFullPath(const Path &path) { if (File::Exists(path)) { - DEBUG_LOG(COMMON, "CreateFullPath: path exists %s", path.c_str()); + DEBUG_LOG(Log::Common, "CreateFullPath: path exists %s", path.c_str()); return true; } @@ -583,7 +583,7 @@ bool CreateFullPath(const Path &path) { case PathType::CONTENT_URI: break; // OK default: - ERROR_LOG(COMMON, "CreateFullPath(%s): Not yet supported", path.c_str()); + ERROR_LOG(Log::Common, "CreateFullPath(%s): Not yet supported", path.c_str()); return false; } @@ -601,7 +601,7 @@ bool CreateFullPath(const Path &path) { // Probably not necessary sanity check, ported from the old code. if (parts.size() > 100) { - ERROR_LOG(COMMON, "CreateFullPath: directory structure too deep"); + ERROR_LOG(Log::Common, "CreateFullPath: directory structure too deep"); return false; } @@ -633,16 +633,16 @@ bool Rename(const Path &srcFilename, const Path &destFilename) { // Content URI: Can only rename if in the same folder. // TODO: Fallback to move + rename? Or do we even care about that use case? We have MoveIfFast for such tricks. if (srcFilename.GetDirectory() != destFilename.GetDirectory()) { - INFO_LOG(COMMON, "Content URI rename: Directories not matching, failing. %s --> %s", srcFilename.c_str(), destFilename.c_str()); + INFO_LOG(Log::Common, "Content URI rename: Directories not matching, failing. %s --> %s", srcFilename.c_str(), destFilename.c_str()); return false; } - INFO_LOG(COMMON, "Content URI rename: %s --> %s", srcFilename.c_str(), destFilename.c_str()); + INFO_LOG(Log::Common, "Content URI rename: %s --> %s", srcFilename.c_str(), destFilename.c_str()); return Android_RenameFileTo(srcFilename.ToString(), destFilename.GetFilename()) == StorageError::SUCCESS; default: return false; } - INFO_LOG(COMMON, "Rename: %s --> %s", srcFilename.c_str(), destFilename.c_str()); + INFO_LOG(Log::Common, "Rename: %s --> %s", srcFilename.c_str(), destFilename.c_str()); #if defined(_WIN32) && defined(UNICODE) #if PPSSPP_PLATFORM(UWP) @@ -659,7 +659,7 @@ bool Rename(const Path &srcFilename, const Path &destFilename) { return true; #endif - ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s", + ERROR_LOG(Log::Common, "Rename: failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); return false; } @@ -683,7 +683,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) { return false; } - INFO_LOG(COMMON, "Copy: %s --> %s", srcFilename.c_str(), destFilename.c_str()); + INFO_LOG(Log::Common, "Copy: %s --> %s", srcFilename.c_str(), destFilename.c_str()); #ifdef _WIN32 #if PPSSPP_PLATFORM(UWP) if (CopyFileFromAppW(srcFilename.ToWString().c_str(), destFilename.ToWString().c_str(), FALSE)) @@ -692,7 +692,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) { if (CopyFile(srcFilename.ToWString().c_str(), destFilename.ToWString().c_str(), FALSE)) return true; #endif - ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", + ERROR_LOG(Log::Common, "Copy: failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); return false; #else @@ -705,7 +705,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) { // Open input file FILE *input = OpenCFile(srcFilename, "rb"); if (!input) { - ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s", + ERROR_LOG(Log::Common, "Copy: input failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); return false; } @@ -714,7 +714,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) { FILE *output = OpenCFile(destFilename, "wb"); if (!output) { fclose(input); - ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s", + ERROR_LOG(Log::Common, "Copy: output failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); return false; } @@ -725,7 +725,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) { int rnum = fread(buffer, sizeof(char), BSIZE, input); if (rnum != BSIZE) { if (ferror(input) != 0) { - ERROR_LOG(COMMON, + ERROR_LOG(Log::Common, "Copy: failed reading from source, %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); fclose(input); @@ -737,7 +737,7 @@ bool Copy(const Path &srcFilename, const Path &destFilename) { // write output int wnum = fwrite(buffer, sizeof(char), rnum, output); if (wnum != rnum) { - ERROR_LOG(COMMON, + ERROR_LOG(Log::Common, "Copy: failed writing to output, %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); fclose(input); @@ -829,14 +829,14 @@ uint64_t GetFileSize(const Path &filename) { int result = stat64(filename.c_str(), &file_info); #endif if (result != 0) { - WARN_LOG(COMMON, "GetSize: failed %s: No such file", filename.ToVisualString().c_str()); + WARN_LOG(Log::Common, "GetSize: failed %s: No such file", filename.ToVisualString().c_str()); return 0; } if (S_ISDIR(file_info.st_mode)) { - WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.ToVisualString().c_str()); + WARN_LOG(Log::Common, "GetSize: failed %s: is a directory", filename.ToVisualString().c_str()); return 0; } - DEBUG_LOG(COMMON, "GetSize: %s: %lld", filename.ToVisualString().c_str(), (long long)file_info.st_size); + DEBUG_LOG(Log::Common, "GetSize: %s: %lld", filename.ToVisualString().c_str(), (long long)file_info.st_size); return file_info.st_size; #endif } @@ -885,10 +885,10 @@ uint64_t GetFileSize(FILE *f) { // creates an empty file filename, returns true on success bool CreateEmptyFile(const Path &filename) { - INFO_LOG(COMMON, "CreateEmptyFile: %s", filename.c_str()); + INFO_LOG(Log::Common, "CreateEmptyFile: %s", filename.c_str()); FILE *pFile = OpenCFile(filename, "wb"); if (!pFile) { - ERROR_LOG(COMMON, "CreateEmptyFile: failed to create '%s': %s", filename.c_str(), GetLastErrorMsg().c_str()); + ERROR_LOG(Log::Common, "CreateEmptyFile: failed to create '%s': %s", filename.c_str(), GetLastErrorMsg().c_str()); return false; } fclose(pFile); @@ -906,11 +906,11 @@ bool DeleteDir(const Path &path) { default: return false; } - INFO_LOG(COMMON, "DeleteDir: directory %s", path.c_str()); + INFO_LOG(Log::Common, "DeleteDir: directory %s", path.c_str()); // check if a directory if (!File::IsDirectory(path)) { - ERROR_LOG(COMMON, "DeleteDir: Not a directory %s", path.c_str()); + ERROR_LOG(Log::Common, "DeleteDir: Not a directory %s", path.c_str()); return false; } @@ -926,7 +926,7 @@ bool DeleteDir(const Path &path) { if (rmdir(path.c_str()) == 0) return true; #endif - ERROR_LOG(COMMON, "DeleteDir: %s: %s", path.c_str(), GetLastErrorMsg().c_str()); + ERROR_LOG(Log::Common, "DeleteDir: %s: %s", path.c_str(), GetLastErrorMsg().c_str()); return false; } @@ -940,7 +940,7 @@ bool DeleteDirRecursively(const Path &path) { // We make use of the dangerous auto-recursive property of Android_RemoveFile. return Android_RemoveFile(path.ToString()) == StorageError::SUCCESS; default: - ERROR_LOG(COMMON, "DeleteDirRecursively: Path type not supported"); + ERROR_LOG(Log::Common, "DeleteDirRecursively: Path type not supported"); return false; } @@ -961,7 +961,7 @@ bool OpenFileInEditor(const Path &fileName) { case PathType::NATIVE: break; // OK default: - ERROR_LOG(COMMON, "OpenFileInEditor(%s): Path type not supported", fileName.c_str()); + ERROR_LOG(Log::Common, "OpenFileInEditor(%s): Path type not supported", fileName.c_str()); return false; } @@ -979,10 +979,10 @@ bool OpenFileInEditor(const Path &fileName) { iniFile = "xdg-open "; #endif iniFile.append(fileName.ToString()); - NOTICE_LOG(BOOT, "Launching %s", iniFile.c_str()); + NOTICE_LOG(Log::Boot, "Launching %s", iniFile.c_str()); int retval = system(iniFile.c_str()); if (retval != 0) { - ERROR_LOG(COMMON, "Failed to launch ini file"); + ERROR_LOG(Log::Common, "Failed to launch ini file"); } #endif return true; diff --git a/Common/File/Path.cpp b/Common/File/Path.cpp index 4448dffe92..8592ed401c 100644 --- a/Common/File/Path.cpp +++ b/Common/File/Path.cpp @@ -51,7 +51,7 @@ void Path::Init(std::string_view str) { // and flip it to a NATIVE url and hope for the best. AndroidContentURI uri(str); if (startsWith(uri.FilePath(), "raw:/")) { - INFO_LOG(SYSTEM, "Raw path detected: %s", uri.FilePath().c_str()); + INFO_LOG(Log::System, "Raw path detected: %s", uri.FilePath().c_str()); path_ = uri.FilePath().substr(4); type_ = PathType::NATIVE; } else { diff --git a/Common/File/PathBrowser.cpp b/Common/File/PathBrowser.cpp index b296741a12..ea5bb92e88 100644 --- a/Common/File/PathBrowser.cpp +++ b/Common/File/PathBrowser.cpp @@ -74,7 +74,7 @@ bool LoadRemoteFileList(const Path &url, const std::string &userAgent, bool *can // Try to extract from an automatic webserver directory listing... GetQuotedStrings(listing, items); } else { - ERROR_LOG(IO, "Unsupported Content-Type: %s", contentType.c_str()); + ERROR_LOG(Log::IO, "Unsupported Content-Type: %s", contentType.c_str()); return false; } Path basePath(baseURL.ToString()); @@ -129,7 +129,7 @@ void PathBrowser::SetPath(const Path &path) { } void PathBrowser::RestrictToRoot(const Path &root) { - INFO_LOG(SYSTEM, "Restricting to root: %s", root.c_str()); + INFO_LOG(Log::System, "Restricting to root: %s", root.c_str()); restrictedRoot_ = root; } @@ -181,7 +181,7 @@ void PathBrowser::HandlePath() { results.clear(); success_ = File::GetFilesInDir(lastPath, &results, nullptr); if (!success_) { - WARN_LOG(IO, "PathBrowser: Failed to list directory: %s", lastPath.c_str()); + WARN_LOG(Log::IO, "PathBrowser: Failed to list directory: %s", lastPath.c_str()); } guard.lock(); } @@ -248,7 +248,7 @@ bool PathBrowser::GetListing(std::vector &fileInfo, const char * void PathBrowser::ApplyRestriction() { if (!path_.StartsWith(restrictedRoot_) && !startsWith(path_.ToString(), "!")) { - WARN_LOG(SYSTEM, "Applying path restriction: %s (%s didn't match)", restrictedRoot_.c_str(), path_.c_str()); + WARN_LOG(Log::System, "Applying path restriction: %s (%s didn't match)", restrictedRoot_.c_str(), path_.c_str()); path_ = restrictedRoot_; } } diff --git a/Common/File/VFS/VFS.cpp b/Common/File/VFS/VFS.cpp index 0923a750f3..3334b7cae4 100644 --- a/Common/File/VFS/VFS.cpp +++ b/Common/File/VFS/VFS.cpp @@ -11,9 +11,9 @@ VFS g_VFS; void VFS::Register(const char *prefix, VFSBackend *reader) { if (reader) { entries_.push_back(VFSEntry{ prefix, reader }); - DEBUG_LOG(IO, "Registered VFS for prefix %s: %s", prefix, reader->toString().c_str()); + DEBUG_LOG(Log::IO, "Registered VFS for prefix %s: %s", prefix, reader->toString().c_str()); } else { - ERROR_LOG(IO, "Trying to register null VFS backend for prefix %s", prefix); + ERROR_LOG(Log::IO, "Trying to register null VFS backend for prefix %s", prefix); } } @@ -40,7 +40,7 @@ static bool IsLocalAbsolutePath(std::string_view path) { uint8_t *VFS::ReadFile(const char *filename, size_t *size) { if (IsLocalAbsolutePath(filename)) { // Local path, not VFS. - // INFO_LOG(IO, "Not a VFS path: %s . Reading local file.", filename); + // INFO_LOG(Log::IO, "Not a VFS path: %s . Reading local file.", filename); return File::ReadLocalFile(Path(filename), size); } @@ -51,7 +51,7 @@ uint8_t *VFS::ReadFile(const char *filename, size_t *size) { if (prefix_len >= fn_len) continue; if (0 == memcmp(filename, entry.prefix, prefix_len)) { fileSystemFound = true; - // INFO_LOG(IO, "Prefix match: %s (%s) -> %s", entries[i].prefix, filename, filename + prefix_len); + // INFO_LOG(Log::IO, "Prefix match: %s (%s) -> %s", entries[i].prefix, filename, filename + prefix_len); uint8_t *data = entry.reader->ReadFile(filename + prefix_len, size); if (data) return data; @@ -61,7 +61,7 @@ uint8_t *VFS::ReadFile(const char *filename, size_t *size) { } } if (!fileSystemFound) { - ERROR_LOG(IO, "Missing filesystem for '%s'", filename); + ERROR_LOG(Log::IO, "Missing filesystem for '%s'", filename); } // Otherwise, the file was just missing. No need to log. return nullptr; } @@ -69,7 +69,7 @@ uint8_t *VFS::ReadFile(const char *filename, size_t *size) { bool VFS::GetFileListing(const char *path, std::vector *listing, const char *filter) { if (IsLocalAbsolutePath(path)) { // Local path, not VFS. - // INFO_LOG(IO, "Not a VFS path: %s . Reading local directory.", path); + // INFO_LOG(Log::IO, "Not a VFS path: %s . Reading local directory.", path); File::GetFilesInDir(Path(std::string(path)), listing, filter); return true; } @@ -88,7 +88,7 @@ bool VFS::GetFileListing(const char *path, std::vector *listing, } if (!fileSystemFound) { - ERROR_LOG(IO, "Missing filesystem for %s", path); + ERROR_LOG(Log::IO, "Missing filesystem for %s", path); } // Otherwise, the file was just missing. No need to log. return false; } @@ -96,7 +96,7 @@ bool VFS::GetFileListing(const char *path, std::vector *listing, bool VFS::GetFileInfo(const char *path, File::FileInfo *info) { if (IsLocalAbsolutePath(path)) { // Local path, not VFS. - // INFO_LOG(IO, "Not a VFS path: %s . Getting local file info.", path); + // INFO_LOG(Log::IO, "Not a VFS path: %s . Getting local file info.", path); return File::GetFileInfo(Path(std::string(path)), info); } @@ -114,7 +114,7 @@ bool VFS::GetFileInfo(const char *path, File::FileInfo *info) { } } if (!fileSystemFound) { - ERROR_LOG(IO, "Missing filesystem for '%s'", path); + ERROR_LOG(Log::IO, "Missing filesystem for '%s'", path); } // Otherwise, the file was just missing. No need to log. return false; } diff --git a/Common/File/VFS/ZipFileReader.cpp b/Common/File/VFS/ZipFileReader.cpp index c25b17f680..fa416eef04 100644 --- a/Common/File/VFS/ZipFileReader.cpp +++ b/Common/File/VFS/ZipFileReader.cpp @@ -22,7 +22,7 @@ ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath, int fd = File::OpenFD(zipFile, File::OPEN_READ); if (!fd) { if (logErrors) { - ERROR_LOG(IO, "Failed to open FD for '%s' as zip file", zipFile.c_str()); + ERROR_LOG(Log::IO, "Failed to open FD for '%s' as zip file", zipFile.c_str()); } return nullptr; } @@ -33,7 +33,7 @@ ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath, if (!zip_file) { if (logErrors) { - ERROR_LOG(IO, "Failed to open %s as a zip file", zipFile.c_str()); + ERROR_LOG(Log::IO, "Failed to open %s as a zip file", zipFile.c_str()); } return nullptr; } @@ -61,7 +61,7 @@ uint8_t *ZipFileReader::ReadFile(const char *path, size_t *size) { zip_stat(zip_file_, temp_path.c_str(), ZIP_FL_NOCASE | ZIP_FL_UNCHANGED, &zstat); zip_file *file = zip_fopen(zip_file_, temp_path.c_str(), ZIP_FL_NOCASE | ZIP_FL_UNCHANGED); if (!file) { - ERROR_LOG(IO, "Error opening %s from ZIP", temp_path.c_str()); + ERROR_LOG(Log::IO, "Error opening %s from ZIP", temp_path.c_str()); return 0; } uint8_t *contents = new uint8_t[zstat.size + 1]; @@ -107,7 +107,7 @@ bool ZipFileReader::GetFileListing(const char *orig_path, std::vectorclear(); - // INFO_LOG(SYSTEM, "Zip: Listing '%s'", orig_path); + // INFO_LOG(Log::System, "Zip: Listing '%s'", orig_path); listing->reserve(directories.size() + files.size()); for (auto diter = directories.begin(); diter != directories.end(); ++diter) { @@ -120,7 +120,7 @@ bool ZipFileReader::GetFileListing(const char *orig_path, std::vectorpush_back(info); } @@ -139,7 +139,7 @@ bool ZipFileReader::GetFileListing(const char *orig_path, std::vectorpush_back(info); } @@ -279,7 +279,7 @@ VFSOpenFile *ZipFileReader::OpenFileForRead(VFSFileReference *vfsReference, size openFile->zf = zip_fopen_index(zip_file_, reference->zi, 0); if (!openFile->zf) { - WARN_LOG(G3D, "File with index %d not found in zip", reference->zi); + WARN_LOG(Log::G3D, "File with index %d not found in zip", reference->zi); lock_.unlock(); delete openFile; return nullptr; diff --git a/Common/GPU/D3D11/thin3d_d3d11.cpp b/Common/GPU/D3D11/thin3d_d3d11.cpp index c9e7f3a291..380daffb51 100644 --- a/Common/GPU/D3D11/thin3d_d3d11.cpp +++ b/Common/GPU/D3D11/thin3d_d3d11.cpp @@ -1036,7 +1036,7 @@ void D3D11DrawContext::UpdateTextureLevels(Texture *texture, const uint8_t **dat ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLanguage language, const uint8_t *data, size_t dataSize, const char *tag) { if (language != ShaderLanguage::HLSL_D3D11) { - ERROR_LOG(G3D, "Unsupported shader language"); + ERROR_LOG(Log::G3D, "Unsupported shader language"); return nullptr; } @@ -1079,7 +1079,7 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang } if (errorMsgs) { errors = std::string((const char *)errorMsgs->GetBufferPointer(), errorMsgs->GetBufferSize()); - ERROR_LOG(G3D, "Failed compiling %s:\n%s\n%s", tag, data, errors.c_str()); + ERROR_LOG(Log::G3D, "Failed compiling %s:\n%s\n%s", tag, data, errors.c_str()); errorMsgs->Release(); } @@ -1104,7 +1104,7 @@ ShaderModule *D3D11DrawContext::CreateShaderModule(ShaderStage stage, ShaderLang result = device_->CreateGeometryShader(data, dataSize, nullptr, &module->gs); break; default: - ERROR_LOG(G3D, "Unsupported shader stage"); + ERROR_LOG(Log::G3D, "Unsupported shader stage"); result = S_FALSE; break; } @@ -1484,7 +1484,7 @@ Framebuffer *D3D11DrawContext::CreateFramebuffer(const FramebufferDesc &desc) { depthViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; hr = device_->CreateShaderResourceView(fb->depthStencilTex, &depthViewDesc, &fb->depthSRView); if (FAILED(hr)) { - WARN_LOG(G3D, "Failed to create SRV for depth buffer."); + WARN_LOG(Log::G3D, "Failed to create SRV for depth buffer."); fb->depthSRView = nullptr; } } diff --git a/Common/GPU/D3D9/thin3d_d3d9.cpp b/Common/GPU/D3D9/thin3d_d3d9.cpp index 3773a4e288..0e12092ee0 100644 --- a/Common/GPU/D3D9/thin3d_d3d9.cpp +++ b/Common/GPU/D3D9/thin3d_d3d9.cpp @@ -375,7 +375,7 @@ bool D3D9Texture::Create(const TextureDesc &desc) { break; } if (FAILED(hr)) { - ERROR_LOG(G3D, "D3D9 Texture creation failed"); + ERROR_LOG(Log::G3D, "D3D9 Texture creation failed"); return false; } @@ -486,7 +486,7 @@ void D3D9Texture::SetImageData(int x, int y, int z, int width, int height, int d } default: - ERROR_LOG(G3D, "Non-LINEAR2D textures not yet supported"); + ERROR_LOG(Log::G3D, "Non-LINEAR2D textures not yet supported"); break; } } @@ -733,7 +733,7 @@ static NVIDIAGeneration NVIDIAGetDeviceGeneration(int deviceID) { D3D9Context::D3D9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx) : d3d_(d3d), d3dEx_(d3dEx), device_(device), deviceEx_(deviceEx), adapterId_(adapterId), caps_{} { if (FAILED(d3d->GetAdapterIdentifier(adapterId, 0, &identifier_))) { - ERROR_LOG(G3D, "Failed to get adapter identifier: %d", adapterId); + ERROR_LOG(Log::G3D, "Failed to get adapter identifier: %d", adapterId); } switch (identifier_.VendorId) { case 0x10DE: caps_.vendor = GPUVendor::VENDOR_NVIDIA; break; @@ -758,7 +758,7 @@ D3D9Context::D3D9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, ID if (SUCCEEDED(result)) { snprintf(shadeLangVersion_, sizeof(shadeLangVersion_), "PS: %04x VS: %04x", d3dCaps_.PixelShaderVersion & 0xFFFF, d3dCaps_.VertexShaderVersion & 0xFFFF); } else { - WARN_LOG(G3D, "Direct3D9: Failed to get the device caps!"); + WARN_LOG(Log::G3D, "Direct3D9: Failed to get the device caps!"); truncate_cpy(shadeLangVersion_, "N/A"); } @@ -846,13 +846,13 @@ ShaderModule *D3D9Context::CreateShaderModule(ShaderStage stage, ShaderLanguage Pipeline *D3D9Context::CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) { if (!desc.shaders.size()) { - ERROR_LOG(G3D, "Pipeline %s requires at least one shader", tag); + ERROR_LOG(Log::G3D, "Pipeline %s requires at least one shader", tag); return NULL; } D3D9Pipeline *pipeline = new D3D9Pipeline(); for (auto iter : desc.shaders) { if (!iter) { - ERROR_LOG(G3D, "NULL shader passed to CreateGraphicsPipeline(%s)", tag); + ERROR_LOG(Log::G3D, "NULL shader passed to CreateGraphicsPipeline(%s)", tag); delete pipeline; return NULL; } @@ -1041,7 +1041,7 @@ D3D9InputLayout::D3D9InputLayout(LPDIRECT3DDEVICE9 device, const InputLayoutDesc HRESULT hr = device->CreateVertexDeclaration(elements, &decl_); if (FAILED(hr)) { - ERROR_LOG(G3D, "Error creating vertex decl"); + ERROR_LOG(Log::G3D, "Error creating vertex decl"); } delete[] elements; } @@ -1119,7 +1119,7 @@ void D3D9Context::UpdateBuffer(Buffer *buffer, const uint8_t *data, size_t offse if (!size) return; if (offset + size > buf->maxSize_) { - ERROR_LOG(G3D, "Can't SubData with bigger size than buffer was created with"); + ERROR_LOG(Log::G3D, "Can't SubData with bigger size than buffer was created with"); return; } if (buf->vbuffer_) { @@ -1253,8 +1253,8 @@ bool D3D9ShaderModule::Compile(LPDIRECT3DDEVICE9 device, const uint8_t *data, si error = "D3D9 shader compiler not installed"; } - ERROR_LOG(G3D, "Compile error: %s", error); - ERROR_LOG(G3D, "%s", LineNumberString(std::string((const char *)data)).c_str()); + ERROR_LOG(Log::G3D, "Compile error: %s", error); + ERROR_LOG(Log::G3D, "%s", LineNumberString(std::string((const char *)data)).c_str()); OutputDebugStringA(source); OutputDebugStringA(error); @@ -1307,7 +1307,7 @@ Framebuffer *D3D9Context::CreateFramebuffer(const FramebufferDesc &desc) { HRESULT rtResult = device_->CreateTexture(desc.width, desc.height, 1, D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &fbo->tex, nullptr); if (FAILED(rtResult)) { - ERROR_LOG(G3D, "Failed to create render target"); + ERROR_LOG(Log::G3D, "Failed to create render target"); fbo->Release(); return NULL; } @@ -1323,7 +1323,7 @@ Framebuffer *D3D9Context::CreateFramebuffer(const FramebufferDesc &desc) { dsResult = device_->CreateDepthStencilSurface(desc.width, desc.height, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, FALSE, &fbo->depthstencil, NULL); } if (FAILED(dsResult)) { - ERROR_LOG(G3D, "Failed to create depth buffer"); + ERROR_LOG(Log::G3D, "Failed to create depth buffer"); fbo->surf->Release(); fbo->tex->Release(); if (fbo->depthstenciltex) { @@ -1595,7 +1595,7 @@ void D3D9Context::HandleEvent(Event ev, int width, int height, void *param1, voi DrawContext *T3DCreateDX9Context(IDirect3D9 *d3d, IDirect3D9Ex *d3dEx, int adapterId, IDirect3DDevice9 *device, IDirect3DDevice9Ex *deviceEx) { bool result = LoadD3DCompilerDynamic(); if (!result) { - ERROR_LOG(G3D, "Failed to load D3DCompiler!"); + ERROR_LOG(Log::G3D, "Failed to load D3DCompiler!"); return nullptr; } return new D3D9Context(d3d, d3dEx, adapterId, device, deviceEx); diff --git a/Common/GPU/OpenGL/GLDebugLog.cpp b/Common/GPU/OpenGL/GLDebugLog.cpp index 94b79dabc0..7a76ffeb75 100644 --- a/Common/GPU/OpenGL/GLDebugLog.cpp +++ b/Common/GPU/OpenGL/GLDebugLog.cpp @@ -37,7 +37,7 @@ std::string GLEnumToString(uint16_t value) { bool CheckGLError(const char *file, int line) { GLenum err = glGetError(); if (err != GL_NO_ERROR) { - ERROR_LOG(G3D, "GL error %s on %s:%d", GLEnumToString(err).c_str(), file, line); + ERROR_LOG(Log::G3D, "GL error %s on %s:%d", GLEnumToString(err).c_str(), file, line); return false; } return true; diff --git a/Common/GPU/OpenGL/GLFeatures.cpp b/Common/GPU/OpenGL/GLFeatures.cpp index c069c0a641..fc91f5ee8d 100644 --- a/Common/GPU/OpenGL/GLFeatures.cpp +++ b/Common/GPU/OpenGL/GLFeatures.cpp @@ -105,7 +105,7 @@ int GLExtensions::GLSLVersion() { void ProcessGPUFeatures() { gl_extensions.bugs = 0; - DEBUG_LOG(G3D, "Checking for GL driver bugs... vendor=%i model='%s'", (int)gl_extensions.gpuVendor, gl_extensions.model); + DEBUG_LOG(Log::G3D, "Checking for GL driver bugs... vendor=%i model='%s'", (int)gl_extensions.gpuVendor, gl_extensions.model); if (gl_extensions.gpuVendor == GPU_VENDOR_IMGTEC) { if (!strcmp(gl_extensions.model, "PowerVR SGX 545") || @@ -115,11 +115,11 @@ void ProcessGPUFeatures() { !strcmp(gl_extensions.model, "PowerVR SGX 540") || !strcmp(gl_extensions.model, "PowerVR SGX 530") || !strcmp(gl_extensions.model, "PowerVR SGX 520") ) { - WARN_LOG(G3D, "GL DRIVER BUG: PVR with bad and terrible precision"); + WARN_LOG(Log::G3D, "GL DRIVER BUG: PVR with bad and terrible precision"); gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_TERRIBLE | BUG_PVR_SHADER_PRECISION_BAD; } else { // TODO: I'm not sure if the Rogue series is affected by this. - WARN_LOG(G3D, "GL DRIVER BUG: PVR with bad precision"); + WARN_LOG(Log::G3D, "GL DRIVER BUG: PVR with bad precision"); gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_BAD; } } @@ -193,14 +193,14 @@ bool CheckGLExtensions() { } else if (vendor == "Apple Inc." || vendor == "Apple") { gl_extensions.gpuVendor = GPU_VENDOR_APPLE; } else { - WARN_LOG(G3D, "Unknown GL vendor: '%s'", vendor.c_str()); + WARN_LOG(Log::G3D, "Unknown GL vendor: '%s'", vendor.c_str()); gl_extensions.gpuVendor = GPU_VENDOR_UNKNOWN; } } else { gl_extensions.gpuVendor = GPU_VENDOR_UNKNOWN; } - INFO_LOG(G3D, "GPU Vendor : %s ; renderer: %s version str: %s ; GLSL version str: %s", cvendor ? cvendor : "N/A", renderer ? renderer : "N/A", versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A"); + INFO_LOG(Log::G3D, "GPU Vendor : %s ; renderer: %s version str: %s ; GLSL version str: %s", cvendor ? cvendor : "N/A", renderer ? renderer : "N/A", versionStr ? versionStr : "N/A", glslVersionStr ? glslVersionStr : "N/A"); if (renderer) { strncpy(gl_extensions.model, renderer, sizeof(gl_extensions.model)); @@ -267,7 +267,7 @@ bool CheckGLExtensions() { gl_extensions.ver[1] = 0; } else if (parsed[0] && (gl_extensions.ver[0] != parsed[0] || gl_extensions.ver[1] != parsed[1])) { // Something going wrong. Possible bug in GL ES drivers. See #9688 - INFO_LOG(G3D, "GL ES version mismatch. Version string '%s' parsed as %d.%d but API return %d.%d. Fallback to GL ES 2.0.", + INFO_LOG(Log::G3D, "GL ES version mismatch. Version string '%s' parsed as %d.%d but API return %d.%d. Fallback to GL ES 2.0.", versionStr ? versionStr : "N/A", parsed[0], parsed[1], gl_extensions.ver[0], gl_extensions.ver[1]); gl_extensions.ver[0] = 2; @@ -291,7 +291,7 @@ bool CheckGLExtensions() { gl_extensions.GLES3 = true; // Though, let's ban Mali from the GLES 3 path for now, see #4078 if (strstr(renderer, "Mali") != 0) { - INFO_LOG(G3D, "Forcing GLES3 off for Mali driver version: %s\n", versionStr ? versionStr : "N/A"); + INFO_LOG(Log::G3D, "Forcing GLES3 off for Mali driver version: %s\n", versionStr ? versionStr : "N/A"); gl_extensions.GLES3 = false; } } else { @@ -312,9 +312,9 @@ bool CheckGLExtensions() { if (gl_extensions.GLES3) { if (gl_extensions.ver[1] >= 1) { - INFO_LOG(G3D, "OpenGL ES 3.1 support detected!\n"); + INFO_LOG(Log::G3D, "OpenGL ES 3.1 support detected!\n"); } else { - INFO_LOG(G3D, "OpenGL ES 3.0 support detected!\n"); + INFO_LOG(Log::G3D, "OpenGL ES 3.0 support detected!\n"); } } } @@ -410,7 +410,7 @@ bool CheckGLExtensions() { #ifdef _DEBUG void *invalidAddress = (void *)eglGetProcAddress("InvalidGlCall1"); void *invalidAddress2 = (void *)eglGetProcAddress("AnotherInvalidGlCall2"); - DEBUG_LOG(G3D, "Addresses returned for invalid extensions: %p %p", invalidAddress, invalidAddress2); + DEBUG_LOG(Log::G3D, "Addresses returned for invalid extensions: %p %p", invalidAddress, invalidAddress2); #endif // These are all the same. Let's alias. @@ -511,7 +511,7 @@ bool CheckGLExtensions() { // The model number comparison should probably be 400 or 500. This causes us to avoid depal-in-shader. // It seems though that this caused large perf regressions on Adreno 5xx, so I've bumped it up to 600. if (gl_extensions.gpuVendor == GPU_VENDOR_QUALCOMM && gl_extensions.modelNumber < 600) { - WARN_LOG(G3D, "Detected old Adreno - lowering reported int precision for safety"); + WARN_LOG(Log::G3D, "Detected old Adreno - lowering reported int precision for safety"); gl_extensions.range[1][5][0] = 15; gl_extensions.range[1][5][1] = 15; } @@ -621,7 +621,7 @@ bool CheckGLExtensions() { int error = glGetError(); if (error) - ERROR_LOG(G3D, "GL error in init: %i", error); + ERROR_LOG(Log::G3D, "GL error in init: %i", error); #endif return true; diff --git a/Common/GPU/OpenGL/GLMemory.cpp b/Common/GPU/OpenGL/GLMemory.cpp index 4da0d9bba2..6718bd23eb 100644 --- a/Common/GPU/OpenGL/GLMemory.cpp +++ b/Common/GPU/OpenGL/GLMemory.cpp @@ -137,7 +137,7 @@ void GLPushBuffer::Flush() { } void GLPushBuffer::AddBuffer() { - // INFO_LOG(G3D, "GLPushBuffer(%s): Allocating %d bytes", tag_, size_); + // INFO_LOG(Log::G3D, "GLPushBuffer(%s): Allocating %d bytes", tag_, size_); BufInfo info; info.localMemory = (uint8_t *)AllocateAlignedMemory(size_, 16); _assert_msg_(info.localMemory != 0, "GLPushBuffer alloc fail: %d (%s)", (int)size_, tag_); diff --git a/Common/GPU/OpenGL/GLQueueRunner.cpp b/Common/GPU/OpenGL/GLQueueRunner.cpp index 75c2125b06..36a391302f 100644 --- a/Common/GPU/OpenGL/GLQueueRunner.cpp +++ b/Common/GPU/OpenGL/GLQueueRunner.cpp @@ -130,12 +130,12 @@ void GLQueueRunner::RunInitSteps(const FastVec &steps, bool skipGLC } case GLRInitStepType::CREATE_PROGRAM: { - WARN_LOG(G3D, "CREATE_PROGRAM found with skipGLCalls, not good"); + WARN_LOG(Log::G3D, "CREATE_PROGRAM found with skipGLCalls, not good"); break; } case GLRInitStepType::CREATE_SHADER: { - WARN_LOG(G3D, "CREATE_SHADER found with skipGLCalls, not good"); + WARN_LOG(Log::G3D, "CREATE_SHADER found with skipGLCalls, not good"); break; } default: @@ -237,11 +237,11 @@ void GLQueueRunner::RunInitSteps(const FastVec &steps, bool skipGLC if (!anyFailed) Reporting::ReportMessage("Error in shader program link: info: %s\nfs: %s\n%s\nvs: %s\n%s", infoLog.c_str(), fsDesc.c_str(), fsCode, vsDesc.c_str(), vsCode); - ERROR_LOG(G3D, "Could not link program:\n %s", infoLog.c_str()); - ERROR_LOG(G3D, "VS desc:\n%s", vsDesc.c_str()); - ERROR_LOG(G3D, "FS desc:\n%s", fsDesc.c_str()); - ERROR_LOG(G3D, "VS:\n%s\n", LineNumberString(vsCode).c_str()); - ERROR_LOG(G3D, "FS:\n%s\n", LineNumberString(fsCode).c_str()); + ERROR_LOG(Log::G3D, "Could not link program:\n %s", infoLog.c_str()); + ERROR_LOG(Log::G3D, "VS desc:\n%s", vsDesc.c_str()); + ERROR_LOG(Log::G3D, "FS desc:\n%s", fsDesc.c_str()); + ERROR_LOG(Log::G3D, "VS:\n%s\n", LineNumberString(vsCode).c_str()); + ERROR_LOG(Log::G3D, "FS:\n%s\n", LineNumberString(fsCode).c_str()); #ifdef _WIN32 OutputDebugStringUTF8(infoLog.c_str()); @@ -264,7 +264,7 @@ void GLQueueRunner::RunInitSteps(const FastVec &steps, bool skipGLC int location = glGetUniformLocation(program->program, query.name); if (location < 0 && query.required) { - WARN_LOG(G3D, "Required uniform query for '%s' failed", query.name); + WARN_LOG(Log::G3D, "Required uniform query for '%s' failed", query.name); } *query.dest = location; } @@ -306,7 +306,7 @@ void GLQueueRunner::RunInitSteps(const FastVec &steps, bool skipGLC std::vector lines; SplitString(errorString, '\n', lines); for (auto line : lines) { - ERROR_LOG(G3D, "%.*s", (int)line.size(), line.data()); + ERROR_LOG(Log::G3D, "%.*s", (int)line.size(), line.data()); } if (errorCallback_) { std::string desc = StringFromFormat("Shader compilation failed: %s", step.create_shader.stage == GL_VERTEX_SHADER ? "vertex" : "fragment"); @@ -431,12 +431,12 @@ void GLQueueRunner::RunInitSteps(const FastVec &steps, bool skipGLC // Calling glGetError() isn't great, but at the end of init, only after creating textures, shouldn't be too bad... GLenum err = glGetError(); if (err == GL_OUT_OF_MEMORY) { - WARN_LOG_REPORT(G3D, "GL ran out of GPU memory; switching to low memory mode"); + WARN_LOG_REPORT(Log::G3D, "GL ran out of GPU memory; switching to low memory mode"); sawOutOfMemory_ = true; } else if (err != GL_NO_ERROR) { // We checked the err anyway, might as well log if there is one. std::string errorString = GLEnumToString(err); - WARN_LOG(G3D, "Got an error after init: %08x (%s)", err, errorString.c_str()); + WARN_LOG(Log::G3D, "Got an error after init: %08x (%s)", err, errorString.c_str()); if (errorCallback_) { errorCallback_("GL frame init error", errorString.c_str(), errorCallbackUserData_); } @@ -494,7 +494,7 @@ void GLQueueRunner::InitCreateFramebuffer(const GLRInitStep &step) { retry_depth: if (!fbo->z_stencil_) { - INFO_LOG(G3D, "Creating %d x %d FBO using no depth", fbo->width, fbo->height); + INFO_LOG(Log::G3D, "Creating %d x %d FBO using no depth", fbo->width, fbo->height); fbo->z_stencil_buffer = 0; fbo->stencil_buffer = 0; @@ -507,7 +507,7 @@ retry_depth: glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); } else if (gl_extensions.IsGLES) { if (gl_extensions.OES_packed_depth_stencil && (gl_extensions.OES_depth_texture || gl_extensions.GLES3)) { - INFO_LOG(G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height); + INFO_LOG(Log::G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height); fbo->z_stencil_buffer = 0; fbo->stencil_buffer = 0; fbo->z_buffer = 0; @@ -528,7 +528,7 @@ retry_depth: glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, fbo->z_stencil_texture.texture, 0); } } else if (gl_extensions.OES_packed_depth_stencil) { - INFO_LOG(G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8", fbo->width, fbo->height); + INFO_LOG(Log::G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8", fbo->width, fbo->height); // Standard method fbo->stencil_buffer = 0; fbo->z_buffer = 0; @@ -543,7 +543,7 @@ retry_depth: glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fbo->z_stencil_buffer); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo->z_stencil_buffer); } else { - INFO_LOG(G3D, "Creating %d x %d FBO using separate stencil", fbo->width, fbo->height); + INFO_LOG(Log::G3D, "Creating %d x %d FBO using separate stencil", fbo->width, fbo->height); // TEGRA fbo->z_stencil_buffer = 0; // 16/24-bit Z, separate 8-bit stencil @@ -564,7 +564,7 @@ retry_depth: glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fbo->stencil_buffer); } } else if (gl_extensions.VersionGEThan(3, 0)) { - INFO_LOG(G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height); + INFO_LOG(Log::G3D, "Creating %d x %d FBO using DEPTH24_STENCIL8 texture", fbo->width, fbo->height); fbo->z_stencil_buffer = 0; fbo->stencil_buffer = 0; fbo->z_buffer = 0; @@ -600,13 +600,13 @@ retry_depth: switch (status) { case GL_FRAMEBUFFER_COMPLETE: - // INFO_LOG(G3D, "Framebuffer verified complete."); + // INFO_LOG(Log::G3D, "Framebuffer verified complete."); break; case GL_FRAMEBUFFER_UNSUPPORTED: - ERROR_LOG(G3D, "GL_FRAMEBUFFER_UNSUPPORTED"); + ERROR_LOG(Log::G3D, "GL_FRAMEBUFFER_UNSUPPORTED"); break; case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: - ERROR_LOG(G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"); + ERROR_LOG(Log::G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"); break; default: _assert_msg_(false, "Other framebuffer error: %d", status); @@ -747,7 +747,7 @@ void GLQueueRunner::PerformBlit(const GLRStep &step) { CHECK_GL_ERROR_IF_DEBUG(); #endif // defined(USING_GLES2) && defined(__ANDROID__) } else { - ERROR_LOG(G3D, "GLQueueRunner: Tried to blit without the capability"); + ERROR_LOG(Log::G3D, "GLQueueRunner: Tried to blit without the capability"); } } @@ -1694,13 +1694,13 @@ void GLQueueRunner::fbo_ext_create(const GLRInitStep &step) { GLenum status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); switch (status) { case GL_FRAMEBUFFER_COMPLETE_EXT: - // INFO_LOG(G3D, "Framebuffer verified complete."); + // INFO_LOG(Log::G3D, "Framebuffer verified complete."); break; case GL_FRAMEBUFFER_UNSUPPORTED_EXT: - ERROR_LOG(G3D, "GL_FRAMEBUFFER_UNSUPPORTED"); + ERROR_LOG(Log::G3D, "GL_FRAMEBUFFER_UNSUPPORTED"); break; case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT: - ERROR_LOG(G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT "); + ERROR_LOG(Log::G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT "); break; default: _assert_msg_(false, "Other framebuffer error: %d", status); diff --git a/Common/GPU/OpenGL/GLRenderManager.cpp b/Common/GPU/OpenGL/GLRenderManager.cpp index 9879b7b8c4..18d93a0f4f 100644 --- a/Common/GPU/OpenGL/GLRenderManager.cpp +++ b/Common/GPU/OpenGL/GLRenderManager.cpp @@ -12,7 +12,7 @@ #include "Common/Math/math_util.h" #if 0 // def _DEBUG -#define VLOG(...) INFO_LOG(G3D, __VA_ARGS__) +#define VLOG(...) INFO_LOG(Log::G3D, __VA_ARGS__) #else #define VLOG(...) #endif @@ -59,7 +59,7 @@ void GLRenderManager::ThreadStart(Draw::DrawContext *draw) { renderThreadId = std::this_thread::get_id(); if (newInflightFrames_ != -1) { - INFO_LOG(G3D, "Updating inflight frames to %d", newInflightFrames_); + INFO_LOG(Log::G3D, "Updating inflight frames to %d", newInflightFrames_); inflightFrames_ = newInflightFrames_; newInflightFrames_ = -1; } @@ -99,7 +99,7 @@ void GLRenderManager::ThreadStart(Draw::DrawContext *draw) { } void GLRenderManager::ThreadEnd() { - INFO_LOG(G3D, "ThreadEnd"); + INFO_LOG(Log::G3D, "ThreadEnd"); queueRunner_.DestroyDeviceObjects(); VLOG(" PULL: Quitting"); @@ -171,7 +171,7 @@ bool GLRenderManager::ThreadFrame() { void GLRenderManager::StopThread() { // There's not really a lot to do here anymore. - INFO_LOG(G3D, "GLRenderManager::StopThread()"); + INFO_LOG(Log::G3D, "GLRenderManager::StopThread()"); if (runCompileThread_) { runCompileThread_ = false; @@ -179,17 +179,17 @@ void GLRenderManager::StopThread() { renderThreadQueue_.push(new GLRRenderThreadTask(GLRRunType::EXIT)); pushCondVar_.notify_one(); } else { - WARN_LOG(G3D, "GL submission thread was already paused."); + WARN_LOG(Log::G3D, "GL submission thread was already paused."); } } void GLRenderManager::StartThread() { // There's not really a lot to do here anymore. - INFO_LOG(G3D, "GLRenderManager::StartThread()"); + INFO_LOG(Log::G3D, "GLRenderManager::StartThread()"); if (!runCompileThread_) { runCompileThread_ = true; } else { - INFO_LOG(G3D, "GL submission thread was already running."); + INFO_LOG(Log::G3D, "GL submission thread was already running."); } } diff --git a/Common/GPU/OpenGL/GLSLProgram.cpp b/Common/GPU/OpenGL/GLSLProgram.cpp index fc5698085e..ef71731323 100644 --- a/Common/GPU/OpenGL/GLSLProgram.cpp +++ b/Common/GPU/OpenGL/GLSLProgram.cpp @@ -23,9 +23,9 @@ bool CompileShader(const char *source, GLuint shader, const char *filename, std: GLsizei len; glGetShaderInfoLog(shader, MAX_INFO_LOG_SIZE, &len, infoLog); infoLog[len] = '\0'; - ERROR_LOG(G3D, "Error in shader compilation of %s!\n", filename); - ERROR_LOG(G3D, "Info log: %s\n", infoLog); - ERROR_LOG(G3D, "Shader source:\n%s\n", (const char *)source); + ERROR_LOG(Log::G3D, "Error in shader compilation of %s!\n", filename); + ERROR_LOG(Log::G3D, "Info log: %s\n", infoLog); + ERROR_LOG(Log::G3D, "Shader source:\n%s\n", (const char *)source); if (error_message) *error_message = infoLog; return false; @@ -46,7 +46,7 @@ GLSLProgram *glsl_create_source(const char *vshader_src, const char *fshader_src if (glsl_recompile(program, error_message)) { active_programs.insert(program); } else { - ERROR_LOG(G3D, "Failed compiling GLSL program from source strings"); + ERROR_LOG(Log::G3D, "Failed compiling GLSL program from source strings"); delete program; return 0; } @@ -105,7 +105,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) { vsh_src.reset((char *)g_VFS.ReadFile(program->vshader_filename, &sz)); } if (!program->vshader_source && !vsh_src) { - ERROR_LOG(G3D, "File missing: %s", program->vshader_filename); + ERROR_LOG(Log::G3D, "File missing: %s", program->vshader_filename); if (error_message) { *error_message = std::string("File missing: ") + program->vshader_filename; } @@ -116,7 +116,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) { fsh_src.reset((char *)g_VFS.ReadFile(program->fshader_filename, &sz)); } if (!program->fshader_source && !fsh_src) { - ERROR_LOG(G3D, "File missing: %s", program->fshader_filename); + ERROR_LOG(Log::G3D, "File missing: %s", program->fshader_filename); if (error_message) { *error_message = std::string("File missing: ") + program->fshader_filename; } @@ -150,15 +150,15 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) { if (bufLength) { char* buf = new char[bufLength + 1]; // safety glGetProgramInfoLog(prog, bufLength, NULL, buf); - INFO_LOG(G3D, "vsh: %i fsh: %i", vsh, fsh); - ERROR_LOG(G3D, "Could not link shader program (linkstatus=%i):\n %s \n", linkStatus, buf); + INFO_LOG(Log::G3D, "vsh: %i fsh: %i", vsh, fsh); + ERROR_LOG(Log::G3D, "Could not link shader program (linkstatus=%i):\n %s \n", linkStatus, buf); if (error_message) { *error_message = buf; } delete [] buf; } else { - INFO_LOG(G3D, "vsh: %i fsh: %i", vsh, fsh); - ERROR_LOG(G3D, "Could not link shader program (linkstatus=%i). No OpenGL error log was available.", linkStatus); + INFO_LOG(Log::G3D, "vsh: %i fsh: %i", vsh, fsh); + ERROR_LOG(Log::G3D, "Could not link shader program (linkstatus=%i). No OpenGL error log was available.", linkStatus); if (error_message) { *error_message = "(no error message available)"; } @@ -193,7 +193,7 @@ bool glsl_recompile(GLSLProgram *program, std::string *error_message) { program->u_sundir = glGetUniformLocation(program->program_, "u_sundir"); program->u_camerapos = glGetUniformLocation(program->program_, "u_camerapos"); - //INFO_LOG(G3D, "Shader compilation success: %s %s", + //INFO_LOG(Log::G3D, "Shader compilation success: %s %s", // program->vshader_filename, // program->fshader_filename); return true; @@ -214,7 +214,7 @@ void glsl_destroy(GLSLProgram *program) { glDeleteProgram(program->program_); active_programs.erase(program); } else { - ERROR_LOG(G3D, "Deleting null GLSL program!"); + ERROR_LOG(Log::G3D, "Deleting null GLSL program!"); } delete program; } diff --git a/Common/GPU/OpenGL/thin3d_gl.cpp b/Common/GPU/OpenGL/thin3d_gl.cpp index cf2eb4eac1..bd615d6b64 100644 --- a/Common/GPU/OpenGL/thin3d_gl.cpp +++ b/Common/GPU/OpenGL/thin3d_gl.cpp @@ -843,7 +843,7 @@ static GLuint TypeToTarget(TextureType type) { #endif case TextureType::ARRAY2D: return GL_TEXTURE_2D_ARRAY; default: - ERROR_LOG(G3D, "Bad texture type %d", (int)type); + ERROR_LOG(Log::G3D, "Bad texture type %d", (int)type); return GL_NONE; } } @@ -998,30 +998,30 @@ static void LogReadPixelsError(GLenum error) { case GL_NO_ERROR: break; case GL_INVALID_ENUM: - ERROR_LOG(G3D, "glReadPixels: GL_INVALID_ENUM"); + ERROR_LOG(Log::G3D, "glReadPixels: GL_INVALID_ENUM"); break; case GL_INVALID_VALUE: - ERROR_LOG(G3D, "glReadPixels: GL_INVALID_VALUE"); + ERROR_LOG(Log::G3D, "glReadPixels: GL_INVALID_VALUE"); break; case GL_INVALID_OPERATION: - ERROR_LOG(G3D, "glReadPixels: GL_INVALID_OPERATION"); + ERROR_LOG(Log::G3D, "glReadPixels: GL_INVALID_OPERATION"); break; case GL_INVALID_FRAMEBUFFER_OPERATION: - ERROR_LOG(G3D, "glReadPixels: GL_INVALID_FRAMEBUFFER_OPERATION"); + ERROR_LOG(Log::G3D, "glReadPixels: GL_INVALID_FRAMEBUFFER_OPERATION"); break; case GL_OUT_OF_MEMORY: - ERROR_LOG(G3D, "glReadPixels: GL_OUT_OF_MEMORY"); + ERROR_LOG(Log::G3D, "glReadPixels: GL_OUT_OF_MEMORY"); break; #ifndef USING_GLES2 case GL_STACK_UNDERFLOW: - ERROR_LOG(G3D, "glReadPixels: GL_STACK_UNDERFLOW"); + ERROR_LOG(Log::G3D, "glReadPixels: GL_STACK_UNDERFLOW"); break; case GL_STACK_OVERFLOW: - ERROR_LOG(G3D, "glReadPixels: GL_STACK_OVERFLOW"); + ERROR_LOG(Log::G3D, "glReadPixels: GL_STACK_OVERFLOW"); break; #endif default: - ERROR_LOG(G3D, "glReadPixels: %08x", error); + ERROR_LOG(Log::G3D, "glReadPixels: %08x", error); break; } } @@ -1166,15 +1166,15 @@ void OpenGLContext::UpdateBuffer(Buffer *buffer, const uint8_t *data, size_t off Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char *tag) { if (!desc.shaders.size()) { - ERROR_LOG(G3D, "Pipeline requires at least one shader"); + ERROR_LOG(Log::G3D, "Pipeline requires at least one shader"); return nullptr; } if ((uint32_t)desc.prim >= (uint32_t)Primitive::PRIMITIVE_TYPE_COUNT) { - ERROR_LOG(G3D, "Invalid primitive type"); + ERROR_LOG(Log::G3D, "Invalid primitive type"); return nullptr; } if (!desc.depthStencil || !desc.blend || !desc.raster) { - ERROR_LOG(G3D, "Incomplete prim desciption"); + ERROR_LOG(Log::G3D, "Incomplete prim desciption"); return nullptr; } @@ -1184,7 +1184,7 @@ Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc, const iter->AddRef(); pipeline->shaders.push_back(static_cast(iter)); } else { - ERROR_LOG(G3D, "ERROR: Tried to create graphics pipeline %s with a null shader module", tag ? tag : "no tag"); + ERROR_LOG(Log::G3D, "ERROR: Tried to create graphics pipeline %s with a null shader module", tag ? tag : "no tag"); delete pipeline; return nullptr; } @@ -1205,7 +1205,7 @@ Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc, const pipeline->inputLayout = (OpenGLInputLayout *)desc.inputLayout; return pipeline; } else { - ERROR_LOG(G3D, "Failed to create pipeline %s - shaders failed to link", tag ? tag : "no tag"); + ERROR_LOG(Log::G3D, "Failed to create pipeline %s - shaders failed to link", tag ? tag : "no tag"); delete pipeline; return nullptr; } @@ -1274,11 +1274,11 @@ bool OpenGLPipeline::LinkShaders(const PipelineDesc &desc) { if (shader) { linkShaders.push_back(shader); } else { - ERROR_LOG(G3D, "LinkShaders: Bad shader module"); + ERROR_LOG(Log::G3D, "LinkShaders: Bad shader module"); return false; } } else { - ERROR_LOG(G3D, "LinkShaders: Bad shader in module"); + ERROR_LOG(Log::G3D, "LinkShaders: Bad shader in module"); return false; } } @@ -1462,7 +1462,7 @@ void OpenGLInputLayout::Compile(const InputLayoutDesc &desc) { break; case DataFormat::UNDEFINED: default: - ERROR_LOG(G3D, "Thin3DGLVertexFormat: Invalid or unknown component type applied."); + ERROR_LOG(Log::G3D, "Thin3DGLVertexFormat: Invalid or unknown component type applied."); break; } diff --git a/Common/GPU/ShaderTranslation.cpp b/Common/GPU/ShaderTranslation.cpp index dc15433742..ad8c1ee76b 100644 --- a/Common/GPU/ShaderTranslation.cpp +++ b/Common/GPU/ShaderTranslation.cpp @@ -203,7 +203,7 @@ bool ConvertToVulkanGLSL(std::string *dest, TranslatedShaderMetadata *destMetada } // DUMPLOG(src.c_str()); - // INFO_LOG(SYSTEM, "---->"); + // INFO_LOG(Log::System, "---->"); // DUMPLOG(LineNumberString(out.str()).c_str()); *dest = out.str(); diff --git a/Common/GPU/Vulkan/VulkanBarrier.cpp b/Common/GPU/Vulkan/VulkanBarrier.cpp index 25e487dd6a..d262c400c6 100644 --- a/Common/GPU/Vulkan/VulkanBarrier.cpp +++ b/Common/GPU/Vulkan/VulkanBarrier.cpp @@ -8,7 +8,7 @@ VulkanBarrierBatch::~VulkanBarrierBatch() { // _dbg_assert_(imageBarriers_.empty()); if (!imageBarriers_.empty()) { - ERROR_LOG(G3D, "~VulkanBarrierBatch: %d barriers remaining", (int)imageBarriers_.size()); + ERROR_LOG(Log::G3D, "~VulkanBarrierBatch: %d barriers remaining", (int)imageBarriers_.size()); } } diff --git a/Common/GPU/Vulkan/VulkanContext.cpp b/Common/GPU/Vulkan/VulkanContext.cpp index 8421f9410b..71bd09d6c0 100644 --- a/Common/GPU/Vulkan/VulkanContext.cpp +++ b/Common/GPU/Vulkan/VulkanContext.cpp @@ -165,9 +165,9 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { } instance_extensions_enabled_.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME); extensionsLookup_.EXT_debug_utils = true; - INFO_LOG(G3D, "Vulkan debug_utils validation enabled."); + INFO_LOG(Log::G3D, "Vulkan debug_utils validation enabled."); } else { - ERROR_LOG(G3D, "Validation layer extension not available - not enabling Vulkan validation."); + ERROR_LOG(Log::G3D, "Validation layer extension not available - not enabling Vulkan validation."); flags_ &= ~VULKAN_FLAG_VALIDATE; } } @@ -192,7 +192,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { // Validate that all the instance extensions we ask for are actually available. for (auto ext : instance_extensions_enabled_) { if (!IsInstanceExtensionAvailable(ext)) - WARN_LOG(G3D, "WARNING: Does not seem that instance extension '%s' is available. Trying to proceed anyway.", ext); + WARN_LOG(Log::G3D, "WARNING: Does not seem that instance extension '%s' is available. Trying to proceed anyway.", ext); } VkApplicationInfo app_info{ VK_STRUCTURE_TYPE_APPLICATION_INFO }; @@ -222,7 +222,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { #endif if (res != VK_SUCCESS) { if (res == VK_ERROR_LAYER_NOT_PRESENT) { - WARN_LOG(G3D, "Validation on but instance layer not available - dropping layers"); + WARN_LOG(Log::G3D, "Validation on but instance layer not available - dropping layers"); // Drop the validation layers and try again. instance_layer_names_.clear(); device_layer_names_.clear(); @@ -230,9 +230,9 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { inst_info.ppEnabledLayerNames = nullptr; res = vkCreateInstance(&inst_info, nullptr, &instance_); if (res != VK_SUCCESS) - ERROR_LOG(G3D, "Failed to create instance even without validation: %d", res); + ERROR_LOG(Log::G3D, "Failed to create instance even without validation: %d", res); } else { - ERROR_LOG(G3D, "Failed to create instance : %d", res); + ERROR_LOG(Log::G3D, "Failed to create instance : %d", res); } } if (res != VK_SUCCESS) { @@ -242,7 +242,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { VulkanLoadInstanceFunctions(instance_, extensionsLookup_, vulkanApiVersion_); if (!CheckLayers(instance_layer_properties_, instance_layer_names_)) { - WARN_LOG(G3D, "CheckLayers for instance failed"); + WARN_LOG(Log::G3D, "CheckLayers for instance failed"); // init_error_ = "Failed to validate instance layers"; // return; } @@ -254,7 +254,7 @@ VkResult VulkanContext::CreateInstance(const CreateInfo &info) { res = vkEnumeratePhysicalDevices(instance_, &gpu_count, nullptr); #endif if (gpu_count <= 0) { - ERROR_LOG(G3D, "Vulkan driver found but no supported GPU is available"); + ERROR_LOG(Log::G3D, "Vulkan driver found but no supported GPU is available"); init_error_ = "No Vulkan physical devices found"; vkDestroyInstance(instance_, nullptr); instance_ = nullptr; @@ -561,11 +561,11 @@ int VulkanContext::GetBestPhysicalDevice() { void VulkanContext::ChooseDevice(int physical_device) { physical_device_ = physical_device; - INFO_LOG(G3D, "Chose physical device %d: %s", physical_device, physicalDeviceProperties_[physical_device].properties.deviceName); + INFO_LOG(Log::G3D, "Chose physical device %d: %s", physical_device, physicalDeviceProperties_[physical_device].properties.deviceName); GetDeviceLayerProperties(); if (!CheckLayers(device_layer_properties_, device_layer_names_)) { - WARN_LOG(G3D, "CheckLayers for device %d failed", physical_device); + WARN_LOG(Log::G3D, "CheckLayers for device %d failed", physical_device); } vkGetPhysicalDeviceQueueFamilyProperties(physical_devices_[physical_device_], &queue_count, nullptr); @@ -603,12 +603,12 @@ void VulkanContext::ChooseDevice(int physical_device) { // This is as good a place as any to do this. Though, we don't use this much anymore after we added // support for VMA. vkGetPhysicalDeviceMemoryProperties(physical_devices_[physical_device_], &memory_properties_); - INFO_LOG(G3D, "Memory Types (%d):", memory_properties_.memoryTypeCount); + INFO_LOG(Log::G3D, "Memory Types (%d):", memory_properties_.memoryTypeCount); for (int i = 0; i < (int)memory_properties_.memoryTypeCount; i++) { // Don't bother printing dummy memory types. if (!memory_properties_.memoryTypes[i].propertyFlags) continue; - INFO_LOG(G3D, " %d: Heap %d; Flags: %s%s%s%s ", i, memory_properties_.memoryTypes[i].heapIndex, + INFO_LOG(Log::G3D, " %d: Heap %d; Flags: %s%s%s%s ", i, memory_properties_.memoryTypes[i].heapIndex, (memory_properties_.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT) ? "DEVICE_LOCAL " : "", (memory_properties_.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) ? "HOST_VISIBLE " : "", (memory_properties_.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_CACHED_BIT) ? "HOST_CACHED " : "", @@ -671,7 +671,7 @@ bool VulkanContext::EnableInstanceExtension(const char *extension, uint32_t core VkResult VulkanContext::CreateDevice() { if (!init_error_.empty() || physical_device_ < 0) { - ERROR_LOG(G3D, "Vulkan init failed: %s", init_error_.c_str()); + ERROR_LOG(Log::G3D, "Vulkan init failed: %s", init_error_.c_str()); return VK_ERROR_INITIALIZATION_FAILED; } @@ -772,11 +772,11 @@ VkResult VulkanContext::CreateDevice() { VkResult res = vkCreateDevice(physical_devices_[physical_device_], &device_info, nullptr, &device_); if (res != VK_SUCCESS) { init_error_ = "Unable to create Vulkan device"; - ERROR_LOG(G3D, "Unable to create Vulkan device"); + ERROR_LOG(Log::G3D, "Unable to create Vulkan device"); } else { VulkanLoadDeviceFunctions(device_, extensionsLookup_, vulkanApiVersion_); } - INFO_LOG(G3D, "Vulkan Device created: %s", physicalDeviceProperties_[physical_device_].properties.deviceName); + INFO_LOG(Log::G3D, "Vulkan Device created: %s", physicalDeviceProperties_[physical_device_].properties.deviceName); // Since we successfully created a device (however we got here, might be interesting in debug), we force the choice to be visible in the menu. VulkanSetAvailable(true); @@ -847,10 +847,10 @@ VkResult VulkanContext::InitDebugUtilsCallback() { VkDebugUtilsMessengerEXT messenger; VkResult res = vkCreateDebugUtilsMessengerEXT(instance_, &callback1, nullptr, &messenger); if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "Failed to register debug callback with vkCreateDebugUtilsMessengerEXT"); + ERROR_LOG(Log::G3D, "Failed to register debug callback with vkCreateDebugUtilsMessengerEXT"); // Do error handling for VK_ERROR_OUT_OF_MEMORY } else { - INFO_LOG(G3D, "Debug callback registered with vkCreateDebugUtilsMessengerEXT."); + INFO_LOG(Log::G3D, "Debug callback registered with vkCreateDebugUtilsMessengerEXT."); utils_callbacks.push_back(messenger); } return res; @@ -859,23 +859,23 @@ VkResult VulkanContext::InitDebugUtilsCallback() { bool VulkanContext::CreateInstanceAndDevice(const CreateInfo &info) { VkResult res = CreateInstance(info); if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "Failed to create vulkan context: %s", InitError().c_str()); + ERROR_LOG(Log::G3D, "Failed to create vulkan context: %s", InitError().c_str()); VulkanSetAvailable(false); return false; } int physicalDevice = GetBestPhysicalDevice(); if (physicalDevice < 0) { - ERROR_LOG(G3D, "No usable Vulkan device found."); + ERROR_LOG(Log::G3D, "No usable Vulkan device found."); DestroyInstance(); return false; } ChooseDevice(physicalDevice); - INFO_LOG(G3D, "Creating Vulkan device (flags: %08x)", info.flags); + INFO_LOG(Log::G3D, "Creating Vulkan device (flags: %08x)", info.flags); if (CreateDevice() != VK_SUCCESS) { - INFO_LOG(G3D, "Failed to create vulkan device: %s", InitError().c_str()); + INFO_LOG(Log::G3D, "Failed to create vulkan device: %s", InitError().c_str()); DestroyInstance(); return false; } @@ -900,12 +900,12 @@ VkResult VulkanContext::InitSurface(WindowSystem winsys, void *data1, void *data VkResult VulkanContext::ReinitSurface() { if (surface_ != VK_NULL_HANDLE) { - INFO_LOG(G3D, "Destroying Vulkan surface (%d, %d)", swapChainExtent_.width, swapChainExtent_.height); + INFO_LOG(Log::G3D, "Destroying Vulkan surface (%d, %d)", swapChainExtent_.width, swapChainExtent_.height); vkDestroySurfaceKHR(instance_, surface_, nullptr); surface_ = VK_NULL_HANDLE; } - INFO_LOG(G3D, "Creating Vulkan surface for window (data1=%p data2=%p)", winsysData1_, winsysData2_); + INFO_LOG(Log::G3D, "Creating Vulkan surface for window (data1=%p data2=%p)", winsysData1_, winsysData2_); VkResult retval = VK_SUCCESS; @@ -1225,7 +1225,7 @@ bool VulkanContext::ChooseQueue() { // Generate error if could not find both a graphics and a present queue if (graphicsQueueNodeIndex == UINT32_MAX || presentQueueNodeIndex == UINT32_MAX) { - ERROR_LOG(G3D, "Could not find a graphics and a present queue"); + ERROR_LOG(Log::G3D, "Could not find a graphics and a present queue"); return false; } @@ -1249,7 +1249,7 @@ bool VulkanContext::ChooseQueue() { // the surface has no preferred format. Otherwise, at least one // supported format will be returned. if (formatCount == 0 || (formatCount == 1 && surfFormats_[0].format == VK_FORMAT_UNDEFINED)) { - INFO_LOG(G3D, "swapchain_format: Falling back to B8G8R8A8_UNORM"); + INFO_LOG(Log::G3D, "swapchain_format: Falling back to B8G8R8A8_UNORM"); swapchainFormat_ = VK_FORMAT_B8G8R8A8_UNORM; } else { swapchainFormat_ = VK_FORMAT_UNDEFINED; @@ -1266,7 +1266,7 @@ bool VulkanContext::ChooseQueue() { // Okay, take the first one then. swapchainFormat_ = surfFormats_[0].format; } - INFO_LOG(G3D, "swapchain_format: %d (/%d)", swapchainFormat_, formatCount); + INFO_LOG(Log::G3D, "swapchain_format: %d (/%d)", swapchainFormat_, formatCount); } vkGetDeviceQueue(device_, graphics_queue_family_index_, 0, &gfx_queue_); @@ -1298,14 +1298,14 @@ static std::string surface_transforms_to_string(VkSurfaceTransformFlagsKHR trans bool VulkanContext::InitSwapchain() { _assert_(physical_device_ >= 0 && physical_device_ < physical_devices_.size()); if (!surface_) { - ERROR_LOG(G3D, "VK: No surface, can't create swapchain"); + ERROR_LOG(Log::G3D, "VK: No surface, can't create swapchain"); return false; } VkResult res = vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physical_devices_[physical_device_], surface_, &surfCapabilities_); if (res == VK_ERROR_SURFACE_LOST_KHR) { // Not much to do. - ERROR_LOG(G3D, "VK: Surface lost in InitSwapchain"); + ERROR_LOG(Log::G3D, "VK: Surface lost in InitSwapchain"); return false; } _dbg_assert_(res == VK_SUCCESS); @@ -1334,7 +1334,7 @@ bool VulkanContext::InitSwapchain() { swapChainExtent_.width = clamp(currentExtent.width, surfCapabilities_.minImageExtent.width, surfCapabilities_.maxImageExtent.width); swapChainExtent_.height = clamp(currentExtent.height, surfCapabilities_.minImageExtent.height, surfCapabilities_.maxImageExtent.height); - INFO_LOG(G3D, "surfCapabilities_.current: %dx%d min: %dx%d max: %dx%d computed: %dx%d", + INFO_LOG(Log::G3D, "surfCapabilities_.current: %dx%d min: %dx%d max: %dx%d computed: %dx%d", currentExtent.width, currentExtent.height, surfCapabilities_.minImageExtent.width, surfCapabilities_.minImageExtent.height, surfCapabilities_.maxImageExtent.width, surfCapabilities_.maxImageExtent.height, @@ -1353,7 +1353,7 @@ bool VulkanContext::InitSwapchain() { availablePresentModes_.push_back(presentModes[i]); } - INFO_LOG(G3D, "Supported present modes: %s", modes.c_str()); + INFO_LOG(Log::G3D, "Supported present modes: %s", modes.c_str()); for (size_t i = 0; i < presentModeCount; i++) { bool match = false; match = match || ((flags_ & VULKAN_FLAG_PRESENT_MAILBOX) && presentModes[i] == VK_PRESENT_MODE_MAILBOX_KHR); @@ -1381,7 +1381,7 @@ bool VulkanContext::InitSwapchain() { desiredNumberOfSwapChainImages = surfCapabilities_.maxImageCount; } - INFO_LOG(G3D, "Chosen present mode: %d (%s). numSwapChainImages: %d/%d", + INFO_LOG(Log::G3D, "Chosen present mode: %d (%s). numSwapChainImages: %d/%d", swapchainPresentMode, VulkanPresentModeToString(swapchainPresentMode), desiredNumberOfSwapChainImages, surfCapabilities_.maxImageCount); @@ -1428,13 +1428,13 @@ bool VulkanContext::InitSwapchain() { } std::string preTransformStr = surface_transforms_to_string(preTransform); - INFO_LOG(G3D, "Transform supported: %s current: %s chosen: %s", supportedTransforms.c_str(), currentTransform.c_str(), preTransformStr.c_str()); + INFO_LOG(Log::G3D, "Transform supported: %s current: %s chosen: %s", supportedTransforms.c_str(), currentTransform.c_str(), preTransformStr.c_str()); if (physicalDeviceProperties_[physical_device_].properties.vendorID == VULKAN_VENDOR_IMGTEC) { u32 driverVersion = physicalDeviceProperties_[physical_device_].properties.driverVersion; // Cutoff the hack at driver version 1.386.1368 (0x00582558, see issue #15773). if (driverVersion < 0x00582558) { - INFO_LOG(G3D, "Applying PowerVR hack (rounding off the width!) driverVersion=%08x", driverVersion); + INFO_LOG(Log::G3D, "Applying PowerVR hack (rounding off the width!) driverVersion=%08x", driverVersion); // Swap chain width hack to avoid issue #11743 (PowerVR driver bug). // To keep the size consistent even with pretransform, do this after the swap. Should be fine. // This is fixed in newer PowerVR drivers but I don't know the cutoff. @@ -1444,7 +1444,7 @@ bool VulkanContext::InitSwapchain() { // This will get a bit messy. Ideally we should remove that logic from app-android.cpp // and move it here, but the OpenGL code still needs it. } else { - INFO_LOG(G3D, "PowerVR driver version new enough (%08x), not applying swapchain width hack", driverVersion); + INFO_LOG(Log::G3D, "PowerVR driver version new enough (%08x), not applying swapchain width hack", driverVersion); } } @@ -1488,10 +1488,10 @@ bool VulkanContext::InitSwapchain() { res = vkCreateSwapchainKHR(device_, &swap_chain_info, NULL, &swapchain_); if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "vkCreateSwapchainKHR failed!"); + ERROR_LOG(Log::G3D, "vkCreateSwapchainKHR failed!"); return false; } - INFO_LOG(G3D, "Created swapchain: %dx%d", swap_chain_info.imageExtent.width, swap_chain_info.imageExtent.height); + INFO_LOG(Log::G3D, "Created swapchain: %dx%d", swap_chain_info.imageExtent.width, swap_chain_info.imageExtent.height); return true; } @@ -1516,17 +1516,17 @@ void VulkanContext::PerformPendingDeletes() { void VulkanContext::DestroyDevice() { if (swapchain_) { - ERROR_LOG(G3D, "DestroyDevice: Swapchain should have been destroyed."); + ERROR_LOG(Log::G3D, "DestroyDevice: Swapchain should have been destroyed."); } if (surface_) { - ERROR_LOG(G3D, "DestroyDevice: Surface should have been destroyed."); + ERROR_LOG(Log::G3D, "DestroyDevice: Surface should have been destroyed."); } for (int i = 0; i < ARRAY_SIZE(frame_); i++) { frame_[i].profiler.Shutdown(); } - INFO_LOG(G3D, "VulkanContext::DestroyDevice (performing deletes)"); + INFO_LOG(Log::G3D, "VulkanContext::DestroyDevice (performing deletes)"); PerformPendingDeletes(); vmaDestroyAllocator(allocator_); diff --git a/Common/GPU/Vulkan/VulkanDebug.cpp b/Common/GPU/Vulkan/VulkanDebug.cpp index bc7dafb4e4..bae1ad0540 100644 --- a/Common/GPU/Vulkan/VulkanDebug.cpp +++ b/Common/GPU/Vulkan/VulkanDebug.cpp @@ -121,7 +121,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDebugUtilsCallback( count = g_errorCount[messageCode]++; } if (count == MAX_SAME_ERROR_COUNT) { - WARN_LOG(G3D, "Too many validation messages with message %d, stopping", messageCode); + WARN_LOG(Log::G3D, "Too many validation messages with message %d, stopping", messageCode); } if (count >= MAX_SAME_ERROR_COUNT) { return false; @@ -166,9 +166,9 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDebugUtilsCallback( #endif if (messageSeverity & VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT) { - ERROR_LOG(G3D, "VKDEBUG: %s", msg.c_str()); + ERROR_LOG(Log::G3D, "VKDEBUG: %s", msg.c_str()); } else { - WARN_LOG(G3D, "VKDEBUG: %s", msg.c_str()); + WARN_LOG(Log::G3D, "VKDEBUG: %s", msg.c_str()); } // false indicates that layer should not bail-out of an diff --git a/Common/GPU/Vulkan/VulkanDescSet.cpp b/Common/GPU/Vulkan/VulkanDescSet.cpp index 640f034d39..df68d67b87 100644 --- a/Common/GPU/Vulkan/VulkanDescSet.cpp +++ b/Common/GPU/Vulkan/VulkanDescSet.cpp @@ -56,7 +56,7 @@ bool VulkanDescSetPool::Allocate(VkDescriptorSet *descriptorSets, int count, con VkResult result = vkAllocateDescriptorSets(vulkan_->GetDevice(), &descAlloc, descriptorSets); if (result == VK_ERROR_FRAGMENTED_POOL || result < 0) { - WARN_LOG(G3D, "Pool %s %s - recreating", tag_, result == VK_ERROR_FRAGMENTED_POOL ? "fragmented" : "full"); + WARN_LOG(Log::G3D, "Pool %s %s - recreating", tag_, result == VK_ERROR_FRAGMENTED_POOL ? "fragmented" : "full"); // There seems to have been a spec revision. Here we should apparently recreate the descriptor pool, // so let's do that. See https://www.khronos.org/registry/vulkan/specs/1.0/man/html/vkAllocateDescriptorSets.html // Fragmentation shouldn't really happen though since we wipe the pool every frame. @@ -113,7 +113,7 @@ VkResult VulkanDescSetPool::Recreate(bool grow) { // Delete the pool if it already exists. if (descPool_ != VK_NULL_HANDLE) { - INFO_LOG(G3D, "Reallocating %s desc pool from %d to %d", tag_, prevSize, info_.maxSets); + INFO_LOG(Log::G3D, "Reallocating %s desc pool from %d to %d", tag_, prevSize, info_.maxSets); vulkan_->Delete().QueueDeleteDescriptorPool(descPool_); usage_ = 0; } diff --git a/Common/GPU/Vulkan/VulkanFrameData.cpp b/Common/GPU/Vulkan/VulkanFrameData.cpp index f2be38d298..cc7cd23016 100644 --- a/Common/GPU/Vulkan/VulkanFrameData.cpp +++ b/Common/GPU/Vulkan/VulkanFrameData.cpp @@ -5,7 +5,7 @@ #include "Common/StringUtils.h" #if 0 // def _DEBUG -#define VLOG(...) NOTICE_LOG(G3D, __VA_ARGS__) +#define VLOG(...) NOTICE_LOG(Log::G3D, __VA_ARGS__) #else #define VLOG(...) #endif @@ -90,17 +90,17 @@ void FrameData::AcquireNextImage(VulkanContext *vulkan) { case VK_SUBOPTIMAL_KHR: hasAcquired = true; // Hopefully the resize will happen shortly. Ignore - one frame might look bad or something. - WARN_LOG(G3D, "VK_SUBOPTIMAL_KHR returned - ignoring"); + WARN_LOG(Log::G3D, "VK_SUBOPTIMAL_KHR returned - ignoring"); break; case VK_ERROR_OUT_OF_DATE_KHR: case VK_TIMEOUT: case VK_NOT_READY: // We do not set hasAcquired here! - WARN_LOG(G3D, "%s returned from AcquireNextImage - processing the frame, but not presenting", VulkanResultToString(res)); + WARN_LOG(Log::G3D, "%s returned from AcquireNextImage - processing the frame, but not presenting", VulkanResultToString(res)); skipSwap = true; break; case VK_ERROR_SURFACE_LOST_KHR: - ERROR_LOG(G3D, "%s returned from AcquireNextImage - ignoring, but this better be during shutdown", VulkanResultToString(res)); + ERROR_LOG(Log::G3D, "%s returned from AcquireNextImage - ignoring, but this better be during shutdown", VulkanResultToString(res)); skipSwap = true; break; default: diff --git a/Common/GPU/Vulkan/VulkanFramebuffer.cpp b/Common/GPU/Vulkan/VulkanFramebuffer.cpp index f91c49a1aa..2ad479e875 100644 --- a/Common/GPU/Vulkan/VulkanFramebuffer.cpp +++ b/Common/GPU/Vulkan/VulkanFramebuffer.cpp @@ -117,7 +117,7 @@ VkFramebuffer VKRFramebuffer::Get(VKRRenderPass *compatibleRenderPass, RenderPas views[attachmentCount++] = color.rtView; // 2D array texture if multilayered. if (hasDepth) { if (!depth.rtView) { - WARN_LOG(G3D, "depth render type to non-depth fb: %p %p fmt=%d (%s %dx%d)", (void *)depth.image, (void *)depth.texAllLayersView, depth.format, tag_.c_str(), width, height); + WARN_LOG(Log::G3D, "depth render type to non-depth fb: %p %p fmt=%d (%s %dx%d)", (void *)depth.image, (void *)depth.texAllLayersView, depth.format, tag_.c_str(), width, height); // Will probably crash, depending on driver. } views[attachmentCount++] = depth.rtView; diff --git a/Common/GPU/Vulkan/VulkanImage.cpp b/Common/GPU/Vulkan/VulkanImage.cpp index f5406a5698..6b5e724aa6 100644 --- a/Common/GPU/Vulkan/VulkanImage.cpp +++ b/Common/GPU/Vulkan/VulkanImage.cpp @@ -40,12 +40,12 @@ static bool IsDepthStencilFormat(VkFormat format) { bool VulkanTexture::CreateDirect(int w, int h, int depth, int numMips, VkFormat format, VkImageLayout initialLayout, VkImageUsageFlags usage, VulkanBarrierBatch *barrierBatch, const VkComponentMapping *mapping) { if (w == 0 || h == 0 || numMips == 0) { - ERROR_LOG(G3D, "Can't create a zero-size VulkanTexture"); + ERROR_LOG(Log::G3D, "Can't create a zero-size VulkanTexture"); return false; } int maxDim = vulkan_->GetPhysicalDeviceProperties(0).properties.limits.maxImageDimension2D; if (w > maxDim || h > maxDim) { - ERROR_LOG(G3D, "Can't create a texture this large"); + ERROR_LOG(Log::G3D, "Can't create a texture this large"); return false; } @@ -137,7 +137,7 @@ bool VulkanTexture::CreateDirect(int w, int h, int depth, int numMips, VkFormat res = vkCreateImageView(vulkan_->GetDevice(), &view_info, NULL, &view_); if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "vkCreateImageView failed: %s. Destroying image.", VulkanResultToString(res)); + ERROR_LOG(Log::G3D, "vkCreateImageView failed: %s. Destroying image.", VulkanResultToString(res)); _assert_msg_(res == VK_ERROR_OUT_OF_HOST_MEMORY || res == VK_ERROR_OUT_OF_DEVICE_MEMORY || res == VK_ERROR_TOO_MANY_OBJECTS, "%d", (int)res); vmaDestroyImage(vulkan_->Allocator(), image_, allocation_); view_ = VK_NULL_HANDLE; diff --git a/Common/GPU/Vulkan/VulkanLoader.cpp b/Common/GPU/Vulkan/VulkanLoader.cpp index bede4348c8..e506b09e18 100644 --- a/Common/GPU/Vulkan/VulkanLoader.cpp +++ b/Common/GPU/Vulkan/VulkanLoader.cpp @@ -264,17 +264,17 @@ static VulkanLibraryHandle vulkanLibrary; bool g_vulkanAvailabilityChecked = false; bool g_vulkanMayBeAvailable = false; -#define LOAD_INSTANCE_FUNC(instance, x) x = (PFN_ ## x)vkGetInstanceProcAddr(instance, #x); if (!x) {INFO_LOG(G3D, "Missing (instance): %s", #x);} +#define LOAD_INSTANCE_FUNC(instance, x) x = (PFN_ ## x)vkGetInstanceProcAddr(instance, #x); if (!x) {INFO_LOG(Log::G3D, "Missing (instance): %s", #x);} #define LOAD_INSTANCE_FUNC_CORE(instance, x, ext_x, min_core) \ x = (PFN_ ## x)vkGetInstanceProcAddr(instance, vulkanApiVersion >= min_core ? #x : #ext_x); \ if (vulkanApiVersion >= min_core && !x) x = (PFN_ ## x)vkGetInstanceProcAddr(instance, #ext_x); \ - if (!x) {INFO_LOG(G3D, "Missing (instance): %s (%s)", #x, #ext_x);} -#define LOAD_DEVICE_FUNC(instance, x) x = (PFN_ ## x)vkGetDeviceProcAddr(instance, #x); if (!x) {INFO_LOG(G3D, "Missing (device): %s", #x);} + if (!x) {INFO_LOG(Log::G3D, "Missing (instance): %s (%s)", #x, #ext_x);} +#define LOAD_DEVICE_FUNC(instance, x) x = (PFN_ ## x)vkGetDeviceProcAddr(instance, #x); if (!x) {INFO_LOG(Log::G3D, "Missing (device): %s", #x);} #define LOAD_DEVICE_FUNC_CORE(instance, x, ext_x, min_core) \ x = (PFN_ ## x)vkGetDeviceProcAddr(instance, vulkanApiVersion >= min_core ? #x : #ext_x); \ if (vulkanApiVersion >= min_core && !x) x = (PFN_ ## x)vkGetDeviceProcAddr(instance, #ext_x); \ - if (!x) {INFO_LOG(G3D, "Missing (device): %s (%s)", #x, #ext_x);} -#define LOAD_GLOBAL_FUNC(x) x = (PFN_ ## x)dlsym(vulkanLibrary, #x); if (!x) {INFO_LOG(G3D,"Missing (global): %s", #x);} + if (!x) {INFO_LOG(Log::G3D, "Missing (device): %s (%s)", #x, #ext_x);} +#define LOAD_GLOBAL_FUNC(x) x = (PFN_ ## x)dlsym(vulkanLibrary, #x); if (!x) {INFO_LOG(Log::G3D,"Missing (global): %s", #x);} #define LOAD_GLOBAL_FUNC_LOCAL(lib, x) (PFN_ ## x)dlsym(lib, #x); @@ -337,9 +337,9 @@ static VulkanLibraryHandle VulkanLoadLibrary(std::string *errorString) { (std::string(driverPath.c_str()) + "/").c_str(), driverLibName.c_str(), (std::string(fileRedirectDir.c_str()) + "/").c_str(), nullptr); if (!lib) { - ERROR_LOG(G3D, "Failed to load custom driver with AdrenoTools ('%s')", g_Config.sCustomDriver.c_str()); + ERROR_LOG(Log::G3D, "Failed to load custom driver with AdrenoTools ('%s')", g_Config.sCustomDriver.c_str()); } else { - INFO_LOG(G3D, "Vulkan library loaded with AdrenoTools ('%s')", g_Config.sCustomDriver.c_str()); + INFO_LOG(Log::G3D, "Vulkan library loaded with AdrenoTools ('%s')", g_Config.sCustomDriver.c_str()); } } } @@ -349,7 +349,7 @@ static VulkanLibraryHandle VulkanLoadLibrary(std::string *errorString) { for (int i = 0; i < ARRAY_SIZE(so_names); i++) { lib = dlopen(so_names[i], RTLD_NOW | RTLD_LOCAL); if (lib) { - INFO_LOG(G3D, "Vulkan library loaded ('%s')", so_names[i]); + INFO_LOG(Log::G3D, "Vulkan library loaded ('%s')", so_names[i]); break; } } @@ -375,7 +375,7 @@ static void VulkanFreeLibrary(VulkanLibraryHandle &h) { #endif void VulkanSetAvailable(bool available) { - INFO_LOG(G3D, "Setting Vulkan availability to true"); + INFO_LOG(Log::G3D, "Setting Vulkan availability to true"); g_vulkanAvailabilityChecked = true; g_vulkanMayBeAvailable = available; } @@ -399,18 +399,18 @@ bool VulkanMayBeAvailable() { std::string name = System_GetProperty(SYSPROP_NAME); for (const char *blacklisted_name : device_name_blacklist) { if (!strcmp(name.c_str(), blacklisted_name)) { - INFO_LOG(G3D, "VulkanMayBeAvailable: Device blacklisted ('%s')", name.c_str()); + INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Device blacklisted ('%s')", name.c_str()); g_vulkanAvailabilityChecked = true; g_vulkanMayBeAvailable = false; return false; } } - INFO_LOG(G3D, "VulkanMayBeAvailable: Device allowed ('%s')", name.c_str()); + INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Device allowed ('%s')", name.c_str()); std::string errorStr; VulkanLibraryHandle lib = VulkanLoadLibrary(&errorStr); if (!lib) { - INFO_LOG(G3D, "Vulkan loader: Library not available: %s", errorStr.c_str()); + INFO_LOG(Log::G3D, "Vulkan loader: Library not available: %s", errorStr.c_str()); g_vulkanAvailabilityChecked = true; g_vulkanMayBeAvailable = false; return false; @@ -450,32 +450,32 @@ bool VulkanMayBeAvailable() { #endif if (!localEnumerateInstanceExtensionProperties || !localCreateInstance || !localEnumerate || !localDestroyInstance || !localGetPhysicalDeviceProperties) { - WARN_LOG(G3D, "VulkanMayBeAvailable: Function pointer missing, bailing"); + WARN_LOG(Log::G3D, "VulkanMayBeAvailable: Function pointer missing, bailing"); goto bail; } - INFO_LOG(G3D, "VulkanMayBeAvailable: Enumerating instance extensions"); + INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Enumerating instance extensions"); res = localEnumerateInstanceExtensionProperties(nullptr, &instanceExtCount, nullptr); // Maximum paranoia. if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "Enumerating VK extensions failed (%s)", VulkanResultToString(res)); + ERROR_LOG(Log::G3D, "Enumerating VK extensions failed (%s)", VulkanResultToString(res)); goto bail; } if (instanceExtCount == 0) { - ERROR_LOG(G3D, "No VK instance extensions - won't be able to present."); + ERROR_LOG(Log::G3D, "No VK instance extensions - won't be able to present."); goto bail; } - INFO_LOG(G3D, "VulkanMayBeAvailable: Instance extension count: %d", instanceExtCount); + INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Instance extension count: %d", instanceExtCount); instanceExts.resize(instanceExtCount); res = localEnumerateInstanceExtensionProperties(nullptr, &instanceExtCount, instanceExts.data()); if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "Enumerating VK extensions failed (%s)", VulkanResultToString(res)); + ERROR_LOG(Log::G3D, "Enumerating VK extensions failed (%s)", VulkanResultToString(res)); goto bail; } for (const auto &iter : instanceExts) { - INFO_LOG(G3D, "VulkanMaybeAvailable: Instance extension found: %s (%08x)", iter.extensionName, iter.specVersion); + INFO_LOG(Log::G3D, "VulkanMaybeAvailable: Instance extension found: %s (%08x)", iter.extensionName, iter.specVersion); if (platformSurfaceExtension && !strcmp(iter.extensionName, platformSurfaceExtension)) { - INFO_LOG(G3D, "VulkanMayBeAvailable: Found platform surface extension '%s'", platformSurfaceExtension); + INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Found platform surface extension '%s'", platformSurfaceExtension); instanceExtensions[ci.enabledExtensionCount++] = platformSurfaceExtension; platformSurfaceExtensionFound = true; break; @@ -486,19 +486,19 @@ bool VulkanMayBeAvailable() { } if (platformSurfaceExtension) { if (!platformSurfaceExtensionFound || !surfaceExtensionFound) { - ERROR_LOG(G3D, "Platform surface extension not found"); + ERROR_LOG(Log::G3D, "Platform surface extension not found"); goto bail; } } else { if (!surfaceExtensionFound) { - ERROR_LOG(G3D, "Surface extension not found"); + ERROR_LOG(Log::G3D, "Surface extension not found"); goto bail; } } // This can't happen unless the driver is double-reporting a surface extension. if (ci.enabledExtensionCount > 2) { - ERROR_LOG(G3D, "Unexpected number of enabled instance extensions"); + ERROR_LOG(Log::G3D, "Unexpected number of enabled instance extensions"); goto bail; } @@ -511,27 +511,27 @@ bool VulkanMayBeAvailable() { info.pEngineName = "VulkanCheckerEngine"; ci.pApplicationInfo = &info; ci.flags = 0; - INFO_LOG(G3D, "VulkanMayBeAvailable: Calling vkCreateInstance"); + INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Calling vkCreateInstance"); res = localCreateInstance(&ci, nullptr, &instance); if (res != VK_SUCCESS) { instance = nullptr; - ERROR_LOG(G3D, "VulkanMayBeAvailable: Failed to create vulkan instance (%s)", VulkanResultToString(res)); + ERROR_LOG(Log::G3D, "VulkanMayBeAvailable: Failed to create vulkan instance (%s)", VulkanResultToString(res)); goto bail; } - INFO_LOG(G3D, "VulkanMayBeAvailable: Vulkan test instance created successfully."); + INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Vulkan test instance created successfully."); res = localEnumerate(instance, &physicalDeviceCount, nullptr); if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "VulkanMayBeAvailable: Failed to count physical devices (%s)", VulkanResultToString(res)); + ERROR_LOG(Log::G3D, "VulkanMayBeAvailable: Failed to count physical devices (%s)", VulkanResultToString(res)); goto bail; } if (physicalDeviceCount == 0) { - ERROR_LOG(G3D, "VulkanMayBeAvailable: No physical Vulkan devices (count = 0)."); + ERROR_LOG(Log::G3D, "VulkanMayBeAvailable: No physical Vulkan devices (count = 0)."); goto bail; } devices.resize(physicalDeviceCount); res = localEnumerate(instance, &physicalDeviceCount, devices.data()); if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "VulkanMayBeAvailable: Failed to enumerate physical devices (%s)", VulkanResultToString(res)); + ERROR_LOG(Log::G3D, "VulkanMayBeAvailable: Failed to enumerate physical devices (%s)", VulkanResultToString(res)); goto bail; } anyGood = false; @@ -543,34 +543,34 @@ bool VulkanMayBeAvailable() { case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: anyGood = true; - INFO_LOG(G3D, "VulkanMayBeAvailable: Eligible device found: '%s'", props.deviceName); + INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Eligible device found: '%s'", props.deviceName); break; default: - INFO_LOG(G3D, "VulkanMayBeAvailable: Ineligible device found and ignored: '%s'", props.deviceName); + INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Ineligible device found and ignored: '%s'", props.deviceName); break; } // TODO: Should also check queuefamilyproperties for a GRAPHICS queue family? Oh well. } if (!anyGood) { - WARN_LOG(G3D, "VulkanMayBeAvailable: Found Vulkan API, but no good Vulkan device!"); + WARN_LOG(Log::G3D, "VulkanMayBeAvailable: Found Vulkan API, but no good Vulkan device!"); g_vulkanMayBeAvailable = false; } else { - INFO_LOG(G3D, "VulkanMayBeAvailable: Found working Vulkan API!"); + INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Found working Vulkan API!"); g_vulkanMayBeAvailable = true; } bail: g_vulkanAvailabilityChecked = true; if (instance) { - INFO_LOG(G3D, "VulkanMayBeAvailable: Destroying instance"); + INFO_LOG(Log::G3D, "VulkanMayBeAvailable: Destroying instance"); localDestroyInstance(instance, nullptr); } if (lib) { VulkanFreeLibrary(lib); } if (!g_vulkanMayBeAvailable) { - WARN_LOG(G3D, "Vulkan with working device not detected."); + WARN_LOG(Log::G3D, "Vulkan with working device not detected."); } return g_vulkanMayBeAvailable; #endif @@ -578,7 +578,7 @@ bail: bool VulkanLoad(std::string *errorStr) { #if PPSSPP_PLATFORM(IOS_APP_STORE) - INFO_LOG(G3D, "iOS: Vulkan doesn't need loading"); + INFO_LOG(Log::G3D, "iOS: Vulkan doesn't need loading"); return true; #else @@ -598,12 +598,12 @@ bool VulkanLoad(std::string *errorStr) { LOAD_GLOBAL_FUNC(vkEnumerateInstanceLayerProperties); if (vkCreateInstance && vkGetInstanceProcAddr && vkGetDeviceProcAddr && vkEnumerateInstanceExtensionProperties && vkEnumerateInstanceLayerProperties) { - INFO_LOG(G3D, "VulkanLoad: Base functions loaded."); + INFO_LOG(Log::G3D, "VulkanLoad: Base functions loaded."); // NOTE: It's ok if vkEnumerateInstanceVersion is missing. return true; } else { *errorStr = "Failed to load Vulkan base functions"; - ERROR_LOG(G3D, "VulkanLoad: %s", errorStr->c_str()); + ERROR_LOG(Log::G3D, "VulkanLoad: %s", errorStr->c_str()); VulkanFreeLibrary(vulkanLibrary); return false; } @@ -678,7 +678,7 @@ void VulkanLoadInstanceFunctions(VkInstance instance, const VulkanExtensions &en LOAD_INSTANCE_FUNC(instance, vkSetDebugUtilsObjectTagEXT); } - INFO_LOG(G3D, "Vulkan instance functions loaded."); + INFO_LOG(Log::G3D, "Vulkan instance functions loaded."); #endif } @@ -687,7 +687,7 @@ void VulkanLoadInstanceFunctions(VkInstance instance, const VulkanExtensions &en // good for multi-device - not likely we'll ever try that anyway though. void VulkanLoadDeviceFunctions(VkDevice device, const VulkanExtensions &enabledExtensions, uint32_t vulkanApiVersion) { #if !PPSSPP_PLATFORM(IOS_APP_STORE) - INFO_LOG(G3D, "Vulkan device functions loaded."); + INFO_LOG(Log::G3D, "Vulkan device functions loaded."); LOAD_DEVICE_FUNC(device, vkQueueSubmit); LOAD_DEVICE_FUNC(device, vkQueueWaitIdle); diff --git a/Common/GPU/Vulkan/VulkanMemory.cpp b/Common/GPU/Vulkan/VulkanMemory.cpp index 83588c9179..146b4eba15 100644 --- a/Common/GPU/Vulkan/VulkanMemory.cpp +++ b/Common/GPU/Vulkan/VulkanMemory.cpp @@ -121,7 +121,7 @@ void VulkanPushPool::BeginFrame() { size_t size = blocks_.back().size; blocks_.back().Destroy(vulkan_); blocks_.pop_back(); - DEBUG_LOG(G3D, "%s: Garbage collected block of size %s in %0.2f ms", name_, NiceSizeFormat(size).c_str(), time_now_d() - start); + DEBUG_LOG(Log::G3D, "%s: Garbage collected block of size %s in %0.2f ms", name_, NiceSizeFormat(size).c_str(), time_now_d() - start); } } @@ -153,7 +153,7 @@ void VulkanPushPool::NextBlock(VkDeviceSize allocationSize) { blocks_.back().used = allocationSize; blocks_.back().lastUsed = time_now_d(); // curBlockIndex_ is already set correctly here. - DEBUG_LOG(G3D, "%s: Created new block of size %s in %0.2f ms", name_, NiceSizeFormat(newBlockSize).c_str(), 1000.0 * (time_now_d() - start)); + DEBUG_LOG(Log::G3D, "%s: Created new block of size %s in %0.2f ms", name_, NiceSizeFormat(newBlockSize).c_str(), 1000.0 * (time_now_d() - start)); } size_t VulkanPushPool::GetUsedThisFrame() const { diff --git a/Common/GPU/Vulkan/VulkanProfiler.cpp b/Common/GPU/Vulkan/VulkanProfiler.cpp index a31952b1bc..60f9805426 100644 --- a/Common/GPU/Vulkan/VulkanProfiler.cpp +++ b/Common/GPU/Vulkan/VulkanProfiler.cpp @@ -50,13 +50,13 @@ void VulkanProfiler::BeginFrame(VulkanContext *vulkan, VkCommandBuffer firstComm static const char * const indent[4] = { "", " ", " ", " " }; if (!scopes_.empty()) { - INFO_LOG(G3D, "Profiling events this frame:"); + INFO_LOG(Log::G3D, "Profiling events this frame:"); } // Log it all out. for (auto &scope : scopes_) { if (scope.endQueryId == -1) { - WARN_LOG(G3D, "Unclosed scope: %s", scope.name); + WARN_LOG(Log::G3D, "Unclosed scope: %s", scope.name); continue; } uint64_t startTime = results[scope.startQueryId]; @@ -66,7 +66,7 @@ void VulkanProfiler::BeginFrame(VulkanContext *vulkan, VkCommandBuffer firstComm double milliseconds = (double)delta * timestampConversionFactor; - INFO_LOG(G3D, "%s%s (%0.3f ms)", indent[scope.level & 3], scope.name, milliseconds); + INFO_LOG(Log::G3D, "%s%s (%0.3f ms)", indent[scope.level & 3], scope.name, milliseconds); } scopes_.clear(); diff --git a/Common/GPU/Vulkan/VulkanQueueRunner.cpp b/Common/GPU/Vulkan/VulkanQueueRunner.cpp index d97800ef76..ad6f31f409 100644 --- a/Common/GPU/Vulkan/VulkanQueueRunner.cpp +++ b/Common/GPU/Vulkan/VulkanQueueRunner.cpp @@ -44,7 +44,7 @@ RenderPassType MergeRPTypes(RenderPassType a, RenderPassType b) { } void VulkanQueueRunner::CreateDeviceObjects() { - INFO_LOG(G3D, "VulkanQueueRunner::CreateDeviceObjects"); + INFO_LOG(Log::G3D, "VulkanQueueRunner::CreateDeviceObjects"); RPKey key{ VKRRenderPassLoadAction::CLEAR, VKRRenderPassLoadAction::CLEAR, VKRRenderPassLoadAction::CLEAR, @@ -56,19 +56,19 @@ void VulkanQueueRunner::CreateDeviceObjects() { // Just to check whether it makes sense to split some of these. drawidx is way bigger than the others... // We should probably just move to variable-size data in a raw buffer anyway... VkRenderData rd; - INFO_LOG(G3D, "sizeof(pipeline): %d", (int)sizeof(rd.pipeline)); - INFO_LOG(G3D, "sizeof(draw): %d", (int)sizeof(rd.draw)); - INFO_LOG(G3D, "sizeof(drawidx): %d", (int)sizeof(rd.drawIndexed)); - INFO_LOG(G3D, "sizeof(clear): %d", (int)sizeof(rd.clear)); - INFO_LOG(G3D, "sizeof(viewport): %d", (int)sizeof(rd.viewport)); - INFO_LOG(G3D, "sizeof(scissor): %d", (int)sizeof(rd.scissor)); - INFO_LOG(G3D, "sizeof(blendColor): %d", (int)sizeof(rd.blendColor)); - INFO_LOG(G3D, "sizeof(push): %d", (int)sizeof(rd.push)); + INFO_LOG(Log::G3D, "sizeof(pipeline): %d", (int)sizeof(rd.pipeline)); + INFO_LOG(Log::G3D, "sizeof(draw): %d", (int)sizeof(rd.draw)); + INFO_LOG(Log::G3D, "sizeof(drawidx): %d", (int)sizeof(rd.drawIndexed)); + INFO_LOG(Log::G3D, "sizeof(clear): %d", (int)sizeof(rd.clear)); + INFO_LOG(Log::G3D, "sizeof(viewport): %d", (int)sizeof(rd.viewport)); + INFO_LOG(Log::G3D, "sizeof(scissor): %d", (int)sizeof(rd.scissor)); + INFO_LOG(Log::G3D, "sizeof(blendColor): %d", (int)sizeof(rd.blendColor)); + INFO_LOG(Log::G3D, "sizeof(push): %d", (int)sizeof(rd.push)); #endif } void VulkanQueueRunner::DestroyDeviceObjects() { - INFO_LOG(G3D, "VulkanQueueRunner::DestroyDeviceObjects"); + INFO_LOG(Log::G3D, "VulkanQueueRunner::DestroyDeviceObjects"); syncReadback_.Destroy(vulkan_); @@ -87,7 +87,7 @@ bool VulkanQueueRunner::CreateSwapchain(VkCommandBuffer cmdInit, VulkanBarrierBa VkImage *swapchainImages = new VkImage[swapchainImageCount_]; res = vkGetSwapchainImagesKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), &swapchainImageCount_, swapchainImages); if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "vkGetSwapchainImagesKHR failed"); + ERROR_LOG(Log::G3D, "vkGetSwapchainImagesKHR failed"); delete[] swapchainImages; return false; } @@ -245,7 +245,7 @@ void VulkanQueueRunner::DestroyBackBuffers() { } framebuffers_.clear(); - INFO_LOG(G3D, "Backbuffers destroyed"); + INFO_LOG(Log::G3D, "Backbuffers destroyed"); } // Self-dependency: https://github.com/gpuweb/gpuweb/issues/442#issuecomment-547604827 @@ -802,7 +802,7 @@ void VulkanQueueRunner::ApplyRenderPassMerge(std::vector &steps) { } void VulkanQueueRunner::LogSteps(const std::vector &steps, bool verbose) { - INFO_LOG(G3D, "=================== FRAME ===================="); + INFO_LOG(Log::G3D, "=================== FRAME ===================="); for (size_t i = 0; i < steps.size(); i++) { const VKRStep &step = *steps[i]; switch (step.stepType) { @@ -822,11 +822,11 @@ void VulkanQueueRunner::LogSteps(const std::vector &steps, bool verbo LogReadbackImage(step); break; case VKRStepType::RENDER_SKIP: - INFO_LOG(G3D, "(skipped render pass)"); + INFO_LOG(Log::G3D, "(skipped render pass)"); break; } } - INFO_LOG(G3D, "------------------- SUBMIT ------------------"); + INFO_LOG(Log::G3D, "------------------- SUBMIT ------------------"); } const char *RenderPassActionName(VKRRenderPassLoadAction a) { @@ -861,47 +861,47 @@ void VulkanQueueRunner::LogRenderPass(const VKRStep &pass, bool verbose) { int w = r.framebuffer ? r.framebuffer->width : vulkan_->GetBackbufferWidth(); int h = r.framebuffer ? r.framebuffer->height : vulkan_->GetBackbufferHeight(); - INFO_LOG(G3D, "RENDER %s Begin(%s, draws: %d, %dx%d, %s, %s, %s)", pass.tag, framebuf, r.numDraws, w, h, RenderPassActionName(r.colorLoad), RenderPassActionName(r.depthLoad), RenderPassActionName(r.stencilLoad)); + INFO_LOG(Log::G3D, "RENDER %s Begin(%s, draws: %d, %dx%d, %s, %s, %s)", pass.tag, framebuf, r.numDraws, w, h, RenderPassActionName(r.colorLoad), RenderPassActionName(r.depthLoad), RenderPassActionName(r.stencilLoad)); // TODO: Log these in detail. for (int i = 0; i < (int)pass.preTransitions.size(); i++) { - INFO_LOG(G3D, " PRETRANSITION: %s %s -> %s", pass.preTransitions[i].fb->Tag(), AspectToString(pass.preTransitions[i].aspect), ImageLayoutToString(pass.preTransitions[i].targetLayout)); + INFO_LOG(Log::G3D, " PRETRANSITION: %s %s -> %s", pass.preTransitions[i].fb->Tag(), AspectToString(pass.preTransitions[i].aspect), ImageLayoutToString(pass.preTransitions[i].targetLayout)); } if (verbose) { for (auto &cmd : pass.commands) { switch (cmd.cmd) { case VKRRenderCommand::REMOVED: - INFO_LOG(G3D, " (Removed)"); + INFO_LOG(Log::G3D, " (Removed)"); break; case VKRRenderCommand::BIND_GRAPHICS_PIPELINE: - INFO_LOG(G3D, " BindGraphicsPipeline(%x)", (int)(intptr_t)cmd.graphics_pipeline.pipeline); + INFO_LOG(Log::G3D, " BindGraphicsPipeline(%x)", (int)(intptr_t)cmd.graphics_pipeline.pipeline); break; case VKRRenderCommand::BLEND: - INFO_LOG(G3D, " BlendColor(%08x)", cmd.blendColor.color); + INFO_LOG(Log::G3D, " BlendColor(%08x)", cmd.blendColor.color); break; case VKRRenderCommand::CLEAR: - INFO_LOG(G3D, " Clear"); + INFO_LOG(Log::G3D, " Clear"); break; case VKRRenderCommand::DRAW: - INFO_LOG(G3D, " Draw(%d)", cmd.draw.count); + INFO_LOG(Log::G3D, " Draw(%d)", cmd.draw.count); break; case VKRRenderCommand::DRAW_INDEXED: - INFO_LOG(G3D, " DrawIndexed(%d)", cmd.drawIndexed.count); + INFO_LOG(Log::G3D, " DrawIndexed(%d)", cmd.drawIndexed.count); break; case VKRRenderCommand::SCISSOR: - INFO_LOG(G3D, " Scissor(%d, %d, %d, %d)", (int)cmd.scissor.scissor.offset.x, (int)cmd.scissor.scissor.offset.y, (int)cmd.scissor.scissor.extent.width, (int)cmd.scissor.scissor.extent.height); + INFO_LOG(Log::G3D, " Scissor(%d, %d, %d, %d)", (int)cmd.scissor.scissor.offset.x, (int)cmd.scissor.scissor.offset.y, (int)cmd.scissor.scissor.extent.width, (int)cmd.scissor.scissor.extent.height); break; case VKRRenderCommand::STENCIL: - INFO_LOG(G3D, " Stencil(ref=%d, compare=%d, write=%d)", cmd.stencil.stencilRef, cmd.stencil.stencilCompareMask, cmd.stencil.stencilWriteMask); + INFO_LOG(Log::G3D, " Stencil(ref=%d, compare=%d, write=%d)", cmd.stencil.stencilRef, cmd.stencil.stencilCompareMask, cmd.stencil.stencilWriteMask); break; case VKRRenderCommand::VIEWPORT: - INFO_LOG(G3D, " Viewport(%f, %f, %f, %f, %f, %f)", cmd.viewport.vp.x, cmd.viewport.vp.y, cmd.viewport.vp.width, cmd.viewport.vp.height, cmd.viewport.vp.minDepth, cmd.viewport.vp.maxDepth); + INFO_LOG(Log::G3D, " Viewport(%f, %f, %f, %f, %f, %f)", cmd.viewport.vp.x, cmd.viewport.vp.y, cmd.viewport.vp.width, cmd.viewport.vp.height, cmd.viewport.vp.minDepth, cmd.viewport.vp.maxDepth); break; case VKRRenderCommand::PUSH_CONSTANTS: - INFO_LOG(G3D, " PushConstants(%d)", cmd.push.size); + INFO_LOG(Log::G3D, " PushConstants(%d)", cmd.push.size); break; case VKRRenderCommand::DEBUG_ANNOTATION: - INFO_LOG(G3D, " DebugAnnotation(%s)", cmd.debugAnnotation.annotation); + INFO_LOG(Log::G3D, " DebugAnnotation(%s)", cmd.debugAnnotation.annotation); break; case VKRRenderCommand::NUM_RENDER_COMMANDS: @@ -910,24 +910,24 @@ void VulkanQueueRunner::LogRenderPass(const VKRStep &pass, bool verbose) { } } - INFO_LOG(G3D, " Final: %s %s", ImageLayoutToString(pass.render.finalColorLayout), ImageLayoutToString(pass.render.finalDepthStencilLayout)); - INFO_LOG(G3D, "RENDER End(%s) - %d commands executed", framebuf, (int)pass.commands.size()); + INFO_LOG(Log::G3D, " Final: %s %s", ImageLayoutToString(pass.render.finalColorLayout), ImageLayoutToString(pass.render.finalDepthStencilLayout)); + INFO_LOG(Log::G3D, "RENDER End(%s) - %d commands executed", framebuf, (int)pass.commands.size()); } void VulkanQueueRunner::LogCopy(const VKRStep &step) { - INFO_LOG(G3D, "%s", StepToString(vulkan_, step).c_str()); + INFO_LOG(Log::G3D, "%s", StepToString(vulkan_, step).c_str()); } void VulkanQueueRunner::LogBlit(const VKRStep &step) { - INFO_LOG(G3D, "%s", StepToString(vulkan_, step).c_str()); + INFO_LOG(Log::G3D, "%s", StepToString(vulkan_, step).c_str()); } void VulkanQueueRunner::LogReadback(const VKRStep &step) { - INFO_LOG(G3D, "%s", StepToString(vulkan_, step).c_str()); + INFO_LOG(Log::G3D, "%s", StepToString(vulkan_, step).c_str()); } void VulkanQueueRunner::LogReadbackImage(const VKRStep &step) { - INFO_LOG(G3D, "%s", StepToString(vulkan_, step).c_str()); + INFO_LOG(Log::G3D, "%s", StepToString(vulkan_, step).c_str()); } void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer cmd, int curFrame, QueueProfileContext &profile) { @@ -1214,7 +1214,7 @@ void VulkanQueueRunner::PerformRenderPass(const VKRStep &step, VkCommandBuffer c break; default: - ERROR_LOG(G3D, "Unimpl queue command"); + ERROR_LOG(Log::G3D, "Unimpl queue command"); break; } } @@ -1777,7 +1777,7 @@ bool VulkanQueueRunner::CopyReadbackBuffer(FrameData &frameData, VKRFramebuffer VkResult res = vmaMapMemory(vulkan_->Allocator(), readback->allocation, &mappedData); if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "CopyReadbackBuffer: vkMapMemory failed! result=%d", (int)res); + ERROR_LOG(Log::G3D, "CopyReadbackBuffer: vkMapMemory failed! result=%d", (int)res); return false; } @@ -1805,7 +1805,7 @@ bool VulkanQueueRunner::CopyReadbackBuffer(FrameData &frameData, VKRFramebuffer ConvertToD16(pixels, (const uint8_t *)mappedData, pixelStride, width, width, height, srcFormat); } else { // TODO: Maybe a depth conversion or something? - ERROR_LOG(G3D, "CopyReadbackBuffer: Unknown format"); + ERROR_LOG(Log::G3D, "CopyReadbackBuffer: Unknown format"); _assert_msg_(false, "CopyReadbackBuffer: Unknown src format %d", (int)srcFormat); } diff --git a/Common/GPU/Vulkan/VulkanRenderManager.cpp b/Common/GPU/Vulkan/VulkanRenderManager.cpp index 902381f752..cd74de27a1 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.cpp +++ b/Common/GPU/Vulkan/VulkanRenderManager.cpp @@ -17,7 +17,7 @@ #include "Common/VR/PPSSPPVR.h" #if 0 // def _DEBUG -#define VLOG(...) NOTICE_LOG(G3D, __VA_ARGS__) +#define VLOG(...) NOTICE_LOG(Log::G3D, __VA_ARGS__) #else #define VLOG(...) #endif @@ -46,7 +46,7 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR // Sanity check. // Seen in crash reports from PowerVR GE8320, presumably we failed creating some shader modules. if (!desc->vertexShader || !desc->fragmentShader) { - ERROR_LOG(G3D, "Failed creating graphics pipeline - missing vs/fs shader module pointers!"); + ERROR_LOG(Log::G3D, "Failed creating graphics pipeline - missing vs/fs shader module pointers!"); pipeline[(size_t)rpType]->Post(VK_NULL_HANDLE); return false; } @@ -57,13 +57,13 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR VkShaderModule gs = desc->geometryShader ? desc->geometryShader->BlockUntilReady() : VK_NULL_HANDLE; if (!vs || !fs || (!gs && desc->geometryShader)) { - ERROR_LOG(G3D, "Failed creating graphics pipeline - missing shader modules"); + ERROR_LOG(Log::G3D, "Failed creating graphics pipeline - missing shader modules"); pipeline[(size_t)rpType]->Post(VK_NULL_HANDLE); return false; } if (!compatibleRenderPass) { - ERROR_LOG(G3D, "Failed creating graphics pipeline - compatible render pass was nullptr"); + ERROR_LOG(Log::G3D, "Failed creating graphics pipeline - compatible render pass was nullptr"); pipeline[(size_t)rpType]->Post(VK_NULL_HANDLE); return false; } @@ -130,10 +130,10 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR double taken_ms = (now - start) * 1000.0; if (taken_ms < 0.1) { - DEBUG_LOG(G3D, "Pipeline (x/%d) time on %s: %0.2f ms, %0.2f ms since scheduling (fast) rpType: %04x sampleBits: %d (%s)", + DEBUG_LOG(Log::G3D, "Pipeline (x/%d) time on %s: %0.2f ms, %0.2f ms since scheduling (fast) rpType: %04x sampleBits: %d (%s)", countToCompile, GetCurrentThreadName(), taken_ms, taken_ms_since_scheduling, (u32)rpType, (u32)sampleCount, tag_.c_str()); } else { - INFO_LOG(G3D, "Pipeline (x/%d) time on %s: %0.2f ms, %0.2f ms since scheduling rpType: %04x sampleBits: %d (%s)", + INFO_LOG(Log::G3D, "Pipeline (x/%d) time on %s: %0.2f ms, %0.2f ms since scheduling rpType: %04x sampleBits: %d (%s)", countToCompile, GetCurrentThreadName(), taken_ms, taken_ms_since_scheduling, (u32)rpType, (u32)sampleCount, tag_.c_str()); } @@ -144,12 +144,12 @@ bool VKRGraphicsPipeline::Create(VulkanContext *vulkan, VkRenderPass compatibleR // // At least create a null placeholder to avoid creating over and over if something is broken. pipeline[(size_t)rpType]->Post(VK_NULL_HANDLE); - ERROR_LOG(G3D, "Failed creating graphics pipeline! VK_INCOMPLETE"); + ERROR_LOG(Log::G3D, "Failed creating graphics pipeline! VK_INCOMPLETE"); LogCreationFailure(); success = false; } else if (result != VK_SUCCESS) { pipeline[(size_t)rpType]->Post(VK_NULL_HANDLE); - ERROR_LOG(G3D, "Failed creating graphics pipeline! result='%s'", VulkanResultToString(result)); + ERROR_LOG(Log::G3D, "Failed creating graphics pipeline! result='%s'", VulkanResultToString(result)); LogCreationFailure(); success = false; } else { @@ -228,13 +228,13 @@ u32 VKRGraphicsPipeline::GetVariantsBitmask() const { } void VKRGraphicsPipeline::LogCreationFailure() const { - ERROR_LOG(G3D, "vs: %s\n[END VS]", desc->vertexShaderSource.c_str()); - ERROR_LOG(G3D, "fs: %s\n[END FS]", desc->fragmentShaderSource.c_str()); + ERROR_LOG(Log::G3D, "vs: %s\n[END VS]", desc->vertexShaderSource.c_str()); + ERROR_LOG(Log::G3D, "fs: %s\n[END FS]", desc->fragmentShaderSource.c_str()); if (desc->geometryShader) { - ERROR_LOG(G3D, "gs: %s\n[END GS]", desc->geometryShaderSource.c_str()); + ERROR_LOG(Log::G3D, "gs: %s\n[END GS]", desc->geometryShaderSource.c_str()); } // TODO: Maybe log various other state? - ERROR_LOG(G3D, "======== END OF PIPELINE =========="); + ERROR_LOG(Log::G3D, "======== END OF PIPELINE =========="); } struct SinglePipelineTask { @@ -310,7 +310,7 @@ VulkanRenderManager::VulkanRenderManager(VulkanContext *vulkan, bool useThread, bool VulkanRenderManager::CreateBackbuffers() { if (!vulkan_->GetSwapchain()) { - ERROR_LOG(G3D, "No swapchain - can't create backbuffers"); + ERROR_LOG(Log::G3D, "No swapchain - can't create backbuffers"); return false; } @@ -328,7 +328,7 @@ bool VulkanRenderManager::CreateBackbuffers() { } if (newInflightFrames_ != -1) { - INFO_LOG(G3D, "Updating inflight frames to %d", newInflightFrames_); + INFO_LOG(Log::G3D, "Updating inflight frames to %d", newInflightFrames_); vulkan_->UpdateInflightFrames(newInflightFrames_); newInflightFrames_ = -1; } @@ -356,14 +356,14 @@ void VulkanRenderManager::StartThreads() { runCompileThread_ = true; // For controlling the compiler thread's exit if (useRenderThread_) { - INFO_LOG(G3D, "Starting Vulkan submission thread"); + INFO_LOG(Log::G3D, "Starting Vulkan submission thread"); renderThread_ = std::thread(&VulkanRenderManager::RenderThreadFunc, this); } - INFO_LOG(G3D, "Starting Vulkan compiler thread"); + INFO_LOG(Log::G3D, "Starting Vulkan compiler thread"); compileThread_ = std::thread(&VulkanRenderManager::CompileThreadFunc, this); if (measurePresentTime_ && vulkan_->Extensions().KHR_present_wait && vulkan_->GetPresentMode() == VK_PRESENT_MODE_FIFO_KHR) { - INFO_LOG(G3D, "Starting Vulkan present wait thread"); + INFO_LOG(Log::G3D, "Starting Vulkan present wait thread"); presentWaitThread_ = std::thread(&VulkanRenderManager::PresentWaitThreadFunc, this); } } @@ -385,7 +385,7 @@ void VulkanRenderManager::StopThreads() { pushCondVar_.notify_one(); // Once the render thread encounters the above exit task, it'll exit. renderThread_.join(); - INFO_LOG(G3D, "Vulkan submission thread joined. Frame=%d", vulkan_->GetCurFrame()); + INFO_LOG(Log::G3D, "Vulkan submission thread joined. Frame=%d", vulkan_->GetCurFrame()); } for (int i = 0; i < vulkan_->GetInflightFrames(); i++) { @@ -406,7 +406,7 @@ void VulkanRenderManager::StopThreads() { presentWaitThread_.join(); } - INFO_LOG(G3D, "Vulkan compiler thread joined. Now wait for any straggling compile tasks."); + INFO_LOG(Log::G3D, "Vulkan compiler thread joined. Now wait for any straggling compile tasks."); CreateMultiPipelinesTask::WaitForAll(); { @@ -431,7 +431,7 @@ void VulkanRenderManager::CheckNothingPending() { } VulkanRenderManager::~VulkanRenderManager() { - INFO_LOG(G3D, "VulkanRenderManager destructor"); + INFO_LOG(Log::G3D, "VulkanRenderManager destructor"); { std::unique_lock lock(compileMutex_); @@ -507,7 +507,7 @@ void VulkanRenderManager::CompileThreadFunc() { auto &shaders = iter.first; auto &entries = iter.second; - // NOTICE_LOG(G3D, "For this shader pair, we have %d pipelines to create", (int)entries.size()); + // NOTICE_LOG(Log::G3D, "For this shader pair, we have %d pipelines to create", (int)entries.size()); Task *task = new CreateMultiPipelinesTask(vulkan_, entries); g_threadManager.EnqueueTask(task); @@ -582,7 +582,7 @@ void VulkanRenderManager::PresentWaitThreadFunc() { } #endif - INFO_LOG(G3D, "Leaving PresentWaitThreadFunc()"); + INFO_LOG(Log::G3D, "Leaving PresentWaitThreadFunc()"); } void VulkanRenderManager::PollPresentTiming() { @@ -768,12 +768,12 @@ void VulkanRenderManager::ReportBadStateForDraw() { std::string str = VulkanQueueRunner::StepToString(vulkan_, *curRenderStep_); truncate_cpy(cause2, str.c_str()); } - ERROR_LOG_REPORT_ONCE(baddraw, G3D, "Can't draw: %s%s. Step count: %d", cause1, cause2, (int)steps_.size()); + ERROR_LOG_REPORT_ONCE(baddraw, Log::G3D, "Can't draw: %s%s. Step count: %d", cause1, cause2, (int)steps_.size()); } VKRGraphicsPipeline *VulkanRenderManager::CreateGraphicsPipeline(VKRGraphicsPipelineDesc *desc, PipelineFlags pipelineFlags, uint32_t variantBitmask, VkSampleCountFlagBits sampleCount, bool cacheLoad, const char *tag) { if (!desc->vertexShader || !desc->fragmentShader) { - ERROR_LOG(G3D, "Can't create graphics pipeline with missing vs/ps: %p %p", desc->vertexShader, desc->fragmentShader); + ERROR_LOG(Log::G3D, "Can't create graphics pipeline with missing vs/ps: %p %p", desc->vertexShader, desc->fragmentShader); return nullptr; } @@ -785,7 +785,7 @@ VKRGraphicsPipeline *VulkanRenderManager::CreateGraphicsPipeline(VKRGraphicsPipe pipelinesToCheck_.push_back(pipeline); } else { if (!variantBitmask) { - WARN_LOG(G3D, "WARNING: Will not compile any variants of pipeline, not in renderpass and empty variantBitmask"); + WARN_LOG(Log::G3D, "WARNING: Will not compile any variants of pipeline, not in renderpass and empty variantBitmask"); } // Presumably we're in initialization, loading the shader cache. // Look at variantBitmask to see what variants we should queue up. @@ -803,12 +803,12 @@ VKRGraphicsPipeline *VulkanRenderManager::CreateGraphicsPipeline(VKRGraphicsPipe // Sanity check - don't compile incompatible types (could be caused by corrupt caches, changes in data structures, etc). if ((pipelineFlags & PipelineFlags::USES_DEPTH_STENCIL) && !RenderPassTypeHasDepth(rpType)) { - WARN_LOG(G3D, "Not compiling pipeline that requires depth, for non depth renderpass type"); + WARN_LOG(Log::G3D, "Not compiling pipeline that requires depth, for non depth renderpass type"); continue; } // Shouldn't hit this, these should have been filtered elsewhere. However, still a good check to do. if (sampleCount == VK_SAMPLE_COUNT_1_BIT && RenderPassTypeHasMultisample(rpType)) { - WARN_LOG(G3D, "Not compiling single sample pipeline for a multisampled render pass type"); + WARN_LOG(Log::G3D, "Not compiling single sample pipeline for a multisampled render pass type"); continue; } @@ -841,7 +841,7 @@ void VulkanRenderManager::EndCurRenderStep() { RenderPassType rpType = depthStencil ? RenderPassType::HAS_DEPTH : RenderPassType::DEFAULT; if (curRenderStep_->render.framebuffer && (rpType & RenderPassType::HAS_DEPTH) && !curRenderStep_->render.framebuffer->HasDepth()) { - WARN_LOG(G3D, "Trying to render with a depth-writing pipeline to a framebuffer without depth: %s", curRenderStep_->render.framebuffer->Tag()); + WARN_LOG(Log::G3D, "Trying to render with a depth-writing pipeline to a framebuffer without depth: %s", curRenderStep_->render.framebuffer->Tag()); rpType = RenderPassType::DEFAULT; } @@ -1089,7 +1089,7 @@ bool VulkanRenderManager::CopyFramebufferToMemory(VKRFramebuffer *src, VkImageAs } else { // Backbuffer. if (!(vulkan_->GetSurfaceCapabilities().supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_SRC_BIT)) { - ERROR_LOG(G3D, "Copying from backbuffer not supported, can't take screenshots"); + ERROR_LOG(Log::G3D, "Copying from backbuffer not supported, can't take screenshots"); return false; } switch (vulkan_->GetSwapchainFormat()) { @@ -1097,7 +1097,7 @@ bool VulkanRenderManager::CopyFramebufferToMemory(VKRFramebuffer *src, VkImageAs case VK_FORMAT_R8G8B8A8_UNORM: srcFormat = Draw::DataFormat::R8G8B8A8_UNORM; break; // NOTE: If you add supported formats here, make sure to also support them in VulkanQueueRunner::CopyReadbackBuffer. default: - ERROR_LOG(G3D, "Unsupported backbuffer format for screenshots"); + ERROR_LOG(Log::G3D, "Unsupported backbuffer format for screenshots"); return false; } } @@ -1216,7 +1216,7 @@ void VulkanRenderManager::Clear(uint32_t clearColor, float clearZ, int clearSten if (clearMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) { if (curRenderStep_->render.framebuffer && !curRenderStep_->render.framebuffer->HasDepth()) { - WARN_LOG(G3D, "Trying to clear depth/stencil on a non-depth framebuffer: %s", curRenderStep_->render.framebuffer->Tag()); + WARN_LOG(Log::G3D, "Trying to clear depth/stencil on a non-depth framebuffer: %s", curRenderStep_->render.framebuffer->Tag()); } else { curPipelineFlags_ |= PipelineFlags::USES_DEPTH_STENCIL; } diff --git a/Common/GPU/Vulkan/thin3d_vulkan.cpp b/Common/GPU/Vulkan/thin3d_vulkan.cpp index 4f8fb6465f..c47fb46f84 100644 --- a/Common/GPU/Vulkan/thin3d_vulkan.cpp +++ b/Common/GPU/Vulkan/thin3d_vulkan.cpp @@ -221,7 +221,7 @@ bool VKShaderModule::Compile(VulkanContext *vulkan, ShaderLanguage language, con std::vector spirv; std::string errorMessage; if (!GLSLtoSPV(vkstage_, source_.c_str(), GLSLVariant::VULKAN, spirv, &errorMessage)) { - WARN_LOG(G3D, "Shader compile to module failed (%s): %s", tag_.c_str(), errorMessage.c_str()); + WARN_LOG(Log::G3D, "Shader compile to module failed (%s): %s", tag_.c_str(), errorMessage.c_str()); return false; } @@ -239,7 +239,7 @@ bool VKShaderModule::Compile(VulkanContext *vulkan, ShaderLanguage language, con module_ = Promise::AlreadyDone(shaderModule); ok_ = true; } else { - WARN_LOG(G3D, "vkCreateShaderModule failed (%s)", tag_.c_str()); + WARN_LOG(Log::G3D, "vkCreateShaderModule failed (%s)", tag_.c_str()); ok_ = false; } return ok_; @@ -781,7 +781,7 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanBarrierBatch *postBarriers, Vu // Zero-sized textures not allowed. _assert_(desc.width * desc.height * desc.depth > 0); // remember to set depth to 1! if (desc.width * desc.height * desc.depth <= 0) { - ERROR_LOG(G3D, "Bad texture dimensions %dx%dx%d", desc.width, desc.height, desc.depth); + ERROR_LOG(Log::G3D, "Bad texture dimensions %dx%dx%d", desc.width, desc.height, desc.depth); return false; } _dbg_assert_(pushBuffer); @@ -802,7 +802,7 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanBarrierBatch *postBarriers, Vu VulkanBarrierBatch barrier; if (!vkTex_->CreateDirect(width_, height_, 1, mipLevels_, vulkanFormat, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, usageBits, &barrier, desc.swizzle == TextureSwizzle::R8_AS_ALPHA ? r8AsAlpha : nullptr)) { - ERROR_LOG(G3D, "Failed to create VulkanTexture: %dx%dx%d fmt %d, %d levels", width_, height_, depth_, (int)vulkanFormat, mipLevels_); + ERROR_LOG(Log::G3D, "Failed to create VulkanTexture: %dx%dx%d fmt %d, %d levels", width_, height_, depth_, (int)vulkanFormat, mipLevels_); return false; } barrier.Flush(cmd); @@ -940,7 +940,7 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread) case VULKAN_VENDOR_APPLE: caps_.vendor = GPUVendor::VENDOR_APPLE; break; case VULKAN_VENDOR_MESA: caps_.vendor = GPUVendor::VENDOR_MESA; break; default: - WARN_LOG(G3D, "Unknown vendor ID %08x", deviceProps.vendorID); + WARN_LOG(Log::G3D, "Unknown vendor ID %08x", deviceProps.vendorID); caps_.vendor = GPUVendor::VENDOR_UNKNOWN; break; } @@ -1051,7 +1051,7 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread) } if (!vulkan->Extensions().KHR_depth_stencil_resolve) { - INFO_LOG(G3D, "KHR_depth_stencil_resolve not supported, disabling multisampling"); + INFO_LOG(Log::G3D, "KHR_depth_stencil_resolve not supported, disabling multisampling"); } // We limit multisampling functionality to reasonably recent and known-good tiling GPUs. @@ -1062,9 +1062,9 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread) const auto &resolveProperties = vulkan->GetPhysicalDeviceProperties().depthStencilResolve; if (((resolveProperties.supportedDepthResolveModes & resolveProperties.supportedStencilResolveModes) & VK_RESOLVE_MODE_SAMPLE_ZERO_BIT) != 0) { caps_.multiSampleLevelsMask = (limits.framebufferColorSampleCounts & limits.framebufferDepthSampleCounts & limits.framebufferStencilSampleCounts); - INFO_LOG(G3D, "Multisample levels mask: %d", caps_.multiSampleLevelsMask); + INFO_LOG(Log::G3D, "Multisample levels mask: %d", caps_.multiSampleLevelsMask); } else { - INFO_LOG(G3D, "Not enough depth/stencil resolve modes supported, disabling multisampling."); + INFO_LOG(Log::G3D, "Not enough depth/stencil resolve modes supported, disabling multisampling."); caps_.multiSampleLevelsMask = 1; } } else { @@ -1196,7 +1196,7 @@ Pipeline *VKContext::CreateGraphicsPipeline(const PipelineDesc &desc, const char } else if (vkshader->GetStage() == ShaderStage::Fragment) { gDesc.fragmentShader = vkshader->Get(); } else { - ERROR_LOG(G3D, "Bad stage"); + ERROR_LOG(Log::G3D, "Bad stage"); delete pipeline; return nullptr; } @@ -1309,14 +1309,14 @@ Texture *VKContext::CreateTexture(const TextureDesc &desc) { VkCommandBuffer initCmd = renderManager_.GetInitCmd(); if (!push_ || !initCmd) { // Too early! Fail. - ERROR_LOG(G3D, "Can't create textures before the first frame has started."); + ERROR_LOG(Log::G3D, "Can't create textures before the first frame has started."); return nullptr; } VKTexture *tex = new VKTexture(vulkan_, initCmd, push_, desc); if (tex->Create(initCmd, &renderManager_.PostInitBarrier(), push_, desc)) { return tex; } else { - ERROR_LOG(G3D, "Failed to create texture"); + ERROR_LOG(Log::G3D, "Failed to create texture"); tex->Release(); return nullptr; } @@ -1326,7 +1326,7 @@ void VKContext::UpdateTextureLevels(Texture *texture, const uint8_t **data, Text VkCommandBuffer initCmd = renderManager_.GetInitCmd(); if (!push_ || !initCmd) { // Too early! Fail. - ERROR_LOG(G3D, "Can't create textures before the first frame has started."); + ERROR_LOG(Log::G3D, "Can't create textures before the first frame has started."); return; } @@ -1438,7 +1438,7 @@ ShaderModule *VKContext::CreateShaderModule(ShaderStage stage, ShaderLanguage la if (shader->Compile(vulkan_, language, data, size)) { return shader; } else { - ERROR_LOG(G3D, "Failed to compile shader %s:\n%s", tag, (const char *)LineNumberString((const char *)data).c_str()); + ERROR_LOG(Log::G3D, "Failed to compile shader %s:\n%s", tag, (const char *)LineNumberString((const char *)data).c_str()); shader->Release(); return nullptr; } diff --git a/Common/GPU/thin3d.cpp b/Common/GPU/thin3d.cpp index d98f53667a..bd93cd133c 100644 --- a/Common/GPU/thin3d.cpp +++ b/Common/GPU/thin3d.cpp @@ -601,7 +601,7 @@ void ConvertFromRGBA8888(uint8_t *dst, const uint8_t *src, uint32_t dstStride, u case Draw::DataFormat::R8G8B8A8_UNORM: case Draw::DataFormat::UNDEFINED: default: - WARN_LOG(G3D, "Unable to convert from format: %d", (int)format); + WARN_LOG(Log::G3D, "Unable to convert from format: %d", (int)format); break; } } @@ -663,7 +663,7 @@ void ConvertFromBGRA8888(uint8_t *dst, const uint8_t *src, uint32_t dstStride, u case Draw::DataFormat::R8G8B8A8_UNORM: case Draw::DataFormat::UNDEFINED: default: - WARN_LOG(G3D, "Unable to convert from format to BGRA: %d", (int)format); + WARN_LOG(Log::G3D, "Unable to convert from format to BGRA: %d", (int)format); break; } } diff --git a/Common/Log.cpp b/Common/Log.cpp index 31c614a9aa..d5b0e62005 100644 --- a/Common/Log.cpp +++ b/Common/Log.cpp @@ -70,8 +70,8 @@ bool HandleAssert(const char *function, const char *file, int line, const char * } // Normal logging (will also log to Android log) - ERROR_LOG(SYSTEM, "%s", formatted); - // Also do a simple printf for good measure, in case logging of SYSTEM is disabled (should we disallow that?) + ERROR_LOG(Log::System, "%s", formatted); + // Also do a simple printf for good measure, in case logging of System is disabled (should we disallow that?) fprintf(stderr, "%s\n", formatted); hitAnyAsserts = true; diff --git a/Common/Log.h b/Common/Log.h index eaa20ac7c0..b3375a4d10 100644 --- a/Common/Log.h +++ b/Common/Log.h @@ -27,41 +27,41 @@ #define VERBOSE_LEVEL 6 // Noisy debugging - sometimes needed but usually unimportant. // NOTE: Needs to be kept in sync with the g_logTypeNames array. -enum class LogType { - SYSTEM = 0, // Catch-all for uncategorized things - BOOT, - COMMON, +enum class Log { + System = 0, // Catch-all for uncategorized things + Boot, + Common, CPU, - FILESYS, + FileSystem, G3D, HLE, // dumping ground that we should get rid of JIT, - LOADER, + Loader, ME, - MEMMAP, - SASMIX, - SAVESTATE, - FRAMEBUF, - AUDIO, + MemMap, + SasMix, + SaveState, + FrameBuf, + Audio, IO, - ACHIEVEMENTS, + Achievements, HTTP, - PRINTF, + Printf, - SCEAUDIO, - SCECTRL, - SCEDISPLAY, - SCEFONT, - SCEGE, - SCEINTC, - SCEIO, - SCEKERNEL, - SCEMODULE, - SCENET, - SCERTC, - SCESAS, - SCEUTILITY, - SCEMISC, + sceAudio, + sceCtrl, + sceDisplay, + sceFont, + sceGe, + sceIntc, + sceIo, + sceKernel, + sceModule, + sceNet, + sceRtc, + sceSas, + sceUtility, + sceMisc, NUMBER_OF_LOGS, // Must be last }; @@ -75,13 +75,12 @@ enum class LogLevel : int { LVERBOSE = VERBOSE_LEVEL, }; -void GenericLog(LogLevel level, LogType type, - const char *file, int line, const char *fmt, ...) +void GenericLog(LogLevel level, Log type, const char *file, int line, const char *fmt, ...) #ifdef __GNUC__ __attribute__((format(printf, 5, 6))) #endif ; -bool GenericLogEnabled(LogLevel level, LogType type); +bool GenericLogEnabled(LogLevel level, Log type); // Exception for Windows - enable more log levels in release mode than on other platforms. #if defined(_DEBUG) || defined(_WIN32) @@ -104,12 +103,12 @@ bool GenericLogEnabled(LogLevel level, LogType type); GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \ } -#define ERROR_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LERROR, __VA_ARGS__) } while (false) -#define WARN_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LWARNING, __VA_ARGS__) } while (false) -#define NOTICE_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LNOTICE, __VA_ARGS__) } while (false) -#define INFO_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LINFO, __VA_ARGS__) } while (false) -#define DEBUG_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LDEBUG, __VA_ARGS__) } while (false) -#define VERBOSE_LOG(t,...) do { GENERIC_LOG(LogType::t, LogLevel::LVERBOSE, __VA_ARGS__) } while (false) +#define ERROR_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LERROR, __VA_ARGS__) } while (false) +#define WARN_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LWARNING, __VA_ARGS__) } while (false) +#define NOTICE_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LNOTICE, __VA_ARGS__) } while (false) +#define INFO_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LINFO, __VA_ARGS__) } while (false) +#define DEBUG_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LDEBUG, __VA_ARGS__) } while (false) +#define VERBOSE_LOG(t,...) do { GENERIC_LOG(t, LogLevel::LVERBOSE, __VA_ARGS__) } while (false) // Currently only actually shows a dialog box on Windows. bool HandleAssert(const char *function, const char *file, int line, const char *expression, const char* format, ...) diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp index f7b59b8447..1039ac55b9 100644 --- a/Common/LogManager.cpp +++ b/Common/LogManager.cpp @@ -47,14 +47,14 @@ static const char level_to_char[8] = "-NEWIDV"; #define LOG_MSC_OUTPUTDEBUG false #endif -void GenericLog(LogLevel level, LogType type, const char *file, int line, const char* fmt, ...) { +void GenericLog(LogLevel level, Log type, const char *file, int line, const char* fmt, ...) { if (g_bLogEnabledSetting && !(*g_bLogEnabledSetting)) return; va_list args; va_start(args, fmt); LogManager *instance = LogManager::GetInstance(); if (instance) { - instance->Log(level, type, file, line, fmt, args); + instance->LogLine(level, type, file, line, fmt, args); } else { // Fall back to printf or direct android logger with a small buffer if the log manager hasn't been initialized yet. #if PPSSPP_PLATFORM(ANDROID) @@ -69,7 +69,7 @@ void GenericLog(LogLevel level, LogType type, const char *file, int line, const va_end(args); } -bool GenericLogEnabled(LogLevel level, LogType type) { +bool GenericLogEnabled(LogLevel level, Log type) { if (LogManager::GetInstance()) return (*g_bLogEnabledSetting) && LogManager::GetInstance()->IsEnabled(level, type); return false; @@ -77,7 +77,7 @@ bool GenericLogEnabled(LogLevel level, LogType type) { LogManager *LogManager::logManager_ = NULL; -// NOTE: Needs to be kept in sync with the LogType enum. +// NOTE: Needs to be kept in sync with the Log enum. static const char * const g_logTypeNames[] = { "SYSTEM", "BOOT", @@ -118,7 +118,7 @@ static const char * const g_logTypeNames[] = { LogManager::LogManager(bool *enabledSetting) { g_bLogEnabledSetting = enabledSetting; - _dbg_assert_(ARRAY_SIZE(g_logTypeNames) == (size_t)LogType::NUMBER_OF_LOGS); + _dbg_assert_(ARRAY_SIZE(g_logTypeNames) == (size_t)Log::NUMBER_OF_LOGS); for (size_t i = 0; i < ARRAY_SIZE(g_logTypeNames); i++) { truncate_cpy(log_[i].m_shortName, g_logTypeNames[i]); @@ -158,7 +158,7 @@ LogManager::LogManager(bool *enabledSetting) { } LogManager::~LogManager() { - for (int i = 0; i < (int)LogType::NUMBER_OF_LOGS; ++i) { + for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; ++i) { #if !defined(MOBILE_DEVICE) || defined(_DEBUG) RemoveListener(fileLog_); RemoveListener(consoleLog_); @@ -194,14 +194,14 @@ void LogManager::ChangeFileLog(const char *filename) { } void LogManager::SaveConfig(Section *section) { - for (int i = 0; i < (int)LogType::NUMBER_OF_LOGS; i++) { + for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; i++) { section->Set((std::string(log_[i].m_shortName) + "Enabled").c_str(), log_[i].enabled); section->Set((std::string(log_[i].m_shortName) + "Level").c_str(), (int)log_[i].level); } } void LogManager::LoadConfig(const Section *section, bool debugDefaults) { - for (int i = 0; i < (int)LogType::NUMBER_OF_LOGS; i++) { + for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; i++) { bool enabled = false; int level = 0; section->Get((std::string(log_[i].m_shortName) + "Enabled").c_str(), &enabled, true); @@ -211,7 +211,7 @@ void LogManager::LoadConfig(const Section *section, bool debugDefaults) { } } -void LogManager::Log(LogLevel level, LogType type, const char *file, int line, const char *format, va_list args) { +void LogManager::LogLine(LogLevel level, Log type, const char *file, int line, const char *format, va_list args) { const LogChannel &log = log_[(size_t)type]; if (level > log.level || !log.enabled) return; @@ -268,7 +268,7 @@ void LogManager::Log(LogLevel level, LogType type, const char *file, int line, c } } -bool LogManager::IsEnabled(LogLevel level, LogType type) { +bool LogManager::IsEnabled(LogLevel level, Log type) { LogChannel &log = log_[(size_t)type]; if (level > log.level || !log.enabled) return false; @@ -356,7 +356,7 @@ void OutputDebugStringUTF8(const char *p) { #else void OutputDebugStringUTF8(const char *p) { - INFO_LOG(SYSTEM, "%s", p); + INFO_LOG(Log::System, "%s", p); } #endif diff --git a/Common/LogManager.h b/Common/LogManager.h index 7151774067..23e41939a6 100644 --- a/Common/LogManager.h +++ b/Common/LogManager.h @@ -114,7 +114,7 @@ private: LogManager(const LogManager &) = delete; void operator=(const LogManager &) = delete; - LogChannel log_[(size_t)LogType::NUMBER_OF_LOGS]; + LogChannel log_[(size_t)Log::NUMBER_OF_LOGS]; FileLogListener *fileLog_ = nullptr; ConsoleListener *consoleLog_ = nullptr; OutputDebugStringLogListener *debuggerLog_ = nullptr; @@ -129,31 +129,31 @@ public: void RemoveListener(LogListener *listener); static u32 GetMaxLevel() { return (u32)MAX_LOGLEVEL; } - static int GetNumChannels() { return (int)LogType::NUMBER_OF_LOGS; } + static int GetNumChannels() { return (int)Log::NUMBER_OF_LOGS; } - void Log(LogLevel level, LogType type, - const char *file, int line, const char *fmt, va_list args); - bool IsEnabled(LogLevel level, LogType type); + void LogLine(LogLevel level, Log type, + const char *file, int line, const char *fmt, va_list args); + bool IsEnabled(LogLevel level, Log type); - LogChannel *GetLogChannel(LogType type) { + LogChannel *GetLogChannel(Log type) { return &log_[(size_t)type]; } - void SetLogLevel(LogType type, LogLevel level) { + void SetLogLevel(Log type, LogLevel level) { log_[(size_t)type].level = level; } void SetAllLogLevels(LogLevel level) { - for (int i = 0; i < (int)LogType::NUMBER_OF_LOGS; ++i) { + for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; ++i) { log_[i].level = level; } } - void SetEnabled(LogType type, bool enable) { + void SetEnabled(Log type, bool enable) { log_[(size_t)type].enabled = enable; } - LogLevel GetLogLevel(LogType type) { + LogLevel GetLogLevel(Log type) { return log_[(size_t)type].level; } diff --git a/Common/LogReporting.cpp b/Common/LogReporting.cpp index 0fcc78d0ad..4b1a092238 100644 --- a/Common/LogReporting.cpp +++ b/Common/LogReporting.cpp @@ -59,7 +59,7 @@ void SetupCallbacks(AllowedCallback allowed, MessageCallback message) { void ReportMessage(const char *message, ...) { if (!allowedCallback || !messageCallback) { - ERROR_LOG(SYSTEM, "Reporting not initialized, skipping: %s", message); + ERROR_LOG(Log::System, "Reporting not initialized, skipping: %s", message); return; } @@ -80,7 +80,7 @@ void ReportMessage(const char *message, ...) { void ReportMessageFormatted(const char *message, const char *formatted) { if (!allowedCallback || !messageCallback) { - ERROR_LOG(SYSTEM, "Reporting not initialized, skipping: %s", message); + ERROR_LOG(Log::System, "Reporting not initialized, skipping: %s", message); return; } diff --git a/Common/MemArenaAndroid.cpp b/Common/MemArenaAndroid.cpp index 73dd4e7cc6..551a89bd60 100644 --- a/Common/MemArenaAndroid.cpp +++ b/Common/MemArenaAndroid.cpp @@ -88,7 +88,7 @@ static int legacy_ashmem_create_region(const char *name, size_t size) { return fd; error: - ERROR_LOG(MEMMAP, "NASTY ASHMEM ERROR: ret = %08x", ret); + ERROR_LOG(Log::MemMap, "NASTY ASHMEM ERROR: ret = %08x", ret); close(fd); return ret; } @@ -110,7 +110,7 @@ bool MemArena::GrabMemSpace(size_t size) { } // Note that it appears that ashmem is pinned by default, so no need to pin. if (fd < 0) { - ERROR_LOG(MEMMAP, "Failed to grab ashmem space of size: %08x errno: %d", (int)size, (int)(errno)); + ERROR_LOG(Log::MemMap, "Failed to grab ashmem space of size: %08x errno: %d", (int)size, (int)(errno)); return false; } return true; @@ -123,7 +123,7 @@ void MemArena::ReleaseSpace() { void *MemArena::CreateView(s64 offset, size_t size, void *base) { void *retval = mmap(base, size, PROT_READ | PROT_WRITE, MAP_SHARED | ((base == 0) ? 0 : MAP_FIXED), fd, offset); if (retval == MAP_FAILED) { - NOTICE_LOG(MEMMAP, "mmap on ashmem (fd: %d) failed", (int)fd); + NOTICE_LOG(Log::MemMap, "mmap on ashmem (fd: %d) failed", (int)fd); return nullptr; } return retval; @@ -142,14 +142,14 @@ u8* MemArena::Find4GBBase() { const uint64_t EIGHT_GIGS = 0x200000000ULL; void *base = mmap(0, EIGHT_GIGS, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); if (base && base != MAP_FAILED) { - INFO_LOG(SYSTEM, "base: %p", base); + INFO_LOG(Log::System, "base: %p", base); uint64_t aligned_base = ((uint64_t)base + 0xFFFFFFFF) & ~0xFFFFFFFFULL; - INFO_LOG(SYSTEM, "aligned_base: %p", (void *)aligned_base); + INFO_LOG(Log::System, "aligned_base: %p", (void *)aligned_base); munmap(base, EIGHT_GIGS); return reinterpret_cast(aligned_base); } else { u8 *hardcoded_ptr = reinterpret_cast(0x2300000000ULL); - INFO_LOG(SYSTEM, "Failed to anonymously map 8GB. Fall back to the hardcoded pointer %p.", hardcoded_ptr); + INFO_LOG(Log::System, "Failed to anonymously map 8GB. Fall back to the hardcoded pointer %p.", hardcoded_ptr); // Just grab some random 4GB... // This has been known to fail lately though, see issue #12249. return hardcoded_ptr; @@ -159,7 +159,7 @@ u8* MemArena::Find4GBBase() { void *base = mmap(0, 0x10000000, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); if (base == MAP_FAILED) { - ERROR_LOG(SYSTEM, "Failed to map 256 MB of memory space: %s", strerror(errno)); + ERROR_LOG(Log::System, "Failed to map 256 MB of memory space: %s", strerror(errno)); return nullptr; } diff --git a/Common/MemArenaDarwin.cpp b/Common/MemArenaDarwin.cpp index 0b1abd16b8..c6f91eaf53 100644 --- a/Common/MemArenaDarwin.cpp +++ b/Common/MemArenaDarwin.cpp @@ -42,10 +42,10 @@ bool MemArena::GrabMemSpace(size_t size) { vm_size = size; kern_return_t retval = vm_allocate(mach_task_self(), &vm_mem, size, VM_FLAGS_ANYWHERE); if (retval != KERN_SUCCESS) { - ERROR_LOG(MEMMAP, "Failed to grab a block of virtual memory"); + ERROR_LOG(Log::MemMap, "Failed to grab a block of virtual memory"); return false; } else { - INFO_LOG(MEMMAP, "Successfully allocated %d bytes at %p", (int)size, (void *)vm_mem); + INFO_LOG(Log::MemMap, "Successfully allocated %d bytes at %p", (int)size, (void *)vm_mem); return true; } } @@ -72,7 +72,7 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base) { // 1 == KERN_INVALID_ADDRESS // 3 == KERN_NO_SPACE (race?) // 4 == KERN_INVALID_ARGUMENT - ERROR_LOG(MEMMAP, "vm_remap failed (%d) - could not remap from %llx (offset %llx) of size %llx to %p", + ERROR_LOG(Log::MemMap, "vm_remap failed (%d) - could not remap from %llx (offset %llx) of size %llx to %p", (int)retval, (uint64_t)source, (uint64_t)offset, (uint64_t)size, base); return nullptr; } diff --git a/Common/MemArenaPosix.cpp b/Common/MemArenaPosix.cpp index 7923b99b85..6f3c25c900 100644 --- a/Common/MemArenaPosix.cpp +++ b/Common/MemArenaPosix.cpp @@ -63,11 +63,11 @@ bool MemArena::GrabMemSpace(size_t size) { // This opens atomically, so will fail if another process is starting. fd = shm_open(ram_temp_filename, O_RDWR | O_CREAT | O_EXCL, mode); if (fd >= 0) { - INFO_LOG(MEMMAP, "Got shm file: %s", ram_temp_filename); + INFO_LOG(Log::MemMap, "Got shm file: %s", ram_temp_filename); is_shm = true; // Our handle persists per POSIX, so no need to keep it around. if (shm_unlink(ram_temp_filename) != 0) { - WARN_LOG(MEMMAP, "Failed to shm_unlink %s", ram_temp_file.c_str()); + WARN_LOG(Log::MemMap, "Failed to shm_unlink %s", ram_temp_file.c_str()); } break; } @@ -79,24 +79,24 @@ bool MemArena::GrabMemSpace(size_t size) { if (fd >= 0) { // Great, this definitely shouldn't flush to disk. ram_temp_file = tmpfs_ram_temp_file; - INFO_LOG(MEMMAP, "Got tmpfs ram file: %s", tmpfs_ram_temp_file.c_str()); + INFO_LOG(Log::MemMap, "Got tmpfs ram file: %s", tmpfs_ram_temp_file.c_str()); } } if (fd < 0) { - INFO_LOG(MEMMAP, "Trying '%s' as ram temp file", ram_temp_file.c_str()); + INFO_LOG(Log::MemMap, "Trying '%s' as ram temp file", ram_temp_file.c_str()); fd = open(ram_temp_file.c_str(), O_RDWR | O_CREAT, mode); } if (fd < 0) { - ERROR_LOG(MEMMAP, "Failed to grab memory space as a file: %s of size: %08x. Error: %s", ram_temp_file.c_str(), (int)size, strerror(errno)); + ERROR_LOG(Log::MemMap, "Failed to grab memory space as a file: %s of size: %08x. Error: %s", ram_temp_file.c_str(), (int)size, strerror(errno)); return false; } // delete immediately, we keep the fd so it still lives if (!is_shm && unlink(ram_temp_file.c_str()) != 0) { - WARN_LOG(MEMMAP, "Failed to unlink %s", ram_temp_file.c_str()); + WARN_LOG(Log::MemMap, "Failed to unlink %s", ram_temp_file.c_str()); } if (ftruncate(fd, size) != 0) { - ERROR_LOG(MEMMAP, "Failed to ftruncate %d (%s) to size %08x", (int)fd, ram_temp_file.c_str(), (int)size); + ERROR_LOG(Log::MemMap, "Failed to ftruncate %d (%s) to size %08x", (int)fd, ram_temp_file.c_str(), (int)size); // Should this be a failure? } #endif @@ -122,7 +122,7 @@ void *MemArena::CreateView(s64 offset, size_t size, void *base) ((base == 0) ? 0 : MAP_FIXED), fd, offset); if (retval == MAP_FAILED) { - NOTICE_LOG(MEMMAP, "mmap on %s (fd: %d) failed: %s", ram_temp_file.c_str(), (int)fd, strerror(errno)); + NOTICE_LOG(Log::MemMap, "mmap on %s (fd: %d) failed: %s", ram_temp_file.c_str(), (int)fd, strerror(errno)); return 0; } return retval; @@ -145,14 +145,14 @@ u8* MemArena::Find4GBBase() { const uint64_t EIGHT_GIGS = 0x200000000ULL; void *base = mmap(0, EIGHT_GIGS, PROT_NONE, MAP_ANON | MAP_PRIVATE | MAP_NORESERVE, -1, 0); if (base && base != MAP_FAILED) { - INFO_LOG(MEMMAP, "base: %p", base); + INFO_LOG(Log::MemMap, "base: %p", base); uint64_t aligned_base = ((uint64_t)base + 0xFFFFFFFF) & ~0xFFFFFFFFULL; - INFO_LOG(MEMMAP, "aligned_base: %p", (void *)aligned_base); + INFO_LOG(Log::MemMap, "aligned_base: %p", (void *)aligned_base); munmap(base, EIGHT_GIGS); return reinterpret_cast(aligned_base); } else { u8 *hardcoded_ptr = reinterpret_cast(0x2300000000ULL); - INFO_LOG(MEMMAP, "Failed to anonymously map 8GB (%s). Fall back to the hardcoded pointer %p.", strerror(errno), hardcoded_ptr); + INFO_LOG(Log::MemMap, "Failed to anonymously map 8GB (%s). Fall back to the hardcoded pointer %p.", strerror(errno), hardcoded_ptr); // Just grab some random 4GB... // This has been known to fail lately though, see issue #12249. return hardcoded_ptr; diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index 4cebd6eb4d..9c7130e8dd 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -146,7 +146,7 @@ void *AllocateExecutableMemory(size_t size) { if (ptr) { ptr = VirtualAlloc(ptr, aligned_size, MEM_RESERVE | MEM_COMMIT, prot); } else { - WARN_LOG(COMMON, "Unable to find nearby executable memory for jit. Proceeding with far memory."); + WARN_LOG(Log::Common, "Unable to find nearby executable memory for jit. Proceeding with far memory."); // Can still run, thanks to "RipAccessible". ptr = VirtualAlloc(nullptr, aligned_size, MEM_RESERVE | MEM_COMMIT, prot); } @@ -161,7 +161,7 @@ void *AllocateExecutableMemory(size_t size) { #endif } if (!ptr) { - ERROR_LOG(MEMMAP, "Failed to allocate executable memory (%d)", (int)size); + ERROR_LOG(Log::MemMap, "Failed to allocate executable memory (%d)", (int)size); } return ptr; } @@ -193,7 +193,7 @@ void *AllocateExecutableMemory(size_t size) { if (ptr == MAP_FAILED) { ptr = nullptr; - ERROR_LOG(MEMMAP, "Failed to allocate executable memory (%d) errno=%d", (int)size, errno); + ERROR_LOG(Log::MemMap, "Failed to allocate executable memory (%d) errno=%d", (int)size, errno); } #if PPSSPP_ARCH(AMD64) @@ -227,7 +227,7 @@ void *AllocateMemoryPages(size_t size, uint32_t memProtFlags) { void* ptr = VirtualAlloc(0, size, MEM_COMMIT, protect); #endif if (!ptr) { - ERROR_LOG(MEMMAP, "Failed to allocate raw memory pages"); + ERROR_LOG(Log::MemMap, "Failed to allocate raw memory pages"); return nullptr; } #else @@ -235,7 +235,7 @@ void *AllocateMemoryPages(size_t size, uint32_t memProtFlags) { uint32_t protect = ConvertProtFlagsUnix(memProtFlags); void *ptr = mmap(0, size, protect, MAP_ANON | MAP_PRIVATE, -1, 0); if (ptr == MAP_FAILED) { - ERROR_LOG(MEMMAP, "Failed to allocate raw memory pages: errno=%d", errno); + ERROR_LOG(Log::MemMap, "Failed to allocate raw memory pages: errno=%d", errno); return nullptr; } #endif @@ -271,7 +271,7 @@ void FreeMemoryPages(void *ptr, size_t size) { size = (size + page_size - 1) & (~(page_size - 1)); #ifdef _WIN32 if (!VirtualFree(ptr, 0, MEM_RELEASE)) { - ERROR_LOG(MEMMAP, "FreeMemoryPages failed!\n%s", GetLastErrorMsg().c_str()); + ERROR_LOG(Log::MemMap, "FreeMemoryPages failed!\n%s", GetLastErrorMsg().c_str()); } #else munmap(ptr, size); @@ -306,7 +306,7 @@ bool PlatformIsWXExclusive() { } bool ProtectMemoryPages(const void* ptr, size_t size, uint32_t memProtFlags) { - VERBOSE_LOG(JIT, "ProtectMemoryPages: %p (%d) : r%d w%d x%d", ptr, (int)size, + VERBOSE_LOG(Log::JIT, "ProtectMemoryPages: %p (%d) : r%d w%d x%d", ptr, (int)size, (memProtFlags & MEM_PROT_READ) != 0, (memProtFlags & MEM_PROT_WRITE) != 0, (memProtFlags & MEM_PROT_EXEC) != 0); if (PlatformIsWXExclusive()) { @@ -322,13 +322,13 @@ bool ProtectMemoryPages(const void* ptr, size_t size, uint32_t memProtFlags) { #if PPSSPP_PLATFORM(UWP) DWORD oldValue; if (!VirtualProtectFromApp((void *)ptr, size, protect, &oldValue)) { - ERROR_LOG(MEMMAP, "WriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str()); + ERROR_LOG(Log::MemMap, "WriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str()); return false; } #else DWORD oldValue; if (!VirtualProtect((void *)ptr, size, protect, &oldValue)) { - ERROR_LOG(MEMMAP, "WriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str()); + ERROR_LOG(Log::MemMap, "WriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str()); return false; } #endif @@ -343,7 +343,7 @@ bool ProtectMemoryPages(const void* ptr, size_t size, uint32_t memProtFlags) { end = (end + page_size - 1) & ~(page_size - 1); int retval = mprotect((void *)start, end - start, protect); if (retval != 0) { - ERROR_LOG(MEMMAP, "mprotect failed (%p)! errno=%d (%s)", (void *)start, errno, strerror(errno)); + ERROR_LOG(Log::MemMap, "mprotect failed (%p)! errno=%d (%s)", (void *)start, errno, strerror(errno)); return false; } return true; diff --git a/Common/Net/HTTPClient.cpp b/Common/Net/HTTPClient.cpp index 5ffed8efa3..13be8e4998 100644 --- a/Common/Net/HTTPClient.cpp +++ b/Common/Net/HTTPClient.cpp @@ -69,11 +69,11 @@ const char *DNSTypeAsString(DNSType type) { bool Connection::Resolve(const char *host, int port, DNSType type) { if ((intptr_t)sock_ != -1) { - ERROR_LOG(IO, "Resolve: Already have a socket"); + ERROR_LOG(Log::IO, "Resolve: Already have a socket"); return false; } if (!host || port < 1 || port > 65535) { - ERROR_LOG(IO, "Resolve: Invalid host or port (%d)", port); + ERROR_LOG(Log::IO, "Resolve: Invalid host or port (%d)", port); return false; } @@ -85,7 +85,7 @@ bool Connection::Resolve(const char *host, int port, DNSType type) { std::string err; if (!net::DNSResolve(host, port_str, &resolved_, err, type)) { - WARN_LOG(IO, "Failed to resolve host '%s': '%s' (%s)", host, err.c_str(), DNSTypeAsString(type)); + WARN_LOG(Log::IO, "Failed to resolve host '%s': '%s' (%s)", host, err.c_str(), DNSTypeAsString(type)); // Zero port so that future calls fail. port_ = 0; return false; @@ -108,7 +108,7 @@ static void FormatAddr(char *addrbuf, size_t bufsize, const addrinfo *info) { bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { if (port_ <= 0) { - ERROR_LOG(IO, "Bad port"); + ERROR_LOG(Log::IO, "Bad port"); return false; } sock_ = -1; @@ -124,13 +124,13 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { int sock = socket(possible->ai_family, SOCK_STREAM, IPPROTO_TCP); if ((intptr_t)sock == -1) { - ERROR_LOG(IO, "Bad socket"); + ERROR_LOG(Log::IO, "Bad socket"); continue; } // Windows sockets aren't limited by socket number, just by count, so checking FD_SETSIZE there is wrong. #if !PPSSPP_PLATFORM(WINDOWS) if (sock >= FD_SETSIZE) { - ERROR_LOG(IO, "Socket doesn't fit in FD_SET: %d We probably have a leak.", sock); + ERROR_LOG(Log::IO, "Socket doesn't fit in FD_SET: %d We probably have a leak.", sock); closesocket(sock); continue; } @@ -155,9 +155,9 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { char addrStr[128]{}; FormatAddr(addrStr, sizeof(addrStr), possible); if (!unreachable) { - ERROR_LOG(HTTP, "connect(%d) call to %s failed (%d: %s)", sock, addrStr, errorCode, errorString.c_str()); + ERROR_LOG(Log::HTTP, "connect(%d) call to %s failed (%d: %s)", sock, addrStr, errorCode, errorString.c_str()); } else { - INFO_LOG(HTTP, "connect(%d): Ignoring unreachable resolved address %s", sock, addrStr); + INFO_LOG(Log::HTTP, "connect(%d): Ignoring unreachable resolved address %s", sock, addrStr); } closesocket(sock); continue; @@ -186,7 +186,7 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { selectResult = select(maxfd, nullptr, &fds, nullptr, &tv); if (cancelConnect && *cancelConnect) { - WARN_LOG(HTTP, "connect: cancelled (1)"); + WARN_LOG(Log::HTTP, "connect: cancelled (1)"); break; } } @@ -210,7 +210,7 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) { } if (cancelConnect && *cancelConnect) { - WARN_LOG(HTTP, "connect: cancelled (2)"); + WARN_LOG(Log::HTTP, "connect: cancelled (2)"); break; } @@ -396,13 +396,13 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector & return -1; ready = fd_util::WaitUntilReady(sock(), CANCEL_INTERVAL, false); if (!ready && time_now_d() > endTimeout) { - ERROR_LOG(HTTP, "HTTP headers timed out"); + ERROR_LOG(Log::HTTP, "HTTP headers timed out"); return -1; } }; // Let's hope all the headers are available in a single packet... if (readbuf->Read(sock(), 4096) < 0) { - ERROR_LOG(HTTP, "Failed to read HTTP headers :("); + ERROR_LOG(Log::HTTP, "Failed to read HTTP headers :("); return -1; } @@ -420,7 +420,7 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector & if (code_pos != line.npos) { code = atoi(&line[code_pos]); } else { - ERROR_LOG(HTTP, "Could not parse HTTP status code: %s", line.c_str()); + ERROR_LOG(Log::HTTP, "Could not parse HTTP status code: %s", line.c_str()); return -1; } @@ -432,7 +432,7 @@ int Client::ReadResponseHeaders(net::Buffer *readbuf, std::vector & } if (responseHeaders.size() == 0) { - ERROR_LOG(HTTP, "No HTTP response headers"); + ERROR_LOG(Log::HTTP, "No HTTP response headers"); return -1; } @@ -469,7 +469,7 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vectorIsVoid()) { if (chunked) { if (!DeChunk(readbuf, output, contentLength)) { - ERROR_LOG(HTTP, "Bad chunked data, couldn't read chunk size"); + ERROR_LOG(Log::HTTP, "Bad chunked data, couldn't read chunk size"); progress->Update(0, 0, true); return -1; } @@ -495,7 +495,7 @@ int Client::ReadResponseEntity(net::Buffer *readbuf, const std::vectorTakeAll(&compressed); bool result = decompress_string(compressed, &decompressed); if (!result) { - ERROR_LOG(HTTP, "Error decompressing using zlib"); + ERROR_LOG(Log::HTTP, "Error decompressing using zlib"); progress->Update(0, 0, true); return -1; } @@ -523,7 +523,7 @@ void HTTPRequest::Start() { void HTTPRequest::Join() { if (joined_) { - ERROR_LOG(HTTP, "Already joined thread!"); + ERROR_LOG(Log::HTTP, "Already joined thread!"); } thread_.join(); joined_ = true; @@ -547,7 +547,7 @@ int HTTPRequest::Perform(const std::string &url) { } if (!client.Resolve(fileUrl.Host().c_str(), fileUrl.Port())) { - ERROR_LOG(HTTP, "Failed resolving %s", url.c_str()); + ERROR_LOG(Log::HTTP, "Failed resolving %s", url.c_str()); return -1; } @@ -556,7 +556,7 @@ int HTTPRequest::Perform(const std::string &url) { } if (!client.Connect(2, 20.0, &cancelled_)) { - ERROR_LOG(HTTP, "Failed connecting to server or cancelled."); + ERROR_LOG(Log::HTTP, "Failed connecting to server or cancelled."); return -1; } @@ -600,7 +600,7 @@ void HTTPRequest::Do() { if (resultCode == 301 || resultCode == 302 || resultCode == 303 || resultCode == 307 || resultCode == 308) { std::string redirectURL = RedirectLocation(downloadURL); if (redirectURL.empty()) { - ERROR_LOG(HTTP, "Could not find Location header for redirect"); + ERROR_LOG(Log::HTTP, "Could not find Location header for redirect"); resultCode_ = resultCode; } else if (redirectURL == downloadURL || redirectURL == url_) { // Simple loop detected, bail out. @@ -609,7 +609,7 @@ void HTTPRequest::Do() { // Perform the next GET. if (resultCode_ == 0) { - INFO_LOG(HTTP, "Download of %s redirected to %s", downloadURL.c_str(), redirectURL.c_str()); + INFO_LOG(Log::HTTP, "Download of %s redirected to %s", downloadURL.c_str(), redirectURL.c_str()); buffer_.clear(); responseHeaders_.clear(); } @@ -618,12 +618,12 @@ void HTTPRequest::Do() { } if (resultCode == 200) { - INFO_LOG(HTTP, "Completed requesting %s (storing result to %s)", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str()); + INFO_LOG(Log::HTTP, "Completed requesting %s (storing result to %s)", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str()); if (!outfile_.empty() && !buffer_.FlushToFile(outfile_)) { - ERROR_LOG(HTTP, "Failed writing download to '%s'", outfile_.c_str()); + ERROR_LOG(Log::HTTP, "Failed writing download to '%s'", outfile_.c_str()); } } else { - ERROR_LOG(HTTP, "Error requesting '%s' (storing result to '%s'): %i", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str(), resultCode); + ERROR_LOG(Log::HTTP, "Error requesting '%s' (storing result to '%s'): %i", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str(), resultCode); } resultCode_ = resultCode; } diff --git a/Common/Net/HTTPHeaders.cpp b/Common/Net/HTTPHeaders.cpp index ddb706285f..7111898548 100644 --- a/Common/Net/HTTPHeaders.cpp +++ b/Common/Net/HTTPHeaders.cpp @@ -31,7 +31,7 @@ bool RequestHeader::GetParamValue(const char *param_name, std::string *value) co for (size_t i = 0; i < v.size(); i++) { std::vector parts; SplitString(v[i], '=', parts); - DEBUG_LOG(IO, "Param: %.*s Value: %.*s", (int)parts[0].size(), parts[0].data(), (int)parts[1].size(), parts[1].data()); + DEBUG_LOG(Log::IO, "Param: %.*s Value: %.*s", (int)parts[0].size(), parts[0].data(), (int)parts[1].size(), parts[1].data()); if (parts[0] == param_name) { *value = parts[1]; return true; @@ -119,13 +119,13 @@ int RequestHeader::ParseHttpHeader(const char *buffer) { if (!strncasecmp(key, "User-Agent", key_len)) { user_agent = new char[value_len + 1]; memcpy(user_agent, buffer, value_len + 1); - VERBOSE_LOG(IO, "user-agent: %s", user_agent); + VERBOSE_LOG(Log::IO, "user-agent: %s", user_agent); } else if (!strncasecmp(key, "Referer", key_len)) { referer = new char[value_len + 1]; memcpy(referer, buffer, value_len + 1); } else if (!strncasecmp(key, "Content-Length", key_len)) { content_length = atoi(buffer); - VERBOSE_LOG(IO, "Content-Length: %i", (int)content_length); + VERBOSE_LOG(Log::IO, "Content-Length: %i", (int)content_length); } else { std::string key_str(key, key_len); std::transform(key_str.begin(), key_str.end(), key_str.begin(), tolower); @@ -148,12 +148,12 @@ void RequestHeader::ParseHeaders(net::InputSink *sink) { line_count++; if (type == SIMPLE) { // Done! - VERBOSE_LOG(IO, "Simple: Done parsing http request."); + VERBOSE_LOG(Log::IO, "Simple: Done parsing http request."); break; } } - VERBOSE_LOG(IO, "finished parsing request."); + VERBOSE_LOG(Log::IO, "finished parsing request."); ok = line_count > 1 && resource != nullptr; } diff --git a/Common/Net/HTTPNaettRequest.cpp b/Common/Net/HTTPNaettRequest.cpp index f3bf0304ab..6c39f0a4df 100644 --- a/Common/Net/HTTPNaettRequest.cpp +++ b/Common/Net/HTTPNaettRequest.cpp @@ -60,7 +60,7 @@ void HTTPSRequest::Join() { res_ = nullptr; req_ = nullptr; } else { - ERROR_LOG(IO, "HTTPSDownload::Join not implemented"); + ERROR_LOG(Log::IO, "HTTPSDownload::Join not implemented"); } } @@ -85,33 +85,33 @@ bool HTTPSRequest::Done() { // It's a naett error. Translate and handle. switch (resultCode_) { case naettConnectionError: // -1 - ERROR_LOG(IO, "Connection error"); + ERROR_LOG(Log::IO, "Connection error"); break; case naettProtocolError: // -2 - ERROR_LOG(IO, "Protocol error"); + ERROR_LOG(Log::IO, "Protocol error"); break; case naettReadError: // -3 - ERROR_LOG(IO, "Read error"); + ERROR_LOG(Log::IO, "Read error"); break; case naettWriteError: // -4 - ERROR_LOG(IO, "Write error"); + ERROR_LOG(Log::IO, "Write error"); break; case naettGenericError: // -5 - ERROR_LOG(IO, "Generic error"); + ERROR_LOG(Log::IO, "Generic error"); break; default: - ERROR_LOG(IO, "Unhandled naett error %d", resultCode_); + ERROR_LOG(Log::IO, "Unhandled naett error %d", resultCode_); break; } failed_ = true; progress_.Update(bodyLength, bodyLength, true); } else if (resultCode_ == 200) { if (!outfile_.empty() && !buffer_.FlushToFile(outfile_)) { - ERROR_LOG(IO, "Failed writing download to '%s'", outfile_.c_str()); + ERROR_LOG(Log::IO, "Failed writing download to '%s'", outfile_.c_str()); } progress_.Update(bodyLength, bodyLength, true); } else { - WARN_LOG(IO, "Naett request failed: %d", resultCode_); + WARN_LOG(Log::IO, "Naett request failed: %d", resultCode_); failed_ = true; progress_.Update(0, 0, true); } diff --git a/Common/Net/HTTPRequest.cpp b/Common/Net/HTTPRequest.cpp index 1633653609..d606a6c946 100644 --- a/Common/Net/HTTPRequest.cpp +++ b/Common/Net/HTTPRequest.cpp @@ -10,7 +10,7 @@ namespace http { Request::Request(RequestMethod method, const std::string &url, std::string_view name, bool *cancelled, ProgressBarMode mode) : method_(method), url_(url), name_(name), progress_(cancelled), progressBarMode_(mode) { - INFO_LOG(HTTP, "HTTP %s request: %s (%.*s)", RequestMethodToString(method), url.c_str(), (int)name.size(), name.data()); + INFO_LOG(Log::HTTP, "HTTP %s request: %s (%.*s)", RequestMethodToString(method), url.c_str(), (int)name.size(), name.data()); progress_.callback = [=](int64_t bytes, int64_t contentLength, bool done) { std::string message; diff --git a/Common/Net/HTTPServer.cpp b/Common/Net/HTTPServer.cpp index 83d90a94bd..623726cfca 100644 --- a/Common/Net/HTTPServer.cpp +++ b/Common/Net/HTTPServer.cpp @@ -67,7 +67,7 @@ ServerRequest::ServerRequest(int fd) header_.ParseHeaders(in_); if (header_.ok) { - VERBOSE_LOG(IO, "The request carried with it %i bytes", (int)header_.content_length); + VERBOSE_LOG(Log::IO, "The request carried with it %i bytes", (int)header_.content_length); } else { Close(); } @@ -77,11 +77,11 @@ ServerRequest::~ServerRequest() { Close(); if (!in_->Empty()) { - ERROR_LOG(IO, "Input not empty - invalid request?"); + ERROR_LOG(Log::IO, "Input not empty - invalid request?"); } delete in_; if (!out_->Empty()) { - WARN_LOG(IO, "Output not empty - connection abort? (%s) (%d bytes)", this->header_.resource, (int)out_->BytesRemaining()); + WARN_LOG(Log::IO, "Output not empty - connection abort? (%s) (%d bytes)", this->header_.resource, (int)out_->BytesRemaining()); } delete out_; } @@ -191,7 +191,7 @@ bool Server::Listen4(int port) { #else int err = errno; #endif - ERROR_LOG(IO, "Failed to bind to port %d, error=%d - Bailing (ipv4)", port, err); + ERROR_LOG(Log::IO, "Failed to bind to port %d, error=%d - Bailing (ipv4)", port, err); closesocket(listener_); return false; } @@ -209,7 +209,7 @@ bool Server::Listen4(int port) { port = ntohs(server_addr.sin_port); } - INFO_LOG(IO, "HTTP server started on port %d", port); + INFO_LOG(Log::IO, "HTTP server started on port %d", port); port_ = port; return true; @@ -241,7 +241,7 @@ bool Server::Listen6(int port, bool ipv6_only) { #else int err = errno; #endif - ERROR_LOG(IO, "Failed to bind to port %d, error=%d - Bailing (ipv6)", port, err); + ERROR_LOG(Log::IO, "Failed to bind to port %d, error=%d - Bailing (ipv6)", port, err); closesocket(listener_); return false; } @@ -259,7 +259,7 @@ bool Server::Listen6(int port, bool ipv6_only) { port = ntohs(server_addr.sin6_port); } - INFO_LOG(IO, "HTTP server started on port %d", port); + INFO_LOG(Log::IO, "HTTP server started on port %d", port); port_ = port; return true; @@ -294,7 +294,7 @@ bool Server::RunSlice(double timeout) { return true; } else { - ERROR_LOG(IO, "socket accept failed: %i", conn_fd); + ERROR_LOG(Log::IO, "socket accept failed: %i", conn_fd); return false; } } @@ -319,7 +319,7 @@ void Server::Stop() { void Server::HandleConnection(int conn_fd) { ServerRequest request(conn_fd); if (!request.IsOK()) { - WARN_LOG(IO, "Bad request, ignoring."); + WARN_LOG(Log::IO, "Bad request, ignoring."); return; } HandleRequest(request); @@ -351,7 +351,7 @@ void Server::HandleRequestDefault(const ServerRequest &request) { } void Server::Handle404(const ServerRequest &request) { - INFO_LOG(IO, "No handler for '%s', falling back to 404.", request.resource()); + INFO_LOG(Log::IO, "No handler for '%s', falling back to 404.", request.resource()); const char *payload = "404 not found\r\n"; request.WriteHttpResponseHeader("1.0", 404, strlen(payload)); request.Out()->Push(payload); diff --git a/Common/Net/NetBuffer.cpp b/Common/Net/NetBuffer.cpp index 1682582440..cb36bcd6b7 100644 --- a/Common/Net/NetBuffer.cpp +++ b/Common/Net/NetBuffer.cpp @@ -44,14 +44,14 @@ bool Buffer::FlushSocket(uintptr_t sock, double timeout, bool *cancelled) { return false; ready = fd_util::WaitUntilReady(sock, CANCEL_INTERVAL, true); if (!ready && time_now_d() > endTimeout) { - ERROR_LOG(IO, "FlushSocket timed out"); + ERROR_LOG(Log::IO, "FlushSocket timed out"); return false; } } int sent = send(sock, &data_[pos], end - pos, MSG_NOSIGNAL); // TODO: Do we need some retry logic here, instead of just giving up? if (sent < 0) { - ERROR_LOG(IO, "FlushSocket failed to send: %d", errno); + ERROR_LOG(Log::IO, "FlushSocket failed to send: %d", errno); return false; } pos += sent; @@ -94,7 +94,7 @@ bool Buffer::ReadAllWithProgress(int fd, int knownSize, RequestProgress *progres #else if (errno != EWOULDBLOCK) { #endif - ERROR_LOG(IO, "Error reading from buffer: %i", retval); + ERROR_LOG(Log::IO, "Error reading from buffer: %i", retval); return false; } diff --git a/Common/Net/Resolve.cpp b/Common/Net/Resolve.cpp index c8fe425186..f7219d4ef8 100644 --- a/Common/Net/Resolve.cpp +++ b/Common/Net/Resolve.cpp @@ -133,7 +133,7 @@ bool GetIPList(std::vector &IP4s) { char ipstr[INET6_ADDRSTRLEN]; // We use IPv6 length since it's longer than IPv4 // getifaddrs first appeared in glibc 2.3, On Android officially supported since __ANDROID_API__ >= 24 #if defined(_IFADDRS_H_) || (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || (__ANDROID_API__ >= 24) - INFO_LOG(SCENET, "GetIPList from getifaddrs"); + INFO_LOG(Log::sceNet, "GetIPList from getifaddrs"); struct ifaddrs* ifAddrStruct = NULL; struct ifaddrs* ifa = NULL; @@ -161,7 +161,7 @@ bool GetIPList(std::vector &IP4s) { return true; } #elif defined(SIOCGIFCONF) // Better detection on Linux/UNIX/MacOS/some Android - INFO_LOG(SCENET, "GetIPList from SIOCGIFCONF"); + INFO_LOG(Log::sceNet, "GetIPList from SIOCGIFCONF"); static struct ifreq ifreqs[32]; struct ifconf ifc; memset(&ifc, 0, sizeof(ifconf)); @@ -170,13 +170,13 @@ bool GetIPList(std::vector &IP4s) { int sd = socket(AF_INET, SOCK_DGRAM, 0); if (sd < 0) { - ERROR_LOG(SCENET, "GetIPList failed to create socket (result = %i, errno = %i)", sd, errno); + ERROR_LOG(Log::sceNet, "GetIPList failed to create socket (result = %i, errno = %i)", sd, errno); return false; } int r = ioctl(sd, SIOCGIFCONF, (char*)&ifc); if (r != 0) { - ERROR_LOG(SCENET, "GetIPList failed ioctl/SIOCGIFCONF (result = %i, errno = %i)", r, errno); + ERROR_LOG(Log::sceNet, "GetIPList failed ioctl/SIOCGIFCONF (result = %i, errno = %i)", r, errno); return false; } @@ -192,7 +192,7 @@ bool GetIPList(std::vector &IP4s) { r = ioctl(sd, SIOCGIFADDR, item); if (r != 0) { - ERROR_LOG(SCENET, "GetIPList failed ioctl/SIOCGIFADDR (i = %i, result = %i, errno = %i)", i, r, errno); + ERROR_LOG(Log::sceNet, "GetIPList failed ioctl/SIOCGIFADDR (i = %i, result = %i, errno = %i)", i, r, errno); } if (ifreqs[i].ifr_addr.sa_family == AF_INET) { @@ -212,7 +212,7 @@ bool GetIPList(std::vector &IP4s) { close(sd); return true; #else // Fallback to POSIX/Cross-platform way but may not works well on Linux (ie. only shows 127.0.0.1) - INFO_LOG(SCENET, "GetIPList from Fallback"); + INFO_LOG(Log::sceNet, "GetIPList from Fallback"); struct addrinfo hints, * res, * p; memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; // AF_INET or AF_INET6 to force version diff --git a/Common/Net/Sinks.cpp b/Common/Net/Sinks.cpp index 0d18cbaf09..d93f477f68 100644 --- a/Common/Net/Sinks.cpp +++ b/Common/Net/Sinks.cpp @@ -200,7 +200,7 @@ void InputSink::AccountFill(int bytes) { if (errno == EWOULDBLOCK || errno == EAGAIN) return; #endif - ERROR_LOG(IO, "Error reading from socket"); + ERROR_LOG(Log::IO, "Error reading from socket"); return; } @@ -321,10 +321,10 @@ bool OutputSink::Printf(const char *fmt, ...) { // Okay, did we actually write? if (result >= (int)avail) { // This means the result string was too big for the buffer. - ERROR_LOG(IO, "Not enough space to format output."); + ERROR_LOG(Log::IO, "Not enough space to format output."); return false; } else if (result < 0) { - ERROR_LOG(IO, "vsnprintf failed."); + ERROR_LOG(Log::IO, "vsnprintf failed."); return false; } @@ -407,7 +407,7 @@ void OutputSink::AccountDrain(int bytes) { if (errno == EWOULDBLOCK || errno == EAGAIN) return; #endif - ERROR_LOG(IO, "Error writing to socket"); + ERROR_LOG(Log::IO, "Error writing to socket"); return; } diff --git a/Common/Net/URL.cpp b/Common/Net/URL.cpp index 3280c39cc9..bef6efc2be 100644 --- a/Common/Net/URL.cpp +++ b/Common/Net/URL.cpp @@ -34,7 +34,7 @@ void UrlEncoder::AppendEscaped(const std::string &value) void Url::Split() { size_t colonSlashSlash = url_.find("://"); if (colonSlashSlash == std::string::npos) { - ERROR_LOG(IO, "Invalid URL: %s", url_.c_str()); + ERROR_LOG(Log::IO, "Invalid URL: %s", url_.c_str()); return; } diff --git a/Common/Profiler/Profiler.cpp b/Common/Profiler/Profiler.cpp index 7d59a9add7..c5829ea980 100644 --- a/Common/Profiler/Profiler.cpp +++ b/Common/Profiler/Profiler.cpp @@ -146,7 +146,7 @@ int internal_profiler_enter(const char *category_name, int *out_thread_id) { } internal_profiler_resume(thread_id, category, now); } else { - DEBUG_LOG(SYSTEM, "profiler: recursive enter (%i - %s)", category, category_name); + DEBUG_LOG(Log::System, "profiler: recursive enter (%i - %s)", category, category_name); } depth++; @@ -163,7 +163,7 @@ void internal_profiler_leave(int thread_id, int category) { int &depth = profiler.depth[thread_id]; if (category < 0 || category >= MAX_CATEGORIES) { - ERROR_LOG(SYSTEM, "Bad category index %d", category); + ERROR_LOG(Log::System, "Bad category index %d", category); depth--; return; } diff --git a/Common/Render/DrawBuffer.cpp b/Common/Render/DrawBuffer.cpp index 3bdf3552bd..63c06f4c98 100644 --- a/Common/Render/DrawBuffer.cpp +++ b/Common/Render/DrawBuffer.cpp @@ -69,7 +69,7 @@ void DrawBuffer::Flush(bool set_blend_state) { if (count_ == 0) return; if (!pipeline_) { - ERROR_LOG(G3D, "DrawBuffer: No program set, skipping flush!"); + ERROR_LOG(Log::G3D, "DrawBuffer: No program set, skipping flush!"); count_ = 0; return; } diff --git a/Common/Render/ManagedTexture.cpp b/Common/Render/ManagedTexture.cpp index 0bf8407219..deb3d4f4b1 100644 --- a/Common/Render/ManagedTexture.cpp +++ b/Common/Render/ManagedTexture.cpp @@ -32,7 +32,7 @@ public: size_t fileSize; uint8_t *buffer = g_VFS.ReadFile(filename_.c_str(), &fileSize); if (!buffer) { - ERROR_LOG(IO, "Failed to read file '%s'", filename_.c_str()); + ERROR_LOG(Log::IO, "Failed to read file '%s'", filename_.c_str()); filename_.clear(); *state_ = ManagedTexture::LoadState::FAILED; waitable_->Notify(); @@ -90,7 +90,7 @@ bool TempImage::LoadTextureLevelsFromFileData(const uint8_t *data, size_t size, typeSuggestion = DetectImageFileType(data, size); } if (typeSuggestion == ImageFileType::UNKNOWN) { - ERROR_LOG(G3D, "File (size: %d) has unknown format", (int)size); + ERROR_LOG(Log::G3D, "File (size: %d) has unknown format", (int)size); return false; } @@ -109,11 +109,11 @@ bool TempImage::LoadTextureLevelsFromFileData(const uint8_t *data, size_t size, numLevels = 1; fmt = Draw::DataFormat::R8G8B8A8_UNORM; if (!levels[0]) { - ERROR_LOG(IO, "pngLoadPtr failed (input size = %d)", (int)size); + ERROR_LOG(Log::IO, "pngLoadPtr failed (input size = %d)", (int)size); return false; } } else { - ERROR_LOG(IO, "PNG load failed"); + ERROR_LOG(Log::IO, "PNG load failed"); return false; } break; @@ -131,7 +131,7 @@ bool TempImage::LoadTextureLevelsFromFileData(const uint8_t *data, size_t size, } default: - ERROR_LOG(IO, "Unsupported image format %d", (int)type); + ERROR_LOG(Log::IO, "Unsupported image format %d", (int)type); return false; } @@ -144,7 +144,7 @@ Draw::Texture *CreateTextureFromTempImage(Draw::DrawContext *draw, const TempIma int numLevels = image.numLevels; if (numLevels < 0 || numLevels >= 16) { - ERROR_LOG(IO, "Invalid num_levels: %d. Falling back to one. Image: %dx%d", numLevels, image.width[0], image.height[0]); + ERROR_LOG(Log::IO, "Invalid num_levels: %d. Falling back to one. Image: %dx%d", numLevels, image.width[0], image.height[0]); numLevels = 1; } @@ -178,7 +178,7 @@ Draw::Texture *CreateTextureFromFile(Draw::DrawContext *draw, const char *filena size_t fileSize; uint8_t *buffer = g_VFS.ReadFile(filename, &fileSize); if (!buffer) { - ERROR_LOG(IO, "Failed to read file '%s'", filename); + ERROR_LOG(Log::IO, "Failed to read file '%s'", filename); return nullptr; } Draw::Texture *texture = CreateTextureFromFileData(draw, buffer, fileSize, type, generateMips, filename); @@ -228,7 +228,7 @@ void ManagedTexture::StartLoadTask() { } void ManagedTexture::DeviceLost() { - INFO_LOG(G3D, "ManagedTexture::DeviceLost(%s)", filename_.c_str()); + INFO_LOG(Log::G3D, "ManagedTexture::DeviceLost(%s)", filename_.c_str()); if (taskWaitable_) { taskWaitable_->WaitAndRelease(); taskWaitable_ = nullptr; @@ -243,13 +243,13 @@ void ManagedTexture::DeviceLost() { } void ManagedTexture::DeviceRestored(Draw::DrawContext *draw) { - INFO_LOG(G3D, "ManagedTexture::DeviceRestored(%s)", filename_.c_str()); + INFO_LOG(Log::G3D, "ManagedTexture::DeviceRestored(%s)", filename_.c_str()); draw_ = draw; _dbg_assert_(!texture_); if (texture_) { - ERROR_LOG(G3D, "ManagedTexture: Unexpected - texture already present: %s", filename_.c_str()); + ERROR_LOG(Log::G3D, "ManagedTexture: Unexpected - texture already present: %s", filename_.c_str()); return; } diff --git a/Common/Render/Text/draw_text.cpp b/Common/Render/Text/draw_text.cpp index 8303c2b6e1..020d777d47 100644 --- a/Common/Render/Text/draw_text.cpp +++ b/Common/Render/Text/draw_text.cpp @@ -179,7 +179,7 @@ void TextDrawer::OncePerFrame() { // If DPI changed (small-mode, future proper monitor DPI support), drop everything. float newDpiScale = CalculateDPIScale(); if (newDpiScale != dpiScale_) { - INFO_LOG(G3D, "DPI Scale changed (%f to %f) - wiping font cache (%d items)", dpiScale_, newDpiScale, (int)cache_.size()); + INFO_LOG(Log::G3D, "DPI Scale changed (%f to %f) - wiping font cache (%d items)", dpiScale_, newDpiScale, (int)cache_.size()); dpiScale_ = newDpiScale; ClearCache(); ClearFonts(); diff --git a/Common/Render/Text/draw_text_android.cpp b/Common/Render/Text/draw_text_android.cpp index 5f0a4bb264..df8da6a8b8 100644 --- a/Common/Render/Text/draw_text_android.cpp +++ b/Common/Render/Text/draw_text_android.cpp @@ -25,11 +25,11 @@ TextDrawerAndroid::TextDrawerAndroid(Draw::DrawContext *draw) : TextDrawer(draw) method_measureText = env->GetStaticMethodID(cls_textRenderer, "measureText", "(Ljava/lang/String;D)I"); method_renderText = env->GetStaticMethodID(cls_textRenderer, "renderText", "(Ljava/lang/String;D)[I"); } else { - ERROR_LOG(G3D, "Failed to find class: '%s'", textRendererClassName); + ERROR_LOG(Log::G3D, "Failed to find class: '%s'", textRendererClassName); } dpiScale_ = CalculateDPIScale(); - INFO_LOG(G3D, "Initializing TextDrawerAndroid with DPI scale %f", dpiScale_); + INFO_LOG(Log::G3D, "Initializing TextDrawerAndroid with DPI scale %f", dpiScale_); } TextDrawerAndroid::~TextDrawerAndroid() { @@ -71,7 +71,7 @@ void TextDrawerAndroid::SetFont(uint32_t fontHandle) { if (iter != fontMap_.end()) { fontHash_ = fontHandle; } else { - ERROR_LOG(G3D, "Invalid font handle %08x", fontHandle); + ERROR_LOG(Log::G3D, "Invalid font handle %08x", fontHandle); } } @@ -93,7 +93,7 @@ void TextDrawerAndroid::MeasureString(std::string_view str, float *w, float *h) if (iter != fontMap_.end()) { scaledSize = iter->second.size; } else { - ERROR_LOG(G3D, "Missing font"); + ERROR_LOG(Log::G3D, "Missing font"); } std::string text(str); auto env = getEnv(); @@ -123,7 +123,7 @@ bool TextDrawerAndroid::DrawStringBitmap(std::vector &bitmapData, TextS if (iter != fontMap_.end()) { size = iter->second.size; } else { - ERROR_LOG(G3D, "Missing font"); + ERROR_LOG(Log::G3D, "Missing font"); } auto env = getEnv(); diff --git a/Common/Render/Text/draw_text_cocoa.mm b/Common/Render/Text/draw_text_cocoa.mm index 2ee51c8d60..52b615172c 100644 --- a/Common/Render/Text/draw_text_cocoa.mm +++ b/Common/Render/Text/draw_text_cocoa.mm @@ -43,7 +43,7 @@ public: void Create() { // Create an attributed string with string and font information CGFloat fontSize = ceilf((height / dpiScale) * 1.25f); - INFO_LOG(G3D, "Creating cocoa typeface '%s' size %d (effective size %0.1f)", APPLE_FONT, height, fontSize); + INFO_LOG(Log::G3D, "Creating cocoa typeface '%s' size %d (effective size %0.1f)", APPLE_FONT, height, fontSize); // CTFontRef font = CTFontCreateWithName(CFSTR(APPLE_FONT), fontSize, nil); CTFontRef font = CTFontCreateUIFontForLanguage(kCTFontUIFontSystem, fontSize, nil); attributes = [NSDictionary dictionaryWithObjectsAndKeys: @@ -125,7 +125,7 @@ void TextDrawerCocoa::MeasureString(std::string_view str, float *w, float *h) { if (iter != sizeCache_.end()) { entry = iter->second.get(); } else { - // INFO_LOG(SYSTEM, "Measuring %.*s", (int)str.length(), str.data()); + // INFO_LOG(Log::System, "Measuring %.*s", (int)str.length(), str.data()); auto iter = fontMap_.find(fontHash_); NSDictionary *attributes = nil; @@ -174,7 +174,7 @@ bool TextDrawerCocoa::DrawStringBitmap(std::vector &bitmapData, TextStr return false; } - // INFO_LOG(SYSTEM, "Rasterizing %.*s", (int)str.length(), str.data()); + // INFO_LOG(Log::System, "Rasterizing %.*s", (int)str.length(), str.data()); NSString* string = [[NSString alloc] initWithBytes:str.data() length:str.length() encoding: NSUTF8StringEncoding]; @@ -192,7 +192,7 @@ bool TextDrawerCocoa::DrawStringBitmap(std::vector &bitmapData, TextStr int width = (int)ceilf(w); int height = (int)ceilf(h); if (width <= 0 || height <= 0) { - WARN_LOG(G3D, "Text '%.*s' caused a zero size image", (int)str.length(), str.data()); + WARN_LOG(Log::G3D, "Text '%.*s' caused a zero size image", (int)str.length(), str.data()); return false; } diff --git a/Common/Render/Text/draw_text_qt.cpp b/Common/Render/Text/draw_text_qt.cpp index 0e3a112184..050761c6e8 100644 --- a/Common/Render/Text/draw_text_qt.cpp +++ b/Common/Render/Text/draw_text_qt.cpp @@ -47,7 +47,7 @@ void TextDrawerQt::SetFont(uint32_t fontHandle) { if (iter != fontMap_.end()) { fontHash_ = fontHandle; } else { - ERROR_LOG(G3D, "Invalid font handle %08x", fontHandle); + ERROR_LOG(Log::G3D, "Invalid font handle %08x", fontHandle); } } diff --git a/Common/Render/Text/draw_text_sdl.cpp b/Common/Render/Text/draw_text_sdl.cpp index a1da471141..cc194cb654 100644 --- a/Common/Render/Text/draw_text_sdl.cpp +++ b/Common/Render/Text/draw_text_sdl.cpp @@ -32,7 +32,7 @@ static std::string getlocale() { TextDrawerSDL::TextDrawerSDL(Draw::DrawContext *draw): TextDrawer(draw) { if (TTF_Init() < 0) { - ERROR_LOG(G3D, "Unable to initialize SDL2_ttf"); + ERROR_LOG(Log::G3D, "Unable to initialize SDL2_ttf"); } dpiScale_ = CalculateDPIScale(); @@ -275,7 +275,7 @@ void TextDrawerSDL::SetFont(uint32_t fontHandle) { if (iter != fontMap_.end()) { fontHash_ = fontHandle; } else { - ERROR_LOG(G3D, "Invalid font handle %08x", fontHandle); + ERROR_LOG(Log::G3D, "Invalid font handle %08x", fontHandle); } } diff --git a/Common/Render/Text/draw_text_uwp.cpp b/Common/Render/Text/draw_text_uwp.cpp index b61541da91..aba313ff96 100644 --- a/Common/Render/Text/draw_text_uwp.cpp +++ b/Common/Render/Text/draw_text_uwp.cpp @@ -48,7 +48,7 @@ public: &textFmt ); if (FAILED(hr)) { - ERROR_LOG(G3D, "Failed creating font %s", fname.c_str()); + ERROR_LOG(Log::G3D, "Failed creating font %s", fname.c_str()); } } void Destroy() { @@ -106,9 +106,9 @@ TextDrawerUWP::TextDrawerUWP(Draw::DrawContext *draw) : TextDrawer(draw), ctx_(n // Load the Roboto font hr = m_dwriteFactory->CreateFontFileReference(L"Content/Roboto-Condensed.ttf", nullptr, &m_fontFile); - if (FAILED(hr)) ERROR_LOG(SYSTEM, "CreateFontFileReference failed"); + if (FAILED(hr)) ERROR_LOG(Log::System, "CreateFontFileReference failed"); hr = m_dwriteFactory->CreateFontSetBuilder(&m_fontSetBuilder); - if (FAILED(hr)) ERROR_LOG(SYSTEM, "CreateFontSetBuilder failed"); + if (FAILED(hr)) ERROR_LOG(Log::System, "CreateFontSetBuilder failed"); hr = m_fontSetBuilder->AddFontFile(m_fontFile); hr = m_fontSetBuilder->CreateFontSet(&m_fontSet); hr = m_dwriteFactory->CreateFontCollectionFromFontSet(m_fontSet, &m_fontCollection); diff --git a/Common/RiscVEmitter.cpp b/Common/RiscVEmitter.cpp index 08cc327105..f90f7d04c1 100644 --- a/Common/RiscVEmitter.cpp +++ b/Common/RiscVEmitter.cpp @@ -121,7 +121,7 @@ enum class Opcode32 { BRANCH = 0b1100011, JALR = 0b1100111, JAL = 0b1101111, - SYSTEM = 0b1110011, + System = 0b1110011, }; enum class Opcode16 { @@ -1853,11 +1853,11 @@ void RiscVEmitter::FENCE_TSO() { } void RiscVEmitter::ECALL() { - Write32(EncodeI(Opcode32::SYSTEM, R_ZERO, Funct3::PRIV, R_ZERO, Funct12::ECALL)); + Write32(EncodeI(Opcode32::System, R_ZERO, Funct3::PRIV, R_ZERO, Funct12::ECALL)); } void RiscVEmitter::EBREAK() { - Write32(EncodeI(Opcode32::SYSTEM, R_ZERO, Funct3::PRIV, R_ZERO, Funct12::EBREAK)); + Write32(EncodeI(Opcode32::System, R_ZERO, Funct3::PRIV, R_ZERO, Funct12::EBREAK)); } void RiscVEmitter::LWU(RiscVReg rd, RiscVReg rs1, s32 simm12) { @@ -2506,40 +2506,40 @@ void RiscVEmitter::QuickFLI(int bits, RiscVReg rd, float v, RiscVReg scratchReg) void RiscVEmitter::CSRRW(RiscVReg rd, Csr csr, RiscVReg rs1) { _assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__); _assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__); - Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRW, rs1, (Funct12)csr)); + Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRW, rs1, (Funct12)csr)); } void RiscVEmitter::CSRRS(RiscVReg rd, Csr csr, RiscVReg rs1) { _assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__); _assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__); - Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRS, rs1, (Funct12)csr)); + Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRS, rs1, (Funct12)csr)); } void RiscVEmitter::CSRRC(RiscVReg rd, Csr csr, RiscVReg rs1) { _assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__); _assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__); - Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRC, rs1, (Funct12)csr)); + Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRC, rs1, (Funct12)csr)); } void RiscVEmitter::CSRRWI(RiscVReg rd, Csr csr, u8 uimm5) { _assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__); _assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__); _assert_msg_((u32)uimm5 <= 0x1F, "%s can only specify lowest 5 bits", __func__); - Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRWI, (RiscVReg)uimm5, (Funct12)csr)); + Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRWI, (RiscVReg)uimm5, (Funct12)csr)); } void RiscVEmitter::CSRRSI(RiscVReg rd, Csr csr, u8 uimm5) { _assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__); _assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__); _assert_msg_((u32)uimm5 <= 0x1F, "%s can only set lowest 5 bits", __func__); - Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRSI, (RiscVReg)uimm5, (Funct12)csr)); + Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRSI, (RiscVReg)uimm5, (Funct12)csr)); } void RiscVEmitter::CSRRCI(RiscVReg rd, Csr csr, u8 uimm5) { _assert_msg_(SupportsZicsr(), "%s instruction not supported", __func__); _assert_msg_((u32)csr <= 0x00000FFF, "%s with invalid CSR number", __func__); _assert_msg_((u32)uimm5 <= 0x1F, "%s can only clear lowest 5 bits", __func__); - Write32(EncodeGI(Opcode32::SYSTEM, rd, Funct3::CSRRCI, (RiscVReg)uimm5, (Funct12)csr)); + Write32(EncodeGI(Opcode32::System, rd, Funct3::CSRRCI, (RiscVReg)uimm5, (Funct12)csr)); } void RiscVEmitter::VSETVLI(RiscVReg rd, RiscVReg rs1, VType vtype) { diff --git a/Common/Serialize/SerializeList.h b/Common/Serialize/SerializeList.h index ae0fc2edc9..d42ddc80f5 100644 --- a/Common/Serialize/SerializeList.h +++ b/Common/Serialize/SerializeList.h @@ -75,7 +75,7 @@ void DoLinkedList(PointerWrap &p, LinkedListItem *&list_start, LinkedListItem } } else { if (shouldExist != 0) { - WARN_LOG(SAVESTATE, "Savestate failure: incorrect item marker %d", shouldExist); + WARN_LOG(Log::SaveState, "Savestate failure: incorrect item marker %d", shouldExist); p.SetError(p.ERROR_FAILURE); } if (p.mode == PointerWrap::MODE_READ) { diff --git a/Common/Serialize/Serializer.cpp b/Common/Serialize/Serializer.cpp index 71f5168c3b..eee85133ab 100644 --- a/Common/Serialize/Serializer.cpp +++ b/Common/Serialize/Serializer.cpp @@ -46,11 +46,11 @@ bool PointerWrap::CheckAfterWrite() { _assert_(error != ERROR_NONE || mode == MODE_WRITE); size_t offset = Offset(); if (measuredSize_ != 0 && offset != measuredSize_) { - WARN_LOG(SAVESTATE, "CheckAfterWrite: Size mismatch! %d but expected %d", (int)offset, (int)measuredSize_); + WARN_LOG(Log::SaveState, "CheckAfterWrite: Size mismatch! %d but expected %d", (int)offset, (int)measuredSize_); return false; } if (!checkpoints_.empty() && curCheckpoint_ != checkpoints_.size()) { - WARN_LOG(SAVESTATE, "Checkpoint count mismatch!"); + WARN_LOG(Log::SaveState, "Checkpoint count mismatch!"); return false; } return true; @@ -71,20 +71,20 @@ PointerWrapSection PointerWrap::Section(const char *title, int minVer, int ver) } else if (mode == MODE_WRITE) { if (!checkpoints_.empty()) { if (checkpoints_.size() <= curCheckpoint_) { - WARN_LOG(SAVESTATE, "Write: Not enough checkpoints from measure pass (%d). cur section: %s", (int)checkpoints_.size(), title); + WARN_LOG(Log::SaveState, "Write: Not enough checkpoints from measure pass (%d). cur section: %s", (int)checkpoints_.size(), title); SetError(ERROR_FAILURE); return PointerWrapSection(*this, -1, title); } if (!checkpoints_[curCheckpoint_].Matches(marker, offset)) { - WARN_LOG(SAVESTATE, "Checkpoint mismatch during write! Section %s but expected %s, offset %d but expected %d", title, marker, (int)offset, (int)checkpoints_[curCheckpoint_].offset); + WARN_LOG(Log::SaveState, "Checkpoint mismatch during write! Section %s but expected %s, offset %d but expected %d", title, marker, (int)offset, (int)checkpoints_[curCheckpoint_].offset); if (curCheckpoint_ > 1) { - WARN_LOG(SAVESTATE, "Previous checkpoint: %s (%d)", checkpoints_[curCheckpoint_ - 1].title, (int)checkpoints_[curCheckpoint_ - 1].offset); + WARN_LOG(Log::SaveState, "Previous checkpoint: %s (%d)", checkpoints_[curCheckpoint_ - 1].title, (int)checkpoints_[curCheckpoint_ - 1].offset); } SetError(ERROR_FAILURE); return PointerWrapSection(*this, -1, title); } } else { - WARN_LOG(SAVESTATE, "Writing savestate without checkpoints. This is OK but should be fixed."); + WARN_LOG(Log::SaveState, "Writing savestate without checkpoints. This is OK but should be fixed."); } curCheckpoint_++; } @@ -106,7 +106,7 @@ PointerWrapSection PointerWrap::Section(const char *title, int minVer, int ver) firstBadSectionTitle_ = title; } if (mode != MODE_NOOP) { - WARN_LOG(SAVESTATE, "Savestate failure: wrong version %d found for section '%s'", foundVersion, title); + WARN_LOG(Log::SaveState, "Savestate failure: wrong version %d found for section '%s'", foundVersion, title); SetError(ERROR_FAILURE); } return PointerWrapSection(*this, -1, title); @@ -162,7 +162,7 @@ void Do(PointerWrap &p, std::string &x) { Do(p, stringLen); if (stringLen < 0 || stringLen > MAX_SANE_STRING_LENGTH) { - WARN_LOG(SAVESTATE, "Savestate failure: bad stringLen %d", stringLen); + WARN_LOG(Log::SaveState, "Savestate failure: bad stringLen %d", stringLen); p.SetError(PointerWrap::ERROR_FAILURE); return; } @@ -182,7 +182,7 @@ void Do(PointerWrap &p, std::wstring &x) { Do(p, stringLen); if (stringLen < 0 || stringLen > MAX_SANE_STRING_LENGTH) { - WARN_LOG(SAVESTATE, "Savestate failure: bad stringLen %d", stringLen); + WARN_LOG(Log::SaveState, "Savestate failure: bad stringLen %d", stringLen); p.SetError(PointerWrap::ERROR_FAILURE); return; } @@ -210,7 +210,7 @@ void Do(PointerWrap &p, std::u16string &x) { Do(p, stringLen); if (stringLen < 0 || stringLen > MAX_SANE_STRING_LENGTH) { - WARN_LOG(SAVESTATE, "Savestate failure: bad stringLen %d", stringLen); + WARN_LOG(Log::SaveState, "Savestate failure: bad stringLen %d", stringLen); p.SetError(PointerWrap::ERROR_FAILURE); return; } @@ -271,7 +271,7 @@ void PointerWrap::DoMarker(const char *prevName, u32 arbitraryNumber) { u32 cookie = arbitraryNumber; Do(*this, cookie); if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) { - ERROR_LOG(SAVESTATE, "Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", prevName, cookie, cookie, arbitraryNumber, arbitraryNumber); + ERROR_LOG(Log::SaveState, "Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", prevName, cookie, cookie, arbitraryNumber, arbitraryNumber); SetError(ERROR_FAILURE); } } @@ -284,31 +284,31 @@ PointerWrapSection::~PointerWrapSection() { CChunkFileReader::Error CChunkFileReader::LoadFileHeader(File::IOFile &pFile, SChunkHeader &header, std::string *title) { if (!pFile) { - ERROR_LOG(SAVESTATE, "ChunkReader: Can't open file for reading"); + ERROR_LOG(Log::SaveState, "ChunkReader: Can't open file for reading"); return ERROR_BAD_FILE; } const u64 fileSize = pFile.GetSize(); u64 headerSize = sizeof(SChunkHeader); if (fileSize < headerSize) { - ERROR_LOG(SAVESTATE, "ChunkReader: File too small"); + ERROR_LOG(Log::SaveState, "ChunkReader: File too small"); return ERROR_BAD_FILE; } if (!pFile.ReadArray(&header, 1)) { - ERROR_LOG(SAVESTATE, "ChunkReader: Bad header size"); + ERROR_LOG(Log::SaveState, "ChunkReader: Bad header size"); return ERROR_BAD_FILE; } if (header.Revision < REVISION_MIN) { - ERROR_LOG(SAVESTATE, "ChunkReader: Wrong file revision, got %d expected >= %d", header.Revision, REVISION_MIN); + ERROR_LOG(Log::SaveState, "ChunkReader: Wrong file revision, got %d expected >= %d", header.Revision, REVISION_MIN); return ERROR_BAD_FILE; } if (header.Revision >= REVISION_TITLE) { char titleFixed[128]; if (!pFile.ReadArray(titleFixed, sizeof(titleFixed))) { - ERROR_LOG(SAVESTATE, "ChunkReader: Unable to read title"); + ERROR_LOG(Log::SaveState, "ChunkReader: Unable to read title"); return ERROR_BAD_FILE; } @@ -323,7 +323,7 @@ CChunkFileReader::Error CChunkFileReader::LoadFileHeader(File::IOFile &pFile, SC u32 sz = (u32)(fileSize - headerSize); if (header.ExpectedSize != sz) { - ERROR_LOG(SAVESTATE, "ChunkReader: Bad file size, got %u expected %u", sz, header.ExpectedSize); + ERROR_LOG(Log::SaveState, "ChunkReader: Bad file size, got %u expected %u", sz, header.ExpectedSize); return ERROR_BAD_FILE; } @@ -332,7 +332,7 @@ CChunkFileReader::Error CChunkFileReader::LoadFileHeader(File::IOFile &pFile, SC CChunkFileReader::Error CChunkFileReader::GetFileTitle(const Path &filename, std::string *title) { if (!File::Exists(filename)) { - ERROR_LOG(SAVESTATE, "ChunkReader: File doesn't exist"); + ERROR_LOG(Log::SaveState, "ChunkReader: File doesn't exist"); return ERROR_BAD_FILE; } @@ -344,7 +344,7 @@ CChunkFileReader::Error CChunkFileReader::GetFileTitle(const Path &filename, std CChunkFileReader::Error CChunkFileReader::LoadFile(const Path &filename, std::string *gitVersion, u8 *&_buffer, size_t &sz, std::string *failureReason) { if (!File::Exists(filename)) { *failureReason = "LoadStateDoesntExist"; - ERROR_LOG(SAVESTATE, "ChunkReader: File doesn't exist"); + ERROR_LOG(Log::SaveState, "ChunkReader: File doesn't exist"); return ERROR_BAD_FILE; } @@ -360,7 +360,7 @@ CChunkFileReader::Error CChunkFileReader::LoadFile(const Path &filename, std::st u8 *buffer = new u8[sz]; if (!pFile.ReadBytes(buffer, sz)) { - ERROR_LOG(SAVESTATE, "ChunkReader: Error reading file"); + ERROR_LOG(Log::SaveState, "ChunkReader: Error reading file"); delete [] buffer; return ERROR_BAD_FILE; } @@ -379,16 +379,16 @@ CChunkFileReader::Error CChunkFileReader::LoadFile(const Path &filename, std::st uncomp_size = status; } } else { - ERROR_LOG(SAVESTATE, "ChunkReader: Unexpected compression type %d", header.Compress); + ERROR_LOG(Log::SaveState, "ChunkReader: Unexpected compression type %d", header.Compress); } if (!success) { - ERROR_LOG(SAVESTATE, "ChunkReader: Failed to decompress file"); + ERROR_LOG(Log::SaveState, "ChunkReader: Failed to decompress file"); delete [] uncomp_buffer; delete [] buffer; return ERROR_BAD_FILE; } if ((u32)uncomp_size != header.UncompressedSize) { - ERROR_LOG(SAVESTATE, "Size mismatch: file: %u calc: %u", header.UncompressedSize, (u32)uncomp_size); + ERROR_LOG(Log::SaveState, "Size mismatch: file: %u calc: %u", header.UncompressedSize, (u32)uncomp_size); delete [] uncomp_buffer; delete [] buffer; return ERROR_BAD_FILE; @@ -411,11 +411,11 @@ CChunkFileReader::Error CChunkFileReader::LoadFile(const Path &filename, std::st // Takes ownership of buffer. CChunkFileReader::Error CChunkFileReader::SaveFile(const Path &filename, const std::string &title, const char *gitVersion, u8 *buffer, size_t sz) { - INFO_LOG(SAVESTATE, "ChunkReader: Writing %s", filename.c_str()); + INFO_LOG(Log::SaveState, "ChunkReader: Writing %s", filename.c_str()); File::IOFile pFile(filename, "wb"); if (!pFile) { - ERROR_LOG(SAVESTATE, "ChunkReader: Error opening file for write"); + ERROR_LOG(Log::SaveState, "ChunkReader: Error opening file for write"); free(buffer); return ERROR_BAD_FILE; } @@ -438,7 +438,7 @@ CChunkFileReader::Error CChunkFileReader::SaveFile(const Path &filename, const s u8 *write_buffer = buffer; if (!compressed_buffer) { if (write_len != 0) - ERROR_LOG(SAVESTATE, "ChunkReader: Unable to allocate compressed buffer"); + ERROR_LOG(Log::SaveState, "ChunkReader: Unable to allocate compressed buffer"); // We'll save uncompressed. Better than not saving... write_len = sz; usedType = SerializeCompressType::NONE; @@ -473,7 +473,7 @@ CChunkFileReader::Error CChunkFileReader::SaveFile(const Path &filename, const s free(buffer); write_buffer = compressed_buffer; } else { - ERROR_LOG(SAVESTATE, "ChunkReader: Compression failed"); + ERROR_LOG(Log::SaveState, "ChunkReader: Compression failed"); free(compressed_buffer); // We can still save uncompressed. @@ -496,25 +496,25 @@ CChunkFileReader::Error CChunkFileReader::SaveFile(const Path &filename, const s // Now let's start writing out the file... if (!pFile.WriteArray(&header, 1)) { - ERROR_LOG(SAVESTATE, "ChunkReader: Failed writing header"); + ERROR_LOG(Log::SaveState, "ChunkReader: Failed writing header"); free(write_buffer); return ERROR_BAD_FILE; } if (!pFile.WriteArray(titleFixed, sizeof(titleFixed))) { - ERROR_LOG(SAVESTATE, "ChunkReader: Failed writing title"); + ERROR_LOG(Log::SaveState, "ChunkReader: Failed writing title"); free(write_buffer); return ERROR_BAD_FILE; } if (!pFile.WriteBytes(write_buffer, write_len)) { - ERROR_LOG(SAVESTATE, "ChunkReader: Failed writing compressed data"); + ERROR_LOG(Log::SaveState, "ChunkReader: Failed writing compressed data"); free(write_buffer); return ERROR_BAD_FILE; } else if (sz != write_len) { - INFO_LOG(SAVESTATE, "Savestate: Compressed %i bytes into %i", (int)sz, (int)write_len); + INFO_LOG(Log::SaveState, "Savestate: Compressed %i bytes into %i", (int)sz, (int)write_len); } free(write_buffer); - INFO_LOG(SAVESTATE, "ChunkReader: Done writing %s", filename.c_str()); + INFO_LOG(Log::SaveState, "ChunkReader: Done writing %s", filename.c_str()); return ERROR_NONE; } diff --git a/Common/Serialize/Serializer.h b/Common/Serialize/Serializer.h index 808967b518..9e39cfdb81 100644 --- a/Common/Serialize/Serializer.h +++ b/Common/Serialize/Serializer.h @@ -269,9 +269,9 @@ public: failureReason->clear(); error = LoadPtr(ptr, _class, failureReason); delete [] ptr; - INFO_LOG(SAVESTATE, "ChunkReader: Done loading '%s'", filename.c_str()); + INFO_LOG(Log::SaveState, "ChunkReader: Done loading '%s'", filename.c_str()); } else { - WARN_LOG(SAVESTATE, "ChunkReader: Error found during load of '%s'", filename.c_str()); + WARN_LOG(Log::SaveState, "ChunkReader: Error found during load of '%s'", filename.c_str()); } return error; } diff --git a/Common/System/Request.cpp b/Common/System/Request.cpp index 436a02d216..23f15f796e 100644 --- a/Common/System/Request.cpp +++ b/Common/System/Request.cpp @@ -48,7 +48,7 @@ bool RequestManager::MakeSystemRequest(SystemRequestType type, RequesterToken to callbackMap_[requestId] = { callback, failedCallback, token }; } - VERBOSE_LOG(SYSTEM, "Making system request %s: id %d", RequestTypeAsString(type), requestId); + VERBOSE_LOG(Log::System, "Making system request %s: id %d", RequestTypeAsString(type), requestId); std::string p1(param1); std::string p2(param2); // TODO: Convert to string_view @@ -65,7 +65,7 @@ bool RequestManager::MakeSystemRequest(SystemRequestType type, RequesterToken to void RequestManager::ForgetRequestsWithToken(RequesterToken token) { for (auto &iter : callbackMap_) { if (iter.second.token == token) { - INFO_LOG(SYSTEM, "Forgetting about requester with token %d", token); + INFO_LOG(Log::System, "Forgetting about requester with token %d", token); iter.second.callback = nullptr; iter.second.failedCallback = nullptr; } @@ -76,7 +76,7 @@ void RequestManager::PostSystemSuccess(int requestId, const char *responseString std::lock_guard guard(callbackMutex_); auto iter = callbackMap_.find(requestId); if (iter == callbackMap_.end()) { - ERROR_LOG(SYSTEM, "PostSystemSuccess: Unexpected request ID %d (responseString=%s)", requestId, responseString); + ERROR_LOG(Log::System, "PostSystemSuccess: Unexpected request ID %d (responseString=%s)", requestId, responseString); return; } @@ -86,7 +86,7 @@ void RequestManager::PostSystemSuccess(int requestId, const char *responseString response.responseString = responseString; response.responseValue = responseValue; pendingSuccesses_.push_back(response); - DEBUG_LOG(SYSTEM, "PostSystemSuccess: Request %d (%s, %d)", requestId, responseString, responseValue); + DEBUG_LOG(Log::System, "PostSystemSuccess: Request %d (%s, %d)", requestId, responseString, responseValue); callbackMap_.erase(iter); } @@ -94,11 +94,11 @@ void RequestManager::PostSystemFailure(int requestId) { std::lock_guard guard(callbackMutex_); auto iter = callbackMap_.find(requestId); if (iter == callbackMap_.end()) { - ERROR_LOG(SYSTEM, "PostSystemFailure: Unexpected request ID %d", requestId); + ERROR_LOG(Log::System, "PostSystemFailure: Unexpected request ID %d", requestId); return; } - WARN_LOG(SYSTEM, "PostSystemFailure: Request %d failed", requestId); + WARN_LOG(Log::System, "PostSystemFailure: Request %d failed", requestId); std::lock_guard responseGuard(responseMutex_); PendingFailure response; diff --git a/Common/Thread/ThreadManager.cpp b/Common/Thread/ThreadManager.cpp index 7bacb69494..f1224a64a8 100644 --- a/Common/Thread/ThreadManager.cpp +++ b/Common/Thread/ThreadManager.cpp @@ -99,7 +99,7 @@ void ThreadManager::Teardown() { global_->threads_.clear(); if (global_->compute_queue_size > 0 || global_->io_queue_size > 0) { - WARN_LOG(SYSTEM, "ThreadManager::Teardown() with tasks still enqueued"); + WARN_LOG(Log::System, "ThreadManager::Teardown() with tasks still enqueued"); } } @@ -222,7 +222,7 @@ void ThreadManager::Init(int numRealCores, int numLogicalCoresPerCpu) { int numThreads = numComputeThreads_ + std::max(MIN_IO_BLOCKING_THREADS, numComputeThreads_); numThreads_ = numThreads; - INFO_LOG(SYSTEM, "ThreadManager::Init(compute threads: %d, all: %d)", numComputeThreads_, numThreads_); + INFO_LOG(Log::System, "ThreadManager::Init(compute threads: %d, all: %d)", numComputeThreads_, numThreads_); for (int i = 0; i < numThreads; i++) { TaskThreadContext *thread = new TaskThreadContext(); diff --git a/Common/Thread/ThreadUtil.cpp b/Common/Thread/ThreadUtil.cpp index 338dfa1a86..0e0badb084 100644 --- a/Common/Thread/ThreadUtil.cpp +++ b/Common/Thread/ThreadUtil.cpp @@ -218,7 +218,7 @@ void SetCurrentThreadNameThroughException(const char *threadName) { void AssertCurrentThreadName(const char *threadName) { #ifdef TLS_SUPPORTED if (strcmp(curThreadName, threadName) != 0) { - ERROR_LOG(SYSTEM, "Thread name assert failed: Expected %s, was %s", threadName, curThreadName); + ERROR_LOG(Log::System, "Thread name assert failed: Expected %s, was %s", threadName, curThreadName); } #endif } diff --git a/Common/UI/Context.cpp b/Common/UI/Context.cpp index 775c01fa18..bab93547e0 100644 --- a/Common/UI/Context.cpp +++ b/Common/UI/Context.cpp @@ -59,7 +59,7 @@ void UIContext::BeginFrame() { // Load the smaller ascii font only, like on Android. For debug ui etc. fontTexture_ = CreateTextureFromFile(draw_, "asciifont_atlas.zim", ImageFileType::ZIM, false); if (!fontTexture_) { - WARN_LOG(SYSTEM, "Failed to load font_atlas.zim or asciifont_atlas.zim"); + WARN_LOG(Log::System, "Failed to load font_atlas.zim or asciifont_atlas.zim"); } } } @@ -171,7 +171,7 @@ void UIContext::ActivateTopScissor() { int w = std::max(0.0f, ceilf(scale_x * bounds.w)); int h = std::max(0.0f, ceilf(scale_y * bounds.h)); if (x < 0 || y < 0 || x + w > g_display.pixel_xres || y + h > g_display.pixel_yres) { - DEBUG_LOG(G3D, "UI scissor out of bounds: %d,%d-%d,%d / %d,%d", x, y, w, h, g_display.pixel_xres, g_display.pixel_yres); + DEBUG_LOG(Log::G3D, "UI scissor out of bounds: %d,%d-%d,%d / %d,%d", x, y, w, h, g_display.pixel_xres, g_display.pixel_yres); if (x < 0) { w += x; x = 0; } if (y < 0) { h += y; y = 0; } if (x >= g_display.pixel_xres) { x = g_display.pixel_xres - 1; } diff --git a/Common/UI/IconCache.cpp b/Common/UI/IconCache.cpp index 7b5bd0a8b8..125f7cc32c 100644 --- a/Common/UI/IconCache.cpp +++ b/Common/UI/IconCache.cpp @@ -242,7 +242,7 @@ bool IconCache::InsertIcon(const std::string &key, IconFormat format, std::strin if (data.empty()) { _dbg_assert_(false); - ERROR_LOG(G3D, "Can't insert empty data into icon cache"); + ERROR_LOG(Log::G3D, "Can't insert empty data into icon cache"); return false; } @@ -253,7 +253,7 @@ bool IconCache::InsertIcon(const std::string &key, IconFormat format, std::strin } if (data.size() > 1024 * 512) { - WARN_LOG(G3D, "Unusually large icon inserted in icon cache: %s (%d bytes)", key.c_str(), (int)data.size()); + WARN_LOG(Log::G3D, "Unusually large icon inserted in icon cache: %s (%d bytes)", key.c_str(), (int)data.size()); } pending_.erase(key); @@ -299,7 +299,7 @@ Draw::Texture *IconCache::BindIconTexture(UIContext *context, const std::string &height, &buffer); if (result != 1) { - ERROR_LOG(G3D, "IconCache: Failed to load png (%d bytes) for key %s", (int)iter->second.data.size(), key.c_str()); + ERROR_LOG(Log::G3D, "IconCache: Failed to load png (%d bytes) for key %s", (int)iter->second.data.size(), key.c_str()); iter->second.badData = true; return nullptr; } diff --git a/Common/UI/Root.cpp b/Common/UI/Root.cpp index 9bb84218bf..41dadf3d16 100644 --- a/Common/UI/Root.cpp +++ b/Common/UI/Root.cpp @@ -98,7 +98,7 @@ bool IsFocusMovementEnabled() { void LayoutViewHierarchy(const UIContext &dc, ViewGroup *root, bool ignoreInsets) { if (!root) { - ERROR_LOG(SYSTEM, "Tried to layout a view hierarchy from a zero pointer root"); + ERROR_LOG(Log::System, "Tried to layout a view hierarchy from a zero pointer root"); return; } @@ -378,7 +378,7 @@ void UpdateViewHierarchy(ViewGroup *root) { frameCount++; if (!root) { - ERROR_LOG(SYSTEM, "Tried to update a view hierarchy from a zero pointer root"); + ERROR_LOG(Log::System, "Tried to update a view hierarchy from a zero pointer root"); return; } diff --git a/Common/UI/Screen.cpp b/Common/UI/Screen.cpp index 0ffb30b16d..05a6c155c4 100644 --- a/Common/UI/Screen.cpp +++ b/Common/UI/Screen.cpp @@ -19,7 +19,7 @@ void Screen::focusChanged(ScreenFocusChange focusChange) { case ScreenFocusChange::FOCUS_LOST_TOP: eventName = "FOCUS_LOST_TOP"; break; case ScreenFocusChange::FOCUS_BECAME_TOP: eventName = "FOCUS_BECAME_TOP"; break; } - DEBUG_LOG(SYSTEM, "Screen %s got %s", this->tag(), eventName); + DEBUG_LOG(Log::System, "Screen %s got %s", this->tag(), eventName); } int Screen::GetRequesterToken() { @@ -45,7 +45,7 @@ void ScreenManager::switchScreen(Screen *screen) { // TODO: inputLock_ ? if (!nextStack_.empty() && screen == nextStack_.front().screen) { - ERROR_LOG(SYSTEM, "Already switching to this screen"); + ERROR_LOG(Log::System, "Already switching to this screen"); return; } // Note that if a dialog is found, this will be a silent background switch that @@ -53,12 +53,12 @@ void ScreenManager::switchScreen(Screen *screen) { // until that switch. // TODO: is this still true? if (!nextStack_.empty()) { - ERROR_LOG(SYSTEM, "Already had a nextStack_! Asynchronous open while doing something? Deleting the new screen."); + ERROR_LOG(Log::System, "Already had a nextStack_! Asynchronous open while doing something? Deleting the new screen."); delete screen; return; } if (screen == nullptr) { - WARN_LOG(SYSTEM, "Switching to a zero screen, this can't be good"); + WARN_LOG(Log::System, "Switching to a zero screen, this can't be good"); } if (stack_.empty() || screen != stack_.back().screen) { screen->setScreenManager(this); @@ -85,7 +85,7 @@ void ScreenManager::update() { void ScreenManager::switchToNext() { std::lock_guard guard(inputLock_); if (nextStack_.empty()) { - ERROR_LOG(SYSTEM, "switchToNext: No nextStack_!"); + ERROR_LOG(Log::System, "switchToNext: No nextStack_!"); } Layer temp = {nullptr, 0}; @@ -161,7 +161,7 @@ void ScreenManager::deviceRestored() { } void ScreenManager::resized() { - INFO_LOG(SYSTEM, "ScreenManager::resized(dp: %dx%d)", g_display.dp_xres, g_display.dp_yres); + INFO_LOG(Log::System, "ScreenManager::resized(dp: %dx%d)", g_display.dp_xres, g_display.dp_yres); std::lock_guard guard(inputLock_); // Have to notify the whole stack, otherwise there will be problems when going back // to non-top screens. @@ -238,7 +238,7 @@ ScreenRenderFlags ScreenManager::render() { postRenderCb_(getUIContext(), postRenderUserdata_); } } else { - ERROR_LOG(SYSTEM, "No current screen!"); + ERROR_LOG(Log::System, "No current screen!"); } processFinishDialog(); @@ -333,7 +333,7 @@ void ScreenManager::pop() { stack_.back().screen->focusChanged(ScreenFocusChange::FOCUS_LOST_TOP); } } else { - ERROR_LOG(SYSTEM, "Can't pop when stack empty"); + ERROR_LOG(Log::System, "Can't pop when stack empty"); } } @@ -346,11 +346,11 @@ void ScreenManager::RecreateAllViews() { void ScreenManager::finishDialog(Screen *dialog, DialogResult result) { if (stack_.empty()) { - ERROR_LOG(SYSTEM, "Must be in a dialog to finishDialog"); + ERROR_LOG(Log::System, "Must be in a dialog to finishDialog"); return; } if (dialog != stack_.back().screen) { - ERROR_LOG(SYSTEM, "Wrong dialog being finished!"); + ERROR_LOG(Log::System, "Wrong dialog being finished!"); return; } dialog->onFinish(result); @@ -389,10 +389,10 @@ void ScreenManager::processFinishDialog() { } if (!caller) { - ERROR_LOG(SYSTEM, "ERROR: no top screen when finishing dialog"); + ERROR_LOG(Log::System, "ERROR: no top screen when finishing dialog"); } else if (caller != topScreen()) { // The caller may get confused if we call dialogFinished() now. - WARN_LOG(SYSTEM, "Skipping non-top dialog when finishing dialog."); + WARN_LOG(Log::System, "Skipping non-top dialog when finishing dialog."); } else { caller->dialogFinished(dialogFinished_, dialogResult_); } diff --git a/Common/UI/UIScreen.cpp b/Common/UI/UIScreen.cpp index c0af58bfb4..8e9a793a1f 100644 --- a/Common/UI/UIScreen.cpp +++ b/Common/UI/UIScreen.cpp @@ -84,11 +84,11 @@ bool UIScreen::key(const KeyInput &key) { bool UIScreen::UnsyncTouch(const TouchInput &touch) { if (ClickDebug && root_ && (touch.flags & TOUCH_DOWN)) { - INFO_LOG(SYSTEM, "Touch down!"); + INFO_LOG(Log::System, "Touch down!"); std::vector views; root_->Query(touch.x, touch.y, views); for (auto view : views) { - INFO_LOG(SYSTEM, "%s", view->DescribeLog().c_str()); + INFO_LOG(Log::System, "%s", view->DescribeLog().c_str()); } } @@ -167,11 +167,11 @@ void UIScreen::update() { break; case QueuedEventType::TOUCH: if (ClickDebug && (ev.touch.flags & TOUCH_DOWN)) { - INFO_LOG(SYSTEM, "Touch down!"); + INFO_LOG(Log::System, "Touch down!"); std::vector views; root_->Query(ev.touch.x, ev.touch.y, views); for (auto view : views) { - INFO_LOG(SYSTEM, "%s", view->DescribeLog().c_str()); + INFO_LOG(Log::System, "%s", view->DescribeLog().c_str()); } } touch(ev.touch); @@ -262,7 +262,7 @@ bool UIDialogScreen::key(const KeyInput &key) { bool retval = UIScreen::key(key); if (!retval && (key.flags & KEY_DOWN) && UI::IsEscapeKey(key)) { if (finished_) { - ERROR_LOG(SYSTEM, "Screen already finished"); + ERROR_LOG(Log::System, "Screen already finished"); } else { finished_ = true; TriggerFinish(DR_BACK); diff --git a/Common/UI/ViewGroup.cpp b/Common/UI/ViewGroup.cpp index 9b7c82beec..d85406201c 100644 --- a/Common/UI/ViewGroup.cpp +++ b/Common/UI/ViewGroup.cpp @@ -322,7 +322,7 @@ float GetTargetScore(const Point2D &originPos, int originIndex, const View *orig float vertOverlap = VerticalOverlap(origin->GetBounds(), destination->GetBounds()); if (horizOverlap == 1.0f && vertOverlap == 1.0f) { if (direction != FOCUS_PREV_PAGE && direction != FOCUS_NEXT_PAGE) { - INFO_LOG(SYSTEM, "Contain overlap"); + INFO_LOG(Log::System, "Contain overlap"); return 0.0; } } @@ -379,7 +379,7 @@ float GetTargetScore(const Point2D &originPos, int originIndex, const View *orig break; case FOCUS_PREV: case FOCUS_NEXT: - ERROR_LOG(SYSTEM, "Invalid focus direction"); + ERROR_LOG(Log::System, "Invalid focus direction"); break; } @@ -401,7 +401,7 @@ static float GetDirectionScore(int originIndex, const View *origin, View *destin NeighborResult ViewGroup::FindNeighbor(View *view, FocusDirection direction, NeighborResult result) { if (!IsEnabled()) { - INFO_LOG(SCECTRL, "Not enabled"); + INFO_LOG(Log::sceCtrl, "Not enabled"); return result; } if (GetVisibility() != V_VISIBLE) { @@ -467,7 +467,7 @@ NeighborResult ViewGroup::FindNeighbor(View *view, FocusDirection direction, Nei return NeighborResult(views_[(num + 1) % views_.size()], 0.0f); default: - ERROR_LOG(SYSTEM, "Bad focus direction %d", (int)direction); + ERROR_LOG(Log::System, "Bad focus direction %d", (int)direction); return result; } } @@ -882,7 +882,7 @@ void AnchorLayout::Layout() { GridLayout::GridLayout(GridLayoutSettings settings, LayoutParams *layoutParams) : ViewGroup(layoutParams), settings_(settings) { if (settings.orientation != ORIENT_HORIZONTAL) - ERROR_LOG(SYSTEM, "GridLayout: Vertical layouts not yet supported"); + ERROR_LOG(Log::System, "GridLayout: Vertical layouts not yet supported"); } void GridLayout::Measure(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert) { diff --git a/Common/x64Analyzer.cpp b/Common/x64Analyzer.cpp index b0bc65403f..04662498b5 100644 --- a/Common/x64Analyzer.cpp +++ b/Common/x64Analyzer.cpp @@ -188,7 +188,7 @@ bool X86AnalyzeMOV(const unsigned char *codePtr, LSInstructionInfo &info) break; default: - ERROR_LOG(CPU, "Unhandled disasm case in write handler!\n\nPlease implement or avoid."); + ERROR_LOG(Log::CPU, "Unhandled disasm case in write handler!\n\nPlease implement or avoid."); return false; } } diff --git a/Common/x64Emitter.cpp b/Common/x64Emitter.cpp index 814fc7e0d6..2dbe577c29 100644 --- a/Common/x64Emitter.cpp +++ b/Common/x64Emitter.cpp @@ -1322,7 +1322,7 @@ void XEmitter::XOR (int bits, const OpArg &a1, const OpArg &a2) {CheckFlags(); W void XEmitter::MOV (int bits, const OpArg &a1, const OpArg &a2) { if (a1.IsSimpleReg() && a2.IsSimpleReg() && a1.GetSimpleReg() == a2.GetSimpleReg()) - ERROR_LOG(JIT, "Redundant MOV @ %p - bug in JIT?", code); + ERROR_LOG(Log::JIT, "Redundant MOV @ %p - bug in JIT?", code); WriteNormalOp(this, bits, nrmMOV, a1, a2); } void XEmitter::TEST(int bits, const OpArg &a1, const OpArg &a2) {CheckFlags(); WriteNormalOp(this, bits, nrmTEST, a1, a2);} diff --git a/Core/AVIDump.cpp b/Core/AVIDump.cpp index aa81165031..ebc140c389 100644 --- a/Core/AVIDump.cpp +++ b/Core/AVIDump.cpp @@ -109,7 +109,7 @@ bool AVIDump::CreateAVI() { const char *filename = s_format_context->filename; snprintf(s_format_context->filename, sizeof(s_format_context->filename), "%s", video_file_name.c_str()); #endif - INFO_LOG(COMMON, "Recording Video to: %s", video_file_name.ToVisualString().c_str()); + INFO_LOG(Log::Common, "Recording Video to: %s", video_file_name.ToVisualString().c_str()); // Make sure that the path exists if (!File::Exists(GetSysDirectory(DIRECTORY_VIDEO))) @@ -168,9 +168,9 @@ bool AVIDump::CreateAVI() { return false; #endif - NOTICE_LOG(G3D, "Opening file %s for dumping", filename); + NOTICE_LOG(Log::G3D, "Opening file %s for dumping", filename); if (avio_open(&s_format_context->pb, filename, AVIO_FLAG_WRITE) < 0 || avformat_write_header(s_format_context, nullptr)) { - WARN_LOG(G3D, "Could not open %s", filename); + WARN_LOG(Log::G3D, "Could not open %s", filename); return false; } @@ -264,10 +264,10 @@ void AVIDump::AddFrame() { #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 48, 101) av_packet_unref(&pkt); if (error < 0 && error != AVERROR(EAGAIN) && error != AVERROR_EOF) - ERROR_LOG(G3D, "Error while encoding video: %d", error); + ERROR_LOG(Log::G3D, "Error while encoding video: %d", error); #else if (error < 0) - ERROR_LOG(G3D, "Error while encoding video: %d", error); + ERROR_LOG(Log::G3D, "Error while encoding video: %d", error); #endif #endif delete[] flipbuffer; @@ -280,7 +280,7 @@ void AVIDump::Stop() { CloseFile(); s_file_index = 0; #endif - NOTICE_LOG(G3D, "Stopping frame dump"); + NOTICE_LOG(Log::G3D, "Stopping frame dump"); } void AVIDump::CloseFile() { diff --git a/Core/Compatibility.cpp b/Core/Compatibility.cpp index 95479b44b5..6a26ea96c3 100644 --- a/Core/Compatibility.cpp +++ b/Core/Compatibility.cpp @@ -149,7 +149,7 @@ void Compatibility::CheckVRSettings(IniFile &iniFile, const std::string &gameID) CheckSetting(iniFile, gameID, "Skyplane", &vrCompat_.Skyplane); CheckSetting(iniFile, gameID, "UnitsPerMeter", &vrCompat_.UnitsPerMeter); - NOTICE_LOG(G3D, "UnitsPerMeter for %s: %f", gameID.c_str(), vrCompat_.UnitsPerMeter); + NOTICE_LOG(Log::G3D, "UnitsPerMeter for %s: %f", gameID.c_str(), vrCompat_.UnitsPerMeter); } void Compatibility::CheckSetting(IniFile &iniFile, const std::string &gameID, const char *option, bool *flag) { diff --git a/Core/Compatibility.h b/Core/Compatibility.h index 6c7f49f464..d9204d7be2 100644 --- a/Core/Compatibility.h +++ b/Core/Compatibility.h @@ -22,7 +22,7 @@ #include // Compatibility flags are controlled by assets/compat.ini. -// Alternatively, if PSP/SYSTEM/compat.ini exists, it is merged on top, to enable editing +// Alternatively, if PSP/System/compat.ini exists, it is merged on top, to enable editing // the file on Android for tests. // // This file is not meant to be user-editable, although is kept as a separate ini diff --git a/Core/Config.cpp b/Core/Config.cpp index fe82d69655..ae3d05327a 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -370,7 +370,7 @@ static int DefaultInternalResolution() { } int longestDisplaySide = std::max(System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)); int scale = longestDisplaySide >= 1000 ? 2 : 1; - INFO_LOG(G3D, "Longest display side: %d pixels. Choosing scale %d", longestDisplaySide, scale); + INFO_LOG(Log::G3D, "Longest display side: %d pixels. Choosing scale %d", longestDisplaySide, scale); return scale; #endif } @@ -481,7 +481,7 @@ int Config::NextValidBackend() { } if (failed.count((GPUBackend)iGPUBackend)) { - ERROR_LOG(LOADER, "Graphics backend failed for %d, trying another", iGPUBackend); + ERROR_LOG(Log::Loader, "Graphics backend failed for %d, trying another", iGPUBackend); #if !PPSSPP_PLATFORM(UWP) if (!failed.count(GPUBackend::VULKAN) && VulkanMayBeAvailable()) { @@ -506,7 +506,7 @@ int Config::NextValidBackend() { // They've all failed. Let them try the default - or on Android, OpenGL. sFailedGPUBackends += ",ALL"; - ERROR_LOG(LOADER, "All graphics backends failed"); + ERROR_LOG(Log::Loader, "All graphics backends failed"); #if PPSSPP_PLATFORM(ANDROID) return (int)GPUBackend::OPENGL; #else @@ -1096,7 +1096,7 @@ void Config::UpdateIniLocation(const char *iniFileName, const char *controllerIn bool Config::LoadAppendedConfig() { IniFile iniFile; if (!iniFile.Load(appendedConfigFileName_)) { - ERROR_LOG(LOADER, "Failed to read appended config '%s'.", appendedConfigFileName_.c_str()); + ERROR_LOG(Log::Loader, "Failed to read appended config '%s'.", appendedConfigFileName_.c_str()); return false; } @@ -1105,7 +1105,7 @@ bool Config::LoadAppendedConfig() { setting.Get(section); }); - INFO_LOG(LOADER, "Loaded appended config '%s'.", appendedConfigFileName_.c_str()); + INFO_LOG(Log::Loader, "Loaded appended config '%s'.", appendedConfigFileName_.c_str()); Save("Loaded appended config"); // Let's prevent reset return true; @@ -1137,12 +1137,12 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) { UpdateIniLocation(iniFileName, controllerIniFilename); - INFO_LOG(LOADER, "Loading config: %s", iniFilename_.c_str()); + INFO_LOG(Log::Loader, "Loading config: %s", iniFilename_.c_str()); bSaveSettings = true; IniFile iniFile; if (!iniFile.Load(iniFilename_)) { - ERROR_LOG(LOADER, "Failed to read '%s'. Setting config to default.", iniFilename_.c_str()); + ERROR_LOG(Log::Loader, "Failed to read '%s'. Setting config to default.", iniFilename_.c_str()); // Continue anyway to initialize the config. } @@ -1179,7 +1179,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) { // Fix JIT setting if no longer available. if (!System_GetPropertyBool(SYSPROP_CAN_JIT)) { if (iCpuCore == (int)CPUCore::JIT || iCpuCore == (int)CPUCore::JIT_IR) { - WARN_LOG(LOADER, "Forcing JIT off due to unavailablility"); + WARN_LOG(Log::Loader, "Forcing JIT off due to unavailablility"); iCpuCore = (int)CPUCore::IR_INTERPRETER; } } @@ -1275,7 +1275,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) { g_DownloadManager.StartDownloadWithCallback(versionUrl, Path(), http::ProgressBarMode::NONE, &DownloadCompletedCallback, "version", acceptMime); } - INFO_LOG(LOADER, "Loading controller config: %s", controllerIniFilename_.c_str()); + INFO_LOG(Log::Loader, "Loading controller config: %s", controllerIniFilename_.c_str()); bSaveSettings = true; LoadStandardControllerIni(); @@ -1291,7 +1291,7 @@ void Config::Load(const char *iniFileName, const char *controllerIniFilename) { PostLoadCleanup(false); - INFO_LOG(LOADER, "Config loaded: '%s' (%0.1f ms)", iniFilename_.c_str(), (time_now_d() - startTime) * 1000.0); + INFO_LOG(Log::Loader, "Config loaded: '%s' (%0.1f ms)", iniFilename_.c_str(), (time_now_d() - startTime) * 1000.0); } bool Config::Save(const char *saveReason) { @@ -1299,7 +1299,7 @@ bool Config::Save(const char *saveReason) { if (!IsFirstInstance()) { // TODO: Should we allow saving config if started from a different directory? // How do we tell? - WARN_LOG(LOADER, "Not saving config - secondary instances don't."); + WARN_LOG(Log::Loader, "Not saving config - secondary instances don't."); // Don't want to retry or something. return true; @@ -1313,7 +1313,7 @@ bool Config::Save(const char *saveReason) { CleanRecent(); IniFile iniFile; if (!iniFile.Load(iniFilename_)) { - WARN_LOG(LOADER, "Likely saving config for first time - couldn't read ini '%s'", iniFilename_.c_str()); + WARN_LOG(Log::Loader, "Likely saving config for first time - couldn't read ini '%s'", iniFilename_.c_str()); } // Need to do this somewhere... @@ -1375,28 +1375,28 @@ bool Config::Save(const char *saveReason) { playTimeTracker_.Save(playTime); if (!iniFile.Save(iniFilename_)) { - ERROR_LOG(LOADER, "Error saving config (%s) - can't write ini '%s'", saveReason, iniFilename_.c_str()); + ERROR_LOG(Log::Loader, "Error saving config (%s) - can't write ini '%s'", saveReason, iniFilename_.c_str()); return false; } - INFO_LOG(LOADER, "Config saved (%s): '%s' (%0.1f ms)", saveReason, iniFilename_.c_str(), (time_now_d() - startTime) * 1000.0); + INFO_LOG(Log::Loader, "Config saved (%s): '%s' (%0.1f ms)", saveReason, iniFilename_.c_str(), (time_now_d() - startTime) * 1000.0); if (!bGameSpecific) //otherwise we already did this in saveGameConfig() { IniFile controllerIniFile; if (!controllerIniFile.Load(controllerIniFilename_)) { - ERROR_LOG(LOADER, "Error saving controller config - can't read ini first '%s'", controllerIniFilename_.c_str()); + ERROR_LOG(Log::Loader, "Error saving controller config - can't read ini first '%s'", controllerIniFilename_.c_str()); } KeyMap::SaveToIni(controllerIniFile); if (!controllerIniFile.Save(controllerIniFilename_)) { - ERROR_LOG(LOADER, "Error saving config - can't write ini '%s'", controllerIniFilename_.c_str()); + ERROR_LOG(Log::Loader, "Error saving config - can't write ini '%s'", controllerIniFilename_.c_str()); return false; } - INFO_LOG(LOADER, "Controller config saved: %s", controllerIniFilename_.c_str()); + INFO_LOG(Log::Loader, "Controller config saved: %s", controllerIniFilename_.c_str()); } PostSaveCleanup(false); } else { - INFO_LOG(LOADER, "Not saving config"); + INFO_LOG(Log::Loader, "Not saving config"); } return true; @@ -1468,20 +1468,20 @@ void Config::NotifyUpdatedCpuCore() { void Config::DownloadCompletedCallback(http::Request &download) { if (download.ResultCode() != 200) { - ERROR_LOG(LOADER, "Failed to download %s: %d", download.url().c_str(), download.ResultCode()); + ERROR_LOG(Log::Loader, "Failed to download %s: %d", download.url().c_str(), download.ResultCode()); return; } std::string data; download.buffer().TakeAll(&data); if (data.empty()) { - ERROR_LOG(LOADER, "Version check: Empty data from server!"); + ERROR_LOG(Log::Loader, "Version check: Empty data from server!"); return; } json::JsonReader reader(data.c_str(), data.size()); const json::JsonGet root = reader.root(); if (!root) { - ERROR_LOG(LOADER, "Failed to parse json"); + ERROR_LOG(Log::Loader, "Failed to parse json"); return; } @@ -1494,16 +1494,16 @@ void Config::DownloadCompletedCallback(http::Request &download) { Version dismissed(g_Config.dismissedVersion); if (!installed.IsValid()) { - ERROR_LOG(LOADER, "Version check: Local version string invalid. Build problems? %s", PPSSPP_GIT_VERSION); + ERROR_LOG(Log::Loader, "Version check: Local version string invalid. Build problems? %s", PPSSPP_GIT_VERSION); return; } if (!upgrade.IsValid()) { - ERROR_LOG(LOADER, "Version check: Invalid server version: %s", version.c_str()); + ERROR_LOG(Log::Loader, "Version check: Invalid server version: %s", version.c_str()); return; } if (installed >= upgrade) { - INFO_LOG(LOADER, "Version check: Already up to date, erasing any upgrade message"); + INFO_LOG(Log::Loader, "Version check: Already up to date, erasing any upgrade message"); g_Config.upgradeMessage.clear(); g_Config.upgradeVersion = upgrade.ToString(); g_Config.dismissedVersion.clear(); @@ -1560,7 +1560,7 @@ void Config::RemoveRecent(const std::string &file) { // The GUID part changes on each launch. static bool TryUpdateSavedPath(Path *path) { #if PPSSPP_PLATFORM(IOS) - INFO_LOG(LOADER, "Original path: %s", path->c_str()); + INFO_LOG(Log::Loader, "Original path: %s", path->c_str()); std::string pathStr = path->ToString(); const std::string_view applicationRoot = "/var/mobile/Containers/Data/Application/"; @@ -1593,7 +1593,7 @@ void Config::CleanRecent() { std::lock_guard guard(private_->recentIsosLock); std::vector cleanedRecent; if (recentIsos.empty()) { - INFO_LOG(LOADER, "No recents list found."); + INFO_LOG(Log::Loader, "No recents list found."); } for (size_t i = 0; i < recentIsos.size(); i++) { @@ -1606,7 +1606,7 @@ void Config::CleanRecent() { if (!exists) { if (TryUpdateSavedPath(&path)) { exists = File::Exists(path); - INFO_LOG(LOADER, "Exists=%d when checking updated path: %s", exists, path.c_str()); + INFO_LOG(Log::Loader, "Exists=%d when checking updated path: %s", exists, path.c_str()); } } break; @@ -1625,13 +1625,13 @@ void Config::CleanRecent() { cleanedRecent.push_back(pathStr); } } else { - DEBUG_LOG(LOADER, "Removed %s from recent. errno=%d", path.c_str(), errno); + DEBUG_LOG(Log::Loader, "Removed %s from recent. errno=%d", path.c_str(), errno); } } double recentTime = time_now_d() - startTime; if (recentTime > 0.1) { - INFO_LOG(SYSTEM, "CleanRecent took %0.2f", recentTime); + INFO_LOG(Log::System, "CleanRecent took %0.2f", recentTime); } recentIsos = cleanedRecent; }); @@ -1790,7 +1790,7 @@ bool Config::loadGameConfig(const std::string &pGameId, const std::string &title Path iniFileNameFull = getGameConfigFile(pGameId); if (!hasGameConfig(pGameId)) { - DEBUG_LOG(LOADER, "No game-specific settings found in %s. Using global defaults.", iniFileNameFull.c_str()); + DEBUG_LOG(Log::Loader, "No game-specific settings found in %s. Using global defaults.", iniFileNameFull.c_str()); return false; } @@ -1805,7 +1805,7 @@ bool Config::loadGameConfig(const std::string &pGameId, const std::string &title if (sscanf(it.second.c_str(), "%f", &value)) { mPostShaderSetting[it.first] = value; } else { - WARN_LOG(LOADER, "Invalid float value string for param %s: '%s'", it.first.c_str(), it.second.c_str()); + WARN_LOG(Log::Loader, "Invalid float value string for param %s: '%s'", it.first.c_str(), it.second.c_str()); } } @@ -1870,7 +1870,7 @@ void Config::unloadGameConfig() { void Config::LoadStandardControllerIni() { IniFile controllerIniFile; if (!controllerIniFile.Load(controllerIniFilename_)) { - ERROR_LOG(LOADER, "Failed to read %s. Setting controller config to default.", controllerIniFilename_.c_str()); + ERROR_LOG(Log::Loader, "Failed to read %s. Setting controller config to default.", controllerIniFilename_.c_str()); KeyMap::RestoreDefault(); } else { // Continue anyway to initialize the config. It will just restore the defaults. @@ -1934,7 +1934,7 @@ void PlayTimeTracker::Start(const std::string &gameId) { if (gameId.empty()) { return; } - INFO_LOG(SYSTEM, "GameTimeTracker::Start(%s)", gameId.c_str()); + INFO_LOG(Log::System, "GameTimeTracker::Start(%s)", gameId.c_str()); auto iter = tracker_.find(std::string(gameId)); if (iter != tracker_.end()) { @@ -1957,7 +1957,7 @@ void PlayTimeTracker::Stop(const std::string &gameId) { return; } - INFO_LOG(SYSTEM, "GameTimeTracker::Stop(%s)", gameId.c_str()); + INFO_LOG(Log::System, "GameTimeTracker::Stop(%s)", gameId.c_str()); auto iter = tracker_.find(std::string(gameId)); if (iter != tracker_.end()) { @@ -1970,7 +1970,7 @@ void PlayTimeTracker::Stop(const std::string &gameId) { } // Shouldn't happen, ignore this case. - WARN_LOG(SYSTEM, "GameTimeTracker::Stop called without corresponding GameTimeTracker::Start"); + WARN_LOG(Log::System, "GameTimeTracker::Stop called without corresponding GameTimeTracker::Start"); } void PlayTimeTracker::Load(const Section *section) { diff --git a/Core/ConfigValues.h b/Core/ConfigValues.h index 297681f022..38b111ca2e 100644 --- a/Core/ConfigValues.h +++ b/Core/ConfigValues.h @@ -170,7 +170,7 @@ enum class DebugOverlay : int { FRAME_PROFILE, #endif CONTROL, - AUDIO, + Audio, GPU_PROFILE, GPU_ALLOCATOR, FRAMEBUFFER_LIST, diff --git a/Core/ControlMapper.cpp b/Core/ControlMapper.cpp index 8be39420d4..ad38aeca91 100644 --- a/Core/ControlMapper.cpp +++ b/Core/ControlMapper.cpp @@ -57,7 +57,7 @@ float ControlMapper::GetDeviceAxisThreshold(int device, const InputMapping &mapp if (absCoValue > 0.0f) { // Bias down the threshold if the other axis is active. float biasedThreshold = AXIS_BIND_THRESHOLD * (1.0f - absCoValue * 0.35f); - // INFO_LOG(SYSTEM, "coValue: %f threshold: %f", absCoValue, biasedThreshold); + // INFO_LOG(Log::System, "coValue: %f threshold: %f", absCoValue, biasedThreshold); return biasedThreshold; } } @@ -309,7 +309,7 @@ float ControlMapper::MapAxisValue(float value, int vkId, const InputMapping &map if (direction == -1) { ranged = 1.0f - ranged; } - // NOTICE_LOG(SYSTEM, "rawValue: %f other: %f signed: %f ranged: %f", iter->second, valueOther, signedValue, ranged); + // NOTICE_LOG(Log::System, "rawValue: %f other: %f signed: %f ranged: %f", iter->second, valueOther, signedValue, ranged); return ranged; } else { return value; @@ -506,13 +506,13 @@ bool ControlMapper::UpdatePSPState(const InputMapping &changedMapping, double no bool bValue = value >= threshold; if (virtKeys_[i] != value) { - // INFO_LOG(G3D, "vkeyanalog %s : %f", KeyMap::GetVirtKeyName(vkId), value); + // INFO_LOG(Log::G3D, "vkeyanalog %s : %f", KeyMap::GetVirtKeyName(vkId), value); onVKeyAnalog(changedMapping.deviceId, vkId, value); virtKeys_[i] = value; } if (!bPrevValue && bValue) { - // INFO_LOG(G3D, "vkeyon %s", KeyMap::GetVirtKeyName(vkId)); + // INFO_LOG(Log::G3D, "vkeyon %s", KeyMap::GetVirtKeyName(vkId)); onVKey(vkId, true); virtKeyOn_[vkId - VIRTKEY_FIRST] = true; @@ -520,7 +520,7 @@ bool ControlMapper::UpdatePSPState(const InputMapping &changedMapping, double no updateAnalogSticks = true; } } else if (bPrevValue && !bValue) { - // INFO_LOG(G3D, "vkeyoff %s", KeyMap::GetVirtKeyName(vkId)); + // INFO_LOG(Log::G3D, "vkeyoff %s", KeyMap::GetVirtKeyName(vkId)); onVKey(vkId, false); virtKeyOn_[vkId - VIRTKEY_FIRST] = false; @@ -563,7 +563,7 @@ bool ControlMapper::Key(const KeyInput &key, bool *pauseTrigger) { // TODO: See if this can be simplified further somehow. if ((key.flags & KEY_DOWN) && key.keyCode == NKCODE_BACK) { bool mappingFound = KeyMap::InputMappingToPspButton(mapping, nullptr); - DEBUG_LOG(SYSTEM, "Key: %d DeviceId: %d", key.keyCode, key.deviceId); + DEBUG_LOG(Log::System, "Key: %d DeviceId: %d", key.keyCode, key.deviceId); if (!mappingFound || key.deviceId == DEVICE_ID_DEFAULT) { *pauseTrigger = true; return true; @@ -682,7 +682,7 @@ void ControlMapper::PSPKey(int deviceId, int pspKeyCode, int flags) { onVKeyAnalog(deviceId, pspKeyCode, 0.0f); } } else { - // INFO_LOG(SYSTEM, "pspKey %d %d", pspKeyCode, flags); + // INFO_LOG(Log::System, "pspKey %d %d", pspKeyCode, flags); if (flags & KEY_DOWN) updatePSPButtons_(pspKeyCode, 0); if (flags & KEY_UP) @@ -715,7 +715,7 @@ void ControlMapper::onVKeyAnalog(int deviceId, int vkey, float value) { float oppVal = virtKeys_[oppositeVKey - VIRTKEY_FIRST]; if (oppVal != 0.0f) { value -= oppVal; - // NOTICE_LOG(SCECTRL, "Reducing %f by %f (from %08x : %s)", value, oppVal, oppositeVKey, KeyMap::GetPspButtonName(oppositeVKey).c_str()); + // NOTICE_LOG(Log::sceCtrl, "Reducing %f by %f (from %08x : %s)", value, oppVal, oppositeVKey, KeyMap::GetPspButtonName(oppositeVKey).c_str()); } } SetPSPAxis(deviceId, stick, axis, sign * value); diff --git a/Core/Core.cpp b/Core/Core.cpp index aad45dabbd..5993f44255 100644 --- a/Core/Core.cpp +++ b/Core/Core.cpp @@ -404,16 +404,16 @@ void Core_MemoryException(u32 address, u32 accessSize, u32 pc, MemoryExceptionTy const char *desc = MemoryExceptionTypeAsString(type); // In jit, we only flush PC when bIgnoreBadMemAccess is off. if ((g_Config.iCpuCore == (int)CPUCore::JIT || g_Config.iCpuCore == (int)CPUCore::JIT_IR) && g_Config.bIgnoreBadMemAccess) { - WARN_LOG(MEMMAP, "%s: Invalid access at %08x (size %08x)", desc, address, accessSize); + WARN_LOG(Log::MemMap, "%s: Invalid access at %08x (size %08x)", desc, address, accessSize); } else { - WARN_LOG(MEMMAP, "%s: Invalid access at %08x (size %08x) PC %08x LR %08x", desc, address, accessSize, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); + WARN_LOG(Log::MemMap, "%s: Invalid access at %08x (size %08x) PC %08x LR %08x", desc, address, accessSize, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]); } if (!g_Config.bIgnoreBadMemAccess) { // Try to fetch a call stack, to start with. std::vector stackFrames = WalkCurrentStack(-1); std::string stackTrace = FormatStackTrace(stackFrames); - WARN_LOG(MEMMAP, "\n%s", stackTrace.c_str()); + WARN_LOG(Log::MemMap, "\n%s", stackTrace.c_str()); MIPSExceptionInfo &e = g_exceptionInfo; e = {}; @@ -432,16 +432,16 @@ void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExcepti const char *desc = MemoryExceptionTypeAsString(type); // In jit, we only flush PC when bIgnoreBadMemAccess is off. if ((g_Config.iCpuCore == (int)CPUCore::JIT || g_Config.iCpuCore == (int)CPUCore::JIT_IR) && g_Config.bIgnoreBadMemAccess) { - WARN_LOG(MEMMAP, "%s: Invalid access at %08x (size %08x). %.*s", desc, address, accessSize, (int)additionalInfo.length(), additionalInfo.data()); + WARN_LOG(Log::MemMap, "%s: Invalid access at %08x (size %08x). %.*s", desc, address, accessSize, (int)additionalInfo.length(), additionalInfo.data()); } else { - WARN_LOG(MEMMAP, "%s: Invalid access at %08x (size %08x) PC %08x LR %08x %.*s", desc, address, accessSize, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA], (int)additionalInfo.length(), additionalInfo.data()); + WARN_LOG(Log::MemMap, "%s: Invalid access at %08x (size %08x) PC %08x LR %08x %.*s", desc, address, accessSize, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA], (int)additionalInfo.length(), additionalInfo.data()); } if (!g_Config.bIgnoreBadMemAccess || forceReport) { // Try to fetch a call stack, to start with. std::vector stackFrames = WalkCurrentStack(-1); std::string stackTrace = FormatStackTrace(stackFrames); - WARN_LOG(MEMMAP, "\n%s", stackTrace.c_str()); + WARN_LOG(Log::MemMap, "\n%s", stackTrace.c_str()); MIPSExceptionInfo &e = g_exceptionInfo; e = {}; @@ -459,7 +459,7 @@ void Core_MemoryExceptionInfo(u32 address, u32 accessSize, u32 pc, MemoryExcepti // Can't be ignored void Core_ExecException(u32 address, u32 pc, ExecExceptionType type) { const char *desc = ExecExceptionTypeAsString(type); - WARN_LOG(MEMMAP, "%s: Invalid exec address %08x PC %08x LR %08x", desc, address, pc, currentMIPS->r[MIPS_REG_RA]); + WARN_LOG(Log::MemMap, "%s: Invalid exec address %08x PC %08x LR %08x", desc, address, pc, currentMIPS->r[MIPS_REG_RA]); MIPSExceptionInfo &e = g_exceptionInfo; e = {}; @@ -475,7 +475,7 @@ void Core_ExecException(u32 address, u32 pc, ExecExceptionType type) { } void Core_Break(u32 pc) { - ERROR_LOG(CPU, "BREAK!"); + ERROR_LOG(Log::CPU, "BREAK!"); MIPSExceptionInfo &e = g_exceptionInfo; e = {}; diff --git a/Core/CoreTiming.cpp b/Core/CoreTiming.cpp index e9fbea956d..b357dc2404 100644 --- a/Core/CoreTiming.cpp +++ b/Core/CoreTiming.cpp @@ -152,7 +152,7 @@ int RegisterEvent(const char *name, TimedCallback callback) { } void AntiCrashCallback(u64 userdata, int cyclesLate) { - ERROR_LOG(SAVESTATE, "Savestate broken: an unregistered event was called."); + ERROR_LOG(Log::SaveState, "Savestate broken: an unregistered event was called."); Core_EnableStepping(true, "savestate.crash", 0); } @@ -366,7 +366,7 @@ void RemoveEvent(int event_type) void ProcessEvents() { while (first) { if (first->time <= (s64)GetTicks()) { - // INFO_LOG(CPU, "%s (%lld, %lld) ", first->name ? first->name : "?", (u64)GetTicks(), (u64)first->time); + // INFO_LOG(Log::CPU, "%s (%lld, %lld) ", first->name ? first->name : "?", (u64)GetTicks(), (u64)first->time); Event *evt = first; first = first->next; if (evt->type >= 0 && evt->type < event_types.size()) { @@ -425,7 +425,7 @@ void Advance() { void LogPendingEvents() { Event *ptr = first; while (ptr) { - //INFO_LOG(CPU, "PENDING: Now: %lld Pending: %lld Type: %d", globalTimer, ptr->time, ptr->type); + //INFO_LOG(Log::CPU, "PENDING: Now: %lld Pending: %lld Type: %d", globalTimer, ptr->time, ptr->type); ptr = ptr->next; } } @@ -447,7 +447,7 @@ void Idle(int maxIdle) { if (cyclesDown < 0) cyclesDown = 0; - // VERBOSE_LOG(CPU, "Idle for %i cycles! (%f ms)", cyclesDown, cyclesDown / (float)(CPU_HZ * 0.001f)); + // VERBOSE_LOG(Log::CPU, "Idle for %i cycles! (%f ms)", cyclesDown, cyclesDown / (float)(CPU_HZ * 0.001f)); idledCycles += cyclesDown; currentMIPS->downcount -= cyclesDown; @@ -499,7 +499,7 @@ void DoState(PointerWrap &p) { int current = n; Do(p, n); if (n > current) { - WARN_LOG(SAVESTATE, "Savestate failure: more events than current (can't ever remove an event)"); + WARN_LOG(Log::SaveState, "Savestate failure: more events than current (can't ever remove an event)"); p.SetError(p.ERROR_FAILURE); return; } diff --git a/Core/Debugger/Breakpoints.cpp b/Core/Debugger/Breakpoints.cpp index 149adbcc6e..0f0d344cff 100644 --- a/Core/Debugger/Breakpoints.cpp +++ b/Core/Debugger/Breakpoints.cpp @@ -47,11 +47,11 @@ void MemCheck::Log(u32 addr, bool write, int size, u32 pc, const char *reason) { if (result & BREAK_ACTION_LOG) { const char *type = write ? "Write" : "Read"; if (logFormat.empty()) { - NOTICE_LOG(MEMMAP, "CHK %s%i(%s) at %08x (%s), PC=%08x (%s)", type, size * 8, reason, addr, g_symbolMap->GetDescription(addr).c_str(), pc, g_symbolMap->GetDescription(pc).c_str()); + NOTICE_LOG(Log::MemMap, "CHK %s%i(%s) at %08x (%s), PC=%08x (%s)", type, size * 8, reason, addr, g_symbolMap->GetDescription(addr).c_str(), pc, g_symbolMap->GetDescription(pc).c_str()); } else { std::string formatted; CBreakPoints::EvaluateLogFormat(currentDebugMIPS, logFormat, formatted); - NOTICE_LOG(MEMMAP, "CHK %s%i(%s) at %08x: %s", type, size * 8, reason, addr, formatted.c_str()); + NOTICE_LOG(Log::MemMap, "CHK %s%i(%s) at %08x: %s", type, size * 8, reason, addr, formatted.c_str()); } } } @@ -323,11 +323,11 @@ BreakAction CBreakPoints::ExecBreakPoint(u32 addr) { if (info.result & BREAK_ACTION_LOG) { if (info.logFormat.empty()) { - NOTICE_LOG(JIT, "BKP PC=%08x (%s)", addr, g_symbolMap->GetDescription(addr).c_str()); + NOTICE_LOG(Log::JIT, "BKP PC=%08x (%s)", addr, g_symbolMap->GetDescription(addr).c_str()); } else { std::string formatted; CBreakPoints::EvaluateLogFormat(currentDebugMIPS, info.logFormat, formatted); - NOTICE_LOG(JIT, "BKP PC=%08x: %s", addr, formatted.c_str()); + NOTICE_LOG(Log::JIT, "BKP PC=%08x: %s", addr, formatted.c_str()); } } if ((info.result & BREAK_ACTION_PAUSE) && coreState != CORE_POWERUP) { diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index 78efc1777e..aa4006bba7 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -165,7 +165,7 @@ bool SymbolMap::LoadSymbolMap(const Path &filename) { type = (SymbolType) typeInt; if (!hasModules) { if (!Memory::IsValidAddress(vaddress)) { - ERROR_LOG(LOADER, "Invalid address in symbol file: %08x (%s)", vaddress, name); + ERROR_LOG(Log::Loader, "Invalid address in symbol file: %08x (%s)", vaddress, name); continue; } } else { @@ -173,7 +173,7 @@ bool SymbolMap::LoadSymbolMap(const Path &filename) { moduleIndex = vaddress; vaddress = GetModuleAbsoluteAddr(address, moduleIndex); if (!Memory::IsValidAddress(vaddress)) { - ERROR_LOG(LOADER, "Invalid address in symbol file: %08x (%s)", vaddress, name); + ERROR_LOG(Log::Loader, "Invalid address in symbol file: %08x (%s)", vaddress, name); continue; } } diff --git a/Core/Debugger/WebSocket.cpp b/Core/Debugger/WebSocket.cpp index 4da6366d24..7f1f1aac69 100644 --- a/Core/Debugger/WebSocket.cpp +++ b/Core/Debugger/WebSocket.cpp @@ -108,7 +108,7 @@ static void WebSocketNotifyLifecycle(CoreLifecycle stage) { case CoreLifecycle::STOPPING: case CoreLifecycle::MEMORY_REINITING: if (debuggersConnected > 0) { - DEBUG_LOG(SYSTEM, "Waiting for debugger to complete on shutdown"); + DEBUG_LOG(Log::System, "Waiting for debugger to complete on shutdown"); } lifecycleLock.lock(); break; @@ -118,7 +118,7 @@ static void WebSocketNotifyLifecycle(CoreLifecycle stage) { case CoreLifecycle::MEMORY_REINITED: lifecycleLock.unlock(); if (debuggersConnected > 0) { - DEBUG_LOG(SYSTEM, "Debugger ready for shutdown"); + DEBUG_LOG(Log::System, "Debugger ready for shutdown"); } break; } diff --git a/Core/Debugger/WebSocket/GameSubscriber.cpp b/Core/Debugger/WebSocket/GameSubscriber.cpp index dae7f871a7..94b62bf53f 100644 --- a/Core/Debugger/WebSocket/GameSubscriber.cpp +++ b/Core/Debugger/WebSocket/GameSubscriber.cpp @@ -51,7 +51,7 @@ void WebSocketGameReset(DebuggerRequest &req) { std::string resetError; if (!PSP_Reboot(&resetError)) { - ERROR_LOG(BOOT, "Error resetting: %s", resetError.c_str()); + ERROR_LOG(Log::Boot, "Error resetting: %s", resetError.c_str()); return req.Fail("Could not reset"); } diff --git a/Core/Dialog/PSPDialog.cpp b/Core/Dialog/PSPDialog.cpp index cbd6b42426..8697e71b13 100644 --- a/Core/Dialog/PSPDialog.cpp +++ b/Core/Dialog/PSPDialog.cpp @@ -43,7 +43,7 @@ void PSPDialog::InitCommon() { UpdateCommon(); if (GetCommonParam() && GetCommonParam()->language != g_Config.GetPSPLanguage()) { - WARN_LOG(SCEUTILITY, "Game requested language %d, ignoring and using user language", GetCommonParam()->language); + WARN_LOG(Log::sceUtility, "Game requested language %d, ignoring and using user language", GetCommonParam()->language); } } diff --git a/Core/Dialog/PSPGamedataInstallDialog.cpp b/Core/Dialog/PSPGamedataInstallDialog.cpp index 2ec44086e5..f03e3bb5c6 100644 --- a/Core/Dialog/PSPGamedataInstallDialog.cpp +++ b/Core/Dialog/PSPGamedataInstallDialog.cpp @@ -70,7 +70,7 @@ PSPGamedataInstallDialog::~PSPGamedataInstallDialog() { int PSPGamedataInstallDialog::Init(u32 paramAddr) { if (GetStatus() != SCE_UTILITY_STATUS_NONE) { - ERROR_LOG_REPORT(SCEUTILITY, "A game install request is already running, not starting a new one"); + ERROR_LOG_REPORT(Log::sceUtility, "A game install request is already running, not starting a new one"); return SCE_ERROR_UTILITY_INVALID_STATUS; } @@ -89,14 +89,14 @@ int PSPGamedataInstallDialog::Init(u32 paramAddr) { } if (allFilesSize == 0) { - ERROR_LOG_REPORT(SCEUTILITY, "Game install with no files / data"); + ERROR_LOG_REPORT(Log::sceUtility, "Game install with no files / data"); // TODO: What happens here? return -1; } int size = Memory::Read_U32(paramAddr); if (size != 1424 && size != 1432) { - ERROR_LOG_REPORT(SCEUTILITY, "sceGamedataInstallInitStart: invalid param size %d", size); + ERROR_LOG_REPORT(Log::sceUtility, "sceGamedataInstallInitStart: invalid param size %d", size); return SCE_ERROR_UTILITY_INVALID_PARAM_SIZE; } @@ -117,7 +117,7 @@ int PSPGamedataInstallDialog::Update(int animSpeed) { param->common.result = ERROR_UTILITY_GAMEDATA_INVALID_MODE; param.NotifyWrite("DialogResult"); ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0); - WARN_LOG_REPORT(SCEUTILITY, "sceUtilityGamedataInstallUpdate: invalid mode %d", param->mode); + WARN_LOG_REPORT(Log::sceUtility, "sceUtilityGamedataInstallUpdate: invalid mode %d", param->mode); return 0; } @@ -158,7 +158,7 @@ void PSPGamedataInstallDialog::OpenNextFile() { currentInputFile = pspFileSystem.OpenFile(inputFileName, FILEACCESS_READ); if (currentInputFile < 0) { // TODO: Generate an error code? - ERROR_LOG_REPORT(SCEUTILITY, "Unable to read from install file: %s", inFileNames[readFiles].c_str()); + ERROR_LOG_REPORT(Log::sceUtility, "Unable to read from install file: %s", inFileNames[readFiles].c_str()); ++readFiles; currentInputFile = 0; return; @@ -166,7 +166,7 @@ void PSPGamedataInstallDialog::OpenNextFile() { currentOutputFile = pspFileSystem.OpenFile(outputFileName, (FileAccess)(FILEACCESS_WRITE | FILEACCESS_CREATE | FILEACCESS_TRUNCATE)); if (currentOutputFile < 0) { // TODO: Generate an error code? - ERROR_LOG(SCEUTILITY, "Unable to write to install file: %s", inFileNames[readFiles].c_str()); + ERROR_LOG(Log::sceUtility, "Unable to write to install file: %s", inFileNames[readFiles].c_str()); pspFileSystem.CloseFile(currentInputFile); currentInputFile = 0; currentOutputFile = 0; diff --git a/Core/Dialog/PSPMsgDialog.cpp b/Core/Dialog/PSPMsgDialog.cpp index ba73d40076..2e7a8efe4c 100755 --- a/Core/Dialog/PSPMsgDialog.cpp +++ b/Core/Dialog/PSPMsgDialog.cpp @@ -44,7 +44,7 @@ PSPMsgDialog::~PSPMsgDialog() { int PSPMsgDialog::Init(unsigned int paramAddr) { // Ignore if already running if (GetStatus() != SCE_UTILITY_STATUS_NONE) { - ERROR_LOG_REPORT(SCEUTILITY, "sceUtilityMsgDialogInitStart: invalid status"); + ERROR_LOG_REPORT(Log::sceUtility, "sceUtilityMsgDialogInitStart: invalid status"); return SCE_ERROR_UTILITY_INVALID_STATUS; } @@ -62,7 +62,7 @@ int PSPMsgDialog::Init(unsigned int paramAddr) { int optionsNotCoded = messageDialog.options & ~SCE_UTILITY_MSGDIALOG_OPTION_SUPPORTED; if(optionsNotCoded) { - ERROR_LOG_REPORT(SCEUTILITY, "PSPMsgDialog options not coded : 0x%08x", optionsNotCoded); + ERROR_LOG_REPORT(Log::sceUtility, "PSPMsgDialog options not coded : 0x%08x", optionsNotCoded); } flag = 0; diff --git a/Core/Dialog/PSPNpSigninDialog.cpp b/Core/Dialog/PSPNpSigninDialog.cpp index 57d8cce705..0770a0a90e 100644 --- a/Core/Dialog/PSPNpSigninDialog.cpp +++ b/Core/Dialog/PSPNpSigninDialog.cpp @@ -61,7 +61,7 @@ int PSPNpSigninDialog::Init(u32 paramAddr) { // Only copy the right size to support different request format Memory::Memcpy(&request, paramAddr, size); - WARN_LOG_REPORT_ONCE(PSPNpSigninDialogInit, SCENET, "NpSignin Init Params: %08x, %08x, %08x, %08x", request.npSigninStatus, request.unknown1, request.unknown2, request.unknown3); + WARN_LOG_REPORT_ONCE(PSPNpSigninDialogInit, Log::sceNet, "NpSignin Init Params: %08x, %08x, %08x, %08x", request.npSigninStatus, request.unknown1, request.unknown2, request.unknown3); ChangeStatusInit(NP_INIT_DELAY_US); diff --git a/Core/Dialog/PSPOskDialog.cpp b/Core/Dialog/PSPOskDialog.cpp index dfcd4a634f..2ce00f4f48 100755 --- a/Core/Dialog/PSPOskDialog.cpp +++ b/Core/Dialog/PSPOskDialog.cpp @@ -298,32 +298,32 @@ static bool IsKeyboardShiftValid(s32 inputType, OskKeyboardLanguage lang, OskKey int PSPOskDialog::Init(u32 oskPtr) { // Ignore if already running if (GetStatus() != SCE_UTILITY_STATUS_NONE) { - ERROR_LOG_REPORT(SCEUTILITY, "sceUtilityOskInitStart: invalid status"); + ERROR_LOG_REPORT(Log::sceUtility, "sceUtilityOskInitStart: invalid status"); return SCE_ERROR_UTILITY_INVALID_STATUS; } // Seems like this should crash? if (!Memory::IsValidAddress(oskPtr)) { - ERROR_LOG_REPORT(SCEUTILITY, "sceUtilityOskInitStart: invalid params (%08x)", oskPtr); + ERROR_LOG_REPORT(Log::sceUtility, "sceUtilityOskInitStart: invalid params (%08x)", oskPtr); return -1; } oskParams = oskPtr; if (oskParams->base.size != sizeof(SceUtilityOskParams)) { - ERROR_LOG_REPORT(SCEUTILITY, "sceUtilityOskInitStart: invalid size %d", oskParams->base.size); + ERROR_LOG_REPORT(Log::sceUtility, "sceUtilityOskInitStart: invalid size %d", oskParams->base.size); return SCE_ERROR_UTILITY_INVALID_PARAM_SIZE; } // Also seems to crash. if (!oskParams->fields.IsValid()) { - ERROR_LOG_REPORT(SCEUTILITY, "sceUtilityOskInitStart: invalid field data (%08x)", oskParams->fields.ptr); + ERROR_LOG_REPORT(Log::sceUtility, "sceUtilityOskInitStart: invalid field data (%08x)", oskParams->fields.ptr); return -1; } if (oskParams->unk_60 != 0) - WARN_LOG_REPORT(SCEUTILITY, "sceUtilityOskInitStart: unknown param is non-zero (%08x)", oskParams->unk_60); + WARN_LOG_REPORT(Log::sceUtility, "sceUtilityOskInitStart: unknown param is non-zero (%08x)", oskParams->unk_60); if (oskParams->fieldCount != 1) - WARN_LOG_REPORT(SCEUTILITY, "sceUtilityOskInitStart: unsupported field count %d", oskParams->fieldCount); + WARN_LOG_REPORT(Log::sceUtility, "sceUtilityOskInitStart: unsupported field count %d", oskParams->fieldCount); ChangeStatusInit(OSK_INIT_DELAY_US); selectedChar = 0; @@ -923,7 +923,7 @@ int PSPOskDialog::NativeKeyboard() { u32 maxLength = FieldMaxLength(); if (inputChars.length() > maxLength) { - ERROR_LOG(SCEUTILITY, "NativeKeyboard: input text too long(%d characters/glyphs max), truncating to game-requested length.", maxLength); + ERROR_LOG(Log::sceUtility, "NativeKeyboard: input text too long(%d characters/glyphs max), truncating to game-requested length.", maxLength); inputChars.erase(maxLength, std::string::npos); } ChangeStatus(SCE_UTILITY_STATUS_FINISHED, 0); diff --git a/Core/Dialog/PSPSaveDialog.cpp b/Core/Dialog/PSPSaveDialog.cpp index f60f60c6f3..988ec8b825 100755 --- a/Core/Dialog/PSPSaveDialog.cpp +++ b/Core/Dialog/PSPSaveDialog.cpp @@ -95,7 +95,7 @@ int PSPSaveDialog::Init(int paramAddr) { // Ignore if already running if (GetStatus() != SCE_UTILITY_STATUS_NONE) { - ERROR_LOG_REPORT(SCEUTILITY, "A save request is already running, not starting a new one"); + ERROR_LOG_REPORT(Log::sceUtility, "A save request is already running, not starting a new one"); return SCE_ERROR_UTILITY_INVALID_STATUS; } @@ -107,7 +107,7 @@ int PSPSaveDialog::Init(int paramAddr) memset(&request, 0, sizeof(request)); // Only copy the right size to support different save request format if (size != SAVEDATA_DIALOG_SIZE_V1 && size != SAVEDATA_DIALOG_SIZE_V2 && size != SAVEDATA_DIALOG_SIZE_V3) { - ERROR_LOG_REPORT(SCEUTILITY, "sceUtilitySavedataInitStart: invalid size %d", size); + ERROR_LOG_REPORT(Log::sceUtility, "sceUtilitySavedataInitStart: invalid size %d", size); return SCE_ERROR_UTILITY_INVALID_PARAM_SIZE; } Memory::Memcpy(&request, requestAddr, size); @@ -119,8 +119,8 @@ int PSPSaveDialog::Init(int paramAddr) const u32 mode = (u32)param.GetPspParam()->mode; const char *modeName = mode < ARRAY_SIZE(utilitySavedataTypeNames) ? utilitySavedataTypeNames[mode] : "UNKNOWN"; - INFO_LOG(SCEUTILITY,"sceUtilitySavedataInitStart(%08x) - %s (%d)", paramAddr, modeName, mode); - INFO_LOG(SCEUTILITY,"sceUtilitySavedataInitStart(%08x) : Game key (hex): %s", paramAddr, param.GetKey(param.GetPspParam()).c_str()); + INFO_LOG(Log::sceUtility,"sceUtilitySavedataInitStart(%08x) - %s (%d)", paramAddr, modeName, mode); + INFO_LOG(Log::sceUtility,"sceUtilitySavedataInitStart(%08x) : Game key (hex): %s", paramAddr, param.GetKey(param.GetPspParam()).c_str()); yesnoChoice = 1; switch ((SceUtilitySavedataFocus)(u32)param.GetPspParam()->focus) @@ -153,7 +153,7 @@ int PSPSaveDialog::Init(int paramAddr) currentSelectedSave = param.GetLastEmptySave(); break; default: - WARN_LOG(SCEUTILITY, "Unknown save list focus option: %d", param.GetPspParam()->focus); + WARN_LOG(Log::sceUtility, "Unknown save list focus option: %d", param.GetPspParam()->focus); currentSelectedSave = 0; break; } @@ -164,7 +164,7 @@ int PSPSaveDialog::Init(int paramAddr) switch ((SceUtilitySavedataType)(u32)param.GetPspParam()->mode) { case SCE_UTILITY_SAVEDATA_TYPE_LOAD: - DEBUG_LOG(SCEUTILITY, "Loading. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetSaveName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + DEBUG_LOG(Log::sceUtility, "Loading. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetSaveName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); if (param.GetFileInfo(0).size != 0) { if (param.GetFileInfo(0).broken) { param.GetPspParam()->common.result = SCE_UTILITY_SAVEDATA_ERROR_LOAD_DATA_BROKEN; @@ -176,20 +176,20 @@ int PSPSaveDialog::Init(int paramAddr) display = DS_LOAD_NODATA; break; case SCE_UTILITY_SAVEDATA_TYPE_AUTOLOAD: - DEBUG_LOG(SCEUTILITY, "Loading. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetSaveName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + DEBUG_LOG(Log::sceUtility, "Loading. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetSaveName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); display = DS_NONE; // Is this necessary? // currentSelectedSave = param.GetSelectedSave(); break; case SCE_UTILITY_SAVEDATA_TYPE_LISTLOAD: - DEBUG_LOG(SCEUTILITY, "Loading. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + DEBUG_LOG(Log::sceUtility, "Loading. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); if(param.GetFilenameCount() == 0) display = DS_LOAD_NODATA; else display = DS_LOAD_LIST_CHOICE; break; case SCE_UTILITY_SAVEDATA_TYPE_SAVE: - DEBUG_LOG(SCEUTILITY, "Saving. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + DEBUG_LOG(Log::sceUtility, "Saving. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); if (param.GetFileInfo(0).size != 0) { yesnoChoice = 0; @@ -199,17 +199,17 @@ int PSPSaveDialog::Init(int paramAddr) display = DS_SAVE_CONFIRM; break; case SCE_UTILITY_SAVEDATA_TYPE_AUTOSAVE: - DEBUG_LOG(SCEUTILITY, "Saving. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + DEBUG_LOG(Log::sceUtility, "Saving. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); display = DS_NONE; // Is this necessary? // currentSelectedSave = param.GetSelectedSave(); break; case SCE_UTILITY_SAVEDATA_TYPE_LISTSAVE: - DEBUG_LOG(SCEUTILITY, "Saving. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + DEBUG_LOG(Log::sceUtility, "Saving. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); display = DS_SAVE_LIST_CHOICE; break; case SCE_UTILITY_SAVEDATA_TYPE_LISTALLDELETE: - DEBUG_LOG(SCEUTILITY, "Delete. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + DEBUG_LOG(Log::sceUtility, "Delete. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); if(param.GetFilenameCount() == 0) display = DS_DELETE_NODATA; else @@ -232,7 +232,7 @@ int PSPSaveDialog::Init(int paramAddr) break; case SCE_UTILITY_SAVEDATA_TYPE_DELETE: - DEBUG_LOG(SCEUTILITY, "Delete. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + DEBUG_LOG(Log::sceUtility, "Delete. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); if (param.GetFileInfo(0).size != 0) { yesnoChoice = 0; display = DS_DELETE_CONFIRM; @@ -241,12 +241,12 @@ int PSPSaveDialog::Init(int paramAddr) break; case SCE_UTILITY_SAVEDATA_TYPE_AUTODELETE: - DEBUG_LOG(SCEUTILITY, "Delete. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + DEBUG_LOG(Log::sceUtility, "Delete. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); display = DS_NONE; break; case SCE_UTILITY_SAVEDATA_TYPE_LISTDELETE: - DEBUG_LOG(SCEUTILITY, "Delete. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + DEBUG_LOG(Log::sceUtility, "Delete. Title: %s Save: %s File: %s", param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); if (param.GetFilenameCount() == 0) display = DS_DELETE_NODATA; else @@ -254,7 +254,7 @@ int PSPSaveDialog::Init(int paramAddr) break; default: { - ERROR_LOG_REPORT(SCEUTILITY, "Load/Save function %d not coded. Title: %s Save: %s File: %s", (SceUtilitySavedataType)(u32)param.GetPspParam()->mode, param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); + ERROR_LOG_REPORT(Log::sceUtility, "Load/Save function %d not coded. Title: %s Save: %s File: %s", (SceUtilitySavedataType)(u32)param.GetPspParam()->mode, param.GetGameName(param.GetPspParam()).c_str(), param.GetGameName(param.GetPspParam()).c_str(), param.GetFileName(param.GetPspParam()).c_str()); param.GetPspParam()->common.result = 0; ChangeStatusInit(SAVEDATA_INIT_DELAY_US); display = DS_NONE; @@ -274,37 +274,37 @@ int PSPSaveDialog::Init(int paramAddr) UpdateButtons(); StartFade(true); - /*INFO_LOG(SCEUTILITY,"Dump Param :"); - INFO_LOG(SCEUTILITY,"size : %d",param.GetPspParam()->common.size); - INFO_LOG(SCEUTILITY,"language : %d",param.GetPspParam()->common.language); - INFO_LOG(SCEUTILITY,"buttonSwap : %d",param.GetPspParam()->common.buttonSwap); - INFO_LOG(SCEUTILITY,"result : %d",param.GetPspParam()->common.result); - INFO_LOG(SCEUTILITY,"mode : %d",param.GetPspParam()->mode); - INFO_LOG(SCEUTILITY,"bind : %d",param.GetPspParam()->bind); - INFO_LOG(SCEUTILITY,"overwriteMode : %d",param.GetPspParam()->overwriteMode); - INFO_LOG(SCEUTILITY,"gameName : %s",param.GetGameName(param.GetPspParam()).c_str()); - INFO_LOG(SCEUTILITY,"saveName : %s",param.GetPspParam()->saveName); - INFO_LOG(SCEUTILITY,"saveNameList : %08x",*((unsigned int*)¶m.GetPspParam()->saveNameList)); - INFO_LOG(SCEUTILITY,"fileName : %s",param.GetPspParam()->fileName); - INFO_LOG(SCEUTILITY,"dataBuf : %08x",*((unsigned int*)¶m.GetPspParam()->dataBuf)); - INFO_LOG(SCEUTILITY,"dataBufSize : %u",param.GetPspParam()->dataBufSize); - INFO_LOG(SCEUTILITY,"dataSize : %u",param.GetPspParam()->dataSize); + /*INFO_LOG(Log::sceUtility,"Dump Param :"); + INFO_LOG(Log::sceUtility,"size : %d",param.GetPspParam()->common.size); + INFO_LOG(Log::sceUtility,"language : %d",param.GetPspParam()->common.language); + INFO_LOG(Log::sceUtility,"buttonSwap : %d",param.GetPspParam()->common.buttonSwap); + INFO_LOG(Log::sceUtility,"result : %d",param.GetPspParam()->common.result); + INFO_LOG(Log::sceUtility,"mode : %d",param.GetPspParam()->mode); + INFO_LOG(Log::sceUtility,"bind : %d",param.GetPspParam()->bind); + INFO_LOG(Log::sceUtility,"overwriteMode : %d",param.GetPspParam()->overwriteMode); + INFO_LOG(Log::sceUtility,"gameName : %s",param.GetGameName(param.GetPspParam()).c_str()); + INFO_LOG(Log::sceUtility,"saveName : %s",param.GetPspParam()->saveName); + INFO_LOG(Log::sceUtility,"saveNameList : %08x",*((unsigned int*)¶m.GetPspParam()->saveNameList)); + INFO_LOG(Log::sceUtility,"fileName : %s",param.GetPspParam()->fileName); + INFO_LOG(Log::sceUtility,"dataBuf : %08x",*((unsigned int*)¶m.GetPspParam()->dataBuf)); + INFO_LOG(Log::sceUtility,"dataBufSize : %u",param.GetPspParam()->dataBufSize); + INFO_LOG(Log::sceUtility,"dataSize : %u",param.GetPspParam()->dataSize); - INFO_LOG(SCEUTILITY,"sfo title : %s",param.GetPspParam()->sfoParam.title); - INFO_LOG(SCEUTILITY,"sfo savedataTitle : %s",param.GetPspParam()->sfoParam.savedataTitle); - INFO_LOG(SCEUTILITY,"sfo detail : %s",param.GetPspParam()->sfoParam.detail); + INFO_LOG(Log::sceUtility,"sfo title : %s",param.GetPspParam()->sfoParam.title); + INFO_LOG(Log::sceUtility,"sfo savedataTitle : %s",param.GetPspParam()->sfoParam.savedataTitle); + INFO_LOG(Log::sceUtility,"sfo detail : %s",param.GetPspParam()->sfoParam.detail); - INFO_LOG(SCEUTILITY,"icon0 data : %08x",*((unsigned int*)¶m.GetPspParam()->icon0FileData.buf)); - INFO_LOG(SCEUTILITY,"icon0 size : %u",param.GetPspParam()->icon0FileData.bufSize); + INFO_LOG(Log::sceUtility,"icon0 data : %08x",*((unsigned int*)¶m.GetPspParam()->icon0FileData.buf)); + INFO_LOG(Log::sceUtility,"icon0 size : %u",param.GetPspParam()->icon0FileData.bufSize); - INFO_LOG(SCEUTILITY,"icon1 data : %08x",*((unsigned int*)¶m.GetPspParam()->icon1FileData.buf)); - INFO_LOG(SCEUTILITY,"icon1 size : %u",param.GetPspParam()->icon1FileData.bufSize); + INFO_LOG(Log::sceUtility,"icon1 data : %08x",*((unsigned int*)¶m.GetPspParam()->icon1FileData.buf)); + INFO_LOG(Log::sceUtility,"icon1 size : %u",param.GetPspParam()->icon1FileData.bufSize); - INFO_LOG(SCEUTILITY,"pic1 data : %08x",*((unsigned int*)¶m.GetPspParam()->pic1FileData.buf)); - INFO_LOG(SCEUTILITY,"pic1 size : %u",param.GetPspParam()->pic1FileData.bufSize); + INFO_LOG(Log::sceUtility,"pic1 data : %08x",*((unsigned int*)¶m.GetPspParam()->pic1FileData.buf)); + INFO_LOG(Log::sceUtility,"pic1 size : %u",param.GetPspParam()->pic1FileData.bufSize); - INFO_LOG(SCEUTILITY,"snd0 data : %08x",*((unsigned int*)¶m.GetPspParam()->snd0FileData.buf)); - INFO_LOG(SCEUTILITY,"snd0 size : %u",param.GetPspParam()->snd0FileData.bufSize);*/ + INFO_LOG(Log::sceUtility,"snd0 data : %08x",*((unsigned int*)¶m.GetPspParam()->snd0FileData.buf)); + INFO_LOG(Log::sceUtility,"snd0 size : %u",param.GetPspParam()->snd0FileData.bufSize);*/ return retval; } @@ -1145,7 +1145,7 @@ void PSPSaveDialog::ExecuteNotVisibleIOAction() { } break; case SCE_UTILITY_SAVEDATA_TYPE_DELETEDATA: - DEBUG_LOG(SCEUTILITY, "sceUtilitySavedata DELETEDATA: %s", param.GetPspParam()->saveName); + DEBUG_LOG(Log::sceUtility, "sceUtilitySavedata DELETEDATA: %s", param.GetPspParam()->saveName); if (param.Delete(param.GetPspParam(), param.GetSelectedSave())) { result = 0; } else { @@ -1210,7 +1210,7 @@ static void DoExecuteIOAction(PSPSaveDialog *dialog) { void PSPSaveDialog::StartIOThread() { if (ioThread) { - WARN_LOG_REPORT(SCEUTILITY, "Starting a save io thread when one already pending, uh oh."); + WARN_LOG_REPORT(Log::sceUtility, "Starting a save io thread when one already pending, uh oh."); JoinIOThread(); } diff --git a/Core/Dialog/PSPScreenshotDialog.cpp b/Core/Dialog/PSPScreenshotDialog.cpp index 6615e84252..9437d578bb 100644 --- a/Core/Dialog/PSPScreenshotDialog.cpp +++ b/Core/Dialog/PSPScreenshotDialog.cpp @@ -61,13 +61,13 @@ PSPScreenshotDialog::~PSPScreenshotDialog() { int PSPScreenshotDialog::Init(u32 paramAddr) { // Already running if (ReadStatus() != SCE_UTILITY_STATUS_NONE && ReadStatus() != SCE_UTILITY_STATUS_SHUTDOWN) { - ERROR_LOG_REPORT(HLE, "sceUtilityScreenshotInitStart(%08x): invalid status", paramAddr); + ERROR_LOG_REPORT(Log::HLE, "sceUtilityScreenshotInitStart(%08x): invalid status", paramAddr); return SCE_ERROR_UTILITY_INVALID_STATUS; } params_ = PSPPointer::Create(paramAddr); if (!params_.IsValid()) { - ERROR_LOG_REPORT(HLE, "sceUtilityScreenshotInitStart(%08x): invalid pointer", paramAddr); + ERROR_LOG_REPORT(Log::HLE, "sceUtilityScreenshotInitStart(%08x): invalid pointer", paramAddr); return SCE_KERNEL_ERROR_INVALID_POINTER; } @@ -78,7 +78,7 @@ int PSPScreenshotDialog::Init(u32 paramAddr) { break; default: - ERROR_LOG_REPORT(HLE, "sceUtilityScreenshotInitStart(%08x): invalid size %d", paramAddr, (u32)params_->base.size); + ERROR_LOG_REPORT(Log::HLE, "sceUtilityScreenshotInitStart(%08x): invalid size %d", paramAddr, (u32)params_->base.size); return SCE_ERROR_UTILITY_INVALID_PARAM_SIZE; } diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index 6d8427607a..8563e25fe3 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -221,7 +221,7 @@ void SavedataParam::Init() if (handle >= 0) { pspFileSystem.CloseFile(handle); } else { - INFO_LOG(IO, "Failed to create .nomedia file (might be ok if it already exists)"); + INFO_LOG(Log::IO, "Failed to create .nomedia file (might be ok if it already exists)"); } #endif } @@ -331,13 +331,13 @@ bool SavedataParam::Delete(SceUtilitySavedataParam* param, int saveId) { // Sanity check, preventing full delete of savedata/ in MGS PW demo (!) if (!strlen(param->gameName) && param->mode != SCE_UTILITY_SAVEDATA_TYPE_LISTALLDELETE) { - ERROR_LOG(SCEUTILITY, "Bad param with gameName empty - cannot delete save directory"); + ERROR_LOG(Log::sceUtility, "Bad param with gameName empty - cannot delete save directory"); return false; } std::string dirPath = GetSaveFilePath(param, GetSaveDir(saveId)); if (dirPath.size() == 0) { - ERROR_LOG(SCEUTILITY, "GetSaveFilePath returned empty - cannot delete save directory"); + ERROR_LOG(Log::sceUtility, "GetSaveFilePath returned empty - cannot delete save directory"); return false; } @@ -377,7 +377,7 @@ int SavedataParam::DeleteData(SceUtilitySavedataParam* param) { } if (!subFolder.size()) { - ERROR_LOG(SCEUTILITY, "Bad subfolder, ignoring delete of %s", filePath.c_str()); + ERROR_LOG(Log::sceUtility, "Bad subfolder, ignoring delete of %s", filePath.c_str()); return 0; } @@ -425,12 +425,12 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD return SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE; } if (param->dataSize > param->dataBufSize) { - ERROR_LOG_REPORT(SCEUTILITY, "Savedata buffer overflow: %d / %d", param->dataSize, param->dataBufSize); + ERROR_LOG_REPORT(Log::sceUtility, "Savedata buffer overflow: %d / %d", param->dataSize, param->dataBufSize); return SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_PARAMS; } auto validateSize = [](const PspUtilitySavedataFileData &data) { if (data.buf.IsValid() && data.bufSize < data.size) { - ERROR_LOG_REPORT(SCEUTILITY, "Savedata subdata buffer overflow: %d / %d", data.size, data.bufSize); + ERROR_LOG_REPORT(Log::sceUtility, "Savedata subdata buffer overflow: %d / %d", data.size, data.bufSize); return false; } return true; @@ -440,14 +440,14 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD } if (param->secureVersion > 3) { - ERROR_LOG_REPORT(SCEUTILITY, "Savedata version requested on save: %d", param->secureVersion); + ERROR_LOG_REPORT(Log::sceUtility, "Savedata version requested on save: %d", param->secureVersion); return SCE_UTILITY_SAVEDATA_ERROR_SAVE_PARAM; } else if (param->secureVersion != 0) { if (param->secureVersion != 1 && !HasKey(param) && secureMode) { - ERROR_LOG_REPORT(SCEUTILITY, "Savedata version with missing key on save: %d", param->secureVersion); + ERROR_LOG_REPORT(Log::sceUtility, "Savedata version with missing key on save: %d", param->secureVersion); return SCE_UTILITY_SAVEDATA_ERROR_SAVE_PARAM; } - WARN_LOG(SCEUTILITY, "Savedata version requested on save: %d", param->secureVersion); + WARN_LOG(Log::sceUtility, "Savedata version requested on save: %d", param->secureVersion); } std::string dirPath = GetSaveFilePath(param, GetSaveDir(param, saveDirName)); @@ -485,7 +485,7 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD if (EncryptData(decryptMode, cryptedData, &cryptedSize, &aligned_len, cryptedHash, (hasKey ? param->key : 0)) != 0) { auto err = GetI18NCategory(I18NCat::ERRORS); g_OSD.Show(OSDType::MESSAGE_WARNING, err->T("Save encryption failed. This save won't work on real PSP"), 6.0f); - ERROR_LOG(SCEUTILITY,"Save encryption failed. This save won't work on real PSP"); + ERROR_LOG(Log::sceUtility,"Save encryption failed. This save won't work on real PSP"); delete[] cryptedData; cryptedData = 0; } @@ -575,14 +575,14 @@ int SavedataParam::Save(SceUtilitySavedataParam* param, const std::string &saveD saveSize = cryptedSize; } - INFO_LOG(SCEUTILITY,"Saving file with size %u in %s",saveSize,filePath.c_str()); + INFO_LOG(Log::sceUtility,"Saving file with size %u in %s",saveSize,filePath.c_str()); // copy back save name in request strncpy(param->saveName, saveDirName.c_str(), 20); if (!fileName.empty()) { if (!WritePSPFile(filePath, data_, saveSize)) { - ERROR_LOG(SCEUTILITY, "Error writing file %s", filePath.c_str()); + ERROR_LOG(Log::sceUtility, "Error writing file %s", filePath.c_str()); delete[] cryptedData; return SCE_UTILITY_SAVEDATA_ERROR_SAVE_MS_NOSPACE; } @@ -668,14 +668,14 @@ int SavedataParam::Load(SceUtilitySavedataParam *param, const std::string &saveD int SavedataParam::LoadSaveData(SceUtilitySavedataParam *param, const std::string &saveDirName, const std::string &dirPath, bool secureMode) { if (param->secureVersion > 3) { - ERROR_LOG_REPORT(SCEUTILITY, "Savedata version requested: %d", param->secureVersion); + ERROR_LOG_REPORT(Log::sceUtility, "Savedata version requested: %d", param->secureVersion); return SCE_UTILITY_SAVEDATA_ERROR_LOAD_PARAM; } else if (param->secureVersion != 0) { if (param->secureVersion != 1 && !HasKey(param) && secureMode) { - ERROR_LOG_REPORT(SCEUTILITY, "Savedata version with missing key: %d", param->secureVersion); + ERROR_LOG_REPORT(Log::sceUtility, "Savedata version with missing key: %d", param->secureVersion); return SCE_UTILITY_SAVEDATA_ERROR_LOAD_PARAM; } - WARN_LOG_REPORT(SCEUTILITY, "Savedata version requested: %d", param->secureVersion); + WARN_LOG_REPORT(Log::sceUtility, "Savedata version requested: %d", param->secureVersion); } std::string filename = GetFileName(param); @@ -685,11 +685,11 @@ int SavedataParam::LoadSaveData(SceUtilitySavedataParam *param, const std::strin return 0; s64 readSize; - INFO_LOG(SCEUTILITY, "Loading file with size %u in %s", param->dataBufSize, filePath.c_str()); + INFO_LOG(Log::sceUtility, "Loading file with size %u in %s", param->dataBufSize, filePath.c_str()); u8 *saveData = nullptr; int saveSize = -1; if (!ReadPSPFile(filePath, &saveData, saveSize, &readSize)) { - ERROR_LOG(SCEUTILITY,"Error reading file %s",filePath.c_str()); + ERROR_LOG(Log::sceUtility,"Error reading file %s",filePath.c_str()); return SCE_UTILITY_SAVEDATA_ERROR_LOAD_NO_DATA; } saveSize = (int)readSize; @@ -769,7 +769,7 @@ u32 SavedataParam::LoadCryptedSave(SceUtilitySavedataParam *param, u8 *data, con if (decryptMode != prevCryptMode) { if (prevCryptMode == 1 && param->key[0] == 0) { // Backwards compat for a bug we used to have. - WARN_LOG(SCEUTILITY, "Savedata loading with hashmode %d instead of detected %d", prevCryptMode, decryptMode); + WARN_LOG(Log::sceUtility, "Savedata loading with hashmode %d instead of detected %d", prevCryptMode, decryptMode); decryptMode = prevCryptMode; // Don't notify the user if we're not going to upgrade the save. @@ -780,9 +780,9 @@ u32 SavedataParam::LoadCryptedSave(SceUtilitySavedataParam *param, u8 *data, con } } else { if (decryptMode == 5 && prevCryptMode == 3) { - WARN_LOG(SCEUTILITY, "Savedata loading with detected hashmode %d instead of file's %d", decryptMode, prevCryptMode); + WARN_LOG(Log::sceUtility, "Savedata loading with detected hashmode %d instead of file's %d", decryptMode, prevCryptMode); } else { - WARN_LOG_REPORT(SCEUTILITY, "Savedata loading with detected hashmode %d instead of file's %d", decryptMode, prevCryptMode); + WARN_LOG_REPORT(Log::sceUtility, "Savedata loading with detected hashmode %d instead of file's %d", decryptMode, prevCryptMode); } if (g_Config.bSavedataUpgrade) { decryptMode = prevCryptMode; @@ -802,7 +802,7 @@ u32 SavedataParam::LoadCryptedSave(SceUtilitySavedataParam *param, u8 *data, con } // TODO: Should return an error, but let's just try with a bad hash. if (err != 0 && expectedHash != nullptr) { - WARN_LOG(SCEUTILITY, "Incorrect hash on save data, likely corrupt"); + WARN_LOG(Log::sceUtility, "Incorrect hash on save data, likely corrupt"); resetData(decryptMode); err = DecryptSave(decryptMode, data_base, &saveSize, &align_len, hasKey ? cryptKey : nullptr, nullptr); } @@ -1265,23 +1265,23 @@ int SavedataParam::GetFilesList(SceUtilitySavedataParam *param, u32 requestAddr) } if (!param->fileList.IsValid()) { - ERROR_LOG_REPORT(SCEUTILITY, "SavedataParam::GetFilesList(): bad fileList address %08x", param->fileList.ptr); + ERROR_LOG_REPORT(Log::sceUtility, "SavedataParam::GetFilesList(): bad fileList address %08x", param->fileList.ptr); // Should crash. return -1; } auto &fileList = param->fileList; if (fileList->secureEntries.IsValid() && fileList->maxSecureEntries > 99) { - ERROR_LOG_REPORT(SCEUTILITY, "SavedataParam::GetFilesList(): too many secure entries, %d", fileList->maxSecureEntries); + ERROR_LOG_REPORT(Log::sceUtility, "SavedataParam::GetFilesList(): too many secure entries, %d", fileList->maxSecureEntries); return SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_PARAMS; } if (fileList->normalEntries.IsValid() && fileList->maxNormalEntries > 8192) { - ERROR_LOG_REPORT(SCEUTILITY, "SavedataParam::GetFilesList(): too many normal entries, %d", fileList->maxNormalEntries); + ERROR_LOG_REPORT(Log::sceUtility, "SavedataParam::GetFilesList(): too many normal entries, %d", fileList->maxNormalEntries); return SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_PARAMS; } if (sceKernelGetCompiledSdkVersion() >= 0x02060000) { if (fileList->systemEntries.IsValid() && fileList->maxSystemEntries > 5) { - ERROR_LOG_REPORT(SCEUTILITY, "SavedataParam::GetFilesList(): too many system entries, %d", fileList->maxSystemEntries); + ERROR_LOG_REPORT(Log::sceUtility, "SavedataParam::GetFilesList(): too many system entries, %d", fileList->maxSystemEntries); return SCE_UTILITY_SAVEDATA_ERROR_RW_BAD_PARAMS; } } @@ -1290,7 +1290,7 @@ int SavedataParam::GetFilesList(SceUtilitySavedataParam *param, u32 requestAddr) bool dirPathExists = false; auto files = pspFileSystem.GetDirListing(dirPath, &dirPathExists); if (!dirPathExists) { - DEBUG_LOG(SCEUTILITY, "SavedataParam::GetFilesList(): directory %s does not exist", dirPath.c_str()); + DEBUG_LOG(Log::sceUtility, "SavedataParam::GetFilesList(): directory %s does not exist", dirPath.c_str()); return SCE_UTILITY_SAVEDATA_ERROR_RW_NO_DATA; } @@ -1324,7 +1324,7 @@ int SavedataParam::GetFilesList(SceUtilitySavedataParam *param, u32 requestAddr) } // TODO: What are the exact rules? It definitely skips lowercase, and allows FILE or FILE.EXT. if (file->name.find_first_of("abcdefghijklmnopqrstuvwxyz") != file->name.npos) { - DEBUG_LOG(SCEUTILITY, "SavedataParam::GetFilesList(): skipping file %s with lowercase", file->name.c_str()); + DEBUG_LOG(Log::sceUtility, "SavedataParam::GetFilesList(): skipping file %s with lowercase", file->name.c_str()); continue; } @@ -1538,7 +1538,7 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) std::string fileDataPath = savePath + it->name; if (it->exists) { SetFileInfo(realCount, *it, saveName); - DEBUG_LOG(SCEUTILITY, "%s Exist", fileDataPath.c_str()); + DEBUG_LOG(Log::sceUtility, "%s Exist", fileDataPath.c_str()); ++realCount; } else { if (listEmptyFile) { @@ -1558,15 +1558,15 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) PSPFileInfo info = GetSaveInfo(fileDataDir); if (info.exists) { SetFileInfo(realCount, info, thisSaveName); - DEBUG_LOG(SCEUTILITY, "Save data exists: %s = %s", thisSaveName.c_str(), fileDataDir.c_str()); + DEBUG_LOG(Log::sceUtility, "Save data exists: %s = %s", thisSaveName.c_str(), fileDataDir.c_str()); realCount++; } else { if (listEmptyFile) { ClearFileInfo(saveDataList[realCount], thisSaveName); - DEBUG_LOG(SCEUTILITY, "Listing missing save data: %s = %s", thisSaveName.c_str(), fileDataDir.c_str()); + DEBUG_LOG(Log::sceUtility, "Listing missing save data: %s = %s", thisSaveName.c_str(), fileDataDir.c_str()); realCount++; } else { - DEBUG_LOG(SCEUTILITY, "Save data not found: %s = %s", thisSaveName.c_str(), fileDataDir.c_str()); + DEBUG_LOG(Log::sceUtility, "Save data not found: %s = %s", thisSaveName.c_str(), fileDataDir.c_str()); } } } @@ -1586,14 +1586,14 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) PSPFileInfo info = GetSaveInfo(fileDataDir); if (info.exists) { SetFileInfo(0, info, GetSaveName(param)); - DEBUG_LOG(SCEUTILITY, "Save data exists: %s = %s", GetSaveName(param).c_str(), fileDataDir.c_str()); + DEBUG_LOG(Log::sceUtility, "Save data exists: %s = %s", GetSaveName(param).c_str(), fileDataDir.c_str()); saveNameListDataCount = 1; } else { if (listEmptyFile) { ClearFileInfo(saveDataList[0], GetSaveName(param)); - DEBUG_LOG(SCEUTILITY, "Listing missing save data: %s = %s", GetSaveName(param).c_str(), fileDataDir.c_str()); + DEBUG_LOG(Log::sceUtility, "Listing missing save data: %s = %s", GetSaveName(param).c_str(), fileDataDir.c_str()); } else { - DEBUG_LOG(SCEUTILITY, "Save data not found: %s = %s", GetSaveName(param).c_str(), fileDataDir.c_str()); + DEBUG_LOG(Log::sceUtility, "Save data not found: %s = %s", GetSaveName(param).c_str(), fileDataDir.c_str()); } saveNameListDataCount = 0; return 0; @@ -1958,7 +1958,7 @@ int SavedataParam::GetSaveCryptMode(const SceUtilitySavedataParam *param, const return 5; default: // Well, it's not zero, so yes. - ERROR_LOG_REPORT(SCEUTILITY, "Unexpected SAVEDATA_PARAMS hash flag: %02x", tmpDataOrig[0]); + ERROR_LOG_REPORT(Log::sceUtility, "Unexpected SAVEDATA_PARAMS hash flag: %02x", tmpDataOrig[0]); return 1; } } diff --git a/Core/ELF/ElfReader.cpp b/Core/ELF/ElfReader.cpp index 2eec38aa86..7adceca25d 100644 --- a/Core/ELF/ElfReader.cpp +++ b/Core/ELF/ElfReader.cpp @@ -37,7 +37,7 @@ const char *ElfReader::GetSectionName(int section) const { int stringsOffset = GetSectionDataOffset(header->e_shstrndx); int nameOffset = sections[section].sh_name; if (nameOffset < 0 || (size_t)nameOffset + stringsOffset >= size_) { - ERROR_LOG(LOADER, "ELF: Bad name offset %d + %d in section %d (max = %d)", nameOffset, stringsOffset, section, (int)size_); + ERROR_LOG(Log::Loader, "ELF: Bad name offset %d + %d in section %d (max = %d)", nameOffset, stringsOffset, section, (int)size_); return nullptr; } const char *ptr = (const char *)GetSectionDataPtr(header->e_shstrndx); @@ -56,7 +56,7 @@ void addrToHiLo(u32 addr, u16 &hi, s16 &lo) u32 test = (hi<<16) + lo; if (test != addr) { - WARN_LOG_REPORT(LOADER, "HI16/LO16 relocation failure?"); + WARN_LOG_REPORT(Log::Loader, "HI16/LO16 relocation failure?"); } } @@ -64,7 +64,7 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) { std::vector relocOps; relocOps.resize(numRelocs); - DEBUG_LOG(LOADER, "Loading %i relocations...", numRelocs); + DEBUG_LOG(Log::Loader, "Loading %i relocations...", numRelocs); std::atomic numErrors; numErrors.store(0); @@ -79,7 +79,7 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) { int readwrite = (info >> 8) & 0xff; if (readwrite >= (int)ARRAY_SIZE(segmentVAddr)) { if (numErrors < 10) { - ERROR_LOG_REPORT(LOADER, "Bad segment number %i", readwrite); + ERROR_LOG_REPORT(Log::Loader, "Bad segment number %i", readwrite); } numErrors++; continue; @@ -90,9 +90,9 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) { // It appears that misaligned relocations are allowed. if (((addr & 3) && type != R_MIPS_32) || !Memory::IsValidAddress(addr)) { if (numErrors < 10) { - WARN_LOG_REPORT(LOADER, "Suspicious address %08x, skipping reloc, type = %d", addr, type); + WARN_LOG_REPORT(Log::Loader, "Suspicious address %08x, skipping reloc, type = %d", addr, type); } else if (numErrors == 10) { - WARN_LOG(LOADER, "Too many bad relocations, skipping logging"); + WARN_LOG(Log::Loader, "Too many bad relocations, skipping logging"); } numErrors++; continue; @@ -104,7 +104,7 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) { ParallelRangeLoop(&g_threadManager, [&](int l, int h) { for (int r = l; r < h; r++) { - VERBOSE_LOG(LOADER, "Loading reloc %i (%p)...", r, rels + r); + VERBOSE_LOG(Log::Loader, "Loading reloc %i (%p)...", r, rels + r); u32 info = rels[r].r_info; u32 addr = rels[r].r_offset; @@ -126,14 +126,14 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) { const bool log = false; //log=true; if (log) { - DEBUG_LOG(LOADER, "rel at: %08x info: %08x type: %i", addr, info, type); + DEBUG_LOG(Log::Loader, "rel at: %08x info: %08x type: %i", addr, info, type); } u32 relocateTo = relative >= (int)ARRAY_SIZE(segmentVAddr) ? 0 : segmentVAddr[relative]; switch (type) { case R_MIPS_32: if (log) - DEBUG_LOG(LOADER, "Full address reloc %08x", addr); + DEBUG_LOG(Log::Loader, "Full address reloc %08x", addr); //full address, no problemo op += relocateTo; break; @@ -141,14 +141,14 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) { case R_MIPS_26: //j, jal //add on to put in correct address space if (log) - DEBUG_LOG(LOADER, "j/jal reloc %08x", addr); + DEBUG_LOG(Log::Loader, "j/jal reloc %08x", addr); op = (op & 0xFC000000) | (((op & 0x03FFFFFF) + (relocateTo >> 2)) & 0x03FFFFFF); break; case R_MIPS_HI16: //lui part of lui-addiu pairs { if (log) - DEBUG_LOG(LOADER, "HI reloc %08x", addr); + DEBUG_LOG(Log::Loader, "HI reloc %08x", addr); u32 cur = (op & 0xFFFF) << 16; u16 hi = 0; @@ -165,19 +165,19 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) { if (t_type != R_MIPS_LO16) { if (t_type != R_MIPS_16) { // Let's play it safe for now and skip. We've only seen this type. - ERROR_LOG_REPORT(LOADER, "ELF relocation HI16/%d pair (instead of LO16) at %08x / %08x", t_type, addr, corrLoAddr); + ERROR_LOG_REPORT(Log::Loader, "ELF relocation HI16/%d pair (instead of LO16) at %08x / %08x", t_type, addr, corrLoAddr); continue; } else { - WARN_LOG_REPORT(LOADER, "ELF relocation HI16/%d(16) pair (instead of LO16) at %08x / %08x", t_type, addr, corrLoAddr); + WARN_LOG_REPORT(Log::Loader, "ELF relocation HI16/%d(16) pair (instead of LO16) at %08x / %08x", t_type, addr, corrLoAddr); } } // Should have matching index and segment info, according to llvm, which makes sense. if ((rels[t].r_info >> 8) != (rels[r].r_info >> 8)) { - WARN_LOG_REPORT(LOADER, "ELF relocation HI16/LO16 with mismatching r_info lo=%08x, hi=%08x", rels[t].r_info, rels[r].r_info); + WARN_LOG_REPORT(Log::Loader, "ELF relocation HI16/LO16 with mismatching r_info lo=%08x, hi=%08x", rels[t].r_info, rels[r].r_info); } if (log) { - DEBUG_LOG(LOADER, "Corresponding lo found at %08x", corrLoAddr); + DEBUG_LOG(Log::Loader, "Corresponding lo found at %08x", corrLoAddr); } if (Memory::IsValidAddress(corrLoAddr)) { s16 lo = (s16)relocOps[t]; @@ -187,11 +187,11 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) { found = true; break; } else { - ERROR_LOG(LOADER, "Bad corrLoAddr %08x", corrLoAddr); + ERROR_LOG(Log::Loader, "Bad corrLoAddr %08x", corrLoAddr); } } if (!found) { - ERROR_LOG_REPORT(LOADER, "R_MIPS_HI16: could not find R_MIPS_LO16 (r=%d of %d, addr=%08x)", r, numRelocs, addr); + ERROR_LOG_REPORT(Log::Loader, "R_MIPS_HI16: could not find R_MIPS_LO16 (r=%d of %d, addr=%08x)", r, numRelocs, addr); } op = (op & 0xFFFF0000) | hi; } @@ -200,7 +200,7 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) { case R_MIPS_LO16: //addiu part of lui-addiu pairs { if (log) - DEBUG_LOG(LOADER, "LO reloc %08x", addr); + DEBUG_LOG(Log::Loader, "LO reloc %08x", addr); u32 cur = op & 0xFFFF; cur += relocateTo; cur &= 0xFFFF; @@ -224,7 +224,7 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) { { char temp[256]; MIPSDisAsm(MIPSOpcode(op), 0, temp, sizeof(temp)); - ERROR_LOG_REPORT(LOADER, "ARGH IT'S AN UNKNOWN RELOCATION!!!!!!!! %08x, type=%d : %s", addr, type, temp); + ERROR_LOG_REPORT(Log::Loader, "ARGH IT'S AN UNKNOWN RELOCATION!!!!!!!! %08x, type=%d : %s", addr, type, temp); } break; } @@ -235,7 +235,7 @@ bool ElfReader::LoadRelocations(const Elf32_Rel *rels, int numRelocs) { }, 0, numRelocs, 128, TaskPriority::HIGH); if (numErrors) { - WARN_LOG(LOADER, "%i bad relocations found!!!", numErrors.load()); + WARN_LOG(Log::Loader, "%i bad relocations found!!!", numErrors.load()); } return numErrors == 0; } @@ -256,7 +256,7 @@ void ElfReader::LoadRelocations2(int rel_seg) buf = (u8*)GetSegmentPtr(rel_seg); if (!buf) { - ERROR_LOG_REPORT(LOADER, "Rel2 segment invalid"); + ERROR_LOG_REPORT(Log::Loader, "Rel2 segment invalid"); return; } end = buf+ph->p_filesz; @@ -303,14 +303,14 @@ void ElfReader::LoadRelocations2(int rel_seg) rel_base = buf[0] | (buf[1]<<8) | (buf[2]<<16) | (buf[3]<<24); buf += 4; }else{ - ERROR_LOG_REPORT(LOADER, "Rel2: invalid size flag! %x", flag); + ERROR_LOG_REPORT(Log::Loader, "Rel2: invalid size flag! %x", flag); rel_base = 0; } }else{ addr_seg = seg; relocate_to = addr_seg >= (int)ARRAY_SIZE(segmentVAddr) ? 0 : segmentVAddr[addr_seg]; if (!Memory::IsValidAddress(relocate_to)) { - ERROR_LOG_REPORT(LOADER, "ELF: Bad address to relocate to: %08x (segment %d)", relocate_to, addr_seg); + ERROR_LOG_REPORT(Log::Loader, "ELF: Bad address to relocate to: %08x (segment %d)", relocate_to, addr_seg); continue; } @@ -336,13 +336,13 @@ void ElfReader::LoadRelocations2(int rel_seg) rel_base = buf[0] | (buf[1]<<8) | (buf[2]<<16) | (buf[3]<<24); buf += 4; }else{ - ERROR_LOG_REPORT(LOADER, "Rel2: invalid relocat size flag! %x", flag); + ERROR_LOG_REPORT(Log::Loader, "Rel2: invalid relocat size flag! %x", flag); } rel_offset = rel_base+segmentVAddr[off_seg]; if (!Memory::IsValidAddress(rel_offset)) { - ERROR_LOG_REPORT(LOADER, "ELF: Bad rel_offset: %08x", rel_offset); + ERROR_LOG_REPORT(Log::Loader, "ELF: Bad rel_offset: %08x", rel_offset); continue; } @@ -357,11 +357,11 @@ void ElfReader::LoadRelocations2(int rel_seg) lo16 |= 0xffff0000; buf += 2; }else{ - ERROR_LOG_REPORT(LOADER, "Rel2: invalid lo16 type! %x", flag); + ERROR_LOG_REPORT(Log::Loader, "Rel2: invalid lo16 type! %x", flag); } op = Memory::Read_Instruction(rel_offset, true).encoding; - DEBUG_LOG(LOADER, "Rel2: %5d: CMD=0x%04X flag=%x type=%d off_seg=%d offset=%08x addr_seg=%d op=%08x\n", rcount, cmd, flag, type, off_seg, rel_base, addr_seg, op); + DEBUG_LOG(Log::Loader, "Rel2: %5d: CMD=0x%04X flag=%x type=%d off_seg=%d offset=%08x addr_seg=%d op=%08x\n", rcount, cmd, flag, type, off_seg, rel_base, addr_seg, op); switch(type){ case 0: @@ -390,7 +390,7 @@ void ElfReader::LoadRelocations2(int rel_seg) op = (op&0xffff0000) | (((op&0xffff)+relocate_to)&0xffff); break; default: - ERROR_LOG_REPORT(LOADER, "Rel2: unexpected relocation type! %x", type); + ERROR_LOG_REPORT(Log::Loader, "Rel2: unexpected relocation type! %x", type); break; } @@ -405,10 +405,10 @@ void ElfReader::LoadRelocations2(int rel_seg) int ElfReader::LoadInto(u32 loadAddress, bool fromTop) { - DEBUG_LOG(LOADER,"String section: %i", header->e_shstrndx); + DEBUG_LOG(Log::Loader,"String section: %i", header->e_shstrndx); if (size_ < sizeof(Elf32_Ehdr)) { - ERROR_LOG(LOADER, "Truncated ELF header, %d bytes", (int)size_); + ERROR_LOG(Log::Loader, "Truncated ELF header, %d bytes", (int)size_); // Probably not the right error code. return SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED; } @@ -423,14 +423,14 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop) return SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED; } - ERROR_LOG(LOADER, "Bad ELF, EI_CLASS (fifth byte) is 0x00, should be 0x01 - would lock up a PSP."); + ERROR_LOG(Log::Loader, "Bad ELF, EI_CLASS (fifth byte) is 0x00, should be 0x01 - would lock up a PSP."); } if (header->e_ident[EI_DATA] != ELFDATA2LSB) return SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED; if (size_ < header->e_phoff + sizeof(Elf32_Phdr) * GetNumSegments() || size_ < header->e_shoff + sizeof(Elf32_Shdr) * GetNumSections()) { - ERROR_LOG(LOADER, "Truncated ELF, %d bytes with %d sections and %d segments", (int)size_, GetNumSections(), GetNumSegments()); + ERROR_LOG(Log::Loader, "Truncated ELF, %d bytes with %d sections and %d segments", (int)size_, GetNumSections(), GetNumSegments()); // Probably not the right error code. return SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED; } @@ -498,19 +498,19 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop) } if (vaddr == (u32)-1) { - ERROR_LOG_REPORT(LOADER, "Failed to allocate memory for ELF!"); + ERROR_LOG_REPORT(Log::Loader, "Failed to allocate memory for ELF!"); return SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED; } if (bRelocate) { - DEBUG_LOG(LOADER,"Relocatable module"); + DEBUG_LOG(Log::Loader,"Relocatable module"); if (entryPoint != (u32)-1) entryPoint += vaddr; } else { - DEBUG_LOG(LOADER,"Prerelocated executable"); + DEBUG_LOG(Log::Loader,"Prerelocated executable"); } - DEBUG_LOG(LOADER,"%i segments:", header->e_phnum); + DEBUG_LOG(Log::Loader,"%i segments:", header->e_phnum); // First pass : Get the damn bits into RAM u32 baseAddress = bRelocate ? vaddr : 0; @@ -518,7 +518,7 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop) for (int i = 0; i < header->e_phnum; i++) { const Elf32_Phdr *p = segments + i; - DEBUG_LOG(LOADER, "Type: %08x Vaddr: %08x Filesz: %08x Memsz: %08x ", (int)p->p_type, (u32)p->p_vaddr, (int)p->p_filesz, (int)p->p_memsz); + DEBUG_LOG(Log::Loader, "Type: %08x Vaddr: %08x Filesz: %08x Memsz: %08x ", (int)p->p_type, (u32)p->p_vaddr, (int)p->p_filesz, (int)p->p_memsz); if (p->p_type == PT_LOAD) { @@ -527,7 +527,7 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop) const u8 *src = GetSegmentPtr(i); if (!src || p->p_offset + p->p_filesz > size_) { - ERROR_LOG(LOADER, "Segment %d pointer invalid - truncated?", i); + ERROR_LOG(Log::Loader, "Segment %d pointer invalid - truncated?", i); continue; } u32 srcSize = p->p_filesz; @@ -542,15 +542,15 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop) memcpy(dst, src, srcSize); std::string tag = StringFromFormat("ELFLoad/%08x", writeAddr); NotifyMemInfo(MemBlockFlags::WRITE, writeAddr, srcSize, tag.c_str(), tag.size()); - DEBUG_LOG(LOADER, "Loadable Segment Copied to %08x, size %08x", writeAddr, (u32)p->p_memsz); + DEBUG_LOG(Log::Loader, "Loadable Segment Copied to %08x, size %08x", writeAddr, (u32)p->p_memsz); } else { - ERROR_LOG(LOADER, "Bad ELF segment. Trying to write %d bytes to %08x", dstSize, writeAddr); + ERROR_LOG(Log::Loader, "Bad ELF segment. Trying to write %d bytes to %08x", dstSize, writeAddr); } } } memblock.ListBlocks(); - DEBUG_LOG(LOADER,"%i sections:", header->e_shnum); + DEBUG_LOG(Log::Loader,"%i sections:", header->e_shnum); sectionOffsets = new u32[GetNumSections()]; sectionAddrs = new u32[GetNumSections()]; @@ -568,15 +568,15 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop) { std::string tag = name && name[0] ? StringFromFormat("%s/%s", modName.c_str(), name) : StringFromFormat("%s/%08x", modName.c_str(), writeAddr); NotifyMemInfo(MemBlockFlags::SUB_ALLOC, writeAddr, s->sh_size, tag.c_str(), tag.size()); - DEBUG_LOG(LOADER,"Data Section found: %s Sitting at %08x, size %08x", name, writeAddr, (u32)s->sh_size); + DEBUG_LOG(Log::Loader,"Data Section found: %s Sitting at %08x, size %08x", name, writeAddr, (u32)s->sh_size); } else { - DEBUG_LOG(LOADER,"NonData Section found: %s Ignoring (size=%08x) (flags=%08x)", name, (u32)s->sh_size, (u32)s->sh_flags); + DEBUG_LOG(Log::Loader,"NonData Section found: %s Ignoring (size=%08x) (flags=%08x)", name, (u32)s->sh_size, (u32)s->sh_flags); } } - DEBUG_LOG(LOADER, "Relocations:"); + DEBUG_LOG(Log::Loader, "Relocations:"); // Second pass: Do necessary relocations for (int i = 0; i < GetNumSections(); i++) @@ -592,7 +592,7 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop) { if (!(sections[sectionToModify].sh_flags & SHF_ALLOC)) { - ERROR_LOG_REPORT(LOADER, "Trying to relocate non-loaded section %s", GetSectionName(sectionToModify)); + ERROR_LOG_REPORT(Log::Loader, "Trying to relocate non-loaded section %s", GetSectionName(sectionToModify)); continue; } @@ -602,22 +602,22 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop) if (GetSectionDataOffset(i) + sizeof(Elf32_Rel) * numRelocs > size_) rels = nullptr; - DEBUG_LOG(LOADER,"%s: Performing %i relocations on %s : offset = %08x", name, numRelocs, GetSectionName(sectionToModify), sections[i].sh_offset); + DEBUG_LOG(Log::Loader,"%s: Performing %i relocations on %s : offset = %08x", name, numRelocs, GetSectionName(sectionToModify), sections[i].sh_offset); if (!rels || !LoadRelocations(rels, numRelocs)) { - WARN_LOG(LOADER, "LoadInto: Relocs failed, trying anyway"); + WARN_LOG(Log::Loader, "LoadInto: Relocs failed, trying anyway"); } } else { - WARN_LOG_REPORT(LOADER, "sectionToModify = %i - ignoring PSP relocation sector %i", sectionToModify, i); + WARN_LOG_REPORT(Log::Loader, "sectionToModify = %i - ignoring PSP relocation sector %i", sectionToModify, i); } } else if (s->sh_type == SHT_REL) { - DEBUG_LOG(LOADER, "Traditional relocation section found."); + DEBUG_LOG(Log::Loader, "Traditional relocation section found."); if (!bRelocate) { - DEBUG_LOG(LOADER, "Binary is prerelocated. Skipping relocations."); + DEBUG_LOG(Log::Loader, "Binary is prerelocated. Skipping relocations."); } else { @@ -628,15 +628,15 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop) if (!(sections[sectionToModify].sh_flags & SHF_ALLOC)) { // Generally stuff like debug info. We don't need it. - INFO_LOG(LOADER, "Skipping relocation of non-loaded section %s", GetSectionName(sectionToModify)); + INFO_LOG(Log::Loader, "Skipping relocation of non-loaded section %s", GetSectionName(sectionToModify)); continue; } } else { - WARN_LOG_REPORT(LOADER, "sectionToModify = %i - ignoring relocation sector %i", sectionToModify, i); + WARN_LOG_REPORT(Log::Loader, "sectionToModify = %i - ignoring relocation sector %i", sectionToModify, i); } - ERROR_LOG_REPORT(LOADER, "Traditional relocations unsupported."); + ERROR_LOG_REPORT(Log::Loader, "Traditional relocations unsupported."); } } } @@ -647,17 +647,17 @@ int ElfReader::LoadInto(u32 loadAddress, bool fromTop) { const Elf32_Phdr *p = &segments[i]; if (p->p_type == PT_PSPREL1) { - INFO_LOG(LOADER,"Loading segment relocations"); + INFO_LOG(Log::Loader,"Loading segment relocations"); int numRelocs = p->p_filesz / sizeof(Elf32_Rel); Elf32_Rel *rels = (Elf32_Rel *)GetSegmentPtr(i); if (p->p_offset + p->p_filesz > size_) rels = nullptr; if (!rels || !LoadRelocations(rels, numRelocs)) { - ERROR_LOG(LOADER, "LoadInto: Relocs failed, trying anyway (2)"); + ERROR_LOG(Log::Loader, "LoadInto: Relocs failed, trying anyway (2)"); } } else if (p->p_type == PT_PSPREL2) { - INFO_LOG(LOADER,"Loading segment relocations2"); + INFO_LOG(Log::Loader,"Loading segment relocations2"); LoadRelocations2(i); } } @@ -749,7 +749,7 @@ bool ElfReader::LoadSymbols() int numSymbols = sections[sec].sh_size / sizeof(Elf32_Sym); if (!stringBase || !symtab || symtabOffset + sections[sec].sh_size > size_) { - ERROR_LOG(LOADER, "Symbols truncated - ignoring"); + ERROR_LOG(Log::Loader, "Symbols truncated - ignoring"); return false; } diff --git a/Core/ELF/PBPReader.cpp b/Core/ELF/PBPReader.cpp index 6bf9157813..72cab6df8d 100644 --- a/Core/ELF/PBPReader.cpp +++ b/Core/ELF/PBPReader.cpp @@ -25,26 +25,26 @@ PBPReader::PBPReader(FileLoader *fileLoader) : file_(nullptr), header_(), isELF_(false) { if (!fileLoader->Exists()) { - ERROR_LOG(LOADER, "Failed to open PBP file %s", fileLoader->GetPath().c_str()); + ERROR_LOG(Log::Loader, "Failed to open PBP file %s", fileLoader->GetPath().c_str()); return; } fileSize_ = (size_t)fileLoader->FileSize(); if (fileLoader->ReadAt(0, sizeof(header_), (u8 *)&header_) != sizeof(header_)) { - ERROR_LOG(LOADER, "PBP is too small to be valid: %s", fileLoader->GetPath().c_str()); + ERROR_LOG(Log::Loader, "PBP is too small to be valid: %s", fileLoader->GetPath().c_str()); return; } if (memcmp(header_.magic, "\0PBP", 4) != 0) { if (memcmp(header_.magic, "\nFLE", 4) != 0) { - VERBOSE_LOG(LOADER, "%s: File actually an ELF, not a PBP", fileLoader->GetPath().c_str()); + VERBOSE_LOG(Log::Loader, "%s: File actually an ELF, not a PBP", fileLoader->GetPath().c_str()); isELF_ = true; } else { - ERROR_LOG(LOADER, "Magic number in %s indicated no PBP: %s", fileLoader->GetPath().c_str(), header_.magic); + ERROR_LOG(Log::Loader, "Magic number in %s indicated no PBP: %s", fileLoader->GetPath().c_str(), header_.magic); } return; } - VERBOSE_LOG(LOADER, "Loading PBP, version = %08x", header_.version); + VERBOSE_LOG(Log::Loader, "Loading PBP, version = %08x", header_.version); file_ = fileLoader; } @@ -59,7 +59,7 @@ bool PBPReader::GetSubFile(PBPSubFile file, std::vector *out) { out->resize(expected); size_t bytes = file_->ReadAt(off, expected, &(*out)[0]); if (bytes != expected) { - ERROR_LOG(LOADER, "PBP file read truncated: %d -> %d", (int)expected, (int)bytes); + ERROR_LOG(Log::Loader, "PBP file read truncated: %d -> %d", (int)expected, (int)bytes); if (bytes < expected) { out->resize(bytes); } @@ -79,7 +79,7 @@ void PBPReader::GetSubFileAsString(PBPSubFile file, std::string *out) { out->resize(expected); size_t bytes = file_->ReadAt(off, expected, (void *)out->data()); if (bytes != expected) { - ERROR_LOG(LOADER, "PBP file read truncated: %d -> %d", (int)expected, (int)bytes); + ERROR_LOG(Log::Loader, "PBP file read truncated: %d -> %d", (int)expected, (int)bytes); if (bytes < expected) { out->resize(bytes); } diff --git a/Core/ELF/ParamSFO.cpp b/Core/ELF/ParamSFO.cpp index 0703b8f2af..fb41536273 100644 --- a/Core/ELF/ParamSFO.cpp +++ b/Core/ELF/ParamSFO.cpp @@ -97,7 +97,7 @@ std::string ParamSFOData::GetDiscID() { const std::string discID = GetValueString("DISC_ID"); if (discID.empty()) { std::string fakeID = GenerateFakeID(Path()); - WARN_LOG(LOADER, "No DiscID found - generating a fake one: '%s' (from %s)", fakeID.c_str(), PSP_CoreParameter().fileToStart.c_str()); + WARN_LOG(Log::Loader, "No DiscID found - generating a fake one: '%s' (from %s)", fakeID.c_str(), PSP_CoreParameter().fileToStart.c_str()); ValueData data; data.type = VT_UTF8; data.s_value = fakeID; @@ -115,7 +115,7 @@ bool ParamSFOData::ReadSFO(const u8 *paramsfo, size_t size) { if (header->magic != 0x46535000) return false; if (header->version != 0x00000101) - WARN_LOG(LOADER, "Unexpected SFO header version: %08x", header->version); + WARN_LOG(Log::Loader, "Unexpected SFO header version: %08x", header->version); const IndexTable *indexTables = (const IndexTable *)(paramsfo + sizeof(Header)); @@ -165,7 +165,7 @@ bool ParamSFOData::ReadSFO(const u8 *paramsfo, size_t size) { // Unsigned int const u32_le *data = (const u32_le *)(paramsfo + data_offset); SetValue(key, *data, indexTables[i].param_max_len); - VERBOSE_LOG(LOADER, "%s %08x", key.c_str(), *data); + VERBOSE_LOG(Log::Loader, "%s %08x", key.c_str(), *data); } break; case 0x0004: @@ -174,7 +174,7 @@ bool ParamSFOData::ReadSFO(const u8 *paramsfo, size_t size) { if (data_offset + indexTables[i].param_len > size) continue; const u8 *utfdata = (const u8 *)(paramsfo + data_offset); - VERBOSE_LOG(LOADER, "%s %s", key.c_str(), utfdata); + VERBOSE_LOG(Log::Loader, "%s %s", key.c_str(), utfdata); SetValue(key, utfdata, indexTables[i].param_len, indexTables[i].param_max_len); } break; @@ -183,7 +183,7 @@ bool ParamSFOData::ReadSFO(const u8 *paramsfo, size_t size) { { // TODO: Likely should use param_len here, but there's gotta be a reason we avoided it before. std::string str = readStringCapped(data_offset, indexTables[i].param_max_len); - VERBOSE_LOG(LOADER, "%s %s", key.c_str(), str.c_str()); + VERBOSE_LOG(Log::Loader, "%s %s", key.c_str(), str.c_str()); SetValue(key, str, indexTables[i].param_max_len); } break; @@ -200,7 +200,7 @@ int ParamSFOData::GetDataOffset(const u8 *paramsfo, const char *dataName) { if (header->magic != 0x46535000) return -1; if (header->version != 0x00000101) - WARN_LOG(LOADER, "Unexpected SFO header version: %08x", header->version); + WARN_LOG(Log::Loader, "Unexpected SFO header version: %08x", header->version); const IndexTable *indexTables = (const IndexTable *)(paramsfo + sizeof(Header)); diff --git a/Core/ELF/PrxDecrypter.cpp b/Core/ELF/PrxDecrypter.cpp index 3b21bf2cec..bf987f6fa7 100644 --- a/Core/ELF/PrxDecrypter.cpp +++ b/Core/ELF/PrxDecrypter.cpp @@ -713,7 +713,7 @@ static_assert(sizeof(PRXType6) == 0x150, "inconsistent size of PRX Type 6"); static int pspDecryptType0(const u8 *inbuf, u8 *outbuf, u32 size) { - INFO_LOG(LOADER, "Decrypting tag %02X", (u32)*(u32_le *)&inbuf[0xD0]); + INFO_LOG(Log::Loader, "Decrypting tag %02X", (u32)*(u32_le *)&inbuf[0xD0]); const auto decryptSize = *(s32_le*)&inbuf[0xB0]; const auto pti = GetTagInfo((u32)*(u32_le *)&inbuf[0xD0]); @@ -767,7 +767,7 @@ static int pspDecryptType0(const u8 *inbuf, u8 *outbuf, u32 size) static int pspDecryptType1(const u8 *inbuf, u8 *outbuf, u32 size) { - INFO_LOG(LOADER, "Decrypting tag %02X", (u32)*(u32_le *)&inbuf[0xD0]); + INFO_LOG(Log::Loader, "Decrypting tag %02X", (u32)*(u32_le *)&inbuf[0xD0]); const auto decryptSize = *(s32_le*)&inbuf[0xB0]; const auto pti = GetTagInfo((u32)*(u32_le *)&inbuf[0xD0]); @@ -822,7 +822,7 @@ static int pspDecryptType1(const u8 *inbuf, u8 *outbuf, u32 size) static int pspDecryptType2(const u8 *inbuf, u8 *outbuf, u32 size) { - INFO_LOG(LOADER, "Decrypting tag %02X", (u32)*(u32_le *)&inbuf[0xD0]); + INFO_LOG(Log::Loader, "Decrypting tag %02X", (u32)*(u32_le *)&inbuf[0xD0]); const auto decryptSize = *(s32_le*)&inbuf[0xB0]; const auto pti = GetTagInfo2((u32)*(u32_le *)&inbuf[0xD0]); @@ -886,7 +886,7 @@ static int pspDecryptType2(const u8 *inbuf, u8 *outbuf, u32 size) static int pspDecryptType5(const u8 *inbuf, u8 *outbuf, u32 size, const u8 *seed) { - INFO_LOG(LOADER, "Decrypting tag %02X", (u32)*(u32_le *)&inbuf[0xD0]); + INFO_LOG(Log::Loader, "Decrypting tag %02X", (u32)*(u32_le *)&inbuf[0xD0]); const auto decryptSize = *(s32_le*)&inbuf[0xB0]; const auto pti = GetTagInfo2((u32)*(u32_le *)&inbuf[0xD0]); @@ -950,7 +950,7 @@ static int pspDecryptType5(const u8 *inbuf, u8 *outbuf, u32 size, const u8 *seed static int pspDecryptType6(const u8 *inbuf, u8 *outbuf, u32 size) { - INFO_LOG(LOADER, "Decrypting tag %02X", (u32)*(u32_le *)&inbuf[0xD0]); + INFO_LOG(Log::Loader, "Decrypting tag %02X", (u32)*(u32_le *)&inbuf[0xD0]); const auto decryptSize = *(s32_le*)&inbuf[0xB0]; const auto pti = GetTagInfo2((u32)*(u32_le *)&inbuf[0xD0]); diff --git a/Core/FileLoaders/DiskCachingFileLoader.cpp b/Core/FileLoaders/DiskCachingFileLoader.cpp index 74df741201..12b715072c 100644 --- a/Core/FileLoaders/DiskCachingFileLoader.cpp +++ b/Core/FileLoaders/DiskCachingFileLoader.cpp @@ -212,7 +212,7 @@ void DiskCachingFileLoaderCache::ShutdownCache() { } if (failed) { // Leave it locked, it's broken. - ERROR_LOG(LOADER, "Unable to flush disk cache."); + ERROR_LOG(Log::Loader, "Unable to flush disk cache."); } else { LockCacheFile(false); } @@ -475,7 +475,7 @@ bool DiskCachingFileLoaderCache::ReadBlockData(u8 *dest, BlockInfo &info, size_t #endif if (failed) { - ERROR_LOG(LOADER, "Unable to read disk cache data entry."); + ERROR_LOG(Log::Loader, "Unable to read disk cache data entry."); CloseFileHandle(); } return !failed; @@ -503,7 +503,7 @@ void DiskCachingFileLoaderCache::WriteBlockData(BlockInfo &info, const u8 *src) #endif if (failed) { - ERROR_LOG(LOADER, "Unable to write disk cache data entry."); + ERROR_LOG(Log::Loader, "Unable to write disk cache data entry."); CloseFileHandle(); } } @@ -523,7 +523,7 @@ void DiskCachingFileLoaderCache::WriteIndexData(u32 indexPos, BlockInfo &info) { } if (failed) { - ERROR_LOG(LOADER, "Unable to write disk cache index entry."); + ERROR_LOG(Log::Loader, "Unable to write disk cache index entry."); CloseFileHandle(); } } @@ -564,7 +564,7 @@ bool DiskCachingFileLoaderCache::LoadCacheFile(const Path &path) { flags_ = header.flags; LoadCacheIndex(); } else { - ERROR_LOG(LOADER, "Disk cache file header did not match, recreating cache file"); + ERROR_LOG(Log::Loader, "Disk cache file header did not match, recreating cache file"); fclose(fp); } @@ -621,14 +621,14 @@ void DiskCachingFileLoaderCache::CreateCacheFile(const Path &path) { if (maxBlocks_ < MAX_BLOCKS_LOWER_BOUND) { // There's not enough free space to cache, disable. f_ = nullptr; - ERROR_LOG(LOADER, "Not enough free space; disabling disk cache"); + ERROR_LOG(Log::Loader, "Not enough free space; disabling disk cache"); return; } flags_ = 0; f_ = File::OpenCFile(path, "wb+"); if (!f_) { - ERROR_LOG(LOADER, "Could not create disk cache file"); + ERROR_LOG(Log::Loader, "Could not create disk cache file"); return; } #ifdef __ANDROID__ @@ -666,7 +666,7 @@ void DiskCachingFileLoaderCache::CreateCacheFile(const Path &path) { return; } - INFO_LOG(LOADER, "Created new disk cache file for %s", origPath_.c_str()); + INFO_LOG(Log::Loader, "Created new disk cache file for %s", origPath_.c_str()); } bool DiskCachingFileLoaderCache::LockCacheFile(bool lockStatus) { @@ -684,7 +684,7 @@ bool DiskCachingFileLoaderCache::LockCacheFile(bool lockStatus) { } if (failed) { - ERROR_LOG(LOADER, "Unable to read current flags during disk cache locking"); + ERROR_LOG(Log::Loader, "Unable to read current flags during disk cache locking"); CloseFileHandle(); return false; } @@ -692,13 +692,13 @@ bool DiskCachingFileLoaderCache::LockCacheFile(bool lockStatus) { // TODO: Also use flock where supported? if (lockStatus) { if ((flags_ & FLAG_LOCKED) != 0) { - ERROR_LOG(LOADER, "Could not lock disk cache file for %s (already locked)", origPath_.c_str()); + ERROR_LOG(Log::Loader, "Could not lock disk cache file for %s (already locked)", origPath_.c_str()); return false; } flags_ |= FLAG_LOCKED; } else { if ((flags_ & FLAG_LOCKED) == 0) { - ERROR_LOG(LOADER, "Could not unlock disk cache file for %s", origPath_.c_str()); + ERROR_LOG(Log::Loader, "Could not unlock disk cache file for %s", origPath_.c_str()); return false; } flags_ &= ~FLAG_LOCKED; @@ -713,15 +713,15 @@ bool DiskCachingFileLoaderCache::LockCacheFile(bool lockStatus) { } if (failed) { - ERROR_LOG(LOADER, "Unable to write updated flags during disk cache locking"); + ERROR_LOG(Log::Loader, "Unable to write updated flags during disk cache locking"); CloseFileHandle(); return false; } if (lockStatus) { - INFO_LOG(LOADER, "Locked disk cache file for %s", origPath_.c_str()); + INFO_LOG(Log::Loader, "Locked disk cache file for %s", origPath_.c_str()); } else { - INFO_LOG(LOADER, "Unlocked disk cache file for %s", origPath_.c_str()); + INFO_LOG(Log::Loader, "Unlocked disk cache file for %s", origPath_.c_str()); } return true; } diff --git a/Core/FileLoaders/HTTPFileLoader.cpp b/Core/FileLoaders/HTTPFileLoader.cpp index 1aba908484..2d9d966cdc 100644 --- a/Core/FileLoaders/HTTPFileLoader.cpp +++ b/Core/FileLoaders/HTTPFileLoader.cpp @@ -50,7 +50,7 @@ void HTTPFileLoader::Prepare() { url = url.Relative(redirectURL); if (url.ToString() == url_.ToString() || url.ToString() == resourceURL.ToString()) { - ERROR_LOG(LOADER, "HTTP request failed, hit a redirect loop"); + ERROR_LOG(Log::Loader, "HTTP request failed, hit a redirect loop"); latestError_ = "Could not connect (redirect loop)"; return; } @@ -61,14 +61,14 @@ void HTTPFileLoader::Prepare() { } // No Location header? - ERROR_LOG(LOADER, "HTTP request failed, invalid redirect"); + ERROR_LOG(Log::Loader, "HTTP request failed, invalid redirect"); latestError_ = "Could not connect (invalid response)"; return; } if (code != 200) { // Leave size at 0, invalid. - ERROR_LOG(LOADER, "HTTP request failed, got %03d for %s", code, filename_.c_str()); + ERROR_LOG(Log::Loader, "HTTP request failed, got %03d for %s", code, filename_.c_str()); latestError_ = "Could not connect (invalid response)"; Disconnect(); return; @@ -105,10 +105,10 @@ void HTTPFileLoader::Prepare() { Disconnect(); if (!acceptsRange) { - WARN_LOG(LOADER, "HTTP server did not advertise support for range requests."); + WARN_LOG(Log::Loader, "HTTP server did not advertise support for range requests."); } if (filesize_ == 0) { - ERROR_LOG(LOADER, "Could not determine file size for %s", filename_.c_str()); + ERROR_LOG(Log::Loader, "Could not determine file size for %s", filename_.c_str()); } // If we didn't end up with a filesize_ (e.g. chunked response), give up. File invalid. @@ -117,13 +117,13 @@ void HTTPFileLoader::Prepare() { int HTTPFileLoader::SendHEAD(const Url &url, std::vector &responseHeaders) { if (!url.Valid()) { - ERROR_LOG(LOADER, "HTTP request failed, invalid URL: '%s'", url.ToString().c_str()); + ERROR_LOG(Log::Loader, "HTTP request failed, invalid URL: '%s'", url.ToString().c_str()); latestError_ = "Invalid URL"; return -400; } if (!client_.Resolve(url.Host().c_str(), url.Port())) { - ERROR_LOG(LOADER, "HTTP request failed, unable to resolve: |%s| port %d", url.Host().c_str(), url.Port()); + ERROR_LOG(Log::Loader, "HTTP request failed, unable to resolve: |%s| port %d", url.Host().c_str(), url.Port()); latestError_ = "Could not connect (name not resolved)"; return -400; } @@ -133,7 +133,7 @@ int HTTPFileLoader::SendHEAD(const Url &url, std::vector &responseH client_.SetDataTimeout(timeout); Connect(10.0); if (!connected_) { - ERROR_LOG(LOADER, "HTTP request failed, failed to connect: %s port %d (resource: '%s')", url.Host().c_str(), url.Port(), url.Resource().c_str()); + ERROR_LOG(Log::Loader, "HTTP request failed, failed to connect: %s port %d (resource: '%s')", url.Host().c_str(), url.Port(), url.Resource().c_str()); latestError_ = "Could not connect (refused to connect)"; return -400; } @@ -141,7 +141,7 @@ int HTTPFileLoader::SendHEAD(const Url &url, std::vector &responseH http::RequestParams req(url.Resource(), "*/*"); int err = client_.SendRequest("HEAD", req, nullptr, &progress_); if (err < 0) { - ERROR_LOG(LOADER, "HTTP request failed, failed to send request: %s port %d", url.Host().c_str(), url.Port()); + ERROR_LOG(Log::Loader, "HTTP request failed, failed to send request: %s port %d", url.Host().c_str(), url.Port()); latestError_ = "Could not connect (could not request data)"; Disconnect(); return -400; @@ -210,7 +210,7 @@ size_t HTTPFileLoader::ReadAt(s64 absolutePos, size_t bytes, void *data, Flags f std::vector responseHeaders; int code = client_.ReadResponseHeaders(&readbuf, responseHeaders, &progress_); if (code != 206) { - ERROR_LOG(LOADER, "HTTP server did not respond with range, received code=%03d", code); + ERROR_LOG(Log::Loader, "HTTP server did not respond with range, received code=%03d", code); latestError_ = "Invalid response reading data"; Disconnect(); return 0; @@ -229,10 +229,10 @@ size_t HTTPFileLoader::ReadAt(s64 absolutePos, size_t bytes, void *data, Flags f if (first == absolutePos && last == absoluteEnd - 1) { supportedResponse = true; } else { - ERROR_LOG(LOADER, "Unexpected HTTP range: got %lld-%lld, wanted %lld-%lld.", first, last, absolutePos, absoluteEnd - 1); + ERROR_LOG(Log::Loader, "Unexpected HTTP range: got %lld-%lld, wanted %lld-%lld.", first, last, absolutePos, absoluteEnd - 1); } } else { - ERROR_LOG(LOADER, "Unexpected HTTP range response: %s", header.c_str()); + ERROR_LOG(Log::Loader, "Unexpected HTTP range response: %s", header.c_str()); } } } @@ -241,7 +241,7 @@ size_t HTTPFileLoader::ReadAt(s64 absolutePos, size_t bytes, void *data, Flags f net::Buffer output; int res = client_.ReadResponseEntity(&readbuf, responseHeaders, &output, &progress_); if (res != 0) { - ERROR_LOG(LOADER, "Unable to read HTTP response entity: %d", res); + ERROR_LOG(Log::Loader, "Unable to read HTTP response entity: %d", res); // Let's take anything we got anyway. Not worse than returning nothing? } @@ -249,7 +249,7 @@ size_t HTTPFileLoader::ReadAt(s64 absolutePos, size_t bytes, void *data, Flags f Disconnect(); if (!supportedResponse) { - ERROR_LOG(LOADER, "HTTP server did not respond with the range we wanted."); + ERROR_LOG(Log::Loader, "HTTP server did not respond with the range we wanted."); latestError_ = "Invalid response reading data"; return 0; } diff --git a/Core/FileLoaders/LocalFileLoader.cpp b/Core/FileLoaders/LocalFileLoader.cpp index 3a329cc36d..05f55f73e3 100644 --- a/Core/FileLoaders/LocalFileLoader.cpp +++ b/Core/FileLoaders/LocalFileLoader.cpp @@ -60,7 +60,7 @@ void LocalFileLoader::DetectSizeFd() { LocalFileLoader::LocalFileLoader(const Path &filename) : filesize_(0), filename_(filename) { if (filename.empty()) { - ERROR_LOG(FILESYS, "LocalFileLoader can't load empty filenames"); + ERROR_LOG(Log::FileSystem, "LocalFileLoader can't load empty filenames"); return; } @@ -76,9 +76,9 @@ LocalFileLoader::LocalFileLoader(const Path &filename) #if PPSSPP_PLATFORM(ANDROID) && !defined(HAVE_LIBRETRO_VFS) if (filename.Type() == PathType::CONTENT_URI) { int fd = Android_OpenContentUriFd(filename.ToString(), Android_OpenContentUriMode::READ); - VERBOSE_LOG(SYSTEM, "LocalFileLoader Fd %d for content URI: '%s'", fd, filename.c_str()); + VERBOSE_LOG(Log::System, "LocalFileLoader Fd %d for content URI: '%s'", fd, filename.c_str()); if (fd < 0) { - ERROR_LOG(FILESYS, "LocalFileLoader failed to open content URI: '%s'", filename.c_str()); + ERROR_LOG(Log::FileSystem, "LocalFileLoader failed to open content URI: '%s'", filename.c_str()); return; } fd_ = fd; @@ -180,7 +180,7 @@ size_t LocalFileLoader::ReadAt(s64 absolutePos, size_t bytes, size_t count, void return 0; if (filesize_ == 0) { - ERROR_LOG(FILESYS, "ReadAt from 0-sized file: %s", filename_.c_str()); + ERROR_LOG(Log::FileSystem, "ReadAt from 0-sized file: %s", filename_.c_str()); return 0; } diff --git a/Core/FileSystems/BlockDevices.cpp b/Core/FileSystems/BlockDevices.cpp index 7c590e21d7..4b2d72ccaa 100644 --- a/Core/FileSystems/BlockDevices.cpp +++ b/Core/FileSystems/BlockDevices.cpp @@ -44,7 +44,7 @@ BlockDevice *constructBlockDevice(FileLoader *fileLoader) { return nullptr; } if (fileLoader->IsDirectory()) { - ERROR_LOG(LOADER, "Can't open directory directly as block device: %s", fileLoader->GetPath().c_str()); + ERROR_LOG(Log::Loader, "Can't open directory directly as block device: %s", fileLoader->GetPath().c_str()); return nullptr; } @@ -91,7 +91,7 @@ bool FileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached) { FileLoader::Flags flags = uncached ? FileLoader::Flags::HINT_UNCACHED : FileLoader::Flags::NONE; size_t retval = fileLoader_->ReadAt((u64)blockNumber * (u64)GetBlockSize(), 1, 2048, outPtr, flags); if (retval != 2048) { - DEBUG_LOG(FILESYS, "Could not read 2048 byte block, at block offset %d. Only got %d bytes", blockNumber, (int)retval); + DEBUG_LOG(Log::FileSystem, "Could not read 2048 byte block, at block offset %d. Only got %d bytes", blockNumber, (int)retval); return false; } @@ -101,7 +101,7 @@ bool FileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached) { bool FileBlockDevice::ReadBlocks(u32 minBlock, int count, u8 *outPtr) { size_t retval = fileLoader_->ReadAt((u64)minBlock * (u64)GetBlockSize(), 2048, count, outPtr); if (retval != (size_t)count) { - ERROR_LOG(FILESYS, "Could not read %d blocks, at block offset %d. Only got %d blocks", count, minBlock, (int)retval); + ERROR_LOG(Log::FileSystem, "Could not read %d blocks, at block offset %d. Only got %d blocks", count, minBlock, (int)retval); return false; } return true; @@ -145,17 +145,17 @@ CISOFileBlockDevice::CISOFileBlockDevice(FileLoader *fileLoader) CISO_H hdr; size_t readSize = fileLoader->ReadAt(0, sizeof(CISO_H), 1, &hdr); if (readSize != 1 || memcmp(hdr.magic, "CISO", 4) != 0) { - WARN_LOG(LOADER, "Invalid CSO!"); + WARN_LOG(Log::Loader, "Invalid CSO!"); } if (hdr.ver > 1) { - WARN_LOG(LOADER, "CSO version too high!"); + WARN_LOG(Log::Loader, "CSO version too high!"); } frameSize = hdr.block_size; if ((frameSize & (frameSize - 1)) != 0) - ERROR_LOG(LOADER, "CSO block size %i unsupported, must be a power of two", frameSize); + ERROR_LOG(Log::Loader, "CSO block size %i unsupported, must be a power of two", frameSize); else if (frameSize < 0x800) - ERROR_LOG(LOADER, "CSO block size %i unsupported, must be at least one sector", frameSize); + ERROR_LOG(Log::Loader, "CSO block size %i unsupported, must be at least one sector", frameSize); // Determine the translation from block to frame. blockShift = 0; @@ -166,7 +166,7 @@ CISOFileBlockDevice::CISOFileBlockDevice(FileLoader *fileLoader) const u64 totalSize = hdr.total_bytes; numFrames = (u32)((totalSize + frameSize - 1) / frameSize); numBlocks = (u32)(totalSize / GetBlockSize()); - VERBOSE_LOG(LOADER, "CSO numBlocks=%i numFrames=%i align=%i", numBlocks, numFrames, indexShift); + VERBOSE_LOG(Log::Loader, "CSO numBlocks=%i numFrames=%i align=%i", numBlocks, numFrames, indexShift); // We might read a bit of alignment too, so be prepared. if (frameSize + (1 << indexShift) < CSO_READ_BUFFER_SIZE) @@ -207,7 +207,7 @@ CISOFileBlockDevice::CISOFileBlockDevice(FileLoader *fileLoader) u64 lastIndexPos = index[indexSize - 1] & 0x7FFFFFFF; u64 expectedFileSize = lastIndexPos << indexShift; if (expectedFileSize > fileSize) { - ERROR_LOG(LOADER, "Expected CSO to at least be %lld bytes, but file is %lld bytes. File: '%s'", + ERROR_LOG(Log::Loader, "Expected CSO to at least be %lld bytes, but file is %lld bytes. File: '%s'", expectedFileSize, fileSize, fileLoader->GetPath().c_str()); NotifyReadError(); } @@ -258,7 +258,7 @@ bool CISOFileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached) z.zfree = Z_NULL; z.opaque = Z_NULL; if (inflateInit2(&z, -15) != Z_OK) { - ERROR_LOG(LOADER, "GetBlockSize() ERROR: %s\n", (z.msg) ? z.msg : "?"); + ERROR_LOG(Log::Loader, "GetBlockSize() ERROR: %s\n", (z.msg) ? z.msg : "?"); NotifyReadError(); return false; } @@ -269,14 +269,14 @@ bool CISOFileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached) int status = inflate(&z, Z_FINISH); if (status != Z_STREAM_END) { - ERROR_LOG(LOADER, "block %d: inflate : %s[%d]\n", blockNumber, (z.msg) ? z.msg : "error", status); + ERROR_LOG(Log::Loader, "block %d: inflate : %s[%d]\n", blockNumber, (z.msg) ? z.msg : "error", status); NotifyReadError(); inflateEnd(&z); memset(outPtr, 0, GetBlockSize()); return false; } if (z.total_out != frameSize) { - ERROR_LOG(LOADER, "block %d: block size error %d != %d\n", blockNumber, (u32)z.total_out, frameSize); + ERROR_LOG(Log::Loader, "block %d: block size error %d != %d\n", blockNumber, (u32)z.total_out, frameSize); NotifyReadError(); inflateEnd(&z); memset(outPtr, 0, GetBlockSize()); @@ -314,7 +314,7 @@ bool CISOFileBlockDevice::ReadBlocks(u32 minBlock, int count, u8 *outPtr) { z_stream z{}; if (inflateInit2(&z, -15) != Z_OK) { - ERROR_LOG(LOADER, "Unable to initialize inflate: %s\n", (z.msg) ? z.msg : "?"); + ERROR_LOG(Log::Loader, "Unable to initialize inflate: %s\n", (z.msg) ? z.msg : "?"); return false; } @@ -358,11 +358,11 @@ bool CISOFileBlockDevice::ReadBlocks(u32 minBlock, int count, u8 *outPtr) { int status = inflate(&z, Z_FINISH); if (status != Z_STREAM_END) { - ERROR_LOG(LOADER, "Inflate frame %d: failed - %s[%d]\n", frame, (z.msg) ? z.msg : "error", status); + ERROR_LOG(Log::Loader, "Inflate frame %d: failed - %s[%d]\n", frame, (z.msg) ? z.msg : "error", status); NotifyReadError(); memset(outPtr, 0, frameBlocks * GetBlockSize()); } else if (z.total_out != frameSize) { - ERROR_LOG(LOADER, "Inflate frame %d: block size error %d != %d\n", frame, (u32)z.total_out, frameSize); + ERROR_LOG(Log::Loader, "Inflate frame %d: block size error %d != %d\n", frame, (u32)z.total_out, frameSize); NotifyReadError(); memset(outPtr, 0, frameBlocks * GetBlockSize()); } else if (frameBlocks != blocksPerFrame) { @@ -395,7 +395,7 @@ NPDRMDemoBlockDevice::NPDRMDemoBlockDevice(FileLoader *fileLoader) fileLoader_->ReadAt(0x24, 1, 4, &psarOffset); size_t readSize = fileLoader_->ReadAt(psarOffset, 1, 256, &np_header); if (readSize != 256){ - ERROR_LOG(LOADER, "Invalid NPUMDIMG header!"); + ERROR_LOG(Log::Loader, "Invalid NPUMDIMG header!"); } kirk_init(); @@ -428,7 +428,7 @@ NPDRMDemoBlockDevice::NPDRMDemoBlockDevice(FileLoader *fileLoader) readSize = fileLoader_->ReadAt(psarOffset + tableOffset, 1, tableSize, table); if(readSize!=tableSize){ - ERROR_LOG(LOADER, "Invalid NPUMDIMG table!"); + ERROR_LOG(Log::Loader, "Invalid NPUMDIMG table!"); } u32 *p = (u32*)table; @@ -510,7 +510,7 @@ bool NPDRMDemoBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached) if(table[block].sizeGetPath().c_str()); + ERROR_LOG(Log::Loader, "Error loading CHD '%s': parents not found", fileLoader->GetPath().c_str()); NotifyReadError(); return; } @@ -636,7 +636,7 @@ CHDFileBlockDevice::CHDFileBlockDevice(FileLoader *fileLoader) chd_file *file = nullptr; chd_error err = chd_open_core_file(&core_file_->core, CHD_OPEN_READ, NULL, &file); if (err != CHDERR_NONE) { - ERROR_LOG(LOADER, "Error loading CHD '%s': %s", paths[depth].c_str(), chd_error_string(err)); + ERROR_LOG(Log::Loader, "Error loading CHD '%s': %s", paths[depth].c_str(), chd_error_string(err)); NotifyReadError(); return; } @@ -661,7 +661,7 @@ CHDFileBlockDevice::~CHDFileBlockDevice() bool CHDFileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached) { if (!impl_->chd) { - ERROR_LOG(LOADER, "ReadBlock: CHD not open. %s", fileLoader_->GetPath().c_str()); + ERROR_LOG(Log::Loader, "ReadBlock: CHD not open. %s", fileLoader_->GetPath().c_str()); return false; } if ((u32)blockNumber >= numBlocks) { @@ -674,7 +674,7 @@ bool CHDFileBlockDevice::ReadBlock(int blockNumber, u8 *outPtr, bool uncached) if (currentHunk != hunk) { chd_error err = chd_read(impl_->chd, hunk, readBuffer); if (err != CHDERR_NONE) { - ERROR_LOG(LOADER, "CHD read failed: %d %d %s", blockNumber, hunk, chd_error_string(err)); + ERROR_LOG(Log::Loader, "CHD read failed: %d %d %s", blockNumber, hunk, chd_error_string(err)); NotifyReadError(); } currentHunk = hunk; diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index a626e4cf22..b98fb0e68b 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -123,7 +123,7 @@ bool DirectoryFileHandle::Open(const Path &basePath, std::string &fileName, File #if HOST_IS_CASE_SENSITIVE if (access & (FILEACCESS_APPEND | FILEACCESS_CREATE | FILEACCESS_WRITE)) { - DEBUG_LOG(FILESYS, "Checking case for path %s", fileName.c_str()); + DEBUG_LOG(Log::FileSystem, "Checking case for path %s", fileName.c_str()); if (!FixPathCase(basePath, fileName, FPC_PATH_MUST_EXIST)) { error = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; return false; // or go on and attempt (for a better error code than just 0?) @@ -225,7 +225,7 @@ bool DirectoryFileHandle::Open(const Path &basePath, std::string &fileName, File // Success return true; } else { - ERROR_LOG(FILESYS, "File::OpenFD returned an error"); + ERROR_LOG(Log::FileSystem, "File::OpenFD returned an error"); // TODO: Need better error codes from OpenFD so we can distinguish // disk full. Just set not found for now. error = SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; @@ -262,7 +262,7 @@ bool DirectoryFileHandle::Open(const Path &basePath, std::string &fileName, File return false; } fullName = GetLocalPath(basePath, fileName); - DEBUG_LOG(FILESYS, "Case may have been incorrect, second try opening %s (%s)", fullName.c_str(), fileName.c_str()); + DEBUG_LOG(Log::FileSystem, "Case may have been incorrect, second try opening %s (%s)", fullName.c_str(), fileName.c_str()); // And try again with the correct case this time #ifdef _WIN32 @@ -361,7 +361,7 @@ size_t DirectoryFileHandle::Write(const u8* pointer, s64 size) MemoryStick_NotifyWrite(); if (diskFull) { - ERROR_LOG(FILESYS, "Disk full"); + ERROR_LOG(Log::FileSystem, "Disk full"); auto err = GetI18NCategory(I18NCat::ERRORS); g_OSD.Show(OSDType::MESSAGE_ERROR, err->T("Disk full while writing data")); // We only return an error when the disk is actually full. @@ -419,12 +419,12 @@ void DirectoryFileHandle::Close() #ifdef _WIN32 Seek((s32)needsTrunc_, FILEMOVE_BEGIN); if (SetEndOfFile(hFile) == 0) { - ERROR_LOG_REPORT(FILESYS, "Failed to truncate file."); + ERROR_LOG_REPORT(Log::FileSystem, "Failed to truncate file."); } #elif !PPSSPP_PLATFORM(SWITCH) // Note: it's not great that Switch cannot truncate appropriately... if (ftruncate(hFile, (off_t)needsTrunc_) != 0) { - ERROR_LOG_REPORT(FILESYS, "Failed to truncate file."); + ERROR_LOG_REPORT(Log::FileSystem, "Failed to truncate file."); } #endif } @@ -439,7 +439,7 @@ void DirectoryFileHandle::Close() void DirectoryFileSystem::CloseAll() { for (auto iter = entries.begin(); iter != entries.end(); ++iter) { - INFO_LOG(FILESYS, "DirectoryFileSystem::CloseAll(): Force closing %d (%s)", (int)iter->first, iter->second.guestFilename.c_str()); + INFO_LOG(Log::FileSystem, "DirectoryFileSystem::CloseAll(): Force closing %d (%s)", (int)iter->first, iter->second.guestFilename.c_str()); iter->second.hFile.Close(); } entries.clear(); @@ -577,7 +577,7 @@ int DirectoryFileSystem::OpenFile(std::string filename, FileAccess access, const logError = (int)errno; #endif if (!(access & FILEACCESS_PPSSPP_QUIET)) { - ERROR_LOG(FILESYS, "DirectoryFileSystem::OpenFile('%s'): FAILED, %d - access = %d '%s'", filename.c_str(), logError, (int)(access & FILEACCESS_PSP_FLAGS), errorString.c_str()); + ERROR_LOG(Log::FileSystem, "DirectoryFileSystem::OpenFile('%s'): FAILED, %d - access = %d '%s'", filename.c_str(), logError, (int)(access & FILEACCESS_PSP_FLAGS), errorString.c_str()); } return err; } else { @@ -606,7 +606,7 @@ void DirectoryFileSystem::CloseFile(u32 handle) { entries.erase(iter); } else { //This shouldn't happen... - ERROR_LOG(FILESYS,"Cannot close file that hasn't been opened: %08x", handle); + ERROR_LOG(Log::FileSystem,"Cannot close file that hasn't been opened: %08x", handle); } } @@ -632,7 +632,7 @@ size_t DirectoryFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &use EntryMap::iterator iter = entries.find(handle); if (iter != entries.end()) { if (size < 0) { - ERROR_LOG_REPORT(FILESYS, "Invalid read for %lld bytes from disk %s", size, iter->second.guestFilename.c_str()); + ERROR_LOG_REPORT(Log::FileSystem, "Invalid read for %lld bytes from disk %s", size, iter->second.guestFilename.c_str()); return 0; } @@ -640,7 +640,7 @@ size_t DirectoryFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &use return bytesRead; } else { // This shouldn't happen... - ERROR_LOG(FILESYS,"Cannot read file that hasn't been opened: %08x", handle); + ERROR_LOG(Log::FileSystem,"Cannot read file that hasn't been opened: %08x", handle); return 0; } } @@ -657,7 +657,7 @@ size_t DirectoryFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size, i return bytesWritten; } else { //This shouldn't happen... - ERROR_LOG(FILESYS,"Cannot write to file that hasn't been opened: %08x", handle); + ERROR_LOG(Log::FileSystem,"Cannot write to file that hasn't been opened: %08x", handle); return 0; } } @@ -668,7 +668,7 @@ size_t DirectoryFileSystem::SeekFile(u32 handle, s32 position, FileMove type) { return iter->second.hFile.Seek(position,type); } else { //This shouldn't happen... - ERROR_LOG(FILESYS,"Cannot seek in file that hasn't been opened: %08x", handle); + ERROR_LOG(Log::FileSystem,"Cannot seek in file that hasn't been opened: %08x", handle); return 0; } } @@ -774,7 +774,7 @@ static std::string SimulateVFATBug(std::string filename) { } if (apply_hack) { - VERBOSE_LOG(FILESYS, "Applying VFAT hack to filename: %s", filename.c_str()); + VERBOSE_LOG(Log::FileSystem, "Applying VFAT hack to filename: %s", filename.c_str()); // In this situation, NT would write UPPERCASE, and just set a flag to say "actually lowercase". // That VFAT flag isn't read by the PSP firmware, so let's pretend to "not read it." std::transform(filename.begin(), filename.end(), filename.begin(), toupper); @@ -920,13 +920,13 @@ void DirectoryFileSystem::DoState(PointerWrap &p) { u32 err; bool brokenFile = false; if (!entry.hFile.Open(basePath,entry.guestFilename,entry.access, err)) { - ERROR_LOG(FILESYS, "Failed to reopen file while loading state: %s", entry.guestFilename.c_str()); + ERROR_LOG(Log::FileSystem, "Failed to reopen file while loading state: %s", entry.guestFilename.c_str()); brokenFile = true; } u32 position; Do(p, position); if (position != entry.hFile.Seek(position, FILEMOVE_BEGIN)) { - ERROR_LOG(FILESYS, "Failed to restore seek position while loading state: %s", entry.guestFilename.c_str()); + ERROR_LOG(Log::FileSystem, "Failed to restore seek position while loading state: %s", entry.guestFilename.c_str()); brokenFile = true; } if (s >= 2) { @@ -990,18 +990,18 @@ bool VFSFileSystem::RemoveFile(const std::string &filename) { int VFSFileSystem::OpenFile(std::string filename, FileAccess access, const char *devicename) { if (access != FILEACCESS_READ) { - ERROR_LOG(FILESYS, "VFSFileSystem only supports plain reading"); + ERROR_LOG(Log::FileSystem, "VFSFileSystem only supports plain reading"); return SCE_KERNEL_ERROR_ERRNO_INVALID_FLAG; } std::string fullName = GetLocalPath(filename); const char *fullNameC = fullName.c_str(); - VERBOSE_LOG(FILESYS, "VFSFileSystem actually opening %s (%s)", fullNameC, filename.c_str()); + VERBOSE_LOG(Log::FileSystem, "VFSFileSystem actually opening %s (%s)", fullNameC, filename.c_str()); size_t size; u8 *data = g_VFS.ReadFile(fullNameC, &size); if (!data) { - ERROR_LOG(FILESYS, "VFSFileSystem failed to open %s", filename.c_str()); + ERROR_LOG(Log::FileSystem, "VFSFileSystem failed to open %s", filename.c_str()); return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; } @@ -1040,7 +1040,7 @@ void VFSFileSystem::CloseFile(u32 handle) { entries.erase(iter); } else { //This shouldn't happen... - ERROR_LOG(FILESYS,"Cannot close file that hasn't been opened: %08x", handle); + ERROR_LOG(Log::FileSystem,"Cannot close file that hasn't been opened: %08x", handle); } } @@ -1063,7 +1063,7 @@ size_t VFSFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size) { } size_t VFSFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { - DEBUG_LOG(FILESYS,"VFSFileSystem::ReadFile %08x %p %i", handle, pointer, (u32)size); + DEBUG_LOG(Log::FileSystem,"VFSFileSystem::ReadFile %08x %p %i", handle, pointer, (u32)size); EntryMap::iterator iter = entries.find(handle); if (iter != entries.end()) { @@ -1075,7 +1075,7 @@ size_t VFSFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { iter->second.seekPos += size; return bytesRead; } else { - ERROR_LOG(FILESYS,"Cannot read file that hasn't been opened: %08x", handle); + ERROR_LOG(Log::FileSystem,"Cannot read file that hasn't been opened: %08x", handle); return 0; } } @@ -1101,7 +1101,7 @@ size_t VFSFileSystem::SeekFile(u32 handle, s32 position, FileMove type) { return iter->second.seekPos; } else { //This shouldn't happen... - ERROR_LOG(FILESYS,"Cannot seek in file that hasn't been opened: %08x", handle); + ERROR_LOG(Log::FileSystem,"Cannot seek in file that hasn't been opened: %08x", handle); return 0; } } @@ -1125,6 +1125,6 @@ void VFSFileSystem::DoState(PointerWrap &p) { if (num != 0) { p.SetError(p.ERROR_WARNING); - ERROR_LOG(FILESYS, "FIXME: Open files during savestate, could go badly."); + ERROR_LOG(Log::FileSystem, "FIXME: Open files during savestate, could go badly."); } } diff --git a/Core/FileSystems/ISOFileSystem.cpp b/Core/FileSystems/ISOFileSystem.cpp index f070ff362f..49574702f3 100644 --- a/Core/FileSystems/ISOFileSystem.cpp +++ b/Core/FileSystems/ISOFileSystem.cpp @@ -164,7 +164,7 @@ ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, BlockDevice *_blockDevic treeroot->valid = false; if (memcmp(desc.cd001, "CD001", 5)) { - ERROR_LOG(FILESYS, "ISO looks bogus, expected CD001 signature not present? Giving up..."); + ERROR_LOG(Log::FileSystem, "ISO looks bogus, expected CD001 signature not present? Giving up..."); return; } @@ -190,7 +190,7 @@ void ISOFileSystem::ReadDirectory(TreeEntry *root) { u8 theSector[2048]; if (!blockDevice->ReadBlock(secnum, theSector)) { blockDevice->NotifyReadError(); - ERROR_LOG(FILESYS, "Error reading block for directory '%s' in sector %d - skipping", root->name.c_str(), secnum); + ERROR_LOG(Log::FileSystem, "Error reading block for directory '%s' in sector %d - skipping", root->name.c_str(), secnum); root->valid = true; // Prevents re-reading return; } @@ -207,7 +207,7 @@ void ISOFileSystem::ReadDirectory(TreeEntry *root) { const int IDENTIFIER_OFFSET = 33; if (offset + IDENTIFIER_OFFSET + dir.identifierLength > 2048) { blockDevice->NotifyReadError(); - ERROR_LOG(FILESYS, "Directory entry crosses sectors, corrupt iso?"); + ERROR_LOG(Log::FileSystem, "Directory entry crosses sectors, corrupt iso?"); return; } @@ -236,18 +236,18 @@ void ISOFileSystem::ReadDirectory(TreeEntry *root) { entry->startsector = dir.firstDataSector; entry->dirsize = dir.dataLength; entry->valid = isFile; // Can pre-mark as valid if file, as we don't recurse into those. - VERBOSE_LOG(FILESYS, "%s: %s %08x %08x %d", entry->isDirectory ? "D" : "F", entry->name.c_str(), (u32)dir.firstDataSector, entry->startingPosition, entry->startingPosition); + VERBOSE_LOG(Log::FileSystem, "%s: %s %08x %08x %d", entry->isDirectory ? "D" : "F", entry->name.c_str(), (u32)dir.firstDataSector, entry->startingPosition, entry->startingPosition); // Round down to avoid any false reports. if (isFile && dir.firstDataSector + (dir.dataLength / 2048) > blockDevice->GetNumBlocks()) { blockDevice->NotifyReadError(); - ERROR_LOG(FILESYS, "File '%s' starts or ends outside ISO. firstDataSector: %d len: %d", entry->BuildPath().c_str(), (int)dir.firstDataSector, (int)dir.dataLength); + ERROR_LOG(Log::FileSystem, "File '%s' starts or ends outside ISO. firstDataSector: %d len: %d", entry->BuildPath().c_str(), (int)dir.firstDataSector, (int)dir.dataLength); } if (entry->isDirectory && !relative) { if (entry->startsector == root->startsector) { blockDevice->NotifyReadError(); - ERROR_LOG(FILESYS, "WARNING: Appear to have a recursive file system, breaking recursion. Probably corrupt ISO."); + ERROR_LOG(Log::FileSystem, "WARNING: Appear to have a recursive file system, breaking recursion. Probably corrupt ISO."); } } root->children.push_back(entry); @@ -313,7 +313,7 @@ ISOFileSystem::TreeEntry *ISOFileSystem::GetFromPath(const std::string &path, bo return entry; } else { if (catchError) - ERROR_LOG(FILESYS, "File '%s' not found", path.c_str()); + ERROR_LOG(Log::FileSystem, "File '%s' not found", path.c_str()); return 0; } @@ -326,7 +326,7 @@ int ISOFileSystem::OpenFile(std::string filename, FileAccess access, const char entry.isBlockSectorMode = false; if (access & FILEACCESS_WRITE) { - ERROR_LOG(FILESYS, "Can't open file '%s' with write access on an ISO partition", filename.c_str()); + ERROR_LOG(Log::FileSystem, "Can't open file '%s' with write access on an ISO partition", filename.c_str()); return SCE_KERNEL_ERROR_ERRNO_INVALID_FLAG; } @@ -335,15 +335,15 @@ int ISOFileSystem::OpenFile(std::string filename, FileAccess access, const char u32 sectorStart = 0xFFFFFFFF, readSize = 0xFFFFFFFF; parseLBN(filename, §orStart, &readSize); if (sectorStart > blockDevice->GetNumBlocks()) { - WARN_LOG(FILESYS, "Unable to open raw sector, out of range: '%s', sector %08x, max %08x", filename.c_str(), sectorStart, blockDevice->GetNumBlocks()); + WARN_LOG(Log::FileSystem, "Unable to open raw sector, out of range: '%s', sector %08x, max %08x", filename.c_str(), sectorStart, blockDevice->GetNumBlocks()); return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; } else if (sectorStart == blockDevice->GetNumBlocks()) { - ERROR_LOG(FILESYS, "Should not be able to open the block after the last on disc! %08x", sectorStart); + ERROR_LOG(Log::FileSystem, "Should not be able to open the block after the last on disc! %08x", sectorStart); } - DEBUG_LOG(FILESYS, "Got a raw sector open: '%s', sector %08x, size %08x", filename.c_str(), sectorStart, readSize); + DEBUG_LOG(Log::FileSystem, "Got a raw sector open: '%s', sector %08x, size %08x", filename.c_str(), sectorStart, readSize); u32 newHandle = hAlloc->GetNewHandle(); entry.seekPos = 0; entry.file = 0; @@ -383,7 +383,7 @@ void ISOFileSystem::CloseFile(u32 handle) { entries.erase(iter); } else { //This shouldn't happen... - ERROR_LOG(FILESYS, "Hey, what are you doing? Closing non-open files?"); + ERROR_LOG(Log::FileSystem, "Hey, what are you doing? Closing non-open files?"); } } @@ -395,7 +395,7 @@ bool ISOFileSystem::OwnsHandle(u32 handle) { int ISOFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 outlen, int &usec) { EntryMap::iterator iter = entries.find(handle); if (iter == entries.end()) { - ERROR_LOG(FILESYS, "Ioctl on a bad file handle"); + ERROR_LOG(Log::FileSystem, "Ioctl on a bad file handle"); return SCE_KERNEL_ERROR_BADF; } @@ -405,23 +405,23 @@ int ISOFileSystem::Ioctl(u32 handle, u32 cmd, u32 indataPtr, u32 inlen, u32 outd // Get ISO9660 volume descriptor (from open ISO9660 file.) case 0x01020001: if (e.isBlockSectorMode) { - ERROR_LOG(FILESYS, "Unsupported read volume descriptor command on a umd block device"); + ERROR_LOG(Log::FileSystem, "Unsupported read volume descriptor command on a umd block device"); return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED; } if (!Memory::IsValidRange(outdataPtr, 0x800) || outlen < 0x800) { - WARN_LOG_REPORT(FILESYS, "sceIoIoctl: Invalid out pointer %08x while reading ISO9660 volume descriptor", outdataPtr); + WARN_LOG_REPORT(Log::FileSystem, "sceIoIoctl: Invalid out pointer %08x while reading ISO9660 volume descriptor", outdataPtr); return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT; } - INFO_LOG(SCEIO, "sceIoIoctl: reading ISO9660 volume descriptor read"); + INFO_LOG(Log::sceIo, "sceIoIoctl: reading ISO9660 volume descriptor read"); blockDevice->ReadBlock(16, Memory::GetPointerWriteUnchecked(outdataPtr)); return 0; // Get ISO9660 path table (from open ISO9660 file.) case 0x01020002: if (e.isBlockSectorMode) { - ERROR_LOG(FILESYS, "Unsupported read path table command on a umd block device"); + ERROR_LOG(Log::FileSystem, "Unsupported read path table command on a umd block device"); return SCE_KERNEL_ERROR_ERRNO_FUNCTION_NOT_SUPPORTED; } @@ -479,7 +479,7 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { OpenFileEntry &e = iter->second; if (size < 0) { - ERROR_LOG_REPORT(FILESYS, "Invalid read for %lld bytes from umd %s", size, e.file ? e.file->name.c_str() : "device"); + ERROR_LOG_REPORT(Log::FileSystem, "Invalid read for %lld bytes from umd %s", size, e.file ? e.file->name.c_str() : "device"); return 0; } @@ -501,7 +501,7 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { positionOnIso = e.sectorStart * 2048ULL + e.seekPos; fileSize = (s64)e.openSize; } else if (e.file == nullptr) { - ERROR_LOG(FILESYS, "File no longer exists (loaded savestate with different ISO?)"); + ERROR_LOG(Log::FileSystem, "File no longer exists (loaded savestate with different ISO?)"); return 0; } else { positionOnIso = e.file->startingPosition + e.seekPos; @@ -509,7 +509,7 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { } if ((s64)e.seekPos > fileSize) { - WARN_LOG(FILESYS, "Read starting outside of file, at %lld / %lld", (s64)e.seekPos, fileSize); + WARN_LOG(Log::FileSystem, "Read starting outside of file, at %lld / %lld", (s64)e.seekPos, fileSize); return 0; } if ((s64)e.seekPos + size > fileSize) { @@ -518,9 +518,9 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { // Reading beyond the file is really quite normal behavior (if return value handled correctly), so // not doing WARN here. Still, can potentially be useful to see so leaving at INFO. if (newSize == 0) { - INFO_LOG(FILESYS, "Attempted read at end of file, 0-size read simulated"); + INFO_LOG(Log::FileSystem, "Attempted read at end of file, 0-size read simulated"); } else { - INFO_LOG(FILESYS, "Reading beyond end of file from seekPos %d, clamping size %lld to %lld", e.seekPos, size, newSize); + INFO_LOG(Log::FileSystem, "Reading beyond end of file from seekPos %d, clamping size %lld to %lld", e.seekPos, size, newSize); } size = newSize; } @@ -534,7 +534,7 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { u8 theSector[2048]; if ((middleSize & 2047) != 0) { - ERROR_LOG(FILESYS, "Remaining size should be aligned"); + ERROR_LOG(Log::FileSystem, "Remaining size should be aligned"); } const u8 *const start = pointer; @@ -565,18 +565,18 @@ size_t ISOFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &usec) { return (size_t)totalBytes; } else { //This shouldn't happen... - ERROR_LOG(FILESYS, "Hey, what are you doing? Reading non-open files?"); + ERROR_LOG(Log::FileSystem, "Hey, what are you doing? Reading non-open files?"); return 0; } } size_t ISOFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size) { - ERROR_LOG(FILESYS, "Hey, what are you doing? You can't write to an ISO!"); + ERROR_LOG(Log::FileSystem, "Hey, what are you doing? You can't write to an ISO!"); return 0; } size_t ISOFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size, int &usec) { - ERROR_LOG(FILESYS, "Hey, what are you doing? You can't write to an ISO!"); + ERROR_LOG(Log::FileSystem, "Hey, what are you doing? You can't write to an ISO!"); return 0; } @@ -602,7 +602,7 @@ size_t ISOFileSystem::SeekFile(u32 handle, s32 position, FileMove type) { return (size_t)e.seekPos; } else { //This shouldn't happen... - ERROR_LOG(FILESYS, "Hey, what are you doing? Seeking in non-open files?"); + ERROR_LOG(Log::FileSystem, "Hey, what are you doing? Seeking in non-open files?"); return 0; } } diff --git a/Core/FileSystems/MetaFileSystem.cpp b/Core/FileSystems/MetaFileSystem.cpp index 5dece8e210..8fba8dff00 100644 --- a/Core/FileSystems/MetaFileSystem.cpp +++ b/Core/FileSystems/MetaFileSystem.cpp @@ -53,7 +53,7 @@ static bool ApplyPathStringToComponentsVector(std::vector &vector, else { // The PSP silently ignores attempts to .. to parent of root directory - WARN_LOG(FILESYS, "RealPath: ignoring .. beyond root - root directory is its own parent: \"%s\"", pathString.c_str()); + WARN_LOG(Log::FileSystem, "RealPath: ignoring .. beyond root - root directory is its own parent: \"%s\"", pathString.c_str()); } } else @@ -102,26 +102,26 @@ static bool RealPath(const std::string ¤tDirectory, const std::string &inP size_t curDirLen = currentDirectory.length(); if (curDirLen == 0) { - ERROR_LOG(FILESYS, "RealPath: inPath \"%s\" is relative, but current directory is empty", inPath.c_str()); + ERROR_LOG(Log::FileSystem, "RealPath: inPath \"%s\" is relative, but current directory is empty", inPath.c_str()); return false; } size_t curDirColon = currentDirectory.find(':'); if (curDirColon == std::string::npos) { - ERROR_LOG(FILESYS, "RealPath: inPath \"%s\" is relative, but current directory \"%s\" has no prefix", inPath.c_str(), currentDirectory.c_str()); + ERROR_LOG(Log::FileSystem, "RealPath: inPath \"%s\" is relative, but current directory \"%s\" has no prefix", inPath.c_str(), currentDirectory.c_str()); return false; } if (curDirColon + 1 == curDirLen) { - WARN_LOG(FILESYS, "RealPath: inPath \"%s\" is relative, but current directory \"%s\" is all prefix and no path. Using \"/\" as path for current directory.", inPath.c_str(), currentDirectory.c_str()); + WARN_LOG(Log::FileSystem, "RealPath: inPath \"%s\" is relative, but current directory \"%s\" is all prefix and no path. Using \"/\" as path for current directory.", inPath.c_str(), currentDirectory.c_str()); } else { const std::string curDirAfter = currentDirectory.substr(curDirColon + 1); if (! ApplyPathStringToComponentsVector(cmpnts, curDirAfter) ) { - ERROR_LOG(FILESYS,"RealPath: currentDirectory is not a valid path: \"%s\"", currentDirectory.c_str()); + ERROR_LOG(Log::FileSystem,"RealPath: currentDirectory is not a valid path: \"%s\"", currentDirectory.c_str()); return false; } @@ -146,7 +146,7 @@ static bool RealPath(const std::string ¤tDirectory, const std::string &inP if (! ApplyPathStringToComponentsVector(cmpnts, inAfterColon) ) { - WARN_LOG(FILESYS, "RealPath: inPath is not a valid path: \"%s\"", inPath.c_str()); + WARN_LOG(Log::FileSystem, "RealPath: inPath is not a valid path: \"%s\"", inPath.c_str()); return false; } @@ -200,7 +200,7 @@ int MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath // Special handling: host0:command.txt (as seen in Super Monkey Ball Adventures, for example) // appears to mean the current directory on the UMD. Let's just assume the current directory. if (strncasecmp(inpath.c_str(), "host0:", strlen("host0:")) == 0) { - INFO_LOG(FILESYS, "Host0 path detected, stripping: %s", inpath.c_str()); + INFO_LOG(Log::FileSystem, "Host0 path detected, stripping: %s", inpath.c_str()); // However, this causes trouble when running tests, since our test framework uses host0:. // Maybe it's really just supposed to map to umd0 or something? if (PSP_CoreParameter().headLess) { @@ -220,7 +220,7 @@ int MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath if (inpath.find(':') == std::string::npos /* means path is relative */) { error = SCE_KERNEL_ERROR_NOCWD; - WARN_LOG(FILESYS, "Path is relative, but current directory not set for thread %i. returning 8002032C(SCE_KERNEL_ERROR_NOCWD) instead.", currentThread); + WARN_LOG(Log::FileSystem, "Path is relative, but current directory not set for thread %i. returning 8002032C(SCE_KERNEL_ERROR_NOCWD) instead.", currentThread); } } else @@ -243,7 +243,7 @@ int MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath outpath = realpath.substr(prefixPos + 1); *system = &(fileSystems[i]); - VERBOSE_LOG(FILESYS, "MapFilePath: mapped \"%s\" to prefix: \"%s\", path: \"%s\"", inpath.c_str(), fileSystems[i].prefix.c_str(), outpath.c_str()); + VERBOSE_LOG(Log::FileSystem, "MapFilePath: mapped \"%s\" to prefix: \"%s\", path: \"%s\"", inpath.c_str(), fileSystems[i].prefix.c_str(), outpath.c_str()); return error == SCE_KERNEL_ERROR_NOCWD ? error : 0; } @@ -252,7 +252,7 @@ int MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath error = SCE_KERNEL_ERROR_NODEV; } - DEBUG_LOG(FILESYS, "MapFilePath: failed mapping \"%s\", returning false", inpath.c_str()); + DEBUG_LOG(Log::FileSystem, "MapFilePath: failed mapping \"%s\", returning false", inpath.c_str()); return error; } @@ -414,13 +414,13 @@ int MetaFileSystem::ChDir(const std::string &dir) if (strncasecmp(prefix.c_str(), dir.c_str(), prefix.size()) == 0) { // The PSP is completely happy with invalid current dirs as long as they have a valid device. - WARN_LOG(FILESYS, "ChDir failed to map path \"%s\", saving as current directory anyway", dir.c_str()); + WARN_LOG(Log::FileSystem, "ChDir failed to map path \"%s\", saving as current directory anyway", dir.c_str()); currentDir[curThread] = dir; return 0; } } - WARN_LOG_REPORT(FILESYS, "ChDir failed to map device for \"%s\", failing", dir.c_str()); + WARN_LOG_REPORT(Log::FileSystem, "ChDir failed to map device for \"%s\", failing", dir.c_str()); return SCE_KERNEL_ERROR_NODEV; } } @@ -637,7 +637,7 @@ void MetaFileSystem::DoState(PointerWrap &p) skipPfat0 = true; } else { p.SetError(p.ERROR_FAILURE); - ERROR_LOG(FILESYS, "Savestate failure: number of filesystems doesn't match."); + ERROR_LOG(Log::FileSystem, "Savestate failure: number of filesystems doesn't match."); return; } } diff --git a/Core/FileSystems/VirtualDiscFileSystem.cpp b/Core/FileSystems/VirtualDiscFileSystem.cpp index 5a0855c3a5..c4501705e8 100644 --- a/Core/FileSystems/VirtualDiscFileSystem.cpp +++ b/Core/FileSystems/VirtualDiscFileSystem.cpp @@ -104,7 +104,7 @@ void VirtualDiscFileSystem::LoadFileListIndex() { // Syntax: HEXPOS filename or HEXPOS filename:handler size_t filename_pos = line.find(' '); if (filename_pos == line.npos) { - ERROR_LOG(FILESYS, "Unexpected line in %s: %s", INDEX_FILENAME.c_str(), line.c_str()); + ERROR_LOG(Log::FileSystem, "Unexpected line in %s: %s", INDEX_FILENAME.c_str(), line.c_str()); continue; } @@ -142,7 +142,7 @@ void VirtualDiscFileSystem::LoadFileListIndex() { entry.totalSize = (u32)temp.Seek(0, FILEMOVE_END); temp.Close(); } else { - ERROR_LOG(FILESYS, "Unable to open virtual file: %s", entry.fileName.c_str()); + ERROR_LOG(Log::FileSystem, "Unable to open virtual file: %s", entry.fileName.c_str()); } } else { entry.totalSize = File::GetFileSize(GetLocalPath(entry.fileName)); @@ -207,7 +207,7 @@ void VirtualDiscFileSystem::DoState(PointerWrap &p) bool success = of.Open(basePath, fileList[of.fileIndex].fileName, FILEACCESS_READ); if (!success) { - ERROR_LOG(FILESYS, "Failed to create file handle for %s.", fileList[of.fileIndex].fileName.c_str()); + ERROR_LOG(Log::FileSystem, "Failed to create file handle for %s.", fileList[of.fileIndex].fileName.c_str()); } else { if (of.type == VFILETYPE_LBN) { of.Seek(of.curOffset + of.startOffset, FILEMOVE_BEGIN); @@ -352,7 +352,7 @@ int VirtualDiscFileSystem::OpenFile(std::string filename, FileAccess access, con int fileIndex = getFileListIndex(sectorStart,readSize); if (fileIndex == -1) { - ERROR_LOG(FILESYS, "VirtualDiscFileSystem: sce_lbn used without calling fileinfo."); + ERROR_LOG(Log::FileSystem, "VirtualDiscFileSystem: sce_lbn used without calling fileinfo."); return 0; } entry.fileIndex = (u32)fileIndex; @@ -368,9 +368,9 @@ int VirtualDiscFileSystem::OpenFile(std::string filename, FileAccess access, con if (!success) { if (!(access & FILEACCESS_PPSSPP_QUIET)) { #ifdef _WIN32 - ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, %i", (int)GetLastError()); + ERROR_LOG(Log::FileSystem, "VirtualDiscFileSystem::OpenFile: FAILED, %i", (int)GetLastError()); #else - ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED"); + ERROR_LOG(Log::FileSystem, "VirtualDiscFileSystem::OpenFile: FAILED"); #endif } return 0; @@ -396,9 +396,9 @@ int VirtualDiscFileSystem::OpenFile(std::string filename, FileAccess access, con if (!success) { if (!(access & FILEACCESS_PPSSPP_QUIET)) { #ifdef _WIN32 - ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, %i - access = %i", (int)GetLastError(), (int)access); + ERROR_LOG(Log::FileSystem, "VirtualDiscFileSystem::OpenFile: FAILED, %i - access = %i", (int)GetLastError(), (int)access); #else - ERROR_LOG(FILESYS, "VirtualDiscFileSystem::OpenFile: FAILED, access = %i", (int)access); + ERROR_LOG(Log::FileSystem, "VirtualDiscFileSystem::OpenFile: FAILED, access = %i", (int)access); #endif } return SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND; @@ -448,7 +448,7 @@ size_t VirtualDiscFileSystem::SeekFile(u32 handle, s32 position, FileMove type) return 0; } else { //This shouldn't happen... - ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot seek in file that hasn't been opened: %08x", handle); + ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot seek in file that hasn't been opened: %08x", handle); return 0; } } @@ -462,7 +462,7 @@ size_t VirtualDiscFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &u EntryMap::iterator iter = entries.find(handle); if (iter != entries.end()) { if (size < 0) { - ERROR_LOG_REPORT(FILESYS, "Invalid read for %lld bytes from virtual umd", size); + ERROR_LOG_REPORT(Log::FileSystem, "Invalid read for %lld bytes from virtual umd", size); return 0; } @@ -474,7 +474,7 @@ size_t VirtualDiscFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &u int fileIndex = getFileListIndex(iter->second.curOffset,size*2048,true); if (fileIndex == -1) { - ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Reading from unknown address in %08x at %08llx", handle, iter->second.curOffset); + ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Reading from unknown address in %08x at %08llx", handle, iter->second.curOffset); return 0; } @@ -486,7 +486,7 @@ size_t VirtualDiscFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &u if (!success) { - ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Error opening file %s", fileList[fileIndex].fileName.c_str()); + ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Error opening file %s", fileList[fileIndex].fileName.c_str()); return 0; } @@ -521,7 +521,7 @@ size_t VirtualDiscFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &u if (iter->second.type == VFILETYPE_LBN && iter->second.curOffset + size > iter->second.size) { // Clamp to the remaining size, but read what we can. const s64 newSize = iter->second.size - iter->second.curOffset; - WARN_LOG(FILESYS, "VirtualDiscFileSystem: Reading beyond end of file, clamping size %lld to %lld", size, newSize); + WARN_LOG(Log::FileSystem, "VirtualDiscFileSystem: Reading beyond end of file, clamping size %lld to %lld", size, newSize); size = newSize; } @@ -530,7 +530,7 @@ size_t VirtualDiscFileSystem::ReadFile(u32 handle, u8 *pointer, s64 size, int &u return bytesRead; } else { //This shouldn't happen... - ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot read file that hasn't been opened: %08x", handle); + ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot read file that hasn't been opened: %08x", handle); return 0; } } @@ -543,7 +543,7 @@ void VirtualDiscFileSystem::CloseFile(u32 handle) { entries.erase(iter); } else { //This shouldn't happen... - ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot close file that hasn't been opened: %08x", handle); + ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot close file that hasn't been opened: %08x", handle); } } @@ -631,7 +631,7 @@ PSPFileInfo VirtualDiscFileSystem::GetFileInfo(std::string filename) { if (x.type != FILETYPE_DIRECTORY) { File::FileInfo details; if (!File::GetFileInfo(fullName, &details)) { - ERROR_LOG(FILESYS, "DirectoryFileSystem::GetFileInfo: GetFileInfo failed: %s", fullName.c_str()); + ERROR_LOG(Log::FileSystem, "DirectoryFileSystem::GetFileInfo: GetFileInfo failed: %s", fullName.c_str()); x.size = 0; x.access = 0; } else { @@ -735,7 +735,7 @@ std::vector VirtualDiscFileSystem::GetDirListing(const std::string #endif if (dp == NULL) { - ERROR_LOG(FILESYS,"Error opening directory %s\n", path.c_str()); + ERROR_LOG(Log::FileSystem,"Error opening directory %s\n", path.c_str()); if (exists) *exists = false; return myVector; @@ -779,37 +779,37 @@ std::vector VirtualDiscFileSystem::GetDirListing(const std::string size_t VirtualDiscFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size) { - ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot write to file on virtual disc"); + ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot write to file on virtual disc"); return 0; } size_t VirtualDiscFileSystem::WriteFile(u32 handle, const u8 *pointer, s64 size, int &usec) { - ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot write to file on virtual disc"); + ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot write to file on virtual disc"); return 0; } bool VirtualDiscFileSystem::MkDir(const std::string &dirname) { - ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot create directory on virtual disc"); + ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot create directory on virtual disc"); return false; } bool VirtualDiscFileSystem::RmDir(const std::string &dirname) { - ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot remove directory on virtual disc"); + ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot remove directory on virtual disc"); return false; } int VirtualDiscFileSystem::RenameFile(const std::string &from, const std::string &to) { - ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot rename file on virtual disc"); + ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot rename file on virtual disc"); return -1; } bool VirtualDiscFileSystem::RemoveFile(const std::string &filename) { - ERROR_LOG(FILESYS,"VirtualDiscFileSystem: Cannot remove file on virtual disc"); + ERROR_LOG(Log::FileSystem,"VirtualDiscFileSystem: Cannot remove file on virtual disc"); return false; } @@ -826,9 +826,9 @@ void VirtualDiscFileSystem::HandlerLogger(void *arg, HandlerHandle handle, LogLe } if (filename != NULL) { - GENERIC_LOG(LogType::FILESYS, level, "%s: %s", filename, msg); + GENERIC_LOG(Log::FileSystem, level, "%s: %s", filename, msg); } else { - GENERIC_LOG(LogType::FILESYS, level, "%s", msg); + GENERIC_LOG(Log::FileSystem, level, "%s", msg); } } @@ -862,16 +862,16 @@ VirtualDiscFileSystem::Handler::Handler(const char *filename, VirtualDiscFileSys } if (!Init || !Shutdown || !Open || !Seek || !Read || !Close) { - ERROR_LOG(FILESYS, "Unable to find all handler functions: %s", filename); + ERROR_LOG(Log::FileSystem, "Unable to find all handler functions: %s", filename); dlclose(library); library = NULL; } else if (!Init(&HandlerLogger, sys)) { - ERROR_LOG(FILESYS, "Unable to initialize handler: %s", filename); + ERROR_LOG(Log::FileSystem, "Unable to initialize handler: %s", filename); dlclose(library); library = NULL; } } else { - ERROR_LOG(FILESYS, "Unable to load handler '%s': %s", filename, GetLastErrorMsg().c_str()); + ERROR_LOG(Log::FileSystem, "Unable to load handler '%s': %s", filename, GetLastErrorMsg().c_str()); } #ifdef _WIN32 #undef dlopen diff --git a/Core/Font/PGF.cpp b/Core/Font/PGF.cpp index a01b47225c..e79bf18dfa 100644 --- a/Core/Font/PGF.cpp +++ b/Core/Font/PGF.cpp @@ -186,7 +186,7 @@ bool PGF::ReadPtr(const u8 *ptr, size_t dataSize) { return false; } - DEBUG_LOG(SCEFONT, "Reading %d bytes of PGF header", (int)sizeof(header)); + DEBUG_LOG(Log::sceFont, "Reading %d bytes of PGF header", (int)sizeof(header)); memcpy(&header, ptr, sizeof(header)); ptr += sizeof(header); @@ -570,13 +570,13 @@ void PGF::DrawCharacter(const GlyphImage *image, int clipX, int clipY, int clipW } if (glyph.w <= 0 || glyph.h <= 0) { - DEBUG_LOG(SCEFONT, "Glyph with negative size, not rendering"); + DEBUG_LOG(Log::sceFont, "Glyph with negative size, not rendering"); return; } if (((glyph.flags & FONT_PGF_BMP_OVERLAY) != FONT_PGF_BMP_H_ROWS) && ((glyph.flags & FONT_PGF_BMP_OVERLAY) != FONT_PGF_BMP_V_ROWS)) { - ERROR_LOG_REPORT(SCEFONT, "Nonsense glyph bitmap direction flag"); + ERROR_LOG_REPORT(Log::sceFont, "Nonsense glyph bitmap direction flag"); return; } @@ -680,7 +680,7 @@ void PGF::SetFontPixel(u32 base, int bpl, int bufWidth, int bufHeight, int x, in static const u8 fontPixelSizeInBytes[] = { 0, 0, 1, 3, 4 }; // 0 means 2 pixels per byte if (pixelformat < 0 || pixelformat > PSP_FONT_PIXELFORMAT_32) { - ERROR_LOG_REPORT_ONCE(pfgbadformat, SCEFONT, "Invalid image format in image: %d", (int)pixelformat); + ERROR_LOG_REPORT_ONCE(pfgbadformat, Log::sceFont, "Invalid image format in image: %d", (int)pixelformat); return; } int pixelBytes = fontPixelSizeInBytes[pixelformat]; diff --git a/Core/HLE/AtracCtx.cpp b/Core/HLE/AtracCtx.cpp index 4a9c8a0e2d..8837d57816 100644 --- a/Core/HLE/AtracCtx.cpp +++ b/Core/HLE/AtracCtx.cpp @@ -231,10 +231,10 @@ void Atrac::WriteContextToPSPMem() { } void Track::DebugLog() { - DEBUG_LOG(ME, "ATRAC analyzed: %s channels: %d filesize: %d bitrate: %d kbps jointStereo: %d", + DEBUG_LOG(Log::ME, "ATRAC analyzed: %s channels: %d filesize: %d bitrate: %d kbps jointStereo: %d", codecType == PSP_MODE_AT_3 ? "AT3" : "AT3Plus", channels, fileSize, bitrate / 1024, jointStereo); - DEBUG_LOG(ME, "dataoff: %d firstSampleOffset: %d endSample: %d", dataByteOffset, firstSampleOffset, endSample); - DEBUG_LOG(ME, "loopStartSample: %d loopEndSample: %d", loopStartSample, loopEndSample); + DEBUG_LOG(Log::ME, "dataoff: %d firstSampleOffset: %d endSample: %d", dataByteOffset, firstSampleOffset, endSample); + DEBUG_LOG(Log::ME, "loopStartSample: %d loopEndSample: %d", loopStartSample, loopEndSample); } int Atrac::Analyze(u32 addr, u32 size) { @@ -247,17 +247,17 @@ int Atrac::Analyze(u32 addr, u32 size) { // 72 is about the size of the minimum required data to even be valid. if (size < 72) { - return hleReportError(ME, ATRAC_ERROR_SIZE_TOO_SMALL, "buffer too small"); + return hleReportError(Log::ME, ATRAC_ERROR_SIZE_TOO_SMALL, "buffer too small"); } // TODO: Check the range (addr, size) instead. if (!Memory::IsValidAddress(addr)) { - return hleReportWarning(ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "invalid buffer address"); + return hleReportWarning(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "invalid buffer address"); } // TODO: Validate stuff. if (Memory::ReadUnchecked_U32(addr) != RIFF_CHUNK_MAGIC) { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "invalid RIFF header"); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "invalid RIFF header"); } int retval = AnalyzeAtracTrack(addr, size, &track_); @@ -284,17 +284,17 @@ int AnalyzeAtracTrack(u32 addr, u32 size, Track *track) { // Round the chunk size up to the nearest 2. offset += chunk + (chunk & 1); if (offset + 12 > size) { - return hleReportError(ME, ATRAC_ERROR_SIZE_TOO_SMALL, "too small for WAVE chunk at %d", offset); + return hleReportError(Log::ME, ATRAC_ERROR_SIZE_TOO_SMALL, "too small for WAVE chunk at %d", offset); } if (Memory::Read_U32(addr + offset) != RIFF_CHUNK_MAGIC) { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "RIFF chunk did not contain WAVE"); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "RIFF chunk did not contain WAVE"); } offset += 8; } offset += 4; if (offset != 12) { - WARN_LOG_REPORT(ME, "RIFF chunk at offset: %d", offset); + WARN_LOG_REPORT(Log::ME, "RIFF chunk at offset: %d", offset); } // RIFF size excluding chunk header. @@ -312,7 +312,7 @@ int AnalyzeAtracTrack(u32 addr, u32 size, Track *track) { u32 chunkSize = Memory::Read_U32(addr + offset + 4); // Account for odd sized chunks. if (chunkSize & 1) { - WARN_LOG_REPORT_ONCE(oddchunk, ME, "RIFF chunk had uneven size"); + WARN_LOG_REPORT_ONCE(oddchunk, Log::ME, "RIFF chunk had uneven size"); } chunkSize += (chunkSize & 1); offset += 8; @@ -322,12 +322,12 @@ int AnalyzeAtracTrack(u32 addr, u32 size, Track *track) { case FMT_CHUNK_MAGIC: { if (track->codecType != 0) { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "multiple fmt definitions"); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "multiple fmt definitions"); } auto at3fmt = PSPPointer::Create(addr + offset); if (chunkSize < 32 || (at3fmt->fmtTag == AT3_PLUS_MAGIC && chunkSize < 52)) { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "fmt definition too small (%d)", chunkSize); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "fmt definition too small (%d)", chunkSize); } if (at3fmt->fmtTag == AT3_MAGIC) @@ -335,19 +335,19 @@ int AnalyzeAtracTrack(u32 addr, u32 size, Track *track) { else if (at3fmt->fmtTag == AT3_PLUS_MAGIC) track->codecType = PSP_MODE_AT_3_PLUS; else { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "invalid fmt magic: %04x", at3fmt->fmtTag); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "invalid fmt magic: %04x", at3fmt->fmtTag); } track->channels = at3fmt->channels; if (track->channels != 1 && track->channels != 2) { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "invalid channel count: %d", track->channels); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "invalid channel count: %d", track->channels); } if (at3fmt->samplerate != 44100) { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "unsupported sample rate: %d", at3fmt->samplerate); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "unsupported sample rate: %d", at3fmt->samplerate); } track->bitrate = at3fmt->avgBytesPerSec * 8; track->bytesPerFrame = at3fmt->blockAlign; if (track->bytesPerFrame == 0) { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "invalid bytes per frame: %d", track->bytesPerFrame); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "invalid bytes per frame: %d", track->bytesPerFrame); } // TODO: There are some format specific bytes here which seem to have fixed values? @@ -374,14 +374,14 @@ int AnalyzeAtracTrack(u32 addr, u32 size, Track *track) { case SMPL_CHUNK_MAGIC: { if (chunkSize < 32) { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "smpl chunk too small (%d)", chunkSize); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "smpl chunk too small (%d)", chunkSize); } int checkNumLoops = Memory::Read_U32(addr + offset + 28); if (checkNumLoops != 0 && chunkSize < 36 + 20) { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "smpl chunk too small for loop (%d, %d)", checkNumLoops, chunkSize); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "smpl chunk too small for loop (%d, %d)", checkNumLoops, chunkSize); } if (checkNumLoops < 0) { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "bad checkNumLoops (%d)", checkNumLoops); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "bad checkNumLoops (%d)", checkNumLoops); } track->loopinfo.resize(checkNumLoops); @@ -397,7 +397,7 @@ int AnalyzeAtracTrack(u32 addr, u32 size, Track *track) { track->loopinfo[i].playCount = Memory::Read_U32(loopinfoAddr + 20); if (track->loopinfo[i].startSample >= track->loopinfo[i].endSample) { - return hleReportError(ME, ATRAC_ERROR_BAD_CODEC_PARAMS, "loop starts after it ends"); + return hleReportError(Log::ME, ATRAC_ERROR_BAD_CODEC_PARAMS, "loop starts after it ends"); } } } @@ -408,7 +408,7 @@ int AnalyzeAtracTrack(u32 addr, u32 size, Track *track) { track->dataByteOffset = offset; dataChunkSize = chunkSize; if (track->fileSize < offset + chunkSize) { - WARN_LOG_REPORT(ME, "Atrac data chunk extends beyond riff chunk"); + WARN_LOG_REPORT(Log::ME, "Atrac data chunk extends beyond riff chunk"); track->fileSize = offset + chunkSize; } } @@ -418,11 +418,11 @@ int AnalyzeAtracTrack(u32 addr, u32 size, Track *track) { } if (track->codecType == 0) { - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "could not detect codec"); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "could not detect codec"); } if (!bfoundData) { - return hleReportError(ME, ATRAC_ERROR_SIZE_TOO_SMALL, "no data chunk"); + return hleReportError(Log::ME, ATRAC_ERROR_SIZE_TOO_SMALL, "no data chunk"); } // set the loopStartSample_ and loopEndSample_ by loopinfo_ @@ -442,7 +442,7 @@ int AnalyzeAtracTrack(u32 addr, u32 size, Track *track) { track->endSample -= 1; if (track->loopEndSample != -1 && track->loopEndSample > track->endSample + track->FirstSampleOffsetFull()) { - return hleReportError(ME, ATRAC_ERROR_BAD_CODEC_PARAMS, "loop after end of data"); + return hleReportError(Log::ME, ATRAC_ERROR_BAD_CODEC_PARAMS, "loop after end of data"); } return 0; @@ -460,25 +460,25 @@ int Atrac::AnalyzeAA3(u32 addr, u32 size, u32 fileSize) { int AnalyzeAA3Track(u32 addr, u32 size, u32 fileSize, Track *track) { if (size < 10) { - return hleReportError(ME, ATRAC_ERROR_AA3_SIZE_TOO_SMALL, "buffer too small"); + return hleReportError(Log::ME, ATRAC_ERROR_AA3_SIZE_TOO_SMALL, "buffer too small"); } // TODO: Make sure this validation is correct, more testing. const u8 *buffer = Memory::GetPointer(addr); if (buffer[0] != 'e' || buffer[1] != 'a' || buffer[2] != '3') { - return hleReportError(ME, ATRAC_ERROR_AA3_INVALID_DATA, "invalid ea3 magic bytes"); + return hleReportError(Log::ME, ATRAC_ERROR_AA3_INVALID_DATA, "invalid ea3 magic bytes"); } // It starts with an id3 header (replaced with ea3.) This is the size. u32 tagSize = buffer[9] | (buffer[8] << 7) | (buffer[7] << 14) | (buffer[6] << 21); if (size < tagSize + 36) { - return hleReportError(ME, ATRAC_ERROR_AA3_SIZE_TOO_SMALL, "truncated before id3 end"); + return hleReportError(Log::ME, ATRAC_ERROR_AA3_SIZE_TOO_SMALL, "truncated before id3 end"); } // EA3 header starts at id3 header (10) + tagSize. buffer = Memory::GetPointer(addr + 10 + tagSize); if (buffer[0] != 'E' || buffer[1] != 'A' || buffer[2] != '3') { - return hleReportError(ME, ATRAC_ERROR_AA3_INVALID_DATA, "invalid EA3 magic bytes"); + return hleReportError(Log::ME, ATRAC_ERROR_AA3_INVALID_DATA, "invalid EA3 magic bytes"); } track->fileSize = fileSize; @@ -504,9 +504,9 @@ int AnalyzeAA3Track(u32 addr, u32 size, u32 fileSize, Track *track) { case 3: case 4: case 5: - return hleReportError(ME, ATRAC_ERROR_AA3_INVALID_DATA, "unsupported codec type %d", buffer[32]); + return hleReportError(Log::ME, ATRAC_ERROR_AA3_INVALID_DATA, "unsupported codec type %d", buffer[32]); default: - return hleReportError(ME, ATRAC_ERROR_AA3_INVALID_DATA, "invalid codec type %d", buffer[32]); + return hleReportError(Log::ME, ATRAC_ERROR_AA3_INVALID_DATA, "invalid codec type %d", buffer[32]); } track->dataByteOffset = 10 + tagSize + 96; @@ -560,7 +560,7 @@ void Atrac::CalculateStreamInfo(u32 *outReadOffset) { // If you don't think this should be here, remove it. It's just a temporary safety check. if (first_.offset + first_.writableBytes > bufferMaxSize_) { - ERROR_LOG_REPORT(ME, "Somehow calculated too many writable bytes: %d + %d > %d", first_.offset, first_.writableBytes, bufferMaxSize_); + ERROR_LOG_REPORT(Log::ME, "Somehow calculated too many writable bytes: %d + %d > %d", first_.offset, first_.writableBytes, bufferMaxSize_); first_.offset = 0; first_.writableBytes = bufferMaxSize_; } @@ -668,7 +668,7 @@ int Atrac::SetData(u32 buffer, u32 readSize, u32 bufferSize, int outputChannels, if (track_.codecType != PSP_MODE_AT_3 && track_.codecType != PSP_MODE_AT_3_PLUS) { // Shouldn't have gotten here, Analyze() checks this. bufferState_ = ATRAC_STATUS_NO_DATA; - return hleReportError(ME, ATRAC_ERROR_UNKNOWN_FORMAT, "unexpected codec type in set data"); + return hleReportError(Log::ME, ATRAC_ERROR_UNKNOWN_FORMAT, "unexpected codec type in set data"); } if (bufferState_ == ATRAC_STATUS_ALL_DATA_LOADED || bufferState_ == ATRAC_STATUS_HALFWAY_BUFFER) { @@ -696,7 +696,7 @@ int Atrac::SetData(u32 buffer, u32 readSize, u32 bufferSize, int outputChannels, Memory::Memcpy(dataBuf_, buffer, copybytes, "AtracSetData"); } CreateDecoder(); - return hleLogSuccessInfoI(ME, successCode, "%s %s audio", codecName, channelName); + return hleLogSuccessInfoI(Log::ME, successCode, "%s %s audio", codecName, channelName); } u32 Atrac::SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) { @@ -705,16 +705,16 @@ u32 Atrac::SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) { // 3 seems to be the number of frames required to handle a loop. if (secondBufferSize < desiredSize && secondBufferSize < (u32)track_.BytesPerFrame() * 3) { - return hleReportError(ME, ATRAC_ERROR_SIZE_TOO_SMALL, "too small"); + return hleReportError(Log::ME, ATRAC_ERROR_SIZE_TOO_SMALL, "too small"); } if (BufferState() != ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER) { - return hleReportError(ME, ATRAC_ERROR_SECOND_BUFFER_NOT_NEEDED, "not needed"); + return hleReportError(Log::ME, ATRAC_ERROR_SECOND_BUFFER_NOT_NEEDED, "not needed"); } second_.addr = secondBuffer; second_.size = secondBufferSize; second_.fileoffset = secondFileOffset; - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } int AtracBase::GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) { @@ -722,12 +722,12 @@ int AtracBase::GetSecondBufferInfo(u32 *fileOffset, u32 *desiredSize) { // Writes zeroes in this error case. *fileOffset = 0; *desiredSize = 0; - return hleLogWarning(ME, ATRAC_ERROR_SECOND_BUFFER_NOT_NEEDED, "not needed"); + return hleLogWarning(Log::ME, ATRAC_ERROR_SECOND_BUFFER_NOT_NEEDED, "not needed"); } *fileOffset = track_.FileOffsetBySample(track_.loopEndSample - track_.firstSampleOffset); *desiredSize = track_.fileSize - *fileOffset; - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } void Atrac::GetStreamDataInfo(u32 *writePtr, u32 *writableBytes, u32 *readOffset) { @@ -764,7 +764,7 @@ int Atrac::AddStreamData(u32 bytesToAdd) { u32 readOffset; CalculateStreamInfo(&readOffset); if (bytesToAdd > first_.writableBytes) - return hleLogWarning(ME, ATRAC_ERROR_ADD_DATA_IS_TOO_BIG, "too many bytes"); + return hleLogWarning(Log::ME, ATRAC_ERROR_ADD_DATA_IS_TOO_BIG, "too many bytes"); if (bytesToAdd > 0) { first_.fileoffset = readOffset; @@ -1064,10 +1064,10 @@ u32 Atrac::ResetPlayPosition(int sample, int bytesWrittenFirstBuf, int bytesWrit GetResetBufferInfo(&bufferInfo, sample); if ((u32)bytesWrittenFirstBuf < bufferInfo.first.minWriteBytes || (u32)bytesWrittenFirstBuf > bufferInfo.first.writableBytes) { - return hleLogError(ME, ATRAC_ERROR_BAD_FIRST_RESET_SIZE, "first byte count not in valid range"); + return hleLogError(Log::ME, ATRAC_ERROR_BAD_FIRST_RESET_SIZE, "first byte count not in valid range"); } if ((u32)bytesWrittenSecondBuf < bufferInfo.second.minWriteBytes || (u32)bytesWrittenSecondBuf > bufferInfo.second.writableBytes) { - return hleLogError(ME, ATRAC_ERROR_BAD_SECOND_RESET_SIZE, "second byte count not in valid range"); + return hleLogError(Log::ME, ATRAC_ERROR_BAD_SECOND_RESET_SIZE, "second byte count not in valid range"); } if (bufferState_ == ATRAC_STATUS_ALL_DATA_LOADED) { @@ -1090,7 +1090,7 @@ u32 Atrac::ResetPlayPosition(int sample, int bytesWrittenFirstBuf, int bytesWrit } } else { if (bufferInfo.first.filePos > track_.fileSize) { - return hleDelayResult(hleLogError(ME, ATRAC_ERROR_API_FAIL, "invalid file position"), "reset play pos", 200); + return hleDelayResult(hleLogError(Log::ME, ATRAC_ERROR_API_FAIL, "invalid file position"), "reset play pos", 200); } // Move the offset to the specified position. diff --git a/Core/HLE/AtracCtx2.cpp b/Core/HLE/AtracCtx2.cpp index b30f3444f3..5ecbf5b7c0 100644 --- a/Core/HLE/AtracCtx2.cpp +++ b/Core/HLE/AtracCtx2.cpp @@ -128,7 +128,7 @@ int Atrac2::SetData(u32 buffer, u32 readSize, u32 bufferSize, int outputChannels } else { bufferState_ = ATRAC_STATUS_HALFWAY_BUFFER; } - return hleLogSuccessI(ME, successCode); + return hleLogSuccessI(Log::ME, successCode); } u32 Atrac2::SetSecondBuffer(u32 secondBuffer, u32 secondBufferSize) { diff --git a/Core/HLE/HLE.cpp b/Core/HLE/HLE.cpp index 5fd835d1be..b771503a21 100644 --- a/Core/HLE/HLE.cpp +++ b/Core/HLE/HLE.cpp @@ -111,7 +111,7 @@ void hleDelayResultFinish(u64 userdata, int cycleslate) __KernelReSchedule("woke from hle delay"); } else - WARN_LOG(HLE, "Someone else woke up HLE-blocked thread %d?", threadID); + WARN_LOG(Log::HLE, "Someone else woke up HLE-blocked thread %d?", threadID); } void HLEInit() { @@ -239,13 +239,13 @@ u32 GetSyscallOp(const char *moduleName, u32 nib) { if (funcindex != -1) { return (0x0000000c | (modindex<<18) | (funcindex<<6)); } else { - INFO_LOG(HLE, "Syscall (%s, %08x) unknown", moduleName, nib); + INFO_LOG(Log::HLE, "Syscall (%s, %08x) unknown", moduleName, nib); return (0x0003FFCC | (modindex<<18)); // invalid syscall } } else { - ERROR_LOG(HLE, "Unknown module %s!", moduleName); + ERROR_LOG(Log::HLE, "Unknown module %s!", moduleName); return (0x03FFFFCC); // invalid syscall } } @@ -275,7 +275,7 @@ bool WriteSyscall(const char *moduleName, u32 nib, u32 address) { if (nib == 0) { - WARN_LOG_REPORT(HLE, "Wrote patched out nid=0 syscall (%s)", moduleName); + WARN_LOG_REPORT(Log::HLE, "Wrote patched out nid=0 syscall (%s)", moduleName); Memory::Write_U32(MIPS_MAKE_JR_RA(), address); //patched out? Memory::Write_U32(MIPS_MAKE_NOP(), address+4); //patched out? return true; @@ -289,7 +289,7 @@ bool WriteSyscall(const char *moduleName, u32 nib, u32 address) } else { - ERROR_LOG_REPORT(HLE, "Unable to write unknown syscall: %s/%08x", moduleName, nib); + ERROR_LOG_REPORT(Log::HLE, "Unable to write unknown syscall: %s/%08x", moduleName, nib); return false; } } @@ -367,11 +367,11 @@ bool hleExecuteDebugBreak(const HLEFunction &func) u32 hleDelayResult(u32 result, const char *reason, int usec) { if (!__KernelIsDispatchEnabled()) { - WARN_LOG(HLE, "%s: Dispatch disabled, not delaying HLE result (right thing to do?)", latestSyscall ? latestSyscall->name : "?"); + WARN_LOG(Log::HLE, "%s: Dispatch disabled, not delaying HLE result (right thing to do?)", latestSyscall ? latestSyscall->name : "?"); } else { SceUID thread = __KernelGetCurThread(); if (KernelIsThreadWaiting(thread)) - ERROR_LOG(HLE, "%s: Delaying a thread that's already waiting", latestSyscall ? latestSyscall->name : "?"); + ERROR_LOG(Log::HLE, "%s: Delaying a thread that's already waiting", latestSyscall ? latestSyscall->name : "?"); CoreTiming::ScheduleEvent(usToCycles(usec), delayedResultEvent, thread); __KernelWaitCurThread(WAITTYPE_HLEDELAY, 1, result, 0, false, reason); } @@ -380,11 +380,11 @@ u32 hleDelayResult(u32 result, const char *reason, int usec) { u64 hleDelayResult(u64 result, const char *reason, int usec) { if (!__KernelIsDispatchEnabled()) { - WARN_LOG(HLE, "%s: Dispatch disabled, not delaying HLE result (right thing to do?)", latestSyscall ? latestSyscall->name : "?"); + WARN_LOG(Log::HLE, "%s: Dispatch disabled, not delaying HLE result (right thing to do?)", latestSyscall ? latestSyscall->name : "?"); } else { SceUID thread = __KernelGetCurThread(); if (KernelIsThreadWaiting(thread)) - ERROR_LOG(HLE, "%s: Delaying a thread that's already waiting", latestSyscall ? latestSyscall->name : "?"); + ERROR_LOG(Log::HLE, "%s: Delaying a thread that's already waiting", latestSyscall ? latestSyscall->name : "?"); u64 param = (result & 0xFFFFFFFF00000000) | thread; CoreTiming::ScheduleEvent(usToCycles(usec), delayedResultEvent, param); __KernelWaitCurThread(WAITTYPE_HLEDELAY, 1, (u32)result, 0, false, reason); @@ -418,7 +418,7 @@ void hleEnqueueCall(u32 func, int argc, const u32 *argv, PSPAction *afterAction) void hleFlushCalls() { u32 &sp = currentMIPS->r[MIPS_REG_SP]; PSPPointer stackData; - VERBOSE_LOG(HLE, "Flushing %d HLE mips calls from %s, sp=%08x", (int)enqueuedMipsCalls.size(), latestSyscall ? latestSyscall->name : "?", sp); + VERBOSE_LOG(Log::HLE, "Flushing %d HLE mips calls from %s, sp=%08x", (int)enqueuedMipsCalls.size(), latestSyscall ? latestSyscall->name : "?", sp); // First, we'll add a marker for the final return. sp -= sizeof(HLEMipsCallStack); @@ -459,7 +459,7 @@ void hleFlushCalls() { } enqueuedMipsCalls.clear(); - DEBUG_LOG(HLE, "Executing HLE mips call at %08x, sp=%08x", currentMIPS->pc, sp); + DEBUG_LOG(Log::HLE, "Executing HLE mips call at %08x, sp=%08x", currentMIPS->pc, sp); } void HLEReturnFromMipsCall() { @@ -470,14 +470,14 @@ void HLEReturnFromMipsCall() { stackData.ptr = sp; if ((stackData->nextOff & 0x0000000F) != 0 || !Memory::IsValidAddress(sp + stackData->nextOff)) { - ERROR_LOG(HLE, "Corrupt stack on HLE mips call return: %08x", stackData->nextOff); + ERROR_LOG(Log::HLE, "Corrupt stack on HLE mips call return: %08x", stackData->nextOff); Core_UpdateState(CORE_RUNTIME_ERROR); return; } if (stackData->actionIndex != 0xFFFFFFFF && stackData->actionIndex < (u32)mipsCallActions.size()) { PSPAction *&action = mipsCallActions[stackData->actionIndex]; - VERBOSE_LOG(HLE, "Executing action for HLE mips call at %08x, sp=%08x", stackData->func, sp); + VERBOSE_LOG(Log::HLE, "Executing action for HLE mips call at %08x, sp=%08x", stackData->func, sp); // Search for the saved v0/v1 values, to preserve the PSPAction API... PSPPointer finalMarker = stackData; @@ -486,7 +486,7 @@ void HLEReturnFromMipsCall() { } if (finalMarker->nextOff != 0xFFFFFFFF) { - ERROR_LOG(HLE, "Corrupt stack on HLE mips call return action: %08x", finalMarker->nextOff); + ERROR_LOG(Log::HLE, "Corrupt stack on HLE mips call return action: %08x", finalMarker->nextOff); Core_UpdateState(CORE_RUNTIME_ERROR); return; } @@ -523,7 +523,7 @@ void HLEReturnFromMipsCall() { mipsCallActions.clear(); } - VERBOSE_LOG(HLE, "Finished HLE mips calls, v0=%08x, sp=%08x", currentMIPS->r[MIPS_REG_V0], sp); + VERBOSE_LOG(Log::HLE, "Finished HLE mips calls, v0=%08x, sp=%08x", currentMIPS->r[MIPS_REG_V0], sp); return; } @@ -534,7 +534,7 @@ void HLEReturnFromMipsCall() { for (int i = 0; i < (int)stackData->argc; i++) { currentMIPS->r[MIPS_REG_A0 + i] = Memory::Read_U32(sp + sizeof(HLEMipsCallStack) + i * sizeof(u32)); } - DEBUG_LOG(HLE, "Executing next HLE mips call at %08x, sp=%08x", currentMIPS->pc, sp); + DEBUG_LOG(Log::HLE, "Executing next HLE mips call at %08x, sp=%08x", currentMIPS->pc, sp); } const static u32 deadbeefRegs[12] = {0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF}; @@ -639,9 +639,9 @@ inline void CallSyscallWithFlags(const HLEFunction *info) } if ((flags & HLE_NOT_DISPATCH_SUSPENDED) && !__KernelIsDispatchEnabled()) { - RETURN(hleLogDebug(HLE, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch suspended")); + RETURN(hleLogDebug(Log::HLE, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch suspended")); } else if ((flags & HLE_NOT_IN_INTERRUPT) && __IsInInterrupt()) { - RETURN(hleLogDebug(HLE, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "in interrupt")); + RETURN(hleLogDebug(Log::HLE, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "in interrupt")); } else { info->func(); } @@ -670,15 +670,15 @@ const HLEFunction *GetSyscallFuncPointer(MIPSOpcode op) int funcnum = callno & 0xFFF; int modulenum = (callno & 0xFF000) >> 12; if (funcnum == 0xfff) { - ERROR_LOG(HLE, "Unknown syscall: Module: %s (module: %d func: %d)", modulenum > (int)moduleDB.size() ? "(unknown)" : moduleDB[modulenum].name, modulenum, funcnum); + ERROR_LOG(Log::HLE, "Unknown syscall: Module: %s (module: %d func: %d)", modulenum > (int)moduleDB.size() ? "(unknown)" : moduleDB[modulenum].name, modulenum, funcnum); return NULL; } if (modulenum >= (int)moduleDB.size()) { - ERROR_LOG(HLE, "Syscall had bad module number %d - probably executing garbage", modulenum); + ERROR_LOG(Log::HLE, "Syscall had bad module number %d - probably executing garbage", modulenum); return NULL; } if (funcnum >= moduleDB[modulenum].numFunctions) { - ERROR_LOG(HLE, "Syscall had bad function number %d in module %d - probably executing garbage", funcnum, modulenum); + ERROR_LOG(Log::HLE, "Syscall had bad function number %d in module %d - probably executing garbage", funcnum, modulenum); return NULL; } return &moduleDB[modulenum].funcTable[funcnum]; @@ -691,7 +691,7 @@ void *GetQuickSyscallFunc(MIPSOpcode op) { const HLEFunction *info = GetSyscallFuncPointer(op); if (!info || !info->func) return nullptr; - DEBUG_LOG(HLE, "Compiling syscall to %s", info->name); + DEBUG_LOG(Log::HLE, "Compiling syscall to %s", info->name); // TODO: Do this with a flag? if (op == idleOp) @@ -735,7 +735,7 @@ void CallSyscall(MIPSOpcode op) } else { RETURN(SCE_KERNEL_ERROR_LIBRARY_NOT_YET_LINKED); - ERROR_LOG_REPORT(HLE, "Unimplemented HLE function %s", info->name ? info->name : "(\?\?\?)"); + ERROR_LOG_REPORT(Log::HLE, "Unimplemented HLE function %s", info->name ? info->name : "(\?\?\?)"); } if (coreCollectDebugStats) { @@ -853,7 +853,7 @@ size_t hleFormatLogArgs(char *message, size_t sz, const char *argmask) { return used; } -void hleDoLogInternal(LogType t, LogLevel level, u64 res, const char *file, int line, const char *reportTag, char retmask, const char *reason, const char *formatted_reason) { +void hleDoLogInternal(Log t, LogLevel level, u64 res, const char *file, int line, const char *reportTag, char retmask, const char *reason, const char *formatted_reason) { char formatted_args[4096]; const char *funcName = "?"; u32 funcFlags = 0; diff --git a/Core/HLE/HLE.h b/Core/HLE/HLE.h index b11efca78e..ba96ef4570 100644 --- a/Core/HLE/HLE.h +++ b/Core/HLE/HLE.h @@ -155,10 +155,10 @@ const HLEFunction *GetSyscallFuncPointer(MIPSOpcode op); // For jit, takes arg: const HLEFunction * void *GetQuickSyscallFunc(MIPSOpcode op); -void hleDoLogInternal(LogType t, LogLevel level, u64 res, const char *file, int line, const char *reportTag, char retmask, const char *reason, const char *formatted_reason); +void hleDoLogInternal(Log t, LogLevel level, u64 res, const char *file, int line, const char *reportTag, char retmask, const char *reason, const char *formatted_reason); template -T hleDoLog(LogType t, LogLevel level, T res, const char *file, int line, const char *reportTag, char retmask, const char *reason, ...) { +T hleDoLog(Log t, LogLevel level, T res, const char *file, int line, const char *reportTag, char retmask, const char *reason, ...) { if ((int)level > MAX_LOGLEVEL || !GenericLogEnabled(level, t)) { return res; } @@ -186,7 +186,7 @@ T hleDoLog(LogType t, LogLevel level, T res, const char *file, int line, const c } template -T hleDoLog(LogType t, LogLevel level, T res, const char *file, int line, const char *reportTag, char retmask) { +T hleDoLog(Log t, LogLevel level, T res, const char *file, int line, const char *reportTag, char retmask) { if (((int)level > MAX_LOGLEVEL || !GenericLogEnabled(level, t)) && !reportTag) { return res; } @@ -216,7 +216,7 @@ T hleDoLog(LogType t, LogLevel level, T res, const char *file, int line, const c #define HLE_LOG_LVERBOSE LVERBOSE #endif -#define hleLogHelper(t, level, res, retmask, ...) hleDoLog(LogType::t, LogLevel::level, res, __FILE__, __LINE__, nullptr, retmask, ##__VA_ARGS__) +#define hleLogHelper(t, level, res, retmask, ...) hleDoLog(t, LogLevel::level, res, __FILE__, __LINE__, nullptr, retmask, ##__VA_ARGS__) #define hleLogError(t, res, ...) hleLogHelper(t, LERROR, res, 'x', ##__VA_ARGS__) #define hleLogWarning(t, res, ...) hleLogHelper(t, LWARNING, res, 'x', ##__VA_ARGS__) #define hleLogDebug(t, res, ...) hleLogHelper(t, HLE_LOG_LDEBUG, res, 'x', ##__VA_ARGS__) @@ -228,7 +228,6 @@ T hleDoLog(LogType t, LogLevel level, T res, const char *file, int line, const c #define hleLogSuccessVerboseX(t, res, ...) hleLogHelper(t, HLE_LOG_LVERBOSE, res, 'x', ##__VA_ARGS__) #define hleLogSuccessVerboseI(t, res, ...) hleLogHelper(t, HLE_LOG_LVERBOSE, res, 'i', ##__VA_ARGS__) -#define hleReportError(t, res, ...) hleDoLog(LogType::t, LogLevel::LERROR, res, __FILE__, __LINE__, "", 'x', ##__VA_ARGS__) -#define hleReportWarning(t, res, ...) hleDoLog(LogType::t, LogLevel::LWARNING, res, __FILE__, __LINE__, "", 'x', ##__VA_ARGS__) -#define hleReportDebug(t, res, ...) hleDoLog(LogType::t, LogLevel::HLE_LOG_LDEBUG, res, __FILE__, __LINE__, "", 'x', ##__VA_ARGS__) -#define hleReportVerbose(t, res, ...) hleDoLog(LogType::t, LogLevel::HLE_LOG_LVERBOSE, res, __FILE__, __LINE__, "", 'x', ##__VA_ARGS__) +#define hleReportError(t, res, ...) hleDoLog(t, LogLevel::LERROR, res, __FILE__, __LINE__, "", 'x', ##__VA_ARGS__) +#define hleReportWarning(t, res, ...) hleDoLog(t, LogLevel::LWARNING, res, __FILE__, __LINE__, "", 'x', ##__VA_ARGS__) +#define hleReportDebug(t, res, ...) hleDoLog(t, LogLevel::HLE_LOG_LDEBUG, res, __FILE__, __LINE__, "", 'x', ##__VA_ARGS__) diff --git a/Core/HLE/HLEHelperThread.cpp b/Core/HLE/HLEHelperThread.cpp index 60f7efb759..f37868c17f 100644 --- a/Core/HLE/HLEHelperThread.cpp +++ b/Core/HLE/HLEHelperThread.cpp @@ -97,7 +97,7 @@ void HLEHelperThread::ChangePriority(u32 prio) { void HLEHelperThread::Resume(WaitType waitType, SceUID uid, int result) { bool res = HLEKernel::ResumeFromWait(id_, waitType, uid, result); if (!res) { - ERROR_LOG(HLE, "Failed to wake helper thread from wait"); + ERROR_LOG(Log::HLE, "Failed to wake helper thread from wait"); } } diff --git a/Core/HLE/KUBridge.cpp b/Core/HLE/KUBridge.cpp index dd643c5896..763efcf3a3 100644 --- a/Core/HLE/KUBridge.cpp +++ b/Core/HLE/KUBridge.cpp @@ -26,13 +26,13 @@ #include "Core/Config.h" static int kuKernelLoadModule(const char *path, uint32_t flags, uint32_t lmOptionAddr) { - INFO_LOG(SCEKERNEL, "kuKernelLoadModule - forwarding to sceKernelLoadModule"); + INFO_LOG(Log::sceKernel, "kuKernelLoadModule - forwarding to sceKernelLoadModule"); // Simply forward the call, like JPSCP does. return sceKernelLoadModule(path, flags, lmOptionAddr); } static int kuKernelGetModel() { - INFO_LOG(SCEKERNEL, "kuKernelGetModel()"); + INFO_LOG(Log::sceKernel, "kuKernelGetModel()"); return g_Config.iPSPModel; } diff --git a/Core/HLE/Plugins.cpp b/Core/HLE/Plugins.cpp index 8a65e9abda..acc57d48fa 100644 --- a/Core/HLE/Plugins.cpp +++ b/Core/HLE/Plugins.cpp @@ -67,16 +67,16 @@ static PluginInfo ReadPluginIni(const std::string &subdir, IniFile &ini) { options->Get("version", &info.version, 0); options->Get("memory", &info.memory, 0); if (info.memory > 93) { - ERROR_LOG(SYSTEM, "Plugin memory too high, using 93 MB"); + ERROR_LOG(Log::System, "Plugin memory too high, using 93 MB"); info.memory = 93; } if (info.version == 0) { - ERROR_LOG(SYSTEM, "Plugin without version ignored: %s", subdir.c_str()); + ERROR_LOG(Log::System, "Plugin without version ignored: %s", subdir.c_str()); info.type = PluginType::INVALID; info.memory = 0; } else if (info.type == PluginType::INVALID && !info.filename.empty()) { - ERROR_LOG(SYSTEM, "Plugin without valid type: %s", subdir.c_str()); + ERROR_LOG(Log::System, "Plugin without valid type: %s", subdir.c_str()); } return info; @@ -94,7 +94,7 @@ std::vector FindPlugins(const std::string &gameID, const std::string IniFile ini; if (!ini.Load(subdirFullName / "plugin.ini")) { - ERROR_LOG(SYSTEM, "Failed to load plugin ini: %s/plugin.ini", subdirFullName.c_str()); + ERROR_LOG(Log::System, "Failed to load plugin ini: %s/plugin.ini", subdirFullName.c_str()); continue; } @@ -127,7 +127,7 @@ std::vector FindPlugins(const std::string &gameID, const std::string std::set langMatches; for (const std::string &subini : matches) { if (!ini.Load(subdirFullName / subini)) { - ERROR_LOG(SYSTEM, "Failed to load plugin ini: %s/%s", subdirFullName.c_str(), subini.c_str()); + ERROR_LOG(Log::System, "Failed to load plugin ini: %s/%s", subdirFullName.c_str(), subini.c_str()); continue; } @@ -142,7 +142,7 @@ std::vector FindPlugins(const std::string &gameID, const std::string for (const std::string &subini : langMatches) { if (!ini.Load(subdirFullName / subini)) { - ERROR_LOG(SYSTEM, "Failed to load plugin ini: %s/%s", subdirFullName.c_str(), subini.c_str()); + ERROR_LOG(Log::System, "Failed to load plugin ini: %s/%s", subdirFullName.c_str(), subini.c_str()); continue; } @@ -179,27 +179,27 @@ bool Load() { for (const std::string &filename : prxPlugins) { if (!g_Config.bEnablePlugins) { - WARN_LOG(SYSTEM, "Plugins are disabled, ignoring enabled plugin %s", filename.c_str()); + WARN_LOG(Log::System, "Plugins are disabled, ignoring enabled plugin %s", filename.c_str()); continue; } std::string error_string = ""; SceUID module = KernelLoadModule(filename, &error_string); if (!error_string.empty() || module < 0) { - ERROR_LOG(SYSTEM, "Unable to load plugin %s (module %d): '%s'", filename.c_str(), module, error_string.c_str()); + ERROR_LOG(Log::System, "Unable to load plugin %s (module %d): '%s'", filename.c_str(), module, error_string.c_str()); continue; } int ret = KernelStartModule(module, 0, 0, 0, nullptr, nullptr); if (ret < 0) { - ERROR_LOG(SYSTEM, "Unable to start plugin %s: %08x", filename.c_str(), ret); + ERROR_LOG(Log::System, "Unable to start plugin %s: %08x", filename.c_str(), ret); } else { std::string shortName = Path(filename).GetFilename(); g_OSD.Show(OSDType::MESSAGE_SUCCESS, ApplySafeSubstitutions(sy->T("Loaded plugin: %1"), shortName), 6.0f); started = true; } - INFO_LOG(SYSTEM, "Loaded plugin: %s", filename.c_str()); + INFO_LOG(Log::System, "Loaded plugin: %s", filename.c_str()); } std::lock_guard guard(g_inputMutex); diff --git a/Core/HLE/ReplaceTables.cpp b/Core/HLE/ReplaceTables.cpp index c4e04b553f..c80c804c3e 100644 --- a/Core/HLE/ReplaceTables.cpp +++ b/Core/HLE/ReplaceTables.cpp @@ -1377,7 +1377,7 @@ static int Hook_starocean_clear_framebuf_after() { int y = (s16)Memory::Read_U16(y_address); int h = (s16)Memory::Read_U16(h_address); - DEBUG_LOG(HLE, "starocean_clear_framebuf() - %08x y=%d-%d", framebuf, y, h); + DEBUG_LOG(Log::HLE, "starocean_clear_framebuf() - %08x y=%d-%d", framebuf, y, h); // TODO: This is always clearing to 0, actually, which could be faster than an upload. gpu->PerformWriteColorFromMemory(framebuf + 512 * y * 4, 512 * h * 4); } @@ -1655,13 +1655,13 @@ static bool WriteReplaceInstruction(u32 address, int index) { if (prevIndex == index) { return false; } - WARN_LOG(HLE, "Replacement func changed at %08x (%d -> %d)", address, prevIndex, index); + WARN_LOG(Log::HLE, "Replacement func changed at %08x (%d -> %d)", address, prevIndex, index); // Make sure we don't save the old replacement. prevInstr = replacedInstructions[address]; } if (MIPS_IS_RUNBLOCK(Memory::Read_U32(address))) { - WARN_LOG(HLE, "Replacing jitted func address %08x", address); + WARN_LOG(Log::HLE, "Replacing jitted func address %08x", address); } replacedInstructions[address] = prevInstr; Memory::Write_U32(MIPS_EMUHACK_CALL_REPLACEMENT | index, address); @@ -1694,7 +1694,7 @@ void WriteReplaceInstructions(u32 address, u64 hash, int size) { } if (didReplace) { - INFO_LOG(HLE, "Replaced %s at %08x with hash %016llx", entries[index].name, address, hash); + INFO_LOG(Log::HLE, "Replaced %s at %08x with hash %016llx", entries[index].name, address, hash); } } } @@ -1703,9 +1703,9 @@ void RestoreReplacedInstruction(u32 address) { const u32 curInstr = Memory::Read_U32(address); if (MIPS_IS_REPLACEMENT(curInstr)) { Memory::Write_U32(replacedInstructions[address], address); - NOTICE_LOG(HLE, "Restored replaced func at %08x", address); + NOTICE_LOG(Log::HLE, "Restored replaced func at %08x", address); } else { - NOTICE_LOG(HLE, "Replaced func changed at %08x", address); + NOTICE_LOG(Log::HLE, "Replaced func changed at %08x", address); } replacedInstructions.erase(address); } @@ -1727,7 +1727,7 @@ void RestoreReplacedInstructions(u32 startAddr, u32 endAddr) { ++restored; } } - INFO_LOG(HLE, "Restored %d replaced funcs between %08x-%08x", restored, startAddr, endAddr); + INFO_LOG(Log::HLE, "Restored %d replaced funcs between %08x-%08x", restored, startAddr, endAddr); replacedInstructions.erase(start, end); } @@ -1788,7 +1788,7 @@ bool CanReplaceJalTo(u32 dest, const ReplacementTableEntry **entry, u32 *funcSiz int index = op.encoding & MIPS_EMUHACK_VALUE_MASK; *entry = GetReplacementFunc(index); if (!*entry) { - ERROR_LOG(HLE, "ReplaceJalTo: Invalid replacement op %08x at %08x", op.encoding, dest); + ERROR_LOG(Log::HLE, "ReplaceJalTo: Invalid replacement op %08x at %08x", op.encoding, dest); return false; } diff --git a/Core/HLE/ThreadQueueList.h b/Core/HLE/ThreadQueueList.h index 72282e2a3f..2e5e76c2c8 100644 --- a/Core/HLE/ThreadQueueList.h +++ b/Core/HLE/ThreadQueueList.h @@ -187,7 +187,7 @@ struct ThreadQueueList { Do(p, numQueues); if (numQueues != NUM_QUEUES) { p.SetError(p.ERROR_FAILURE); - ERROR_LOG(SCEKERNEL, "Savestate loading error: invalid data"); + ERROR_LOG(Log::sceKernel, "Savestate loading error: invalid data"); return; } diff --git a/Core/HLE/__sceAudio.cpp b/Core/HLE/__sceAudio.cpp index ed4cec8da2..4ce1199672 100644 --- a/Core/HLE/__sceAudio.cpp +++ b/Core/HLE/__sceAudio.cpp @@ -163,7 +163,7 @@ void __AudioDoState(PointerWrap &p) { Do(p, chanCount); if (chanCount != ARRAY_SIZE(chans)) { - ERROR_LOG(SCEAUDIO, "Savestate failure: different number of audio channels."); + ERROR_LOG(Log::sceAudio, "Savestate failure: different number of audio channels."); p.SetError(p.ERROR_FAILURE); return; } @@ -292,7 +292,7 @@ inline void __AudioWakeThreads(AudioChannel &chan, int result, int step) { // If it's done (there will still be samples on queue) and actually still waiting, wake it up. u32 waitID = __KernelGetWaitID(waitInfo.threadID, WAITTYPE_AUDIOCHANNEL, error); if (waitInfo.numSamples <= 0 && waitID != 0) { - // DEBUG_LOG(SCEAUDIO, "Woke thread %i for some buffer filling", waitingThread); + // DEBUG_LOG(Log::sceAudio, "Woke thread %i for some buffer filling", waitingThread); u32 ret = result == 0 ? __KernelGetWaitValue(waitInfo.threadID, error) : SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; __KernelResumeThreadFromWait(waitInfo.threadID, ret); wokeThreads = true; @@ -315,9 +315,9 @@ void __AudioWakeThreads(AudioChannel &chan, int result) { void __AudioSetOutputFrequency(int freq) { if (freq != 44100) { - WARN_LOG_REPORT(SCEAUDIO, "Switching audio frequency to %i", freq); + WARN_LOG_REPORT(Log::sceAudio, "Switching audio frequency to %i", freq); } else { - DEBUG_LOG(SCEAUDIO, "Switching audio frequency to %i", freq); + DEBUG_LOG(Log::sceAudio, "Switching audio frequency to %i", freq); } mixFrequency = freq; } @@ -328,7 +328,7 @@ void __AudioSetSRCFrequency(int freq) { // Mix samples from the various audio channels into a single sample queue, managed by the backend implementation. void __AudioUpdate(bool resetRecording) { - // Audio throttle doesn't really work on the PSP since the mixing intervals are so closely tied + // AUDIO throttle doesn't really work on the PSP since the mixing intervals are so closely tied // to the CPU. Much better to throttle the frame rate on frame display and just throw away audio // if the buffer somehow gets full. bool firstChannel = true; @@ -348,7 +348,7 @@ void __AudioUpdate(bool resetRecording) { bool needsResample = i == PSP_AUDIO_CHANNEL_SRC && srcFrequency != 0 && srcFrequency != mixFrequency; size_t sz = needsResample ? (srcBufferSize * srcFrequency) / mixFrequency : srcBufferSize; if (sz > chanSampleQueues[i].size()) { - ERROR_LOG(SCEAUDIO, "Channel %i buffer underrun at %i of %i", i, (int)chanSampleQueues[i].size() / 2, (int)sz / 2); + ERROR_LOG(Log::sceAudio, "Channel %i buffer underrun at %i of %i", i, (int)chanSampleQueues[i].size() / 2, (int)sz / 2); } const s16 *buf1 = 0, *buf2 = 0; @@ -424,7 +424,7 @@ void __AudioUpdate(bool resetRecording) { __StopLogAudio(); std::string discID = g_paramSFO.GetDiscID(); Path audio_file_name = GetSysDirectory(DIRECTORY_AUDIO) / StringFromFormat("%s_%s.wav", discID.c_str(), KernelTimeNowFormatted().c_str()).c_str(); - INFO_LOG(COMMON, "Restarted audio recording to: %s", audio_file_name.c_str()); + INFO_LOG(Log::Common, "Restarted audio recording to: %s", audio_file_name.c_str()); if (!File::Exists(GetSysDirectory(DIRECTORY_AUDIO))) File::CreateDir(GetSysDirectory(DIRECTORY_AUDIO)); File::CreateEmptyFile(audio_file_name); @@ -435,7 +435,7 @@ void __AudioUpdate(bool resetRecording) { // Use gameID_EmulatedTimestamp for filename std::string discID = g_paramSFO.GetDiscID(); Path audio_file_name = GetSysDirectory(DIRECTORY_AUDIO) / StringFromFormat("%s_%s.wav", discID.c_str(), KernelTimeNowFormatted().c_str()); - INFO_LOG(COMMON,"Recording audio to: %s", audio_file_name.c_str()); + INFO_LOG(Log::Common,"Recording audio to: %s", audio_file_name.c_str()); // Create the path just in case it doesn't exist if (!File::Exists(GetSysDirectory(DIRECTORY_AUDIO))) File::CreateDir(GetSysDirectory(DIRECTORY_AUDIO)); @@ -462,9 +462,9 @@ void __StartLogAudio(const Path& filename) { m_logAudio = true; g_wave_writer.Start(filename, 44100); g_wave_writer.SetSkipSilence(false); - NOTICE_LOG(SCEAUDIO, "Starting Audio logging"); + NOTICE_LOG(Log::sceAudio, "Starting Audio logging"); } else { - WARN_LOG(SCEAUDIO, "Audio logging has already been started"); + WARN_LOG(Log::sceAudio, "Audio logging has already been started"); } } @@ -472,9 +472,9 @@ void __StopLogAudio() { if (m_logAudio) { m_logAudio = false; g_wave_writer.Stop(); - NOTICE_LOG(SCEAUDIO, "Stopping Audio logging"); + NOTICE_LOG(Log::sceAudio, "Stopping Audio logging"); } else { - WARN_LOG(SCEAUDIO, "Audio logging has already been stopped"); + WARN_LOG(Log::sceAudio, "Audio logging has already been stopped"); } } #endif diff --git a/Core/HLE/__sceAudio.h b/Core/HLE/__sceAudio.h index d757e1d8bd..cf1426d3b3 100644 --- a/Core/HLE/__sceAudio.h +++ b/Core/HLE/__sceAudio.h @@ -46,7 +46,7 @@ u32 __AudioEnqueue(AudioChannel &chan, int chanNum, bool blocking); void __AudioWakeThreads(AudioChannel &chan, int result, int step); void __AudioWakeThreads(AudioChannel &chan, int result); -// Audio Dumping stuff +// AUDIO Dumping stuff void __StartLogAudio(const Path &filename); void __StopLogAudio(); diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index 2fc90989d9..eda054c6a4 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -196,7 +196,7 @@ SceNetAdhocMatchingMemberInternal* addMember(SceNetAdhocMatchingContext * contex SceNetAdhocMatchingMemberInternal * peer = findPeer(context, mac); // Already existed if (peer != NULL) { - WARN_LOG(SCENET, "Member Peer Already Existed! Updating [%s]", mac2str(mac).c_str()); + WARN_LOG(Log::sceNet, "Member Peer Already Existed! Updating [%s]", mac2str(mac).c_str()); peer->state = 0; peer->sending = 0; peer->lastping = CoreTiming::GetGlobalTimeUsScaled(); @@ -227,7 +227,7 @@ void addFriend(SceNetAdhocctlConnectPacketS2C * packet) { // Already existed if (peer != NULL) { u32 tmpip = packet->ip; - WARN_LOG(SCENET, "Friend Peer Already Existed! Updating [%s][%s][%s]", mac2str(&packet->mac).c_str(), ip2str(*(struct in_addr*)&tmpip).c_str(), packet->name.data); //inet_ntoa(*(in_addr*)&packet->ip) + WARN_LOG(Log::sceNet, "Friend Peer Already Existed! Updating [%s][%s][%s]", mac2str(&packet->mac).c_str(), ip2str(*(struct in_addr*)&tmpip).c_str(), packet->name.data); //inet_ntoa(*(in_addr*)&packet->ip) peer->nickname = packet->name; peer->mac_addr = packet->mac; peer->ip_addr = packet->ip; @@ -489,7 +489,7 @@ void deleteFriendByIP(uint32_t ip) { */ u32 tmpip = peer->ip_addr; - INFO_LOG(SCENET, "Removing Friend Peer %s [%s]", mac2str(&peer->mac_addr).c_str(), ip2str(*(struct in_addr *)&tmpip).c_str()); //inet_ntoa(*(in_addr*)&peer->ip_addr) + INFO_LOG(Log::sceNet, "Removing Friend Peer %s [%s]", mac2str(&peer->mac_addr).c_str(), ip2str(*(struct in_addr *)&tmpip).c_str()); //inet_ntoa(*(in_addr*)&peer->ip_addr) // Free Memory //free(peer); @@ -596,7 +596,7 @@ void postAcceptCleanPeerList(SceNetAdhocMatchingContext * context) // Free Peer Lock peerlock.unlock(); - INFO_LOG(SCENET, "Removing Unneeded Peers (%i/%i)", delcount, peercount); + INFO_LOG(Log::sceNet, "Removing Unneeded Peers (%i/%i)", delcount, peercount); } /** @@ -625,7 +625,7 @@ void postAcceptAddSiblings(SceNetAdhocMatchingContext * context, int siblingcoun peer->state = PSP_ADHOC_MATCHING_PEER_CHILD; peer->sending = 0; peer->lastping = CoreTiming::GetGlobalTimeUsScaled(); - WARN_LOG(SCENET, "Updating Sibling Peer %s", mac2str(mac).c_str()); + WARN_LOG(Log::sceNet, "Updating Sibling Peer %s", mac2str(mac).c_str()); } else { // Allocate Memory @@ -653,7 +653,7 @@ void postAcceptAddSiblings(SceNetAdhocMatchingContext * context, int siblingcoun // Spawn Established Event. FIXME: ESTABLISHED event should only be triggered for Parent/P2P peer? //spawnLocalEvent(context, PSP_ADHOC_MATCHING_EVENT_ESTABLISHED, &sibling->mac, 0, NULL); - INFO_LOG(SCENET, "Accepting Sibling Peer %s", mac2str(&sibling->mac).c_str()); + INFO_LOG(Log::sceNet, "Accepting Sibling Peer %s", mac2str(&sibling->mac).c_str()); } } } @@ -784,7 +784,7 @@ void deletePeer(SceNetAdhocMatchingContext * context, SceNetAdhocMatchingMemberI // Beginning Item else context->peerlist = item->next; - INFO_LOG(SCENET, "Removing Member Peer %s", mac2str(&peer->mac).c_str()); + INFO_LOG(Log::sceNet, "Removing Member Peer %s", mac2str(&peer->mac).c_str()); } // Free Peer Memory @@ -1059,7 +1059,7 @@ void handleTimeout(SceNetAdhocMatchingContext * context) // FIXME: TIMEOUT event should only be triggered on Parent/P2P mode and for Parent/P2P peer? spawnLocalEvent(context, PSP_ADHOC_MATCHING_EVENT_TIMEOUT, &peer->mac, 0, NULL); - INFO_LOG(SCENET, "TimedOut Member Peer %s (%lld - %lld = %lld > %lld us)", mac2str(&peer->mac).c_str(), now, peer->lastping, (now - peer->lastping), context->timeout); + INFO_LOG(Log::sceNet, "TimedOut Member Peer %s (%lld - %lld = %lld > %lld us)", mac2str(&peer->mac).c_str(), now, peer->lastping, (now - peer->lastping), context->timeout); if (context->mode == PSP_ADHOC_MATCHING_MODE_PARENT) sendDeathMessage(context, peer); @@ -1179,9 +1179,9 @@ void AfterMatchingMipsCall::run(MipsCall &call) { peerlock.unlock(); } u32 v0 = currentMIPS->r[MIPS_REG_V0]; - if (__IsInInterrupt()) ERROR_LOG(SCENET, "AfterMatchingMipsCall::run [ID=%i][Event=%d] is Returning Inside an Interrupt!", contextID, EventID); + if (__IsInInterrupt()) ERROR_LOG(Log::sceNet, "AfterMatchingMipsCall::run [ID=%i][Event=%d] is Returning Inside an Interrupt!", contextID, EventID); //SetMatchingInCallback(context, false); - DEBUG_LOG(SCENET, "AfterMatchingMipsCall::run [ID=%i][Event=%d][%s] [cbId: %u][retV0: %08x]", contextID, EventID, mac2str((SceNetEtherAddr*)Memory::GetPointer(bufAddr)).c_str(), call.cbId, v0); + DEBUG_LOG(Log::sceNet, "AfterMatchingMipsCall::run [ID=%i][Event=%d][%s] [cbId: %u][retV0: %08x]", contextID, EventID, mac2str((SceNetEtherAddr*)Memory::GetPointer(bufAddr)).c_str(), call.cbId, v0); if (Memory::IsValidAddress(bufAddr)) userMemory.Free(bufAddr); //call.setReturnValue(v0); } @@ -1229,10 +1229,10 @@ void AfterAdhocMipsCall::DoState(PointerWrap & p) { void AfterAdhocMipsCall::run(MipsCall& call) { u32 v0 = currentMIPS->r[MIPS_REG_V0]; - if (__IsInInterrupt()) ERROR_LOG(SCENET, "AfterAdhocMipsCall::run [ID=%i][Event=%d] is Returning Inside an Interrupt!", HandlerID, EventID); + if (__IsInInterrupt()) ERROR_LOG(Log::sceNet, "AfterAdhocMipsCall::run [ID=%i][Event=%d] is Returning Inside an Interrupt!", HandlerID, EventID); SetAdhocctlInCallback(false); isAdhocctlBusy = false; - DEBUG_LOG(SCENET, "AfterAdhocMipsCall::run [ID=%i][Event=%d] [cbId: %u][retV0: %08x]", HandlerID, EventID, call.cbId, v0); + DEBUG_LOG(Log::sceNet, "AfterAdhocMipsCall::run [ID=%i][Event=%d] [cbId: %u][retV0: %08x]", HandlerID, EventID, call.cbId, v0); //call.setReturnValue(v0); } @@ -1327,7 +1327,7 @@ void sendChat(const std::string &chatString) { //Send Chat Messages if (IsSocketReady((int)metasocket, false, true) > 0) { int chatResult = (int)send((int)metasocket, (const char*)&chat, sizeof(chat), MSG_NOSIGNAL); - NOTICE_LOG(SCENET, "Send Chat %s to Adhoc Server", chat.message); + NOTICE_LOG(Log::sceNet, "Send Chat %s to Adhoc Server", chat.message); std::string name = g_Config.sNickName; std::lock_guard guard(chatLogLock); @@ -1381,14 +1381,14 @@ int friendFinder(){ uint64_t now; // Log Startup - INFO_LOG(SCENET, "FriendFinder: Begin of Friend Finder Thread"); + INFO_LOG(Log::sceNet, "FriendFinder: Begin of Friend Finder Thread"); // Resolve and cache AdhocServer DNS addrinfo* resolved = nullptr; std::string err; g_adhocServerIP.in.sin_addr.s_addr = INADDR_NONE; if (g_Config.bEnableWlan && !net::DNSResolve(g_Config.proAdhocServer, "", &resolved, err)) { - ERROR_LOG(SCENET, "DNS Error Resolving %s\n", g_Config.proAdhocServer.c_str()); + ERROR_LOG(Log::sceNet, "DNS Error Resolving %s\n", g_Config.proAdhocServer.c_str()); g_OSD.Show(OSDType::MESSAGE_ERROR, std::string(n->T("DNS Error Resolving ")) + g_Config.proAdhocServer); } if (resolved) { @@ -1414,7 +1414,7 @@ int friendFinder(){ if (g_Config.bEnableWlan) { if (initNetwork(&product_code) == 0) { networkInited = true; - INFO_LOG(SCENET, "FriendFinder: Network [RE]Initialized"); + INFO_LOG(Log::sceNet, "FriendFinder: Network [RE]Initialized"); // At this point we are most-likely not in a Group within the Adhoc Server, so we should probably reset AdhocctlState adhocctlState = ADHOCCTL_STATE_DISCONNECTED; netAdhocGameModeEntered = false; @@ -1445,7 +1445,7 @@ int friendFinder(){ int error = errno; // KHBBS seems to be getting error 10053 often if (iResult == SOCKET_ERROR) { - ERROR_LOG(SCENET, "FriendFinder: Socket Error (%i) when sending OPCODE_PING", error); + ERROR_LOG(Log::sceNet, "FriendFinder: Socket Error (%i) when sending OPCODE_PING", error); if (error != EAGAIN && error != EWOULDBLOCK) { networkInited = false; shutdown((int)metasocket, SD_BOTH); @@ -1461,7 +1461,7 @@ int friendFinder(){ else { // Update Ping Time lastping = now; - VERBOSE_LOG(SCENET, "FriendFinder: Sending OPCODE_PING (%llu)", static_cast(now)); + VERBOSE_LOG(Log::sceNet, "FriendFinder: Sending OPCODE_PING (%llu)", static_cast(now)); } } } @@ -1480,7 +1480,7 @@ int friendFinder(){ // Log Incoming Traffic //printf("Received %d Bytes of Data from Server\n", received); - INFO_LOG(SCENET, "Received %d Bytes of Data from Adhoc Server", received); + INFO_LOG(Log::sceNet, "Received %d Bytes of Data from Adhoc Server", received); } } @@ -1499,7 +1499,7 @@ int friendFinder(){ // Cast Packet SceNetAdhocctlConnectBSSIDPacketS2C* packet = (SceNetAdhocctlConnectBSSIDPacketS2C*)rx; - INFO_LOG(SCENET, "FriendFinder: Incoming OPCODE_CONNECT_BSSID [%s]", mac2str(&packet->mac).c_str()); + INFO_LOG(Log::sceNet, "FriendFinder: Incoming OPCODE_CONNECT_BSSID [%s]", mac2str(&packet->mac).c_str()); // Update User BSSID parameter.bssid.mac_addr = packet->mac; // This packet seems to contains Adhoc Group Creator's BSSID (similar to AP's BSSID) so it shouldn't get mixed up with local MAC address @@ -1521,7 +1521,7 @@ int friendFinder(){ } } else - WARN_LOG(SCENET, "GameMode SelfMember [%s] Already Existed!", mac2str(&localMac).c_str()); + WARN_LOG(Log::sceNet, "GameMode SelfMember [%s] Already Existed!", mac2str(&localMac).c_str()); } else { //adhocctlState = ADHOCCTL_STATE_CONNECTED; @@ -1546,14 +1546,14 @@ int friendFinder(){ if (rxpos >= (int)sizeof(SceNetAdhocctlChatPacketS2C)) { // Cast Packet SceNetAdhocctlChatPacketS2C* packet = (SceNetAdhocctlChatPacketS2C*)rx; - INFO_LOG(SCENET, "FriendFinder: Incoming OPCODE_CHAT"); + INFO_LOG(Log::sceNet, "FriendFinder: Incoming OPCODE_CHAT"); // Fix strings with null-terminated packet->name.data[ADHOCCTL_NICKNAME_LEN - 1] = 0; packet->base.message[ADHOCCTL_MESSAGE_LEN - 1] = 0; // Add Incoming Chat to HUD - NOTICE_LOG(SCENET, "Received chat message %s", packet->base.message); + NOTICE_LOG(Log::sceNet, "Received chat message %s", packet->base.message); std::string incoming = ""; std::string name = (char*)packet->name.data; incoming.append(name.substr(0, 8)); @@ -1585,7 +1585,7 @@ int friendFinder(){ // Log Incoming Peer u32_le ipaddr = packet->ip; - INFO_LOG(SCENET, "FriendFinder: Incoming OPCODE_CONNECT [%s][%s][%s]", mac2str(&packet->mac).c_str(), ip2str(*(in_addr*)&ipaddr).c_str(), packet->name.data); + INFO_LOG(Log::sceNet, "FriendFinder: Incoming OPCODE_CONNECT [%s][%s][%s]", mac2str(&packet->mac).c_str(), ip2str(*(in_addr*)&ipaddr).c_str(), packet->name.data); // Add User addFriend(packet); @@ -1620,7 +1620,7 @@ int friendFinder(){ } } else - WARN_LOG(SCENET, "GameMode Member [%s] Already Existed!", mac2str(&packet->mac).c_str()); + WARN_LOG(Log::sceNet, "GameMode Member [%s] Already Existed!", mac2str(&packet->mac).c_str()); } // Update HUD User Count @@ -1656,10 +1656,10 @@ int friendFinder(){ // Cast Packet SceNetAdhocctlDisconnectPacketS2C* packet = (SceNetAdhocctlDisconnectPacketS2C*)rx; - DEBUG_LOG(SCENET, "FriendFinder: OPCODE_DISCONNECT"); + DEBUG_LOG(Log::sceNet, "FriendFinder: OPCODE_DISCONNECT"); // Log Incoming Peer Delete Request - INFO_LOG(SCENET, "FriendFinder: Incoming Peer Data Delete Request..."); + INFO_LOG(Log::sceNet, "FriendFinder: Incoming Peer Data Delete Request..."); if (adhocctlCurrentMode == ADHOCCTL_MODE_GAMEMODE) { auto peer = findFriendByIP(packet->ip); @@ -1695,10 +1695,10 @@ int friendFinder(){ // Cast Packet SceNetAdhocctlScanPacketS2C* packet = (SceNetAdhocctlScanPacketS2C*)rx; - DEBUG_LOG(SCENET, "FriendFinder: OPCODE_SCAN"); + DEBUG_LOG(Log::sceNet, "FriendFinder: OPCODE_SCAN"); // Log Incoming Network Information - INFO_LOG(SCENET, "Incoming Group Information..."); + INFO_LOG(Log::sceNet, "Incoming Group Information..."); // Multithreading Lock peerlock.lock(); @@ -1743,9 +1743,9 @@ int friendFinder(){ // Scan Complete Packet else if (rx[0] == OPCODE_SCAN_COMPLETE) { - DEBUG_LOG(SCENET, "FriendFinder: OPCODE_SCAN_COMPLETE"); + DEBUG_LOG(Log::sceNet, "FriendFinder: OPCODE_SCAN_COMPLETE"); // Log Scan Completion - INFO_LOG(SCENET, "FriendFinder: Incoming Scan complete response..."); + INFO_LOG(Log::sceNet, "FriendFinder: Incoming Scan complete response..."); // Reset current networks to prevent disbanded host to be listed again peerlock.lock(); @@ -1781,7 +1781,7 @@ int friendFinder(){ friendFinderRunning = false; // Log Shutdown - INFO_LOG(SCENET, "FriendFinder: End of Friend Finder Thread"); + INFO_LOG(Log::sceNet, "FriendFinder: End of Friend Finder Thread"); // Return Success return 0; @@ -1933,7 +1933,7 @@ void getLocalMac(SceNetEtherAddr * addr){ } else if (!ParseMacAddress(g_Config.sMACAddress, mac)) { - ERROR_LOG(SCENET, "Error parsing mac address %s", g_Config.sMACAddress.c_str()); + ERROR_LOG(Log::sceNet, "Error parsing mac address %s", g_Config.sMACAddress.c_str()); memset(&mac, 0, sizeof(mac)); } memcpy(addr, mac, ETHER_ADDR_LEN); @@ -2170,7 +2170,7 @@ int initNetwork(SceNetAdhocctlAdhocId *adhoc_id){ metasocket = (int)INVALID_SOCKET; metasocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (metasocket == INVALID_SOCKET){ - ERROR_LOG(SCENET, "Invalid socket"); + ERROR_LOG(Log::sceNet, "Invalid socket"); return SOCKET_ERROR; } setSockKeepAlive((int)metasocket, true); @@ -2193,7 +2193,7 @@ int initNetwork(SceNetAdhocctlAdhocId *adhoc_id){ // Bind Local Address to Socket iResult = bind((int)metasocket, &g_localhostIP.addr, sizeof(g_localhostIP.addr)); if (iResult == SOCKET_ERROR) { - ERROR_LOG(SCENET, "Bind to alternate localhost[%s] failed(%i).", ip2str(g_localhostIP.in.sin_addr).c_str(), iResult); + ERROR_LOG(Log::sceNet, "Bind to alternate localhost[%s] failed(%i).", ip2str(g_localhostIP.in.sin_addr).c_str(), iResult); g_OSD.Show(OSDType::MESSAGE_ERROR, std::string(n->T("Failed to Bind Localhost IP")) + " " + ip2str(g_localhostIP.in.sin_addr).c_str()); } } @@ -2222,7 +2222,7 @@ int initNetwork(SceNetAdhocctlAdhocId *adhoc_id){ // Connect to Adhoc Server int errorcode = 0; int cnt = 0; - DEBUG_LOG(SCENET, "InitNetwork: Connecting to AdhocServer"); + DEBUG_LOG(Log::sceNet, "InitNetwork: Connecting to AdhocServer"); iResult = connect((int)metasocket, &g_adhocServerIP.addr, sizeof(g_adhocServerIP)); errorcode = errno; @@ -2248,7 +2248,7 @@ int initNetwork(SceNetAdhocctlAdhocId *adhoc_id){ sleep_ms(10); } if (!done) { - ERROR_LOG(SCENET, "Socket error (%i) when connecting to AdhocServer [%s/%s:%u]", errorcode, g_Config.proAdhocServer.c_str(), ip2str(g_adhocServerIP.in.sin_addr).c_str(), ntohs(g_adhocServerIP.in.sin_port)); + ERROR_LOG(Log::sceNet, "Socket error (%i) when connecting to AdhocServer [%s/%s:%u]", errorcode, g_Config.proAdhocServer.c_str(), ip2str(g_adhocServerIP.in.sin_addr).c_str(), ntohs(g_adhocServerIP.in.sin_port)); g_OSD.Show(OSDType::MESSAGE_ERROR, std::string(n->T("Failed to connect to Adhoc Server")) + " (" + std::string(n->T("Error")) + ": " + std::to_string(errorcode) + ")"); return iResult; } @@ -2265,7 +2265,7 @@ int initNetwork(SceNetAdhocctlAdhocId *adhoc_id){ memcpy(packet.game.data, adhoc_id->data, ADHOCCTL_ADHOCID_LEN); IsSocketReady((int)metasocket, false, true, nullptr, adhocDefaultTimeout); - DEBUG_LOG(SCENET, "InitNetwork: Sending LOGIN OPCODE %d", packet.base.opcode); + DEBUG_LOG(Log::sceNet, "InitNetwork: Sending LOGIN OPCODE %d", packet.base.opcode); int sent = (int)send((int)metasocket, (char*)&packet, sizeof(packet), MSG_NOSIGNAL); if (sent > 0) { socklen_t addrLen = sizeof(LocalIP); diff --git a/Core/HLE/proAdhocServer.cpp b/Core/HLE/proAdhocServer.cpp index 975ce81015..f58f00ca76 100644 --- a/Core/HLE/proAdhocServer.cpp +++ b/Core/HLE/proAdhocServer.cpp @@ -517,7 +517,7 @@ void login_user_stream(int fd, uint32_t ip) while(u != NULL && u->resolver.ip != ip) u = u->next; if (u != NULL) { // IP Already existed - WARN_LOG(SCENET, "AdhocServer: Already Existing IP: %s\n", ip2str(*(in_addr*)&u->resolver.ip).c_str()); + WARN_LOG(Log::sceNet, "AdhocServer: Already Existing IP: %s\n", ip2str(*(in_addr*)&u->resolver.ip).c_str()); } // Unique IP Address @@ -547,7 +547,7 @@ void login_user_stream(int fd, uint32_t ip) user->last_recv = time(NULL); // Notify User - INFO_LOG(SCENET, "AdhocServer: New Connection from %s", ip2str(*(in_addr*)&user->resolver.ip).c_str()); + INFO_LOG(Log::sceNet, "AdhocServer: New Connection from %s", ip2str(*(in_addr*)&user->resolver.ip).c_str()); // Fix User Counter _db_user_count++; @@ -590,7 +590,7 @@ void login_user_data(SceNetAdhocctlUserNode * user, SceNetAdhocctlLoginPacketC2S while (u != NULL && !IsMatch(u->resolver.mac, data->mac)) u = u->next; if (u != NULL) { // MAC Already existed - WARN_LOG(SCENET, "AdhocServer: Already Existing MAC: %s [%s]\n", mac2str(&data->mac).c_str(), ip2str(*(in_addr*)&u->resolver.ip).c_str()); + WARN_LOG(Log::sceNet, "AdhocServer: Already Existing MAC: %s [%s]\n", mac2str(&data->mac).c_str(), ip2str(*(in_addr*)&u->resolver.ip).c_str()); } // Game Product Override @@ -641,7 +641,7 @@ void login_user_data(SceNetAdhocctlUserNode * user, SceNetAdhocctlLoginPacketC2S char safegamestr[10]; memset(safegamestr, 0, sizeof(safegamestr)); strncpy(safegamestr, game->game.data, PRODUCT_CODE_LENGTH); - INFO_LOG(SCENET, "AdhocServer: %s (MAC: %s - IP: %s) started playing %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr); + INFO_LOG(Log::sceNet, "AdhocServer: %s (MAC: %s - IP: %s) started playing %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr); // Update Status Log update_status(); @@ -655,7 +655,7 @@ void login_user_data(SceNetAdhocctlUserNode * user, SceNetAdhocctlLoginPacketC2S else { // Notify User - WARN_LOG(SCENET, "AdhocServer: Invalid Login Packet Contents from %s", ip2str(*(in_addr*)&user->resolver.ip).c_str()); + WARN_LOG(Log::sceNet, "AdhocServer: Invalid Login Packet Contents from %s", ip2str(*(in_addr*)&user->resolver.ip).c_str()); } // Logout User - Out of Memory or Invalid Arguments @@ -690,7 +690,7 @@ void logout_user(SceNetAdhocctlUserNode * user) char safegamestr[10]; memset(safegamestr, 0, sizeof(safegamestr)); strncpy(safegamestr, user->game->game.data, PRODUCT_CODE_LENGTH); - INFO_LOG(SCENET, "AdhocServer: %s (MAC: %s - IP: %s) stopped playing %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr); + INFO_LOG(Log::sceNet, "AdhocServer: %s (MAC: %s - IP: %s) stopped playing %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr); // Fix Game Player Count user->game->playercount--; @@ -716,7 +716,7 @@ void logout_user(SceNetAdhocctlUserNode * user) else { // Notify User - WARN_LOG(SCENET, "AdhocServer: Dropped Connection to %s", ip2str(*(in_addr*)&user->resolver.ip).c_str()); + WARN_LOG(Log::sceNet, "AdhocServer: Dropped Connection to %s", ip2str(*(in_addr*)&user->resolver.ip).c_str()); } // Free Memory @@ -860,7 +860,7 @@ void connect_user(SceNetAdhocctlUserNode * user, SceNetAdhocctlGroupName * group // Send Data int iResult = (int)send(peer->stream, (const char*)&packet, sizeof(packet), MSG_NOSIGNAL); - if (iResult < 0) ERROR_LOG(SCENET, "AdhocServer: connect_user[send peer] (Socket error %d)", errno); + if (iResult < 0) ERROR_LOG(Log::sceNet, "AdhocServer: connect_user[send peer] (Socket error %d)", errno); // Set Player Name packet.name = peer->resolver.name; @@ -873,7 +873,7 @@ void connect_user(SceNetAdhocctlUserNode * user, SceNetAdhocctlGroupName * group // Send Data iResult = (int)send(user->stream, (const char*)&packet, sizeof(packet), MSG_NOSIGNAL); - if (iResult < 0) ERROR_LOG(SCENET, "AdhocServer: connect_user[send user] (Socket error %d)", errno); + if (iResult < 0) ERROR_LOG(Log::sceNet, "AdhocServer: connect_user[send user] (Socket error %d)", errno); // Set BSSID if(peer->group_next == NULL) bssid.mac = peer->resolver.mac; @@ -895,7 +895,7 @@ void connect_user(SceNetAdhocctlUserNode * user, SceNetAdhocctlGroupName * group // Send Network BSSID to User int iResult = (int)send(user->stream, (const char*)&bssid, sizeof(bssid), MSG_NOSIGNAL); - if (iResult < 0) ERROR_LOG(SCENET, "AdhocServer: connect_user[send user bssid] (Socket error %d)", errno); + if (iResult < 0) ERROR_LOG(Log::sceNet, "AdhocServer: connect_user[send user bssid] (Socket error %d)", errno); // Notify User char safegamestr[10]; @@ -904,7 +904,7 @@ void connect_user(SceNetAdhocctlUserNode * user, SceNetAdhocctlGroupName * group char safegroupstr[9]; memset(safegroupstr, 0, sizeof(safegroupstr)); strncpy(safegroupstr, (char *)user->group->group.data, ADHOCCTL_GROUPNAME_LEN); - INFO_LOG(SCENET, "AdhocServer: %s (MAC: %s - IP: %s) joined %s group %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr, safegroupstr); + INFO_LOG(Log::sceNet, "AdhocServer: %s (MAC: %s - IP: %s) joined %s group %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr, safegroupstr); // Update Status Log update_status(); @@ -927,7 +927,7 @@ void connect_user(SceNetAdhocctlUserNode * user, SceNetAdhocctlGroupName * group char safegroupstr2[9]; memset(safegroupstr2, 0, sizeof(safegroupstr2)); strncpy(safegroupstr2, (char *)user->group->group.data, ADHOCCTL_GROUPNAME_LEN); - WARN_LOG(SCENET, "AdhocServer: %s (MAC: %s - IP: %s) attempted to join %s group %s without disconnecting from %s first", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr, safegroupstr, safegroupstr2); + WARN_LOG(Log::sceNet, "AdhocServer: %s (MAC: %s - IP: %s) attempted to join %s group %s without disconnecting from %s first", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr, safegroupstr, safegroupstr2); } } @@ -941,7 +941,7 @@ void connect_user(SceNetAdhocctlUserNode * user, SceNetAdhocctlGroupName * group char safegroupstr[9]; memset(safegroupstr, 0, sizeof(safegroupstr)); strncpy(safegroupstr, (char *)group->data, ADHOCCTL_GROUPNAME_LEN); - WARN_LOG(SCENET, "AdhocServer: %s (MAC: %s - IP: %s) attempted to join invalid %s group %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr, safegroupstr); + WARN_LOG(Log::sceNet, "AdhocServer: %s (MAC: %s - IP: %s) attempted to join invalid %s group %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr, safegroupstr); } // Invalid State, Out of Memory or Invalid Group Name @@ -987,7 +987,7 @@ void disconnect_user(SceNetAdhocctlUserNode * user) // Send Data int iResult = (int)send(peer->stream, (const char*)&packet, sizeof(packet), MSG_NOSIGNAL); - if (iResult < 0) ERROR_LOG(SCENET, "AdhocServer: disconnect_user[send peer] (Socket error %d)", errno); + if (iResult < 0) ERROR_LOG(Log::sceNet, "AdhocServer: disconnect_user[send peer] (Socket error %d)", errno); // Move Pointer peer = peer->group_next; @@ -1000,7 +1000,7 @@ void disconnect_user(SceNetAdhocctlUserNode * user) char safegroupstr[9]; memset(safegroupstr, 0, sizeof(safegroupstr)); strncpy(safegroupstr, (char *)user->group->group.data, ADHOCCTL_GROUPNAME_LEN); - INFO_LOG(SCENET, "AdhocServer: %s (MAC: %s - IP: %s) left %s group %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr, safegroupstr); + INFO_LOG(Log::sceNet, "AdhocServer: %s (MAC: %s - IP: %s) left %s group %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr, safegroupstr); // Empty Group if(user->group->playercount == 0) @@ -1040,7 +1040,7 @@ void disconnect_user(SceNetAdhocctlUserNode * user) char safegamestr[10]; memset(safegamestr, 0, sizeof(safegamestr)); strncpy(safegamestr, user->game->game.data, PRODUCT_CODE_LENGTH); - WARN_LOG(SCENET, "AdhocServer: %s (MAC: %s - IP: %s) attempted to leave %s group without joining one first", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr); + WARN_LOG(Log::sceNet, "AdhocServer: %s (MAC: %s - IP: %s) attempted to leave %s group without joining one first", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr); } // Delete User @@ -1086,19 +1086,19 @@ void send_scan_results(SceNetAdhocctlUserNode * user) // Send Group Packet int iResult = (int)send(user->stream, (const char*)&packet, sizeof(packet), MSG_NOSIGNAL); - if (iResult < 0) ERROR_LOG(SCENET, "AdhocServer: send_scan_result[send user] (Socket error %d)", errno); + if (iResult < 0) ERROR_LOG(Log::sceNet, "AdhocServer: send_scan_result[send user] (Socket error %d)", errno); } // Notify Player of End of Scan uint8_t opcode = OPCODE_SCAN_COMPLETE; int iResult = (int)send(user->stream, (const char*)&opcode, 1, MSG_NOSIGNAL); - if (iResult < 0) ERROR_LOG(SCENET, "AdhocServer: send_scan_result[send peer complete] (Socket error %d)", errno); + if (iResult < 0) ERROR_LOG(Log::sceNet, "AdhocServer: send_scan_result[send peer complete] (Socket error %d)", errno); // Notify User char safegamestr[10]; memset(safegamestr, 0, sizeof(safegamestr)); strncpy(safegamestr, user->game->game.data, PRODUCT_CODE_LENGTH); - INFO_LOG(SCENET, "AdhocServer: %s (MAC: %s - IP: %s) requested information on %d %s groups", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), user->game->groupcount, safegamestr); + INFO_LOG(Log::sceNet, "AdhocServer: %s (MAC: %s - IP: %s) requested information on %d %s groups", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), user->game->groupcount, safegamestr); // Exit Function return; @@ -1114,7 +1114,7 @@ void send_scan_results(SceNetAdhocctlUserNode * user) char safegroupstr[9]; memset(safegroupstr, 0, sizeof(safegroupstr)); strncpy(safegroupstr, (char *)user->group->group.data, ADHOCCTL_GROUPNAME_LEN); - WARN_LOG(SCENET, "AdhocServer: %s (MAC: %s - IP: %s) attempted to scan for %s groups without disconnecting from %s first", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr, safegroupstr); + WARN_LOG(Log::sceNet, "AdhocServer: %s (MAC: %s - IP: %s) attempted to scan for %s groups without disconnecting from %s first", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr, safegroupstr); } // Delete User @@ -1151,7 +1151,7 @@ void spread_message(SceNetAdhocctlUserNode *user, const char *message) // Send Data int iResult = (int)send(user->stream, (const char*)&packet, sizeof(packet), MSG_NOSIGNAL); - if (iResult < 0) ERROR_LOG(SCENET, "AdhocServer: spread_message[send user chat] (Socket error %d)", errno); + if (iResult < 0) ERROR_LOG(Log::sceNet, "AdhocServer: spread_message[send user chat] (Socket error %d)", errno); } } @@ -1193,7 +1193,7 @@ void spread_message(SceNetAdhocctlUserNode *user, const char *message) // Send Data int iResult = (int)send(peer->stream, (const char*)&packet, sizeof(packet), MSG_NOSIGNAL); - if (iResult < 0) ERROR_LOG(SCENET, "AdhocServer: spread_message[send peer chat] (Socket error %d)", errno); + if (iResult < 0) ERROR_LOG(Log::sceNet, "AdhocServer: spread_message[send peer chat] (Socket error %d)", errno); // Move Pointer peer = peer->group_next; @@ -1212,7 +1212,7 @@ void spread_message(SceNetAdhocctlUserNode *user, const char *message) char safegroupstr[9]; memset(safegroupstr, 0, sizeof(safegroupstr)); strncpy(safegroupstr, (char *)user->group->group.data, ADHOCCTL_GROUPNAME_LEN); - INFO_LOG(SCENET, "AdhocServer: %s (MAC: %s - IP: %s) sent \"%s\" to %d players in %s group %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), message, counter, safegamestr, safegroupstr); + INFO_LOG(Log::sceNet, "AdhocServer: %s (MAC: %s - IP: %s) sent \"%s\" to %d players in %s group %s", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), message, counter, safegamestr, safegroupstr); } // Exit Function @@ -1226,7 +1226,7 @@ void spread_message(SceNetAdhocctlUserNode *user, const char *message) char safegamestr[10]; memset(safegamestr, 0, sizeof(safegamestr)); strncpy(safegamestr, user->game->game.data, PRODUCT_CODE_LENGTH); - WARN_LOG(SCENET, "AdhocServer: %s (MAC: %s - IP: %s) attempted to send a text message without joining a %s group first", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr); + WARN_LOG(Log::sceNet, "AdhocServer: %s (MAC: %s - IP: %s) attempted to send a text message without joining a %s group first", (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str(), safegamestr); } // Delete User @@ -1327,7 +1327,7 @@ void game_product_override(SceNetAdhocctlProductCode * product) strncpy(product->data, crosslink, PRODUCT_CODE_LENGTH); // Log Crosslink - INFO_LOG(SCENET, "Crosslinked %s to %s", productid, crosslink); + INFO_LOG(Log::sceNet, "Crosslinked %s to %s", productid, crosslink); // Set Crosslinked Flag crosslinked = 1; @@ -1348,7 +1348,7 @@ void game_product_override(SceNetAdhocctlProductCode * product) strncpy(product->data, it->id_to, PRODUCT_CODE_LENGTH); // Log Crosslink - INFO_LOG(SCENET, "AdhocServer: Crosslinked %s to %s", productid, crosslink); + INFO_LOG(Log::sceNet, "AdhocServer: Crosslinked %s to %s", productid, crosslink); // Set Crosslinked Flag crosslinked = 1; @@ -1397,7 +1397,7 @@ void game_product_override(SceNetAdhocctlProductCode * product) if(sqlite3_step(statement) == SQLITE_DONE) { // Log Addition - INFO_LOG(SCENET, "Added Unknown Product ID %s to Database", productid); + INFO_LOG(Log::sceNet, "Added Unknown Product ID %s to Database", productid); } } @@ -1409,7 +1409,7 @@ void game_product_override(SceNetAdhocctlProductCode * product) strncpy(unkproduct.name, productid, sizeof(productid)); productids.push_back(unkproduct); //productids[productids.size()] = unkproduct; // Log Addition - INFO_LOG(SCENET, "AdhocServer: Added Unknown Product ID %s to Database", productid); + INFO_LOG(Log::sceNet, "AdhocServer: Added Unknown Product ID %s to Database", productid); } } @@ -1680,7 +1680,7 @@ int proAdhocServerThread(int port) // (int argc, char * argv[]) // Result int result = 0; - INFO_LOG(SCENET, "AdhocServer: Begin of AdhocServer Thread"); + INFO_LOG(Log::sceNet, "AdhocServer: Begin of AdhocServer Thread"); // Create Signal Receiver for CTRL + C //signal(SIGINT, interrupt); @@ -1695,7 +1695,7 @@ int proAdhocServerThread(int port) // (int argc, char * argv[]) if(server != SOCKET_ERROR) { // Notify User - INFO_LOG(SCENET, "AdhocServer: Listening for Connections on TCP Port %u", port); //SERVER_PORT + INFO_LOG(Log::sceNet, "AdhocServer: Listening for Connections on TCP Port %u", port); //SERVER_PORT // Port forward UPnP_Add(IP_PROTOCOL_TCP, port); // g_PortManager.Add(IP_PROTOCOL_TCP, port); @@ -1707,13 +1707,13 @@ int proAdhocServerThread(int port) // (int argc, char * argv[]) UPnP_Remove(IP_PROTOCOL_TCP, port); // g_PortManager.Remove(IP_PROTOCOL_TCP, port); // Notify User - INFO_LOG(SCENET, "AdhocServer: Shutdown complete"); + INFO_LOG(Log::sceNet, "AdhocServer: Shutdown complete"); } //_status = 0; adhocServerRunning = false; - INFO_LOG(SCENET, "AdhocServer: End of AdhocServer Thread"); + INFO_LOG(Log::sceNet, "AdhocServer: End of AdhocServer Thread"); // Return Result return result; @@ -1726,7 +1726,7 @@ int proAdhocServerThread(int port) // (int argc, char * argv[]) void interrupt(int sig) { // Notify User - INFO_LOG(SCENET, "AdhocServer: Shutting down... please wait"); + INFO_LOG(Log::sceNet, "AdhocServer: Shutting down... please wait"); // Trigger Shutdown //_status = 0; @@ -1856,7 +1856,7 @@ int create_listen_socket(uint16_t port) // Notify User else { - ERROR_LOG(SCENET, "AdhocServer: Bind returned %i (Socket error %d)", bindresult, errno); + ERROR_LOG(Log::sceNet, "AdhocServer: Bind returned %i (Socket error %d)", bindresult, errno); auto n = GetI18NCategory(I18NCat::NETWORKING); g_OSD.Show(OSDType::MESSAGE_ERROR, std::string(n->T("AdhocServer Failed to Bind Port")) + " " + std::to_string(port)); } @@ -1866,7 +1866,7 @@ int create_listen_socket(uint16_t port) } // Notify User - else ERROR_LOG(SCENET, "AdhocServer: Socket returned %i (Socket error %d)", fd, errno); + else ERROR_LOG(Log::sceNet, "AdhocServer: Socket returned %i (Socket error %d)", fd, errno); // Return Error return -1; @@ -1923,7 +1923,7 @@ int server_loop(int server) u8 *pip = (u8*)&sip; if (gethostbyname(str)->h_addrtype == AF_INET && gethostbyname(str)->h_addr_list[0] != NULL) pip = (u8*)gethostbyname(str)->h_addr_list[0]; sip = *(u32_le*)pip; - WARN_LOG(SCENET, "AdhocServer: Replacing IP %s with %s", inet_ntoa(addr.sin_addr), inet_ntoa(*(in_addr*)&pip)); + WARN_LOG(Log::sceNet, "AdhocServer: Replacing IP %s with %s", inet_ntoa(addr.sin_addr), inet_ntoa(*(in_addr*)&pip)); } */ login_user_stream(loginresult, sip); @@ -1985,7 +1985,7 @@ int server_loop(int server) else { // Notify User - WARN_LOG(SCENET, "AdhocServer: Invalid Opcode 0x%02X in Waiting State from %s", user->rx[0], ip2str(*(in_addr*)&user->resolver.ip).c_str()); + WARN_LOG(Log::sceNet, "AdhocServer: Invalid Opcode 0x%02X in Waiting State from %s", user->rx[0], ip2str(*(in_addr*)&user->resolver.ip).c_str()); // Logout User logout_user(user); @@ -2068,7 +2068,7 @@ int server_loop(int server) else { // Notify User - WARN_LOG(SCENET, "AdhocServer: Invalid Opcode 0x%02X in Logged-In State from %s (MAC: %s - IP: %s)", user->rx[0], (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str()); + WARN_LOG(Log::sceNet, "AdhocServer: Invalid Opcode 0x%02X in Logged-In State from %s (MAC: %s - IP: %s)", user->rx[0], (char *)user->resolver.name.data, mac2str(&user->resolver.mac).c_str(), ip2str(*(in_addr*)&user->resolver.ip).c_str()); // Logout User logout_user(user); diff --git a/Core/HLE/sceAdler.cpp b/Core/HLE/sceAdler.cpp index 59e2570467..fe74d313cf 100644 --- a/Core/HLE/sceAdler.cpp +++ b/Core/HLE/sceAdler.cpp @@ -28,10 +28,10 @@ static u32 sceAdler32(u32 adler, u32 data, u32 datalen) { if (!Memory::IsValidAddress(data) || !Memory::IsValidAddress(data + datalen - 1)) { - ERROR_LOG(SCEMISC, "sceAdler32(adler=%08x, data=%08x, datalen=%08x) - bad address(es)", adler, data, datalen); + ERROR_LOG(Log::sceMisc, "sceAdler32(adler=%08x, data=%08x, datalen=%08x) - bad address(es)", adler, data, datalen); return -1; } - INFO_LOG(SCEMISC, "sceAdler32(adler=%08x, data=%08x, datalen=%08x)", adler, data, datalen); + INFO_LOG(Log::sceMisc, "sceAdler32(adler=%08x, data=%08x, datalen=%08x)", adler, data, datalen); u8 *buf = Memory::GetPointerWriteUnchecked(data); u32 ret = adler32(adler, buf, datalen); diff --git a/Core/HLE/sceAtrac.cpp b/Core/HLE/sceAtrac.cpp index cf53775b07..dc5652acd1 100644 --- a/Core/HLE/sceAtrac.cpp +++ b/Core/HLE/sceAtrac.cpp @@ -107,7 +107,7 @@ void __AtracShutdown() { void __AtracLoadModule(int version, u32 crc) { atracLibVersion = version; atracLibCrc = crc; - INFO_LOG(ME, "AtracInit, atracLibVersion 0x%0x, atracLibcrc %x", atracLibVersion, atracLibCrc); + INFO_LOG(Log::ME, "AtracInit, atracLibVersion 0x%0x, atracLibcrc %x", atracLibVersion, atracLibCrc); } void __AtracDoState(PointerWrap &p) { @@ -182,7 +182,7 @@ static int deleteAtrac(int atracID) { // Useful to initialize a context for low level decode. static u32 sceAtracGetAtracID(int codecType) { if (codecType != PSP_MODE_AT_3 && codecType != PSP_MODE_AT_3_PLUS) { - return hleReportError(ME, ATRAC_ERROR_INVALID_CODECTYPE, "invalid codecType"); + return hleReportError(Log::ME, ATRAC_ERROR_INVALID_CODECTYPE, "invalid codecType"); } AtracBase *atrac = allocAtrac(); @@ -190,17 +190,17 @@ static u32 sceAtracGetAtracID(int codecType) { int atracID = createAtrac(atrac); if (atracID < 0) { delete atrac; - return hleLogError(ME, atracID, "no free ID"); + return hleLogError(Log::ME, atracID, "no free ID"); } - return hleLogSuccessInfoI(ME, atracID); + return hleLogSuccessInfoI(Log::ME, atracID); } static u32 AtracValidateData(const AtracBase *atrac) { if (!atrac) { - return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); } else if (atrac->BufferState() == ATRAC_STATUS_NO_DATA) { - return hleLogError(ME, ATRAC_ERROR_NO_DATA, "no data"); + return hleLogError(Log::ME, ATRAC_ERROR_NO_DATA, "no data"); } else { return 0; } @@ -208,13 +208,13 @@ static u32 AtracValidateData(const AtracBase *atrac) { static u32 AtracValidateManaged(const AtracBase *atrac) { if (!atrac) { - return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); } else if (atrac->BufferState() == ATRAC_STATUS_NO_DATA) { - return hleLogError(ME, ATRAC_ERROR_NO_DATA, "no data"); + return hleLogError(Log::ME, ATRAC_ERROR_NO_DATA, "no data"); } else if (atrac->BufferState() == ATRAC_STATUS_LOW_LEVEL) { - return hleLogError(ME, ATRAC_ERROR_IS_LOW_LEVEL, "low level stream, can't use"); + return hleLogError(Log::ME, ATRAC_ERROR_IS_LOW_LEVEL, "low level stream, can't use"); } else if (atrac->BufferState() == ATRAC_STATUS_FOR_SCESAS) { - return hleLogError(ME, ATRAC_ERROR_IS_FOR_SCESAS, "SAS stream, can't use"); + return hleLogError(Log::ME, ATRAC_ERROR_IS_FOR_SCESAS, "SAS stream, can't use"); } else { return 0; } @@ -235,15 +235,15 @@ static u32 sceAtracAddStreamData(int atracID, u32 bytesToAdd) { if (atrac->BufferState() == ATRAC_STATUS_ALL_DATA_LOADED) { // Let's avoid spurious warnings. Some games call this with 0 which is pretty harmless. if (bytesToAdd == 0) - return hleLogDebug(ME, ATRAC_ERROR_ALL_DATA_LOADED, "stream entirely loaded"); - return hleLogWarning(ME, ATRAC_ERROR_ALL_DATA_LOADED, "stream entirely loaded"); + return hleLogDebug(Log::ME, ATRAC_ERROR_ALL_DATA_LOADED, "stream entirely loaded"); + return hleLogWarning(Log::ME, ATRAC_ERROR_ALL_DATA_LOADED, "stream entirely loaded"); } int ret = atrac->AddStreamData(bytesToAdd); if (ret < 0) { return ret; } - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } // Note that outAddr being null is completely valid here, used to skip data. @@ -268,7 +268,7 @@ static u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 if (ret == 0 && Memory::IsValidAddress(remainAddr)) Memory::WriteUnchecked_U32(remains, remainAddr); } - DEBUG_LOG(ME, "%08x=sceAtracDecodeData(%i, %08x, %08x[%08x], %08x[%08x], %08x[%d])", ret, atracID, outAddr, + DEBUG_LOG(Log::ME, "%08x=sceAtracDecodeData(%i, %08x, %08x[%08x], %08x[%08x], %08x[%d])", ret, atracID, outAddr, numSamplesAddr, numSamples, finishFlagAddr, finish, remainAddr, remains); @@ -280,7 +280,7 @@ static u32 sceAtracDecodeData(int atracID, u32 outAddr, u32 numSamplesAddr, u32 } static u32 sceAtracEndEntry() { - ERROR_LOG_REPORT(ME, "UNIMPL sceAtracEndEntry()"); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceAtracEndEntry()"); return 0; } @@ -297,15 +297,15 @@ static u32 sceAtracGetBufferInfoForResetting(int atracID, int sample, u32 buffer } if (!bufferInfo.IsValid()) { - return hleReportError(ME, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid buffer, should crash"); + return hleReportError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid buffer, should crash"); } else if (atrac->BufferState() == ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER && atrac->SecondBufferSize() == 0) { - return hleReportError(ME, ATRAC_ERROR_SECOND_BUFFER_NEEDED, "no second buffer"); + return hleReportError(Log::ME, ATRAC_ERROR_SECOND_BUFFER_NEEDED, "no second buffer"); } else if ((u32)sample + atrac->GetTrack().firstSampleOffset > (u32)atrac->GetTrack().endSample + atrac->GetTrack().firstSampleOffset) { // NOTE: Above we have to add firstSampleOffset to both sides - we seem to rely on wraparound. - return hleLogWarning(ME, ATRAC_ERROR_BAD_SAMPLE, "invalid sample position"); + return hleLogWarning(Log::ME, ATRAC_ERROR_BAD_SAMPLE, "invalid sample position"); } else { atrac->GetResetBufferInfo(bufferInfo, sample); - return hleLogSuccessInfoI(ME, 0); + return hleLogSuccessInfoI(Log::ME, 0); } } @@ -321,9 +321,9 @@ static u32 sceAtracGetBitrate(int atracID, u32 outBitrateAddr) { if (Memory::IsValidAddress(outBitrateAddr)) { Memory::WriteUnchecked_U32(atrac->GetTrack().bitrate, outBitrateAddr); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } else { - return hleLogError(ME, 0, "invalid address"); + return hleLogError(Log::ME, 0, "invalid address"); } } @@ -337,9 +337,9 @@ static u32 sceAtracGetChannel(int atracID, u32 channelAddr) { if (Memory::IsValidAddress(channelAddr)){ Memory::WriteUnchecked_U32(atrac->GetTrack().channels, channelAddr); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } else { - return hleLogError(ME, 0, "invalid address"); + return hleLogError(Log::ME, 0, "invalid address"); } } @@ -359,9 +359,9 @@ static u32 sceAtracGetLoopStatus(int atracID, u32 loopNumAddr, u32 statusAddr) { Memory::WriteUnchecked_U32(1, statusAddr); else Memory::WriteUnchecked_U32(0, statusAddr); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } else { - return hleLogError(ME, 0, "invalid address"); + return hleLogError(Log::ME, 0, "invalid address"); } } @@ -372,7 +372,7 @@ static u32 sceAtracGetInternalErrorInfo(int atracID, u32 errorAddr) { // Already logged. return err; } - ERROR_LOG(ME, "UNIMPL sceAtracGetInternalErrorInfo(%i, %08x)", atracID, errorAddr); + ERROR_LOG(Log::ME, "UNIMPL sceAtracGetInternalErrorInfo(%i, %08x)", atracID, errorAddr); if (Memory::IsValidAddress(errorAddr)) Memory::WriteUnchecked_U32(0, errorAddr); return 0; @@ -388,9 +388,9 @@ static u32 sceAtracGetMaxSample(int atracID, u32 maxSamplesAddr) { if (Memory::IsValidAddress(maxSamplesAddr)) { Memory::WriteUnchecked_U32(atrac->GetTrack().SamplesPerFrame(), maxSamplesAddr); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } else { - return hleLogError(ME, 0, "invalid address"); + return hleLogError(Log::ME, 0, "invalid address"); } } @@ -405,13 +405,13 @@ static u32 sceAtracGetNextDecodePosition(int atracID, u32 outposAddr) { if (Memory::IsValidAddress(outposAddr)) { if (atrac->CurrentSample() >= atrac->GetTrack().endSample) { Memory::WriteUnchecked_U32(0, outposAddr); - return hleLogSuccessI(ME, ATRAC_ERROR_ALL_DATA_DECODED, "all data decoded - beyond endSample"); + return hleLogSuccessI(Log::ME, ATRAC_ERROR_ALL_DATA_DECODED, "all data decoded - beyond endSample"); } else { Memory::WriteUnchecked_U32(atrac->CurrentSample(), outposAddr); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } } else { - return hleLogError(ME, 0, "invalid address"); + return hleLogError(Log::ME, 0, "invalid address"); } } @@ -425,14 +425,14 @@ static u32 sceAtracGetNextSample(int atracID, u32 outNAddr) { if (atrac->CurrentSample() >= atrac->GetTrack().endSample) { if (Memory::IsValidAddress(outNAddr)) Memory::WriteUnchecked_U32(0, outNAddr); - return hleLogSuccessI(ME, 0, "0 samples left"); + return hleLogSuccessI(Log::ME, 0, "0 samples left"); } u32 numSamples = atrac->GetNextSamples(); if (Memory::IsValidAddress(outNAddr)) Memory::WriteUnchecked_U32(numSamples, outNAddr); - return hleLogSuccessI(ME, 0, "%d samples left", numSamples); + return hleLogSuccessI(Log::ME, 0, "%d samples left", numSamples); } // Obtains the number of frames remaining in the buffer which can be decoded. @@ -449,11 +449,11 @@ static u32 sceAtracGetRemainFrame(int atracID, u32 remainAddr) { if (!remainingFrames.IsValid()) { // Would crash. - return hleReportError(ME, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid remainingFrames pointer"); + return hleReportError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid remainingFrames pointer"); } *remainingFrames = atrac->RemainingFrames(); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static u32 sceAtracGetSecondBufferInfo(int atracID, u32 fileOffsetAddr, u32 desiredSizeAddr) { @@ -469,7 +469,7 @@ static u32 sceAtracGetSecondBufferInfo(int atracID, u32 fileOffsetAddr, u32 desi if (!fileOffset.IsValid() || !desiredSize.IsValid()) { // Would crash. - return hleReportError(ME, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid addresses"); + return hleReportError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid addresses"); } return atrac->GetSecondBufferInfo(fileOffset, desiredSize); @@ -494,9 +494,9 @@ static u32 sceAtracGetSoundSample(int atracID, u32 outEndSampleAddr, u32 outLoop *outLoopEnd = atrac->GetTrack().loopEndSample == -1 ? -1 : atrac->GetTrack().loopEndSample - atrac->GetTrack().FirstSampleOffsetFull(); if (!outEndSample.IsValid() || !outLoopStart.IsValid() || !outLoopEnd.IsValid()) { - return hleReportError(ME, 0, "invalid address"); + return hleReportError(Log::ME, 0, "invalid address"); } - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } // Games call this function to get some info for add more stream data, @@ -522,15 +522,15 @@ static u32 sceAtracGetStreamDataInfo(int atracID, u32 writePtrAddr, u32 writable if (Memory::IsValidAddress(readOffsetAddr)) Memory::WriteUnchecked_U32(readOffset, readOffsetAddr); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static u32 sceAtracReleaseAtracID(int atracID) { int result = deleteAtrac(atracID); if (result < 0) { - return hleLogError(ME, result, "did not exist"); + return hleLogError(Log::ME, result, "did not exist"); } - return hleLogSuccessInfoI(ME, result); + return hleLogSuccessInfoI(Log::ME, result); } // This is called when a game wants to seek (or "reset") to a specific position in the audio data. @@ -545,10 +545,10 @@ static u32 sceAtracResetPlayPosition(int atracID, int sample, int bytesWrittenFi } if (atrac->BufferState() == ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER && atrac->SecondBufferSize() == 0) { - return hleReportError(ME, ATRAC_ERROR_SECOND_BUFFER_NEEDED, "no second buffer"); + return hleReportError(Log::ME, ATRAC_ERROR_SECOND_BUFFER_NEEDED, "no second buffer"); } else if ((u32)sample + atrac->GetTrack().firstSampleOffset > (u32)atrac->GetTrack().endSample + atrac->GetTrack().firstSampleOffset) { // NOTE: Above we have to add firstSampleOffset to both sides - we seem to rely on wraparound. - return hleLogWarning(ME, ATRAC_ERROR_BAD_SAMPLE, "invalid sample position"); + return hleLogWarning(Log::ME, ATRAC_ERROR_BAD_SAMPLE, "invalid sample position"); } u32 res = atrac->ResetPlayPosition(sample, bytesWrittenFirstBuf, bytesWrittenSecondBuf); @@ -557,14 +557,14 @@ static u32 sceAtracResetPlayPosition(int atracID, int sample, int bytesWrittenFi return res; } - return hleDelayResult(hleLogSuccessInfoI(ME, 0), "reset play pos", 3000); + return hleDelayResult(hleLogSuccessInfoI(Log::ME, 0), "reset play pos", 3000); } static int _AtracSetData(int atracID, u32 buffer, u32 readSize, u32 bufferSize, int outputChannels, bool needReturnAtracID) { AtracBase *atrac = getAtrac(atracID); // Don't use AtracValidateManaged here. if (!atrac) - return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "invalid atrac ID"); + return hleLogError(Log::ME, ATRAC_ERROR_BAD_ATRACID, "invalid atrac ID"); int ret = atrac->SetData(buffer, readSize, bufferSize, outputChannels, needReturnAtracID ? atracID : 0); // not sure the real delay time return hleDelayResult(ret, "atrac set data", 100); @@ -574,11 +574,11 @@ static u32 sceAtracSetHalfwayBuffer(int atracID, u32 buffer, u32 readSize, u32 b AtracBase *atrac = getAtrac(atracID); // Don't use AtracValidateManaged here. if (!atrac) { - return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "invalid atrac ID"); + return hleLogError(Log::ME, ATRAC_ERROR_BAD_ATRACID, "invalid atrac ID"); } if (readSize > bufferSize) { - return hleLogError(ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); + return hleLogError(Log::ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); } int ret = atrac->Analyze(buffer, readSize); @@ -604,7 +604,7 @@ static u32 sceAtracSetSecondBuffer(int atracID, u32 secondBuffer, u32 secondBuff static u32 sceAtracSetData(int atracID, u32 buffer, u32 bufferSize) { AtracBase *atrac = getAtrac(atracID); if (!atrac) { - return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); } int ret = atrac->Analyze(buffer, bufferSize); @@ -615,7 +615,7 @@ static u32 sceAtracSetData(int atracID, u32 buffer, u32 bufferSize) { if (atrac->GetTrack().codecType != atracContextTypes[atracID]) { // TODO: Should this not change the buffer size? - return hleReportError(ME, ATRAC_ERROR_WRONG_CODECTYPE, "atracID uses different codec type than data"); + return hleReportError(Log::ME, ATRAC_ERROR_WRONG_CODECTYPE, "atracID uses different codec type than data"); } return _AtracSetData(atracID, buffer, bufferSize, bufferSize, 2, false); @@ -625,7 +625,7 @@ static int sceAtracSetDataAndGetID(u32 buffer, int bufferSize) { // A large value happens in Tales of VS, and isn't handled somewhere properly as a u32. // It's impossible for it to be that big anyway, so cap it. if (bufferSize < 0) { - WARN_LOG(ME, "sceAtracSetDataAndGetID(%08x, %08x): negative bufferSize", buffer, bufferSize); + WARN_LOG(Log::ME, "sceAtracSetDataAndGetID(%08x, %08x): negative bufferSize", buffer, bufferSize); bufferSize = 0x10000000; } @@ -639,7 +639,7 @@ static int sceAtracSetDataAndGetID(u32 buffer, int bufferSize) { int atracID = createAtrac(atrac); if (atracID < 0) { delete atrac; - return hleLogError(ME, atracID, "no free ID"); + return hleLogError(Log::ME, atracID, "no free ID"); } return _AtracSetData(atracID, buffer, bufferSize, bufferSize, 2, true); @@ -647,7 +647,7 @@ static int sceAtracSetDataAndGetID(u32 buffer, int bufferSize) { static int sceAtracSetHalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 bufferSize) { if (readSize > bufferSize) { - return hleLogError(ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); + return hleLogError(Log::ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); } AtracBase *atrac = allocAtrac(); int ret = atrac->Analyze(buffer, readSize); @@ -659,13 +659,13 @@ static int sceAtracSetHalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 buffer int atracID = createAtrac(atrac); if (atracID < 0) { delete atrac; - return hleLogError(ME, atracID, "no free ID"); + return hleLogError(Log::ME, atracID, "no free ID"); } return _AtracSetData(atracID, buffer, readSize, bufferSize, 2, true); } static u32 sceAtracStartEntry() { - ERROR_LOG_REPORT(ME, "UNIMPL sceAtracStartEntry()"); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceAtracStartEntry()"); return 0; } @@ -677,17 +677,17 @@ static u32 sceAtracSetLoopNum(int atracID, int loopNum) { return err; } if (atrac->GetTrack().loopinfo.size() == 0) { - return hleLogError(ME, ATRAC_ERROR_NO_LOOP_INFORMATION, "no loop information"); + return hleLogError(Log::ME, ATRAC_ERROR_NO_LOOP_INFORMATION, "no loop information"); } atrac->SetLoopNum(loopNum); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static int sceAtracReinit(int at3Count, int at3plusCount) { for (int i = 0; i < PSP_NUM_ATRAC_IDS; ++i) { if (atracContexts[i] != nullptr) { - ERROR_LOG_REPORT(ME, "sceAtracReinit(%d, %d): cannot reinit while IDs in use", at3Count, at3plusCount); + ERROR_LOG_REPORT(Log::ME, "sceAtracReinit(%d, %d): cannot reinit while IDs in use", at3Count, at3plusCount); return SCE_KERNEL_ERROR_BUSY; } } @@ -698,7 +698,7 @@ static int sceAtracReinit(int at3Count, int at3plusCount) { // This seems to deinit things. Mostly, it cause a reschedule on next deinit (but -1, -1 does not.) if (at3Count == 0 && at3plusCount == 0) { - INFO_LOG(ME, "sceAtracReinit(%d, %d): deinit", at3Count, at3plusCount); + INFO_LOG(Log::ME, "sceAtracReinit(%d, %d): deinit", at3Count, at3plusCount); atracInited = false; return hleDelayResult(0, "atrac reinit", 200); } @@ -722,10 +722,10 @@ static int sceAtracReinit(int at3Count, int at3plusCount) { int result = space >= 0 ? 0 : (int)SCE_KERNEL_ERROR_OUT_OF_MEMORY; if (atracInited || next == 0) { atracInited = true; - return hleLogSuccessInfoI(ME, result); + return hleLogSuccessInfoI(Log::ME, result); } else { atracInited = true; - return hleDelayResult(hleLogSuccessInfoI(ME, result), "atrac reinit", 400); + return hleDelayResult(hleLogSuccessInfoI(Log::ME, result), "atrac reinit", 400); } } @@ -738,9 +738,9 @@ static int sceAtracGetOutputChannel(int atracID, u32 outputChanPtr) { } if (Memory::IsValidAddress(outputChanPtr)) { Memory::WriteUnchecked_U32(atrac->GetOutputChannels(), outputChanPtr); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } else { - return hleLogError(ME, 0, "invalid address"); + return hleLogError(Log::ME, 0, "invalid address"); } } @@ -754,17 +754,17 @@ static int sceAtracIsSecondBufferNeeded(int atracID) { // Note that this returns true whether the buffer is already set or not. int needed = atrac->BufferState() == ATRAC_STATUS_STREAMED_LOOP_WITH_TRAILER ? 1 : 0; - return hleLogSuccessI(ME, needed); + return hleLogSuccessI(Log::ME, needed); } static int sceAtracSetMOutHalfwayBuffer(int atracID, u32 buffer, u32 readSize, u32 bufferSize) { AtracBase *atrac = getAtrac(atracID); // Don't use AtracValidate* here. if (!atrac) { - return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); } if (readSize > bufferSize) { - return hleLogError(ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); + return hleLogError(Log::ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); } int ret = atrac->Analyze(buffer, readSize); @@ -775,7 +775,7 @@ static int sceAtracSetMOutHalfwayBuffer(int atracID, u32 buffer, u32 readSize, u if (atrac->GetTrack().channels != 1) { // It seems it still sets the data. atrac->SetData(buffer, readSize, bufferSize, 2, 0); - return hleReportError(ME, ATRAC_ERROR_NOT_MONO, "not mono data"); + return hleReportError(Log::ME, ATRAC_ERROR_NOT_MONO, "not mono data"); } else { return _AtracSetData(atracID, buffer, readSize, bufferSize, 1, false); } @@ -786,7 +786,7 @@ static u32 sceAtracSetMOutData(int atracID, u32 buffer, u32 bufferSize) { AtracBase *atrac = getAtrac(atracID); // Don't use AtracValidate* here. if (!atrac) { - return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); } int ret = atrac->Analyze(buffer, bufferSize); @@ -797,7 +797,7 @@ static u32 sceAtracSetMOutData(int atracID, u32 buffer, u32 bufferSize) { if (atrac->GetTrack().channels != 1) { // It seems it still sets the data. atrac->SetData(buffer, bufferSize, bufferSize, 2, 0); - return hleReportError(ME, ATRAC_ERROR_NOT_MONO, "not mono data"); + return hleReportError(Log::ME, ATRAC_ERROR_NOT_MONO, "not mono data"); } else { return _AtracSetData(atracID, buffer, bufferSize, bufferSize, 1, false); } @@ -814,12 +814,12 @@ static int sceAtracSetMOutDataAndGetID(u32 buffer, u32 bufferSize) { } if (atrac->GetTrack().channels != 1) { delete atrac; - return hleReportError(ME, ATRAC_ERROR_NOT_MONO, "not mono data"); + return hleReportError(Log::ME, ATRAC_ERROR_NOT_MONO, "not mono data"); } int atracID = createAtrac(atrac); if (atracID < 0) { delete atrac; - return hleLogError(ME, atracID, "no free ID"); + return hleLogError(Log::ME, atracID, "no free ID"); } return _AtracSetData(atracID, buffer, bufferSize, bufferSize, 1, true); @@ -827,7 +827,7 @@ static int sceAtracSetMOutDataAndGetID(u32 buffer, u32 bufferSize) { static int sceAtracSetMOutHalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 bufferSize) { if (readSize > bufferSize) { - return hleLogError(ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); + return hleLogError(Log::ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); } AtracBase *atrac = allocAtrac(); int ret = atrac->Analyze(buffer, readSize); @@ -838,12 +838,12 @@ static int sceAtracSetMOutHalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 bu } if (atrac->GetTrack().channels != 1) { delete atrac; - return hleReportError(ME, ATRAC_ERROR_NOT_MONO, "not mono data"); + return hleReportError(Log::ME, ATRAC_ERROR_NOT_MONO, "not mono data"); } int atracID = createAtrac(atrac); if (atracID < 0) { delete atrac; - return hleLogError(ME, atracID, "no free ID"); + return hleLogError(Log::ME, atracID, "no free ID"); } return _AtracSetData(atracID, buffer, readSize, bufferSize, 1, true); @@ -860,7 +860,7 @@ static int sceAtracSetAA3DataAndGetID(u32 buffer, u32 bufferSize, u32 fileSize, int atracID = createAtrac(atrac); if (atracID < 0) { delete atrac; - return hleLogError(ME, atracID, "no free ID"); + return hleLogError(Log::ME, atracID, "no free ID"); } return _AtracSetData(atracID, buffer, bufferSize, bufferSize, 2, true); @@ -869,7 +869,7 @@ static int sceAtracSetAA3DataAndGetID(u32 buffer, u32 bufferSize, u32 fileSize, static u32 _sceAtracGetContextAddress(int atracID) { AtracBase *atrac = getAtrac(atracID); if (!atrac) { - ERROR_LOG(ME, "_sceAtracGetContextAddress(%i): bad atrac id", atracID); + ERROR_LOG(Log::ME, "_sceAtracGetContextAddress(%i): bad atrac id", atracID); return 0; } if (!atrac->context_.IsValid()) { @@ -879,10 +879,10 @@ static u32 _sceAtracGetContextAddress(int atracID) { atrac->context_ = kernelMemory.Alloc(contextSize, false, StringFromFormat("AtracCtx/%d", atracID).c_str()); if (atrac->context_.IsValid()) Memory::Memset(atrac->context_.ptr, 0, contextSize, "AtracContextClear"); - WARN_LOG(ME, "%08x=_sceAtracGetContextAddress(%i): allocated new context", atrac->context_.ptr, atracID); + WARN_LOG(Log::ME, "%08x=_sceAtracGetContextAddress(%i): allocated new context", atrac->context_.ptr, atracID); } else - WARN_LOG(ME, "%08x=_sceAtracGetContextAddress(%i)", atrac->context_.ptr, atracID); + WARN_LOG(Log::ME, "%08x=_sceAtracGetContextAddress(%i)", atrac->context_.ptr, atracID); atrac->WriteContextToPSPMem(); return atrac->context_.ptr; } @@ -910,12 +910,12 @@ static const At3HeaderMap at3HeaderMap[] = { static int sceAtracLowLevelInitDecoder(int atracID, u32 paramsAddr) { AtracBase *atrac = getAtrac(atracID); if (!atrac) { - return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); } if (!Memory::IsValidAddress(paramsAddr)) { // TODO: Returning zero as code was before. Needs testing. - return hleReportError(ME, 0, "invalid pointers"); + return hleReportError(Log::ME, 0, "invalid pointers"); } bool jointStereo = false; @@ -929,7 +929,7 @@ static int sceAtracLowLevelInitDecoder(int atracID, u32 paramsAddr) { } } if (!found) { - ERROR_LOG_REPORT(ME, "AT3 header map lacks entry for bpf: %i channels: %i", atrac->GetTrack().BytesPerFrame(), atrac->GetTrack().channels); + ERROR_LOG_REPORT(Log::ME, "AT3 header map lacks entry for bpf: %i channels: %i", atrac->GetTrack().BytesPerFrame(), atrac->GetTrack().channels); // TODO: Should we return an error code for these values? } } @@ -938,7 +938,7 @@ static int sceAtracLowLevelInitDecoder(int atracID, u32 paramsAddr) { const char *codecName = atrac->GetTrack().codecType == PSP_MODE_AT_3 ? "atrac3" : "atrac3+"; const char *channelName = atrac->GetTrack().channels == 1 ? "mono" : "stereo"; - return hleLogSuccessInfoI(ME, 0, "%s %s audio", codecName, channelName); + return hleLogSuccessInfoI(Log::ME, 0, "%s %s audio", codecName, channelName); } static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesConsumedAddr, u32 samplesAddr, u32 sampleBytesAddr) { @@ -949,12 +949,12 @@ static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesCo AtracBase *atrac = getAtrac(atracID); if (!atrac) { - return hleLogError(ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); + return hleLogError(Log::ME, ATRAC_ERROR_BAD_ATRACID, "bad atrac ID"); } if (!srcp.IsValid() || !srcConsumed.IsValid() || !outp.IsValid() || !outWritten.IsValid()) { // TODO: Returning zero as code was before. Needs testing. - return hleReportError(ME, 0, "invalid pointers"); + return hleReportError(Log::ME, 0, "invalid pointers"); } int bytesConsumed = 0; @@ -966,12 +966,12 @@ static int sceAtracLowLevelDecode(int atracID, u32 sourceAddr, u32 sourceBytesCo *outWritten = bytesWritten; NotifyMemInfo(MemBlockFlags::WRITE, samplesAddr, bytesWritten, "AtracLowLevelDecode"); - return hleLogDebug(ME, hleDelayResult(0, "low level atrac decode data", atracDecodeDelay)); + return hleLogDebug(Log::ME, hleDelayResult(0, "low level atrac decode data", atracDecodeDelay)); } static int sceAtracSetAA3HalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 bufferSize, u32 fileSize) { if (readSize > bufferSize) { - return hleLogError(ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); + return hleLogError(Log::ME, ATRAC_ERROR_INCORRECT_READ_SIZE, "read size too large"); } AtracBase *atrac = allocAtrac(); @@ -984,7 +984,7 @@ static int sceAtracSetAA3HalfwayBufferAndGetID(u32 buffer, u32 readSize, u32 buf int atracID = createAtrac(atrac); if (atracID < 0) { delete atrac; - return hleLogError(ME, atracID, "no free ID"); + return hleLogError(Log::ME, atracID, "no free ID"); } return _AtracSetData(atracID, buffer, readSize, bufferSize, 2, true); diff --git a/Core/HLE/sceAudio.cpp b/Core/HLE/sceAudio.cpp index 42504d4e28..cacdb9e315 100644 --- a/Core/HLE/sceAudio.cpp +++ b/Core/HLE/sceAudio.cpp @@ -86,16 +86,16 @@ void AudioChannel::clear() // max or 50%? static u32 sceAudioOutputBlocking(u32 chan, int vol, u32 samplePtr) { if (vol > 0xFFFF) { - ERROR_LOG(SCEAUDIO, "sceAudioOutputBlocking() - invalid volume"); + ERROR_LOG(Log::sceAudio, "sceAudioOutputBlocking() - invalid volume"); return SCE_ERROR_AUDIO_INVALID_VOLUME; } else if (chan >= PSP_AUDIO_CHANNEL_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioOutputBlocking() - bad channel"); + ERROR_LOG(Log::sceAudio, "sceAudioOutputBlocking() - bad channel"); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } else if (!chans[chan].reserved) { - ERROR_LOG(SCEAUDIO, "sceAudioOutputBlocking() - channel not reserved"); + ERROR_LOG(Log::sceAudio, "sceAudioOutputBlocking() - channel not reserved"); return SCE_ERROR_AUDIO_CHANNEL_NOT_INIT; } else { - DEBUG_LOG(SCEAUDIO, "sceAudioOutputBlocking(%08x, %08x, %08x)", chan, vol, samplePtr); + DEBUG_LOG(Log::sceAudio, "sceAudioOutputBlocking(%08x, %08x, %08x)", chan, vol, samplePtr); if (vol >= 0) { chans[chan].leftVolume = vol; chans[chan].rightVolume = vol; @@ -109,13 +109,13 @@ static u32 sceAudioOutputPannedBlocking(u32 chan, int leftvol, int rightvol, u32 int result = 0; // For some reason, this is the only one that checks for negative. if (leftvol > 0xFFFF || rightvol > 0xFFFF || leftvol < 0 || rightvol < 0) { - ERROR_LOG(SCEAUDIO, "sceAudioOutputPannedBlocking() - invalid volume"); + ERROR_LOG(Log::sceAudio, "sceAudioOutputPannedBlocking() - invalid volume"); result = SCE_ERROR_AUDIO_INVALID_VOLUME; } else if (chan >= PSP_AUDIO_CHANNEL_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioOutputPannedBlocking() - bad channel"); + ERROR_LOG(Log::sceAudio, "sceAudioOutputPannedBlocking() - bad channel"); result = SCE_ERROR_AUDIO_INVALID_CHANNEL; } else if (!chans[chan].reserved) { - ERROR_LOG(SCEAUDIO, "sceAudioOutputPannedBlocking() - channel not reserved"); + ERROR_LOG(Log::sceAudio, "sceAudioOutputPannedBlocking() - channel not reserved"); result = SCE_ERROR_AUDIO_CHANNEL_NOT_INIT; } else { if (leftvol >= 0) { @@ -128,23 +128,23 @@ static u32 sceAudioOutputPannedBlocking(u32 chan, int leftvol, int rightvol, u32 result = __AudioEnqueue(chans[chan], chan, true); } - DEBUG_LOG(SCEAUDIO, "%08x = sceAudioOutputPannedBlocking(%08x, %08x, %08x, %08x)", result, chan, leftvol, rightvol, samplePtr); + DEBUG_LOG(Log::sceAudio, "%08x = sceAudioOutputPannedBlocking(%08x, %08x, %08x, %08x)", result, chan, leftvol, rightvol, samplePtr); return result; } static u32 sceAudioOutput(u32 chan, int vol, u32 samplePtr) { if (vol > 0xFFFF) { - ERROR_LOG(SCEAUDIO, "sceAudioOutput() - invalid volume"); + ERROR_LOG(Log::sceAudio, "sceAudioOutput() - invalid volume"); return SCE_ERROR_AUDIO_INVALID_VOLUME; } else if (chan >= PSP_AUDIO_CHANNEL_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioOutput() - bad channel"); + ERROR_LOG(Log::sceAudio, "sceAudioOutput() - bad channel"); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } else if (!chans[chan].reserved) { - ERROR_LOG(SCEAUDIO, "sceAudioOutput(%08x, %08x, %08x) - channel not reserved", chan, vol, samplePtr); + ERROR_LOG(Log::sceAudio, "sceAudioOutput(%08x, %08x, %08x) - channel not reserved", chan, vol, samplePtr); return SCE_ERROR_AUDIO_CHANNEL_NOT_INIT; } else { - DEBUG_LOG(SCEAUDIO, "sceAudioOutput(%08x, %08x, %08x)", chan, vol, samplePtr); + DEBUG_LOG(Log::sceAudio, "sceAudioOutput(%08x, %08x, %08x)", chan, vol, samplePtr); if (vol >= 0) { chans[chan].leftVolume = vol; chans[chan].rightVolume = vol; @@ -156,16 +156,16 @@ static u32 sceAudioOutput(u32 chan, int vol, u32 samplePtr) { static u32 sceAudioOutputPanned(u32 chan, int leftvol, int rightvol, u32 samplePtr) { if (leftvol > 0xFFFF || rightvol > 0xFFFF) { - ERROR_LOG(SCEAUDIO, "sceAudioOutputPanned() - invalid volume"); + ERROR_LOG(Log::sceAudio, "sceAudioOutputPanned() - invalid volume"); return SCE_ERROR_AUDIO_INVALID_VOLUME; } else if (chan >= PSP_AUDIO_CHANNEL_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioOutputPanned() - bad channel"); + ERROR_LOG(Log::sceAudio, "sceAudioOutputPanned() - bad channel"); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } else if (!chans[chan].reserved) { - ERROR_LOG(SCEAUDIO, "sceAudioOutputPanned(%08x, %08x, %08x, %08x) - channel not reserved", chan, leftvol, rightvol, samplePtr); + ERROR_LOG(Log::sceAudio, "sceAudioOutputPanned(%08x, %08x, %08x, %08x) - channel not reserved", chan, leftvol, rightvol, samplePtr); return SCE_ERROR_AUDIO_CHANNEL_NOT_INIT; } else { - DEBUG_LOG(SCEAUDIO, "sceAudioOutputPanned(%08x, %08x, %08x, %08x)", chan, leftvol, rightvol, samplePtr); + DEBUG_LOG(Log::sceAudio, "sceAudioOutputPanned(%08x, %08x, %08x, %08x)", chan, leftvol, rightvol, samplePtr); if (leftvol >= 0) { chans[chan].leftVolume = leftvol; } @@ -179,21 +179,21 @@ static u32 sceAudioOutputPanned(u32 chan, int leftvol, int rightvol, u32 sampleP static int sceAudioGetChannelRestLen(u32 chan) { if (chan >= PSP_AUDIO_CHANNEL_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioGetChannelRestLen(%08x) - bad channel", chan); + ERROR_LOG(Log::sceAudio, "sceAudioGetChannelRestLen(%08x) - bad channel", chan); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } int remainingSamples = (int)chanSampleQueues[chan].size() / 2; - VERBOSE_LOG(SCEAUDIO, "%d=sceAudioGetChannelRestLen(%08x)", remainingSamples, chan); + VERBOSE_LOG(Log::sceAudio, "%d=sceAudioGetChannelRestLen(%08x)", remainingSamples, chan); return remainingSamples; } static int sceAudioGetChannelRestLength(u32 chan) { if (chan >= PSP_AUDIO_CHANNEL_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioGetChannelRestLength(%08x) - bad channel", chan); + ERROR_LOG(Log::sceAudio, "sceAudioGetChannelRestLength(%08x) - bad channel", chan); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } int remainingSamples = (int)chanSampleQueues[chan].size() / 2; - VERBOSE_LOG(SCEAUDIO, "%d=sceAudioGetChannelRestLength(%08x)", remainingSamples, chan); + VERBOSE_LOG(Log::sceAudio, "%d=sceAudioGetChannelRestLength(%08x)", remainingSamples, chan); return remainingSamples; } @@ -209,28 +209,28 @@ static u32 sceAudioChReserve(int chan, u32 sampleCount, u32 format) { if (chan < 0) { chan = GetFreeChannel(); if (chan < 0) { - ERROR_LOG(SCEAUDIO, "sceAudioChReserve - no channels remaining"); + ERROR_LOG(Log::sceAudio, "sceAudioChReserve - no channels remaining"); return SCE_ERROR_AUDIO_NO_CHANNELS_AVAILABLE; } } if ((u32)chan >= PSP_AUDIO_CHANNEL_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioChReserve(%08x, %08x, %08x) - bad channel", chan, sampleCount, format); + ERROR_LOG(Log::sceAudio, "sceAudioChReserve(%08x, %08x, %08x) - bad channel", chan, sampleCount, format); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } if ((sampleCount & 63) != 0 || sampleCount == 0 || sampleCount > PSP_AUDIO_SAMPLE_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioChReserve(%08x, %08x, %08x) - invalid sample count", chan, sampleCount, format); + ERROR_LOG(Log::sceAudio, "sceAudioChReserve(%08x, %08x, %08x) - invalid sample count", chan, sampleCount, format); return SCE_ERROR_AUDIO_OUTPUT_SAMPLE_DATA_SIZE_NOT_ALIGNED; } if (format != PSP_AUDIO_FORMAT_MONO && format != PSP_AUDIO_FORMAT_STEREO) { - ERROR_LOG(SCEAUDIO, "sceAudioChReserve(%08x, %08x, %08x) - invalid format", chan, sampleCount, format); + ERROR_LOG(Log::sceAudio, "sceAudioChReserve(%08x, %08x, %08x) - invalid format", chan, sampleCount, format); return SCE_ERROR_AUDIO_INVALID_FORMAT; } if (chans[chan].reserved) { - ERROR_LOG(SCEAUDIO, "sceAudioChReserve - reserve channel failed"); + ERROR_LOG(Log::sceAudio, "sceAudioChReserve - reserve channel failed"); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } - DEBUG_LOG(SCEAUDIO, "sceAudioChReserve(%08x, %08x, %08x)", chan, sampleCount, format); + DEBUG_LOG(Log::sceAudio, "sceAudioChReserve(%08x, %08x, %08x)", chan, sampleCount, format); chans[chan].sampleCount = sampleCount; chans[chan].format = format; chans[chan].reserved = true; @@ -241,47 +241,47 @@ static u32 sceAudioChReserve(int chan, u32 sampleCount, u32 format) { static u32 sceAudioChRelease(u32 chan) { if (chan >= PSP_AUDIO_CHANNEL_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioChRelease(%i) - bad channel", chan); + ERROR_LOG(Log::sceAudio, "sceAudioChRelease(%i) - bad channel", chan); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } if (!chans[chan].reserved) { - ERROR_LOG(SCEAUDIO, "sceAudioChRelease(%i) - channel not reserved", chan); + ERROR_LOG(Log::sceAudio, "sceAudioChRelease(%i) - channel not reserved", chan); return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; } // TODO: Does this error if busy? chans[chan].reset(); chans[chan].reserved = false; - return hleLogSuccessI(SCEAUDIO, 0); + return hleLogSuccessI(Log::sceAudio, 0); } static u32 sceAudioSetChannelDataLen(u32 chan, u32 len) { int result = 0; if (chan >= PSP_AUDIO_CHANNEL_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioSetChannelDataLen(%08x, %08x) - bad channel", chan, len); + ERROR_LOG(Log::sceAudio, "sceAudioSetChannelDataLen(%08x, %08x) - bad channel", chan, len); result = SCE_ERROR_AUDIO_INVALID_CHANNEL; } else if (!chans[chan].reserved) { - ERROR_LOG(SCEAUDIO, "sceAudioSetChannelDataLen(%08x, %08x) - channel not reserved", chan, len); + ERROR_LOG(Log::sceAudio, "sceAudioSetChannelDataLen(%08x, %08x) - channel not reserved", chan, len); result = SCE_ERROR_AUDIO_CHANNEL_NOT_INIT; } else if ((len & 63) != 0 || len == 0 || len > PSP_AUDIO_SAMPLE_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioSetChannelDataLen(%08x, %08x) - invalid sample count", chan, len); + ERROR_LOG(Log::sceAudio, "sceAudioSetChannelDataLen(%08x, %08x) - invalid sample count", chan, len); result = SCE_ERROR_AUDIO_OUTPUT_SAMPLE_DATA_SIZE_NOT_ALIGNED; } else { chans[chan].sampleCount = len; } - DEBUG_LOG(SCEAUDIO, "%08x = sceAudioSetChannelDataLen(%08x, %08x)", result , chan, len); + DEBUG_LOG(Log::sceAudio, "%08x = sceAudioSetChannelDataLen(%08x, %08x)", result , chan, len); return result; } static u32 sceAudioChangeChannelConfig(u32 chan, u32 format) { if (chan >= PSP_AUDIO_CHANNEL_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioChangeChannelConfig(%08x, %08x) - invalid channel number", chan, format); + ERROR_LOG(Log::sceAudio, "sceAudioChangeChannelConfig(%08x, %08x) - invalid channel number", chan, format); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } else if (!chans[chan].reserved) { - ERROR_LOG(SCEAUDIO, "sceAudioChangeChannelConfig(%08x, %08x) - channel not reserved", chan, format); + ERROR_LOG(Log::sceAudio, "sceAudioChangeChannelConfig(%08x, %08x) - channel not reserved", chan, format); return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; } else { - DEBUG_LOG(SCEAUDIO, "sceAudioChangeChannelConfig(%08x, %08x)", chan, format); + DEBUG_LOG(Log::sceAudio, "sceAudioChangeChannelConfig(%08x, %08x)", chan, format); chans[chan].format = format; return 0; } @@ -289,16 +289,16 @@ static u32 sceAudioChangeChannelConfig(u32 chan, u32 format) { static u32 sceAudioChangeChannelVolume(u32 chan, u32 leftvol, u32 rightvol) { if (leftvol > 0xFFFF || rightvol > 0xFFFF) { - ERROR_LOG(SCEAUDIO, "sceAudioChangeChannelVolume(%08x, %08x, %08x) - invalid volume", chan, leftvol, rightvol); + ERROR_LOG(Log::sceAudio, "sceAudioChangeChannelVolume(%08x, %08x, %08x) - invalid volume", chan, leftvol, rightvol); return SCE_ERROR_AUDIO_INVALID_VOLUME; } else if (chan >= PSP_AUDIO_CHANNEL_MAX) { - ERROR_LOG(SCEAUDIO, "sceAudioChangeChannelVolume(%08x, %08x, %08x) - invalid channel number", chan, leftvol, rightvol); + ERROR_LOG(Log::sceAudio, "sceAudioChangeChannelVolume(%08x, %08x, %08x) - invalid channel number", chan, leftvol, rightvol); return SCE_ERROR_AUDIO_INVALID_CHANNEL; } else if (!chans[chan].reserved) { - ERROR_LOG(SCEAUDIO, "sceAudioChangeChannelVolume(%08x, %08x, %08x) - channel not reserved", chan, leftvol, rightvol); + ERROR_LOG(Log::sceAudio, "sceAudioChangeChannelVolume(%08x, %08x, %08x) - channel not reserved", chan, leftvol, rightvol); return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; } else { - DEBUG_LOG(SCEAUDIO, "sceAudioChangeChannelVolume(%08x, %08x, %08x)", chan, leftvol, rightvol); + DEBUG_LOG(Log::sceAudio, "sceAudioChangeChannelVolume(%08x, %08x, %08x)", chan, leftvol, rightvol); chans[chan].leftVolume = leftvol; chans[chan].rightVolume = rightvol; return 0; @@ -306,13 +306,13 @@ static u32 sceAudioChangeChannelVolume(u32 chan, u32 leftvol, u32 rightvol) { } static u32 sceAudioInit() { - DEBUG_LOG(SCEAUDIO, "sceAudioInit()"); + DEBUG_LOG(Log::sceAudio, "sceAudioInit()"); // Don't need to do anything return 0; } static u32 sceAudioEnd() { - DEBUG_LOG(SCEAUDIO, "sceAudioEnd()"); + DEBUG_LOG(Log::sceAudio, "sceAudioEnd()"); // Don't need to do anything return 0; } @@ -322,27 +322,27 @@ static u32 sceAudioOutput2Reserve(u32 sampleCount) { // This seems to ignore the MSB, for some reason. sampleCount &= 0x7FFFFFFF; if (sampleCount < 17 || sampleCount > 4111) { - return hleLogError(SCEAUDIO, SCE_KERNEL_ERROR_INVALID_SIZE, "invalid sample count"); + return hleLogError(Log::sceAudio, SCE_KERNEL_ERROR_INVALID_SIZE, "invalid sample count"); } else if (chan.reserved) { - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "channel already reserved"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "channel already reserved"); } chan.sampleCount = sampleCount; chan.format = PSP_AUDIO_FORMAT_STEREO; chan.reserved = true; __AudioSetSRCFrequency(0); - return hleLogSuccessI(SCEAUDIO, 0); + return hleLogSuccessI(Log::sceAudio, 0); } static u32 sceAudioOutput2OutputBlocking(u32 vol, u32 dataPtr) { // Note: 0xFFFFF, not 0xFFFF! if (vol > 0xFFFFF) { - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_INVALID_VOLUME, "invalid volume"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_INVALID_VOLUME, "invalid volume"); } auto &chan = chans[PSP_AUDIO_CHANNEL_OUTPUT2]; if (!chan.reserved) { - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); } chan.leftVolume = vol; @@ -352,58 +352,58 @@ static u32 sceAudioOutput2OutputBlocking(u32 vol, u32 dataPtr) { hleEatCycles(10000); int result = __AudioEnqueue(chan, PSP_AUDIO_CHANNEL_OUTPUT2, true); if (result < 0) - return hleLogError(SCEAUDIO, result); - return hleLogSuccessI(SCEAUDIO, result); + return hleLogError(Log::sceAudio, result); + return hleLogSuccessI(Log::sceAudio, result); } static u32 sceAudioOutput2ChangeLength(u32 sampleCount) { auto &chan = chans[PSP_AUDIO_CHANNEL_OUTPUT2]; if (!chan.reserved) { - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); } chan.sampleCount = sampleCount; - return hleLogSuccessI(SCEAUDIO, 0); + return hleLogSuccessI(Log::sceAudio, 0); } static u32 sceAudioOutput2GetRestSample() { auto &chan = chans[PSP_AUDIO_CHANNEL_OUTPUT2]; if (!chan.reserved) { - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); } u32 size = (u32)chanSampleQueues[PSP_AUDIO_CHANNEL_OUTPUT2].size() / 2; if (size > chan.sampleCount) { // If ChangeLength reduces the size, it still gets output but this return is clamped. size = chan.sampleCount; } - return hleLogSuccessI(SCEAUDIO, size); + return hleLogSuccessI(Log::sceAudio, size); } static u32 sceAudioOutput2Release() { auto &chan = chans[PSP_AUDIO_CHANNEL_OUTPUT2]; if (!chan.reserved) - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); if (!chanSampleQueues[PSP_AUDIO_CHANNEL_OUTPUT2].empty()) - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "output busy"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "output busy"); chan.reset(); chan.reserved = false; - return hleLogSuccessI(SCEAUDIO, 0); + return hleLogSuccessI(Log::sceAudio, 0); } static u32 sceAudioSetFrequency(u32 freq) { // TODO: Not available from user code. if (freq == 44100 || freq == 48000) { - INFO_LOG(SCEAUDIO, "sceAudioSetFrequency(%08x)", freq); + INFO_LOG(Log::sceAudio, "sceAudioSetFrequency(%08x)", freq); __AudioSetOutputFrequency(freq); return 0; } else { - ERROR_LOG(SCEAUDIO, "sceAudioSetFrequency(%08x) - invalid frequency (must be 44.1 or 48 khz)", freq); + ERROR_LOG(Log::sceAudio, "sceAudioSetFrequency(%08x) - invalid frequency (must be 44.1 or 48 khz)", freq); return SCE_ERROR_AUDIO_INVALID_FREQUENCY; } } static u32 sceAudioSetVolumeOffset() { - ERROR_LOG(SCEAUDIO, "UNIMPL sceAudioSetVolumeOffset()"); + ERROR_LOG(Log::sceAudio, "UNIMPL sceAudioSetVolumeOffset()"); return 0; } @@ -420,15 +420,15 @@ static u32 sceAudioSRCChReserve(u32 sampleCount, u32 freq, u32 format) { // This seems to ignore the MSB, for some reason. sampleCount &= 0x7FFFFFFF; if (format == 4) { - return hleReportError(SCEAUDIO, PSP_AUDIO_ERROR_SRC_FORMAT_4, "unexpected format"); + return hleReportError(Log::sceAudio, PSP_AUDIO_ERROR_SRC_FORMAT_4, "unexpected format"); } else if (format != 2) { - return hleLogError(SCEAUDIO, SCE_KERNEL_ERROR_INVALID_SIZE, "unexpected format"); + return hleLogError(Log::sceAudio, SCE_KERNEL_ERROR_INVALID_SIZE, "unexpected format"); } else if (sampleCount < 17 || sampleCount > 4111) { - return hleLogError(SCEAUDIO, SCE_KERNEL_ERROR_INVALID_SIZE, "invalid sample count"); + return hleLogError(Log::sceAudio, SCE_KERNEL_ERROR_INVALID_SIZE, "invalid sample count"); } else if (freq != 0 && !SRCFrequencyAllowed(freq)) { - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_INVALID_FREQUENCY, "invalid frequency"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_INVALID_FREQUENCY, "invalid frequency"); } else if (chan.reserved) { - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "channel already reserved"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "channel already reserved"); } chan.reserved = true; @@ -436,29 +436,29 @@ static u32 sceAudioSRCChReserve(u32 sampleCount, u32 freq, u32 format) { chan.format = format == 2 ? PSP_AUDIO_FORMAT_STEREO : PSP_AUDIO_FORMAT_MONO; // Zero means default to 44.1kHz. __AudioSetSRCFrequency(freq); - return hleLogSuccessI(SCEAUDIO, 0); + return hleLogSuccessI(Log::sceAudio, 0); } static u32 sceAudioSRCChRelease() { auto &chan = chans[PSP_AUDIO_CHANNEL_SRC]; if (!chan.reserved) - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); if (!chanSampleQueues[PSP_AUDIO_CHANNEL_SRC].empty()) - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "output busy"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED, "output busy"); chan.reset(); chan.reserved = false; - return hleLogSuccessI(SCEAUDIO, 0); + return hleLogSuccessI(Log::sceAudio, 0); } static u32 sceAudioSRCOutputBlocking(u32 vol, u32 buf) { if (vol > 0xFFFFF) { - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_INVALID_VOLUME, "invalid volume"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_INVALID_VOLUME, "invalid volume"); } auto &chan = chans[PSP_AUDIO_CHANNEL_SRC]; if (!chan.reserved) { - return hleLogError(SCEAUDIO, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); + return hleLogError(Log::sceAudio, SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED, "channel not reserved"); } chan.leftVolume = vol; @@ -468,77 +468,77 @@ static u32 sceAudioSRCOutputBlocking(u32 vol, u32 buf) { hleEatCycles(10000); int result = __AudioEnqueue(chan, PSP_AUDIO_CHANNEL_SRC, true); if (result < 0) - return hleLogError(SCEAUDIO, result); - return hleLogSuccessI(SCEAUDIO, result); + return hleLogError(Log::sceAudio, result); + return hleLogSuccessI(Log::sceAudio, result); } static int sceAudioInputBlocking(u32 maxSamples, u32 sampleRate, u32 bufAddr) { if (!Memory::IsValidAddress(bufAddr)) { - ERROR_LOG(HLE, "sceAudioInputBlocking(%d, %d, %08x): invalid addresses", maxSamples, sampleRate, bufAddr); + ERROR_LOG(Log::HLE, "sceAudioInputBlocking(%d, %d, %08x): invalid addresses", maxSamples, sampleRate, bufAddr); return -1; } - INFO_LOG(HLE, "sceAudioInputBlocking: maxSamples: %d, samplerate: %d, bufAddr: %08x", maxSamples, sampleRate, bufAddr); + INFO_LOG(Log::HLE, "sceAudioInputBlocking: maxSamples: %d, samplerate: %d, bufAddr: %08x", maxSamples, sampleRate, bufAddr); return __MicInput(maxSamples, sampleRate, bufAddr, AUDIOINPUT); } static int sceAudioInput(u32 maxSamples, u32 sampleRate, u32 bufAddr) { if (!Memory::IsValidAddress(bufAddr)) { - ERROR_LOG(HLE, "sceAudioInput(%d, %d, %08x): invalid addresses", maxSamples, sampleRate, bufAddr); + ERROR_LOG(Log::HLE, "sceAudioInput(%d, %d, %08x): invalid addresses", maxSamples, sampleRate, bufAddr); return -1; } - ERROR_LOG(HLE, "UNTEST sceAudioInput: maxSamples: %d, samplerate: %d, bufAddr: %08x", maxSamples, sampleRate, bufAddr); + ERROR_LOG(Log::HLE, "UNTEST sceAudioInput: maxSamples: %d, samplerate: %d, bufAddr: %08x", maxSamples, sampleRate, bufAddr); return __MicInput(maxSamples, sampleRate, bufAddr, AUDIOINPUT, false); } static int sceAudioInputInit(int unknown1, int gain, int unknown2) { - ERROR_LOG(HLE, "UNIMPL sceAudioInputInit: unknown1: %d, gain: %d, unknown2: %d", unknown1, gain, unknown2); + ERROR_LOG(Log::HLE, "UNIMPL sceAudioInputInit: unknown1: %d, gain: %d, unknown2: %d", unknown1, gain, unknown2); return 0; } static int sceAudioInputInitEx(u32 paramAddr) { - ERROR_LOG(HLE, "UNIMPL sceAudioInputInitEx: paramAddr: %08x", paramAddr); + ERROR_LOG(Log::HLE, "UNIMPL sceAudioInputInitEx: paramAddr: %08x", paramAddr); return 0; } static int sceAudioPollInputEnd() { - ERROR_LOG(HLE, "UNIMPL sceAudioPollInputEnd"); + ERROR_LOG(Log::HLE, "UNIMPL sceAudioPollInputEnd"); return 0; } static int sceAudioWaitInputEnd() { - ERROR_LOG(HLE, "UNIMPL sceAudioWaitInputEnd"); + ERROR_LOG(Log::HLE, "UNIMPL sceAudioWaitInputEnd"); return 0; } static int sceAudioGetInputLength() { int ret = Microphone::getReadMicDataLength() / 2; - ERROR_LOG(HLE, "UNTEST sceAudioGetInputLength(ret: %d)", ret); + ERROR_LOG(Log::HLE, "UNTEST sceAudioGetInputLength(ret: %d)", ret); return ret; } static u32 sceAudioRoutingSetMode(u32 mode) { - ERROR_LOG_REPORT(SCEAUDIO, "sceAudioRoutingSetMode(%08x)", mode); + ERROR_LOG_REPORT(Log::sceAudio, "sceAudioRoutingSetMode(%08x)", mode); int previousMode = defaultRoutingMode; defaultRoutingMode = mode; return previousMode; } static u32 sceAudioRoutingGetMode() { - ERROR_LOG_REPORT(SCEAUDIO, "sceAudioRoutingGetMode()"); + ERROR_LOG_REPORT(Log::sceAudio, "sceAudioRoutingGetMode()"); return defaultRoutingMode; } static u32 sceAudioRoutingSetVolumeMode(u32 mode) { - ERROR_LOG_REPORT(SCEAUDIO, "sceAudioRoutingSetVolumeMode(%08x)", mode); + ERROR_LOG_REPORT(Log::sceAudio, "sceAudioRoutingSetVolumeMode(%08x)", mode); int previousMode = defaultRoutingVolMode; defaultRoutingVolMode = mode; return previousMode; } static u32 sceAudioRoutingGetVolumeMode() { - ERROR_LOG_REPORT(SCEAUDIO, "sceAudioRoutingGetVolumeMode()"); + ERROR_LOG_REPORT(Log::sceAudio, "sceAudioRoutingGetVolumeMode()"); return defaultRoutingVolMode; } diff --git a/Core/HLE/sceAudioRouting.cpp b/Core/HLE/sceAudioRouting.cpp index e573da6dae..c2e34221d6 100644 --- a/Core/HLE/sceAudioRouting.cpp +++ b/Core/HLE/sceAudioRouting.cpp @@ -28,24 +28,24 @@ u32 audioRoutingMode = AUDIO_ROUTING_SPEAKER_ON; u32 audioRoutineVolumeMode = AUDIO_ROUTING_SPEAKER_ON; static int sceAudioRoutingGetMode() { - INFO_LOG(SCEAUDIO, "sceAudioRoutingGetMode"); + INFO_LOG(Log::sceAudio, "sceAudioRoutingGetMode"); return 0; } static int sceAudioRoutingSetVolumeMode(int mode) { - INFO_LOG(SCEAUDIO, "sceAudioRoutingSetVolumeMode %d", mode); + INFO_LOG(Log::sceAudio, "sceAudioRoutingSetVolumeMode %d", mode); int previousMode = audioRoutineVolumeMode; audioRoutineVolumeMode = audioRoutingMode; return previousMode; } static int sceAudioRoutingGetVolumeMode() { - INFO_LOG(SCEAUDIO, "sceAudioRoutingGetMode"); + INFO_LOG(Log::sceAudio, "sceAudioRoutingGetMode"); return 0; } static int sceAudioRoutingSetMode(int mode) { - INFO_LOG(SCEAUDIO, "sceAudioRoutingSetMode %d", mode); + INFO_LOG(Log::sceAudio, "sceAudioRoutingSetMode %d", mode); int previousMode = audioRoutingMode; audioRoutingMode = mode; return previousMode; diff --git a/Core/HLE/sceAudiocodec.cpp b/Core/HLE/sceAudiocodec.cpp index 7676593630..fd1e770cba 100644 --- a/Core/HLE/sceAudiocodec.cpp +++ b/Core/HLE/sceAudiocodec.cpp @@ -81,23 +81,23 @@ static int sceAudiocodecInit(u32 ctxPtr, int codec) { if (IsValidCodec(audioType)) { // Create audio decoder for given audio codec and push it into AudioList if (removeDecoder(ctxPtr)) { - WARN_LOG_REPORT(HLE, "sceAudiocodecInit(%08x, %d): replacing existing context", ctxPtr, codec); + WARN_LOG_REPORT(Log::HLE, "sceAudiocodecInit(%08x, %d): replacing existing context", ctxPtr, codec); } AudioDecoder *decoder = CreateAudioDecoder(audioType); decoder->SetCtxPtr(ctxPtr); audioList[ctxPtr] = decoder; - INFO_LOG(ME, "sceAudiocodecInit(%08x, %i (%s))", ctxPtr, codec, GetCodecName(audioType)); - DEBUG_LOG(ME, "Number of playing sceAudioCodec audios : %d", (int)audioList.size()); + INFO_LOG(Log::ME, "sceAudiocodecInit(%08x, %i (%s))", ctxPtr, codec, GetCodecName(audioType)); + DEBUG_LOG(Log::ME, "Number of playing sceAudioCodec audios : %d", (int)audioList.size()); return 0; } - ERROR_LOG_REPORT(ME, "sceAudiocodecInit(%08x, %i (%s)): Unknown audio codec %i", ctxPtr, codec, GetCodecName(audioType), codec); + ERROR_LOG_REPORT(Log::ME, "sceAudiocodecInit(%08x, %i (%s)): Unknown audio codec %i", ctxPtr, codec, GetCodecName(audioType), codec); return 0; } static int sceAudiocodecDecode(u32 ctxPtr, int codec) { PSPAudioType audioType = (PSPAudioType)codec; if (!ctxPtr){ - ERROR_LOG_REPORT(ME, "sceAudiocodecDecode(%08x, %i (%s)) got NULL pointer", ctxPtr, codec, GetCodecName(audioType)); + ERROR_LOG_REPORT(Log::ME, "sceAudiocodecDecode(%08x, %i (%s)) got NULL pointer", ctxPtr, codec, GetCodecName(audioType)); return -1; } @@ -121,34 +121,34 @@ static int sceAudiocodecDecode(u32 ctxPtr, int codec) { int outSamples = 0; decoder->Decode(Memory::GetPointer(ctx->inDataPtr), ctx->inDataSize, &inDataConsumed, 2, (int16_t *)Memory::GetPointerWrite(ctx->outDataPtr), &outSamples); } - DEBUG_LOG(ME, "sceAudiocodecDec(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec)); + DEBUG_LOG(Log::ME, "sceAudiocodecDec(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec)); return 0; } - ERROR_LOG_REPORT(ME, "UNIMPL sceAudiocodecDecode(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec)); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceAudiocodecDecode(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec)); return 0; } static int sceAudiocodecGetInfo(u32 ctxPtr, int codec) { - ERROR_LOG_REPORT(ME, "UNIMPL sceAudiocodecGetInfo(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec)); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceAudiocodecGetInfo(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec)); return 0; } static int sceAudiocodecCheckNeedMem(u32 ctxPtr, int codec) { - WARN_LOG(ME, "UNIMPL sceAudiocodecCheckNeedMem(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec)); + WARN_LOG(Log::ME, "UNIMPL sceAudiocodecCheckNeedMem(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec)); return 0; } static int sceAudiocodecGetEDRAM(u32 ctxPtr, int codec) { - WARN_LOG(ME, "UNIMPL sceAudiocodecGetEDRAM(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec)); + WARN_LOG(Log::ME, "UNIMPL sceAudiocodecGetEDRAM(%08x, %i (%s))", ctxPtr, codec, GetCodecName(codec)); return 0; } static int sceAudiocodecReleaseEDRAM(u32 ctxPtr, int id) { if (removeDecoder(ctxPtr)){ - INFO_LOG(ME, "sceAudiocodecReleaseEDRAM(%08x, %i)", ctxPtr, id); + INFO_LOG(Log::ME, "sceAudiocodecReleaseEDRAM(%08x, %i)", ctxPtr, id); return 0; } - WARN_LOG(ME, "UNIMPL sceAudiocodecReleaseEDRAM(%08x, %i)", ctxPtr, id); + WARN_LOG(Log::ME, "UNIMPL sceAudiocodecReleaseEDRAM(%08x, %i)", ctxPtr, id); return 0; } diff --git a/Core/HLE/sceCcc.cpp b/Core/HLE/sceCcc.cpp index b47d805573..780b389af7 100644 --- a/Core/HLE/sceCcc.cpp +++ b/Core/HLE/sceCcc.cpp @@ -86,7 +86,7 @@ static u32 __CccJIStoUCS(u32 c, u32 alt) static void sceCccSetTable(u32 jis2ucs, u32 ucs2jis) { // Both tables jis2ucs and ucs2jis have a size of 0x20000 bytes. - DEBUG_LOG(SCEMISC, "sceCccSetTable(%08x, %08x)", jis2ucs, ucs2jis); + DEBUG_LOG(Log::sceMisc, "sceCccSetTable(%08x, %08x)", jis2ucs, ucs2jis); ucs2jisTable = ucs2jis; jis2ucsTable = jis2ucs; } @@ -97,14 +97,14 @@ static int sceCccUTF8toUTF16(u32 dstAddr, u32 dstSize, u32 srcAddr) auto dst = PSPWCharPointer::Create(dstAddr); if (!dst.IsValid() || !src.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccUTF8toUTF16(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); + ERROR_LOG(Log::sceMisc, "sceCccUTF8toUTF16(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); return 0; } // Round dstSize down if it represents half a character. const auto dstEnd = PSPWCharPointer::Create(dstAddr + (dstSize & ~1)); - DEBUG_LOG(SCEMISC, "sceCccUTF8toUTF16(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); + DEBUG_LOG(Log::sceMisc, "sceCccUTF8toUTF16(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); UTF8 utf(src); int n = 0; while (u32 c = utf.next()) @@ -129,18 +129,18 @@ static int sceCccUTF8toSJIS(u32 dstAddr, u32 dstSize, u32 srcAddr) auto dst = PSPCharPointer::Create(dstAddr); if (!dst.IsValid() || !src.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccUTF8toSJIS(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); + ERROR_LOG(Log::sceMisc, "sceCccUTF8toSJIS(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); return 0; } if (!ucs2jisTable.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccUTF8toSJIS(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr); + ERROR_LOG(Log::sceMisc, "sceCccUTF8toSJIS(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr); return 0; } const auto dstEnd = PSPCharPointer::Create(dstAddr + dstSize); - DEBUG_LOG(SCEMISC, "sceCccUTF8toSJIS(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); + DEBUG_LOG(Log::sceMisc, "sceCccUTF8toSJIS(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); UTF8 utf(src); int n = 0; while (u32 c = utf.next()) @@ -165,13 +165,13 @@ static int sceCccUTF16toUTF8(u32 dstAddr, u32 dstSize, u32 srcAddr) auto dst = PSPCharPointer::Create(dstAddr); if (!dst.IsValid() || !src.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccUTF16toUTF8(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); + ERROR_LOG(Log::sceMisc, "sceCccUTF16toUTF8(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); return 0; } const auto dstEnd = PSPCharPointer::Create(dstAddr + dstSize); - DEBUG_LOG(SCEMISC, "sceCccUTF16toUTF8(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); + DEBUG_LOG(Log::sceMisc, "sceCccUTF16toUTF8(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); UTF16LE utf(src); int n = 0; while (u32 c = utf.next()) @@ -196,18 +196,18 @@ static int sceCccUTF16toSJIS(u32 dstAddr, u32 dstSize, u32 srcAddr) auto dst = PSPCharPointer::Create(dstAddr); if (!dst.IsValid() || !src.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccUTF16toSJIS(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); + ERROR_LOG(Log::sceMisc, "sceCccUTF16toSJIS(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); return 0; } if (!ucs2jisTable.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccUTF16toSJIS(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr); + ERROR_LOG(Log::sceMisc, "sceCccUTF16toSJIS(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr); return 0; } const auto dstEnd = PSPCharPointer::Create(dstAddr + dstSize); - DEBUG_LOG(SCEMISC, "sceCccUTF16toSJIS(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); + DEBUG_LOG(Log::sceMisc, "sceCccUTF16toSJIS(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); UTF16LE utf(src); int n = 0; while (u32 c = utf.next()) @@ -232,18 +232,18 @@ static int sceCccSJIStoUTF8(u32 dstAddr, u32 dstSize, u32 srcAddr) auto dst = PSPCharPointer::Create(dstAddr); if (!dst.IsValid() || !src.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccSJIStoUTF8(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); + ERROR_LOG(Log::sceMisc, "sceCccSJIStoUTF8(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); return 0; } if (!jis2ucsTable.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccSJIStoUTF8(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr); + ERROR_LOG(Log::sceMisc, "sceCccSJIStoUTF8(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr); return 0; } const auto dstEnd = PSPCharPointer::Create(dstAddr + dstSize); - DEBUG_LOG(SCEMISC, "sceCccSJIStoUTF8(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); + DEBUG_LOG(Log::sceMisc, "sceCccSJIStoUTF8(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); ShiftJIS sjis(src); int n = 0; while (u32 c = sjis.next()) @@ -268,18 +268,18 @@ static int sceCccSJIStoUTF16(u32 dstAddr, u32 dstSize, u32 srcAddr) auto dst = PSPWCharPointer::Create(dstAddr); if (!dst.IsValid() || !src.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccSJIStoUTF16(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); + ERROR_LOG(Log::sceMisc, "sceCccSJIStoUTF16(%08x, %d, %08x): invalid pointers", dstAddr, dstSize, srcAddr); return 0; } if (!jis2ucsTable.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccSJIStoUTF16(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr); + ERROR_LOG(Log::sceMisc, "sceCccSJIStoUTF16(%08x, %d, %08x): table not loaded", dstAddr, dstSize, srcAddr); return 0; } const auto dstEnd = PSPWCharPointer::Create(dstAddr + (dstSize & ~1)); - DEBUG_LOG(SCEMISC, "sceCccSJIStoUTF16(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); + DEBUG_LOG(Log::sceMisc, "sceCccSJIStoUTF16(%08x, %d, %08x)", dstAddr, dstSize, srcAddr); ShiftJIS sjis(src); int n = 0; while (u32 c = sjis.next()) @@ -303,10 +303,10 @@ static int sceCccStrlenUTF8(u32 strAddr) const auto str = PSPConstCharPointer::Create(strAddr); if (!str.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccStrlenUTF8(%08x): invalid pointer", strAddr); + ERROR_LOG(Log::sceMisc, "sceCccStrlenUTF8(%08x): invalid pointer", strAddr); return 0; } - DEBUG_LOG(SCEMISC, "sceCccStrlenUTF8(%08x): invalid pointer", strAddr); + DEBUG_LOG(Log::sceMisc, "sceCccStrlenUTF8(%08x): invalid pointer", strAddr); return UTF8(str).length(); } @@ -315,10 +315,10 @@ static int sceCccStrlenUTF16(u32 strAddr) const auto str = PSPConstWCharPointer::Create(strAddr); if (!str.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccStrlenUTF16(%08x): invalid pointer", strAddr); + ERROR_LOG(Log::sceMisc, "sceCccStrlenUTF16(%08x): invalid pointer", strAddr); return 0; } - DEBUG_LOG(SCEMISC, "sceCccStrlenUTF16(%08x): invalid pointer", strAddr); + DEBUG_LOG(Log::sceMisc, "sceCccStrlenUTF16(%08x): invalid pointer", strAddr); return UTF16LE(str).length(); } @@ -327,10 +327,10 @@ static int sceCccStrlenSJIS(u32 strAddr) const auto str = PSPCharPointer::Create(strAddr); if (!str.IsValid()) { - ERROR_LOG(SCEMISC, "sceCccStrlenSJIS(%08x): invalid pointer", strAddr); + ERROR_LOG(Log::sceMisc, "sceCccStrlenSJIS(%08x): invalid pointer", strAddr); return 0; } - DEBUG_LOG(SCEMISC, "sceCccStrlenSJIS(%08x): invalid pointer", strAddr); + DEBUG_LOG(Log::sceMisc, "sceCccStrlenSJIS(%08x): invalid pointer", strAddr); return ShiftJIS(str).length(); } @@ -340,10 +340,10 @@ static u32 sceCccEncodeUTF8(u32 dstAddrAddr, u32 ucs) if (!dstp.IsValid() || !dstp->IsValid()) { - ERROR_LOG(SCEMISC, "sceCccEncodeUTF8(%08x, U+%04x): invalid pointer", dstAddrAddr, ucs); + ERROR_LOG(Log::sceMisc, "sceCccEncodeUTF8(%08x, U+%04x): invalid pointer", dstAddrAddr, ucs); return 0; } - DEBUG_LOG(SCEMISC, "sceCccEncodeUTF8(%08x, U+%04x)", dstAddrAddr, ucs); + DEBUG_LOG(Log::sceMisc, "sceCccEncodeUTF8(%08x, U+%04x)", dstAddrAddr, ucs); *dstp += UTF8::encode(*dstp, ucs); return dstp->ptr; } @@ -354,10 +354,10 @@ static void sceCccEncodeUTF16(u32 dstAddrAddr, u32 ucs) if (!dstp.IsValid() || !dstp->IsValid()) { - ERROR_LOG(SCEMISC, "sceCccEncodeUTF16(%08x, U+%04x): invalid pointer", dstAddrAddr, ucs); + ERROR_LOG(Log::sceMisc, "sceCccEncodeUTF16(%08x, U+%04x): invalid pointer", dstAddrAddr, ucs); return; } - DEBUG_LOG(SCEMISC, "sceCccEncodeUTF16(%08x, U+%04x)", dstAddrAddr, ucs); + DEBUG_LOG(Log::sceMisc, "sceCccEncodeUTF16(%08x, U+%04x)", dstAddrAddr, ucs); // Anything above 0x10FFFF is unencodable, and 0xD800 - 0xDFFF are reserved for surrogate pairs. if (ucs > 0x10FFFF || (ucs & 0xD800) == 0xD800) ucs = errorUTF16; @@ -370,10 +370,10 @@ static u32 sceCccEncodeSJIS(u32 dstAddrAddr, u32 jis) if (!dstp.IsValid() || !dstp->IsValid()) { - ERROR_LOG(SCEMISC, "sceCccEncodeSJIS(%08x, U+%04x): invalid pointer", dstAddrAddr, jis); + ERROR_LOG(Log::sceMisc, "sceCccEncodeSJIS(%08x, U+%04x): invalid pointer", dstAddrAddr, jis); return 0; } - DEBUG_LOG(SCEMISC, "sceCccEncodeSJIS(%08x, U+%04x)", dstAddrAddr, jis); + DEBUG_LOG(Log::sceMisc, "sceCccEncodeSJIS(%08x, U+%04x)", dstAddrAddr, jis); *dstp += ShiftJIS::encode(*dstp, jis); return dstp->ptr; } @@ -383,12 +383,12 @@ static u32 sceCccDecodeUTF8(u32 dstAddrAddr) auto dstp = PSPPointer::Create(dstAddrAddr); if (!dstp.IsValid() || !dstp->IsValid()) { - ERROR_LOG(SCEMISC, "sceCccDecodeUTF8(%08x): invalid pointer", dstAddrAddr); + ERROR_LOG(Log::sceMisc, "sceCccDecodeUTF8(%08x): invalid pointer", dstAddrAddr); // Should crash? return 0; } - DEBUG_LOG(SCEMISC, "sceCccDecodeUTF8(%08x)", dstAddrAddr); + DEBUG_LOG(Log::sceMisc, "sceCccDecodeUTF8(%08x)", dstAddrAddr); UTF8 utf(*dstp); u32 result = utf.next(); *dstp += utf.byteIndex(); @@ -403,12 +403,12 @@ static u32 sceCccDecodeUTF16(u32 dstAddrAddr) auto dstp = PSPPointer::Create(dstAddrAddr); if (!dstp.IsValid() || !dstp->IsValid()) { - ERROR_LOG(SCEMISC, "sceCccDecodeUTF16(%08x): invalid pointer", dstAddrAddr); + ERROR_LOG(Log::sceMisc, "sceCccDecodeUTF16(%08x): invalid pointer", dstAddrAddr); // Should crash? return 0; } - DEBUG_LOG(SCEMISC, "sceCccDecodeUTF16(%08x)", dstAddrAddr); + DEBUG_LOG(Log::sceMisc, "sceCccDecodeUTF16(%08x)", dstAddrAddr); // TODO: Does it do any detection of BOM? UTF16LE utf(*dstp); u32 result = utf.next(); @@ -424,12 +424,12 @@ static u32 sceCccDecodeSJIS(u32 dstAddrAddr) auto dstp = PSPPointer::Create(dstAddrAddr); if (!dstp.IsValid() || !dstp->IsValid()) { - ERROR_LOG(SCEMISC, "sceCccDecodeSJIS(%08x): invalid pointer", dstAddrAddr); + ERROR_LOG(Log::sceMisc, "sceCccDecodeSJIS(%08x): invalid pointer", dstAddrAddr); // Should crash? return 0; } - DEBUG_LOG(SCEMISC, "sceCccDecodeSJIS(%08x)", dstAddrAddr); + DEBUG_LOG(Log::sceMisc, "sceCccDecodeSJIS(%08x)", dstAddrAddr); ShiftJIS sjis(*dstp); u32 result = sjis.next(); *dstp += sjis.byteIndex(); @@ -441,49 +441,49 @@ static u32 sceCccDecodeSJIS(u32 dstAddrAddr) static int sceCccIsValidUTF8(u32 c) { - WARN_LOG(SCEMISC, "UNIMPL sceCccIsValidUTF8(%08x)", c); + WARN_LOG(Log::sceMisc, "UNIMPL sceCccIsValidUTF8(%08x)", c); return c != 0; } static int sceCccIsValidUTF16(u32 c) { - WARN_LOG(SCEMISC, "UNIMPL sceCccIsValidUTF16(%08x)", c); + WARN_LOG(Log::sceMisc, "UNIMPL sceCccIsValidUTF16(%08x)", c); return c != 0; } static int sceCccIsValidSJIS(u32 c) { - WARN_LOG(SCEMISC, "UNIMPL sceCccIsValidSJIS(%08x)", c); + WARN_LOG(Log::sceMisc, "UNIMPL sceCccIsValidSJIS(%08x)", c); return c != 0; } static int sceCccIsValidUCS2(u32 c) { - WARN_LOG(SCEMISC, "UNIMPL sceCccIsValidUCS2(%08x)", c); + WARN_LOG(Log::sceMisc, "UNIMPL sceCccIsValidUCS2(%08x)", c); return c != 0; } static int sceCccIsValidUCS4(u32 c) { - WARN_LOG(SCEMISC, "UNIMPL sceCccIsValidUCS4(%08x)", c); + WARN_LOG(Log::sceMisc, "UNIMPL sceCccIsValidUCS4(%08x)", c); return c != 0; } static int sceCccIsValidJIS(u32 c) { - WARN_LOG(SCEMISC, "UNIMPL sceCccIsValidJIS(%08x)", c); + WARN_LOG(Log::sceMisc, "UNIMPL sceCccIsValidJIS(%08x)", c); return c != 0; } static int sceCccIsValidUnicode(u32 c) { - WARN_LOG(SCEMISC, "UNIMPL sceCccIsValidUnicode(%08x)", c); + WARN_LOG(Log::sceMisc, "UNIMPL sceCccIsValidUnicode(%08x)", c); return c != 0; } static u32 sceCccSetErrorCharUTF8(u32 c) { - DEBUG_LOG(SCEMISC, "sceCccSetErrorCharUTF8(%08x)", c); + DEBUG_LOG(Log::sceMisc, "sceCccSetErrorCharUTF8(%08x)", c); int result = errorUTF8; errorUTF8 = c; return result; @@ -491,7 +491,7 @@ static u32 sceCccSetErrorCharUTF8(u32 c) static u32 sceCccSetErrorCharUTF16(u32 c) { - DEBUG_LOG(SCEMISC, "sceCccSetErrorCharUTF16(%08x)", c); + DEBUG_LOG(Log::sceMisc, "sceCccSetErrorCharUTF16(%08x)", c); int result = errorUTF16; errorUTF16 = c; return result; @@ -499,7 +499,7 @@ static u32 sceCccSetErrorCharUTF16(u32 c) static u32 sceCccSetErrorCharSJIS(u32 c) { - DEBUG_LOG(SCEMISC, "sceCccSetErrorCharSJIS(%04x)", c); + DEBUG_LOG(Log::sceMisc, "sceCccSetErrorCharSJIS(%04x)", c); int result = errorSJIS; errorSJIS = c; return result; @@ -509,12 +509,12 @@ static u32 sceCccUCStoJIS(u32 c, u32 alt) { if (ucs2jisTable.IsValid()) { - DEBUG_LOG(SCEMISC, "sceCccUCStoJIS(%08x, %08x)", c, alt); + DEBUG_LOG(Log::sceMisc, "sceCccUCStoJIS(%08x, %08x)", c, alt); return __CccUCStoJIS(c, alt); } else { - ERROR_LOG(SCEMISC, "sceCccUCStoJIS(%08x, %08x): table not loaded", c, alt); + ERROR_LOG(Log::sceMisc, "sceCccUCStoJIS(%08x, %08x): table not loaded", c, alt); return alt; } } @@ -523,12 +523,12 @@ static u32 sceCccJIStoUCS(u32 c, u32 alt) { if (jis2ucsTable.IsValid()) { - DEBUG_LOG(SCEMISC, "sceCccUCStoJIS(%08x, %08x)", c, alt); + DEBUG_LOG(Log::sceMisc, "sceCccUCStoJIS(%08x, %08x)", c, alt); return __CccJIStoUCS(c, alt); } else { - ERROR_LOG(SCEMISC, "sceCccUCStoJIS(%08x, %08x): table not loaded", c, alt); + ERROR_LOG(Log::sceMisc, "sceCccUCStoJIS(%08x, %08x): table not loaded", c, alt); return alt; } } diff --git a/Core/HLE/sceChnnlsv.cpp b/Core/HLE/sceChnnlsv.cpp index c7fcd2cef3..5eaf5fab6e 100644 --- a/Core/HLE/sceChnnlsv.cpp +++ b/Core/HLE/sceChnnlsv.cpp @@ -218,8 +218,8 @@ static int sceSdGetLastIndex(u32 addressCtx, u32 addressHash, u32 addressKey) { auto ctx = PSPPointer::Create(addressCtx); u8 *hash = Memory::GetPointerWrite(addressHash); if (!ctx.IsValid() || !hash) - return hleLogError(SCEMISC, 0, "Invalid pointer"); - return hleLogSuccessI(SCEMISC, sceSdGetLastIndex_(*ctx, hash, Memory::GetPointerWrite(addressKey))); + return hleLogError(Log::sceMisc, 0, "Invalid pointer"); + return hleLogSuccessI(Log::sceMisc, sceSdGetLastIndex_(*ctx, hash, Memory::GetPointerWrite(addressKey))); } int sceSdGetLastIndex_(pspChnnlsvContext1& ctx, u8* in_hash, const u8* in_key) @@ -327,8 +327,8 @@ int sceSdGetLastIndex_(pspChnnlsvContext1& ctx, u8* in_hash, const u8* in_key) static int sceSdSetIndex(u32 addressCtx, int value) { auto ctx = PSPPointer::Create(addressCtx); if (!ctx.IsValid()) - return hleLogError(SCEMISC, 0, "Invalid pointer"); - return hleLogSuccessI(SCEMISC, sceSdSetIndex_(*ctx, value)); + return hleLogError(Log::sceMisc, 0, "Invalid pointer"); + return hleLogSuccessI(Log::sceMisc, sceSdSetIndex_(*ctx, value)); } int sceSdSetIndex_(pspChnnlsvContext1& ctx, int value) @@ -344,8 +344,8 @@ int sceSdSetIndex_(pspChnnlsvContext1& ctx, int value) static int sceSdRemoveValue(u32 addressCtx, u32 addressData, int length) { auto ctx = PSPPointer::Create(addressCtx); if (!ctx.IsValid() || !Memory::IsValidAddress(addressData)) - return hleLogError(SCEMISC, 0, "Invalid pointer"); - return hleLogSuccessI(SCEMISC, sceSdRemoveValue_(*ctx, Memory::GetPointerWrite(addressData), length)); + return hleLogError(Log::sceMisc, 0, "Invalid pointer"); + return hleLogSuccessI(Log::sceMisc, sceSdRemoveValue_(*ctx, Memory::GetPointerWrite(addressData), length)); } int sceSdRemoveValue_(pspChnnlsvContext1& ctx, const u8* data, int length) @@ -395,9 +395,9 @@ static int sceSdCreateList(u32 ctx2Addr, int mode, int unkwn, u32 dataAddr, u32 u8* data = Memory::GetPointerWrite(dataAddr); u8* cryptkey = Memory::GetPointerWrite(cryptkeyAddr); if (!ctx2.IsValid() || !data) - return hleLogError(SCEMISC, 0, "Invalid pointer"); + return hleLogError(Log::sceMisc, 0, "Invalid pointer"); - return hleLogSuccessI(SCEMISC, sceSdCreateList_(*ctx2, mode, unkwn, data, cryptkey)); + return hleLogSuccessI(Log::sceMisc, sceSdCreateList_(*ctx2, mode, unkwn, data, cryptkey)); } int sceSdCreateList_(pspChnnlsvContext2& ctx2, int mode, int uknw, u8* data, const u8* cryptkey) @@ -458,9 +458,9 @@ static int sceSdSetMember(u32 ctxAddr, u32 dataAddr, int alignedLen) { auto ctx = PSPPointer::Create(ctxAddr); u8 *data = Memory::GetPointerWrite(dataAddr); if (!ctx.IsValid() || !data) - return hleLogError(SCEMISC, 0, "Invalid pointer"); + return hleLogError(Log::sceMisc, 0, "Invalid pointer"); - return hleLogSuccessI(SCEMISC, sceSdSetMember_(*ctx, data, alignedLen)); + return hleLogSuccessI(Log::sceMisc, sceSdSetMember_(*ctx, data, alignedLen)); } int sceSdSetMember_(pspChnnlsvContext2& ctx, u8* data, int alignedLen) @@ -500,8 +500,8 @@ int sceSdSetMember_(pspChnnlsvContext2& ctx, u8* data, int alignedLen) static int sceSdCleanList(u32 ctxAddr) { auto ctx = PSPPointer::Create(ctxAddr); if (!ctx.IsValid()) - return hleLogError(SCEMISC, 0, "Invalid pointer"); - return hleLogSuccessI(SCEMISC, sceSdCleanList_(*ctx)); + return hleLogError(Log::sceMisc, 0, "Invalid pointer"); + return hleLogSuccessI(Log::sceMisc, sceSdCleanList_(*ctx)); } int sceSdCleanList_(pspChnnlsvContext2& ctx) diff --git a/Core/HLE/sceCtrl.cpp b/Core/HLE/sceCtrl.cpp index d78b59033f..7bca2772fd 100644 --- a/Core/HLE/sceCtrl.cpp +++ b/Core/HLE/sceCtrl.cpp @@ -417,11 +417,11 @@ void __CtrlShutdown() static u32 sceCtrlSetSamplingCycle(u32 cycle) { - DEBUG_LOG(SCECTRL, "sceCtrlSetSamplingCycle(%u)", cycle); + DEBUG_LOG(Log::sceCtrl, "sceCtrlSetSamplingCycle(%u)", cycle); if ((cycle > 0 && cycle < 5555) || cycle > 20000) { - WARN_LOG(SCECTRL, "SCE_KERNEL_ERROR_INVALID_VALUE=sceCtrlSetSamplingCycle(%u)", cycle); + WARN_LOG(Log::sceCtrl, "SCE_KERNEL_ERROR_INVALID_VALUE=sceCtrlSetSamplingCycle(%u)", cycle); return SCE_KERNEL_ERROR_INVALID_VALUE; } @@ -438,7 +438,7 @@ static u32 sceCtrlSetSamplingCycle(u32 cycle) static int sceCtrlGetSamplingCycle(u32 cyclePtr) { - DEBUG_LOG(SCECTRL, "sceCtrlGetSamplingCycle(%08x)", cyclePtr); + DEBUG_LOG(Log::sceCtrl, "sceCtrlGetSamplingCycle(%08x)", cyclePtr); if (Memory::IsValidAddress(cyclePtr)) Memory::Write_U32(ctrlCycle, cyclePtr); return 0; @@ -448,7 +448,7 @@ static u32 sceCtrlSetSamplingMode(u32 mode) { u32 retVal = 0; - DEBUG_LOG(SCECTRL, "sceCtrlSetSamplingMode(%i)", mode); + DEBUG_LOG(Log::sceCtrl, "sceCtrlSetSamplingMode(%i)", mode); if (mode > 1) return SCE_KERNEL_ERROR_INVALID_MODE; @@ -460,7 +460,7 @@ static u32 sceCtrlSetSamplingMode(u32 mode) static int sceCtrlGetSamplingMode(u32 modePtr) { u32 retVal = analogEnabled == true ? CTRL_MODE_ANALOG : CTRL_MODE_DIGITAL; - DEBUG_LOG(SCECTRL, "%d=sceCtrlGetSamplingMode(%08x)", retVal, modePtr); + DEBUG_LOG(Log::sceCtrl, "%d=sceCtrlGetSamplingMode(%08x)", retVal, modePtr); if (Memory::IsValidAddress(modePtr)) Memory::Write_U32(retVal, modePtr); @@ -470,7 +470,7 @@ static int sceCtrlGetSamplingMode(u32 modePtr) static int sceCtrlSetIdleCancelThreshold(int idleReset, int idleBack) { - DEBUG_LOG(SCECTRL, "FAKE sceCtrlSetIdleCancelThreshold(%d, %d)", idleReset, idleBack); + DEBUG_LOG(Log::sceCtrl, "FAKE sceCtrlSetIdleCancelThreshold(%d, %d)", idleReset, idleBack); if (idleReset < -1 || idleBack < -1 || idleReset > 128 || idleBack > 128) return SCE_KERNEL_ERROR_INVALID_VALUE; @@ -482,7 +482,7 @@ static int sceCtrlSetIdleCancelThreshold(int idleReset, int idleBack) static int sceCtrlGetIdleCancelThreshold(u32 idleResetPtr, u32 idleBackPtr) { - DEBUG_LOG(SCECTRL, "sceCtrlSetIdleCancelThreshold(%08x, %08x)", idleResetPtr, idleBackPtr); + DEBUG_LOG(Log::sceCtrl, "sceCtrlSetIdleCancelThreshold(%08x, %08x)", idleResetPtr, idleBackPtr); if (idleResetPtr && !Memory::IsValidAddress(idleResetPtr)) return SCE_KERNEL_ERROR_PRIV_REQUIRED; @@ -503,13 +503,13 @@ static int sceCtrlReadBufferPositive(u32 ctrlDataPtr, u32 nBufs) hleEatCycles(330); if (done != 0) { - DEBUG_LOG(SCECTRL, "%d=sceCtrlReadBufferPositive(%08x, %i)", done, ctrlDataPtr, nBufs); + DEBUG_LOG(Log::sceCtrl, "%d=sceCtrlReadBufferPositive(%08x, %i)", done, ctrlDataPtr, nBufs); } else { waitingThreads.push_back(__KernelGetCurThread()); __KernelWaitCurThread(WAITTYPE_CTRL, CTRL_WAIT_POSITIVE, ctrlDataPtr, 0, false, "ctrl buffer waited"); - DEBUG_LOG(SCECTRL, "sceCtrlReadBufferPositive(%08x, %i) - waiting", ctrlDataPtr, nBufs); + DEBUG_LOG(Log::sceCtrl, "sceCtrlReadBufferPositive(%08x, %i) - waiting", ctrlDataPtr, nBufs); } return done; } @@ -520,13 +520,13 @@ static int sceCtrlReadBufferNegative(u32 ctrlDataPtr, u32 nBufs) hleEatCycles(330); if (done != 0) { - DEBUG_LOG(SCECTRL, "%d=sceCtrlReadBufferNegative(%08x, %i)", done, ctrlDataPtr, nBufs); + DEBUG_LOG(Log::sceCtrl, "%d=sceCtrlReadBufferNegative(%08x, %i)", done, ctrlDataPtr, nBufs); } else { waitingThreads.push_back(__KernelGetCurThread()); __KernelWaitCurThread(WAITTYPE_CTRL, CTRL_WAIT_NEGATIVE, ctrlDataPtr, 0, false, "ctrl buffer waited"); - DEBUG_LOG(SCECTRL, "sceCtrlReadBufferNegative(%08x, %i) - waiting", ctrlDataPtr, nBufs); + DEBUG_LOG(Log::sceCtrl, "sceCtrlReadBufferNegative(%08x, %i) - waiting", ctrlDataPtr, nBufs); } return done; } @@ -535,7 +535,7 @@ static int sceCtrlPeekBufferPositive(u32 ctrlDataPtr, u32 nBufs) { int done = __CtrlReadBuffer(ctrlDataPtr, nBufs, false, true); // Some homebrew call this in a tight loop - so VERBOSE it is. - VERBOSE_LOG(SCECTRL, "%d=sceCtrlPeekBufferPositive(%08x, %i)", done, ctrlDataPtr, nBufs); + VERBOSE_LOG(Log::sceCtrl, "%d=sceCtrlPeekBufferPositive(%08x, %i)", done, ctrlDataPtr, nBufs); hleEatCycles(330); return done; } @@ -544,7 +544,7 @@ static int sceCtrlPeekBufferNegative(u32 ctrlDataPtr, u32 nBufs) { int done = __CtrlReadBuffer(ctrlDataPtr, nBufs, true, true); // Some homebrew call this in a tight loop - so VERBOSE it is. - VERBOSE_LOG(SCECTRL, "%d=sceCtrlPeekBufferNegative(%08x, %i)", done, ctrlDataPtr, nBufs); + VERBOSE_LOG(Log::sceCtrl, "%d=sceCtrlPeekBufferNegative(%08x, %i)", done, ctrlDataPtr, nBufs); hleEatCycles(330); return done; } @@ -564,7 +564,7 @@ static u32 sceCtrlPeekLatch(u32 latchDataPtr) { if (userLatch.IsValid()) { __CtrlWriteUserLatch(userLatch, ctrlLatchBufs); } - return hleLogSuccessI(SCECTRL, ctrlLatchBufs); + return hleLogSuccessI(Log::sceCtrl, ctrlLatchBufs); } static u32 sceCtrlReadLatch(u32 latchDataPtr) { @@ -572,7 +572,7 @@ static u32 sceCtrlReadLatch(u32 latchDataPtr) { if (userLatch.IsValid()) { __CtrlWriteUserLatch(userLatch, ctrlLatchBufs); } - return hleLogSuccessI(SCECTRL, __CtrlResetLatch()); + return hleLogSuccessI(Log::sceCtrl, __CtrlResetLatch()); } static const HLEFunction sceCtrl[] = diff --git a/Core/HLE/sceDeflt.cpp b/Core/HLE/sceDeflt.cpp index d1a6da33e1..ba722e9a5c 100644 --- a/Core/HLE/sceDeflt.cpp +++ b/Core/HLE/sceDeflt.cpp @@ -27,12 +27,12 @@ // All the decompress functions are identical with only differing window bits. static int CommonDecompress(int windowBits, u32 OutBuffer, int OutBufferLength, u32 InBuffer, u32 Crc32Addr) { if (!Memory::IsValidAddress(OutBuffer) || !Memory::IsValidAddress(InBuffer)) { - return hleLogError(HLE, 0, "bad address"); + return hleLogError(Log::HLE, 0, "bad address"); } auto crc32Addr = PSPPointer::Create(Crc32Addr); if (Crc32Addr && !crc32Addr.IsValid()) { - return hleLogError(HLE, 0, "bad crc32 address"); + return hleLogError(Log::HLE, 0, "bad crc32 address"); } z_stream stream{}; @@ -45,13 +45,13 @@ static int CommonDecompress(int windowBits, u32 OutBuffer, int OutBufferLength, int err = inflateInit2(&stream, windowBits); if (err != Z_OK) { - return hleLogError(HLE, 0, "inflateInit2 failed %08x", err); + return hleLogError(Log::HLE, 0, "inflateInit2 failed %08x", err); } err = inflate(&stream, Z_FINISH); inflateEnd(&stream); if (err != Z_STREAM_END) { - return hleLogError(HLE, 0, "inflate failed %08x", err); + return hleLogError(Log::HLE, 0, "inflate failed %08x", err); } if (crc32Addr.IsValid()) { uLong crc = crc32(0L, Z_NULL, 0); @@ -65,7 +65,7 @@ static int CommonDecompress(int windowBits, u32 OutBuffer, int OutBufferLength, NotifyMemInfo(MemBlockFlags::WRITE, OutBuffer, stream.total_out, tagData, tagSize); } - return hleLogSuccessI(HLE, stream.total_out); + return hleLogSuccessI(Log::HLE, stream.total_out); } static int sceDeflateDecompress(u32 OutBuffer, int OutBufferLength, u32 InBuffer, u32 Crc32Addr) { diff --git a/Core/HLE/sceDisplay.cpp b/Core/HLE/sceDisplay.cpp index 55c3a62d1a..7283b4d814 100644 --- a/Core/HLE/sceDisplay.cpp +++ b/Core/HLE/sceDisplay.cpp @@ -316,12 +316,12 @@ void __DisplayVblankBeginCallback(SceUID threadID, SceUID prevCallbackId) { } if (waitData.threadID != threadID) { - WARN_LOG_REPORT(SCEDISPLAY, "sceDisplayWaitVblankCB: could not find waiting thread info."); + WARN_LOG_REPORT(Log::sceDisplay, "sceDisplayWaitVblankCB: could not find waiting thread info."); return; } vblankPausedWaits[pauseKey] = __DisplayGetVCount() + waitData.vcountUnblock; - DEBUG_LOG(SCEDISPLAY, "sceDisplayWaitVblankCB: Suspending vblank wait for callback"); + DEBUG_LOG(Log::sceDisplay, "sceDisplayWaitVblankCB: Suspending vblank wait for callback"); } void __DisplayVblankEndCallback(SceUID threadID, SceUID prevCallbackId) { @@ -342,7 +342,7 @@ void __DisplayVblankEndCallback(SceUID threadID, SceUID prevCallbackId) { // Still have to wait a bit longer. vblankWaitingThreads.push_back(WaitVBlankInfo(__KernelGetCurThread(), vcountUnblock - __DisplayGetVCount())); - DEBUG_LOG(SCEDISPLAY, "sceDisplayWaitVblankCB: Resuming vblank wait from callback"); + DEBUG_LOG(Log::sceDisplay, "sceDisplayWaitVblankCB: Resuming vblank wait from callback"); } void __DisplaySetWasPaused() { @@ -385,7 +385,7 @@ static void DoFrameDropLogging(float scaledTimestep) { char stats[4096]; __DisplayGetDebugStats(stats, sizeof(stats)); - NOTICE_LOG(SCEDISPLAY, "Dropping frames - budget = %.2fms / %.1ffps, actual = %.2fms (+%.2fms) / %.1ffps\n%s", scaledTimestep * 1000.0, 1.0 / scaledTimestep, actualTimestep * 1000.0, (actualTimestep - scaledTimestep) * 1000.0, 1.0 / actualTimestep, stats); + NOTICE_LOG(Log::sceDisplay, "Dropping frames - budget = %.2fms / %.1ffps, actual = %.2fms (+%.2fms) / %.1ffps\n%s", scaledTimestep * 1000.0, 1.0 / scaledTimestep, actualTimestep * 1000.0, (actualTimestep - scaledTimestep) * 1000.0, 1.0 / actualTimestep, stats); } } @@ -499,7 +499,7 @@ static void DoFrameIdleTiming() { void hleEnterVblank(u64 userdata, int cyclesLate) { int vbCount = userdata; - VERBOSE_LOG(SCEDISPLAY, "Enter VBlank %i", vbCount); + VERBOSE_LOG(Log::sceDisplay, "Enter VBlank %i", vbCount); DisplayFireVblankStart(); @@ -530,7 +530,7 @@ void hleEnterVblank(u64 userdata, int cyclesLate) { // TODO: Should this be done here or in hleLeaveVblank? if (framebufIsLatched) { - DEBUG_LOG(SCEDISPLAY, "Setting latched framebuffer %08x (prev: %08x)", latchedFramebuf.topaddr, framebuf.topaddr); + DEBUG_LOG(Log::sceDisplay, "Setting latched framebuffer %08x (prev: %08x)", latchedFramebuf.topaddr, framebuf.topaddr); framebuf = latchedFramebuf; framebufIsLatched = false; gpu->SetDisplayFramebuffer(framebuf.topaddr, framebuf.stride, framebuf.fmt); @@ -597,7 +597,7 @@ void __DisplayFlip(int cyclesLate) { } if (!FrameTimingThrottled()) { - // NOTICE_LOG(SYSTEM, "Throttle: %d %d", (int)fastForwardSkipFlip, (int)postEffectRequiresFlip); + // NOTICE_LOG(Log::System, "Throttle: %d %d", (int)fastForwardSkipFlip, (int)postEffectRequiresFlip); } const bool fbDirty = gpu->FramebufferDirty(); @@ -709,7 +709,7 @@ void hleAfterFlip(u64 userdata, int cyclesLate) { void hleLeaveVblank(u64 userdata, int cyclesLate) { flippedThisFrame = false; - VERBOSE_LOG(SCEDISPLAY,"Leave VBlank %i", (int)userdata - 1); + VERBOSE_LOG(Log::sceDisplay,"Leave VBlank %i", (int)userdata - 1); CoreTiming::ScheduleEvent(msToCycles(frameMs - vblankMs) - cyclesLate, enterVblankEvent, userdata); // Fire the vblank listeners after the vblank completes. @@ -761,7 +761,7 @@ void hleLagSync(u64 userdata, int cyclesLate) { } static u32 sceDisplayIsVblank() { - return hleLogSuccessI(SCEDISPLAY, DisplayIsVblank()); + return hleLogSuccessI(Log::sceDisplay, DisplayIsVblank()); } static int DisplayWaitForVblanks(const char *reason, int vblanks, bool callbacks = false) { @@ -777,7 +777,7 @@ static int DisplayWaitForVblanks(const char *reason, int vblanks, bool callbacks vblankWaitingThreads.push_back(WaitVBlankInfo(__KernelGetCurThread(), vblanks)); __KernelWaitCurThread(WAITTYPE_VBLANK, 1, 0, 0, callbacks, reason); - return hleLogSuccessVerboseI(SCEDISPLAY, 0, "waiting for %d vblanks", vblanks); + return hleLogSuccessVerboseI(Log::sceDisplay, 0, "waiting for %d vblanks", vblanks); } void __DisplayWaitForVblanks(const char* reason, int vblanks, bool callbacks) { @@ -786,13 +786,13 @@ void __DisplayWaitForVblanks(const char* reason, int vblanks, bool callbacks) { static u32 sceDisplaySetMode(int displayMode, int displayWidth, int displayHeight) { if (displayMode != PSP_DISPLAY_MODE_LCD || displayWidth != 480 || displayHeight != 272) { - WARN_LOG_REPORT(SCEDISPLAY, "Video out requested, not supported: mode=%d size=%d,%d", displayMode, displayWidth, displayHeight); + WARN_LOG_REPORT(Log::sceDisplay, "Video out requested, not supported: mode=%d size=%d,%d", displayMode, displayWidth, displayHeight); } if (displayMode != PSP_DISPLAY_MODE_LCD) { - return hleLogWarning(SCEDISPLAY, SCE_KERNEL_ERROR_INVALID_MODE, "invalid mode"); + return hleLogWarning(Log::sceDisplay, SCE_KERNEL_ERROR_INVALID_MODE, "invalid mode"); } if (displayWidth != 480 || displayHeight != 272) { - return hleLogWarning(SCEDISPLAY, SCE_KERNEL_ERROR_INVALID_SIZE, "invalid size"); + return hleLogWarning(Log::sceDisplay, SCE_KERNEL_ERROR_INVALID_SIZE, "invalid size"); } hasSetMode = true; @@ -800,7 +800,7 @@ static u32 sceDisplaySetMode(int displayMode, int displayWidth, int displayHeigh width = displayWidth; height = displayHeight; - hleLogSuccessI(SCEDISPLAY, 0); + hleLogSuccessI(Log::sceDisplay, 0); // On success, this implicitly waits for a vblank start. return DisplayWaitForVblanks("display mode", 1); } @@ -841,24 +841,24 @@ void __DisplaySetFramebuf(u32 topaddr, int linesize, int pixelFormat, int sync) // Some games (GTA) never call this during gameplay, so bad place to put a framerate counter. u32 sceDisplaySetFramebuf(u32 topaddr, int linesize, int pixelformat, int sync) { if (sync != PSP_DISPLAY_SETBUF_IMMEDIATE && sync != PSP_DISPLAY_SETBUF_NEXTFRAME) { - return hleLogError(SCEDISPLAY, SCE_KERNEL_ERROR_INVALID_MODE, "invalid sync mode"); + return hleLogError(Log::sceDisplay, SCE_KERNEL_ERROR_INVALID_MODE, "invalid sync mode"); } if (topaddr != 0 && !Memory::IsRAMAddress(topaddr) && !Memory::IsVRAMAddress(topaddr)) { - return hleLogError(SCEDISPLAY, SCE_KERNEL_ERROR_INVALID_POINTER, "invalid address"); + return hleLogError(Log::sceDisplay, SCE_KERNEL_ERROR_INVALID_POINTER, "invalid address"); } if ((topaddr & 0xF) != 0) { - return hleLogError(SCEDISPLAY, SCE_KERNEL_ERROR_INVALID_POINTER, "misaligned address"); + return hleLogError(Log::sceDisplay, SCE_KERNEL_ERROR_INVALID_POINTER, "misaligned address"); } if ((linesize & 0x3F) != 0 || (linesize == 0 && topaddr != 0)) { - return hleLogError(SCEDISPLAY, SCE_KERNEL_ERROR_INVALID_SIZE, "invalid stride"); + return hleLogError(Log::sceDisplay, SCE_KERNEL_ERROR_INVALID_SIZE, "invalid stride"); } if (pixelformat < 0 || pixelformat > GE_FORMAT_8888) { - return hleLogError(SCEDISPLAY, SCE_KERNEL_ERROR_INVALID_FORMAT, "invalid format"); + return hleLogError(Log::sceDisplay, SCE_KERNEL_ERROR_INVALID_FORMAT, "invalid format"); } if (sync == PSP_DISPLAY_SETBUF_IMMEDIATE) { if ((GEBufferFormat)pixelformat != latchedFramebuf.fmt || linesize != latchedFramebuf.stride) { - return hleReportError(SCEDISPLAY, SCE_KERNEL_ERROR_INVALID_MODE, "must change latched framebuf first"); + return hleReportError(Log::sceDisplay, SCE_KERNEL_ERROR_INVALID_MODE, "must change latched framebuf first"); } } @@ -905,12 +905,12 @@ u32 sceDisplaySetFramebuf(u32 topaddr, int linesize, int pixelformat, int sync) // Okay, the game is going at too high a frame rate. God of War and Fat Princess both do this. // Simply eating the cycles works and is fast, but breaks other games (like Jeanne d'Arc.) // So, instead, we delay this HLE thread only (a small deviation from correct behavior.) - return hleDelayResult(hleLogSuccessI(SCEDISPLAY, 0, "delaying frame thread"), "set framebuf", cyclesToUs(delayCycles)); + return hleDelayResult(hleLogSuccessI(Log::sceDisplay, 0, "delaying frame thread"), "set framebuf", cyclesToUs(delayCycles)); } else { if (topaddr == 0) { - return hleLogSuccessI(SCEDISPLAY, 0, "disabling display"); + return hleLogSuccessI(Log::sceDisplay, 0, "disabling display"); } else { - return hleLogSuccessI(SCEDISPLAY, 0); + return hleLogSuccessI(Log::sceDisplay, 0); } } } @@ -937,7 +937,7 @@ static u32 sceDisplayGetFramebuf(u32 topaddrPtr, u32 linesizePtr, u32 pixelForma if (Memory::IsValidAddress(pixelFormatPtr)) Memory::Write_U32(fbState.fmt, pixelFormatPtr); - return hleLogSuccessI(SCEDISPLAY, 0); + return hleLogSuccessI(Log::sceDisplay, 0); } static int DisplayWaitForVblanksCB(const char *reason, int vblanks) { @@ -954,18 +954,18 @@ static u32 sceDisplayWaitVblank() { } else { hleEatCycles(1110); hleReSchedule("vblank wait skipped"); - return hleLogSuccessI(SCEDISPLAY, 1, "not waiting since in vblank"); + return hleLogSuccessI(Log::sceDisplay, 1, "not waiting since in vblank"); } } static u32 sceDisplayWaitVblankStartMulti(int vblanks) { if (vblanks <= 0) { - return hleLogWarning(SCEDISPLAY, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid number of vblanks"); + return hleLogWarning(Log::sceDisplay, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid number of vblanks"); } if (!__KernelIsDispatchEnabled()) - return hleLogWarning(SCEDISPLAY, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogWarning(Log::sceDisplay, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); if (__IsInInterrupt()) - return hleLogWarning(SCEDISPLAY, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "in interrupt"); + return hleLogWarning(Log::sceDisplay, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "in interrupt"); return DisplayWaitForVblanks("vblank start multi waited", vblanks); } @@ -976,7 +976,7 @@ static u32 sceDisplayWaitVblankCB() { } else { hleEatCycles(1110); hleReSchedule("vblank wait skipped"); - return hleLogSuccessI(SCEDISPLAY, 1, "not waiting since in vblank"); + return hleLogSuccessI(Log::sceDisplay, 1, "not waiting since in vblank"); } } @@ -986,12 +986,12 @@ static u32 sceDisplayWaitVblankStartCB() { static u32 sceDisplayWaitVblankStartMultiCB(int vblanks) { if (vblanks <= 0) { - return hleLogWarning(SCEDISPLAY, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid number of vblanks"); + return hleLogWarning(Log::sceDisplay, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid number of vblanks"); } if (!__KernelIsDispatchEnabled()) - return hleLogWarning(SCEDISPLAY, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogWarning(Log::sceDisplay, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); if (__IsInInterrupt()) - return hleLogWarning(SCEDISPLAY, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "in interrupt"); + return hleLogWarning(Log::sceDisplay, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "in interrupt"); return DisplayWaitForVblanksCB("vblank start multi waited", vblanks); } @@ -999,17 +999,17 @@ static u32 sceDisplayWaitVblankStartMultiCB(int vblanks) { static u32 sceDisplayGetVcount() { hleEatCycles(150); hleReSchedule("get vcount"); - return hleLogSuccessVerboseI(SCEDISPLAY, __DisplayGetVCount()); + return hleLogSuccessVerboseI(Log::sceDisplay, __DisplayGetVCount()); } static u32 sceDisplayGetCurrentHcount() { hleEatCycles(275); - return hleLogSuccessI(SCEDISPLAY, __DisplayGetCurrentHcount()); + return hleLogSuccessI(Log::sceDisplay, __DisplayGetCurrentHcount()); } static int sceDisplayAdjustAccumulatedHcount(int value) { if (value < 0) { - return hleLogError(SCEDISPLAY, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid value"); + return hleLogError(Log::sceDisplay, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid value"); } // Since it includes the current hCount, find the difference to apply to the base. @@ -1017,24 +1017,24 @@ static int sceDisplayAdjustAccumulatedHcount(int value) { int diff = value - accumHCount; DisplayAdjustAccumulatedHcount(diff); - return hleLogSuccessI(SCEDISPLAY, 0); + return hleLogSuccessI(Log::sceDisplay, 0); } static int sceDisplayGetAccumulatedHcount() { u32 accumHCount = __DisplayGetAccumulatedHcount(); hleEatCycles(235); - return hleLogSuccessI(SCEDISPLAY, accumHCount); + return hleLogSuccessI(Log::sceDisplay, accumHCount); } static float sceDisplayGetFramePerSec() { const static float framePerSec = 59.9400599f; - VERBOSE_LOG(SCEDISPLAY,"%f=sceDisplayGetFramePerSec()", framePerSec); + VERBOSE_LOG(Log::sceDisplay,"%f=sceDisplayGetFramePerSec()", framePerSec); return framePerSec; // (9MHz * 1)/(525 * 286) } static u32 sceDisplayIsForeground() { int result = hasSetMode && framebuf.topaddr != 0 ? 1 : 0; - return hleLogSuccessI(SCEDISPLAY, result); + return hleLogSuccessI(Log::sceDisplay, result); } static u32 sceDisplayGetMode(u32 modeAddr, u32 widthAddr, u32 heightAddr) { @@ -1044,7 +1044,7 @@ static u32 sceDisplayGetMode(u32 modeAddr, u32 widthAddr, u32 heightAddr) { Memory::Write_U32(width, widthAddr); if (Memory::IsValidAddress(heightAddr)) Memory::Write_U32(height, heightAddr); - return hleLogSuccessI(SCEDISPLAY, 0); + return hleLogSuccessI(Log::sceDisplay, 0); } static u32 sceDisplayIsVsync() { @@ -1052,19 +1052,19 @@ static u32 sceDisplayIsVsync() { u64 start = DisplayFrameStartTicks() + msToCycles(vsyncStartMs); u64 end = DisplayFrameStartTicks() + msToCycles(vsyncEndMs); - return hleLogSuccessI(SCEDISPLAY, now >= start && now <= end ? 1 : 0); + return hleLogSuccessI(Log::sceDisplay, now >= start && now <= end ? 1 : 0); } static u32 sceDisplayGetResumeMode(u32 resumeModeAddr) { if (Memory::IsValidAddress(resumeModeAddr)) Memory::Write_U32(resumeMode, resumeModeAddr); - return hleLogSuccessI(SCEDISPLAY, 0); + return hleLogSuccessI(Log::sceDisplay, 0); } static u32 sceDisplaySetResumeMode(u32 rMode) { // Not sure what this does, seems to do nothing in tests and accept all values. resumeMode = rMode; - return hleReportError(SCEDISPLAY, 0, "unsupported"); + return hleReportError(Log::sceDisplay, 0, "unsupported"); } static u32 sceDisplayGetBrightness(u32 levelAddr, u32 otherAddr) { @@ -1077,19 +1077,19 @@ static u32 sceDisplayGetBrightness(u32 levelAddr, u32 otherAddr) { if (Memory::IsValidAddress(otherAddr)) { Memory::Write_U32(0, otherAddr); } - return hleLogWarning(SCEDISPLAY, 0); + return hleLogWarning(Log::sceDisplay, 0); } static u32 sceDisplaySetBrightness(int level, int other) { // Note: Only usable in kernel mode. brightnessLevel = level; - return hleLogWarning(SCEDISPLAY, 0); + return hleLogWarning(Log::sceDisplay, 0); } static u32 sceDisplaySetHoldMode(u32 hMode) { // Not sure what this does, seems to do nothing in tests and accept all values. holdMode = hMode; - return hleReportError(SCEDISPLAY, 0, "unsupported"); + return hleReportError(Log::sceDisplay, 0, "unsupported"); } const HLEFunction sceDisplay[] = { diff --git a/Core/HLE/sceDmac.cpp b/Core/HLE/sceDmac.cpp index 8feb1fc89e..01abc95a0c 100644 --- a/Core/HLE/sceDmac.cpp +++ b/Core/HLE/sceDmac.cpp @@ -73,24 +73,24 @@ static int __DmacMemcpy(u32 dst, u32 src, u32 size) { static u32 sceDmacMemcpy(u32 dst, u32 src, u32 size) { if (size == 0) { // Some games seem to do this frequently. - DEBUG_LOG(HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%i): invalid size", dst, src, size); + DEBUG_LOG(Log::HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%i): invalid size", dst, src, size); return SCE_KERNEL_ERROR_INVALID_SIZE; } if (!Memory::IsValidAddress(dst) || !Memory::IsValidAddress(src)) { - ERROR_LOG(HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%i): invalid address", dst, src, size); + ERROR_LOG(Log::HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%i): invalid address", dst, src, size); return SCE_KERNEL_ERROR_INVALID_POINTER; } if (dst + size >= 0x80000000 || src + size >= 0x80000000 || size >= 0x80000000) { - ERROR_LOG(HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%i): illegal size", dst, src, size); + ERROR_LOG(Log::HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%i): illegal size", dst, src, size); return SCE_KERNEL_ERROR_PRIV_REQUIRED; } if (dmacMemcpyDeadline > CoreTiming::GetTicks()) { - WARN_LOG_REPORT_ONCE(overlapDmacMemcpy, HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%d): overlapping read", dst, src, size); + WARN_LOG_REPORT_ONCE(overlapDmacMemcpy, Log::HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%d): overlapping read", dst, src, size); // TODO: Should block, seems like copy doesn't start until previous finishes. // Might matter for overlapping copies. } else { - DEBUG_LOG(HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%i)", dst, src, size); + DEBUG_LOG(Log::HLE, "sceDmacMemcpy(dest=%08x, src=%08x, size=%i)", dst, src, size); } return __DmacMemcpy(dst, src, size); @@ -98,23 +98,23 @@ static u32 sceDmacMemcpy(u32 dst, u32 src, u32 size) { static u32 sceDmacTryMemcpy(u32 dst, u32 src, u32 size) { if (size == 0) { - ERROR_LOG(HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i): invalid size", dst, src, size); + ERROR_LOG(Log::HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i): invalid size", dst, src, size); return SCE_KERNEL_ERROR_INVALID_SIZE; } if (!Memory::IsValidAddress(dst) || !Memory::IsValidAddress(src)) { - ERROR_LOG(HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i): invalid address", dst, src, size); + ERROR_LOG(Log::HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i): invalid address", dst, src, size); return SCE_KERNEL_ERROR_INVALID_POINTER; } if (dst + size >= 0x80000000 || src + size >= 0x80000000 || size >= 0x80000000) { - ERROR_LOG(HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i): illegal size", dst, src, size); + ERROR_LOG(Log::HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i): illegal size", dst, src, size); return SCE_KERNEL_ERROR_PRIV_REQUIRED; } if (dmacMemcpyDeadline > CoreTiming::GetTicks()) { - DEBUG_LOG(HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i): busy", dst, src, size); + DEBUG_LOG(Log::HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i): busy", dst, src, size); return SCE_KERNEL_ERROR_BUSY; } else { - DEBUG_LOG(HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i)", dst, src, size); + DEBUG_LOG(Log::HLE, "sceDmacTryMemcpy(dest=%08x, src=%08x, size=%i)", dst, src, size); } return __DmacMemcpy(dst, src, size); diff --git a/Core/HLE/sceFont.cpp b/Core/HLE/sceFont.cpp index cb729b672d..42377c3feb 100644 --- a/Core/HLE/sceFont.cpp +++ b/Core/HLE/sceFont.cpp @@ -319,7 +319,7 @@ public: Do(p, numInternalFonts); // It's okay if numInternalFonts was zero and we've now loaded them. if (numInternalFonts != (int)internalFonts.size() && numInternalFonts != 0) { - ERROR_LOG(SCEFONT, "Unable to load state: different internal font count."); + ERROR_LOG(Log::sceFont, "Unable to load state: different internal font count."); p.SetError(p.ERROR_FAILURE); return; } @@ -331,7 +331,7 @@ public: Do(p, font_); } else if (p.mode == p.MODE_READ) { if (internalFont < 0 || internalFont >= (int)internalFonts.size()) { - ERROR_LOG(SCEFONT, "Unable to load state: unexpected internal font index."); + ERROR_LOG(Log::sceFont, "Unable to load state: unexpected internal font index."); p.SetError(p.ERROR_FAILURE); return; } @@ -605,12 +605,12 @@ public: if (foundFontIndex < 0 || fontRefCount_[foundFontIndex] >= MAX_FONT_REFS) { error = ERROR_FONT_TOO_MANY_OPEN_FONTS; - hleLogError(SCEFONT, 0, "Too many fonts opened in FontLib"); + hleLogError(Log::sceFont, 0, "Too many fonts opened in FontLib"); return nullptr; } if (!font->IsValid()) { error = ERROR_FONT_INVALID_FONT_DATA; - hleLogError(SCEFONT, 0, "Invalid font data"); + hleLogError(Log::sceFont, 0, "Invalid font data"); return nullptr; } @@ -772,7 +772,7 @@ private: void PostAllocCallback::run(MipsCall &call) { - INFO_LOG(SCEFONT, "Entering PostAllocCallback::run"); + INFO_LOG(Log::sceFont, "Entering PostAllocCallback::run"); u32 v0 = currentMIPS->r[MIPS_REG_V0]; if (v0 == 0) { // TODO: Who deletes fontLib? @@ -786,7 +786,7 @@ void PostAllocCallback::run(MipsCall &call) { // This is the same as v0 above. call.setReturnValue(fontLib->handle()); } - INFO_LOG(SCEFONT, "Leaving PostAllocCallback::run"); + INFO_LOG(Log::sceFont, "Leaving PostAllocCallback::run"); } void PostOpenCallback::run(MipsCall &call) { @@ -848,11 +848,11 @@ static LoadedFont *GetLoadedFont(u32 handle, bool allowClosed) { if (iter->second->IsOpen() || allowClosed) { return fontMap[handle]; } else { - ERROR_LOG(SCEFONT, "Font exists but is closed, which was not allowed in this call."); + ERROR_LOG(Log::sceFont, "Font exists but is closed, which was not allowed in this call."); return 0; } } else { - ERROR_LOG(SCEFONT, "No font with handle %08x", handle); + ERROR_LOG(Log::sceFont, "No font with handle %08x", handle); return 0; } } @@ -875,12 +875,12 @@ static void __LoadInternalFonts() { std::string fontFilename = gameFontPath + entry.fileName; std::vector buffer; if (pspFileSystem.ReadEntireFile(fontFilename, buffer) < 0) { - ERROR_LOG(SCEFONT, "Failed opening font %s", fontFilename.c_str()); + ERROR_LOG(Log::sceFont, "Failed opening font %s", fontFilename.c_str()); continue; } - DEBUG_LOG(SCEFONT, "Loading internal font %s (%i bytes)", fontFilename.c_str(), (int)buffer.size()); + DEBUG_LOG(Log::sceFont, "Loading internal font %s (%i bytes)", fontFilename.c_str(), (int)buffer.size()); internalFonts.push_back(new Font(buffer, entry)); - DEBUG_LOG(SCEFONT, "Loaded font %s", fontFilename.c_str()); + DEBUG_LOG(Log::sceFont, "Loaded font %s", fontFilename.c_str()); return; } } @@ -906,12 +906,12 @@ static void __LoadInternalFonts() { } if (bufferRead) { - DEBUG_LOG(SCEFONT, "Loading internal font %s (%i bytes)", fontFilename.c_str(), (int)buffer.size()); + DEBUG_LOG(Log::sceFont, "Loading internal font %s (%i bytes)", fontFilename.c_str(), (int)buffer.size()); internalFonts.push_back(new Font(buffer, entry)); - DEBUG_LOG(SCEFONT, "Loaded font %s", fontFilename.c_str()); + DEBUG_LOG(Log::sceFont, "Loaded font %s", fontFilename.c_str()); } else if (!entry.ignoreIfMissing) { - WARN_LOG(SCEFONT, "Font file not found: %s", fontFilename.c_str()); + WARN_LOG(Log::sceFont, "Font file not found: %s", fontFilename.c_str()); } } } @@ -994,17 +994,17 @@ static u32 sceFontNewLib(u32 paramPtr, u32 errorCodePtr) { auto errorCode = PSPPointer::Create(errorCodePtr); if (!params.IsValid() || !errorCode.IsValid()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontNewLib(%08x, %08x): invalid addresses", paramPtr, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontNewLib(%08x, %08x): invalid addresses", paramPtr, errorCodePtr); // The PSP would crash in this situation, not a real error code. return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } if (!Memory::IsValidAddress(params->allocFuncAddr) || !Memory::IsValidAddress(params->freeFuncAddr)) { - ERROR_LOG_REPORT(SCEFONT, "sceFontNewLib(%08x, %08x): missing alloc func", paramPtr, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontNewLib(%08x, %08x): missing alloc func", paramPtr, errorCodePtr); *errorCode = ERROR_FONT_INVALID_PARAMETER; return 0; } - INFO_LOG(SCEFONT, "sceFontNewLib(%08x, %08x)", paramPtr, errorCodePtr); + INFO_LOG(Log::sceFont, "sceFontNewLib(%08x, %08x)", paramPtr, errorCodePtr); *errorCode = 0; FontLib *newLib = new FontLib(params, errorCodePtr); @@ -1019,10 +1019,10 @@ static int sceFontDoneLib(u32 fontLibHandle) { FontLib *fl = GetFontLib(fontLibHandle); if (fl) { fl->Done(); - return hleLogSuccessInfoI(SCEFONT, 0); + return hleLogSuccessInfoI(Log::sceFont, 0); } - return hleLogWarning(SCEFONT, 0, "invalid font lib"); + return hleLogWarning(Log::sceFont, 0, "invalid font lib"); } // Open internal font into a FontLib @@ -1030,17 +1030,17 @@ static u32 sceFontOpen(u32 libHandle, u32 index, u32 mode, u32 errorCodePtr) { auto errorCode = PSPPointer::Create(errorCodePtr); if (!errorCode.IsValid()) { // Would crash on the PSP. - return hleLogError(SCEFONT, -1, "invalid error address"); + return hleLogError(Log::sceFont, -1, "invalid error address"); } FontLib *fontLib = GetFontLib(libHandle); if (!fontLib) { *errorCode = ERROR_FONT_INVALID_LIBID; - return hleLogDebug(SCEFONT, 0, "invalid font lib"); + return hleLogDebug(Log::sceFont, 0, "invalid font lib"); } if (index >= internalFonts.size()) { *errorCode = ERROR_FONT_INVALID_PARAMETER; - return hleLogDebug(SCEFONT, 0, "invalid font index"); + return hleLogDebug(Log::sceFont, 0, "invalid font index"); } FontOpenMode openMode = mode != 1 ? FONT_OPEN_INTERNAL_STINGY : FONT_OPEN_INTERNAL_FULL; @@ -1049,8 +1049,8 @@ static u32 sceFontOpen(u32 libHandle, u32 index, u32 mode, u32 errorCodePtr) { *errorCode = 0; // Delay only on the first open. if (fontLib->GetFontRefCount(internalFonts[index]) == 1) - return hleDelayResult(hleLogSuccessX(SCEFONT, font->Handle()), "font open", 10000); - return hleLogSuccessX(SCEFONT, font->Handle()); + return hleDelayResult(hleLogSuccessX(Log::sceFont, font->Handle()), "font open", 10000); + return hleLogSuccessX(Log::sceFont, font->Handle()); } return 0; } @@ -1059,21 +1059,21 @@ static u32 sceFontOpen(u32 libHandle, u32 index, u32 mode, u32 errorCodePtr) { static u32 sceFontOpenUserMemory(u32 libHandle, u32 memoryFontPtr, u32 memoryFontLength, u32 errorCodePtr) { auto errorCode = PSPPointer::Create(errorCodePtr); if (!errorCode.IsValid()) { - return hleReportError(SCEFONT, -1, "invalid error address"); + return hleReportError(Log::sceFont, -1, "invalid error address"); } if (!Memory::IsValidAddress(memoryFontPtr)) { *errorCode = ERROR_FONT_INVALID_PARAMETER; - return hleReportError(SCEFONT, 0, "invalid address"); + return hleReportError(Log::sceFont, 0, "invalid address"); } FontLib *fontLib = GetFontLib(libHandle); if (!fontLib) { *errorCode = ERROR_FONT_INVALID_LIBID; - return hleReportError(SCEFONT, 0, "invalid font lib"); + return hleReportError(Log::sceFont, 0, "invalid font lib"); } if (memoryFontLength == 0) { *errorCode = ERROR_FONT_INVALID_PARAMETER; - return hleReportError(SCEFONT, 0, "invalid size"); + return hleReportError(Log::sceFont, 0, "invalid size"); } const u8 *fontData = Memory::GetPointer(memoryFontPtr); @@ -1088,7 +1088,7 @@ static u32 sceFontOpenUserMemory(u32 libHandle, u32 memoryFontPtr, u32 memoryFon LoadedFont *font = fontLib->OpenFont(f, FONT_OPEN_USERBUFFER, *errorCode); if (font) { *errorCode = 0; - return hleLogSuccessX(SCEFONT, font->Handle()); + return hleLogSuccessX(Log::sceFont, font->Handle()); } delete f; return 0; @@ -1098,29 +1098,29 @@ static u32 sceFontOpenUserMemory(u32 libHandle, u32 memoryFontPtr, u32 memoryFon static u32 sceFontOpenUserFile(u32 libHandle, const char *fileName, u32 mode, u32 errorCodePtr) { auto errorCode = PSPPointer::Create(errorCodePtr); if (!errorCode.IsValid()) { - return hleReportError(SCEFONT, ERROR_FONT_INVALID_PARAMETER, "invalid error address"); + return hleReportError(Log::sceFont, ERROR_FONT_INVALID_PARAMETER, "invalid error address"); } if (!fileName) { *errorCode = ERROR_FONT_INVALID_PARAMETER; - return hleReportError(SCEFONT, 0, "invalid filename"); + return hleReportError(Log::sceFont, 0, "invalid filename"); } FontLib *fontLib = GetFontLib(libHandle); if (!fontLib) { *errorCode = ERROR_FONT_INVALID_LIBID; - return hleReportError(SCEFONT, 0, "invalid font lib"); + return hleReportError(Log::sceFont, 0, "invalid font lib"); } // TODO: Technically, we only do this if mode = 1. Mode 0 uses the handlers. if (mode != 1) { - WARN_LOG_REPORT(SCEFONT, "Loading file directly instead of using handlers: %s", fileName); + WARN_LOG_REPORT(Log::sceFont, "Loading file directly instead of using handlers: %s", fileName); } std::vector buffer; if (pspFileSystem.ReadEntireFile(fileName, buffer) != 0) { *errorCode = ERROR_FONT_HANDLER_OPEN_FAILED; - return hleLogError(SCEFONT, 0, "file does not exist"); + return hleLogError(Log::sceFont, 0, "file does not exist"); } Font *f = new Font(buffer); @@ -1128,7 +1128,7 @@ static u32 sceFontOpenUserFile(u32 libHandle, const char *fileName, u32 mode, u3 LoadedFont *font = fontLib->OpenFont(f, openMode, *errorCode); if (font) { *errorCode = 0; - return hleLogSuccessInfoX(SCEFONT, font->Handle()); + return hleLogSuccessInfoX(Log::sceFont, font->Handle()); } delete f; @@ -1139,36 +1139,36 @@ static u32 sceFontOpenUserFile(u32 libHandle, const char *fileName, u32 mode, u3 static int sceFontClose(u32 fontHandle) { LoadedFont *font = GetLoadedFont(fontHandle, false); if (font) { - DEBUG_LOG(SCEFONT, "sceFontClose(%x)", fontHandle); + DEBUG_LOG(Log::sceFont, "sceFontClose(%x)", fontHandle); FontLib *fontLib = font->GetFontLib(); if (fontLib) { fontLib->CloseFont(font, false); } } else - ERROR_LOG(SCEFONT, "sceFontClose(%x) - font not open?", fontHandle); + ERROR_LOG(Log::sceFont, "sceFontClose(%x) - font not open?", fontHandle); return 0; } static int sceFontFindOptimumFont(u32 libHandle, u32 fontStylePtr, u32 errorCodePtr) { auto errorCode = PSPPointer::Create(errorCodePtr); if (!errorCode.IsValid()) { - return hleReportError(SCEFONT, SCE_KERNEL_ERROR_INVALID_ARGUMENT, "invalid error address"); + return hleReportError(Log::sceFont, SCE_KERNEL_ERROR_INVALID_ARGUMENT, "invalid error address"); } FontLib *fontLib = GetFontLib(libHandle); if (!fontLib) { *errorCode = ERROR_FONT_INVALID_LIBID; - return hleReportError(SCEFONT, 0, "invalid font lib"); + return hleReportError(Log::sceFont, 0, "invalid font lib"); } if (!Memory::IsValidAddress(fontStylePtr)) { // Yes, actually. Must've been a typo in the library. *errorCode = ERROR_FONT_INVALID_LIBID; - return hleReportError(SCEFONT, 0, "invalid style address"); + return hleReportError(Log::sceFont, 0, "invalid style address"); } auto requestedStyle = PSPPointer::Create(fontStylePtr); - DEBUG_LOG(SCEFONT, "requestedStyle fontAttributes %i,fontCountry %i,fontExpire %i,fontFamily %i,fontFileName %s,fontH %f,fontHRes %f,fontLanguage %i,fontName %s,fontRegion %i,fontStyle %i,fontStyleSub %i,fontV %f,fontVRes %f,fontWeight %f", requestedStyle->fontAttributes, requestedStyle->fontCountry, requestedStyle->fontExpire, requestedStyle->fontFamily, requestedStyle->fontFileName, requestedStyle->fontH, requestedStyle->fontHRes, requestedStyle->fontLanguage, requestedStyle->fontName, requestedStyle->fontRegion, requestedStyle->fontStyle, requestedStyle->fontStyleSub, requestedStyle->fontV, requestedStyle->fontVRes, requestedStyle->fontWeight); + DEBUG_LOG(Log::sceFont, "requestedStyle fontAttributes %i,fontCountry %i,fontExpire %i,fontFamily %i,fontFileName %s,fontH %f,fontHRes %f,fontLanguage %i,fontName %s,fontRegion %i,fontStyle %i,fontStyleSub %i,fontV %f,fontVRes %f,fontWeight %f", requestedStyle->fontAttributes, requestedStyle->fontCountry, requestedStyle->fontExpire, requestedStyle->fontFamily, requestedStyle->fontFileName, requestedStyle->fontH, requestedStyle->fontHRes, requestedStyle->fontLanguage, requestedStyle->fontName, requestedStyle->fontRegion, requestedStyle->fontStyle, requestedStyle->fontStyleSub, requestedStyle->fontV, requestedStyle->fontVRes, requestedStyle->fontWeight); // Find the first nearest match for H/V, OR the last exact match for others. float hRes = requestedStyle->fontHRes > 0.0f ? (float)requestedStyle->fontHRes : fontLib->FontHRes(); @@ -1218,10 +1218,10 @@ static int sceFontFindOptimumFont(u32 libHandle, u32 fontStylePtr, u32 errorCode } if (optimumFont) { *errorCode = 0; - return hleLogSuccessInfoX(SCEFONT, GetInternalFontIndex(optimumFont) ,""); + return hleLogSuccessInfoX(Log::sceFont, GetInternalFontIndex(optimumFont) ,""); } else { *errorCode = 0; - return hleLogSuccessInfoX(SCEFONT, 0, ""); + return hleLogSuccessInfoX(Log::sceFont, 0, ""); } } @@ -1229,27 +1229,27 @@ static int sceFontFindOptimumFont(u32 libHandle, u32 fontStylePtr, u32 errorCode static int sceFontFindFont(u32 libHandle, u32 fontStylePtr, u32 errorCodePtr) { auto errorCode = PSPPointer::Create(errorCodePtr); if (!errorCode.IsValid()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontFindFont(%x, %x, %x): invalid error address", libHandle, fontStylePtr, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontFindFont(%x, %x, %x): invalid error address", libHandle, fontStylePtr, errorCodePtr); return SCE_KERNEL_ERROR_INVALID_ARGUMENT; } FontLib *fontLib = GetFontLib(libHandle); if (!fontLib) { - ERROR_LOG_REPORT(SCEFONT, "sceFontFindFont(%08x, %08x, %08x): invalid font lib", libHandle, fontStylePtr, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontFindFont(%08x, %08x, %08x): invalid font lib", libHandle, fontStylePtr, errorCodePtr); *errorCode = ERROR_FONT_INVALID_LIBID; return 0; } if (!Memory::IsValidAddress(fontStylePtr)) { - ERROR_LOG_REPORT(SCEFONT, "sceFontFindFont(%08x, %08x, %08x): invalid style address", libHandle, fontStylePtr, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontFindFont(%08x, %08x, %08x): invalid style address", libHandle, fontStylePtr, errorCodePtr); *errorCode = ERROR_FONT_INVALID_PARAMETER; return 0; } - DEBUG_LOG(SCEFONT, "sceFontFindFont(%x, %x, %x)", libHandle, fontStylePtr, errorCodePtr); + DEBUG_LOG(Log::sceFont, "sceFontFindFont(%x, %x, %x)", libHandle, fontStylePtr, errorCodePtr); auto requestedStyle = PSPPointer::Create(fontStylePtr); - DEBUG_LOG(SCEFONT, "requestedStyle fontAttributes %i,fontCountry %i,fontExpire %i,fontFamily %i,fontFileName %s,fontH %f,fontHRes %f,fontLanguage %i,fontName %s,fontRegion %i,fontStyle %i,fontStyleSub %i,fontV %f,fontVRes %f,fontWeight %f", requestedStyle->fontAttributes, requestedStyle->fontCountry, requestedStyle->fontExpire, requestedStyle->fontFamily, requestedStyle->fontFileName, requestedStyle->fontH, requestedStyle->fontHRes, requestedStyle->fontLanguage, requestedStyle->fontName, requestedStyle->fontRegion, requestedStyle->fontStyle, requestedStyle->fontStyleSub, requestedStyle->fontV, requestedStyle->fontVRes, requestedStyle->fontWeight); + DEBUG_LOG(Log::sceFont, "requestedStyle fontAttributes %i,fontCountry %i,fontExpire %i,fontFamily %i,fontFileName %s,fontH %f,fontHRes %f,fontLanguage %i,fontName %s,fontRegion %i,fontStyle %i,fontStyleSub %i,fontV %f,fontVRes %f,fontWeight %f", requestedStyle->fontAttributes, requestedStyle->fontCountry, requestedStyle->fontExpire, requestedStyle->fontFamily, requestedStyle->fontFileName, requestedStyle->fontH, requestedStyle->fontHRes, requestedStyle->fontLanguage, requestedStyle->fontName, requestedStyle->fontRegion, requestedStyle->fontStyle, requestedStyle->fontStyleSub, requestedStyle->fontV, requestedStyle->fontVRes, requestedStyle->fontWeight); // Find the closest exact match for the fields specified. float hRes = requestedStyle->fontHRes > 0.0f ? (float)requestedStyle->fontHRes : fontLib->FontHRes(); @@ -1276,16 +1276,16 @@ static int sceFontFindFont(u32 libHandle, u32 fontStylePtr, u32 errorCodePtr) { static int sceFontGetFontInfo(u32 fontHandle, u32 fontInfoPtr) { if (!Memory::IsValidAddress(fontInfoPtr)) { - ERROR_LOG(SCEFONT, "sceFontGetFontInfo(%x, %x): bad fontInfo pointer", fontHandle, fontInfoPtr); + ERROR_LOG(Log::sceFont, "sceFontGetFontInfo(%x, %x): bad fontInfo pointer", fontHandle, fontInfoPtr); return ERROR_FONT_INVALID_PARAMETER; } LoadedFont *font = GetLoadedFont(fontHandle, true); if (!font) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetFontInfo(%x, %x): bad font", fontHandle, fontInfoPtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetFontInfo(%x, %x): bad font", fontHandle, fontInfoPtr); return ERROR_FONT_INVALID_PARAMETER; } - DEBUG_LOG(SCEFONT, "sceFontGetFontInfo(%x, %x)", fontHandle, fontInfoPtr); + DEBUG_LOG(Log::sceFont, "sceFontGetFontInfo(%x, %x)", fontHandle, fontInfoPtr); auto fi = PSPPointer::Create(fontInfoPtr); font->GetPGF()->GetFontInfo(fi); fi->fontStyle = font->GetFont()->GetFontStyle(); @@ -1298,19 +1298,19 @@ static int sceFontGetFontInfoByIndexNumber(u32 libHandle, u32 fontInfoPtr, u32 i auto fontStyle = PSPPointer::Create(fontInfoPtr); FontLib *fl = GetFontLib(libHandle); if (!fl || fl->handle() == 0) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetFontInfoByIndexNumber(%08x, %08x, %i): invalid font lib", libHandle, fontInfoPtr, index); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetFontInfoByIndexNumber(%08x, %08x, %i): invalid font lib", libHandle, fontInfoPtr, index); return !fl ? ERROR_FONT_INVALID_LIBID : ERROR_FONT_INVALID_PARAMETER; } if (index >= internalFonts.size()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetFontInfoByIndexNumber(%08x, %08x, %i): invalid font index", libHandle, fontInfoPtr, index); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetFontInfoByIndexNumber(%08x, %08x, %i): invalid font index", libHandle, fontInfoPtr, index); return ERROR_FONT_INVALID_PARAMETER; } if (!fontStyle.IsValid()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetFontInfoByIndexNumber(%08x, %08x, %i): invalid info pointer", libHandle, fontInfoPtr, index); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetFontInfoByIndexNumber(%08x, %08x, %i): invalid info pointer", libHandle, fontInfoPtr, index); return ERROR_FONT_INVALID_PARAMETER; } - DEBUG_LOG(SCEFONT, "sceFontGetFontInfoByIndexNumber(%08x, %08x, %i)", libHandle, fontInfoPtr, index); + DEBUG_LOG(Log::sceFont, "sceFontGetFontInfoByIndexNumber(%08x, %08x, %i)", libHandle, fontInfoPtr, index); auto font = internalFonts[index]; *fontStyle = font->GetFontStyle(); @@ -1320,17 +1320,17 @@ static int sceFontGetFontInfoByIndexNumber(u32 libHandle, u32 fontInfoPtr, u32 i static int sceFontGetCharInfo(u32 fontHandle, u32 charCode, u32 charInfoPtr) { charCode &= 0xffff; if (!Memory::IsValidAddress(charInfoPtr)) { - ERROR_LOG(SCEFONT, "sceFontGetCharInfo(%08x, %i, %08x): bad charInfo pointer", fontHandle, charCode, charInfoPtr); + ERROR_LOG(Log::sceFont, "sceFontGetCharInfo(%08x, %i, %08x): bad charInfo pointer", fontHandle, charCode, charInfoPtr); return ERROR_FONT_INVALID_PARAMETER; } LoadedFont *font = GetLoadedFont(fontHandle, true); if (!font) { // The PSP crashes, but we assume it'd work like sceFontGetFontInfo(), and not touch charInfo. - ERROR_LOG_REPORT(SCEFONT, "sceFontGetCharInfo(%08x, %i, %08x): bad font", fontHandle, charCode, charInfoPtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetCharInfo(%08x, %i, %08x): bad font", fontHandle, charCode, charInfoPtr); return ERROR_FONT_INVALID_PARAMETER; } - DEBUG_LOG(SCEFONT, "sceFontGetCharInfo(%08x, %i, %08x)", fontHandle, charCode, charInfoPtr); + DEBUG_LOG(Log::sceFont, "sceFontGetCharInfo(%08x, %i, %08x)", fontHandle, charCode, charInfoPtr); auto charInfo = PSPPointer::Create(charInfoPtr); font->GetCharInfo(charCode, charInfo); @@ -1361,16 +1361,16 @@ static int sceFontGetCharInfo(u32 fontHandle, u32 charCode, u32 charInfoPtr) { static int sceFontGetShadowInfo(u32 fontHandle, u32 charCode, u32 charInfoPtr) { charCode &= 0xffff; if (!Memory::IsValidAddress(charInfoPtr)) { - ERROR_LOG(SCEFONT, "sceFontGetShadowInfo(%08x, %i, %08x): bad charInfo pointer", fontHandle, charCode, charInfoPtr); + ERROR_LOG(Log::sceFont, "sceFontGetShadowInfo(%08x, %i, %08x): bad charInfo pointer", fontHandle, charCode, charInfoPtr); return ERROR_FONT_INVALID_PARAMETER; } LoadedFont *font = GetLoadedFont(fontHandle, true); if (!font) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetShadowInfo(%08x, %i, %08x): bad font", fontHandle, charCode, charInfoPtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetShadowInfo(%08x, %i, %08x): bad font", fontHandle, charCode, charInfoPtr); return ERROR_FONT_INVALID_PARAMETER; } - DEBUG_LOG(SCEFONT, "sceFontGetShadowInfo(%08x, %i, %08x)", fontHandle, charCode, charInfoPtr); + DEBUG_LOG(Log::sceFont, "sceFontGetShadowInfo(%08x, %i, %08x)", fontHandle, charCode, charInfoPtr); auto charInfo = PSPPointer::Create(charInfoPtr); font->GetCharInfo(charCode, charInfo, FONT_PGF_SHADOWGLYPH); @@ -1382,15 +1382,15 @@ static int sceFontGetCharImageRect(u32 fontHandle, u32 charCode, u32 charRectPtr auto charRect = PSPPointer::Create(charRectPtr); LoadedFont *font = GetLoadedFont(fontHandle, true); if (!font) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetCharImageRect(%08x, %i, %08x): bad font", fontHandle, charCode, charRectPtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetCharImageRect(%08x, %i, %08x): bad font", fontHandle, charCode, charRectPtr); return ERROR_FONT_INVALID_PARAMETER; } if (!charRect.IsValid()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetCharImageRect(%08x, %i, %08x): invalid rect pointer", fontHandle, charCode, charRectPtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetCharImageRect(%08x, %i, %08x): invalid rect pointer", fontHandle, charCode, charRectPtr); return ERROR_FONT_INVALID_PARAMETER; } - DEBUG_LOG(SCEFONT, "sceFontGetCharImageRect(%08x, %i, %08x)", fontHandle, charCode, charRectPtr); + DEBUG_LOG(Log::sceFont, "sceFontGetCharImageRect(%08x, %i, %08x)", fontHandle, charCode, charRectPtr); PGFCharInfo charInfo; font->GetCharInfo(charCode, &charInfo); charRect->width = charInfo.bitmapWidth; @@ -1403,15 +1403,15 @@ static int sceFontGetShadowImageRect(u32 fontHandle, u32 charCode, u32 charRectP auto charRect = PSPPointer::Create(charRectPtr); LoadedFont *font = GetLoadedFont(fontHandle, true); if (!font) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetShadowImageRect(%08x, %i, %08x): bad font", fontHandle, charCode, charRectPtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetShadowImageRect(%08x, %i, %08x): bad font", fontHandle, charCode, charRectPtr); return ERROR_FONT_INVALID_PARAMETER; } if (!charRect.IsValid()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetShadowImageRect(%08x, %i, %08x): invalid rect pointer", fontHandle, charCode, charRectPtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetShadowImageRect(%08x, %i, %08x): invalid rect pointer", fontHandle, charCode, charRectPtr); return ERROR_FONT_INVALID_PARAMETER; } - DEBUG_LOG(SCEFONT, "sceFontGetShadowImageRect(%08x, %i, %08x)", fontHandle, charCode, charRectPtr); + DEBUG_LOG(Log::sceFont, "sceFontGetShadowImageRect(%08x, %i, %08x)", fontHandle, charCode, charRectPtr); PGFCharInfo charInfo; font->GetCharInfo(charCode, &charInfo, FONT_PGF_SHADOWGLYPH); charRect->width = charInfo.bitmapWidth; @@ -1422,16 +1422,16 @@ static int sceFontGetShadowImageRect(u32 fontHandle, u32 charCode, u32 charRectP static int sceFontGetCharGlyphImage(u32 fontHandle, u32 charCode, u32 glyphImagePtr) { charCode &= 0xffff; if (!Memory::IsValidAddress(glyphImagePtr)) { - ERROR_LOG(SCEFONT, "sceFontGetCharGlyphImage(%x, %x, %x): bad glyphImage pointer", fontHandle, charCode, glyphImagePtr); + ERROR_LOG(Log::sceFont, "sceFontGetCharGlyphImage(%x, %x, %x): bad glyphImage pointer", fontHandle, charCode, glyphImagePtr); return ERROR_FONT_INVALID_PARAMETER; } LoadedFont *font = GetLoadedFont(fontHandle, true); if (!font) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetCharGlyphImage(%x, %x, %x): bad font", fontHandle, charCode, glyphImagePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetCharGlyphImage(%x, %x, %x): bad font", fontHandle, charCode, glyphImagePtr); return ERROR_FONT_INVALID_PARAMETER; } - DEBUG_LOG(SCEFONT, "sceFontGetCharGlyphImage(%x, %x, %x)", fontHandle, charCode, glyphImagePtr); + DEBUG_LOG(Log::sceFont, "sceFontGetCharGlyphImage(%x, %x, %x)", fontHandle, charCode, glyphImagePtr); auto glyph = PSPPointer::Create(glyphImagePtr); font->DrawCharacter(glyph, -1, -1, -1, -1, charCode, FONT_PGF_CHARGLYPH); return 0; @@ -1440,16 +1440,16 @@ static int sceFontGetCharGlyphImage(u32 fontHandle, u32 charCode, u32 glyphImage static int sceFontGetCharGlyphImage_Clip(u32 fontHandle, u32 charCode, u32 glyphImagePtr, int clipXPos, int clipYPos, int clipWidth, int clipHeight) { charCode &= 0xffff; if (!Memory::IsValidAddress(glyphImagePtr)) { - ERROR_LOG(SCEFONT, "sceFontGetCharGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i): bad glyphImage pointer", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); + ERROR_LOG(Log::sceFont, "sceFontGetCharGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i): bad glyphImage pointer", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); return ERROR_FONT_INVALID_PARAMETER; } LoadedFont *font = GetLoadedFont(fontHandle, true); if (!font) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetCharGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i): bad font", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetCharGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i): bad font", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); return ERROR_FONT_INVALID_PARAMETER; } - DEBUG_LOG(SCEFONT, "sceFontGetCharGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i)", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); + DEBUG_LOG(Log::sceFont, "sceFontGetCharGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i)", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); auto glyph = PSPPointer::Create(glyphImagePtr); font->DrawCharacter(glyph, clipXPos, clipYPos, clipWidth, clipHeight, charCode, FONT_PGF_CHARGLYPH); return 0; @@ -1459,21 +1459,21 @@ static int sceFontSetAltCharacterCode(u32 fontLibHandle, u32 charCode) { charCode &= 0xffff; FontLib *fl = GetFontLib(fontLibHandle); if (!fl) { - ERROR_LOG_REPORT(SCEFONT, "sceFontSetAltCharacterCode(%08x, %08x): invalid font lib", fontLibHandle, charCode); + ERROR_LOG_REPORT(Log::sceFont, "sceFontSetAltCharacterCode(%08x, %08x): invalid font lib", fontLibHandle, charCode); return ERROR_FONT_INVALID_LIBID; } - INFO_LOG(SCEFONT, "sceFontSetAltCharacterCode(%08x, %08x)", fontLibHandle, charCode); + INFO_LOG(Log::sceFont, "sceFontSetAltCharacterCode(%08x, %08x)", fontLibHandle, charCode); fl->SetAltCharCode(charCode & 0xFFFF); return 0; } static int sceFontFlush(u32 fontHandle) { - INFO_LOG(SCEFONT, "sceFontFlush(%i)", fontHandle); + INFO_LOG(Log::sceFont, "sceFontFlush(%i)", fontHandle); LoadedFont *font = GetLoadedFont(fontHandle, true); if (!font) { - ERROR_LOG_REPORT(SCEFONT, "sceFontFlush(%08x): bad font", fontHandle); + ERROR_LOG_REPORT(Log::sceFont, "sceFontFlush(%08x): bad font", fontHandle); return ERROR_FONT_INVALID_PARAMETER; } @@ -1489,15 +1489,15 @@ static int sceFontGetFontList(u32 fontLibHandle, u32 fontStylePtr, int numFonts) auto fontStyles = PSPPointer::Create(fontStylePtr); FontLib *fl = GetFontLib(fontLibHandle); if (!fl) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetFontList(%08x, %08x, %i): invalid font lib", fontLibHandle, fontStylePtr, numFonts); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetFontList(%08x, %08x, %i): invalid font lib", fontLibHandle, fontStylePtr, numFonts); return ERROR_FONT_INVALID_LIBID; } if (!fontStyles.IsValid()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetFontList(%08x, %08x, %i): invalid style pointer", fontLibHandle, fontStylePtr, numFonts); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetFontList(%08x, %08x, %i): invalid style pointer", fontLibHandle, fontStylePtr, numFonts); return ERROR_FONT_INVALID_PARAMETER; } - DEBUG_LOG(SCEFONT, "sceFontGetFontList(%08x, %08x, %i)", fontLibHandle, fontStylePtr, numFonts); + DEBUG_LOG(Log::sceFont, "sceFontGetFontList(%08x, %08x, %i)", fontLibHandle, fontStylePtr, numFonts); if (fl->handle() != 0) { numFonts = std::min(numFonts, (int)internalFonts.size()); for (int i = 0; i < numFonts; i++) @@ -1510,16 +1510,16 @@ static int sceFontGetFontList(u32 fontLibHandle, u32 fontStylePtr, int numFonts) static int sceFontGetNumFontList(u32 fontLibHandle, u32 errorCodePtr) { auto errorCode = PSPPointer::Create(errorCodePtr); if (!errorCode.IsValid()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetNumFontList(%08x, %08x): invalid error address", fontLibHandle, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetNumFontList(%08x, %08x): invalid error address", fontLibHandle, errorCodePtr); return ERROR_FONT_INVALID_PARAMETER; } FontLib *fl = GetFontLib(fontLibHandle); if (!fl) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetNumFontList(%08x, %08x): invalid font lib", fontLibHandle, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetNumFontList(%08x, %08x): invalid font lib", fontLibHandle, errorCodePtr); *errorCode = ERROR_FONT_INVALID_LIBID; return 0; } - DEBUG_LOG(SCEFONT, "sceFontGetNumFontList(%08x, %08x)", fontLibHandle, errorCodePtr); + DEBUG_LOG(Log::sceFont, "sceFontGetNumFontList(%08x, %08x)", fontLibHandle, errorCodePtr); *errorCode = 0; return fl->handle() == 0 ? 0 : (int)internalFonts.size(); } @@ -1527,14 +1527,14 @@ static int sceFontGetNumFontList(u32 fontLibHandle, u32 errorCodePtr) { static int sceFontSetResolution(u32 fontLibHandle, float hRes, float vRes) { FontLib *fl = GetFontLib(fontLibHandle); if (!fl) { - ERROR_LOG_REPORT(SCEFONT, "sceFontSetResolution(%08x, %f, %f): invalid font lib", fontLibHandle, hRes, vRes); + ERROR_LOG_REPORT(Log::sceFont, "sceFontSetResolution(%08x, %f, %f): invalid font lib", fontLibHandle, hRes, vRes); return ERROR_FONT_INVALID_LIBID; } if (hRes <= 0.0f || vRes <= 0.0f) { - ERROR_LOG_REPORT(SCEFONT, "sceFontSetResolution(%08x, %f, %f): negative value", fontLibHandle, hRes, vRes); + ERROR_LOG_REPORT(Log::sceFont, "sceFontSetResolution(%08x, %f, %f): negative value", fontLibHandle, hRes, vRes); return ERROR_FONT_INVALID_PARAMETER; } - INFO_LOG(SCEFONT, "sceFontSetResolution(%08x, %f, %f)", fontLibHandle, hRes, vRes); + INFO_LOG(Log::sceFont, "sceFontSetResolution(%08x, %f, %f)", fontLibHandle, hRes, vRes); fl->SetResolution(hRes, vRes); return 0; } @@ -1542,16 +1542,16 @@ static int sceFontSetResolution(u32 fontLibHandle, float hRes, float vRes) { static float sceFontPixelToPointH(int fontLibHandle, float fontPixelsH, u32 errorCodePtr) { auto errorCode = PSPPointer::Create(errorCodePtr); if (!errorCode.IsValid()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontPixelToPointH(%08x, %f, %08x): invalid error address", fontLibHandle, fontPixelsH, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontPixelToPointH(%08x, %f, %08x): invalid error address", fontLibHandle, fontPixelsH, errorCodePtr); return 0.0f; } FontLib *fl = GetFontLib(fontLibHandle); if (!fl) { - ERROR_LOG_REPORT(SCEFONT, "sceFontPixelToPointH(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPixelsH, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontPixelToPointH(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPixelsH, errorCodePtr); *errorCode = ERROR_FONT_INVALID_LIBID; return 0.0f; } - DEBUG_LOG(SCEFONT, "sceFontPixelToPointH(%08x, %f, %08x)", fontLibHandle, fontPixelsH, errorCodePtr); + DEBUG_LOG(Log::sceFont, "sceFontPixelToPointH(%08x, %f, %08x)", fontLibHandle, fontPixelsH, errorCodePtr); *errorCode = 0; return fontPixelsH * pointDPI / fl->FontHRes(); } @@ -1559,16 +1559,16 @@ static float sceFontPixelToPointH(int fontLibHandle, float fontPixelsH, u32 erro static float sceFontPixelToPointV(int fontLibHandle, float fontPixelsV, u32 errorCodePtr) { auto errorCode = PSPPointer::Create(errorCodePtr); if (!errorCode.IsValid()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontPixelToPointV(%08x, %f, %08x): invalid error address", fontLibHandle, fontPixelsV, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontPixelToPointV(%08x, %f, %08x): invalid error address", fontLibHandle, fontPixelsV, errorCodePtr); return 0.0f; } FontLib *fl = GetFontLib(fontLibHandle); if (!fl) { - ERROR_LOG_REPORT(SCEFONT, "sceFontPixelToPointV(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPixelsV, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontPixelToPointV(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPixelsV, errorCodePtr); *errorCode = ERROR_FONT_INVALID_LIBID; return 0.0f; } - DEBUG_LOG(SCEFONT, "sceFontPixelToPointV(%08x, %f, %08x)", fontLibHandle, fontPixelsV, errorCodePtr); + DEBUG_LOG(Log::sceFont, "sceFontPixelToPointV(%08x, %f, %08x)", fontLibHandle, fontPixelsV, errorCodePtr); *errorCode = 0; return fontPixelsV * pointDPI / fl->FontVRes(); } @@ -1576,16 +1576,16 @@ static float sceFontPixelToPointV(int fontLibHandle, float fontPixelsV, u32 erro static float sceFontPointToPixelH(int fontLibHandle, float fontPointsH, u32 errorCodePtr) { auto errorCode = PSPPointer::Create(errorCodePtr); if (!errorCode.IsValid()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontPointToPixelH(%08x, %f, %08x): invalid error address", fontLibHandle, fontPointsH, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontPointToPixelH(%08x, %f, %08x): invalid error address", fontLibHandle, fontPointsH, errorCodePtr); return 0.0f; } FontLib *fl = GetFontLib(fontLibHandle); if (!fl) { - ERROR_LOG_REPORT(SCEFONT, "sceFontPointToPixelH(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPointsH, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontPointToPixelH(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPointsH, errorCodePtr); *errorCode = ERROR_FONT_INVALID_LIBID; return 0.0f; } - DEBUG_LOG(SCEFONT, "sceFontPointToPixelH(%08x, %f, %08x)", fontLibHandle, fontPointsH, errorCodePtr); + DEBUG_LOG(Log::sceFont, "sceFontPointToPixelH(%08x, %f, %08x)", fontLibHandle, fontPointsH, errorCodePtr); *errorCode = 0; return fontPointsH * fl->FontHRes() / pointDPI; } @@ -1593,38 +1593,38 @@ static float sceFontPointToPixelH(int fontLibHandle, float fontPointsH, u32 erro static float sceFontPointToPixelV(int fontLibHandle, float fontPointsV, u32 errorCodePtr) { auto errorCode = PSPPointer::Create(errorCodePtr); if (!errorCode.IsValid()) { - ERROR_LOG_REPORT(SCEFONT, "sceFontPointToPixelV(%08x, %f, %08x): invalid error address", fontLibHandle, fontPointsV, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontPointToPixelV(%08x, %f, %08x): invalid error address", fontLibHandle, fontPointsV, errorCodePtr); return 0.0f; } FontLib *fl = GetFontLib(fontLibHandle); if (!fl) { - ERROR_LOG_REPORT(SCEFONT, "sceFontPointToPixelV(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPointsV, errorCodePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontPointToPixelV(%08x, %f, %08x): invalid font lib", fontLibHandle, fontPointsV, errorCodePtr); *errorCode = ERROR_FONT_INVALID_LIBID; return 0.0f; } - DEBUG_LOG(SCEFONT, "sceFontPointToPixelV(%08x, %f, %08x)", fontLibHandle, fontPointsV, errorCodePtr); + DEBUG_LOG(Log::sceFont, "sceFontPointToPixelV(%08x, %f, %08x)", fontLibHandle, fontPointsV, errorCodePtr); *errorCode = 0; return fontPointsV * fl->FontVRes() / pointDPI; } static int sceFontCalcMemorySize() { - ERROR_LOG_REPORT(SCEFONT, "UNIMPL sceFontCalcMemorySize()"); + ERROR_LOG_REPORT(Log::sceFont, "UNIMPL sceFontCalcMemorySize()"); return 0; } static int sceFontGetShadowGlyphImage(u32 fontHandle, u32 charCode, u32 glyphImagePtr) { charCode &= 0xffff; if (!Memory::IsValidAddress(glyphImagePtr)) { - ERROR_LOG(SCEFONT, "sceFontGetShadowGlyphImage(%x, %x, %x): bad glyphImage pointer", fontHandle, charCode, glyphImagePtr); + ERROR_LOG(Log::sceFont, "sceFontGetShadowGlyphImage(%x, %x, %x): bad glyphImage pointer", fontHandle, charCode, glyphImagePtr); return ERROR_FONT_INVALID_PARAMETER; } LoadedFont *font = GetLoadedFont(fontHandle, true); if (!font) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetShadowGlyphImage(%x, %x, %x): bad font", fontHandle, charCode, glyphImagePtr); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetShadowGlyphImage(%x, %x, %x): bad font", fontHandle, charCode, glyphImagePtr); return ERROR_FONT_INVALID_PARAMETER; } - DEBUG_LOG(SCEFONT, "sceFontGetShadowGlyphImage(%x, %x, %x)", fontHandle, charCode, glyphImagePtr); + DEBUG_LOG(Log::sceFont, "sceFontGetShadowGlyphImage(%x, %x, %x)", fontHandle, charCode, glyphImagePtr); auto glyph = PSPPointer::Create(glyphImagePtr); font->DrawCharacter(glyph, -1, -1, -1, -1, charCode, FONT_PGF_SHADOWGLYPH); return 0; @@ -1633,16 +1633,16 @@ static int sceFontGetShadowGlyphImage(u32 fontHandle, u32 charCode, u32 glyphIma static int sceFontGetShadowGlyphImage_Clip(u32 fontHandle, u32 charCode, u32 glyphImagePtr, int clipXPos, int clipYPos, int clipWidth, int clipHeight) { charCode &= 0xffff; if (!Memory::IsValidAddress(glyphImagePtr)) { - ERROR_LOG(SCEFONT, "sceFontGetShadowGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i): bad glyphImage pointer", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); + ERROR_LOG(Log::sceFont, "sceFontGetShadowGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i): bad glyphImage pointer", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); return ERROR_FONT_INVALID_PARAMETER; } LoadedFont *font = GetLoadedFont(fontHandle, true); if (!font) { - ERROR_LOG_REPORT(SCEFONT, "sceFontGetShadowGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i): bad font", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); + ERROR_LOG_REPORT(Log::sceFont, "sceFontGetShadowGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i): bad font", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); return ERROR_FONT_INVALID_PARAMETER; } - DEBUG_LOG(SCEFONT, "sceFontGetShadowGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i)", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); + DEBUG_LOG(Log::sceFont, "sceFontGetShadowGlyphImage_Clip(%08x, %i, %08x, %i, %i, %i, %i)", fontHandle, charCode, glyphImagePtr, clipXPos, clipYPos, clipWidth, clipHeight); auto glyph = PSPPointer::Create(glyphImagePtr); font->DrawCharacter(glyph, clipXPos, clipYPos, clipWidth, clipHeight, charCode, FONT_PGF_SHADOWGLYPH); return 0; diff --git a/Core/HLE/sceGameUpdate.cpp b/Core/HLE/sceGameUpdate.cpp index d4c0775c23..57314172f2 100644 --- a/Core/HLE/sceGameUpdate.cpp +++ b/Core/HLE/sceGameUpdate.cpp @@ -21,25 +21,25 @@ static u32 sceGameUpdateInit() { - ERROR_LOG(SCEUTILITY, "UNIMPL sceGameUpdateInit()"); + ERROR_LOG(Log::sceUtility, "UNIMPL sceGameUpdateInit()"); return 0; } static u32 sceGameUpdateTerm() { - ERROR_LOG(SCEUTILITY, "UNIMPL sceGameUpdateTerm()"); + ERROR_LOG(Log::sceUtility, "UNIMPL sceGameUpdateTerm()"); return 0; } static u32 sceGameUpdateRun() { - ERROR_LOG(SCEUTILITY, "UNIMPL sceGameUpdateRun()"); + ERROR_LOG(Log::sceUtility, "UNIMPL sceGameUpdateRun()"); return 0; } static u32 sceGameUpdateAbort() { - ERROR_LOG(SCEUTILITY, "UNIMPL sceGameUpdateAbort()"); + ERROR_LOG(Log::sceUtility, "UNIMPL sceGameUpdateAbort()"); return 0; } diff --git a/Core/HLE/sceGe.cpp b/Core/HLE/sceGe.cpp index 639791f687..a78ce1f94d 100644 --- a/Core/HLE/sceGe.cpp +++ b/Core/HLE/sceGe.cpp @@ -66,7 +66,7 @@ public: bool run(PendingInterrupt& pend) override { if (ge_pending_cb.empty()) { - ERROR_LOG_REPORT(SCEGE, "Unable to run GE interrupt: no pending interrupt"); + ERROR_LOG_REPORT(Log::sceGe, "Unable to run GE interrupt: no pending interrupt"); return false; } @@ -74,12 +74,12 @@ public: DisplayList* dl = gpu->getList(intrdata.listid); if (dl == NULL) { - WARN_LOG(SCEGE, "Unable to run GE interrupt: list doesn't exist: %d", intrdata.listid); + WARN_LOG(Log::sceGe, "Unable to run GE interrupt: list doesn't exist: %d", intrdata.listid); return false; } if (!dl->interruptsEnabled) { - ERROR_LOG_REPORT(SCEGE, "Unable to run GE interrupt: list has interrupts disabled, should not happen"); + ERROR_LOG_REPORT(Log::sceGe, "Unable to run GE interrupt: list has interrupts disabled, should not happen"); return false; } @@ -118,7 +118,7 @@ public: SubIntrHandler* handler = get(subintr); if (handler != NULL) { - DEBUG_LOG(CPU, "Entering GE interrupt handler %08x", handler->handlerAddress); + DEBUG_LOG(Log::CPU, "Entering GE interrupt handler %08x", handler->handlerAddress); currentMIPS->pc = handler->handlerAddress; u32 data = dl->subIntrToken; currentMIPS->r[MIPS_REG_A0] = data & 0xFFFF; @@ -142,7 +142,7 @@ public: // Seen in GoW. if (subintr >= 0) - DEBUG_LOG(SCEGE, "Ignoring interrupt for display list %d, already been released.", intrdata.listid); + DEBUG_LOG(Log::sceGe, "Ignoring interrupt for display list %d, already been released.", intrdata.listid); return false; } @@ -152,7 +152,7 @@ public: DisplayList* dl = gpu->getList(intrdata.listid); if (!dl->interruptsEnabled) { - ERROR_LOG_REPORT(SCEGE, "Unable to finish GE interrupt: list has interrupts disabled, should not happen"); + ERROR_LOG_REPORT(Log::sceGe, "Unable to finish GE interrupt: list has interrupts disabled, should not happen"); return; } @@ -163,9 +163,9 @@ public: DisplayListState newState = static_cast(Memory::ReadUnchecked_U32(intrdata.pc - 4) & 0xFF); //dl->status = static_cast(Memory::ReadUnchecked_U32(intrdata.pc) & 0xFF); //if(dl->status < 0 || dl->status > PSP_GE_LIST_PAUSED) - // ERROR_LOG(SCEGE, "Weird DL status after signal suspend %x", dl->status); + // ERROR_LOG(Log::sceGe, "Weird DL status after signal suspend %x", dl->status); if (newState != PSP_GE_DL_STATE_RUNNING) { - DEBUG_LOG_REPORT(SCEGE, "GE Interrupt: newState might be %d", newState); + DEBUG_LOG_REPORT(Log::sceGe, "GE Interrupt: newState might be %d", newState); } if (dl->state != PSP_GE_DL_STATE_NONE && dl->state != PSP_GE_DL_STATE_COMPLETED) { @@ -288,7 +288,7 @@ void __GeWaitCurrentThread(GPUSyncType type, SceUID waitId, const char *reason) listWaitingThreads[waitId].push_back(__KernelGetCurThread()); waitType = WAITTYPE_GELISTSYNC; } else { - ERROR_LOG_REPORT(SCEGE, "__GeWaitCurrentThread: bad wait type"); + ERROR_LOG_REPORT(Log::sceGe, "__GeWaitCurrentThread: bad wait type"); return; } @@ -311,13 +311,13 @@ bool __GeTriggerWait(GPUSyncType type, SceUID waitId) { else if (type == GPU_SYNC_LIST || (WaitType)type == WAITTYPE_GELISTSYNC) return __GeTriggerWait(WAITTYPE_GELISTSYNC, waitId, listWaitingThreads[waitId]); else - ERROR_LOG_REPORT(SCEGE, "__GeTriggerWait: bad wait type"); + ERROR_LOG_REPORT(Log::sceGe, "__GeTriggerWait: bad wait type"); return false; } static u32 sceGeEdramGetAddr() { u32 retVal = 0x04000000; - DEBUG_LOG(SCEGE, "%08x = sceGeEdramGetAddr", retVal); + DEBUG_LOG(Log::sceGe, "%08x = sceGeEdramGetAddr", retVal); hleEatCycles(150); return retVal; } @@ -325,7 +325,7 @@ static u32 sceGeEdramGetAddr() { // TODO: Return a different value for the PS3 enhanced-emulator games? static u32 sceGeEdramGetSize() { const u32 retVal = 0x00200000; - DEBUG_LOG(SCEGE, "%08x = sceGeEdramGetSize()", retVal); + DEBUG_LOG(Log::sceGe, "%08x = sceGeEdramGetSize()", retVal); return retVal; } @@ -334,7 +334,7 @@ static int __GeSubIntrBase(int callbackId) { } u32 sceGeListEnQueue(u32 listAddress, u32 stallAddress, int callbackId, u32 optParamAddr) { - DEBUG_LOG(SCEGE, + DEBUG_LOG(Log::sceGe, "sceGeListEnQueue(addr=%08x, stall=%08x, cbid=%08x, param=%08x)", listAddress, stallAddress, callbackId, optParamAddr); auto optParam = PSPPointer::Create(optParamAddr); @@ -345,11 +345,11 @@ u32 sceGeListEnQueue(u32 listAddress, u32 stallAddress, int callbackId, u32 optP hleEatCycles(490); CoreTiming::ForceCheck(); - return hleLogSuccessX(SCEGE, listID); + return hleLogSuccessX(Log::sceGe, listID); } u32 sceGeListEnQueueHead(u32 listAddress, u32 stallAddress, int callbackId, u32 optParamAddr) { - DEBUG_LOG(SCEGE, + DEBUG_LOG(Log::sceGe, "sceGeListEnQueueHead(addr=%08x, stall=%08x, cbid=%08x, param=%08x)", listAddress, stallAddress, callbackId, optParamAddr); auto optParam = PSPPointer::Create(optParamAddr); @@ -360,11 +360,11 @@ u32 sceGeListEnQueueHead(u32 listAddress, u32 stallAddress, int callbackId, u32 hleEatCycles(480); CoreTiming::ForceCheck(); - return hleLogSuccessX(SCEGE, listID); + return hleLogSuccessX(Log::sceGe, listID); } static int sceGeListDeQueue(u32 listID) { - WARN_LOG(SCEGE, "sceGeListDeQueue(%08x)", listID); + WARN_LOG(Log::sceGe, "sceGeListDeQueue(%08x)", listID); int result = gpu->DequeueList(LIST_ID_MAGIC ^ listID); hleReSchedule("dlist dequeued"); return result; @@ -376,13 +376,13 @@ static int sceGeListUpdateStallAddr(u32 displayListID, u32 stallAddress) { hleEatCycles(190); CoreTiming::ForceCheck(); - DEBUG_LOG(SCEGE, "sceGeListUpdateStallAddr(dlid=%i, stalladdr=%08x)", displayListID, stallAddress); + DEBUG_LOG(Log::sceGe, "sceGeListUpdateStallAddr(dlid=%i, stalladdr=%08x)", displayListID, stallAddress); return gpu->UpdateStall(LIST_ID_MAGIC ^ displayListID, stallAddress); } // 0 : wait for completion. 1:check and return int sceGeListSync(u32 displayListID, u32 mode) { - DEBUG_LOG(SCEGE, "sceGeListSync(dlid=%08x, mode=%08x)", displayListID, mode); + DEBUG_LOG(Log::sceGe, "sceGeListSync(dlid=%08x, mode=%08x)", displayListID, mode); hleEatCycles(220); // Fudged without measuring, copying sceGeContinue. return gpu->ListSync(LIST_ID_MAGIC ^ displayListID, mode); } @@ -393,12 +393,12 @@ static u32 sceGeDrawSync(u32 mode) { hleEatCycles(500000); //HACK(?) : Potential fix for Crash Tag Team Racing and a few Gundam games else hleEatCycles(1240); - DEBUG_LOG(SCEGE, "sceGeDrawSync(mode=%d) (0=wait for completion, 1=peek)", mode); + DEBUG_LOG(Log::sceGe, "sceGeDrawSync(mode=%d) (0=wait for completion, 1=peek)", mode); return gpu->DrawSync(mode); } int sceGeContinue() { - DEBUG_LOG(SCEGE, "sceGeContinue"); + DEBUG_LOG(Log::sceGe, "sceGeContinue"); int ret = gpu->Continue(); hleEatCycles(220); hleReSchedule("ge continue"); @@ -407,19 +407,19 @@ int sceGeContinue() { static int sceGeBreak(u32 mode, u32 unknownPtr) { if (mode > 1) { - WARN_LOG(SCEGE, "sceGeBreak(mode=%d, unknown=%08x): invalid mode", mode, unknownPtr); + WARN_LOG(Log::sceGe, "sceGeBreak(mode=%d, unknown=%08x): invalid mode", mode, unknownPtr); return SCE_KERNEL_ERROR_INVALID_MODE; } // Not sure what this is supposed to be for... if ((int)unknownPtr < 0 || (int)(unknownPtr + 16) < 0) { - WARN_LOG_REPORT(SCEGE, "sceGeBreak(mode=%d, unknown=%08x): invalid ptr", mode, unknownPtr); + WARN_LOG_REPORT(Log::sceGe, "sceGeBreak(mode=%d, unknown=%08x): invalid ptr", mode, unknownPtr); return SCE_KERNEL_ERROR_PRIV_REQUIRED; } else if (unknownPtr != 0) { - WARN_LOG_REPORT(SCEGE, "sceGeBreak(mode=%d, unknown=%08x): unknown ptr (%s)", mode, unknownPtr, Memory::IsValidAddress(unknownPtr) ? "valid" : "invalid"); + WARN_LOG_REPORT(Log::sceGe, "sceGeBreak(mode=%d, unknown=%08x): unknown ptr (%s)", mode, unknownPtr, Memory::IsValidAddress(unknownPtr) ? "valid" : "invalid"); } //mode => 0 : current dlist 1: all drawing - DEBUG_LOG(SCEGE, "sceGeBreak(mode=%d, unknown=%08x)", mode, unknownPtr); + DEBUG_LOG(Log::sceGe, "sceGeBreak(mode=%d, unknown=%08x)", mode, unknownPtr); int result = gpu->Break(mode); if (result >= 0 && mode == 0) { return LIST_ID_MAGIC ^ result; @@ -437,7 +437,7 @@ static u32 sceGeSetCallback(u32 structAddr) { } if (cbID == -1) { - return hleLogWarning(SCEGE, SCE_KERNEL_ERROR_OUT_OF_MEMORY, "out of callback ids"); + return hleLogWarning(Log::sceGe, SCE_KERNEL_ERROR_OUT_OF_MEMORY, "out of callback ids"); } ge_used_callbacks[cbID] = true; @@ -458,14 +458,14 @@ static u32 sceGeSetCallback(u32 structAddr) { sceKernelEnableSubIntr(PSP_GE_INTR, subIntrBase | PSP_GE_SUBINTR_SIGNAL); } - return hleLogSuccessI(SCEGE, cbID); + return hleLogSuccessI(Log::sceGe, cbID); } static int sceGeUnsetCallback(u32 cbID) { - DEBUG_LOG(SCEGE, "sceGeUnsetCallback(cbid=%08x)", cbID); + DEBUG_LOG(Log::sceGe, "sceGeUnsetCallback(cbid=%08x)", cbID); if (cbID >= ARRAY_SIZE(ge_used_callbacks)) { - WARN_LOG(SCEGE, "sceGeUnsetCallback(cbid=%08x): invalid callback id", cbID); + WARN_LOG(Log::sceGe, "sceGeUnsetCallback(cbid=%08x): invalid callback id", cbID); return SCE_KERNEL_ERROR_INVALID_ID; } @@ -475,7 +475,7 @@ static int sceGeUnsetCallback(u32 cbID) { sceKernelReleaseSubIntrHandler(PSP_GE_INTR, subIntrBase | PSP_GE_SUBINTR_FINISH); sceKernelReleaseSubIntrHandler(PSP_GE_INTR, subIntrBase | PSP_GE_SUBINTR_SIGNAL); } else { - WARN_LOG(SCEGE, "sceGeUnsetCallback(cbid=%08x): ignoring unregistered callback id", cbID); + WARN_LOG(Log::sceGe, "sceGeUnsetCallback(cbid=%08x): ignoring unregistered callback id", cbID); } ge_used_callbacks[cbID] = false; @@ -485,10 +485,10 @@ static int sceGeUnsetCallback(u32 cbID) { // Points to 512 32-bit words, where we can probably layout the context however we want // unless some insane game pokes it and relies on it... u32 sceGeSaveContext(u32 ctxAddr) { - DEBUG_LOG(SCEGE, "sceGeSaveContext(%08x)", ctxAddr); + DEBUG_LOG(Log::sceGe, "sceGeSaveContext(%08x)", ctxAddr); if (gpu->BusyDrawing()) { - WARN_LOG(SCEGE, "sceGeSaveContext(%08x): lists in process, aborting", ctxAddr); + WARN_LOG(Log::sceGe, "sceGeSaveContext(%08x): lists in process, aborting", ctxAddr); // Real error code. return -1; } @@ -504,10 +504,10 @@ u32 sceGeSaveContext(u32 ctxAddr) { } u32 sceGeRestoreContext(u32 ctxAddr) { - DEBUG_LOG(SCEGE, "sceGeRestoreContext(%08x)", ctxAddr); + DEBUG_LOG(Log::sceGe, "sceGeRestoreContext(%08x)", ctxAddr); if (gpu->BusyDrawing()) { - WARN_LOG(SCEGE, "sceGeRestoreContext(%08x): lists in process, aborting", ctxAddr); + WARN_LOG(Log::sceGe, "sceGeRestoreContext(%08x): lists in process, aborting", ctxAddr); return SCE_KERNEL_ERROR_BUSY; } @@ -522,16 +522,16 @@ u32 sceGeRestoreContext(u32 ctxAddr) { static int sceGeGetMtx(int type, u32 matrixPtr) { int size = type == GE_MTX_PROJECTION ? 16 : 12; if (!Memory::IsValidRange(matrixPtr, size * sizeof(float))) { - return hleLogError(SCEGE, -1, "bad matrix ptr"); + return hleLogError(Log::sceGe, -1, "bad matrix ptr"); } u32_le *dest = (u32_le *)Memory::GetPointerWriteUnchecked(matrixPtr); // Note: this reads the CPU-visible matrix values, which may differ from the actual used values. // They only differ when more DATA commands are sent than are valid for a matrix. if (!gpu || !gpu->GetMatrix24(GEMatrixType(type), dest, 0)) - return hleLogError(SCEGE, SCE_KERNEL_ERROR_INVALID_INDEX, "invalid matrix"); + return hleLogError(Log::sceGe, SCE_KERNEL_ERROR_INVALID_INDEX, "invalid matrix"); - return hleLogSuccessInfoI(SCEGE, 0); + return hleLogSuccessInfoI(Log::sceGe, 0); } static u32 sceGeGetCmd(int cmd) { @@ -561,13 +561,13 @@ static u32 sceGeGetCmd(int cmd) { default: break; } - return hleLogSuccessInfoX(SCEGE, val); + return hleLogSuccessInfoX(Log::sceGe, val); } - return hleLogError(SCEGE, SCE_KERNEL_ERROR_INVALID_INDEX); + return hleLogError(Log::sceGe, SCE_KERNEL_ERROR_INVALID_INDEX); } static int sceGeGetStack(int index, u32 stackPtr) { - WARN_LOG_REPORT(SCEGE, "sceGeGetStack(%i, %08x)", index, stackPtr); + WARN_LOG_REPORT(Log::sceGe, "sceGeGetStack(%i, %08x)", index, stackPtr); return gpu->GetStack(index, stackPtr); } @@ -575,13 +575,13 @@ static u32 sceGeEdramSetAddrTranslation(u32 new_size) { bool outsideRange = new_size != 0 && (new_size < 0x200 || new_size > 0x1000); bool notPowerOfTwo = (new_size & (new_size - 1)) != 0; if (outsideRange || notPowerOfTwo) { - return hleLogWarning(SCEGE, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid value"); + return hleLogWarning(Log::sceGe, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid value"); } if (!gpu) { - return hleLogError(SCEGE, -1, "GPUInterface not available"); + return hleLogError(Log::sceGe, -1, "GPUInterface not available"); } - return hleReportDebug(SCEGE, gpu->SetAddrTranslation(new_size)); + return hleReportDebug(Log::sceGe, gpu->SetAddrTranslation(new_size)); } const HLEFunction sceGe_user[] = { diff --git a/Core/HLE/sceHeap.cpp b/Core/HLE/sceHeap.cpp index 5a5ac3065f..69c808f847 100644 --- a/Core/HLE/sceHeap.cpp +++ b/Core/HLE/sceHeap.cpp @@ -81,23 +81,23 @@ void __HeapShutdown() { } static int sceHeapReallocHeapMemory(u32 heapAddr, u32 memPtr, int memSize) { - ERROR_LOG_REPORT(HLE,"UNIMPL sceHeapReallocHeapMemory(%08x, %08x, %08x)", heapAddr, memPtr, memSize); + ERROR_LOG_REPORT(Log::HLE,"UNIMPL sceHeapReallocHeapMemory(%08x, %08x, %08x)", heapAddr, memPtr, memSize); return 0; } static int sceHeapReallocHeapMemoryWithOption(u32 heapPtr, u32 memPtr, int memSize, u32 paramsPtr) { - ERROR_LOG_REPORT(HLE,"UNIMPL sceHeapReallocHeapMemoryWithOption(%08x, %08x, %08x, %08x)", heapPtr, memPtr, memSize, paramsPtr); + ERROR_LOG_REPORT(Log::HLE,"UNIMPL sceHeapReallocHeapMemoryWithOption(%08x, %08x, %08x, %08x)", heapPtr, memPtr, memSize, paramsPtr); return 0; } static int sceHeapFreeHeapMemory(u32 heapAddr, u32 memAddr) { Heap *heap = getHeap(heapAddr); if (!heap) { - ERROR_LOG(HLE, "sceHeapFreeHeapMemory(%08x, %08x): invalid heap", heapAddr, memAddr); + ERROR_LOG(Log::HLE, "sceHeapFreeHeapMemory(%08x, %08x): invalid heap", heapAddr, memAddr); return SCE_KERNEL_ERROR_INVALID_ID; } - DEBUG_LOG(HLE, "sceHeapFreeHeapMemory(%08x, %08x)", heapAddr, memAddr); + DEBUG_LOG(Log::HLE, "sceHeapFreeHeapMemory(%08x, %08x)", heapAddr, memAddr); // An invalid address will crash the PSP, but 0 is always returns success. if (memAddr == 0) { return 0; @@ -110,7 +110,7 @@ static int sceHeapFreeHeapMemory(u32 heapAddr, u32 memAddr) { } static int sceHeapGetMallinfo(u32 heapAddr, u32 infoPtr) { - ERROR_LOG_REPORT(HLE,"UNIMPL sceHeapGetMallinfo(%08x, %08x)", heapAddr, infoPtr); + ERROR_LOG_REPORT(Log::HLE,"UNIMPL sceHeapGetMallinfo(%08x, %08x)", heapAddr, infoPtr); return 0; } @@ -118,7 +118,7 @@ static u32 sceHeapAllocHeapMemoryWithOption(u32 heapAddr, u32 memSize, u32 param Heap *heap = getHeap(heapAddr); u32 grain = 4; if (!heap) { - ERROR_LOG(HLE, "sceHeapAllocHeapMemoryWithOption(%08x, %08x, %08x): invalid heap", heapAddr, memSize, paramsPtr); + ERROR_LOG(Log::HLE, "sceHeapAllocHeapMemoryWithOption(%08x, %08x, %08x): invalid heap", heapAddr, memSize, paramsPtr); return 0; } @@ -126,16 +126,16 @@ static u32 sceHeapAllocHeapMemoryWithOption(u32 heapAddr, u32 memSize, u32 param if (paramsPtr != 0) { u32 size = Memory::Read_U32(paramsPtr); if (size < 8) { - ERROR_LOG(HLE, "sceHeapAllocHeapMemoryWithOption(%08x, %08x, %08x): invalid param size", heapAddr, memSize, paramsPtr); + ERROR_LOG(Log::HLE, "sceHeapAllocHeapMemoryWithOption(%08x, %08x, %08x): invalid param size", heapAddr, memSize, paramsPtr); return 0; } if (size > 8) { - WARN_LOG_REPORT(HLE, "sceHeapAllocHeapMemoryWithOption(): unexpected param size %d", size); + WARN_LOG_REPORT(Log::HLE, "sceHeapAllocHeapMemoryWithOption(): unexpected param size %d", size); } grain = Memory::Read_U32(paramsPtr + 4); } - DEBUG_LOG(HLE,"sceHeapAllocHeapMemoryWithOption(%08x, %08x, %08x)", heapAddr, memSize, paramsPtr); + DEBUG_LOG(Log::HLE,"sceHeapAllocHeapMemoryWithOption(%08x, %08x, %08x)", heapAddr, memSize, paramsPtr); // There's 8 bytes at the end of every block, reserved. memSize += 8; u32 addr = heap->alloc.AllocAligned(memSize, grain, grain, true); @@ -145,11 +145,11 @@ static u32 sceHeapAllocHeapMemoryWithOption(u32 heapAddr, u32 memSize, u32 param static int sceHeapGetTotalFreeSize(u32 heapAddr) { Heap *heap = getHeap(heapAddr); if (!heap) { - ERROR_LOG(HLE, "sceHeapGetTotalFreeSize(%08x): invalid heap", heapAddr); + ERROR_LOG(Log::HLE, "sceHeapGetTotalFreeSize(%08x): invalid heap", heapAddr); return SCE_KERNEL_ERROR_INVALID_ID; } - DEBUG_LOG(HLE, "sceHeapGetTotalFreeSize(%08x)", heapAddr); + DEBUG_LOG(Log::HLE, "sceHeapGetTotalFreeSize(%08x)", heapAddr); u32 free = heap->alloc.GetTotalFreeBytes(); if (free >= 8) { // Every allocation requires an extra 8 bytes. @@ -160,11 +160,11 @@ static int sceHeapGetTotalFreeSize(u32 heapAddr) { static int sceHeapIsAllocatedHeapMemory(u32 heapPtr, u32 memPtr) { if (!Memory::IsValidAddress(memPtr)) { - ERROR_LOG(HLE, "sceHeapIsAllocatedHeapMemory(%08x, %08x): invalid address", heapPtr, memPtr); + ERROR_LOG(Log::HLE, "sceHeapIsAllocatedHeapMemory(%08x, %08x): invalid address", heapPtr, memPtr); return SCE_KERNEL_ERROR_INVALID_POINTER; } - DEBUG_LOG(HLE, "sceHeapIsAllocatedHeapMemory(%08x, %08x)", heapPtr, memPtr); + DEBUG_LOG(Log::HLE, "sceHeapIsAllocatedHeapMemory(%08x, %08x)", heapPtr, memPtr); Heap *heap = getHeap(heapPtr); // An invalid heap is fine, it's not a member of this heap one way or another. // Only an exact address matches. Off by one crashes, and off by 4 says no. @@ -177,11 +177,11 @@ static int sceHeapIsAllocatedHeapMemory(u32 heapPtr, u32 memPtr) { static int sceHeapDeleteHeap(u32 heapAddr) { Heap *heap = getHeap(heapAddr); if (!heap) { - ERROR_LOG(HLE, "sceHeapDeleteHeap(%08x): invalid heap", heapAddr); + ERROR_LOG(Log::HLE, "sceHeapDeleteHeap(%08x): invalid heap", heapAddr); return SCE_KERNEL_ERROR_INVALID_ID; } - DEBUG_LOG(HLE, "sceHeapDeleteHeap(%08x)", heapAddr); + DEBUG_LOG(Log::HLE, "sceHeapDeleteHeap(%08x)", heapAddr); heapList.erase(heapAddr); delete heap; return 0; @@ -190,10 +190,10 @@ static int sceHeapDeleteHeap(u32 heapAddr) { static int sceHeapCreateHeap(const char* name, u32 heapSize, int attr, u32 paramsPtr) { if (paramsPtr != 0) { u32 size = Memory::Read_U32(paramsPtr); - WARN_LOG_REPORT(HLE, "sceHeapCreateHeap(): unsupported options parameter, size = %d", size); + WARN_LOG_REPORT(Log::HLE, "sceHeapCreateHeap(): unsupported options parameter, size = %d", size); } if (name == NULL) { - WARN_LOG_REPORT(HLE, "sceHeapCreateHeap(): name is NULL"); + WARN_LOG_REPORT(Log::HLE, "sceHeapCreateHeap(): name is NULL"); return 0; } int allocSize = (heapSize + 3) & ~3; @@ -203,7 +203,7 @@ static int sceHeapCreateHeap(const char* name, u32 heapSize, int attr, u32 param heap->fromtop = (attr & PSP_HEAP_ATTR_HIGHMEM) != 0; u32 addr = userMemory.Alloc(heap->size, heap->fromtop, StringFromFormat("Heap/%s", name).c_str()); if (addr == (u32)-1) { - ERROR_LOG(HLE, "sceHeapCreateHeap(): Failed to allocate %i bytes memory", allocSize); + ERROR_LOG(Log::HLE, "sceHeapCreateHeap(): Failed to allocate %i bytes memory", allocSize); delete heap; return 0; } @@ -212,19 +212,19 @@ static int sceHeapCreateHeap(const char* name, u32 heapSize, int attr, u32 param // Some of the heap is reserved by the implementation (the first 128 bytes, and 8 after each block.) heap->alloc.Init(heap->address + 128, heap->size - 128, true); heapList[heap->address] = heap; - DEBUG_LOG(HLE, "%08x=sceHeapCreateHeap(%s, %08x, %08x, %08x)", heap->address, name, heapSize, attr, paramsPtr); + DEBUG_LOG(Log::HLE, "%08x=sceHeapCreateHeap(%s, %08x, %08x, %08x)", heap->address, name, heapSize, attr, paramsPtr); return heap->address; } static u32 sceHeapAllocHeapMemory(u32 heapAddr, u32 memSize) { Heap *heap = getHeap(heapAddr); if (!heap) { - ERROR_LOG(HLE, "sceHeapAllocHeapMemory(%08x, %08x): invalid heap", heapAddr, memSize); + ERROR_LOG(Log::HLE, "sceHeapAllocHeapMemory(%08x, %08x): invalid heap", heapAddr, memSize); // Yes, not 0 (returns a pointer), but an error code. Strange. return SCE_KERNEL_ERROR_INVALID_ID; } - DEBUG_LOG(HLE, "sceHeapAllocHeapMemory(%08x, %08x)", heapAddr, memSize); + DEBUG_LOG(Log::HLE, "sceHeapAllocHeapMemory(%08x, %08x)", heapAddr, memSize); // There's 8 bytes at the end of every block, reserved. memSize += 8; // Always goes down, regardless of whether the heap is high or low. diff --git a/Core/HLE/sceHprm.cpp b/Core/HLE/sceHprm.cpp index 44d00f5b3d..bb1e6dd9fe 100644 --- a/Core/HLE/sceHprm.cpp +++ b/Core/HLE/sceHprm.cpp @@ -22,7 +22,7 @@ #include "Core/MIPS/MIPS.h" static u32 sceHprmPeekCurrentKey(u32 keyAddress) { - DEBUG_LOG(HLE,"0=sceHprmPeekCurrentKey(ptr)"); + DEBUG_LOG(Log::HLE,"0=sceHprmPeekCurrentKey(ptr)"); Memory::Write_U32(0, keyAddress); return 0; } @@ -30,37 +30,37 @@ static u32 sceHprmPeekCurrentKey(u32 keyAddress) { // TODO: Might make sense to reflect the headphone status of the host here, // if the games adjust their sound. static u32 sceHprmIsHeadphoneExist() { - DEBUG_LOG(HLE, "sceHprmIsHeadphoneExist()"); + DEBUG_LOG(Log::HLE, "sceHprmIsHeadphoneExist()"); return 0; } static u32 sceHprmIsMicrophoneExist() { - DEBUG_LOG(HLE, "sceHprmIsMicrophoneExist()"); + DEBUG_LOG(Log::HLE, "sceHprmIsMicrophoneExist()"); return 0; } static u32 sceHprmIsRemoteExist() { - DEBUG_LOG(HLE, "sceHprmIsRemoteExist()"); + DEBUG_LOG(Log::HLE, "sceHprmIsRemoteExist()"); return 0; } static u32 sceHprmRegisterCallback() { - ERROR_LOG(HLE, "UNIMPL %s", __FUNCTION__); + ERROR_LOG(Log::HLE, "UNIMPL %s", __FUNCTION__); return 0; } static u32 sceHprmUnregisterCallback() { - ERROR_LOG(HLE, "UNIMPL %s", __FUNCTION__); + ERROR_LOG(Log::HLE, "UNIMPL %s", __FUNCTION__); return 0; } static u32 sceHprmPeekLatch(u32 latchAddr) { - DEBUG_LOG(HLE,"sceHprmPeekLatch latchAddr %08x",latchAddr); + DEBUG_LOG(Log::HLE,"sceHprmPeekLatch latchAddr %08x",latchAddr); return 0; } static u32 sceHprmReadLatch(u32 latchAddr) { - DEBUG_LOG(HLE,"sceHprmReadLatch latchAddr %08x",latchAddr); + DEBUG_LOG(Log::HLE,"sceHprmReadLatch latchAddr %08x",latchAddr); return 0; } diff --git a/Core/HLE/sceHttp.cpp b/Core/HLE/sceHttp.cpp index 0f01636405..b56f2cc9cf 100644 --- a/Core/HLE/sceHttp.cpp +++ b/Core/HLE/sceHttp.cpp @@ -46,229 +46,229 @@ class HTTPRequest { int sceHttpSetResolveRetry(int connectionID, int retryCount) { - ERROR_LOG(SCENET, "UNIMPL sceHttpSetResolveRetry(%d, %d)", connectionID, retryCount); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSetResolveRetry(%d, %d)", connectionID, retryCount); return 0; } static int sceHttpInit(int unknown) { - ERROR_LOG(SCENET, "UNIMPL sceHttpInit(%i)", unknown); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpInit(%i)", unknown); return 0; } static int sceHttpEnd() { - ERROR_LOG(SCENET, "UNIMPL sceHttpEnd()"); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpEnd()"); return 0; } static int sceHttpInitCache(int size) { - ERROR_LOG(SCENET, "UNIMPL sceHttpInitCache(%d)", size); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpInitCache(%d)", size); return 0; } static int sceHttpEndCache() { - ERROR_LOG(SCENET, "UNIMPL sceHttpEndCache()"); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpEndCache()"); return 0; } static int sceHttpEnableCache(int id) { - ERROR_LOG(SCENET, "UNIMPL sceHttpEnableCache(%d)", id); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpEnableCache(%d)", id); return 0; } static int sceHttpDisableCache(int id) { - ERROR_LOG(SCENET, "UNIMPL sceHttpDisableCache(%d)", id); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpDisableCache(%d)", id); return 0; } static u32 sceHttpGetProxy(u32 id, u32 activateFlagPtr, u32 modePtr, u32 proxyHostPtr, u32 len, u32 proxyPort) { - ERROR_LOG(SCENET, "UNIMPL sceHttpGetProxy(%d, %x, %x, %x, %d, %x)", id, activateFlagPtr, modePtr, proxyHostPtr, len, proxyPort); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpGetProxy(%d, %x, %x, %x, %d, %x)", id, activateFlagPtr, modePtr, proxyHostPtr, len, proxyPort); return 0; } static int sceHttpGetStatusCode(int requestID, u32 statusCodePtr) { - ERROR_LOG(SCENET, "UNIMPL sceHttpGetStatusCode(%d, %x)", requestID, statusCodePtr); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpGetStatusCode(%d, %x)", requestID, statusCodePtr); return 0; } static int sceHttpReadData(int requestID, u32 dataPtr, u32 dataSize) { - ERROR_LOG(SCENET, "UNIMPL sceHttpReadData(%d, %x, %x)", requestID, dataPtr, dataSize); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpReadData(%d, %x, %x)", requestID, dataPtr, dataSize); return 0; } static int sceHttpSendRequest(int requestID, u32 dataPtr, u32 dataSize) { - ERROR_LOG(SCENET, "UNIMPL sceHttpSendRequest(%d, %x, %x)", requestID, dataPtr, dataSize); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSendRequest(%d, %x, %x)", requestID, dataPtr, dataSize); return 0; } static int sceHttpDeleteRequest(int requestID) { - ERROR_LOG(SCENET, "UNIMPL sceHttpDeleteRequest(%d)", requestID); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpDeleteRequest(%d)", requestID); return 0; } static int sceHttpDeleteHeader(int id, const char *name) { - ERROR_LOG(SCENET, "UNIMPL sceHttpDeleteHeader(%d, %s)", id, name); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpDeleteHeader(%d, %s)", id, name); return 0; } static int sceHttpDeleteConnection(int connectionID) { - ERROR_LOG(SCENET, "UNIMPL sceHttpDisableCache(%d)", connectionID); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpDisableCache(%d)", connectionID); return 0; } static int sceHttpSetConnectTimeOut(int id, u32 timeout) { - ERROR_LOG(SCENET, "UNIMPL sceHttpSetConnectTimeout(%d, %d)", id, timeout); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSetConnectTimeout(%d, %d)", id, timeout); return 0; } static int sceHttpSetSendTimeOut(int id, u32 timeout) { - ERROR_LOG(SCENET, "UNIMPL sceHttpSetSendTimeout(%d, %d)", id, timeout); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSetSendTimeout(%d, %d)", id, timeout); return 0; } static u32 sceHttpSetProxy(u32 id, u32 activateFlagPtr, u32 mode, u32 newProxyHostPtr, u32 newProxyPort) { - ERROR_LOG(SCENET, "UNIMPL sceHttpSetProxy(%d, %x, %x, %x, %d)", id, activateFlagPtr, mode, newProxyHostPtr, newProxyPort); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSetProxy(%d, %x, %x, %x, %d)", id, activateFlagPtr, mode, newProxyHostPtr, newProxyPort); return 0; } static int sceHttpEnableCookie(int id) { - ERROR_LOG(SCENET, "UNIMPL sceHttpEnableCookie(%d)", id); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpEnableCookie(%d)", id); return 0; } static int sceHttpEnableKeepAlive(int id) { - ERROR_LOG(SCENET, "UNIMPL sceHttpEnableKeepAlive(%d)", id); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpEnableKeepAlive(%d)", id); return 0; } static int sceHttpDisableCookie(int id) { - ERROR_LOG(SCENET, "UNIMPL sceHttpDisableCookie(%d)", id); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpDisableCookie(%d)", id); return 0; } static int sceHttpDisableKeepAlive(int id) { - ERROR_LOG(SCENET, "UNIMPL sceHttpDisableKeepAlive(%d)", id); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpDisableKeepAlive(%d)", id); return 0; } static int sceHttpsInit(int unknown1, int unknown2, int unknown3, int unknown4) { - ERROR_LOG(SCENET, "UNIMPL sceHttpsInit(%d, %d, %d, %d)", unknown1, unknown2, unknown3, unknown4); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpsInit(%d, %d, %d, %d)", unknown1, unknown2, unknown3, unknown4); return 0; } static int sceHttpsEnd() { - ERROR_LOG(SCENET, "UNIMPL sceHttpsEnd()"); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpsEnd()"); return 0; } // Parameter "method" should be one of PSPHttpMethod's listed entries static int sceHttpCreateRequest(int connectionID, int method, const char *path, u64 contentLength) { - ERROR_LOG(SCENET, "UNIMPL sceHttpCreateRequest(%d, %d, %s, %llx)", connectionID, method, path, contentLength); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpCreateRequest(%d, %d, %s, %llx)", connectionID, method, path, contentLength); return 0; } static int sceHttpCreateConnection(int templateID, const char *hostString, const char *unknown1, u32 port, int unknown2) { - ERROR_LOG(SCENET, "UNIMPL sceHttpCreateConnection(%d, %s, %s, %d, %d)", templateID, hostString, unknown1, port, unknown2); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpCreateConnection(%d, %s, %s, %d, %d)", templateID, hostString, unknown1, port, unknown2); return 0; } static int sceHttpGetNetworkErrno(int request, u32 errNumPtr) { - ERROR_LOG(SCENET, "UNIMPL sceHttpGetNetworkErrno(%d, %x)", request, errNumPtr); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpGetNetworkErrno(%d, %x)", request, errNumPtr); return 0; } static int sceHttpAddExtraHeader(int id, const char *name, const char *value, int unknown) { - ERROR_LOG(SCENET, "UNIMPL sceHttpAddExtraHeader(%d, %s, %s, %d)", id, name, value, unknown); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpAddExtraHeader(%d, %s, %s, %d)", id, name, value, unknown); return 0; } static int sceHttpAbortRequest(int requestID) { - ERROR_LOG(SCENET, "UNIMPL sceHttpAbortRequest(%d)", requestID); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpAbortRequest(%d)", requestID); return 0; } static int sceHttpDeleteTemplate(int templateID) { - ERROR_LOG(SCENET, "UNIMPL sceHttpDeleteTemplate(%d)", templateID); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpDeleteTemplate(%d)", templateID); return 0; } static int sceHttpSetMallocFunction(u32 mallocFuncPtr, u32 freeFuncPtr, u32 reallocFuncPtr) { - ERROR_LOG(SCENET, "UNIMPL sceHttpSetMallocFunction(%x, %x, %x)", mallocFuncPtr, freeFuncPtr, reallocFuncPtr); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSetMallocFunction(%x, %x, %x)", mallocFuncPtr, freeFuncPtr, reallocFuncPtr); return 0; } static int sceHttpSetResolveTimeOut(int id, u32 timeout) { - ERROR_LOG(SCENET, "UNIMPL sceHttpSetResolveTimeOut(%d, %d)", id, timeout); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSetResolveTimeOut(%d, %d)", id, timeout); return 0; } static int sceHttpSetAuthInfoCB(int id, u32 callbackFuncPtr) { - ERROR_LOG(SCENET, "UNIMPL sceHttpSetAuthInfoCB(%d, %x)", id, callbackFuncPtr); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSetAuthInfoCB(%d, %x)", id, callbackFuncPtr); return 0; } static int sceHttpEnableRedirect(int id) { - ERROR_LOG(SCENET, "UNIMPL sceHttpEnableRedirect(%d)", id); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpEnableRedirect(%d)", id); return 0; } static int sceHttpEnableAuth(int id) { - ERROR_LOG(SCENET, "UNIMPL sceHttpEnableAuth(%d)", id); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpEnableAuth(%d)", id); return 0; } static int sceHttpDisableRedirect(int id) { - ERROR_LOG(SCENET, "UNIMPL sceHttpDisableRedirect(%d)", id); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpDisableRedirect(%d)", id); return 0; } static int sceHttpDisableAuth(int id) { - ERROR_LOG(SCENET, "UNIMPL sceHttpDisableAuth(%d)", id); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpDisableAuth(%d)", id); return 0; } static int sceHttpSaveSystemCookie() { - ERROR_LOG(SCENET, "UNIMPL sceHttpSaveSystemCookie()"); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSaveSystemCookie()"); return 0; } static int sceHttpsLoadDefaultCert(int unknown1, int unknown2) { - ERROR_LOG(SCENET, "UNIMPL sceHttpLoadDefaultCert(%d, %d)", unknown1, unknown2); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpLoadDefaultCert(%d, %d)", unknown1, unknown2); return 0; } static int sceHttpLoadSystemCookie() { - ERROR_LOG(SCENET, "UNIMPL sceHttpLoadSystemCookie()"); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpLoadSystemCookie()"); return 0; } static int sceHttpCreateTemplate(const char *agent, int unknown1, int unknown2) { - ERROR_LOG(SCENET, "UNIMPL sceHttpCreateTemplate(%s, %d, %d)", agent, unknown1, unknown2); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpCreateTemplate(%s, %d, %d)", agent, unknown1, unknown2); return 0; } // Parameter "method" should be one of PSPHttpMethod's listed entries static int sceHttpCreateRequestWithURL(int connectionID, int method, const char *url, u64 contentLength) { - ERROR_LOG(SCENET, "UNIMPL sceHttpCreateRequestWithURL(%d, %d, %s, %llx)", connectionID, method, url, contentLength); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpCreateRequestWithURL(%d, %d, %s, %llx)", connectionID, method, url, contentLength); return 0; } static int sceHttpCreateConnectionWithURL(int templateID, const char *url, int unknown1) { - ERROR_LOG(SCENET, "UNIMPL sceHttpCreateConnectionWithURL(%d, %s, %d)", templateID, url, unknown1); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpCreateConnectionWithURL(%d, %s, %d)", templateID, url, unknown1); return 0; } static int sceHttpSetRecvTimeOut(int id, u32 timeout) { - ERROR_LOG(SCENET, "UNIMPL sceHttpSetRecvTimeOut(%d, %x)", id, timeout); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpSetRecvTimeOut(%d, %x)", id, timeout); return 0; } static int sceHttpGetAllHeader(int request, u32 headerPtrToPtr, u32 headerSize) { - ERROR_LOG(SCENET, "UNIMPL sceHttpGetAllHeader(%d, %x, %x)", request, headerPtrToPtr, headerSize); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpGetAllHeader(%d, %x, %x)", request, headerPtrToPtr, headerSize); return 0; } static int sceHttpGetContentLength(int requestID, u64 contentLengthPtr) { - ERROR_LOG(SCENET, "UNIMPL sceHttpGetContentLength(%d, %llx)", requestID, contentLengthPtr); + ERROR_LOG(Log::sceNet, "UNIMPL sceHttpGetContentLength(%d, %llx)", requestID, contentLengthPtr); return 0; } diff --git a/Core/HLE/sceImpose.cpp b/Core/HLE/sceImpose.cpp index 5cb102a8d0..c72fea4995 100644 --- a/Core/HLE/sceImpose.cpp +++ b/Core/HLE/sceImpose.cpp @@ -65,7 +65,7 @@ void __ImposeDoState(PointerWrap &p) static u32 sceImposeGetBatteryIconStatus(u32 chargingPtr, u32 iconStatusPtr) { - DEBUG_LOG(SCEUTILITY, "sceImposeGetBatteryIconStatus(%08x, %08x)", chargingPtr, iconStatusPtr); + DEBUG_LOG(Log::sceUtility, "sceImposeGetBatteryIconStatus(%08x, %08x)", chargingPtr, iconStatusPtr); if (Memory::IsValidAddress(chargingPtr)) Memory::Write_U32(PSP_IMPOSE_BATTICON_NONE, chargingPtr); if (Memory::IsValidAddress(iconStatusPtr)) @@ -77,14 +77,14 @@ static u32 sceImposeSetLanguageMode(u32 languageVal, u32 buttonVal) { language = languageVal; buttonValue = buttonVal; if (language != g_Config.GetPSPLanguage()) { - return hleLogWarning(SCEUTILITY, 0, "ignoring requested language"); + return hleLogWarning(Log::sceUtility, 0, "ignoring requested language"); } - return hleLogSuccessI(SCEUTILITY, 0); + return hleLogSuccessI(Log::sceUtility, 0); } static u32 sceImposeGetLanguageMode(u32 languagePtr, u32 btnPtr) { - DEBUG_LOG(SCEUTILITY, "sceImposeGetLanguageMode(%08x, %08x)", languagePtr, btnPtr); + DEBUG_LOG(Log::sceUtility, "sceImposeGetLanguageMode(%08x, %08x)", languagePtr, btnPtr); if (Memory::IsValidAddress(languagePtr)) Memory::Write_U32(language, languagePtr); if (Memory::IsValidAddress(btnPtr)) @@ -93,24 +93,24 @@ static u32 sceImposeGetLanguageMode(u32 languagePtr, u32 btnPtr) } static u32 sceImposeSetUMDPopup(int mode) { - DEBUG_LOG(SCEUTILITY, "sceImposeSetUMDPopup(%i)", mode); + DEBUG_LOG(Log::sceUtility, "sceImposeSetUMDPopup(%i)", mode); umdPopup = mode; return 0; } static u32 sceImposeGetUMDPopup() { - DEBUG_LOG(SCEUTILITY, "sceImposeGetUMDPopup()"); + DEBUG_LOG(Log::sceUtility, "sceImposeGetUMDPopup()"); return umdPopup; } static u32 sceImposeSetBacklightOffTime(int time) { - DEBUG_LOG(SCEUTILITY, "sceImposeSetBacklightOffTime(%i)", time); + DEBUG_LOG(Log::sceUtility, "sceImposeSetBacklightOffTime(%i)", time); backlightOffTime = time; return 0; } static u32 sceImposeGetBacklightOffTime() { - DEBUG_LOG(SCEUTILITY, "sceImposeGetBacklightOffTime()"); + DEBUG_LOG(Log::sceUtility, "sceImposeGetBacklightOffTime()"); return backlightOffTime; } diff --git a/Core/HLE/sceIo.cpp b/Core/HLE/sceIo.cpp index 974a224a26..6b5a336b2c 100644 --- a/Core/HLE/sceIo.cpp +++ b/Core/HLE/sceIo.cpp @@ -239,7 +239,7 @@ public: if (!infoReady) { info = pspFileSystem.GetFileInfo(fullpath); if (!info.exists) { - ERROR_LOG(IO, "File %s no longer exists when reading info", fullpath.c_str()); + ERROR_LOG(Log::IO, "File %s no longer exists when reading info", fullpath.c_str()); } infoReady = true; } @@ -431,7 +431,7 @@ static void __IoAsyncNotify(u64 userdata, int cyclesLate) { u32 error; FileNode *f = __IoGetFd(fd, error); if (!f) { - ERROR_LOG_REPORT(SCEIO, "__IoAsyncNotify: file no longer exists?"); + ERROR_LOG_REPORT(Log::sceIo, "__IoAsyncNotify: file no longer exists?"); return; } @@ -489,7 +489,7 @@ static void __IoSyncNotify(u64 userdata, int cyclesLate) { u32 error; FileNode *f = __IoGetFd(fd, error); if (!f) { - ERROR_LOG_REPORT(SCEIO, "__IoSyncNotify: file no longer exists?"); + ERROR_LOG_REPORT(Log::sceIo, "__IoSyncNotify: file no longer exists?"); return; } @@ -516,7 +516,7 @@ static void __IoSyncNotify(u64 userdata, int cyclesLate) { if (ioManager.WaitResult(f->handle, managerResult)) { result = managerResult.result; } else { - ERROR_LOG(SCEIO, "Unable to complete IO operation on %s", f->GetName()); + ERROR_LOG(Log::sceIo, "Unable to complete IO operation on %s", f->GetName()); } f->pendingAsyncResult = false; @@ -529,9 +529,9 @@ static void __IoSyncNotify(u64 userdata, int cyclesLate) { static void __IoAsyncBeginCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitBeginCallback(threadID, prevCallbackId, -1); if (result == HLEKernel::WAIT_CB_SUCCESS) { - DEBUG_LOG(SCEIO, "sceIoWaitAsync: Suspending wait for callback"); + DEBUG_LOG(Log::sceIo, "sceIoWaitAsync: Suspending wait for callback"); } else if (result == HLEKernel::WAIT_CB_BAD_WAIT_ID) { - WARN_LOG_REPORT(SCEIO, "sceIoWaitAsync: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceIo, "sceIoWaitAsync: beginning callback with bad wait id?"); } } @@ -545,7 +545,7 @@ static bool __IoCheckAsyncWait(FileNode *f, SceUID threadID, u32 &error, int res } } if (fd == -1) { - ERROR_LOG_REPORT(SCEIO, "__IoCheckAsyncWait: could not find io handle"); + ERROR_LOG_REPORT(Log::sceIo, "__IoCheckAsyncWait: could not find io handle"); return true; } @@ -576,7 +576,7 @@ static bool __IoCheckAsyncWait(FileNode *f, SceUID threadID, u32 &error, int res static void __IoAsyncEndCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitEndCallback(threadID, prevCallbackId, -1, __IoCheckAsyncWait); if (result == HLEKernel::WAIT_CB_RESUMED_WAIT) { - DEBUG_LOG(SCEIO, "sceKernelWaitEventFlagCB: Resuming lock wait for callback"); + DEBUG_LOG(Log::sceIo, "sceKernelWaitEventFlagCB: Resuming lock wait for callback"); } } @@ -658,7 +658,7 @@ void __IoInit() { Path pspDir = GetSysDirectory(DIRECTORY_PSP); if (pspDir == g_Config.memStickDirectory) { // Initially tried to do this with dual mounts, but failed due to save state compatibility issues. - INFO_LOG(SCEIO, "Enabling /PSP compatibility mode"); + INFO_LOG(Log::sceIo, "Enabling /PSP compatibility mode"); memstickFlags |= FileSystemFlags::STRIP_PSP; } @@ -677,9 +677,9 @@ void __IoInit() { if (File::Exists(exdataPath)) { auto exdataSystem = std::make_shared(&pspFileSystem, exdataPath, FileSystemFlags::SIMULATE_FAT32 | FileSystemFlags::CARD); pspFileSystem.Mount("exdata0:", exdataSystem); - INFO_LOG(SCEIO, "Mounted exdata/%s/ under memstick for exdata0:/", gameId.c_str()); + INFO_LOG(Log::sceIo, "Mounted exdata/%s/ under memstick for exdata0:/", gameId.c_str()); } else { - INFO_LOG(SCEIO, "Did not find exdata/%s/ under memstick for exdata0:/", gameId.c_str()); + INFO_LOG(Log::sceIo, "Did not find exdata/%s/ under memstick for exdata0:/", gameId.c_str()); } } @@ -841,7 +841,7 @@ static u32 sceIoAssign(u32 alias_addr, u32 physical_addr, u32 filesystem_addr, i if (!Memory::IsValidNullTerminatedString(alias_addr) || !Memory::IsValidNullTerminatedString(physical_addr) || !Memory::IsValidNullTerminatedString(filesystem_addr)) { - return hleLogError(SCEIO, -1, "Bad parameters"); + return hleLogError(Log::sceIo, -1, "Bad parameters"); } std::string alias = Memory::GetCharPointer(alias_addr); @@ -860,28 +860,28 @@ static u32 sceIoAssign(u32 alias_addr, u32 physical_addr, u32 filesystem_addr, i perm = "unhandled"; break; } - WARN_LOG_REPORT(SCEIO, "sceIoAssign(%s, %s, %s, %s, %08x, %i)", alias.c_str(), physical_dev.c_str(), filesystem_dev.c_str(), perm.c_str(), arg_addr, argSize); + WARN_LOG_REPORT(Log::sceIo, "sceIoAssign(%s, %s, %s, %s, %08x, %i)", alias.c_str(), physical_dev.c_str(), filesystem_dev.c_str(), perm.c_str(), arg_addr, argSize); return 0; } static u32 sceIoUnassign(const char *alias) { - WARN_LOG_REPORT(SCEIO, "sceIoUnassign(%s)", alias); + WARN_LOG_REPORT(Log::sceIo, "sceIoUnassign(%s)", alias); return 0; } static u32 sceKernelStdin() { - DEBUG_LOG(SCEIO, "%d=sceKernelStdin()", PSP_STDIN); + DEBUG_LOG(Log::sceIo, "%d=sceKernelStdin()", PSP_STDIN); return PSP_STDIN; } static u32 sceKernelStdout() { - DEBUG_LOG(SCEIO, "%d=sceKernelStdout()", PSP_STDOUT); + DEBUG_LOG(Log::sceIo, "%d=sceKernelStdout()", PSP_STDOUT); return PSP_STDOUT; } static u32 sceKernelStderr() { - DEBUG_LOG(SCEIO, "%d=sceKernelStderr()", PSP_STDERR); + DEBUG_LOG(Log::sceIo, "%d=sceKernelStderr()", PSP_STDERR); return PSP_STDERR; } @@ -967,14 +967,14 @@ static u32 sceIoGetstat(const char *filename, u32 addr) { if (stat.IsValid()) { __IoGetStat(stat, info); stat.NotifyWrite("IoGetstat"); - DEBUG_LOG(SCEIO, "sceIoGetstat(%s, %08x) : sector = %08x", filename, addr, info.startSector); + DEBUG_LOG(Log::sceIo, "sceIoGetstat(%s, %08x) : sector = %08x", filename, addr, info.startSector); return hleDelayResult(0, "io getstat", usec); } else { - ERROR_LOG(SCEIO, "sceIoGetstat(%s, %08x) : bad address", filename, addr); + ERROR_LOG(Log::sceIo, "sceIoGetstat(%s, %08x) : bad address", filename, addr); return hleDelayResult(-1, "io getstat", usec); } } else { - DEBUG_LOG(SCEIO, "sceIoGetstat(%s, %08x) : FILE NOT FOUND", filename, addr); + DEBUG_LOG(Log::sceIo, "sceIoGetstat(%s, %08x) : FILE NOT FOUND", filename, addr); return hleDelayResult(SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "io getstat", usec); } } @@ -982,23 +982,23 @@ static u32 sceIoGetstat(const char *filename, u32 addr) { static u32 sceIoChstat(const char *filename, u32 iostatptr, u32 changebits) { auto iostat = PSPPointer::Create(iostatptr); if (!iostat.IsValid()) - return hleReportError(SCEIO, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT, "bad address"); + return hleReportError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT, "bad address"); - ERROR_LOG_REPORT(SCEIO, "UNIMPL sceIoChstat(%s, %08x, %08x)", filename, iostatptr, changebits); + ERROR_LOG_REPORT(Log::sceIo, "UNIMPL sceIoChstat(%s, %08x, %08x)", filename, iostatptr, changebits); if (changebits & SCE_CST_MODE) - ERROR_LOG_REPORT(SCEIO, "sceIoChstat: change mode to %03o requested", iostat->st_mode); + ERROR_LOG_REPORT(Log::sceIo, "sceIoChstat: change mode to %03o requested", iostat->st_mode); if (changebits & SCE_CST_ATTR) - ERROR_LOG_REPORT(SCEIO, "sceIoChstat: change attr to %04x requested", iostat->st_attr); + ERROR_LOG_REPORT(Log::sceIo, "sceIoChstat: change attr to %04x requested", iostat->st_attr); if (changebits & SCE_CST_SIZE) - ERROR_LOG(SCEIO, "sceIoChstat: change size requested"); + ERROR_LOG(Log::sceIo, "sceIoChstat: change size requested"); if (changebits & SCE_CST_CT) - ERROR_LOG(SCEIO, "sceIoChstat: change creation time requested"); + ERROR_LOG(Log::sceIo, "sceIoChstat: change creation time requested"); if (changebits & SCE_CST_AT) - ERROR_LOG(SCEIO, "sceIoChstat: change access time requested"); + ERROR_LOG(Log::sceIo, "sceIoChstat: change access time requested"); if (changebits & SCE_CST_MT) - ERROR_LOG_REPORT(SCEIO, "sceIoChstat: change modification time to %04d-%02d-%02d requested", iostat->st_m_time.year, iostat->st_m_time.month, iostat->st_m_time.day); + ERROR_LOG_REPORT(Log::sceIo, "sceIoChstat: change modification time to %04d-%02d-%02d requested", iostat->st_m_time.year, iostat->st_m_time.month, iostat->st_m_time.day); if (changebits & SCE_CST_PRVT) - ERROR_LOG(SCEIO, "sceIoChstat: change private data requested"); + ERROR_LOG(Log::sceIo, "sceIoChstat: change private data requested"); return 0; } @@ -1058,7 +1058,7 @@ static bool __IoRead(int &result, int id, u32 data_addr, int size, int &us) { } if (id == PSP_STDIN) { - DEBUG_LOG(SCEIO, "sceIoRead STDIN"); + DEBUG_LOG(Log::sceIo, "sceIoRead STDIN"); result = 0; //stdin return true; } @@ -1133,11 +1133,11 @@ static u32 sceIoRead(int id, u32 data_addr, int size) { FileNode *f = __IoGetFd(id, error); if (id > 2 && f != NULL) { if (!__KernelIsDispatchEnabled()) { - DEBUG_LOG(SCEIO, "sceIoRead(%d, %08x, %x): dispatch disabled", id, data_addr, size); + DEBUG_LOG(Log::sceIo, "sceIoRead(%d, %08x, %x): dispatch disabled", id, data_addr, size); return SCE_KERNEL_ERROR_CAN_NOT_WAIT; } if (__IsInInterrupt()) { - DEBUG_LOG(SCEIO, "sceIoRead(%d, %08x, %x): inside interrupt", id, data_addr, size); + DEBUG_LOG(Log::sceIo, "sceIoRead(%d, %08x, %x): inside interrupt", id, data_addr, size); return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT; } } @@ -1146,17 +1146,17 @@ static u32 sceIoRead(int id, u32 data_addr, int size) { int us; bool complete = __IoRead(result, id, data_addr, size, us); if (!complete) { - DEBUG_LOG(SCEIO, "sceIoRead(%d, %08x, %x): deferring result", id, data_addr, size); + DEBUG_LOG(Log::sceIo, "sceIoRead(%d, %08x, %x): deferring result", id, data_addr, size); __IoSchedSync(f, id, us); __KernelWaitCurThread(WAITTYPE_IO, id, 0, 0, false, "io read"); f->waitingSyncThreads.push_back(__KernelGetCurThread()); return 0; } else if (result >= 0) { - DEBUG_LOG(SCEIO, "%x=sceIoRead(%d, %08x, %x)", result, id, data_addr, size); + DEBUG_LOG(Log::sceIo, "%x=sceIoRead(%d, %08x, %x)", result, id, data_addr, size); return hleDelayResult(result, "io read", us); } else { - WARN_LOG(SCEIO, "sceIoRead(%d, %08x, %x): error %08x", id, data_addr, size, result); + WARN_LOG(Log::sceIo, "sceIoRead(%d, %08x, %x): error %08x", id, data_addr, size, result); return result; } } @@ -1166,7 +1166,7 @@ static u32 sceIoReadAsync(int id, u32 data_addr, int size) { FileNode *f = __IoGetFd(id, error); if (f) { if (f->asyncBusy()) { - return hleLogWarning(SCEIO, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); + return hleLogWarning(Log::sceIo, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); } auto ¶ms = asyncParams[id]; @@ -1174,9 +1174,9 @@ static u32 sceIoReadAsync(int id, u32 data_addr, int size) { params.std.addr = data_addr; params.std.size = size; IoStartAsyncThread(id, f); - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } else { - return hleLogError(SCEIO, error, "bad file descriptor"); + return hleLogError(Log::sceIo, error, "bad file descriptor"); } } @@ -1194,7 +1194,7 @@ static bool __IoWrite(int &result, int id, u32 data_addr, int size, int &us) { if (id == PSP_STDOUT || id == PSP_STDERR) { const char *str = (const char *) data_ptr; const int str_size = size <= 0 ? 0 : (str[validSize - 1] == '\n' ? validSize - 1 : validSize); - INFO_LOG(PRINTF, "%s: %.*s", id == 1 ? "stdout" : "stderr", str_size, str); + INFO_LOG(Log::Printf, "%s: %.*s", id == 1 ? "stdout" : "stderr", str_size, str); result = validSize; return true; } @@ -1220,7 +1220,7 @@ static bool __IoWrite(int &result, int id, u32 data_addr, int size, int &us) { if (f->isTTY) { const char *str = (const char *)data_ptr; const int str_size = size <= 0 ? 0 : (str[validSize - 1] == '\n' ? validSize - 1 : validSize); - INFO_LOG(PRINTF, "%s: %.*s", "tty", str_size, str); + INFO_LOG(Log::Printf, "%s: %.*s", "tty", str_size, str); result = validSize; return true; } @@ -1250,7 +1250,7 @@ static bool __IoWrite(int &result, int id, u32 data_addr, int size, int &us) { } return true; } else { - ERROR_LOG(SCEIO, "sceIoWrite ERROR: no file open"); + ERROR_LOG(Log::sceIo, "sceIoWrite ERROR: no file open"); result = (s32) error; return true; } @@ -1261,11 +1261,11 @@ static u32 sceIoWrite(int id, u32 data_addr, int size) { FileNode *f = __IoGetFd(id, error); if (id > 2 && f != NULL) { if (!__KernelIsDispatchEnabled()) { - DEBUG_LOG(SCEIO, "sceIoWrite(%d, %08x, %x): dispatch disabled", id, data_addr, size); + DEBUG_LOG(Log::sceIo, "sceIoWrite(%d, %08x, %x): dispatch disabled", id, data_addr, size); return SCE_KERNEL_ERROR_CAN_NOT_WAIT; } if (__IsInInterrupt()) { - DEBUG_LOG(SCEIO, "sceIoWrite(%d, %08x, %x): inside interrupt", id, data_addr, size); + DEBUG_LOG(Log::sceIo, "sceIoWrite(%d, %08x, %x): inside interrupt", id, data_addr, size); return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT; } } @@ -1274,14 +1274,14 @@ static u32 sceIoWrite(int id, u32 data_addr, int size) { int us; bool complete = __IoWrite(result, id, data_addr, size, us); if (!complete) { - DEBUG_LOG(SCEIO, "sceIoWrite(%d, %08x, %x): deferring result", id, data_addr, size); + DEBUG_LOG(Log::sceIo, "sceIoWrite(%d, %08x, %x): deferring result", id, data_addr, size); __IoSchedSync(f, id, us); __KernelWaitCurThread(WAITTYPE_IO, id, 0, 0, false, "io write"); f->waitingSyncThreads.push_back(__KernelGetCurThread()); return 0; } else if (result >= 0) { - DEBUG_LOG(SCEIO, "%x=sceIoWrite(%d, %08x, %x)", result, id, data_addr, size); + DEBUG_LOG(Log::sceIo, "%x=sceIoWrite(%d, %08x, %x)", result, id, data_addr, size); if (__KernelIsDispatchEnabled()) { // If we wrote to stdout, return an error (even though we did log it) rather than delaying. // On actual hardware, it would just return this... we just want the log output. @@ -1293,7 +1293,7 @@ static u32 sceIoWrite(int id, u32 data_addr, int size) { return result; } } else { - WARN_LOG(SCEIO, "sceIoWrite(%d, %08x, %x): error %08x", id, data_addr, size, result); + WARN_LOG(Log::sceIo, "sceIoWrite(%d, %08x, %x): error %08x", id, data_addr, size, result); return result; } } @@ -1303,7 +1303,7 @@ static u32 sceIoWriteAsync(int id, u32 data_addr, int size) { FileNode *f = __IoGetFd(id, error); if (f) { if (f->asyncBusy()) { - return hleLogWarning(SCEIO, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); + return hleLogWarning(Log::sceIo, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); } auto ¶ms = asyncParams[id]; @@ -1311,15 +1311,15 @@ static u32 sceIoWriteAsync(int id, u32 data_addr, int size) { params.std.addr = data_addr; params.std.size = size; IoStartAsyncThread(id, f); - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } else { - return hleLogError(SCEIO, error, "bad file descriptor"); + return hleLogError(Log::sceIo, error, "bad file descriptor"); } } static u32 sceIoGetDevType(int id) { if (id == PSP_STDOUT || id == PSP_STDERR || id == PSP_STDIN) { - DEBUG_LOG(SCEIO, "sceIoGetDevType(%d)", id); + DEBUG_LOG(Log::sceIo, "sceIoGetDevType(%d)", id); return (u32)PSPDevType::FILE; } @@ -1328,13 +1328,13 @@ static u32 sceIoGetDevType(int id) { int result; if (f) { // TODO: When would this return PSP_DEV_TYPE_ALIAS? - WARN_LOG(SCEIO, "sceIoGetDevType(%d - %s)", id, f->fullpath.c_str()); + WARN_LOG(Log::sceIo, "sceIoGetDevType(%d - %s)", id, f->fullpath.c_str()); if (f->isTTY) result = (u32)PSPDevType::FILE; else result = (u32)pspFileSystem.DevType(f->handle) & (u32)PSPDevType::EMU_MASK; } else { - ERROR_LOG(SCEIO, "sceIoGetDevType: unknown id %d", id); + ERROR_LOG(Log::sceIo, "sceIoGetDevType: unknown id %d", id); result = SCE_KERNEL_ERROR_BADF; } @@ -1347,9 +1347,9 @@ static u32 sceIoCancel(int id) FileNode *f = __IoGetFd(id, error); if (f) { // It seems like this is unsupported for UMDs and memory sticks, based on tests. - return hleReportError(SCEIO, SCE_KERNEL_ERROR_UNSUP, "unimplemented or unsupported"); + return hleReportError(Log::sceIo, SCE_KERNEL_ERROR_UNSUP, "unimplemented or unsupported"); } else { - return hleLogError(SCEIO, SCE_KERNEL_ERROR_BADF, "invalid fd"); + return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_BADF, "invalid fd"); } } @@ -1412,7 +1412,7 @@ static s64 __IoLseek(SceUID id, s64 offset, int whence) { FileNode *f = __IoGetFd(id, error); if (f) { if (f->asyncBusy()) { - WARN_LOG(SCEIO, "sceIoLseek*(%d, %llx, %i): async busy", id, offset, whence); + WARN_LOG(Log::sceIo, "sceIoLseek*(%d, %llx, %i): async busy", id, offset, whence); return SCE_KERNEL_ERROR_ASYNC_BUSY; } FileMove seek; @@ -1432,26 +1432,26 @@ static s64 __IoLseek(SceUID id, s64 offset, int whence) { static s64 sceIoLseek(int id, s64 offset, int whence) { s64 result = __IoLseek(id, offset, whence); if (result >= 0 || result == -1) { - DEBUG_LOG(SCEIO, "%lli = sceIoLseek(%d, %llx, %i)", result, id, offset, whence); + DEBUG_LOG(Log::sceIo, "%lli = sceIoLseek(%d, %llx, %i)", result, id, offset, whence); // Educated guess at timing. hleEatCycles(1400); hleReSchedule("io seek"); return result; } else { - return hleLogError(SCEIO, result, "bad file descriptor"); + return hleLogError(Log::sceIo, result, "bad file descriptor"); } } static u32 sceIoLseek32(int id, int offset, int whence) { s32 result = (s32) __IoLseek(id, offset, whence); if (result >= 0 || result == -1) { - DEBUG_LOG(SCEIO, "%i = sceIoLseek32(%d, %x, %i)", result, id, offset, whence); + DEBUG_LOG(Log::sceIo, "%i = sceIoLseek32(%d, %x, %i)", result, id, offset, whence); // Educated guess at timing. hleEatCycles(1400); hleReSchedule("io seek"); return result; } else { - return hleLogError(SCEIO, result, "bad file descriptor"); + return hleLogError(Log::sceIo, result, "bad file descriptor"); } } @@ -1460,10 +1460,10 @@ static u32 sceIoLseekAsync(int id, s64 offset, int whence) { FileNode *f = __IoGetFd(id, error); if (f) { if (whence < 0 || whence > 2) { - return hleLogWarning(SCEIO, SCE_KERNEL_ERROR_INVAL, "invalid whence"); + return hleLogWarning(Log::sceIo, SCE_KERNEL_ERROR_INVAL, "invalid whence"); } if (f->asyncBusy()) { - return hleLogWarning(SCEIO, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); + return hleLogWarning(Log::sceIo, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); } auto ¶ms = asyncParams[id]; @@ -1471,9 +1471,9 @@ static u32 sceIoLseekAsync(int id, s64 offset, int whence) { params.seek.pos = offset; params.seek.whence = whence; IoStartAsyncThread(id, f); - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } else { - return hleLogError(SCEIO, error, "bad file descriptor"); + return hleLogError(Log::sceIo, error, "bad file descriptor"); } return 0; } @@ -1483,10 +1483,10 @@ static u32 sceIoLseek32Async(int id, int offset, int whence) { FileNode *f = __IoGetFd(id, error); if (f) { if (whence < 0 || whence > 2) { - return hleLogWarning(SCEIO, SCE_KERNEL_ERROR_INVAL, "invalid whence"); + return hleLogWarning(Log::sceIo, SCE_KERNEL_ERROR_INVAL, "invalid whence"); } if (f->asyncBusy()) { - return hleLogWarning(SCEIO, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); + return hleLogWarning(Log::sceIo, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); } auto ¶ms = asyncParams[id]; @@ -1494,9 +1494,9 @@ static u32 sceIoLseek32Async(int id, int offset, int whence) { params.seek.pos = offset; params.seek.whence = whence; IoStartAsyncThread(id, f); - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } else { - return hleLogError(SCEIO, error, "bad file descriptor"); + return hleLogError(Log::sceIo, error, "bad file descriptor"); } return 0; } @@ -1564,12 +1564,12 @@ static u32 sceIoOpen(const char *filename, int flags, int mode) { if (!filename) { // Not tested on the PSP. - return hleLogError(SCEIO, SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "nullptr file not found"); + return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "nullptr file not found"); } if (!__KernelIsDispatchEnabled()) { hleEatCycles(48000); - return hleLogError(SCEIO, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); } int error; @@ -1578,49 +1578,49 @@ static u32 sceIoOpen(const char *filename, int flags, int mode) { _assert_(error != 0); if (error == (int)SCE_KERNEL_ERROR_NOCWD) { // TODO: Timing is not accurate. - return hleLogError(SCEIO, hleDelayResult(error, "file opened", 10000), "no current working directory"); + return hleLogError(Log::sceIo, hleDelayResult(error, "file opened", 10000), "no current working directory"); } else if (error == (int)SCE_KERNEL_ERROR_NODEV) { - return hleLogError(SCEIO, error, "device not found"); + return hleLogError(Log::sceIo, error, "device not found"); } else if (error == (int)SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND) { // UMD: Varies between 5-10ms, could take longer if disc spins up. // TODO: Bad filename at root (disc0:/no.exist) should take ~200us. // Card: Path depth matters, but typically between 10-13ms on a standard Pro Duo. // TODO: If a UMD and spun down, this can easily take 1s+. int delay = pspFileSystem.FlagsFromFilename(filename) & FileSystemFlags::UMD ? 6000 : 10000; - return hleLogWarning(SCEIO, hleDelayResult(error, "file opened", delay), "file not found"); + return hleLogWarning(Log::sceIo, hleDelayResult(error, "file opened", delay), "file not found"); } else { - return hleLogError(SCEIO, hleDelayResult(error, "file opened", 10000)); + return hleLogError(Log::sceIo, hleDelayResult(error, "file opened", 10000)); } } int id = __IoAllocFd(f); if (id < 0) { kernelObjects.Destroy(f->GetUID()); - return hleLogError(SCEIO, hleDelayResult(id, "file opened", 1000), "out of fds"); + return hleLogError(Log::sceIo, hleDelayResult(id, "file opened", 1000), "out of fds"); } else { asyncParams[id].priority = asyncDefaultPriority; IFileSystem *sys = pspFileSystem.GetSystemFromFilename(filename); if (sys && !f->isTTY && (sys->DevType(f->handle) & (PSPDevType::BLOCK | PSPDevType::EMU_LBN))) { // These are fast to open, no delay or even rescheduling happens. - return hleLogSuccessI(SCEIO, id); + return hleLogSuccessI(Log::sceIo, id); } // UMD: Speed varies from 1-6ms. // Card: Path depth matters, but typically between 10-13ms on a standard Pro Duo. int delay = pspFileSystem.FlagsFromFilename(filename) & FileSystemFlags::UMD ? 4000 : 10000; - return hleLogSuccessI(SCEIO, hleDelayResult(id, "file opened", delay)); + return hleLogSuccessI(Log::sceIo, hleDelayResult(id, "file opened", delay)); } } static u32 sceIoClose(int id) { u32 error; - DEBUG_LOG(SCEIO, "sceIoClose(%d)", id); + DEBUG_LOG(Log::sceIo, "sceIoClose(%d)", id); __IoFreeFd(id, error); // Timing is not accurate, aiming low for now. return hleDelayResult(error, "file closed", 100); } static u32 sceIoRemove(const char *filename) { - DEBUG_LOG(SCEIO, "sceIoRemove(%s)", filename); + DEBUG_LOG(Log::sceIo, "sceIoRemove(%s)", filename); // TODO: This timing isn't necessarily accurate, low end for now. if(!pspFileSystem.GetFileInfo(filename).exists) @@ -1631,7 +1631,7 @@ static u32 sceIoRemove(const char *filename) { } static u32 sceIoMkdir(const char *dirname, int mode) { - DEBUG_LOG(SCEIO, "sceIoMkdir(%s, %i)", dirname, mode); + DEBUG_LOG(Log::sceIo, "sceIoMkdir(%s, %i)", dirname, mode); // TODO: Improve timing. if (pspFileSystem.MkDir(dirname)) return hleDelayResult(0, "mkdir", 1000); @@ -1640,7 +1640,7 @@ static u32 sceIoMkdir(const char *dirname, int mode) { } static u32 sceIoRmdir(const char *dirname) { - DEBUG_LOG(SCEIO, "sceIoRmdir(%s)", dirname); + DEBUG_LOG(Log::sceIo, "sceIoRmdir(%s)", dirname); // TODO: Improve timing. if (pspFileSystem.RmDir(dirname)) return hleDelayResult(0, "rmdir", 1000); @@ -1649,7 +1649,7 @@ static u32 sceIoRmdir(const char *dirname) { } static u32 sceIoSync(const char *devicename, int flag) { - DEBUG_LOG(SCEIO, "UNIMPL sceIoSync(%s, %i)", devicename, flag); + DEBUG_LOG(Log::sceIo, "UNIMPL sceIoSync(%s, %i)", devicename, flag); return 0; } @@ -1663,7 +1663,7 @@ struct DeviceSize { static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 outPtr, int outLen) { if (strcmp(name, "emulator:")) { - DEBUG_LOG(SCEIO,"sceIoDevctl(\"%s\", %08x, %08x, %i, %08x, %i)", name, cmd, argAddr, argLen, outPtr, outLen); + DEBUG_LOG(Log::sceIo,"sceIoDevctl(\"%s\", %08x, %08x, %i, %08x, %i)", name, cmd, argAddr, argLen, outPtr, outLen); } // UMD checks @@ -1755,7 +1755,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o case 0x01F100A6: case 0x01F100A8: case 0x01F100A9: - ERROR_LOG_REPORT(SCEIO, "UNIMPL sceIoDevctl(\"%s\", %08x, %08x, %i, %08x, %i)", name, cmd, argAddr, argLen, outPtr, outLen); + ERROR_LOG_REPORT(Log::sceIo, "UNIMPL sceIoDevctl(\"%s\", %08x, %08x, %i, %08x, %i)", name, cmd, argAddr, argLen, outPtr, outLen); return 0; } @@ -1794,10 +1794,10 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o // * 1 = Memory stick inserted // * 2 = Memory stick removed // * 4 = Memory stick mounting? (followed by a 1 about 500ms later) - DEBUG_LOG(SCEIO, "sceIoDevctl: Memstick callback %i registered, notifying immediately", cbId); + DEBUG_LOG(Log::sceIo, "sceIoDevctl: Memstick callback %i registered, notifying immediately", cbId); __KernelNotifyCallback(cbId, MemoryStick_State()); } else { - DEBUG_LOG(SCEIO, "sceIoDevctl: Memstick callback %i registered", cbId); + DEBUG_LOG(Log::sceIo, "sceIoDevctl: Memstick callback %i registered", cbId); } return 0; } else { @@ -1822,7 +1822,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o if (slot != (size_t)-1) { memStickCallbacks.erase(memStickCallbacks.begin() + slot); - DEBUG_LOG(SCEIO, "sceIoDevctl: Unregistered memstick callback %i", cbId); + DEBUG_LOG(Log::sceIo, "sceIoDevctl: Unregistered memstick callback %i", cbId); return 0; } else { return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT; @@ -1879,7 +1879,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o Memory::WriteUnchecked_U32(0, outPtr); return 0; } else { - ERROR_LOG(SCEIO, "Failed 0x02425824 fat"); + ERROR_LOG(Log::sceIo, "Failed 0x02425824 fat"); return -1; } break; @@ -1906,10 +1906,10 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o // Values observed: // * 1 = Memory stick inserted // * 2 = Memory stick removed - DEBUG_LOG(SCEIO, "sceIoDevCtl: Memstick FAT callback %i registered, notifying immediately", cbId); + DEBUG_LOG(Log::sceIo, "sceIoDevCtl: Memstick FAT callback %i registered, notifying immediately", cbId); __KernelNotifyCallback(cbId, MemoryStick_FatState()); } else { - DEBUG_LOG(SCEIO, "sceIoDevCtl: Memstick FAT callback %i registered", cbId); + DEBUG_LOG(Log::sceIo, "sceIoDevCtl: Memstick FAT callback %i registered", cbId); } return 0; } else { @@ -1934,7 +1934,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o if (slot != (size_t)-1) { memStickFatCallbacks.erase(memStickFatCallbacks.begin() + slot); - DEBUG_LOG(SCEIO, "sceIoDevCtl: Unregistered memstick FAT callback %i", cbId); + DEBUG_LOG(Log::sceIo, "sceIoDevCtl: Unregistered memstick FAT callback %i", cbId); return 0; } else { return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT; @@ -1947,7 +1947,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o MemoryStick_SetFatState((MemStickFatState)Memory::Read_U32(argAddr)); return 0; } else { - ERROR_LOG(SCEIO, "Failed 0x02415823 fat"); + ERROR_LOG(Log::sceIo, "Failed 0x02415823 fat"); return -1; } break; @@ -1955,11 +1955,11 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o // Check if FAT enabled // If the values added together are >= 0x80000000, or less than outPtr, invalid address. if (((int)outPtr + outLen) < (int)outPtr) { - ERROR_LOG(SCEIO, "sceIoDevctl: fatms0: 0x02425823 command, bad address"); + ERROR_LOG(Log::sceIo, "sceIoDevctl: fatms0: 0x02425823 command, bad address"); return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } else if (!Memory::IsValidAddress(outPtr)) { // Technically, only checks for NULL, crashes for many bad addresses. - ERROR_LOG(SCEIO, "sceIoDevctl: fatms0: 0x02425823 command, no output address"); + ERROR_LOG(Log::sceIo, "sceIoDevctl: fatms0: 0x02425823 command, no output address"); return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT; } else { // Does not care about outLen, even if it's 0. @@ -1977,7 +1977,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o Memory::Write_U32(0, outPtr); return 0; } else { - ERROR_LOG(SCEIO, "Failed 0x02425824 fat"); + ERROR_LOG(Log::sceIo, "Failed 0x02425824 fat"); return -1; } break; @@ -2039,7 +2039,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o if (Memory::IsValidRange(argAddr, argLen)) { std::string data(Memory::GetCharPointerUnchecked(argAddr), argLen); if (!System_SendDebugOutput(data)) - DEBUG_LOG(SCEIO, "%s", data.c_str()); + DEBUG_LOG(Log::sceIo, "%s", data.c_str()); if (PSP_CoreParameter().collectDebugOutput) *PSP_CoreParameter().collectDebugOutput += data; } @@ -2103,7 +2103,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o return 0; } - ERROR_LOG(SCEIO, "sceIoDevCtl: UNKNOWN PARAMETERS"); + ERROR_LOG(Log::sceIo, "sceIoDevCtl: UNKNOWN PARAMETERS"); return 0; } @@ -2113,12 +2113,12 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o 089c6bdc ]: HLE: sceKernelCreateCallback(name= MemoryStick Detection ,entry= 089c7484 ) (z_un_089c6bc4) 089c6c40 ]: HLE: sceKernelCreateCallback(name= MemoryStick Assignment ,entry= 089c7534 ) (z_un_089c6bc4) */ - ERROR_LOG_REPORT(SCEIO, "UNIMPL sceIoDevctl(\"%s\", %08x, %08x, %i, %08x, %i)", name, cmd, argAddr, argLen, outPtr, outLen); + ERROR_LOG_REPORT(Log::sceIo, "UNIMPL sceIoDevctl(\"%s\", %08x, %08x, %i, %08x, %i)", name, cmd, argAddr, argLen, outPtr, outLen); return SCE_KERNEL_ERROR_UNSUP; } static u32 sceIoRename(const char *from, const char *to) { - DEBUG_LOG(SCEIO, "sceIoRename(%s, %s)", from, to); + DEBUG_LOG(Log::sceIo, "sceIoRename(%s, %s)", from, to); // TODO: Timing isn't terribly accurate. if (!pspFileSystem.GetFileInfo(from).exists) @@ -2126,30 +2126,30 @@ static u32 sceIoRename(const char *from, const char *to) { int result = pspFileSystem.RenameFile(from, to); if (result < 0) - WARN_LOG(SCEIO, "Could not move %s to %s", from, to); + WARN_LOG(Log::sceIo, "Could not move %s to %s", from, to); return hleDelayResult(result, "file renamed", 1000); } static u32 sceIoChdir(const char *dirname) { - DEBUG_LOG(SCEIO, "sceIoChdir(%s)", dirname); + DEBUG_LOG(Log::sceIo, "sceIoChdir(%s)", dirname); return pspFileSystem.ChDir(dirname); } static int sceIoChangeAsyncPriority(int id, int priority) { // priority = -1 is valid,means the current thread'priority if (priority != -1 && (priority < 0x08 || priority > 0x77)) { - return hleLogError(SCEIO, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "illegal priority %d", priority); + return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "illegal priority %d", priority); } if (id == -1) { asyncDefaultPriority = priority; - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } u32 error; FileNode *f = __IoGetFd(id, error); if (!f) { - return hleLogError(SCEIO, error, "bad file descriptor"); + return hleLogError(Log::sceIo, error, "bad file descriptor"); } if (asyncThreads[id] && !asyncThreads[id]->Stopped()) { @@ -2160,17 +2160,17 @@ static int sceIoChangeAsyncPriority(int id, int priority) { } asyncParams[id].priority = priority; - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } static int sceIoCloseAsync(int id) { u32 error; FileNode *f = __IoGetFd(id, error); if (!f) { - return hleLogError(SCEIO, error, "bad file descriptor"); + return hleLogError(Log::sceIo, error, "bad file descriptor"); } if (f->asyncBusy()) { - return hleLogWarning(SCEIO, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); + return hleLogWarning(Log::sceIo, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); } f->closePending = true; @@ -2178,12 +2178,12 @@ static int sceIoCloseAsync(int id) { auto ¶ms = asyncParams[id]; params.op = IoAsyncOp::CLOSE; IoStartAsyncThread(id, f); - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } static u32 sceIoSetAsyncCallback(int id, u32 clbckId, u32 clbckArg) { - DEBUG_LOG(SCEIO, "sceIoSetAsyncCallback(%d, %i, %08x)", id, clbckId, clbckArg); + DEBUG_LOG(Log::sceIo, "sceIoSetAsyncCallback(%d, %i, %08x)", id, clbckId, clbckArg); u32 error; FileNode *f = __IoGetFd(id, error); @@ -2203,7 +2203,7 @@ static u32 sceIoOpenAsync(const char *filename, int flags, int mode) { hleEatCycles(18000); if (!filename) { // Not tested on the PSP. - return hleLogError(SCEIO, SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "nullptr file not found"); + return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "nullptr file not found"); } // TODO: Use an internal method so as not to pollute the log? @@ -2218,7 +2218,7 @@ static u32 sceIoOpenAsync(const char *filename, int flags, int mode) { if (f == nullptr) { _assert_(error != 0); if (error == SCE_KERNEL_ERROR_NODEV) - return hleLogError(SCEIO, error, "device not found"); + return hleLogError(Log::sceIo, error, "device not found"); f = new FileNode(); kernelObjects.Create(f); @@ -2231,7 +2231,7 @@ static u32 sceIoOpenAsync(const char *filename, int flags, int mode) { int fd = __IoAllocFd(f); if (fd < 0) { kernelObjects.Destroy(f->GetUID()); - return hleLogError(SCEIO, hleDelayResult(fd, "file opened", 1000), "out of fds"); + return hleLogError(Log::sceIo, hleDelayResult(fd, "file opened", 1000), "out of fds"); } auto ¶ms = asyncParams[fd]; @@ -2244,11 +2244,11 @@ static u32 sceIoOpenAsync(const char *filename, int flags, int mode) { if (error != 0) { f->asyncResult = (s64)error; - return hleLogError(SCEIO, fd, "file not found"); + return hleLogError(Log::sceIo, fd, "file not found"); } f->asyncResult = fd; - return hleLogSuccessI(SCEIO, fd); + return hleLogSuccessI(Log::sceIo, fd); } static u32 sceIoGetAsyncStat(int id, u32 poll, u32 address) { @@ -2256,30 +2256,30 @@ static u32 sceIoGetAsyncStat(int id, u32 poll, u32 address) { FileNode *f = __IoGetFd(id, error); if (f) { if (__IsInInterrupt()) { - DEBUG_LOG(SCEIO, "%lli = sceIoGetAsyncStat(%i, %i, %08x): illegal context", f->asyncResult, id, poll, address); + DEBUG_LOG(Log::sceIo, "%lli = sceIoGetAsyncStat(%i, %i, %08x): illegal context", f->asyncResult, id, poll, address); return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT; } if (f->pendingAsyncResult) { if (poll) { - DEBUG_LOG(SCEIO, "%lli = sceIoGetAsyncStat(%i, %i, %08x): not ready", f->asyncResult, id, poll, address); + DEBUG_LOG(Log::sceIo, "%lli = sceIoGetAsyncStat(%i, %i, %08x): not ready", f->asyncResult, id, poll, address); return 1; } else { if (!__KernelIsDispatchEnabled()) { - DEBUG_LOG(SCEIO, "%lli = sceIoGetAsyncStat(%i, %i, %08x): dispatch disabled", f->asyncResult, id, poll, address); + DEBUG_LOG(Log::sceIo, "%lli = sceIoGetAsyncStat(%i, %i, %08x): dispatch disabled", f->asyncResult, id, poll, address); return SCE_KERNEL_ERROR_CAN_NOT_WAIT; } - DEBUG_LOG(SCEIO, "%lli = sceIoGetAsyncStat(%i, %i, %08x): waiting", f->asyncResult, id, poll, address); + DEBUG_LOG(Log::sceIo, "%lli = sceIoGetAsyncStat(%i, %i, %08x): waiting", f->asyncResult, id, poll, address); f->waitingThreads.push_back(__KernelGetCurThread()); __KernelWaitCurThread(WAITTYPE_ASYNCIO, f->GetUID(), address, 0, false, "io waited"); } } else if (f->hasAsyncResult) { if (!__KernelIsDispatchEnabled()) { - DEBUG_LOG(SCEIO, "%lli = sceIoGetAsyncStat(%i, %i, %08x): dispatch disabled", f->asyncResult, id, poll, address); + DEBUG_LOG(Log::sceIo, "%lli = sceIoGetAsyncStat(%i, %i, %08x): dispatch disabled", f->asyncResult, id, poll, address); return SCE_KERNEL_ERROR_CAN_NOT_WAIT; } - DEBUG_LOG(SCEIO, "%lli = sceIoGetAsyncStat(%i, %i, %08x)", f->asyncResult, id, poll, address); + DEBUG_LOG(Log::sceIo, "%lli = sceIoGetAsyncStat(%i, %i, %08x)", f->asyncResult, id, poll, address); Memory::Write_U64((u64) f->asyncResult, address); f->hasAsyncResult = false; @@ -2287,14 +2287,14 @@ static u32 sceIoGetAsyncStat(int id, u32 poll, u32 address) { __IoFreeFd(id, error); } } else { - WARN_LOG(SCEIO, "SCE_KERNEL_ERROR_NOASYNC = sceIoGetAsyncStat(%i, %i, %08x)", id, poll, address); + WARN_LOG(Log::sceIo, "SCE_KERNEL_ERROR_NOASYNC = sceIoGetAsyncStat(%i, %i, %08x)", id, poll, address); return SCE_KERNEL_ERROR_NOASYNC; } return 0; //completed } else { - ERROR_LOG(SCEIO, "ERROR - sceIoGetAsyncStat with invalid id %i", id); + ERROR_LOG(Log::sceIo, "ERROR - sceIoGetAsyncStat with invalid id %i", id); return SCE_KERNEL_ERROR_BADF; } } @@ -2304,18 +2304,18 @@ static int sceIoWaitAsync(int id, u32 address) { FileNode *f = __IoGetFd(id, error); if (f) { if (__IsInInterrupt()) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "illegal context"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "illegal context"); } if (f->pendingAsyncResult) { if (!__KernelIsDispatchEnabled()) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); } f->waitingThreads.push_back(__KernelGetCurThread()); __KernelWaitCurThread(WAITTYPE_ASYNCIO, f->GetUID(), address, 0, false, "io waited"); - return hleLogSuccessI(SCEIO, 0, "waiting"); + return hleLogSuccessI(Log::sceIo, 0, "waiting"); } else if (f->hasAsyncResult) { if (!__KernelIsDispatchEnabled()) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); } Memory::Write_U64((u64) f->asyncResult, address); f->hasAsyncResult = false; @@ -2324,13 +2324,13 @@ static int sceIoWaitAsync(int id, u32 address) { __IoFreeFd(id, error); } - return hleLogSuccessI(SCEIO, 0, "complete"); + return hleLogSuccessI(Log::sceIo, 0, "complete"); } else { - return hleLogWarning(SCEIO, SCE_KERNEL_ERROR_NOASYNC, "no async pending"); + return hleLogWarning(Log::sceIo, SCE_KERNEL_ERROR_NOASYNC, "no async pending"); } return 0; //completed } else { - return hleLogError(SCEIO, SCE_KERNEL_ERROR_BADF, "invalid fd"); + return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_BADF, "invalid fd"); } } @@ -2340,7 +2340,7 @@ static int sceIoWaitAsyncCB(int id, u32 address) { FileNode *f = __IoGetFd(id, error); if (f) { if (__IsInInterrupt()) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "illegal context"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "illegal context"); } hleCheckCurrentCallbacks(); @@ -2348,7 +2348,7 @@ static int sceIoWaitAsyncCB(int id, u32 address) { // TODO: This seems to re-enable dispatch or something? f->waitingThreads.push_back(__KernelGetCurThread()); __KernelWaitCurThread(WAITTYPE_ASYNCIO, f->GetUID(), address, 0, true, "io waited"); - return hleLogSuccessI(SCEIO, 0, "waiting"); + return hleLogSuccessI(Log::sceIo, 0, "waiting"); } else if (f->hasAsyncResult) { Memory::Write_U64((u64) f->asyncResult, address); f->hasAsyncResult = false; @@ -2357,12 +2357,12 @@ static int sceIoWaitAsyncCB(int id, u32 address) { __IoFreeFd(id, error); } - return hleLogSuccessI(SCEIO, 0, "complete"); + return hleLogSuccessI(Log::sceIo, 0, "complete"); } else { - return hleLogWarning(SCEIO, SCE_KERNEL_ERROR_NOASYNC, "no async pending"); + return hleLogWarning(Log::sceIo, SCE_KERNEL_ERROR_NOASYNC, "no async pending"); } } else { - return hleLogError(SCEIO, SCE_KERNEL_ERROR_BADF, "invalid fd"); + return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_BADF, "invalid fd"); } } @@ -2371,7 +2371,7 @@ static u32 sceIoPollAsync(int id, u32 address) { FileNode *f = __IoGetFd(id, error); if (f) { if (f->pendingAsyncResult) { - return hleLogSuccessVerboseI(SCEIO, 1, "not ready"); + return hleLogSuccessVerboseI(Log::sceIo, 1, "not ready"); } else if (f->hasAsyncResult) { Memory::Write_U64((u64) f->asyncResult, address); f->hasAsyncResult = false; @@ -2379,12 +2379,12 @@ static u32 sceIoPollAsync(int id, u32 address) { if (f->closePending) { __IoFreeFd(id, error); } - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } else { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_NOASYNC, "no async pending"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_NOASYNC, "no async pending"); } } else { - return hleLogError(SCEIO, SCE_KERNEL_ERROR_BADF, "invalid fd"); + return hleLogError(Log::sceIo, SCE_KERNEL_ERROR_BADF, "invalid fd"); } } @@ -2420,7 +2420,7 @@ public: }; static u32 sceIoDopen(const char *path) { - DEBUG_LOG(SCEIO, "sceIoDopen(\"%s\")", path); + DEBUG_LOG(Log::sceIo, "sceIoDopen(\"%s\")", path); double startTime = time_now_d(); @@ -2441,7 +2441,7 @@ static u32 sceIoDopen(const char *path) { double listTime = time_now_d() - startTime; if (listTime > 0.01) { - INFO_LOG(IO, "Dir listing '%s' took %0.3f", path, listTime); + INFO_LOG(Log::IO, "Dir listing '%s' took %0.3f", path, listTime); } // Blacklist some directories that games should not be able to find out about. @@ -2507,7 +2507,7 @@ static u32 sceIoDread(int id, u32 dirent_addr) { SceIoDirEnt *entry = (SceIoDirEnt*) Memory::GetPointer(dirent_addr); if (dir->index == (int) dir->listing.size()) { - DEBUG_LOG(SCEIO, "sceIoDread( %d %08x ) - end", id, dirent_addr); + DEBUG_LOG(Log::sceIo, "sceIoDread( %d %08x ) - end", id, dirent_addr); entry->d_name[0] = '\0'; return 0; } @@ -2547,7 +2547,7 @@ static u32 sceIoDread(int id, u32 dirent_addr) { } } } - DEBUG_LOG(SCEIO, "sceIoDread( %d %08x ) = %s", id, dirent_addr, entry->d_name); + DEBUG_LOG(Log::sceIo, "sceIoDread( %d %08x ) = %s", id, dirent_addr, entry->d_name); // TODO: Improve timing. Only happens on the *first* entry read, ms and umd. if (dir->index++ == 0) { @@ -2555,13 +2555,13 @@ static u32 sceIoDread(int id, u32 dirent_addr) { } return 1; } else { - DEBUG_LOG(SCEIO, "sceIoDread - invalid listing %i, error %08x", id, error); + DEBUG_LOG(Log::sceIo, "sceIoDread - invalid listing %i, error %08x", id, error); return SCE_KERNEL_ERROR_BADF; } } static u32 sceIoDclose(int id) { - DEBUG_LOG(SCEIO, "sceIoDclose(%d)", id); + DEBUG_LOG(Log::sceIo, "sceIoDclose(%d)", id); return kernelObjects.Destroy(id); } @@ -2569,11 +2569,11 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out u32 error; FileNode *f = __IoGetFd(id, error); if (error) { - ERROR_LOG(SCEIO, "%08x=sceIoIoctl id: %08x, cmd %08x, bad file", error, id, cmd); + ERROR_LOG(Log::sceIo, "%08x=sceIoIoctl id: %08x, cmd %08x, bad file", error, id, cmd); return error; } if (f->asyncBusy()) { - ERROR_LOG(SCEIO, "%08x=sceIoIoctl id: %08x, cmd %08x, async busy", error, id, cmd); + ERROR_LOG(Log::sceIo, "%08x=sceIoIoctl id: %08x, cmd %08x, async busy", error, id, cmd); return SCE_KERNEL_ERROR_ASYNC_BUSY; } @@ -2602,7 +2602,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out key_ptr = NULL; } - DEBUG_LOG(SCEIO, "Decrypting PGD DRM files"); + DEBUG_LOG(Log::sceIo, "Decrypting PGD DRM files"); pspFileSystem.SeekFile(f->handle, (s32)f->pgd_offset, FILEMOVE_BEGIN); pspFileSystem.ReadFile(f->handle, pgd_header, 0x90); f->pgdInfo = pgd_open(pgd_header, 2, key_ptr); @@ -2610,11 +2610,11 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out f->npdrm = false; pspFileSystem.SeekFile(f->handle, (s32)0, FILEMOVE_BEGIN); if (memcmp(pgd_header, pgd_magic, 4) == 0) { - ERROR_LOG(SCEIO, "%s is PGD file, but there's likely a key mismatch. Returning error.", f->fullpath.c_str()); + ERROR_LOG(Log::sceIo, "%s is PGD file, but there's likely a key mismatch. Returning error.", f->fullpath.c_str()); // File is PGD file, but key mismatch return ERROR_PGD_INVALID_HEADER; } else { - INFO_LOG(SCEIO, "%s is not an encrypted PGD file as was expected. Proceeding.", f->fullpath.c_str()); + INFO_LOG(Log::sceIo, "%s is not an encrypted PGD file as was expected. Proceeding.", f->fullpath.c_str()); // File is not encrypted. return 0; } @@ -2644,7 +2644,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out case 0x01020003: // TODO: Should not work for umd0:/, ms0:/, etc. // TODO: Should probably move this to something common between ISOFileSystem and VirtualDiscSystem. - INFO_LOG(SCEIO, "sceIoIoctl: Asked for sector size of file %i", id); + INFO_LOG(Log::sceIo, "sceIoIoctl: Asked for sector size of file %i", id); if (Memory::IsValidAddress(outdataPtr) && outlen >= 4) { // ISOs always use 2048 sized sectors. Memory::Write_U32(2048, outdataPtr); @@ -2657,7 +2657,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out case 0x01020004: // TODO: Should not work for umd0:/, ms0:/, etc. // TODO: Should probably move this to something common between ISOFileSystem and VirtualDiscSystem. - DEBUG_LOG(SCEIO, "sceIoIoctl: Asked for file offset of file %d", id); + DEBUG_LOG(Log::sceIo, "sceIoIoctl: Asked for file offset of file %d", id); if (Memory::IsValidAddress(outdataPtr) && outlen >= 4) { u32 offset = (u32)pspFileSystem.GetSeekPos(f->handle); Memory::Write_U32(offset, outdataPtr); @@ -2669,7 +2669,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out case 0x01010005: // TODO: Should not work for umd0:/, ms0:/, etc. // TODO: Should probably move this to something common between ISOFileSystem and VirtualDiscSystem. - INFO_LOG(SCEIO, "sceIoIoctl: Seek for file %i", id); + INFO_LOG(Log::sceIo, "sceIoIoctl: Seek for file %i", id); // Even if the size is 4, it still actually reads a 16 byte struct, it seems. if (Memory::IsValidAddress(indataPtr) && inlen >= 4) { struct SeekInfo { @@ -2694,7 +2694,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out case 0x01020006: // TODO: Should not work for umd0:/, ms0:/, etc. // TODO: Should probably move this to something common between ISOFileSystem and VirtualDiscSystem. - INFO_LOG(SCEIO, "sceIoIoctl: Asked for start sector of file %i", id); + INFO_LOG(Log::sceIo, "sceIoIoctl: Asked for start sector of file %i", id); if (Memory::IsValidAddress(outdataPtr) && outlen >= 4) { Memory::Write_U32(f->FileInfo().startSector, outdataPtr); } else { @@ -2706,7 +2706,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out case 0x01020007: // TODO: Should not work for umd0:/, ms0:/, etc. // TODO: Should probably move this to something common between ISOFileSystem and VirtualDiscSystem. - INFO_LOG(SCEIO, "sceIoIoctl: Asked for size of file %i", id); + INFO_LOG(Log::sceIo, "sceIoIoctl: Asked for size of file %i", id); if (Memory::IsValidAddress(outdataPtr) && outlen >= 8) { Memory::Write_U64(f->FileInfo().size, outdataPtr); } else { @@ -2718,7 +2718,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out case 0x01030008: // TODO: Should not work for umd0:/, ms0:/, etc. // TODO: Should probably move this to something common between ISOFileSystem and VirtualDiscSystem. - INFO_LOG(SCEIO, "sceIoIoctl: Read from file %i", id); + INFO_LOG(Log::sceIo, "sceIoIoctl: Read from file %i", id); if (Memory::IsValidAddress(indataPtr) && inlen >= 4) { u32 size = Memory::Read_U32(indataPtr); if (Memory::IsValidAddress(outdataPtr) && size <= outlen) { @@ -2737,7 +2737,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out case 0x01d20001: // TODO: Should work only for umd0:/, etc. not for ms0:/ or disc0:/. // TODO: Should probably move this to something common between ISOFileSystem and VirtualDiscSystem. - INFO_LOG(SCEIO, "sceIoIoctl: Sector tell from file %i", id); + INFO_LOG(Log::sceIo, "sceIoIoctl: Sector tell from file %i", id); if (Memory::IsValidAddress(outdataPtr) && outlen >= 4) { Memory::Write_U32((u32)pspFileSystem.GetSeekPos(f->handle), outdataPtr); } else { @@ -2749,7 +2749,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out case 0x01f30003: // TODO: Should work only for umd0:/, etc. not for ms0:/ or disc0:/. // TODO: Should probably move this to something common between ISOFileSystem and VirtualDiscSystem. - INFO_LOG(SCEIO, "sceIoIoctl: Sector read from file %i", id); + INFO_LOG(Log::sceIo, "sceIoIoctl: Sector read from file %i", id); if (Memory::IsValidAddress(indataPtr) && inlen >= 4) { u32 size = Memory::Read_U32(indataPtr); // Note that size is specified in sectors, not bytes. @@ -2769,7 +2769,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out case 0x01f100a6: // TODO: Should work only for umd0:/, etc. not for ms0:/ or disc0:/. // TODO: Should probably move this to something common between ISOFileSystem and VirtualDiscSystem. - INFO_LOG(SCEIO, "sceIoIoctl: Sector seek for file %i", id); + INFO_LOG(Log::sceIo, "sceIoIoctl: Sector seek for file %i", id); // Even if the size is 4, it still actually reads a 16 byte struct, it seems. //if (GetIOTimingMethod() == IOTIMING_REALISTIC) // Need a check for io timing method? @@ -2803,7 +2803,7 @@ int __IoIoctl(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdataPtr, u32 out // We want the reported message to include the cmd, so it's unique. snprintf(temp, sizeof(temp), "sceIoIoctl(%%s, %08x, %%08x, %%x, %%08x, %%x)", cmd); Reporting::ReportMessage(temp, f->fullpath.c_str(), indataPtr, inlen, outdataPtr, outlen); - ERROR_LOG(SCEIO, "UNIMPL 0=sceIoIoctl id: %08x, cmd %08x, indataPtr %08x, inlen %08x, outdataPtr %08x, outLen %08x", id,cmd,indataPtr,inlen,outdataPtr,outlen); + ERROR_LOG(Log::sceIo, "UNIMPL 0=sceIoIoctl id: %08x, cmd %08x, indataPtr %08x, inlen %08x, outdataPtr %08x, outLen %08x", id,cmd,indataPtr,inlen,outdataPtr,outlen); } return result; } @@ -2829,7 +2829,7 @@ static u32 sceIoIoctlAsync(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdat FileNode *f = __IoGetFd(id, error); if (f) { if (f->asyncBusy()) { - return hleLogWarning(SCEIO, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); + return hleLogWarning(Log::sceIo, SCE_KERNEL_ERROR_ASYNC_BUSY, "async busy"); } auto ¶ms = asyncParams[id]; @@ -2840,14 +2840,14 @@ static u32 sceIoIoctlAsync(u32 id, u32 cmd, u32 indataPtr, u32 inlen, u32 outdat params.ioctl.outAddr = outdataPtr; params.ioctl.outSize = outlen; IoStartAsyncThread(id, f); - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } else { - return hleLogError(SCEIO, error, "bad file descriptor"); + return hleLogError(Log::sceIo, error, "bad file descriptor"); } } static u32 sceIoGetFdList(u32 outAddr, int outSize, u32 fdNumAddr) { - WARN_LOG(SCEIO, "sceIoGetFdList(%08x, %i, %08x)", outAddr, outSize, fdNumAddr); + WARN_LOG(Log::sceIo, "sceIoGetFdList(%08x, %i, %08x)", outAddr, outSize, fdNumAddr); auto out = PSPPointer::Create(outAddr); int count = 0; @@ -2882,12 +2882,12 @@ static u32 sceIoGetFdList(u32 outAddr, int outSize, u32 fdNumAddr) { // Presumably lets you hook up stderr to a MsgPipe. static u32 sceKernelRegisterStderrPipe(u32 msgPipeUID) { - ERROR_LOG_REPORT(SCEIO, "UNIMPL sceKernelRegisterStderrPipe(%08x)", msgPipeUID); + ERROR_LOG_REPORT(Log::sceIo, "UNIMPL sceKernelRegisterStderrPipe(%08x)", msgPipeUID); return 0; } static u32 sceKernelRegisterStdoutPipe(u32 msgPipeUID) { - ERROR_LOG_REPORT(SCEIO, "UNIMPL sceKernelRegisterStdoutPipe(%08x)", msgPipeUID); + ERROR_LOG_REPORT(Log::sceIo, "UNIMPL sceKernelRegisterStdoutPipe(%08x)", msgPipeUID); return 0; } @@ -2911,9 +2911,9 @@ static int IoAsyncFinish(int id) { complete = __IoRead(result, id, params.std.addr, params.std.size, us); if (complete) { f->asyncResult = (s64)result; - DEBUG_LOG(SCEIO, "ASYNC %llx=sceIoReadAsync(%d, %08x, %x)", f->asyncResult, id, params.std.addr, params.std.size); + DEBUG_LOG(Log::sceIo, "ASYNC %llx=sceIoReadAsync(%d, %08x, %x)", f->asyncResult, id, params.std.addr, params.std.size); } else { - DEBUG_LOG(SCEIO, "ASYNC sceIoReadAsync(%d, %08x, %x): deferring result", id, params.std.addr, params.std.size); + DEBUG_LOG(Log::sceIo, "ASYNC sceIoReadAsync(%d, %08x, %x): deferring result", id, params.std.addr, params.std.size); } break; @@ -2921,9 +2921,9 @@ static int IoAsyncFinish(int id) { complete = __IoWrite(result, id, params.std.addr, params.std.size, us); if (complete) { f->asyncResult = (s64)result; - DEBUG_LOG(SCEIO, "ASYNC %llx=sceIoWriteAsync(%d, %08x, %x)", f->asyncResult, id, params.std.addr, params.std.size); + DEBUG_LOG(Log::sceIo, "ASYNC %llx=sceIoWriteAsync(%d, %08x, %x)", f->asyncResult, id, params.std.addr, params.std.size); } else { - DEBUG_LOG(SCEIO, "ASYNC sceIoWriteAsync(%d, %08x, %x): deferring result", id, params.std.addr, params.std.size); + DEBUG_LOG(Log::sceIo, "ASYNC sceIoWriteAsync(%d, %08x, %x): deferring result", id, params.std.addr, params.std.size); } break; @@ -2931,7 +2931,7 @@ static int IoAsyncFinish(int id) { f->asyncResult = __IoLseek(id, params.seek.pos, params.seek.whence); // Educated guess at timing. us = 100; - DEBUG_LOG(SCEIO, "ASYNC %lli = sceIoLseekAsync(%d, %llx, %i)", f->asyncResult, id, params.seek.pos, params.seek.whence); + DEBUG_LOG(Log::sceIo, "ASYNC %lli = sceIoLseekAsync(%d, %llx, %i)", f->asyncResult, id, params.seek.pos, params.seek.whence); break; case IoAsyncOp::OPEN: @@ -2939,7 +2939,7 @@ static int IoAsyncFinish(int id) { // See notes on timing in sceIoOpen. if (!Memory::IsValidNullTerminatedString(params.open.filenameAddr)) { // Bad - ERROR_LOG(SCEIO, "Bad pointer to filename %08x", params.open.filenameAddr); + ERROR_LOG(Log::sceIo, "Bad pointer to filename %08x", params.open.filenameAddr); us = 80; break; } @@ -2964,17 +2964,17 @@ static int IoAsyncFinish(int id) { f->asyncResult = 0; // CLOSE shouldn't have a delay. See #12549. us = 0; - DEBUG_LOG(SCEIO, "ASYNC %lli = sceIoCloseAsync(%d)", f->asyncResult, id); + DEBUG_LOG(Log::sceIo, "ASYNC %lli = sceIoCloseAsync(%d)", f->asyncResult, id); break; case IoAsyncOp::IOCTL: us = 0; // __IoIoctl will add 100. f->asyncResult = __IoIoctl(id, params.ioctl.cmd, params.ioctl.inAddr, params.ioctl.inSize, params.ioctl.outAddr, params.ioctl.outSize, us); - DEBUG_LOG(SCEIO, "ASYNC sceIoIoctlAsync(%08x, %08x, %08x, %08x, %08x, %08x)", id, params.ioctl.cmd, params.ioctl.inAddr, params.ioctl.inSize, params.ioctl.outAddr, params.ioctl.outSize); + DEBUG_LOG(Log::sceIo, "ASYNC sceIoIoctlAsync(%08x, %08x, %08x, %08x, %08x, %08x)", id, params.ioctl.cmd, params.ioctl.inAddr, params.ioctl.inSize, params.ioctl.outAddr, params.ioctl.outSize); break; default: - ERROR_LOG_REPORT(SCEIO, "Unknown async op %d", (int)params.op); + ERROR_LOG_REPORT(Log::sceIo, "Unknown async op %d", (int)params.op); us = 0; break; } @@ -2986,7 +2986,7 @@ static int IoAsyncFinish(int id) { params.op = IoAsyncOp::NONE; return 0; } else { - return hleLogError(SCEIO, error, "bad file descriptor"); + return hleLogError(Log::sceIo, error, "bad file descriptor"); } } diff --git a/Core/HLE/sceJpeg.cpp b/Core/HLE/sceJpeg.cpp index 8b2e4272de..6b424501c4 100644 --- a/Core/HLE/sceJpeg.cpp +++ b/Core/HLE/sceJpeg.cpp @@ -104,7 +104,7 @@ static u32 convertYCbCrToABGR(int y, int cb, int cr) { static int JpegCsc(u32 imageAddr, u32 yCbCrAddr, int widthHeight, int bufferWidth, uint32_t chroma, int &usec) { if ((chroma & 0x000FFFFF) != 0x00020202 && (chroma & 0x000FFFFF) != 0x00020201 && (chroma & 0x000FFFFF) != 0x00020101) - return hleLogError(ME, ERROR_JPEG_INVALID_COLORSPACE, "invalid colorspace"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_COLORSPACE, "invalid colorspace"); if (bufferWidth < 0) bufferWidth = 0; @@ -120,9 +120,9 @@ static int JpegCsc(u32 imageAddr, u32 yCbCrAddr, int widthHeight, int bufferWidt uint64_t destSize = ((uint64_t)bufferWidth * (height - 1) + width) * 4; if (destSize > 0x3FFFFFFF || !Memory::IsValidRange(imageAddr, (uint32_t)destSize)) - return hleLogError(ME, ERROR_JPEG_INVALID_VALUE, "invalid dest address or size"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_VALUE, "invalid dest address or size"); if (sizeY > 0x3FFFFFFF || !Memory::IsValidRange(yCbCrAddr, sizeY + sizeCb + sizeCb)) - return hleLogError(ME, ERROR_JPEG_INVALID_VALUE, "invalid src address or size"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_VALUE, "invalid src address or size"); u32_le *imageBuffer = (u32_le *)Memory::GetPointerWriteUnchecked(imageAddr); const u8 *Y = (const u8 *)Memory::GetPointerUnchecked(yCbCrAddr); @@ -164,8 +164,8 @@ static int JpegCsc(u32 imageAddr, u32 yCbCrAddr, int widthHeight, int bufferWidt NotifyMemInfo(MemBlockFlags::WRITE, imageAddr, (uint32_t)destSize, "JpegCsc"); if ((widthHeight & 0xFFFF) == 0) - return hleLogSuccessI(ME, -1); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, -1); + return hleLogSuccessI(Log::ME, 0); } static int JpegMJpegCsc(u32 imageAddr, u32 yCbCrAddr, int widthHeight, int bufferWidth, int &usec) { @@ -180,12 +180,12 @@ static int JpegMJpegCsc(u32 imageAddr, u32 yCbCrAddr, int widthHeight, int buffe int sizeCb = sizeY >> 2; if (width > 720 || height > 480) - return hleLogError(ME, ERROR_JPEG_INVALID_SIZE, "invalid size, max 720x480"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_SIZE, "invalid size, max 720x480"); if (bufferWidth > 1024) - return hleLogError(ME, ERROR_JPEG_INVALID_SIZE, "invalid stride, max 1024"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_SIZE, "invalid stride, max 1024"); uint32_t destSize = (bufferWidth * (height - 1) + width) * 4; if (!Memory::IsValidRange(imageAddr, destSize)) - return hleLogError(ME, SCE_KERNEL_ERROR_INVALID_POINTER, "invalid dest address or size"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_INVALID_POINTER, "invalid dest address or size"); u32_le *imageBuffer = (u32_le *)Memory::GetPointerWriteUnchecked(imageAddr); const u8 *Y = (const u8 *)Memory::GetPointerUnchecked(yCbCrAddr); @@ -237,12 +237,12 @@ static int JpegMJpegCsc(u32 imageAddr, u32 yCbCrAddr, int widthHeight, int buffe NotifyMemInfo(MemBlockFlags::WRITE, imageAddr, destSize, "JpegMJpegCsc"); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static int sceJpegMJpegCsc(u32 imageAddr, u32 yCbCrAddr, int widthHeight, int bufferWidth) { if (mjpegInited == 0) - return hleLogError(ME, 0x80000001, "not yet inited"); + return hleLogError(Log::ME, 0x80000001, "not yet inited"); int usec = 0; int result = JpegMJpegCsc(imageAddr, yCbCrAddr, widthHeight, bufferWidth, usec); @@ -263,15 +263,15 @@ static u32 convertARGBtoABGR(u32 argb) { static int DecodeJpeg(u32 jpegAddr, int jpegSize, u32 imageAddr, int &usec) { if (!Memory::IsValidRange(jpegAddr, jpegSize)) - return hleLogError(ME, ERROR_JPEG_NO_SOI, "invalid jpeg address"); + return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "invalid jpeg address"); if (jpegSize == 0) - return hleLogError(ME, ERROR_JPEG_INVALID_DATA, "invalid jpeg data"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "invalid jpeg data"); NotifyMemInfo(MemBlockFlags::READ, jpegAddr, jpegSize, "JpegDecodeMJpeg"); const u8 *buf = Memory::GetPointerUnchecked(jpegAddr); if (jpegSize < 2 || buf[0] != 0xFF || buf[1] != 0xD8) - return hleLogError(ME, ERROR_JPEG_NO_SOI, "no SOI found, invalid data"); + return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "no SOI found, invalid data"); int width, height, actual_components; unsigned char *jpegBuf = jpgd::decompress_jpeg_image_from_memory(buf, jpegSize, &width, &height, &actual_components, 3); @@ -284,24 +284,24 @@ static int DecodeJpeg(u32 jpegAddr, int jpegSize, u32 imageAddr, int &usec) { } if (jpegBuf == nullptr) { - return hleLogError(ME, ERROR_JPEG_INVALID_DATA, "unable to decompress jpeg"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "unable to decompress jpeg"); } usec += (width * height) / 14; if (!Memory::IsValidRange(imageAddr, mjpegWidth * mjpegHeight * 4)) { free(jpegBuf); - return hleLogError(ME, SCE_KERNEL_ERROR_INVALID_POINTER, "invalid output address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_INVALID_POINTER, "invalid output address"); } // Note: even if you Delete, the size is still allowed. if (width > mjpegWidth || height > mjpegHeight) { free(jpegBuf); - return hleLogError(ME, ERROR_JPEG_INVALID_SIZE, "invalid output address"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_SIZE, "invalid output address"); } if (mjpegInited == 0) { // If you finish after setting the size, then call this - you get an interesting error. free(jpegBuf); - return hleLogError(ME, 0x80000001, "mjpeg not inited"); + return hleLogError(Log::ME, 0x80000001, "mjpeg not inited"); } usec += (width * height) / 110; @@ -320,14 +320,14 @@ static int DecodeJpeg(u32 jpegAddr, int jpegSize, u32 imageAddr, int &usec) { } free(jpegBuf); - return hleLogSuccessX(ME, getWidthHeight(width, height)); + return hleLogSuccessX(Log::ME, getWidthHeight(width, height)); } static int sceJpegDecodeMJpeg(u32 jpegAddr, int jpegSize, u32 imageAddr, int dhtMode) { if ((jpegAddr | jpegSize | (jpegAddr + jpegSize)) & 0x80000000) - return hleLogError(ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid jpeg address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid jpeg address"); if (imageAddr & 0x80000000) - return hleLogError(ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid output address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid output address"); int usec = 300; int result = DecodeJpeg(jpegAddr, jpegSize, imageAddr, usec); @@ -336,9 +336,9 @@ static int sceJpegDecodeMJpeg(u32 jpegAddr, int jpegSize, u32 imageAddr, int dht static int sceJpegDecodeMJpegSuccessively(u32 jpegAddr, int jpegSize, u32 imageAddr, int dhtMode) { if ((jpegAddr | jpegSize | (jpegAddr + jpegSize)) & 0x80000000) - return hleLogError(ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid jpeg address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid jpeg address"); if (imageAddr & 0x80000000) - return hleLogError(ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid output address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid output address"); int usec = 300; int result = DecodeJpeg(jpegAddr, jpegSize, imageAddr, usec); @@ -360,15 +360,15 @@ static int getYCbCrBufferSize(int w, int h) { static int JpegGetOutputInfo(u32 jpegAddr, int jpegSize, u32 colourInfoAddr) { if (!Memory::IsValidRange(jpegAddr, jpegSize)) - return hleLogError(ME, ERROR_JPEG_NO_SOI, "invalid jpeg address"); + return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "invalid jpeg address"); if (jpegSize == 0) - return hleLogError(ME, ERROR_JPEG_INVALID_DATA, "invalid jpeg data"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "invalid jpeg data"); NotifyMemInfo(MemBlockFlags::READ, jpegAddr, jpegSize, "JpegGetOutputInfo"); const u8 *buf = Memory::GetPointerUnchecked(jpegAddr); if (jpegSize < 2 || buf[0] != 0xFF || buf[1] != 0xD8) - return hleLogError(ME, ERROR_JPEG_NO_SOI, "no SOI found, invalid data"); + return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "no SOI found, invalid data"); int width, height, actual_components; unsigned char *jpegBuf = jpgd::decompress_jpeg_image_from_memory(buf, jpegSize, &width, &height, &actual_components, 3); @@ -381,7 +381,7 @@ static int JpegGetOutputInfo(u32 jpegAddr, int jpegSize, u32 colourInfoAddr) { } if (jpegBuf == nullptr) { - return hleLogError(ME, ERROR_JPEG_INVALID_DATA, "unable to decompress jpeg"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "unable to decompress jpeg"); } free(jpegBuf); @@ -411,12 +411,12 @@ static int JpegGetOutputInfo(u32 jpegAddr, int jpegSize, u32 colourInfoAddr) { fclose(wfp); #endif //JPEG_DEBUG - return hleLogSuccessX(ME, getYCbCrBufferSize(width, height)); + return hleLogSuccessX(Log::ME, getYCbCrBufferSize(width, height)); } static int sceJpegGetOutputInfo(u32 jpegAddr, int jpegSize, u32 colourInfoAddr, int dhtMode) { if ((jpegAddr | jpegSize | (jpegAddr + jpegSize)) & 0x80000000) - return hleLogError(ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid jpeg address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid jpeg address"); int result = JpegGetOutputInfo(jpegAddr, jpegSize, colourInfoAddr); // Time taken varies a bit, this is the low end. Depends on data. @@ -489,15 +489,15 @@ static int JpegConvertRGBToYCbCr(const void *data, u8 *output, int width, int he static int JpegDecodeMJpegYCbCr(u32 jpegAddr, int jpegSize, u32 yCbCrAddr, int yCbCrSize, int &usec) { if (!Memory::IsValidRange(jpegAddr, jpegSize)) - return hleLogError(ME, ERROR_JPEG_NO_SOI, "invalid jpeg address"); + return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "invalid jpeg address"); if (jpegSize == 0) - return hleLogError(ME, ERROR_JPEG_INVALID_DATA, "invalid jpeg data"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "invalid jpeg data"); NotifyMemInfo(MemBlockFlags::READ, jpegAddr, jpegSize, "JpegDecodeMJpegYCbCr"); const u8 *buf = Memory::GetPointerUnchecked(jpegAddr); if (jpegSize < 2 || buf[0] != 0xFF || buf[1] != 0xD8) - return hleLogError(ME, ERROR_JPEG_NO_SOI, "no SOI found, invalid data"); + return hleLogError(Log::ME, ERROR_JPEG_NO_SOI, "no SOI found, invalid data"); int width, height, actual_components; unsigned char *jpegBuf = jpgd::decompress_jpeg_image_from_memory(buf, jpegSize, &width, &height, &actual_components, 3); @@ -510,12 +510,12 @@ static int JpegDecodeMJpegYCbCr(u32 jpegAddr, int jpegSize, u32 yCbCrAddr, int y } if (jpegBuf == nullptr) { - return hleLogError(ME, ERROR_JPEG_INVALID_DATA, "unable to decompress jpeg"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_DATA, "unable to decompress jpeg"); } if (yCbCrSize < getYCbCrBufferSize(width, height)) { free(jpegBuf); - return hleLogError(ME, ERROR_JPEG_OUT_OF_MEMORY, "buffer not large enough"); + return hleLogError(Log::ME, ERROR_JPEG_OUT_OF_MEMORY, "buffer not large enough"); } // Technically, it seems like the PSP doesn't support grayscale, but we might as well. @@ -525,7 +525,7 @@ static int JpegDecodeMJpegYCbCr(u32 jpegAddr, int jpegSize, u32 yCbCrAddr, int y NotifyMemInfo(MemBlockFlags::WRITE, yCbCrAddr, getYCbCrBufferSize(width, height), "JpegDecodeMJpegYCbCr"); } else { // There's some weird behavior on the PSP where it writes data around the last passed address. - WARN_LOG_REPORT(ME, "JpegDecodeMJpegYCbCr: Invalid output address (%08x / %08x) for %dx%d", yCbCrAddr, yCbCrSize, width, height); + WARN_LOG_REPORT(Log::ME, "JpegDecodeMJpegYCbCr: Invalid output address (%08x / %08x) for %dx%d", yCbCrAddr, yCbCrSize, width, height); } } @@ -533,16 +533,16 @@ static int JpegDecodeMJpegYCbCr(u32 jpegAddr, int jpegSize, u32 yCbCrAddr, int y // Rough estimate based on observed timing. usec += (width * height) / 14; - return hleLogSuccessX(ME, getWidthHeight(width, height)); + return hleLogSuccessX(Log::ME, getWidthHeight(width, height)); } static int sceJpegDecodeMJpegYCbCr(u32 jpegAddr, int jpegSize, u32 yCbCrAddr, int yCbCrSize, int dhtMode) { if ((jpegAddr | jpegSize | (jpegAddr + jpegSize)) & 0x80000000) - return hleLogError(ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid jpeg address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid jpeg address"); if ((yCbCrAddr | yCbCrSize | (yCbCrAddr + yCbCrSize)) & 0x80000000) - return hleLogError(ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid output address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid output address"); if (!Memory::IsValidRange(jpegAddr, jpegSize)) - return hleLogError(ME, ERROR_JPEG_INVALID_VALUE, "invalid jpeg address"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_VALUE, "invalid jpeg address"); int usec = 300; int result = JpegDecodeMJpegYCbCr(jpegAddr, jpegSize, yCbCrAddr, yCbCrSize, usec); @@ -551,9 +551,9 @@ static int sceJpegDecodeMJpegYCbCr(u32 jpegAddr, int jpegSize, u32 yCbCrAddr, in static int sceJpegDecodeMJpegYCbCrSuccessively(u32 jpegAddr, int jpegSize, u32 yCbCrAddr, int yCbCrSize, int dhtMode) { if ((jpegAddr | jpegSize | (jpegAddr + jpegSize)) & 0x80000000) - return hleLogError(ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid jpeg address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid jpeg address"); if ((yCbCrAddr | yCbCrSize | (yCbCrAddr + yCbCrSize)) & 0x80000000) - return hleLogError(ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid output address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_PRIV_REQUIRED, "invalid output address"); // Do as same way as sceJpegDecodeMJpegYCbCr() but with smaller block size int usec = 300; @@ -562,63 +562,63 @@ static int sceJpegDecodeMJpegYCbCrSuccessively(u32 jpegAddr, int jpegSize, u32 y } static int sceJpeg_9B36444C() { - ERROR_LOG_REPORT(ME, "UNIMPL sceJpeg_9B36444C()"); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceJpeg_9B36444C()"); return 0; } static int sceJpegCreateMJpeg(int width, int height) { if (mjpegInited == 0) - return hleLogError(ME, ERROR_JPEG_INVALID_STATE, "not yet inited"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "not yet inited"); if (mjpegInited == 2) - return hleLogError(ME, ERROR_JPEG_INVALID_STATE, "already created"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "already created"); if (width > 1024) - return hleLogError(ME, ERROR_JPEG_INVALID_SIZE, "width outside bounds"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_SIZE, "width outside bounds"); mjpegInited = 2; mjpegWidth = width; mjpegHeight = height; - return hleLogSuccessInfoI(ME, 0); + return hleLogSuccessInfoI(Log::ME, 0); } static int sceJpegDeleteMJpeg() { if (mjpegInited == 0) - return hleLogError(ME, ERROR_JPEG_INVALID_STATE, "not yet inited"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "not yet inited"); if (mjpegInited == 1) - return hleLogError(ME, ERROR_JPEG_INVALID_STATE, "not yet created"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "not yet created"); mjpegInited = 1; - return hleLogSuccessInfoI(ME, 0); + return hleLogSuccessInfoI(Log::ME, 0); } static int sceJpegInitMJpeg() { if (mjpegInited == 1 || mjpegInited == 2) - return hleLogError(ME, ERROR_JPEG_ALREADY_INIT, "already inited"); + return hleLogError(Log::ME, ERROR_JPEG_ALREADY_INIT, "already inited"); // If it was -1, it's from an old save state, avoid double init error but assume inited. if (mjpegInited == 0) mjpegInited = 1; - return hleLogSuccessI(ME, hleDelayResult(0, "mjpeg init", 130)); + return hleLogSuccessI(Log::ME, hleDelayResult(0, "mjpeg init", 130)); } static int sceJpegFinishMJpeg() { if (mjpegInited == 0) - return hleLogError(ME, ERROR_JPEG_INVALID_STATE, "already inited"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "already inited"); if (mjpegInited == 2) - return hleLogError(ME, ERROR_JPEG_INVALID_STATE, "mjpeg not deleted"); + return hleLogError(Log::ME, ERROR_JPEG_INVALID_STATE, "mjpeg not deleted"); // Even from an old save state, if we see this we leave compat mode. mjpegInited = 0; - return hleLogSuccessI(ME, hleDelayResult(0, "mjpeg finish", 120)); + return hleLogSuccessI(Log::ME, hleDelayResult(0, "mjpeg finish", 120)); } static int sceJpegMJpegCscWithColorOption() { - ERROR_LOG_REPORT(ME, "UNIMPL sceJpegMJpegCscWithColorOption()"); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceJpegMJpegCscWithColorOption()"); return 0; } static int sceJpegDecompressAllImage() { - ERROR_LOG_REPORT(ME, "UNIMPL sceJpegDecompressAllImage()"); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceJpegDecompressAllImage()"); return 0; } diff --git a/Core/HLE/sceKernel.cpp b/Core/HLE/sceKernel.cpp index e0427b9ec8..fd7ab5c1a6 100644 --- a/Core/HLE/sceKernel.cpp +++ b/Core/HLE/sceKernel.cpp @@ -107,10 +107,10 @@ void __KernelInit() { if (kernelRunning) { - ERROR_LOG(SCEKERNEL, "Can't init kernel when kernel is running"); + ERROR_LOG(Log::sceKernel, "Can't init kernel when kernel is running"); return; } - INFO_LOG(SCEKERNEL, "Initializing kernel..."); + INFO_LOG(Log::sceKernel, "Initializing kernel..."); __KernelTimeInit(); __InterruptsInit(); @@ -164,18 +164,18 @@ void __KernelInit() kernelRunning = true; g_GPOBits = 0; - INFO_LOG(SCEKERNEL, "Kernel initialized."); + INFO_LOG(Log::sceKernel, "Kernel initialized."); } void __KernelShutdown() { if (!kernelRunning) { - ERROR_LOG(SCEKERNEL, "Can't shut down kernel - not running"); + ERROR_LOG(Log::sceKernel, "Can't shut down kernel - not running"); return; } kernelObjects.List(); - INFO_LOG(SCEKERNEL, "Shutting down kernel - %i kernel objects alive", kernelObjects.GetCount()); + INFO_LOG(Log::sceKernel, "Shutting down kernel - %i kernel objects alive", kernelObjects.GetCount()); hleCurrentThreadName = NULL; kernelObjects.Clear(); @@ -318,7 +318,7 @@ std::string __KernelStateSummary() { void sceKernelExitGame() { - INFO_LOG(SCEKERNEL, "sceKernelExitGame"); + INFO_LOG(Log::sceKernel, "sceKernelExitGame"); __KernelSwitchOffThread("game exited"); Core_Stop(); @@ -327,7 +327,7 @@ void sceKernelExitGame() void sceKernelExitGameWithStatus() { - INFO_LOG(SCEKERNEL, "sceKernelExitGameWithStatus"); + INFO_LOG(Log::sceKernel, "sceKernelExitGameWithStatus"); __KernelSwitchOffThread("game exited"); Core_Stop(); @@ -342,19 +342,19 @@ u32 sceKernelDevkitVersion() int revision = firmwareVersion % 10; int devkitVersion = (major << 24) | (minor << 16) | (revision << 8) | 0x10; - DEBUG_LOG(SCEKERNEL, "%08x=sceKernelDevkitVersion()", devkitVersion); + DEBUG_LOG(Log::sceKernel, "%08x=sceKernelDevkitVersion()", devkitVersion); return devkitVersion; } u32 sceKernelRegisterKprintfHandler() { - ERROR_LOG(SCEKERNEL, "UNIMPL sceKernelRegisterKprintfHandler()"); + ERROR_LOG(Log::sceKernel, "UNIMPL sceKernelRegisterKprintfHandler()"); return 0; } int sceKernelRegisterDefaultExceptionHandler() { - ERROR_LOG(SCEKERNEL, "UNIMPL sceKernelRegisterDefaultExceptionHandler()"); + ERROR_LOG(Log::sceKernel, "UNIMPL sceKernelRegisterDefaultExceptionHandler()"); return 0; } @@ -369,7 +369,7 @@ u32 sceKernelGetGPI() { // Always returns 0 on production systems. // On developer systems, there are 8 switches that control the lower 8 bits of the return value. - DEBUG_LOG(SCEKERNEL, "%d=sceKernelGetGPI()", g_GPIBits); + DEBUG_LOG(Log::sceKernel, "%d=sceKernelGetGPI()", g_GPIBits); return g_GPIBits; } @@ -382,7 +382,7 @@ u32 sceKernelGetGPI() int sceKernelDcacheInvalidateRange(u32 addr, int size) { #ifdef LOG_CACHE - NOTICE_LOG(CPU,"sceKernelDcacheInvalidateRange(%08x, %i)", addr, size); + NOTICE_LOG(Log::CPU,"sceKernelDcacheInvalidateRange(%08x, %i)", addr, size); #endif if (size < 0 || (int) addr + size < 0) return SCE_KERNEL_ERROR_ILLEGAL_ADDR; @@ -400,7 +400,7 @@ int sceKernelDcacheInvalidateRange(u32 addr, int size) } int sceKernelIcacheInvalidateRange(u32 addr, int size) { - DEBUG_LOG(CPU, "sceKernelIcacheInvalidateRange(%08x, %i)", addr, size); + DEBUG_LOG(Log::CPU, "sceKernelIcacheInvalidateRange(%08x, %i)", addr, size); if (size != 0) currentMIPS->InvalidateICache(addr, size); return 0; @@ -409,7 +409,7 @@ int sceKernelIcacheInvalidateRange(u32 addr, int size) { int sceKernelDcacheWritebackAll() { #ifdef LOG_CACHE - NOTICE_LOG(CPU,"sceKernelDcacheWritebackAll()"); + NOTICE_LOG(Log::CPU,"sceKernelDcacheWritebackAll()"); #endif // Some games seem to use this a lot, it doesn't make sense // to zap the whole texture cache. @@ -422,7 +422,7 @@ int sceKernelDcacheWritebackAll() int sceKernelDcacheWritebackRange(u32 addr, int size) { #ifdef LOG_CACHE - NOTICE_LOG(CPU,"sceKernelDcacheWritebackRange(%08x, %i)", addr, size); + NOTICE_LOG(Log::CPU,"sceKernelDcacheWritebackRange(%08x, %i)", addr, size); #endif if (size < 0) return SCE_KERNEL_ERROR_INVALID_SIZE; @@ -437,7 +437,7 @@ int sceKernelDcacheWritebackRange(u32 addr, int size) int sceKernelDcacheWritebackInvalidateRange(u32 addr, int size) { #ifdef LOG_CACHE - NOTICE_LOG(CPU,"sceKernelDcacheInvalidateRange(%08x, %i)", addr, size); + NOTICE_LOG(Log::CPU,"sceKernelDcacheInvalidateRange(%08x, %i)", addr, size); #endif if (size < 0) return SCE_KERNEL_ERROR_INVALID_SIZE; @@ -452,7 +452,7 @@ int sceKernelDcacheWritebackInvalidateRange(u32 addr, int size) int sceKernelDcacheWritebackInvalidateAll() { #ifdef LOG_CACHE - NOTICE_LOG(CPU,"sceKernelDcacheInvalidateAll()"); + NOTICE_LOG(Log::CPU,"sceKernelDcacheInvalidateAll()"); #endif gpu->InvalidateCache(0, -1, GPU_INVALIDATE_ALL); hleEatCycles(1165); @@ -463,7 +463,7 @@ int sceKernelDcacheWritebackInvalidateAll() u32 sceKernelIcacheInvalidateAll() { #ifdef LOG_CACHE - NOTICE_LOG(CPU, "Icache invalidated - should clear JIT someday"); + NOTICE_LOG(Log::CPU, "Icache invalidated - should clear JIT someday"); #endif // Note that this doesn't actually fully invalidate all with such a large range. currentMIPS->InvalidateICache(0, 0x3FFFFFFF); @@ -473,9 +473,9 @@ u32 sceKernelIcacheInvalidateAll() u32 sceKernelIcacheClearAll() { #ifdef LOG_CACHE - NOTICE_LOG(CPU, "Icache cleared - should clear JIT someday"); + NOTICE_LOG(Log::CPU, "Icache cleared - should clear JIT someday"); #endif - DEBUG_LOG(CPU, "Icache cleared - should clear JIT someday"); + DEBUG_LOG(Log::CPU, "Icache cleared - should clear JIT someday"); // Note that this doesn't actually fully invalidate all with such a large range. currentMIPS->InvalidateICache(0, 0x3FFFFFFF); return 0; @@ -506,7 +506,7 @@ SceUID KernelObjectPool::Create(KernelObject *obj, int rangeBottom, int rangeTop } } - ERROR_LOG_REPORT(SCEKERNEL, "Unable to allocate kernel object, too many objects slots in use."); + ERROR_LOG_REPORT(Log::sceKernel, "Unable to allocate kernel object, too many objects slots in use."); return 0; } @@ -535,9 +535,9 @@ void KernelObjectPool::List() { char buffer[256]; if (pool[i]) { pool[i]->GetQuickInfo(buffer, sizeof(buffer)); - DEBUG_LOG(SCEKERNEL, "KO %i: %s \"%s\": %s", i + handleOffset, pool[i]->GetTypeName(), pool[i]->GetName(), buffer); + DEBUG_LOG(Log::sceKernel, "KO %i: %s \"%s\": %s", i + handleOffset, pool[i]->GetTypeName(), pool[i]->GetName(), buffer); } else { - ERROR_LOG(SCEKERNEL, "KO %i: bad object", i + handleOffset); + ERROR_LOG(Log::sceKernel, "KO %i: bad object", i + handleOffset); } } } @@ -562,7 +562,7 @@ void KernelObjectPool::DoState(PointerWrap &p) { if (_maxCount != maxCount) { p.SetError(p.ERROR_FAILURE); - ERROR_LOG(SCEKERNEL, "Unable to load state: different kernel object storage."); + ERROR_LOG(Log::sceKernel, "Unable to load state: different kernel object storage."); return; } @@ -639,7 +639,7 @@ KernelObject *KernelObjectPool::CreateByIDType(int type) { return __KernelThreadEventHandlerObject(); default: - ERROR_LOG(SAVESTATE, "Unable to load state: could not find object type %d.", type); + ERROR_LOG(Log::SaveState, "Unable to load state: could not find object type %d.", type); return NULL; } } @@ -655,7 +655,7 @@ struct SystemStatus { }; static int sceKernelReferSystemStatus(u32 statusPtr) { - DEBUG_LOG(SCEKERNEL, "sceKernelReferSystemStatus(%08x)", statusPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelReferSystemStatus(%08x)", statusPtr); auto status = PSPPointer::Create(statusPtr); if (status.IsValid()) { memset((SystemStatus *)status, 0, sizeof(SystemStatus)); @@ -694,13 +694,13 @@ static u32 sceKernelReferThreadProfiler() { // This seems to simply has no parameter: // https://pspdev.github.io/pspsdk/group__ThreadMan.html#ga8fd30da51b9dc0507ac4dae04a7e4a17 // In testing it just returns null in around 140-150 cycles. See issue #17623. - DEBUG_LOG(SCEKERNEL, "0=sceKernelReferThreadProfiler()"); + DEBUG_LOG(Log::sceKernel, "0=sceKernelReferThreadProfiler()"); hleEatCycles(140); return 0; } static int sceKernelReferGlobalProfiler() { - DEBUG_LOG(SCEKERNEL, "0=sceKernelReferGlobalProfiler()"); + DEBUG_LOG(Log::sceKernel, "0=sceKernelReferGlobalProfiler()"); // See sceKernelReferThreadProfiler(), similar. hleEatCycles(140); return 0; diff --git a/Core/HLE/sceKernel.h b/Core/HLE/sceKernel.h index 4c03d5848b..6094781909 100644 --- a/Core/HLE/sceKernel.h +++ b/Core/HLE/sceKernel.h @@ -459,7 +459,7 @@ public: if (handle < handleOffset || handle >= handleOffset+maxCount || !occupied[handle-handleOffset]) { // Tekken 6 spams 0x80020001 gets wrong with no ill effects, also on the real PSP if (handle != 0 && (u32)handle != 0x80020001) { - WARN_LOG(SCEKERNEL, "Kernel: Bad %s handle %d (%08x)", T::GetStaticTypeName(), handle, handle); + WARN_LOG(Log::sceKernel, "Kernel: Bad %s handle %d (%08x)", T::GetStaticTypeName(), handle, handle); } outError = T::GetMissingErrorCode(); return 0; @@ -469,7 +469,7 @@ public: // see the Wrong type object error below, but we'll just have to live with that danger. T* t = static_cast(pool[handle - handleOffset]); if (t == nullptr || t->GetIDType() != T::GetStaticIDType()) { - WARN_LOG(SCEKERNEL, "Kernel: Wrong object type for %d (%08x), was %s, should have been %s", handle, handle, t ? t->GetTypeName() : "null", T::GetStaticTypeName()); + WARN_LOG(Log::sceKernel, "Kernel: Wrong object type for %d (%08x), was %s, should have been %s", handle, handle, t ? t->GetTypeName() : "null", T::GetStaticTypeName()); outError = T::GetMissingErrorCode(); return 0; } @@ -518,7 +518,7 @@ public: bool GetIDType(SceUID handle, int *type) const { if (handle < handleOffset || handle >= handleOffset+maxCount || !occupied[handle-handleOffset]) { - ERROR_LOG(SCEKERNEL, "Kernel: Bad object handle %i (%08x)", handle, handle); + ERROR_LOG(Log::sceKernel, "Kernel: Bad object handle %i (%08x)", handle, handle); return false; } KernelObject *t = pool[handle - handleOffset]; diff --git a/Core/HLE/sceKernelAlarm.cpp b/Core/HLE/sceKernelAlarm.cpp index d6b12703df..edfe19b223 100644 --- a/Core/HLE/sceKernelAlarm.cpp +++ b/Core/HLE/sceKernelAlarm.cpp @@ -73,13 +73,13 @@ public: PSPAlarm *alarm = kernelObjects.Get(alarmID, error); if (error) { - WARN_LOG(SCEKERNEL, "Ignoring deleted alarm %08x", alarmID); + WARN_LOG(Log::sceKernel, "Ignoring deleted alarm %08x", alarmID); return false; } currentMIPS->pc = alarm->alm.handlerPtr; currentMIPS->r[MIPS_REG_A0] = alarm->alm.commonPtr; - DEBUG_LOG(SCEKERNEL, "Entering alarm %08x handler: %08x", alarmID, currentMIPS->pc); + DEBUG_LOG(Log::sceKernel, "Entering alarm %08x handler: %08x", alarmID, currentMIPS->pc); return true; } @@ -94,7 +94,7 @@ public: // A non-zero result means to reschedule. if (result > 0) { - DEBUG_LOG(SCEKERNEL, "Rescheduling alarm %08x for +%dms", alarmID, result); + DEBUG_LOG(Log::sceKernel, "Rescheduling alarm %08x for +%dms", alarmID, result); u32 error; PSPAlarm *alarm = kernelObjects.Get(alarmID, error); __KernelScheduleAlarm(alarm, result); @@ -102,9 +102,9 @@ public: else { if (result < 0) - WARN_LOG(SCEKERNEL, "Alarm requested reschedule for negative value %u, ignoring", (unsigned) result); + WARN_LOG(Log::sceKernel, "Alarm requested reschedule for negative value %u, ignoring", (unsigned) result); - DEBUG_LOG(SCEKERNEL, "Finished alarm %08x", alarmID); + DEBUG_LOG(Log::sceKernel, "Finished alarm %08x", alarmID); // Delete the alarm if it's not rescheduled. kernelObjects.Destroy(alarmID); @@ -171,7 +171,7 @@ static SceUID __KernelSetAlarm(u64 micro, u32 handlerPtr, u32 commonPtr) SceUID sceKernelSetAlarm(SceUInt micro, u32 handlerPtr, u32 commonPtr) { - DEBUG_LOG(SCEKERNEL, "sceKernelSetAlarm(%d, %08x, %08x)", micro, handlerPtr, commonPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelSetAlarm(%d, %08x, %08x)", micro, handlerPtr, commonPtr); return __KernelSetAlarm((u64) micro, handlerPtr, commonPtr); } @@ -184,13 +184,13 @@ SceUID sceKernelSetSysClockAlarm(u32 microPtr, u32 handlerPtr, u32 commonPtr) else return -1; - DEBUG_LOG(SCEKERNEL, "sceKernelSetSysClockAlarm(%lld, %08x, %08x)", micro, handlerPtr, commonPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelSetSysClockAlarm(%lld, %08x, %08x)", micro, handlerPtr, commonPtr); return __KernelSetAlarm(micro, handlerPtr, commonPtr); } int sceKernelCancelAlarm(SceUID uid) { - DEBUG_LOG(SCEKERNEL, "sceKernelCancelAlarm(%08x)", uid); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelAlarm(%08x)", uid); CoreTiming::UnscheduleEvent(alarmTimer, uid); @@ -203,11 +203,11 @@ int sceKernelReferAlarmStatus(SceUID uid, u32 infoPtr) PSPAlarm *alarm = kernelObjects.Get(uid, error); if (!alarm) { - ERROR_LOG(SCEKERNEL, "sceKernelReferAlarmStatus(%08x, %08x): invalid alarm", uid, infoPtr); + ERROR_LOG(Log::sceKernel, "sceKernelReferAlarmStatus(%08x, %08x): invalid alarm", uid, infoPtr); return error; } - DEBUG_LOG(SCEKERNEL, "sceKernelReferAlarmStatus(%08x, %08x)", uid, infoPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelReferAlarmStatus(%08x, %08x)", uid, infoPtr); if (!Memory::IsValidAddress(infoPtr)) return -1; diff --git a/Core/HLE/sceKernelEventFlag.cpp b/Core/HLE/sceKernelEventFlag.cpp index b903f950d3..101b592cf4 100644 --- a/Core/HLE/sceKernelEventFlag.cpp +++ b/Core/HLE/sceKernelEventFlag.cpp @@ -195,28 +195,28 @@ static bool __KernelClearEventFlagThreads(EventFlag *e, int reason) { void __KernelEventFlagBeginCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitBeginCallback(threadID, prevCallbackId, eventFlagWaitTimer); if (result == HLEKernel::WAIT_CB_SUCCESS) - DEBUG_LOG(SCEKERNEL, "sceKernelWaitEventFlagCB: Suspending lock wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelWaitEventFlagCB: Suspending lock wait for callback"); else if (result == HLEKernel::WAIT_CB_BAD_WAIT_DATA) - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelWaitEventFlagCB: wait not found to pause for callback"); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelWaitEventFlagCB: wait not found to pause for callback"); else - WARN_LOG_REPORT(SCEKERNEL, "sceKernelWaitEventFlagCB: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelWaitEventFlagCB: beginning callback with bad wait id?"); } void __KernelEventFlagEndCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitEndCallback(threadID, prevCallbackId, eventFlagWaitTimer, __KernelUnlockEventFlagForThread); if (result == HLEKernel::WAIT_CB_RESUMED_WAIT) - DEBUG_LOG(SCEKERNEL, "sceKernelWaitEventFlagCB: Resuming lock wait from callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelWaitEventFlagCB: Resuming lock wait from callback"); } //SceUID sceKernelCreateEventFlag(const char *name, int attr, int bits, SceKernelEventFlagOptParam *opt); int sceKernelCreateEventFlag(const char *name, u32 flag_attr, u32 flag_initPattern, u32 optPtr) { if (!name) { - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ERROR, "invalid name"); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ERROR, "invalid name"); } // These attributes aren't valid. if ((flag_attr & 0x100) != 0 || flag_attr >= 0x300) { - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter: %08x", flag_attr); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter: %08x", flag_attr); } EventFlag *e = new EventFlag(); @@ -233,12 +233,12 @@ int sceKernelCreateEventFlag(const char *name, u32 flag_attr, u32 flag_initPatte if (optPtr != 0) { u32 size = Memory::Read_U32(optPtr); if (size > 4) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateEventFlag(%s) unsupported options parameter, size = %d", name, size); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateEventFlag(%s) unsupported options parameter, size = %d", name, size); } if ((flag_attr & ~PSP_EVENT_WAITMULTIPLE) != 0) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateEventFlag(%s) unsupported attr parameter: %08x", name, flag_attr); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateEventFlag(%s) unsupported attr parameter: %08x", name, flag_attr); - return hleLogSuccessI(SCEKERNEL, id); + return hleLogSuccessI(Log::sceKernel, id); } u32 sceKernelCancelEventFlag(SceUID uid, u32 pattern, u32 numWaitThreadsPtr) { @@ -255,9 +255,9 @@ u32 sceKernelCancelEventFlag(SceUID uid, u32 pattern, u32 numWaitThreadsPtr) { hleReSchedule("event flag canceled"); hleEatCycles(580); - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogDebug(SCEKERNEL, error, "invalid event flag"); + return hleLogDebug(Log::sceKernel, error, "invalid event flag"); } } @@ -268,9 +268,9 @@ u32 sceKernelClearEventFlag(SceUID id, u32 bits) { e->nef.currentPattern &= bits; // Note that it's not possible for threads to get woken up by this action. hleEatCycles(430); - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogDebug(SCEKERNEL, error, "invalid event flag"); + return hleLogDebug(Log::sceKernel, error, "invalid event flag"); } } @@ -282,9 +282,9 @@ u32 sceKernelDeleteEventFlag(SceUID uid) { if (wokeThreads) hleReSchedule("event flag deleted"); - return hleLogSuccessI(SCEKERNEL, kernelObjects.Destroy(uid)); + return hleLogSuccessI(Log::sceKernel, kernelObjects.Destroy(uid)); } else { - return hleLogDebug(SCEKERNEL, error, "invalid event flag"); + return hleLogDebug(Log::sceKernel, error, "invalid event flag"); } } @@ -309,9 +309,9 @@ u32 sceKernelSetEventFlag(SceUID id, u32 bitsToSet) { hleReSchedule("event flag set"); hleEatCycles(430); - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogDebug(SCEKERNEL, error, "invalid event flag"); + return hleLogDebug(Log::sceKernel, error, "invalid event flag"); } } @@ -361,15 +361,15 @@ static void __KernelSetEventFlagTimeout(EventFlag *e, u32 timeoutPtr) { int sceKernelWaitEventFlag(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 timeoutPtr) { if ((wait & ~PSP_EVENT_WAITKNOWN) != 0) { - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_MODE, "invalid mode parameter: %08x", wait); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_MODE, "invalid mode parameter: %08x", wait); } // Can't wait on 0, that's guaranteed to wait forever. if (bits == 0) { - return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_EVF_ILPAT, "bad pattern"); + return hleLogDebug(Log::sceKernel, SCE_KERNEL_ERROR_EVF_ILPAT, "bad pattern"); } if (!__KernelIsDispatchEnabled()) { - return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogDebug(Log::sceKernel, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); } u32 error; @@ -387,10 +387,10 @@ int sceKernelWaitEventFlag(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 ti // Do we allow more than one thread to wait? if (e->waitingThreads.size() > 0 && (e->nef.attr & PSP_EVENT_WAITMULTIPLE) == 0) { - return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_EVF_MULTI); + return hleLogDebug(Log::sceKernel, SCE_KERNEL_ERROR_EVF_MULTI); } - (void)hleLogSuccessI(SCEKERNEL, 0, "waiting"); + (void)hleLogSuccessI(Log::sceKernel, 0, "waiting"); // No match - must wait. th.threadID = __KernelGetCurThread(); @@ -403,27 +403,27 @@ int sceKernelWaitEventFlag(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 ti __KernelSetEventFlagTimeout(e, timeoutPtr); __KernelWaitCurThread(WAITTYPE_EVENTFLAG, id, 0, timeoutPtr, false, "event flag waited"); } else { - (void)hleLogSuccessI(SCEKERNEL, 0); + (void)hleLogSuccessI(Log::sceKernel, 0); } hleEatCycles(500); return 0; } else { - return hleLogDebug(SCEKERNEL, error, "invalid event flag"); + return hleLogDebug(Log::sceKernel, error, "invalid event flag"); } } int sceKernelWaitEventFlagCB(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 timeoutPtr) { if ((wait & ~PSP_EVENT_WAITKNOWN) != 0) { - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_MODE, "invalid mode parameter: %08x", wait); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_MODE, "invalid mode parameter: %08x", wait); } // Can't wait on 0, that's guaranteed to wait forever. if (bits == 0) { - return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_EVF_ILPAT, "bad pattern"); + return hleLogDebug(Log::sceKernel, SCE_KERNEL_ERROR_EVF_ILPAT, "bad pattern"); } if (!__KernelIsDispatchEnabled()) { - return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogDebug(Log::sceKernel, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); } u32 error; @@ -450,10 +450,10 @@ int sceKernelWaitEventFlagCB(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 // Do we allow more than one thread to wait? if (e->waitingThreads.size() > 0 && (e->nef.attr & PSP_EVENT_WAITMULTIPLE) == 0) { - return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_EVF_MULTI); + return hleLogDebug(Log::sceKernel, SCE_KERNEL_ERROR_EVF_MULTI); } - (void)hleLogSuccessI(SCEKERNEL, 0, "waiting"); + (void)hleLogSuccessI(Log::sceKernel, 0, "waiting"); // No match - must wait. th.threadID = __KernelGetCurThread(); @@ -469,7 +469,7 @@ int sceKernelWaitEventFlagCB(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 else __KernelWaitCurThread(WAITTYPE_EVENTFLAG, id, 0, timeoutPtr, true, "event flag waited"); } else { - (void)hleLogSuccessI(SCEKERNEL, 0); + (void)hleLogSuccessI(Log::sceKernel, 0); __KernelApplyEventFlagMatch(&e->nef.currentPattern, bits, wait, outBitsPtr); hleCheckCurrentCallbacks(); } @@ -477,21 +477,21 @@ int sceKernelWaitEventFlagCB(SceUID id, u32 bits, u32 wait, u32 outBitsPtr, u32 hleEatCycles(500); return 0; } else { - return hleLogDebug(SCEKERNEL, error, "invalid event flag"); + return hleLogDebug(Log::sceKernel, error, "invalid event flag"); } } int sceKernelPollEventFlag(SceUID id, u32 bits, u32 wait, u32 outBitsPtr) { if ((wait & ~PSP_EVENT_WAITKNOWN) != 0) { - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_MODE, "invalid mode parameter: %08x", wait); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_MODE, "invalid mode parameter: %08x", wait); } // Poll seems to also fail when CLEAR and CLEARALL are used together, but not wait. if ((wait & PSP_EVENT_WAITCLEAR) != 0 && (wait & PSP_EVENT_WAITCLEARALL) != 0) { - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_MODE, "invalid mode parameter: %08x", wait); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_MODE, "invalid mode parameter: %08x", wait); } // Can't wait on 0, it never matches. if (bits == 0) { - return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_EVF_ILPAT, "bad pattern"); + return hleLogDebug(Log::sceKernel, SCE_KERNEL_ERROR_EVF_ILPAT, "bad pattern"); } hleEatCycles(360); @@ -504,16 +504,16 @@ int sceKernelPollEventFlag(SceUID id, u32 bits, u32 wait, u32 outBitsPtr) { Memory::Write_U32(e->nef.currentPattern, outBitsPtr); if (e->waitingThreads.size() > 0 && (e->nef.attr & PSP_EVENT_WAITMULTIPLE) == 0) { - return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_EVF_MULTI); + return hleLogDebug(Log::sceKernel, SCE_KERNEL_ERROR_EVF_MULTI); } // No match - return that, this is polling, not waiting. - return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_EVF_COND); + return hleLogDebug(Log::sceKernel, SCE_KERNEL_ERROR_EVF_COND); } else { - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } } else { - return hleLogDebug(SCEKERNEL, error, "invalid event flag"); + return hleLogDebug(Log::sceKernel, error, "invalid event flag"); } } @@ -524,7 +524,7 @@ u32 sceKernelReferEventFlagStatus(SceUID id, u32 statusPtr) { if (e) { auto status = PSPPointer::Create(statusPtr); if (!status.IsValid()) - return hleLogWarning(SCEKERNEL, -1, "invalid ptr"); + return hleLogWarning(Log::sceKernel, -1, "invalid ptr"); HLEKernel::CleanupWaitingThreads(WAITTYPE_EVENTFLAG, id, e->waitingThreads); @@ -533,8 +533,8 @@ u32 sceKernelReferEventFlagStatus(SceUID id, u32 statusPtr) { *status = e->nef; status.NotifyWrite("EventFlagStatus"); } - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogDebug(SCEKERNEL, error, "invalid event flag"); + return hleLogDebug(Log::sceKernel, error, "invalid event flag"); } } diff --git a/Core/HLE/sceKernelHeap.cpp b/Core/HLE/sceKernelHeap.cpp index 1663c81eec..a781a2ec0b 100644 --- a/Core/HLE/sceKernelHeap.cpp +++ b/Core/HLE/sceKernelHeap.cpp @@ -50,13 +50,13 @@ static int sceKernelCreateHeap(int partitionId, int size, int flags, const char BlockAllocator *allocator = BlockAllocatorFromAddr(partitionId); // TODO: Validate error code. if (!allocator) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition"); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition"); // TODO: This should probably actually use flags? Name? u32 addr = allocator->Alloc(allocSize, g_fromBottom, StringFromFormat("KernelHeap/%s", Name).c_str()); if (addr == (u32)-1) { // TODO: Validate error code. - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_NO_MEMORY, "fFailed to allocate %d bytes of memory", size); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_NO_MEMORY, "fFailed to allocate %d bytes of memory", size); } KernelHeap *heap = new KernelHeap(); @@ -69,54 +69,54 @@ static int sceKernelCreateHeap(int partitionId, int size, int flags, const char heap->address = addr; heap->alloc.Init(heap->address + 128, heap->size - 128, true); heap->uid = uid; - return hleLogSuccessInfoX(SCEKERNEL, uid); + return hleLogSuccessInfoX(Log::sceKernel, uid); } static int sceKernelAllocHeapMemory(int heapId, int size) { u32 error; KernelHeap *heap = kernelObjects.Get(heapId, error); if (!heap) - return hleLogError(SCEKERNEL, error, "sceKernelAllocHeapMemory(%d): invalid heapId", heapId); + return hleLogError(Log::sceKernel, error, "sceKernelAllocHeapMemory(%d): invalid heapId", heapId); // There's 8 bytes at the end of every block, reserved. u32 memSize = KERNEL_HEAP_BLOCK_HEADER_SIZE + size; u32 addr = heap->alloc.Alloc(memSize, true); - return hleLogSuccessInfoX(SCEKERNEL, addr); + return hleLogSuccessInfoX(Log::sceKernel, addr); } static int sceKernelDeleteHeap(int heapId) { u32 error; KernelHeap *heap = kernelObjects.Get(heapId, error); if (!heap) - return hleLogError(SCEKERNEL, error, "sceKernelDeleteHeap(%d): invalid heapId", heapId); + return hleLogError(Log::sceKernel, error, "sceKernelDeleteHeap(%d): invalid heapId", heapId); // Not using heap->partitionId here for backwards compatibility with old save states. BlockAllocator *allocator = BlockAllocatorFromAddr(heap->address); if (allocator) allocator->Free(heap->address); kernelObjects.Destroy(heap->uid); - return hleLogSuccessInfoX(SCEKERNEL, 0); + return hleLogSuccessInfoX(Log::sceKernel, 0); } static u32 sceKernelPartitionTotalFreeMemSize(int partitionId) { BlockAllocator *allocator = BlockAllocatorFromID(partitionId); // TODO: Validate error code. if (!allocator) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition"); - return hleLogWarning(SCEKERNEL, allocator->GetTotalFreeBytes()); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition"); + return hleLogWarning(Log::sceKernel, allocator->GetTotalFreeBytes()); } static u32 sceKernelPartitionMaxFreeMemSize(int partitionId) { BlockAllocator *allocator = BlockAllocatorFromID(partitionId); // TODO: Validate error code. if (!allocator) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition"); - return hleLogWarning(SCEKERNEL, allocator->GetLargestFreeBlockSize()); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition"); + return hleLogWarning(Log::sceKernel, allocator->GetLargestFreeBlockSize()); } static u32 sceKernelGetUidmanCB() { - ERROR_LOG_REPORT(SCEKERNEL, "UNIMP sceKernelGetUidmanCB"); + ERROR_LOG_REPORT(Log::sceKernel, "UNIMP sceKernelGetUidmanCB"); return 0; } @@ -124,14 +124,14 @@ static int sceKernelFreeHeapMemory(int heapId, u32 block) { u32 error; KernelHeap* heap = kernelObjects.Get(heapId, error); if (!heap) - return hleLogError(SCEKERNEL, error, "sceKernelFreeHeapMemory(%d): invalid heapId", heapId); + return hleLogError(Log::sceKernel, error, "sceKernelFreeHeapMemory(%d): invalid heapId", heapId); if (block == 0) { - return hleLogSuccessInfoI(SCEKERNEL, 0, "sceKernelFreeHeapMemory(%d): heapId,0: block", heapId); + return hleLogSuccessInfoI(Log::sceKernel, 0, "sceKernelFreeHeapMemory(%d): heapId,0: block", heapId); } if (!heap->alloc.FreeExact(block)) { - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_INVALID_POINTER, "invalid pointer %08x", block); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_INVALID_POINTER, "invalid pointer %08x", block); } - return hleLogSuccessInfoI(SCEKERNEL, 0, "sceKernelFreeHeapMemory(%d): heapId, block", heapId, block); + return hleLogSuccessInfoI(Log::sceKernel, 0, "sceKernelFreeHeapMemory(%d): heapId, block", heapId, block); } @@ -139,18 +139,18 @@ static int sceKernelAllocHeapMemoryWithOption(int heapId, u32 memSize, u32 param u32 error; KernelHeap* heap = kernelObjects.Get(heapId, error); if (!heap) - return hleLogError(SCEKERNEL, error, "sceKernelFreeHeapMemory(%d): invalid heapId", heapId); + return hleLogError(Log::sceKernel, error, "sceKernelFreeHeapMemory(%d): invalid heapId", heapId); u32 grain = 4; // 0 is ignored. if (paramsPtr != 0) { u32 size = Memory::Read_U32(paramsPtr); if (size < 8) - return hleLogError(SCEKERNEL, 0, "invalid param size"); + return hleLogError(Log::sceKernel, 0, "invalid param size"); if (size > 8) - WARN_LOG(HLE, "sceKernelAllocHeapMemoryWithOption(): unexpected param size %d", size); + WARN_LOG(Log::HLE, "sceKernelAllocHeapMemoryWithOption(): unexpected param size %d", size); grain = Memory::Read_U32(paramsPtr + 4); } - INFO_LOG(HLE, "sceKernelAllocHeapMemoryWithOption(%08x, %08x, %08x)", heapId, memSize, paramsPtr); + INFO_LOG(Log::HLE, "sceKernelAllocHeapMemoryWithOption(%08x, %08x, %08x)", heapId, memSize, paramsPtr); // There's 8 bytes at the end of every block, reserved. memSize += 8; u32 addr = heap->alloc.AllocAligned(memSize, grain, grain, true); diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index a1ec85dec0..5794150250 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -79,7 +79,7 @@ static SceUID threadBeforeInterrupt; static int sceKernelCpuSuspendIntr() { - VERBOSE_LOG(SCEINTC, "sceKernelCpuSuspendIntr"); + VERBOSE_LOG(Log::sceIntc, "sceKernelCpuSuspendIntr"); int returnValue; if (__InterruptsEnabled()) { @@ -96,7 +96,7 @@ static int sceKernelCpuSuspendIntr() static void sceKernelCpuResumeIntr(u32 enable) { - VERBOSE_LOG(SCEINTC, "sceKernelCpuResumeIntr(%i)", enable); + VERBOSE_LOG(Log::sceIntc, "sceKernelCpuResumeIntr(%i)", enable); if (enable) { __EnableInterrupts(); @@ -113,14 +113,14 @@ static void sceKernelCpuResumeIntr(u32 enable) static int sceKernelIsCpuIntrEnable() { u32 retVal = __InterruptsEnabled(); - DEBUG_LOG(SCEINTC, "%i=sceKernelIsCpuIntrEnable()", retVal); + DEBUG_LOG(Log::sceIntc, "%i=sceKernelIsCpuIntrEnable()", retVal); return retVal; } static int sceKernelIsCpuIntrSuspended(int flag) { int retVal = flag == 0 ? 1 : 0; - DEBUG_LOG(SCEINTC, "%i=sceKernelIsCpuIntrSuspended(%d)", retVal, flag); + DEBUG_LOG(Log::sceIntc, "%i=sceKernelIsCpuIntrSuspended(%d)", retVal, flag); return retVal; } @@ -134,7 +134,7 @@ bool IntrHandler::run(PendingInterrupt& pend) SubIntrHandler *handler = get(pend.subintr); if (handler == NULL) { - WARN_LOG(SCEINTC, "Ignoring interrupt, already been released."); + WARN_LOG(Log::sceIntc, "Ignoring interrupt, already been released."); return false; } @@ -146,7 +146,7 @@ bool IntrHandler::run(PendingInterrupt& pend) void IntrHandler::copyArgsToCPU(PendingInterrupt& pend) { SubIntrHandler* handler = get(pend.subintr); - DEBUG_LOG(CPU, "Entering interrupt handler %08x", handler->handlerAddress); + DEBUG_LOG(Log::CPU, "Entering interrupt handler %08x", handler->handlerAddress); currentMIPS->pc = handler->handlerAddress; currentMIPS->r[MIPS_REG_A0] = handler->subIntrNumber; currentMIPS->r[MIPS_REG_A1] = handler->handlerArg; @@ -248,7 +248,7 @@ void __InterruptsDoState(PointerWrap &p) if (numInterrupts != PSP_NUMBER_INTERRUPTS) { p.SetError(p.ERROR_FAILURE); - ERROR_LOG(SCEINTC, "Savestate failure: wrong number of interrupts, can't load."); + ERROR_LOG(Log::sceIntc, "Savestate failure: wrong number of interrupts, can't load."); return; } @@ -339,7 +339,7 @@ retry: IntrHandler* handler = intrHandlers[pend.intr]; if (handler == NULL) { - WARN_LOG(SCEINTC, "Ignoring interrupt"); + WARN_LOG(Log::sceIntc, "Ignoring interrupt"); pendingInterrupts.pop_front(); goto retry; } @@ -366,7 +366,7 @@ retry: } else { if (needsThreadReturn) __KernelSwitchToThread(threadBeforeInterrupt, "left interrupt"); - // DEBUG_LOG(SCEINTC, "No more interrupts!"); + // DEBUG_LOG(Log::sceIntc, "No more interrupts!"); return false; } } @@ -398,14 +398,14 @@ void __TriggerInterrupt(int type, PSPInterrupt intno, int subintr) if (interruptsEnabled || (type & PSP_INTR_ONLY_IF_ENABLED) == 0) { intrHandlers[intno]->queueUp(subintr); - VERBOSE_LOG(SCEINTC, "Triggering subinterrupts for interrupt %i sub %i (%i in queue)", intno, subintr, (u32)pendingInterrupts.size()); + VERBOSE_LOG(Log::sceIntc, "Triggering subinterrupts for interrupt %i sub %i (%i in queue)", intno, subintr, (u32)pendingInterrupts.size()); __TriggerRunInterrupts(type); } } void __KernelReturnFromInterrupt() { - VERBOSE_LOG(SCEINTC, "Left interrupt handler at %08x", currentMIPS->pc); + VERBOSE_LOG(Log::sceIntc, "Left interrupt handler at %08x", currentMIPS->pc); hleSkipDeadbeef(); @@ -493,11 +493,11 @@ int __ReleaseSubIntrHandler(int intrNumber, int subIntrNumber) { u32 sceKernelRegisterSubIntrHandler(u32 intrNumber, u32 subIntrNumber, u32 handler, u32 handlerArg) { if (intrNumber >= PSP_NUMBER_INTERRUPTS) { - ERROR_LOG_REPORT(SCEINTC, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x): invalid interrupt", intrNumber, subIntrNumber, handler, handlerArg); + ERROR_LOG_REPORT(Log::sceIntc, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x): invalid interrupt", intrNumber, subIntrNumber, handler, handlerArg); return SCE_KERNEL_ERROR_ILLEGAL_INTRCODE; } if (subIntrNumber >= PSP_NUMBER_SUBINTERRUPTS) { - ERROR_LOG_REPORT(SCEINTC, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x): invalid subinterrupt", intrNumber, subIntrNumber, handler, handlerArg); + ERROR_LOG_REPORT(Log::sceIntc, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x): invalid subinterrupt", intrNumber, subIntrNumber, handler, handlerArg); return SCE_KERNEL_ERROR_ILLEGAL_INTRCODE; } @@ -505,46 +505,46 @@ u32 sceKernelRegisterSubIntrHandler(u32 intrNumber, u32 subIntrNumber, u32 handl SubIntrHandler *subIntrHandler = __RegisterSubIntrHandler(intrNumber, subIntrNumber, handler, handlerArg, error); if (subIntrHandler) { if (handler == 0) { - WARN_LOG_REPORT(SCEINTC, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x): ignored NULL handler", intrNumber, subIntrNumber, handler, handlerArg); + WARN_LOG_REPORT(Log::sceIntc, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x): ignored NULL handler", intrNumber, subIntrNumber, handler, handlerArg); } else { - DEBUG_LOG(SCEINTC, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x)", intrNumber, subIntrNumber, handler, handlerArg); + DEBUG_LOG(Log::sceIntc, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x)", intrNumber, subIntrNumber, handler, handlerArg); } } else if (error == SCE_KERNEL_ERROR_FOUND_HANDLER) { - ERROR_LOG_REPORT(SCEINTC, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x): duplicate handler", intrNumber, subIntrNumber, handler, handlerArg); + ERROR_LOG_REPORT(Log::sceIntc, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x): duplicate handler", intrNumber, subIntrNumber, handler, handlerArg); } else { - ERROR_LOG_REPORT(SCEINTC, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x): error %08x", intrNumber, subIntrNumber, handler, handlerArg, error); + ERROR_LOG_REPORT(Log::sceIntc, "sceKernelRegisterSubIntrHandler(%i, %i, %08x, %08x): error %08x", intrNumber, subIntrNumber, handler, handlerArg, error); } return error; } u32 sceKernelReleaseSubIntrHandler(u32 intrNumber, u32 subIntrNumber) { if (intrNumber >= PSP_NUMBER_INTERRUPTS) { - ERROR_LOG_REPORT(SCEINTC, "sceKernelReleaseSubIntrHandler(%i, %i): invalid interrupt", intrNumber, subIntrNumber); + ERROR_LOG_REPORT(Log::sceIntc, "sceKernelReleaseSubIntrHandler(%i, %i): invalid interrupt", intrNumber, subIntrNumber); return SCE_KERNEL_ERROR_ILLEGAL_INTRCODE; } if (subIntrNumber >= PSP_NUMBER_SUBINTERRUPTS) { - ERROR_LOG_REPORT(SCEINTC, "sceKernelReleaseSubIntrHandler(%i, %i): invalid subinterrupt", intrNumber, subIntrNumber); + ERROR_LOG_REPORT(Log::sceIntc, "sceKernelReleaseSubIntrHandler(%i, %i): invalid subinterrupt", intrNumber, subIntrNumber); return SCE_KERNEL_ERROR_ILLEGAL_INTRCODE; } u32 error = __ReleaseSubIntrHandler(intrNumber, subIntrNumber); if (error != SCE_KERNEL_ERROR_OK) { - ERROR_LOG(SCEINTC, "sceKernelReleaseSubIntrHandler(%i, %i): error %08x", intrNumber, subIntrNumber, error); + ERROR_LOG(Log::sceIntc, "sceKernelReleaseSubIntrHandler(%i, %i): error %08x", intrNumber, subIntrNumber, error); } return error; } u32 sceKernelEnableSubIntr(u32 intrNumber, u32 subIntrNumber) { if (intrNumber >= PSP_NUMBER_INTERRUPTS) { - ERROR_LOG_REPORT(SCEINTC, "sceKernelEnableSubIntr(%i, %i): invalid interrupt", intrNumber, subIntrNumber); + ERROR_LOG_REPORT(Log::sceIntc, "sceKernelEnableSubIntr(%i, %i): invalid interrupt", intrNumber, subIntrNumber); return SCE_KERNEL_ERROR_ILLEGAL_INTRCODE; } if (subIntrNumber >= PSP_NUMBER_SUBINTERRUPTS) { - ERROR_LOG_REPORT(SCEINTC, "sceKernelEnableSubIntr(%i, %i): invalid subinterrupt", intrNumber, subIntrNumber); + ERROR_LOG_REPORT(Log::sceIntc, "sceKernelEnableSubIntr(%i, %i): invalid subinterrupt", intrNumber, subIntrNumber); return SCE_KERNEL_ERROR_ILLEGAL_INTRCODE; } - DEBUG_LOG(SCEINTC, "sceKernelEnableSubIntr(%i, %i)", intrNumber, subIntrNumber); + DEBUG_LOG(Log::sceIntc, "sceKernelEnableSubIntr(%i, %i)", intrNumber, subIntrNumber); u32 error; if (!intrHandlers[intrNumber]->has(subIntrNumber)) { // Enableing a handler before registering it works fine. @@ -557,15 +557,15 @@ u32 sceKernelEnableSubIntr(u32 intrNumber, u32 subIntrNumber) { static u32 sceKernelDisableSubIntr(u32 intrNumber, u32 subIntrNumber) { if (intrNumber >= PSP_NUMBER_INTERRUPTS) { - ERROR_LOG_REPORT(SCEINTC, "sceKernelDisableSubIntr(%i, %i): invalid interrupt", intrNumber, subIntrNumber); + ERROR_LOG_REPORT(Log::sceIntc, "sceKernelDisableSubIntr(%i, %i): invalid interrupt", intrNumber, subIntrNumber); return SCE_KERNEL_ERROR_ILLEGAL_INTRCODE; } if (subIntrNumber >= PSP_NUMBER_SUBINTERRUPTS) { - ERROR_LOG_REPORT(SCEINTC, "sceKernelDisableSubIntr(%i, %i): invalid subinterrupt", intrNumber, subIntrNumber); + ERROR_LOG_REPORT(Log::sceIntc, "sceKernelDisableSubIntr(%i, %i): invalid subinterrupt", intrNumber, subIntrNumber); return SCE_KERNEL_ERROR_ILLEGAL_INTRCODE; } - DEBUG_LOG(SCEINTC, "sceKernelDisableSubIntr(%i, %i)", intrNumber, subIntrNumber); + DEBUG_LOG(Log::sceIntc, "sceKernelDisableSubIntr(%i, %i)", intrNumber, subIntrNumber); if (!intrHandlers[intrNumber]->has(subIntrNumber)) { // Disabling when not registered is not an error. @@ -598,14 +598,14 @@ struct PspIntrHandlerOptionParam { static int QueryIntrHandlerInfo() { - ERROR_LOG_REPORT(SCEINTC, "QueryIntrHandlerInfo()"); + ERROR_LOG_REPORT(Log::sceIntc, "QueryIntrHandlerInfo()"); return 0; } static u32 sceKernelMemset(u32 addr, u32 fillc, u32 n) { u8 c = fillc & 0xff; - DEBUG_LOG(SCEINTC, "sceKernelMemset(ptr = %08x, c = %02x, n = %08x)", addr, c, n); + DEBUG_LOG(Log::sceIntc, "sceKernelMemset(ptr = %08x, c = %02x, n = %08x)", addr, c, n); bool skip = false; if (n != 0) { if (Memory::IsVRAMAddress(addr)) { @@ -621,7 +621,7 @@ static u32 sceKernelMemset(u32 addr, u32 fillc, u32 n) static u32 sceKernelMemcpy(u32 dst, u32 src, u32 size) { - DEBUG_LOG(SCEKERNEL, "sceKernelMemcpy(dest=%08x, src=%08x, size=%i)", dst, src, size); + DEBUG_LOG(Log::sceKernel, "sceKernelMemcpy(dest=%08x, src=%08x, size=%i)", dst, src, size); // Some games copy from executable code. We need to flush emuhack ops. if (size != 0) @@ -696,7 +696,7 @@ static u32 sysclib_memcpy(u32 dst, u32 src, u32 size) { } static u32 sysclib_strcat(u32 dst, u32 src) { - ERROR_LOG(SCEKERNEL, "Untested sysclib_strcat(dest=%08x, src=%08x)", dst, src); + ERROR_LOG(Log::sceKernel, "Untested sysclib_strcat(dest=%08x, src=%08x)", dst, src); if (Memory::IsValidNullTerminatedString(dst) && Memory::IsValidNullTerminatedString(src)) { strcat((char *)Memory::GetPointerWriteUnchecked(dst), (const char *)Memory::GetPointerUnchecked(src)); } @@ -704,7 +704,7 @@ static u32 sysclib_strcat(u32 dst, u32 src) { } static int sysclib_strcmp(u32 dst, u32 src) { - ERROR_LOG(SCEKERNEL, "Untested sysclib_strcmp(dest=%08x, src=%08x)", dst, src); + ERROR_LOG(Log::sceKernel, "Untested sysclib_strcmp(dest=%08x, src=%08x)", dst, src); if (Memory::IsValidNullTerminatedString(dst) && Memory::IsValidNullTerminatedString(src)) { return strcmp((const char *)Memory::GetPointerUnchecked(dst), (const char *)Memory::GetPointerUnchecked(src)); } else { @@ -714,7 +714,7 @@ static int sysclib_strcmp(u32 dst, u32 src) { } static u32 sysclib_strcpy(u32 dst, u32 src) { - ERROR_LOG(SCEKERNEL, "Untested sysclib_strcpy(dest=%08x, src=%08x)", dst, src); + ERROR_LOG(Log::sceKernel, "Untested sysclib_strcpy(dest=%08x, src=%08x)", dst, src); if (Memory::IsValidAddress(dst) && Memory::IsValidNullTerminatedString(src)) { strcpy((char *)Memory::GetPointerWriteUnchecked(dst), (const char *)Memory::GetPointerUnchecked(src)); } @@ -722,7 +722,7 @@ static u32 sysclib_strcpy(u32 dst, u32 src) { } static u32 sysclib_strlen(u32 src) { - ERROR_LOG(SCEKERNEL, "Untested sysclib_strlen(src=%08x)", src); + ERROR_LOG(Log::sceKernel, "Untested sysclib_strlen(src=%08x)", src); if (Memory::IsValidNullTerminatedString(src)) { // TODO: This computes the length, could reuse it maybe. return (u32)strlen(Memory::GetCharPointerUnchecked(src)); } else { @@ -732,7 +732,7 @@ static u32 sysclib_strlen(u32 src) { } static int sysclib_memcmp(u32 dst, u32 src, u32 size) { - ERROR_LOG(SCEKERNEL, "Untested sysclib_memcmp(dest=%08x, src=%08x, size=%i)", dst, src, size); + ERROR_LOG(Log::sceKernel, "Untested sysclib_memcmp(dest=%08x, src=%08x, size=%i)", dst, src, size); if (Memory::IsValidRange(dst, size) && Memory::IsValidRange(src, size)) { return memcmp(Memory::GetCharPointerUnchecked(dst), Memory::GetCharPointerUnchecked(src), size); } else { @@ -742,15 +742,15 @@ static int sysclib_memcmp(u32 dst, u32 src, u32 size) { } static int sysclib_sprintf(u32 dst, u32 fmt) { - ERROR_LOG(SCEKERNEL, "Untested sysclib_sprintf(dst=%08x, fmt=%08x)", dst, fmt); + ERROR_LOG(Log::sceKernel, "Untested sysclib_sprintf(dst=%08x, fmt=%08x)", dst, fmt); if (!Memory::IsValidNullTerminatedString(fmt)) { - ERROR_LOG(SCEKERNEL, "sysclib_sprintf bad fmt"); + ERROR_LOG(Log::sceKernel, "sysclib_sprintf bad fmt"); return 0; } - DEBUG_LOG(SCEKERNEL, "sysclib_sprintf fmt: %s", Memory::GetCharPointerUnchecked(fmt)); - DEBUG_LOG(SCEKERNEL, "sysclib_sprintf a0-a4, t0-t4: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x", + DEBUG_LOG(Log::sceKernel, "sysclib_sprintf fmt: %s", Memory::GetCharPointerUnchecked(fmt)); + DEBUG_LOG(Log::sceKernel, "sysclib_sprintf a0-a4, t0-t4: 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x 0x%08x", currentMIPS->r[MIPS_REG_A0], currentMIPS->r[MIPS_REG_A1], currentMIPS->r[MIPS_REG_A2], @@ -800,16 +800,16 @@ static int sysclib_sprintf(u32 dst, u32 fmt) { u32 stack_cur = currentMIPS->r[MIPS_REG_SP] + stack_idx * 4; if (!Memory::IsValidAddress(stack_cur)) { - ERROR_LOG(SCEKERNEL, "sysclib_sprintf bad stack pointer %08x", stack_cur); + ERROR_LOG(Log::sceKernel, "sysclib_sprintf bad stack pointer %08x", stack_cur); return 0; } val = Memory::Read_U32(stack_cur); - DEBUG_LOG(SCEKERNEL, "sysclib_sprintf fetching %08x from sp + %u", val, stack_idx * 4); + DEBUG_LOG(Log::sceKernel, "sysclib_sprintf fetching %08x from sp + %u", val, stack_idx * 4); } arg_idx++; if (!Memory::IsValidNullTerminatedString(val)) { - ERROR_LOG(SCEKERNEL, "sysclib_sprintf bad string reference at %08x", val); + ERROR_LOG(Log::sceKernel, "sysclib_sprintf bad string reference at %08x", val); return 0; } result.append(Memory::GetCharPointerUnchecked(val)); @@ -847,11 +847,11 @@ static int sysclib_sprintf(u32 dst, u32 fmt) { u32 stack_cur = currentMIPS->r[MIPS_REG_SP] + stack_idx * 4; if (!Memory::IsValidAddress(stack_cur)) { - ERROR_LOG(SCEKERNEL, "sysclib_sprintf bad stack pointer %08x", stack_cur); + ERROR_LOG(Log::sceKernel, "sysclib_sprintf bad stack pointer %08x", stack_cur); return 0; } val_from_arg = Memory::Read_U32(stack_cur); - DEBUG_LOG(SCEKERNEL, "sysclib_sprintf fetching %08x from sp + %u", val_from_arg, stack_idx * 4); + DEBUG_LOG(Log::sceKernel, "sysclib_sprintf fetching %08x from sp + %u", val_from_arg, stack_idx * 4); } arg_idx++; @@ -882,10 +882,10 @@ static int sysclib_sprintf(u32 dst, u32 fmt) { } } - DEBUG_LOG(SCEKERNEL, "sysclib_sprintf result string has length %d, content:", (int)result.length()); - DEBUG_LOG(SCEKERNEL, "%s", result.c_str()); + DEBUG_LOG(Log::sceKernel, "sysclib_sprintf result string has length %d, content:", (int)result.length()); + DEBUG_LOG(Log::sceKernel, "%s", result.c_str()); if (!Memory::IsValidRange(dst, (u32)result.length() + 1)) { - ERROR_LOG(SCEKERNEL, "sysclib_sprintf result string is too long or dst is invalid"); + ERROR_LOG(Log::sceKernel, "sysclib_sprintf result string is too long or dst is invalid"); return 0; } memcpy((char *)Memory::GetPointerUnchecked(dst), result.c_str(), (int)result.length() + 1); @@ -893,7 +893,7 @@ static int sysclib_sprintf(u32 dst, u32 fmt) { } static u32 sysclib_memset(u32 destAddr, int data, int size) { - DEBUG_LOG(SCEKERNEL, "Untested sysclib_memset(dest=%08x, data=%d ,size=%d)", destAddr, data, size); + DEBUG_LOG(Log::sceKernel, "Untested sysclib_memset(dest=%08x, data=%d ,size=%d)", destAddr, data, size); if (Memory::IsValidRange(destAddr, size)) { memset(Memory::GetPointerWriteUnchecked(destAddr), data, size); } @@ -902,7 +902,7 @@ static u32 sysclib_memset(u32 destAddr, int data, int size) { } static int sysclib_strstr(u32 s1, u32 s2) { - DEBUG_LOG(SCEKERNEL, "Untested sysclib_strstr(%08x, %08x)", s1, s2); + DEBUG_LOG(Log::sceKernel, "Untested sysclib_strstr(%08x, %08x)", s1, s2); if (Memory::IsValidNullTerminatedString(s1) && Memory::IsValidNullTerminatedString(s2)) { std::string str1 = Memory::GetCharPointerUnchecked(s1); std::string str2 = Memory::GetCharPointerUnchecked(s2); @@ -916,7 +916,7 @@ static int sysclib_strstr(u32 s1, u32 s2) { } static int sysclib_strncmp(u32 s1, u32 s2, u32 size) { - DEBUG_LOG(SCEKERNEL, "Untested sysclib_strncmp(%08x, %08x, %08x)", s1, s2, size); + DEBUG_LOG(Log::sceKernel, "Untested sysclib_strncmp(%08x, %08x, %08x)", s1, s2, size); if (Memory::IsValidRange(s1, size) && Memory::IsValidRange(s2, size)) { const char * str1 = Memory::GetCharPointerUnchecked(s1); const char * str2 = Memory::GetCharPointerUnchecked(s2); @@ -926,7 +926,7 @@ static int sysclib_strncmp(u32 s1, u32 s2, u32 size) { } static u32 sysclib_memmove(u32 dst, u32 src, u32 size) { - DEBUG_LOG(SCEKERNEL, "Untested sysclib_memmove(%08x, %08x, %08x)", dst, src, size); + DEBUG_LOG(Log::sceKernel, "Untested sysclib_memmove(%08x, %08x, %08x)", dst, src, size); if (Memory::IsValidRange(dst, size) && Memory::IsValidRange(src, size)) { memmove(Memory::GetPointerWriteUnchecked(dst), Memory::GetPointerUnchecked(src), size); } @@ -938,7 +938,7 @@ static u32 sysclib_memmove(u32 dst, u32 src, u32 size) { static u32 sysclib_strncpy(u32 dest, u32 src, u32 size) { if (!Memory::IsValidAddress(dest) || !Memory::IsValidAddress(src)) { - return hleLogError(SCEKERNEL, 0, "invalid address"); + return hleLogError(Log::sceKernel, 0, "invalid address"); } // This is just regular strncpy, but being explicit to avoid warnings/safety fixes on missing null. @@ -958,12 +958,12 @@ static u32 sysclib_strncpy(u32 dest, u32 src, u32 size) { *destp++ = 0; } - return hleLogSuccessX(SCEKERNEL, dest); + return hleLogSuccessX(Log::sceKernel, dest); } static u32 sysclib_strtol(u32 strPtr, u32 endPtrPtr, int base) { if (!Memory::IsValidNullTerminatedString(strPtr)) { - return hleLogError(SCEKERNEL, 0, "invalid address"); + return hleLogError(Log::sceKernel, 0, "invalid address"); } const char* str = Memory::GetCharPointer(strPtr); char* end = nullptr; @@ -975,7 +975,7 @@ static u32 sysclib_strtol(u32 strPtr, u32 endPtrPtr, int base) { static u32 sysclib_strchr(u32 src, int c) { if (!Memory::IsValidNullTerminatedString(src)) { - return hleLogError(SCEKERNEL, 0, "invalid address"); + return hleLogError(Log::sceKernel, 0, "invalid address"); } const std::string str = Memory::GetCharPointer(src); size_t cpos = str.find(str, c); @@ -987,7 +987,7 @@ static u32 sysclib_strchr(u32 src, int c) { static u32 sysclib_strrchr(u32 src, int c) { if (!Memory::IsValidNullTerminatedString(src)) { - return hleLogError(SCEKERNEL, 0, "invalid address"); + return hleLogError(Log::sceKernel, 0, "invalid address"); } const std::string str = Memory::GetCharPointer(src); size_t cpos = str.rfind(str, c); diff --git a/Core/HLE/sceKernelMbx.cpp b/Core/HLE/sceKernelMbx.cpp index 0a5f132f01..543b57d97b 100644 --- a/Core/HLE/sceKernelMbx.cpp +++ b/Core/HLE/sceKernelMbx.cpp @@ -237,18 +237,18 @@ void __KernelMbxBeginCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitBeginCallback(threadID, prevCallbackId, mbxWaitTimer); if (result == HLEKernel::WAIT_CB_SUCCESS) - DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMbxCB: Suspending mbx wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMbxCB: Suspending mbx wait for callback"); else if (result == HLEKernel::WAIT_CB_BAD_WAIT_DATA) - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelReceiveMbxCB: wait not found to pause for callback"); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelReceiveMbxCB: wait not found to pause for callback"); else - WARN_LOG_REPORT(SCEKERNEL, "sceKernelReceiveMbxCB: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelReceiveMbxCB: beginning callback with bad wait id?"); } void __KernelMbxEndCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitEndCallback(threadID, prevCallbackId, mbxWaitTimer, __KernelUnlockMbxForThreadCheck); if (result == HLEKernel::WAIT_CB_RESUMED_WAIT) - DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMbxCB: Resuming mbx wait from callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMbxCB: Resuming mbx wait from callback"); } void __KernelMbxTimeout(u64 userdata, int cyclesLate) @@ -298,13 +298,13 @@ SceUID sceKernelCreateMbx(const char *name, u32 attr, u32 optAddr) { if (!name) { - WARN_LOG_REPORT(SCEKERNEL, "%08x=sceKernelCreateMbx(): invalid name", SCE_KERNEL_ERROR_ERROR); + WARN_LOG_REPORT(Log::sceKernel, "%08x=sceKernelCreateMbx(): invalid name", SCE_KERNEL_ERROR_ERROR); return SCE_KERNEL_ERROR_ERROR; } // Accepts 0x000 - 0x0FF, 0x100 - 0x1FF, and 0x400 - 0x4FF. if (((attr & ~SCE_KERNEL_MBA_ATTR_KNOWN) & ~0xFF) != 0) { - WARN_LOG_REPORT(SCEKERNEL, "%08x=sceKernelCreateMbx(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); + WARN_LOG_REPORT(Log::sceKernel, "%08x=sceKernelCreateMbx(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); return SCE_KERNEL_ERROR_ILLEGAL_ATTR; } @@ -319,16 +319,16 @@ SceUID sceKernelCreateMbx(const char *name, u32 attr, u32 optAddr) m->nmb.numMessages = 0; m->nmb.packetListHead = 0; - DEBUG_LOG(SCEKERNEL, "%i=sceKernelCreateMbx(%s, %08x, %08x)", id, name, attr, optAddr); + DEBUG_LOG(Log::sceKernel, "%i=sceKernelCreateMbx(%s, %08x, %08x)", id, name, attr, optAddr); if (optAddr != 0) { u32 size = Memory::Read_U32(optAddr); if (size > 4) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateMbx(%s) unsupported options parameter, size = %d", name, size); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateMbx(%s) unsupported options parameter, size = %d", name, size); } if ((attr & ~SCE_KERNEL_MBA_ATTR_KNOWN) != 0) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateMbx(%s) unsupported attr parameter: %08x", name, attr); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateMbx(%s) unsupported attr parameter: %08x", name, attr); return id; } @@ -339,7 +339,7 @@ int sceKernelDeleteMbx(SceUID id) Mbx *m = kernelObjects.Get(id, error); if (m) { - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteMbx(%i)", id); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteMbx(%i)", id); bool wokeThreads = false; for (size_t i = 0; i < m->waitingThreads.size(); i++) @@ -351,7 +351,7 @@ int sceKernelDeleteMbx(SceUID id) } else { - ERROR_LOG(SCEKERNEL, "sceKernelDeleteMbx(%i): invalid mbx id", id); + ERROR_LOG(Log::sceKernel, "sceKernelDeleteMbx(%i): invalid mbx id", id); } return kernelObjects.Destroy(id); } @@ -362,14 +362,14 @@ int sceKernelSendMbx(SceUID id, u32 packetAddr) Mbx *m = kernelObjects.Get(id, error); if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelSendMbx(%i, %08x): invalid mbx id", id, packetAddr); + ERROR_LOG(Log::sceKernel, "sceKernelSendMbx(%i, %08x): invalid mbx id", id, packetAddr); return error; } NativeMbxPacket *addPacket = (NativeMbxPacket*)Memory::GetPointer(packetAddr); if (addPacket == 0) { - ERROR_LOG(SCEKERNEL, "sceKernelSendMbx(%i, %08x): invalid packet address", id, packetAddr); + ERROR_LOG(Log::sceKernel, "sceKernelSendMbx(%i, %08x): invalid packet address", id, packetAddr); return -1; } @@ -392,7 +392,7 @@ int sceKernelSendMbx(SceUID id, u32 packetAddr) if (wokeThreads) { - DEBUG_LOG(SCEKERNEL, "sceKernelSendMbx(%i, %08x): threads waiting, resuming %d", id, packetAddr, t.threadID); + DEBUG_LOG(Log::sceKernel, "sceKernelSendMbx(%i, %08x): threads waiting, resuming %d", id, packetAddr, t.threadID); Memory::Write_U32(packetAddr, t.packetAddr); hleReSchedule("mbx sent"); @@ -402,7 +402,7 @@ int sceKernelSendMbx(SceUID id, u32 packetAddr) } } - DEBUG_LOG(SCEKERNEL, "sceKernelSendMbx(%i, %08x): no threads currently waiting, adding message to queue", id, packetAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelSendMbx(%i, %08x): no threads currently waiting, adding message to queue", id, packetAddr); if (m->nmb.numMessages == 0) m->AddInitialMessage(packetAddr); @@ -454,18 +454,18 @@ int sceKernelReceiveMbx(SceUID id, u32 packetAddrPtr, u32 timeoutPtr) if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelReceiveMbx(%i, %08x, %08x): invalid mbx id", id, packetAddrPtr, timeoutPtr); + ERROR_LOG(Log::sceKernel, "sceKernelReceiveMbx(%i, %08x, %08x): invalid mbx id", id, packetAddrPtr, timeoutPtr); return error; } if (m->nmb.numMessages > 0) { - DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMbx(%i, %08x, %08x): sending first queue message", id, packetAddrPtr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMbx(%i, %08x, %08x): sending first queue message", id, packetAddrPtr, timeoutPtr); return m->ReceiveMessage(packetAddrPtr); } else { - DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMbx(%i, %08x, %08x): no message in queue, waiting", id, packetAddrPtr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMbx(%i, %08x, %08x): no message in queue, waiting", id, packetAddrPtr, timeoutPtr); HLEKernel::RemoveWaitingThread(m->waitingThreads, __KernelGetCurThread()); m->AddWaitingThread(__KernelGetCurThread(), packetAddrPtr); __KernelWaitMbx(m, timeoutPtr); @@ -481,19 +481,19 @@ int sceKernelReceiveMbxCB(SceUID id, u32 packetAddrPtr, u32 timeoutPtr) if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelReceiveMbxCB(%i, %08x, %08x): invalid mbx id", id, packetAddrPtr, timeoutPtr); + ERROR_LOG(Log::sceKernel, "sceKernelReceiveMbxCB(%i, %08x, %08x): invalid mbx id", id, packetAddrPtr, timeoutPtr); return error; } if (m->nmb.numMessages > 0) { - DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMbxCB(%i, %08x, %08x): sending first queue message", id, packetAddrPtr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMbxCB(%i, %08x, %08x): sending first queue message", id, packetAddrPtr, timeoutPtr); hleCheckCurrentCallbacks(); return m->ReceiveMessage(packetAddrPtr); } else { - DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMbxCB(%i, %08x, %08x): no message in queue, waiting", id, packetAddrPtr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMbxCB(%i, %08x, %08x): no message in queue, waiting", id, packetAddrPtr, timeoutPtr); HLEKernel::RemoveWaitingThread(m->waitingThreads, __KernelGetCurThread()); m->AddWaitingThread(__KernelGetCurThread(), packetAddrPtr); __KernelWaitMbx(m, timeoutPtr); @@ -509,18 +509,18 @@ int sceKernelPollMbx(SceUID id, u32 packetAddrPtr) if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelPollMbx(%i, %08x): invalid mbx id", id, packetAddrPtr); + ERROR_LOG(Log::sceKernel, "sceKernelPollMbx(%i, %08x): invalid mbx id", id, packetAddrPtr); return error; } if (m->nmb.numMessages > 0) { - DEBUG_LOG(SCEKERNEL, "sceKernelPollMbx(%i, %08x): sending first queue message", id, packetAddrPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelPollMbx(%i, %08x): sending first queue message", id, packetAddrPtr); return m->ReceiveMessage(packetAddrPtr); } else { - DEBUG_LOG(SCEKERNEL, "SCE_KERNEL_ERROR_MBOX_NOMSG=sceKernelPollMbx(%i, %08x): no message in queue", id, packetAddrPtr); + DEBUG_LOG(Log::sceKernel, "SCE_KERNEL_ERROR_MBOX_NOMSG=sceKernelPollMbx(%i, %08x): no message in queue", id, packetAddrPtr); return SCE_KERNEL_ERROR_MBOX_NOMSG; } } @@ -532,12 +532,12 @@ int sceKernelCancelReceiveMbx(SceUID id, u32 numWaitingThreadsAddr) if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelCancelReceiveMbx(%i, %08x): invalid mbx id", id, numWaitingThreadsAddr); + ERROR_LOG(Log::sceKernel, "sceKernelCancelReceiveMbx(%i, %08x): invalid mbx id", id, numWaitingThreadsAddr); return error; } u32 count = (u32) m->waitingThreads.size(); - DEBUG_LOG(SCEKERNEL, "sceKernelCancelReceiveMbx(%i, %08x): cancelling %d threads", id, numWaitingThreadsAddr, count); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelReceiveMbx(%i, %08x): cancelling %d threads", id, numWaitingThreadsAddr, count); bool wokeThreads = false; for (size_t i = 0; i < m->waitingThreads.size(); i++) @@ -556,13 +556,13 @@ int sceKernelReferMbxStatus(SceUID id, u32 infoAddr) { u32 error; Mbx *m = kernelObjects.Get(id, error); if (!m) { - return hleLogError(SCEKERNEL, error, "invalid mbx id"); + return hleLogError(Log::sceKernel, error, "invalid mbx id"); } // Should we crash the thread somehow? auto info = PSPPointer::Create(infoAddr); if (!info.IsValid()) - return hleLogError(SCEKERNEL, -1, "invalid pointer"); + return hleLogError(Log::sceKernel, -1, "invalid pointer"); for (int i = 0, n = m->nmb.numMessages; i < n; ++i) m->nmb.packetListHead = Memory::Read_U32(m->nmb.packetListHead); diff --git a/Core/HLE/sceKernelMemory.cpp b/Core/HLE/sceKernelMemory.cpp index 72b1a3faa9..98992800f4 100644 --- a/Core/HLE/sceKernelMemory.cpp +++ b/Core/HLE/sceKernelMemory.cpp @@ -346,15 +346,15 @@ struct SceKernelVplHeader { while (b.ptr < lastBlock.ptr) { bool isFree = b->next.ptr != SentinelPtr(); if (nextFreeBlock_ == b && isFree) { - NOTICE_LOG(SCEKERNEL, "NEXT: %x -> %x (size %x)", b.ptr - startPtr_, b->next.ptr - startPtr_, b->sizeInBlocks * 8); + NOTICE_LOG(Log::sceKernel, "NEXT: %x -> %x (size %x)", b.ptr - startPtr_, b->next.ptr - startPtr_, b->sizeInBlocks * 8); } else if (isFree) { - NOTICE_LOG(SCEKERNEL, "FREE: %x -> %x (size %x)", b.ptr - startPtr_, b->next.ptr - startPtr_, b->sizeInBlocks * 8); + NOTICE_LOG(Log::sceKernel, "FREE: %x -> %x (size %x)", b.ptr - startPtr_, b->next.ptr - startPtr_, b->sizeInBlocks * 8); } else { - NOTICE_LOG(SCEKERNEL, "BLOCK: %x (size %x)", b.ptr - startPtr_, b->sizeInBlocks * 8); + NOTICE_LOG(Log::sceKernel, "BLOCK: %x (size %x)", b.ptr - startPtr_, b->sizeInBlocks * 8); } b += b->sizeInBlocks; } - NOTICE_LOG(SCEKERNEL, "LAST: %x -> %x (size %x)", lastBlock.ptr - startPtr_, lastBlock->next.ptr - startPtr_, lastBlock->sizeInBlocks * 8); + NOTICE_LOG(Log::sceKernel, "LAST: %x -> %x (size %x)", lastBlock.ptr - startPtr_, lastBlock->next.ptr - startPtr_, lastBlock->sizeInBlocks * 8); } PSPPointer MergeBlocks(PSPPointer first, PSPPointer second) { @@ -437,7 +437,7 @@ void __KernelMemoryInit() volatileMemory.Init(PSP_GetVolatileMemoryStart(), PSP_GetVolatileMemoryEnd() - PSP_GetVolatileMemoryStart(), false); ParallelMemset(&g_threadManager, Memory::GetPointerWrite(PSP_GetKernelMemoryBase()), 0, PSP_GetUserMemoryEnd() - PSP_GetKernelMemoryBase(), TaskPriority::HIGH); NotifyMemInfo(MemBlockFlags::WRITE, PSP_GetKernelMemoryBase(), PSP_GetUserMemoryEnd() - PSP_GetKernelMemoryBase(), "MemInit"); - INFO_LOG(SCEKERNEL, "Kernel and user memory pools initialized"); + INFO_LOG(Log::sceKernel, "Kernel and user memory pools initialized"); vplWaitTimer = CoreTiming::RegisterEvent("VplTimeout", __KernelVplTimeout); fplWaitTimer = CoreTiming::RegisterEvent("FplTimeout", __KernelFplTimeout); @@ -487,17 +487,17 @@ void __KernelMemoryDoState(PointerWrap &p) void __KernelMemoryShutdown() { #ifdef _DEBUG - INFO_LOG(SCEKERNEL, "Shutting down volatile memory pool: "); + INFO_LOG(Log::sceKernel, "Shutting down volatile memory pool: "); volatileMemory.ListBlocks(); #endif volatileMemory.Shutdown(); #ifdef _DEBUG - INFO_LOG(SCEKERNEL,"Shutting down user memory pool: "); + INFO_LOG(Log::sceKernel,"Shutting down user memory pool: "); userMemory.ListBlocks(); #endif userMemory.Shutdown(); #ifdef _DEBUG - INFO_LOG(SCEKERNEL,"Shutting down \"kernel\" memory pool: "); + INFO_LOG(Log::sceKernel,"Shutting down \"kernel\" memory pool: "); kernelMemory.ListBlocks(); #endif kernelMemory.Shutdown(); @@ -600,18 +600,18 @@ void __KernelFplBeginCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitBeginCallback(threadID, prevCallbackId, fplWaitTimer); if (result == HLEKernel::WAIT_CB_SUCCESS) - DEBUG_LOG(SCEKERNEL, "sceKernelAllocateFplCB: Suspending fpl wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelAllocateFplCB: Suspending fpl wait for callback"); else if (result == HLEKernel::WAIT_CB_BAD_WAIT_DATA) - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelAllocateFplCB: wait not found to pause for callback"); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelAllocateFplCB: wait not found to pause for callback"); else - WARN_LOG_REPORT(SCEKERNEL, "sceKernelAllocateFplCB: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelAllocateFplCB: beginning callback with bad wait id?"); } void __KernelFplEndCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitEndCallback(threadID, prevCallbackId, fplWaitTimer, __KernelUnlockFplForThread); if (result == HLEKernel::WAIT_CB_RESUMED_WAIT) - DEBUG_LOG(SCEKERNEL, "sceKernelAllocateFplCB: Resuming mbx wait from callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelAllocateFplCB: Resuming mbx wait from callback"); } static bool __FplThreadSortPriority(FplWaitingThread thread1, FplWaitingThread thread2) @@ -642,15 +642,15 @@ static void __KernelSortFplThreads(FPL *fpl) int sceKernelCreateFpl(const char *name, u32 mpid, u32 attr, u32 blockSize, u32 numBlocks, u32 optPtr) { if (!name) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_NO_MEMORY, "invalid name"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_NO_MEMORY, "invalid name"); if (mpid < 1 || mpid > 9 || mpid == 7) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition %d", mpid); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition %d", mpid); BlockAllocator *allocator = BlockAllocatorFromID(mpid); if (allocator == nullptr) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_PERM, "invalid partition %d", mpid); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_PERM, "invalid partition %d", mpid); if (((attr & ~PSP_FPL_ATTR_KNOWN) & ~0xFF) != 0) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter: %08x", attr); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter: %08x", attr); // There's probably a simpler way to get this same basic formula... // This is based on results from a PSP. @@ -660,7 +660,7 @@ int sceKernelCreateFpl(const char *name, u32 mpid, u32 attr, u32 blockSize, u32 if (!illegalMemSize && (u64) numBlocks >= 0x100000000ULL / (((u64) blockSize + 3ULL) & ~3ULL)) illegalMemSize = true; if (illegalMemSize) - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE, "invalid blockSize/count"); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE, "invalid blockSize/count"); int alignment = 4; if (Memory::IsValidRange(optPtr, 4)) { @@ -669,7 +669,7 @@ int sceKernelCreateFpl(const char *name, u32 mpid, u32 attr, u32 blockSize, u32 alignment = Memory::Read_U32(optPtr + 4); // Must be a power of 2 to be valid. if ((alignment & (alignment - 1)) != 0) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid alignment %d", alignment); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid alignment %d", alignment); } if (alignment < 4) @@ -680,7 +680,7 @@ int sceKernelCreateFpl(const char *name, u32 mpid, u32 attr, u32 blockSize, u32 bool atEnd = (attr & PSP_FPL_ATTR_HIGHMEM) != 0; u32 address = allocator->Alloc(totalSize, atEnd, StringFromFormat("FPL/%s", name).c_str()); if (address == (u32)-1) { - DEBUG_LOG(SCEKERNEL, "sceKernelCreateFpl(\"%s\", partition=%i, attr=%08x, bsize=%i, nb=%i) FAILED - out of ram", + DEBUG_LOG(Log::sceKernel, "sceKernelCreateFpl(\"%s\", partition=%i, attr=%08x, bsize=%i, nb=%i) FAILED - out of ram", name, mpid, attr, blockSize, numBlocks); return SCE_KERNEL_ERROR_NO_MEMORY; } @@ -702,7 +702,7 @@ int sceKernelCreateFpl(const char *name, u32 mpid, u32 attr, u32 blockSize, u32 fpl->address = address; fpl->alignedSize = alignedSize; - DEBUG_LOG(SCEKERNEL, "%i=sceKernelCreateFpl(\"%s\", partition=%i, attr=%08x, bsize=%i, nb=%i)", + DEBUG_LOG(Log::sceKernel, "%i=sceKernelCreateFpl(\"%s\", partition=%i, attr=%08x, bsize=%i, nb=%i)", id, name, mpid, attr, blockSize, numBlocks); return id; @@ -715,7 +715,7 @@ int sceKernelDeleteFpl(SceUID uid) FPL *fpl = kernelObjects.Get(uid, error); if (fpl) { - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteFpl(%i)", uid); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteFpl(%i)", uid); bool wokeThreads = __KernelClearFplThreads(fpl, SCE_KERNEL_ERROR_WAIT_DELETE); if (wokeThreads) @@ -729,7 +729,7 @@ int sceKernelDeleteFpl(SceUID uid) } else { - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteFpl(%i): invalid fpl", uid); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteFpl(%i): invalid fpl", uid); return error; } } @@ -766,7 +766,7 @@ int sceKernelAllocateFpl(SceUID uid, u32 blockPtrAddr, u32 timeoutPtr) FPL *fpl = kernelObjects.Get(uid, error); if (fpl) { - DEBUG_LOG(SCEKERNEL, "sceKernelAllocateFpl(%i, %08x, %08x)", uid, blockPtrAddr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelAllocateFpl(%i, %08x, %08x)", uid, blockPtrAddr, timeoutPtr); int blockNum = fpl->allocateBlock(); if (blockNum >= 0) { @@ -787,7 +787,7 @@ int sceKernelAllocateFpl(SceUID uid, u32 blockPtrAddr, u32 timeoutPtr) } else { - DEBUG_LOG(SCEKERNEL, "sceKernelAllocateFpl(%i, %08x, %08x): invalid fpl", uid, blockPtrAddr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelAllocateFpl(%i, %08x, %08x): invalid fpl", uid, blockPtrAddr, timeoutPtr); return error; } } @@ -798,7 +798,7 @@ int sceKernelAllocateFplCB(SceUID uid, u32 blockPtrAddr, u32 timeoutPtr) FPL *fpl = kernelObjects.Get(uid, error); if (fpl) { - DEBUG_LOG(SCEKERNEL, "sceKernelAllocateFplCB(%i, %08x, %08x)", uid, blockPtrAddr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelAllocateFplCB(%i, %08x, %08x)", uid, blockPtrAddr, timeoutPtr); int blockNum = fpl->allocateBlock(); if (blockNum >= 0) { @@ -819,7 +819,7 @@ int sceKernelAllocateFplCB(SceUID uid, u32 blockPtrAddr, u32 timeoutPtr) } else { - DEBUG_LOG(SCEKERNEL, "sceKernelAllocateFplCB(%i, %08x, %08x): invalid fpl", uid, blockPtrAddr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelAllocateFplCB(%i, %08x, %08x): invalid fpl", uid, blockPtrAddr, timeoutPtr); return error; } } @@ -830,7 +830,7 @@ int sceKernelTryAllocateFpl(SceUID uid, u32 blockPtrAddr) FPL *fpl = kernelObjects.Get(uid, error); if (fpl) { - DEBUG_LOG(SCEKERNEL, "sceKernelTryAllocateFpl(%i, %08x)", uid, blockPtrAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelTryAllocateFpl(%i, %08x)", uid, blockPtrAddr); int blockNum = fpl->allocateBlock(); if (blockNum >= 0) { @@ -844,7 +844,7 @@ int sceKernelTryAllocateFpl(SceUID uid, u32 blockPtrAddr) } else { - DEBUG_LOG(SCEKERNEL, "sceKernelTryAllocateFpl(%i, %08x): invalid fpl", uid, blockPtrAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelTryAllocateFpl(%i, %08x): invalid fpl", uid, blockPtrAddr); return error; } } @@ -852,7 +852,7 @@ int sceKernelTryAllocateFpl(SceUID uid, u32 blockPtrAddr) int sceKernelFreeFpl(SceUID uid, u32 blockPtr) { if (blockPtr > PSP_GetUserMemoryEnd()) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelFreeFpl(%i, %08x): invalid address", SCE_KERNEL_ERROR_ILLEGAL_ADDR, uid, blockPtr); + WARN_LOG(Log::sceKernel, "%08x=sceKernelFreeFpl(%i, %08x): invalid address", SCE_KERNEL_ERROR_ILLEGAL_ADDR, uid, blockPtr); return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } @@ -861,14 +861,14 @@ int sceKernelFreeFpl(SceUID uid, u32 blockPtr) if (fpl) { int blockNum = (blockPtr - fpl->address) / fpl->alignedSize; if (blockNum < 0 || blockNum >= fpl->nf.numBlocks) { - DEBUG_LOG(SCEKERNEL, "sceKernelFreeFpl(%i, %08x): bad block ptr", uid, blockPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelFreeFpl(%i, %08x): bad block ptr", uid, blockPtr); return SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCK; } else { if (fpl->freeBlock(blockNum)) { u32 blockPtr = fpl->address + fpl->alignedSize * blockNum; NotifyMemInfo(MemBlockFlags::SUB_FREE, blockPtr, fpl->alignedSize, "FplFree"); - DEBUG_LOG(SCEKERNEL, "sceKernelFreeFpl(%i, %08x)", uid, blockPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelFreeFpl(%i, %08x)", uid, blockPtr); __KernelSortFplThreads(fpl); bool wokeThreads = false; @@ -886,14 +886,14 @@ retry: hleReSchedule("fpl freed"); return 0; } else { - DEBUG_LOG(SCEKERNEL, "sceKernelFreeFpl(%i, %08x): already free", uid, blockPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelFreeFpl(%i, %08x): already free", uid, blockPtr); return SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCK; } } } else { - DEBUG_LOG(SCEKERNEL, "sceKernelFreeFpl(%i, %08x): invalid fpl", uid, blockPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelFreeFpl(%i, %08x): invalid fpl", uid, blockPtr); return error; } } @@ -906,7 +906,7 @@ int sceKernelCancelFpl(SceUID uid, u32 numWaitThreadsPtr) FPL *fpl = kernelObjects.Get(uid, error); if (fpl) { - DEBUG_LOG(SCEKERNEL, "sceKernelCancelFpl(%i, %08x)", uid, numWaitThreadsPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelFpl(%i, %08x)", uid, numWaitThreadsPtr); fpl->nf.numWaitThreads = (int) fpl->waitingThreads.size(); if (Memory::IsValidAddress(numWaitThreadsPtr)) Memory::Write_U32(fpl->nf.numWaitThreads, numWaitThreadsPtr); @@ -918,7 +918,7 @@ int sceKernelCancelFpl(SceUID uid, u32 numWaitThreadsPtr) } else { - DEBUG_LOG(SCEKERNEL, "sceKernelCancelFpl(%i, %08x): invalid fpl", uid, numWaitThreadsPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelFpl(%i, %08x): invalid fpl", uid, numWaitThreadsPtr); return error; } } @@ -940,9 +940,9 @@ int sceKernelReferFplStatus(SceUID uid, u32 statusPtr) { *status = fpl->nf; status.NotifyWrite("FplStatus"); } - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogError(SCEKERNEL, error, "invalid fpl"); + return hleLogError(Log::sceKernel, error, "invalid fpl"); } } @@ -1022,46 +1022,46 @@ public: static u32 sceKernelMaxFreeMemSize() { u32 retVal = userMemory.GetLargestFreeBlockSize(); - DEBUG_LOG(SCEKERNEL, "%08x (dec %i)=sceKernelMaxFreeMemSize()", retVal, retVal); + DEBUG_LOG(Log::sceKernel, "%08x (dec %i)=sceKernelMaxFreeMemSize()", retVal, retVal); return retVal; } static u32 sceKernelTotalFreeMemSize() { u32 retVal = userMemory.GetTotalFreeBytes(); - DEBUG_LOG(SCEKERNEL, "%08x (dec %i)=sceKernelTotalFreeMemSize()", retVal, retVal); + DEBUG_LOG(Log::sceKernel, "%08x (dec %i)=sceKernelTotalFreeMemSize()", retVal, retVal); return retVal; } int sceKernelAllocPartitionMemory(int partition, const char *name, int type, u32 size, u32 addr) { if (type < PSP_SMEM_Low || type > PSP_SMEM_HighAligned) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCKTYPE, "invalid type %x", type); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCKTYPE, "invalid type %x", type); // Alignment is only allowed for powers of 2. if (type == PSP_SMEM_LowAligned || type == PSP_SMEM_HighAligned) { if ((addr & (addr - 1)) != 0 || addr == 0) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ALIGNMENT_SIZE, "invalid alignment %x", addr); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ALIGNMENT_SIZE, "invalid alignment %x", addr); } if (partition < 1 || partition > 9 || partition == 7) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition %x", partition); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition %x", partition); BlockAllocator *allocator = BlockAllocatorFromID(partition); if (allocator == nullptr) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_PARTITION, "invalid partition %x", partition); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_PARTITION, "invalid partition %x", partition); if (name == nullptr) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ERROR, "invalid name"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ERROR, "invalid name"); if (size == 0) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED, "invalid size %x", size); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED, "invalid size %x", size); PartitionMemoryBlock *block = new PartitionMemoryBlock(allocator, name, size, (MemblockType)type, addr); if (!block->IsValid()) { delete block; - ERROR_LOG(SCEKERNEL, "sceKernelAllocPartitionMemory(partition = %i, %s, type= %i, size= %i, addr= %08x): allocation failed", partition, name, type, size, addr); + ERROR_LOG(Log::sceKernel, "sceKernelAllocPartitionMemory(partition = %i, %s, type= %i, size= %i, addr= %08x): allocation failed", partition, name, type, size, addr); return SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED; } SceUID uid = kernelObjects.Create(block); - DEBUG_LOG(SCEKERNEL,"%i = sceKernelAllocPartitionMemory(partition = %i, %s, type= %i, size= %i, addr= %08x)", + DEBUG_LOG(Log::sceKernel,"%i = sceKernelAllocPartitionMemory(partition = %i, %s, type= %i, size= %i, addr= %08x)", uid, partition, name, type, size, addr); return uid; @@ -1069,7 +1069,7 @@ int sceKernelAllocPartitionMemory(int partition, const char *name, int type, u32 int sceKernelFreePartitionMemory(SceUID id) { - DEBUG_LOG(SCEKERNEL,"sceKernelFreePartitionMemory(%d)",id); + DEBUG_LOG(Log::sceKernel,"sceKernelFreePartitionMemory(%d)",id); return kernelObjects.Destroy(id); } @@ -1080,12 +1080,12 @@ u32 sceKernelGetBlockHeadAddr(SceUID id) PartitionMemoryBlock *block = kernelObjects.Get(id, error); if (block) { - DEBUG_LOG(SCEKERNEL,"%08x = sceKernelGetBlockHeadAddr(%i)", block->address, id); + DEBUG_LOG(Log::sceKernel,"%08x = sceKernelGetBlockHeadAddr(%i)", block->address, id); return block->address; } else { - ERROR_LOG(SCEKERNEL,"sceKernelGetBlockHeadAddr failed(%i)", id); + ERROR_LOG(Log::sceKernel,"sceKernelGetBlockHeadAddr failed(%i)", id); return 0; } } @@ -1211,9 +1211,9 @@ static int sceKernelPrintf(const char *formatString) result.resize(result.size() - 1); if (supported) - INFO_LOG(PRINTF, "sceKernelPrintf: %s", result.c_str()); + INFO_LOG(Log::Printf, "sceKernelPrintf: %s", result.c_str()); else - ERROR_LOG(PRINTF, "UNIMPL sceKernelPrintf(%s, %08x, %08x, %08x)", format.c_str(), PARAM(1), PARAM(2), PARAM(3)); + ERROR_LOG(Log::Printf, "UNIMPL sceKernelPrintf(%s, %08x, %08x, %08x)", format.c_str(), PARAM(1), PARAM(2), PARAM(3)); return 0; } @@ -1242,10 +1242,10 @@ static int sceKernelSetCompiledSdkVersion(int sdkVersion) { } if (!validSDK) { - WARN_LOG_REPORT(SCEKERNEL, "sceKernelSetCompiledSdkVersion unknown SDK: %x", sdkVersion); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelSetCompiledSdkVersion unknown SDK: %x", sdkVersion); } - DEBUG_LOG(SCEKERNEL, "sceKernelSetCompiledSdkVersion(%08x)", sdkVersion); + DEBUG_LOG(Log::sceKernel, "sceKernelSetCompiledSdkVersion(%08x)", sdkVersion); sdkVersion_ = sdkVersion; flags_ |= SCE_KERNEL_HASCOMPILEDSDKVERSION; return 0; @@ -1254,10 +1254,10 @@ static int sceKernelSetCompiledSdkVersion(int sdkVersion) { static int sceKernelSetCompiledSdkVersion370(int sdkVersion) { int sdkMainVersion = sdkVersion & 0xFFFF0000; if (sdkMainVersion != 0x03070000) { - WARN_LOG_REPORT(SCEKERNEL, "sceKernelSetCompiledSdkVersion370 unknown SDK: %x", sdkVersion); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelSetCompiledSdkVersion370 unknown SDK: %x", sdkVersion); } - DEBUG_LOG(SCEKERNEL, "sceKernelSetCompiledSdkVersion370(%08x)", sdkVersion); + DEBUG_LOG(Log::sceKernel, "sceKernelSetCompiledSdkVersion370(%08x)", sdkVersion); sdkVersion_ = sdkVersion; flags_ |= SCE_KERNEL_HASCOMPILEDSDKVERSION; return 0; @@ -1266,12 +1266,12 @@ static int sceKernelSetCompiledSdkVersion370(int sdkVersion) { static int sceKernelSetCompiledSdkVersion380_390(int sdkVersion) { int sdkMainVersion = sdkVersion & 0xFFFF0000; if (sdkMainVersion != 0x03080000 && sdkMainVersion != 0x03090000) { - WARN_LOG_REPORT(SCEKERNEL, "sceKernelSetCompiledSdkVersion380_390 unknown SDK: %x", sdkVersion); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelSetCompiledSdkVersion380_390 unknown SDK: %x", sdkVersion); sdkVersion_ = sdkVersion; flags_ |= SCE_KERNEL_HASCOMPILEDSDKVERSION; } - DEBUG_LOG(SCEKERNEL, "sceKernelSetCompiledSdkVersion380_390(%08x)", sdkVersion); + DEBUG_LOG(Log::sceKernel, "sceKernelSetCompiledSdkVersion380_390(%08x)", sdkVersion); sdkVersion_ = sdkVersion; flags_ |= SCE_KERNEL_HASCOMPILEDSDKVERSION; return 0; @@ -1284,10 +1284,10 @@ static int sceKernelSetCompiledSdkVersion395(int sdkVersion) { && sdkMainVersion != 0x04000500 && sdkMainVersion != 0x03090500 && sdkMainVersion != 0x03090600) { - WARN_LOG_REPORT(SCEKERNEL, "sceKernelSetCompiledSdkVersion395 unknown SDK: %x", sdkVersion); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelSetCompiledSdkVersion395 unknown SDK: %x", sdkVersion); } - DEBUG_LOG(SCEKERNEL, "sceKernelSetCompiledSdkVersion395(%08x)", sdkVersion); + DEBUG_LOG(Log::sceKernel, "sceKernelSetCompiledSdkVersion395(%08x)", sdkVersion); sdkVersion_ = sdkVersion; flags_ |= SCE_KERNEL_HASCOMPILEDSDKVERSION; return 0; @@ -1298,10 +1298,10 @@ static int sceKernelSetCompiledSdkVersion600_602(int sdkVersion) { if (sdkMainVersion != 0x06010000 && sdkMainVersion != 0x06000000 && sdkMainVersion != 0x06020000) { - WARN_LOG_REPORT(SCEKERNEL, "sceKernelSetCompiledSdkVersion600_602 unknown SDK: %x", sdkVersion); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelSetCompiledSdkVersion600_602 unknown SDK: %x", sdkVersion); } - DEBUG_LOG(SCEKERNEL, "sceKernelSetCompiledSdkVersion600_602(%08x)", sdkVersion); + DEBUG_LOG(Log::sceKernel, "sceKernelSetCompiledSdkVersion600_602(%08x)", sdkVersion); sdkVersion_ = sdkVersion; flags_ |= SCE_KERNEL_HASCOMPILEDSDKVERSION; return 0; @@ -1312,10 +1312,10 @@ static int sceKernelSetCompiledSdkVersion500_505(int sdkVersion) int sdkMainVersion = sdkVersion & 0xFFFF0000; if (sdkMainVersion != 0x05000000 && sdkMainVersion != 0x05050000) { - WARN_LOG_REPORT(SCEKERNEL, "sceKernelSetCompiledSdkVersion500_505 unknown SDK: %x", sdkVersion); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelSetCompiledSdkVersion500_505 unknown SDK: %x", sdkVersion); } - DEBUG_LOG(SCEKERNEL, "sceKernelSetCompiledSdkVersion500_505(%08x)", sdkVersion); + DEBUG_LOG(Log::sceKernel, "sceKernelSetCompiledSdkVersion500_505(%08x)", sdkVersion); sdkVersion_ = sdkVersion; flags_ |= SCE_KERNEL_HASCOMPILEDSDKVERSION; return 0; @@ -1325,10 +1325,10 @@ static int sceKernelSetCompiledSdkVersion401_402(int sdkVersion) { int sdkMainVersion = sdkVersion & 0xFFFF0000; if (sdkMainVersion != 0x04010000 && sdkMainVersion != 0x04020000) { - WARN_LOG_REPORT(SCEKERNEL, "sceKernelSetCompiledSdkVersion401_402 unknown SDK: %x", sdkVersion); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelSetCompiledSdkVersion401_402 unknown SDK: %x", sdkVersion); } - DEBUG_LOG(SCEKERNEL, "sceKernelSetCompiledSdkVersion401_402(%08x)", sdkVersion); + DEBUG_LOG(Log::sceKernel, "sceKernelSetCompiledSdkVersion401_402(%08x)", sdkVersion); sdkVersion_ = sdkVersion; flags_ |= SCE_KERNEL_HASCOMPILEDSDKVERSION; return 0; @@ -1337,10 +1337,10 @@ static int sceKernelSetCompiledSdkVersion401_402(int sdkVersion) { static int sceKernelSetCompiledSdkVersion507(int sdkVersion) { int sdkMainVersion = sdkVersion & 0xFFFF0000; if (sdkMainVersion != 0x05070000) { - WARN_LOG_REPORT(SCEKERNEL, "sceKernelSetCompiledSdkVersion507 unknown SDK: %x", sdkVersion); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelSetCompiledSdkVersion507 unknown SDK: %x", sdkVersion); } - DEBUG_LOG(SCEKERNEL, "sceKernelSetCompiledSdkVersion507(%08x)", sdkVersion); + DEBUG_LOG(Log::sceKernel, "sceKernelSetCompiledSdkVersion507(%08x)", sdkVersion); sdkVersion_ = sdkVersion; flags_ |= SCE_KERNEL_HASCOMPILEDSDKVERSION; return 0; @@ -1351,10 +1351,10 @@ static int sceKernelSetCompiledSdkVersion603_605(int sdkVersion) { if (sdkMainVersion != 0x06040000 && sdkMainVersion != 0x06030000 && sdkMainVersion != 0x06050000) { - WARN_LOG_REPORT(SCEKERNEL, "sceKernelSetCompiledSdkVersion603_605 unknown SDK: %x", sdkVersion); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelSetCompiledSdkVersion603_605 unknown SDK: %x", sdkVersion); } - DEBUG_LOG(SCEKERNEL, "sceKernelSetCompiledSdkVersion603_605(%08x)", sdkVersion); + DEBUG_LOG(Log::sceKernel, "sceKernelSetCompiledSdkVersion603_605(%08x)", sdkVersion); sdkVersion_ = sdkVersion; flags_ |= SCE_KERNEL_HASCOMPILEDSDKVERSION; return 0; @@ -1363,10 +1363,10 @@ static int sceKernelSetCompiledSdkVersion603_605(int sdkVersion) { static int sceKernelSetCompiledSdkVersion606(int sdkVersion) { int sdkMainVersion = sdkVersion & 0xFFFF0000; if (sdkMainVersion != 0x06060000) { - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelSetCompiledSdkVersion606 unknown SDK: %x (would crash)", sdkVersion); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelSetCompiledSdkVersion606 unknown SDK: %x (would crash)", sdkVersion); } - DEBUG_LOG(SCEKERNEL, "sceKernelSetCompiledSdkVersion606(%08x)", sdkVersion); + DEBUG_LOG(Log::sceKernel, "sceKernelSetCompiledSdkVersion606(%08x)", sdkVersion); sdkVersion_ = sdkVersion; flags_ |= SCE_KERNEL_HASCOMPILEDSDKVERSION; return 0; @@ -1379,7 +1379,7 @@ int sceKernelGetCompiledSdkVersion() { } static int sceKernelSetCompilerVersion(int version) { - DEBUG_LOG(SCEKERNEL, "sceKernelSetCompilerVersion(%08x)", version); + DEBUG_LOG(Log::sceKernel, "sceKernelSetCompilerVersion(%08x)", version); compilerVersion_ = version; flags_ |= SCE_KERNEL_HASCOMPILERVERSION; return 0; @@ -1456,18 +1456,18 @@ void __KernelVplBeginCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitBeginCallback(threadID, prevCallbackId, vplWaitTimer); if (result == HLEKernel::WAIT_CB_SUCCESS) - DEBUG_LOG(SCEKERNEL, "sceKernelAllocateVplCB: Suspending vpl wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelAllocateVplCB: Suspending vpl wait for callback"); else if (result == HLEKernel::WAIT_CB_BAD_WAIT_DATA) - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelAllocateVplCB: wait not found to pause for callback"); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelAllocateVplCB: wait not found to pause for callback"); else - WARN_LOG_REPORT(SCEKERNEL, "sceKernelAllocateVplCB: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelAllocateVplCB: beginning callback with bad wait id?"); } void __KernelVplEndCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitEndCallback(threadID, prevCallbackId, vplWaitTimer, __KernelUnlockVplForThread); if (result == HLEKernel::WAIT_CB_RESUMED_WAIT) - DEBUG_LOG(SCEKERNEL, "sceKernelAllocateVplCB: Resuming mbx wait from callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelAllocateVplCB: Resuming mbx wait from callback"); } static bool __VplThreadSortPriority(VplWaitingThread thread1, VplWaitingThread thread2) @@ -1498,21 +1498,21 @@ static void __KernelSortVplThreads(VPL *vpl) SceUID sceKernelCreateVpl(const char *name, int partition, u32 attr, u32 vplSize, u32 optPtr) { if (!name) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ERROR, "invalid name"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ERROR, "invalid name"); if (partition < 1 || partition > 9 || partition == 7) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition %d", partition); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition %d", partition); BlockAllocator *allocator = BlockAllocatorFromID(partition); if (allocator == nullptr) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_PERM, "invalid partition %d", partition); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_PERM, "invalid partition %d", partition); if (((attr & ~PSP_VPL_ATTR_KNOWN) & ~0xFF) != 0) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter: %08x", attr); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter: %08x", attr); if (vplSize == 0) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE, "invalid size"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE, "invalid size"); // Block Allocator seems to A-OK this, let's stop it here. if (vplSize >= 0x80000000) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_NO_MEMORY, "way too big size"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_NO_MEMORY, "way too big size"); // Can't have that little space in a Vpl, sorry. if (vplSize <= 0x30) @@ -1523,7 +1523,7 @@ SceUID sceKernelCreateVpl(const char *name, int partition, u32 attr, u32 vplSize u32 allocSize = vplSize; u32 memBlockPtr = allocator->Alloc(allocSize, (attr & PSP_VPL_ATTR_HIGHMEM) != 0, StringFromFormat("VPL/%s", name).c_str()); if (memBlockPtr == (u32)-1) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_NO_MEMORY, "failed to allocate %i bytes of pool data", vplSize); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_NO_MEMORY, "failed to allocate %i bytes of pool data", vplSize); VPL *vpl = new VPL; SceUID id = kernelObjects.Create(vpl); @@ -1543,14 +1543,14 @@ SceUID sceKernelCreateVpl(const char *name, int partition, u32 attr, u32 vplSize vpl->header = PSPPointer::Create(memBlockPtr); vpl->header->Init(memBlockPtr, vplSize); - DEBUG_LOG(SCEKERNEL, "%x=sceKernelCreateVpl(\"%s\", block=%i, attr=%i, size=%i)", + DEBUG_LOG(Log::sceKernel, "%x=sceKernelCreateVpl(\"%s\", block=%i, attr=%i, size=%i)", id, name, partition, vpl->nv.attr, vpl->nv.poolSize); if (optPtr != 0) { u32 size = Memory::Read_U32(optPtr); if (size > 4) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateVpl(): unsupported options parameter, size = %d", size); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateVpl(): unsupported options parameter, size = %d", size); } return id; @@ -1558,7 +1558,7 @@ SceUID sceKernelCreateVpl(const char *name, int partition, u32 attr, u32 vplSize int sceKernelDeleteVpl(SceUID uid) { - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteVpl(%i)", uid); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteVpl(%i)", uid); u32 error; VPL *vpl = kernelObjects.Get(uid, error); if (vpl) @@ -1584,12 +1584,12 @@ static bool __KernelAllocateVpl(SceUID uid, u32 size, u32 addrPtr, u32 &error, b VPL *vpl = kernelObjects.Get(uid, error); if (vpl) { if (size == 0 || size > (u32) vpl->nv.poolSize) { - WARN_LOG(SCEKERNEL, "%s(vpl=%i, size=%i, ptrout=%08x): invalid size", funcname, uid, size, addrPtr); + WARN_LOG(Log::sceKernel, "%s(vpl=%i, size=%i, ptrout=%08x): invalid size", funcname, uid, size, addrPtr); error = SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE; return false; } - VERBOSE_LOG(SCEKERNEL, "%s(vpl=%i, size=%i, ptrout=%08x)", funcname, uid, size, addrPtr); + VERBOSE_LOG(Log::sceKernel, "%s(vpl=%i, size=%i, ptrout=%08x)", funcname, uid, size, addrPtr); // For some reason, try doesn't follow the same rules... if (!trying && (vpl->nv.attr & PSP_VPL_ATTR_MASK_ORDER) == PSP_VPL_ATTR_FIFO) @@ -1733,11 +1733,11 @@ int sceKernelTryAllocateVpl(SceUID uid, u32 size, u32 addrPtr) int sceKernelFreeVpl(SceUID uid, u32 addr) { if (addr && !Memory::IsValidAddress(addr)) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelFreeVpl(%i, %08x): Invalid address", SCE_KERNEL_ERROR_ILLEGAL_ADDR, uid, addr); + WARN_LOG(Log::sceKernel, "%08x=sceKernelFreeVpl(%i, %08x): Invalid address", SCE_KERNEL_ERROR_ILLEGAL_ADDR, uid, addr); return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } - VERBOSE_LOG(SCEKERNEL, "sceKernelFreeVpl(%i, %08x)", uid, addr); + VERBOSE_LOG(Log::sceKernel, "sceKernelFreeVpl(%i, %08x)", uid, addr); u32 error; VPL *vpl = kernelObjects.Get(uid, error); if (vpl) { @@ -1770,7 +1770,7 @@ retry: return 0; } else { - WARN_LOG(SCEKERNEL, "%08x=sceKernelFreeVpl(%i, %08x): Unable to free", SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCK, uid, addr); + WARN_LOG(Log::sceKernel, "%08x=sceKernelFreeVpl(%i, %08x): Unable to free", SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCK, uid, addr); return SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCK; } } else { @@ -1784,7 +1784,7 @@ int sceKernelCancelVpl(SceUID uid, u32 numWaitThreadsPtr) VPL *vpl = kernelObjects.Get(uid, error); if (vpl) { - DEBUG_LOG(SCEKERNEL, "sceKernelCancelVpl(%i, %08x)", uid, numWaitThreadsPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelVpl(%i, %08x)", uid, numWaitThreadsPtr); vpl->nv.numWaitThreads = (int) vpl->waitingThreads.size(); if (Memory::IsValidAddress(numWaitThreadsPtr)) Memory::Write_U32(vpl->nv.numWaitThreads, numWaitThreadsPtr); @@ -1797,7 +1797,7 @@ int sceKernelCancelVpl(SceUID uid, u32 numWaitThreadsPtr) } else { - DEBUG_LOG(SCEKERNEL, "sceKernelCancelVpl(%i, %08x): invalid vpl", uid, numWaitThreadsPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelVpl(%i, %08x): invalid vpl", uid, numWaitThreadsPtr); return error; } } @@ -1818,27 +1818,27 @@ int sceKernelReferVplStatus(SceUID uid, u32 infoPtr) { *info = vpl->nv; info.NotifyWrite("VplStatus"); } - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogError(SCEKERNEL, error, "invalid vpl"); + return hleLogError(Log::sceKernel, error, "invalid vpl"); } } static u32 AllocMemoryBlock(const char *pname, u32 type, u32 size, u32 paramsAddr) { if (Memory::IsValidAddress(paramsAddr) && Memory::Read_U32(paramsAddr) != 4) { - ERROR_LOG_REPORT(SCEKERNEL, "AllocMemoryBlock(%s): unsupported params size %d", pname, Memory::Read_U32(paramsAddr)); + ERROR_LOG_REPORT(Log::sceKernel, "AllocMemoryBlock(%s): unsupported params size %d", pname, Memory::Read_U32(paramsAddr)); return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT; } if (type != PSP_SMEM_High && type != PSP_SMEM_Low) { - ERROR_LOG_REPORT(SCEKERNEL, "AllocMemoryBlock(%s): unsupported type %d", pname, type); + ERROR_LOG_REPORT(Log::sceKernel, "AllocMemoryBlock(%s): unsupported type %d", pname, type); return SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCKTYPE; } if (size == 0) { - WARN_LOG_REPORT(SCEKERNEL, "AllocMemoryBlock(%s): invalid size %x", pname, size); + WARN_LOG_REPORT(Log::sceKernel, "AllocMemoryBlock(%s): invalid size %x", pname, size); return SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED; } if (pname == NULL) { - ERROR_LOG_REPORT(SCEKERNEL, "AllocMemoryBlock(): NULL name"); + ERROR_LOG_REPORT(Log::sceKernel, "AllocMemoryBlock(): NULL name"); return SCE_KERNEL_ERROR_ERROR; } @@ -1846,17 +1846,17 @@ static u32 AllocMemoryBlock(const char *pname, u32 type, u32 size, u32 paramsAdd if (!block->IsValid()) { delete block; - ERROR_LOG(SCEKERNEL, "AllocMemoryBlock(%s, %i, %08x, %08x): allocation failed", pname, type, size, paramsAddr); + ERROR_LOG(Log::sceKernel, "AllocMemoryBlock(%s, %i, %08x, %08x): allocation failed", pname, type, size, paramsAddr); return SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED; } SceUID uid = kernelObjects.Create(block); - INFO_LOG(SCEKERNEL,"%08x=AllocMemoryBlock(SysMemUserForUser_FE707FDF)(%s, %i, %08x, %08x)", uid, pname, type, size, paramsAddr); + INFO_LOG(Log::sceKernel,"%08x=AllocMemoryBlock(SysMemUserForUser_FE707FDF)(%s, %i, %08x, %08x)", uid, pname, type, size, paramsAddr); return uid; } static u32 FreeMemoryBlock(u32 uid) { - INFO_LOG(SCEKERNEL, "FreeMemoryBlock(%08x)", uid); + INFO_LOG(Log::sceKernel, "FreeMemoryBlock(%08x)", uid); return kernelObjects.Destroy(uid); } @@ -1865,31 +1865,31 @@ static u32 GetMemoryBlockPtr(u32 uid, u32 addr) { PartitionMemoryBlock *block = kernelObjects.Get(uid, error); if (block) { - INFO_LOG(SCEKERNEL, "GetMemoryBlockPtr(%08x, %08x) = %08x", uid, addr, block->address); + INFO_LOG(Log::sceKernel, "GetMemoryBlockPtr(%08x, %08x) = %08x", uid, addr, block->address); Memory::Write_U32(block->address, addr); return 0; } else { - ERROR_LOG(SCEKERNEL, "GetMemoryBlockPtr(%08x, %08x) failed", uid, addr); + ERROR_LOG(Log::sceKernel, "GetMemoryBlockPtr(%08x, %08x) failed", uid, addr); return 0; } } static u32 SysMemUserForUser_D8DE5C1E() { // Called by Evangelion Jo and return 0 here to go in-game. - ERROR_LOG(SCEKERNEL,"UNIMPL SysMemUserForUser_D8DE5C1E()"); + ERROR_LOG(Log::sceKernel,"UNIMPL SysMemUserForUser_D8DE5C1E()"); return 0; } static u32 SysMemUserForUser_ACBD88CA() { - ERROR_LOG_REPORT_ONCE(SysMemUserForUser_ACBD88CA, SCEKERNEL, "UNIMPL SysMemUserForUser_ACBD88CA()"); + ERROR_LOG_REPORT_ONCE(SysMemUserForUser_ACBD88CA, Log::sceKernel, "UNIMPL SysMemUserForUser_ACBD88CA()"); return 0; } static u32 SysMemUserForUser_945E45DA() { // Called by Evangelion Jo and expected return 0 here. - ERROR_LOG_REPORT_ONCE(SysMemUserForUser945E45DA, SCEKERNEL, "UNIMPL SysMemUserForUser_945E45DA()"); + ERROR_LOG_REPORT_ONCE(SysMemUserForUser945E45DA, Log::sceKernel, "UNIMPL SysMemUserForUser_945E45DA()"); return 0; } @@ -2074,15 +2074,15 @@ void __KernelTlsplThreadEnd(SceUID threadID) SceUID sceKernelCreateTlspl(const char *name, u32 partition, u32 attr, u32 blockSize, u32 count, u32 optionsPtr) { if (!name) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_NO_MEMORY, "invalid name"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_NO_MEMORY, "invalid name"); if ((attr & ~PSP_TLSPL_ATTR_KNOWN) >= 0x100) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter: %08x", attr); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter: %08x", attr); if (partition < 1 || partition > 9 || partition == 7) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition %d", partition); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition %d", partition); BlockAllocator *allocator = BlockAllocatorFromID(partition); if (allocator == nullptr) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_PERM, "invalid partition %x", partition); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_PERM, "invalid partition %x", partition); // There's probably a simpler way to get this same basic formula... // This is based on results from a PSP. @@ -2092,7 +2092,7 @@ SceUID sceKernelCreateTlspl(const char *name, u32 partition, u32 attr, u32 block if (!illegalMemSize && (u64) count >= 0x100000000ULL / (((u64) blockSize + 3ULL) & ~3ULL)) illegalMemSize = true; if (illegalMemSize) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE, "invalid blockSize/count"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE, "invalid blockSize/count"); int index = -1; for (int i = 0; i < TLSPL_NUM_INDEXES; ++i) { @@ -2103,7 +2103,7 @@ SceUID sceKernelCreateTlspl(const char *name, u32 partition, u32 attr, u32 block } if (index == -1) - return hleLogWarning(SCEKERNEL, PSP_ERROR_TOO_MANY_TLSPL, "ran out of indexes for TLS pools"); + return hleLogWarning(Log::sceKernel, PSP_ERROR_TOO_MANY_TLSPL, "ran out of indexes for TLS pools"); // Unless otherwise specified, we align to 4 bytes (a mips word.) u32 alignment = 4; @@ -2114,7 +2114,7 @@ SceUID sceKernelCreateTlspl(const char *name, u32 partition, u32 attr, u32 block // Note that 0 intentionally is allowed. if ((alignment & (alignment - 1)) != 0) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "alignment is not a power of 2: %d", alignment); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "alignment is not a power of 2: %d", alignment); // This goes for 0, 1, and 2. Can't have less than 4 byte alignment. if (alignment < 4) alignment = 4; @@ -2130,7 +2130,7 @@ SceUID sceKernelCreateTlspl(const char *name, u32 partition, u32 attr, u32 block #endif if (blockPtr == (u32)-1) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_NO_MEMORY, "failed to allocate memory"); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_NO_MEMORY, "failed to allocate memory"); TLSPL *tls = new TLSPL(); SceUID id = kernelObjects.Create(tls); @@ -2149,7 +2149,7 @@ SceUID sceKernelCreateTlspl(const char *name, u32 partition, u32 attr, u32 block tls->alignment = alignment; tls->usage.resize(count, 0); - return hleLogSuccessInfoI(SCEKERNEL, id); + return hleLogSuccessInfoI(Log::sceKernel, id); } int sceKernelDeleteTlspl(SceUID uid) @@ -2167,11 +2167,11 @@ int sceKernelDeleteTlspl(SceUID uid) if (inUse) { error = PSP_ERROR_TLSPL_IN_USE; - WARN_LOG(SCEKERNEL, "%08x=sceKernelDeleteTlspl(%08x): in use", error, uid); + WARN_LOG(Log::sceKernel, "%08x=sceKernelDeleteTlspl(%08x): in use", error, uid); return error; } - WARN_LOG(SCEKERNEL, "sceKernelDeleteTlspl(%08x)", uid); + WARN_LOG(Log::sceKernel, "sceKernelDeleteTlspl(%08x)", uid); for (SceUID threadID : tls->waitingThreads) HLEKernel::ResumeFromWait(threadID, WAITTYPE_TLSPL, uid, 0); @@ -2185,7 +2185,7 @@ int sceKernelDeleteTlspl(SceUID uid) kernelObjects.Destroy(uid); } else - ERROR_LOG(SCEKERNEL, "%08x=sceKernelDeleteTlspl(%08x): bad tlspl", error, uid); + ERROR_LOG(Log::sceKernel, "%08x=sceKernelDeleteTlspl(%08x): bad tlspl", error, uid); return error; } @@ -2204,23 +2204,23 @@ static bool FindTLSByIndex(TLSPL *possible, FindTLSByIndexArg *state) { int sceKernelGetTlsAddr(SceUID uid) { if (!__KernelIsDispatchEnabled() || __IsInInterrupt()) - return hleLogWarning(SCEKERNEL, 0, "dispatch disabled"); + return hleLogWarning(Log::sceKernel, 0, "dispatch disabled"); u32 error; TLSPL *tls = kernelObjects.Get(uid, error); if (!tls) { if (uid < 0) - return hleLogError(SCEKERNEL, 0, "tlspl not found"); + return hleLogError(Log::sceKernel, 0, "tlspl not found"); // There's this weird behavior where it looks up by index. Maybe we shouldn't use uids... if (!tlsplUsedIndexes[(uid >> 3) & 15]) - return hleLogError(SCEKERNEL, 0, "tlspl not found"); + return hleLogError(Log::sceKernel, 0, "tlspl not found"); FindTLSByIndexArg state; state.index = (uid >> 3) & 15; kernelObjects.Iterate(&FindTLSByIndex, &state); if (!state.result) - return hleLogError(SCEKERNEL, 0, "tlspl not found"); + return hleLogError(Log::sceKernel, 0, "tlspl not found"); tls = state.result; } @@ -2259,7 +2259,7 @@ int sceKernelGetTlsAddr(SceUID uid) { { tls->waitingThreads.push_back(threadID); __KernelWaitCurThread(WAITTYPE_TLSPL, uid, 1, 0, false, "allocate tls"); - return hleLogDebug(SCEKERNEL, 0, "waiting for tls alloc"); + return hleLogDebug(Log::sceKernel, 0, "waiting for tls alloc"); } u32 alignedSize = (tls->ntls.blockSize + tls->alignment - 1) & ~(tls->alignment - 1); @@ -2271,13 +2271,13 @@ int sceKernelGetTlsAddr(SceUID uid) { Memory::Memset(allocAddress, 0, tls->ntls.blockSize, "TlsAddr"); } - return hleLogDebug(SCEKERNEL, allocAddress); + return hleLogDebug(Log::sceKernel, allocAddress); } // Parameters are an educated guess. int sceKernelFreeTlspl(SceUID uid) { - WARN_LOG(SCEKERNEL, "UNIMPL sceKernelFreeTlspl(%08x)", uid); + WARN_LOG(Log::sceKernel, "UNIMPL sceKernelFreeTlspl(%08x)", uid); u32 error; TLSPL *tls = kernelObjects.Get(uid, error); if (tls) @@ -2302,9 +2302,9 @@ int sceKernelReferTlsplStatus(SceUID uid, u32 infoPtr) { *info = tls->ntls; info.NotifyWrite("TlsplStatus"); } - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogError(SCEKERNEL, error, "invalid tlspl"); + return hleLogError(Log::sceKernel, error, "invalid tlspl"); } } diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 1b2908e28c..cd1553ee3d 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -363,7 +363,7 @@ public: } if (foundBroken) { - ERROR_LOG(LOADER, "Broken stub import data while loading state"); + ERROR_LOG(Log::Loader, "Broken stub import data while loading state"); } } @@ -384,11 +384,11 @@ public: void ImportFunc(const FuncSymbolImport &func, bool reimporting) { if (!Memory::IsValidAddress(func.stubAddr)) { - WARN_LOG_REPORT(LOADER, "Invalid address for syscall stub %s %08x", func.moduleName, func.nid); + WARN_LOG_REPORT(Log::Loader, "Invalid address for syscall stub %s %08x", func.moduleName, func.nid); return; } - DEBUG_LOG(LOADER, "Importing %s : %08x", GetFuncName(func.moduleName, func.nid), func.stubAddr); + DEBUG_LOG(Log::Loader, "Importing %s : %08x", GetFuncName(func.moduleName, func.nid), func.stubAddr); // Add the symbol to the symbol map for debugging. char temp[256]; @@ -560,7 +560,7 @@ void __KernelModuleDoState(PointerWrap &p) PSPModule *module = kernelObjects.Get(moduleId, error); if (module && module->libstub != 0) { if (!KernelImportModuleFuncs(module, nullptr, true)) { - ERROR_LOG(LOADER, "Something went wrong loading imports on load state"); + ERROR_LOG(Log::Loader, "Something went wrong loading imports on load state"); } } } @@ -598,7 +598,7 @@ static void WriteVarSymbol(WriteVarSymbolState &state, u32 exportAddress, u32 re switch (type) { case R_MIPS_NONE: - WARN_LOG_REPORT(LOADER, "Var relocation type NONE - %08x => %08x", exportAddress, relocAddress); + WARN_LOG_REPORT(Log::Loader, "Var relocation type NONE - %08x => %08x", exportAddress, relocAddress); break; case R_MIPS_32: @@ -613,7 +613,7 @@ static void WriteVarSymbol(WriteVarSymbolState &state, u32 exportAddress, u32 re /* case R_MIPS_26: if (exportAddress % 4 || (exportAddress >> 28) != ((relocAddress + 4) >> 28)) { - WARN_LOG_REPORT(LOADER, "Bad var relocation addresses for type 26 - %08x => %08x", exportAddress, relocAddress) + WARN_LOG_REPORT(Log::Loader, "Bad var relocation addresses for type 26 - %08x => %08x", exportAddress, relocAddress) } else { if (!reverse) { relocData = (relocData & ~0x03ffffff) | ((relocData + (exportAddress >> 2)) & 0x03ffffff); @@ -627,7 +627,7 @@ static void WriteVarSymbol(WriteVarSymbolState &state, u32 exportAddress, u32 re case R_MIPS_HI16: if (state.lastHI16ExportAddress != exportAddress) { if (!state.lastHI16Processed && !state.lastHI16Relocs.empty()) { - WARN_LOG_REPORT(LOADER, "Unsafe unpaired HI16 variable relocation @ %08x / %08x", state.lastHI16Relocs[state.lastHI16Relocs.size() - 1].addr, relocAddress); + WARN_LOG_REPORT(Log::Loader, "Unsafe unpaired HI16 variable relocation @ %08x / %08x", state.lastHI16Relocs[state.lastHI16Relocs.size() - 1].addr, relocAddress); } state.lastHI16ExportAddress = exportAddress; @@ -657,10 +657,10 @@ static void WriteVarSymbol(WriteVarSymbolState &state, u32 exportAddress, u32 re // The ABI requires that these come in pairs, at least. if (state.lastHI16Relocs.empty()) { - ERROR_LOG_REPORT(LOADER, "LO16 without any HI16 variable import at %08x for %08x", relocAddress, exportAddress); + ERROR_LOG_REPORT(Log::Loader, "LO16 without any HI16 variable import at %08x for %08x", relocAddress, exportAddress); // Try to process at least the low relocation... } else if (state.lastHI16ExportAddress != exportAddress) { - ERROR_LOG_REPORT(LOADER, "HI16 and LO16 imports do not match at %08x for %08x (should be %08x)", relocAddress, state.lastHI16ExportAddress, exportAddress); + ERROR_LOG_REPORT(Log::Loader, "HI16 and LO16 imports do not match at %08x for %08x (should be %08x)", relocAddress, state.lastHI16ExportAddress, exportAddress); } else { // Process each of the HI16. Usually there's only one. for (auto &reloc : state.lastHI16Relocs) { @@ -684,7 +684,7 @@ static void WriteVarSymbol(WriteVarSymbolState &state, u32 exportAddress, u32 re break; default: - WARN_LOG_REPORT(LOADER, "Unsupported var relocation type %d - %08x => %08x", type, exportAddress, relocAddress); + WARN_LOG_REPORT(Log::Loader, "Unsupported var relocation type %d - %08x => %08x", type, exportAddress, relocAddress); } Memory::Write_U32(relocData, relocAddress); @@ -694,12 +694,12 @@ static void WriteVarSymbol(WriteVarSymbolState &state, u32 exportAddress, u32 re void ImportVarSymbol(WriteVarSymbolState &state, const VarSymbolImport &var) { if (var.nid == 0) { // TODO: What's the right thing for this? - ERROR_LOG_REPORT(LOADER, "Var import with nid = 0, type = %d", var.type); + ERROR_LOG_REPORT(Log::Loader, "Var import with nid = 0, type = %d", var.type); return; } if (!Memory::IsValidAddress(var.stubAddr)) { - ERROR_LOG_REPORT(LOADER, "Invalid address for var import nid = %08x, type = %d, addr = %08x", var.nid, var.type, var.stubAddr); + ERROR_LOG_REPORT(Log::Loader, "Invalid address for var import nid = %08x, type = %d, addr = %08x", var.nid, var.type, var.stubAddr); return; } @@ -720,7 +720,7 @@ void ImportVarSymbol(WriteVarSymbolState &state, const VarSymbolImport &var) { } // It hasn't been exported yet, but hopefully it will later. - INFO_LOG(LOADER, "Variable (%s,%08x) unresolved, storing for later resolving", var.moduleName, var.nid); + INFO_LOG(Log::Loader, "Variable (%s,%08x) unresolved, storing for later resolving", var.moduleName, var.nid); } void ExportVarSymbol(const VarSymbolExport &var) { @@ -735,7 +735,7 @@ void ExportVarSymbol(const VarSymbolExport &var) { WriteVarSymbolState state; for (auto &imported : module->importedVars) { if (var.Matches(imported)) { - INFO_LOG(LOADER, "Resolving var %s/%08x", var.moduleName, var.nid); + INFO_LOG(Log::Loader, "Resolving var %s/%08x", var.moduleName, var.nid); WriteVarSymbol(state, var.symAddr, imported.stubAddr, imported.type); } } @@ -754,7 +754,7 @@ void UnexportVarSymbol(const VarSymbolExport &var) { WriteVarSymbolState state; for (auto &imported : module->importedVars) { if (var.Matches(imported)) { - INFO_LOG(LOADER, "Unresolving var %s/%08x", var.moduleName, var.nid); + INFO_LOG(Log::Loader, "Unresolving var %s/%08x", var.moduleName, var.nid); WriteVarSymbol(state, var.symAddr, imported.stubAddr, imported.type, true); } } @@ -766,7 +766,7 @@ void ImportFuncSymbol(const FuncSymbolImport &func, bool reimporting, const char // TODO: Or not? if (FuncImportIsSyscall(func.moduleName, func.nid)) { if (reimporting && Memory::Read_Instruction(func.stubAddr + 4) != GetSyscallOp(func.moduleName, func.nid)) { - WARN_LOG(LOADER, "Reimporting updated syscall %s", GetFuncName(func.moduleName, func.nid)); + WARN_LOG(Log::Loader, "Reimporting updated syscall %s", GetFuncName(func.moduleName, func.nid)); } WriteSyscall(func.moduleName, func.nid, func.stubAddr); currentMIPS->InvalidateICache(func.stubAddr, 8); @@ -785,7 +785,7 @@ void ImportFuncSymbol(const FuncSymbolImport &func, bool reimporting, const char for (auto it = module->exportedFuncs.begin(), end = module->exportedFuncs.end(); it != end; ++it) { if (it->Matches(func)) { if (reimporting && Memory::Read_Instruction(func.stubAddr) != MIPS_MAKE_J(it->symAddr)) { - WARN_LOG_REPORT(LOADER, "Reimporting: func import %s/%08x changed", func.moduleName, func.nid); + WARN_LOG_REPORT(Log::Loader, "Reimporting: func import %s/%08x changed", func.moduleName, func.nid); } WriteFuncStub(func.stubAddr, it->symAddr); currentMIPS->InvalidateICache(func.stubAddr, 8); @@ -799,9 +799,9 @@ void ImportFuncSymbol(const FuncSymbolImport &func, bool reimporting, const char bool isKnownModule = GetModuleIndex(func.moduleName) != -1; if (isKnownModule) { // We used to report this, but I don't think it's very interesting anymore. - WARN_LOG(LOADER, "Unknown syscall from known module '%s': 0x%08x (import for '%s')", func.moduleName, func.nid, importingModule); + WARN_LOG(Log::Loader, "Unknown syscall from known module '%s': 0x%08x (import for '%s')", func.moduleName, func.nid, importingModule); } else { - INFO_LOG(LOADER, "Function (%s,%08x) unresolved in '%s', storing for later resolving", func.moduleName, func.nid, importingModule); + INFO_LOG(Log::Loader, "Function (%s,%08x) unresolved in '%s', storing for later resolving", func.moduleName, func.nid, importingModule); } if (isKnownModule || !reimporting) { WriteFuncMissingStub(func.stubAddr, func.nid); @@ -812,7 +812,7 @@ void ImportFuncSymbol(const FuncSymbolImport &func, bool reimporting, const char void ExportFuncSymbol(const FuncSymbolExport &func) { if (FuncImportIsSyscall(func.moduleName, func.nid)) { // HLE covers this already - let's ignore the function. - WARN_LOG(LOADER, "Ignoring func export %s/%08x, already implemented in HLE.", func.moduleName, func.nid); + WARN_LOG(Log::Loader, "Ignoring func export %s/%08x, already implemented in HLE.", func.moduleName, func.nid); return; } @@ -826,7 +826,7 @@ void ExportFuncSymbol(const FuncSymbolExport &func) { // Look for imports currently loaded modules already have, hook it up right away. for (auto it = module->importedFuncs.begin(), end = module->importedFuncs.end(); it != end; ++it) { if (func.Matches(*it)) { - INFO_LOG(LOADER, "Resolving function %s/%08x", func.moduleName, func.nid); + INFO_LOG(Log::Loader, "Resolving function %s/%08x", func.moduleName, func.nid); WriteFuncStub(it->stubAddr, func.symAddr); currentMIPS->InvalidateICache(it->stubAddr, 8); MIPSAnalyst::PrecompileFunction(it->stubAddr, 8); @@ -851,7 +851,7 @@ void UnexportFuncSymbol(const FuncSymbolExport &func) { // Look for imports modules that are *still* loaded have, and write back stubs. for (auto it = module->importedFuncs.begin(), end = module->importedFuncs.end(); it != end; ++it) { if (func.Matches(*it)) { - INFO_LOG(LOADER, "Unresolving function %s/%08x", func.moduleName, func.nid); + INFO_LOG(Log::Loader, "Unresolving function %s/%08x", func.moduleName, func.nid); WriteFuncMissingStub(it->stubAddr, it->nid); currentMIPS->InvalidateICache(it->stubAddr, 8); } @@ -872,7 +872,7 @@ void PSPModule::Cleanup() { } if (memoryBlockAddr != 0 && nm.text_addr != 0 && memoryBlockSize >= nm.data_size + nm.bss_size + nm.text_size) { - DEBUG_LOG(LOADER, "Zeroing out module %s memory: %08x - %08x", nm.name, memoryBlockAddr, memoryBlockAddr + memoryBlockSize); + DEBUG_LOG(Log::Loader, "Zeroing out module %s memory: %08x - %08x", nm.name, memoryBlockAddr, memoryBlockAddr + memoryBlockSize); u32 clearSize = Memory::ValidSize(nm.text_addr, (u32)nm.text_size + 3); for (u32 i = 0; i < clearSize; i += 4) { Memory::WriteUnchecked_U32(MIPS_MAKE_BREAK(1), nm.text_addr + i); @@ -887,12 +887,12 @@ void PSPModule::Cleanup() { static void SaveDecryptedEbootToStorageMedia(const u8 *decryptedEbootDataPtr, const u32 length, const char *name) { if (!decryptedEbootDataPtr) { - ERROR_LOG(SCEMODULE, "Error saving decrypted EBOOT.BIN: invalid pointer"); + ERROR_LOG(Log::sceModule, "Error saving decrypted EBOOT.BIN: invalid pointer"); return; } if (length == 0) { - ERROR_LOG(SCEMODULE, "Error saving decrypted EBOOT.BIN: invalid length"); + ERROR_LOG(Log::sceModule, "Error saving decrypted EBOOT.BIN: invalid length"); return; } @@ -902,21 +902,21 @@ static void SaveDecryptedEbootToStorageMedia(const u8 *decryptedEbootDataPtr, co // If the file already exists, don't dump it again. if (File::Exists(fullPath)) { - INFO_LOG(SCEMODULE, "Decrypted EBOOT.BIN already exists for this game, skipping dump."); + INFO_LOG(Log::sceModule, "Decrypted EBOOT.BIN already exists for this game, skipping dump."); return; } // Make sure the dump directory exists before continuing. if (!File::Exists(dumpDirectory)) { if (!File::CreateDir(dumpDirectory)) { - ERROR_LOG(SCEMODULE, "Unable to create directory for EBOOT dumping, aborting."); + ERROR_LOG(Log::sceModule, "Unable to create directory for EBOOT dumping, aborting."); return; } } FILE *decryptedEbootFile = File::OpenCFile(fullPath, "wb"); if (!decryptedEbootFile) { - ERROR_LOG(SCEMODULE, "Unable to write decrypted EBOOT."); + ERROR_LOG(Log::sceModule, "Unable to write decrypted EBOOT."); return; } @@ -924,7 +924,7 @@ static void SaveDecryptedEbootToStorageMedia(const u8 *decryptedEbootDataPtr, co fwrite(decryptedEbootDataPtr, sizeof(u8), lengthToWrite, decryptedEbootFile); fclose(decryptedEbootFile); - INFO_LOG(SCEMODULE, "Successfully wrote decrypted EBOOT to %s", fullPath.c_str()); + INFO_LOG(Log::sceModule, "Successfully wrote decrypted EBOOT to %s", fullPath.c_str()); } static bool IsHLEVersionedModule(const char *name) { @@ -998,7 +998,7 @@ static bool KernelImportModuleFuncs(PSPModule *module, u32 *firstImportStubAddr, return false; } if (!Memory::IsValidRange(module->libstub, module->libstubend - module->libstub)) { - ERROR_LOG_REPORT(LOADER, "Garbage libstub address %08x or end %08x", module->libstub, module->libstubend); + ERROR_LOG_REPORT(Log::Loader, "Garbage libstub address %08x or end %08x", module->libstub, module->libstubend); return false; } @@ -1018,13 +1018,13 @@ static bool KernelImportModuleFuncs(PSPModule *module, u32 *firstImportStubAddr, needReport = true; } - DEBUG_LOG(LOADER, "Importing Module %s, stubs at %08x", modulename, entry->firstSymAddr); + DEBUG_LOG(Log::Loader, "Importing Module %s, stubs at %08x", modulename, entry->firstSymAddr); if (entry->size != 5 && entry->size != 6) { if (entry->size != 7) { - WARN_LOG_REPORT(LOADER, "Unexpected module entry size %d", entry->size); + WARN_LOG_REPORT(Log::Loader, "Unexpected module entry size %d", entry->size); needReport = true; } else if (entry->extra != 0) { - WARN_LOG_REPORT(LOADER, "Unexpected module entry with non-zero 7th value %08x", entry->extra); + WARN_LOG_REPORT(Log::Loader, "Unexpected module entry with non-zero 7th value %08x", entry->extra); needReport = true; } } @@ -1036,7 +1036,7 @@ static bool KernelImportModuleFuncs(PSPModule *module, u32 *firstImportStubAddr, // If nidData is 0, only variables are being imported. if (entry->numFuncs > 0 && entry->nidData != 0) { if (!Memory::IsValidAddress(entry->nidData)) { - ERROR_LOG_REPORT(LOADER, "Crazy nidData address %08x, skipping entire module", entry->nidData); + ERROR_LOG_REPORT(Log::Loader, "Crazy nidData address %08x, skipping entire module", entry->nidData); needReport = true; continue; } @@ -1057,7 +1057,7 @@ static bool KernelImportModuleFuncs(PSPModule *module, u32 *firstImportStubAddr, if (firstImportStubAddr && (!*firstImportStubAddr || *firstImportStubAddr > (u32)entry->firstSymAddr)) *firstImportStubAddr = entry->firstSymAddr; } else if (entry->numFuncs > 0) { - WARN_LOG_REPORT(LOADER, "Module entry with %d imports but no valid address", entry->numFuncs); + WARN_LOG_REPORT(Log::Loader, "Module entry with %d imports but no valid address", entry->numFuncs); needReport = true; } @@ -1065,7 +1065,7 @@ static bool KernelImportModuleFuncs(PSPModule *module, u32 *firstImportStubAddr, // We only reimport funcs, which can't be double-offset. if (entry->numVars > 0 && entry->varData != 0 && !reimporting) { if (!Memory::IsValidAddress(entry->varData)) { - ERROR_LOG_REPORT(LOADER, "Crazy varData address %08x, skipping rest of module", entry->varData); + ERROR_LOG_REPORT(Log::Loader, "Crazy varData address %08x, skipping rest of module", entry->varData); needReport = true; continue; } @@ -1078,7 +1078,7 @@ static bool KernelImportModuleFuncs(PSPModule *module, u32 *firstImportStubAddr, u32 varRefsPtr = Memory::Read_U32(entry->varData + i * 8); u32 nid = Memory::Read_U32(entry->varData + i * 8 + 4); if (!Memory::IsValidAddress(varRefsPtr)) { - WARN_LOG_REPORT(LOADER, "Bad relocation list address for nid %08x in %s", nid, modulename); + WARN_LOG_REPORT(Log::Loader, "Bad relocation list address for nid %08x in %s", nid, modulename); continue; } @@ -1092,11 +1092,11 @@ static bool KernelImportModuleFuncs(PSPModule *module, u32 *firstImportStubAddr, } } } else if (entry->numVars > 0 && !reimporting) { - WARN_LOG_REPORT(LOADER, "Module entry with %d var imports but no valid address", entry->numVars); + WARN_LOG_REPORT(Log::Loader, "Module entry with %d var imports but no valid address", entry->numVars); needReport = true; } - DEBUG_LOG(LOADER, "-------------------------------------------------------------"); + DEBUG_LOG(Log::Loader, "-------------------------------------------------------------"); } if (needReport) { @@ -1159,7 +1159,7 @@ static void parsePrxLibInfo(const u8* ptr, u32 headerSize) { if (headerSize - start < lib_info_size) { // That's very wrong! - WARN_LOG(SCEMODULE, "~SCE module, header too small (0x%x bytes) to fit a lib info", headerSize); + WARN_LOG(Log::sceModule, "~SCE module, header too small (0x%x bytes) to fit a lib info", headerSize); return; } @@ -1172,7 +1172,7 @@ static void parsePrxLibInfo(const u8* ptr, u32 headerSize) { // Now that we have found the start, let's do one more check if (end - ptr < lib_info_size) { // That's very wrong! - WARN_LOG(SCEMODULE, "~SCE module, unexpected header (not an error)"); + WARN_LOG(Log::sceModule, "~SCE module, unexpected header (not an error)"); return; } @@ -1181,7 +1181,7 @@ static void parsePrxLibInfo(const u8* ptr, u32 headerSize) { auto lib_info_ptr = reinterpret_cast(ptr); if (*lib_info_ptr != lib_info_prefix) { // That's very wrong! - WARN_LOG(SCEMODULE, "~SCE module, unexpected header (not an error)"); + WARN_LOG(Log::sceModule, "~SCE module, unexpected header (not an error)"); return; } ptr += sizeof(lib_info_prefix); @@ -1203,7 +1203,7 @@ static void parsePrxLibInfo(const u8* ptr, u32 headerSize) { } } - INFO_LOG(SCEMODULE, "~SCE module: Lib-PSP %s (SDK %s)", nameBuffer, versionBuffer); + INFO_LOG(Log::sceModule, "~SCE module: Lib-PSP %s (SDK %s)", nameBuffer, versionBuffer); } static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 loadAddress, bool fromTop, std::string *error_string, u32 *magic, u32 &error) { @@ -1232,18 +1232,18 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load magicPtr = (u32_le *)ptr; } else { - ERROR_LOG(SCEMODULE, "~SCE module: bad data"); + ERROR_LOG(Log::sceModule, "~SCE module: bad data"); } } *magic = *magicPtr; if (*magic == 0x5053507e && elfSize > sizeof(PSP_Header)) { // "~PSP" - DEBUG_LOG(SCEMODULE, "Decrypting ~PSP file"); + DEBUG_LOG(Log::sceModule, "Decrypting ~PSP file"); PSP_Header *head = (PSP_Header*)ptr; devkitVersion = head->devkitversion; if (IsHLEVersionedModule(head->modname)) { int ver = (head->module_ver_hi << 8) | head->module_ver_lo; - INFO_LOG(SCEMODULE, "Loading module %s with version %04x, devkit %08x, crc %x", head->modname, ver, head->devkitversion, module->crc); + INFO_LOG(Log::sceModule, "Loading module %s with version %04x, devkit %08x, crc %x", head->modname, ver, head->devkitversion, module->crc); reportedModule = true; if (!strcmp(head->modname, "sceMpeg_library")) { @@ -1314,7 +1314,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load return module; } else if (ret <= 0) { - ERROR_LOG(SCEMODULE, "Failed decrypting PRX! That's not normal! ret = %i\n", ret); + ERROR_LOG(Log::sceModule, "Failed decrypting PRX! That's not normal! ret = %i\n", ret); Reporting::ReportMessage("Failed decrypting the PRX (ret = %i, size = %i, psp_size = %i)!", ret, head->elf_size, head->psp_size); // Fall through to safe exit in the next check. } else { @@ -1342,7 +1342,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load // DO NOT change to else if, see above. if (*magicPtr != 0x464c457f) { - ERROR_LOG(SCEMODULE, "Wrong magic number %08x", *magicPtr); + ERROR_LOG(Log::sceModule, "Wrong magic number %08x", *magicPtr); *error_string = "File corrupt"; if (newptr) delete [] newptr; @@ -1357,7 +1357,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load int result = reader.LoadInto(loadAddress, fromTop); if (result != SCE_KERNEL_ERROR_OK) { - ERROR_LOG(SCEMODULE, "LoadInto failed with error %08x",result); + ERROR_LOG(Log::sceModule, "LoadInto failed with error %08x",result); if (newptr) delete [] newptr; module->Cleanup(); @@ -1382,7 +1382,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load if (!Memory::IsValidAddress(modinfoaddr)) { *error_string = StringFromFormat("Bad module info address %08x", modinfoaddr); - ERROR_LOG(SCEMODULE, "Bad module info address %08x", modinfoaddr); + ERROR_LOG(Log::sceModule, "Bad module info address %08x", modinfoaddr); if (newptr) delete[] newptr; module->Cleanup(); @@ -1449,8 +1449,8 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load module->libstub = modinfo->libstub; module->libstubend = modinfo->libstubend; - INFO_LOG(LOADER, "Module %s: %08x %08x %08x", modinfo->name, modinfo->gp, modinfo->libent, modinfo->libstub); - DEBUG_LOG(LOADER,"==================================================="); + INFO_LOG(Log::Loader, "Module %s: %08x %08x %08x", modinfo->name, modinfo->gp, modinfo->libent, modinfo->libstub); + DEBUG_LOG(Log::Loader,"==================================================="); u32 firstImportStubAddr = 0; KernelImportModuleFuncs(module, &firstImportStubAddr); @@ -1481,7 +1481,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load continue; } if (!Memory::IsValidRange(start, len)) { - ERROR_LOG(LOADER, "Bad section %08x (len %08x) of section %d", start, len, id); + ERROR_LOG(Log::Loader, "Bad section %08x (len %08x) of section %d", start, len, id); continue; } @@ -1512,7 +1512,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load } insertSymbols = MIPSAnalyst::ScanForFunctions(scanStart, scanEnd, insertSymbols); } else { - ERROR_LOG(LOADER, "Bad text scan range %08x-%08x", scanStart, scanEnd); + ERROR_LOG(Log::Loader, "Bad text scan range %08x-%08x", scanStart, scanEnd); } } @@ -1549,7 +1549,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load const PspLibEntEntry *ent = (const PspLibEntEntry *)entPos; entPos += ent->size; if (ent->size == 0) { - WARN_LOG_REPORT(LOADER, "Invalid export entry size %d", ent->size); + WARN_LOG_REPORT(Log::Loader, "Invalid export entry size %d", ent->size); entPos += 4; continue; } @@ -1564,11 +1564,11 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load name = "invalid?"; } - INFO_LOG(LOADER, "Exporting ent %d named %s, %d funcs, %d vars, resident %08x", m, name, ent->fcount, ent->vcount, ent->resident); + INFO_LOG(Log::Loader, "Exporting ent %d named %s, %d funcs, %d vars, resident %08x", m, name, ent->fcount, ent->vcount, ent->resident); if (!Memory::IsValidAddress(ent->resident)) { if (ent->fcount + variableCount > 0) { - WARN_LOG_REPORT(LOADER, "Invalid export resident address %08x", ent->resident); + WARN_LOG_REPORT(Log::Loader, "Invalid export resident address %08x", ent->resident); } continue; } @@ -1577,7 +1577,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load u32_le *exportPtr = residentPtr + ent->fcount + variableCount; if (ent->size != 4 && ent->unknown1 != 0 && ent->unknown2 != 0) { - WARN_LOG_REPORT(LOADER, "Unexpected export module entry size %d, vcountNew=%08x, unknown1=%08x, unknown2=%08x", ent->size, ent->vcountNew, ent->unknown1, ent->unknown2); + WARN_LOG_REPORT(Log::Loader, "Unexpected export module entry size %d, vcountNew=%08x, unknown1=%08x, unknown2=%08x", ent->size, ent->vcountNew, ent->unknown1, ent->unknown2); } FuncSymbolExport func; @@ -1608,7 +1608,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load func.nid = nid; func.symAddr = exportAddr; if (ent->name == 0) { - WARN_LOG_REPORT(HLE, "Exporting func from syslib export: %08x", nid); + WARN_LOG_REPORT(Log::HLE, "Exporting func from syslib export: %08x", nid); } module->ExportFunc(func); } @@ -1632,7 +1632,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load if (size == 0) break; else if (size != 3) - WARN_LOG_REPORT(LOADER, "Strange value at module_start_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); + WARN_LOG_REPORT(Log::Loader, "Strange value at module_start_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); module->nm.module_start_thread_priority = Memory::Read_U32(exportAddr + 4); module->nm.module_start_thread_stacksize = Memory::Read_U32(exportAddr + 8); module->nm.module_start_thread_attr = Memory::Read_U32(exportAddr + 12); @@ -1642,7 +1642,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load if (size == 0) break; else if (size != 3) - WARN_LOG_REPORT(LOADER, "Strange value at module_stop_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); + WARN_LOG_REPORT(Log::Loader, "Strange value at module_stop_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); module->nm.module_stop_thread_priority = Memory::Read_U32(exportAddr + 4); module->nm.module_stop_thread_stacksize = Memory::Read_U32(exportAddr + 8); module->nm.module_stop_thread_attr = Memory::Read_U32(exportAddr + 12); @@ -1652,20 +1652,20 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load if (size == 0) break; else if (size != 3) - WARN_LOG_REPORT(LOADER, "Strange value at module_reboot_before_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); + WARN_LOG_REPORT(Log::Loader, "Strange value at module_reboot_before_thread_parameter export: %08x", Memory::Read_U32(exportAddr)); module->nm.module_reboot_before_thread_priority = Memory::Read_U32(exportAddr + 4); module->nm.module_reboot_before_thread_stacksize = Memory::Read_U32(exportAddr + 8); module->nm.module_reboot_before_thread_attr = Memory::Read_U32(exportAddr + 12); break; case NID_MODULE_SDK_VERSION: - DEBUG_LOG(LOADER, "Module SDK: %08x", Memory::Read_U32(exportAddr)); + DEBUG_LOG(Log::Loader, "Module SDK: %08x", Memory::Read_U32(exportAddr)); devkitVersion = Memory::Read_U32(exportAddr); break; default: var.nid = nid; var.symAddr = exportAddr; if (ent->name == 0) { - WARN_LOG_REPORT(HLE, "Exporting var from syslib export: %08x", nid); + WARN_LOG_REPORT(Log::HLE, "Exporting var from syslib export: %08x", nid); } module->ExportVar(var); break; @@ -1690,7 +1690,7 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load delete [] newptr; if (!reportedModule && IsHLEVersionedModule(modinfo->name)) { - INFO_LOG(SCEMODULE, "Loading module %s with version %04x, devkit %08x", modinfo->name, modinfo->moduleVersion, devkitVersion); + INFO_LOG(Log::sceModule, "Loading module %s with version %04x, devkit %08x", modinfo->name, modinfo->moduleVersion, devkitVersion); if (!strcmp(modinfo->name, "sceMpeg_library")) { __MpegLoadModule(modinfo->moduleVersion, module->crc); @@ -1768,7 +1768,7 @@ static PSPModule *__KernelLoadModule(u8 *fileptr, size_t fileSize, SceKernelLMOp temp = new u8[elfSize]; memcpy(temp, fileptr + offsets[5], elfSize); - INFO_LOG(LOADER, "PBP: ELF unaligned (%d: %d), aligning!", offsets[5], offsets[5] & 3); + INFO_LOG(Log::Loader, "PBP: ELF unaligned (%d: %d), aligning!", offsets[5], offsets[5] & 3); } u32 error; @@ -1794,7 +1794,7 @@ static void __KernelStartModule(PSPModule *m, int args, const char *argp, SceKer if (m->nm.module_start_func != 0 && m->nm.module_start_func != (u32)-1) { if (m->nm.module_start_func != m->nm.entry_addr) - WARN_LOG_REPORT(LOADER, "Main module has start func (%08x) different from entry (%08x)?", m->nm.module_start_func, m->nm.entry_addr); + WARN_LOG_REPORT(Log::Loader, "Main module has start func (%08x) different from entry (%08x)?", m->nm.module_start_func, m->nm.entry_addr); // TODO: Should we try to run both? currentMIPS->pc = m->nm.module_start_func; } @@ -1840,7 +1840,7 @@ void __KernelLoadReset() { module->Cleanup(); } else { // An invalid module. We need to remove it or we'll loop forever. - WARN_LOG(LOADER, "Invalid module still marked as loaded on loadexec"); + WARN_LOG(Log::Loader, "Invalid module still marked as loaded on loadexec"); loadedModules.erase(moduleID); } } @@ -1886,7 +1886,7 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str std::vector fileData; if (pspFileSystem.ReadEntireFile(filename, fileData) < 0) { - ERROR_LOG(LOADER, "Failed to load executable %s - file doesn't exist", filename); + ERROR_LOG(Log::Loader, "Failed to load executable %s - file doesn't exist", filename); *error_string = StringFromFormat("Could not find executable %s", filename); delete[] param_argp; delete[] param_key; @@ -1903,7 +1903,7 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str module->Cleanup(); kernelObjects.Destroy(module->GetUID()); } - ERROR_LOG(LOADER, "Failed to load module %s", filename); + ERROR_LOG(Log::Loader, "Failed to load module %s", filename); *error_string = "Failed to load executable: " + *error_string; delete[] param_argp; delete[] param_key; @@ -1917,7 +1917,7 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str mipsr4k.pc = module->nm.entry_addr; - INFO_LOG(LOADER, "Module entry: %08x (%s %04x)", mipsr4k.pc, moduleName, moduleVersion); + INFO_LOG(Log::Loader, "Module entry: %08x (%s %04x)", mipsr4k.pc, moduleName, moduleVersion); SceKernelSMOption option; option.size = sizeof(SceKernelSMOption); @@ -1997,7 +1997,7 @@ void __KernelGPUReplay() { // Special ABI: s0 and s1 are the "args". Not null terminated. const char *filenamep = Memory::GetCharPointer(currentMIPS->r[MIPS_REG_S1]); if (!filenamep) { - ERROR_LOG(G3D, "Failed to load dump filename"); + ERROR_LOG(Log::G3D, "Failed to load dump filename"); Core_Stop(); return; } @@ -2033,20 +2033,20 @@ int sceKernelLoadExec(const char *filename, u32 paramPtr) } if (!info.exists) { - ERROR_LOG(LOADER, "sceKernelLoadExec(%s, ...): File does not exist", filename); + ERROR_LOG(Log::Loader, "sceKernelLoadExec(%s, ...): File does not exist", filename); return SCE_KERNEL_ERROR_NOFILE; } s64 size = (s64)info.size; if (!size) { - ERROR_LOG(LOADER, "sceKernelLoadExec(%s, ...): File is size 0", filename); + ERROR_LOG(Log::Loader, "sceKernelLoadExec(%s, ...): File is size 0", filename); return SCE_KERNEL_ERROR_ILLEGAL_OBJECT; } - DEBUG_LOG(SCEMODULE, "sceKernelLoadExec(name=%s,...): loading %s", filename, exec_filename.c_str()); + DEBUG_LOG(Log::sceModule, "sceKernelLoadExec(name=%s,...): loading %s", filename, exec_filename.c_str()); std::string error_string; if (!__KernelLoadExec(exec_filename.c_str(), paramPtr, &error_string)) { - ERROR_LOG(SCEMODULE, "sceKernelLoadExec failed: %s", error_string.c_str()); + ERROR_LOG(Log::sceModule, "sceKernelLoadExec failed: %s", error_string.c_str()); Core_UpdateState(CORE_RUNTIME_ERROR); return -1; } @@ -2058,7 +2058,7 @@ int sceKernelLoadExec(const char *filename, u32 paramPtr) u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr) { if (!name) { - return hleLogError(LOADER, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "bad filename"); + return hleLogError(Log::Loader, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "bad filename"); } for (size_t i = 0; i < ARRAY_SIZE(lieAboutSuccessModules); i++) { @@ -2084,42 +2084,42 @@ u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr) { // TODO: It would be more ideal to allocate memory for this module. - return hleLogSuccessInfoI(LOADER, module->GetUID(), "created fake module"); + return hleLogSuccessInfoI(Log::Loader, module->GetUID(), "created fake module"); } } std::vector fileData; if (pspFileSystem.ReadEntireFile(name, fileData) < 0) { - const u32 error = hleLogError(LOADER, SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "file does not exist"); + const u32 error = hleLogError(Log::Loader, SCE_KERNEL_ERROR_ERRNO_FILE_NOT_FOUND, "file does not exist"); return hleDelayResult(error, "module loaded", 500); } if (fileData.empty()) { - const u32 error = hleLogError(LOADER, SCE_KERNEL_ERROR_FILEERR, "module file size is 0"); + const u32 error = hleLogError(Log::Loader, SCE_KERNEL_ERROR_FILEERR, "module file size is 0"); return hleDelayResult(error, "module loaded", 500); } // We log before hand because ELF loading logs a bunch. - DEBUG_LOG(LOADER, "sceKernelLoadModule(%s, %08x)", name, flags); + DEBUG_LOG(Log::Loader, "sceKernelLoadModule(%s, %08x)", name, flags); if (flags != 0) { - WARN_LOG_REPORT(LOADER, "sceKernelLoadModule: unsupported flags: %08x", flags); + WARN_LOG_REPORT(Log::Loader, "sceKernelLoadModule: unsupported flags: %08x", flags); } SceKernelLMOption *lmoption = 0; if (optionAddr) { lmoption = (SceKernelLMOption *)Memory::GetPointer(optionAddr); if (lmoption->position < PSP_SMEM_Low || lmoption->position > PSP_SMEM_HighAligned) { - ERROR_LOG_REPORT(LOADER, "sceKernelLoadModule(%s): invalid position (%i)", name, (int)lmoption->position); + ERROR_LOG_REPORT(Log::Loader, "sceKernelLoadModule(%s): invalid position (%i)", name, (int)lmoption->position); return hleDelayResult(SCE_KERNEL_ERROR_ILLEGAL_MEMBLOCKTYPE, "module loaded", 500); } if (lmoption->position == PSP_SMEM_LowAligned || lmoption->position == PSP_SMEM_HighAligned) { - ERROR_LOG_REPORT(LOADER, "sceKernelLoadModule(%s): invalid position (aligned)", name); + ERROR_LOG_REPORT(Log::Loader, "sceKernelLoadModule(%s): invalid position (aligned)", name); return hleDelayResult(SCE_KERNEL_ERROR_ILLEGAL_ALIGNMENT_SIZE, "module loaded", 500); } if (lmoption->position == PSP_SMEM_Addr) { - ERROR_LOG_REPORT(LOADER, "sceKernelLoadModule(%s): invalid position (fixed)", name); + ERROR_LOG_REPORT(Log::Loader, "sceKernelLoadModule(%s): invalid position (fixed)", name); return hleDelayResult(SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED, "module loaded", 500); } - WARN_LOG_REPORT(LOADER, "sceKernelLoadModule: unsupported options size=%08x, flags=%08x, pos=%d, access=%d, data=%d, text=%d", lmoption->size, lmoption->flags, lmoption->position, lmoption->access, lmoption->mpiddata, lmoption->mpidtext); + WARN_LOG_REPORT(Log::Loader, "sceKernelLoadModule: unsupported options size=%08x, flags=%08x, pos=%d, access=%d, data=%d, text=%d", lmoption->size, lmoption->flags, lmoption->position, lmoption->access, lmoption->mpiddata, lmoption->mpidtext); } PSPModule *module = nullptr; @@ -2130,7 +2130,7 @@ u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr) { if (!module) { if (magic == 0x46535000) { - ERROR_LOG(LOADER, "Game tried to load an SFO as a module. Go figure? Magic = %08x", magic); + ERROR_LOG(Log::Loader, "Game tried to load an SFO as a module. Go figure? Magic = %08x", magic); // TODO: What's actually going on here? error = -1; return hleDelayResult(error, "module loaded", 500); @@ -2138,7 +2138,7 @@ u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr) { PSPFileInfo info = pspFileSystem.GetFileInfo(name); if (info.name == "BOOT.BIN") { - NOTICE_LOG_REPORT(LOADER, "Module %s is blacklisted or undecryptable - we try __KernelLoadExec", name); + NOTICE_LOG_REPORT(Log::Loader, "Module %s is blacklisted or undecryptable - we try __KernelLoadExec", name); // Name might get deleted. const std::string safeName = name; if (gpu) { @@ -2146,17 +2146,17 @@ u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr) { } return __KernelLoadExec(safeName.c_str(), 0, &error_string); } else { - hleLogError(LOADER, error, "failed to load"); + hleLogError(Log::Loader, error, "failed to load"); return hleDelayResult(error, "module loaded", 500); } } if (lmoption) { - INFO_LOG(SCEMODULE,"%i=sceKernelLoadModule(name=%s,flag=%08x,%08x,%08x,%08x,position = %08x)", + INFO_LOG(Log::sceModule,"%i=sceKernelLoadModule(name=%s,flag=%08x,%08x,%08x,%08x,position = %08x)", module->GetUID(),name,flags, lmoption->size,lmoption->mpidtext,lmoption->mpiddata,lmoption->position); } else { - INFO_LOG(SCEMODULE,"%i=sceKernelLoadModule(name=%s,flag=%08x,(...))", module->GetUID(), name, flags); + INFO_LOG(Log::sceModule,"%i=sceKernelLoadModule(name=%s,flag=%08x,(...))", module->GetUID(), name, flags); } // TODO: This is not the right timing and probably not the right wait type, just an approximation. @@ -2165,7 +2165,7 @@ u32 sceKernelLoadModule(const char *name, u32 flags, u32 optionAddr) { static u32 sceKernelLoadModuleNpDrm(const char *name, u32 flags, u32 optionAddr) { - DEBUG_LOG(LOADER, "sceKernelLoadModuleNpDrm(%s, %08x)", name, flags); + DEBUG_LOG(Log::Loader, "sceKernelLoadModuleNpDrm(%s, %08x)", name, flags); return sceKernelLoadModule(name, flags, optionAddr); } @@ -2215,10 +2215,10 @@ int KernelStartModule(SceUID moduleId, u32 argsize, u32 argAddr, u32 returnValue *needsWait = true; } } else if (entryAddr == 0 || entryAddr == (u32)-1) { - INFO_LOG(SCEMODULE, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x): no entry address", moduleId, argsize, argAddr, returnValueAddr); + INFO_LOG(Log::sceModule, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x): no entry address", moduleId, argsize, argAddr, returnValueAddr); module->nm.status = MODULE_STATUS_STARTED; } else { - ERROR_LOG(SCEMODULE, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x): invalid entry address", moduleId, argsize, argAddr, returnValueAddr); + ERROR_LOG(Log::sceModule, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x): invalid entry address", moduleId, argsize, argAddr, returnValueAddr); return -1; } @@ -2230,25 +2230,25 @@ static void sceKernelStartModule(u32 moduleId, u32 argsize, u32 argAddr, u32 ret u32 error; PSPModule *module = kernelObjects.Get(moduleId, error); if (!module) { - INFO_LOG(SCEMODULE, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x): error %08x", moduleId, argsize, argAddr, returnValueAddr, optionAddr, error); + INFO_LOG(Log::sceModule, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x): error %08x", moduleId, argsize, argAddr, returnValueAddr, optionAddr, error); RETURN(error); return; } else if (module->isFake) { - INFO_LOG(SCEMODULE, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x): faked (undecryptable module)", + INFO_LOG(Log::sceModule, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x): faked (undecryptable module)", moduleId,argsize,argAddr,returnValueAddr,optionAddr); if (returnValueAddr) Memory::Write_U32(0, returnValueAddr); RETURN(moduleId); return; } else if (module->nm.status == MODULE_STATUS_STARTED) { - ERROR_LOG(SCEMODULE, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x) : already started", + ERROR_LOG(Log::sceModule, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x) : already started", moduleId,argsize,argAddr,returnValueAddr,optionAddr); // TODO: Maybe should be SCE_KERNEL_ERROR_ALREADY_STARTED, but I get SCE_KERNEL_ERROR_ERROR. // But I also get crashes... RETURN(SCE_KERNEL_ERROR_ERROR); return; } else { - INFO_LOG(SCEMODULE, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x)", + INFO_LOG(Log::sceModule, "sceKernelStartModule(%d,asize=%08x,aptr=%08x,retptr=%08x,%08x)", moduleId,argsize,argAddr,returnValueAddr,optionAddr); bool needsWait; @@ -2279,20 +2279,20 @@ static u32 sceKernelStopModule(u32 moduleId, u32 argSize, u32 argAddr, u32 retur PSPModule *module = kernelObjects.Get(moduleId, error); if (!module) { - ERROR_LOG(SCEMODULE, "sceKernelStopModule(%08x, %08x, %08x, %08x, %08x): invalid module id", moduleId, argSize, argAddr, returnValueAddr, optionAddr); + ERROR_LOG(Log::sceModule, "sceKernelStopModule(%08x, %08x, %08x, %08x, %08x): invalid module id", moduleId, argSize, argAddr, returnValueAddr, optionAddr); return error; } if (module->isFake) { - INFO_LOG(SCEMODULE, "sceKernelStopModule(%08x, %08x, %08x, %08x, %08x) - faking", moduleId, argSize, argAddr, returnValueAddr, optionAddr); + INFO_LOG(Log::sceModule, "sceKernelStopModule(%08x, %08x, %08x, %08x, %08x) - faking", moduleId, argSize, argAddr, returnValueAddr, optionAddr); if (returnValueAddr) Memory::Write_U32(0, returnValueAddr); return 0; } if (module->nm.status != MODULE_STATUS_STARTED) { - ERROR_LOG(SCEMODULE, "sceKernelStopModule(%08x, %08x, %08x, %08x, %08x): already stopped", moduleId, argSize, argAddr, returnValueAddr, optionAddr); + ERROR_LOG(Log::sceModule, "sceKernelStopModule(%08x, %08x, %08x, %08x, %08x): already stopped", moduleId, argSize, argAddr, returnValueAddr, optionAddr); return SCE_KERNEL_ERROR_ALREADY_STOPPED; } @@ -2317,7 +2317,7 @@ static u32 sceKernelStopModule(u32 moduleId, u32 argSize, u32 argAddr, u32 retur attr = options->attribute; // TODO: Maybe based on size? else if (attr != 0) - WARN_LOG_REPORT(SCEMODULE, "Stopping module with attr=%x, but options specify 0", attr); + WARN_LOG_REPORT(Log::sceModule, "Stopping module with attr=%x, but options specify 0", attr); } if (Memory::IsValidAddress(stopFunc)) @@ -2333,12 +2333,12 @@ static u32 sceKernelStopModule(u32 moduleId, u32 argSize, u32 argAddr, u32 retur } else if (stopFunc == 0) { - INFO_LOG(SCEMODULE, "sceKernelStopModule(%08x, %08x, %08x, %08x, %08x): no stop func, skipping", moduleId, argSize, argAddr, returnValueAddr, optionAddr); + INFO_LOG(Log::sceModule, "sceKernelStopModule(%08x, %08x, %08x, %08x, %08x): no stop func, skipping", moduleId, argSize, argAddr, returnValueAddr, optionAddr); module->nm.status = MODULE_STATUS_STOPPED; } else { - ERROR_LOG_REPORT(SCEMODULE, "sceKernelStopModule(%08x, %08x, %08x, %08x, %08x): bad stop func address", moduleId, argSize, argAddr, returnValueAddr, optionAddr); + ERROR_LOG_REPORT(Log::sceModule, "sceKernelStopModule(%08x, %08x, %08x, %08x, %08x): bad stop func address", moduleId, argSize, argAddr, returnValueAddr, optionAddr); module->nm.status = MODULE_STATUS_STOPPED; } @@ -2347,7 +2347,7 @@ static u32 sceKernelStopModule(u32 moduleId, u32 argSize, u32 argAddr, u32 retur static u32 sceKernelUnloadModule(u32 moduleId) { - INFO_LOG(SCEMODULE,"sceKernelUnloadModule(%i)", moduleId); + INFO_LOG(Log::sceModule,"sceKernelUnloadModule(%i)", moduleId); u32 error; PSPModule *module = kernelObjects.Get(moduleId, error); if (!module) @@ -2361,9 +2361,9 @@ static u32 sceKernelUnloadModule(u32 moduleId) u32 hleKernelStopUnloadSelfModuleWithOrWithoutStatus(u32 exitCode, u32 argSize, u32 argp, u32 statusAddr, u32 optionAddr, bool WithStatus) { if (loadedModules.size() > 1) { if (WithStatus) - ERROR_LOG_REPORT(SCEMODULE, "UNIMPL sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): game may have crashed", exitCode, argSize, argp, statusAddr, optionAddr); + ERROR_LOG_REPORT(Log::sceModule, "UNIMPL sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): game may have crashed", exitCode, argSize, argp, statusAddr, optionAddr); else - ERROR_LOG_REPORT(SCEMODULE, "UNIMPL sceKernelSelfStopUnloadModule(%08x, %08x, %08x): game may have crashed", exitCode, argSize, argp); + ERROR_LOG_REPORT(Log::sceModule, "UNIMPL sceKernelSelfStopUnloadModule(%08x, %08x, %08x): game may have crashed", exitCode, argSize, argp); SceUID moduleID = __KernelGetCurThreadModuleId(); u32 priority = 0x20; u32 stacksize = 0x40000; @@ -2374,9 +2374,9 @@ u32 hleKernelStopUnloadSelfModuleWithOrWithoutStatus(u32 exitCode, u32 argSize, PSPModule *module = kernelObjects.Get(moduleID, error); if (!module) { if (WithStatus) - ERROR_LOG(SCEMODULE, "sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): invalid module id", exitCode, argSize, argp, statusAddr, optionAddr); + ERROR_LOG(Log::sceModule, "sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): invalid module id", exitCode, argSize, argp, statusAddr, optionAddr); else - ERROR_LOG(SCEMODULE, "sceKernelSelfStopUnloadModule(%08x, %08x, %08x): invalid module id", exitCode, argSize, argp); + ERROR_LOG(Log::sceModule, "sceKernelSelfStopUnloadModule(%08x, %08x, %08x): invalid module id", exitCode, argSize, argp); return error; } @@ -2401,7 +2401,7 @@ u32 hleKernelStopUnloadSelfModuleWithOrWithoutStatus(u32 exitCode, u32 argSize, attr = options->attribute; // TODO: Maybe based on size? else if (attr != 0) - WARN_LOG_REPORT(SCEMODULE, "Stopping module with attr=%x, but options specify 0", attr); + WARN_LOG_REPORT(Log::sceModule, "Stopping module with attr=%x, but options specify 0", attr); } if (Memory::IsValidAddress(stopFunc)) { @@ -2415,26 +2415,26 @@ u32 hleKernelStopUnloadSelfModuleWithOrWithoutStatus(u32 exitCode, u32 argSize, module->waitingThreads.push_back(mwt); } else if (stopFunc == 0) { if (WithStatus) - INFO_LOG(SCEMODULE, "sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): no stop func", exitCode, argSize, argp, statusAddr, optionAddr); + INFO_LOG(Log::sceModule, "sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): no stop func", exitCode, argSize, argp, statusAddr, optionAddr); else - INFO_LOG(SCEMODULE, "sceKernelSelfStopUnloadModule(%08x, %08x, %08x): no stop func", exitCode, argSize, argp); + INFO_LOG(Log::sceModule, "sceKernelSelfStopUnloadModule(%08x, %08x, %08x): no stop func", exitCode, argSize, argp); sceKernelExitDeleteThread(exitCode); module->Cleanup(); kernelObjects.Destroy(moduleID); } else { if (WithStatus) - ERROR_LOG_REPORT(SCEMODULE, "sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): bad stop func address", exitCode, argSize, argp, statusAddr, optionAddr); + ERROR_LOG_REPORT(Log::sceModule, "sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): bad stop func address", exitCode, argSize, argp, statusAddr, optionAddr); else - ERROR_LOG_REPORT(SCEMODULE, "sceKernelSelfStopUnloadModule(%08x, %08x, %08x): bad stop func address", exitCode, argSize, argp); + ERROR_LOG_REPORT(Log::sceModule, "sceKernelSelfStopUnloadModule(%08x, %08x, %08x): bad stop func address", exitCode, argSize, argp); sceKernelExitDeleteThread(exitCode); module->Cleanup(); kernelObjects.Destroy(moduleID); } } else { if (WithStatus) - ERROR_LOG_REPORT(SCEMODULE, "UNIMPL sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): game has likely crashed", exitCode, argSize, argp, statusAddr, optionAddr); + ERROR_LOG_REPORT(Log::sceModule, "UNIMPL sceKernelStopUnloadSelfModuleWithStatus(%08x, %08x, %08x, %08x, %08x): game has likely crashed", exitCode, argSize, argp, statusAddr, optionAddr); else - ERROR_LOG_REPORT(SCEMODULE, "UNIMPL sceKernelSelfStopUnloadModule(%08x, %08x, %08x): game has likely crashed", exitCode, argSize, argp); + ERROR_LOG_REPORT(Log::sceModule, "UNIMPL sceKernelSelfStopUnloadModule(%08x, %08x, %08x): game has likely crashed", exitCode, argSize, argp); } return 0; @@ -2466,7 +2466,7 @@ void __KernelReturnFromModuleFunc() u32 error; PSPModule *module = kernelObjects.Get(leftModuleID, error); if (!module) { - ERROR_LOG_REPORT(SCEMODULE, "Returned from deleted module start/stop func"); + ERROR_LOG_REPORT(Log::sceModule, "Returned from deleted module start/stop func"); return; } @@ -2521,15 +2521,15 @@ static u32 sceKernelGetModuleIdByAddress(u32 moduleAddr) kernelObjects.Iterate(&__GetModuleIdByAddressIterator, &state); if (state.result == (SceUID)SCE_KERNEL_ERROR_UNKNOWN_MODULE) - ERROR_LOG(SCEMODULE, "sceKernelGetModuleIdByAddress(%08x): module not found", moduleAddr); + ERROR_LOG(Log::sceModule, "sceKernelGetModuleIdByAddress(%08x): module not found", moduleAddr); else - DEBUG_LOG(SCEMODULE, "%x=sceKernelGetModuleIdByAddress(%08x)", state.result, moduleAddr); + DEBUG_LOG(Log::sceModule, "%x=sceKernelGetModuleIdByAddress(%08x)", state.result, moduleAddr); return state.result; } static u32 sceKernelGetModuleId() { - INFO_LOG(SCEMODULE,"sceKernelGetModuleId()"); + INFO_LOG(Log::sceModule,"sceKernelGetModuleId()"); return __KernelGetCurThreadModuleId(); } @@ -2538,10 +2538,10 @@ u32 sceKernelFindModuleByUID(u32 uid) u32 error; PSPModule *module = kernelObjects.Get(uid, error); if (!module || module->isFake) { - ERROR_LOG(SCEMODULE, "0 = sceKernelFindModuleByUID(%d): Module Not Found or Fake", uid); + ERROR_LOG(Log::sceModule, "0 = sceKernelFindModuleByUID(%d): Module Not Found or Fake", uid); return 0; } - INFO_LOG(SCEMODULE, "%d = sceKernelFindModuleByUID(%d)", module->modulePtr.ptr, uid); + INFO_LOG(Log::sceModule, "%d = sceKernelFindModuleByUID(%d)", module->modulePtr.ptr, uid); return module->modulePtr.ptr; } @@ -2554,16 +2554,16 @@ u32 sceKernelFindModuleByName(const char *name) continue; if (strcmp(name, module->nm.name) == 0) { if (!module->isFake) { - INFO_LOG(SCEMODULE, "%d = sceKernelFindModuleByName(%s)", module->modulePtr.ptr, name); + INFO_LOG(Log::sceModule, "%d = sceKernelFindModuleByName(%s)", module->modulePtr.ptr, name); return module->modulePtr.ptr; } else { - WARN_LOG(SCEMODULE, "0 = sceKernelFindModuleByName(%s): Module Fake", name); + WARN_LOG(Log::sceModule, "0 = sceKernelFindModuleByName(%s): Module Fake", name); return hleDelayResult(0, "Module Fake", 1000 * 1000); } } } - WARN_LOG(SCEMODULE, "0 = sceKernelFindModuleByName(%s): Module Not Found", name); + WARN_LOG(Log::sceModule, "0 = sceKernelFindModuleByName(%s): Module Not Found", name); return 0; } @@ -2572,16 +2572,16 @@ static u32 sceKernelLoadModuleByID(u32 id, u32 flags, u32 lmoptionPtr) u32 error; u32 handle = __IoGetFileHandleFromId(id, error); if (handle == (u32)-1) { - ERROR_LOG(SCEMODULE,"sceKernelLoadModuleByID(%08x, %08x, %08x): could not open file id",id,flags,lmoptionPtr); + ERROR_LOG(Log::sceModule,"sceKernelLoadModuleByID(%08x, %08x, %08x): could not open file id",id,flags,lmoptionPtr); return error; } if (flags != 0) { - WARN_LOG_REPORT(LOADER, "sceKernelLoadModuleByID: unsupported flags: %08x", flags); + WARN_LOG_REPORT(Log::Loader, "sceKernelLoadModuleByID: unsupported flags: %08x", flags); } SceKernelLMOption *lmoption = 0; if (lmoptionPtr) { lmoption = (SceKernelLMOption *)Memory::GetPointer(lmoptionPtr); - WARN_LOG_REPORT(LOADER, "sceKernelLoadModuleByID: unsupported options size=%08x, flags=%08x, pos=%d, access=%d, data=%d, text=%d", lmoption->size, lmoption->flags, lmoption->position, lmoption->access, lmoption->mpiddata, lmoption->mpidtext); + WARN_LOG_REPORT(Log::Loader, "sceKernelLoadModuleByID: unsupported options size=%08x, flags=%08x, pos=%d, access=%d, data=%d, text=%d", lmoption->size, lmoption->flags, lmoption->position, lmoption->access, lmoption->mpiddata, lmoption->mpidtext); } u32 pos = (u32) pspFileSystem.SeekFile(handle, 0, FILEMOVE_CURRENT); size_t size = pspFileSystem.SeekFile(handle, 0, FILEMOVE_END); @@ -2598,7 +2598,7 @@ static u32 sceKernelLoadModuleByID(u32 id, u32 flags, u32 lmoptionPtr) // Some games try to load strange stuff as PARAM.SFO as modules and expect it to fail. // This checks for the SFO magic number. if (magic == 0x46535000) { - ERROR_LOG(LOADER, "Game tried to load an SFO as a module. Go figure? Magic = %08x", magic); + ERROR_LOG(Log::Loader, "Game tried to load an SFO as a module. Go figure? Magic = %08x", magic); return error; } @@ -2606,22 +2606,22 @@ static u32 sceKernelLoadModuleByID(u32 id, u32 flags, u32 lmoptionPtr) { // Module was blacklisted or couldn't be decrypted, which means it's a kernel module we don't want to run.. // Let's just act as if it worked. - NOTICE_LOG(LOADER, "Module %d is blacklisted or undecryptable - we lie about success", id); + NOTICE_LOG(Log::Loader, "Module %d is blacklisted or undecryptable - we lie about success", id); return 1; } else { - NOTICE_LOG(LOADER, "Module %d failed to load: %08x", id, error); + NOTICE_LOG(Log::Loader, "Module %d failed to load: %08x", id, error); return error; } } if (lmoption) { - INFO_LOG(SCEMODULE,"%i=sceKernelLoadModuleByID(%d,flag=%08x,%08x,%08x,%08x,position = %08x)", + INFO_LOG(Log::sceModule,"%i=sceKernelLoadModuleByID(%d,flag=%08x,%08x,%08x,%08x,position = %08x)", module->GetUID(),id,flags, lmoption->size,lmoption->mpidtext,lmoption->mpiddata,lmoption->position); } else { - INFO_LOG(SCEMODULE,"%i=sceKernelLoadModuleByID(%d,flag=%08x,(...))", module->GetUID(), id, flags); + INFO_LOG(Log::sceModule,"%i=sceKernelLoadModuleByID(%d,flag=%08x,(...))", module->GetUID(), id, flags); } return module->GetUID(); @@ -2629,7 +2629,7 @@ static u32 sceKernelLoadModuleByID(u32 id, u32 flags, u32 lmoptionPtr) static u32 sceKernelLoadModuleDNAS(const char *name, u32 flags) { - ERROR_LOG_REPORT(SCEMODULE, "UNIMPL 0=sceKernelLoadModuleDNAS()"); + ERROR_LOG_REPORT(Log::sceModule, "UNIMPL 0=sceKernelLoadModuleDNAS()"); return 0; } @@ -2637,12 +2637,12 @@ static u32 sceKernelLoadModuleDNAS(const char *name, u32 flags) static SceUID sceKernelLoadModuleBufferUsbWlan(u32 size, u32 bufPtr, u32 flags, u32 lmoptionPtr) { if (flags != 0) { - WARN_LOG_REPORT(LOADER, "sceKernelLoadModuleBufferUsbWlan: unsupported flags: %08x", flags); + WARN_LOG_REPORT(Log::Loader, "sceKernelLoadModuleBufferUsbWlan: unsupported flags: %08x", flags); } SceKernelLMOption *lmoption = 0; if (lmoptionPtr) { lmoption = (SceKernelLMOption *)Memory::GetPointer(lmoptionPtr); - WARN_LOG_REPORT(LOADER, "sceKernelLoadModuleBufferUsbWlan: unsupported options size=%08x, flags=%08x, pos=%d, access=%d, data=%d, text=%d", lmoption->size, lmoption->flags, lmoption->position, lmoption->access, lmoption->mpiddata, lmoption->mpidtext); + WARN_LOG_REPORT(Log::Loader, "sceKernelLoadModuleBufferUsbWlan: unsupported options size=%08x, flags=%08x, pos=%d, access=%d, data=%d, text=%d", lmoption->size, lmoption->flags, lmoption->position, lmoption->access, lmoption->mpiddata, lmoption->mpidtext); } std::string error_string; PSPModule *module = nullptr; @@ -2654,7 +2654,7 @@ static SceUID sceKernelLoadModuleBufferUsbWlan(u32 size, u32 bufPtr, u32 flags, // Some games try to load strange stuff as PARAM.SFO as modules and expect it to fail. // This checks for the SFO magic number. if (magic == 0x46535000) { - ERROR_LOG(LOADER, "Game tried to load an SFO as a module. Go figure? Magic = %08x", magic); + ERROR_LOG(Log::Loader, "Game tried to load an SFO as a module. Go figure? Magic = %08x", magic); return error; } @@ -2662,22 +2662,22 @@ static SceUID sceKernelLoadModuleBufferUsbWlan(u32 size, u32 bufPtr, u32 flags, { // Module was blacklisted or couldn't be decrypted, which means it's a kernel module we don't want to run.. // Let's just act as if it worked. - NOTICE_LOG(LOADER, "Module is blacklisted or undecryptable - we lie about success"); + NOTICE_LOG(Log::Loader, "Module is blacklisted or undecryptable - we lie about success"); return 1; } else { - NOTICE_LOG(LOADER, "Module failed to load: %08x", error); + NOTICE_LOG(Log::Loader, "Module failed to load: %08x", error); return error; } } if (lmoption) { - INFO_LOG(SCEMODULE,"%i=sceKernelLoadModuleBufferUsbWlan(%x,%08x,flag=%08x,%08x,%08x,%08x,position = %08x)", + INFO_LOG(Log::sceModule,"%i=sceKernelLoadModuleBufferUsbWlan(%x,%08x,flag=%08x,%08x,%08x,%08x,position = %08x)", module->GetUID(),size,bufPtr,flags, lmoption->size,lmoption->mpidtext,lmoption->mpiddata,lmoption->position); } else { - INFO_LOG(SCEMODULE,"%i=sceKernelLoadModuleBufferUsbWlan(%x,%08x,flag=%08x,(...))", module->GetUID(), size,bufPtr, flags); + INFO_LOG(Log::sceModule,"%i=sceKernelLoadModuleBufferUsbWlan(%x,%08x,flag=%08x,(...))", module->GetUID(), size,bufPtr, flags); } return module->GetUID(); @@ -2685,13 +2685,13 @@ static SceUID sceKernelLoadModuleBufferUsbWlan(u32 size, u32 bufPtr, u32 flags, static u32 sceKernelQueryModuleInfo(u32 uid, u32 infoAddr) { - DEBUG_LOG(SCEMODULE, "sceKernelQueryModuleInfo(%i, %08x)", uid, infoAddr); + DEBUG_LOG(Log::sceModule, "sceKernelQueryModuleInfo(%i, %08x)", uid, infoAddr); u32 error; PSPModule *module = kernelObjects.Get(uid, error); if (!module) return error; if (!Memory::IsValidAddress(infoAddr)) { - ERROR_LOG(SCEMODULE, "sceKernelQueryModuleInfo(%i, %08x) - bad infoAddr", uid, infoAddr); + ERROR_LOG(Log::sceModule, "sceKernelQueryModuleInfo(%i, %08x) - bad infoAddr", uid, infoAddr); return -1; } @@ -2721,7 +2721,7 @@ static u32 sceKernelQueryModuleInfo(u32 uid, u32 infoAddr) static u32 sceKernelGetModuleIdList(u32 resultBuffer, u32 resultBufferSize, u32 idCountAddr) { - ERROR_LOG(SCEMODULE, "UNTESTED sceKernelGetModuleIdList(%08x, %i, %08x)", resultBuffer, resultBufferSize, idCountAddr); + ERROR_LOG(Log::sceModule, "UNTESTED sceKernelGetModuleIdList(%08x, %i, %08x)", resultBuffer, resultBufferSize, idCountAddr); int idCount = 0; u32 resultBufferOffset = 0; diff --git a/Core/HLE/sceKernelMsgPipe.cpp b/Core/HLE/sceKernelMsgPipe.cpp index 5292d90c10..63244b2a0b 100644 --- a/Core/HLE/sceKernelMsgPipe.cpp +++ b/Core/HLE/sceKernelMsgPipe.cpp @@ -385,7 +385,7 @@ static int __KernelSendMsgPipe(MsgPipe *m, u32 sendBufAddr, u32 sendSize, int wa { if (sendSize > (u32) m->nmp.bufSize) { - ERROR_LOG(SCEKERNEL, "__KernelSendMsgPipe(%d): size %d too large for buffer", uid, sendSize); + ERROR_LOG(Log::sceKernel, "__KernelSendMsgPipe(%d): size %d too large for buffer", uid, sendSize); return SCE_KERNEL_ERROR_ILLEGAL_SIZE; } @@ -486,7 +486,7 @@ static int __KernelReceiveMsgPipe(MsgPipe *m, u32 receiveBufAddr, u32 receiveSiz { if (receiveSize > (u32) m->nmp.bufSize) { - ERROR_LOG(SCEKERNEL, "__KernelReceiveMsgPipe(%d): size %d too large for buffer", uid, receiveSize); + ERROR_LOG(Log::sceKernel, "__KernelReceiveMsgPipe(%d): size %d too large for buffer", uid, receiveSize); return SCE_KERNEL_ERROR_ILLEGAL_SIZE; } @@ -541,12 +541,12 @@ static void __KernelMsgPipeBeginCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitBeginCallback(threadID, prevCallbackId, waitTimer, ko->sendWaitingThreads, ko->pausedSendWaits, timeoutPtr != 0); if (result == HLEKernel::WAIT_CB_SUCCESS) - DEBUG_LOG(SCEKERNEL, "sceKernelSendMsgPipeCB: Suspending wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelSendMsgPipeCB: Suspending wait for callback"); else if (result == HLEKernel::WAIT_CB_BAD_WAIT_DATA) - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelSendMsgPipeCB: wait not found to pause for callback"); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelSendMsgPipeCB: wait not found to pause for callback"); } else - WARN_LOG_REPORT(SCEKERNEL, "sceKernelSendMsgPipeCB: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelSendMsgPipeCB: beginning callback with bad wait id?"); break; case MSGPIPE_WAIT_VALUE_RECV: @@ -554,16 +554,16 @@ static void __KernelMsgPipeBeginCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitBeginCallback(threadID, prevCallbackId, waitTimer, ko->receiveWaitingThreads, ko->pausedReceiveWaits, timeoutPtr != 0); if (result == HLEKernel::WAIT_CB_SUCCESS) - DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMsgPipeCB: Suspending wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMsgPipeCB: Suspending wait for callback"); else if (result == HLEKernel::WAIT_CB_BAD_WAIT_DATA) - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelReceiveMsgPipeCB: wait not found to pause for callback"); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelReceiveMsgPipeCB: wait not found to pause for callback"); } else - WARN_LOG_REPORT(SCEKERNEL, "sceKernelReceiveMsgPipeCB: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelReceiveMsgPipeCB: beginning callback with bad wait id?"); break; default: - ERROR_LOG_REPORT(SCEKERNEL, "__KernelMsgPipeBeginCallback: Unexpected wait value"); + ERROR_LOG_REPORT(Log::sceKernel, "__KernelMsgPipeBeginCallback: Unexpected wait value"); } } @@ -617,7 +617,7 @@ static void __KernelMsgPipeEndCallback(SceUID threadID, SceUID prevCallbackId) { MsgPipe *ko = uid == 0 ? NULL : kernelObjects.Get(uid, error); if (ko == NULL) { - ERROR_LOG_REPORT(SCEKERNEL, "__KernelMsgPipeEndCallback: Invalid object"); + ERROR_LOG_REPORT(Log::sceKernel, "__KernelMsgPipeEndCallback: Invalid object"); return; } @@ -627,7 +627,7 @@ static void __KernelMsgPipeEndCallback(SceUID threadID, SceUID prevCallbackId) { MsgPipeWaitingThread dummy; auto result = HLEKernel::WaitEndCallback(threadID, prevCallbackId, waitTimer, __KernelCheckResumeMsgPipeSend, dummy, ko->sendWaitingThreads, ko->pausedSendWaits); if (result == HLEKernel::WAIT_CB_RESUMED_WAIT) { - DEBUG_LOG(SCEKERNEL, "sceKernelSendMsgPipeCB: Resuming wait from callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelSendMsgPipeCB: Resuming wait from callback"); } else if (result == HLEKernel::WAIT_CB_TIMED_OUT) { // It was re-added to the the waiting threads list, but it timed out. Let's remove it. ko->RemoveSendWaitingThread(threadID); @@ -640,7 +640,7 @@ static void __KernelMsgPipeEndCallback(SceUID threadID, SceUID prevCallbackId) { MsgPipeWaitingThread dummy; auto result = HLEKernel::WaitEndCallback(threadID, prevCallbackId, waitTimer, __KernelCheckResumeMsgPipeReceive, dummy, ko->receiveWaitingThreads, ko->pausedReceiveWaits); if (result == HLEKernel::WAIT_CB_RESUMED_WAIT) { - DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMsgPipeCB: Resuming wait from callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMsgPipeCB: Resuming wait from callback"); } else if (result == HLEKernel::WAIT_CB_TIMED_OUT) { // It was re-added to the the waiting threads list, but it timed out. Let's remove it. ko->RemoveReceiveWaitingThread(threadID); @@ -649,7 +649,7 @@ static void __KernelMsgPipeEndCallback(SceUID threadID, SceUID prevCallbackId) { break; default: - ERROR_LOG_REPORT(SCEKERNEL, "__KernelMsgPipeEndCallback: Unexpected wait value"); + ERROR_LOG_REPORT(Log::sceKernel, "__KernelMsgPipeEndCallback: Unexpected wait value"); } } @@ -672,16 +672,16 @@ void __KernelMsgPipeDoState(PointerWrap &p) int sceKernelCreateMsgPipe(const char *name, int partition, u32 attr, u32 size, u32 optionsPtr) { if (!name) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_NO_MEMORY, "invalid name"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_NO_MEMORY, "invalid name"); if (partition < 1 || partition > 9 || partition == 7) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition %d", partition); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "invalid partition %d", partition); BlockAllocator *allocator = BlockAllocatorFromID(partition); if (allocator == nullptr) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_PERM, "invalid partition %d", partition); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_PERM, "invalid partition %d", partition); if ((attr & ~SCE_KERNEL_MPA_KNOWN) >= 0x100) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter: %08x", attr); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter: %08x", attr); u32 memBlockPtr = 0; if (size != 0) { @@ -689,7 +689,7 @@ int sceKernelCreateMsgPipe(const char *name, int partition, u32 attr, u32 size, u32 allocSize = size; memBlockPtr = allocator->Alloc(allocSize, (attr & SCE_KERNEL_MPA_HIGHMEM) != 0, StringFromFormat("MsgPipe/%s", name).c_str()); if (memBlockPtr == (u32)-1) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_NO_MEMORY, "failed to allocate %i bytes for buffer", size); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_NO_MEMORY, "failed to allocate %i bytes for buffer", size); } MsgPipe *m = new MsgPipe(); @@ -706,13 +706,13 @@ int sceKernelCreateMsgPipe(const char *name, int partition, u32 attr, u32 size, m->buffer = memBlockPtr; - DEBUG_LOG(SCEKERNEL, "%d=sceKernelCreateMsgPipe(%s, part=%d, attr=%08x, size=%d, opt=%08x)", id, name, partition, attr, size, optionsPtr); + DEBUG_LOG(Log::sceKernel, "%d=sceKernelCreateMsgPipe(%s, part=%d, attr=%08x, size=%d, opt=%08x)", id, name, partition, attr, size, optionsPtr); if (optionsPtr != 0) { u32 optionsSize = Memory::Read_U32(optionsPtr); if (optionsSize > 4) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateMsgPipe(%s) unsupported options parameter, size = %d", name, optionsSize); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateMsgPipe(%s) unsupported options parameter, size = %d", name, optionsSize); } return id; @@ -726,7 +726,7 @@ int sceKernelDeleteMsgPipe(SceUID uid) MsgPipe *m = kernelObjects.Get(uid, error); if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelDeleteMsgPipe(%i) - ERROR %08x", uid, error); + ERROR_LOG(Log::sceKernel, "sceKernelDeleteMsgPipe(%i) - ERROR %08x", uid, error); return error; } @@ -739,7 +739,7 @@ int sceKernelDeleteMsgPipe(SceUID uid) for (size_t i = 0; i < m->receiveWaitingThreads.size(); i++) m->receiveWaitingThreads[i].Cancel(uid, SCE_KERNEL_ERROR_WAIT_DELETE); - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteMsgPipe(%i)", uid); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteMsgPipe(%i)", uid); return kernelObjects.Destroy(uid); } @@ -747,19 +747,19 @@ static int __KernelValidateSendMsgPipe(SceUID uid, u32 sendBufAddr, u32 sendSize { if (sendSize & 0x80000000) { - ERROR_LOG(SCEKERNEL, "__KernelSendMsgPipe(%d): illegal size %d", uid, sendSize); + ERROR_LOG(Log::sceKernel, "__KernelSendMsgPipe(%d): illegal size %d", uid, sendSize); return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } if (sendSize != 0 && !Memory::IsValidAddress(sendBufAddr)) { - ERROR_LOG(SCEKERNEL, "__KernelSendMsgPipe(%d): bad buffer address %08x (should crash?)", uid, sendBufAddr); + ERROR_LOG(Log::sceKernel, "__KernelSendMsgPipe(%d): bad buffer address %08x (should crash?)", uid, sendBufAddr); return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } if (waitMode != SCE_KERNEL_MPW_ASAP && waitMode != SCE_KERNEL_MPW_FULL) { - ERROR_LOG(SCEKERNEL, "__KernelSendMsgPipe(%d): invalid wait mode %d", uid, waitMode); + ERROR_LOG(Log::sceKernel, "__KernelSendMsgPipe(%d): invalid wait mode %d", uid, waitMode); return SCE_KERNEL_ERROR_ILLEGAL_MODE; } @@ -767,12 +767,12 @@ static int __KernelValidateSendMsgPipe(SceUID uid, u32 sendBufAddr, u32 sendSize { if (!__KernelIsDispatchEnabled()) { - WARN_LOG(SCEKERNEL, "__KernelSendMsgPipe(%d): dispatch disabled", uid); + WARN_LOG(Log::sceKernel, "__KernelSendMsgPipe(%d): dispatch disabled", uid); return SCE_KERNEL_ERROR_CAN_NOT_WAIT; } if (__IsInInterrupt()) { - WARN_LOG(SCEKERNEL, "__KernelSendMsgPipe(%d): in interrupt", uid); + WARN_LOG(Log::sceKernel, "__KernelSendMsgPipe(%d): in interrupt", uid); return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT; } } @@ -810,11 +810,11 @@ int sceKernelSendMsgPipe(SceUID uid, u32 sendBufAddr, u32 sendSize, u32 waitMode } MsgPipe *m = kernelObjects.Get(uid, error); if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelSendMsgPipe(%i) - ERROR %08x", uid, error); + ERROR_LOG(Log::sceKernel, "sceKernelSendMsgPipe(%i) - ERROR %08x", uid, error); return error; } - DEBUG_LOG(SCEKERNEL, "sceKernelSendMsgPipe(id=%i, addr=%08x, size=%i, mode=%i, result=%08x, timeout=%08x)", uid, sendBufAddr, sendSize, waitMode, resultAddr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelSendMsgPipe(id=%i, addr=%08x, size=%i, mode=%i, result=%08x, timeout=%08x)", uid, sendBufAddr, sendSize, waitMode, resultAddr, timeoutPtr); return __KernelSendMsgPipe(m, sendBufAddr, sendSize, waitMode, resultAddr, timeoutPtr, false, false); } @@ -826,11 +826,11 @@ int sceKernelSendMsgPipeCB(SceUID uid, u32 sendBufAddr, u32 sendSize, u32 waitMo } MsgPipe *m = kernelObjects.Get(uid, error); if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelSendMsgPipeCB(%i) - ERROR %08x", uid, error); + ERROR_LOG(Log::sceKernel, "sceKernelSendMsgPipeCB(%i) - ERROR %08x", uid, error); return error; } - DEBUG_LOG(SCEKERNEL, "sceKernelSendMsgPipeCB(id=%i, addr=%08x, size=%i, mode=%i, result=%08x, timeout=%08x)", uid, sendBufAddr, sendSize, waitMode, resultAddr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelSendMsgPipeCB(id=%i, addr=%08x, size=%i, mode=%i, result=%08x, timeout=%08x)", uid, sendBufAddr, sendSize, waitMode, resultAddr, timeoutPtr); // TODO: Verify callback behavior. hleCheckCurrentCallbacks(); return __KernelSendMsgPipe(m, sendBufAddr, sendSize, waitMode, resultAddr, timeoutPtr, true, false); @@ -844,11 +844,11 @@ int sceKernelTrySendMsgPipe(SceUID uid, u32 sendBufAddr, u32 sendSize, u32 waitM } MsgPipe *m = kernelObjects.Get(uid, error); if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelTrySendMsgPipe(%i) - ERROR %08x", uid, error); + ERROR_LOG(Log::sceKernel, "sceKernelTrySendMsgPipe(%i) - ERROR %08x", uid, error); return error; } - DEBUG_LOG(SCEKERNEL, "sceKernelTrySendMsgPipe(id=%i, addr=%08x, size=%i, mode=%i, result=%08x)", uid, sendBufAddr, sendSize, waitMode, resultAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelTrySendMsgPipe(id=%i, addr=%08x, size=%i, mode=%i, result=%08x)", uid, sendBufAddr, sendSize, waitMode, resultAddr); return __KernelSendMsgPipe(m, sendBufAddr, sendSize, waitMode, resultAddr, 0, false, true); } @@ -856,19 +856,19 @@ static int __KernelValidateReceiveMsgPipe(SceUID uid, u32 receiveBufAddr, u32 re { if (receiveSize & 0x80000000) { - ERROR_LOG(SCEKERNEL, "__KernelReceiveMsgPipe(%d): illegal size %d", uid, receiveSize); + ERROR_LOG(Log::sceKernel, "__KernelReceiveMsgPipe(%d): illegal size %d", uid, receiveSize); return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } if (receiveSize != 0 && !Memory::IsValidAddress(receiveBufAddr)) { - ERROR_LOG(SCEKERNEL, "__KernelReceiveMsgPipe(%d): bad buffer address %08x (should crash?)", uid, receiveBufAddr); + ERROR_LOG(Log::sceKernel, "__KernelReceiveMsgPipe(%d): bad buffer address %08x (should crash?)", uid, receiveBufAddr); return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } if (waitMode != SCE_KERNEL_MPW_ASAP && waitMode != SCE_KERNEL_MPW_FULL) { - ERROR_LOG(SCEKERNEL, "__KernelReceiveMsgPipe(%d): invalid wait mode %d", uid, waitMode); + ERROR_LOG(Log::sceKernel, "__KernelReceiveMsgPipe(%d): invalid wait mode %d", uid, waitMode); return SCE_KERNEL_ERROR_ILLEGAL_MODE; } @@ -876,12 +876,12 @@ static int __KernelValidateReceiveMsgPipe(SceUID uid, u32 receiveBufAddr, u32 re { if (!__KernelIsDispatchEnabled()) { - WARN_LOG(SCEKERNEL, "__KernelReceiveMsgPipe(%d): dispatch disabled", uid); + WARN_LOG(Log::sceKernel, "__KernelReceiveMsgPipe(%d): dispatch disabled", uid); return SCE_KERNEL_ERROR_CAN_NOT_WAIT; } if (__IsInInterrupt()) { - WARN_LOG(SCEKERNEL, "__KernelReceiveMsgPipe(%d): in interrupt", uid); + WARN_LOG(Log::sceKernel, "__KernelReceiveMsgPipe(%d): in interrupt", uid); return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT; } } @@ -917,11 +917,11 @@ int sceKernelReceiveMsgPipe(SceUID uid, u32 receiveBufAddr, u32 receiveSize, u32 } MsgPipe *m = kernelObjects.Get(uid, error); if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelReceiveMsgPipe(%i) - ERROR %08x", uid, error); + ERROR_LOG(Log::sceKernel, "sceKernelReceiveMsgPipe(%i) - ERROR %08x", uid, error); return error; } - DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMsgPipe(%i, %08x, %i, %i, %08x, %08x)", uid, receiveBufAddr, receiveSize, waitMode, resultAddr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMsgPipe(%i, %08x, %i, %i, %08x, %08x)", uid, receiveBufAddr, receiveSize, waitMode, resultAddr, timeoutPtr); return __KernelReceiveMsgPipe(m, receiveBufAddr, receiveSize, waitMode, resultAddr, timeoutPtr, false, false); } @@ -933,11 +933,11 @@ int sceKernelReceiveMsgPipeCB(SceUID uid, u32 receiveBufAddr, u32 receiveSize, u } MsgPipe *m = kernelObjects.Get(uid, error); if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelReceiveMsgPipeCB(%i) - ERROR %08x", uid, error); + ERROR_LOG(Log::sceKernel, "sceKernelReceiveMsgPipeCB(%i) - ERROR %08x", uid, error); return error; } - DEBUG_LOG(SCEKERNEL, "sceKernelReceiveMsgPipeCB(%i, %08x, %i, %i, %08x, %08x)", uid, receiveBufAddr, receiveSize, waitMode, resultAddr, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelReceiveMsgPipeCB(%i, %08x, %i, %i, %08x, %08x)", uid, receiveBufAddr, receiveSize, waitMode, resultAddr, timeoutPtr); // TODO: Verify callback behavior. hleCheckCurrentCallbacks(); return __KernelReceiveMsgPipe(m, receiveBufAddr, receiveSize, waitMode, resultAddr, timeoutPtr, true, false); @@ -951,11 +951,11 @@ int sceKernelTryReceiveMsgPipe(SceUID uid, u32 receiveBufAddr, u32 receiveSize, } MsgPipe *m = kernelObjects.Get(uid, error); if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelTryReceiveMsgPipe(%i) - ERROR %08x", uid, error); + ERROR_LOG(Log::sceKernel, "sceKernelTryReceiveMsgPipe(%i) - ERROR %08x", uid, error); return error; } - DEBUG_LOG(SCEKERNEL, "sceKernelTryReceiveMsgPipe(%i, %08x, %i, %i, %08x)", uid, receiveBufAddr, receiveSize, waitMode, resultAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelTryReceiveMsgPipe(%i, %08x, %i, %i, %08x)", uid, receiveBufAddr, receiveSize, waitMode, resultAddr); return __KernelReceiveMsgPipe(m, receiveBufAddr, receiveSize, waitMode, resultAddr, 0, false, true); } @@ -967,7 +967,7 @@ int sceKernelCancelMsgPipe(SceUID uid, u32 numSendThreadsAddr, u32 numReceiveThr MsgPipe *m = kernelObjects.Get(uid, error); if (!m) { - ERROR_LOG(SCEKERNEL, "sceKernelCancelMsgPipe(%i) - ERROR %08x", uid, error); + ERROR_LOG(Log::sceKernel, "sceKernelCancelMsgPipe(%i) - ERROR %08x", uid, error); return error; } @@ -990,7 +990,7 @@ int sceKernelCancelMsgPipe(SceUID uid, u32 numSendThreadsAddr, u32 numReceiveThr // And now the entire buffer is free. m->nmp.freeSize = m->nmp.bufSize; - DEBUG_LOG(SCEKERNEL, "sceKernelCancelMsgPipe(%i, %i, %i)", uid, numSendThreadsAddr, numReceiveThreadsAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelMsgPipe(%i, %i, %i)", uid, numSendThreadsAddr, numReceiveThreadsAddr); return 0; } @@ -1000,7 +1000,7 @@ int sceKernelReferMsgPipeStatus(SceUID uid, u32 statusPtr) { if (m) { auto status = PSPPointer::Create(statusPtr); if (!status.IsValid()) { - return hleLogError(SCEKERNEL, -1, "invalid address"); + return hleLogError(Log::sceKernel, -1, "invalid address"); } // Clean up any that have timed out. @@ -1013,8 +1013,8 @@ int sceKernelReferMsgPipeStatus(SceUID uid, u32 statusPtr) { *status = m->nmp; status.NotifyWrite("MsgPipeStatus"); } - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogError(SCEKERNEL, error, "bad message pipe"); + return hleLogError(Log::sceKernel, error, "bad message pipe"); } } diff --git a/Core/HLE/sceKernelMutex.cpp b/Core/HLE/sceKernelMutex.cpp index 1885552ce1..45f0a9fb4e 100644 --- a/Core/HLE/sceKernelMutex.cpp +++ b/Core/HLE/sceKernelMutex.cpp @@ -293,28 +293,28 @@ void __KernelMutexBeginCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitBeginCallback(threadID, prevCallbackId, mutexWaitTimer); if (result == HLEKernel::WAIT_CB_SUCCESS) - DEBUG_LOG(SCEKERNEL, "sceKernelLockMutexCB: Suspending lock wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelLockMutexCB: Suspending lock wait for callback"); else - WARN_LOG_REPORT(SCEKERNEL, "sceKernelLockMutexCB: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelLockMutexCB: beginning callback with bad wait id?"); } void __KernelMutexEndCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitEndCallback(threadID, prevCallbackId, mutexWaitTimer, __KernelUnlockMutexForThreadCheck); if (result == HLEKernel::WAIT_CB_RESUMED_WAIT) - DEBUG_LOG(SCEKERNEL, "sceKernelLockMutexCB: Resuming lock wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelLockMutexCB: Resuming lock wait for callback"); } int sceKernelCreateMutex(const char *name, u32 attr, int initialCount, u32 optionsPtr) { if (!name) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ERROR, "invalid name"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ERROR, "invalid name"); if (attr & ~0xBFF) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter %08x", attr); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter %08x", attr); if (initialCount < 0) - return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_COUNT, "illegal initial count"); + return hleLogDebug(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_COUNT, "illegal initial count"); if ((attr & PSP_MUTEX_ATTR_ALLOW_RECURSIVE) == 0 && initialCount > 1) - return hleLogDebug(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_COUNT, "illegal non-recursive count"); + return hleLogDebug(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_COUNT, "illegal non-recursive count"); PSPMutex *mutex = new PSPMutex(); SceUID id = kernelObjects.Create(mutex); @@ -334,12 +334,12 @@ int sceKernelCreateMutex(const char *name, u32 attr, int initialCount, u32 optio if (optionsPtr != 0) { u32 size = Memory::Read_U32(optionsPtr); if (size > 4) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateMutex(%s) unsupported options parameter, size = %d", name, size); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateMutex(%s) unsupported options parameter, size = %d", name, size); } if ((attr & ~PSP_MUTEX_ATTR_KNOWN) != 0) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateMutex(%s) unsupported attr parameter: %08x", name, attr); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateMutex(%s) unsupported attr parameter: %08x", name, attr); - return hleLogSuccessX(SCEKERNEL, id); + return hleLogSuccessX(Log::sceKernel, id); } int sceKernelDeleteMutex(SceUID id) @@ -348,7 +348,7 @@ int sceKernelDeleteMutex(SceUID id) PSPMutex *mutex = kernelObjects.Get(id, error); if (mutex) { - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteMutex(%i)", id); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteMutex(%i)", id); bool wokeThreads = false; std::vector::iterator iter, end; for (iter = mutex->waitingThreads.begin(), end = mutex->waitingThreads.end(); iter != end; ++iter) @@ -365,7 +365,7 @@ int sceKernelDeleteMutex(SceUID id) } else { - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteMutex(%i): invalid mutex", id); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteMutex(%i): invalid mutex", id); return error; } } @@ -504,12 +504,12 @@ int sceKernelCancelMutex(SceUID uid, int count, u32 numWaitThreadsPtr) // May still be okay. As long as the count/etc. are valid. if (error != 0 && error != PSP_MUTEX_ERROR_LOCK_OVERFLOW && error != PSP_MUTEX_ERROR_ALREADY_LOCKED) { - DEBUG_LOG(SCEKERNEL, "sceKernelCancelMutex(%i, %d, %08x): invalid count", uid, count, numWaitThreadsPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelMutex(%i, %d, %08x): invalid count", uid, count, numWaitThreadsPtr); return error; } } - DEBUG_LOG(SCEKERNEL, "sceKernelCancelMutex(%i, %d, %08x)", uid, count, numWaitThreadsPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelMutex(%i, %d, %08x)", uid, count, numWaitThreadsPtr); // Remove threads no longer waiting on this first (so the numWaitThreads value is correct.) HLEKernel::CleanupWaitingThreads(WAITTYPE_MUTEX, uid, mutex->waitingThreads); @@ -540,7 +540,7 @@ int sceKernelCancelMutex(SceUID uid, int count, u32 numWaitThreadsPtr) } else { - DEBUG_LOG(SCEKERNEL, "sceKernelCancelMutex(%i, %d, %08x)", uid, count, numWaitThreadsPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelMutex(%i, %d, %08x)", uid, count, numWaitThreadsPtr); return error; } } @@ -548,7 +548,7 @@ int sceKernelCancelMutex(SceUID uid, int count, u32 numWaitThreadsPtr) // int sceKernelLockMutex(SceUID id, int count, int *timeout) int sceKernelLockMutex(SceUID id, int count, u32 timeoutPtr) { - DEBUG_LOG(SCEKERNEL, "sceKernelLockMutex(%i, %i, %08x)", id, count, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelLockMutex(%i, %i, %08x)", id, count, timeoutPtr); u32 error; PSPMutex *mutex = kernelObjects.Get(id, error); @@ -573,7 +573,7 @@ int sceKernelLockMutex(SceUID id, int count, u32 timeoutPtr) // int sceKernelLockMutexCB(SceUID id, int count, int *timeout) int sceKernelLockMutexCB(SceUID id, int count, u32 timeoutPtr) { - DEBUG_LOG(SCEKERNEL, "sceKernelLockMutexCB(%i, %i, %08x)", id, count, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelLockMutexCB(%i, %i, %08x)", id, count, timeoutPtr); u32 error; PSPMutex *mutex = kernelObjects.Get(id, error); @@ -612,7 +612,7 @@ int sceKernelLockMutexCB(SceUID id, int count, u32 timeoutPtr) // int sceKernelTryLockMutex(SceUID id, int count) int sceKernelTryLockMutex(SceUID id, int count) { - DEBUG_LOG(SCEKERNEL, "sceKernelTryLockMutex(%i, %i)", id, count); + DEBUG_LOG(Log::sceKernel, "sceKernelTryLockMutex(%i, %i)", id, count); u32 error; PSPMutex *mutex = kernelObjects.Get(id, error); @@ -627,7 +627,7 @@ int sceKernelTryLockMutex(SceUID id, int count) // int sceKernelUnlockMutex(SceUID id, int count) int sceKernelUnlockMutex(SceUID id, int count) { - DEBUG_LOG(SCEKERNEL, "sceKernelUnlockMutex(%i, %i)", id, count); + DEBUG_LOG(Log::sceKernel, "sceKernelUnlockMutex(%i, %i)", id, count); u32 error; PSPMutex *mutex = kernelObjects.Get(id, error); @@ -657,13 +657,13 @@ int sceKernelReferMutexStatus(SceUID id, u32 infoAddr) { u32 error; PSPMutex *m = kernelObjects.Get(id, error); if (!m) { - return hleLogError(SCEKERNEL, error, "invalid mutex id"); + return hleLogError(Log::sceKernel, error, "invalid mutex id"); } // Should we crash the thread somehow? auto info = PSPPointer::Create(infoAddr); if (!info.IsValid()) - return hleLogError(SCEKERNEL, -1, "invalid pointer"); + return hleLogError(Log::sceKernel, -1, "invalid pointer"); // Don't write if the size is 0. Anything else is A-OK, though, apparently. if (info->size != 0) { @@ -673,19 +673,19 @@ int sceKernelReferMutexStatus(SceUID id, u32 infoAddr) { *info = m->nm; info.NotifyWrite("MutexStatus"); } - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } int sceKernelCreateLwMutex(u32 workareaPtr, const char *name, u32 attr, int initialCount, u32 optionsPtr) { if (!name) { - WARN_LOG_REPORT(SCEKERNEL, "%08x=sceKernelCreateLwMutex(): invalid name", SCE_KERNEL_ERROR_ERROR); + WARN_LOG_REPORT(Log::sceKernel, "%08x=sceKernelCreateLwMutex(): invalid name", SCE_KERNEL_ERROR_ERROR); return SCE_KERNEL_ERROR_ERROR; } if (attr >= 0x400) { - WARN_LOG_REPORT(SCEKERNEL, "%08x=sceKernelCreateLwMutex(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); + WARN_LOG_REPORT(Log::sceKernel, "%08x=sceKernelCreateLwMutex(): invalid attr parameter: %08x", SCE_KERNEL_ERROR_ILLEGAL_ATTR, attr); return SCE_KERNEL_ERROR_ILLEGAL_ATTR; } @@ -713,16 +713,16 @@ int sceKernelCreateLwMutex(u32 workareaPtr, const char *name, u32 attr, int init workarea->attr = attr; workarea->uid = id; - DEBUG_LOG(SCEKERNEL, "sceKernelCreateLwMutex(%08x, %s, %08x, %d, %08x)", workareaPtr, name, attr, initialCount, optionsPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelCreateLwMutex(%08x, %s, %08x, %d, %08x)", workareaPtr, name, attr, initialCount, optionsPtr); if (optionsPtr != 0) { u32 size = Memory::Read_U32(optionsPtr); if (size > 4) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateLwMutex(%s) unsupported options parameter, size = %d", name, size); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateLwMutex(%s) unsupported options parameter, size = %d", name, size); } if ((attr & ~PSP_MUTEX_ATTR_KNOWN) != 0) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateLwMutex(%s) unsupported attr parameter: %08x", name, attr); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateLwMutex(%s) unsupported attr parameter: %08x", name, attr); return 0; } @@ -754,7 +754,7 @@ bool __KernelUnlockLwMutexForThread(LwMutex *mutex, T workarea, SceUID threadID, int sceKernelDeleteLwMutex(u32 workareaPtr) { - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteLwMutex(%08x)", workareaPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteLwMutex(%08x)", workareaPtr); if (!workareaPtr || !Memory::IsValidAddress(workareaPtr)) return SCE_KERNEL_ERROR_ILLEGAL_ADDR; @@ -896,24 +896,24 @@ void __KernelLwMutexBeginCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitBeginCallback(threadID, prevCallbackId, lwMutexWaitTimer); if (result == HLEKernel::WAIT_CB_SUCCESS) - DEBUG_LOG(SCEKERNEL, "sceKernelLockLwMutexCB: Suspending lock wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelLockLwMutexCB: Suspending lock wait for callback"); else - WARN_LOG_REPORT(SCEKERNEL, "sceKernelLockLwMutexCB: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelLockLwMutexCB: beginning callback with bad wait id?"); } void __KernelLwMutexEndCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitEndCallback(threadID, prevCallbackId, lwMutexWaitTimer, __KernelUnlockLwMutexForThreadCheck); if (result == HLEKernel::WAIT_CB_RESUMED_WAIT) - DEBUG_LOG(SCEKERNEL, "sceKernelLockLwMutexCB: Resuming lock wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelLockLwMutexCB: Resuming lock wait for callback"); } int sceKernelTryLockLwMutex(u32 workareaPtr, int count) { - DEBUG_LOG(SCEKERNEL, "sceKernelTryLockLwMutex(%08x, %i)", workareaPtr, count); + DEBUG_LOG(Log::sceKernel, "sceKernelTryLockLwMutex(%08x, %i)", workareaPtr, count); if (!Memory::IsValidAddress(workareaPtr)) { - ERROR_LOG(SCEKERNEL, "Bad workarea pointer for LwMutex"); + ERROR_LOG(Log::sceKernel, "Bad workarea pointer for LwMutex"); return SCE_KERNEL_ERROR_ACCESS_ERROR; } @@ -932,10 +932,10 @@ int sceKernelTryLockLwMutex(u32 workareaPtr, int count) int sceKernelTryLockLwMutex_600(u32 workareaPtr, int count) { - DEBUG_LOG(SCEKERNEL, "sceKernelTryLockLwMutex_600(%08x, %i)", workareaPtr, count); + DEBUG_LOG(Log::sceKernel, "sceKernelTryLockLwMutex_600(%08x, %i)", workareaPtr, count); if (!Memory::IsValidAddress(workareaPtr)) { - ERROR_LOG(SCEKERNEL, "Bad workarea pointer for LwMutex"); + ERROR_LOG(Log::sceKernel, "Bad workarea pointer for LwMutex"); return SCE_KERNEL_ERROR_ACCESS_ERROR; } @@ -953,10 +953,10 @@ int sceKernelTryLockLwMutex_600(u32 workareaPtr, int count) int sceKernelLockLwMutex(u32 workareaPtr, int count, u32 timeoutPtr) { - VERBOSE_LOG(SCEKERNEL, "sceKernelLockLwMutex(%08x, %i, %08x)", workareaPtr, count, timeoutPtr); + VERBOSE_LOG(Log::sceKernel, "sceKernelLockLwMutex(%08x, %i, %08x)", workareaPtr, count, timeoutPtr); if (!Memory::IsValidAddress(workareaPtr)) { - ERROR_LOG(SCEKERNEL, "Bad workarea pointer for LwMutex"); + ERROR_LOG(Log::sceKernel, "Bad workarea pointer for LwMutex"); return SCE_KERNEL_ERROR_ACCESS_ERROR; } @@ -990,10 +990,10 @@ int sceKernelLockLwMutex(u32 workareaPtr, int count, u32 timeoutPtr) int sceKernelLockLwMutexCB(u32 workareaPtr, int count, u32 timeoutPtr) { - VERBOSE_LOG(SCEKERNEL, "sceKernelLockLwMutexCB(%08x, %i, %08x)", workareaPtr, count, timeoutPtr); + VERBOSE_LOG(Log::sceKernel, "sceKernelLockLwMutexCB(%08x, %i, %08x)", workareaPtr, count, timeoutPtr); if (!Memory::IsValidAddress(workareaPtr)) { - ERROR_LOG(SCEKERNEL, "Bad workarea pointer for LwMutex"); + ERROR_LOG(Log::sceKernel, "Bad workarea pointer for LwMutex"); return SCE_KERNEL_ERROR_ACCESS_ERROR; } @@ -1027,10 +1027,10 @@ int sceKernelLockLwMutexCB(u32 workareaPtr, int count, u32 timeoutPtr) int sceKernelUnlockLwMutex(u32 workareaPtr, int count) { - VERBOSE_LOG(SCEKERNEL, "sceKernelUnlockLwMutex(%08x, %i)", workareaPtr, count); + VERBOSE_LOG(Log::sceKernel, "sceKernelUnlockLwMutex(%08x, %i)", workareaPtr, count); if (!Memory::IsValidAddress(workareaPtr)) { - ERROR_LOG(SCEKERNEL, "Bad workarea pointer for LwMutex"); + ERROR_LOG(Log::sceKernel, "Bad workarea pointer for LwMutex"); return SCE_KERNEL_ERROR_ACCESS_ERROR; } @@ -1064,12 +1064,12 @@ static int __KernelReferLwMutexStatus(SceUID uid, u32 infoPtr) { u32 error; LwMutex *m = kernelObjects.Get(uid, error); if (!m) - return hleLogError(SCEKERNEL, error, "invalid id"); + return hleLogError(Log::sceKernel, error, "invalid id"); // Should we crash the thread somehow? auto info = PSPPointer::Create(infoPtr); if (!info.IsValid()) - return hleLogError(SCEKERNEL, -1, "invalid pointer"); + return hleLogError(Log::sceKernel, -1, "invalid pointer"); if (info->size != 0) { @@ -1084,7 +1084,7 @@ static int __KernelReferLwMutexStatus(SceUID uid, u32 infoPtr) { *info = m->nm; info.NotifyWrite("LwMutexStatus"); } - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } int sceKernelReferLwMutexStatusByID(SceUID uid, u32 infoPtr) { @@ -1094,7 +1094,7 @@ int sceKernelReferLwMutexStatusByID(SceUID uid, u32 infoPtr) { int sceKernelReferLwMutexStatus(u32 workareaPtr, u32 infoPtr) { auto workarea = PSPPointer::Create(workareaPtr); if (!workarea.IsValid()) { - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ACCESS_ERROR, "bad workarea pointer for LwMutex"); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ACCESS_ERROR, "bad workarea pointer for LwMutex"); } return __KernelReferLwMutexStatus(workarea->uid, infoPtr); diff --git a/Core/HLE/sceKernelSemaphore.cpp b/Core/HLE/sceKernelSemaphore.cpp index b6a759cb76..4597a024c9 100644 --- a/Core/HLE/sceKernelSemaphore.cpp +++ b/Core/HLE/sceKernelSemaphore.cpp @@ -143,16 +143,16 @@ void __KernelSemaBeginCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitBeginCallback(threadID, prevCallbackId, semaWaitTimer); if (result == HLEKernel::WAIT_CB_SUCCESS) - DEBUG_LOG(SCEKERNEL, "sceKernelWaitSemaCB: Suspending sema wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelWaitSemaCB: Suspending sema wait for callback"); else - WARN_LOG_REPORT(SCEKERNEL, "sceKernelWaitSemaCB: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelWaitSemaCB: beginning callback with bad wait id?"); } void __KernelSemaEndCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitEndCallback(threadID, prevCallbackId, semaWaitTimer, __KernelUnlockSemaForThread); if (result == HLEKernel::WAIT_CB_RESUMED_WAIT) - DEBUG_LOG(SCEKERNEL, "sceKernelWaitSemaCB: Resuming sema wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelWaitSemaCB: Resuming sema wait for callback"); } // Resume all waiting threads (for delete / cancel.) @@ -176,11 +176,11 @@ int sceKernelCancelSema(SceUID id, int newCount, u32 numWaitThreadsPtr) { if (newCount > s->ns.maxCount) { - DEBUG_LOG(SCEKERNEL, "sceKernelCancelSema(%i, %i, %08x): invalid count", id, newCount, numWaitThreadsPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelSema(%i, %i, %08x): invalid count", id, newCount, numWaitThreadsPtr); return SCE_KERNEL_ERROR_ILLEGAL_COUNT; } - DEBUG_LOG(SCEKERNEL, "sceKernelCancelSema(%i, %i, %08x)", id, newCount, numWaitThreadsPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelSema(%i, %i, %08x)", id, newCount, numWaitThreadsPtr); s->ns.numWaitThreads = (int) s->waitingThreads.size(); if (Memory::IsValidAddress(numWaitThreadsPtr)) @@ -198,16 +198,16 @@ int sceKernelCancelSema(SceUID id, int newCount, u32 numWaitThreadsPtr) } else { - DEBUG_LOG(SCEKERNEL, "sceKernelCancelSema(%i, %i, %08x): invalid semaphore", id, newCount, numWaitThreadsPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelSema(%i, %i, %08x): invalid semaphore", id, newCount, numWaitThreadsPtr); return error; } } int sceKernelCreateSema(const char* name, u32 attr, int initVal, int maxVal, u32 optionPtr) { if (!name) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ERROR, "invalid name"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ERROR, "invalid name"); if (attr >= 0x200) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter %08x", attr); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr parameter %08x", attr); PSPSemaphore *s = new PSPSemaphore(); SceUID id = kernelObjects.Create(s); @@ -224,14 +224,14 @@ int sceKernelCreateSema(const char* name, u32 attr, int initVal, int maxVal, u32 // Many games pass garbage into optionPtr, it doesn't have any options. if (optionPtr != 0) { if (!Memory::IsValidRange(optionPtr, 4)) - hleLogWarning(SCEKERNEL, id, "invalid options parameter"); + hleLogWarning(Log::sceKernel, id, "invalid options parameter"); else if (Memory::Read_U32(optionPtr) > 4) - hleLogDebug(SCEKERNEL, id, "invalid options parameter size"); + hleLogDebug(Log::sceKernel, id, "invalid options parameter size"); } if ((attr & ~PSP_SEMA_ATTR_PRIORITY) != 0) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateSema(%s) unsupported attr parameter: %08x", name, attr); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateSema(%s) unsupported attr parameter: %08x", name, attr); - return hleLogSuccessX(SCEKERNEL, id); + return hleLogSuccessX(Log::sceKernel, id); } int sceKernelDeleteSema(SceUID id) @@ -240,7 +240,7 @@ int sceKernelDeleteSema(SceUID id) PSPSemaphore *s = kernelObjects.Get(id, error); if (s) { - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteSema(%i)", id); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteSema(%i)", id); bool wokeThreads = __KernelClearSemaThreads(s, SCE_KERNEL_ERROR_WAIT_DELETE); if (wokeThreads) @@ -250,7 +250,7 @@ int sceKernelDeleteSema(SceUID id) } else { - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteSema(%i): invalid semaphore", id); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteSema(%i): invalid semaphore", id); return error; } } @@ -261,7 +261,7 @@ int sceKernelReferSemaStatus(SceUID id, u32 infoPtr) { if (s) { auto info = PSPPointer::Create(infoPtr); if (!info.IsValid()) - return hleLogWarning(SCEKERNEL, -1, "invalid pointer"); + return hleLogWarning(Log::sceKernel, -1, "invalid pointer"); HLEKernel::CleanupWaitingThreads(WAITTYPE_SEMA, id, s->waitingThreads); @@ -270,9 +270,9 @@ int sceKernelReferSemaStatus(SceUID id, u32 infoPtr) { *info = s->ns; info.NotifyWrite("SemaStatus"); } - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogError(SCEKERNEL, error); + return hleLogError(Log::sceKernel, error); } } @@ -284,13 +284,13 @@ int sceKernelSignalSema(SceUID id, int signal) { if (s->ns.currentCount + signal - (int) s->waitingThreads.size() > s->ns.maxCount) { - VERBOSE_LOG(SCEKERNEL, "sceKernelSignalSema(%i, %i): overflow (at %i)", id, signal, s->ns.currentCount); + VERBOSE_LOG(Log::sceKernel, "sceKernelSignalSema(%i, %i): overflow (at %i)", id, signal, s->ns.currentCount); return SCE_KERNEL_ERROR_SEMA_OVF; } int oldval = s->ns.currentCount; s->ns.currentCount += signal; - DEBUG_LOG(SCEKERNEL, "sceKernelSignalSema(%i, %i) (count: %i -> %i)", id, signal, oldval, s->ns.currentCount); + DEBUG_LOG(Log::sceKernel, "sceKernelSignalSema(%i, %i) (count: %i -> %i)", id, signal, oldval, s->ns.currentCount); if ((s->ns.attr & PSP_SEMA_ATTR_PRIORITY) != 0) std::stable_sort(s->waitingThreads.begin(), s->waitingThreads.end(), __KernelThreadSortPriority); @@ -314,7 +314,7 @@ retry: } else { - DEBUG_LOG(SCEKERNEL, "sceKernelSignalSema(%i, %i): invalid semaphore", id, signal); + DEBUG_LOG(Log::sceKernel, "sceKernelSignalSema(%i, %i): invalid semaphore", id, signal); return error; } } @@ -396,11 +396,11 @@ int sceKernelWaitSema(SceUID id, int wantedCount, u32 timeoutPtr) { int result = __KernelWaitSema(id, wantedCount, timeoutPtr, false); if (result == (int)SCE_KERNEL_ERROR_ILLEGAL_COUNT) - DEBUG_LOG(SCEKERNEL, "SCE_KERNEL_ERROR_ILLEGAL_COUNT=sceKernelWaitSema(%i, %i, %i)", id, wantedCount, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "SCE_KERNEL_ERROR_ILLEGAL_COUNT=sceKernelWaitSema(%i, %i, %i)", id, wantedCount, timeoutPtr); else if (result == 0) - DEBUG_LOG(SCEKERNEL, "0=sceKernelWaitSema(%i, %i, %i)", id, wantedCount, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "0=sceKernelWaitSema(%i, %i, %i)", id, wantedCount, timeoutPtr); else - DEBUG_LOG(SCEKERNEL, "%08x=sceKernelWaitSema(%i, %i, %i)", result, id, wantedCount, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "%08x=sceKernelWaitSema(%i, %i, %i)", result, id, wantedCount, timeoutPtr); return result; } @@ -408,11 +408,11 @@ int sceKernelWaitSemaCB(SceUID id, int wantedCount, u32 timeoutPtr) { int result = __KernelWaitSema(id, wantedCount, timeoutPtr, true); if (result == (int)SCE_KERNEL_ERROR_ILLEGAL_COUNT) - DEBUG_LOG(SCEKERNEL, "SCE_KERNEL_ERROR_ILLEGAL_COUNT=sceKernelWaitSemaCB(%i, %i, %i)", id, wantedCount, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "SCE_KERNEL_ERROR_ILLEGAL_COUNT=sceKernelWaitSemaCB(%i, %i, %i)", id, wantedCount, timeoutPtr); else if (result == 0) - DEBUG_LOG(SCEKERNEL, "0=sceKernelWaitSemaCB(%i, %i, %i)", id, wantedCount, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "0=sceKernelWaitSemaCB(%i, %i, %i)", id, wantedCount, timeoutPtr); else - DEBUG_LOG(SCEKERNEL, "%08x=sceKernelWaitSemaCB(%i, %i, %i)", result, id, wantedCount, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "%08x=sceKernelWaitSemaCB(%i, %i, %i)", result, id, wantedCount, timeoutPtr); return result; } @@ -421,7 +421,7 @@ int sceKernelPollSema(SceUID id, int wantedCount) { if (wantedCount <= 0) { - DEBUG_LOG(SCEKERNEL, "SCE_KERNEL_ERROR_ILLEGAL_COUNT=sceKernelPollSema(%i, %i)", id, wantedCount); + DEBUG_LOG(Log::sceKernel, "SCE_KERNEL_ERROR_ILLEGAL_COUNT=sceKernelPollSema(%i, %i)", id, wantedCount); return (int)SCE_KERNEL_ERROR_ILLEGAL_COUNT; } @@ -431,19 +431,19 @@ int sceKernelPollSema(SceUID id, int wantedCount) { if (s->ns.currentCount >= wantedCount && s->waitingThreads.size() == 0) { - DEBUG_LOG(SCEKERNEL, "0=sceKernelPollSema(%i, %i)", id, wantedCount); + DEBUG_LOG(Log::sceKernel, "0=sceKernelPollSema(%i, %i)", id, wantedCount); s->ns.currentCount -= wantedCount; return 0; } else { - DEBUG_LOG(SCEKERNEL, "SCE_KERNEL_ERROR_SEMA_ZERO=sceKernelPollSema(%i, %i)", id, wantedCount); + DEBUG_LOG(Log::sceKernel, "SCE_KERNEL_ERROR_SEMA_ZERO=sceKernelPollSema(%i, %i)", id, wantedCount); return SCE_KERNEL_ERROR_SEMA_ZERO; } } else { - DEBUG_LOG(SCEKERNEL, "sceKernelPollSema(%i, %i): invalid semaphore", id, wantedCount); + DEBUG_LOG(Log::sceKernel, "sceKernelPollSema(%i, %i): invalid semaphore", id, wantedCount); return error; } } @@ -458,7 +458,7 @@ static u32 sceUtilsBufferCopyWithRange(u32 outAddr, int outSize, u32 inAddr, int const u8 *inAddress = Memory::IsValidRange(inAddr, inSize) ? Memory::GetPointerUnchecked(inAddr) : nullptr; int temp = kirk_sceUtilsBufferCopyWithRange(outAddress, outSize, inAddress, inSize, cmd); if (temp != 0) { - ERROR_LOG(SCEKERNEL, "hleUtilsBufferCopyWithRange: Failed with %d", temp); + ERROR_LOG(Log::sceKernel, "hleUtilsBufferCopyWithRange: Failed with %d", temp); } return 0; } diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index 40a575da74..d2a22881a2 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -406,7 +406,7 @@ public: { currentStack.start = 0; nt.initialStack = 0; - ERROR_LOG(SCEKERNEL, "Failed to allocate stack for thread"); + ERROR_LOG(Log::sceKernel, "Failed to allocate stack for thread"); return false; } @@ -439,7 +439,7 @@ public: void FreeStack() { if (currentStack.start != 0) { - DEBUG_LOG(SCEKERNEL, "Freeing thread stack %s", nt.name); + DEBUG_LOG(Log::sceKernel, "Freeing thread stack %s", nt.name); if ((nt.attr & PSP_THREAD_ATTR_CLEAR_STACK) != 0 && nt.initialStack != 0) { Memory::Memset(nt.initialStack, 0, nt.stackSize, "ThreadFreeStack"); @@ -490,7 +490,7 @@ public: if (pushedStacks.size() != 0) { - WARN_LOG_REPORT(SCEKERNEL, "Thread ended within an extended stack"); + WARN_LOG_REPORT(Log::sceKernel, "Thread ended within an extended stack"); for (size_t i = 0; i < pushedStacks.size(); ++i) userMemory.Free(pushedStacks[i].start); } @@ -752,10 +752,10 @@ static void __KernelDelayBeginCallback(SceUID threadID, SceUID prevCallbackId) { // Most waits need to keep track of waiting threads, delays don't. Use a fake list. std::vector dummy; HLEKernel::WaitBeginCallback(threadID, prevCallbackId, eventScheduledWakeup, dummy, pausedDelays, true); - DEBUG_LOG(SCEKERNEL, "sceKernelDelayThreadCB: Suspending delay for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelDelayThreadCB: Suspending delay for callback"); } else - WARN_LOG_REPORT(SCEKERNEL, "sceKernelDelayThreadCB: beginning callback with bad wait?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelDelayThreadCB: beginning callback with bad wait?"); } static void __KernelDelayEndCallback(SceUID threadID, SceUID prevCallbackId) { @@ -764,7 +764,7 @@ static void __KernelDelayEndCallback(SceUID threadID, SceUID prevCallbackId) { if (pausedDelays.find(pauseKey) == pausedDelays.end()) { // This probably should not happen. - WARN_LOG_REPORT(SCEKERNEL, "sceKernelDelayThreadCB: cannot find delay deadline"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelDelayThreadCB: cannot find delay deadline"); __KernelResumeThreadFromWait(threadID, 0); return; } @@ -780,12 +780,12 @@ static void __KernelDelayEndCallback(SceUID threadID, SceUID prevCallbackId) { else { CoreTiming::ScheduleEvent(cyclesLeft, eventScheduledWakeup, __KernelGetCurThread()); - DEBUG_LOG(SCEKERNEL, "sceKernelDelayThreadCB: Resuming delay after callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelDelayThreadCB: Resuming delay after callback"); } } static void __KernelSleepBeginCallback(SceUID threadID, SceUID prevCallbackId) { - DEBUG_LOG(SCEKERNEL, "sceKernelSleepThreadCB: Suspending sleep for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelSleepThreadCB: Suspending sleep for callback"); } static void __KernelSleepEndCallback(SceUID threadID, SceUID prevCallbackId) { @@ -793,7 +793,7 @@ static void __KernelSleepEndCallback(SceUID threadID, SceUID prevCallbackId) { PSPThread *thread = kernelObjects.Get(threadID, error); if (!thread) { // This probably should not happen. - WARN_LOG_REPORT(SCEKERNEL, "sceKernelSleepThreadCB: thread deleted?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelSleepThreadCB: thread deleted?"); return; } @@ -801,10 +801,10 @@ static void __KernelSleepEndCallback(SceUID threadID, SceUID prevCallbackId) { if (thread->nt.wakeupCount > 0) { thread->nt.wakeupCount--; - DEBUG_LOG(SCEKERNEL, "sceKernelSleepThreadCB: resume from callback, wakeupCount decremented to %i", thread->nt.wakeupCount); + DEBUG_LOG(Log::sceKernel, "sceKernelSleepThreadCB: resume from callback, wakeupCount decremented to %i", thread->nt.wakeupCount); __KernelResumeThreadFromWait(threadID, 0); } else { - DEBUG_LOG(SCEKERNEL, "sceKernelSleepThreadCB: Resuming sleep after callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelSleepThreadCB: Resuming sleep after callback"); } } @@ -812,11 +812,11 @@ static void __KernelThreadEndBeginCallback(SceUID threadID, SceUID prevCallbackI { auto result = HLEKernel::WaitBeginCallback(threadID, prevCallbackId, eventThreadEndTimeout); if (result == HLEKernel::WAIT_CB_SUCCESS) - DEBUG_LOG(SCEKERNEL, "sceKernelWaitThreadEndCB: Suspending wait for callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelWaitThreadEndCB: Suspending wait for callback"); else if (result == HLEKernel::WAIT_CB_BAD_WAIT_DATA) - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelWaitThreadEndCB: wait not found to pause for callback"); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelWaitThreadEndCB: wait not found to pause for callback"); else - WARN_LOG_REPORT(SCEKERNEL, "sceKernelWaitThreadEndCB: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelWaitThreadEndCB: beginning callback with bad wait id?"); } static bool __KernelCheckResumeThreadEnd(PSPThread *t, SceUID waitingThreadID, u32 &error, int result, bool &wokeThreads) { @@ -840,7 +840,7 @@ static void __KernelThreadEndEndCallback(SceUID threadID, SceUID prevCallbackId) { auto result = HLEKernel::WaitEndCallback(threadID, prevCallbackId, eventThreadEndTimeout, __KernelCheckResumeThreadEnd); if (result == HLEKernel::WAIT_CB_RESUMED_WAIT) - DEBUG_LOG(SCEKERNEL, "sceKernelWaitThreadEndCB: Resuming wait from callback"); + DEBUG_LOG(Log::sceKernel, "sceKernelWaitThreadEndCB: Resuming wait from callback"); } u32 __KernelSetThreadRA(SceUID threadID, u32 nid) @@ -852,7 +852,7 @@ u32 __KernelSetThreadRA(SceUID threadID, u32 nid) newRA = moduleReturnHackAddr; break; default: - ERROR_LOG_REPORT(SCEKERNEL, "__KernelSetThreadRA(): invalid RA address"); + ERROR_LOG_REPORT(Log::sceKernel, "__KernelSetThreadRA(): invalid RA address"); return -1; } @@ -1064,7 +1064,7 @@ static void __KernelChangeReadyState(SceUID threadID, bool ready) if (thread) __KernelChangeReadyState(thread, threadID, ready); else - WARN_LOG(SCEKERNEL, "Trying to change the ready state of an unknown thread?"); + WARN_LOG(Log::sceKernel, "Trying to change the ready state of an unknown thread?"); } void __KernelStartIdleThreads(SceUID moduleId) @@ -1109,7 +1109,7 @@ bool __KernelSwitchOffThread(const char *reason) return true; } else - ERROR_LOG(SCEKERNEL, "Unable to switch to idle thread."); + ERROR_LOG(Log::sceKernel, "Unable to switch to idle thread."); } return false; @@ -1122,7 +1122,7 @@ bool __KernelSwitchToThread(SceUID threadID, const char *reason) if (currentThread != threadIdleID[0] && currentThread != threadIdleID[1]) { - ERROR_LOG_REPORT(SCEKERNEL, "__KernelSwitchToThread used when already on a thread."); + ERROR_LOG_REPORT(Log::sceKernel, "__KernelSwitchToThread used when already on a thread."); return false; } @@ -1133,7 +1133,7 @@ bool __KernelSwitchToThread(SceUID threadID, const char *reason) PSPThread *t = kernelObjects.Get(threadID, error); if (!t) { - ERROR_LOG_REPORT(SCEKERNEL, "__KernelSwitchToThread: %x doesn't exist", threadID); + ERROR_LOG_REPORT(Log::sceKernel, "__KernelSwitchToThread: %x doesn't exist", threadID); hleReSchedule("switch to deleted thread"); } else if (t->isReady() || t->isRunning()) @@ -1219,7 +1219,7 @@ u32 __KernelGetWaitValue(SceUID threadID, u32 &error) { if (t) { return t->getWaitInfo().waitValue; } else { - ERROR_LOG(SCEKERNEL, "__KernelGetWaitValue ERROR: thread %i", threadID); + ERROR_LOG(Log::sceKernel, "__KernelGetWaitValue ERROR: thread %i", threadID); return 0; } } @@ -1229,7 +1229,7 @@ u32 __KernelGetWaitTimeoutPtr(SceUID threadID, u32 &error) { if (t) { return t->getWaitInfo().timeoutPtr; } else { - ERROR_LOG(SCEKERNEL, "__KernelGetWaitTimeoutPtr ERROR: thread %i", threadID); + ERROR_LOG(Log::sceKernel, "__KernelGetWaitTimeoutPtr ERROR: thread %i", threadID); return 0; } } @@ -1239,7 +1239,7 @@ SceUID __KernelGetWaitID(SceUID threadID, WaitType type, u32 &error) { if (t) { return t->getWaitID(type); } else { - ERROR_LOG(SCEKERNEL, "__KernelGetWaitID ERROR: thread %i", threadID); + ERROR_LOG(Log::sceKernel, "__KernelGetWaitID ERROR: thread %i", threadID); return -1; } } @@ -1249,7 +1249,7 @@ SceUID __KernelGetCurrentCallbackID(SceUID threadID, u32 &error) { if (t) { return t->currentCallbackId; } else { - ERROR_LOG(SCEKERNEL, "__KernelGetCurrentCallbackID ERROR: thread %i", threadID); + ERROR_LOG(Log::sceKernel, "__KernelGetCurrentCallbackID ERROR: thread %i", threadID); return 0; } } @@ -1267,7 +1267,7 @@ u32 sceKernelReferThreadStatus(u32 threadID, u32 statusPtr) if (!t) { hleEatCycles(700); hleReSchedule("refer thread status"); - return hleLogError(SCEKERNEL, error, "bad thread"); + return hleLogError(Log::sceKernel, error, "bad thread"); } u32 wantedSize = Memory::Read_U32(statusPtr); @@ -1276,7 +1276,7 @@ u32 sceKernelReferThreadStatus(u32 threadID, u32 statusPtr) if (wantedSize > THREADINFO_SIZE_AFTER_260) { hleEatCycles(1200); hleReSchedule("refer thread status"); - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_SIZE, "bad size %d", wantedSize); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_SIZE, "bad size %d", wantedSize); } t->nt.nativeSize = THREADINFO_SIZE_AFTER_260; @@ -1294,7 +1294,7 @@ u32 sceKernelReferThreadStatus(u32 threadID, u32 statusPtr) hleEatCycles(1400); hleReSchedule("refer thread status"); - return hleLogSuccessVerboseI(SCEKERNEL, 0); + return hleLogSuccessVerboseI(Log::sceKernel, 0); } // Thanks JPCSP @@ -1307,11 +1307,11 @@ u32 sceKernelReferThreadRunStatus(u32 threadID, u32 statusPtr) PSPThread *t = kernelObjects.Get(threadID, error); if (!t) { - ERROR_LOG(SCEKERNEL,"sceKernelReferThreadRunStatus Error %08x", error); + ERROR_LOG(Log::sceKernel,"sceKernelReferThreadRunStatus Error %08x", error); return error; } - DEBUG_LOG(SCEKERNEL,"sceKernelReferThreadRunStatus(%i, %08x)", threadID, statusPtr); + DEBUG_LOG(Log::sceKernel,"sceKernelReferThreadRunStatus(%i, %08x)", threadID, statusPtr); if (!Memory::IsValidAddress(statusPtr)) return -1; @@ -1336,14 +1336,14 @@ int __KernelGetThreadExitStatus(SceUID threadID) { u32 error; PSPThread *t = kernelObjects.Get(threadID, error); if (!t) { - return hleLogError(SCEKERNEL, error); + return hleLogError(Log::sceKernel, error); } // __KernelResetThread and __KernelCreateThread set exitStatus in case it's DORMANT. if (t->nt.status == THREADSTATUS_DORMANT) { - return hleLogSuccessI(SCEKERNEL, t->nt.exitStatus); + return hleLogSuccessI(Log::sceKernel, t->nt.exitStatus); } - return hleLogVerbose(SCEKERNEL, SCE_KERNEL_ERROR_NOT_DORMANT, "not dormant"); + return hleLogVerbose(Log::sceKernel, SCE_KERNEL_ERROR_NOT_DORMANT, "not dormant"); } int sceKernelGetThreadExitStatus(SceUID threadID) { @@ -1357,15 +1357,15 @@ u32 sceKernelGetThreadmanIdType(u32 uid) { int type; if (kernelObjects.GetIDType(uid, &type)) { if (type < 0x1000) { - DEBUG_LOG(SCEKERNEL, "%i=sceKernelGetThreadmanIdType(%i)", type, uid); + DEBUG_LOG(Log::sceKernel, "%i=sceKernelGetThreadmanIdType(%i)", type, uid); return type; } else { // This means a partition memory block or module, etc. - ERROR_LOG(SCEKERNEL, "sceKernelGetThreadmanIdType(%i): invalid object type %i", uid, type); + ERROR_LOG(Log::sceKernel, "sceKernelGetThreadmanIdType(%i): invalid object type %i", uid, type); return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT; } } else { - ERROR_LOG(SCEKERNEL, "sceKernelGetThreadmanIdType(%i) - FAILED", uid); + ERROR_LOG(Log::sceKernel, "sceKernelGetThreadmanIdType(%i) - FAILED", uid); return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT; } } @@ -1389,12 +1389,12 @@ static bool __ThreadmanIdListIsDormant(const PSPThread *t) { u32 sceKernelGetThreadmanIdList(u32 type, u32 readBufPtr, u32 readBufSize, u32 idCountPtr) { if (readBufSize >= 0x8000000) { // Not exact, it's probably if the sum ends up negative or something. - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelGetThreadmanIdList(%i, %08x, %i, %08x): invalid size", type, readBufPtr, readBufSize, idCountPtr); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelGetThreadmanIdList(%i, %08x, %i, %08x): invalid size", type, readBufPtr, readBufSize, idCountPtr); return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } if (!Memory::IsValidAddress(readBufPtr) && readBufSize > 0) { // Crashes on a PSP. - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelGetThreadmanIdList(%i, %08x, %i, %08x): invalid pointer", type, readBufPtr, readBufSize, idCountPtr); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelGetThreadmanIdList(%i, %08x, %i, %08x): invalid pointer", type, readBufPtr, readBufSize, idCountPtr); return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT; } @@ -1402,7 +1402,7 @@ u32 sceKernelGetThreadmanIdList(u32 type, u32 readBufPtr, u32 readBufSize, u32 i auto uids = PSPPointer::Create(readBufPtr); u32 error; if (type > 0 && type <= SCE_KERNEL_TMID_Tlspl) { - DEBUG_LOG(SCEKERNEL, "sceKernelGetThreadmanIdList(%i, %08x, %i, %08x)", type, readBufPtr, readBufSize, idCountPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelGetThreadmanIdList(%i, %08x, %i, %08x)", type, readBufPtr, readBufSize, idCountPtr); total = kernelObjects.ListIDType(type, uids, readBufSize); } else if (type >= SCE_KERNEL_TMID_SleepThread && type <= SCE_KERNEL_TMID_DormantThread) { bool (*checkFunc)(const PSPThread *t) = nullptr; @@ -1437,7 +1437,7 @@ u32 sceKernelGetThreadmanIdList(u32 type, u32 readBufPtr, u32 readBufSize, u32 i } } } else { - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelGetThreadmanIdList(%i, %08x, %i, %08x): invalid type", type, readBufPtr, readBufSize, idCountPtr); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelGetThreadmanIdList(%i, %08x, %i, %08x): invalid type", type, readBufPtr, readBufSize, idCountPtr); return SCE_KERNEL_ERROR_ILLEGAL_TYPE; } @@ -1495,7 +1495,7 @@ u32 __KernelResumeThreadFromWait(SceUID threadID, u32 retval) } else { - ERROR_LOG(SCEKERNEL, "__KernelResumeThreadFromWait(%d): bad thread: %08x", threadID, error); + ERROR_LOG(Log::sceKernel, "__KernelResumeThreadFromWait(%d): bad thread: %08x", threadID, error); return error; } } @@ -1512,7 +1512,7 @@ u32 __KernelResumeThreadFromWait(SceUID threadID, u64 retval) } else { - ERROR_LOG(SCEKERNEL, "__KernelResumeThreadFromWait(%d): bad thread: %08x", threadID, error); + ERROR_LOG(Log::sceKernel, "__KernelResumeThreadFromWait(%d): bad thread: %08x", threadID, error); return error; } } @@ -1520,14 +1520,14 @@ u32 __KernelResumeThreadFromWait(SceUID threadID, u64 retval) // makes the current thread wait for an event void __KernelWaitCurThread(WaitType type, SceUID waitID, u32 waitValue, u32 timeoutPtr, bool processCallbacks, const char *reason) { if (!dispatchEnabled) { - WARN_LOG_REPORT(SCEKERNEL, "Ignoring wait, dispatching disabled... right thing to do?"); + WARN_LOG_REPORT(Log::sceKernel, "Ignoring wait, dispatching disabled... right thing to do?"); return; } PSPThread *thread = __GetCurrentThread(); _assert_(thread != nullptr); if ((thread->nt.status & THREADSTATUS_WAIT) != 0) - WARN_LOG_REPORT(SCEKERNEL, "Waiting thread for %d that was already waiting for %d", type, thread->nt.waitType); + WARN_LOG_REPORT(Log::sceKernel, "Waiting thread for %d that was already waiting for %d", type, thread->nt.waitType); thread->nt.waitID = waitID; thread->nt.waitType = type; __KernelChangeThreadState(thread, ThreadStatus(THREADSTATUS_WAIT | (thread->nt.status & THREADSTATUS_SUSPEND))); @@ -1543,13 +1543,13 @@ void __KernelWaitCurThread(WaitType type, SceUID waitID, u32 waitValue, u32 time void __KernelWaitCallbacksCurThread(WaitType type, SceUID waitID, u32 waitValue, u32 timeoutPtr) { if (!dispatchEnabled) { - WARN_LOG_REPORT(SCEKERNEL, "Ignoring wait, dispatching disabled... right thing to do?"); + WARN_LOG_REPORT(Log::sceKernel, "Ignoring wait, dispatching disabled... right thing to do?"); return; } PSPThread *thread = __GetCurrentThread(); if ((thread->nt.status & THREADSTATUS_WAIT) != 0) - WARN_LOG_REPORT(SCEKERNEL, "Waiting thread for %d that was already waiting for %d", type, thread->nt.waitType); + WARN_LOG_REPORT(Log::sceKernel, "Waiting thread for %d that was already waiting for %d", type, thread->nt.waitType); thread->nt.waitID = waitID; thread->nt.waitType = type; __KernelChangeThreadState(thread, ThreadStatus(THREADSTATUS_WAIT | (thread->nt.status & THREADSTATUS_SUSPEND))); @@ -1639,7 +1639,7 @@ void __KernelStopThread(SceUID threadID, int exitStatus, const char *reason) t->nt.waitType = WAITTYPE_NONE; t->nt.waitID = 0; } else { - ERROR_LOG_REPORT(SCEKERNEL, "__KernelStopThread: thread %d does not exist (%s)", threadID, reason ? reason : "?"); + ERROR_LOG_REPORT(Log::sceKernel, "__KernelStopThread: thread %d does not exist (%s)", threadID, reason ? reason : "?"); } } @@ -1711,9 +1711,9 @@ static void __ReportThreadQueueEmpty() { sprintf(idleDescription1, "DELETED"); } - ERROR_LOG_REPORT_ONCE(threadqueueempty, SCEKERNEL, "Failed to reschedule: out of threads on queue (%d, %d)", idleStatus0, idleStatus1); - WARN_LOG(SCEKERNEL, "Failed to reschedule: idle0 -> %s", idleDescription0); - WARN_LOG(SCEKERNEL, "Failed to reschedule: idle1 -> %s", idleDescription1); + ERROR_LOG_REPORT_ONCE(threadqueueempty, Log::sceKernel, "Failed to reschedule: out of threads on queue (%d, %d)", idleStatus0, idleStatus1); + WARN_LOG(Log::sceKernel, "Failed to reschedule: idle0 -> %s", idleDescription0); + WARN_LOG(Log::sceKernel, "Failed to reschedule: idle1 -> %s", idleDescription1); } // Returns NULL if the current thread is fine. @@ -1788,10 +1788,10 @@ int sceKernelCheckThreadStack() PSPThread *t = kernelObjects.Get(__KernelGetCurThread(), error); if (t) { u32 diff = labs((long)((s64)currentMIPS->r[MIPS_REG_SP] - (s64)t->currentStack.start)); - DEBUG_LOG(SCEKERNEL, "%i=sceKernelCheckThreadStack()", diff); + DEBUG_LOG(Log::sceKernel, "%i=sceKernelCheckThreadStack()", diff); return diff; } else { - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelCheckThreadStack() - not on thread"); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelCheckThreadStack() - not on thread"); return -1; } } @@ -1855,7 +1855,7 @@ void __KernelResetThread(PSPThread *t, int lowestPriority) { t->FillStack(); if (!t->waitingThreads.empty()) - ERROR_LOG_REPORT(SCEKERNEL, "Resetting thread with threads waiting on end?"); + ERROR_LOG_REPORT(Log::sceKernel, "Resetting thread with threads waiting on end?"); } PSPThread *__KernelCreateThread(SceUID &id, SceUID moduleId, const char *name, u32 entryPoint, u32 priority, int stacksize, u32 attr) { @@ -1910,7 +1910,7 @@ SceUID __KernelSetupRootThread(SceUID moduleID, int args, const char *argp, int SceUID id; PSPThread *thread = __KernelCreateThread(id, moduleID, "root", currentMIPS->pc, prio, stacksize, attr); if (thread->currentStack.start == 0) - ERROR_LOG_REPORT(SCEKERNEL, "Unable to allocate stack for root thread."); + ERROR_LOG_REPORT(Log::sceKernel, "Unable to allocate stack for root thread."); __KernelResetThread(thread, 0); PSPThread *prevThread = __GetCurrentThread(); @@ -1948,23 +1948,23 @@ SceUID __KernelCreateThreadInternal(const char *threadName, SceUID moduleID, u32 int __KernelCreateThread(const char *threadName, SceUID moduleID, u32 entry, u32 prio, int stacksize, u32 attr, u32 optionAddr, bool allowKernel) { if (threadName == nullptr) - return hleReportError(SCEKERNEL, SCE_KERNEL_ERROR_ERROR, "NULL thread name"); + return hleReportError(Log::sceKernel, SCE_KERNEL_ERROR_ERROR, "NULL thread name"); if ((u32)stacksize < 0x200) - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_STACK_SIZE, "bogus thread stack size %08x", stacksize); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_STACK_SIZE, "bogus thread stack size %08x", stacksize); if (prio < 0x08 || prio > 0x77) { - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "bogus thread priority %08x", prio); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "bogus thread priority %08x", prio); } if (!Memory::IsValidAddress(entry)) { // The PSP firmware seems to allow NULL...? if (entry != 0) - return hleReportError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid thread entry %08x", entry); + return hleReportError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid thread entry %08x", entry); } if ((attr & ~PSP_THREAD_ATTR_USER_MASK) != 0 && !allowKernel) - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "illegal thread attributes %08x", attr); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "illegal thread attributes %08x", attr); if ((attr & ~PSP_THREAD_ATTR_SUPPORTED) != 0) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateThread(name=%s): unsupported attributes %08x", threadName, attr); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateThread(name=%s): unsupported attributes %08x", threadName, attr); // TODO: Not sure what these values are, but they are removed from the attr silently. // Some are USB/VSH specific, probably removes when they are from the wrong module? @@ -1980,10 +1980,10 @@ int __KernelCreateThread(const char *threadName, SceUID moduleID, u32 entry, u32 SceUID id = __KernelCreateThreadInternal(threadName, moduleID, entry, prio, stacksize, attr); if ((u32)id == SCE_KERNEL_ERROR_NO_MEMORY) - return hleReportError(SCEKERNEL, SCE_KERNEL_ERROR_NO_MEMORY, "out of memory, %08x stack requested", stacksize); + return hleReportError(Log::sceKernel, SCE_KERNEL_ERROR_NO_MEMORY, "out of memory, %08x stack requested", stacksize); if (optionAddr != 0) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateThread(name=%s): unsupported options parameter %08x", threadName, optionAddr); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateThread(name=%s): unsupported options parameter %08x", threadName, optionAddr); // Creating a thread resumes dispatch automatically. Probably can't create without it. dispatchEnabled = true; @@ -1996,7 +1996,7 @@ int __KernelCreateThread(const char *threadName, SceUID moduleID, u32 entry, u32 // Before triggering, set v0, since we restore on return. RETURN(id); __KernelThreadTriggerEvent((attr & PSP_THREAD_ATTR_KERNEL) != 0, id, THREADEVENT_CREATE); - return hleLogSuccessInfoI(SCEKERNEL, id); + return hleLogSuccessInfoI(Log::sceKernel, id); } int sceKernelCreateThread(const char *threadName, u32 entry, u32 prio, int stacksize, u32 attr, u32 optionAddr) { @@ -2075,17 +2075,17 @@ int __KernelStartThread(SceUID threadToStartID, int argSize, u32 argBlockPtr, bo int __KernelStartThreadValidate(SceUID threadToStartID, int argSize, u32 argBlockPtr, bool forceArgs) { if (threadToStartID == 0) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_THID, "thread id is 0"); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_THID, "thread id is 0"); if (argSize < 0 || argBlockPtr & 0x80000000) - return hleReportError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "bad thread argument pointer/length %08x / %08x", argSize, argBlockPtr); + return hleReportError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "bad thread argument pointer/length %08x / %08x", argSize, argBlockPtr); u32 error = 0; PSPThread *startThread = kernelObjects.Get(threadToStartID, error); if (startThread == 0) - return hleLogError(SCEKERNEL, error, "thread does not exist"); + return hleLogError(Log::sceKernel, error, "thread does not exist"); if (startThread->nt.status != THREADSTATUS_DORMANT) - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_NOT_DORMANT, "thread already running"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_NOT_DORMANT, "thread already running"); hleEatCycles(3400); return __KernelStartThread(threadToStartID, argSize, argBlockPtr, forceArgs); @@ -2093,12 +2093,12 @@ int __KernelStartThreadValidate(SceUID threadToStartID, int argSize, u32 argBloc // int sceKernelStartThread(SceUID threadToStartID, SceSize argSize, void *argBlock) int sceKernelStartThread(SceUID threadToStartID, int argSize, u32 argBlockPtr) { - return hleLogSuccessInfoI(SCEKERNEL, __KernelStartThreadValidate(threadToStartID, argSize, argBlockPtr)); + return hleLogSuccessInfoI(Log::sceKernel, __KernelStartThreadValidate(threadToStartID, argSize, argBlockPtr)); } int sceKernelGetThreadStackFreeSize(SceUID threadID) { - DEBUG_LOG(SCEKERNEL, "sceKernelGetThreadStackFreeSize(%i)", threadID); + DEBUG_LOG(Log::sceKernel, "sceKernelGetThreadStackFreeSize(%i)", threadID); if (threadID == 0) threadID = __KernelGetCurThread(); @@ -2106,7 +2106,7 @@ int sceKernelGetThreadStackFreeSize(SceUID threadID) u32 error; PSPThread *thread = kernelObjects.Get(threadID, error); if (thread == nullptr) { - ERROR_LOG(SCEKERNEL, "sceKernelGetThreadStackFreeSize: invalid thread id %i", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelGetThreadStackFreeSize: invalid thread id %i", threadID); return error; } @@ -2131,7 +2131,7 @@ void __KernelReturnFromThread() PSPThread *thread = __GetCurrentThread(); _dbg_assert_msg_(thread != NULL, "Returned from a NULL thread."); - DEBUG_LOG(SCEKERNEL, "__KernelReturnFromThread: %d", exitStatus); + DEBUG_LOG(Log::sceKernel, "__KernelReturnFromThread: %d", exitStatus); __KernelStopThread(currentThread, exitStatus, "thread returned"); hleReSchedule("thread returned"); @@ -2144,11 +2144,11 @@ void __KernelReturnFromThread() int sceKernelExitThread(int exitStatus) { if (!__KernelIsDispatchEnabled() && sceKernelGetCompiledSdkVersion() >= 0x03080000) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_CAN_NOT_WAIT); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_CAN_NOT_WAIT); PSPThread *thread = __GetCurrentThread(); _dbg_assert_msg_(thread != NULL, "Exited from a NULL thread."); - INFO_LOG(SCEKERNEL, "sceKernelExitThread(%d)", exitStatus); + INFO_LOG(Log::sceKernel, "sceKernelExitThread(%d)", exitStatus); if (exitStatus < 0) { exitStatus = SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT; } @@ -2167,7 +2167,7 @@ void _sceKernelExitThread(int exitStatus) { PSPThread *thread = __GetCurrentThread(); _dbg_assert_msg_(thread != NULL, "_Exited from a NULL thread."); - ERROR_LOG_REPORT(SCEKERNEL, "_sceKernelExitThread(%d): should not be called directly", exitStatus); + ERROR_LOG_REPORT(Log::sceKernel, "_sceKernelExitThread(%d): should not be called directly", exitStatus); __KernelStopThread(currentThread, exitStatus, "thread _exited"); hleReSchedule("thread _exited"); @@ -2180,11 +2180,11 @@ void _sceKernelExitThread(int exitStatus) { int sceKernelExitDeleteThread(int exitStatus) { if (!__KernelIsDispatchEnabled() && sceKernelGetCompiledSdkVersion() >= 0x03080000) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_CAN_NOT_WAIT); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_CAN_NOT_WAIT); PSPThread *thread = __GetCurrentThread(); if (thread) { - INFO_LOG(SCEKERNEL,"sceKernelExitDeleteThread(%d)", exitStatus); + INFO_LOG(Log::sceKernel,"sceKernelExitDeleteThread(%d)", exitStatus); uint32_t thread_attr = thread->nt.attr; uint32_t uid = thread->GetUID(); __KernelDeleteThread(currentThread, exitStatus, "thread exited with delete"); @@ -2197,7 +2197,7 @@ int sceKernelExitDeleteThread(int exitStatus) { __KernelThreadTriggerEvent((thread_attr & PSP_THREAD_ATTR_KERNEL) != 0, uid, THREADEVENT_EXIT); } else - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelExitDeleteThread(%d) ERROR - could not find myself!", exitStatus); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelExitDeleteThread(%d) ERROR - could not find myself!", exitStatus); return 0; } @@ -2205,13 +2205,13 @@ u32 sceKernelSuspendDispatchThread() { if (!__InterruptsEnabled()) { - DEBUG_LOG(SCEKERNEL, "sceKernelSuspendDispatchThread(): interrupts disabled"); + DEBUG_LOG(Log::sceKernel, "sceKernelSuspendDispatchThread(): interrupts disabled"); return SCE_KERNEL_ERROR_CPUDI; } u32 oldDispatchEnabled = dispatchEnabled; dispatchEnabled = false; - DEBUG_LOG(SCEKERNEL, "%i=sceKernelSuspendDispatchThread()", oldDispatchEnabled); + DEBUG_LOG(Log::sceKernel, "%i=sceKernelSuspendDispatchThread()", oldDispatchEnabled); hleEatCycles(940); return oldDispatchEnabled; } @@ -2220,13 +2220,13 @@ u32 sceKernelResumeDispatchThread(u32 enabled) { if (!__InterruptsEnabled()) { - DEBUG_LOG(SCEKERNEL, "sceKernelResumeDispatchThread(%i): interrupts disabled", enabled); + DEBUG_LOG(Log::sceKernel, "sceKernelResumeDispatchThread(%i): interrupts disabled", enabled); return SCE_KERNEL_ERROR_CPUDI; } u32 oldDispatchEnabled = dispatchEnabled; dispatchEnabled = enabled != 0; - DEBUG_LOG(SCEKERNEL, "sceKernelResumeDispatchThread(%i) - from %i", enabled, oldDispatchEnabled); + DEBUG_LOG(Log::sceKernel, "sceKernelResumeDispatchThread(%i) - from %i", enabled, oldDispatchEnabled); hleReSchedule("dispatch resumed"); hleEatCycles(940); return 0; @@ -2268,12 +2268,12 @@ int sceKernelRotateThreadReadyQueue(int priority) { hleReSchedule("rotatethreadreadyqueue"); hleEatCycles(250); } - return hleLogSuccessVerboseI(SCEKERNEL, result); + return hleLogSuccessVerboseI(Log::sceKernel, result); } int sceKernelDeleteThread(int threadID) { if (threadID == 0 || threadID == currentThread) { - ERROR_LOG(SCEKERNEL, "sceKernelDeleteThread(%i): cannot delete current thread", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelDeleteThread(%i): cannot delete current thread", threadID); return SCE_KERNEL_ERROR_NOT_DORMANT; } @@ -2281,14 +2281,14 @@ int sceKernelDeleteThread(int threadID) { PSPThread *t = kernelObjects.Get(threadID, error); if (t) { if (!t->isStopped()) { - ERROR_LOG(SCEKERNEL, "sceKernelDeleteThread(%i): thread not dormant", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelDeleteThread(%i): thread not dormant", threadID); return SCE_KERNEL_ERROR_NOT_DORMANT; } - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteThread(%i)", threadID); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteThread(%i)", threadID); return __KernelDeleteThread(threadID, SCE_KERNEL_ERROR_THREAD_TERMINATED, "thread deleted"); } else { - ERROR_LOG(SCEKERNEL, "sceKernelDeleteThread(%i): thread doesn't exist", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelDeleteThread(%i): thread doesn't exist", threadID); return error; } } @@ -2297,11 +2297,11 @@ int sceKernelTerminateDeleteThread(int threadID) { if (threadID == 0 || threadID == currentThread) { - ERROR_LOG(SCEKERNEL, "sceKernelTerminateDeleteThread(%i): cannot terminate current thread", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelTerminateDeleteThread(%i): cannot terminate current thread", threadID); return SCE_KERNEL_ERROR_ILLEGAL_THID; } if (!__KernelIsDispatchEnabled() && sceKernelGetCompiledSdkVersion() >= 0x03080000) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_CAN_NOT_WAIT); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_CAN_NOT_WAIT); u32 error; PSPThread *t = kernelObjects.Get(threadID, error); @@ -2311,7 +2311,7 @@ int sceKernelTerminateDeleteThread(int threadID) uint32_t attr = t->nt.attr; uint32_t uid = t->GetUID(); - INFO_LOG(SCEKERNEL, "sceKernelTerminateDeleteThread(%i)", threadID); + INFO_LOG(Log::sceKernel, "sceKernelTerminateDeleteThread(%i)", threadID); error = __KernelDeleteThread(threadID, SCE_KERNEL_ERROR_THREAD_TERMINATED, "thread terminated with delete"); if (!wasStopped) { @@ -2324,26 +2324,26 @@ int sceKernelTerminateDeleteThread(int threadID) } else { - ERROR_LOG(SCEKERNEL, "sceKernelTerminateDeleteThread(%i): thread doesn't exist", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelTerminateDeleteThread(%i): thread doesn't exist", threadID); return error; } } int sceKernelTerminateThread(SceUID threadID) { if (__IsInInterrupt() && sceKernelGetCompiledSdkVersion() >= 0x03080000) { - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "in interrupt"); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "in interrupt"); } if (!__KernelIsDispatchEnabled() && sceKernelGetCompiledSdkVersion() >= 0x03080000) - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_CAN_NOT_WAIT); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_CAN_NOT_WAIT); if (threadID == 0 || threadID == currentThread) { - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_THID, "cannot terminate current thread"); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_THID, "cannot terminate current thread"); } u32 error; PSPThread *t = kernelObjects.Get(threadID, error); if (t) { if (t->isStopped()) { - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_DORMANT, "already stopped"); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_DORMANT, "already stopped"); } // TODO: Should this reschedule? Seems like not. @@ -2356,9 +2356,9 @@ int sceKernelTerminateThread(SceUID threadID) { RETURN(0); __KernelThreadTriggerEvent((t->nt.attr & PSP_THREAD_ATTR_KERNEL) != 0, t->GetUID(), THREADEVENT_EXIT); - return hleLogSuccessInfoI(SCEKERNEL, 0); + return hleLogSuccessInfoI(Log::sceKernel, 0); } else { - return hleLogError(SCEKERNEL, error, "thread doesn't exist"); + return hleLogError(Log::sceKernel, error, "thread doesn't exist"); } } @@ -2397,28 +2397,28 @@ u32 __KernelGetCurThreadStackStart() { SceUID sceKernelGetThreadId() { - VERBOSE_LOG(SCEKERNEL, "%i = sceKernelGetThreadId()", currentThread); + VERBOSE_LOG(Log::sceKernel, "%i = sceKernelGetThreadId()", currentThread); hleEatCycles(180); return currentThread; } int sceKernelGetThreadCurrentPriority() { u32 retVal = __GetCurrentThread()->nt.currentPriority; - return hleLogSuccessI(SCEKERNEL, retVal); + return hleLogSuccessI(Log::sceKernel, retVal); } int sceKernelChangeCurrentThreadAttr(u32 clearAttr, u32 setAttr) { // Seems like this is the only allowed attribute? if ((clearAttr & ~PSP_THREAD_ATTR_VFPU) != 0 || (setAttr & ~PSP_THREAD_ATTR_VFPU) != 0) { - return hleReportError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr"); + return hleReportError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid attr"); } PSPThread *t = __GetCurrentThread(); if (!t) - return hleReportError(SCEKERNEL, -1, "no current thread"); + return hleReportError(Log::sceKernel, -1, "no current thread"); t->nt.attr = (t->nt.attr & ~clearAttr) | setAttr; - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } // Assumes validated parameters. @@ -2452,7 +2452,7 @@ int sceKernelChangeThreadPriority(SceUID threadID, int priority) { if (priority == 0) { PSPThread *cur = __GetCurrentThread(); if (!cur) { - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelChangeThreadPriority(%i, %i): no current thread?", threadID, priority); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelChangeThreadPriority(%i, %i): no current thread?", threadID, priority); } else { priority = cur->nt.currentPriority; } @@ -2462,11 +2462,11 @@ int sceKernelChangeThreadPriority(SceUID threadID, int priority) { PSPThread *thread = kernelObjects.Get(threadID, error); if (thread) { if (thread->isStopped()) { - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_DORMANT, "thread is dormant"); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_DORMANT, "thread is dormant"); } if (priority < 0x08 || priority > 0x77) { - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "bogus priority"); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "bogus priority"); } KernelChangeThreadPriority(threadID, priority); @@ -2474,9 +2474,9 @@ int sceKernelChangeThreadPriority(SceUID threadID, int priority) { hleEatCycles(450); hleReSchedule("change thread priority"); - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogError(SCEKERNEL, error, "thread not found"); + return hleLogError(Log::sceKernel, error, "thread not found"); } } @@ -2507,7 +2507,7 @@ int sceKernelDelayThreadCB(u32 usec) { s64 delayUs = __KernelDelayThreadUs(usec); __KernelScheduleWakeup(curThread, delayUs); __KernelWaitCurThread(WAITTYPE_DELAY, curThread, 0, 0, true, "thread delayed"); - return hleLogSuccessI(SCEKERNEL, 0, "delaying %lld usecs", delayUs); + return hleLogSuccessI(Log::sceKernel, 0, "delaying %lld usecs", delayUs); } int sceKernelDelayThread(u32 usec) { @@ -2518,14 +2518,14 @@ int sceKernelDelayThread(u32 usec) { s64 delayUs = __KernelDelayThreadUs(usec); __KernelScheduleWakeup(curThread, delayUs); __KernelWaitCurThread(WAITTYPE_DELAY, curThread, 0, 0, false, "thread delayed"); - return hleLogSuccessI(SCEKERNEL, 0, "delaying %lld usecs", delayUs); + return hleLogSuccessI(Log::sceKernel, 0, "delaying %lld usecs", delayUs); } int sceKernelDelaySysClockThreadCB(u32 sysclockAddr) { auto sysclock = PSPPointer::Create(sysclockAddr); if (!sysclock.IsValid()) { // Note: crashes on real firmware. - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad pointer"); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad pointer"); } // This is just a u64 of usecs. All bits are respected, but overflow can happen for very large values. @@ -2535,14 +2535,14 @@ int sceKernelDelaySysClockThreadCB(u32 sysclockAddr) { s64 delayUs = __KernelDelayThreadUs(usec); __KernelScheduleWakeup(curThread, delayUs); __KernelWaitCurThread(WAITTYPE_DELAY, curThread, 0, 0, true, "thread delayed"); - return hleLogSuccessI(SCEKERNEL, 0, "delaying %lld usecs", delayUs); + return hleLogSuccessI(Log::sceKernel, 0, "delaying %lld usecs", delayUs); } int sceKernelDelaySysClockThread(u32 sysclockAddr) { auto sysclock = PSPPointer::Create(sysclockAddr); if (!sysclock.IsValid()) { // Note: crashes on real firmware. - return hleLogError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad pointer"); + return hleLogError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad pointer"); } // This is just a u64 of usecs. All bits are respected, but overflow can happen for very large values. @@ -2552,7 +2552,7 @@ int sceKernelDelaySysClockThread(u32 sysclockAddr) { s64 delayUs = __KernelDelayThreadUs(usec); __KernelScheduleWakeup(curThread, delayUs); __KernelWaitCurThread(WAITTYPE_DELAY, curThread, 0, 0, false, "thread delayed"); - return hleLogSuccessI(SCEKERNEL, 0, "delaying %lld usecs", delayUs); + return hleLogSuccessI(Log::sceKernel, 0, "delaying %lld usecs", delayUs); } u32 __KernelGetThreadPrio(SceUID id) { @@ -2573,7 +2573,7 @@ bool __KernelThreadSortPriority(SceUID thread1, SceUID thread2) ////////////////////////////////////////////////////////////////////////// int sceKernelWakeupThread(SceUID uid) { if (uid == currentThread) { - return hleLogWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_THID, "unable to wakeup current thread"); + return hleLogWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_THID, "unable to wakeup current thread"); } u32 error; @@ -2581,14 +2581,14 @@ int sceKernelWakeupThread(SceUID uid) { if (t) { if (!t->isWaitingFor(WAITTYPE_SLEEP, 0)) { t->nt.wakeupCount++; - return hleLogSuccessI(SCEKERNEL, 0, "wakeupCount incremented to %i", t->nt.wakeupCount); + return hleLogSuccessI(Log::sceKernel, 0, "wakeupCount incremented to %i", t->nt.wakeupCount); } else { __KernelResumeThreadFromWait(uid, 0); hleReSchedule("thread woken up"); - return hleLogSuccessVerboseI(SCEKERNEL, 0, "woke thread at %i", t->nt.wakeupCount); + return hleLogSuccessVerboseI(Log::sceKernel, 0, "woke thread at %i", t->nt.wakeupCount); } } else { - return hleLogError(SCEKERNEL, error, "bad thread id"); + return hleLogError(Log::sceKernel, error, "bad thread id"); } } @@ -2602,25 +2602,25 @@ int sceKernelCancelWakeupThread(SceUID uid) { if (t) { int wCount = t->nt.wakeupCount; t->nt.wakeupCount = 0; - return hleLogSuccessI(SCEKERNEL, wCount, "wakeupCount reset to 0"); + return hleLogSuccessI(Log::sceKernel, wCount, "wakeupCount reset to 0"); } else { - return hleLogError(SCEKERNEL, error, "bad thread id"); + return hleLogError(Log::sceKernel, error, "bad thread id"); } } static int __KernelSleepThread(bool doCallbacks) { PSPThread *thread = __GetCurrentThread(); if (!thread) { - ERROR_LOG_REPORT(SCEKERNEL, "sceKernelSleepThread*(): bad current thread"); + ERROR_LOG_REPORT(Log::sceKernel, "sceKernelSleepThread*(): bad current thread"); return -1; } if (thread->nt.wakeupCount > 0) { thread->nt.wakeupCount--; - return hleLogSuccessI(SCEKERNEL, 0, "wakeupCount decremented to %i", thread->nt.wakeupCount); + return hleLogSuccessI(Log::sceKernel, 0, "wakeupCount decremented to %i", thread->nt.wakeupCount); } else { __KernelWaitCurThread(WAITTYPE_SLEEP, 0, 0, 0, doCallbacks, "thread slept"); - return hleLogSuccessVerboseI(SCEKERNEL, 0, "sleeping"); + return hleLogSuccessVerboseI(Log::sceKernel, 0, "sleeping"); } return 0; } @@ -2636,7 +2636,7 @@ int sceKernelSleepThreadCB() { int sceKernelWaitThreadEnd(SceUID threadID, u32 timeoutPtr) { - DEBUG_LOG(SCEKERNEL, "sceKernelWaitThreadEnd(%i, %08x)", threadID, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelWaitThreadEnd(%i, %08x)", threadID, timeoutPtr); if (threadID == 0 || threadID == currentThread) return SCE_KERNEL_ERROR_ILLEGAL_THID; @@ -2662,14 +2662,14 @@ int sceKernelWaitThreadEnd(SceUID threadID, u32 timeoutPtr) } else { - ERROR_LOG(SCEKERNEL, "sceKernelWaitThreadEnd - bad thread %i", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelWaitThreadEnd - bad thread %i", threadID); return error; } } int sceKernelWaitThreadEndCB(SceUID threadID, u32 timeoutPtr) { - DEBUG_LOG(SCEKERNEL, "sceKernelWaitThreadEndCB(%i, 0x%X)", threadID, timeoutPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelWaitThreadEndCB(%i, 0x%X)", threadID, timeoutPtr); if (threadID == 0 || threadID == currentThread) return SCE_KERNEL_ERROR_ILLEGAL_THID; @@ -2697,16 +2697,16 @@ int sceKernelWaitThreadEndCB(SceUID threadID, u32 timeoutPtr) } else { - ERROR_LOG(SCEKERNEL, "sceKernelWaitThreadEndCB - bad thread %i", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelWaitThreadEndCB - bad thread %i", threadID); return error; } } int sceKernelReleaseWaitThread(SceUID threadID) { - DEBUG_LOG(SCEKERNEL, "sceKernelReleaseWaitThread(%i)", threadID); + DEBUG_LOG(Log::sceKernel, "sceKernelReleaseWaitThread(%i)", threadID); if (__KernelInCallback()) - WARN_LOG_REPORT(SCEKERNEL, "UNTESTED sceKernelReleaseWaitThread() might not do the right thing in a callback"); + WARN_LOG_REPORT(Log::sceKernel, "UNTESTED sceKernelReleaseWaitThread() might not do the right thing in a callback"); if (threadID == 0 || threadID == currentThread) return SCE_KERNEL_ERROR_ILLEGAL_THID; @@ -2719,12 +2719,12 @@ int sceKernelReleaseWaitThread(SceUID threadID) return SCE_KERNEL_ERROR_NOT_WAIT; if (t->nt.waitType == WAITTYPE_HLEDELAY) { - WARN_LOG_REPORT_ONCE(rwt_delay, SCEKERNEL, "sceKernelReleaseWaitThread(): Refusing to wake HLE-delayed thread, right thing to do?"); + WARN_LOG_REPORT_ONCE(rwt_delay, Log::sceKernel, "sceKernelReleaseWaitThread(): Refusing to wake HLE-delayed thread, right thing to do?"); return SCE_KERNEL_ERROR_NOT_WAIT; } if (t->nt.waitType == WAITTYPE_MODULE) { - WARN_LOG_REPORT_ONCE(rwt_sm, SCEKERNEL, "sceKernelReleaseWaitThread(): Refusing to wake start_module thread, right thing to do?"); + WARN_LOG_REPORT_ONCE(rwt_sm, Log::sceKernel, "sceKernelReleaseWaitThread(): Refusing to wake start_module thread, right thing to do?"); return SCE_KERNEL_ERROR_NOT_WAIT; } @@ -2734,7 +2734,7 @@ int sceKernelReleaseWaitThread(SceUID threadID) } else { - ERROR_LOG(SCEKERNEL, "sceKernelReleaseWaitThread - bad thread %i", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelReleaseWaitThread - bad thread %i", threadID); return error; } } @@ -2744,7 +2744,7 @@ int sceKernelSuspendThread(SceUID threadID) // TODO: What about interrupts/callbacks? if (threadID == 0 || threadID == currentThread) { - ERROR_LOG(SCEKERNEL, "sceKernelSuspendThread(%d): cannot suspend current thread", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelSuspendThread(%d): cannot suspend current thread", threadID); return SCE_KERNEL_ERROR_ILLEGAL_THID; } @@ -2754,16 +2754,16 @@ int sceKernelSuspendThread(SceUID threadID) { if (t->isStopped()) { - ERROR_LOG(SCEKERNEL, "sceKernelSuspendThread(%d): thread not running", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelSuspendThread(%d): thread not running", threadID); return SCE_KERNEL_ERROR_DORMANT; } if (t->isSuspended()) { - ERROR_LOG(SCEKERNEL, "sceKernelSuspendThread(%d): thread already suspended", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelSuspendThread(%d): thread already suspended", threadID); return SCE_KERNEL_ERROR_SUSPEND; } - DEBUG_LOG(SCEKERNEL, "sceKernelSuspendThread(%d)", threadID); + DEBUG_LOG(Log::sceKernel, "sceKernelSuspendThread(%d)", threadID); if (t->isReady()) __KernelChangeReadyState(t, threadID, false); t->nt.status = (t->nt.status & ~THREADSTATUS_READY) | THREADSTATUS_SUSPEND; @@ -2771,7 +2771,7 @@ int sceKernelSuspendThread(SceUID threadID) } else { - ERROR_LOG(SCEKERNEL, "sceKernelSuspendThread(%d): bad thread", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelSuspendThread(%d): bad thread", threadID); return error; } } @@ -2781,7 +2781,7 @@ int sceKernelResumeThread(SceUID threadID) // TODO: What about interrupts/callbacks? if (threadID == 0 || threadID == currentThread) { - ERROR_LOG(SCEKERNEL, "sceKernelResumeThread(%d): cannot suspend current thread", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelResumeThread(%d): cannot suspend current thread", threadID); return SCE_KERNEL_ERROR_ILLEGAL_THID; } @@ -2791,10 +2791,10 @@ int sceKernelResumeThread(SceUID threadID) { if (!t->isSuspended()) { - ERROR_LOG(SCEKERNEL, "sceKernelResumeThread(%d): thread not suspended", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelResumeThread(%d): thread not suspended", threadID); return SCE_KERNEL_ERROR_NOT_SUSPEND; } - DEBUG_LOG(SCEKERNEL, "sceKernelResumeThread(%d)", threadID); + DEBUG_LOG(Log::sceKernel, "sceKernelResumeThread(%d)", threadID); t->nt.status &= ~THREADSTATUS_SUSPEND; // If it was dormant, waiting, etc. before we don't flip its ready state. @@ -2805,7 +2805,7 @@ int sceKernelResumeThread(SceUID threadID) } else { - ERROR_LOG(SCEKERNEL, "sceKernelResumeThread(%d): bad thread", threadID); + ERROR_LOG(Log::sceKernel, "sceKernelResumeThread(%d): bad thread", threadID); return error; } } @@ -2819,9 +2819,9 @@ int sceKernelResumeThread(SceUID threadID) SceUID sceKernelCreateCallback(const char *name, u32 entrypoint, u32 signalArg) { if (!name) - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ERROR, "invalid name"); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ERROR, "invalid name"); if (entrypoint & 0xF0000000) - return hleReportWarning(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid func"); + return hleReportWarning(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "invalid func"); PSPCallback *cb = new PSPCallback(); SceUID id = kernelObjects.Create(cb); @@ -2839,7 +2839,7 @@ SceUID sceKernelCreateCallback(const char *name, u32 entrypoint, u32 signalArg) if (thread) thread->callbacks.push_back(id); - return hleLogSuccessI(SCEKERNEL, id); + return hleLogSuccessI(Log::sceKernel, id); } int sceKernelDeleteCallback(SceUID cbId) @@ -2854,9 +2854,9 @@ int sceKernelDeleteCallback(SceUID cbId) if (cb->nc.notifyCount != 0) readyCallbacksCount--; - return hleLogSuccessI(SCEKERNEL, kernelObjects.Destroy(cbId)); + return hleLogSuccessI(Log::sceKernel, kernelObjects.Destroy(cbId)); } else { - return hleLogError(SCEKERNEL, error, "bad cbId"); + return hleLogError(Log::sceKernel, error, "bad cbId"); } } @@ -2867,9 +2867,9 @@ int sceKernelNotifyCallback(SceUID cbId, int notifyArg) PSPCallback *cb = kernelObjects.Get(cbId, error); if (cb) { __KernelNotifyCallback(cbId, notifyArg); - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogError(SCEKERNEL, error, "bad cbId"); + return hleLogError(Log::sceKernel, error, "bad cbId"); } } @@ -2880,9 +2880,9 @@ int sceKernelCancelCallback(SceUID cbId) if (cb) { // This just resets the notify count. cb->nc.notifyArg = 0; - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogError(SCEKERNEL, error, "bad cbId"); + return hleLogError(Log::sceKernel, error, "bad cbId"); } } @@ -2891,9 +2891,9 @@ int sceKernelGetCallbackCount(SceUID cbId) u32 error; PSPCallback *cb = kernelObjects.Get(cbId, error); if (cb) { - return hleLogSuccessVerboseI(SCEKERNEL, cb->nc.notifyCount); + return hleLogSuccessVerboseI(Log::sceKernel, cb->nc.notifyCount); } else { - return hleLogError(SCEKERNEL, error, "bad cbId"); + return hleLogError(Log::sceKernel, error, "bad cbId"); } } @@ -2905,26 +2905,26 @@ int sceKernelReferCallbackStatus(SceUID cbId, u32 statusAddr) { if (status.IsValid() && status->size != 0) { *status = c->nc; status.NotifyWrite("CallbackStatus"); - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogDebug(SCEKERNEL, 0, "struct size was 0"); + return hleLogDebug(Log::sceKernel, 0, "struct size was 0"); } } else { - return hleLogError(SCEKERNEL, error, "bad cbId"); + return hleLogError(Log::sceKernel, error, "bad cbId"); } } u32 sceKernelExtendThreadStack(u32 size, u32 entryAddr, u32 entryParameter) { if (size < 512) - return hleReportError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_STACK_SIZE, "xxx", "stack size too small"); + return hleReportError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_STACK_SIZE, "xxx", "stack size too small"); PSPThread *thread = __GetCurrentThread(); if (!thread) - return hleReportError(SCEKERNEL, -1, "xxx", "not on a thread?"); + return hleReportError(Log::sceKernel, -1, "xxx", "not on a thread?"); if (!thread->PushExtendedStack(size)) - return hleReportError(SCEKERNEL, SCE_KERNEL_ERROR_NO_MEMORY, "xxx", "could not allocate new stack"); + return hleReportError(Log::sceKernel, SCE_KERNEL_ERROR_NO_MEMORY, "xxx", "could not allocate new stack"); // The stack has been changed now, so it's do or die time. @@ -2942,7 +2942,7 @@ u32 sceKernelExtendThreadStack(u32 size, u32 entryAddr, u32 entryParameter) currentMIPS->r[MIPS_REG_SP] = thread->currentStack.end - 0x10; hleSkipDeadbeef(); - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } void __KernelReturnFromExtendStack() @@ -2952,7 +2952,7 @@ void __KernelReturnFromExtendStack() PSPThread *thread = __GetCurrentThread(); if (!thread) { - ERROR_LOG_REPORT(SCEKERNEL, "__KernelReturnFromExtendStack() - not on a thread?"); + ERROR_LOG_REPORT(Log::sceKernel, "__KernelReturnFromExtendStack() - not on a thread?"); return; } @@ -2963,13 +2963,13 @@ void __KernelReturnFromExtendStack() if (!thread->PopExtendedStack()) { - ERROR_LOG_REPORT(SCEKERNEL, "__KernelReturnFromExtendStack() - no stack to restore?"); + ERROR_LOG_REPORT(Log::sceKernel, "__KernelReturnFromExtendStack() - no stack to restore?"); return; } KernelValidateThreadTarget(restorePC); - DEBUG_LOG(SCEKERNEL, "__KernelReturnFromExtendStack()"); + DEBUG_LOG(Log::sceKernel, "__KernelReturnFromExtendStack()"); currentMIPS->r[MIPS_REG_RA] = restoreRA; currentMIPS->r[MIPS_REG_SP] = restoreSP; currentMIPS->pc = restorePC; @@ -3079,7 +3079,7 @@ void __KernelSwitchContext(PSPThread *target, const char *reason) { s64 consumedCycles = nowCycles - lastSwitchCycles; lastSwitchCycles = nowCycles; - DEBUG_LOG(SCEKERNEL, "Context switch: %s -> %s (%i->%i, pc: %08x->%08x, %s) +%lldus", + DEBUG_LOG(Log::sceKernel, "Context switch: %s -> %s (%i->%i, pc: %08x->%08x, %s) +%lldus", oldName, hleCurrentThreadName, oldUID, currentThread, oldPC, currentMIPS->pc, @@ -3112,7 +3112,7 @@ void __KernelChangeThreadState(PSPThread *thread, ThreadStatus newStatus) { return; if (!dispatchEnabled && thread == __GetCurrentThread() && newStatus != THREADSTATUS_RUNNING) { - ERROR_LOG(SCEKERNEL, "Dispatching suspended, not changing thread state"); + ERROR_LOG(Log::sceKernel, "Dispatching suspended, not changing thread state"); return; } @@ -3124,7 +3124,7 @@ void __KernelChangeThreadState(PSPThread *thread, ThreadStatus newStatus) { if (newStatus == THREADSTATUS_WAIT) { if (thread->nt.waitType == WAITTYPE_NONE) { - ERROR_LOG(SCEKERNEL, "Waittype none not allowed here"); + ERROR_LOG(Log::sceKernel, "Waittype none not allowed here"); } // Schedule deletion of stopped threads here. if (thread->isStopped()) @@ -3140,7 +3140,7 @@ static bool __CanExecuteCallbackNow(PSPThread *thread) { // Takes ownership of afterAction. void __KernelCallAddress(PSPThread *thread, u32 entryPoint, PSPAction *afterAction, const u32 args[], int numargs, bool reschedAfter, SceUID cbId) { if (!thread || thread->isStopped()) { - WARN_LOG_REPORT(SCEKERNEL, "Running mipscall on dormant thread"); + WARN_LOG_REPORT(Log::sceKernel, "Running mipscall on dormant thread"); } _dbg_assert_msg_(numargs <= 6, "MipsCalls can only take 6 args."); @@ -3164,7 +3164,7 @@ void __KernelCallAddress(PSPThread *thread, u32 entryPoint, PSPAction *afterActi if (waitTypeFuncs[thread->nt.waitType].beginFunc != NULL) { waitTypeFuncs[thread->nt.waitType].beginFunc(after->threadID, thread->currentCallbackId); } else { - ERROR_LOG_REPORT(HLE, "Missing begin/restore funcs for wait type %d", thread->nt.waitType); + ERROR_LOG_REPORT(Log::HLE, "Missing begin/restore funcs for wait type %d", thread->nt.waitType); } } @@ -3198,10 +3198,10 @@ void __KernelCallAddress(PSPThread *thread, u32 entryPoint, PSPAction *afterActi if (!called) { if (thread) { - DEBUG_LOG(SCEKERNEL, "Making mipscall pending on thread"); + DEBUG_LOG(Log::sceKernel, "Making mipscall pending on thread"); thread->pendingMipsCalls.push_back(callId); } else { - WARN_LOG(SCEKERNEL, "Ignoring mispcall on NULL/deleted thread"); + WARN_LOG(Log::sceKernel, "Ignoring mispcall on NULL/deleted thread"); } } } @@ -3216,20 +3216,20 @@ bool __KernelExecuteMipsCallOnCurrentThread(u32 callId, bool reschedAfter) PSPThread *cur = __GetCurrentThread(); if (cur == nullptr) { - ERROR_LOG(SCEKERNEL, "__KernelExecuteMipsCallOnCurrentThread(): Bad current thread"); + ERROR_LOG(Log::sceKernel, "__KernelExecuteMipsCallOnCurrentThread(): Bad current thread"); return false; } if (g_inCbCount > 0) { - WARN_LOG_REPORT(SCEKERNEL, "__KernelExecuteMipsCallOnCurrentThread(): Already in a callback!"); + WARN_LOG_REPORT(Log::sceKernel, "__KernelExecuteMipsCallOnCurrentThread(): Already in a callback!"); } - DEBUG_LOG(SCEKERNEL, "Executing mipscall %i", callId); + DEBUG_LOG(Log::sceKernel, "Executing mipscall %i", callId); MipsCall *call = mipsCalls.get(callId); // Grab some MIPS stack space. u32 &sp = currentMIPS->r[MIPS_REG_SP]; if (!Memory::IsValidAddress(sp - 32 * 4)) { - ERROR_LOG_REPORT(SCEKERNEL, "__KernelExecuteMipsCallOnCurrentThread(): Not enough free stack"); + ERROR_LOG_REPORT(Log::sceKernel, "__KernelExecuteMipsCallOnCurrentThread(): Not enough free stack"); return false; } @@ -3273,7 +3273,7 @@ void __KernelReturnFromMipsCall() PSPThread *cur = __GetCurrentThread(); if (cur == NULL) { - ERROR_LOG(SCEKERNEL, "__KernelReturnFromMipsCall(): Bad current thread"); + ERROR_LOG(Log::sceKernel, "__KernelReturnFromMipsCall(): Bad current thread"); return; } @@ -3282,7 +3282,7 @@ void __KernelReturnFromMipsCall() // Value returned by the callback function u32 retVal = currentMIPS->r[MIPS_REG_V0]; - DEBUG_LOG(SCEKERNEL, "__KernelReturnFromMipsCall(), returned %08x", retVal); + DEBUG_LOG(Log::sceKernel, "__KernelReturnFromMipsCall(), returned %08x", retVal); // TODO: Should also save/restore wait state here? if (call->doAfter) { @@ -3321,7 +3321,7 @@ void __KernelReturnFromMipsCall() if (waitTypeFuncs[cur->nt.waitType].endFunc != NULL) waitTypeFuncs[cur->nt.waitType].endFunc(cur->GetUID(), cur->currentCallbackId); else - ERROR_LOG_REPORT(HLE, "Missing begin/restore funcs for wait type %d", cur->nt.waitType); + ERROR_LOG_REPORT(Log::HLE, "Missing begin/restore funcs for wait type %d", cur->nt.waitType); } } @@ -3368,11 +3368,11 @@ static void __KernelRunCallbackOnThread(SceUID cbId, PSPThread *thread, bool res u32 error; PSPCallback *cb = kernelObjects.Get(cbId, error); if (!cb) { - ERROR_LOG(SCEKERNEL, "__KernelRunCallbackOnThread: Bad cbId %i", cbId); + ERROR_LOG(Log::sceKernel, "__KernelRunCallbackOnThread: Bad cbId %i", cbId); return; } - DEBUG_LOG(SCEKERNEL, "__KernelRunCallbackOnThread: Turning callback %i into pending mipscall", cbId); + DEBUG_LOG(Log::sceKernel, "__KernelRunCallbackOnThread: Turning callback %i into pending mipscall", cbId); // Alright, we're on the right thread // Should save/restore wait state? @@ -3387,7 +3387,7 @@ static void __KernelRunCallbackOnThread(SceUID cbId, PSPThread *thread, bool res if (action != NULL) action->setCallback(cbId); else - ERROR_LOG(SCEKERNEL, "Something went wrong creating a restore action for a callback."); + ERROR_LOG(Log::sceKernel, "Something went wrong creating a restore action for a callback."); __KernelCallAddress(thread, cb->nc.entrypoint, action, args, 3, reschedAfter, cbId); } @@ -3403,10 +3403,10 @@ void ActionAfterCallback::run(MipsCall &call) { __KernelCheckThreadCallbacks(t, true); } - DEBUG_LOG(SCEKERNEL, "Left callback %i - %s", cbId, cb->nc.name); + DEBUG_LOG(Log::sceKernel, "Left callback %i - %s", cbId, cb->nc.name); // Callbacks that don't return 0 are deleted. But should this be done here? if (currentMIPS->r[MIPS_REG_V0] != 0) { - DEBUG_LOG(SCEKERNEL, "ActionAfterCallback::run(): Callback returned non-zero, gets deleted!"); + DEBUG_LOG(Log::sceKernel, "ActionAfterCallback::run(): Callback returned non-zero, gets deleted!"); kernelObjects.Destroy(cbId); } } @@ -3457,7 +3457,7 @@ bool __KernelCheckCallbacks() { return false; } if (readyCallbacksCount < 0) { - ERROR_LOG_REPORT(SCEKERNEL, "readyCallbacksCount became negative: %i", readyCallbacksCount); + ERROR_LOG_REPORT(Log::sceKernel, "readyCallbacksCount became negative: %i", readyCallbacksCount); } if (__IsInInterrupt() || !__KernelIsDispatchEnabled() || __KernelInCallback()) { // TODO: Technically, other callbacks can run when a thread within a callback is waiting. @@ -3489,7 +3489,7 @@ bool __KernelForceCallbacks() return false; } if (readyCallbacksCount < 0) { - ERROR_LOG_REPORT(SCEKERNEL, "readyCallbacksCount became negative: %i", readyCallbacksCount); + ERROR_LOG_REPORT(Log::sceKernel, "readyCallbacksCount became negative: %i", readyCallbacksCount); } PSPThread *curThread = __GetCurrentThread(); @@ -3510,7 +3510,7 @@ void sceKernelCheckCallback() bool callbacksProcessed = __KernelForceCallbacks(); if (callbacksProcessed) { - DEBUG_LOG(SCEKERNEL, "sceKernelCheckCallback() - processed a callback."); + DEBUG_LOG(Log::sceKernel, "sceKernelCheckCallback() - processed a callback."); // The RETURN(1) above is still active here, unless __KernelForceCallbacks changed it. } else { RETURN(0); @@ -3530,7 +3530,7 @@ void __KernelNotifyCallback(SceUID cbId, int notifyArg) PSPCallback *cb = kernelObjects.Get(cbId, error); if (!cb) { // Yeah, we're screwed, this shouldn't happen. - ERROR_LOG(SCEKERNEL, "__KernelNotifyCallback - invalid callback %08x", cbId); + ERROR_LOG(Log::sceKernel, "__KernelNotifyCallback - invalid callback %08x", cbId); return; } if (cb->nc.notifyCount == 0) { @@ -3606,45 +3606,45 @@ int sceKernelRegisterExitCallback(SceUID cbId) PSPCallback *cb = kernelObjects.Get(cbId, error); if (!cb) { - WARN_LOG(SCEKERNEL, "sceKernelRegisterExitCallback(%i): invalid callback id", cbId); + WARN_LOG(Log::sceKernel, "sceKernelRegisterExitCallback(%i): invalid callback id", cbId); if (sceKernelGetCompiledSdkVersion() >= 0x3090500) return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT; return 0; } - DEBUG_LOG(SCEKERNEL, "sceKernelRegisterExitCallback(%i)", cbId); + DEBUG_LOG(Log::sceKernel, "sceKernelRegisterExitCallback(%i)", cbId); registeredExitCbId = cbId; return 0; } int LoadExecForUser_362A956B() { - WARN_LOG_REPORT(SCEKERNEL, "LoadExecForUser_362A956B()"); + WARN_LOG_REPORT(Log::sceKernel, "LoadExecForUser_362A956B()"); u32 error; PSPCallback *cb = kernelObjects.Get(registeredExitCbId, error); if (!cb) { - WARN_LOG(SCEKERNEL, "LoadExecForUser_362A956B() : registeredExitCbId not found 0x%x", registeredExitCbId); + WARN_LOG(Log::sceKernel, "LoadExecForUser_362A956B() : registeredExitCbId not found 0x%x", registeredExitCbId); return SCE_KERNEL_ERROR_UNKNOWN_CBID; } int cbArg = cb->nc.commonArgument; if (!Memory::IsValidAddress(cbArg)) { - WARN_LOG(SCEKERNEL, "LoadExecForUser_362A956B() : invalid address for cbArg (0x%08X)", cbArg); + WARN_LOG(Log::sceKernel, "LoadExecForUser_362A956B() : invalid address for cbArg (0x%08X)", cbArg); return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } u32 unknown1 = Memory::Read_U32(cbArg - 8); if (unknown1 >= 4) { - WARN_LOG(SCEKERNEL, "LoadExecForUser_362A956B() : invalid value unknown1 (0x%08X)", unknown1); + WARN_LOG(Log::sceKernel, "LoadExecForUser_362A956B() : invalid value unknown1 (0x%08X)", unknown1); return SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT; } u32 parameterArea = Memory::Read_U32(cbArg - 4); if (!Memory::IsValidAddress(parameterArea)) { - WARN_LOG(SCEKERNEL, "LoadExecForUser_362A956B() : invalid address for parameterArea on userMemory (0x%08X)", parameterArea); + WARN_LOG(Log::sceKernel, "LoadExecForUser_362A956B() : invalid address for parameterArea on userMemory (0x%08X)", parameterArea); return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } u32 size = Memory::Read_U32(parameterArea); if (size < 12) { - WARN_LOG(SCEKERNEL, "LoadExecForUser_362A956B() : invalid parameterArea size %d", size); + WARN_LOG(Log::sceKernel, "LoadExecForUser_362A956B() : invalid parameterArea size %d", size); return SCE_KERNEL_ERROR_ILLEGAL_SIZE; } Memory::Write_U32(0, parameterArea + 4); @@ -3735,20 +3735,20 @@ bool __KernelThreadTriggerEvent(bool isKernel, SceUID threadID, ThreadEventType SceUID sceKernelRegisterThreadEventHandler(const char *name, SceUID threadID, u32 mask, u32 handlerPtr, u32 commonArg) { if (!name) { - return hleReportError(SCEKERNEL, SCE_KERNEL_ERROR_ERROR, "invalid name"); + return hleReportError(Log::sceKernel, SCE_KERNEL_ERROR_ERROR, "invalid name"); } if (threadID == 0) { // "atexit"? if (mask != THREADEVENT_EXIT) { - return hleReportError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid thread id"); + return hleReportError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_ATTR, "invalid thread id"); } } u32 error; if (kernelObjects.Get(threadID, error) == NULL && threadID != SCE_TE_THREADID_ALL_USER) { - return hleReportError(SCEKERNEL, error, "bad thread id"); + return hleReportError(Log::sceKernel, error, "bad thread id"); } if ((mask & ~THREADEVENT_SUPPORTED) != 0) { - return hleReportError(SCEKERNEL, SCE_KERNEL_ERROR_ILLEGAL_MASK, "invalid event mask"); + return hleReportError(Log::sceKernel, SCE_KERNEL_ERROR_ILLEGAL_MASK, "invalid event mask"); } auto teh = new ThreadEventHandler; @@ -3763,34 +3763,34 @@ SceUID sceKernelRegisterThreadEventHandler(const char *name, SceUID threadID, u3 SceUID uid = kernelObjects.Create(teh); threadEventHandlers[threadID].push_back(uid); - return hleLogSuccessI(SCEKERNEL, uid); + return hleLogSuccessI(Log::sceKernel, uid); } int sceKernelReleaseThreadEventHandler(SceUID uid) { u32 error; auto teh = kernelObjects.Get(uid, error); if (!teh) { - return hleReportError(SCEKERNEL, error, "bad handler id"); + return hleReportError(Log::sceKernel, error, "bad handler id"); } auto &handlers = threadEventHandlers[teh->nteh.threadID]; handlers.erase(std::remove(handlers.begin(), handlers.end(), uid), handlers.end()); - return hleLogSuccessI(SCEKERNEL, kernelObjects.Destroy(uid)); + return hleLogSuccessI(Log::sceKernel, kernelObjects.Destroy(uid)); } int sceKernelReferThreadEventHandlerStatus(SceUID uid, u32 infoPtr) { u32 error; auto teh = kernelObjects.Get(uid, error); if (!teh) { - return hleReportError(SCEKERNEL, error, "bad handler id"); + return hleReportError(Log::sceKernel, error, "bad handler id"); } auto info = PSPPointer::Create(infoPtr); if (info.IsValid() && info->size != 0) { *info = teh->nteh; info.NotifyWrite("ThreadEventHandlerStatus"); - return hleLogSuccessI(SCEKERNEL, 0); + return hleLogSuccessI(Log::sceKernel, 0); } else { - return hleLogDebug(SCEKERNEL, 0, "struct size was 0"); + return hleLogDebug(Log::sceKernel, 0, "struct size was 0"); } } diff --git a/Core/HLE/sceKernelTime.cpp b/Core/HLE/sceKernelTime.cpp index 67fe49189f..5c300283ac 100644 --- a/Core/HLE/sceKernelTime.cpp +++ b/Core/HLE/sceKernelTime.cpp @@ -71,7 +71,7 @@ int sceKernelGetSystemTime(u32 sysclockPtr) u64 t = CoreTiming::GetGlobalTimeUs(); if (Memory::IsValidAddress(sysclockPtr)) Memory::Write_U64(t, sysclockPtr); - VERBOSE_LOG(SCEKERNEL, "sceKernelGetSystemTime(out:%16llx)", t); + VERBOSE_LOG(Log::sceKernel, "sceKernelGetSystemTime(out:%16llx)", t); hleEatCycles(265); hleReSchedule("system time"); return 0; @@ -81,7 +81,7 @@ u32 sceKernelGetSystemTimeLow() { // This clock should tick at 1 Mhz. u64 t = CoreTiming::GetGlobalTimeUs(); - VERBOSE_LOG(SCEKERNEL,"%08x=sceKernelGetSystemTimeLow()",(u32)t); + VERBOSE_LOG(Log::sceKernel,"%08x=sceKernelGetSystemTimeLow()",(u32)t); hleEatCycles(165); hleReSchedule("system time"); return (u32)t; @@ -90,7 +90,7 @@ u32 sceKernelGetSystemTimeLow() u64 sceKernelGetSystemTimeWide() { u64 t = CoreTiming::GetGlobalTimeUsScaled(); - VERBOSE_LOG(SCEKERNEL,"%i=sceKernelGetSystemTimeWide()",(u32)t); + VERBOSE_LOG(Log::sceKernel,"%i=sceKernelGetSystemTimeWide()",(u32)t); hleEatCycles(250); hleReSchedule("system time"); return t; @@ -98,7 +98,7 @@ u64 sceKernelGetSystemTimeWide() int sceKernelUSec2SysClock(u32 usec, u32 clockPtr) { - VERBOSE_LOG(SCEKERNEL, "sceKernelUSec2SysClock(%i, %08x)", usec, clockPtr); + VERBOSE_LOG(Log::sceKernel, "sceKernelUSec2SysClock(%i, %08x)", usec, clockPtr); if (Memory::IsValidAddress(clockPtr)) Memory::Write_U64((usec & 0xFFFFFFFFL), clockPtr); hleEatCycles(165); @@ -107,14 +107,14 @@ int sceKernelUSec2SysClock(u32 usec, u32 clockPtr) u64 sceKernelUSec2SysClockWide(u32 usec) { - VERBOSE_LOG(SCEKERNEL, "sceKernelUSec2SysClockWide(%i)", usec); + VERBOSE_LOG(Log::sceKernel, "sceKernelUSec2SysClockWide(%i)", usec); hleEatCycles(150); return usec; } int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr) { - DEBUG_LOG(SCEKERNEL, "sceKernelSysClock2USec(clock = %08x, lo = %08x, hi = %08x)", sysclockPtr, highPtr, lowPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelSysClock2USec(clock = %08x, lo = %08x, hi = %08x)", sysclockPtr, highPtr, lowPtr); u64 time = Memory::Read_U64(sysclockPtr); u32 highResult = (u32)(time / 1000000); u32 lowResult = (u32)(time % 1000000); @@ -129,7 +129,7 @@ int sceKernelSysClock2USec(u32 sysclockPtr, u32 highPtr, u32 lowPtr) int sceKernelSysClock2USecWide(u32 lowClock, u32 highClock, u32 lowPtr, u32 highPtr) { u64 sysClock = lowClock | ((u64)highClock << 32); - DEBUG_LOG(SCEKERNEL, "sceKernelSysClock2USecWide(clock = %llu, lo = %08x, hi = %08x)", sysClock, lowPtr, highPtr); + DEBUG_LOG(Log::sceKernel, "sceKernelSysClock2USecWide(clock = %llu, lo = %08x, hi = %08x)", sysClock, lowPtr, highPtr); if (Memory::IsValidAddress(lowPtr)) { Memory::Write_U32((u32)(sysClock / 1000000), lowPtr); if (Memory::IsValidAddress(highPtr)) @@ -144,7 +144,7 @@ int sceKernelSysClock2USecWide(u32 lowClock, u32 highClock, u32 lowPtr, u32 high u32 sceKernelLibcClock() { u32 retVal = (u32) CoreTiming::GetGlobalTimeUs(); - DEBUG_LOG(SCEKERNEL, "%i = sceKernelLibcClock", retVal); + DEBUG_LOG(Log::sceKernel, "%i = sceKernelLibcClock", retVal); hleEatCycles(330); hleReSchedule("libc clock"); return retVal; @@ -154,7 +154,7 @@ u32 sceKernelLibcTime(u32 outPtr) { u32 t = (u32) start_time + (u32) (CoreTiming::GetGlobalTimeUs() / 1000000ULL); - DEBUG_LOG(SCEKERNEL, "%i = sceKernelLibcTime(%08X)", t, outPtr); + DEBUG_LOG(Log::sceKernel, "%i = sceKernelLibcTime(%08X)", t, outPtr); // The PSP sure takes its sweet time on this function. hleEatCycles(3385); @@ -176,7 +176,7 @@ u32 sceKernelLibcGettimeofday(u32 timeAddr, u32 tzAddr) __RtcTimeOfDay(tv); } - DEBUG_LOG(SCEKERNEL,"sceKernelLibcGettimeofday(%08x, %08x)", timeAddr, tzAddr); + DEBUG_LOG(Log::sceKernel,"sceKernelLibcGettimeofday(%08x, %08x)", timeAddr, tzAddr); hleEatCycles(1885); hleReSchedule("libc timeofday"); diff --git a/Core/HLE/sceKernelVTimer.cpp b/Core/HLE/sceKernelVTimer.cpp index ce26b208ac..f9e836e8ee 100644 --- a/Core/HLE/sceKernelVTimer.cpp +++ b/Core/HLE/sceKernelVTimer.cpp @@ -216,10 +216,10 @@ void __KernelVTimerInit() { u32 sceKernelCreateVTimer(const char *name, u32 optParamAddr) { if (!name) { - WARN_LOG_REPORT(SCEKERNEL, "%08x=sceKernelCreateVTimer(): invalid name", SCE_KERNEL_ERROR_ERROR); + WARN_LOG_REPORT(Log::sceKernel, "%08x=sceKernelCreateVTimer(): invalid name", SCE_KERNEL_ERROR_ERROR); return SCE_KERNEL_ERROR_ERROR; } - DEBUG_LOG(SCEKERNEL, "sceKernelCreateVTimer(%s, %08x)", name, optParamAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelCreateVTimer(%s, %08x)", name, optParamAddr); VTimer *vtimer = new VTimer; SceUID id = kernelObjects.Create(vtimer); @@ -232,20 +232,20 @@ u32 sceKernelCreateVTimer(const char *name, u32 optParamAddr) { if (optParamAddr != 0) { u32 size = Memory::Read_U32(optParamAddr); if (size > 4) - WARN_LOG_REPORT(SCEKERNEL, "sceKernelCreateVTimer(%s) unsupported options parameter, size = %d", name, size); + WARN_LOG_REPORT(Log::sceKernel, "sceKernelCreateVTimer(%s) unsupported options parameter, size = %d", name, size); } return id; } u32 sceKernelDeleteVTimer(SceUID uid) { - DEBUG_LOG(SCEKERNEL, "sceKernelDeleteVTimer(%08x)", uid); + DEBUG_LOG(Log::sceKernel, "sceKernelDeleteVTimer(%08x)", uid); u32 error; VTimer* vt = kernelObjects.Get(uid, error); if (error) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelDeleteVTimer(%08x)", error, uid); + WARN_LOG(Log::sceKernel, "%08x=sceKernelDeleteVTimer(%08x)", error, uid); return error; } @@ -260,13 +260,13 @@ u32 sceKernelDeleteVTimer(SceUID uid) { } u32 sceKernelGetVTimerBase(SceUID uid, u32 baseClockAddr) { - DEBUG_LOG(SCEKERNEL, "sceKernelGetVTimerBase(%08x, %08x)", uid, baseClockAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelGetVTimerBase(%08x, %08x)", uid, baseClockAddr); u32 error; VTimer *vt = kernelObjects.Get(uid, error); if (error) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelGetVTimerBase(%08x, %08x)", error, uid, baseClockAddr); + WARN_LOG(Log::sceKernel, "%08x=sceKernelGetVTimerBase(%08x, %08x)", error, uid, baseClockAddr); return error; } @@ -277,13 +277,13 @@ u32 sceKernelGetVTimerBase(SceUID uid, u32 baseClockAddr) { } u64 sceKernelGetVTimerBaseWide(SceUID uid) { - DEBUG_LOG(SCEKERNEL, "sceKernelGetVTimerBaseWide(%08x)", uid); + DEBUG_LOG(Log::sceKernel, "sceKernelGetVTimerBaseWide(%08x)", uid); u32 error; VTimer *vt = kernelObjects.Get(uid, error); if (error) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelGetVTimerBaseWide(%08x)", error, uid); + WARN_LOG(Log::sceKernel, "%08x=sceKernelGetVTimerBaseWide(%08x)", error, uid); return -1; } @@ -291,13 +291,13 @@ u64 sceKernelGetVTimerBaseWide(SceUID uid) { } u32 sceKernelGetVTimerTime(SceUID uid, u32 timeClockAddr) { - DEBUG_LOG(SCEKERNEL, "sceKernelGetVTimerTime(%08x, %08x)", uid, timeClockAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelGetVTimerTime(%08x, %08x)", uid, timeClockAddr); u32 error; VTimer *vt = kernelObjects.Get(uid, error); if (error) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelGetVTimerTime(%08x, %08x)", error, uid, timeClockAddr); + WARN_LOG(Log::sceKernel, "%08x=sceKernelGetVTimerTime(%08x, %08x)", error, uid, timeClockAddr); return error; } @@ -309,13 +309,13 @@ u32 sceKernelGetVTimerTime(SceUID uid, u32 timeClockAddr) { } u64 sceKernelGetVTimerTimeWide(SceUID uid) { - DEBUG_LOG(SCEKERNEL, "sceKernelGetVTimerTimeWide(%08x)", uid); + DEBUG_LOG(Log::sceKernel, "sceKernelGetVTimerTimeWide(%08x)", uid); u32 error; VTimer *vt = kernelObjects.Get(uid, error); if (error) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelGetVTimerTimeWide(%08x)", error, uid); + WARN_LOG(Log::sceKernel, "%08x=sceKernelGetVTimerTimeWide(%08x)", error, uid); return -1; } @@ -334,13 +334,13 @@ static u64 __KernelSetVTimer(VTimer *vt, u64 time) { } u32 sceKernelSetVTimerTime(SceUID uid, u32 timeClockAddr) { - DEBUG_LOG(SCEKERNEL, "sceKernelSetVTimerTime(%08x, %08x)", uid, timeClockAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelSetVTimerTime(%08x, %08x)", uid, timeClockAddr); u32 error; VTimer *vt = kernelObjects.Get(uid, error); if (error) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelSetVTimerTime(%08x, %08x)", error, uid, timeClockAddr); + WARN_LOG(Log::sceKernel, "%08x=sceKernelSetVTimerTime(%08x, %08x)", error, uid, timeClockAddr); return error; } @@ -353,16 +353,16 @@ u32 sceKernelSetVTimerTime(SceUID uid, u32 timeClockAddr) { u64 sceKernelSetVTimerTimeWide(SceUID uid, u64 timeClock) { if (__IsInInterrupt()) { - WARN_LOG(SCEKERNEL, "sceKernelSetVTimerTimeWide(%08x, %llu): in interrupt", uid, timeClock); + WARN_LOG(Log::sceKernel, "sceKernelSetVTimerTimeWide(%08x, %llu): in interrupt", uid, timeClock); return -1; } - DEBUG_LOG(SCEKERNEL, "sceKernelSetVTimerTimeWide(%08x, %llu)", uid, timeClock); + DEBUG_LOG(Log::sceKernel, "sceKernelSetVTimerTimeWide(%08x, %llu)", uid, timeClock); u32 error; VTimer *vt = kernelObjects.Get(uid, error); if (error || vt == NULL) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelSetVTimerTimeWide(%08x, %llu)", error, uid, timeClock); + WARN_LOG(Log::sceKernel, "%08x=sceKernelSetVTimerTimeWide(%08x, %llu)", error, uid, timeClock); return -1; } @@ -381,11 +381,11 @@ u32 sceKernelStartVTimer(SceUID uid) { hleEatCycles(12200); if (uid == runningVTimer) { - WARN_LOG(SCEKERNEL, "sceKernelStartVTimer(%08x): invalid vtimer", uid); + WARN_LOG(Log::sceKernel, "sceKernelStartVTimer(%08x): invalid vtimer", uid); return SCE_KERNEL_ERROR_ILLEGAL_VTID; } - DEBUG_LOG(SCEKERNEL, "sceKernelStartVTimer(%08x)", uid); + DEBUG_LOG(Log::sceKernel, "sceKernelStartVTimer(%08x)", uid); u32 error; VTimer *vt = kernelObjects.Get(uid, error); @@ -410,10 +410,10 @@ static void __stopVTimer(VTimer *vt) { u32 sceKernelStopVTimer(SceUID uid) { if (uid == runningVTimer) { - WARN_LOG(SCEKERNEL, "sceKernelStopVTimer(%08x): invalid vtimer", uid); + WARN_LOG(Log::sceKernel, "sceKernelStopVTimer(%08x): invalid vtimer", uid); return SCE_KERNEL_ERROR_ILLEGAL_VTID; } - DEBUG_LOG(SCEKERNEL, "sceKernelStopVTimer(%08x)", uid); + DEBUG_LOG(Log::sceKernel, "sceKernelStopVTimer(%08x)", uid); u32 error; VTimer *vt = kernelObjects.Get(uid, error); @@ -432,7 +432,7 @@ u32 sceKernelStopVTimer(SceUID uid) { u32 sceKernelSetVTimerHandler(SceUID uid, u32 scheduleAddr, u32 handlerFuncAddr, u32 commonAddr) { hleEatCycles(900); if (uid == runningVTimer) { - WARN_LOG(SCEKERNEL, "sceKernelSetVTimerHandler(%08x, %08x, %08x, %08x): invalid vtimer", uid, scheduleAddr, handlerFuncAddr, commonAddr); + WARN_LOG(Log::sceKernel, "sceKernelSetVTimerHandler(%08x, %08x, %08x, %08x): invalid vtimer", uid, scheduleAddr, handlerFuncAddr, commonAddr); return SCE_KERNEL_ERROR_ILLEGAL_VTID; } @@ -440,11 +440,11 @@ u32 sceKernelSetVTimerHandler(SceUID uid, u32 scheduleAddr, u32 handlerFuncAddr, VTimer *vt = kernelObjects.Get(uid, error); if (error) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelSetVTimerHandler(%08x, %08x, %08x, %08x)", error, uid, scheduleAddr, handlerFuncAddr, commonAddr); + WARN_LOG(Log::sceKernel, "%08x=sceKernelSetVTimerHandler(%08x, %08x, %08x, %08x)", error, uid, scheduleAddr, handlerFuncAddr, commonAddr); return error; } - DEBUG_LOG(SCEKERNEL, "sceKernelSetVTimerHandler(%08x, %08x, %08x, %08x)", uid, scheduleAddr, handlerFuncAddr, commonAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelSetVTimerHandler(%08x, %08x, %08x, %08x)", uid, scheduleAddr, handlerFuncAddr, commonAddr); hleEatCycles(2000); u64 schedule = Memory::Read_U64(scheduleAddr); @@ -462,7 +462,7 @@ u32 sceKernelSetVTimerHandler(SceUID uid, u32 scheduleAddr, u32 handlerFuncAddr, u32 sceKernelSetVTimerHandlerWide(SceUID uid, u64 schedule, u32 handlerFuncAddr, u32 commonAddr) { hleEatCycles(900); if (uid == runningVTimer) { - WARN_LOG(SCEKERNEL, "sceKernelSetVTimerHandlerWide(%08x, %llu, %08x, %08x): invalid vtimer", uid, schedule, handlerFuncAddr, commonAddr); + WARN_LOG(Log::sceKernel, "sceKernelSetVTimerHandlerWide(%08x, %llu, %08x, %08x): invalid vtimer", uid, schedule, handlerFuncAddr, commonAddr); return SCE_KERNEL_ERROR_ILLEGAL_VTID; } @@ -470,11 +470,11 @@ u32 sceKernelSetVTimerHandlerWide(SceUID uid, u64 schedule, u32 handlerFuncAddr, VTimer *vt = kernelObjects.Get(uid, error); if (error) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelSetVTimerHandlerWide(%08x, %llu, %08x, %08x)", error, uid, schedule, handlerFuncAddr, commonAddr); + WARN_LOG(Log::sceKernel, "%08x=sceKernelSetVTimerHandlerWide(%08x, %llu, %08x, %08x)", error, uid, schedule, handlerFuncAddr, commonAddr); return error; } - DEBUG_LOG(SCEKERNEL, "sceKernelSetVTimerHandlerWide(%08x, %llu, %08x, %08x)", uid, schedule, handlerFuncAddr, commonAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelSetVTimerHandlerWide(%08x, %llu, %08x, %08x)", uid, schedule, handlerFuncAddr, commonAddr); vt->nvt.handlerAddr = handlerFuncAddr; if (handlerFuncAddr) { @@ -489,24 +489,24 @@ u32 sceKernelSetVTimerHandlerWide(SceUID uid, u64 schedule, u32 handlerFuncAddr, u32 sceKernelCancelVTimerHandler(SceUID uid) { if (uid == runningVTimer) { - WARN_LOG(SCEKERNEL, "sceKernelCancelVTimerHandler(%08x): invalid vtimer", uid); + WARN_LOG(Log::sceKernel, "sceKernelCancelVTimerHandler(%08x): invalid vtimer", uid); return SCE_KERNEL_ERROR_ILLEGAL_VTID; } - DEBUG_LOG(SCEKERNEL, "sceKernelCancelVTimerHandler(%08x)", uid); + DEBUG_LOG(Log::sceKernel, "sceKernelCancelVTimerHandler(%08x)", uid); //__cancelVTimer checks if uid is valid return __KernelCancelVTimer(uid); } u32 sceKernelReferVTimerStatus(SceUID uid, u32 statusAddr) { - DEBUG_LOG(SCEKERNEL, "sceKernelReferVTimerStatus(%08x, %08x)", uid, statusAddr); + DEBUG_LOG(Log::sceKernel, "sceKernelReferVTimerStatus(%08x, %08x)", uid, statusAddr); u32 error; VTimer *vt = kernelObjects.Get(uid, error); if (error) { - WARN_LOG(SCEKERNEL, "%08x=sceKernelReferVTimerStatus(%08x, %08x)", error, uid, statusAddr); + WARN_LOG(Log::sceKernel, "%08x=sceKernelReferVTimerStatus(%08x, %08x)", error, uid, statusAddr); return error; } @@ -522,5 +522,5 @@ u32 sceKernelReferVTimerStatus(SceUID uid, u32 statusAddr) { // Not sure why this is exposed... void _sceKernelReturnFromTimerHandler() { - ERROR_LOG_REPORT(SCEKERNEL,"_sceKernelReturnFromTimerHandler - should not be called!"); + ERROR_LOG_REPORT(Log::sceKernel,"_sceKernelReturnFromTimerHandler - should not be called!"); } diff --git a/Core/HLE/sceMd5.cpp b/Core/HLE/sceMd5.cpp index 532428bfe4..7a279d5bcb 100644 --- a/Core/HLE/sceMd5.cpp +++ b/Core/HLE/sceMd5.cpp @@ -30,7 +30,7 @@ // Not really sure where these belong - is it worth giving them their own file? u32 sceKernelUtilsMt19937Init(u32 ctx, u32 seed) { - DEBUG_LOG(HLE, "sceKernelUtilsMt19937Init(%08x, %08x)", ctx, seed); + DEBUG_LOG(Log::HLE, "sceKernelUtilsMt19937Init(%08x, %08x)", ctx, seed); if (!Memory::IsValidAddress(ctx)) return -1; void *ptr = Memory::GetPointerWrite(ctx); @@ -41,7 +41,7 @@ u32 sceKernelUtilsMt19937Init(u32 ctx, u32 seed) { } u32 sceKernelUtilsMt19937UInt(u32 ctx) { - VERBOSE_LOG(HLE, "sceKernelUtilsMt19937UInt(%08x)", ctx); + VERBOSE_LOG(Log::HLE, "sceKernelUtilsMt19937UInt(%08x)", ctx); if (!Memory::IsValidAddress(ctx)) return -1; MersenneTwister *mt = (MersenneTwister *)Memory::GetPointerUnchecked(ctx); @@ -53,7 +53,7 @@ u32 sceKernelUtilsMt19937UInt(u32 ctx) { static md5_context md5_ctx; static int sceMd5Digest(u32 dataAddr, u32 len, u32 digestAddr) { - DEBUG_LOG(HLE, "sceMd5Digest(%08x, %d, %08x)", dataAddr, len, digestAddr); + DEBUG_LOG(Log::HLE, "sceMd5Digest(%08x, %d, %08x)", dataAddr, len, digestAddr); if (!Memory::IsValidAddress(dataAddr) || !Memory::IsValidAddress(digestAddr)) return -1; @@ -63,7 +63,7 @@ static int sceMd5Digest(u32 dataAddr, u32 len, u32 digestAddr) { } static int sceMd5BlockInit(u32 ctxAddr) { - DEBUG_LOG(HLE, "sceMd5BlockInit(%08x)", ctxAddr); + DEBUG_LOG(Log::HLE, "sceMd5BlockInit(%08x)", ctxAddr); if (!Memory::IsValidAddress(ctxAddr)) return -1; @@ -75,7 +75,7 @@ static int sceMd5BlockInit(u32 ctxAddr) { } static int sceMd5BlockUpdate(u32 ctxAddr, u32 dataPtr, u32 len) { - DEBUG_LOG(HLE, "sceMd5BlockUpdate(%08x, %08x, %d)", ctxAddr, dataPtr, len); + DEBUG_LOG(Log::HLE, "sceMd5BlockUpdate(%08x, %08x, %d)", ctxAddr, dataPtr, len); if (!Memory::IsValidAddress(ctxAddr) || !Memory::IsValidAddress(dataPtr)) return -1; @@ -84,7 +84,7 @@ static int sceMd5BlockUpdate(u32 ctxAddr, u32 dataPtr, u32 len) { } static int sceMd5BlockResult(u32 ctxAddr, u32 digestAddr) { - DEBUG_LOG(HLE, "sceMd5BlockResult(%08x, %08x)", ctxAddr, digestAddr); + DEBUG_LOG(Log::HLE, "sceMd5BlockResult(%08x, %08x)", ctxAddr, digestAddr); if (!Memory::IsValidAddress(ctxAddr) || !Memory::IsValidAddress(digestAddr)) return -1; @@ -93,7 +93,7 @@ static int sceMd5BlockResult(u32 ctxAddr, u32 digestAddr) { } int sceKernelUtilsMd5Digest(u32 dataAddr, int len, u32 digestAddr) { - DEBUG_LOG(HLE, "sceKernelUtilsMd5Digest(%08x, %d, %08x)", dataAddr, len, digestAddr); + DEBUG_LOG(Log::HLE, "sceKernelUtilsMd5Digest(%08x, %d, %08x)", dataAddr, len, digestAddr); if (!Memory::IsValidAddress(dataAddr) || !Memory::IsValidAddress(digestAddr)) return -1; @@ -103,7 +103,7 @@ int sceKernelUtilsMd5Digest(u32 dataAddr, int len, u32 digestAddr) { } int sceKernelUtilsMd5BlockInit(u32 ctxAddr) { - DEBUG_LOG(HLE, "sceKernelUtilsMd5BlockInit(%08x)", ctxAddr); + DEBUG_LOG(Log::HLE, "sceKernelUtilsMd5BlockInit(%08x)", ctxAddr); if (!Memory::IsValidAddress(ctxAddr)) return -1; @@ -115,7 +115,7 @@ int sceKernelUtilsMd5BlockInit(u32 ctxAddr) { } int sceKernelUtilsMd5BlockUpdate(u32 ctxAddr, u32 dataPtr, int len) { - DEBUG_LOG(HLE, "sceKernelUtilsMd5BlockUpdate(%08x, %08x, %d)", ctxAddr, dataPtr, len); + DEBUG_LOG(Log::HLE, "sceKernelUtilsMd5BlockUpdate(%08x, %08x, %d)", ctxAddr, dataPtr, len); if (!Memory::IsValidAddress(ctxAddr) || !Memory::IsValidAddress(dataPtr)) return -1; @@ -124,7 +124,7 @@ int sceKernelUtilsMd5BlockUpdate(u32 ctxAddr, u32 dataPtr, int len) { } int sceKernelUtilsMd5BlockResult(u32 ctxAddr, u32 digestAddr) { - DEBUG_LOG(HLE, "sceKernelUtilsMd5BlockResult(%08x, %08x)", ctxAddr, digestAddr); + DEBUG_LOG(Log::HLE, "sceKernelUtilsMd5BlockResult(%08x, %08x)", ctxAddr, digestAddr); if (!Memory::IsValidAddress(ctxAddr) || !Memory::IsValidAddress(digestAddr)) return -1; @@ -136,7 +136,7 @@ int sceKernelUtilsMd5BlockResult(u32 ctxAddr, u32 digestAddr) { static sha1_context sha1_ctx; int sceKernelUtilsSha1Digest(u32 dataAddr, int len, u32 digestAddr) { - DEBUG_LOG(HLE, "sceKernelUtilsSha1Digest(%08x, %d, %08x)", dataAddr, len, digestAddr); + DEBUG_LOG(Log::HLE, "sceKernelUtilsSha1Digest(%08x, %d, %08x)", dataAddr, len, digestAddr); if (!Memory::IsValidAddress(dataAddr) || !Memory::IsValidAddress(digestAddr)) return -1; @@ -146,7 +146,7 @@ int sceKernelUtilsSha1Digest(u32 dataAddr, int len, u32 digestAddr) { } int sceKernelUtilsSha1BlockInit(u32 ctxAddr) { - DEBUG_LOG(HLE, "sceKernelUtilsSha1BlockInit(%08x)", ctxAddr); + DEBUG_LOG(Log::HLE, "sceKernelUtilsSha1BlockInit(%08x)", ctxAddr); if (!Memory::IsValidAddress(ctxAddr)) return -1; @@ -159,7 +159,7 @@ int sceKernelUtilsSha1BlockInit(u32 ctxAddr) { } int sceKernelUtilsSha1BlockUpdate(u32 ctxAddr, u32 dataAddr, int len) { - DEBUG_LOG(HLE, "sceKernelUtilsSha1BlockUpdate(%08x, %08x, %d)", ctxAddr, dataAddr, len); + DEBUG_LOG(Log::HLE, "sceKernelUtilsSha1BlockUpdate(%08x, %08x, %d)", ctxAddr, dataAddr, len); if (!Memory::IsValidAddress(ctxAddr) || !Memory::IsValidAddress(dataAddr)) return -1; @@ -168,7 +168,7 @@ int sceKernelUtilsSha1BlockUpdate(u32 ctxAddr, u32 dataAddr, int len) { } int sceKernelUtilsSha1BlockResult(u32 ctxAddr, u32 digestAddr) { - DEBUG_LOG(HLE, "sceKernelUtilsSha1BlockResult(%08x, %08x)", ctxAddr, digestAddr); + DEBUG_LOG(Log::HLE, "sceKernelUtilsSha1BlockResult(%08x, %08x)", ctxAddr, digestAddr); if (!Memory::IsValidAddress(ctxAddr) || !Memory::IsValidAddress(digestAddr)) return -1; diff --git a/Core/HLE/sceMp3.cpp b/Core/HLE/sceMp3.cpp index f364acd80f..48c3ede269 100644 --- a/Core/HLE/sceMp3.cpp +++ b/Core/HLE/sceMp3.cpp @@ -215,18 +215,18 @@ static int sceMp3Decode(u32 mp3, u32 outPcmPtr) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); } else if (ctx->Version < 0 || ctx->AuBuf == 0) { - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); } int pcmBytes = ctx->AuDecode(outPcmPtr); if (pcmBytes > 0) { // decode data successfully, delay thread - return hleDelayResult(hleLogSuccessI(ME, pcmBytes), "mp3 decode", mp3DecodeDelay); + return hleDelayResult(hleLogSuccessI(Log::ME, pcmBytes), "mp3 decode", mp3DecodeDelay); } else if (pcmBytes == 0) { - return hleLogSuccessI(ME, pcmBytes); + return hleLogSuccessI(Log::ME, pcmBytes); } // Should already have logged. return pcmBytes; @@ -236,44 +236,44 @@ static int sceMp3ResetPlayPosition(u32 mp3) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); } else if (ctx->Version < 0 || ctx->AuBuf == 0) { - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); } - return hleLogSuccessI(ME, ctx->AuResetPlayPosition()); + return hleLogSuccessI(Log::ME, ctx->AuResetPlayPosition()); } static int sceMp3CheckStreamDataNeeded(u32 mp3) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); } else if (ctx->AuBuf == 0) { - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); } - return hleLogSuccessI(ME, ctx->AuCheckStreamDataNeeded()); + return hleLogSuccessI(Log::ME, ctx->AuCheckStreamDataNeeded()); } static u32 sceMp3ReserveMp3Handle(u32 mp3Addr) { if (!resourceInited) { - return hleLogError(ME, ERROR_MP3_NO_RESOURCE_AVAIL, "sceMp3InitResource must be called first"); + return hleLogError(Log::ME, ERROR_MP3_NO_RESOURCE_AVAIL, "sceMp3InitResource must be called first"); } if (mp3Map.size() >= MP3_MAX_HANDLES) { - return hleLogError(ME, ERROR_MP3_NO_RESOURCE_AVAIL, "no free handles"); + return hleLogError(Log::ME, ERROR_MP3_NO_RESOURCE_AVAIL, "no free handles"); } if (mp3Addr != 0 && !Memory::IsValidRange(mp3Addr, 32)) { // The PSP would crash, but might as well return a proper error. - return hleLogError(ME, SCE_KERNEL_ERROR_INVALID_POINTER, "bad mp3 pointer"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_INVALID_POINTER, "bad mp3 pointer"); } AuCtx *Au = new AuCtx; if (mp3Addr) { - Au->startPos = Memory::Read_U64(mp3Addr); // Audio stream start position. - Au->endPos = Memory::Read_U64(mp3Addr + 8); // Audio stream end position. + Au->startPos = Memory::Read_U64(mp3Addr); // AUDIO stream start position. + Au->endPos = Memory::Read_U64(mp3Addr + 8); // AUDIO stream end position. Au->AuBuf = Memory::Read_U32(mp3Addr + 16); // Input Au data buffer. Au->AuBufSize = Memory::Read_U32(mp3Addr + 20); // Input Au data buffer size. Au->PCMBuf = Memory::Read_U32(mp3Addr + 24); // Output PCM data buffer. @@ -281,18 +281,18 @@ static u32 sceMp3ReserveMp3Handle(u32 mp3Addr) { if (Au->startPos >= Au->endPos) { delete Au; - return hleLogError(ME, ERROR_MP3_BAD_SIZE, "start must be before end"); + return hleLogError(Log::ME, ERROR_MP3_BAD_SIZE, "start must be before end"); } if (!Au->AuBuf || !Au->PCMBuf) { delete Au; - return hleLogError(ME, ERROR_MP3_BAD_ADDR, "invalid buffer addresses"); + return hleLogError(Log::ME, ERROR_MP3_BAD_ADDR, "invalid buffer addresses"); } if ((int)Au->AuBufSize < AU_BUF_MIN_SIZE || (int)Au->PCMBufSize < PCM_BUF_MIN_SIZE) { delete Au; - return hleLogError(ME, ERROR_MP3_BAD_SIZE, "buffers too small"); + return hleLogError(Log::ME, ERROR_MP3_BAD_SIZE, "buffers too small"); } - DEBUG_LOG(ME, "startPos %llx endPos %llx mp3buf %08x mp3bufSize %08x PCMbuf %08x PCMbufSize %08x", + DEBUG_LOG(Log::ME, "startPos %llx endPos %llx mp3buf %08x mp3bufSize %08x PCMbuf %08x PCMbufSize %08x", Au->startPos, Au->endPos, Au->AuBuf, Au->AuBufSize, Au->PCMBuf, Au->PCMBufSize); } else { Au->startPos = 0; @@ -309,21 +309,21 @@ static u32 sceMp3ReserveMp3Handle(u32 mp3Addr) { int handle = (int)mp3Map.size(); mp3Map[handle] = Au; - return hleLogSuccessI(ME, handle); + return hleLogSuccessI(Log::ME, handle); } static int sceMp3InitResource() { // TODO: Could validate the utility modules have been loaded? if (resourceInited) { - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } resourceInited = true; - return hleLogSuccessI(ME, hleDelayResult(0, "mp3 resource init", 200)); + return hleLogSuccessI(Log::ME, hleDelayResult(0, "mp3 resource init", 200)); } static int sceMp3TermResource() { if (!resourceInited) { - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } // Free any handles that are still open. @@ -333,7 +333,7 @@ static int sceMp3TermResource() { mp3Map.clear(); resourceInited = false; - return hleLogSuccessI(ME, hleDelayResult(0, "mp3 resource term", 100)); + return hleLogSuccessI(Log::ME, hleDelayResult(0, "mp3 resource term", 100)); } static int __CalculateMp3Channels(int bitval) { @@ -435,10 +435,10 @@ static int sceMp3Init(u32 mp3) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); } else if (ctx->AuBuf == 0) { - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); } static const int PARSE_DELAY_MS = 500; @@ -447,7 +447,7 @@ static int sceMp3Init(u32 mp3) { // If we have an ID3 tag, we'll get past it based on frame sync. Don't modify startPos. int header = 0; if (FindMp3Header(ctx, header, 1440) < 0) - return hleDelayResult(hleLogWarning(ME, ERROR_AVCODEC_INVALID_DATA, "no header found"), "mp3 init", PARSE_DELAY_MS); + return hleDelayResult(hleLogWarning(Log::ME, ERROR_AVCODEC_INVALID_DATA, "no header found"), "mp3 init", PARSE_DELAY_MS); // Parse the Mp3 header int layerBits = (header >> 17) & 0x3; @@ -456,23 +456,23 @@ static int sceMp3Init(u32 mp3) { int samplerate = __CalculateMp3SampleRates((header >> 10) & 0x3, versionBits);; int channels = __CalculateMp3Channels((header >> 6) & 0x3); - DEBUG_LOG(ME, "sceMp3Init(): channels=%i, samplerate=%iHz, bitrate=%ikbps, layerBits=%d ,versionBits=%d,HEADER: %08x", channels, samplerate, bitrate, layerBits, versionBits, header); + DEBUG_LOG(Log::ME, "sceMp3Init(): channels=%i, samplerate=%iHz, bitrate=%ikbps, layerBits=%d ,versionBits=%d,HEADER: %08x", channels, samplerate, bitrate, layerBits, versionBits, header); if (layerBits != 1) { // TODO: Should return ERROR_AVCODEC_INVALID_DATA. - WARN_LOG_REPORT(ME, "sceMp3Init: invalid data: not layer 3"); + WARN_LOG_REPORT(Log::ME, "sceMp3Init: invalid data: not layer 3"); } if (bitrate == 0 || bitrate == -1) { - return hleDelayResult(hleReportError(ME, ERROR_AVCODEC_INVALID_DATA, "invalid bitrate v%d l%d rate %04x", versionBits, layerBits, (header >> 12) & 0xF), "mp3 init", PARSE_DELAY_MS); + return hleDelayResult(hleReportError(Log::ME, ERROR_AVCODEC_INVALID_DATA, "invalid bitrate v%d l%d rate %04x", versionBits, layerBits, (header >> 12) & 0xF), "mp3 init", PARSE_DELAY_MS); } if (samplerate == -1) { - return hleDelayResult(hleReportError(ME, ERROR_AVCODEC_INVALID_DATA, "invalid sample rate v%d l%d rate %02x", versionBits, layerBits, (header >> 10) & 0x3), "mp3 init", PARSE_DELAY_MS); + return hleDelayResult(hleReportError(Log::ME, ERROR_AVCODEC_INVALID_DATA, "invalid sample rate v%d l%d rate %02x", versionBits, layerBits, (header >> 10) & 0x3), "mp3 init", PARSE_DELAY_MS); } // Before we allow init, newer SDK versions next require at least 156 bytes. // That happens to be the size of the first frame header for VBR. if (sdkver >= 0x06000000 && ctx->ReadPos() < 156) { - return hleDelayResult(hleLogError(ME, SCE_KERNEL_ERROR_INVALID_VALUE, "insufficient mp3 data for init"), "mp3 init", PARSE_DELAY_MS); + return hleDelayResult(hleLogError(Log::ME, SCE_KERNEL_ERROR_INVALID_VALUE, "insufficient mp3 data for init"), "mp3 init", PARSE_DELAY_MS); } ctx->SamplingRate = samplerate; @@ -483,10 +483,10 @@ static int sceMp3Init(u32 mp3) { if (versionBits != 3) { // TODO: Should return 0x80671301 (unsupported version?) - WARN_LOG_REPORT(ME, "sceMp3Init: invalid data: not MPEG v1"); + WARN_LOG_REPORT(Log::ME, "sceMp3Init: invalid data: not MPEG v1"); } if (samplerate != 44100 && sdkver < 3090500) { - return hleDelayResult(hleLogError(ME, ERROR_MP3_BAD_SAMPLE_RATE, "invalid data: not 44.1kHz"), "mp3 init", PARSE_DELAY_MS); + return hleDelayResult(hleLogError(Log::ME, ERROR_MP3_BAD_SAMPLE_RATE, "invalid data: not 44.1kHz"), "mp3 init", PARSE_DELAY_MS); } // Based on bitrate, we can calculate the frame size in bytes. @@ -498,136 +498,136 @@ static int sceMp3Init(u32 mp3) { ctx->Version = versionBits; - return hleDelayResult(hleLogSuccessI(ME, 0), "mp3 init", PARSE_DELAY_MS); + return hleDelayResult(hleLogSuccessI(Log::ME, 0), "mp3 init", PARSE_DELAY_MS); } static int sceMp3GetLoopNum(u32 mp3) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); } else if (ctx->AuBuf == 0) { - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); } - return hleLogSuccessI(ME, ctx->LoopNum); + return hleLogSuccessI(Log::ME, ctx->LoopNum); } static int sceMp3GetMaxOutputSample(u32 mp3) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); } else if (ctx->Version < 0) { - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); } else if (ctx->AuBuf == 0) { - return hleLogWarning(ME, 0, "no channel available for low level"); + return hleLogWarning(Log::ME, 0, "no channel available for low level"); } - return hleLogSuccessI(ME, ctx->MaxOutputSample); + return hleLogSuccessI(Log::ME, ctx->MaxOutputSample); } static int sceMp3GetSumDecodedSample(u32 mp3) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); } else if (ctx->AuBuf == 0) { - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); } - return hleLogSuccessI(ME, ctx->SumDecodedSamples); + return hleLogSuccessI(Log::ME, ctx->SumDecodedSamples); } static int sceMp3SetLoopNum(u32 mp3, int loop) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); } else if (ctx->AuBuf == 0) { - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); } if (loop < 0) loop = -1; ctx->LoopNum = loop; - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static int sceMp3GetMp3ChannelNum(u32 mp3) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); } else if (ctx->Version < 0) { - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); } else if (ctx->AuBuf == 0) { - return hleLogWarning(ME, 0, "no channel available for low level"); + return hleLogWarning(Log::ME, 0, "no channel available for low level"); } - return hleLogSuccessI(ME, ctx->Channels); + return hleLogSuccessI(Log::ME, ctx->Channels); } static int sceMp3GetBitRate(u32 mp3) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); } else if (ctx->Version < 0) { - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); } else if (ctx->AuBuf == 0) { - return hleLogWarning(ME, 0, "no bitrate available for low level"); + return hleLogWarning(Log::ME, 0, "no bitrate available for low level"); } - return hleLogSuccessI(ME, ctx->BitRate); + return hleLogSuccessI(Log::ME, ctx->BitRate); } static int sceMp3GetSamplingRate(u32 mp3) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); } else if (ctx->Version < 0) { - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); } else if (ctx->AuBuf == 0) { - return hleLogWarning(ME, 0, "no sample rate available for low level"); + return hleLogWarning(Log::ME, 0, "no sample rate available for low level"); } - return hleLogSuccessI(ME, ctx->SamplingRate); + return hleLogSuccessI(Log::ME, ctx->SamplingRate); } static int sceMp3GetInfoToAddStreamData(u32 mp3, u32 dstPtr, u32 towritePtr, u32 srcposPtr) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); } else if (ctx->AuBuf == 0) { - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); } - return hleLogSuccessI(ME, ctx->AuGetInfoToAddStreamData(dstPtr, towritePtr, srcposPtr)); + return hleLogSuccessI(Log::ME, ctx->AuGetInfoToAddStreamData(dstPtr, towritePtr, srcposPtr)); } static int sceMp3NotifyAddStreamData(u32 mp3, int size) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); } else if (ctx->AuBuf == 0) { - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "incorrect handle type"); } - return hleLogSuccessI(ME, ctx->AuNotifyAddStreamData(size)); + return hleLogSuccessI(Log::ME, ctx->AuNotifyAddStreamData(size)); } static int sceMp3ReleaseMp3Handle(u32 mp3) { @@ -635,22 +635,22 @@ static int sceMp3ReleaseMp3Handle(u32 mp3) { if (ctx) { delete ctx; mp3Map.erase(mp3); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } else if (mp3 >= MP3_MAX_HANDLES) { - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); } // Intentionally a zero result. - return hleLogDebug(ME, 0, "double free ignored"); + return hleLogDebug(Log::ME, 0, "double free ignored"); } static u32 sceMp3EndEntry() { - ERROR_LOG_REPORT(ME, "UNIMPL sceMp3EndEntry(...)"); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMp3EndEntry(...)"); return 0; } static u32 sceMp3StartEntry() { - ERROR_LOG_REPORT(ME, "UNIMPL sceMp3StartEntry(...)"); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMp3StartEntry(...)"); return 0; } @@ -658,47 +658,47 @@ static u32 sceMp3GetFrameNum(u32 mp3) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); } else if (ctx->Version < 0 || ctx->AuBuf == 0) { - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); } - return hleLogSuccessI(ME, ctx->FrameNum); + return hleLogSuccessI(Log::ME, ctx->FrameNum); } static u32 sceMp3GetMPEGVersion(u32 mp3) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "unreserved handle"); } else if (ctx->Version < 0) { // Seems to be the wrong error code. - return hleLogError(ME, ERROR_MP3_UNRESERVED_HANDLE, "not yet init"); + return hleLogError(Log::ME, ERROR_MP3_UNRESERVED_HANDLE, "not yet init"); } else if (ctx->AuBuf == 0) { - return hleLogWarning(ME, 0, "no MPEG version available for low level"); + return hleLogWarning(Log::ME, 0, "no MPEG version available for low level"); } // Tests have not revealed how to expose more than "3" here as a result. - return hleReportDebug(ME, ctx->Version); + return hleReportDebug(Log::ME, ctx->Version); } static u32 sceMp3ResetPlayPositionByFrame(u32 mp3, u32 frame) { AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { if (mp3 >= MP3_MAX_HANDLES) - return hleLogError(ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); + return hleLogError(Log::ME, ERROR_MP3_INVALID_HANDLE, "invalid handle"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "unreserved handle"); } else if (ctx->Version < 0 || ctx->AuBuf == 0) { - return hleLogError(ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); + return hleLogError(Log::ME, ERROR_MP3_NOT_YET_INIT_HANDLE, "not yet init"); } if (frame >= (u32)ctx->FrameNum) { - return hleLogError(ME, ERROR_MP3_BAD_RESET_FRAME, "bad frame position"); + return hleLogError(Log::ME, ERROR_MP3_BAD_RESET_FRAME, "bad frame position"); } - return hleLogSuccessI(ME, ctx->AuResetPlayPositionByFrame(frame)); + return hleLogSuccessI(Log::ME, ctx->AuResetPlayPositionByFrame(frame)); } static u32 sceMp3LowLevelInit(u32 mp3, u32 unk) { @@ -717,7 +717,7 @@ static u32 sceMp3LowLevelInit(u32 mp3, u32 unk) { // Indicate that we've run low level init by setting version to 1. ctx->Version = 1; - return hleLogSuccessInfoI(ME, hleDelayResult(0, "mp3 low level", 600)); + return hleLogSuccessInfoI(Log::ME, hleDelayResult(0, "mp3 low level", 600)); } static u32 sceMp3LowLevelDecode(u32 mp3, u32 sourceAddr, u32 sourceBytesConsumedAddr, u32 samplesAddr, u32 sampleBytesAddr) { @@ -725,17 +725,17 @@ static u32 sceMp3LowLevelDecode(u32 mp3, u32 sourceAddr, u32 sourceBytesConsumed // sourceBytesConsumedAddr: consumed bytes decoded in source // samplesAddr: output pcm buffer // sampleBytesAddr: output pcm size - DEBUG_LOG(ME, "sceMp3LowLevelDecode(%08x, %08x, %08x, %08x, %08x)", mp3, sourceAddr, sourceBytesConsumedAddr, samplesAddr, sampleBytesAddr); + DEBUG_LOG(Log::ME, "sceMp3LowLevelDecode(%08x, %08x, %08x, %08x, %08x)", mp3, sourceAddr, sourceBytesConsumedAddr, samplesAddr, sampleBytesAddr); AuCtx *ctx = getMp3Ctx(mp3); if (!ctx) { - ERROR_LOG(ME, "%s: bad mp3 handle %08x", __FUNCTION__, mp3); + ERROR_LOG(Log::ME, "%s: bad mp3 handle %08x", __FUNCTION__, mp3); return -1; } if (!Memory::IsValidAddress(sourceAddr) || !Memory::IsValidAddress(sourceBytesConsumedAddr) || !Memory::IsValidAddress(samplesAddr) || !Memory::IsValidAddress(sampleBytesAddr)) { - ERROR_LOG(ME, "sceMp3LowLevelDecode(%08x, %08x, %08x, %08x, %08x) : invalid address in args", mp3, sourceAddr, sourceBytesConsumedAddr, samplesAddr, sampleBytesAddr); + ERROR_LOG(Log::ME, "sceMp3LowLevelDecode(%08x, %08x, %08x, %08x, %08x) : invalid address in args", mp3, sourceAddr, sourceBytesConsumedAddr, samplesAddr, sampleBytesAddr); return -1; } diff --git a/Core/HLE/sceMp4.cpp b/Core/HLE/sceMp4.cpp index a716e8fa78..bd6cdf2f11 100644 --- a/Core/HLE/sceMp4.cpp +++ b/Core/HLE/sceMp4.cpp @@ -50,80 +50,80 @@ void __AACDoState(PointerWrap &p) { static u32 sceMp4Init() { - INFO_LOG(ME, "sceMp4Init()"); + INFO_LOG(Log::ME, "sceMp4Init()"); return 0; } static u32 sceMp4Finish() { - ERROR_LOG(ME, "UNIMPL sceMp4Finish()"); + ERROR_LOG(Log::ME, "UNIMPL sceMp4Finish()"); return 0; } static u32 sceMp4Create(u32 mp4, u32 callbacks, u32 readBufferAddr, u32 readBufferSize) { - ERROR_LOG_REPORT(ME, "UNIMPL sceMp4Create(mp4 %i,callbacks %08x,readBufferAddr %08x,readBufferSize %i)", mp4, callbacks, readBufferAddr, readBufferSize); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMp4Create(mp4 %i,callbacks %08x,readBufferAddr %08x,readBufferSize %i)", mp4, callbacks, readBufferAddr, readBufferSize); return 0; } static u32 sceMp4GetNumberOfSpecificTrack() { - ERROR_LOG(ME, "UNIMPL sceMp4GetNumberOfSpecificTrack()"); + ERROR_LOG(Log::ME, "UNIMPL sceMp4GetNumberOfSpecificTrack()"); return 1; } static u32 sceMp4GetMovieInfo(u32 mp4, u32 unknown2) { - ERROR_LOG(ME, "UNIMPL sceMp4GetMovieInfo(mp4 %i, unknown2 %08x)",mp4, unknown2); + ERROR_LOG(Log::ME, "UNIMPL sceMp4GetMovieInfo(mp4 %i, unknown2 %08x)",mp4, unknown2); return 0; } static u32 sceMp4TrackSampleBufAvailableSize(u32 mp4, u32 trackAddr, u32 writableSamplesAddr, u32 writableBytesAddr) { - return hleLogError(ME, 0, "unimplemented"); + return hleLogError(Log::ME, 0, "unimplemented"); } static u32 sceMp4Delete(u32 mp4) { - return hleLogError(ME, 0, "unimplemented"); + return hleLogError(Log::ME, 0, "unimplemented"); } static u32 sceMp4AacDecodeInitResource(int unknown) { - ERROR_LOG(ME, "UNIMPL sceMp4AacDecodeInitResource(%i)",unknown); + ERROR_LOG(Log::ME, "UNIMPL sceMp4AacDecodeInitResource(%i)",unknown); return 0; } static u32 sceMp4InitAu(u32 mp4, u32 unknown2, u32 auAddr) { // unknown2 = return value of sceMpegAvcResourceGetAvcEsBuf() - ERROR_LOG(ME, "UNIMPL sceMp4InitAu(mp4 %i,unknown2 %08x,auAddr %08x)", mp4, unknown2, auAddr); + ERROR_LOG(Log::ME, "UNIMPL sceMp4InitAu(mp4 %i,unknown2 %08x,auAddr %08x)", mp4, unknown2, auAddr); return 0; } static u32 sceMp4GetAvcAu(u32 mp4, u32 unknown2, u32 auAddr, u32 unknown4) { // unknown2 = return value of sceMpegAvcResourceGetAvcEsBuf() - ERROR_LOG(ME, "UNIMPL sceMp4InitAu(mp4 %i,unknown2 %08x,auAddr %08x,unknown4 %08x)", mp4, unknown2, auAddr, unknown4); + ERROR_LOG(Log::ME, "UNIMPL sceMp4InitAu(mp4 %i,unknown2 %08x,auAddr %08x,unknown4 %08x)", mp4, unknown2, auAddr, unknown4); return 0; } static u32 sceMp4GetAvcTrackInfoData() { - ERROR_LOG(ME, "UNIMPL sceMp4GetAvcTrackInfoData()"); + ERROR_LOG(Log::ME, "UNIMPL sceMp4GetAvcTrackInfoData()"); return 0; } static u32 sceMp4TrackSampleBufConstruct(u32 mp4, u32 unknown2, u32 unknown3, u32 unknown4, u32 unknown5, u32 unknown6, u32 unknown7) { // unknown4 == value returned by sceMp4_BCA9389C - ERROR_LOG(ME, "UNIMPL sceMp4TrackSampleBufConstruct(mp4 %i,unknown2 %08x,unknown3 %08x, unknown4 %08x, unknown5 %08x, unknown6 %08x, unknown7 %08x)", mp4, unknown2, unknown3, unknown4, unknown5, unknown6, unknown7); + ERROR_LOG(Log::ME, "UNIMPL sceMp4TrackSampleBufConstruct(mp4 %i,unknown2 %08x,unknown3 %08x, unknown4 %08x, unknown5 %08x, unknown6 %08x, unknown7 %08x)", mp4, unknown2, unknown3, unknown4, unknown5, unknown6, unknown7); return 0; } static u32 sceMp4TrackSampleBufQueryMemSize(u32 unknown1, u32 unknown2, u32 unknown3, u32 unknown4, u32 unknown5) { u32 value = std::max(unknown2 * unknown3, unknown4 << 1) + (unknown2 << 6) + unknown5 + 256; - ERROR_LOG(ME, "sceMp4TrackSampleBufQueryMemSize return %i",value); + ERROR_LOG(Log::ME, "sceMp4TrackSampleBufQueryMemSize return %i",value); return value; } @@ -132,7 +132,7 @@ static u32 sceMp4AacDecode(u32 mp4, u32 auAddr, u32 bufferAddr, u32 init, u32 fr // Decode audio: // - init: 1 at first call, 0 afterwards // - frequency: 44100 - ERROR_LOG(ME, "sceMp4AacDecode(mp4 %i,auAddr %08x,bufferAddr %08x,init %i,frequency %i ", mp4, auAddr, bufferAddr, init, frequency); + ERROR_LOG(Log::ME, "sceMp4AacDecode(mp4 %i,auAddr %08x,bufferAddr %08x,init %i,frequency %i ", mp4, auAddr, bufferAddr, init, frequency); return 0; //This is hack //return -1; @@ -141,55 +141,55 @@ static u32 sceMp4AacDecode(u32 mp4, u32 auAddr, u32 bufferAddr, u32 init, u32 fr static u32 sceMp4GetAacAu(u32 mp4, u32 unknown2, u32 auAddr, u32 unknown4) { // unknown4: pointer to a 40-bytes structure - ERROR_LOG(ME, "sceMp4GetAacAu(mp4 %i,unknown2 %08x,auAddr %08x,unknown4 %i ", mp4, unknown2, auAddr, unknown4); + ERROR_LOG(Log::ME, "sceMp4GetAacAu(mp4 %i,unknown2 %08x,auAddr %08x,unknown4 %i ", mp4, unknown2, auAddr, unknown4); return 0; } static u32 sceMp4GetSampleInfo() { - ERROR_LOG(ME, "UNIMPL sceMp4GetSampleInfo()"); + ERROR_LOG(Log::ME, "UNIMPL sceMp4GetSampleInfo()"); return 0; } static u32 sceMp4GetSampleNumWithTimeStamp() { - ERROR_LOG(ME, "UNIMPL sceMp4GetSampleNumWithTimeStamp()"); + ERROR_LOG(Log::ME, "UNIMPL sceMp4GetSampleNumWithTimeStamp()"); return 0; } static u32 sceMp4TrackSampleBufFlush() { - ERROR_LOG(ME, "UNIMPL sceMp4TrackSampleBufFlush()"); + ERROR_LOG(Log::ME, "UNIMPL sceMp4TrackSampleBufFlush()"); return 0; } static u32 sceMp4AacDecodeInit(int unknown) { - ERROR_LOG(ME, "UNIMPL sceMp4AacDecodeInit(%i)",unknown); + ERROR_LOG(Log::ME, "UNIMPL sceMp4AacDecodeInit(%i)",unknown); return 0; } static u32 sceMp4GetAacTrackInfoData() { - ERROR_LOG(ME, "UNIMPL sceMp4GetAacTrackInfoData()"); + ERROR_LOG(Log::ME, "UNIMPL sceMp4GetAacTrackInfoData()"); return 0; } static u32 sceMp4GetNumberOfMetaData() { - ERROR_LOG(ME, "UNIMPL sceMp4GetNumberOfMetaData()"); + ERROR_LOG(Log::ME, "UNIMPL sceMp4GetNumberOfMetaData()"); return 0; } static u32 sceMp4RegistTrack(u32 mp4, u32 unknown2, u32 unknown3, u32 callbacks, u32 unknown5) { - ERROR_LOG(ME, "UNIMPL sceMp4RegistTrack(mp4 %i,unknown2 %i,unknown3 %i,callbacks %i unknown5 %i)",mp4,unknown2,unknown3,callbacks,unknown5); + ERROR_LOG(Log::ME, "UNIMPL sceMp4RegistTrack(mp4 %i,unknown2 %i,unknown3 %i,callbacks %i unknown5 %i)",mp4,unknown2,unknown3,callbacks,unknown5); return 0; } static u32 sceMp4SearchSyncSampleNum() { - ERROR_LOG(ME, "UNIMPL sceMp4SearchSyncSampleNum()"); + ERROR_LOG(Log::ME, "UNIMPL sceMp4SearchSyncSampleNum()"); return 0; } @@ -198,13 +198,13 @@ static u32 sceMp4SearchSyncSampleNum() static u32 sceAacExit(u32 id) { - INFO_LOG(ME, "sceAacExit(id %i)", id); + INFO_LOG(Log::ME, "sceAacExit(id %i)", id); if (aacMap.find(id) != aacMap.end()) { delete aacMap[id]; aacMap.erase(id); } else{ - ERROR_LOG(ME, "%s: bad aac id %08x", __FUNCTION__, id); + ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id); return -1; } return 0; @@ -212,42 +212,42 @@ static u32 sceAacExit(u32 id) static u32 sceAacInit(u32 id) { - INFO_LOG(ME, "UNIMPL sceAacInit(%08x)", id); + INFO_LOG(Log::ME, "UNIMPL sceAacInit(%08x)", id); if (!Memory::IsValidAddress(id)){ - ERROR_LOG(ME, "sceAacInit() AAC Invalid id address %08x", id); + ERROR_LOG(Log::ME, "sceAacInit() AAC Invalid id address %08x", id); return ERROR_AAC_INVALID_ADDRESS; } AuCtx *aac = new AuCtx(); - aac->startPos = Memory::Read_U64(id); // Audio stream start position. - aac->endPos = Memory::Read_U32(id + 8); // Audio stream end position. + aac->startPos = Memory::Read_U64(id); // AUDIO stream start position. + aac->endPos = Memory::Read_U32(id + 8); // AUDIO stream end position. aac->AuBuf = Memory::Read_U32(id + 16); // Input AAC data buffer. aac->AuBufSize = Memory::Read_U32(id + 20); // Input AAC data buffer size. aac->PCMBuf = Memory::Read_U32(id + 24); // Output PCM data buffer. aac->PCMBufSize = Memory::Read_U32(id + 28); // Output PCM data buffer size. aac->freq = Memory::Read_U32(id + 32); // Frequency. if (aac->AuBuf == 0 || aac->PCMBuf == 0) { - ERROR_LOG(ME, "sceAacInit() AAC INVALID ADDRESS AuBuf %08x PCMBuf %08x", aac->AuBuf, aac->PCMBuf); + ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID ADDRESS AuBuf %08x PCMBuf %08x", aac->AuBuf, aac->PCMBuf); delete aac; return ERROR_AAC_INVALID_ADDRESS; } if (aac->startPos > aac->endPos) { - ERROR_LOG(ME, "sceAacInit() AAC INVALID startPos %lli endPos %lli", aac->startPos, aac->endPos); + ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID startPos %lli endPos %lli", aac->startPos, aac->endPos); delete aac; return ERROR_AAC_INVALID_PARAMETER; } if (aac->AuBufSize < 8192 || aac->PCMBufSize < 8192) { - ERROR_LOG(ME, "sceAacInit() AAC INVALID PARAMETER, bufferSize %i outputSize %i", aac->AuBufSize, aac->PCMBufSize); + ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID PARAMETER, bufferSize %i outputSize %i", aac->AuBufSize, aac->PCMBufSize); delete aac; return ERROR_AAC_INVALID_PARAMETER; } if (aac->freq != 24000 && aac->freq != 32000 && aac->freq != 44100 && aac->freq != 48000) { - ERROR_LOG(ME, "sceAacInit() AAC INVALID freq %i", aac->freq); + ERROR_LOG(Log::ME, "sceAacInit() AAC INVALID freq %i", aac->freq); delete aac; return ERROR_AAC_INVALID_PARAMETER; } - DEBUG_LOG(ME, "startPos %llx endPos %llx AuBuf %08x AuBufSize %08x PCMbuf %08x PCMbufSize %08x freq %d", + DEBUG_LOG(Log::ME, "startPos %llx endPos %llx AuBuf %08x AuBufSize %08x PCMbuf %08x PCMbufSize %08x freq %d", aac->startPos, aac->endPos, aac->AuBuf, aac->AuBufSize, aac->PCMBuf, aac->PCMBufSize, aac->freq); aac->Channels = 2; @@ -270,23 +270,23 @@ static u32 sceAacInit(u32 id) static u32 sceAacInitResource(u32 numberIds) { // Do nothing here - INFO_LOG_REPORT(ME, "sceAacInitResource(%i)", numberIds); + INFO_LOG_REPORT(Log::ME, "sceAacInitResource(%i)", numberIds); return 0; } static u32 sceAacTermResource() { - ERROR_LOG(ME, "UNIMPL sceAacTermResource()"); + ERROR_LOG(Log::ME, "UNIMPL sceAacTermResource()"); return 0; } static u32 sceAacDecode(u32 id, u32 pcmAddr) { // return the size of output pcm, <0 error - DEBUG_LOG(ME, "sceAacDecode(id %i, bufferAddress %08x)", id, pcmAddr); + DEBUG_LOG(Log::ME, "sceAacDecode(id %i, bufferAddress %08x)", id, pcmAddr); auto ctx = getAacCtx(id); if (!ctx) { - ERROR_LOG(ME, "%s: bad aac id %08x", __FUNCTION__, id); + ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id); return -1; } @@ -295,10 +295,10 @@ static u32 sceAacDecode(u32 id, u32 pcmAddr) static u32 sceAacGetLoopNum(u32 id) { - INFO_LOG(ME, "sceAacGetLoopNum(id %i)", id); + INFO_LOG(Log::ME, "sceAacGetLoopNum(id %i)", id); auto ctx = getAacCtx(id); if (!ctx) { - ERROR_LOG(ME, "%s: bad aac id %08x", __FUNCTION__, id); + ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id); return -1; } return ctx->LoopNum; @@ -306,10 +306,10 @@ static u32 sceAacGetLoopNum(u32 id) static u32 sceAacSetLoopNum(u32 id, int loop) { - INFO_LOG(ME, "sceAacSetLoopNum(id %i,loop %d)", id, loop); + INFO_LOG(Log::ME, "sceAacSetLoopNum(id %i,loop %d)", id, loop); auto ctx = getAacCtx(id); if (!ctx) { - ERROR_LOG(ME, "%s: bad aac id %08x", __FUNCTION__, id); + ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id); return -1; } @@ -320,11 +320,11 @@ static u32 sceAacSetLoopNum(u32 id, int loop) static int sceAacCheckStreamDataNeeded(u32 id) { // return 1 to read more data stream, 0 don't read, <0 error - DEBUG_LOG(ME, "sceAacCheckStreamDataNeeded(%i)", id); + DEBUG_LOG(Log::ME, "sceAacCheckStreamDataNeeded(%i)", id); auto ctx = getAacCtx(id); if (!ctx) { - ERROR_LOG(ME, "%s: bad aac id %08x", __FUNCTION__, id); + ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id); return -1; } @@ -334,11 +334,11 @@ static int sceAacCheckStreamDataNeeded(u32 id) static u32 sceAacNotifyAddStreamData(u32 id, int size) { // check how many bytes we have read from source file - DEBUG_LOG(ME, "sceAacNotifyAddStreamData(%i, %08x)", id, size); + DEBUG_LOG(Log::ME, "sceAacNotifyAddStreamData(%i, %08x)", id, size); auto ctx = getAacCtx(id); if (!ctx) { - ERROR_LOG(ME, "%s: bad aac id %08x", __FUNCTION__, id); + ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id); return -1; } @@ -348,11 +348,11 @@ static u32 sceAacNotifyAddStreamData(u32 id, int size) static u32 sceAacGetInfoToAddStreamData(u32 id, u32 buff, u32 size, u32 srcPos) { // read from stream position srcPos of size bytes into buff - DEBUG_LOG(ME, "sceAacGetInfoToAddStreamData(%08X, %08X, %08X, %08X)", id, buff, size, srcPos); + DEBUG_LOG(Log::ME, "sceAacGetInfoToAddStreamData(%08X, %08X, %08X, %08X)", id, buff, size, srcPos); auto ctx = getAacCtx(id); if (!ctx) { - ERROR_LOG(ME, "%s: bad aac handle %08x", __FUNCTION__, id); + ERROR_LOG(Log::ME, "%s: bad aac handle %08x", __FUNCTION__, id); return -1; } @@ -361,10 +361,10 @@ static u32 sceAacGetInfoToAddStreamData(u32 id, u32 buff, u32 size, u32 srcPos) static u32 sceAacGetMaxOutputSample(u32 id) { - DEBUG_LOG(ME, "sceAacGetMaxOutputSample(id %i)", id); + DEBUG_LOG(Log::ME, "sceAacGetMaxOutputSample(id %i)", id); auto ctx = getAacCtx(id); if (!ctx) { - ERROR_LOG(ME, "%s: bad aac id %08x", __FUNCTION__, id); + ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id); return -1; } @@ -373,10 +373,10 @@ static u32 sceAacGetMaxOutputSample(u32 id) static u32 sceAacGetSumDecodedSample(u32 id) { - DEBUG_LOG(ME, "sceAacGetSumDecodedSample(id %i)", id); + DEBUG_LOG(Log::ME, "sceAacGetSumDecodedSample(id %i)", id); auto ctx = getAacCtx(id); if (!ctx) { - ERROR_LOG(ME, "%s: bad aac id %08x", __FUNCTION__, id); + ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id); return -1; } @@ -385,10 +385,10 @@ static u32 sceAacGetSumDecodedSample(u32 id) static u32 sceAacResetPlayPosition(u32 id) { - INFO_LOG(ME, "sceAacResetPlayPosition(id %i)", id); + INFO_LOG(Log::ME, "sceAacResetPlayPosition(id %i)", id); auto ctx = getAacCtx(id); if (!ctx) { - ERROR_LOG(ME, "%s: bad aac id %08x", __FUNCTION__, id); + ERROR_LOG(Log::ME, "%s: bad aac id %08x", __FUNCTION__, id); return -1; } @@ -396,12 +396,12 @@ static u32 sceAacResetPlayPosition(u32 id) } static u32 mp4msv_3C2183C7(u32 unknown1, u32 unknown2) { - ERROR_LOG(ME, "UNIMPL mp4msv_3C2183C7(%d, %x)", unknown1, unknown2); + ERROR_LOG(Log::ME, "UNIMPL mp4msv_3C2183C7(%d, %x)", unknown1, unknown2); return 0; } static u32 mp4msv_9CA13D1A(u32 unknown1, u32 unknown2) { - ERROR_LOG(ME, "UNIMPL mp4msv_9CA13D1A(%d, %x)", unknown1, unknown2); + ERROR_LOG(Log::ME, "UNIMPL mp4msv_9CA13D1A(%d, %x)", unknown1, unknown2); return 0; } diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index b4e252208f..1c3b8f6566 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -340,7 +340,7 @@ static void AnalyzeMpeg(const u8 *buffer, u32 validSize, MpegContext *ctx) { // Sanity Check ctx->mpegFirstTimestamp if (ctx->mpegFirstTimestamp != 90000) { - WARN_LOG_REPORT(ME, "Unexpected mpeg first timestamp: %llx / %lld", ctx->mpegFirstTimestamp, ctx->mpegFirstTimestamp); + WARN_LOG_REPORT(Log::ME, "Unexpected mpeg first timestamp: %llx / %lld", ctx->mpegFirstTimestamp, ctx->mpegFirstTimestamp); } if (ctx->mpegMagic != PSMF_MAGIC || ctx->mpegVersion < 0 || @@ -370,8 +370,8 @@ static void AnalyzeMpeg(const u8 *buffer, u32 validSize, MpegContext *ctx) { memcpy(ctx->mpegheader, buffer, validSize >= 2048 ? 2048 : validSize); *(u32_le*)(ctx->mpegheader + PSMF_STREAM_OFFSET_OFFSET) = 0x80000; - INFO_LOG(ME, "Stream offset: %d, Stream size: 0x%X", ctx->mpegOffset, ctx->mpegStreamSize); - INFO_LOG(ME, "First timestamp: %lld, Last timestamp: %lld", ctx->mpegFirstTimestamp, ctx->mpegLastTimestamp); + INFO_LOG(Log::ME, "Stream offset: %d, Stream size: 0x%X", ctx->mpegOffset, ctx->mpegStreamSize); + INFO_LOG(Log::ME, "First timestamp: %lld, Last timestamp: %lld", ctx->mpegFirstTimestamp, ctx->mpegLastTimestamp); } class PostPutAction : public PSPAction { @@ -459,11 +459,11 @@ void __MpegLoadModule(int version,u32 crc) { static u32 sceMpegInit() { if (isMpegInit) { - WARN_LOG(ME, "sceMpegInit(): already initialized"); + WARN_LOG(Log::ME, "sceMpegInit(): already initialized"); // TODO: Need to properly hook module load/unload for this to work right. //return ERROR_MPEG_ALREADY_INIT; } else { - INFO_LOG(ME, "sceMpegInit(), mpegLibVersion 0x%0x, mpegLibcrc %x", mpegLibVersion, mpegLibCrc); + INFO_LOG(Log::ME, "sceMpegInit(), mpegLibVersion 0x%0x, mpegLibcrc %x", mpegLibVersion, mpegLibCrc); } isMpegInit = true; return hleDelayResult(0, "mpeg init", 750); @@ -475,33 +475,33 @@ static u32 __MpegRingbufferQueryMemSize(int packets) { static u32 sceMpegRingbufferQueryMemSize(int packets) { u32 size = __MpegRingbufferQueryMemSize(packets); - DEBUG_LOG(ME, "%i = sceMpegRingbufferQueryMemSize(%i)", size, packets); + DEBUG_LOG(Log::ME, "%i = sceMpegRingbufferQueryMemSize(%i)", size, packets); return size; } static u32 sceMpegRingbufferConstruct(u32 ringbufferAddr, u32 numPackets, u32 data, u32 size, u32 callbackAddr, u32 callbackArg) { if (!Memory::IsValidAddress(ringbufferAddr)) { - ERROR_LOG_REPORT(ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): bad ringbuffer, should crash", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); + ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): bad ringbuffer, should crash", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); return SCE_KERNEL_ERROR_ILLEGAL_ADDRESS; } if ((int)size < 0) { - ERROR_LOG_REPORT(ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): invalid size", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); + ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): invalid size", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); return ERROR_MPEG_NO_MEMORY; } if (__MpegRingbufferQueryMemSize(numPackets) > size) { if (numPackets < 0x00100000) { - ERROR_LOG_REPORT(ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): too many packets for buffer", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); + ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): too many packets for buffer", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); return ERROR_MPEG_NO_MEMORY; } else { // The PSP's firmware allows some cases here, due to a bug in its validation. - ERROR_LOG_REPORT(ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): too many packets for buffer, bogus size", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); + ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x): too many packets for buffer, bogus size", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); } } - DEBUG_LOG(ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x)", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); + DEBUG_LOG(Log::ME, "sceMpegRingbufferConstruct(%08x, %i, %08x, %08x, %08x, %08x)", ringbufferAddr, numPackets, data, size, callbackAddr, callbackArg); auto ring = PSPPointer::Create(ringbufferAddr); InitRingbuffer(ring, numPackets, data, size, callbackAddr, callbackArg); return 0; @@ -517,12 +517,12 @@ static u32 MpegRequiredMem() { static u32 sceMpegCreate(u32 mpegAddr, u32 dataPtr, u32 size, u32 ringbufferAddr, u32 frameWidth, u32 mode, u32 ddrTop) { if (!Memory::IsValidAddress(mpegAddr)) { - WARN_LOG(ME, "sceMpegCreate(%08x, %08x, %i, %08x, %i, %i, %i): invalid addresses", mpegAddr, dataPtr, size, ringbufferAddr, frameWidth, mode, ddrTop); + WARN_LOG(Log::ME, "sceMpegCreate(%08x, %08x, %i, %08x, %i, %i, %i): invalid addresses", mpegAddr, dataPtr, size, ringbufferAddr, frameWidth, mode, ddrTop); return -1; } if (size < MpegRequiredMem()) { - WARN_LOG(ME, "ERROR_MPEG_NO_MEMORY=sceMpegCreate(%08x, %08x, %i, %08x, %i, %i, %i)", mpegAddr, dataPtr, size, ringbufferAddr, frameWidth, mode, ddrTop); + WARN_LOG(Log::ME, "ERROR_MPEG_NO_MEMORY=sceMpegCreate(%08x, %08x, %i, %08x, %i, %i, %i)", mpegAddr, dataPtr, size, ringbufferAddr, frameWidth, mode, ddrTop); return ERROR_MPEG_NO_MEMORY; } @@ -550,7 +550,7 @@ static u32 sceMpegCreate(u32 mpegAddr, u32 dataPtr, u32 size, u32 ringbufferAddr } MpegContext *ctx = new MpegContext(); if (mpegMap.find(mpegHandle) != mpegMap.end()) { - WARN_LOG_REPORT(HLE, "Replacing existing mpeg context at %08x", mpegAddr); + WARN_LOG_REPORT(Log::HLE, "Replacing existing mpeg context at %08x", mpegAddr); // Otherwise, it would leak. delete mpegMap[mpegHandle]; } @@ -579,7 +579,7 @@ static u32 sceMpegCreate(u32 mpegAddr, u32 dataPtr, u32 size, u32 ringbufferAddr ctx->isAnalyzed = false; ctx->mediaengine = new MediaEngine(); - INFO_LOG(ME, "%08x=sceMpegCreate(%08x, %08x, %i, %08x, %i, %i, %i)", mpegHandle, mpegAddr, dataPtr, size, ringbufferAddr, frameWidth, mode, ddrTop); + INFO_LOG(Log::ME, "%08x=sceMpegCreate(%08x, %08x, %i, %08x, %i, %i, %i)", mpegHandle, mpegAddr, dataPtr, size, ringbufferAddr, frameWidth, mode, ddrTop); return hleDelayResult(0, "mpeg create", 29000); } @@ -587,11 +587,11 @@ static int sceMpegDelete(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegDelete(%08x): bad mpeg handle", mpeg); + WARN_LOG(Log::ME, "sceMpegDelete(%08x): bad mpeg handle", mpeg); return -1; } - DEBUG_LOG(ME, "sceMpegDelete(%08x)", mpeg); + DEBUG_LOG(Log::ME, "sceMpegDelete(%08x)", mpeg); delete ctx; mpegMap.erase(Memory::Read_U32(mpeg)); @@ -603,24 +603,24 @@ static int sceMpegDelete(u32 mpeg) static int sceMpegAvcDecodeMode(u32 mpeg, u32 modeAddr) { if (!Memory::IsValidAddress(modeAddr)) { - WARN_LOG(ME, "sceMpegAvcDecodeMode(%08x, %08x): invalid addresses", mpeg, modeAddr); + WARN_LOG(Log::ME, "sceMpegAvcDecodeMode(%08x, %08x): invalid addresses", mpeg, modeAddr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegAvcDecodeMode(%08x, %08x): bad mpeg handle", mpeg, modeAddr); + WARN_LOG(Log::ME, "sceMpegAvcDecodeMode(%08x, %08x): bad mpeg handle", mpeg, modeAddr); return -1; } - DEBUG_LOG(ME, "sceMpegAvcDecodeMode(%08x, %08x)", mpeg, modeAddr); + DEBUG_LOG(Log::ME, "sceMpegAvcDecodeMode(%08x, %08x)", mpeg, modeAddr); int mode = Memory::Read_U32(modeAddr); int pixelMode = Memory::Read_U32(modeAddr + 4); if (pixelMode >= GE_CMODE_16BIT_BGR5650 && pixelMode <= GE_CMODE_32BIT_ABGR8888) { ctx->videoPixelMode = pixelMode; } else { - ERROR_LOG(ME, "sceMpegAvcDecodeMode(%i, %i): unknown pixelMode ", mode, pixelMode); + ERROR_LOG(Log::ME, "sceMpegAvcDecodeMode(%i, %i): unknown pixelMode ", mode, pixelMode); } return 0; } @@ -628,31 +628,31 @@ static int sceMpegAvcDecodeMode(u32 mpeg, u32 modeAddr) static int sceMpegQueryStreamOffset(u32 mpeg, u32 bufferAddr, u32 offsetAddr) { if (!Memory::IsValidAddress(bufferAddr) || !Memory::IsValidAddress(offsetAddr)) { - ERROR_LOG(ME, "sceMpegQueryStreamOffset(%08x, %08x, %08x): invalid addresses", mpeg, bufferAddr, offsetAddr); + ERROR_LOG(Log::ME, "sceMpegQueryStreamOffset(%08x, %08x, %08x): invalid addresses", mpeg, bufferAddr, offsetAddr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegQueryStreamOffset(%08x, %08x, %08x): bad mpeg handle", mpeg, bufferAddr, offsetAddr); + WARN_LOG(Log::ME, "sceMpegQueryStreamOffset(%08x, %08x, %08x): bad mpeg handle", mpeg, bufferAddr, offsetAddr); return -1; } - DEBUG_LOG(ME, "sceMpegQueryStreamOffset(%08x, %08x, %08x)", mpeg, bufferAddr, offsetAddr); + DEBUG_LOG(Log::ME, "sceMpegQueryStreamOffset(%08x, %08x, %08x)", mpeg, bufferAddr, offsetAddr); // Kinda destructive, no? Shouldn't this just do what sceMpegQueryStreamSize does? AnalyzeMpeg(Memory::GetPointerWriteUnchecked(bufferAddr), Memory::ValidSize(bufferAddr, 32768), ctx); if (ctx->mpegMagic != PSMF_MAGIC) { - ERROR_LOG(ME, "sceMpegQueryStreamOffset: Bad PSMF magic"); + ERROR_LOG(Log::ME, "sceMpegQueryStreamOffset: Bad PSMF magic"); Memory::Write_U32(0, offsetAddr); return ERROR_MPEG_INVALID_VALUE; } else if (ctx->mpegVersion < 0) { - ERROR_LOG(ME, "sceMpegQueryStreamOffset: Bad version"); + ERROR_LOG(Log::ME, "sceMpegQueryStreamOffset: Bad version"); Memory::Write_U32(0, offsetAddr); return ERROR_MPEG_BAD_VERSION; } else if ((ctx->mpegOffset & 2047) != 0 || ctx->mpegOffset == 0) { - ERROR_LOG(ME, "sceMpegQueryStreamOffset: Bad offset"); + ERROR_LOG(Log::ME, "sceMpegQueryStreamOffset: Bad offset"); Memory::Write_U32(0, offsetAddr); return ERROR_MPEG_INVALID_VALUE; } @@ -664,11 +664,11 @@ static int sceMpegQueryStreamOffset(u32 mpeg, u32 bufferAddr, u32 offsetAddr) static u32 sceMpegQueryStreamSize(u32 bufferAddr, u32 sizeAddr) { if (!Memory::IsValidAddress(bufferAddr) || !Memory::IsValidAddress(sizeAddr)) { - ERROR_LOG(ME, "sceMpegQueryStreamSize(%08x, %08x): invalid addresses", bufferAddr, sizeAddr); + ERROR_LOG(Log::ME, "sceMpegQueryStreamSize(%08x, %08x): invalid addresses", bufferAddr, sizeAddr); return -1; } - DEBUG_LOG(ME, "sceMpegQueryStreamSize(%08x, %08x)", bufferAddr, sizeAddr); + DEBUG_LOG(Log::ME, "sceMpegQueryStreamSize(%08x, %08x)", bufferAddr, sizeAddr); MpegContext ctx; ctx.mediaengine = nullptr; // makes sure we don't actually load the stream. @@ -677,11 +677,11 @@ static u32 sceMpegQueryStreamSize(u32 bufferAddr, u32 sizeAddr) AnalyzeMpeg(Memory::GetPointerWriteUnchecked(bufferAddr), Memory::ValidSize(bufferAddr, 32768), &ctx); if (ctx.mpegMagic != PSMF_MAGIC) { - ERROR_LOG(ME, "sceMpegQueryStreamSize: Bad PSMF magic"); + ERROR_LOG(Log::ME, "sceMpegQueryStreamSize: Bad PSMF magic"); Memory::Write_U32(0, sizeAddr); return ERROR_MPEG_INVALID_VALUE; } else if ((ctx.mpegOffset & 2047) != 0 ) { - ERROR_LOG(ME, "sceMpegQueryStreamSize: Bad offset"); + ERROR_LOG(Log::ME, "sceMpegQueryStreamSize: Bad offset"); Memory::Write_U32(0, sizeAddr); return ERROR_MPEG_INVALID_VALUE; } @@ -694,11 +694,11 @@ static int sceMpegRegistStream(u32 mpeg, u32 streamType, u32 streamNum) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegRegistStream(%08x, %i, %i): bad mpeg handle", mpeg, streamType, streamNum); + WARN_LOG(Log::ME, "sceMpegRegistStream(%08x, %i, %i): bad mpeg handle", mpeg, streamType, streamNum); return -1; } - INFO_LOG(ME, "sceMpegRegistStream(%08x, %i, %i)", mpeg, streamType, streamNum); + INFO_LOG(Log::ME, "sceMpegRegistStream(%08x, %i, %i)", mpeg, streamType, streamNum); switch (streamType) { case MPEG_AVC_STREAM: @@ -720,7 +720,7 @@ static int sceMpegRegistStream(u32 mpeg, u32 streamType, u32 streamNum) ctx->dataRegistered = true; break; default : - DEBUG_LOG(ME, "sceMpegRegistStream(%i) : unknown stream type", streamType); + DEBUG_LOG(Log::ME, "sceMpegRegistStream(%i) : unknown stream type", streamType); break; } // ... @@ -738,11 +738,11 @@ static int sceMpegMallocAvcEsBuf(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegMallocAvcEsBuf(%08x): bad mpeg handle", mpeg); + WARN_LOG(Log::ME, "sceMpegMallocAvcEsBuf(%08x): bad mpeg handle", mpeg); return -1; } - DEBUG_LOG(ME, "sceMpegMallocAvcEsBuf(%08x)", mpeg); + DEBUG_LOG(Log::ME, "sceMpegMallocAvcEsBuf(%08x)", mpeg); // Doesn't actually malloc, just keeps track of a couple of flags for (int i = 0; i < MPEG_DATA_ES_BUFFERS; i++) { @@ -759,11 +759,11 @@ static int sceMpegFreeAvcEsBuf(u32 mpeg, int esBuf) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegFreeAvcEsBuf(%08x, %i): bad mpeg handle", mpeg, esBuf); + WARN_LOG(Log::ME, "sceMpegFreeAvcEsBuf(%08x, %i): bad mpeg handle", mpeg, esBuf); return -1; } - DEBUG_LOG(ME, "sceMpegFreeAvcEsBuf(%08x, %i)", mpeg, esBuf); + DEBUG_LOG(Log::ME, "sceMpegFreeAvcEsBuf(%08x, %i)", mpeg, esBuf); if (esBuf == 0) { return ERROR_MPEG_INVALID_VALUE; @@ -808,14 +808,14 @@ static bool InitPmp(MpegContext * ctx){ // Create H264 video codec AVCodec * pmp_Codec = avcodec_find_decoder(AV_CODEC_ID_H264); if (pmp_Codec == NULL){ - ERROR_LOG(ME, "Can not find H264 codec, please update ffmpeg"); + ERROR_LOG(Log::ME, "Can not find H264 codec, please update ffmpeg"); return false; } // Create CodecContext AVCodecContext * pmp_CodecCtx = avcodec_alloc_context3(pmp_Codec); if (pmp_CodecCtx == NULL){ - ERROR_LOG(ME, "Can not allocate pmp Codec Context"); + ERROR_LOG(Log::ME, "Can not allocate pmp Codec Context"); return false; } @@ -833,7 +833,7 @@ static bool InitPmp(MpegContext * ctx){ // Open pmp video codec if (avcodec_open2(pmp_CodecCtx, pmp_Codec, NULL) < 0){ - ERROR_LOG(ME, "Can not open pmp video codec"); + ERROR_LOG(Log::ME, "Can not open pmp video codec"); return false; } @@ -957,7 +957,7 @@ static bool decodePmpVideo(PSPPointer ringbuffer, u32 pmpctxA if (isContextExist(pmpctxAddr) == false){ bool ret = InitPmp(ctx); if (!ret){ - ERROR_LOG(ME, "Pmp video initialization failed"); + ERROR_LOG(Log::ME, "Pmp video initialization failed"); return false; } // add the initialized context into ContextList @@ -1026,7 +1026,7 @@ static bool decodePmpVideo(PSPPointer ringbuffer, u32 pmpctxA #else int len = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, &packet); #endif - DEBUG_LOG(ME, "got_picture %d", got_picture); + DEBUG_LOG(Log::ME, "got_picture %d", got_picture); if (got_picture){ SwsContext *img_convert_ctx = NULL; img_convert_ctx = sws_getContext( @@ -1040,7 +1040,7 @@ static bool decodePmpVideo(PSPPointer ringbuffer, u32 pmpctxA NULL, NULL, NULL); if (!img_convert_ctx) { - ERROR_LOG(ME, "Cannot initialize sws conversion context"); + ERROR_LOG(Log::ME, "Cannot initialize sws conversion context"); return false; } @@ -1048,7 +1048,7 @@ static bool decodePmpVideo(PSPPointer ringbuffer, u32 pmpctxA int swsRet = sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize, 0, pCodecCtx->height, pFrameRGB->data, pFrameRGB->linesize); if (swsRet < 0){ - ERROR_LOG(ME, "sws_scale: Error while converting %d", swsRet); + ERROR_LOG(Log::ME, "sws_scale: Error while converting %d", swsRet); return false; } // free sws context @@ -1130,7 +1130,7 @@ static u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegAvcDecode(%08x, %08x, %d, %08x, %08x): bad mpeg handle", mpeg, auAddr, frameWidth, bufferAddr, initAddr); + WARN_LOG(Log::ME, "sceMpegAvcDecode(%08x, %08x, %d, %08x, %08x): bad mpeg handle", mpeg, auAddr, frameWidth, bufferAddr, initAddr); return -1; } @@ -1147,23 +1147,23 @@ static u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr auto ringbuffer = PSPPointer::Create(ctx->mpegRingbufferAddr); if (!ringbuffer.IsValid()) { - ERROR_LOG(ME, "Bogus mpegringbufferaddr"); + ERROR_LOG(Log::ME, "Bogus mpegringbufferaddr"); return -1; } u32 buffer = Memory::Read_U32(bufferAddr); u32 init = Memory::Read_U32(initAddr); - DEBUG_LOG(ME, "video: bufferAddr = %08x, *buffer = %08x, *init = %08x", bufferAddr, buffer, init); + DEBUG_LOG(Log::ME, "video: bufferAddr = %08x, *buffer = %08x, *init = %08x", bufferAddr, buffer, init); // check and decode pmp video bool ispmp = false; if (decodePmpVideo(ringbuffer, mpeg)){ - DEBUG_LOG(ME, "Using ffmpeg to decode pmp video"); + DEBUG_LOG(Log::ME, "Using ffmpeg to decode pmp video"); ispmp = true; } if (ringbuffer->packetsRead == 0 || ctx->mediaengine->IsVideoEnd()) { - WARN_LOG(ME, "sceMpegAvcDecode(%08x, %08x, %d, %08x, %08x): mpeg buffer empty", mpeg, auAddr, frameWidth, bufferAddr, initAddr); + WARN_LOG(Log::ME, "sceMpegAvcDecode(%08x, %08x, %d, %08x, %08x): mpeg buffer empty", mpeg, auAddr, frameWidth, bufferAddr, initAddr); return hleDelayResult(ERROR_MPEG_AVC_DECODE_FATAL, "mpeg buffer empty", avcEmptyDelayMs); } @@ -1220,7 +1220,7 @@ static u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr } ctx->avc.avcDecodeResult = MPEG_AVC_DECODE_SUCCESS; - DEBUG_LOG(ME, "sceMpegAvcDecode(%08x, %08x, %i, %08x, %08x)", mpeg, auAddr, frameWidth, bufferAddr, initAddr); + DEBUG_LOG(Log::ME, "sceMpegAvcDecode(%08x, %08x, %i, %08x, %08x)", mpeg, auAddr, frameWidth, bufferAddr, initAddr); if (ctx->videoFrameCount <= 1) return hleDelayResult(0, "mpeg decode", avcFirstDelayMs); @@ -1233,17 +1233,17 @@ static u32 sceMpegAvcDecode(u32 mpeg, u32 auAddr, u32 frameWidth, u32 bufferAddr static u32 sceMpegAvcDecodeStop(u32 mpeg, u32 frameWidth, u32 bufferAddr, u32 statusAddr) { if (!Memory::IsValidAddress(bufferAddr) || !Memory::IsValidAddress(statusAddr)){ - ERROR_LOG(ME, "sceMpegAvcDecodeStop(%08x, %08x, %08x, %08x): invalid addresses", mpeg, frameWidth, bufferAddr, statusAddr); + ERROR_LOG(Log::ME, "sceMpegAvcDecodeStop(%08x, %08x, %08x, %08x): invalid addresses", mpeg, frameWidth, bufferAddr, statusAddr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegAvcDecodeStop(%08x, %08x, %08x, %08x): bad mpeg handle", mpeg, frameWidth, bufferAddr, statusAddr); + WARN_LOG(Log::ME, "sceMpegAvcDecodeStop(%08x, %08x, %08x, %08x): bad mpeg handle", mpeg, frameWidth, bufferAddr, statusAddr); return -1; } - DEBUG_LOG(ME, "sceMpegAvcDecodeStop(%08x, %08x, %08x, %08x)", mpeg, frameWidth, bufferAddr, statusAddr); + DEBUG_LOG(Log::ME, "sceMpegAvcDecodeStop(%08x, %08x, %08x, %08x)", mpeg, frameWidth, bufferAddr, statusAddr); // No last frame generated Memory::Write_U32(0, statusAddr); @@ -1254,7 +1254,7 @@ static u32 sceMpegUnRegistStream(u32 mpeg, int streamUid) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegUnRegistStream(%08x, %i): bad mpeg handle", mpeg, streamUid); + WARN_LOG(Log::ME, "sceMpegUnRegistStream(%08x, %i): bad mpeg handle", mpeg, streamUid); return -1; } @@ -1275,7 +1275,7 @@ static u32 sceMpegUnRegistStream(u32 mpeg, int streamUid) ctx->dataRegistered = false; break; default : - DEBUG_LOG(ME, "sceMpegUnRegistStream(%i) : unknown streamID ", streamUid); + DEBUG_LOG(Log::ME, "sceMpegUnRegistStream(%i) : unknown streamID ", streamUid); break; } ctx->streamMap[streamUid] = info; @@ -1289,17 +1289,17 @@ static u32 sceMpegUnRegistStream(u32 mpeg, int streamUid) static int sceMpegAvcDecodeDetail(u32 mpeg, u32 detailAddr) { if (!Memory::IsValidAddress(detailAddr)){ - WARN_LOG(ME, "sceMpegAvcDecodeDetail(%08x, %08x): invalid addresses", mpeg, detailAddr); + WARN_LOG(Log::ME, "sceMpegAvcDecodeDetail(%08x, %08x): invalid addresses", mpeg, detailAddr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegAvcDecodeDetail(%08x, %08x): bad mpeg handle", mpeg, detailAddr); + WARN_LOG(Log::ME, "sceMpegAvcDecodeDetail(%08x, %08x): bad mpeg handle", mpeg, detailAddr); return -1; } - DEBUG_LOG(ME, "sceMpegAvcDecodeDetail(%08x, %08x)", mpeg, detailAddr); + DEBUG_LOG(Log::ME, "sceMpegAvcDecodeDetail(%08x, %08x)", mpeg, detailAddr); Memory::Write_U32(ctx->avc.avcDecodeResult, detailAddr + 0); Memory::Write_U32(ctx->videoFrameCount, detailAddr + 4); @@ -1316,17 +1316,17 @@ static int sceMpegAvcDecodeDetail(u32 mpeg, u32 detailAddr) static u32 sceMpegAvcDecodeStopYCbCr(u32 mpeg, u32 bufferAddr, u32 statusAddr) { if (!Memory::IsValidAddress(bufferAddr) || !Memory::IsValidAddress(statusAddr)) { - ERROR_LOG(ME, "UNIMPL sceMpegAvcDecodeStopYCbCr(%08x, %08x, %08x): invalid addresses", mpeg, bufferAddr, statusAddr); + ERROR_LOG(Log::ME, "UNIMPL sceMpegAvcDecodeStopYCbCr(%08x, %08x, %08x): invalid addresses", mpeg, bufferAddr, statusAddr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegAvcDecodeStopYCbCr(%08x, %08x, %08x): bad mpeg handle", mpeg, bufferAddr, statusAddr); + WARN_LOG(Log::ME, "UNIMPL sceMpegAvcDecodeStopYCbCr(%08x, %08x, %08x): bad mpeg handle", mpeg, bufferAddr, statusAddr); return -1; } - ERROR_LOG(ME, "UNIMPL sceMpegAvcDecodeStopYCbCr(%08x, %08x, %08x)", mpeg, bufferAddr, statusAddr); + ERROR_LOG(Log::ME, "UNIMPL sceMpegAvcDecodeStopYCbCr(%08x, %08x, %08x)", mpeg, bufferAddr, statusAddr); Memory::Write_U32(0, statusAddr); return 0; } @@ -1335,7 +1335,7 @@ static int sceMpegAvcDecodeYCbCr(u32 mpeg, u32 auAddr, u32 bufferAddr, u32 initA { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegAvcDecodeYCbCr(%08x, %08x, %08x, %08x): bad mpeg handle", mpeg, auAddr, bufferAddr, initAddr); + WARN_LOG(Log::ME, "sceMpegAvcDecodeYCbCr(%08x, %08x, %08x, %08x): bad mpeg handle", mpeg, auAddr, bufferAddr, initAddr); return -1; } @@ -1344,12 +1344,12 @@ static int sceMpegAvcDecodeYCbCr(u32 mpeg, u32 auAddr, u32 bufferAddr, u32 initA auto ringbuffer = PSPPointer::Create(ctx->mpegRingbufferAddr); if (!ringbuffer.IsValid()) { - ERROR_LOG(ME, "Bogus mpegringbufferaddr"); + ERROR_LOG(Log::ME, "Bogus mpegringbufferaddr"); return -1; } if (ringbuffer->packetsRead == 0 || ctx->mediaengine->IsVideoEnd()) { - WARN_LOG(ME, "sceMpegAvcDecodeYCbCr(%08x, %08x, %08x, %08x): mpeg buffer empty", mpeg, auAddr, bufferAddr, initAddr); + WARN_LOG(Log::ME, "sceMpegAvcDecodeYCbCr(%08x, %08x, %08x, %08x): mpeg buffer empty", mpeg, auAddr, bufferAddr, initAddr); return hleDelayResult(ERROR_MPEG_AVC_DECODE_FATAL, "mpeg buffer empty", avcEmptyDelayMs); } @@ -1360,7 +1360,7 @@ static int sceMpegAvcDecodeYCbCr(u32 mpeg, u32 auAddr, u32 bufferAddr, u32 initA u32 buffer = Memory::Read_U32(bufferAddr); u32 init = Memory::Read_U32(initAddr); - DEBUG_LOG(ME, "*buffer = %08x, *init = %08x", buffer, init); + DEBUG_LOG(Log::ME, "*buffer = %08x, *init = %08x", buffer, init); if (ctx->mediaengine->stepVideo(ctx->videoPixelMode)) { // Don't draw here, we'll draw in the Csc func. @@ -1393,7 +1393,7 @@ static int sceMpegAvcDecodeYCbCr(u32 mpeg, u32 auAddr, u32 bufferAddr, u32 initA } ctx->avc.avcDecodeResult = MPEG_AVC_DECODE_SUCCESS; - DEBUG_LOG(ME, "sceMpegAvcDecodeYCbCr(%08x, %08x, %08x, %08x)", mpeg, auAddr, bufferAddr, initAddr); + DEBUG_LOG(Log::ME, "sceMpegAvcDecodeYCbCr(%08x, %08x, %08x, %08x)", mpeg, auAddr, bufferAddr, initAddr); if (ctx->videoFrameCount <= 1) return hleDelayResult(0, "mpeg decode", avcFirstDelayMs); @@ -1407,11 +1407,11 @@ static u32 sceMpegAvcDecodeFlush(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegAvcDecodeFlush(%08x): bad mpeg handle", mpeg); + WARN_LOG(Log::ME, "UNIMPL sceMpegAvcDecodeFlush(%08x): bad mpeg handle", mpeg); return -1; } - ERROR_LOG(ME, "UNIMPL sceMpegAvcDecodeFlush(%08x)", mpeg); + ERROR_LOG(Log::ME, "UNIMPL sceMpegAvcDecodeFlush(%08x)", mpeg); if ( ctx->videoFrameCount > 0 || ctx->audioFrameCount > 0) { //__MpegFinish(); } @@ -1422,11 +1422,11 @@ static int sceMpegInitAu(u32 mpeg, u32 bufferAddr, u32 auPointer) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegInitAu(%08x, %i, %08x): bad mpeg handle", mpeg, bufferAddr, auPointer); + WARN_LOG(Log::ME, "sceMpegInitAu(%08x, %i, %08x): bad mpeg handle", mpeg, bufferAddr, auPointer); return -1; } - DEBUG_LOG(ME, "sceMpegInitAu(%08x, %i, %08x)", mpeg, bufferAddr, auPointer); + DEBUG_LOG(Log::ME, "sceMpegInitAu(%08x, %i, %08x)", mpeg, bufferAddr, auPointer); SceMpegAu sceAu; sceAu.read(auPointer); @@ -1458,17 +1458,17 @@ static int sceMpegInitAu(u32 mpeg, u32 bufferAddr, u32 auPointer) static int sceMpegQueryAtracEsSize(u32 mpeg, u32 esSizeAddr, u32 outSizeAddr) { if (!Memory::IsValidAddress(esSizeAddr) || !Memory::IsValidAddress(outSizeAddr)) { - ERROR_LOG(ME, "sceMpegQueryAtracEsSize(%08x, %08x, %08x): invalid addresses", mpeg, esSizeAddr, outSizeAddr); + ERROR_LOG(Log::ME, "sceMpegQueryAtracEsSize(%08x, %08x, %08x): invalid addresses", mpeg, esSizeAddr, outSizeAddr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegQueryAtracEsSize(%08x, %08x, %08x): bad mpeg handle", mpeg, esSizeAddr, outSizeAddr); + WARN_LOG(Log::ME, "sceMpegQueryAtracEsSize(%08x, %08x, %08x): bad mpeg handle", mpeg, esSizeAddr, outSizeAddr); return -1; } - DEBUG_LOG(ME, "sceMpegQueryAtracEsSize(%08x, %08x, %08x)", mpeg, esSizeAddr, outSizeAddr); + DEBUG_LOG(Log::ME, "sceMpegQueryAtracEsSize(%08x, %08x, %08x)", mpeg, esSizeAddr, outSizeAddr); Memory::Write_U32(MPEG_ATRAC_ES_SIZE, esSizeAddr); Memory::Write_U32(MPEG_ATRAC_ES_OUTPUT_SIZE, outSizeAddr); @@ -1480,13 +1480,13 @@ static int sceMpegRingbufferAvailableSize(u32 ringbufferAddr) auto ringbuffer = PSPPointer::Create(ringbufferAddr); if (!ringbuffer.IsValid()) { - ERROR_LOG(ME, "sceMpegRingbufferAvailableSize(%08x): invalid ringbuffer, should crash", ringbufferAddr); + ERROR_LOG(Log::ME, "sceMpegRingbufferAvailableSize(%08x): invalid ringbuffer, should crash", ringbufferAddr); return SCE_KERNEL_ERROR_ILLEGAL_ADDRESS; } MpegContext *ctx = getMpegCtx(ringbuffer->mpeg); if (!ctx) { - ERROR_LOG(ME, "sceMpegRingbufferAvailableSize(%08x): bad mpeg handle", ringbufferAddr); + ERROR_LOG(Log::ME, "sceMpegRingbufferAvailableSize(%08x): bad mpeg handle", ringbufferAddr); return ERROR_MPEG_NOT_YET_INIT; } @@ -1496,10 +1496,10 @@ static int sceMpegRingbufferAvailableSize(u32 ringbufferAddr) static int lastAvail = 0; if (lastAvail != ringbuffer->packetsAvail) { - DEBUG_LOG(ME, "%i=sceMpegRingbufferAvailableSize(%08x)", ringbuffer->packets - ringbuffer->packetsAvail, ringbufferAddr); + DEBUG_LOG(Log::ME, "%i=sceMpegRingbufferAvailableSize(%08x)", ringbuffer->packets - ringbuffer->packetsAvail, ringbufferAddr); lastAvail = ringbuffer->packetsAvail; } else { - VERBOSE_LOG(ME, "%i=sceMpegRingbufferAvailableSize(%08x)", ringbuffer->packets - ringbuffer->packetsAvail, ringbufferAddr); + VERBOSE_LOG(Log::ME, "%i=sceMpegRingbufferAvailableSize(%08x)", ringbuffer->packets - ringbuffer->packetsAvail, ringbufferAddr); } return ringbuffer->packets - ringbuffer->packetsAvail; } @@ -1533,7 +1533,7 @@ void PostPutAction::run(MipsCall &call) { } if (invalid) { // Bail out early - don't accept any of the packets, even the good ones. - ERROR_LOG_REPORT(ME, "sceMpegRingbufferPut(): invalid mpeg data"); + ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferPut(): invalid mpeg data"); call.setReturnValue(ERROR_MPEG_INVALID_VALUE); if (mpegLibVersion <= 0x0103) { @@ -1552,20 +1552,20 @@ void PostPutAction::run(MipsCall &call) { } if (packetsAddedThisRound > 0) { if (packetsAddedThisRound > ringbuffer->packets - ringbuffer->packetsAvail) { - WARN_LOG(ME, "sceMpegRingbufferPut clamping packetsAdded old=%i new=%i", packetsAddedThisRound, ringbuffer->packets - ringbuffer->packetsAvail); + WARN_LOG(Log::ME, "sceMpegRingbufferPut clamping packetsAdded old=%i new=%i", packetsAddedThisRound, ringbuffer->packets - ringbuffer->packetsAvail); packetsAddedThisRound = ringbuffer->packets - ringbuffer->packetsAvail; } const u8 *data = Memory::GetPointer(ringbuffer->data + writeOffset * 2048); uint32_t dataSize = Memory::ValidSize(ringbuffer->data + writeOffset * 2048, packetsAddedThisRound * 2048); int actuallyAdded = ctx->mediaengine == NULL ? 8 : ctx->mediaengine->addStreamData(data, dataSize) / 2048; if (actuallyAdded != packetsAddedThisRound) { - WARN_LOG_REPORT(ME, "sceMpegRingbufferPut(): unable to enqueue all added packets, going to overwrite some frames."); + WARN_LOG_REPORT(Log::ME, "sceMpegRingbufferPut(): unable to enqueue all added packets, going to overwrite some frames."); } ringbuffer->packetsRead += packetsAddedThisRound; ringbuffer->packetsWritePos += packetsAddedThisRound; ringbuffer->packetsAvail += packetsAddedThisRound; } - DEBUG_LOG(ME, "packetAdded: %i packetsRead: %i packetsTotal: %i", packetsAddedThisRound, ringbuffer->packetsRead, ringbuffer->packets); + DEBUG_LOG(Log::ME, "packetAdded: %i packetsRead: %i packetsTotal: %i", packetsAddedThisRound, ringbuffer->packetsRead, ringbuffer->packets); if (packetsAddedThisRound < 0 && ringbufferPutPacketsAdded == 0) { // Return an error. @@ -1582,7 +1582,7 @@ static u32 sceMpegRingbufferPut(u32 ringbufferAddr, int numPackets, int availabl auto ringbuffer = PSPPointer::Create(ringbufferAddr); if (!ringbuffer.IsValid()) { // Would have crashed before, TODO test behavior. - ERROR_LOG_REPORT(ME, "sceMpegRingbufferPut(%08x, %i, %i): invalid ringbuffer address", ringbufferAddr, numPackets, available); + ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferPut(%08x, %i, %i): invalid ringbuffer address", ringbufferAddr, numPackets, available); return -1; } @@ -1591,19 +1591,19 @@ static u32 sceMpegRingbufferPut(u32 ringbufferAddr, int numPackets, int availabl // Seems still need to check actual available, Patapon 3 for example. numPackets = std::min(numPackets, ringbuffer->packets - ringbuffer->packetsAvail); if (numPackets <= 0) { - DEBUG_LOG(ME, "sceMpegRingbufferPut(%08x, %i, %i): no packets to enqueue", ringbufferAddr, numPackets, available); + DEBUG_LOG(Log::ME, "sceMpegRingbufferPut(%08x, %i, %i): no packets to enqueue", ringbufferAddr, numPackets, available); return 0; } MpegContext *ctx = getMpegCtx(ringbuffer->mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegRingbufferPut(%08x, %i, %i): bad mpeg handle %08x", ringbufferAddr, numPackets, available, ringbuffer->mpeg); + WARN_LOG(Log::ME, "sceMpegRingbufferPut(%08x, %i, %i): bad mpeg handle %08x", ringbufferAddr, numPackets, available, ringbuffer->mpeg); return -1; } ringbufferPutPacketsAdded = 0; // Execute callback function as a direct MipsCall, no blocking here so no messing around with wait states etc if (ringbuffer->callback_addr != 0) { - DEBUG_LOG(ME, "sceMpegRingbufferPut(%08x, %i, %i)", ringbufferAddr, numPackets, available); + DEBUG_LOG(Log::ME, "sceMpegRingbufferPut(%08x, %i, %i)", ringbufferAddr, numPackets, available); // Call this multiple times until we get numPackets. // Normally this would be if it did not read enough, but also if available > packets. @@ -1624,7 +1624,7 @@ static u32 sceMpegRingbufferPut(u32 ringbufferAddr, int numPackets, int availabl break; } } else { - ERROR_LOG_REPORT(ME, "sceMpegRingbufferPut: callback_addr zero"); + ERROR_LOG_REPORT(Log::ME, "sceMpegRingbufferPut: callback_addr zero"); } return 0; } @@ -1633,20 +1633,20 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegGetAvcAu(%08x, %08x, %08x, %08x): bad mpeg handle", mpeg, streamId, auAddr, attrAddr); + WARN_LOG(Log::ME, "sceMpegGetAvcAu(%08x, %08x, %08x, %08x): bad mpeg handle", mpeg, streamId, auAddr, attrAddr); return -1; } auto ringbuffer = PSPPointer::Create(ctx->mpegRingbufferAddr); if (!ringbuffer.IsValid()) { // Would have crashed before, TODO test behavior. - ERROR_LOG_REPORT(ME, "sceMpegGetAvcAu(%08x, %08x, %08x, %08x): invalid ringbuffer address", mpeg, streamId, auAddr, attrAddr); + ERROR_LOG_REPORT(Log::ME, "sceMpegGetAvcAu(%08x, %08x, %08x, %08x): invalid ringbuffer address", mpeg, streamId, auAddr, attrAddr); return -1; } if (PSP_CoreParameter().compat.flags().MpegAvcWarmUp) { if (ctx->mpegwarmUp == 0) { - DEBUG_LOG(ME, "sceMpegGetAvcAu(%08x, %08x, %08x, %08x): warming up", mpeg, streamId, auAddr, attrAddr); + DEBUG_LOG(Log::ME, "sceMpegGetAvcAu(%08x, %08x, %08x, %08x): warming up", mpeg, streamId, auAddr, attrAddr); ctx->mpegwarmUp++; return ERROR_MPEG_NO_DATA; } @@ -1656,7 +1656,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) avcAu.read(auAddr); if (ringbuffer->packetsRead == 0 || ringbuffer->packetsAvail == 0) { - DEBUG_LOG(ME, "ERROR_MPEG_NO_DATA=sceMpegGetAvcAu(%08x, %08x, %08x, %08x)", mpeg, streamId, auAddr, attrAddr); + DEBUG_LOG(Log::ME, "ERROR_MPEG_NO_DATA=sceMpegGetAvcAu(%08x, %08x, %08x, %08x)", mpeg, streamId, auAddr, attrAddr); avcAu.pts = -1; avcAu.dts = -1; avcAu.write(auAddr); @@ -1666,7 +1666,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) auto streamInfo = ctx->streamMap.find(streamId); if (streamInfo == ctx->streamMap.end()) { - WARN_LOG_REPORT(ME, "sceMpegGetAvcAu: invalid video stream %08x", streamId); + WARN_LOG_REPORT(Log::ME, "sceMpegGetAvcAu: invalid video stream %08x", streamId); return -1; } @@ -1682,7 +1682,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) /*// Wait for audio if too much ahead if (ctx->atracRegistered && (ctx->mediaengine->getVideoTimeStamp() > ctx->mediaengine->getAudioTimeStamp() + getMaxAheadTimestamp(mpegRingbuffer))) { - ERROR_LOG(ME, "sceMpegGetAvcAu - video too much ahead"); + ERROR_LOG(Log::ME, "sceMpegGetAvcAu - video too much ahead"); // TODO: Does this really reschedule? return hleDelayResult(ERROR_MPEG_NO_DATA, "mpeg get avc", mpegDecodeErrorDelayMs); }*/ @@ -1693,7 +1693,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) avcAu.dts = avcAu.pts - videoTimestampStep; if (ctx->mediaengine->IsVideoEnd()) { - INFO_LOG(ME, "video end reach. pts: %i dts: %i", (int)avcAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); + INFO_LOG(Log::ME, "video end reach. pts: %i dts: %i", (int)avcAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); ringbuffer->packetsAvail = 0; result = ERROR_MPEG_NO_DATA; @@ -1707,7 +1707,7 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) Memory::Write_U32(1, attrAddr); } - DEBUG_LOG(ME, "%x=sceMpegGetAvcAu(%08x, %08x, %08x, %08x)", result, mpeg, streamId, auAddr, attrAddr); + DEBUG_LOG(Log::ME, "%x=sceMpegGetAvcAu(%08x, %08x, %08x, %08x)", result, mpeg, streamId, auAddr, attrAddr); // TODO: sceMpegGetAvcAu seems to modify esSize, and delay when it's > 1000 or something. // There's definitely more to it, but ultimately it seems games should expect it to delay randomly. return hleDelayResult(result, "mpeg get avc", 100); @@ -1716,11 +1716,11 @@ static int sceMpegGetAvcAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) static u32 sceMpegFinish() { if (!isMpegInit) { - WARN_LOG(ME, "sceMpegFinish(...): not initialized"); + WARN_LOG(Log::ME, "sceMpegFinish(...): not initialized"); // TODO: Need to properly hook module load/unload for this to work right. //return ERROR_MPEG_NOT_YET_INIT; } else { - INFO_LOG(ME, "sceMpegFinish(...)"); + INFO_LOG(Log::ME, "sceMpegFinish(...)"); __VideoPmpShutdown(); } isMpegInit = false; @@ -1729,21 +1729,21 @@ static u32 sceMpegFinish() } static u32 sceMpegQueryMemSize() { - return hleLogSuccessX(ME, MpegRequiredMem()); + return hleLogSuccessX(Log::ME, MpegRequiredMem()); } static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegGetAtracAu(%08x, %08x, %08x, %08x): bad mpeg handle", mpeg, streamId, auAddr, attrAddr); + WARN_LOG(Log::ME, "sceMpegGetAtracAu(%08x, %08x, %08x, %08x): bad mpeg handle", mpeg, streamId, auAddr, attrAddr); return -1; } auto ringbuffer = PSPPointer::Create(ctx->mpegRingbufferAddr); if (!ringbuffer.IsValid()) { // Would have crashed before, TODO test behavior. - WARN_LOG(ME, "sceMpegGetAtracAu(%08x, %08x, %08x, %08x): invalid ringbuffer address", mpeg, streamId, auAddr, attrAddr); + WARN_LOG(Log::ME, "sceMpegGetAtracAu(%08x, %08x, %08x, %08x): invalid ringbuffer address", mpeg, streamId, auAddr, attrAddr); return -1; } @@ -1756,13 +1756,13 @@ static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) streamInfo->second.needsReset = false; } if (streamInfo == ctx->streamMap.end()) { - WARN_LOG_REPORT(ME, "sceMpegGetAtracAu: invalid audio stream %08x", streamId); + WARN_LOG_REPORT(Log::ME, "sceMpegGetAtracAu: invalid audio stream %08x", streamId); // TODO: Why was this changed to not return an error? } // The audio can end earlier than the video does. if (ringbuffer->packetsAvail == 0) { - DEBUG_LOG(ME, "ERROR_MPEG_NO_DATA=sceMpegGetAtracAu(%08x, %08x, %08x, %08x)", mpeg, streamId, auAddr, attrAddr); + DEBUG_LOG(Log::ME, "ERROR_MPEG_NO_DATA=sceMpegGetAtracAu(%08x, %08x, %08x, %08x)", mpeg, streamId, auAddr, attrAddr); // TODO: Does this really delay? return hleDelayResult(ERROR_MPEG_NO_DATA, "mpeg get atrac", mpegDecodeErrorDelayMs); } @@ -1778,17 +1778,17 @@ static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) atracAu.pts = ctx->mediaengine->getAudioTimeStamp() + ctx->mpegFirstTimestamp; if (ctx->mediaengine->IsVideoEnd()) { - INFO_LOG(ME, "video end reach. pts: %i dts: %i", (int)atracAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); + INFO_LOG(Log::ME, "video end reach. pts: %i dts: %i", (int)atracAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); ringbuffer->packetsAvail = 0; // TODO: Is this correct? if (!ctx->mediaengine->IsNoAudioData()) { - WARN_LOG_REPORT(ME, "Video end without audio end, potentially skipping some audio?"); + WARN_LOG_REPORT(Log::ME, "Video end without audio end, potentially skipping some audio?"); } result = ERROR_MPEG_NO_DATA; } if (ctx->atracRegistered && ctx->mediaengine->IsNoAudioData() && !ctx->endOfAudioReached) { - WARN_LOG(ME, "Audio end reach. pts: %i dts: %i", (int)atracAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); + WARN_LOG(Log::ME, "Audio end reach. pts: %i dts: %i", (int)atracAu.pts, (int)ctx->mediaengine->getLastTimeStamp()); ctx->endOfAudioReached = true; } if (ctx->mediaengine->IsNoAudioData()) { @@ -1802,7 +1802,7 @@ static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) Memory::Write_U32(0, attrAddr); } - DEBUG_LOG(ME, "%x=sceMpegGetAtracAu(%08x, %08x, %08x, %08x)", result, mpeg, streamId, auAddr, attrAddr); + DEBUG_LOG(Log::ME, "%x=sceMpegGetAtracAu(%08x, %08x, %08x, %08x)", result, mpeg, streamId, auAddr, attrAddr); // TODO: Not clear on exactly when this delays. return hleDelayResult(result, "mpeg get atrac", 100); } @@ -1810,17 +1810,17 @@ static int sceMpegGetAtracAu(u32 mpeg, u32 streamId, u32 auAddr, u32 attrAddr) static int sceMpegQueryPcmEsSize(u32 mpeg, u32 esSizeAddr, u32 outSizeAddr) { if (!Memory::IsValidAddress(esSizeAddr) || !Memory::IsValidAddress(outSizeAddr)) { - ERROR_LOG(ME, "sceMpegQueryPcmEsSize(%08x, %08x, %08x): invalid addresses", mpeg, esSizeAddr, outSizeAddr); + ERROR_LOG(Log::ME, "sceMpegQueryPcmEsSize(%08x, %08x, %08x): invalid addresses", mpeg, esSizeAddr, outSizeAddr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegQueryPcmEsSize(%08x, %08x, %08x): bad mpeg handle", mpeg, esSizeAddr, outSizeAddr); + WARN_LOG(Log::ME, "sceMpegQueryPcmEsSize(%08x, %08x, %08x): bad mpeg handle", mpeg, esSizeAddr, outSizeAddr); return -1; } - ERROR_LOG(ME, "sceMpegQueryPcmEsSize(%08x, %08x, %08x)", mpeg, esSizeAddr, outSizeAddr); + ERROR_LOG(Log::ME, "sceMpegQueryPcmEsSize(%08x, %08x, %08x)", mpeg, esSizeAddr, outSizeAddr); Memory::Write_U32(MPEG_PCM_ES_SIZE, esSizeAddr); Memory::Write_U32(MPEG_PCM_ES_OUTPUT_SIZE, outSizeAddr); @@ -1832,21 +1832,21 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegChangeGetAuMode(%08x, %i, %i): bad mpeg handle", mpeg, streamUid, mode); + WARN_LOG(Log::ME, "sceMpegChangeGetAuMode(%08x, %i, %i): bad mpeg handle", mpeg, streamUid, mode); return ERROR_MPEG_INVALID_VALUE; } if (mode != MPEG_AU_MODE_DECODE && mode != MPEG_AU_MODE_SKIP) { - ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): bad mode", mpeg, streamUid, mode); + ERROR_LOG(Log::ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): bad mode", mpeg, streamUid, mode); return ERROR_MPEG_INVALID_VALUE; } auto stream = ctx->streamMap.find(streamUid); if (stream == ctx->streamMap.end()) { - ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode); + ERROR_LOG(Log::ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode); return ERROR_MPEG_INVALID_VALUE; } else { StreamInfo &info = stream->second; - DEBUG_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): changing type=%d", mpeg, streamUid, mode, info.type); + DEBUG_LOG(Log::ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): changing type=%d", mpeg, streamUid, mode, info.type); switch (info.type) { case MPEG_AVC_STREAM: if (mode == MPEG_AU_MODE_DECODE) { @@ -1871,7 +1871,7 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode) } break; default: - ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode); + ERROR_LOG(Log::ME, "UNIMPL sceMpegChangeGetAuMode(%08x, %i, %i): unknown streamID", mpeg, streamUid, mode); break; } } @@ -1881,17 +1881,17 @@ static u32 sceMpegChangeGetAuMode(u32 mpeg, int streamUid, int mode) static u32 sceMpegChangeGetAvcAuMode(u32 mpeg, u32 stream_addr, int mode) { if (!Memory::IsValidAddress(stream_addr)) { - ERROR_LOG(ME, "UNIMPL sceMpegChangeGetAvcAuMode(%08x, %08x, %i): invalid addresses", mpeg, stream_addr, mode); + ERROR_LOG(Log::ME, "UNIMPL sceMpegChangeGetAvcAuMode(%08x, %08x, %i): invalid addresses", mpeg, stream_addr, mode); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegChangeGetAvcAuMode(%08x, %08x, %i): bad mpeg handle", mpeg, stream_addr, mode); + WARN_LOG(Log::ME, "UNIMPL sceMpegChangeGetAvcAuMode(%08x, %08x, %i): bad mpeg handle", mpeg, stream_addr, mode); return -1; } - ERROR_LOG_REPORT_ONCE(mpegChangeAvcAu, ME, "UNIMPL sceMpegChangeGetAvcAuMode(%08x, %08x, %i)", mpeg, stream_addr, mode); + ERROR_LOG_REPORT_ONCE(mpegChangeAvcAu, Log::ME, "UNIMPL sceMpegChangeGetAvcAuMode(%08x, %08x, %i)", mpeg, stream_addr, mode); return 0; } @@ -1899,24 +1899,24 @@ static u32 sceMpegGetPcmAu(u32 mpeg, int streamUid, u32 auAddr, u32 attrAddr) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegGetPcmAu(%08x, %i, %08x, %08x): bad mpeg handle", mpeg, streamUid, auAddr, attrAddr); + WARN_LOG(Log::ME, "UNIMPL sceMpegGetPcmAu(%08x, %i, %08x, %08x): bad mpeg handle", mpeg, streamUid, auAddr, attrAddr); return -1; } auto ringbuffer = PSPPointer::Create(ctx->mpegRingbufferAddr); if (!ringbuffer.IsValid()) { // Would have crashed before, TODO test behavior - WARN_LOG(ME, "sceMpegGetPcmAu(%08x, %08x, %08x, %08x): invalid ringbuffer address", mpeg, streamUid, auAddr, attrAddr); + WARN_LOG(Log::ME, "sceMpegGetPcmAu(%08x, %08x, %08x, %08x): invalid ringbuffer address", mpeg, streamUid, auAddr, attrAddr); return -1; } if (!Memory::IsValidAddress(streamUid)) { - WARN_LOG(ME, "sceMpegGetPcmAu(%08x, %08x, %08x, %08x): didn't get a fake stream", mpeg, streamUid, auAddr, attrAddr); + WARN_LOG(Log::ME, "sceMpegGetPcmAu(%08x, %08x, %08x, %08x): didn't get a fake stream", mpeg, streamUid, auAddr, attrAddr); return ERROR_MPEG_INVALID_ADDR; } SceMpegAu atracAu; atracAu.read(auAddr); auto streamInfo = ctx->streamMap.find(streamUid); if (streamInfo == ctx->streamMap.end()) { - WARN_LOG(ME, "sceMpegGetPcmAu(%08x, %08x, %08x, %08x): bad streamUid ", mpeg, streamUid, auAddr, attrAddr); + WARN_LOG(Log::ME, "sceMpegGetPcmAu(%08x, %08x, %08x, %08x): bad streamUid ", mpeg, streamUid, auAddr, attrAddr); return -1; } @@ -1926,7 +1926,7 @@ static u32 sceMpegGetPcmAu(u32 mpeg, int streamUid, u32 auAddr, u32 attrAddr) if (Memory::IsValidAddress(attrAddr)) Memory::Write_U32(attr, attrAddr); - ERROR_LOG_REPORT_ONCE(mpegPcmAu, ME, "UNIMPL sceMpegGetPcmAu(%08x, %i, %08x, %08x)", mpeg, streamUid, auAddr, attrAddr); + ERROR_LOG_REPORT_ONCE(mpegPcmAu, Log::ME, "UNIMPL sceMpegGetPcmAu(%08x, %i, %08x, %08x)", mpeg, streamUid, auAddr, attrAddr); return 0; } @@ -1935,7 +1935,7 @@ static int __MpegRingbufferQueryPackNum(u32 memorySize) { } static int sceMpegRingbufferQueryPackNum(u32 memorySize) { - DEBUG_LOG(ME, "sceMpegRingbufferQueryPackNum(%i)", memorySize); + DEBUG_LOG(Log::ME, "sceMpegRingbufferQueryPackNum(%i)", memorySize); return __MpegRingbufferQueryPackNum(memorySize); } @@ -1943,11 +1943,11 @@ static u32 sceMpegFlushAllStream(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegFlushAllStream(%08x): bad mpeg handle", mpeg); + WARN_LOG(Log::ME, "sceMpegFlushAllStream(%08x): bad mpeg handle", mpeg); return -1; } - WARN_LOG(ME, "UNIMPL sceMpegFlushAllStream(%08x)", mpeg); + WARN_LOG(Log::ME, "UNIMPL sceMpegFlushAllStream(%08x)", mpeg); ctx->isAnalyzed = false; @@ -1964,17 +1964,17 @@ static u32 sceMpegFlushAllStream(u32 mpeg) static u32 sceMpegFlushStream(u32 mpeg, int stream_addr) { if (!Memory::IsValidAddress(stream_addr)) { - ERROR_LOG(ME, "UNIMPL sceMpegFlushStream(%08x, %i): invalid addresses", mpeg , stream_addr); + ERROR_LOG(Log::ME, "UNIMPL sceMpegFlushStream(%08x, %i): invalid addresses", mpeg , stream_addr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegFlushStream(%08x, %i): bad mpeg handle", mpeg , stream_addr); + WARN_LOG(Log::ME, "UNIMPL sceMpegFlushStream(%08x, %i): bad mpeg handle", mpeg , stream_addr); return -1; } - ERROR_LOG(ME, "UNIMPL sceMpegFlushStream(%08x, %i)", mpeg , stream_addr); + ERROR_LOG(Log::ME, "UNIMPL sceMpegFlushStream(%08x, %i)", mpeg , stream_addr); //__MpegFinish(); return 0; } @@ -1982,18 +1982,18 @@ static u32 sceMpegFlushStream(u32 mpeg, int stream_addr) static u32 sceMpegAvcCopyYCbCr(u32 mpeg, u32 sourceAddr, u32 YCbCrAddr) { if (!Memory::IsValidAddress(sourceAddr) || !Memory::IsValidAddress(YCbCrAddr)) { - ERROR_LOG(ME, "UNIMPL sceMpegAvcCopyYCbCr(%08x, %08x, %08x): invalid addresses", mpeg, sourceAddr, YCbCrAddr); + ERROR_LOG(Log::ME, "UNIMPL sceMpegAvcCopyYCbCr(%08x, %08x, %08x): invalid addresses", mpeg, sourceAddr, YCbCrAddr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - ERROR_LOG(ME, "UNIMPL sceMpegAvcCopyYCbCr(%08x, %08x, %08x): bad mpeg handle", mpeg, sourceAddr, YCbCrAddr); + ERROR_LOG(Log::ME, "UNIMPL sceMpegAvcCopyYCbCr(%08x, %08x, %08x): bad mpeg handle", mpeg, sourceAddr, YCbCrAddr); return -1; } // This is very common. - DEBUG_LOG(ME, "UNIMPL sceMpegAvcCopyYCbCr(%08x, %08x, %08x)", mpeg, sourceAddr, YCbCrAddr); + DEBUG_LOG(Log::ME, "UNIMPL sceMpegAvcCopyYCbCr(%08x, %08x, %08x)", mpeg, sourceAddr, YCbCrAddr); return 0; } @@ -2001,16 +2001,16 @@ static u32 sceMpegAtracDecode(u32 mpeg, u32 auAddr, u32 bufferAddr, int init) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegAtracDecode(%08x, %08x, %08x, %i): bad mpeg handle", mpeg, auAddr, bufferAddr, init); + WARN_LOG(Log::ME, "sceMpegAtracDecode(%08x, %08x, %08x, %i): bad mpeg handle", mpeg, auAddr, bufferAddr, init); return -1; } if (!Memory::IsValidAddress(bufferAddr)) { - WARN_LOG(ME, "sceMpegAtracDecode(%08x, %08x, %08x, %i): invalid addresses", mpeg, auAddr, bufferAddr, init); + WARN_LOG(Log::ME, "sceMpegAtracDecode(%08x, %08x, %08x, %i): invalid addresses", mpeg, auAddr, bufferAddr, init); return -1; } - DEBUG_LOG(ME, "sceMpegAtracDecode(%08x, %08x, %08x, %i)", mpeg, auAddr, bufferAddr, init); + DEBUG_LOG(Log::ME, "sceMpegAtracDecode(%08x, %08x, %08x, %i)", mpeg, auAddr, bufferAddr, init); SceMpegAu atracAu; atracAu.read(auAddr); @@ -2034,17 +2034,17 @@ static u32 sceMpegAtracDecode(u32 mpeg, u32 auAddr, u32 bufferAddr, int init) static u32 sceMpegAvcCsc(u32 mpeg, u32 sourceAddr, u32 rangeAddr, int frameWidth, u32 destAddr) { if (!Memory::IsValidAddress(sourceAddr) || !Memory::IsValidAddress(rangeAddr) || !Memory::IsValidAddress(destAddr)) { - ERROR_LOG(ME, "sceMpegAvcCsc(%08x, %08x, %08x, %i, %08x): invalid addresses", mpeg, sourceAddr, rangeAddr, frameWidth, destAddr); + ERROR_LOG(Log::ME, "sceMpegAvcCsc(%08x, %08x, %08x, %i, %08x): invalid addresses", mpeg, sourceAddr, rangeAddr, frameWidth, destAddr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegAvcCsc(%08x, %08x, %08x, %i, %08x): bad mpeg handle", mpeg, sourceAddr, rangeAddr, frameWidth, destAddr); + WARN_LOG(Log::ME, "sceMpegAvcCsc(%08x, %08x, %08x, %i, %08x): bad mpeg handle", mpeg, sourceAddr, rangeAddr, frameWidth, destAddr); return -1; } - DEBUG_LOG(ME, "sceMpegAvcCsc(%08x, %08x, %08x, %i, %08x)", mpeg, sourceAddr, rangeAddr, frameWidth, destAddr); + DEBUG_LOG(Log::ME, "sceMpegAvcCsc(%08x, %08x, %08x, %i, %08x)", mpeg, sourceAddr, rangeAddr, frameWidth, destAddr); if (frameWidth == 0) { if (!ctx->defaultFrameWidth) { @@ -2060,7 +2060,7 @@ static u32 sceMpegAvcCsc(u32 mpeg, u32 sourceAddr, u32 rangeAddr, int frameWidth int height = Memory::Read_U32(rangeAddr + 12); if (x < 0 || y < 0 || width < 0 || height < 0) { - WARN_LOG(ME, "sceMpegAvcCsc(%08x, %08x, %08x, %i, %08x) returning ERROR_INVALID_VALUE", mpeg, sourceAddr, rangeAddr, frameWidth, destAddr); + WARN_LOG(Log::ME, "sceMpegAvcCsc(%08x, %08x, %08x, %i, %08x) returning ERROR_INVALID_VALUE", mpeg, sourceAddr, rangeAddr, frameWidth, destAddr); return SCE_KERNEL_ERROR_INVALID_VALUE; } @@ -2078,7 +2078,7 @@ static u32 sceMpegAvcCsc(u32 mpeg, u32 sourceAddr, u32 rangeAddr, int frameWidth static u32 sceMpegRingbufferDestruct(u32 ringbufferAddr) { - DEBUG_LOG(ME, "sceMpegRingbufferDestruct(%08x)", ringbufferAddr); + DEBUG_LOG(Log::ME, "sceMpegRingbufferDestruct(%08x)", ringbufferAddr); // Apparently, does nothing. return 0; } @@ -2086,28 +2086,28 @@ static u32 sceMpegRingbufferDestruct(u32 ringbufferAddr) static u32 sceMpegAvcInitYCbCr(u32 mpeg, int mode, int width, int height, u32 ycbcr_addr) { if (!Memory::IsValidAddress(ycbcr_addr)) { - ERROR_LOG(ME, "UNIMPL sceMpegAvcInitYCbCr(%08x, %i, %i, %i, %08x): invalid addresses", mpeg, mode, width, height, ycbcr_addr); + ERROR_LOG(Log::ME, "UNIMPL sceMpegAvcInitYCbCr(%08x, %i, %i, %i, %08x): invalid addresses", mpeg, mode, width, height, ycbcr_addr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegAvcInitYCbCr(%08x, %i, %i, %i, %08x): bad mpeg handle", mpeg, mode, width, height, ycbcr_addr); + WARN_LOG(Log::ME, "UNIMPL sceMpegAvcInitYCbCr(%08x, %i, %i, %i, %08x): bad mpeg handle", mpeg, mode, width, height, ycbcr_addr); return -1; } - WARN_LOG_ONCE(sceMpegAvcInitYCbCr, ME, "UNIMPL sceMpegAvcInitYCbCr(%08x, %i, %i, %i, %08x)", mpeg, mode, width, height, ycbcr_addr); + WARN_LOG_ONCE(sceMpegAvcInitYCbCr, Log::ME, "UNIMPL sceMpegAvcInitYCbCr(%08x, %i, %i, %i, %08x)", mpeg, mode, width, height, ycbcr_addr); return 0; } static int sceMpegAvcQueryYCbCrSize(u32 mpeg, u32 mode, u32 width, u32 height, u32 resultAddr) { if ((width & 15) != 0 || (height & 15) != 0 || height > 272 || width > 480) { - ERROR_LOG(ME, "sceMpegAvcQueryYCbCrSize: bad w/h %i x %i", width, height); + ERROR_LOG(Log::ME, "sceMpegAvcQueryYCbCrSize: bad w/h %i x %i", width, height); return ERROR_MPEG_INVALID_VALUE; } - DEBUG_LOG(ME, "sceMpegAvcQueryYCbCrSize(%08x, %i, %i, %i, %08x)", mpeg, mode, width, height, resultAddr); + DEBUG_LOG(Log::ME, "sceMpegAvcQueryYCbCrSize(%08x, %i, %i, %i, %08x)", mpeg, mode, width, height, resultAddr); int size = (width / 2) * (height / 2) * 6 + 128; Memory::Write_U32(size, resultAddr); @@ -2117,17 +2117,17 @@ static int sceMpegAvcQueryYCbCrSize(u32 mpeg, u32 mode, u32 width, u32 height, u static u32 sceMpegQueryUserdataEsSize(u32 mpeg, u32 esSizeAddr, u32 outSizeAddr) { if (!Memory::IsValidAddress(esSizeAddr) || !Memory::IsValidAddress(outSizeAddr)) { - ERROR_LOG(ME, "sceMpegQueryUserdataEsSize(%08x, %08x, %08x): invalid addresses", mpeg, esSizeAddr, outSizeAddr); + ERROR_LOG(Log::ME, "sceMpegQueryUserdataEsSize(%08x, %08x, %08x): invalid addresses", mpeg, esSizeAddr, outSizeAddr); return -1; } MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegQueryUserdataEsSize(%08x, %08x, %08x): bad mpeg handle", mpeg, esSizeAddr, outSizeAddr); + WARN_LOG(Log::ME, "sceMpegQueryUserdataEsSize(%08x, %08x, %08x): bad mpeg handle", mpeg, esSizeAddr, outSizeAddr); return -1; } - DEBUG_LOG(ME, "sceMpegQueryUserdataEsSize(%08x, %08x, %08x)", mpeg, esSizeAddr, outSizeAddr); + DEBUG_LOG(Log::ME, "sceMpegQueryUserdataEsSize(%08x, %08x, %08x)", mpeg, esSizeAddr, outSizeAddr); Memory::Write_U32(MPEG_DATA_ES_SIZE, esSizeAddr); Memory::Write_U32(MPEG_DATA_ES_OUTPUT_SIZE, outSizeAddr); @@ -2136,20 +2136,20 @@ static u32 sceMpegQueryUserdataEsSize(u32 mpeg, u32 esSizeAddr, u32 outSizeAddr) static u32 sceMpegAvcResourceGetAvcDecTopAddr(u32 mpeg) { - ERROR_LOG(ME, "UNIMPL sceMpegAvcResourceGetAvcDecTopAddr(%08x)", mpeg); + ERROR_LOG(Log::ME, "UNIMPL sceMpegAvcResourceGetAvcDecTopAddr(%08x)", mpeg); // it's just a random address return 0x12345678; } static u32 sceMpegAvcResourceFinish(u32 mpeg) { - DEBUG_LOG(ME,"UNIMPL sceMpegAvcResourceFinish(%08x)", mpeg); + DEBUG_LOG(Log::ME,"UNIMPL sceMpegAvcResourceFinish(%08x)", mpeg); return 0; } static u32 sceMpegAvcResourceGetAvcEsBuf(u32 mpeg) { - ERROR_LOG_REPORT_ONCE(mpegResourceEsBuf, ME, "UNIMPL sceMpegAvcResourceGetAvcEsBuf(%08x)", mpeg); + ERROR_LOG_REPORT_ONCE(mpegResourceEsBuf, Log::ME, "UNIMPL sceMpegAvcResourceGetAvcEsBuf(%08x)", mpeg); return 0; } @@ -2159,7 +2159,7 @@ static u32 sceMpegAvcResourceInit(u32 mpeg) return ERROR_MPEG_INVALID_VALUE; } - ERROR_LOG(ME, "UNIMPL sceMpegAvcResourceInit(%08x)", mpeg); + ERROR_LOG(Log::ME, "UNIMPL sceMpegAvcResourceInit(%08x)", mpeg); return 0; } @@ -2190,7 +2190,7 @@ static int __MpegAvcConvertToYuv420(const void *data, u32 bufferOutputAddr, int u8 *Cr = Cb + sizeCb; if (!Y) - return hleLogError(ME, 0, "Bad output buffer pointer for yuv conv: %08x", bufferOutputAddr); + return hleLogError(Log::ME, 0, "Bad output buffer pointer for yuv conv: %08x", bufferOutputAddr); for (int y = 0; y < height; y += 2) { for (int x = 0; x < width; x += 2) { @@ -2218,14 +2218,14 @@ static int __MpegAvcConvertToYuv420(const void *data, u32 bufferOutputAddr, int static int sceMpegAvcConvertToYuv420(u32 mpeg, u32 bufferOutputAddr, u32 bufferAddr, int unknown2) { if (!Memory::IsValidAddress(bufferOutputAddr)) - return hleLogError(ME, ERROR_MPEG_INVALID_VALUE, "invalid addresses"); + return hleLogError(Log::ME, ERROR_MPEG_INVALID_VALUE, "invalid addresses"); MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) - return hleLogWarning(ME, -1, "bad mpeg handle"); + return hleLogWarning(Log::ME, -1, "bad mpeg handle"); if (ctx->mediaengine->m_buffer == 0) - return hleLogWarning(ME, ERROR_MPEG_AVC_INVALID_VALUE, "m_buffer is zero"); + return hleLogWarning(Log::ME, ERROR_MPEG_AVC_INVALID_VALUE, "m_buffer is zero"); const u8 *data = ctx->mediaengine->getFrameImage(); int width = ctx->mediaengine->m_desWidth; @@ -2234,18 +2234,18 @@ static int sceMpegAvcConvertToYuv420(u32 mpeg, u32 bufferOutputAddr, u32 bufferA if (data) { __MpegAvcConvertToYuv420(data, bufferOutputAddr, width, height); } - return hleLogSuccessX(ME, (width << 16) | height); + return hleLogSuccessX(Log::ME, (width << 16) | height); } static int sceMpegGetUserdataAu(u32 mpeg, u32 streamUid, u32 auAddr, u32 resultAddr) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "sceMpegGetUserdataAu(%08x, %08x, %08x, %08x): bad mpeg handle", mpeg, streamUid, auAddr, resultAddr); + WARN_LOG(Log::ME, "sceMpegGetUserdataAu(%08x, %08x, %08x, %08x): bad mpeg handle", mpeg, streamUid, auAddr, resultAddr); return -1; } - DEBUG_LOG(ME, "sceMpegGetUserdataAu(%08x, %08x, %08x, %08x)", mpeg, streamUid, auAddr, resultAddr); + DEBUG_LOG(Log::ME, "sceMpegGetUserdataAu(%08x, %08x, %08x, %08x)", mpeg, streamUid, auAddr, resultAddr); // TODO: Are these at all right? Seen in Phantasy Star Portable 2. Memory::Write_U32(0, resultAddr); @@ -2260,11 +2260,11 @@ static u32 sceMpegNextAvcRpAu(u32 mpeg, u32 streamUid) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegNextAvcRpAu(%08x, %08x): bad mpeg handle", mpeg, streamUid); + WARN_LOG(Log::ME, "UNIMPL sceMpegNextAvcRpAu(%08x, %08x): bad mpeg handle", mpeg, streamUid); return -1; } - ERROR_LOG_REPORT(ME, "UNIMPL sceMpegNextAvcRpAu(%08x, %08x)", mpeg, streamUid); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegNextAvcRpAu(%08x, %08x)", mpeg, streamUid); return 0; } @@ -2273,11 +2273,11 @@ static u32 sceMpegGetAvcNalAu(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegGetAvcNalAu(%08x): bad mpeg handle", mpeg); + WARN_LOG(Log::ME, "UNIMPL sceMpegGetAvcNalAu(%08x): bad mpeg handle", mpeg); return -1; } - ERROR_LOG_REPORT(ME, "UNIMPL sceMpegGetAvcNalAu(%08x)", mpeg); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegGetAvcNalAu(%08x)", mpeg); return 0; } @@ -2286,11 +2286,11 @@ static u32 sceMpegAvcDecodeDetailIndex(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegAvcDecodeDetailIndex(%08x): bad mpeg handle", mpeg); + WARN_LOG(Log::ME, "UNIMPL sceMpegAvcDecodeDetailIndex(%08x): bad mpeg handle", mpeg); return -1; } - ERROR_LOG_REPORT(ME, "UNIMPL sceMpegAvcDecodeDetailIndex(%08x)", mpeg); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegAvcDecodeDetailIndex(%08x)", mpeg); return 0; } @@ -2299,11 +2299,11 @@ static u32 sceMpegAvcDecodeDetail2(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegAvcDecodeDetail2(%08x): bad mpeg handle", mpeg); + WARN_LOG(Log::ME, "UNIMPL sceMpegAvcDecodeDetail2(%08x): bad mpeg handle", mpeg); return -1; } - ERROR_LOG_REPORT(ME, "UNIMPL sceMpegAvcDecodeDetail2(%08x)", mpeg); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegAvcDecodeDetail2(%08x)", mpeg); return 0; } @@ -2312,11 +2312,11 @@ static u32 sceMpegGetAvcEsAu(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegGetAvcEsAu(%08x): bad mpeg handle", mpeg); + WARN_LOG(Log::ME, "UNIMPL sceMpegGetAvcEsAu(%08x): bad mpeg handle", mpeg); return -1; } - ERROR_LOG_REPORT(ME, "UNIMPL sceMpegGetAvcEsAu(%08x)", mpeg); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegGetAvcEsAu(%08x)", mpeg); return 0; } @@ -2325,11 +2325,11 @@ static u32 sceMpegAvcCscInfo(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegAvcCscInfo(%08x): bad mpeg handle", mpeg); + WARN_LOG(Log::ME, "UNIMPL sceMpegAvcCscInfo(%08x): bad mpeg handle", mpeg); return -1; } - ERROR_LOG_REPORT(ME, "UNIMPL sceMpegAvcCscInfo(%08x)", mpeg); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegAvcCscInfo(%08x)", mpeg); return 0; } @@ -2338,11 +2338,11 @@ static u32 sceMpegAvcCscMode(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegAvcCscMode(%08x): bad mpeg handle", mpeg); + WARN_LOG(Log::ME, "UNIMPL sceMpegAvcCscMode(%08x): bad mpeg handle", mpeg); return -1; } - ERROR_LOG_REPORT(ME, "UNIMPL sceMpegAvcCscMode(%08x)", mpeg); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegAvcCscMode(%08x)", mpeg); return 0; } @@ -2351,11 +2351,11 @@ static u32 sceMpegFlushAu(u32 mpeg) { MpegContext *ctx = getMpegCtx(mpeg); if (!ctx) { - WARN_LOG(ME, "UNIMPL sceMpegFlushAu(%08x): bad mpeg handle", mpeg); + WARN_LOG(Log::ME, "UNIMPL sceMpegFlushAu(%08x): bad mpeg handle", mpeg); return -1; } - ERROR_LOG_REPORT(ME, "UNIMPL sceMpegFlushAu(%08x)", mpeg); + ERROR_LOG_REPORT(Log::ME, "UNIMPL sceMpegFlushAu(%08x)", mpeg); return 0; } @@ -2445,7 +2445,7 @@ static u32 sceMpegBasePESpacketCopy(u32 p) ++lli; } - DEBUG_LOG(ME, "sceMpegBasePESpacketCopy(%08x), received %d block(s)", pmp_videoSource, pmp_nBlocks); + DEBUG_LOG(Log::ME, "sceMpegBasePESpacketCopy(%08x), received %d block(s)", pmp_videoSource, pmp_nBlocks); return 0; } diff --git a/Core/HLE/sceMt19937.cpp b/Core/HLE/sceMt19937.cpp index 64adebcf81..baec983eb9 100644 --- a/Core/HLE/sceMt19937.cpp +++ b/Core/HLE/sceMt19937.cpp @@ -30,20 +30,20 @@ static u32 sceMt19937Init(u32 mt19937Addr, u32 seed) { if (!Memory::IsValidAddress(mt19937Addr)) - return hleLogError(HLE, -1); + return hleLogError(Log::HLE, -1); void *ptr = Memory::GetPointerWriteUnchecked(mt19937Addr); // This is made to match the memory layout of a PSP MT structure exactly. // Let's just construct it in place with placement new. Elite C++ hackery FTW. new (ptr) MersenneTwister(seed); - return hleLogSuccessInfoI(HLE, 0); + return hleLogSuccessInfoI(Log::HLE, 0); } static u32 sceMt19937UInt(u32 mt19937Addr) { if (!Memory::IsValidAddress(mt19937Addr)) - return hleLogError(HLE, -1); + return hleLogError(Log::HLE, -1); MersenneTwister *mt = (MersenneTwister *)Memory::GetPointer(mt19937Addr); - return hleLogSuccessVerboseX(HLE, mt->R32()); + return hleLogSuccessVerboseX(Log::HLE, mt->R32()); } const HLEFunction sceMt19937[] = diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index 2e256fffbb..2318641511 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -106,7 +106,7 @@ void AfterApctlMipsCall::DoState(PointerWrap & p) { void AfterApctlMipsCall::run(MipsCall& call) { u32 v0 = currentMIPS->r[MIPS_REG_V0]; - DEBUG_LOG(SCENET, "AfterApctlMipsCall::run [ID=%i][OldState=%d][NewState=%d][Event=%d][Error=%d][ArgsPtr=%08x] [cbId: %u][retV0: %08x]", handlerID, oldState, newState, event, error, argsAddr, call.cbId, v0); + DEBUG_LOG(Log::sceNet, "AfterApctlMipsCall::run [ID=%i][OldState=%d][NewState=%d][Event=%d][Error=%d][ArgsPtr=%08x] [cbId: %u][retV0: %08x]", handlerID, oldState, newState, event, error, argsAddr, call.cbId, v0); //call.setReturnValue(v0); } @@ -141,7 +141,7 @@ static void __ApctlState(u64 userdata, int cyclesLate) { SceUID waitID = __KernelGetWaitID(threadID, WAITTYPE_NET, error); if (waitID == 0 || error != 0) { - WARN_LOG(SCENET, "sceNetApctl State WaitID(%i) on Thread(%i) already woken up? (error: %08x)", uid, threadID, error); + WARN_LOG(Log::sceNet, "sceNetApctl State WaitID(%i) on Thread(%i) already woken up? (error: %08x)", uid, threadID, error); return; } @@ -151,7 +151,7 @@ static void __ApctlState(u64 userdata, int cyclesLate) { } __KernelResumeThreadFromWait(threadID, result); - DEBUG_LOG(SCENET, "Returning (WaitID: %d, error: %08x) Result (%08x) of sceNetApctl - Event: %d, State: %d", waitID, error, (int)result, event, netApctlState); + DEBUG_LOG(Log::sceNet, "Returning (WaitID: %d, error: %08x) Result (%08x) of sceNetApctl - Event: %d, State: %d", waitID, error, (int)result, event, netApctlState); } // Used to change Apctl State after a delay and before executing callback mipscall (since we don't have beforeAction) @@ -210,7 +210,7 @@ void __NetInit() { SceNetEtherAddr mac; getLocalMac(&mac); - INFO_LOG(SCENET, "LocalHost IP will be %s [%s]", ip2str(g_localhostIP.in.sin_addr).c_str(), mac2str(&mac).c_str()); + INFO_LOG(Log::sceNet, "LocalHost IP will be %s [%s]", ip2str(g_localhostIP.in.sin_addr).c_str(), mac2str(&mac).c_str()); // TODO: May be we should initialize & cleanup somewhere else than here for PortManager to be used as general purpose for whatever port forwarding PPSSPP needed __UPnPInit(); @@ -440,7 +440,7 @@ void __NetApctlCallbacks() int handlerID = id - 1; for (std::map::iterator it = npAuthHandlers.begin(); it != npAuthHandlers.end(); ++it) { if (it->first == handlerID) { - DEBUG_LOG(SCENET, "NpAuthCallback [HandlerID=%i][RequestID=%d][Result=%d][ArgsPtr=%08x]", it->first, id, result, it->second.argument); + DEBUG_LOG(Log::sceNet, "NpAuthCallback [HandlerID=%i][RequestID=%d][Result=%d][ArgsPtr=%08x]", it->first, id, result, it->second.argument); // TODO: Update result / args.data[1] with the actual ticket length (or error code?) hleEnqueueCall(it->second.entryPoint, 3, args.data); } @@ -537,7 +537,7 @@ void __NetApctlCallbacks() // Run mipscall. Should we skipped executing the mipscall if oldState == newState? for (std::map::iterator it = apctlHandlers.begin(); it != apctlHandlers.end(); ++it) { - DEBUG_LOG(SCENET, "ApctlCallback [ID=%i][OldState=%d][NewState=%d][Event=%d][Error=%08x][ArgsPtr=%08x]", it->first, oldState, newState, event, error, it->second.argument); + DEBUG_LOG(Log::sceNet, "ApctlCallback [ID=%i][OldState=%d][NewState=%d][Event=%d][Error=%08x][ArgsPtr=%08x]", it->first, oldState, newState, event, error, it->second.argument); args.data[4] = it->second.argument; AfterApctlMipsCall* after = (AfterApctlMipsCall*)__KernelCreateAction(actionAfterApctlMipsCall); after->SetData(it->first, oldState, newState, event, error, it->second.argument); @@ -599,7 +599,7 @@ u32 Net_Term() { } static u32 sceNetTerm() { - WARN_LOG(SCENET, "sceNetTerm() at %08x", currentMIPS->pc); + WARN_LOG(Log::sceNet, "sceNetTerm() at %08x", currentMIPS->pc); int retval = Net_Term(); // Give time to make sure everything are cleaned up @@ -623,11 +623,11 @@ static int sceNetInit(u32 poolSize, u32 calloutPri, u32 calloutStack, u32 netini Net_Term(); // This cleanup attempt might not worked when SaveState were loaded in the middle of multiplayer game and re-entering multiplayer, thus causing memory leaks & wasting binded ports. May be we shouldn't save/load "Inited" vars on SaveState? if (poolSize == 0) { - return hleLogError(SCENET, SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE, "invalid pool size"); + return hleLogError(Log::sceNet, SCE_KERNEL_ERROR_ILLEGAL_MEMSIZE, "invalid pool size"); } else if (calloutPri < 0x08 || calloutPri > 0x77) { - return hleLogError(SCENET, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "invalid callout thread priority"); + return hleLogError(Log::sceNet, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "invalid callout thread priority"); } else if (netinitPri < 0x08 || netinitPri > 0x77) { - return hleLogError(SCENET, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "invalid init thread priority"); + return hleLogError(Log::sceNet, SCE_KERNEL_ERROR_ILLEGAL_PRIORITY, "invalid init thread priority"); } // TODO: Should also start the threads, probably? For now, let's just allocate. @@ -635,22 +635,22 @@ static int sceNetInit(u32 poolSize, u32 calloutPri, u32 calloutStack, u32 netini u32 stackSize = 4096; netThread1Addr = AllocUser(stackSize, true, "netstack1"); if (netThread1Addr == 0) { - return hleLogError(SCENET, SCE_KERNEL_ERROR_NO_MEMORY, "unable to allocate thread"); + return hleLogError(Log::sceNet, SCE_KERNEL_ERROR_NO_MEMORY, "unable to allocate thread"); } netThread2Addr = AllocUser(stackSize, true, "netstack2"); if (netThread2Addr == 0) { FreeUser(netThread1Addr); - return hleLogError(SCENET, SCE_KERNEL_ERROR_NO_MEMORY, "unable to allocate thread"); + return hleLogError(Log::sceNet, SCE_KERNEL_ERROR_NO_MEMORY, "unable to allocate thread"); } netPoolAddr = AllocUser(poolSize, false, "netpool"); if (netPoolAddr == 0) { FreeUser(netThread1Addr); FreeUser(netThread2Addr); - return hleLogError(SCENET, SCE_KERNEL_ERROR_NO_MEMORY, "unable to allocate pool"); + return hleLogError(Log::sceNet, SCE_KERNEL_ERROR_NO_MEMORY, "unable to allocate pool"); } - WARN_LOG(SCENET, "sceNetInit(poolsize=%d, calloutpri=%i, calloutstack=%d, netintrpri=%i, netintrstack=%d) at %08x", poolSize, calloutPri, calloutStack, netinitPri, netinitStack, currentMIPS->pc); + WARN_LOG(Log::sceNet, "sceNetInit(poolsize=%d, calloutpri=%i, calloutstack=%d, netintrpri=%i, netintrstack=%d) at %08x", poolSize, calloutPri, calloutStack, netinitPri, netinitStack, currentMIPS->pc); netMallocStat.pool = poolSize - 0x20; // On Vantage Master Portable this is slightly (32 bytes) smaller than the poolSize arg when tested with JPCSP + prx files netMallocStat.maximum = 0x4050; // Dummy maximum foot print @@ -660,20 +660,20 @@ static int sceNetInit(u32 poolSize, u32 calloutPri, u32 calloutStack, u32 netini memset(&adhocSockets, 0, sizeof(adhocSockets)); netInited = true; - return hleLogSuccessI(SCENET, 0); + return hleLogSuccessI(Log::sceNet, 0); } // Free(delete) thread info / data. // Normal usage: sceKernelDeleteThread followed by sceNetFreeThreadInfo with the same threadID as argument static int sceNetFreeThreadinfo(SceUID thid) { - ERROR_LOG(SCENET, "UNIMPL sceNetFreeThreadinfo(%i)", thid); + ERROR_LOG(Log::sceNet, "UNIMPL sceNetFreeThreadinfo(%i)", thid); return 0; } // Abort a thread. static int sceNetThreadAbort(SceUID thid) { - ERROR_LOG(SCENET, "UNIMPL sceNetThreadAbort(%i)", thid); + ERROR_LOG(Log::sceNet, "UNIMPL sceNetThreadAbort(%i)", thid); return 0; } @@ -681,7 +681,7 @@ static int sceNetThreadAbort(SceUID thid) { static u32 sceWlanGetEtherAddr(u32 addrAddr) { if (!Memory::IsValidRange(addrAddr, 6)) { // More correctly, it should crash. - return hleLogError(SCENET, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "illegal address"); + return hleLogError(Log::sceNet, SCE_KERNEL_ERROR_ILLEGAL_ADDR, "illegal address"); } u8 *addr = Memory::GetPointerWriteUnchecked(addrAddr); @@ -692,34 +692,34 @@ static u32 sceWlanGetEtherAddr(u32 addrAddr) { } else { // Read MAC Address from config if (!ParseMacAddress(g_Config.sMACAddress, addr)) { - ERROR_LOG(SCENET, "Error parsing mac address %s", g_Config.sMACAddress.c_str()); + ERROR_LOG(Log::sceNet, "Error parsing mac address %s", g_Config.sMACAddress.c_str()); Memory::Memset(addrAddr, 0, 6); } } NotifyMemInfo(MemBlockFlags::WRITE, addrAddr, 6, "WlanEtherAddr"); - return hleLogSuccessI(SCENET, hleDelayResult(0, "get ether mac", 200)); + return hleLogSuccessI(Log::sceNet, hleDelayResult(0, "get ether mac", 200)); } static u32 sceNetGetLocalEtherAddr(u32 addrAddr) { // FIXME: Return 0x80410180 (pspnet[_core] error code?) before successful attempt to Create/Connect/Join a Group? (ie. adhocctlCurrentMode == ADHOCCTL_MODE_NONE) if (adhocctlCurrentMode == ADHOCCTL_MODE_NONE) - return hleLogDebug(SCENET, 0x80410180, "address not available?"); + return hleLogDebug(Log::sceNet, 0x80410180, "address not available?"); return sceWlanGetEtherAddr(addrAddr); } static u32 sceWlanDevIsPowerOn() { - return hleLogSuccessVerboseI(SCENET, g_Config.bEnableWlan ? 1 : 0); + return hleLogSuccessVerboseI(Log::sceNet, g_Config.bEnableWlan ? 1 : 0); } static u32 sceWlanGetSwitchState() { - return hleLogSuccessVerboseI(SCENET, g_Config.bEnableWlan ? 1 : 0); + return hleLogSuccessVerboseI(Log::sceNet, g_Config.bEnableWlan ? 1 : 0); } // Probably a void function, but often returns a useful value. static void sceNetEtherNtostr(u32 macPtr, u32 bufferPtr) { - DEBUG_LOG(SCENET, "sceNetEtherNtostr(%08x, %08x) at %08x", macPtr, bufferPtr, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "sceNetEtherNtostr(%08x, %08x) at %08x", macPtr, bufferPtr, currentMIPS->pc); if (Memory::IsValidAddress(bufferPtr) && Memory::IsValidAddress(macPtr)) { char *buffer = (char *)Memory::GetPointerWriteUnchecked(bufferPtr); @@ -729,7 +729,7 @@ static void sceNetEtherNtostr(u32 macPtr, u32 bufferPtr) { sprintf(buffer, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); - VERBOSE_LOG(SCENET, "sceNetEtherNtostr - [%s]", buffer); + VERBOSE_LOG(Log::sceNet, "sceNetEtherNtostr - [%s]", buffer); } } @@ -745,7 +745,7 @@ static int hex_to_digit(int c) { // Probably a void function, but sometimes returns a useful-ish value. static void sceNetEtherStrton(u32 bufferPtr, u32 macPtr) { - DEBUG_LOG(SCENET, "sceNetEtherStrton(%08x, %08x)", bufferPtr, macPtr); + DEBUG_LOG(Log::sceNet, "sceNetEtherStrton(%08x, %08x)", bufferPtr, macPtr); if (Memory::IsValidAddress(bufferPtr) && Memory::IsValidAddress(macPtr)) { const char *buffer = (const char *)Memory::GetPointerUnchecked(bufferPtr); @@ -775,7 +775,7 @@ static void sceNetEtherStrton(u32 bufferPtr, u32 macPtr) { } } - VERBOSE_LOG(SCENET, "sceNetEtherStrton - [%s]", mac2str((SceNetEtherAddr*)Memory::GetPointer(macPtr)).c_str()); + VERBOSE_LOG(Log::sceNet, "sceNetEtherStrton - [%s]", mac2str((SceNetEtherAddr*)Memory::GetPointer(macPtr)).c_str()); // Seems to maybe kinda return the last value. Probably returns void. //return value; } @@ -784,10 +784,10 @@ static void sceNetEtherStrton(u32 bufferPtr, u32 macPtr) { // Write static data since we don't actually manage any memory for sceNet* yet. static int sceNetGetMallocStat(u32 statPtr) { - VERBOSE_LOG(SCENET, "UNTESTED sceNetGetMallocStat(%x) at %08x", statPtr, currentMIPS->pc); + VERBOSE_LOG(Log::sceNet, "UNTESTED sceNetGetMallocStat(%x) at %08x", statPtr, currentMIPS->pc); auto stat = PSPPointer::Create(statPtr); if (!stat.IsValid()) - return hleLogError(SCENET, 0, "invalid address"); + return hleLogError(Log::sceNet, 0, "invalid address"); *stat = netMallocStat; stat.NotifyWrite("sceNetGetMallocStat"); @@ -795,7 +795,7 @@ static int sceNetGetMallocStat(u32 statPtr) { } static int sceNetInetInit() { - ERROR_LOG(SCENET, "UNIMPL sceNetInetInit()"); + ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetInit()"); if (netInetInited) return ERROR_NET_INET_ALREADY_INITIALIZED; netInetInited = true; @@ -803,7 +803,7 @@ static int sceNetInetInit() { } int sceNetInetTerm() { - ERROR_LOG(SCENET, "UNIMPL sceNetInetTerm()"); + ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetTerm()"); netInetInited = false; return 0; @@ -836,7 +836,7 @@ void NetApctl_InitInfo() { } static int sceNetApctlInit(int stackSize, int initPriority) { - WARN_LOG(SCENET, "UNTESTED %s(%i, %i)", __FUNCTION__, stackSize, initPriority); + WARN_LOG(Log::sceNet, "UNTESTED %s(%i, %i)", __FUNCTION__, stackSize, initPriority); if (netApctlInited) return ERROR_NET_APCTL_ALREADY_INITIALIZED; @@ -884,144 +884,144 @@ int NetApctl_Term() { } int sceNetApctlTerm() { - WARN_LOG(SCENET, "UNTESTED %s()", __FUNCTION__); + WARN_LOG(Log::sceNet, "UNTESTED %s()", __FUNCTION__); return NetApctl_Term(); } static int sceNetApctlGetInfo(int code, u32 pInfoAddr) { - WARN_LOG(SCENET, "UNTESTED %s(%i, %08x)", __FUNCTION__, code, pInfoAddr); + WARN_LOG(Log::sceNet, "UNTESTED %s(%i, %08x)", __FUNCTION__, code, pInfoAddr); if (!netApctlInited) - return hleLogError(SCENET, ERROR_NET_APCTL_NOT_IN_BSS, "apctl not in bss"); // Only have valid info after joining an AP and got an IP, right? + return hleLogError(Log::sceNet, ERROR_NET_APCTL_NOT_IN_BSS, "apctl not in bss"); // Only have valid info after joining an AP and got an IP, right? switch (code) { case PSP_NET_APCTL_INFO_PROFILE_NAME: if (!Memory::IsValidRange(pInfoAddr, APCTL_PROFILENAME_MAXLEN)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::MemcpyUnchecked(pInfoAddr, netApctlInfo.name, APCTL_PROFILENAME_MAXLEN); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, APCTL_PROFILENAME_MAXLEN, "NetApctlGetInfo"); - DEBUG_LOG(SCENET, "ApctlInfo - ProfileName: %s", netApctlInfo.name); + DEBUG_LOG(Log::sceNet, "ApctlInfo - ProfileName: %s", netApctlInfo.name); break; case PSP_NET_APCTL_INFO_BSSID: if (!Memory::IsValidRange(pInfoAddr, ETHER_ADDR_LEN)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::MemcpyUnchecked(pInfoAddr, netApctlInfo.bssid, ETHER_ADDR_LEN); - DEBUG_LOG(SCENET, "ApctlInfo - BSSID: %s", mac2str((SceNetEtherAddr*)&netApctlInfo.bssid).c_str()); + DEBUG_LOG(Log::sceNet, "ApctlInfo - BSSID: %s", mac2str((SceNetEtherAddr*)&netApctlInfo.bssid).c_str()); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, ETHER_ADDR_LEN, "NetApctlGetInfo"); break; case PSP_NET_APCTL_INFO_SSID: if (!Memory::IsValidRange(pInfoAddr, APCTL_SSID_MAXLEN)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::MemcpyUnchecked(pInfoAddr, netApctlInfo.ssid, APCTL_SSID_MAXLEN); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, APCTL_SSID_MAXLEN, "NetApctlGetInfo"); - DEBUG_LOG(SCENET, "ApctlInfo - SSID: %s", netApctlInfo.ssid); + DEBUG_LOG(Log::sceNet, "ApctlInfo - SSID: %s", netApctlInfo.ssid); break; case PSP_NET_APCTL_INFO_SSID_LENGTH: if (!Memory::IsValidRange(pInfoAddr, 4)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::WriteUnchecked_U32(netApctlInfo.ssidLength, pInfoAddr); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 4, "NetApctlGetInfo"); break; case PSP_NET_APCTL_INFO_SECURITY_TYPE: if (!Memory::IsValidRange(pInfoAddr, 4)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::WriteUnchecked_U32(netApctlInfo.securityType, pInfoAddr); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 4, "NetApctlGetInfo"); break; case PSP_NET_APCTL_INFO_STRENGTH: if (!Memory::IsValidRange(pInfoAddr, 1)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::WriteUnchecked_U8(netApctlInfo.strength, pInfoAddr); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 1, "NetApctlGetInfo"); break; case PSP_NET_APCTL_INFO_CHANNEL: if (!Memory::IsValidRange(pInfoAddr, 1)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::WriteUnchecked_U8(netApctlInfo.channel, pInfoAddr); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 1, "NetApctlGetInfo"); break; case PSP_NET_APCTL_INFO_POWER_SAVE: if (!Memory::IsValidRange(pInfoAddr, 1)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::WriteUnchecked_U8(netApctlInfo.powerSave, pInfoAddr); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 1, "NetApctlGetInfo"); break; case PSP_NET_APCTL_INFO_IP: if (!Memory::IsValidRange(pInfoAddr, APCTL_IPADDR_MAXLEN)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::MemcpyUnchecked(pInfoAddr, netApctlInfo.ip, APCTL_IPADDR_MAXLEN); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, APCTL_IPADDR_MAXLEN, "NetApctlGetInfo"); - DEBUG_LOG(SCENET, "ApctlInfo - IP: %s", netApctlInfo.ip); + DEBUG_LOG(Log::sceNet, "ApctlInfo - IP: %s", netApctlInfo.ip); break; case PSP_NET_APCTL_INFO_SUBNETMASK: if (!Memory::IsValidRange(pInfoAddr, APCTL_IPADDR_MAXLEN)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::MemcpyUnchecked(pInfoAddr, netApctlInfo.subNetMask, APCTL_IPADDR_MAXLEN); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, APCTL_IPADDR_MAXLEN, "NetApctlGetInfo"); - DEBUG_LOG(SCENET, "ApctlInfo - SubNet Mask: %s", netApctlInfo.subNetMask); + DEBUG_LOG(Log::sceNet, "ApctlInfo - SubNet Mask: %s", netApctlInfo.subNetMask); break; case PSP_NET_APCTL_INFO_GATEWAY: if (!Memory::IsValidRange(pInfoAddr, APCTL_IPADDR_MAXLEN)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::MemcpyUnchecked(pInfoAddr, netApctlInfo.gateway, APCTL_IPADDR_MAXLEN); - DEBUG_LOG(SCENET, "ApctlInfo - Gateway IP: %s", netApctlInfo.gateway); + DEBUG_LOG(Log::sceNet, "ApctlInfo - Gateway IP: %s", netApctlInfo.gateway); break; case PSP_NET_APCTL_INFO_PRIMDNS: if (!Memory::IsValidRange(pInfoAddr, APCTL_IPADDR_MAXLEN)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::MemcpyUnchecked(pInfoAddr, netApctlInfo.primaryDns, APCTL_IPADDR_MAXLEN); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, APCTL_IPADDR_MAXLEN, "NetApctlGetInfo"); - DEBUG_LOG(SCENET, "ApctlInfo - Primary DNS: %s", netApctlInfo.primaryDns); + DEBUG_LOG(Log::sceNet, "ApctlInfo - Primary DNS: %s", netApctlInfo.primaryDns); break; case PSP_NET_APCTL_INFO_SECDNS: if (!Memory::IsValidRange(pInfoAddr, APCTL_IPADDR_MAXLEN)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::MemcpyUnchecked(pInfoAddr, netApctlInfo.secondaryDns, APCTL_IPADDR_MAXLEN); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, APCTL_IPADDR_MAXLEN, "NetApctlGetInfo"); - DEBUG_LOG(SCENET, "ApctlInfo - Secondary DNS: %s", netApctlInfo.secondaryDns); + DEBUG_LOG(Log::sceNet, "ApctlInfo - Secondary DNS: %s", netApctlInfo.secondaryDns); break; case PSP_NET_APCTL_INFO_USE_PROXY: if (!Memory::IsValidRange(pInfoAddr, 4)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::WriteUnchecked_U32(netApctlInfo.useProxy, pInfoAddr); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 4, "NetApctlGetInfo"); break; case PSP_NET_APCTL_INFO_PROXY_URL: if (!Memory::IsValidRange(pInfoAddr, APCTL_URL_MAXLEN)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::MemcpyUnchecked(pInfoAddr, netApctlInfo.proxyUrl, APCTL_URL_MAXLEN); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, APCTL_URL_MAXLEN, "NetApctlGetInfo"); - DEBUG_LOG(SCENET, "ApctlInfo - Proxy URL: %s", netApctlInfo.proxyUrl); + DEBUG_LOG(Log::sceNet, "ApctlInfo - Proxy URL: %s", netApctlInfo.proxyUrl); break; case PSP_NET_APCTL_INFO_PROXY_PORT: if (!Memory::IsValidRange(pInfoAddr, 2)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::WriteUnchecked_U16(netApctlInfo.proxyPort, pInfoAddr); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 2, "NetApctlGetInfo"); break; case PSP_NET_APCTL_INFO_8021_EAP_TYPE: if (!Memory::IsValidRange(pInfoAddr, 4)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::WriteUnchecked_U32(netApctlInfo.eapType, pInfoAddr); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 4, "NetApctlGetInfo"); break; case PSP_NET_APCTL_INFO_START_BROWSER: if (!Memory::IsValidRange(pInfoAddr, 4)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::WriteUnchecked_U32(netApctlInfo.startBrowser, pInfoAddr); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 4, "NetApctlGetInfo"); break; case PSP_NET_APCTL_INFO_WIFISP: if (!Memory::IsValidRange(pInfoAddr, 4)) - return hleLogError(SCENET, -1, "apctl invalid arg"); + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); Memory::WriteUnchecked_U32(netApctlInfo.wifisp, pInfoAddr); NotifyMemInfo(MemBlockFlags::WRITE, pInfoAddr, 4, "NetApctlGetInfo"); break; default: - return hleLogError(SCENET, ERROR_NET_APCTL_INVALID_CODE, "apctl invalid code"); + return hleLogError(Log::sceNet, ERROR_NET_APCTL_INVALID_CODE, "apctl invalid code"); } - return hleLogSuccessI(SCENET, 0); + return hleLogSuccessI(Log::sceNet, 0); } int NetApctl_AddHandler(u32 handlerPtr, u32 handlerArg) { @@ -1045,15 +1045,15 @@ int NetApctl_AddHandler(u32 handlerPtr, u32 handlerArg) { if (!foundHandler && Memory::IsValidAddress(handlerPtr)) { if (apctlHandlers.size() >= MAX_APCTL_HANDLERS) { - ERROR_LOG(SCENET, "Failed to Add handler(%x, %x): Too many handlers", handlerPtr, handlerArg); + ERROR_LOG(Log::sceNet, "Failed to Add handler(%x, %x): Too many handlers", handlerPtr, handlerArg); retval = ERROR_NET_ADHOCCTL_TOO_MANY_HANDLERS; // TODO: What's the proper error code for Apctl's TOO_MANY_HANDLERS? return retval; } apctlHandlers[retval] = handler; - WARN_LOG(SCENET, "Added Apctl handler(%x, %x): %d", handlerPtr, handlerArg, retval); + WARN_LOG(Log::sceNet, "Added Apctl handler(%x, %x): %d", handlerPtr, handlerArg, retval); } else { - ERROR_LOG(SCENET, "Existing Apctl handler(%x, %x)", handlerPtr, handlerArg); + ERROR_LOG(Log::sceNet, "Existing Apctl handler(%x, %x)", handlerPtr, handlerArg); } // The id to return is the number of handlers currently registered @@ -1063,33 +1063,33 @@ int NetApctl_AddHandler(u32 handlerPtr, u32 handlerArg) { // TODO: How many handlers can the PSP actually have for Apctl? // TODO: Should we allow the same handler to be added more than once? static u32 sceNetApctlAddHandler(u32 handlerPtr, u32 handlerArg) { - INFO_LOG(SCENET, "%s(%08x, %08x)", __FUNCTION__, handlerPtr, handlerArg); + INFO_LOG(Log::sceNet, "%s(%08x, %08x)", __FUNCTION__, handlerPtr, handlerArg); return NetApctl_AddHandler(handlerPtr, handlerArg); } int NetApctl_DelHandler(u32 handlerID) { if (apctlHandlers.find(handlerID) != apctlHandlers.end()) { apctlHandlers.erase(handlerID); - WARN_LOG(SCENET, "Deleted Apctl handler: %d", handlerID); + WARN_LOG(Log::sceNet, "Deleted Apctl handler: %d", handlerID); } else { - ERROR_LOG(SCENET, "Invalid Apctl handler: %d", handlerID); + ERROR_LOG(Log::sceNet, "Invalid Apctl handler: %d", handlerID); } return 0; } static int sceNetApctlDelHandler(u32 handlerID) { - INFO_LOG(SCENET, "%s(%d)", __FUNCTION__, handlerID); + INFO_LOG(Log::sceNet, "%s(%d)", __FUNCTION__, handlerID); return NetApctl_DelHandler(handlerID); } static int sceNetInetInetAton(const char *hostname, u32 addrPtr) { - ERROR_LOG(SCENET, "UNIMPL sceNetInetInetAton(%s, %08x)", hostname, addrPtr); + ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetInetAton(%s, %08x)", hostname, addrPtr); return -1; } int sceNetInetPoll(void *fds, u32 nfds, int timeout) { // timeout in miliseconds - DEBUG_LOG(SCENET, "UNTESTED sceNetInetPoll(%p, %d, %i) at %08x", fds, nfds, timeout, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "UNTESTED sceNetInetPoll(%p, %d, %i) at %08x", fds, nfds, timeout, currentMIPS->pc); int retval = -1; SceNetInetPollfd *fdarray = (SceNetInetPollfd *)fds; // SceNetInetPollfd/pollfd, sceNetInetPoll() have similarity to BSD poll() but pollfd have different size on 64bit //#ifdef _WIN32 @@ -1144,17 +1144,17 @@ int sceNetInetPoll(void *fds, u32 nfds, int timeout) { // timeout in miliseconds } static int sceNetInetRecv(int socket, u32 bufPtr, u32 bufLen, u32 flags) { - ERROR_LOG(SCENET, "UNIMPL sceNetInetRecv(%i, %08x, %i, %08x)", socket, bufPtr, bufLen, flags); + ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetRecv(%i, %08x, %i, %08x)", socket, bufPtr, bufLen, flags); return -1; } static int sceNetInetSend(int socket, u32 bufPtr, u32 bufLen, u32 flags) { - ERROR_LOG(SCENET, "UNIMPL sceNetInetSend(%i, %08x, %i, %08x)", socket, bufPtr, bufLen, flags); + ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetSend(%i, %08x, %i, %08x)", socket, bufPtr, bufLen, flags); return -1; } static int sceNetInetGetErrno() { - ERROR_LOG(SCENET, "UNTESTED sceNetInetGetErrno()"); + ERROR_LOG(Log::sceNet, "UNTESTED sceNetInetGetErrno()"); int error = errno; switch (error) { case ETIMEDOUT: @@ -1170,22 +1170,22 @@ static int sceNetInetGetErrno() { } static int sceNetInetSocket(int domain, int type, int protocol) { - ERROR_LOG(SCENET, "UNIMPL sceNetInetSocket(%i, %i, %i)", domain, type, protocol); + ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetSocket(%i, %i, %i)", domain, type, protocol); return -1; } static int sceNetInetSetsockopt(int socket, int level, int optname, u32 optvalPtr, int optlen) { - ERROR_LOG(SCENET, "UNIMPL sceNetInetSetsockopt(%i, %i, %i, %08x, %i)", socket, level, optname, optvalPtr, optlen); + ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetSetsockopt(%i, %i, %i, %08x, %i)", socket, level, optname, optvalPtr, optlen); return -1; } static int sceNetInetConnect(int socket, u32 sockAddrInternetPtr, int addressLength) { - ERROR_LOG(SCENET, "UNIMPL sceNetInetConnect(%i, %08x, %i)", socket, sockAddrInternetPtr, addressLength); + ERROR_LOG(Log::sceNet, "UNIMPL sceNetInetConnect(%i, %08x, %i)", socket, sockAddrInternetPtr, addressLength); return -1; } int sceNetApctlConnect(int connIndex) { - WARN_LOG(SCENET, "UNTESTED %s(%i)", __FUNCTION__, connIndex); + WARN_LOG(Log::sceNet, "UNTESTED %s(%i)", __FUNCTION__, connIndex); // Is this connIndex is the index to the scanning's result data or sceNetApctlGetBSSDescIDListUser result? __UpdateApctlHandlers(0, 0, PSP_NET_APCTL_EVENT_CONNECT_REQUEST, 0); //hleDelayResult(0, "give time to init/cleanup", adhocEventDelayMS * 1000); @@ -1193,7 +1193,7 @@ int sceNetApctlConnect(int connIndex) { } static int sceNetApctlDisconnect() { - ERROR_LOG(SCENET, "UNIMPL %s()", __FUNCTION__); + ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__); // Like its 'sister' function sceNetAdhocctlDisconnect, we need to alert Apctl handlers that a disconnect took place // or else games like Phantasy Star Portable 2 will hang at certain points (e.g. returning to the main menu after trying to connect to PSN). @@ -1206,30 +1206,30 @@ int NetApctl_GetState() { } static int sceNetApctlGetState(u32 pStateAddr) { - //if (!netApctlInited) return hleLogError(SCENET, ERROR_NET_APCTL_NOT_IN_BSS, "apctl not in bss"); + //if (!netApctlInited) return hleLogError(Log::sceNet, ERROR_NET_APCTL_NOT_IN_BSS, "apctl not in bss"); // Valid Arguments if (Memory::IsValidAddress(pStateAddr)) { // Return Thread Status Memory::Write_U32(NetApctl_GetState(), pStateAddr); // Return Success - return hleLogSuccessI(SCENET, 0); + return hleLogSuccessI(Log::sceNet, 0); } - return hleLogError(SCENET, -1, "apctl invalid arg"); // 0x8002013A or ERROR_NET_WLAN_INVALID_ARG ? + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); // 0x8002013A or ERROR_NET_WLAN_INVALID_ARG ? } int NetApctl_ScanUser() { // Scan probably only works when not in connected state, right? if (netApctlState != PSP_NET_APCTL_STATE_DISCONNECTED) - return hleLogError(SCENET, ERROR_NET_APCTL_NOT_DISCONNECTED, "apctl not disconnected"); + return hleLogError(Log::sceNet, ERROR_NET_APCTL_NOT_DISCONNECTED, "apctl not disconnected"); __UpdateApctlHandlers(0, 0, PSP_NET_APCTL_EVENT_SCAN_REQUEST, 0); return 0; } static int sceNetApctlScanUser() { - ERROR_LOG(SCENET, "UNIMPL %s()", __FUNCTION__); + ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__); return NetApctl_ScanUser(); } @@ -1238,7 +1238,7 @@ int NetApctl_GetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) { // Faking 4 entries, games like MGS:PW Recruit will need to have a different AP for each entry int entries = 4; if (!Memory::IsValidAddress(sizeAddr) || !Memory::IsValidAddress(bufAddr)) - return hleLogError(SCENET, -1, "apctl invalid arg"); // 0x8002013A or ERROR_NET_WLAN_INVALID_ARG ? + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); // 0x8002013A or ERROR_NET_WLAN_INVALID_ARG ? int size = Memory::Read_U32(sizeAddr); // Return size required @@ -1252,7 +1252,7 @@ int NetApctl_GetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) { break; } - DEBUG_LOG(SCENET, "%s writing ID#%d to %08x", __FUNCTION__, i, bufAddr + offset); + DEBUG_LOG(Log::sceNet, "%s writing ID#%d to %08x", __FUNCTION__, i, bufAddr + offset); // Pointer to next Network structure in list Memory::Write_U32((i + 1) * userInfoSize + bufAddr, bufAddr + offset); @@ -1271,13 +1271,13 @@ int NetApctl_GetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) { } static int sceNetApctlGetBSSDescIDListUser(u32 sizeAddr, u32 bufAddr) { - WARN_LOG(SCENET, "UNTESTED %s(%08x, %08x)", __FUNCTION__, sizeAddr, bufAddr); + WARN_LOG(Log::sceNet, "UNTESTED %s(%08x, %08x)", __FUNCTION__, sizeAddr, bufAddr); return NetApctl_GetBSSDescIDListUser(sizeAddr, bufAddr); } int NetApctl_GetBSSDescEntryUser(int entryId, int infoId, u32 resultAddr) { if (!Memory::IsValidAddress(resultAddr)) - return hleLogError(SCENET, -1, "apctl invalid arg"); // 0x8002013A or ERROR_NET_WLAN_INVALID_ARG ? + return hleLogError(Log::sceNet, -1, "apctl invalid arg"); // 0x8002013A or ERROR_NET_WLAN_INVALID_ARG ? // Generate an SSID name char dummySSID[APCTL_SSID_MAXLEN] = "WifiAP0"; @@ -1336,19 +1336,19 @@ int NetApctl_GetBSSDescEntryUser(int entryId, int infoId, u32 resultAddr) { Memory::Write_U32(netApctlInfo.securityType, resultAddr); break; default: - return hleLogError(SCENET, ERROR_NET_APCTL_INVALID_CODE, "unknown info id"); + return hleLogError(Log::sceNet, ERROR_NET_APCTL_INVALID_CODE, "unknown info id"); } return 0; } static int sceNetApctlGetBSSDescEntryUser(int entryId, int infoId, u32 resultAddr) { - WARN_LOG(SCENET, "UNTESTED %s(%i, %i, %08x)", __FUNCTION__, entryId, infoId, resultAddr); + WARN_LOG(Log::sceNet, "UNTESTED %s(%i, %i, %08x)", __FUNCTION__, entryId, infoId, resultAddr); return NetApctl_GetBSSDescEntryUser(entryId, infoId, resultAddr); } static int sceNetApctlScanSSID2() { - WARN_LOG(SCENET, "UNTESTED %s() at %08x", __FUNCTION__, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED %s() at %08x", __FUNCTION__, currentMIPS->pc); return NetApctl_ScanUser(); } @@ -1359,7 +1359,7 @@ static int sceNetApctlScanSSID2() { * Arg4 = input flag? (initially 0/1 ?) ***************/ static int sceNetApctlGetBSSDescIDList2(u32 Arg1, u32 Arg2, u32 Arg3, u32 Arg4) { - WARN_LOG(SCENET, "UNTESTED %s(%08x, %08x, %08x, %08x) at %08x", __FUNCTION__, Arg1, Arg2, Arg3, Arg4, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED %s(%08x, %08x, %08x, %08x) at %08x", __FUNCTION__, Arg1, Arg2, Arg3, Arg4, currentMIPS->pc); return NetApctl_GetBSSDescIDListUser(Arg1, Arg2); } @@ -1369,97 +1369,97 @@ static int sceNetApctlGetBSSDescIDList2(u32 Arg1, u32 Arg2, u32 Arg3, u32 Arg4) * Arg3 = output buffer for retrieved entry data? (max size = 32 bytes? ie. APCTL_SSID_MAXLEN ? or similar to SceNetApctlInfoInternal union ?) ***************/ static int sceNetApctlGetBSSDescEntry2(int entryId, int infoId, u32 resultAddr) { - WARN_LOG(SCENET, "UNTESTED %s(%i, %i, %08x) at %08x", __FUNCTION__, entryId, infoId, resultAddr, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED %s(%i, %i, %08x) at %08x", __FUNCTION__, entryId, infoId, resultAddr, currentMIPS->pc); return NetApctl_GetBSSDescEntryUser(entryId, infoId, resultAddr); } static int sceNetResolverInit() { - ERROR_LOG(SCENET, "UNIMPL %s()", __FUNCTION__); + ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__); return 0; } static int sceNetApctlAddInternalHandler(u32 handlerPtr, u32 handlerArg) { - ERROR_LOG(SCENET, "UNIMPL %s(%08x, %08x)", __FUNCTION__, handlerPtr, handlerArg); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x, %08x)", __FUNCTION__, handlerPtr, handlerArg); // This seems to be a 2nd kind of handler return NetApctl_AddHandler(handlerPtr, handlerArg); } static int sceNetApctlDelInternalHandler(u32 handlerID) { - ERROR_LOG(SCENET, "UNIMPL %s(%i)", __FUNCTION__, handlerID); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%i)", __FUNCTION__, handlerID); // This seems to be a 2nd kind of handler return NetApctl_DelHandler(handlerID); } static int sceNetApctl_A7BB73DF(u32 handlerPtr, u32 handlerArg) { - ERROR_LOG(SCENET, "UNIMPL %s(%08x, %08x)", __FUNCTION__, handlerPtr, handlerArg); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x, %08x)", __FUNCTION__, handlerPtr, handlerArg); // This seems to be a 3rd kind of handler return sceNetApctlAddHandler(handlerPtr, handlerArg); } static int sceNetApctl_6F5D2981(u32 handlerID) { - ERROR_LOG(SCENET, "UNIMPL %s(%i)", __FUNCTION__, handlerID); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%i)", __FUNCTION__, handlerID); // This seems to be a 3rd kind of handler return sceNetApctlDelHandler(handlerID); } static int sceNetApctl_lib2_69745F0A(int handlerId) { - return hleLogError(SCENET, 0, "unimplemented"); + return hleLogError(Log::sceNet, 0, "unimplemented"); } static int sceNetApctl_lib2_4C19731F(int code, u32 pInfoAddr) { - ERROR_LOG(SCENET, "UNIMPL %s(%i, %08x)", __FUNCTION__, code, pInfoAddr); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%i, %08x)", __FUNCTION__, code, pInfoAddr); return sceNetApctlGetInfo(code, pInfoAddr); } static int sceNetApctlScan() { - ERROR_LOG(SCENET, "UNIMPL %s()", __FUNCTION__); + ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__); return NetApctl_ScanUser(); } static int sceNetApctlGetBSSDescIDList(u32 sizeAddr, u32 bufAddr) { - ERROR_LOG(SCENET, "UNIMPL %s(%08x, %08x)", __FUNCTION__, sizeAddr, bufAddr); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x, %08x)", __FUNCTION__, sizeAddr, bufAddr); return sceNetApctlGetBSSDescIDListUser(sizeAddr, bufAddr); } static int sceNetApctlGetBSSDescEntry(int entryId, int infoId, u32 resultAddr) { - ERROR_LOG(SCENET, "UNIMPL %s(%i, %i, %08x)", __FUNCTION__, entryId, infoId, resultAddr); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%i, %i, %08x)", __FUNCTION__, entryId, infoId, resultAddr); return sceNetApctlGetBSSDescEntryUser(entryId, infoId, resultAddr); } static int sceNetApctl_lib2_C20A144C(int connIndex, u32 ps3MacAddressPtr) { - ERROR_LOG(SCENET, "UNIMPL %s(%i, %08x)", __FUNCTION__, connIndex, ps3MacAddressPtr); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%i, %08x)", __FUNCTION__, connIndex, ps3MacAddressPtr); return sceNetApctlConnect(connIndex); } static int sceNetUpnpInit(int unknown1,int unknown2) { - ERROR_LOG_REPORT_ONCE(sceNetUpnpInit, SCENET, "UNIMPLsceNetUpnpInit %d,%d",unknown1,unknown2); + ERROR_LOG_REPORT_ONCE(sceNetUpnpInit, Log::sceNet, "UNIMPLsceNetUpnpInit %d,%d",unknown1,unknown2); return 0; } static int sceNetUpnpStart() { - ERROR_LOG(SCENET, "UNIMPLsceNetUpnpStart"); + ERROR_LOG(Log::sceNet, "UNIMPLsceNetUpnpStart"); return 0; } static int sceNetUpnpStop() { - ERROR_LOG(SCENET, "UNIMPLsceNetUpnpStop"); + ERROR_LOG(Log::sceNet, "UNIMPLsceNetUpnpStop"); return 0; } static int sceNetUpnpTerm() { - ERROR_LOG(SCENET, "UNIMPLsceNetUpnpTerm"); + ERROR_LOG(Log::sceNet, "UNIMPLsceNetUpnpTerm"); return 0; } static int sceNetUpnpGetNatInfo() { - ERROR_LOG(SCENET, "UNIMPLsceNetUpnpGetNatInfo"); + ERROR_LOG(Log::sceNet, "UNIMPLsceNetUpnpGetNatInfo"); return 0; } @@ -1467,14 +1467,14 @@ static int sceNetGetDropRate(u32 dropRateAddr, u32 dropDurationAddr) { Memory::Write_U32(netDropRate, dropRateAddr); Memory::Write_U32(netDropDuration, dropDurationAddr); - return hleLogSuccessInfoI(SCENET, 0); + return hleLogSuccessInfoI(Log::sceNet, 0); } static int sceNetSetDropRate(u32 dropRate, u32 dropDuration) { netDropRate = dropRate; netDropDuration = dropDuration; - return hleLogSuccessInfoI(SCENET, 0); + return hleLogSuccessInfoI(Log::sceNet, 0); } const HLEFunction sceNet[] = { diff --git a/Core/HLE/sceNetAdhoc.cpp b/Core/HLE/sceNetAdhoc.cpp index a8070d4dd9..207382dfa0 100644 --- a/Core/HLE/sceNetAdhoc.cpp +++ b/Core/HLE/sceNetAdhoc.cpp @@ -175,12 +175,12 @@ static void __GameModeNotify(u64 userdata, int cyclesLate) { gameModeBuffer = buf; if ((gameModeSocket = sceNetAdhocPdpCreate((const char*)&masterGameModeArea.mac, ADHOC_GAMEMODE_PORT, gameModeBuffSize, 0)) < 0) { - ERROR_LOG(SCENET, "GameMode: Failed to create socket (Error %08x)", gameModeSocket); + ERROR_LOG(Log::sceNet, "GameMode: Failed to create socket (Error %08x)", gameModeSocket); __KernelResumeThreadFromWait(threadID, gameModeSocket); return; } else - INFO_LOG(SCENET, "GameMode: Synchronizer (%d, %d) has started", gameModeSocket, gameModeBuffSize); + INFO_LOG(Log::sceNet, "GameMode: Synchronizer (%d, %d) has started", gameModeSocket, gameModeBuffSize); } if (gameModeSocket < 0) { // ReSchedule @@ -189,7 +189,7 @@ static void __GameModeNotify(u64 userdata, int cyclesLate) { } auto sock = adhocSockets[gameModeSocket - 1]; if (!sock) { - WARN_LOG(SCENET, "GameMode: Socket (%d) got deleted", gameModeSocket); + WARN_LOG(Log::sceNet, "GameMode: Socket (%d) got deleted", gameModeSocket); u32 waitVal = __KernelGetWaitValue(threadID, error); if (error == 0) { __KernelResumeThreadFromWait(threadID, waitVal); @@ -210,7 +210,7 @@ static void __GameModeNotify(u64 userdata, int cyclesLate) { int sent = sceNetAdhocPdpSend(gameModeSocket, (const char*)&gma.mac, port, masterGameModeArea.data, masterGameModeArea.size, 0, ADHOC_F_NONBLOCK); if (sent != ERROR_NET_ADHOC_WOULD_BLOCK) { gma.dataSent = 1; - DEBUG_LOG(SCENET, "GameMode: Master data Sent %d bytes to Area #%d [%s]", masterGameModeArea.size, gma.id, mac2str(&gma.mac).c_str()); + DEBUG_LOG(Log::sceNet, "GameMode: Master data Sent %d bytes to Area #%d [%s]", masterGameModeArea.size, gma.id, mac2str(&gma.mac).c_str()); sentcount++; } } @@ -245,15 +245,15 @@ static void __GameModeNotify(u64 userdata, int cyclesLate) { if (recvd == replicaGameModeAreas.size()) { u32 waitVal = __KernelGetWaitValue(threadID, error); if (error == 0) { - DEBUG_LOG(SCENET, "GameMode: Resuming Thread %d after Master data Synced (Result = %08x)", threadID, waitVal); + DEBUG_LOG(Log::sceNet, "GameMode: Resuming Thread %d after Master data Synced (Result = %08x)", threadID, waitVal); __KernelResumeThreadFromWait(threadID, waitVal); } else - ERROR_LOG(SCENET, "GameMode: Error (%08x) on WaitValue %d ThreadID %d", error, waitVal, threadID); + ERROR_LOG(Log::sceNet, "GameMode: Error (%08x) on WaitValue %d ThreadID %d", error, waitVal, threadID); } // Attempt to Re-Send initial Master data (in case previous packets were lost) else if (static_cast(now - masterGameModeArea.updateTimestamp) > GAMEMODE_SYNC_TIMEOUT) { - DEBUG_LOG(SCENET, "GameMode: Attempt to Re-Send Master data after Sync Timeout (%d us)", GAMEMODE_SYNC_TIMEOUT); + DEBUG_LOG(Log::sceNet, "GameMode: Attempt to Re-Send Master data after Sync Timeout (%d us)", GAMEMODE_SYNC_TIMEOUT); // Reset Sent marker on players who haven't replied yet (except disconnected players) for (auto& gma : replicaGameModeAreas) if (!gma.dataUpdated && gma.updateTimestamp != 0) @@ -279,7 +279,7 @@ static void __GameModeNotify(u64 userdata, int cyclesLate) { SceNetAdhocctlPeerInfo* peer = findFriend(&sendermac); if (peer != NULL) truncate_cpy(name, sizeof(name), (const char*)peer->nickname.data); - WARN_LOG(SCENET, "GameMode: Unknown Source Port from [%s][%s:%u -> %u] (Result=%i, Size=%i)", name, mac2str(&sendermac).c_str(), senderport, ADHOC_GAMEMODE_PORT, ret, bufsz); + WARN_LOG(Log::sceNet, "GameMode: Unknown Source Port from [%s][%s:%u -> %u] (Result=%i, Size=%i)", name, mac2str(&sendermac).c_str(), senderport, ADHOC_GAMEMODE_PORT, ret, bufsz); g_OSD.Show(OSDType::MESSAGE_WARNING, std::string(n->T("GM: Data from Unknown Port")) + std::string(" [") + std::string(name) + std::string("]:") + std::to_string(senderport) + std::string(" -> ") + std::to_string(ADHOC_GAMEMODE_PORT) + std::string(" (") + std::to_string(portOffset) + std::string(")")); peerlock.unlock(); } @@ -288,7 +288,7 @@ static void __GameModeNotify(u64 userdata, int cyclesLate) { for (auto& gma : replicaGameModeAreas) { if (IsMatch(gma.mac, sendermac)) { - DEBUG_LOG(SCENET, "GameMode: Replica data Received %d bytes for Area #%d [%s]", bufsz, gma.id, mac2str(&sendermac).c_str()); + DEBUG_LOG(Log::sceNet, "GameMode: Replica data Received %d bytes for Area #%d [%s]", bufsz, gma.id, mac2str(&sendermac).c_str()); memcpy(gma.data, gameModeBuffer, std::min(gma.size, bufsz)); gma.dataUpdated = 1; gma.updateTimestamp = CoreTiming::GetGlobalTimeUsScaled(); @@ -303,10 +303,10 @@ static void __GameModeNotify(u64 userdata, int cyclesLate) { CoreTiming::ScheduleEvent(usToCycles(GAMEMODE_UPDATE_INTERVAL) - cyclesLate, gameModeNotifyEvent, userdata); return; } - INFO_LOG(SCENET, "GameMode Scheduler (%d, %d) has ended", gameModeSocket, gameModeBuffSize); + INFO_LOG(Log::sceNet, "GameMode Scheduler (%d, %d) has ended", gameModeSocket, gameModeBuffSize); u32 waitVal = __KernelGetWaitValue(threadID, error); if (error == 0) { - DEBUG_LOG(SCENET, "GameMode: Resuming Thread %d after Master Deleted (Result = %08x)", threadID, waitVal); + DEBUG_LOG(Log::sceNet, "GameMode: Resuming Thread %d after Master Deleted (Result = %08x)", threadID, waitVal); __KernelResumeThreadFromWait(threadID, waitVal); } } @@ -320,13 +320,13 @@ static void __AdhocctlNotify(u64 userdata, int cyclesLate) { SceUID waitID = __KernelGetWaitID(threadID, WAITTYPE_NET, error); if (waitID == 0 || error != 0) { - WARN_LOG(SCENET, "sceNetAdhocctl Socket WaitID(%i) on Thread(%i) already woken up? (error: %08x)", uid, threadID, error); + WARN_LOG(Log::sceNet, "sceNetAdhocctl Socket WaitID(%i) on Thread(%i) already woken up? (error: %08x)", uid, threadID, error); return; } // Socket not found?! Should never happen! But if it ever happened (ie. loaded from SaveState where adhocctlRequests got cleared) return BUSY and let the game try again. if (adhocctlRequests.find(uid) == adhocctlRequests.end()) { - WARN_LOG(SCENET, "sceNetAdhocctl Socket WaitID(%i) not found!", uid); + WARN_LOG(Log::sceNet, "sceNetAdhocctl Socket WaitID(%i) not found!", uid); __KernelResumeThreadFromWait(threadID, ERROR_NET_ADHOCCTL_BUSY); return; } @@ -367,7 +367,7 @@ static void __AdhocctlNotify(u64 userdata, int cyclesLate) { // Prevent from sending again req.opcode = 0; if (ret == SOCKET_ERROR) - DEBUG_LOG(SCENET, "sceNetAdhocctl[%i]: Socket Error (%i)", uid, sockerr); + DEBUG_LOG(Log::sceNet, "sceNetAdhocctl[%i]: Socket Error (%i)", uid, sockerr); } } } @@ -389,7 +389,7 @@ static void __AdhocctlNotify(u64 userdata, int cyclesLate) { u32 waitVal = __KernelGetWaitValue(threadID, error); __KernelResumeThreadFromWait(threadID, result); - DEBUG_LOG(SCENET, "Returning (WaitID: %d, error: %08x) Result (%08x) of sceNetAdhocctl - Opcode: %d, State: %d", waitID, error, (int)result, waitVal, adhocctlState); + DEBUG_LOG(Log::sceNet, "Returning (WaitID: %d, error: %08x) Result (%08x) of sceNetAdhocctl - Opcode: %d, State: %d", waitID, error, (int)result, waitVal, adhocctlState); // We are done with this request adhocctlRequests.erase(uid); @@ -405,7 +405,7 @@ static void __AdhocctlState(u64 userdata, int cyclesLate) { SceUID waitID = __KernelGetWaitID(threadID, WAITTYPE_NET, error); if (waitID == 0 || error != 0) { - WARN_LOG(SCENET, "sceNetAdhocctl State WaitID(%i) on Thread(%i) already woken up? (error: %08x)", uid, threadID, error); + WARN_LOG(Log::sceNet, "sceNetAdhocctl State WaitID(%i) on Thread(%i) already woken up? (error: %08x)", uid, threadID, error); return; } @@ -421,7 +421,7 @@ static void __AdhocctlState(u64 userdata, int cyclesLate) { } __KernelResumeThreadFromWait(threadID, result); - DEBUG_LOG(SCENET, "Returning (WaitID: %d, error: %08x) Result (%08x) of sceNetAdhocctl - Event: %d, State: %d", waitID, error, (int)result, event, adhocctlState); + DEBUG_LOG(Log::sceNet, "Returning (WaitID: %d, error: %08x) Result (%08x) of sceNetAdhocctl - Event: %d, State: %d", waitID, error, (int)result, event, adhocctlState); } // Used to simulate blocking on metasocket when send OP code to AdhocServer @@ -429,7 +429,7 @@ int WaitBlockingAdhocctlSocket(AdhocctlRequest request, int usec, const char* re int uid = (metasocket <= 0) ? 1 : (int)metasocket; if (adhocctlRequests.find(uid) != adhocctlRequests.end()) { - WARN_LOG(SCENET, "sceNetAdhocctl - WaitID[%d] already existed, Socket is busy!", uid); + WARN_LOG(Log::sceNet, "sceNetAdhocctl - WaitID[%d] already existed, Socket is busy!", uid); return ERROR_NET_ADHOCCTL_BUSY; } @@ -455,9 +455,9 @@ int ScheduleAdhocctlState(int event, int newState, int usec, const char* reason) } int StartGameModeScheduler() { - INFO_LOG(SCENET, "Initiating GameMode Scheduler"); + INFO_LOG(Log::sceNet, "Initiating GameMode Scheduler"); if (CoreTiming::IsScheduled(gameModeNotifyEvent)) { - WARN_LOG(SCENET, "GameMode Scheduler is already running!"); + WARN_LOG(Log::sceNet, "GameMode Scheduler is already running!"); return -1; } u64 param = ((u64)__KernelGetCurThread()) << 32; @@ -505,7 +505,7 @@ int DoBlockingPdpRecv(AdhocSocketRequest& req, s64& result) { u64 now = (u64)(time_now_d() * 1000000.0); if (req.timeout != 0 && now - req.startTime > req.timeout) { result = ERROR_NET_ADHOC_TIMEOUT; - DEBUG_LOG(SCENET, "sceNetAdhocPdpRecv[%i]: Discard Timeout", req.id); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpRecv[%i]: Discard Timeout", req.id); return 0; } else @@ -524,7 +524,7 @@ int DoBlockingPdpRecv(AdhocSocketRequest& req, s64& result) { // UDP can also receives 0 data, while on TCP receiving 0 data = connection gracefully closed, but not sure whether PDP can send/recv 0 data or not tho *req.length = 0; if (ret >= 0) { - DEBUG_LOG(SCENET, "sceNetAdhocPdpRecv[%i:%u]: Received %u bytes from %s:%u\n", req.id, getLocalPort(pdpsocket.id), ret, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpRecv[%i:%u]: Received %u bytes from %s:%u\n", req.id, getLocalPort(pdpsocket.id), ret, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); // Find Peer MAC if (resolveIP(sin.sin_addr.s_addr, &mac)) { @@ -546,7 +546,7 @@ int DoBlockingPdpRecv(AdhocSocketRequest& req, s64& result) { *req.length = ret; *req.remotePort = ntohs(sin.sin_port) - portOffset; - WARN_LOG(SCENET, "sceNetAdhocPdpRecv[%i:%u]: Received %i bytes from Unknown Peer %s:%u", req.id, getLocalPort(pdpsocket.id), ret, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); + WARN_LOG(Log::sceNet, "sceNetAdhocPdpRecv[%i:%u]: Received %i bytes from Unknown Peer %s:%u", req.id, getLocalPort(pdpsocket.id), ret, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); } } result = 0; @@ -563,7 +563,7 @@ int DoBlockingPdpRecv(AdhocSocketRequest& req, s64& result) { } // Returning required buffer size when available data in recv buffer is larger than provided buffer size else if (ret > *req.length) { - WARN_LOG(SCENET, "sceNetAdhocPdpRecv[%i:%u]: Peeked %u/%u bytes from %s:%u\n", req.id, getLocalPort(pdpsocket.id), ret, *req.length, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); + WARN_LOG(Log::sceNet, "sceNetAdhocPdpRecv[%i:%u]: Peeked %u/%u bytes from %s:%u\n", req.id, getLocalPort(pdpsocket.id), ret, *req.length, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); *req.length = ret; // Find Peer MAC @@ -585,7 +585,7 @@ int DoBlockingPdpRecv(AdhocSocketRequest& req, s64& result) { result = ERROR_NET_ADHOC_TIMEOUT; // ERROR_NET_ADHOC_INVALID_ARG; // ERROR_NET_ADHOC_DISCONNECTED if (ret == SOCKET_ERROR) - DEBUG_LOG(SCENET, "sceNetAdhocPdpRecv[%i]: Socket Error (%i)", req.id, sockerr); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpRecv[%i]: Socket Error (%i)", req.id, sockerr); return 0; } @@ -616,7 +616,7 @@ int DoBlockingPdpSend(AdhocSocketRequest& req, s64& result, AdhocSendTargets& ta int sockerr = errno; if (ret >= 0) { - DEBUG_LOG(SCENET, "sceNetAdhocPdpSend[%i:%u](B): Sent %u bytes to %s:%u\n", req.id, getLocalPort(pdpsocket.id), ret, ip2str(target.sin_addr).c_str(), ntohs(target.sin_port)); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpSend[%i:%u](B): Sent %u bytes to %s:%u\n", req.id, getLocalPort(pdpsocket.id), ret, ip2str(target.sin_addr).c_str(), ntohs(target.sin_port)); // Remove successfully sent to peer to prevent sending the same data again during a retry peer = targetPeers.peers.erase(peer); } @@ -634,7 +634,7 @@ int DoBlockingPdpSend(AdhocSocketRequest& req, s64& result, AdhocSendTargets& ta } if (ret == SOCKET_ERROR) - DEBUG_LOG(SCENET, "Socket Error (%i) on sceNetAdhocPdpSend[%i:%u->%u](B) [size=%i]", sockerr, req.id, getLocalPort(pdpsocket.id), ntohs(target.sin_port), targetPeers.length); + DEBUG_LOG(Log::sceNet, "Socket Error (%i) on sceNetAdhocPdpSend[%i:%u->%u](B) [size=%i]", sockerr, req.id, getLocalPort(pdpsocket.id), ntohs(target.sin_port), targetPeers.length); } if (retry) @@ -665,7 +665,7 @@ int DoBlockingPtpSend(AdhocSocketRequest& req, s64& result) { // Save Length *req.length = ret; - DEBUG_LOG(SCENET, "sceNetAdhocPtpSend[%i:%u]: Sent %u bytes to %s:%u\n", req.id, ptpsocket.lport, ret, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpSend[%i:%u]: Sent %u bytes to %s:%u\n", req.id, ptpsocket.lport, ret, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport); // Set to Established on successful Send when an attempt to Connect was initiated if (ptpsocket.state == ADHOC_PTP_STATE_SYN_SENT) @@ -691,7 +691,7 @@ int DoBlockingPtpSend(AdhocSocketRequest& req, s64& result) { } if (ret == SOCKET_ERROR) - DEBUG_LOG(SCENET, "sceNetAdhocPtpSend[%i]: Socket Error (%i)", req.id, sockerr); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpSend[%i]: Socket Error (%i)", req.id, sockerr); return 0; } @@ -714,7 +714,7 @@ int DoBlockingPtpRecv(AdhocSocketRequest& req, s64& result) { // Received Data. POSIX: May received 0 bytes when the remote peer already closed the connection. if (ret > 0) { - DEBUG_LOG(SCENET, "sceNetAdhocPtpRecv[%i:%u]: Received %u bytes from %s:%u\n", req.id, ptpsocket.lport, ret, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpRecv[%i:%u]: Received %u bytes from %s:%u\n", req.id, ptpsocket.lport, ret, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport); // Save Length *req.length = ret; @@ -747,7 +747,7 @@ int DoBlockingPtpRecv(AdhocSocketRequest& req, s64& result) { } if (ret == SOCKET_ERROR) - DEBUG_LOG(SCENET, "sceNetAdhocPtpRecv[%i]: Socket Error (%i)", req.id, sockerr); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpRecv[%i]: Socket Error (%i)", req.id, sockerr); return 0; } @@ -797,7 +797,7 @@ int DoBlockingPtpAccept(AdhocSocketRequest& req, s64& result) { result = ERROR_NET_ADHOC_INVALID_ARG; //ERROR_NET_ADHOC_TIMEOUT if (ret == SOCKET_ERROR) - DEBUG_LOG(SCENET, "sceNetAdhocPtpAccept[%i]: Socket Error (%i)", req.id, sockerr); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpAccept[%i]: Socket Error (%i)", req.id, sockerr); return 0; } @@ -827,7 +827,7 @@ int DoBlockingPtpConnect(AdhocSocketRequest& req, s64& result, AdhocSendTargets& ret = connect(ptpsocket.id, (struct sockaddr*)&sin, sizeof(sin)); sockerr = errno; if (sockerr != 0) - DEBUG_LOG(SCENET, "sceNetAdhocPtpConnect[%i:%u]: connect(%i) error = %i", req.id, ptpsocket.lport, ptpsocket.id, sockerr); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i:%u]: connect(%i) error = %i", req.id, ptpsocket.lport, ptpsocket.id, sockerr); else ret = 1; // Ensure returned success value from connect to be compatible with returned success value from select (ie. positive value) } @@ -835,9 +835,9 @@ int DoBlockingPtpConnect(AdhocSocketRequest& req, s64& result, AdhocSendTargets& // Note: On Linux "select" can return > 0 (with SO_ERROR = 0) even when the connection is not accepted yet, thus need "getpeername" to ensure else { ret = IsSocketReady(ptpsocket.id, false, true, &sockerr); - DEBUG_LOG(SCENET, "sceNetAdhocPtpConnect[%i:%u]: Select(%i) = %i, error = %i", req.id, ptpsocket.lport, ptpsocket.id, ret, sockerr); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i:%u]: Select(%i) = %i, error = %i", req.id, ptpsocket.lport, ptpsocket.id, ret, sockerr); if (sockerr != 0) { - DEBUG_LOG(SCENET, "sceNetAdhocPtpConnect[%i:%u]: SelectError(%i) = %i", req.id, ptpsocket.lport, ptpsocket.id, sockerr); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i:%u]: SelectError(%i) = %i", req.id, ptpsocket.lport, ptpsocket.id, sockerr); ret = SOCKET_ERROR; // Ensure returned value from select to be negative when the socket has error (the socket may need to be recreated again) } @@ -856,7 +856,7 @@ int DoBlockingPtpConnect(AdhocSocketRequest& req, s64& result, AdhocSendTargets& ret = getpeername(ptpsocket.id, (struct sockaddr*)&sin, &sinlen); if (ret == SOCKET_ERROR) { int err = errno; - VERBOSE_LOG(SCENET, "sceNetAdhocPtpConnect[%i:%u]: getpeername(%i) error %i, sockerr = %i", req.id, ptpsocket.lport, ptpsocket.id, err, sockerr); + VERBOSE_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i:%u]: getpeername(%i) error %i, sockerr = %i", req.id, ptpsocket.lport, ptpsocket.id, err, sockerr); sockerr = err; } } @@ -864,7 +864,7 @@ int DoBlockingPtpConnect(AdhocSocketRequest& req, s64& result, AdhocSendTargets& // Update Adhoc Socket state if (ret != SOCKET_ERROR || sockerr == EISCONN) { ptpsocket.state = ADHOC_PTP_STATE_ESTABLISHED; - INFO_LOG(SCENET, "sceNetAdhocPtpConnect[%i:%u]: Established (%s:%u)", req.id, ptpsocket.lport, ip2str(sin.sin_addr).c_str(), ptpsocket.pport); + INFO_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i:%u]: Established (%s:%u)", req.id, ptpsocket.lport, ip2str(sin.sin_addr).c_str(), ptpsocket.pport); // Done result = 0; @@ -876,9 +876,9 @@ int DoBlockingPtpConnect(AdhocSocketRequest& req, s64& result, AdhocSendTargets& else { // Only recreate the socket once per frame (just like most adhoc games that tried to PtpConnect once per frame when using non-blocking mode) if (/*sockerr == ECONNREFUSED ||*/ static_cast(CoreTiming::GetGlobalTimeUsScaled() - sock->internalLastAttempt) > 16666) { - DEBUG_LOG(SCENET, "sceNetAdhocPtpConnect[%i:%u]: Recreating Socket %i, errno = %i, state = %i, attempt = %i", req.id, ptpsocket.lport, ptpsocket.id, sockerr, ptpsocket.state, sock->attemptCount); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i:%u]: Recreating Socket %i, errno = %i, state = %i, attempt = %i", req.id, ptpsocket.lport, ptpsocket.id, sockerr, ptpsocket.state, sock->attemptCount); if (RecreatePtpSocket(req.id) < 0) { - WARN_LOG(SCENET, "sceNetAdhocPtpConnect[%i:%u]: RecreatePtpSocket error %i", req.id, ptpsocket.lport, errno); + WARN_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i:%u]: RecreatePtpSocket error %i", req.id, ptpsocket.lport, errno); } ptpsocket.state = ADHOC_PTP_STATE_CLOSED; sock->internalLastAttempt = CoreTiming::GetGlobalTimeUsScaled(); @@ -905,7 +905,7 @@ int DoBlockingPtpConnect(AdhocSocketRequest& req, s64& result, AdhocSendTargets& } if (ret == SOCKET_ERROR) - DEBUG_LOG(SCENET, "sceNetAdhocPtpConnect[%i]: Socket Error (%i)", req.id, sockerr); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i]: Socket Error (%i)", req.id, sockerr); return 0; } @@ -937,7 +937,7 @@ int DoBlockingPtpFlush(AdhocSocketRequest& req, s64& result) { } if (sockerr != 0) { - DEBUG_LOG(SCENET, "sceNetAdhocPtpFlush[%i]: Socket Error (%i)", req.id, sockerr); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpFlush[%i]: Socket Error (%i)", req.id, sockerr); } return 0; @@ -965,9 +965,9 @@ int DoBlockingAdhocPollSocket(AdhocSocketRequest& req, s64& result) { if (sds[i].id > 0 && sds[i].id <= MAX_SOCKET && adhocSockets[sds[i].id - 1] != NULL) { auto sock = adhocSockets[sds[i].id - 1]; if (sock->type == SOCK_PTP) - VERBOSE_LOG(SCENET, "Poll PTP Socket Id: %d (%d), events: %08x, revents: %08x - state: %d", sds[i].id, sock->data.ptp.id, sds[i].events, sds[i].revents, sock->data.ptp.state); + VERBOSE_LOG(Log::sceNet, "Poll PTP Socket Id: %d (%d), events: %08x, revents: %08x - state: %d", sds[i].id, sock->data.ptp.id, sds[i].events, sds[i].revents, sock->data.ptp.state); else - VERBOSE_LOG(SCENET, "Poll PDP Socket Id: %d (%d), events: %08x, revents: %08x", sds[i].id, sock->data.pdp.id, sds[i].events, sds[i].revents); + VERBOSE_LOG(Log::sceNet, "Poll PDP Socket Id: %d (%d), events: %08x, revents: %08x", sds[i].id, sock->data.pdp.id, sds[i].events, sds[i].revents); } } } @@ -985,13 +985,13 @@ static void __AdhocSocketNotify(u64 userdata, int cyclesLate) { SceUID waitID = __KernelGetWaitID(threadID, WAITTYPE_NET, error); if (waitID == 0 || error != 0) { - WARN_LOG(SCENET, "sceNetAdhoc Socket WaitID(%i) on Thread(%i) already woken up? (error: %08x)", uid, threadID, error); + WARN_LOG(Log::sceNet, "sceNetAdhoc Socket WaitID(%i) on Thread(%i) already woken up? (error: %08x)", uid, threadID, error); return; } // Socket not found?! Should never happened! But if it ever happened (ie. loaded from SaveState where adhocSocketRequests got cleared) return TIMEOUT and let the game try again. if (adhocSocketRequests.find(userdata) == adhocSocketRequests.end()) { - WARN_LOG(SCENET, "sceNetAdhoc Socket WaitID(%i) on Thread(%i) not found!", uid, threadID); + WARN_LOG(Log::sceNet, "sceNetAdhoc Socket WaitID(%i) on Thread(%i) not found!", uid, threadID); __KernelResumeThreadFromWait(threadID, ERROR_NET_ADHOC_TIMEOUT); return; } @@ -1071,7 +1071,7 @@ static void __AdhocSocketNotify(u64 userdata, int cyclesLate) { } __KernelResumeThreadFromWait(threadID, result); - DEBUG_LOG(SCENET, "Returning (ThreadId: %d, WaitID: %d, error: %08x) Result (%08x) of sceNetAdhoc[%d] - SocketID: %d", threadID, waitID, error, (int)result, req.type, req.id); + DEBUG_LOG(Log::sceNet, "Returning (ThreadId: %d, WaitID: %d, error: %08x) Result (%08x) of sceNetAdhoc[%d] - SocketID: %d", threadID, waitID, error, (int)result, req.type, req.id); // We are done with this socket adhocSocketRequests.erase(userdata); @@ -1081,7 +1081,7 @@ static void __AdhocSocketNotify(u64 userdata, int cyclesLate) { int WaitBlockingAdhocSocket(u64 threadSocketId, int type, int pspSocketId, void* buffer, s32_le* len, u32 timeoutUS, SceNetEtherAddr* remoteMAC, u16_le* remotePort, const char* reason) { int uid = (int)(threadSocketId & 0xFFFFFFFF); if (adhocSocketRequests.find(threadSocketId) != adhocSocketRequests.end()) { - WARN_LOG(SCENET, "sceNetAdhoc[%d] - ThreadID[%d] WaitID[%d] already existed, Socket[%d] is busy!", type, static_cast(threadSocketId >> 32), uid, pspSocketId); + WARN_LOG(Log::sceNet, "sceNetAdhoc[%d] - ThreadID[%d] WaitID[%d] already existed, Socket[%d] is busy!", type, static_cast(threadSocketId >> 32), uid, pspSocketId); // FIXME: Not sure if Adhoc Socket can return ADHOC_BUSY or not (assuming it's similar to EINPROGRESS for Adhoc Socket), or may be we should return TIMEOUT instead? return ERROR_NET_ADHOC_BUSY; // ERROR_NET_ADHOC_TIMEOUT } @@ -1293,14 +1293,14 @@ u32 sceNetAdhocInit() { deleteAllGMB(); // Return Success - return hleLogSuccessInfoI(SCENET, 0, "at %08x", currentMIPS->pc); + return hleLogSuccessInfoI(Log::sceNet, 0, "at %08x", currentMIPS->pc); } // Already initialized - return hleLogWarning(SCENET, ERROR_NET_ADHOC_ALREADY_INITIALIZED, "already initialized"); + return hleLogWarning(Log::sceNet, ERROR_NET_ADHOC_ALREADY_INITIALIZED, "already initialized"); } static u32 sceNetAdhocctlInit(int stackSize, int prio, u32 productAddr) { - INFO_LOG(SCENET, "sceNetAdhocctlInit(%i, %i, %08x) at %08x", stackSize, prio, productAddr, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocctlInit(%i, %i, %08x) at %08x", stackSize, prio, productAddr, currentMIPS->pc); // FIXME: Returning 0x8002013a (SCE_KERNEL_ERROR_LIBRARY_NOT_YET_LINKED) without adhoc module loaded first? // FIXME: Sometimes returning 0x80410601 (ERROR_NET_ADHOC_AUTH_ALREADY_INITIALIZED / Library module is already initialized ?) when AdhocctlTerm is not fully done? @@ -1361,7 +1361,7 @@ int sceNetAdhocctlGetState(u32 ptrToStatus) { Memory::Write_U32(state, ptrToStatus); // Return Success - return hleLogSuccessVerboseI(SCENET, 0, "state = %d", state); + return hleLogSuccessVerboseI(Log::sceNet, 0, "state = %d", state); } /** @@ -1374,7 +1374,7 @@ int sceNetAdhocctlGetState(u32 ptrToStatus) { */ // When choosing AdHoc menu in Wipeout Pulse sometimes it's saying that "WLAN is turned off" on game screen and getting "kUnityCommandCode_MediaDisconnected" error in the Log Console when calling sceNetAdhocPdpCreate, probably it needed to wait something from the thread before calling this (ie. need to receives 7 bytes from adhoc server 1st?) static int sceNetAdhocPdpCreate(const char *mac, int port, int bufferSize, u32 flag) { - INFO_LOG(SCENET, "sceNetAdhocPdpCreate(%s, %u, %u, %u) at %08x", mac2str((SceNetEtherAddr*)mac).c_str(), port, bufferSize, flag, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocPdpCreate(%s, %u, %u, %u) at %08x", mac2str((SceNetEtherAddr*)mac).c_str(), port, bufferSize, flag, currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; } @@ -1391,7 +1391,7 @@ static int sceNetAdhocPdpCreate(const char *mac, int port, int bufferSize, u32 f // Port is in use by another PDP Socket. if (isPDPPortInUse(port)) { // FIXME: When PORT_IN_USE error occured it seems the index to the socket id also increased, which means it tries to create & bind the socket first and then closes it due to failed to bind - return hleLogDebug(SCENET, ERROR_NET_ADHOC_PORT_IN_USE, "port in use"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_PORT_IN_USE, "port in use"); } //sport 0 should be shifted back to 0 when using offset Phantasy Star Portable 2 use this @@ -1437,7 +1437,7 @@ static int sceNetAdhocPdpCreate(const char *mac, int port, int bufferSize, u32 f requestedport = 65535; // Hopefully it will be safe to default it to 65535 since there can't be more than one port that can bumped into 65536 // Show a warning about privileged ports if (requestedport != 0 && requestedport < 1024) { - WARN_LOG(SCENET, "sceNetAdhocPdpCreate - Ports below 1024(ie. %hu) may require Admin Privileges", requestedport); + WARN_LOG(Log::sceNet, "sceNetAdhocPdpCreate - Ports below 1024(ie. %hu) may require Admin Privileges", requestedport); } addr.sin_port = htons(requestedport); @@ -1454,7 +1454,7 @@ static int sceNetAdhocPdpCreate(const char *mac, int port, int bufferSize, u32 f if (getsockname(usocket, (struct sockaddr*)&addr, &len) == 0) { uint16_t boundport = ntohs(addr.sin_port); if (port + static_cast(portOffset) >= 65536 || static_cast(boundport) - static_cast(portOffset) <= 0) - WARN_LOG(SCENET, "sceNetAdhocPdpCreate - Wrapped Port Detected: Original(%d) -> Requested(%d), Bound(%d) -> BoundOriginal(%d)", port, requestedport, boundport, boundport - portOffset); + WARN_LOG(Log::sceNet, "sceNetAdhocPdpCreate - Wrapped Port Detected: Original(%d) -> Requested(%d), Bound(%d) -> BoundOriginal(%d)", port, requestedport, boundport, boundport - portOffset); port = boundport - portOffset; } @@ -1495,7 +1495,7 @@ static int sceNetAdhocPdpCreate(const char *mac, int port, int bufferSize, u32 f changeBlockingMode(usocket, 1); // Success - INFO_LOG(SCENET, "sceNetAdhocPdpCreate - PSP Socket id: %i, Host Socket id: %i", i + 1, usocket); + INFO_LOG(Log::sceNet, "sceNetAdhocPdpCreate - PSP Socket id: %i, Host Socket id: %i", i + 1, usocket); return i + 1; } @@ -1509,27 +1509,27 @@ static int sceNetAdhocPdpCreate(const char *mac, int port, int bufferSize, u32 f // Port not available (exclusively in use?) if (iResult == SOCKET_ERROR) { - ERROR_LOG(SCENET, "Socket error (%i) when binding port %u", errno, ntohs(addr.sin_port)); + ERROR_LOG(Log::sceNet, "Socket error (%i) when binding port %u", errno, ntohs(addr.sin_port)); auto n = GetI18NCategory(I18NCat::NETWORKING); g_OSD.Show(OSDType::MESSAGE_ERROR, std::string(n->T("Failed to Bind Port")) + " " + std::to_string(port + portOffset) + "\n" + std::string(n->T("Please change your Port Offset"))); - return hleLogDebug(SCENET, ERROR_NET_ADHOC_PORT_NOT_AVAIL, "port not available"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_PORT_NOT_AVAIL, "port not available"); } } // Default to No-Space Error - return hleLogDebug(SCENET, ERROR_NET_NO_SPACE, "net no space"); + return hleLogDebug(Log::sceNet, ERROR_NET_NO_SPACE, "net no space"); } // Invalid MAC supplied - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_ADDR, "invalid address"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_ADDR, "invalid address"); } // Invalid Arguments were supplied - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); } // Library is uninitialized - return hleLogDebug(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "adhoc not initialized"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "adhoc not initialized"); } /** @@ -1541,19 +1541,19 @@ static int sceNetAdhocctlGetParameter(u32 paramAddr) { char grpName[9] = { 0 }; memcpy(grpName, parameter.group_name.data, ADHOCCTL_GROUPNAME_LEN); parameter.nickname.data[ADHOCCTL_NICKNAME_LEN - 1] = 0; - DEBUG_LOG(SCENET, "sceNetAdhocctlGetParameter(%08x) [Ch=%i][Group=%s][BSSID=%s][name=%s]", paramAddr, parameter.channel, grpName, mac2str(¶meter.bssid.mac_addr).c_str(), parameter.nickname.data); + DEBUG_LOG(Log::sceNet, "sceNetAdhocctlGetParameter(%08x) [Ch=%i][Group=%s][BSSID=%s][name=%s]", paramAddr, parameter.channel, grpName, mac2str(¶meter.bssid.mac_addr).c_str(), parameter.nickname.data); if (!g_Config.bEnableWlan) { return ERROR_NET_ADHOCCTL_DISCONNECTED; } // Library initialized if (!netAdhocctlInited) { - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_INITIALIZED); } auto ptr = PSPPointer::Create(paramAddr); if (!ptr.IsValid()) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_INVALID_ARG); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_INVALID_ARG); *ptr = parameter; ptr.NotifyWrite("NetAdhocctlGetParameter"); @@ -1573,9 +1573,9 @@ static int sceNetAdhocctlGetParameter(u32 paramAddr) { */ static int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int len, int timeout, int flag) { if (flag == 0) { // Prevent spamming Debug Log with retries of non-bocking socket - DEBUG_LOG(SCENET, "sceNetAdhocPdpSend(%i, %s, %i, %p, %i, %i, %i) at %08x", id, mac2str((SceNetEtherAddr*)mac).c_str(), port, data, len, timeout, flag, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpSend(%i, %s, %i, %p, %i, %i, %i) at %08x", id, mac2str((SceNetEtherAddr*)mac).c_str(), port, data, len, timeout, flag, currentMIPS->pc); } else { - VERBOSE_LOG(SCENET, "sceNetAdhocPdpSend(%i, %s, %i, %p, %i, %i, %i) at %08x", id, mac2str((SceNetEtherAddr*)mac).c_str(), port, data, len, timeout, flag, currentMIPS->pc); + VERBOSE_LOG(Log::sceNet, "sceNetAdhocPdpSend(%i, %s, %i, %p, %i, %i, %i) at %08x", id, mac2str((SceNetEtherAddr*)mac).c_str(), port, data, len, timeout, flag, currentMIPS->pc); } if (!g_Config.bEnableWlan) { return -1; @@ -1615,7 +1615,7 @@ static int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int if (socket->flags & ADHOC_F_ALERTSEND) { socket->alerted_flags |= ADHOC_F_ALERTSEND; - return hleLogError(SCENET, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); } // Single Target @@ -1643,8 +1643,8 @@ static int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int if (!flag && (error == EAGAIN || error == EWOULDBLOCK)) { u64 threadSocketId = ((u64)__KernelGetCurThread()) << 32 | pdpsocket.id; if (sendTargetPeers.find(threadSocketId) != sendTargetPeers.end()) { - DEBUG_LOG(SCENET, "sceNetAdhocPdpSend[%i:%u]: Socket(%d) is Busy!", id, getLocalPort(pdpsocket.id), pdpsocket.id); - return hleLogError(SCENET, ERROR_NET_ADHOC_BUSY, "busy?"); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpSend[%i:%u]: Socket(%d) is Busy!", id, getLocalPort(pdpsocket.id), pdpsocket.id); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_BUSY, "busy?"); } AdhocSendTargets dest = { len, {}, false }; @@ -1653,7 +1653,7 @@ static int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int return WaitBlockingAdhocSocket(threadSocketId, PDP_SEND, id, data, nullptr, timeout, nullptr, nullptr, "pdp send"); } - DEBUG_LOG(SCENET, "Socket Error (%i) on sceNetAdhocPdpSend[%i:%u->%u] (size=%i)", error, id, getLocalPort(pdpsocket.id), ntohs(target.sin_port), len); + DEBUG_LOG(Log::sceNet, "Socket Error (%i) on sceNetAdhocPdpSend[%i:%u->%u] (size=%i)", error, id, getLocalPort(pdpsocket.id), ntohs(target.sin_port), len); } //changeBlockingMode(socket->id, 0); @@ -1663,7 +1663,7 @@ static int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int hleEatMicro(50); // Can be longer than 1ms tho // Sent Data if (sent >= 0) { - DEBUG_LOG(SCENET, "sceNetAdhocPdpSend[%i:%u]: Sent %u bytes to %s:%u\n", id, getLocalPort(pdpsocket.id), sent, ip2str(target.sin_addr).c_str(), ntohs(target.sin_port)); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpSend[%i:%u]: Sent %u bytes to %s:%u\n", id, getLocalPort(pdpsocket.id), sent, ip2str(target.sin_addr).c_str(), ntohs(target.sin_port)); // Success return 0; // sent; // MotorStorm will try to resend if return value is not 0 @@ -1671,12 +1671,12 @@ static int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int // Non-Blocking if (flag) - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); // Does PDP can Timeout? There is no concept of Timeout when sending UDP due to no ACK, but might happen if the socket buffer is full, not sure about PDP since some games did use the timeout arg - return hleLogDebug(SCENET, ERROR_NET_ADHOC_TIMEOUT, "timeout?"); // ERROR_NET_ADHOC_INVALID_ADDR; + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_TIMEOUT, "timeout?"); // ERROR_NET_ADHOC_INVALID_ADDR; } - VERBOSE_LOG(SCENET, "sceNetAdhocPdpSend[%i:%u]: Unknown Target Peer %s:%u (faking success)\n", id, getLocalPort(pdpsocket.id), mac2str(daddr).c_str(), ntohs(target.sin_port)); + VERBOSE_LOG(Log::sceNet, "sceNetAdhocPdpSend[%i:%u]: Unknown Target Peer %s:%u (faking success)\n", id, getLocalPort(pdpsocket.id), mac2str(daddr).c_str(), ntohs(target.sin_port)); return 0; // faking success } @@ -1719,8 +1719,8 @@ static int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int if (!flag) { u64 threadSocketId = ((u64)__KernelGetCurThread()) << 32 | pdpsocket.id; if (sendTargetPeers.find(threadSocketId) != sendTargetPeers.end()) { - DEBUG_LOG(SCENET, "sceNetAdhocPdpSend[%i:%u](BC): Socket(%d) is Busy!", id, getLocalPort(pdpsocket.id), pdpsocket.id); - return hleLogError(SCENET, ERROR_NET_ADHOC_BUSY, "busy?"); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpSend[%i:%u](BC): Socket(%d) is Busy!", id, getLocalPort(pdpsocket.id), pdpsocket.id); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_BUSY, "busy?"); } sendTargetPeers[threadSocketId] = dest; @@ -1739,11 +1739,11 @@ static int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int int sent = sendto(pdpsocket.id, (const char*)data, len, MSG_NOSIGNAL, (struct sockaddr*)&target, sizeof(target)); int error = errno; if (sent == SOCKET_ERROR) { - DEBUG_LOG(SCENET, "Socket Error (%i) on sceNetAdhocPdpSend[%i:%u->%u](BC) [size=%i]", error, id, getLocalPort(pdpsocket.id), ntohs(target.sin_port), len); + DEBUG_LOG(Log::sceNet, "Socket Error (%i) on sceNetAdhocPdpSend[%i:%u->%u](BC) [size=%i]", error, id, getLocalPort(pdpsocket.id), ntohs(target.sin_port), len); } if (sent >= 0) { - DEBUG_LOG(SCENET, "sceNetAdhocPdpSend[%i:%u](BC): Sent %u bytes to %s:%u\n", id, getLocalPort(pdpsocket.id), sent, ip2str(target.sin_addr).c_str(), ntohs(target.sin_port)); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpSend[%i:%u](BC): Sent %u bytes to %s:%u\n", id, getLocalPort(pdpsocket.id), sent, ip2str(target.sin_addr).c_str(), ntohs(target.sin_port)); } } } @@ -1760,27 +1760,27 @@ static int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int } // Invalid Destination Address - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_ADDR, "invalid address"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_ADDR, "invalid address"); } // Invalid Argument - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); } // Invalid Socket ID - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); } // Invalid Data Length - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_DATALEN, "invalid data length"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_DATALEN, "invalid data length"); } // Invalid Destination Port - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_PORT, "invalid port"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_PORT, "invalid port"); } // Library is uninitialized - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); } /** @@ -1796,9 +1796,9 @@ static int sceNetAdhocPdpSend(int id, const char *mac, u32 port, void *data, int */ static int sceNetAdhocPdpRecv(int id, void *addr, void * port, void *buf, void *dataLength, u32 timeout, int flag) { if (flag == 0) { // Prevent spamming Debug Log with retries of non-bocking socket - DEBUG_LOG(SCENET, "sceNetAdhocPdpRecv(%i, %p, %p, %p, %p, %i, %i) at %08x", id, addr, port, buf, dataLength, timeout, flag, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpRecv(%i, %p, %p, %p, %p, %i, %i) at %08x", id, addr, port, buf, dataLength, timeout, flag, currentMIPS->pc); } else { - VERBOSE_LOG(SCENET, "sceNetAdhocPdpRecv(%i, %p, %p, %p, %p, %i, %i) at %08x", id, addr, port, buf, dataLength, timeout, flag, currentMIPS->pc); + VERBOSE_LOG(Log::sceNet, "sceNetAdhocPdpRecv(%i, %p, %p, %p, %p, %i, %i) at %08x", id, addr, port, buf, dataLength, timeout, flag, currentMIPS->pc); } if (!g_Config.bEnableWlan) { @@ -1848,7 +1848,7 @@ static int sceNetAdhocPdpRecv(int id, void *addr, void * port, void *buf, void * if (socket->flags & ADHOC_F_ALERTRECV) { socket->alerted_flags |= ADHOC_F_ALERTRECV; - return hleLogError(SCENET, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); } // Sender Address @@ -1884,8 +1884,8 @@ static int sceNetAdhocPdpRecv(int id, void *addr, void * port, void *buf, void * memset(&sin, 0, sinlen); recvfrom(pdpsocket.id, dummyPeekBuf64k, dummyPeekBuf64kSize, MSG_NOSIGNAL, (struct sockaddr*)&sin, &sinlen); if (flag) { - VERBOSE_LOG(SCENET, "%08x=sceNetAdhocPdpRecv: would block (disc)", ERROR_NET_ADHOC_WOULD_BLOCK); // Temporary fix to avoid a crash on the Logs due to trying to Logs syscall's argument from another thread (ie. AdhocMatchingInput thread) - return ERROR_NET_ADHOC_WOULD_BLOCK; // hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "would block (disc)"); + VERBOSE_LOG(Log::sceNet, "%08x=sceNetAdhocPdpRecv: would block (disc)", ERROR_NET_ADHOC_WOULD_BLOCK); // Temporary fix to avoid a crash on the Logs due to trying to Logs syscall's argument from another thread (ie. AdhocMatchingInput thread) + return ERROR_NET_ADHOC_WOULD_BLOCK; // hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_WOULD_BLOCK, "would block (disc)"); } else { // Simulate blocking behaviour with non-blocking socket, and discard more unresolvable packets until timeout reached @@ -1899,7 +1899,7 @@ static int sceNetAdhocPdpRecv(int id, void *addr, void * port, void *buf, void * // At this point we assumed that the packet is a valid PPSSPP packet if (received != SOCKET_ERROR && *len < received) { - INFO_LOG(SCENET, "sceNetAdhocPdpRecv[%i:%u]: Peeked %u/%u bytes from %s:%u\n", id, getLocalPort(pdpsocket.id), received, *len, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); + INFO_LOG(Log::sceNet, "sceNetAdhocPdpRecv[%i:%u]: Peeked %u/%u bytes from %s:%u\n", id, getLocalPort(pdpsocket.id), received, *len, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); if (received > 0 && *len > 0) memcpy(buf, dummyPeekBuf64k, std::min(received, *len)); @@ -1917,7 +1917,7 @@ static int sceNetAdhocPdpRecv(int id, void *addr, void * port, void *buf, void * if (peer != NULL) peer->last_recv = CoreTiming::GetGlobalTimeUsScaled(); peerlock.unlock(); - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_NOT_ENOUGH_SPACE, "not enough space"); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_NOT_ENOUGH_SPACE, "not enough space"); } sinlen = sizeof(sin); @@ -1934,14 +1934,14 @@ static int sceNetAdhocPdpRecv(int id, void *addr, void * port, void *buf, void * return WaitBlockingAdhocSocket(threadSocketId, PDP_RECV, id, buf, len, timeout, saddr, sport, "pdp recv"); } - VERBOSE_LOG(SCENET, "%08x=sceNetAdhocPdpRecv: would block", ERROR_NET_ADHOC_WOULD_BLOCK); // Temporary fix to avoid a crash on the Logs due to trying to Logs syscall's argument from another thread (ie. AdhocMatchingInput thread) - return ERROR_NET_ADHOC_WOULD_BLOCK; // hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); + VERBOSE_LOG(Log::sceNet, "%08x=sceNetAdhocPdpRecv: would block", ERROR_NET_ADHOC_WOULD_BLOCK); // Temporary fix to avoid a crash on the Logs due to trying to Logs syscall's argument from another thread (ie. AdhocMatchingInput thread) + return ERROR_NET_ADHOC_WOULD_BLOCK; // hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); } hleEatMicro(50); // Received Data. UDP can also receives 0 data, while on TCP 0 data = connection gracefully closed, but not sure about PDP tho if (received >= 0) { - DEBUG_LOG(SCENET, "sceNetAdhocPdpRecv[%i:%u]: Received %u bytes from %s:%u\n", id, getLocalPort(pdpsocket.id), received, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpRecv[%i:%u]: Received %u bytes from %s:%u\n", id, getLocalPort(pdpsocket.id), received, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); // Find Peer MAC if (resolveIP(sin.sin_addr.s_addr, &mac)) { @@ -1971,10 +1971,10 @@ static int sceNetAdhocPdpRecv(int id, void *addr, void * port, void *buf, void * //free(tmpbuf); // Receiving data from unknown peer? Should never reached here! Unless the Peeked's packet was different than the Recved one (which mean there is a problem) - WARN_LOG(SCENET, "sceNetAdhocPdpRecv[%i:%u]: Received %i bytes from Unknown Peer %s:%u", id, getLocalPort(pdpsocket.id), received, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); + WARN_LOG(Log::sceNet, "sceNetAdhocPdpRecv[%i:%u]: Received %i bytes from Unknown Peer %s:%u", id, getLocalPort(pdpsocket.id), received, ip2str(sin.sin_addr).c_str(), ntohs(sin.sin_port)); if (flag) { - VERBOSE_LOG(SCENET, "%08x=sceNetAdhocPdpRecv: would block (problem)", ERROR_NET_ADHOC_WOULD_BLOCK); // Temporary fix to avoid a crash on the Logs due to trying to Logs syscall's argument from another thread (ie. AdhocMatchingInput thread) - return ERROR_NET_ADHOC_WOULD_BLOCK; // hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "would block (problem)"); + VERBOSE_LOG(Log::sceNet, "%08x=sceNetAdhocPdpRecv: would block (problem)", ERROR_NET_ADHOC_WOULD_BLOCK); // Temporary fix to avoid a crash on the Logs due to trying to Logs syscall's argument from another thread (ie. AdhocMatchingInput thread) + return ERROR_NET_ADHOC_WOULD_BLOCK; // hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_WOULD_BLOCK, "would block (problem)"); } } @@ -1986,22 +1986,22 @@ static int sceNetAdhocPdpRecv(int id, void *addr, void * port, void *buf, void * if (wouldblock) flag = 1; #endif - DEBUG_LOG(SCENET, "sceNetAdhocPdpRecv[%i:%u]: Result:%i (Error:%i)", id, pdpsocket.lport, received, error); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPdpRecv[%i:%u]: Result:%i (Error:%i)", id, pdpsocket.lport, received, error); // Unexpected error (other than EAGAIN/EWOULDBLOCK/ECONNRESET) or in case the Peeked's packet was different than Recved one, treated as Timeout? - return hleLogError(SCENET, ERROR_NET_ADHOC_TIMEOUT, "timeout?"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_TIMEOUT, "timeout?"); } // Invalid Argument - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); } // Invalid Socket ID - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); } // Library is uninitialized - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); } int NetAdhoc_SetSocketAlert(int id, s32_le flag) { @@ -2019,11 +2019,11 @@ int NetAdhoc_SetSocketAlert(int id, s32_le flag) { // Flags seems to be bitmasks of ADHOC_F_ALERT... (need more games to test this) int sceNetAdhocSetSocketAlert(int id, int flag) { - WARN_LOG_REPORT_ONCE(sceNetAdhocSetSocketAlert, SCENET, "UNTESTED sceNetAdhocSetSocketAlert(%d, %08x) at %08x", id, flag, currentMIPS->pc); + WARN_LOG_REPORT_ONCE(sceNetAdhocSetSocketAlert, Log::sceNet, "UNTESTED sceNetAdhocSetSocketAlert(%d, %08x) at %08x", id, flag, currentMIPS->pc); int retval = NetAdhoc_SetSocketAlert(id, flag); hleDelayResult(retval, "set socket alert delay", 1000); - return hleLogDebug(SCENET, retval, ""); + return hleLogDebug(Log::sceNet, retval, ""); } int PollAdhocSocket(SceNetAdhocPollSd* sds, int count, int timeout, int nonblock) { @@ -2122,7 +2122,7 @@ int PollAdhocSocket(SceNetAdhocPollSd* sds, int count, int timeout, int nonblock } int sceNetAdhocPollSocket(u32 socketStructAddr, int count, int timeout, int nonblock) { // timeout in microseconds - DEBUG_LOG_REPORT_ONCE(sceNetAdhocPollSocket, SCENET, "UNTESTED sceNetAdhocPollSocket(%08x, %i, %i, %i) at %08x", socketStructAddr, count, timeout, nonblock, currentMIPS->pc); + DEBUG_LOG_REPORT_ONCE(sceNetAdhocPollSocket, Log::sceNet, "UNTESTED sceNetAdhocPollSocket(%08x, %i, %i, %i) at %08x", socketStructAddr, count, timeout, nonblock, currentMIPS->pc); // Library is initialized if (netAdhocInited) { @@ -2136,7 +2136,7 @@ int sceNetAdhocPollSocket(u32 socketStructAddr, int count, int timeout, int nonb for (int i = 0; i < count; i++) { // Invalid Socket if (sds[i].id < 1 || sds[i].id > MAX_SOCKET || adhocSockets[sds[i].id - 1] == NULL) - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); } // Nonblocking Mode @@ -2173,28 +2173,28 @@ int sceNetAdhocPollSocket(u32 socketStructAddr, int count, int timeout, int nonb if (sds[i].id > 0 && sds[i].id <= MAX_SOCKET && adhocSockets[sds[i].id - 1] != NULL) { auto sock = adhocSockets[sds[i].id - 1]; if (sock->type == SOCK_PTP) - VERBOSE_LOG(SCENET, "Poll PTP Socket Id: %d (%d), events: %08x, revents: %08x - state: %d", sds[i].id, sock->data.ptp.id, sds[i].events, sds[i].revents, sock->data.ptp.state); + VERBOSE_LOG(Log::sceNet, "Poll PTP Socket Id: %d (%d), events: %08x, revents: %08x - state: %d", sds[i].id, sock->data.ptp.id, sds[i].events, sds[i].revents, sock->data.ptp.state); else - VERBOSE_LOG(SCENET, "Poll PDP Socket Id: %d (%d), events: %08x, revents: %08x", sds[i].id, sock->data.pdp.id, sds[i].events, sds[i].revents); + VERBOSE_LOG(Log::sceNet, "Poll PDP Socket Id: %d (%d), events: %08x, revents: %08x", sds[i].id, sock->data.pdp.id, sds[i].events, sds[i].revents); } } } // Workaround to get 30 FPS instead of the too fast 60 FPS on Fate Unlimited Codes, it's abit absurd for a non-blocking call to have this much delay tho, and hleDelayResult doesn't works as good as hleEatMicro for this workaround. hleEatMicro(50); // hleEatMicro(7500); // normally 1ms, but using 7.5ms here seems to show better result for Bleach Heat the Soul 7 and other games with too high FPS, but may have a risk of slowing down games that already runs at normal FPS? (need more games to test this) - return hleLogDebug(SCENET, affectedsockets, "success"); + return hleLogDebug(Log::sceNet, affectedsockets, "success"); } //else if (nonblock && affectedsockets < 0) - // return hleLogDebug(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); // Is this error code valid for PollSocket? as it always returns 0 even when nonblock flag is set + // return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); // Is this error code valid for PollSocket? as it always returns 0 even when nonblock flag is set - return hleLogDebug(SCENET, ERROR_NET_ADHOC_EXCEPTION_EVENT, "exception event"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_EXCEPTION_EVENT, "exception event"); } // Invalid Argument - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); } // Library is uninitialized - return hleLogDebug(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "adhoc not initialized"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "adhoc not initialized"); } int NetAdhocPdp_Delete(int id, int unknown) { @@ -2249,7 +2249,7 @@ int NetAdhocPdp_Delete(int id, int unknown) { */ static int sceNetAdhocPdpDelete(int id, int unknown) { // WLAN might be disabled in the middle of successfull multiplayer, but we still need to cleanup right? - INFO_LOG(SCENET, "sceNetAdhocPdpDelete(%d, %d) at %08x", id, unknown, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocPdpDelete(%d, %d) at %08x", id, unknown, currentMIPS->pc); /* if (!g_Config.bEnableWlan) { return 0; @@ -2260,24 +2260,24 @@ static int sceNetAdhocPdpDelete(int id, int unknown) { } static int sceNetAdhocctlGetAdhocId(u32 productStructAddr) { - INFO_LOG(SCENET, "sceNetAdhocctlGetAdhocId(%08x) at %08x", productStructAddr, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocctlGetAdhocId(%08x) at %08x", productStructAddr, currentMIPS->pc); if (!netAdhocctlInited) - return hleLogDebug(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); auto productStruct = PSPPointer::Create(productStructAddr); if (!productStruct.IsValid()) - return hleLogDebug(SCENET, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); *productStruct = product_code; productStruct.NotifyWrite("NetAdhocctlGetAdhocId"); - return hleLogDebug(SCENET, 0, "type = %d, code = %s", product_code.type, product_code.data); + return hleLogDebug(Log::sceNet, 0, "type = %d, code = %s", product_code.type, product_code.data); } // FIXME: Scan probably not a blocking function since there is ADHOCCTL_STATE_SCANNING state that can be polled by the game, right? But apparently it need to be delayed for Naruto Shippuden Ultimate Ninja Heroes 3 int sceNetAdhocctlScan() { - INFO_LOG(SCENET, "sceNetAdhocctlScan() at %08x", currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocctlScan() at %08x", currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; } @@ -2322,11 +2322,11 @@ int sceNetAdhocctlScan() { } // FIXME: Returning BUSY when previous adhocctl handler's callback is not fully executed yet, But returning success and notifying handler's callback with error (ie. ALREADY_CONNECTED) when previous adhocctl handler's callback is fully executed? Is there a case where error = BUSY sent through handler's callback? - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_BUSY, "busy"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_BUSY, "busy"); } // Library uninitialized - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); } int sceNetAdhocctlGetScanInfo(u32 sizeAddr, u32 bufAddr) { @@ -2335,7 +2335,7 @@ int sceNetAdhocctlGetScanInfo(u32 sizeAddr, u32 bufAddr) { SceNetAdhocctlScanInfoEmu *buf = NULL; if (Memory::IsValidAddress(bufAddr)) buf = (SceNetAdhocctlScanInfoEmu *)Memory::GetPointer(bufAddr); - INFO_LOG(SCENET, "sceNetAdhocctlGetScanInfo([%08x]=%i, %08x) at %08x", sizeAddr, Memory::Read_U32(sizeAddr), bufAddr, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocctlGetScanInfo([%08x]=%i, %08x) at %08x", sizeAddr, Memory::Read_U32(sizeAddr), bufAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) { return 0; } @@ -2356,13 +2356,13 @@ int sceNetAdhocctlGetScanInfo(u32 sizeAddr, u32 bufAddr) { // FIXME: When already connected to a group GetScanInfo will return size = 0 ? or may be only hides the group created by it's self? if (adhocctlState == ADHOCCTL_STATE_CONNECTED || adhocctlState == ADHOCCTL_STATE_GAMEMODE) { *buflen = 0; - DEBUG_LOG(SCENET, "NetworkList [Available: 0] Already in a Group"); + DEBUG_LOG(Log::sceNet, "NetworkList [Available: 0] Already in a Group"); } // Length Returner Mode else if (buf == NULL) { int availNetworks = countAvailableNetworks(excludeSelf); *buflen = availNetworks * sizeof(SceNetAdhocctlScanInfoEmu); - DEBUG_LOG(SCENET, "NetworkList [Available: %i]", availNetworks); + DEBUG_LOG(Log::sceNet, "NetworkList [Available: %i]", availNetworks); } // Normal Information Mode else { @@ -2410,7 +2410,7 @@ int sceNetAdhocctlGetScanInfo(u32 sizeAddr, u32 bufAddr) { // Fix Size *buflen = discovered * sizeof(SceNetAdhocctlScanInfoEmu); - DEBUG_LOG(SCENET, "NetworkList [Requested: %i][Discovered: %i]", requestcount, discovered); + DEBUG_LOG(Log::sceNet, "NetworkList [Requested: %i][Discovered: %i]", requestcount, discovered); } // Multithreading Unlock @@ -2453,17 +2453,17 @@ static u32 sceNetAdhocctlAddHandler(u32 handlerPtr, u32 handlerArg) { if (!foundHandler && Memory::IsValidAddress(handlerPtr)) { if (adhocctlHandlers.size() >= MAX_ADHOCCTL_HANDLERS) { - ERROR_LOG(SCENET, "UNTESTED sceNetAdhocctlAddHandler(%x, %x): Too many handlers", handlerPtr, handlerArg); + ERROR_LOG(Log::sceNet, "UNTESTED sceNetAdhocctlAddHandler(%x, %x): Too many handlers", handlerPtr, handlerArg); retval = ERROR_NET_ADHOCCTL_TOO_MANY_HANDLERS; return retval; } adhocctlHandlers[retval] = handler; - WARN_LOG(SCENET, "UNTESTED sceNetAdhocctlAddHandler(%x, %x): added handler %d", handlerPtr, handlerArg, retval); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocctlAddHandler(%x, %x): added handler %d", handlerPtr, handlerArg, retval); } else if(foundHandler) { - ERROR_LOG(SCENET, "UNTESTED sceNetAdhocctlAddHandler(%x, %x): Same handler already exists", handlerPtr, handlerArg); + ERROR_LOG(Log::sceNet, "UNTESTED sceNetAdhocctlAddHandler(%x, %x): Same handler already exists", handlerPtr, handlerArg); retval = 0; //Faking success } else { - ERROR_LOG(SCENET, "UNTESTED sceNetAdhocctlAddHandler(%x, %x): Invalid handler", handlerPtr, handlerArg); + ERROR_LOG(Log::sceNet, "UNTESTED sceNetAdhocctlAddHandler(%x, %x): Invalid handler", handlerPtr, handlerArg); retval = ERROR_NET_ADHOCCTL_INVALID_ARG; } @@ -2505,7 +2505,7 @@ u32 NetAdhocctl_Disconnect() { // Sending may get socket error 10053 if the AdhocServer is already shutted down if (iResult == SOCKET_ERROR) { if (error != EAGAIN && error != EWOULDBLOCK) { - ERROR_LOG(SCENET, "Socket error (%i) when sending", error); + ERROR_LOG(Log::sceNet, "Socket error (%i) when sending", error); // Set Disconnected State adhocctlState = ADHOCCTL_STATE_DISCONNECTED; } @@ -2529,7 +2529,7 @@ u32 NetAdhocctl_Disconnect() { // Clear Peer List, since games are moving to a different a group when the mission started may be we shouldn't free all peers yet int32_t peercount = 0; timeoutFriendsRecursive(friends, &peercount); - INFO_LOG(SCENET, "Marked for Timedout Peer List (%i)", peercount); + INFO_LOG(Log::sceNet, "Marked for Timedout Peer List (%i)", peercount); // Delete Peer Reference //friends = NULL; @@ -2561,20 +2561,20 @@ static u32 sceNetAdhocctlDisconnect() { char grpName[9] = { 0 }; memcpy(grpName, parameter.group_name.data, ADHOCCTL_GROUPNAME_LEN); // Copied to null-terminated var to prevent unexpected behaviour on Logs int ret = NetAdhocctl_Disconnect(); - INFO_LOG(SCENET, "%08x=sceNetAdhocctlDisconnect() at %08x [group=%s]", ret, currentMIPS->pc, grpName); + INFO_LOG(Log::sceNet, "%08x=sceNetAdhocctlDisconnect() at %08x [group=%s]", ret, currentMIPS->pc, grpName); return ret; } static u32 sceNetAdhocctlDelHandler(u32 handlerID) { if (!netAdhocctlInited) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "adhocctl not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "adhocctl not initialized"); if (adhocctlHandlers.find(handlerID) != adhocctlHandlers.end()) { adhocctlHandlers.erase(handlerID); - INFO_LOG(SCENET, "sceNetAdhocctlDelHandler(%d) at %08x", handlerID, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocctlDelHandler(%d) at %08x", handlerID, currentMIPS->pc); } else { - WARN_LOG(SCENET, "sceNetAdhocctlDelHandler(%d): Invalid Handler ID", handlerID); + WARN_LOG(Log::sceNet, "sceNetAdhocctlDelHandler(%d): Invalid Handler ID", handlerID); } return 0; @@ -2605,7 +2605,7 @@ int NetAdhocctl_Term() { // Clear Peer List int32_t peercount = 0; freeFriendsRecursive(friends, &peercount); - INFO_LOG(SCENET, "Cleared Peer List (%i)", peercount); + INFO_LOG(Log::sceNet, "Cleared Peer List (%i)", peercount); // Delete Peer Reference friends = NULL; //May also need to clear Handlers @@ -2632,7 +2632,7 @@ int NetAdhocctl_Term() { int sceNetAdhocctlTerm() { // WLAN might be disabled in the middle of successfull multiplayer, but we still need to cleanup right? - INFO_LOG(SCENET, "sceNetAdhocctlTerm() at %08x", currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocctlTerm() at %08x", currentMIPS->pc); //if (netAdhocMatchingInited) NetAdhocMatching_Term(); int retval = NetAdhocctl_Term(); @@ -2642,7 +2642,7 @@ int sceNetAdhocctlTerm() { } static int sceNetAdhocctlGetNameByAddr(const char *mac, u32 nameAddr) { - DEBUG_LOG(SCENET, "UNTESTED sceNetAdhocctlGetNameByAddr(%s, %08x) at %08x", mac2str((SceNetEtherAddr*)mac).c_str(), nameAddr, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "UNTESTED sceNetAdhocctlGetNameByAddr(%s, %08x) at %08x", mac2str((SceNetEtherAddr*)mac).c_str(), nameAddr, currentMIPS->pc); // Library initialized if (netAdhocctlInited) @@ -2661,7 +2661,7 @@ static int sceNetAdhocctlGetNameByAddr(const char *mac, u32 nameAddr) { // Write Data *nickname = parameter.nickname; - DEBUG_LOG(SCENET, "sceNetAdhocctlGetNameByAddr - [PlayerName:%s]", (char*)nickname); + DEBUG_LOG(Log::sceNet, "sceNetAdhocctlGetNameByAddr - [PlayerName:%s]", (char*)nickname); // Return Success return 0; @@ -2685,7 +2685,7 @@ static int sceNetAdhocctlGetNameByAddr(const char *mac, u32 nameAddr) { // Multithreading Unlock peerlock.unlock(); - DEBUG_LOG(SCENET, "sceNetAdhocctlGetNameByAddr - [PeerName:%s]", (char*)nickname); + DEBUG_LOG(Log::sceNet, "sceNetAdhocctlGetNameByAddr - [PeerName:%s]", (char*)nickname); // Return Success return 0; @@ -2695,7 +2695,7 @@ static int sceNetAdhocctlGetNameByAddr(const char *mac, u32 nameAddr) { // Multithreading Unlock peerlock.unlock(); - DEBUG_LOG(SCENET, "sceNetAdhocctlGetNameByAddr - PlayerName not found"); + DEBUG_LOG(Log::sceNet, "sceNetAdhocctlGetNameByAddr - PlayerName not found"); // Player not found return ERROR_NET_ADHOC_NO_ENTRY; } @@ -2709,7 +2709,7 @@ static int sceNetAdhocctlGetNameByAddr(const char *mac, u32 nameAddr) { } int sceNetAdhocctlGetPeerInfo(const char *mac, int size, u32 peerInfoAddr) { - VERBOSE_LOG(SCENET, "sceNetAdhocctlGetPeerInfo(%s, %i, %08x) at %08x", mac2str((SceNetEtherAddr*)mac).c_str(), size, peerInfoAddr, currentMIPS->pc); + VERBOSE_LOG(Log::sceNet, "sceNetAdhocctlGetPeerInfo(%s, %i, %08x) at %08x", mac2str((SceNetEtherAddr*)mac).c_str(), size, peerInfoAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; } @@ -2852,32 +2852,32 @@ int sceNetAdhocctlCreate(const char *groupName) { char grpName[ADHOCCTL_GROUPNAME_LEN + 1] = { 0 }; if (groupName) memcpy(grpName, groupName, ADHOCCTL_GROUPNAME_LEN); // For logging purpose, must not be truncated - INFO_LOG(SCENET, "sceNetAdhocctlCreate(%s) at %08x", grpName, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocctlCreate(%s) at %08x", grpName, currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; } adhocctlCurrentMode = ADHOCCTL_MODE_NORMAL; adhocConnectionType = ADHOC_CREATE; - return hleLogDebug(SCENET, NetAdhocctl_Create(groupName), ""); + return hleLogDebug(Log::sceNet, NetAdhocctl_Create(groupName), ""); } int sceNetAdhocctlConnect(const char* groupName) { char grpName[ADHOCCTL_GROUPNAME_LEN + 1] = { 0 }; if (groupName) memcpy(grpName, groupName, ADHOCCTL_GROUPNAME_LEN); // For logging purpose, must not be truncated - INFO_LOG(SCENET, "sceNetAdhocctlConnect(%s) at %08x", grpName, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocctlConnect(%s) at %08x", grpName, currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; } adhocctlCurrentMode = ADHOCCTL_MODE_NORMAL; adhocConnectionType = ADHOC_CONNECT; - return hleLogDebug(SCENET, NetAdhocctl_Create(groupName), ""); + return hleLogDebug(Log::sceNet, NetAdhocctl_Create(groupName), ""); } int sceNetAdhocctlJoin(u32 scanInfoAddr) { - INFO_LOG(SCENET, "sceNetAdhocctlJoin(%08x) at %08x", scanInfoAddr, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocctlJoin(%08x) at %08x", scanInfoAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; } @@ -2891,13 +2891,13 @@ int sceNetAdhocctlJoin(u32 scanInfoAddr) { SceNetAdhocctlScanInfoEmu* sinfo = (SceNetAdhocctlScanInfoEmu*)Memory::GetPointer(scanInfoAddr); char grpName[ADHOCCTL_GROUPNAME_LEN + 1] = { 0 }; memcpy(grpName, sinfo->group_name.data, ADHOCCTL_GROUPNAME_LEN); // For logging purpose, must not be truncated - DEBUG_LOG(SCENET, "sceNetAdhocctlJoin - Group: %s", grpName); + DEBUG_LOG(Log::sceNet, "sceNetAdhocctlJoin - Group: %s", grpName); // We can ignore minor connection process differences here // TODO: Adhoc Server may need to be changed to differentiate between Host/Create and Join, otherwise it can't support multiple Host using the same Group name, thus causing one of the Host to be confused being treated as Join. adhocctlCurrentMode = ADHOCCTL_MODE_NORMAL; adhocConnectionType = ADHOC_JOIN; - return hleLogDebug(SCENET, NetAdhocctl_Create(grpName), ""); + return hleLogDebug(Log::sceNet, NetAdhocctl_Create(grpName), ""); } // Invalid Argument @@ -2924,7 +2924,7 @@ int NetAdhocctl_CreateEnterGameMode(const char* group_name, int game_type, int n SceNetEtherAddr* addrs = PSPPointer::Create(membersAddr); // List of participating MAC addresses (started from host) for (int i = 0; i < num_members; i++) { requiredGameModeMacs.push_back(*addrs); - DEBUG_LOG(SCENET, "GameMode macAddress#%d=%s", i, mac2str(addrs).c_str()); + DEBUG_LOG(Log::sceNet, "GameMode macAddress#%d=%s", i, mac2str(addrs).c_str()); addrs++; } // Add local MAC (Host) first @@ -2964,9 +2964,9 @@ static int sceNetAdhocctlCreateEnterGameMode(const char * group_name, int game_t char grpName[ADHOCCTL_GROUPNAME_LEN + 1] = { 0 }; if (group_name) memcpy(grpName, group_name, ADHOCCTL_GROUPNAME_LEN); // For logging purpose, must not be truncated - WARN_LOG_REPORT_ONCE(sceNetAdhocctlCreateEnterGameMode, SCENET, "UNTESTED sceNetAdhocctlCreateEnterGameMode(%s, %i, %i, %08x, %i, %i) at %08x", grpName, game_type, num_members, membersAddr, timeout, flag, currentMIPS->pc); + WARN_LOG_REPORT_ONCE(sceNetAdhocctlCreateEnterGameMode, Log::sceNet, "UNTESTED sceNetAdhocctlCreateEnterGameMode(%s, %i, %i, %08x, %i, %i) at %08x", grpName, game_type, num_members, membersAddr, timeout, flag, currentMIPS->pc); - return hleLogDebug(SCENET, NetAdhocctl_CreateEnterGameMode(group_name, game_type, num_members, membersAddr, timeout, flag), ""); + return hleLogDebug(Log::sceNet, NetAdhocctl_CreateEnterGameMode(group_name, game_type, num_members, membersAddr, timeout, flag), ""); } /** @@ -2983,13 +2983,13 @@ static int sceNetAdhocctlJoinEnterGameMode(const char * group_name, const char * char grpName[ADHOCCTL_GROUPNAME_LEN + 1] = { 0 }; if (group_name) memcpy(grpName, group_name, ADHOCCTL_GROUPNAME_LEN); // For logging purpose, must not be truncated - WARN_LOG_REPORT_ONCE(sceNetAdhocctlJoinEnterGameMode, SCENET, "UNTESTED sceNetAdhocctlJoinEnterGameMode(%s, %s, %i, %i) at %08x", grpName, mac2str((SceNetEtherAddr*)hostMac).c_str(), timeout, flag, currentMIPS->pc); + WARN_LOG_REPORT_ONCE(sceNetAdhocctlJoinEnterGameMode, Log::sceNet, "UNTESTED sceNetAdhocctlJoinEnterGameMode(%s, %s, %i, %i) at %08x", grpName, mac2str((SceNetEtherAddr*)hostMac).c_str(), timeout, flag, currentMIPS->pc); if (!netAdhocctlInited) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); if (!hostMac) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); deleteAllGMB(); @@ -3007,7 +3007,7 @@ static int sceNetAdhocctlJoinEnterGameMode(const char * group_name, const char * adhocConnectionType = ADHOC_JOIN; netAdhocGameModeEntered = true; netAdhocEnterGameModeTimeout = timeout; - return hleLogDebug(SCENET, NetAdhocctl_Create(group_name), ""); + return hleLogDebug(Log::sceNet, NetAdhocctl_Create(group_name), ""); } /** @@ -3025,9 +3025,9 @@ int sceNetAdhocctlCreateEnterGameModeMin(const char *group_name, int game_type, char grpName[ADHOCCTL_GROUPNAME_LEN + 1] = { 0 }; if (group_name) memcpy(grpName, group_name, ADHOCCTL_GROUPNAME_LEN); // For logging purpose, must not be truncated - WARN_LOG_REPORT_ONCE(sceNetAdhocctlCreateEnterGameModeMin, SCENET, "UNTESTED sceNetAdhocctlCreateEnterGameModeMin(%s, %i, %i, %i, %08x, %d, %i) at %08x", grpName, game_type, min_members, num_members, membersAddr, timeout, flag, currentMIPS->pc); + WARN_LOG_REPORT_ONCE(sceNetAdhocctlCreateEnterGameModeMin, Log::sceNet, "UNTESTED sceNetAdhocctlCreateEnterGameModeMin(%s, %i, %i, %i, %08x, %d, %i) at %08x", grpName, game_type, min_members, num_members, membersAddr, timeout, flag, currentMIPS->pc); // We don't really need the Minimum User Check - return hleLogDebug(SCENET, NetAdhocctl_CreateEnterGameMode(group_name, game_type, num_members, membersAddr, timeout, flag), ""); + return hleLogDebug(Log::sceNet, NetAdhocctl_CreateEnterGameMode(group_name, game_type, num_members, membersAddr, timeout, flag), ""); } int NetAdhoc_Term() { @@ -3053,12 +3053,12 @@ int NetAdhoc_Term() { // Library shutdown netAdhocInited = false; - //return hleLogSuccessInfoI(SCENET, 0); + //return hleLogSuccessInfoI(Log::sceNet, 0); } /*else { // TODO: Reportedly returns SCE_KERNEL_ERROR_LWMUTEX_NOT_FOUND in some cases? // Only seen returning 0 in tests. - return hleLogWarning(SCENET, 0, "already uninitialized"); + return hleLogWarning(Log::sceNet, 0, "already uninitialized"); }*/ return 0; @@ -3069,11 +3069,11 @@ int sceNetAdhocTerm() { int retval = NetAdhoc_Term(); hleEatMicro(adhocDefaultDelay); - return hleLogSuccessInfoI(SCENET, retval); + return hleLogSuccessInfoI(Log::sceNet, retval); } static int sceNetAdhocGetPdpStat(u32 structSize, u32 structAddr) { - VERBOSE_LOG(SCENET, "sceNetAdhocGetPdpStat(%08x, %08x) at %08x", structSize, structAddr, currentMIPS->pc); + VERBOSE_LOG(Log::sceNet, "sceNetAdhocGetPdpStat(%08x, %08x) at %08x", structSize, structAddr, currentMIPS->pc); // Library is initialized if (netAdhocInited) @@ -3091,7 +3091,7 @@ static int sceNetAdhocGetPdpStat(u32 structSize, u32 structAddr) { { // Return Required Size *buflen = sizeof(SceNetAdhocPdpStat) * socketcount; - VERBOSE_LOG(SCENET, "Stat PDP Socket Count: %d", socketcount); + VERBOSE_LOG(Log::sceNet, "Stat PDP Socket Count: %d", socketcount); // Success return 0; @@ -3143,7 +3143,7 @@ static int sceNetAdhocGetPdpStat(u32 structSize, u32 structAddr) { if (i > 0) buf[i - 1].next = structAddr + (i * sizeof(SceNetAdhocPdpStat)); - VERBOSE_LOG(SCENET, "Stat PDP Socket Id: %d (%d), LPort: %d, RecvSbCC: %d", buf[i].id, sock->data.pdp.id, buf[i].lport, buf[i].rcv_sb_cc); + VERBOSE_LOG(Log::sceNet, "Stat PDP Socket Id: %d (%d), LPort: %d, RecvSbCC: %d", buf[i].id, sock->data.pdp.id, buf[i].lport, buf[i].rcv_sb_cc); // Increment Counter i++; @@ -3159,11 +3159,11 @@ static int sceNetAdhocGetPdpStat(u32 structSize, u32 structAddr) { } // Invalid Arguments - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg, at %08x", currentMIPS->pc); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg, at %08x", currentMIPS->pc); } // Library is uninitialized - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized, at %08x", currentMIPS->pc); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized, at %08x", currentMIPS->pc); } @@ -3175,7 +3175,7 @@ static int sceNetAdhocGetPdpStat(u32 structSize, u32 structAddr) { */ static int sceNetAdhocGetPtpStat(u32 structSize, u32 structAddr) { // Spams a lot - VERBOSE_LOG(SCENET,"sceNetAdhocGetPtpStat(%08x, %08x) at %08x",structSize,structAddr,currentMIPS->pc); + VERBOSE_LOG(Log::sceNet,"sceNetAdhocGetPtpStat(%08x, %08x) at %08x",structSize,structAddr,currentMIPS->pc); s32_le *buflen = NULL; if (Memory::IsValidAddress(structSize)) buflen = (s32_le *)Memory::GetPointer(structSize); @@ -3191,7 +3191,7 @@ static int sceNetAdhocGetPtpStat(u32 structSize, u32 structAddr) { if (buflen != NULL && buf == NULL) { // Return Required Size *buflen = sizeof(SceNetAdhocPtpStat) * socketcount; - VERBOSE_LOG(SCENET, "Stat PTP Socket Count: %d", socketcount); + VERBOSE_LOG(Log::sceNet, "Stat PTP Socket Count: %d", socketcount); // Success return 0; @@ -3251,7 +3251,7 @@ static int sceNetAdhocGetPtpStat(u32 structSize, u32 structAddr) { if (i > 0) buf[i - 1].next = structAddr + (i * sizeof(SceNetAdhocPtpStat)); - VERBOSE_LOG(SCENET, "Stat PTP Socket Id: %d (%d), LPort: %d, RecvSbCC: %d, State: %d", buf[i].id, sock->data.ptp.id, buf[i].lport, buf[i].rcv_sb_cc, buf[i].state); + VERBOSE_LOG(Log::sceNet, "Stat PTP Socket Id: %d (%d), LPort: %d, RecvSbCC: %d, State: %d", buf[i].id, sock->data.ptp.id, buf[i].lport, buf[i].rcv_sb_cc, buf[i].state); // Increment Counter i++; @@ -3267,11 +3267,11 @@ static int sceNetAdhocGetPtpStat(u32 structSize, u32 structAddr) { } // Invalid Arguments - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg, at %08x", currentMIPS->pc); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg, at %08x", currentMIPS->pc); } // Library is uninitialized - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized, at %08x", currentMIPS->pc); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized, at %08x", currentMIPS->pc); } @@ -3336,7 +3336,7 @@ int RecreatePtpSocket(int ptpId) { // Bound Socket to local Port if (bind(tcpsocket, (struct sockaddr*)&addr, sizeof(addr)) == SOCKET_ERROR) { - ERROR_LOG(SCENET, "RecreatePtpSocket(%i) - Socket error (%i) when binding port %u", ptpId, errno, ntohs(addr.sin_port)); + ERROR_LOG(Log::sceNet, "RecreatePtpSocket(%i) - Socket error (%i) when binding port %u", ptpId, errno, ntohs(addr.sin_port)); } else { // Update sport with the port assigned internal->lport = ntohs(local.sin_port) @@ -3344,17 +3344,17 @@ int RecreatePtpSocket(int ptpId) { if (getsockname(tcpsocket, (struct sockaddr*)&addr, &len) == 0) { uint16_t boundport = ntohs(addr.sin_port); if (sock->data.ptp.lport + static_cast(portOffset) >= 65536 || static_cast(boundport) - static_cast(portOffset) <= 0) - WARN_LOG(SCENET, "RecreatePtpSocket(%i) - Wrapped Port Detected: Original(%d) -> Requested(%d), Bound(%d) -> BoundOriginal(%d)", ptpId, sock->data.ptp.lport, requestedport, boundport, boundport - portOffset); + WARN_LOG(Log::sceNet, "RecreatePtpSocket(%i) - Wrapped Port Detected: Original(%d) -> Requested(%d), Bound(%d) -> BoundOriginal(%d)", ptpId, sock->data.ptp.lport, requestedport, boundport, boundport - portOffset); u16 newlport = boundport - portOffset; if (newlport != sock->data.ptp.lport) { - WARN_LOG(SCENET, "RecreatePtpSocket(%i) - Old and New LPort is different! The port may need to be reforwarded", ptpId); + WARN_LOG(Log::sceNet, "RecreatePtpSocket(%i) - Old and New LPort is different! The port may need to be reforwarded", ptpId); if (!sock->isClient) UPnP_Add(IP_PROTOCOL_TCP, isOriPort ? newlport : newlport + portOffset, newlport + portOffset); } sock->data.ptp.lport = newlport; } else { - WARN_LOG(SCENET, "RecreatePtpSocket(%i): getsockname error %i", ptpId, errno); + WARN_LOG(Log::sceNet, "RecreatePtpSocket(%i): getsockname error %i", ptpId, errno); } } @@ -3377,7 +3377,7 @@ int RecreatePtpSocket(int ptpId) { * @return Socket ID > 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_ADDR, ADHOC_INVALID_PORT */ static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, int dport, int bufsize, int rexmt_int, int rexmt_cnt, int flag) { - INFO_LOG(SCENET, "sceNetAdhocPtpOpen(%s, %d, %s, %d, %d, %d, %d, %d) at %08x", mac2str((SceNetEtherAddr*)srcmac).c_str(), sport, mac2str((SceNetEtherAddr*)dstmac).c_str(),dport,bufsize, rexmt_int, rexmt_cnt, flag, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocPtpOpen(%s, %d, %s, %d, %d, %d, %d, %d) at %08x", mac2str((SceNetEtherAddr*)srcmac).c_str(), sport, mac2str((SceNetEtherAddr*)dstmac).c_str(),dport,bufsize, rexmt_int, rexmt_cnt, flag, currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; } @@ -3395,7 +3395,7 @@ static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, // Dissidia 012 will try to reOpen the port without Closing the old one first when PtpConnect failed to try again. if (isPTPPortInUse(sport, false, daddr, dport)) { // FIXME: When PORT_IN_USE error occured it seems the index to the socket id also increased, which means it tries to create & bind the socket first and then closes it due to failed to bind - return hleLogDebug(SCENET, ERROR_NET_ADHOC_PORT_IN_USE, "port in use"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_PORT_IN_USE, "port in use"); } // Random Port required @@ -3448,7 +3448,7 @@ static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, requestedport = 65535; // Hopefully it will be safe to default it to 65535 since there can't be more than one port that can bumped into 65536 // Show a warning about privileged ports if (requestedport != 0 && requestedport < 1024) { - WARN_LOG(SCENET, "sceNetAdhocPtpOpen - Ports below 1024(ie. %hu) may require Admin Privileges", requestedport); + WARN_LOG(Log::sceNet, "sceNetAdhocPtpOpen - Ports below 1024(ie. %hu) may require Admin Privileges", requestedport); } addr.sin_port = htons(requestedport); @@ -3459,7 +3459,7 @@ static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, if (getsockname(tcpsocket, (struct sockaddr*)&addr, &len) == 0) { uint16_t boundport = ntohs(addr.sin_port); if (sport + static_cast(portOffset) >= 65536 || static_cast(boundport) - static_cast(portOffset) <= 0) - WARN_LOG(SCENET, "sceNetAdhocPtpOpen - Wrapped Port Detected: Original(%d) -> Requested(%d), Bound(%d) -> BoundOriginal(%d)", sport, requestedport, boundport, boundport - portOffset); + WARN_LOG(Log::sceNet, "sceNetAdhocPtpOpen - Wrapped Port Detected: Original(%d) -> Requested(%d), Bound(%d) -> BoundOriginal(%d)", sport, requestedport, boundport, boundport - portOffset); sport = boundport - portOffset; } @@ -3515,7 +3515,7 @@ static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, hleDelayResult(i + 1, "delayed ptpopen", rexmt_int); // Return PTP Socket id - INFO_LOG(SCENET, "sceNetAdhocPtpOpen - PSP Socket id: %i, Host Socket id: %i", i + 1, tcpsocket); + INFO_LOG(Log::sceNet, "sceNetAdhocPtpOpen - PSP Socket id: %i, Host Socket id: %i", i + 1, tcpsocket); return i + 1; } @@ -3524,7 +3524,7 @@ static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, } } else { - ERROR_LOG(SCENET, "Socket error (%i) when binding port %u", errno, ntohs(addr.sin_port)); + ERROR_LOG(Log::sceNet, "Socket error (%i) when binding port %u", errno, ntohs(addr.sin_port)); auto n = GetI18NCategory(I18NCat::NETWORKING); g_OSD.Show(OSDType::MESSAGE_ERROR, std::string(n->T("Failed to Bind Port")) + " " + std::to_string(sport + portOffset) + "\n" + std::string(n->T("Please change your Port Offset"))); } @@ -3533,20 +3533,20 @@ static int sceNetAdhocPtpOpen(const char *srcmac, int sport, const char *dstmac, closesocket(tcpsocket); // Port not available (exclusively in use?) - return hleLogDebug(SCENET, ERROR_NET_ADHOC_PORT_NOT_AVAIL, "port not available"); // ERROR_NET_ADHOC_PORT_IN_USE; // ERROR_NET_ADHOC_INVALID_PORT; + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_PORT_NOT_AVAIL, "port not available"); // ERROR_NET_ADHOC_PORT_IN_USE; // ERROR_NET_ADHOC_INVALID_PORT; } } // Invalid Arguments - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); } // Invalid Addresses - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_ADDR, "invalid address"); // ERROR_NET_ADHOC_INVALID_ARG; + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_ADDR, "invalid address"); // ERROR_NET_ADHOC_INVALID_ARG; } // Library is uninitialized - return hleLogDebug(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "adhoc not initialized"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "adhoc not initialized"); } // On a POSIX accept, returned socket may inherits properties from the listening socket, does PtpAccept also have similar behavior? @@ -3641,7 +3641,7 @@ int AcceptPtpSocket(int ptpId, int newsocket, sockaddr_in& peeraddr, SceNetEther // Switch to non-blocking for futher usage changeBlockingMode(newsocket, 1); - INFO_LOG(SCENET, "sceNetAdhocPtpAccept[%i->%i(%i):%u]: Established (%s:%u) - state: %d", ptpId, i + 1, newsocket, internal->data.ptp.lport, ip2str(peeraddr.sin_addr).c_str(), internal->data.ptp.pport, internal->data.ptp.state); + INFO_LOG(Log::sceNet, "sceNetAdhocPtpAccept[%i->%i(%i):%u]: Established (%s:%u) - state: %d", ptpId, i + 1, newsocket, internal->data.ptp.lport, ip2str(peeraddr.sin_addr).c_str(), internal->data.ptp.pport, internal->data.ptp.state); // Return Socket return i + 1; @@ -3656,7 +3656,7 @@ int AcceptPtpSocket(int ptpId, int newsocket, sockaddr_in& peeraddr, SceNetEther // Close Socket closesocket(newsocket); - ERROR_LOG(SCENET, "sceNetAdhocPtpAccept[%i]: Failed (Socket Closed)", ptpId); + ERROR_LOG(Log::sceNet, "sceNetAdhocPtpAccept[%i]: Failed (Socket Closed)", ptpId); return -1; } @@ -3680,9 +3680,9 @@ static int sceNetAdhocPtpAccept(int id, u32 peerMacAddrPtr, u32 peerPortPtr, int port = (uint16_t *)Memory::GetPointer(peerPortPtr); } if (flag == 0) { // Prevent spamming Debug Log with retries of non-bocking socket - DEBUG_LOG(SCENET, "sceNetAdhocPtpAccept(%d, [%08x]=%s, [%08x]=%u, %d, %u) at %08x", id, peerMacAddrPtr, mac2str(addr).c_str(), peerPortPtr, port ? *port : -1, timeout, flag, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpAccept(%d, [%08x]=%s, [%08x]=%u, %d, %u) at %08x", id, peerMacAddrPtr, mac2str(addr).c_str(), peerPortPtr, port ? *port : -1, timeout, flag, currentMIPS->pc); } else { - VERBOSE_LOG(SCENET, "sceNetAdhocPtpAccept(%d, [%08x]=%s, [%08x]=%u, %d, %u) at %08x", id, peerMacAddrPtr, mac2str(addr).c_str(), peerPortPtr, port ? *port : -1, timeout, flag, currentMIPS->pc); + VERBOSE_LOG(Log::sceNet, "sceNetAdhocPtpAccept(%d, [%08x]=%s, [%08x]=%u, %d, %u) at %08x", id, peerMacAddrPtr, mac2str(addr).c_str(), peerPortPtr, port ? *port : -1, timeout, flag, currentMIPS->pc); } if (!g_Config.bEnableWlan) { return -1; @@ -3702,7 +3702,7 @@ static int sceNetAdhocPtpAccept(int id, u32 peerMacAddrPtr, u32 peerPortPtr, int if (socket->flags & ADHOC_F_ALERTACCEPT) { socket->alerted_flags |= ADHOC_F_ALERTACCEPT; - return hleLogError(SCENET, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); } // Listener Socket @@ -3730,7 +3730,7 @@ static int sceNetAdhocPtpAccept(int id, u32 peerMacAddrPtr, u32 peerPortPtr, int } // Prevent spamming Debug Log with retries of non-bocking socket else { - VERBOSE_LOG(SCENET, "sceNetAdhocPtpAccept[%i]: Socket Error (%i)", id, error); + VERBOSE_LOG(Log::sceNet, "sceNetAdhocPtpAccept[%i]: Socket Error (%i)", id, error); } } @@ -3743,26 +3743,26 @@ static int sceNetAdhocPtpAccept(int id, u32 peerMacAddrPtr, u32 peerPortPtr, int // Action would block if (flag) - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); // Timeout - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_TIMEOUT, "timeout"); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_TIMEOUT, "timeout"); } // Client Socket - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_NOT_LISTENED, "not listened"); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_NOT_LISTENED, "not listened"); } // Invalid Socket - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); } // Invalid Arguments - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); } // Library is uninitialized - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); } int NetAdhocPtp_Connect(int id, int timeout, int flag, bool allowForcedConnect) { @@ -3779,7 +3779,7 @@ int NetAdhocPtp_Connect(int id, int timeout, int flag, bool allowForcedConnect) if (socket->flags & ADHOC_F_ALERTCONNECT) { socket->alerted_flags |= ADHOC_F_ALERTCONNECT; - return hleLogError(SCENET, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); } // Phantasy Star Portable 2 will try to reconnect even when previous connect already success, so we should return success too if it's already connected @@ -3813,9 +3813,9 @@ int NetAdhocPtp_Connect(int id, int timeout, int flag, bool allowForcedConnect) if (connectresult == SOCKET_ERROR) { if (errorcode == EAGAIN || errorcode == EWOULDBLOCK || errorcode == EALREADY || errorcode == EISCONN) - DEBUG_LOG(SCENET, "sceNetAdhocPtpConnect[%i]: Socket Error (%i) to %s:%u", id, errorcode, ip2str(sin.sin_addr).c_str(), ptpsocket.pport); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i]: Socket Error (%i) to %s:%u", id, errorcode, ip2str(sin.sin_addr).c_str(), ptpsocket.pport); else - ERROR_LOG(SCENET, "sceNetAdhocPtpConnect[%i]: Socket Error (%i) to %s:%u", id, errorcode, ip2str(sin.sin_addr).c_str(), ptpsocket.pport); + ERROR_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i]: Socket Error (%i) to %s:%u", id, errorcode, ip2str(sin.sin_addr).c_str(), ptpsocket.pport); } // Instant Connection (Lucky!) @@ -3826,7 +3826,7 @@ int NetAdhocPtp_Connect(int id, int timeout, int flag, bool allowForcedConnect) // Set Connected State ptpsocket.state = ADHOC_PTP_STATE_ESTABLISHED; - INFO_LOG(SCENET, "sceNetAdhocPtpConnect[%i:%u]: Already Connected to %s:%u", id, ptpsocket.lport, ip2str(sin.sin_addr).c_str(), ptpsocket.pport); + INFO_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i:%u]: Already Connected to %s:%u", id, ptpsocket.lport, ip2str(sin.sin_addr).c_str(), ptpsocket.pport); // Success return 0; } @@ -3842,9 +3842,9 @@ int NetAdhocPtp_Connect(int id, int timeout, int flag, bool allowForcedConnect) } // On Windows you can call connect again using the same socket after ECONNREFUSED/ETIMEDOUT/ENETUNREACH error, but on non-Windows you'll need to recreate the socket first else { - DEBUG_LOG(SCENET, "sceNetAdhocPtpConnect[%i:%u]: Recreating Socket %i, errno = %i, state = %i, attempt = %i", id, ptpsocket.lport, ptpsocket.id, errorcode, ptpsocket.state, socket->attemptCount); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i:%u]: Recreating Socket %i, errno = %i, state = %i, attempt = %i", id, ptpsocket.lport, ptpsocket.id, errorcode, ptpsocket.state, socket->attemptCount); if (RecreatePtpSocket(id) < 0) { - WARN_LOG(SCENET, "sceNetAdhocPtpConnect[%i:%u]: Failed to Recreate Socket", id, ptpsocket.lport); + WARN_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i:%u]: Failed to Recreate Socket", id, ptpsocket.lport); } ptpsocket.state = ADHOC_PTP_STATE_CLOSED; } @@ -3857,8 +3857,8 @@ int NetAdhocPtp_Connect(int id, int timeout, int flag, bool allowForcedConnect) // Simulate blocking behaviour with non-blocking socket u64 threadSocketId = ((u64)__KernelGetCurThread()) << 32 | ptpsocket.id; if (sendTargetPeers.find(threadSocketId) != sendTargetPeers.end()) { - DEBUG_LOG(SCENET, "sceNetAdhocPtpConnect[%i:%u]: Socket(%d) is Busy!", id, ptpsocket.lport, ptpsocket.id); - return hleLogError(SCENET, ERROR_NET_ADHOC_BUSY, "busy?"); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpConnect[%i:%u]: Socket(%d) is Busy!", id, ptpsocket.lport, ptpsocket.id); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_BUSY, "busy?"); } AdhocSendTargets dest = { 0, {}, false }; @@ -3869,26 +3869,26 @@ int NetAdhocPtp_Connect(int id, int timeout, int flag, bool allowForcedConnect) // NonBlocking Mode else { // Returning WOULD_BLOCK as Workaround for ERROR_NET_ADHOC_CONNECTION_REFUSED to be more cross-platform, since there is no way to simulate ERROR_NET_ADHOC_CONNECTION_REFUSED properly on Windows - return hleLogDebug(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); } } } } // Peer not found - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_ADDR, "invalid address"); // ERROR_NET_ADHOC_WOULD_BLOCK / ERROR_NET_ADHOC_TIMEOUT + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_ADDR, "invalid address"); // ERROR_NET_ADHOC_WOULD_BLOCK / ERROR_NET_ADHOC_TIMEOUT } // Not a valid Client Socket - return hleLogDebug(SCENET, ERROR_NET_ADHOC_NOT_OPENED, "not opened"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_NOT_OPENED, "not opened"); } // Invalid Socket - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); } // Library is uninitialized - return hleLogDebug(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); } /** @@ -3899,7 +3899,7 @@ int NetAdhocPtp_Connect(int id, int timeout, int flag, bool allowForcedConnect) * @return 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_CONNECTION_REFUSED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_NOT_OPENED, ADHOC_THREAD_ABORTED, NET_INTERNAL */ static int sceNetAdhocPtpConnect(int id, int timeout, int flag) { - INFO_LOG(SCENET, "sceNetAdhocPtpConnect(%i, %i, %i) at %08x", id, timeout, flag, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocPtpConnect(%i, %i, %i) at %08x", id, timeout, flag, currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; } @@ -3957,7 +3957,7 @@ int NetAdhocPtp_Close(int id, int unknown) { * @return 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED */ static int sceNetAdhocPtpClose(int id, int unknown) { - INFO_LOG(SCENET,"sceNetAdhocPtpClose(%d,%d) at %08x",id,unknown,currentMIPS->pc); + INFO_LOG(Log::sceNet,"sceNetAdhocPtpClose(%d,%d) at %08x",id,unknown,currentMIPS->pc); /*if (!g_Config.bEnableWlan) { return 0; }*/ @@ -3978,7 +3978,7 @@ static int sceNetAdhocPtpClose(int id, int unknown) { * @return Socket ID > 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_ADDR, ADHOC_INVALID_PORT, ADHOC_SOCKET_ID_NOT_AVAIL, ADHOC_PORT_NOT_AVAIL, ADHOC_PORT_IN_USE, NET_NO_SPACE */ static int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int rexmt_int, int rexmt_cnt, int backlog, int flag) { - INFO_LOG(SCENET, "sceNetAdhocPtpListen(%s, %d, %d, %d, %d, %d, %d) at %08x", mac2str((SceNetEtherAddr*)srcmac).c_str(), sport,bufsize,rexmt_int,rexmt_cnt,backlog,flag, currentMIPS->pc); + INFO_LOG(Log::sceNet, "sceNetAdhocPtpListen(%s, %d, %d, %d, %d, %d, %d) at %08x", mac2str((SceNetEtherAddr*)srcmac).c_str(), sport,bufsize,rexmt_int,rexmt_cnt,backlog,flag, currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; } @@ -3995,7 +3995,7 @@ static int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int // It's allowed to Listen and Open the same PTP port, But it's not allowed to Listen or Open the same PTP port twice. if (isPTPPortInUse(sport, true)) { // FIXME: When PORT_IN_USE error occured it seems the index to the socket id also increased, which means it tries to create & bind the socket first and then closes it due to failed to bind - return hleLogDebug(SCENET, ERROR_NET_ADHOC_PORT_IN_USE, "port in use"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_PORT_IN_USE, "port in use"); } // Random Port required @@ -4048,7 +4048,7 @@ static int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int requestedport = 65535; // Hopefully it will be safe to default it to 65535 since there can't be more than one port that can bumped into 65536 // Show a warning about privileged ports if (requestedport != 0 && requestedport < 1024) { - WARN_LOG(SCENET, "sceNetAdhocPtpListen - Ports below 1024(ie. %hu) may require Admin Privileges", requestedport); + WARN_LOG(Log::sceNet, "sceNetAdhocPtpListen - Ports below 1024(ie. %hu) may require Admin Privileges", requestedport); } addr.sin_port = htons(requestedport); @@ -4060,7 +4060,7 @@ static int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int if (getsockname(tcpsocket, (struct sockaddr*)&addr, &len) == 0) { uint16_t boundport = ntohs(addr.sin_port); if (sport + static_cast(portOffset) >= 65536 || static_cast(boundport) - static_cast(portOffset) <= 0) - WARN_LOG(SCENET, "sceNetAdhocPtpListen - Wrapped Port Detected: Original(%d) -> Requested(%d), Bound(%d) -> BoundOriginal(%d)", sport, requestedport, boundport, boundport - portOffset); + WARN_LOG(Log::sceNet, "sceNetAdhocPtpListen - Wrapped Port Detected: Original(%d) -> Requested(%d), Bound(%d) -> BoundOriginal(%d)", sport, requestedport, boundport, boundport - portOffset); sport = boundport - portOffset; } // Switch into Listening Mode @@ -4109,7 +4109,7 @@ static int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int changeBlockingMode(tcpsocket, 1); // Return PTP Socket id - INFO_LOG(SCENET, "sceNetAdhocPtpListen - PSP Socket id: %i, Host Socket id: %i", i + 1, tcpsocket); + INFO_LOG(Log::sceNet, "sceNetAdhocPtpListen - PSP Socket id: %i, Host Socket id: %i", i + 1, tcpsocket); return i + 1; } @@ -4125,30 +4125,30 @@ static int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int if (iResult == SOCKET_ERROR) { int error = errno; - ERROR_LOG(SCENET, "sceNetAdhocPtpListen[%i]: Socket Error (%i)", sport, error); + ERROR_LOG(Log::sceNet, "sceNetAdhocPtpListen[%i]: Socket Error (%i)", sport, error); } // Close Socket closesocket(tcpsocket); // Port not available (exclusively in use?) - return hleLogDebug(SCENET, ERROR_NET_ADHOC_PORT_NOT_AVAIL, "port not available"); //ERROR_NET_ADHOC_PORT_IN_USE; // ERROR_NET_ADHOC_INVALID_PORT; + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_PORT_NOT_AVAIL, "port not available"); //ERROR_NET_ADHOC_PORT_IN_USE; // ERROR_NET_ADHOC_INVALID_PORT; } // Socket not available - return hleLogDebug(SCENET, ERROR_NET_ADHOC_SOCKET_ID_NOT_AVAIL, "socket id not available"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_SOCKET_ID_NOT_AVAIL, "socket id not available"); } // Invalid Arguments - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); } // Invalid Addresses - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_ADDR, "invalid address"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_ADDR, "invalid address"); } // Library is uninitialized - return hleLogDebug(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "adhoc not initialized"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "adhoc not initialized"); } /** @@ -4161,7 +4161,7 @@ static int sceNetAdhocPtpListen(const char *srcmac, int sport, int bufsize, int * @return 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_NOT_CONNECTED, ADHOC_THREAD_ABORTED, ADHOC_INVALID_DATALEN, ADHOC_DISCONNECTED, NET_INTERNAL, NET_NO_SPACE */ static int sceNetAdhocPtpSend(int id, u32 dataAddr, u32 dataSizeAddr, int timeout, int flag) { - DEBUG_LOG(SCENET, "sceNetAdhocPtpSend(%d,%08x,%08x,%d,%d) at %08x", id, dataAddr, dataSizeAddr, timeout, flag, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpSend(%d,%08x,%08x,%d,%d) at %08x", id, dataAddr, dataSizeAddr, timeout, flag, currentMIPS->pc); int * len = (int *)Memory::GetPointer(dataSizeAddr); const char * data = Memory::GetCharPointer(dataAddr); @@ -4188,7 +4188,7 @@ static int sceNetAdhocPtpSend(int id, u32 dataAddr, u32 dataSizeAddr, int timeou if (socket->flags & ADHOC_F_ALERTSEND) { socket->alerted_flags |= ADHOC_F_ALERTSEND; - return hleLogError(SCENET, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); } // Acquire Network Lock @@ -4207,7 +4207,7 @@ static int sceNetAdhocPtpSend(int id, u32 dataAddr, u32 dataSizeAddr, int timeou // Save Length *len = sent; - DEBUG_LOG(SCENET, "sceNetAdhocPtpSend[%i:%u]: Sent %u bytes to %s:%u\n", id, ptpsocket.lport, sent, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpSend[%i:%u]: Sent %u bytes to %s:%u\n", id, ptpsocket.lport, sent, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport); // Set to Established on successful Send when an attempt to Connect was initiated if (ptpsocket.state == ADHOC_PTP_STATE_SYN_SENT) @@ -4221,36 +4221,36 @@ static int sceNetAdhocPtpSend(int id, u32 dataAddr, u32 dataSizeAddr, int timeou else if (sent == SOCKET_ERROR && (error == EAGAIN || error == EWOULDBLOCK || (ptpsocket.state == ADHOC_PTP_STATE_SYN_SENT && (error == ENOTCONN || connectInProgress(error))))) { // Non-Blocking if (flag) - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); // Simulate blocking behaviour with non-blocking socket u64 threadSocketId = ((u64)__KernelGetCurThread()) << 32 | ptpsocket.id; return WaitBlockingAdhocSocket(threadSocketId, PTP_SEND, id, (void*)data, len, timeout, nullptr, nullptr, "ptp send"); } - DEBUG_LOG(SCENET, "sceNetAdhocPtpSend[%i:%u -> %s:%u]: Result:%i (Error:%i)", id, ptpsocket.lport, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport, sent, error); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpSend[%i:%u -> %s:%u]: Result:%i (Error:%i)", id, ptpsocket.lport, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport, sent, error); // Change Socket State ptpsocket.state = ADHOC_PTP_STATE_CLOSED; // Disconnected - return hleLogError(SCENET, ERROR_NET_ADHOC_DISCONNECTED, "disconnected"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_DISCONNECTED, "disconnected"); } // Invalid Arguments - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); } // Not Connected - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_CONNECTED, "not connected"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_CONNECTED, "not connected"); } // Invalid Socket - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); } // Library is uninitialized - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); } /** @@ -4263,7 +4263,7 @@ static int sceNetAdhocPtpSend(int id, u32 dataAddr, u32 dataSizeAddr, int timeou * @return 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_THREAD_ABORTED, ADHOC_DISCONNECTED, NET_INTERNAL */ static int sceNetAdhocPtpRecv(int id, u32 dataAddr, u32 dataSizeAddr, int timeout, int flag) { - DEBUG_LOG(SCENET, "sceNetAdhocPtpRecv(%d,%08x,%08x,%d,%d) at %08x", id, dataAddr, dataSizeAddr, timeout, flag, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpRecv(%d,%08x,%08x,%d,%d) at %08x", id, dataAddr, dataSizeAddr, timeout, flag, currentMIPS->pc); void * buf = (void *)Memory::GetPointer(dataAddr); int * len = (int *)Memory::GetPointer(dataSizeAddr); @@ -4289,7 +4289,7 @@ static int sceNetAdhocPtpRecv(int id, u32 dataAddr, u32 dataSizeAddr, int timeou if (socket->flags & ADHOC_F_ALERTRECV) { socket->alerted_flags |= ADHOC_F_ALERTRECV; - return hleLogError(SCENET, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); } // Acquire Network Lock @@ -4310,7 +4310,7 @@ static int sceNetAdhocPtpRecv(int id, u32 dataAddr, u32 dataSizeAddr, int timeou return WaitBlockingAdhocSocket(threadSocketId, PTP_RECV, id, buf, len, timeout, nullptr, nullptr, "ptp recv"); } - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); } // Free Network Lock @@ -4329,7 +4329,7 @@ static int sceNetAdhocPtpRecv(int id, u32 dataAddr, u32 dataSizeAddr, int timeou if (peer != NULL) peer->last_recv = CoreTiming::GetGlobalTimeUsScaled(); peerlock.unlock(); - DEBUG_LOG(SCENET, "sceNetAdhocPtpRecv[%i:%u]: Received %u bytes from %s:%u\n", id, ptpsocket.lport, received, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpRecv[%i:%u]: Received %u bytes from %s:%u\n", id, ptpsocket.lport, received, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport); // Set to Established on successful Recv when an attempt to Connect was initiated if (ptpsocket.state == ADHOC_PTP_STATE_SYN_SENT) @@ -4339,7 +4339,7 @@ static int sceNetAdhocPtpRecv(int id, u32 dataAddr, u32 dataSizeAddr, int timeou return 0; } - DEBUG_LOG(SCENET, "sceNetAdhocPtpRecv[%i:%u]: Result:%i (Error:%i)", id, ptpsocket.lport, received, error); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpRecv[%i:%u]: Result:%i (Error:%i)", id, ptpsocket.lport, received, error); if (*len == 0) return 0; @@ -4348,23 +4348,23 @@ static int sceNetAdhocPtpRecv(int id, u32 dataAddr, u32 dataSizeAddr, int timeou ptpsocket.state = ADHOC_PTP_STATE_CLOSED; // Disconnected - return hleLogError(SCENET, ERROR_NET_ADHOC_DISCONNECTED, "disconnected"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_DISCONNECTED, "disconnected"); } // Not Connected - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_CONNECTED, "not connected"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_CONNECTED, "not connected"); } // Invalid Socket - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); } // Invalid Arguments - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid socket arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid socket arg"); } // Library is uninitialized - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); } int FlushPtpSocket(int socketId) { @@ -4394,7 +4394,7 @@ int FlushPtpSocket(int socketId) { * @return 0 on success or... ADHOC_NOT_INITIALIZED, ADHOC_INVALID_ARG, ADHOC_INVALID_SOCKET_ID, ADHOC_SOCKET_DELETED, ADHOC_SOCKET_ALERTED, ADHOC_WOULD_BLOCK, ADHOC_TIMEOUT, ADHOC_THREAD_ABORTED, ADHOC_DISCONNECTED, ADHOC_NOT_CONNECTED, NET_INTERNAL */ static int sceNetAdhocPtpFlush(int id, int timeout, int nonblock) { - DEBUG_LOG(SCENET,"sceNetAdhocPtpFlush(%d,%d,%d) at %08x", id, timeout, nonblock, currentMIPS->pc); + DEBUG_LOG(Log::sceNet,"sceNetAdhocPtpFlush(%d,%d,%d) at %08x", id, timeout, nonblock, currentMIPS->pc); // Library initialized if (netAdhocInited) { @@ -4408,7 +4408,7 @@ static int sceNetAdhocPtpFlush(int id, int timeout, int nonblock) { if (socket->flags & ADHOC_F_ALERTFLUSH) { socket->alerted_flags |= ADHOC_F_ALERTFLUSH; - return hleLogError(SCENET, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_SOCKET_ALERTED, "socket alerted"); } // Connected Socket @@ -4423,7 +4423,7 @@ static int sceNetAdhocPtpFlush(int id, int timeout, int nonblock) { if (error == EAGAIN || error == EWOULDBLOCK) { // Non-Blocking if (nonblock) - return hleLogSuccessVerboseX(SCENET, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); + return hleLogSuccessVerboseX(Log::sceNet, ERROR_NET_ADHOC_WOULD_BLOCK, "would block"); // Simulate blocking behaviour with non-blocking socket u64 threadSocketId = ((u64)__KernelGetCurThread()) << 32 | ptpsocket.id; @@ -4431,7 +4431,7 @@ static int sceNetAdhocPtpFlush(int id, int timeout, int nonblock) { } if (error != 0) - DEBUG_LOG(SCENET, "sceNetAdhocPtpFlush[%i:%u -> %s:%u]: Error:%i", id, ptpsocket.lport, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport, error); + DEBUG_LOG(Log::sceNet, "sceNetAdhocPtpFlush[%i:%u -> %s:%u]: Error:%i", id, ptpsocket.lport, mac2str(&ptpsocket.paddr).c_str(), ptpsocket.pport, error); } // Dummy Result, Always success? @@ -4439,10 +4439,10 @@ static int sceNetAdhocPtpFlush(int id, int timeout, int nonblock) { } // Invalid Socket - return hleLogError(SCENET, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); } // Library uninitialized - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_INITIALIZED, "not initialized"); } /** @@ -4454,21 +4454,21 @@ static int sceNetAdhocPtpFlush(int id, int timeout, int nonblock) { * @return 0 on success, < 0 on error. */ static int sceNetAdhocGameModeCreateMaster(u32 dataAddr, int size) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocGameModeCreateMaster(%08x, %i) at %08x", dataAddr, size, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocGameModeCreateMaster(%08x, %i) at %08x", dataAddr, size, currentMIPS->pc); if (!netAdhocctlInited) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); if (adhocctlCurrentMode != ADHOCCTL_MODE_GAMEMODE) - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_IN_GAMEMODE, "not in gamemode"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_IN_GAMEMODE, "not in gamemode"); if (!netAdhocGameModeEntered) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_ENTER_GAMEMODE, "not enter gamemode"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_ENTER_GAMEMODE, "not enter gamemode"); if (size < 0 || !Memory::IsValidAddress(dataAddr)) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); if (masterGameModeArea.data) - return hleLogError(SCENET, ERROR_NET_ADHOC_ALREADY_CREATED, "already created"); // FIXME: Should we return a success instead? (need to test this on a homebrew) + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_ALREADY_CREATED, "already created"); // FIXME: Should we return a success instead? (need to test this on a homebrew) hleEatMicro(1000); SceNetEtherAddr localMac; @@ -4488,13 +4488,13 @@ static int sceNetAdhocGameModeCreateMaster(u32 dataAddr, int size) { if (replicaGameModeAreas.size() == (gameModeMacs.size() - 1)) { if (CoreTiming::IsScheduled(gameModeNotifyEvent)) { __KernelWaitCurThread(WAITTYPE_NET, GAMEMODE_WAITID, 0, 0, false, "syncing master data"); - DEBUG_LOG(SCENET, "GameMode: Blocking Thread %d to Sync initial Master data", __KernelGetCurThread()); + DEBUG_LOG(Log::sceNet, "GameMode: Blocking Thread %d to Sync initial Master data", __KernelGetCurThread()); } } - return hleLogDebug(SCENET, 0, "success"); // returned an id just like CreateReplica? always return 0? + return hleLogDebug(Log::sceNet, 0, "success"); // returned an id just like CreateReplica? always return 0? } - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_CREATED, "not created"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_CREATED, "not created"); } /** @@ -4507,18 +4507,18 @@ static int sceNetAdhocGameModeCreateMaster(u32 dataAddr, int size) { * @return The id of the replica on success, < 0 on error. */ static int sceNetAdhocGameModeCreateReplica(const char *mac, u32 dataAddr, int size) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocGameModeCreateReplica(%s, %08x, %i) at %08x", mac2str((SceNetEtherAddr*)mac).c_str(), dataAddr, size, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocGameModeCreateReplica(%s, %08x, %i) at %08x", mac2str((SceNetEtherAddr*)mac).c_str(), dataAddr, size, currentMIPS->pc); if (!netAdhocctlInited) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); if (adhocctlCurrentMode != ADHOCCTL_MODE_GAMEMODE) - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_IN_GAMEMODE, "not in gamemode"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_IN_GAMEMODE, "not in gamemode"); if (!netAdhocGameModeEntered) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_ENTER_GAMEMODE, "not enter gamemode"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_ENTER_GAMEMODE, "not enter gamemode"); if (mac == nullptr || size < 0 || !Memory::IsValidAddress(dataAddr)) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); hleEatMicro(1000); int maxid = 0; @@ -4529,7 +4529,7 @@ static int sceNetAdhocGameModeCreateReplica(const char *mac, u32 dataAddr, int s }); // MAC address already existed! if (it != replicaGameModeAreas.end()) { - WARN_LOG(SCENET, "sceNetAdhocGameModeCreateReplica - [%s] is already existed (id: %d)", mac2str((SceNetEtherAddr*)mac).c_str(), it->id); + WARN_LOG(Log::sceNet, "sceNetAdhocGameModeCreateReplica - [%s] is already existed (id: %d)", mac2str((SceNetEtherAddr*)mac).c_str(), it->id); return it->id; // ERROR_NET_ADHOC_ALREADY_CREATED } @@ -4551,25 +4551,25 @@ static int sceNetAdhocGameModeCreateReplica(const char *mac, u32 dataAddr, int s if (masterGameModeArea.data != NULL && replicaGameModeAreas.size() == (gameModeMacs.size() - 1)) { if (CoreTiming::IsScheduled(gameModeNotifyEvent)) { __KernelWaitCurThread(WAITTYPE_NET, GAMEMODE_WAITID, ret, 0, false, "syncing master data"); - DEBUG_LOG(SCENET, "GameMode: Blocking Thread %d to Sync initial Master data", __KernelGetCurThread()); + DEBUG_LOG(Log::sceNet, "GameMode: Blocking Thread %d to Sync initial Master data", __KernelGetCurThread()); } } - return hleLogSuccessInfoI(SCENET, ret, "success"); + return hleLogSuccessInfoI(Log::sceNet, ret, "success"); } - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_CREATED, "not created"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_CREATED, "not created"); } static int sceNetAdhocGameModeUpdateMaster() { - DEBUG_LOG(SCENET, "UNTESTED sceNetAdhocGameModeUpdateMaster() at %08x", currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "UNTESTED sceNetAdhocGameModeUpdateMaster() at %08x", currentMIPS->pc); if (!netAdhocctlInited) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); if (adhocctlCurrentMode != ADHOCCTL_MODE_GAMEMODE) - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_IN_GAMEMODE, "not in gamemode"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_IN_GAMEMODE, "not in gamemode"); if (!netAdhocGameModeEntered) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_ENTER_GAMEMODE, "not enter gamemode"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_ENTER_GAMEMODE, "not enter gamemode"); if (masterGameModeArea.data) { Memory::Memcpy(masterGameModeArea.data, masterGameModeArea.addr, masterGameModeArea.size); @@ -4587,7 +4587,7 @@ static int sceNetAdhocGameModeUpdateMaster() { int NetAdhocGameMode_DeleteMaster() { if (CoreTiming::IsScheduled(gameModeNotifyEvent)) { __KernelWaitCurThread(WAITTYPE_NET, GAMEMODE_WAITID, 0, 0, false, "deleting master data"); - DEBUG_LOG(SCENET, "GameMode: Blocking Thread %d to End GameMode Scheduler", __KernelGetCurThread()); + DEBUG_LOG(Log::sceNet, "GameMode: Blocking Thread %d to End GameMode Scheduler", __KernelGetCurThread()); } if (masterGameModeArea.data) { @@ -4607,23 +4607,23 @@ int NetAdhocGameMode_DeleteMaster() { } static int sceNetAdhocGameModeDeleteMaster() { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocGameModeDeleteMaster() at %08x", currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocGameModeDeleteMaster() at %08x", currentMIPS->pc); if (isZeroMAC(&masterGameModeArea.mac)) - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_CREATED, "not created"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_CREATED, "not created"); return NetAdhocGameMode_DeleteMaster(); } static int sceNetAdhocGameModeUpdateReplica(int id, u32 infoAddr) { - DEBUG_LOG(SCENET, "UNTESTED sceNetAdhocGameModeUpdateReplica(%i, %08x) at %08x", id, infoAddr, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "UNTESTED sceNetAdhocGameModeUpdateReplica(%i, %08x) at %08x", id, infoAddr, currentMIPS->pc); if (!netAdhocctlInited) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); if (adhocctlCurrentMode != ADHOCCTL_MODE_GAMEMODE) - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_IN_GAMEMODE, "not in gamemode"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_IN_GAMEMODE, "not in gamemode"); if (!netAdhocGameModeEntered) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_ENTER_GAMEMODE, "not enter gamemode"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_ENTER_GAMEMODE, "not enter gamemode"); auto it = std::find_if(replicaGameModeAreas.begin(), replicaGameModeAreas.end(), [id](GameModeArea const& e) { @@ -4631,7 +4631,7 @@ static int sceNetAdhocGameModeUpdateReplica(int id, u32 infoAddr) { }); if (it == replicaGameModeAreas.end()) - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_CREATED, "not created"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_CREATED, "not created"); // Bomberman Panic Bomber is using 0/null on infoAddr, so i guess it's optional. GameModeUpdateInfo* gmuinfo = NULL; @@ -4664,14 +4664,14 @@ static int sceNetAdhocGameModeUpdateReplica(int id, u32 infoAddr) { } static int sceNetAdhocGameModeDeleteReplica(int id) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocGameModeDeleteReplica(%i) at %08x", id, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocGameModeDeleteReplica(%i) at %08x", id, currentMIPS->pc); auto it = std::find_if(replicaGameModeAreas.begin(), replicaGameModeAreas.end(), [id](GameModeArea const& e) { return e.id == id; }); if (it == replicaGameModeAreas.end()) - return hleLogError(SCENET, ERROR_NET_ADHOC_NOT_CREATED, "not created"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_NOT_CREATED, "not created"); if (it->data) { free(it->data); @@ -4690,17 +4690,17 @@ static int sceNetAdhocGameModeDeleteReplica(int id) { } int sceNetAdhocGetSocketAlert(int id, u32 flagPtr) { - WARN_LOG_REPORT_ONCE(sceNetAdhocGetSocketAlert, SCENET, "UNTESTED sceNetAdhocGetSocketAlert(%i, %08x) at %08x", id, flagPtr, currentMIPS->pc); + WARN_LOG_REPORT_ONCE(sceNetAdhocGetSocketAlert, Log::sceNet, "UNTESTED sceNetAdhocGetSocketAlert(%i, %08x) at %08x", id, flagPtr, currentMIPS->pc); if (!Memory::IsValidAddress(flagPtr)) - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_ARG, "invalid arg"); if (id < 1 || id > MAX_SOCKET || adhocSockets[id - 1] == NULL) - return hleLogDebug(SCENET, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_INVALID_SOCKET_ID, "invalid socket id"); s32_le flg = adhocSockets[id - 1]->flags; Memory::Write_U32(flg, flagPtr); - return hleLogDebug(SCENET, 0, "flags = %08x", flg); + return hleLogDebug(Log::sceNet, 0, "flags = %08x", flg); } int NetAdhocMatching_Stop(int matchingId) { @@ -4752,7 +4752,7 @@ int NetAdhocMatching_Stop(int matchingId) { } int sceNetAdhocMatchingStop(int matchingId) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocMatchingStop(%i) at %08x", matchingId, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingStop(%i) at %08x", matchingId, currentMIPS->pc); return NetAdhocMatching_Stop(matchingId); } @@ -4827,7 +4827,7 @@ int sceNetAdhocMatchingDelete(int matchingId) { NetAdhocMatching_Delete(matchingId); - WARN_LOG(SCENET, "UNTESTED sceNetAdhocMatchingDelete(%i) at %08x", matchingId, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingDelete(%i) at %08x", matchingId, currentMIPS->pc); // Give a little time to make sure everything are cleaned up before the following AdhocMatchingCreate, Not too long tho, otherwise Naruto Ultimate Ninja Heroes 3 will have an issue //hleDelayResult(0, "give time to init/cleanup", adhocExtraPollDelayMS * 1000); @@ -4835,7 +4835,7 @@ int sceNetAdhocMatchingDelete(int matchingId) { } int sceNetAdhocMatchingInit(u32 memsize) { - WARN_LOG_REPORT_ONCE(sceNetAdhocMatchingInit, SCENET, "sceNetAdhocMatchingInit(%d) at %08x", memsize, currentMIPS->pc); + WARN_LOG_REPORT_ONCE(sceNetAdhocMatchingInit, Log::sceNet, "sceNetAdhocMatchingInit(%d) at %08x", memsize, currentMIPS->pc); // Uninitialized Library if (netAdhocMatchingInited) @@ -4871,7 +4871,7 @@ int NetAdhocMatching_Term() { } int sceNetAdhocMatchingTerm() { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocMatchingTerm() at %08x", currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingTerm() at %08x", currentMIPS->pc); // Should we cleanup all created matching contexts first? just in case there are games that doesn't delete them before calling this NetAdhocMatching_Term(); @@ -4882,7 +4882,7 @@ int sceNetAdhocMatchingTerm() { // Presumably returns a "matchingId". static int sceNetAdhocMatchingCreate(int mode, int maxnum, int port, int rxbuflen, int hello_int, int keepalive_int, int init_count, int rexmt_int, u32 callbackAddr) { - WARN_LOG(SCENET, "sceNetAdhocMatchingCreate(mode=%i, maxnum=%i, port=%i, rxbuflen=%i, hello=%i, keepalive=%i, initcount=%i, rexmt=%i, callbackAddr=%08x) at %08x", mode, maxnum, port, rxbuflen, hello_int, keepalive_int, init_count, rexmt_int, callbackAddr, currentMIPS->pc); + WARN_LOG(Log::sceNet, "sceNetAdhocMatchingCreate(mode=%i, maxnum=%i, port=%i, rxbuflen=%i, hello=%i, keepalive=%i, initcount=%i, rexmt=%i, callbackAddr=%08x) at %08x", mode, maxnum, port, rxbuflen, hello_int, keepalive_int, init_count, rexmt_int, callbackAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; } @@ -4904,7 +4904,7 @@ static int sceNetAdhocMatchingCreate(int mode, int maxnum, int port, int rxbufle for (; item != NULL; item = item->next) { // Port Match found if (item->port == port) - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_PORT_IN_USE, "adhoc matching port in use"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_PORT_IN_USE, "adhoc matching port in use"); } // Allocate Context Memory @@ -4971,7 +4971,7 @@ static int sceNetAdhocMatchingCreate(int mode, int maxnum, int port, int rxbufle //hleDelayResult(context->id, "give time to init/cleanup", adhocEventDelayMS * 1000); // Return Matching ID - return hleLogDebug(SCENET, context->id, "success"); + return hleLogDebug(Log::sceNet, context->id, "success"); } // Free Memory @@ -4979,22 +4979,22 @@ static int sceNetAdhocMatchingCreate(int mode, int maxnum, int port, int rxbufle } // Out of Memory - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NO_SPACE, "adhoc matching no space"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NO_SPACE, "adhoc matching no space"); } // InvalidERROR_NET_Arguments - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhoc matching invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhoc matching invalid arg"); } // Invalid Receive Buffer Size - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_RXBUF_TOO_SHORT, "adhoc matching rxbuf too short"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_RXBUF_TOO_SHORT, "adhoc matching rxbuf too short"); } // Invalid Member Limit - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_MAXNUM, "adhoc matching invalid maxnum"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_MAXNUM, "adhoc matching invalid maxnum"); } // Uninitialized Library - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhoc matching not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhoc matching not initialized"); } int NetAdhocMatching_Start(int matchingId, int evthPri, int evthPartitionId, int evthStack, int inthPri, int inthPartitionId, int inthStack, int optLen, u32 optDataAddr) { @@ -5023,7 +5023,7 @@ int NetAdhocMatching_Start(int matchingId, int evthPri, int evthPartitionId, int item->socket = sock; if (sock < 1) { peerlock.unlock(); - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_PORT_IN_USE, "adhoc matching port in use"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_PORT_IN_USE, "adhoc matching port in use"); } // Create & Start the Fake PSP Thread ("matching_ev%d" and "matching_io%d") @@ -5062,7 +5062,7 @@ int NetAdhocMatching_Start(int matchingId, int evthPri, int evthPartitionId, int #define VSHELL_PARTITION_ID 5 // This should be similar with sceNetAdhocMatchingStart2 but using USER_PARTITION_ID (2) for PartitionId params static int sceNetAdhocMatchingStart(int matchingId, int evthPri, int evthStack, int inthPri, int inthStack, int optLen, u32 optDataAddr) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocMatchingStart(%i, %i, %i, %i, %i, %i, %08x) at %08x", matchingId, evthPri, evthStack, inthPri, inthStack, optLen, optDataAddr, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingStart(%i, %i, %i, %i, %i, %i, %08x) at %08x", matchingId, evthPri, evthStack, inthPri, inthStack, optLen, optDataAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) return -1; @@ -5074,7 +5074,7 @@ static int sceNetAdhocMatchingStart(int matchingId, int evthPri, int evthStack, // With params for Partition ID for the event & input handler stack static int sceNetAdhocMatchingStart2(int matchingId, int evthPri, int evthPartitionId, int evthStack, int inthPri, int inthPartitionId, int inthStack, int optLen, u32 optDataAddr) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocMatchingStart2(%i, %i, %i, %i, %i, %i, %i, %i, %08x) at %08x", matchingId, evthPri, evthPartitionId, evthStack, inthPri, inthPartitionId, inthStack, optLen, optDataAddr, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingStart2(%i, %i, %i, %i, %i, %i, %i, %i, %08x) at %08x", matchingId, evthPri, evthPartitionId, evthStack, inthPri, inthPartitionId, inthStack, optLen, optDataAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) return -1; @@ -5086,7 +5086,7 @@ static int sceNetAdhocMatchingStart2(int matchingId, int evthPri, int evthPartit static int sceNetAdhocMatchingSelectTarget(int matchingId, const char *macAddress, int optLen, u32 optDataPtr) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocMatchingSelectTarget(%i, %s, %i, %08x) at %08x", matchingId, mac2str((SceNetEtherAddr*)macAddress).c_str(), optLen, optDataPtr, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingSelectTarget(%i, %s, %i, %08x) at %08x", matchingId, mac2str((SceNetEtherAddr*)macAddress).c_str(), optLen, optDataPtr, currentMIPS->pc); if (!g_Config.bEnableWlan) return -1; @@ -5122,10 +5122,10 @@ static int sceNetAdhocMatchingSelectTarget(int matchingId, const char *macAddres if (context->mode == PSP_ADHOC_MATCHING_MODE_PARENT) { // Already Connected - if (peer->state == PSP_ADHOC_MATCHING_PEER_CHILD) return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_ALREADY_ESTABLISHED, "adhocmatching already established"); + if (peer->state == PSP_ADHOC_MATCHING_PEER_CHILD) return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_ALREADY_ESTABLISHED, "adhocmatching already established"); // Not enough space - if (countChildren(context) == (context->maxpeers - 1)) return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_EXCEED_MAXNUM, "adhocmatching exceed maxnum"); + if (countChildren(context) == (context->maxpeers - 1)) return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_EXCEED_MAXNUM, "adhocmatching exceed maxnum"); // Requesting Peer if (peer->state == PSP_ADHOC_MATCHING_PEER_INCOMING_REQUEST) @@ -5153,10 +5153,10 @@ static int sceNetAdhocMatchingSelectTarget(int matchingId, const char *macAddres else if (context->mode == PSP_ADHOC_MATCHING_MODE_CHILD) { // Already connected - if (findParent(context) != NULL) return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_ALREADY_ESTABLISHED, "adhocmatching already established"); + if (findParent(context) != NULL) return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_ALREADY_ESTABLISHED, "adhocmatching already established"); // Outgoing Request in Progress - if (findOutgoingRequest(context) != NULL) return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_REQUEST_IN_PROGRESS, "adhocmatching request in progress"); + if (findOutgoingRequest(context) != NULL) return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_REQUEST_IN_PROGRESS, "adhocmatching request in progress"); // Valid Offer if (peer->state == PSP_ADHOC_MATCHING_PEER_OFFER) @@ -5176,10 +5176,10 @@ static int sceNetAdhocMatchingSelectTarget(int matchingId, const char *macAddres else { // Already connected - if (findP2P(context) != NULL) return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_ALREADY_ESTABLISHED, "adhocmatching already established"); + if (findP2P(context) != NULL) return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_ALREADY_ESTABLISHED, "adhocmatching already established"); // Outgoing Request in Progress - if (findOutgoingRequest(context) != NULL) return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_REQUEST_IN_PROGRESS, "adhocmatching request in progress"); + if (findOutgoingRequest(context) != NULL) return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_REQUEST_IN_PROGRESS, "adhocmatching request in progress"); // Join Request Mode if (peer->state == PSP_ADHOC_MATCHING_PEER_OFFER) @@ -5211,31 +5211,31 @@ static int sceNetAdhocMatchingSelectTarget(int matchingId, const char *macAddres } // How did this happen?! It shouldn't! - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_TARGET_NOT_READY, "adhocmatching target not ready"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_TARGET_NOT_READY, "adhocmatching target not ready"); } // Invalid Optional Data Length - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_OPTLEN, "adhocmatching invalid optlen"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_OPTLEN, "adhocmatching invalid optlen"); } // Peer not found - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_UNKNOWN_TARGET, "adhocmatching unknown target"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_UNKNOWN_TARGET, "adhocmatching unknown target"); } // Idle Context - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "adhocmatching not running"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "adhocmatching not running"); } // Invalid Matching ID - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "adhocmatching invalid id"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "adhocmatching invalid id"); } // Invalid Arguments - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); } // Uninitialized Library - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); } int NetAdhocMatching_CancelTargetWithOpt(int matchingId, const char* macAddress, int optLen, u32 optDataPtr) { @@ -5295,43 +5295,43 @@ int NetAdhocMatching_CancelTargetWithOpt(int matchingId, const char* macAddress, } // Peer not found - //return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_UNKNOWN_TARGET, "adhocmatching unknown target"); + //return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_UNKNOWN_TARGET, "adhocmatching unknown target"); // Faking success to prevent the game (ie. Soul Calibur) to repeatedly calling this function when the other player is disconnected return 0; } // Context not running - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "adhocmatching not running"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "adhocmatching not running"); } // Invalid Matching ID - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "adhocmatching invalid id"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "adhocmatching invalid id"); } // Invalid Arguments - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); } // Uninitialized Library - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); } int sceNetAdhocMatchingCancelTargetWithOpt(int matchingId, const char *macAddress, int optLen, u32 optDataPtr) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocMatchingCancelTargetWithOpt(%i, %s, %i, %08x) at %08x", matchingId, mac2str((SceNetEtherAddr*)macAddress).c_str(), optLen, optDataPtr, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingCancelTargetWithOpt(%i, %s, %i, %08x) at %08x", matchingId, mac2str((SceNetEtherAddr*)macAddress).c_str(), optLen, optDataPtr, currentMIPS->pc); if (!g_Config.bEnableWlan) return -1; return NetAdhocMatching_CancelTargetWithOpt(matchingId, macAddress, optLen, optDataPtr); } int sceNetAdhocMatchingCancelTarget(int matchingId, const char *macAddress) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocMatchingCancelTarget(%i, %s)", matchingId, mac2str((SceNetEtherAddr*)macAddress).c_str()); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingCancelTarget(%i, %s)", matchingId, mac2str((SceNetEtherAddr*)macAddress).c_str()); if (!g_Config.bEnableWlan) return -1; return NetAdhocMatching_CancelTargetWithOpt(matchingId, macAddress, 0, 0); } int sceNetAdhocMatchingGetHelloOpt(int matchingId, u32 optLenAddr, u32 optDataAddr) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocMatchingGetHelloOpt(%i, %08x, %08x)", matchingId, optLenAddr, optDataAddr); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingGetHelloOpt(%i, %08x, %08x)", matchingId, optLenAddr, optDataAddr); if (!g_Config.bEnableWlan) return -1; @@ -5362,12 +5362,12 @@ int sceNetAdhocMatchingGetHelloOpt(int matchingId, u32 optLenAddr, u32 optDataAd } int sceNetAdhocMatchingSetHelloOpt(int matchingId, int optLenAddr, u32 optDataAddr) { - VERBOSE_LOG(SCENET, "UNTESTED sceNetAdhocMatchingSetHelloOpt(%i, %i, %08x) at %08x", matchingId, optLenAddr, optDataAddr, currentMIPS->pc); + VERBOSE_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingSetHelloOpt(%i, %i, %08x) at %08x", matchingId, optLenAddr, optDataAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) return -1; if (!netAdhocMatchingInited) - return hleLogDebug(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); // Multithreading Lock peerlock.lock(); @@ -5379,19 +5379,19 @@ int sceNetAdhocMatchingSetHelloOpt(int matchingId, int optLenAddr, u32 optDataAd // Context not found if (context == NULL) - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "adhocmatching invalid id"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "adhocmatching invalid id"); // Invalid Matching Mode (Child) if (context->mode == PSP_ADHOC_MATCHING_MODE_CHILD) - return hleLogDebug(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_MODE, "adhocmatching invalid mode"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_MODE, "adhocmatching invalid mode"); // Context not running if (!context->running) - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "adhocmatching not running"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "adhocmatching not running"); // Invalid Optional Data Length if ((optLenAddr != 0) && (optDataAddr == 0)) - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_OPTLEN, "adhocmatching invalid optlen"); //ERROR_NET_ADHOC_MATCHING_INVALID_ARG + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_OPTLEN, "adhocmatching invalid optlen"); //ERROR_NET_ADHOC_MATCHING_INVALID_ARG // Grab Existing Hello Data void* hello = context->hello; @@ -5435,16 +5435,16 @@ int sceNetAdhocMatchingSetHelloOpt(int matchingId, int optLenAddr, u32 optDataAd } static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) { - DEBUG_LOG(SCENET, "UNTESTED sceNetAdhocMatchingGetMembers(%i, [%08x]=%i, %08x) at %08x", matchingId, sizeAddr, Memory::Read_U32(sizeAddr), buf, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingGetMembers(%i, [%08x]=%i, %08x) at %08x", matchingId, sizeAddr, Memory::Read_U32(sizeAddr), buf, currentMIPS->pc); if (!g_Config.bEnableWlan) return -1; if (!netAdhocMatchingInited) - return hleLogDebug(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); // Minimum Argument if (!Memory::IsValidAddress(sizeAddr)) - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); // Multithreading Lock peerlock.lock(); @@ -5455,15 +5455,15 @@ static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) // Context not found if (context == NULL) - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "adhocmatching invalid id"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "adhocmatching invalid id"); // Context not running if (!context->running) - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "adhocmatching not running"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "adhocmatching not running"); // Buffer Length not available if (!Memory::IsValidAddress(sizeAddr)) - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); int* buflen = (int*)Memory::GetPointer(sizeAddr); SceNetAdhocMatchingMemberInfoEmu* buf2 = NULL; @@ -5483,7 +5483,7 @@ static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) { // Get Connected Peer Count *buflen = available; - DEBUG_LOG(SCENET, "MemberList [Connected: %i]", peercount); + DEBUG_LOG(Log::sceNet, "MemberList [Connected: %i]", peercount); } // Normal Mode @@ -5511,7 +5511,7 @@ static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) // Add Local MAC buf2[filledpeers++].mac_addr = context->mac; - DEBUG_LOG(SCENET, "MemberSelf [%s]", mac2str(&context->mac).c_str()); + DEBUG_LOG(Log::sceNet, "MemberSelf [%s]", mac2str(&context->mac).c_str()); } // Room for more than local peer @@ -5536,7 +5536,7 @@ static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) // Add P2P Brother MAC buf2[filledpeers++].mac_addr = p2p->mac; - DEBUG_LOG(SCENET, "MemberP2P [%s]", mac2str(&p2p->mac).c_str()); + DEBUG_LOG(Log::sceNet, "MemberP2P [%s]", mac2str(&p2p->mac).c_str()); } } @@ -5556,7 +5556,7 @@ static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) // Add Parent MAC buf2[filledpeers++].mac_addr = parentpeer->mac; - DEBUG_LOG(SCENET, "MemberParent [%s]", mac2str(&parentpeer->mac).c_str()); + DEBUG_LOG(Log::sceNet, "MemberParent [%s]", mac2str(&parentpeer->mac).c_str()); } // We may need to rearrange children where last joined player placed last @@ -5589,7 +5589,7 @@ static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) // Add Child MAC buf2[filledpeers++].mac_addr = peer->mac; - DEBUG_LOG(SCENET, "MemberChild [%s]", mac2str(&peer->mac).c_str()); + DEBUG_LOG(Log::sceNet, "MemberChild [%s]", mac2str(&peer->mac).c_str()); } } @@ -5600,14 +5600,14 @@ static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) // Add Peer MAC buf2[filledpeers++].mac_addr = peer->mac; - DEBUG_LOG(SCENET, "MemberSibling [%s]", mac2str(&peer->mac).c_str()); + DEBUG_LOG(Log::sceNet, "MemberSibling [%s]", mac2str(&peer->mac).c_str()); } // Self Peer else if (peer->state == 0) { // Add Local MAC buf2[filledpeers++].mac_addr = peer->mac; - DEBUG_LOG(SCENET, "MemberSelf [%s]", mac2str(&peer->mac).c_str()); + DEBUG_LOG(Log::sceNet, "MemberSelf [%s]", mac2str(&peer->mac).c_str()); } } @@ -5629,7 +5629,7 @@ static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) // Fix Buffer Size *buflen = sizeof(SceNetAdhocMatchingMemberInfoEmu) * filledpeers; - DEBUG_LOG(SCENET, "MemberList [Requested: %i][Discovered: %i]", requestedpeers, filledpeers); + DEBUG_LOG(Log::sceNet, "MemberList [Requested: %i][Discovered: %i]", requestedpeers, filledpeers); } // Return Success @@ -5638,7 +5638,7 @@ static int sceNetAdhocMatchingGetMembers(int matchingId, u32 sizeAddr, u32 buf) // Gran Turismo may replace the 1st bit of the 1st byte of MAC address's OUI with 0 (unicast bit), or replace the whole 6-bytes of MAC address with all 00 (invalid mac) for unknown reason int sceNetAdhocMatchingSendData(int matchingId, const char *mac, int dataLen, u32 dataAddr) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocMatchingSendData(%i, %s, %i, %08x) at %08x", matchingId, mac2str((SceNetEtherAddr*)mac).c_str(), dataLen, dataAddr, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingSendData(%i, %s, %i, %08x) at %08x", matchingId, mac2str((SceNetEtherAddr*)mac).c_str(), dataLen, dataAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) return -1; @@ -5660,7 +5660,7 @@ int sceNetAdhocMatchingSendData(int matchingId, const char *mac, int dataLen, u3 // Invalid Data Length if (dataLen <=0 || dataAddr == 0) // Invalid Data Length - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_DATALEN, "invalid datalen"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_DATALEN, "invalid datalen"); void* data = NULL; if (Memory::IsValidAddress(dataAddr)) data = Memory::GetPointerWriteUnchecked(dataAddr); @@ -5679,7 +5679,7 @@ int sceNetAdhocMatchingSendData(int matchingId, const char *mac, int dataLen, u3 { // Send in Progress if (peer->sending) - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_DATA_BUSY, "data busy"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_DATA_BUSY, "data busy"); // Mark Peer as Sending peer->sending = 1; @@ -5692,31 +5692,31 @@ int sceNetAdhocMatchingSendData(int matchingId, const char *mac, int dataLen, u3 } // Not connected / accepted - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_ESTABLISHED, "not established"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_ESTABLISHED, "not established"); } // Peer not found - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_UNKNOWN_TARGET, "unknown target"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_UNKNOWN_TARGET, "unknown target"); } // Context not running - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "not running"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "not running"); } // Invalid Matching ID - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "invalid id"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "invalid id"); } // Invalid Arguments - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "invalid arg"); } // Uninitialized Library - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "not initialized"); } int sceNetAdhocMatchingAbortSendData(int matchingId, const char *mac) { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocMatchingAbortSendData(%i, %s)", matchingId, mac2str((SceNetEtherAddr*)mac).c_str()); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingAbortSendData(%i, %s)", matchingId, mac2str((SceNetEtherAddr*)mac).c_str()); if (!g_Config.bEnableWlan) return -1; @@ -5756,37 +5756,37 @@ int sceNetAdhocMatchingAbortSendData(int matchingId, const char *mac) { } // Peer not found - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_UNKNOWN_TARGET, "adhocmatching unknown target"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_UNKNOWN_TARGET, "adhocmatching unknown target"); } // Context not running - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "adhocmatching not running"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_RUNNING, "adhocmatching not running"); } // Invalid Matching ID - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "adhocmatching invalid id"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ID, "adhocmatching invalid id"); } // Invalid Arguments - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); } // Uninitialized Library - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); } // Get the maximum memory usage by the matching library static int sceNetAdhocMatchingGetPoolMaxAlloc() { - ERROR_LOG(SCENET, "UNIMPL sceNetAdhocMatchingGetPoolMaxAlloc() at %08x", currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL sceNetAdhocMatchingGetPoolMaxAlloc() at %08x", currentMIPS->pc); if (!g_Config.bEnableWlan) return -1; // Lazy way out - hardcoded return value - return hleLogDebug(SCENET, fakePoolSize/2, "faked value"); + return hleLogDebug(Log::sceNet, fakePoolSize/2, "faked value"); } int sceNetAdhocMatchingGetPoolStat(u32 poolstatPtr) { - DEBUG_LOG(SCENET, "UNTESTED sceNetAdhocMatchingGetPoolStat(%08x) at %08x", poolstatPtr, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "UNTESTED sceNetAdhocMatchingGetPoolStat(%08x) at %08x", poolstatPtr, currentMIPS->pc); if (!g_Config.bEnableWlan) return -1; @@ -5809,11 +5809,11 @@ int sceNetAdhocMatchingGetPoolStat(u32 poolstatPtr) { } // Invalid Argument - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_INVALID_ARG, "adhocmatching invalid arg"); } // Uninitialized Library - return hleLogError(SCENET, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOC_MATCHING_NOT_INITIALIZED, "adhocmatching not initialized"); } void __NetTriggerCallbacks() @@ -5867,10 +5867,10 @@ void __NetTriggerCallbacks() if (adhocConnectionType == ADHOC_JOIN) delayus += adhocExtraDelay * 3; // Shows player list - INFO_LOG(SCENET, "GameMode - All players have joined:"); + INFO_LOG(Log::sceNet, "GameMode - All players have joined:"); int i = 0; for (auto& mac : gameModeMacs) { - INFO_LOG(SCENET, "GameMode macAddress#%d=%s", i++, mac2str(&mac).c_str()); + INFO_LOG(Log::sceNet, "GameMode macAddress#%d=%s", i++, mac2str(&mac).c_str()); if (i >= ADHOCCTL_GAMEMODE_MAX_MEMBERS) break; } @@ -5888,7 +5888,7 @@ void __NetTriggerCallbacks() } for (std::map::iterator it = adhocctlHandlers.begin(); it != adhocctlHandlers.end(); ++it) { - DEBUG_LOG(SCENET, "AdhocctlCallback: [ID=%i][EVENT=%i][Error=%08x]", it->first, flags, error); + DEBUG_LOG(Log::sceNet, "AdhocctlCallback: [ID=%i][EVENT=%i][Error=%08x]", it->first, flags, error); args[2] = it->second.argument; AfterAdhocMipsCall* after = (AfterAdhocMipsCall*)__KernelCreateAction(actionAfterAdhocMipsCall); after->SetData(it->first, flags, args[2]); @@ -5923,11 +5923,11 @@ void __NetMatchingCallbacks() //(int matchingId) if (actionAfterMatchingMipsCall < 0) { actionAfterMatchingMipsCall = __KernelRegisterActionType(AfterMatchingMipsCall::Create); } - DEBUG_LOG(SCENET, "AdhocMatching - Remaining Events: %zu", matchingEvents.size()); + DEBUG_LOG(Log::sceNet, "AdhocMatching - Remaining Events: %zu", matchingEvents.size()); auto peer = findPeer(context, (SceNetEtherAddr*)Memory::GetPointer(args[2])); // Discard HELLO Events when in the middle of joining, as some games (ie. Super Pocket Tennis) might tried to join again (TODO: Need to confirm whether sceNetAdhocMatchingSelectTarget supposed to be blocking the current thread or not) if (peer == NULL || (args[1] != PSP_ADHOC_MATCHING_EVENT_HELLO || (peer->state != PSP_ADHOC_MATCHING_PEER_OUTGOING_REQUEST && peer->state != PSP_ADHOC_MATCHING_PEER_INCOMING_REQUEST))) { - DEBUG_LOG(SCENET, "AdhocMatchingCallback: [ID=%i][EVENT=%i][%s]", args[0], args[1], mac2str((SceNetEtherAddr *)Memory::GetPointer(args[2])).c_str()); + DEBUG_LOG(Log::sceNet, "AdhocMatchingCallback: [ID=%i][EVENT=%i][%s]", args[0], args[1], mac2str((SceNetEtherAddr *)Memory::GetPointer(args[2])).c_str()); AfterMatchingMipsCall* after = (AfterMatchingMipsCall*)__KernelCreateAction(actionAfterMatchingMipsCall); after->SetData(args[0], args[1], args[2]); @@ -5935,7 +5935,7 @@ void __NetMatchingCallbacks() //(int matchingId) matchingEvents.pop_front(); } else { - DEBUG_LOG(SCENET, "AdhocMatching - Discarding Callback: [ID=%i][EVENT=%i][%s]", args[0], args[1], mac2str((SceNetEtherAddr*)Memory::GetPointer(args[2])).c_str()); + DEBUG_LOG(Log::sceNet, "AdhocMatching - Discarding Callback: [ID=%i][EVENT=%i][%s]", args[0], args[1], mac2str((SceNetEtherAddr*)Memory::GetPointer(args[2])).c_str()); matchingEvents.pop_front(); } } @@ -6012,25 +6012,25 @@ int NetAdhocctl_ExitGameMode() { } static int sceNetAdhocctlExitGameMode() { - WARN_LOG(SCENET, "UNTESTED sceNetAdhocctlExitGameMode() at %08x", currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED sceNetAdhocctlExitGameMode() at %08x", currentMIPS->pc); return NetAdhocctl_ExitGameMode(); } static int sceNetAdhocctlGetGameModeInfo(u32 infoAddr) { - DEBUG_LOG(SCENET, "sceNetAdhocctlGetGameModeInfo(%08x)", infoAddr); + DEBUG_LOG(Log::sceNet, "sceNetAdhocctlGetGameModeInfo(%08x)", infoAddr); if (!netAdhocctlInited) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); if (!Memory::IsValidAddress(infoAddr)) - return hleLogError(SCENET, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); + return hleLogError(Log::sceNet, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); SceNetAdhocctlGameModeInfo* gmInfo = (SceNetAdhocctlGameModeInfo*)Memory::GetPointer(infoAddr); // Writes number of participants and each participating MAC address into infoAddr/gmInfo gmInfo->num = static_cast(gameModeMacs.size()); int i = 0; for (auto& mac : gameModeMacs) { - VERBOSE_LOG(SCENET, "GameMode macAddress#%d=%s", i, mac2str(&mac).c_str()); + VERBOSE_LOG(Log::sceNet, "GameMode macAddress#%d=%s", i, mac2str(&mac).c_str()); gmInfo->members[i++] = mac; if (i >= ADHOCCTL_GAMEMODE_MAX_MEMBERS) break; @@ -6046,7 +6046,7 @@ static int sceNetAdhocctlGetPeerList(u32 sizeAddr, u32 bufAddr) { SceNetAdhocctlPeerInfoEmu *buf = NULL; if (Memory::IsValidAddress(bufAddr)) buf = (SceNetAdhocctlPeerInfoEmu *)Memory::GetPointer(bufAddr); - DEBUG_LOG(SCENET, "sceNetAdhocctlGetPeerList([%08x]=%i, %08x) at %08x", sizeAddr, /*buflen ? *buflen : -1*/Memory::Read_U32(sizeAddr), bufAddr, currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "sceNetAdhocctlGetPeerList([%08x]=%i, %08x) at %08x", sizeAddr, /*buflen ? *buflen : -1*/Memory::Read_U32(sizeAddr), bufAddr, currentMIPS->pc); if (!g_Config.bEnableWlan) { return -1; } @@ -6065,7 +6065,7 @@ static int sceNetAdhocctlGetPeerList(u32 sizeAddr, u32 bufAddr) { if (buf == NULL) { int activePeers = getActivePeerCount(excludeTimedout); *buflen = activePeers * sizeof(SceNetAdhocctlPeerInfoEmu); - DEBUG_LOG(SCENET, "PeerList [Active: %i]", activePeers); + DEBUG_LOG(Log::sceNet, "PeerList [Active: %i]", activePeers); } // Normal Mode else { @@ -6101,7 +6101,7 @@ static int sceNetAdhocctlGetPeerList(u32 sizeAddr, u32 bufAddr) { discovered++; u32_le ipaddr = peer->ip_addr; - DEBUG_LOG(SCENET, "Peer [%s][%s][%s][%llu]", mac2str(&peer->mac_addr).c_str(), ip2str(*(in_addr*)&ipaddr).c_str(), (const char*)&peer->nickname.data, peer->last_recv); + DEBUG_LOG(Log::sceNet, "Peer [%s][%s][%s][%llu]", mac2str(&peer->mac_addr).c_str(), ip2str(*(in_addr*)&ipaddr).c_str(), (const char*)&peer->nickname.data, peer->last_recv); } } @@ -6116,7 +6116,7 @@ static int sceNetAdhocctlGetPeerList(u32 sizeAddr, u32 bufAddr) { // Fix Size *buflen = discovered * sizeof(SceNetAdhocctlPeerInfoEmu); - DEBUG_LOG(SCENET, "PeerList [Requested: %i][Discovered: %i]", requestcount, discovered); + DEBUG_LOG(Log::sceNet, "PeerList [Requested: %i][Discovered: %i]", requestcount, discovered); } // Multithreading Unlock @@ -6127,11 +6127,11 @@ static int sceNetAdhocctlGetPeerList(u32 sizeAddr, u32 bufAddr) { } // Invalid Arguments - return hleLogDebug(SCENET, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOCCTL_INVALID_ARG, "invalid arg"); } // Uninitialized Library - return hleLogDebug(SCENET, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); + return hleLogDebug(Log::sceNet, ERROR_NET_ADHOCCTL_NOT_INITIALIZED, "not initialized"); } static int sceNetAdhocctlGetAddrByName(const char *nickName, u32 sizeAddr, u32 bufAddr) { @@ -6142,7 +6142,7 @@ static int sceNetAdhocctlGetAddrByName(const char *nickName, u32 sizeAddr, u32 b memcpy(nckName, nickName, ADHOCCTL_NICKNAME_LEN); // Copied to null-terminated var to prevent unexpected behaviour on Logs nckName[ADHOCCTL_NICKNAME_LEN - 1] = 0; - WARN_LOG_REPORT_ONCE(sceNetAdhocctlGetAddrByName, SCENET, "UNTESTED sceNetAdhocctlGetAddrByName(%s, [%08x]=%d/%zu, %08x) at %08x", nckName, sizeAddr, buflen ? *buflen : -1, sizeof(SceNetAdhocctlPeerInfoEmu), bufAddr, currentMIPS->pc); + WARN_LOG_REPORT_ONCE(sceNetAdhocctlGetAddrByName, Log::sceNet, "UNTESTED sceNetAdhocctlGetAddrByName(%s, [%08x]=%d/%zu, %08x) at %08x", nckName, sizeAddr, buflen ? *buflen : -1, sizeof(SceNetAdhocctlPeerInfoEmu), bufAddr, currentMIPS->pc); // Library initialized if (netAdhocctlInited) @@ -6160,7 +6160,7 @@ static int sceNetAdhocctlGetAddrByName(const char *nickName, u32 sizeAddr, u32 b if (buf == NULL) { int foundName = getNicknameCount(nickName); *buflen = foundName * sizeof(SceNetAdhocctlPeerInfoEmu); - DEBUG_LOG(SCENET, "PeerNameList [%s: %i]", nickName, foundName); + DEBUG_LOG(Log::sceNet, "PeerNameList [%s: %i]", nickName, foundName); } // Normal Information Mode else @@ -6193,7 +6193,7 @@ static int sceNetAdhocctlGetAddrByName(const char *nickName, u32 sizeAddr, u32 b u64 lastrecv = std::max(0LL, static_cast(CoreTiming::GetGlobalTimeUsScaled() - defaultLastRecvDelta)); buf[discovered++].last_recv = lastrecv; - DEBUG_LOG(SCENET, "Peer [%s][%s][%s][%llu]", mac2str(&mac).c_str(), ip2str(addr.sin_addr).c_str(), nickName, lastrecv); + DEBUG_LOG(Log::sceNet, "Peer [%s][%s][%s][%llu]", mac2str(&mac).c_str(), ip2str(addr.sin_addr).c_str(), nickName, lastrecv); } // Peer Reference @@ -6216,7 +6216,7 @@ static int sceNetAdhocctlGetAddrByName(const char *nickName, u32 sizeAddr, u32 b buf[discovered++].last_recv = peer->last_recv; u32_le ipaddr = peer->ip_addr; - DEBUG_LOG(SCENET, "Peer [%s][%s][%s][%llu]", mac2str(&peer->mac_addr).c_str(), ip2str(*(in_addr*)&ipaddr).c_str(), (const char*)&peer->nickname.data, peer->last_recv); + DEBUG_LOG(Log::sceNet, "Peer [%s][%s][%s][%llu]", mac2str(&peer->mac_addr).c_str(), ip2str(*(in_addr*)&ipaddr).c_str(), (const char*)&peer->nickname.data, peer->last_recv); } } @@ -6233,14 +6233,14 @@ static int sceNetAdhocctlGetAddrByName(const char *nickName, u32 sizeAddr, u32 b // Fix Buffer Size *buflen = discovered * sizeof(SceNetAdhocctlPeerInfoEmu); - DEBUG_LOG(SCENET, "PeerNameList [%s][Requested: %i][Discovered: %i]", nickName, requestcount, discovered); + DEBUG_LOG(Log::sceNet, "PeerNameList [%s][Requested: %i][Discovered: %i]", nickName, requestcount, discovered); } // Multithreading Unlock peerlock.unlock(); // Return Success - return hleLogDebug(SCENET, hleDelayResult(0, "delay 100 ~ 1000us", 100), "success"); // FIXME: Might have similar delay with GetPeerList? need to know which games using this tho + return hleLogDebug(Log::sceNet, hleDelayResult(0, "delay 100 ~ 1000us", 100), "success"); // FIXME: Might have similar delay with GetPeerList? need to know which games using this tho } // Invalid Arguments @@ -6278,7 +6278,7 @@ const HLEFunction sceNetAdhocctl[] = { // Return value: 0/0x80410005/0x80411301/error returned from sceNetAdhocctl_lib_F8BABD85[/error returned from sceUtilityGetSystemParamInt?] int sceNetAdhocDiscoverInitStart(u32 paramAddr) { - WARN_LOG_REPORT_ONCE(sceNetAdhocDiscoverInitStart, SCENET, "UNIMPL sceNetAdhocDiscoverInitStart(%08x) at %08x", paramAddr, currentMIPS->pc); + WARN_LOG_REPORT_ONCE(sceNetAdhocDiscoverInitStart, Log::sceNet, "UNIMPL sceNetAdhocDiscoverInitStart(%08x) at %08x", paramAddr, currentMIPS->pc); // FIXME: Most AdhocDiscover syscalls will return 0x80410005 if (sceKernelCheckThreadStack_user() < 0x00000FE0), AdhocDiscover seems to be storing some data in the stack, while we use global variables for these if (sceKernelCheckThreadStack() < 0x00000FE0) return 0x80410005; @@ -6296,7 +6296,7 @@ int sceNetAdhocDiscoverInitStart(u32 paramAddr) { // TODO: Need to findout whether using invalid params or param address will return an error code or not netAdhocDiscoverParam = (SceNetAdhocDiscoverParam*)Memory::GetPointer(paramAddr); if (!netAdhocDiscoverParam) - return hleLogError(SCENET, -1, "invalid param?"); + return hleLogError(Log::sceNet, -1, "invalid param?"); // FIXME: paramAddr seems to be stored at 0x000010D8 without validating the value first //*((int*)Memory::GetPointer(0x000010D8)) = paramAddr; @@ -6328,23 +6328,23 @@ int sceNetAdhocDiscoverInitStart(u32 paramAddr) { char grpName[ADHOCCTL_GROUPNAME_LEN + 1] = { 0 }; memcpy(grpName, netAdhocDiscoverParam->groupName, ADHOCCTL_GROUPNAME_LEN); // For logging purpose, must not be truncated - DEBUG_LOG(SCENET, "sceNetAdhocDiscoverInitStart - Param.Unknown1 : %08x", netAdhocDiscoverParam->unknown1); - DEBUG_LOG(SCENET, "sceNetAdhocDiscoverInitStart - Param.GroupName: [%s]", grpName); - DEBUG_LOG(SCENET, "sceNetAdhocDiscoverInitStart - Param.Unknown2 : %08x", netAdhocDiscoverParam->unknown2); - DEBUG_LOG(SCENET, "sceNetAdhocDiscoverInitStart - Param.Result : %08x", netAdhocDiscoverParam->result); + DEBUG_LOG(Log::sceNet, "sceNetAdhocDiscoverInitStart - Param.Unknown1 : %08x", netAdhocDiscoverParam->unknown1); + DEBUG_LOG(Log::sceNet, "sceNetAdhocDiscoverInitStart - Param.GroupName: [%s]", grpName); + DEBUG_LOG(Log::sceNet, "sceNetAdhocDiscoverInitStart - Param.Unknown2 : %08x", netAdhocDiscoverParam->unknown2); + DEBUG_LOG(Log::sceNet, "sceNetAdhocDiscoverInitStart - Param.Result : %08x", netAdhocDiscoverParam->result); // TODO: Check whether we're already in the correct group and change the status and result accordingly netAdhocDiscoverIsStopping = false; netAdhocDiscoverStatus = NET_ADHOC_DISCOVER_STATUS_IN_PROGRESS; netAdhocDiscoverParam->result = NET_ADHOC_DISCOVER_RESULT_NO_PEER_FOUND; netAdhocDiscoverStartTime = CoreTiming::GetGlobalTimeUsScaled(); - return hleLogSuccessInfoX(SCENET, 0); + return hleLogSuccessInfoX(Log::sceNet, 0); } // Note1: When canceling the progress, Legend Of The Dragon will use DiscoverStop -> AdhocctlDisconnect -> DiscoverTerm (when status changed to 2) // Note2: When result = NO_PEER_FOUND or PEER_FOUND the progress can no longer be canceled on Legend Of The Dragon int sceNetAdhocDiscoverStop() { - WARN_LOG(SCENET, "UNIMPL sceNetAdhocDiscoverStop()"); + WARN_LOG(Log::sceNet, "UNIMPL sceNetAdhocDiscoverStop()"); if (sceKernelCheckThreadStack() < 0x00000FF0) return 0x80410005; @@ -6360,7 +6360,7 @@ int sceNetAdhocDiscoverStop() { } int sceNetAdhocDiscoverTerm() { - WARN_LOG(SCENET, "UNIMPL sceNetAdhocDiscoverTerm() at %08x", currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNIMPL sceNetAdhocDiscoverTerm() at %08x", currentMIPS->pc); /* if (sceKernelCheckThreadStack() < 0x00000FF0) return 0x80410005; @@ -6387,7 +6387,7 @@ int sceNetAdhocDiscoverTerm() { } int sceNetAdhocDiscoverGetStatus() { - DEBUG_LOG(SCENET, "UNIMPL sceNetAdhocDiscoverGetStatus() at %08x", currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "UNIMPL sceNetAdhocDiscoverGetStatus() at %08x", currentMIPS->pc); if (sceKernelCheckThreadStack() < 0x00000FF0) return 0x80410005; /* @@ -6398,12 +6398,12 @@ int sceNetAdhocDiscoverGetStatus() { if (Memory::Read_U32(netAdhocDiscoverBufAddr + 0x80) == 0x13) return 2; */ - return hleLogDebug(SCENET, netAdhocDiscoverStatus); // Returning 2 will trigger Legend Of The Dragon to call sceNetAdhocctlGetPeerList (only happened if it was the first sceNetAdhocDiscoverGetStatus after sceNetAdhocDiscoverInitStart) + return hleLogDebug(Log::sceNet, netAdhocDiscoverStatus); // Returning 2 will trigger Legend Of The Dragon to call sceNetAdhocctlGetPeerList (only happened if it was the first sceNetAdhocDiscoverGetStatus after sceNetAdhocDiscoverInitStart) } int sceNetAdhocDiscoverRequestSuspend() { - ERROR_LOG_REPORT_ONCE(sceNetAdhocDiscoverRequestSuspend, SCENET, "UNIMPL sceNetAdhocDiscoverRequestSuspend() at %08x", currentMIPS->pc); + ERROR_LOG_REPORT_ONCE(sceNetAdhocDiscoverRequestSuspend, Log::sceNet, "UNIMPL sceNetAdhocDiscoverRequestSuspend() at %08x", currentMIPS->pc); // FIXME: Not sure what is this syscall used for, may be related to Sleep Mode and can be triggered by using Power/Hold Switch? (based on what's written on Dissidia 012) if (sceKernelCheckThreadStack() < 0x00000FF0) return 0x80410005; @@ -6419,11 +6419,11 @@ int sceNetAdhocDiscoverRequestSuspend() */ // Since we don't know what this supposed to do, and we currently don't have a working AdhocDiscover yet, may be we should cancel the progress for now? netAdhocDiscoverIsStopping = true; - return hleLogError(SCENET, 0); + return hleLogError(Log::sceNet, 0); } int sceNetAdhocDiscoverUpdate() { - DEBUG_LOG(SCENET, "UNIMPL sceNetAdhocDiscoverUpdate() at %08x", currentMIPS->pc); + DEBUG_LOG(Log::sceNet, "UNIMPL sceNetAdhocDiscoverUpdate() at %08x", currentMIPS->pc); if (sceKernelCheckThreadStack() < 0x00000FF0) return 0x80410005; @@ -6437,7 +6437,7 @@ int sceNetAdhocDiscoverUpdate() { netAdhocDiscoverParam->result = NET_ADHOC_DISCOVER_RESULT_CANCELED; // netAdhocDiscoverIsStopping ? NET_ADHOC_DISCOVER_RESULT_CANCELED : NET_ADHOC_DISCOVER_RESULT_PEER_FOUND; } } - return hleDelayResult(hleLogDebug(SCENET, 0/*netAdhocDiscoverBufAddr*/), "adhoc discover update", 300); // FIXME: Based on JPCSP+prx, it seems to be returning a pointer to the internal buffer/struct (only when status = 1 ?), But when i stepped the code it returns 0 (might be a bug on JPCSP LLE Logging?) + return hleDelayResult(hleLogDebug(Log::sceNet, 0/*netAdhocDiscoverBufAddr*/), "adhoc discover update", 300); // FIXME: Based on JPCSP+prx, it seems to be returning a pointer to the internal buffer/struct (only when status = 1 ?), But when i stepped the code it returns 0 (might be a bug on JPCSP LLE Logging?) } const HLEFunction sceNetAdhocDiscover[] = { @@ -6522,7 +6522,7 @@ void broadcastHelloMessage(SceNetAdhocMatchingContext * context) std::string hellohex; DataToHexString(10, 0, context->hello, context->hellolen, &hellohex); - DEBUG_LOG(SCENET, "HELLO Dump (%d bytes):\n%s", context->hellolen, hellohex.c_str()); + DEBUG_LOG(Log::sceNet, "HELLO Dump (%d bytes):\n%s", context->hellolen, hellohex.c_str()); // Send Broadcast, so everyone know we have a room here peerlock.lock(); @@ -6825,9 +6825,9 @@ void sendBirthPacket(SceNetAdhocMatchingContext * context, SceNetEtherAddr * mac // Log Send Success if (sent >= 0) - INFO_LOG(SCENET, "InputLoop: Sending BIRTH [%s] to %s", mac2str(mac).c_str(), mac2str(&peer->mac).c_str()); + INFO_LOG(Log::sceNet, "InputLoop: Sending BIRTH [%s] to %s", mac2str(mac).c_str(), mac2str(&peer->mac).c_str()); else - WARN_LOG(SCENET, "InputLoop: Failed to Send BIRTH [%s] to %s", mac2str(mac).c_str(), mac2str(&peer->mac).c_str()); + WARN_LOG(Log::sceNet, "InputLoop: Failed to Send BIRTH [%s] to %s", mac2str(mac).c_str(), mac2str(&peer->mac).c_str()); } } } @@ -6996,7 +6996,7 @@ void actOnHelloPacket(SceNetAdhocMatchingContext * context, SceNetEtherAddr * se { std::string hellohex; DataToHexString(10, 0, (u8*)opt, optlen, &hellohex); - DEBUG_LOG(SCENET, "HELLO Dump (%d bytes):\n%s", optlen, hellohex.c_str()); + DEBUG_LOG(Log::sceNet, "HELLO Dump (%d bytes):\n%s", optlen, hellohex.c_str()); // Spawn Hello Event. FIXME: HELLO event should not be triggered in the middle of joining? This will cause Bleach 7 to Cancel the join request spawnLocalEvent(context, PSP_ADHOC_MATCHING_EVENT_HELLO, sendermac, optlen, opt); @@ -7042,7 +7042,7 @@ void actOnJoinPacket(SceNetAdhocMatchingContext * context, SceNetEtherAddr * sen // This is because the only way a parent can know of a child is via a join request... // If we thus know of a possible child, then we already had a previous join request thus no need for double tapping. if (peer != NULL && peer->lastping != 0 && context->mode == PSP_ADHOC_MATCHING_MODE_PARENT) { - WARN_LOG(SCENET, "Join Event(2) Ignored"); + WARN_LOG(Log::sceNet, "Join Event(2) Ignored"); return; } @@ -7099,7 +7099,7 @@ void actOnJoinPacket(SceNetAdhocMatchingContext * context, SceNetEtherAddr * sen } } } - WARN_LOG(SCENET, "Join Event(2) Rejected"); + WARN_LOG(Log::sceNet, "Join Event(2) Rejected"); // Auto-Reject Player sendCancelPacket(context, sendermac, 0, NULL); } @@ -7505,7 +7505,7 @@ int matchingEventThread(int matchingId) peerlock.unlock(); // Log Startup - INFO_LOG(SCENET, "EventLoop: Begin of EventLoop[%i] Thread", matchingId); + INFO_LOG(Log::sceNet, "EventLoop: Begin of EventLoop[%i] Thread", matchingId); // Run while needed... if (context != NULL) { @@ -7539,7 +7539,7 @@ int matchingEventThread(int matchingId) if (msg->optlen > 0) opt = ((u8*)msg) + sizeof(ThreadMessage); //&msg[1] // Log Matching Events - INFO_LOG(SCENET, "EventLoop[%d]: Matching Event [%d=%s][%s] OptSize=%d", matchingId, msg->opcode, getMatchingEventStr(msg->opcode), mac2str(&msg->mac).c_str(), msg->optlen); + INFO_LOG(Log::sceNet, "EventLoop[%d]: Matching Event [%d=%s][%s] OptSize=%d", matchingId, msg->opcode, getMatchingEventStr(msg->opcode), mac2str(&msg->mac).c_str(), msg->optlen); // Unlock to prevent race-condition with other threads due to recursive lock //context->eventlock->unlock(); @@ -7589,7 +7589,7 @@ int matchingEventThread(int matchingId) // Grab Optional Data if (msg->optlen > 0) opt = ((u8 *)msg) + sizeof(ThreadMessage); //&msg[1] - INFO_LOG(SCENET, "EventLoop[%d]: Matching Event [EVENT=%d]\n", matchingId, msg->opcode); + INFO_LOG(Log::sceNet, "EventLoop[%d]: Matching Event [EVENT=%d]\n", matchingId, msg->opcode); //context->eventlock->unlock(); // Original Call Event Handler @@ -7605,7 +7605,7 @@ int matchingEventThread(int matchingId) // Free Stack context->eventlock->unlock(); - INFO_LOG(SCENET, "EventLoop[%d]: Finished (%d msg)", matchingId, msg_count); + INFO_LOG(Log::sceNet, "EventLoop[%d]: Finished (%d msg)", matchingId, msg_count); } // Free memory @@ -7616,7 +7616,7 @@ int matchingEventThread(int matchingId) } // Log Shutdown - INFO_LOG(SCENET, "EventLoop: End of EventLoop[%i] Thread", matchingId); + INFO_LOG(Log::sceNet, "EventLoop: End of EventLoop[%i] Thread", matchingId); // Return Zero to shut up Compiler return 0; @@ -7652,7 +7652,7 @@ int matchingInputThread(int matchingId) // TODO: The MatchingInput thread is usi static int rxbuflen; // Log Startup - INFO_LOG(SCENET, "InputLoop: Begin of InputLoop[%i] Thread", matchingId); + INFO_LOG(Log::sceNet, "InputLoop: Begin of InputLoop[%i] Thread", matchingId); // Run while needed... if (context != NULL) { @@ -7762,7 +7762,7 @@ int matchingInputThread(int matchingId) // TODO: The MatchingInput thread is usi { // Log Receive Success if (context->rxbuf[0] > 1) { - INFO_LOG(SCENET, "InputLoop[%d]: Received %d Bytes (Opcode[%d]=%s)", matchingId, rxbuflen, context->rxbuf[0], getMatchingOpcodeStr(context->rxbuf[0])); + INFO_LOG(Log::sceNet, "InputLoop[%d]: Received %d Bytes (Opcode[%d]=%s)", matchingId, rxbuflen, context->rxbuf[0], getMatchingOpcodeStr(context->rxbuf[0])); } // Update Peer Timestamp @@ -7771,11 +7771,11 @@ int matchingInputThread(int matchingId) // TODO: The MatchingInput thread is usi if (peer != NULL) { now = CoreTiming::GetGlobalTimeUsScaled(); s64 delta = now - peer->last_recv; - DEBUG_LOG(SCENET, "Timestamp LastRecv Delta: %lld (%llu - %llu) from %s", delta, now, peer->last_recv, mac2str(&sendermac).c_str()); + DEBUG_LOG(Log::sceNet, "Timestamp LastRecv Delta: %lld (%llu - %llu) from %s", delta, now, peer->last_recv, mac2str(&sendermac).c_str()); if (peer->last_recv != 0) peer->last_recv = std::max(peer->last_recv, now - defaultLastRecvDelta); } else { - WARN_LOG(SCENET, "InputLoop[%d]: Unknown Peer[%s:%u] (Recved=%i, Length=%i)", matchingId, mac2str(&sendermac).c_str(), senderport, recvresult, rxbuflen); + WARN_LOG(Log::sceNet, "InputLoop[%d]: Unknown Peer[%s:%u] (Recved=%i, Length=%i)", matchingId, mac2str(&sendermac).c_str(), senderport, recvresult, rxbuflen); } // Show a warning if other player is having their port being re-mapped, thus that other player may have issue with the communication. @@ -7784,7 +7784,7 @@ int matchingInputThread(int matchingId) // TODO: The MatchingInput thread is usi char name[9] = {}; if (peer != NULL) truncate_cpy(name, sizeof(name), (const char*)peer->nickname.data); - WARN_LOG(SCENET, "InputLoop[%d]: Unknown Source Port from [%s][%s:%u -> %u] (Recved=%i, Length=%i)", matchingId, name, mac2str(&sendermac).c_str(), senderport, context->port, recvresult, rxbuflen); + WARN_LOG(Log::sceNet, "InputLoop[%d]: Unknown Source Port from [%s][%s:%u -> %u] (Recved=%i, Length=%i)", matchingId, name, mac2str(&sendermac).c_str(), senderport, context->port, recvresult, rxbuflen); g_OSD.Show(OSDType::MESSAGE_WARNING, std::string(n->T("AM: Data from Unknown Port")) + std::string(" [") + std::string(name) + std::string("]:") + std::to_string(senderport) + std::string(" -> ") + std::to_string(context->port) + std::string(" (") + std::to_string(portOffset) + std::string(")")); } // Keep tracks of re-mapped peer's ports for further communication. @@ -7883,7 +7883,7 @@ int matchingInputThread(int matchingId) // TODO: The MatchingInput thread is usi // Free Stack context->inputlock->unlock(); - INFO_LOG(SCENET, "InputLoop[%d]: Finished (%d msg)", matchingId, msg_count); + INFO_LOG(Log::sceNet, "InputLoop[%d]: Finished (%d msg)", matchingId, msg_count); } // Clear IO Message Stack @@ -7901,7 +7901,7 @@ int matchingInputThread(int matchingId) // TODO: The MatchingInput thread is usi } // Log Shutdown - INFO_LOG(SCENET, "InputLoop: End of InputLoop[%i] Thread", matchingId); + INFO_LOG(Log::sceNet, "InputLoop: End of InputLoop[%i] Thread", matchingId); // Terminate Thread //sceKernelExitDeleteThread(0); diff --git a/Core/HLE/sceNp.cpp b/Core/HLE/sceNp.cpp index c5ca4be4c6..1d8aa8154a 100644 --- a/Core/HLE/sceNp.cpp +++ b/Core/HLE/sceNp.cpp @@ -107,7 +107,7 @@ void notifyNpAuthHandlers(u32 id, u32 result, u32 argAddr) { static int sceNpInit() { - ERROR_LOG(SCENET, "UNIMPL %s()", __FUNCTION__); + ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__); npOnlineId = g_Config.sNickName; return 0; @@ -116,19 +116,19 @@ static int sceNpInit() static int sceNpTerm() { // No parameters - ERROR_LOG(SCENET, "UNIMPL %s()", __FUNCTION__); + ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__); return 0; } static int sceNpGetContentRatingFlag(u32 parentalControlAddr, u32 userAgeAddr) { - WARN_LOG(SCENET, "UNTESTED %s(%08x, %08x)", __FUNCTION__, parentalControlAddr, userAgeAddr); + WARN_LOG(Log::sceNet, "UNTESTED %s(%08x, %08x)", __FUNCTION__, parentalControlAddr, userAgeAddr); if (!Memory::IsValidAddress(parentalControlAddr) || !Memory::IsValidAddress(userAgeAddr)) - return hleLogError(SCENET, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); + return hleLogError(Log::sceNet, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); - INFO_LOG(SCENET, "%s - Parental Control: %d", __FUNCTION__, npParentalControl); - INFO_LOG(SCENET, "%s - User Age: %d", __FUNCTION__, npUserAge); + INFO_LOG(Log::sceNet, "%s - Parental Control: %d", __FUNCTION__, npParentalControl); + INFO_LOG(Log::sceNet, "%s - User Age: %d", __FUNCTION__, npUserAge); Memory::Write_U32(npParentalControl, parentalControlAddr); Memory::Write_U32(npUserAge, userAgeAddr); @@ -138,12 +138,12 @@ static int sceNpGetContentRatingFlag(u32 parentalControlAddr, u32 userAgeAddr) static int sceNpGetChatRestrictionFlag(u32 flagAddr) { - WARN_LOG(SCENET, "UNTESTED %s(%08x)", __FUNCTION__, flagAddr); + WARN_LOG(Log::sceNet, "UNTESTED %s(%08x)", __FUNCTION__, flagAddr); if (!Memory::IsValidAddress(flagAddr)) - return hleLogError(SCENET, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); + return hleLogError(Log::sceNet, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); - INFO_LOG(SCENET, "%s - Chat Restriction: %d", __FUNCTION__, npChatRestriction); + INFO_LOG(Log::sceNet, "%s - Chat Restriction: %d", __FUNCTION__, npChatRestriction); Memory::Write_U32(npChatRestriction, flagAddr); @@ -152,17 +152,17 @@ static int sceNpGetChatRestrictionFlag(u32 flagAddr) static int sceNpGetOnlineId(u32 idPtr) { - WARN_LOG(SCENET, "UNTESTED %s(%08x)", __FUNCTION__, idPtr); + WARN_LOG(Log::sceNet, "UNTESTED %s(%08x)", __FUNCTION__, idPtr); auto id = PSPPointer::Create(idPtr); if (!id.IsValid()) - return hleLogError(SCENET, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); + return hleLogError(Log::sceNet, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); memset((SceNpOnlineId *)id, 0, sizeof(SceNpOnlineId)); truncate_cpy(id->data, sizeof(id->data), npOnlineId.c_str()); id.NotifyWrite("NpGetOnlineId"); - INFO_LOG(SCENET, "%s - Online ID: %s", __FUNCTION__, id->data); + INFO_LOG(Log::sceNet, "%s - Online ID: %s", __FUNCTION__, id->data); return 0; } @@ -175,22 +175,22 @@ int NpGetNpId(SceNpId* npid) static int sceNpGetNpId(u32 idPtr) { - WARN_LOG(SCENET, "UNTESTED %s(%08x)", __FUNCTION__, idPtr); + WARN_LOG(Log::sceNet, "UNTESTED %s(%08x)", __FUNCTION__, idPtr); auto id = PSPPointer::Create(idPtr); if (!id.IsValid()) - return hleLogError(SCENET, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); + return hleLogError(Log::sceNet, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); SceNpId dummyNpId{}; memset((SceNpId *)id, 0, sizeof(SceNpId)); int retval = NpGetNpId(id); if (retval < 0) - return hleLogError(SCENET, retval); + return hleLogError(Log::sceNet, retval); - INFO_LOG(SCENET, "%s - Online ID: %s", __FUNCTION__, id->handle.data); + INFO_LOG(Log::sceNet, "%s - Online ID: %s", __FUNCTION__, id->handle.data); std::string datahex; DataToHexString(id->opt, sizeof(id->opt), &datahex); - INFO_LOG(SCENET, "%s - Options?: %s", __FUNCTION__, datahex.c_str()); + INFO_LOG(Log::sceNet, "%s - Options?: %s", __FUNCTION__, datahex.c_str()); id.NotifyWrite("NpGetNpId"); return 0; @@ -198,20 +198,20 @@ static int sceNpGetNpId(u32 idPtr) static int sceNpGetAccountRegion(u32 countryCodePtr, u32 regionCodePtr) { - WARN_LOG(SCENET, "UNTESTED %s(%08x, %08x)", __FUNCTION__, countryCodePtr, regionCodePtr); + WARN_LOG(Log::sceNet, "UNTESTED %s(%08x, %08x)", __FUNCTION__, countryCodePtr, regionCodePtr); auto countryCode = PSPPointer::Create(countryCodePtr); auto regionCode = PSPPointer::Create(regionCodePtr); if (!countryCode.IsValid() || !regionCode.IsValid()) - return hleLogError(SCENET, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); + return hleLogError(Log::sceNet, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); memset((SceNpCountryCode *)countryCode, 0, sizeof(SceNpCountryCode)); memcpy(countryCode->data, npCountryCode, sizeof(countryCode->data)); memset((SceNpCountryCode *)regionCode, 0, sizeof(SceNpCountryCode)); memcpy(regionCode->data, npRegionCode, sizeof(regionCode->data)); - INFO_LOG(SCENET, "%s - Country Code: %s", __FUNCTION__, countryCode->data); - INFO_LOG(SCENET, "%s - Region? Code: %s", __FUNCTION__, regionCode->data); + INFO_LOG(Log::sceNet, "%s - Country Code: %s", __FUNCTION__, countryCode->data); + INFO_LOG(Log::sceNet, "%s - Region? Code: %s", __FUNCTION__, regionCode->data); countryCode.NotifyWrite("NpGetAccountRegion"); regionCode.NotifyWrite("NpGetAccountRegion"); @@ -221,15 +221,15 @@ static int sceNpGetAccountRegion(u32 countryCodePtr, u32 regionCodePtr) static int sceNpGetMyLanguages(u32 langListPtr) { - WARN_LOG(SCENET, "UNTESTED %s(%08x)", __FUNCTION__, langListPtr); + WARN_LOG(Log::sceNet, "UNTESTED %s(%08x)", __FUNCTION__, langListPtr); auto langList = PSPPointer::Create(langListPtr); if (!langList.IsValid()) - return hleLogError(SCENET, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); + return hleLogError(Log::sceNet, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); - INFO_LOG(SCENET, "%s - Language1 Code: %d", __FUNCTION__, npMyLangList.language1); - INFO_LOG(SCENET, "%s - Language2 Code: %d", __FUNCTION__, npMyLangList.language2); - INFO_LOG(SCENET, "%s - Language3 Code: %d", __FUNCTION__, npMyLangList.language3); + INFO_LOG(Log::sceNet, "%s - Language1 Code: %d", __FUNCTION__, npMyLangList.language1); + INFO_LOG(Log::sceNet, "%s - Language2 Code: %d", __FUNCTION__, npMyLangList.language2); + INFO_LOG(Log::sceNet, "%s - Language3 Code: %d", __FUNCTION__, npMyLangList.language3); *langList = npMyLangList; langList.NotifyWrite("NpGetMyLanguages"); @@ -239,21 +239,21 @@ static int sceNpGetMyLanguages(u32 langListPtr) static int sceNpGetUserProfile(u32 profilePtr) { - WARN_LOG(SCENET, "UNTESTED %s(%08x)", __FUNCTION__, profilePtr); + WARN_LOG(Log::sceNet, "UNTESTED %s(%08x)", __FUNCTION__, profilePtr); auto profile = PSPPointer::Create(profilePtr); if (!Memory::IsValidAddress(profilePtr)) - return hleLogError(SCENET, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); + return hleLogError(Log::sceNet, SCE_NP_ERROR_INVALID_ARGUMENT, "invalid arg"); memset((SceNpUserInformation *)profile, 0, sizeof(SceNpUserInformation)); truncate_cpy(profile->userId.handle.data, sizeof(profile->userId.handle.data), npOnlineId.c_str()); truncate_cpy(profile->icon.data, sizeof(profile->icon.data), npAvatarUrl.c_str()); - INFO_LOG(SCENET, "%s - Online ID: %s", __FUNCTION__, profile->userId.handle.data); + INFO_LOG(Log::sceNet, "%s - Online ID: %s", __FUNCTION__, profile->userId.handle.data); std::string datahex; DataToHexString(profile->userId.opt, sizeof(profile->userId.opt), &datahex); - INFO_LOG(SCENET, "%s - Options?: %s", __FUNCTION__, datahex.c_str()); - INFO_LOG(SCENET, "%s - Avatar URL: %s", __FUNCTION__, profile->icon.data); + INFO_LOG(Log::sceNet, "%s - Options?: %s", __FUNCTION__, datahex.c_str()); + INFO_LOG(Log::sceNet, "%s - Avatar URL: %s", __FUNCTION__, profile->icon.data); profile.NotifyWrite("NpGetUserProfile"); @@ -280,14 +280,14 @@ void Register_sceNp() static int sceNpAuthTerm() { // No parameters - ERROR_LOG(SCENET, "UNIMPL %s()", __FUNCTION__); + ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__); npAuthInited = false; return 0; } static int sceNpAuthInit(u32 poolSize, u32 stackSize, u32 threadPrio) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %d, %d)", __FUNCTION__, poolSize, stackSize, threadPrio); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %d, %d)", __FUNCTION__, poolSize, stackSize, threadPrio); npAuthMemStat.npMemSize = poolSize - 0x20; npAuthMemStat.npMaxMemSize = 0x4050; // Dummy maximum foot print npAuthMemStat.npFreeMemSize = npAuthMemStat.npMemSize; @@ -299,11 +299,11 @@ static int sceNpAuthInit(u32 poolSize, u32 stackSize, u32 threadPrio) int sceNpAuthGetMemoryStat(u32 memStatAddr) { - ERROR_LOG(SCENET, "UNIMPL %s(%08x)", __FUNCTION__, memStatAddr); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x)", __FUNCTION__, memStatAddr); auto memStat = PSPPointer::Create(memStatAddr); if (!memStat.IsValid()) - return hleLogError(SCENET, SCE_NP_AUTH_ERROR_INVALID_ARGUMENT, "invalid arg"); + return hleLogError(Log::sceNet, SCE_NP_AUTH_ERROR_INVALID_ARGUMENT, "invalid arg"); *memStat = npAuthMemStat; memStat.NotifyWrite("NpAuthGetMemoryStat"); @@ -325,21 +325,21 @@ return value >= 0 and <0 seems to be stored at a different location by the game */ int sceNpAuthCreateStartRequest(u32 paramAddr) { - WARN_LOG(SCENET, "UNTESTED %s(%08x) at %08x", __FUNCTION__, paramAddr, currentMIPS->pc); + WARN_LOG(Log::sceNet, "UNTESTED %s(%08x) at %08x", __FUNCTION__, paramAddr, currentMIPS->pc); if (!Memory::IsValidAddress(paramAddr)) - return hleLogError(SCENET, SCE_NP_AUTH_ERROR_INVALID_ARGUMENT, "invalid arg"); + return hleLogError(Log::sceNet, SCE_NP_AUTH_ERROR_INVALID_ARGUMENT, "invalid arg"); SceNpAuthRequestParameter params = {}; int size = Memory::Read_U32(paramAddr); Memory::Memcpy(¶ms, paramAddr, size); npServiceId = Memory::GetCharPointer(params.serviceIdAddr); - INFO_LOG(SCENET, "%s - Max Version: %u.%u", __FUNCTION__, params.version.major, params.version.minor); - INFO_LOG(SCENET, "%s - Service ID: %s", __FUNCTION__, Memory::GetCharPointer(params.serviceIdAddr)); - INFO_LOG(SCENET, "%s - Entitlement ID: %s", __FUNCTION__, Memory::GetCharPointer(params.entitlementIdAddr)); - INFO_LOG(SCENET, "%s - Consumed Count: %d", __FUNCTION__, params.consumedCount); - INFO_LOG(SCENET, "%s - Cookie (size = %d): %s", __FUNCTION__, params.cookieSize, Memory::GetCharPointer(params.cookieAddr)); + INFO_LOG(Log::sceNet, "%s - Max Version: %u.%u", __FUNCTION__, params.version.major, params.version.minor); + INFO_LOG(Log::sceNet, "%s - Service ID: %s", __FUNCTION__, Memory::GetCharPointer(params.serviceIdAddr)); + INFO_LOG(Log::sceNet, "%s - Entitlement ID: %s", __FUNCTION__, Memory::GetCharPointer(params.entitlementIdAddr)); + INFO_LOG(Log::sceNet, "%s - Consumed Count: %d", __FUNCTION__, params.consumedCount); + INFO_LOG(Log::sceNet, "%s - Cookie (size = %d): %s", __FUNCTION__, params.cookieSize, Memory::GetCharPointer(params.cookieAddr)); u32 retval = 0; if (params.size >= 32 && params.ticketCbAddr != 0) { @@ -364,10 +364,10 @@ int sceNpAuthCreateStartRequest(u32 paramAddr) if (!foundHandler && Memory::IsValidAddress(handler.entryPoint)) { npAuthHandlers[retval] = handler; - WARN_LOG(SCENET, "%s - Added handler(%08x, %08x) : %d", __FUNCTION__, handler.entryPoint, handler.argument, retval); + WARN_LOG(Log::sceNet, "%s - Added handler(%08x, %08x) : %d", __FUNCTION__, handler.entryPoint, handler.argument, retval); } else { - ERROR_LOG(SCENET, "%s - Same handler(%08x, %08x) already exists", __FUNCTION__, handler.entryPoint, handler.argument); + ERROR_LOG(Log::sceNet, "%s - Same handler(%08x, %08x) already exists", __FUNCTION__, handler.entryPoint, handler.argument); } // Patapon 3 will only Abort & Destroy AuthRequest if the ID is larger than 0. Is 0 a valid request id? retval++; @@ -388,10 +388,10 @@ int sceNpAuthCreateStartRequest(u32 paramAddr) // JPCSP is using length = 248 for dummy ticket int sceNpAuthGetTicket(u32 requestId, u32 bufferAddr, u32 length) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %08x, %d) at %08x", __FUNCTION__, requestId, bufferAddr, length, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %08x, %d) at %08x", __FUNCTION__, requestId, bufferAddr, length, currentMIPS->pc); if (!Memory::IsValidAddress(bufferAddr)) - return hleLogError(SCENET, SCE_NP_AUTH_ERROR_INVALID_ARGUMENT, "invalid arg"); + return hleLogError(Log::sceNet, SCE_NP_AUTH_ERROR_INVALID_ARGUMENT, "invalid arg"); int result = length; Memory::Memset(bufferAddr, 0, length, "NpAuthGetTicket"); @@ -441,8 +441,8 @@ int sceNpAuthGetTicket(u32 requestId, u32 bufferAddr, u32 length) // Patapon 3 will loop (for each DLC?) through an array of 4+4 bytes, ID addr (pchar) + result (int). Each loop calls this function using the same ticket addr but use different ID addr (arg3) and store the return value in result field (default/initial = -1) int sceNpAuthGetEntitlementById(u32 ticketBufferAddr, u32 ticketLength, u32 entitlementIdAddr, u32 arg4) { - ERROR_LOG(SCENET, "UNIMPL %s(%08x, %d, %08x, %d)", __FUNCTION__, ticketBufferAddr, ticketLength, entitlementIdAddr, arg4); - INFO_LOG(SCENET, "%s - Entitlement ID: %s", __FUNCTION__, Memory::GetCharPointer(entitlementIdAddr)); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x, %d, %08x, %d)", __FUNCTION__, ticketBufferAddr, ticketLength, entitlementIdAddr, arg4); + INFO_LOG(Log::sceNet, "%s - Entitlement ID: %s", __FUNCTION__, Memory::GetCharPointer(entitlementIdAddr)); // Do we return the entitlement through function result? or update the ticket content? or replace the arg3 data with SceNpEntitlement struct? return 1; // dummy value assuming it's a boolean/flag, since we don't know how to return the entitlement result yet @@ -450,7 +450,7 @@ int sceNpAuthGetEntitlementById(u32 ticketBufferAddr, u32 ticketLength, u32 enti int sceNpAuthAbortRequest(int requestId) { - WARN_LOG(SCENET, "UNTESTED %s(%i)", __FUNCTION__, requestId); + WARN_LOG(Log::sceNet, "UNTESTED %s(%i)", __FUNCTION__, requestId); // TODO: Disconnect HTTPS connection & cancel the callback event std::lock_guard npAuthGuard(npAuthEvtMtx); for (auto it = npAuthEvents.begin(); it != npAuthEvents.end(); ) { @@ -462,15 +462,15 @@ int sceNpAuthAbortRequest(int requestId) int sceNpAuthDestroyRequest(int requestId) { - WARN_LOG(SCENET, "UNTESTED %s(%i)", __FUNCTION__, requestId); + WARN_LOG(Log::sceNet, "UNTESTED %s(%i)", __FUNCTION__, requestId); // Remove callback handler int handlerID = requestId - 1; if (npAuthHandlers.find(handlerID) != npAuthHandlers.end()) { npAuthHandlers.erase(handlerID); - WARN_LOG(SCENET, "%s: Deleted handler %d", __FUNCTION__, handlerID); + WARN_LOG(Log::sceNet, "%s: Deleted handler %d", __FUNCTION__, handlerID); } else { - ERROR_LOG(SCENET, "%s: Invalid request ID %d", __FUNCTION__, requestId); + ERROR_LOG(Log::sceNet, "%s: Invalid request ID %d", __FUNCTION__, requestId); } // Patapon 3 is checking for error code 0x80550402 @@ -479,7 +479,7 @@ int sceNpAuthDestroyRequest(int requestId) int sceNpAuthGetTicketParam(u32 ticketBufPtr, int ticketLen, int paramNum, u32 bufferPtr) { - ERROR_LOG(SCENET, "UNIMPL %s(%08x, %0d, %d, %08x) at %08x", __FUNCTION__, ticketBufPtr, ticketLen, paramNum, bufferPtr, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x, %0d, %d, %08x) at %08x", __FUNCTION__, ticketBufPtr, ticketLen, paramNum, bufferPtr, currentMIPS->pc); const u32 PARAM_BUFFER_MAX_SIZE = 256; Memory::Memset(bufferPtr, 0, PARAM_BUFFER_MAX_SIZE); // JPCSP: This clear is always done, even when an error is returned if (paramNum < 0 || paramNum >= NUMBER_PARAMETERS) { @@ -495,7 +495,7 @@ int sceNpAuthGetTicketParam(u32 ticketBufPtr, int ticketLen, int paramNum, u32 b SceNpTicketParamData* ticketParam = (SceNpTicketParamData*)Memory::GetPointer(inbuf); u32 sz = (u32)sizeof(SceNpTicketParamData) + ticketParam->length; Memory::Memcpy(outbuf, inbuf, sz); - DEBUG_LOG(SCENET, "%s - Param #%d: Type = %04x, Length = %u", __FUNCTION__, i, static_cast(ticketParam->type), static_cast(ticketParam->length)); + DEBUG_LOG(Log::sceNet, "%s - Param #%d: Type = %04x, Length = %u", __FUNCTION__, i, static_cast(ticketParam->type), static_cast(ticketParam->length)); outbuf += sz; inbuf += sz; if (outbuf - bufferPtr >= PARAM_BUFFER_MAX_SIZE || inbuf - ticketBufPtr >= (u32)ticketLen) @@ -526,21 +526,21 @@ void Register_sceNpAuth() static int sceNpServiceTerm() { // No parameters - ERROR_LOG(SCENET, "UNIMPL %s()", __FUNCTION__); + ERROR_LOG(Log::sceNet, "UNIMPL %s()", __FUNCTION__); return 0; } static int sceNpServiceInit(u32 poolSize, u32 stackSize, u32 threadPrio) { - ERROR_LOG(SCENET, "UNIMPL %s(%08x, %08x, %08x)", __FUNCTION__, poolSize, stackSize, threadPrio); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x, %08x, %08x)", __FUNCTION__, poolSize, stackSize, threadPrio); return 0; } // FIXME: On Patapon 3 the Arg is pointing to a String, but based on RPCS3 the Arg is an Id integer ? static int sceNpLookupCreateTransactionCtx(u32 lookupTitleCtxIdAddr) { - ERROR_LOG(SCENET, "UNIMPL %s(%08x)", __FUNCTION__, lookupTitleCtxIdAddr); - INFO_LOG(SCENET, "%s - Title ID: %s", __FUNCTION__, Memory::GetCharPointer(lookupTitleCtxIdAddr)); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x)", __FUNCTION__, lookupTitleCtxIdAddr); + INFO_LOG(Log::sceNet, "%s - Title ID: %s", __FUNCTION__, Memory::GetCharPointer(lookupTitleCtxIdAddr)); // Patapon 3 will only Destroy if returned Id > 0. Is 0 a valid id? return 1; // returning dummy transaction id } @@ -548,7 +548,7 @@ static int sceNpLookupCreateTransactionCtx(u32 lookupTitleCtxIdAddr) // transId: id returned from sceNpLookupCreateTransactionCtx static int sceNpLookupDestroyTransactionCtx(s32 transId) { - ERROR_LOG(SCENET, "UNIMPL %s(%d)", __FUNCTION__, transId); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d)", __FUNCTION__, transId); return 0; } @@ -558,7 +558,7 @@ static int sceNpLookupDestroyTransactionCtx(s32 transId) // FIXME: maxSize and contentLength are u64 based on https://github.com/RPCS3/rpcs3/blob/master/rpcs3/Emu/Cell/Modules/sceNp.cpp ? But on Patapon 3 optionAddr will be deadbeef if maxSize is u64 ? static int sceNpLookupTitleSmallStorage(s32 transId, u32 dataAddr, u32 maxSize, u32 contentLengthAddr, u32 optionAddr) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %08x, %d, %08x[%d], %08x) at %08x", __FUNCTION__, transId, dataAddr, maxSize, contentLengthAddr, (Memory::IsValidAddress(contentLengthAddr)? Memory::Read_U32(contentLengthAddr): 0), optionAddr, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %08x, %d, %08x[%d], %08x) at %08x", __FUNCTION__, transId, dataAddr, maxSize, contentLengthAddr, (Memory::IsValidAddress(contentLengthAddr)? Memory::Read_U32(contentLengthAddr): 0), optionAddr, currentMIPS->pc); return 0; } @@ -571,7 +571,7 @@ static int sceNpLookupTitleSmallStorage(s32 transId, u32 dataAddr, u32 maxSize, // There could be more data in the struct? (at least 48-bytes?) static int sceNpRosterCreateRequest(u32 unknownAddr) { - ERROR_LOG(SCENET, "UNIMPL %s(%08x) at %08x", __FUNCTION__, unknownAddr, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x) at %08x", __FUNCTION__, unknownAddr, currentMIPS->pc); return 1; // returning dummy roster id } @@ -584,19 +584,19 @@ static int sceNpRosterCreateRequest(u32 unknownAddr) // unknown6 set to 0 static int sceNpRosterGetFriendListEntry(s32 rosterId, u32 unknown1, u32 unknown2, u32 unknown3Addr, u32 unknown4Addr, u32 unknown5Addr, u32 unknown6) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %08x, %08x, %08x, %08x, %08x, %08x) at %08x", __FUNCTION__, rosterId, unknown1, unknown2, unknown3Addr, unknown4Addr, unknown5Addr, unknown6, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %08x, %08x, %08x, %08x, %08x, %08x) at %08x", __FUNCTION__, rosterId, unknown1, unknown2, unknown3Addr, unknown4Addr, unknown5Addr, unknown6, currentMIPS->pc); return 0; } static int sceNpRosterAbort(s32 rosterId) { - ERROR_LOG(SCENET, "UNIMPL %s(%d) at %08x", __FUNCTION__, rosterId, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d) at %08x", __FUNCTION__, rosterId, currentMIPS->pc); return 0; } static int sceNpRosterDeleteRequest(s32 rosterId) { - ERROR_LOG(SCENET, "UNIMPL %s(%d) at %08x", __FUNCTION__, rosterId, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d) at %08x", __FUNCTION__, rosterId, currentMIPS->pc); return 0; } diff --git a/Core/HLE/sceNp2.cpp b/Core/HLE/sceNp2.cpp index 0bcd0968c5..a03829a23c 100644 --- a/Core/HLE/sceNp2.cpp +++ b/Core/HLE/sceNp2.cpp @@ -54,9 +54,9 @@ void notifyNpMatching2Handlers(NpMatching2Args &args, u32 ctxId, u32 serverId, u static int sceNpMatching2Init(int poolSize, int threadPriority, int cpuAffinityMask, int threadStackSize) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %d, %d, %d) at %08x", __FUNCTION__, poolSize, threadPriority, cpuAffinityMask, threadStackSize, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %d, %d, %d) at %08x", __FUNCTION__, poolSize, threadPriority, cpuAffinityMask, threadStackSize, currentMIPS->pc); //if (npMatching2Inited) - // return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED); + // return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_ALREADY_INITIALIZED); npMatching2MemStat.npMemSize = poolSize - 0x20; npMatching2MemStat.npMaxMemSize = 0x4050; // Dummy maximum foot print @@ -70,7 +70,7 @@ static int sceNpMatching2Init(int poolSize, int threadPriority, int cpuAffinityM static int sceNpMatching2Term() { - ERROR_LOG(SCENET, "UNIMPL %s() at %08x", __FUNCTION__, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s() at %08x", __FUNCTION__, currentMIPS->pc); npMatching2Inited = false; npMatching2Handlers.clear(); npMatching2Events.clear(); @@ -80,12 +80,12 @@ static int sceNpMatching2Term() static int sceNpMatching2CreateContext(u32 communicationIdPtr, u32 passPhrasePtr, u32 ctxIdPtr, int unknown) { - ERROR_LOG(SCENET, "UNIMPL %s(%08x[%s], %08x[%08x], %08x[%hu], %i) at %08x", __FUNCTION__, communicationIdPtr, safe_string(Memory::GetCharPointer(communicationIdPtr)), passPhrasePtr, Memory::Read_U32(passPhrasePtr), ctxIdPtr, Memory::Read_U16(ctxIdPtr), unknown, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x[%s], %08x[%08x], %08x[%hu], %i) at %08x", __FUNCTION__, communicationIdPtr, safe_string(Memory::GetCharPointer(communicationIdPtr)), passPhrasePtr, Memory::Read_U32(passPhrasePtr), ctxIdPtr, Memory::Read_U16(ctxIdPtr), unknown, currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); if (!Memory::IsValidAddress(communicationIdPtr) || !Memory::IsValidAddress(passPhrasePtr) || !Memory::IsValidAddress(ctxIdPtr)) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); // FIXME: It seems Context are mapped to TitleID? may return 0x80550C05 or 0x80550C06 when finding an existing context SceNpCommunicationId* titleid = (SceNpCommunicationId*)Memory::GetCharPointer(communicationIdPtr); @@ -96,16 +96,16 @@ static int sceNpMatching2CreateContext(u32 communicationIdPtr, u32 passPhrasePtr SceNpId npid{}; int retval = NpGetNpId(&npid); if (retval < 0) - return hleLogError(SCENET, retval); + return hleLogError(Log::sceNet, retval); - INFO_LOG(SCENET, "%s - Title ID: %s", __FUNCTION__, titleid->data); - INFO_LOG(SCENET, "%s - Online ID: %s", __FUNCTION__, npid.handle.data); + INFO_LOG(Log::sceNet, "%s - Title ID: %s", __FUNCTION__, titleid->data); + INFO_LOG(Log::sceNet, "%s - Online ID: %s", __FUNCTION__, npid.handle.data); std::string datahex; DataToHexString(npid.opt, sizeof(npid.opt), &datahex); - INFO_LOG(SCENET, "%s - Options?: %s", __FUNCTION__, datahex.c_str()); + INFO_LOG(Log::sceNet, "%s - Options?: %s", __FUNCTION__, datahex.c_str()); datahex.clear(); DataToHexString(10, 0, passph->data, sizeof(passph->data), &datahex); - INFO_LOG(SCENET, "%s - Passphrase: \n%s", __FUNCTION__, datahex.c_str()); + INFO_LOG(Log::sceNet, "%s - Passphrase: \n%s", __FUNCTION__, datahex.c_str()); // TODO: Allocate & zeroed a memory of 68 bytes where npId (36 bytes) is copied to offset 8, offset 44 = 0x00026808, offset 48 = 0 @@ -117,15 +117,15 @@ static int sceNpMatching2CreateContext(u32 communicationIdPtr, u32 passPhrasePtr static int sceNpMatching2ContextStart(int ctxId) { - ERROR_LOG(SCENET, "UNIMPL %s(%d) at %08x", __FUNCTION__, ctxId, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d) at %08x", __FUNCTION__, ctxId, currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); //if (!npMatching2Ctx) - // return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND); //SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID + // return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND); //SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID //if (npMatching2Ctx.started) - // return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_CONTEXT_ALREADY_STARTED); + // return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_CONTEXT_ALREADY_STARTED); // TODO: use sceNpGetUserProfile and check server availability using sceNpService_76867C01 //npMatching2Ctx.started = true; @@ -134,7 +134,7 @@ static int sceNpMatching2ContextStart(int ctxId) bool cancelled = false; net::RequestProgress progress(&cancelled); if (!client.Resolve(url.Host().c_str(), url.Port())) { - return hleLogError(SCENET, SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE, "HTTP failed to resolve %s", url.Resource().c_str()); + return hleLogError(Log::sceNet, SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE, "HTTP failed to resolve %s", url.Resource().c_str()); } client.SetDataTimeout(20.0); @@ -143,12 +143,12 @@ static int sceNpMatching2ContextStart(int ctxId) snprintf(requestHeaders, sizeof(requestHeaders), "User-Agent: PS3Community-agent/1.0.0 libhttp/1.0.0\r\n"); - DEBUG_LOG(SCENET, "GET URI: %s", url.ToString().c_str()); + DEBUG_LOG(Log::sceNet, "GET URI: %s", url.ToString().c_str()); http::RequestParams req(url.Resource(), "*/*"); int err = client.SendRequest("GET", req, requestHeaders, &progress); if (err < 0) { client.Disconnect(); - return hleLogError(SCENET, SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE, "HTTP GET Error = %d", err); + return hleLogError(Log::sceNet, SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE, "HTTP GET Error = %d", err); } net::Buffer readbuf; @@ -156,13 +156,13 @@ static int sceNpMatching2ContextStart(int ctxId) int code = client.ReadResponseHeaders(&readbuf, responseHeaders, &progress); if (code != 200) { client.Disconnect(); - return hleLogError(SCENET, SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE, "HTTP Error Code = %d", code); + return hleLogError(Log::sceNet, SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE, "HTTP Error Code = %d", code); } net::Buffer output; int res = client.ReadResponseEntity(&readbuf, responseHeaders, &output, &progress); if (res != 0) { - WARN_LOG(SCENET, "Unable to read HTTP response entity: %d", res); + WARN_LOG(Log::sceNet, "Unable to read HTTP response entity: %d", res); } client.Disconnect(); @@ -174,19 +174,19 @@ static int sceNpMatching2ContextStart(int ctxId) std::string text; size_t ofs = entity.find("titleid="); if (ofs == std::string::npos) - return hleLogError(SCENET, SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE, "titleid not found"); + return hleLogError(Log::sceNet, SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE, "titleid not found"); ofs += 9; size_t ofs2 = entity.find('"', ofs); text = entity.substr(ofs, ofs2-ofs); - INFO_LOG(SCENET, "%s - Title ID: %s", __FUNCTION__, text.c_str()); + INFO_LOG(Log::sceNet, "%s - Title ID: %s", __FUNCTION__, text.c_str()); int i = 1; while (true) { ofs = entity.find("', ++ofs2); if (ofs == std::string::npos) - return hleLogError(SCENET, SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE, "agent host not found"); + return hleLogError(Log::sceNet, SCE_NP_COMMUNITY_SERVER_ERROR_NO_SUCH_TITLE, "agent host not found"); ofs2 = entity.find("pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d) at %08x", __FUNCTION__, ctxId, currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); //if (!npMatching2Ctx) - // return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND); //SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID + // return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND); //SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID //if (!npMatching2Ctx.started) - // return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED); + // return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_STARTED); //TODO: Stop any in-progress HTTPClient communication used on sceNpMatching2ContextStart //npMatching2Ctx.started = false; @@ -255,21 +255,21 @@ static int sceNpMatching2ContextStop(int ctxId) static int sceNpMatching2DestroyContext(int ctxId) { - ERROR_LOG(SCENET, "UNIMPL %s(%d) at %08x", __FUNCTION__, ctxId, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d) at %08x", __FUNCTION__, ctxId, currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); //if (!npMatching2Ctx) - // return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND); //SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID + // return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_CONTEXT_NOT_FOUND); //SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID // Remove callback handler int handlerID = ctxId - 1; if (npMatching2Handlers.find(handlerID) != npMatching2Handlers.end()) { npMatching2Handlers.erase(handlerID); - WARN_LOG(SCENET, "%s: Deleted handler %d", __FUNCTION__, handlerID); + WARN_LOG(Log::sceNet, "%s: Deleted handler %d", __FUNCTION__, handlerID); } else { - ERROR_LOG(SCENET, "%s: Invalid Context ID %d", __FUNCTION__, ctxId); + ERROR_LOG(Log::sceNet, "%s: Invalid Context ID %d", __FUNCTION__, ctxId); } return 0; @@ -277,13 +277,13 @@ static int sceNpMatching2DestroyContext(int ctxId) static int sceNpMatching2GetMemoryStat(u32 memStatPtr) { - ERROR_LOG(SCENET, "UNIMPL %s(%08x) at %08x", __FUNCTION__, memStatPtr, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%08x) at %08x", __FUNCTION__, memStatPtr, currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); auto memStat = PSPPointer::Create(memStatPtr); if (!memStat.IsValid()) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT); *memStat = npMatching2MemStat; memStat.NotifyWrite("NpMatching2GetMemoryStat"); @@ -293,12 +293,12 @@ static int sceNpMatching2GetMemoryStat(u32 memStatPtr) static int sceNpMatching2RegisterSignalingCallback(int ctxId, u32 callbackFunctionAddr, u32 callbackArgument) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %08x, %08x) at %08x", __FUNCTION__, ctxId, callbackFunctionAddr, callbackArgument, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %08x, %08x) at %08x", __FUNCTION__, ctxId, callbackFunctionAddr, callbackArgument, currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); if (ctxId <= 0) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_INVALID_CONTEXT_ID); int id = ctxId - 1; if (callbackFunctionAddr != 0) { @@ -320,10 +320,10 @@ static int sceNpMatching2RegisterSignalingCallback(int ctxId, u32 callbackFuncti if (!foundHandler && Memory::IsValidAddress(handler.entryPoint)) { npMatching2Handlers[id] = handler; - WARN_LOG(SCENET, "%s - Added handler(%08x, %08x) : %d", __FUNCTION__, handler.entryPoint, handler.argument, id); + WARN_LOG(Log::sceNet, "%s - Added handler(%08x, %08x) : %d", __FUNCTION__, handler.entryPoint, handler.argument, id); } else { - ERROR_LOG(SCENET, "%s - Same handler(%08x, %08x) already exists", __FUNCTION__, handler.entryPoint, handler.argument); + ERROR_LOG(Log::sceNet, "%s - Same handler(%08x, %08x) already exists", __FUNCTION__, handler.entryPoint, handler.argument); } //u32 dataLength = 4097; @@ -337,12 +337,12 @@ static int sceNpMatching2RegisterSignalingCallback(int ctxId, u32 callbackFuncti static int sceNpMatching2GetServerIdListLocal(int ctxId, u32 serverIdsPtr, int maxServerIds) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %08x, %d) at %08x", __FUNCTION__, ctxId, serverIdsPtr, maxServerIds, currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %08x, %d) at %08x", __FUNCTION__, ctxId, serverIdsPtr, maxServerIds, currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); if (!Memory::IsValidAddress(serverIdsPtr)) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT); // Returning dummy Id, a 16-bit variable according to JPCSP for (int i = 0; i < maxServerIds; i++) @@ -354,18 +354,18 @@ static int sceNpMatching2GetServerIdListLocal(int ctxId, u32 serverIdsPtr, int m // Unknown1 = optParam, unknown2 = assignedReqId according to https://github.com/RPCS3/rpcs3/blob/master/rpcs3/Emu/Cell/Modules/sceNp2.cpp ? static int sceNpMatching2GetServerInfo(int ctxId, u32 serverIdPtr, u32 unknown1Ptr, u32 unknown2Ptr) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %08x[%d], %08x, %08x[%08x]) at %08x", __FUNCTION__, ctxId, serverIdPtr, Memory::Read_U16(serverIdPtr), unknown1Ptr, unknown2Ptr, Memory::Read_U32(unknown2Ptr), currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %08x[%d], %08x, %08x[%08x]) at %08x", __FUNCTION__, ctxId, serverIdPtr, Memory::Read_U16(serverIdPtr), unknown1Ptr, unknown2Ptr, Memory::Read_U32(unknown2Ptr), currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); if (!Memory::IsValidAddress(serverIdPtr) || !Memory::IsValidAddress(unknown2Ptr)) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); // Should be SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT ? + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); // Should be SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT ? // Server ID is a 16-bit variable according to JPCSP int serverId = Memory::Read_U16(serverIdPtr); if (serverId == 0) - return hleLogError(SCENET, 0x80550CBF); // Should be SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID ? + return hleLogError(Log::sceNet, 0x80550CBF); // Should be SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID ? // Output to unknown1(infoBuffer)? and unknown2(infoLength or flags)? // Patapon 3 is using serverId at 09FFF2F4, unknown1 at 09FFF2E4, unknown2 at 09FFF2E0, which mean unknown1's can only fit upto 16-bytes @@ -416,12 +416,12 @@ static int sceNpMatching2GetServerInfo(int ctxId, u32 serverIdPtr, u32 unknown1P static int sceNpMatching2LeaveRoom(int ctxId, u32 reqParamPtr, u32 optParamPtr, u32 assignedReqIdPtr) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %08x, %08x, %08x[%08x]) at %08x", __FUNCTION__, ctxId, reqParamPtr, optParamPtr, assignedReqIdPtr, Memory::Read_U32(assignedReqIdPtr), currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %08x, %08x, %08x[%08x]) at %08x", __FUNCTION__, ctxId, reqParamPtr, optParamPtr, assignedReqIdPtr, Memory::Read_U32(assignedReqIdPtr), currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); if (!Memory::IsValidAddress(reqParamPtr) || !Memory::IsValidAddress(assignedReqIdPtr)) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); // Should be SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT ? + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); // Should be SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT ? u32 cbFunc = Memory::Read_U32(reqParamPtr); u32 cbArg = Memory::Read_U32(reqParamPtr + 0x04); @@ -450,18 +450,18 @@ static int sceNpMatching2LeaveRoom(int ctxId, u32 reqParamPtr, u32 optParamPtr, static int sceNpMatching2JoinRoom(int ctxId, u32 reqParamPtr, u32 optParamPtr, u32 unknown1, u32 unknown2, u32 assignedReqIdPtr) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %08x, %08x, %08x[%08x]) at %08x", __FUNCTION__, ctxId, reqParamPtr, optParamPtr, assignedReqIdPtr, Memory::Read_U32(assignedReqIdPtr), currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %08x, %08x, %08x[%08x]) at %08x", __FUNCTION__, ctxId, reqParamPtr, optParamPtr, assignedReqIdPtr, Memory::Read_U32(assignedReqIdPtr), currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); if (!Memory::IsValidAddress(reqParamPtr) || !Memory::IsValidAddress(assignedReqIdPtr)) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); // Should be SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT ? + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); // Should be SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT ? // Server ID is a 16-bit variable according to JPCSP int serverId = Memory::Read_U16(reqParamPtr + 0x06); if (serverId == 0) - return hleLogError(SCENET, 0x80550CBF); // Should be SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID ? + return hleLogError(Log::sceNet, 0x80550CBF); // Should be SCE_NP_MATCHING2_ERROR_INVALID_SERVER_ID ? u32 cbFunc = Memory::Read_U32(reqParamPtr); u32 cbArg = Memory::Read_U32(reqParamPtr + 0x04); @@ -493,12 +493,12 @@ static int sceNpMatching2JoinRoom(int ctxId, u32 reqParamPtr, u32 optParamPtr, u static int sceNpMatching2SearchRoom(int ctxId, u32 reqParamPtr, u32 optParamPtr, u32 assignedReqIdPtr) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %08x, %08x, %08x[%08x]) at %08x", __FUNCTION__, ctxId, reqParamPtr, optParamPtr, assignedReqIdPtr, Memory::Read_U32(assignedReqIdPtr), currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %08x, %08x, %08x[%08x]) at %08x", __FUNCTION__, ctxId, reqParamPtr, optParamPtr, assignedReqIdPtr, Memory::Read_U32(assignedReqIdPtr), currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); if (!Memory::IsValidAddress(reqParamPtr) || !Memory::IsValidAddress(assignedReqIdPtr)) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); // Should be SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT ? + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); // Should be SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT ? u32 cbFunc = Memory::Read_U32(reqParamPtr); u32 cbArg = Memory::Read_U32(reqParamPtr + 0x04); @@ -517,12 +517,12 @@ static int sceNpMatching2SearchRoom(int ctxId, u32 reqParamPtr, u32 optParamPtr, static int sceNpMatching2SendRoomChatMessage(int ctxId, u32 reqParamPtr, u32 optParamPtr, u32 assignedReqIdPtr) { - ERROR_LOG(SCENET, "UNIMPL %s(%d, %08x, %08x, %08x[%08x]) at %08x", __FUNCTION__, ctxId, reqParamPtr, optParamPtr, assignedReqIdPtr, Memory::Read_U32(assignedReqIdPtr), currentMIPS->pc); + ERROR_LOG(Log::sceNet, "UNIMPL %s(%d, %08x, %08x, %08x[%08x]) at %08x", __FUNCTION__, ctxId, reqParamPtr, optParamPtr, assignedReqIdPtr, Memory::Read_U32(assignedReqIdPtr), currentMIPS->pc); if (!npMatching2Inited) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_NOT_INITIALIZED); if (!Memory::IsValidAddress(reqParamPtr) || !Memory::IsValidAddress(assignedReqIdPtr)) - return hleLogError(SCENET, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); // Should be SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT ? + return hleLogError(Log::sceNet, SCE_NP_MATCHING2_ERROR_CONTEXT_MAX); // Should be SCE_NP_MATCHING2_ERROR_INVALID_ARGUMENT ? u32 cbFunc = Memory::Read_U32(reqParamPtr); u32 cbArg = Memory::Read_U32(reqParamPtr + 0x04); diff --git a/Core/HLE/sceOpenPSID.cpp b/Core/HLE/sceOpenPSID.cpp index f15b7bc142..62def434e6 100644 --- a/Core/HLE/sceOpenPSID.cpp +++ b/Core/HLE/sceOpenPSID.cpp @@ -37,7 +37,7 @@ void __OpenPSIDShutdown() { static int sceOpenPSIDGetOpenPSID(u32 OpenPSIDPtr) { - WARN_LOG(HLE, "UNTESTED %s(%08x)", __FUNCTION__, OpenPSIDPtr); + WARN_LOG(Log::HLE, "UNTESTED %s(%08x)", __FUNCTION__, OpenPSIDPtr); auto ptr = PSPPointer::Create(OpenPSIDPtr); if (ptr.IsValid()) { @@ -49,7 +49,7 @@ static int sceOpenPSIDGetOpenPSID(u32 OpenPSIDPtr) static int sceOpenPSIDGetPSID(u32 OpenPSIDPtr,u32 unknown) { - WARN_LOG(HLE, "UNTESTED %s(%08x, %08x)", __FUNCTION__, OpenPSIDPtr, unknown); + WARN_LOG(Log::HLE, "UNTESTED %s(%08x, %08x)", __FUNCTION__, OpenPSIDPtr, unknown); auto ptr = PSPPointer::Create(OpenPSIDPtr); if (ptr.IsValid()) { @@ -74,14 +74,14 @@ Returns: 0 on success, otherwise < 0. */ static s32 sceDdrdb_F013F8BF(u32 pDataPtr, u32 pSigPtr) { - ERROR_LOG(HLE, "UNIMPL %s(%08x, %08x)", __FUNCTION__, pDataPtr, pSigPtr); + ERROR_LOG(Log::HLE, "UNIMPL %s(%08x, %08x)", __FUNCTION__, pDataPtr, pSigPtr); return 0; } // unkPtr might be a pointer to OpenPSID static s32 sceOpenPSIDGetProductCode(u32 unkPtr) { - ERROR_LOG_REPORT(HLE, "UNIMPL %s(%08x)", __FUNCTION__, unkPtr); + ERROR_LOG_REPORT(Log::HLE, "UNIMPL %s(%08x)", __FUNCTION__, unkPtr); return 0; } diff --git a/Core/HLE/sceP3da.cpp b/Core/HLE/sceP3da.cpp index e9cd6aa1c4..706b891057 100644 --- a/Core/HLE/sceP3da.cpp +++ b/Core/HLE/sceP3da.cpp @@ -24,13 +24,13 @@ static u32 sceP3daBridgeInit(u32 channelsNum, u32 samplesNum) { - ERROR_LOG_REPORT(SCEAUDIO, "UNIMPL sceP3daBridgeInit(%08x, %08x)", channelsNum, samplesNum); + ERROR_LOG_REPORT(Log::sceAudio, "UNIMPL sceP3daBridgeInit(%08x, %08x)", channelsNum, samplesNum); return 0; } static u32 sceP3daBridgeExit() { - ERROR_LOG_REPORT(SCEAUDIO, "UNIMPL sceP3daBridgeExit()"); + ERROR_LOG_REPORT(Log::sceAudio, "UNIMPL sceP3daBridgeExit()"); return 0; } @@ -45,7 +45,7 @@ static inline int getScaleValue(u32 channelsNum) { static u32 sceP3daBridgeCore(u32 p3daCoreAddr, u32 channelsNum, u32 samplesNum, u32 inputAddr, u32 outputAddr) { - DEBUG_LOG(SCEAUDIO, "sceP3daBridgeCore(%08x, %08x, %08x, %08x, %08x)", p3daCoreAddr, channelsNum, samplesNum, inputAddr, outputAddr); + DEBUG_LOG(Log::sceAudio, "sceP3daBridgeCore(%08x, %08x, %08x, %08x, %08x)", p3daCoreAddr, channelsNum, samplesNum, inputAddr, outputAddr); if (Memory::IsValidAddress(inputAddr) && Memory::IsValidAddress(outputAddr)) { int scaleval = getScaleValue(channelsNum); s16_le *outbuf = (s16_le *)Memory::GetPointerWriteUnchecked(outputAddr); diff --git a/Core/HLE/scePauth.cpp b/Core/HLE/scePauth.cpp index 705f6aeeaf..a9915e9ebc 100644 --- a/Core/HLE/scePauth.cpp +++ b/Core/HLE/scePauth.cpp @@ -36,7 +36,7 @@ static int scePauth_F7AA47F6(u32 srcPtr, int srcLength, u32 destLengthPtr, u32 w if (decryptResult < 0) { - ERROR_LOG(HLE, "Pauth decryption failed 0x%08X", decryptResult); + ERROR_LOG(Log::HLE, "Pauth decryption failed 0x%08X", decryptResult); return decryptResult; } @@ -53,7 +53,7 @@ static int scePauth_98B83B5D(u32 srcPtr, int srcLength, u32 destLengthPtr, u32 w if (decryptResult < 0) { - ERROR_LOG(HLE, "Pauth decryption failed 0x%08X", decryptResult); + ERROR_LOG(Log::HLE, "Pauth decryption failed 0x%08X", decryptResult); return decryptResult; } diff --git a/Core/HLE/scePower.cpp b/Core/HLE/scePower.cpp index d6fc4fd0aa..95c9d19c6f 100644 --- a/Core/HLE/scePower.cpp +++ b/Core/HLE/scePower.cpp @@ -165,49 +165,49 @@ void __PowerDoState(PointerWrap &p) { } static int scePowerGetBatteryLifePercent() { - DEBUG_LOG(HLE, "100=scePowerGetBatteryLifePercent"); + DEBUG_LOG(Log::HLE, "100=scePowerGetBatteryLifePercent"); return 100; } static int scePowerGetBatteryLifeTime() { - DEBUG_LOG(HLE, "0=scePowerGetBatteryLifeTime()"); + DEBUG_LOG(Log::HLE, "0=scePowerGetBatteryLifeTime()"); // 0 means we're on AC power. return 0; } static int scePowerGetBatteryTemp() { - DEBUG_LOG(HLE, "0=scePowerGetBatteryTemp()"); + DEBUG_LOG(Log::HLE, "0=scePowerGetBatteryTemp()"); // 0 means celsius temperature of the battery return 0; } static int scePowerIsPowerOnline() { - DEBUG_LOG(HLE, "1=scePowerIsPowerOnline"); + DEBUG_LOG(Log::HLE, "1=scePowerIsPowerOnline"); return 1; } static int scePowerIsBatteryExist() { - DEBUG_LOG(HLE, "1=scePowerIsBatteryExist"); + DEBUG_LOG(Log::HLE, "1=scePowerIsBatteryExist"); return 1; } static int scePowerIsBatteryCharging() { - DEBUG_LOG(HLE, "0=scePowerIsBatteryCharging"); + DEBUG_LOG(Log::HLE, "0=scePowerIsBatteryCharging"); return 0; } static int scePowerGetBatteryChargingStatus() { - DEBUG_LOG(HLE, "0=scePowerGetBatteryChargingStatus"); + DEBUG_LOG(Log::HLE, "0=scePowerGetBatteryChargingStatus"); return 0; } static int scePowerIsLowBattery() { - DEBUG_LOG(HLE, "0=scePowerIsLowBattery"); + DEBUG_LOG(Log::HLE, "0=scePowerIsLowBattery"); return 0; } static int scePowerRegisterCallback(int slot, int cbId) { - DEBUG_LOG(HLE, "0=scePowerRegisterCallback(%i, %i)", slot, cbId); + DEBUG_LOG(Log::HLE, "0=scePowerRegisterCallback(%i, %i)", slot, cbId); if (slot < -1 || slot >= numberOfCBPowerSlotsPrivate) { return PSP_POWER_ERROR_INVALID_SLOT; @@ -248,7 +248,7 @@ static int scePowerRegisterCallback(int slot, int cbId) { } static int scePowerUnregisterCallback(int slotId) { - DEBUG_LOG(HLE, "0=scePowerUnregisterCallback(%i)", slotId); + DEBUG_LOG(Log::HLE, "0=scePowerUnregisterCallback(%i)", slotId); if (slotId < 0 || slotId >= numberOfCBPowerSlotsPrivate) { return PSP_POWER_ERROR_INVALID_SLOT; @@ -259,7 +259,7 @@ static int scePowerUnregisterCallback(int slotId) { if (powerCbSlots[slotId] != 0) { int cbId = powerCbSlots[slotId]; - DEBUG_LOG(HLE, "0=scePowerUnregisterCallback(%i) (cbid = %i)", slotId, cbId); + DEBUG_LOG(Log::HLE, "0=scePowerUnregisterCallback(%i) (cbid = %i)", slotId, cbId); powerCbSlots[slotId] = 0; } else { return PSP_POWER_ERROR_EMPTY_SLOT; @@ -269,7 +269,7 @@ static int scePowerUnregisterCallback(int slotId) { } static int sceKernelPowerLock(int lockType) { - DEBUG_LOG(HLE, "0=sceKernelPowerLock(%i)", lockType); + DEBUG_LOG(Log::HLE, "0=sceKernelPowerLock(%i)", lockType); if (lockType == 0) { return 0; } else { @@ -278,7 +278,7 @@ static int sceKernelPowerLock(int lockType) { } static int sceKernelPowerUnlock(int lockType) { - DEBUG_LOG(HLE, "0=sceKernelPowerUnlock(%i)", lockType); + DEBUG_LOG(Log::HLE, "0=sceKernelPowerUnlock(%i)", lockType); if (lockType == 0) { return 0; } else { @@ -287,7 +287,7 @@ static int sceKernelPowerUnlock(int lockType) { } static int sceKernelPowerTick(int flag) { - DEBUG_LOG(HLE, "UNIMPL 0=sceKernelPowerTick(%i)", flag); + DEBUG_LOG(Log::HLE, "UNIMPL 0=sceKernelPowerTick(%i)", flag); return 0; } @@ -323,15 +323,15 @@ static int sceKernelVolatileMemTryLock(int type, u32 paddr, u32 psize) { // and with that it's still broken. So it's not this, unfortunately. // Leaving it in for the 0.9.8 release anyway. hleEatCycles(500000); - DEBUG_LOG(HLE, "sceKernelVolatileMemTryLock(%i, %08x, %08x) - success", type, paddr, psize); + DEBUG_LOG(Log::HLE, "sceKernelVolatileMemTryLock(%i, %08x, %08x) - success", type, paddr, psize); break; case SCE_KERNEL_ERROR_POWER_VMEM_IN_USE: - ERROR_LOG(HLE, "sceKernelVolatileMemTryLock(%i, %08x, %08x) - already locked!", type, paddr, psize); + ERROR_LOG(Log::HLE, "sceKernelVolatileMemTryLock(%i, %08x, %08x) - already locked!", type, paddr, psize); break; default: - ERROR_LOG_REPORT(HLE, "%08x=sceKernelVolatileMemTryLock(%i, %08x, %08x) - error", type, paddr, psize, error); + ERROR_LOG_REPORT(Log::HLE, "%08x=sceKernelVolatileMemTryLock(%i, %08x, %08x) - error", type, paddr, psize, error); break; } @@ -365,7 +365,7 @@ int KernelVolatileMemUnlock(int type) { } if (wokeThreads) { - INFO_LOG(HLE, "KernelVolatileMemUnlock(%i) handed over to another thread", type); + INFO_LOG(Log::HLE, "KernelVolatileMemUnlock(%i) handed over to another thread", type); hleReSchedule("volatile mem unlocked"); } return 0; @@ -374,14 +374,14 @@ int KernelVolatileMemUnlock(int type) { static int sceKernelVolatileMemUnlock(int type) { int error = KernelVolatileMemUnlock(type); if (error == SCE_KERNEL_ERROR_INVALID_MODE) { - ERROR_LOG_REPORT(HLE, "sceKernelVolatileMemUnlock(%i) - invalid mode", type); + ERROR_LOG_REPORT(Log::HLE, "sceKernelVolatileMemUnlock(%i) - invalid mode", type); return error; } else if (error == SCE_KERNEL_ERROR_SEMA_OVF) { - ERROR_LOG_REPORT(HLE, "sceKernelVolatileMemUnlock(%i) FAILED - not locked", type); + ERROR_LOG_REPORT(Log::HLE, "sceKernelVolatileMemUnlock(%i) FAILED - not locked", type); return error; } - return hleLogSuccessI(HLE, 0); + return hleLogSuccessI(Log::HLE, 0); } static int sceKernelVolatileMemLock(int type, u32 paddr, u32 psize) { @@ -401,12 +401,12 @@ static int sceKernelVolatileMemLock(int type, u32 paddr, u32 psize) { case 0: // Should only wait 1200 cycles though according to Unknown's testing, hleEatCycles(1200); - DEBUG_LOG(HLE, "sceKernelVolatileMemLock(%i, %08x, %08x) - success", type, paddr, psize); + DEBUG_LOG(Log::HLE, "sceKernelVolatileMemLock(%i, %08x, %08x) - success", type, paddr, psize); break; case SCE_KERNEL_ERROR_POWER_VMEM_IN_USE: { - WARN_LOG(HLE, "sceKernelVolatileMemLock(%i, %08x, %08x) - already locked, waiting", type, paddr, psize); + WARN_LOG(Log::HLE, "sceKernelVolatileMemLock(%i, %08x, %08x) - already locked, waiting", type, paddr, psize); const VolatileWaitingThread waitInfo = { __KernelGetCurThread(), paddr, psize }; volatileWaitingThreads.push_back(waitInfo); __KernelWaitCurThread(WAITTYPE_VMEM, 1, 0, 0, false, "volatile mem waited"); @@ -415,7 +415,7 @@ static int sceKernelVolatileMemLock(int type, u32 paddr, u32 psize) { case SCE_KERNEL_ERROR_CAN_NOT_WAIT: { - WARN_LOG(HLE, "sceKernelVolatileMemLock(%i, %08x, %08x): dispatch disabled", type, paddr, psize); + WARN_LOG(Log::HLE, "sceKernelVolatileMemLock(%i, %08x, %08x): dispatch disabled", type, paddr, psize); Memory::Write_U32(0x08400000, paddr); Memory::Write_U32(0x00400000, psize); } @@ -423,14 +423,14 @@ static int sceKernelVolatileMemLock(int type, u32 paddr, u32 psize) { case SCE_KERNEL_ERROR_ILLEGAL_CONTEXT: { - WARN_LOG(HLE, "sceKernelVolatileMemLock(%i, %08x, %08x): in interrupt", type, paddr, psize); + WARN_LOG(Log::HLE, "sceKernelVolatileMemLock(%i, %08x, %08x): in interrupt", type, paddr, psize); Memory::Write_U32(0x08400000, paddr); Memory::Write_U32(0x00400000, psize); } break; default: - ERROR_LOG_REPORT(HLE, "%08x=sceKernelVolatileMemLock(%i, %08x, %08x) - error", type, paddr, psize, error); + ERROR_LOG_REPORT(Log::HLE, "%08x=sceKernelVolatileMemLock(%i, %08x, %08x) - error", type, paddr, psize, error); break; } @@ -441,19 +441,19 @@ static int sceKernelVolatileMemLock(int type, u32 paddr, u32 psize) { static u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) { // 190 might (probably) be a typo for 19, but it's what the actual PSP validates against. if (pllfreq < 19 || pllfreq < cpufreq || pllfreq > 333) { - return hleLogWarning(SCEMISC, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid pll frequency"); + return hleLogWarning(Log::sceMisc, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid pll frequency"); } if (cpufreq == 0 || cpufreq > 333) { - return hleLogWarning(SCEMISC, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid cpu frequency"); + return hleLogWarning(Log::sceMisc, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid cpu frequency"); } if (busfreq == 0 || busfreq > 166) { - return hleLogWarning(SCEMISC, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid bus frequency"); + return hleLogWarning(Log::sceMisc, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid bus frequency"); } // TODO: More restrictions. if (GetLockedCPUSpeedMhz() > 0) { - INFO_LOG(HLE, "scePowerSetClockFrequency(%i,%i,%i): locked by user config at %i, %i, %i", pllfreq, cpufreq, busfreq, GetLockedCPUSpeedMhz(), GetLockedCPUSpeedMhz(), busFreq); + INFO_LOG(Log::HLE, "scePowerSetClockFrequency(%i,%i,%i): locked by user config at %i, %i, %i", pllfreq, cpufreq, busfreq, GetLockedCPUSpeedMhz(), GetLockedCPUSpeedMhz(), busFreq); } else { - INFO_LOG(HLE, "scePowerSetClockFrequency(%i,%i,%i)", pllfreq, cpufreq, busfreq); + INFO_LOG(Log::HLE, "scePowerSetClockFrequency(%i,%i,%i)", pllfreq, cpufreq, busfreq); } // Only reschedules when the stepped PLL frequency changes. // It seems like the busfreq parameter has no effect (but can cause errors.) @@ -485,21 +485,21 @@ static u32 scePowerSetClockFrequency(u32 pllfreq, u32 cpufreq, u32 busfreq) { static u32 scePowerSetCpuClockFrequency(u32 cpufreq) { if (cpufreq == 0 || cpufreq > 333) { - return hleLogWarning(SCEMISC, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid frequency"); + return hleLogWarning(Log::sceMisc, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid frequency"); } if (GetLockedCPUSpeedMhz() > 0) { - return hleLogDebug(SCEMISC, 0, "locked by user config at %i", GetLockedCPUSpeedMhz()); + return hleLogDebug(Log::sceMisc, 0, "locked by user config at %i", GetLockedCPUSpeedMhz()); } CoreTiming::SetClockFrequencyHz(PowerCpuMhzToHz(cpufreq, pllFreq)); - return hleLogSuccessI(SCEMISC, 0); + return hleLogSuccessI(Log::sceMisc, 0); } static u32 scePowerSetBusClockFrequency(u32 busfreq) { if (busfreq == 0 || busfreq > 111) { - return hleLogWarning(SCEMISC, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid frequency"); + return hleLogWarning(Log::sceMisc, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid frequency"); } if (GetLockedCPUSpeedMhz() > 0) { - return hleLogDebug(SCEMISC, 0, "locked by user config at %i", GetLockedCPUSpeedMhz() / 2); + return hleLogDebug(Log::sceMisc, 0, "locked by user config at %i", GetLockedCPUSpeedMhz() / 2); } // The value passed is validated, but then doesn't seem to matter for the result. @@ -516,47 +516,47 @@ static u32 scePowerSetBusClockFrequency(u32 busfreq) { else busFreq = pllFreq / 2; - return hleLogSuccessI(SCEMISC, 0); + return hleLogSuccessI(Log::sceMisc, 0); } static u32 scePowerGetCpuClockFrequencyInt() { int cpuFreq = CoreTiming::GetClockFrequencyHz() / 1000000; - return hleLogSuccessI(SCEMISC, cpuFreq); + return hleLogSuccessI(Log::sceMisc, cpuFreq); } static u32 scePowerGetPllClockFrequencyInt() { - return hleLogSuccessInfoI(SCEMISC, pllFreq / 1000000); + return hleLogSuccessInfoI(Log::sceMisc, pllFreq / 1000000); } static u32 scePowerGetBusClockFrequencyInt() { - return hleLogSuccessInfoI(SCEMISC, busFreq / 1000000); + return hleLogSuccessInfoI(Log::sceMisc, busFreq / 1000000); } static float scePowerGetCpuClockFrequencyFloat() { float cpuFreq = CoreTiming::GetClockFrequencyHz() / 1000000.0f; - DEBUG_LOG(SCEMISC, "%f=scePowerGetCpuClockFrequencyFloat()", (float)cpuFreq); + DEBUG_LOG(Log::sceMisc, "%f=scePowerGetCpuClockFrequencyFloat()", (float)cpuFreq); return cpuFreq; } static float scePowerGetPllClockFrequencyFloat() { - INFO_LOG(SCEMISC, "%f=scePowerGetPllClockFrequencyFloat()", (float)pllFreq / 1000000.0f); + INFO_LOG(Log::sceMisc, "%f=scePowerGetPllClockFrequencyFloat()", (float)pllFreq / 1000000.0f); return (float) pllFreq / 1000000.0f; } static float scePowerGetBusClockFrequencyFloat() { - INFO_LOG(SCEMISC, "%f=scePowerGetBusClockFrequencyFloat()", (float)busFreq / 1000000.0f); + INFO_LOG(Log::sceMisc, "%f=scePowerGetBusClockFrequencyFloat()", (float)busFreq / 1000000.0f); return (float) busFreq / 1000000.0f; } static int scePowerTick() { - DEBUG_LOG(SCEMISC, "scePowerTick()"); + DEBUG_LOG(Log::sceMisc, "scePowerTick()"); // Don't think we need to do anything. return 0; } static u32 IsPSPNonFat() { - DEBUG_LOG(SCEMISC, "%d=scePower_a85880d0_IsPSPNonFat()", g_Config.iPSPModel); + DEBUG_LOG(Log::sceMisc, "%d=scePower_a85880d0_IsPSPNonFat()", g_Config.iPSPModel); return g_Config.iPSPModel; } diff --git a/Core/HLE/scePsmf.cpp b/Core/HLE/scePsmf.cpp index d3057e5ed8..19c0a481c9 100644 --- a/Core/HLE/scePsmf.cpp +++ b/Core/HLE/scePsmf.cpp @@ -306,7 +306,7 @@ public: const u32 EP_MAP_STRIDE = 1 + 1 + 4 + 4; if (psmf->headerOffset != 0 && !Memory::IsValidRange(psmf->headerOffset, psmf->EPMapOffset + EP_MAP_STRIDE * psmf->EPMapEntriesNum)) { - ERROR_LOG(ME, "Invalid PSMF EP map entry count: %d", psmf->EPMapEntriesNum); + ERROR_LOG(Log::ME, "Invalid PSMF EP map entry count: %d", psmf->EPMapEntriesNum); psmf->EPMapEntriesNum = Memory::ValidSize(psmf->headerOffset + psmf->EPMapOffset, EP_MAP_STRIDE * psmf->EPMapEntriesNum) / EP_MAP_STRIDE; } @@ -322,7 +322,7 @@ public: psmf->EPMap.push_back(entry); } - INFO_LOG(ME, "PSMF MPEG data found: id=%02x, privid=%02x, epmoff=%08x, epmnum=%08x, width=%i, height=%i", streamId, privateStreamId, psmf->EPMapOffset, psmf->EPMapEntriesNum, psmf->videoWidth, psmf->videoHeight); + INFO_LOG(Log::ME, "PSMF MPEG data found: id=%02x, privid=%02x, epmoff=%08x, epmnum=%08x, width=%i, height=%i", streamId, privateStreamId, psmf->EPMapOffset, psmf->EPMapEntriesNum, psmf->videoWidth, psmf->videoHeight); } void readPrivateAudioStreamParams(const u8 *addr, Psmf *psmf) { @@ -332,7 +332,7 @@ public: // Note: "frequency" is usually 2. But that's what scePsmfGetAudioInfo() writes too. audioFrequency_ = addr[15]; // two unknowns here - INFO_LOG(ME, "PSMF private audio found: id=%02x, privid=%02x, channels=%i, freq=%i", streamId, privateStreamId, psmf->audioChannels, psmf->audioFrequency); + INFO_LOG(Log::ME, "PSMF private audio found: id=%02x, privid=%02x, channels=%i, freq=%i", streamId, privateStreamId, psmf->audioChannels, psmf->audioFrequency); } bool matchesType(int ty) { @@ -386,7 +386,7 @@ Psmf::Psmf(const u8 *ptr, u32 data) { currentStreamChannel = -1; if (data != 0 && !Memory::IsValidRange(data, 0x82 + numStreams * 16)) { - ERROR_LOG(ME, "Invalid PSMF stream count: %d", numStreams); + ERROR_LOG(Log::ME, "Invalid PSMF stream count: %d", numStreams); numStreams = Memory::ValidSize(data + 0x82, numStreams * 16) / 16; } @@ -401,7 +401,7 @@ Psmf::Psmf(const u8 *ptr, u32 data) { int type = PSMF_ATRAC_STREAM; int privateStreamId = currentStreamAddr[1]; if ((privateStreamId & 0xF0) != 0) { - WARN_LOG_REPORT(ME, "Unknown private stream type, assuming PCM: %02x", privateStreamId); + WARN_LOG_REPORT(Log::ME, "Unknown private stream type, assuming PCM: %02x", privateStreamId); type = PSMF_PCM_STREAM; } stream = new PsmfStream(type, privateStreamId & 0x0F); @@ -758,22 +758,22 @@ static void DelayPsmfStateChange(u32 psmfPlayer, u32 newState, s64 delayUs) { static u32 scePsmfSetPsmf(u32 psmfStruct, u32 psmfData) { if (!Memory::IsValidAddress(psmfStruct) || !Memory::IsValidAddress(psmfData)) { // Crashes on a PSP. - return hleReportError(ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad address"); + return hleReportError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad address"); } Psmf *psmf = new Psmf(Memory::GetPointer(psmfData), psmfData); if (psmf->magic != PSMF_MAGIC) { delete psmf; - return hleLogError(ME, ERROR_PSMF_INVALID_PSMF, "invalid psmf data"); + return hleLogError(Log::ME, ERROR_PSMF_INVALID_PSMF, "invalid psmf data"); } // Note: devkit 00000000 supports only '0012'(0F), '0013'(1F), and '0014'(2F). 03000310+ supports '0015'(3F.) if (psmf->version == 0) { delete psmf; - return hleLogError(ME, ERROR_PSMF_BAD_VERSION, "invalid psmf version"); + return hleLogError(Log::ME, ERROR_PSMF_BAD_VERSION, "invalid psmf version"); } if (psmf->streamOffset == 0) { delete psmf; - return hleLogError(ME, ERROR_PSMF_INVALID_VALUE, "invalid psmf version"); + return hleLogError(Log::ME, ERROR_PSMF_INVALID_VALUE, "invalid psmf version"); } // Note: this structure changes between versions. @@ -794,21 +794,21 @@ static u32 scePsmfSetPsmf(u32 psmfStruct, u32 psmfData) { delete iter->second; psmfMap[data->headerOffset] = psmf; - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static u32 scePsmfGetNumberOfStreams(u32 psmfStruct) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } - return hleLogSuccessI(ME, psmf->numStreams); + return hleLogSuccessI(Log::ME, psmf->numStreams); } static u32 scePsmfGetNumberOfSpecificStreams(u32 psmfStruct, int streamType) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } int streamNum = 0; @@ -818,113 +818,113 @@ static u32 scePsmfGetNumberOfSpecificStreams(u32 psmfStruct, int streamType) { } } - return hleLogSuccessI(ME, streamNum); + return hleLogSuccessI(Log::ME, streamNum); } static u32 scePsmfSpecifyStreamWithStreamType(u32 psmfStruct, u32 streamType, u32 channel) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } if (!psmf->setStreamWithType(psmfStruct, streamType, channel)) { // An invalid type seems to make the stream number invalid, but retain the old type/channel. psmf->setStreamNum(psmfStruct, ERROR_PSMF_INVALID_ID, false); // Also, returns 0 even when no stream found. - return hleLogWarning(ME, 0, "no stream found"); + return hleLogWarning(Log::ME, 0, "no stream found"); } - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static u32 scePsmfSpecifyStreamWithStreamTypeNumber(u32 psmfStruct, u32 streamType, u32 typeNum) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } if (!psmf->setStreamWithTypeNumber(psmfStruct, streamType, typeNum)) { // Don't update stream, just bail out. - return hleLogWarning(ME, ERROR_PSMF_INVALID_ID, "no stream found"); + return hleLogWarning(Log::ME, ERROR_PSMF_INVALID_ID, "no stream found"); } - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static u32 scePsmfSpecifyStream(u32 psmfStruct, int streamNum) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } if (!psmf->setStreamNum(psmfStruct, streamNum)) { psmf->setStreamNum(psmfStruct, ERROR_PSMF_NOT_INITIALIZED); - return hleLogWarning(ME, ERROR_PSMF_INVALID_ID, "bad stream id"); + return hleLogWarning(Log::ME, ERROR_PSMF_INVALID_ID, "bad stream id"); } - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static u32 scePsmfGetVideoInfo(u32 psmfStruct, u32 videoInfoAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } else if (!psmf->isValidCurrentStreamNumber()) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid stream selected"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid stream selected"); } else if (!Memory::IsValidRange(videoInfoAddr, 8)) { // Would crash. - return hleLogError(ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad address"); } auto info = psmf->streamMap[psmf->currentStreamNum]; if (info->videoWidth_ == PsmfStream::INVALID) { - return hleLogError(ME, ERROR_PSMF_INVALID_ID, "not a video stream"); + return hleLogError(Log::ME, ERROR_PSMF_INVALID_ID, "not a video stream"); } Memory::Write_U32(info->videoWidth_ == PsmfStream::USE_PSMF ? psmf->videoWidth : info->videoWidth_, videoInfoAddr); Memory::Write_U32(info->videoHeight_ == PsmfStream::USE_PSMF ? psmf->videoHeight : info->videoHeight_, videoInfoAddr + 4); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static u32 scePsmfGetAudioInfo(u32 psmfStruct, u32 audioInfoAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } else if (!psmf->isValidCurrentStreamNumber()) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid stream selected"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid stream selected"); } else if (!Memory::IsValidRange(audioInfoAddr, 8)) { // Would crash. - return hleLogError(ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad address"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad address"); } auto info = psmf->streamMap[psmf->currentStreamNum]; if (info->audioChannels_ == PsmfStream::INVALID) { - return hleLogError(ME, ERROR_PSMF_INVALID_ID, "not an audio stream"); + return hleLogError(Log::ME, ERROR_PSMF_INVALID_ID, "not an audio stream"); } Memory::Write_U32(info->audioChannels_ == PsmfStream::USE_PSMF ? psmf->audioChannels : info->audioChannels_, audioInfoAddr); Memory::Write_U32(info->audioFrequency_ == PsmfStream::USE_PSMF ? psmf->audioFrequency : info->audioFrequency_, audioInfoAddr + 4); - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static u32 scePsmfGetCurrentStreamType(u32 psmfStruct, u32 typeAddr, u32 channelAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } if (psmf->currentStreamNum == (int)ERROR_PSMF_NOT_INITIALIZED) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "no stream set"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "no stream set"); } if (!Memory::IsValidAddress(typeAddr) || !Memory::IsValidAddress(channelAddr)) { - return hleLogError(ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad pointers"); + return hleLogError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad pointers"); } if (psmf->currentStreamType != -1) { Memory::Write_U32(psmf->currentStreamType, typeAddr); Memory::Write_U32(psmf->currentStreamChannel, channelAddr); } - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static u32 scePsmfGetStreamSize(u32 psmfStruct, u32 sizeAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - ERROR_LOG(ME, "scePsmfGetStreamSize(%08x, %08x): invalid psmf", psmfStruct, sizeAddr); + ERROR_LOG(Log::ME, "scePsmfGetStreamSize(%08x, %08x): invalid psmf", psmfStruct, sizeAddr); return ERROR_PSMF_NOT_FOUND; } - DEBUG_LOG(ME, "scePsmfGetStreamSize(%08x, %08x)", psmfStruct, sizeAddr); + DEBUG_LOG(Log::ME, "scePsmfGetStreamSize(%08x, %08x)", psmfStruct, sizeAddr); if (Memory::IsValidAddress(sizeAddr)) { Memory::Write_U32(psmf->streamSize, sizeAddr); } @@ -933,7 +933,7 @@ static u32 scePsmfGetStreamSize(u32 psmfStruct, u32 sizeAddr) static u32 scePsmfQueryStreamOffset(u32 bufferAddr, u32 offsetAddr) { - WARN_LOG(ME, "scePsmfQueryStreamOffset(%08x, %08x)", bufferAddr, offsetAddr); + WARN_LOG(Log::ME, "scePsmfQueryStreamOffset(%08x, %08x)", bufferAddr, offsetAddr); if (Memory::IsValidAddress(offsetAddr)) { Memory::Write_U32(bswap32(Memory::Read_U32(bufferAddr + PSMF_STREAM_OFFSET_OFFSET)), offsetAddr); } @@ -942,7 +942,7 @@ static u32 scePsmfQueryStreamOffset(u32 bufferAddr, u32 offsetAddr) static u32 scePsmfQueryStreamSize(u32 bufferAddr, u32 sizeAddr) { - WARN_LOG(ME, "scePsmfQueryStreamSize(%08x, %08x)", bufferAddr, sizeAddr); + WARN_LOG(Log::ME, "scePsmfQueryStreamSize(%08x, %08x)", bufferAddr, sizeAddr); if (Memory::IsValidAddress(sizeAddr)) { Memory::Write_U32(bswap32(Memory::Read_U32(bufferAddr + PSMF_STREAM_SIZE_OFFSET)), sizeAddr); } @@ -953,10 +953,10 @@ static u32 scePsmfGetHeaderSize(u32 psmfStruct, u32 sizeAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - ERROR_LOG(ME, "scePsmfGetHeaderSize(%08x, %08x): invalid psmf", psmfStruct, sizeAddr); + ERROR_LOG(Log::ME, "scePsmfGetHeaderSize(%08x, %08x): invalid psmf", psmfStruct, sizeAddr); return ERROR_PSMF_NOT_FOUND; } - DEBUG_LOG(ME, "scePsmfGetHeaderSize(%08x, %08x)", psmfStruct, sizeAddr); + DEBUG_LOG(Log::ME, "scePsmfGetHeaderSize(%08x, %08x)", psmfStruct, sizeAddr); if (Memory::IsValidAddress(sizeAddr)) { Memory::Write_U32(psmf->headerSize, sizeAddr); } @@ -967,10 +967,10 @@ static u32 scePsmfGetPsmfVersion(u32 psmfStruct) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - ERROR_LOG(ME, "scePsmfGetPsmfVersion(%08x): invalid psmf", psmfStruct); + ERROR_LOG(Log::ME, "scePsmfGetPsmfVersion(%08x): invalid psmf", psmfStruct); return ERROR_PSMF_NOT_FOUND; } - DEBUG_LOG(ME, "scePsmfGetPsmfVersion(%08x)", psmfStruct); + DEBUG_LOG(Log::ME, "scePsmfGetPsmfVersion(%08x)", psmfStruct); return psmf->version; } @@ -978,18 +978,18 @@ static u32 scePsmfVerifyPsmf(u32 psmfAddr) { u32 magic = Memory::Read_U32(psmfAddr); if (magic != PSMF_MAGIC) { - ERROR_LOG(ME, "scePsmfVerifyPsmf(%08x): bad magic %08x", psmfAddr, magic); + ERROR_LOG(Log::ME, "scePsmfVerifyPsmf(%08x): bad magic %08x", psmfAddr, magic); return ERROR_PSMF_NOT_FOUND; } int version = Memory::Read_U32(psmfAddr + PSMF_STREAM_VERSION_OFFSET); if (version < 0) { - ERROR_LOG(ME, "scePsmfVerifyPsmf(%08x): bad version %08x", psmfAddr, version); + ERROR_LOG(Log::ME, "scePsmfVerifyPsmf(%08x): bad version %08x", psmfAddr, version); return ERROR_PSMF_NOT_FOUND; } // Kurohyou 2 (at least the demo) uses an uninitialized value that happens to be zero on the PSP. // It appears to be written by scePsmfVerifyPsmf(), so we write some bytes into the stack here. Memory::Memset(currentMIPS->r[MIPS_REG_SP] - 0x20, 0, 0x20, "PsmfStack"); - DEBUG_LOG(ME, "scePsmfVerifyPsmf(%08x)", psmfAddr); + DEBUG_LOG(Log::ME, "scePsmfVerifyPsmf(%08x)", psmfAddr); return 0; } @@ -997,10 +997,10 @@ static u32 scePsmfGetNumberOfEPentries(u32 psmfStruct) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - ERROR_LOG(ME, "scePsmfGetNumberOfEPentries(%08x): invalid psmf", psmfStruct); + ERROR_LOG(Log::ME, "scePsmfGetNumberOfEPentries(%08x): invalid psmf", psmfStruct); return ERROR_PSMF_NOT_FOUND; } - DEBUG_LOG(ME, "scePsmfGetNumberOfEPentries(%08x)", psmfStruct); + DEBUG_LOG(Log::ME, "scePsmfGetNumberOfEPentries(%08x)", psmfStruct); return psmf->EPMapEntriesNum; } @@ -1008,10 +1008,10 @@ static u32 scePsmfGetPresentationStartTime(u32 psmfStruct, u32 startTimeAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - ERROR_LOG(ME, "scePsmfGetPresentationStartTime(%08x, %08x): invalid psmf", psmfStruct, startTimeAddr); + ERROR_LOG(Log::ME, "scePsmfGetPresentationStartTime(%08x, %08x): invalid psmf", psmfStruct, startTimeAddr); return ERROR_PSMF_NOT_FOUND; } - DEBUG_LOG(ME, "scePsmfGetPresentationStartTime(%08x, %08x)", psmfStruct, startTimeAddr); + DEBUG_LOG(Log::ME, "scePsmfGetPresentationStartTime(%08x, %08x)", psmfStruct, startTimeAddr); if (Memory::IsValidAddress(startTimeAddr)) { Memory::Write_U32(psmf->presentationStartTime, startTimeAddr); } @@ -1022,10 +1022,10 @@ static u32 scePsmfGetPresentationEndTime(u32 psmfStruct, u32 endTimeAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - ERROR_LOG(ME, "scePsmfGetPresentationEndTime(%08x, %08x): invalid psmf", psmfStruct, endTimeAddr); + ERROR_LOG(Log::ME, "scePsmfGetPresentationEndTime(%08x, %08x): invalid psmf", psmfStruct, endTimeAddr); return ERROR_PSMF_NOT_FOUND; } - DEBUG_LOG(ME, "scePsmfGetPresentationEndTime(%08x, %08x)", psmfStruct, endTimeAddr); + DEBUG_LOG(Log::ME, "scePsmfGetPresentationEndTime(%08x, %08x)", psmfStruct, endTimeAddr); if (Memory::IsValidAddress(endTimeAddr)) { Memory::Write_U32(psmf->presentationEndTime, endTimeAddr); } @@ -1035,23 +1035,23 @@ static u32 scePsmfGetPresentationEndTime(u32 psmfStruct, u32 endTimeAddr) static u32 scePsmfGetCurrentStreamNumber(u32 psmfStruct) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } if (psmf->currentStreamNum < 0) { - return hleLogError(ME, psmf->currentStreamNum, "invalid stream"); + return hleLogError(Log::ME, psmf->currentStreamNum, "invalid stream"); } - return hleLogSuccessI(ME, psmf->currentStreamNum); + return hleLogSuccessI(Log::ME, psmf->currentStreamNum); } static u32 scePsmfCheckEPMap(u32 psmfStruct) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - ERROR_LOG(ME, "scePsmfCheckEPMap(%08x): invalid psmf", psmfStruct); + ERROR_LOG(Log::ME, "scePsmfCheckEPMap(%08x): invalid psmf", psmfStruct); return ERROR_PSMF_NOT_FOUND; } - DEBUG_LOG(ME, "scePsmfCheckEPMap(%08x)", psmfStruct); + DEBUG_LOG(Log::ME, "scePsmfCheckEPMap(%08x)", psmfStruct); return psmf->EPMap.empty() ? ERROR_PSMF_NOT_FOUND : 0; } @@ -1059,11 +1059,11 @@ static u32 scePsmfGetEPWithId(u32 psmfStruct, int epid, u32 entryAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } if (epid < 0 || epid >= (int)psmf->EPMap.size()) { - return hleLogError(ME, ERROR_PSMF_NOT_FOUND, "invalid id"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid id"); } auto entry = PSPPointer::Create(entryAddr); @@ -1071,23 +1071,23 @@ static u32 scePsmfGetEPWithId(u32 psmfStruct, int epid, u32 entryAddr) *entry = psmf->EPMap[epid]; entry.NotifyWrite("PsmfGetEPWithId"); } - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static u32 scePsmfGetEPWithTimestamp(u32 psmfStruct, u32 ts, u32 entryAddr) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - return hleLogError(ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_INITIALIZED, "invalid psmf"); } if (ts < psmf->presentationStartTime) { - return hleLogError(ME, ERROR_PSMF_NOT_FOUND, "invalid timestamp"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid timestamp"); } int epid = psmf->FindEPWithTimestamp(ts); if (epid < 0 || epid >= (int)psmf->EPMap.size()) { - return hleLogError(ME, ERROR_PSMF_NOT_FOUND, "invalid id"); + return hleLogError(Log::ME, ERROR_PSMF_NOT_FOUND, "invalid id"); } auto entry = PSPPointer::Create(entryAddr); @@ -1095,31 +1095,31 @@ static u32 scePsmfGetEPWithTimestamp(u32 psmfStruct, u32 ts, u32 entryAddr) *entry = psmf->EPMap[epid]; entry.NotifyWrite("PsmfGetEPWithTimestamp"); } - return hleLogSuccessI(ME, 0); + return hleLogSuccessI(Log::ME, 0); } static u32 scePsmfGetEPidWithTimestamp(u32 psmfStruct, u32 ts) { Psmf *psmf = getPsmf(psmfStruct); if (!psmf) { - ERROR_LOG(ME, "scePsmfGetEPidWithTimestamp(%08x, %i): invalid psmf", psmfStruct, ts); + ERROR_LOG(Log::ME, "scePsmfGetEPidWithTimestamp(%08x, %i): invalid psmf", psmfStruct, ts); return ERROR_PSMF_NOT_FOUND; } - DEBUG_LOG(ME, "scePsmfGetEPidWithTimestamp(%08x, %i)", psmfStruct, ts); + DEBUG_LOG(Log::ME, "scePsmfGetEPidWithTimestamp(%08x, %i)", psmfStruct, ts); if (psmf->EPMap.empty()) { - ERROR_LOG(ME, "scePsmfGetEPidWithTimestamp(%08x): EPMap is empty", psmfStruct); + ERROR_LOG(Log::ME, "scePsmfGetEPidWithTimestamp(%08x): EPMap is empty", psmfStruct); return ERROR_PSMF_NOT_FOUND; } if (ts < psmf->presentationStartTime) { - ERROR_LOG(ME, "scePsmfGetEPidWithTimestamp(%08x, %i): invalid timestamp", psmfStruct, ts); + ERROR_LOG(Log::ME, "scePsmfGetEPidWithTimestamp(%08x, %i): invalid timestamp", psmfStruct, ts); return ERROR_PSMF_INVALID_TIMESTAMP; } int epid = psmf->FindEPWithTimestamp(ts); if (epid < 0 || epid >= (int)psmf->EPMap.size()) { - ERROR_LOG(ME, "scePsmfGetEPidWithTimestamp(%08x, %i): invalid id", psmfStruct, epid); + ERROR_LOG(Log::ME, "scePsmfGetEPidWithTimestamp(%08x, %i): invalid id", psmfStruct, epid); return ERROR_PSMF_INVALID_ID; } @@ -1132,24 +1132,24 @@ static int scePsmfPlayerCreate(u32 psmfPlayer, u32 dataPtr) { if (!player.IsValid() || !data.IsValid()) { // Crashes on a PSP. - return hleReportError(ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad pointers"); + return hleReportError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "bad pointers"); } if (!data->buffer.IsValid()) { // Also crashes on a PSP. *player = 0; - return hleReportError(ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "invalid buffer address %08x", data->buffer.ptr); + return hleReportError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ADDRESS, "invalid buffer address %08x", data->buffer.ptr); } if (data->bufferSize < 0x00285800) { *player = 0; - return hleReportError(ME, ERROR_PSMFPLAYER_BUFFER_SIZE, "buffer too small %08x", data->bufferSize); + return hleReportError(Log::ME, ERROR_PSMFPLAYER_BUFFER_SIZE, "buffer too small %08x", data->bufferSize); } if (data->threadPriority < 0x10 || data->threadPriority >= 0x6E) { *player = 0; - return hleReportError(ME, ERROR_PSMFPLAYER_INVALID_PARAM, "bad thread priority %02x", data->threadPriority); + return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_PARAM, "bad thread priority %02x", data->threadPriority); } if (!psmfPlayerMap.empty()) { *player = 0; - return hleReportError(ME, ERROR_MPEG_ALREADY_INIT, "already have an active player"); + return hleReportError(Log::ME, ERROR_MPEG_ALREADY_INIT, "already have an active player"); } PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); @@ -1169,34 +1169,34 @@ static int scePsmfPlayerCreate(u32 psmfPlayer, u32 dataPtr) { int delayUs = 20000; DelayPsmfStateChange(psmfPlayer, PSMF_PLAYER_STATUS_INIT, delayUs); - INFO_LOG(ME, "psmfplayer create, psmfPlayerLibVersion 0x%0x, psmfPlayerLibcrc %x", psmfPlayerLibVersion, psmfPlayerLibcrc); + INFO_LOG(Log::ME, "psmfplayer create, psmfPlayerLibVersion 0x%0x, psmfPlayerLibcrc %x", psmfPlayerLibVersion, psmfPlayerLibcrc); return hleDelayResult(0, "player create", delayUs); } static int scePsmfPlayerStop(u32 psmfPlayer) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - return hleLogError(ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player"); + return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player"); } if (psmfplayer->status < PSMF_PLAYER_STATUS_PLAYING) { - return hleLogError(ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not yet playing"); + return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "not yet playing"); } psmfplayer->AbortFinish(); int delayUs = 3000; DelayPsmfStateChange(psmfPlayer, PSMF_PLAYER_STATUS_STANDBY, delayUs); - return hleLogSuccessInfoI(ME, hleDelayResult(0, "psmfplayer stop", delayUs)); + return hleLogSuccessInfoI(Log::ME, hleDelayResult(0, "psmfplayer stop", delayUs)); } static int scePsmfPlayerBreak(u32 psmfPlayer) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - return hleLogError(ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player", psmfPlayer); + return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player", psmfPlayer); } psmfplayer->AbortFinish(); - return hleLogWarning(ME, 0); + return hleLogWarning(Log::ME, 0); } static int _PsmfPlayerFillRingbuffer(PsmfPlayer *psmfplayer) { @@ -1235,17 +1235,17 @@ static int _PsmfPlayerFillRingbuffer(PsmfPlayer *psmfplayer) { static int _PsmfPlayerSetPsmfOffset(u32 psmfPlayer, const char *filename, int offset, bool docallback) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer || psmfplayer->status != PSMF_PLAYER_STATUS_INIT) { - return hleReportError(ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player or status"); + return hleReportError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player or status"); } if (!filename) { - return hleLogError(ME, ERROR_PSMFPLAYER_INVALID_PARAM, "invalid filename"); + return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_PARAM, "invalid filename"); } int delayUs = 1100; psmfplayer->filehandle = pspFileSystem.OpenFile(filename, (FileAccess) FILEACCESS_READ); if (psmfplayer->filehandle < 0) { - return hleLogError(ME, hleDelayResult(SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "psmfplayer set", delayUs), "invalid file data or does not exist"); + return hleLogError(Log::ME, hleDelayResult(SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "psmfplayer set", delayUs), "invalid file data or does not exist"); } if (offset != 0) @@ -1258,14 +1258,14 @@ static int _PsmfPlayerSetPsmfOffset(u32 psmfPlayer, const char *filename, int of const u32 magic = *(u32_le *)buf; if (magic != PSMF_MAGIC) { // TODO: Let's keep trying as we were before. - ERROR_LOG_REPORT(ME, "scePsmfPlayerSetPsmf*: incorrect PSMF magic (%08x), bad data", magic); - //return hleReportError(ME, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "incorrect PSMF magic (%08x), bad data", magic); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSetPsmf*: incorrect PSMF magic (%08x), bad data", magic); + //return hleReportError(Log::ME, SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "incorrect PSMF magic (%08x), bad data", magic); } // TODO: Merge better with Psmf. u16 numStreams = *(u16_be *)(buf + 0x80); if (numStreams > 128) { - return hleReportError(ME, hleDelayResult(SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "psmfplayer set", delayUs), "too many streams in PSMF video, bogus data"); + return hleReportError(Log::ME, hleDelayResult(SCE_KERNEL_ERROR_ILLEGAL_ARGUMENT, "psmfplayer set", delayUs), "too many streams in PSMF video, bogus data"); } psmfplayer->totalVideoStreams = 0; @@ -1289,7 +1289,7 @@ static int _PsmfPlayerSetPsmfOffset(u32 psmfPlayer, const char *filename, int of } else if ((streamId & PSMF_AUDIO_STREAM_ID) == PSMF_AUDIO_STREAM_ID) { ++psmfplayer->totalAudioStreams; } else { - WARN_LOG_REPORT(ME, "scePsmfPlayerSetPsmf*: unexpected streamID %x", streamId); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerSetPsmf*: unexpected streamID %x", streamId); } } // TODO: It seems like it's invalid if there's not at least 1 video stream. @@ -1309,7 +1309,7 @@ static int _PsmfPlayerSetPsmfOffset(u32 psmfPlayer, const char *filename, int of psmfplayer->totalDurationTimestamp = psmfplayer->mediaengine->getLastTimeStamp(); DelayPsmfStateChange(psmfPlayer, PSMF_PLAYER_STATUS_STANDBY, delayUs); - return hleLogSuccessInfoI(ME, hleDelayResult(0, "psmfplayer set", delayUs)); + return hleLogSuccessInfoI(Log::ME, hleDelayResult(0, "psmfplayer set", delayUs)); } static int scePsmfPlayerSetPsmf(u32 psmfPlayer, const char *filename) { @@ -1333,9 +1333,9 @@ static int scePsmfPlayerSetPsmfOffsetCB(u32 psmfPlayer, const char *filename, in static int scePsmfPlayerGetAudioOutSize(u32 psmfPlayer) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - return hleLogError(ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player"); + return hleLogError(Log::ME, ERROR_PSMFPLAYER_INVALID_STATUS, "invalid psmf player"); } - return hleLogWarning(ME, audioSamplesBytes); + return hleLogWarning(Log::ME, audioSamplesBytes); } static bool __PsmfPlayerContinueSeek(PsmfPlayer *psmfplayer, int tries = 50) { @@ -1362,45 +1362,45 @@ static int scePsmfPlayerStart(u32 psmfPlayer, u32 psmfPlayerData, int initPts) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid psmf player", psmfPlayer, psmfPlayerData, initPts); + ERROR_LOG(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid psmf player", psmfPlayer, psmfPlayerData, initPts); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status == PSMF_PLAYER_STATUS_INIT) { - ERROR_LOG(ME, "scePsmfPlayerStart(%08x, %08x, %d): psmf not yet set", psmfPlayer, psmfPlayerData, initPts); + ERROR_LOG(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): psmf not yet set", psmfPlayer, psmfPlayerData, initPts); return ERROR_PSMFPLAYER_INVALID_STATUS; } auto playerData = PSPPointer::Create(psmfPlayerData); if (!playerData.IsValid()) { // Crashes on a PSP. - ERROR_LOG(ME, "scePsmfPlayerStart(%08x, %08x, %d): bad data address", psmfPlayer, psmfPlayerData, initPts); + ERROR_LOG(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): bad data address", psmfPlayer, psmfPlayerData, initPts); return SCE_KERNEL_ERROR_ILLEGAL_ADDRESS; } if (playerData->playMode < 0 || playerData->playMode > (int)PSMF_PLAYER_MODE_REWIND) { - ERROR_LOG(ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid mode", psmfPlayer, psmfPlayerData, initPts); + ERROR_LOG(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid mode", psmfPlayer, psmfPlayerData, initPts); return ERROR_PSMFPLAYER_INVALID_PARAM; } if (initPts >= psmfplayer->mediaengine->getLastTimeStamp()) { - ERROR_LOG(ME, "scePsmfPlayerStart(%08x, %08x, %d): pts is outside video", psmfPlayer, psmfPlayerData, initPts); + ERROR_LOG(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): pts is outside video", psmfPlayer, psmfPlayerData, initPts); return ERROR_PSMFPLAYER_INVALID_PARAM; } if (psmfplayer->totalAudioStreams > 0) { if (playerData->audioCodec != 0x0F && playerData->audioCodec != 0x01) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid audio codec %02x", psmfPlayer, psmfPlayerData, initPts, playerData->audioCodec); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid audio codec %02x", psmfPlayer, psmfPlayerData, initPts, playerData->audioCodec); return ERROR_PSMFPLAYER_INVALID_STREAM; } if (playerData->audioStreamNum >= psmfplayer->totalAudioStreams) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to change audio stream to %d", psmfPlayer, psmfPlayerData, initPts, playerData->audioStreamNum); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to change audio stream to %d", psmfPlayer, psmfPlayerData, initPts, playerData->audioStreamNum); return ERROR_PSMFPLAYER_INVALID_CONFIG; } } if (playerData->videoCodec != 0x0E && playerData->videoCodec != 0x00) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid video codec %02x", psmfPlayer, psmfPlayerData, initPts, playerData->videoCodec); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): invalid video codec %02x", psmfPlayer, psmfPlayerData, initPts, playerData->videoCodec); return ERROR_PSMFPLAYER_INVALID_STREAM; } if (playerData->videoStreamNum < 0 || playerData->videoStreamNum >= psmfplayer->totalVideoStreams) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to change video stream to %d", psmfPlayer, psmfPlayerData, initPts, playerData->videoStreamNum); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to change video stream to %d", psmfPlayer, psmfPlayerData, initPts, playerData->videoStreamNum); return ERROR_PSMFPLAYER_INVALID_CONFIG; } @@ -1408,10 +1408,10 @@ static int scePsmfPlayerStart(u32 psmfPlayer, u32 psmfPlayerData, int initPts) case PSMF_PLAYER_MODE_FORWARD: case PSMF_PLAYER_MODE_REWIND: if (psmfplayer->playerVersion == PSMF_PLAYER_VERSION_BASIC) { - WARN_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): no EP data for FORWARD/REWIND", psmfPlayer, psmfPlayerData, initPts); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): no EP data for FORWARD/REWIND", psmfPlayer, psmfPlayerData, initPts); return ERROR_PSMFPLAYER_INVALID_PARAM; } - WARN_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): unsupported playMode", psmfPlayer, psmfPlayerData, initPts); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): unsupported playMode", psmfPlayer, psmfPlayerData, initPts); break; case PSMF_PLAYER_MODE_PLAY: @@ -1419,12 +1419,12 @@ static int scePsmfPlayerStart(u32 psmfPlayer, u32 psmfPlayerData, int initPts) break; default: - WARN_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): unsupported playMode", psmfPlayer, psmfPlayerData, initPts); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): unsupported playMode", psmfPlayer, psmfPlayerData, initPts); break; } if (psmfplayer->playerVersion == PSMF_PLAYER_VERSION_BASIC && initPts != 0) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to seek without EPmap", psmfPlayer, psmfPlayerData, initPts); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d): unable to seek without EPmap", psmfPlayer, psmfPlayerData, initPts); return ERROR_PSMFPLAYER_INVALID_PARAM; } @@ -1440,7 +1440,7 @@ static int scePsmfPlayerStart(u32 psmfPlayer, u32 psmfPlayerData, int initPts) psmfplayer->playMode = playerData->playMode; psmfplayer->playSpeed = playerData->playSpeed; - WARN_LOG(ME, "scePsmfPlayerStart(%08x, %08x, %d (mode %d, speed %d)", psmfPlayer, psmfPlayerData, initPts, playerData->playMode, playerData->playSpeed); + WARN_LOG(Log::ME, "scePsmfPlayerStart(%08x, %08x, %d (mode %d, speed %d)", psmfPlayer, psmfPlayerData, initPts, playerData->playMode, playerData->playSpeed); // Does not alter current pts, it just catches up when Update()/etc. get there. @@ -1491,11 +1491,11 @@ static int scePsmfPlayerDelete(u32 psmfPlayer) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerDelete(%08x): invalid psmf player", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerDelete(%08x): invalid psmf player", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } - INFO_LOG(ME, "scePsmfPlayerDelete(%08x)", psmfPlayer); + INFO_LOG(Log::ME, "scePsmfPlayerDelete(%08x)", psmfPlayer); delete psmfplayer; psmfPlayerMap.erase(Memory::Read_U32(psmfPlayer)); Memory::Write_U32(0, psmfPlayer); @@ -1507,20 +1507,20 @@ static int scePsmfPlayerUpdate(u32 psmfPlayer) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerUpdate(%08x): invalid psmf player", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerUpdate(%08x): invalid psmf player", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status < PSMF_PLAYER_STATUS_PLAYING) { - ERROR_LOG(ME, "scePsmfPlayerUpdate(%08x): not playing yet", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerUpdate(%08x): not playing yet", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } - DEBUG_LOG(ME, "scePsmfPlayerUpdate(%08x)", psmfPlayer); + DEBUG_LOG(Log::ME, "scePsmfPlayerUpdate(%08x)", psmfPlayer); if (psmfplayer->HasReachedEnd()) { if (videoLoopStatus == PSMF_PLAYER_CONFIG_NO_LOOP && psmfplayer->videoStep >= 1) { if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING_FINISHED) { psmfplayer->ScheduleFinish(psmfPlayer); - INFO_LOG(ME, "scePsmfPlayerUpdate(%08x): video end scheduled", psmfPlayer); + INFO_LOG(Log::ME, "scePsmfPlayerUpdate(%08x): video end scheduled", psmfPlayer); } } } @@ -1533,15 +1533,15 @@ static int scePsmfPlayerReleasePsmf(u32 psmfPlayer) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerReleasePsmf(%08x): invalid psmf player", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerReleasePsmf(%08x): invalid psmf player", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status < PSMF_PLAYER_STATUS_STANDBY) { - ERROR_LOG(ME, "scePsmfPlayerReleasePsmf(%08x): not set yet", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerReleasePsmf(%08x): not set yet", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } - WARN_LOG(ME, "scePsmfPlayerReleasePsmf(%08x)", psmfPlayer); + WARN_LOG(Log::ME, "scePsmfPlayerReleasePsmf(%08x)", psmfPlayer); psmfplayer->status = PSMF_PLAYER_STATUS_INIT; return 0; } @@ -1558,32 +1558,32 @@ static int scePsmfPlayerGetVideoData(u32 psmfPlayer, u32 videoDataAddr) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerGetVideoData(%08x, %08x): invalid psmf player", psmfPlayer, videoDataAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetVideoData(%08x, %08x): invalid psmf player", psmfPlayer, videoDataAddr); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status < PSMF_PLAYER_STATUS_PLAYING) { - ERROR_LOG(ME, "scePsmfPlayerGetVideoData(%08x, %08x): psmf not playing", psmfPlayer, videoDataAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetVideoData(%08x, %08x): psmf not playing", psmfPlayer, videoDataAddr); return ERROR_PSMFPLAYER_INVALID_STATUS; } auto videoData = PSPPointer::Create(videoDataAddr); if (!videoData.IsValid()) { - ERROR_LOG(ME, "scePsmfPlayerGetVideoData(%08x, %08x): invalid data pointer", psmfPlayer, videoDataAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetVideoData(%08x, %08x): invalid data pointer", psmfPlayer, videoDataAddr); // Technically just crashes if videoData is not valid. return SCE_KERNEL_ERROR_INVALID_POINTER; } if (videoData->frameWidth < 0) { - ERROR_LOG(ME, "scePsmfPlayerGetVideoData(%08x, %08x): illegal bufw %d", psmfPlayer, videoDataAddr, videoData->frameWidth); + ERROR_LOG(Log::ME, "scePsmfPlayerGetVideoData(%08x, %08x): illegal bufw %d", psmfPlayer, videoDataAddr, videoData->frameWidth); return SCE_KERNEL_ERROR_PRIV_REQUIRED; } if (videoData->frameWidth != 0 && videoData->frameWidth < psmfplayer->mediaengine->VideoWidth()) { - ERROR_LOG(ME, "scePsmfPlayerGetVideoData(%08x, %08x): bufw %d smaller than width %d", psmfPlayer, videoDataAddr, videoData->frameWidth, psmfplayer->mediaengine->VideoWidth()); + ERROR_LOG(Log::ME, "scePsmfPlayerGetVideoData(%08x, %08x): bufw %d smaller than width %d", psmfPlayer, videoDataAddr, videoData->frameWidth, psmfplayer->mediaengine->VideoWidth()); return SCE_KERNEL_ERROR_INVALID_VALUE; } hleEatCycles(20000); if (!__PsmfPlayerContinueSeek(psmfplayer)) { - DEBUG_LOG(HLE, "scePsmfPlayerGetVideoData(%08x, %08x): still seeking", psmfPlayer, videoDataAddr); + DEBUG_LOG(Log::HLE, "scePsmfPlayerGetVideoData(%08x, %08x): still seeking", psmfPlayer, videoDataAddr); return ERROR_PSMFPLAYER_NO_MORE_DATA; } @@ -1591,7 +1591,7 @@ static int scePsmfPlayerGetVideoData(u32 psmfPlayer, u32 videoDataAddr) // Normally a minimum of 3 without audio, 5 with. But if you don't delay sufficiently between, hundreds. // It should be okay if we start videos quicker, but some games expect the first couple to fail. if (psmfplayer->warmUp < PSMF_PLAYER_WARMUP_FRAMES) { - DEBUG_LOG(ME, "scePsmfPlayerGetVideoData(%08x, %08x): warming up", psmfPlayer, videoDataAddr); + DEBUG_LOG(Log::ME, "scePsmfPlayerGetVideoData(%08x, %08x): warming up", psmfPlayer, videoDataAddr); ++psmfplayer->warmUp; return ERROR_PSMFPLAYER_NO_MORE_DATA; } @@ -1600,7 +1600,7 @@ static int scePsmfPlayerGetVideoData(u32 psmfPlayer, u32 videoDataAddr) // It's fine to pass an invalid value here if it's still warming up, but after that it's not okay. if (!Memory::IsValidAddress(videoData->displaybuf)) { - ERROR_LOG(ME, "scePsmfPlayerGetVideoData(%08x, %08x): invalid buffer pointer %08x", psmfPlayer, videoDataAddr, videoData->displaybuf); + ERROR_LOG(Log::ME, "scePsmfPlayerGetVideoData(%08x, %08x): invalid buffer pointer %08x", psmfPlayer, videoDataAddr, videoData->displaybuf); return SCE_KERNEL_ERROR_INVALID_POINTER; } @@ -1643,7 +1643,7 @@ static int scePsmfPlayerGetVideoData(u32 psmfPlayer, u32 videoDataAddr) _PsmfPlayerFillRingbuffer(psmfplayer); - DEBUG_LOG(ME, "%08x=scePsmfPlayerGetVideoData(%08x, %08x)", 0, psmfPlayer, videoDataAddr); + DEBUG_LOG(Log::ME, "%08x=scePsmfPlayerGetVideoData(%08x, %08x)", 0, psmfPlayer, videoDataAddr); return hleDelayResult(0, "psmfPlayer video decode", 3000); } @@ -1651,26 +1651,26 @@ static int scePsmfPlayerGetAudioData(u32 psmfPlayer, u32 audioDataAddr) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerGetAudioData(%08x, %08x): invalid psmf player", psmfPlayer, audioDataAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetAudioData(%08x, %08x): invalid psmf player", psmfPlayer, audioDataAddr); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status < PSMF_PLAYER_STATUS_PLAYING) { - ERROR_LOG(ME, "scePsmfPlayerGetAudioData(%08x, %08x): not yet playing", psmfPlayer, audioDataAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetAudioData(%08x, %08x): not yet playing", psmfPlayer, audioDataAddr); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (!Memory::IsValidAddress(audioDataAddr)) { - ERROR_LOG(ME, "scePsmfPlayerGetAudioData(%08x, %08x): invalid audio pointer", psmfPlayer, audioDataAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetAudioData(%08x, %08x): invalid audio pointer", psmfPlayer, audioDataAddr); return SCE_KERNEL_ERROR_INVALID_POINTER; } // Don't return audio frames before we would return video frames. if (psmfplayer->warmUp < PSMF_PLAYER_WARMUP_FRAMES) { - DEBUG_LOG(ME, "scePsmfPlayerGetAudioData(%08x, %08x): warming up", psmfPlayer, audioDataAddr); + DEBUG_LOG(Log::ME, "scePsmfPlayerGetAudioData(%08x, %08x): warming up", psmfPlayer, audioDataAddr); return ERROR_PSMFPLAYER_NO_MORE_DATA; } if (psmfplayer->playMode == PSMF_PLAYER_MODE_PAUSE) { - INFO_LOG(HLE, "scePsmfPlayerGetAudioData(%08x): paused mode", psmfPlayer); + INFO_LOG(Log::HLE, "scePsmfPlayerGetAudioData(%08x): paused mode", psmfPlayer); return ERROR_PSMFPLAYER_NO_MORE_DATA; } @@ -1684,7 +1684,7 @@ static int scePsmfPlayerGetAudioData(u32 psmfPlayer, u32 audioDataAddr) } } - DEBUG_LOG(ME, "%08x=scePsmfPlayerGetAudioData(%08x, %08x)", ret, psmfPlayer, audioDataAddr); + DEBUG_LOG(Log::ME, "%08x=scePsmfPlayerGetAudioData(%08x, %08x)", ret, psmfPlayer, audioDataAddr); if (ret != 0) { hleEatCycles(10000); } else { @@ -1700,15 +1700,15 @@ static int scePsmfPlayerGetCurrentStatus(u32 psmfPlayer) if (!psmfplayer) { // Mana Khemia and other games call this even when not necessary. // It's annoying so the logging is verbose'd out. - VERBOSE_LOG(ME, "scePsmfPlayerGetCurrentStatus(%08x): invalid psmf player", psmfPlayer); + VERBOSE_LOG(Log::ME, "scePsmfPlayerGetCurrentStatus(%08x): invalid psmf player", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status == PSMF_PLAYER_STATUS_NONE) { - ERROR_LOG(ME, "scePsmfPlayerGetCurrentStatus(%08x): not initialized", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerGetCurrentStatus(%08x): not initialized", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } - DEBUG_LOG(ME, "%d=scePsmfPlayerGetCurrentStatus(%08x)", psmfplayer->status, psmfPlayer); + DEBUG_LOG(Log::ME, "%d=scePsmfPlayerGetCurrentStatus(%08x)", psmfplayer->status, psmfPlayer); return psmfplayer->status; } @@ -1716,19 +1716,19 @@ static u32 scePsmfPlayerGetCurrentPts(u32 psmfPlayer, u32 currentPtsAddr) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerGetCurrentPts(%08x, %08x): invalid psmf player", psmfPlayer, currentPtsAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetCurrentPts(%08x, %08x): invalid psmf player", psmfPlayer, currentPtsAddr); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status < PSMF_PLAYER_STATUS_STANDBY) { - ERROR_LOG(ME, "scePsmfPlayerGetCurrentPts(%08x, %08x): not initialized", psmfPlayer, currentPtsAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetCurrentPts(%08x, %08x): not initialized", psmfPlayer, currentPtsAddr); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->psmfPlayerAvcAu.pts < 0) { - VERBOSE_LOG(ME, "scePsmfPlayerGetCurrentPts(%08x, %08x): no frame yet", psmfPlayer, currentPtsAddr); + VERBOSE_LOG(Log::ME, "scePsmfPlayerGetCurrentPts(%08x, %08x): no frame yet", psmfPlayer, currentPtsAddr); return ERROR_PSMFPLAYER_NO_MORE_DATA; } - DEBUG_LOG(ME, "scePsmfPlayerGetCurrentPts(%08x, %08x)", psmfPlayer, currentPtsAddr); + DEBUG_LOG(Log::ME, "scePsmfPlayerGetCurrentPts(%08x, %08x)", psmfPlayer, currentPtsAddr); if (Memory::IsValidAddress(currentPtsAddr)) { Memory::Write_U32(psmfplayer->psmfPlayerAvcAu.pts, currentPtsAddr); } @@ -1738,22 +1738,22 @@ static u32 scePsmfPlayerGetCurrentPts(u32 psmfPlayer, u32 currentPtsAddr) static u32 scePsmfPlayerGetPsmfInfo(u32 psmfPlayer, u32 psmfInfoAddr, u32 widthAddr, u32 heightAddr) { auto info = PSPPointer::Create(psmfInfoAddr); if (!Memory::IsValidAddress(psmfPlayer) || !info.IsValid()) { - ERROR_LOG(ME, "scePsmfPlayerGetPsmfInfo(%08x, %08x): invalid addresses", psmfPlayer, psmfInfoAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetPsmfInfo(%08x, %08x): invalid addresses", psmfPlayer, psmfInfoAddr); // PSP would crash. return SCE_KERNEL_ERROR_ILLEGAL_ADDRESS; } PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerGetPsmfInfo(%08x, %08x): invalid psmf player", psmfPlayer, psmfInfoAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetPsmfInfo(%08x, %08x): invalid psmf player", psmfPlayer, psmfInfoAddr); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status < PSMF_PLAYER_STATUS_STANDBY) { - ERROR_LOG(ME, "scePsmfPlayerGetPsmfInfo(%08x): psmf not set yet", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerGetPsmfInfo(%08x): psmf not set yet", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } - DEBUG_LOG(ME, "scePsmfPlayerGetPsmfInfo(%08x, %08x)", psmfPlayer, psmfInfoAddr); + DEBUG_LOG(Log::ME, "scePsmfPlayerGetPsmfInfo(%08x, %08x)", psmfPlayer, psmfInfoAddr); // The first frame is at 0, so subtract one frame's duration to get the last frame's timestamp. info->lastFrameTS = psmfplayer->totalDurationTimestamp - VIDEO_FRAME_DURATION_TS; info->numVideoStreams = psmfplayer->totalVideoStreams; @@ -1781,11 +1781,11 @@ static u32 scePsmfPlayerGetCurrentPlayMode(u32 psmfPlayer, u32 playModeAddr, u32 { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerGetCurrentPlayMode(%08x, %08x, %08x): invalid psmf player", psmfPlayer, playModeAddr, playSpeedAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetCurrentPlayMode(%08x, %08x, %08x): invalid psmf player", psmfPlayer, playModeAddr, playSpeedAddr); return ERROR_PSMFPLAYER_INVALID_STATUS; } - DEBUG_LOG(ME, "scePsmfPlayerGetCurrentPlayMode(%08x, %08x, %08x)", psmfPlayer, playModeAddr, playSpeedAddr); + DEBUG_LOG(Log::ME, "scePsmfPlayerGetCurrentPlayMode(%08x, %08x, %08x)", psmfPlayer, playModeAddr, playSpeedAddr); if (Memory::IsValidAddress(playModeAddr)) { Memory::Write_U32(psmfplayer->playMode, playModeAddr); } @@ -1799,15 +1799,15 @@ static u32 scePsmfPlayerGetCurrentVideoStream(u32 psmfPlayer, u32 videoCodecAddr { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerGetCurrentVideoStream(%08x, %08x, %08x): invalid psmf player", psmfPlayer, videoCodecAddr, videoStreamNumAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetCurrentVideoStream(%08x, %08x, %08x): invalid psmf player", psmfPlayer, videoCodecAddr, videoStreamNumAddr); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status == PSMF_PLAYER_STATUS_INIT) { - ERROR_LOG(ME, "scePsmfPlayerGetCurrentVideoStream(%08x): psmf not yet set", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerGetCurrentVideoStream(%08x): psmf not yet set", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } - DEBUG_LOG(ME, "scePsmfPlayerGetCurrentVideoStream(%08x, %08x, %08x)", psmfPlayer, videoCodecAddr, videoStreamNumAddr); + DEBUG_LOG(Log::ME, "scePsmfPlayerGetCurrentVideoStream(%08x, %08x, %08x)", psmfPlayer, videoCodecAddr, videoStreamNumAddr); if (Memory::IsValidAddress(videoCodecAddr)) { Memory::Write_U32(psmfplayer->videoCodec == 0x0E ? 0 : psmfplayer->videoCodec, videoCodecAddr); } @@ -1821,15 +1821,15 @@ static u32 scePsmfPlayerGetCurrentAudioStream(u32 psmfPlayer, u32 audioCodecAddr { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerGetCurrentAudioStream(%08x, %08x, %08x): invalid psmf player", psmfPlayer, audioCodecAddr, audioStreamNumAddr); + ERROR_LOG(Log::ME, "scePsmfPlayerGetCurrentAudioStream(%08x, %08x, %08x): invalid psmf player", psmfPlayer, audioCodecAddr, audioStreamNumAddr); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status == PSMF_PLAYER_STATUS_INIT) { - ERROR_LOG(ME, "scePsmfPlayerGetCurrentVideoStream(%08x): psmf not yet set", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerGetCurrentVideoStream(%08x): psmf not yet set", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } - DEBUG_LOG(ME, "scePsmfPlayerGetCurrentAudioStream(%08x, %08x, %08x)", psmfPlayer, audioCodecAddr, audioStreamNumAddr); + DEBUG_LOG(Log::ME, "scePsmfPlayerGetCurrentAudioStream(%08x, %08x, %08x)", psmfPlayer, audioCodecAddr, audioStreamNumAddr); if (Memory::IsValidAddress(audioCodecAddr)) { Memory::Write_U32(psmfplayer->audioCodec == 0x0F ? 1 : psmfplayer->audioCodec, audioCodecAddr); } @@ -1843,19 +1843,19 @@ static int scePsmfPlayerSetTempBuf(u32 psmfPlayer, u32 tempBufAddr, u32 tempBufS { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerSetTempBuf(%08x, %08x, %08x): invalid psmf player", psmfPlayer, tempBufAddr, tempBufSize); + ERROR_LOG(Log::ME, "scePsmfPlayerSetTempBuf(%08x, %08x, %08x): invalid psmf player", psmfPlayer, tempBufAddr, tempBufSize); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status != PSMF_PLAYER_STATUS_INIT) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSetTempBuf(%08x, %08x, %08x): invalid status %x", psmfPlayer, tempBufAddr, tempBufSize, psmfplayer->status); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSetTempBuf(%08x, %08x, %08x): invalid status %x", psmfPlayer, tempBufAddr, tempBufSize, psmfplayer->status); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (tempBufSize < 0x00010000) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSetTempBuf(%08x, %08x, %08x): buffer too small", psmfPlayer, tempBufAddr, tempBufSize); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSetTempBuf(%08x, %08x, %08x): buffer too small", psmfPlayer, tempBufAddr, tempBufSize); return ERROR_PSMFPLAYER_INVALID_PARAM; } - INFO_LOG(ME, "scePsmfPlayerSetTempBuf(%08x, %08x, %08x)", psmfPlayer, tempBufAddr, tempBufSize); + INFO_LOG(Log::ME, "scePsmfPlayerSetTempBuf(%08x, %08x, %08x)", psmfPlayer, tempBufAddr, tempBufSize); // fake it right now, use tempbuf from memory directly //psmfplayer->tempbuf = tempBufAddr; //psmfplayer->tempbufSize = tempBufSize; @@ -1867,15 +1867,15 @@ static u32 scePsmfPlayerChangePlayMode(u32 psmfPlayer, int playMode, int playSpe { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): invalid psmf player", psmfPlayer, playMode, playSpeed); + ERROR_LOG(Log::ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): invalid psmf player", psmfPlayer, playMode, playSpeed); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status < PSMF_PLAYER_STATUS_PLAYING) { - ERROR_LOG(ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): not playing yet", psmfPlayer, playMode, playSpeed); + ERROR_LOG(Log::ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): not playing yet", psmfPlayer, playMode, playSpeed); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (playMode < 0 || playMode > (int)PSMF_PLAYER_MODE_REWIND) { - ERROR_LOG(ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): invalid mode", psmfPlayer, playMode, playSpeed); + ERROR_LOG(Log::ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): invalid mode", psmfPlayer, playMode, playSpeed); return ERROR_PSMFPLAYER_INVALID_CONFIG; } @@ -1883,27 +1883,27 @@ static u32 scePsmfPlayerChangePlayMode(u32 psmfPlayer, int playMode, int playSpe case PSMF_PLAYER_MODE_FORWARD: case PSMF_PLAYER_MODE_REWIND: if (psmfplayer->playerVersion == PSMF_PLAYER_VERSION_BASIC) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): no EP data for FORWARD/REWIND", psmfPlayer, playMode, playSpeed); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): no EP data for FORWARD/REWIND", psmfPlayer, playMode, playSpeed); return ERROR_PSMFPLAYER_INVALID_STREAM; } psmfplayer->playSpeed = playSpeed; - WARN_LOG_REPORT(ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): unsupported playMode", psmfPlayer, playMode, playSpeed); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): unsupported playMode", psmfPlayer, playMode, playSpeed); break; case PSMF_PLAYER_MODE_PLAY: case PSMF_PLAYER_MODE_PAUSE: if (psmfplayer->playSpeed != playSpeed) { - WARN_LOG_REPORT(ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): play speed not changed", psmfPlayer, playMode, playSpeed); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): play speed not changed", psmfPlayer, playMode, playSpeed); } else { - DEBUG_LOG(ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i)", psmfPlayer, playMode, playSpeed); + DEBUG_LOG(Log::ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i)", psmfPlayer, playMode, playSpeed); } break; default: if (psmfplayer->playSpeed != playSpeed) { - WARN_LOG_REPORT(ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): play speed not changed", psmfPlayer, playMode, playSpeed); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): play speed not changed", psmfPlayer, playMode, playSpeed); } - WARN_LOG_REPORT(ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): unsupported playMode", psmfPlayer, playMode, playSpeed); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerChangePlayMode(%08x, %i, %i): unsupported playMode", psmfPlayer, playMode, playSpeed); break; } @@ -1915,11 +1915,11 @@ static u32 scePsmfPlayerSelectAudio(u32 psmfPlayer) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerSelectAudio(%08x): invalid psmf player", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerSelectAudio(%08x): invalid psmf player", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) { - ERROR_LOG(ME, "scePsmfPlayerSelectAudio(%08x): not playing", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerSelectAudio(%08x): not playing", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } @@ -1928,11 +1928,11 @@ static u32 scePsmfPlayerSelectAudio(u32 psmfPlayer) next = 0; if (next == psmfplayer->audioStreamNum || !psmfplayer->mediaengine->setAudioStream(next)) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectAudio(%08x): no stream to switch to", psmfPlayer); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSelectAudio(%08x): no stream to switch to", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STREAM; } - WARN_LOG_REPORT(ME, "scePsmfPlayerSelectAudio(%08x)", psmfPlayer); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerSelectAudio(%08x)", psmfPlayer); psmfplayer->audioStreamNum = next; return 0; } @@ -1941,11 +1941,11 @@ static u32 scePsmfPlayerSelectVideo(u32 psmfPlayer) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerSelectVideo(%08x): invalid psmf player", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerSelectVideo(%08x): invalid psmf player", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) { - ERROR_LOG(ME, "scePsmfPlayerSelectVideo(%08x): not playing", psmfPlayer); + ERROR_LOG(Log::ME, "scePsmfPlayerSelectVideo(%08x): not playing", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } @@ -1954,11 +1954,11 @@ static u32 scePsmfPlayerSelectVideo(u32 psmfPlayer) next = 0; if (next == psmfplayer->videoStreamNum || !psmfplayer->mediaengine->setVideoStream(next)) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectVideo(%08x): no stream to switch to", psmfPlayer); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSelectVideo(%08x): no stream to switch to", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STREAM; } - WARN_LOG_REPORT(ME, "scePsmfPlayerSelectVideo(%08x)", psmfPlayer); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerSelectVideo(%08x)", psmfPlayer); psmfplayer->videoStreamNum = next; return 0; } @@ -1967,31 +1967,31 @@ static u32 scePsmfPlayerSelectSpecificVideo(u32 psmfPlayer, int videoCodec, int { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): invalid psmf player", psmfPlayer, videoCodec, videoStreamNum); + ERROR_LOG(Log::ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): invalid psmf player", psmfPlayer, videoCodec, videoStreamNum); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) { - ERROR_LOG(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): not playing", psmfPlayer, videoCodec, videoStreamNum); + ERROR_LOG(Log::ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): not playing", psmfPlayer, videoCodec, videoStreamNum); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->totalVideoStreams < 2) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): unable to change stream", psmfPlayer, videoCodec, videoStreamNum); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): unable to change stream", psmfPlayer, videoCodec, videoStreamNum); return ERROR_PSMFPLAYER_INVALID_STREAM; } if (videoStreamNum < 0 || videoStreamNum >= psmfplayer->totalVideoStreams) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): bad stream num param", psmfPlayer, videoCodec, videoStreamNum); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): bad stream num param", psmfPlayer, videoCodec, videoStreamNum); return ERROR_PSMFPLAYER_INVALID_CONFIG; } if (videoCodec != 0x0E && videoCodec != 0x00) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): invalid codec", psmfPlayer, videoCodec, videoStreamNum); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): invalid codec", psmfPlayer, videoCodec, videoStreamNum); return ERROR_PSMFPLAYER_INVALID_STREAM; } if (psmfplayer->totalVideoStreams < 2 || !psmfplayer->mediaengine->setVideoStream(videoStreamNum)) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): unable to change stream", psmfPlayer, videoCodec, videoStreamNum); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i): unable to change stream", psmfPlayer, videoCodec, videoStreamNum); return ERROR_PSMFPLAYER_INVALID_STREAM; } - WARN_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i)", psmfPlayer, videoCodec, videoStreamNum); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerSelectSpecificVideo(%08x, %i, %i)", psmfPlayer, videoCodec, videoStreamNum); if (psmfplayer->videoStreamNum != videoStreamNum) { hleDelayResult(0, "psmf select video", 100); } @@ -2005,31 +2005,31 @@ static u32 scePsmfPlayerSelectSpecificAudio(u32 psmfPlayer, int audioCodec, int { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): invalid psmf player", psmfPlayer, audioCodec, audioStreamNum); + ERROR_LOG(Log::ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): invalid psmf player", psmfPlayer, audioCodec, audioStreamNum); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) { - ERROR_LOG(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): not playing", psmfPlayer, audioCodec, audioStreamNum); + ERROR_LOG(Log::ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): not playing", psmfPlayer, audioCodec, audioStreamNum); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->totalAudioStreams < 2) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): unable to change stream", psmfPlayer, audioCodec, audioStreamNum); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): unable to change stream", psmfPlayer, audioCodec, audioStreamNum); return ERROR_PSMFPLAYER_INVALID_STREAM; } if (audioStreamNum < 0 || audioStreamNum >= psmfplayer->totalAudioStreams) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): bad stream num param", psmfPlayer, audioCodec, audioStreamNum); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): bad stream num param", psmfPlayer, audioCodec, audioStreamNum); return ERROR_PSMFPLAYER_INVALID_CONFIG; } if (audioCodec != 0x0F && audioCodec != 0x01) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): invalid codec", psmfPlayer, audioCodec, audioStreamNum); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): invalid codec", psmfPlayer, audioCodec, audioStreamNum); return ERROR_PSMFPLAYER_INVALID_STREAM; } if (psmfplayer->totalAudioStreams < 2 || !psmfplayer->mediaengine->setAudioStream(audioStreamNum)) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): unable to change stream", psmfPlayer, audioCodec, audioStreamNum); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i): unable to change stream", psmfPlayer, audioCodec, audioStreamNum); return ERROR_PSMFPLAYER_INVALID_STREAM; } - WARN_LOG_REPORT(ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i)", psmfPlayer, audioCodec, audioStreamNum); + WARN_LOG_REPORT(Log::ME, "scePsmfPlayerSelectSpecificAudio(%08x, %i, %i)", psmfPlayer, audioCodec, audioStreamNum); if (psmfplayer->audioStreamNum != audioStreamNum) { hleDelayResult(0, "psmf select audio", 100); } @@ -2042,7 +2042,7 @@ static u32 scePsmfPlayerConfigPlayer(u32 psmfPlayer, int configMode, int configA { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG(ME, "scePsmfPlayerConfigPlayer(%08x, %i, %i): invalid psmf player", psmfPlayer, configMode, configAttr); + ERROR_LOG(Log::ME, "scePsmfPlayerConfigPlayer(%08x, %i, %i): invalid psmf player", psmfPlayer, configMode, configAttr); return ERROR_PSMFPLAYER_INVALID_STATUS; } // This one works in any status as long as it's created. @@ -2050,18 +2050,18 @@ static u32 scePsmfPlayerConfigPlayer(u32 psmfPlayer, int configMode, int configA switch (configMode) { case PSMF_PLAYER_CONFIG_MODE_LOOP: if (configAttr != 0 && configAttr != 1) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerConfigPlayer(%08x, loop, %i): invalid value", psmfPlayer, configAttr); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerConfigPlayer(%08x, loop, %i): invalid value", psmfPlayer, configAttr); return ERROR_PSMFPLAYER_INVALID_PARAM; } - INFO_LOG(ME, "scePsmfPlayerConfigPlayer(%08x, loop, %i)", psmfPlayer, configAttr); + INFO_LOG(Log::ME, "scePsmfPlayerConfigPlayer(%08x, loop, %i)", psmfPlayer, configAttr); videoLoopStatus = configAttr; break; case PSMF_PLAYER_CONFIG_MODE_PIXEL_TYPE: if (configAttr < -1 || configAttr > 3) { - ERROR_LOG_REPORT(ME, "scePsmfPlayerConfigPlayer(%08x, pixelType, %i): invalid value", psmfPlayer, configAttr); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerConfigPlayer(%08x, pixelType, %i): invalid value", psmfPlayer, configAttr); return ERROR_PSMFPLAYER_INVALID_PARAM; } - INFO_LOG(ME, "scePsmfPlayerConfigPlayer(%08x, pixelType, %i)", psmfPlayer, configAttr); + INFO_LOG(Log::ME, "scePsmfPlayerConfigPlayer(%08x, pixelType, %i)", psmfPlayer, configAttr); // Does -1 mean default or something? if (configAttr != -1) { videoPixelMode = configAttr; @@ -2071,7 +2071,7 @@ static u32 scePsmfPlayerConfigPlayer(u32 psmfPlayer, int configMode, int configA } break; default: - ERROR_LOG_REPORT(ME, "scePsmfPlayerConfigPlayer(%08x, %i, %i): unknown parameter", psmfPlayer, configMode, configAttr); + ERROR_LOG_REPORT(Log::ME, "scePsmfPlayerConfigPlayer(%08x, %i, %i): unknown parameter", psmfPlayer, configMode, configAttr); return ERROR_PSMFPLAYER_INVALID_CONFIG; } @@ -2081,15 +2081,15 @@ static u32 scePsmfPlayerConfigPlayer(u32 psmfPlayer, int configMode, int configA static int __PsmfPlayerFinish(u32 psmfPlayer) { PsmfPlayer *psmfplayer = getPsmfPlayer(psmfPlayer); if (!psmfplayer) { - ERROR_LOG_REPORT(ME, "__PsmfPlayerFinish(%08x): invalid psmf player", psmfPlayer); + ERROR_LOG_REPORT(Log::ME, "__PsmfPlayerFinish(%08x): invalid psmf player", psmfPlayer); return ERROR_PSMFPLAYER_INVALID_STATUS; } if (psmfplayer->status != PSMF_PLAYER_STATUS_PLAYING) { - ERROR_LOG_REPORT(ME, "__PsmfPlayerFinish(%08x): unexpected status %d", psmfPlayer, psmfplayer->status); + ERROR_LOG_REPORT(Log::ME, "__PsmfPlayerFinish(%08x): unexpected status %d", psmfPlayer, psmfplayer->status); return ERROR_PSMFPLAYER_INVALID_STATUS; } - INFO_LOG(ME, "__PsmfPlayerFinish(%08x): video end reached", psmfPlayer); + INFO_LOG(Log::ME, "__PsmfPlayerFinish(%08x): video end reached", psmfPlayer); psmfplayer->status = PSMF_PLAYER_STATUS_PLAYING_FINISHED; return 0; } diff --git a/Core/HLE/scePspNpDrm_user.cpp b/Core/HLE/scePspNpDrm_user.cpp index f35f6b5239..b81d92a601 100644 --- a/Core/HLE/scePspNpDrm_user.cpp +++ b/Core/HLE/scePspNpDrm_user.cpp @@ -6,25 +6,25 @@ static int sceNpDrmSetLicenseeKey(u32 npDrmKeyAddr) { - INFO_LOG(HLE, "call sceNpDrmSetLicenseeKey(%08x)", npDrmKeyAddr); + INFO_LOG(Log::HLE, "call sceNpDrmSetLicenseeKey(%08x)", npDrmKeyAddr); return 0; } static int sceNpDrmClearLicenseeKey() { - INFO_LOG(HLE, "call sceNpDrmClearLicenseeKey()"); + INFO_LOG(Log::HLE, "call sceNpDrmClearLicenseeKey()"); return 0; } static int sceNpDrmRenameCheck(const char *filename) { - INFO_LOG(HLE, "call sceNpDrmRenameCheck(%s)", filename); + INFO_LOG(Log::HLE, "call sceNpDrmRenameCheck(%s)", filename); return 0; } static int sceNpDrmEdataSetupKey(u32 edataFd) { - INFO_LOG(HLE, "call sceNpDrmEdataSetupKey %x", edataFd); + INFO_LOG(Log::HLE, "call sceNpDrmEdataSetupKey %x", edataFd); int usec = 0; // set PGD offset int retval = __IoIoctl(edataFd, 0x04100002, 0x90, 0, 0, 0, usec); @@ -39,13 +39,13 @@ static int sceNpDrmEdataSetupKey(u32 edataFd) static int sceNpDrmEdataGetDataSize(u32 edataFd) { - INFO_LOG(HLE, "call sceNpDrmEdataGetDataSize %x", edataFd); + INFO_LOG(Log::HLE, "call sceNpDrmEdataGetDataSize %x", edataFd); return sceIoIoctl(edataFd, 0x04100010, 0, 0, 0, 0); } static int sceNpDrmOpen() { - ERROR_LOG(HLE, "UNIMPL sceNpDrmOpen"); + ERROR_LOG(Log::HLE, "UNIMPL sceNpDrmOpen"); return 0; } diff --git a/Core/HLE/sceRtc.cpp b/Core/HLE/sceRtc.cpp index 7ceca39ce5..ff0dd67620 100644 --- a/Core/HLE/sceRtc.cpp +++ b/Core/HLE/sceRtc.cpp @@ -279,13 +279,13 @@ static bool __RtcValidatePspTime(const ScePspDateTime &t) static u32 sceRtcGetTickResolution() { - DEBUG_LOG(SCERTC, "sceRtcGetTickResolution()"); + DEBUG_LOG(Log::sceRtc, "sceRtcGetTickResolution()"); return 1000000; } static u32 sceRtcGetCurrentTick(u32 tickPtr) { - VERBOSE_LOG(SCERTC, "sceRtcGetCurrentTick(%08x)", tickPtr); + VERBOSE_LOG(Log::sceRtc, "sceRtcGetCurrentTick(%08x)", tickPtr); u64 curTick = __RtcGetCurrentTick(); if (Memory::IsValidAddress(tickPtr)) @@ -297,7 +297,7 @@ static u32 sceRtcGetCurrentTick(u32 tickPtr) static u64 sceRtcGetAccumulativeTime() { - DEBUG_LOG(SCERTC, "sceRtcGetAccumulativeTime()"); + DEBUG_LOG(Log::sceRtc, "sceRtcGetAccumulativeTime()"); hleEatCycles(300); hleReSchedule("rtc accumulative time"); return __RtcGetCurrentTick(); @@ -312,7 +312,7 @@ static u32 sceRtcGetCurrentClock(u32 pspTimePtr, int tz) { time_t sec = (time_t)tv.tv_sec; tm *utc = gmtime(&sec); if (!utc) { - return hleLogError(SCERTC, 0, "Date is too high/low to handle, pretending to work"); + return hleLogError(Log::sceRtc, 0, "Date is too high/low to handle, pretending to work"); } utc->tm_isdst = -1; @@ -326,7 +326,7 @@ static u32 sceRtcGetCurrentClock(u32 pspTimePtr, int tz) { hleEatCycles(1900); hleReSchedule("rtc current clock"); - return hleLogSuccessI(SCERTC, 0); + return hleLogSuccessI(Log::sceRtc, 0); } static u32 sceRtcGetCurrentClockLocalTime(u32 pspTimePtr) { @@ -338,7 +338,7 @@ static u32 sceRtcGetCurrentClockLocalTime(u32 pspTimePtr) { time_t sec = (time_t)tv.tv_sec; const tm *local = localtime(&sec); if (!local) { - return hleLogError(SCERTC, 0, "Date is too high/low to handle, pretending to work"); + return hleLogError(Log::sceRtc, 0, "Date is too high/low to handle, pretending to work"); } if (pt.IsValid()) { @@ -348,7 +348,7 @@ static u32 sceRtcGetCurrentClockLocalTime(u32 pspTimePtr) { hleEatCycles(2000); hleReSchedule("rtc current clock local"); - return hleLogSuccessI(SCERTC, 0); + return hleLogSuccessI(Log::sceRtc, 0); } static u32 sceRtcSetTick(u32 pspTimePtr, u32 tickPtr) { @@ -356,10 +356,10 @@ static u32 sceRtcSetTick(u32 pspTimePtr, u32 tickPtr) { auto tick = PSPPointer::Create(tickPtr); if (!pt.IsValid() || !tick.IsValid()) - return hleLogError(SCERTC, 0, "bad address"); + return hleLogError(Log::sceRtc, 0, "bad address"); __RtcTicksToPspTime(*pt, *tick); - return hleLogSuccessI(SCERTC, 0); + return hleLogSuccessI(Log::sceRtc, 0); } static u32 sceRtcGetTick(u32 pspTimePtr, u32 tickPtr) { @@ -367,17 +367,17 @@ static u32 sceRtcGetTick(u32 pspTimePtr, u32 tickPtr) { auto tick = PSPPointer::Create(tickPtr); if (!pt.IsValid() || !tick.IsValid()) - return hleLogError(SCERTC, 0, "bad address"); + return hleLogError(Log::sceRtc, 0, "bad address"); if (!__RtcValidatePspTime(*pt)) - return hleLogWarning(SCERTC, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid time"); + return hleLogWarning(Log::sceRtc, SCE_KERNEL_ERROR_INVALID_VALUE, "invalid time"); *tick = __RtcPspTimeToTicks(*pt); - return hleLogSuccessI(SCERTC, 0); + return hleLogSuccessI(Log::sceRtc, 0); } static u32 sceRtcGetDayOfWeek(u32 year, u32 month, u32 day) { - DEBUG_LOG(SCERTC, "sceRtcGetDayOfWeek(%d, %d, %d)", year, month, day); + DEBUG_LOG(Log::sceRtc, "sceRtcGetDayOfWeek(%d, %d, %d)", year, month, day); if(month == 0) // Mark month 0 as august, don't know why, but works { @@ -426,7 +426,7 @@ static int __RtcDaysInMonth(u32 year, u32 month) static u32 sceRtcGetDaysInMonth(u32 year, u32 month) { - DEBUG_LOG(SCERTC, "sceRtcGetDaysInMonth(%d, %d)", year, month); + DEBUG_LOG(Log::sceRtc, "sceRtcGetDaysInMonth(%d, %d)", year, month); if (year == 0 || month == 0 || month > 12) return SCE_KERNEL_ERROR_INVALID_ARGUMENT; @@ -436,13 +436,13 @@ static u32 sceRtcGetDaysInMonth(u32 year, u32 month) static u32 sceRtcIsLeapYear(u32 year) { - DEBUG_LOG(SCERTC, "sceRtcIsLeapYear(%d)", year); + DEBUG_LOG(Log::sceRtc, "sceRtcIsLeapYear(%d)", year); return __RtcIsLeapYear(year) ? 1 : 0; } static int sceRtcConvertLocalTimeToUTC(u32 tickLocalPtr,u32 tickUTCPtr) { - DEBUG_LOG(SCERTC, "sceRtcConvertLocalTimeToUTC(%d, %d)", tickLocalPtr, tickUTCPtr); + DEBUG_LOG(Log::sceRtc, "sceRtcConvertLocalTimeToUTC(%d, %d)", tickLocalPtr, tickUTCPtr); if (Memory::IsValidAddress(tickLocalPtr) && Memory::IsValidAddress(tickUTCPtr)) { u64 srcTick = Memory::Read_U64(tickLocalPtr); @@ -467,7 +467,7 @@ static int sceRtcConvertLocalTimeToUTC(u32 tickLocalPtr,u32 tickUTCPtr) static int sceRtcConvertUtcToLocalTime(u32 tickUTCPtr,u32 tickLocalPtr) { - DEBUG_LOG(SCERTC, "sceRtcConvertLocalTimeToUTC(%d, %d)", tickLocalPtr, tickUTCPtr); + DEBUG_LOG(Log::sceRtc, "sceRtcConvertLocalTimeToUTC(%d, %d)", tickLocalPtr, tickUTCPtr); if (Memory::IsValidAddress(tickLocalPtr) && Memory::IsValidAddress(tickUTCPtr)) { u64 srcTick = Memory::Read_U64(tickUTCPtr); @@ -494,7 +494,7 @@ static int sceRtcCheckValid(u32 datePtr) { auto pt = PSPPointer::Create(datePtr); if (!pt.IsValid() ) - return hleLogError(SCERTC, -1, "bad address"); + return hleLogError(Log::sceRtc, -1, "bad address"); int result = 0; if (pt->year < 1 || pt->year > 9999) @@ -513,51 +513,51 @@ static int sceRtcCheckValid(u32 datePtr) { result = PSP_TIME_INVALID_SECONDS; else if (pt->microsecond >= 1000000UL) result = PSP_TIME_INVALID_MICROSECONDS; - return hleLogSuccessI(SCERTC, result); + return hleLogSuccessI(Log::sceRtc, result); } static int sceRtcSetTime_t(u32 datePtr, u32 time) { auto pt = PSPPointer::Create(datePtr); if (!pt.IsValid()) - return hleLogError(SCERTC, 1, "bad address"); + return hleLogError(Log::sceRtc, 1, "bad address"); __RtcTicksToPspTime(*pt, time * 1000000ULL + rtcMagicOffset); - return hleLogSuccessI(SCERTC, 0); + return hleLogSuccessI(Log::sceRtc, 0); } static int sceRtcSetTime64_t(u32 datePtr, u64 time) { auto pt = PSPPointer::Create(datePtr); if (!pt.IsValid()) - return hleLogError(SCERTC, 1, "bad address"); + return hleLogError(Log::sceRtc, 1, "bad address"); __RtcTicksToPspTime(*pt, time * 1000000ULL + rtcMagicOffset); - return hleLogSuccessI(SCERTC, 0); + return hleLogSuccessI(Log::sceRtc, 0); } static int sceRtcGetTime_t(u32 datePtr, u32 timePtr) { auto pt = PSPPointer::Create(datePtr); auto timep = PSPPointer::Create(timePtr); if (!pt.IsValid() || !timep.IsValid()) - return hleLogError(SCERTC, 1, "bad address"); + return hleLogError(Log::sceRtc, 1, "bad address"); *timep = (u32)((__RtcPspTimeToTicks(*pt) - rtcMagicOffset) / 1000000ULL); - return hleLogSuccessI(SCERTC, 0); + return hleLogSuccessI(Log::sceRtc, 0); } static int sceRtcGetTime64_t(u32 datePtr, u32 timePtr) { auto pt = PSPPointer::Create(datePtr); auto timep = PSPPointer::Create(timePtr); if (!pt.IsValid() || !timep.IsValid()) - return hleLogError(SCERTC, 1, "bad address"); + return hleLogError(Log::sceRtc, 1, "bad address"); *timep = (__RtcPspTimeToTicks(*pt) - rtcMagicOffset) / 1000000ULL; - return hleLogSuccessI(SCERTC, 0); + return hleLogSuccessI(Log::sceRtc, 0); } static int sceRtcSetDosTime(u32 datePtr, u32 dosTime) { auto pt = PSPPointer::Create(datePtr); if (!pt.IsValid()) - return hleLogError(SCERTC, 1, "bad address"); + return hleLogError(Log::sceRtc, 1, "bad address"); int hms = dosTime & 0xFFFF; int ymd = dosTime >> 16; @@ -570,21 +570,21 @@ static int sceRtcSetDosTime(u32 datePtr, u32 dosTime) { pt->second = (hms << 1) & 0x3E; pt->microsecond = 0; - return hleLogSuccessI(SCERTC, 0); + return hleLogSuccessI(Log::sceRtc, 0); } static int sceRtcGetDosTime(u32 datePtr, u32 dosTime) { auto datep = PSPPointer::Create(datePtr); auto dosp = PSPPointer::Create(dosTime); if (!datep.IsValid() || !dosp.IsValid()) - return hleLogError(SCERTC, -1, "bad address"); + return hleLogError(Log::sceRtc, -1, "bad address"); if (datep->year < 1980) { *dosp = 0; - return hleLogWarning(SCERTC, -1, "invalid year"); + return hleLogWarning(Log::sceRtc, -1, "invalid year"); } else if (datep->year >= 2108) { *dosp = 0xFF9FBF7D; - return hleLogWarning(SCERTC, -1, "invalid year"); + return hleLogWarning(Log::sceRtc, -1, "invalid year"); } int year = ((datep->year - 1980) & 0x7F) << 9; @@ -597,18 +597,18 @@ static int sceRtcGetDosTime(u32 datePtr, u32 dosTime) { int hms = hour | minute | second; *dosp = (ymd << 16) | hms; - return hleLogSuccessI(SCERTC, 0); + return hleLogSuccessI(Log::sceRtc, 0); } static int sceRtcSetWin32FileTime(u32 datePtr, u64 win32Time) { if (!Memory::IsValidAddress(datePtr)) { - ERROR_LOG_REPORT(SCERTC, "sceRtcSetWin32FileTime(%08x, %lld): invalid address", datePtr, win32Time); + ERROR_LOG_REPORT(Log::sceRtc, "sceRtcSetWin32FileTime(%08x, %lld): invalid address", datePtr, win32Time); return -1; } - DEBUG_LOG(SCERTC, "sceRtcSetWin32FileTime(%08x, %lld)", datePtr, win32Time); + DEBUG_LOG(Log::sceRtc, "sceRtcSetWin32FileTime(%08x, %lld)", datePtr, win32Time); u64 ticks = (win32Time / 10) + rtcFiletimeOffset; auto pspTime = PSPPointer::Create(datePtr); @@ -620,11 +620,11 @@ static int sceRtcGetWin32FileTime(u32 datePtr, u32 win32TimePtr) { if (!Memory::IsValidAddress(datePtr)) { - ERROR_LOG_REPORT(SCERTC, "sceRtcGetWin32FileTime(%08x, %08x): invalid address", datePtr, win32TimePtr); + ERROR_LOG_REPORT(Log::sceRtc, "sceRtcGetWin32FileTime(%08x, %08x): invalid address", datePtr, win32TimePtr); return -1; } - DEBUG_LOG(SCERTC, "sceRtcGetWin32FileTime(%08x, %08x)", datePtr, win32TimePtr); + DEBUG_LOG(Log::sceRtc, "sceRtcGetWin32FileTime(%08x, %08x)", datePtr, win32TimePtr); if (!Memory::IsValidAddress(win32TimePtr)) return SCE_KERNEL_ERROR_INVALID_VALUE; @@ -643,7 +643,7 @@ static int sceRtcGetWin32FileTime(u32 datePtr, u32 win32TimePtr) static int sceRtcCompareTick(u32 tick1Ptr, u32 tick2Ptr) { - DEBUG_LOG(SCERTC, "sceRtcCompareTick(%d,%d)", tick1Ptr, tick2Ptr); + DEBUG_LOG(Log::sceRtc, "sceRtcCompareTick(%d,%d)", tick1Ptr, tick2Ptr); if (Memory::IsValidAddress(tick1Ptr) && Memory::IsValidAddress(tick2Ptr)) { u64 tick1 = Memory::Read_U64(tick1Ptr); @@ -666,7 +666,7 @@ static int sceRtcTickAddTicks(u32 destTickPtr, u32 srcTickPtr, u64 numTicks) Memory::Write_U64(srcTick, destTickPtr); } - DEBUG_LOG(SCERTC, "sceRtcTickAddTicks(%x,%x,%llu)", destTickPtr, srcTickPtr, numTicks); + DEBUG_LOG(Log::sceRtc, "sceRtcTickAddTicks(%x,%x,%llu)", destTickPtr, srcTickPtr, numTicks); return 0; } @@ -680,7 +680,7 @@ static int sceRtcTickAddMicroseconds(u32 destTickPtr,u32 srcTickPtr, u64 numMS) Memory::Write_U64(srcTick, destTickPtr); } - DEBUG_LOG(SCERTC, "sceRtcTickAddMicroseconds(%x,%x,%llu)", destTickPtr, srcTickPtr, numMS); + DEBUG_LOG(Log::sceRtc, "sceRtcTickAddMicroseconds(%x,%x,%llu)", destTickPtr, srcTickPtr, numMS); return 0; } @@ -693,7 +693,7 @@ static int sceRtcTickAddSeconds(u32 destTickPtr, u32 srcTickPtr, u64 numSecs) srcTick += numSecs * 1000000UL; Memory::Write_U64(srcTick, destTickPtr); } - DEBUG_LOG(SCERTC, "sceRtcTickAddSeconds(%x,%x,%llu)", destTickPtr, srcTickPtr, numSecs); + DEBUG_LOG(Log::sceRtc, "sceRtcTickAddSeconds(%x,%x,%llu)", destTickPtr, srcTickPtr, numSecs); return 0; } @@ -706,7 +706,7 @@ static int sceRtcTickAddMinutes(u32 destTickPtr, u32 srcTickPtr, u64 numMins) srcTick += numMins*60000000UL; Memory::Write_U64(srcTick, destTickPtr); } - DEBUG_LOG(SCERTC, "sceRtcTickAddMinutes(%x,%x,%llu)", destTickPtr, srcTickPtr, numMins); + DEBUG_LOG(Log::sceRtc, "sceRtcTickAddMinutes(%x,%x,%llu)", destTickPtr, srcTickPtr, numMins); return 0; } @@ -718,7 +718,7 @@ static int sceRtcTickAddHours(u32 destTickPtr, u32 srcTickPtr, int numHours) srcTick += numHours * 3600ULL * 1000000ULL; Memory::Write_U64(srcTick, destTickPtr); } - DEBUG_LOG(SCERTC, "sceRtcTickAddMinutes(%d,%d,%d)", destTickPtr, srcTickPtr, numHours); + DEBUG_LOG(Log::sceRtc, "sceRtcTickAddMinutes(%d,%d,%d)", destTickPtr, srcTickPtr, numHours); return 0; } @@ -731,7 +731,7 @@ static int sceRtcTickAddDays(u32 destTickPtr, u32 srcTickPtr, int numDays) srcTick += numDays * 86400ULL * 1000000ULL; Memory::Write_U64(srcTick, destTickPtr); } - DEBUG_LOG(SCERTC, "sceRtcTickAddDays(%d,%d,%d)", destTickPtr, srcTickPtr, numDays); + DEBUG_LOG(Log::sceRtc, "sceRtcTickAddDays(%d,%d,%d)", destTickPtr, srcTickPtr, numDays); return 0; } @@ -744,7 +744,7 @@ static int sceRtcTickAddWeeks(u32 destTickPtr, u32 srcTickPtr, int numWeeks) srcTick += numWeeks * 7ULL * 86400ULL * 1000000ULL; Memory::Write_U64(srcTick, destTickPtr); } - DEBUG_LOG(SCERTC, "sceRtcTickAddWeeks(%d,%d,%d)", destTickPtr, srcTickPtr, numWeeks); + DEBUG_LOG(Log::sceRtc, "sceRtcTickAddWeeks(%d,%d,%d)", destTickPtr, srcTickPtr, numWeeks); return 0; } @@ -752,7 +752,7 @@ static int sceRtcTickAddMonths(u32 destTickPtr, u32 srcTickPtr, int numMonths) { if (!Memory::IsValidAddress(destTickPtr) || !Memory::IsValidAddress(srcTickPtr)) { - WARN_LOG(SCERTC, "sceRtcTickAddMonths(%08x, %08x, %d): invalid address", destTickPtr, srcTickPtr, numMonths); + WARN_LOG(Log::sceRtc, "sceRtcTickAddMonths(%08x, %08x, %d): invalid address", destTickPtr, srcTickPtr, numMonths); return -1; } @@ -784,7 +784,7 @@ static int sceRtcTickAddMonths(u32 destTickPtr, u32 srcTickPtr, int numMonths) Memory::Write_U64(__RtcPspTimeToTicks(pt), destTickPtr); } - DEBUG_LOG(SCERTC, "sceRtcTickAddMonths(%08x, %08x = %lld, %d)", destTickPtr, srcTickPtr, srcTick, numMonths); + DEBUG_LOG(Log::sceRtc, "sceRtcTickAddMonths(%08x, %08x = %lld, %d)", destTickPtr, srcTickPtr, srcTick, numMonths); return 0; } @@ -792,7 +792,7 @@ static int sceRtcTickAddYears(u32 destTickPtr, u32 srcTickPtr, int numYears) { if (!Memory::IsValidAddress(destTickPtr) || !Memory::IsValidAddress(srcTickPtr)) { - WARN_LOG(SCERTC, "sceRtcTickAddYears(%08x, %08x, %d): invalid address", destTickPtr, srcTickPtr, numYears); + WARN_LOG(Log::sceRtc, "sceRtcTickAddYears(%08x, %08x, %d): invalid address", destTickPtr, srcTickPtr, numYears); return -1; } @@ -812,13 +812,13 @@ static int sceRtcTickAddYears(u32 destTickPtr, u32 srcTickPtr, int numYears) Memory::Write_U64(__RtcPspTimeToTicks(pt), destTickPtr); } - DEBUG_LOG(SCERTC, "sceRtcTickAddYears(%08x, %08x = %lld, %d)", destTickPtr, srcTickPtr, srcTick, numYears); + DEBUG_LOG(Log::sceRtc, "sceRtcTickAddYears(%08x, %08x = %lld, %d)", destTickPtr, srcTickPtr, srcTick, numYears); return 0; } static int sceRtcParseDateTime(u32 destTickPtr, u32 dateStringPtr) { - ERROR_LOG_REPORT(SCERTC, "UNIMPL sceRtcParseDateTime(%d,%d)", destTickPtr, dateStringPtr); + ERROR_LOG_REPORT(Log::sceRtc, "UNIMPL sceRtcParseDateTime(%d,%d)", destTickPtr, dateStringPtr); return 0; } @@ -826,7 +826,7 @@ static int sceRtcGetLastAdjustedTime(u32 tickPtr) { if (Memory::IsValidAddress(tickPtr)) Memory::Write_U64(rtcLastAdjustedTicks, tickPtr); - DEBUG_LOG(SCERTC, "sceRtcGetLastAdjustedTime(%d)", tickPtr); + DEBUG_LOG(Log::sceRtc, "sceRtcGetLastAdjustedTime(%d)", tickPtr); return 0; } @@ -834,14 +834,14 @@ static int sceRtcGetLastReincarnatedTime(u32 tickPtr) { if (Memory::IsValidAddress(tickPtr)) Memory::Write_U64(rtcLastReincarnatedTicks, tickPtr); - DEBUG_LOG(SCERTC, "sceRtcGetLastReincarnatedTime(%d)", tickPtr); + DEBUG_LOG(Log::sceRtc, "sceRtcGetLastReincarnatedTime(%d)", tickPtr); return 0; } //Returns 0 on success, according to Project Diva 2nd jpcsptrace log static int sceRtcSetAlarmTick(u32 unknown1, u32 unknown2) { - ERROR_LOG_REPORT(SCERTC, "UNIMPL sceRtcSetAlarmTick(%x, %x)", unknown1, unknown2); + ERROR_LOG_REPORT(Log::sceRtc, "UNIMPL sceRtcSetAlarmTick(%x, %x)", unknown1, unknown2); return 0; } @@ -914,11 +914,11 @@ static int sceRtcFormatRFC2822(u32 outPtr, u32 srcTickPtr, int tz) if (!Memory::IsValidAddress(outPtr) || !Memory::IsValidAddress(srcTickPtr)) { // TODO: Not well tested. - ERROR_LOG(SCERTC, "sceRtcFormatRFC2822(%08x, %08x, %d): invalid address", outPtr, srcTickPtr, tz); + ERROR_LOG(Log::sceRtc, "sceRtcFormatRFC2822(%08x, %08x, %d): invalid address", outPtr, srcTickPtr, tz); return -1; } - DEBUG_LOG(SCERTC, "sceRtcFormatRFC2822(%08x, %08x, %d)", outPtr, srcTickPtr, tz); + DEBUG_LOG(Log::sceRtc, "sceRtcFormatRFC2822(%08x, %08x, %d)", outPtr, srcTickPtr, tz); return __RtcFormatRFC2822(outPtr, srcTickPtr, tz); } @@ -927,7 +927,7 @@ static int sceRtcFormatRFC2822LocalTime(u32 outPtr, u32 srcTickPtr) if (!Memory::IsValidAddress(outPtr) || !Memory::IsValidAddress(srcTickPtr)) { // TODO: Not well tested. - ERROR_LOG(SCERTC, "sceRtcFormatRFC2822LocalTime(%08x, %08x): invalid address", outPtr, srcTickPtr); + ERROR_LOG(Log::sceRtc, "sceRtcFormatRFC2822LocalTime(%08x, %08x): invalid address", outPtr, srcTickPtr); return -1; } @@ -942,7 +942,7 @@ static int sceRtcFormatRFC2822LocalTime(u32 outPtr, u32 srcTickPtr) tz_seconds = time->tm_gmtoff; #endif - DEBUG_LOG(SCERTC, "sceRtcFormatRFC2822LocalTime(%08x, %08x)", outPtr, srcTickPtr); + DEBUG_LOG(Log::sceRtc, "sceRtcFormatRFC2822LocalTime(%08x, %08x)", outPtr, srcTickPtr); return __RtcFormatRFC2822(outPtr, srcTickPtr, tz_seconds / 60); } @@ -951,11 +951,11 @@ static int sceRtcFormatRFC3339(u32 outPtr, u32 srcTickPtr, int tz) if (!Memory::IsValidAddress(outPtr) || !Memory::IsValidAddress(srcTickPtr)) { // TODO: Not well tested. - ERROR_LOG(SCERTC, "sceRtcFormatRFC3339(%08x, %08x, %d): invalid address", outPtr, srcTickPtr, tz); + ERROR_LOG(Log::sceRtc, "sceRtcFormatRFC3339(%08x, %08x, %d): invalid address", outPtr, srcTickPtr, tz); return -1; } - DEBUG_LOG(SCERTC, "sceRtcFormatRFC3339(%08x, %08x, %d)", outPtr, srcTickPtr, tz); + DEBUG_LOG(Log::sceRtc, "sceRtcFormatRFC3339(%08x, %08x, %d)", outPtr, srcTickPtr, tz); return __RtcFormatRFC3339(outPtr, srcTickPtr, tz); } @@ -964,7 +964,7 @@ static int sceRtcFormatRFC3339LocalTime(u32 outPtr, u32 srcTickPtr) if (!Memory::IsValidAddress(outPtr) || !Memory::IsValidAddress(srcTickPtr)) { // TODO: Not well tested. - ERROR_LOG(SCERTC, "sceRtcFormatRFC3339LocalTime(%08x, %08x): invalid address", outPtr, srcTickPtr); + ERROR_LOG(Log::sceRtc, "sceRtcFormatRFC3339LocalTime(%08x, %08x): invalid address", outPtr, srcTickPtr); return -1; } @@ -979,7 +979,7 @@ static int sceRtcFormatRFC3339LocalTime(u32 outPtr, u32 srcTickPtr) tz_seconds = time->tm_gmtoff; #endif - DEBUG_LOG(SCERTC, "sceRtcFormatRFC3339LocalTime(%08x, %08x)", outPtr, srcTickPtr); + DEBUG_LOG(Log::sceRtc, "sceRtcFormatRFC3339LocalTime(%08x, %08x)", outPtr, srcTickPtr); return __RtcFormatRFC3339(outPtr, srcTickPtr, tz_seconds / 60); } diff --git a/Core/HLE/sceSas.cpp b/Core/HLE/sceSas.cpp index d8a320ee55..19a73f168e 100644 --- a/Core/HLE/sceSas.cpp +++ b/Core/HLE/sceSas.cpp @@ -176,7 +176,7 @@ static void sasMixFinish(u64 userdata, int cycleslate) { __KernelResumeThreadFromWait(threadID, result); __KernelReSchedule("woke from sas mix"); } else { - WARN_LOG(HLE, "Someone else woke up SAS-blocked thread?"); + WARN_LOG(Log::HLE, "Someone else woke up SAS-blocked thread?"); } } @@ -225,26 +225,26 @@ void __SasShutdown() { static u32 sceSasInit(u32 core, u32 grainSize, u32 maxVoices, u32 outputMode, u32 sampleRate) { if (!Memory::IsValidAddress(core) || (core & 0x3F) != 0) { - ERROR_LOG_REPORT(SCESAS, "sceSasInit(%08x, %i, %i, %i, %i): bad core address", core, grainSize, maxVoices, outputMode, sampleRate); + ERROR_LOG_REPORT(Log::sceSas, "sceSasInit(%08x, %i, %i, %i, %i): bad core address", core, grainSize, maxVoices, outputMode, sampleRate); return ERROR_SAS_BAD_ADDRESS; } if (maxVoices == 0 || maxVoices > PSP_SAS_VOICES_MAX) { - ERROR_LOG_REPORT(SCESAS, "sceSasInit(%08x, %i, %i, %i, %i): bad max voices", core, grainSize, maxVoices, outputMode, sampleRate); + ERROR_LOG_REPORT(Log::sceSas, "sceSasInit(%08x, %i, %i, %i, %i): bad max voices", core, grainSize, maxVoices, outputMode, sampleRate); return ERROR_SAS_INVALID_MAX_VOICES; } if (grainSize < 0x40 || grainSize > 0x800 || (grainSize & 0x1F) != 0) { - ERROR_LOG_REPORT(SCESAS, "sceSasInit(%08x, %i, %i, %i, %i): bad grain size", core, grainSize, maxVoices, outputMode, sampleRate); + ERROR_LOG_REPORT(Log::sceSas, "sceSasInit(%08x, %i, %i, %i, %i): bad grain size", core, grainSize, maxVoices, outputMode, sampleRate); return ERROR_SAS_INVALID_GRAIN; } if (outputMode != 0 && outputMode != 1) { - ERROR_LOG_REPORT(SCESAS, "sceSasInit(%08x, %i, %i, %i, %i): bad output mode", core, grainSize, maxVoices, outputMode, sampleRate); + ERROR_LOG_REPORT(Log::sceSas, "sceSasInit(%08x, %i, %i, %i, %i): bad output mode", core, grainSize, maxVoices, outputMode, sampleRate); return ERROR_SAS_INVALID_OUTPUT_MODE; } if (sampleRate != 44100) { - ERROR_LOG_REPORT(SCESAS, "sceSasInit(%08x, %i, %i, %i, %i): bad sample rate", core, grainSize, maxVoices, outputMode, sampleRate); + ERROR_LOG_REPORT(Log::sceSas, "sceSasInit(%08x, %i, %i, %i, %i): bad sample rate", core, grainSize, maxVoices, outputMode, sampleRate); return ERROR_SAS_INVALID_SAMPLE_RATE; } - INFO_LOG(SCESAS, "sceSasInit(%08x, %i, %i, %i, %i)", core, grainSize, maxVoices, outputMode, sampleRate); + INFO_LOG(Log::sceSas, "sceSasInit(%08x, %i, %i, %i, %i)", core, grainSize, maxVoices, outputMode, sampleRate); sas->SetGrainSize(grainSize); // Seems like maxVoices is actually ignored for all intents and purposes. @@ -266,7 +266,7 @@ static u32 sceSasGetEndFlag(u32 core) { endFlag |= (1 << i); } - VERBOSE_LOG(SCESAS, "%08x=sceSasGetEndFlag(%08x)", endFlag, core); + VERBOSE_LOG(Log::sceSas, "%08x=sceSasGetEndFlag(%08x)", endFlag, core); return endFlag; } @@ -288,15 +288,15 @@ static u32 _sceSasCore(u32 core, u32 outAddr) { PROFILE_THIS_SCOPE("mixer"); if (!Memory::IsValidAddress(outAddr)) { - return hleReportError(SCESAS, ERROR_SAS_INVALID_PARAMETER, "invalid address"); + return hleReportError(Log::sceSas, ERROR_SAS_INVALID_PARAMETER, "invalid address"); } if (!__KernelIsDispatchEnabled()) { - return hleLogError(SCESAS, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogError(Log::sceSas, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); } __SasEnqueueMix(outAddr); - return hleLogSuccessVerboseI(SCESAS, delaySasResult(0)); + return hleLogSuccessVerboseI(Log::sceSas, delaySasResult(0)); } // Another way of running the mixer, the inoutAddr should be both input and output @@ -304,47 +304,47 @@ static u32 _sceSasCoreWithMix(u32 core, u32 inoutAddr, int leftVolume, int right PROFILE_THIS_SCOPE("mixer"); if (!Memory::IsValidAddress(inoutAddr)) { - return hleReportError(SCESAS, ERROR_SAS_INVALID_PARAMETER, "invalid address"); + return hleReportError(Log::sceSas, ERROR_SAS_INVALID_PARAMETER, "invalid address"); } if (sas->outputMode == PSP_SAS_OUTPUTMODE_RAW) { - return hleReportError(SCESAS, 0x80000004, "unsupported outputMode"); + return hleReportError(Log::sceSas, 0x80000004, "unsupported outputMode"); } if (!__KernelIsDispatchEnabled()) { - return hleLogError(SCESAS, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogError(Log::sceSas, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); } __SasEnqueueMix(inoutAddr, inoutAddr, leftVolume, rightVolume); - return hleLogSuccessVerboseI(SCESAS, delaySasResult(0)); + return hleLogSuccessVerboseI(Log::sceSas, delaySasResult(0)); } static u32 sceSasSetVoice(u32 core, int voiceNum, u32 vagAddr, int size, int loop) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - return hleLogVerbose(SCESAS, ERROR_SAS_INVALID_VOICE, "invalid voicenum"); + return hleLogVerbose(Log::sceSas, ERROR_SAS_INVALID_VOICE, "invalid voicenum"); } if (size == 0 || ((u32)size & 0xF) != 0) { if (size == 0) { - DEBUG_LOG(SCESAS, "%s: invalid size %d", __FUNCTION__, size); + DEBUG_LOG(Log::sceSas, "%s: invalid size %d", __FUNCTION__, size); } else { - WARN_LOG(SCESAS, "%s: invalid size %d", __FUNCTION__, size); + WARN_LOG(Log::sceSas, "%s: invalid size %d", __FUNCTION__, size); } return ERROR_SAS_INVALID_PARAMETER; } if (loop != 0 && loop != 1) { - WARN_LOG_REPORT(SCESAS, "%s: invalid loop mode %d", __FUNCTION__, loop); + WARN_LOG_REPORT(Log::sceSas, "%s: invalid loop mode %d", __FUNCTION__, loop); return ERROR_SAS_INVALID_LOOP_POS; } if (!Memory::IsValidAddress(vagAddr)) { - ERROR_LOG(SCESAS, "%s: Ignoring invalid VAG audio address %08x", __FUNCTION__, vagAddr); + ERROR_LOG(Log::sceSas, "%s: Ignoring invalid VAG audio address %08x", __FUNCTION__, vagAddr); return 0; } __SasDrain(); SasVoice &v = sas->voices[voiceNum]; if (v.type == VOICETYPE_ATRAC3) { - return hleLogError(SCESAS, ERROR_SAS_ATRAC3_ALREADY_SET, "voice is already ATRAC3"); + return hleLogError(Log::sceSas, ERROR_SAS_ATRAC3_ALREADY_SET, "voice is already ATRAC3"); } if (size < 0) { @@ -354,9 +354,9 @@ static u32 sceSasSetVoice(u32 core, int voiceNum, u32 vagAddr, int size, int loo // Needs more rigorous testing perhaps, but this fixes issue https://github.com/hrydgard/ppsspp/issues/5652 // while being fairly low risk to other games. size = 0; - DEBUG_LOG(SCESAS, "sceSasSetVoice(%08x, %i, %08x, %i, %i) : HACK: Negative size changed to 0", core, voiceNum, vagAddr, size, loop); + DEBUG_LOG(Log::sceSas, "sceSasSetVoice(%08x, %i, %08x, %i, %i) : HACK: Negative size changed to 0", core, voiceNum, vagAddr, size, loop); } else { - DEBUG_LOG(SCESAS, "sceSasSetVoice(%08x, %i, %08x, %i, %i)", core, voiceNum, vagAddr, size, loop); + DEBUG_LOG(Log::sceSas, "sceSasSetVoice(%08x, %i, %08x, %i, %i)", core, voiceNum, vagAddr, size, loop); } u32 prevVagAddr = v.vagAddr; @@ -373,28 +373,28 @@ static u32 sceSasSetVoice(u32 core, int voiceNum, u32 vagAddr, int size, int loo static u32 sceSasSetVoicePCM(u32 core, int voiceNum, u32 pcmAddr, int size, int loopPos) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - return hleLogWarning(SCESAS, ERROR_SAS_INVALID_VOICE, "invalid voicenum"); + return hleLogWarning(Log::sceSas, ERROR_SAS_INVALID_VOICE, "invalid voicenum"); } if (size <= 0 || size > 0x10000) { - WARN_LOG(SCESAS, "%s: invalid size %d", __FUNCTION__, size); + WARN_LOG(Log::sceSas, "%s: invalid size %d", __FUNCTION__, size); return ERROR_SAS_INVALID_PCM_SIZE; } if (loopPos >= size) { - ERROR_LOG_REPORT(SCESAS, "sceSasSetVoicePCM(%08x, %i, %08x, %i, %i): bad loop pos", core, voiceNum, pcmAddr, size, loopPos); + ERROR_LOG_REPORT(Log::sceSas, "sceSasSetVoicePCM(%08x, %i, %08x, %i, %i): bad loop pos", core, voiceNum, pcmAddr, size, loopPos); return ERROR_SAS_INVALID_LOOP_POS; } if (!Memory::IsValidAddress(pcmAddr)) { - ERROR_LOG(SCESAS, "Ignoring invalid PCM audio address %08x", pcmAddr); + ERROR_LOG(Log::sceSas, "Ignoring invalid PCM audio address %08x", pcmAddr); return 0; } __SasDrain(); SasVoice &v = sas->voices[voiceNum]; if (v.type == VOICETYPE_ATRAC3) { - return hleLogError(SCESAS, ERROR_SAS_ATRAC3_ALREADY_SET, "voice is already ATRAC3"); + return hleLogError(Log::sceSas, ERROR_SAS_ATRAC3_ALREADY_SET, "voice is already ATRAC3"); } - DEBUG_LOG(SCESAS, "sceSasSetVoicePCM(%08x, %i, %08x, %i, %i)", core, voiceNum, pcmAddr, size, loopPos); + DEBUG_LOG(Log::sceSas, "sceSasSetVoicePCM(%08x, %i, %08x, %i, %i)", core, voiceNum, pcmAddr, size, loopPos); u32 prevPcmAddr = v.pcmAddr; v.type = VOICETYPE_PCM; @@ -415,12 +415,12 @@ static u32 sceSasGetPauseFlag(u32 core) { pauseFlag |= (1 << i); } - DEBUG_LOG(SCESAS, "sceSasGetPauseFlag(%08x)", pauseFlag); + DEBUG_LOG(Log::sceSas, "sceSasGetPauseFlag(%08x)", pauseFlag); return pauseFlag; } static u32 sceSasSetPause(u32 core, u32 voicebit, int pause) { - DEBUG_LOG(SCESAS, "sceSasSetPause(%08x, %08x, %i)", core, voicebit, pause); + DEBUG_LOG(Log::sceSas, "sceSasSetPause(%08x, %08x, %i)", core, voicebit, pause); __SasDrain(); for (int i = 0; voicebit != 0; i++, voicebit >>= 1) { @@ -434,10 +434,10 @@ static u32 sceSasSetPause(u32 core, u32 voicebit, int pause) { } static u32 sceSasSetVolume(u32 core, int voiceNum, int leftVol, int rightVol, int effectLeftVol, int effectRightVol) { - DEBUG_LOG(SCESAS, "sceSasSetVolume(%08x, %i, %i, %i, %i, %i)", core, voiceNum, leftVol, rightVol, effectLeftVol, effectRightVol); + DEBUG_LOG(Log::sceSas, "sceSasSetVolume(%08x, %i, %i, %i, %i, %i)", core, voiceNum, leftVol, rightVol, effectLeftVol, effectRightVol); if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - WARN_LOG(SCESAS, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); + WARN_LOG(Log::sceSas, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); return ERROR_SAS_INVALID_VOICE; } bool overVolume = abs(leftVol) > PSP_SAS_VOL_MAX || abs(rightVol) > PSP_SAS_VOL_MAX; @@ -456,15 +456,15 @@ static u32 sceSasSetVolume(u32 core, int voiceNum, int leftVol, int rightVol, in static u32 sceSasSetPitch(u32 core, int voiceNum, int pitch) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - WARN_LOG(SCESAS, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); + WARN_LOG(Log::sceSas, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); return ERROR_SAS_INVALID_VOICE; } if (pitch < PSP_SAS_PITCH_MIN || pitch > PSP_SAS_PITCH_MAX) { - WARN_LOG(SCESAS, "sceSasSetPitch(%08x, %i, %i): bad pitch", core, voiceNum, pitch); + WARN_LOG(Log::sceSas, "sceSasSetPitch(%08x, %i, %i): bad pitch", core, voiceNum, pitch); return ERROR_SAS_INVALID_PITCH; } - DEBUG_LOG(SCESAS, "sceSasSetPitch(%08x, %i, %i)", core, voiceNum, pitch); + DEBUG_LOG(Log::sceSas, "sceSasSetPitch(%08x, %i, %i)", core, voiceNum, pitch); __SasDrain(); SasVoice &v = sas->voices[voiceNum]; v.pitch = pitch; @@ -472,10 +472,10 @@ static u32 sceSasSetPitch(u32 core, int voiceNum, int pitch) { } static u32 sceSasSetKeyOn(u32 core, int voiceNum) { - DEBUG_LOG(SCESAS, "sceSasSetKeyOn(%08x, %i)", core, voiceNum); + DEBUG_LOG(Log::sceSas, "sceSasSetKeyOn(%08x, %i)", core, voiceNum); if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - WARN_LOG(SCESAS, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); + WARN_LOG(Log::sceSas, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); return ERROR_SAS_INVALID_VOICE; } @@ -492,10 +492,10 @@ static u32 sceSasSetKeyOn(u32 core, int voiceNum) { // sceSasSetKeyOff can be used to start sounds, that just sound during the Release phase! static u32 sceSasSetKeyOff(u32 core, int voiceNum) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - WARN_LOG(SCESAS, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); + WARN_LOG(Log::sceSas, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); return ERROR_SAS_INVALID_VOICE; } else { - DEBUG_LOG(SCESAS, "sceSasSetKeyOff(%08x, %i)", core, voiceNum); + DEBUG_LOG(Log::sceSas, "sceSasSetKeyOff(%08x, %i)", core, voiceNum); __SasDrain(); if (sas->voices[voiceNum].paused || !sas->voices[voiceNum].on) { @@ -510,15 +510,15 @@ static u32 sceSasSetKeyOff(u32 core, int voiceNum) { static u32 sceSasSetNoise(u32 core, int voiceNum, int freq) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - WARN_LOG(SCESAS, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); + WARN_LOG(Log::sceSas, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); return ERROR_SAS_INVALID_VOICE; } if (freq < 0 || freq >= 64) { - DEBUG_LOG(SCESAS, "sceSasSetNoise(%08x, %i, %i)", core, voiceNum, freq); + DEBUG_LOG(Log::sceSas, "sceSasSetNoise(%08x, %i, %i)", core, voiceNum, freq); return ERROR_SAS_INVALID_NOISE_FREQ; } - DEBUG_LOG(SCESAS, "sceSasSetNoise(%08x, %i, %i)", core, voiceNum, freq); + DEBUG_LOG(Log::sceSas, "sceSasSetNoise(%08x, %i, %i)", core, voiceNum, freq); __SasDrain(); SasVoice &v = sas->voices[voiceNum]; @@ -529,11 +529,11 @@ static u32 sceSasSetNoise(u32 core, int voiceNum, int freq) { static u32 sceSasSetSL(u32 core, int voiceNum, int level) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - WARN_LOG(SCESAS, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); + WARN_LOG(Log::sceSas, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); return ERROR_SAS_INVALID_VOICE; } - DEBUG_LOG(SCESAS, "sceSasSetSL(%08x, %i, %08x)", core, voiceNum, level); + DEBUG_LOG(Log::sceSas, "sceSasSetSL(%08x, %i, %08x)", core, voiceNum, level); __SasDrain(); SasVoice &v = sas->voices[voiceNum]; v.envelope.SetSustainLevel(level); @@ -542,17 +542,17 @@ static u32 sceSasSetSL(u32 core, int voiceNum, int level) { static u32 sceSasSetADSR(u32 core, int voiceNum, int flag, int a, int d, int s, int r) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - WARN_LOG(SCESAS, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); + WARN_LOG(Log::sceSas, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); return ERROR_SAS_INVALID_VOICE; } // Create a mask like flag for the invalid values. int invalid = (a < 0 ? 0x1 : 0) | (d < 0 ? 0x2 : 0) | (s < 0 ? 0x4 : 0) | (r < 0 ? 0x8 : 0); if (invalid & flag) { - WARN_LOG_REPORT(SCESAS, "sceSasSetADSR(%08x, %i, %i, %08x, %08x, %08x, %08x): invalid value", core, voiceNum, flag, a, d, s, r); + WARN_LOG_REPORT(Log::sceSas, "sceSasSetADSR(%08x, %i, %i, %08x, %08x, %08x, %08x): invalid value", core, voiceNum, flag, a, d, s, r); return ERROR_SAS_INVALID_ADSR_RATE; } - DEBUG_LOG(SCESAS, "0=sceSasSetADSR(%08x, %i, %i, %08x, %08x, %08x, %08x)", core, voiceNum, flag, a, d, s, r); + DEBUG_LOG(Log::sceSas, "0=sceSasSetADSR(%08x, %i, %i, %08x, %08x, %08x, %08x)", core, voiceNum, flag, a, d, s, r); __SasDrain(); SasVoice &v = sas->voices[voiceNum]; @@ -562,7 +562,7 @@ static u32 sceSasSetADSR(u32 core, int voiceNum, int flag, int a, int d, int s, static u32 sceSasSetADSRMode(u32 core, int voiceNum, int flag, int a, int d, int s, int r) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - WARN_LOG(SCESAS, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); + WARN_LOG(Log::sceSas, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); return ERROR_SAS_INVALID_VOICE; } @@ -589,14 +589,14 @@ static u32 sceSasSetADSRMode(u32 core, int voiceNum, int flag, int a, int d, int if (invalid & flag) { if (a == 5 && d == 5 && s == 5 && r == 5) { // Some games do this right at init. It seems to fail even on a PSP, but let's not report it. - DEBUG_LOG(SCESAS, "sceSasSetADSRMode(%08x, %i, %i, %08x, %08x, %08x, %08x): invalid modes", core, voiceNum, flag, a, d, s, r); + DEBUG_LOG(Log::sceSas, "sceSasSetADSRMode(%08x, %i, %i, %08x, %08x, %08x, %08x): invalid modes", core, voiceNum, flag, a, d, s, r); } else { - WARN_LOG_REPORT(SCESAS, "sceSasSetADSRMode(%08x, %i, %i, %08x, %08x, %08x, %08x): invalid modes", core, voiceNum, flag, a, d, s, r); + WARN_LOG_REPORT(Log::sceSas, "sceSasSetADSRMode(%08x, %i, %i, %08x, %08x, %08x, %08x): invalid modes", core, voiceNum, flag, a, d, s, r); } return ERROR_SAS_INVALID_ADSR_CURVE_MODE; } - DEBUG_LOG(SCESAS, "sceSasSetADSRMode(%08x, %i, %i, %08x, %08x, %08x, %08x)", core, voiceNum, flag, a, d, s, r); + DEBUG_LOG(Log::sceSas, "sceSasSetADSRMode(%08x, %i, %i, %08x, %08x, %08x, %08x)", core, voiceNum, flag, a, d, s, r); __SasDrain(); SasVoice &v = sas->voices[voiceNum]; v.envelope.SetEnvelope(flag, a, d, s, r); @@ -606,16 +606,16 @@ static u32 sceSasSetADSRMode(u32 core, int voiceNum, int flag, int a, int d, int static u32 sceSasSetSimpleADSR(u32 core, int voiceNum, u32 ADSREnv1, u32 ADSREnv2) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - WARN_LOG(SCESAS, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); + WARN_LOG(Log::sceSas, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); return ERROR_SAS_INVALID_VOICE; } // This bit could be related to decay type or systain type, but gives an error if you try to set it. if ((ADSREnv2 >> 13) & 1) { - WARN_LOG_REPORT(SCESAS, "sceSasSetSimpleADSR(%08x, %d, %04x, %04x): Invalid ADSREnv2", core, voiceNum, ADSREnv1, ADSREnv2); + WARN_LOG_REPORT(Log::sceSas, "sceSasSetSimpleADSR(%08x, %d, %04x, %04x): Invalid ADSREnv2", core, voiceNum, ADSREnv1, ADSREnv2); return ERROR_SAS_INVALID_ADSR_CURVE_MODE; } - DEBUG_LOG(SCESAS, "sasSetSimpleADSR(%08x, %i, %08x, %08x)", core, voiceNum, ADSREnv1, ADSREnv2); + DEBUG_LOG(Log::sceSas, "sasSetSimpleADSR(%08x, %i, %08x, %08x)", core, voiceNum, ADSREnv1, ADSREnv2); __SasDrain(); SasVoice &v = sas->voices[voiceNum]; @@ -625,82 +625,82 @@ static u32 sceSasSetSimpleADSR(u32 core, int voiceNum, u32 ADSREnv1, u32 ADSREnv static u32 sceSasGetEnvelopeHeight(u32 core, int voiceNum) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - ERROR_LOG(SCESAS, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); + ERROR_LOG(Log::sceSas, "%s: invalid voicenum %d", __FUNCTION__, voiceNum); return ERROR_SAS_INVALID_VOICE; } __SasDrain(); SasVoice &v = sas->voices[voiceNum]; int height = v.envelope.GetHeight(); - DEBUG_LOG(SCESAS, "%i = sceSasGetEnvelopeHeight(%08x, %i)", height, core, voiceNum); + DEBUG_LOG(Log::sceSas, "%i = sceSasGetEnvelopeHeight(%08x, %i)", height, core, voiceNum); return height; } static u32 sceSasRevType(u32 core, int type) { if (type < PSP_SAS_EFFECT_TYPE_OFF || type > PSP_SAS_EFFECT_TYPE_MAX) { - return hleLogError(SCESAS, ERROR_SAS_REV_INVALID_TYPE, "invalid type"); + return hleLogError(Log::sceSas, ERROR_SAS_REV_INVALID_TYPE, "invalid type"); } __SasDrain(); sas->SetWaveformEffectType(type); - return hleLogSuccessI(SCESAS, 0); + return hleLogSuccessI(Log::sceSas, 0); } static u32 sceSasRevParam(u32 core, int delay, int feedback) { if (delay < 0 || delay >= 128) { - return hleLogError(SCESAS, ERROR_SAS_REV_INVALID_DELAY, "invalid delay value"); + return hleLogError(Log::sceSas, ERROR_SAS_REV_INVALID_DELAY, "invalid delay value"); } if (feedback < 0 || feedback >= 128) { - return hleLogError(SCESAS, ERROR_SAS_REV_INVALID_FEEDBACK, "invalid feedback value"); + return hleLogError(Log::sceSas, ERROR_SAS_REV_INVALID_FEEDBACK, "invalid feedback value"); } __SasDrain(); sas->waveformEffect.delay = delay; sas->waveformEffect.feedback = feedback; - return hleLogSuccessI(SCESAS, 0); + return hleLogSuccessI(Log::sceSas, 0); } static u32 sceSasRevEVOL(u32 core, u32 lv, u32 rv) { if (lv > 0x1000 || rv > 0x1000) { - return hleReportDebug(SCESAS, ERROR_SAS_REV_INVALID_VOLUME, "invalid volume"); + return hleReportDebug(Log::sceSas, ERROR_SAS_REV_INVALID_VOLUME, "invalid volume"); } __SasDrain(); sas->waveformEffect.leftVol = lv; sas->waveformEffect.rightVol = rv; - return hleLogSuccessI(SCESAS, 0); + return hleLogSuccessI(Log::sceSas, 0); } static u32 sceSasRevVON(u32 core, int dry, int wet) { __SasDrain(); sas->waveformEffect.isDryOn = dry != 0; sas->waveformEffect.isWetOn = wet != 0; - return hleLogSuccessI(SCESAS, 0); + return hleLogSuccessI(Log::sceSas, 0); } static u32 sceSasGetGrain(u32 core) { - DEBUG_LOG(SCESAS, "sceSasGetGrain(%08x)", core); + DEBUG_LOG(Log::sceSas, "sceSasGetGrain(%08x)", core); return sas->GetGrainSize(); } static u32 sceSasSetGrain(u32 core, int grain) { - INFO_LOG(SCESAS, "sceSasSetGrain(%08x, %i)", core, grain); + INFO_LOG(Log::sceSas, "sceSasSetGrain(%08x, %i)", core, grain); __SasDrain(); sas->SetGrainSize(grain); return 0; } static u32 sceSasGetOutputMode(u32 core) { - DEBUG_LOG(SCESAS, "sceSasGetOutputMode(%08x)", core); + DEBUG_LOG(Log::sceSas, "sceSasGetOutputMode(%08x)", core); return sas->outputMode; } static u32 sceSasSetOutputMode(u32 core, u32 outputMode) { if (outputMode != 0 && outputMode != 1) { - ERROR_LOG_REPORT(SCESAS, "sceSasSetOutputMode(%08x, %i): bad output mode", core, outputMode); + ERROR_LOG_REPORT(Log::sceSas, "sceSasSetOutputMode(%08x, %i): bad output mode", core, outputMode); return ERROR_SAS_INVALID_OUTPUT_MODE; } - DEBUG_LOG(SCESAS, "sceSasSetOutputMode(%08x, %i)", core, outputMode); + DEBUG_LOG(Log::sceSas, "sceSasSetOutputMode(%08x, %i)", core, outputMode); __SasDrain(); sas->outputMode = outputMode; @@ -708,7 +708,7 @@ static u32 sceSasSetOutputMode(u32 core, u32 outputMode) { } static u32 sceSasGetAllEnvelopeHeights(u32 core, u32 heightsAddr) { - DEBUG_LOG(SCESAS, "sceSasGetAllEnvelopeHeights(%08x, %i)", core, heightsAddr); + DEBUG_LOG(Log::sceSas, "sceSasGetAllEnvelopeHeights(%08x, %i)", core, heightsAddr); if (!Memory::IsValidAddress(heightsAddr)) { return ERROR_SAS_INVALID_PARAMETER; @@ -724,24 +724,24 @@ static u32 sceSasGetAllEnvelopeHeights(u32 core, u32 heightsAddr) { } static u32 sceSasSetTriangularWave(u32 sasCore, int voice, int unknown) { - ERROR_LOG_REPORT(SCESAS, "UNIMPL sceSasSetTriangularWave(%08x, %i, %i)", sasCore, voice, unknown); + ERROR_LOG_REPORT(Log::sceSas, "UNIMPL sceSasSetTriangularWave(%08x, %i, %i)", sasCore, voice, unknown); return 0; } static u32 sceSasSetSteepWave(u32 sasCore, int voice, int unknown) { - ERROR_LOG_REPORT(SCESAS, "UNIMPL sceSasSetSteepWave(%08x, %i, %i)", sasCore, voice, unknown); + ERROR_LOG_REPORT(Log::sceSas, "UNIMPL sceSasSetSteepWave(%08x, %i, %i)", sasCore, voice, unknown); return 0; } static u32 __sceSasSetVoiceATRAC3(u32 core, int voiceNum, u32 atrac3Context) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - return hleLogWarning(SCESAS, ERROR_SAS_INVALID_VOICE, "invalid voicenum"); + return hleLogWarning(Log::sceSas, ERROR_SAS_INVALID_VOICE, "invalid voicenum"); } __SasDrain(); SasVoice &v = sas->voices[voiceNum]; if (v.type == VOICETYPE_ATRAC3) { - return hleLogError(SCESAS, ERROR_SAS_ATRAC3_ALREADY_SET, "voice is already ATRAC3"); + return hleLogError(Log::sceSas, ERROR_SAS_ATRAC3_ALREADY_SET, "voice is already ATRAC3"); } v.type = VOICETYPE_ATRAC3; v.loop = false; @@ -749,15 +749,15 @@ static u32 __sceSasSetVoiceATRAC3(u32 core, int voiceNum, u32 atrac3Context) { v.atrac3.setContext(atrac3Context); Memory::Write_U32(atrac3Context, core + 56 * voiceNum + 20); - return hleLogSuccessI(SCESAS, 0); + return hleLogSuccessI(Log::sceSas, 0); } static u32 __sceSasConcatenateATRAC3(u32 core, int voiceNum, u32 atrac3DataAddr, int atrac3DataLength) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - return hleLogWarning(SCESAS, ERROR_SAS_INVALID_VOICE, "invalid voicenum"); + return hleLogWarning(Log::sceSas, ERROR_SAS_INVALID_VOICE, "invalid voicenum"); } - DEBUG_LOG_REPORT(SCESAS, "__sceSasConcatenateATRAC3(%08x, %i, %08x, %i)", core, voiceNum, atrac3DataAddr, atrac3DataLength); + DEBUG_LOG_REPORT(Log::sceSas, "__sceSasConcatenateATRAC3(%08x, %i, %08x, %i)", core, voiceNum, atrac3DataAddr, atrac3DataLength); __SasDrain(); SasVoice &v = sas->voices[voiceNum]; if (Memory::IsValidAddress(atrac3DataAddr)) @@ -767,13 +767,13 @@ static u32 __sceSasConcatenateATRAC3(u32 core, int voiceNum, u32 atrac3DataAddr, static u32 __sceSasUnsetATRAC3(u32 core, int voiceNum) { if (voiceNum >= PSP_SAS_VOICES_MAX || voiceNum < 0) { - return hleLogWarning(SCESAS, ERROR_SAS_INVALID_VOICE, "invalid voicenum"); + return hleLogWarning(Log::sceSas, ERROR_SAS_INVALID_VOICE, "invalid voicenum"); } __SasDrain(); SasVoice &v = sas->voices[voiceNum]; if (v.type != VOICETYPE_ATRAC3) { - return hleLogError(SCESAS, ERROR_SAS_ATRAC3_NOT_SET, "voice is not ATRAC3"); + return hleLogError(Log::sceSas, ERROR_SAS_ATRAC3_NOT_SET, "voice is not ATRAC3"); } v.type = VOICETYPE_OFF; v.playing = false; @@ -782,7 +782,7 @@ static u32 __sceSasUnsetATRAC3(u32 core, int voiceNum) { v.paused = false; Memory::Write_U32(0, core + 56 * voiceNum + 20); - return hleLogSuccessI(SCESAS, 0); + return hleLogSuccessI(Log::sceSas, 0); } void __SasGetDebugStats(char *stats, size_t bufsize) { diff --git a/Core/HLE/sceSfmt19937.cpp b/Core/HLE/sceSfmt19937.cpp index d0cc399094..4e56b97c41 100644 --- a/Core/HLE/sceSfmt19937.cpp +++ b/Core/HLE/sceSfmt19937.cpp @@ -28,10 +28,10 @@ static int sceSfmt19937InitGenRand(u32 sfmt, u32 seed) { if (!Memory::IsValidAddress(sfmt)) { - ERROR_LOG(HLE, "sceSfmt19937InitGenRand(sfmt=%08x, seed=%08x) - bad address(es)", sfmt, seed); + ERROR_LOG(Log::HLE, "sceSfmt19937InitGenRand(sfmt=%08x, seed=%08x) - bad address(es)", sfmt, seed); return -1; } - INFO_LOG(HLE, "sceSfmt19937InitGenRand(sfmt=%08x, seed=%08x)", sfmt, seed); + INFO_LOG(Log::HLE, "sceSfmt19937InitGenRand(sfmt=%08x, seed=%08x)", sfmt, seed); sfmt_t *psfmt = (sfmt_t *)Memory::GetPointerUnchecked(sfmt); sfmt_init_gen_rand(psfmt, seed); @@ -41,10 +41,10 @@ static int sceSfmt19937InitGenRand(u32 sfmt, u32 seed) { static int sceSfmt19937InitByArray(u32 sfmt, u32 seeds, int seedslen) { if (!Memory::IsValidAddress(sfmt) || !Memory::IsValidAddress(seeds) || !Memory::IsValidAddress(seeds + 4 * (seedslen - 1))) { - ERROR_LOG(HLE, "sceSfmt19937InitByArray(sfmt=%08x, seeds=%08x, seedslen=%08x) - bad address(es)", sfmt, seeds, seedslen); + ERROR_LOG(Log::HLE, "sceSfmt19937InitByArray(sfmt=%08x, seeds=%08x, seedslen=%08x) - bad address(es)", sfmt, seeds, seedslen); return -1; } - INFO_LOG(HLE, "sceSfmt19937InitByArray(sfmt=%08x, seeds=%08x, seedslen=%08x)", sfmt, seeds, seedslen); + INFO_LOG(Log::HLE, "sceSfmt19937InitByArray(sfmt=%08x, seeds=%08x, seedslen=%08x)", sfmt, seeds, seedslen); sfmt_t *psfmt = (sfmt_t *)Memory::GetPointerUnchecked(sfmt); uint32_t *pseeds = (uint32_t *)Memory::GetPointerUnchecked(seeds); @@ -55,10 +55,10 @@ static int sceSfmt19937InitByArray(u32 sfmt, u32 seeds, int seedslen) { static u32 sceSfmt19937GenRand32(u32 sfmt) { if (!Memory::IsValidAddress(sfmt)) { - ERROR_LOG(HLE, "sceSfmt19937GenRand32(sfmt=%08x) - bad address(es)", sfmt); + ERROR_LOG(Log::HLE, "sceSfmt19937GenRand32(sfmt=%08x) - bad address(es)", sfmt); return -1; } - INFO_LOG(HLE, "sceSfmt19937GenRand32(sfmt=%08x)", sfmt); + INFO_LOG(Log::HLE, "sceSfmt19937GenRand32(sfmt=%08x)", sfmt); sfmt_t *psfmt = (sfmt_t *)Memory::GetPointerUnchecked(sfmt); u32 ret = sfmt_genrand_uint32(psfmt); @@ -68,10 +68,10 @@ static u32 sceSfmt19937GenRand32(u32 sfmt) { static u64 sceSfmt19937GenRand64(u32 sfmt) { if (!Memory::IsValidAddress(sfmt)) { - ERROR_LOG(HLE, "sceSfmt19937GenRand64(sfmt=%08x) - bad address(es)", sfmt); + ERROR_LOG(Log::HLE, "sceSfmt19937GenRand64(sfmt=%08x) - bad address(es)", sfmt); return -1; } - INFO_LOG(HLE, "sceSfmt19937GenRand64(sfmt=%08x)", sfmt); + INFO_LOG(Log::HLE, "sceSfmt19937GenRand64(sfmt=%08x)", sfmt); sfmt_t *psfmt = (sfmt_t *)Memory::GetPointerUnchecked(sfmt); u64 ret = sfmt_genrand_uint64(psfmt); @@ -81,10 +81,10 @@ static u64 sceSfmt19937GenRand64(u32 sfmt) { static int sceSfmt19937FillArray32(u32 sfmt, u32 array, int arraylen) { if (!Memory::IsValidAddress(sfmt) || !Memory::IsValidAddress(array) || !Memory::IsValidAddress(array + 4 * (arraylen - 1))) { - ERROR_LOG(HLE, "sceSfmt19937FillArray32(sfmt=%08x, ar=%08x, arlen=%08x) - bad address(es)", sfmt, array, arraylen); + ERROR_LOG(Log::HLE, "sceSfmt19937FillArray32(sfmt=%08x, ar=%08x, arlen=%08x) - bad address(es)", sfmt, array, arraylen); return -1; } - INFO_LOG(HLE, "sceSfmt19937FillArray32(sfmt=%08x, ar=%08x, arlen=%08x)", sfmt, array, arraylen); + INFO_LOG(Log::HLE, "sceSfmt19937FillArray32(sfmt=%08x, ar=%08x, arlen=%08x)", sfmt, array, arraylen); sfmt_t *psfmt = (sfmt_t *)Memory::GetPointerUnchecked(sfmt); uint32_t *parray = (uint32_t *)Memory::GetPointerUnchecked(array); @@ -95,10 +95,10 @@ static int sceSfmt19937FillArray32(u32 sfmt, u32 array, int arraylen) { static int sceSfmt19937FillArray64(u32 sfmt, u32 array, int arraylen) { if (!Memory::IsValidAddress(sfmt) || !Memory::IsValidAddress(array) || !Memory::IsValidAddress(array + 8 * (arraylen - 1))) { - ERROR_LOG(HLE, "sceSfmt19937FillArray64(sfmt=%08x, ar=%08x, arlen=%08x) - bad address(es)", sfmt, array, arraylen); + ERROR_LOG(Log::HLE, "sceSfmt19937FillArray64(sfmt=%08x, ar=%08x, arlen=%08x) - bad address(es)", sfmt, array, arraylen); return -1; } - INFO_LOG(HLE, "sceSfmt19937FillArray64(sfmt=%08x, ar=%08x, arlen=%08x)", sfmt, array, arraylen); + INFO_LOG(Log::HLE, "sceSfmt19937FillArray64(sfmt=%08x, ar=%08x, arlen=%08x)", sfmt, array, arraylen); sfmt_t *psfmt = (sfmt_t *)Memory::GetPointerUnchecked(sfmt); uint64_t *parray = (uint64_t *)Memory::GetPointerUnchecked(array); diff --git a/Core/HLE/sceSha256.cpp b/Core/HLE/sceSha256.cpp index a2dcef54ee..1663d64bba 100644 --- a/Core/HLE/sceSha256.cpp +++ b/Core/HLE/sceSha256.cpp @@ -23,10 +23,10 @@ static int sceSha256Digest(u32 data, int dataLen, u32 digestPtr) { if (!Memory::IsValidAddress(data) || !Memory::IsValidAddress(digestPtr) || !Memory::IsValidAddress(data + dataLen)) { - ERROR_LOG(HLE, "sceSha256Digest(data=%08x, len=%d, digest=%08x) - bad address(es)", data, dataLen, digestPtr); + ERROR_LOG(Log::HLE, "sceSha256Digest(data=%08x, len=%d, digest=%08x) - bad address(es)", data, dataLen, digestPtr); return -1; } - INFO_LOG(HLE, "sceSha256Digest(data=%08x, len=%d, digest=%08x)", data, dataLen, digestPtr); + INFO_LOG(Log::HLE, "sceSha256Digest(data=%08x, len=%d, digest=%08x)", data, dataLen, digestPtr); // Already checked above... u8 *digest = Memory::GetPointerWriteUnchecked(digestPtr); diff --git a/Core/HLE/sceSircs.cpp b/Core/HLE/sceSircs.cpp index c300f84367..cad58326eb 100644 --- a/Core/HLE/sceSircs.cpp +++ b/Core/HLE/sceSircs.cpp @@ -32,7 +32,7 @@ int sceSircsSend(u32 dataAddr, int count) { auto data = PSPPointer::Create(dataAddr); if (data.IsValid()) { - INFO_LOG(HLE, "%s (version=0x%x, command=0x%x, address=0x%x, count=%d)", + INFO_LOG(Log::HLE, "%s (version=0x%x, command=0x%x, address=0x%x, count=%d)", __FUNCTION__, data->version, data->command, data->address, count); #if PPSSPP_PLATFORM(ANDROID) char command[40] = {0}; diff --git a/Core/HLE/sceSsl.cpp b/Core/HLE/sceSsl.cpp index 7361962d1d..6e9afe7a6d 100644 --- a/Core/HLE/sceSsl.cpp +++ b/Core/HLE/sceSsl.cpp @@ -51,7 +51,7 @@ void __SslDoState(PointerWrap &p) static int sceSslInit(int heapSize) { - DEBUG_LOG(HLE, "sceSslInit %d", heapSize); + DEBUG_LOG(Log::HLE, "sceSslInit %d", heapSize); if (isSslInit) { return ERROR_SSL_ALREADY_INIT; @@ -69,7 +69,7 @@ static int sceSslInit(int heapSize) static int sceSslEnd() { - DEBUG_LOG(HLE, "sceSslEnd"); + DEBUG_LOG(Log::HLE, "sceSslEnd"); if (!isSslInit) { return ERROR_SSL_NOT_INIT; @@ -80,7 +80,7 @@ static int sceSslEnd() static int sceSslGetUsedMemoryMax(u32 maxMemPtr) { - DEBUG_LOG(HLE, "sceSslGetUsedMemoryMax %d", maxMemPtr); + DEBUG_LOG(Log::HLE, "sceSslGetUsedMemoryMax %d", maxMemPtr); if (!isSslInit) { return ERROR_SSL_NOT_INIT; @@ -95,7 +95,7 @@ static int sceSslGetUsedMemoryMax(u32 maxMemPtr) static int sceSslGetUsedMemoryCurrent(u32 currentMemPtr) { - DEBUG_LOG(HLE, "sceSslGetUsedMemoryCurrent %d", currentMemPtr); + DEBUG_LOG(Log::HLE, "sceSslGetUsedMemoryCurrent %d", currentMemPtr); if (!isSslInit) { return ERROR_SSL_NOT_INIT; diff --git a/Core/HLE/sceUmd.cpp b/Core/HLE/sceUmd.cpp index 0257ee71ed..3e1b610195 100644 --- a/Core/HLE/sceUmd.cpp +++ b/Core/HLE/sceUmd.cpp @@ -213,10 +213,10 @@ static void __UmdBeginCallback(SceUID threadID, SceUID prevCallbackId) HLEKernel::RemoveWaitingThread(umdWaitingThreads, threadID); - DEBUG_LOG(SCEIO, "sceUmdWaitDriveStatCB: Suspending lock wait for callback"); + DEBUG_LOG(Log::sceIo, "sceUmdWaitDriveStatCB: Suspending lock wait for callback"); } else - WARN_LOG_REPORT(SCEIO, "sceUmdWaitDriveStatCB: beginning callback with bad wait id?"); + WARN_LOG_REPORT(Log::sceIo, "sceUmdWaitDriveStatCB: beginning callback with bad wait id?"); } static void __UmdEndCallback(SceUID threadID, SceUID prevCallbackId) @@ -227,7 +227,7 @@ static void __UmdEndCallback(SceUID threadID, SceUID prevCallbackId) u32 stat = __KernelGetWaitValue(threadID, error); if (umdPausedWaits.find(pauseKey) == umdPausedWaits.end()) { - WARN_LOG_REPORT(SCEIO, "__UmdEndCallback(): UMD paused wait missing"); + WARN_LOG_REPORT(Log::sceIo, "__UmdEndCallback(): UMD paused wait missing"); __KernelResumeThreadFromWait(threadID, 0); return; @@ -254,23 +254,23 @@ static void __UmdEndCallback(SceUID threadID, SceUID prevCallbackId) umdWaitingThreads.push_back(threadID); - DEBUG_LOG(SCEIO, "sceUmdWaitDriveStatCB: Resuming lock wait for callback"); + DEBUG_LOG(Log::sceIo, "sceUmdWaitDriveStatCB: Resuming lock wait for callback"); } } static int sceUmdCheckMedium() { if (UMDInserted) { - DEBUG_LOG(SCEIO, "1=sceUmdCheckMedium()"); + DEBUG_LOG(Log::sceIo, "1=sceUmdCheckMedium()"); return 1; //non-zero: disc in drive } - DEBUG_LOG(SCEIO, "0=sceUmdCheckMedium()"); + DEBUG_LOG(Log::sceIo, "0=sceUmdCheckMedium()"); return 0; } static u32 sceUmdGetDiscInfo(u32 infoAddr) { - DEBUG_LOG(SCEIO, "sceUmdGetDiscInfo(%08x)", infoAddr); + DEBUG_LOG(Log::sceIo, "sceUmdGetDiscInfo(%08x)", infoAddr); if (Memory::IsValidAddress(infoAddr)) { auto info = PSPPointer::Create(infoAddr); @@ -285,14 +285,14 @@ static u32 sceUmdGetDiscInfo(u32 infoAddr) static int sceUmdActivate(u32 mode, const char *name) { if (mode < 1 || mode > 2) - return hleLogWarning(SCEIO, PSP_ERROR_UMD_INVALID_PARAM); + return hleLogWarning(Log::sceIo, PSP_ERROR_UMD_INVALID_PARAM); __KernelUmdActivate(); if (mode != 1) { - return hleLogError(SCEIO, 0, "UNTESTED"); + return hleLogError(Log::sceIo, 0, "UNTESTED"); } - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } static int sceUmdDeactivate(u32 mode, const char *name) @@ -304,9 +304,9 @@ static int sceUmdDeactivate(u32 mode, const char *name) __KernelUmdDeactivate(); if (mode == 1) { - DEBUG_LOG(SCEIO, "0=sceUmdDeactivate(%d, %s)", mode, name); + DEBUG_LOG(Log::sceIo, "0=sceUmdDeactivate(%d, %s)", mode, name); } else { - ERROR_LOG(SCEIO, "UNTESTED 0=sceUmdDeactivate(%d, %s)", mode, name); + ERROR_LOG(Log::sceIo, "UNTESTED 0=sceUmdDeactivate(%d, %s)", mode, name); } return 0; @@ -323,7 +323,7 @@ static u32 sceUmdRegisterUMDCallBack(u32 cbId) // There's only ever one. driveCBId = cbId; } - DEBUG_LOG(SCEIO, "%d=sceUmdRegisterUMDCallback(id=%08x)", retVal, cbId); + DEBUG_LOG(Log::sceIo, "%d=sceUmdRegisterUMDCallback(id=%08x)", retVal, cbId); return retVal; } @@ -341,20 +341,20 @@ static int sceUmdUnRegisterUMDCallBack(int cbId) } driveCBId = 0; } - DEBUG_LOG(SCEIO, "%08x=sceUmdUnRegisterUMDCallBack(id=%08x)", retVal, cbId); + DEBUG_LOG(Log::sceIo, "%08x=sceUmdUnRegisterUMDCallBack(id=%08x)", retVal, cbId); return retVal; } static u32 sceUmdGetDriveStat() { if (!UMDInserted) { - WARN_LOG(SCEIO, "sceUmdGetDriveStat: UMD is taking out for switch UMD"); + WARN_LOG(Log::sceIo, "sceUmdGetDriveStat: UMD is taking out for switch UMD"); return PSP_UMD_NOT_PRESENT; } //u32 retVal = PSP_UMD_INITED | PSP_UMD_READY | PSP_UMD_PRESENT; u32 retVal = __KernelUmdGetState(); // This one can be very spammy. - VERBOSE_LOG(SCEIO,"0x%02x=sceUmdGetDriveStat()", retVal); + VERBOSE_LOG(Log::sceIo,"0x%02x=sceUmdGetDriveStat()", retVal); return retVal; } @@ -391,40 +391,40 @@ static void __UmdWaitStat(u32 timeout) */ static int sceUmdWaitDriveStat(u32 stat) { if ((stat & UMD_STAT_ALLOW_WAIT) == 0) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT, "bad status"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT, "bad status"); } if (!__KernelIsDispatchEnabled()) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); } if (__IsInInterrupt()) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "inside interrupt"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "inside interrupt"); } hleEatCycles(520); if ((stat & __KernelUmdGetState()) == 0) { - DEBUG_LOG(SCEIO, "sceUmdWaitDriveStat(stat = %08x): waiting", stat); + DEBUG_LOG(Log::sceIo, "sceUmdWaitDriveStat(stat = %08x): waiting", stat); umdWaitingThreads.push_back(__KernelGetCurThread()); __KernelWaitCurThread(WAITTYPE_UMD, 1, stat, 0, 0, "umd stat waited"); return 0; } - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } static int sceUmdWaitDriveStatWithTimer(u32 stat, u32 timeout) { if ((stat & UMD_STAT_ALLOW_WAIT) == 0) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT, "bad status"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT, "bad status"); } if (!__KernelIsDispatchEnabled()) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); } if (__IsInInterrupt()) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "inside interrupt"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "inside interrupt"); } hleEatCycles(520); if ((stat & __KernelUmdGetState()) == 0) { - DEBUG_LOG(SCEIO, "sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): waiting", stat, timeout); + DEBUG_LOG(Log::sceIo, "sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): waiting", stat, timeout); __UmdWaitStat(timeout); umdWaitingThreads.push_back(__KernelGetCurThread()); __KernelWaitCurThread(WAITTYPE_UMD, 1, stat, 0, false, "umd stat waited with timer"); @@ -433,24 +433,24 @@ static int sceUmdWaitDriveStatWithTimer(u32 stat, u32 timeout) { hleReSchedule("umd stat checked"); } - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } static int sceUmdWaitDriveStatCB(u32 stat, u32 timeout) { if ((stat & UMD_STAT_ALLOW_WAIT) == 0) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT, "bad status"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT, "bad status"); } if (!__KernelIsDispatchEnabled()) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_CAN_NOT_WAIT, "dispatch disabled"); } if (__IsInInterrupt()) { - return hleLogDebug(SCEIO, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "inside interrupt"); + return hleLogDebug(Log::sceIo, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "inside interrupt"); } hleEatCycles(520); hleCheckCurrentCallbacks(); if ((stat & __KernelUmdGetState()) == 0) { - DEBUG_LOG(SCEIO, "sceUmdWaitDriveStatCB(stat = %08x, timeout = %d): waiting", stat, timeout); + DEBUG_LOG(Log::sceIo, "sceUmdWaitDriveStatCB(stat = %08x, timeout = %d): waiting", stat, timeout); if (timeout == 0) { timeout = 8000; } @@ -462,12 +462,12 @@ static int sceUmdWaitDriveStatCB(u32 stat, u32 timeout) { hleReSchedule("umd stat waited"); } - return hleLogSuccessI(SCEIO, 0); + return hleLogSuccessI(Log::sceIo, 0); } static u32 sceUmdCancelWaitDriveStat() { - DEBUG_LOG(SCEIO, "0=sceUmdCancelWaitDriveStat()"); + DEBUG_LOG(Log::sceIo, "0=sceUmdCancelWaitDriveStat()"); for (size_t i = 0; i < umdWaitingThreads.size(); ++i) { const SceUID threadID = umdWaitingThreads[i]; @@ -481,7 +481,7 @@ static u32 sceUmdCancelWaitDriveStat() static u32 sceUmdGetErrorStat() { - DEBUG_LOG(SCEIO,"%i=sceUmdGetErrorStat()", umdErrorStat); + DEBUG_LOG(Log::sceIo,"%i=sceUmdGetErrorStat()", umdErrorStat); return umdErrorStat; } @@ -489,7 +489,7 @@ void __UmdReplace(const Path &filepath) { std::string error = ""; FileLoader *fileLoader; if (!UmdReplace(filepath, &fileLoader, error)) { - ERROR_LOG(SCEIO, "UMD Replace failed: %s", error.c_str()); + ERROR_LOG(Log::sceIo, "UMD Replace failed: %s", error.c_str()); return; } @@ -512,9 +512,9 @@ bool getUMDReplacePermit() { static u32 sceUmdReplaceProhibit() { - DEBUG_LOG(SCEIO, "sceUmdReplaceProhibit()"); + DEBUG_LOG(Log::sceIo, "sceUmdReplaceProhibit()"); if (g_UMDReplacePermit) { - INFO_LOG(SCEIO, "sceUmdReplaceProhibit() - prohibited"); + INFO_LOG(Log::sceIo, "sceUmdReplaceProhibit() - prohibited"); g_UMDReplacePermit = false; System_Notify(SystemNotification::SWITCH_UMD_UPDATED); } @@ -523,9 +523,9 @@ static u32 sceUmdReplaceProhibit() static u32 sceUmdReplacePermit() { - DEBUG_LOG(SCEIO, "sceUmdReplacePermit()"); + DEBUG_LOG(Log::sceIo, "sceUmdReplacePermit()"); if (!g_UMDReplacePermit) { - INFO_LOG(SCEIO, "sceUmdReplacePermit() - permitted"); + INFO_LOG(Log::sceIo, "sceUmdReplacePermit() - permitted"); g_UMDReplacePermit = true; System_Notify(SystemNotification::SWITCH_UMD_UPDATED); } diff --git a/Core/HLE/sceUsb.cpp b/Core/HLE/sceUsb.cpp index d47192a995..e6d08a9ddf 100644 --- a/Core/HLE/sceUsb.cpp +++ b/Core/HLE/sceUsb.cpp @@ -148,14 +148,14 @@ void __UsbDoState(PointerWrap &p) { } static int sceUsbStart(const char* driverName, u32 argsSize, u32 argsPtr) { - INFO_LOG(HLE, "sceUsbStart(%s, %i, %08x)", driverName, argsSize, argsPtr); + INFO_LOG(Log::HLE, "sceUsbStart(%s, %i, %08x)", driverName, argsSize, argsPtr); usbStarted = true; UsbUpdateState(); return 0; } static int sceUsbStop(const char* driverName, u32 argsSize, u32 argsPtr) { - INFO_LOG(HLE, "sceUsbStop(%s, %i, %08x)", driverName, argsSize, argsPtr); + INFO_LOG(Log::HLE, "sceUsbStop(%s, %i, %08x)", driverName, argsSize, argsPtr); usbStarted = false; UsbUpdateState(); return 0; @@ -168,19 +168,19 @@ static int sceUsbGetState() { } else { state = UsbCurrentState(); } - DEBUG_LOG(HLE, "sceUsbGetState: 0x%x", state); + DEBUG_LOG(Log::HLE, "sceUsbGetState: 0x%x", state); return state; } static int sceUsbActivate(u32 pid) { - INFO_LOG(HLE, "sceUsbActivate(%i)", pid); + INFO_LOG(Log::HLE, "sceUsbActivate(%i)", pid); usbActivated = true; UsbUpdateState(); return 0; } static int sceUsbDeactivate(u32 pid) { - INFO_LOG(HLE, "sceUsbDeactivate(%i)", pid); + INFO_LOG(Log::HLE, "sceUsbDeactivate(%i)", pid); usbActivated = false; UsbUpdateState(); return 0; @@ -190,12 +190,12 @@ static int sceUsbWaitState(int state, u32 waitMode, u32 timeoutPtr) { hleEatCycles(10000); if (waitMode >= 2) - return hleLogError(HLE, SCE_KERNEL_ERROR_ILLEGAL_MODE, "invalid mode"); + return hleLogError(Log::HLE, SCE_KERNEL_ERROR_ILLEGAL_MODE, "invalid mode"); if (state == 0) - return hleLogError(HLE, SCE_KERNEL_ERROR_EVF_ILPAT, "bad state"); + return hleLogError(Log::HLE, SCE_KERNEL_ERROR_EVF_ILPAT, "bad state"); if (UsbMatchState(state, waitMode)) { - return hleLogSuccessX(HLE, UsbCurrentState()); + return hleLogSuccessX(Log::HLE, UsbCurrentState()); } // We'll have to wait as long as it takes. Cleanup first, just in case. @@ -204,16 +204,16 @@ static int sceUsbWaitState(int state, u32 waitMode, u32 timeoutPtr) { UsbSetTimeout(PSPPointer::Create(timeoutPtr)); __KernelWaitCurThread(WAITTYPE_USB, state, waitMode, timeoutPtr, false, "usb state waited"); - return hleLogSuccessI(HLE, 0, "waiting"); + return hleLogSuccessI(Log::HLE, 0, "waiting"); } static int sceUsbWaitStateCB(int state, u32 waitMode, u32 timeoutPtr) { - ERROR_LOG_REPORT(HLE, "UNIMPL sceUsbWaitStateCB(%i, %i, %08x)", state, waitMode, timeoutPtr); + ERROR_LOG_REPORT(Log::HLE, "UNIMPL sceUsbWaitStateCB(%i, %i, %08x)", state, waitMode, timeoutPtr); return 0; } static int sceUsbstorBootSetCapacity(u32 capacity) { - return hleReportError(HLE, 0, "unimplemented"); + return hleReportError(Log::HLE, 0, "unimplemented"); } const HLEFunction sceUsb[] = diff --git a/Core/HLE/sceUsbAcc.cpp b/Core/HLE/sceUsbAcc.cpp index 93d6add3cb..d2b83ca67c 100644 --- a/Core/HLE/sceUsbAcc.cpp +++ b/Core/HLE/sceUsbAcc.cpp @@ -25,12 +25,12 @@ // we don't have to deal with physical Usb connection, so let's just always pass static int sceUsbAccGetAuthStat() { - INFO_LOG(HLE, "UNIMPL sceUsbAccGetAuthStat"); + INFO_LOG(Log::HLE, "UNIMPL sceUsbAccGetAuthStat"); return 0; } static int sceUsbAccGetInfo(u32 addr) { - INFO_LOG(HLE, "UNIMPL sceUsbAccGetInfo"); + INFO_LOG(Log::HLE, "UNIMPL sceUsbAccGetInfo"); return 0; } diff --git a/Core/HLE/sceUsbCam.cpp b/Core/HLE/sceUsbCam.cpp index 512bcfe15d..1deed656c0 100644 --- a/Core/HLE/sceUsbCam.cpp +++ b/Core/HLE/sceUsbCam.cpp @@ -119,36 +119,36 @@ static int sceUsbCamSetupMic(u32 paramAddr, u32 workareaAddr, int wasize) { config->micParam = *param; param.NotifyRead("UsbCamSetupMic"); } - return hleLogSuccessInfoI(SCEMISC, 0); + return hleLogSuccessInfoI(Log::sceMisc, 0); } static int sceUsbCamStartMic() { - INFO_LOG(HLE, "UNIMPL sceUsbCamStartMic"); + INFO_LOG(Log::HLE, "UNIMPL sceUsbCamStartMic"); return 0; } static int sceUsbCamStopMic() { - INFO_LOG(HLE, "UNIMPL sceUsbCamStopMic"); + INFO_LOG(Log::HLE, "UNIMPL sceUsbCamStopMic"); return 0; } static int sceUsbCamReadMicBlocking(u32 bufAddr, u32 size) { if (!Memory::IsValidAddress(bufAddr)) { - ERROR_LOG(HLE,"sceUsbCamReadMicBlocking(%08x, %d): invalid addresses", bufAddr, size); + ERROR_LOG(Log::HLE,"sceUsbCamReadMicBlocking(%08x, %d): invalid addresses", bufAddr, size); return -1; } - INFO_LOG(HLE, "sceUsbCamReadMicBlocking: size: %d", size); + INFO_LOG(Log::HLE, "sceUsbCamReadMicBlocking: size: %d", size); return __MicInput(size >> 1, config->micParam.frequency, bufAddr, CAMERAMIC); } static int sceUsbCamReadMic(u32 bufAddr, u32 size) { if (!Memory::IsValidAddress(bufAddr)) { - ERROR_LOG(HLE, "sceUsbCamReadMic(%08x, %d): invalid addresses", bufAddr, size); + ERROR_LOG(Log::HLE, "sceUsbCamReadMic(%08x, %d): invalid addresses", bufAddr, size); return -1; } - INFO_LOG(HLE, "sceUsbCamReadMic: size: %d", size); + INFO_LOG(Log::HLE, "sceUsbCamReadMic: size: %d", size); return __MicInput(size >> 1, config->micParam.frequency, bufAddr, CAMERAMIC, false); } @@ -222,12 +222,12 @@ static int sceUsbCamReadVideoFrame(u32 bufAddr, u32 size) { } static int sceUsbCamPollReadVideoFrameEnd() { - VERBOSE_LOG(HLE, "UNIMPL sceUsbCamPollReadVideoFrameEnd: %d", nextVideoFrame); + VERBOSE_LOG(Log::HLE, "UNIMPL sceUsbCamPollReadVideoFrameEnd: %d", nextVideoFrame); return nextVideoFrame; } static int sceUsbCamSetupStill(u32 paramAddr) { - INFO_LOG(HLE, "UNIMPL sceUsbCamSetupStill"); + INFO_LOG(Log::HLE, "UNIMPL sceUsbCamSetupStill"); auto param = PSPPointer::Create(paramAddr); if (param.IsValid()) { config->stillParam = *param; @@ -238,7 +238,7 @@ static int sceUsbCamSetupStill(u32 paramAddr) { } static int sceUsbCamSetupStillEx(u32 paramAddr) { - INFO_LOG(HLE, "UNIMPL sceUsbCamSetupStillEx"); + INFO_LOG(Log::HLE, "UNIMPL sceUsbCamSetupStillEx"); auto param = PSPPointer::Create(paramAddr); if (param.IsValid()) { config->stillExParam = *param; @@ -249,17 +249,17 @@ static int sceUsbCamSetupStillEx(u32 paramAddr) { } static int sceUsbCamAutoImageReverseSW(int on) { - INFO_LOG(HLE, "UNIMPL sceUsbCamAutoImageReverseSW: %d", on); + INFO_LOG(Log::HLE, "UNIMPL sceUsbCamAutoImageReverseSW: %d", on); return 0; } static int sceUsbCamGetLensDirection() { - INFO_LOG(HLE, "UNIMPL sceUsbCamGetLensDirection"); + INFO_LOG(Log::HLE, "UNIMPL sceUsbCamGetLensDirection"); return 0; } static int sceUsbCamSetReverseMode(int reverseflags) { - INFO_LOG(HLE, "UNIMPL sceUsbCamSetReverseMode %d", reverseflags); + INFO_LOG(Log::HLE, "UNIMPL sceUsbCamSetReverseMode %d", reverseflags); return 0; } @@ -345,7 +345,7 @@ std::vector Camera::getDeviceList() { int Camera::startCapture() { int width, height; getCameraResolution(config->type, &width, &height); - INFO_LOG(HLE, "%s resolution: %dx%d", __FUNCTION__, width, height); + INFO_LOG(Log::HLE, "%s resolution: %dx%d", __FUNCTION__, width, height); config->mode = Camera::Mode::Video; #ifdef HAVE_WIN32_CAMERA @@ -365,13 +365,13 @@ int Camera::startCapture() { #elif PPSSPP_PLATFORM(LINUX) __v4l_startCapture(width, height); #else - ERROR_LOG(HLE, "%s not implemented", __FUNCTION__); + ERROR_LOG(Log::HLE, "%s not implemented", __FUNCTION__); #endif return 0; } int Camera::stopCapture() { - INFO_LOG(HLE, "%s", __FUNCTION__); + INFO_LOG(Log::HLE, "%s", __FUNCTION__); #ifdef HAVE_WIN32_CAMERA if (winCamera) { winCamera->sendMessage({ CAPTUREDEVIDE_COMMAND::STOP, nullptr }); @@ -381,7 +381,7 @@ int Camera::stopCapture() { #elif PPSSPP_PLATFORM(LINUX) __v4l_stopCapture(); #else - ERROR_LOG(HLE, "%s not implemented", __FUNCTION__); + ERROR_LOG(Log::HLE, "%s not implemented", __FUNCTION__); #endif config->mode = Camera::Mode::Unused; return 0; @@ -402,7 +402,7 @@ void Camera::pushCameraImage(long long length, unsigned char* image) { memset(videoBuffer, 0, VIDEO_BUFFER_SIZE); if (length > VIDEO_BUFFER_SIZE) { videoBufferLength = 0; - ERROR_LOG(HLE, "pushCameraImage: length error: %lld > %d", length, VIDEO_BUFFER_SIZE); + ERROR_LOG(Log::HLE, "pushCameraImage: length error: %lld > %d", length, VIDEO_BUFFER_SIZE); } else { videoBufferLength = length; memcpy(videoBuffer, image, length); diff --git a/Core/HLE/sceUsbMic.cpp b/Core/HLE/sceUsbMic.cpp index 2d46b5e6a2..78a6b3ee22 100644 --- a/Core/HLE/sceUsbMic.cpp +++ b/Core/HLE/sceUsbMic.cpp @@ -68,7 +68,7 @@ static void __MicBlockingResume(u64 userdata, int cyclesLate) { if (Microphone::isHaveDevice()) { if (Microphone::getReadMicDataLength() >= waitingThread.needSize) { u32 ret = __KernelGetWaitValue(threadID, error); - DEBUG_LOG(HLE, "sceUsbMic: Waking up thread(%d)", (int)waitingThread.threadID); + DEBUG_LOG(Log::HLE, "sceUsbMic: Waking up thread(%d)", (int)waitingThread.threadID); __KernelResumeThreadFromWait(threadID, ret); waitingThreads.erase(waitingThreads.begin() + count); } else { @@ -82,7 +82,7 @@ static void __MicBlockingResume(u64 userdata, int cyclesLate) { } } u32 ret = __KernelGetWaitValue(threadID, error); - DEBUG_LOG(HLE, "sceUsbMic: Waking up thread(%d)", (int)waitingThread.threadID); + DEBUG_LOG(Log::HLE, "sceUsbMic: Waking up thread(%d)", (int)waitingThread.threadID); __KernelResumeThreadFromWait(threadID, ret); waitingThreads.erase(waitingThreads.begin() + count); readMicDataLength += waitingThread.needSize; @@ -260,17 +260,17 @@ u32 QueueBuf::getStartPos() { } static int sceUsbMicPollInputEnd() { - ERROR_LOG(HLE, "UNIMPL sceUsbMicPollInputEnd"); + ERROR_LOG(Log::HLE, "UNIMPL sceUsbMicPollInputEnd"); return 0; } static int sceUsbMicInputBlocking(u32 maxSamples, u32 sampleRate, u32 bufAddr) { if (!Memory::IsValidAddress(bufAddr)) { - ERROR_LOG(HLE, "sceUsbMicInputBlocking(%d, %d, %08x): invalid addresses", maxSamples, sampleRate, bufAddr); + ERROR_LOG(Log::HLE, "sceUsbMicInputBlocking(%d, %d, %08x): invalid addresses", maxSamples, sampleRate, bufAddr); return -1; } - INFO_LOG(HLE, "sceUsbMicInputBlocking: maxSamples: %d, samplerate: %d, bufAddr: %08x", maxSamples, sampleRate, bufAddr); + INFO_LOG(Log::HLE, "sceUsbMicInputBlocking: maxSamples: %d, samplerate: %d, bufAddr: %08x", maxSamples, sampleRate, bufAddr); if (maxSamples <= 0 || (maxSamples & 0x3F) != 0) { return SCE_USBMIC_ERROR_INVALID_MAX_SAMPLES; } @@ -283,17 +283,17 @@ static int sceUsbMicInputBlocking(u32 maxSamples, u32 sampleRate, u32 bufAddr) { } static int sceUsbMicInputInitEx(u32 paramAddr) { - ERROR_LOG(HLE, "UNIMPL sceUsbMicInputInitEx: %08x", paramAddr); + ERROR_LOG(Log::HLE, "UNIMPL sceUsbMicInputInitEx: %08x", paramAddr); return 0; } static int sceUsbMicInput(u32 maxSamples, u32 sampleRate, u32 bufAddr) { if (!Memory::IsValidAddress(bufAddr)) { - ERROR_LOG(HLE, "sceUsbMicInput(%d, %d, %08x): invalid addresses", maxSamples, sampleRate, bufAddr); + ERROR_LOG(Log::HLE, "sceUsbMicInput(%d, %d, %08x): invalid addresses", maxSamples, sampleRate, bufAddr); return -1; } - ERROR_LOG(HLE, "UNTEST sceUsbMicInput: maxSamples: %d, samplerate: %d, bufAddr: %08x", maxSamples, sampleRate, bufAddr); + ERROR_LOG(Log::HLE, "UNTEST sceUsbMicInput: maxSamples: %d, samplerate: %d, bufAddr: %08x", maxSamples, sampleRate, bufAddr); if (maxSamples <= 0 || (maxSamples & 0x3F) != 0) { return SCE_USBMIC_ERROR_INVALID_MAX_SAMPLES; } @@ -306,17 +306,17 @@ static int sceUsbMicInput(u32 maxSamples, u32 sampleRate, u32 bufAddr) { } static int sceUsbMicGetInputLength() { int ret = Microphone::getReadMicDataLength() / 2; - ERROR_LOG(HLE, "UNTEST sceUsbMicGetInputLength(ret: %d)", ret); + ERROR_LOG(Log::HLE, "UNTEST sceUsbMicGetInputLength(ret: %d)", ret); return ret; } static int sceUsbMicInputInit(int unknown1, int inputVolume, int unknown2) { - ERROR_LOG(HLE, "UNIMPL sceUsbMicInputInit(unknown1: %d, inputVolume: %d, unknown2: %d)", unknown1, inputVolume, unknown2); + ERROR_LOG(Log::HLE, "UNIMPL sceUsbMicInputInit(unknown1: %d, inputVolume: %d, unknown2: %d)", unknown1, inputVolume, unknown2); return 0; } static int sceUsbMicWaitInputEnd() { - ERROR_LOG(HLE, "UNIMPL sceUsbMicWaitInputEnd"); + ERROR_LOG(Log::HLE, "UNIMPL sceUsbMicWaitInputEnd"); return 0; } @@ -328,7 +328,7 @@ int Microphone::startMic(void *param) { std::vector *micParam = static_cast*>(param); int sampleRate = micParam->at(0); int channels = micParam->at(1); - INFO_LOG(HLE, "microphone_command : sr = %d", sampleRate); + INFO_LOG(Log::HLE, "microphone_command : sr = %d", sampleRate); System_MicrophoneCommand("startRecording:" + std::to_string(sampleRate)); #endif micState = 1; @@ -456,7 +456,7 @@ u32 __MicInput(u32 maxSamples, u32 sampleRate, u32 bufAddr, MICTYPE type, bool b CoreTiming::ScheduleEvent(usToCycles(waitTimeus), eventMicBlockingResume, __KernelGetCurThread()); MicWaitInfo waitInfo = { __KernelGetCurThread(), bufAddr, size, sampleRate }; waitingThreads.push_back(waitInfo); - DEBUG_LOG(HLE, "MicInputBlocking: blocking thread(%d)", (int)__KernelGetCurThread()); + DEBUG_LOG(Log::HLE, "MicInputBlocking: blocking thread(%d)", (int)__KernelGetCurThread()); __KernelWaitCurThread(WAITTYPE_MICINPUT, 1, size, 0, false, "blocking microphone"); return type == CAMERAMIC ? size : maxSamples; diff --git a/Core/HLE/sceUtility.cpp b/Core/HLE/sceUtility.cpp index 0672de41be..cabdb19ef3 100644 --- a/Core/HLE/sceUtility.cpp +++ b/Core/HLE/sceUtility.cpp @@ -156,7 +156,7 @@ static void CleanupDialogThreads(bool force = false) { accessThread = nullptr; accessThreadState = "cleaned up"; } else if (force) { - ERROR_LOG_REPORT(SCEUTILITY, "Utility access thread still running, state: %s, dialog=%d/%d", accessThreadState, (int)currentDialogType, currentDialogActive); + ERROR_LOG_REPORT(Log::sceUtility, "Utility access thread still running, state: %s, dialog=%d/%d", accessThreadState, (int)currentDialogType, currentDialogActive); // Try to force shutdown anyway. accessThread->Terminate(); @@ -402,8 +402,8 @@ static int UtilityInitDialog(int type) { accessThreadFinished = true; accessThreadState = "init finished"; if (dialog) - return hleLogSuccessI(SCEUTILITY, dialog->FinishInit()); - return hleLogError(SCEUTILITY, 0, "invalid dialog type?"); + return hleLogSuccessI(Log::sceUtility, dialog->FinishInit()); + return hleLogError(Log::sceUtility, 0, "invalid dialog type?"); } static int UtilityFinishDialog(int type) { @@ -411,14 +411,14 @@ static int UtilityFinishDialog(int type) { accessThreadFinished = true; accessThreadState = "shutdown finished"; if (dialog) - return hleLogSuccessI(SCEUTILITY, dialog->FinishShutdown()); - return hleLogError(SCEUTILITY, 0, "invalid dialog type?"); + return hleLogSuccessI(Log::sceUtility, dialog->FinishShutdown()); + return hleLogError(Log::sceUtility, 0, "invalid dialog type?"); } static int sceUtilitySavedataInitStart(u32 paramAddr) { if (currentDialogActive && currentDialogType != UtilityDialogType::SAVEDATA) { if (PSP_CoreParameter().compat.flags().YugiohSaveFix) { - WARN_LOG_REPORT(SCEUTILITY, "Yugioh Savedata Correction (state=%d)", lastSaveStateVersion); + WARN_LOG_REPORT(Log::sceUtility, "Yugioh Savedata Correction (state=%d)", lastSaveStateVersion); if (accessThread) { accessThread->Terminate(); delete accessThread; @@ -429,28 +429,28 @@ static int sceUtilitySavedataInitStart(u32 paramAddr) { KernelVolatileMemUnlock(0); } } else { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } } ActivateDialog(UtilityDialogType::SAVEDATA); - return hleLogSuccessX(SCEUTILITY, saveDialog->Init(paramAddr)); + return hleLogSuccessX(Log::sceUtility, saveDialog->Init(paramAddr)); } static int sceUtilitySavedataShutdownStart() { if (currentDialogType != UtilityDialogType::SAVEDATA) - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); DeactivateDialog(); int ret = saveDialog->Shutdown(); hleEatCycles(30000); - return hleLogSuccessX(SCEUTILITY, ret); + return hleLogSuccessX(Log::sceUtility, ret); } static int sceUtilitySavedataGetStatus() { if (currentDialogType != UtilityDialogType::SAVEDATA) { hleEatCycles(200); - return hleLogDebug(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogDebug(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } int status = saveDialog->GetStatus(); @@ -458,17 +458,17 @@ static int sceUtilitySavedataGetStatus() { CleanupDialogThreads(); if (oldStatus != status) { oldStatus = status; - return hleLogSuccessI(SCEUTILITY, status); + return hleLogSuccessI(Log::sceUtility, status); } - return hleLogSuccessVerboseI(SCEUTILITY, status); + return hleLogSuccessVerboseI(Log::sceUtility, status); } static int sceUtilitySavedataUpdate(int animSpeed) { if (currentDialogType != UtilityDialogType::SAVEDATA) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - int result = hleLogSuccessI(SCEUTILITY, saveDialog->Update(animSpeed)); + int result = hleLogSuccessI(Log::sceUtility, saveDialog->Update(animSpeed)); if (result >= 0) return hleDelayResult(result, "savedata update", 300); return result; @@ -478,11 +478,11 @@ static u32 sceUtilityLoadAvModule(u32 module) { if (module > 7) { - ERROR_LOG_REPORT(SCEUTILITY, "sceUtilityLoadAvModule(%i): invalid module id", module); + ERROR_LOG_REPORT(Log::sceUtility, "sceUtilityLoadAvModule(%i): invalid module id", module); return SCE_ERROR_AV_MODULE_BAD_ID; } - INFO_LOG(SCEUTILITY, "0=sceUtilityLoadAvModule(%i)", module); + INFO_LOG(Log::sceUtility, "0=sceUtilityLoadAvModule(%i)", module); if (module == 0) JpegNotifyLoadStatus(1); return hleDelayResult(0, "utility av module loaded", 25000); @@ -490,7 +490,7 @@ static u32 sceUtilityLoadAvModule(u32 module) static u32 sceUtilityUnloadAvModule(u32 module) { - INFO_LOG(SCEUTILITY,"0=sceUtilityUnloadAvModule(%i)", module); + INFO_LOG(Log::sceUtility,"0=sceUtilityUnloadAvModule(%i)", module); if (module == 0) JpegNotifyLoadStatus(-1); return hleDelayResult(0, "utility av module unloaded", 800); @@ -510,16 +510,16 @@ static const ModuleLoadInfo *__UtilityModuleInfo(int module) { static u32 sceUtilityLoadModule(u32 module) { const ModuleLoadInfo *info = __UtilityModuleInfo(module); if (!info) { - return hleReportError(SCEUTILITY, SCE_ERROR_MODULE_BAD_ID, "invalid module id"); + return hleReportError(Log::sceUtility, SCE_ERROR_MODULE_BAD_ID, "invalid module id"); } if (currentlyLoadedModules.find(module) != currentlyLoadedModules.end()) { - return hleLogError(SCEUTILITY, SCE_ERROR_MODULE_ALREADY_LOADED, "already loaded"); + return hleLogError(Log::sceUtility, SCE_ERROR_MODULE_ALREADY_LOADED, "already loaded"); } // Some games, like Kamen Rider Climax Heroes OOO, require an error if dependencies aren't loaded yet. for (const int *dep = info->dependencies; *dep != 0; ++dep) { if (currentlyLoadedModules.find(*dep) == currentlyLoadedModules.end()) { - u32 result = hleLogError(SCEUTILITY, SCE_KERNEL_ERROR_LIBRARY_NOTFOUND, "dependent module %04x not loaded", *dep); + u32 result = hleLogError(Log::sceUtility, SCE_KERNEL_ERROR_LIBRARY_NOTFOUND, "dependent module %04x not loaded", *dep); return hleDelayResult(result, "utility module load attempt", 25000); } } @@ -538,19 +538,19 @@ static u32 sceUtilityLoadModule(u32 module) { // TODO: Each module has its own timing, technically, but this is a low-end. if (module == 0x3FF) - return hleDelayResult(hleLogSuccessInfoI(SCEUTILITY, 0), "utility module loaded", 130); + return hleDelayResult(hleLogSuccessInfoI(Log::sceUtility, 0), "utility module loaded", 130); else - return hleDelayResult(hleLogSuccessInfoI(SCEUTILITY, 0), "utility module loaded", 25000); + return hleDelayResult(hleLogSuccessInfoI(Log::sceUtility, 0), "utility module loaded", 25000); } static u32 sceUtilityUnloadModule(u32 module) { const ModuleLoadInfo *info = __UtilityModuleInfo(module); if (!info) { - return hleReportError(SCEUTILITY, SCE_ERROR_MODULE_BAD_ID, "invalid module id"); + return hleReportError(Log::sceUtility, SCE_ERROR_MODULE_BAD_ID, "invalid module id"); } if (currentlyLoadedModules.find(module) == currentlyLoadedModules.end()) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_MODULE_NOT_LOADED, "not yet loaded"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_MODULE_NOT_LOADED, "not yet loaded"); } if (currentlyLoadedModules[module] != 0) { userMemory.Free(currentlyLoadedModules[module]); @@ -562,35 +562,35 @@ static u32 sceUtilityUnloadModule(u32 module) { // TODO: Each module has its own timing, technically, but this is a low-end. if (module == 0x3FF) - return hleDelayResult(hleLogSuccessInfoI(SCEUTILITY, 0), "utility module unloaded", 110); + return hleDelayResult(hleLogSuccessInfoI(Log::sceUtility, 0), "utility module unloaded", 110); else - return hleDelayResult(hleLogSuccessInfoI(SCEUTILITY, 0), "utility module unloaded", 400); + return hleDelayResult(hleLogSuccessInfoI(Log::sceUtility, 0), "utility module unloaded", 400); } static int sceUtilityMsgDialogInitStart(u32 paramAddr) { if (currentDialogActive && currentDialogType != UtilityDialogType::MSG) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } ActivateDialog(UtilityDialogType::MSG); - return hleLogSuccessInfoX(SCEUTILITY, msgDialog->Init(paramAddr)); + return hleLogSuccessInfoX(Log::sceUtility, msgDialog->Init(paramAddr)); } static int sceUtilityMsgDialogShutdownStart() { if (currentDialogType != UtilityDialogType::MSG) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } DeactivateDialog(); - return hleLogSuccessX(SCEUTILITY, msgDialog->Shutdown()); + return hleLogSuccessX(Log::sceUtility, msgDialog->Shutdown()); } static int sceUtilityMsgDialogUpdate(int animSpeed) { if (currentDialogType != UtilityDialogType::MSG) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - int ret = hleLogSuccessX(SCEUTILITY, msgDialog->Update(animSpeed)); + int ret = hleLogSuccessX(Log::sceUtility, msgDialog->Update(animSpeed)); if (ret >= 0) return hleDelayResult(ret, "msgdialog update", 800); return ret; @@ -598,118 +598,118 @@ static int sceUtilityMsgDialogUpdate(int animSpeed) { static int sceUtilityMsgDialogGetStatus() { if (currentDialogType != UtilityDialogType::MSG) { - return hleLogDebug(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogDebug(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } int status = msgDialog->GetStatus(); CleanupDialogThreads(); if (oldStatus != status) { oldStatus = status; - return hleLogSuccessI(SCEUTILITY, status); + return hleLogSuccessI(Log::sceUtility, status); } - return hleLogSuccessVerboseI(SCEUTILITY, status); + return hleLogSuccessVerboseI(Log::sceUtility, status); } static int sceUtilityMsgDialogAbort() { if (currentDialogType != UtilityDialogType::MSG) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - return hleLogSuccessX(SCEUTILITY, msgDialog->Abort()); + return hleLogSuccessX(Log::sceUtility, msgDialog->Abort()); } // On screen keyboard static int sceUtilityOskInitStart(u32 oskPtr) { if (currentDialogActive && currentDialogType != UtilityDialogType::OSK) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } ActivateDialog(UtilityDialogType::OSK); - return hleLogSuccessInfoX(SCEUTILITY, oskDialog->Init(oskPtr)); + return hleLogSuccessInfoX(Log::sceUtility, oskDialog->Init(oskPtr)); } static int sceUtilityOskShutdownStart() { if (currentDialogType != UtilityDialogType::OSK) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } DeactivateDialog(); - return hleLogSuccessX(SCEUTILITY, oskDialog->Shutdown()); + return hleLogSuccessX(Log::sceUtility, oskDialog->Shutdown()); } static int sceUtilityOskUpdate(int animSpeed) { if (currentDialogType != UtilityDialogType::OSK) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } // This is the vblank period, plus a little slack. Needed to fix timing bug in Ghost Recon: Predator. // See issue #12044. hleEatCycles(msToCycles(0.7315 + 0.1)); - return hleLogSuccessX(SCEUTILITY, oskDialog->Update(animSpeed)); + return hleLogSuccessX(Log::sceUtility, oskDialog->Update(animSpeed)); } static int sceUtilityOskGetStatus() { if (currentDialogType != UtilityDialogType::OSK) { - return hleLogDebug(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogDebug(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } int status = oskDialog->GetStatus(); CleanupDialogThreads(); if (oldStatus != status) { oldStatus = status; - return hleLogSuccessI(SCEUTILITY, status); + return hleLogSuccessI(Log::sceUtility, status); } - return hleLogSuccessVerboseI(SCEUTILITY, status); + return hleLogSuccessVerboseI(Log::sceUtility, status); } static int sceUtilityNetconfInitStart(u32 paramsAddr) { if (currentDialogActive && currentDialogType != UtilityDialogType::NET) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } ActivateDialog(UtilityDialogType::NET); - return hleLogSuccessInfoI(SCEUTILITY, netDialog->Init(paramsAddr)); + return hleLogSuccessInfoI(Log::sceUtility, netDialog->Init(paramsAddr)); } static int sceUtilityNetconfShutdownStart() { if (currentDialogType != UtilityDialogType::NET) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } DeactivateDialog(); - return hleLogSuccessI(SCEUTILITY, netDialog->Shutdown()); + return hleLogSuccessI(Log::sceUtility, netDialog->Shutdown()); } static int sceUtilityNetconfUpdate(int animSpeed) { if (currentDialogType != UtilityDialogType::NET) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - return hleLogSuccessI(SCEUTILITY, netDialog->Update(animSpeed)); + return hleLogSuccessI(Log::sceUtility, netDialog->Update(animSpeed)); } static int sceUtilityNetconfGetStatus() { if (currentDialogType != UtilityDialogType::NET) { // Spam in Danball Senki BOOST. - return hleLogDebug(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogDebug(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } int status = netDialog->GetStatus(); CleanupDialogThreads(); if (oldStatus != status) { oldStatus = status; - return hleLogSuccessI(SCEUTILITY, status); + return hleLogSuccessI(Log::sceUtility, status); } - return hleLogSuccessVerboseI(SCEUTILITY, status); + return hleLogSuccessVerboseI(Log::sceUtility, status); } static int sceUtilityCheckNetParam(int id) { bool available = (id >= 0 && id <= 24); int ret = available ? 0 : 0X80110601; - DEBUG_LOG(SCEUTILITY, "%08x=sceUtilityCheckNetParam(%d)", ret, id); + DEBUG_LOG(Log::sceUtility, "%08x=sceUtilityCheckNetParam(%d)", ret, id); return ret; } @@ -718,106 +718,106 @@ static int sceUtilityCheckNetParam(int id) //but it requires more investigation static int sceUtilityScreenshotInitStart(u32 paramAddr) { if (currentDialogActive && currentDialogType != UtilityDialogType::SCREENSHOT) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } ActivateDialog(UtilityDialogType::SCREENSHOT); - return hleReportWarning(SCEUTILITY, screenshotDialog->Init(paramAddr)); + return hleReportWarning(Log::sceUtility, screenshotDialog->Init(paramAddr)); } static int sceUtilityScreenshotShutdownStart() { if (currentDialogType != UtilityDialogType::SCREENSHOT) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } DeactivateDialog(); - return hleLogWarning(SCEUTILITY, screenshotDialog->Shutdown()); + return hleLogWarning(Log::sceUtility, screenshotDialog->Shutdown()); } static int sceUtilityScreenshotUpdate(u32 animSpeed) { if (currentDialogType != UtilityDialogType::SCREENSHOT) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - return hleLogWarning(SCEUTILITY, screenshotDialog->Update(animSpeed)); + return hleLogWarning(Log::sceUtility, screenshotDialog->Update(animSpeed)); } static int sceUtilityScreenshotGetStatus() { if (currentDialogType != UtilityDialogType::SCREENSHOT) { - return hleLogDebug(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogDebug(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } int status = screenshotDialog->GetStatus(); CleanupDialogThreads(); if (oldStatus != status) { oldStatus = status; - return hleLogWarning(SCEUTILITY, status); + return hleLogWarning(Log::sceUtility, status); } - return hleLogSuccessVerboseI(SCEUTILITY, status); + return hleLogSuccessVerboseI(Log::sceUtility, status); } static int sceUtilityScreenshotContStart(u32 paramAddr) { if (currentDialogType != UtilityDialogType::SCREENSHOT) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - return hleLogWarning(SCEUTILITY, screenshotDialog->ContStart()); + return hleLogWarning(Log::sceUtility, screenshotDialog->ContStart()); } static int sceUtilityGamedataInstallInitStart(u32 paramsAddr) { if (currentDialogActive && currentDialogType != UtilityDialogType::GAMEDATAINSTALL) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } ActivateDialog(UtilityDialogType::GAMEDATAINSTALL); int result = gamedataInstallDialog->Init(paramsAddr); if (result < 0) DeactivateDialog(); - return hleLogSuccessInfoX(SCEUTILITY, result); + return hleLogSuccessInfoX(Log::sceUtility, result); } static int sceUtilityGamedataInstallShutdownStart() { if (!currentDialogActive || currentDialogType != UtilityDialogType::GAMEDATAINSTALL) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } DeactivateDialog(); - return hleLogSuccessX(SCEUTILITY, gamedataInstallDialog->Shutdown()); + return hleLogSuccessX(Log::sceUtility, gamedataInstallDialog->Shutdown()); } static int sceUtilityGamedataInstallUpdate(int animSpeed) { if (!currentDialogActive || currentDialogType != UtilityDialogType::GAMEDATAINSTALL) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - return hleLogSuccessX(SCEUTILITY, gamedataInstallDialog->Update(animSpeed)); + return hleLogSuccessX(Log::sceUtility, gamedataInstallDialog->Update(animSpeed)); } static int sceUtilityGamedataInstallGetStatus() { if (currentDialogType != UtilityDialogType::GAMEDATAINSTALL) { // This is called incorrectly all the time by some games. So let's not bother warning. hleEatCycles(200); - return hleLogDebug(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogDebug(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } int status = gamedataInstallDialog->GetStatus(); CleanupDialogThreads(); - return hleLogSuccessI(SCEUTILITY, status); + return hleLogSuccessI(Log::sceUtility, status); } static int sceUtilityGamedataInstallAbort() { if (!currentDialogActive || currentDialogType != UtilityDialogType::GAMEDATAINSTALL) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } DeactivateDialog(); - return hleLogSuccessX(SCEUTILITY, gamedataInstallDialog->Abort()); + return hleLogSuccessX(Log::sceUtility, gamedataInstallDialog->Abort()); } //TODO: should save to config file static u32 sceUtilitySetSystemParamString(u32 id, u32 strPtr) { - WARN_LOG_REPORT(SCEUTILITY, "sceUtilitySetSystemParamString(%i, %08x)", id, strPtr); + WARN_LOG_REPORT(Log::sceUtility, "sceUtilitySetSystemParamString(%i, %08x)", id, strPtr); return 0; } @@ -827,7 +827,7 @@ static u32 sceUtilityGetSystemParamString(u32 id, u32 destAddr, int destSize) // TODO: What error code? return -1; } - DEBUG_LOG(SCEUTILITY, "sceUtilityGetSystemParamString(%i, %08x, %i)", id, destAddr, destSize); + DEBUG_LOG(Log::sceUtility, "sceUtilityGetSystemParamString(%i, %08x, %i)", id, destAddr, destSize); char *buf = (char *)Memory::GetPointerWriteUnchecked(destAddr); switch (id) { case PSP_SYSTEMPARAM_ID_STRING_NICKNAME: @@ -866,7 +866,7 @@ static u32 sceUtilitySetSystemParamInt(u32 id, u32 value) static u32 sceUtilityGetSystemParamInt(u32 id, u32 destaddr) { - DEBUG_LOG(SCEUTILITY,"sceUtilityGetSystemParamInt(%i, %08x)", id,destaddr); + DEBUG_LOG(Log::sceUtility,"sceUtilityGetSystemParamInt(%i, %08x)", id,destaddr); u32 param = 0; switch (id) { case PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL: @@ -924,124 +924,124 @@ static u32 sceUtilityGetSystemParamInt(u32 id, u32 destaddr) static u32 sceUtilityLoadNetModule(u32 module) { - DEBUG_LOG(SCEUTILITY,"FAKE: sceUtilityLoadNetModule(%i)", module); + DEBUG_LOG(Log::sceUtility,"FAKE: sceUtilityLoadNetModule(%i)", module); return 0; } static u32 sceUtilityUnloadNetModule(u32 module) { - DEBUG_LOG(SCEUTILITY,"FAKE: sceUtilityUnloadNetModule(%i)", module); + DEBUG_LOG(Log::sceUtility,"FAKE: sceUtilityUnloadNetModule(%i)", module); return 0; } static int sceUtilityNpSigninInitStart(u32 paramsPtr) { if (currentDialogActive && currentDialogType != UtilityDialogType::NPSIGNIN) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } ActivateDialog(UtilityDialogType::NPSIGNIN); - return hleLogSuccessInfoI(SCEUTILITY, npSigninDialog->Init(paramsPtr)); + return hleLogSuccessInfoI(Log::sceUtility, npSigninDialog->Init(paramsPtr)); } static int sceUtilityNpSigninShutdownStart() { if (currentDialogType != UtilityDialogType::NPSIGNIN) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } DeactivateDialog(); - return hleLogSuccessI(SCEUTILITY, npSigninDialog->Shutdown()); + return hleLogSuccessI(Log::sceUtility, npSigninDialog->Shutdown()); } static int sceUtilityNpSigninUpdate(int animSpeed) { if (currentDialogType != UtilityDialogType::NPSIGNIN) { - return hleLogWarning(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogWarning(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } - return hleLogSuccessI(SCEUTILITY, npSigninDialog->Update(animSpeed)); + return hleLogSuccessI(Log::sceUtility, npSigninDialog->Update(animSpeed)); } static int sceUtilityNpSigninGetStatus() { if (currentDialogType != UtilityDialogType::NPSIGNIN) { - return hleLogDebug(SCEUTILITY, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); + return hleLogDebug(Log::sceUtility, SCE_ERROR_UTILITY_WRONG_TYPE, "wrong dialog type"); } int status = npSigninDialog->GetStatus(); CleanupDialogThreads(); if (oldStatus != status) { oldStatus = status; - return hleLogSuccessI(SCEUTILITY, status); + return hleLogSuccessI(Log::sceUtility, status); } - return hleLogSuccessVerboseI(SCEUTILITY, status); + return hleLogSuccessVerboseI(Log::sceUtility, status); } static void sceUtilityInstallInitStart(u32 unknown) { - WARN_LOG_REPORT(SCEUTILITY, "UNIMPL sceUtilityInstallInitStart()"); + WARN_LOG_REPORT(Log::sceUtility, "UNIMPL sceUtilityInstallInitStart()"); } static int sceUtilityStoreCheckoutShutdownStart() { - ERROR_LOG(SCEUTILITY,"UNIMPL sceUtilityStoreCheckoutShutdownStart()"); + ERROR_LOG(Log::sceUtility,"UNIMPL sceUtilityStoreCheckoutShutdownStart()"); return 0; } static int sceUtilityStoreCheckoutInitStart(u32 paramsPtr) { - ERROR_LOG_REPORT(SCEUTILITY,"UNIMPL sceUtilityStoreCheckoutInitStart(%d)", paramsPtr); + ERROR_LOG_REPORT(Log::sceUtility,"UNIMPL sceUtilityStoreCheckoutInitStart(%d)", paramsPtr); return 0; } static int sceUtilityStoreCheckoutUpdate(int drawSpeed) { - ERROR_LOG(SCEUTILITY,"UNIMPL sceUtilityStoreCheckoutUpdate(%d)", drawSpeed); + ERROR_LOG(Log::sceUtility,"UNIMPL sceUtilityStoreCheckoutUpdate(%d)", drawSpeed); return 0; } static int sceUtilityStoreCheckoutGetStatus() { - ERROR_LOG(SCEUTILITY,"UNIMPL sceUtilityStoreCheckoutGetStatus()"); + ERROR_LOG(Log::sceUtility,"UNIMPL sceUtilityStoreCheckoutGetStatus()"); return 0; } static int sceUtilityGameSharingShutdownStart() { if (currentDialogType != UtilityDialogType::GAMESHARING) { - WARN_LOG(SCEUTILITY, "sceUtilityGameSharingShutdownStart(): wrong dialog type"); + WARN_LOG(Log::sceUtility, "sceUtilityGameSharingShutdownStart(): wrong dialog type"); return SCE_ERROR_UTILITY_WRONG_TYPE; } DeactivateDialog(); - ERROR_LOG(SCEUTILITY, "UNIMPL sceUtilityGameSharingShutdownStart()"); + ERROR_LOG(Log::sceUtility, "UNIMPL sceUtilityGameSharingShutdownStart()"); return 0; } static int sceUtilityGameSharingInitStart(u32 paramsPtr) { if (currentDialogActive && currentDialogType != UtilityDialogType::GAMESHARING) { - WARN_LOG(SCEUTILITY, "sceUtilityGameSharingInitStart(%08x)", paramsPtr); + WARN_LOG(Log::sceUtility, "sceUtilityGameSharingInitStart(%08x)", paramsPtr); return SCE_ERROR_UTILITY_WRONG_TYPE; } ActivateDialog(UtilityDialogType::GAMESHARING); - ERROR_LOG_REPORT(SCEUTILITY, "UNIMPL sceUtilityGameSharingInitStart(%08x)", paramsPtr); + ERROR_LOG_REPORT(Log::sceUtility, "UNIMPL sceUtilityGameSharingInitStart(%08x)", paramsPtr); return 0; } static int sceUtilityGameSharingUpdate(int animSpeed) { if (currentDialogType != UtilityDialogType::GAMESHARING) { - WARN_LOG(SCEUTILITY, "sceUtilityGameSharingUpdate(%i): wrong dialog type", animSpeed); + WARN_LOG(Log::sceUtility, "sceUtilityGameSharingUpdate(%i): wrong dialog type", animSpeed); return SCE_ERROR_UTILITY_WRONG_TYPE; } - ERROR_LOG(SCEUTILITY, "UNIMPL sceUtilityGameSharingUpdate(%i)", animSpeed); + ERROR_LOG(Log::sceUtility, "UNIMPL sceUtilityGameSharingUpdate(%i)", animSpeed); return 0; } static int sceUtilityGameSharingGetStatus() { if (currentDialogType != UtilityDialogType::GAMESHARING) { - DEBUG_LOG(SCEUTILITY, "sceUtilityGameSharingGetStatus(): wrong dialog type"); + DEBUG_LOG(Log::sceUtility, "sceUtilityGameSharingGetStatus(): wrong dialog type"); return SCE_ERROR_UTILITY_WRONG_TYPE; } - ERROR_LOG(SCEUTILITY, "UNIMPL sceUtilityGameSharingGetStatus()"); + ERROR_LOG(Log::sceUtility, "UNIMPL sceUtilityGameSharingGetStatus()"); CleanupDialogThreads(); return 0; } @@ -1050,10 +1050,10 @@ static u32 sceUtilityLoadUsbModule(u32 module) { if (module < 1 || module > 5) { - ERROR_LOG(SCEUTILITY, "sceUtilityLoadUsbModule(%i): invalid module id", module); + ERROR_LOG(Log::sceUtility, "sceUtilityLoadUsbModule(%i): invalid module id", module); } - ERROR_LOG_REPORT(SCEUTILITY, "UNIMPL sceUtilityLoadUsbModule(%i)", module); + ERROR_LOG_REPORT(Log::sceUtility, "UNIMPL sceUtilityLoadUsbModule(%i)", module); return 0; } @@ -1061,10 +1061,10 @@ static u32 sceUtilityUnloadUsbModule(u32 module) { if (module < 1 || module > 5) { - ERROR_LOG(SCEUTILITY, "sceUtilityUnloadUsbModule(%i): invalid module id", module); + ERROR_LOG(Log::sceUtility, "sceUtilityUnloadUsbModule(%i): invalid module id", module); } - ERROR_LOG_REPORT(SCEUTILITY, "UNIMPL sceUtilityUnloadUsbModule(%i)", module); + ERROR_LOG_REPORT(Log::sceUtility, "UNIMPL sceUtilityUnloadUsbModule(%i)", module); return 0; } diff --git a/Core/HLE/sceVaudio.cpp b/Core/HLE/sceVaudio.cpp index 7d5819114f..841de68681 100644 --- a/Core/HLE/sceVaudio.cpp +++ b/Core/HLE/sceVaudio.cpp @@ -42,15 +42,15 @@ void __VaudioDoState(PointerWrap &p) { static u32 sceVaudioChReserve(int sampleCount, int freq, int format) { if (vaudioReserved) { - ERROR_LOG(SCEAUDIO, "sceVaudioChReserve(%i, %i, %i) - already reserved", sampleCount, freq, format); + ERROR_LOG(Log::sceAudio, "sceVaudioChReserve(%i, %i, %i) - already reserved", sampleCount, freq, format); return SCE_KERNEL_ERROR_BUSY; } // We still have to check the channel also, which gives a different error. if (chans[PSP_AUDIO_CHANNEL_VAUDIO].reserved) { - ERROR_LOG(SCEAUDIO, "sceVaudioChReserve(%i, %i, %i) - channel already reserved", sampleCount, freq, format); + ERROR_LOG(Log::sceAudio, "sceVaudioChReserve(%i, %i, %i) - channel already reserved", sampleCount, freq, format); return SCE_ERROR_AUDIO_CHANNEL_ALREADY_RESERVED; } - DEBUG_LOG(SCEAUDIO, "sceVaudioChReserve(%i, %i, %i)", sampleCount, freq, format); + DEBUG_LOG(Log::sceAudio, "sceVaudioChReserve(%i, %i, %i)", sampleCount, freq, format); chans[PSP_AUDIO_CHANNEL_VAUDIO].reserved = true; chans[PSP_AUDIO_CHANNEL_VAUDIO].sampleCount = sampleCount; chans[PSP_AUDIO_CHANNEL_VAUDIO].format = format == 2 ? PSP_AUDIO_FORMAT_STEREO : PSP_AUDIO_FORMAT_MONO; @@ -62,7 +62,7 @@ static u32 sceVaudioChReserve(int sampleCount, int freq, int format) { } static u32 sceVaudioChRelease() { - DEBUG_LOG(SCEAUDIO, "sceVaudioChRelease(...)"); + DEBUG_LOG(Log::sceAudio, "sceVaudioChRelease(...)"); if (!chans[PSP_AUDIO_CHANNEL_VAUDIO].reserved) { return SCE_ERROR_AUDIO_CHANNEL_NOT_RESERVED; } else { @@ -74,7 +74,7 @@ static u32 sceVaudioChRelease() { } static u32 sceVaudioOutputBlocking(int vol, u32 buffer) { - DEBUG_LOG(SCEAUDIO, "sceVaudioOutputBlocking(%i, %08x)", vol, buffer); + DEBUG_LOG(Log::sceAudio, "sceVaudioOutputBlocking(%i, %08x)", vol, buffer); chans[PSP_AUDIO_CHANNEL_VAUDIO].leftVolume = vol; chans[PSP_AUDIO_CHANNEL_VAUDIO].rightVolume = vol; // TODO: This may be wrong, not sure if's in a different format? @@ -83,12 +83,12 @@ static u32 sceVaudioOutputBlocking(int vol, u32 buffer) { } static u32 sceVaudioSetEffectType(int effectType, int vol) { - ERROR_LOG_REPORT(SCEAUDIO, "UNIMPL sceVaudioSetEffectType(%i, %i)", effectType, vol); + ERROR_LOG_REPORT(Log::sceAudio, "UNIMPL sceVaudioSetEffectType(%i, %i)", effectType, vol); return 0; } static u32 sceVaudioSetAlcMode(int alcMode) { - ERROR_LOG_REPORT(SCEAUDIO, "UNIMPL sceVaudioSetAlcMode(%i)", alcMode); + ERROR_LOG_REPORT(Log::sceAudio, "UNIMPL sceVaudioSetAlcMode(%i)", alcMode); return 0; } diff --git a/Core/HW/AsyncIOManager.cpp b/Core/HW/AsyncIOManager.cpp index 2156d5261a..ee842a0861 100644 --- a/Core/HW/AsyncIOManager.cpp +++ b/Core/HW/AsyncIOManager.cpp @@ -43,7 +43,7 @@ void AsyncIOManager::ScheduleOperation(const AsyncIOEvent &ev) { { std::lock_guard guard(resultsLock_); if (!resultsPending_.insert(ev.handle).second) { - ERROR_LOG_REPORT(SCEIO, "Scheduling operation for file %d while one is pending (type %d)", ev.handle, ev.type); + ERROR_LOG_REPORT(Log::sceIo, "Scheduling operation for file %d while one is pending (type %d)", ev.handle, ev.type); } } ScheduleEvent(ev); @@ -127,7 +127,7 @@ void AsyncIOManager::ProcessEvent(AsyncIOEvent ev) { break; default: - ERROR_LOG_REPORT(SCEIO, "Unsupported IO event type"); + ERROR_LOG_REPORT(Log::sceIo, "Unsupported IO event type"); } } @@ -146,7 +146,7 @@ void AsyncIOManager::Write(u32 handle, const u8 *buf, size_t bytes) { void AsyncIOManager::EventResult(u32 handle, const AsyncIOResult &result) { std::lock_guard guard(resultsLock_); if (results_.find(handle) != results_.end()) { - ERROR_LOG_REPORT(SCEIO, "Overwriting previous result for file action on handle %d", handle); + ERROR_LOG_REPORT(Log::sceIo, "Overwriting previous result for file action on handle %d", handle); } results_[handle] = result; resultsWait_.notify_one(); diff --git a/Core/HW/Atrac3Standalone.cpp b/Core/HW/Atrac3Standalone.cpp index a585db1791..39670b750a 100644 --- a/Core/HW/Atrac3Standalone.cpp +++ b/Core/HW/Atrac3Standalone.cpp @@ -23,14 +23,14 @@ public: if (at3pCtx_) { codecOpen_ = true; } else { - ERROR_LOG(ME, "Failed to open atrac3+ context! (channels=%d blockAlign=%d ed=%d)", channels, (int)blockAlign, (int)extraDataSize); + ERROR_LOG(Log::ME, "Failed to open atrac3+ context! (channels=%d blockAlign=%d ed=%d)", channels, (int)blockAlign, (int)extraDataSize); } } else if (audioType_ == PSP_CODEC_AT3) { at3Ctx_ = atrac3_alloc(channels, &blockAlign_, extraData, (int)extraDataSize); if (at3Ctx_) { codecOpen_ = true; } else { - ERROR_LOG(ME, "Failed to open atrac3 context! !channels=%d blockAlign=%d ed=%d)", channels, (int)blockAlign, (int)extraDataSize); + ERROR_LOG(Log::ME, "Failed to open atrac3 context! !channels=%d blockAlign=%d ed=%d)", channels, (int)blockAlign, (int)extraDataSize); } } for (int i = 0; i < 2; i++) { @@ -64,7 +64,7 @@ public: bool Decode(const uint8_t *inbuf, int inbytes, int *inbytesConsumed, int outputChannels, int16_t *outbuf, int *outSamples) override { if (!codecOpen_) { - WARN_LOG_N_TIMES(codecNotOpen, 5, ME, "Atrac3Audio:Decode: Codec not open, not decoding"); + WARN_LOG_N_TIMES(codecNotOpen, 5, Log::ME, "Atrac3Audio:Decode: Codec not open, not decoding"); if (outSamples) *outSamples = 0; if (inbytesConsumed) @@ -72,7 +72,7 @@ public: return false; } if (inbytes != blockAlign_ && blockAlign_ != 0) { - WARN_LOG(ME, "Atrac3Audio::Decode: Unexpected block align %d (expected %d)", inbytes, blockAlign_); + WARN_LOG(Log::ME, "Atrac3Audio::Decode: Unexpected block align %d (expected %d)", inbytes, blockAlign_); } blockAlign_ = inbytes; // We just call the decode function directly without going through the whole packet machinery. diff --git a/Core/HW/Camera.cpp b/Core/HW/Camera.cpp index 9cf8138e21..7c542284c6 100644 --- a/Core/HW/Camera.cpp +++ b/Core/HW/Camera.cpp @@ -144,7 +144,7 @@ bool MyViewfinder::present(const QVideoFrame &frame) { int __qt_startCapture(int width, int height) { if (qt_camera != nullptr) { - ERROR_LOG(HLE, "camera already started"); + ERROR_LOG(Log::HLE, "camera already started"); return -1; } @@ -155,7 +155,7 @@ int __qt_startCapture(int width, int height) { if (availableCameras.size() < 1) { delete qt_camera; qt_camera = nullptr; - ERROR_LOG(HLE, "no camera found"); + ERROR_LOG(Log::HLE, "no camera found"); return -1; } for (const QCameraInfo &cameraInfo : availableCameras) { @@ -166,7 +166,7 @@ int __qt_startCapture(int width, int height) { if (qt_camera == nullptr) { qt_camera = new QCamera(); if (qt_camera == nullptr) { - ERROR_LOG(HLE, "cannot open camera"); + ERROR_LOG(Log::HLE, "cannot open camera"); return -1; } } @@ -213,12 +213,12 @@ std::vector __v4l_getDeviceList() { } int fd = -1; if((fd = open(path, O_RDONLY)) < 0) { - ERROR_LOG(HLE, "Cannot open '%s'; errno=%d(%s)", path, errno, strerror(errno)); + ERROR_LOG(Log::HLE, "Cannot open '%s'; errno=%d(%s)", path, errno, strerror(errno)); continue; } struct v4l2_capability video_cap; if(ioctl(fd, VIDIOC_QUERYCAP, &video_cap) < 0) { - ERROR_LOG(HLE, "VIDIOC_QUERYCAP"); + ERROR_LOG(Log::HLE, "VIDIOC_QUERYCAP"); goto cont; } else { char device[256]; @@ -243,7 +243,7 @@ void *v4l_loop(void *data) { buf.memory = V4L2_MEMORY_MMAP; if (ioctl(v4l_fd, VIDIOC_DQBUF, &buf) == -1) { - ERROR_LOG(HLE, "VIDIOC_DQBUF; errno=%d(%s)", errno, strerror(errno)); + ERROR_LOG(Log::HLE, "VIDIOC_DQBUF; errno=%d(%s)", errno, strerror(errno)); switch (errno) { case EAGAIN: continue; @@ -279,7 +279,7 @@ void *v4l_loop(void *data) { buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; if (ioctl(v4l_fd, VIDIOC_QBUF, &buf) == -1) { - ERROR_LOG(HLE, "VIDIOC_QBUF"); + ERROR_LOG(Log::HLE, "VIDIOC_QBUF"); return nullptr; } } @@ -301,22 +301,22 @@ int __v4l_startCapture(int ideal_width, int ideal_height) { snprintf(dev_name, sizeof(dev_name), "/dev/video%d", dev_index); if ((v4l_fd = open(dev_name, O_RDWR)) == -1) { - ERROR_LOG(HLE, "Cannot open '%s'; errno=%d(%s)", dev_name, errno, strerror(errno)); + ERROR_LOG(Log::HLE, "Cannot open '%s'; errno=%d(%s)", dev_name, errno, strerror(errno)); return -1; } struct v4l2_capability cap; memset(&cap, 0, sizeof(cap)); if (ioctl(v4l_fd, VIDIOC_QUERYCAP, &cap) == -1) { - ERROR_LOG(HLE, "VIDIOC_QUERYCAP"); + ERROR_LOG(Log::HLE, "VIDIOC_QUERYCAP"); return -1; } if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) { - ERROR_LOG(HLE, "V4L2_CAP_VIDEO_CAPTURE"); + ERROR_LOG(Log::HLE, "V4L2_CAP_VIDEO_CAPTURE"); return -1; } if (!(cap.capabilities & V4L2_CAP_STREAMING)) { - ERROR_LOG(HLE, "V4L2_CAP_STREAMING"); + ERROR_LOG(Log::HLE, "V4L2_CAP_STREAMING"); return -1; } @@ -331,19 +331,19 @@ int __v4l_startCapture(int ideal_width, int ideal_height) { desc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; while (ioctl(v4l_fd, VIDIOC_ENUM_FMT, &desc) == 0) { desc.index++; - INFO_LOG(HLE, "V4L2: pixel format supported: %s", desc.description); + INFO_LOG(Log::HLE, "V4L2: pixel format supported: %s", desc.description); if (fmt.fmt.pix.pixelformat != 0) { continue; } else if (desc.pixelformat == V4L2_PIX_FMT_YUYV || desc.pixelformat == V4L2_PIX_FMT_JPEG || desc.pixelformat == V4L2_PIX_FMT_MJPEG) { - INFO_LOG(HLE, "V4L2: %s selected", desc.description); + INFO_LOG(Log::HLE, "V4L2: %s selected", desc.description); fmt.fmt.pix.pixelformat = desc.pixelformat; v4l_format = desc.pixelformat; } } if (fmt.fmt.pix.pixelformat == 0) { - ERROR_LOG(HLE, "V4L2: No supported format found"); + ERROR_LOG(Log::HLE, "V4L2: No supported format found"); return -1; } @@ -356,7 +356,7 @@ int __v4l_startCapture(int ideal_width, int ideal_height) { while (ioctl(v4l_fd, VIDIOC_ENUM_FRAMESIZES, &frmsize) == 0) { frmsize.index++; if (frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE) { - INFO_LOG(HLE, "V4L2: frame size supported: %dx%d", frmsize.discrete.width, frmsize.discrete.height); + INFO_LOG(Log::HLE, "V4L2: frame size supported: %dx%d", frmsize.discrete.width, frmsize.discrete.height); bool matchesIdeal = frmsize.discrete.width >= ideal_width && frmsize.discrete.height >= ideal_height; bool zeroPix = fmt.fmt.pix.width == 0 && fmt.fmt.pix.height == 0; bool pixLarger = frmsize.discrete.width < fmt.fmt.pix.width && frmsize.discrete.height < fmt.fmt.pix.height; @@ -371,16 +371,16 @@ int __v4l_startCapture(int ideal_width, int ideal_height) { fmt.fmt.pix.width = ideal_width; fmt.fmt.pix.height = ideal_height; } - INFO_LOG(HLE, "V4L2: asking for %dx%d", fmt.fmt.pix.width, fmt.fmt.pix.height); + INFO_LOG(Log::HLE, "V4L2: asking for %dx%d", fmt.fmt.pix.width, fmt.fmt.pix.height); if (ioctl(v4l_fd, VIDIOC_S_FMT, &fmt) == -1) { - ERROR_LOG(HLE, "VIDIOC_S_FMT"); + ERROR_LOG(Log::HLE, "VIDIOC_S_FMT"); return -1; } v4l_hw_width = fmt.fmt.pix.width; v4l_hw_height = fmt.fmt.pix.height; - INFO_LOG(HLE, "V4L2: will receive %dx%d", v4l_hw_width, v4l_hw_height); + INFO_LOG(Log::HLE, "V4L2: will receive %dx%d", v4l_hw_width, v4l_hw_height); v4l_height_fixed_aspect = v4l_hw_width * ideal_height / ideal_width; - INFO_LOG(HLE, "V4L2: will use %dx%d", v4l_hw_width, v4l_height_fixed_aspect); + INFO_LOG(Log::HLE, "V4L2: will use %dx%d", v4l_hw_width, v4l_height_fixed_aspect); struct v4l2_requestbuffers req; memset(&req, 0, sizeof(req)); @@ -388,11 +388,11 @@ int __v4l_startCapture(int ideal_width, int ideal_height) { req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; req.memory = V4L2_MEMORY_MMAP; if (ioctl(v4l_fd, VIDIOC_REQBUFS, &req) == -1) { - ERROR_LOG(HLE, "VIDIOC_REQBUFS"); + ERROR_LOG(Log::HLE, "VIDIOC_REQBUFS"); return -1; } v4l_buffer_count = req.count; - INFO_LOG(HLE, "V4L2: buffer count: %d", v4l_buffer_count); + INFO_LOG(Log::HLE, "V4L2: buffer count: %d", v4l_buffer_count); v4l_buffers = (v4l_buf_t*) calloc(v4l_buffer_count, sizeof(v4l_buf_t)); for (int buf_id = 0; buf_id < v4l_buffer_count; buf_id++) { @@ -402,7 +402,7 @@ int __v4l_startCapture(int ideal_width, int ideal_height) { buf.memory = V4L2_MEMORY_MMAP; buf.index = buf_id; if (ioctl(v4l_fd, VIDIOC_QUERYBUF, &buf) == -1) { - ERROR_LOG(HLE, "VIDIOC_QUERYBUF"); + ERROR_LOG(Log::HLE, "VIDIOC_QUERYBUF"); return -1; } @@ -413,7 +413,7 @@ int __v4l_startCapture(int ideal_width, int ideal_height) { MAP_SHARED, v4l_fd, buf.m.offset); if (v4l_buffers[buf_id].start == MAP_FAILED) { - ERROR_LOG(HLE, "MAP_FAILED"); + ERROR_LOG(Log::HLE, "MAP_FAILED"); return -1; } @@ -422,14 +422,14 @@ int __v4l_startCapture(int ideal_width, int ideal_height) { buf.memory = V4L2_MEMORY_MMAP; buf.index = buf_id; if (ioctl(v4l_fd, VIDIOC_QBUF, &buf) == -1) { - ERROR_LOG(HLE, "VIDIOC_QBUF"); + ERROR_LOG(Log::HLE, "VIDIOC_QBUF"); return -1; } } enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl(v4l_fd, VIDIOC_STREAMON, &type) == -1) { - ERROR_LOG(HLE, "VIDIOC_STREAMON"); + ERROR_LOG(Log::HLE, "VIDIOC_STREAMON"); return -1; } @@ -446,19 +446,19 @@ int __v4l_stopCapture() { } if (ioctl(v4l_fd, VIDIOC_STREAMOFF, &type) == -1) { - ERROR_LOG(HLE, "VIDIOC_STREAMOFF"); + ERROR_LOG(Log::HLE, "VIDIOC_STREAMOFF"); goto exit; } for (int buf_id = 0; buf_id < v4l_buffer_count; buf_id++) { if (munmap(v4l_buffers[buf_id].start, v4l_buffers[buf_id].length) == -1) { - ERROR_LOG(HLE, "munmap"); + ERROR_LOG(Log::HLE, "munmap"); goto exit; } } if (close(v4l_fd) == -1) { - ERROR_LOG(HLE, "close"); + ERROR_LOG(Log::HLE, "close"); goto exit; } diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index 79c52a5763..224b46e146 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -71,7 +71,7 @@ static AVPixelFormat getSwsFormat(int pspFormat) case GE_CMODE_32BIT_ABGR8888: return AV_PIX_FMT_RGBA; default: - ERROR_LOG(ME, "Unknown pixel format"); + ERROR_LOG(Log::ME, "Unknown pixel format"); return (AVPixelFormat)0; } } @@ -96,11 +96,11 @@ void ffmpeg_logger(void *, int level, const char *format, va_list va_args) { // Let's color the log line appropriately. if (level <= AV_LOG_PANIC) { - ERROR_LOG(ME, "FF: %s", tmp); + ERROR_LOG(Log::ME, "FF: %s", tmp); } else if (level >= AV_LOG_VERBOSE) { - DEBUG_LOG(ME, "FF: %s", tmp); + DEBUG_LOG(Log::ME, "FF: %s", tmp); } else { - INFO_LOG(ME, "FF: %s", tmp); + INFO_LOG(Log::ME, "FF: %s", tmp); } } @@ -128,7 +128,7 @@ static int getPixelFormatBytes(int pspFormat) return 4; default: - ERROR_LOG(ME, "Unknown pixel format"); + ERROR_LOG(Log::ME, "Unknown pixel format"); return 4; } } @@ -245,13 +245,13 @@ bool MediaEngine::SetupStreams() { #ifdef USE_FFMPEG const u32 magic = *(u32_le *)&m_mpegheader[0]; if (magic != PSMF_MAGIC) { - WARN_LOG_REPORT(ME, "Could not setup streams, bad magic: %08x", magic); + WARN_LOG_REPORT(Log::ME, "Could not setup streams, bad magic: %08x", magic); return false; } int numStreams = *(u16_be *)&m_mpegheader[0x80]; if (numStreams <= 0 || numStreams > 8) { // Looks crazy. Let's bail out and let FFmpeg handle it. - WARN_LOG_REPORT(ME, "Could not setup streams, unexpected stream count: %d", numStreams); + WARN_LOG_REPORT(Log::ME, "Could not setup streams, unexpected stream count: %d", numStreams); return false; } @@ -306,7 +306,7 @@ bool MediaEngine::openContext(bool keepReadPos) { if (!SetupStreams()) { // Fallback to old behavior. Reads too much and corrupts when game doesn't read fast enough. // SetupStreams sometimes work for newer FFmpeg 3.1+ now, but sometimes framerate is missing. - WARN_LOG_REPORT_ONCE(setupStreams, ME, "Failed to read valid video stream data from header"); + WARN_LOG_REPORT_ONCE(setupStreams, Log::ME, "Failed to read valid video stream data from header"); if (avformat_find_stream_info(m_pFormatCtx, nullptr) < 0) { closeContext(); return false; @@ -314,7 +314,7 @@ bool MediaEngine::openContext(bool keepReadPos) { } if (m_videoStream >= (int)m_pFormatCtx->nb_streams) { - WARN_LOG_REPORT(ME, "Bad video stream %d", m_videoStream); + WARN_LOG_REPORT(Log::ME, "Bad video stream %d", m_videoStream); m_videoStream = -1; } @@ -523,13 +523,13 @@ bool MediaEngine::setVideoStream(int streamNum, bool force) { #if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100) AVCodec *pCodec = avcodec_find_decoder(stream->codecpar->codec_id); if (!pCodec) { - WARN_LOG_REPORT(ME, "Could not find decoder for %d", (int)stream->codecpar->codec_id); + WARN_LOG_REPORT(Log::ME, "Could not find decoder for %d", (int)stream->codecpar->codec_id); return false; } AVCodecContext *m_pCodecCtx = avcodec_alloc_context3(pCodec); int paramResult = avcodec_parameters_to_context(m_pCodecCtx, stream->codecpar); if (paramResult < 0) { - WARN_LOG_REPORT(ME, "Failed to prepare context parameters: %08x", paramResult); + WARN_LOG_REPORT(Log::ME, "Failed to prepare context parameters: %08x", paramResult); return false; } #else @@ -841,7 +841,7 @@ int MediaEngine::writeVideoImage(u32 bufferPtr, int frameWidth, int videoPixelMo if (!Memory::IsValidRange(bufferPtr, videoImageSize) || frameWidth > 2048) { // Clearly invalid values. Let's just not. - ERROR_LOG_REPORT(ME, "Ignoring invalid video decode address %08x/%x", bufferPtr, frameWidth); + ERROR_LOG_REPORT(Log::ME, "Ignoring invalid video decode address %08x/%x", bufferPtr, frameWidth); return 0; } @@ -892,7 +892,7 @@ int MediaEngine::writeVideoImage(u32 bufferPtr, int frameWidth, int videoPixelMo break; default: - ERROR_LOG_REPORT(ME, "Unsupported video pixel format %d", videoPixelMode); + ERROR_LOG_REPORT(Log::ME, "Unsupported video pixel format %d", videoPixelMode); break; } @@ -930,7 +930,7 @@ int MediaEngine::writeVideoImageWithRange(u32 bufferPtr, int frameWidth, int vid if (!Memory::IsValidRange(bufferPtr, videoImageSize) || frameWidth > 2048) { // Clearly invalid values. Let's just not. - ERROR_LOG_REPORT(ME, "Ignoring invalid video decode address %08x/%x", bufferPtr, frameWidth); + ERROR_LOG_REPORT(Log::ME, "Ignoring invalid video decode address %08x/%x", bufferPtr, frameWidth); return 0; } @@ -992,12 +992,12 @@ int MediaEngine::writeVideoImageWithRange(u32 bufferPtr, int frameWidth, int vid break; default: - ERROR_LOG_REPORT(ME, "Unsupported video pixel format %d", videoPixelMode); + ERROR_LOG_REPORT(Log::ME, "Unsupported video pixel format %d", videoPixelMode); break; } if (swizzle) { - WARN_LOG_REPORT_ONCE(vidswizzle, ME, "Swizzling Video with range"); + WARN_LOG_REPORT_ONCE(vidswizzle, Log::ME, "Swizzling Video with range"); const int bxc = videoLineSize / 16; int byc = (height + 7) / 8; @@ -1056,7 +1056,7 @@ int MediaEngine::getNextAudioFrame(u8 **buf, int *headerCode1, int *headerCode2) int MediaEngine::getAudioSamples(u32 bufferPtr) { int16_t *buffer = (int16_t *)Memory::GetPointerWriteRange(bufferPtr, 8192); if (buffer == nullptr) { - ERROR_LOG_REPORT(ME, "Ignoring bad audio decode address %08x during video playback", bufferPtr); + ERROR_LOG_REPORT(Log::ME, "Ignoring bad audio decode address %08x during video playback", bufferPtr); } if (!m_demux) { return 0; @@ -1079,7 +1079,7 @@ int MediaEngine::getAudioSamples(u32 bufferPtr) { int inbytesConsumed = 0; if (!m_audioContext->Decode(audioFrame, frameSize, &inbytesConsumed, 2, buffer, &outSamples)) { - ERROR_LOG(ME, "Audio (%s) decode failed during video playback", GetCodecName(m_audioType)); + ERROR_LOG(Log::ME, "Audio (%s) decode failed during video playback", GetCodecName(m_audioType)); } int outBytes = outSamples * sizeof(int16_t) * 2; diff --git a/Core/HW/MpegDemux.cpp b/Core/HW/MpegDemux.cpp index 6dbfa5ec44..cdef5cbee2 100644 --- a/Core/HW/MpegDemux.cpp +++ b/Core/HW/MpegDemux.cpp @@ -237,7 +237,7 @@ bool MpegDemux::demux(int audioChannel) break; } case PRIVATE_STREAM_1: { - // Audio stream + // AUDIO stream int length = read16(); // Check for PES header marker. looksValid = (m_buf[m_index] & 0xC0) == 0x80; @@ -270,7 +270,7 @@ bool MpegDemux::demux(int audioChannel) // User data, probably same as queried by sceMpegGetUserdataAu. // Not sure what exactly to do or how much to read. // TODO: implement properly. - WARN_LOG_REPORT_ONCE(mpeguserdata, ME, "MPEG user data found"); + WARN_LOG_REPORT_ONCE(mpeguserdata, Log::ME, "MPEG user data found"); looksValid = true; break; } diff --git a/Core/HW/SasAudio.cpp b/Core/HW/SasAudio.cpp index bfdb41834d..6c54fbda2e 100644 --- a/Core/HW/SasAudio.cpp +++ b/Core/HW/SasAudio.cpp @@ -79,7 +79,7 @@ void VagDecoder::DecodeBlock(const u8 *&read_pointer) { predict_nr >>= 4; int flags = *readp++; if (flags == 7) { - VERBOSE_LOG(SASMIX, "VAG ending block at %d", curBlock_); + VERBOSE_LOG(Log::SasMix, "VAG ending block at %d", curBlock_); end_ = true; return; } @@ -124,7 +124,7 @@ void VagDecoder::GetSamples(s16 *outSamples, int numSamples) { return; } if (!Memory::IsValidRange(read_, numBlocks_ * 16)) { - WARN_LOG_REPORT(SASMIX, "Bad VAG samples address? %08x / %d", read_, numBlocks_); + WARN_LOG_REPORT(Log::SasMix, "Bad VAG samples address? %08x / %d", read_, numBlocks_); return; } @@ -134,7 +134,7 @@ void VagDecoder::GetSamples(s16 *outSamples, int numSamples) { for (int i = 0; i < numSamples; i++) { if (curSample == 28) { if (loopAtNextBlock_) { - VERBOSE_LOG(SASMIX, "Looping VAG from block %d/%d to %d", curBlock_, numBlocks_, loopStartBlock_); + VERBOSE_LOG(Log::SasMix, "Looping VAG from block %d/%d to %d", curBlock_, numBlocks_, loopStartBlock_); // data_ starts at curBlock = -1. read_ = data_ + 16 * loopStartBlock_ + 16; readp = Memory::GetPointerUnchecked(read_); @@ -364,7 +364,7 @@ void ADSREnvelope::SetSimpleEnvelope(u32 ADSREnv1, u32 ADSREnv2) { } if (attackRate < 0 || decayRate < 0 || sustainRate < 0 || releaseRate < 0) { - ERROR_LOG_REPORT(SASMIX, "Simple ADSR resulted in invalid rates: %04x, %04x", ADSREnv1, ADSREnv2); + ERROR_LOG_REPORT(Log::SasMix, "Simple ADSR resulted in invalid rates: %04x, %04x", ADSREnv1, ADSREnv2); } } @@ -558,7 +558,7 @@ void SasInstance::MixVoice(SasVoice &voice) { u32 sampleFrac = voice.sampleFrac; int samplesToRead = (sampleFrac + voicePitch * std::max(0, grainSize - delay)) >> PSP_SAS_PITCH_BASE_SHIFT; if (samplesToRead > ARRAY_SIZE(mixTemp_) - 2) { - ERROR_LOG(SCESAS, "Too many samples to read (%d)! This shouldn't happen.", samplesToRead); + ERROR_LOG(Log::sceSas, "Too many samples to read (%d)! This shouldn't happen.", samplesToRead); samplesToRead = ARRAY_SIZE(mixTemp_) - 2; } int readPos = 2; @@ -614,7 +614,7 @@ void SasInstance::MixVoice(SasVoice &voice) { if (voice.HaveSamplesEnded()) voice.envelope.End(); if (voice.envelope.HasEnded()) { - // NOTICE_LOG(SASMIX, "Hit end of envelope"); + // NOTICE_LOG(Log::SasMix, "Hit end of envelope"); voice.playing = false; voice.on = false; } @@ -635,7 +635,7 @@ void SasInstance::Mix(u32 outAddr, u32 inAddr, int leftVol, int rightVol) { s16 *outp = (s16 *)Memory::GetPointerWriteRange(outAddr, 4 * grainSize); const s16 *inp = inAddr ? (const s16 *)Memory::GetPointerRange(inAddr, 4 * grainSize) : 0; if (!outp) { - WARN_LOG_REPORT(SCESAS, "Bad SAS Mix output address: %08x, grain=%d", outAddr, grainSize); + WARN_LOG_REPORT(Log::sceSas, "Bad SAS Mix output address: %08x, grain=%d", outAddr, grainSize); } else if (outputMode == PSP_SAS_OUTPUTMODE_MIXED) { // Okay, apply effects processing to the Send buffer. WriteMixedOutput(outp, inp, leftVol, rightVol); @@ -649,7 +649,7 @@ void SasInstance::Mix(u32 outAddr, u32 inAddr, int leftVol, int rightVol) { s16 *outpR = outp + grainSize * 1; s16 *outpSendL = outp + grainSize * 2; s16 *outpSendR = outp + grainSize * 3; - WARN_LOG_REPORT_ONCE(sasraw, SASMIX, "sceSasCore: raw outputMode"); + WARN_LOG_REPORT_ONCE(sasraw, Log::SasMix, "sceSasCore: raw outputMode"); for (int i = 0; i < grainSize * 2; i += 2) { *outpL++ = clamp_s16(mixBuffer[i + 0]); *outpR++ = clamp_s16(mixBuffer[i + 1]); @@ -776,7 +776,7 @@ void SasInstance::DoState(PointerWrap &p) { int n = PSP_SAS_VOICES_MAX; Do(p, n); if (n != PSP_SAS_VOICES_MAX) { - ERROR_LOG(SAVESTATE, "Wrong number of SAS voices"); + ERROR_LOG(Log::SaveState, "Wrong number of SAS voices"); return; } DoArray(p, voices, ARRAY_SIZE(voices)); @@ -798,7 +798,7 @@ void SasVoice::KeyOn() { if (Memory::IsValidAddress(vagAddr)) { vag.Start(vagAddr, vagSize, loop); } else { - ERROR_LOG(SASMIX, "Invalid VAG address %08x", vagAddr); + ERROR_LOG(Log::SasMix, "Invalid VAG address %08x", vagAddr); return; } break; diff --git a/Core/HW/SimpleAudioDec.cpp b/Core/HW/SimpleAudioDec.cpp index 538886cc22..f3517e7139 100644 --- a/Core/HW/SimpleAudioDec.cpp +++ b/Core/HW/SimpleAudioDec.cpp @@ -172,23 +172,23 @@ FFmpegAudioDecoder::FFmpegAudioDecoder(PSPAudioType audioType, int sampleRateHz, frame_ = av_frame_alloc(); - // Get Audio Codec ctx + // Get AUDIO Codec ctx int audioCodecId = GetAudioCodecID(audioType); if (!audioCodecId) { - ERROR_LOG(ME, "This version of FFMPEG does not support Audio codec type: %08x. Update your submodule.", audioType); + ERROR_LOG(Log::ME, "This version of FFMPEG does not support Audio codec type: %08x. Update your submodule.", audioType); return; } // Find decoder codec_ = avcodec_find_decoder((AVCodecID)audioCodecId); if (!codec_) { // Eh, we shouldn't even have managed to compile. But meh. - ERROR_LOG(ME, "This version of FFMPEG does not support AV_CODEC_ctx for audio (%s). Update your submodule.", GetCodecName(audioType)); + ERROR_LOG(Log::ME, "This version of FFMPEG does not support AV_CODEC_ctx for audio (%s). Update your submodule.", GetCodecName(audioType)); return; } // Allocate codec context codecCtx_ = avcodec_alloc_context3(codec_); if (!codecCtx_) { - ERROR_LOG(ME, "Failed to allocate a codec context"); + ERROR_LOG(Log::ME, "Failed to allocate a codec context"); return; } codecCtx_->channels = channels_; @@ -209,7 +209,7 @@ bool FFmpegAudioDecoder::OpenCodec(int block_align) { AVDictionary *opts = 0; int retval = avcodec_open2(codecCtx_, codec_, &opts); if (retval < 0) { - ERROR_LOG(ME, "Failed to open codec: retval = %i", retval); + ERROR_LOG(Log::ME, "Failed to open codec: retval = %i", retval); } av_dict_free(&opts); codecOpen_ = true; @@ -227,7 +227,7 @@ void FFmpegAudioDecoder::SetChannels(int channels) { #ifdef USE_FFMPEG if (codecOpen_) { - ERROR_LOG(ME, "Codec already open, cannot change channels"); + ERROR_LOG(Log::ME, "Codec already open, cannot change channels"); } else { channels_ = channels; codecCtx_->channels = channels_; @@ -278,7 +278,7 @@ bool FFmpegAudioDecoder::Decode(const uint8_t *inbuf, int inbytes, int *inbytesC if (inbytes != 0) { int err = avcodec_send_packet(codecCtx_, &packet); if (err < 0) { - ERROR_LOG(ME, "Error sending audio frame to decoder (%d bytes): %d (%08x)", inbytes, err, err); + ERROR_LOG(Log::ME, "Error sending audio frame to decoder (%d bytes): %d (%08x)", inbytes, err, err); return false; } } @@ -300,7 +300,7 @@ bool FFmpegAudioDecoder::Decode(const uint8_t *inbuf, int inbytes, int *inbytesC #endif if (len < 0) { - ERROR_LOG(ME, "Error decoding Audio frame (%i bytes): %i (%08x)", inbytes, len, len); + ERROR_LOG(Log::ME, "Error decoding Audio frame (%i bytes): %i (%08x)", inbytes, len, len); return false; } @@ -326,7 +326,7 @@ bool FFmpegAudioDecoder::Decode(const uint8_t *inbuf, int inbytes, int *inbytesC NULL); if (!swrCtx_ || swr_init(swrCtx_) < 0) { - ERROR_LOG(ME, "swr_init: Failed to initialize the resampling context"); + ERROR_LOG(Log::ME, "swr_init: Failed to initialize the resampling context"); avcodec_close(codecCtx_); codec_ = 0; return false; @@ -339,7 +339,7 @@ bool FFmpegAudioDecoder::Decode(const uint8_t *inbuf, int inbytes, int *inbytesC swrRet = swr_convert(swrCtx_, (uint8_t **)&outbuf, frame_->nb_samples, (const u8 **)frame_->extended_data, frame_->nb_samples); } if (swrRet < 0) { - ERROR_LOG(ME, "swr_convert: Error while converting: %d", swrRet); + ERROR_LOG(Log::ME, "swr_convert: Error while converting: %d", swrRet); return false; } // output stereo samples per frame diff --git a/Core/HW/StereoResampler.cpp b/Core/HW/StereoResampler.cpp index 6abf607eda..b7fa658e4b 100644 --- a/Core/HW/StereoResampler.cpp +++ b/Core/HW/StereoResampler.cpp @@ -73,7 +73,7 @@ StereoResampler::StereoResampler() // If framerate is "close"... if (refresh != 60.0f && refresh > 50.0f && refresh < 70.0f) { int input_sample_rate = (int)(44100 * (refresh / 60.0f)); - INFO_LOG(AUDIO, "StereoResampler: Adjusting target sample rate to %dHz", input_sample_rate); + INFO_LOG(Log::Audio, "StereoResampler: Adjusting target sample rate to %dHz", input_sample_rate); m_input_sample_rate = input_sample_rate; } diff --git a/Core/Instance.cpp b/Core/Instance.cpp index b8ecfd8d41..fcb350f82e 100644 --- a/Core/Instance.cpp +++ b/Core/Instance.cpp @@ -66,7 +66,7 @@ static bool UpdateInstanceCounter(void (*callback)(volatile InstanceInfo *)) { if (!buf) { auto err = GetLastError(); - ERROR_LOG(SCENET, "Could not map view of file %s, %08x %s", ID_SHM_NAME, (uint32_t)err, GetStringErrorMsg(err).c_str()); + ERROR_LOG(Log::sceNet, "Could not map view of file %s, %08x %s", ID_SHM_NAME, (uint32_t)err, GetStringErrorMsg(err).c_str()); return false; } @@ -91,7 +91,7 @@ static bool UpdateInstanceCounter(void (*callback)(volatile InstanceInfo *)) { InstanceInfo *buf = (InstanceInfo *)mmap(0, BUF_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, hIDMapFile, 0); if (buf == MAP_FAILED) { - ERROR_LOG(SCENET, "mmap(%s) failure.", ID_SHM_NAME); + ERROR_LOG(Log::sceNet, "mmap(%s) failure.", ID_SHM_NAME); return false; } @@ -138,7 +138,7 @@ void InitInstanceCounter() { DWORD lasterr = GetLastError(); if (!hIDMapFile) { - ERROR_LOG(SCENET, "Could not create %s file mapping object, %08x %s", ID_SHM_NAME, (uint32_t)lasterr, GetStringErrorMsg(lasterr).c_str()); + ERROR_LOG(Log::sceNet, "Could not create %s file mapping object, %08x %s", ID_SHM_NAME, (uint32_t)lasterr, GetStringErrorMsg(lasterr).c_str()); PPSSPP_ID = 1; return; } @@ -150,7 +150,7 @@ void InitInstanceCounter() { BUF_SIZE = (BUF_SIZE < sysconf(_SC_PAGE_SIZE)) ? sysconf(_SC_PAGE_SIZE) : BUF_SIZE; if (hIDMapFile < 0 || (ftruncate(hIDMapFile, BUF_SIZE)) == -1) { // Set the size - ERROR_LOG(SCENET, "ftruncate(%s) failure.", ID_SHM_NAME); + ERROR_LOG(Log::sceNet, "ftruncate(%s) failure.", ID_SHM_NAME); PPSSPP_ID = 1; return; } diff --git a/Core/KeyMap.cpp b/Core/KeyMap.cpp index 0cbda9d2f6..3197e1f1b3 100644 --- a/Core/KeyMap.cpp +++ b/Core/KeyMap.cpp @@ -76,7 +76,7 @@ void SingleInputMappingFromPspButton(int btn, std::vector *mapping if (!mapping.empty()) { mappings->push_back(mapping.mappings[0]); } else { - WARN_LOG(COMMON, "Encountered empty mapping in multi-mapping for button %d", btn); + WARN_LOG(Log::Common, "Encountered empty mapping in multi-mapping for button %d", btn); } } } @@ -855,7 +855,7 @@ void AutoConfForPad(const std::string &name) { std::lock_guard guard(g_controllerMapLock); g_controllerMap.clear(); - INFO_LOG(SYSTEM, "Autoconfiguring pad for '%s'", name.c_str()); + INFO_LOG(Log::System, "Autoconfiguring pad for '%s'", name.c_str()); #if PPSSPP_PLATFORM(ANDROID) if (name.find("Xbox") != std::string::npos) { diff --git a/Core/Loaders.cpp b/Core/Loaders.cpp index f15a071397..96799e3ca3 100644 --- a/Core/Loaders.cpp +++ b/Core/Loaders.cpp @@ -215,7 +215,7 @@ IdentifiedFileType Identify_File(FileLoader *fileLoader, std::string *errorStrin } return IdentifiedFileType::PSP_PBP; } else if (extension == ".pbp") { - ERROR_LOG(LOADER, "A PBP with the wrong magic number?"); + ERROR_LOG(Log::Loader, "A PBP with the wrong magic number?"); return IdentifiedFileType::PSP_PBP; } else if (extension == ".bin") { return IdentifiedFileType::UNKNOWN_BIN; @@ -271,7 +271,7 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) { { fileLoader = ResolveFileLoaderTarget(fileLoader); if (fileLoader->Exists()) { - INFO_LOG(LOADER, "File is a PBP in a directory: %s", fileLoader->GetPath().c_str()); + INFO_LOG(Log::Loader, "File is a PBP in a directory: %s", fileLoader->GetPath().c_str()); IdentifiedFileType ebootType = Identify_File(fileLoader, error_string); if (ebootType == IdentifiedFileType::PSP_ISO_NP) { InitMemoryForGameISO(fileLoader); @@ -309,7 +309,7 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) { case IdentifiedFileType::PSP_PBP: case IdentifiedFileType::PSP_ELF: { - INFO_LOG(LOADER, "File is an ELF or loose PBP! %s", fileLoader->GetPath().c_str()); + INFO_LOG(Log::Loader, "File is an ELF or loose PBP! %s", fileLoader->GetPath().c_str()); return Load_PSP_ELF_PBP(fileLoader, error_string); } @@ -352,7 +352,7 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) { break; case IdentifiedFileType::NORMAL_DIRECTORY: - ERROR_LOG(LOADER, "Just a directory."); + ERROR_LOG(Log::Loader, "Just a directory."); *error_string = "Just a directory."; break; @@ -371,18 +371,18 @@ bool LoadFile(FileLoader **fileLoaderPtr, std::string *error_string) { case IdentifiedFileType::UNKNOWN_ELF: case IdentifiedFileType::UNKNOWN_ISO: case IdentifiedFileType::UNKNOWN: - ERROR_LOG(LOADER, "Unknown file type: %s (%s)", fileLoader->GetPath().c_str(), error_string->c_str()); + ERROR_LOG(Log::Loader, "Unknown file type: %s (%s)", fileLoader->GetPath().c_str(), error_string->c_str()); *error_string = "Unknown file type: " + fileLoader->GetPath().ToString(); break; case IdentifiedFileType::ERROR_IDENTIFYING: *error_string = *error_string + ": " + (fileLoader ? fileLoader->LatestError() : ""); - ERROR_LOG(LOADER, "Error while identifying file: %s", error_string->c_str()); + ERROR_LOG(Log::Loader, "Error while identifying file: %s", error_string->c_str()); break; default: *error_string = StringFromFormat("Unhandled identified file type %d", (int)type); - ERROR_LOG(LOADER, "%s", error_string->c_str()); + ERROR_LOG(Log::Loader, "%s", error_string->c_str()); break; } diff --git a/Core/MIPS/ARM/ArmAsm.cpp b/Core/MIPS/ARM/ArmAsm.cpp index f90dd237ec..2b00b1573a 100644 --- a/Core/MIPS/ARM/ArmAsm.cpp +++ b/Core/MIPS/ARM/ArmAsm.cpp @@ -56,7 +56,7 @@ static const bool disasm = false; extern volatile CoreState coreState; void ShowPC(u32 sp) { - ERROR_LOG(JIT, "ShowPC : %08x ArmSP : %08x", currentMIPS->pc, sp); + ERROR_LOG(Log::JIT, "ShowPC : %08x ArmSP : %08x", currentMIPS->pc, sp); // Sleep(1); } @@ -127,7 +127,7 @@ void ArmJit::GenerateFixedCode() { enterDispatcher = AlignCode16(); - DEBUG_LOG(JIT, "Base: %08x", (u32)Memory::base); + DEBUG_LOG(Log::JIT, "Base: %08x", (u32)Memory::base); SetCC(CC_AL); @@ -256,9 +256,9 @@ void ArmJit::GenerateFixedCode() { // Uncomment if you want to see the output... if (disasm) { - INFO_LOG(JIT, "THE DISASM ========================"); + INFO_LOG(Log::JIT, "THE DISASM ========================"); DisassembleArm(start, GetCodePtr() - start); - INFO_LOG(JIT, "END OF THE DISASM ========================"); + INFO_LOG(Log::JIT, "END OF THE DISASM ========================"); } // Don't forget to zap the instruction cache! diff --git a/Core/MIPS/ARM/ArmCompBranch.cpp b/Core/MIPS/ARM/ArmCompBranch.cpp index ee6a96a620..526da54a68 100644 --- a/Core/MIPS/ARM/ArmCompBranch.cpp +++ b/Core/MIPS/ARM/ArmCompBranch.cpp @@ -68,7 +68,7 @@ namespace MIPSComp void ArmJit::BranchRSRTComp(MIPSOpcode op, CCFlags cc, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in RSRTComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in RSRTComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -195,7 +195,7 @@ void ArmJit::BranchRSRTComp(MIPSOpcode op, CCFlags cc, bool likely) void ArmJit::BranchRSZeroComp(MIPSOpcode op, CCFlags cc, bool andLink, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in RSZeroComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in RSZeroComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -355,7 +355,7 @@ void ArmJit::Comp_RelBranchRI(MIPSOpcode op) void ArmJit::BranchFPFlag(MIPSOpcode op, CCFlags cc, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in FPFlag delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in FPFlag delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -426,7 +426,7 @@ void ArmJit::Comp_FPUBranch(MIPSOpcode op) void ArmJit::BranchVFPUFlag(MIPSOpcode op, CCFlags cc, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in VFPU delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in VFPU delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -503,7 +503,7 @@ static void HitInvalidJump(uint32_t dest) { void ArmJit::Comp_Jump(MIPSOpcode op) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in Jump delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in Jump delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } u32 off = TARGET26; @@ -512,7 +512,7 @@ void ArmJit::Comp_Jump(MIPSOpcode op) { // Might be a stubbed address or something? if (!Memory::IsValidAddress(targetAddr) || (targetAddr & 3) != 0) { if (js.nextExit == 0) { - ERROR_LOG_REPORT(JIT, "Jump to invalid address: %08x", targetAddr); + ERROR_LOG_REPORT(Log::JIT, "Jump to invalid address: %08x", targetAddr); } else { js.compiling = false; } @@ -570,7 +570,7 @@ void ArmJit::Comp_Jump(MIPSOpcode op) { void ArmJit::Comp_JumpReg(MIPSOpcode op) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in JumpReg delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in JumpReg delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } MIPSGPReg rs = _RS; @@ -650,7 +650,7 @@ void ArmJit::Comp_JumpReg(MIPSOpcode op) void ArmJit::Comp_Syscall(MIPSOpcode op) { if (op.encoding == 0x03FFFFcc) { - WARN_LOG(JIT, "Encountered bad syscall instruction at %08x (%08x)", js.compilerPC, op.encoding); + WARN_LOG(Log::JIT, "Encountered bad syscall instruction at %08x (%08x)", js.compilerPC, op.encoding); } if (!g_Config.bSkipDeadbeefFilling) diff --git a/Core/MIPS/ARM/ArmCompVFPU.cpp b/Core/MIPS/ARM/ArmCompVFPU.cpp index b843e84cbb..7577ad26cc 100644 --- a/Core/MIPS/ARM/ArmCompVFPU.cpp +++ b/Core/MIPS/ARM/ArmCompVFPU.cpp @@ -107,7 +107,7 @@ namespace MIPSComp js.prefixDFlag = JitState::PREFIX_KNOWN_DIRTY; break; default: - ERROR_LOG(CPU, "VPFX - bad regnum %i : data=%08x", regnum, data); + ERROR_LOG(Log::CPU, "VPFX - bad regnum %i : data=%08x", regnum, data); break; } } @@ -142,7 +142,7 @@ namespace MIPSComp // Prefix may say "z, z, z, z" but if this is a pair, we force to x. // TODO: But some ops seem to use const 0 instead? if (regnum >= n) { - WARN_LOG(CPU, "JIT: Invalid VFPU swizzle: %08x : %d / %d at PC = %08x (%s)", prefix, regnum, n, GetCompilerPC(), MIPSDisasmAt(GetCompilerPC()).c_str()); + WARN_LOG(Log::CPU, "JIT: Invalid VFPU swizzle: %08x : %d / %d at PC = %08x (%s)", prefix, regnum, n, GetCompilerPC(), MIPSDisasmAt(GetCompilerPC()).c_str()); regnum = 0; } @@ -1060,7 +1060,7 @@ namespace MIPSComp VDIV(fpr.V(tempregs[i]), S0, fpr.V(sregs[i])); break; default: - ERROR_LOG(JIT, "case missing in vfpu vv2op"); + ERROR_LOG(Log::JIT, "case missing in vfpu vv2op"); DISABLE; break; } @@ -1283,7 +1283,7 @@ namespace MIPSComp } } else { //ERROR - maybe need to make this value too an "interlock" value? - ERROR_LOG(CPU, "mfv - invalid register %i", imm); + ERROR_LOG(Log::CPU, "mfv - invalid register %i", imm); } } break; @@ -2174,7 +2174,7 @@ namespace MIPSComp break; } default: - ERROR_LOG(JIT, "Bad what in vrot"); + ERROR_LOG(Log::JIT, "Bad what in vrot"); break; } } @@ -2211,7 +2211,7 @@ namespace MIPSComp // Pair of vrot. Let's join them. vd2 = MIPS_GET_VD(nextOp); imm2 = (nextOp >> 16) & 0x1f; - // NOTICE_LOG(JIT, "Joint VFPU at %08x", js.blockStart); + // NOTICE_LOG(Log::JIT, "Joint VFPU at %08x", js.blockStart); } u8 sreg; GetVectorRegs(dregs, sz, vd); diff --git a/Core/MIPS/ARM/ArmCompVFPUNEON.cpp b/Core/MIPS/ARM/ArmCompVFPUNEON.cpp index 1f4f783e76..71838d6837 100644 --- a/Core/MIPS/ARM/ArmCompVFPUNEON.cpp +++ b/Core/MIPS/ARM/ArmCompVFPUNEON.cpp @@ -55,7 +55,7 @@ // #define CONDITIONAL_DISABLE { fpr.ReleaseSpillLocksAndDiscardTemps(); Comp_Generic(op); return; } #define CONDITIONAL_DISABLE(flag) if (jo.Disabled(JitDisable::flag)) { Comp_Generic(op); return; } #define DISABLE { fpr.ReleaseSpillLocksAndDiscardTemps(); Comp_Generic(op); return; } -#define DISABLE_UNKNOWN_PREFIX { WARN_LOG(JIT, "DISABLE: Unknown Prefix in %s", __FUNCTION__); fpr.ReleaseSpillLocksAndDiscardTemps(); Comp_Generic(op); return; } +#define DISABLE_UNKNOWN_PREFIX { WARN_LOG(Log::JIT, "DISABLE: Unknown Prefix in %s", __FUNCTION__); fpr.ReleaseSpillLocksAndDiscardTemps(); Comp_Generic(op); return; } #define _RS MIPS_GET_RS(op) #define _RT MIPS_GET_RT(op) @@ -182,7 +182,7 @@ void ArmJit::CompNEON_SV(MIPSOpcode op) { case 50: //lv.s // VI(vt) = Memory::Read_U32(addr); { if (!gpr.IsImm(rs) && jo.cachePointers && g_Config.bFastMemory && (offset & 3) == 0 && offset < 0x400 && offset > -0x400) { - INFO_LOG(HLE, "LV.S fastmode!"); + INFO_LOG(Log::HLE, "LV.S fastmode!"); // TODO: Also look forward and combine multiple loads. gpr.MapRegAsPointer(rs); ARMReg ar = fpr.QMapReg(vt, V_Single, MAP_NOINIT | MAP_DIRTY); @@ -194,7 +194,7 @@ void ArmJit::CompNEON_SV(MIPSOpcode op) { } break; } - INFO_LOG(HLE, "LV.S slowmode!"); + INFO_LOG(Log::HLE, "LV.S slowmode!"); // CC might be set by slow path below, so load regs first. ARMReg ar = fpr.QMapReg(vt, V_Single, MAP_DIRTY | MAP_NOINIT); @@ -226,7 +226,7 @@ void ArmJit::CompNEON_SV(MIPSOpcode op) { case 58: //sv.s // Memory::Write_U32(VI(vt), addr); { if (!gpr.IsImm(rs) && jo.cachePointers && g_Config.bFastMemory && (offset & 3) == 0 && offset < 0x400 && offset > -0x400) { - INFO_LOG(HLE, "SV.S fastmode!"); + INFO_LOG(Log::HLE, "SV.S fastmode!"); // TODO: Also look forward and combine multiple stores. gpr.MapRegAsPointer(rs); ARMReg ar = fpr.QMapReg(vt, V_Single, 0); @@ -239,7 +239,7 @@ void ArmJit::CompNEON_SV(MIPSOpcode op) { break; } - INFO_LOG(HLE, "SV.S slowmode!"); + INFO_LOG(Log::HLE, "SV.S slowmode!"); // CC might be set by slow path below, so load regs first. ARMReg ar = fpr.QMapReg(vt, V_Single, 0); if (gpr.IsImm(rs)) { @@ -303,7 +303,7 @@ void ArmJit::CompNEON_SVQ(MIPSOpcode op) { // Detected four consecutive ones! // gpr.MapRegAsPointer(rs); // fpr.QLoad4x4(vts[4], rs, offset); - INFO_LOG(JIT, "Matrix load detected! TODO: optimize"); + INFO_LOG(Log::JIT, "Matrix load detected! TODO: optimize"); // break; } } @@ -368,7 +368,7 @@ void ArmJit::CompNEON_SVQ(MIPSOpcode op) { // Detected four consecutive ones! // gpr.MapRegAsPointer(rs); // fpr.QLoad4x4(vts[4], rs, offset); - INFO_LOG(JIT, "Matrix store detected! TODO: optimize"); + INFO_LOG(Log::JIT, "Matrix store detected! TODO: optimize"); // break; } } @@ -690,7 +690,7 @@ void ArmJit::CompNEON_Mftv(MIPSOpcode op) { } } else { //ERROR - maybe need to make this value too an "interlock" value? - ERROR_LOG(CPU, "mfv - invalid register %i", imm); + ERROR_LOG(Log::CPU, "mfv - invalid register %i", imm); } } break; @@ -869,7 +869,7 @@ void ArmJit::CompNEON_Vmmul(MIPSOpcode op) { bool overlap = GetMatrixOverlap(_VD, _VS, msz) || GetMatrixOverlap(_VD, _VT, msz); if (overlap) { // Later. Fortunately, the VFPU also seems to prohibit overlap for matrix mul. - INFO_LOG(JIT, "Matrix overlap, ignoring."); + INFO_LOG(Log::JIT, "Matrix overlap, ignoring."); DISABLE; } @@ -1036,7 +1036,7 @@ void ArmJit::CompNEON_Vh2f(MIPSOpcode op) { outsize = V_Quad; break; default: - ERROR_LOG(JIT, "Vh2f: Must be pair or quad"); + ERROR_LOG(Log::JIT, "Vh2f: Must be pair or quad"); break; } diff --git a/Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp b/Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp index 5a6f727456..01fdc40b83 100644 --- a/Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp +++ b/Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp @@ -177,7 +177,7 @@ ARMReg ArmJit::NEONMapPrefixST(int mipsReg, VectorSize sz, u32 prefix, int mapFl } else { // Do some special cases if (regnum[0] == 1 && regnum[1] == 0) { - INFO_LOG(HLE, "PREFIXST: Bottom swap!"); + INFO_LOG(Log::HLE, "PREFIXST: Bottom swap!"); VREV64(I_32, ar, inputAR); regnum[0] = 0; regnum[1] = 1; @@ -193,7 +193,7 @@ ARMReg ArmJit::NEONMapPrefixST(int mipsReg, VectorSize sz, u32 prefix, int mapFl // TODO: Cannot do this permutation yet! if (!match) { - ERROR_LOG(HLE, "PREFIXST: Unsupported permute! %i %i %i %i / %i", regnum[0], regnum[1], regnum[2], regnum[3], n); + ERROR_LOG(Log::HLE, "PREFIXST: Unsupported permute! %i %i %i %i / %i", regnum[0], regnum[1], regnum[2], regnum[3], n); VMOV(ar, inputAR); } } @@ -218,7 +218,7 @@ ARMReg ArmJit::NEONMapPrefixST(int mipsReg, VectorSize sz, u32 prefix, int mapFl } } VMOV(ar, MatchSize(Q0, ar)); - INFO_LOG(HLE, "PREFIXST: Partial ABS %i/%i! Slow fallback generated.", abs_mask, full_mask); + INFO_LOG(Log::HLE, "PREFIXST: Partial ABS %i/%i! Slow fallback generated.", abs_mask, full_mask); } } @@ -240,7 +240,7 @@ ARMReg ArmJit::NEONMapPrefixST(int mipsReg, VectorSize sz, u32 prefix, int mapFl } } VMOV(ar, MatchSize(Q0, ar)); - INFO_LOG(HLE, "PREFIXST: Partial Negate %i/%i! Slow fallback generated.", negate_mask, full_mask); + INFO_LOG(Log::HLE, "PREFIXST: Partial Negate %i/%i! Slow fallback generated.", negate_mask, full_mask); } } @@ -270,7 +270,7 @@ ArmJit::DestARMReg ArmJit::NEONMapPrefixD(int vreg, VectorSize sz, int mapFlags) dest.backingRd = dest.rd; } else { // Allocate a temporary register. - ERROR_LOG(JIT, "PREFIXD: Write mask allocated! %i/%i", writeMask, full_mask); + ERROR_LOG(Log::JIT, "PREFIXD: Write mask allocated! %i/%i", writeMask, full_mask); dest.rd = fpr.QAllocTemp(sz); dest.backingRd = fpr.QMapReg(vreg, sz, mapFlags & ~MAP_NOINIT); // Force initialization of the backing reg. } @@ -294,12 +294,12 @@ void ArmJit::NEONApplyPrefixD(DestARMReg dest) { if (sat1_mask && sat3_mask) { // Why would anyone do this? - ERROR_LOG(JIT, "PREFIXD: Can't have both sat[0-1] and sat[-1-1] at the same time yet"); + ERROR_LOG(Log::JIT, "PREFIXD: Can't have both sat[0-1] and sat[-1-1] at the same time yet"); } if (sat1_mask) { if (sat1_mask != full_mask) { - ERROR_LOG(JIT, "PREFIXD: Can't have partial sat1 mask yet (%i vs %i)", sat1_mask, full_mask); + ERROR_LOG(Log::JIT, "PREFIXD: Can't have partial sat1 mask yet (%i vs %i)", sat1_mask, full_mask); } if (IsD(dest.rd)) { VMOV_immf(D0, 0.0); @@ -316,7 +316,7 @@ void ArmJit::NEONApplyPrefixD(DestARMReg dest) { if (sat3_mask && sat1_mask != full_mask) { if (sat3_mask != full_mask) { - ERROR_LOG(JIT, "PREFIXD: Can't have partial sat3 mask yet (%i vs %i)", sat3_mask, full_mask); + ERROR_LOG(Log::JIT, "PREFIXD: Can't have partial sat3 mask yet (%i vs %i)", sat3_mask, full_mask); } if (IsD(dest.rd)) { VMOV_immf(D0, 0.0); @@ -340,11 +340,11 @@ void ArmJit::NEONApplyPrefixD(DestARMReg dest) { int writeMask = (~(js.prefixD >> 8)) & 0xF; if (writeMask == 3) { - INFO_LOG(JIT, "Doing writemask = 3"); + INFO_LOG(Log::JIT, "Doing writemask = 3"); VMOV(D_0(dest.rd), D_0(dest.backingRd)); } else { // TODO - ERROR_LOG(JIT, "PREFIXD: Arbitrary write masks not supported (%i / %i)", writeMask, full_mask); + ERROR_LOG(Log::JIT, "PREFIXD: Arbitrary write masks not supported (%i / %i)", writeMask, full_mask); VMOV(dest.backingRd, dest.rd); } } diff --git a/Core/MIPS/ARM/ArmJit.cpp b/Core/MIPS/ARM/ArmJit.cpp index e830a6b310..2b05f9a4e1 100644 --- a/Core/MIPS/ARM/ArmJit.cpp +++ b/Core/MIPS/ARM/ArmJit.cpp @@ -63,13 +63,13 @@ void DisassembleArm(const u8 *data, int size) { int reg1 = (next & 0x0000F000) >> 12; if (reg0 == reg1) { snprintf(temp, sizeof(temp), "%08x MOV32 %s, %04x%04x", (u32)inst, ArmRegName(reg0), hi, low); - INFO_LOG(JIT, "A: %s", temp); + INFO_LOG(Log::JIT, "A: %s", temp); i += 4; continue; } } ArmDis((u32)codePtr, inst, temp, sizeof(temp), true); - INFO_LOG(JIT, "A: %s", temp); + INFO_LOG(Log::JIT, "A: %s", temp); } } @@ -114,7 +114,7 @@ ArmJit::ArmJit(MIPSState *mipsState) : blocks(mipsState, this), gpr(mipsState, & AllocCodeSpace(1024 * 1024 * 16); // 32MB is the absolute max because that's what an ARM branch instruction can reach, backwards and forwards. GenerateFixedCode(); - INFO_LOG(JIT, "ARM JIT initialized: %lld MB of code space", (long long)(GetSpaceLeft() / (1024 * 1024))); + INFO_LOG(Log::JIT, "ARM JIT initialized: %lld MB of code space", (long long)(GetSpaceLeft() / (1024 * 1024))); js.startDefaultPrefix = mips_->HasDefaultPrefix(); @@ -133,7 +133,7 @@ void ArmJit::DoState(PointerWrap &p) return; if (p.mode == PointerWrap::MODE_READ && !js.startDefaultPrefix) { - WARN_LOG(CPU, "Jit: An uneaten prefix was previously detected. Jitting in unknown-prefix mode."); + WARN_LOG(Log::CPU, "Jit: An uneaten prefix was previously detected. Jitting in unknown-prefix mode."); } Do(p, js.startDefaultPrefix); if (s >= 2) { @@ -208,10 +208,10 @@ void ArmJit::InvalidateCacheAt(u32 em_address, int length) { void ArmJit::EatInstruction(MIPSOpcode op) { MIPSInfo info = MIPSGetInfo(op); if (info & DELAYSLOT) { - ERROR_LOG_REPORT_ONCE(ateDelaySlot, JIT, "Ate a branch op."); + ERROR_LOG_REPORT_ONCE(ateDelaySlot, Log::JIT, "Ate a branch op."); } if (js.inDelaySlot) { - ERROR_LOG_REPORT_ONCE(ateInDelaySlot, JIT, "Ate an instruction inside a delay slot."); + ERROR_LOG_REPORT_ONCE(ateInDelaySlot, Log::JIT, "Ate an instruction inside a delay slot."); } CheckJitBreakpoint(GetCompilerPC() + 4, 0); @@ -244,7 +244,7 @@ void ArmJit::CompileDelaySlot(int flags) { void ArmJit::Compile(u32 em_address) { PROFILE_THIS_SCOPE("jitc"); - // INFO_LOG(JIT, "Compiling at %08x", em_address); + // INFO_LOG(Log::JIT, "Compiling at %08x", em_address); if (GetSpaceLeft() < 0x10000 || blocks.IsFull()) { ClearCache(); @@ -263,7 +263,7 @@ void ArmJit::Compile(u32 em_address) { bool cleanSlate = false; if (js.hasSetRounding && !js.lastSetRounding) { - WARN_LOG(JIT, "Detected rounding mode usage, rebuilding jit with checks"); + WARN_LOG(Log::JIT, "Detected rounding mode usage, rebuilding jit with checks"); // Won't loop, since hasSetRounding is only ever set to 1. js.lastSetRounding = js.hasSetRounding; cleanSlate = true; @@ -271,7 +271,7 @@ void ArmJit::Compile(u32 em_address) { // Drat. The VFPU hit an uneaten prefix at the end of a block. if (js.startDefaultPrefix && js.MayHavePrefix()) { - WARN_LOG_REPORT(JIT, "An uneaten prefix at end of block: %08x", GetCompilerPC() - 4); + WARN_LOG_REPORT(Log::JIT, "An uneaten prefix at end of block: %08x", GetCompilerPC() - 4); js.LogPrefix(); // Let's try that one more time. We won't get back here because we toggled the value. @@ -398,17 +398,17 @@ const u8 *ArmJit::DoJit(u32 em_address, JitBlock *b) char temp[256]; if (logBlocks > 0 && dontLogBlocks == 0) { - INFO_LOG(JIT, "=============== mips ==============="); + INFO_LOG(Log::JIT, "=============== mips ==============="); for (u32 cpc = em_address; cpc != GetCompilerPC() + 4; cpc += 4) { MIPSDisAsm(Memory::Read_Opcode_JIT(cpc), cpc, temp, sizeof(temp), true); - INFO_LOG(JIT, "M: %08x %s", cpc, temp); + INFO_LOG(Log::JIT, "M: %08x %s", cpc, temp); } } b->codeSize = GetCodePtr() - b->normalEntry; if (logBlocks > 0 && dontLogBlocks == 0) { - INFO_LOG(JIT, "=============== ARM ==============="); + INFO_LOG(Log::JIT, "=============== ARM ==============="); DisassembleArm(b->normalEntry, GetCodePtr() - b->normalEntry); } if (logBlocks > 0) @@ -449,7 +449,7 @@ bool ArmJit::DescribeCodePtr(const u8 *ptr, std::string &name) void ArmJit::Comp_RunBlock(MIPSOpcode op) { // This shouldn't be necessary, the dispatcher should catch us before we get here. - ERROR_LOG(JIT, "Comp_RunBlock should never be reached!"); + ERROR_LOG(Log::JIT, "Comp_RunBlock should never be reached!"); } void ArmJit::LinkBlock(u8 *exitPoint, const u8 *checkedEntry) { @@ -561,7 +561,7 @@ void ArmJit::Comp_ReplacementFunc(MIPSOpcode op) const ReplacementTableEntry *entry = GetReplacementFunc(index); if (!entry) { - ERROR_LOG_REPORT_ONCE(replFunc, HLE, "Invalid replacement op %08x at %08x", op.encoding, js.compilerPC); + ERROR_LOG_REPORT_ONCE(replFunc, Log::HLE, "Invalid replacement op %08x at %08x", op.encoding, js.compilerPC); return; } @@ -634,7 +634,7 @@ void ArmJit::Comp_ReplacementFunc(MIPSOpcode op) js.compiling = false; } } else { - ERROR_LOG(HLE, "Replacement function %s has neither jit nor regular impl", entry->name); + ERROR_LOG(Log::HLE, "Replacement function %s has neither jit nor regular impl", entry->name); } } diff --git a/Core/MIPS/ARM/ArmRegCache.cpp b/Core/MIPS/ARM/ArmRegCache.cpp index 61b16b5c53..40369d82cf 100644 --- a/Core/MIPS/ARM/ArmRegCache.cpp +++ b/Core/MIPS/ARM/ArmRegCache.cpp @@ -229,7 +229,7 @@ ARMReg ArmRegCache::MapReg(MIPSGPReg mipsReg, int mapFlags) { if (mr[mipsReg].loc == ML_ARMREG || mr[mipsReg].loc == ML_ARMREG_IMM) { ARMReg armReg = mr[mipsReg].reg; if (ar[armReg].mipsReg != mipsReg) { - ERROR_LOG_REPORT(JIT, "Register mapping out of sync! %i", mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Register mapping out of sync! %i", mipsReg); } if (mapFlags & MAP_DIRTY) { // Mapping dirty means the old imm value is invalid. @@ -292,7 +292,7 @@ allocate: } if (bestToSpill != INVALID_REG) { - // ERROR_LOG(JIT, "Out of registers at PC %08x - spills register %i.", mips_->pc, bestToSpill); + // ERROR_LOG(Log::JIT, "Out of registers at PC %08x - spills register %i.", mips_->pc, bestToSpill); // TODO: Broken somehow in Dante's Inferno, but most games work. Bad flags in MIPSTables somewhere? if (clobbered) { DiscardR(ar[bestToSpill].mipsReg); @@ -303,7 +303,7 @@ allocate: } // Uh oh, we have all of them spilllocked.... - ERROR_LOG_REPORT(JIT, "Out of spillable registers at PC %08x!!!", mips_->pc); + ERROR_LOG_REPORT(Log::JIT, "Out of spillable registers at PC %08x!!!", mips_->pc); return INVALID_REG; } @@ -356,7 +356,7 @@ void ArmRegCache::FlushArmReg(ARMReg r) { if (ar[r].mipsReg == MIPS_REG_INVALID) { // Nothing to do, reg not mapped. if (ar[r].isDirty) { - ERROR_LOG_REPORT(JIT, "Dirty but no mipsreg?"); + ERROR_LOG_REPORT(Log::JIT, "Dirty but no mipsreg?"); } return; } @@ -411,7 +411,7 @@ void ArmRegCache::FlushR(MIPSGPReg r) { case ML_ARMREG: case ML_ARMREG_IMM: if (mr[r].reg == INVALID_REG) { - ERROR_LOG_REPORT(JIT, "FlushR: MipsReg %d had bad ArmReg", r); + ERROR_LOG_REPORT(Log::JIT, "FlushR: MipsReg %d had bad ArmReg", r); } if (ar[mr[r].reg].isDirty) { if (r != MIPS_REG_ZERO) { @@ -425,7 +425,7 @@ void ArmRegCache::FlushR(MIPSGPReg r) { case ML_ARMREG_AS_PTR: // Never dirty. if (ar[mr[r].reg].isDirty) { - ERROR_LOG_REPORT(JIT, "ARMREG_AS_PTR cannot be dirty (yet)"); + ERROR_LOG_REPORT(Log::JIT, "ARMREG_AS_PTR cannot be dirty (yet)"); } ar[mr[r].reg].mipsReg = MIPS_REG_INVALID; break; @@ -435,7 +435,7 @@ void ArmRegCache::FlushR(MIPSGPReg r) { break; default: - ERROR_LOG_REPORT(JIT, "FlushR: MipsReg %d with invalid location %d", r, mr[r].loc); + ERROR_LOG_REPORT(Log::JIT, "FlushR: MipsReg %d with invalid location %d", r, mr[r].loc); break; } if (r == MIPS_REG_ZERO) { @@ -544,14 +544,14 @@ void ArmRegCache::FlushAll() { // Sanity check for (int i = 0; i < NUM_ARMREG; i++) { if (ar[i].mipsReg != MIPS_REG_INVALID) { - ERROR_LOG_REPORT(JIT, "Flush fail: ar[%i].mipsReg=%i", i, ar[i].mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Flush fail: ar[%i].mipsReg=%i", i, ar[i].mipsReg); } } } void ArmRegCache::SetImm(MIPSGPReg r, u32 immVal) { if (r == MIPS_REG_ZERO && immVal != 0) { - ERROR_LOG_REPORT(JIT, "Trying to set immediate %08x to r0 at %08x", immVal, compilerPC_); + ERROR_LOG_REPORT(Log::JIT, "Trying to set immediate %08x to r0 at %08x", immVal, compilerPC_); return; } @@ -577,7 +577,7 @@ bool ArmRegCache::IsImm(MIPSGPReg r) const { u32 ArmRegCache::GetImm(MIPSGPReg r) const { if (r == MIPS_REG_ZERO) return 0; if (mr[r].loc != ML_IMM && mr[r].loc != ML_ARMREG_IMM) { - ERROR_LOG_REPORT(JIT, "Trying to get imm from non-imm register %i", r); + ERROR_LOG_REPORT(Log::JIT, "Trying to get imm from non-imm register %i", r); } return mr[r].imm; } @@ -595,7 +595,7 @@ int ArmRegCache::GetMipsRegOffset(MIPSGPReg r) { case MIPS_REG_VFPUCC: return offsetof(MIPSState, vfpuCtrl[VFPU_CTRL_CC]); default: - ERROR_LOG_REPORT(JIT, "bad mips register %i", r); + ERROR_LOG_REPORT(Log::JIT, "bad mips register %i", r); return 0; // or what? } } @@ -621,7 +621,7 @@ ARMReg ArmRegCache::R(MIPSGPReg mipsReg) { if (mr[mipsReg].loc == ML_ARMREG || mr[mipsReg].loc == ML_ARMREG_IMM) { return (ARMReg)mr[mipsReg].reg; } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in arm reg. compilerPC = %08x", mipsReg, compilerPC_); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in arm reg. compilerPC = %08x", mipsReg, compilerPC_); return INVALID_REG; // BAAAD } } @@ -630,7 +630,7 @@ ARMReg ArmRegCache::RPtr(MIPSGPReg mipsReg) { if (mr[mipsReg].loc == ML_ARMREG_AS_PTR) { return (ARMReg)mr[mipsReg].reg; } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in arm reg as pointer. compilerPC = %08x", mipsReg, compilerPC_); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in arm reg as pointer. compilerPC = %08x", mipsReg, compilerPC_); return INVALID_REG; // BAAAD } } diff --git a/Core/MIPS/ARM/ArmRegCacheFPU.cpp b/Core/MIPS/ARM/ArmRegCacheFPU.cpp index c3df5301e1..c6d514ace0 100644 --- a/Core/MIPS/ARM/ArmRegCacheFPU.cpp +++ b/Core/MIPS/ARM/ArmRegCacheFPU.cpp @@ -113,9 +113,9 @@ bool ArmRegCacheFPU::IsMapped(MIPSReg r) { } ARMReg ArmRegCacheFPU::MapReg(MIPSReg mipsReg, int mapFlags) { - // INFO_LOG(JIT, "FPR MapReg: %i flags=%i", mipsReg, mapFlags); + // INFO_LOG(Log::JIT, "FPR MapReg: %i flags=%i", mipsReg, mapFlags); if (jo_->useNEONVFPU && mipsReg >= 32) { - ERROR_LOG(JIT, "Cannot map VFPU registers to ARM VFP registers in NEON mode. PC=%08x", js_->compilerPC); + ERROR_LOG(Log::JIT, "Cannot map VFPU registers to ARM VFP registers in NEON mode. PC=%08x", js_->compilerPC); return S0; } @@ -125,12 +125,12 @@ ARMReg ArmRegCacheFPU::MapReg(MIPSReg mipsReg, int mapFlags) { // with that flag immediately writes a "known" value to the register. if (mr[mipsReg].loc == ML_ARMREG) { if (ar[mr[mipsReg].reg].mipsReg != mipsReg) { - ERROR_LOG(JIT, "Reg mapping out of sync! MR %i", mipsReg); + ERROR_LOG(Log::JIT, "Reg mapping out of sync! MR %i", mipsReg); } if (mapFlags & MAP_DIRTY) { ar[mr[mipsReg].reg].isDirty = true; } - //INFO_LOG(JIT, "Already mapped %i to %i", mipsReg, mr[mipsReg].reg); + //INFO_LOG(Log::JIT, "Already mapped %i to %i", mipsReg, mr[mipsReg].reg); return (ARMReg)(mr[mipsReg].reg + S0); } @@ -154,7 +154,7 @@ allocate: ar[reg].mipsReg = mipsReg; mr[mipsReg].loc = ML_ARMREG; mr[mipsReg].reg = reg; - //INFO_LOG(JIT, "Mapped %i to %i", mipsReg, mr[mipsReg].reg); + //INFO_LOG(Log::JIT, "Mapped %i to %i", mipsReg, mr[mipsReg].reg); return (ARMReg)(reg + S0); } } @@ -178,7 +178,7 @@ allocate: } // Uh oh, we have all them spilllocked.... - ERROR_LOG(JIT, "Out of spillable registers at PC %08x!!!", js_->compilerPC); + ERROR_LOG(Log::JIT, "Out of spillable registers at PC %08x!!!", js_->compilerPC); return INVALID_REG; } @@ -293,14 +293,14 @@ void ArmRegCacheFPU::FlushArmReg(ARMReg r) { if (ar[reg].mipsReg != -1) { if (ar[reg].isDirty && mr[ar[reg].mipsReg].loc == ML_ARMREG) { - //INFO_LOG(JIT, "Flushing ARM reg %i", reg); + //INFO_LOG(Log::JIT, "Flushing ARM reg %i", reg); emit_->VSTR(r, CTXREG, GetMipsRegOffset(ar[reg].mipsReg)); } // IMMs won't be in an ARM reg. mr[ar[reg].mipsReg].loc = ML_MEM; mr[ar[reg].mipsReg].reg = INVALID_REG; } else { - ERROR_LOG(JIT, "Dirty but no mipsreg?"); + ERROR_LOG(Log::JIT, "Dirty but no mipsreg?"); } ar[reg].isDirty = false; ar[reg].mipsReg = -1; @@ -338,7 +338,7 @@ void ArmRegCacheFPU::FlushQWithV(MIPSReg r) { } if (flushCount > 1) { - WARN_LOG(JIT, "ERROR: More than one quad was flushed to flush reg %i", r); + WARN_LOG(Log::JIT, "ERROR: More than one quad was flushed to flush reg %i", r); } } */ @@ -348,12 +348,12 @@ void ArmRegCacheFPU::FlushR(MIPSReg r) { case ML_IMM: // IMM is always "dirty". // IMM is not allowed for FP (yet). - ERROR_LOG(JIT, "Imm in FP register?"); + ERROR_LOG(Log::JIT, "Imm in FP register?"); break; case ML_ARMREG: if (mr[r].reg == INVALID_REG) { - ERROR_LOG(JIT, "FlushR: MipsReg had bad ArmReg"); + ERROR_LOG(Log::JIT, "FlushR: MipsReg had bad ArmReg"); } if (mr[r].reg >= Q0 && mr[r].reg <= Q15) { @@ -361,13 +361,13 @@ void ArmRegCacheFPU::FlushR(MIPSReg r) { // mipsreg that's been part of a quad. int quad = mr[r].reg - Q0; if (qr[quad].isDirty) { - WARN_LOG(JIT, "FlushR found quad register %i - PC=%08x", quad, js_->compilerPC); + WARN_LOG(Log::JIT, "FlushR found quad register %i - PC=%08x", quad, js_->compilerPC); emit_->ADDI2R(R0, CTXREG, GetMipsRegOffset(r), R1); emit_->VST1_lane(F_32, (ARMReg)mr[r].reg, R0, mr[r].lane, true); } } else { if (ar[mr[r].reg].isDirty) { - //INFO_LOG(JIT, "Flushing dirty reg %i", mr[r].reg); + //INFO_LOG(Log::JIT, "Flushing dirty reg %i", mr[r].reg); emit_->VSTR((ARMReg)(mr[r].reg + S0), CTXREG, GetMipsRegOffset(r)); ar[mr[r].reg].isDirty = false; } @@ -438,13 +438,13 @@ void ArmRegCacheFPU::FlushAll() { if (ar[a].isDirty) { if (m == -1) { - INFO_LOG(JIT, "ARM reg %i is dirty but has no mipsreg", a); + INFO_LOG(Log::JIT, "ARM reg %i is dirty but has no mipsreg", a); continue; } int c = FlushGetSequential(a); if (c == 1) { - // INFO_LOG(JIT, "Got single register: %i (%i)", a, m); + // INFO_LOG(Log::JIT, "Got single register: %i (%i)", a, m); emit_->VSTR((ARMReg)(a + S0), CTXREG, GetMipsRegOffset(m)); } else if (c == 2) { // Probably not worth using VSTMIA for two. @@ -452,9 +452,9 @@ void ArmRegCacheFPU::FlushAll() { emit_->VSTR((ARMReg)(a + S0), CTXREG, offset); emit_->VSTR((ARMReg)(a + 1 + S0), CTXREG, offset + 4); } else { - // INFO_LOG(JIT, "Got sequence: %i at %i (%i)", c, a, m); + // INFO_LOG(Log::JIT, "Got sequence: %i at %i (%i)", c, a, m); emit_->ADDI2R(SCRATCHREG1, CTXREG, GetMipsRegOffset(m), SCRATCHREG2); - // INFO_LOG(JIT, "VSTMIA R0, %i, %i", a, c); + // INFO_LOG(Log::JIT, "VSTMIA R0, %i, %i", a, c); emit_->VSTMIA(SCRATCHREG1, false, (ARMReg)(S0 + a), c); } @@ -480,7 +480,7 @@ void ArmRegCacheFPU::FlushAll() { // Sanity check for (int i = 0; i < NUM_ARMFPUREG; i++) { if (ar[i].mipsReg != -1) { - ERROR_LOG(JIT, "Flush fail: ar[%i].mipsReg=%i", i, ar[i].mipsReg); + ERROR_LOG(Log::JIT, "Flush fail: ar[%i].mipsReg=%i", i, ar[i].mipsReg); } } pendingFlush = false; @@ -491,12 +491,12 @@ void ArmRegCacheFPU::DiscardR(MIPSReg r) { case ML_IMM: // IMM is always "dirty". // IMM is not allowed for FP (yet). - ERROR_LOG(JIT, "Imm in FP register?"); + ERROR_LOG(Log::JIT, "Imm in FP register?"); break; case ML_ARMREG: if (mr[r].reg == INVALID_REG) { - ERROR_LOG(JIT, "DiscardR: MipsReg had bad ArmReg"); + ERROR_LOG(Log::JIT, "DiscardR: MipsReg had bad ArmReg"); } else { // Note that we DO NOT write it back here. That's the whole point of Discard. ar[mr[r].reg].isDirty = false; @@ -524,7 +524,7 @@ bool ArmRegCacheFPU::IsTempX(ARMReg r) const { int ArmRegCacheFPU::GetTempR() { if (jo_->useNEONVFPU) { - ERROR_LOG(JIT, "VFP temps not allowed in NEON mode"); + ERROR_LOG(Log::JIT, "VFP temps not allowed in NEON mode"); return 0; } pendingFlush = true; @@ -535,7 +535,7 @@ int ArmRegCacheFPU::GetTempR() { } } - ERROR_LOG(CPU, "Out of temp regs! Might need to DiscardR() some"); + ERROR_LOG(Log::CPU, "Out of temp regs! Might need to DiscardR() some"); _assert_msg_(false, "Regcache ran out of temp regs, might need to DiscardR() some."); return -1; } @@ -543,7 +543,7 @@ int ArmRegCacheFPU::GetTempR() { int ArmRegCacheFPU::GetMipsRegOffset(MIPSReg r) { // These are offsets within the MIPSState structure. First there are the GPRS, then FPRS, then the "VFPURs", then the VFPU ctrls. if (r < 0 || r > 32 + 128 + NUM_TEMPS) { - ERROR_LOG(JIT, "bad mips register %i, out of range", r); + ERROR_LOG(Log::JIT, "bad mips register %i, out of range", r); return 0; // or what? } @@ -584,11 +584,11 @@ ARMReg ArmRegCacheFPU::R(int mipsReg) { return (ARMReg)(mr[mipsReg].reg + S0); } else { if (mipsReg < 32) { - ERROR_LOG(JIT, "FReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); + ERROR_LOG(Log::JIT, "FReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); } else if (mipsReg < 32 + 128) { - ERROR_LOG(JIT, "VReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 32, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); + ERROR_LOG(Log::JIT, "VReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 32, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); } else { - ERROR_LOG(JIT, "Tempreg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 128 - 32, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); + ERROR_LOG(Log::JIT, "Tempreg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 128 - 32, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); } return INVALID_REG; // BAAAD } @@ -607,18 +607,18 @@ bool MappableQ(int quad) { } void ArmRegCacheFPU::QLoad4x4(MIPSGPReg regPtr, int vquads[4]) { - ERROR_LOG(JIT, "QLoad4x4 not implemented"); + ERROR_LOG(Log::JIT, "QLoad4x4 not implemented"); // TODO } void ArmRegCacheFPU::QFlush(int quad) { if (!MappableQ(quad)) { - ERROR_LOG(JIT, "Cannot flush non-mappable quad %i", quad); + ERROR_LOG(Log::JIT, "Cannot flush non-mappable quad %i", quad); return; } if (qr[quad].isDirty && !qr[quad].isTemp) { - INFO_LOG(JIT, "Flushing Q%i (%s)", quad, GetVectorNotation(qr[quad].mipsVec, qr[quad].sz).c_str()); + INFO_LOG(Log::JIT, "Flushing Q%i (%s)", quad, GetVectorNotation(qr[quad].mipsVec, qr[quad].sz).c_str()); ARMReg q = QuadAsQ(quad); // Unlike reads, when writing to the register file we need to be careful to write the correct @@ -628,7 +628,7 @@ void ArmRegCacheFPU::QFlush(int quad) { case V_Single: emit_->ADDI2R(R0, CTXREG, GetMipsRegOffsetV(qr[quad].vregs[0]), R1); emit_->VST1_lane(F_32, q, R0, 0, true); - // WARN_LOG(JIT, "S: Falling back to individual flush: pc=%08x", js_->compilerPC); + // WARN_LOG(Log::JIT, "S: Falling back to individual flush: pc=%08x", js_->compilerPC); break; case V_Pair: if (Consecutive(qr[quad].vregs[0], qr[quad].vregs[1])) { @@ -636,7 +636,7 @@ void ArmRegCacheFPU::QFlush(int quad) { emit_->ADDI2R(R0, CTXREG, GetMipsRegOffsetV(qr[quad].vregs[0]), R1); emit_->VST1(F_32, q, R0, 1, ALIGN_NONE); // TODO: Allow ALIGN_64 when applicable } else { - // WARN_LOG(JIT, "P: Falling back to individual flush: pc=%08x", js_->compilerPC); + // WARN_LOG(Log::JIT, "P: Falling back to individual flush: pc=%08x", js_->compilerPC); emit_->ADDI2R(R0, CTXREG, GetMipsRegOffsetV(qr[quad].vregs[0]), R1); emit_->VST1_lane(F_32, q, R0, 0, true); emit_->ADDI2R(R0, CTXREG, GetMipsRegOffsetV(qr[quad].vregs[1]), R1); @@ -649,7 +649,7 @@ void ArmRegCacheFPU::QFlush(int quad) { emit_->VST1(F_32, QuadAsD(quad), R0, 1, ALIGN_NONE, REG_UPDATE); // TODO: Allow ALIGN_64 when applicable emit_->VST1_lane(F_32, q, R0, 2, true); } else { - // WARN_LOG(JIT, "T: Falling back to individual flush: pc=%08x", js_->compilerPC); + // WARN_LOG(Log::JIT, "T: Falling back to individual flush: pc=%08x", js_->compilerPC); emit_->ADDI2R(R0, CTXREG, GetMipsRegOffsetV(qr[quad].vregs[0]), R1); emit_->VST1_lane(F_32, q, R0, 0, true); emit_->ADDI2R(R0, CTXREG, GetMipsRegOffsetV(qr[quad].vregs[1]), R1); @@ -663,7 +663,7 @@ void ArmRegCacheFPU::QFlush(int quad) { emit_->ADDI2R(R0, CTXREG, GetMipsRegOffsetV(qr[quad].vregs[0]), R1); emit_->VST1(F_32, QuadAsD(quad), R0, 2, ALIGN_NONE); // TODO: Allow ALIGN_64 when applicable } else { - // WARN_LOG(JIT, "Q: Falling back to individual flush: pc=%08x", js_->compilerPC); + // WARN_LOG(Log::JIT, "Q: Falling back to individual flush: pc=%08x", js_->compilerPC); emit_->ADDI2R(R0, CTXREG, GetMipsRegOffsetV(qr[quad].vregs[0]), R1); emit_->VST1_lane(F_32, q, R0, 0, true); emit_->ADDI2R(R0, CTXREG, GetMipsRegOffsetV(qr[quad].vregs[1]), R1); @@ -675,7 +675,7 @@ void ArmRegCacheFPU::QFlush(int quad) { } break; default: - ERROR_LOG(JIT, "Unknown quad size %i", qr[quad].sz); + ERROR_LOG(Log::JIT, "Unknown quad size %i", qr[quad].sz); break; } @@ -685,7 +685,7 @@ void ArmRegCacheFPU::QFlush(int quad) { for (int i = 0; i < n; i++) { int vr = qr[quad].vregs[i]; if (vr < 0 || vr > 128) { - ERROR_LOG(JIT, "Bad vr %i", vr); + ERROR_LOG(Log::JIT, "Bad vr %i", vr); } FPURegMIPS &m = mr[32 + vr]; m.loc = ML_MEM; @@ -695,7 +695,7 @@ void ArmRegCacheFPU::QFlush(int quad) { } else { if (qr[quad].isTemp) { - WARN_LOG(JIT, "Not flushing quad %i; dirty = %i, isTemp = %i", quad, qr[quad].isDirty, qr[quad].isTemp); + WARN_LOG(Log::JIT, "Not flushing quad %i; dirty = %i, isTemp = %i", quad, qr[quad].isDirty, qr[quad].isTemp); } } @@ -715,7 +715,7 @@ int ArmRegCacheFPU::QGetFreeQuad(int start, int count, const char *reason) { // Don't steal temp quads! if (qr[q].mipsVec == (int)INVALID_REG && !qr[q].isTemp) { - // INFO_LOG(JIT, "Free quad: %i", q); + // INFO_LOG(Log::JIT, "Free quad: %i", q); // Oh yeah! Free quad! return q; } @@ -747,10 +747,10 @@ int ArmRegCacheFPU::QGetFreeQuad(int start, int count, const char *reason) { } if (bestQuad == -1) { - ERROR_LOG(JIT, "Failed finding a free quad. Things will now go haywire!"); + ERROR_LOG(Log::JIT, "Failed finding a free quad. Things will now go haywire!"); return -1; } else { - INFO_LOG(JIT, "No register found in %i and the next %i, kicked out #%i (%s)", start, count, bestQuad, reason ? reason : "no reason"); + INFO_LOG(Log::JIT, "No register found in %i and the next %i, kicked out #%i (%s)", start, count, bestQuad, reason ? reason : "no reason"); QFlush(bestQuad); return bestQuad; } @@ -759,7 +759,7 @@ int ArmRegCacheFPU::QGetFreeQuad(int start, int count, const char *reason) { ARMReg ArmRegCacheFPU::QAllocTemp(VectorSize sz) { int q = QGetFreeQuad(8, 16, "allocating temporary"); // Prefer high quads as temps if (q < 0) { - ERROR_LOG(JIT, "Failed to allocate temp quad"); + ERROR_LOG(Log::JIT, "Failed to allocate temp quad"); q = 0; } qr[q].spillLock = true; @@ -767,7 +767,7 @@ ARMReg ArmRegCacheFPU::QAllocTemp(VectorSize sz) { qr[q].sz = sz; qr[q].isDirty = false; // doesn't matter - INFO_LOG(JIT, "Allocated temp quad %i", q); + INFO_LOG(Log::JIT, "Allocated temp quad %i", q); if (sz == V_Single || sz == V_Pair) { return D_0(ARMReg(Q0 + q)); @@ -845,20 +845,20 @@ ARMReg ArmRegCacheFPU::QMapReg(int vreg, VectorSize sz, int flags) { // Check if completely there already. If so, set spill-lock, transfer dirty flag and exit. if (vreg == qr[q].mipsVec && sz == qr[q].sz) { if (i < count) { - INFO_LOG(JIT, "Quad already mapped: %i : %i (size %i)", q, vreg, sz); + INFO_LOG(Log::JIT, "Quad already mapped: %i : %i (size %i)", q, vreg, sz); qr[q].isDirty = qr[q].isDirty || (flags & MAP_DIRTY); qr[q].spillLock = true; // Sanity check vregs for (int i = 0; i < n; i++) { if (vregs[i] != qr[q].vregs[i]) { - ERROR_LOG(JIT, "Sanity check failed: %i vs %i", vregs[i], qr[q].vregs[i]); + ERROR_LOG(Log::JIT, "Sanity check failed: %i vs %i", vregs[i], qr[q].vregs[i]); } } return (ARMReg)(Q0 + q); } else { - INFO_LOG(JIT, "Quad already mapped at %i which is out of requested range [%i-%i) (count = %i), needs moving. For now we flush.", q, start, start+count, count); + INFO_LOG(Log::JIT, "Quad already mapped at %i which is out of requested range [%i-%i) (count = %i), needs moving. For now we flush.", q, start, start+count, count); quadsToFlush.push_back(q); continue; } @@ -881,7 +881,7 @@ ARMReg ArmRegCacheFPU::QMapReg(int vreg, VectorSize sz, int flags) { // We didn't find the extra register, but we got a list of regs to flush. Flush 'em. // Here we can check for opportunities to do a "transpose-flush" of row vectors, etc. if (!quadsToFlush.empty()) { - INFO_LOG(JIT, "New mapping %s collided with %d quads, flushing them.", GetVectorNotation(vreg, sz).c_str(), (int)quadsToFlush.size()); + INFO_LOG(Log::JIT, "New mapping %s collided with %d quads, flushing them.", GetVectorNotation(vreg, sz).c_str(), (int)quadsToFlush.size()); } for (size_t i = 0; i < quadsToFlush.size(); i++) { QFlush(quadsToFlush[i]); @@ -973,7 +973,7 @@ ARMReg ArmRegCacheFPU::QMapReg(int vreg, VectorSize sz, int flags) { qr[quad].isDirty = (flags & MAP_DIRTY) != 0; qr[quad].spillLock = true; - INFO_LOG(JIT, "Mapped Q%i to vfpu %i (%s), sz=%i, dirty=%i", quad, vreg, GetVectorNotation(vreg, sz).c_str(), (int)sz, qr[quad].isDirty); + INFO_LOG(Log::JIT, "Mapped Q%i to vfpu %i (%s), sz=%i, dirty=%i", quad, vreg, GetVectorNotation(vreg, sz).c_str(), (int)sz, qr[quad].isDirty); if (sz == V_Single || sz == V_Pair) { return D_0(QuadAsQ(quad)); } else { diff --git a/Core/MIPS/ARM64/Arm64Asm.cpp b/Core/MIPS/ARM64/Arm64Asm.cpp index 5a0b12ce65..727f26a7cf 100644 --- a/Core/MIPS/ARM64/Arm64Asm.cpp +++ b/Core/MIPS/ARM64/Arm64Asm.cpp @@ -77,9 +77,9 @@ extern volatile CoreState coreState; void ShowPC(u32 downcount, void *membase, void *jitbase) { static int count = 0; if (currentMIPS) { - ERROR_LOG(JIT, "ShowPC : %08x Downcount : %08x %d %p %p", currentMIPS->pc, downcount, count, membase, jitbase); + ERROR_LOG(Log::JIT, "ShowPC : %08x Downcount : %08x %d %p %p", currentMIPS->pc, downcount, count, membase, jitbase); } else { - ERROR_LOG(JIT, "Universe corrupt?"); + ERROR_LOG(Log::JIT, "Universe corrupt?"); } //if (count > 2000) // exit(0); @@ -314,7 +314,7 @@ void Arm64Jit::GenerateFixedCode(const JitOptions &jo) { if (enableDisasm) { std::vector lines = DisassembleArm64(start, (int)(GetCodePtr() - start)); for (auto s : lines) { - INFO_LOG(JIT, "%s", s.c_str()); + INFO_LOG(Log::JIT, "%s", s.c_str()); } } diff --git a/Core/MIPS/ARM64/Arm64CompBranch.cpp b/Core/MIPS/ARM64/Arm64CompBranch.cpp index 26713ecce2..be030c8eba 100644 --- a/Core/MIPS/ARM64/Arm64CompBranch.cpp +++ b/Core/MIPS/ARM64/Arm64CompBranch.cpp @@ -68,7 +68,7 @@ namespace MIPSComp void Arm64Jit::BranchRSRTComp(MIPSOpcode op, CCFlags cc, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in RSRTComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in RSRTComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -212,7 +212,7 @@ void Arm64Jit::BranchRSRTComp(MIPSOpcode op, CCFlags cc, bool likely) void Arm64Jit::BranchRSZeroComp(MIPSOpcode op, CCFlags cc, bool andLink, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in RSZeroComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in RSZeroComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -371,7 +371,7 @@ void Arm64Jit::Comp_RelBranchRI(MIPSOpcode op) // If likely is set, discard the branch slot if NOT taken. void Arm64Jit::BranchFPFlag(MIPSOpcode op, CCFlags cc, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in FPFlag delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in FPFlag delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -441,7 +441,7 @@ void Arm64Jit::Comp_FPUBranch(MIPSOpcode op) { // If likely is set, discard the branch slot if NOT taken. void Arm64Jit::BranchVFPUFlag(MIPSOpcode op, CCFlags cc, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in VFPU delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in VFPU delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -518,7 +518,7 @@ static void HitInvalidJump(uint32_t dest) { void Arm64Jit::Comp_Jump(MIPSOpcode op) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in Jump delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in Jump delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } u32 off = TARGET26; @@ -527,7 +527,7 @@ void Arm64Jit::Comp_Jump(MIPSOpcode op) { // Might be a stubbed address or something? if (!Memory::IsValidAddress(targetAddr) || (targetAddr & 3) != 0) { if (js.nextExit == 0) { - ERROR_LOG_REPORT(JIT, "Jump to invalid address: %08x", targetAddr); + ERROR_LOG_REPORT(Log::JIT, "Jump to invalid address: %08x", targetAddr); } else { js.compiling = false; } @@ -585,7 +585,7 @@ void Arm64Jit::Comp_Jump(MIPSOpcode op) { void Arm64Jit::Comp_JumpReg(MIPSOpcode op) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in JumpReg delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in JumpReg delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } MIPSGPReg rs = _RS; @@ -667,7 +667,7 @@ void Arm64Jit::Comp_JumpReg(MIPSOpcode op) void Arm64Jit::Comp_Syscall(MIPSOpcode op) { if (op.encoding == 0x03FFFFcc) { - WARN_LOG(JIT, "Encountered bad syscall instruction at %08x (%08x)", js.compilerPC, op.encoding); + WARN_LOG(Log::JIT, "Encountered bad syscall instruction at %08x (%08x)", js.compilerPC, op.encoding); } if (!g_Config.bSkipDeadbeefFilling) { diff --git a/Core/MIPS/ARM64/Arm64CompVFPU.cpp b/Core/MIPS/ARM64/Arm64CompVFPU.cpp index 0d84f2851d..d722deb0f6 100644 --- a/Core/MIPS/ARM64/Arm64CompVFPU.cpp +++ b/Core/MIPS/ARM64/Arm64CompVFPU.cpp @@ -99,7 +99,7 @@ namespace MIPSComp { js.prefixDFlag = JitState::PREFIX_KNOWN_DIRTY; break; default: - ERROR_LOG(CPU, "VPFX - bad regnum %i : data=%08x", regnum, data); + ERROR_LOG(Log::CPU, "VPFX - bad regnum %i : data=%08x", regnum, data); break; } } @@ -134,7 +134,7 @@ namespace MIPSComp { // Prefix may say "z, z, z, z" but if this is a pair, we force to x. // TODO: But some ops seem to use const 0 instead? if (regnum >= n) { - WARN_LOG(CPU, "JIT: Invalid VFPU swizzle: %08x : %d / %d at PC = %08x (%s)", prefix, regnum, n, GetCompilerPC(), MIPSDisasmAt(GetCompilerPC()).c_str()); + WARN_LOG(Log::CPU, "JIT: Invalid VFPU swizzle: %08x : %d / %d at PC = %08x (%s)", prefix, regnum, n, GetCompilerPC(), MIPSDisasmAt(GetCompilerPC()).c_str()); regnum = 0; } @@ -882,7 +882,7 @@ namespace MIPSComp { fp.FDIV(fpr.V(tempregs[i]), S0, fpr.V(sregs[i])); break; default: - ERROR_LOG(JIT, "case missing in vfpu vv2op"); + ERROR_LOG(Log::JIT, "case missing in vfpu vv2op"); DISABLE; break; } @@ -1033,7 +1033,7 @@ namespace MIPSComp { } } else { //ERROR - maybe need to make this value too an "interlock" value? - ERROR_LOG(CPU, "mfv - invalid register %i", imm); + ERROR_LOG(Log::CPU, "mfv - invalid register %i", imm); } } break; @@ -1916,7 +1916,7 @@ namespace MIPSComp { break; } default: - ERROR_LOG(JIT, "Bad what in vrot"); + ERROR_LOG(Log::JIT, "Bad what in vrot"); break; } } @@ -1947,7 +1947,7 @@ namespace MIPSComp { // Pair of vrot. Let's join them. vd2 = MIPS_GET_VD(nextOp); imm2 = (nextOp >> 16) & 0x1f; - // NOTICE_LOG(JIT, "Joint VFPU at %08x", js.blockStart); + // NOTICE_LOG(Log::JIT, "Joint VFPU at %08x", js.blockStart); } u8 sreg; GetVectorRegs(dregs, sz, vd); diff --git a/Core/MIPS/ARM64/Arm64IRAsm.cpp b/Core/MIPS/ARM64/Arm64IRAsm.cpp index d623c6cd58..7783045b08 100644 --- a/Core/MIPS/ARM64/Arm64IRAsm.cpp +++ b/Core/MIPS/ARM64/Arm64IRAsm.cpp @@ -40,9 +40,9 @@ static void ShowPC(void *membase, void *jitbase) { static int count = 0; if (currentMIPS) { u32 downcount = currentMIPS->downcount; - ERROR_LOG(JIT, "[%08x] ShowPC Downcount : %08x %d %p %p", currentMIPS->pc, downcount, count, membase, jitbase); + ERROR_LOG(Log::JIT, "[%08x] ShowPC Downcount : %08x %d %p %p", currentMIPS->pc, downcount, count, membase, jitbase); } else { - ERROR_LOG(JIT, "Universe corrupt?"); + ERROR_LOG(Log::JIT, "Universe corrupt?"); } //if (count > 2000) // exit(0); @@ -269,7 +269,7 @@ void Arm64JitBackend::GenerateFixedCode(MIPSState *mipsState) { if (enableDisasm) { std::vector lines = DisassembleArm64(disasmStart, (int)(GetCodePtr() - disasmStart)); for (auto s : lines) { - INFO_LOG(JIT, "%s", s.c_str()); + INFO_LOG(Log::JIT, "%s", s.c_str()); } } diff --git a/Core/MIPS/ARM64/Arm64IRJit.cpp b/Core/MIPS/ARM64/Arm64IRJit.cpp index 420f7443ca..7462e5b406 100644 --- a/Core/MIPS/ARM64/Arm64IRJit.cpp +++ b/Core/MIPS/ARM64/Arm64IRJit.cpp @@ -157,7 +157,7 @@ bool Arm64JitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bo for (int i = 0; i < (int)addresses.size(); ++i) addressesLookup[addresses[i]] = i; - INFO_LOG(JIT, "=============== ARM64 (%08x, %d bytes) ===============", startPC, len); + INFO_LOG(Log::JIT, "=============== ARM64 (%08x, %d bytes) ===============", startPC, len); const IRInst *instructions = irBlockCache->GetBlockInstructionPtr(*block); for (const u8 *p = blockStart; p < GetCodePointer(); ) { auto it = addressesLookup.find(p); @@ -166,7 +166,7 @@ bool Arm64JitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bo char temp[512]; DisassembleIR(temp, sizeof(temp), inst); - INFO_LOG(JIT, "IR: #%d %s", it->second, temp); + INFO_LOG(Log::JIT, "IR: #%d %s", it->second, temp); } auto next = std::next(it); @@ -174,7 +174,7 @@ bool Arm64JitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bo auto lines = DisassembleArm64(p, (int)(nextp - p)); for (const auto &line : lines) - INFO_LOG(JIT, " A: %s", line.c_str()); + INFO_LOG(Log::JIT, " A: %s", line.c_str()); p = nextp; } } diff --git a/Core/MIPS/ARM64/Arm64IRRegCache.cpp b/Core/MIPS/ARM64/Arm64IRRegCache.cpp index 84564877a7..41281be57d 100644 --- a/Core/MIPS/ARM64/Arm64IRRegCache.cpp +++ b/Core/MIPS/ARM64/Arm64IRRegCache.cpp @@ -814,7 +814,7 @@ ARM64Reg Arm64IRRegCache::R(IRReg mipsReg) { if (mr[mipsReg].loc == MIPSLoc::REG || mr[mipsReg].loc == MIPSLoc::REG_IMM) { return FromNativeReg(mr[mipsReg].nReg); } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in arm64 reg", mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in arm64 reg", mipsReg); return INVALID_REG; // BAAAD } } @@ -834,11 +834,11 @@ ARM64Reg Arm64IRRegCache::RPtr(IRReg mipsReg) { if (nr[r].pointerified) { return FromNativeReg64(mr[mipsReg].nReg); } else { - ERROR_LOG(JIT, "Tried to use a non-pointer register as a pointer"); + ERROR_LOG(Log::JIT, "Tried to use a non-pointer register as a pointer"); return INVALID_REG; } } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in arm64 reg", mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in arm64 reg", mipsReg); return INVALID_REG; // BAAAD } } @@ -849,7 +849,7 @@ ARM64Reg Arm64IRRegCache::F(IRReg mipsReg) { if (mr[mipsReg + 32].loc == MIPSLoc::FREG) { return FromNativeReg(mr[mipsReg + 32].nReg); } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in arm64 reg", mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in arm64 reg", mipsReg); return INVALID_REG; // BAAAD } } diff --git a/Core/MIPS/ARM64/Arm64Jit.cpp b/Core/MIPS/ARM64/Arm64Jit.cpp index a82b791d13..92d481b6d3 100644 --- a/Core/MIPS/ARM64/Arm64Jit.cpp +++ b/Core/MIPS/ARM64/Arm64Jit.cpp @@ -51,17 +51,17 @@ using namespace Arm64JitConstants; static void DisassembleArm64Print(const u8 *data, int size) { std::vector lines = DisassembleArm64(data, size); for (auto s : lines) { - INFO_LOG(JIT, "%s", s.c_str()); + INFO_LOG(Log::JIT, "%s", s.c_str()); } /* - INFO_LOG(JIT, "+++"); + INFO_LOG(Log::JIT, "+++"); // A format friendly to Online Disassembler which gets endianness wrong for (size_t i = 0; i < lines.size(); i++) { uint32_t opcode = ((const uint32_t *)data)[i]; - INFO_LOG(JIT, "%d/%d: %08x", (int)(i+1), (int)lines.size(), swap32(opcode)); + INFO_LOG(Log::JIT, "%d/%d: %08x", (int)(i+1), (int)lines.size(), swap32(opcode)); } - INFO_LOG(JIT, "==="); - INFO_LOG(JIT, "===");*/ + INFO_LOG(Log::JIT, "==="); + INFO_LOG(Log::JIT, "===");*/ } static u32 JitBreakpoint(uint32_t addr) { @@ -131,7 +131,7 @@ void Arm64Jit::DoState(PointerWrap &p) { Do(p, js.startDefaultPrefix); if (p.mode == PointerWrap::MODE_READ && !js.startDefaultPrefix) { - WARN_LOG(CPU, "Jit: An uneaten prefix was previously detected. Jitting in unknown-prefix mode."); + WARN_LOG(Log::CPU, "Jit: An uneaten prefix was previously detected. Jitting in unknown-prefix mode."); } if (s >= 2) { Do(p, js.hasSetRounding); @@ -192,7 +192,7 @@ void Arm64Jit::FlushPrefixV() { } void Arm64Jit::ClearCache() { - INFO_LOG(JIT, "ARM64Jit: Clearing the cache!"); + INFO_LOG(Log::JIT, "ARM64Jit: Clearing the cache!"); blocks.Clear(); ClearCodeSpace(jitStartOffset); FlushIcacheSection(region + jitStartOffset, region + region_size - jitStartOffset); @@ -207,10 +207,10 @@ void Arm64Jit::InvalidateCacheAt(u32 em_address, int length) { void Arm64Jit::EatInstruction(MIPSOpcode op) { MIPSInfo info = MIPSGetInfo(op); if (info & DELAYSLOT) { - ERROR_LOG_REPORT_ONCE(ateDelaySlot, JIT, "Ate a branch op."); + ERROR_LOG_REPORT_ONCE(ateDelaySlot, Log::JIT, "Ate a branch op."); } if (js.inDelaySlot) { - ERROR_LOG_REPORT_ONCE(ateInDelaySlot, JIT, "Ate an instruction inside a delay slot."); + ERROR_LOG_REPORT_ONCE(ateInDelaySlot, Log::JIT, "Ate an instruction inside a delay slot."); } CheckJitBreakpoint(GetCompilerPC() + 4, 0); @@ -244,7 +244,7 @@ void Arm64Jit::CompileDelaySlot(int flags) { void Arm64Jit::Compile(u32 em_address) { PROFILE_THIS_SCOPE("jitc"); if (GetSpaceLeft() < 0x10000 || blocks.IsFull()) { - INFO_LOG(JIT, "Space left: %d", (int)GetSpaceLeft()); + INFO_LOG(Log::JIT, "Space left: %d", (int)GetSpaceLeft()); ClearCache(); } @@ -263,7 +263,7 @@ void Arm64Jit::Compile(u32 em_address) { bool cleanSlate = false; if (js.hasSetRounding && !js.lastSetRounding) { - WARN_LOG(JIT, "Detected rounding mode usage, rebuilding jit with checks"); + WARN_LOG(Log::JIT, "Detected rounding mode usage, rebuilding jit with checks"); // Won't loop, since hasSetRounding is only ever set to 1. js.lastSetRounding = js.hasSetRounding; cleanSlate = true; @@ -271,7 +271,7 @@ void Arm64Jit::Compile(u32 em_address) { // Drat. The VFPU hit an uneaten prefix at the end of a block. if (js.startDefaultPrefix && js.MayHavePrefix()) { - WARN_LOG_REPORT(JIT, "An uneaten prefix at end of block: %08x", GetCompilerPC() - 4); + WARN_LOG_REPORT(Log::JIT, "An uneaten prefix at end of block: %08x", GetCompilerPC() - 4); js.LogPrefix(); // Let's try that one more time. We won't get back here because we toggled the value. @@ -387,16 +387,16 @@ const u8 *Arm64Jit::DoJit(u32 em_address, JitBlock *b) { char temp[256]; if (logBlocks > 0 && dontLogBlocks == 0) { - INFO_LOG(JIT, "=============== mips %d ===============", blocks.GetNumBlocks()); + INFO_LOG(Log::JIT, "=============== mips %d ===============", blocks.GetNumBlocks()); for (u32 cpc = em_address; cpc != GetCompilerPC() + 4; cpc += 4) { MIPSDisAsm(Memory::Read_Opcode_JIT(cpc), cpc, temp, sizeof(temp), true); - INFO_LOG(JIT, "M: %08x %s", cpc, temp); + INFO_LOG(Log::JIT, "M: %08x %s", cpc, temp); } } b->codeSize = GetCodePtr() - b->normalEntry; if (logBlocks > 0 && dontLogBlocks == 0) { - INFO_LOG(JIT, "=============== ARM (%d instructions -> %d bytes) ===============", js.numInstructions, b->codeSize); + INFO_LOG(Log::JIT, "=============== ARM (%d instructions -> %d bytes) ===============", js.numInstructions, b->codeSize); DisassembleArm64Print(b->normalEntry, GetCodePtr() - b->normalEntry); } if (logBlocks > 0) @@ -470,7 +470,7 @@ bool Arm64Jit::DescribeCodePtr(const u8 *ptr, std::string &name) { void Arm64Jit::Comp_RunBlock(MIPSOpcode op) { // This shouldn't be necessary, the dispatcher should catch us before we get here. - ERROR_LOG(JIT, "Comp_RunBlock should never be reached!"); + ERROR_LOG(Log::JIT, "Comp_RunBlock should never be reached!"); } void Arm64Jit::LinkBlock(u8 *exitPoint, const u8 *checkedEntry) { @@ -562,7 +562,7 @@ void Arm64Jit::Comp_ReplacementFunc(MIPSOpcode op) const ReplacementTableEntry *entry = GetReplacementFunc(index); if (!entry) { - ERROR_LOG_REPORT_ONCE(replFunc, HLE, "Invalid replacement op %08x at %08x", op.encoding, js.compilerPC); + ERROR_LOG_REPORT_ONCE(replFunc, Log::HLE, "Invalid replacement op %08x at %08x", op.encoding, js.compilerPC); // TODO: What should we do here? We're way off in the weeds probably. return; } @@ -631,7 +631,7 @@ void Arm64Jit::Comp_ReplacementFunc(MIPSOpcode op) js.compiling = false; } } else { - ERROR_LOG(HLE, "Replacement function %s has neither jit nor regular impl", entry->name); + ERROR_LOG(Log::HLE, "Replacement function %s has neither jit nor regular impl", entry->name); } } diff --git a/Core/MIPS/ARM64/Arm64RegCache.cpp b/Core/MIPS/ARM64/Arm64RegCache.cpp index 7dc2ba1ddf..0dc7f8c999 100644 --- a/Core/MIPS/ARM64/Arm64RegCache.cpp +++ b/Core/MIPS/ARM64/Arm64RegCache.cpp @@ -150,7 +150,7 @@ bool Arm64RegCache::IsMappedAsPointer(MIPSGPReg mipsReg) { return ar[mr[mipsReg].reg].pointerified; } else if (mr[mipsReg].loc == ML_ARMREG_IMM) { if (ar[mr[mipsReg].reg].pointerified) { - ERROR_LOG(JIT, "Really shouldn't be pointerified here"); + ERROR_LOG(Log::JIT, "Really shouldn't be pointerified here"); } } else if (mr[mipsReg].loc == ML_ARMREG_AS_PTR) { return true; @@ -164,7 +164,7 @@ void Arm64RegCache::MarkDirty(ARM64Reg reg) { void Arm64RegCache::SetRegImm(ARM64Reg reg, u64 imm) { if (reg == INVALID_REG) { - ERROR_LOG(JIT, "SetRegImm to invalid register: at %08x", js_->compilerPC); + ERROR_LOG(Log::JIT, "SetRegImm to invalid register: at %08x", js_->compilerPC); return; } // On ARM64, at least Cortex A57, good old MOVT/MOVW (MOVK in 64-bit) is really fast. @@ -174,7 +174,7 @@ void Arm64RegCache::SetRegImm(ARM64Reg reg, u64 imm) { void Arm64RegCache::MapRegTo(ARM64Reg reg, MIPSGPReg mipsReg, int mapFlags) { if (mr[mipsReg].isStatic) { - ERROR_LOG(JIT, "Cannot MapRegTo static register %d", mipsReg); + ERROR_LOG(Log::JIT, "Cannot MapRegTo static register %d", mipsReg); return; } ar[reg].isDirty = (mapFlags & MAP_DIRTY) ? true : false; @@ -193,7 +193,7 @@ void Arm64RegCache::MapRegTo(ARM64Reg reg, MIPSGPReg mipsReg, int mapFlags) { { int offset = GetMipsRegOffset(mipsReg); ARM64Reg loadReg = reg; - // INFO_LOG(JIT, "MapRegTo %d mips: %d offset %d", (int)reg, mipsReg, offset); + // INFO_LOG(Log::JIT, "MapRegTo %d mips: %d offset %d", (int)reg, mipsReg, offset); if (mipsReg == MIPS_REG_LO) { loadReg = EncodeRegTo64(loadReg); } @@ -261,7 +261,7 @@ allocate: } // Uh oh, we have all of them spilllocked.... - ERROR_LOG_REPORT(JIT, "Out of spillable registers at PC %08x!!!", mips_->pc); + ERROR_LOG_REPORT(Log::JIT, "Out of spillable registers at PC %08x!!!", mips_->pc); return INVALID_REG; } @@ -340,12 +340,12 @@ ARM64Reg Arm64RegCache::GetAndLockTempR() { // round robin or FIFO or something. ARM64Reg Arm64RegCache::MapReg(MIPSGPReg mipsReg, int mapFlags) { if (mipsReg == MIPS_REG_HI) { - ERROR_LOG_REPORT(JIT, "Cannot map HI in Arm64RegCache"); + ERROR_LOG_REPORT(Log::JIT, "Cannot map HI in Arm64RegCache"); return INVALID_REG; } if (mipsReg == MIPS_REG_INVALID) { - ERROR_LOG(JIT, "Cannot map invalid register"); + ERROR_LOG(Log::JIT, "Cannot map invalid register"); return INVALID_REG; } @@ -353,7 +353,7 @@ ARM64Reg Arm64RegCache::MapReg(MIPSGPReg mipsReg, int mapFlags) { if (mr[mipsReg].isStatic) { if (armReg == INVALID_REG) { - ERROR_LOG(JIT, "MapReg on statically mapped reg %d failed - armReg got lost", mipsReg); + ERROR_LOG(Log::JIT, "MapReg on statically mapped reg %d failed - armReg got lost", mipsReg); } if (mr[mipsReg].loc == ML_IMM) { // Back into the register, with or without the imm value. @@ -386,7 +386,7 @@ ARM64Reg Arm64RegCache::MapReg(MIPSGPReg mipsReg, int mapFlags) { // with that flag immediately writes a "known" value to the register. if (mr[mipsReg].loc == ML_ARMREG || mr[mipsReg].loc == ML_ARMREG_IMM) { if (ar[armReg].mipsReg != mipsReg) { - ERROR_LOG_REPORT(JIT, "Register mapping out of sync! %i", mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Register mapping out of sync! %i", mipsReg); } if (mapFlags & MAP_DIRTY) { // Mapping dirty means the old imm value is invalid. @@ -450,7 +450,7 @@ Arm64Gen::ARM64Reg Arm64RegCache::MapRegAsPointer(MIPSGPReg reg) { ar[a].pointerified = true; } } else { - ERROR_LOG(JIT, "MapRegAsPointer : MapReg failed to allocate a register?"); + ERROR_LOG(Log::JIT, "MapRegAsPointer : MapReg failed to allocate a register?"); } return retval; } @@ -506,18 +506,18 @@ void Arm64RegCache::MapDirtyDirtyInIn(MIPSGPReg rd1, MIPSGPReg rd2, MIPSGPReg rs void Arm64RegCache::FlushArmReg(ARM64Reg r) { if (r == INVALID_REG) { - ERROR_LOG(JIT, "FlushArmReg called on invalid register %d", r); + ERROR_LOG(Log::JIT, "FlushArmReg called on invalid register %d", r); return; } if (ar[r].mipsReg == MIPS_REG_INVALID) { // Nothing to do, reg not mapped. if (ar[r].isDirty) { - ERROR_LOG_REPORT(JIT, "Dirty but no mipsreg?"); + ERROR_LOG_REPORT(Log::JIT, "Dirty but no mipsreg?"); } return; } if (mr[ar[r].mipsReg].isStatic) { - ERROR_LOG(JIT, "Cannot FlushArmReg a statically mapped register"); + ERROR_LOG(Log::JIT, "Cannot FlushArmReg a statically mapped register"); return; } auto &mreg = mr[ar[r].mipsReg]; @@ -603,7 +603,7 @@ ARM64Reg Arm64RegCache::ARM64RegForFlush(MIPSGPReg r) { case ML_ARMREG: case ML_ARMREG_IMM: if (mr[r].reg == INVALID_REG) { - ERROR_LOG_REPORT(JIT, "ARM64RegForFlush: MipsReg %d had bad ArmReg", r); + ERROR_LOG_REPORT(Log::JIT, "ARM64RegForFlush: MipsReg %d had bad ArmReg", r); return INVALID_REG; } // No need to flush if it's zero or not dirty. @@ -622,14 +622,14 @@ ARM64Reg Arm64RegCache::ARM64RegForFlush(MIPSGPReg r) { return INVALID_REG; default: - ERROR_LOG_REPORT(JIT, "ARM64RegForFlush: MipsReg %d with invalid location %d", r, mr[r].loc); + ERROR_LOG_REPORT(Log::JIT, "ARM64RegForFlush: MipsReg %d with invalid location %d", r, mr[r].loc); return INVALID_REG; } } void Arm64RegCache::FlushR(MIPSGPReg r) { if (mr[r].isStatic) { - ERROR_LOG(JIT, "Cannot flush static reg %d", r); + ERROR_LOG(Log::JIT, "Cannot flush static reg %d", r); return; } @@ -683,7 +683,7 @@ void Arm64RegCache::FlushR(MIPSGPReg r) { break; default: - ERROR_LOG_REPORT(JIT, "FlushR: MipsReg %d with invalid location %d", r, mr[r].loc); + ERROR_LOG_REPORT(Log::JIT, "FlushR: MipsReg %d with invalid location %d", r, mr[r].loc); break; } if (r == MIPS_REG_ZERO) { @@ -753,7 +753,7 @@ void Arm64RegCache::FlushAll() { } else if (mr[i].loc == ML_ARMREG_IMM) { // The register already contains the immediate. if (ar[armReg].pointerified) { - ERROR_LOG(JIT, "ML_ARMREG_IMM but pointerified. Wrong."); + ERROR_LOG(Log::JIT, "ML_ARMREG_IMM but pointerified. Wrong."); ar[armReg].pointerified = false; } mr[i].loc = ML_ARMREG; @@ -762,7 +762,7 @@ void Arm64RegCache::FlushAll() { mr[i].loc = ML_ARMREG; } if (i != MIPS_REG_ZERO && mr[i].reg == INVALID_REG) { - ERROR_LOG(JIT, "ARM reg of static %i is invalid", i); + ERROR_LOG(Log::JIT, "ARM reg of static %i is invalid", i); continue; } } else { @@ -785,18 +785,18 @@ void Arm64RegCache::FlushAll() { // Sanity check for (int i = 0; i < NUM_ARMREG; i++) { if (ar[i].mipsReg != MIPS_REG_INVALID && mr[ar[i].mipsReg].isStatic == false) { - ERROR_LOG_REPORT(JIT, "Flush fail: ar[%i].mipsReg=%i", i, ar[i].mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Flush fail: ar[%i].mipsReg=%i", i, ar[i].mipsReg); } } } void Arm64RegCache::SetImm(MIPSGPReg r, u64 immVal) { if (r == MIPS_REG_HI) { - ERROR_LOG_REPORT(JIT, "Cannot set HI imm in Arm64RegCache"); + ERROR_LOG_REPORT(Log::JIT, "Cannot set HI imm in Arm64RegCache"); return; } if (r == MIPS_REG_ZERO && immVal != 0) { - ERROR_LOG_REPORT(JIT, "Trying to set immediate %08x to r0 at %08x", (u32)immVal, compilerPC_); + ERROR_LOG_REPORT(Log::JIT, "Trying to set immediate %08x to r0 at %08x", (u32)immVal, compilerPC_); return; } @@ -846,7 +846,7 @@ u64 Arm64RegCache::GetImm(MIPSGPReg r) const { if (r == MIPS_REG_ZERO) return 0; if (mr[r].loc != ML_IMM && mr[r].loc != ML_ARMREG_IMM) { - ERROR_LOG_REPORT(JIT, "Trying to get imm from non-imm register %i", r); + ERROR_LOG_REPORT(Log::JIT, "Trying to get imm from non-imm register %i", r); } return mr[r].imm; } @@ -864,7 +864,7 @@ int Arm64RegCache::GetMipsRegOffset(MIPSGPReg r) { case MIPS_REG_VFPUCC: return offsetof(MIPSState, vfpuCtrl[VFPU_CTRL_CC]); default: - ERROR_LOG_REPORT(JIT, "bad mips register %i", r); + ERROR_LOG_REPORT(Log::JIT, "bad mips register %i", r); return 0; // or what? } } @@ -901,7 +901,7 @@ ARM64Reg Arm64RegCache::R(MIPSGPReg mipsReg) { if (mr[mipsReg].loc == ML_ARMREG || mr[mipsReg].loc == ML_ARMREG_IMM) { return mr[mipsReg].reg; } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in arm reg. compilerPC = %08x", mipsReg, compilerPC_); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in arm reg. compilerPC = %08x", mipsReg, compilerPC_); return INVALID_REG; // BAAAD } } @@ -914,11 +914,11 @@ ARM64Reg Arm64RegCache::RPtr(MIPSGPReg mipsReg) { if (ar[a].pointerified) { return (ARM64Reg)mr[mipsReg].reg; } else { - ERROR_LOG(JIT, "Tried to use a non-pointer register as a pointer"); + ERROR_LOG(Log::JIT, "Tried to use a non-pointer register as a pointer"); return INVALID_REG; } } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in arm reg. compilerPC = %08x", mipsReg, compilerPC_); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in arm reg. compilerPC = %08x", mipsReg, compilerPC_); return INVALID_REG; // BAAAD } } diff --git a/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp b/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp index 6771713652..4b0fd4d502 100644 --- a/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp +++ b/Core/MIPS/ARM64/Arm64RegCacheFPU.cpp @@ -110,9 +110,9 @@ bool Arm64RegCacheFPU::IsInRAM(MIPSReg r) { } ARM64Reg Arm64RegCacheFPU::MapReg(MIPSReg mipsReg, int mapFlags) { - // INFO_LOG(JIT, "FPR MapReg: %i flags=%i", mipsReg, mapFlags); + // INFO_LOG(Log::JIT, "FPR MapReg: %i flags=%i", mipsReg, mapFlags); if (jo_->useASIMDVFPU && mipsReg >= 32) { - ERROR_LOG(JIT, "Cannot map VFPU registers to ARM VFP registers in NEON mode. PC=%08x", js_->compilerPC); + ERROR_LOG(Log::JIT, "Cannot map VFPU registers to ARM VFP registers in NEON mode. PC=%08x", js_->compilerPC); return S0; } @@ -122,12 +122,12 @@ ARM64Reg Arm64RegCacheFPU::MapReg(MIPSReg mipsReg, int mapFlags) { // with that flag immediately writes a "known" value to the register. if (mr[mipsReg].loc == ML_ARMREG) { if (ar[mr[mipsReg].reg].mipsReg != mipsReg) { - ERROR_LOG(JIT, "Reg mapping out of sync! MR %i", mipsReg); + ERROR_LOG(Log::JIT, "Reg mapping out of sync! MR %i", mipsReg); } if (mapFlags & MAP_DIRTY) { ar[mr[mipsReg].reg].isDirty = true; } - //INFO_LOG(JIT, "Already mapped %i to %i", mipsReg, mr[mipsReg].reg); + //INFO_LOG(Log::JIT, "Already mapped %i to %i", mipsReg, mr[mipsReg].reg); return (ARM64Reg)(mr[mipsReg].reg + S0); } @@ -151,7 +151,7 @@ allocate: ar[reg].mipsReg = mipsReg; mr[mipsReg].loc = ML_ARMREG; mr[mipsReg].reg = reg; - //INFO_LOG(JIT, "Mapped %i to %i", mipsReg, mr[mipsReg].reg); + //INFO_LOG(Log::JIT, "Mapped %i to %i", mipsReg, mr[mipsReg].reg); return (ARM64Reg)(reg + S0); } } @@ -175,7 +175,7 @@ allocate: } // Uh oh, we have all them spilllocked.... - ERROR_LOG(JIT, "Out of spillable registers at PC %08x!!!", js_->compilerPC); + ERROR_LOG(Log::JIT, "Out of spillable registers at PC %08x!!!", js_->compilerPC); return INVALID_REG; } @@ -289,14 +289,14 @@ void Arm64RegCacheFPU::FlushArmReg(ARM64Reg r) { } if (ar[reg].mipsReg != -1) { if (ar[reg].isDirty && mr[ar[reg].mipsReg].loc == ML_ARMREG){ - //INFO_LOG(JIT, "Flushing ARM reg %i", reg); + //INFO_LOG(Log::JIT, "Flushing ARM reg %i", reg); fp_->STR(32, INDEX_UNSIGNED, r, CTXREG, GetMipsRegOffset(ar[reg].mipsReg)); } // IMMs won't be in an ARM reg. mr[ar[reg].mipsReg].loc = ML_MEM; mr[ar[reg].mipsReg].reg = INVALID_REG; } else { - ERROR_LOG(JIT, "Dirty but no mipsreg?"); + ERROR_LOG(Log::JIT, "Dirty but no mipsreg?"); } ar[reg].mipsReg = -1; ar[reg].isDirty = false; @@ -312,12 +312,12 @@ void Arm64RegCacheFPU::FlushR(MIPSReg r) { case ML_IMM: // IMM is always "dirty". // IMM is not allowed for FP (yet). - ERROR_LOG(JIT, "Imm in FP register?"); + ERROR_LOG(Log::JIT, "Imm in FP register?"); break; case ML_ARMREG: if (mr[r].reg == INVALID_REG) { - ERROR_LOG(JIT, "FlushR: MipsReg had bad ArmReg"); + ERROR_LOG(Log::JIT, "FlushR: MipsReg had bad ArmReg"); } FlushArmReg((ARM64Reg)(S0 + mr[r].reg)); break; @@ -337,12 +337,12 @@ Arm64Gen::ARM64Reg Arm64RegCacheFPU::ARM64RegForFlush(int r) { case ML_IMM: // IMM is always "dirty". // IMM is not allowed for FP (yet). - ERROR_LOG(JIT, "Imm in FP register?"); + ERROR_LOG(Log::JIT, "Imm in FP register?"); return INVALID_REG; case ML_ARMREG: if (mr[r].reg == INVALID_REG) { - ERROR_LOG_REPORT(JIT, "ARM64RegForFlush: MipsReg %d had bad ArmReg", r); + ERROR_LOG_REPORT(Log::JIT, "ARM64RegForFlush: MipsReg %d had bad ArmReg", r); return INVALID_REG; } // No need to flush if it's not dirty. @@ -355,7 +355,7 @@ Arm64Gen::ARM64Reg Arm64RegCacheFPU::ARM64RegForFlush(int r) { return INVALID_REG; default: - ERROR_LOG_REPORT(JIT, "ARM64RegForFlush: MipsReg %d with invalid location %d", r, mr[r].loc); + ERROR_LOG_REPORT(Log::JIT, "ARM64RegForFlush: MipsReg %d with invalid location %d", r, mr[r].loc); return INVALID_REG; } } @@ -399,7 +399,7 @@ void Arm64RegCacheFPU::FlushAll() { if (ar[a].isDirty) { if (m == -1) { - INFO_LOG(JIT, "ARM reg %d is dirty but has no mipsreg", a); + INFO_LOG(Log::JIT, "ARM reg %d is dirty but has no mipsreg", a); continue; } @@ -422,7 +422,7 @@ void Arm64RegCacheFPU::FlushAll() { // Sanity check for (int i = 0; i < numARMFpuReg_; i++) { if (ar[i].mipsReg != -1) { - ERROR_LOG(JIT, "Flush fail: ar[%d].mipsReg=%d", i, ar[i].mipsReg); + ERROR_LOG(Log::JIT, "Flush fail: ar[%d].mipsReg=%d", i, ar[i].mipsReg); } } pendingFlush = false; @@ -433,12 +433,12 @@ void Arm64RegCacheFPU::DiscardR(MIPSReg r) { case ML_IMM: // IMM is always "dirty". // IMM is not allowed for FP (yet). - ERROR_LOG(JIT, "Imm in FP register?"); + ERROR_LOG(Log::JIT, "Imm in FP register?"); break; case ML_ARMREG: if (mr[r].reg == INVALID_REG) { - ERROR_LOG(JIT, "DiscardR: MipsReg had bad ArmReg"); + ERROR_LOG(Log::JIT, "DiscardR: MipsReg had bad ArmReg"); } else { // Note that we DO NOT write it back here. That's the whole point of Discard. ar[mr[r].reg].isDirty = false; @@ -466,7 +466,7 @@ bool Arm64RegCacheFPU::IsTempX(ARM64Reg r) const { int Arm64RegCacheFPU::GetTempR() { if (jo_->useASIMDVFPU) { - ERROR_LOG(JIT, "VFP temps not allowed in NEON mode"); + ERROR_LOG(Log::JIT, "VFP temps not allowed in NEON mode"); return 0; } pendingFlush = true; @@ -477,7 +477,7 @@ int Arm64RegCacheFPU::GetTempR() { } } - ERROR_LOG(CPU, "Out of temp regs! Might need to DiscardR() some"); + ERROR_LOG(Log::CPU, "Out of temp regs! Might need to DiscardR() some"); _assert_msg_(false, "Regcache ran out of temp regs, might need to DiscardR() some."); return -1; } @@ -485,7 +485,7 @@ int Arm64RegCacheFPU::GetTempR() { int Arm64RegCacheFPU::GetMipsRegOffset(MIPSReg r) { // These are offsets within the MIPSState structure. First there are the GPRS, then FPRS, then the "VFPURs", then the VFPU ctrls. if (r < 0 || r > 32 + 128 + NUM_TEMPS) { - ERROR_LOG(JIT, "bad mips register %i, out of range", r); + ERROR_LOG(Log::JIT, "bad mips register %i, out of range", r); return 0; // or what? } @@ -519,11 +519,11 @@ ARM64Reg Arm64RegCacheFPU::R(int mipsReg) { return (ARM64Reg)(mr[mipsReg].reg + S0); } else { if (mipsReg < 32) { - ERROR_LOG(JIT, "FReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); + ERROR_LOG(Log::JIT, "FReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); } else if (mipsReg < 32 + 128) { - ERROR_LOG(JIT, "VReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 32, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); + ERROR_LOG(Log::JIT, "VReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 32, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); } else { - ERROR_LOG(JIT, "Tempreg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 128 - 32, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); + ERROR_LOG(Log::JIT, "Tempreg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 128 - 32, js_->compilerPC, MIPSDisasmAt(js_->compilerPC).c_str()); } return INVALID_REG; // BAAAD } diff --git a/Core/MIPS/IR/IRCompBranch.cpp b/Core/MIPS/IR/IRCompBranch.cpp index 49f0f7d5eb..b43d9d2f9f 100644 --- a/Core/MIPS/IR/IRCompBranch.cpp +++ b/Core/MIPS/IR/IRCompBranch.cpp @@ -56,7 +56,7 @@ namespace MIPSComp void IRFrontend::BranchRSRTComp(MIPSOpcode op, IRComparison cc, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in RSRTComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in RSRTComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -123,7 +123,7 @@ void IRFrontend::BranchRSRTComp(MIPSOpcode op, IRComparison cc, bool likely) { void IRFrontend::BranchRSZeroComp(MIPSOpcode op, IRComparison cc, bool andLink, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in RSZeroComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in RSZeroComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -212,7 +212,7 @@ void IRFrontend::Comp_RelBranchRI(MIPSOpcode op) { // If likely is set, discard the branch slot if NOT taken. void IRFrontend::BranchFPFlag(MIPSOpcode op, IRComparison cc, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in FPFlag delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in FPFlag delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -266,7 +266,7 @@ void IRFrontend::Comp_FPUBranch(MIPSOpcode op) { // If likely is set, discard the branch slot if NOT taken. void IRFrontend::BranchVFPUFlag(MIPSOpcode op, IRComparison cc, bool likely) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in VFPU delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in VFPU delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -324,7 +324,7 @@ void IRFrontend::Comp_VBranch(MIPSOpcode op) { void IRFrontend::Comp_Jump(MIPSOpcode op) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in Jump delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in Jump delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } @@ -337,7 +337,7 @@ void IRFrontend::Comp_Jump(MIPSOpcode op) { if (js.preloading) js.cancel = true; else - ERROR_LOG_REPORT(JIT, "Jump to invalid address: %08x", targetAddr); + ERROR_LOG_REPORT(Log::JIT, "Jump to invalid address: %08x", targetAddr); // TODO: Mark this block dirty or something? May be indication it will be changed by imports. // Continue so the block gets completed and crashes properly. } @@ -371,7 +371,7 @@ void IRFrontend::Comp_Jump(MIPSOpcode op) { void IRFrontend::Comp_JumpReg(MIPSOpcode op) { if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in JumpReg delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in JumpReg delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } MIPSGPReg rs = _RS; diff --git a/Core/MIPS/IR/IRCompVFPU.cpp b/Core/MIPS/IR/IRCompVFPU.cpp index 84b57047f4..5507d6f041 100644 --- a/Core/MIPS/IR/IRCompVFPU.cpp +++ b/Core/MIPS/IR/IRCompVFPU.cpp @@ -177,7 +177,7 @@ namespace MIPSComp { js.prefixDFlag = JitState::PREFIX_KNOWN_DIRTY; break; default: - ERROR_LOG(CPU, "VPFX - bad regnum %i : data=%08x", regnum, data); + ERROR_LOG(Log::CPU, "VPFX - bad regnum %i : data=%08x", regnum, data); break; } } diff --git a/Core/MIPS/IR/IRFrontend.cpp b/Core/MIPS/IR/IRFrontend.cpp index f299ba9cae..024609bf70 100644 --- a/Core/MIPS/IR/IRFrontend.cpp +++ b/Core/MIPS/IR/IRFrontend.cpp @@ -94,10 +94,10 @@ void IRFrontend::FlushPrefixV() { void IRFrontend::EatInstruction(MIPSOpcode op) { MIPSInfo info = MIPSGetInfo(op); if (info & DELAYSLOT) { - ERROR_LOG_REPORT_ONCE(ateDelaySlot, JIT, "Ate a branch op."); + ERROR_LOG_REPORT_ONCE(ateDelaySlot, Log::JIT, "Ate a branch op."); } if (js.inDelaySlot) { - ERROR_LOG_REPORT_ONCE(ateInDelaySlot, JIT, "Ate an instruction inside a delay slot."); + ERROR_LOG_REPORT_ONCE(ateInDelaySlot, Log::JIT, "Ate an instruction inside a delay slot."); } CheckBreakpoint(GetCompilerPC() + 4); @@ -117,7 +117,7 @@ void IRFrontend::CompileDelaySlot() { bool IRFrontend::CheckRounding(u32 blockAddress) { bool cleanSlate = false; if (js.hasSetRounding && !js.lastSetRounding) { - WARN_LOG(JIT, "Detected rounding mode usage, rebuilding jit with checks"); + WARN_LOG(Log::JIT, "Detected rounding mode usage, rebuilding jit with checks"); // Won't loop, since hasSetRounding is only ever set to 1. js.lastSetRounding = js.hasSetRounding; cleanSlate = true; @@ -125,7 +125,7 @@ bool IRFrontend::CheckRounding(u32 blockAddress) { // Drat. The VFPU hit an uneaten prefix at the end of a block. if (js.startDefaultPrefix && js.MayHavePrefix()) { - WARN_LOG_REPORT(JIT, "An uneaten prefix at end of block for %08x", blockAddress); + WARN_LOG_REPORT(Log::JIT, "An uneaten prefix at end of block for %08x", blockAddress); logBlocks = 1; js.LogPrefix(); @@ -141,7 +141,7 @@ void IRFrontend::Comp_ReplacementFunc(MIPSOpcode op) { const ReplacementTableEntry *entry = GetReplacementFunc(index); if (!entry) { - ERROR_LOG(HLE, "Invalid replacement op %08x", op.encoding); + ERROR_LOG(Log::HLE, "Invalid replacement op %08x", op.encoding); return; } @@ -178,7 +178,7 @@ void IRFrontend::Comp_ReplacementFunc(MIPSOpcode op) { js.compiling = false; } } else { - ERROR_LOG(HLE, "Replacement function %s has neither jit nor regular impl", entry->name); + ERROR_LOG(Log::HLE, "Replacement function %s has neither jit nor regular impl", entry->name); } } @@ -303,32 +303,32 @@ void IRFrontend::DoJit(u32 em_address, std::vector &instructions, u32 &m if (logBlocks > 0 && dontLogBlocks == 0) { char temp2[256]; - NOTICE_LOG(JIT, "=============== mips %08x ===============", em_address); + NOTICE_LOG(Log::JIT, "=============== mips %08x ===============", em_address); for (u32 cpc = em_address; cpc != GetCompilerPC(); cpc += 4) { temp2[0] = 0; MIPSDisAsm(Memory::Read_Opcode_JIT(cpc), cpc, temp2, sizeof(temp2), true); - NOTICE_LOG(JIT, "M: %08x %s", cpc, temp2); + NOTICE_LOG(Log::JIT, "M: %08x %s", cpc, temp2); } } if (logBlocks > 0 && dontLogBlocks == 0) { - NOTICE_LOG(JIT, "=============== Original IR (%d instructions) ===============", (int)ir.GetInstructions().size()); + NOTICE_LOG(Log::JIT, "=============== Original IR (%d instructions) ===============", (int)ir.GetInstructions().size()); for (size_t i = 0; i < ir.GetInstructions().size(); i++) { char buf[256]; DisassembleIR(buf, sizeof(buf), ir.GetInstructions()[i]); - NOTICE_LOG(JIT, "%s", buf); + NOTICE_LOG(Log::JIT, "%s", buf); } - NOTICE_LOG(JIT, "=============== end ================="); + NOTICE_LOG(Log::JIT, "=============== end ================="); } if (logBlocks > 0 && dontLogBlocks == 0) { - NOTICE_LOG(JIT, "=============== IR (%d instructions) ===============", (int)code->GetInstructions().size()); + NOTICE_LOG(Log::JIT, "=============== IR (%d instructions) ===============", (int)code->GetInstructions().size()); for (size_t i = 0; i < code->GetInstructions().size(); i++) { char buf[256]; DisassembleIR(buf, sizeof(buf), code->GetInstructions()[i]); - NOTICE_LOG(JIT, "%s", buf); + NOTICE_LOG(Log::JIT, "%s", buf); } - NOTICE_LOG(JIT, "=============== end ================="); + NOTICE_LOG(Log::JIT, "=============== end ================="); } if (logBlocks > 0) @@ -339,7 +339,7 @@ void IRFrontend::DoJit(u32 em_address, std::vector &instructions, u32 &m void IRFrontend::Comp_RunBlock(MIPSOpcode op) { // This shouldn't be necessary, the dispatcher should catch us before we get here. - ERROR_LOG(JIT, "Comp_RunBlock should never be reached!"); + ERROR_LOG(Log::JIT, "Comp_RunBlock should never be reached!"); } void IRFrontend::CheckBreakpoint(u32 addr) { diff --git a/Core/MIPS/IR/IRJit.cpp b/Core/MIPS/IR/IRJit.cpp index 5be8607bfd..444e558288 100644 --- a/Core/MIPS/IR/IRJit.cpp +++ b/Core/MIPS/IR/IRJit.cpp @@ -83,7 +83,7 @@ void IRJit::UpdateFCR31() { } void IRJit::ClearCache() { - INFO_LOG(JIT, "IRJit: Clearing the cache!"); + INFO_LOG(Log::JIT, "IRJit: Clearing the cache!"); blocks_.Clear(); } @@ -119,7 +119,7 @@ void IRJit::Compile(u32 em_address) { u32 mipsBytes; if (!CompileBlock(em_address, instructions, mipsBytes, false)) { // Ran out of block numbers - need to reset. - ERROR_LOG(JIT, "Ran out of block numbers, clearing cache"); + ERROR_LOG(Log::JIT, "Ran out of block numbers, clearing cache"); ClearCache(); CompileBlock(em_address, instructions, mipsBytes, false); } @@ -141,7 +141,7 @@ bool IRJit::CompileBlock(u32 em_address, std::vector &instructions, u32 int block_num = blocks_.AllocateBlock(em_address, mipsBytes, instructions); if ((block_num & ~MIPS_EMUHACK_VALUE_MASK) != 0) { - WARN_LOG(JIT, "Failed to allocate block for %08x (%d instructions)", em_address, (int)instructions.size()); + WARN_LOG(Log::JIT, "Failed to allocate block for %08x (%d instructions)", em_address, (int)instructions.size()); // Out of block numbers. Caller will handle. return false; } @@ -188,7 +188,7 @@ void IRJit::CompileFunction(u32 start_address, u32 length) { if (!CompileBlock(em_address, instructions, mipsBytes, true)) { // Ran out of block numbers - let's hope there's no more code it needs to run. // Will flush when actually compiling. - ERROR_LOG(JIT, "Ran out of block numbers while compiling function"); + ERROR_LOG(Log::JIT, "Ran out of block numbers while compiling function"); return; } @@ -322,7 +322,7 @@ int IRBlockCache::AllocateBlock(int emAddr, u32 origSize, const std::vector= MAX_ARENA_SIZE) { - WARN_LOG(JIT, "Filled JIT arena, restarting"); + WARN_LOG(Log::JIT, "Filled JIT arena, restarting"); return -1; } for (int i = 0; i < inst.size(); i++) { @@ -466,7 +466,7 @@ std::vector IRBlockCache::SaveAndClearEmuHackOps() { void IRBlockCache::RestoreSavedEmuHackOps(const std::vector &saved) { if ((int)blocks_.size() != (int)saved.size()) { - ERROR_LOG(JIT, "RestoreSavedEmuHackOps: Wrong saved block size."); + ERROR_LOG(Log::JIT, "RestoreSavedEmuHackOps: Wrong saved block size."); return; } diff --git a/Core/MIPS/IR/IRNativeCommon.cpp b/Core/MIPS/IR/IRNativeCommon.cpp index ccccc152b7..b96f6d83bc 100644 --- a/Core/MIPS/IR/IRNativeCommon.cpp +++ b/Core/MIPS/IR/IRNativeCommon.cpp @@ -116,15 +116,15 @@ static void LogDebugStats() { debugSeenPCUsage.clear(); if (worstIROp != -1) - WARN_LOG(JIT, "Most not compiled IR op: %s (%d)", GetIRMeta((IROp)worstIROp)->name, worstIRVal); + WARN_LOG(Log::JIT, "Most not compiled IR op: %s (%d)", GetIRMeta((IROp)worstIROp)->name, worstIRVal); if (worstName != nullptr) - WARN_LOG(JIT, "Most not compiled op: %s (%d)", worstName, worstVal); + WARN_LOG(Log::JIT, "Most not compiled op: %s (%d)", worstName, worstVal); if (slowestPCs.counts[0] != 0) { for (int i = 0; i < 4; ++i) { uint32_t pc = slowestPCs.values[i].first; const char *status = IRProfilerStatusToString(slowestPCs.values[i].second); const std::string label = g_symbolMap ? g_symbolMap->GetDescription(pc) : ""; - WARN_LOG(JIT, "Slowest sampled PC #%d: %08x (%s)/%s (%f%%)", i, pc, label.c_str(), status, 100.0 * (double)slowestPCs.counts[i] / (double)totalCount); + WARN_LOG(Log::JIT, "Slowest sampled PC #%d: %08x (%s)/%s (%f%%)", i, pc, label.c_str(), status, 100.0 * (double)slowestPCs.counts[i] / (double)totalCount); } } } diff --git a/Core/MIPS/IR/IRPassSimplify.cpp b/Core/MIPS/IR/IRPassSimplify.cpp index f9a3294fad..08455eee01 100644 --- a/Core/MIPS/IR/IRPassSimplify.cpp +++ b/Core/MIPS/IR/IRPassSimplify.cpp @@ -2167,7 +2167,7 @@ bool ReduceVec4Flush(const IRWriter &in, IRWriter &out, const IROptions &opts) { downgrade = true; if (downgrade) { - //WARN_LOG(JIT, "Vec4 downgrade by: %s", m->name); + //WARN_LOG(Log::JIT, "Vec4 downgrade by: %s", m->name); } if (!skip) diff --git a/Core/MIPS/IR/IRRegCache.cpp b/Core/MIPS/IR/IRRegCache.cpp index adc2939303..e2cb9ac6eb 100644 --- a/Core/MIPS/IR/IRRegCache.cpp +++ b/Core/MIPS/IR/IRRegCache.cpp @@ -238,7 +238,7 @@ uint64_t IRNativeRegCacheBase::GetGPR2Imm(IRReg base) { void IRNativeRegCacheBase::SetGPRImm(IRReg gpr, uint32_t immVal) { _dbg_assert_(IsValidGPR(gpr)); if (gpr == MIPS_REG_ZERO && immVal != 0) { - ERROR_LOG_REPORT(JIT, "Trying to set immediate %08x to r0", immVal); + ERROR_LOG_REPORT(Log::JIT, "Trying to set immediate %08x to r0", immVal); return; } @@ -387,7 +387,7 @@ IRNativeReg IRNativeRegCacheBase::AllocateReg(MIPSLoc type, MIPSMap flags) { } // Uh oh, we have all of them spilllocked.... - ERROR_LOG_REPORT(JIT, "Out of spillable registers in block PC %08x, index %d", irBlock_->GetOriginalStart(), irIndex_); + ERROR_LOG_REPORT(Log::JIT, "Out of spillable registers in block PC %08x, index %d", irBlock_->GetOriginalStart(), irIndex_); _assert_(bestToSpill != -1); return -1; } @@ -586,7 +586,7 @@ void IRNativeRegCacheBase::FlushNativeReg(IRNativeReg nreg) { } _dbg_assert_(!mr[nr[nreg].mipsReg].isStatic); if (mr[nr[nreg].mipsReg].isStatic) { - ERROR_LOG(JIT, "Cannot FlushNativeReg a statically mapped register"); + ERROR_LOG(Log::JIT, "Cannot FlushNativeReg a statically mapped register"); return; } @@ -708,7 +708,7 @@ void IRNativeRegCacheBase::FlushAll(bool gprs, bool fprs) { } else if (mr[i].loc == MIPSLoc::REG_IMM) { // The register already contains the immediate. if (nr[nreg].pointerified) { - ERROR_LOG(JIT, "RVREG_IMM but pointerified. Wrong."); + ERROR_LOG(Log::JIT, "RVREG_IMM but pointerified. Wrong."); nr[nreg].pointerified = false; } mr[i].loc = MIPSLoc::REG; @@ -746,7 +746,7 @@ void IRNativeRegCacheBase::FlushAll(bool gprs, bool fprs) { // Sanity check for (int i = 0; i < config_.totalNativeRegs; i++) { if (nr[i].mipsReg != IRREG_INVALID && !mr[nr[i].mipsReg].isStatic) { - ERROR_LOG_REPORT(JIT, "Flush fail: nr[%i].mipsReg=%i", i, nr[i].mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Flush fail: nr[%i].mipsReg=%i", i, nr[i].mipsReg); } } } @@ -1217,7 +1217,7 @@ IRNativeReg IRNativeRegCacheBase::MapNativeRegAsPointer(IRReg gpr) { nr[nreg].pointerified = true; } } else { - ERROR_LOG(JIT, "MapNativeRegAsPointer: MapNativeReg failed to allocate a register?"); + ERROR_LOG(Log::JIT, "MapNativeRegAsPointer: MapNativeReg failed to allocate a register?"); } return nreg; } diff --git a/Core/MIPS/JitCommon/JitBlockCache.cpp b/Core/MIPS/JitCommon/JitBlockCache.cpp index cf1838951b..7c04a1436a 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.cpp +++ b/Core/MIPS/JitCommon/JitBlockCache.cpp @@ -181,7 +181,7 @@ void JitBlockCache::ProxyBlock(u32 rootAddress, u32 startAddress, u32 size, cons // instead of creating a new block. int num = GetBlockNumberFromStartAddress(startAddress, false); if (num != -1) { - DEBUG_LOG(HLE, "Adding proxy root %08x to block at %08x", rootAddress, startAddress); + DEBUG_LOG(Log::HLE, "Adding proxy root %08x to block at %08x", rootAddress, startAddress); if (!blocks_[num].proxyFor) { blocks_[num].proxyFor = new std::vector(); } @@ -334,7 +334,7 @@ int JitBlockCache::GetBlockNumberFromEmuHackOp(MIPSOpcode inst, bool ignoreBad) const u8 *baseoff = codeBlock_->GetBasePtr() + off; if (baseoff < codeBlock_->GetBasePtr() || baseoff >= codeBlock_->GetCodePtr()) { if (!ignoreBad) { - ERROR_LOG(JIT, "JitBlockCache: Invalid Emuhack Op %08x", inst.encoding); + ERROR_LOG(Log::JIT, "JitBlockCache: Invalid Emuhack Op %08x", inst.encoding); } return -1; } @@ -451,7 +451,7 @@ void JitBlockCache::LinkBlock(int i) { if (ppp.first == ppp.second) return; for (auto iter = ppp.first; iter != ppp.second; ++iter) { - // INFO_LOG(JIT, "Linking block %i to block %i", iter->second, i); + // INFO_LOG(Log::JIT, "Linking block %i to block %i", iter->second, i); LinkBlockExits(iter->second); } } @@ -464,7 +464,7 @@ void JitBlockCache::UnlinkBlock(int i) { for (auto iter = ppp.first; iter != ppp.second; ++iter) { if ((size_t)iter->second >= num_blocks_) { // Something probably went very wrong. Try to stumble along nevertheless. - ERROR_LOG(JIT, "UnlinkBlock: Invalid block number %d", iter->second); + ERROR_LOG(Log::JIT, "UnlinkBlock: Invalid block number %d", iter->second); continue; } JitBlock &sourceBlock = blocks_[iter->second]; @@ -499,7 +499,7 @@ std::vector JitBlockCache::SaveAndClearEmuHackOps() { void JitBlockCache::RestoreSavedEmuHackOps(const std::vector &saved) { if (num_blocks_ != (int)saved.size()) { - ERROR_LOG(JIT, "RestoreSavedEmuHackOps: Wrong saved block size."); + ERROR_LOG(Log::JIT, "RestoreSavedEmuHackOps: Wrong saved block size."); return; } @@ -516,7 +516,7 @@ void JitBlockCache::RestoreSavedEmuHackOps(const std::vector &saved) { void JitBlockCache::DestroyBlock(int block_num, DestroyType type) { if (block_num < 0 || block_num >= num_blocks_) { - ERROR_LOG_REPORT(JIT, "DestroyBlock: Invalid block number %d", block_num); + ERROR_LOG_REPORT(Log::JIT, "DestroyBlock: Invalid block number %d", block_num); return; } JitBlock *b = &blocks_[block_num]; @@ -554,7 +554,7 @@ void JitBlockCache::DestroyBlock(int block_num, DestroyType type) { if (b->invalid) { if (type == DestroyType::INVALIDATE) - ERROR_LOG(JIT, "Invalidating invalid block %d", block_num); + ERROR_LOG(Log::JIT, "Invalidating invalid block %d", block_num); return; } @@ -581,7 +581,7 @@ void JitBlockCache::DestroyBlock(int block_num, DestroyType type) { MIPSComp::jit->UnlinkBlock(writableEntry, b->originalAddress); } } else { - ERROR_LOG(JIT, "Unlinking block with no entry: %08x (%d)", b->originalAddress, block_num); + ERROR_LOG(Log::JIT, "Unlinking block with no entry: %08x (%d)", b->originalAddress, block_num); } } @@ -591,7 +591,7 @@ void JitBlockCache::InvalidateICache(u32 address, const u32 length) { const u32 pEnd = pAddr + length; if (pEnd < pAddr) { - ERROR_LOG(JIT, "Bad InvalidateICache: %08x with len=%d", address, length); + ERROR_LOG(Log::JIT, "Bad InvalidateICache: %08x with len=%d", address, length); return; } @@ -637,7 +637,7 @@ void JitBlockCache::InvalidateChangedBlocks() { } if (changed) { - DEBUG_LOG(JIT, "Invalidating changed block at %08x", b.originalAddress); + DEBUG_LOG(Log::JIT, "Invalidating changed block at %08x", b.originalAddress); DestroyBlock(block_num, DestroyType::INVALIDATE); } } diff --git a/Core/MIPS/JitCommon/JitCommon.cpp b/Core/MIPS/JitCommon/JitCommon.cpp index 752cb67b7f..1708bf1ea6 100644 --- a/Core/MIPS/JitCommon/JitCommon.cpp +++ b/Core/MIPS/JitCommon/JitCommon.cpp @@ -96,9 +96,9 @@ namespace MIPSComp { // For a branch (not a jump), it actually should try the delay slot and take its target potentially. // This is similar to the VFPU case and has not been seen, so just report it. if (!isJump && SignExtend16ToU32(branchInfo.delaySlotOp) != SignExtend16ToU32(branchInfo.op) - 1) - ERROR_LOG_REPORT(JIT, "Branch in branch delay slot at %08x with different target", branchInfo.compilerPC); + ERROR_LOG_REPORT(Log::JIT, "Branch in branch delay slot at %08x with different target", branchInfo.compilerPC); if (isJump && branchInfo.likely && (branchInfo.delaySlotInfo & (OUT_RA | OUT_RD)) != 0) - ERROR_LOG_REPORT(JIT, "Jump in likely branch delay slot with link at %08x", branchInfo.compilerPC); + ERROR_LOG_REPORT(Log::JIT, "Jump in likely branch delay slot with link at %08x", branchInfo.compilerPC); } return notTakenTarget; } diff --git a/Core/MIPS/JitCommon/JitState.h b/Core/MIPS/JitCommon/JitState.h index 6f5b9f2628..ef90409e36 100644 --- a/Core/MIPS/JitCommon/JitState.h +++ b/Core/MIPS/JitCommon/JitState.h @@ -162,20 +162,20 @@ namespace MIPSComp { private: void LogSTPrefix(const char *name, int p, int pflag) { if ((prefixSFlag & PREFIX_KNOWN) == 0) { - ERROR_LOG(JIT, "%s: unknown (%08x %i)", name, p, pflag); + ERROR_LOG(Log::JIT, "%s: unknown (%08x %i)", name, p, pflag); } else if (prefixS != 0xE4) { - ERROR_LOG(JIT, "%s: %08x flag: %i", name, p, pflag); + ERROR_LOG(Log::JIT, "%s: %08x flag: %i", name, p, pflag); } else { - WARN_LOG(JIT, "%s: %08x flag: %i", name, p, pflag); + WARN_LOG(Log::JIT, "%s: %08x flag: %i", name, p, pflag); } } void LogDPrefix() { if ((prefixDFlag & PREFIX_KNOWN) == 0) { - ERROR_LOG(JIT, "D: unknown (%08x %i)", prefixD, prefixDFlag); + ERROR_LOG(Log::JIT, "D: unknown (%08x %i)", prefixD, prefixDFlag); } else if (prefixD != 0) { - ERROR_LOG(JIT, "D: (%08x %i)", prefixD, prefixDFlag); + ERROR_LOG(Log::JIT, "D: (%08x %i)", prefixD, prefixDFlag); } else { - WARN_LOG(JIT, "D: %08x flag: %i", prefixD, prefixDFlag); + WARN_LOG(Log::JIT, "D: %08x flag: %i", prefixD, prefixDFlag); } } }; diff --git a/Core/MIPS/MIPS.cpp b/Core/MIPS/MIPS.cpp index e9137f2054..aef97fb98c 100644 --- a/Core/MIPS/MIPS.cpp +++ b/Core/MIPS/MIPS.cpp @@ -154,7 +154,7 @@ MIPSState::MIPSState() { for (int i = 0; i < (int)ARRAY_SIZE(firstThirtyTwo); i++) { if (voffset[firstThirtyTwo[i]] != i) { - ERROR_LOG(CPU, "Wrong voffset order! %i: %i should have been %i", firstThirtyTwo[i], voffset[firstThirtyTwo[i]], i); + ERROR_LOG(Log::CPU, "Wrong voffset order! %i: %i should have been %i", firstThirtyTwo[i], voffset[firstThirtyTwo[i]], i); } } } @@ -236,7 +236,7 @@ void MIPSState::UpdateCore(CPUCore desired) { switch (PSP_CoreParameter().cpuCore) { case CPUCore::JIT: case CPUCore::JIT_IR: - INFO_LOG(CPU, "Switching to JIT%s", PSP_CoreParameter().cpuCore == CPUCore::JIT_IR ? " IR" : ""); + INFO_LOG(Log::CPU, "Switching to JIT%s", PSP_CoreParameter().cpuCore == CPUCore::JIT_IR ? " IR" : ""); if (oldjit) { std::lock_guard guard(MIPSComp::jitLock); MIPSComp::jit = nullptr; @@ -246,7 +246,7 @@ void MIPSState::UpdateCore(CPUCore desired) { break; case CPUCore::IR_INTERPRETER: - INFO_LOG(CPU, "Switching to IR interpreter"); + INFO_LOG(Log::CPU, "Switching to IR interpreter"); if (oldjit) { std::lock_guard guard(MIPSComp::jitLock); MIPSComp::jit = nullptr; @@ -256,7 +256,7 @@ void MIPSState::UpdateCore(CPUCore desired) { break; case CPUCore::INTERPRETER: - INFO_LOG(CPU, "Switching to interpreter"); + INFO_LOG(Log::CPU, "Switching to interpreter"); if (oldjit) { std::lock_guard guard(MIPSComp::jitLock); MIPSComp::jit = nullptr; diff --git a/Core/MIPS/MIPS/MipsJit.cpp b/Core/MIPS/MIPS/MipsJit.cpp index eef7938668..4086ef847d 100644 --- a/Core/MIPS/MIPS/MipsJit.cpp +++ b/Core/MIPS/MIPS/MipsJit.cpp @@ -149,7 +149,7 @@ void MipsJit::Compile(u32 em_address) { bool cleanSlate = false; if (js.hasSetRounding && !js.lastSetRounding) { - WARN_LOG(JIT, "Detected rounding mode usage, rebuilding jit with checks"); + WARN_LOG(Log::JIT, "Detected rounding mode usage, rebuilding jit with checks"); // Won't loop, since hasSetRounding is only ever set to 1. js.lastSetRounding = js.hasSetRounding; cleanSlate = true; @@ -237,7 +237,7 @@ bool MipsJit::DescribeCodePtr(const u8 *ptr, std::string &name) void MipsJit::Comp_RunBlock(MIPSOpcode op) { // This shouldn't be necessary, the dispatcher should catch us before we get here. - ERROR_LOG(JIT, "Comp_RunBlock should never be reached!"); + ERROR_LOG(Log::JIT, "Comp_RunBlock should never be reached!"); } void MipsJit::LinkBlock(u8 *exitPoint, const u8 *checkedEntry) { diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 0983d7226b..6816d9172d 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -737,7 +737,7 @@ namespace MIPSAnalyst { } totalUsedRegs += numUsedRegs; numAnalyzings++; - VERBOSE_LOG(CPU, "[ %08x ] Used regs: %i Average: %f", address, numUsedRegs, (float)totalUsedRegs / (float)numAnalyzings); + VERBOSE_LOG(Log::CPU, "[ %08x ] Used regs: %i Average: %f", address, numUsedRegs, (float)totalUsedRegs / (float)numAnalyzings); return results; } @@ -930,7 +930,7 @@ skip: } double et = time_now_d(); - NOTICE_LOG(JIT, "Precompiled %d MIPS functions in %0.2f milliseconds", (int)functions.size(), (et - st) * 1000.0); + NOTICE_LOG(Log::JIT, "Precompiled %d MIPS functions in %0.2f milliseconds", (int)functions.size(), (et - st) * 1000.0); } static const char *DefaultFunctionName(char buffer[256], u32 startAddr) { @@ -1219,7 +1219,7 @@ skip: hashMap.insert(hfun); return; } else if (!iter->hasHash || size == 0) { - ERROR_LOG(HLE, "%s: %08x %08x : match but no hash (%i) or no size", name, startAddr, size, iter->hasHash); + ERROR_LOG(Log::HLE, "%s: %08x %08x : match but no hash (%i) or no size", name, startAddr, size, iter->hasHash); } } } @@ -1329,7 +1329,7 @@ skip: FILE *file = File::OpenCFile(filename, "wt"); if (!file) { - WARN_LOG(LOADER, "Could not store hash map: %s", filename.c_str()); + WARN_LOG(Log::Loader, "Could not store hash map: %s", filename.c_str()); return; } @@ -1337,7 +1337,7 @@ skip: const HashMapFunc &mf = *it; if (!mf.hardcoded) { if (fprintf(file, "%016llx:%d = %s\n", mf.hash, mf.size, mf.name) <= 0) { - WARN_LOG(LOADER, "Could not store hash map: %s", filename.c_str()); + WARN_LOG(Log::Loader, "Could not store hash map: %s", filename.c_str()); break; } } @@ -1386,7 +1386,7 @@ skip: void LoadHashMap(const Path &filename) { FILE *file = File::OpenCFile(filename, "rt"); if (!file) { - WARN_LOG(LOADER, "Could not load hash map: %s", filename.c_str()); + WARN_LOG(Log::Loader, "Could not load hash map: %s", filename.c_str()); return; } hashmapFileName = filename; @@ -1397,7 +1397,7 @@ skip: if (fscanf(file, "%llx:%d = %63s\n", &mf.hash, &mf.size, mf.name) < 3) { char temp[1024]; if (!fgets(temp, 1024, file)) { - WARN_LOG(LOADER, "Could not read from hash map: %s", filename.c_str()); + WARN_LOG(Log::Loader, "Could not read from hash map: %s", filename.c_str()); } continue; } diff --git a/Core/MIPS/MIPSInt.cpp b/Core/MIPS/MIPSInt.cpp index 93644706d6..50e87df11f 100644 --- a/Core/MIPS/MIPSInt.cpp +++ b/Core/MIPS/MIPSInt.cpp @@ -120,12 +120,12 @@ namespace MIPSInt MIPSComp::jit->InvalidateCacheAt(alignedAddr, size); // Using a bool to avoid locking/etc. in case it's slow. if (!reportedAlignment && (addr & 0x3F) != 0) { - WARN_LOG_REPORT(JIT, "Unaligned icache invalidation of %08x (%08x + %d) at PC=%08x", addr, R(rs), imm, PC); + WARN_LOG_REPORT(Log::JIT, "Unaligned icache invalidation of %08x (%08x + %d) at PC=%08x", addr, R(rs), imm, PC); reportedAlignment = true; } if (alignedAddr <= PC + 4 && alignedAddr + size >= PC - 4) { // This is probably rare so we don't use a static bool. - WARN_LOG_REPORT_ONCE(icacheInvalidatePC, JIT, "Invalidating address near PC: %08x (%08x + %d) at PC=%08x", addr, R(rs), imm, PC); + WARN_LOG_REPORT_ONCE(icacheInvalidatePC, Log::JIT, "Invalidating address near PC: %08x (%08x + %d) at PC=%08x", addr, R(rs), imm, PC); } } break; @@ -144,7 +144,7 @@ namespace MIPSInt break; default: - DEBUG_LOG(CPU, "cache instruction affecting %08x : function %i", addr, func); + DEBUG_LOG(Log::CPU, "cache instruction affecting %08x : function %i", addr, func); } PC += 4; @@ -169,7 +169,7 @@ namespace MIPSInt void Int_Sync(MIPSOpcode op) { - //DEBUG_LOG(CPU, "sync"); + //DEBUG_LOG(Log::CPU, "sync"); PC += 4; } @@ -265,7 +265,7 @@ namespace MIPSInt void Int_JumpType(MIPSOpcode op) { if (mipsr4k.inDelaySlot) - ERROR_LOG(CPU, "Jump in delay slot :("); + ERROR_LOG(Log::CPU, "Jump in delay slot :("); u32 off = ((op & 0x03FFFFFF) << 2); u32 addr = (currentMIPS->pc & 0xF0000000) | off; @@ -292,7 +292,7 @@ namespace MIPSInt if (mipsr4k.inDelaySlot) { // There's one of these in Star Soldier at 0881808c, which seems benign. - ERROR_LOG(CPU, "Jump in delay slot :("); + ERROR_LOG(Log::CPU, "Jump in delay slot :("); } int rs = _RS; @@ -522,7 +522,7 @@ namespace MIPSInt } else if (fs == 0) { R(rt) = MIPSState::FCR0_VALUE; } else { - WARN_LOG_REPORT(CPU, "ReadFCR: Unexpected reg %d", fs); + WARN_LOG_REPORT(Log::CPU, "ReadFCR: Unexpected reg %d", fs); R(rt) = 0; } break; @@ -544,9 +544,9 @@ namespace MIPSInt MIPSComp::jit->UpdateFCR31(); } } else { - WARN_LOG_REPORT(CPU, "WriteFCR: Unexpected reg %d (value %08x)", fs, value); + WARN_LOG_REPORT(Log::CPU, "WriteFCR: Unexpected reg %d (value %08x)", fs, value); } - DEBUG_LOG(CPU, "FCR%i written to, value %08x", fs, value); + DEBUG_LOG(Log::CPU, "FCR%i written to, value %08x", fs, value); break; } @@ -821,14 +821,14 @@ namespace MIPSInt case 36: // mfic if (!reported) { Reporting::ReportMessage("MFIC instruction hit (%08x) at %08x", op.encoding, currentMIPS->pc); - WARN_LOG(CPU,"MFIC Disable/Enable Interrupt CPU instruction"); + WARN_LOG(Log::CPU,"MFIC Disable/Enable Interrupt CPU instruction"); reported = 1; } break; case 38: // mtic if (!reported) { Reporting::ReportMessage("MTIC instruction hit (%08x) at %08x", op.encoding, currentMIPS->pc); - WARN_LOG(CPU,"MTIC Disable/Enable Interrupt CPU instruction"); + WARN_LOG(Log::CPU,"MTIC Disable/Enable Interrupt CPU instruction"); reported = 1; } break; @@ -1021,7 +1021,7 @@ namespace MIPSInt case 0: if (!reported) { Reporting::ReportMessage("INTERRUPT instruction hit (%08x) at %08x", op.encoding, currentMIPS->pc); - WARN_LOG(CPU,"Disable/Enable Interrupt CPU instruction"); + WARN_LOG(Log::CPU,"Disable/Enable Interrupt CPU instruction"); reported = 1; } break; @@ -1052,7 +1052,7 @@ namespace MIPSInt } } else { if (!entry || !entry->replaceFunc) { - ERROR_LOG(CPU, "Bad replacement function index %i", index); + ERROR_LOG(Log::CPU, "Bad replacement function index %i", index); } // Interpret the original instruction under it. MIPSInterpret(Memory::Read_Instruction(PC, true)); diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index d2391a2e74..c5d712beff 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -123,7 +123,7 @@ static void ApplyPrefixST(float *r, u32 data, VectorSize size, float invalid = 0 if (!constants) { if (regnum >= n) { // We mostly handle this now, but still worth reporting. - ERROR_LOG_REPORT(CPU, "Invalid VFPU swizzle: %08x: %i / %d at PC = %08x (%s)", data, regnum, n, currentMIPS->pc, MIPSDisasmAt(currentMIPS->pc).c_str()); + ERROR_LOG_REPORT(Log::CPU, "Invalid VFPU swizzle: %08x: %i / %d at PC = %08x (%s)", data, regnum, n, currentMIPS->pc, MIPSDisasmAt(currentMIPS->pc).c_str()); } r[i] = origV[regnum]; if (abs) @@ -576,7 +576,7 @@ namespace MIPSInt void Int_Vflush(MIPSOpcode op) { - VERBOSE_LOG(CPU, "vflush"); + VERBOSE_LOG(Log::CPU, "vflush"); PC += 4; // Anything with 0xFC000000 is a nop, but only 0xFFFF0000 retains prefixes. if ((op & 0xFFFF0000) != 0xFFFF0000) @@ -905,7 +905,7 @@ namespace MIPSInt break; default: - ERROR_LOG_REPORT(CPU, "vf2h with invalid elements"); + ERROR_LOG_REPORT(Log::CPU, "vf2h with invalid elements"); break; } ApplyPrefixD(reinterpret_cast(d), outsize); @@ -973,7 +973,7 @@ namespace MIPSInt break; default: - ERROR_LOG_REPORT(CPU, "vus2i with more than 2 elements"); + ERROR_LOG_REPORT(Log::CPU, "vus2i with more than 2 elements"); break; } break; @@ -997,7 +997,7 @@ namespace MIPSInt break; default: - ERROR_LOG_REPORT(CPU, "vs2i with more than 2 elements"); + ERROR_LOG_REPORT(Log::CPU, "vs2i with more than 2 elements"); break; } break; @@ -1256,7 +1256,7 @@ namespace MIPSInt // Other sizes don't seem completely predictable. if (sz != V_Quad) { - ERROR_LOG_REPORT_ONCE(vbfy2, CPU, "vfby2 with incorrect size"); + ERROR_LOG_REPORT_ONCE(vbfy2, Log::CPU, "vfby2 with incorrect size"); } } else { // vbfy1 @@ -1271,7 +1271,7 @@ namespace MIPSInt ApplyPrefixST(t, VFPURewritePrefix(VFPU_CTRL_TPREFIX, tprefixRemove, tprefixAdd), sz); if (sz != V_Quad && sz != V_Pair) { - ERROR_LOG_REPORT_ONCE(vbfy2, CPU, "vfby1 with incorrect size"); + ERROR_LOG_REPORT_ONCE(vbfy2, Log::CPU, "vfby1 with incorrect size"); } } @@ -2076,7 +2076,7 @@ namespace MIPSInt d[i] = s[i]; } } else { - ERROR_LOG_REPORT(CPU, "Bad Imm3 in cmov: %d", imm3); + ERROR_LOG_REPORT(Log::CPU, "Bad Imm3 in cmov: %d", imm3); } ApplyPrefixD(d, sz); WriteVector(d, sz, vd); @@ -2248,7 +2248,7 @@ namespace MIPSInt break; default: - ERROR_LOG_REPORT(CPU, "vcrsp/vqmul with invalid elements"); + ERROR_LOG_REPORT(Log::CPU, "vcrsp/vqmul with invalid elements"); break; } diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp index f864191b10..cb3ab2e5a2 100644 --- a/Core/MIPS/MIPSTables.cpp +++ b/Core/MIPS/MIPSTables.cpp @@ -887,7 +887,7 @@ const MIPSInstruction *MIPSGetInstruction(MIPSOpcode op) { const MIPSInstruction *instr = &tableImmediate[op.encoding >> 26]; while (instr->altEncoding != Instruc) { if (instr->altEncoding == Inval) { - //ERROR_LOG(CPU, "Invalid instruction %08x in table %i, entry %i", op, (int)encoding, subop); + //ERROR_LOG(Log::CPU, "Invalid instruction %08x in table %i, entry %i", op, (int)encoding, subop); return 0; //invalid instruction } encoding = instr->altEncoding; @@ -909,12 +909,12 @@ void MIPSCompileOp(MIPSOpcode op, MIPSComp::MIPSFrontendInterface *jit) { if (instr->compile) { (jit->*(instr->compile))(op); } else { - ERROR_LOG_REPORT(CPU,"MIPSCompileOp %08x failed",op.encoding); + ERROR_LOG_REPORT(Log::CPU,"MIPSCompileOp %08x failed",op.encoding); } if (info & OUT_EAT_PREFIX) jit->EatPrefix(); } else { - ERROR_LOG_REPORT(CPU, "MIPSCompileOp: Invalid instruction %08x", op.encoding); + ERROR_LOG_REPORT(Log::CPU, "MIPSCompileOp: Invalid instruction %08x", op.encoding); } } @@ -942,7 +942,7 @@ static inline void Interpret(const MIPSInstruction *instr, MIPSOpcode op) { if (instr && instr->interpret) { instr->interpret(op); } else { - ERROR_LOG_REPORT(CPU, "Unknown instruction %08x at %08x", op.encoding, currentMIPS->pc); + ERROR_LOG_REPORT(Log::CPU, "Unknown instruction %08x at %08x", op.encoding, currentMIPS->pc); // Try to disassemble it char disasm[256]; MIPSDisAsm(op, currentMIPS->pc, disasm, sizeof(disasm)); @@ -1054,7 +1054,7 @@ int MIPSInterpret_RunUntil(u64 globalTicks) { RunUntilFast(); if (CoreTiming::GetTicks() > globalTicks) { - // DEBUG_LOG(CPU, "Hit the max ticks, bailing 1 : %llu, %llu", globalTicks, CoreTiming::GetTicks()); + // DEBUG_LOG(Log::CPU, "Hit the max ticks, bailing 1 : %llu, %llu", globalTicks, CoreTiming::GetTicks()); return 1; } } diff --git a/Core/MIPS/MIPSVFPUUtils.cpp b/Core/MIPS/MIPSVFPUUtils.cpp index d8196999eb..6e65702304 100644 --- a/Core/MIPS/MIPSVFPUUtils.cpp +++ b/Core/MIPS/MIPSVFPUUtils.cpp @@ -97,26 +97,26 @@ int GetMatrixName(int matrix, MatrixSize msize, int column, int row, bool transp switch (msize) { case M_4x4: if (row || column) { - ERROR_LOG(JIT, "GetMatrixName: Invalid row %i or column %i for size %i", row, column, msize); + ERROR_LOG(Log::JIT, "GetMatrixName: Invalid row %i or column %i for size %i", row, column, msize); } break; case M_3x3: if (row & ~2) { - ERROR_LOG(JIT, "GetMatrixName: Invalid row %i for size %i", row, msize); + ERROR_LOG(Log::JIT, "GetMatrixName: Invalid row %i for size %i", row, msize); } if (column & ~2) { - ERROR_LOG(JIT, "GetMatrixName: Invalid col %i for size %i", column, msize); + ERROR_LOG(Log::JIT, "GetMatrixName: Invalid col %i for size %i", column, msize); } name |= (row << 6) | column; break; case M_2x2: if (row & ~2) { - ERROR_LOG(JIT, "GetMatrixName: Invalid row %i for size %i", row, msize); + ERROR_LOG(Log::JIT, "GetMatrixName: Invalid row %i for size %i", row, msize); } if (column & ~2) { - ERROR_LOG(JIT, "GetMatrixName: Invalid col %i for size %i", column, msize); + ERROR_LOG(Log::JIT, "GetMatrixName: Invalid col %i for size %i", column, msize); } name |= (row << 5) | column; break; @@ -301,7 +301,7 @@ void WriteMatrix(const float *rd, MatrixSize size, int reg) { } if (currentMIPS->VfpuWriteMask() != 0) { - ERROR_LOG_REPORT(CPU, "Write mask used with vfpu matrix instruction."); + ERROR_LOG_REPORT(Log::CPU, "Write mask used with vfpu matrix instruction."); } // The voffset ordering is now integrated in these formulas, @@ -998,16 +998,16 @@ static inline bool load_vfpu_table(T *&ptr, const char *filename, size_t expecte #endif if (ptr) return true; // Already loaded. size_t size = 0u; - INFO_LOG(CPU, "Loading '%s'...", filename); + INFO_LOG(Log::CPU, "Loading '%s'...", filename); ptr = reinterpret_cast(g_VFS.ReadFile(filename, &size)); if(!ptr || size != expected_size) { - ERROR_LOG(CPU, "Error loading '%s' (size=%u, expected: %u)", filename, (unsigned)size, (unsigned)expected_size); + ERROR_LOG(Log::CPU, "Error loading '%s' (size=%u, expected: %u)", filename, (unsigned)size, (unsigned)expected_size); if(ptr) delete[] ptr; ptr = nullptr; return false; } - INFO_LOG(CPU, "Successfully loaded '%s'", filename); + INFO_LOG(Log::CPU, "Successfully loaded '%s'", filename); return true; } diff --git a/Core/MIPS/RiscV/RiscVAsm.cpp b/Core/MIPS/RiscV/RiscVAsm.cpp index 730a6d9dcc..63e68a345b 100644 --- a/Core/MIPS/RiscV/RiscVAsm.cpp +++ b/Core/MIPS/RiscV/RiscVAsm.cpp @@ -35,9 +35,9 @@ static const bool enableDisasm = false; static void ShowPC(u32 downcount, void *membase, void *jitbase) { static int count = 0; if (currentMIPS) { - ERROR_LOG(JIT, "[%08x] ShowPC Downcount : %08x %d %p %p", currentMIPS->pc, downcount, count, membase, jitbase); + ERROR_LOG(Log::JIT, "[%08x] ShowPC Downcount : %08x %d %p %p", currentMIPS->pc, downcount, count, membase, jitbase); } else { - ERROR_LOG(JIT, "Universe corrupt?"); + ERROR_LOG(Log::JIT, "Universe corrupt?"); } //if (count > 2000) // exit(0); @@ -240,7 +240,7 @@ void RiscVJitBackend::GenerateFixedCode(MIPSState *mipsState) { #if PPSSPP_ARCH(RISCV64) std::vector lines = DisassembleRV64(start, GetCodePtr() - start); for (auto s : lines) { - INFO_LOG(JIT, "%s", s.c_str()); + INFO_LOG(Log::JIT, "%s", s.c_str()); } #endif } diff --git a/Core/MIPS/RiscV/RiscVJit.cpp b/Core/MIPS/RiscV/RiscVJit.cpp index 6c3544969c..8f18f0ab8b 100644 --- a/Core/MIPS/RiscV/RiscVJit.cpp +++ b/Core/MIPS/RiscV/RiscVJit.cpp @@ -143,7 +143,7 @@ bool RiscVJitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bo for (int i = 0; i < (int)addresses.size(); ++i) addressesLookup[addresses[i]] = i; - INFO_LOG(JIT, "=============== RISCV (%08x, %d bytes) ===============", startPC, len); + INFO_LOG(Log::JIT, "=============== RISCV (%08x, %d bytes) ===============", startPC, len); const IRInst *instructions = irBlockCache->GetBlockInstructionPtr(*block); for (const u8 *p = blockStart; p < GetCodePointer(); ) { auto it = addressesLookup.find(p); @@ -152,7 +152,7 @@ bool RiscVJitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bo char temp[512]; DisassembleIR(temp, sizeof(temp), inst); - INFO_LOG(JIT, "IR: #%d %s", it->second, temp); + INFO_LOG(Log::JIT, "IR: #%d %s", it->second, temp); } auto next = std::next(it); @@ -161,7 +161,7 @@ bool RiscVJitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bo #if PPSSPP_ARCH(RISCV64) || (PPSSPP_PLATFORM(WINDOWS) && !defined(__LIBRETRO__)) auto lines = DisassembleRV64(p, (int)(nextp - p)); for (const auto &line : lines) - INFO_LOG(JIT, "RV: %s", line.c_str()); + INFO_LOG(Log::JIT, "RV: %s", line.c_str()); #endif p = nextp; } diff --git a/Core/MIPS/RiscV/RiscVRegCache.cpp b/Core/MIPS/RiscV/RiscVRegCache.cpp index 25528aa3aa..0e5965bf36 100644 --- a/Core/MIPS/RiscV/RiscVRegCache.cpp +++ b/Core/MIPS/RiscV/RiscVRegCache.cpp @@ -405,7 +405,7 @@ RiscVReg RiscVRegCache::R(IRReg mipsReg) { if (mr[mipsReg].loc == MIPSLoc::REG || mr[mipsReg].loc == MIPSLoc::REG_IMM) { return (RiscVReg)mr[mipsReg].nReg; } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in riscv reg", mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in riscv reg", mipsReg); return INVALID_REG; // BAAAD } } @@ -421,11 +421,11 @@ RiscVReg RiscVRegCache::RPtr(IRReg mipsReg) { if (nr[rv].pointerified) { return (RiscVReg)mr[mipsReg].nReg; } else { - ERROR_LOG(JIT, "Tried to use a non-pointer register as a pointer"); + ERROR_LOG(Log::JIT, "Tried to use a non-pointer register as a pointer"); return INVALID_REG; } } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in riscv reg", mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in riscv reg", mipsReg); return INVALID_REG; // BAAAD } } @@ -436,7 +436,7 @@ RiscVReg RiscVRegCache::F(IRReg mipsReg) { if (mr[mipsReg + 32].loc == MIPSLoc::FREG) { return (RiscVReg)mr[mipsReg + 32].nReg; } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in riscv reg", mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in riscv reg", mipsReg); return INVALID_REG; // BAAAD } } diff --git a/Core/MIPS/fake/FakeJit.cpp b/Core/MIPS/fake/FakeJit.cpp index 7ed0af300b..081655752b 100644 --- a/Core/MIPS/fake/FakeJit.cpp +++ b/Core/MIPS/fake/FakeJit.cpp @@ -109,10 +109,10 @@ void FakeJit::InvalidateCacheAt(u32 em_address, int length) { void FakeJit::EatInstruction(MIPSOpcode op) { MIPSInfo info = MIPSGetInfo(op); if (info & DELAYSLOT) { - ERROR_LOG_REPORT_ONCE(ateDelaySlot, JIT, "Ate a branch op."); + ERROR_LOG_REPORT_ONCE(ateDelaySlot, Log::JIT, "Ate a branch op."); } if (js.inDelaySlot) { - ERROR_LOG_REPORT_ONCE(ateInDelaySlot, JIT, "Ate an instruction inside a delay slot."); + ERROR_LOG_REPORT_ONCE(ateInDelaySlot, Log::JIT, "Ate an instruction inside a delay slot."); } js.numInstructions++; @@ -150,7 +150,7 @@ bool FakeJit::DescribeCodePtr(const u8 *ptr, std::string &name) void FakeJit::Comp_RunBlock(MIPSOpcode op) { // This shouldn't be necessary, the dispatcher should catch us before we get here. - ERROR_LOG(JIT, "Comp_RunBlock should never be reached!"); + ERROR_LOG(Log::JIT, "Comp_RunBlock should never be reached!"); } void FakeJit::Comp_ReplacementFunc(MIPSOpcode op) diff --git a/Core/MIPS/x86/Asm.cpp b/Core/MIPS/x86/Asm.cpp index 471414e453..0c5d5924f0 100644 --- a/Core/MIPS/x86/Asm.cpp +++ b/Core/MIPS/x86/Asm.cpp @@ -62,7 +62,7 @@ static bool enableDebug = false; //R15 - Pointer to array of block pointers void ImHere() { - DEBUG_LOG(CPU, "JIT Here: %08x", currentMIPS->pc); + DEBUG_LOG(Log::CPU, "JIT Here: %08x", currentMIPS->pc); } void Jit::GenerateFixedCode(JitOptions &jo) { diff --git a/Core/MIPS/x86/CompBranch.cpp b/Core/MIPS/x86/CompBranch.cpp index 52655319c1..0e58a14ce9 100644 --- a/Core/MIPS/x86/CompBranch.cpp +++ b/Core/MIPS/x86/CompBranch.cpp @@ -108,7 +108,7 @@ static void JitBranchLogMismatch(MIPSOpcode op, u32 pc) { char temp[256]; MIPSDisAsm(op, pc, temp, sizeof(temp), true); - ERROR_LOG(JIT, "Bad jump: %s - int:%08x jit:%08x", temp, currentMIPS->intBranchExit, currentMIPS->jitBranchExit); + ERROR_LOG(Log::JIT, "Bad jump: %s - int:%08x jit:%08x", temp, currentMIPS->intBranchExit, currentMIPS->jitBranchExit); Core_EnableStepping(true, "jit.branchdebug", pc); } @@ -155,7 +155,7 @@ CCFlags Jit::FlipCCFlag(CCFlags flag) case CC_LE: return CC_NLE; case CC_NLE: return CC_LE; } - ERROR_LOG_REPORT(JIT, "FlipCCFlag: Unexpected CC flag: %d", flag); + ERROR_LOG_REPORT(Log::JIT, "FlipCCFlag: Unexpected CC flag: %d", flag); return CC_O; } @@ -181,7 +181,7 @@ CCFlags Jit::SwapCCFlag(CCFlags flag) case CC_LE: return CC_GE; case CC_NLE: return CC_NGE; } - ERROR_LOG_REPORT(JIT, "SwapCCFlag: Unexpected CC flag: %d", flag); + ERROR_LOG_REPORT(Log::JIT, "SwapCCFlag: Unexpected CC flag: %d", flag); return CC_O; } @@ -340,7 +340,7 @@ void Jit::BranchRSRTComp(MIPSOpcode op, Gen::CCFlags cc, bool likely) { CONDITIONAL_LOG; if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in RSRTComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in RSRTComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -419,7 +419,7 @@ void Jit::BranchRSZeroComp(MIPSOpcode op, Gen::CCFlags cc, bool andLink, bool li { CONDITIONAL_LOG; if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in RSZeroComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in RSZeroComp delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -539,7 +539,7 @@ void Jit::BranchFPFlag(MIPSOpcode op, Gen::CCFlags cc, bool likely) { CONDITIONAL_LOG; if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in FPFlag delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in FPFlag delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -582,7 +582,7 @@ void Jit::BranchVFPUFlag(MIPSOpcode op, Gen::CCFlags cc, bool likely) if (js.inDelaySlot) { // I think we can safely just warn-log this without reporting, it's pretty clear that this type // of branch is ignored. - WARN_LOG(JIT, "Branch in VFPU delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + WARN_LOG(Log::JIT, "Branch in VFPU delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } int offset = TARGET16; @@ -631,7 +631,7 @@ static void HitInvalidJump(uint32_t dest) { void Jit::Comp_Jump(MIPSOpcode op) { CONDITIONAL_LOG; if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in Jump delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in Jump delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } u32 off = TARGET26; @@ -640,7 +640,7 @@ void Jit::Comp_Jump(MIPSOpcode op) { // Might be a stubbed address or something? if (!Memory::IsValidAddress(targetAddr) || (targetAddr & 3) != 0) { if (js.nextExit == 0) { - ERROR_LOG_REPORT(JIT, "Jump to invalid address: %08x PC %08x LR %08x", targetAddr, GetCompilerPC(), currentMIPS->r[MIPS_REG_RA]); + ERROR_LOG_REPORT(Log::JIT, "Jump to invalid address: %08x PC %08x LR %08x", targetAddr, GetCompilerPC(), currentMIPS->r[MIPS_REG_RA]); } else { js.compiling = false; } @@ -707,7 +707,7 @@ void Jit::Comp_JumpReg(MIPSOpcode op) { CONDITIONAL_LOG; if (js.inDelaySlot) { - ERROR_LOG_REPORT(JIT, "Branch in JumpReg delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); + ERROR_LOG_REPORT(Log::JIT, "Branch in JumpReg delay slot at %08x in block starting at %08x", GetCompilerPC(), js.blockStart); return; } MIPSGPReg rs = _RS; @@ -798,7 +798,7 @@ void Jit::Comp_JumpReg(MIPSOpcode op) void Jit::Comp_Syscall(MIPSOpcode op) { if (op.encoding == 0x03FFFFcc) { - WARN_LOG(JIT, "Encountered bad syscall instruction at %08x (%08x)", js.compilerPC, op.encoding); + WARN_LOG(Log::JIT, "Encountered bad syscall instruction at %08x (%08x)", js.compilerPC, op.encoding); } if (!g_Config.bSkipDeadbeefFilling) diff --git a/Core/MIPS/x86/CompLoadStore.cpp b/Core/MIPS/x86/CompLoadStore.cpp index 9509f63d68..69c8b29963 100644 --- a/Core/MIPS/x86/CompLoadStore.cpp +++ b/Core/MIPS/x86/CompLoadStore.cpp @@ -93,7 +93,7 @@ namespace MIPSComp { if (makeRTWritable) { gpr.MapReg(rt, true, true); } - // NOTICE_LOG(JIT, "%d-bit Imm at %08x : %08x", bits, js.blockStart, (u32)gpr.R(rt).GetImmValue()); + // NOTICE_LOG(Log::JIT, "%d-bit Imm at %08x : %08x", bits, js.blockStart, (u32)gpr.R(rt).GetImmValue()); } else { gpr.MapReg(rt, true, false); } diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index 99f6640c94..610772e97b 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -123,7 +123,7 @@ void Jit::ApplyPrefixST(u8 *vregs, u32 prefix, VectorSize sz) { // Prefix may say "z, z, z, z" but if this is a pair, we force to x. // TODO: But some ops seem to use const 0 instead? if (regnum >= n) { - ERROR_LOG_REPORT(CPU, "Invalid VFPU swizzle: %08x / %d", prefix, sz); + ERROR_LOG_REPORT(Log::CPU, "Invalid VFPU swizzle: %08x / %d", prefix, sz); regnum = 0; } fpr.SimpleRegV(origV[regnum], 0); @@ -3556,7 +3556,7 @@ void Jit::CompVrotShuffle(u8 *dregs, int imm, int n, bool negSin) { break; } default: - ERROR_LOG(JIT, "Bad what in vrot"); + ERROR_LOG(Log::JIT, "Bad what in vrot"); break; } } @@ -3570,7 +3570,7 @@ void Jit::Comp_VRot(MIPSOpcode op) { } if (!js.HasNoPrefix()) { // Prefixes work strangely for this, see IRCompVFPU. - WARN_LOG_REPORT(JIT, "vrot instruction using prefixes at %08x", GetCompilerPC()); + WARN_LOG_REPORT(Log::JIT, "vrot instruction using prefixes at %08x", GetCompilerPC()); DISABLE; } @@ -3590,7 +3590,7 @@ void Jit::Comp_VRot(MIPSOpcode op) { // Pair of vrot with the same angle argument. Let's join them (can share sin/cos results). vd2 = MIPS_GET_VD(nextOp); imm2 = (nextOp >> 16) & 0x1f; - // NOTICE_LOG(JIT, "Joint VFPU at %08x", js.blockStart); + // NOTICE_LOG(Log::JIT, "Joint VFPU at %08x", js.blockStart); } u8 sreg; diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index 249d12a143..4077ba815e 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -85,7 +85,7 @@ u32 JitBreakpoint(uint32_t addr) if (message.size() > 2) message.resize(message.size() - 2); - NOTICE_LOG(JIT, "Top ops compiled to interpreter: %s", message.c_str()); + NOTICE_LOG(Log::JIT, "Top ops compiled to interpreter: %s", message.c_str()); } return 1; @@ -145,7 +145,7 @@ void Jit::DoState(PointerWrap &p) { Do(p, js.startDefaultPrefix); if (p.mode == PointerWrap::MODE_READ && !js.startDefaultPrefix) { - WARN_LOG(CPU, "Jit: An uneaten prefix was previously detected. Jitting in unknown-prefix mode."); + WARN_LOG(Log::CPU, "Jit: An uneaten prefix was previously detected. Jitting in unknown-prefix mode."); } if (s >= 2) { Do(p, js.hasSetRounding); @@ -286,10 +286,10 @@ void Jit::CompileDelaySlot(int flags, RegCacheState *state) { void Jit::EatInstruction(MIPSOpcode op) { MIPSInfo info = MIPSGetInfo(op); if (info & DELAYSLOT) { - ERROR_LOG_REPORT_ONCE(ateDelaySlot, JIT, "Ate a branch op."); + ERROR_LOG_REPORT_ONCE(ateDelaySlot, Log::JIT, "Ate a branch op."); } if (js.inDelaySlot) { - ERROR_LOG_REPORT_ONCE(ateInDelaySlot, JIT, "Ate an instruction inside a delay slot."); + ERROR_LOG_REPORT_ONCE(ateInDelaySlot, Log::JIT, "Ate an instruction inside a delay slot."); } CheckJitBreakpoint(GetCompilerPC() + 4, 0); @@ -323,7 +323,7 @@ void Jit::Compile(u32 em_address) { bool cleanSlate = false; if (js.hasSetRounding && !js.lastSetRounding) { - WARN_LOG(JIT, "Detected rounding mode usage, rebuilding jit with checks"); + WARN_LOG(Log::JIT, "Detected rounding mode usage, rebuilding jit with checks"); // Won't loop, since hasSetRounding is only ever set to 1. js.lastSetRounding = js.hasSetRounding; cleanSlate = true; @@ -331,7 +331,7 @@ void Jit::Compile(u32 em_address) { // Drat. The VFPU hit an uneaten prefix at the end of a block. if (js.startDefaultPrefix && js.MayHavePrefix()) { - WARN_LOG_REPORT(JIT, "An uneaten prefix at end of block: %08x", GetCompilerPC() - 4); + WARN_LOG_REPORT(Log::JIT, "An uneaten prefix at end of block: %08x", GetCompilerPC() - 4); js.LogPrefix(); // Let's try that one more time. We won't get back here because we toggled the value. @@ -513,7 +513,7 @@ bool Jit::DescribeCodePtr(const u8 *ptr, std::string &name) { void Jit::Comp_RunBlock(MIPSOpcode op) { // This shouldn't be necessary, the dispatcher should catch us before we get here. - ERROR_LOG(JIT, "Comp_RunBlock"); + ERROR_LOG(Log::JIT, "Comp_RunBlock"); } void Jit::LinkBlock(u8 *exitPoint, const u8 *checkedEntry) { @@ -605,7 +605,7 @@ void Jit::Comp_ReplacementFunc(MIPSOpcode op) { const ReplacementTableEntry *entry = GetReplacementFunc(index); if (!entry) { - ERROR_LOG_REPORT_ONCE(replFunc, HLE, "Invalid replacement op %08x at %08x", op.encoding, js.compilerPC); + ERROR_LOG_REPORT_ONCE(replFunc, Log::HLE, "Invalid replacement op %08x at %08x", op.encoding, js.compilerPC); return; } @@ -624,7 +624,7 @@ void Jit::Comp_ReplacementFunc(MIPSOpcode op) { // Not sure about the cause. Memory::Opcode origInstruction = Memory::Read_Instruction(GetCompilerPC(), true); if (origInstruction.encoding == op.encoding) { - ERROR_LOG(HLE, "Replacement broken (savestate problem?): %08x at %08x", op.encoding, GetCompilerPC()); + ERROR_LOG(Log::HLE, "Replacement broken (savestate problem?): %08x at %08x", op.encoding, GetCompilerPC()); return; } @@ -677,7 +677,7 @@ void Jit::Comp_ReplacementFunc(MIPSOpcode op) { js.compiling = false; } } else { - ERROR_LOG(HLE, "Replacement function %s has neither jit nor regular impl", entry->name); + ERROR_LOG(Log::HLE, "Replacement function %s has neither jit nor regular impl", entry->name); } } @@ -698,7 +698,7 @@ void Jit::Comp_Generic(MIPSOpcode op) { ApplyRoundingMode(); } else - ERROR_LOG_REPORT(JIT, "Trying to compile instruction %08x that can't be interpreted", op.encoding); + ERROR_LOG_REPORT(Log::JIT, "Trying to compile instruction %08x that can't be interpreted", op.encoding); const MIPSInfo info = MIPSGetInfo(op); if ((info & IS_VFPU) != 0 && (info & VFPU_NO_PREFIX) == 0) @@ -721,7 +721,7 @@ void Jit::WriteExit(u32 destination, int exit_num) { _assert_msg_(exit_num < MAX_JIT_BLOCK_EXITS, "Expected a valid exit_num. dest=%08x", destination); if (!Memory::IsValidAddress(destination) || (destination & 3) != 0) { - ERROR_LOG_REPORT(JIT, "Trying to write block exit to illegal destination %08x: pc = %08x", destination, currentMIPS->pc); + ERROR_LOG_REPORT(Log::JIT, "Trying to write block exit to illegal destination %08x: pc = %08x", destination, currentMIPS->pc); MOV(32, MIPSSTATE_VAR(pc), Imm32(GetCompilerPC())); ABI_CallFunctionC(&HitInvalidBranch, destination); js.afterOp |= JitState::AFTER_CORE_STATE; diff --git a/Core/MIPS/x86/RegCache.cpp b/Core/MIPS/x86/RegCache.cpp index 10b2676526..e8c3ecea72 100644 --- a/Core/MIPS/x86/RegCache.cpp +++ b/Core/MIPS/x86/RegCache.cpp @@ -330,7 +330,7 @@ OpArg GPRRegCache::GetDefaultLocation(MIPSGPReg reg) const { case MIPS_REG_VFPUCC: return MIPSSTATE_VAR(vfpuCtrl[VFPU_CTRL_CC]); default: - ERROR_LOG_REPORT(JIT, "Bad mips register %d", reg); + ERROR_LOG_REPORT(Log::JIT, "Bad mips register %d", reg); return MIPSSTATE_VAR(r[0]); } } diff --git a/Core/MIPS/x86/X64IRAsm.cpp b/Core/MIPS/x86/X64IRAsm.cpp index 86cb3929cb..3745bde4f8 100644 --- a/Core/MIPS/x86/X64IRAsm.cpp +++ b/Core/MIPS/x86/X64IRAsm.cpp @@ -39,9 +39,9 @@ static void ShowPC(void *membase, void *jitbase) { static int count = 0; if (currentMIPS) { u32 downcount = currentMIPS->downcount; - ERROR_LOG(JIT, "[%08x] ShowPC Downcount : %08x %d %p %p", currentMIPS->pc, downcount, count, membase, jitbase); + ERROR_LOG(Log::JIT, "[%08x] ShowPC Downcount : %08x %d %p %p", currentMIPS->pc, downcount, count, membase, jitbase); } else { - ERROR_LOG(JIT, "Universe corrupt?"); + ERROR_LOG(Log::JIT, "Universe corrupt?"); } //if (count > 2000) // exit(0); @@ -304,7 +304,7 @@ void X64JitBackend::GenerateFixedCode(MIPSState *mipsState) { #if PPSSPP_ARCH(AMD64) std::vector lines = DisassembleX86(disasmStart, (int)(GetCodePtr() - disasmStart)); for (auto s : lines) { - INFO_LOG(JIT, "%s", s.c_str()); + INFO_LOG(Log::JIT, "%s", s.c_str()); } #endif } diff --git a/Core/MIPS/x86/X64IRJit.cpp b/Core/MIPS/x86/X64IRJit.cpp index 4bbc924306..c638832bff 100644 --- a/Core/MIPS/x86/X64IRJit.cpp +++ b/Core/MIPS/x86/X64IRJit.cpp @@ -147,7 +147,7 @@ bool X64JitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bool for (int i = 0; i < (int)addresses.size(); ++i) addressesLookup[addresses[i]] = i; - INFO_LOG(JIT, "=============== x86 (%08x, %d bytes) ===============", startPC, len); + INFO_LOG(Log::JIT, "=============== x86 (%08x, %d bytes) ===============", startPC, len); const IRInst *instructions = irBlockCache->GetBlockInstructionPtr(*block); for (const u8 *p = blockStart; p < GetCodePointer(); ) { auto it = addressesLookup.find(p); @@ -156,7 +156,7 @@ bool X64JitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bool char temp[512]; DisassembleIR(temp, sizeof(temp), inst); - INFO_LOG(JIT, "IR: #%d %s", it->second, temp); + INFO_LOG(Log::JIT, "IR: #%d %s", it->second, temp); } auto next = std::next(it); @@ -164,7 +164,7 @@ bool X64JitBackend::CompileBlock(IRBlockCache *irBlockCache, int block_num, bool auto lines = DisassembleX86(p, (int)(nextp - p)); for (const auto &line : lines) - INFO_LOG(JIT, " X: %s", line.c_str()); + INFO_LOG(Log::JIT, " X: %s", line.c_str()); p = nextp; } } diff --git a/Core/MIPS/x86/X64IRRegCache.cpp b/Core/MIPS/x86/X64IRRegCache.cpp index cfbb57712e..8ea13ef775 100644 --- a/Core/MIPS/x86/X64IRRegCache.cpp +++ b/Core/MIPS/x86/X64IRRegCache.cpp @@ -766,7 +766,7 @@ X64Reg X64IRRegCache::RX(IRReg mipsReg) { if (mr[mipsReg].loc == MIPSLoc::REG || mr[mipsReg].loc == MIPSLoc::REG_IMM) { return FromNativeReg(mr[mipsReg].nReg); } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in x64 reg", mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in x64 reg", mipsReg); return INVALID_REG; // BAAAD } } @@ -782,11 +782,11 @@ X64Reg X64IRRegCache::RXPtr(IRReg mipsReg) { if (nr[r].pointerified) { return FromNativeReg(mr[mipsReg].nReg); } else { - ERROR_LOG(JIT, "Tried to use a non-pointer register as a pointer"); + ERROR_LOG(Log::JIT, "Tried to use a non-pointer register as a pointer"); return INVALID_REG; } } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in x64 reg", mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in x64 reg", mipsReg); return INVALID_REG; // BAAAD } } @@ -797,7 +797,7 @@ X64Reg X64IRRegCache::FX(IRReg mipsReg) { if (mr[mipsReg + 32].loc == MIPSLoc::FREG) { return FromNativeReg(mr[mipsReg + 32].nReg); } else { - ERROR_LOG_REPORT(JIT, "Reg %i not in x64 reg", mipsReg); + ERROR_LOG_REPORT(Log::JIT, "Reg %i not in x64 reg", mipsReg); return INVALID_REG; // BAAAD } } diff --git a/Core/MemFault.cpp b/Core/MemFault.cpp index ae98e199e4..e788c72420 100644 --- a/Core/MemFault.cpp +++ b/Core/MemFault.cpp @@ -250,7 +250,7 @@ bool HandleFault(uintptr_t hostAddress, void *ctx) { uintptr_t crashHandler = (uintptr_t)MIPSComp::jit->GetCrashHandler(); if (crashHandler != 0) { context->CTX_PC = crashHandler; - ERROR_LOG(MEMMAP, "Bad execution access detected, halting: %08x (last known pc %08x, host: %p)", targetAddr, currentMIPS->pc, (void *)hostAddress); + ERROR_LOG(Log::MemMap, "Bad execution access detected, halting: %08x (last known pc %08x, host: %p)", targetAddr, currentMIPS->pc, (void *)hostAddress); inCrashHandler = false; return true; } @@ -278,7 +278,7 @@ bool HandleFault(uintptr_t hostAddress, void *ctx) { context->CTX_PC += info.instructionSize; g_numReportedBadAccesses++; if (g_numReportedBadAccesses < 100) { - ERROR_LOG(MEMMAP, "Bad memory access detected and ignored: %08x (%p)", guestAddress, (void *)hostAddress); + ERROR_LOG(Log::MemMap, "Bad memory access detected and ignored: %08x (%p)", guestAddress, (void *)hostAddress); } } else { std::string infoString = ""; @@ -309,7 +309,7 @@ bool HandleFault(uintptr_t hostAddress, void *ctx) { context->CTX_PC = crashHandler; else handled = false; - ERROR_LOG(MEMMAP, "Bad memory access detected! %08x (%p) Stopping emulation. Info:\n%s", guestAddress, (void *)hostAddress, infoString.c_str()); + ERROR_LOG(Log::MemMap, "Bad memory access detected! %08x (%p) Stopping emulation. Info:\n%s", guestAddress, (void *)hostAddress, infoString.c_str()); } inCrashHandler = false; @@ -319,7 +319,7 @@ bool HandleFault(uintptr_t hostAddress, void *ctx) { #else bool HandleFault(uintptr_t hostAddress, void *ctx) { - ERROR_LOG(MEMMAP, "Exception handling not supported"); + ERROR_LOG(Log::MemMap, "Exception handling not supported"); return false; } diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index f47836dc5e..67bbe6f9f3 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -159,7 +159,7 @@ static bool Memory_TryBase(u32 flags) { position, view.size, base + view.virtual_address); if (!*view.out_ptr) { goto bail; - DEBUG_LOG(MEMMAP, "Failed at view %d", i); + DEBUG_LOG(Log::MemMap, "Failed at view %d", i); } #else if (CanIgnoreView(view)) { @@ -169,7 +169,7 @@ static bool Memory_TryBase(u32 flags) { *view.out_ptr = (u8*)g_arena.CreateView( position, view.size, base + (view.virtual_address & MEMVIEW32_MASK)); if (!*view.out_ptr) { - DEBUG_LOG(MEMMAP, "Failed at view %d", i); + DEBUG_LOG(Log::MemMap, "Failed at view %d", i); goto bail; } } @@ -235,18 +235,18 @@ bool MemoryMap_Setup(u32 flags) { uintptr_t max_base_addr = 0; uintptr_t min_base_addr = 0; uintptr_t stride = 0; - ERROR_LOG(MEMMAP, "MemoryMap_Setup: Hit a wrong path, should not be needed on this platform."); + ERROR_LOG(Log::MemMap, "MemoryMap_Setup: Hit a wrong path, should not be needed on this platform."); return false; #endif for (uintptr_t base_addr = min_base_addr; base_addr < max_base_addr; base_addr += stride) { base_attempts++; base = (u8 *)base_addr; if (Memory_TryBase(flags)) { - INFO_LOG(MEMMAP, "Found valid memory base at %p after %i tries.", base, base_attempts); + INFO_LOG(Log::MemMap, "Found valid memory base at %p after %i tries.", base, base_attempts); return true; } } - ERROR_LOG(MEMMAP, "MemoryMap_Setup: Failed finding a memory base."); + ERROR_LOG(Log::MemMap, "MemoryMap_Setup: Failed finding a memory base."); return false; } else @@ -309,7 +309,7 @@ bool Init() { return false; } - INFO_LOG(MEMMAP, "Memory system initialized. Base at %p (RAM at @ %p, uncached @ %p)", + INFO_LOG(Log::MemMap, "Memory system initialized. Base at %p (RAM at @ %p, uncached @ %p)", base, m_pPhysicalRAM, m_pUncachedRAM); MemFault_Init(); @@ -400,7 +400,7 @@ void Shutdown() { u32 flags = 0; MemoryMap_Shutdown(flags); base = nullptr; - DEBUG_LOG(MEMMAP, "Memory system shut down."); + DEBUG_LOG(Log::MemMap, "Memory system shut down."); } bool IsActive() { @@ -435,13 +435,13 @@ __forceinline static Opcode Read_Instruction(u32 address, bool resolveReplacemen u32 op; if (GetReplacedOpAt(address, &op)) { if (MIPS_IS_EMUHACK(op)) { - ERROR_LOG(MEMMAP, "WTF 1"); + ERROR_LOG(Log::MemMap, "WTF 1"); return Opcode(op); } else { return Opcode(op); } } else { - ERROR_LOG(MEMMAP, "Replacement, but no replacement op? %08x", inst.encoding); + ERROR_LOG(Log::MemMap, "Replacement, but no replacement op? %08x", inst.encoding); } } return inst; @@ -449,7 +449,7 @@ __forceinline static Opcode Read_Instruction(u32 address, bool resolveReplacemen u32 op; if (GetReplacedOpAt(address, &op)) { if (MIPS_IS_EMUHACK(op)) { - ERROR_LOG(MEMMAP, "WTF 2"); + ERROR_LOG(Log::MemMap, "WTF 2"); return Opcode(op); } else { return Opcode(op); diff --git a/Core/PSPLoaders.cpp b/Core/PSPLoaders.cpp index 623bc6032a..48c6ff5835 100644 --- a/Core/PSPLoaders.cpp +++ b/Core/PSPLoaders.cpp @@ -65,10 +65,10 @@ static void UseLargeMem(int memsize) { } if (Memory::g_PSPModel != PSP_MODEL_FAT) { - INFO_LOG(LOADER, "Game requested full PSP-2000 memory access"); + INFO_LOG(Log::Loader, "Game requested full PSP-2000 memory access"); Memory::g_MemorySize = Memory::RAM_DOUBLE_SIZE; } else { - WARN_LOG(LOADER, "Game requested full PSP-2000 memory access, ignoring in PSP-1000 mode"); + WARN_LOG(Log::Loader, "Game requested full PSP-2000 memory access, ignoring in PSP-1000 mode"); } } @@ -139,7 +139,7 @@ void InitMemoryForGameISO(FileLoader *fileLoader) { break; } if (g_RemasterMode) { - INFO_LOG(LOADER, "HDRemaster found, using increased memory"); + INFO_LOG(Log::Loader, "HDRemaster found, using increased memory"); } } @@ -247,7 +247,7 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) { pspFileSystem.ReadEntireFile(sfoPath, paramsfo); if (g_paramSFO.ReadSFO(paramsfo)) { std::string title = StringFromFormat("%s : %s", g_paramSFO.GetValueString("DISC_ID").c_str(), g_paramSFO.GetValueString("TITLE").c_str()); - INFO_LOG(LOADER, "%s", title.c_str()); + INFO_LOG(Log::Loader, "%s", title.c_str()); System_SetWindowTitle(title); } } @@ -282,7 +282,7 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) { pspFileSystem.CloseFile(fd); } if (!hasEncrypted) { - // try unencrypted BOOT.BIN + // try unencrypted Boot.BIN bootpath = "disc0:/PSP_GAME/SYSDIR/BOOT.BIN"; } @@ -307,7 +307,7 @@ bool Load_PSP_ISO(FileLoader *fileLoader, std::string *error_string) { //in case we didn't go through EmuScreen::boot g_Config.loadGameConfig(id, g_paramSFO.GetValueString("TITLE")); System_PostUIMessage(UIMessage::CONFIG_LOADED); - INFO_LOG(LOADER, "Loading %s...", bootpath.c_str()); + INFO_LOG(Log::Loader, "Loading %s...", bootpath.c_str()); PSPLoaders_Shutdown(); // Note: this thread reads the game binary, loads caches, and links HLE while UI spins. @@ -452,7 +452,7 @@ bool Load_PSP_ELF_PBP(FileLoader *fileLoader, std::string *error_string) { std::string madeUpID = g_paramSFO.GenerateFakeID(Path()); std::string title = StringFromFormat("%s : %s", discID.c_str(), homebrewTitle.c_str()); - INFO_LOG(LOADER, "%s", title.c_str()); + INFO_LOG(Log::Loader, "%s", title.c_str()); System_SetWindowTitle(title); // Migrate old save states from old versions of fake game IDs. diff --git a/Core/Replay.cpp b/Core/Replay.cpp index 4b375c45ef..00fc62eb22 100644 --- a/Core/Replay.cpp +++ b/Core/Replay.cpp @@ -138,11 +138,11 @@ static bool diskFailed = false; bool ReplayExecuteBlob(int version, const std::vector &data) { if (version < REPLAY_VERSION_MIN || version > REPLAY_VERSION_CURRENT) { - ERROR_LOG(SYSTEM, "Bad replay data version: %d", version); + ERROR_LOG(Log::System, "Bad replay data version: %d", version); return false; } if (data.size() == 0) { - ERROR_LOG(SYSTEM, "Empty replay data"); + ERROR_LOG(Log::System, "Empty replay data"); return false; } @@ -152,7 +152,7 @@ bool ReplayExecuteBlob(int version, const std::vector &data) { replayItems.reserve(data.size() / sizeof(ReplayItemHeader)); for (size_t i = 0, sz = data.size(); i < sz; ) { if (i + sizeof(ReplayItemHeader) > sz) { - ERROR_LOG(SYSTEM, "Truncated replay data at %lld during item header", (long long)i); + ERROR_LOG(Log::System, "Truncated replay data at %lld during item header", (long long)i); break; } ReplayItemHeader *info = (ReplayItemHeader *)&data[i]; @@ -161,7 +161,7 @@ bool ReplayExecuteBlob(int version, const std::vector &data) { if ((int)item.info.action & (int)ReplayAction::MASK_SIDEDATA) { if (i + item.info.size > sz) { - ERROR_LOG(SYSTEM, "Truncated replay data at %lld during side data", (long long)i); + ERROR_LOG(Log::System, "Truncated replay data at %lld during side data", (long long)i); break; } if (item.info.size != 0) { @@ -175,7 +175,7 @@ bool ReplayExecuteBlob(int version, const std::vector &data) { } replayState = ReplayState::EXECUTE; - INFO_LOG(SYSTEM, "Executing replay with %lld items", (long long)replayItems.size()); + INFO_LOG(Log::System, "Executing replay with %lld items", (long long)replayItems.size()); return true; } @@ -184,7 +184,7 @@ bool ReplayExecuteFile(const Path &filename) { FILE *fp = File::OpenCFile(filename, "rb"); if (!fp) { - DEBUG_LOG(SYSTEM, "Failed to open replay file: %s", filename.c_str()); + DEBUG_LOG(Log::System, "Failed to open replay file: %s", filename.c_str()); return false; } @@ -194,27 +194,27 @@ bool ReplayExecuteFile(const Path &filename) { // TODO: Maybe stream instead. size_t sz = File::GetFileSize(fp); if (sz <= sizeof(ReplayFileHeader)) { - ERROR_LOG(SYSTEM, "Empty replay data"); + ERROR_LOG(Log::System, "Empty replay data"); return false; } ReplayFileHeader fh; if (fread(&fh, sizeof(fh), 1, fp) != 1) { - ERROR_LOG(SYSTEM, "Could not read replay file header"); + ERROR_LOG(Log::System, "Could not read replay file header"); return false; } sz -= sizeof(fh); if (memcmp(fh.magic, REPLAY_MAGIC, sizeof(fh.magic)) != 0) { - ERROR_LOG(SYSTEM, "Replay header corrupt"); + ERROR_LOG(Log::System, "Replay header corrupt"); return false; } if (fh.version < REPLAY_VERSION_MIN) { - ERROR_LOG(SYSTEM, "Replay version %d unsupported", fh.version); + ERROR_LOG(Log::System, "Replay version %d unsupported", fh.version); return false; } else if (fh.version > REPLAY_VERSION_CURRENT) { - WARN_LOG(SYSTEM, "Replay version %d scary and futuristic, trying anyway", fh.version); + WARN_LOG(Log::System, "Replay version %d scary and futuristic, trying anyway", fh.version); } RtcSetBaseTime((int32_t)fh.rtcBaseSeconds, 0); @@ -223,7 +223,7 @@ bool ReplayExecuteFile(const Path &filename) { data.resize(sz); if (fread(&data[0], sz, 1, fp) != 1) { - ERROR_LOG(SYSTEM, "Could not read replay data"); + ERROR_LOG(Log::System, "Could not read replay data"); return false; } @@ -286,7 +286,7 @@ void ReplayFlushBlob(std::vector *data) { bool ReplayFlushFile(const Path &filename) { FILE *fp = File::OpenCFile(filename, replaySaveWroteHeader ? "ab" : "wb"); if (!fp) { - ERROR_LOG(SYSTEM, "Failed to open replay file: %s", filename.c_str()); + ERROR_LOG(Log::System, "Failed to open replay file: %s", filename.c_str()); return false; } @@ -311,9 +311,9 @@ bool ReplayFlushFile(const Path &filename) { fclose(fp); if (success) { - DEBUG_LOG(SYSTEM, "Flushed %lld replay items", (long long)c); + DEBUG_LOG(Log::System, "Flushed %lld replay items", (long long)c); } else { - ERROR_LOG(SYSTEM, "Could not write %lld replay items (disk full?)", (long long)c); + ERROR_LOG(Log::System, "Could not write %lld replay items (disk full?)", (long long)c); } return success; } diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 1a04c9a903..5e01300afa 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -131,7 +131,7 @@ namespace Reporting return 0; } if (!blockDevice->ReadBlock(i, block, true)) { - ERROR_LOG(FILESYS, "Failed to read block for CRC"); + ERROR_LOG(Log::FileSystem, "Failed to read block for CRC"); g_OSD.RemoveProgressBar("crc", false, 0.0f); return 0; } @@ -181,7 +181,7 @@ namespace Reporting return; } - INFO_LOG(SYSTEM, "Starting CRC calculation"); + INFO_LOG(Log::System, "Starting CRC calculation"); crcFilename = gamePath; crcPending = true; crcCancel = false; @@ -204,7 +204,7 @@ namespace Reporting } if (crcThread.joinable()) { - INFO_LOG(SYSTEM, "Finished CRC calculation"); + INFO_LOG(Log::System, "Finished CRC calculation"); crcThread.join(); } return it->second; @@ -222,13 +222,13 @@ namespace Reporting static void PurgeCRC() { std::unique_lock guard(crcLock); if (crcPending) { - INFO_LOG(SYSTEM, "Cancelling CRC calculation"); + INFO_LOG(Log::System, "Cancelling CRC calculation"); crcCancel = true; while (crcPending) { crcCond.wait(guard); } } else { - DEBUG_LOG(SYSTEM, "No CRC pending"); + DEBUG_LOG(Log::System, "No CRC pending"); } if (crcThread.joinable()) diff --git a/Core/RetroAchievements.cpp b/Core/RetroAchievements.cpp index 587a896f49..2ca6c2f811 100644 --- a/Core/RetroAchievements.cpp +++ b/Core/RetroAchievements.cpp @@ -246,7 +246,7 @@ bool WarnUserIfHardcoreModeActive(bool isSaveStateAction, std::string_view messa bool IsBlockingExecution() { if (g_isLoggingIn || g_isIdentifying) { // Useful for debugging race conditions. - // INFO_LOG(ACHIEVEMENTS, "isLoggingIn: %d isIdentifying: %d", (int)g_isLoggingIn, (int)g_isIdentifying); + // INFO_LOG(Log::Achievements, "isLoggingIn: %d isIdentifying: %d", (int)g_isLoggingIn, (int)g_isIdentifying); } return g_isLoggingIn || g_isIdentifying; } @@ -275,7 +275,7 @@ static uint32_t read_memory_callback(uint32_t address, uint8_t *buffer, uint32_t // So we'll just count the bad accesses. Achievements::g_stats.badMemoryAccessCount++; if (g_Config.bAchievementsLogBadMemReads) { - WARN_LOG(G3D, "RetroAchievements PeekMemory: Bad address %08x (%d bytes) (%08x was passed in)", address, num_bytes, orig_address); + WARN_LOG(Log::G3D, "RetroAchievements PeekMemory: Bad address %08x (%d bytes) (%08x was passed in)", address, num_bytes, orig_address); } // This tells rcheevos that the access was bad, which should now be handled properly. @@ -317,7 +317,7 @@ static void server_call_callback(const rc_api_request_t *request, } static void log_message_callback(const char *message, const rc_client_t *client) { - INFO_LOG(ACHIEVEMENTS, "RetroAchievements: %s", message); + INFO_LOG(Log::Achievements, "RetroAchievements: %s", message); } // For detailed documentation, see https://github.com/RetroAchievements/rcheevos/wiki/rc_client_set_event_handler. @@ -329,7 +329,7 @@ static void event_handler_callback(const rc_client_event_t *event, rc_client_t * // An achievement was earned by the player. The handler should notify the player that the achievement was earned. g_OSD.ShowAchievementUnlocked(event->achievement->id); System_PostUIMessage(UIMessage::REQUEST_PLAY_SOUND, "achievement_unlocked"); - INFO_LOG(ACHIEVEMENTS, "Achievement unlocked: '%s' (%d)", event->achievement->title, event->achievement->id); + INFO_LOG(Log::Achievements, "Achievement unlocked: '%s' (%d)", event->achievement->title, event->achievement->id); break; case RC_CLIENT_EVENT_GAME_COMPLETED: @@ -353,7 +353,7 @@ static void event_handler_callback(const rc_client_event_t *event, rc_client_t * System_PostUIMessage(UIMessage::REQUEST_PLAY_SOUND, "achievement_unlocked"); - INFO_LOG(ACHIEVEMENTS, "%s", message.c_str()); + INFO_LOG(Log::Achievements, "%s", message.c_str()); break; } case RC_CLIENT_EVENT_LEADERBOARD_STARTED: @@ -370,13 +370,13 @@ static void event_handler_callback(const rc_client_event_t *event, rc_client_t * } else { title = event->leaderboard->description; } - INFO_LOG(ACHIEVEMENTS, "Attempt %s: %s", started ? "started" : "failed", title); + INFO_LOG(Log::Achievements, "Attempt %s: %s", started ? "started" : "failed", title); g_OSD.ShowLeaderboardStartEnd(ApplySafeSubstitutions(ac->T(started ? "%1: Attempt started" : "%1: Attempt failed"), title), description, started); break; } case RC_CLIENT_EVENT_LEADERBOARD_SUBMITTED: { - INFO_LOG(ACHIEVEMENTS, "Leaderboard result submitted: %s", event->leaderboard->title); + INFO_LOG(Log::Achievements, "Leaderboard result submitted: %s", event->leaderboard->title); const char *title = ""; // Hack around some problematic events in Burnout Legends. Hopefully this can be fixed in the backend. if (strlen(event->leaderboard->title) > 0) { @@ -389,20 +389,20 @@ static void event_handler_callback(const rc_client_event_t *event, rc_client_t * break; } case RC_CLIENT_EVENT_ACHIEVEMENT_CHALLENGE_INDICATOR_SHOW: - INFO_LOG(ACHIEVEMENTS, "Challenge indicator show: %s", event->achievement->title); + INFO_LOG(Log::Achievements, "Challenge indicator show: %s", event->achievement->title); g_OSD.ShowChallengeIndicator(event->achievement->id, true); g_activeChallenges.insert(event->achievement->id); // A challenge achievement has become active. The handler should show a small version of the achievement icon // to indicate the challenge is active. break; case RC_CLIENT_EVENT_ACHIEVEMENT_CHALLENGE_INDICATOR_HIDE: - INFO_LOG(ACHIEVEMENTS, "Challenge indicator hide: %s", event->achievement->title); + INFO_LOG(Log::Achievements, "Challenge indicator hide: %s", event->achievement->title); g_OSD.ShowChallengeIndicator(event->achievement->id, false); g_activeChallenges.erase(event->achievement->id); // The handler should hide the small version of the achievement icon that was shown by the corresponding RC_CLIENT_EVENT_ACHIEVEMENT_CHALLENGE_INDICATOR_SHOW event. break; case RC_CLIENT_EVENT_ACHIEVEMENT_PROGRESS_INDICATOR_SHOW: - INFO_LOG(ACHIEVEMENTS, "Progress indicator show: %s, progress: '%s' (%f)", event->achievement->title, event->achievement->measured_progress, event->achievement->measured_percent); + INFO_LOG(Log::Achievements, "Progress indicator show: %s, progress: '%s' (%f)", event->achievement->title, event->achievement->measured_progress, event->achievement->measured_percent); // An achievement that tracks progress has changed the amount of progress that has been made. // The handler should show a small version of the achievement icon along with the achievement->measured_progress text (for two seconds). // Only one progress indicator should be shown at a time. @@ -410,11 +410,11 @@ static void event_handler_callback(const rc_client_event_t *event, rc_client_t * g_OSD.ShowAchievementProgress(event->achievement->id, true); break; case RC_CLIENT_EVENT_ACHIEVEMENT_PROGRESS_INDICATOR_UPDATE: - INFO_LOG(ACHIEVEMENTS, "Progress indicator update: %s, progress: '%s' (%f)", event->achievement->title, event->achievement->measured_progress, event->achievement->measured_percent); + INFO_LOG(Log::Achievements, "Progress indicator update: %s, progress: '%s' (%f)", event->achievement->title, event->achievement->measured_progress, event->achievement->measured_percent); g_OSD.ShowAchievementProgress(event->achievement->id, true); break; case RC_CLIENT_EVENT_ACHIEVEMENT_PROGRESS_INDICATOR_HIDE: - INFO_LOG(ACHIEVEMENTS, "Progress indicator hide"); + INFO_LOG(Log::Achievements, "Progress indicator hide"); // An achievement that tracks progress has changed the amount of progress that has been made. // The handler should show a small version of the achievement icon along with the achievement->measured_progress text (for two seconds). // Only one progress indicator should be shown at a time. @@ -422,7 +422,7 @@ static void event_handler_callback(const rc_client_event_t *event, rc_client_t * g_OSD.ShowAchievementProgress(0, false); break; case RC_CLIENT_EVENT_LEADERBOARD_TRACKER_SHOW: - INFO_LOG(ACHIEVEMENTS, "Leaderboard tracker show: '%s' (id %d)", event->leaderboard_tracker->display, event->leaderboard_tracker->id); + INFO_LOG(Log::Achievements, "Leaderboard tracker show: '%s' (id %d)", event->leaderboard_tracker->display, event->leaderboard_tracker->id); // A leaderboard_tracker has become active. The handler should show the tracker text on screen. // Multiple active leaderboards may share a single tracker if they have the same definition and value. // As such, the leaderboard tracker IDs are unique amongst the leaderboard trackers, and have no correlation to the active leaderboard(s). @@ -431,25 +431,25 @@ static void event_handler_callback(const rc_client_event_t *event, rc_client_t * break; case RC_CLIENT_EVENT_LEADERBOARD_TRACKER_HIDE: // A leaderboard_tracker has become inactive. The handler should hide the tracker text from the screen. - INFO_LOG(ACHIEVEMENTS, "Leaderboard tracker hide: '%s' (id %d)", event->leaderboard_tracker->display, event->leaderboard_tracker->id); + INFO_LOG(Log::Achievements, "Leaderboard tracker hide: '%s' (id %d)", event->leaderboard_tracker->display, event->leaderboard_tracker->id); g_OSD.ShowLeaderboardTracker(event->leaderboard_tracker->id, nullptr, false); break; case RC_CLIENT_EVENT_LEADERBOARD_TRACKER_UPDATE: // A leaderboard_tracker value has been updated. The handler should update the tracker text on the screen. - INFO_LOG(ACHIEVEMENTS, "Leaderboard tracker update: '%s' (id %d)", event->leaderboard_tracker->display, event->leaderboard_tracker->id); + INFO_LOG(Log::Achievements, "Leaderboard tracker update: '%s' (id %d)", event->leaderboard_tracker->display, event->leaderboard_tracker->id); g_OSD.ShowLeaderboardTracker(event->leaderboard_tracker->id, event->leaderboard_tracker->display, true); break; case RC_CLIENT_EVENT_RESET: - WARN_LOG(ACHIEVEMENTS, "Resetting game due to achievement setting change!"); + WARN_LOG(Log::Achievements, "Resetting game due to achievement setting change!"); // Hardcore mode was enabled, or something else that forces a game reset. System_PostUIMessage(UIMessage::REQUEST_GAME_RESET); break; case RC_CLIENT_EVENT_SERVER_ERROR: - ERROR_LOG(ACHIEVEMENTS, "Server error: %s: %s", event->server_error->api, event->server_error->error_message); + ERROR_LOG(Log::Achievements, "Server error: %s: %s", event->server_error->api, event->server_error->error_message); g_OSD.Show(OSDType::MESSAGE_ERROR, "Server error", "", g_RAImageID); break; default: - WARN_LOG(ACHIEVEMENTS, "Unhandled rc_client event %d, ignoring", event->type); + WARN_LOG(Log::Achievements, "Unhandled rc_client event %d, ignoring", event->type); break; } } @@ -459,7 +459,7 @@ static void login_token_callback(int result, const char *error_message, rc_clien switch (result) { case RC_OK: { - INFO_LOG(ACHIEVEMENTS, "Successful login by token."); + INFO_LOG(Log::Achievements, "Successful login by token."); OnAchievementsLoginStateChange(); if (!isInitialAttempt) { auto ac = GetI18NCategory(I18NCat::ACHIEVEMENTS); @@ -484,7 +484,7 @@ static void login_token_callback(int result, const char *error_message, rc_clien case RC_INVALID_JSON: default: { - ERROR_LOG(ACHIEVEMENTS, "Callback: Failure logging in via token: %d, %s", result, error_message); + ERROR_LOG(Log::Achievements, "Callback: Failure logging in via token: %d, %s", result, error_message); if (isInitialAttempt) { auto ac = GetI18NCategory(I18NCat::ACHIEVEMENTS); g_OSD.Show(OSDType::MESSAGE_WARNING, ac->T("Failed logging in to RetroAchievements"), "", g_RAImageID); @@ -534,7 +534,7 @@ static void raintegration_event_handler(const rc_client_raintegration_event_t *e g_Config.bAchievementsHardcoreMode = rc_client_get_hardcore_enabled(client); break; default: - ERROR_LOG(ACHIEVEMENTS, "Unsupported raintegration event %u\n", event->type); + ERROR_LOG(Log::Achievements, "Unsupported raintegration event %u\n", event->type); break; } } @@ -584,7 +584,7 @@ static void load_integration_callback(int result, const char *error_message, rc_ void Initialize() { if (!g_Config.bAchievementsEnable) { _dbg_assert_(!g_rcClient); - INFO_LOG(ACHIEVEMENTS, "Achievements are disabled, not initializing."); + INFO_LOG(Log::Achievements, "Achievements are disabled, not initializing."); return; } _assert_msg_(!g_rcClient, "Achievements already initialized"); @@ -676,7 +676,7 @@ static void login_password_callback(int result, const char *error_message, rc_cl case RC_EXPIRED_TOKEN: default: { - ERROR_LOG(ACHIEVEMENTS, "Failure logging in via password: %d, %s", result, error_message); + ERROR_LOG(Log::Achievements, "Failure logging in via password: %d, %s", result, error_message); g_OSD.Show(OSDType::MESSAGE_WARNING, di->T("Failed to log in, check your username and password."), "", g_RAImageID); OnAchievementsLoginStateChange(); break; @@ -731,12 +731,12 @@ bool Shutdown() { #endif rc_client_destroy(g_rcClient); g_rcClient = nullptr; - INFO_LOG(ACHIEVEMENTS, "Achievements shut down."); + INFO_LOG(Log::Achievements, "Achievements shut down."); return true; } void ResetRuntime() { - INFO_LOG(ACHIEVEMENTS, "Resetting rcheevos state..."); + INFO_LOG(Log::Achievements, "Resetting rcheevos state..."); rc_client_reset(g_rcClient); g_activeChallenges.clear(); } @@ -767,7 +767,7 @@ void Idle() { // In this situation, there's a token, but we're not logged in. Probably disrupted internet connection // during startup. // Let's make an attempt. - INFO_LOG(ACHIEVEMENTS, "Retrying login.."); + INFO_LOG(Log::Achievements, "Retrying login.."); TryLoginByToken(false); } } @@ -790,7 +790,7 @@ void DoState(PointerWrap &p) { if (!IsActive()) { Do(p, data_size); if (p.mode == PointerWrap::MODE_READ) { - WARN_LOG(ACHIEVEMENTS, "Save state contained achievement data, but achievements are not active. Ignore."); + WARN_LOG(Log::Achievements, "Save state contained achievement data, but achievements are not active. Ignore."); } p.SkipBytes(data_size); return; @@ -811,7 +811,7 @@ void DoState(PointerWrap &p) { { int retval = rc_client_serialize_progress(g_rcClient, buffer); if (retval != RC_OK) { - ERROR_LOG(ACHIEVEMENTS, "Error %d serializing achievement data. Ignoring.", retval); + ERROR_LOG(Log::Achievements, "Error %d serializing achievement data. Ignoring.", retval); } break; } @@ -827,7 +827,7 @@ void DoState(PointerWrap &p) { int retval = rc_client_deserialize_progress(g_rcClient, buffer); if (retval != RC_OK) { // TODO: What should we really do here? - ERROR_LOG(ACHIEVEMENTS, "Error %d deserializing achievement data. Ignoring.", retval); + ERROR_LOG(Log::Achievements, "Error %d deserializing achievement data. Ignoring.", retval); } break; } @@ -853,7 +853,7 @@ bool HasAchievementsOrLeaderboards() { void DownloadImageIfMissing(const std::string &cache_key, std::string &&url) { if (g_iconCache.MarkPending(cache_key)) { - INFO_LOG(ACHIEVEMENTS, "Downloading image: %s (%s)", url.c_str(), cache_key.c_str()); + INFO_LOG(Log::Achievements, "Downloading image: %s (%s)", url.c_str(), cache_key.c_str()); g_DownloadManager.StartDownloadWithCallback(url, Path(), http::ProgressBarMode::NONE, [cache_key](http::Request &download) { if (download.ResultCode() != 200) return; @@ -906,7 +906,7 @@ void ShowNotLoggedInMessage() { void identify_and_load_callback(int result, const char *error_message, rc_client_t *client, void *userdata) { auto ac = GetI18NCategory(I18NCat::ACHIEVEMENTS); - NOTICE_LOG(ACHIEVEMENTS, "Load callback: %d (%s)", result, error_message); + NOTICE_LOG(Log::Achievements, "Load callback: %d (%s)", result, error_message); switch (result) { case RC_OK: @@ -934,7 +934,7 @@ void identify_and_load_callback(int result, const char *error_message, rc_client break; default: // Other various errors. - ERROR_LOG(ACHIEVEMENTS, "Failed to identify/load game: %d (%s)", result, error_message); + ERROR_LOG(Log::Achievements, "Failed to identify/load game: %d (%s)", result, error_message); g_OSD.Show(OSDType::MESSAGE_ERROR, ac->T("Failed to identify game. Achievements will not unlock."), "", g_RAImageID, 6.0f); break; } @@ -961,14 +961,14 @@ void SetGame(const Path &path, IdentifiedFileType fileType, FileLoader *fileLoad default: // Other file types are not yet supported. // TODO: Should we show an OSD popup here? - WARN_LOG(ACHIEVEMENTS, "File type of '%s' is not yet compatible with RetroAchievements", path.c_str()); + WARN_LOG(Log::Achievements, "File type of '%s' is not yet compatible with RetroAchievements", path.c_str()); return; } if (g_isLoggingIn) { // IsReadyToStart should have been checked the same frame, so we shouldn't be here. // Maybe there's a race condition possible, but don't think so. - ERROR_LOG(ACHIEVEMENTS, "Still logging in during SetGame - shouldn't happen"); + ERROR_LOG(Log::Achievements, "Still logging in during SetGame - shouldn't happen"); } if (!g_rcClient || !IsLoggedIn()) { @@ -993,7 +993,7 @@ void SetGame(const Path &path, IdentifiedFileType fileType, FileLoader *fileLoad // we need a temporary blockdevice anyway since it gets consumed by ComputePSPISOHash. BlockDevice *blockDevice(constructBlockDevice(fileLoader)); if (!blockDevice) { - ERROR_LOG(ACHIEVEMENTS, "Failed to construct block device for '%s' - can't identify", path.c_str()); + ERROR_LOG(Log::Achievements, "Failed to construct block device for '%s' - can't identify", path.c_str()); g_isIdentifying = false; return; } @@ -1001,7 +1001,7 @@ void SetGame(const Path &path, IdentifiedFileType fileType, FileLoader *fileLoad // This consumes the blockDevice. s_game_hash = ComputePSPISOHash(blockDevice); if (!s_game_hash.empty()) { - INFO_LOG(ACHIEVEMENTS, "Hash: %s", s_game_hash.c_str()); + INFO_LOG(Log::Achievements, "Hash: %s", s_game_hash.c_str()); } } @@ -1023,7 +1023,7 @@ void UnloadGame() { void change_media_callback(int result, const char *error_message, rc_client_t *client, void *userdata) { auto ac = GetI18NCategory(I18NCat::ACHIEVEMENTS); - NOTICE_LOG(ACHIEVEMENTS, "Change media callback: %d (%s)", result, error_message); + NOTICE_LOG(Log::Achievements, "Change media callback: %d (%s)", result, error_message); g_isIdentifying = false; switch (result) { @@ -1042,7 +1042,7 @@ void change_media_callback(int result, const char *error_message, rc_client_t *c break; default: // Other various errors. - ERROR_LOG(ACHIEVEMENTS, "Failed to identify/load game: %d (%s)", result, error_message); + ERROR_LOG(Log::Achievements, "Failed to identify/load game: %d (%s)", result, error_message); g_OSD.Show(OSDType::MESSAGE_ERROR, ac->T("Failed to identify game. Achievements will not unlock."), "", g_RAImageID, 6.0f); break; } @@ -1056,7 +1056,7 @@ void ChangeUMD(const Path &path, FileLoader *fileLoader) { BlockDevice *blockDevice = constructBlockDevice(fileLoader); if (!blockDevice) { - ERROR_LOG(ACHIEVEMENTS, "Failed to construct block device for '%s' - can't identify", path.c_str()); + ERROR_LOG(Log::Achievements, "Failed to construct block device for '%s' - can't identify", path.c_str()); return; } @@ -1065,7 +1065,7 @@ void ChangeUMD(const Path &path, FileLoader *fileLoader) { // This consumes the blockDevice. s_game_hash = ComputePSPISOHash(blockDevice); if (s_game_hash.empty()) { - ERROR_LOG(ACHIEVEMENTS, "Failed to hash - can't identify"); + ERROR_LOG(Log::Achievements, "Failed to hash - can't identify"); return; } diff --git a/Core/RetroAchievements.h b/Core/RetroAchievements.h index 2d68258a3b..3646b53236 100644 --- a/Core/RetroAchievements.h +++ b/Core/RetroAchievements.h @@ -57,7 +57,7 @@ bool IsBlockingExecution(); bool HardcoreModeActive(); // Same as ChallengeModeActive but comes with a convenient user message. Don't use for every-frame checks or UI enablement, -// only for shortcut keys and commands. You should look up the message in I18NCat::ACHIEVEMENTS. +// only for shortcut keys and commands. You should look up the message in I18NCat::Achievements. // If no message is specified, a standard "This feature is not available in Hardcore Mode" message will be shown. // Also returns true if hardcore mode is active. // Specify isSaveAction so we can still permit saves (but not loads) in hardcore mode if that option is enabled. diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index fb42b68bdc..202fdaf972 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -211,7 +211,7 @@ namespace SaveState } double taken_s = time_now_d() - start_time; - DEBUG_LOG(SAVESTATE, "Rewind: Compressed save from %d bytes to %d in %0.2f ms.", (int)state.size(), (int)result.size(), taken_s * 1000.0); + DEBUG_LOG(Log::SaveState, "Rewind: Compressed save from %d bytes to %d in %0.2f ms.", (int)state.size(), (int)result.size(), taken_s * 1000.0); } void LockedDecompress(std::vector &result, const std::vector &compressed, const std::vector &base) @@ -285,7 +285,7 @@ namespace SaveState if (diff < g_Config.iRewindSnapshotInterval) return; - DEBUG_LOG(SAVESTATE, "Saving rewind state"); + DEBUG_LOG(Log::SaveState, "Saving rewind state"); Save(); } @@ -588,7 +588,7 @@ namespace SaveState g_Config.sStateLoadUndoGame = GenerateFullDiscId(gameFilename); g_Config.Save("Saving config for savestate last load undo"); } else { - ERROR_LOG(SAVESTATE, "Saving load undo state failed: %.*s", (int)message.size(), message.data()); + ERROR_LOG(Log::SaveState, "Saving load undo state failed: %.*s", (int)message.size(), message.data()); } Load(fn, slot, callback, cbUserData); }; @@ -596,7 +596,7 @@ namespace SaveState if (!backup.empty()) { Save(backup.WithExtraExtension(".tmp"), LOAD_UNDO_SLOT, saveCallback, cbUserData); } else { - ERROR_LOG(SAVESTATE, "Saving load undo state failed. Error in the file system."); + ERROR_LOG(Log::SaveState, "Saving load undo state failed. Error in the file system."); Load(fn, slot, callback, cbUserData); } } else { @@ -837,7 +837,7 @@ namespace SaveState bool HandleLoadFailure() { - WARN_LOG(SAVESTATE, "HandleLoadFailure - trying a rewind state."); + WARN_LOG(Log::SaveState, "HandleLoadFailure - trying a rewind state."); // Okay, first, let's give the rewind state a shot - maybe we can at least not reset entirely. // Even if this was a rewind, maybe we can still load a previous one. @@ -922,7 +922,7 @@ namespace SaveState if (!__KernelIsRunning()) { - ERROR_LOG(SAVESTATE, "Savestate failure: Unable to load without kernel, this should never happen."); + ERROR_LOG(Log::SaveState, "Savestate failure: Unable to load without kernel, this should never happen."); return; } @@ -948,7 +948,7 @@ namespace SaveState switch (op.type) { case SAVESTATE_LOAD: - INFO_LOG(SAVESTATE, "Loading state from '%s'", op.filename.c_str()); + INFO_LOG(Log::SaveState, "Loading state from '%s'", op.filename.c_str()); // Use the state's latest version as a guess for saveStateInitialGitVersion. result = CChunkFileReader::Load(op.filename, &saveStateInitialGitVersion, state, &errorString); if (result == CChunkFileReader::ERROR_NONE) { @@ -974,7 +974,7 @@ namespace SaveState } else if (result == CChunkFileReader::ERROR_BROKEN_STATE) { HandleLoadFailure(); callbackMessage = std::string(i18nLoadFailure) + ": " + errorString; - ERROR_LOG(SAVESTATE, "Load state failure: %s", errorString.c_str()); + ERROR_LOG(Log::SaveState, "Load state failure: %s", errorString.c_str()); callbackResult = Status::FAILURE; } else { callbackMessage = sc->T(errorString.c_str(), i18nLoadFailure); @@ -983,7 +983,7 @@ namespace SaveState break; case SAVESTATE_SAVE: - INFO_LOG(SAVESTATE, "Saving state to %s", op.filename.c_str()); + INFO_LOG(Log::SaveState, "Saving state to %s", op.filename.c_str()); title = g_paramSFO.GetValueString("TITLE"); if (title.empty()) { // Homebrew title @@ -1009,7 +1009,7 @@ namespace SaveState } else if (result == CChunkFileReader::ERROR_BROKEN_STATE) { // TODO: What else might we want to do here? This should be very unusual. callbackMessage = i18nSaveFailure; - ERROR_LOG(SAVESTATE, "Save state failure"); + ERROR_LOG(Log::SaveState, "Save state failure"); callbackResult = Status::FAILURE; } else { callbackMessage = i18nSaveFailure; @@ -1021,14 +1021,14 @@ namespace SaveState tempResult = CChunkFileReader::Verify(state) == CChunkFileReader::ERROR_NONE; callbackResult = tempResult ? Status::SUCCESS : Status::FAILURE; if (tempResult) { - INFO_LOG(SAVESTATE, "Verified save state system"); + INFO_LOG(Log::SaveState, "Verified save state system"); } else { - ERROR_LOG(SAVESTATE, "Save state system verification failed"); + ERROR_LOG(Log::SaveState, "Save state system verification failed"); } break; case SAVESTATE_REWIND: - INFO_LOG(SAVESTATE, "Rewinding to recent savestate snapshot"); + INFO_LOG(Log::SaveState, "Rewinding to recent savestate snapshot"); result = rewindStates.Restore(&errorString); if (result == CChunkFileReader::ERROR_NONE) { callbackMessage = sc->T("Loaded State"); @@ -1059,7 +1059,7 @@ namespace SaveState tempResult = TakeGameScreenshot(nullptr, op.filename, ScreenshotFormat::JPG, SCREENSHOT_DISPLAY, nullptr, nullptr, maxResMultiplier); callbackResult = tempResult ? Status::SUCCESS : Status::FAILURE; if (!tempResult) { - ERROR_LOG(SAVESTATE, "Failed to take a screenshot for the savestate! %s", op.filename.c_str()); + ERROR_LOG(Log::SaveState, "Failed to take a screenshot for the savestate! %s", op.filename.c_str()); if (screenshotFailures++ < SCREENSHOT_FAILURE_RETRIES) { // Requeue for next frame. SaveScreenshot(op.filename, op.callback, op.cbUserData); @@ -1070,7 +1070,7 @@ namespace SaveState break; } default: - ERROR_LOG(SAVESTATE, "Savestate failure: unknown operation type %d", op.type); + ERROR_LOG(Log::SaveState, "Savestate failure: unknown operation type %d", op.type); callbackResult = Status::FAILURE; break; } @@ -1094,7 +1094,7 @@ namespace SaveState PSP_Shutdown(); std::string resetError; if (!PSP_Init(PSP_CoreParameter(), &resetError)) { - ERROR_LOG(BOOT, "Error resetting: %s", resetError.c_str()); + ERROR_LOG(Log::Boot, "Error resetting: %s", resetError.c_str()); // TODO: This probably doesn't clean up well enough. Core_Stop(); return; diff --git a/Core/Screenshot.cpp b/Core/Screenshot.cpp index 9c267204a9..bb12cb3b31 100644 --- a/Core/Screenshot.cpp +++ b/Core/Screenshot.cpp @@ -70,7 +70,7 @@ private: static bool WriteScreenshotToJPEG(const Path &filename, int width, int height, int num_channels, const uint8_t *image_data, const jpge::params &comp_params) { JPEGFileStream dst_stream(filename); if (!dst_stream.Valid()) { - ERROR_LOG(IO, "Unable to open screenshot file for writing."); + ERROR_LOG(Log::IO, "Unable to open screenshot file for writing."); return false; } @@ -92,7 +92,7 @@ static bool WriteScreenshotToJPEG(const Path &filename, int width, int height, i } if (!dst_stream.Valid()) { - ERROR_LOG(SYSTEM, "Screenshot file write failed."); + ERROR_LOG(Log::System, "Screenshot file write failed."); } dst_image.deinit(); @@ -102,7 +102,7 @@ static bool WriteScreenshotToJPEG(const Path &filename, int width, int height, i static bool WriteScreenshotToPNG(png_imagep image, const Path &filename, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) { FILE *fp = File::OpenCFile(filename, "wb"); if (!fp) { - ERROR_LOG(IO, "Unable to open screenshot file for writing."); + ERROR_LOG(Log::IO, "Unable to open screenshot file for writing."); return false; } @@ -110,7 +110,7 @@ static bool WriteScreenshotToPNG(png_imagep image, const Path &filename, int con fclose(fp); return true; } else { - ERROR_LOG(IO, "Screenshot PNG encode failed."); + ERROR_LOG(Log::IO, "Screenshot PNG encode failed."); fclose(fp); // Should we even do this? File::Delete(filename); @@ -337,7 +337,7 @@ bool TakeGameScreenshot(Draw::DrawContext *draw, const Path &filename, Screensho if (type == SCREENSHOT_DISPLAY || type == SCREENSHOT_RENDER) { if (!gpuDebug) { - ERROR_LOG(SYSTEM, "Can't take screenshots when GPU not running"); + ERROR_LOG(Log::System, "Can't take screenshots when GPU not running"); return false; } success = gpuDebug->GetCurrentFramebuffer(buf, type == SCREENSHOT_RENDER ? GPU_DBG_FRAMEBUF_RENDER : GPU_DBG_FRAMEBUF_DISPLAY, maxRes); @@ -356,7 +356,7 @@ bool TakeGameScreenshot(Draw::DrawContext *draw, const Path &filename, Screensho } if (!success) { - ERROR_LOG(G3D, "Failed to obtain screenshot data."); + ERROR_LOG(Log::G3D, "Failed to obtain screenshot data."); return false; } @@ -376,7 +376,7 @@ bool TakeGameScreenshot(Draw::DrawContext *draw, const Path &filename, Screensho } if (!success) { - ERROR_LOG(IO, "Failed to write screenshot."); + ERROR_LOG(Log::IO, "Failed to write screenshot."); } return success; @@ -394,7 +394,7 @@ bool Save888RGBScreenshot(const Path &filename, ScreenshotFormat fmt, const u8 * png_image_free(&png); if (png.warning_or_error >= 2) { - ERROR_LOG(IO, "Saving screenshot to PNG produced errors."); + ERROR_LOG(Log::IO, "Saving screenshot to PNG produced errors."); success = false; } return success; @@ -417,7 +417,7 @@ bool Save8888RGBAScreenshot(const Path &filename, const u8 *buffer, int w, int h png_image_free(&png); if (png.warning_or_error >= 2) { - ERROR_LOG(IO, "Saving screenshot to PNG produced errors."); + ERROR_LOG(Log::IO, "Saving screenshot to PNG produced errors."); success = false; } return success; @@ -444,7 +444,7 @@ bool Save8888RGBAScreenshot(std::vector &bufferPNG, const u8 *bufferRGB png_image_free(&png); if (!success) { - ERROR_LOG(IO, "Buffering screenshot to PNG produced errors."); + ERROR_LOG(Log::IO, "Buffering screenshot to PNG produced errors."); bufferPNG.clear(); } return success; diff --git a/Core/System.cpp b/Core/System.cpp index 01cd8fb066..0c46edec3c 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -271,12 +271,12 @@ bool CPU_Init(std::string *errorString, FileLoader *loadedFile) { case IdentifiedFileType::PSP_PBP: case IdentifiedFileType::PSP_PBP_DIRECTORY: // This is normal for homebrew. - // ERROR_LOG(LOADER, "PBP directory resolution failed."); + // ERROR_LOG(Log::Loader, "PBP directory resolution failed."); InitMemoryForGamePBP(loadedFile); break; case IdentifiedFileType::PSP_ELF: if (Memory::g_PSPModel != PSP_MODEL_FAT) { - INFO_LOG(LOADER, "ELF, using full PSP-2000 memory access"); + INFO_LOG(Log::Loader, "ELF, using full PSP-2000 memory access"); Memory::g_MemorySize = Memory::RAM_DOUBLE_SIZE; } break; @@ -290,7 +290,7 @@ bool CPU_Init(std::string *errorString, FileLoader *loadedFile) { break; default: // Can we even get here? - WARN_LOG(LOADER, "CPU_Init didn't recognize file. %s", errorString->c_str()); + WARN_LOG(Log::Loader, "CPU_Init didn't recognize file. %s", errorString->c_str()); break; } @@ -421,11 +421,11 @@ bool PSP_InitStart(const CoreParameter &coreParam, std::string *error_string) { } #if defined(_WIN32) && PPSSPP_ARCH(AMD64) - NOTICE_LOG(BOOT, "PPSSPP %s Windows 64 bit", PPSSPP_GIT_VERSION); + NOTICE_LOG(Log::Boot, "PPSSPP %s Windows 64 bit", PPSSPP_GIT_VERSION); #elif defined(_WIN32) && !PPSSPP_ARCH(AMD64) - NOTICE_LOG(BOOT, "PPSSPP %s Windows 32 bit", PPSSPP_GIT_VERSION); + NOTICE_LOG(Log::Boot, "PPSSPP %s Windows 32 bit", PPSSPP_GIT_VERSION); #else - NOTICE_LOG(BOOT, "PPSSPP %s", PPSSPP_GIT_VERSION); + NOTICE_LOG(Log::Boot, "PPSSPP %s", PPSSPP_GIT_VERSION); #endif Core_NotifyLifecycle(CoreLifecycle::STARTING); @@ -704,7 +704,7 @@ Path GetSysDirectory(PSPDirectories directoryType) { return g_Config.memStickDirectory; // Just return the memory stick root if we run into some sort of problem. default: - ERROR_LOG(FILESYS, "Unknown directory type."); + ERROR_LOG(Log::FileSystem, "Unknown directory type."); return g_Config.memStickDirectory; } } @@ -717,10 +717,10 @@ bool CreateSysDirectories() { #endif Path pspDir = GetSysDirectory(DIRECTORY_PSP); - INFO_LOG(IO, "Creating '%s' and subdirs:", pspDir.c_str()); + INFO_LOG(Log::IO, "Creating '%s' and subdirs:", pspDir.c_str()); File::CreateDir(pspDir); if (!File::Exists(pspDir)) { - INFO_LOG(IO, "Not a workable memstick directory. Giving up"); + INFO_LOG(Log::IO, "Not a workable memstick directory. Giving up"); return false; } diff --git a/Core/Util/BlockAllocator.cpp b/Core/Util/BlockAllocator.cpp index 270cca6508..72907d7aea 100644 --- a/Core/Util/BlockAllocator.cpp +++ b/Core/Util/BlockAllocator.cpp @@ -61,7 +61,7 @@ u32 BlockAllocator::AllocAligned(u32 &size, u32 sizeGrain, u32 grain, bool fromT { // Sanity check if (size == 0 || size > rangeSize_) { - ERROR_LOG(SCEKERNEL, "Clearly bogus size: %08x - failing allocation", size); + ERROR_LOG(Log::sceKernel, "Clearly bogus size: %08x - failing allocation", size); return -1; } @@ -139,7 +139,7 @@ u32 BlockAllocator::AllocAligned(u32 &size, u32 sizeGrain, u32 grain, bool fromT //Out of memory :( ListBlocks(); - ERROR_LOG(SCEKERNEL, "Block Allocator (%08x-%08x) failed to allocate %i (%08x) bytes of contiguous memory", rangeStart_, rangeStart_ + rangeSize_, size, size); + ERROR_LOG(Log::sceKernel, "Block Allocator (%08x-%08x) failed to allocate %i (%08x) bytes of contiguous memory", rangeStart_, rangeStart_ + rangeSize_, size, size); return -1; } @@ -153,7 +153,7 @@ u32 BlockAllocator::AllocAt(u32 position, u32 size, const char *tag) { CheckBlocks(); if (size > rangeSize_) { - ERROR_LOG(SCEKERNEL, "Clearly bogus size: %08x - failing allocation", size); + ERROR_LOG(Log::sceKernel, "Clearly bogus size: %08x - failing allocation", size); return -1; } @@ -161,7 +161,7 @@ u32 BlockAllocator::AllocAt(u32 position, u32 size, const char *tag) u32 alignedPosition = position; u32 alignedSize = size; if (position & (grain_ - 1)) { - DEBUG_LOG(SCEKERNEL, "Position %08x does not align to grain.", position); + DEBUG_LOG(Log::sceKernel, "Position %08x does not align to grain.", position); alignedPosition &= ~(grain_ - 1); // Since the position was decreased, size must increase. @@ -179,7 +179,7 @@ u32 BlockAllocator::AllocAt(u32 position, u32 size, const char *tag) Block &b = *bp; if (b.taken) { - ERROR_LOG(SCEKERNEL, "Block allocator AllocAt failed, block taken! %08x, %i", position, size); + ERROR_LOG(Log::sceKernel, "Block allocator AllocAt failed, block taken! %08x, %i", position, size); return -1; } else @@ -187,7 +187,7 @@ u32 BlockAllocator::AllocAt(u32 position, u32 size, const char *tag) // Make sure the block is big enough to split. if (b.start + b.size < alignedPosition + alignedSize) { - ERROR_LOG(SCEKERNEL, "Block allocator AllocAt failed, not enough contiguous space %08x, %i", position, size); + ERROR_LOG(Log::sceKernel, "Block allocator AllocAt failed, not enough contiguous space %08x, %i", position, size); return -1; } //good to go @@ -214,24 +214,24 @@ u32 BlockAllocator::AllocAt(u32 position, u32 size, const char *tag) } else { - ERROR_LOG(SCEKERNEL, "Block allocator AllocAt failed :( %08x, %i", position, size); + ERROR_LOG(Log::sceKernel, "Block allocator AllocAt failed :( %08x, %i", position, size); } //Out of memory :( ListBlocks(); - ERROR_LOG(SCEKERNEL, "Block Allocator (%08x-%08x) failed to allocate %i (%08x) bytes of contiguous memory", rangeStart_, rangeStart_ + rangeSize_, alignedSize, alignedSize); + ERROR_LOG(Log::sceKernel, "Block Allocator (%08x-%08x) failed to allocate %i (%08x) bytes of contiguous memory", rangeStart_, rangeStart_ + rangeSize_, alignedSize, alignedSize); return -1; } void BlockAllocator::MergeFreeBlocks(Block *fromBlock) { - DEBUG_LOG(SCEKERNEL, "Merging Blocks"); + DEBUG_LOG(Log::sceKernel, "Merging Blocks"); Block *prev = fromBlock->prev; while (prev != NULL && prev->taken == false) { - DEBUG_LOG(SCEKERNEL, "Block Alloc found adjacent free blocks - merging"); + DEBUG_LOG(Log::sceKernel, "Block Alloc found adjacent free blocks - merging"); prev->size += fromBlock->size; if (fromBlock->next == NULL) top_ = prev; @@ -251,7 +251,7 @@ void BlockAllocator::MergeFreeBlocks(Block *fromBlock) Block *next = fromBlock->next; while (next != NULL && next->taken == false) { - DEBUG_LOG(SCEKERNEL, "Block Alloc found adjacent free blocks - merging"); + DEBUG_LOG(Log::sceKernel, "Block Alloc found adjacent free blocks - merging"); fromBlock->size += next->size; fromBlock->next = next->next; delete next; @@ -276,7 +276,7 @@ bool BlockAllocator::Free(u32 position) } else { - ERROR_LOG(SCEKERNEL, "BlockAllocator : invalid free %08x", position); + ERROR_LOG(Log::sceKernel, "BlockAllocator : invalid free %08x", position); return false; } } @@ -293,7 +293,7 @@ bool BlockAllocator::FreeExact(u32 position) } else { - ERROR_LOG(SCEKERNEL, "BlockAllocator : invalid free %08x", position); + ERROR_LOG(Log::sceKernel, "BlockAllocator : invalid free %08x", position); return false; } } @@ -331,11 +331,11 @@ void BlockAllocator::CheckBlocks() const { const Block &b = *bp; if (b.start > 0xc0000000) { // probably free'd debug values - ERROR_LOG_REPORT(HLE, "Bogus block in allocator"); + ERROR_LOG_REPORT(Log::HLE, "Bogus block in allocator"); } // Outside the valid range, probably logic bug in allocation. if (b.start + b.size > rangeStart_ + rangeSize_ || b.start < rangeStart_) { - ERROR_LOG_REPORT(HLE, "Bogus block in allocator"); + ERROR_LOG_REPORT(Log::HLE, "Bogus block in allocator"); } } } @@ -393,13 +393,13 @@ u32 BlockAllocator::GetBlockSizeFromAddress(u32 addr) const void BlockAllocator::ListBlocks() const { - DEBUG_LOG(SCEKERNEL,"-----------"); + DEBUG_LOG(Log::sceKernel,"-----------"); for (const Block *bp = bottom_; bp != NULL; bp = bp->next) { const Block &b = *bp; - DEBUG_LOG(SCEKERNEL, "Block: %08x - %08x size %08x taken=%i tag=%s", b.start, b.start+b.size, b.size, b.taken ? 1:0, b.tag); + DEBUG_LOG(Log::sceKernel, "Block: %08x - %08x size %08x taken=%i tag=%s", b.start, b.start+b.size, b.size, b.taken ? 1:0, b.tag); } - DEBUG_LOG(SCEKERNEL,"-----------"); + DEBUG_LOG(Log::sceKernel,"-----------"); } u32 BlockAllocator::GetLargestFreeBlockSize() const @@ -415,7 +415,7 @@ u32 BlockAllocator::GetLargestFreeBlockSize() const } } if (maxFreeBlock & (grain_ - 1)) - WARN_LOG_REPORT(HLE, "GetLargestFreeBlockSize: free size %08x does not align to grain %08x.", maxFreeBlock, grain_); + WARN_LOG_REPORT(Log::HLE, "GetLargestFreeBlockSize: free size %08x does not align to grain %08x.", maxFreeBlock, grain_); return maxFreeBlock; } @@ -431,7 +431,7 @@ u32 BlockAllocator::GetTotalFreeBytes() const } } if (sum & (grain_ - 1)) - WARN_LOG_REPORT(HLE, "GetTotalFreeBytes: free size %08x does not align to grain %08x.", sum, grain_); + WARN_LOG_REPORT(Log::HLE, "GetTotalFreeBytes: free size %08x does not align to grain %08x.", sum, grain_); return sum; } diff --git a/Core/Util/GameDB.cpp b/Core/Util/GameDB.cpp index 804aa055a0..6d815f0582 100644 --- a/Core/Util/GameDB.cpp +++ b/Core/Util/GameDB.cpp @@ -97,7 +97,7 @@ void GameDB::LoadIfNeeded() { SplitCSVLine(lineString, items); if (items.size() != columns_.size()) { // Bad line - ERROR_LOG(SYSTEM, "Bad line in CSV file: %s", std::string(lineString).c_str()); + ERROR_LOG(Log::System, "Bad line in CSV file: %s", std::string(lineString).c_str()); continue; } diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index c93c29477b..d52c3bae34 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -66,7 +66,7 @@ static struct zip *ZipOpenPath(Path fileName) { } if (!z) { - ERROR_LOG(HLE, "Failed to open ZIP file '%s', error code=%i", fileName.c_str(), error); + ERROR_LOG(Log::HLE, "Failed to open ZIP file '%s', error code=%i", fileName.c_str(), error); } return z; } @@ -93,11 +93,11 @@ bool GameManager::IsGameInstalled(const std::string &name) { bool GameManager::DownloadAndInstall(const std::string &storeFileUrl) { if (curDownload_.get() != nullptr) { - ERROR_LOG(HLE, "Can only process one download at a time"); + ERROR_LOG(Log::HLE, "Can only process one download at a time"); return false; } if (InstallInProgress()) { - ERROR_LOG(HLE, "Can't download when an install is in progress (yet)"); + ERROR_LOG(Log::HLE, "Can't download when an install is in progress (yet)"); return false; } @@ -136,21 +136,21 @@ void GameManager::UninstallGame(const std::string &name) { Path gameDir = GetSysDirectory(DIRECTORY_GAME) / name; auto st = GetI18NCategory(I18NCat::STORE); - INFO_LOG(HLE, "Uninstalling '%s'", gameDir.c_str()); + INFO_LOG(Log::HLE, "Uninstalling '%s'", gameDir.c_str()); if (!File::Exists(gameDir)) { - ERROR_LOG(HLE, "Game '%s' not installed, cannot uninstall", name.c_str()); + ERROR_LOG(Log::HLE, "Game '%s' not installed, cannot uninstall", name.c_str()); return; } g_OSD.SetProgressBar("install", st->T("Uninstall"), 0.0f, 0.0f, 0.0f, 0.1f); bool success = File::DeleteDirRecursively(gameDir); g_OSD.RemoveProgressBar("install", success, 0.5f); if (success) { - INFO_LOG(HLE, "Successfully uninstalled game '%s'", name.c_str()); + INFO_LOG(Log::HLE, "Successfully uninstalled game '%s'", name.c_str()); InstallDone(); cleanRecentsAfter_ = true; return; } else { - ERROR_LOG(HLE, "Failed to uninstalled game '%s'", name.c_str()); + ERROR_LOG(Log::HLE, "Failed to uninstalled game '%s'", name.c_str()); InstallDone(); return; } @@ -158,18 +158,18 @@ void GameManager::UninstallGame(const std::string &name) { void GameManager::Update() { if (curDownload_.get() && curDownload_->Done()) { - INFO_LOG(HLE, "Download completed! Status = %d", curDownload_->ResultCode()); + INFO_LOG(Log::HLE, "Download completed! Status = %d", curDownload_->ResultCode()); Path fileName = curDownload_->outfile(); if (curDownload_->ResultCode() == 200) { if (!File::Exists(fileName)) { - ERROR_LOG(HLE, "Downloaded file '%s' does not exist :(", fileName.c_str()); + ERROR_LOG(Log::HLE, "Downloaded file '%s' does not exist :(", fileName.c_str()); curDownload_.reset(); return; } // Game downloaded to temporary file - install it! InstallGameOnThread(Path(curDownload_->url()), fileName, true); } else { - ERROR_LOG(HLE, "Expected HTTP status code 200, got status code %d. Install cancelled, deleting partial file '%s'", + ERROR_LOG(Log::HLE, "Expected HTTP status code 200, got status code %d. Install cancelled, deleting partial file '%s'", curDownload_->ResultCode(), fileName.c_str()); File::Delete(fileName); } @@ -242,7 +242,7 @@ ZipFileContents DetectZipFileContents(struct zip *z, ZipFileInfo *info) { stripChars = slashLocation + 1; isPSPMemstickGame = true; } else { - INFO_LOG(HLE, "Wrong number of slashes (%i) in '%s'", slashCount, fn); + INFO_LOG(Log::HLE, "Wrong number of slashes (%i) in '%s'", slashCount, fn); } } else if (endsWith(zippedName, ".iso") || endsWith(zippedName, ".cso") || endsWith(zippedName, ".chd")) { int slashCount = 0; @@ -288,13 +288,13 @@ bool GameManager::InstallGame(const Path &url, const Path &fileName, bool delete SetCurrentThreadName("InstallGame"); if (installDonePending_) { - ERROR_LOG(HLE, "Cannot have two installs in progress at the same time"); + ERROR_LOG(Log::HLE, "Cannot have two installs in progress at the same time"); return false; } AndroidJNIThreadContext context; // Destructor detaches. if (!File::Exists(fileName)) { - ERROR_LOG(HLE, "Game file '%s' doesn't exist", fileName.c_str()); + ERROR_LOG(Log::HLE, "Game file '%s' doesn't exist", fileName.c_str()); return false; } @@ -327,19 +327,19 @@ bool GameManager::InstallGame(const Path &url, const Path &fileName, bool delete bool success = false; switch (contents) { case ZipFileContents::PSP_GAME_DIR: - INFO_LOG(HLE, "Installing '%s' into '%s'", fileName.c_str(), pspGame.c_str()); + INFO_LOG(Log::HLE, "Installing '%s' into '%s'", fileName.c_str(), pspGame.c_str()); // InstallMemstickGame contains code to close (and delete) z. success = InstallMemstickGame(z, fileName, pspGame, info, false, deleteAfter); break; case ZipFileContents::ISO_FILE: - INFO_LOG(HLE, "Installing '%s' into its containing directory", fileName.c_str()); + INFO_LOG(Log::HLE, "Installing '%s' into its containing directory", fileName.c_str()); // InstallZippedISO contains code to close z. success = InstallZippedISO(z, info.isoFileIndex, fileName, deleteAfter); break; case ZipFileContents::TEXTURE_PACK: // InstallMemstickGame contains code to close z, and works for textures too. if (DetectTexturePackDest(z, info.textureIniIndex, dest)) { - INFO_LOG(HLE, "Installing texture pack '%s' into '%s'", fileName.c_str(), dest.c_str()); + INFO_LOG(Log::HLE, "Installing texture pack '%s' into '%s'", fileName.c_str(), dest.c_str()); File::CreateFullPath(dest); // Install as a zip file if textures.ini is in the root. Performs better on Android. if (info.stripChars == 0) { @@ -355,7 +355,7 @@ bool GameManager::InstallGame(const Path &url, const Path &fileName, bool delete } break; default: - ERROR_LOG(HLE, "File not a PSP game, no EBOOT.PBP found."); + ERROR_LOG(Log::HLE, "File not a PSP game, no EBOOT.PBP found."); SetInstallError(sy->T("Not a PSP game")); zip_close(z); z = nullptr; @@ -495,12 +495,12 @@ bool GameManager::ExtractFile(struct zip *z, int file_index, const Path &outFile // Don't spam the log. if (file_index < 10) { - INFO_LOG(HLE, "Writing %d bytes to '%s'", (int)size, outFilename.c_str()); + INFO_LOG(Log::HLE, "Writing %d bytes to '%s'", (int)size, outFilename.c_str()); } zip_file *zf = zip_fopen_index(z, file_index, 0); if (!zf) { - ERROR_LOG(HLE, "Failed to open file by index (%d) (%s)", file_index, outFilename.c_str()); + ERROR_LOG(Log::HLE, "Failed to open file by index (%d) (%s)", file_index, outFilename.c_str()); return false; } @@ -513,7 +513,7 @@ bool GameManager::ExtractFile(struct zip *z, int file_index, const Path &outFile size_t readSize = std::min(blockSize, size - pos); zip_int64_t retval = zip_fread(zf, buffer, readSize); if (retval < 0 || (size_t)retval < readSize) { - ERROR_LOG(HLE, "Failed to read %d bytes from zip (%d) - archive corrupt?", (int)readSize, (int)retval); + ERROR_LOG(Log::HLE, "Failed to read %d bytes from zip (%d) - archive corrupt?", (int)readSize, (int)retval); delete[] buffer; fclose(f); zip_fclose(zf); @@ -522,7 +522,7 @@ bool GameManager::ExtractFile(struct zip *z, int file_index, const Path &outFile } size_t written = fwrite(buffer, 1, readSize, f); if (written != readSize) { - ERROR_LOG(HLE, "Wrote %d bytes out of %d - Disk full?", (int)written, (int)readSize); + ERROR_LOG(Log::HLE, "Wrote %d bytes out of %d - Disk full?", (int)written, (int)readSize); delete[] buffer; fclose(f); zip_fclose(zf); @@ -541,7 +541,7 @@ bool GameManager::ExtractFile(struct zip *z, int file_index, const Path &outFile } else { auto iz = GetI18NCategory(I18NCat::INSTALLZIP); g_OSD.Show(OSDType::MESSAGE_ERROR, iz->T("Installation failed")); - ERROR_LOG(HLE, "Failed to open file for writing: %s", outFilename.c_str()); + ERROR_LOG(Log::HLE, "Failed to open file for writing: %s", outFilename.c_str()); return false; } } @@ -616,7 +616,7 @@ bool GameManager::InstallMemstickGame(struct zip *z, const Path &zipfile, const continue; if (!ExtractFile(z, i, outFilename, &bytesCopied, allBytes)) { - ERROR_LOG(HLE, "Bailing: Failed to extract file: %s -> %s", zippedName.c_str(), outFilename.c_str()); + ERROR_LOG(Log::HLE, "Bailing: Failed to extract file: %s -> %s", zippedName.c_str(), outFilename.c_str()); goto bail; } else { createdFiles.push_back(outFilename); @@ -625,12 +625,12 @@ bool GameManager::InstallMemstickGame(struct zip *z, const Path &zipfile, const g_OSD.SetProgressBar("install", di->T("Installing..."), 0.0f, 1.0f, 0.1f + (i + 1) / (float)info.numFiles * 0.9f, 0.1f); } - INFO_LOG(HLE, "Unzipped %d files (%d bytes / %d).", info.numFiles, (int)bytesCopied, (int)allBytes); + INFO_LOG(Log::HLE, "Unzipped %d files (%d bytes / %d).", info.numFiles, (int)bytesCopied, (int)allBytes); zip_close(z); z = nullptr; installProgress_ = 1.0f; if (deleteAfter) { - INFO_LOG(HLE, "Deleting '%s' after extraction", zipfile.c_str()); + INFO_LOG(Log::HLE, "Deleting '%s' after extraction", zipfile.c_str()); File::Delete(zipfile); } InstallDone(); @@ -733,7 +733,7 @@ bool GameManager::InstallZippedISO(struct zip *z, int isoFileIndex, const Path & auto di = GetI18NCategory(I18NCat::DIALOG); g_OSD.SetProgressBar("install", di->T("Installing..."), 0.0f, 0.0f, 0.0f, 0.1f); if (ExtractFile(z, isoFileIndex, outputISOFilename, &bytesCopied, allBytes)) { - INFO_LOG(IO, "Successfully unzipped ISO file to '%s'", outputISOFilename.c_str()); + INFO_LOG(Log::IO, "Successfully unzipped ISO file to '%s'", outputISOFilename.c_str()); success = true; } zip_close(z); @@ -760,7 +760,7 @@ bool GameManager::InstallGameOnThread(const Path &url, const Path &fileName, boo bool GameManager::UninstallGameOnThread(const std::string &name) { if (name.empty()) { - ERROR_LOG(HLE, "Cannot uninstall an empty-named game"); + ERROR_LOG(Log::HLE, "Cannot uninstall an empty-named game"); return false; } if (InstallInProgress() || installDonePending_ || curDownload_.get() != nullptr) { diff --git a/Core/Util/MemStick.cpp b/Core/Util/MemStick.cpp index 64da3b699b..d06428886c 100644 --- a/Core/Util/MemStick.cpp +++ b/Core/Util/MemStick.cpp @@ -47,7 +47,7 @@ bool SwitchMemstickFolderTo(Path newMemstickFolder) { std::string str = newMemstickFolder.ToString(); if (!File::WriteDataToFile(true, str.c_str(), str.size(), memStickDirFile)) { - ERROR_LOG(SYSTEM, "Failed to write memstick path '%s' to '%s'", newMemstickFolder.c_str(), memStickDirFile.c_str()); + ERROR_LOG(Log::System, "Failed to write memstick path '%s' to '%s'", newMemstickFolder.c_str(), memStickDirFile.c_str()); // Not sure what to do if this file can't be written. Disk full? } @@ -85,7 +85,7 @@ static bool ListFileSuffixesRecursively(const Path &root, const Path &folder, st progressReporter.SetProgress(file.name, fileSuffixes.size(), (size_t)-1); } } else { - ERROR_LOG_REPORT(SYSTEM, "Failed to compute PathTo from '%s' to '%s'", root.c_str(), folder.c_str()); + ERROR_LOG_REPORT(Log::System, "Failed to compute PathTo from '%s' to '%s'", root.c_str(), folder.c_str()); } } else { std::string fileSuffix; @@ -112,7 +112,7 @@ bool MoveChildrenFast(const Path &moveSrc, const Path &moveDest, MoveProgressRep Path fileSrc = file.fullName; Path fileDest = moveDest / file.name; progressReporter.SetProgress(file.name, i, files.size()); - INFO_LOG(SYSTEM, "About to move PSP data from '%s' to '%s'", fileSrc.c_str(), fileDest.c_str()); + INFO_LOG(Log::System, "About to move PSP data from '%s' to '%s'", fileSrc.c_str(), fileDest.c_str()); bool result = File::MoveIfFast(fileSrc, fileDest); if (!result) { // TODO: Should we try to move back anything that succeeded before this one? @@ -147,12 +147,12 @@ MoveResult *MoveDirectoryContentsSafe(Path moveSrc, Path moveDest, MoveProgressR File::CreateDir(moveDest); } - INFO_LOG(SYSTEM, "About to move PSP data from '%s' to '%s'", moveSrc.c_str(), moveDest.c_str()); + INFO_LOG(Log::System, "About to move PSP data from '%s' to '%s'", moveSrc.c_str(), moveDest.c_str()); // First, we try the cheapest and safest way to move: Can we move files directly within the same device? // We loop through the files/dirs in the source directory and just try to move them, it should work. if (MoveChildrenFast(moveSrc, moveDest, progressReporter)) { - INFO_LOG(SYSTEM, "Quick-move succeeded"); + INFO_LOG(Log::System, "Quick-move succeeded"); progressReporter.SetProgress(ms->T("Done!")); return new MoveResult{ true, "" @@ -171,7 +171,7 @@ MoveResult *MoveDirectoryContentsSafe(Path moveSrc, Path moveDest, MoveProgressR if (!ListFileSuffixesRecursively(moveSrc, moveSrc, directorySuffixesToCreate, fileSuffixesToMove, progressReporter)) { // TODO: Handle failure listing files. std::string error = "Failed to read old directory"; - INFO_LOG(SYSTEM, "%s", error.c_str()); + INFO_LOG(Log::System, "%s", error.c_str()); progressReporter.SetProgress(ms->T(error.c_str())); return new MoveResult{ false, error }; } @@ -196,9 +196,9 @@ MoveResult *MoveDirectoryContentsSafe(Path moveSrc, Path moveDest, MoveProgressR const auto &dirSuffix = directorySuffixesToCreate[i]; Path dir = moveDest / dirSuffix; if (dryRun) { - INFO_LOG(SYSTEM, "dry run: Would have created dir '%s'", dir.c_str()); + INFO_LOG(Log::System, "dry run: Would have created dir '%s'", dir.c_str()); } else { - INFO_LOG(SYSTEM, "Creating dir '%s'", dir.c_str()); + INFO_LOG(Log::System, "Creating dir '%s'", dir.c_str()); progressReporter.SetProgress(dirSuffix); // Just ignore already-exists errors. File::CreateDir(dir); @@ -214,16 +214,16 @@ MoveResult *MoveDirectoryContentsSafe(Path moveSrc, Path moveDest, MoveProgressR Path to = moveDest / fileSuffix.suffix; if (dryRun) { - INFO_LOG(SYSTEM, "dry run: Would have moved '%s' to '%s' (%d bytes)", from.c_str(), to.c_str(), (int)fileSuffix.fileSize); + INFO_LOG(Log::System, "dry run: Would have moved '%s' to '%s' (%d bytes)", from.c_str(), to.c_str(), (int)fileSuffix.fileSize); } else { // Remove the "from" prefix from the path. // We have to drop down to string operations for this. if (!File::Copy(from, to)) { - ERROR_LOG(SYSTEM, "Failed to copy file '%s' to '%s'", from.c_str(), to.c_str()); + ERROR_LOG(Log::System, "Failed to copy file '%s' to '%s'", from.c_str(), to.c_str()); failedFiles++; // Should probably just bail? } else { - INFO_LOG(SYSTEM, "Copied file '%s' to '%s'", from.c_str(), to.c_str()); + INFO_LOG(Log::System, "Copied file '%s' to '%s'", from.c_str(), to.c_str()); } } } @@ -248,7 +248,7 @@ MoveResult *MoveDirectoryContentsSafe(Path moveSrc, Path moveDest, MoveProgressR } if (fileSuffix.fileSize != info.size) { - ERROR_LOG(SYSTEM, "Mismatched size in target file %s. Verification failed.", fileSuffix.suffix.c_str()); + ERROR_LOG(Log::System, "Mismatched size in target file %s. Verification failed.", fileSuffix.suffix.c_str()); ok = false; failedFiles++; break; @@ -259,7 +259,7 @@ MoveResult *MoveDirectoryContentsSafe(Path moveSrc, Path moveDest, MoveProgressR return new MoveResult{ false, "", failedFiles }; } - INFO_LOG(SYSTEM, "Verification complete"); + INFO_LOG(Log::System, "Verification complete"); // Delete all the old, now hopefully empty, directories. // Hopefully DeleteDir actually fails if it contains a file... @@ -267,9 +267,9 @@ MoveResult *MoveDirectoryContentsSafe(Path moveSrc, Path moveDest, MoveProgressR const auto &dirSuffix = directorySuffixesToCreate[i]; Path dir = moveSrc / dirSuffix; if (dryRun) { - INFO_LOG(SYSTEM, "dry run: Would have deleted dir '%s'", dir.c_str()); + INFO_LOG(Log::System, "dry run: Would have deleted dir '%s'", dir.c_str()); } else { - INFO_LOG(SYSTEM, "Deleting dir '%s'", dir.c_str()); + INFO_LOG(Log::System, "Deleting dir '%s'", dir.c_str()); progressReporter.SetProgress(dirSuffix, i, directorySuffixesToCreate.size()); if (File::Exists(dir)) { File::DeleteDir(dir); diff --git a/Core/Util/PPGeDraw.cpp b/Core/Util/PPGeDraw.cpp index 784a893b90..b206d5e6c0 100644 --- a/Core/Util/PPGeDraw.cpp +++ b/Core/Util/PPGeDraw.cpp @@ -252,7 +252,7 @@ void __PPGeInit() { bool loadedZIM = !skipZIM && LoadZIM("ppge_atlas.zim", width, height, &flags, imageData); if (!skipZIM && !loadedZIM) { - ERROR_LOG(SCEGE, "Failed to load ppge_atlas.zim.\n\nPlace it in the directory \"assets\" under your PPSSPP directory.\n\nPPGe stuff will not be drawn."); + ERROR_LOG(Log::sceGe, "Failed to load ppge_atlas.zim.\n\nPlace it in the directory \"assets\" under your PPSSPP directory.\n\nPPGe stuff will not be drawn."); } if (loadedZIM) { @@ -309,7 +309,7 @@ void __PPGeInit() { atlasRequiresReset = false; - INFO_LOG(SCEGE, "PPGe drawing library initialized. DL: %08x Data: %08x Atlas: %08x (%i) Args: %08x", + INFO_LOG(Log::sceGe, "PPGe drawing library initialized. DL: %08x Data: %08x Atlas: %08x (%i) Args: %08x", dlPtr, dataPtr, atlasPtr, atlasSize, listArgs.ptr); } @@ -470,7 +470,7 @@ void PPGeEnd() gpu->EnableInterrupts(false); NotifyMemInfo(MemBlockFlags::WRITE, dlPtr, dlWritePtr - dlPtr, "PPGe ListCmds"); u32 list = sceGeListEnQueue(dlPtr, dlWritePtr, -1, listArgs.ptr); - DEBUG_LOG(SCEGE, "PPGe enqueued display list %i", list); + DEBUG_LOG(Log::sceGe, "PPGe enqueued display list %i", list); gpu->EnableInterrupts(true); } } @@ -1373,7 +1373,7 @@ bool PPGeImage::Load() { } else { std::vector pngData; if (pspFileSystem.ReadEntireFile(filename_, pngData) < 0) { - WARN_LOG(SCEGE, "PPGeImage cannot load file %s", filename_.c_str()); + WARN_LOG(Log::sceGe, "PPGeImage cannot load file %s", filename_.c_str()); loadFailed_ = true; return false; } @@ -1381,7 +1381,7 @@ bool PPGeImage::Load() { success = pngLoadPtr((const unsigned char *)&pngData[0], pngData.size(), &width_, &height_, &textureData); } if (!success) { - WARN_LOG(SCEGE, "Bad PPGeImage - not a valid png"); + WARN_LOG(Log::sceGe, "Bad PPGeImage - not a valid png"); loadFailed_ = true; return false; } @@ -1391,7 +1391,7 @@ bool PPGeImage::Load() { texture_ = __PPGeDoAlloc(texSize, true, "Savedata Icon"); if (texture_ == 0) { free(textureData); - WARN_LOG(SCEGE, "Bad PPGeImage - unable to allocate space for texture"); + WARN_LOG(Log::sceGe, "Bad PPGeImage - unable to allocate space for texture"); // Don't set loadFailed_ here, we'll try again if there's more memory later. return false; } diff --git a/Core/Util/PortManager.cpp b/Core/Util/PortManager.cpp index 4b023b6406..e5e93593c2 100644 --- a/Core/Util/PortManager.cpp +++ b/Core/Util/PortManager.cpp @@ -66,7 +66,7 @@ void PortManager::Shutdown() { } void PortManager::Terminate() { - VERBOSE_LOG(SCENET, "PortManager::Terminate()"); + VERBOSE_LOG(Log::sceNet, "PortManager::Terminate()"); if (urls) { #ifdef WITH_UPNP FreeUPNPUrls(urls); @@ -100,9 +100,9 @@ bool PortManager::Initialize(const unsigned int timeout) { unsigned char ttl = 2; // defaulting to 2 int error = 0; - VERBOSE_LOG(SCENET, "PortManager::Initialize(%d)", timeout); + VERBOSE_LOG(Log::sceNet, "PortManager::Initialize(%d)", timeout); if (!g_Config.bEnableUPnP) { - ERROR_LOG(SCENET, "PortManager::Initialize - UPnP is Disabled on Networking Settings"); + ERROR_LOG(Log::sceNet, "PortManager::Initialize - UPnP is Disabled on Networking Settings"); return false; } @@ -110,12 +110,12 @@ bool PortManager::Initialize(const unsigned int timeout) { switch (m_InitState) { case UPNP_INITSTATE_BUSY: { - WARN_LOG(SCENET, "PortManager - Initialization already in progress"); + WARN_LOG(Log::sceNet, "PortManager - Initialization already in progress"); return false; } // Should we redetect UPnP? just in case the player switched to a different network in the middle case UPNP_INITSTATE_DONE: { - WARN_LOG(SCENET, "PortManager - Already Initialized"); + WARN_LOG(Log::sceNet, "PortManager - Already Initialized"); return true; } default: @@ -149,7 +149,7 @@ bool PortManager::Initialize(const unsigned int timeout) { if (!dev) dev = devlist; // defaulting to first device - INFO_LOG(SCENET, "PortManager - UPnP device: [desc: %s] [st: %s]", dev->descURL, dev->st); + INFO_LOG(Log::sceNet, "PortManager - UPnP device: [desc: %s] [st: %s]", dev->descURL, dev->st); descXML = (char*)miniwget(dev->descURL, &descXMLsize, dev->scope_id, &descXMLstatus); if (descXML) @@ -163,15 +163,15 @@ bool PortManager::Initialize(const unsigned int timeout) { char lanaddr[64] = "unset"; int status = UPNP_GetValidIGD(devlist, urls, datas, lanaddr, sizeof(lanaddr), nullptr, 0); //possible "status" values, 0 = NO IGD found, 1 = A valid connected IGD has been found, 2 = A valid IGD has been found but it reported as not connected, 3 = an UPnP device has been found but was not recognized as an IGD m_lanip = std::string(lanaddr); - INFO_LOG(SCENET, "PortManager - Detected LAN IP: %s", m_lanip.c_str()); + INFO_LOG(Log::sceNet, "PortManager - Detected LAN IP: %s", m_lanip.c_str()); // Additional Info char connectionType[64] = ""; if (UPNP_GetConnectionTypeInfo(urls->controlURL, datas->first.servicetype, connectionType) != UPNPCOMMAND_SUCCESS) { - WARN_LOG(SCENET, "PortManager - GetConnectionTypeInfo failed"); + WARN_LOG(Log::sceNet, "PortManager - GetConnectionTypeInfo failed"); } else { - INFO_LOG(SCENET, "PortManager - Connection Type: %s", connectionType); + INFO_LOG(Log::sceNet, "PortManager - Connection Type: %s", connectionType); } // Using Game ID & Player Name as default description for mapping @@ -186,7 +186,7 @@ bool PortManager::Initialize(const unsigned int timeout) { return true; } - ERROR_LOG(SCENET, "PortManager - upnpDiscover failed (error: %i) or No UPnP device detected", error); + ERROR_LOG(Log::sceNet, "PortManager - upnpDiscover failed (error: %i) or No UPnP device detected", error); if (g_Config.bEnableUPnP) { auto n = GetI18NCategory(I18NCat::NETWORKING); g_OSD.Show(OSDType::MESSAGE_ERROR, n->T("Unable to find UPnP device")); @@ -209,11 +209,11 @@ bool PortManager::Add(const char* protocol, unsigned short port, unsigned short if (intport == 0) intport = port; - INFO_LOG(SCENET, "PortManager::Add(%s, %d, %d)", protocol, port, intport); + INFO_LOG(Log::sceNet, "PortManager::Add(%s, %d, %d)", protocol, port, intport); if (urls == NULL || urls->controlURL == NULL || urls->controlURL[0] == '\0') { if (g_Config.bEnableUPnP) { - WARN_LOG(SCENET, "PortManager::Add - the init was not done !"); + WARN_LOG(Log::sceNet, "PortManager::Add - the init was not done !"); g_OSD.Show(OSDType::MESSAGE_INFO, n->T("UPnP need to be reinitialized")); } Terminate(); @@ -241,7 +241,7 @@ bool PortManager::Add(const char* protocol, unsigned short port, unsigned short } if (r != 0) { - ERROR_LOG(SCENET, "PortManager - AddPortMapping failed (error: %i)", r); + ERROR_LOG(Log::sceNet, "PortManager - AddPortMapping failed (error: %i)", r); if (r == UPNPCOMMAND_HTTP_ERROR) { if (g_Config.bEnableUPnP) { g_OSD.Show(OSDType::MESSAGE_INFO, n->T("UPnP need to be reinitialized")); @@ -265,11 +265,11 @@ bool PortManager::Remove(const char* protocol, unsigned short port) { char port_str[16]; auto n = GetI18NCategory(I18NCat::NETWORKING); - INFO_LOG(SCENET, "PortManager::Remove(%s, %d)", protocol, port); + INFO_LOG(Log::sceNet, "PortManager::Remove(%s, %d)", protocol, port); if (urls == NULL || urls->controlURL == NULL || urls->controlURL[0] == '\0') { if (g_Config.bEnableUPnP) { - WARN_LOG(SCENET, "PortManager::Remove - the init was not done !"); + WARN_LOG(Log::sceNet, "PortManager::Remove - the init was not done !"); g_OSD.Show(OSDType::MESSAGE_INFO, n->T("UPnP need to be reinitialized")); } Terminate(); @@ -279,7 +279,7 @@ bool PortManager::Remove(const char* protocol, unsigned short port) { int r = UPNP_DeletePortMapping(urls->controlURL, datas->first.servicetype, port_str, protocol, NULL); if (r != 0) { - ERROR_LOG(SCENET, "PortManager - DeletePortMapping failed (error: %i)", r); + ERROR_LOG(Log::sceNet, "PortManager - DeletePortMapping failed (error: %i)", r); if (r == UPNPCOMMAND_HTTP_ERROR) { if (g_Config.bEnableUPnP) { g_OSD.Show(OSDType::MESSAGE_INFO, n->T("UPnP need to be reinitialized")); @@ -300,10 +300,10 @@ bool PortManager::Remove(const char* protocol, unsigned short port) { bool PortManager::Restore() { #ifdef WITH_UPNP int r; - VERBOSE_LOG(SCENET, "PortManager::Restore()"); + VERBOSE_LOG(Log::sceNet, "PortManager::Restore()"); if (urls == NULL || urls->controlURL == NULL || urls->controlURL[0] == '\0') { - if (g_Config.bEnableUPnP) WARN_LOG(SCENET, "PortManager::Remove - the init was not done !"); + if (g_Config.bEnableUPnP) WARN_LOG(Log::sceNet, "PortManager::Remove - the init was not done !"); return false; } for (auto it = m_otherPortList.begin(); it != m_otherPortList.end(); ++it) { @@ -319,7 +319,7 @@ bool PortManager::Restore() { m_portList.erase(el_it); } else { - ERROR_LOG(SCENET, "PortManager::Restore - DeletePortMapping failed (error: %i)", r); + ERROR_LOG(Log::sceNet, "PortManager::Restore - DeletePortMapping failed (error: %i)", r); if (r == UPNPCOMMAND_HTTP_ERROR) return false; // Might be better not to exit here, but exiting a loop will avoid long timeouts in the case the router is no longer reachable } @@ -331,7 +331,7 @@ bool PortManager::Restore() { it->taken = false; } else { - ERROR_LOG(SCENET, "PortManager::Restore - AddPortMapping failed (error: %i)", r); + ERROR_LOG(Log::sceNet, "PortManager::Restore - AddPortMapping failed (error: %i)", r); if (r == UPNPCOMMAND_HTTP_ERROR) return false; // Might be better not to exit here, but exiting a loop will avoid long timeouts in the case the router is no longer reachable } @@ -357,10 +357,10 @@ bool PortManager::Clear() { char rHost[64]; char duration[16]; - VERBOSE_LOG(SCENET, "PortManager::Clear()"); + VERBOSE_LOG(Log::sceNet, "PortManager::Clear()"); if (urls == NULL || urls->controlURL == NULL || urls->controlURL[0] == '\0') { - if (g_Config.bEnableUPnP) WARN_LOG(SCENET, "PortManager::Clear - the init was not done !"); + if (g_Config.bEnableUPnP) WARN_LOG(Log::sceNet, "PortManager::Clear - the init was not done !"); return false; } //unsigned int num = 0; @@ -382,7 +382,7 @@ bool PortManager::Clear() { int r2 = UPNP_DeletePortMapping(urls->controlURL, datas->first.servicetype, extPort, protocol, rHost); if (r2 != 0) { - ERROR_LOG(SCENET, "PortManager::Clear - DeletePortMapping(%s, %s) failed (error: %i)", extPort, protocol, r2); + ERROR_LOG(Log::sceNet, "PortManager::Clear - DeletePortMapping(%s, %s) failed (error: %i)", extPort, protocol, r2); if (r2 == UPNPCOMMAND_HTTP_ERROR) return false; } @@ -415,10 +415,10 @@ bool PortManager::RefreshPortList() { char rHost[64]; char duration[16]; - INFO_LOG(SCENET, "PortManager::RefreshPortList()"); + INFO_LOG(Log::sceNet, "PortManager::RefreshPortList()"); if (urls == NULL || urls->controlURL == NULL || urls->controlURL[0] == '\0') { - if (g_Config.bEnableUPnP) WARN_LOG(SCENET, "PortManager::RefreshPortList - the init was not done !"); + if (g_Config.bEnableUPnP) WARN_LOG(Log::sceNet, "PortManager::RefreshPortList - the init was not done !"); return false; } m_portList.clear(); @@ -461,7 +461,7 @@ bool PortManager::RefreshPortList() { int upnpService(const unsigned int timeout) { SetCurrentThreadName("UPnPService"); - INFO_LOG(SCENET, "UPnPService: Begin of UPnPService Thread"); + INFO_LOG(Log::sceNet, "UPnPService: Begin of UPnPService Thread"); // Service Loop while (upnpServiceRunning && coreState != CORE_POWERDOWN) { @@ -509,7 +509,7 @@ int upnpService(const unsigned int timeout) upnpReqs.clear(); upnpLock.unlock(); - INFO_LOG(SCENET, "UPnPService: End of UPnPService Thread"); + INFO_LOG(Log::sceNet, "UPnPService: End of UPnPService Thread"); return 0; } diff --git a/Core/WaveFile.cpp b/Core/WaveFile.cpp index 551d33bd36..44ce0fa421 100644 --- a/Core/WaveFile.cpp +++ b/Core/WaveFile.cpp @@ -19,13 +19,13 @@ bool WaveFileWriter::Start(const Path &filename, unsigned int HLESampleRate) { // Check if the file is already open if (file) { - ERROR_LOG(SYSTEM, "The file %s was already open, the file header will not be written.", filename.c_str()); + ERROR_LOG(Log::System, "The file %s was already open, the file header will not be written.", filename.c_str()); return false; } file.Open(filename, "wb"); if (!file) { - ERROR_LOG(IO, "The file %s could not be opened for writing. Please check if it's already opened by another program.", filename.c_str()); + ERROR_LOG(Log::IO, "The file %s could not be opened for writing. Please check if it's already opened by another program.", filename.c_str()); return false; } diff --git a/Core/WebServer.cpp b/Core/WebServer.cpp index 21987575ad..1aa5a23d96 100644 --- a/Core/WebServer.cpp +++ b/Core/WebServer.cpp @@ -353,7 +353,7 @@ static void HandleFallback(const http::ServerRequest &request) { if (serverFlags & (int)WebServerFlags::DISCS) { std::string resource = request.resource(); Path localPath = LocalFromRemotePath(resource); - INFO_LOG(LOADER, "Serving %s from %s", resource.c_str(), localPath.c_str()); + INFO_LOG(Log::Loader, "Serving %s from %s", resource.c_str(), localPath.c_str()); if (!localPath.empty()) { if (File::IsDirectory(localPath)) { HandleListing(request); @@ -415,7 +415,7 @@ static void ExecuteWebServer() { if (!http->Listen(g_Config.iRemoteISOPort)) { if (!http->Listen(0)) { - ERROR_LOG(FILESYS, "Unable to listen on any port"); + ERROR_LOG(Log::FileSystem, "Unable to listen on any port"); UpdateStatus(ServerStatus::FINISHED); return; } diff --git a/GPU/Common/DepalettizeShaderCommon.cpp b/GPU/Common/DepalettizeShaderCommon.cpp index bb78b80875..b8162d26f9 100644 --- a/GPU/Common/DepalettizeShaderCommon.cpp +++ b/GPU/Common/DepalettizeShaderCommon.cpp @@ -313,7 +313,7 @@ void GenerateDepalShaderFloat(ShaderWriter &writer, const DepalConfig &config) { // index_multiplier -= 0.01f / texturePixels; if (!formatOK) { - ERROR_LOG_REPORT_ONCE(depal, G3D, "%s depal unsupported: shift=%d mask=%02x offset=%d", GeBufferFormatToString(config.bufferFormat), shift, mask, config.startPos); + ERROR_LOG_REPORT_ONCE(depal, Log::G3D, "%s depal unsupported: shift=%d mask=%02x offset=%d", GeBufferFormatToString(config.bufferFormat), shift, mask, config.startPos); } // Offset by half a texel (plus clutBase) to turn NEAREST filtering into FLOOR. diff --git a/GPU/Common/DepthBufferCommon.cpp b/GPU/Common/DepthBufferCommon.cpp index ebc936c10a..0de297f743 100644 --- a/GPU/Common/DepthBufferCommon.cpp +++ b/GPU/Common/DepthBufferCommon.cpp @@ -166,7 +166,7 @@ bool FramebufferManagerCommon::ReadbackDepthbuffer(Draw::Framebuffer *fbo, int x using namespace Draw; if (!fbo) { - ERROR_LOG_REPORT_ONCE(vfbfbozero, SCEGE, "ReadbackDepthbufferSync: bad fbo"); + ERROR_LOG_REPORT_ONCE(vfbfbozero, Log::sceGe, "ReadbackDepthbufferSync: bad fbo"); return false; } // Old desktop GL can download depth, but not upload. diff --git a/GPU/Common/DrawEngineCommon.cpp b/GPU/Common/DrawEngineCommon.cpp index 77ef5d5dd9..b517850ee3 100644 --- a/GPU/Common/DrawEngineCommon.cpp +++ b/GPU/Common/DrawEngineCommon.cpp @@ -170,10 +170,10 @@ void DrawEngineCommon::DispatchSubmitImm(GEPrimitiveType prim, TransformedVertex // TODO: Handle fog and secondary color somehow? if (gstate.isFogEnabled() && !gstate.isModeThrough()) { - WARN_LOG_REPORT_ONCE(geimmfog, G3D, "Imm vertex used fog"); + WARN_LOG_REPORT_ONCE(geimmfog, Log::G3D, "Imm vertex used fog"); } if (color1Used != 0 && gstate.isUsingSecondaryColor() && !gstate.isModeThrough()) { - WARN_LOG_REPORT_ONCE(geimmcolor1, G3D, "Imm vertex used secondary color"); + WARN_LOG_REPORT_ONCE(geimmcolor1, Log::G3D, "Imm vertex used secondary color"); } bool prevThrough = gstate.isModeThrough(); @@ -595,11 +595,11 @@ bool DrawEngineCommon::GetCurrentSimpleVertices(int count, std::vectorfb_format != format) { - WARN_LOG_ONCE(resolvevfb, G3D, "ResolveVFB: Resolving from %s to %s at %08x/%d", GeBufferFormatToString(newest->fb_format), GeBufferFormatToString(format), addr, stride); + WARN_LOG_ONCE(resolvevfb, Log::G3D, "ResolveVFB: Resolving from %s to %s at %08x/%d", GeBufferFormatToString(newest->fb_format), GeBufferFormatToString(format), addr, stride); return ResolveFramebufferColorToFormat(newest, format); } @@ -313,7 +313,7 @@ void FramebufferManagerCommon::EstimateDrawingSize(u32 fb_address, int fb_stride } } - DEBUG_LOG(G3D, "Est: %08x V: %ix%i, R: %ix%i, S: %ix%i, STR: %i, THR:%i, Z:%08x = %ix%i %s", fb_address, viewport_width,viewport_height, region_width, region_height, scissor_width, scissor_height, fb_stride, gstate.isModeThrough(), gstate.isDepthWriteEnabled() ? gstate.getDepthBufAddress() : 0, drawing_width, drawing_height, margin ? " (margin!)" : ""); + DEBUG_LOG(Log::G3D, "Est: %08x V: %ix%i, R: %ix%i, S: %ix%i, STR: %i, THR:%i, Z:%08x = %ix%i %s", fb_address, viewport_width,viewport_height, region_width, region_height, scissor_width, scissor_height, fb_stride, gstate.isModeThrough(), gstate.isDepthWriteEnabled() ? gstate.getDepthBufAddress() : 0, drawing_width, drawing_height, margin ? " (margin!)" : ""); } void GetFramebufferHeuristicInputs(FramebufferHeuristicParams *params, const GPUgstate &gstate) { @@ -370,7 +370,7 @@ void GetFramebufferHeuristicInputs(FramebufferHeuristicParams *params, const GPU params->scissorBottom = gstate.getScissorY2() + 1; if (gstate.getRegionRateX() != 0x100 || gstate.getRegionRateY() != 0x100) { - WARN_LOG_REPORT_ONCE(regionRate, G3D, "Drawing region rate add non-zero: %04x, %04x of %04x, %04x", gstate.getRegionRateX(), gstate.getRegionRateY(), gstate.getRegionX2(), gstate.getRegionY2()); + WARN_LOG_REPORT_ONCE(regionRate, Log::G3D, "Drawing region rate add non-zero: %04x, %04x of %04x, %04x", gstate.getRegionRateX(), gstate.getRegionRateY(), gstate.getRegionX2(), gstate.getRegionY2()); } } @@ -390,7 +390,7 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(Framebuffer if (params.fb_address == params.z_address) { // Most likely Z will not be used in this pass, as that would wreak havoc (undefined behavior for sure) // We probably don't need to do anything about that, but let's log it. - WARN_LOG_ONCE(color_equal_z, G3D, "Framebuffer bound with color addr == z addr, likely will not use Z in this pass: %08x", params.fb_address); + WARN_LOG_ONCE(color_equal_z, Log::G3D, "Framebuffer bound with color addr == z addr, likely will not use Z in this pass: %08x", params.fb_address); } // Compatibility hack for Killzone, see issue #6207. @@ -421,7 +421,7 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(Framebuffer const int x_offset = (params.fb_address - v->fb_address) / bpp; if (x_offset < params.fb_stride && v->height >= drawing_height) { // Pretty certainly a pure render-to-X-offset. - WARN_LOG_REPORT_ONCE(renderoffset, HLE, "Rendering to framebuffer offset at %08x +%dx%d (stride %d)", v->fb_address, x_offset, 0, v->fb_stride); + WARN_LOG_REPORT_ONCE(renderoffset, Log::HLE, "Rendering to framebuffer offset at %08x +%dx%d (stride %d)", v->fb_address, x_offset, 0, v->fb_stride); normal_vfb = v; gstate_c.SetCurRTOffset(x_offset, 0); normal_vfb->width = std::max((int)normal_vfb->width, x_offset + drawing_width); @@ -446,7 +446,7 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(Framebuffer // These are prioritized over normal VFBs matches, to ensure things work even if the higher-address one // is created first. Only enabled under compat flag. vfb = large_offset_vfb; - WARN_LOG_REPORT_ONCE(tokimeki, FRAMEBUF, "Detected FBO at Y offset %d of %08x: %08x", y_offset, large_offset_vfb->fb_address, params.fb_address); + WARN_LOG_REPORT_ONCE(tokimeki, Log::FrameBuf, "Detected FBO at Y offset %d of %08x: %08x", y_offset, large_offset_vfb->fb_address, params.fb_address); gstate_c.SetCurRTOffset(0, y_offset); vfb->height = std::max((int)vfb->height, y_offset + drawing_height); drawing_height += y_offset; @@ -552,7 +552,7 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(Framebuffer CopyToColorFromOverlappingFramebuffers(vfb); SetColorUpdated(vfb, skipDrawReason); - INFO_LOG(FRAMEBUF, "Creating FBO for %08x (z: %08x) : %d x %d x %s", vfb->fb_address, vfb->z_address, vfb->width, vfb->height, GeBufferFormatToString(vfb->fb_format)); + INFO_LOG(Log::FrameBuf, "Creating FBO for %08x (z: %08x) : %d x %d x %s", vfb->fb_address, vfb->z_address, vfb->width, vfb->height, GeBufferFormatToString(vfb->fb_format)); vfb->last_frame_render = gpuStats.numFlips; frameLastFramebufUsed_ = gpuStats.numFlips; @@ -572,7 +572,7 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(Framebuffer // We already have it! } else if (vfb != currentRenderVfb_) { // Use it as a render target. - DEBUG_LOG(FRAMEBUF, "Switching render target to FBO for %08x: %d x %d x %d ", vfb->fb_address, vfb->width, vfb->height, vfb->fb_format); + DEBUG_LOG(Log::FrameBuf, "Switching render target to FBO for %08x: %d x %d x %d ", vfb->fb_address, vfb->width, vfb->height, vfb->fb_format); vfb->usageFlags |= FB_USAGE_RENDER_COLOR; vfb->last_frame_render = gpuStats.numFlips; frameLastFramebufUsed_ = gpuStats.numFlips; @@ -622,11 +622,11 @@ void FramebufferManagerCommon::SetDepthFrameBuffer(bool isClearingDepth) { if (currentRenderVfb_->z_address != boundDepthBuffer || currentRenderVfb_->z_stride != boundDepthStride) { if (currentRenderVfb_->fb_address == boundDepthBuffer) { // Disallow setting depth buffer to the same address as the color buffer, usually means it's not used. - WARN_LOG_N_TIMES(z_reassign, 5, G3D, "Ignoring color matching depth buffer at %08x", boundDepthBuffer); + WARN_LOG_N_TIMES(z_reassign, 5, Log::G3D, "Ignoring color matching depth buffer at %08x", boundDepthBuffer); boundDepthBuffer = 0; boundDepthStride = 0; } - WARN_LOG_N_TIMES(z_reassign, 5, G3D, "Framebuffer at %08x/%d has switched associated depth buffer from %08x to %08x, updating.", + WARN_LOG_N_TIMES(z_reassign, 5, Log::G3D, "Framebuffer at %08x/%d has switched associated depth buffer from %08x to %08x, updating.", currentRenderVfb_->fb_address, currentRenderVfb_->fb_stride, currentRenderVfb_->z_address, boundDepthBuffer); // Technically, here we should copy away the depth buffer to another framebuffer that uses that z_address, or maybe @@ -717,7 +717,7 @@ void FramebufferManagerCommon::CopyToDepthFromOverlappingFramebuffers(VirtualFra } else if (source.channel == RASTER_COLOR && draw_->GetDeviceCaps().fragmentShaderDepthWriteSupported) { VirtualFramebuffer *src = source.vfb; if (src->fb_format != GE_FORMAT_565) { - WARN_LOG_ONCE(not565, G3D, "fb_format of buffer at %08x not 565 as expected", src->fb_address); + WARN_LOG_ONCE(not565, Log::G3D, "fb_format of buffer at %08x not 565 as expected", src->fb_address); } // Really hate to do this, but tracking the depth swizzle state across multiple @@ -880,11 +880,11 @@ void FramebufferManagerCommon::CopyToColorFromOverlappingFramebuffers(VirtualFra pass_name = "copy_color"; } else { if (PSP_CoreParameter().compat.flags().BlueToAlpha) { - WARN_LOG_ONCE(bta, G3D, "WARNING: Reinterpret encountered with BlueToAlpha on"); + WARN_LOG_ONCE(bta, Log::G3D, "WARNING: Reinterpret encountered with BlueToAlpha on"); } // Reinterpret! - WARN_LOG_N_TIMES(reint, 5, G3D, "Reinterpret detected from %08x_%s to %08x_%s", + WARN_LOG_N_TIMES(reint, 5, Log::G3D, "Reinterpret detected from %08x_%s to %08x_%s", src->fb_address, GeBufferFormatToString(src->fb_format), dst->fb_address, GeBufferFormatToString(dst->fb_format)); @@ -1134,7 +1134,7 @@ void FramebufferManagerCommon::PerformWriteFormattedFromMemory(u32 addr, int siz vfb->colorBindSeq = GetBindSeqCount(); if (vfb->fb_stride < stride) { - DEBUG_LOG(ME, "Changing stride for %08x from %d to %d", addr, vfb->fb_stride, stride); + DEBUG_LOG(Log::ME, "Changing stride for %08x from %d to %d", addr, vfb->fb_stride, stride); const int bpp = BufferFormatBytesPerPixel(fmt); ResizeFramebufFBO(vfb, stride, size / (bpp * stride)); // Resizing may change the viewport/etc. @@ -1174,7 +1174,7 @@ void FramebufferManagerCommon::UpdateFromMemory(u32 addr, int size) { DrawPixels(vfb, 0, 0, Memory::GetPointerUnchecked(addr), fmt, vfb->fb_stride, vfb->width, vfb->height, RASTER_COLOR, "UpdateFromMemory_DrawPixels"); SetColorUpdated(vfb, gstate_c.skipDrawReason); } else { - INFO_LOG(FRAMEBUF, "Invalidating FBO for %08x (%dx%d %s)", vfb->fb_address, vfb->width, vfb->height, GeBufferFormatToString(vfb->fb_format)); + INFO_LOG(Log::FrameBuf, "Invalidating FBO for %08x (%dx%d %s)", vfb->fb_address, vfb->width, vfb->height, GeBufferFormatToString(vfb->fb_format)); DestroyFramebuf(vfb); vfbs_.erase(vfbs_.begin() + i--); } @@ -1255,7 +1255,7 @@ bool FramebufferManagerCommon::BindFramebufferAsColorTexture(int stage, VirtualF // Currently rendering to this framebuffer. Need to make a copy. if (!skipCopy && framebuffer == currentRenderVfb_) { // Self-texturing, need a copy currently (some backends can potentially support it though). - WARN_LOG_ONCE(selfTextureCopy, G3D, "Attempting to texture from current render target (src=%08x / target=%08x / flags=%d), making a copy", framebuffer->fb_address, currentRenderVfb_->fb_address, flags); + WARN_LOG_ONCE(selfTextureCopy, Log::G3D, "Attempting to texture from current render target (src=%08x / target=%08x / flags=%d), making a copy", framebuffer->fb_address, currentRenderVfb_->fb_address, flags); // TODO: Maybe merge with bvfbs_? Not sure if those could be packing, and they're created at a different size. if (currentFramebufferCopy_ && (flags & BINDFBCOLOR_UNCACHED) == 0) { // We have a copy already that hasn't been invalidated, let's keep using it. @@ -1289,7 +1289,7 @@ bool FramebufferManagerCommon::BindFramebufferAsColorTexture(int stage, VirtualF return true; } else { // Here it's an error because for some reason skipCopy is true. That shouldn't really happen. - ERROR_LOG_REPORT_ONCE(selfTextureFail, G3D, "Attempting to texture from target (src=%08x / target=%08x / flags=%d)", framebuffer->fb_address, currentRenderVfb_->fb_address, flags); + ERROR_LOG_REPORT_ONCE(selfTextureFail, Log::G3D, "Attempting to texture from target (src=%08x / target=%08x / flags=%d)", framebuffer->fb_address, currentRenderVfb_->fb_address, flags); // To do this safely in Vulkan, we need to use input attachments. // Actually if the texture region and render regions don't overlap, this is safe, but we need // to transition to GENERAL image layout which will take some trickery. @@ -1499,11 +1499,11 @@ Draw::Texture *FramebufferManagerCommon::MakePixelTexture(const u8 *srcPixels, G // better be fast. So does God of War, a lot of the time, a bit unclear what it's doing. Draw::Texture *tex = draw_->CreateTexture(desc); if (!tex) { - ERROR_LOG(G3D, "Failed to create DrawPixels texture"); + ERROR_LOG(Log::G3D, "Failed to create DrawPixels texture"); } // We don't need to count here, already counted by numUploads by the caller. - // INFO_LOG(G3D, "Creating drawPixelsCache texture: %dx%d", tex->Width(), tex->Height()); + // INFO_LOG(Log::G3D, "Creating drawPixelsCache texture: %dx%d", tex->Width(), tex->Height()); DrawPixelsEntry entry{ tex, imageHash, frameNumber }; drawPixelsCache_.push_back(entry); @@ -1554,9 +1554,9 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { if (displayFramebufPtr_ == 0) { if (GetUIState() != UISTATE_PAUSEMENU) { if (Core_IsStepping()) - VERBOSE_LOG(FRAMEBUF, "Display disabled, displaying only black"); + VERBOSE_LOG(Log::FrameBuf, "Display disabled, displaying only black"); else - DEBUG_LOG(FRAMEBUF, "Display disabled, displaying only black"); + DEBUG_LOG(Log::FrameBuf, "Display disabled, displaying only black"); } // No framebuffer to display! Clear to black. if (useBufferedRendering_) { @@ -1609,7 +1609,7 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { if (vfb) { // Okay, we found one above. // Log should be "Displaying from framebuf" but not worth changing the report. - INFO_LOG_REPORT_ONCE(displayoffset, FRAMEBUF, "Rendering from framebuf with offset %08x -> %08x+%dx%d", addr, vfb->fb_address, offsetX, offsetY); + INFO_LOG_REPORT_ONCE(displayoffset, Log::FrameBuf, "Rendering from framebuf with offset %08x -> %08x+%dx%d", addr, vfb->fb_address, offsetX, offsetY); } } @@ -1624,7 +1624,7 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { DrawFramebufferToOutput(Memory::GetPointerUnchecked(fbaddr), displayStride_, displayFormat_); return; } else { - DEBUG_LOG(FRAMEBUF, "Found no FBO to display! displayFBPtr = %08x", fbaddr); + DEBUG_LOG(Log::FrameBuf, "Found no FBO to display! displayFBPtr = %08x", fbaddr); // No framebuffer to display! Clear to black. if (useBufferedRendering_) { // Bind and clear the backbuffer. This should be the first time during the frame that it's bound. @@ -1651,9 +1651,9 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { if (vfb->fbo) { if (GetUIState() != UISTATE_PAUSEMENU) { if (Core_IsStepping()) - VERBOSE_LOG(FRAMEBUF, "Displaying FBO %08x", vfb->fb_address); + VERBOSE_LOG(Log::FrameBuf, "Displaying FBO %08x", vfb->fb_address); else - DEBUG_LOG(FRAMEBUF, "Displaying FBO %08x", vfb->fb_address); + DEBUG_LOG(Log::FrameBuf, "Displaying FBO %08x", vfb->fb_address); } float u0 = offsetX / (float)vfb->bufferWidth; @@ -1694,7 +1694,7 @@ void FramebufferManagerCommon::CopyDisplayToOutput(bool reallyDirty) { presentation_->SourceFramebuffer(vfb->fbo, actualWidth, actualHeight); presentation_->CopyToOutput(flags, uvRotation, u0, v0, u1, v1); } else if (useBufferedRendering_) { - WARN_LOG(FRAMEBUF, "Current VFB lacks an FBO: %08x", vfb->fb_address); + WARN_LOG(Log::FrameBuf, "Current VFB lacks an FBO: %08x", vfb->fb_address); } // This may get called mid-draw if the game uses an immediate flip. @@ -1727,7 +1727,7 @@ void FramebufferManagerCommon::DecimateFBOs() { if (vfb != displayFramebuf_ && vfb != prevDisplayFramebuf_ && vfb != prevPrevDisplayFramebuf_) { if (age > FBO_OLD_AGE) { - INFO_LOG(FRAMEBUF, "Decimating FBO for %08x (%ix%i %s), age %i", vfb->fb_address, vfb->width, vfb->height, GeBufferFormatToString(vfb->fb_format), age); + INFO_LOG(Log::FrameBuf, "Decimating FBO for %08x (%ix%i %s), age %i", vfb->fb_address, vfb->width, vfb->height, GeBufferFormatToString(vfb->fb_format), age); DestroyFramebuf(vfb); vfbs_.erase(vfbs_.begin() + i--); } @@ -1749,7 +1749,7 @@ void FramebufferManagerCommon::DecimateFBOs() { VirtualFramebuffer *vfb = bvfbs_[i]; int age = frameLastFramebufUsed_ - vfb->last_frame_render; if (age > FBO_OLD_AGE) { - INFO_LOG(FRAMEBUF, "Decimating FBO for %08x (%dx%d %s), age %i", vfb->fb_address, vfb->width, vfb->height, GeBufferFormatToString(vfb->fb_format), age); + INFO_LOG(Log::FrameBuf, "Decimating FBO for %08x (%dx%d %s), age %i", vfb->fb_address, vfb->width, vfb->height, GeBufferFormatToString(vfb->fb_format), age); DestroyFramebuf(vfb); bvfbs_.erase(bvfbs_.begin() + i--); } @@ -1760,7 +1760,7 @@ void FramebufferManagerCommon::DecimateFBOs() { for (auto it = drawPixelsCache_.begin(); it != drawPixelsCache_.end(); ) { int age = draw_->GetFrameCount() - it->frameNumber; if (age > 10) { - // INFO_LOG(G3D, "Releasing drawPixelsCache texture: %dx%d", it->tex->Width(), it->tex->Height()); + // INFO_LOG(Log::G3D, "Releasing drawPixelsCache texture: %dx%d", it->tex->Width(), it->tex->Height()); it->tex->Release(); it->tex = nullptr; it = drawPixelsCache_.erase(it); @@ -1824,9 +1824,9 @@ void FramebufferManagerCommon::ResizeFramebufFBO(VirtualFramebuffer *vfb, int w, bool creating = old.bufferWidth == 0; if (creating) { - WARN_LOG(FRAMEBUF, "Creating %s FBO at %08x/%08x stride=%d %dx%d (force=%d)", GeBufferFormatToString(vfb->fb_format), vfb->fb_address, vfb->z_address, vfb->fb_stride, vfb->bufferWidth, vfb->bufferHeight, (int)force); + WARN_LOG(Log::FrameBuf, "Creating %s FBO at %08x/%08x stride=%d %dx%d (force=%d)", GeBufferFormatToString(vfb->fb_format), vfb->fb_address, vfb->z_address, vfb->fb_stride, vfb->bufferWidth, vfb->bufferHeight, (int)force); } else { - WARN_LOG(FRAMEBUF, "Resizing %s FBO at %08x/%08x stride=%d from %dx%d to %dx%d (force=%d, skipCopy=%d)", GeBufferFormatToString(vfb->fb_format), vfb->fb_address, vfb->z_address, vfb->fb_stride, old.bufferWidth, old.bufferHeight, vfb->bufferWidth, vfb->bufferHeight, (int)force, (int)skipCopy); + WARN_LOG(Log::FrameBuf, "Resizing %s FBO at %08x/%08x stride=%d from %dx%d to %dx%d (force=%d, skipCopy=%d)", GeBufferFormatToString(vfb->fb_format), vfb->fb_address, vfb->z_address, vfb->fb_stride, old.bufferWidth, old.bufferHeight, vfb->bufferWidth, vfb->bufferHeight, (int)force, (int)skipCopy); } // During hardware rendering, we always render at full color depth even if the game wouldn't on real hardware. @@ -1861,7 +1861,7 @@ void FramebufferManagerCommon::ResizeFramebufFBO(VirtualFramebuffer *vfb, int w, NotifyMemInfo(MemBlockFlags::ALLOC, vfb->z_address, vfb->z_stride * vfb->height * sizeof(uint16_t), buf, len); } if (old.fbo) { - INFO_LOG(FRAMEBUF, "Resizing FBO for %08x : %dx%dx%s", vfb->fb_address, w, h, GeBufferFormatToString(vfb->fb_format)); + INFO_LOG(Log::FrameBuf, "Resizing FBO for %08x : %dx%dx%s", vfb->fb_address, w, h, GeBufferFormatToString(vfb->fb_format)); if (vfb->fbo) { draw_->BindFramebufferAsRenderTarget(vfb->fbo, { Draw::RPAction::CLEAR, Draw::RPAction::CLEAR, Draw::RPAction::CLEAR }, "ResizeFramebufFBO"); if (!skipCopy) { @@ -1880,7 +1880,7 @@ void FramebufferManagerCommon::ResizeFramebufFBO(VirtualFramebuffer *vfb, int w, currentRenderVfb_ = vfb; if (!vfb->fbo) { - ERROR_LOG(FRAMEBUF, "Error creating FBO during resize! %dx%d", vfb->renderWidth, vfb->renderHeight); + ERROR_LOG(Log::FrameBuf, "Error creating FBO during resize! %dx%d", vfb->renderWidth, vfb->renderHeight); vfb->last_frame_failed = gpuStats.numFlips; } } @@ -1986,7 +1986,7 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, // Not likely to be a correct color format copy for this buffer. Ignore it, there will either be RAM // that can be displayed from, or another matching buffer with the right format if rendering is going on. // If we had scoring here, we should strongly penalize this target instead of ignoring it. - WARN_LOG_N_TIMES(notify_copy_2x, 5, G3D, "Framebuffer size %08x conspicuously not matching copy size %08x for source in NotifyFramebufferCopy. Ignoring.", size, vfb_size); + WARN_LOG_N_TIMES(notify_copy_2x, 5, Log::G3D, "Framebuffer size %08x conspicuously not matching copy size %08x for source in NotifyFramebufferCopy. Ignoring.", size, vfb_size); continue; } @@ -1994,7 +1994,7 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, // Seems likely we are looking at a potential copy of 32-bit pixels (like video) to an old 16-bit buffer, // which is very likely simply the wrong target, so skip it. See issue #17740 where this happens in Naruto Ultimate Ninja Heroes 2. // Probably no point to give it a bad score and let it pass to sorting, as we're pretty sure here. - WARN_LOG_N_TIMES(notify_copy_2x, 5, G3D, "Framebuffer size %08x too small for %08x bytes of data and also 16-bit (%s), and not rendered to this frame. Ignoring.", vfb_size, size, GeBufferFormatToString(vfb->fb_format)); + WARN_LOG_N_TIMES(notify_copy_2x, 5, Log::G3D, "Framebuffer size %08x too small for %08x bytes of data and also 16-bit (%s), and not rendered to this frame. Ignoring.", vfb_size, size, GeBufferFormatToString(vfb->fb_format)); continue; } @@ -2034,7 +2034,7 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, // Not likely to be a correct color format copy for this buffer. Ignore it, there will either be RAM // that can be displayed from, or another matching buffer with the right format if rendering is going on. // If we had scoring here, we should strongly penalize this target instead of ignoring it. - WARN_LOG_N_TIMES(notify_copy_2x, 5, G3D, "Framebuffer size %08x conspicuously not matching copy size %08x for dest in NotifyFramebufferCopy. Ignoring.", size, vfb_size); + WARN_LOG_N_TIMES(notify_copy_2x, 5, Log::G3D, "Framebuffer size %08x conspicuously not matching copy size %08x for dest in NotifyFramebufferCopy. Ignoring.", size, vfb_size); continue; } @@ -2095,7 +2095,7 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, log += "\n"; } } - WARN_LOG(G3D, "Copy: Multiple src vfb candidates for (src: %08x, size: %d):\n%s (%s)", src, size, log.c_str(), RasterChannelToString(channel)); + WARN_LOG(Log::G3D, "Copy: Multiple src vfb candidates for (src: %08x, size: %d):\n%s (%s)", src, size, log.c_str(), RasterChannelToString(channel)); } } @@ -2110,7 +2110,7 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, log += "\n"; } } - WARN_LOG(G3D, "Copy: Multiple dst vfb candidates for (dst: %08x, size: %d):\n%s (%s)", src, size, log.c_str(), RasterChannelToString(channel)); + WARN_LOG(Log::G3D, "Copy: Multiple dst vfb candidates for (dst: %08x, size: %d):\n%s (%s)", src, size, log.c_str(), RasterChannelToString(channel)); } } @@ -2140,9 +2140,9 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, if (dstBuffer && srcBuffer) { if (srcBuffer == dstBuffer) { - WARN_LOG_ONCE(dstsrccpy, G3D, "Intra-buffer memcpy (not supported) %08x -> %08x (size: %x)", src, dst, size); + WARN_LOG_ONCE(dstsrccpy, Log::G3D, "Intra-buffer memcpy (not supported) %08x -> %08x (size: %x)", src, dst, size); } else { - WARN_LOG_ONCE(dstnotsrccpy, G3D, "Inter-buffer memcpy %08x -> %08x (size: %x)", src, dst, size); + WARN_LOG_ONCE(dstnotsrccpy, Log::G3D, "Inter-buffer memcpy %08x -> %08x (size: %x)", src, dst, size); // Just do the blit! BlitFramebuffer(dstBuffer, 0, dstY, srcBuffer, 0, srcY, srcBuffer->width, srcH, 0, channel, "Blit_InterBufferMemcpy"); SetColorUpdated(dstBuffer, skipDrawReason); @@ -2153,7 +2153,7 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, if (flags & GPUCopyFlag::MEMSET) { gpuStats.numClears++; } - WARN_LOG_N_TIMES(btucpy, 5, G3D, "Memcpy fbo upload %08x -> %08x (size: %x)", src, dst, size); + WARN_LOG_N_TIMES(btucpy, 5, Log::G3D, "Memcpy fbo upload %08x -> %08x (size: %x)", src, dst, size); FlushBeforeCopy(); // TODO: Hot Shots Golf makes a lot of these during the "meter", to copy back the image to the screen, it copies line by line. @@ -2168,12 +2168,12 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, // This is a memcpy, let's still copy just in case. return false; } else if (srcBuffer) { - WARN_LOG_N_TIMES(btdcpy, 5, G3D, "Memcpy fbo download %08x -> %08x", src, dst); + WARN_LOG_N_TIMES(btdcpy, 5, Log::G3D, "Memcpy fbo download %08x -> %08x", src, dst); FlushBeforeCopy(); // TODO: In Hot Shots Golf, check if we can do a readback to a framebuffer here. // Again we have the problem though that it's doing a lot of small copies here, one for each line. if (srcH == 0 || srcY + srcH > srcBuffer->bufferHeight) { - WARN_LOG_ONCE(btdcpyheight, G3D, "Memcpy fbo download %08x -> %08x skipped, %d+%d is taller than %d", src, dst, srcY, srcH, srcBuffer->bufferHeight); + WARN_LOG_ONCE(btdcpyheight, Log::G3D, "Memcpy fbo download %08x -> %08x skipped, %d+%d is taller than %d", src, dst, srcY, srcH, srcBuffer->bufferHeight); } else if (g_Config.iSkipGPUReadbackMode == (int)SkipGPUReadbackMode::NO_SKIP && (!srcBuffer->memoryUpdated || channel == RASTER_DEPTH)) { Draw::ReadbackMode readbackMode = Draw::ReadbackMode::BLOCK; if (PSP_CoreParameter().compat.flags().AllowDelayedReadbacks) { @@ -2203,7 +2203,7 @@ bool FramebufferManagerCommon::FindTransferFramebuffer(u32 basePtr, int stride_p rect->vfb = nullptr; if (!stride_pixels) { - WARN_LOG(G3D, "Zero stride in FindTransferFrameBuffer, ignoring"); + WARN_LOG(Log::G3D, "Zero stride in FindTransferFrameBuffer, ignoring"); return false; } @@ -2226,7 +2226,7 @@ bool FramebufferManagerCommon::FindTransferFramebuffer(u32 basePtr, int stride_p // and also #17878 where a game does ram->buffer to an auto-swizzling (|0x600000) address, // to initialize Z with a pre-rendered depth buffer. if (vfb->z_address == basePtr && vfb->BufferByteStride(RASTER_DEPTH) == byteStride && PSP_CoreParameter().compat.flags().BlockTransferDepth) { - WARN_LOG_N_TIMES(z_xfer, 5, G3D, "FindTransferFramebuffer: found matching depth buffer, %08x (dest=%d, bpp=%d)", basePtr, (int)destination, bpp); + WARN_LOG_N_TIMES(z_xfer, 5, Log::G3D, "FindTransferFramebuffer: found matching depth buffer, %08x (dest=%d, bpp=%d)", basePtr, (int)destination, bpp); candidate.channel = RASTER_DEPTH; candidate.x_bytes = x_pixels * bpp; candidate.w_bytes = w_pixels * bpp; @@ -2336,7 +2336,7 @@ bool FramebufferManagerCommon::FindTransferFramebuffer(u32 basePtr, int stride_p for (size_t i = 0; i < candidates.size(); i++) { log += " - " + candidates[i].ToString() + "\n"; } - WARN_LOG(G3D, "Multiple framebuffer candidates for %08x/%d/%d %d,%d %dx%d (dest = %d):\n%s", basePtr, stride_pixels, bpp, x_pixels, y, w_pixels, h, (int)destination, log.c_str()); + WARN_LOG(Log::G3D, "Multiple framebuffer candidates for %08x/%d/%d %d,%d %dx%d (dest = %d):\n%s", basePtr, stride_pixels, bpp, x_pixels, y, w_pixels, h, (int)destination, log.c_str()); } } @@ -2345,14 +2345,14 @@ bool FramebufferManagerCommon::FindTransferFramebuffer(u32 basePtr, int stride_p return true; } else { if (Memory::IsVRAMAddress(basePtr) && destination && h >= 128) { - WARN_LOG_N_TIMES(nocands, 5, G3D, "Didn't find a destination candidate for %08x/%d/%d %d,%d %dx%d", basePtr, stride_pixels, bpp, x_pixels, y, w_pixels, h); + WARN_LOG_N_TIMES(nocands, 5, Log::G3D, "Didn't find a destination candidate for %08x/%d/%d %d,%d %dx%d", basePtr, stride_pixels, bpp, x_pixels, y, w_pixels, h); } return false; } } VirtualFramebuffer *FramebufferManagerCommon::CreateRAMFramebuffer(uint32_t fbAddress, int width, int height, int stride, GEBufferFormat format) { - INFO_LOG(G3D, "Creating RAM framebuffer at %08x (%dx%d, stride %d, fb_format %d)", fbAddress, width, height, stride, format); + INFO_LOG(Log::G3D, "Creating RAM framebuffer at %08x (%dx%d, stride %d, fb_format %d)", fbAddress, width, height, stride, format); RasterChannel channel = format == GE_FORMAT_DEPTH16 ? RASTER_DEPTH : RASTER_COLOR; @@ -2453,7 +2453,7 @@ VirtualFramebuffer *FramebufferManagerCommon::FindDownloadTempBuffer(VirtualFram // We always create a color-only framebuffer here - readbacks of depth convert to color while translating the values. nvfb->fbo = draw_->CreateFramebuffer({ nvfb->bufferWidth, nvfb->bufferHeight, 1, 1, 0, false, name }); if (!nvfb->fbo) { - ERROR_LOG(FRAMEBUF, "Error creating FBO! %d x %d", nvfb->renderWidth, nvfb->renderHeight); + ERROR_LOG(Log::FrameBuf, "Error creating FBO! %d x %d", nvfb->renderWidth, nvfb->renderHeight); delete nvfb; return nullptr; } @@ -2642,12 +2642,12 @@ bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dst int buffer_bpp = BufferFormatBytesPerPixel(srcRect.vfb->Format(srcRect.channel)); if (bpp != buffer_bpp) { - WARN_LOG_ONCE(intrabpp, G3D, "Mismatched transfer bpp in intra-buffer block transfer. Was %d, expected %d.", bpp, buffer_bpp); + WARN_LOG_ONCE(intrabpp, Log::G3D, "Mismatched transfer bpp in intra-buffer block transfer. Was %d, expected %d.", bpp, buffer_bpp); // We just switch to using the buffer's bpp, since we've already converted the rectangle to byte offsets. bpp = buffer_bpp; } - WARN_LOG_N_TIMES(dstsrc, 5, G3D, "Intra-buffer block transfer %dx%d %dbpp from %08x (x:%d y:%d stride:%d) -> %08x (x:%d y:%d stride:%d)", + WARN_LOG_N_TIMES(dstsrc, 5, Log::G3D, "Intra-buffer block transfer %dx%d %dbpp from %08x (x:%d y:%d stride:%d) -> %08x (x:%d y:%d stride:%d)", width, height, bpp, srcBasePtr, srcRect.x_bytes / bpp, srcRect.y, srcStride, dstBasePtr, dstRect.x_bytes / bpp, dstRect.y, dstStride); @@ -2661,7 +2661,7 @@ bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dst // Straightforward blit between two same-format framebuffers. if (srcRect.vfb && srcRect.channel == dstRect.channel && srcRect.vfb->Format(srcRect.channel) == dstRect.vfb->Format(dstRect.channel)) { - WARN_LOG_N_TIMES(dstnotsrc, 5, G3D, "Inter-buffer %s block transfer %dx%d %dbpp from %08x (x:%d y:%d stride:%d %s) -> %08x (x:%d y:%d stride:%d %s)", + WARN_LOG_N_TIMES(dstnotsrc, 5, Log::G3D, "Inter-buffer %s block transfer %dx%d %dbpp from %08x (x:%d y:%d stride:%d %s) -> %08x (x:%d y:%d stride:%d %s)", RasterChannelToString(srcRect.channel), width, height, bpp, srcBasePtr, srcRect.x_bytes / bpp, srcRect.y, srcStride, GeBufferFormatToString(srcRect.vfb->fb_format), @@ -2670,7 +2670,7 @@ bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dst // Straight blit will do, but check the bpp, we might need to convert coordinates differently. int buffer_bpp = BufferFormatBytesPerPixel(srcRect.vfb->Format(srcRect.channel)); if (bpp != buffer_bpp) { - WARN_LOG_ONCE(intrabpp, G3D, "Mismatched transfer bpp in inter-buffer block transfer. Was %d, expected %d.", bpp, buffer_bpp); + WARN_LOG_ONCE(intrabpp, Log::G3D, "Mismatched transfer bpp in inter-buffer block transfer. Was %d, expected %d.", bpp, buffer_bpp); // We just switch to using the buffer's bpp, since we've already converted the rectangle to byte offsets. bpp = buffer_bpp; } @@ -2682,7 +2682,7 @@ bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dst } // Getting to the more complex cases. Have not actually seen much of these yet. - WARN_LOG_N_TIMES(blockformat, 5, G3D, "Mismatched buffer formats in block transfer: %s->%s (%dx%d)", + WARN_LOG_N_TIMES(blockformat, 5, Log::G3D, "Mismatched buffer formats in block transfer: %s->%s (%dx%d)", GeBufferFormatToString(srcRect.vfb->Format(srcRect.channel)), GeBufferFormatToString(dstRect.vfb->Format(dstRect.channel)), width, height); @@ -2695,7 +2695,7 @@ bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dst // Handle depth uploads directly here, and let's not bother copying the data. This is compat-flag-gated for now, // may generalize it when I remove the compat flag. if (dstRect.channel == RASTER_DEPTH) { - WARN_LOG_ONCE(btud, G3D, "Block transfer upload %08x -> %08x (%dx%d %d,%d bpp=%d %s)", srcBasePtr, dstBasePtr, width, height, dstX, dstY, bpp, RasterChannelToString(dstRect.channel)); + WARN_LOG_ONCE(btud, Log::G3D, "Block transfer upload %08x -> %08x (%dx%d %d,%d bpp=%d %s)", srcBasePtr, dstBasePtr, width, height, dstX, dstY, bpp, RasterChannelToString(dstRect.channel)); FlushBeforeCopy(); const u8 *srcBase = Memory::GetPointerUnchecked(srcBasePtr) + (srcX + srcY * srcStride) * bpp; DrawPixels(dstRect.vfb, dstX, dstY, srcBase, dstRect.vfb->Format(dstRect.channel), srcStride * bpp / 2, (int)(dstRect.w_bytes / 2), dstRect.h, dstRect.channel, "BlockTransferCopy_DrawPixelsDepth"); @@ -2711,7 +2711,7 @@ bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dst return false; } - WARN_LOG_N_TIMES(btd, 10, G3D, "Block transfer readback %dx%d %dbpp from %08x (x:%d y:%d stride:%d) -> %08x (x:%d y:%d stride:%d)", + WARN_LOG_N_TIMES(btd, 10, Log::G3D, "Block transfer readback %dx%d %dbpp from %08x (x:%d y:%d stride:%d) -> %08x (x:%d y:%d stride:%d)", width, height, bpp, srcBasePtr, srcRect.x_bytes / bpp, srcRect.y, srcStride, dstBasePtr, dstRect.x_bytes / bpp, dstRect.y, dstStride); @@ -2721,10 +2721,10 @@ bool FramebufferManagerCommon::NotifyBlockTransferBefore(u32 dstBasePtr, int dst const float srcXFactor = (float)bpp / srcBpp; const bool tooTall = srcY + srcRect.h > srcRect.vfb->bufferHeight; if (srcRect.h <= 0 || (tooTall && srcY != 0)) { - WARN_LOG_ONCE(btdheight, G3D, "Block transfer download %08x -> %08x skipped, %d+%d is taller than %d", srcBasePtr, dstBasePtr, srcRect.y, srcRect.h, srcRect.vfb->bufferHeight); + WARN_LOG_ONCE(btdheight, Log::G3D, "Block transfer download %08x -> %08x skipped, %d+%d is taller than %d", srcBasePtr, dstBasePtr, srcRect.y, srcRect.h, srcRect.vfb->bufferHeight); } else { if (tooTall) { - WARN_LOG_ONCE(btdheight, G3D, "Block transfer download %08x -> %08x dangerous, %d+%d is taller than %d", srcBasePtr, dstBasePtr, srcRect.y, srcRect.h, srcRect.vfb->bufferHeight); + WARN_LOG_ONCE(btdheight, Log::G3D, "Block transfer download %08x -> %08x dangerous, %d+%d is taller than %d", srcBasePtr, dstBasePtr, srcRect.y, srcRect.h, srcRect.vfb->bufferHeight); } Draw::ReadbackMode readbackMode = Draw::ReadbackMode::BLOCK; if (PSP_CoreParameter().compat.flags().AllowDelayedReadbacks) { @@ -2770,7 +2770,7 @@ void FramebufferManagerCommon::NotifyBlockTransferAfter(u32 dstBasePtr, int dstS } if (dstBuffer && !srcBuffer) { - WARN_LOG_ONCE(btu, G3D, "Block transfer upload %08x -> %08x (%dx%d %d,%d bpp=%d)", srcBasePtr, dstBasePtr, width, height, dstX, dstY, bpp); + WARN_LOG_ONCE(btu, Log::G3D, "Block transfer upload %08x -> %08x (%dx%d %d,%d bpp=%d)", srcBasePtr, dstBasePtr, width, height, dstX, dstY, bpp); FlushBeforeCopy(); const u8 *srcBase = Memory::GetPointerUnchecked(srcBasePtr) + (srcX + srcY * srcStride) * bpp; @@ -2808,7 +2808,7 @@ void FramebufferManagerCommon::NotifyDisplayResized() { pixelHeight_ = PSP_CoreParameter().pixelHeight; presentation_->UpdateDisplaySize(pixelWidth_, pixelHeight_); - INFO_LOG(G3D, "FramebufferManagerCommon::NotifyDisplayResized: %dx%d", pixelWidth_, pixelHeight_); + INFO_LOG(Log::G3D, "FramebufferManagerCommon::NotifyDisplayResized: %dx%d", pixelWidth_, pixelHeight_); // No drawing is allowed here. This includes anything that might potentially touch a command buffer, like creating images! // So we need to defer the post processing initialization. @@ -2847,7 +2847,7 @@ void FramebufferManagerCommon::DestroyAllFBOs() { prevPrevDisplayFramebuf_ = nullptr; for (VirtualFramebuffer *vfb : vfbs_) { - INFO_LOG(FRAMEBUF, "Destroying FBO for %08x : %i x %i x %i", vfb->fb_address, vfb->width, vfb->height, vfb->fb_format); + INFO_LOG(Log::FrameBuf, "Destroying FBO for %08x : %i x %i x %i", vfb->fb_address, vfb->width, vfb->height, vfb->fb_format); DestroyFramebuf(vfb); } vfbs_.clear(); @@ -3105,7 +3105,7 @@ bool FramebufferManagerCommon::GetOutputFramebuffer(GPUDebugBuffer &buffer) { // can't entirely be rid of the CPU path.) -- unknown void FramebufferManagerCommon::ReadbackFramebuffer(VirtualFramebuffer *vfb, int x, int y, int w, int h, RasterChannel channel, Draw::ReadbackMode mode) { if (w <= 0 || h <= 0) { - ERROR_LOG(G3D, "Bad inputs to ReadbackFramebufferSync: %d %d %d %d", x, y, w, h); + ERROR_LOG(Log::G3D, "Bad inputs to ReadbackFramebufferSync: %d %d %d %d", x, y, w, h); return; } @@ -3133,7 +3133,7 @@ void FramebufferManagerCommon::ReadbackFramebuffer(VirtualFramebuffer *vfb, int const int dstSize = ((h - 1) * stride + w) * dstBpp; if (!Memory::IsValidRange(fb_address + dstByteOffset, dstSize)) { - ERROR_LOG_REPORT(G3D, "ReadbackFramebufferSync would write outside of memory, ignoring"); + ERROR_LOG_REPORT(Log::G3D, "ReadbackFramebufferSync would write outside of memory, ignoring"); return; } @@ -3141,7 +3141,7 @@ void FramebufferManagerCommon::ReadbackFramebuffer(VirtualFramebuffer *vfb, int // We always need to convert from the framebuffer native format. // Right now that's always 8888. - DEBUG_LOG(G3D, "Reading framebuffer to mem, fb_address = %08x, ptr=%p", fb_address, destPtr); + DEBUG_LOG(Log::G3D, "Reading framebuffer to mem, fb_address = %08x, ptr=%p", fb_address, destPtr); if (channel == RASTER_DEPTH) { _assert_msg_(vfb && vfb->z_address != 0 && vfb->z_stride != 0, "Depth buffer invalid"); @@ -3453,7 +3453,7 @@ void FramebufferManagerCommon::BlitFramebuffer(VirtualFramebuffer *dst, int dstX if (src == dst && srcX == dstX && srcY == dstY) { // Let's just skip a copy where the destination is equal to the source. - WARN_LOG_REPORT_ONCE(blitSame, G3D, "Skipped blit with equal dst and src"); + WARN_LOG_REPORT_ONCE(blitSame, Log::G3D, "Skipped blit with equal dst and src"); return; } @@ -3574,7 +3574,7 @@ VirtualFramebuffer *FramebufferManagerCommon::ResolveFramebufferColorToFormat(Vi vfb->fb_format = newFormat; // stride stays the same since it's in pixels. - WARN_LOG(G3D, "Creating %s clone of %08x/%08x/%s (%dx%d -> %dx%d)", GeBufferFormatToString(newFormat), src->fb_address, src->z_address, GeBufferFormatToString(src->fb_format), src->width, src->height, vfb->width, vfb->height); + WARN_LOG(Log::G3D, "Creating %s clone of %08x/%08x/%s (%dx%d -> %dx%d)", GeBufferFormatToString(newFormat), src->fb_address, src->z_address, GeBufferFormatToString(src->fb_format), src->width, src->height, vfb->width, vfb->height); char tag[128]; FormatFramebufferName(vfb, tag, sizeof(tag)); diff --git a/GPU/Common/GPUStateUtils.cpp b/GPU/Common/GPUStateUtils.cpp index 2177bf31db..4097d5cce7 100644 --- a/GPU/Common/GPUStateUtils.cpp +++ b/GPU/Common/GPUStateUtils.cpp @@ -920,7 +920,7 @@ static bool SimulateLogicOpIfNeeded(BlendFactor &srcBlend, BlendFactor &dstBlend return true; case GE_LOGIC_AND: case GE_LOGIC_AND_REVERSE: - WARN_LOG_REPORT_ONCE(d3dLogicOpAnd, G3D, "Unsupported AND logic op: %x", gstate.getLogicOp()); + WARN_LOG_REPORT_ONCE(d3dLogicOpAnd, Log::G3D, "Unsupported AND logic op: %x", gstate.getLogicOp()); break; case GE_LOGIC_COPY: // This is the same as off. @@ -933,13 +933,13 @@ static bool SimulateLogicOpIfNeeded(BlendFactor &srcBlend, BlendFactor &dstBlend case GE_LOGIC_NAND: case GE_LOGIC_EQUIV: // Handled in the shader. - WARN_LOG_REPORT_ONCE(d3dLogicOpAndInverted, G3D, "Attempted invert for logic op: %x", gstate.getLogicOp()); + WARN_LOG_REPORT_ONCE(d3dLogicOpAndInverted, Log::G3D, "Attempted invert for logic op: %x", gstate.getLogicOp()); break; case GE_LOGIC_INVERTED: srcBlend = BlendFactor::ONE; dstBlend = BlendFactor::ONE; blendEq = BlendEq::SUBTRACT; - WARN_LOG_REPORT_ONCE(d3dLogicOpInverted, G3D, "Attempted inverse for logic op: %x", gstate.getLogicOp()); + WARN_LOG_REPORT_ONCE(d3dLogicOpInverted, Log::G3D, "Attempted inverse for logic op: %x", gstate.getLogicOp()); return true; case GE_LOGIC_NOOP: srcBlend = BlendFactor::ZERO; @@ -947,7 +947,7 @@ static bool SimulateLogicOpIfNeeded(BlendFactor &srcBlend, BlendFactor &dstBlend blendEq = BlendEq::ADD; return true; case GE_LOGIC_XOR: - WARN_LOG_REPORT_ONCE(d3dLogicOpOrXor, G3D, "Unsupported XOR logic op: %x", gstate.getLogicOp()); + WARN_LOG_REPORT_ONCE(d3dLogicOpOrXor, Log::G3D, "Unsupported XOR logic op: %x", gstate.getLogicOp()); break; case GE_LOGIC_OR: case GE_LOGIC_OR_INVERTED: @@ -955,16 +955,16 @@ static bool SimulateLogicOpIfNeeded(BlendFactor &srcBlend, BlendFactor &dstBlend srcBlend = BlendFactor::ONE; dstBlend = BlendFactor::ONE; blendEq = BlendEq::ADD; - WARN_LOG_REPORT_ONCE(d3dLogicOpOr, G3D, "Attempted or for logic op: %x", gstate.getLogicOp()); + WARN_LOG_REPORT_ONCE(d3dLogicOpOr, Log::G3D, "Attempted or for logic op: %x", gstate.getLogicOp()); return true; case GE_LOGIC_OR_REVERSE: - WARN_LOG_REPORT_ONCE(d3dLogicOpOrReverse, G3D, "Unsupported OR REVERSE logic op: %x", gstate.getLogicOp()); + WARN_LOG_REPORT_ONCE(d3dLogicOpOrReverse, Log::G3D, "Unsupported OR REVERSE logic op: %x", gstate.getLogicOp()); break; case GE_LOGIC_SET: srcBlend = BlendFactor::ONE; dstBlend = BlendFactor::ONE; blendEq = BlendEq::ADD; - WARN_LOG_REPORT_ONCE(d3dLogicOpSet, G3D, "Attempted set for logic op: %x", gstate.getLogicOp()); + WARN_LOG_REPORT_ONCE(d3dLogicOpSet, Log::G3D, "Attempted set for logic op: %x", gstate.getLogicOp()); return true; } } else { @@ -1284,7 +1284,7 @@ static void ConvertBlendState(GenericBlendState &blendState, bool forceReplaceBl glBlendFuncB = BlendFactor::CONSTANT_COLOR; blendState.setBlendColor(fixA, constantAlpha); } else { - DEBUG_LOG(G3D, "ERROR INVALID blendcolorstate: FixA=%06x FixB=%06x FuncA=%i FuncB=%i", fixA, fixB, blendFuncA, blendFuncB); + DEBUG_LOG(Log::G3D, "ERROR INVALID blendcolorstate: FixA=%06x FixB=%06x FuncA=%i FuncB=%i", fixA, fixB, blendFuncA, blendFuncB); // Let's approximate, at least. Close is better than totally off. const bool nearZeroA = blendColorSimilar(fixA, 0, 64); const bool nearZeroB = blendColorSimilar(fixB, 0, 64); @@ -1642,11 +1642,11 @@ void ConvertStencilFuncState(GenericStencilFuncState &state) { } void GenericMaskState::Log() { - WARN_LOG(G3D, "Mask: %08x %01X readfb=%d", uniformMask, channelMask, applyFramebufferRead); + WARN_LOG(Log::G3D, "Mask: %08x %01X readfb=%d", uniformMask, channelMask, applyFramebufferRead); } void GenericBlendState::Log() { - WARN_LOG(G3D, "Blend: hwenable=%d readfb=%d replblend=%d replalpha=%d", + WARN_LOG(Log::G3D, "Blend: hwenable=%d readfb=%d replblend=%d replalpha=%d", blendEnabled, applyFramebufferRead, replaceBlend, (int)replaceAlphaWithStencil); } diff --git a/GPU/Common/PostShader.cpp b/GPU/Common/PostShader.cpp index 6ffd58f5b0..97afc59bc9 100644 --- a/GPU/Common/PostShader.cpp +++ b/GPU/Common/PostShader.cpp @@ -204,7 +204,7 @@ void LoadPostShaderInfo(Draw::DrawContext *draw, const std::vector &direct appendTextureShader(info); } } else if (!section.name().empty()) { - WARN_LOG(G3D, "Unrecognized shader type '%s' or invalid shader in section '%s'", shaderType.c_str(), section.name().c_str()); + WARN_LOG(Log::G3D, "Unrecognized shader type '%s' or invalid shader in section '%s'", shaderType.c_str(), section.name().c_str()); } } } diff --git a/GPU/Common/PresentationCommon.cpp b/GPU/Common/PresentationCommon.cpp index 69e440a64c..178b2b10ea 100644 --- a/GPU/Common/PresentationCommon.cpp +++ b/GPU/Common/PresentationCommon.cpp @@ -257,7 +257,7 @@ bool PresentationCommon::UpdatePostShader() { stereoShaderInfo_ = new ShaderInfo(*stereoShaderInfo); } } else { - WARN_LOG(G3D, "Failed to get info about stereo shader '%s'", g_Config.sStereoToMonoShader.c_str()); + WARN_LOG(Log::G3D, "Failed to get info about stereo shader '%s'", g_Config.sStereoToMonoShader.c_str()); } } @@ -335,7 +335,7 @@ bool PresentationCommon::CompilePostShader(const ShaderInfo *shaderInfo, Draw::P std::string errorString = vsError + "\n" + fsError; // DO NOT turn this into an ERROR_LOG_REPORT, as it will pollute our logs with all kinds of // user shader experiments. - ERROR_LOG(FRAMEBUF, "Failed to build post-processing program from %s and %s!\n%s", shaderInfo->vertexShaderFile.c_str(), shaderInfo->fragmentShaderFile.c_str(), errorString.c_str()); + ERROR_LOG(Log::FrameBuf, "Failed to build post-processing program from %s and %s!\n%s", shaderInfo->vertexShaderFile.c_str(), shaderInfo->fragmentShaderFile.c_str(), errorString.c_str()); ShowPostShaderError(errorString); return false; } @@ -572,7 +572,7 @@ Draw::ShaderModule *PresentationCommon::CompileShaderModule(ShaderStage stage, S if (lang != lang_) { // Gonna have to upconvert the shader. if (!TranslateShader(&translated, lang_, draw_->GetShaderLanguageDesc(), nullptr, src, lang, stage, errorString)) { - ERROR_LOG(FRAMEBUF, "Failed to translate post-shader. Error string: '%s'\nSource code:\n%s\n", errorString->c_str(), src.c_str()); + ERROR_LOG(Log::FrameBuf, "Failed to translate post-shader. Error string: '%s'\nSource code:\n%s\n", errorString->c_str(), src.c_str()); return nullptr; } } diff --git a/GPU/Common/ReplacedTexture.cpp b/GPU/Common/ReplacedTexture.cpp index fd24a3e1af..fb01001474 100644 --- a/GPU/Common/ReplacedTexture.cpp +++ b/GPU/Common/ReplacedTexture.cpp @@ -223,7 +223,7 @@ void ReplacedTexture::Prepare(VFSBackend *vfs) { VFSFileReference *fileRef = vfs_->GetFile(desc_.filenames[i].c_str()); if (!fileRef) { if (i == 0) { - INFO_LOG(G3D, "Texture replacement file '%s' not found", desc_.filenames[i].c_str()); + INFO_LOG(Log::G3D, "Texture replacement file '%s' not found", desc_.filenames[i].c_str()); // No file at all. Mark as NOT_FOUND. SetState(ReplacementState::NOT_FOUND); return; @@ -248,7 +248,7 @@ void ReplacedTexture::Prepare(VFSBackend *vfs) { fmt = pixelFormat; } else { if (fmt != pixelFormat) { - ERROR_LOG(G3D, "Replacement mipmap %d doesn't have the same pixel format as mipmap 0. Stopping.", i); + ERROR_LOG(Log::G3D, "Replacement mipmap %d doesn't have the same pixel format as mipmap 0. Stopping.", i); break; } } @@ -262,7 +262,7 @@ void ReplacedTexture::Prepare(VFSBackend *vfs) { // No replacement found. std::string name = TextureReplacer::HashName(desc_.cachekey, desc_.hash, 0); if (result == LoadLevelResult::LOAD_ERROR) { - WARN_LOG(G3D, "Failed to load replacement texture '%s'", name.c_str()); + WARN_LOG(Log::G3D, "Failed to load replacement texture '%s'", name.c_str()); } SetState(ReplacementState::NOT_FOUND); return; @@ -320,7 +320,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference // Additional quick checks good = good && header.layerCount <= 1; } else if (imageType == ReplacedImageType::BASIS) { - WARN_LOG(G3D, "The basis texture format is not supported. Use KTX2 (basisu texture.png -uastc -ktx2 -mipmap)"); + WARN_LOG(Log::G3D, "The basis texture format is not supported. Use KTX2 (basisu texture.png -uastc -ktx2 -mipmap)"); // We simply don't support basis files currently. good = false; @@ -333,7 +333,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference u32 format; if (good && (header.ddspf.dwFlags & DDPF_FOURCC)) { char *fcc = (char *)&header.ddspf.dwFourCC; - // INFO_LOG(G3D, "DDS fourcc: %c%c%c%c", fcc[0], fcc[1], fcc[2], fcc[3]); + // INFO_LOG(Log::G3D, "DDS fourcc: %c%c%c%c", fcc[0], fcc[1], fcc[2], fcc[3]); if (header.ddspf.dwFourCC == MK_FOURCC("DX10")) { ddsDX10 = true; good = good && vfs_->Read(openFile, &header10, sizeof(header10)) == sizeof(header10); @@ -342,7 +342,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference case 71: // DXGI_FORMAT_BC1_UNORM case 72: // DXGI_FORMAT_BC1_UNORM_SRGB if (!desc_.formatSupport.bc123) { - WARN_LOG(G3D, "BC1 format not supported, skipping texture"); + WARN_LOG(Log::G3D, "BC1 format not supported, skipping texture"); good = false; } *pixelFormat = Draw::DataFormat::BC1_RGBA_UNORM_BLOCK; @@ -350,7 +350,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference case 74: // DXGI_FORMAT_BC2_UNORM case 75: // DXGI_FORMAT_BC2_UNORM_SRGB if (!desc_.formatSupport.bc123) { - WARN_LOG(G3D, "BC2 format not supported, skipping texture"); + WARN_LOG(Log::G3D, "BC2 format not supported, skipping texture"); good = false; } *pixelFormat = Draw::DataFormat::BC2_UNORM_BLOCK; @@ -358,7 +358,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference case 77: // DXGI_FORMAT_BC3_UNORM case 78: // DXGI_FORMAT_BC3_UNORM_SRGB if (!desc_.formatSupport.bc123) { - WARN_LOG(G3D, "BC3 format not supported, skipping texture"); + WARN_LOG(Log::G3D, "BC3 format not supported, skipping texture"); good = false; } *pixelFormat = Draw::DataFormat::BC3_UNORM_BLOCK; @@ -366,18 +366,18 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference case 98: // DXGI_FORMAT_BC7_UNORM: case 99: // DXGI_FORMAT_BC7_UNORM_SRGB: if (!desc_.formatSupport.bc7) { - WARN_LOG(G3D, "BC7 format not supported, skipping texture"); + WARN_LOG(Log::G3D, "BC7 format not supported, skipping texture"); good = false; } *pixelFormat = Draw::DataFormat::BC7_UNORM_BLOCK; break; default: - WARN_LOG(G3D, "DXGI pixel format %d not supported.", header10.dxgiFormat); + WARN_LOG(Log::G3D, "DXGI pixel format %d not supported.", header10.dxgiFormat); good = false; } } else { if (!desc_.formatSupport.bc123) { - WARN_LOG(G3D, "BC1-3 formats not supported"); + WARN_LOG(Log::G3D, "BC1-3 formats not supported"); good = false; } format = header.ddspf.dwFourCC; @@ -394,12 +394,12 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference *pixelFormat = Draw::DataFormat::BC3_UNORM_BLOCK; break; default: - ERROR_LOG(G3D, "DDS pixel format not supported."); + ERROR_LOG(Log::G3D, "DDS pixel format not supported."); good = false; } } } else if (good) { - ERROR_LOG(G3D, "DDS non-fourCC format not supported."); + ERROR_LOG(Log::G3D, "DDS non-fourCC format not supported."); good = false; } @@ -427,12 +427,12 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference level.h = headerPeek.Height(); good = true; } else { - ERROR_LOG(G3D, "Could not get PNG dimensions: %s (zip)", filename.c_str()); + ERROR_LOG(Log::G3D, "Could not get PNG dimensions: %s (zip)", filename.c_str()); good = false; } *pixelFormat = Draw::DataFormat::R8G8B8A8_UNORM; } else { - ERROR_LOG(G3D, "Could not load texture replacement info: %s - unsupported format %s", filename.c_str(), magic.c_str()); + ERROR_LOG(Log::G3D, "Could not load texture replacement info: %s - unsupported format %s", filename.c_str(), magic.c_str()); } // TODO: We no longer really need to have a split in this function, the upper and lower parts can be merged now. @@ -441,7 +441,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference // If loading a low mip directly (through png most likely), check that the mipmap size is correct. // Can't load mips of the wrong size. if (level.w != std::max(1, (levels_[0].w >> mipLevel)) || level.h != std::max(1, (levels_[0].h >> mipLevel))) { - WARN_LOG(G3D, "Replacement mipmap invalid: size=%dx%d, expected=%dx%d (level %d)", + WARN_LOG(Log::G3D, "Replacement mipmap invalid: size=%dx%d, expected=%dx%d (level %d)", level.w, level.h, levels_[0].w >> mipLevel, levels_[0].h >> mipLevel, mipLevel); good = false; } @@ -464,7 +464,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference basist::ktx2_transcoder transcoder; if (!transcoder.init(buffer.data(), (int)buffer.size())) { - WARN_LOG(G3D, "Error reading KTX file"); + WARN_LOG(Log::G3D, "Error reading KTX file"); vfs_->CloseFile(openFile); return LoadLevelResult::LOAD_ERROR; } @@ -483,7 +483,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference *pixelFormat = Draw::DataFormat::ETC2_R8G8B8_UNORM_BLOCK; } else { // Transcode to RGBA8 instead as a fallback. A bit slow and takes a lot of memory, but better than nothing. - WARN_LOG(G3D, "Replacement texture format not supported - transcoding to RGBA8888"); + WARN_LOG(Log::G3D, "Replacement texture format not supported - transcoding to RGBA8888"); transcoderFormat = basist::transcoder_texture_format::cTFRGBA32; *pixelFormat = Draw::DataFormat::R8G8B8A8_UNORM; } @@ -499,12 +499,12 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference *pixelFormat = Draw::DataFormat::ASTC_4x4_UNORM_BLOCK; } else { // Transcode to RGBA8 instead as a fallback. A bit slow and takes a lot of memory, but better than nothing. - WARN_LOG(G3D, "Replacement texture format not supported - transcoding to RGBA8888"); + WARN_LOG(Log::G3D, "Replacement texture format not supported - transcoding to RGBA8888"); transcoderFormat = basist::transcoder_texture_format::cTFRGBA32; *pixelFormat = Draw::DataFormat::R8G8B8A8_UNORM; } } else { - WARN_LOG(G3D, "PPSSPP currently only supports KTX for basis/UASTC textures. This may change in the future."); + WARN_LOG(Log::G3D, "PPSSPP currently only supports KTX for basis/UASTC textures. This may change in the future."); vfs_->CloseFile(openFile); return LoadLevelResult::LOAD_ERROR; } @@ -514,7 +514,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference _dbg_assert_(bc || *pixelFormat == Draw::DataFormat::R8G8B8A8_UNORM); if (bc && ((level.w & 3) != 0 || (level.h & 3) != 0)) { - WARN_LOG(G3D, "Block compressed replacement texture '%s' not divisible by 4x4 (%dx%d). In D3D11 (only!) we will have to expand (potentially causing glitches).", filename.c_str(), level.w, level.h); + WARN_LOG(Log::G3D, "Block compressed replacement texture '%s' not divisible by 4x4 (%dx%d). In D3D11 (only!) we will have to expand (potentially causing glitches).", filename.c_str(), level.w, level.h); } data_.resize(numMips); @@ -569,7 +569,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference _dbg_assert_(bc); if (bc && ((level.w & 3) != 0 || (level.h & 3) != 0)) { - WARN_LOG(G3D, "Block compressed replacement texture '%s' not divisible by 4x4 (%dx%d). In D3D11 (only!) we will have to expand (potentially causing glitches).", filename.c_str(), level.w, level.h); + WARN_LOG(Log::G3D, "Block compressed replacement texture '%s' not divisible by 4x4 (%dx%d). In D3D11 (only!) we will have to expand (potentially causing glitches).", filename.c_str(), level.w, level.h); } data_.resize(numMips); @@ -584,7 +584,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference size_t read_bytes = vfs_->Read(openFile, &out[0], bytesToRead); if (read_bytes != bytesToRead) { - WARN_LOG(G3D, "DDS: Expected %d bytes, got %d", bytesToRead, (int)read_bytes); + WARN_LOG(Log::G3D, "DDS: Expected %d bytes, got %d", bytesToRead, (int)read_bytes); } levels_.push_back(level); @@ -601,13 +601,13 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference auto zim = std::make_unique(fileSize); if (!zim) { - ERROR_LOG(G3D, "Failed to allocate memory for texture replacement"); + ERROR_LOG(Log::G3D, "Failed to allocate memory for texture replacement"); vfs_->CloseFile(openFile); return LoadLevelResult::LOAD_ERROR; } if (vfs_->Read(openFile, &zim[0], fileSize) != fileSize) { - ERROR_LOG(G3D, "Could not load texture replacement: %s - failed to read ZIM", filename.c_str()); + ERROR_LOG(Log::G3D, "Could not load texture replacement: %s - failed to read ZIM", filename.c_str()); vfs_->CloseFile(openFile); return LoadLevelResult::LOAD_ERROR; } @@ -618,7 +618,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference // TODO: Zim files can actually hold mipmaps (although no tool has ever been made to create them :P) if (LoadZIMPtr(&zim[0], fileSize, &w, &h, &f, &image)) { if (w > level.w || h > level.h) { - ERROR_LOG(G3D, "Texture replacement changed since header read: %s", filename.c_str()); + ERROR_LOG(Log::G3D, "Texture replacement changed since header read: %s", filename.c_str()); vfs_->CloseFile(openFile); return LoadLevelResult::LOAD_ERROR; } @@ -653,12 +653,12 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference pngdata.resize(fileSize); pngdata.resize(vfs_->Read(openFile, &pngdata[0], fileSize)); if (!png_image_begin_read_from_memory(&png, &pngdata[0], pngdata.size())) { - ERROR_LOG(G3D, "Could not load texture replacement info: %s - %s (zip)", filename.c_str(), png.message); + ERROR_LOG(Log::G3D, "Could not load texture replacement info: %s - %s (zip)", filename.c_str(), png.message); vfs_->CloseFile(openFile); return LoadLevelResult::LOAD_ERROR; } if (png.width > (uint32_t)level.w || png.height > (uint32_t)level.h) { - ERROR_LOG(G3D, "Texture replacement changed since header read: %s", filename.c_str()); + ERROR_LOG(Log::G3D, "Texture replacement changed since header read: %s", filename.c_str()); vfs_->CloseFile(openFile); return LoadLevelResult::LOAD_ERROR; } @@ -677,7 +677,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference // TODO: Should probably try to handle out-of-memory gracefully here. out.resize(level.w * level.h * 4); if (!png_image_finish_read(&png, nullptr, &out[0], level.w * 4, nullptr)) { - ERROR_LOG(G3D, "Could not load texture replacement: %s - %s", filename.c_str(), png.message); + ERROR_LOG(Log::G3D, "Could not load texture replacement: %s - %s", filename.c_str(), png.message); vfs_->CloseFile(openFile); out.resize(0); return LoadLevelResult::LOAD_ERROR; @@ -697,7 +697,7 @@ ReplacedTexture::LoadLevelResult ReplacedTexture::LoadLevelData(VFSFileReference vfs_->CloseFile(openFile); return LoadLevelResult::CONTINUE; } else { - WARN_LOG(G3D, "Don't know how to load this image type! %d", (int)imageType); + WARN_LOG(Log::G3D, "Don't know how to load this image type! %d", (int)imageType); vfs_->CloseFile(openFile); } return LoadLevelResult::LOAD_ERROR; @@ -708,7 +708,7 @@ bool ReplacedTexture::CopyLevelTo(int level, uint8_t *out, size_t outDataSize, i _assert_msg_(out != nullptr && rowPitch > 0, "Invalid out/pitch"); if (State() != ReplacementState::ACTIVE) { - WARN_LOG(G3D, "Init not done yet"); + WARN_LOG(Log::G3D, "Init not done yet"); return false; } @@ -726,7 +726,7 @@ bool ReplacedTexture::CopyLevelTo(int level, uint8_t *out, size_t outDataSize, i const std::vector &data = data_[level]; if (data.empty()) { - WARN_LOG(G3D, "Level %d is empty", level); + WARN_LOG(Log::G3D, "Level %d is empty", level); return false; } @@ -735,12 +735,12 @@ bool ReplacedTexture::CopyLevelTo(int level, uint8_t *out, size_t outDataSize, i int blockSize; if (!Draw::DataFormatIsBlockCompressed(fmt, &blockSize)) { if (fmt != Draw::DataFormat::R8G8B8A8_UNORM) { - ERROR_LOG(G3D, "Unexpected linear data format"); + ERROR_LOG(Log::G3D, "Unexpected linear data format"); return false; } if (rowPitch < info.w * 4) { - ERROR_LOG(G3D, "Replacement rowPitch=%d, but w=%d (level=%d) (too small)", rowPitch, info.w * 4, level); + ERROR_LOG(Log::G3D, "Replacement rowPitch=%d, but w=%d (level=%d) (too small)", rowPitch, info.w * 4, level); return false; } diff --git a/GPU/Common/ReplacedTexture.h b/GPU/Common/ReplacedTexture.h index 7474bae115..2161a01783 100644 --- a/GPU/Common/ReplacedTexture.h +++ b/GPU/Common/ReplacedTexture.h @@ -121,7 +121,7 @@ public: void SetState(ReplacementState state) { _dbg_assert_(state != state_); #ifdef _DEBUG - // WARN_LOG(G3D, "Texture %s changed state from %s to %s", logId_.c_str(), StateString(state_), StateString(state)); + // WARN_LOG(Log::G3D, "Texture %s changed state from %s to %s", logId_.c_str(), StateString(state_), StateString(state)); #endif state_ = state; } diff --git a/GPU/Common/SoftwareTransformCommon.cpp b/GPU/Common/SoftwareTransformCommon.cpp index 4e5cce6985..fd117de69a 100644 --- a/GPU/Common/SoftwareTransformCommon.cpp +++ b/GPU/Common/SoftwareTransformCommon.cpp @@ -354,7 +354,7 @@ void SoftwareTransform::Transform(int prim, u32 vertType, const DecVtxFormat &de source.Normalize(); } if (!reader.hasNormal()) { - ERROR_LOG_REPORT(G3D, "Normal projection mapping without normal?"); + ERROR_LOG_REPORT(Log::G3D, "Normal projection mapping without normal?"); } break; @@ -371,7 +371,7 @@ void SoftwareTransform::Transform(int prim, u32 vertType, const DecVtxFormat &de source = -source; } if (!reader.hasNormal()) { - ERROR_LOG_REPORT(G3D, "Normal projection mapping without normal?"); + ERROR_LOG_REPORT(Log::G3D, "Normal projection mapping without normal?"); } break; } @@ -409,7 +409,7 @@ void SoftwareTransform::Transform(int prim, u32 vertType, const DecVtxFormat &de default: // Illegal - ERROR_LOG_REPORT(G3D, "Impossible UV gen mode? %d", gstate.getUVGenMode()); + ERROR_LOG_REPORT(Log::G3D, "Impossible UV gen mode? %d", gstate.getUVGenMode()); break; } diff --git a/GPU/Common/SplineCommon.cpp b/GPU/Common/SplineCommon.cpp index bf0921c54a..de22c14fcf 100644 --- a/GPU/Common/SplineCommon.cpp +++ b/GPU/Common/SplineCommon.cpp @@ -514,13 +514,13 @@ void DrawEngineCommon::SubmitCurve(const void *control_points, const void *indic // There are normally not a lot of control points so just splitting decoded should be reasonably safe, although not great. SimpleVertex *simplified_control_points = (SimpleVertex *)managedBuf.Allocate(sizeof(SimpleVertex) * (index_upper_bound + 1)); if (!simplified_control_points) { - ERROR_LOG(G3D, "Failed to allocate space for simplified control points, skipping curve draw"); + ERROR_LOG(Log::G3D, "Failed to allocate space for simplified control points, skipping curve draw"); return; } u8 *temp_buffer = managedBuf.Allocate(sizeof(SimpleVertex) * num_points); if (!temp_buffer) { - ERROR_LOG(G3D, "Failed to allocate space for temp buffer, skipping curve draw"); + ERROR_LOG(Log::G3D, "Failed to allocate space for temp buffer, skipping curve draw"); return; } @@ -531,13 +531,13 @@ void DrawEngineCommon::SubmitCurve(const void *control_points, const void *indic int vertexSize = vdecoder->VertexSize(); if (vertexSize != sizeof(SimpleVertex)) { - ERROR_LOG(G3D, "Something went really wrong, vertex size: %d vs %d", vertexSize, (int)sizeof(SimpleVertex)); + ERROR_LOG(Log::G3D, "Something went really wrong, vertex size: %d vs %d", vertexSize, (int)sizeof(SimpleVertex)); } // Make an array of pointers to the control points, to get rid of indices. const SimpleVertex **points = (const SimpleVertex **)managedBuf.Allocate(sizeof(SimpleVertex *) * num_points); if (!points) { - ERROR_LOG(G3D, "Failed to allocate space for control point pointers, skipping curve draw"); + ERROR_LOG(Log::G3D, "Failed to allocate space for control point pointers, skipping curve draw"); return; } for (int idx = 0; idx < num_points; idx++) @@ -559,7 +559,7 @@ void DrawEngineCommon::SubmitCurve(const void *control_points, const void *indic if (cpoints.IsValid()) SoftwareTessellation(output, surface, origVertType, cpoints); else - ERROR_LOG(G3D, "Failed to allocate space for control point values, skipping curve draw"); + ERROR_LOG(Log::G3D, "Failed to allocate space for control point values, skipping curve draw"); } u32 vertTypeWithIndex16 = (vertType & ~GE_VTYPE_IDX_MASK) | GE_VTYPE_IDX_16BIT; diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index c56e11b51d..43a8b33537 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -140,7 +140,7 @@ void TextureCacheCommon::StartFrame() { } if (texelsScaledThisFrame_) { - VERBOSE_LOG(G3D, "Scaled %d texels", texelsScaledThisFrame_); + VERBOSE_LOG(Log::G3D, "Scaled %d texels", texelsScaledThisFrame_); } texelsScaledThisFrame_ = 0; @@ -528,7 +528,7 @@ TexCacheEntry *TextureCacheCommon::SetTexture() { if (match && (entry->status & TexCacheEntry::STATUS_TO_SCALE) && standardScaleFactor_ != 1 && texelsScaledThisFrame_ < TEXCACHE_MAX_TEXELS_SCALED) { if ((entry->status & TexCacheEntry::STATUS_CHANGE_FREQUENT) == 0) { - // INFO_LOG(G3D, "Reloading texture to do the scaling we skipped.."); + // INFO_LOG(Log::G3D, "Reloading texture to do the scaling we skipped.."); match = false; reason = "scaling"; } @@ -545,7 +545,7 @@ TexCacheEntry *TextureCacheCommon::SetTexture() { switch (entry->replacedTexture->State()) { case ReplacementState::NOT_FOUND: // Didn't find a replacement, so stop looking. - // DEBUG_LOG(G3D, "No replacement for texture %dx%d", w0, h0); + // DEBUG_LOG(Log::G3D, "No replacement for texture %dx%d", w0, h0); entry->status &= ~TexCacheEntry::STATUS_TO_REPLACE; if (g_Config.bSaveNewTextures) { // Load it once more to actually save it. Since we don't set STATUS_TO_REPLACE, we won't end up looping. @@ -588,7 +588,7 @@ TexCacheEntry *TextureCacheCommon::SetTexture() { // Might need a rebuild if the hash fails, but that will be set later. nextNeedsRebuild_ = false; failedTexture_ = false; - VERBOSE_LOG(G3D, "Texture at %08x found in cache, applying", texaddr); + VERBOSE_LOG(Log::G3D, "Texture at %08x found in cache, applying", texaddr); return entry; //Done! } else { // Wasn't a match, we will rebuild. @@ -624,7 +624,7 @@ TexCacheEntry *TextureCacheCommon::SetTexture() { // Didn't match a framebuffer, keep going. if (!entry) { - VERBOSE_LOG(G3D, "No texture in cache for %08x, decoding...", texaddr); + VERBOSE_LOG(Log::G3D, "No texture in cache for %08x, decoding...", texaddr); entry = new TexCacheEntry{}; cache_[cachekey].reset(entry); @@ -638,7 +638,7 @@ TexCacheEntry *TextureCacheCommon::SetTexture() { } if (hasClutGPU) { - WARN_LOG_N_TIMES(clutUseRender, 5, G3D, "Using texture with dynamic CLUT: texfmt=%d, clutfmt=%d", gstate.getTextureFormat(), gstate.getClutPaletteFormat()); + WARN_LOG_N_TIMES(clutUseRender, 5, Log::G3D, "Using texture with dynamic CLUT: texfmt=%d, clutfmt=%d", gstate.getTextureFormat(), gstate.getClutPaletteFormat()); entry->status |= TexCacheEntry::STATUS_CLUT_GPU; } @@ -767,7 +767,7 @@ bool TextureCacheCommon::GetBestFramebufferCandidate(const TextureDefinition &en } cands += "\n"; - WARN_LOG(G3D, "GetFramebufferCandidates(tex): Multiple (%d) candidate framebuffers. texaddr: %08x offset: %d (%dx%d stride %d, %s):\n%s", + WARN_LOG(Log::G3D, "GetFramebufferCandidates(tex): Multiple (%d) candidate framebuffers. texaddr: %08x offset: %d (%dx%d stride %d, %s):\n%s", (int)candidates.size(), entry.addr, texAddrOffset, dimWidth(entry.dim), dimHeight(entry.dim), entry.bufw, GeTextureFormatToString(entry.format), cands.c_str() @@ -777,7 +777,7 @@ bool TextureCacheCommon::GetBestFramebufferCandidate(const TextureDefinition &en if (bestIndex != -1) { if (logging) { - WARN_LOG(G3D, "Chose candidate %d:\n%s\n", (int)bestIndex, candidates[bestIndex].ToString().c_str()); + WARN_LOG(Log::G3D, "Chose candidate %d:\n%s\n", (int)bestIndex, candidates[bestIndex].ToString().c_str()); } *bestCandidate = candidates[bestIndex]; return true; @@ -813,7 +813,7 @@ void TextureCacheCommon::Decimate(TexCacheEntry *exceptThisOne, bool forcePressu } } - VERBOSE_LOG(G3D, "Decimated texture cache, saved %d estimated bytes - now %d bytes", had - cacheSizeEstimate_, cacheSizeEstimate_); + VERBOSE_LOG(Log::G3D, "Decimated texture cache, saved %d estimated bytes - now %d bytes", had - cacheSizeEstimate_, cacheSizeEstimate_); } // If enabled, we also need to clear the secondary cache. @@ -835,7 +835,7 @@ void TextureCacheCommon::Decimate(TexCacheEntry *exceptThisOne, bool forcePressu } } - VERBOSE_LOG(G3D, "Decimated second texture cache, saved %d estimated bytes - now %d bytes", had - secondCacheSizeEstimate_, secondCacheSizeEstimate_); + VERBOSE_LOG(Log::G3D, "Decimated second texture cache, saved %d estimated bytes - now %d bytes", had - secondCacheSizeEstimate_, secondCacheSizeEstimate_); } DecimateVideos(); @@ -869,7 +869,7 @@ void TextureCacheCommon::HandleTextureChange(TexCacheEntry *const entry, const c cacheSizeEstimate_ -= EstimateTexMemoryUsage(entry); entry->numInvalidated++; gpuStats.numTextureInvalidations++; - DEBUG_LOG(G3D, "Texture different or overwritten, reloading at %08x: %s", entry->addr, reason); + DEBUG_LOG(Log::G3D, "Texture different or overwritten, reloading at %08x: %s", entry->addr, reason); if (doDelete) { ForgetLastTexture(); ReleaseTexture(entry, true); @@ -1019,7 +1019,7 @@ bool TextureCacheCommon::MatchFramebuffer( if (TextureFormatMatchesBufferFormat(entry.format, fb_format) || (framebuffer->usageFlags & FB_USAGE_BLUE_TO_ALPHA)) { return true; } else { - WARN_LOG_ONCE(diffFormat1, G3D, "Found matching framebuffer with reinterpretable fb_format: %s != %s at %08x", GeTextureFormatToString(entry.format), GeBufferFormatToString(fb_format), fb_address); + WARN_LOG_ONCE(diffFormat1, Log::G3D, "Found matching framebuffer with reinterpretable fb_format: %s != %s at %08x", GeTextureFormatToString(entry.format), GeBufferFormatToString(fb_format), fb_address); *matchInfo = FramebufferMatchInfo{ 0, 0, true, TextureFormatToBufferFormat(entry.format) }; return true; } @@ -1082,7 +1082,7 @@ bool TextureCacheCommon::MatchFramebuffer( // Trying to play it safe. Below 0x04110000 is almost always framebuffers. // TODO: Maybe we can reduce this check and find a better way above 0x04110000? if (matchInfo->yOffset > MAX_SUBAREA_Y_OFFSET_SAFE && addr > 0x04110000 && !PSP_CoreParameter().compat.flags().AllowLargeFBTextureOffsets) { - WARN_LOG_ONCE(subareaIgnored, G3D, "Ignoring possible texturing from framebuffer at %08x +%dx%d / %dx%d", fb_address, matchInfo->xOffset, matchInfo->yOffset, framebuffer->width, framebuffer->height); + WARN_LOG_ONCE(subareaIgnored, Log::G3D, "Ignoring possible texturing from framebuffer at %08x +%dx%d / %dx%d", fb_address, matchInfo->xOffset, matchInfo->yOffset, framebuffer->width, framebuffer->height); return false; } @@ -1097,26 +1097,26 @@ bool TextureCacheCommon::MatchFramebuffer( // 3rd Birthday (and a bunch of other games) render to a 16 bit clut texture. if (matchingClutFormat) { if (!noOffset) { - WARN_LOG_ONCE(subareaClut, G3D, "Matching framebuffer (%s) using %s with offset at %08x +%dx%d", RasterChannelToString(channel), GeTextureFormatToString(entry.format), fb_address, matchInfo->xOffset, matchInfo->yOffset); + WARN_LOG_ONCE(subareaClut, Log::G3D, "Matching framebuffer (%s) using %s with offset at %08x +%dx%d", RasterChannelToString(channel), GeTextureFormatToString(entry.format), fb_address, matchInfo->xOffset, matchInfo->yOffset); } return true; } else if (IsClutFormat((GETextureFormat)(entry.format)) || IsDXTFormat((GETextureFormat)(entry.format))) { - WARN_LOG_ONCE(fourEightBit, G3D, "%s texture format not matching framebuffer of format %s at %08x/%d", GeTextureFormatToString(entry.format), GeBufferFormatToString(fb_format), fb_address, fb_stride); + WARN_LOG_ONCE(fourEightBit, Log::G3D, "%s texture format not matching framebuffer of format %s at %08x/%d", GeTextureFormatToString(entry.format), GeBufferFormatToString(fb_format), fb_address, fb_stride); return false; } // This is either normal or we failed to generate a shader to depalettize if ((int)fb_format == (int)entry.format || matchingClutFormat) { if ((int)fb_format != (int)entry.format) { - WARN_LOG_ONCE(diffFormat2, G3D, "Matching framebuffer with different formats %s != %s at %08x", + WARN_LOG_ONCE(diffFormat2, Log::G3D, "Matching framebuffer with different formats %s != %s at %08x", GeTextureFormatToString(entry.format), GeBufferFormatToString(fb_format), fb_address); return true; } else { - WARN_LOG_ONCE(subarea, G3D, "Matching from framebuffer at %08x +%dx%d", fb_address, matchInfo->xOffset, matchInfo->yOffset); + WARN_LOG_ONCE(subarea, Log::G3D, "Matching from framebuffer at %08x +%dx%d", fb_address, matchInfo->xOffset, matchInfo->yOffset); return true; } } else { - WARN_LOG_ONCE(diffFormat2, G3D, "Ignoring possible texturing from framebuffer at %08x with incompatible format %s != %s (+%dx%d)", + WARN_LOG_ONCE(diffFormat2, Log::G3D, "Ignoring possible texturing from framebuffer at %08x with incompatible format %s != %s (+%dx%d)", fb_address, GeTextureFormatToString(entry.format), GeBufferFormatToString(fb_format), matchInfo->xOffset, matchInfo->yOffset); return false; } @@ -1179,7 +1179,7 @@ void TextureCacheCommon::SetTextureFramebuffer(const AttachCandidate &candidate) } if (channel == RASTER_DEPTH && !gstate_c.Use(GPU_USE_DEPTH_TEXTURE)) { - WARN_LOG_ONCE(ndepthtex, G3D, "Depth textures not supported, not binding"); + WARN_LOG_ONCE(ndepthtex, Log::G3D, "Depth textures not supported, not binding"); // Flag to bind a null texture if we can't support depth textures. // Should only happen on old OpenGL. nextFramebufferTexture_ = nullptr; @@ -1272,7 +1272,7 @@ bool TextureCacheCommon::GetCurrentFramebufferTextureDebug(GPUDebugBuffer &buffe // We may have blitted to a temp FBO. framebufferManager_->RebindFramebuffer("RebindFramebuffer - GetCurrentTextureDebug"); if (!retval) - ERROR_LOG(G3D, "Failed to get debug texture: copy to memory failed"); + ERROR_LOG(Log::G3D, "Failed to get debug texture: copy to memory failed"); return retval; } @@ -1361,7 +1361,7 @@ void TextureCacheCommon::LoadClut(u32 clutAddr, u32 loadBytes) { bool okAge = !PSP_CoreParameter().compat.flags().LoadCLUTFromCurrentFrameOnly || framebuffer->last_frame_render == gpuStats.numFlips; // Here we can try heuristics. if (matchRange && !inMargin && offset < (int)clutRenderOffset_) { if (okAge) { - WARN_LOG_N_TIMES(clutfb, 5, G3D, "Detected LoadCLUT(%d bytes) from framebuffer %08x (%s), last render %d frames ago, byte offset %d, pixel offset %d", + WARN_LOG_N_TIMES(clutfb, 5, Log::G3D, "Detected LoadCLUT(%d bytes) from framebuffer %08x (%s), last render %d frames ago, byte offset %d, pixel offset %d", loadBytes, fb_address, GeBufferFormatToString(framebuffer->fb_format), gpuStats.numFlips - framebuffer->last_frame_render, offset, offset / fb_bpp); framebuffer->last_frame_clut = gpuStats.numFlips; // Also mark used so it's not decimated. @@ -1375,7 +1375,7 @@ void TextureCacheCommon::LoadClut(u32 clutAddr, u32 loadBytes) { break; } } else { - WARN_LOG(G3D, "Ignoring CLUT load from %d frames old buffer at %08x", gpuStats.numFlips - framebuffer->last_frame_render, fb_address); + WARN_LOG(Log::G3D, "Ignoring CLUT load from %d frames old buffer at %08x", gpuStats.numFlips - framebuffer->last_frame_render, fb_address); } } } @@ -1659,9 +1659,8 @@ static CheckAlphaResult DecodeDXTBlocks(uint8_t *out, int outPitch, uint32_t tex int outPitch32 = outPitch / sizeof(uint32_t); const DXTBlock *src = (const DXTBlock *)texptr; - if (!Memory::IsValidRange(texaddr, (h / 4) * (bufw / 4) * sizeof(DXTBlock))) { - ERROR_LOG_REPORT(G3D, "DXT%d texture extends beyond valid RAM: %08x + %d x %d", n, texaddr, bufw, h); + ERROR_LOG_REPORT(Log::G3D, "DXT%d texture extends beyond valid RAM: %08x + %d x %d", n, texaddr, bufw, h); uint32_t limited = Memory::ValidSize(texaddr, (h / 4) * (bufw / 4) * sizeof(DXTBlock)); // This might possibly be 0, but try to decode what we can (might even be how the PSP behaves.) h = (((int)limited / sizeof(DXTBlock)) / (bufw / 4)) * 4; @@ -1741,7 +1740,7 @@ CheckAlphaResult TextureCacheCommon::DecodeTextureLevel(u8 *out, int outPitch, G bool swizzled = gstate.isTextureSwizzled(); if ((texaddr & 0x00600000) != 0 && Memory::IsVRAMAddress(texaddr)) { // This means it's in a mirror, possibly a swizzled mirror. Let's report. - WARN_LOG_REPORT_ONCE(texmirror, G3D, "Decoding texture from VRAM mirror at %08x swizzle=%d", texaddr, swizzled ? 1 : 0); + WARN_LOG_REPORT_ONCE(texmirror, Log::G3D, "Decoding texture from VRAM mirror at %08x swizzle=%d", texaddr, swizzled ? 1 : 0); if ((texaddr & 0x00200000) == 0x00200000) { // Technically 2 and 6 are slightly different, but this is better than nothing probably. // We should only see this with depth textures anyway which we don't support uploading (yet). @@ -1843,7 +1842,7 @@ CheckAlphaResult TextureCacheCommon::DecodeTextureLevel(u8 *out, int outPitch, G break; default: - ERROR_LOG_REPORT(G3D, "Unknown CLUT4 texture mode %d", gstate.getClutPaletteFormat()); + ERROR_LOG_REPORT(Log::G3D, "Unknown CLUT4 texture mode %d", gstate.getClutPaletteFormat()); return CHECKALPHA_ANY; } } @@ -1980,7 +1979,7 @@ CheckAlphaResult TextureCacheCommon::DecodeTextureLevel(u8 *out, int outPitch, G return DecodeDXTBlocks(out, outPitch, texaddr, texptr, w, h, bufw, reverseColors); default: - ERROR_LOG_REPORT(G3D, "Unknown Texture Format %d!!!", format); + ERROR_LOG_REPORT(Log::G3D, "Unknown Texture Format %d!!!", format); break; } @@ -2077,7 +2076,7 @@ CheckAlphaResult TextureCacheCommon::ReadIndexedTex(u8 *out, int outPitch, int l break; default: - ERROR_LOG_REPORT(G3D, "Unhandled clut texture mode %d!!!", gstate.getClutPaletteFormat()); + ERROR_LOG_REPORT(Log::G3D, "Unhandled clut texture mode %d!!!", gstate.getClutPaletteFormat()); break; } @@ -2204,7 +2203,7 @@ static bool CanDepalettize(GETextureFormat texFormat, GEBufferFormat bufferForma // Shouldn't happen here. return false; } - WARN_LOG(G3D, "Invalid CLUT/framebuffer combination: %s vs %s", GeTextureFormatToString(texFormat), GeBufferFormatToString(bufferFormat)); + WARN_LOG(Log::G3D, "Invalid CLUT/framebuffer combination: %s vs %s", GeTextureFormatToString(texFormat), GeBufferFormatToString(bufferFormat)); return false; } else if (texFormat == GE_TFMT_5650 && bufferFormat == GE_FORMAT_DEPTH16) { // We can also "depal" 565 format, this is used to read depth buffers as 565 on occasion (#15491). @@ -2520,7 +2519,7 @@ void TextureCacheCommon::Clear(bool delete_them) { ReleaseTexture(iter->second.get(), delete_them); } if (cache_.size() + secondCache_.size()) { - INFO_LOG(G3D, "Texture cached cleared from %i textures", (int)(cache_.size() + secondCache_.size())); + INFO_LOG(Log::G3D, "Texture cached cleared from %i textures", (int)(cache_.size() + secondCache_.size())); cache_.clear(); secondCache_.clear(); cacheSizeEstimate_ = 0; @@ -2837,7 +2836,7 @@ bool TextureCacheCommon::PrepareBuildTexture(BuildTexturePlan &plan, TexCacheEnt // These will only work correctly in the top 512x512 part. So, I've increased the threshold quite a bit. // We probably should handle these differently, by clamping the texture size and texture coordinates, but meh. if (plan.w > 2048 || plan.h > 2048) { - ERROR_LOG(G3D, "Bad texture dimensions: %dx%d", plan.w, plan.h); + ERROR_LOG(Log::G3D, "Bad texture dimensions: %dx%d", plan.w, plan.h); return false; } } diff --git a/GPU/Common/TextureReplacer.cpp b/GPU/Common/TextureReplacer.cpp index 5d03565f94..b456d05875 100644 --- a/GPU/Common/TextureReplacer.cpp +++ b/GPU/Common/TextureReplacer.cpp @@ -88,7 +88,7 @@ void TextureReplacer::NotifyConfigChanged() { // If we're saving, auto-create the directory. if (saveEnabled_ && !File::Exists(newTextureDir_)) { - INFO_LOG(G3D, "Creating new texture directory: '%s'", newTextureDir_.ToVisualString().c_str()); + INFO_LOG(Log::G3D, "Creating new texture directory: '%s'", newTextureDir_.ToVisualString().c_str()); File::CreateFullPath(newTextureDir_); // We no longer create a nomedia file here, since we put one // in the TEXTURES root. @@ -135,7 +135,7 @@ bool TextureReplacer::LoadIni() { // First, check for textures.zip, which is used to reduce IO. VFSBackend *dir = ZipFileReader::Create(zipPath, "", false); if (!dir) { - INFO_LOG(G3D, "%s wasn't a zip file - opening the directory %s instead.", zipPath.c_str(), basePath_.c_str()); + INFO_LOG(Log::G3D, "%s wasn't a zip file - opening the directory %s instead.", zipPath.c_str(), basePath_.c_str()); vfsIsZip_ = false; dir = new DirectoryReader(basePath_); } else { @@ -158,14 +158,14 @@ bool TextureReplacer::LoadIni() { IniFile overrideIni; iniLoaded = overrideIni.LoadFromVFS(*dir, overrideFilename); if (!iniLoaded) { - ERROR_LOG(G3D, "Failed to load extra texture ini: %s", overrideFilename.c_str()); + ERROR_LOG(Log::G3D, "Failed to load extra texture ini: %s", overrideFilename.c_str()); // Since this error is most likely to occure for texture pack creators, let's just bail here // so that the creator is more likely to look in the logs for what happened. delete dir; return false; } - INFO_LOG(G3D, "Loading extra texture ini: %s", overrideFilename.c_str()); + INFO_LOG(Log::G3D, "Loading extra texture ini: %s", overrideFilename.c_str()); if (!LoadIniValues(overrideIni, nullptr, true)) { delete dir; return false; @@ -175,17 +175,17 @@ bool TextureReplacer::LoadIni() { } else { if (vfsIsZip_) { // We don't accept zip files without inis. - ERROR_LOG(G3D, "Texture pack lacking ini file: %s", basePath_.c_str()); + ERROR_LOG(Log::G3D, "Texture pack lacking ini file: %s", basePath_.c_str()); delete dir; return false; } else { - WARN_LOG(G3D, "Texture pack lacking ini file: %s", basePath_.c_str()); + WARN_LOG(Log::G3D, "Texture pack lacking ini file: %s", basePath_.c_str()); // Do what we can do anyway: Scan for textures and build the map. std::map> filenameMap; ScanForHashNamedFiles(dir, filenameMap); if (filenameMap.empty()) { - WARN_LOG(G3D, "No replacement textures found."); + WARN_LOG(Log::G3D, "No replacement textures found."); return false; } @@ -205,9 +205,9 @@ bool TextureReplacer::LoadIni() { } if (vfsIsZip_) { - INFO_LOG(G3D, "Texture pack activated from '%s'", (basePath_ / ZIP_FILENAME).c_str()); + INFO_LOG(Log::G3D, "Texture pack activated from '%s'", (basePath_ / ZIP_FILENAME).c_str()); } else { - INFO_LOG(G3D, "Texture pack activated from '%s'", basePath_.c_str()); + INFO_LOG(Log::G3D, "Texture pack activated from '%s'", basePath_.c_str()); } // The ini doesn't have to exist for the texture directory or zip to be valid. @@ -235,7 +235,7 @@ void TextureReplacer::ScanForHashNamedFiles(VFSBackend *dir, std::map= 1) { - // INFO_LOG(G3D, "hash-like file in root, adding: %s", file.name.c_str()); + // INFO_LOG(Log::G3D, "hash-like file in root, adding: %s", file.name.c_str()); filenameMap[key][level] = file.name; } } @@ -251,7 +251,7 @@ void TextureReplacer::ComputeAliasMap(const std::mapGet("ignoreMipmap", &ignoreMipmap_, ignoreMipmap_); if (reduceHash_ && hash_ == ReplacedTextureHash::QUICK) { reduceHash_ = false; - ERROR_LOG(G3D, "Texture Replacement: reduceHash option requires safer hash, use xxh32 or xxh64 instead."); + ERROR_LOG(Log::G3D, "Texture Replacement: reduceHash option requires safer hash, use xxh32 or xxh64 instead."); } if (ignoreAddress_ && hash_ == ReplacedTextureHash::QUICK) { ignoreAddress_ = false; - ERROR_LOG(G3D, "Texture Replacement: ignoreAddress option requires safer hash, use xxh32 or xxh64 instead."); + ERROR_LOG(Log::G3D, "Texture Replacement: ignoreAddress option requires safer hash, use xxh32 or xxh64 instead."); } int version = 0; if (options->Get("version", &version, 0) && version > VERSION) { - ERROR_LOG(G3D, "Unsupported texture replacement version %d, trying anyway", version); + ERROR_LOG(Log::G3D, "Unsupported texture replacement version %d, trying anyway", version); } int badFileNameCount = 0; @@ -346,9 +346,9 @@ bool TextureReplacer::LoadIniValues(IniFile &ini, VFSBackend *dir, bool isOverri } } } else if (item.first.empty()) { - INFO_LOG(G3D, "Ignoring [hashes] line with empty key: '= %s'", item.second.c_str()); + INFO_LOG(Log::G3D, "Ignoring [hashes] line with empty key: '= %s'", item.second.c_str()); } else { - ERROR_LOG(G3D, "Unsupported syntax under [hashes], ignoring: %s = ", item.first.c_str()); + ERROR_LOG(Log::G3D, "Unsupported syntax under [hashes], ignoring: %s = ", item.first.c_str()); } } } @@ -359,7 +359,7 @@ bool TextureReplacer::LoadIniValues(IniFile &ini, VFSBackend *dir, bool isOverri if (badFileNameCount > 0) { auto err = GetI18NCategory(I18NCat::ERRORS); g_OSD.Show(OSDType::MESSAGE_WARNING, err->T("textures.ini filenames may not be cross - platform(banned characters)"), badFilenames, 6.0f); - WARN_LOG(G3D, "Potentially bad filenames: %s", badFilenames.c_str()); + WARN_LOG(Log::G3D, "Potentially bad filenames: %s", badFilenames.c_str()); } if (ini.HasSection("hashranges")) { @@ -396,7 +396,7 @@ void TextureReplacer::ParseHashRange(const std::string &key, const std::string & SplitString(value, ',', valueParts); if (keyParts.size() != 3 || valueParts.size() != 2) { - ERROR_LOG(G3D, "Ignoring invalid hashrange %s = %s, expecting addr,w,h = w,h", key.c_str(), value.c_str()); + ERROR_LOG(Log::G3D, "Ignoring invalid hashrange %s = %s, expecting addr,w,h = w,h", key.c_str(), value.c_str()); return; } @@ -409,19 +409,19 @@ void TextureReplacer::ParseHashRange(const std::string &key, const std::string & u32 fromW; u32 fromH; if (!TryParse(keyParts[0], &addr) || !TryParse(keyParts[1], &fromW) || !TryParse(keyParts[2], &fromH)) { - ERROR_LOG(G3D, "Ignoring invalid hashrange %s = %s, key format is 0x12345678,512,512", key.c_str(), value.c_str()); + ERROR_LOG(Log::G3D, "Ignoring invalid hashrange %s = %s, key format is 0x12345678,512,512", key.c_str(), value.c_str()); return; } u32 toW; u32 toH; if (!TryParse(valueParts[0], &toW) || !TryParse(valueParts[1], &toH)) { - ERROR_LOG(G3D, "Ignoring invalid hashrange %s = %s, value format is 512,512", key.c_str(), value.c_str()); + ERROR_LOG(Log::G3D, "Ignoring invalid hashrange %s = %s, value format is 512,512", key.c_str(), value.c_str()); return; } if (toW > fromW || toH > fromH) { - ERROR_LOG(G3D, "Ignoring invalid hashrange %s = %s, range bigger than source", key.c_str(), value.c_str()); + ERROR_LOG(Log::G3D, "Ignoring invalid hashrange %s = %s, range bigger than source", key.c_str(), value.c_str()); return; } @@ -439,10 +439,10 @@ void TextureReplacer::ParseFiltering(const std::string &key, const std::string & } else if (!strcasecmp(value.c_str(), "auto")) { filtering_[itemKey] = TEX_FILTER_AUTO; } else { - ERROR_LOG(G3D, "Unsupported syntax under [filtering]: %s", value.c_str()); + ERROR_LOG(Log::G3D, "Unsupported syntax under [filtering]: %s", value.c_str()); } } else { - ERROR_LOG(G3D, "Unsupported syntax under [filtering]: %s", key.c_str()); + ERROR_LOG(Log::G3D, "Unsupported syntax under [filtering]: %s", key.c_str()); } } @@ -453,25 +453,25 @@ void TextureReplacer::ParseReduceHashRange(const std::string& key, const std::st SplitString(value, ',', valueParts); if (keyParts.size() != 2 || valueParts.size() != 1) { - ERROR_LOG(G3D, "Ignoring invalid reducehashrange %s = %s, expecting w,h = reducehashvalue", key.c_str(), value.c_str()); + ERROR_LOG(Log::G3D, "Ignoring invalid reducehashrange %s = %s, expecting w,h = reducehashvalue", key.c_str(), value.c_str()); return; } u32 forW; u32 forH; if (!TryParse(keyParts[0], &forW) || !TryParse(keyParts[1], &forH)) { - ERROR_LOG(G3D, "Ignoring invalid reducehashrange %s = %s, key format is 512,512", key.c_str(), value.c_str()); + ERROR_LOG(Log::G3D, "Ignoring invalid reducehashrange %s = %s, key format is 512,512", key.c_str(), value.c_str()); return; } float rhashvalue; if (!TryParse(valueParts[0], &rhashvalue)) { - ERROR_LOG(G3D, "Ignoring invalid reducehashrange %s = %s, value format is 0.5", key.c_str(), value.c_str()); + ERROR_LOG(Log::G3D, "Ignoring invalid reducehashrange %s = %s, value format is 0.5", key.c_str(), value.c_str()); return; } if (rhashvalue == 0) { - ERROR_LOG(G3D, "Ignoring invalid hashrange %s = %s, reducehashvalue can't be 0", key.c_str(), value.c_str()); + ERROR_LOG(Log::G3D, "Ignoring invalid hashrange %s = %s, reducehashvalue can't be 0", key.c_str(), value.c_str()); return; } @@ -582,7 +582,7 @@ ReplacedTexture *TextureReplacer::FindReplacement(u64 cachekey, u32 hash, int w, // Early-out for ignored textures, let's not bother even starting a thread task. if (ignored) { - // WARN_LOG(G3D, "Not found/ignored: %s (%d, %d)", hashfiles.c_str(), (int)foundReplacement, (int)ignored); + // WARN_LOG(Log::G3D, "Not found/ignored: %s (%d, %d)", hashfiles.c_str(), (int)foundReplacement, (int)ignored); // Insert an entry into the cache for faster lookup next time. ReplacedTextureRef ref{}; cache_.emplace(std::make_pair(replacementKey, ref)); @@ -645,7 +645,7 @@ ReplacedTexture *TextureReplacer::FindReplacement(u64 cachekey, u32 hash, int w, static bool WriteTextureToPNG(png_imagep image, const Path &filename, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) { FILE *fp = File::OpenCFile(filename, "wb"); if (!fp) { - ERROR_LOG(IO, "Unable to open texture file '%s' for writing.", filename.c_str()); + ERROR_LOG(Log::IO, "Unable to open texture file '%s' for writing.", filename.c_str()); return false; } @@ -653,7 +653,7 @@ static bool WriteTextureToPNG(png_imagep image, const Path &filename, int conver fclose(fp); return true; } else { - ERROR_LOG(SYSTEM, "Texture PNG encode failed."); + ERROR_LOG(Log::System, "Texture PNG encode failed."); fclose(fp); remove(filename.c_str()); return false; @@ -714,11 +714,11 @@ public: bool success = WriteTextureToPNG(&png, saveFilename, 0, rgbaData.data(), pitch, nullptr); png_image_free(&png); if (png.warning_or_error >= 2) { - ERROR_LOG(G3D, "Saving texture to PNG produced errors."); + ERROR_LOG(Log::G3D, "Saving texture to PNG produced errors."); } else if (success) { - NOTICE_LOG(G3D, "Saving texture for replacement: %08x / %dx%d in '%s'", replacedInfoHash, w, h, saveFilename.ToVisualString().c_str()); + NOTICE_LOG(Log::G3D, "Saving texture for replacement: %08x / %dx%d in '%s'", replacedInfoHash, w, h, saveFilename.ToVisualString().c_str()); } else { - ERROR_LOG(G3D, "Failed to write '%s'", saveFilename.c_str()); + ERROR_LOG(Log::G3D, "Failed to write '%s'", saveFilename.c_str()); } } }; @@ -853,7 +853,7 @@ void TextureReplacer::Decimate(ReplacerDecimateMode mode) { double totalSizeGB = totalSize / (1024.0 * 1024.0 * 1024.0); if (totalSizeGB >= 1.0) { - WARN_LOG(G3D, "Decimated replacements older than %fs, currently using %f GB of RAM", age, totalSizeGB); + WARN_LOG(Log::G3D, "Decimated replacements older than %fs, currently using %f GB of RAM", age, totalSizeGB); } lastTextureCacheSizeGB_ = totalSizeGB; } diff --git a/GPU/Common/TextureScalerCommon.cpp b/GPU/Common/TextureScalerCommon.cpp index a27e109c5c..bbcb497b8f 100644 --- a/GPU/Common/TextureScalerCommon.cpp +++ b/GPU/Common/TextureScalerCommon.cpp @@ -503,7 +503,7 @@ void bilinearH(int factor, const u32 *data, u32 *out, int w, int l, int u) { case 3: bilinearHt<3>(data, out, w, l, u); break; case 4: bilinearHt<4>(data, out, w, l, u); break; case 5: bilinearHt<5>(data, out, w, l, u); break; - default: ERROR_LOG(G3D, "Bilinear upsampling only implemented for factors 2 to 5"); + default: ERROR_LOG(Log::G3D, "Bilinear upsampling only implemented for factors 2 to 5"); } } // integral bilinear upscaling by factor f, vertical part @@ -537,7 +537,7 @@ void bilinearV(int factor, const u32 *data, u32 *out, int w, int gl, int gu, int case 3: bilinearVt<3>(data, out, w, gl, gu, l, u); break; case 4: bilinearVt<4>(data, out, w, gl, gu, l, u); break; case 5: bilinearVt<5>(data, out, w, gl, gu, l, u); break; - default: ERROR_LOG(G3D, "Bilinear upsampling only implemented for factors 2 to 5"); + default: ERROR_LOG(Log::G3D, "Bilinear upsampling only implemented for factors 2 to 5"); } } @@ -658,7 +658,7 @@ bool TextureScalerCommon::ScaleInto(u32 *outputBuf, u32 *src, int width, int hei ScaleHybrid(factor, inputBuf, outputBuf, width, height, true); break; default: - ERROR_LOG(G3D, "Unknown scaling type: %d", g_Config.iTexScalingType); + ERROR_LOG(Log::G3D, "Unknown scaling type: %d", g_Config.iTexScalingType); } // update values accordingly @@ -668,7 +668,7 @@ bool TextureScalerCommon::ScaleInto(u32 *outputBuf, u32 *src, int width, int hei #ifdef SCALING_MEASURE_TIME if (*scaledWidth* *scaledHeight > 64 * 64 * factor*factor) { double t = time_now_d() - t_start; - NOTICE_LOG(G3D, "TextureScaler: processed %9d pixels in %6.5lf seconds. (%9.2lf Mpixels/second)", + NOTICE_LOG(Log::G3D, "TextureScaler: processed %9d pixels in %6.5lf seconds. (%9.2lf Mpixels/second)", *scaledWidth * *scaledHeight, t, (*scaledWidth * *scaledHeight) / (t * 1000 * 1000)); } #endif @@ -680,7 +680,7 @@ bool TextureScalerCommon::Scale(u32* &data, int width, int height, int *scaledWi // prevent processing empty or flat textures (this happens a lot in some games) // doesn't hurt the standard case, will be very quick for textures with actual texture if (IsEmptyOrFlat(data, width*height)) { - DEBUG_LOG(G3D, "TextureScaler: early exit -- empty/flat texture"); + DEBUG_LOG(Log::G3D, "TextureScaler: early exit -- empty/flat texture"); return false; } diff --git a/GPU/Common/VertexDecoderArm.cpp b/GPU/Common/VertexDecoderArm.cpp index 257a0aa96c..6dc39e2ed3 100644 --- a/GPU/Common/VertexDecoderArm.cpp +++ b/GPU/Common/VertexDecoderArm.cpp @@ -258,7 +258,7 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int ResetCodePtr(GetOffset(start)); char temp[1024] = {0}; dec.ToString(temp, true); - INFO_LOG(G3D, "Could not compile vertex decoder: %s", temp); + INFO_LOG(Log::G3D, "Could not compile vertex decoder: %s", temp); return 0; } } @@ -286,7 +286,7 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int DisassembleArm(start, GetCodePtr() - start); char temp[1024] = {0}; dec.ToString(temp, true); - INFO_LOG(G3D, "%s", temp); + INFO_LOG(Log::G3D, "%s", temp); */ *jittedSize = GetCodePtr() - start; diff --git a/GPU/Common/VertexDecoderArm64.cpp b/GPU/Common/VertexDecoderArm64.cpp index e3675ee553..c79fb5bfcc 100644 --- a/GPU/Common/VertexDecoderArm64.cpp +++ b/GPU/Common/VertexDecoderArm64.cpp @@ -254,7 +254,7 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int ResetCodePtr(GetOffset(start)); char temp[1024] = {0}; dec.ToString(temp, true); - ERROR_LOG(G3D, "Could not compile vertex decoder, failed at step %d: %s", i, temp); + ERROR_LOG(Log::G3D, "Could not compile vertex decoder, failed at step %d: %s", i, temp); return nullptr; } } @@ -289,12 +289,12 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int if (log) { char temp[1024] = { 0 }; dec.ToString(temp, true); - INFO_LOG(JIT, "=== %s (%d bytes) ===", temp, (int)(GetCodePtr() - start)); + INFO_LOG(Log::JIT, "=== %s (%d bytes) ===", temp, (int)(GetCodePtr() - start)); std::vector lines = DisassembleArm64(start, (int)(GetCodePtr() - start)); for (auto line : lines) { - INFO_LOG(JIT, "%s", line.c_str()); + INFO_LOG(Log::JIT, "%s", line.c_str()); } - INFO_LOG(JIT, "=========="); + INFO_LOG(Log::JIT, "=========="); } *jittedSize = (int)(GetCodePtr() - start); diff --git a/GPU/Common/VertexDecoderCommon.cpp b/GPU/Common/VertexDecoderCommon.cpp index 4c7d322780..c3807e41bb 100644 --- a/GPU/Common/VertexDecoderCommon.cpp +++ b/GPU/Common/VertexDecoderCommon.cpp @@ -138,13 +138,13 @@ void GetIndexBounds(const void *inds, int count, u32 vertType, u16 *indexLowerBo } else if (idx == GE_VTYPE_IDX_32BIT) { int lowerBound = 0x7FFFFFFF; int upperBound = 0; - WARN_LOG_REPORT_ONCE(indexBounds32, G3D, "GetIndexBounds: Decoding 32-bit indexes"); + WARN_LOG_REPORT_ONCE(indexBounds32, Log::G3D, "GetIndexBounds: Decoding 32-bit indexes"); const u32_le *ind32 = (const u32_le *)inds; for (int i = 0; i < count; i++) { u16 value = (u16)ind32[i]; // These aren't documented and should be rare. Let's bounds check each one. if (ind32[i] != value) { - ERROR_LOG_REPORT_ONCE(indexBounds32Bounds, G3D, "GetIndexBounds: Index outside 16-bit range"); + ERROR_LOG_REPORT_ONCE(indexBounds32Bounds, Log::G3D, "GetIndexBounds: Index outside 16-bit range"); } if (value > upperBound) upperBound = value; @@ -1132,9 +1132,9 @@ void VertexDecoder::SetVertexType(u32 fmt, const VertexDecoderOptions &options, memset(&decFmt, 0, sizeof(decFmt)); if (morphcount > 1) { - DEBUG_LOG_REPORT_ONCE(vtypeM, G3D, "VTYPE with morph used: THRU=%i TC=%i COL=%i POS=%i NRM=%i WT=%i NW=%i IDX=%i MC=%i", (int)throughmode, tc, col, pos, nrm, weighttype, nweights, idx, morphcount); + DEBUG_LOG_REPORT_ONCE(vtypeM, Log::G3D, "VTYPE with morph used: THRU=%i TC=%i COL=%i POS=%i NRM=%i WT=%i NW=%i IDX=%i MC=%i", (int)throughmode, tc, col, pos, nrm, weighttype, nweights, idx, morphcount); } else { - DEBUG_LOG(G3D, "VTYPE: THRU=%i TC=%i COL=%i POS=%i NRM=%i WT=%i NW=%i IDX=%i MC=%i", (int)throughmode, tc, col, pos, nrm, weighttype, nweights, idx, morphcount); + DEBUG_LOG(Log::G3D, "VTYPE: THRU=%i TC=%i COL=%i POS=%i NRM=%i WT=%i NW=%i IDX=%i MC=%i", (int)throughmode, tc, col, pos, nrm, weighttype, nweights, idx, morphcount); } skinInDecode = weighttype != 0 && options.applySkinInDecode; @@ -1307,12 +1307,12 @@ void VertexDecoder::SetVertexType(u32 fmt, const VertexDecoderOptions &options, size = align(size, biggest); onesize_ = size; size *= morphcount; - DEBUG_LOG(G3D, "SVT : size = %i, aligned to biggest %i", size, biggest); + DEBUG_LOG(Log::G3D, "SVT : size = %i, aligned to biggest %i", size, biggest); if (reportNoPos) { char temp[256]{}; ToString(temp, true); - ERROR_LOG_REPORT(G3D, "Vertices without position found: (%08x) %s", fmt_, temp); + ERROR_LOG_REPORT(Log::G3D, "Vertices without position found: (%08x) %s", fmt_, temp); } _assert_msg_(decFmt.uvfmt == DEC_FLOAT_2 || decFmt.uvfmt == DEC_NONE, "Reader only supports float UV"); @@ -1338,7 +1338,7 @@ void VertexDecoder::SetVertexType(u32 fmt, const VertexDecoderOptions &options, if (jitCache) { jitted_ = jitCache->Compile(*this, &jittedSize_); if (!jitted_) { - WARN_LOG(G3D, "Vertex decoder JIT failed! fmt = %08x (%s)", fmt_, GetString(SHADER_STRING_SHORT_DESC).c_str()); + WARN_LOG(Log::G3D, "Vertex decoder JIT failed! fmt = %08x (%s)", fmt_, GetString(SHADER_STRING_SHORT_DESC).c_str()); } } } @@ -1403,7 +1403,7 @@ static bool DecodedVertsAreSimilar(const VertexReader &vtx1, const VertexReader vtx2.ReadNrm(vec2.AsArray()); float diff = LargestAbsDiff(vec1, vec2, 3); if (diff >= 1.0 / 512.0f) { - WARN_LOG(G3D, "Normal diff %f", diff); + WARN_LOG(Log::G3D, "Normal diff %f", diff); return false; } } @@ -1412,7 +1412,7 @@ static bool DecodedVertsAreSimilar(const VertexReader &vtx1, const VertexReader vtx2.ReadUV(vec2.AsArray()); float diff = LargestAbsDiff(vec1, vec2, 2); if (diff >= 1.0 / 512.0f) { - WARN_LOG(G3D, "UV diff %f", diff); + WARN_LOG(Log::G3D, "UV diff %f", diff); return false; } } @@ -1421,7 +1421,7 @@ static bool DecodedVertsAreSimilar(const VertexReader &vtx1, const VertexReader vtx2.ReadColor0(vec2.AsArray()); float diff = LargestAbsDiff(vec1, vec2, 4); if (diff >= 1.0 / 255.0f) { - WARN_LOG(G3D, "Color0 diff %f", diff); + WARN_LOG(Log::G3D, "Color0 diff %f", diff); return false; } } @@ -1430,7 +1430,7 @@ static bool DecodedVertsAreSimilar(const VertexReader &vtx1, const VertexReader vtx2.ReadColor1(vec2.AsArray()); float diff = LargestAbsDiff(vec1, vec2, 4); if (diff >= 1.0 / 255.0f) { - WARN_LOG(G3D, "Color1 diff %f", diff); + WARN_LOG(Log::G3D, "Color1 diff %f", diff); return false; } } @@ -1438,7 +1438,7 @@ static bool DecodedVertsAreSimilar(const VertexReader &vtx1, const VertexReader vtx2.ReadPos(vec2.AsArray()); float diff = LargestAbsDiff(vec1, vec2, 3); if (diff >= 1.0 / 512.0f) { - WARN_LOG(G3D, "Pos diff %f", diff); + WARN_LOG(Log::G3D, "Pos diff %f", diff); return false; } @@ -1458,7 +1458,7 @@ void VertexDecoder::CompareToJit(const u8 *startPtr, u8 *decodedptr, int count, if (!DecodedVertsAreSimilar(controlReader, jittedReader)) { char name[512]{}; ToString(name, true); - ERROR_LOG(G3D, "Encountered vertexjit mismatch at %d/%d for %s", i, count, name); + ERROR_LOG(Log::G3D, "Encountered vertexjit mismatch at %d/%d for %s", i, count, name); if (morphcount > 1) { printf("Morph:\n"); for (int j = 0; j < morphcount; ++j) { diff --git a/GPU/Common/VertexDecoderCommon.h b/GPU/Common/VertexDecoderCommon.h index 65d0b56d0f..ba8b217832 100644 --- a/GPU/Common/VertexDecoderCommon.h +++ b/GPU/Common/VertexDecoderCommon.h @@ -254,7 +254,7 @@ public: case DEC_U16_3: for (int i = 0; i < 3; i++) weights[i] = s[i] * (1.f / 32768.f); break; case DEC_U16_4: for (int i = 0; i < 4; i++) weights[i] = s[i] * (1.f / 32768.f); break; default: - ERROR_LOG_REPORT_ONCE(fmtw0, G3D, "Reader: Unsupported W0 Format %d", decFmt_.w0fmt); + ERROR_LOG_REPORT_ONCE(fmtw0, Log::G3D, "Reader: Unsupported W0 Format %d", decFmt_.w0fmt); memset(weights, 0, sizeof(float) * 8); break; } diff --git a/GPU/Common/VertexDecoderRiscV.cpp b/GPU/Common/VertexDecoderRiscV.cpp index 82a7b3b5b8..0d232a74fb 100644 --- a/GPU/Common/VertexDecoderRiscV.cpp +++ b/GPU/Common/VertexDecoderRiscV.cpp @@ -317,7 +317,7 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int ResetCodePtr(GetOffset(start)); char temp[1024]{}; dec.ToString(temp, true); - ERROR_LOG(G3D, "Could not compile vertex decoder, failed at step %d: %s", i, temp); + ERROR_LOG(Log::G3D, "Could not compile vertex decoder, failed at step %d: %s", i, temp); return nullptr; } } @@ -350,12 +350,12 @@ JittedVertexDecoder VertexDecoderJitCache::Compile(const VertexDecoder &dec, int if (log) { char temp[1024]{}; dec.ToString(temp, true); - INFO_LOG(JIT, "=== %s (%d bytes) ===", temp, (int)(GetCodePtr() - start)); + INFO_LOG(Log::JIT, "=== %s (%d bytes) ===", temp, (int)(GetCodePtr() - start)); std::vector lines = DisassembleRV64(start, (int)(GetCodePtr() - start)); for (auto line : lines) { - INFO_LOG(JIT, "%s", line.c_str()); + INFO_LOG(Log::JIT, "%s", line.c_str()); } - INFO_LOG(JIT, "=========="); + INFO_LOG(Log::JIT, "=========="); } *jittedSize = (int)(GetCodePtr() - start); diff --git a/GPU/D3D11/D3D11Util.cpp b/GPU/D3D11/D3D11Util.cpp index 31a6980c16..b136ca57bc 100644 --- a/GPU/D3D11/D3D11Util.cpp +++ b/GPU/D3D11/D3D11Util.cpp @@ -36,10 +36,10 @@ std::vector CompileShaderToBytecodeD3D11(const char *code, size_t codeS if (trimmed.find("pow(f, e) will not work for negative f") != std::string::npos) { continue; } - WARN_LOG(G3D, "%.*s", (int)trimmed.length(), trimmed.data()); + WARN_LOG(Log::G3D, "%.*s", (int)trimmed.length(), trimmed.data()); } } else { - ERROR_LOG(G3D, "%s: %s\n\n%s", "errors", errors.c_str(), numberedCode.c_str()); + ERROR_LOG(Log::G3D, "%s: %s\n\n%s", "errors", errors.c_str(), numberedCode.c_str()); } OutputDebugStringA(errors.c_str()); OutputDebugStringA(numberedCode.c_str()); diff --git a/GPU/D3D11/DrawEngineD3D11.cpp b/GPU/D3D11/DrawEngineD3D11.cpp index e1c588b76b..f415745d70 100644 --- a/GPU/D3D11/DrawEngineD3D11.cpp +++ b/GPU/D3D11/DrawEngineD3D11.cpp @@ -237,7 +237,7 @@ ID3D11InputLayout *DrawEngineD3D11::SetupDecFmtForDraw(D3D11VertexShader *vshade // Create declaration HRESULT hr = device_->CreateInputLayout(VertexElements, VertexElement - VertexElements, vshader->bytecode().data(), vshader->bytecode().size(), &inputLayout); if (FAILED(hr)) { - ERROR_LOG(G3D, "Failed to create input layout!"); + ERROR_LOG(Log::G3D, "Failed to create input layout!"); inputLayout = nullptr; } @@ -370,7 +370,7 @@ void DrawEngineD3D11::DoFlush() { gpuStats.numUncachedVertsDrawn += vertexCount; prim = IndexGenerator::GeneralPrim((GEPrimitiveType)drawInds_[0].prim); - VERBOSE_LOG(G3D, "Flush prim %i SW! %i verts in one go", prim, vertexCount); + VERBOSE_LOG(Log::G3D, "Flush prim %i SW! %i verts in one go", prim, vertexCount); u16 *inds = decIndex_; SoftwareTransformResult result{}; diff --git a/GPU/D3D11/GPU_D3D11.cpp b/GPU/D3D11/GPU_D3D11.cpp index bb07131b5f..2e425b1f44 100644 --- a/GPU/D3D11/GPU_D3D11.cpp +++ b/GPU/D3D11/GPU_D3D11.cpp @@ -71,7 +71,7 @@ GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw) // Sanity check gstate if ((int *)&gstate.transferstart - (int *)&gstate != 0xEA) { - ERROR_LOG(G3D, "gstate has drifted out of sync!"); + ERROR_LOG(Log::G3D, "gstate has drifted out of sync!"); } // No need to flush before the tex scale/offset commands if we are baking @@ -141,7 +141,7 @@ void GPU_D3D11::BeginHostFrame() { if (gstate_c.useFlagsChanged) { // TODO: It'd be better to recompile them in the background, probably? // This most likely means that saw equal depth changed. - WARN_LOG(G3D, "Shader use flags changed, clearing all shaders and depth buffers"); + WARN_LOG(Log::G3D, "Shader use flags changed, clearing all shaders and depth buffers"); shaderManager_->ClearShaders(); framebufferManager_->ClearAllDepthBuffers(); drawEngine_.ClearInputLayoutMap(); diff --git a/GPU/D3D11/TextureCacheD3D11.cpp b/GPU/D3D11/TextureCacheD3D11.cpp index fa95d37eb0..320d688031 100644 --- a/GPU/D3D11/TextureCacheD3D11.cpp +++ b/GPU/D3D11/TextureCacheD3D11.cpp @@ -333,7 +333,7 @@ void TextureCacheD3D11::BuildTexture(TexCacheEntry *const entry) { } if (!data) { - ERROR_LOG(G3D, "Ran out of RAM trying to allocate a temporary texture upload buffer (%dx%d)", mipWidth, mipHeight); + ERROR_LOG(Log::G3D, "Ran out of RAM trying to allocate a temporary texture upload buffer (%dx%d)", mipWidth, mipHeight); return; } diff --git a/GPU/Debugger/Debugger.cpp b/GPU/Debugger/Debugger.cpp index 16143b882f..88c923b8ee 100644 --- a/GPU/Debugger/Debugger.cpp +++ b/GPU/Debugger/Debugger.cpp @@ -141,10 +141,10 @@ bool NotifyCommand(u32 pc) { auto info = gpuDebug->DissassembleOp(pc); if (lastStepTime >= 0.0) { - NOTICE_LOG(G3D, "Waiting at %08x, %s (%fms)", pc, info.desc.c_str(), (time_now_d() - lastStepTime) * 1000.0); + NOTICE_LOG(Log::G3D, "Waiting at %08x, %s (%fms)", pc, info.desc.c_str(), (time_now_d() - lastStepTime) * 1000.0); lastStepTime = -1.0; } else { - NOTICE_LOG(G3D, "Waiting at %08x, %s", pc, info.desc.c_str()); + NOTICE_LOG(Log::G3D, "Waiting at %08x, %s", pc, info.desc.c_str()); } GPUStepping::EnterStepping(); } @@ -157,10 +157,10 @@ void NotifyDraw() { return; if (breakNext == BreakNext::DRAW && !GPUStepping::IsStepping()) { if (lastStepTime >= 0.0) { - NOTICE_LOG(G3D, "Waiting at a draw (%fms)", (time_now_d() - lastStepTime) * 1000.0); + NOTICE_LOG(Log::G3D, "Waiting at a draw (%fms)", (time_now_d() - lastStepTime) * 1000.0); lastStepTime = -1.0; } else { - NOTICE_LOG(G3D, "Waiting at a draw"); + NOTICE_LOG(Log::G3D, "Waiting at a draw"); } GPUStepping::EnterStepping(); } diff --git a/GPU/Debugger/Playback.cpp b/GPU/Debugger/Playback.cpp index f66a9c3e92..b19919348f 100644 --- a/GPU/Debugger/Playback.cpp +++ b/GPU/Debugger/Playback.cpp @@ -355,7 +355,7 @@ bool DumpExecute::SubmitCmds(const void *p, u32 sz) { execListBuf = 0; } if (execListBuf == 0) { - ERROR_LOG(SYSTEM, "Unable to allocate for display list"); + ERROR_LOG(Log::System, "Unable to allocate for display list"); return false; } @@ -462,7 +462,7 @@ void DumpExecute::Registers(u32 ptr, u32 sz) { void DumpExecute::Vertices(u32 ptr, u32 sz) { u32 psp = mapping_.Map(ptr, sz, std::bind(&DumpExecute::SyncStall, this)); if (psp == 0) { - ERROR_LOG(SYSTEM, "Unable to allocate for vertices"); + ERROR_LOG(Log::System, "Unable to allocate for vertices"); return; } @@ -476,7 +476,7 @@ void DumpExecute::Vertices(u32 ptr, u32 sz) { void DumpExecute::Indices(u32 ptr, u32 sz) { u32 psp = mapping_.Map(ptr, sz, std::bind(&DumpExecute::SyncStall, this)); if (psp == 0) { - ERROR_LOG(SYSTEM, "Unable to allocate for indices"); + ERROR_LOG(Log::System, "Unable to allocate for indices"); return; } @@ -513,7 +513,7 @@ void DumpExecute::Clut(u32 ptr, u32 sz) { } else { u32 psp = mapping_.Map(ptr, sz, std::bind(&DumpExecute::SyncStall, this)); if (psp == 0) { - ERROR_LOG(SYSTEM, "Unable to allocate for clut"); + ERROR_LOG(Log::System, "Unable to allocate for clut"); return; } @@ -525,7 +525,7 @@ void DumpExecute::Clut(u32 ptr, u32 sz) { void DumpExecute::TransferSrc(u32 ptr, u32 sz) { u32 psp = mapping_.Map(ptr, sz, std::bind(&DumpExecute::SyncStall, this)); if (psp == 0) { - ERROR_LOG(SYSTEM, "Unable to allocate for transfer"); + ERROR_LOG(Log::System, "Unable to allocate for transfer"); return; } @@ -569,7 +569,7 @@ void DumpExecute::Memcpy(u32 ptr, u32 sz) { void DumpExecute::Texture(int level, u32 ptr, u32 sz) { u32 psp = mapping_.Map(ptr, sz, std::bind(&DumpExecute::SyncStall, this)); if (psp == 0) { - ERROR_LOG(SYSTEM, "Unable to allocate for texture"); + ERROR_LOG(Log::System, "Unable to allocate for texture"); return; } @@ -733,7 +733,7 @@ bool DumpExecute::Run() { break; default: - ERROR_LOG(SYSTEM, "Unsupported GE dump command: %d", (int)cmd.type); + ERROR_LOG(Log::System, "Unsupported GE dump command: %d", (int)cmd.type); return false; } } @@ -788,7 +788,7 @@ bool RunMountedReplay(const std::string &filename) { version = header.version; if (memcmp(header.magic, HEADER_MAGIC, sizeof(header.magic)) != 0 || header.version > VERSION || header.version < MIN_VERSION) { - ERROR_LOG(SYSTEM, "Invalid GE dump or unsupported version"); + ERROR_LOG(Log::System, "Invalid GE dump or unsupported version"); pspFileSystem.CloseFile(fp); return false; } @@ -817,7 +817,7 @@ bool RunMountedReplay(const std::string &filename) { pspFileSystem.CloseFile(fp); if (truncated) { - ERROR_LOG(SYSTEM, "Truncated GE dump"); + ERROR_LOG(Log::System, "Truncated GE dump"); return false; } diff --git a/GPU/Debugger/Record.cpp b/GPU/Debugger/Record.cpp index f37af0b557..88ee8353ea 100644 --- a/GPU/Debugger/Record.cpp +++ b/GPU/Debugger/Record.cpp @@ -197,7 +197,7 @@ static Path WriteRecording() { const Path filename = GenRecordingFilename(); - NOTICE_LOG(G3D, "Recording filename: %s", filename.c_str()); + NOTICE_LOG(Log::G3D, "Recording filename: %s", filename.c_str()); FILE *fp = File::OpenCFile(filename, "wb"); Header header{}; @@ -624,7 +624,7 @@ static void FinishRecording() { pushbuf.clear(); lastVRAM.clear(); - NOTICE_LOG(SYSTEM, "Recording finished"); + NOTICE_LOG(Log::System, "Recording finished"); active = false; flipLastAction = gpuStats.numFlips; flipFinishAt = -1; @@ -784,7 +784,7 @@ void NotifyDisplay(u32 framebuf, int stride, int fmt) { writePending = true; } if (!active && nextFrame && (gstate_c.skipDrawReason & SKIPDRAW_SKIPFRAME) == 0) { - NOTICE_LOG(SYSTEM, "Recording starting on display..."); + NOTICE_LOG(Log::System, "Recording starting on display..."); BeginRecording(); } if (!active) { @@ -808,7 +808,7 @@ void NotifyDisplay(u32 framebuf, int stride, int fmt) { commands.push_back({ CommandType::DISPLAY, sz, ptr }); if (writePending) { - NOTICE_LOG(SYSTEM, "Recording complete on display"); + NOTICE_LOG(Log::System, "Recording complete on display"); FinishRecording(); } } @@ -817,7 +817,7 @@ void NotifyBeginFrame() { const bool noDisplayAction = flipLastAction + 4 < gpuStats.numFlips; // We do this only to catch things that don't call NotifyDisplay. if (active && HasDrawCommands() && (noDisplayAction || gpuStats.numFlips == flipFinishAt)) { - NOTICE_LOG(SYSTEM, "Recording complete on frame"); + NOTICE_LOG(Log::System, "Recording complete on frame"); CheckEdramTrans(); struct DisplayBufData { @@ -839,7 +839,7 @@ void NotifyBeginFrame() { FinishRecording(); } if (!active && nextFrame && (gstate_c.skipDrawReason & SKIPDRAW_SKIPFRAME) == 0 && noDisplayAction) { - NOTICE_LOG(SYSTEM, "Recording starting on frame..."); + NOTICE_LOG(Log::System, "Recording starting on frame..."); BeginRecording(); // If we began on a BeginFrame, end on a BeginFrame. flipFinishAt = gpuStats.numFlips + 1; diff --git a/GPU/Debugger/Stepping.cpp b/GPU/Debugger/Stepping.cpp index d0fe232de6..db6b657e73 100644 --- a/GPU/Debugger/Stepping.cpp +++ b/GPU/Debugger/Stepping.cpp @@ -128,7 +128,7 @@ static void RunPauseAction() { break; default: - ERROR_LOG(G3D, "Unsupported pause action, forgot to add it to the switch."); + ERROR_LOG(Log::G3D, "Unsupported pause action, forgot to add it to the switch."); } actionComplete = true; diff --git a/GPU/Directx9/DrawEngineDX9.cpp b/GPU/Directx9/DrawEngineDX9.cpp index 6fe9b3dd07..4d16fd6701 100644 --- a/GPU/Directx9/DrawEngineDX9.cpp +++ b/GPU/Directx9/DrawEngineDX9.cpp @@ -211,7 +211,7 @@ IDirect3DVertexDeclaration9 *DrawEngineDX9::SetupDecFmtForDraw(const DecVtxForma IDirect3DVertexDeclaration9 *pHardwareVertexDecl = nullptr; HRESULT hr = device_->CreateVertexDeclaration( VertexElements, &pHardwareVertexDecl ); if (FAILED(hr)) { - ERROR_LOG(G3D, "Failed to create vertex declaration!"); + ERROR_LOG(Log::G3D, "Failed to create vertex declaration!"); pHardwareVertexDecl = nullptr; } @@ -322,7 +322,7 @@ void DrawEngineDX9::DoFlush() { gpuStats.numUncachedVertsDrawn += vertexCount; prim = IndexGenerator::GeneralPrim((GEPrimitiveType)drawInds_[0].prim); - VERBOSE_LOG(G3D, "Flush prim %i SW! %i verts in one go", prim, vertexCount); + VERBOSE_LOG(Log::G3D, "Flush prim %i SW! %i verts in one go", prim, vertexCount); u16 *inds = decIndex_; SoftwareTransformResult result{}; diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index cd821ad71c..cf49fa1c0a 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -69,7 +69,7 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw) // Sanity check gstate if ((int *)&gstate.transferstart - (int *)&gstate != 0xEA) { - ERROR_LOG(G3D, "gstate has drifted out of sync!"); + ERROR_LOG(Log::G3D, "gstate has drifted out of sync!"); } // No need to flush before the tex scale/offset commands if we are baking @@ -86,7 +86,7 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw) if (g_Config.bHardwareTessellation) { // Disable hardware tessellation bacause DX9 is still unsupported. - ERROR_LOG(G3D, "Hardware Tessellation is unsupported, falling back to software tessellation"); + ERROR_LOG(Log::G3D, "Hardware Tessellation is unsupported, falling back to software tessellation"); auto gr = GetI18NCategory(I18NCat::GRAPHICS); // TODO: Badly formulated g_OSD.Show(OSDType::MESSAGE_WARNING, gr->T("Turn off Hardware Tessellation - unsupported")); @@ -131,7 +131,7 @@ void GPU_DX9::BeginHostFrame() { if (gstate_c.useFlagsChanged) { // TODO: It'd be better to recompile them in the background, probably? // This most likely means that saw equal depth changed. - WARN_LOG(G3D, "Shader use flags changed, clearing all shaders and depth buffers"); + WARN_LOG(Log::G3D, "Shader use flags changed, clearing all shaders and depth buffers"); shaderManager_->ClearShaders(); framebufferManager_->ClearAllDepthBuffers(); gstate_c.useFlagsChanged = false; diff --git a/GPU/Directx9/ShaderManagerDX9.cpp b/GPU/Directx9/ShaderManagerDX9.cpp index 790e6f7609..bddc01ecf0 100644 --- a/GPU/Directx9/ShaderManagerDX9.cpp +++ b/GPU/Directx9/ShaderManagerDX9.cpp @@ -61,12 +61,12 @@ PSShader::PSShader(LPDIRECT3DDEVICE9 device, FShaderID id, const char *code) : i if (!errorMessage.empty()) { if (success) { - ERROR_LOG(G3D, "Warnings in shader compilation!"); + ERROR_LOG(Log::G3D, "Warnings in shader compilation!"); } else { - ERROR_LOG(G3D, "Error in shader compilation!"); + ERROR_LOG(Log::G3D, "Error in shader compilation!"); } - ERROR_LOG(G3D, "Messages: %s", errorMessage.c_str()); - ERROR_LOG(G3D, "Shader source:\n%s", LineNumberString(code).c_str()); + ERROR_LOG(Log::G3D, "Messages: %s", errorMessage.c_str()); + ERROR_LOG(Log::G3D, "Shader source:\n%s", LineNumberString(code).c_str()); OutputDebugStringUTF8("Messages:\n"); OutputDebugStringUTF8(errorMessage.c_str()); Reporting::ReportMessage("D3D error in shader compilation: info: %s / code: %s", errorMessage.c_str(), code); @@ -79,7 +79,7 @@ PSShader::PSShader(LPDIRECT3DDEVICE9 device, FShaderID id, const char *code) : i shader = NULL; return; } else { - VERBOSE_LOG(G3D, "Compiled pixel shader:\n%s\n", (const char *)code); + VERBOSE_LOG(Log::G3D, "Compiled pixel shader:\n%s\n", (const char *)code); } } @@ -110,12 +110,12 @@ VSShader::VSShader(LPDIRECT3DDEVICE9 device, VShaderID id, const char *code, boo success = CompileVertexShaderD3D9(device, code, &shader, &errorMessage); if (!errorMessage.empty()) { if (success) { - ERROR_LOG(G3D, "Warnings in shader compilation!"); + ERROR_LOG(Log::G3D, "Warnings in shader compilation!"); } else { - ERROR_LOG(G3D, "Error in shader compilation!"); + ERROR_LOG(Log::G3D, "Error in shader compilation!"); } - ERROR_LOG(G3D, "Messages: %s", errorMessage.c_str()); - ERROR_LOG(G3D, "Shader source:\n%s", code); + ERROR_LOG(Log::G3D, "Messages: %s", errorMessage.c_str()); + ERROR_LOG(Log::G3D, "Shader source:\n%s", code); OutputDebugStringUTF8("Messages:\n"); OutputDebugStringUTF8(errorMessage.c_str()); Reporting::ReportMessage("D3D error in shader compilation: info: %s / code: %s", errorMessage.c_str(), code); @@ -128,7 +128,7 @@ VSShader::VSShader(LPDIRECT3DDEVICE9 device, VShaderID id, const char *code, boo shader = NULL; return; } else { - VERBOSE_LOG(G3D, "Compiled vertex shader:\n%s\n", (const char *)code); + VERBOSE_LOG(Log::G3D, "Compiled vertex shader:\n%s\n", (const char *)code); } } @@ -596,9 +596,9 @@ VSShader *ShaderManagerDX9::ApplyShader(bool useHWTransform, bool useHWTessellat if (!vs || vs->Failed()) { if (!vs) { // TODO: Report this? - ERROR_LOG(G3D, "Shader generation failed, falling back to software transform"); + ERROR_LOG(Log::G3D, "Shader generation failed, falling back to software transform"); } else { - ERROR_LOG(G3D, "Shader compilation failed, falling back to software transform"); + ERROR_LOG(Log::G3D, "Shader compilation failed, falling back to software transform"); } if (!g_Config.bHideSlowWarnings) { auto gr = GetI18NCategory(I18NCat::GRAPHICS); diff --git a/GPU/Directx9/TextureCacheDX9.cpp b/GPU/Directx9/TextureCacheDX9.cpp index 04a1aafad1..ac130dd4c3 100644 --- a/GPU/Directx9/TextureCacheDX9.cpp +++ b/GPU/Directx9/TextureCacheDX9.cpp @@ -79,7 +79,7 @@ TextureCacheDX9::TextureCacheDX9(Draw::DrawContext *draw, Draw2D *draw2D) result = device_->GetDeviceCaps(&pCaps); } if (FAILED(result)) { - WARN_LOG(G3D, "Failed to get the device caps!"); + WARN_LOG(Log::G3D, "Failed to get the device caps!"); maxAnisotropyLevel = 16; } else { maxAnisotropyLevel = pCaps.MaxAnisotropy; @@ -264,7 +264,7 @@ void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry) { } if (FAILED(hr)) { - INFO_LOG(G3D, "Failed to create D3D texture: %dx%d", tw, th); + INFO_LOG(Log::G3D, "Failed to create D3D texture: %dx%d", tw, th); ReleaseTexture(entry, true); return; } @@ -284,7 +284,7 @@ void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry) { result = ((LPDIRECT3DTEXTURE9)texture)->LockRect(dstLevel, &rect, NULL, lockFlag); if (FAILED(result)) { - ERROR_LOG(G3D, "Failed to lock D3D 2D texture at level %d: %dx%d", i, plan.w, plan.h); + ERROR_LOG(Log::G3D, "Failed to lock D3D 2D texture at level %d: %dx%d", i, plan.w, plan.h); return; } uint8_t *data = (uint8_t *)rect.pBits; @@ -297,7 +297,7 @@ void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry) { D3DLOCKED_BOX box; HRESULT result = ((LPDIRECT3DVOLUMETEXTURE9)texture)->LockBox(0, &box, nullptr, D3DLOCK_DISCARD); if (FAILED(result)) { - ERROR_LOG(G3D, "Failed to lock D3D 2D texture: %dx%dx%d", plan.w, plan.h, plan.depth); + ERROR_LOG(Log::G3D, "Failed to lock D3D 2D texture: %dx%dx%d", plan.w, plan.h, plan.depth); return; } diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index 1fcfc119bd..d6da9070de 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -375,7 +375,7 @@ void DrawEngineGLES::DoFlush() { if (gl_extensions.IsGLES && !gl_extensions.GLES3) { constexpr int vertexCountLimit = 0x10000 / 3; if (vertexCount > vertexCountLimit) { - WARN_LOG_REPORT_ONCE(manyVerts, G3D, "Truncating vertex count from %d to %d", vertexCount, vertexCountLimit); + WARN_LOG_REPORT_ONCE(manyVerts, Log::G3D, "Truncating vertex count from %d to %d", vertexCount, vertexCountLimit); vertexCount = vertexCountLimit; } } diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 10fe10b76f..092bcf872d 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -75,7 +75,7 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw) // Sanity check gstate if ((int *)&gstate.transferstart - (int *)&gstate != 0xEA) { - ERROR_LOG(G3D, "gstate has drifted out of sync!"); + ERROR_LOG(Log::G3D, "gstate has drifted out of sync!"); } // No need to flush before the tex scale/offset commands if we are baking @@ -105,18 +105,18 @@ GPU_GLES::GPU_GLES(GraphicsContext *gfxCtx, Draw::DrawContext *draw) gstate_c.useFlagsChanged = false; if (shaderManagerGL_->LoadCache(f)) - NOTICE_LOG(G3D, "Precompiling the shader cache from '%s'", shaderCachePath_.c_str()); + NOTICE_LOG(Log::G3D, "Precompiling the shader cache from '%s'", shaderCachePath_.c_str()); } } } else { - INFO_LOG(G3D, "Shader cache disabled. Not loading."); + INFO_LOG(Log::G3D, "Shader cache disabled. Not loading."); } } if (g_Config.bHardwareTessellation) { // Disable hardware tessellation if device is unsupported. if (!drawEngine_.SupportsHWTessellation()) { - ERROR_LOG(G3D, "Hardware Tessellation is unsupported, falling back to software tessellation"); + ERROR_LOG(Log::G3D, "Hardware Tessellation is unsupported, falling back to software tessellation"); auto gr = GetI18NCategory(I18NCat::GRAPHICS); g_OSD.Show(OSDType::MESSAGE_WARNING, gr->T("Turn off Hardware Tessellation - unsupported")); } @@ -131,7 +131,7 @@ GPU_GLES::~GPU_GLES() { if (g_Config.bShaderCache) { shaderManagerGL_->SaveCache(shaderCachePath_, &drawEngine_); } else { - INFO_LOG(G3D, "Shader cache disabled. Not saving."); + INFO_LOG(Log::G3D, "Shader cache disabled. Not saving."); } } fragmentTestCache_.Clear(); @@ -221,7 +221,7 @@ void GPU_GLES::BuildReportingInfo() { } void GPU_GLES::DeviceLost() { - INFO_LOG(G3D, "GPU_GLES: DeviceLost"); + INFO_LOG(Log::G3D, "GPU_GLES: DeviceLost"); // Simply drop all caches and textures. // FBOs appear to survive? Or no? @@ -260,7 +260,7 @@ void GPU_GLES::BeginHostFrame() { if (gstate_c.useFlagsChanged) { // TODO: It'd be better to recompile them in the background, probably? // This most likely means that saw equal depth changed. - WARN_LOG(G3D, "Shader use flags changed, clearing all shaders and depth buffers"); + WARN_LOG(Log::G3D, "Shader use flags changed, clearing all shaders and depth buffers"); shaderManager_->ClearShaders(); framebufferManager_->ClearAllDepthBuffers(); gstate_c.useFlagsChanged = false; diff --git a/GPU/GLES/ShaderManagerGLES.cpp b/GPU/GLES/ShaderManagerGLES.cpp index 3eac4b2808..2a3678e6b8 100644 --- a/GPU/GLES/ShaderManagerGLES.cpp +++ b/GPU/GLES/ShaderManagerGLES.cpp @@ -749,7 +749,7 @@ Shader *ShaderManagerGLES::CompileFragmentShader(FShaderID FSID) { std::string errorString; FragmentShaderFlags flags; if (!GenerateFragmentShader(FSID, codeBuffer_, draw_->GetShaderLanguageDesc(), draw_->GetBugs(), &uniformMask, &flags, &errorString)) { - ERROR_LOG_REPORT(G3D, "FS shader gen error: %s (%s: %08x:%08x)", errorString.c_str(), "GLES", FSID.d[0], FSID.d[1]); + ERROR_LOG_REPORT(Log::G3D, "FS shader gen error: %s (%s: %08x:%08x)", errorString.c_str(), "GLES", FSID.d[0], FSID.d[1]); return nullptr; } _assert_msg_(strlen(codeBuffer_) < CODE_BUFFER_SIZE, "FS length error: %d", (int)strlen(codeBuffer_)); @@ -767,7 +767,7 @@ Shader *ShaderManagerGLES::CompileVertexShader(VShaderID VSID) { std::string errorString; VertexShaderFlags flags; if (!GenerateVertexShader(VSID, codeBuffer_, draw_->GetShaderLanguageDesc(), draw_->GetBugs(), &attrMask, &uniformMask, &flags, &errorString)) { - ERROR_LOG_REPORT(G3D, "VS shader gen error: %s (%s: %08x:%08x)", errorString.c_str(), "GLES", VSID.d[0], VSID.d[1]); + ERROR_LOG_REPORT(Log::G3D, "VS shader gen error: %s (%s: %08x:%08x)", errorString.c_str(), "GLES", VSID.d[0], VSID.d[1]); return nullptr; } _assert_msg_(strlen(codeBuffer_) < CODE_BUFFER_SIZE, "VS length error: %d", (int)strlen(codeBuffer_)); @@ -801,7 +801,7 @@ Shader *ShaderManagerGLES::ApplyVertexShader(bool useHWTransform, bool useHWTess // Vertex shader not in cache. Let's compile it. vs = CompileVertexShader(*VSID); if (!vs) { - ERROR_LOG(G3D, "Vertex shader generation failed, falling back to software transform"); + ERROR_LOG(Log::G3D, "Vertex shader generation failed, falling back to software transform"); if (!g_Config.bHideSlowWarnings) { auto gr = GetI18NCategory(I18NCat::GRAPHICS); g_OSD.Show(OSDType::MESSAGE_ERROR, gr->T("hardware transform error - falling back to software"), 2.5f); @@ -852,7 +852,7 @@ LinkedShader *ShaderManagerGLES::ApplyFragmentShader(VShaderID VSID, Shader *vs, // Could fail to generate, in which case we're kinda screwed. fs = CompileFragmentShader(FSID); if (!fs) { - ERROR_LOG(G3D, "Failed to generate fragment shader with ID %08x:%08x", FSID.d[0], FSID.d[1]); + ERROR_LOG(Log::G3D, "Failed to generate fragment shader with ID %08x:%08x", FSID.d[0], FSID.d[1]); // Still insert it so we don't end up spamming generation. } fsCache_.Insert(FSID, fs); @@ -1043,7 +1043,7 @@ bool ShaderManagerGLES::LoadCache(File::IOFile &f) { // Sanity check the file contents if (header.numFragmentShaders > 1000 || header.numVertexShaders > 1000 || header.numLinkedPrograms > 1000) { - ERROR_LOG(G3D, "Corrupt shader cache file header, aborting."); + ERROR_LOG(Log::G3D, "Corrupt shader cache file header, aborting."); return false; } @@ -1053,7 +1053,7 @@ bool ShaderManagerGLES::LoadCache(File::IOFile &f) { expectedSize += header.numFragmentShaders * sizeof(FShaderID); expectedSize += header.numLinkedPrograms * (sizeof(VShaderID) + sizeof(FShaderID)); if (sz != expectedSize) { - ERROR_LOG(G3D, "Shader cache file is wrong size: %lld instead of %lld", sz, expectedSize); + ERROR_LOG(Log::G3D, "Shader cache file is wrong size: %lld instead of %lld", sz, expectedSize); return false; } @@ -1096,7 +1096,7 @@ bool ShaderManagerGLES::LoadCache(File::IOFile &f) { if (!vsCache_.ContainsKey(id)) { if (id.Bit(VS_BIT_IS_THROUGH) && id.Bit(VS_BIT_USE_HW_TRANSFORM)) { // Clearly corrupt, bailing. - ERROR_LOG_REPORT(G3D, "Corrupt shader cache: Both IS_THROUGH and USE_HW_TRANSFORM set."); + ERROR_LOG_REPORT(Log::G3D, "Corrupt shader cache: Both IS_THROUGH and USE_HW_TRANSFORM set."); pending.Clear(); return false; } @@ -1105,13 +1105,13 @@ bool ShaderManagerGLES::LoadCache(File::IOFile &f) { if (!vs) { // Give up on using the cache, just bail. We can't safely create the fallback shaders here // without trying to deduce the vertType from the VSID. - ERROR_LOG(G3D, "Failed to compile a vertex shader loading from cache. Skipping rest of shader cache."); + ERROR_LOG(Log::G3D, "Failed to compile a vertex shader loading from cache. Skipping rest of shader cache."); pending.Clear(); return false; } vsCache_.Insert(id, vs); } else { - WARN_LOG(G3D, "Duplicate vertex shader found in GL shader cache, ignoring"); + WARN_LOG(Log::G3D, "Duplicate vertex shader found in GL shader cache, ignoring"); } } @@ -1122,13 +1122,13 @@ bool ShaderManagerGLES::LoadCache(File::IOFile &f) { if (!fs) { // Give up on using the cache - something went wrong. // We'll still keep the shaders we generated so far around. - ERROR_LOG(G3D, "Failed to compile a fragment shader loading from cache. Skipping rest of shader cache."); + ERROR_LOG(Log::G3D, "Failed to compile a fragment shader loading from cache. Skipping rest of shader cache."); pending.Clear(); return false; } fsCache_.Insert(id, fs); } else { - WARN_LOG(G3D, "Duplicate fragment shader found in GL shader cache, ignoring"); + WARN_LOG(Log::G3D, "Duplicate fragment shader found in GL shader cache, ignoring"); } } @@ -1150,7 +1150,7 @@ bool ShaderManagerGLES::LoadCache(File::IOFile &f) { // Okay, finally done. Time to report status. double finish = time_now_d(); - NOTICE_LOG(G3D, "Precompile: Compiled and linked %d programs (%d vertex, %d fragment) in %0.1f milliseconds", (int)pending.link.size(), (int)pending.vert.size(), (int)pending.frag.size(), 1000 * (finish - pending.start)); + NOTICE_LOG(Log::G3D, "Precompile: Compiled and linked %d programs (%d vertex, %d fragment) in %0.1f milliseconds", (int)pending.link.size(), (int)pending.vert.size(), (int)pending.frag.size(), 1000 * (finish - pending.start)); pending.Clear(); return true; @@ -1160,7 +1160,7 @@ void ShaderManagerGLES::SaveCache(const Path &filename, DrawEngineGLES *drawEngi if (linkedShaderCache_.empty()) { return; } - INFO_LOG(G3D, "Saving the shader cache to '%s'", filename.c_str()); + INFO_LOG(Log::G3D, "Saving the shader cache to '%s'", filename.c_str()); FILE *f = File::OpenCFile(filename, "wb"); if (!f) { // Can't save, give up for now. diff --git a/GPU/GLES/StencilBufferGLES.cpp b/GPU/GLES/StencilBufferGLES.cpp index cb045691fc..18be9d359f 100644 --- a/GPU/GLES/StencilBufferGLES.cpp +++ b/GPU/GLES/StencilBufferGLES.cpp @@ -102,7 +102,7 @@ bool FramebufferManagerGLES::ReadbackStencilbuffer(Draw::Framebuffer *fbo, int x using namespace Draw; if (!fbo) { - ERROR_LOG_REPORT_ONCE(vfbfbozero, SCEGE, "ReadbackStencilbufferSync: bad fbo"); + ERROR_LOG_REPORT_ONCE(vfbfbozero, Log::sceGe, "ReadbackStencilbufferSync: bad fbo"); return false; } diff --git a/GPU/GLES/TextureCacheGLES.cpp b/GPU/GLES/TextureCacheGLES.cpp index 25fe23eea3..62b2ca3765 100644 --- a/GPU/GLES/TextureCacheGLES.cpp +++ b/GPU/GLES/TextureCacheGLES.cpp @@ -321,7 +321,7 @@ void TextureCacheGLES::BuildTexture(TexCacheEntry *const entry) { data = (u8 *)AllocateAlignedMemory(dataSize, 16); if (!data) { - ERROR_LOG(G3D, "Ran out of RAM trying to allocate a temporary texture upload buffer (%dx%d)", mipWidth, mipHeight); + ERROR_LOG(Log::G3D, "Ran out of RAM trying to allocate a temporary texture upload buffer (%dx%d)", mipWidth, mipHeight); return; } @@ -409,7 +409,7 @@ bool TextureCacheGLES::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, buffer.Allocate(w, h, GE_FORMAT_8888, false); renderManager->CopyImageToMemorySync(entry->textureName, level, 0, 0, w, h, Draw::DataFormat::R8G8B8A8_UNORM, (uint8_t *)buffer.GetData(), w, "GetCurrentTextureDebug"); } else { - ERROR_LOG(G3D, "Failed to get debug texture: texture is null"); + ERROR_LOG(Log::G3D, "Failed to get debug texture: texture is null"); } gstate_c.Dirty(DIRTY_TEXTURE_IMAGE | DIRTY_TEXTURE_PARAMS); framebufferManager_->RebindFramebuffer("RebindFramebuffer - GetCurrentTextureDebug"); diff --git a/GPU/GPU.cpp b/GPU/GPU.cpp index 21ad2d3f0f..38af2f75ba 100644 --- a/GPU/GPU.cpp +++ b/GPU/GPU.cpp @@ -102,7 +102,7 @@ bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *draw) { #if !PPSSPP_PLATFORM(SWITCH) case GPUCORE_VULKAN: if (!ctx) { - ERROR_LOG(G3D, "Unable to init Vulkan GPU backend, no context"); + ERROR_LOG(Log::G3D, "Unable to init Vulkan GPU backend, no context"); break; } SetGPU(new GPU_Vulkan(ctx, draw)); diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 1710f50c36..80dc8b91c0 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -363,13 +363,13 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, PSPPointersize is below 16, it's the old struct without stack info. if (args.IsValid() && args->size >= 16 && args->numStacks >= 256) { - return hleLogError(G3D, SCE_KERNEL_ERROR_INVALID_SIZE, "invalid stack depth %d", args->numStacks); + return hleLogError(Log::G3D, SCE_KERNEL_ERROR_INVALID_SIZE, "invalid stack depth %d", args->numStacks); } int id = -1; @@ -384,10 +384,10 @@ u32 GPUCommon::EnqueueList(u32 listpc, u32 stall, int subIntrBase, PSPPointersignal == PSP_GE_SIGNAL_HANDLER_PAUSE) { - ERROR_LOG_REPORT(G3D, "sceGeBreak: can't break signal-pausing list"); + ERROR_LOG_REPORT(Log::G3D, "sceGeBreak: can't break signal-pausing list"); } else return SCE_KERNEL_ERROR_ALREADY; @@ -620,7 +620,7 @@ void GPUCommon::NotifySteppingEnter() { void GPUCommon::NotifySteppingExit() { if (coreCollectDebugStats) { if (timeSteppingStarted_ <= 0.0) { - ERROR_LOG(G3D, "Mismatched stepping enter/exit."); + ERROR_LOG(Log::G3D, "Mismatched stepping enter/exit."); } double total = time_now_d() - timeSteppingStarted_; _dbg_assert_msg_(total >= 0.0, "Time spent stepping became negative"); @@ -648,7 +648,7 @@ bool GPUCommon::InterpretList(DisplayList &list) { gstate_c.offsetAddr = list.offsetAddr; if (!Memory::IsValidAddress(list.pc)) { - ERROR_LOG_REPORT(G3D, "DL PC = %08x WTF!!!!", list.pc); + ERROR_LOG_REPORT(Log::G3D, "DL PC = %08x WTF!!!!", list.pc); return true; } @@ -712,7 +712,7 @@ bool GPUCommon::InterpretList(DisplayList &list) { void GPUCommon::PSPFrame() { immCount_ = 0; if (dumpNextFrame_) { - NOTICE_LOG(G3D, "DUMPING THIS FRAME"); + NOTICE_LOG(Log::G3D, "DUMPING THIS FRAME"); dumpThisFrame_ = true; dumpNextFrame_ = false; } else if (dumpThisFrame_) { @@ -746,7 +746,7 @@ void GPUCommon::SlowRunLoop(DisplayList &list) { prev = 0; } GeDisassembleOp(list.pc, op, prev, temp, 256); - NOTICE_LOG(G3D, "%08x: %s", op, temp); + NOTICE_LOG(Log::G3D, "%08x: %s", op, temp); } gstate.cmdmem[cmd] = op; @@ -839,13 +839,13 @@ void GPUCommon::ProcessDLQueue() { // Seems to be correct behaviour to process the list anyway? if (startingTicks < busyTicks) { - DEBUG_LOG(G3D, "Can't execute a list yet, still busy for %lld ticks", busyTicks - startingTicks); + DEBUG_LOG(Log::G3D, "Can't execute a list yet, still busy for %lld ticks", busyTicks - startingTicks); //return; } for (int listIndex = GetNextListIndex(); listIndex != -1; listIndex = GetNextListIndex()) { DisplayList &l = dls[listIndex]; - DEBUG_LOG(G3D, "Starting DL execution at %08x - stall = %08x", l.pc, l.stall); + DEBUG_LOG(Log::G3D, "Starting DL execution at %08x - stall = %08x", l.pc, l.stall); if (!InterpretList(l)) { return; } else { @@ -889,7 +889,7 @@ void GPUCommon::Execute_Origin(u32 op, u32 diff) { void GPUCommon::Execute_Jump(u32 op, u32 diff) { const u32 target = gstate_c.getRelativeAddress(op & 0x00FFFFFC); if (!Memory::IsValidAddress(target)) { - ERROR_LOG(G3D, "JUMP to illegal address %08x - ignoring! data=%06x", target, op & 0x00FFFFFF); + ERROR_LOG(Log::G3D, "JUMP to illegal address %08x - ignoring! data=%06x", target, op & 0x00FFFFFF); UpdateState(GPUSTATE_ERROR); return; } @@ -906,7 +906,7 @@ void GPUCommon::Execute_BJump(u32 op, u32 diff) { UpdatePC(currentList->pc, target - 4); currentList->pc = target - 4; // pc will be increased after we return, counteract that } else { - ERROR_LOG(G3D, "BJUMP to illegal address %08x - ignoring! data=%06x", target, op & 0x00FFFFFF); + ERROR_LOG(Log::G3D, "BJUMP to illegal address %08x - ignoring! data=%06x", target, op & 0x00FFFFFF); UpdateState(GPUSTATE_ERROR); } } @@ -917,7 +917,7 @@ void GPUCommon::Execute_Call(u32 op, u32 diff) { const u32 target = gstate_c.getRelativeAddress(op & 0x00FFFFFC); if (!Memory::IsValidAddress(target)) { - ERROR_LOG(G3D, "CALL to illegal address %08x - ignoring! data=%06x", target, op & 0x00FFFFFF); + ERROR_LOG(Log::G3D, "CALL to illegal address %08x - ignoring! data=%06x", target, op & 0x00FFFFFF); UpdateState(GPUSTATE_ERROR); return; } @@ -941,7 +941,7 @@ void GPUCommon::DoExecuteCall(u32 target) { } if (currentList->stackptr == ARRAY_SIZE(currentList->stack)) { - ERROR_LOG(G3D, "CALL: Stack full!"); + ERROR_LOG(Log::G3D, "CALL: Stack full!"); // TODO: UpdateState(GPUSTATE_ERROR) ? } else { auto &stackEntry = currentList->stack[currentList->stackptr++]; @@ -955,7 +955,7 @@ void GPUCommon::DoExecuteCall(u32 target) { void GPUCommon::Execute_Ret(u32 op, u32 diff) { if (currentList->stackptr == 0) { - DEBUG_LOG(G3D, "RET: Stack empty!"); + DEBUG_LOG(Log::G3D, "RET: Stack empty!"); } else { auto &stackEntry = currentList->stack[--currentList->stackptr]; gstate_c.offsetAddr = stackEntry.offsetAddr; @@ -965,7 +965,7 @@ void GPUCommon::Execute_Ret(u32 op, u32 diff) { currentList->pc = target - 4; #ifdef _DEBUG if (!Memory::IsValidAddress(currentList->pc)) { - ERROR_LOG_REPORT(G3D, "Invalid DL PC %08x on return", currentList->pc); + ERROR_LOG_REPORT(Log::G3D, "Invalid DL PC %08x on return", currentList->pc); UpdateState(GPUSTATE_ERROR); } #endif @@ -998,12 +998,12 @@ void GPUCommon::Execute_End(u32 op, u32 diff) { if (sceKernelGetCompiledSdkVersion() <= 0x02000010) currentList->state = PSP_GE_DL_STATE_PAUSED; currentList->signal = behaviour; - DEBUG_LOG(G3D, "Signal with wait. signal/end: %04x %04x", signal, enddata); + DEBUG_LOG(Log::G3D, "Signal with wait. signal/end: %04x %04x", signal, enddata); break; case PSP_GE_SIGNAL_HANDLER_CONTINUE: // Resume the list right away, then call the handler. currentList->signal = behaviour; - DEBUG_LOG(G3D, "Signal without wait. signal/end: %04x %04x", signal, enddata); + DEBUG_LOG(Log::G3D, "Signal without wait. signal/end: %04x %04x", signal, enddata); break; case PSP_GE_SIGNAL_HANDLER_PAUSE: // Pause the list instead of ending at the next FINISH. @@ -1012,7 +1012,7 @@ void GPUCommon::Execute_End(u32 op, u32 diff) { // But right now, signal is always reset by interrupts, so that causes pause to not work. trigger = false; currentList->signal = behaviour; - DEBUG_LOG(G3D, "Signal with Pause. signal/end: %04x %04x", signal, enddata); + DEBUG_LOG(Log::G3D, "Signal with Pause. signal/end: %04x %04x", signal, enddata); break; case PSP_GE_SIGNAL_SYNC: // Acts as a memory barrier, never calls any user code. @@ -1021,7 +1021,7 @@ void GPUCommon::Execute_End(u32 op, u32 diff) { // However, this is likely a bug in how GE signal interrupts are handled. trigger = false; currentList->signal = behaviour; - DEBUG_LOG(G3D, "Signal with Sync. signal/end: %04x %04x", signal, enddata); + DEBUG_LOG(Log::G3D, "Signal with Sync. signal/end: %04x %04x", signal, enddata); break; case PSP_GE_SIGNAL_JUMP: case PSP_GE_SIGNAL_RJUMP: @@ -1041,12 +1041,12 @@ void GPUCommon::Execute_End(u32 op, u32 diff) { } if (!Memory::IsValidAddress(target)) { - ERROR_LOG_REPORT(G3D, "Signal with Jump (%s): bad address. signal/end: %04x %04x", targetType, signal, enddata); + ERROR_LOG_REPORT(Log::G3D, "Signal with Jump (%s): bad address. signal/end: %04x %04x", targetType, signal, enddata); UpdateState(GPUSTATE_ERROR); } else { UpdatePC(currentList->pc, target); currentList->pc = target; - DEBUG_LOG(G3D, "Signal with Jump (%s). signal/end: %04x %04x", targetType, signal, enddata); + DEBUG_LOG(Log::G3D, "Signal with Jump (%s). signal/end: %04x %04x", targetType, signal, enddata); } } break; @@ -1068,9 +1068,9 @@ void GPUCommon::Execute_End(u32 op, u32 diff) { } if (currentList->stackptr == ARRAY_SIZE(currentList->stack)) { - ERROR_LOG_REPORT(G3D, "Signal with Call (%s): stack full. signal/end: %04x %04x", targetType, signal, enddata); + ERROR_LOG_REPORT(Log::G3D, "Signal with Call (%s): stack full. signal/end: %04x %04x", targetType, signal, enddata); } else if (!Memory::IsValidAddress(target)) { - ERROR_LOG_REPORT(G3D, "Signal with Call (%s): bad address. signal/end: %04x %04x", targetType, signal, enddata); + ERROR_LOG_REPORT(Log::G3D, "Signal with Call (%s): bad address. signal/end: %04x %04x", targetType, signal, enddata); UpdateState(GPUSTATE_ERROR); } else { // TODO: This might save/restore other state... @@ -1080,7 +1080,7 @@ void GPUCommon::Execute_End(u32 op, u32 diff) { stackEntry.baseAddr = gstate.base; UpdatePC(currentList->pc, target); currentList->pc = target; - DEBUG_LOG(G3D, "Signal with Call (%s). signal/end: %04x %04x", targetType, signal, enddata); + DEBUG_LOG(Log::G3D, "Signal with Call (%s). signal/end: %04x %04x", targetType, signal, enddata); } } break; @@ -1089,7 +1089,7 @@ void GPUCommon::Execute_End(u32 op, u32 diff) { trigger = false; currentList->signal = behaviour; if (currentList->stackptr == 0) { - ERROR_LOG_REPORT(G3D, "Signal with Return: stack empty. signal/end: %04x %04x", signal, enddata); + ERROR_LOG_REPORT(Log::G3D, "Signal with Return: stack empty. signal/end: %04x %04x", signal, enddata); } else { // TODO: This might save/restore other state... auto &stackEntry = currentList->stack[--currentList->stackptr]; @@ -1097,12 +1097,12 @@ void GPUCommon::Execute_End(u32 op, u32 diff) { gstate.base = stackEntry.baseAddr; UpdatePC(currentList->pc, stackEntry.pc); currentList->pc = stackEntry.pc; - DEBUG_LOG(G3D, "Signal with Return. signal/end: %04x %04x", signal, enddata); + DEBUG_LOG(Log::G3D, "Signal with Return. signal/end: %04x %04x", signal, enddata); } } break; default: - ERROR_LOG_REPORT(G3D, "UNKNOWN Signal UNIMPLEMENTED %i ! signal/end: %04x %04x", behaviour, signal, enddata); + ERROR_LOG_REPORT(Log::G3D, "UNKNOWN Signal UNIMPLEMENTED %i ! signal/end: %04x %04x", behaviour, signal, enddata); break; } // TODO: Technically, jump/call/ret should generate an interrupt, but before the pc change maybe? @@ -1155,7 +1155,7 @@ void GPUCommon::Execute_End(u32 op, u32 diff) { } break; default: - DEBUG_LOG(G3D,"Ah, not finished: %06x", prev & 0xFFFFFF); + DEBUG_LOG(Log::G3D,"Ah, not finished: %06x", prev & 0xFFFFFF); break; } } @@ -1178,7 +1178,7 @@ void GPUCommon::Execute_BoundingBox(u32 op, u32 diff) { if (Memory::IsValidRange(gstate_c.vertexAddr, bytesRead)) { const void *control_points = Memory::GetPointerUnchecked(gstate_c.vertexAddr); if (!control_points) { - ERROR_LOG_REPORT_ONCE(boundingbox, G3D, "Invalid verts in bounding box check"); + ERROR_LOG_REPORT_ONCE(boundingbox, Log::G3D, "Invalid verts in bounding box check"); currentList->bboxResult = true; return; } @@ -1188,7 +1188,7 @@ void GPUCommon::Execute_BoundingBox(u32 op, u32 diff) { int indexShift = ((gstate.vertType & GE_VTYPE_IDX_MASK) >> GE_VTYPE_IDX_SHIFT) - 1; inds = Memory::GetPointerUnchecked(gstate_c.indexAddr); if (!inds || !Memory::IsValidRange(gstate_c.indexAddr, count << indexShift)) { - ERROR_LOG_REPORT_ONCE(boundingboxInds, G3D, "Invalid inds in bounding box check"); + ERROR_LOG_REPORT_ONCE(boundingboxInds, Log::G3D, "Invalid inds in bounding box check"); currentList->bboxResult = true; return; } @@ -1208,7 +1208,7 @@ void GPUCommon::Execute_BoundingBox(u32 op, u32 diff) { } AdvanceVerts(gstate.vertType, count, bytesRead); } else { - ERROR_LOG_REPORT_ONCE(boundingbox, G3D, "Bad bounding box data: %06x", count); + ERROR_LOG_REPORT_ONCE(boundingbox, Log::G3D, "Bad bounding box data: %06x", count); // Data seems invalid. Let's assume the box test passed. currentList->bboxResult = true; } @@ -1223,7 +1223,7 @@ void GPUCommon::Execute_ImmVertexAlphaPrim(u32 op, u32 diff) { if (immCount_ >= MAX_IMMBUFFER_SIZE) { // Only print once for each overrun. if (immCount_ == MAX_IMMBUFFER_SIZE) { - ERROR_LOG_REPORT_ONCE(exceed_imm_buffer, G3D, "Exceeded immediate draw buffer size. gstate.imm_ap=%06x , prim=%d", gstate.imm_ap & 0xFFFFFF, (int)immPrim_); + ERROR_LOG_REPORT_ONCE(exceed_imm_buffer, Log::G3D, "Exceeded immediate draw buffer size. gstate.imm_ap=%06x , prim=%d", gstate.imm_ap & 0xFFFFFF, (int)immPrim_); } if (immCount_ < 0x7fffffff) // Paranoia :) immCount_++; @@ -1270,7 +1270,7 @@ void GPUCommon::Execute_ImmVertexAlphaPrim(u32 op, u32 diff) { if (immCount_ == flushPrimCount[immPrim_ & 7]) FlushImm(); } else { - ERROR_LOG_REPORT_ONCE(imm_draw_prim, G3D, "Immediate draw: Unexpected primitive %d at count %d", prim, immCount_); + ERROR_LOG_REPORT_ONCE(imm_draw_prim, Log::G3D, "Immediate draw: Unexpected primitive %d at count %d", prim, immCount_); } } @@ -1307,7 +1307,7 @@ void GPUCommon::FlushImm() { bool prevDither = gstate.isDitherEnabled(); if ((immFlags_ & GE_IMM_CLIPMASK) != 0) { - WARN_LOG_REPORT_ONCE(geimmclipvalue, G3D, "Imm vertex used clip value, flags=%06x", immFlags_); + WARN_LOG_REPORT_ONCE(geimmclipvalue, Log::G3D, "Imm vertex used clip value, flags=%06x", immFlags_); } bool changed = texturing != prevTexturing || cullEnable != prevCullEnable || dither != prevDither; @@ -1341,7 +1341,7 @@ void GPUCommon::FlushImm() { void GPUCommon::Execute_Unknown(u32 op, u32 diff) { if ((op & 0xFFFFFF) != 0) - WARN_LOG_REPORT_ONCE(unknowncmd, G3D, "Unknown GE command : %08x ", op); + WARN_LOG_REPORT_ONCE(unknowncmd, Log::G3D, "Unknown GE command : %08x ", op); } void GPUCommon::FastLoadBoneMatrix(u32 target) { @@ -1666,7 +1666,7 @@ void GPUCommon::DoBlockTransfer(u32 skipDrawReason) { int bpp = gstate.getTransferBpp(); - DEBUG_LOG(G3D, "Block transfer: %08x/%x -> %08x/%x, %ix%ix%i (%i,%i)->(%i,%i)", srcBasePtr, srcStride, dstBasePtr, dstStride, width, height, bpp, srcX, srcY, dstX, dstY); + DEBUG_LOG(Log::G3D, "Block transfer: %08x/%x -> %08x/%x, %ix%ix%i (%i,%i)->(%i,%i)", srcBasePtr, srcStride, dstBasePtr, dstStride, width, height, bpp, srcX, srcY, dstX, dstY); gpuStats.numBlockTransfers++; // For VRAM, we wrap around when outside valid memory (mirrors still work.) @@ -1843,7 +1843,7 @@ void GPUCommon::DoBlockTransfer(u32 skipDrawReason) { } else { // This seems to cause the GE to require a break/reset on a PSP. // TODO: Handle that and figure out which bytes are still copied? - ERROR_LOG_REPORT_ONCE(invalidtransfer, G3D, "Block transfer invalid: %08x/%x -> %08x/%x, %ix%ix%i (%i,%i)->(%i,%i)", srcBasePtr, srcStride, dstBasePtr, dstStride, width, height, bpp, srcX, srcY, dstX, dstY); + ERROR_LOG_REPORT_ONCE(invalidtransfer, Log::G3D, "Block transfer invalid: %08x/%x -> %08x/%x, %ix%ix%i (%i,%i)->(%i,%i)", srcBasePtr, srcStride, dstBasePtr, dstStride, width, height, bpp, srcX, srcY, dstX, dstY); } if (framebufferManager_) { diff --git a/GPU/GPUCommonHW.cpp b/GPU/GPUCommonHW.cpp index 144fd8276b..8d835da5ff 100644 --- a/GPU/GPUCommonHW.cpp +++ b/GPU/GPUCommonHW.cpp @@ -367,7 +367,7 @@ GPUCommonHW::GPUCommonHW(GraphicsContext *gfxCtx, Draw::DrawContext *draw) : GPU for (size_t i = 0; i < ARRAY_SIZE(commonCommandTable); i++) { const u8 cmd = commonCommandTable[i].cmd; if (dupeCheck.find(cmd) != dupeCheck.end()) { - ERROR_LOG(G3D, "Command table Dupe: %02x (%i)", (int)cmd, (int)cmd); + ERROR_LOG(Log::G3D, "Command table Dupe: %02x (%i)", (int)cmd, (int)cmd); } else { dupeCheck.insert(cmd); } @@ -381,7 +381,7 @@ GPUCommonHW::GPUCommonHW(GraphicsContext *gfxCtx, Draw::DrawContext *draw) : GPU // Find commands missing from the table. for (int i = 0; i < 0xEF; i++) { if (dupeCheck.find((u8)i) == dupeCheck.end()) { - ERROR_LOG(G3D, "Command missing from table: %02x (%i)", i, i); + ERROR_LOG(Log::G3D, "Command missing from table: %02x (%i)", i, i); } } @@ -519,7 +519,7 @@ void GPUCommonHW::CheckFlushOp(int cmd, u32 diff) { const u8 cmdFlags = cmdInfo_[cmd].flags; if (diff && (cmdFlags & FLAG_FLUSHBEFOREONCHANGE)) { if (dumpThisFrame_) { - NOTICE_LOG(G3D, "================ FLUSH ================"); + NOTICE_LOG(Log::G3D, "================ FLUSH ================"); } drawEngineCommon_->DispatchFlush(); } @@ -916,7 +916,7 @@ void GPUCommonHW::Execute_Prim(u32 op, u32 diff) { gstate_c.framebufFormat = gstate.FrameBufFormat(); if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); + ERROR_LOG(Log::G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); return; } @@ -977,7 +977,7 @@ void GPUCommonHW::Execute_Prim(u32 op, u32 diff) { u32 indexAddr = gstate_c.indexAddr; u32 indexSize = (vertexType & GE_VTYPE_IDX_MASK) >> GE_VTYPE_IDX_SHIFT; if (!Memory::IsValidRange(indexAddr, count * indexSize)) { - ERROR_LOG(G3D, "Bad index address %08x (%d)!", indexAddr, count); + ERROR_LOG(Log::G3D, "Bad index address %08x (%d)!", indexAddr, count); return; } inds = Memory::GetPointerUnchecked(indexAddr); @@ -1263,7 +1263,7 @@ void GPUCommonHW::Execute_Bezier(u32 op, u32 diff) { CheckDepthUsage(vfb); if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); + ERROR_LOG_REPORT(Log::G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); return; } @@ -1271,14 +1271,14 @@ void GPUCommonHW::Execute_Bezier(u32 op, u32 diff) { const void *indices = NULL; if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { if (!Memory::IsValidAddress(gstate_c.indexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); + ERROR_LOG_REPORT(Log::G3D, "Bad index address %08x!", gstate_c.indexAddr); return; } indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); } if (vertTypeIsSkinningEnabled(gstate.vertType)) { - DEBUG_LOG_REPORT(G3D, "Unusual bezier/spline vtype: %08x, morph: %d, bones: %d", gstate.vertType, (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT, vertTypeGetNumBoneWeights(gstate.vertType)); + DEBUG_LOG_REPORT(Log::G3D, "Unusual bezier/spline vtype: %08x, morph: %d, bones: %d", gstate.vertType, (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT, vertTypeGetNumBoneWeights(gstate.vertType)); } // Can't flush after setting gstate_c.submitType below since it'll be a mess - it must be done already. @@ -1335,7 +1335,7 @@ void GPUCommonHW::Execute_Spline(u32 op, u32 diff) { CheckDepthUsage(vfb); if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); + ERROR_LOG_REPORT(Log::G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); return; } @@ -1343,14 +1343,14 @@ void GPUCommonHW::Execute_Spline(u32 op, u32 diff) { const void *indices = NULL; if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { if (!Memory::IsValidAddress(gstate_c.indexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); + ERROR_LOG_REPORT(Log::G3D, "Bad index address %08x!", gstate_c.indexAddr); return; } indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); } if (vertTypeIsSkinningEnabled(gstate.vertType)) { - DEBUG_LOG_REPORT(G3D, "Unusual bezier/spline vtype: %08x, morph: %d, bones: %d", gstate.vertType, (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT, vertTypeGetNumBoneWeights(gstate.vertType)); + DEBUG_LOG_REPORT(Log::G3D, "Unusual bezier/spline vtype: %08x, morph: %d, bones: %d", gstate.vertType, (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT, vertTypeGetNumBoneWeights(gstate.vertType)); } // Can't flush after setting gstate_c.submitType below since it'll be a mess - it must be done already. diff --git a/GPU/Software/DrawPixelX86.cpp b/GPU/Software/DrawPixelX86.cpp index f539d681d3..2c887f44f1 100644 --- a/GPU/Software/DrawPixelX86.cpp +++ b/GPU/Software/DrawPixelX86.cpp @@ -101,7 +101,7 @@ SingleFunc PixelJitCache::CompileSingle(const PixelFuncID &id) { regCache_.ForceRelease(RegCache::GEN_ARG_ID); if (!success) { - ERROR_LOG_REPORT(G3D, "Could not compile pixel func: %s", DescribePixelFuncID(id).c_str()); + ERROR_LOG_REPORT(Log::G3D, "Could not compile pixel func: %s", DescribePixelFuncID(id).c_str()); regCache_.Reset(false); EndWrite(); diff --git a/GPU/Software/Sampler.cpp b/GPU/Software/Sampler.cpp index 60afbd39a9..dae2c93118 100644 --- a/GPU/Software/Sampler.cpp +++ b/GPU/Software/Sampler.cpp @@ -314,7 +314,7 @@ static inline u32 LookupColor(unsigned int index, unsigned int level, const Samp return samplerID.cached.clut32[index + clutSharingOffset]; default: - ERROR_LOG_REPORT(G3D, "Software: Unsupported palette format: %x", samplerID.ClutFmt()); + ERROR_LOG_REPORT(Log::G3D, "Software: Unsupported palette format: %x", samplerID.ClutFmt()); return 0; } } @@ -434,7 +434,7 @@ inline static Nearest4 SOFTRAST_CALL SampleNearest(const int u[N], const int v[N return res; default: - ERROR_LOG_REPORT(G3D, "Software: Unsupported texture format: %x", samplerID.TexFmt()); + ERROR_LOG_REPORT(Log::G3D, "Software: Unsupported texture format: %x", samplerID.TexFmt()); memset(res.v, 0, sizeof(res.v)); return res; } diff --git a/GPU/Software/SamplerX86.cpp b/GPU/Software/SamplerX86.cpp index 290f8587f4..3b3d432210 100644 --- a/GPU/Software/SamplerX86.cpp +++ b/GPU/Software/SamplerX86.cpp @@ -80,7 +80,7 @@ FetchFunc SamplerJitCache::CompileFetch(const SamplerID &id) { regCache_.Reset(false); EndWrite(); ResetCodePtr(GetOffset(start)); - ERROR_LOG(G3D, "Failed to compile fetch %s", DescribeSamplerID(id).c_str()); + ERROR_LOG(Log::G3D, "Failed to compile fetch %s", DescribeSamplerID(id).c_str()); return nullptr; } @@ -415,7 +415,7 @@ NearestFunc SamplerJitCache::CompileNearest(const SamplerID &id) { regCache_.Reset(false); EndWrite(); ResetCodePtr(GetOffset(start)); - ERROR_LOG(G3D, "Failed to compile nearest %s", DescribeSamplerID(id).c_str()); + ERROR_LOG(Log::G3D, "Failed to compile nearest %s", DescribeSamplerID(id).c_str()); return nullptr; } @@ -486,7 +486,7 @@ LinearFunc SamplerJitCache::CompileLinear(const SamplerID &id) { regCache_.Reset(false); EndWrite(); ResetCodePtr(GetOffset(nearest)); - ERROR_LOG(G3D, "Failed to compile linear nearest %s", DescribeSamplerID(id).c_str()); + ERROR_LOG(Log::G3D, "Failed to compile linear nearest %s", DescribeSamplerID(id).c_str()); return nullptr; } @@ -878,7 +878,7 @@ LinearFunc SamplerJitCache::CompileLinear(const SamplerID &id) { regCache_.Reset(false); EndWrite(); ResetCodePtr(GetOffset(nearest ? nearest : linearResetPos)); - ERROR_LOG(G3D, "Failed to compile linear %s", DescribeSamplerID(id).c_str()); + ERROR_LOG(Log::G3D, "Failed to compile linear %s", DescribeSamplerID(id).c_str()); return nullptr; } diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index d02049d740..fbaa0093fc 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -406,7 +406,7 @@ SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *draw) for (size_t i = 0; i < ARRAY_SIZE(softgpuCommandTable); i++) { const u8 cmd = softgpuCommandTable[i].cmd; if (dupeCheck.find(cmd) != dupeCheck.end()) { - ERROR_LOG(G3D, "Command table Dupe: %02x (%i)", (int)cmd, (int)cmd); + ERROR_LOG(Log::G3D, "Command table Dupe: %02x (%i)", (int)cmd, (int)cmd); } else { dupeCheck.insert(cmd); } @@ -420,7 +420,7 @@ SoftGPU::SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *draw) // Find commands missing from the table. for (int i = 0; i < 0xEF; i++) { if (dupeCheck.find((u8)i) == dupeCheck.end()) { - ERROR_LOG(G3D, "Command missing from table: %02x (%i)", i, i); + ERROR_LOG(Log::G3D, "Command missing from table: %02x (%i)", i, i); } } @@ -524,7 +524,7 @@ void SoftGPU::ConvertTextureDescFrom16(Draw::TextureDesc &desc, int srcwidth, in break; default: - ERROR_LOG_REPORT(G3D, "Software: Unexpected framebuffer format: %d", displayFormat_); + ERROR_LOG_REPORT(Log::G3D, "Software: Unexpected framebuffer format: %d", displayFormat_); break; } } @@ -848,7 +848,7 @@ void SoftGPU::Execute_Prim(u32 op, u32 diff) { FlushImm(); if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG_REPORT(G3D, "Software: Bad vertex address %08x!", gstate_c.vertexAddr); + ERROR_LOG_REPORT(Log::G3D, "Software: Bad vertex address %08x!", gstate_c.vertexAddr); return; } @@ -856,7 +856,7 @@ void SoftGPU::Execute_Prim(u32 op, u32 diff) { const void *indices = NULL; if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { if (!Memory::IsValidAddress(gstate_c.indexAddr)) { - ERROR_LOG_REPORT(G3D, "Software: Bad index address %08x!", gstate_c.indexAddr); + ERROR_LOG_REPORT(Log::G3D, "Software: Bad index address %08x!", gstate_c.indexAddr); return; } indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); @@ -886,7 +886,7 @@ void SoftGPU::Execute_Bezier(u32 op, u32 diff) { } if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); + ERROR_LOG_REPORT(Log::G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); return; } @@ -894,14 +894,14 @@ void SoftGPU::Execute_Bezier(u32 op, u32 diff) { const void *indices = NULL; if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { if (!Memory::IsValidAddress(gstate_c.indexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); + ERROR_LOG_REPORT(Log::G3D, "Bad index address %08x!", gstate_c.indexAddr); return; } indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); } if ((gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) || vertTypeIsSkinningEnabled(gstate.vertType)) { - DEBUG_LOG_REPORT(G3D, "Unusual bezier/spline vtype: %08x, morph: %d, bones: %d", gstate.vertType, (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT, vertTypeGetNumBoneWeights(gstate.vertType)); + DEBUG_LOG_REPORT(Log::G3D, "Unusual bezier/spline vtype: %08x, morph: %d, bones: %d", gstate.vertType, (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT, vertTypeGetNumBoneWeights(gstate.vertType)); } Spline::BezierSurface surface; @@ -938,7 +938,7 @@ void SoftGPU::Execute_Spline(u32 op, u32 diff) { } if (!Memory::IsValidAddress(gstate_c.vertexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); + ERROR_LOG_REPORT(Log::G3D, "Bad vertex address %08x!", gstate_c.vertexAddr); return; } @@ -946,14 +946,14 @@ void SoftGPU::Execute_Spline(u32 op, u32 diff) { const void *indices = NULL; if ((gstate.vertType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) { if (!Memory::IsValidAddress(gstate_c.indexAddr)) { - ERROR_LOG_REPORT(G3D, "Bad index address %08x!", gstate_c.indexAddr); + ERROR_LOG_REPORT(Log::G3D, "Bad index address %08x!", gstate_c.indexAddr); return; } indices = Memory::GetPointerUnchecked(gstate_c.indexAddr); } if ((gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) || vertTypeIsSkinningEnabled(gstate.vertType)) { - DEBUG_LOG_REPORT(G3D, "Unusual bezier/spline vtype: %08x, morph: %d, bones: %d", gstate.vertType, (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT, vertTypeGetNumBoneWeights(gstate.vertType)); + DEBUG_LOG_REPORT(Log::G3D, "Unusual bezier/spline vtype: %08x, morph: %d, bones: %d", gstate.vertType, (gstate.vertType & GE_VTYPE_MORPHCOUNT_MASK) >> GE_VTYPE_MORPHCOUNT_SHIFT, vertTypeGetNumBoneWeights(gstate.vertType)); } Spline::SplineSurface surface; @@ -1007,7 +1007,7 @@ void SoftGPU::Execute_LoadClut(u32 op, u32 diff) { } } else if (clutAddr != 0) { // Some invalid addresses trigger a crash, others fill with zero. We always fill zero. - DEBUG_LOG(G3D, "Software: Invalid CLUT address, filling with garbage instead of crashing"); + DEBUG_LOG(Log::G3D, "Software: Invalid CLUT address, filling with garbage instead of crashing"); memset(clut, 0x00, clutTotalBytes); changed = true; } @@ -1236,7 +1236,7 @@ void SoftGPU::Execute_Call(u32 op, u32 diff) { const u32 target = gstate_c.getRelativeAddress(op & 0x00FFFFFC); if (!Memory::IsValidAddress(target)) { - ERROR_LOG(G3D, "CALL to illegal address %08x - ignoring! data=%06x", target, op & 0x00FFFFFF); + ERROR_LOG(Log::G3D, "CALL to illegal address %08x - ignoring! data=%06x", target, op & 0x00FFFFFF); gpuState = GPUSTATE_ERROR; downcount = 0; return; @@ -1244,7 +1244,7 @@ void SoftGPU::Execute_Call(u32 op, u32 diff) { const u32 retval = currentList->pc + 4; if (currentList->stackptr == ARRAY_SIZE(currentList->stack)) { - ERROR_LOG(G3D, "CALL: Stack full!"); + ERROR_LOG(Log::G3D, "CALL: Stack full!"); } else { auto &stackEntry = currentList->stack[currentList->stackptr++]; stackEntry.pc = retval; diff --git a/GPU/Software/TransformUnit.cpp b/GPU/Software/TransformUnit.cpp index 62c3e22ffc..eac7c21f85 100644 --- a/GPU/Software/TransformUnit.cpp +++ b/GPU/Software/TransformUnit.cpp @@ -835,7 +835,7 @@ void TransformUnit::SubmitPrimitive(const void* vertices, const void* indices, G } default: - ERROR_LOG(G3D, "Unexpected prim type: %d", prim_type); + ERROR_LOG(Log::G3D, "Unexpected prim type: %d", prim_type); break; } } @@ -950,11 +950,11 @@ bool TransformUnit::GetCurrentSimpleVertices(int count, std::vectorLoadCacheFlags(f, &drawEngine_); if (!result) { - WARN_LOG(G3D, "ShaderManagerVulkan failed to load cache header."); + WARN_LOG(Log::G3D, "ShaderManagerVulkan failed to load cache header."); } if (result) { // Reload use flags in case LoadCacheFlags() changed them. @@ -124,7 +124,7 @@ void GPU_Vulkan::LoadCache(const Path &filename) { gstate_c.SetUseFlags(CheckGPUFeatures()); result = shaderManagerVulkan_->LoadCache(f); if (!result) { - WARN_LOG(G3D, "ShaderManagerVulkan failed to load cache."); + WARN_LOG(Log::G3D, "ShaderManagerVulkan failed to load cache."); } } if (result) { @@ -134,23 +134,23 @@ void GPU_Vulkan::LoadCache(const Path &filename) { fclose(f); if (!result) { - WARN_LOG(G3D, "Incompatible Vulkan pipeline cache - rebuilding."); + WARN_LOG(Log::G3D, "Incompatible Vulkan pipeline cache - rebuilding."); // Bad cache file for this GPU/Driver/etc. Delete it. File::Delete(filename); } else { - INFO_LOG(G3D, "Loaded Vulkan pipeline cache."); + INFO_LOG(Log::G3D, "Loaded Vulkan pipeline cache."); } } void GPU_Vulkan::SaveCache(const Path &filename) { if (!g_Config.bShaderCache) { - INFO_LOG(G3D, "Shader cache disabled. Not saving."); + INFO_LOG(Log::G3D, "Shader cache disabled. Not saving."); return; } if (!draw_) { // Already got the lost message, we're in shutdown. - WARN_LOG(G3D, "Not saving shaders - shutting down from in-game."); + WARN_LOG(Log::G3D, "Not saving shaders - shutting down from in-game."); return; } @@ -160,7 +160,7 @@ void GPU_Vulkan::SaveCache(const Path &filename) { shaderManagerVulkan_->SaveCache(f, &drawEngine_); // WARNING: See comment in LoadCache if you are tempted to flip the second parameter to true. pipelineManager_->SavePipelineCache(f, false, shaderManagerVulkan_, draw_); - INFO_LOG(G3D, "Saved Vulkan pipeline cache"); + INFO_LOG(Log::G3D, "Saved Vulkan pipeline cache"); fclose(f); } @@ -265,7 +265,7 @@ u32 GPU_Vulkan::CheckGPUFeatures() const { if ((fmt4444 & Draw::FMT_TEXTURE) && (fmt565 & Draw::FMT_TEXTURE) && (fmt1555 & Draw::FMT_TEXTURE)) { features |= GPU_USE_16BIT_FORMATS; } else { - INFO_LOG(G3D, "Deficient texture format support: 4444: %d 1555: %d 565: %d", fmt4444, fmt1555, fmt565); + INFO_LOG(Log::G3D, "Deficient texture format support: 4444: %d 1555: %d 565: %d", fmt4444, fmt1555, fmt565); } } @@ -306,7 +306,7 @@ void GPU_Vulkan::BeginHostFrame() { if (gstate_c.useFlagsChanged) { // TODO: It'd be better to recompile them in the background, probably? // This most likely means that saw equal depth changed. - WARN_LOG(G3D, "Shader use flags changed, clearing all shaders and depth buffers"); + WARN_LOG(Log::G3D, "Shader use flags changed, clearing all shaders and depth buffers"); // TODO: Not all shaders need to be recompiled. In fact, quite few? Of course, depends on // the use flag change.. This is a major frame rate hitch in the start of a race in Outrun. shaderManager_->ClearShaders(); @@ -316,7 +316,7 @@ void GPU_Vulkan::BeginHostFrame() { } if (dumpNextFrame_) { - NOTICE_LOG(G3D, "DUMPING THIS FRAME"); + NOTICE_LOG(Log::G3D, "DUMPING THIS FRAME"); dumpThisFrame_ = true; dumpNextFrame_ = false; } else if (dumpThisFrame_) { @@ -388,7 +388,7 @@ void GPU_Vulkan::FinishDeferred() { } void GPU_Vulkan::InitDeviceObjects() { - INFO_LOG(G3D, "GPU_Vulkan::InitDeviceObjects"); + INFO_LOG(Log::G3D, "GPU_Vulkan::InitDeviceObjects"); uint32_t hacks = 0; if (PSP_CoreParameter().compat.flags().MGS2AcidHack) @@ -406,7 +406,7 @@ void GPU_Vulkan::InitDeviceObjects() { } void GPU_Vulkan::DestroyDeviceObjects() { - INFO_LOG(G3D, "GPU_Vulkan::DestroyDeviceObjects"); + INFO_LOG(Log::G3D, "GPU_Vulkan::DestroyDeviceObjects"); // Need to turn off hacks when shutting down the GPU. Don't want them running in the menu. if (draw_) { VulkanRenderManager *rm = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); diff --git a/GPU/Vulkan/PipelineManagerVulkan.cpp b/GPU/Vulkan/PipelineManagerVulkan.cpp index 86f6e51f1a..dce7a5fb2b 100644 --- a/GPU/Vulkan/PipelineManagerVulkan.cpp +++ b/GPU/Vulkan/PipelineManagerVulkan.cpp @@ -48,7 +48,7 @@ void PipelineManagerVulkan::Clear() { pipelines_.Iterate([&](const VulkanPipelineKey &key, VulkanPipeline *value) { if (!value->pipeline) { // Something went wrong. - ERROR_LOG(G3D, "Null pipeline found in PipelineManagerVulkan::Clear - didn't wait for asyncs?"); + ERROR_LOG(Log::G3D, "Null pipeline found in PipelineManagerVulkan::Clear - didn't wait for asyncs?"); } else { value->pipeline->QueueForDeletion(vulkan_); } @@ -192,15 +192,15 @@ static VulkanPipeline *CreateVulkanPipeline(VulkanRenderManager *renderManager, _assert_(fs && vs); if (!fs || !fs->GetModule()) { - ERROR_LOG(G3D, "Fragment shader missing in CreateVulkanPipeline"); + ERROR_LOG(Log::G3D, "Fragment shader missing in CreateVulkanPipeline"); return nullptr; } if (!vs || !vs->GetModule()) { - ERROR_LOG(G3D, "Vertex shader missing in CreateVulkanPipeline"); + ERROR_LOG(Log::G3D, "Vertex shader missing in CreateVulkanPipeline"); return nullptr; } if (gs && !gs->GetModule()) { - ERROR_LOG(G3D, "Geometry shader missing in CreateVulkanPipeline"); + ERROR_LOG(Log::G3D, "Geometry shader missing in CreateVulkanPipeline"); return nullptr; } @@ -650,7 +650,7 @@ void PipelineManagerVulkan::SavePipelineCache(FILE *file, bool saveRawPipelineCa size = (uint32_t)dataSize; fwrite(&size, sizeof(size), 1, file); fwrite(buffer.get(), 1, size, file); - NOTICE_LOG(G3D, "Saved Vulkan pipeline cache (%d bytes).", (int)size); + NOTICE_LOG(Log::G3D, "Saved Vulkan pipeline cache (%d bytes).", (int)size); } size_t seekPosOnFailure = ftell(file); @@ -702,20 +702,20 @@ void PipelineManagerVulkan::SavePipelineCache(FILE *file, bool saveRawPipelineCa } if (failed) { - ERROR_LOG(G3D, "Failed to write pipeline cache, some shader was missing"); + ERROR_LOG(Log::G3D, "Failed to write pipeline cache, some shader was missing"); // Write a zero in the right place so it doesn't try to load the pipelines next time. size = 0; fseek(file, (long)seekPosOnFailure, SEEK_SET); writeFailed = fwrite(&size, sizeof(size), 1, file) != 1; if (writeFailed) { - ERROR_LOG(G3D, "Failed to write pipeline cache, disk full?"); + ERROR_LOG(Log::G3D, "Failed to write pipeline cache, disk full?"); } return; } if (writeFailed) { - ERROR_LOG(G3D, "Failed to write pipeline cache, disk full?"); + ERROR_LOG(Log::G3D, "Failed to write pipeline cache, disk full?"); } else { - NOTICE_LOG(G3D, "Saved Vulkan pipeline ID cache (%d unique pipelines/%d).", (int)keys.size(), (int)pipelines_.size()); + NOTICE_LOG(Log::G3D, "Saved Vulkan pipeline ID cache (%d unique pipelines/%d).", (int)keys.size(), (int)pipelines_.size()); } } @@ -725,11 +725,11 @@ bool PipelineManagerVulkan::LoadPipelineCache(FILE *file, bool loadRawPipelineCa uint32_t size = 0; if (loadRawPipelineCache) { - NOTICE_LOG(G3D, "WARNING: Using the badly tested raw pipeline cache path!!!!"); + NOTICE_LOG(Log::G3D, "WARNING: Using the badly tested raw pipeline cache path!!!!"); // WARNING: Do not use this path until after reading and implementing https://zeux.io/2019/07/17/serializing-pipeline-cache/ ! bool success = fread(&size, sizeof(size), 1, file) == 1; if (!size || !success) { - WARN_LOG(G3D, "Zero-sized Vulkan pipeline cache."); + WARN_LOG(Log::G3D, "Zero-sized Vulkan pipeline cache."); return true; } auto buffer = std::make_unique(size); @@ -738,12 +738,12 @@ bool PipelineManagerVulkan::LoadPipelineCache(FILE *file, bool loadRawPipelineCa VkPipelineCacheHeader *header = (VkPipelineCacheHeader *)buffer.get(); if (!success || header->version != VK_PIPELINE_CACHE_HEADER_VERSION_ONE) { // Bad header, don't do anything. - WARN_LOG(G3D, "Bad Vulkan pipeline cache header - ignoring"); + WARN_LOG(Log::G3D, "Bad Vulkan pipeline cache header - ignoring"); return false; } if (0 != memcmp(header->uuid, vulkan_->GetPhysicalDeviceProperties().properties.pipelineCacheUUID, VK_UUID_SIZE)) { // Wrong hardware/driver/etc. - WARN_LOG(G3D, "Bad Vulkan pipeline cache UUID - ignoring"); + WARN_LOG(Log::G3D, "Bad Vulkan pipeline cache UUID - ignoring"); return false; } @@ -761,14 +761,14 @@ bool PipelineManagerVulkan::LoadPipelineCache(FILE *file, bool loadRawPipelineCa } else { vkMergePipelineCaches(vulkan_->GetDevice(), pipelineCache_, 1, &cache); } - NOTICE_LOG(G3D, "Loaded Vulkan binary pipeline cache (%d bytes).", (int)size); + NOTICE_LOG(Log::G3D, "Loaded Vulkan binary pipeline cache (%d bytes).", (int)size); // Note that after loading the cache, it's still a good idea to pre-create the various pipelines. } else { if (!pipelineCache_) { VkPipelineCacheCreateInfo pc{ VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO }; VkResult res = vkCreatePipelineCache(vulkan_->GetDevice(), &pc, nullptr, &pipelineCache_); if (res != VK_SUCCESS) { - WARN_LOG(G3D, "vkCreatePipelineCache failed (%08x), highly unexpected", (u32)res); + WARN_LOG(Log::G3D, "vkCreatePipelineCache failed (%08x), highly unexpected", (u32)res); return false; } } @@ -777,7 +777,7 @@ bool PipelineManagerVulkan::LoadPipelineCache(FILE *file, bool loadRawPipelineCa // Read the number of pipelines. bool failed = fread(&size, sizeof(size), 1, file) != 1; - NOTICE_LOG(G3D, "Creating %d pipelines from cache (%dx MSAA)...", size, (1 << multiSampleLevel)); + NOTICE_LOG(Log::G3D, "Creating %d pipelines from cache (%dx MSAA)...", size, (1 << multiSampleLevel)); int pipelineCreateFailCount = 0; int shaderFailCount = 0; for (uint32_t i = 0; i < size; i++) { @@ -787,12 +787,12 @@ bool PipelineManagerVulkan::LoadPipelineCache(FILE *file, bool loadRawPipelineCa StoredVulkanPipelineKey key; failed = failed || fread(&key, sizeof(key), 1, file) != 1; if (failed) { - ERROR_LOG(G3D, "Truncated Vulkan pipeline cache file, stopping."); + ERROR_LOG(Log::G3D, "Truncated Vulkan pipeline cache file, stopping."); break; } if (key.raster.topology == VK_PRIMITIVE_TOPOLOGY_POINT_LIST || key.raster.topology == VK_PRIMITIVE_TOPOLOGY_LINE_LIST) { - WARN_LOG(G3D, "Bad raster key in cache, ignoring"); + WARN_LOG(Log::G3D, "Bad raster key in cache, ignoring"); continue; } @@ -802,7 +802,7 @@ bool PipelineManagerVulkan::LoadPipelineCache(FILE *file, bool loadRawPipelineCa if (!vs || !fs || (!gs && key.gShaderID.Bit(GS_BIT_ENABLED))) { // We just ignore this one, it'll get created later if needed. // Probably some useFlags mismatch. - WARN_LOG(G3D, "Failed to find vs or fs in pipeline %d in cache, skipping pipeline", (int)i); + WARN_LOG(Log::G3D, "Failed to find vs or fs in pipeline %d in cache, skipping pipeline", (int)i); continue; } @@ -828,7 +828,7 @@ bool PipelineManagerVulkan::LoadPipelineCache(FILE *file, bool loadRawPipelineCa rm->NudgeCompilerThread(); - NOTICE_LOG(G3D, "Recreated Vulkan pipeline cache (%d pipelines, %d failed).", (int)size, pipelineCreateFailCount); + NOTICE_LOG(Log::G3D, "Recreated Vulkan pipeline cache (%d pipelines, %d failed).", (int)size, pipelineCreateFailCount); // We just ignore any failures. return true; } diff --git a/GPU/Vulkan/ShaderManagerVulkan.cpp b/GPU/Vulkan/ShaderManagerVulkan.cpp index 1068e94f98..10a8371768 100644 --- a/GPU/Vulkan/ShaderManagerVulkan.cpp +++ b/GPU/Vulkan/ShaderManagerVulkan.cpp @@ -59,13 +59,13 @@ static Promise *CompileShaderModuleAsync(VulkanContext *vulkan, if (!errorMessage.empty()) { if (success) { - ERROR_LOG(G3D, "Warnings in shader compilation!"); + ERROR_LOG(Log::G3D, "Warnings in shader compilation!"); } else { - ERROR_LOG(G3D, "Error in shader compilation!"); + ERROR_LOG(Log::G3D, "Error in shader compilation!"); } std::string numberedSource = LineNumberString(code); - ERROR_LOG(G3D, "Messages: %s", errorMessage.c_str()); - ERROR_LOG(G3D, "Shader source:\n%s", numberedSource.c_str()); + ERROR_LOG(Log::G3D, "Messages: %s", errorMessage.c_str()); + ERROR_LOG(Log::G3D, "Shader source:\n%s", numberedSource.c_str()); #if PPSSPP_PLATFORM(WINDOWS) OutputDebugStringA("Error messages:\n"); OutputDebugStringA(errorMessage.c_str()); @@ -116,7 +116,7 @@ VulkanFragmentShader::VulkanFragmentShader(VulkanContext *vulkan, FShaderID id, _assert_(!id.is_invalid()); source_ = code; module_ = CompileShaderModuleAsync(vulkan, VK_SHADER_STAGE_FRAGMENT_BIT, source_.c_str(), new std::string(FragmentShaderDesc(id))); - VERBOSE_LOG(G3D, "Compiled fragment shader:\n%s\n", (const char *)code); + VERBOSE_LOG(Log::G3D, "Compiled fragment shader:\n%s\n", (const char *)code); } VulkanFragmentShader::~VulkanFragmentShader() { @@ -148,7 +148,7 @@ VulkanVertexShader::VulkanVertexShader(VulkanContext *vulkan, VShaderID id, Vert _assert_(!id.is_invalid()); source_ = code; module_ = CompileShaderModuleAsync(vulkan, VK_SHADER_STAGE_VERTEX_BIT, source_.c_str(), new std::string(VertexShaderDesc(id))); - VERBOSE_LOG(G3D, "Compiled vertex shader:\n%s\n", (const char *)code); + VERBOSE_LOG(Log::G3D, "Compiled vertex shader:\n%s\n", (const char *)code); } VulkanVertexShader::~VulkanVertexShader() { @@ -180,7 +180,7 @@ VulkanGeometryShader::VulkanGeometryShader(VulkanContext *vulkan, GShaderID id, _assert_(!id.is_invalid()); source_ = code; module_ = CompileShaderModuleAsync(vulkan, VK_SHADER_STAGE_GEOMETRY_BIT, source_.c_str(), new std::string(GeometryShaderDesc(id).c_str())); - VERBOSE_LOG(G3D, "Compiled geometry shader:\n%s\n", (const char *)code); + VERBOSE_LOG(Log::G3D, "Compiled geometry shader:\n%s\n", (const char *)code); } VulkanGeometryShader::~VulkanGeometryShader() { @@ -520,11 +520,11 @@ bool ShaderManagerVulkan::LoadCacheFlags(FILE *f, DrawEngineVulkan *drawEngine) // We'll read it again later, this is just to check the flags. success = success && fseek(f, pos, SEEK_SET) == 0; if (!success || header.magic != CACHE_HEADER_MAGIC) { - WARN_LOG(G3D, "Shader cache magic mismatch"); + WARN_LOG(Log::G3D, "Shader cache magic mismatch"); return false; } if (header.version != CACHE_VERSION) { - WARN_LOG(G3D, "Shader cache version mismatch, %d, expected %d", header.version, CACHE_VERSION); + WARN_LOG(Log::G3D, "Shader cache version mismatch, %d, expected %d", header.version, CACHE_VERSION); return false; } @@ -543,7 +543,7 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) { if (header.useFlags != gstate_c.GetUseFlags()) { // This can simply be a result of sawExactEqualDepth_ having been flipped to true in the previous run. // Let's just keep going. - WARN_LOG(G3D, "Shader cache useFlags mismatch, %08x, expected %08x", header.useFlags, gstate_c.GetUseFlags()); + WARN_LOG(Log::G3D, "Shader cache useFlags mismatch, %08x, expected %08x", header.useFlags, gstate_c.GetUseFlags()); } else { // We're compiling shaders now, so they haven't changed anymore. gstate_c.useFlagsChanged = false; @@ -555,7 +555,7 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) { for (int i = 0; i < header.numVertexShaders; i++) { VShaderID id; if (fread(&id, sizeof(id), 1, f) != 1) { - ERROR_LOG(G3D, "Vulkan shader cache truncated (in VertexShaders)"); + ERROR_LOG(Log::G3D, "Vulkan shader cache truncated (in VertexShaders)"); return false; } bool useHWTransform = id.Bit(VS_BIT_USE_HW_TRANSFORM); @@ -564,7 +564,7 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) { uint64_t uniformMask = 0; VertexShaderFlags flags; if (!GenerateVertexShader(id, codeBuffer_, compat_, draw_->GetBugs(), &attributeMask, &uniformMask, &flags, &genErrorString)) { - ERROR_LOG(G3D, "Failed to generate vertex shader during cache load"); + ERROR_LOG(Log::G3D, "Failed to generate vertex shader during cache load"); // We just ignore this one and carry on. failCount++; continue; @@ -581,14 +581,14 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) { for (int i = 0; i < header.numFragmentShaders; i++) { FShaderID id; if (fread(&id, sizeof(id), 1, f) != 1) { - ERROR_LOG(G3D, "Vulkan shader cache truncated (in FragmentShaders)"); + ERROR_LOG(Log::G3D, "Vulkan shader cache truncated (in FragmentShaders)"); return false; } std::string genErrorString; uint64_t uniformMask = 0; FragmentShaderFlags flags; if (!GenerateFragmentShader(id, codeBuffer_, compat_, draw_->GetBugs(), &uniformMask, &flags, &genErrorString)) { - ERROR_LOG(G3D, "Failed to generate fragment shader during cache load"); + ERROR_LOG(Log::G3D, "Failed to generate fragment shader during cache load"); // We just ignore this one and carry on. failCount++; continue; @@ -605,12 +605,12 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) { for (int i = 0; i < header.numGeometryShaders; i++) { GShaderID id; if (fread(&id, sizeof(id), 1, f) != 1) { - ERROR_LOG(G3D, "Vulkan shader cache truncated (in GeometryShaders)"); + ERROR_LOG(Log::G3D, "Vulkan shader cache truncated (in GeometryShaders)"); return false; } std::string genErrorString; if (!GenerateGeometryShader(id, codeBuffer_, compat_, draw_->GetBugs(), &genErrorString)) { - ERROR_LOG(G3D, "Failed to generate geometry shader during cache load"); + ERROR_LOG(Log::G3D, "Failed to generate geometry shader during cache load"); // We just ignore this one and carry on. failCount++; continue; @@ -623,7 +623,7 @@ bool ShaderManagerVulkan::LoadCache(FILE *f) { } } - NOTICE_LOG(G3D, "ShaderCache: Loaded %d vertex, %d fragment shaders and %d geometry shaders (failed %d)", header.numVertexShaders, header.numFragmentShaders, header.numGeometryShaders, failCount); + NOTICE_LOG(Log::G3D, "ShaderCache: Loaded %d vertex, %d fragment shaders and %d geometry shaders (failed %d)", header.numVertexShaders, header.numFragmentShaders, header.numGeometryShaders, failCount); return true; } @@ -649,8 +649,8 @@ void ShaderManagerVulkan::SaveCache(FILE *f, DrawEngineVulkan *drawEngine) { writeFailed = writeFailed || fwrite(&id, sizeof(id), 1, f) != 1; }); if (writeFailed) { - ERROR_LOG(G3D, "Failed to write Vulkan shader cache, disk full?"); + ERROR_LOG(Log::G3D, "Failed to write Vulkan shader cache, disk full?"); } else { - NOTICE_LOG(G3D, "Saved %d vertex and %d fragment shaders", header.numVertexShaders, header.numFragmentShaders); + NOTICE_LOG(Log::G3D, "Saved %d vertex and %d fragment shaders", header.numVertexShaders, header.numFragmentShaders); } } diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index d12b3267fc..a38a18fc11 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -486,7 +486,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { if (uploadCS_ != VK_NULL_HANDLE) { computeUpload = true; } else { - WARN_LOG(G3D, "Falling back to software scaling, hardware shader didn't compile"); + WARN_LOG(Log::G3D, "Falling back to software scaling, hardware shader didn't compile"); } } @@ -496,7 +496,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { } if (plan.saveTexture) { - INFO_LOG(G3D, "About to save texture"); + INFO_LOG(Log::G3D, "About to save texture"); actualFmt = VULKAN_8888_FORMAT; } @@ -517,7 +517,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { bool allocSuccess = image->CreateDirect(plan.createW, plan.createH, plan.depth, plan.levelsToCreate, actualFmt, imageLayout, usage, &barrier, mapping); barrier.Flush(cmdInit); if (!allocSuccess && !lowMemoryMode_) { - WARN_LOG_REPORT(G3D, "Texture cache ran out of GPU memory; switching to low memory mode"); + WARN_LOG_REPORT(Log::G3D, "Texture cache ran out of GPU memory; switching to low memory mode"); lowMemoryMode_ = true; decimationCounter_ = 0; Decimate(entry, true); @@ -545,7 +545,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { } if (!allocSuccess) { - ERROR_LOG(G3D, "Failed to create texture (%dx%d)", plan.w, plan.h); + ERROR_LOG(Log::G3D, "Failed to create texture (%dx%d)", plan.w, plan.h); delete entry->vkTex; entry->vkTex = nullptr; } @@ -617,7 +617,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { data = pushBuffer->Allocate(uploadSize, pushAlignment, &texBuf, &bufferOffset); double replaceStart = time_now_d(); if (!plan.replaced->CopyLevelTo(plan.baseLevelSrc + i, (uint8_t *)data, uploadSize, byteStride)) { // If plan.doReplace, this shouldn't fail. - WARN_LOG(G3D, "Failed to copy replaced texture level"); + WARN_LOG(Log::G3D, "Failed to copy replaced texture level"); // TODO: Fill with some pattern? } replacementTimeThisFrame_ += time_now_d() - replaceStart; @@ -652,7 +652,7 @@ void TextureCacheVulkan::BuildTexture(TexCacheEntry *const entry) { } // Format might be wrong in lowMemoryMode_, so don't save. if (plan.saveTexture && !lowMemoryMode_) { - INFO_LOG(G3D, "Calling NotifyTextureDecoded %08x", entry->addr); + INFO_LOG(Log::G3D, "Calling NotifyTextureDecoded %08x", entry->addr); // When hardware texture scaling is enabled, this saves the original. int w = dataScaled ? mipWidth : mipUnscaledWidth; diff --git a/GPU/Vulkan/VulkanUtil.cpp b/GPU/Vulkan/VulkanUtil.cpp index 0309c35c20..dcde43d286 100644 --- a/GPU/Vulkan/VulkanUtil.cpp +++ b/GPU/Vulkan/VulkanUtil.cpp @@ -32,12 +32,12 @@ VkShaderModule CompileShaderModule(VulkanContext *vulkan, VkShaderStageFlagBits bool success = GLSLtoSPV(stage, code, GLSLVariant::VULKAN, spirv, error); if (!error->empty()) { if (success) { - ERROR_LOG(G3D, "Warnings in shader compilation!"); + ERROR_LOG(Log::G3D, "Warnings in shader compilation!"); } else { - ERROR_LOG(G3D, "Error in shader compilation!"); + ERROR_LOG(Log::G3D, "Error in shader compilation!"); } - ERROR_LOG(G3D, "Messages: %s", error->c_str()); - ERROR_LOG(G3D, "Shader source:\n%s", LineNumberString(code).c_str()); + ERROR_LOG(Log::G3D, "Messages: %s", error->c_str()); + ERROR_LOG(Log::G3D, "Shader source:\n%s", LineNumberString(code).c_str()); OutputDebugStringUTF8("Messages:\n"); OutputDebugStringUTF8(error->c_str()); OutputDebugStringUTF8(LineNumberString(code).c_str()); diff --git a/Qt/QtMain.cpp b/Qt/QtMain.cpp index c9b3251970..caaaf9f31c 100644 --- a/Qt/QtMain.cpp +++ b/Qt/QtMain.cpp @@ -53,7 +53,7 @@ #include #include -// Audio +// AUDIO #define AUDIO_FREQ 44100 #define AUDIO_CHANNELS 2 #define AUDIO_SAMPLES 2048 @@ -92,23 +92,23 @@ static void InitSDLAudioDevice() { if (!g_Config.sAudioDevice.empty()) { audioDev = SDL_OpenAudioDevice(g_Config.sAudioDevice.c_str(), 0, &fmt, &g_retFmt, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE); if (audioDev <= 0) { - WARN_LOG(AUDIO, "Failed to open preferred audio device %s", g_Config.sAudioDevice.c_str()); + WARN_LOG(Log::Audio, "Failed to open preferred audio device %s", g_Config.sAudioDevice.c_str()); } } if (audioDev <= 0) { audioDev = SDL_OpenAudioDevice(nullptr, 0, &fmt, &g_retFmt, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE); } if (audioDev <= 0) { - ERROR_LOG(AUDIO, "Failed to open audio: %s", SDL_GetError()); + ERROR_LOG(Log::Audio, "Failed to open audio: %s", SDL_GetError()); } else { if (g_retFmt.samples != fmt.samples) // Notify, but still use it - ERROR_LOG(AUDIO, "Output audio samples: %d (requested: %d)", g_retFmt.samples, fmt.samples); + ERROR_LOG(Log::Audio, "Output audio samples: %d (requested: %d)", g_retFmt.samples, fmt.samples); if (g_retFmt.format != fmt.format || g_retFmt.channels != fmt.channels) { - ERROR_LOG(AUDIO, "Sound buffer format does not match requested format."); - ERROR_LOG(AUDIO, "Output audio freq: %d (requested: %d)", g_retFmt.freq, fmt.freq); - ERROR_LOG(AUDIO, "Output audio format: %d (requested: %d)", g_retFmt.format, fmt.format); - ERROR_LOG(AUDIO, "Output audio channels: %d (requested: %d)", g_retFmt.channels, fmt.channels); - ERROR_LOG(AUDIO, "Provided output format does not match requirement, turning audio off"); + ERROR_LOG(Log::Audio, "Sound buffer format does not match requested format."); + ERROR_LOG(Log::Audio, "Output audio freq: %d (requested: %d)", g_retFmt.freq, fmt.freq); + ERROR_LOG(Log::Audio, "Output audio format: %d (requested: %d)", g_retFmt.format, fmt.format); + ERROR_LOG(Log::Audio, "Output audio channels: %d (requested: %d)", g_retFmt.channels, fmt.channels); + ERROR_LOG(Log::Audio, "Provided output format does not match requirement, turning audio off"); SDL_CloseAudioDevice(audioDev); } SDL_PauseAudioDevice(audioDev, 0); @@ -517,9 +517,9 @@ MainUI::MainUI(QWidget *parent) } MainUI::~MainUI() { - INFO_LOG(SYSTEM, "MainUI::Destructor"); + INFO_LOG(Log::System, "MainUI::Destructor"); if (emuThreadState != (int)EmuThreadState::DISABLED) { - INFO_LOG(SYSTEM, "EmuThreadStop"); + INFO_LOG(Log::System, "EmuThreadStop"); EmuThreadStop(); while (graphicsContext->ThreadFrame()) { // Need to keep eating frames to allow the EmuThread to exit correctly. @@ -684,7 +684,7 @@ bool MainUI::event(QEvent *e) { void MainUI::initializeGL() { if (g_Config.iGPUBackend != (int)GPUBackend::OPENGL) { - INFO_LOG(SYSTEM, "Only GL supported under Qt - switching."); + INFO_LOG(Log::System, "Only GL supported under Qt - switching."); g_Config.iGPUBackend = (int)GPUBackend::OPENGL; } @@ -706,12 +706,12 @@ void MainUI::initializeGL() { #endif if (g_Config.iGPUBackend == (int)GPUBackend::OPENGL) { // OpenGL uses a background thread to do the main processing and only renders on the gl thread. - INFO_LOG(SYSTEM, "Initializing GL graphics context"); + INFO_LOG(Log::System, "Initializing GL graphics context"); graphicsContext = new QtGLGraphicsContext(); - INFO_LOG(SYSTEM, "Using thread, starting emu thread"); + INFO_LOG(Log::System, "Using thread, starting emu thread"); EmuThreadStart(); } else { - INFO_LOG(SYSTEM, "Not using thread, backend=%d", (int)g_Config.iGPUBackend); + INFO_LOG(Log::System, "Not using thread, backend=%d", (int)g_Config.iGPUBackend); } graphicsContext->ThreadStart(); } @@ -864,7 +864,7 @@ int main(int argc, char *argv[]) g_Config.iGPUBackend = (int)GPUBackend::OPENGL; int ret = mainInternal(a); - INFO_LOG(SYSTEM, "Left mainInternal here."); + INFO_LOG(Log::System, "Left mainInternal here."); #ifdef SDL if (audioDev > 0) { diff --git a/Qt/QtMain.h b/Qt/QtMain.h index 16bcc6d62d..af077c04bd 100644 --- a/Qt/QtMain.h +++ b/Qt/QtMain.h @@ -166,7 +166,7 @@ extern MainUI* emugl; #ifndef SDL -// Audio +// AUDIO class MainAudio : public QObject { Q_OBJECT public: diff --git a/SDL/SDLGLGraphicsContext.cpp b/SDL/SDLGLGraphicsContext.cpp index 7c05a1ad93..66d515b1c8 100644 --- a/SDL/SDLGLGraphicsContext.cpp +++ b/SDL/SDLGLGraphicsContext.cpp @@ -432,7 +432,7 @@ int SDLGLGraphicsContext::Init(SDL_Window *&window, int x, int y, int w, int h, }); renderManager_->SetSwapIntervalFunction([&](int interval) { - INFO_LOG(G3D, "SDL SwapInterval: %d", interval); + INFO_LOG(Log::G3D, "SDL SwapInterval: %d", interval); SDL_GL_SetSwapInterval(interval); }); window_ = window; diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index 014de198ea..b8a19e2b46 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -152,24 +152,24 @@ static void InitSDLAudioDevice(const std::string &name = "") { if (!startDevice.empty()) { audioDev = SDL_OpenAudioDevice(startDevice.c_str(), 0, &fmt, &g_retFmt, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE); if (audioDev <= 0) { - WARN_LOG(AUDIO, "Failed to open audio device: %s", startDevice.c_str()); + WARN_LOG(Log::Audio, "Failed to open audio device: %s", startDevice.c_str()); } } if (audioDev <= 0) { - INFO_LOG(AUDIO, "SDL: Trying a different audio device"); + INFO_LOG(Log::Audio, "SDL: Trying a different audio device"); audioDev = SDL_OpenAudioDevice(nullptr, 0, &fmt, &g_retFmt, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE); } if (audioDev <= 0) { - ERROR_LOG(AUDIO, "Failed to open audio device: %s", SDL_GetError()); + ERROR_LOG(Log::Audio, "Failed to open audio device: %s", SDL_GetError()); } else { if (g_retFmt.samples != fmt.samples) // Notify, but still use it - ERROR_LOG(AUDIO, "Output audio samples: %d (requested: %d)", g_retFmt.samples, fmt.samples); + ERROR_LOG(Log::Audio, "Output audio samples: %d (requested: %d)", g_retFmt.samples, fmt.samples); if (g_retFmt.format != fmt.format || g_retFmt.channels != fmt.channels) { - ERROR_LOG(AUDIO, "Sound buffer format does not match requested format."); - ERROR_LOG(AUDIO, "Output audio freq: %d (requested: %d)", g_retFmt.freq, fmt.freq); - ERROR_LOG(AUDIO, "Output audio format: %d (requested: %d)", g_retFmt.format, fmt.format); - ERROR_LOG(AUDIO, "Output audio channels: %d (requested: %d)", g_retFmt.channels, fmt.channels); - ERROR_LOG(AUDIO, "Provided output format does not match requirement, turning audio off"); + ERROR_LOG(Log::Audio, "Sound buffer format does not match requested format."); + ERROR_LOG(Log::Audio, "Output audio freq: %d (requested: %d)", g_retFmt.freq, fmt.freq); + ERROR_LOG(Log::Audio, "Output audio format: %d (requested: %d)", g_retFmt.format, fmt.format); + ERROR_LOG(Log::Audio, "Output audio channels: %d (requested: %d)", g_retFmt.channels, fmt.channels); + ERROR_LOG(Log::Audio, "Provided output format does not match requirement, turning audio off"); SDL_CloseAudioDevice(audioDev); } SDL_PauseAudioDevice(audioDev, 0); @@ -365,7 +365,7 @@ void System_LaunchUrl(LaunchUrlType urlType, const char *url) { webWifiCreate(&conf, NULL, url, uuid, 0); webWifiShow(&conf, NULL); #elif defined(MOBILE_DEVICE) - INFO_LOG(SYSTEM, "Would have gone to %s but LaunchBrowser is not implemented on this platform", url); + INFO_LOG(Log::System, "Would have gone to %s but LaunchBrowser is not implemented on this platform", url); #elif defined(_WIN32) std::wstring wurl = ConvertUTF8ToWString(url); ShellExecute(NULL, L"open", wurl.c_str(), NULL, NULL, SW_SHOWNORMAL); @@ -375,7 +375,7 @@ void System_LaunchUrl(LaunchUrlType urlType, const char *url) { std::string command = std::string("xdg-open ") + url; int err = system(command.c_str()); if (err) { - INFO_LOG(SYSTEM, "Would have gone to %s but xdg-utils seems not to be installed", url); + INFO_LOG(Log::System, "Would have gone to %s but xdg-utils seems not to be installed", url); } #endif break; @@ -383,7 +383,7 @@ void System_LaunchUrl(LaunchUrlType urlType, const char *url) { case LaunchUrlType::EMAIL_ADDRESS: { #if defined(MOBILE_DEVICE) - INFO_LOG(SYSTEM, "Would have opened your email client for %s but LaunchEmail is not implemented on this platform", url); + INFO_LOG(Log::System, "Would have opened your email client for %s but LaunchEmail is not implemented on this platform", url); #elif defined(_WIN32) std::wstring mailto = std::wstring(L"mailto:") + ConvertUTF8ToWString(url); ShellExecute(NULL, L"open", mailto.c_str(), NULL, NULL, SW_SHOWNORMAL); @@ -394,7 +394,7 @@ void System_LaunchUrl(LaunchUrlType urlType, const char *url) { std::string command = std::string("xdg-email ") + url; int err = system(command.c_str()); if (err) { - INFO_LOG(SYSTEM, "Would have gone to %s but xdg-utils seems not to be installed", url); + INFO_LOG(Log::System, "Would have gone to %s but xdg-utils seems not to be installed", url); } #endif break; @@ -1478,7 +1478,7 @@ int main(int argc, char *argv[]) { EmuThreadStop("shutdown"); // Skipping GL calls, the old context is gone. while (graphicsContext->ThreadFrame()) { - INFO_LOG(SYSTEM, "graphicsContext->ThreadFrame executed to clear buffers"); + INFO_LOG(Log::System, "graphicsContext->ThreadFrame executed to clear buffers"); } EmuThreadJoin(); graphicsContext->ThreadEnd(); diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index 100c79d66d..7aa1ed8f5e 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -73,7 +73,7 @@ bool WavData::Read(RIFFReader &file_) { codec = 0; break; default: - ERROR_LOG(SCEAUDIO, "Unexpected wave format %04x", format); + ERROR_LOG(Log::sceAudio, "Unexpected wave format %04x", format); return false; } @@ -95,9 +95,9 @@ bool WavData::Read(RIFFReader &file_) { } } file_.Ascend(); - // INFO_LOG(AUDIO, "got fmt data: %i", samplesPerSec); + // INFO_LOG(Log::AUDIO, "got fmt data: %i", samplesPerSec); } else { - ERROR_LOG(AUDIO, "Error - no format chunk in wav"); + ERROR_LOG(Log::Audio, "Error - no format chunk in wav"); file_.Ascend(); return false; } @@ -156,20 +156,20 @@ bool WavData::Read(RIFFReader &file_) { if (num_channels == 1 || num_channels == 2) { file_.ReadData(raw_data, numBytes); } else { - ERROR_LOG(AUDIO, "Error - bad blockalign or channels"); + ERROR_LOG(Log::Audio, "Error - bad blockalign or channels"); free(raw_data); raw_data = nullptr; return false; } file_.Ascend(); } else { - ERROR_LOG(AUDIO, "Error - no data chunk in wav"); + ERROR_LOG(Log::Audio, "Error - no data chunk in wav"); file_.Ascend(); return false; } file_.Ascend(); } else { - ERROR_LOG(AUDIO, "Could not descend into RIFF file."); + ERROR_LOG(Log::Audio, "Could not descend into RIFF file."); return false; } sample_rate = samplesPerSec; @@ -200,7 +200,7 @@ public: blockSize = wave_.raw_bytes_per_frame; } decoder_ = CreateAudioDecoder((PSPAudioType)wave_.codec, wave_.sample_rate, wave_.num_channels, blockSize, extraData, extraDataSize); - INFO_LOG(AUDIO, "read ATRAC, frames: %d, rate %d", wave_.numFrames, wave_.sample_rate); + INFO_LOG(Log::Audio, "read ATRAC, frames: %d, rate %d", wave_.numFrames, wave_.sample_rate); } ~AT3PlusReader() { @@ -395,7 +395,7 @@ Sample *Sample::Load(const std::string &path) { size_t data_size = 0; uint8_t *data = g_VFS.ReadFile(path.c_str(), &data_size); if (!data || data_size > 100000000) { - WARN_LOG(AUDIO, "Failed to load sample '%s'", path.c_str()); + WARN_LOG(Log::Audio, "Failed to load sample '%s'", path.c_str()); return nullptr; } @@ -412,7 +412,7 @@ Sample *Sample::Load(const std::string &path) { delete[] data; if (!wave.IsSimpleWAV()) { - ERROR_LOG(AUDIO, "Wave format not supported for mixer playback. Must be 8-bit or 16-bit raw mono or stereo. '%s'", path.c_str()); + ERROR_LOG(Log::Audio, "Wave format not supported for mixer playback. Must be 8-bit or 16-bit raw mono or stereo. '%s'", path.c_str()); return nullptr; } @@ -548,7 +548,7 @@ void SoundEffectMixer::LoadDefaultSample(UI::UISound sound) { } Sample *sample = Sample::Load(filename); if (!sample) { - ERROR_LOG(SYSTEM, "Failed to load the default sample for UI sound %d", (int)sound); + ERROR_LOG(Log::System, "Failed to load the default sample for UI sound %d", (int)sound); } std::lock_guard guard(mutex_); samples_[(size_t)sound] = std::unique_ptr(sample); diff --git a/UI/CwCheatScreen.cpp b/UI/CwCheatScreen.cpp index d6d7c1421c..a97fbf9ff0 100644 --- a/UI/CwCheatScreen.cpp +++ b/UI/CwCheatScreen.cpp @@ -217,7 +217,7 @@ static char *GetLineNoNewline(char *temp, int sz, FILE *fp) { UI::EventReturn CwCheatScreen::OnImportBrowse(UI::EventParams ¶ms) { System_BrowseForFile(GetRequesterToken(), "Open cheat DB file", BrowseFileType::DB, [&](const std::string &value, int) { Path path(value); - INFO_LOG(SYSTEM, "Attempting to load cheats from: '%s'", path.ToVisualString().c_str()); + INFO_LOG(Log::System, "Attempting to load cheats from: '%s'", path.ToVisualString().c_str()); if (ImportCheats(path)) { g_Config.bReloadCheats = true; } else { @@ -242,7 +242,7 @@ UI::EventReturn CwCheatScreen::OnImportCheat(UI::EventParams ¶ms) { bool CwCheatScreen::ImportCheats(const Path & cheatFile) { if (gameID_.length() != 9 || !engine_) { - WARN_LOG(COMMON, "CWCHEAT: Incorrect ID(%s) - can't import cheats.", gameID_.c_str()); + WARN_LOG(Log::Common, "CWCHEAT: Incorrect ID(%s) - can't import cheats.", gameID_.c_str()); return false; } @@ -250,7 +250,7 @@ bool CwCheatScreen::ImportCheats(const Path & cheatFile) { FILE *in = File::OpenCFile(cheatFile, "rt"); if (!in) { - WARN_LOG(COMMON, "Unable to open %s\n", cheatFile.c_str()); + WARN_LOG(Log::Common, "Unable to open %s\n", cheatFile.c_str()); return false; } @@ -315,7 +315,7 @@ bool CwCheatScreen::ImportCheats(const Path & cheatFile) { } } - NOTICE_LOG(COMMON, "Imported %u lines from %s.\n", (int)newList.size(), cheatFile.c_str()); + NOTICE_LOG(Log::Common, "Imported %u lines from %s.\n", (int)newList.size(), cheatFile.c_str()); if (newList.size() != 0) { fputc('\n', append); } diff --git a/UI/DarwinFileSystemServices.mm b/UI/DarwinFileSystemServices.mm index 3aa6afdd32..5f08c1c781 100644 --- a/UI/DarwinFileSystemServices.mm +++ b/UI/DarwinFileSystemServices.mm @@ -46,7 +46,7 @@ void DarwinFileSystemServices::ClearDelegate() { else self.panelCallback(false, Path()); - INFO_LOG(SYSTEM, "Callback processed, pre-emptively hide keyboard"); + INFO_LOG(Log::System, "Callback processed, pre-emptively hide keyboard"); [sharedViewController hideKeyboard]; DarwinFileSystemServices::ClearDelegate(); } @@ -54,7 +54,7 @@ void DarwinFileSystemServices::ClearDelegate() { - (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller { self.panelCallback(false, Path()); - INFO_LOG(SYSTEM, "Picker cancelled, pre-emptively hide keyboard"); + INFO_LOG(Log::System, "Picker cancelled, pre-emptively hide keyboard"); [sharedViewController hideKeyboard]; } @@ -97,13 +97,13 @@ void DarwinFileSystemServices::presentDirectoryPanel( // panel.allowedFileTypes = @[(__bridge NSString *)kUTTypeFolder]; NSModalResponse modalResponse = [panel runModal]; if (modalResponse == NSModalResponseOK && panel.URLs.firstObject) { - INFO_LOG(SYSTEM, "Mac: Received OK response from modal"); + INFO_LOG(Log::System, "Mac: Received OK response from modal"); panelCallback(true, Path(panel.URLs.firstObject.path.UTF8String)); } else if (modalResponse == NSModalResponseCancel) { - INFO_LOG(SYSTEM, "Mac: Received Cancel response from modal"); + INFO_LOG(Log::System, "Mac: Received Cancel response from modal"); panelCallback(false, Path()); } else { - WARN_LOG(SYSTEM, "Mac: Received unknown responsde from modal"); + WARN_LOG(Log::System, "Mac: Received unknown responsde from modal"); panelCallback(false, Path()); } #elif PPSSPP_PLATFORM(IOS) diff --git a/UI/DebugOverlay.cpp b/UI/DebugOverlay.cpp index 9e402144ac..3d23e036d4 100644 --- a/UI/DebugOverlay.cpp +++ b/UI/DebugOverlay.cpp @@ -230,7 +230,7 @@ void DrawDebugOverlay(UIContext *ctx, const Bounds &bounds, DebugOverlay overlay case DebugOverlay::FRAME_TIMING: DrawFrameTiming(ctx, ctx->GetLayoutBounds()); break; - case DebugOverlay::AUDIO: + case DebugOverlay::Audio: DrawAudioDebugStats(ctx, ctx->GetLayoutBounds()); break; #if !PPSSPP_PLATFORM(UWP) && !PPSSPP_PLATFORM(SWITCH) @@ -325,7 +325,7 @@ void DrawCrashDump(UIContext *ctx, const Path &gamePath) { ctx->PushScissor(Bounds(x, y, columnWidth, height)); - // INFO_LOG(SYSTEM, "DrawCrashDump (%d %d %d %d)", x, y, columnWidth, height); + // INFO_LOG(Log::System, "DrawCrashDump (%d %d %d %d)", x, y, columnWidth, height); snprintf(statbuf, sizeof(statbuf), R"(%s %s (%s) diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index afd9ad7508..851b1504ab 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -150,7 +150,7 @@ void DevMenuScreen::CreatePopupContents(UI::ViewGroup *parent) { items->Add(new Choice(dev->T("Create frame dump")))->OnClick.Add([](UI::EventParams &e) { GPURecord::RecordNextFrame([](const Path &dumpPath) { - NOTICE_LOG(SYSTEM, "Frame dump created at '%s'", dumpPath.c_str()); + NOTICE_LOG(Log::System, "Frame dump created at '%s'", dumpPath.c_str()); if (System_GetPropertyBool(SYSPROP_CAN_SHOW_FILE)) { System_ShowFileInFolder(dumpPath); } else { @@ -285,7 +285,7 @@ UI::EventReturn LogScreen::OnSubmit(UI::EventParams &e) { // TODO: Can add all sorts of fun stuff here that we can't be bothered writing proper UI for, like various memdumps etc. - NOTICE_LOG(SYSTEM, "Submitted: %s", cmd.c_str()); + NOTICE_LOG(Log::System, "Submitted: %s", cmd.c_str()); UpdateLog(); cmdLine_->SetText(""); @@ -324,7 +324,7 @@ void LogConfigScreen::CreateViews() { GridLayout *grid = vert->Add(new GridLayoutList(gridsettings, new LayoutParams(FILL_PARENT, WRAP_CONTENT))); for (int i = 0; i < LogManager::GetNumChannels(); i++) { - LogType type = (LogType)i; + Log type = (Log)i; LogChannel *chan = logMan->GetLogChannel(type); LinearLayout *row = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(cellSize - 50, WRAP_CONTENT)); row->SetSpacing(0); @@ -337,7 +337,7 @@ void LogConfigScreen::CreateViews() { UI::EventReturn LogConfigScreen::OnToggleAll(UI::EventParams &e) { LogManager *logMan = LogManager::GetInstance(); for (int i = 0; i < LogManager::GetNumChannels(); i++) { - LogChannel *chan = logMan->GetLogChannel((LogType)i); + LogChannel *chan = logMan->GetLogChannel((Log)i); chan->enabled = !chan->enabled; } return UI::EVENT_DONE; @@ -346,7 +346,7 @@ UI::EventReturn LogConfigScreen::OnToggleAll(UI::EventParams &e) { UI::EventReturn LogConfigScreen::OnEnableAll(UI::EventParams &e) { LogManager *logMan = LogManager::GetInstance(); for (int i = 0; i < LogManager::GetNumChannels(); i++) { - LogChannel *chan = logMan->GetLogChannel((LogType)i); + LogChannel *chan = logMan->GetLogChannel((Log)i); chan->enabled = true; } return UI::EVENT_DONE; @@ -355,7 +355,7 @@ UI::EventReturn LogConfigScreen::OnEnableAll(UI::EventParams &e) { UI::EventReturn LogConfigScreen::OnDisableAll(UI::EventParams &e) { LogManager *logMan = LogManager::GetInstance(); for (int i = 0; i < LogManager::GetNumChannels(); i++) { - LogChannel *chan = logMan->GetLogChannel((LogType)i); + LogChannel *chan = logMan->GetLogChannel((Log)i); chan->enabled = false; } return UI::EVENT_DONE; @@ -393,7 +393,7 @@ void LogLevelScreen::OnCompleted(DialogResult result) { LogManager *logMan = LogManager::GetInstance(); for (int i = 0; i < LogManager::GetNumChannels(); ++i) { - LogType type = (LogType)i; + Log type = (Log)i; LogChannel *chan = logMan->GetLogChannel(type); if (chan->enabled) chan->level = (LogLevel)(selected + 1); @@ -1054,7 +1054,7 @@ void FrameDumpTestScreen::CreateViews() { UI::EventReturn FrameDumpTestScreen::OnLoadDump(UI::EventParams ¶ms) { std::string url = params.v->Tag(); - INFO_LOG(COMMON, "Trying to launch '%s'", url.c_str()); + INFO_LOG(Log::Common, "Trying to launch '%s'", url.c_str()); // Our disc streaming functionality detects the URL and takes over and handles loading framedumps well, // except for some reason the game ID. // TODO: Fix that since it can be important for compat settings. @@ -1086,7 +1086,7 @@ void FrameDumpTestScreen::update() { if (offset != std::string::npos) { trimmed = trimmed.substr(0, offset); if (endsWith(trimmed, ".ppdmp")) { - INFO_LOG(COMMON, "Found ppdmp: '%s'", trimmed.c_str()); + INFO_LOG(Log::Common, "Found ppdmp: '%s'", trimmed.c_str()); files_.push_back(trimmed); } } @@ -1106,7 +1106,7 @@ void TouchTestScreen::touch(const TouchInput &touch) { bool found = false; for (int i = 0; i < MAX_TOUCH_POINTS; i++) { if (touches_[i].id == touch.id) { - WARN_LOG(SYSTEM, "Double touch"); + WARN_LOG(Log::System, "Double touch"); touches_[i].x = touch.x; touches_[i].y = touch.y; found = true; @@ -1133,7 +1133,7 @@ void TouchTestScreen::touch(const TouchInput &touch) { } } if (!found) { - WARN_LOG(SYSTEM, "Move without touch down: %d", touch.id); + WARN_LOG(Log::System, "Move without touch down: %d", touch.id); } } if (touch.flags & TOUCH_UP) { @@ -1146,7 +1146,7 @@ void TouchTestScreen::touch(const TouchInput &touch) { } } if (!found) { - WARN_LOG(SYSTEM, "Touch release without touch down"); + WARN_LOG(Log::System, "Touch release without touch down"); } } } @@ -1284,9 +1284,9 @@ void TouchTestScreen::DrawForeground(UIContext &dc) { void RecreateActivity() { const int SYSTEM_JELLYBEAN = 16; if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= SYSTEM_JELLYBEAN) { - INFO_LOG(SYSTEM, "Sending recreate"); + INFO_LOG(Log::System, "Sending recreate"); System_Notify(SystemNotification::FORCE_RECREATE_ACTIVITY); - INFO_LOG(SYSTEM, "Got back from recreate"); + INFO_LOG(Log::System, "Got back from recreate"); } else { auto gr = GetI18NCategory(I18NCat::GRAPHICS); System_Toast(gr->T_cstr("Must Restart", "You must restart PPSSPP for this change to take effect")); diff --git a/UI/DiscordIntegration.cpp b/UI/DiscordIntegration.cpp index b0e58d54f5..748547c2a0 100644 --- a/UI/DiscordIntegration.cpp +++ b/UI/DiscordIntegration.cpp @@ -35,13 +35,13 @@ static const char *ppsspp_app_id = "423397985041383434"; #ifdef ENABLE_DISCORD // No context argument? What? static void handleDiscordError(int errCode, const char *message) { - ERROR_LOG(SYSTEM, "Discord error code %d: '%s'", errCode, message); + ERROR_LOG(Log::System, "Discord error code %d: '%s'", errCode, message); } #endif Discord::~Discord() { if (initialized_) { - ERROR_LOG(SYSTEM, "Discord destructor running though g_Discord.Shutdown() has not been called."); + ERROR_LOG(Log::System, "Discord destructor running though g_Discord.Shutdown() has not been called."); } } @@ -57,7 +57,7 @@ void Discord::Init() { DiscordEventHandlers eventHandlers{}; eventHandlers.errored = &handleDiscordError; Discord_Initialize(ppsspp_app_id, &eventHandlers, 0, nullptr); - INFO_LOG(SYSTEM, "Discord connection initialized"); + INFO_LOG(Log::System, "Discord connection initialized"); #endif initialized_ = true; diff --git a/UI/DriverManagerScreen.cpp b/UI/DriverManagerScreen.cpp index 0e93ac3ebb..5b810f5304 100644 --- a/UI/DriverManagerScreen.cpp +++ b/UI/DriverManagerScreen.cpp @@ -191,7 +191,7 @@ UI::EventReturn DriverManagerScreen::OnCustomDriverChange(UI::EventParams &e) { screenManager()->push(new PromptScreen(gamePath_, di->T("Changing this setting requires PPSSPP to restart."), di->T("Restart"), di->T("Cancel"), [=](bool yes) { if (yes) { - INFO_LOG(G3D, "Switching driver to '%s'", e.s.c_str()); + INFO_LOG(Log::G3D, "Switching driver to '%s'", e.s.c_str()); g_Config.sCustomDriver = e.s; TriggerRestart("GameSettingsScreen::CustomDriverYes", false, gamePath_); } @@ -203,7 +203,7 @@ UI::EventReturn DriverManagerScreen::OnCustomDriverUninstall(UI::EventParams &e) if (e.s.empty()) { return UI::EVENT_DONE; } - INFO_LOG(G3D, "Uninstalling driver: %s", e.s.c_str()); + INFO_LOG(Log::G3D, "Uninstalling driver: %s", e.s.c_str()); Path folder = GetDriverPath() / e.s; File::DeleteDirRecursively(folder); @@ -230,7 +230,7 @@ UI::EventReturn DriverManagerScreen::OnCustomDriverInstall(UI::EventParams &e) { std::unique_ptr zipFileReader = std::unique_ptr(ZipFileReader::Create(zipPath, "", true)); if (!zipFileReader) { g_OSD.Show(OSDType::MESSAGE_ERROR, gr->T("The chosen ZIP file doesn't contain a valid driver", "couldn't open zip")); - ERROR_LOG(SYSTEM, "Failed to open file '%s' as zip", zipPath.c_str()); + ERROR_LOG(Log::System, "Failed to open file '%s' as zip", zipPath.c_str()); return; } @@ -251,7 +251,7 @@ UI::EventReturn DriverManagerScreen::OnCustomDriverInstall(UI::EventParams &e) { delete[] metaData; const Path newCustomDriver = GetDriverPath() / meta.name; - NOTICE_LOG(G3D, "Installing driver into '%s'", newCustomDriver.c_str()); + NOTICE_LOG(Log::G3D, "Installing driver into '%s'", newCustomDriver.c_str()); File::CreateFullPath(newCustomDriver); std::vector zipListing; diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 6ccacf6b8f..8aab392e58 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -254,7 +254,7 @@ void EmuScreen::bootGame(const Path &filename) { invalid_ = !PSP_IsInited(); if (invalid_) { errorMessage_ = error_string; - ERROR_LOG(BOOT, "isIniting bootGame error: %s", errorMessage_.c_str()); + ERROR_LOG(Log::Boot, "isIniting bootGame error: %s", errorMessage_.c_str()); return; } bootComplete(); @@ -283,7 +283,7 @@ void EmuScreen::bootGame(const Path &filename) { if (!File::Exists(filename / INDEX_FILENAME)) { g_OSD.Show(OSDType::MESSAGE_CENTERED_WARNING, sc->T("ExtractedIsoWarning", "Extracted ISOs often don't work.\nPlay the ISO file directly."), gamePath_.ToVisualString(), 7.0f); } else { - INFO_LOG(LOADER, "Extracted ISO loaded without warning - %s is present.", INDEX_FILENAME.c_str()); + INFO_LOG(Log::Loader, "Extracted ISO loaded without warning - %s is present.", INDEX_FILENAME.c_str()); } } @@ -348,7 +348,7 @@ void EmuScreen::bootGame(const Path &filename) { bootPending_ = false; invalid_ = true; errorMessage_ = error_string; - ERROR_LOG(BOOT, "InitStart bootGame error: %s", errorMessage_.c_str()); + ERROR_LOG(Log::Boot, "InitStart bootGame error: %s", errorMessage_.c_str()); } if (PSP_CoreParameter().compat.flags().RequireBufferedRendering && g_Config.bSkipBufferEffects) { @@ -381,7 +381,7 @@ void EmuScreen::bootComplete() { System_Notify(SystemNotification::BOOT_DONE); System_Notify(SystemNotification::DISASSEMBLY); - NOTICE_LOG(BOOT, "Booted %s...", PSP_CoreParameter().fileToStart.c_str()); + NOTICE_LOG(Log::Boot, "Booted %s...", PSP_CoreParameter().fileToStart.c_str()); if (!Achievements::HardcoreModeActive()) { // Don't auto-load savestates in hardcore mode. autoLoad(); @@ -531,7 +531,7 @@ void EmuScreen::sendMessage(UIMessage message, const char *value) { std::string resetError; if (!PSP_InitStart(PSP_CoreParameter(), &resetError)) { - ERROR_LOG(LOADER, "Error resetting: %s", resetError.c_str()); + ERROR_LOG(Log::Loader, "Error resetting: %s", resetError.c_str()); stopRender_ = true; screenManager()->switchScreen(new MainScreen()); return; @@ -539,7 +539,7 @@ void EmuScreen::sendMessage(UIMessage message, const char *value) { } else if (message == UIMessage::REQUEST_GAME_BOOT) { // TODO: Ignore or not if it's the same game that's already running? if (gamePath_ == Path(value)) { - WARN_LOG(LOADER, "Game already running, ignoring"); + WARN_LOG(Log::Loader, "Game already running, ignoring"); return; } const char *ext = strrchr(value, '.'); @@ -1275,7 +1275,7 @@ bool EmuScreen::checkPowerDown() { if (PSP_IsInited()) { PSP_Shutdown(); } - INFO_LOG(SYSTEM, "SELF-POWERDOWN!"); + INFO_LOG(Log::System, "SELF-POWERDOWN!"); screenManager()->switchScreen(new MainScreen()); bootPending_ = false; invalid_ = true; @@ -1414,7 +1414,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) { } else if (PSP_CoreParameter().frozen) { std::string errorString; if (CChunkFileReader::ERROR_NONE != SaveState::LoadFromRam(freezeState_, &errorString)) { - ERROR_LOG(SAVESTATE, "Failed to load freeze state (%s). Unfreezing.", errorString.c_str()); + ERROR_LOG(Log::SaveState, "Failed to load freeze state (%s). Unfreezing.", errorString.c_str()); PSP_CoreParameter().frozen = false; } } diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 9c7a45b2a2..6139ee3446 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -76,7 +76,7 @@ bool GameInfo::Delete() { { // Just delete the one file (TODO: handle two-disk games as well somehow). Path fileToRemove = filePath_; - INFO_LOG(SYSTEM, "Deleting file %s", fileToRemove.c_str()); + INFO_LOG(Log::System, "Deleting file %s", fileToRemove.c_str()); File::Delete(fileToRemove); g_Config.RemoveRecent(filePath_.ToString()); return true; @@ -86,9 +86,9 @@ bool GameInfo::Delete() { { // TODO: This could be handled by Core/Util/GameManager too somehow. Path directoryToRemove = ResolvePBPDirectory(filePath_); - INFO_LOG(SYSTEM, "Deleting directory %s", directoryToRemove.c_str()); + INFO_LOG(Log::System, "Deleting directory %s", directoryToRemove.c_str()); if (!File::DeleteDirRecursively(directoryToRemove)) { - ERROR_LOG(SYSTEM, "Failed to delete file"); + ERROR_LOG(Log::System, "Failed to delete file"); return false; } g_Config.CleanRecent(); @@ -104,7 +104,7 @@ bool GameInfo::Delete() { case IdentifiedFileType::PPSSPP_GE_DUMP: { const Path &fileToRemove = filePath_; - INFO_LOG(SYSTEM, "Deleting file %s", fileToRemove.c_str()); + INFO_LOG(Log::System, "Deleting file %s", fileToRemove.c_str()); File::Delete(fileToRemove); g_Config.RemoveRecent(filePath_.ToString()); return true; @@ -113,7 +113,7 @@ bool GameInfo::Delete() { case IdentifiedFileType::PPSSPP_SAVESTATE: { const Path &ppstPath = filePath_; - INFO_LOG(SYSTEM, "Deleting file %s", ppstPath.c_str()); + INFO_LOG(Log::System, "Deleting file %s", ppstPath.c_str()); File::Delete(ppstPath); const Path screenshotPath = filePath_.WithReplacedExtension(".ppst", ".jpg"); if (File::Exists(screenshotPath)) { @@ -123,7 +123,7 @@ bool GameInfo::Delete() { } default: - INFO_LOG(SYSTEM, "Don't know how to delete this type of file: %s", filePath_.c_str()); + INFO_LOG(Log::System, "Don't know how to delete this type of file: %s", filePath_.c_str()); return false; } } @@ -358,7 +358,7 @@ void GameInfo::SetupTexture(Draw::DrawContext *thin3d, GameInfoTex &tex) { tex.texture = CreateTextureFromFileData(thin3d, (const uint8_t *)tex.data.data(), tex.data.size(), ImageFileType::DETECT, false, GetTitle().c_str()); tex.timeLoaded = time_now_d(); if (!tex.texture) { - ERROR_LOG(G3D, "Failed creating texture (%s) from %d-byte file", GetTitle().c_str(), (int)tex.data.size()); + ERROR_LOG(Log::G3D, "Failed creating texture (%s) from %d-byte file", GetTitle().c_str(), (int)tex.data.size()); } } @@ -456,7 +456,7 @@ public: // Mark everything requested as done, so std::unique_lock lock(info_->lock); info_->MarkReadyNoLock(flags_); - ERROR_LOG(LOADER, "Failed getting game info for %s", info_->GetFilePath().ToVisualString().c_str()); + ERROR_LOG(Log::Loader, "Failed getting game info for %s", info_->GetFilePath().ToVisualString().c_str()); return; } @@ -483,7 +483,7 @@ public: if (pbp.IsELF()) { goto handleELF; } - ERROR_LOG(LOADER, "invalid pbp '%s'\n", pbpLoader->GetPath().c_str()); + ERROR_LOG(Log::Loader, "invalid pbp '%s'\n", pbpLoader->GetPath().c_str()); return; } @@ -576,7 +576,7 @@ handleELF: ReadLocalFileToString(screenshot_jpg, &info_->icon.data, &info_->lock); } else { // Read standard icon - VERBOSE_LOG(LOADER, "Loading unknown.png because there was an ELF"); + VERBOSE_LOG(Log::Loader, "Loading unknown.png because there was an ELF"); ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock); } info_->icon.dataLoaded = true; @@ -623,7 +623,7 @@ handleELF: if (ReadLocalFileToString(screenshotPath, &info_->icon.data, &info_->lock)) { info_->icon.dataLoaded = true; } else { - ERROR_LOG(G3D, "Error loading screenshot data: '%s'", screenshotPath.c_str()); + ERROR_LOG(Log::G3D, "Error loading screenshot data: '%s'", screenshotPath.c_str()); } } break; @@ -725,7 +725,7 @@ handleELF: else if (File::Exists(screenshot_jpg)) info_->icon.dataLoaded = ReadLocalFileToString(screenshot_jpg, &info_->icon.data, &info_->lock); else { - DEBUG_LOG(LOADER, "Loading unknown.png because no icon was found"); + DEBUG_LOG(Log::Loader, "Loading unknown.png because no icon was found"); info_->icon.dataLoaded = ReadVFSToString("unknown.png", &info_->icon.data, &info_->lock); } } else { @@ -779,7 +779,7 @@ handleELF: // Time to update the flags. std::unique_lock lock(info_->lock); info_->MarkReadyNoLock(flags_); - // INFO_LOG(SYSTEM, "Completed writing info for %s", info_->GetTitle().c_str()); + // INFO_LOG(Log::System, "Completed writing info for %s", info_->GetTitle().c_str()); } private: @@ -866,7 +866,7 @@ void GameInfoCache::PurgeType(IdentifiedFileType fileType) { } // TODO: Find a better way to wait here. if (info->pendingFlags != (GameInfoFlags)0) { - INFO_LOG(LOADER, "%s: pending flags %08x, retrying", info->GetTitle().c_str(), (int)info->pendingFlags); + INFO_LOG(Log::Loader, "%s: pending flags %08x, retrying", info->GetTitle().c_str(), (int)info->pendingFlags); retry = true; break; } diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index 7b877ed1e0..2c089e5826 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -406,7 +406,7 @@ ScreenRenderFlags GameScreen::render(ScreenRenderMode mode) { // tvVerified_->SetText(ga->T("File size incorrect, bad or modified ISO")); // tvVerified_->SetVisibility(UI::V_VISIBLE); // tvVerified_->SetLevel(NoticeLevel::ERROR); - // INFO_LOG(LOADER, "File size %d not matching game DB", (int)info->gameSizeUncompressed); + // INFO_LOG(Log::Loader, "File size %d not matching game DB", (int)info->gameSizeUncompressed); } else { tvVerified_->SetText(ga->T("Click \"Calculate CRC\" to verify ISO")); tvVerified_->SetVisibility(UI::V_VISIBLE); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index 4c1d301e61..526d88644b 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -1316,10 +1316,10 @@ UI::EventReturn GameSettingsScreen::OnAutoFrameskip(UI::EventParams &e) { } UI::EventReturn GameSettingsScreen::OnScreenRotation(UI::EventParams &e) { - INFO_LOG(SYSTEM, "New display rotation: %d", g_Config.iScreenRotation); - INFO_LOG(SYSTEM, "Sending rotate"); + INFO_LOG(Log::System, "New display rotation: %d", g_Config.iScreenRotation); + INFO_LOG(Log::System, "Sending rotate"); System_Notify(SystemNotification::ROTATE_UPDATED); - INFO_LOG(SYSTEM, "Got back from rotate"); + INFO_LOG(Log::System, "Got back from rotate"); return UI::EVENT_DONE; } @@ -1550,7 +1550,7 @@ void GameSettingsScreen::CallbackMemstickFolder(bool yes) { File::Delete(Path(testWriteFile)); if (!File::WriteDataToFile(true, pendingMemstickFolder_.c_str(), pendingMemstickFolder_.size(), memstickDirFile)) { - WARN_LOG(SYSTEM, "Failed to write memstick folder to '%s'", memstickDirFile.c_str()); + WARN_LOG(Log::System, "Failed to write memstick folder to '%s'", memstickDirFile.c_str()); } else { // Save so the settings, at least, are transferred. g_Config.memStickDirectory = Path(pendingMemstickFolder_); @@ -2052,7 +2052,7 @@ UI::EventReturn DeveloperToolsScreen::OnCopyStatesToRoot(UI::EventParams &e) { for (const File::FileInfo &file : files) { Path src = file.fullName; Path dst = root_dir / file.name; - INFO_LOG(SYSTEM, "Copying file '%s' to '%s'", src.c_str(), dst.c_str()); + INFO_LOG(Log::System, "Copying file '%s' to '%s'", src.c_str(), dst.c_str()); File::Copy(src, dst); } diff --git a/UI/JitCompareScreen.cpp b/UI/JitCompareScreen.cpp index f14ddfa908..326bd55d9f 100644 --- a/UI/JitCompareScreen.cpp +++ b/UI/JitCompareScreen.cpp @@ -456,7 +456,7 @@ void JitCompareScreen::OnRandomBlock(int flag) { if (MIPSGetInfo(opcode) & flag) { char temp[256]; MIPSDisAsm(opcode, addr, temp, sizeof(temp)); - // INFO_LOG(HLE, "Stopping at random instruction: %08x %s", addr, temp); + // INFO_LOG(Log::HLE, "Stopping at random instruction: %08x %s", addr, temp); anyWanted = true; break; } diff --git a/UI/MemStickScreen.cpp b/UI/MemStickScreen.cpp index f7a7a69cfd..6b8cd3574c 100644 --- a/UI/MemStickScreen.cpp +++ b/UI/MemStickScreen.cpp @@ -77,7 +77,7 @@ MemStickScreen::MemStickScreen(bool initialSetup) if (System_GetPropertyBool(SYSPROP_ANDROID_SCOPED_STORAGE)) { choice_ = CHOICE_BROWSE_FOLDER; } else { - WARN_LOG_REPORT(SYSTEM, "Scoped storage not enabled - shouldn't be in MemStickScreen at initial setup"); + WARN_LOG_REPORT(Log::System, "Scoped storage not enabled - shouldn't be in MemStickScreen at initial setup"); choice_ = CHOICE_STORAGE_ROOT; // Shouldn't really be here in initial setup. } @@ -268,7 +268,7 @@ void MemStickScreen::CreateViews() { rightColumnItems->Add(new UI::Choice(iz->T("WhatsThis", "What's this?")))->OnClick.Handle(this, &MemStickScreen::OnHelp); } - INFO_LOG(SYSTEM, "MemStickScreen: initialSetup=%d", (int)initialSetup_); + INFO_LOG(Log::System, "MemStickScreen: initialSetup=%d", (int)initialSetup_); } UI::EventReturn MemStickScreen::OnHelp(UI::EventParams ¶ms) { @@ -342,10 +342,10 @@ UI::EventReturn MemStickScreen::SetFolderManually(UI::EventParams ¶ms) { std::string oldNewPath = newPath; FixPathCase(Path(""), newPath, FixPathCaseBehavior::FPC_FILE_MUST_EXIST); if (oldNewPath != newPath) { - NOTICE_LOG(IO, "Fixed path case: %s -> %s", oldNewPath.c_str(), newPath.c_str()); + NOTICE_LOG(Log::IO, "Fixed path case: %s -> %s", oldNewPath.c_str(), newPath.c_str()); pendingMemStickFolder = Path(newPath); } else { - NOTICE_LOG(IO, "Failed to fix case of path %s (result: %s)", newPath.c_str(), oldNewPath.c_str()); + NOTICE_LOG(Log::IO, "Failed to fix case of path %s (result: %s)", newPath.c_str(), oldNewPath.c_str()); } } @@ -380,7 +380,7 @@ UI::EventReturn MemStickScreen::UseInternalStorage(UI::EventParams ¶ms) { TriggerFinish(DialogResult::DR_OK); } else { // This can't really happen?? Not worth making an error message. - ERROR_LOG_REPORT(SYSTEM, "Could not switch memstick path in setup (internal)"); + ERROR_LOG_REPORT(Log::System, "Could not switch memstick path in setup (internal)"); } // Don't have a confirmation dialog that would otherwise do it for us, need to just switch directly to the main screen. screenManager()->switchScreen(new MainScreen()); @@ -404,7 +404,7 @@ UI::EventReturn MemStickScreen::UseStorageRoot(UI::EventParams ¶ms) { TriggerFinish(DialogResult::DR_OK); } else { // This can't really happen?? Not worth making an error message. - ERROR_LOG_REPORT(SYSTEM, "Could not switch memstick path in setup"); + ERROR_LOG_REPORT(Log::System, "Could not switch memstick path in setup"); } } else if (pendingMemStickFolder != g_Config.memStickDirectory) { // Always ask for confirmation when called from the UI. Likely there's already some data. @@ -420,7 +420,7 @@ UI::EventReturn MemStickScreen::Browse(UI::EventParams ¶ms) { auto mm = GetI18NCategory(I18NCat::MAINMENU); System_BrowseForFolder(GetRequesterToken(), mm->T("Choose folder"), g_Config.memStickDirectory, [=](const std::string &value, int) { Path pendingMemStickFolder = Path(value); - INFO_LOG(SYSTEM, "Got folder: '%s'", pendingMemStickFolder.c_str()); + INFO_LOG(Log::System, "Got folder: '%s'", pendingMemStickFolder.c_str()); // Browse finished. Let's pop up the confirmation dialog. if (!pendingMemStickFolder.empty() && pendingMemStickFolder == g_Config.memStickDirectory && File::IsDirectory(pendingMemStickFolder)) { auto iz = GetI18NCategory(I18NCat::MEMSTICK); @@ -439,7 +439,7 @@ UI::EventReturn MemStickScreen::Browse(UI::EventParams ¶ms) { void MemStickScreen::dialogFinished(const Screen *dialog, DialogResult result) { if (result == DialogResult::DR_OK) { - INFO_LOG(SYSTEM, "Confirmation screen done - moving on."); + INFO_LOG(Log::System, "Confirmation screen done - moving on."); // There's a screen manager bug if we call TriggerFinish directly. // Can't be bothered right now, so we pick this up in update(). done_ = true; @@ -465,7 +465,7 @@ ConfirmMemstickMoveScreen::ConfirmMemstickMoveScreen(Path newMemstickFolder, boo ConfirmMemstickMoveScreen::~ConfirmMemstickMoveScreen() { if (moveDataTask_) { - INFO_LOG(SYSTEM, "Move Data task still running, blocking on it"); + INFO_LOG(Log::System, "Move Data task still running, blocking on it"); moveDataTask_->BlockUntilReady(); delete moveDataTask_; } @@ -553,12 +553,12 @@ void ConfirmMemstickMoveScreen::update() { if (result) { if (result->success) { progressReporter_.SetProgress(iz->T("Done!")); - INFO_LOG(SYSTEM, "Move data task finished successfully!"); + INFO_LOG(Log::System, "Move data task finished successfully!"); // Succeeded! FinishFolderMove(); } else { progressReporter_.SetProgress(iz->T("Failed to move some files!")); - INFO_LOG(SYSTEM, "Move data task failed!"); + INFO_LOG(Log::System, "Move data task failed!"); // What do we do here? We might be in the middle of a move... Bad. RecreateViews(); } diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 948a6d4a7b..ba3c0dfacf 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -284,7 +284,7 @@ void PostLoadConfig() { static void CheckFailedGPUBackends() { #ifdef _DEBUG // If you're in debug mode, you probably don't want a fallback. If you're in release mode, use IGNORE below. - NOTICE_LOG(LOADER, "Not checking for failed graphics backends in debug mode"); + NOTICE_LOG(Log::Loader, "Not checking for failed graphics backends in debug mode"); return; #endif @@ -317,14 +317,14 @@ static void CheckFailedGPUBackends() { if (g_Config.sFailedGPUBackends == "IGNORE") return; else if (!g_Config.sFailedGPUBackends.empty()) - ERROR_LOG(LOADER, "Failed graphics backends: %s", g_Config.sFailedGPUBackends.c_str()); + ERROR_LOG(Log::Loader, "Failed graphics backends: %s", g_Config.sFailedGPUBackends.c_str()); // Okay, let's not try a backend in the failed list. g_Config.iGPUBackend = g_Config.NextValidBackend(); if (lastBackend != g_Config.iGPUBackend) { std::string param = GPUBackendToString((GPUBackend)lastBackend) + " -> " + GPUBackendToString((GPUBackend)g_Config.iGPUBackend); System_GraphicsBackendFailedAlert(param); - WARN_LOG(LOADER, "Failed graphics backend switched from %s (%d to %d)", param.c_str(), lastBackend, g_Config.iGPUBackend); + WARN_LOG(Log::Loader, "Failed graphics backend switched from %s (%d to %d)", param.c_str(), lastBackend, g_Config.iGPUBackend); } // And then let's - for now - add the current to the failed list. if (g_Config.sFailedGPUBackends.empty()) { @@ -431,24 +431,24 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch Path memstickDirFile = g_Config.internalDataDirectory / "memstick_dir.txt"; if (File::Exists(memstickDirFile)) { - INFO_LOG(SYSTEM, "Reading '%s' to find memstick dir.", memstickDirFile.c_str()); + INFO_LOG(Log::System, "Reading '%s' to find memstick dir.", memstickDirFile.c_str()); std::string memstickDir; if (File::ReadTextFileToString(memstickDirFile, &memstickDir)) { Path memstickPath(memstickDir); if (!memstickPath.empty() && File::Exists(memstickPath)) { g_Config.memStickDirectory = memstickPath; - INFO_LOG(SYSTEM, "Memstick Directory from memstick_dir.txt: '%s'", g_Config.memStickDirectory.c_str()); + INFO_LOG(Log::System, "Memstick Directory from memstick_dir.txt: '%s'", g_Config.memStickDirectory.c_str()); } else { - ERROR_LOG(SYSTEM, "Couldn't read directory '%s' specified by memstick_dir.txt.", memstickDir.c_str()); + ERROR_LOG(Log::System, "Couldn't read directory '%s' specified by memstick_dir.txt.", memstickDir.c_str()); if (System_GetPropertyBool(SYSPROP_ANDROID_SCOPED_STORAGE)) { // Ask the user to configure a memstick directory. - INFO_LOG(SYSTEM, "Asking the user."); + INFO_LOG(Log::System, "Asking the user."); g_Config.memStickDirectory.clear(); } } } } else { - INFO_LOG(SYSTEM, "No memstick directory file found (tried to open '%s')", memstickDirFile.c_str()); + INFO_LOG(Log::System, "No memstick directory file found (tried to open '%s')", memstickDirFile.c_str()); } // Attempt to create directories after reading the path. @@ -458,7 +458,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch #elif PPSSPP_PLATFORM(UWP) && !defined(__LIBRETRO__) Path memstickDirFile = g_Config.internalDataDirectory / "memstick_dir.txt"; if (File::Exists(memstickDirFile)) { - INFO_LOG(SYSTEM, "Reading '%s' to find memstick dir.", memstickDirFile.c_str()); + INFO_LOG(Log::System, "Reading '%s' to find memstick dir.", memstickDirFile.c_str()); std::string memstickDir; if (File::ReadTextFileToString(memstickDirFile, &memstickDir)) { Path memstickPath(memstickDir); @@ -466,15 +466,15 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch g_Config.memStickDirectory = memstickPath; g_Config.SetSearchPath(GetSysDirectory(DIRECTORY_SYSTEM)); g_Config.Reload(); - INFO_LOG(SYSTEM, "Memstick Directory from memstick_dir.txt: '%s'", g_Config.memStickDirectory.c_str()); + INFO_LOG(Log::System, "Memstick Directory from memstick_dir.txt: '%s'", g_Config.memStickDirectory.c_str()); } else { - ERROR_LOG(SYSTEM, "Couldn't read directory '%s' specified by memstick_dir.txt.", memstickDir.c_str()); + ERROR_LOG(Log::System, "Couldn't read directory '%s' specified by memstick_dir.txt.", memstickDir.c_str()); g_Config.memStickDirectory.clear(); } } } else { - INFO_LOG(SYSTEM, "No memstick directory file found (tried to open '%s')", memstickDirFile.c_str()); + INFO_LOG(Log::System, "No memstick directory file found (tried to open '%s')", memstickDirFile.c_str()); } #elif PPSSPP_PLATFORM(IOS) g_Config.defaultCurrentDirectory = g_Config.internalDataDirectory; @@ -618,21 +618,21 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch // don't already have one. if (!gotBootFilename) { gotBootFilename = true; - INFO_LOG(SYSTEM, "Boot filename found in args: '%s'", argv[i]); + INFO_LOG(Log::System, "Boot filename found in args: '%s'", argv[i]); bool okToLoad = true; bool okToCheck = true; if (System_GetPropertyBool(SYSPROP_SUPPORTS_PERMISSIONS)) { PermissionStatus status = System_GetPermissionStatus(SYSTEM_PERMISSION_STORAGE); if (status == PERMISSION_STATUS_DENIED) { - ERROR_LOG(IO, "Storage permission denied. Launching without argument."); + ERROR_LOG(Log::IO, "Storage permission denied. Launching without argument."); okToLoad = false; okToCheck = false; } else if (status != PERMISSION_STATUS_GRANTED) { - ERROR_LOG(IO, "Storage permission not granted. Launching without argument check."); + ERROR_LOG(Log::IO, "Storage permission not granted. Launching without argument check."); okToCheck = false; } else { - INFO_LOG(IO, "Storage permission granted."); + INFO_LOG(Log::IO, "Storage permission granted."); } } if (okToLoad) { @@ -640,7 +640,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch // Handle file:/// URIs, since you get those when creating shortcuts on some Android systems. if (startsWith(str, "file:///")) { str = UriDecode(str.substr(7)); - INFO_LOG(IO, "Decoding '%s' to '%s'", argv[i], str.c_str()); + INFO_LOG(Log::IO, "Decoding '%s' to '%s'", argv[i], str.c_str()); } boot_filename = Path(str); @@ -749,10 +749,10 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch } } - DEBUG_LOG(SYSTEM, "ScreenManager!"); + DEBUG_LOG(Log::System, "ScreenManager!"); g_screenManager = new ScreenManager(); if (g_Config.memStickDirectory.empty()) { - INFO_LOG(SYSTEM, "No memstick directory! Asking for one to be configured."); + INFO_LOG(Log::System, "No memstick directory! Asking for one to be configured."); g_screenManager->switchScreen(new LogoScreen(AfterLogoScreen::MEMSTICK_SCREEN_INITIAL_SETUP)); } else if (gotoGameSettings) { g_screenManager->switchScreen(new LogoScreen(AfterLogoScreen::TO_GAME_SETTINGS)); @@ -800,7 +800,7 @@ void CallbackPostRender(UIContext *dc, void *userdata); bool CreateGlobalPipelines(); bool NativeInitGraphics(GraphicsContext *graphicsContext) { - INFO_LOG(SYSTEM, "NativeInitGraphics"); + INFO_LOG(Log::System, "NativeInitGraphics"); _assert_msg_(g_screenManager, "No screenmanager, bad init order. Backend = %d", g_Config.iGPUBackend); @@ -813,7 +813,7 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) { _assert_(g_draw); if (!CreateGlobalPipelines()) { - ERROR_LOG(G3D, "Failed to create global pipelines"); + ERROR_LOG(Log::G3D, "Failed to create global pipelines"); return false; } @@ -848,7 +848,7 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) { if (IsWin7OrHigher()) { winCamera = new WindowsCaptureDevice(CAPTUREDEVIDE_TYPE::VIDEO); winCamera->sendMessage({ CAPTUREDEVIDE_COMMAND::INITIALIZE, nullptr }); - winMic = new WindowsCaptureDevice(CAPTUREDEVIDE_TYPE::AUDIO); + winMic = new WindowsCaptureDevice(CAPTUREDEVIDE_TYPE::Audio); winMic->sendMessage({ CAPTUREDEVIDE_COMMAND::INITIALIZE, nullptr }); } #endif @@ -861,7 +861,7 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) { gpu->DeviceRestore(g_draw); } - INFO_LOG(SYSTEM, "NativeInitGraphics completed"); + INFO_LOG(Log::System, "NativeInitGraphics completed"); return true; } @@ -875,7 +875,7 @@ bool CreateGlobalPipelines() { ShaderModule *fs_texture_color_2d = g_draw->GetFshaderPreset(FS_TEXTURE_COLOR_2D); if (!vs_color_2d || !fs_color_2d || !vs_texture_color_2d || !fs_texture_color_2d) { - ERROR_LOG(G3D, "Failed to get shader preset"); + ERROR_LOG(Log::G3D, "Failed to get shader preset"); return false; } @@ -917,7 +917,7 @@ bool CreateGlobalPipelines() { } void NativeShutdownGraphics() { - INFO_LOG(SYSTEM, "NativeShutdownGraphics"); + INFO_LOG(Log::System, "NativeShutdownGraphics"); if (g_screenManager) { g_screenManager->deviceLost(); @@ -965,7 +965,7 @@ void NativeShutdownGraphics() { texColorPipeline = nullptr; } - INFO_LOG(SYSTEM, "NativeShutdownGraphics done"); + INFO_LOG(Log::System, "NativeShutdownGraphics done"); } static void TakeScreenshot(Draw::DrawContext *draw) { @@ -1108,7 +1108,7 @@ void NativeFrame(GraphicsContext *graphicsContext) { for (const auto &item : toProcess) { if (HandleGlobalMessage(item.message, item.value)) { // TODO: Add a to-string thingy. - INFO_LOG(SYSTEM, "Handled global message: %d / %s", (int)item.message, item.value.c_str()); + INFO_LOG(Log::System, "Handled global message: %d / %s", (int)item.message, item.value.c_str()); } g_screenManager->sendMessage(item.message, item.value.c_str()); } @@ -1157,7 +1157,7 @@ void NativeFrame(GraphicsContext *graphicsContext) { g_draw->Present(presentMode, interval); if (resized) { - INFO_LOG(G3D, "Resized flag set - recalculating bounds"); + INFO_LOG(Log::G3D, "Resized flag set - recalculating bounds"); resized = false; if (uiContext) { @@ -1184,7 +1184,7 @@ void NativeFrame(GraphicsContext *graphicsContext) { System_PostUIMessage(UIMessage::GPU_DISPLAY_RESIZED); #endif } else { - // INFO_LOG(G3D, "Polling graphics context"); + // INFO_LOG(Log::G3D, "Polling graphics context"); graphicsContext->Poll(); } @@ -1254,7 +1254,7 @@ bool HandleGlobalMessage(UIMessage message, const std::string &value) { // and then getting permission), it will get out of sync. So we save and restore g_Config.iGPUBackend. // Ideally we should simply reinitialize graphics to the mode from the config, but there are potential issues. int gpuBackend = g_Config.iGPUBackend; - INFO_LOG(IO, "Reloading config after storage permission grant."); + INFO_LOG(Log::IO, "Reloading config after storage permission grant."); g_Config.Reload(); PostLoadConfig(); g_Config.iGPUBackend = gpuBackend; @@ -1271,16 +1271,16 @@ bool HandleGlobalMessage(UIMessage message, const std::string &value) { bool NativeIsAtTopLevel() { // This might need some synchronization? if (!g_screenManager) { - ERROR_LOG(SYSTEM, "No screen manager active"); + ERROR_LOG(Log::System, "No screen manager active"); return false; } Screen *currentScreen = g_screenManager->topScreen(); if (currentScreen) { bool top = currentScreen->isTopLevel(); - INFO_LOG(SYSTEM, "Screen toplevel: %i", (int)top); + INFO_LOG(Log::System, "Screen toplevel: %i", (int)top); return currentScreen->isTopLevel(); } else { - ERROR_LOG(SYSTEM, "No current screen"); + ERROR_LOG(Log::System, "No current screen"); return false; } } @@ -1334,7 +1334,7 @@ bool NativeKey(const KeyInput &key) { } #endif - // INFO_LOG(SYSTEM, "Key code: %i flags: %i", key.keyCode, key.flags); + // INFO_LOG(Log::System, "Key code: %i flags: %i", key.keyCode, key.flags); #if !defined(MOBILE_DEVICE) if (g_Config.bPauseExitsEmulator) { std::vector pspKeys; @@ -1405,7 +1405,7 @@ static void SendMouseDeltaAxis() { HLEPlugins::PluginDataAxis[JOYSTICK_AXIS_MOUSE_REL_X] = mx; HLEPlugins::PluginDataAxis[JOYSTICK_AXIS_MOUSE_REL_Y] = my; - //NOTICE_LOG(SYSTEM, "delta: %0.2f %0.2f mx/my: %0.2f %0.2f dpi: %f sens: %f ", + //NOTICE_LOG(Log::System, "delta: %0.2f %0.2f mx/my: %0.2f %0.2f dpi: %f sens: %f ", // g_mouseDeltaX, g_mouseDeltaY, mx, my, g_display.dpi_scale_x, g_Config.fMouseSensitivity); if (GetUIState() == UISTATE_INGAME || g_Config.bMapMouse) { @@ -1465,7 +1465,7 @@ void System_PostUIMessage(UIMessage message, const std::string &value) { void NativeResized() { // NativeResized can come from any thread so we just set a flag, then process it later. - VERBOSE_LOG(G3D, "NativeResized - setting flag"); + VERBOSE_LOG(Log::G3D, "NativeResized - setting flag"); resized = true; } @@ -1496,7 +1496,7 @@ void NativeShutdown() { g_Config.Save("NativeShutdown"); - INFO_LOG(SYSTEM, "NativeShutdown called"); + INFO_LOG(Log::System, "NativeShutdown called"); g_i18nrepo.LogMissingKeys(); @@ -1544,7 +1544,7 @@ static Path GetSecretPath(const char *nameOfSecret) { bool NativeSaveSecret(const char *nameOfSecret, const std::string &data) { Path path = GetSecretPath(nameOfSecret); if (!File::WriteDataToFile(false, data.data(), data.size(), path)) { - WARN_LOG(SYSTEM, "Failed to write secret '%s' to path '%s'", nameOfSecret, path.c_str()); + WARN_LOG(Log::System, "Failed to write secret '%s' to path '%s'", nameOfSecret, path.c_str()); return false; } return true; diff --git a/UI/RemoteISOScreen.cpp b/UI/RemoteISOScreen.cpp index 7d356db8a2..611f0bb58a 100644 --- a/UI/RemoteISOScreen.cpp +++ b/UI/RemoteISOScreen.cpp @@ -119,7 +119,7 @@ bool RemoteISOConnectScreen::FindServer(std::string &resultHost, int &resultPort std::lock_guard guard(statusLock_); statusMessage_ = formatted; - INFO_LOG(SYSTEM, "Remote: %s", formatted.c_str()); + INFO_LOG(Log::System, "Remote: %s", formatted.c_str()); }; http.SetUserAgent(StringFromFormat("PPSSPP/%s", PPSSPP_GIT_VERSION)); @@ -177,7 +177,7 @@ bool RemoteISOConnectScreen::FindServer(std::string &resultHost, int &resultPort resultHost = host; resultPort = port; SetStatus("Connected to [URL]", host, port); - NOTICE_LOG(SYSTEM, "RemoteISO found: %s : %d", host.c_str(), port); + NOTICE_LOG(Log::System, "RemoteISO found: %s : %d", host.c_str(), port); return true; } diff --git a/UI/Store.cpp b/UI/Store.cpp index e558c4c9dd..39d75fcea3 100644 --- a/UI/Store.cpp +++ b/UI/Store.cpp @@ -372,7 +372,7 @@ UI::EventReturn ProductView::OnInstall(UI::EventParams &e) { if (cancelButton_) { cancelButton_->SetVisibility(UI::V_VISIBLE); } - INFO_LOG(SYSTEM, "Triggering install of '%s'", fileUrl.c_str()); + INFO_LOG(Log::System, "Triggering install of '%s'", fileUrl.c_str()); g_GameManager.DownloadAndInstall(fileUrl); return UI::EVENT_DONE; } @@ -430,7 +430,7 @@ void StoreScreen::update() { RecreateViews(); } else { // Failed to contact store. Don't do anything. - ERROR_LOG(IO, "Download failed : error code %d", resultCode_); + ERROR_LOG(Log::IO, "Download failed : error code %d", resultCode_); connectionError_ = true; loading_ = false; RecreateViews(); @@ -445,7 +445,7 @@ void StoreScreen::ParseListing(const std::string &json) { using namespace json; JsonReader reader(json.c_str(), json.size()); if (!reader.ok() || !reader.root()) { - ERROR_LOG(IO, "Error parsing JSON from store"); + ERROR_LOG(Log::IO, "Error parsing JSON from store"); connectionError_ = true; RecreateViews(); return; diff --git a/UI/Theme.cpp b/UI/Theme.cpp index 91c7d10dbf..b5f1b492d0 100644 --- a/UI/Theme.cpp +++ b/UI/Theme.cpp @@ -167,9 +167,9 @@ static void LoadAtlasMetadata(Atlas &metadata, const char *filename, bool requir bool load_success = atlas_data != nullptr && metadata.Load(atlas_data, atlas_data_size); if (!load_success) { if (required) - ERROR_LOG(G3D, "Failed to load %s - graphics will be broken", filename); + ERROR_LOG(Log::G3D, "Failed to load %s - graphics will be broken", filename); else - WARN_LOG(G3D, "Failed to load %s", filename); + WARN_LOG(Log::G3D, "Failed to load %s", filename); // Stumble along with broken visuals instead of dying... } delete[] atlas_data; diff --git a/UI/TouchControlLayoutScreen.cpp b/UI/TouchControlLayoutScreen.cpp index 367fee910d..b41a8475fc 100644 --- a/UI/TouchControlLayoutScreen.cpp +++ b/UI/TouchControlLayoutScreen.cpp @@ -573,7 +573,7 @@ UI::EventReturn TouchControlLayoutScreen::OnVisibility(UI::EventParams &e) { } UI::EventReturn TouchControlLayoutScreen::OnReset(UI::EventParams &e) { - INFO_LOG(G3D, "Resetting touch control layout"); + INFO_LOG(Log::G3D, "Resetting touch control layout"); g_Config.ResetControlLayout(); const Bounds &bounds = screenManager()->getUIContext()->GetBounds(); InitPadLayout(bounds.w, bounds.h); diff --git a/UWP/PPSSPP_UWPMain.cpp b/UWP/PPSSPP_UWPMain.cpp index 1cc76530a3..11ce531a98 100644 --- a/UWP/PPSSPP_UWPMain.cpp +++ b/UWP/PPSSPP_UWPMain.cpp @@ -520,7 +520,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string // 'ChooseFile' will added '*' by default when there are no extensions assigned break; default: - ERROR_LOG(FILESYS, "Unexpected BrowseFileType: %d", param3); + ERROR_LOG(Log::FileSystem, "Unexpected BrowseFileType: %d", param3); return false; } @@ -652,7 +652,7 @@ std::string GetCPUBrandString() { } catch (const std::exception & e) { const char* what = e.what(); - INFO_LOG(SYSTEM, "%s", what); + INFO_LOG(Log::System, "%s", what); } if (cpu_id != nullptr) { @@ -674,7 +674,7 @@ std::string GetCPUBrandString() { } catch (const std::exception & e) { const char* what = e.what(); - INFO_LOG(SYSTEM, "%s", what); + INFO_LOG(Log::System, "%s", what); } } diff --git a/UWP/UWPHelpers/InputHelpers.cpp b/UWP/UWPHelpers/InputHelpers.cpp index c865ff1b77..485998a044 100644 --- a/UWP/UWPHelpers/InputHelpers.cpp +++ b/UWP/UWPHelpers/InputHelpers.cpp @@ -121,13 +121,13 @@ void ActivateTextEditInput(bool byFocus) { if (!isInputPaneVisible() && (isDPadActive() || !IsXBox())) { if (ShowInputPane()) { - DEBUG_LOG(COMMON, "Input pane: TryShow accepted"); + DEBUG_LOG(Log::Common, "Input pane: TryShow accepted"); } else { - DEBUG_LOG(COMMON, "Input pane: (TryShow is not accepted or not supported)"); + DEBUG_LOG(Log::Common, "Input pane: (TryShow is not accepted or not supported)"); } } - DEBUG_LOG(COMMON, "Text edit active"); + DEBUG_LOG(Log::Common, "Text edit active"); textEditActive = true; })); } @@ -140,14 +140,14 @@ void DeactivateTextEditInput(bool byFocus) { { if (isInputPaneVisible()) { if (HideInputPane()) { - DEBUG_LOG(COMMON, "Input pane: TryHide accepted"); + DEBUG_LOG(Log::Common, "Input pane: TryHide accepted"); } else { - DEBUG_LOG(COMMON, "Input pane: TryHide is not accepted, or not supported"); + DEBUG_LOG(Log::Common, "Input pane: TryHide is not accepted, or not supported"); } } if (isTextEditActive()) { - DEBUG_LOG(COMMON, "Text edit inactive"); + DEBUG_LOG(Log::Common, "Text edit inactive"); textEditActive = false; } })); diff --git a/UWP/UWPHelpers/LaunchItem.cpp b/UWP/UWPHelpers/LaunchItem.cpp index 4f06c173d3..e46bb5e219 100644 --- a/UWP/UWPHelpers/LaunchItem.cpp +++ b/UWP/UWPHelpers/LaunchItem.cpp @@ -60,7 +60,7 @@ public: if (arg->Name == "cmd") { auto command = FromPlatformString(arg->Value); - DEBUG_LOG(FILESYS, "Launch command %s", command.c_str()); + DEBUG_LOG(Log::FileSystem, "Launch command %s", command.c_str()); std::regex rgx("\"(.+[^\\/]+)\""); std::smatch match; @@ -73,12 +73,12 @@ public: catch (...) { launchPath = match[0]; } - DEBUG_LOG(FILESYS, "Launch target %s", launchPath.c_str()); + DEBUG_LOG(Log::FileSystem, "Launch target %s", launchPath.c_str()); } } else if (arg->Name == "launchOnExit") { launchOnExit = FromPlatformString(arg->Value); - DEBUG_LOG(FILESYS, "On exit URI %s", launchOnExit.c_str()); + DEBUG_LOG(Log::FileSystem, "On exit URI %s", launchOnExit.c_str()); } } } @@ -126,12 +126,12 @@ public: if (!launchOnExit.empty()) { if (callLaunchOnExit) { - DEBUG_LOG(FILESYS, "Calling back %s", launchOnExit.c_str()); + DEBUG_LOG(Log::FileSystem, "Calling back %s", launchOnExit.c_str()); auto uri = ref new Windows::Foundation::Uri(ToPlatformString(launchOnExit)); Windows::System::Launcher::LaunchUriAsync(uri); } else { - DEBUG_LOG(FILESYS, "Ignoring callback %s, due to callLaunchOnExit is false", launchOnExit.c_str()); + DEBUG_LOG(Log::FileSystem, "Ignoring callback %s, due to callLaunchOnExit is false", launchOnExit.c_str()); } } launchOnExit = std::string(); diff --git a/UWP/UWPHelpers/StorageAsync.h b/UWP/UWPHelpers/StorageAsync.h index 3f57a2457a..b55066d303 100644 --- a/UWP/UWPHelpers/StorageAsync.h +++ b/UWP/UWPHelpers/StorageAsync.h @@ -31,7 +31,7 @@ T TaskHandler(std::function()> wtask, T def) } catch (Platform::Exception^ exception_) { - ERROR_LOG(FILESYS, FromPlatformString(exception_->Message).c_str()); + ERROR_LOG(Log::FileSystem, FromPlatformString(exception_->Message).c_str()); } done = true; }); diff --git a/UWP/XAudioSoundStream.cpp b/UWP/XAudioSoundStream.cpp index 1e3ee6d0bb..070402598d 100644 --- a/UWP/XAudioSoundStream.cpp +++ b/UWP/XAudioSoundStream.cpp @@ -163,7 +163,7 @@ void XAudioBackend::PollLoop() { xaudioBuffer.AudioBytes = numBytesRendered; if FAILED(xaudioVoice->SubmitSourceBuffer(&xaudioBuffer, NULL)) { - WARN_LOG(AUDIO, "XAudioBackend: Failed writing bytes"); + WARN_LOG(Log::Audio, "XAudioBackend: Failed writing bytes"); } cursor_ += numBytesRendered; if (cursor_ >= BUFSIZE) { diff --git a/Windows/CaptureDevice.cpp b/Windows/CaptureDevice.cpp index 9b6683f614..93376078c8 100644 --- a/Windows/CaptureDevice.cpp +++ b/Windows/CaptureDevice.cpp @@ -244,7 +244,7 @@ HRESULT ReaderCallback::OnReadSample( delete videoBuffer; break; } - case CAPTUREDEVIDE_TYPE::AUDIO: { + case CAPTUREDEVIDE_TYPE::Audio: { BYTE *sampleBuf = nullptr; DWORD length = 0; u32 sizeAfterResample = 0; @@ -473,7 +473,7 @@ WindowsCaptureDevice::WindowsCaptureDevice(CAPTUREDEVIDE_TYPE _type) : case CAPTUREDEVIDE_TYPE::VIDEO: targetMediaParam = defaultVideoParam; break; - case CAPTUREDEVIDE_TYPE::AUDIO: + case CAPTUREDEVIDE_TYPE::Audio: targetMediaParam = defaultAudioParam; break; } @@ -489,7 +489,7 @@ WindowsCaptureDevice::~WindowsCaptureDevice() { av_freep(&imageRGB); av_freep(&imageJpeg); break; - case CAPTUREDEVIDE_TYPE::AUDIO: + case CAPTUREDEVIDE_TYPE::Audio: av_freep(&resampleBuf); break; } @@ -637,7 +637,7 @@ bool WindowsCaptureDevice::start(void *startParam) { break; } - case CAPTUREDEVIDE_TYPE::AUDIO: { + case CAPTUREDEVIDE_TYPE::Audio: { if (startParam) { std::vector *micParam = static_cast*>(startParam); targetMediaParam.sampleRate = micParam->at(0); @@ -823,7 +823,7 @@ HRESULT WindowsCaptureDevice::setDeviceParam(IMFMediaType *pType) { hr = GetDefaultStride(pType, &deviceParam.default_stride); break; - case CAPTUREDEVIDE_TYPE::AUDIO: + case CAPTUREDEVIDE_TYPE::Audio: hr = pType->GetGUID(MF_MT_SUBTYPE, &subtype); if (FAILED(hr)) break; @@ -912,7 +912,7 @@ void WindowsCaptureDevice::messageHandler() { if (type == CAPTUREDEVIDE_TYPE::VIDEO) { SetCurrentThreadName("Camera"); - } else if (type == CAPTUREDEVIDE_TYPE::AUDIO) { + } else if (type == CAPTUREDEVIDE_TYPE::Audio) { SetCurrentThreadName("Microphone"); } @@ -969,7 +969,7 @@ HRESULT WindowsCaptureDevice::enumDevices() { ); break; - case CAPTUREDEVIDE_TYPE::AUDIO: + case CAPTUREDEVIDE_TYPE::Audio: hr = pAttributes->SetGUID( MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE, MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_AUDCAP_GUID diff --git a/Windows/CaptureDevice.h b/Windows/CaptureDevice.h index d0ed3b4b5f..0107f3d774 100644 --- a/Windows/CaptureDevice.h +++ b/Windows/CaptureDevice.h @@ -50,7 +50,7 @@ struct AudioFormatTransform { enum class CAPTUREDEVIDE_TYPE { VIDEO, - AUDIO + Audio }; enum class CAPTUREDEVIDE_STATE { diff --git a/Windows/EmuThread.cpp b/Windows/EmuThread.cpp index 052253fbde..d560bd74da 100644 --- a/Windows/EmuThread.cpp +++ b/Windows/EmuThread.cpp @@ -116,7 +116,7 @@ static void EmuThreadStop() { static void EmuThreadJoin() { emuThread.join(); - INFO_LOG(SYSTEM, "EmuThreadJoin - joined"); + INFO_LOG(Log::System, "EmuThreadJoin - joined"); } bool CreateGraphicsBackend(std::string *error_message, GraphicsContext **ctx) { @@ -240,7 +240,7 @@ void MainThreadFunc() { std::string full_error = StringFromFormat("%.*s\n\n%s", (int)genericError.size(), genericError.data(), error_string.c_str()); std::wstring title = ConvertUTF8ToWString(err->T("GenericGraphicsError", "Graphics Error")); bool yes = IDYES == MessageBox(0, ConvertUTF8ToWString(full_error).c_str(), title.c_str(), MB_ICONERROR | MB_YESNO); - ERROR_LOG(BOOT, "%s", full_error.c_str()); + ERROR_LOG(Log::Boot, "%s", full_error.c_str()); if (yes) { // Change the config to the alternative and restart. @@ -268,10 +268,10 @@ void MainThreadFunc() { NativeResized(); } - DEBUG_LOG(BOOT, "Done."); + DEBUG_LOG(Log::Boot, "Done."); if (coreState == CORE_POWERDOWN) { - INFO_LOG(BOOT, "Exit before core loop."); + INFO_LOG(Log::Boot, "Exit before core loop."); goto shutdown; } diff --git a/Windows/GEDebugger/SimpleGLWindow.cpp b/Windows/GEDebugger/SimpleGLWindow.cpp index 3056d9fee3..eb21c5512b 100644 --- a/Windows/GEDebugger/SimpleGLWindow.cpp +++ b/Windows/GEDebugger/SimpleGLWindow.cpp @@ -116,7 +116,7 @@ void SimpleGLWindow::SetupGL() { pfd.cDepthBits = 16; pfd.iLayerType = PFD_MAIN_PLANE; -#define ENFORCE(x, msg) { if (!(x)) { ERROR_LOG(COMMON, "SimpleGLWindow: %s (%08x)", msg, (uint32_t)GetLastError()); return; } } +#define ENFORCE(x, msg) { if (!(x)) { ERROR_LOG(Log::Common, "SimpleGLWindow: %s (%08x)", msg, (uint32_t)GetLastError()); return; } } ENFORCE(hDC_ = GetDC(hWnd_), "Unable to create DC."); ENFORCE(pixelFormat = ChoosePixelFormat(hDC_, &pfd), "Unable to match pixel format."); diff --git a/Windows/GEDebugger/VertexPreview.cpp b/Windows/GEDebugger/VertexPreview.cpp index ea416aa0b3..f508037f49 100644 --- a/Windows/GEDebugger/VertexPreview.cpp +++ b/Windows/GEDebugger/VertexPreview.cpp @@ -286,11 +286,11 @@ void CGEDebugger::UpdatePrimPreview(u32 op, int which) { } if (prim_type >= 7) { - ERROR_LOG(G3D, "Unsupported prim type: %x", op); + ERROR_LOG(Log::G3D, "Unsupported prim type: %x", op); return; } if (!gpuDebug) { - ERROR_LOG(G3D, "Invalid debugging environment, shutting down?"); + ERROR_LOG(Log::G3D, "Invalid debugging environment, shutting down?"); return; } which &= previewsEnabled_; @@ -303,7 +303,7 @@ void CGEDebugger::UpdatePrimPreview(u32 op, int which) { static std::vector indices; if (!gpuDebug->GetCurrentSimpleVertices(count, vertices, indices)) { - ERROR_LOG(G3D, "Vertex preview not yet supported"); + ERROR_LOG(Log::G3D, "Vertex preview not yet supported"); return; } diff --git a/Windows/GPU/D3D9Context.cpp b/Windows/GPU/D3D9Context.cpp index 11ce38367a..e23eb562e0 100644 --- a/Windows/GPU/D3D9Context.cpp +++ b/Windows/GPU/D3D9Context.cpp @@ -35,7 +35,7 @@ bool D3D9Context::Init(HINSTANCE hInst, HWND wnd, std::string *error_message) { hD3D9_ = LoadLibrary(TEXT("d3d9.dll")); if (!hD3D9_) { - ERROR_LOG(G3D, "Missing d3d9.dll"); + ERROR_LOG(Log::G3D, "Missing d3d9.dll"); *error_message = "D3D9.dll missing - try reinstalling DirectX."; return false; } diff --git a/Windows/GPU/WindowsGLContext.cpp b/Windows/GPU/WindowsGLContext.cpp index e799a2e330..b61d26ad89 100644 --- a/Windows/GPU/WindowsGLContext.cpp +++ b/Windows/GPU/WindowsGLContext.cpp @@ -49,7 +49,7 @@ void WindowsGLContext::Poll() { resumeRequested = true; DWORD result = WaitForSingleObject(resumeEvent, INFINITE); if (result == WAIT_TIMEOUT) { - ERROR_LOG(G3D, "Wait for resume timed out. Resuming rendering"); + ERROR_LOG(Log::G3D, "Wait for resume timed out. Resuming rendering"); } pauseRequested = false; } @@ -66,7 +66,7 @@ void WindowsGLContext::Pause() { pauseRequested = true; DWORD result = WaitForSingleObject(pauseEvent, INFINITE); if (result == WAIT_TIMEOUT) { - ERROR_LOG(G3D, "Wait for pause timed out"); + ERROR_LOG(Log::G3D, "Wait for pause timed out"); } // OK, we now know the rendering thread is paused. } @@ -80,7 +80,7 @@ void WindowsGLContext::Resume() { } if (!resumeRequested) { - ERROR_LOG(G3D, "Not waiting to get resumed"); + ERROR_LOG(Log::G3D, "Not waiting to get resumed"); } else { SetEvent(resumeEvent); } @@ -156,18 +156,18 @@ void DebugCallbackARB(GLenum source, GLenum type, GLuint id, GLenum severity, case GL_DEBUG_TYPE_ERROR_ARB: case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: - ERROR_LOG(G3D, "GL: %s", finalMessage); + ERROR_LOG(Log::G3D, "GL: %s", finalMessage); break; case GL_DEBUG_TYPE_PORTABILITY_ARB: case GL_DEBUG_TYPE_PERFORMANCE_ARB: - NOTICE_LOG(G3D, "GL: %s", finalMessage); + NOTICE_LOG(Log::G3D, "GL: %s", finalMessage); break; case GL_DEBUG_TYPE_OTHER_ARB: default: // These are just performance warnings. - VERBOSE_LOG(G3D, "GL: %s", finalMessage); + VERBOSE_LOG(Log::G3D, "GL: %s", finalMessage); break; } } @@ -383,21 +383,21 @@ bool WindowsGLContext::InitFromRenderThread(std::string *error_message) { glGetError(); glDebugMessageCallback((GLDEBUGPROC)&DebugCallbackARB, nullptr); if (glGetError()) { - ERROR_LOG(G3D, "Failed to register a debug log callback"); + ERROR_LOG(Log::G3D, "Failed to register a debug log callback"); } glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); if (glGetError()) { - ERROR_LOG(G3D, "Failed to enable synchronous debug output"); + ERROR_LOG(Log::G3D, "Failed to enable synchronous debug output"); } } else if (glewIsSupported("GL_ARB_debug_output")) { glGetError(); glDebugMessageCallbackARB((GLDEBUGPROCARB)&DebugCallbackARB, 0); // print debug output to stderr if (glGetError()) { - ERROR_LOG(G3D, "Failed to register a debug log callback"); + ERROR_LOG(Log::G3D, "Failed to register a debug log callback"); } glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); if (glGetError()) { - ERROR_LOG(G3D, "Failed to enable synchronous debug output"); + ERROR_LOG(Log::G3D, "Failed to enable synchronous debug output"); } // For extra verbosity uncomment this (MEDIUM and HIGH are on by default): diff --git a/Windows/MainWindow.cpp b/Windows/MainWindow.cpp index 0a1016e0ae..e13990973a 100644 --- a/Windows/MainWindow.cpp +++ b/Windows/MainWindow.cpp @@ -292,7 +292,7 @@ namespace MainWindow PSP_CoreParameter().pixelHeight = height; } - DEBUG_LOG(SYSTEM, "Pixel width/height: %dx%d", PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight); + DEBUG_LOG(Log::System, "Pixel width/height: %dx%d", PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight); if (UpdateScreenScale(width, height)) { System_PostUIMessage(UIMessage::GPU_DISPLAY_RESIZED); diff --git a/Windows/PPSSPP.vcxproj b/Windows/PPSSPP.vcxproj index f9dddd9731..031296a483 100644 --- a/Windows/PPSSPP.vcxproj +++ b/Windows/PPSSPP.vcxproj @@ -1334,6 +1334,7 @@ true true + true @@ -1683,6 +1684,7 @@ true + true true diff --git a/Windows/PPSSPP.vcxproj.filters b/Windows/PPSSPP.vcxproj.filters index 1c228494e9..b1b0525a34 100644 --- a/Windows/PPSSPP.vcxproj.filters +++ b/Windows/PPSSPP.vcxproj.filters @@ -580,6 +580,9 @@ Other Platforms\Mac + + Other Platforms\iOS + @@ -815,6 +818,9 @@ Other Platforms\Mac + + Other Platforms\iOS + diff --git a/Windows/RawInput.cpp b/Windows/RawInput.cpp index 81f833681e..a8e7ceea01 100644 --- a/Windows/RawInput.cpp +++ b/Windows/RawInput.cpp @@ -196,7 +196,7 @@ namespace WindowsRawInput { dev[2].dwFlags = 0; if (!RegisterRawInputDevices(dev, 3, sizeof(RAWINPUTDEVICE))) { - WARN_LOG(SYSTEM, "Unable to register raw input devices: %s", GetLastErrorMsg().c_str()); + WARN_LOG(Log::System, "Unable to register raw input devices: %s", GetLastErrorMsg().c_str()); } } diff --git a/Windows/TouchInputHandler.cpp b/Windows/TouchInputHandler.cpp index 56b91c5275..ff359a01db 100644 --- a/Windows/TouchInputHandler.cpp +++ b/Windows/TouchInputHandler.cpp @@ -90,7 +90,7 @@ void TouchInputHandler::handleTouchEvent(HWND hWnd, UINT message, WPARAM wParam, } closeTouch(touchInputData); } else { - WARN_LOG(SYSTEM, "Failed to read input data: %s", GetLastErrorMsg().c_str()); + WARN_LOG(Log::System, "Failed to read input data: %s", GetLastErrorMsg().c_str()); } delete [] inputs; } diff --git a/Windows/WASAPIStream.cpp b/Windows/WASAPIStream.cpp index 2844934eb5..034bdafd74 100644 --- a/Windows/WASAPIStream.cpp +++ b/Windows/WASAPIStream.cpp @@ -54,7 +54,7 @@ public: } if (currentDevice_) { - INFO_LOG(SCEAUDIO, "Switching to WASAPI audio device: '%s'", GetDeviceName(currentDevice_).c_str()); + INFO_LOG(Log::sceAudio, "Switching to WASAPI audio device: '%s'", GetDeviceName(currentDevice_).c_str()); } deviceChanged_ = false; @@ -112,7 +112,7 @@ public: } deviceChanged_ = true; - INFO_LOG(SCEAUDIO, "New default eRender/eConsole WASAPI audio device detected: '%s'", GetDeviceName(pwstrDeviceId).c_str()); + INFO_LOG(Log::sceAudio, "New default eRender/eConsole WASAPI audio device detected: '%s'", GetDeviceName(pwstrDeviceId).c_str()); return S_OK; } @@ -132,7 +132,7 @@ public: } HRESULT STDMETHODCALLTYPE OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key) override { - INFO_LOG(SCEAUDIO, "Changed audio device property " + INFO_LOG(Log::sceAudio, "Changed audio device property " "{%8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x}#%d", (uint32_t)key.fmtid.Data1, key.fmtid.Data2, key.fmtid.Data3, key.fmtid.Data4[0], key.fmtid.Data4[1], @@ -368,14 +368,14 @@ bool WASAPIAudioThread::DetectFormat() { } else { wchar_t guid[256]{}; StringFromGUID2(closest->SubFormat, guid, 256); - ERROR_LOG_REPORT_ONCE(badfallbackclosest, SCEAUDIO, "WASAPI fallback and closest unsupported (fmt=%04x/%s)", closest->Format.wFormatTag, guid); + ERROR_LOG_REPORT_ONCE(badfallbackclosest, Log::sceAudio, "WASAPI fallback and closest unsupported (fmt=%04x/%s)", closest->Format.wFormatTag, guid); CoTaskMemFree(closest); return false; } } else { CoTaskMemFree(closest); if (hr != AUDCLNT_E_DEVICE_INVALIDATED && hr != AUDCLNT_E_SERVICE_NOT_RUNNING) - ERROR_LOG_REPORT_ONCE(badfallback, SCEAUDIO, "WASAPI fallback format was unsupported (%08x)", hr); + ERROR_LOG_REPORT_ONCE(badfallback, Log::sceAudio, "WASAPI fallback format was unsupported (%08x)", hr); return false; } } @@ -397,7 +397,7 @@ bool WASAPIAudioThread::ValidateFormat(const WAVEFORMATEXTENSIBLE *fmt) { } else { wchar_t guid[256]{}; StringFromGUID2(fmt->SubFormat, guid, 256); - ERROR_LOG_REPORT_ONCE(unexpectedformat, SCEAUDIO, "Got unexpected WASAPI 0xFFFE stream format (%S), expected float!", guid); + ERROR_LOG_REPORT_ONCE(unexpectedformat, Log::sceAudio, "Got unexpected WASAPI 0xFFFE stream format (%S), expected float!", guid); if (fmt->Format.wBitsPerSample == 16 && fmt->Format.nChannels == 2) { format_ = Format::PCM16; } @@ -406,7 +406,7 @@ bool WASAPIAudioThread::ValidateFormat(const WAVEFORMATEXTENSIBLE *fmt) { if (fmt->Format.nChannels >= 1) format_ = Format::IEEE_FLOAT; } else { - ERROR_LOG_REPORT_ONCE(unexpectedformat2, SCEAUDIO, "Got unexpected non-extensible WASAPI stream format, expected extensible float!"); + ERROR_LOG_REPORT_ONCE(unexpectedformat2, Log::sceAudio, "Got unexpected non-extensible WASAPI stream format, expected extensible float!"); if (fmt->Format.wBitsPerSample == 16 && fmt->Format.nChannels == 2) { format_ = Format::PCM16; } @@ -453,7 +453,7 @@ void WASAPIAudioThread::Run() { return; if (!ActivateDefaultDevice()) { - ERROR_LOG(SCEAUDIO, "WASAPI: Could not activate default device"); + ERROR_LOG(Log::sceAudio, "WASAPI: Could not activate default device"); return; } @@ -467,17 +467,17 @@ void WASAPIAudioThread::Run() { } if (!InitAudioDevice()) { - ERROR_LOG(SCEAUDIO, "WASAPI: Could not init audio device"); + ERROR_LOG(Log::sceAudio, "WASAPI: Could not init audio device"); return; } if (!PrepareFormat()) { - ERROR_LOG(SCEAUDIO, "WASAPI: Could not find a suitable audio output format"); + ERROR_LOG(Log::sceAudio, "WASAPI: Could not find a suitable audio output format"); return; } hresult = audioInterface_->Start(); if (FAILED(hresult)) { - ERROR_LOG(SCEAUDIO, "WASAPI: Failed to start audio stream"); + ERROR_LOG(Log::sceAudio, "WASAPI: Failed to start audio stream"); return; } @@ -542,23 +542,23 @@ void WASAPIAudioThread::Run() { ShutdownAudioDevice(); if (!ActivateDefaultDevice()) { - ERROR_LOG(SCEAUDIO, "WASAPI: Could not activate default device"); + ERROR_LOG(Log::sceAudio, "WASAPI: Could not activate default device"); // TODO: Return to the old device here? return; } notificationClient_->SetCurrentDevice(device_); if (!InitAudioDevice()) { - ERROR_LOG(SCEAUDIO, "WASAPI: Could not init audio device"); + ERROR_LOG(Log::sceAudio, "WASAPI: Could not init audio device"); return; } if (!PrepareFormat()) { - ERROR_LOG(SCEAUDIO, "WASAPI: Could not find a suitable audio output format"); + ERROR_LOG(Log::sceAudio, "WASAPI: Could not find a suitable audio output format"); return; } hresult = audioInterface_->Start(); if (FAILED(hresult)) { - ERROR_LOG(SCEAUDIO, "WASAPI: Failed to start audio stream"); + ERROR_LOG(Log::sceAudio, "WASAPI: Failed to start audio stream"); return; } } @@ -569,7 +569,7 @@ void WASAPIAudioThread::Run() { hresult = audioInterface_->Stop(); if (FAILED(hresult)) { - ERROR_LOG(SCEAUDIO, "WASAPI: Failed to stop audio stream"); + ERROR_LOG(Log::sceAudio, "WASAPI: Failed to stop audio stream"); } } diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index 2e3e8809e7..7216a8a10f 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -82,7 +82,7 @@ void WindowsInputManager::PollControllers() { #ifndef _M_ARM size_t newCount = DinputDevice::getNumPads(); if (newCount > numDinputDevices_) { - INFO_LOG(SYSTEM, "New controller device detected"); + INFO_LOG(Log::System, "New controller device detected"); for (size_t i = numDinputDevices_; i < newCount; i++) { input.push_back(std::make_unique(static_cast(i))); } diff --git a/Windows/XinputDevice.cpp b/Windows/XinputDevice.cpp index 7ad79255ef..e6a19b4c42 100644 --- a/Windows/XinputDevice.cpp +++ b/Windows/XinputDevice.cpp @@ -144,7 +144,7 @@ static const struct { int from; InputKeyCode to; } xinput_ctrl_map[] = { XinputDevice::XinputDevice() { if (LoadXInputDLL() != 0) { - WARN_LOG(SCECTRL, "Failed to load XInput! DLL missing"); + WARN_LOG(Log::sceCtrl, "Failed to load XInput! DLL missing"); } for (size_t i = 0; i < ARRAY_SIZE(check_delay); ++i) { diff --git a/Windows/main.cpp b/Windows/main.cpp index 6eccff9cd7..b7bc133151 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -654,7 +654,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string icoPath = iconFolder / (info->id + ".ico"); if (!File::Exists(icoPath)) { if (!W32Util::CreateICOFromPNGData((const uint8_t *)info->icon.data.data(), info->icon.data.size(), icoPath)) { - ERROR_LOG(SYSTEM, "ICO creation failed"); + ERROR_LOG(Log::System, "ICO creation failed"); icoPath.clear(); } } @@ -740,7 +740,7 @@ static bool DetectVulkanInExternalProcess() { if (W32Util::ExecuteAndGetReturnCode(moduleFilename.c_str(), cmdline, workingDirectory.c_str(), &exitCode)) { return exitCode == EXIT_CODE_VULKAN_WORKS; } else { - ERROR_LOG(G3D, "Failed to detect Vulkan in external process somehow"); + ERROR_LOG(Log::G3D, "Failed to detect Vulkan in external process somehow"); return false; } } @@ -808,7 +808,7 @@ static void InitMemstickDirectory() { if (!File::Exists(g_Config.memStickDirectory)) { if (!File::CreateDir(g_Config.memStickDirectory)) g_Config.memStickDirectory = myDocsPath; - INFO_LOG(COMMON, "Memstick directory not present, creating at '%s'", g_Config.memStickDirectory.c_str()); + INFO_LOG(Log::Common, "Memstick directory not present, creating at '%s'", g_Config.memStickDirectory.c_str()); } Path testFile = g_Config.memStickDirectory / "_writable_test.$$$"; diff --git a/android/jni/AndroidAudio.cpp b/android/jni/AndroidAudio.cpp index e7d699068a..4d80779177 100644 --- a/android/jni/AndroidAudio.cpp +++ b/android/jni/AndroidAudio.cpp @@ -45,42 +45,42 @@ AndroidAudioState *AndroidAudio_Init(AndroidAudioCallback callback, int optimalF bool AndroidAudio_Recording_SetSampleRate(AndroidAudioState *state, int sampleRate) { if (!state) { - ERROR_LOG(AUDIO, "AndroidAudioState not initialized, cannot set recording sample rate"); + ERROR_LOG(Log::Audio, "AndroidAudioState not initialized, cannot set recording sample rate"); return false; } state->input_sample_rate = sampleRate; - INFO_LOG(AUDIO, "AndroidAudio_Recording_SetSampleRate=%d", sampleRate); + INFO_LOG(Log::Audio, "AndroidAudio_Recording_SetSampleRate=%d", sampleRate); return true; } bool AndroidAudio_Recording_Start(AndroidAudioState *state) { if (!state) { - ERROR_LOG(AUDIO, "AndroidAudioState not initialized, cannot start recording!"); + ERROR_LOG(Log::Audio, "AndroidAudioState not initialized, cannot start recording!"); return false; } state->input_enable = 1; if (!state->ctx) { - ERROR_LOG(AUDIO, "OpenSLContext not initialized, cannot start recording!"); + ERROR_LOG(Log::Audio, "OpenSLContext not initialized, cannot start recording!"); return false; } state->ctx->AudioRecord_Start(state->input_sample_rate); - INFO_LOG(AUDIO, "AndroidAudio_Recording_Start"); + INFO_LOG(Log::Audio, "AndroidAudio_Recording_Start"); return true; } bool AndroidAudio_Recording_Stop(AndroidAudioState *state) { if (!state) { - ERROR_LOG(AUDIO, "AndroidAudioState not initialized, cannot stop recording!"); + ERROR_LOG(Log::Audio, "AndroidAudioState not initialized, cannot stop recording!"); return false; } if (!state->ctx) { - ERROR_LOG(AUDIO, "OpenSLContext not initialized, cannot stop recording!"); + ERROR_LOG(Log::Audio, "OpenSLContext not initialized, cannot stop recording!"); return false; } state->input_enable = 0; state->input_sample_rate = 0; state->ctx->AudioRecord_Stop(); - INFO_LOG(AUDIO, "AndroidAudio_Recording_Stop"); + INFO_LOG(Log::Audio, "AndroidAudio_Recording_Stop"); return true; } @@ -93,13 +93,13 @@ bool AndroidAudio_Recording_State(AndroidAudioState *state) { bool AndroidAudio_Resume(AndroidAudioState *state) { if (!state) { - ERROR_LOG(AUDIO, "Audio was shutdown, cannot resume!"); + ERROR_LOG(Log::Audio, "Audio was shutdown, cannot resume!"); return false; } if (!state->ctx) { - INFO_LOG(AUDIO, "Calling OpenSLWrap_Init_T..."); + INFO_LOG(Log::Audio, "Calling OpenSLWrap_Init_T..."); state->ctx = new OpenSLContext(state->callback, state->frames_per_buffer, state->sample_rate); - INFO_LOG(AUDIO, "Returned from OpenSLWrap_Init_T"); + INFO_LOG(Log::Audio, "Returned from OpenSLWrap_Init_T"); bool init_retval = state->ctx->Init(); if (!init_retval) { delete state->ctx; @@ -115,14 +115,14 @@ bool AndroidAudio_Resume(AndroidAudioState *state) { bool AndroidAudio_Pause(AndroidAudioState *state) { if (!state) { - ERROR_LOG(AUDIO, "Audio was shutdown, cannot pause!"); + ERROR_LOG(Log::Audio, "Audio was shutdown, cannot pause!"); return false; } if (state->ctx) { - INFO_LOG(AUDIO, "Calling OpenSLWrap_Shutdown_T..."); + INFO_LOG(Log::Audio, "Calling OpenSLWrap_Shutdown_T..."); delete state->ctx; state->ctx = nullptr; - INFO_LOG(AUDIO, "Returned from OpenSLWrap_Shutdown_T ..."); + INFO_LOG(Log::Audio, "Returned from OpenSLWrap_Shutdown_T ..."); return true; } return false; @@ -130,15 +130,15 @@ bool AndroidAudio_Pause(AndroidAudioState *state) { bool AndroidAudio_Shutdown(AndroidAudioState *state) { if (!state) { - ERROR_LOG(AUDIO, "Audio already shutdown!"); + ERROR_LOG(Log::Audio, "Audio already shutdown!"); return false; } if (state->ctx) { - ERROR_LOG(AUDIO, "Should not shut down when playing! Something is wrong!"); + ERROR_LOG(Log::Audio, "Should not shut down when playing! Something is wrong!"); return false; } delete state; - INFO_LOG(AUDIO, "OpenSLWrap completely unloaded."); + INFO_LOG(Log::Audio, "OpenSLWrap completely unloaded."); return true; } diff --git a/android/jni/AndroidJavaGLContext.cpp b/android/jni/AndroidJavaGLContext.cpp index 84010df9c4..12e4862592 100644 --- a/android/jni/AndroidJavaGLContext.cpp +++ b/android/jni/AndroidJavaGLContext.cpp @@ -11,9 +11,9 @@ AndroidJavaEGLGraphicsContext::AndroidJavaEGLGraphicsContext() { } bool AndroidJavaEGLGraphicsContext::InitFromRenderThread(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) { - INFO_LOG(G3D, "AndroidJavaEGLGraphicsContext::InitFromRenderThread"); + INFO_LOG(Log::G3D, "AndroidJavaEGLGraphicsContext::InitFromRenderThread"); if (!CheckGLExtensions()) { - ERROR_LOG(G3D, "CheckGLExtensions failed - not gonna attempt starting up."); + ERROR_LOG(Log::G3D, "CheckGLExtensions failed - not gonna attempt starting up."); state_ = GraphicsContextState::FAILED_INIT; return false; } @@ -37,7 +37,7 @@ bool AndroidJavaEGLGraphicsContext::InitFromRenderThread(ANativeWindow *wnd, int } void AndroidJavaEGLGraphicsContext::ShutdownFromRenderThread() { - INFO_LOG(G3D, "AndroidJavaEGLGraphicsContext::Shutdown"); + INFO_LOG(Log::G3D, "AndroidJavaEGLGraphicsContext::Shutdown"); renderManager_ = nullptr; // owned by draw_. delete draw_; draw_ = nullptr; diff --git a/android/jni/AndroidVulkanContext.cpp b/android/jni/AndroidVulkanContext.cpp index e11a05c4ab..e021194f55 100644 --- a/android/jni/AndroidVulkanContext.cpp +++ b/android/jni/AndroidVulkanContext.cpp @@ -42,19 +42,19 @@ AndroidVulkanContext::~AndroidVulkanContext() { } bool AndroidVulkanContext::InitAPI() { - INFO_LOG(G3D, "AndroidVulkanContext::Init"); + INFO_LOG(Log::G3D, "AndroidVulkanContext::Init"); init_glslang(); g_LogOptions.breakOnError = true; g_LogOptions.breakOnWarning = true; g_LogOptions.msgBoxOnError = false; - INFO_LOG(G3D, "Creating Vulkan context"); + INFO_LOG(Log::G3D, "Creating Vulkan context"); Version gitVer(PPSSPP_GIT_VERSION); std::string errorStr; if (!VulkanLoad(&errorStr)) { - ERROR_LOG(G3D, "Failed to load Vulkan driver library: %s", errorStr.c_str()); + ERROR_LOG(Log::G3D, "Failed to load Vulkan driver library: %s", errorStr.c_str()); state_ = GraphicsContextState::FAILED_INIT; return false; } @@ -75,21 +75,21 @@ bool AndroidVulkanContext::InitAPI() { return false; } - INFO_LOG(G3D, "Vulkan device created!"); + INFO_LOG(Log::G3D, "Vulkan device created!"); state_ = GraphicsContextState::INITIALIZED; return true; } bool AndroidVulkanContext::InitFromRenderThread(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) { - INFO_LOG(G3D, "AndroidVulkanContext::InitFromRenderThread: desiredwidth=%d desiredheight=%d", desiredBackbufferSizeX, desiredBackbufferSizeY); + INFO_LOG(Log::G3D, "AndroidVulkanContext::InitFromRenderThread: desiredwidth=%d desiredheight=%d", desiredBackbufferSizeX, desiredBackbufferSizeY); if (!g_Vulkan) { - ERROR_LOG(G3D, "AndroidVulkanContext::InitFromRenderThread: No Vulkan context"); + ERROR_LOG(Log::G3D, "AndroidVulkanContext::InitFromRenderThread: No Vulkan context"); return false; } VkResult res = g_Vulkan->InitSurface(WINDOWSYSTEM_ANDROID, (void *)wnd, nullptr); if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "g_Vulkan->InitSurface failed: '%s'", VulkanResultToString(res)); + ERROR_LOG(Log::G3D, "g_Vulkan->InitSurface failed: '%s'", VulkanResultToString(res)); return false; } @@ -112,7 +112,7 @@ bool AndroidVulkanContext::InitFromRenderThread(ANativeWindow *wnd, int desiredB success = false; } - INFO_LOG(G3D, "AndroidVulkanContext::Init completed, %s", success ? "successfully" : "but failed"); + INFO_LOG(Log::G3D, "AndroidVulkanContext::Init completed, %s", success ? "successfully" : "but failed"); if (!success) { g_Vulkan->DestroySwapchain(); g_Vulkan->DestroySurface(); @@ -123,7 +123,7 @@ bool AndroidVulkanContext::InitFromRenderThread(ANativeWindow *wnd, int desiredB } void AndroidVulkanContext::ShutdownFromRenderThread() { - INFO_LOG(G3D, "AndroidVulkanContext::Shutdown"); + INFO_LOG(Log::G3D, "AndroidVulkanContext::Shutdown"); draw_->HandleEvent(Draw::Event::LOST_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); delete draw_; draw_ = nullptr; @@ -131,20 +131,20 @@ void AndroidVulkanContext::ShutdownFromRenderThread() { g_Vulkan->PerformPendingDeletes(); g_Vulkan->DestroySwapchain(); g_Vulkan->DestroySurface(); - INFO_LOG(G3D, "Done with ShutdownFromRenderThread"); + INFO_LOG(Log::G3D, "Done with ShutdownFromRenderThread"); } void AndroidVulkanContext::Shutdown() { - INFO_LOG(G3D, "Calling NativeShutdownGraphics"); + INFO_LOG(Log::G3D, "Calling NativeShutdownGraphics"); g_Vulkan->DestroyDevice(); g_Vulkan->DestroyInstance(); // We keep the g_Vulkan context around to avoid invalidating a ton of pointers around the app. finalize_glslang(); - INFO_LOG(G3D, "AndroidVulkanContext::Shutdown completed"); + INFO_LOG(Log::G3D, "AndroidVulkanContext::Shutdown completed"); } void AndroidVulkanContext::Resize() { - INFO_LOG(G3D, "AndroidVulkanContext::Resize begin (oldsize: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); + INFO_LOG(Log::G3D, "AndroidVulkanContext::Resize begin (oldsize: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); draw_->HandleEvent(Draw::Event::LOST_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); g_Vulkan->DestroySwapchain(); @@ -155,5 +155,5 @@ void AndroidVulkanContext::Resize() { g_Vulkan->ReinitSurface(); g_Vulkan->InitSwapchain(); draw_->HandleEvent(Draw::Event::GOT_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); - INFO_LOG(G3D, "AndroidVulkanContext::Resize end (final size: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); + INFO_LOG(Log::G3D, "AndroidVulkanContext::Resize end (final size: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); } diff --git a/android/jni/Arm64EmitterTest.cpp b/android/jni/Arm64EmitterTest.cpp index 3a04f6fb18..e49658cfda 100644 --- a/android/jni/Arm64EmitterTest.cpp +++ b/android/jni/Arm64EmitterTest.cpp @@ -66,11 +66,11 @@ void Arm64EmitterTest() { return; for (int i = 0; i < 6; i++) { - INFO_LOG(SYSTEM, "---------------------------"); + INFO_LOG(Log::System, "---------------------------"); } - INFO_LOG(SYSTEM, "---------------------------"); - INFO_LOG(SYSTEM, "Running ARM64 emitter test!"); - INFO_LOG(SYSTEM, "---------------------------"); + INFO_LOG(Log::System, "---------------------------"); + INFO_LOG(Log::System, "Running ARM64 emitter test!"); + INFO_LOG(Log::System, "---------------------------"); TestCode gen; gen.ReserveCodeSpace(0x1000); @@ -78,15 +78,15 @@ void Arm64EmitterTest() { gen.Generate(); u32 retval = CallPtr(gen.testCodePtr); - INFO_LOG(SYSTEM, "Returned %d", retval); - // INFO_LOG(SYSTEM, "ARM emitter test 1 passed if %f == 3.0! retval = %08x", abc[32 + 31], retval); + INFO_LOG(Log::System, "Returned %d", retval); + // INFO_LOG(Log::System, "ARM emitter test 1 passed if %f == 3.0! retval = %08x", abc[32 + 31], retval); /* - INFO_LOG(SYSTEM, "x: %08x %08x %08x %08x", x[0], x[1], x[2], x[3]); - INFO_LOG(SYSTEM, "y: %08x %08x %08x %08x", y[0], y[1], y[2], y[3]); - INFO_LOG(SYSTEM, "z: %08x %08x %08x %08x", z[0], z[1], z[2], z[3]); - INFO_LOG(SYSTEM, "c: %f %f %f %f", c[0], c[1], c[2], c[3]);*/ + INFO_LOG(Log::System, "x: %08x %08x %08x %08x", x[0], x[1], x[2], x[3]); + INFO_LOG(Log::System, "y: %08x %08x %08x %08x", y[0], y[1], y[2], y[3]); + INFO_LOG(Log::System, "z: %08x %08x %08x %08x", z[0], z[1], z[2], z[3]); + INFO_LOG(Log::System, "c: %f %f %f %f", c[0], c[1], c[2], c[3]);*/ for (int i = 0; i < 6; i++) { - INFO_LOG(SYSTEM, "--------------------------"); + INFO_LOG(Log::System, "--------------------------"); } // DisassembleArm(codeStart, gen.GetCodePtr()-codeStart); } diff --git a/android/jni/ArmEmitterTest.cpp b/android/jni/ArmEmitterTest.cpp index 5af9643f07..fe9d06b725 100644 --- a/android/jni/ArmEmitterTest.cpp +++ b/android/jni/ArmEmitterTest.cpp @@ -69,7 +69,7 @@ void TestCode::Generate() VST1(I_32, D6, R3, 2); PLD(R1, 32); u32 word = *(u32 *)(GetCodePtr() - 4); - INFO_LOG(SYSTEM, "Instruction Word: %08x", word); + INFO_LOG(Log::System, "Instruction Word: %08x", word); // This works! @@ -121,11 +121,11 @@ void ArmEmitterTest() return; for (int i = 0; i < 6; i++) { - INFO_LOG(SYSTEM, "--------------------------"); + INFO_LOG(Log::System, "--------------------------"); } - INFO_LOG(SYSTEM, "--------------------------"); - INFO_LOG(SYSTEM, "Running ARM emitter test!"); - INFO_LOG(SYSTEM, "--------------------------"); + INFO_LOG(Log::System, "--------------------------"); + INFO_LOG(Log::System, "Running ARM emitter test!"); + INFO_LOG(Log::System, "--------------------------"); TestCode gen; gen.ReserveCodeSpace(0x1000); @@ -133,13 +133,13 @@ void ArmEmitterTest() gen.Generate(); u32 retval = CallPtr(gen.testCodePtr); - // INFO_LOG(SYSTEM, "ARM emitter test 1 passed if %f == 3.0! retval = %08x", abc[32 + 31], retval); - INFO_LOG(SYSTEM, "x: %08x %08x %08x %08x", x[0], x[1], x[2], x[3]); - INFO_LOG(SYSTEM, "y: %08x %08x %08x %08x", y[0], y[1], y[2], y[3]); - INFO_LOG(SYSTEM, "z: %08x %08x %08x %08x", z[0], z[1], z[2], z[3]); - INFO_LOG(SYSTEM, "c: %f %f %f %f", c[0], c[1], c[2], c[3]); + // INFO_LOG(Log::System, "ARM emitter test 1 passed if %f == 3.0! retval = %08x", abc[32 + 31], retval); + INFO_LOG(Log::System, "x: %08x %08x %08x %08x", x[0], x[1], x[2], x[3]); + INFO_LOG(Log::System, "y: %08x %08x %08x %08x", y[0], y[1], y[2], y[3]); + INFO_LOG(Log::System, "z: %08x %08x %08x %08x", z[0], z[1], z[2], z[3]); + INFO_LOG(Log::System, "c: %f %f %f %f", c[0], c[1], c[2], c[3]); for (int i = 0; i < 6; i++) { - INFO_LOG(SYSTEM, "--------------------------"); + INFO_LOG(Log::System, "--------------------------"); } // DisassembleArm(codeStart, gen.GetCodePtr()-codeStart); } diff --git a/android/jni/OpenSLContext.cpp b/android/jni/OpenSLContext.cpp index c5ebffbe6a..32d951b854 100644 --- a/android/jni/OpenSLContext.cpp +++ b/android/jni/OpenSLContext.cpp @@ -45,7 +45,7 @@ void OpenSLContext::bqPlayerCallbackWrap(SLAndroidSimpleBufferQueueItf bq, void void OpenSLContext::BqPlayerCallback(SLAndroidSimpleBufferQueueItf bq) { if (bq != bqPlayerBufferQueue) { - ERROR_LOG(AUDIO, "OpenSL: Wrong bq!"); + ERROR_LOG(Log::Audio, "OpenSL: Wrong bq!"); return; } @@ -64,7 +64,7 @@ void OpenSLContext::BqPlayerCallback(SLAndroidSimpleBufferQueueItf bq) { // the most likely other result is SL_RESULT_BUFFER_INSUFFICIENT, // which for this code example would indicate a programming error if (result != SL_RESULT_SUCCESS) { - ERROR_LOG(AUDIO, "OpenSL: Failed to enqueue! %i %i", renderedFrames, sizeInBytes); + ERROR_LOG(Log::Audio, "OpenSL: Failed to enqueue! %i %i", renderedFrames, sizeInBytes); } curBuffer += 1; // Switch buffer @@ -131,7 +131,7 @@ bool OpenSLContext::Init() { result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, sizeof(ids)/sizeof(ids[0]), ids, req); if (result != SL_RESULT_SUCCESS) { - ERROR_LOG(AUDIO, "OpenSL: CreateAudioPlayer failed: %d", (int)result); + ERROR_LOG(Log::Audio, "OpenSL: CreateAudioPlayer failed: %d", (int)result); (*outputMixObject)->Destroy(outputMixObject); outputMixObject = nullptr; @@ -269,13 +269,13 @@ bool OpenSLContext::AudioRecord_Stop() { // shut down the native audio system OpenSLContext::~OpenSLContext() { if (bqPlayerPlay) { - INFO_LOG(AUDIO, "OpenSL: Shutdown - stopping playback"); + INFO_LOG(Log::Audio, "OpenSL: Shutdown - stopping playback"); SLresult result; result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_STOPPED); CheckResult(result, "SetPlayState(stopped) failed"); } - INFO_LOG(AUDIO, "OpenSL: Shutdown - deleting player object"); + INFO_LOG(Log::Audio, "OpenSL: Shutdown - deleting player object"); if (bqPlayerObject) { (*bqPlayerObject)->Destroy(bqPlayerObject); @@ -285,7 +285,7 @@ OpenSLContext::~OpenSLContext() { bqPlayerVolume = nullptr; } - INFO_LOG(AUDIO, "OpenSL: Shutdown - deleting mix object"); + INFO_LOG(Log::Audio, "OpenSL: Shutdown - deleting mix object"); if (outputMixObject) { (*outputMixObject)->Destroy(outputMixObject); @@ -293,7 +293,7 @@ OpenSLContext::~OpenSLContext() { } AudioRecord_Stop(); - INFO_LOG(AUDIO, "OpenSL: Shutdown - deleting engine object"); + INFO_LOG(Log::Audio, "OpenSL: Shutdown - deleting engine object"); if (engineObject) { (*engineObject)->Destroy(engineObject); @@ -305,12 +305,12 @@ OpenSLContext::~OpenSLContext() { delete[] buffer[i]; buffer[i] = nullptr; } - INFO_LOG(AUDIO, "OpenSL: Shutdown - finished"); + INFO_LOG(Log::Audio, "OpenSL: Shutdown - finished"); } bool OpenSLContext::CheckResult(SLresult result, const char *str) { if (result != SL_RESULT_SUCCESS) { - ERROR_LOG(AUDIO, "OpenSL failure (%s): %d", str, result); + ERROR_LOG(Log::Audio, "OpenSL failure (%s): %d", str, result); SetErrorString(str); return false; } else { @@ -320,7 +320,7 @@ bool OpenSLContext::CheckResult(SLresult result, const char *str) { bool OpenSLContext::CheckResultStatic(SLresult result, const char *str) { if (result != SL_RESULT_SUCCESS) { - ERROR_LOG(AUDIO, "OpenSL failure (%s): %d", str, result); + ERROR_LOG(Log::Audio, "OpenSL failure (%s): %d", str, result); return false; } else { return true; diff --git a/android/jni/TestRunner.cpp b/android/jni/TestRunner.cpp index 3fc0059df7..2be5918de2 100644 --- a/android/jni/TestRunner.cpp +++ b/android/jni/TestRunner.cpp @@ -117,11 +117,11 @@ bool RunTests() { coreParam.fileToStart = baseDirectory / "pspautotests" / "tests" / (testName + ".prx"); Path expectedFile = baseDirectory / "pspautotests" / "tests" / (testName + ".expected"); - INFO_LOG(SYSTEM, "Preparing to execute '%s'", testName.c_str()); + INFO_LOG(Log::System, "Preparing to execute '%s'", testName.c_str()); std::string error_string; output.clear(); if (!PSP_Init(coreParam, &error_string)) { - ERROR_LOG(SYSTEM, "Failed to init unittest %s : %s", testsToRun[i], error_string.c_str()); + ERROR_LOG(Log::System, "Failed to init unittest %s : %s", testsToRun[i], error_string.c_str()); PSP_CoreParameter().pixelWidth = g_display.pixel_xres; PSP_CoreParameter().pixelHeight = g_display.pixel_yres; return false; @@ -130,7 +130,7 @@ bool RunTests() { PSP_BeginHostFrame(); // Run the emu until the test exits - INFO_LOG(SYSTEM, "Test: Entering runloop."); + INFO_LOG(Log::System, "Test: Entering runloop."); while (true) { int blockTicks = (int)usToCycles(1000000 / 10); while (coreState == CORE_RUNNING) { @@ -141,7 +141,7 @@ bool RunTests() { // set back to running for the next frame coreState = CORE_RUNNING; } else if (coreState == CORE_POWERDOWN) { - INFO_LOG(SYSTEM, "Finished running test %s", testName.c_str()); + INFO_LOG(Log::System, "Finished running test %s", testName.c_str()); break; } } @@ -149,7 +149,7 @@ bool RunTests() { std::string expect_results; if (!File::ReadTextFileToString(expectedFile, &expect_results)) { - ERROR_LOG(SYSTEM, "Error opening expectedFile %s", expectedFile.c_str()); + ERROR_LOG(Log::System, "Error opening expectedFile %s", expectedFile.c_str()); break; } @@ -166,9 +166,9 @@ bool RunTests() { e = TrimNewlines(e); o = TrimNewlines(o); if (e != o) { - ERROR_LOG(SYSTEM, "DIFF on line %i!", line); - ERROR_LOG(SYSTEM, "O: %s", o.c_str()); - ERROR_LOG(SYSTEM, "E: %s", e.c_str()); + ERROR_LOG(Log::System, "DIFF on line %i!", line); + ERROR_LOG(Log::System, "O: %s", o.c_str()); + ERROR_LOG(Log::System, "E: %s", e.c_str()); } if (expected.eof()) { break; diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 6345d08985..fe19a10c40 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -256,7 +256,7 @@ void Android_AttachThreadToJNI() { JNIEnv *env; int status = gJvm->GetEnv((void **)&env, JNI_VERSION_1_6); if (status < 0) { - DEBUG_LOG(SYSTEM, "Attaching thread '%s' (not already attached) to JNI.", GetCurrentThreadName()); + DEBUG_LOG(Log::System, "Attaching thread '%s' (not already attached) to JNI.", GetCurrentThreadName()); JavaVMAttachArgs args{}; args.version = JNI_VERSION_1_6; args.name = GetCurrentThreadName(); @@ -264,23 +264,23 @@ void Android_AttachThreadToJNI() { if (status < 0) { // bad, but what can we do other than report.. - ERROR_LOG_REPORT_ONCE(threadAttachFail, SYSTEM, "Failed to attach thread %s to JNI.", GetCurrentThreadName()); + ERROR_LOG_REPORT_ONCE(threadAttachFail, Log::System, "Failed to attach thread %s to JNI.", GetCurrentThreadName()); } } else { - WARN_LOG(SYSTEM, "Thread %s was already attached to JNI.", GetCurrentThreadName()); + WARN_LOG(Log::System, "Thread %s was already attached to JNI.", GetCurrentThreadName()); } } void Android_DetachThreadFromJNI() { if (gJvm->DetachCurrentThread() == JNI_OK) { - DEBUG_LOG(SYSTEM, "Detached thread from JNI: '%s'", GetCurrentThreadName()); + DEBUG_LOG(Log::System, "Detached thread from JNI: '%s'", GetCurrentThreadName()); } else { - WARN_LOG(SYSTEM, "Failed to detach thread '%s' from JNI - never attached?", GetCurrentThreadName()); + WARN_LOG(Log::System, "Failed to detach thread '%s' from JNI - never attached?", GetCurrentThreadName()); } } JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *pjvm, void *reserved) { - INFO_LOG(SYSTEM, "JNI_OnLoad"); + INFO_LOG(Log::System, "JNI_OnLoad"); gJvm = pjvm; // cache the JavaVM pointer auto env = getEnv(); //replace with one of your classes in the line below @@ -309,17 +309,17 @@ static void EmuThreadFunc() { args.name = "EmuThread"; gJvm->AttachCurrentThread(&env, &args); - INFO_LOG(SYSTEM, "Entering emu thread"); + INFO_LOG(Log::System, "Entering emu thread"); // Wait for render loop to get started. - INFO_LOG(SYSTEM, "Runloop: Waiting for displayInit..."); + INFO_LOG(Log::System, "Runloop: Waiting for displayInit..."); while (!graphicsContext || graphicsContext->GetState() == GraphicsContextState::PENDING) { sleep_ms(5); } // Check the state of the graphics context before we try to feed it into NativeInitGraphics. if (graphicsContext->GetState() != GraphicsContextState::INITIALIZED) { - ERROR_LOG(G3D, "Failed to initialize the graphics context! %d", (int)graphicsContext->GetState()); + ERROR_LOG(Log::G3D, "Failed to initialize the graphics context! %d", (int)graphicsContext->GetState()); emuThreadState = (int)EmuThreadState::QUIT_REQUESTED; gJvm->DetachCurrentThread(); return; @@ -332,7 +332,7 @@ static void EmuThreadFunc() { return; } - INFO_LOG(SYSTEM, "Graphics initialized. Entering loop."); + INFO_LOG(Log::System, "Graphics initialized. Entering loop."); // There's no real requirement that NativeInit happen on this thread. // We just call the update/render loop here. @@ -345,7 +345,7 @@ static void EmuThreadFunc() { std::lock_guard guard(frameCommandLock); if (!nativeActivity) { - ERROR_LOG(SYSTEM, "No activity, clearing commands"); + ERROR_LOG(Log::System, "No activity, clearing commands"); while (!frameCommands.empty()) frameCommands.pop(); return; @@ -354,7 +354,7 @@ static void EmuThreadFunc() { ProcessFrameCommands(env); } - INFO_LOG(SYSTEM, "QUIT_REQUESTED found, left EmuThreadFunc loop. Setting state to STOPPED."); + INFO_LOG(Log::System, "QUIT_REQUESTED found, left EmuThreadFunc loop. Setting state to STOPPED."); emuThreadState = (int)EmuThreadState::STOPPED; NativeShutdownGraphics(); @@ -363,11 +363,11 @@ static void EmuThreadFunc() { graphicsContext->StopThread(); gJvm->DetachCurrentThread(); - INFO_LOG(SYSTEM, "Leaving emu thread"); + INFO_LOG(Log::System, "Leaving emu thread"); } static void EmuThreadStart() { - INFO_LOG(SYSTEM, "EmuThreadStart"); + INFO_LOG(Log::System, "EmuThreadStart"); emuThreadState = (int)EmuThreadState::START_REQUESTED; emuThread = std::thread(&EmuThreadFunc); } @@ -376,14 +376,14 @@ static void EmuThreadStart() { // as long as emuThreadState isn't STOPPED and/or there are still things queued up. // Only after that, call EmuThreadJoin. static void EmuThreadStop(const char *caller) { - INFO_LOG(SYSTEM, "EmuThreadStop - stopping (%s)...", caller); + INFO_LOG(Log::System, "EmuThreadStop - stopping (%s)...", caller); emuThreadState = (int)EmuThreadState::QUIT_REQUESTED; } static void EmuThreadJoin() { emuThread.join(); emuThread = std::thread(); - INFO_LOG(SYSTEM, "EmuThreadJoin - joined"); + INFO_LOG(Log::System, "EmuThreadJoin - joined"); } static void PushCommand(std::string cmd, std::string param) { @@ -631,7 +631,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_audioConfig static std::string QueryConfig(std::string query) { char temp[128]; if (query == "screenRotation") { - INFO_LOG(G3D, "g_Config.screenRotation = %d", g_Config.iScreenRotation); + INFO_LOG(Log::G3D, "g_Config.screenRotation = %d", g_Config.iScreenRotation); snprintf(temp, sizeof(temp), "%d", g_Config.iScreenRotation); return std::string(temp); } else if (query == "immersiveMode") { @@ -816,20 +816,20 @@ retry: switch (g_Config.iGPUBackend) { case (int)GPUBackend::OPENGL: useCPUThread = true; - INFO_LOG(SYSTEM, "NativeApp.init() -- creating OpenGL context (JavaGL)"); + INFO_LOG(Log::System, "NativeApp.init() -- creating OpenGL context (JavaGL)"); graphicsContext = new AndroidJavaEGLGraphicsContext(); - INFO_LOG(SYSTEM, "NativeApp.init() - launching emu thread"); + INFO_LOG(Log::System, "NativeApp.init() - launching emu thread"); EmuThreadStart(); break; case (int)GPUBackend::VULKAN: { - INFO_LOG(SYSTEM, "NativeApp.init() -- creating Vulkan context"); + INFO_LOG(Log::System, "NativeApp.init() -- creating Vulkan context"); useCPUThread = false; // The Vulkan render manager manages its own thread. // We create and destroy the Vulkan graphics context in the app main thread though. AndroidVulkanContext *ctx = new AndroidVulkanContext(); if (!ctx->InitAPI()) { - INFO_LOG(SYSTEM, "Failed to initialize Vulkan, switching to OpenGL"); + INFO_LOG(Log::System, "Failed to initialize Vulkan, switching to OpenGL"); g_Config.iGPUBackend = (int)GPUBackend::OPENGL; SetGPUBackend(GPUBackend::OPENGL); goto retry; @@ -839,7 +839,7 @@ retry: break; } default: - ERROR_LOG(SYSTEM, "NativeApp.init(): iGPUBackend %d not supported. Switching to OpenGL.", (int)g_Config.iGPUBackend); + ERROR_LOG(Log::System, "NativeApp.init(): iGPUBackend %d not supported. Switching to OpenGL.", (int)g_Config.iGPUBackend); g_Config.iGPUBackend = (int)GPUBackend::OPENGL; goto retry; } @@ -869,11 +869,11 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_audioInit(JNIEnv *, jclass) { sampleRate = 44100; } - INFO_LOG(AUDIO, "NativeApp.audioInit() -- Using OpenSL audio! frames/buffer: %i optimal sr: %i actual sr: %i", optimalFramesPerBuffer, optimalSampleRate, sampleRate); + INFO_LOG(Log::Audio, "NativeApp.audioInit() -- Using OpenSL audio! frames/buffer: %i optimal sr: %i actual sr: %i", optimalFramesPerBuffer, optimalSampleRate, sampleRate); if (!g_audioState) { g_audioState = AndroidAudio_Init(&NativeMix, framesPerBuffer, sampleRate); } else { - ERROR_LOG(AUDIO, "Audio state already initialized"); + ERROR_LOG(Log::Audio, "Audio state already initialized"); } } @@ -882,7 +882,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_audioShutdown(JNIEnv *, jclass) AndroidAudio_Shutdown(g_audioState); g_audioState = nullptr; } else { - ERROR_LOG(AUDIO, "Audio state already shutdown!"); + ERROR_LOG(Log::Audio, "Audio state already shutdown!"); } } @@ -907,19 +907,19 @@ bool System_AudioRecordingState() { } extern "C" void Java_org_ppsspp_ppsspp_NativeApp_resume(JNIEnv *, jclass) { - INFO_LOG(SYSTEM, "NativeApp.resume() - resuming audio"); + INFO_LOG(Log::System, "NativeApp.resume() - resuming audio"); AndroidAudio_Resume(g_audioState); System_PostUIMessage(UIMessage::APP_RESUMED); } extern "C" void Java_org_ppsspp_ppsspp_NativeApp_pause(JNIEnv *, jclass) { - INFO_LOG(SYSTEM, "NativeApp.pause() - pausing audio"); + INFO_LOG(Log::System, "NativeApp.pause() - pausing audio"); AndroidAudio_Pause(g_audioState); } extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) { - INFO_LOG(SYSTEM, "NativeApp.shutdown() -- begin"); + INFO_LOG(Log::System, "NativeApp.shutdown() -- begin"); if (renderer_inited && useCPUThread && graphicsContext) { // Only used in Java EGL path. @@ -928,19 +928,19 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) { // which locks renderLock already, and only gets out once we call ThreadFrame() // in a loop before, to empty the queue. EmuThreadStop("shutdown"); - INFO_LOG(SYSTEM, "BeginAndroidShutdown"); + INFO_LOG(Log::System, "BeginAndroidShutdown"); graphicsContext->BeginAndroidShutdown(); // Now, it could be that we had some frames queued up. Get through them. // We're on the render thread, so this is synchronous. do { - INFO_LOG(SYSTEM, "Executing graphicsContext->ThreadFrame to clear buffers"); + INFO_LOG(Log::System, "Executing graphicsContext->ThreadFrame to clear buffers"); } while (graphicsContext->ThreadFrame()); graphicsContext->ThreadEnd(); - INFO_LOG(SYSTEM, "ThreadEnd called."); + INFO_LOG(Log::System, "ThreadEnd called."); graphicsContext->ShutdownFromRenderThread(); - INFO_LOG(SYSTEM, "Graphics context now shut down from NativeApp_shutdown"); + INFO_LOG(Log::System, "Graphics context now shut down from NativeApp_shutdown"); - INFO_LOG(SYSTEM, "Joining emuthread"); + INFO_LOG(Log::System, "Joining emuthread"); EmuThreadJoin(); } @@ -948,13 +948,13 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) { std::lock_guard guard(renderLock); if (graphicsContext) { - INFO_LOG(G3D, "Shutting down renderer"); + INFO_LOG(Log::G3D, "Shutting down renderer"); graphicsContext->Shutdown(); delete graphicsContext; graphicsContext = nullptr; renderer_inited = false; } else { - INFO_LOG(G3D, "Not shutting down renderer - not initialized"); + INFO_LOG(Log::G3D, "Not shutting down renderer - not initialized"); } NativeShutdown(); @@ -966,7 +966,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) { while (frameCommands.size()) frameCommands.pop(); } - INFO_LOG(SYSTEM, "NativeApp.shutdown() -- end"); + INFO_LOG(Log::System, "NativeApp.shutdown() -- end"); } // JavaEGL. This doesn't get called on the Vulkan path. @@ -974,7 +974,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_shutdown(JNIEnv *, jclass) { extern "C" bool Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env, jobject obj) { _assert_(useCPUThread); - INFO_LOG(G3D, "NativeApp.displayInit()"); + INFO_LOG(Log::G3D, "NativeApp.displayInit()"); bool firstStart = !renderer_inited; // We should be running on the render thread here. @@ -984,21 +984,21 @@ extern "C" bool Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env, // but the only mechanism for handling lost devices seems to be that onSurfaceCreated is called again, // which ends up calling displayInit. - INFO_LOG(G3D, "NativeApp.displayInit() restoring"); + INFO_LOG(Log::G3D, "NativeApp.displayInit() restoring"); EmuThreadStop("displayInit"); graphicsContext->BeginAndroidShutdown(); - INFO_LOG(G3D, "BeginAndroidShutdown. Looping until emu thread done..."); + INFO_LOG(Log::G3D, "BeginAndroidShutdown. Looping until emu thread done..."); // Skipping GL calls here because the old context is lost. while (graphicsContext->ThreadFrame()) { continue; } - INFO_LOG(G3D, "Joining emu thread"); + INFO_LOG(Log::G3D, "Joining emu thread"); EmuThreadJoin(); graphicsContext->ThreadEnd(); graphicsContext->ShutdownFromRenderThread(); - INFO_LOG(G3D, "Shut down both threads. Now let's bring it up again!"); + INFO_LOG(Log::G3D, "Shut down both threads. Now let's bring it up again!"); if (!graphicsContext->InitFromRenderThread(nullptr, 0, 0, 0, 0)) { System_Toast("Graphics initialization failed. Quitting."); @@ -1013,9 +1013,9 @@ extern "C" bool Java_org_ppsspp_ppsspp_NativeRenderer_displayInit(JNIEnv * env, graphicsContext->ThreadStart(); - INFO_LOG(G3D, "Restored."); + INFO_LOG(Log::G3D, "Restored."); } else { - INFO_LOG(G3D, "NativeApp.displayInit() first time"); + INFO_LOG(Log::G3D, "NativeApp.displayInit() first time"); if (!graphicsContext || !graphicsContext->InitFromRenderThread(nullptr, 0, 0, 0, 0)) { System_Toast("Graphics initialization failed. Quitting."); return false; @@ -1050,12 +1050,12 @@ static void recalculateDpi() { g_display.pixel_in_dps_x = (float)g_display.pixel_xres / g_display.dp_xres; g_display.pixel_in_dps_y = (float)g_display.pixel_yres / g_display.dp_yres; - INFO_LOG(G3D, "RecalcDPI: display_xres=%d display_yres=%d pixel_xres=%d pixel_yres=%d", display_xres, display_yres, g_display.pixel_xres, g_display.pixel_yres); - INFO_LOG(G3D, "RecalcDPI: g_dpi=%f g_dpi_scale_x=%f g_dpi_scale_y=%f dp_xres=%d dp_yres=%d", g_display.dpi, g_display.dpi_scale_x, g_display.dpi_scale_y, g_display.dp_xres, g_display.dp_yres); + INFO_LOG(Log::G3D, "RecalcDPI: display_xres=%d display_yres=%d pixel_xres=%d pixel_yres=%d", display_xres, display_yres, g_display.pixel_xres, g_display.pixel_yres); + INFO_LOG(Log::G3D, "RecalcDPI: g_dpi=%f g_dpi_scale_x=%f g_dpi_scale_y=%f dp_xres=%d dp_yres=%d", g_display.dpi, g_display.dpi_scale_x, g_display.dpi_scale_y, g_display.dp_xres, g_display.dp_yres); } extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv *, jclass, jint bufw, jint bufh, jint format) { - INFO_LOG(SYSTEM, "NativeApp.backbufferResize(%d x %d)", bufw, bufh); + INFO_LOG(Log::System, "NativeApp.backbufferResize(%d x %d)", bufw, bufh); bool new_size = g_display.pixel_xres != bufw || g_display.pixel_yres != bufh; int old_w = g_display.pixel_xres; @@ -1072,10 +1072,10 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_backbufferResize(JNIEnv recalculateDpi(); if (new_size) { - INFO_LOG(G3D, "Size change detected (previously %d,%d) - calling NativeResized()", old_w, old_h); + INFO_LOG(Log::G3D, "Size change detected (previously %d,%d) - calling NativeResized()", old_w, old_h); NativeResized(); } else { - INFO_LOG(G3D, "NativeApp::backbufferResize: Size didn't change."); + INFO_LOG(Log::G3D, "NativeApp::backbufferResize: Size didn't change."); } } @@ -1170,7 +1170,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_sendRequestResult(JNIEnv *env, jclass, jint jrequestID, jboolean result, jstring jvalue, jint jintValue) { std::string value = jvalue ? GetJavaString(env, jvalue) : "(no value)"; - INFO_LOG(SYSTEM, "Received result of request %d from Java: %d: %d '%s'", jrequestID, (int)result, jintValue, value.c_str()); + INFO_LOG(Log::System, "Received result of request %d from Java: %d: %d '%s'", jrequestID, (int)result, jintValue, value.c_str()); if (result) { g_requestManager.PostSystemSuccess(jrequestID, value.c_str()); } else { @@ -1334,23 +1334,23 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_sendMessageFromJava(JNI if (msg == "moga") { mogaVersion = prm; } else if (msg == "permission_pending") { - INFO_LOG(SYSTEM, "STORAGE PERMISSION: PENDING"); + INFO_LOG(Log::System, "STORAGE PERMISSION: PENDING"); // TODO: Add support for other permissions permissions[SYSTEM_PERMISSION_STORAGE] = PERMISSION_STATUS_PENDING; // Don't need to send along, nothing else is listening. } else if (msg == "permission_denied") { - INFO_LOG(SYSTEM, "STORAGE PERMISSION: DENIED"); + INFO_LOG(Log::System, "STORAGE PERMISSION: DENIED"); permissions[SYSTEM_PERMISSION_STORAGE] = PERMISSION_STATUS_DENIED; // Don't need to send along, nothing else is listening. } else if (msg == "permission_granted") { - INFO_LOG(SYSTEM, "STORAGE PERMISSION: GRANTED"); + INFO_LOG(Log::System, "STORAGE PERMISSION: GRANTED"); permissions[SYSTEM_PERMISSION_STORAGE] = PERMISSION_STATUS_GRANTED; // Send along. System_PostUIMessage(UIMessage::PERMISSION_GRANTED, prm); } else if (msg == "sustained_perf_supported") { sustainedPerfSupported = true; } else if (msg == "safe_insets") { - // INFO_LOG(SYSTEM, "Got insets: %s", prm.c_str()); + // INFO_LOG(Log::System, "Got insets: %s", prm.c_str()); // We don't bother with supporting exact rectangular regions. Safe insets are good enough. int left, right, top, bottom; if (4 == sscanf(prm.c_str(), "%d:%d:%d:%d", &left, &right, &top, &bottom)) { @@ -1370,13 +1370,13 @@ extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_sendMessageFromJava(JNI g_OSD.Show(OSDType::MESSAGE_ERROR, std::string("Java Exception"), prm, 10.0f); } else if (msg == "shortcutParam") { if (prm.empty()) { - WARN_LOG(SYSTEM, "shortcutParam empty"); + WARN_LOG(Log::System, "shortcutParam empty"); return; } - INFO_LOG(SYSTEM, "shortcutParam received: %s", prm.c_str()); + INFO_LOG(Log::System, "shortcutParam received: %s", prm.c_str()); System_PostUIMessage(UIMessage::REQUEST_GAME_BOOT, StripQuotes(prm)); } else { - ERROR_LOG(SYSTEM, "Got unexpected message from Java, ignoring: %s / %s", msg.c_str(), prm.c_str()); + ERROR_LOG(Log::System, "Got unexpected message from Java, ignoring: %s / %s", msg.c_str(), prm.c_str()); } } @@ -1384,7 +1384,7 @@ void correctRatio(int &sz_x, int &sz_y, float scale) { float x = (float)sz_x; float y = (float)sz_y; float ratio = x / y; - INFO_LOG(G3D, "CorrectRatio: Considering size: %0.2f/%0.2f=%0.2f for scale %f", x, y, ratio, scale); + INFO_LOG(Log::G3D, "CorrectRatio: Considering size: %0.2f/%0.2f=%0.2f for scale %f", x, y, ratio, scale); float targetRatio; // Try to get the longest dimension to match scale*PSP resolution. @@ -1399,7 +1399,7 @@ void correctRatio(int &sz_x, int &sz_y, float scale) { } float correction = targetRatio / ratio; - INFO_LOG(G3D, "Target ratio: %0.2f ratio: %0.2f correction: %0.2f", targetRatio, ratio, correction); + INFO_LOG(Log::G3D, "Target ratio: %0.2f ratio: %0.2f correction: %0.2f", targetRatio, ratio, correction); if (ratio < targetRatio) { y *= correction; } else { @@ -1408,7 +1408,7 @@ void correctRatio(int &sz_x, int &sz_y, float scale) { sz_x = x; sz_y = y; - INFO_LOG(G3D, "Corrected ratio: %dx%d", sz_x, sz_y); + INFO_LOG(Log::G3D, "Corrected ratio: %dx%d", sz_x, sz_y); } void getDesiredBackbufferSize(int &sz_x, int &sz_y) { @@ -1440,7 +1440,7 @@ void getDesiredBackbufferSize(int &sz_x, int &sz_y) { } extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeApp_setDisplayParameters(JNIEnv *, jclass, jint xres, jint yres, jint dpi, jfloat refreshRate) { - INFO_LOG(G3D, "NativeApp.setDisplayParameters(%d x %d, dpi=%d, refresh=%0.2f)", xres, yres, dpi, refreshRate); + INFO_LOG(Log::G3D, "NativeApp.setDisplayParameters(%d x %d, dpi=%d, refresh=%0.2f)", xres, yres, dpi, refreshRate); if (IsVREnabled()) { int width, height; @@ -1540,7 +1540,7 @@ static void ProcessFrameCommands(JNIEnv *env) { frameCmd = frameCommands.front(); frameCommands.pop(); - INFO_LOG(SYSTEM, "frameCommand '%s' '%s'", frameCmd.command.c_str(), frameCmd.params.c_str()); + INFO_LOG(Log::System, "frameCommand '%s' '%s'", frameCmd.command.c_str(), frameCmd.params.c_str()); jstring cmd = env->NewStringUTF(frameCmd.command.c_str()); jstring param = env->NewStringUTF(frameCmd.params.c_str()); @@ -1560,12 +1560,12 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runVulkanRenderLoo _assert_(!useCPUThread); if (!graphicsContext) { - ERROR_LOG(G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context."); + ERROR_LOG(Log::G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context."); return false; } if (g_renderLoopThread.joinable()) { - ERROR_LOG(G3D, "runVulkanRenderLoop: Already running"); + ERROR_LOG(Log::G3D, "runVulkanRenderLoop: Already running"); return false; } @@ -1573,7 +1573,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runVulkanRenderLoo if (!wnd) { // This shouldn't ever happen. - ERROR_LOG(G3D, "Error: Surface is null."); + ERROR_LOG(Log::G3D, "Error: Surface is null."); renderLoopRunning = false; return false; } @@ -1584,7 +1584,7 @@ extern "C" bool JNICALL Java_org_ppsspp_ppsspp_NativeActivity_runVulkanRenderLoo extern "C" void JNICALL Java_org_ppsspp_ppsspp_NativeActivity_requestExitVulkanRenderLoop(JNIEnv * env, jobject obj) { if (!renderLoopRunning) { - ERROR_LOG(SYSTEM, "Render loop already exited"); + ERROR_LOG(Log::System, "Render loop already exited"); return; } _assert_(g_renderLoopThread.joinable()); @@ -1602,14 +1602,14 @@ static void VulkanEmuThread(ANativeWindow *wnd) { JNIEnv *env = getEnv(); if (!graphicsContext) { - ERROR_LOG(G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context."); + ERROR_LOG(Log::G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context."); renderLoopRunning = false; exitRenderLoop = false; return; } if (exitRenderLoop) { - WARN_LOG(G3D, "runVulkanRenderLoop: ExitRenderLoop requested at start, skipping the whole thing."); + WARN_LOG(Log::G3D, "runVulkanRenderLoop: ExitRenderLoop requested at start, skipping the whole thing."); renderLoopRunning = false; exitRenderLoop = false; return; @@ -1618,14 +1618,14 @@ static void VulkanEmuThread(ANativeWindow *wnd) { // This is up here to prevent race conditions, in case we pause during init. renderLoopRunning = true; - WARN_LOG(G3D, "runVulkanRenderLoop. display_xres=%d display_yres=%d desiredBackbufferSizeX=%d desiredBackbufferSizeY=%d", + WARN_LOG(Log::G3D, "runVulkanRenderLoop. display_xres=%d display_yres=%d desiredBackbufferSizeX=%d desiredBackbufferSizeY=%d", display_xres, display_yres, desiredBackbufferSizeX, desiredBackbufferSizeY); if (!graphicsContext->InitFromRenderThread(wnd, desiredBackbufferSizeX, desiredBackbufferSizeY, backbuffer_format, androidVersion)) { // On Android, if we get here, really no point in continuing. // The UI is supposed to render on any device both on OpenGL and Vulkan. If either of those don't work // on a device, we blacklist it. Hopefully we should have already failed in InitAPI anyway and reverted to GL back then. - ERROR_LOG(G3D, "Failed to initialize graphics context."); + ERROR_LOG(Log::G3D, "Failed to initialize graphics context."); System_Toast("Failed to initialize graphics context."); delete graphicsContext; @@ -1636,7 +1636,7 @@ static void VulkanEmuThread(ANativeWindow *wnd) { if (!exitRenderLoop) { if (!NativeInitGraphics(graphicsContext)) { - ERROR_LOG(G3D, "Failed to initialize graphics."); + ERROR_LOG(Log::G3D, "Failed to initialize graphics."); // Gonna be in a weird state here.. } graphicsContext->ThreadStart(); @@ -1652,9 +1652,9 @@ static void VulkanEmuThread(ANativeWindow *wnd) { ProcessFrameCommands(env); } } - INFO_LOG(G3D, "Leaving Vulkan main loop."); + INFO_LOG(Log::G3D, "Leaving Vulkan main loop."); } else { - INFO_LOG(G3D, "Not entering main loop."); + INFO_LOG(Log::G3D, "Not entering main loop."); } NativeShutdownGraphics(); @@ -1663,12 +1663,12 @@ static void VulkanEmuThread(ANativeWindow *wnd) { graphicsContext->ThreadEnd(); // Shut the graphics context down to the same state it was in when we entered the render thread. - INFO_LOG(G3D, "Shutting down graphics context..."); + INFO_LOG(Log::G3D, "Shutting down graphics context..."); graphicsContext->ShutdownFromRenderThread(); renderLoopRunning = false; exitRenderLoop = false; - WARN_LOG(G3D, "Render loop function exited."); + WARN_LOG(Log::G3D, "Render loop function exited."); } // NOTE: This is defunct and not working, due to how the Android storage functions currently require @@ -1676,7 +1676,7 @@ static void VulkanEmuThread(ANativeWindow *wnd) { extern "C" jstring Java_org_ppsspp_ppsspp_ShortcutActivity_queryGameName(JNIEnv * env, jclass, jstring jpath) { bool teardownThreadManager = false; if (!g_threadManager.IsInitialized()) { - INFO_LOG(SYSTEM, "No thread manager - initializing one"); + INFO_LOG(Log::System, "No thread manager - initializing one"); // Need a thread manager. teardownThreadManager = true; g_threadManager.Init(1, 1); @@ -1684,7 +1684,7 @@ extern "C" jstring Java_org_ppsspp_ppsspp_ShortcutActivity_queryGameName(JNIEnv Path path = Path(GetJavaString(env, jpath)); - INFO_LOG(SYSTEM, "queryGameName(%s)", path.c_str()); + INFO_LOG(Log::System, "queryGameName(%s)", path.c_str()); std::string result = ""; @@ -1692,11 +1692,11 @@ extern "C" jstring Java_org_ppsspp_ppsspp_ShortcutActivity_queryGameName(JNIEnv std::shared_ptr info = cache->GetInfo(nullptr, path, GameInfoFlags::PARAM_SFO); // Wait until it's done: this is synchronous, unfortunately. if (info) { - INFO_LOG(SYSTEM, "GetInfo successful, waiting"); + INFO_LOG(Log::System, "GetInfo successful, waiting"); while (!info->Ready(GameInfoFlags::PARAM_SFO)) { sleep_ms(1); } - INFO_LOG(SYSTEM, "Done waiting"); + INFO_LOG(Log::System, "Done waiting"); if (info->fileType != IdentifiedFileType::UNKNOWN) { result = info->GetTitle(); @@ -1706,12 +1706,12 @@ extern "C" jstring Java_org_ppsspp_ppsspp_ShortcutActivity_queryGameName(JNIEnv result = result.substr(strlen("The ")); } - INFO_LOG(SYSTEM, "queryGameName: Got '%s'", result.c_str()); + INFO_LOG(Log::System, "queryGameName: Got '%s'", result.c_str()); } else { - INFO_LOG(SYSTEM, "queryGameName: Filetype unknown"); + INFO_LOG(Log::System, "queryGameName: Filetype unknown"); } } else { - INFO_LOG(SYSTEM, "No info from cache"); + INFO_LOG(Log::System, "No info from cache"); } delete cache; @@ -1728,7 +1728,7 @@ JNIEXPORT jbyteArray JNICALL Java_org_ppsspp_ppsspp_ShortcutActivity_queryGameIcon(JNIEnv * env, jclass clazz, jstring jpath) { bool teardownThreadManager = false; if (!g_threadManager.IsInitialized()) { - INFO_LOG(SYSTEM, "No thread manager - initializing one"); + INFO_LOG(Log::System, "No thread manager - initializing one"); // Need a thread manager. teardownThreadManager = true; g_threadManager.Init(1, 1); @@ -1737,7 +1737,7 @@ Java_org_ppsspp_ppsspp_ShortcutActivity_queryGameIcon(JNIEnv * env, jclass clazz Path path = Path(GetJavaString(env, jpath)); - INFO_LOG(SYSTEM, "queryGameIcon(%s)", path.c_str()); + INFO_LOG(Log::System, "queryGameIcon(%s)", path.c_str()); jbyteArray result = nullptr; @@ -1745,7 +1745,7 @@ Java_org_ppsspp_ppsspp_ShortcutActivity_queryGameIcon(JNIEnv * env, jclass clazz std::shared_ptr info = cache->GetInfo(nullptr, path, GameInfoFlags::ICON); // Wait until it's done: this is synchronous, unfortunately. if (info) { - INFO_LOG(SYSTEM, "GetInfo successful, waiting"); + INFO_LOG(Log::System, "GetInfo successful, waiting"); int attempts = 1000; while (!info->Ready(GameInfoFlags::ICON)) { sleep_ms(1); @@ -1754,18 +1754,18 @@ Java_org_ppsspp_ppsspp_ShortcutActivity_queryGameIcon(JNIEnv * env, jclass clazz break; } } - INFO_LOG(SYSTEM, "Done waiting"); + INFO_LOG(Log::System, "Done waiting"); if (info->Ready(GameInfoFlags::ICON)) { if (!info->icon.data.empty()) { - INFO_LOG(SYSTEM, "requestIcon: Got icon"); + INFO_LOG(Log::System, "requestIcon: Got icon"); result = env->NewByteArray(info->icon.data.size()); env->SetByteArrayRegion(result, 0, info->icon.data.size(), (const jbyte *)info->icon.data.data()); } } else { - INFO_LOG(SYSTEM, "requestIcon: Filetype unknown"); + INFO_LOG(Log::System, "requestIcon: Filetype unknown"); } } else { - INFO_LOG(SYSTEM, "No info from cache"); + INFO_LOG(Log::System, "No info from cache"); } delete cache; diff --git a/ext/at3_standalone/compat.cpp b/ext/at3_standalone/compat.cpp index b46ae77af8..33dbe59a5d 100644 --- a/ext/at3_standalone/compat.cpp +++ b/ext/at3_standalone/compat.cpp @@ -15,11 +15,11 @@ void av_log(int level, const char *fmt, ...) { switch (level) { case AV_LOG_DEBUG: case AV_LOG_TRACE: - case AV_LOG_VERBOSE: DEBUG_LOG(ME, "Atrac3/3+: %s", buffer); break; - case AV_LOG_ERROR: ERROR_LOG(ME, "Atrac3/3+: %s", buffer); break; - case AV_LOG_INFO: INFO_LOG(ME, "Atrac3/3+: %s", buffer); break; + case AV_LOG_VERBOSE: DEBUG_LOG(Log::ME, "Atrac3/3+: %s", buffer); break; + case AV_LOG_ERROR: ERROR_LOG(Log::ME, "Atrac3/3+: %s", buffer); break; + case AV_LOG_INFO: INFO_LOG(Log::ME, "Atrac3/3+: %s", buffer); break; case AV_LOG_WARNING: default: - WARN_LOG(ME, "Atrac3/3+: %s", buffer); break; + WARN_LOG(Log::ME, "Atrac3/3+: %s", buffer); break; } } diff --git a/ext/libkirk/amctrl.c b/ext/libkirk/amctrl.c index d144ca792c..3116c39725 100644 --- a/ext/libkirk/amctrl.c +++ b/ext/libkirk/amctrl.c @@ -608,7 +608,7 @@ PGD_DESC *pgd_open(u8 *pgd_buf, int pgd_flag, u8 *pgd_vkey) u8 *fkey; int retv; - //DEBUG_LOG(HLE, "Open PGD ..."); + //DEBUG_LOG(Log::HLE, "Open PGD ..."); pgd = (PGD_DESC*)malloc(sizeof(PGD_DESC)); memset(pgd, 0, sizeof(PGD_DESC)); @@ -637,7 +637,7 @@ PGD_DESC *pgd_open(u8 *pgd_buf, int pgd_flag, u8 *pgd_vkey) if(pgd_flag&1) fkey = (u8*)dnas_key1AA0; if(fkey==NULL){ - //ERROR_LOG(HLE, "pgd_open: invalid pgd_flag! %08x\n", pgd_flag); + //ERROR_LOG(Log::HLE, "pgd_open: invalid pgd_flag! %08x\n", pgd_flag); free(pgd); return NULL; } @@ -647,7 +647,7 @@ PGD_DESC *pgd_open(u8 *pgd_buf, int pgd_flag, u8 *pgd_vkey) sceDrmBBMacUpdate(&mkey, pgd_buf+0x00, 0x80); retv = sceDrmBBMacFinal2(&mkey, pgd_buf+0x80, fkey); if(retv){ - //ERROR_LOG(HLE, "pgd_open: MAC_80 check failed!: %08x(%d)\n", retv, retv); + //ERROR_LOG(Log::HLE, "pgd_open: MAC_80 check failed!: %08x(%d)\n", retv, retv); free(pgd); return NULL; } @@ -659,7 +659,7 @@ PGD_DESC *pgd_open(u8 *pgd_buf, int pgd_flag, u8 *pgd_vkey) // use given vkey retv = sceDrmBBMacFinal2(&mkey, pgd_buf+0x70, pgd_vkey); if(retv){ - //ERROR_LOG(HLE, "pgd_open: MAC_70 check failed!: %08x(%d)\n", retv, retv); + //ERROR_LOG(Log::HLE, "pgd_open: MAC_70 check failed!: %08x(%d)\n", retv, retv); free(pgd); return NULL; }else{ diff --git a/ext/vma/vk_mem_alloc.h b/ext/vma/vk_mem_alloc.h index 79c2ae0b33..41b1e466d5 100644 --- a/ext/vma/vk_mem_alloc.h +++ b/ext/vma/vk_mem_alloc.h @@ -13309,7 +13309,7 @@ VkResult VmaAllocator_T::AllocateMemoryOfType( if(res == VK_SUCCESS) { // Succeeded: AllocateDedicatedMemory function already filled pMemory, nothing more to do here. - VMA_DEBUG_LOG(" Allocated as DedicatedMemory"); + VMA_DEBUG_LOG(Log::" Allocated as DedicatedMemory"); return VK_SUCCESS; } } @@ -13350,12 +13350,12 @@ VkResult VmaAllocator_T::AllocateMemoryOfType( if(res == VK_SUCCESS) { // Succeeded: AllocateDedicatedMemory function already filled pMemory, nothing more to do here. - VMA_DEBUG_LOG(" Allocated as DedicatedMemory"); + VMA_DEBUG_LOG(Log::" Allocated as DedicatedMemory"); return VK_SUCCESS; } } // Everything failed: Return error code. - VMA_DEBUG_LOG(" vkAllocateMemory FAILED"); + VMA_DEBUG_LOG(Log::" vkAllocateMemory FAILED"); return res; } } @@ -13523,7 +13523,7 @@ VkResult VmaAllocator_T::AllocateDedicatedMemoryPage( VkResult res = AllocateVulkanMemory(&allocInfo, &hMemory); if(res < 0) { - VMA_DEBUG_LOG(" vkAllocateMemory FAILED"); + VMA_DEBUG_LOG(Log::" vkAllocateMemory FAILED"); return res; } @@ -13539,7 +13539,7 @@ VkResult VmaAllocator_T::AllocateDedicatedMemoryPage( &pMappedData); if(res < 0) { - VMA_DEBUG_LOG(" vkMapMemory FAILED"); + VMA_DEBUG_LOG(Log::" vkMapMemory FAILED"); FreeVulkanMemory(memTypeIndex, size, hMemory); return res; } @@ -14855,7 +14855,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAllocator( VMA_ASSERT(pCreateInfo && pAllocator); VMA_ASSERT(pCreateInfo->vulkanApiVersion == 0 || (VK_VERSION_MAJOR(pCreateInfo->vulkanApiVersion) == 1 && VK_VERSION_MINOR(pCreateInfo->vulkanApiVersion) <= 3)); - VMA_DEBUG_LOG("vmaCreateAllocator"); + VMA_DEBUG_LOG(Log::"vmaCreateAllocator"); *pAllocator = vma_new(pCreateInfo->pAllocationCallbacks, VmaAllocator_T)(pCreateInfo); VkResult result = (*pAllocator)->Init(pCreateInfo); if(result < 0) @@ -14871,7 +14871,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaDestroyAllocator( { if(allocator != VK_NULL_HANDLE) { - VMA_DEBUG_LOG("vmaDestroyAllocator"); + VMA_DEBUG_LOG(Log::"vmaDestroyAllocator"); VkAllocationCallbacks allocationCallbacks = allocator->m_AllocationCallbacks; // Have to copy the callbacks when destroying. vma_delete(&allocationCallbacks, allocator); } @@ -15271,7 +15271,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreatePool( { VMA_ASSERT(allocator && pCreateInfo && pPool); - VMA_DEBUG_LOG("vmaCreatePool"); + VMA_DEBUG_LOG(Log::"vmaCreatePool"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15289,7 +15289,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaDestroyPool( return; } - VMA_DEBUG_LOG("vmaDestroyPool"); + VMA_DEBUG_LOG(Log::"vmaDestroyPool"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15326,7 +15326,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckPoolCorruption(VmaAllocator allocato VMA_DEBUG_GLOBAL_MUTEX_LOCK - VMA_DEBUG_LOG("vmaCheckPoolCorruption"); + VMA_DEBUG_LOG(Log::"vmaCheckPoolCorruption"); return allocator->CheckPoolCorruption(pool); } @@ -15338,7 +15338,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaGetPoolName( { VMA_ASSERT(allocator && pool && ppName); - VMA_DEBUG_LOG("vmaGetPoolName"); + VMA_DEBUG_LOG(Log::"vmaGetPoolName"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15352,7 +15352,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaSetPoolName( { VMA_ASSERT(allocator && pool); - VMA_DEBUG_LOG("vmaSetPoolName"); + VMA_DEBUG_LOG(Log::"vmaSetPoolName"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15368,7 +15368,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemory( { VMA_ASSERT(allocator && pVkMemoryRequirements && pCreateInfo && pAllocation); - VMA_DEBUG_LOG("vmaAllocateMemory"); + VMA_DEBUG_LOG(Log::"vmaAllocateMemory"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15407,7 +15407,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryPages( VMA_ASSERT(allocator && pVkMemoryRequirements && pCreateInfo && pAllocations); - VMA_DEBUG_LOG("vmaAllocateMemoryPages"); + VMA_DEBUG_LOG(Log::"vmaAllocateMemoryPages"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15443,7 +15443,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForBuffer( { VMA_ASSERT(allocator && buffer != VK_NULL_HANDLE && pCreateInfo && pAllocation); - VMA_DEBUG_LOG("vmaAllocateMemoryForBuffer"); + VMA_DEBUG_LOG(Log::"vmaAllocateMemoryForBuffer"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15483,7 +15483,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaAllocateMemoryForImage( { VMA_ASSERT(allocator && image != VK_NULL_HANDLE && pCreateInfo && pAllocation); - VMA_DEBUG_LOG("vmaAllocateMemoryForImage"); + VMA_DEBUG_LOG(Log::"vmaAllocateMemoryForImage"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15524,7 +15524,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemory( return; } - VMA_DEBUG_LOG("vmaFreeMemory"); + VMA_DEBUG_LOG(Log::"vmaFreeMemory"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15545,7 +15545,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaFreeMemoryPages( VMA_ASSERT(allocator); - VMA_DEBUG_LOG("vmaFreeMemoryPages"); + VMA_DEBUG_LOG(Log::"vmaFreeMemoryPages"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15637,7 +15637,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaFlushAllocation( { VMA_ASSERT(allocator && allocation); - VMA_DEBUG_LOG("vmaFlushAllocation"); + VMA_DEBUG_LOG(Log::"vmaFlushAllocation"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15652,7 +15652,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaInvalidateAllocation( { VMA_ASSERT(allocator && allocation); - VMA_DEBUG_LOG("vmaInvalidateAllocation"); + VMA_DEBUG_LOG(Log::"vmaInvalidateAllocation"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15675,7 +15675,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaFlushAllocations( VMA_ASSERT(allocations); - VMA_DEBUG_LOG("vmaFlushAllocations"); + VMA_DEBUG_LOG(Log::"vmaFlushAllocations"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15698,7 +15698,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaInvalidateAllocations( VMA_ASSERT(allocations); - VMA_DEBUG_LOG("vmaInvalidateAllocations"); + VMA_DEBUG_LOG(Log::"vmaInvalidateAllocations"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15719,7 +15719,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCopyMemoryToAllocation( return VK_SUCCESS; } - VMA_DEBUG_LOG("vmaCopyMemoryToAllocation"); + VMA_DEBUG_LOG(Log::"vmaCopyMemoryToAllocation"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15740,7 +15740,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCopyAllocationToMemory( return VK_SUCCESS; } - VMA_DEBUG_LOG("vmaCopyAllocationToMemory"); + VMA_DEBUG_LOG(Log::"vmaCopyAllocationToMemory"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15753,7 +15753,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCheckCorruption( { VMA_ASSERT(allocator); - VMA_DEBUG_LOG("vmaCheckCorruption"); + VMA_DEBUG_LOG(Log::"vmaCheckCorruption"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15767,7 +15767,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentation( { VMA_ASSERT(allocator && pInfo && pContext); - VMA_DEBUG_LOG("vmaBeginDefragmentation"); + VMA_DEBUG_LOG(Log::"vmaBeginDefragmentation"); if (pInfo->pool != VMA_NULL) { @@ -15789,7 +15789,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaEndDefragmentation( { VMA_ASSERT(allocator && context); - VMA_DEBUG_LOG("vmaEndDefragmentation"); + VMA_DEBUG_LOG(Log::"vmaEndDefragmentation"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15805,7 +15805,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBeginDefragmentationPass( { VMA_ASSERT(context && pPassInfo); - VMA_DEBUG_LOG("vmaBeginDefragmentationPass"); + VMA_DEBUG_LOG(Log::"vmaBeginDefragmentationPass"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15819,7 +15819,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaEndDefragmentationPass( { VMA_ASSERT(context && pPassInfo); - VMA_DEBUG_LOG("vmaEndDefragmentationPass"); + VMA_DEBUG_LOG(Log::"vmaEndDefragmentationPass"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15833,7 +15833,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory( { VMA_ASSERT(allocator && allocation && buffer); - VMA_DEBUG_LOG("vmaBindBufferMemory"); + VMA_DEBUG_LOG(Log::"vmaBindBufferMemory"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15849,7 +15849,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindBufferMemory2( { VMA_ASSERT(allocator && allocation && buffer); - VMA_DEBUG_LOG("vmaBindBufferMemory2"); + VMA_DEBUG_LOG(Log::"vmaBindBufferMemory2"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15863,7 +15863,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory( { VMA_ASSERT(allocator && allocation && image); - VMA_DEBUG_LOG("vmaBindImageMemory"); + VMA_DEBUG_LOG(Log::"vmaBindImageMemory"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15879,7 +15879,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaBindImageMemory2( { VMA_ASSERT(allocator && allocation && image); - VMA_DEBUG_LOG("vmaBindImageMemory2"); + VMA_DEBUG_LOG(Log::"vmaBindImageMemory2"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15907,7 +15907,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateBuffer( return VK_ERROR_INITIALIZATION_FAILED; } - VMA_DEBUG_LOG("vmaCreateBuffer"); + VMA_DEBUG_LOG(Log::"vmaCreateBuffer"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -15999,7 +15999,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateBufferWithAlignment( return VK_ERROR_INITIALIZATION_FAILED; } - VMA_DEBUG_LOG("vmaCreateBufferWithAlignment"); + VMA_DEBUG_LOG(Log::"vmaCreateBufferWithAlignment"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -16091,7 +16091,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAliasingBuffer2( VMA_ASSERT(allocator && pBufferCreateInfo && pBuffer && allocation); VMA_ASSERT(allocationLocalOffset + pBufferCreateInfo->size <= allocation->GetSize()); - VMA_DEBUG_LOG("vmaCreateAliasingBuffer2"); + VMA_DEBUG_LOG(Log::"vmaCreateAliasingBuffer2"); *pBuffer = VK_NULL_HANDLE; @@ -16139,7 +16139,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaDestroyBuffer( return; } - VMA_DEBUG_LOG("vmaDestroyBuffer"); + VMA_DEBUG_LOG(Log::"vmaDestroyBuffer"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -16175,7 +16175,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateImage( return VK_ERROR_INITIALIZATION_FAILED; } - VMA_DEBUG_LOG("vmaCreateImage"); + VMA_DEBUG_LOG(Log::"vmaCreateImage"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -16268,7 +16268,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateAliasingImage2( *pImage = VK_NULL_HANDLE; - VMA_DEBUG_LOG("vmaCreateImage2"); + VMA_DEBUG_LOG(Log::"vmaCreateImage2"); if (pImageCreateInfo->extent.width == 0 || pImageCreateInfo->extent.height == 0 || @@ -16312,7 +16312,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaDestroyImage( return; } - VMA_DEBUG_LOG("vmaDestroyImage"); + VMA_DEBUG_LOG(Log::"vmaDestroyImage"); VMA_DEBUG_GLOBAL_MUTEX_LOCK @@ -16334,7 +16334,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaCreateVirtualBlock( { VMA_ASSERT(pCreateInfo && pVirtualBlock); VMA_ASSERT(pCreateInfo->size > 0); - VMA_DEBUG_LOG("vmaCreateVirtualBlock"); + VMA_DEBUG_LOG(Log::"vmaCreateVirtualBlock"); VMA_DEBUG_GLOBAL_MUTEX_LOCK; *pVirtualBlock = vma_new(pCreateInfo->pAllocationCallbacks, VmaVirtualBlock_T)(*pCreateInfo); VkResult res = (*pVirtualBlock)->Init(); @@ -16350,7 +16350,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaDestroyVirtualBlock(VmaVirtualBlock VMA_NULLA { if(virtualBlock != VK_NULL_HANDLE) { - VMA_DEBUG_LOG("vmaDestroyVirtualBlock"); + VMA_DEBUG_LOG(Log::"vmaDestroyVirtualBlock"); VMA_DEBUG_GLOBAL_MUTEX_LOCK; VkAllocationCallbacks allocationCallbacks = virtualBlock->m_AllocationCallbacks; // Have to copy the callbacks when destroying. vma_delete(&allocationCallbacks, virtualBlock); @@ -16360,7 +16360,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaDestroyVirtualBlock(VmaVirtualBlock VMA_NULLA VMA_CALL_PRE VkBool32 VMA_CALL_POST vmaIsVirtualBlockEmpty(VmaVirtualBlock VMA_NOT_NULL virtualBlock) { VMA_ASSERT(virtualBlock != VK_NULL_HANDLE); - VMA_DEBUG_LOG("vmaIsVirtualBlockEmpty"); + VMA_DEBUG_LOG(Log::"vmaIsVirtualBlockEmpty"); VMA_DEBUG_GLOBAL_MUTEX_LOCK; return virtualBlock->IsEmpty() ? VK_TRUE : VK_FALSE; } @@ -16369,7 +16369,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaGetVirtualAllocationInfo(VmaVirtualBlock VMA_ VmaVirtualAllocation VMA_NOT_NULL_NON_DISPATCHABLE allocation, VmaVirtualAllocationInfo* VMA_NOT_NULL pVirtualAllocInfo) { VMA_ASSERT(virtualBlock != VK_NULL_HANDLE && pVirtualAllocInfo != VMA_NULL); - VMA_DEBUG_LOG("vmaGetVirtualAllocationInfo"); + VMA_DEBUG_LOG(Log::"vmaGetVirtualAllocationInfo"); VMA_DEBUG_GLOBAL_MUTEX_LOCK; virtualBlock->GetAllocationInfo(allocation, *pVirtualAllocInfo); } @@ -16379,7 +16379,7 @@ VMA_CALL_PRE VkResult VMA_CALL_POST vmaVirtualAllocate(VmaVirtualBlock VMA_NOT_N VkDeviceSize* VMA_NULLABLE pOffset) { VMA_ASSERT(virtualBlock != VK_NULL_HANDLE && pCreateInfo != VMA_NULL && pAllocation != VMA_NULL); - VMA_DEBUG_LOG("vmaVirtualAllocate"); + VMA_DEBUG_LOG(Log::"vmaVirtualAllocate"); VMA_DEBUG_GLOBAL_MUTEX_LOCK; return virtualBlock->Allocate(*pCreateInfo, *pAllocation, pOffset); } @@ -16389,7 +16389,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaVirtualFree(VmaVirtualBlock VMA_NOT_NULL virt if(allocation != VK_NULL_HANDLE) { VMA_ASSERT(virtualBlock != VK_NULL_HANDLE); - VMA_DEBUG_LOG("vmaVirtualFree"); + VMA_DEBUG_LOG(Log::"vmaVirtualFree"); VMA_DEBUG_GLOBAL_MUTEX_LOCK; virtualBlock->Free(allocation); } @@ -16398,7 +16398,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaVirtualFree(VmaVirtualBlock VMA_NOT_NULL virt VMA_CALL_PRE void VMA_CALL_POST vmaClearVirtualBlock(VmaVirtualBlock VMA_NOT_NULL virtualBlock) { VMA_ASSERT(virtualBlock != VK_NULL_HANDLE); - VMA_DEBUG_LOG("vmaClearVirtualBlock"); + VMA_DEBUG_LOG(Log::"vmaClearVirtualBlock"); VMA_DEBUG_GLOBAL_MUTEX_LOCK; virtualBlock->Clear(); } @@ -16407,7 +16407,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaSetVirtualAllocationUserData(VmaVirtualBlock VmaVirtualAllocation VMA_NOT_NULL_NON_DISPATCHABLE allocation, void* VMA_NULLABLE pUserData) { VMA_ASSERT(virtualBlock != VK_NULL_HANDLE); - VMA_DEBUG_LOG("vmaSetVirtualAllocationUserData"); + VMA_DEBUG_LOG(Log::"vmaSetVirtualAllocationUserData"); VMA_DEBUG_GLOBAL_MUTEX_LOCK; virtualBlock->SetAllocationUserData(allocation, pUserData); } @@ -16416,7 +16416,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaGetVirtualBlockStatistics(VmaVirtualBlock VMA VmaStatistics* VMA_NOT_NULL pStats) { VMA_ASSERT(virtualBlock != VK_NULL_HANDLE && pStats != VMA_NULL); - VMA_DEBUG_LOG("vmaGetVirtualBlockStatistics"); + VMA_DEBUG_LOG(Log::"vmaGetVirtualBlockStatistics"); VMA_DEBUG_GLOBAL_MUTEX_LOCK; virtualBlock->GetStatistics(*pStats); } @@ -16425,7 +16425,7 @@ VMA_CALL_PRE void VMA_CALL_POST vmaCalculateVirtualBlockStatistics(VmaVirtualBlo VmaDetailedStatistics* VMA_NOT_NULL pStats) { VMA_ASSERT(virtualBlock != VK_NULL_HANDLE && pStats != VMA_NULL); - VMA_DEBUG_LOG("vmaCalculateVirtualBlockStatistics"); + VMA_DEBUG_LOG(Log::"vmaCalculateVirtualBlockStatistics"); VMA_DEBUG_GLOBAL_MUTEX_LOCK; virtualBlock->CalculateDetailedStatistics(*pStats); } diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 4d84a1f265..4487a445cd 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -431,8 +431,8 @@ int main(int argc, const char* argv[]) PrintfLogger *printfLogger = new PrintfLogger(); - for (int i = 0; i < (int)LogType::NUMBER_OF_LOGS; i++) { - LogType type = (LogType)i; + for (int i = 0; i < (int)Log::NUMBER_OF_LOGS; i++) { + Log type = (Log)i; logman->SetEnabled(type, fullLog); logman->SetLogLevel(type, LogLevel::LDEBUG); } diff --git a/ios/AppDelegate.mm b/ios/AppDelegate.mm index ea07b02d1f..1d348ab568 100644 --- a/ios/AppDelegate.mm +++ b/ios/AppDelegate.mm @@ -27,14 +27,14 @@ switch ([interruptionType unsignedIntegerValue]) { case AVAudioSessionInterruptionTypeBegan: - INFO_LOG(SYSTEM, "ios audio session interruption beginning"); + INFO_LOG(Log::System, "ios audio session interruption beginning"); if (g_Config.bEnableSound) { iOSCoreAudioShutdown(); } break; case AVAudioSessionInterruptionTypeEnded: - INFO_LOG(SYSTEM, "ios audio session interruption ending"); + INFO_LOG(Log::System, "ios audio session interruption ending"); if (g_Config.bEnableSound) { /* * Only try to reinit audio if in the foreground, otherwise @@ -56,7 +56,7 @@ // Registered in application:didFinishLaunchingWithOptions: // for AVAudioSessionMediaServicesWereResetNotification -(void) handleMediaServicesWereReset:(NSNotification *)notification { - INFO_LOG(SYSTEM, "ios media services were reset - reinitializing audio"); + INFO_LOG(Log::System, "ios media services were reset - reinitializing audio"); /* When media services were reset, Apple recommends: @@ -124,14 +124,14 @@ } - (void)restart:(const char*)restartArgs { - INFO_LOG(G3D, "Restart requested: %s", restartArgs); + INFO_LOG(Log::G3D, "Restart requested: %s", restartArgs); [self.viewController willResignActive]; [self.viewController shutdown]; self.window.rootViewController = nil; self.viewController = nil; // App was requested to restart, probably. - INFO_LOG(G3D, "viewController nilled"); + INFO_LOG(Log::G3D, "viewController nilled"); NativeShutdown(); @@ -142,7 +142,7 @@ } - (void)applicationWillResignActive:(UIApplication *)application { - INFO_LOG(G3D, "willResignActive"); + INFO_LOG(Log::G3D, "willResignActive"); [self.viewController willResignActive]; @@ -154,7 +154,7 @@ } - (void)applicationDidBecomeActive:(UIApplication *)application { - INFO_LOG(G3D, "didBecomeActive"); + INFO_LOG(Log::G3D, "didBecomeActive"); if (g_Config.bEnableSound) { iOSCoreAudioInit(); } diff --git a/ios/Controls.mm b/ios/Controls.mm index 3da8ba755e..6683a00781 100644 --- a/ios/Controls.mm +++ b/ios/Controls.mm @@ -77,12 +77,12 @@ bool InitController(GCController *controller) { }; extendedProfile.leftTrigger.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { - INFO_LOG(SYSTEM, "ltrigger: %f %d", value, (int)pressed); + INFO_LOG(Log::System, "ltrigger: %f %d", value, (int)pressed); analogTriggerPressed(JOYSTICK_AXIS_LTRIGGER, value); }; extendedProfile.rightTrigger.valueChangedHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) { - INFO_LOG(SYSTEM, "rtrigger: %f %d", value, (int)pressed); + INFO_LOG(Log::System, "rtrigger: %f %d", value, (int)pressed); analogTriggerPressed(JOYSTICK_AXIS_RTRIGGER, value); }; @@ -408,7 +408,7 @@ void KeyboardPressesBegan(NSSet *presses, UIPressesEvent *event) { input.keyCode = code; input.flags = KEY_DOWN; NativeKey(input); - INFO_LOG(SYSTEM, "pressesBegan %d", code); + INFO_LOG(Log::System, "pressesBegan %d", code); } } if (press.key.characters) { @@ -432,7 +432,7 @@ void KeyboardPressesEnded(NSSet *presses, UIPressesEvent *event) { input.keyCode = code; input.flags = KEY_UP; NativeKey(input); - INFO_LOG(SYSTEM, "pressesEnded %d", code); + INFO_LOG(Log::System, "pressesEnded %d", code); } } } diff --git a/ios/ViewController.mm b/ios/ViewController.mm index a9b82dc749..abcf5f19ea 100644 --- a/ios/ViewController.mm +++ b/ios/ViewController.mm @@ -178,16 +178,16 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { NativeInitGraphics(graphicsContext); - INFO_LOG(SYSTEM, "Emulation thread starting\n"); + INFO_LOG(Log::System, "Emulation thread starting\n"); while (!exitRenderLoop) { NativeFrame(graphicsContext); } - INFO_LOG(SYSTEM, "Emulation thread shutting down\n"); + INFO_LOG(Log::System, "Emulation thread shutting down\n"); NativeShutdownGraphics(); // Also ask the main thread to stop, so it doesn't hang waiting for a new frame. - INFO_LOG(SYSTEM, "Emulation thread stopping\n"); + INFO_LOG(Log::System, "Emulation thread stopping\n"); exitRenderLoop = false; renderLoopRunning = false; @@ -195,12 +195,12 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { - (bool)runGLRenderLoop { if (!graphicsContext) { - ERROR_LOG(G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context."); + ERROR_LOG(Log::G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context."); return false; } if (g_renderLoopThread.joinable()) { - ERROR_LOG(G3D, "runVulkanRenderLoop: Already running"); + ERROR_LOG(Log::G3D, "runVulkanRenderLoop: Already running"); return false; } @@ -215,7 +215,7 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { - (void)requestExitGLRenderLoop { if (!renderLoopRunning) { - ERROR_LOG(SYSTEM, "Render loop already exited"); + ERROR_LOG(Log::System, "Render loop already exited"); return; } _assert_(g_renderLoopThread.joinable()); @@ -230,7 +230,7 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - INFO_LOG(G3D, "viewDidAppear"); + INFO_LOG(Log::G3D, "viewDidAppear"); [self hideKeyboard]; [self updateGesture]; } @@ -284,7 +284,7 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { // Initialize the motion manager for accelerometer control. self.motionManager = [[CMMotionManager alloc] init]; - INFO_LOG(G3D, "Done with viewDidLoad."); + INFO_LOG(Log::G3D, "Done with viewDidLoad."); } - (void)handleSwipeFrom:(UIScreenEdgePanGestureRecognizer *)recognizer @@ -295,7 +295,7 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { key.keyCode = NKCODE_BACK; key.deviceId = DEVICE_ID_TOUCH; NativeKey(key); - INFO_LOG(SYSTEM, "Detected back swipe"); + INFO_LOG(Log::System, "Detected back swipe"); } } @@ -305,10 +305,10 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { } - (void)didBecomeActive { - INFO_LOG(SYSTEM, "didBecomeActive begin"); + INFO_LOG(Log::System, "didBecomeActive begin"); if (self.motionManager.accelerometerAvailable) { self.motionManager.accelerometerUpdateInterval = 1.0 / 60.0; - INFO_LOG(G3D, "Starting accelerometer updates."); + INFO_LOG(Log::G3D, "Starting accelerometer updates."); [self.motionManager startAccelerometerUpdatesToQueue:self.accelerometerQueue withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) { @@ -319,27 +319,27 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { ProcessAccelerometerData(accelerometerData); }]; } else { - INFO_LOG(G3D, "No accelerometer available, not starting updates."); + INFO_LOG(Log::G3D, "No accelerometer available, not starting updates."); } [self runGLRenderLoop]; - INFO_LOG(SYSTEM, "didBecomeActive end"); + INFO_LOG(Log::System, "didBecomeActive end"); } - (void)willResignActive { - INFO_LOG(SYSTEM, "willResignActive begin"); + INFO_LOG(Log::System, "willResignActive begin"); [self requestExitGLRenderLoop]; // Stop accelerometer updates if (self.motionManager.accelerometerActive) { - INFO_LOG(G3D, "Stopping accelerometer updates"); + INFO_LOG(Log::G3D, "Stopping accelerometer updates"); [self.motionManager stopAccelerometerUpdates]; } - INFO_LOG(SYSTEM, "willResignActive end"); + INFO_LOG(Log::System, "willResignActive end"); } - (void)shutdown { - INFO_LOG(SYSTEM, "shutdown GL"); + INFO_LOG(Log::System, "shutdown GL"); g_Config.Save("shutdown GL"); @@ -366,12 +366,12 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { graphicsContext->Shutdown(); delete graphicsContext; graphicsContext = nullptr; - INFO_LOG(SYSTEM, "Done shutting down GL"); + INFO_LOG(Log::System, "Done shutting down GL"); } - (void)dealloc { - INFO_LOG(SYSTEM, "dealloc GL"); + INFO_LOG(Log::System, "dealloc GL"); } - (NSUInteger)supportedInterfaceOrientations @@ -382,7 +382,7 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { - (void)glkView:(GLKView *)view drawInRect:(CGRect)rect { if (!renderLoopRunning) { - INFO_LOG(G3D, "Ignoring drawInRect"); + INFO_LOG(Log::G3D, "Ignoring drawInRect"); return; } if (sharedViewController) { @@ -451,10 +451,10 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { if (GetUIState() == UISTATE_INGAME) { // In-game, we need all the control we can get. Though, we could possibly // allow the top edge? - INFO_LOG(SYSTEM, "Defer system gestures on all edges"); + INFO_LOG(Log::System, "Defer system gestures on all edges"); return UIRectEdgeAll; } else { - INFO_LOG(SYSTEM, "Allow system gestures on the bottom"); + INFO_LOG(Log::System, "Allow system gestures on the bottom"); // Allow task switching gestures to take precedence, without causing // scroll events in the UI. Otherwise, we get "ghost" scrolls when switching tasks. return UIRectEdgeTop | UIRectEdgeLeft | UIRectEdgeRight; @@ -469,16 +469,16 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { } - (void)updateGesture { - INFO_LOG(SYSTEM, "Updating swipe gesture."); + INFO_LOG(Log::System, "Updating swipe gesture."); if (mBackGestureRecognizer) { - INFO_LOG(SYSTEM, "Removing swipe gesture."); + INFO_LOG(Log::System, "Removing swipe gesture."); [[self view] removeGestureRecognizer:mBackGestureRecognizer]; mBackGestureRecognizer = nil; } if (GetUIState() != UISTATE_INGAME) { - INFO_LOG(SYSTEM, "Adding swipe gesture."); + INFO_LOG(Log::System, "Adding swipe gesture."); mBackGestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:) ]; [mBackGestureRecognizer setEdges:UIRectEdgeLeft]; [[self view] addGestureRecognizer:mBackGestureRecognizer]; @@ -552,13 +552,13 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { input.flags = KEY_DOWN | KEY_UP; input.keyCode = NKCODE_DEL; NativeKey(input); - INFO_LOG(SYSTEM, "Backspace"); + INFO_LOG(Log::System, "Backspace"); } -(void) insertText:(NSString *)text { std::string str([text UTF8String]); - INFO_LOG(SYSTEM, "Chars: %s", str.c_str()); + INFO_LOG(Log::System, "Chars: %s", str.c_str()); SendKeyboardChars(str); } @@ -574,14 +574,14 @@ void GLRenderLoop(IOSGLESContext *graphicsContext) { -(void) showKeyboard { dispatch_async(dispatch_get_main_queue(), ^{ - INFO_LOG(SYSTEM, "becomeFirstResponder"); + INFO_LOG(Log::System, "becomeFirstResponder"); [self becomeFirstResponder]; }); } -(void) hideKeyboard { dispatch_async(dispatch_get_main_queue(), ^{ - INFO_LOG(SYSTEM, "resignFirstResponder"); + INFO_LOG(Log::System, "resignFirstResponder"); [self resignFirstResponder]; }); } diff --git a/ios/ViewControllerMetal.mm b/ios/ViewControllerMetal.mm index 0fd0a45969..f45c2cc43e 100644 --- a/ios/ViewControllerMetal.mm +++ b/ios/ViewControllerMetal.mm @@ -74,15 +74,15 @@ private: IOSVulkanContext::IOSVulkanContext() {} bool IOSVulkanContext::InitFromRenderThread(CAMetalLayer *layer, int desiredBackbufferSizeX, int desiredBackbufferSizeY) { - INFO_LOG(G3D, "IOSVulkanContext::InitFromRenderThread: desiredwidth=%d desiredheight=%d", desiredBackbufferSizeX, desiredBackbufferSizeY); + INFO_LOG(Log::G3D, "IOSVulkanContext::InitFromRenderThread: desiredwidth=%d desiredheight=%d", desiredBackbufferSizeX, desiredBackbufferSizeY); if (!g_Vulkan) { - ERROR_LOG(G3D, "IOSVulkanContext::InitFromRenderThread: No Vulkan context"); + ERROR_LOG(Log::G3D, "IOSVulkanContext::InitFromRenderThread: No Vulkan context"); return false; } VkResult res = g_Vulkan->InitSurface(WINDOWSYSTEM_METAL_EXT, (__bridge void *)layer, nullptr); if (res != VK_SUCCESS) { - ERROR_LOG(G3D, "g_Vulkan->InitSurface failed: '%s'", VulkanResultToString(res)); + ERROR_LOG(Log::G3D, "g_Vulkan->InitSurface failed: '%s'", VulkanResultToString(res)); return false; } @@ -105,7 +105,7 @@ bool IOSVulkanContext::InitFromRenderThread(CAMetalLayer *layer, int desiredBack success = false; } - INFO_LOG(G3D, "IOSVulkanContext::Init completed, %s", success ? "successfully" : "but failed"); + INFO_LOG(Log::G3D, "IOSVulkanContext::Init completed, %s", success ? "successfully" : "but failed"); if (!success) { g_Vulkan->DestroySwapchain(); g_Vulkan->DestroySurface(); @@ -116,7 +116,7 @@ bool IOSVulkanContext::InitFromRenderThread(CAMetalLayer *layer, int desiredBack } void IOSVulkanContext::ShutdownFromRenderThread() { - INFO_LOG(G3D, "IOSVulkanContext::Shutdown"); + INFO_LOG(Log::G3D, "IOSVulkanContext::Shutdown"); draw_->HandleEvent(Draw::Event::LOST_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); delete draw_; draw_ = nullptr; @@ -124,20 +124,20 @@ void IOSVulkanContext::ShutdownFromRenderThread() { g_Vulkan->PerformPendingDeletes(); g_Vulkan->DestroySwapchain(); g_Vulkan->DestroySurface(); - INFO_LOG(G3D, "Done with ShutdownFromRenderThread"); + INFO_LOG(Log::G3D, "Done with ShutdownFromRenderThread"); } void IOSVulkanContext::Shutdown() { - INFO_LOG(G3D, "Calling NativeShutdownGraphics"); + INFO_LOG(Log::G3D, "Calling NativeShutdownGraphics"); g_Vulkan->DestroyDevice(); g_Vulkan->DestroyInstance(); // We keep the g_Vulkan context around to avoid invalidating a ton of pointers around the app. finalize_glslang(); - INFO_LOG(G3D, "IOSVulkanContext::Shutdown completed"); + INFO_LOG(Log::G3D, "IOSVulkanContext::Shutdown completed"); } void IOSVulkanContext::Resize() { - INFO_LOG(G3D, "IOSVulkanContext::Resize begin (oldsize: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); + INFO_LOG(Log::G3D, "IOSVulkanContext::Resize begin (oldsize: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); draw_->HandleEvent(Draw::Event::LOST_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); g_Vulkan->DestroySwapchain(); @@ -148,23 +148,23 @@ void IOSVulkanContext::Resize() { g_Vulkan->ReinitSurface(); g_Vulkan->InitSwapchain(); draw_->HandleEvent(Draw::Event::GOT_BACKBUFFER, g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); - INFO_LOG(G3D, "IOSVulkanContext::Resize end (final size: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); + INFO_LOG(Log::G3D, "IOSVulkanContext::Resize end (final size: %dx%d)", g_Vulkan->GetBackbufferWidth(), g_Vulkan->GetBackbufferHeight()); } bool IOSVulkanContext::InitAPI() { - INFO_LOG(G3D, "IOSVulkanContext::Init"); + INFO_LOG(Log::G3D, "IOSVulkanContext::Init"); init_glslang(); g_LogOptions.breakOnError = true; g_LogOptions.breakOnWarning = true; g_LogOptions.msgBoxOnError = false; - INFO_LOG(G3D, "Creating Vulkan context"); + INFO_LOG(Log::G3D, "Creating Vulkan context"); Version gitVer(PPSSPP_GIT_VERSION); std::string errorStr; if (!VulkanLoad(&errorStr)) { - ERROR_LOG(G3D, "Failed to load Vulkan driver library: %s", errorStr.c_str()); + ERROR_LOG(Log::G3D, "Failed to load Vulkan driver library: %s", errorStr.c_str()); state_ = GraphicsContextState::FAILED_INIT; return false; } @@ -189,7 +189,7 @@ bool IOSVulkanContext::InitAPI() { return VkExtent2D {(uint32_t)g_display.pixel_xres, (uint32_t)g_display.pixel_yres}; }); - INFO_LOG(G3D, "Vulkan device created!"); + INFO_LOG(Log::G3D, "Vulkan device created!"); state_ = GraphicsContextState::INITIALIZED; return true; } @@ -245,17 +245,17 @@ static std::thread g_renderLoopThread; // Should be very similar to the Android one, probably mergeable. void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLayer) { SetCurrentThreadName("EmuThreadVulkan"); - INFO_LOG(G3D, "Entering EmuThreadVulkan"); + INFO_LOG(Log::G3D, "Entering EmuThreadVulkan"); if (!graphicsContext) { - ERROR_LOG(G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context."); + ERROR_LOG(Log::G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context."); renderLoopRunning = false; exitRenderLoop = false; return; } if (exitRenderLoop) { - WARN_LOG(G3D, "runVulkanRenderLoop: ExitRenderLoop requested at start, skipping the whole thing."); + WARN_LOG(Log::G3D, "runVulkanRenderLoop: ExitRenderLoop requested at start, skipping the whole thing."); renderLoopRunning = false; exitRenderLoop = false; return; @@ -274,7 +274,7 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye // On Android, if we get here, really no point in continuing. // The UI is supposed to render on any device both on OpenGL and Vulkan. If either of those don't work // on a device, we blacklist it. Hopefully we should have already failed in InitAPI anyway and reverted to GL back then. - ERROR_LOG(G3D, "Failed to initialize graphics context."); + ERROR_LOG(Log::G3D, "Failed to initialize graphics context."); System_Toast("Failed to initialize graphics context."); delete graphicsContext; @@ -285,16 +285,16 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye if (!exitRenderLoop) { if (!NativeInitGraphics(graphicsContext)) { - ERROR_LOG(G3D, "Failed to initialize graphics."); + ERROR_LOG(Log::G3D, "Failed to initialize graphics."); // Gonna be in a weird state here.. } graphicsContext->ThreadStart(); while (!exitRenderLoop) { NativeFrame(graphicsContext); } - INFO_LOG(G3D, "Leaving Vulkan main loop."); + INFO_LOG(Log::G3D, "Leaving Vulkan main loop."); } else { - INFO_LOG(G3D, "Not entering main loop."); + INFO_LOG(Log::G3D, "Not entering main loop."); } NativeShutdownGraphics(); @@ -302,24 +302,24 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye graphicsContext->ThreadEnd(); // Shut the graphics context down to the same state it was in when we entered the render thread. - INFO_LOG(G3D, "Shutting down graphics context..."); + INFO_LOG(Log::G3D, "Shutting down graphics context..."); graphicsContext->ShutdownFromRenderThread(); renderLoopRunning = false; exitRenderLoop = false; - WARN_LOG(G3D, "Render loop function exited."); + WARN_LOG(Log::G3D, "Render loop function exited."); } - (bool)runVulkanRenderLoop { - INFO_LOG(G3D, "runVulkanRenderLoop"); + INFO_LOG(Log::G3D, "runVulkanRenderLoop"); if (!graphicsContext) { - ERROR_LOG(G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context."); + ERROR_LOG(Log::G3D, "runVulkanRenderLoop: Tried to enter without a created graphics context."); return false; } if (g_renderLoopThread.joinable()) { - ERROR_LOG(G3D, "runVulkanRenderLoop: Already running"); + ERROR_LOG(Log::G3D, "runVulkanRenderLoop: Already running"); return false; } @@ -329,10 +329,10 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye } - (void)requestExitVulkanRenderLoop { - INFO_LOG(G3D, "requestExitVulkanRenderLoop"); + INFO_LOG(Log::G3D, "requestExitVulkanRenderLoop"); if (!renderLoopRunning) { - ERROR_LOG(SYSTEM, "Render loop already exited"); + ERROR_LOG(Log::System, "Render loop already exited"); return; } _assert_(g_renderLoopThread.joinable()); @@ -343,10 +343,10 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye // These two are forwarded from the appDelegate - (void)didBecomeActive { - INFO_LOG(G3D, "didBecomeActive GL"); + INFO_LOG(Log::G3D, "didBecomeActive GL"); if (self.motionManager.accelerometerAvailable) { self.motionManager.accelerometerUpdateInterval = 1.0 / 60.0; - INFO_LOG(G3D, "Starting accelerometer updates."); + INFO_LOG(Log::G3D, "Starting accelerometer updates."); [self.motionManager startAccelerometerUpdatesToQueue:self.accelerometerQueue withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) { @@ -357,7 +357,7 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye ProcessAccelerometerData(accelerometerData); }]; } else { - INFO_LOG(G3D, "No accelerometer available, not starting updates."); + INFO_LOG(Log::G3D, "No accelerometer available, not starting updates."); } // Spin up the emu thread. It will in turn spin up the Vulkan render thread // on its own. @@ -365,19 +365,19 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye } - (void)willResignActive { - INFO_LOG(G3D, "willResignActive GL"); + INFO_LOG(Log::G3D, "willResignActive GL"); [self requestExitVulkanRenderLoop]; // Stop accelerometer updates if (self.motionManager.accelerometerActive) { - INFO_LOG(G3D, "Stopping accelerometer updates"); + INFO_LOG(Log::G3D, "Stopping accelerometer updates"); [self.motionManager stopAccelerometerUpdates]; } } - (void)shutdown { - INFO_LOG(SYSTEM, "shutdown VK"); + INFO_LOG(Log::System, "shutdown VK"); g_Config.Save("shutdown vk"); @@ -397,11 +397,11 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye - (void)dealloc { - INFO_LOG(SYSTEM, "dealloc VK"); + INFO_LOG(Log::System, "dealloc VK"); } - (void)loadView { - INFO_LOG(G3D, "Creating metal view"); + INFO_LOG(Log::G3D, "Creating metal view"); CGRect screenRect = [[UIScreen mainScreen] bounds]; CGFloat screenWidth = screenRect.size.width; @@ -417,7 +417,7 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye [[DisplayManager shared] setupDisplayListener]; - INFO_LOG(SYSTEM, "Metal viewDidLoad"); + INFO_LOG(Log::System, "Metal viewDidLoad"); UIScreen* screen = [(AppDelegate*)[UIApplication sharedApplication].delegate screen]; self.view.frame = [screen bounds]; @@ -434,7 +434,7 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye [self setupController:[[GCController controllers] firstObject]]; } - INFO_LOG(G3D, "Detected size: %dx%d", g_display.pixel_xres, g_display.pixel_yres); + INFO_LOG(Log::G3D, "Detected size: %dx%d", g_display.pixel_xres, g_display.pixel_yres); cameraHelper = [[CameraHelper alloc] init]; [cameraHelper setDelegate:self]; @@ -458,23 +458,23 @@ void VulkanRenderLoop(IOSVulkanContext *graphicsContext, CAMetalLayer *metalLaye - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - INFO_LOG(G3D, "viewWillAppear"); + INFO_LOG(Log::G3D, "viewWillAppear"); self.view.contentScaleFactor = UIScreen.mainScreen.nativeScale; } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; - INFO_LOG(G3D, "viewWillDisappear"); + INFO_LOG(Log::G3D, "viewWillDisappear"); } - (void)viewDidDisappear:(BOOL)animated { [super viewDidDisappear: animated]; - INFO_LOG(G3D, "viewWillDisappear"); + INFO_LOG(Log::G3D, "viewWillDisappear"); } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; - INFO_LOG(G3D, "viewDidAppear"); + INFO_LOG(Log::G3D, "viewDidAppear"); [self hideKeyboard]; [self updateGesture]; @@ -523,10 +523,10 @@ extern float g_safeInsetBottom; if (GetUIState() == UISTATE_INGAME) { // In-game, we need all the control we can get. Though, we could possibly // allow the top edge? - INFO_LOG(SYSTEM, "Defer system gestures on all edges"); + INFO_LOG(Log::System, "Defer system gestures on all edges"); return UIRectEdgeAll; } else { - INFO_LOG(SYSTEM, "Allow system gestures on the bottom"); + INFO_LOG(Log::System, "Allow system gestures on the bottom"); // Allow task switching gestures to take precedence, without causing // scroll events in the UI. return UIRectEdgeTop | UIRectEdgeLeft | UIRectEdgeRight; @@ -541,16 +541,16 @@ extern float g_safeInsetBottom; } - (void)updateGesture { - INFO_LOG(SYSTEM, "Updating swipe gesture."); + INFO_LOG(Log::System, "Updating swipe gesture."); if (mBackGestureRecognizer) { - INFO_LOG(SYSTEM, "Removing swipe gesture."); + INFO_LOG(Log::System, "Removing swipe gesture."); [[self view] removeGestureRecognizer:mBackGestureRecognizer]; mBackGestureRecognizer = nil; } if (GetUIState() != UISTATE_INGAME) { - INFO_LOG(SYSTEM, "Adding swipe gesture."); + INFO_LOG(Log::System, "Adding swipe gesture."); mBackGestureRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:) ]; [mBackGestureRecognizer setEdges:UIRectEdgeLeft]; [[self view] addGestureRecognizer:mBackGestureRecognizer]; @@ -679,7 +679,7 @@ extern float g_safeInsetBottom; key.keyCode = NKCODE_BACK; key.deviceId = DEVICE_ID_TOUCH; NativeKey(key); - INFO_LOG(SYSTEM, "Detected back swipe"); + INFO_LOG(Log::System, "Detected back swipe"); } } // The below is inspired by https://stackoverflow.com/questions/7253477/how-to-display-the-iphone-ipad-keyboard-over-a-full-screen-opengl-es-app @@ -691,7 +691,7 @@ extern float g_safeInsetBottom; input.flags = KEY_DOWN | KEY_UP; input.keyCode = NKCODE_DEL; NativeKey(input); - INFO_LOG(SYSTEM, "Backspace"); + INFO_LOG(Log::System, "Backspace"); } -(BOOL) hasText @@ -702,7 +702,7 @@ extern float g_safeInsetBottom; -(void) insertText:(NSString *)text { std::string str([text UTF8String]); - INFO_LOG(SYSTEM, "Chars: %s", str.c_str()); + INFO_LOG(Log::System, "Chars: %s", str.c_str()); SendKeyboardChars(str); } diff --git a/ios/iOSCoreAudio.mm b/ios/iOSCoreAudio.mm index f54bd99007..fb1ea97f1c 100644 --- a/ios/iOSCoreAudio.mm +++ b/ios/iOSCoreAudio.mm @@ -34,14 +34,14 @@ static bool g_displayConnected = false; void iOSCoreAudioUpdateSession() { NSError *error = nil; if (g_displayConnected) { - INFO_LOG(AUDIO, "Display connected, setting Playback mode"); + INFO_LOG(Log::Audio, "Display connected, setting Playback mode"); // Special handling when a display is connected. Always exclusive. // Let's revisit this later. [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&error]; return; } - INFO_LOG(AUDIO, "RespectSilentMode: %d MixWithOthers: %d", g_Config.bAudioRespectSilentMode, g_Config.bAudioMixWithOthers); + INFO_LOG(Log::Audio, "RespectSilentMode: %d MixWithOthers: %d", g_Config.bAudioRespectSilentMode, g_Config.bAudioMixWithOthers); // Hacky hack to force iOS to re-evaluate. // Switching from CatogoryPlayback to CategoryPlayback with an option otherwise does nothing. @@ -114,7 +114,7 @@ void iOSCoreAudioInit() NSError *error = nil; AVAudioSession *session = [AVAudioSession sharedInstance]; if (![session setActive:YES error:&error]) { - ERROR_LOG(SYSTEM, "Failed to activate AVFoundation audio session"); + ERROR_LOG(Log::System, "Failed to activate AVFoundation audio session"); if (error.localizedDescription) { NSLog(@"%@", error.localizedDescription); } diff --git a/ios/main.mm b/ios/main.mm index 3ac7eda183..6477c6b0c3 100644 --- a/ios/main.mm +++ b/ios/main.mm @@ -503,7 +503,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string */ case SystemRequestType::SET_KEEP_SCREEN_BRIGHT: dispatch_async(dispatch_get_main_queue(), ^{ - INFO_LOG(SYSTEM, "SET_KEEP_SCREEN_BRIGHT: %d", (int)param3); + INFO_LOG(Log::System, "SET_KEEP_SCREEN_BRIGHT: %d", (int)param3); [[UIApplication sharedApplication] setIdleTimerDisabled: (param3 ? YES : NO)]; }); return true; @@ -587,17 +587,17 @@ int main(int argc, char *argv[]) // see https://github.com/hrydgard/ppsspp/issues/11905 if (jb_spawn_ptrace_child(argc, argv)) { - INFO_LOG(SYSTEM, "JIT: ptrace() child spawn trick\n"); + INFO_LOG(Log::System, "JIT: ptrace() child spawn trick\n"); } else if (jb_has_jit_entitlement()) { - INFO_LOG(SYSTEM, "JIT: found entitlement\n"); + INFO_LOG(Log::System, "JIT: found entitlement\n"); } else if (jb_has_cs_disabled()) { - INFO_LOG(SYSTEM, "JIT: CS_KILL disabled\n"); + INFO_LOG(Log::System, "JIT: CS_KILL disabled\n"); } else if (jb_has_cs_execseg_allow_unsigned()) { - INFO_LOG(SYSTEM, "JIT: CS_EXECSEG_ALLOW_UNSIGNED set\n"); + INFO_LOG(Log::System, "JIT: CS_EXECSEG_ALLOW_UNSIGNED set\n"); } else if (jb_enable_ptrace_hack()) { - INFO_LOG(SYSTEM, "JIT: ptrace() hack supported\n"); + INFO_LOG(Log::System, "JIT: ptrace() hack supported\n"); } else { - INFO_LOG(SYSTEM, "JIT: ptrace() hack failed\n"); + INFO_LOG(Log::System, "JIT: ptrace() hack failed\n"); g_jitAvailable = false; } diff --git a/libretro/LibretroD3D11Context.cpp b/libretro/LibretroD3D11Context.cpp index 2a9da24dc4..5e1c6ab953 100644 --- a/libretro/LibretroD3D11Context.cpp +++ b/libretro/LibretroD3D11Context.cpp @@ -23,18 +23,18 @@ void LibretroD3D11Context::CreateDrawContext() { std::vector adapterNames; if (!Libretro::environ_cb(RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE, (void **)&d3d11_) || !d3d11_) { - ERROR_LOG(G3D, "Failed to get HW rendering interface!\n"); + ERROR_LOG(Log::G3D, "Failed to get HW rendering interface!\n"); return; } if (d3d11_->interface_version != RETRO_HW_RENDER_INTERFACE_D3D11_VERSION) { - ERROR_LOG(G3D, "HW render interface mismatch, expected %u, got %u!\n", RETRO_HW_RENDER_INTERFACE_D3D11_VERSION, d3d11_->interface_version); + ERROR_LOG(Log::G3D, "HW render interface mismatch, expected %u, got %u!\n", RETRO_HW_RENDER_INTERFACE_D3D11_VERSION, d3d11_->interface_version); return; } // Reject lower feature levels. We have D3D9 for these ancient GPUs. if (d3d11_->featureLevel < D3D_FEATURE_LEVEL_10_0) { - ERROR_LOG(G3D, "D3D11 featureLevel not high enough - rejecting!\n"); + ERROR_LOG(Log::G3D, "D3D11 featureLevel not high enough - rejecting!\n"); return; } diff --git a/libretro/LibretroGLCoreContext.cpp b/libretro/LibretroGLCoreContext.cpp index 98fc09ca08..f2c9306744 100644 --- a/libretro/LibretroGLCoreContext.cpp +++ b/libretro/LibretroGLCoreContext.cpp @@ -19,7 +19,7 @@ void LibretroGLCoreContext::CreateDrawContext() { if (!glewInitDone) { #if !PPSSPP_PLATFORM(IOS) && !defined(USING_GLES2) if (glewInit() != GLEW_OK) { - ERROR_LOG(G3D, "glewInit() failed.\n"); + ERROR_LOG(Log::G3D, "glewInit() failed.\n"); return; } #endif diff --git a/libretro/LibretroGraphicsContext.cpp b/libretro/LibretroGraphicsContext.cpp index f79c197e9c..91d953b13c 100644 --- a/libretro/LibretroGraphicsContext.cpp +++ b/libretro/LibretroGraphicsContext.cpp @@ -40,7 +40,7 @@ LibretroHWRenderContext::LibretroHWRenderContext(retro_hw_context_type context_t } void LibretroHWRenderContext::ContextReset() { - INFO_LOG(G3D, "Context reset"); + INFO_LOG(Log::G3D, "Context reset"); if (gpu && Libretro::useEmuThread) { Libretro::EmuThreadPause(); @@ -68,7 +68,7 @@ void LibretroHWRenderContext::ContextReset() { } void LibretroHWRenderContext::ContextDestroy() { - INFO_LOG(G3D, "Context destroy"); + INFO_LOG(Log::G3D, "Context destroy"); if (Libretro::useEmuThread) { Libretro::EmuThreadStop(); diff --git a/libretro/LibretroVulkanContext.cpp b/libretro/LibretroVulkanContext.cpp index c7e125ba6c..2d218347e7 100644 --- a/libretro/LibretroVulkanContext.cpp +++ b/libretro/LibretroVulkanContext.cpp @@ -35,7 +35,7 @@ static bool create_device(retro_vulkan_context *context, VkInstance instance, Vk if (!VulkanLoad(&errorStr)) { // TODO: In the context of RetroArch, someone has already loaded the functions. // But grabbing the pointers for ourselves can't really be a bad thing. - ERROR_LOG(G3D, "RetroArch called the Vulkan entry point without Vulkan available??? %s", errorStr.c_str()); + ERROR_LOG(Log::G3D, "RetroArch called the Vulkan entry point without Vulkan available??? %s", errorStr.c_str()); return false; } @@ -117,11 +117,11 @@ bool LibretroVulkanContext::Init() { void LibretroVulkanContext::ContextReset() { retro_hw_render_interface *vulkan; if (!Libretro::environ_cb(RETRO_ENVIRONMENT_GET_HW_RENDER_INTERFACE, (void **)&vulkan) || !vulkan) { - ERROR_LOG(G3D, "Failed to get HW rendering interface!\n"); + ERROR_LOG(Log::G3D, "Failed to get HW rendering interface!\n"); return; } if (vulkan->interface_version != RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION) { - ERROR_LOG(G3D, "HW render interface mismatch, expected %u, got %u!\n", RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION, vulkan->interface_version); + ERROR_LOG(Log::G3D, "HW render interface mismatch, expected %u, got %u!\n", RETRO_HW_RENDER_INTERFACE_VULKAN_VERSION, vulkan->interface_version); return; } vk_libretro_set_hwrender_interface(vulkan); @@ -130,7 +130,7 @@ void LibretroVulkanContext::ContextReset() { } void LibretroVulkanContext::ContextDestroy() { - INFO_LOG(G3D, "LibretroVulkanContext::ContextDestroy()"); + INFO_LOG(Log::G3D, "LibretroVulkanContext::ContextDestroy()"); vk->WaitUntilQueueIdle(); LibretroHWRenderContext::ContextDestroy(); } diff --git a/libretro/libretro.cpp b/libretro/libretro.cpp index f91b3f0f19..586ebd9036 100644 --- a/libretro/libretro.cpp +++ b/libretro/libretro.cpp @@ -68,7 +68,7 @@ #define SAMPLERATE 44100 -/* Audio output buffer */ +/* AUDIO output buffer */ static struct { int16_t *data; int32_t size; @@ -1452,7 +1452,7 @@ bool retro_load_game(const struct retro_game_info *game) retro_pixel_format fmt = retro_pixel_format::RETRO_PIXEL_FORMAT_XRGB8888; if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) { - ERROR_LOG(SYSTEM, "XRGB8888 is not supported.\n"); + ERROR_LOG(Log::System, "XRGB8888 is not supported.\n"); return false; } @@ -1460,7 +1460,7 @@ bool retro_load_game(const struct retro_game_info *game) coreState = CORE_POWERUP; ctx = LibretroGraphicsContext::CreateGraphicsContext(); - INFO_LOG(SYSTEM, "Using %s backend", ctx->Ident()); + INFO_LOG(Log::System, "Using %s backend", ctx->Ident()); Core_SetGraphicsContext(ctx); SetGPUBackend((GPUBackend)g_Config.iGPUBackend); @@ -1492,7 +1492,7 @@ bool retro_load_game(const struct retro_game_info *game) std::string error_string; if (!PSP_InitStart(coreParam, &error_string)) { - ERROR_LOG(BOOT, "%s", error_string.c_str()); + ERROR_LOG(Log::Boot, "%s", error_string.c_str()); return false; } @@ -1539,7 +1539,7 @@ void retro_reset(void) if (!PSP_Init(PSP_CoreParameter(), &error_string)) { - ERROR_LOG(BOOT, "%s", error_string.c_str()); + ERROR_LOG(Log::Boot, "%s", error_string.c_str()); environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, nullptr); } } @@ -1638,7 +1638,7 @@ void retro_run(void) if (!PSP_IsInited()) { - ERROR_LOG(BOOT, "%s", error_string.c_str()); + ERROR_LOG(Log::Boot, "%s", error_string.c_str()); environ_cb(RETRO_ENVIRONMENT_SHUTDOWN, nullptr); return; } diff --git a/libretro/libretro.h b/libretro/libretro.h index fe020d64ab..5068ca107a 100644 --- a/libretro/libretro.h +++ b/libretro/libretro.h @@ -1054,9 +1054,9 @@ enum retro_mod * so the core may decide to skip generating a frame or generating audio. * This is mainly used for increasing performance. * Bit 0 (value 1): Enable Video - * Bit 1 (value 2): Enable Audio + * Bit 1 (value 2): Enable AUDIO * Bit 2 (value 4): Use Fast Savestates. - * Bit 3 (value 8): Hard Disable Audio + * Bit 3 (value 8): Hard Disable AUDIO * Other bits are reserved for future use and will default to zero. * If video is disabled: * * The frontend wants the core to not generate any video, @@ -1079,14 +1079,14 @@ enum retro_mod * * Suggest that the core skips clearing memory. * * Suggest that the core skips resetting the system. * * Suggest that the core may skip validation steps. - * Hard Disable Audio: + * Hard Disable AUDIO: * * Used for a secondary core when running ahead. * * Indicates that the frontend will never need audio from the core. * * Suggests that the core may stop synthesizing audio, but this should not * compromise emulation accuracy. - * * Audio output for the next frame does not matter, and the frontend will + * * AUDIO output for the next frame does not matter, and the frontend will * never need an accurate audio state in the future. - * * State will never be saved when using Hard Disable Audio. + * * State will never be saved when using Hard Disable AUDIO. */ #define RETRO_ENVIRONMENT_GET_MIDI_INTERFACE (48 | RETRO_ENVIRONMENT_EXPERIMENTAL) /* struct retro_midi_interface ** -- @@ -2653,10 +2653,10 @@ struct retro_rumble_interface /* Notifies libretro that audio data should be written. */ typedef void (RETRO_CALLCONV *retro_audio_callback_t)(void); -/* True: Audio driver in frontend is active, and callback is +/* True: AUDIO driver in frontend is active, and callback is * expected to be called regularily. - * False: Audio driver in frontend is paused or inactive. - * Audio callback will not be called until set_state has been + * False: AUDIO driver in frontend is paused or inactive. + * AUDIO callback will not be called until set_state has been * called with true. * Initial state is false (inactive). */ diff --git a/libretro/libretro_vulkan.cpp b/libretro/libretro_vulkan.cpp index 55e7ca102d..c03701ef73 100644 --- a/libretro/libretro_vulkan.cpp +++ b/libretro/libretro_vulkan.cpp @@ -378,7 +378,7 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr_libretro(VkInstan PFN_vkVoidFunction fptr = vkGetInstanceProcAddr_org(instance, pName); if (!fptr) { - ERROR_LOG(G3D, "Failed to load VK instance function: %s", pName); + ERROR_LOG(Log::G3D, "Failed to load VK instance function: %s", pName); return fptr; } diff --git a/unittest/JitHarness.cpp b/unittest/JitHarness.cpp index cf21c59623..3640a96357 100644 --- a/unittest/JitHarness.cpp +++ b/unittest/JitHarness.cpp @@ -84,7 +84,7 @@ double ExecCPUTest(bool clearCache = true) { JitBlockCacheDebugInterface *cache = MIPSComp::jit->GetBlockCacheDebugInterface(); if (cache) { JitBlockDebugInfo block = cache->GetBlockDebugInfo(0); - WARN_LOG(JIT, "Executed %d target instrs, %d IR, for %d orig", (int)block.targetDisasm.size(), (int)block.irDisasm.size(), (int)block.origDisasm.size()); + WARN_LOG(Log::JIT, "Executed %d target instrs, %d IR, for %d orig", (int)block.targetDisasm.size(), (int)block.irDisasm.size(), (int)block.origDisasm.size()); } if (clearCache) diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index 640e8eddb9..f6d2317980 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -479,7 +479,7 @@ bool TestMatrixTranspose() { } void TestGetMatrix(int matrix, MatrixSize sz) { - INFO_LOG(SYSTEM, "Testing matrix %s", GetMatrixNotation(matrix, sz).c_str()); + INFO_LOG(Log::System, "Testing matrix %s", GetMatrixNotation(matrix, sz).c_str()); u8 fullMatrix[16]; u8 cols[4]; @@ -497,8 +497,8 @@ void TestGetMatrix(int matrix, MatrixSize sz) { // int rowName = GetRowName(matrix, sz, i, 0); int colName = cols[i]; int rowName = rows[i]; - INFO_LOG(SYSTEM, "Column %i: %s", i, GetVectorNotation(colName, vsz).c_str()); - INFO_LOG(SYSTEM, "Row %i: %s", i, GetVectorNotation(rowName, vsz).c_str()); + INFO_LOG(Log::System, "Column %i: %s", i, GetVectorNotation(colName, vsz).c_str()); + INFO_LOG(Log::System, "Row %i: %s", i, GetVectorNotation(rowName, vsz).c_str()); u8 colRegs[4]; u8 rowRegs[4]; @@ -519,12 +519,12 @@ void TestGetMatrix(int matrix, MatrixSize sz) { c << (int)fullMatrix[j * 4 + i] << " "; d << (int)rowRegs[j] << " "; } - INFO_LOG(SYSTEM, "Col: %s vs %s", a.str().c_str(), b.str().c_str()); + INFO_LOG(Log::System, "Col: %s vs %s", a.str().c_str(), b.str().c_str()); if (a.str() != b.str()) - INFO_LOG(SYSTEM, "WRONG!"); - INFO_LOG(SYSTEM, "Row: %s vs %s", c.str().c_str(), d.str().c_str()); + INFO_LOG(Log::System, "WRONG!"); + INFO_LOG(Log::System, "Row: %s vs %s", c.str().c_str(), d.str().c_str()); if (c.str() != d.str()) - INFO_LOG(SYSTEM, "WRONG!"); + INFO_LOG(Log::System, "WRONG!"); } }